OpenViking
volcengine
Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
tableau-China/dsh-workload-report
A DeepSeek Harness plugin for effort & token insights by date and workspace, plus multi-device sync. DSH 工作量报告插件:按日期与工作区看清「我的付出」与 Token 消耗,含日历热力图 / 时刻分析 / 工作区占比 / 模型用量,可导出自包含 HTML 报告,并支持多设备用量同步(COS / GitHub / Gitea / 共享目录)。
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:tableau-China/dsh-workload-report
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
See your effort and your token spend on the same picture — by date and by workspace: a calendar heatmap, time-of-day analysis, workspace share, model usage, and per-KPI sparklines that follow the date range. A DeepSeek Harness (DSH) plugin. Current version: 2.6.0.
中文 · 日本語 · Deutsch · Français · Español · Русский · Português · English
DSH shows stats for the current session. This plugin adds the cross-session, cross-project, cross-time view: which dates and which workspaces your effort went to, which hours you were productive, which models consumed the tokens, and what it cost — plus a screenshot-friendly dashboard for clients, teammates or monthly reviews.
Not only cost, but the work behind it. Active time, active days and turns show what you actually did; tokens and estimated cost show what it consumed. Numbers use the same definitions everywhere, so every view agrees.
# npm (published package)
dsh plugin add dsh-workload-report
# or straight from GitHub (pin a release tag)
dsh plugin --profile web add github:tableau-China/dsh-workload-report#v2.0.0
# or link a local checkout (development)
dsh plugin --profile web add link:$PWD
DSH Desktop: open Settings → Plugins, search for dsh-workload-report, and install it there — no command line needed. For dsh web, run the command above and restart the Web profile.
The entry appears at the bottom of the sidebar: Workload report — its label follows the DSH interface language (8 languages, see Languages). The built client bundle (lib/client.js) is committed, so installing from GitHub/npm needs no local build.
Uninstall: dsh plugin --profile web remove dsh-workload-report.
The plugin has no language setting of its own: the dashboard, the AI-profile card (local fallback rules and model output), the sync dialogs and their server-side error messages all follow the DSH interface language (Settings → General → Language) and switch live.
| Language | Locale id | Dashboard | AI profile | Sync dialogs |
|---|---|---|---|---|
| English | en |
✓ | ✓ | ✓ |
| 中文(简体) | zh |
✓ | ✓ | ✓ |
| 日本語 | ja |
✓ | ✓ | ✓ |
| Español | es |
✓ | ✓ | ✓ |
| Français | fr |
✓ | ✓ | ✓ |
| Deutsch | de |
✓ | ✓ | ✓ |
| Русский | ru |
✓ | ✓ | ✓ |
| Português (Brasil) | pt |
✓ | ✓ | ✓ |
src/locales/<lang>.json; zh.json is the key baseline and en.json is the fallback. npm run check:i18n enforces identical key sets, key order and {placeholders} across all 8 languages, plus "no hard-coded copy in source" and "no dead keys".en.json, translate, register it in src/locales/index.js — full workflow in docs/i18n.md, terminology in docs/i18n-glossary.md. On DSH versions without the locale service (pre-0.2.2), only zh / en are selectable and the plugin keeps working.sessionQuery.listSessions(); statistics come from the official projections (sessionProjections, sessionProjectionCache) and, when needed, the official sessionQuery.observeSession() cold read. Model and hourly-token dimensions use the official sessionQuery.readSession() event log.*.jsonl.zstd, never parses zstd/JSONL, and never reads the harness's internal projection-cache files. Formats can change between releases; the official seams are the contract.<DSH_HOME>/workload-report/index-v9.json plus the AI-profile cache in the same directory (both safe to delete; they rebuild). The AI profile calls a model only after you click Generate.balance.enabled: true, off by default), where the host calls the official deepseekAccount service, and the AI user profile (included by default, but only a manual click calls the model; aggregate statistics only). See Privacy.steps / turns — how many steps the AI runs per human turn), conversations / turns (one merged card, steps no longer shown), average output per request, output speed tok/s (subtitle = TTFT), and cache-read share. Each card carries a sparkline of its daily values over the selected range (7 / 30 / 90 days / all time); see docs/metrics.md.deepseek-v4-flash / deepseek-v4.1-flash / deepseek-v4-pro / deepseek-v4.1-pro share the official DeepSeek price, plus the -sg regional alias; other channel models show —).src/palette.js); UI chrome (buttons / tabs / links) keeps host theme tokens (--dsw-*) so it follows the harness light/dark theme. The dashboard, AI profile and sync dialogs are localised into all 8 languages shipped by DSH 0.2.2 (English, Chinese, Japanese, Spanish, French, German, Russian, Brazilian Portuguese) and follow the host language live — see Languages.readSession); cold open 25 ms, warm open ~1 ms (measured on an isolated instance). Model folding is driven by background timers, never by opening the panel.kpi.topModel (a category, no numeric trend) and kpi.activeDays (a monotonically increasing cumulative line) are replaced by Steps per turn (steps / turns — how many steps the AI runs per human turn). The grid is now 4 columns × 2 rows with no spanning cards.snapshot.byDay, so choosing 7 / 30 / 90 days or All time changes both the value and the sparkline. No sampling, no aggregation, no invented points: days without data break the line instead of drawing a fake zero. The geometry (src/sparkline.js) and series (src/kpi-series.js) are single-source, so every card uses the same rules. The sparkline sits to the right of the label and value and the subtitle spans the card bottom, so cards stay compact (≈100 px instead of ≈150 px); the range / point count lives in the SVG tooltip rather than a separate line.Export HTML report button and the whole report feature (/report.html route, renderer, 34 dictionary keys) were removed: real clicks landed on a host overlay (_mask_*) rather than the button, and both window.open and <a target="_blank"> were tried. A single-page PNG snapshot is the planned replacement.Export HTML report button had been hidden since 2.1.0 while the /report.html route and renderer kept working; it was visible again in all 8 languages. (Removed again in 2.6.0 together with the whole HTML report feature.)deepseek-v4.1-flash / deepseek-v4.1-pro use the same official DeepSeek price as deepseek-v4-flash / deepseek-v4-pro (CNY + USD, peak/off-peak). Three-segment channel keys (magpie/workbuddy-ai/deepseek-v4.1-flash) and the -sg regional variant now resolve to a price too. Override any name with pricing.overrides.model · provider instead of only the legend doing so.deepseek-account (signed-in DeepSeek account) and deepseek-official (your DeepSeek API key) are separate rows with readable, localised provider labels; the raw route id stays in the tooltip. The index was rebuilt once (v8 → v9) so historical sessions are re-folded with the new grouping.src/locales/*.json, 398 keys) shared by the browser half and the Node half. npm run check:i18n guards key-set / key-order / placeholder parity.{placeholders} instead of string concatenation).code + params; the client renders them from the dictionaries (falling back to the server message only for unknown codes).workbuddy-ai / auto / workbuddy) with the full path in the tooltip.By date: eight KPIs with sparklines + calendar heatmap + time-of-day analysis with human-message density dots + workspace share

