dsh-dispatch-bridge: Driving the DSH Host with Local Automation

Introduction

DSH (DeepSeek Harness) /api endpoint requires requests to carry a signed Cookie, and obtaining this Cookie mandates a launch token generated within the host process. The token is only passed between the host’s own windows; external programs such as scripts, schedulers, or IDE tasks have no official means to obtain it.

The dsh-dispatch-bridge plugin runs inside the host process and is responsible for writing the host’s local authorization URL and workspace snapshots to disk for local automation clients to use.

Plugin Positioning

dsh-dispatch-bridge is a client plugin provided by maintainer jilan71310. It solves the core problem of enabling local automation programs (scripts, schedulers, IDE tasks, or agents) to create sessions, send prompts, and read responses within a specified DSH workspace through the standard /api endpoint.

Core Functionality

The plugin runs within the host process and refreshes two files every 60 seconds:

File Content
~/.dsh/dispatch/auth-url.txt http://127.0.0.1:<port>/?token=<token> — the host’s authorization local URL
~/.dsh/dispatch/workspaces.json Workspace snapshot containing workspaceId, title, path, sessionIds, default, defaultWorkspaceId, archivedSessionIds

The client only needs to retrieve the token from auth-url.txt once, then perform operations through the standard /api endpoint.

Installation and Enablement

Use the official installation command:

dsh plugin --profile <profile> add github:jilan71310/dsh-dispatch-bridge

You can also install from a local checkout:

dsh plugin --profile <profile> add file:/absolute/path/to/dsh-dispatch-bridge

After installation, restart the host (if the current profile does not support hot-reloading), and verify that ~/.dsh/dispatch/auth-url.txt appears. The plugin respects the DSH_HOME environment variable, maintaining a separate dispatch/ directory for each isolated profile.

Typical Usage

  1. Exchange the token URL for a Cookie
curl -s -o /dev/null -D /dev/null -c cookies.txt "$(cat ~/.dsh/dispatch/auth-url.txt)"
  1. Create a session in a workspace
curl -s -b cookies.txt -H 'Content-Type: application/json' \
  -d '{"type":"client-request","rpcId":"1","method":"session/create","payload":{"args":{"request":{"workspaceId":"<id>"}}}}' \
  http://127.0.0.1:<port>/api/session/create
  1. Send a message
curl -s -b cookies.txt -H 'Content-Type: application/json' \
  -d '{"type":"client-request","rpcId":"2","method":"session/prompt","payload":{"args":{"request":{"requestId":"p2","sessionId":"<sessionId>","mode":"queue","content":[{"type":"text","text":"Hello"}]}}}}' \
  http://127.0.0.1:<port>/api/session/prompt
  1. Read the response from the event stream
curl -s -b cookies.txt -H 'Content-Type: application/json' \
  -d '{"type":"client-request","rpcId":"3","method":"session/page","payload":{"args":{"request":{"address":{"kind":"session","sessionId":"<sessionId>"},"maxMessages":50}}}}' \
  http://127.0.0.1:<port>/api/session/page

The response body is located in the type === "text" block within assistant/message. The turn/end event carries the final status; on success, reason.kind: "completed".

Use Cases and Notes

This plugin is suitable for scenarios where DSH host control is needed from external programs, such as automation scripts, scheduled tasks, IDE tasks, or local agents. Before use, review the source code and license (MIT).

Security notice: auth-url.txt contains the host’s launch token, which is a bearer credential. Whoever holds it has full access to the host. File permissions are POSIX 0600, directory 0700, and the plugin itself initiates no network requests. Do not commit the token to version control, sync it to cloud storage, or paste it into chat.

The plugin can be disabled by setting the environment variable DSH_DISPATCH_BRIDGE=0 (or off).

Ecosystem Context

DSH’s design philosophy is “everything is a plugin.” The community catalog is maintained by an independent site and has no official affiliation with DeepSeek or High-Flyer.

Conclusion

dsh-dispatch-bridge provides a standard pathway for local automation programs to communicate with the DSH host by persisting the authorization URL and workspace snapshots within the host process, simplifying client integration. Full documentation is available at docs/DETAIL.md.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye