@angelyeye/dsh-cost-tracker 1.9.1 → 1.9.3

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,125 @@
2
2
 
3
3
  本文件用中文记录 dsh-cost-tracker 的版本变更。
4
4
 
5
+ ## v1.9.3(2026-09-24)
6
+
7
+ **适配 DSH 0.1.7-alpha.2:配置入口内迁到「花费统计」页头齿轮(带返回键),旧插件配置卡片入口保留兼容**
8
+
9
+ ### 一、背景:新宿主上原配置入口已经消失
10
+
11
+ - DSH `0.1.7-alpha.2` **删除了 `settings.plugin.item` 插槽**(在 0.1.7-alpha.2 全部宿主包的 JS 里该字符串零命中),
12
+ 原「设置 → 插件 → 插件配置」页由 `dsh-client-ui-settings-plugins` 承担,现在该分区只托管
13
+ `settings.plugins.tab`,唯一贡献者是**只读清单** `dsh-client-ui-settings-plugin-inventory`
14
+ (只显示完整名称 / 配置状态 / 启用于),**没有任何表单**;
15
+ - 同时 `dsh-settings` 的 `installSection` 也已下线(grep 零命中),即 `index.js` 的
16
+ `installSettingsSection()` 现在只会静默返回 false;配置值实际只来自
17
+ `~/.dsh/storages/cost-tracker-config.json` + 插件自己的 `/api/cost-tracker/*` —— 所以修复完全落在客户端;
18
+ - 结论:v1.9.2 及更早版本在新宿主上「设置 → 插件 → 插件配置」里**再也看不到本插件的配置卡片**,
19
+ 而插件的配置又只在那张卡片里 —— 用户实际上失去了全部设置入口(本次修复的动机)。
20
+
21
+ ### 二、改法:配置 UI 内迁到本插件自己的设置分区
22
+
23
+ - 新增 `CostSection`(`settings.section` 的渲染函数):持有 `view`(`dashboard` / `config`)与 `ui` 快照
24
+ (`peak` 轮询 + `UI_EVENT` 监听,从原 `DashGate` 上移,看板与配置页共用同一快照);
25
+ - `Dashboard` 页头 `.cost-h1` 右侧新增**齿轮按钮** `button.cost-gear`(自绘齿轮图标、`aria-label="花费统计设置"`、
26
+ `title` 同文案,不带可见文字);点击进入配置页;
27
+ - 配置页 = `ConfigPanel({ mode: "page" })`:根节点 `div.cost-wrap.cost-cfg-page`,
28
+ 页头为 **返回键** `button.cost-back`(‹ 图标 + 「返回」+ `aria-label="返回花费统计看板"`)
29
+ + 标题「花费统计 · 设置」+ 兼容说明;正文**常驻展开**(无外层折叠),
30
+ 顶部状态条与七个折叠分组(多机汇总 / 峰谷计价与提示 / 订阅套餐与配额 / 计价与价格目录 /
31
+ 历史导入 / 数据与界面 / 安全与凭据)与各分组动作**逐项不变**;
32
+ - **为什么是分区内子视图而不是第二个左侧导航项**:宿主设置外壳渲染分区时只传入 `close`
33
+ (`dsh-client-ui-settings-general` 的 `renderSlot('settings.section', { close }, { only: active })`),
34
+ 分区没有任何程序化切换导航的能力;`settings.section` 的 label 与 order 也只能在注册时决定;
35
+ - **关闭看板不再可能成为死亡入口**:`uiDashboardEnabled=false` 时仍渲染页头 + 齿轮,
36
+ 只把统计内容换成「点右上角齿轮 → 数据与界面 → 打开」的指引(原卡片入口在新宿主上已不存在,
37
+ 这条护栏是必须的)。
38
+
39
+ ### 三、兼容:`settings.plugin.item` 卡片入口保留
40
+
41
+ - 注册**原样保留**(`slots.inject(pluginItemKey, ...)` 无条件注入,未声明该插槽时回调不触发 ⇒ 零成本);
42
+ 仍声明它的旧宿主(`dsh < 0.1.7-alpha.2`)照旧显示卡片;
43
+ - 两个入口**共用同一个 `ConfigPanel`**(`mode: "card"` 折叠卡片外壳 / `mode: "page"` 配置页外壳),
44
+ 正文同一段渲染 ⇒ 字段、字典、校验、写接口不可能漂移;两处的未保存草稿各自独立;
45
+ - 卡片外壳(`li.cost-pcard` > `button.cost-pcard-head` > 折叠 body、默认收起、`aria-expanded`)
46
+ 与 `.cost-pcard*` 样式**逐字未改**,原有卡片测试原样通过(`client-render` 的 [3] 组断言未动)。
47
+
48
+ ### 四、文案路径统一
49
+
50
+ - 插件内与 HTTP/Agent 错误里的路径统一为「设置 → 花费统计 → 右上角齿轮 → 分组名」:
51
+ `client.js`(峰谷只读面板、云端同步只读卡、看板关闭提示、云端未配置提示、令牌失效提示)、
52
+ `index.js`(`NOT_CONFIGURED`、共享引导令牌失效)、`sync.js`(`TOKEN_INVALID` message);
53
+ - 注释同步更新(`config.js`、`pricing.js`、`vendor-catalog.js`、`index.js`、`schema.js` 相关段),
54
+ 旧宿主兼容路径只在配置页页脚与 README 里说明。
55
+
56
+ ### 五、测试
57
+
58
+ - `test/client-render.test.js`:新增 **[3b] 齿轮入口**(齿轮存在 / 可访问名 / 图标 / 挂在页头操作位 /
59
+ 点击进入配置页 / 页头有返回键 / 七个分组齐 / 两视图互斥 / 点返回回到看板)与
60
+ **[3c] 两入口一致性**(配置页与兼容卡片的分组标题、状态摘要、关键字段集合必须相同);
61
+ [8] 组新增「关闭态仍渲染齿轮 → 点击进入配置页 → 能重新打开看板」的完整闭环;
62
+ 原 [3] 卡片外壳断言保持不变(兼容入口的护栏);
63
+ - `test/ui-display.test.js`:关闭提示断言改为指向齿轮,新增「分区内配置入口不受三个界面开关控制」
64
+ 「齿轮挂在页头操作位」两条;[5] 改为断言四个插槽无条件注册(含兼容卡片);
65
+ - `test/client-registration.test.js`:[6] 组扩充为「两种外壳来自同一个 ConfigPanel」
66
+ 「齿轮与返回键都在(图标 + 可访问名)」「settings.section 渲染的是 CostSection 而不是直接渲染看板」;
67
+ - 全量 18 个测试文件通过。
68
+
69
+ ### 六、行为差异与注意
70
+
71
+ - **从配置页点「返回」会丢弃未点保存的草稿**(每个分组仍是「改草稿 → 点该组保存」;
72
+ 折叠分组之间的切换不丢草稿,与卡片折叠语义一致);
73
+ - 切换左侧设置分区 / 关闭设置面板时组件卸载,下次进入回到看板视图(宿主只挂载当前分区);
74
+ - 本次为**纯客户端 UI 重组**:HTTP 面、配置键、落盘路径、云端契约(`dsh-cost-cloud`)、
75
+ 计费/定价/导入/同步逻辑**零改动**,老配置零迁移。
76
+
77
+ ## v1.9.2(2026-09-20)
78
+
79
+ **定价口径修正:V4-Pro 不再路由到 Flash(官方撤销下线计划)+ 新增「法定节假日全天闲时」**
80
+
81
+ ### 一、修正:`deepseek-v4-pro` 维持自有牌价,取消反向路由
82
+
83
+ - **现场**:核对官方定价页(2026-09-20 抓取)—— 官方**为 V4-Pro 单列价格**:
84
+ 高峰 输入(未命中)9.0 / 输入(命中)0.30 / 输出 27.0,闲时半价,**并发 500**(Flash 为 2500);
85
+ 脚注只把 `deepseek-v4-flash`、`deepseek-v4-flash-vision-exp`、`deepseek-v4.1-flash`
86
+ 路由到 `deepseek-flash`,**没有** V4-Pro 的路由条目。
87
+ - **为什么之前是反的**:09-10 新闻稿写的是「我们**计划**有序下线 V4 Pro……北京时间
88
+ 9 月 14 日 12:00 之后,`deepseek-v4-pro` 的请求将全部路由到 V4.1 Flash,并按 V4.1 Flash
89
+ 单价计费」,v1.9.0/1.9.1 据此实现了 `v41pro` 时代;但官方**更新日志**(同一篇的口径其后被改写)
90
+ 改为:「为响应广大用户的需求,我们**决定**在 2026 年 9 月 14 日之后**继续提供**
91
+ DeepSeek V4 Pro 的 API 调用服务,**计费方式保持不变**」。以现行价目页 + 更新日志为准。
92
+ - **修法**:删除时代 `v41pro` 与导出 `V41_PRO_ROUTE_AT`(`PRICE_ERAS` 回到 2 版:
93
+ `legacy` / `v41`),`v41` 时代保留 V4-Pro 自有牌价且不配任何路由;`cost_prices` 不再输出
94
+ `v41ProRouteAt`,渲染文本改为「deepseek-v4-pro 维持 V4-Pro 自有牌价」。
95
+ - **影响**:内置表若继续把 pro 路由到 Flash,会按 Flash 价(输入 2 / 输出 8)计 pro 调用
96
+ (应为 9 / 27),**低估约 3.4~4.5 倍**。本机账本**零影响**:全量回放 4393 次调用,
97
+ `deepseek-v4-pro` **0 次**(默认模型是 `deepseek-flash`)。
98
+ - **历史记录的可修复边界**:路由期入库的 pro 记录,模型名已被改写为计费名
99
+ `deepseek-flash`,补账无法反推原始模型;若要订正必须重放会话日志(`import.js` 保留原始名)。
100
+
101
+ ### 二、新增:法定节假日全天计入闲时(官方口径,此前只排除了周末)
102
+
103
+ - 官方脚注:「北京时间周一至周五(**不含中国法定节假日**)9:00-12:00、14:00-18:00
104
+ 为高峰时段;其余时段,包括周末及中国法定节假日全天均为空闲时段。」
105
+ 旧实现只排除周末 ⇒ 节假日落在工作日时会被按高峰多计 1 倍(下一次是国庆 10-01~10-07)。
106
+ - `pricing.js` 新增 `CN_HOLIDAYS`(2026 全年 33 天,来源:国办发明电〔2025〕7 号,
107
+ 2025-11-04)与 `setPeakHolidays` / `getPeakHolidays` / `isCnHoliday` / `holidayKeyAt` /
108
+ `normalizeHolidayList`;`isPeak` 与 `peakPhaseAt` 同源判定,节假日全天 `allDayOff`
109
+ (相位另带 `holiday` 标记,真周末仍为 `weekend`)。
110
+ - **调休补班的周六/周日不计高峰**:定价规则只看「周一至周五」,调休不改变这一点
111
+ (`2026-05-09`、`2026-10-10` 等补班日仍为闲时)。
112
+ - **配置**:新增 `peakHolidays`(配置卡「峰谷计价与提示」分组)—— 空串 = 内置表;
113
+ `none`/`off` = 停用(只按周末判定);也可写自定义列表(`2027-01-01 2027-02-05`,
114
+ 逗号/空白分隔,兼容 `2027/1/1` 写法)。语义防呆:自定义列表**整体替换**内置表而非追加;
115
+ 非法条目不被静默吞掉 —— `peak` 快照以 `invalid` 原样报告,配置卡如实回显。
116
+ - **文案与相位**:区分「周末全谷」与「节假日全谷」(侧边栏时段条 / 环形表盘 / 档位行),
117
+ 同为绿色系;峰谷文案改为「周一至周五 9:00-12:00 · 14:00-18:00(周末与法定节假日全天闲时)」;
118
+ 老后端缺 `allDayOff` 字段时回落 `weekend` 判定(向后兼容)。
119
+ - **测试**:新增 `test/peak-holidays.test.js`(内置表 / 停用 / 自定义 / 重启持久化 / 工具输出,
120
+ 含「配置写入真的改变记账口径」的闭环断言);`test/pricing.test.js` 新增 [2c](节假日边界、
121
+ 相位、覆盖语义、`holidayKeyAt` 边界);`test/client-render.test.js` 新增 [10](节假日/周末/
122
+ 老后端三种相位的文案)与配置项渲染断言。
123
+
5
124
  ## v1.9.1(2026-09-20)
