pi2dsh
weijiafu14
Bridge the Pi and DeepSeek Harness ecosystems: one Pi Host ABI runs unmodified Pi extensions as native DSH plugins. 打通 Pi 与 DSH 生态。
zoyluoblue/deepseek-harness-token
DeepSeek Harness (dsh) plugin for machine-wide token usage statistics — a Settings page with totals, a GitHub-style contribution heatmap, streaks, and a per-model breakdown. Folds session logs from every dsh home; no cost estimates.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:zoyluoblue/deepseek-harness-token
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 中文

@zoytown/dsh-token is a DeepSeek Harness (dsh) plugin that reports your token usage across the whole machine. It folds the session logs of every dsh home — ~/.dsh and each ~/.dsh_desktop/<version> — into a Token page in Settings: headline totals, a GitHub-style contribution heatmap, current and longest streaks, peak hour, and a per-model breakdown of the four disjoint token buckets. It registers no model-facing tool and appends no session event, so mounting it costs the conversation nothing.

Everything is local and read-only: the plugin never writes to a session, never contacts a network service, and answers loopback callers only — the payload lists working directories, which is effectively a list of your projects.
Cost. The harness stores no price table — @deepseek-ai/dsh-llm-pi-ai hardcodes NO_COST and its own comment states the harness never reads a provider's cost metadata. Any currency figure here would be a local guess dressed up as a fact. Account balance is a separate concern, covered by @zoytown/dsh-billing.
dsh plugin --profile web add @zoytown/dsh-token
Requires Node ^22.19 || >=24 and pnpm on PATH (dsh plugin is a thin pnpm forwarder). Then open Settings → Token.
No global dsh on your PATH? Either form works:
npx -y @deepseek-ai/dsh plugin --profile web add @zoytown/dsh-token # published CLI
pnpm dsh plugin --profile web add @zoytown/dsh-token # from a harness checkout
Pick one and stay with it — both CLIs re-point the <DSH_HOME>/profiles/node_modules symlink farm at their own installation on every boot.
To remove it:
dsh plugin --profile web remove @zoytown/dsh-token
This plugin targets dsh web. An Electron shell wrapping the harness may pin bare module resolution to its own bundle, which makes a profile-installed plugin unresolvable — and the plugin tree then fails to load outright rather than degrading, so the app will not start. Do not install this plugin into such a shell's DSH_HOME. You do not need one anyway: sessions recorded under ~/.dsh_desktop/<version>/ are read from dsh web all the same.
Set on the dsh-token row in the profile's cordis.patch.yml:
| Key | Default | Meaning |
|---|---|---|
extraSessionRoots |
[] |
Extra dsh home directories to scan. Discovery covers ~/.dsh and ~/.dsh_desktop/<version>; a home reached through a $DSH_HOME that is not currently set needs listing here. |
includeCompaction |
true |
Count tokens spent generating compaction summaries — real spend the harness's own tokenUsage projection cannot see. Set false to reconcile 1:1 with it. |
refreshIntervalMs |
30000 |
How often to re-scan for appended sessions. |
indexChunkYieldMs |
16 |
Cooperative yield interval during a scan. |
The rules matter more than the code, so they are stated plainly:
(turn, step) and replaced, never accumulated, matching the harness's own projection.Intl rather than UTC millisecond arithmetic, and streaks are measured between noon anchors so a daylight-saving transition cannot break one.Metering coverage, retried steps, sessions still being written, and skipped logs are all disclosed in the page footer rather than silently absorbed.
A full scan is not viable on the read path: folding ~1,200 sessions / ~319 MB of compressed logs takes about 4 s, and the cost is frame-bound rather than byte-bound, so a faster decompressor does not fix it. So the host half folds once in the background and afterwards reads only the bytes appended since, keyed on (dev, ino, size, mtime). The browser half never sees a log byte — it renders a view model fetched from one loopback JSON route.
Session logs are a container of concatenated, independently decodable zstd frames, which is both why Node's stock zstd APIs cannot read them (they stop at the first frame) and why resuming from a stored byte cursor is sound.
npm install
npm run typecheck
npm run build
MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: token-usage、usage-statistics。