dsh-all-usage 1.0.8 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,50 @@
2
2
 
3
3
  All notable changes to `dsh-all-usage` are documented here.
4
4
 
5
+ ## [1.1.1] - 2026-08-29
6
+
7
+ ### Fixed
8
+
9
+ - Reissued the v1.1 dashboard package under a new patch version for registry compatibility.
10
+
11
+ ## [1.1.0] - 2026-08-28
12
+
13
+ ### Added
14
+
15
+ - Added structured Provider, requested-model, actual-model, and display-model identity fields while preserving the legacy `model` field.
16
+ - Added a backward-compatible ledger v2 adapter; v1 rows are read once, canonicalized, and upgraded before revision skipping resumes.
17
+ - Added shared scoped usage and privacy-safe paginated records APIs: `/api/all-usage/query` and `/api/all-usage/records`; query responses now add hourly trend rows for single-day scopes while preserving the existing daily rows.
18
+ - Kept workspace, provider, and model filters independent so users can combine all three dimensions in one scope.
19
+ - Limited workspace, provider, and model filter options to values used in the selected date range and clear selections that become unavailable after a range change.
20
+ - Added unified Workspace, Provider, model, date, and timezone filtering for dashboard aggregates, the fixed 53-week heatmap, trend data, and exports.
21
+ - Added a responsive Token trend chart with smooth monotone cubic curves, staged draw animation, selectable input, cache-read, cache-write, output, reasoning, and total series; single-day scopes use hourly buckets while cross-day scopes use daily buckets.
22
+ - Added Token-share donut charts with ranked legends to the model and workspace detail panels, including high-contrast remainder segments, animated arc reveals, and cursor-following hover details.
23
+ - Added a persistent Request Logs tab with a compact paginated table, selected-row Token detail, opaque row IDs, materialization-source labels, and scoped detail CSV export.
24
+ - Optimized Host records pagination with revision-scoped ordering and precomputed identity/date values; optimized Client derived aggregates with memoization and active-tab rendering.
25
+
26
+ ### Fixed
27
+
28
+ - Prevented model identity collisions caused by parsing display labels containing ` / `.
29
+ - Detects truncated or replaced session logs instead of overlaying a newer full rebuild with a stale ledger row.
30
+ - Keeps turn counts, call counts, and distinct session counts separately defined in scoped results.
31
+ - Keeps complete trend paths visible while per-series reveal animation restarts during live refreshes, preventing the final chart segment from disappearing.
32
+ - Reserves the trend chart height during query loading and replaces floating loading text/legend controls with a centered spinner.
33
+ - Keeps hover intersection markers static so they do not jump from the SVG origin into position on every hover.
34
+ - Reuses one anchored trend tooltip with short position and opacity transitions, avoiding abrupt remounts while switching dates.
35
+ - Isolates dashboard render failures behind the sidebar entry so a bad range response cannot remove the usage entry itself.
36
+
37
+ ## [1.0.9] - 2026-08-26
38
+
39
+ ### Added
40
+
41
+ - Added a lightweight, guarded `/api/all-usage/status` contract with a per-Host instance ID, monotonic stats revision, scan progress, and non-sensitive sync-health counters.
42
+ - Added sync-health visibility for revision-skipped sessions, actual log reads, ledger-only recoveries, failures, persistence snapshot availability, and last completed baseline time.
43
+ - Added revision-driven Client refresh: after the initial scan, the dashboard polls only lightweight status and fetches the full historical snapshot only when the Host instance or stats revision changes.
44
+
45
+ ### Fixed
46
+
47
+ - Preserved the last successful usage view after status or full-snapshot failures, exposed a retry action, and added bounded retry backoff instead of silently discarding refresh errors.
48
+
5
49
  ## [1.0.8] - 2026-08-23
6
50
 
7
51
  ### Added
@@ -62,6 +106,8 @@ All notable changes to `dsh-all-usage` are documented here.
62
106
  - Allowed same-origin browser balance GET requests that omit `Origin` while retaining token protection.
63
107
  - Standardized English date buckets, range filters, streaks, heatmap dates, and export timestamps on UTC.
64
108
 
109
+ [1.1.0]: https://github.com/ParticleLight/dsh-all-usage/releases/tag/v1.1.0
110
+ [1.0.9]: https://github.com/ParticleLight/dsh-all-usage/releases/tag/v1.0.9
65
111
  [1.0.8]: https://github.com/ParticleLight/dsh-all-usage/releases/tag/v1.0.8
66
112
  [1.0.7]: https://github.com/ParticleLight/dsh-all-usage/releases/tag/v1.0.7
67
113
  [1.0.6]: https://github.com/ParticleLight/dsh-all-usage/releases/tag/v1.0.6
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 dsh-all-usage contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-all-usage contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -19,14 +19,21 @@ DeepSeek Harness 全量用量看板:按模型、供应商、工作区和时间
19
19
  - **界面语言**:在看板顶部切换中文与 English;选择会保存到浏览器本地
20
20
  - **完整历史与增量重建**:基线扫描全部可读历史会话;独立用量账本同时作为每会话游标——未变化的会话直接复用账本,新增事件只增量回填,长历史重启不再全量重建
21
21
  - **重启免读**:用持久化日志的 revision 作为每会话的变更信号(只读头部行 + stat,不读全量)——日志未变的会话重启时连事件都不读,直接从账本复用;仅日志变化(新增/修改)的会话才做增量读取
22
+ - **数据健康与按需刷新**:扫描完成后浏览器只检查轻量状态版本,只有用量、别名或同步状态变化时才拉完整历史;显示本次数据更新时间、历史扫描健康、revision 免读、实际读取、账本恢复和失败,网络异常保留上次成功数据并可重试
23
+ - **性能优化**:Host 复用 canonical identity、local/UTC 日期键和当前 revision 的 records 排序;Client memo 化 scope 聚合与统计行,并只渲染当前明细页签
24
+ - **趋势折线图**:按当前范围、时区、工作区、供应商和模型显示输入、缓存读写、输出、推理及总处理量;单日范围按小时聚合并显示小时轴,跨日范围按日聚合;使用平滑单调曲线与入场动画,悬停查看精确值,图例可切换曲线,点击点位进入当日明细
25
+ - **统一筛选与审计**:工作区、供应商、模型和日期筛选贯穿摘要、热力图、趋势、表格与 CSV;工作区、供应商、模型三个筛选维度可独立自由组合,工作区、供应商和模型选项只展示当前日期范围内实际使用过的值;切换范围后失效筛选会自动清除;请求日志以紧凑分页表常驻显示,选择单条后查看分组 Token 详情
22
26
  - **Token 口径**:输入按「未含缓存命中」计,缓存命中 / 写入与推理独立成桶;全 0 用量的重放事件不会覆盖已记录的真实用量,仅缓存命中的请求也会计入
23
27
 
24
28
  ### 最近更新
25
29
 
26
- **v1.0.8**
30
+ **v1.1.1**
27
31
 
28
- - 重启免读:用持久化日志的 revision 做每会话变更信号,未变化会话重启时完全不读事件,直接复用账本;仅在日志变化时增量读取
29
- - 账本记录持久化每会话的日志 revision(旧记录首次重读后自动回填)
32
+ - 结构化模型身份与兼容 ledger v2:区分 Provider、请求模型和实际模型,旧账本自动升级
33
+ - 统一 scope 查询:时间、时区、工作区、Provider、模型筛选同时作用于摘要、热力图、趋势、表格和 CSV
34
+ - Token 趋势折线图:单日范围按小时、跨日范围按日;平滑单调曲线、分层入场动画、多桶图例切换、悬停精确值和点位审计钻取
35
+ - 模型与工作区统计:在明细表上方提供 Token 占比环形图、中心总量、Top 项目图例和 hover 明细;环段带绘制动画,tooltip 会跟随鼠标位置
36
+ - turn / step 审计明细:常驻请求日志标签、紧凑分页表、选中行分组详情、脱敏来源标记和当前筛选范围明细 CSV
30
37
 
31
38
  完整版本记录见 [CHANGELOG.md](CHANGELOG.md)。
32
39
 
@@ -34,7 +41,17 @@ DeepSeek Harness 全量用量看板:按模型、供应商、工作区和时间
34
41
 
35
42
  ![dsh-all-usage 看板总览 / Dashboard overview](assets/screenshot-1.png)
36
43
 
37
- ![dsh-all-usage 模型与工作区明细 / Model and workspace details](assets/screenshot-2.png)
44
+ ![dsh-all-usage Token 使用趋势 / Token usage trend](assets/screenshot-2.png)
45
+
46
+ ![dsh-all-usage 使用热力图 / Usage heatmap](assets/screenshot-3.png)
47
+
48
+ ![dsh-all-usage 请求日志 / Request logs](assets/screenshot-4.png)
49
+
50
+ ![dsh-all-usage 模型占比环图 / Model usage donut chart](assets/screenshot-5.png)
51
+
52
+ ![dsh-all-usage 模型明细表 / Model details table](assets/screenshot-6.png)
53
+
54
+ ![dsh-all-usage 工作区占比环图与明细 / Workspace donut chart and details](assets/screenshot-7.png)
38
55
 
39
56
  ### 安装
40
57
 
@@ -69,7 +86,10 @@ dsh plugin --profile web add github:ParticleLight/dsh-all-usage
69
86
  ### 架构
70
87
 
71
88
  - **Host 端**(`lib/index.js`):扫描持久化会话日志聚合用量(`turn/end` + `assistant/message.usage`),监听 `session/event` 实时折叠;通过 `webServer` 服务注册数据路由:
