dsh-cost-meter 1.9.25 → 1.9.26

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.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  **Session cost tracking plugin for the DeepSeek Harness web GUI (bilingual UI)**
8
8
 
9
- [![version](https://img.shields.io/badge/version-1.9.25-4176E6)](https://github.com/Han-1413141/dsh-cost-meter)
9
+ [![version](https://img.shields.io/badge/version-1.9.26-4176E6)](https://github.com/Han-1413141/dsh-cost-meter)
10
10
  [![npm](https://img.shields.io/npm/v/dsh-cost-meter?label=npm)](https://www.npmjs.com/package/dsh-cost-meter)
11
11
  [![dshfind](https://dshfind.com/api/badge/Han-1413141/dsh-cost-meter?metric=downloads&lang=en)](https://dshfind.com/zh/plugins/Han-1413141/dsh-cost-meter?ref=badge)
12
12
  [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
@@ -16,11 +16,11 @@
16
16
 
17
17
  </div>
18
18
 
19
- **v1.9.25** adds WorkBuddy account selection and observed credit statistics, fixes legacy settings saves, and keeps update notices above the conversation.
19
+ **v1.9.26** fixes reversed OpenDesign 5-hour and weekly quotas, keeping each percentage paired with its reset time.
20
20
 
21
21
  **Host floor: DSH 0.2.0** · Adaptation target: **0.2.1-rc.2** (npm `next`). Expand the compatibility notes below for exact declarations, host records and troubleshooting.
22
22
 
23
- Release notes: [v1.9.25](docs/update-notes-1.9.25.md#english). Fully restart DSH after updating.
23
+ Release notes: [v1.9.26](docs/update-notes-1.9.26.md#english). Fully restart DSH after updating.
24
24
 
25
25
  ![Promo art](docs/promo.en.png)
26
26
 
@@ -352,22 +352,22 @@ On Node.js 20, use `npm install -g pnpm@10` instead. See [pnpm installation and
352
352
  dsh plugin --profile web add dsh-cost-meter
353
353
  ```
354
354
 
355
- **PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.9.25`** — review the script before running):
355
+ **PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.9.26`** — review the script before running):
356
356
 
357
357
  ```powershell
358
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.25/install.ps1 | iex
358
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.26/install.ps1 | iex
359
359
  ```
360
360
 
361
361
  **Or a plain command line** (the machine must already have pnpm and git; also pinned to the tag):
362
362
 
363
363
  ```sh
364
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.25
364
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.26
365
365
  ```
366
366
 
367
367
  Without git, use the GitHub tag archive:
368
368
 
369
369
  ```sh
370
- dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.25.tar.gz
370
+ dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.26.tar.gz
371
371
  ```
372
372
 
373
373
  After installing, **restart** `dsh web` (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
@@ -432,7 +432,7 @@ Workarounds:
432
432
 
433
433
  ```yaml
434
434
  minimumReleaseAgeExclude:
435
- - dsh-cost-meter@1.9.25
435
+ - dsh-cost-meter@1.9.26
436
436
  ```
437
437
 
438
438
  3. For a one-off CLI operation, forward the pnpm flag: `dsh plugin --profile desktop remove dsh-cost-meter --config.minimum-release-age=0` (or add `--trust-lockfile` when only lockfile verification fails). Both flags were verified against pnpm 11.28.5 in a temporary profile.
package/README.zh-CN.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  **DeepSeek Harness 会话费用统计插件(界面中英双语)**
8
8
 
9
- [![version](https://img.shields.io/badge/version-1.9.25-4176E6)](https://github.com/Han-1413141/dsh-cost-meter)
9
+ [![version](https://img.shields.io/badge/version-1.9.26-4176E6)](https://github.com/Han-1413141/dsh-cost-meter)
10
10
  [![npm](https://img.shields.io/npm/v/dsh-cost-meter?label=npm)](https://www.npmjs.com/package/dsh-cost-meter)
11
11
  [![dshfind](https://dshfind.com/api/badge/Han-1413141/dsh-cost-meter?metric=downloads&lang=zh)](https://dshfind.com/zh/plugins/Han-1413141/dsh-cost-meter?ref=badge)
12
12
  [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
@@ -16,11 +16,11 @@
16
16
 
17
17
  </div>
18
18
 
19
- **v1.9.25** 新增 WorkBuddy 账号选择与积分变化统计,修复旧配置无法保存和引导弹窗被会话遮挡的问题。
19
+ **v1.9.26** 修复 OpenDesign 的 5h 与每周额度颠倒问题,额度百分比与各自重置时间保持对应。
20
20
 
21
21
  **宿主要求:DSH 0.2.0 起支持** · 适配目标 **0.2.1-rc.2**(npm `next`)。完整声明、历史记录与安装排障见下方展开项。
22
22
 
23
- 更新说明:[v1.9.25](docs/update-notes-1.9.25.md#中文)。更新后完全重启 DSH。
23
+ 更新说明:[v1.9.26](docs/update-notes-1.9.26.md#中文)。更新后完全重启 DSH。
24
24
 
25
25
  ![宣传图](docs/promo.png)
26
26
 
@@ -352,22 +352,22 @@ Node.js 20 请改用 `npm install -g pnpm@10`。版本要求见 [pnpm 官方安
352
352
  dsh plugin --profile web add dsh-cost-meter
353
353
  ```
354
354
 
355
- **PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.9.25`**,建议先下载审阅再运行):
355
+ **PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.9.26`**,建议先下载审阅再运行):
356
356
 
357
357
  ```powershell
358
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.25/install.ps1 | iex
358
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.26/install.ps1 | iex
359
359
  ```
360
360
 
361
361
  **或直接命令行**(机器上需已有 pnpm 与 git;同样固定到 tag):
362
362
 
363
363
  ```sh
364
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.25
364
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.26
365
365
  ```
366
366
 
367
367
  没有 git 时可用 GitHub tag 打包直链:
368
368
 
369
369
  ```sh
370
- dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.25.tar.gz
370
+ dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.26.tar.gz
371
371
  ```
372
372
 
373
373
  安装后**重启** `dsh web`(插件行、Typert 清单与客户端 bundle 均在启动时扫描):
@@ -432,7 +432,7 @@ DSH **0.2.1-rc.1 / 0.2.1-rc.2** 宿主自带 pnpm **11.28.5**,默认启用内
432
432
 
433
433
  ```yaml
434
434
  minimumReleaseAgeExclude:
435
- - dsh-cost-meter@1.9.25
435
+ - dsh-cost-meter@1.9.26
436
436
  ```
437
437
 
438
438
  3. 仅本次操作用 CLI 透传 pnpm 参数:`dsh plugin --profile desktop remove dsh-cost-meter --config.minimum-release-age=0`;若只是 lockfile 校验阶段失败,可改用 `--trust-lockfile`。这两个参数已在本机 pnpm 11.28.5 临时 Profile 上实测可用。
@@ -42,7 +42,7 @@ https://amr-api.open-design.ai/api/v1/workspaces/{workspaceId}/wallet/balance
42
42
 
43
43
  Quota and wallet responses must match the requested workspace. The wallet must identify its member; if the quota response provides a member identity, both must match. A preflight response that omits the redundant outer `workspaceId` is accepted only after the requested workspace has scoped the request; a body naming a different workspace is rejected. Credentials are never forwarded through a redirect and no cookie is attached. They use the existing DSH credential store and are excluded from the ledger and client snapshot.
44
44
 
45
- Each returned allowance window has its own used percentage and reset time. Simultaneous windows are not added together or called unlimited. Wallet credit remains a separate USD-equivalent value, including a real zero. Quota and wallet are fetched independently, so a failure on one side keeps the other side visible; an `eligible: false` / empty-window answer is reported as **no active subscription** instead of a credential failure. Invalid, unauthorized or missing responses never fabricate a zero allowance; when both sides fail, the card shows an error/unavailable state. The workspace setting is kept across restarts and invalidates the previous query when changed.
45
+ Each returned allowance window has its own used percentage and reset time. The API's `durationSeconds` identifies the window: `18000` (5 hours) maps to `fiveHour`, and `604800` (7 days) maps to `weekly`, regardless of response order or time remaining until reset. Simultaneous windows are not added together or called unlimited. Wallet credit remains a separate USD-equivalent value, including a real zero. Quota and wallet are fetched independently, so a failure on one side keeps the other side visible; an `eligible: false` / empty-window answer is reported as **no active subscription** instead of a credential failure. Invalid, unauthorized or missing responses never fabricate a zero allowance; when both sides fail, the card shows an error/unavailable state. The workspace setting is kept across restarts and invalidates the previous query when changed.
46
46
 
47
47
  ### Evidence and limits
48
48
 
@@ -0,0 +1,33 @@
1
+ # v1.9.26
2
+
3
+ ## 中文
4
+
5
+ ### OpenDesign 额度窗口
6
+
7
+ 修复 OpenDesign 的 5 小时与每周额度显示颠倒的问题。接口返回的窗口按 `durationSeconds` 识别:18,000 秒对应 5h,604,800 秒对应每周;使用比例和重置时间始终来自同一条记录,不依赖接口返回顺序。
8
+
9
+ 例如,原先显示为“每周剩余 91%,当晚重置”和“5h 剩余 94%,下周重置”的数据,更新后会正确显示为“5h 剩余 91%,当晚重置”和“每周剩余 94%,下周重置”。侧栏、设置页、输入区额度条及悬浮说明同步生效。
10
+
11
+ 补充了截图数据、中英文、已用/剩余方向、正反返回顺序和嵌套响应的回归测试,并验证 DSH 宿主的凭据查询流程。上游响应使用测试数据,未查询真实 OpenDesign 账号。
12
+
13
+ ### 更新
14
+
15
+ 在插件市场更新,或运行:
16
+
17
+ ```powershell
18
+ dsh plugin --profile web add dsh-cost-meter@1.9.26
19
+ ```
20
+
21
+ 更新后完全退出并重启 DSH,再点击 OpenDesign 卡片刷新额度。
22
+
23
+ ## English
24
+
25
+ ### OpenDesign quota windows
26
+
27
+ Fix reversed 5-hour and weekly OpenDesign quotas. Each API window is identified by `durationSeconds`: 18,000 seconds means 5 hours, and 604,800 seconds means one week. Its usage percentage and reset time stay together, regardless of response order.
28
+
29
+ For example, data previously shown as “weekly: 91% remaining, resets tonight” and “5h: 94% remaining, resets next week” now appears under the correct 5h and weekly labels. The correction applies to the sidebar, settings, composer quota strip and tooltips.
30
+
31
+ Regression tests cover the reported values, both response orders, nested responses, Chinese and English, and used/remaining display directions. DSH credential queries were exercised with synthetic upstream responses; no live OpenDesign account was queried.
32
+
33
+ Update through the plugin market or run the command above. Fully exit and restart DSH, then click the OpenDesign card to refresh its quota.
package/lib/opendesign.js CHANGED
@@ -80,8 +80,8 @@ export function parseOpenDesignUsage(value, workspaceId) {
80
80
  if (limit <= 0n || remaining > limit || remaining !== (used >= limit ? 0n : limit - used)) return null
81
81
  const resetsAt = row.resetsAt == null ? '' : typeof row.resetsAt === 'string' && Number.isFinite(Date.parse(row.resetsAt)) ? new Date(row.resetsAt).toISOString() : null
82
82
  if (resetsAt === null) return null
83
- // OpenDesign-only correction requested after the two displayed allowances were reversed.
84
- const duration = row.durationSeconds, base = duration === 18000 ? 'weekly' : duration === 604800 ? 'fiveHour' : 'window_' + duration + 's'
83
+ // Identify the window by its duration, keeping usage and reset time on that same row.
84
+ const duration = row.durationSeconds, base = duration === 5 * 60 * 60 ? 'fiveHour' : duration === 7 * 24 * 60 * 60 ? 'weekly' : 'window_' + duration + 's'
85
85
  const key = Object.hasOwn(windows, base) ? base + '_' + seen.size : base
86
86
  windows[key] = { percent: Number((used > limit ? limit : used) * 100000n / limit) / 1000, resetsAt }
87
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cost-meter",
3
- "version": "1.9.25",
3
+ "version": "1.9.26",
4
4
  "description": "DeepSeek Harness 会话费用统计插件:本会话成本、当日费用、历史记录与官方价格同步,支持多厂商多模型价格计费(内置 170+ 模型 ID 价格目录与自动匹配)、主流 Coding Plan 订阅额度查询与显示(14 家,含 WorkBuddy 官方积分、OpenDesign 工作区查询、含小米 MiMo Token Plan 控制台 Cookie 查询、SCNet Token Plan 本地 Credits 计量与火山方舟 Volcano Ark Coding Plan AK/SK 签名查询)、自定义 Provider 余额查询(可配任意 HTTP 端点)与余额进度条、峰谷计价时段显示与切换前弹窗/系统通知提醒(位置/提前量/类型可配),界面中英双语。Session cost tracking plugin for DeepSeek Harness: per-conversation cost, daily totals, history and official price sync, with multi-vendor model pricing (built-in 170+ model-ID catalog with auto-matching), Coding Plan quota queries & display for 14 vendors (incl. WorkBuddy official credits, OpenDesign workspace queries, Xiaomi MiMo Token Plan via console cookie, local credits metering for the SCNet Token Plan and Volcano Ark Coding Plan via AK/SK signature), plan/API dual-track billing with per-1% & full-window Token Plan usage estimates, custom provider balance lookup (configurable HTTP endpoint) and balance progress bar, plus peak/off-peak pricing display with pre-switch popup & system-notification alerts (position / lead time / type configurable), in a bilingual (Chinese/English) UI.",
5
5
  "type": "module",
6
6
  "main": "lib/bootstrap.js",
@@ -166,7 +166,8 @@
166
166
  "docs/update-notes-1.9.22.md",
167
167
  "docs/update-notes-1.9.23.md",
168
168
  "docs/update-notes-1.9.24.md",
169
- "docs/update-notes-1.9.25.md"
169
+ "docs/update-notes-1.9.25.md",
170
+ "docs/update-notes-1.9.26.md"
170
171
  ],
171
172
  "dependencies": {
172
173
  "acorn": "8.15.0",