Skip to content

About

Drive the DeepSeek Harness on your PC from your phone — over LAN or the public internet via a secure Tailscale mesh. Loopback-only, token-gated.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

DSH-Remote

Drive the DeepSeek Harness running on your PC from your phone — over the home LAN or over the public internet (4G / 5G), through a secure Tailscale mesh. Every file, command, session, and API key stays on the PC; the phone is just a screen and a keyboard.

English | 中文

What this is not: this is the remote-control distribution — the agent runs on your PC, and your phone drives it from anywhere. For running the agent directly on an Android phone (Termux), see the sibling on-device distribution.


Features

  • Two reachability modes, one security model. LAN (home WiFi, plain HTTP) and public (Tailscale mesh + real *.ts.net certificate TLS). In both modes the harness binds loopback only — no public port is ever opened.
  • Bearer-token gate, fail-closed. Every /api request and event stream must present the token; no token = 401. Mesh membership is reachability; the token is authorization.
  • API key never leaves the PC. The web channel only reports whether a credential is configured — it never returns the value.
  • Single shared session. Desktop browser and phone connect to the same harness instance and share the same conversation.

Screenshots

Connection settings Token gate
connection settings token request
Workspace picker Chat with the agent
workspace picker chat

How it works

Phone (4G/5G or any WiFi)                              Home PC
┌──────────────────┐   HTTPS/WSS    ┌──────────────────────────────┐
│ DSH Remote App    │ ─────────────▶ │ tailscale serve (TLS term.)  │
│ https://pc.x.ts.net│◀───────────── │   *.ts.net auto cert         │
└──────────────────┘                │      │ http://127.0.0.1:3080 │
        ▲                           │ dsh web (loopback + token)   │
        └──── Tailscale VPN ───────▶│ agent/files/session/key on PC│
        (WireGuard end-to-end)      └──────────────────────────────┘

The harness stays bound to 127.0.0.1 — reachability comes from the mesh, not a port mapping. TLS is terminated by tailscale serve with a real certificate; the token adds an application layer inside the mesh. See docs/plan-and-risk.md for the full design and threat analysis.

Quick start

Prerequisites

  • PC: Node.js + the deepseek-harness source checkout (the launcher scripts start the harness with pnpm dsh --profile web, so they must run from the source tree — node_modules/ and packages/ present), plus Tailscale installed & signed in (winget install tailscale.tailscale, then tailscale up).
  • Phone: the DSH Remote shell APK (release-signed, R8-minified), plus the Tailscale Android app from the friend repo — their official APK (~105 MB), not bundled here.
  • Tailnet: MagicDNS and HTTPS certificates enabled (admin console → DNS).

1. Public remote (Tailscale)

Deployment prerequisite: these scripts start the harness with pnpm dsh --profile web, which depends on the deepseek-harness source tree's own workspace (node_modules/ + packages/) — they won't run from this DSH-Remote repo. Apply the patch patches/harness-all-changes.patch to that checkout first (it carries the bearer-token gate and dsh remote; git apply --binary from the source tree root), then copy the two scripts from scripts/ into the source tree's scripts/ directory, and run from the source tree root:

# Windows
.\scripts\dsh-remote-tailscale.ps1 -Port 3090
# macOS / Linux
scripts/dsh-remote-tailscale.sh --port 3090

The script validates the tailscale login, derives your tailnet DNS name, generates a fresh bearer token, registers tailscale serve (loopback target only), and starts the harness. The terminal prints the public URL and the token:

dsh-remote-tailscale: tailnet name : pc-name.tailxxxx.ts.net
dsh-remote-tailscale: harness bind : 127.0.0.1:3090 (loopback only - no public port)
dsh-remote-tailscale: bearer token : <token>
dsh-remote-tailscale: public URL   : https://pc-name.tailxxxx.ts.net
  • Desktop: open http://127.0.0.1:3090, paste the token.
  • Phone: open the Tailscale app (VPN ON), then open https://pc-name.tailxxxx.ts.net in the browser or the DSH Remote app, and paste the same token.

Stop: .\scripts\dsh-remote-tailscale.ps1 -Stop (removes the serve config), then Ctrl+C in the harness terminal.

2. LAN remote

dsh remote --token "$(openssl rand -hex 32)"

Open http://<PC LAN IP>:3080 in the phone browser, paste the printed token once. See docs/cookbook-lan.md.

3. Recovery — corrupt session log

If a session fails to restore with seq gap in committed region, a second harness instance once wrote to the same log. Close every harness instance, then run the repair tool.

