sandbase-harness
sandbaseai
Local-first, self-hosted AI agent runtime and MCP bridge with sandboxed sessions, memory, credentials, audit/replay, and a local Console.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:yancf666/dsh-usage-panel
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
简体中文 · English
A polished, local-first usage observatory for DSH. It adds a compact token-and-balance widget to the web sidebar and opens a responsive dashboard for trends, cache efficiency, provider health, and detailed exports.

From the DSH profile root that contains node_modules/ and web/:
cd ~/.dsh/profiles
npm install github:yancf666/dsh-usage-panel
Add the plugin to the profile patch, typically ~/.dsh/profiles/web/cordis.patch.yml:
- insert:
- id: usage-panel
name: 'dsh-usage-panel'
inject: [webServer]
config: {}
Restart dsh web. The widget appears at the bottom of the sidebar.
To upgrade:
cd ~/.dsh/profiles
npm install github:yancf666/dsh-usage-panel#main
All options are optional:
- insert:
- id: usage-panel
name: 'dsh-usage-panel'
inject: [webServer]
config:
# DeepSeek official balance
balanceKeyEnv: DEEPSEEK_API_KEY
balanceUrl: https://api.deepseek.com/user/balance
# Reliability
balanceCacheMs: 300000
balanceTimeoutMs: 15000
balanceRetries: 1
# Generic JSON balance/usage endpoints
balanceSources:
- id: team-credit
label: Team credit
url: https://gateway.example.com/api/balance
keyEnv: TEAM_GATEWAY_KEY
valuePath: data.balance
currency: USD
scale: 1
kind: balance
| Option | Default | Description |
|---|---|---|
| balanceKeyEnv | DEEPSEEK_API_KEY | Environment or .credentials.yaml key for DeepSeek. |
| balanceUrl | DeepSeek official endpoint | Override the official balance endpoint. |
| balanceCacheMs | 300000 | Successful balance cache lifetime, clamped to 5s–1h. |
| balanceTimeoutMs | 15000 | Timeout per request, clamped to 1s–30s. |
| balanceRetries | 1 | Retries for timeouts, HTTP 408/429, and 5xx; maximum 2. |
| balanceSources | [] | Extra Bearer-authenticated JSON endpoints. |
Each custom source supports id, label, url, keyEnv, valuePath (dot notation), currency, scale, and kind: balance or usage.
The plugin also discovers providers in ~/.dsh/settings.yaml. For OpenAI-style gateways it probes BASE_URL/dashboard/billing/usage; many gateways expose cumulative spend there but keep the remaining quota behind their web login.
GET /usage-panel/summary?range=1h|24h|today|7d|30d
GET /usage-panel/summary?date=YYYY-MM-DD
GET /usage-panel/summary?...&eventPage=1&eventSize=30
GET /usage-panel/summary?...&q=model-or-session
GET /usage-panel/summary?...&refreshBalance=1
GET /usage-panel/export?range=today&format=csv
GET /usage-panel/export?date=YYYY-MM-DD&format=json
npm install
npm test
npm run check
npm pack --dry-run
The host module is lib/index.js; the browser module is lib/client.js. The browser half is a hand-written React factory bundle, so no bundler is required.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: token-usage。