Ghost Downloader Adapter: Unifying Agent Download Queues with ghd

Introduction

DeepSeek Harness (DSH) adopts a “everything is a plugin” architecture, where developers register tools to agents via plugins to extend capabilities. Download operations are prone to repeated failures over unstable networks, and improvements like retries and resume are difficult to implement at the caller level in place. Ghost Downloader is a desktop download tool with built-in support for resumable downloads, multi-threading, and retry on failure. This plugin leverages its official CLI tool ghd to unify download queue management: downloads initiated by the AI and those initiated manually from the desktop share the same queue, progress is visible in the UI, and the default destination is bound to the session working directory so the agent can read back files.

Plugin Positioning

  • Name: dsh-ghost-download
  • Maintainer: a-molecule-of-ATP
  • Type: Workflow plugin
  • Core value: Acts as an adapter that reuses the user’s existing Ghost Downloader engine without adding a new downloader or migrating queues. The agent invokes it via the ghd CLI and shares the same queue with the desktop app.

Core Capabilities

The plugin registers 8 tools to the agent, all routed through the ghd CLI:

  • ghost_download: Submit one or multiple links for download. Supports http/https/ftp/magnet/ed2k, .torrent URLs, and HLS/DASH manifests. Parameters include target directory dir, file index select, rename name, request headers headers, same-name conflict policy conflict (default keep), useGhostFolder (ignores dir, defers to Ghost’s own rules), precheck (uses ghd probe before submission to check disk space and same-name files; report-only, no auto-skip), and waitSeconds (synchronous wait duration).
  • ghost_probe: Preview a link only. Returns the resolved filename, size, and file list (for torrents, this provides the file index needed for select). Results are cached for 5 minutes; fresh:true forces a re-probe.
  • ghost_tasks: List all current Ghost tasks with their status and progress. Filterable by status, or use limit to cap the number of results returned (newest first).
  • ghost_task: View details of a single task (status, progress, files, errors). Failed tasks include a diagnosis (certificate/DNS/authentication/resource-not-found/range-request, etc.) and a suggested action.
  • ghost_control: Control tasks — pause to pause, start to resume/start, retry to retry (optionally specify taskIds; if omitted, retries all failed tasks), remove to delete (deletes files of the task that haven’t finished yet, can be disabled in settings; deleteFiles:true also deletes already-produced files).
  • ghost_wait: Block until a task stops running (completed/failed/paused/removed), then report the final status. timeoutSeconds defaults to 600 seconds, clamped by the waitLimitSeconds upper bound. Optional checksum parameter for integrity verification supports md5/sha1/sha256/sha512/crc32, with the algorithm auto-detected by length.
  • ghost_stats: Aggregate status counts and total byte size for tasks currently visible in the queue. Ghost does not retain history, so only the current queue is summarized.
  • ghost_doctor: Read-only health check. Verifies ghd availability, live tasks, small-file network/certificate probe, session download directory writability, and cross-checks against Ghost’s UserConfig.json.

Two additional non-tool capabilities are provided:

  • Sidebar “Ghost Download Queue” panel: Displays download progress in real time on the right side of the Web client, polling a queue snapshot cached for 3 seconds every 5 seconds.
  • Shell download interception: Rejects curl -o / curl -O / wget by default and redirects the model to ghost_download (can be disabled via blockShellDownloads).

Installation & Activation

This plugin is installed via link: and requires linking the plugin package to your profile.

  1. Place the plugin package (containing cordis.patch.yml, package.json, etc.) into your profile directory.
  2. Insert the following into your profile’s cordis.patch.yml:
- insert:
    - id: ghost-download
      name: '@local/dsh-ghost-download'
  1. Configure ghdPath in the DSH plugin page, pointing to ghd.exe (by default, it probes the GHOST_GHD / GHD_PATH environment variables, standard install directories, and finally falls back to PATH).

Configuration Options

The plugin provides 12 configuration items, all marked .volatile() and taking effect immediately upon save:

Field Type Default Description
enabled boolean true When disabled, no ghost_* tools are registered
ghdPath string "" Path to ghd.exe; auto-detect if left empty
pollIntervalMs natural 5000 Background polling interval (ms, minimum 1000)
blockShellDownloads boolean true Reject curl -o / curl -O / wget
maxUrlsPerCall natural 50 Max links per ghost_download call
waitLimitSeconds natural 3600 Synchronous wait upper bound (10–7200)
watchLimitMinutes natural 30 Per-task background watch upper bound (minutes)
maxOutputChars natural 20000 Max characters in successful result (min 500)
maxErrorChars natural 2000 Max characters in error output (min 200)
allowedUrlSchemes string[] ["http","https","ftp","magnet","ed2k"] Protocol whitelist
controlRemoveEnabled boolean true Whether to allow remove in ghost_control
noticeIncludePath boolean true Whether notifications include the absolute file path

Typical Usage

  1. Submit a download and wait synchronously for completion:
ghost_download(
  urls: ["https://example.com/file.zip", "magnet:?xt=urn:btih:..."],
  dir: "/path/to/session/downloads",
  conflict: "keep",
  waitSeconds: 600
)
  1. Preview a link and select a torrent file index:
probe_result = ghost_probe(urls=["..."], fresh: true)
select = probe_result.files[0].index
ghost_download(urls=["..."], select: select)
  1. Wait for a task to complete and verify its md5:
result = ghost_wait(
  taskId: "tsk_0123",
  timeoutSeconds: 600,
  checksum: "md5:5d41402abc4b2a76b9719d911017c592"
)
  1. View task details and attempt a retry:
task = ghost_task(taskId: "tsk_0123")
ghost_control(taskIds: ["tsk_0123"], action: "retry")
  1. Run a health check on the current queue:
health = ghost_doctor()

Use Cases & Caveats

  • The ghd CLI tool of Ghost Downloader must be installed in advance (install via “Settings → Command-Line Tools” in the desktop app).
  • The plugin runs with the permissions of the current DSH process. Review the source code and license (MIT) before installing.
  • Same-name conflict defaults to keep; passing overwrite will overwrite existing files.
  • ghost_probe results are cached for 5 minutes. Header values containing cookies/tokens will appear in the local process list as CLI arguments — handle sensitive headers with care.
  • Task IDs follow the format tsk_0123; ghost_task / ghost_control / ghost_wait only accept this format.
  • Up to 50 links per call (limited by the 32K Windows command-line constraint); exported results are truncated to maxOutputChars / maxErrorChars.
  • Background watching has limits: 30 minutes per task, or stops after 10 consecutive CLI failures or 3 session disconnections.

Value Recap

This plugin unifies the download queue into Ghost Downloader via the official ghd CLI, letting the agent and the desktop app share the same queue. It reuses resumable download and retry capabilities, binds the default destination to the session working directory for easy file read-back by the agent. It provides 8 tools, a sidebar queue panel, and shell download interception — an adapter, not a new downloader. Ideal for scenarios where the agent and desktop app need to share a download queue and manage download progress uniformly.

  • Plugin directory page: https://www.skillhub.cn/plugins/a-molecule-of-ATP/dsh-ghost-download
  • GitHub repository: https://github.com/a-molecule-of-ATP/dsh-ghost-download
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye