dsh-balance-widget 0.5.2 → 0.5.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/README.en.md CHANGED
@@ -142,7 +142,7 @@ If you mainly use DeepSeek-V4-Pro, point the pricing model at it for a more accu
142
142
 
143
143
  ## Pricing
144
144
 
145
- Built-in DeepSeek official peak/off-peak pricing (CNY per 1M tokens), effective 2026-09-10. Peak windows are Beijing time 09:00–12:00 and 14:00–18:00; prices are double the off-peak rates:
145
+ Built-in DeepSeek official peak/off-peak pricing (CNY per 1M tokens), effective 2026-09-10. Peak windows are Beijing time **Mon–Fri** 09:00–12:00 and 14:00–18:00 (weekends are off-peak all day); prices are double the off-peak rates:
146
146
 
147
147
  | Model | Window | Cache hit (input) | Cache miss (input) | Output |
148
148
  | --- | --- | --- | --- | --- |
@@ -183,6 +183,10 @@ This section is for the DSH Store / plugin audit: dependencies, runtime permissi
183
183
 
184
184
  ## Changelog
185
185
 
186
+ ### v0.5.3 — weekends no longer mispriced as peak
187
+ - 🐛 **Fixed**: the peak/off-peak check looked only at the hour and ignored the weekday, so weekends were priced as peak (2×) during 09:00–12:00 and 14:00–18:00, up to doubling "today's cost". The official rule is **Mon–Fri** 09:00–12:00 and 14:00–18:00 (everything else, weekends included, is off-peak); Saturday and Sunday are now excluded first, using the Beijing-time weekday
188
+ - 📄 **Docs**: the pricing section and the peak/off-peak tooltips now state the Mon–Fri restriction
189
+
186
190
  ### v0.5.2 — DSH 0.1.5: new session format & new pricing page
187
191
  - 🐛 **Fixed**: DSH 0.1.5 writes session logs under a generation-tagged name (`session.v3.jsonl.zstd`), but the plugin only matched `session.jsonl.zstd`, so every session created after the upgrade was invisible — viewing one produced red error text in the popover, and today's cost was understated (measured ~36% low). Logs are now found by taking the highest generation per session directory; a migrated session's older file is a subset of the new one, so reading only the newest avoids double-counting the session
188
192
  - 🐛 **Fixed**: the official pricing page renamed the Flash column to `deepseek-flash` and cut its rates. The parser's model-id anchor landed on a page footnote, so the sync reported success while silently keeping the stale, higher rates — overstating costs by ~1.7x. The parser now anchors on the table's row labels and applies that column to every Flash-family name
package/README.md CHANGED
@@ -139,7 +139,7 @@ DSH 的插件配置统一放在这个文件里:
139
139
 
140
140
  ## 定价说明
141
141
 
142
- 内置 DeepSeek 官方 2026-09-10 峰谷定价(元 / 百万 tokens),高峰时段为北京时间 09:00–12:00、14:00–18:00,价格为空闲时段两倍:
142
+ 内置 DeepSeek 官方 2026-09-10 峰谷定价(元 / 百万 tokens),高峰时段为北京时间**周一至周五** 09:00–12:00、14:00–18:00(周末全天为空闲时段),价格为空闲时段两倍:
143
143
 
144
144
  | 模型 | 时段 | 缓存命中(输入) | 缓存未命中(输入) | 输出 |
145
145
  | --- | --- | --- | --- | --- |
@@ -180,6 +180,10 @@ DSH 的插件配置统一放在这个文件里:
180
180
 
181
181
  ## 版本历史
182
182
 
183
+ ### v0.5.3 — 修复周末被误判为峰时
184
+ - 🐛 **修复**:峰/谷判断只看小时、不看星期,导致周末 09:00–12:00、14:00–18:00 被误判为峰时并按 2× 计价,"今日花费"最多翻倍。官方规则为**周一至周五** 09:00–12:00、14:00–18:00(其余含周末全天为空闲时段),现按北京时间的星期先行排除周六/周日
185
+ - 📄 **文档**:定价说明与峰谷 tooltip 补上"周一至周五"限定
186
+
183
187
  ### v0.5.2 — 适配 DSH 0.1.5:新会话格式与新定价页
