Skip to main content
E

dsh-download-router

elgwia-dsh/dsh-download-router

Routes every download across seven transports (node, python, curl, wget, aria2c, PowerShell, BITS) plus mirror variants, picks the fastest route against a baseline measured at setup, and exposes download, download_status and download_baseline tools.

Install

dsh plugin --profile web add github:elgwia-dsh/dsh-download-router

README

dsh-download-router

English · 简体中文

A small DeepSeek Harness plugin that plugs in download-router.

It does not download anything itself. It gives the AI three extra tools and hands the work to that scheduler — the route picking, speed tests and retries all run there, so they cost no model reasoning and no tokens.

This repository is the DSH plugin. The downloader itself lives in the download-router repository.

The three tools

ToolHow to call itWhat it does
downloadgive a link; optionally a path, checksum, timeout, modepicks the best route and downloads the file
download_statusno argumentsshows the current mode, whether the proxy is up, which routes exist, and the last measured speeds
download_baselineoptionally a modemeasures every route again

download also takes special: ytdlp for video pages, git for repositories.

How it works

AI calls a tool
   ↓
plugin (dsh/index.js)
   · tidies up the config
   · writes it to a temporary JSON
   · starts the scheduler CLI
   · reads the result back
   ↓
scheduler (download-router/bin/dl.js)
   detect → measure → pick → download → degrade → fall back
   ↓
returns: did it work, where it went, which route, how fast

Three things are on purpose:

The plugin stays thin. It never touches the scheduler's internals — it finds it, passes arguments, reads a result. Upgrading the downloader never means editing plugin code.

Results travel in files, not pipes. In a restricted sandbox, Windows refuses to create pipes (EPERM). So the plugin writes the request to a temp file, throws away all command-line output, and reads the answer from another file. Bonus: a long download never blocks the rest of the plugin.

Config is translated, not copied. Whatever you set in the profile — download folder, data folder, proxy — is written into a one-off JSON and passed to the scheduler. The downloader's own config file is never modified.

How it finds the downloader

In this order, first hit wins:

  1. the DL_ROUTER_CLI environment variable (pointing at bin/dl.js)
  2. node_modules/download-router (a normal install)
  3. a sibling ../download-router folder (two repos side by side)

The third one is for development: put both folders next to each other and it runs, no publishing needed.

Install

From the plugin market

In DSH: Settings → Plugin market → Add index, and enter:

https://raw.githubusercontent.com/Elgwia-dsh/dsh-download-router/main/market/index.json

Then install dsh-download-router from Discover. The downloader comes with it as a dependency.

Side-by-side clone

plugins/
  download-router/        # the downloader
  dsh-download-router/    # this plugin

Add it to your profile and run pnpm install:

"dependencies": { "dsh-download-router": "link:/path/to/dsh-download-router" },
"dsh": { "profile": { "bundles": ["...", "dsh-download-router"] } }

The first install needs one host restart, or turn the entry off and on in the plugin panel.

Configuration

The plugin ships with generic defaults only. Anything specific to this machine goes in the profile patch:

- id: download-router
  name: 'dsh-download-router'
  config:
    destDir: '~/Downloads'
    dataDir: '~/.download-router'
    proxy:
      url: 'http://127.0.0.1:7890'
      autoStart: true
      exe: '/path/to/mihomo'
      configDir: '~/.config/clash'
      profile: '~/.config/clash/profiles/xxx.yml'

Empty values are dropped, not forwarded: an empty destDir would overwrite the downloader's own default with nothing.

Requirements

  • Node 18 or newer
  • the download-router package (installed as a dependency, or sitting next to this one)
  • at least one working route — the built-in node one is enough
  • python, curl, wget, aria2c, yt-dlp and git are all optional

What it cannot do

  • In a sandbox, curl, PowerShell and BITS do not work (the system TLS stack cannot get credentials). That is a permission limit.
  • Multi-threaded sharding is off by default.
  • The result passes through temporary files, so the data folder must be writable; when it is not, the downloader falls back to the system temp folder.

License

MIT

Related plugins