DeepSHPlugins
dsh-token-usage 專案預覽
GITHUB / COMMUNITY PROJECT

dsh-token-usage

安全與運維JavaScriptMIT

Token 用量熱力圖:日/周/累計檢視,12 個月視窗,支援深淺色主題。

1 Starskelearns 更新時間 2026-08-15
訪問 GitHub 倉庫
dsh-token-usage 專案預覽
dsh-token-usage 介面截圖dsh-token-usage 介面截圖dsh-token-usage 介面截圖dsh-token-usage 介面截圖dsh-token-usage 介面截圖

專案介紹

中文

Token 用量熱力圖:日/周/累計檢視,12 個月視窗,支援深淺色主題。

English

Token usage heatmap for the Web UI: daily/weekly/cumulative views over a 12-month window with light/dark themes.

專案資訊與收錄訊號

快照 2026-09-11
作者 / 組織
kelearns
倉庫
kelearns/dsh-token-usage
GitHub Stars
1
Forks
0
開發語言
JavaScript
許可證
MIT
最近推送
2026-08-15
Manifest
資料中檢測到宣告

公開倉庫不自動等於可商用;許可證與當前相容性以原專案文件為準。Manifest 和資料評分不構成安裝安全認證。

資料評分

54/ 100
維護活躍
81
文件與實用資訊
100
生態關注度
9
安裝便捷訊號
100
專案宣告訊號
100

README 含完整安裝與使用說明;關注度尚低(1);標準命令一鍵安裝。

評分來自已有資料快照的五維模型,僅作瀏覽參考,不是實際使用評測或安全檢測結論。

安裝與使用

所有專案資料與許可均以對應 GitHub 倉庫為準。

dsh plugin --profile web add github:kelearns/dsh-token-usage

複製命令不會自動執行。請先閱讀倉庫文件,確認環境要求與許可證。

專案截圖

倉庫 README

GitHub 原文

已儲存的倉庫文件快照;文件抓取時間未記錄,可能與上方目錄介紹處於不同版本。安裝前請核對當前倉庫說明。

儲存庫檔案保留原文,指令與授權文字不作自動改寫。

English | 简体中文

@kelearns/dsh-token-usage

npm version License GitHub

Token usage heatmap for the DeepSeek Harness (dsh) web GUI — a GitHub-style contribution graph for daily / weekly / cumulative token consumption, with a summary bubble, hover details, and activity insights. Mounted through the official dsh plugin mechanism (dsh plugin add) — no dsh source changes.

A "Token Activity" entry appears in the settings sidebar.

Screenshots

Daily heatmap — dark theme, English (12-month window)

Daily token usage heatmap, dark theme, English

Three views — dark theme, English

DailyWeeklyCumulative
Daily viewWeekly viewCumulative view

Light theme & Chinese UI

Light (English)深色主题(简体中文)
Light theme, EnglishDark theme, Chinese

Features

  • Summary bubble — one rounded container with 5 statistics divided by

vertical rules: total / peak-day / longest session / current streak / longest streak;

  • Three views — Daily (per-day color levels), Weekly (per-week stacked

cells: week total ÷ (max week / 7) cells, deepest color), Cumulative (per-week cumulative stack: total ÷ 7 per cell, newest column always full);

  • Window switch — last 3 / 6 / 12 months (default 12); fixed 12px cells,

12-month view scrolls horizontally and auto-scrolls to the latest week;

  • Hover details — hovering a cell shows that day's total, that week's

total, or the week-to-date cumulative as of that day (localized zh/en);

  • Activity insights — most used model / reasoning effort / tool, peak

hour, daily & monthly averages, most active weekday, most active day; sorted by label length, two equal columns with a continuous center divider;

  • i18n — zh / en, follows the document language live;
  • Themes — light & dark palettes, follows the dsh application theme;
  • Auto refresh — re-scans changed session files every 60s and on focus;
  • Cross-platform — pure Node stdlib on the host side (fs / path / os / zlib), works on Windows, macOS and Linux; the browser half is platform-agnostic.

Install (official mechanism)

Requires pnpm on PATH:

npm install -g pnpm

From npm (recommended):

dsh plugin --profile web add @kelearns/dsh-token-usage
Listed in awesome-dsh-plugin curated registry;
also searchable as token-usage in the Plugin Market tab of dsh settings (dsh-market).

Local development install (run from this repository's root — link:. resolves to the current directory):

dsh plugin --profile web add link:.

Remove:

dsh plugin --profile web remove @kelearns/dsh-token-usage
The installer reads cordis.patch.yml (the dsh.bundle.patch manifest
field) and applies the plugin row automatically — no manual patch editing.
Restart dsh web to activate.

Manual equivalent (no CLI)

  1. Put the package into the profile node_modules:

$DSH_HOME/profiles/web/node_modules/@kelearns/dsh-token-usage;

  1. Append this block to $DSH_HOME/cordis.patch.yml (idempotent):
- insert:
    - id: dsh-token-usage
      name: '@kelearns/dsh-token-usage'
  1. Restart dsh web.

Data source

$DSH_HOME/sessions///session.jsonl.zstd (the official dsh JSONL persistence: concatenated zstd frames; first line is the session header, followed by the event stream).

Token usage is folded from assistant/chunk events with chunk.type === "usage" (usage { inputTokens, outputTokens, cacheReadTokens }) attributed to local days by event time (epoch ms). Total = input + output + cache read. Insights additionally read request/header (model / reasoning effort), tool/call (tools) and usage timestamps (peak hour / weekday).

Per-file results are cached by (size, mtimeMs); rescans only re-decode changed (active) sessions.

Routes (same-origin)

MethodPathDescription
GET/dsh-token-usage/statsFull statistics: { totals, stats, insights, today, days:[{d,i,o,c,a}], scan }
POST/dsh-token-usage/refreshForce cache invalidation and rescan
GET/dsh-token-usage/statusCache / last scan state

Configuration

- insert:
    - id: dsh-token-usage
      name: '@kelearns/dsh-token-usage'
      config:
        refreshIntervalMinutes: 5   # background rescan interval (default 5)

Tests

node test/mock.test.mjs                                   # synthetic full pipeline
node test/mock.test.mjs "$env:USERPROFILE\.dsh"  # real-data smoke (any DSH_HOME)
node test/layout-algo.mjs                                  # layout algorithm matrix

Known limitations

  • Counts sessions that carry usage events (dsh session log format, verified on 0.1.0-rc.6);
  • Days are attributed in the process local timezone; weeks start on Monday;
  • zstd decompression requires Node >= 22.2 (satisfied by the official dsh runtime);
  • Missing/unreadable session directories yield empty statistics without affecting the GUI.

License

MIT

使用前核對

安裝步驟、相容版本與授權範圍以原專案當前文件為準。Stars 和評分是快照中的導航訊號。

安裝與排錯 · 專案問題反饋

同類專案