agent-mobile/dsh-mobile-gateway

dsh-mobile-gateway

LAN access plugin for the DeepSeek Harness (dsh) web host: token-gated /m/api for the companion mobile app

Uncategorizeddeepseek-harnessdshlan

dsh-mobile-gateway

中文 | English

LAN access plugin for the official DeepSeek Harness (DSH): install one plugin, connect the mobile app. No dsh source modifications, no fork, no rebuild — dsh plugin to install, plain dsh web to run.

What it does

Official dsh web listens on 127.0.0.1 only, and the official CLI refuses --host 0.0.0.0. This plugin opens LAN access using official extension points only. Full usage guide (with the mobile app): USAGE.en.md. Voice mode / live transcription / remote networking (in Chinese): VOICE-AND-NETWORK.md.

ConcernMechanism
Bind all interfacesThe plugin's cordis.patch.yml overrides the webserver row to host: 0.0.0.0 (--port still works; uninstalling restores loopback-only)
Close official /api to loopbackBinding 0.0.0.0 alone auto-trusts every LAN IP (SDK behavior, effectively unauthenticated) — the plugin sets trustedHosts: []; the local browser is unaffected and --trusted-host is inert
RPC surface for the phoneA token-gated /m/api prefix route next to the official /api; admitted requests are forwarded in-process to the official apiProxy via toFetchHandler
Live events/m/api/events.mux and /m/api/events.host WebSocket downlinks, frame-identical to the official ones
Approvals / questions/m/api/respond passes through to the official respond channel
Large imagesRaises attachment limits and the request-body cap together
Management page /m/Loopback-only: one-click token generation/rotation (live via the settings seam, persisted), per-address pairing QR codes, device list with per-device block
Sidebar entryA phone icon beside Settings in the desktop Web GUI opens the management page as an in-page modal (with a one-click full-tab affordance; v0.3.3+, toggle with uiEntry)
Scan-to-pairQR encodes server|token; the companion app (v1.0.36+) fills both fields from one scan

Quick start

npm install -g @deepseek-ai/dsh
dsh plugin --profile web add github:agent-mobile/dsh-mobile-gateway
#   first git install: pnpm asks to allow this package's build script —
#   accept the dsh prompt once. Dev checkout: add link:<repo path> instead.
# set the token (see below), then:
dsh web
# dsh web: http://127.0.0.1:3080 (LAN: http://192.168.1.5:3080)

Configure the token in ~/.dsh/profiles/web/cordis.patch.yml:

- id: mobile-gateway
  config:
    token: a-long-random-secret
    allowSettings: true        # default
    allowCredentials: true     # default
    extraMethods: []
    maxRequestBodyBytes: 750000000

or through the Web GUI settings card (hot-reloads).

The app only changes its path prefix (/api → /m/api, including both WebSocket downlinks); token, envelopes, frame formats, and rpcId correlation are unchanged.

Security notes

  • The token is the key: anyone holding it gets the full whitelisted agent capability (sessions that can run commands on your machine). Use a long random secret.
  • The boundary is your LAN. No public tunnel is included; if you need remote access, put an authenticated tunnel in front and make sure it passes WebSockets.
  • Never add --trusted-host for this setup: it exposes the official /api to the LAN and bypasses this plugin's whitelist.

Compatibility

Verified against @deepseek-ai/dsh 0.1.2-rc.1 (dsh.engines requires >=0.1.2-rc.1). The plugin checks the official seams at startup and fails loudly on an incompatible dsh build instead of serving a half-broken surface.

Development

pnpm install
pnpm test && pnpm run typecheck && pnpm run build
node scripts/e2e-ws-probe.cjs <port> <token>

License

MIT