dsh-system-control
DSH web plugin: sidebar-embedded DeepSeek balance readout with a black minimalist full-shutdown button.
- Stars
- 0
- Language
- JavaScript
- Created
- Aug 26, 2026
- Updated
- Aug 26, 2026
Introduction
dsh-system-control
A persistent DeepSeek Harness (DSH) web plugin that embeds a DeepSeek API balance readout and a full-shutdown button directly above the Settings entry in the left sidebar.
| Balance | 余额 ¥0.69 — read from $DSH_HOME/.credentials.yaml, fetched live from https://api.deepseek.com/user/balance |
| Shutdown | Black minimalist line-art power button — flushes every session, then exits the whole Harness (web UI + child processes + main process) |
✨ Features
- Sidebar-embedded, not floating — registers into
sidebar.footer.action, rendered directly above the Settings button; no card chrome, no clipping, follows the active theme tokens. - Live balance display — auto-refreshes after every model API call (via the
llm/streamevent), polls every 25 s, and refreshes on click. - Black minimalist shutdown — a pure line-art power icon (no circle, no fill, no border). A confirm dialog appears first; on confirm it:
- Flushes every live session (
sessions.flush) so all conversation data is durable; - Gracefully exits the whole Harness (
appExit(0)) — the launcher disposes the tree (stops the web UI, terminates child processes) and exits the process; - Hard fallback (
process.exit(0)after 1.5 s) so the web UI is guaranteed to go down even if the graceful controller stalls.
- Flushes every live session (
- Clean row — the official Cordis panel icon cell is hidden while this plugin is active, so the footer stays tidy.
- Collapsed rail friendly — on the 56px rail the confirm row switches to a compact
退出?prompt. - Failure-friendly — balance read errors show
获取失败(fetch failed) instead of breaking the UI; click to retry.
📦 Install
From Git (available now)
dsh plugin --profile web add git+https://github.com/lnetrit-alt/dsh-system-control.git
From npm (pending)
The package is prepared for the npm registry (dsh-system-control); publishing is pending account 2FA setup. Once published:
dsh plugin --profile web add dsh-system-control
Local development
git clone https://github.com/lnetrit-alt/dsh-system-control.git
dsh plugin --profile web add ./dsh-system-control
Restart the Harness (or refresh the page — the client half hot-reloads via dsh-client-hmr; the host half loads at boot).
🖥️ Usage
- View balance: the footer row shows
余额 ¥0.69(currency symbol mapped from the API: CNY →¥, USD →$, EUR →€, GBP →£). - Refresh manually: click the balance text.
- Refresh automatically: after every model API call and every 25 s.
- Shut down: click the power icon → confirm → all sessions are saved and the whole Harness process exits (web UI included).
🔧 How it works
- Host half (
lib/index.js): registers the/system-control/apiroute (same browser-trust fence as the official/apigateway — loopback ortrustedHosts, same-origin only), servingbalanceandshutdown; listens tollm/streamto refresh the cached balance after each API call. - Client half (
lib/client.js): adsh.clientbundle registering twosidebar.footer.actioncells — one that replaces (hides) the officialcordis-panelicon, and one that renders the balance + shutdown row. - Shutdown sequence:
sessions.flush→appExit(0)(graceful tree disposal) →process.exit(0)hard fallback.
🤖 Model Experience
The plugin is a UI-only surface: it registers no model-visible tools and changes no agent behavior. The model does not need to know it exists.
⚠️ Known Limitations and Deferred Work
- Requires the DSH launcher's
appExitservice (provided bydsh/dsh web); in an embedding host without it, shutdown reports an error instead of exiting. - Balance currency symbol is mapped from the API response; multi-currency accounts show the first
balance_infosentry. - The official Cordis plugin-panel icon is hidden from the sidebar footer while this plugin is active.
- npm publishing is pending account 2FA setup (see Install).
📄 License
MIT