DeepSeek Harness plugin

dsh-usage-hud

DSH 用量悬浮面板:右下角常驻多 Tab HUD(实时 token / 会话记录 / 今日 / 历史 / 热力图 / 24h 曲线 + 费用估算),Host 半从持久化会话日志聚合跨会话历史,零 npm 依赖。

Jump to install

Source facts

Repository
ksk2023/dsh-usage-hud
Latest update
Aug 16, 2026
Category
Memory
GitHub stars
0
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/ksk2023/dsh-usage-hud
Plugin: dsh-usage-hud
Author: ksk2023

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

dsh-usage-hud

> DSH(DeepSeek Harness)用量悬浮面板 — 右下角常驻多 Tab HUD:实时 token、会话记录、今日汇总、历史统计、使用热力图、24 小时曲线,外加按模型估算的费用。 > > A always-on usage HUD for DeepSeek Harness: live tokens, session records, daily totals, history, GitHub-style heatmap, 24-hour curve, and per-model cost estimation — docked in the bottom-right corner of the Web GUI.

![npm](https://www.npmjs.com/package/dsh-usage-hud) ![license](./LICENSE)

---

✨ 功能

面板固定在 Web GUI 右下角(可折叠),六个 Tab:

Tab内容
实时当前会话累计 token 四项(输入未命中缓存 / 缓存命中 / 缓存写入 / 输出)、上下文压力条(>80% 告警变色)、上下文构成(system / tools / messages 三色分栏)、费用估算
会话全部会话记录(自动登记,含子代理标记),按最近活动倒序;展开看详情:创建时间、轮次/请求数、平均每轮用量、分项 token、分模型用量、费用
今日今日汇总卡片(token 总量、请求数、会话数、估算费用)+ 24h 分布迷你条
历史按月汇总 + 按日明细 + 全部总量与总费用
热力图类 GitHub 贡献图;默认近 1 年,可切 1 周 / 1 月 / 半年 / 1 年 / 全部;悬停看当日明细(token / 请求 / 费用)
24h0–23 时用量柱状图,峰值小时高亮;前后翻日;点击热力图某天自动联动查看该日曲线

特性:

  • 重启不丢数据 — 历史统计从 DSH 持久化会话日志(JSONL)重算,无需插件自建数据库
  • 统计与官方口径一致 — 聚合采用 @deepseek-ai/dsh-token-meter 相同的折叠规则(同 turn/step 用量样本替换而非累加),费用按每请求实际模型逐笔估算
  • 零 npm 依赖 — Host 半为纯 JS(手动 typert 注册 + duck-typed Remote 绑定),Client 半为自包含 __ModuleLoader__ bundle
  • 只读、本地 — 不写任何会话数据、不联网上报

📦 安装

需要 DSH ≥ 对应 web profile(含 dsh plugin 命令)与 pnpm:

dsh plugin --profile web add dsh-usage-hud

然后重启 dsh web,面板自动出现(无需会话内 define / 审批)。

升级(用户侧,一行 + 重启 dsh web):

dsh plugin --profile web update dsh-usage-hud
# 跨大版本:dsh plugin --profile web add dsh-usage-hud@latest

卸载:

dsh plugin --profile web remove dsh-usage-hud

本地开发(link 模式,改源码即生效):

git clone https://github.com/ksk2023/dsh-usage-hud.git
cd dsh-usage-hud
dsh plugin --profile web add .

🚀 发布新版本(维护者)

npm version patch        # 0.2.0 → 0.2.1:改版本号 + 提交 + 打 tag(patch/minor/major)
git push --follow-tags   # 推 GitHub
npm publish              # 发 npm(2FA 需 --otp=xxxxxx)

用户侧执行上面的 update 即升到新版本。注意:

  • npm 不允许重复发布同一版本号,每次发布前必须 bump
  • Host 半(lib-host/)与组合变更需重启 dsh web 生效;Client 半(lib/client.js)重启后必然生效
  • link 方式安装的开发副本改代码重启即生效,无需发版

🔧 工作原理

┌─ Client(浏览器)─────────────────┐      ┌─ Host(DSH 进程)──────────────────┐
│ shell.overlay 悬浮面板(6 Tab)    │ RPC  │ usagePanel Remote 服务             │
│  实时 Tab ← sessions 投影          │ ───▶ │  summary()  跨会话/按日/按模型聚合 │
│  其余 Tab ← usagePanel/summary     │/api  │  hourly(date) 指定日小时曲线       │
│            ← usagePanel/hourly     │      │  数据源:sessionQuery 重放持久日志 │
└───────────────────────────────────┘      └───────────────────────────────────┘
  • 实时数据:读取官方 token-meter 投影(tokenUsage / contextPressure / contextBreakdown
  • 历史数据:Host 半经 sessionQuery.readSession() 重放全部会话日志,折叠出与会话内 tokenUsage 完全一致的累计值,再按本地日期 / 小时 / 模型分桶
  • 通信:静态 Remote 通道(connection.rpc.call('/api', 'usagePanel/*')),Host 侧手动 ctx.typert.register() + duck-typed typertRemote 绑定(typert-loader 文档保留的手写路径,codec 全部 src-json
  • 费用估算:内置 DeepSeek 官方定价表(2025-09,美元 / 1M tokens);未收录模型显示 ,可在 lib/client.js 顶部 PRICING 中自行补充

仓库结构:

lib/client.js       浏览器半(__ModuleLoader__ bundle)
lib-host/index.js   Host 半(聚合 + Remote 服务)
cordis.patch.yml    profile 组合行(dsh.plugin add 自动挂载)
src/usage-panel/    开发源与工具(动态版原型、离线验证脚本)
docs/               设计文档与生态调研

📊 数据口径说明

  • token 四桶与 DSH 官方 tokenUsage 投影一致:输入未命中缓存、输入缓存命中、缓存写入、输出(推理 tokens 计入输出)
  • 「上下文构成」为启发式估算(system / tools / messages),三数之和不等于总量属正常
  • 费用为估算值(面板底部有「非账单」提示),以模型提供商实际账单为准

🙏 相关项目

  • dsh-usage-panel(AlfredChaos)— 同领域的设置页版消耗统计(KPI + 热力图 + 模型图表);本插件是悬浮 HUD 形态的独立实现,两者可共存

License

[MIT](./LICENSE)