rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:yinshipeng/dsh-token-ledger
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
在 DeepSeek Harness(DSH)的对话页顶栏常驻一枚小胶囊,显示本机 DSH 所有会话累计消耗的 Token 总数。数字随着 DSH 的持续使用而增长,跨重启保留,连已被删除的会话消耗过的部分也仍然保留。
A DeepSeek Harness (DSH) Web UI plugin: one compact pill in the conversation header showing this machine's lifetime token consumption across all local sessions.
🪙 累计 21.85亿 ← 会话标题栏右侧,悬停看分项,点击复制精确值
DSH 自身只展示当前会话的上下文与用量。这个插件回答的是另一个问题:
我在这一台电脑的 DSH 上,总共烧掉了多少 token?
不打开任何面板、不切页面,抬头就能看到数字在涨。
conversation.session.header.utilities,位于对话窗口标题栏右侧在 DSH 的 插件 → 发现 中添加索引源后搜索 dsh-token-ledger(收录后可见):
https://dshopen.org/index.json
# 从插件市场使用的固定提交安装
dsh plugin --profile desktop add 'git+https://github.com/yinshipeng/dsh-token-ledger.git'
# 发布 npm 版本后
dsh plugin --profile desktop add dsh-token-ledger
安装后刷新页面(桌面端重启客户端)即可在会话标题栏右侧看到胶囊。
数字来自 DSH 自己的 tokenUsage 投影(@deepseek-ai/dsh-token-meter),口径与 DSH 内部一致:
| 分项 | 字段 | 含义 |
|---|---|---|
| 未缓存输入 | uncachedInputTokens |
未命中前缀缓存的 prompt token |
| 缓存读取 | cacheReadTokens |
命中前缀缓存的 prompt token |
| 缓存写入 | cacheWriteTokens |
写入缓存的 token |
| 输出 | outputTokens |
模型生成的 token |
| 胶囊上的数字 | 四者之和 | 本机处理过的全部 token |
| 非缓存合计 | 未缓存输入 + 输出 | 悬停可见,适合与账单对照 |
缓存读取通常占大头(每一轮都要重新读一遍上下文),所以「总计」会明显大于「非缓存合计」,两者都在悬停面板里。
turn/end、会话释放时由 DSH 自动把 tokenUsage 投影落盘到 $DSH_HOME/storages/session_projcache/。插件直接读这份结果,不回放会话日志,因此开销接近零,也能覆盖早已结束的会话。session/event,把 assistant/message 上 provider 返回的 usage 先记账,等下一次 checkpoint 落盘后自动去重。$DSH_HOME/token-ledger/ledger.json 记录每个会话观察到的最大值与未合并的实时增量,重启后继续累加。会话被删除后,它贡献的消耗仍留在账本里。$DSH_HOME/token-ledger/ledger.json 中connection.requestRejection 认证的浏览器请求;拿不到该服务时一律拒绝,不会退化为只检查回环地址GET,没有写操作| 项 | 要求 |
|---|---|
| DSH | >=0.2.2-rc.1(声明在 dsh.engines.dsh) |
| Node.js | >=22.19.0 |
| 形态 | Web / Desktop 均可(需要 Web UI 宿主) |
已在 macOS + DeepSeek Harness Desktop 0.2.2-rc.1 实测。
| 文件 | 职责 |
|---|---|
index.js |
Host:聚合所有会话的 tokenUsage 投影、实时事件、持久账本、GET /token-ledger/state |
client.js |
Browser:向顶栏 utilities 槽位注册胶囊,轮询状态 |
cordis.patch.yml |
插入一行双端插件 |
locale/*.json |
插件管理页的标题与说明 |
icon.svg |
插件图标 |
dsh plugin --profile desktop remove dsh-token-ledger
账本文件可手动删除:$DSH_HOME/token-ledger/ledger.json。
dsh-token-ledger puts one compact pill in the DSH conversation header showing the lifetime token total of every session on this machine — not just the open one. The number only grows: it is checkpointed into a durable ledger, survives restarts and keeps the consumption of sessions that were later deleted.
tokenUsage projection cache (no session-log replay), plus live assistant/message events between checkpointsconnection.requestRejection gateInstall:
dsh plugin --profile desktop add dsh-token-ledger
MIT © 2026 yinshipeng
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness、deepseek-harness-plugin。