bowenliang123/dsh-context
bowenliang123/dsh-contextDSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
会话头部显示 DeepSeek 余额与本会话 Token 用量:三级余额预警、自定义阈值、一键充值入口、分段 Token 条与缓存命中率,并采用可见时才轮询的省流策略。
English | 简体中文
DeepSeek account balance and per-session token usage for the DSH (DeepSeek Harness) web GUI, rendered as a colored pill in the session header (top right).
GET /user/balance (total / topped-up / granted).tokenUsage projection: uncached input, cache read, cache write, output, total, and cache-hit rate.ctx.connection.fetch and falls back to ctx.webServer; the browser tries the session-header seats in order.Option 1 - install it as a plugin package (recommended):
dsh plugin --profile web add dsh-usage-panel
Option 2 - local installer:
node install.mjs --home ~/.dsh --profile web
Restart dsh web (or let the live patch watcher apply it) and refresh the GUI.
apply(ctx, config) reads an optional config object from the patch row:
| Field | Default | Meaning |
|---|---|---|
routePath | /api/usage-panel/balance | route served by the host half |
cacheMs | 30000 | upstream cache and single-flight window |
apiKeyEnv | DEEPSEEK_API_KEY | resolved via ctx.credentials, then env |
baseUrl | https://api.deepseek.com | provider base URL |
baseUrlEnv | DEEPSEEK_BASE_URL | env var overriding baseUrl |
ctx.connection.fetch.register and falls back to ctx.webServer.register. Key resolution uses ctx.credentials when present.slots service. Preferred seat is conversation.session.header.utilities, then conversation.session.header.corner; sidebar.footer.action is a delayed (4s) fallback, so the pill never pre-empts the header on a normal boot. Token usage needs the session-scoped useProjection hook; without it the balance still renders.node tools/verify.mjs --port 3080 --home ~/.dsh
Reports boot-graph presence, the HMR channel, and the served bundle features.
Remove the usage-panel insert row from the profile patch and delete <home>/plugins/dsh-usage-panel.
Mysterious Mark