rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:mantou2nd/dsh-plugin-account-balance
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
给 DeepSeek Harness(DSH)的会话输入框下面加一条余额统计: 余额 · 会话消耗 · 本轮估算,点一下展开明细面板。


截图是示意图,数字为虚构值。
ctx.remote.account.getBalance,与「设置 → 账号与余额」同一个 Host 接口,金额为充值余额 + 赠金余额的合计。localStorage,切换会话、刷新窗口都不串不清零,充值会把基线抬高,不会出现负数。tokenUsage 投影,翻页和压缩都不会让比例跑偏。LOW_BALANCE_CENTS = 500,按各币种最小单位,即 ¥5 / $5)时「余额」那一段变红,用的是 DSH 自己的 --dsw-alias-state-error-primary。<button> + portal,Escape / 点面板外 / 再点一次关闭;面板里能刷新,并跳到「查询用量 / 去充值」(链接与设置页同源)。仓库地址:https://github.com/mantou2nd/dsh-plugin-account-balance(发版后 Releases 里也有打包好的 .tgz)。
dsh-plugin-account-balance-1.0.0.tgz(或直接 git clone 本仓库)。node install.mjs # 装到 ~/.dsh/profiles/desktop
node install.mjs --profile web # 装到指定 profile
node install.mjs --uninstall # 卸载
脚本会把包复制进 profile 的 node_modules,把包名写进 dsh.profile.bundles,
并清掉早期手工安装留在 cordis.patch.yml 里的那一行(避免同一入口装两次)。
两种方式不要叠加:包已经在
dsh.profile.bundles里后,就不要再往cordis.patch.yml加ui-account-balance行。
| 想改什么 | 改哪里 |
|---|---|
| 变红的阈值 | lib/client.js 的 LOW_BALANCE_CENTS(500 = ¥5) |
| 刷新频率 | lib/client.js 的 REFRESH_MS(默认 60000) |
| 文案 | lib/client.js 里的 t("中文", "English") |
| 上报的客户端版本 | lib/client.js 的 CLIENT_VERSION |
改完跑一次 node install.mjs,再刷新窗口(profile 配置会热加载,但浏览器 bundle 不会自己热更)。
不想刷新可以在插件页把这一项关掉再打开,让条目重新挂载。
node test/client.test.mjs # 11 项单测:注册、渲染、面板、金额格式化、低余额、未登录降级
结构:
| 路径 | 作用 |
|---|---|
package.json |
dsh.bundle.patch(bundle 层)+ dsh.client(web 客户端半侧) |
cordis.patch.yml |
bundle 层插入 ui-account-balance 行 |
lib/index.js |
Host 半侧,无行为 |
lib/client.js |
浏览器 bundle:注册 conversation.composer.dock 条目、读余额、算会话/本轮、渲染面板 |
test/client.test.mjs |
用 Node 跑的最小渲染测试 |
install.mjs |
命令行安装/卸载 |
在 DSH 0.2.1-rc.2(桌面版)上验证。插件依赖 remote.account 服务,只对 DeepSeek 账号模式生效。
包里硬编码了 CLIENT_VERSION;如果 DSH 大版本变化后连「设置 → 账号与余额」都打不开,把它改成对应版本再试。
MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。