72
- - `GET /api/all-usage` — 统计快照
89
+ - `GET /api/all-usage` — 兼容统计快照
90
+ - `GET /api/all-usage/status` — 轻量 revision 与同步健康状态
91
+ - `GET /api/all-usage/query` — 按 scope 返回聚合、daily/hourly 趋势和 heatmap 数据;单日 scope 填充 `hourly`,跨日 scope 的 `hourly` 为空
92
+ - `GET /api/all-usage/records` — 按 scope 分页返回脱敏 canonical usage rows
73
93
  - `GET /api/all-usage/balance?force=1` — 账户余额(复用 `llm-deepseek` 的 API Key 配置)
74
94
  - `POST /api/all-usage/alias` — 设置工作区别名
75
95
  - **Client 端**(`lib/client.js`):`window.__ModuleLoader__` 工厂格式的浏览器 bundle,注册侧边栏「用量统计」入口(`sidebar.footer.action` 槽位)。所有 API 仅接受本机 loopback 请求并拒绝显式跨域请求;余额读取与别名写入还要求插件启动时生成、仅在当前进程有效的令牌(余额 GET 兼容浏览器省略 Origin)。英文模式的日期分桶、范围筛选、连续使用、热力图和导出时间统一按 UTC;中文模式按本地时区。
@@ -81,6 +101,9 @@ dsh plugin --profile web add github:ParticleLight/dsh-all-usage
81
101
  - 会话删除后,已成功 flush 的用量仍从独立账本恢复;会话销毁提示和周期对账只负责触发重建,不会删除账本记录
82
102
  - 同一会话的同一 `turn / step` 只保留一份最终 usage;重试或替换消息会替换旧贡献,不重复累计
83
103
  - 输入 Token 按「未含缓存命中」计(缓存命中 / 写入独立成桶);全 0 用量的重放事件不会覆盖已记录的真实用量,纯缓存命中的请求仍会计入
104
+ - 轻量状态接口只公开 Host 实例、统计 revision、扫描进度与同步计数,不公开会话 ID、工作区路径、提示词或回复正文;完整快照仅在状态变化或手动刷新时获取
105
+ - scope query 将回合(turns)、模型调用(calls)和去重会话(sessions)分开统计;Provider/模型筛选缺少路由信息时明确归为 Unknown,不从展示字符串猜测
106
+ - records 接口只返回短 hash、时间、工作区 ID、结构化模型身份、turn/step、Token buckets 和当前物化来源,不返回原始 session ID、路径、提示词、回复或凭据
84
107
  - 看板中的总处理量 = 输入 + 输出 + 缓存读写 + 推理;缓存命中表示复用的上下文 Token,不等于新生成 Token 或实际费用
85
108
  - 余额查询走 DeepSeek 官方 `/user/balance` 接口;未配置 API Key 时卡片显示引导文案
86
109
  - 仅统计能归属到已注册工作区(按会话 cwd 匹配)的会话
@@ -105,14 +128,21 @@ A full usage dashboard for DeepSeek Harness. Analyze tokens, cache behavior, acc
105
128
  - **Interface language**: switch between Chinese and English from the dashboard header; your choice persists locally in the browser
106
129
  - **Full history & incremental rebuild**: the baseline scans every readable historical session; the durable usage ledger doubles as a per-session cursor, so unchanged sessions are reused straight from the ledger and only newly appended events are folded — long histories restart without a full rebuild
107
130
  - **Restart with no re-read**: the persisted log revision (a header-line + stat via `sessionPersistence.listSnapshots()`) acts as a per-session change signal — sessions whose log is unchanged are applied from the ledger on restart without reading their events at all; only changed/new sessions are read incrementally
131
+ - **Data health and on-demand refresh**: after a scan completes, the browser polls only a lightweight status revision and fetches full history only after usage, alias, or sync state changes; it shows the latest full-data update, historical scan health, revision skips, rereads, ledger recovery, and failures while preserving last-good data on network errors
132
+ - **Performance**: Host reuses canonical identities, local/UTC date keys, and the current-revision records ordering; Client memoizes scope aggregates and detail rows and renders only the active detail tab
133
+ - **Trend line chart**: show input, cache read/write, output, reasoning, and total processed tokens for the active range, timezone, workspace, provider, and model scope; use hourly buckets for a single-day scope and daily buckets for cross-day scopes, with smooth monotone curves, staged entrance animation, hover for exact values, and click a point to inspect that day
134
+ - **Unified filters and audit**: workspace, provider, model, and date filters apply to the summary, heatmap, trend, tables, and CSV; workspace, provider, and model filters remain independent and can be combined freely, while workspace, provider, and model options are limited to values used in the selected date range and stale selections clear automatically; request logs stay visible as a compact paginated table with grouped Token details for the selected row
108
135
  - **Token accounting semantics**: input tokens are fresh (exclude cache hits/writes, which sit in separate buckets along with reasoning); all-zero usage replays never overwrite recorded usage, while cache-only requests still count
