dsh-phonebox
中文文档 · English
A DeepSeek Harness dashboard for a tablet running PhoneBox: account balance, today's spend and token usage, and the sessions the Harness knows about — on the wall, in a small widget, and as native PhoneBox cards.

What you get
- Balance from the DSH account (falls back to a
DEEPSEEK_API_KEYcredential). - Today's spend from the balance ledger: the plugin records the account
balance at the start of the day and adds every drop it observes — the way
dsh-whale-widgetbooks costs — so the number follows the account instead of a token price table. On the first day the ledger starts at the first balance sample (install or first run after an upgrade) and the card says so. - Sessions: title, workspace, model, working / idle / ended, token totals and last activity; the running one comes first, its status ring lit steadily, with the card glowing a faint dark orange.
- Finished sessions you have not looked at pulse dark green for up to ten minutes; tapping the row, replying to that session, or it running again clears the mark.
- The spend card shows the running session's share of the balance drops it
saw next to the big number, as a small
本次会话 +¥1.00. - Questions and approvals the Harness is waiting on are mirrored as a popup: single-question, single-choice prompts can be answered right on the page when the dashboard was open in the last minute (the phone gets a 15-second head start, then the question goes to the computer); everything else is answered on the computer and the popup closes itself.
- Two layouts that follow the widget size — a full page and a compact one that adapts from two cells high upwards.
| Compact, 4 cells | Compact, 6 cells |
|---|---|
![]() |
![]() |

