Turbo-Harry/dsh-status-balance

Turbo-Harry★ 0JavaScriptLast synced: 2026-08-15

Open on GitHub

README excerpt

dsh-status-balance DeepSeek Harness 的树外(out-of-tree)双面插件:在 右下角 显示 DeepSeek API 账户余额。 - host 半身 ( lib/index.js ):读取 DEEPSEEK API KEY ,调 GET https://api.deepseek.com/user/balance ,缓存结果;一方面 ctx.emit("balance/updated", …) 推给所有客户端,另一方面注册只读的 /status-balance 拉取端点。 - client 半身 ( lib/client.js ):往 frame 级 shell.overlay 槽注册一个小角标;挂载时先 fetch("/status-balance") 秒出首屏,再订阅 balance/updated 实时刷新。 架构要点(为什么是这样) 1. 密钥只在 host 侧 :余额接口要 Bearer 密钥,浏览器绝不能碰。host 半身零 import( credentialRef 运行时是恒等函数,直接用字符串 "DEEPSEEK API KEY" )。 2. 推送 + 拉取双通道 :实时更新走 forwarded-event(host ctx.emit("balance/updated") → dsh-host-apiproxy 转发循环 → 客户端 ctx.remote.$on ,需第 1 步的 allowlist);首屏秒出走只读 HTTP 端点 /status-balance (host 用 ctx.webServer.register 注册,client 挂载时 fetch 一次)。 3. 右下角 = shell.overlay 槽 : dsh-client-ui-layout 把它渲染进一个 position:absolute; inset:0; z-index:20 的浮层,角标用绝对定位钉在 right:16px; bottom:16px 。 安装(4 步) 1. 把 balance/updated 加进转发 allowlist 编辑 @deepseek-ai/dsh-api-remotes/lib/index.js ,在 API REMOTE FORWARDED EVENTS 数组里加一行: 该文件位于(本机): /Users/wuhai/.nvm/versions/node/v22.19.0/lib/node modules/@deepseek-ai/dsh/node modules/@deepseek-ai/dsh-api-remotes/lib/index.js 注:这是对第一方包的单点改动,重装 DSH 会被覆盖;客户端 $on 无运行时 allowlist 校验,所以 只改这一处 host 文…

View full README on GitHub →
Tools / Devdsh-plugin

Category