184
188
  - 🐛 **修复**:DSH 0.1.5 将会话日志改为代数命名 `session.v3.jsonl.zstd`,插件此前只认 `session.jsonl.zstd`,导致升级后新建的会话全部不可见——查看这类会话时弹层出现红色报错,今日成本也漏算(实测少约 36%)。现按「每个会话目录取最高代」发现日志;迁移会话保留的旧文件是新代的子集,因此只读最高代,避免整个会话被重复计算
185
189
  - 🐛 **修复**:官方定价页将 Flash 列改名为 `deepseek-flash` 并下调价格,插件按模型名定位价格块的锚点因此落到页面脚注,同步"成功"却静默沿用旧高价,成本被高估约 1.7 倍。现改为按价格表行标签锚定,并把该列价格套用到全部 Flash 系名称
package/lib/client.js CHANGED
@@ -476,8 +476,8 @@ window.__ModuleLoader__.load({
476
476
  "todayCostShort": "今日·全部",
477
477
  "peak.active": "峰时",
478
478
  "peak.offpeak": "谷时",
479
- "peak.tooltip.active": "当前为峰时(09:00-12:00、14:00-18:00,价格翻倍):输入 ¥{input}/M · 输出 ¥{output}/M",
480
- "peak.tooltip.offpeak": "当前为谷时(其余时段,半价):输入 ¥{input}/M · 输出 ¥{output}/M",
479
+ "peak.tooltip.active": "当前为峰时(周一至周五 09:00-12:00、14:00-18:00,价格翻倍):输入 ¥{input}/M · 输出 ¥{output}/M",
480
+ "peak.tooltip.offpeak": "当前为谷时(其余时段含周末全天,半价):输入 ¥{input}/M · 输出 ¥{output}/M",
481
481
  "sessionNote": "基于最近活跃会话:",
482
482
  "hint": "价格为估算值,实际以官方账单为准。",
483
483
  "topUp": "去充值",
@@ -507,8 +507,8 @@ window.__ModuleLoader__.load({
507
507
  "todayCostShort": "Today · all",
508
508
  "peak.active": "Peak",
509
509
  "peak.offpeak": "Off-peak",
510
- "peak.tooltip.active": "Peak hours now (09:00-12:00, 14:00-18:00, 2× price): input ¥{input}/M · output ¥{output}/M",
511
- "peak.tooltip.offpeak": "Off-peak hours now (rest of day, half price): input ¥{input}/M · output ¥{output}/M",
510
+ "peak.tooltip.active": "Peak hours now (Mon-Fri 09:00-12:00, 14:00-18:00, 2× price): input ¥{input}/M · output ¥{output}/M",
511
+ "peak.tooltip.offpeak": "Off-peak hours now (all other times incl. weekends, half price): input ¥{input}/M · output ¥{output}/M",
512
512
  "sessionNote": "Based on most recent session:",
513
513
  "hint": "Prices are estimates; actual billing from the provider is authoritative.",
514
514
  "topUp": "Top up",
package/lib/index.js CHANGED
@@ -264,11 +264,14 @@ const PRICING_ALIASES = {
264
264
  /**
265
265
  * Whether `date` falls inside a Beijing-time (UTC+8) peak window.
266
266
  * DeepSeek's peak pricing applies to Beijing time 09:00-12:00 and 14:00-18:00
267
- * regardless of the host's timezone, so the window is computed in UTC+8
268
- * explicitly instead of the machine's local time.
267
+ * on weekdays only (Mon-Fri); the whole weekend is off-peak. The window is
268
+ * computed in UTC+8 explicitly instead of the machine's local time, which also
269
+ * supplies the Beijing weekday.
269
270
  */
270
271
  function isPeak(date) {
271
272
  const beijing = new Date(date.getTime() + 8 * 60 * 60 * 1000);
273
+ const day = beijing.getUTCDay(); // 0 = Sunday, 6 = Saturday
274
+ if (day === 0 || day === 6) return false;
272
275
  const hour = beijing.getUTCHours();
273
276
  return (hour >= 9 && hour < 12) || (hour >= 14 && hour < 18);
274
277
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-balance-widget",
3
3
  "description": "Balance & cost widget for the dsh web GUI: a sidebar footer card shows the DeepSeek account balance and today's costs; clicking opens a popover with a five-tier cost breakdown (last prompt with session name / today-this-session / today-this-workspace / today-all-workspaces), peak/off-peak status tags, term explanations, and a one-click top-up link. Zero external dependencies — works on Node 24.",
4
- "version": "0.5.2",
4
+ "version": "0.5.3",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "files": [