6
125
 
7
126
  **修复:云端同步全面失败(405「方法不允许」)+ 明文迁移在凭据服务晚就绪时不再重试**
package/README.en.md CHANGED
@@ -29,7 +29,7 @@
29
29
  | | Feature | Description |
30
30
  | --- | --- | --- |
31
31
  | 💰 | **Cost tracking** | Every API call is recorded automatically: input / output / cache-hit / cache-write tokens and cost (cache write billed at the cache-hit price), aggregated by day and by model |
32
- | ⏰ | **Peak/off-peak pricing** | Built-in price table; peak windows (Mon–Fri 9:00–12:00, 14:00–18:00 Beijing time) vs half-price off-peak handled automatically; **weekends are fully off-peak**; local models (e.g. ollama) count as 0; the table is **versioned by pricing era** and switches automatically to V4.1 Flash rates at 2026-09-10 12:00 Beijing time (peak 2.0 / 0.04 / 8.0), routing the legacy V4-Flash family to V4.1 Flash billing per the official rules; **V4-Pro is routed from 2026-09-14 12:00 only** (before that it keeps its own rates 9.0 / 27.0 / 0.30) |
32
+ | ⏰ | **Peak/off-peak pricing** | Built-in price table; peak windows (Mon–Fri 9:00–12:00, 14:00–18:00 Beijing time, **excluding Chinese statutory holidays**) vs half-price off-peak handled automatically; **weekends and statutory holidays are fully off-peak** (33 holiday days for 2026, overridable/disableable in the config card; make-up workday weekends stay off-peak); local models (e.g. ollama) count as 0; the table is **versioned by pricing era** (`legacy` / `v41`) and switches automatically to V4.1 Flash rates at 2026-09-10 12:00 Beijing time (peak 2.0 / 0.04 / 8.0), routing the legacy V4-Flash family to V4.1 Flash billing per the official footnote; **`deepseek-v4-pro` keeps its own rates 9.0 / 27.0 / 0.30 and is never routed** (the official retirement plan was revoked on 2026-09-14) |
33
33
  | 🔔 | **Peak-price notice** | A "Peak/off-peak pricing & notice" panel in Settings: current tier + countdown strip, style switch (**compact single-row · 24h-proportional** / **ring dial · phase dot**), an optional **two-row compact** stacked layout for the compact style (bar-above-text / text-above-bar), a "Show time" toggle, popup alert + browser notification before a tier switch, lead time, popup position (bottom-right/center), alert type; a persistent strip in the sidebar footer (adapts to rail/collapsed). Mirrors `dsh-cost-meter` |
