dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
Balance & usage card plugin built on the DeepSeek Harness for its Web GUI: DeepSeek account balance with color tiers, plus live per-conversation token usage and cost (peak/off-peak priced).
定位说明:本插件是基于 DeepSeek Harness(dsh)开发的余额卡片插件, 不是 DeepSeek 官方余额卡片,与 DeepSeek 平台无隶属关系。它读取的是 当前 harness 里配置的
DEEPSEEK_API_KEY所对应账户的余额。
右下角浮窗卡片显示余额(按档位着色),以及当前对话的实时 token 用量、 缓存命中率与费用(按高峰·低谷分桶计价)。
lib/index.js)+ 浏览器半(lib/client.js)双面结构,
通过 harness 的 credentials / webServer / sessionPersistence 等原生服务工作,
不依赖任何第三方运行时包。DEEPSEEK_API_KEY 解析——谁装在这台 harness 上,就查询谁的账户余额。lib/pricing.js 的价格表策展自 DeepSeek 官方公告
(https://api-docs.deepseek.com/zh-cn/quick_start/pricing/),内置官方政策时间表
(含 2026-08-17 起峰谷定价:高峰 09:00–12:00 / 14:00–18:00,空闲时段半价),
按每条消息的时刻自动选择生效政策。如官方调整价目,需同步更新该文件。session/event +
回放持久化日志),费用按内置价目表本地计算,非 DeepSeek 平台权威账单。shell.overlay 右下角浮窗):余额字体按档位着色
(≥¥50 绿、¥10–50 橙、<¥10 红)、可用状态、手动刷新、头部箭头可收起/展开
(收起只显示余额)。balance-show-pos:<会话id>),
窗口/容器缩放时按最近边缘比例跟随并钳制在容器内;侧边栏等面板打开时,自动
贴到面板边缘外侧避免被盖住(避让只是显示位移、不改变记忆位置,面板关闭即回到原处)。dsh plugin --profile web add @javierni/balance-show
dsh plugin add 即可完成安装;
其 import 的 @deepseek-ai/cordis、@deepseek-ai/dsh-credentials、react
均来自 dsh 自带闭包,无需额外安装。装完后必须确认 profile 的 pnpm-workspace.yaml 包含以下两项,否则
插件不会被正确挂载、或点击更新无法生效:
# 1. 让 bundle 的 ESM 依赖(@deepseek-ai/*、react)能从 flat 目录解析
nodeLinker: hoisted
# 2. 排除 release-age 门禁:否则 pnpm 会静默拒绝刚发布的新版本,
# 导致点击"更新"升不到最新版
minimumReleaseAgeExclude:
- '@javierni/*'
如果之前用旧版本安装导致
^0.2.x之类范围残留在 profile 的 package.json,需执行dsh plugin --profile web update @javierni/balance-show让依赖范围重写为最新(插件内点击更新也会自动用add @latest重写范围)。
然后重启 dsh web(新增 bundle 需要启动时扫描),刷新浏览器页面即可看到
右下角卡片。
插件自动检查 npm 线上版本(启动时 + 每 12 小时),右下角卡片底部常驻显示:
更新于 21:00:00 本地版本 v0.3.4 线上版本 v0.3.4
线上版本 vX.Y.Z 变为可点击。线上版本 vX.Y.Z 即通过本机 pnpm 执行 pnpm add @javierni/balance-show@latest
完成更新,成功后提示重启 dsh web。dsh-pnpm-bin → corepack → npx 顺序探测,
且会跳过与 profile 的 pnpm store 大版本不匹配的 pnpm(v0.3.9 起:先读
node_modules/.modules.yaml 的 store 版本再过滤启动器,避免 DSH Desktop 捆绑的
pnpm 10 读 pnpm 11 的 store 时报 ERR_PNPM_UNEXPECTED_STORE)。CHANGELOG.md。把本包拷贝到 profile 依赖树(必须拷贝而非 junction/symlink:插件自身的
ESM 依赖需从 profiles\node_modules 向上解析):
Copy-Item -Path "<你的插件源码目录>" -Destination "$env:USERPROFILE\.dsh\profiles\node_modules\@javierni\balance-show" -Recurse -Force
在 $env:USERPROFILE\.dsh\profiles\web\cordis.patch.yml(CLI 版;桌面版为
%APPDATA%\dsh-desktop\harness\profiles\web\cordis.patch.yml)的 patch 数组里追加
(新行必须放在 - insert: 列表里):
- insert:
- id: balance-show
name: '@javierni/balance-show'
重启 harness(dsh web),刷新页面。修改源码后需重新拷贝并再次重启。
删除上述 patch 行与 @javierni 目录(或 dsh plugin --profile web remove @javierni/balance-show),重启。
node plugins/balance-show/scripts/test-balance.mjs # 宿主取数逻辑冒烟测试
curl http://127.0.0.1:3080/balance # 余额路由
curl "http://127.0.0.1:3080/api/session-stats?sessionId=x" # 会话统计路由
MIT