dsh-cost-meter 1.9.79 → 1.9.80

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
@@ -3,7 +3,7 @@
3
3
  <p align="center">Cost tracking and subscription quotas for DeepSeek Harness</p>
4
4
 
5
5
  <p align="center">
6
- <a href="https://github.com/Han-1413141/dsh-cost-meter/releases/latest"><img src="https://img.shields.io/badge/version-1.9.79-4176E6?style=flat-square" alt="version"></a>
6
+ <a href="https://github.com/Han-1413141/dsh-cost-meter/releases/latest"><img src="https://img.shields.io/badge/version-1.9.80-4176E6?style=flat-square" alt="version"></a>
7
7
  <a href="https://www.npmjs.com/package/dsh-cost-meter"><img src="https://img.shields.io/npm/dm/dsh-cost-meter?label=downloads&style=flat-square&color=4176E6" alt="npm monthly downloads"></a>
8
8
  <a href="https://github.com/Han-1413141/dsh-cost-meter/stargazers"><img src="https://img.shields.io/github/stars/Han-1413141/dsh-cost-meter?label=stars&style=flat-square&color=D9A400" alt="GitHub stars"></a>
9
9
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT license"></a>
@@ -42,20 +42,20 @@ Restart `dsh web` after installation or updates. **Desktop** uses its bundled CL
42
42
  The PowerShell installer checks pnpm and Git and uses the `web` profile by default:
43
43
 
44
44
  ```powershell
45
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.79/install.ps1 | iex
45
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.80/install.ps1 | iex
46
46
  ```
47
47
 
48
48
  Install a pinned Git tag:
49
49
 
50
50
  ```sh
51
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.79
51
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.80
52
52
  ```
53
53
 
54
54
  See [installation and updates](docs/install.en.md) for uninstalling or installing without Git.
55
55
 
56
56
  </details>
57
57
 
58
- Current release **v1.9.79**: [release notes](docs/release-notes/v1.9.79.md) · [troubleshooting](docs/install-troubleshooting.md)
58
+ Current release **v1.9.80**: [release notes](docs/release-notes/v1.9.80.md) · [troubleshooting](docs/install-troubleshooting.md)
59
59
 
60
60
  ## Feature overview
61
61
 
package/README.zh-CN.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <p align="center">DeepSeek Harness 费用统计与订阅额度插件</p>
4
4
 
5
5
  <p align="center">
6
- <a href="https://github.com/Han-1413141/dsh-cost-meter/releases/latest"><img src="https://img.shields.io/badge/version-1.9.79-4176E6?style=flat-square" alt="version"></a>
6
+ <a href="https://github.com/Han-1413141/dsh-cost-meter/releases/latest"><img src="https://img.shields.io/badge/version-1.9.80-4176E6?style=flat-square" alt="version"></a>
7
7
  <a href="https://www.npmjs.com/package/dsh-cost-meter"><img src="https://img.shields.io/npm/dm/dsh-cost-meter?label=downloads&style=flat-square&color=4176E6" alt="npm monthly downloads"></a>
8
8
  <a href="https://github.com/Han-1413141/dsh-cost-meter/stargazers"><img src="https://img.shields.io/github/stars/Han-1413141/dsh-cost-meter?label=stars&style=flat-square&color=D9A400" alt="GitHub stars"></a>
9
9
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT license"></a>
@@ -42,20 +42,20 @@ dsh plugin --profile web add dsh-cost-meter
42
42
  PowerShell 脚本自动检查 pnpm 和 Git,默认安装到 `web` Profile:
43
43
 
44
44
  ```powershell
45
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.79/install.ps1 | iex
45
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.80/install.ps1 | iex
46
46
  ```
47
47
 
48
48
  固定 Git tag 安装:
49
49
 
50
50
  ```sh
51
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.79
51
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.80
52
52
  ```
53
53
 
54
54
  更新、卸载及无 Git 的安装方法见[安装说明](docs/install.md)。
55
55
 
56
56
  </details>
57
57
 
58
- 当前版本 **v1.9.79**:[更新说明](docs/release-notes/v1.9.79.md) · [安装排障](docs/install-troubleshooting.md)
58
+ 当前版本 **v1.9.80**:[更新说明](docs/release-notes/v1.9.80.md) · [安装排障](docs/install-troubleshooting.md)
59
59
 
60
60
  ## 功能总览
61
61
 
@@ -120,3 +120,7 @@ SHA-512 校验、静态契约检查和实际发布包回归通过:原生及代
120
120
  ### 2026-11-19:Codex Subscription 3.2.25
121
121
 