109
136
 
110
137
  ### Latest Update
111
138
 
112
- **v1.0.8**
139
+ **v1.1.0**
113
140
 
114
- - Restart with no re-read: the persisted log revision acts as a per-session change signal, so unchanged sessions are applied from the ledger on restart without reading any events; only changed logs are read incrementally
115
- - The ledger now stores each session's log revision; existing rows are re-read once and backfilled automatically
141
+ - Structured model identity with backward-compatible ledger v2 migration
142
+ - Unified scope queries for time, timezone, workspace, provider, and model filters
143
+ - Token trend line chart with hourly single-day data, selectable series, exact hover values, and point-to-audit drill-down
144
+ - Model and workspace analytics with Token-share donut charts, center totals, ranked legends, animated arc reveals, and cursor-following hover details
145
+ - Paginated turn/step audit records with redacted provenance and scoped detail CSV export
116
146
 
117
147
  See [CHANGELOG.md](CHANGELOG.md) for the complete version history.
118
148
 
@@ -149,7 +179,10 @@ The profile patch layer hot-reloads; save the file and refresh the page.
149
179
  ### Architecture
150
180
 
151
181
  - **Host** (`lib/index.js`): aggregates persisted session logs (`turn/end` and `assistant/message.usage`), folds live `session/event` updates, and exposes data routes through `webServer`:
152
- - `GET /api/all-usage` — usage snapshot
182
+ - `GET /api/all-usage` — compatible usage snapshot
183
+ - `GET /api/all-usage/status` — lightweight revision and sync health
184
+ - `GET /api/all-usage/query` — scoped aggregate, daily/hourly trend, and heatmap data; single-day scopes populate `hourly`, while cross-day scopes return an empty `hourly` array
185
+ - `GET /api/all-usage/records` — paginated privacy-safe canonical usage rows
153
186
  - `GET /api/all-usage/balance?force=1` — account balance using the configured `llm-deepseek` API key
154
187
  - `POST /api/all-usage/alias` — update workspace aliases
155
188
  - **Client** (`lib/client.js`): a `window.__ModuleLoader__` browser bundle that registers the “Usage statistics” sidebar entry through the `sidebar.footer.action` slot. All API routes accept loopback requests and reject an explicit cross-origin Origin; balance reads and alias writes also require a process-scoped token generated when the plugin starts (the balance GET tolerates browsers omitting Origin).
@@ -161,6 +194,9 @@ The profile patch layer hot-reloads; save the file and refresh the page.
161
194
  - After a session is deleted, successfully flushed usage is restored from the separate ledger; disposal hints and periodic reconciliation trigger rebuilds without deleting ledger rows
162
195
  - For each session and logical `turn / step`, only the final usage contribution is kept; retries or replaced messages do not double-count
163
196
  - Input tokens are fresh (exclude cache hits/writes, which sit in their own buckets); all-zero usage replays do not overwrite recorded usage and pure cache-read requests still count
197
+ - The lightweight status endpoint exposes only Host instance, stats revision, scan progress, and sync counters. It does not expose session IDs, workspace paths, prompts, or reply bodies; full snapshots are fetched only after status changes or a manual refresh
198
+ - Scoped results keep turns, model calls, and distinct sessions as separate metrics; missing route identity is explicitly Unknown rather than inferred from a display label
199
+ - The records endpoint returns only a short hash, time, workspace ID, structured model identity, turn/step, token buckets, and current materialization source. It omits raw session IDs, paths, prompts, replies, and credentials
164
200
  - Processed tokens = input + output + cache read/write + reasoning; a cache hit means reused context, not newly generated tokens or actual cost
165
201
  - Balance data comes from DeepSeek’s official `/user/balance` endpoint; the card shows guidance when no API key is configured
166
202
  - English mode uses UTC for date buckets, range filters, streaks, heatmap dates, and export timestamps; Chinese mode uses local time
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/cordis.patch.yml CHANGED
@@ -1,5 +1,5 @@
1
- # dsh-all-usage 的 bundle patch:作为社区插件层被 dsh plugin add 安装时,
2
- # 本文件插入插件行(host 半 = 包默认导出;client 半 = dsh.client 标记扫描)。
3
- - insert:
4
- - id: all-usage
5
- name: dsh-all-usage
1
+ # dsh-all-usage 的 bundle patch:作为社区插件层被 dsh plugin add 安装时,
2
+ # 本文件插入插件行(host 半 = 包默认导出;client 半 = dsh.client 标记扫描)。
3
+ - insert:
4
+ - id: all-usage
5
+ name: dsh-all-usage