X
dsh-tokscale-usage
xs-dev/dsh-tokscale-usage
基于 tokscale 与 dsh-context 的本机多 Agent 精密遥测用量面板:适配浅色/深色冷调矿物双主题、自定义常用 Harness 范围、Antigravity/Codex/DSH 统一趋势与真实生成吞吐、多维同心环项目与会话卡片,并提供 /tokscale 命令与 tokscale_usage 工具。
安装
dsh plugin --profile web add github:xs-dev/dsh-tokscale-usageREADME
dsh-tokscale-usage
English | 中文
Local multi-agent token usage and telemetry dashboard for DeepSeek Harness (DSH), backed by @tokscale/cli and local dsh-context / Codex session metadata.
@tokscale/cli is declared as a direct package dependency with prebuilt platform binaries (win32, darwin, linux on x64 and arm64, without postinstall build scripts). Installing this plugin automatically provides the tokscale binary without requiring global CLI installation or PATH configuration.
Install
- From DSH Plugin Market (
dshmarket/ DSH Discover): searchdsh-tokscale-usageand click Install. - From CLI (
dsh webor custom profile):
dsh plugin --profile <profile> add https://github.com/XS-dev/dsh-tokscale-usage/releases/download/v1.0.1/dsh-tokscale-usage-1.0.1.tgz
Features
- Sidebar Panel (
Usage insights / 用量洞察) — Precision Telemetry DLS v1.0:- Calibrated Light & Dark Cool-Mineral Themes: dedicated Cool Alabaster (Light) and Deep Obsidian Slate (Dark) palettes with automatic DSH host theme synchronization and a 1-click
◐ Auto / ☀ Light / ☾ Darkswitcher, paired with a fixed non-bleeding top command dock. - Configurable Harness Scope (
⚙ Harnesses / 常用范围): choose and persist which local agent harnesses are queried and listed (~/.dsh/tokscale-usage/scope.json), avoiding scans across unused clients. - Unified Antigravity Accounting, Throughput & Task Attribution: folds
antigravity-extension(Desktop IDE) andantigravity-cli(agyCLI) under a singleantigravityidentifier, computes real output generation speed (tok/s) from localtranscript.jsonlstep timings alongside prompt-stripped Codex output throughput, and enriches session-leveltokscale --group-by client,session,modelusage with localconversation_summaries.dbtitles, workspace paths, step counts, and subagent tags. - Global Two-Stage Inspection & Drilldown: hover to preview, single-click any chart datum to pin/lock inspection readouts without mutating global filters, and double-click to jump/filter globally (with a 20-step
← Back/Alt+←filter history stack). - Pure-SVG Multi-Ring & Curve Telemetry: Hero KPI jumpers, smooth non-bar 24-hour intraday spline curve on single-day windows, multi-day stacked Agent bars with a synchronized Spend Sub-Lane, Monday-aligned 8-week activity heatmap, semantic token composition, Ring-family comparisons (
Agentdonut,Modeldonut/radial gauges,Workspacedual master rings + per-project concentric rings, andTask usageoverview rings + per-task54×54concentric dual rings), and collision-free quadrant efficiency bubble map.
- Calibrated Light & Dark Cool-Mineral Themes: dedicated Cool Alabaster (Light) and Deep Obsidian Slate (Dark) palettes with automatic DSH host theme synchronization and a 1-click
- Slash Command:
/tokscaleoutputs a monthly text summary with token buckets, cache hit rate, estimated cost, and top tasks. - Agent Tool:
tokscale_usagequeries local token usage filtered byrange(today,yesterday,days3,week,month,all,custom),client,model,since,until, andrefresh.
Notes & Limitations
- Cost is an estimate, calculated by
tokscalepricing tables rather than billing APIs. Models without known pricing report$0. - Read-only: the plugin never modifies or moves session transcripts. Cached reports and scope settings are stored under
$DSH_HOME/tokscale-usage(or~/.dsh/tokscale-usage). - Incremental scanning: once initial history is cached, routine refreshes scan a rolling 14-day window and merge into the persisted daily graph; full-history rescans run only on cold cache,
Allrange refreshes, or explicit full discovery.
Development & Contributing
See CONTRIBUTING.md for local DSH symlink setup, architecture guardrails, and Pull Request workflow.
npm test
License
MIT