@feiyang666/dsh-usage-plugin 1.13.1 → 1.14.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 +42 -22
- package/README.md +11 -2
- package/README.zh.md +12 -2
- package/lib/client.js +352 -35
- package/lib/index.js +128 -39
- package/package.json +88 -88
package/CHANGELOG.md
CHANGED
|
@@ -8,36 +8,52 @@
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## v1.14.1 (2026-08-29)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
- 复用百炼 CLI(`bl`)的「控制台登录」OAuth token(`~/.bailian/config.json` 的 `access_token`),**不需要阿里云 AccessKey / BSS 权限**,权限面远小于 `AliyunBSSReadOnlyAccess`。
|
|
15
|
-
- Host 侧新增 `console-token` 查询模式:读取 `~/.bailian/config.json` → 调百炼门户网关 `zeldaHttp.apikeyMgr./tokenplan/personal/api/v2/usage` → 返回配额已用百分比与重置时间。
|
|
16
|
-
- 客户端渲染:百分比按官方 CLI 的 `round(x*1000)/10` 格式(如 `20.6%`),重置时间显示本地日期 + 相对倒计时;「本周配额」卡片用连续线段展示开始 / 结束日期(开始到今天深蓝、今天到结束浅色),今天节点随日期动态移动,窗口宽度随浏览器缩放自适应。
|
|
17
|
-
- 说明:展示的是**配额已用百分比**,不是剩余 token 数;百炼 Token Plan 实际没有 5 小时配额(相关 UI 已移除)。
|
|
18
|
-
- 新增依赖 `undici`(`package.json`)。
|
|
13
|
+
### 修复 / Fixed
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
- **中断调用兜底记录,使「调用次数」与 DeepSeek 官方后台对齐**(`lib/index.js`):harness 在流被中断(aborted / error / timeout / 用户停止生成)时不会产出 `usage` chunk(usage 只在收到 `[DONE]` 哨兵后才由 adapter yield),导致这类调用此前完全不被插件记录——而官方后台仍会把该次请求计入「API 请求次数」并按实际 token 计费,于是插件统计的调用次数长期低于官方(如 8 月 27 日 985 vs 1033)。现在无 usage 但确为真实模型调用(通过 `isRealCall`,排除内部 `dsh2shell-*`/`fake`)的流,会在 `observe()` 的 `finally` 里补记一条 **0-token 的「中断调用」**(新增 `interrupted: true` 字段,`finishReason` 如实标记 `aborted`/`error`/`timeout`)。token 与费用均为 0,不会虚增消耗;调用次数与官方口径一致。
|
|
16
|
+
- **面板透明展示中断调用**(`lib/client.js`):
|
|
17
|
+
- 概览「调用次数」卡片新增 `· 中断 N(未计费)` 提示;
|
|
18
|
+
- 缓存命中列表与用量日历当日明细中,中断调用行在模型名旁显示红色「中断」徽标、结束原因红色标注、消耗列显示 `—`;
|
|
19
|
+
- PNG 导出报告同样在模型名旁标注「中断」、消耗列显示 `—`;
|
|
20
|
+
- 结束原因新增 `aborted → 已中断 / Interrupted`、`timeout → 超时 / Timeout` 映射(中英双语)。
|
|
21
|
+
- **用量面板顶部新增「本地统计与官方后台的差异」提示横幅**:说明本面板统计的是插件本地捕获的调用(官方价格 + 峰谷时段),与官方后台(platform.deepseek.com 用量页)相比金额可能更低——① 中断/出错/超时的调用官方仍按实际 token 计费而插件按 0 记录;② 账号下其他 API Key(其它应用/脚本)的调用不经过 DeepSeek Harness,官方包含而插件不包含;③ 精确对账可导出官方月度账单 CSV 对比。检测到中断调用时额外显示「当前记录中有 N 次中断调用(未计费)」红字提示。
|
|
22
|
+
- **持久化与 API 透传 `interrupted`**(`lib/index.js`):`normalizeRecord` / `projectRecord` 均保留该字段,重启恢复、`/usage/api` list 输出、JSON 导出一致。
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
### 测试 / Tests
|
|
23
25
|
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- **瞬态提示文案同样响应式**:导出 / 导入 / 目录选择等状态消息与客户端校验错误改为语义描述符(`{ k }` / `{ k, tail }` / `{ seq }` / `errorKey`)存储,渲染时才翻译,切换语言后既有提示立即跟随当前语言。
|
|
27
|
-
- **缺失凭据错误不再泄漏内部键**:`PROVIDERS.credentialHint` 更名为 `credentialHintKey`;DeepSeek 未配置凭据的错误改由技术凭据名生成(如「未找到 DEEPSEEK_API_KEY,请配置后重试」),新增 `missingCredentialError` 助手与单测断言错误中不含 `hint.*`。
|
|
28
|
-
- **测试与调试钩子**:新增 `exports.__i18n`(t / tb / msgText / setLang / 日期格式化)与 `test/client-i18n.test.js` —— 覆盖语言即时切换、localStorage 持久化跨挂载生效、日期 / 星期渲染、瞬态消息双语文案、余额语义键双语全覆盖。
|
|
29
|
-
- **余额查询改用语义化字段**:host(`lib/balance.js`)不再返回中文展示文案,改为 `labelKey / hintKey / meaningKey / sourceNoteKey / balanceLabelKey` 等稳定键,双语文案集中到客户端;成功响应负载不含中文展示文本(新增单测覆盖)。错误消息本期保持中文,拟后续跟进。
|
|
30
|
-
- **本地化日期与星期**:新增 `dayLabel / fmtMonthLabel / dailyStatsTitle / weekdayLabels`,中文保持 `2026年8月22日` 习惯格式,英文输出 `Aug 22, 2026`、`August 2026` 与 Mo–Su 星期表头。
|
|
31
|
-
- **实现范围**:改动 `lib/client.js` 与 `lib/balance.js`;PNG 报告、日历悬停提示等 canvas 文案同步支持英文;与数据相关的比较(如合计行 key `"合计"`)保留原文不受翻译影响。宿主端日志 / 错误文案保持中文,拟后续跟进。
|
|
26
|
+
- 新增 `test/interrupt.test.js`:验证中断兜底仅记录真实模型调用(DeepSeek 官方 / 第三方真实 provider),内部 `fake`/`dsh*` 占位调用永不兜底记录。
|
|
27
|
+
- 全部 30/30 通过。
|
|
32
28
|
|
|
33
29
|
---
|
|
34
30
|
|
|
35
|
-
## v1.
|
|
31
|
+
## v1.14.0 (2026-08-27)
|
|
36
32
|
|
|
37
|
-
###
|
|
33
|
+
### 新增 / New
|
|
38
34
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
35
|
+
- **消息底部「本轮 token」弹窗(两层统计)**:多轮完成后,助手消息底部操作行(复制 / 点赞 / 点踩 / 回复 那一排)新增「本轮 token」按钮,点击弹出 `Token 明细`:
|
|
36
|
+
- **对话累计**:整场对话(当前会话)的 总 token / 总消耗 / 耗时 / 缓存命中率;
|
|
37
|
+
- **本轮明细**:本次输出 / 本轮 token / 本轮消耗 / 本轮耗时 / 本轮缓存命中率 / **缓存命中长条图**(命中部分单独绿色渲染 + 百分比)/ **按模型卡片**(每模型:模型名 + 总成本,一行 输入·未命中 / 缓存命中 / 输出(+推理),有费用再一行 峰 / 谷);
|
|
38
|
+
- 时长统一按「X分Y秒」(英文 `Xm Ys`)显示;本轮窗口取该消息实际产出所在 step 的起止,本轮命中率与对话累计各自独立统计。
|
|
39
|
+
- **宿主记录带会话标识**:`llm/stream` 捕获每条记录时新增 `sessionId`(优先 `options.sessionId`,缺失回退当前 agent 会话);新增 `tokenForMessage` API——按「会话 + 时间窗」返回本轮明细与对话累计两层聚合。
|
|
40
|
+
- **内部/工具调用单独分组**:`list` 同时返回 `toolCalls`(`model` 为 fake/unknown/空 或 `dsh*` 内部路由,如 `dsh2shell-*`/`fake`),概览「消耗明细」下方新增可折叠的「工具调用(内部)」分组(默认收起,显示 服务商·模型 / 调用数 / 总消耗),与真实模型调用分开。
|
|
41
|
+
- **语言跟随系统设置**:移除「用量与消耗」头部的中英文切换按钮,语言完全跟随宿主「通用设置 → 语言」,切换即时生效(`locale` 服务 `subscribe` + `locale/change`);不再写 `localStorage`(`dsh-usage-lang`),旧残留值不再覆盖系统语言;「会话 / 设置」标签页名改为按渲染时读取的 thunk,随语言切换实时更新。
|
|
42
|
+
- **移动端适配**:表格在 ≤900px 贴合屏宽(`min-width:0 !important`)、不再出现横向滑条;宽表折叠中间列;弹窗统计卡与按模型卡片随宽度自适应;弹窗滚动条外观隐藏(仍可滚轮滚动)。
|
|
43
|
+
- **英文适配补全**:「高峰 / 空闲时段说明」整块与 19 个遗漏键(当前 · 工作日/周末时段、工作日高峰卡片提示、用量日历悬停提示、价格表两段长说明等)补上英译。
|
|
44
|
+
|
|
45
|
+
### 修复 / Fixes
|
|
46
|
+
|
|
47
|
+
- **弹窗不可见**:对话树祖先的 transform 会破坏 `position: fixed`,改用 `react-dom` 平台种子的 `createPortal` 把弹窗挂到 `document.body`。
|
|
48
|
+
- **整场会话聚合**:按 `messageId` 查找消息完成时间改为读取 `data.finalNode.messageId` / `data.closing.finalNode.messageId`,时间窗正确生效(不再把整场对话圈进来)。
|
|
49
|
+
- **语言切换失效**:不再持久化语言选择,宿主设置切回中文即时恢复、无需刷新。
|
|
50
|
+
- **表格显示**:宽表 `width:max-content`,列按内容撑开、外层容器横向滚动,数字不再被压到换行/重叠。
|
|
51
|
+
|
|
52
|
+
### 测试 / Tests
|
|
53
|
+
|
|
54
|
+
- 周末计费规则回归测试(issue #9):宿主 `isPeakAt`(新增 `test/period.test.js`)+ 客户端 `isPeakNow` / `periodNow`(`test/client-i18n.test.js`),覆盖 issue 的 5 个时刻向量、生效时间边界、峰段窗口左右端点。
|
|
55
|
+
- i18n 测试改为覆盖「跟随宿主语言服务实时切换」「旧 localStorage 值不再覆盖宿主语言」。
|
|
56
|
+
- 全部 27/27 通过。
|
|
41
57
|
|
|
42
58
|
---
|
|
43
59
|
|
|
@@ -49,6 +65,11 @@
|
|
|
49
65
|
- **百炼(Qwen)Token Plan 配额查询**(社区贡献,[@wuhuqif176](https://github.com/wuhuqif176),[PR #8](https://github.com/feiyang-dev/dsh-usage-plugin/pull/8)):「剩余余额查询」新增「百炼 Token Plan」子页签——复用百炼 CLI(`bl`)的控制台 OAuth token(`~/.bailian/config.json`),无需阿里云 AccessKey;展示本周配额已用百分比(进度条 + `已用 xx.x%`)与本周开始 / 结束日期(连续线段,今天节点随日期动态移动)。新增依赖 `undici`。
|
|
50
66
|
- **本地改进**:消耗明细表顶部与底部各渲染一份分页条(长列表翻页更顺手);DeepSeek 系 provider 未单独上报 `cacheWriteTokens` 时,「缓存写入」列改用未命中 token 数(`inputTokens`)兜底显示,避免长期为空。
|
|
51
67
|
|
|
68
|
+
### 文档 / Docs
|
|
69
|
+
|
|
70
|
+
- **补全贡献者名单**(`package.json` contributors):新增 [@ayleen](https://github.com/ayleen)(PR #7 英文界面)与 [@wuhuqif176](https://github.com/wuhuqif176)(PR #8 百炼配额)。
|
|
71
|
+
- **新增 `.mailmap`**:把 PR #7 提交作者 `Ruslan R. Musakalimov <gitlab@letsweb.me>` 映射到 GitHub 账号 @ayleen,使仓库 Contributors 图与 git blame 正确归属历史提交。
|
|
72
|
+
|
|
52
73
|
### 致谢 / Acknowledgements
|
|
53
74
|
|
|
54
75
|
- **[@ayleen](https://github.com/ayleen)**:实现英文界面与响应式语言切换(PR #7)。
|
|
@@ -274,4 +295,3 @@
|
|
|
274
295
|
- CSV / JSON / PNG 长图导出(最新在前,最多 2000 条,超出提示),支持自定义导出目录(原生目录选择器)与「打开所在目录」。
|
|
275
296
|
- JSON / CSV 导入合并,按时间去重。
|
|
276
297
|
- Windows / macOS / Linux 跨平台路径与原生操作适配;启动诊断日志 `dsh-usage-boot.log`。
|
|
277
|
-
|
package/README.md
CHANGED
|
@@ -35,13 +35,18 @@ dsh-usage-plugin is a **usage & cost tracker** plugin in the DeepSeek Harness ec
|
|
|
35
35
|
- **Usage & Cost**: records each model call's token usage and cache hits (input miss / cache hit / cache write / output / reasoning / finish reason), and computes cost using DeepSeek's peak/valley or base pricing (peak hours on weekdays are automatically priced by Beijing time 09:00–12:00 and 14:00–18:00; since 2026-08-23 weekends are billed entirely at the off-peak rate). Model names come from the actual request parameters, so non-DeepSeek models are shown truthfully instead of "unknown model"; models without an official price are counted as 0. The overview shows a by-model table plus a by-API-provider × model drill-down (each provider grouped with every model's calls and peak/off-peak cost split) and a grand total row. The overview also supports **date filtering** (Today / Last 7 days / Last 30 days / All, plus a custom start–end range), so the aggregate stats can be scoped to any single day or date range.
|
|
36
36
|
- **Usage Calendar**: a monthly daily-usage heatmap (colored by cost or call count), hover for details including the peak/off-peak cost split, click a day for its call list and peak/off-peak totals, plus a per-day statistics table with peak cost / off-peak cost / total columns and monthly rollups.
|
|
37
37
|
- **Cache Hit List**: newest-first, fully scrollable, with quick filters (Today / 7 days / 30 days / All) and custom date ranges; the summary line and footer total split peak vs off-peak consumption with a grand cost total. The list is paginated (100 rows per page), so it stays smooth even with large data volumes.
|
|
38
|
+
- **Interrupted calls shown truthfully**: calls that were aborted / errored / timed out (e.g. manually stopped generation, stream interruption) are shown with a red **"Interrupted"** badge, the finish reason (Interrupted / Error / Timeout) and a `—` cost. The official console still counts these as API requests and bills their actual tokens, but the harness does not report their usage to the plugin — so the plugin records them at 0 tokens, keeping the **call count aligned with the official console** while costs are unaffected. The Overview's "Calls" card adds a `· interrupted N (not billed)` hint.
|
|
39
|
+
- **Local stats vs official console**: a fixed notice banner at the top of the panel explains that this panel reflects calls captured locally by the plugin (official prices + peak/off-peak hours), and that the official console (platform.deepseek.com usage page) may show a higher amount because: ① interrupted/failed/timed-out calls are still billed by the console while the plugin records them as 0; ② calls from other API keys on your account (other apps/scripts) do not pass through DeepSeek Harness — the console includes them, the plugin does not; ③ for exact reconciliation, export the official monthly billing CSV and compare. When interrupted calls are detected, the banner also shows a red "Current records include N interrupted call(s) (not billed)" line.
|
|
38
40
|
- **Price Table**: the official DeepSeek API price table (covering `deepseek-v4-flash` / `deepseek-v4-flash-vision-exp` / `deepseek-v4-pro`) — base and peak/valley unit prices shown side by side (peak vs off-peak), editable in-panel and persisted to `pricing.json`, with a reset-to-default option.
|
|
39
41
|
- **Balance Query**: queries your DeepSeek account balance using the configured `DEEPSEEK_API_KEY`.
|
|
40
42
|
- **Export**: CSV / JSON / **PNG long image** (newest-first, up to the latest 2000 records, warns if exceeded; the PNG report includes peak/off-peak cost columns), to any directory (native picker), auto-opens the folder after export.
|
|
41
43
|
- **Import**: merge-imports JSON / CSV files, deduplicated by time.
|
|
42
44
|
- **Persistence**: records are written live to `<session workspace>/dsh-usage/usage-records.json` and restored on restart (cap 100000 records).
|
|
43
|
-
- **UI adaptation**: panel typography scales with the app's display-size setting (em-relative fonts);
|
|
44
|
-
- **English UI (i18n)**: the panel
|
|
45
|
+
- **UI adaptation**: panel typography scales with the app's display-size setting (em-relative fonts); wide tables scroll horizontally on desktop (`max-content` + `overflow-x`) and **fit the screen width on mobile (≤900px, no horizontal scrollbar)**; popup cards adapt to the viewport.
|
|
46
|
+
- **English UI (i18n)**: the panel follows the harness's own language setting (General Settings → Language) — switch it there and the plugin follows instantly, no separate toggle, no `localStorage` override. The bilingual dictionary covers the whole panel, the peak/off-peak billing-period hints, the balance query and the PNG report; host-level Conversation/Settings tab labels are re-read per render, so they follow the language switch live.
|
|
47
|
+
- **Per-message token popup**: when a turn finishes, the assistant message's footer action row shows a **"Turn tokens"** button; clicking opens a `Token Details` popup in two layers — **Conversation total** (the whole session's total tokens / total cost / run time / cache-hit rate) and **This turn** (this output's tokens, turn tokens, turn cost, turn duration, turn cache-hit rate, a cache-hit bar, and per-model cards showing each model's input·miss / cache hit / output (+ reasoning) plus its peak/off-peak cost split). Durations are shown as `Xm Ys`. Each usage record is tagged with the conversation (`sessionId`), so per-turn and per-conversation stats are computed independently.
|
|
48
|
+
- **Internal/tool calls grouped separately**: internal/placeholder calls (e.g. `dsh2shell-*` with model `fake`) are excluded from the model cost breakdown and collected in a collapsible **"Tool calls (internal)"** group below the breakdown, so only real model calls count in the cost tables.
|
|
49
|
+
- **Mobile adaptation**: tables fit the screen width on ≤900px (no horizontal scrollbar); wide tables collapse the middle columns; the popup and its stat cards / per-model cards adapt to the viewport.
|
|
45
50
|
|
|
46
51
|
---
|
|
47
52
|
|
|
@@ -306,6 +311,10 @@ pnpm dsh web
|
|
|
306
311
|
- **[@mumuer1024](https://github.com/mumuer1024)**: reported and diagnosed the persistence-path drift across workspaces (history "disappearing" / counted as 0) and proposed storing data in a fixed, dedicated directory ([#4](https://github.com/feiyang-dev/dsh-usage-plugin/issues/4)).
|
|
307
312
|
- **[@liu3734](https://github.com/liu3734)**: reported and diagnosed the Windows-only path handling / spawn issues on macOS (POSIX) and proposed the cross-platform fix ([#1](https://github.com/feiyang-dev/dsh-usage-plugin/issues/1)).
|
|
308
313
|
|
|
314
|
+
## Changelog
|
|
315
|
+
|
|
316
|
+
- [CHANGELOG.md](./CHANGELOG.md) — detailed notes for every release.
|
|
317
|
+
|
|
309
318
|
## License
|
|
310
319
|
|
|
311
320
|
MIT © dsh-usage-plugin
|
package/README.zh.md
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[GitHub](https://github.com/feiyang-dev/dsh-usage-plugin) · [npm](https://www.npmjs.com/package/@feiyang666/dsh-usage-plugin) · MIT License
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
**由开发者制作的 DeepSeek Harness 插件** —— 记录每一次模型调用的 token 用量与消耗,支持峰谷计费、余额查询、日历热力图与 CSV / JSON / PNG 导出。
|
|
10
11
|
|
|
11
12
|

|
|
@@ -35,13 +36,18 @@ dsh-usage-plugin 是 DeepSeek Harness 生态的**用量与消耗统计插件**
|
|
|
35
36
|
- **用量与消耗**:记录每次模型调用的 token 用量与缓存命中(输入·未命中 / 缓存命中 / 缓存写入 / 输出 / 推理 / 结束原因),按 DeepSeek 峰谷/基础价格计算消耗(工作日高峰时段按北京时间 9:00–12:00、14:00–18:00 计价;自 2026-08-23 起周末全天按空闲价计费)。模型名以请求参数为准如实显示(非 DeepSeek 模型不再显示为「未知模型」,无官方价格的模型消耗按 0 统计)。概览含「按模型」表与「按 API 服务商 × 模型」明细表(每个服务商一组,组内列出各模型的调用与高峰/空闲分列消耗),底部有总费用合计。概览还支持**日期筛选**(今天 / 近 7 天 / 近 30 天 / 全部,外加自定义起止区间),可将聚合统计限定到任意一天或日期范围。
|
|
36
37
|
- **用量日历**:按月查看每日用量热力图(按消耗或调用数着色),悬停查看详情(含高峰 / 空闲消耗拆分)、点击某天查看当日调用明细与高峰/空闲消耗统计,附本月每日统计表(高峰消耗 / 空闲消耗 / 总消耗分列)与月度汇总。
|
|
37
38
|
- **缓存命中列表**:最新记录排在最前,支持 今天 / 近7天 / 近30天 / 全部 快捷筛选与自定义起止日期区间,汇总行与表尾合计区分高峰消耗 / 空闲消耗 / 总费用合计;列表分页渲染(每页 100 条),记录量大也不卡顿。
|
|
39
|
+
- **中断调用如实呈现**:被中止 / 出错 / 超时(如手动停止生成、流中断)的调用在面板中标红显示「中断」徽标、结束原因(已中断 / 错误 / 超时)与消耗 `—`。这类调用官方后台仍会计入「API 请求次数」并按实际 token 计费,但 harness 不向插件上报 usage——插件按 0 token 记录它们,**调用次数与官方口径一致,消耗不受影响**;概览「调用次数」卡片会提示 `中断 N(未计费)`。
|
|
40
|
+
- **本地统计 vs 官方后台的差异提示**:用量面板顶部固定显示说明横幅——本面板统计的是插件本地捕获的调用(官方价格 + 峰谷时段),与官方后台(platform.deepseek.com 用量页)相比金额可能更低:① 中断/出错/超时的调用官方仍按实际 token 计费而插件按 0 记录;② 账号下其他 API Key(其它应用/脚本)的调用不经过 DeepSeek Harness,官方包含而插件不包含;③ 精确对账可导出官方月度账单 CSV 对比。检测到中断调用时,横幅额外以红字显示「当前记录中有 N 次中断调用(未计费)」。
|
|
38
41
|
- **价格表**:**DeepSeek 官方 API 价格表**(覆盖官方模型 `deepseek-v4-flash` / `deepseek-v4-flash-vision-exp` / `deepseek-v4-pro`),展示基础价与峰谷价(高峰/空闲)单价表,高峰价与空闲价分列展示,支持在面板内直接编辑价格并持久化(数据目录 `pricing.json`),也可一键恢复默认。
|
|
39
42
|
- **剩余余额查询**:用当前配置的 `DEEPSEEK_API_KEY` 查询 DeepSeek 账户余额;并支持 **百炼 Token Plan 配额查询**(复用 `bl auth login --console` 的控制台 OAuth token,无需阿里云 AccessKey,展示本周配额已用百分比与重置时间)。
|
|
40
43
|
- **导出**:CSV / JSON / **PNG 长图**(按最新在前展示,最多含最近 2000 条,超出会提示;PNG 报告含高峰 / 空闲消耗分列统计),可导出到任意目录(原生目录选择器),导出后自动打开所在目录。
|
|
41
44
|
- **导入**:选择文件(JSON / CSV)合并导入,按时间去重。
|
|
42
45
|
- **持久化**:记录实时落盘到**固定专用数据目录**(如 `%LOCALAPPDATA%\dsh-usage-plugin\dsh-usage\usage-records.json`,详见下文「数据目录」),与当前工作区无关,重启自动恢复(上限 100000 条,尽量多存)。
|
|
43
|
-
- **界面适配**:面板字号跟随应用「显示大小」设置自动缩放(em
|
|
44
|
-
- **英文界面(i18n
|
|
46
|
+
- **界面适配**:面板字号跟随应用「显示大小」设置自动缩放(em 相对字号);桌面端宽表在容器内横向滑动(max-content + overflow-x),**移动端(≤900px)表格贴合屏宽、不再出现横向滑条**,弹窗与卡片随视口自适应。
|
|
47
|
+
- **英文界面(i18n)**:面板语言跟随宿主的「通用设置 → 语言」——在那里切换,插件即时跟随,不再自带切换按钮,也不再用 `localStorage` 覆盖系统语言。双语词典覆盖整个面板(含高峰 / 空闲时段说明、余额查询、PNG 报告);外部「会话 / 设置」标签页名按渲染时读取,切换语言后实时更新。
|
|
48
|
+
- **消息底部 token 弹窗**:一轮输出完成后,助手消息底部操作行新增「本轮 token」按钮,点击弹出 `Token 明细`,分两层统计——**对话累计**(整场会话的 总 token / 总消耗 / 耗时 / 缓存命中率)与**本轮明细**(本次输出 / 本轮 token / 本轮消耗 / 本轮耗时 / 本轮缓存命中率、缓存命中长条图、按模型卡片:每个模型显示 输入·未命中 / 缓存命中 / 输出(+推理)与峰 / 谷成本分列)。时长按「X分Y秒」显示。宿主记录带会话标识(`sessionId`),本轮与整场对话统计各自独立。
|
|
49
|
+
- **内部/工具调用单独分组**:内部/占位调用(如 `dsh2shell-*`、模型 `fake`)不混入模型消耗明细,单独收在「消耗明细」下方可折叠的 **「工具调用(内部)」** 分组里(默认收起),成本表只统计真实模型调用。
|
|
50
|
+
- **移动端适配**:≤900px 时表格贴合屏宽(不再出现横向滑条)、宽表折叠中间列,弹窗统计卡与按模型卡片随视口自适应。
|
|
45
51
|
|
|
46
52
|
---
|
|
47
53
|
|
|
@@ -306,6 +312,10 @@ pnpm dsh web
|
|
|
306
312
|
- **[@mumuer1024](https://github.com/mumuer1024)**:报告并定位了持久化路径随会话工作区漂移导致历史数据"消失/统计为 0"的问题,提出把数据写到固定专用目录的方案([#4](https://github.com/feiyang-dev/dsh-usage-plugin/issues/4))。
|
|
307
313
|
- **[@liu3734](https://github.com/liu3734)**:报告并定位 macOS(POSIX)下路径处理与 spawn 的 Windows 专用问题,提出跨平台修复方案([#1](https://github.com/feiyang-dev/dsh-usage-plugin/issues/1))。
|
|
308
314
|
|
|
315
|
+
## 更新日志
|
|
316
|
+
|
|
317
|
+
- [CHANGELOG.md](./CHANGELOG.md) —— 每次发布的详细更新内容。
|
|
318
|
+
|
|
309
319
|
## 许可
|
|
310
320
|
|
|
311
321
|
MIT © dsh-usage-plugin
|