본문으로 건너뛰기
A

dsh-hello

ada87/dsh-hello

Phone access for DeepSeek Harness: pair a device, browse sessions, reply, approve tool calls, and open terminals and files.

설치

dsh plugin --profile web add github:ada87/dsh-hello

README

DSH Hello

npm version license dsh

Non-official mobile BFF for DeepSeek Harness (dsh). It is a normal dsh plugin: it runs inside the Host process, calls the Host's own Cordis services, and speaks a small JSON + SSE protocol to the React Native app.

It does not use Typert Remote, does not fork dsh, and does not put a relay server between the user's phone and the user's Host.

Features

  • The session list, everywhere. Open the drawer to read every session with tags, unread weight and live status.
  • Reply without opening a laptop. Send a prompt, queue it behind the current turn, or steer mid-turn.
  • Approve tool calls from the phone. Allow, always-allow or deny; answer the agent's structured questions.
  • Terminal and files. Open a real PTY for the session, leave it running in the background, and browse the workspace.
  • Push when you leave. Optional FCM/APNs notifications for turn end, approvals and questions, plus webhook targets (WeCom, ServerChan, ntfy, Bark, generic) that work without Google services.
  • One token per device. Pair once; revoke any device from Settings at any time.
PhoneTablet
Session drawer on a phoneSession list and chat side by side on a tablet

Install

dsh plugin --profile web add dsh-hello

From a checkout or a packed tarball:

dsh plugin --profile web add /path/to/dsh-hello
# or
pnpm pack
dsh plugin --profile web add ./dsh-hello-<version>.tgz

Restart dsh web. The terminal prints:

[dsh-hello] dsh 0.2.2-rc.3 satisfies >=0.2.2-0 <0.3.0
[dsh-hello] routes mounted at /dsh-hello (protocol 2, push none)
[dsh-hello] pairing code 1234 — open the app, enter the server URL, then this code.

The code has a five-minute TTL by default. After a successful pairing it rotates; the terminal prints the next one.

Pairing and compatibility

The pairing code is four digits by default (1234). The Settings page offers three modes: One-time (fresh code, pairingTtlMs TTL), Permanent (does not expire until changed) and Locked (no new devices; paired ones keep working). Each client address gets pairingMaxAttempts (8) tries per TTL. Four digits are convenient but low entropy: keep dsh on a trusted LAN/Tailscale, or raise pairingCodeLength / lower pairingMaxAttempts before exposing it to the internet.

The Host's compatibility gate enforces the engines.dsh range at install and profile startup. If a linked or exempted install runs outside the tested range, the plugin logs a warning and reports dshCompatible: false in /health instead of failing to load.

Supported window: the latest three minor lines, starting with 0.2.2. Prerelease suffixes (alpha, rc) do not create a new line; 0.2.2-rc.1 and 0.2.2-rc.3 are one line. The current matrix and test record live in docs/COMPATIBILITY.md and compat/versions.json.

engines.dsh reads >=0.2.2-0 <0.3.0. 0.2.1 is outside the support window: it lacks sessionController.state() and the page cursor, so the plugin no longer carries shims for it. A Host outside the range still loads with a warning and reports dshCompatible: false in /health.

Usage

  • Open dsh web → Settings → DSH Hello to read the pairing code and manage paired devices.
  • In the app, enter the Host URL and the four-digit code; the device stores its own bearer token.
  • The drawer lists sessions: open one to read, reply, approve tool calls, or open its terminal and files.
  • Push is optional; register an FCM/APNs token under Settings when a relay is configured.

Why a plugin

The official browser client uses generated Typert codecs and /api/remote.mux. Those artifacts are browser bundles, and dsh's /api route sits behind a Host/Origin fence and browser cookies. A native app cannot consume either cleanly. This plugin registers its own routes on the same webServer, authenticates devices with its own bearer token, and uses the Host's own sessionController / approval / userQuestions services.

Upgrade

