@angelyeye/dsh-cost-tracker 1.9.1 → 1.9.2

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,53 @@
2
2
 
3
3
  本文件用中文记录 dsh-cost-tracker 的版本变更。
4
4
 
5
+ ## v1.9.2(2026-09-20)
6
+
7
+ **定价口径修正:V4-Pro 不再路由到 Flash(官方撤销下线计划)+ 新增「法定节假日全天闲时」**
8
+
9
+ ### 一、修正:`deepseek-v4-pro` 维持自有牌价,取消反向路由
10
+
11
+ - **现场**:核对官方定价页(2026-09-20 抓取)—— 官方**为 V4-Pro 单列价格**:
12
+ 高峰 输入(未命中)9.0 / 输入(命中)0.30 / 输出 27.0,闲时半价,**并发 500**(Flash 为 2500);
13
+ 脚注只把 `deepseek-v4-flash`、`deepseek-v4-flash-vision-exp`、`deepseek-v4.1-flash`
14
+ 路由到 `deepseek-flash`,**没有** V4-Pro 的路由条目。
15
+ - **为什么之前是反的**:09-10 新闻稿写的是「我们**计划**有序下线 V4 Pro……北京时间
16
+ 9 月 14 日 12:00 之后,`deepseek-v4-pro` 的请求将全部路由到 V4.1 Flash,并按 V4.1 Flash
17
+ 单价计费」,v1.9.0/1.9.1 据此实现了 `v41pro` 时代;但官方**更新日志**(同一篇的口径其后被改写)
18
+ 改为:「为响应广大用户的需求,我们**决定**在 2026 年 9 月 14 日之后**继续提供**
19
+ DeepSeek V4 Pro 的 API 调用服务,**计费方式保持不变**」。以现行价目页 + 更新日志为准。
20
+ - **修法**:删除时代 `v41pro` 与导出 `V41_PRO_ROUTE_AT`(`PRICE_ERAS` 回到 2 版:
21
+ `legacy` / `v41`),`v41` 时代保留 V4-Pro 自有牌价且不配任何路由;`cost_prices` 不再输出
22
+ `v41ProRouteAt`,渲染文本改为「deepseek-v4-pro 维持 V4-Pro 自有牌价」。
23
+ - **影响**:内置表若继续把 pro 路由到 Flash,会按 Flash 价(输入 2 / 输出 8)计 pro 调用
24
+ (应为 9 / 27),**低估约 3.4~4.5 倍**。本机账本**零影响**:全量回放 4393 次调用,
25
+ `deepseek-v4-pro` **0 次**(默认模型是 `deepseek-flash`)。
26
+ - **历史记录的可修复边界**:路由期入库的 pro 记录,模型名已被改写为计费名
27
+ `deepseek-flash`,补账无法反推原始模型;若要订正必须重放会话日志(`import.js` 保留原始名)。
28
+
29
+ ### 二、新增:法定节假日全天计入闲时(官方口径,此前只排除了周末)
30
+
31
+ - 官方脚注:「北京时间周一至周五(**不含中国法定节假日**)9:00-12:00、14:00-18:00
32
+ 为高峰时段;其余时段,包括周末及中国法定节假日全天均为空闲时段。」
33
+ 旧实现只排除周末 ⇒ 节假日落在工作日时会被按高峰多计 1 倍(下一次是国庆 10-01~10-07)。
34
+ - `pricing.js` 新增 `CN_HOLIDAYS`(2026 全年 33 天,来源:国办发明电〔2025〕7 号,
35
+ 2025-11-04)与 `setPeakHolidays` / `getPeakHolidays` / `isCnHoliday` / `holidayKeyAt` /
36
+ `normalizeHolidayList`;`isPeak` 与 `peakPhaseAt` 同源判定,节假日全天 `allDayOff`
37
+ (相位另带 `holiday` 标记,真周末仍为 `weekend`)。
38
+ - **调休补班的周六/周日不计高峰**:定价规则只看「周一至周五」,调休不改变这一点
39
+ (`2026-05-09`、`2026-10-10` 等补班日仍为闲时)。
40
+ - **配置**:新增 `peakHolidays`(配置卡「峰谷计价与提示」分组)—— 空串 = 内置表;
41
+ `none`/`off` = 停用(只按周末判定);也可写自定义列表(`2027-01-01 2027-02-05`,
42
+ 逗号/空白分隔,兼容 `2027/1/1` 写法)。语义防呆:自定义列表**整体替换**内置表而非追加;
43
+ 非法条目不被静默吞掉 —— `peak` 快照以 `invalid` 原样报告,配置卡如实回显。
44
+ - **文案与相位**:区分「周末全谷」与「节假日全谷」(侧边栏时段条 / 环形表盘 / 档位行),
45
+ 同为绿色系;峰谷文案改为「周一至周五 9:00-12:00 · 14:00-18:00(周末与法定节假日全天闲时)」;
46
+ 老后端缺 `allDayOff` 字段时回落 `weekend` 判定(向后兼容)。
47
+ - **测试**:新增 `test/peak-holidays.test.js`(内置表 / 停用 / 自定义 / 重启持久化 / 工具输出,
48
+ 含「配置写入真的改变记账口径」的闭环断言);`test/pricing.test.js` 新增 [2c](节假日边界、
49
+ 相位、覆盖语义、`holidayKeyAt` 边界);`test/client-render.test.js` 新增 [10](节假日/周末/
50
+ 老后端三种相位的文案)与配置项渲染断言。
51
+
5
52
  ## v1.9.1(2026-09-20)
6
53
 
7
54
  **修复:云端同步全面失败(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) |
@@ -328,6 +328,27 @@ Example: `curl -X POST http://127.0.0.1:3080/api/cost-tracker/summary -d '{}'`
328
328
 
329
329
  > Highlights only — the full version-by-version history lives in [`CHANGELOG.md`](./CHANGELOG.md) (Chinese).
330
330
 