By workspace: three bars — sessions / turns · my effort · token spend, one shared scale

The full definitions live in docs/metrics.md. Durations use one language-neutral H / M / S format (like K/M/B for tokens).
waitMs.ΣdecodeTokens / (ΣdecodeMs / 1000), excluding time to first token. TTFT = step/start → first token.max(window start, first active day), so the active-days denominator is always the real span. The calendar heatmap always covers full history.Override any of these in the profile's cordis.patch.yml (all optional):
- id: workload-report
name: dsh-workload-report
config:
defaultDays: 7 # initial range: 7 | 30 | 90 | all
refreshMs: 30000 # index refresh interval (ms)
snapshotCacheMs: 15000 # snapshot cache per query (invalidated by events/index/fold)
modelFoldWarmupMs: 2000 # warm-up fold after the index is ready (never from opening the panel)
modelFoldIntervalMs: 720000 # periodic fold maintenance (12 min)
modelFoldIdleMs: 600000 # only refold a live session after 10 min without events
modelRetryMs: 1800000 # retry failed rows after 30 min (never changes the status line)
revalidateMs: 604800000 # index row TTL: re-validate after this long (default 7 days)
revalidateRecentDays: 30 # only re-validate sessions active in the last N days; 0 = disable the optimization
snapshotSwr: true # after a live event, serve the previous snapshot and rebuild in background (false = old behaviour)
snapshotStaleMaxMs: 600000 # max age of a snapshot served by SWR (default 10 min)
defaultScope: all # all | main | subagent
modelUsage: auto # auto | off (off = do not read event logs for model/hourly data)
excludeWait: true # false = keep 0.6.0 behaviour (no wait detection)
waitTools: # tools treated as waiting for a human
- ask_user_question
- exit_plan_mode
waitMinMs: 60000 # minimum interval to be treated as waiting (ms)
activeModelMetric: requests # requests | tokens | activeMs
workspaceAliases: # display names, useful in client reports
my-shop-app: Retail Order System
balance: # optional balance chip — OFF by default
enabled: false # true = host calls platform.deepseek.com (see Privacy)
refreshMs: 300000 # balance cache TTL (ms)
aiProfile: # AI user profile — included by default, manual trigger only
enabled: true # set false to hide the entry; opening the panel never calls a model
provider: "" # empty = host agentDefaultModel selection
model: "" # use together with provider
timeoutMs: 60000 # AbortSignal.timeout(timeoutMs)
minDays: 30 # aggregate window floor (days): a 7-day board still profiles 30 days
# deliberately no maxTokens: an output cap truncates the JSON; the plugin repairs it instead
cacheTtlMs: 86400000 # fingerprint cache TTL (ms); 0 = no disk cache
The default model prices are built in and offline; pricing.overrides, pricing.asOf and pricing.links let you replace them if your contract differs. See docs/models.md.
Running DSH on several machines? Merge their usage into one report. Disabled by default — with no sync config the plugin behaves exactly as before and makes zero outbound requests.
No YAML needed. Open the dashboard → Device sync (right end of the device-filter row) → one large dialog opens directly (the old sync page is merged into it, there is no second layer):
✓ configured and reachable, ! configured but failing, ○ not configured / disabled / untested.Prefer a config file (servers / CI)? That works too — see section 4 of docs/sync.md.
- id: workload-report
name: dsh-workload-report
config:
sync:
enabled: true
transport: cos # cos | github | gitea | local
cos:
bucket: my-sync-1250000000
region: ap-guangzhou
secretIdFile: ~/.dsh/.cos-id # 0600
secretKeyFile: ~/.dsh/.cos-key # 0600
| Transport | Best for | Credential |
|---|---|---|
cos |
Tencent Cloud COS — low latency, near-zero cost | SecretId/SecretKey (sub-account scoped to machines/* of one bucket) |
github / gitea |
You already have a Git account | fine-grained PAT: Contents: Read and write, one repo only |
local |
No cloud account / corporate intranet | none — point at an iCloud / Syncthing / NAS folder |
<DSH_HOME>/.anonymous-user-id; override the display name with sync.machineName.machines/{machineId}.json).?machine= on the API.cwd paths. The UI no longer offers the "redact paths" toggle
(its meaning was unclear and it was already off by default); if you need it, set sync.redactPaths: true in the config to hash them.See docs/sync.md for the full config reference and least-privilege policies.
The dashboard appends its version and build hash to the definitions note at the bottom:
Definitions: metric definitions in docs/metrics.md; all data stays local. · v2.4.0 · 9eadcd8
└─ host commit hash
package.json via the host (/sync); it is never hard-coded in the client and is not rendered when unavailable.node test/check-release.mjs --tag vX.Y.Z compares package.json, CHANGELOG and both READMEs
and validates the tag; it runs in CI.92vh frame and scrolls internally,
so switching between By date / Model usage / By workspace / Top sessions no longer jumps the frame height.5/5 days instead of 5/30).Included by default, but only generated by a manual click; opening the panel never calls a model. The profile lives on its own top-level tab, aligned to the right end of the navigation and tinted so it stands out from the other tabs; the Top sessions tab keeps the sessions table alone.
probe (no model call; llm.prepareCall stays at 0). The model is called when you click Generate profile / Regenerate; the button is disabled while generating.max(current range, aiProfile.minDays); minDays defaults to 30, so a 7-day board still produces a days >= 30 payload. The result card says “Based on the last N days”, where N is the actual window.headline / dimensions / advice / risk), temperature: 0.35; no maxTokens is sent.{-to-last-} extraction. When finish.kind=length or the text is clearly unfinished, the plugin closes unclosed strings / arrays / objects and parses again; success is marked truncated: true (card footer says “Output truncated; repaired and used”). Only an unrepairable result falls back, with the first 300 characters in diagnostic.excerpt.tmp → rename, PROFILE_CACHE_VERSION = 4); an identical fingerprint returns the cache without another model call. force=1 regenerates.llm service, not signed in / no models, timeout, empty output, or unparsable JSON all fall back to a deterministic local rules profile with the same shape (headline + 4–6 dimensions + 2–3 advice + risk, every insight still numeric, no network). A non-stop finish whose JSON can be repaired is used instead (truncated: true); only an unrepairable one falls back. The response always carries source: "llm" | "local" and a stable code; nothing is thrown to the UI.diagnostic.error.{code,message,stage} (the underlying error code is preserved; the message is redacted and capped at 300 characters) plus route / precheck; /health exposes diagnostics.aiProfile with the latest attempt. For debugging, provider= / model= query parameters override just that request (only when enabled=true; no config write, no cache write, no restart).Full details: docs/ai-profile.md.
| Route | Description |
|---|---|
GET {apiPath}/snapshot?days=30&tz=Asia/Shanghai&scope=all |
Aggregated snapshot JSON (totals / byDay / byWorkspace / byHour / bySession / calendar / byModel / modelDaily / diagnostics) |
GET {apiPath}/export.json?... |
Same payload with a content-disposition header |
GET {apiPath}/profile?days=30&tz=...&lang=zh&probe=1 |
AI user profile: probe=1 only reports enabled / signed-in / model, never calls one; otherwise generates on demand; days is floored at aiProfile.minDays (30); force=1 bypasses the fingerprint cache |
GET {apiPath}/profile?...&provider=...&model=... |
Debug entry: override the route for this request only (only when enabled; no config write, no cache write) |
GET {apiPath}/health |
Index diagnostics (sessions, checkpoint hits, cold reads, read failures, duration); diagnostics.aiProfile has the latest profile code / stage / error / route |
GET {apiPath}/balance |
Cached balance state for the toolbar chip; never touches the index |
Parameters: from/to (YYYY-MM-DD, take precedence over days), days, all=1 (earliest active day → today), tz (IANA time zone), scope, machine (repeatable device id — same filter as the dashboard).
<DSH_HOME>/workload-report/index-v9.json; INDEX_VERSION = 9.indexing: true while this runs.Install the plugin, restart DSH, and open Workload report at the bottom of the sidebar. The Total tokens KPI sums every session in the selected range (today / 7 / 30 / 90 days / all time); the daily table and the workspace and model tabs break it down. Unlike a per-session stats line, this view is cross-session, cross-project and cross-device.
Token and cost dashboards answer "how much did it consume?". This plugin answers "where did my effort go?" — it measures active time (model time + tool time, with waiting-for-user time excluded), attributes it to dates and workspaces, and puts it next to token usage. You can see a 46%-of-effort project, a 3.7 B-token month, and a review-ready dashboard — from the same data.
Not as a file yet. The self-contained HTML report was removed in 2.6.0 (its toolbar button was already unreliable); a single-page PNG snapshot is the planned replacement. For now you can screen-share the dashboard or use your own screenshots.
Yes, optionally. Device sync merges per-session aggregate rows from several machines through Tencent COS, GitHub, Gitea or a shared folder (iCloud / Syncthing / NAS). It is off by default and only syncs the numbers — no conversation content, titles, prompts or attachments. Each device writes its own file, so there is nothing to merge by hand.
No, by default everything stays on your machine. The plugin registers read-only local HTTP routes, uses only official DSH interfaces, and writes only its own local index and cache. Two features can use the network and are opt-in: the balance chip (off by default) and the AI profile (only after you click Generate; it sends aggregate statistics only).
The dashboard, the AI profile and the sync dialogs follow the DSH interface language and are localized into all 8 languages shipped with DSH 0.2.2: English, Chinese, Japanese, Spanish, French, German, Russian and Brazilian Portuguese. Switching the language in Settings → General → Language switches the plugin live — no reload, no plugin setting.
In DSH Desktop: Settings → Plugins → search dsh-workload-report → install. In dsh web: dsh plugin add dsh-workload-report, then restart the Web profile. You can also install from GitHub (dsh plugin --profile web add github:tableau-China/dsh-workload-report#main). The built client bundle is committed, so no local build is required.
| Document | What it covers |
|---|---|
| docs/metrics.md | Definitions: active/net/wait, time-of-day, tokens, calendar, workspaces |
| docs/models.md | Model attribution, grouping, cache-hit rate, peak/off-peak pricing and cost estimation |
| docs/ui-conventions.md | Shared UI components, card heads, legend/status rules, tooltip rules |
| docs/ai-profile.md | AI user profile: whitelist payload, cache fingerprint, fallback codes, privacy |
| docs/discoverability.md | How this project is made discoverable: keywords, channels, submission checklists, launch plan |
| docs/i18n.md | 8-language architecture, maintenance rules, how to add a language |
| docs/i18n-glossary.md | Terminology and translation rules for translators |
| docs/preaggregation.md | Pre-aggregation assessment: measurements, costs, trigger conditions (verdict: not needed yet) |
| CHANGELOG.md | Version history and testing notes |
| PROGRESS.md | Decisions, measurements, environment gotchas and release notes |
All statistics stay on your machine. The plugin registers read-only HTTP routes only: by default no outbound requests, no telemetry, no user content collected. It writes only its own index cache plus the optional AI-profile cache; nothing else in your harness data is touched.
Optional balance chip — off by default. Only when you set balance.enabled: true does the host call the official deepseekAccount service: getBalance() makes the host request https://platform.deepseek.com/api/v0/users/get_user_summary (the account balance endpoint). It is opt-in and cached for balance.refreshMs. The top-up/usage links come from the service's local getState() and need no network. A failed or timed-out query shows an em dash with a top-up link — never an error dialog. The balance is rendered only in your own toolbar chip.
AI user profile — included by default, manual trigger only. Opening the panel / probe only reads enabled, sign-in state, and provider/model; it never calls a model. Only after you click Generate profile does the plugin call the llm service (and your configured model provider) with the aggregate whitelist described in AI user profile, always using a window of at least 30 days. No conversation text, titles, paths, session ids, or event logs are sent. The response is cached on disk in the plugin's own directory; no report file is produced. If the service is missing, you are not signed in, the call times out, or parsing fails, the card falls back to local rules and shows the reason — no error dialog. This side call is not included in the plugin's token / cost report. Set aiProfile.enabled: false to hide the entry and guarantee zero model calls.
| Command | Purpose |
|---|---|
pnpm add -D esbuild puppeteer-core |
Install build and browser-test dependencies (or point ESBUILD_PATH / WL_PUPPETEER_DIR at existing installs) |
node build.mjs |
Bundle src/client/ into lib/client.js (ModuleLoader factory format) with esbuild |
node test/verify.mjs |
1625 offline assertions: aggregation semantics with one shared range rule, time zones, turn-based hour bucketing and conservation, hourly tokens by message time, human-message density, wait exclusion (all three rules + long-task exemption + excludeWait:false regression), index/read fallbacks, the AI-profile tab as a right-aligned navigation entry, the 30-day profile window, multi-device sync (payload / merge / credentials / settings / device filter / pull-cache persistence), output-speed and TTFT definitions, KPI sparkline series / geometry / calendar summary, zero model calls on first open, i18n key alignment, balance states, and 8-language rendering (dashboard helpers / AI profile / prompt) |
./test/e2e-boot.sh 3299 |
Boot an isolated instance (own DSH_HOME and port) without touching your running GUI |
node test/i18n.mjs |
I18n dictionary checks (85 assertions): key sets / order / placeholders / empty values / untranslated / hard-coded copy / dead keys across all 8 languages; --lang de checks one language |
node test/e2e-ui.mjs |
Real-browser E2E: calendar/bar switching, geometry, donuts, KPI sparklines, time-of-day card |
node test/e2e-i18n.mjs |
Real-browser E2E in all 8 languages: injects navigator.languages, opens the panel, asserts copy against the dictionaries and saves screenshots |
CI runs build.mjs + verify.mjs, and fails if the committed lib/client.js differs from a fresh build.
0.2.x, including alpha prereleases (developed and verified against @deepseek-ai/dsh@0.2.1-alpha.2 and 0.2.2-rc.1). The manifest declares engines.dsh >= 0.2.1-alpha.0 with no upper bound, so upgrading DSH to a newer 0.x build does not exclude the plugin by version range; newer versions are allowed to load but only the versions above are explicitly verified. The plugin depends only on official interfaces (sessionProjections / sessionProjectionCache / sessionQuery) and Node built-ins, never on internal file formats.indexing: true, and restarts reuse the persisted index.CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: sync、object-storage。