- PhoneBox push: the same summary goes to
POST /api/push/dsh(session list) andPOST /api/push/dsh-quota(today's spend), so aPushed valuewidget works without the page; optional toasts when a turn ends. - Metadata only: prompts, replies and tool arguments never leave the host; answering a mirrored prompt sends back just the chosen option label.
Requirements
- DeepSeek Harness (Desktop) with the
sessionQueryservice (the current builds have it) and thedeepseekAccountservice for the balance — without the account, aDEEPSEEK_API_KEYcredential is used instead. - PhoneBox agent 0.10.x on the same computer (Windows, macOS or Linux) and the Android app on the tablet (Android 7 or later).
- The tablet and the computer on the same network, or USB with USB debugging.
Install
git clone https://github.com/CY-W-2000/dsh-phonebox.git
Install it as a local DSH bundle: Plugins › Add plugin and pick the folder,
or through the plugin_manager tool with action: install_bundle and the
absolute directory as target. The plugin row is phonebox; it survives DSH
restarts and can be disabled like any other row.
The page listens on http://127.0.0.1:8799/ as soon as the plugin is active.
Open /api/health to check it.
Quick start
Check the page on the computer — http://127.0.0.1:8799/ (loopback needs no token; a LAN request needs the page token, see below).
Open it on the tablet (same Wi-Fi):
node scripts/make-page.mjs # prints the URL with the tokenThe token lives in
$DSH_HOME/dsh-phonebox/state.json.Add the PhoneBox page: generate and import
phonebox-page.jsonthrough PhoneBox settings › Pages › Import, then Save. It adds a full dashboard page, a 6×4DSH 小组件page and aDSH 状态page with the native cards. Tick the widget's No card background option for the "cards only" look.USB instead of Wi-Fi: attach the cable with USB debugging on, run
scripts\adb-reverse.ps1once (and after every reconnect), thennode scripts/make-page.mjs --host 127.0.0.1 --out phonebox-page-usb.jsonand import that file.adb reversetunnels TCP 8799 and bypasses the firewall.
Windows Firewall
DSH's own firewall rule covers the Public profile only, while a home Wi-Fi network is usually Private — the tablet then times out. Add a narrow rule (asks for UAC once):
scripts\allow-firewall.ps1
From the tablet, http://<pc-ip>:8799/api/health should answer with JSON (that
endpoint needs no token). macOS and Linux have no such step.
Configuration
Defaults are chosen so no configuration is needed. Override them with
environment variables for the DSH process, or with the bundle row's config in
the profile patch:
| Variable | Default | Meaning |
|---|---|---|
DSH_PHONEBOX_PORT |
8799 |
page port |
DSH_PHONEBOX_BIND |
0.0.0.0 |
127.0.0.1 keeps the page local (USB reverse only) |
DSH_PHONEBOX_URL |
http://127.0.0.1:8765 |
PhoneBox agent address |
DSH_PHONEBOX_PUSH |
true |
push into PhoneBox |
DSH_PHONEBOX_PUSH_KEY |
dsh |
session card key |
DSH_PHONEBOX_QUOTA_KEY |
dsh-quota |
spend card key |
DSH_PHONEBOX_NOTIFY |
false |
toast on every finished turn |
DSH_PHONEBOX_ANSWERS |
true |
allow answering single-choice prompts from the page |
DSH_PHONEBOX_ANSWER_WAIT_MS |
15000 |
how long the phone gets to answer before the question is handed to the desktop (only while the page was active in the last minute) |
DSH_PHONEBOX_SESSIONS |
16 |
sessions kept on the page and in the card |
DSH_PHONEBOX_DAYS |
7 |
how far back sessions are read |
DSH_PHONEBOX_INTERVAL |
20 |
push cadence, seconds |
DSH_PHONEBOX_REFRESH |
300 |
full session/balance rescan, seconds |
The row config accepts the same keys as camelCase fields
(port, bind, phoneboxUrl, pushEnabled, pushKey, quotaKey,
notifyTurns, sessionsShown, historyDays, intervalSec, refreshSec).
Layouts
The page picks a layout from its own size: below 330 px of height (or 640 px of width) it switches to the compact one — no logo, the run state and the plugin name in the top-right pill, 2×2 big-number cards — and keeps adapting to the height:
| Height | Shows |
|---|---|
| ≤149 px (2 cells) | four cards in one row, no second line, no sessions |
| 150–259 px (3 cells) | 2×2 cards with the small second line (recharge, spend window, token split) |
| from ~220 px (4 cells) | the session list, with as many rows as fit — up to sessionsShown |
?compact=1 / ?compact=0 in the widget URL forces one layout. The full layout
is used at normal page sizes.
PhoneBox cards
The plugin writes two values to the PhoneBox agent on every push:
dsh—{ title, value, sub, items }with one item per session;dsh-quota—{ title, value, sub }with today's spend.
Add a Pushed value widget with either key, or use a Notifications widget for the optional turn-end toasts.
Privacy
- Only metadata leaves the host: session titles, workspace folder names, model names, token counters, timestamps and the account balance.
- Prompts, replies, tool arguments and tool output are never read, stored or sent.
- Static page files are public on the configured port;
/api/stateand/api/refreshneed the 48-character page token when the request does not come from loopback. The page token is stored in$DSH_HOME/dsh-phonebox/state.json(owner-only file). - Binding
0.0.0.0puts the page — and the token — on the local network; setDSH_PHONEBOX_BIND=127.0.0.1to keep it loopback-only (USB reverse still works on the tablet).
Limitations
- Spend follows the account balance, not individual sessions: it counts every
drop the account shows, including usage outside DSH, and a top-up never counts
as negative spend. A day's ledger starts at its first balance sample — at
install/upgrade on the first day, and at the first sample after midnight while
the Harness runs — so usage before that sample is not included; the card shows
the start time. Without a readable balance the card stays
—. - Answering is deliberately narrow: single-question, single-choice questions and yes/no approvals can be answered from the page; multi-select or multi-question prompts and everything else stay on the computer.
- The session token totals come from the host's own counters; sessions whose
logs are unavailable show
0 tok. - Inside a PhoneBox widget the page cannot be truly transparent: Android WebView
paints the iframe canvas, so the page keeps a near-black
#121212backdrop that blends with dark wallpapers. On a bright or photographic wallpaper the widget area is visible. - Sessions untouched for
historyDaysare dropped from the page; their totals stay in the state file.
Troubleshooting
| Symptom | Try |
|---|---|
| Tablet times out | Windows Firewall rule (above); same subnet; /api/health from the tablet's browser |
| Page opens but the widget stays empty | The URL needs the page token when the tablet is not loopback-mapped; re-run make-page.mjs |
| White sheet inside the widget | The page was loaded before the current CSS; reload the widget (switch pages or reopen PhoneBox) |
Balance shows — |
Sign in to the DeepSeek account in DSH, or store a DEEPSEEK_API_KEY credential |
Spend stays ¥0.00 |
The balance has not dropped yet; on the first day the ledger starts at the first sample — usage before it is not counted |
| No sessions | The host has no sessionQuery, or all logs are older than DSH_PHONEBOX_DAYS |
| Push cards stay empty | PhoneBox agent not running, or DSH_PHONEBOX_PUSH=0; check dsh-phonebox: PhoneBox push failed in the DSH log |
Development
index.js— host plugin: web server, collectors, PhoneBox push.public/— the page (index.html,style.css,app.js), plain ES modules.scripts/— page generation, firewall and adb helpers.locale/,icon.svg,docs/DETAIL.md— plugin-manager metadata and docs.
Page endpoints:
| Endpoint | Meaning |
|---|---|
GET /api/state |
the snapshot the page renders: balance, today (incl. spent, sessionSpend), sessions (incl. workspace, unseen) and prompts |
POST /api/seen/<sessionId> |
clears a session's unseen mark (the page does it when you tap a green row) |
POST /api/answer/<promptId>?option=<n> |
answers a mirrored prompt from the page (option index) |
POST /api/refresh |
rescan sessions and balance, push to PhoneBox |
POST /api/prompt/test |
loopback only: shows a demo question popup for two minutes (for testing the mirror) |
Check the JavaScript with node --check index.js public/app.js. The plugin
reads its files on every request, so page edits show up on reload; host changes
need the row to be reloaded (disable/enable in the plugin list).
License
MIT — see LICENSE.


No comments yet. Be the first to write one.