dsh-cost-meter 1.9.60 → 1.9.62

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.60-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.62-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>
@@ -19,6 +19,13 @@ Track costs and tokens by conversation, model and call. View account balances, s
19
19
  <br><sub>Project illustration</sub>
20
20
  </p>
21
21
 
22
+ <picture>
23
+ <source media="(prefers-color-scheme: dark)" srcset="docs/images/conversation-dark.png">
24
+ <img src="docs/images/conversation-light.png" alt="Full conversation view with costs, subscription quotas and account balance" width="1280">
25
+ </picture>
26
+
27
+ <p align="center"><sub>Full conversation view in light or dark mode to match your theme. Screenshots use example data.</sub></p>
28
+
22
29
  ## Installation
23
30
 
24
31
  Requires **Node.js ≥ 20, DSH 0.2.0 or later**, and pnpm available to DSH. See [host compatibility](docs/host-compatibility.md).
@@ -35,20 +42,20 @@ Restart `dsh web` after installation or updates. **Desktop** uses its bundled CL
35
42
  The PowerShell installer checks pnpm and Git and uses the `web` profile by default:
36
43
 
37
44
  ```powershell
38
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.60/install.ps1 | iex
45
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.62/install.ps1 | iex
39
46
  ```
40
47
 
41
48
  Install a pinned Git tag:
42
49
 
43
50
  ```sh
44
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.60
51
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.62
45
52
  ```
46
53
 
47
54
  See [installation and updates](docs/install.en.md) for uninstalling or installing without Git.
48
55
 
49
56
  </details>
50
57
 
