dsh-strength-meter — Model Usage Stats for DSH 0.2.x
A local token-usage statistics section for the DeepSeek Harness Settings panel: metric cards, per-model donut, a 15-week activity heatmap, and a daily token trend. Everything is folded from your local session logs through the current sessionQuery service; nothing is uploaded.
中文文档见 README.zh.md。
| |
|---|
| Plugin | dsh-strength-meter 2.0.0 |
| Harness | DeepSeek Harness 0.2.1-rc.2 (Desktop or dsh web) |
| Layer | Host route + Settings client section |
| License | MIT |
What changed from 1.x
DSH 0.2 replaced the old host session seams. Version 2 keeps the same UI and
route path but reads the corpus through today's API:
| Concern | 1.x | 2.0.0 |
|---|
| Live sessions | ctx.sessions.list() → session.events | ctx.sessions.list() for ids; logs read through sessionQuery |
| Cold sessions | sessionPersistence.listSnapshots() / inspect(id) | sessionQuery.readSession(id) (live-preferred, replay-validated) |
| Cache key | persistence revision from listSnapshots | sessionPersistence.list() revision (optional; folds still work without it) |
| Client icons | @deepseek-ai/dsh-client-ui-primitives | Local SVG glyph (no primitives import) |
| Registration | settings.section (compatible) | settings.section (unchanged) |
The fold itself (lib/fold.js) is unchanged and still mirrors the durable log:
request/header names the model, assistant/message.usage / assistant/chunk
carry tokens, and user/assistant messages drive the activity calendar.
Install
Plugin Manager (Desktop)
Install this folder as a bundle and enable dsh-strength-meter.
CLI
dsh plugin --profile <profile> add /absolute/path/to/dsh-strength-meter
Manual
Link the package into the profile's node_modules, then add to cordis.patch.yml:
- insert:
- id: dsh-strength-meter
name: 'dsh-strength-meter'
Reload the page. No Harness file is patched.
Use
Open Settings → Usage stats (the section sits after the built-in sections).
Pick Last 7 days / Last 30 days, or press the refresh button to bypass the
15 s response cache. The first read folds the whole corpus with a concurrency of
4; subsequent reads reuse folds whose persistence revision is unchanged.
Route
GET /plugins/dsh-strength-meter/usage.json?days=7|30&force=1
The payload contains total, models[], sessions, messages, activeDays,
streak, topModel, byDay[], heatmap[][], and a debug block with
corpus/folded/cached/errors.
Verify
npm test
# → fold tests, host smoke test, bundle smoke test
Live check: open the stats section; the metric cards must show non-zero totals
for a profile with history, and the heatmap must render 15 columns.
Limits
- Response cache — 15 seconds unless
force=1.
- Bounded corpus — at most 400 sessions per request.
- No projection dependency — the plugin deliberately folds raw logs instead
of registering a
sessionStats projection, so it works in any composition.
License
MIT.