331
+ ### v1.9.2 (2026-09-20)
332
+
333
+ **Pricing correction: V4-Pro is no longer routed to Flash (official retirement plan revoked) + statutory holidays are now off-peak**
334
+
335
+ - **Correction**: the live official pricing page still lists `deepseek-v4-pro` **with its own row**
336
+ (peak 9 / 27 / 0.30, half price off-peak, concurrency 500), and the official changelog now reads
337
+ "we **decided** to **continue** serving DeepSeek V4 Pro after 2026-09-14, **with billing unchanged**".
338
+ The built-in table had implemented the *announced plan* from the 09-10 news post ("after 09-14 12:00 all
339
+ `deepseek-v4-pro` requests are routed to V4.1 Flash and billed at Flash rates") as era `v41pro`,
340
+ which billed pro calls at Flash rates (input 2 / output 8 instead of 9 / 27) — an
341
+ **understatement of roughly 3.4–4.5×**. That era and its route are removed; V4-Pro always uses its
342
+ own rates (`PRICE_ERAS` is back to `legacy` / `v41`). Zero impact on this machine's ledger
343
+ (0 of 4393 replayed calls used `deepseek-v4-pro`). **Caveat**: pro records ingested while the route
344
+ was active have their model name rewritten to `deepseek-flash`, so a re-price cannot recover them —
345
+ only replaying session logs can.
346
+ - **New**: official rules treat **Chinese statutory holidays** as fully off-peak (previously only weekends
347
+ were excluded, so a holiday weekday was billed 1× too high). 33 built-in days for 2026
348
+ ([State Council notice](https://www.gov.cn/zhengce/zhengceku/202511/content_7047091.htm)); the config card
349
+ gains `peakHolidays` (empty = built-in, `none` = disable, or a custom list); **make-up workday weekends
350
+ stay off-peak**; the phase wording now distinguishes "weekend all off-peak" from "holiday all off-peak".
351
+
331
352
  ### v1.9.1 (2026-09-20)
332
353
 
333
354
  **Fixed: cloud sync failed with "method not allowed" (405) — `safeFetch` dropped the native fetch signature, turning every POST into a GET**
package/README.md CHANGED
@@ -29,7 +29,7 @@
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) |
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
33
  | 🔔 | **峰谷计价提示** | **设置 → 插件 → 插件配置 → 花费统计 → 峰谷计价与提示**(v1.9.0 起设置集中在此,改完即可预览):当前档位/距下次切换倒计时时段条、样式切换(**简洁单行·按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 个,以接口用量计费) |
@@ -330,6 +330,22 @@ POST /api/cost-tracker/export 导出 CSV
330
330
 
331
331
  > 这里只列重要版本;逐版完整记录见 [`CHANGELOG.md`](./CHANGELOG.md)。
332
332
 
333
+ ### v1.9.2(2026-09-20)
334
+
335
+ **定价口径修正:V4-Pro 不再路由到 Flash(官方撤销下线计划)+ 新增「法定节假日全天闲时」**
336
+
337
+ - **修正**:官方现行价目页仍为 `deepseek-v4-pro` **单列价格**(高峰 9 / 27 / 0.30,闲时半价,并发 500),
338
+ 更新日志也已改为「决定在 2026-09-14 之后**继续提供** V4 Pro 服务,**计费方式保持不变**」。
339
+ 内置表此前按 09-10 新闻稿的**预告**(「9-14 12:00 后 pro 全部路由到 Flash」)实现了 `v41pro` 时代,
340
+ 会把 pro 调用按 Flash 价计(输入 2 / 输出 8),**低估约 3.4~4.5 倍**。现删除该时代与路由,
341
+ V4-Pro 一律按自有牌价计费(`PRICE_ERAS` 回到 `legacy` / `v41` 两版)。
342
+ 本机账本零影响(4393 次调用中 `deepseek-v4-pro` 0 次);**注意**:路由期已入库的 pro 记录模型名
343
+ 已被改写为 `deepseek-flash`,补账无法反推,需重放会话日志才能订正。
344
+ - **新增**:官方把**中国法定节假日**全天计入闲时(此前只排除了周末,节假日落在工作日会多计 1 倍)。
345
+ 内置 2026 全年 33 天([国办发明电〔2025〕7 号](https://www.gov.cn/zhengce/zhengceku/202511/content_7047091.htm)),
346
+ 配置卡「峰谷计价与提示」新增 `peakHolidays`:空 = 内置表、`none` = 停用、也可自定列表;
347
+ **调休补班的周六/周日不计高峰**;相位文案区分「周末全谷」与「节假日全谷」。
348
+
333
349
  ### v1.9.1(2026-09-20)
334
350
 
335
351
  **修复:云端同步报「方法不允许」(405)—— `safeFetch` 丢掉 fetch 原生签名,POST 退化成 GET**
package/client.js CHANGED
@@ -180,6 +180,8 @@ window.__ModuleLoader__.load({
180
180
  .cost-ps.peak .cost-ps-chip { color: #ff9800; }
181
181
  .cost-ps.off .cost-ps-chip { color: var(--dsw-alias-state-business-primary, #4176e6); }
182
182
  .cost-ps.weekend .cost-ps-chip { color: #34a853; }
183
+ /* 法定节假日:与周末同为「全天谷价」,同一绿色系 */
184
+ .cost-ps.holiday .cost-ps-chip { color: #34a853; }
183
185
  .cost-ps-foot { font-size: 11px; color: var(--dsw-alias-label-tertiary, #9ca3af); white-space: nowrap; }
184
186
  /* 环形表盘(classic 改造):24h 中空圆环,蓝=平价、橙=高峰、绿=周末 */
185
187
  .cost-ps-ring { flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
@@ -191,6 +193,7 @@ window.__ModuleLoader__.load({
191
193
  .cost-ps-rail.peak .cost-ps-word { color: #ff9800; }
192
194
  .cost-ps-rail.off .cost-ps-word { color: var(--dsw-alias-state-business-primary, #4176e6); }
193
195
  .cost-ps-rail.weekend .cost-ps-word { color: #34a853; }
196
+ .cost-ps-rail.holiday .cost-ps-word { color: #34a853; }
194
197
  /* 侧边栏底部(sidebar.footer.action)多插件 UI 兼容:
195
198
  DSH 渲染器把该槽锚点设为 display:contents(见 dsh-client-ui-renderer ANCHOR_STYLE),
196
199
  多个插件内容会被并进同一行(如与 linxin666/dsh-web-ui-all 冲突);改为纵向堆叠即可共存。
@@ -1270,15 +1273,24 @@ window.__ModuleLoader__.load({
1270
1273
  }
1271
1274
 
1272
1275
  // ---------- 峰谷计价提示 ----------
1273
- // 相位助记(与 dsh-cost-meter 一致):weekend → 「周末全谷」;inPeak → 「峰时」;否则「平价」。
1276
+ // 相位助记(与 dsh-cost-meter 一致):allDayOff → 「周末/节假日全谷」;inPeak → 「峰时」;否则「平价」。
1277
+ // allDayOff 由后端给出(weekend ∪ 法定节假日);对老后端缺该字段时回落到 weekend。
1278
+ function offAllDay(p) {
1279
+ return !!(p && (p.allDayOff === true || (p.allDayOff === undefined && p.weekend === true)));
1280
+ }
1274
1281
  function peakWord(p) {
1275
1282
  if (!p) return "";
1276
- if (p.weekend) return "周末全谷";
1283
+ if (offAllDay(p)) return p.holiday ? "节假日全谷" : "周末全谷";
1277
1284
  return p.inPeak ? "峰时" : "平价";
1278
1285
  }
1279
1286
  function peakWordClass(p) {
1280
1287
  if (!p) return "";
1281
- return p.weekend ? " weekend" : p.inPeak ? " peak" : " off";
1288
+ if (offAllDay(p)) return p.holiday ? " holiday" : " weekend";
1289
+ return p.inPeak ? " peak" : " off";
1290
+ }
1291
+ /** 全天谷价日的档位文案(周末 / 法定节假日分开说,避免把节假日误称「周末」) */
1292
+ function offPhaseLabel(p) {
1293
+ return p && p.holiday ? "法定节假日全谷价" : "周末全谷价";
1282
1294
  }
1283
1295
  // 倒计时文本:向上取整到分钟。与 dsh-cost-meter 一致:{time}后进入高峰/平价。
1284
1296
  function peakCountdown(p, now) {
@@ -1297,7 +1309,7 @@ window.__ModuleLoader__.load({
1297
1309
  // 当前相位在轨道上的标记位置:峰=25%、平价=75%;周末中点=50%。
1298
1310
  function peakMarkerLeft(p) {
1299
1311
  if (!p) return "50%";
1300
- if (p.weekend) return "50%";
1312
+ if (offAllDay(p)) return "50%";
1301
1313
  return p.inPeak ? "25%" : "75%";
1302
1314
  }
1303
1315
  // 24h 环形表盘(classic 改造):中空圆环。底环蓝=平价铺满 24h,高峰窗口叠加橙色弧段,
@@ -1322,8 +1334,8 @@ window.__ModuleLoader__.load({
1322
1334
  // 平价底环(蓝)
1323
1335
  e("circle", { cx: CX, cy: CY, r: R, fill: "none", stroke: offC, "stroke-width": SW }),
1324
1336
  ];
1325
- // 高峰弧(橙);周末则不画任何峰时弧段
1326
- if (!p.weekend) {
1337
+ // 高峰弧(橙);周末 / 法定节假日则不画任何峰时弧段
1338
+ if (!offAllDay(p)) {
1327
1339
  for (const w of windows) {
1328
1340
  const a = deg(w.start), b = deg(w.end);
1329
1341
  const s = polar(a, R), e2 = polar(b, R);
@@ -1338,9 +1350,9 @@ window.__ModuleLoader__.load({
1338
1350
  children.push(e("text", { x: pt[0], y: pt[1], "text-anchor": "middle", "dominant-baseline": "middle", "font-size": "8.5", fill: dim }, (h < 10 ? "0" : "") + h + ":00"));
1339
1351
  }
1340
1352
  }
1341
- // 当前相位颜色(峰橙 / 平蓝 / 周末绿)—— 同时用于标记点与圆心文案
1342
- const color = p.weekend ? weekC : p.inPeak ? peakC : offC;
1343
- const word = p.weekend ? "周末全谷" : p.inPeak ? "高峰时段" : "平价时段";
1353
+ // 当前相位颜色(峰橙 / 平蓝 / 周末·节假日绿)—— 同时用于标记点与圆心文案
1354
+ const color = offAllDay(p) ? weekC : p.inPeak ? peakC : offC;
1355
+ const word = offAllDay(p) ? (p.holiday ? "节假日全谷" : "周末全谷") : p.inPeak ? "高峰时段" : "平价时段";
1344
1356
  // 当前时刻标记:相位色点(环上,随相位变色 + 白色描边)
1345
1357
  const m = peakBeijingMinute(now);
1346
1358
  const tip = polar(m / 1440 * 360, R);
@@ -1379,7 +1391,7 @@ window.__ModuleLoader__.load({
1379
1391
  e("div", { className: "cost-ps-seg cost-ps-offseg", style: { left: "0%", width: "100%" } }),
1380
1392
  ];
1381
1393
  // 高峰段(橙)按窗口在 24h 中的比例定位
1382
- if (!p.weekend) {
1394
+ if (!offAllDay(p)) {
1383
1395
  for (const w of win) {
1384
1396
  segs.push(e("div", { className: "cost-ps-seg cost-ps-peakseg", style: { left: (w.start / 24 * 100) + "%", width: ((w.end - w.start) / 24 * 100) + "%" } }));
1385
1397
  }
@@ -1532,7 +1544,7 @@ window.__ModuleLoader__.load({
1532
1544
  ["时段条样式", cfg.peakStyle === "classic" ? "环形表盘(24h)" : "简洁(单行紧凑)"],
1533
1545
  ["切换提醒", cfg.peakAlertEnabled !== false ? ("提前 " + (cfg.peakAlertAhead == null ? 2 : cfg.peakAlertAhead) + " 分钟 · " + (cfg.peakAlertTarget === "peak" ? "进入峰时" : cfg.peakAlertTarget === "offpeak" ? "进入谷时" : "峰和谷")) : "已关闭"],
1534
1546
  ["系统通知", cfg.peakAlertWebNotify === true ? "已开启" : "未开启"],
1535
- ["当前档位", snap && snap.phase ? (snap.phase.weekend ? "周末全谷价" : snap.phase.inPeak ? "高峰时段" : "平价时段") : "…"],
1547
+ ["当前档位", snap && snap.phase ? (offAllDay(snap.phase) ? offPhaseLabel(snap.phase) : snap.phase.inPeak ? "高峰时段" : "平价时段") : "…"],
1536
1548
  ];
1537
1549
  return e("div", { className: "cost-panel" },
1538
1550
  e("div", { className: "cost-row" },
@@ -1546,8 +1558,8 @@ window.__ModuleLoader__.load({
1546
1558
  e("span", { className: "k", style: { minWidth: "90px" } }, r[0]),
1547
1559
  e("span", { className: "v" }, r[1])))),
1548
1560
  e("div", { className: "cost-hint", style: { marginTop: "6px" } },
1549
- "峰时段(北京时间):" + (snap ? snap.peakWindows : "周一至周五 9:00-12:00 · 14:00-18:00(周末全天闲时)") +
1550
- "。当前:" + (snap && snap.phase ? (snap.phase.weekend ? "周末全谷价" : snap.phase.inPeak ? "高峰时段" : "平价时段") : "…")),
1561
+ "峰时段(北京时间):" + (snap ? snap.peakWindows : "周一至周五 9:00-12:00 · 14:00-18:00(周末与法定节假日全天闲时)") +
1562
+ "。当前:" + (snap && snap.phase ? (offAllDay(snap.phase) ? offPhaseLabel(snap.phase) : snap.phase.inPeak ? "高峰时段" : "平价时段") : "…")),
1551
1563
  noticeOn ? e("div", { style: { marginTop: "8px" } }, e(PeakStrip, { snap, style: cfg.peakStyle || "compact", wide: true, now, ringSize: 150 }))
1552
1564
  : e("p", { className: "cost-hint", style: { marginTop: "8px" } }, "提示已隐藏:需启用峰谷计价并开启「峰时高价时段显著提示」。"),
1553
1565
  e(SyncReadonlyCard, { sync: props.sync }));
@@ -1728,6 +1740,7 @@ window.__ModuleLoader__.load({
1728
1740
  alert: { enabled: v.peakAlertEnabled, ahead: v.peakAlertAhead, target: v.peakAlertTarget, position: v.peakAlertPosition, webNotify: v.peakAlertWebNotify },
1729
1741
  }));
1730
1742
  say("peak", "已保存");
1743
+ loadPeak();
1731
1744
  } else say("peak", "保存失败");
1732
1745
  }).catch(err => { setBusy(""); say("peak", "保存失败:" + String(err && err.message ? err.message : err)); });
1733
1746
  }
@@ -1911,11 +1924,18 @@ window.__ModuleLoader__.load({
1911
1924
 
1912
1925
  // ---------- ② 峰谷计价与提示 ----------
1913
1926
  const pd = peakDraft || {};
1927
+ // 法定节假日(官方把节假日全天计入闲时):回显当前生效来源与条数
1928
+ const hol = (peakSnap && peakSnap.holidays) || null;
1929
+ const holHint = !hol ? "法定节假日:…"
1930
+ : hol.disabled ? "法定节假日:已停用(只按周末判定高峰)"
1931
+ : "法定节假日:" + hol.count + " 天" + (hol.builtin ? "(内置表)" : "(自定义)")
1932
+ + (hol.count ? " · 例:" + hol.dates.slice(0, 3).join(" ") + (hol.count > 3 ? " …" : "") : "")
1933
+ + (hol.invalid && hol.invalid.length ? " · 已忽略无法识别:" + hol.invalid.join(" ") : "");
1914
1934
  // 预览用快照:把草稿覆盖到服务端快照上,从而「改完即可预览、点保存才落盘」
1915
1935
  const peakPreviewSnap = peakSnap ? Object.assign({}, peakSnap, { config: pd }) : null;
1916
1936
  const noticeOn = peakSnap && peakSnap.notice !== false && pd.peakNotice !== false;
1917
1937
  const peakBody = e("div", null,
1918
- e("div", { className: "cost-hint" }, "官方只有两档:高峰(工作日 9:00-12:00 / 14:00-18:00)与闲时(高峰 × 0.5,含周末全天)。此处只影响界面提示与档位判定:改价请用「计价与价格目录 → 官方价格同步」。"),
1938
+ e("div", { className: "cost-hint" }, "官方只有两档:高峰(工作日 9:00-12:00 / 14:00-18:00,不含法定节假日)与闲时(高峰 × 0.5,含周末与法定节假日全天)。此处只影响界面提示与档位判定:改价请用「计价与价格目录 → 官方价格同步」。"),
1919
1939
  e("div", { style: { marginTop: "8px", display: "grid", gap: "6px" } },
1920
1940
  e("label", { className: "cost-row", style: { gap: "8px" } },
1921
1941
  e("input", { type: "checkbox", checked: pd.peakEnabled !== false, onChange: ev => setPeak("peakEnabled", ev.target.checked) }),
@@ -1923,6 +1943,19 @@ window.__ModuleLoader__.load({
1923
1943
  e("label", { className: "cost-row", style: { gap: "8px" } },
1924
1944
  e("input", { type: "checkbox", checked: pd.peakNotice !== false, onChange: ev => setPeak("peakNotice", ev.target.checked) }),
1925
1945
  e("span", null, "峰时高价时段显著提示(时段条显示)")),
1946
+ e("div", { className: "cost-row", style: { gap: "8px", flexWrap: "wrap" } },
1947
+ e("span", null, "法定节假日(全天闲时)"),
1948
+ e("input", {
1949
+ className: "cost-input",
1950
+ style: { flex: "1 1 280px", minWidth: "220px" },
1951
+ type: "text",
1952
+ placeholder: "留空 = 内置表;填 none = 停用;或写 2027-01-01 2027-02-05 …",
1953
+ value: pd.peakHolidays == null ? "" : String(pd.peakHolidays),
1954
+ onChange: ev => setPeak("peakHolidays", ev.target.value),
1955
+ }),
1956
+ e("button", { className: "cost-btn", onClick: () => setPeak("peakHolidays", "") }, "恢复内置"),
1957
+ e("button", { className: "cost-btn", onClick: () => setPeak("peakHolidays", "none") }, "停用")),
1958
+ e("div", { className: "cost-hint" }, holHint + "(官方口径:周一至周五不含法定节假日才算高峰;调休补班的周末不计高峰)"),
1926
1959
  e("div", { className: "cost-row", style: { gap: "8px" } },
1927
1960
  e("span", null, "时段条样式"),
1928
1961
  e("select", { className: "cost-select", value: pd.peakStyle === "classic" ? "classic" : "compact", onChange: ev => setPeak("peakStyle", ev.target.value) },
@@ -1966,8 +1999,8 @@ window.__ModuleLoader__.load({
1966
1999
  e("button", { className: "cost-btn cost-btn-primary", onClick: savePeak, disabled: busy === "peak" }, "保存"),
1967
2000
  msg.peak ? e("span", { className: "cost-hint" }, msg.peak) : null),
1968
2001
  e("div", { className: "cost-hint", style: { marginTop: "6px" } },
1969
- "峰时段(北京时间):" + (peakSnap ? peakSnap.peakWindows : "周一至周五 9:00-12:00 · 14:00-18:00(周末全天闲时)") +
1970
- "。当前:" + (peakPreviewSnap && peakPreviewSnap.phase ? (peakPreviewSnap.phase.weekend ? "周末全谷价" : peakPreviewSnap.phase.inPeak ? "高峰时段" : "平价时段") : "…")),
2002
+ "峰时段(北京时间):" + (peakSnap ? peakSnap.peakWindows : "周一至周五 9:00-12:00 · 14:00-18:00(周末与法定节假日全天闲时)") +
2003
+ "。当前:" + (peakPreviewSnap && peakPreviewSnap.phase ? (offAllDay(peakPreviewSnap.phase) ? offPhaseLabel(peakPreviewSnap.phase) : peakPreviewSnap.phase.inPeak ? "高峰时段" : "平价时段") : "…")),
1971
2004
  noticeOn ? e("div", { style: { marginTop: "8px" } }, e(PeakStrip, { snap: peakPreviewSnap, style: pd.peakStyle || "compact", wide: true, now, ringSize: 150 }))
1972
2005
  : e("p", { className: "cost-hint", style: { marginTop: "8px" } }, "提示已隐藏:需启用峰谷计价并开启「峰时高价时段显著提示」。")));
1973
2006
 
@@ -2164,7 +2197,7 @@ window.__ModuleLoader__.load({
2164
2197
  topStrip,
2165
2198
  !st ? e("div", { className: "cost-hint", style: { margin: "4px 0 8px" } }, "加载状态…") : null,
2166
2199
  cfgSection(Object.assign({ key: "s1" }, secProps("cloud", "多机汇总(云端同步)", st && st.enabled ? ("已开启 · " + (st.deviceName || "未命名设备")) : "未开启")), cloudBody),
2167
- cfgSection(Object.assign({ key: "s2" }, secProps("peak", "峰谷计价与提示", (pd.peakEnabled !== false ? "已启用" : "已停用") + " · " + (pd.peakStyle === "classic" ? "环形表盘" : "简洁样式"))), peakBody),
2200
+ cfgSection(Object.assign({ key: "s2" }, secProps("peak", "峰谷计价与提示", (pd.peakEnabled !== false ? "已启用" : "已停用") + " · " + (pd.peakStyle === "classic" ? "环形表盘" : "简洁样式") + (hol ? (hol.disabled ? " · 节假日停用" : " · 节假日 " + hol.count + " 天") : ""))), peakBody),
2168
2201
  cfgSection(Object.assign({ key: "s3" }, secProps("sub", "订阅套餐与配额", (volcHasSecret ? "火山凭据已配" : "火山凭据未配") + " · 归类覆盖 " + bill.planRows.length + " 条")), subBody),
2169
2202
  cfgSection(Object.assign({ key: "s4" }, secProps("bill", "计价与价格目录", (bill.showTotalWithPlan ? "含 Plan 总额" : "仅按量") + " · 覆盖价 " + bill.priceRows.length + " 条 · " + (cat ? (cat.providers || []).length + " 家目录" : "无目录"))), billBody),
2170
2203
  cfgSection(Object.assign({ key: "s5" }, secProps("imp", "历史导入", (impDraft.autoImport !== false ? "开机自动" : "手动") + " · 已导入 " + fmtInt((imp && imp.totalImported) || 0) + " 条")), impBody),
@@ -2576,7 +2609,7 @@ window.__ModuleLoader__.load({
2576
2609
 
2577
2610
  return e("div", { className: "cost-wrap" },
2578
2611
  e("div", { className: "cost-h1" }, pluginIcon(18), "花费统计"),
2579
- filterRow(days, setDays, onExport, onRefresh, msg, busy, dash ? dash.peakWindows : "周一至周五 9:00-12:00 · 14:00-18:00(周末全天闲时)", viewCtl, openVolc, planTotal, setPlanTotal),
2612
+ filterRow(days, setDays, onExport, onRefresh, msg, busy, dash ? dash.peakWindows : "周一至周五 9:00-12:00 · 14:00-18:00(周末与法定节假日全天闲时)", viewCtl, openVolc, planTotal, setPlanTotal),
2580
2613
  !cloudAvailable
2581
2614
  ? e("div", { className: "cost-hint", style: { marginTop: "4px" } },
2582
2615
  "仅显示本机数据。在多台电脑/多个 Agent 之间汇总:到「设置 → 插件 → 插件配置 → 花费统计」填写云端服务地址与令牌。")
package/config.js CHANGED
@@ -18,6 +18,9 @@
18
18
  // peakAlertTarget 提醒类型:both(峰和谷)/ peak(进入峰时)/ offpeak(进入谷时)
19
19
  // peakAlertPosition 弹窗位置:corner(右下角)/ center(屏幕中心)
20
20
  // peakAlertWebNotify 同步发送浏览器系统通知
21
+ // peakHolidays 中国法定节假日列表(官方把节假日全天计入空闲时段)。
22
+ // 空串 = 用内置表;'none'/'off' = 停用(只按周末判定);
23
+ // 也可写 "2027-01-01 2027-02-05" 这类自定列表(逗号/空白分隔)。
21
24
  // peakEffectiveAt 峰谷计价生效时间(ISO 字符串,展示用)
22
25
  //
23
26
  // 字段(云端同步,v1.8.0):
@@ -94,6 +97,7 @@ export function defaultPeakConfig() {
94
97
  peakAlertTarget: 'both',
95
98
  peakAlertPosition: 'corner',
96
99
  peakAlertWebNotify: false,
100
+ peakHolidays: '',
97
101
  peakEffectiveAt: DEFAULT_PEAK_EFFECTIVE_AT,
98
102
  }
99
103
  }
@@ -191,6 +195,9 @@ export function normalizePeakConfig(raw) {
191
195
  peakAlertTarget: (raw.peakAlertTarget === 'peak' || raw.peakAlertTarget === 'offpeak') ? raw.peakAlertTarget : def.peakAlertTarget,
192
196
  peakAlertPosition: raw.peakAlertPosition === 'center' ? 'center' : 'corner',
193
197
  peakAlertWebNotify: bool(raw.peakAlertWebNotify, def.peakAlertWebNotify),
198
+ // 节假日列表按**原文**保存(由 pricing.setPeakHolidays 解释空串/哨兵/列表),
199
+ // 配置卡回显即所见即所得,不做静默改写。
200
+ peakHolidays: typeof raw.peakHolidays === 'string' ? raw.peakHolidays.trim() : def.peakHolidays,
194
201
  peakEffectiveAt: typeof raw.peakEffectiveAt === 'string' && raw.peakEffectiveAt.length > 0 ? raw.peakEffectiveAt : def.peakEffectiveAt,
195
202
  }
196
203
  return out
package/index.js CHANGED
@@ -10,7 +10,7 @@ import { readFileSync, writeFileSync, mkdirSync, renameSync, existsSync, realpat
10
10
  import { join, dirname } from 'node:path'
11
11
  import { homedir } from 'node:os'
12
12
  import { createStore, collectTotals, DETAIL_DAYS, MAX_AXIS_DAYS } from './store.js'
13
- import { PRICE_ERAS, V41_EFFECTIVE_AT, V41_PRO_ROUTE_AT, exactModelsAt, eraAt, SUBSCRIPTION_RATES, PROVIDER_RATES, GENERIC_RATES, PEAK_WINDOWS, PEAK_HOUR_WINDOWS, isPeak, peakPhaseAt, priceFor, computeCost, normalizeTokens, subscriptionPlanFor, volcenginePlanModels, VOLCENGINE_PLAN_PROVIDER_KEYS, VOLCENGINE_PLAN_RATES, setSyncedEras, getSyncedEras, setPriceOverrides, getPriceOverrides } from './pricing.js'
13
+ import { PRICE_ERAS, V41_EFFECTIVE_AT, exactModelsAt, eraAt, SUBSCRIPTION_RATES, PROVIDER_RATES, GENERIC_RATES, PEAK_WINDOWS, PEAK_HOUR_WINDOWS, isPeak, peakPhaseAt, priceFor, computeCost, normalizeTokens, subscriptionPlanFor, volcenginePlanModels, VOLCENGINE_PLAN_PROVIDER_KEYS, VOLCENGINE_PLAN_RATES, setSyncedEras, getSyncedEras, setPriceOverrides, getPriceOverrides, setPeakHolidays, getPeakHolidays } from './pricing.js'
14
14
  import {
15
15
  normalizePeakConfig, defaultPeakConfig, peakEffective,
16
16
  normalizeCloudConfig, defaultCloudConfig, normalizePluginConfig,
@@ -33,7 +33,7 @@ import { createCredSeam, migrateLegacySecrets, safeFetch, CRED_REFS, hostnameOf
33
33
  import { listSessionLogs, planAndBuildImports, loadManifest, IMPORT_SOURCE } from './import.js'
34
34
 
35
35
  /** 插件版本(写入上报信封,便于云端排查版本差异) */
36
- const PLUGIN_VERSION = '1.9.1'
36
+ const PLUGIN_VERSION = '1.9.2'
37
37
  setPluginVersion(PLUGIN_VERSION)
38
38
 
39
39
  /** 「设置 → 插件 → 插件配置」里的卡片字段(与 settings 命名空间一致)。
@@ -63,6 +63,7 @@ const SyncSchema = Schema.object({
63
63
  peakAlertTarget: Schema.string().default(undefined).description('提醒类型:both / peak / offpeak'),
64
64
  peakAlertPosition: Schema.string().default(undefined).description('弹窗位置:corner / center'),
65
65
  peakAlertWebNotify: Schema.boolean().default(undefined).description('同步发送浏览器系统通知'),
66
+ peakHolidays: Schema.string().default(undefined).description('中国法定节假日列表(空=内置表;none=停用;否则 "YYYY-MM-DD" 逗号/空白分隔)'),
66
67
  // 双轨计费 + 价格目录(v1.9.0)
67
68
  showTotalWithPlan: Schema.boolean().default(undefined).description('金额含 Plan 等值总额(关闭只算按量)'),
68
69
  priceMatch: Schema.string().default(undefined).description('目录匹配模式:fuzzy / exact'),
@@ -304,6 +305,8 @@ export default {
304
305
  } catch (e) {
305
306
  if (!configLoadWarned) { console.error('cost tracker config load failed, using defaults', e); configLoadWarned = true }
306
307
  }
308
+ // 峰谷口径依赖节假日表:配置载入后立刻注入定价层(否则首个调用会按内置表判定)
309
+ applyPeakRuntime()
307
310
  }
308
311
 
309
312
  function saveConfig() {
@@ -319,8 +322,18 @@ export default {
319
322
  }
320
323
  }
321
324
 
325
+ /**
326
+ * 把峰谷配置里的法定节假日列表注入定价层。
327
+ * 官方口径把「中国法定节假日」全天计入空闲时段,因此 isPeak / peakPhaseAt 必须
328
+ * 拿到用户配置——记账(recordUsage 判峰谷)、时段条相位、切换提醒共用同一份。
329
+ */
330
+ function applyPeakRuntime() {
331
+ setPeakHolidays(peakConfig.peakHolidays)
332
+ }
333
+
322
334
  function setPeakConfig(raw) {
323
335
  peakConfig = normalizePeakConfig(Object.assign({}, peakConfig, raw))
336
+ applyPeakRuntime()
324
337
  saveConfig()
325
338
  return peakConfig
326
339
  }
@@ -470,7 +483,7 @@ export default {
470
483
  applyGroup(() => cloudConfig, (p) => { cloudConfig = normalizeCloudConfig(Object.assign({}, cloudConfig, p)) }, cloudPatch)
471
484
  applyGroup(() => uiConfig, (p) => { uiConfig = normalizeUiConfig(Object.assign({}, uiConfig, p)) }, uiPatch)
472
485
  applyGroup(() => volcengineConfig, (p) => { volcengineConfig = normalizeVolcengineConfig(Object.assign({}, volcengineConfig, p)) }, volcPatch)
473
- applyGroup(() => peakConfig, (p) => { peakConfig = normalizePeakConfig(Object.assign({}, peakConfig, p)) }, peakPatch)
486
+ applyGroup(() => peakConfig, (p) => { peakConfig = normalizePeakConfig(Object.assign({}, peakConfig, p)); applyPeakRuntime() }, peakPatch)
474
487
  applyGroup(() => billingConfig, (p) => { billingConfig = normalizeBillingConfig(Object.assign({}, billingConfig, p)); applyPricingRuntime() }, billingPatch)
475
488
  applyGroup(() => importConfig, (p) => { importConfig = normalizeImportConfig(Object.assign({}, importConfig, p)) }, importPatch)
476
489
  applyGroup(() => priceSyncConfig, (p) => { priceSyncConfig = normalizePriceSyncConfig(Object.assign({}, priceSyncConfig, p)) }, priceSyncPatch)
@@ -528,6 +541,8 @@ export default {
528
541
  phase,
529
542
  peakWindows: PEAK_WINDOWS,
530
543
  peakHours: PEAK_HOUR_WINDOWS,
544
+ // 法定节假日(官方把节假日全天计入空闲时段):回显来源与条数,供配置卡展示
545
+ holidays: getPeakHolidays(peakConfig.peakHolidays),
531
546
  effectiveAt: peakConfig.peakEffectiveAt,
532
547
  // 前端显隐开关(只影响渲染;与峰谷计价本身无关,因此不参与 enabled/effective 判定)
533
548
  ui: Object.assign({}, uiConfig),
@@ -1099,7 +1114,8 @@ export default {
1099
1114
  // 全部价格时代(含生效时刻与路由规则),供工具/接口展示
1100
1115
  eras: PRICE_ERAS.map((e) => ({ id: e.id, label: e.label, since: e.since, models: e.models, routes: e.routes || {} })),
1101
1116
  v41EffectiveAt: V41_EFFECTIVE_AT,
1102
- v41ProRouteAt: V41_PRO_ROUTE_AT,
1117
+ // 法定节假日(影响峰谷判定;官方口径:节假日全天闲时)
1118
+ peakHolidays: getPeakHolidays(peakConfig.peakHolidays),
1103
1119
  subscription: SUBSCRIPTION_RATES,
1104
1120
  // 火山方舟 Coding Plan 订阅:套餐内模型清单(等效参考价,非真实扣费)
1105
1121
  volcenginePlan: {
@@ -2035,7 +2051,13 @@ export default {
2035
2051
  }
2036
2052
  lines.push('', '当前生效:' + v.eraLabel + '(era=' + v.era + ')')
2037
2053
  lines.push('模型名口径:官方现役名为 deepseek-flash(被路由的请求一律以此名入账);deepseek-v4.1-flash 等写法归一化后命中同一档。')
2038
- lines.push('V4-Pro 路由生效:' + when(v.v41ProRouteAt) + '(此前 deepseek-v4-pro 仍按 V4-Pro 自有牌价计费)。')
2054
+ lines.push('deepseek-v4-pro 维持 V4-Pro 自有牌价 9/27/0.30(官方 2026-09-14 撤销了「路由到 V4.1 Flash」的下线计划),不做路由。')
2055
+ if (v.peakHolidays) {
2056
+ lines.push('法定节假日(全天闲时):' + (v.peakHolidays.disabled
2057
+ ? '已停用(仅按周末判定)'
2058
+ : (v.peakHolidays.count || 0) + ' 天' + (v.peakHolidays.builtin ? '(内置表)' : '(自定义)')
2059
+ + (v.peakHolidays.invalid && v.peakHolidays.invalid.length ? ',忽略无法识别:' + v.peakHolidays.invalid.join(' ') : '')))
2060
+ }
2039
2061
  lines.push('视觉模型 deepseek-v4-flash-vision-exp:图片按官方规则换算 token(每张上限 384),以接口用量计费(已含在 inputTokens 内)。')
2040
2062
  lines.push('kimi-coding(订阅等效,估算):输入 6.5 / 缓存命中(含缓存写入)1.1 / 输出 27.0')
2041
2063
  lines.push('缓存写入(cache write)按缓存命中价计费,与官方规则一致。其他 provider 兜底为估算平价(openai 10/30/5,anthropic 15/75/1.5,gemini 2.5/10/0.625,未知 2/8/0.5);ollama/local 为 0。')
@@ -2117,7 +2139,7 @@ export default {
2117
2139
 
2118
2140
  ctx.tools.register({
2119
2141
  name: 'cost_peak',
2120
- description: '查询当前 DeepSeek 峰谷计价档位与下次切换倒计时(北京时间:高峰时段为周一至周五 9:00-12:00、14:00-18:00,其余为闲时,周末全天闲时)。',
2142
+ description: '查询当前 DeepSeek 峰谷计价档位与下次切换倒计时(北京时间:高峰时段为周一至周五 9:00-12:00、14:00-18:00,且不含中国法定节假日;其余时段含周末与法定节假日全天均为闲时)。',
2121
2143
  parameters: {
2122
2144
  type: 'object',
2123
2145
  properties: {},
@@ -2127,7 +2149,8 @@ export default {
2127
2149
  schema: { type: 'object', additionalProperties: true },
2128
2150
  render: (args, v) => {
2129
2151
  const p = v.phase
2130
- const phaseText = !p ? '未知' : p.weekend ? '周末全天闲时(全谷价)' : p.inPeak ? '高峰时段(按峰时价)' : '闲时时段(按谷时价)'
2152
+ const offLabel = p && p.allDayOff ? (p.holiday ? '法定节假日全天闲时(全谷价)' : '周末全天闲时(全谷价)') : ''
2153
+ const phaseText = !p ? '未知' : p.allDayOff ? offLabel : p.inPeak ? '高峰时段(按峰时价)' : '闲时时段(按谷时价)'
2131
2154
  const nextText = p ? new Date(p.nextAtMs + 28800000).toISOString().replace('T', ' ').slice(0, 16).replace(/-/g, '/') + ' 转' + (p.nextIntoPeak ? '峰' : '谷') : '未知'
2132
2155
  return [{ type: 'text', text: '峰谷计价:' + (v.enabled ? '已启用' : '已停用') + '(' + v.peakWindows + ')\n当前档位:' + phaseText + '\n下次切换:' + nextText + (v.effective ? '' : '(峰谷未生效,按平价计费)') }]
2133
2156
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angelyeye/dsh-cost-tracker",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "DeepSeek Harness (DSH) plugin: LLM token usage & cost tracking with a settings dashboard, agent tools, HTTP API, persistent storage, multi-device cloud sync, session-log history import, official price sync and a multi-vendor price catalog.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -33,7 +33,7 @@
33
33
  "./package.json": "./package.json"
34
34
  },
35
35
  "scripts": {
36
- "test": "node test/storage.test.js && node test/pricing.test.js && node test/volcengine-plan.test.js && node test/volcengine-host.test.js && node test/config.test.js && node test/recompute.test.js && node test/credstore.test.js && node test/vendor-catalog.test.js && node test/price-sync.test.js && node test/import.test.js && node test/client-registration.test.js && node test/ui-display.test.js && node test/client-render.test.js && node test/cloud-read.test.js && node --no-warnings test/cloud-view-e2e.test.js && node test/sync.test.js && node test/view.test.js"
36
+ "test": "node test/storage.test.js && node test/pricing.test.js && node test/peak-holidays.test.js && node test/volcengine-plan.test.js && node test/volcengine-host.test.js && node test/config.test.js && node test/recompute.test.js && node test/credstore.test.js && node test/vendor-catalog.test.js && node test/price-sync.test.js && node test/import.test.js && node test/client-registration.test.js && node test/ui-display.test.js && node test/client-render.test.js && node test/cloud-read.test.js && node --no-warnings test/cloud-view-e2e.test.js && node test/sync.test.js && node test/view.test.js"
37
37
  },
38
38
  "keywords": [
39
39
  "dsh-plugin",
package/pricing.js CHANGED
@@ -3,18 +3,26 @@
3
3
  //
4
4
  // 单价来源:DeepSeek 官方定价页
5
5
  // https://api-docs.deepseek.com/zh-cn/quick_start/pricing
6
- // - 高峰时段(北京时间周一至周五 9:00-12:00、14:00-18:00)为表内价格;
7
- // 空闲时段 = 高峰 × 0.5。周末(周六/周日)全天计入空闲时段(该窗口两版价通用)。
6
+ // - 高峰时段(北京时间周一至周五 9:00-12:00、14:00-18:00,**不含中国法定节假日**)
7
+ // 为表内价格;其余时段(含周末与法定节假日全天)= 高峰 × 0.5。
8
8
  // - **单价随时间调整**:故单价表按生效时刻分版(见 PRICE_ERAS),按记录时间戳选版。
9
9
  // · legacy :V4-Flash 3.0/9.0/0.10、V4-Pro 9.0/27.0/0.30
10
10
  // · v41 :V4.1 Flash 2.0/8.0/0.04(北京时间 2026-09-10 12:00 起生效)。
11
11
  // 官方现役模型名为 `deepseek-flash`;旧名 `deepseek-v4-flash` 与
12
12
  // `deepseek-v4-flash-vision-exp` 已下线但仍可调用,请求由 V4.1 Flash
13
13
  // 提供服务并按 Flash 价计费,故一并路由到 `deepseek-flash`。
14
- // · v41pro :同一档单价,**V4-Pro 路由在此才开始**:官方通告为「北京时间 2026-09-14
15
- // 12:00 之后,deepseek-v4-pro 的请求全部路由到 V4.1 Flash 并按 V4.1 Flash
16
- // 单价计费」(价格卡脚注 (2) 同口径)。9/10 12:00 ~ 9/14 12:00 之间的
17
- // V4-Pro 请求按 V4-Pro 自有牌价 9.0/27.0/0.30 计费,不可提前折算。
14
+ // **V4-Pro 维持自有牌价(9.0/27.0/0.30),不做任何路由**:
15
+ // 09-10 新闻稿确实预告过「9-14 12:00 之后 pro 请求全部路由到 V4.1 Flash
16
+ // 并按 Flash 单价计费」,v1.9.0/1.9.1 据此实现了 v41pro 时代;但官方
17
+ // **更新日志随后改为**「为响应广大用户的需求,我们决定在 2026 年 9 月 14 日
18
+ // 之后继续提供 DeepSeek V4 Pro 的 API 调用服务,计费方式保持不变」,
19
+ // 且现行价目页仍为 pro **单列价格**(9.0/27.0/0.30)与**独立并发 500**
20
+ // (flash 为 2500),脚注只把旧 flash 名与 `deepseek-v4.1-flash` 路由到
21
+ // flash。故 v1.9.2 起**取消 pro 的反向路由**:否则会按 Flash 价计 pro 调用
22
+ // (输入 2 vs 9、输出 8 vs 27),显著低估。
23
+ // - 法定节假日(isPeak / peakPhaseAt 的 offAllDay):官方口径把节假日全天计入空闲时段,
24
+ // 数据来自国务院办公厅节假日安排通知(见 CN_HOLIDAYS)。调休补班的周六/周日**不**计高峰
25
+ // —— 定价规则只看「周一至周五」,调休不改变这一点。
18
26
  // - deepseek-v4-flash-vision-exp 与 deepseek-v4-flash 在 legacy 时代单价一致。
19
27
  // - 模型名归一化后 `deepseek-v4.1-flash` 等同为 `deepseek-flash` 的等价写法,命中同一档。
20
28
  //
@@ -43,14 +51,6 @@
43
51
  /** V4.1 Flash 价格的生效时刻:北京时间 2026-09-10 12:00(UTC+8)= 2026-09-10T04:00:00Z */
44
52
  export const V41_EFFECTIVE_AT = Date.UTC(2026, 8, 10, 4, 0, 0)
45
53
 
46
- /**
47
- * V4-Pro 请求被路由到 V4.1 Flash 的生效时刻:北京时间 2026-09-14 12:00。
48
- * 官方表述:「北京时间 2026 年 9 月 14 日 12:00 之后,至未来 V4.1 Pro 上线之前,
49
- * 用户访问 deepseek-v4-pro 的请求将全部路由到 V4.1 Flash,并按 V4.1 Flash 单价计费」。
50
- * 注意它与 V41_EFFECTIVE_AT(9-10 12:00)不是同一时刻,提前折算会低估 V4-Pro 花费。
51
- */
52
- export const V41_PRO_ROUTE_AT = Date.UTC(2026, 8, 14, 4, 0, 0)
53
-
54
54
  /**
55
55
  * V4.1 Flash 档的规范(官方现役)模型名。
56
56
  * 官方文档:「模型名请使用 `deepseek-flash`」——被路由的请求一律以此名入账,
@@ -72,33 +72,17 @@ export const PRICE_ERAS = [
72
72
  },
73
73
  {
74
74
  id: 'v41',
75
- label: 'V4.1 Flash 价(2026-09-10 12:00 起;V4-Pro 此时仍按自有牌价)',
75
+ label: 'V4.1 Flash 价(2026-09-10 12:00 起;V4-Pro 维持自有牌价)',
76
76
  since: V41_EFFECTIVE_AT,
77
77
  models: {
78
78
  // 高峰价:输入(缓存命中)0.04 / 输入(缓存未命中)2 / 输出 8;空闲减半
79
79
  [V41_FLASH_MODEL]: { input: 2.0, output: 8.0, cacheRead: 0.04, cacheWrite: 0.04 },
80
- // V4-Pro 尚在「自有牌价」窗口(9-14 12:00 前不路由),故本时代仍需保留其单价,
81
- // 否则会落入 provider 兜底而被误标记为「估算」。
80
+ // V4-Pro 维持自有牌价:官方 9-14 撤销了下线计划(「继续提供服务,计费方式保持不变」),
81
+ // 现行价目页仍为其单列 9.0/27.0/0.30 与独立并发 500 —— 因此**不做路由**。
82
82
  'deepseek-v4-pro': { input: 9.0, output: 27.0, cacheRead: 0.30, cacheWrite: 0.30 },
83
83
  },
84
84
  // 旧 V4-Flash 系(含视觉版)已下线,请求由 V4.1 Flash 提供并按 Flash 价计费。
85
- // V4-Pro 此时尚未路由(官方路由时刻为 9-14 12:00,见下一个时代)。
86
- routes: {
87
- 'deepseek-v4-flash': V41_FLASH_MODEL,
88
- 'deepseek-v4-flash-vision-exp': V41_FLASH_MODEL,
89
- },
90
- proRouteSince: V41_PRO_ROUTE_AT,
91
- },
92
- {
93
- id: 'v41pro',
94
- label: 'V4.1 Flash 价 + V4-Pro 路由(2026-09-14 12:00 起)',
95
- since: V41_PRO_ROUTE_AT,
96
- models: {
97
- [V41_FLASH_MODEL]: { input: 2.0, output: 8.0, cacheRead: 0.04, cacheWrite: 0.04 },
98
- },
99
- // V4.1 Pro 上线前,V4-Pro 的请求全部路由到 V4.1 Flash 并按 V4.1 Flash 单价计费。
100
85
  routes: {
101
- 'deepseek-v4-pro': V41_FLASH_MODEL,
102
86
  'deepseek-v4-flash': V41_FLASH_MODEL,
103
87
  'deepseek-v4-flash-vision-exp': V41_FLASH_MODEL,
104
88
  },
@@ -403,8 +387,8 @@ export const PROVIDER_RATES = {
403
387
  /** 未知模型兜底单价(估算);缓存写入按缓存命中价计。 */
404
388
  export const GENERIC_RATES = { input: 2.0, output: 8.0, cacheRead: 0.5, cacheWrite: 0.5 }
405
389
 
406
- /** 高峰时段(北京时间,仅周一至周五),空闲时段 = 高峰 × 0.5;周末全天空闲 */
407
- export const PEAK_WINDOWS = '周一至周五 9:00-12:00 · 14:00-18:00(周末全天闲时)'
390
+ /** 高峰时段(北京时间,仅周一至周五且非法定节假日),空闲时段 = 高峰 × 0.5 */
391
+ export const PEAK_WINDOWS = '周一至周五 9:00-12:00 · 14:00-18:00(周末与法定节假日全天闲时)'
408
392
 
409
393
  /** 视觉模型名(DeepSeek DeepSeek-V4-Flash-Vision-Exp) */
410
394
  export const VISION_MODEL = 'deepseek-v4-flash-vision-exp'
@@ -412,11 +396,133 @@ export const VISION_MODEL = 'deepseek-v4-flash-vision-exp'
412
396
  /** 每张图片换算 token 的上限(官方规则) */
413
397
  export const VISION_IMAGE_MAX_TOKENS = 384
414
398
 
415
- /** 是否高峰时段(北京时间 UTC+8,仅周一至周五;周末全天空闲) */
399
+ // ------------------------------------------------------------
400
+ // 中国法定节假日(官方峰谷口径:节假日全天计入空闲时段)
401
+ //
402
+ // 官方价目页脚注:「北京时间周一至周五(**不含中国法定节假日**)9:00-12:00、
403
+ // 14:00-18:00 为高峰时段;其余时段,包括周末及中国法定节假日全天均为空闲时段。」
404
+ // 因此仅排除周末是不够的:节假日落在一周内时,峰段也必须按闲时计(否则会多计 1 倍)。
405
+ //
406
+ // 数据来源:国务院办公厅关于节假日安排的通知。
407
+ // · 2026 年:国办发明电〔2025〕7 号(2025-11-04 发布)
408
+ // https://www.gov.cn/zhengce/zhengceku/202511/content_7047091.htm
409
+ // 调休补班的周六/周日**不计高峰**:定价规则只看「周一至周五」,调休不改变这一点。
410
+ // 新一年度的安排通常在上一年 11 月公布,届时更新本表并随版本发布;也可在插件配置卡
411
+ // 用 `peakHolidays` 覆盖(见 setPeakHolidays)。
412
+ // ------------------------------------------------------------
413
+ export const CN_HOLIDAYS = [
414
+ // 2026 · 元旦 1/1-1/3
415
+ '2026-01-01', '2026-01-02', '2026-01-03',
416
+ // 2026 · 春节 2/15-2/23
417
+ '2026-02-15', '2026-02-16', '2026-02-17', '2026-02-18', '2026-02-19',
418
+ '2026-02-20', '2026-02-21', '2026-02-22', '2026-02-23',
419
+ // 2026 · 清明 4/4-4/6
420
+ '2026-04-04', '2026-04-05', '2026-04-06',
421
+ // 2026 · 劳动节 5/1-5/5
422
+ '2026-05-01', '2026-05-02', '2026-05-03', '2026-05-04', '2026-05-05',
423
+ // 2026 · 端午 6/19-6/21
424
+ '2026-06-19', '2026-06-20', '2026-06-21',
425
+ // 2026 · 中秋 9/25-9/27
426
+ '2026-09-25', '2026-09-26', '2026-09-27',
427
+ // 2026 · 国庆 10/1-10/7
428
+ '2026-10-01', '2026-10-02', '2026-10-03', '2026-10-04',
429
+ '2026-10-05', '2026-10-06', '2026-10-07',
430
+ ]
431
+
432
+ /** 把 'YYYY-MM-DD' / 'YYYY/M/D' 归一为 'YYYY-MM-DD';非法返回 '' */
433
+ function normHolidayKey(s) {
434
+ const m = /^(\d{4})[-/.](\d{1,2})[-/.](\d{1,2})$/.exec(String(s == null ? '' : s).trim())
435
+ if (!m) return ''
436
+ const mm = Number(m[2])
437
+ const dd = Number(m[3])
438
+ if (!(mm >= 1 && mm <= 12) || !(dd >= 1 && dd <= 31)) return ''
439
+ return m[1] + '-' + (mm < 10 ? '0' + mm : String(mm)) + '-' + (dd < 10 ? '0' + dd : String(dd))
440
+ }
441
+
442
+ /** 归一化节假日列表:接受数组或「逗号/分号/空白分隔」的整串,去重并升序 */
443
+ export function normalizeHolidayList(input) {
444
+ const out = []
445
+ if (Array.isArray(input)) {
446
+ for (const s of input) { const k = normHolidayKey(s); if (k) out.push(k) }
447
+ } else if (typeof input === 'string') {
448
+ for (const s of input.split(/[\s,,;;]+/)) { const k = normHolidayKey(s); if (k) out.push(k) }
449
+ }
450
+ return Array.from(new Set(out)).sort()
451
+ }
452
+
453
+ // null = 使用内置表 CN_HOLIDAYS;[] = 显式停用(不排除任何节假日);否则为用户覆盖列表
454
+ let PEAK_HOLIDAY_LIST = null
455
+ let PEAK_HOLIDAY_SET = null // Set<string>(null 时按需从 CN_HOLIDAYS 构建)
456
+
457
+ /**
458
+ * 覆盖法定节假日列表(插件配置卡的「峰谷计价与提示」)。语义防呆:
459
+ * · 传 null / undefined / '' → 恢复内置表(默认);config 里存空串即走这条;
460
+ * · 传 'none' / 'off' / '0' → 显式停用(不排除任何节假日,等价于按「仅周末」计);
461
+ * · 传数组或分隔字符串 → 用该列表**整体替换**内置表(不追加);
462
+ * · 传了内容但一条都解析不出 → 视为停用并记入 invalid,如实回显,
463
+ * 避免「以为关掉了节假日,其实还在用内置表」。
464
+ * @returns {{dates:string[], mode:'builtin'|'custom'|'disabled', builtin:boolean, disabled:boolean, count:number, invalid:string[]}}
465
+ */
466
+ export function setPeakHolidays(input) {
467
+ if (Array.isArray(input)) {
468
+ PEAK_HOLIDAY_LIST = normalizeHolidayList(input)
469
+ } else if (input === null || input === undefined) {
470
+ PEAK_HOLIDAY_LIST = null
471
+ } else {
472
+ const raw = String(input).trim()
473
+ if (raw === '') PEAK_HOLIDAY_LIST = null
474
+ else if (/^(none|off|0|无|关|关闭)$/i.test(raw)) PEAK_HOLIDAY_LIST = []
475
+ else PEAK_HOLIDAY_LIST = normalizeHolidayList(raw)
476
+ }
477
+ PEAK_HOLIDAY_SET = null
478
+ return getPeakHolidays(typeof input === 'string' ? input : undefined)
479
+ }
480
+
481
+ /**
482
+ * 当前生效的节假日列表(含来源标记,便于配置卡回显与双端比对)。
483
+ * @param {string} [rawInput] - 可选:原始配置字符串(用于统计被忽略的非法条目)
484
+ */
485
+ export function getPeakHolidays(rawInput) {
486
+ const list = PEAK_HOLIDAY_LIST === null ? CN_HOLIDAYS : PEAK_HOLIDAY_LIST
487
+ const invalid = []
488
+ if (typeof rawInput === 'string' && rawInput.trim() !== '' && !/^(none|off|0|无|关|关闭)$/i.test(rawInput.trim())) {
489
+ for (const tok of rawInput.split(/[\s,,;;]+/)) {
490
+ if (tok && !normHolidayKey(tok)) invalid.push(tok)
491
+ }
492
+ }
493
+ const mode = PEAK_HOLIDAY_LIST === null ? 'builtin' : (PEAK_HOLIDAY_LIST.length === 0 ? 'disabled' : 'custom')
494
+ return { dates: list.slice(), mode, builtin: mode === 'builtin', disabled: mode === 'disabled', count: list.length, invalid }
495
+ }
496
+
497
+ /** 某时刻所属的北京日历日('YYYY-MM-DD') */
498
+ export function holidayKeyAt(ts) {
499
+ const t = Number(ts)
500
+ if (!Number.isFinite(t)) return ''
501
+ const d = new Date(t + 28800000)
502
+ const p = (n) => (n < 10 ? '0' + n : String(n))
503
+ return d.getUTCFullYear() + '-' + p(d.getUTCMonth() + 1) + '-' + p(d.getUTCDate())
504
+ }
505
+
506
+ /** 北京日 index(D0,北京午夜为界)→ 'YYYY-MM-DD' */
507
+ function holidayKeyOfDayIndex(D) {
508
+ return holidayKeyAt(D * 86400000 - 28800000 + 43200000) // 该北京日正午,避免边界歧义
509
+ }
510
+
511
+ /** 某时刻是否落在(配置生效的)中国法定节假日 */
512
+ export function isCnHoliday(ts) {
513
+ const key = holidayKeyAt(ts)
514
+ if (!key) return false
515
+ const set = PEAK_HOLIDAY_SET || (PEAK_HOLIDAY_SET = new Set(PEAK_HOLIDAY_LIST === null ? CN_HOLIDAYS : PEAK_HOLIDAY_LIST))
516
+ return set.has(key)
517
+ }
518
+
519
+ /** 是否高峰时段(北京时间 UTC+8:周一至周五、非节假日、落在峰窗口内) */
416
520
  export function isPeak(ts) {
417
- const d = new Date(ts + 28800000)
521
+ const t = Number(ts)
522
+ const d = new Date(t + 28800000)
418
523
  const day = d.getUTCDay() // 0=周日 … 6=周六
419
524
  if (day === 0 || day === 6) return false // 周末不计高峰
525
+ if (isCnHoliday(t)) return false // 法定节假日全天闲时
420
526
  const h = d.getUTCHours()
421
527
  return (h >= 9 && h < 12) || (h >= 14 && h < 18)
422
528
  }
@@ -426,31 +532,42 @@ export const PEAK_HOUR_WINDOWS = [{ start: 9, end: 12 }, { start: 14, end: 18 }]
426
532
 
427
533
  /**
428
534
  * 某一时刻所处的峰谷相位与相邻切换点(供时段条 / 倒计时 / 切换前弹窗)。
429
- * 与 isPeak 同口径(北京时间 UTC+8),并处理「周末全天谷价」:
430
- * - 工作日:按峰窗口判定 inPeak,扫描前后 N 天收集切换点;
431
- * - 周末:inPeak=false 且 weekend=true,日内无切换点(价格恒为谷),
432
- * 下一个价格切换点为下周一 09:00(首个峰窗口起点)。
535
+ * 与 isPeak 同口径(北京时间 UTC+8),并处理「全天谷价日」:
536
+ * - 普通工作日:按峰窗口判定 inPeak,扫描前后 N 天收集切换点;
537
+ * - 周末 / 法定节假日:inPeak=false、allDayOff=true,日内无切换点(价格恒为谷),
538
+ * 下一个价格切换点为下一个「工作日且非节假日」的首个峰窗口起点;
539
+ * weekend / holiday 分别标记具体原因(节假日落在周末时 weekend 优先)。
433
540
  * @param {number} ts - epoch ms
434
- * @param {number} [spanDays=5] - 前后扫描天数(须覆盖最长周末间隔)
435
- * @returns {{inPeak:boolean, weekend:boolean, prevAtMs:number, nextAtMs:number,
436
- * nextIntoPeak:boolean}|null} prevAtMs/nextAtMs 为相邻切换点 epoch ms
541
+ * @param {number} [spanDays=5] - 前后扫描天数(须覆盖最长连休:春节 9 天,故内部下限取 12)
542
+ * @returns {{inPeak:boolean, weekend:boolean, holiday:boolean, allDayOff:boolean,
543
+ * prevAtMs:number, nextAtMs:number, nextIntoPeak:boolean}|null}
544
+ * prevAtMs/nextAtMs 为相邻切换点 epoch ms(全天谷价日的 prevAtMs = 本段连休起点)
437
545
  */
438
546
  export function peakPhaseAt(ts, spanDays) {
439
547
  if (!Number.isFinite(ts)) return null
440
- const SPAN = (Number.isFinite(spanDays) && spanDays >= 1) ? Math.floor(spanDays) : 5
548
+ // 连休最长可达 9 天(春节),默认扫描窗口必须比它大,否则会找不到下一切换点。
549
+ const SPAN = Math.max(12, (Number.isFinite(spanDays) && spanDays >= 1) ? Math.floor(spanDays) : 5)
441
550
  const DAY_MS = 86400000
442
551
  // 北京时间日 index 与星期(0=周日 … 6=周六;1970-01-01 为周四)。
443
552
  const D0 = Math.floor((ts + 28800000) / DAY_MS)
444
553
  const weekday = (D0 + 4) % 7
445
554
  const isWeekendNow = weekday === 6 || weekday === 0
555
+ const isHolidayNow = isCnHoliday(ts)
556
+ const allDayOffNow = isWeekendNow || isHolidayNow
446
557
  // 某北京时间日 D 的某时 h 对应的 epoch ms(北京 = UTC+8)。
447
558
  const atBeijing = (D, h) => D * DAY_MS - 28800000 + h * 3600000
448
- // 收集 ±SPAN 天内全部窗口边界切换点,剔除落在周末(无价格变化)的点。
559
+ // 某北京时间日 D 是否为「全天谷价日」:周末或法定节假日。
560
+ const dayOff = (D) => {
561
+ const wd = (D + 4) % 7
562
+ if (wd === 6 || wd === 0) return true
563
+ const set = PEAK_HOLIDAY_SET || (PEAK_HOLIDAY_SET = new Set(PEAK_HOLIDAY_LIST === null ? CN_HOLIDAYS : PEAK_HOLIDAY_LIST))
564
+ return set.has(holidayKeyOfDayIndex(D))
565
+ }
566
+ // 收集 ±SPAN 天内全部窗口边界切换点,剔除落在全天谷价日(无价格变化)的点。
449
567
  const points = []
450
568
  for (let off = -SPAN; off <= SPAN; off += 1) {
451
569
  const D = D0 + off
452
- const wd = (D + 4) % 7
453
- if (wd === 6 || wd === 0) continue // 周末日内无切换
570
+ if (dayOff(D)) continue // 周末 / 节假日日内无切换
454
571
  for (const w of PEAK_HOUR_WINDOWS) {
455
572
  points.push({ at: atBeijing(D, w.start), intoPeak: true })
456
573
  points.push({ at: atBeijing(D, w.end), intoPeak: false })
@@ -462,13 +579,24 @@ export function peakPhaseAt(ts, spanDays) {
462
579
  if (p.at <= ts && (prev === null || p.at > prev.at)) prev = p
463
580
  if (p.at > ts && (next === null || p.at < next.at)) next = p
464
581
  }
465
- if (isWeekendNow) {
466
- // 周末全谷价:当前谷,下一切换 = 下周一首个峰窗口起点;prev = 周六 00:00(北京)。
582
+ if (allDayOffNow) {
583
+ // 全天谷价:当前谷,下一切换 = 下一个非谷价日的首个峰窗口起点;
584
+ // prev = 本段连休起点(北京时间 00:00),便于「本段已持续多久」类展示。
467
585
  if (next === null) return null
468
- return { inPeak: false, weekend: true, prevAtMs: (D0 - weekday) * DAY_MS - 57600000, nextAtMs: next.at, nextIntoPeak: next.intoPeak }
586
+ let start = D0
587
+ for (let i = 0; i < SPAN && dayOff(start - 1); i += 1) start -= 1
588
+ return {
589
+ inPeak: false,
590
+ weekend: isWeekendNow,
591
+ holiday: isHolidayNow && !isWeekendNow,
592
+ allDayOff: true,
593
+ prevAtMs: start * DAY_MS - 28800000,
594
+ nextAtMs: next.at,
595
+ nextIntoPeak: next.intoPeak,
596
+ }
469
597
  }
470
598
  if (prev === null || next === null) return null
471
- return { inPeak: isPeak(ts), weekend: false, prevAtMs: prev.at, nextAtMs: next.at, nextIntoPeak: next.intoPeak }
599
+ return { inPeak: isPeak(ts), weekend: false, holiday: false, allDayOff: false, prevAtMs: prev.at, nextAtMs: next.at, nextIntoPeak: next.intoPeak }
472
600
  }
473
601
 
474
602
  /**