122
122
  [#539](https://github.com/Han-1413141/dsh-cost-meter/issues/539) 报告 `3.2.25` 发布。npm 发布包 SHA-512 与登记值一致,四个额度接口函数的指纹与 `3.2.24` 一致。使用发布包在 DSH `0.2.0-rc.2` 和 `0.2.2-alpha.3` 上验证了两种额度窗口、强制刷新、账号切换、授权失效恢复和宿主 RPC。回归使用本机测试数据,兼容基线和两个 CI 矩阵均已加入 `3.2.25`。
123
+
124
+ ### 2026-11-20:Codex Subscription 3.2.26 与 Connect 0.2.0-alpha.16
125
+
126
+ [#551](https://github.com/Han-1413141/dsh-cost-meter/issues/551) 与 [#552](https://github.com/Han-1413141/dsh-cost-meter/issues/552) 的 npm 发布包 SHA-512 校验通过。Subscription 移除了 `dsh-home-paths` 依赖。Connect 调整了宿主版本范围并移除了 `./invariant` 导出,其当前宿主声明不再包含 DSH `0.2.0-rc.2`。额度相关的函数指纹一致。Subscription 在两套宿主传输上通过额度解析、刷新和授权失效回归,Connect 通过发布包的额度解析及只读 HTTP 回归。测试使用本机数据。
@@ -0,0 +1,14 @@
1
+ ## v1.9.80 更新
2
+
3
+ - 修复阿里云通用券和百炼券因适用范围带括号说明而被漏算的问题。感谢 [@dustplume](https://github.com/dustplume) 在 [#553](https://github.com/Han-1413141/dsh-cost-meter/issues/553) 提供脱敏的券数据、定位过滤条件并建议处理括号说明。
4
+ - 验证 `dsh-codex-subscription` 3.2.26 与 `dsh-codex-connect` 0.2.0-alpha.16 的实际发布包,更新兼容基线与 CI。两项版本变化由 [github-actions[bot]](https://github.com/apps/github-actions) 在 [#551](https://github.com/Han-1413141/dsh-cost-meter/issues/551) 和 [#552](https://github.com/Han-1413141/dsh-cost-meter/issues/552) 报告。
5
+
6
+ ## 升级
7
+
8
+ 已安装用户在任意终端重跑一行即可(重跑即为更新):
9
+
10
+ ```powershell
11
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.80/install.ps1 | iex
12
+ ```
13
+
14
+ 升级后**重启 dsh web** 使插件服务端代码生效,浏览器端刷新页面即可。
@@ -180,6 +180,37 @@ function couponBalance(item) {
180
180
  return typeof value === 'string' && /^\d+(\.\d+)?$/.test(value.trim()) ? Number(value) : NaN
181
181
  }
182
182
 
183
+ const MODEL_STUDIO_SCOPE = /^(通用|general|(?:阿里云)?(?:大模型服务平台)?百炼|(?:alibaba cloud )?model studio|dashscope)$/i
184
+ const PAYG_SCOPE = /^(通用|不限|general|(?:阿里云)?按量付费(?:账单)?|(?:alibaba cloud )?pay-as-you-go(?: bills?)?)$/i
185
+ const MODEL_STUDIO_EXCLUSION = /(?:不含|不适用|不支持|排除|except|exclud\w*).*?(?:百炼|model studio|dashscope)|(?:百炼|model studio|dashscope).*?除外/i
186
+
187
+ // Parenthetical notes belong to an entry. Their internal separators do not
188
+ // introduce additional supported products or billing scenarios.
189
+ function couponScopeMatches(value, pattern) {
190
+ const description = value.replaceAll('(', '(').replaceAll(')', ')')
191
+ let start = 0
192
+ let depth = 0
193
+ let noteEnd = -1
194
+ for (let end = 0; end <= description.length; end++) {
195
+ const char = description[end]
196
+ if (char === '(') depth++
197
+ if (char === ')') {
198
+ depth--
199
+ if (depth === 0 && noteEnd === -1) noteEnd = end
200
+ }
201
+ if (depth !== 0 || (end < description.length && !/[,,、;;]/.test(char))) continue
202
+ const scope = description.slice(start, end).trim()
203
+ const noteAt = scope.indexOf('(')
204
+ if (noteAt === -1 && pattern.test(scope)) return true
205
+ if (noteAt !== -1 && noteEnd !== -1 && !description.slice(noteEnd + 1, end).trim()
206
+ && pattern.test(scope.slice(0, noteAt).trim())
207
+ && !MODEL_STUDIO_EXCLUSION.test(scope.slice(noteAt))) return true
208
+ start = end + 1
209
+ noteEnd = -1
210
+ }
211
+ return false
212
+ }
213
+
183
214
  /**
184
215
  * 汇总可用代金券。
185
216
  * @param {Array<object>} items 券明细
@@ -205,8 +236,8 @@ export function summarizeCashCoupons(items, nowMs = Date.now(), currency = 'CNY'
205
236
  incomplete = true
206
237
  continue
207
238
  }
208
- const supportedProduct = product.split(/[,,、;;]/).some(name => /^(通用|general|(?:阿里云)?(?:大模型服务平台)?百炼|(?:alibaba cloud )?model studio|dashscope)$/i.test(name.trim()))
209
- const supportedScenario = !scenario || scenario.split(/[,,、;;]/).some(name => /^(通用|不限|general|(?:阿里云)?按量付费(?:账单)?|(?:alibaba cloud )?pay-as-you-go(?: bills?)?)$/i.test(name.trim()))
239
+ const supportedProduct = couponScopeMatches(product, MODEL_STUDIO_SCOPE)
240
+ const supportedScenario = !scenario || couponScopeMatches(scenario, PAYG_SCOPE)
210
241
  if (couponCurrency !== currency || !supportedProduct || !supportedScenario) continue
211
242
  if (!(amount > 0)) continue
212
243
  const cents = Math.round(amount * 100)