34
34
  | 📌 | **Six overview cards** | Six cards at the top of Settings: Today / This month / Total spend / API requests / Tokens / **Account balance**. The three spend cards **exclude subscription equivalent cost** (shown as an annotation instead) |
35
35
  | 👁️ | **Vision model** | Supports `deepseek-v4-flash-vision-exp`: priced as flash in the legacy era, billed at V4.1 Flash rates from 2026-09-10 12:00 (that legacy id is retired; requests are served by V4.1 Flash); images are converted to tokens per the official rule (≤384 tokens each, billed per API usage) |
@@ -206,7 +206,7 @@ cp .env.example .env # fill SESSION_SECRET and ADMIN_PASSWORD_HASH (node sc
206
206
  docker compose up -d # open http://<server>:8787 and generate a shared bootstrap token under Settings
207
207
  ```
208
208
 
209
- **Configure each device**: open **Settings → Plugins → Plugin configuration → Cost Tracker** and fill in:
209
+ **Configure each device**: open **Settings → Cost Tracker → gear icon (top right)** → "Multi-machine aggregation (cloud sync)" and fill in:
210
210
 
211
211
  | Field | Meaning |
212
212
  | --- | --- |
@@ -235,22 +235,34 @@ The dimension selector adds per-device / per-agent / per-model breakdowns and a
235
235
 
236
236
  ### Interface visibility (v1.8.12, optional)
237
237
 
238
- Don't want the plugin in your face? **Settings → Plugins → Plugin configuration → Cost Tracker → Interface visibility** has three independent switches that apply **the moment you tick them** (no Save, no `dsh` restart):
238
+ Don't want the plugin in your face? **Settings → Cost Tracker → gear icon (top right) → Data & interface → Interface visibility** has three independent switches that apply **the moment you tick them** (no Save, no `dsh` restart):
239
239
 
240
240
  | Switch | What turning it off does |
241
241
  | --- | --- |
242
242
  | Composer cost pill | the per-session cost / model breakdown above the chat input disappears |
243
243
  | Sidebar peak bar | the phase / countdown strip at the bottom of the sidebar disappears (the peak-switch popup and web notifications go with it; if you only want the reminder without the strip, use the notice switch under "Peak/off-peak pricing & notices" instead) |
244
- | Settings dashboard | the "Cost Tracker" entry disappears from the Settings nav (accounting and cloud sync keep running; the page then shows a one-line hint on how to bring it back) |
244
+ | Settings dashboard | the Settings nav entry keeps a one-line hint on how to bring the dashboard back (accounting and cloud sync keep running) |
245
245
 
246
246
  - **Display only**: accounting, persistence, cloud sync and the agent tools (`cost_stats` etc.) are unaffected;
247
- - **The plugin configuration card itself is never hidden by these switches** — otherwise you would have no way to turn them back on;
247
+ - **The configuration entry itself is never hidden by these switches** — the header gear always stays (old hosts also keep the plugin configuration card), otherwise you would have no way to turn them back on;
248
248
  - Truth value is "hidden only on an explicit `false`", so a missing key means visible: **an existing config file looks exactly the same after upgrading**;
249
249
  - All three keys live in the same `~/.dsh/storages/cost-tracker-config.json` (`uiDockEnabled` / `uiPeakEnabled` / `uiDashboardEnabled`) and never overwrite the peak/cloud fields.
250
250
 
251
- ### Plugin configuration card (v1.9.0 redesign: the single place for every setting)
251
+ ### Settings entry (v1.9.3: the gear in the Cost Tracker header; the only entry on new hosts)
252
252
 
253
- **Settings → Plugins → Plugin configuration → Cost Tracker** now carries **all** settings, laid out as collapsible groups under a status strip (cloud sync / records stored / pending / last sync / pricing era / history import / amount basis):
253
+ **Settings → Cost Tracker → gear icon at the top right** (icon button, tooltip "花费统计设置") opens the configuration page; the **back** control at its top-left returns to the dashboard.
254
+
255
+ | Entry | Host versions | Shape |
256
+ | --- | --- | --- |
257
+ | **Header gear → configuration page** (v1.9.3, recommended) | all versions | Settings → Cost Tracker → gear; the page is fully expanded, back control at the top left |
258
+ | **Plugin configuration card** (v1.9.0, kept for compatibility) | only hosts that still declare `settings.plugin.item` (`dsh < 0.1.7-alpha.2`) | Settings → Plugins → Plugin configuration → Cost Tracker; collapsed by default, click the header to expand |
259
+
260
+ > DSH `0.1.7-alpha.2` removed the `settings.plugin.item` slot (the Built-in plugins section became a read-only inventory),
261
+ > so the card no longer shows on new hosts. The registration is **kept** (an undeclared slot simply never fires, so it costs
262
+ > nothing) and old hosts keep working. Both entries share **one configuration component**, so fields, validation and write
263
+ > paths are identical — only the shell differs; unsaved drafts are independent, just edit wherever you are.
264
+
265
+ The configuration page carries **all** settings, laid out as collapsible groups under a status strip (cloud sync / records stored / pending / last sync / pricing era / history import / amount basis):
254
266
 
255
267
  | Group | Contents |
256
268
  | --- | --- |
@@ -328,6 +340,46 @@ Example: `curl -X POST http://127.0.0.1:3080/api/cost-tracker/summary -d '{}'`
328
340
 
