dsh-cost-meter 1.9.79 → 1.9.81

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.81-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.81/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.81
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.81**: [release notes](docs/release-notes/v1.9.81.md) · [troubleshooting](docs/install-troubleshooting.md)
59
59
 
60
60
  ## Feature overview
61
61
 
@@ -70,6 +70,29 @@ See [features and screenshots](docs/features.en.md) for entry points and [model
70
70
 
71
71
  ## Screenshots & walkthrough
72
72
 
73
+ ### Sidebar layouts
74
+
75
+ Switch layouts under **Settings → Cost → Display → Sidebar → Sidebar layout**. Each screenshot uses the same example balance, quota and usage.
76
+
77
+ | Standard | Compact |
78
+ |:---:|:---:|
79
+ | [![Standard sidebar with stacked quota rows](docs/images/sidebar-standard-en.png)](docs/images/sidebar-standard-en.png) | [![Compact sidebar with two-column quota rows](docs/images/sidebar-compact-en.png)](docs/images/sidebar-compact-en.png) |
80
+
81
+ | Simple | Combined card |
82
+ |:---:|:---:|
83
+ | [![Simple sidebar with shorter rows](docs/images/sidebar-simple-en.png)](docs/images/sidebar-simple-en.png) | [![Combined sidebar card with usage, balance and pricing period](docs/images/sidebar-summary-en.png)](docs/images/sidebar-summary-en.png) |
84
+
85
+ <details>
86
+ <summary>Icons layout</summary>
87
+
88
+ Select an icon to open its details.
89
+
90
+ [![Sidebar with a combined balance and pricing period icon, plus quota and usage icons](docs/images/sidebar-icons-en.png)](docs/images/sidebar-icons-en.png)
91
+
92
+ </details>
93
+
94
+ ### Other views
95
+
73
96
  | Cost trends and model ranking | Conversation cost distribution |
74
97
  |---|---|
75
98
  | [![Cost trends](docs/images/statistics.png)](docs/images/statistics.png) | [![Conversation treemap](docs/images/treemap.png)](docs/images/treemap.png) |
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.81-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.81/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.81
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.81**:[更新说明](docs/release-notes/v1.9.81.md) · [安装排障](docs/install-troubleshooting.md)
59
59
 
60
60
  ## 功能总览
61
61
 
@@ -70,6 +70,29 @@ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.79
70
70
 
71
71
  ## 图文演示
72
72
 
73
+ ### 侧栏布局
74
+
75
+ 在 **设置 → 费用 → 显示 → 侧栏 → 侧栏布局** 中切换。各张截图使用同一组示例余额、套餐额度和用量。
76
+
77
+ | 标准 | 紧凑 |
78
+ |:---:|:---:|
79
+ | [![标准布局,套餐额度纵向排列](docs/images/sidebar-standard-zh.png)](docs/images/sidebar-standard-zh.png) | [![紧凑布局,套餐额度两列排列](docs/images/sidebar-compact-zh.png)](docs/images/sidebar-compact-zh.png) |
80
+
81
+ | 简洁 | 合并卡片 |
82
+ |:---:|:---:|
83
+ | [![简洁布局,以短行显示用量和额度](docs/images/sidebar-simple-zh.png)](docs/images/sidebar-simple-zh.png) | [![合并卡片布局,同一张卡片显示用量、余额和峰谷时段](docs/images/sidebar-summary-zh.png)](docs/images/sidebar-summary-zh.png) |
84
+
85
+ <details>
86
+ <summary>图标布局</summary>
87
+
88
+ 点击图标可展开对应明细。
89
+
90
+ [![侧栏图标布局,包含余额与峰谷图标、套餐额度图标和今日用量图标](docs/images/sidebar-icons-zh.png)](docs/images/sidebar-icons-zh.png)
91
+
92
+ </details>
93
+
94
+ ### 其他界面
95
+
73
96
  | 费用趋势与模型排行 | 单个会话费用分布 |
74
97
  |---|---|
75
98
  | [![费用趋势与模型排行](docs/images/statistics.png)](docs/images/statistics.png) | [![会话费用矩形图](docs/images/treemap.png)](docs/images/treemap.png) |
@@ -1,5 +1,9 @@
1
1
  # 界面截图 / UI screenshots
2
2
 
3
- 这些图片选自 2026-10-25 的项目配图库,由实际界面组件和示例数据生成。金额、账户余额、套餐百分比和会话内容用于展示功能。当前安装与功能说明以文档正文为准。
3
+ 会话和功能截图选自 2026-10-25 的项目配图库,由实际界面组件和示例数据生成。金额、账户余额、套餐百分比和会话内容用于展示功能。当前安装与功能说明以文档正文为准。
4
4
 
5
- The images come from the project's 2026-10-25 screenshot collection, rendered with application components and sample data. Amounts, balances, quota percentages and conversation content are examples.
5
+ The conversation and feature images come from the project's 2026-10-25 screenshot collection, rendered with application components and sample data. Amounts, balances, quota percentages and conversation content are examples.
6
+
7
+ `sidebar-*.png` 截取自 DeepSeek Harness Web 中运行的 dsh-cost-meter,使用同一组示例数据展示各侧栏布局。
8
+
9
+ The `sidebar-*.png` images show dsh-cost-meter running in DeepSeek Harness Web, with the same example data in each layout.
Binary file
Binary file
@@ -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** 使插件服务端代码生效,浏览器端刷新页面即可。
@@ -0,0 +1,13 @@
1
+ ## v1.9.81 更新
2
+
3
+ - **侧栏布局截图**。中英文仓库首页增加标准、紧凑、简洁、合并卡片与图标布局截图,使用同一组示例用量、余额和套餐额度。
4
+
5
+ ## 升级
6
+
7
+ 已安装用户在任意终端重跑一行即可(重跑即为更新):
8
+
9
+ ```powershell
10
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.81/install.ps1 | iex
11
+ ```
12
+
13
+ 升级后**重启 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)