51
- Current release **v1.9.60**: [release notes](docs/update-notes-1.9.60.md#english) · [troubleshooting](docs/install-troubleshooting.md)
58
+ Current release **v1.9.62**: [release notes](docs/update-notes-1.9.62.md#english) · [troubleshooting](docs/install-troubleshooting.md)
52
59
 
53
60
  ## Feature overview
54
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.60-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.62-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>
@@ -19,6 +19,13 @@
19
19
  <br><sub>项目宣传图</sub>
20
20
  </p>
21
21
 
22
+ <picture>
23
+ <source media="(prefers-color-scheme: dark)" srcset="docs/images/conversation-dark.png">
24
+ <img src="docs/images/conversation-light.png" alt="完整会话界面,包含会话费用、套餐额度与账户余额" width="1280">
25
+ </picture>
26
+
27
+ <p align="center"><sub>完整会话界面,随主题切换浅色与深色。截图使用示例数据。</sub></p>
28
+
22
29
  ## 安装
23
30
 
24
31
  需要 **Node.js ≥ 20、DSH 0.2.0 或更新版本**,以及 DSH 可用的 pnpm。[宿主兼容记录](docs/host-compatibility.md)
@@ -35,20 +42,20 @@ dsh plugin --profile web add dsh-cost-meter
35
42
  PowerShell 脚本自动检查 pnpm 和 Git,默认安装到 `web` Profile:
36
43
 
37
44
  ```powershell
38
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.60/install.ps1 | iex
45
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.62/install.ps1 | iex
39
46
  ```
40
47
 
41
48
  固定 Git tag 安装:
42
49
 
43
50
  ```sh
44
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.60
51
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.62
45
52
  ```
46
53
 
47
54
  更新、卸载及无 Git 的安装方法见[安装说明](docs/install.md)。
48
55
 
49
56
  </details>
50
57
 
51
- 当前版本 **v1.9.60**:[更新说明](docs/update-notes-1.9.60.md#中文) · [安装排障](docs/install-troubleshooting.md)
58
+ 当前版本 **v1.9.62**:[更新说明](docs/update-notes-1.9.62.md#中文) · [安装排障](docs/install-troubleshooting.md)
52
59
 
53
60
  ## 功能总览
54
61
 
@@ -19,22 +19,22 @@ On Node.js 20, use `npm install -g pnpm@10` instead. See [pnpm installation and
19
19
  dsh plugin --profile web add dsh-cost-meter
20
20
  ```
21
21
 
22
- **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.60`** — review the script before running):
22
+ **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.62`** — review the script before running):
23
23
 
24
24
  ```powershell
25
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.60/install.ps1 | iex
25
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.62/install.ps1 | iex
26
26
  ```
27
27
 
28
28
  **Or a plain command line** (the machine must already have pnpm and git; also pinned to the tag):
29
29
 
30
30
  ```sh
31
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.60
31
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.62
32
32
  ```
33
33
 
34
34
  Without git, use the GitHub tag archive:
35
35
 
36
36
  ```sh
37
- dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.60.tar.gz
37
+ dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.62.tar.gz
38
38
  ```
39
39
 
40
40
  After installing, **restart** `dsh web` (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
package/docs/install.md CHANGED
@@ -19,22 +19,22 @@ Node.js 20 请改用 `npm install -g pnpm@10`。版本要求见 [pnpm 官方安
19
19
  dsh plugin --profile web add dsh-cost-meter
20
20
  ```
21
21
 
22
- **PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.9.60`**,建议先下载审阅再运行):
22
+ **PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.9.62`**,建议先下载审阅再运行):
23
23
 
24
24
  ```powershell
25
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.60/install.ps1 | iex
25
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.62/install.ps1 | iex
26
26
  ```
27
27
 
28
28
  **或直接命令行**(机器上需已有 pnpm 与 git;同样固定到 tag):
29
29
 
30
30
  ```sh
31
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.60
31
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.62
32
32
  ```
33
33
 
34
34
  没有 git 时可用 GitHub tag 打包直链:
35
35
 
36
36
  ```sh
37
- dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.60.tar.gz
37
+ dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.62.tar.gz
38
38
  ```
39
39
 
40
40
  安装后**重启** `dsh web`(插件行、Typert 清单与客户端 bundle 均在启动时扫描):
@@ -17,24 +17,40 @@ OpenDesign uses shared subscription allowances and can fall back to its wallet;
17
17
 
18
18
  ### Quota queries
19
19
 
20
- The OpenDesign desktop app is not required. Version 1.9.45 accepts either a web **Cookie** or the existing **Control Key**. Inference API keys from the API Keys page cannot read account quota.
20
+ The OpenDesign desktop app is not required. The card has a **Get quota credential** button that runs the same device authorization the official `vela login` uses; the old Cookie / Control Key paths remain.
21
+
22
+ **One click (recommended)**
23
+
24
+ 1. Open **DSH Settings → Cost → Quotas → OpenDesign** and enable the card.
25
+ 2. Press **Get quota credential**. The plugin asks `amr-api` for a device authorization, opens the approval page in the browser and writes the 6-character code to the DSH host log (`[cost-meter] OpenDesign device authorization: …`).
26
+ 3. Approve the CLI sign-in in the browser. The plugin then polls until it receives the account's control key (`vela_ctrl_…`), stores it in the existing `OPENDESIGN_CONTROL_KEY` slot, reads the active workspace ID from `workspaces/current`, and refreshes the 5-hour and 7-day windows immediately.
27
+
28
+ The device authorization is public but not documented; it was verified against the official Cloud web client and the `vela` CLI on 2026-11-07. Only the control key is stored — the runtime key (`sk-amr_…`) belongs to model calls and cannot read quota. Repeated clicks start a single authorization; changing the quota settings or unloading the plugin while it runs discards the result.
29
+
30
+ **Manual fallback** (expired session, unavailable device authorization, or a different account)
21
31
 
22
32
  1. Sign in to the [OpenDesign Cloud dashboard](https://open-design.ai/cloud/dashboard).
23
33
  2. Open browser DevTools (**F12 → Network**), reload the dashboard, and select a `coding-plan-usage` or `wallet/balance` request to `amr-api.open-design.ai`. Under **Request Headers**, copy the full **Cookie** value (or the complete `Cookie: ...` line). Do not copy response `Set-Cookie` or run a script in the console.
24
34
  3. Open **DSH Settings → Cost → Quotas → OpenDesign**, edit **Cookie / Control Key**, paste and save. Leave workspace ID blank to read the website's current workspace, or copy the ID between `/workspaces/` and `/billing/` or `/wallet/` in that request URL.
25
- 4. Enable the card, select its display location and refresh. If the Cookie expires, sign in on the website and copy it again.
35
+ 4. Refresh. If the Cookie expires, sign in on the website and copy it again.
36
+
37
+ Inference API keys from the API Keys page cannot read account quota.
26
38
 
27
39
  Existing Control Keys still use the same editor and require an explicit workspace ID. The editor stores either credential in the existing DSH credential slot `OPENDESIGN_CONTROL_KEY` (named accounts use their own slots). Host environment aliases are checked in order: `OPENDESIGN_CONTROL_KEY`, `VELA_CONTROL_KEY`, `OPENDESIGN_COOKIE`. Clearing a saved credential does not remove environment values. The original editor mapping was reported and located by @unifilitence in [#317](https://github.com/Han-1413141/dsh-cost-meter/issues/317).
28
40
 
29
- Only these fixed official HTTPS GET endpoints are used:
41
+ Only these fixed official HTTPS endpoints are used:
30
42
 
31
43
  ```text
32
- https://amr-api.open-design.ai/api/v1/workspaces/current # Cookie, only if workspace ID is blank
44
+ POST https://amr-api.open-design.ai/api/v1/cli/device-authorizations # one-click setup, no credential
45
+ POST https://amr-api.open-design.ai/api/v1/cli/device-authorizations/{deviceId}/token # one-click setup, polls for approval
46
+ https://amr-api.open-design.ai/api/v1/workspaces/current # Cookie, or the Control Key after one-click setup
33
47
  https://amr-api.open-design.ai/api/v1/workspaces/{workspaceId}/billing/coding-plan-usage # Cookie
34
48
  https://amr-api.open-design.ai/api/v1/workspaces/{workspaceId}/billing/preflight # Control Key
35
49
  https://amr-api.open-design.ai/api/v1/workspaces/{workspaceId}/wallet/balance # same credential as quota, independent read
36
50
  ```
37
51
 
52
+ The device authorization routes were verified on 2026-11-07: the pair returns `deviceId` / `userCode` / `deviceSecret` / `activationUrl`, a bogus path answers `404` while an unknown device secret answers `401`, and the `vela` CLI shipped with the desktop app embeds the same paths. They are public but undocumented, so the manual Cookie path stays.
53
+
38
54
  The Cookie routes, `activeWorkspaceId` field and API origin were checked against the official Cloud dashboard assets on 2026-10-29: `cloud-root-CUrPHDgS.js` and `pricing-refund-policy-Bamt0E9e.js`. Tests use synthetic credentials and responses; no authenticated real-account query was performed.
39
55
 
40
56
  #### Endpoint permissions and 401 troubleshooting
@@ -70,24 +86,40 @@ OpenDesign 的 API 与客户端共用套餐,套餐用尽后可以继续扣钱
70
86
 
71
87
  ### 额度查询
72
88
 
73
- 不需要安装 OpenDesign 桌面版。1.9.45 起支持网页 **Cookie** 和原有 **Control Key** 两种查询方式。API Keys 页面生成的推理密钥不能查询账户额度。
89
+ 不需要安装 OpenDesign 桌面版。卡片上有**一键获取额度凭据**按钮,走的是官方 `vela login` 同一套设备码授权;原有 Cookie / Control Key 方式保留。
90
+
91
+ **一键获取(推荐)**
92
+
93
+ 1. 打开 **DSH 设置 → 费用 → 额度 → OpenDesign**,启用该卡片。
94
+ 2. 点击**一键获取额度凭据**。插件向 `amr-api` 申请设备码授权,在浏览器打开授权页,并把 6 位验证码写入 DSH 宿主日志(`[cost-meter] OpenDesign device authorization: …`)。
95
+ 3. 在浏览器里批准这次 CLI 登录。插件随后轮询拿到该账号的控制面密钥(`vela_ctrl_…`),写入 DSH 凭据库原有的 `OPENDESIGN_CONTROL_KEY` 槽位,从 `workspaces/current` 读取当前工作区 ID,并立刻刷新 5 小时与 7 天窗口。
96
+
97
+ 该设备码授权端点是公开但未文档化的契约,2026-11-07 已对照官方 Cloud 网页与 `vela` CLI 核实。只保存控制面密钥;运行时密钥(`sk-amr_…`)属于模型调用,不能查询额度。连续点击只发起一份授权;授权进行中修改额度设置或卸载插件会让结果作废。
98
+
99
+ **手工兜底**(Cookie 过期、设备码授权不可用或换账号时)
74
100
 
75
101
  1. 登录 [OpenDesign Cloud 网页](https://open-design.ai/cloud/dashboard)。
76
102
  2. 按 **F12 → 网络(Network)**,刷新网页,选择发往 `amr-api.open-design.ai` 的 `coding-plan-usage` 或 `wallet/balance` 请求。在**请求标头(Request Headers)**中复制 **Cookie** 的完整值,也可连同 `Cookie:` 一起复制。不要复制响应的 `Set-Cookie`,不需要在控制台执行脚本。
77
103
  3. 打开 **DSH 设置 → 费用 → 额度 → OpenDesign**,编辑 **Cookie / Control Key**,粘贴并保存。工作区 ID 留空时读取网页当前工作区;也可从刚才请求 URL 中复制 `/workspaces/` 后、`/billing/` 或 `/wallet/` 前的 ID。
78
- 4. 开启额度查询,选择显示位置并刷新。Cookie 失效后,重新登录网页并复制即可。
104
+ 4. 选择显示位置并刷新。Cookie 失效后,重新登录网页并复制即可。
105
+
106
+ API Keys 页面生成的推理密钥不能查询账户额度。
79
107
 
80
108
  原有 Control Key 继续使用同一个凭据编辑器,需明确填写工作区 ID。两种凭据都保存在 DSH 凭据库原有的 `OPENDESIGN_CONTROL_KEY` 槽位,命名账号各自隔离。宿主环境变量依次支持 `OPENDESIGN_CONTROL_KEY`、`VELA_CONTROL_KEY`、`OPENDESIGN_COOKIE`。清除已保存凭据不会移除环境变量。原有凭据映射问题由 @unifilitence 在 [#317](https://github.com/Han-1413141/dsh-cost-meter/issues/317) 报告并定位。
81
109
 
82
- 查询只访问以下固定官方 HTTPS GET 端点:
110
+ 查询只访问以下固定官方 HTTPS 端点:
83
111
 
84
112
  ```text
85
- https://amr-api.open-design.ai/api/v1/workspaces/current # Cookie,工作区 ID 留空时读取
113
+ POST https://amr-api.open-design.ai/api/v1/cli/device-authorizations # 一键获取,无需凭据
114
+ POST https://amr-api.open-design.ai/api/v1/cli/device-authorizations/{deviceId}/token # 一键获取,轮询批准结果
115
+ https://amr-api.open-design.ai/api/v1/workspaces/current # Cookie,或一键获取后的 Control Key
86
116
  https://amr-api.open-design.ai/api/v1/workspaces/{workspaceId}/billing/coding-plan-usage # Cookie 查询套餐窗口
87
117
  https://amr-api.open-design.ai/api/v1/workspaces/{workspaceId}/billing/preflight # Control Key 查询套餐窗口
88
118
  https://amr-api.open-design.ai/api/v1/workspaces/{workspaceId}/wallet/balance # 使用同一查询凭据,独立读取钱包
89
119
  ```
90
120
 
121
+ 设备码授权端点于 2026-11-07 核实:该对端点返回 `deviceId` / `userCode` / `deviceSecret` / `activationUrl`,伪造路径回 `404`、错误的 `deviceSecret` 回 `401`,桌面版自带的 `vela` CLI 内嵌同一组路径。它公开但未文档化,因此手工 Cookie 方式保留为兜底。
122
+
91
123
  2026-10-29 已核对官方网页资源 `cloud-root-CUrPHDgS.js` 与 `pricing-refund-policy-Bamt0E9e.js` 中的 Cookie 路径、`activeWorkspaceId` 字段和 API 地址。回归使用模拟凭据与响应,未进行真实账户的登录查询。
92
124
 
93
125
  #### 端点权限与 401 排查
@@ -0,0 +1,29 @@
1
+ # v1.9.61
2
+
3
+ ## 中文
4
+
5
+ - OpenDesign 额度卡新增“一键获取额度凭据”。在浏览器批准设备码授权后,插件保存控制面密钥、读取当前工作区并刷新额度。
6
+ - 授权绑定发起时的账号和工作区设置。等待期间切换账号、修改设置或卸载插件会取消旧结果。
7
+ - 同一凭据槽位的自动授权、手工保存和清除操作按顺序完成,后提交的手工操作优先。
8
+ - 修正 OpenDesign 取消提示,补充中英文、浅深色和窄屏交互验证。
9
+
10
+ 入口为 **费用 → 额度 → OpenDesign → 一键获取额度凭据**。授权页由 DSH 宿主打开,授权链接与验证码可在宿主日志查看。[配置说明](opendesign-billing.md)
11
+
12
+ 感谢 [@Lu2O3GaN](https://github.com/Lu2O3GaN) 在 [#485](https://github.com/Han-1413141/dsh-cost-meter/pull/485) 提供设备码授权流程、额度按钮、文档与初始回归测试。
13
+
14
+ ## English
15
+
16
+ - Add **Get quota credential** to the OpenDesign quota card. Approve device authorization in the browser to store the control key, read the current workspace and refresh quota.
17
+ - Bind authorization to the starting account and workspace settings. Account changes, settings changes and plugin disposal cancel stale results.
18
+ - Serialize authorization, manual save and clear operations for each credential slot. Later manual operations take effect after earlier writes.
19
+ - Correct cancellation messages and verify the bilingual button in light, dark and narrow layouts.
20
+
21
+ Open **Cost → Quotas → OpenDesign → Get quota credential**. The DSH host opens the approval page and logs its link and code. [Configuration](opendesign-billing.md)
22
+
23
+ ## 升级 / Upgrade
24
+
25
+ ```sh
26
+ dsh plugin --profile web add dsh-cost-meter@latest
27
+ ```
28
+
29
+ 更新后重启 `dsh web`。Desktop 用户参见 [安装与更新](install-troubleshooting.md#desktop-安装与更新)。
@@ -0,0 +1,21 @@
1
+ # v1.9.62
2
+
3
+ ## 中文
4
+
5
+ - 修复合并卡片模式下峰谷进度条过薄、高光被裁切的问题,实际侧栏与显示预览完整呈现进度条。
6
+ - 补充实际侧栏与设置预览的回归检查,覆盖浅色、深色和窄侧栏。
7
+
8
+ 感谢 [@ansel-open](https://github.com/ansel-open) 在 [#487](https://github.com/Han-1413141/dsh-cost-meter/issues/487) 报告问题,并提供复现步骤及侧栏、显示预览截图。
9
+
10
+ ## English
11
+
12
+ - Fix the thin peak-period track and clipped highlight in the merged sidebar card and its display preview.
13
+ - Cover the actual sidebar and settings preview in light, dark and narrow layouts.
14
+
15
+ ## 升级 / Upgrade
16
+
17
+ ```sh
18
+ dsh plugin --profile web add dsh-cost-meter@latest
19
+ ```
20
+
21
+ 更新后重启 `dsh web`。Desktop 用户参见 [安装与更新](install-troubleshooting.md#desktop-安装与更新)。