Token usage dashboard in the DSH settings page: nine metric cards (total, today, yesterday, peak day, longest session, active-day streak, active days, sessions, subagent tokens), a GitHub-style daily/weekly/cumulative heatmap, and an activity insight list, aggregated locally from session logs and projection caches, keeping token history after a session is deleted.
Install
# from a prebuilt release tarball
dsh plugin --profile web add "https://github.com/zeng6125-rgb/dsh-usage-heatmap/releases/latest/download/dsh-usage-heatmap.tgz"
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:zeng6125-rgb/dsh-usage-heatmap
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
模型用量统计面板 — 装在 DSH 设置页里的 Token 用量看板:九宫指标卡 + GitHub 风格热力图 + 活动洞察,数据全部在本地聚合。
An all-local token usage dashboard for the DeepSeek Harness settings page.
功能 / Features
- 九宫指标卡:累计 Token、今日、昨日、峰值日、最长会话、连续活跃(当前 / 历史最长)、活跃天数、会话数(主 / 子代理)、子代理 Token。
- 热力图:GitHub 风格日历,每格 = 当日用量(周一为一周之始),可切「每日 / 每周 / 累计」三档;行标一/三/五/日与格子按同一 7 行网格对齐;列数随容器宽度自适应。
- 活动洞察:峰值日占比、连续活跃区间、会话构成、最长会话、子代理占比、缓存读取占比、今日四桶(未缓存输入 / 输出 / 缓存读 / 缓存写)。
- 不丢数:会话日志被删后,历史 token 仍从投影缓存(
session_projcache)与已扫入的归档分桶中保留;面板把「已删归档」与「孤儿投影」分开标注。 - 性能:投影文件按 mtime 记忆化、逐文件让出事件循环、内容未变不重渲染、持久化快照使重启首帧约 350ms;面板根为自滚动容器(
will-change: scroll-position),滚动走合成器线程。
安装 / Install
从 GitHub 安装(仓库已提交 lib/,无需构建):
dsh plugin add github:zeng6125-rgb/dsh-usage-heatmap
或使用 Release 里的预构建 tarball:
dsh plugin add https://github.com/zeng6125-rgb/dsh-usage-heatmap/releases/latest/download/dsh-usage-heatmap.tgz
装好后在 设置 → 模型用量统计 查看。首次扫描需要几秒(约 8s,取决于会话日志总量),之后走缓存与快照,秒开。
数据来源 / Where the numbers come from
全部为本地文件,插件不发起任何网络请求:
| 来源 | 路径 | 用途 |
|---|---|---|
| 会话投影缓存 | ~/.dsh/storages/session_projcache/sessions/*.json |
会话级累计 token、会话元信息 |
| 会话日志 | ~/.dsh/storages/session*/**.jsonl.zstd |
逐日分桶(多帧 zstd) |
| 聚合缓存 | ~/.dsh/storages/usage-heatmap/cache.json |
增量扫描结果与归档 |
| 快照 | ~/.dsh/storages/usage-heatmap/last-state.json |
重启后首帧秒开 |
逐日分桶依赖会话日志中的事件时间戳;缺失时回退到
createdAt/ 文件 mtime 摊分。
开发 / Development
DSH_CHECKOUT=<dsh source checkout> bash scripts/build.sh # src/ → lib/
npm run typecheck # tsc --noEmit
scripts/build.sh 需要一份 DSH 源码检出(DSH_CHECKOUT,或 ~/dsh-harness / ~/dsh / ~/.dsh/dsh-harness 之一)来链接 @deepseek-ai/* 与 cordis;终端用户安装时用的是仓库里已提交的 lib/,不需要这一步。
tools/*.mjs 是开发期探针(逐日对账、事件字段、帧结构、投影缓存、子代理口径),自带实现、不依赖 lib/。
License
BSD-3-Clause
Links
More in this category
bowenliang123/dsh-context★ 1526
DSH context insight panel: Context dashboard + /context command + Context browser — one-stop context lifecycle management with categorized composition, content details, evolution trends, compaction/injection events, and stats.
Han-1413141/dsh-cost-meter★ 338
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
zh667/TokenLedger★ 203
Sidebar usage panel that attributes tokens to the relay site that served each request, read from your existing provider config: today/month/all-time totals, per-site and per-model breakdowns, a year activity heatmap, and New API / Sub2API / DeepSeek balances.
wssfk12138/dsh-damage-pulse★ 201
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
Ychris12138/dsh-usage-stats★ 163
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
PolinniZhong/dsh-personal-center★ 120
Personal center for DeepSeek Harness: cross-session usage statistics, per-model cost estimation, global custom instructions, a global font-size adjuster, a data-driven desktop pet with bitmap & vector skins, and a conversation status overview, all local and offline.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.