329
341
  > Highlights only — the full version-by-version history lives in [`CHANGELOG.md`](./CHANGELOG.md) (Chinese).
330
342
 
343
+ ### v1.9.3 (2026-09-24)
344
+
345
+ **DSH 0.1.7-alpha.2 support: the configuration entry moved into the Cost Tracker page (gear icon + back control); the old card entry is kept for compatibility**
346
+
347
+ - **Why**: DSH `0.1.7-alpha.2` removed the `settings.plugin.item` slot (the old Settings → Plugins → Plugin configuration page);
348
+ the Built-in plugins section is now a read-only inventory, and `dsh-settings` no longer exposes `installSection` — so the
349
+ plugin's configuration card could never render on the new host;
350
+ - **What**: the configuration UI now lives inside the plugin's own settings section —
351
+ **Settings → Cost Tracker → gear icon (top right)** opens the configuration page, whose **back** control returns to the
352
+ dashboard. The seven collapsible groups, the status strip and every per-group action (Save / Test / Sync now / price sync /
353
+ history import …) are unchanged;
354
+ - **Why an in-page switch instead of a second nav entry**: the host settings shell renders a section with `close` only
355
+ (`renderSlot('settings.section', { close }, { only: active })`), so a section has no way to navigate the shell;
356
+ - **Compatibility**: the `settings.plugin.item` registration is **kept** — on 0.1.7+ the slot does not exist, so the callback
357
+ never fires (zero cost), while older hosts keep showing the card. Both entries share one `ConfigPanel` (only the shell
358
+ differs), so fields, validation and write paths are identical; unsaved drafts stay independent;
359
+ - **No more dead end**: when the dashboard is turned off, the header and gear remain, with a one-line hint pointing to
360
+ "Data & interface → Settings dashboard" (the old card entry no longer exists on new hosts, so this guard is required).
361
+
362
+ ### v1.9.2 (2026-09-20)
363
+
364
+ **Pricing correction: V4-Pro is no longer routed to Flash (official retirement plan revoked) + statutory holidays are now off-peak**
365
+
366
+ - **Correction**: the live official pricing page still lists `deepseek-v4-pro` **with its own row**
367
+ (peak 9 / 27 / 0.30, half price off-peak, concurrency 500), and the official changelog now reads
368
+ "we **decided** to **continue** serving DeepSeek V4 Pro after 2026-09-14, **with billing unchanged**".
369
+ The built-in table had implemented the *announced plan* from the 09-10 news post ("after 09-14 12:00 all
370
+ `deepseek-v4-pro` requests are routed to V4.1 Flash and billed at Flash rates") as era `v41pro`,
371
+ which billed pro calls at Flash rates (input 2 / output 8 instead of 9 / 27) — an
372
+ **understatement of roughly 3.4–4.5×**. That era and its route are removed; V4-Pro always uses its
373
+ own rates (`PRICE_ERAS` is back to `legacy` / `v41`). Zero impact on this machine's ledger
374
+ (0 of 4393 replayed calls used `deepseek-v4-pro`). **Caveat**: pro records ingested while the route
375
+ was active have their model name rewritten to `deepseek-flash`, so a re-price cannot recover them —
376
+ only replaying session logs can.
377
+ - **New**: official rules treat **Chinese statutory holidays** as fully off-peak (previously only weekends
378
+ were excluded, so a holiday weekday was billed 1× too high). 33 built-in days for 2026
379
+ ([State Council notice](https://www.gov.cn/zhengce/zhengceku/202511/content_7047091.htm)); the config card
380
+ gains `peakHolidays` (empty = built-in, `none` = disable, or a custom list); **make-up workday weekends
381
+ stay off-peak**; the phase wording now distinguishes "weekend all off-peak" from "holiday all off-peak".
382
+
331
383
  ### v1.9.1 (2026-09-20)
332
384
 
333
385
  **Fixed: cloud sync failed with "method not allowed" (405) — `safeFetch` dropped the native fetch signature, turning every POST into a GET**
@@ -571,7 +623,7 @@ Quota is read from the Ark **control-plane** OpenAPI (`open.volcengineapi.com`,
571
623
  1. Volcengine console → **IAM → Users → Keys**, create an AccessKeyID / SecretAccessKey pair;
572
624
  2. Grant that sub-user **`ArkReadOnlyAccess`** and **`BillingCenterReadOnlyAccess`** (read-only is enough to query usage);
573
625
  3. Let the plugin obtain the pair (any one of these, in priority order):
574
- - fill in **Volcengine AccessKeyID / SecretAccessKey** under **Settings → Plugins → Plugin config → Cost Tracker** (the secret is never echoed back); or
626
+ - fill in **Volcengine AccessKeyID / SecretAccessKey** under **Settings → Cost Tracker → gear icon → Subscriptions & quota** (the secret is never echoed back); or
575
627
  - put them in the `refs:` section of `~/.dsh/.credentials.yaml` under `VOLC_ACCESSKEY` / `VOLC_SECRETKEY` (variants such as `VOLCENGINE_ACCESS_KEY_ID` and `ARK_ACCESS_KEY_ID` also work); or
576
628
  - export them as environment variables with the same names.
577
629
 
package/README.md CHANGED
@@ -29,8 +29,8 @@
29
29
  | | 功能 | 说明 |
30
30
  | --- | --- | --- |
31
31
  | 💰 | **花费统计** | 每一次 API 调用自动记账:输入 / 输出 / 缓存命中 / 缓存写入 Tokens 与费用(缓存写入按缓存命中价计),按天、按模型聚合 |
32
- | ⏰ | **峰谷定价** | 内置单价表,高峰时段(北京时间周一至周五 9:00–12:00、14:00–18:00)与闲时半价自动区分,**周末全天计为闲时**,本地模型(ollama 等)计 0;**单价表按「计费时代」分版**,北京时间 2026-09-10 12:00 起自动切换为 V4.1 Flash 新价(2.0 / 0.04 / 8.0 高峰),并按官方规则把旧 V4-Flash 系请求路由到 V4.1 Flash 计费;**V4-Pro 自 2026-09-14 12:00 起才路由**(此前仍按自有牌价 9.0 / 27.0 / 0.30) |
33
- | 🔔 | **峰谷计价提示** | **设置 → 插件 → 插件配置 → 花费统计 → 峰谷计价与提示**(v1.9.0 起设置集中在此,改完即可预览):当前档位/距下次切换倒计时时段条、样式切换(**简洁单行·按24h比例** / **环形表盘·相位色点**)、简洁样式可选**双行紧凑**(上下布局,条上文下/文上条下)、「显示时间」开关、峰/谷切换前弹窗提醒与浏览器系统通知、提前提醒分钟、弹窗位置(右下角/屏幕中心)、提醒类型;侧边栏底部常驻显示时段条(窄栏/展开自适应)。看板上的同名面板改为只读回显 |
32
+ | ⏰ | **峰谷定价** | 内置单价表,高峰时段(北京时间周一至周五 9:00–12:00、14:00–18:00,**不含中国法定节假日**)与闲时半价自动区分,**周末与法定节假日全天计为闲时**(节假日表 2026 全年 33 天,可在配置页覆盖/停用;调休补班的周六周日不计高峰),本地模型(ollama 等)计 0;**单价表按「计费时代」分版**(`legacy` / `v41`),北京时间 2026-09-10 12:00 起自动切换为 V4.1 Flash 新价(2.0 / 0.04 / 8.0 高峰),并按官方脚注把旧 V4-Flash 系请求路由到 V4.1 Flash 计费;**`deepseek-v4-pro` 维持自有牌价 9.0 / 27.0 / 0.30 不做路由**(官方 2026-09-14 撤销了下线计划) |
33
+ | 🔔 | **峰谷计价提示** | **设置 → 花费统计 → 右上角齿轮 → 峰谷计价与提示**(v1.9.0 起设置集中在此,改完即可预览;DSH 0.1.7-alpha.2 起入口在「花费统计」页头的齿轮,v1.9.3):当前档位/距下次切换倒计时时段条、样式切换(**简洁单行·按24h比例** / **环形表盘·相位色点**)、简洁样式可选**双行紧凑**(上下布局,条上文下/文上条下)、「显示时间」开关、峰/谷切换前弹窗提醒与浏览器系统通知、提前提醒分钟、弹窗位置(右下角/屏幕中心)、提醒类型;侧边栏底部常驻显示时段条(窄栏/展开自适应)。看板上的同名面板改为只读回显 |
34
34
  | 📌 | **六组概览卡** | 设置页顶部六张卡:今日费用 / 本月费用 / 总花费 / API 请求次数 / Tokens / **总余额**。前三个金额卡**不含订阅会员等效费用**,订阅以附注展示 |
35
35
  | 👁️ | **视觉模型** | 支持 `deepseek-v4-flash-vision-exp`:legacy 时代单价与 flash 一致,2026-09-10 12:00 起随 V4.1 Flash 新价计费(该旧名已下线,请求由 V4.1 Flash 提供);图片按官方规则换算 token(每张上限 384 个,以接口用量计费) |
36
36
  | 🏷️ | **官方模型名对齐** | 计费支持**官方现役名 `deepseek-flash`**(价格卡脚注 (1):「模型名请使用 `deepseek-flash`」),旧写法 `deepseek-v4.1-flash` 等归一化后命中同一档价,避免因官方改名而落入兜底估算 |
@@ -41,7 +41,7 @@
41
41
  | 💳 | **余额查询** | 一键查询 DeepSeek 官方账户余额(总余额 / 充值 / 赠送 / 状态) |
42
42
  | 🤖 | **Agent 工具** | 直接在对话里问:"我现在花了多少钱?"——Agent 会调用 `cost_stats` / `cost_prices` 等工具回答 |
43
43
  | 🔻 | **状态栏** | 聊天输入框下方实时显示:**本会话花费**(胶囊分段:本会话 / 订阅套餐 / 分模型),按会话实际用到的模型与订阅拆分,**多模型默认折叠只显示 top2,点击展开全部明细**;订阅显示具体套餐名,不再展示配额与调用次数 |
44
- | 👁️ | **界面显示开关** | 输入框上方的花费胶囊、侧边栏峰谷时段条、设置页「花费统计」看板**三个落点各自可关**(设置 → 插件 → 插件配置 → 花费统计 → 界面显示),勾选即刻生效;**只影响显示**,记账、云端同步与 Agent 工具照常,配置卡片本身不受开关控制 |
44
+ | 👁️ | **界面显示开关** | 输入框上方的花费胶囊、侧边栏峰谷时段条、设置页「花费统计」看板**三个落点各自可关**(设置 → 花费统计 → 右上角齿轮 → 数据与界面 → 界面显示),勾选即刻生效;**只影响显示**,记账、云端同步与 Agent 工具照常,配置入口(齿轮页)本身不受开关控制 |
45
45
  | 💾 | **本地持久化** | 数据存本机 `~/.dsh/storages/cost-tracker-records.json`,重启不丢、不上传;**明细保留最近 180 天,更早自动压缩为永久日汇总,全时段统计永远精确且内存/磁盘有界** |
46
46
  | 🕰️ | **历史导入(v1.9.0)** | 回放宿主会话日志,**把装插件之前的对话调用补录进账本**(按各自时间戳的旧价计费);只补插件不可能记到的部分(安装前 / 停机缺口),幂等可重复执行,导入记录标记 `source=import` 以便区分 |
47
47
  | 🔄 | **官方价格同步(v1.9.0)** | 一键抓取官方定价页、解析各模型峰价并对比差异,应用后构建**新的计费时代**(只影响之后,历史口径不回改);每日可自动核对(只提示、不自动应用),页面改版时宁可不同步也绝不写错价 |
@@ -64,7 +64,7 @@
64
64
 
65
65
  ![单个模型的请求次数面积图与 Tokens 堆叠图,悬停提示显示完整日期与分段数值](docs/screenshots/model-detail.png)
66
66
 
67
- > 📸 截图取自 v1.8.x 的看板;v1.9.0 起工具栏多了「含 Plan 总额」开关、插件配置卡片改为七个折叠分组(见「插件配置卡片」一节),概览卡与图表本身不变。
67
+ > 📸 截图取自 v1.8.x 的看板;v1.9.0 起工具栏多了「含 Plan 总额」开关、配置面板改为七个折叠分组(见「设置入口」一节),v1.9.3 起配置页由「花费统计」页头右上角齿轮进入(带返回键),概览卡与图表本身不变。
68
68
 
69
69
  ---
70
70
 
@@ -180,7 +180,7 @@ rm -rf ~/.dsh/profiles/node_modules/dsh-cost-tracker
180
180
  - **配色切换**:「按模型」视图下,消费金额标题旁有三套装色款条(橙→黄 / 蓝→紫 / 蓝→浅蓝)可切换;模型按总消费降序排名取色(第 1 名最深夜底、逐级变浅,不循环不撞色),选择保存在浏览器本地;
181
181
  - **分模型区块**:每个模型一张请求次数图 + 一张 Tokens 构成图(输入/缓存写入/输出/缓存命中);
182
182
  - **Token 用量统计热力图**:类 Codex 的 26 周每日用量方格,颜色深浅按当日 token 相对最大值分档;悬停任一格看该日明细(输入 / 缓存 / 输出 / 费用),今天高亮描边;**口径跟随三态开关**:「本机」只统计本机,「本机+云端」把云端按天用量并入(与上方卡片同一并集口径、不重复计数),「仅云端」只看云端,标题右侧标注当前口径。云端按天明细需要 `dsh-cost-cloud ≥ v1.3.2`,旧云端下自动退回本机口径;
183
- - **峰谷计价与提示**:时段条样式可选(**简洁单行·按 24h 比例**(白色实时进度线) / **环形表盘·相位色点**),简洁样式可选**双行紧凑**(条上文下 / 文上条下),可开关「显示时间」刻度(00:00–21:00),设置峰/谷切换前的弹窗提醒提前量(1–30 分钟)、提醒类型(两者 / 进入高峰 / 进入闲时)、弹窗位置(右下角 / 屏幕中心)与浏览器系统通知。**v1.9.0 起这些设置统一在「设置 → 插件 → 插件配置 → 花费统计 → 峰谷计价与提示」里改**(看板上的同名面板改为只读回显,只保留弹窗预览);侧边栏底部常驻时段条显示当前档位与下次切换倒计时;
183
+ - **峰谷计价与提示**:时段条样式可选(**简洁单行·按 24h 比例**(白色实时进度线) / **环形表盘·相位色点**),简洁样式可选**双行紧凑**(条上文下 / 文上条下),可开关「显示时间」刻度(00:00–21:00),设置峰/谷切换前的弹窗提醒提前量(1–30 分钟)、提醒类型(两者 / 进入高峰 / 进入闲时)、弹窗位置(右下角 / 屏幕中心)与浏览器系统通知。**v1.9.0 起这些设置统一在「设置 → 花费统计 → 右上角齿轮 → 峰谷计价与提示」里改**(v1.9.3 起入口为页头齿轮;看板上的同名面板改为只读回显,只保留弹窗预览);侧边栏底部常驻时段条显示当前档位与下次切换倒计时;
184
184
  - **含 Plan 总额开关(v1.9.0)**:工具栏右侧一个开关,决定金额卡与图表的口径 —— 关闭(默认)只算按量真金白银、订阅以附注展示;打开则金额 = 按量 + 订阅等值,图表按天并入「订阅等值」一段。选择存浏览器本地并回写服务端配置(跨设备一致);
185
185
  - **导出 CSV**:导出明细记录(近 180 天)+ 日汇总行(`purpose=rollup`)。
186
186
 
@@ -208,7 +208,7 @@ cp .env.example .env # 填 SESSION_SECRET 与 ADMIN_PASSWORD_HASH(node sc
208
208
  docker compose up -d # 打开 http://<服务器>:8787 ,在「设置」页生成共享引导令牌
209
209
  ```
210
210
 
211
- **在每台设备上配置**:打开 **设置 → 插件 → 插件配置 → 花费统计**,填写:
211
+ **在每台设备上配置**:打开 **设置 → 花费统计 → 右上角齿轮** → 「多机汇总(云端同步)」,填写:
212
212
 
213
213
  | 字段 | 说明 |
214
214
  | --- | --- |
@@ -233,26 +233,37 @@ docker compose up -d # 打开 http://<服务器>:8787 ,在「设置」页
233
233
  **其它 agent 也能接入**:云端的上报协议是开放的,任何 agent 的统计插件按 `dsh-cost-cloud` 仓库的 `docs/INGEST-API.md` 实现即可接入,云端无需改动,看板会自动出现新的 Agent 列。
234
234
  **关键约定**:同一台机器上的所有 agent 必须共用同一个 `machineId`(共享文件 `~/.dsh-cost/device.json`),否则会被统计成多台设备。
235
235
 
236
- **隐私**:只上报 token 数量、费用、时间戳与标识符(不涉及 prompt / 回复 / 文件内容);可在配置卡开启「会话脱敏」(`sessionId` 上报前替换为不可逆哈希)与「不含 purpose」。
236
+ **隐私**:只上报 token 数量、费用、时间戳与标识符(不涉及 prompt / 回复 / 文件内容);可在配置页开启「会话脱敏」(`sessionId` 上报前替换为不可逆哈希)与「不含 purpose」。
237
237
 
238
238
  ### 界面显示(v1.8.12,可选)
239
239
 
240
- 不想在界面上看到插件?**设置 → 插件 → 插件配置 → 花费统计 → 界面显示**里三个开关**各自独立**、**勾选即刻生效**(无需点「保存」,也无需重启 dsh):
240
+ 不想在界面上看到插件?**设置 → 花费统计 → 右上角齿轮 → 数据与界面 → 界面显示**里三个开关**各自独立**、**勾选即刻生效**(无需点「保存」,也无需重启 dsh):
241
241
 
242
242
  | 开关 | 关掉之后 |
243
243
  | --- | --- |
244
244
  | 输入框上方的花费胶囊 | 会话输入区不再显示本会话花费与模型明细 |
245
245
  | 侧边栏峰谷时段条 | 侧边栏底部的档位 / 倒计时消失(峰谷切换弹窗与系统通知一并停用;只想留提醒不想要时段条,请改用「峰谷计价与提示」里的提示开关) |
246
- | 设置页「花费统计」看板 | 设置页左侧不再出现该入口(记账与云端同步照常;关掉后该页只留一句重新打开的指引) |
246
+ | 设置页「花费统计」看板 | 设置页左侧的该入口只留一句重新打开的指引(记账与云端同步照常) |
247
247
 
248
248
  - **只影响显示**:记账、落盘、云端同步与 Agent 工具(`cost_stats` 等)全部照常工作;
249
- - **插件配置卡片本身不受这三个开关控制** —— 否则关掉之后就没有入口能再打开了;
249
+ - **配置入口本身不受这三个开关控制** —— 页头齿轮始终在(旧宿主还有插件配置卡片),否则关掉之后就没有入口能再打开了;
250
250
  - 取值为「只有显式 `false` 才隐藏」,缺省即显示。老配置文件里没有这几个键,**升级后界面与升级前一致**;
251
251
  - 落盘在同一份 `~/.dsh/storages/cost-tracker-config.json`(键名 `uiDockEnabled` / `uiPeakEnabled` / `uiDashboardEnabled`),与峰谷、云端字段互不覆盖。
252
252
 
253
- ### 插件配置卡片(v1.9.0 重设计:全部设置的唯一入口)
253
+ ### 设置入口(v1.9.3:花费统计页头齿轮;新宿主上的唯一入口)
254
254
 
255
- **设置 → 插件 → 插件配置 → 花费统计** 现在承载**全部**设置,按折叠分组排列,顶部一条状态摘要(云端同步 / 已记账条数 / 待上报 / 上次同步 / 计价时代 / 历史导入 / 金额口径):
255
+ **设置 → 花费统计 → 页头右上角齿轮**(图标按钮,悬浮提示「花费统计设置」)→ 配置页,左上角**返回键**回到看板。
256
+
257
+ | 入口 | 适用宿主 | 形态 |
258
+ | --- | --- | --- |
259
+ | **页头齿轮 → 配置页**(v1.9.3 起,推荐) | 全部版本 | 设置 → 花费统计 → 齿轮;配置页整页常驻展开,左上角返回键 |
260
+ | **插件配置卡片**(v1.9.0,兼容保留) | 仅仍声明 `settings.plugin.item` 的旧宿主(`dsh < 0.1.7-alpha.2`) | 设置 → 插件 → 插件配置 → 花费统计;卡片默认收起,点标题展开 |
261
+
262
+ > DSH `0.1.7-alpha.2` 删除了 `settings.plugin.item` 插槽(「内置插件」分区改为只读清单),卡片在新宿主上不显示;
263
+ > 插件侧的注册**保留**(插槽不存在时回调不触发,零成本),旧宿主照旧可用。两个入口**共用同一个配置组件**,
264
+ > 字段、校验、写接口完全一致,只是外壳不同;未保存草稿各自独立,就近改一处即可。
265
+
266
+ 配置页承载**全部**设置,按折叠分组排列,顶部一条状态摘要(云端同步 / 已记账条数 / 待上报 / 上次同步 / 计价时代 / 历史导入 / 金额口径):
256
267
 
257
268
  | 分组 | 内容 |
258
269
  | --- | --- |
@@ -264,13 +275,13 @@ docker compose up -d # 打开 http://<服务器>:8787 ,在「设置」页
264
275
  | **数据与界面** | 界面显示三开关(勾选即刻生效)、导出 CSV、重算费用(试算 / 写回)、清空数据(两步确认) |
265
276
  | **安全与凭据** | 云端令牌 / 火山 SK 的「是否已配置 + 存储位置」徽章、旧版明文迁移状态、清除按钮与出站防护说明 |
266
277
 
267
- 约定:**只有「界面显示」三开关是勾选即刻生效**(要立刻看到显隐结果),其余分组都是「改草稿 → 点该组保存」,避免误触即写盘;分组折叠只切显隐、不卸载内容,展开任一分组都不会重新取数或丢草稿。
278
+ 约定:**只有「界面显示」三开关是勾选即刻生效**(要立刻看到显隐结果),其余分组都是「改草稿 → 点该组保存」,避免误触即写盘;分组折叠只切显隐、不卸载内容,展开任一分组都不会重新取数或丢草稿。**从配置页点「返回」会丢弃未点保存的草稿**(点该组「保存」即落盘),各组之间互不影响。
268
279
 
269
280
  ### 历史导入(v1.9.0)
270
281
 
271
282
  装上插件之前的对话也能补进账本:插件回放宿主会话日志(`$DSH_HOME/sessions/<项目>/<会话>/session.v3.jsonl.zstd`,多 zstd frame 逐帧解压、逐帧切片),把其中的模型调用按**当时时间戳**的计费口径入账。
272
283
 
273
- - 默认**开机自动导入**(延迟 8 秒,不阻塞启动),也可在配置卡点「立即导入」或关掉自动(`autoImport`);
284
+ - 默认**开机自动导入**(延迟 8 秒,不阻塞启动),也可在配置页点「立即导入」或关掉自动(`autoImport`);
274
285
  - **只补「插件不可能记到」的调用**:早于本机最早一条实时记录,或所在日完全没有实时覆盖(停机缺口);
275
286
  - 跨安装点的会话按切割线截断:安装前那段补录,安装后那段以实时记录为准;
276
287
  - **幂等三保险**:清单按文件 mtime + size 快跳、逐调用键 `(sessionId, 时间戳, 五桶 tokens)` 去重、已被实时覆盖的日子宁可不导入也不重复计数;
@@ -278,7 +289,7 @@ docker compose up -d # 打开 http://<服务器>:8787 ,在「设置」页
278
289
 
279
290
  ### 官方价格同步与多厂商目录(v1.9.0)
280
291
 
281
- - **官方价格同步**:配置卡里点「核对官方价」抓取官方定价页(中文页直接给出人民币价),解析出各模型峰价并与当前生效价对比;点「应用新价」把结果构建为**新的计费时代** —— 只对生效时刻**之后**的记录生效,历史记录按各自时间戳选版,口径不回改。每日可自动核对(默认开,只提示差异,**绝不自动应用**)。解析器对页面改版 / 数字缺失 / 「空闲价 ≠ 高峰一半」一律抛错,宁可不同步也绝不写错价;
292
+ - **官方价格同步**:配置页里点「核对官方价」抓取官方定价页(中文页直接给出人民币价),解析出各模型峰价并与当前生效价对比;点「应用新价」把结果构建为**新的计费时代** —— 只对生效时刻**之后**的记录生效,历史记录按各自时间戳选版,口径不回改。每日可自动核对(默认开,只提示差异,**绝不自动应用**)。解析器对页面改版 / 数字缺失 / 「空闲价 ≠ 高峰一半」一律抛错,宁可不同步也绝不写错价;
282
293
  - **多厂商模型价格目录**:内置 14 家厂商 / 90 个模型条目(OpenAI / Anthropic / Google / Moonshot / z-ai / xAI / Alibaba / MiniMax / Tencent / Xiaomi / Upstage / NVIDIA / Mistral / OpenCode;数据改编自 `dsh-cost-meter` 的已核对官方目录,MIT),按 USD→CNY 汇率(默认 7.2,可改)折算。内置表之外的模型命中目录即记**精确价**(不再标「估算」);匹配模式可选宽松(归一化包含)或严格(名称全等);
283
294
  - **手动覆盖价**:`provider/model` → 输入 / 输出 / 缓存价,优先级最高,用于自建端点或议价套餐;
284
295
  - **计费优先级**:手动覆盖价 > 订阅归类(Plan)> 内置 / 同步时代精确价 > 多厂商目录 > provider 兜底 > 通用兜底。`cost_prices` 工具与 `/api/cost-tracker/prices` 会一并回显当前时代、同步时代、目录指纹与覆盖价;
@@ -318,7 +329,7 @@ POST /api/cost-tracker/prices-config 价格同步设置(定价页地址 / 每日
318
329
  POST /api/cost-tracker/import-status 历史导入状态
319
330
  POST /api/cost-tracker/import-run 执行一轮历史导入(幂等)
320
331
  POST /api/cost-tracker/import-config 历史导入设置(开机自动开关)
321
- POST /api/cost-tracker/reset 清空全部记录(配置卡两步确认后调用)
332
+ POST /api/cost-tracker/reset 清空全部记录(配置页两步确认后调用)
322
333
  POST /api/cost-tracker/export 导出 CSV
323
334
  ```
324
335
 
@@ -330,6 +341,42 @@ POST /api/cost-tracker/export 导出 CSV
330
341
 
331
342
  > 这里只列重要版本;逐版完整记录见 [`CHANGELOG.md`](./CHANGELOG.md)。
332
343
 
344
+ ### v1.9.3(2026-09-24)
345
+
346
+ **适配 DSH 0.1.7-alpha.2:配置入口内迁到「花费统计」页头齿轮(旧卡片入口保留兼容)**
347
+
348
+ - **背景**:DSH `0.1.7-alpha.2` 删除了 `settings.plugin.item` 插槽(原来的「设置 → 插件 → 插件配置」),
349
+ 「内置插件」分区改成**只读清单**(只显示完整名称 / 配置状态 / 启用于),`dsh-settings` 的
350
+ `installSection` 也一并下线 —— 本插件原先挂在那里的配置卡片在新宿主上**永远不会显示**;
351
+ - **改法**:配置 UI 内迁到本插件自己的设置分区 —— **设置 → 花费统计 → 页头右上角齿轮**(齿轮为图标按钮,
352
+ 带 `花费统计设置` 可访问名)→ 配置页,左上角**返回键**回到看板。七个折叠分组、顶部状态摘要、
353
+ 各分组的保存 / 测试连接 / 立即同步 / 用价同步 / 历史导入等动作**逐项不变**;
354
+ - **为什么是「页内跳转」而不是第二个左侧导航项**:宿主设置外壳渲染分区时只传入 `close`
355
+ (`renderSlot('settings.section', { close }, { only: active })`),分区没有任何程序化切换导航的能力;
356
+ - **兼容**:`settings.plugin.item` 注册**保留**。0.1.7+ 上该插槽不存在 → 回调不触发即自动失效(零成本);
357
+ 仍声明它的旧宿主照旧显示卡片。两种入口**共用同一个 `ConfigPanel`**(只有外壳不同),字段、校验、
358
+ 写接口完全一致 —— 就近改一处即可,两处的未保存草稿互相独立;
359
+ - **不再可能关掉后打不开**:看板被关掉时页头与齿轮仍在,只有统计内容换成一句「点右上角齿轮 →
360
+ 数据与界面 → 打开」的指引(原「插件配置」入口在新宿主上已经不存在,这条护栏是必须的);
361
+ - **文案**:插件内所有指引(峰谷只读面板、云端同步只读卡、令牌失效提示、云端未配置提示)与
362
+ Agent 工具 / HTTP 错误里的路径统一改为「设置 → 花费统计 → 右上角齿轮 → 分组名」。
363
+
364
+ ### v1.9.2(2026-09-20)
365
+
366
+ **定价口径修正:V4-Pro 不再路由到 Flash(官方撤销下线计划)+ 新增「法定节假日全天闲时」**
367
+
368
+ - **修正**:官方现行价目页仍为 `deepseek-v4-pro` **单列价格**(高峰 9 / 27 / 0.30,闲时半价,并发 500),
369
+ 更新日志也已改为「决定在 2026-09-14 之后**继续提供** V4 Pro 服务,**计费方式保持不变**」。
370
+ 内置表此前按 09-10 新闻稿的**预告**(「9-14 12:00 后 pro 全部路由到 Flash」)实现了 `v41pro` 时代,
371
+ 会把 pro 调用按 Flash 价计(输入 2 / 输出 8),**低估约 3.4~4.5 倍**。现删除该时代与路由,
372
+ V4-Pro 一律按自有牌价计费(`PRICE_ERAS` 回到 `legacy` / `v41` 两版)。
373
+ 本机账本零影响(4393 次调用中 `deepseek-v4-pro` 0 次);**注意**:路由期已入库的 pro 记录模型名
374
+ 已被改写为 `deepseek-flash`,补账无法反推,需重放会话日志才能订正。
375
+ - **新增**:官方把**中国法定节假日**全天计入闲时(此前只排除了周末,节假日落在工作日会多计 1 倍)。
376
+ 内置 2026 全年 33 天([国办发明电〔2025〕7 号](https://www.gov.cn/zhengce/zhengceku/202511/content_7047091.htm)),
377
+ 配置卡「峰谷计价与提示」新增 `peakHolidays`:空 = 内置表、`none` = 停用、也可自定列表;
378
+ **调休补班的周六/周日不计高峰**;相位文案区分「周末全谷」与「节假日全谷」。
379
+
333
380
  ### v1.9.1(2026-09-20)
334
381
 
335
382
  **修复:云端同步报「方法不允许」(405)—— `safeFetch` 丢掉 fetch 原生签名,POST 退化成 GET**
@@ -575,7 +622,7 @@ POST /api/cost-tracker/export 导出 CSV
575
622
  1. 火山引擎控制台 → **IAM → 用户 → 密钥**,创建 AccessKeyID / SecretAccessKey;
576
623
  2. 给该子用户授予 **`ArkReadOnlyAccess`** 与 **`BillingCenterReadOnlyAccess`**(只读,足够查询用量);
577
624
  3. 让插件拿到这对密钥(任选其一,按优先级):
578
- - **设置 → 插件 → 插件配置 → 花费统计** 里填 `火山引擎 AccessKeyID` / `SecretAccessKey`(密钥不回显);或
625
+ - **设置 → 花费统计 → 右上角齿轮 → 订阅套餐与配额** 里填 `火山引擎 AccessKeyID` / `SecretAccessKey`(密钥不回显);或
579
626
  - 写进 `~/.dsh/.credentials.yaml` 的 `refs:` 段,键名 `VOLC_ACCESSKEY` / `VOLC_SECRETKEY`(也兼容 `VOLCENGINE_ACCESS_KEY_ID`、`ARK_ACCESS_KEY_ID` 等写法);或
580
627
  - 设为同名环境变量。
581
628
 
@@ -609,7 +656,7 @@ POST /api/cost-tracker/export 导出 CSV
609
656
  ├── config.js 配置层:峰谷计价提示 + 云端同步 + 界面显示 + 火山凭据的默认值与规范化(纯逻辑,可独立测试)
610
657
  ├── volcengine.js 火山方舟配额查询:HMAC-SHA256 签名、响应解析、凭据归一(纯逻辑,可独立测试)
611
658
  ├── sync.js 云端同步引擎:设备身份、增量水位、幂等批次、退避重试
612
- ├── schema.js 宿主设置空间的 schema(插件配置卡片字段)
659
+ ├── schema.js 宿主设置空间的 schema(配置面板字段;旧宿主兼容)
613
660
  ├── view.js 三态视图合并:本机 / 本机+云端 / 仅云端的口径归一化(浏览器与测试共用)
614
661
  ├── client.js Client 半端:设置页仪表盘、状态栏与峰谷提示 UI
615
662
  ├── package.json 插件清单:声明 dsh.bundle(插件可被安装的关键)与 dsh.client(前端 UI)