reactive-resume
reactive-resume
A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
genius-alray/dsh-plugin-session-token-stats
Token usage dashboard for DeepSeek Harness: totals, monthly usage, cache-hit rate, daily timeline, per-session breakdown with subagent sessions merged, and live CPU/memory monitoring. No cost estimates.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:genius-alray/dsh-plugin-session-token-stats
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 中文
A DeepSeek Harness (dsh) Web plugin that turns your real session logs into a token-usage dashboard: total tokens, session count, a daily usage timeline, per-session breakdown with cache-hit rate, and live CPU/memory monitoring.
It counts tokens only. There is no reliable billing API for these sessions, so the page deliberately shows no estimated cost and no budget instead of presenting a guess as a fact.
parentSession chain is folded, including multi-level delegation) and never listed separately. Select a row to expand the per-model breakdown, merged subagent count, creation/last-activity timestamps, and session id.The Host half reads durable session logs through ctx.sessionQuery.listSessions() / readSession(id) and counts every assistant/message usage report:
| Field | Meaning |
|---|---|
| uncached input | usage.inputTokens (DeepSeek excludes cache hits from this field) |
| cache hit | usage.cacheReadTokens |
| output | usage.outputTokens |
| total | uncached + cache hit + output (+ cacheWriteTokens where a provider reports it) |
| cache-hit rate | cache hit ÷ (uncached + cache hit) |
Two deduplication rules keep the numbers honest:
inheritedEventCount are counted (the latest session/title is still read from the whole log).header.parentSession identifies the spawning conversation; sessions are grouped up that chain to the top-most main session and reported as one row.Persisted sessions are immutable, so each log is read once and cached; live sessions are re-read on every refresh. The first open decompresses and replay-validates every log (roughly 10–20 seconds for 500+ sessions) and reports { done, total } progress while polling quickly; afterwards refreshes only re-read running sessions.
dsh >= 0.2.1-rc.2.sessionQuery, webServer, and connection (all present in the shipped Web profile).The plugin is a normal dsh bundle: it registers one Host row and one client half, and does not override any shipped component.
Open Plugins → Add plugin → Install third-party plugin and paste one of:
dsh-plugin-session-token-stats
The same field also accepts a local directory or a Git URL.
# From a local checkout (development)
dsh plugin --profile web add /absolute/path/to/dsh-plugins/session-token-stats
# Or directly from this repository
dsh plugin --profile web add https://github.com/genius-alray/dsh-plugin-session-token-stats
After installation, reload the page; a bar-chart entry (Token stats) appears at the bottom of the left sidebar.
Both routes are same-origin and owner-authenticated through the Connection service (unauthenticated → 401; missing Connection service → 403, fail-closed):
GET /session-token-stats/data — totals, daily buckets, grouped per-session aggregates, scan progress.GET /session-token-stats/live — CPU / load / memory sample ring (1 Hz, last 120 samples).server.js Host: log folding, subagent grouping, CPU sampling, the two JSON routes
client.js Client: main panel + sidebar entry, timeline, table, settings
locale/*.json Plugin catalog metadata (Chinese / English)
cordis.patch.yml Inserts this plugin's Host row only
icon.svg Plugin icon
tests/ Host and Client logic tests (node:test)
npm run check # node --check on both halves
npm test # node --test tests/
Tests need no third-party dependencies. The Host suite drives apply() with a synthetic corpus through a fake Cordis context (usage folding, peak/off-peak day buckets, inherited-prefix exclusion, subagent grouping, scan caching, route auth); the Client suite loads the browser bundle with a stub module loader and covers token formatting, cache-hit rate, timeline zero-fill, per-browser preferences, and dictionary parity.
session/title event, falling back to the first user message for older logs.CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: monitoring。