wenbin-wb/dsh-bridge
wenbin-wb/dsh-bridgeDeepSeek Harness 远程与移动端接入插件:提供局域网扫码直连、Cloudflare 与自建公网隧道,以及微信、QQ、飞书、Telegram 机器人交互,内置安全认证与访问控制。
DSH Mobile 的电脑侧连接器:连上可自建的公网 WSS 中转,手机在 4G/5G 下即可访问这台电脑上的 DSH 会话,电脑不需要公网 IP 也不用组网;中转只做鉴权与转发。
面向:使用者与实现者 · 状态:stable · 最近核对:2026-09-20
The computer half of DSH Mobile: it dials a relay over WSS, so the native iOS client reaches this DSH instance even though the computer has no public IP.
iPhone App ──WSS──▶ Relay(公网,只鉴权与转发)──WSS──▶ this plugin ──HTTP+WS──▶ 127.0.0.1:<port>The connector always talks to the local DSH as 127.0.0.1:, so the host's authority and its trust fence are unaffected: no --trusted-host, no rewritten Host, no new listening port on this machine.
plugins/mobile-link/
├── package.json # type: module, dsh.bundle.patch, bin: dsh-mobile-link
├── cordis.patch.yml # bundle patch: the loader row + config reference
├── lib/
│ ├── index.js # cordis plugin: starts the agent, registers 3 routes
│ ├── link.js # the DLP agent transport: identity, socket, heartbeat, reconnect
│ ├── router.js # frames ⇄ local DSH mux streams, per-device `$events`
│ ├── dlp.js # DLP v1 frame codec (shared with the relay)
│ ├── files.js # phone → computer file transfers (`_link/file*` methods)
│ ├── enroll.js # invite-code redemption, writes ~/.dsh/mobile-link/agent.json
│ ├── journal.js # lifecycle journal: why a relay link was dropped, after the fact
│ ├── routes.js # GET /mobile-link/status, POST /pair-code, GET /qr
│ ├── qr.js # dependency-free QR SVG
│ └── cli.js # dsh-mobile-link: enroll / mint-pair-code
└── test/ # node --test, 100+ tests (no DSH, no network)The connector runs in whichever host runs your DSH. There are two supported hosts today — the official desktop app and the command-line web host — and each keeps its own profile, so you install the plugin into the one you actually use. The connector discovers the local DSH by itself in both (the host hands it the authenticated loopback address); you never type an address or a token.
Command-line web host
dsh plugin --profile web add dsh-plugin-mobile-linkOfficial desktop app — install through the app's own plugin page, or with the CLI that the app ships (…/Resources/runtime/cli/bin/dsh, installable from its settings). The npm dsh refuses this profile on purpose (profile "desktop" is managed exclusively by the Electron application). Two prerequisites matter in practice: let the app start once so it initializes its profile, and quit it completely before installing — otherwise the profile is locked.
# quoting the app's bundled CLI; see docs/ONBOARDING.md for the section titles
"<DeepSeek Harness.app>/Contents/Resources/runtime/cli/bin/dsh" \
plugin --profile desktop add dsh-plugin-mobile-linkThen restart the host (or reload the profile). From a checkout the same command takes a path — the leading ./ matters, because DSH anchors a relative spec against your current directory instead of resolving it inside the profile:
dsh plugin --profile web add ./plugins/mobile-linkdsh-mobile-link enroll --invite <邀请码> --relay wss://<你的站点>/dsh-link…or register it on the relay host with dsh-relay admin agent-register --write-config ~/.dsh/mobile-link/agent.json.
dsh-mobile-link --mint-pair-code # prints JSON: code + relay + agentIdOr open the 移动端连接 panel at the bottom of the sidebar in the DSH client (spec 010) — same code, same QR, with the validity countdown.
else has to be run by hand.
GET /mobile-link/status reports whether the link is up, which devices are attached, and whether this computer is registered yet. Its journal block carries the current process's newest lifecycle events (link opened/closed with the reason, device attached/detached); the counters in it reset when the plugin hot-reloads, so the full history — across restarts — is the JSONL file at journal.path.
All optional; the defaults are what a stock deployment needs. Set them in the plugin's config block (cordis.patch.yml), not by editing this file.
Key · Default · Meaning enabled · true · false stops the outbound link without uninstalling relayUrl · from agent.json · Relay base URL; a bare deployment dials /link/agent agentId / agentSecret · from agent.json · Override the enrolled identity stateFile · ~/.dsh/mobile-link/agent.json · Where the identity lives journalFile · ~/.dsh/mobile-link/link-events.jsonl · Lifecycle journal (rotated once at 256 KiB); false keeps it in memory only slowRequestMs · 2000 · A slower single request gets its own request.slow entry; 0 disables those (per-attach device.summary is still written) diagnostics · true · false refuses the phone's phase uploads; the phone ignores the refusal and stays connected dshUrl · discovery · Explicit local DSH base URL (usually unnecessary — the host hands the connector its own address) heartbeatMs · 20000 · DLP ping interval
The connector does not read an endpoint handoff file any more: discovery happens inside the host process (ctx.inject(['webServer','connection'])), which is what makes one npm package work on both the desktop app and the command-line host. It writes one instead — $DSH_HOME/mobile-link/endpoint.json, mode 0600 — for tools that run *outside* the host (our dev/test scripts and the iOS integration helpers).
Address resolution order: this config block, then DSH_RELAY_URL (or DSH_MOBILE_LINK_RELAY), then the enrolled identity file, then the repository placeholder wss://relay.example.com/dsh-link — the placeholder being the "nothing configured yet" sentinel rather than a real address.
inject is empty and the routes are attached throughctx.inject([...]), so a future DSH that renames or drops webServer / connection cannot make the tunnel fatal on boot.
lib/ is imported and no DSHbusiness API is touched: the connector forwards frames, it does not interpret sessions. The relay has the same property.
cordis.patch.yml, or bysetting enabled: false.
cd plugins/mobile-link && npm test # zero dependenciesThe wire protocol is specified in docs/RELAY-PROTOCOL.md.
MIT.