rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:Aily-DSH/dsh-session-usage
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
给 DeepSeek Harness 的「对话用量」插件:把每个会话的输入 / 缓存读 / 缓存写 / 输出 token 与估算费用汇总成一张表,并直接标注在侧栏会话行上。
DSH 自带的用量信息是「当前会话、当前上下文」视角,回答不了这些问题:
本插件直接解析本地会话日志($DSH_HOME/sessions/<project>/<session>/session.v4.jsonl.zstd),所以历史会话也算得出来,而不是从装上插件那一刻开始计数。
Token 用量 与 费用,一键切换,选择会被记住工作区 3h ¥ …),不会挤到标题前面~/.dsh/dsh-session-usage/cache.json,只有日志增长的文件才重新解析^22.19.0 || >=24.0.0(用到内置 zlib 的 zstd 能力)$DSH_HOME(默认 ~/.dsh)cd "/d/Program Files/DeepSeek Harness/resources/runtime/cli/bin"
./dsh.cmd plugin --profile desktop add "git+https://github.com/Aily-DSH/dsh-session-usage.git"
或本地开发:
dsh plugin --profile desktop add "file:/D:/path/to/dsh-session-usage"
装完重启一次 DeepSeek Harness 客户端,然后打开 设置 → 对话用量。
插件没有必填配置。相关路径:
| 路径 | 说明 |
|---|---|
$DSH_HOME/sessions/<project>/<session>/session.v4.jsonl.zstd |
数据来源(DSH 自己写的会话日志) |
~/.dsh/dsh-session-usage/cache.json |
解析缓存(可随时删除,删除后重建) |
GET /api/dsh-session-usage/list |
宿主路由,返回汇总后的列表(仅回环) |
计价口径:
deepseek-flash 价目折算(人民币 / 百万 token),并把 deepseek-v4-pro 收敛到同一行lib/holidays.js(由 tools/gen-holidays.mjs 生成),到期后可重新生成DSH 的会话日志是「追加写的独立 zstd 帧序列」,每个帧里是一段 JSONL 事件。Node 的 zstdDecompressSync 遇到第一个帧就停,所以宿主半按 zstd 魔数(28 B5 2F FD)切分文件、逐帧解压。
为控制开销:
tool/result、request/header 行,再 JSON.parseusage 里的 inputTokens / outputTokens / cacheReadTokens / cacheWriteTokens / totalTokens)mtime + size 命中缓存,避免重复解压CACHE_VERSION)升级后会自动重建dsh plugin --profile desktop remove dsh-session-usage
删除 ~/.dsh/dsh-session-usage/(可选)。
lib/index.js 宿主半:日志发现、逐帧解压、事件聚合、缓存、/list 路由
lib/client.js 客户端半:设置页表格 + 侧栏标注
lib/pricing.js 峰谷价与人民币换算
lib/holidays.js 中国法定节假日/调休表(生成物)
tools/gen-holidays.mjs 重新生成节假日表
cordis.patch.yml 插入插件行
如果这个插件帮你省了钱,欢迎扫码请作者喝一杯 ☕(纯属自愿,不影响使用和更新)
dsh / dsh-plugin / deepseek-harness / plugin 等 topics。dsh.profile.indexes 即可在客户端内直接看到 dsh-session-usage。dsh plugin --profile desktop add git+https://github.com/Aily-DSH/dsh-session-usage.git 直接装。dsh-session-usage shows per-conversation token usage and cost for DeepSeek Harness. It parses the local session logs directly ($DSH_HOME/sessions/.../session.v4.jsonl.zstd, an append-only sequence of zstd frames, decompressed frame by frame), so past conversations are included rather than starting from installation. A settings section renders a sortable table with input / cache-read / cache-write / output tokens and an estimated CNY cost that follows the official peak/off-peak rule (weekday 09:00–12:00 and 14:00–18:00 Asia/Shanghai are peak, everything else half price; Chinese holidays accounted for). The same number is painted onto sidebar session rows. Parsed data is cached in ~/.dsh/dsh-session-usage/cache.json.
dsh plugin --profile desktop add "git+https://github.com/Aily-DSH/dsh-session-usage.git"
# restart the client once
Sponsor: if this plugin saved you money, you can buy the author a coffee — scan assets/reward-qr.png.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness、deepseek-harness-plugin。