TTTimas/dsh-plugin-balance-tokens ↗★ 0

dsh-plugin-balance-tokens

Status strip below the workspace: DeepSeek account balance and session token usage / remaining context.

套件
dsh-plugin-balance-tokens
相容性
待驗證
Cordis 依賴範圍
~4.0.5
版本
0.1.0
授權
MIT
最近更新
2026年10月22日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:TTTimas/dsh-plugin-balance-tokens

dsh-plugin-balance-tokens

DeepSeek Harness(DSH)桌面版插件:在 Web GUI 窗口最底部显示一条状态条——左侧账户余额,右侧当前会话的 token 用量与上下文剩余。

A status strip for the DeepSeek Harness web GUI: account balance on the left, the current session's token usage and remaining context on the right.

效果

  • 左:余额 充值 ¥12.34 · 赠送 ¥3.00,点击手动刷新,每 60 秒自动刷新,页面重新可见时也会刷新。

  • 余额按预警等级着色,金额前有同色圆点,悬停可看状态与阈值:

    颜色CNYUSD含义
    绿色≥ ¥20≥ $3余额充足
    黄色¥5 – ¥19.99$1 – $2.99余额偏低
    红色0` 的行。
    「本会话」按输入、缓存读写、输出四项合计分级;「上下文剩余」= contextWindow - projectedTokens,按剩余占比分级。

目录结构

package.json        dsh.bundle.patch + dsh.client(platform: web)
cordis.patch.yml    bundle 补丁:insert 本包为 Loader 条目
lib/index.js        node 半侧(纯 UI 插件,空 apply)
lib/client.js       浏览器半侧,已构建格式,无需构建步骤
tests/smoke.cjs     无依赖冒烟测试
docs/statusbar.png  状态条截图(README 引用)

lib/client.js 直接使用 window.__ModuleLoader__.load({ id, factory }) 的已构建格式,仅依赖基线共享模块(react 等),不声明 dsh.client.external。

安装

桌面版 profile 为 desktop(由 Electron 应用管理,普通 dsh --profile desktop 启动会被拒绝,但 dsh plugin 可以管理)。

本地开发安装(推荐,改动即时生效):

dsh plugin --profile desktop add "link:E:\path\to\dsh-plugin-balance-tokens"

也可以从 Git 仓库安装:

dsh plugin --profile desktop add "git+https://github.com/TTTimas/dsh-plugin-balance-tokens.git"

安装会把依赖写入 $DSH_HOME/profiles/desktop/package.json 并登记到 dsh.profile.bundles;正在运行的界面通过 HMR 实时加载,无需重启。

测试

npm test

冒烟测试模拟 window.__ModuleLoader__、react 与 cordis ctx,断言注册到 shell.bottom、locale 字典、余额/用量渲染与点击刷新。

卸载

dsh plugin --profile desktop remove dsh-plugin-balance-tokens

备注

  • 注册目标 shell.bottom 是 single 插槽。若将来有其他插件占用它(例如 experimental-inspector),两个条目在同一 priority 会冲突;届时可通过注册的 priority 协调。
  • 位置选的是全宽底部(三栏下方);如需挪到左侧栏底部,可改为注册到 sidebar 内部座位。

License

MIT