dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
跨 Agent 的 token 用量看板:聚合 Claude Code、OpenCode、Cursor、DSH、OpenClaw、CodeWhale、Hermes 等本地对话日志,台账持久化(删除聊天记录后历史仍留存),提供缓存命中率、成本估算、环比对比与当日下钻分析的侧边栏面板。
Cross-agent local LLM token usage dashboard for DeepSeek Harness (web profile). 跨 Agent 的本地 token 用量看板。
Aggregates local conversation logs from Claude Code, WPS Claude, OpenCode, DSH, OpenClaw, QClaw, CodeWhale, WorkBuddy, Cursor IDE and Hermes (with Codex CLI, Gemini CLI, Cline/Roo and Pi parsers on standby, plus detection-only probes for Trae / Lingma / CodeGeeX / Comate / Ollama / AionUi / Copilot) into a persistent ratchet ledger, and renders a full analytics panel in the DSH web GUI sidebar.
聚合本机 10+ 个 AI 工具的对话日志到持久化台账(源日志删除后历史仍保留),在 DSH web 侧边栏提供完整分析面板。
dsh plugin --profile web add github:skyzhao1223/dsh-agent-token-stats
# npm publishing planned: dsh plugin --profile web add dsh-agent-token-stats
# then restart: dsh webRequires system sqlite3, jq, and zstd (macOS: brew install zstd). Host: DSH >= 0.1.5-rc.
~/.agent-token-stats/ledger.json — ratchet-merged per source × model × day; rescans never double-count; history survives source-log deletion/ focuses model search (Cmd/Ctrl/Alt + / stays with the browser), Esc dismisses the toast → clears search → closes the day drill-down, and it only touches the model filter when this plugin's own search box has focus; tabs are a real tablist/tabpanel pair with ←/→/Home/End and :focus-visible rings; prefers-reduced-motion is honoured. Heatmap cells, bar rows, legend entries and table rows/headers stay mouse-only by design — making ~180 heat cells tabbable would be worse than leaving them out.~/.agent-token-stats/)File · Purpose config.json · {"budgets":{"dailyTokens":0,"monthlyTokens":0,"dailyCost":0,"monthlyCost":0}} — budget alert thresholds;cost 阈值按展示币种解读(即 pricing.json 的 display) pricing.json · 价目与展示币种,见下方「Pricing & currency」 quota.json · {"deepseek":{"apiKey":"sk-..."},"kimi":{"apiKey":"..."}} — balance queries (env DEEPSEEK_API_KEY / MOONSHOT_API_KEY also work) export-*.csv · CSV exports land here
~/.agent-token-stats/pricing.json(全部可选):
{
"display": "CNY", // 面板/报告/CSV 的展示币种;省略 = 跟 unit
"unit": "USD", // 你写的 rules 数字用的币种;省略 = USD
"fx": 7.2, // 1 USD = 7.2 display,仅在两者不同时用于换算;缺 fx 时原样展示并在面板提示
"rules": [ // 可选:优先于内置表匹配,细分 pattern 要先写
{ "pat": "deepseek-v4.1-flash", "i": 0.28, "o": 0.42, "cr": 0.028, "cw": 0.28, "rt": 0.42 },
{ "pat": "wps-gateway/model", "i": 2, "o": 8, "cr": 0.2, "unit": "CNY" } // 单条规则可自带币种
]
}i 输入(缓存未命中)、o 输出、cr 缓存读(命中)、cw 缓存写、rt 推理(省略或 ≤0 时按输出价)。(输入×i + 输出×o + 缓存读×cr + 缓存写×cw + 推理×rt) / 1e6,再按需要换算到 display。claude-opus 必须写在 claude 之前、细分模型行写在兜底行之前。*_usd、Cursor 的 API 价折算)按定义是美元,展示时同样按 fx 换算;上报与估算永远分列、不混算。deepseek-v4.1-flash / deepseek-v4-flash / deepseek-reasoner / 兜底 deepseek),网关转售价请用上面的 rules 覆盖。One bundle row, two halves:
lib/index.js, injects shell + webServer): signature-based incremental scanners, ledger, pricing, and routes GET /agent-token-stats/{data,export,sessions,report,quota} (loopback, Origin-checked)lib/client.js, dsh.client web bundle): sidebar panel + main-slot dashboard, plain React.createElement, no build step needed for editsnode --check lib/index.js && node --check lib/client.js
node scripts/smoke.mjs
node scripts/verify-cold-snapshot.mjs # 秒级:冷启动首屏必须来自磁盘台账且字段同构
node scripts/verify-instant-open.mjs # 真实 HOME:冷/热/手动刷新都必须瞬时返回(后台扫描约 2 分钟)
node scripts/verify-cooldown.mjs # fixture HOME:冷却期内不重扫、冷却后补扫不丢数(~90s)
node scripts/verify-pricing.mjs # 秒级:币种/fx 换算、规则币种、细分优先、推理计费、缺 fx 告警
node scripts/verify-ux.mjs # 秒级:客户端结构级回归(骨架/筛选器适用范围/下钻/toast/键盘/a11y/token 白名单)verify-ux.mjs用自带的最小 React 垫片把 Dashboard 真渲染一遍再断言结构,所以它验证的是结构与交互,不是视觉效果——配色、间距、真实对比度仍需在浏览器里人工确认。可用LTS_CLIENT=./some-copy.js node scripts/verify-ux.mjs指向变异副本,确认「把功能删掉断言真的会挂」。
Maintenance: edit source → dsh plugin --profile web update dsh-agent-token-stats → restart dsh web.
MIT © skyzhao1223