The scripts/repair-session-log.ts copy in this repo is a reference snapshot. It imports from the harness source tree (packages/…, @deepseek-ai/dsh-session), so run it from your deepseek-harness source checkout (which has node_modules + packages/), not from this repo:

# from the deepseek-harness source checkout (repo root)
pnpm exec tsx scripts/repair-session-log.ts \
  --path <log> --remove-type <type> --remove-seq <n> \
  --prev-type <t> --prev-seq <n> --next-type <t> --next-seq <n>

See the script header and the troubleshooting tables in the docs.

Two red lines

  1. One harness instance per DSH_HOME. Desktop and phone must connect to the same instance; running a second dsh web over the same session corrupts the session log (seq gaps).
  2. Restarting the script = a new token. Update it on both ends.

Repository layout

DSH-Remote/
├── README.md / README.zh.md      ← this overview (EN / 中文)
├── android/                      ← the DSH Remote phone app — full Kotlin WebView-shell source
│                                    (build/ + .kotlin/ gitignored; release-signed APK in apk/)
├── patches/
│   └── harness-all-changes.patch ← full diff vs. upstream deepseek-harness (51 files: bearer-token
│                                    gate, `dsh remote`, Android app…; `git apply --binary` to
│                                    reproduce). Baseline: upstream 5badb15009 (0.2.1-alpha.1) — see
│                                    docs/upstream-sync.md for what upstream owns vs. what we do
├── docs/
│   ├── plan-and-risk.md          ← design + threat model (Tailscale vs. alternatives)
│   ├── validation-report.md      ← 2026-08-15 end-to-end validation record
│   ├── cookbook-public-remote.md ← Tailscale public-remote runbook (+ troubleshooting)
│   ├── cookbook-lan.md           ← LAN remote runbook (+ troubleshooting)
│   ├── upstream-sync.md          ← who owns what against current upstream (what we dropped, what stays ours)
│   └── security-review-dsh-remote.md / .zh.md ← security review & remediation record
├── scripts/
│   ├── dsh-remote-tailscale.ps1  ← one-command public remote (Windows)
│   ├── dsh-remote-tailscale.sh   ← one-command public remote (macOS/Linux)
│   └── repair-session-log.ts     ← session-log repair tool (seq collisions)
├── screenshots/                  ← the four screenshots above
├── apk/
│   └── DSH-Remote-0.2.1-release.apk ← WebView shell app, release-signed + R8-minified (remembers the address and port; the access token is entered per session)
└── release-assets/               ← gitignored local staging (never published)

Security model

  • No public port. The harness binds 127.0.0.1; reachability comes from the mesh, not port mapping.
  • Double encryption (public mode). WireGuard carries the traffic; TLS (real cert, auto-issued & renewed) adds a second layer; the token never travels in plaintext.
  • Token, fail-closed. Identical to the LAN mode — no token, everything 401. --host 0.0.0.0 is never involved.
  • API key stays on the PC. The web channel only reports "configured or not"; the residual risk is token theft → RCE → disk read, which rotation and rate-limiting narrow further (see docs/plan-and-risk.md Phase 3).
  • The mesh is not a boundary. Any device in the tailnet can reach the port; the token is the authorization. Tighten with Tailscale ACLs to phone↔PC when other devices share the tailnet.

Documentation

Document Contents
plan-and-risk.md Architecture decision record — 4 candidate routes compared, threat table, phased rollout
validation-report.md 2026-08-15 end-to-end verification: mobile network, real cert, 401 negatives, session-log integrity (580k+ events) + security-remediation appendix
cookbook-public-remote.md Tailscale runbook + troubleshooting table + ACL template
security-review-dsh-remote.md Security review & remediation record (中文)
cookbook-lan.md LAN runbook + troubleshooting table
upstream-sync.md Who owns what against upstream 0.2.1: what upstream absorbed (gzip, no-hard-link fallback, responsive frame), what stays ours (bearer-token gate, dsh remote), and the verification record

Related projects

  • deepseek-ai/deepseek-harness — the upstream agent harness, "everything is a plugin", powered by Cordis.
  • ChongYep/-Deepseek-harness-mobile — the on-device distribution: the harness running directly on an Android phone under Termux.
  • tailscale/tailscale-android — official Tailscale Android app; the public-remote setup depends on it (download the APK from its Releases).
  • The scripts and cookbook runbooks in this repo are kept in sync with the upstream source tree (scripts/, docs/cookbook/).

License

MIT — same terms as upstream. Third-party notices: see upstream THIRD_PARTY_NOTICES.md.

About

Drive the DeepSeek Harness on your PC from your phone — over LAN or the public internet via a secure Tailscale mesh. Loopback-only, token-gated.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages