rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:nanvtin-droid/dsh-token-account
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Token usage, wallet balance, and daily/monthly usage overview for DeepSeek Harness — as a sidebar panel.
A DSH plugin (Host + Client halves) that adds one entry to the left sidebar and answers "how much has this account used, and how much is left?" without leaving the app.
中文说明见下方 中文文档。
The panel running in the Harness Web UI (light theme), showing the wallet, today / month / recent totals, the monthly daily-usage chart, the daily table, and the model breakdown:

Captured on v1.0.0. Since v1.1.0 the input/output and cache/requests detail under each total sits on its own line instead of being truncated.
| Block | Content |
|---|---|
| Wallet | DeepSeek Platform wallet balances (recharge + bonus), signed-in profile name, links to the Platform usage page and top-up |
| Today | Tokens used since local midnight: cache reads, cache-miss input, output, request count |
| This month | Tokens used in the current local month, with active days |
| Recent | Tokens over the selected window (180 days by default) |
| Daily usage by month | One stacked bar per day (cache read / input / output), month switcher, monthly total, active days, daily average, peak day, cache share |
| Daily detail | The last 14 days as a table |
| Model breakdown | Tokens per provider/model for the window |
The plugin is a DSH bundle: a package that declares dsh.bundle.patch.
git clone https://github.com/nanvtin-droid/dsh-token-account.git
Then install that directory in the current profile (absolute path):
// plugin_manager → install_bundle
{ "target": "C:/path/to/dsh-token-account" }
The plugin manager runs the package install, adds @local/dsh-token-account to the profile
bundles, and applies the row live. The sidebar entry appears next to the other panel icons;
refresh the Web UI once if the page was already open (client bundles load with the page).
Remove the @local/dsh-token-account bundle from the Plugins page (or plugin_manager →
remove_bundle). The plugin keeps no state of its own — everything it shows derives from the
session logs and the account service.
sidebar.panellist#token-account → main#token-account
│
GET /api/token-account/overview
│
┌─────────────────────────┴─────────────────────────┐
ctx.sessionQuery + ctx.sessionPersistence ctx.deepseekAccount
fold assistant/message TokenUsage per day getBalance / getProfile
assistant/message usage
records the Harness replays. Forked sessions inherit their source's events; only events the
session actually produced are counted, so a fork never double counts its prefix.ctx.deepseekAccount.getBalance, the same Platform
wallet the account settings show. The browser never receives a credential: the Client half
only calls the same-origin JSON route.list() instead of a full log replay. The first visit to a large corpus runs under a
time budget and the panel keeps asking until every session is folded.The adapter reports inputTokens as prompt tokens not served from cache, with
cacheReadTokens / cacheWriteTokens beside it; its own totalTokens equals the sum of the
parts (verified against live logs). The panel therefore defines:
total = input (cache miss) + output + cache read + cache write
and shows cache reads separately, so the numbers never contradict each other.
The row accepts an optional config block (no schema is declared, unknown keys are ignored):
- id: token-account
config:
scanBudgetMs: 7000 # per-request budget for folding new session logs
maxSessions: 400 # newest sessions considered
readConcurrency: 3 # parallel session reads
accountTtlMs: 30000 # wallet cache lifetime
defaultDays: 120 # day window when `days` is absent
maxDays: 366 # hard cap for the days query
clientVersion: '1.0.0' # x-client-version sent to the Platform
node test/host.test.mjs # daily buckets, fork de-duplication, cache reuse, wallet mapping
node test/client.test.mjs # registrations, locale dictionaries, full render smoke test
Both tests run against plain Node (no DSH process needed); the Client test renders the panel through a stub React runtime.
DSH 左侧栏账号用量面板:Token 消耗、钱包余额、每日与月度用量总览。
git clone https://github.com/nanvtin-droid/dsh-token-account.git
然后在当前 profile 里用插件管理器安装该目录(绝对路径):
{ "target": "C:/path/to/dsh-token-account" }
装好后左侧栏会多出一个图标;若页面已经打开,刷新一次即可(Client 半部随页面加载)。
assistant/message 用量记录,按本地自然日聚合;分叉会话只统计自身产生的事件,不会重复计算源会话前缀。ctx.deepseekAccount.getBalance(与设置里的账户同源)。浏览器只请求同源 GET /api/token-account/overview,拿不到任何凭据。适配器的 inputTokens 是未命中缓存的输入,另有 cacheReadTokens / cacheWriteTokens,官方 totalTokens 为各项之和。因此面板的「总量」= 输入 + 输出 + 缓存读取 + 缓存写入,缓存命中单独展示,不会出现总量小于缓存命中的怪数。
同上文 YAML 示例(scanBudgetMs、maxSessions、defaultDays 等)。
node test/host.test.mjs
node test/client.test.mjs CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。