Back to home@lnetrit-alt

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
GitHub repo

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
ShutdownBlack 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/stream event), 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:
    1. Flushes every live session (sessions.flush) so all conversation data is durable;
    2. Gracefully exits the whole Harness (appExit(0)) — the launcher disposes the tree (stops the web UI, terminates child processes) and exits the process;
    3. Hard fallback (process.exit(0) after 1.5 s) so the web UI is guaranteed to go down even if the graceful controller stalls.
  • 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/api route (same browser-trust fence as the official /api gateway — loopback or trustedHosts, same-origin only), serving balance and shutdown; listens to llm/stream to refresh the cached balance after each API call.
  • Client half (lib/client.js): a dsh.client bundle registering two sidebar.footer.action cells — one that replaces (hides) the official cordis-panel icon, and one that renders the balance + shutdown row.
  • Shutdown sequence: sessions.flushappExit(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 appExit service (provided by dsh / 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_infos entry.
  • 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