Install from the npm registry (the default dsh plugin add dsh-hello) so dsh can track releases. The dsh-hello page under Plugins then shows Update available and a Versions section; Update removes the old version, installs the selected one, keeps the bundle enabled, and recomposes with HMR or asks for a restart. A failed update restores the previous version when possible.

The Update / Versions section is a dsh 0.2.2 feature. When the page has no update action, update from the CLI instead:

dsh plugin --profile web remove dsh-hello
dsh plugin --profile web add dsh-hello@latest
# restart dsh

The Web UI is preferred on 0.2.2+ because it checks engines.dsh before touching the profile and rolls back a failed install. From the CLI:

dsh plugin --profile web add dsh-hello@latest
# restart dsh if the result asks for it

If you installed from a tarball or a link: path, that entry is not updatable; switch it once:

dsh plugin --profile web remove dsh-hello
dsh plugin --profile web add dsh-hello@latest

dsh upgrades

The plugin is a profile dependency, so upgrading dsh keeps it installed. dsh 0.2.x releases stay inside the supported range. A dsh 0.3.x Host refuses this version at startup and marks it incompatible: update dsh-hello to a release with a matching range instead of reinstalling. Pairings and device tokens live in the credential store under dsh-hello/* and survive plugin updates.

Coming from @xdnote/dsh-mobile

Remove the old package once; it owns the old /dsh-mobile routes and the old credential keys:

dsh plugin --profile web remove @xdnote/dsh-mobile
dsh plugin --profile web add dsh-hello

Device records now live under dsh-hello/*, so pairings are not migrated: pair the phone again. The app's storage keys are also @dsh-hello/* now, so install the new app build rather than upgrading the old one in place.

Pairing code in the browser

Open dsh Web UI and go to Settings → dsh-hello, the section placed directly after General (slot settings.section, order 5). It uses dsh's React runtime and locale dictionaries, so it follows the Web UI theme and language.

The page shows:

  • a lock switch: while locked, POST /pair answers 403 pair-locked and no new device can join, while devices that are already paired keep working;
  • the current numeric code and expiry;
  • a QR payload ({"v":1,"url":…,"code":…});
  • the paired-device table;
  • buttons to generate a new one-time code, set a fixed code, or restore one-time rotation.

The lock is persisted next to the fixed code in the credential store, so it survives a Host restart. There is no standalone HTML page. The panel is contributed by client/client.js through the settings.section and settings.section.icon slots and reads three cookie-authenticated endpoints:

  • GET /admin/data – current code, QR payload, lock state and device list;
  • POST /admin/pair-code – rotate, set or clear a fixed code;
  • POST /admin/lock – { "locked": true | false }.

Both are protected by the dsh browser session: the plugin calls ctx.connection.admit() on the request headers, with loopback accepted as a local fallback. Without a valid dsh login the endpoints return 401.

The browser half is part of the page's boot manifest, so after installing or updating the plugin, restart dsh web and reload the Web UI (a hard refresh, not just the settings tab). An already-open tab keeps the old module graph and will not show the section.

Local development without publishing

Install the checkout once as a link; every rebuild is served from the same path:

dsh plugin --profile web add link:/absolute/path/to/dsh-hello

Then:

  • Host + client half: pnpm dev:host (TypeScript types, esbuild bundle, and the client/client.js copy); restart dsh web.
  • Before publishing: pnpm build (types + bundle) and pnpm test.

Use a separate home if you do not want to touch your real profile:

DSH_HOME=$HOME/.dsh-dev dsh plugin --profile web add link:/absolute/path/to/dsh-hello
DSH_HOME=$HOME/.dsh-dev dsh web --port 4001

On Windows PowerShell:

$env:DSH_HOME="$HOME\.dsh-dev"
dsh plugin --profile web add link:D:/all-in-dsh/apps/dsh-hello
dsh web --port 4001

Fixed codes are normalized (letters/digits, 4–32 chars, dashes ignored) and persisted in the dsh credential store under dsh-hello/pairing. They remain valid until changed; use them only on a trusted network. One-time codes rotate after a successful pairing and expire after pairingTtlMs.

Pairing

  • The plugin generates a one-time code, prints it, and optionally prints a QR payload ({"v":1,"url":"http://host:port/dsh-hello","code":"..."}). The Settings-page QR uses the browser's base URL; the terminal QR uses the bind origin.
  • The app sends the code plus a stable public-key fingerprint (devicePublicKey). The server stores a hash of the bearer token and pins the fingerprint as the device id.
  • Tokens are not bound to host:port, so changing IP, port, or tunnel does not require re-pairing.
  • Device records live in the dsh credential store under the owner-scoped key dsh-hello/devices (grant payload). No token is stored in cordis.yml.
  • GET /dsh-hello/pair/code is loopback-only and only exists to make local setup/curl tests convenient. Remote users read the code from the terminal.

Configuration

basePath defaults to /dsh-hello. The app's v1 discovery probes that exact path, so a deployment that changes it also needs an app-side setting (planned).

The wire prefix and the persisted credential keys use the same dsh-hello name: the app probes /dsh-hello/health, and pairings live under dsh-hello/*.

- id: dsh-hello
  name: 'dsh-hello'
  config:
    basePath: /dsh-hello
    allowedHosts: ['dsh.example.com']   # extra Host-header authorities
    requireSecure: false                # true when the Host itself serves TLS
    strictHostCheck: false              # true binds requests to a known authority
    pairingTtlMs: 300000
    pairingCodeLength: 4
    pairingMaxAttempts: 8
    interactionTarget: browser-only      # browser-only | browser-first | phone-first (Default | DSH first | Device first)
    approvalWaitTimeoutMs: 120000
    questionWaitTimeoutMs: 120000
    allowSessionWideGrants: true
    enableDebugRoutes: false            # true exposes authenticated /debug/* test routes
    maxBodyBytes: 65536
    rateLimitWindowMs: 60000
    rateLimitMax: 240
    dshVersionRange: '>=0.2.2-0 <0.3.0'
    push:
      provider: none                    # none | fcm | apns | relay
      # provider: relay
      # relayUrl: https://push.example.com
      # relayHostToken: dshr_...
      notifyTurnEnd: true
      notifyApproval: true
      notifyQuestion: true

relay mode sends only the notification payload and host token to your relay; the relay holds the FCM/APNs credentials. Device tokens are registered with the relay automatically when the app calls PUT /devices/me/push.

The notify* config values are host-wide defaults. Each device can then set its own approval, question and turnEnd subscriptions with PUT /devices/me/push/subscriptions; both direct sending and relay mode filter unsubscribed devices. Turn-end pushes are sent only when no app has a live global SSE connection. A connected app handles the event locally instead.

Push credentials are BYO. Put secrets in the dsh credential store under the owner-scoped record dsh-hello/push when possible; the plugin reads that record first and falls back to configuration:

{
  "provider": "fcm",
  "fcmServiceAccountJson": "{\"type\":\"service_account\",...}",
  "fcmProjectId": "my-project"
}

The equivalent configuration fallback (useful for tests) is:

    push:
      provider: fcm
      fcmServiceAccountJson: '{"type":"service_account",...}'
      fcmProjectId: my-project

or APNs:

    push:
      provider: apns
      apnsKey: |
        -----BEGIN PRIVATE KEY-----
        ...
      apnsKeyId: ABC123DEFG
      apnsTeamId: TEAM123456
      apnsTopic: com.example.dshapp
      apnsEnvironment: production

The plugin talks directly to Google/Apple; there is no author-operated relay.

Webhook notifications

Webhooks are independent of the app push provider: they work with provider: none, and they do not need a phone token or GMS. Add one or more targets under push.webhooks:

    push:
      webhooks:
        - name: wecom
          url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...
          format: wecom
        - name: ntfy
          url: https://ntfy.sh/my-dsh-topic
          format: ntfy
        - name: bark
          url: https://api.day.app/<device-key>
          format: bark
        - name: serverchan
          url: https://<uid>.push.ft07.com/send/<sendkey>.send
          format: serverchan
        - name: hook
          url: https://example.com/dsh
          format: generic
      webhookContent: minimal   # minimal | standard
      webhookCooldownMs: 60000
  • wecom posts a markdown bot message, serverchan posts title/desp, ntfy posts the body with a Title header, bark accepts either https://api.day.app/<key> or the full /push endpoint, and generic posts JSON { kind, title, body, data }.
  • webhookContent: minimal (default) never puts conversation text in the body; standard sends the same rendered body as the app push.
  • webhookCooldownMs suppresses repeated sends to one target for the same kind (turn end, approval, question), so a burst produces one notification.
  • The notify* switches gate webhooks too; a disabled kind is not sent anywhere.

HTTP API

All routes are under basePath (default /dsh-hello). Except for /health and /pair, every route requires Authorization: Bearer <device token>. /admin/* instead accepts the Host's own browser session (or a loopback caller), because the settings page talks to it.

MethodPathPurpose
GET/healthPublic capability and version facts (also reports pairingOpen)
GET/POST/pair/codeLoopback-only current/rotated code + QR payload
POST/pairOne-time code → device token (201)
GET/devices/meThis device's record, including push subscriptions
DELETE/devices/meUnpair this device and close its streams
PUT/devices/me/pushRegister/replace this device's FCM/APNs token
PUT/devices/me/push/subscriptionsSet approval / question / turnEnd
DELETE/devices/me/pushRemove this device's push registration
POST/presenceForeground claim ({ foreground: boolean })
GET/speechHost speech provider readiness
POST/speech/transcribeTranscribe a raw WAV body (audio/wav; optional ?language=&providerId=)
GET/sessionsSession list with title projections and optional vitals
POST/sessionsCreate/reuse a blank Session
PATCH/sessions/:idRename ({ "title": string })
PUT/sessions/:id/pinPin/unpin ({ "pinned": boolean })
PUT/sessions/:id/archiveArchive/unarchive ({ "archived": boolean, "stopActivity"?: boolean })
PUT/sessions/:id/modelSelect provider/model ({ provider, model, reasoningEffort? })
GET/sessions/:id/modelCurrent selection
GET/sessions/:id/transcript?beforeSeq=&limit=Message-aligned history page
GET/sessions/:id/stateRunning/queue state + projections
POST/sessions/:id/promptSend text (queue or steer), 202
POST/sessions/:id/cancelStop the current turn, 202
POST/sessions/:id/forkChild Session at an optional inclusive atSeq, 201
POST/sessions/:id/uploadsRaw attachment bytes (?kind=&name=&mediaType=), 201
GET/sessions/:id/eventsSSE follow stream (snapshot + events)
GET/sessions/:id/files?path=Directory listing inside the Session cwd (300 entries max)
GET/sessions/:id/file?path=, /sessions/:id/raw?path=UTF-8 preview / base64 byte chunk
GET/sessions/:id/image?path=, /workspaces/:id/image?path=Raw image bytes for markdown image tags (device header auth, 24 MiB cap)
GET/sessions/:id/terminalsList retained phone terminals
POST/sessions/:id/terminalsOpen a PTY in the Session working directory
GET/sessions/:id/terminals/:tid/eventsSSE replay + live terminal output
POST/sessions/:id/terminals/:tid/inputWrite terminal input
POST/sessions/:id/terminals/:tid/resizeResize the PTY
DELETE/sessions/:id/terminals/:tidTerminate the terminal (204)
POST/sessions/:id/questions/:callId/answerAnswer a continued question
GET/workspacesWorkspace registry (id, path, title)
POST/workspacesAdopt an existing directory ({ "path", "title"? })
PUT/workspaces/:idRename a workspace ({ "title": string })
GET/workspaces/:id/files, /workspaces/:id/file, /workspaces/:id/rawSame file surface, keyed by workspace
GET/schedulesAutomation catalog; available: false without a schedule service
GET/schedules/marksActive scheduled-task counts per Session (drawer clock)
GET/schedules/:idOne task with target, last delivery and execution flags
GET/schedules/:id/history?limit=&before=Delivery history, newest first
POST/schedules/:id/runDeliver one occurrence now
PUT/schedules/:idPause/resume ({ "active": boolean, "expectedUpdatedAt"?: string })
DELETE/schedules/:idDelete the task and its saved deliveries
GET/read-stateShared read watermarks (proxied to dsh-tag)
PATCH/read-stateMerge this device's watermarks and return the merged map
GET/eventsGlobal SSE: approvals, questions, sessions, turn end
GET/approvalsPending approvals
POST/approvals/:id/decisionallow / always / deny
GET/questionsPending questions
POST/questions/:id/answerStructured answer batch
GET/web-urlThis Host's Web UI, launch token attached
POST/debug/approvalDebug-only synthetic approval (enableDebugRoutes)
POST/debug/questionDebug-only synthetic question (enableDebugRoutes)

GET /sessions returns rows already ordered by updatedAt (newest first). updatedAt is the Host's last-prompt time: renaming, pinning, archiving or assistant activity does not move it, so the phone can use it for sorting and unread watermarks without flicker. Titles and vitals come from the projections the Host attaches to each row, so a list costs one Host call rather than one per Session. The Host's list is not paginated; the phone searches the whole set locally, which is why this route deliberately returns every row.

Admin page (browser session or loopback):

MethodPathPurpose
GET/admin/dataCode, QR, lock, policy, paired devices
POST/admin/pair-codeRotate / set fixed / auto
POST/admin/interactionphone-first / browser-first / browser-only
POST/admin/lockLock or unlock pairing
PUT/admin/devices/:idRename a paired device
DELETE/admin/devices/:idRevoke a paired device

A schedule delivery receipt acknowledges that the target Session persisted the message, not that the Agent finished or succeeded. Open the target Session for the actual result. GET /health advertises schedules, scheduleActions and scheduleHistory so older plugins can stay read-only; workspaceRename gates the phone's workspace rename entry, and readState tells the app that read watermarks are shared across paired devices.

Approval policy

dsh hands an approval or a question to one answerer: the first listener that does not call next(). interactionTarget decides who that is; the admin page calls the same three choices Default, DSH first and Device first.

Admin labelValueWho answers
Default (default)browser-onlyNobody here: the plugin registers no listener, so dsh behaves exactly as if it were not installed. The app shows a read-only prompt and hands the decision to the Web UI.
DSH firstbrowser-firstA live web UI always answers. With no browser connected the app holds the request, even in the background.
Device firstphone-firstA foreground app answers, even when a browser is connected; otherwise dsh's own listeners do.

The plugin registers unscoped (global) waterfall listeners ahead of the browser's answerer, so the policy rather than listener order decides. dsh 0.2.2 dispatches both waterfalls with scopeTarget(agent, agent); a listener bound to the plugin's own scope never sees them.

With a request claimed, the app is asked over SSE (and push) and its answer becomes the tool's outcome:

  1. A claim expires after 45 seconds without a POST /presence heartbeat, and backgrounding the app releases it immediately, so a browser can take over.
  2. Timeout, abort, "no", or the app leaving falls back to next(), so dsh's own fail-closed unavailable path still applies.

always is a process-local session grant for one session + tool pair. dsh only defines one-shot allowed-once; the plugin does not invent durable grants.

Approval events try to include a presentation-only preview by reading the matching tool/call event (bash command, edit diff, web_fetch URL, etc.). The lookup is best-effort and bounded so it never blocks the approval. Push data also carries hostId (when the Host origin is known) and the approval's sessionId, so a multi-host app can switch to the right Host before opening the session.

Questions

Questions use the same policy: a foreground app with a live SSE connection claims the question before a connected browser. If the app leaves the foreground, the claim is released and dsh shows the question in the browser. If the foreground wait is already gone, the app can still answer the projection's continued questions through the callId route, which calls ctx.userQuestions.answer(agent, callId, ...).

SSE frames

GET /sessions/:id/events:

event: ready
data: {"sessionId":"..."}

event: frame
data: {"type":"snapshot","header":{...},"records":[...],"projections":{...}}

event: frame
data: {"type":"event","event":{"type":"assistant/message",...}}

GET /events:

event: hello
data: {"server":{...},"features":{...},"pendingApprovals":[],"pendingQuestions":[]}

event: approval
data: {"id":"...","sessionId":"...","toolName":"bash","displayReason":{"en":"..."}}

event: session
data: {"action":"status","sessionId":"...","running":true}

Debug interaction routes

enableDebugRoutes: true adds authenticated POST /debug/approval and POST /debug/question routes. They create the same pending items the real interaction seams create, so a phone can exercise the approval/question UI without a model key or a tool call. They are off by default and are not a replacement for the real waterfall; turn them off after testing.

Security model

  • Route registration is outside dsh's /api cookie fence, so the plugin owns its own fence:
    • A Host header is required. Unauthenticated routes accept loopback, the listener's bind address, a configured allowedHosts entry, or an authority recorded at pairing.
    • An authenticated device request is accepted across address/tunnel changes: the bearer token is the boundary, so changing IP, port, or tunnel does not require re-pairing. Set strictHostCheck: true to bind requests to the authority allowlist instead.
    • An attached web Origin must match the request authority; cross-site web requests are refused (403).
    • Installed browser-extension origins (chrome-extension://, moz-extension://, safari-web-extension://) are accepted as paired clients and receive scoped CORS headers plus OPTIONS preflight. The device token or pairing code remains the authentication boundary. Web pages still receive no CORS headers.
    • Native clients do not need CORS; their requests are unchanged.
  • The pairing admin page uses dsh's own browser authentication (ctx.connection.admit) and only falls back to loopback; it is not an unauthenticated code-dump route.
  • Bearer tokens are compared in constant time after hashing.
  • The phone terminal runs the Host's default shell through ctx.subprocess.spawnTerminal, so it runs as the dsh OS user outside the agent sandbox — the same permission model as dsh's Web sidebar terminal. It is reachable only with a device token, input is capped at 64 KiB per request, at most four terminals are kept per Session, and unattached terminals are reclaimed after 30 idle minutes. Output is bounded to 200k characters.
  • Revoking a device deletes its token and immediately ends every SSE stream opened with it (global events and per-Session follows), so a lost phone stops receiving events at revoke time rather than on its next reconnect.
  • JSON bodies are bounded (maxBodyBytes) and rate-limited per client address.
  • Pairing has a TTL, a one-time code, and a per-address failure cap.
  • Plain HTTP on a public address is the user's choice and is surfaced by the app as a strong warning; the app refuses to pair publicly over HTTP until the user explicitly confirms. Prefer Tailscale, a private address, or TLS.

Verification

The plugin ships an integration suite that mounts the real router on a local HTTP server with a fake Host context:

node --import tsx --test tests/*.test.ts
# or, when deps are installed:
pnpm test

It covers health, pairing and one-time-code consumption, token auth, session projection, Host/Origin fences, approval claim/answer, browser-first delegation, session-wide grants, question answers, terminal create/input/resize/close, revoke stream teardown, body limits, and JSON-safe device persistence.

The app repository also contains a recorded M1 curl walkthrough in docs/M1-ACCEPTANCE.md (https://cnb.cool/ada87/app-dsh-hello).

Known limitations

  • dsh is developer preview; the plugin is pinned to 0.2.x.
  • Session title/list reads call the projection service per row (fine for a personal Host; not optimized for thousands of sessions).
  • always is process-local and disappears on restart.
  • Push is implemented for FCM v1 and APNs token auth, but this repository cannot exercise Apple/Google credentials.
  • The app reads committed assistant/message events; assistant token deltas (assistant-stream frames) are not rendered yet.
  • The browser escape hatch opens the Web root; dsh does not expose the launch token to plugins, so an already-authenticated browser session is required.

License

MIT

관련 플러그인