dsh-usage-state 0.4.6 → 0.4.7

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/CHANGELOG.md CHANGED
@@ -6,6 +6,18 @@
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.4.7] - 2026-10-17
10
+
11
+ ### Fixed
12
+
13
+ - 每次读取/描述凭据时获取当前宿主服务,修复插件早于凭据服务启动时永久缓存“服务不可用”的问题;服务激活或重载后不再继续使用直接回退凭据。DSH 0.2.1-rc.1 的已保存凭据优先级和可写状态因此得到保留。
14
+
15
+ ### Compatibility
16
+
17
+ - 明确声明 DSH `^0.2.0-rc.2 || ^0.2.1-rc.1`,同步 dsh-settings peer;保留原开发锁定基线。新旧宿主的隔离 tarball 安装、启动、客户端设置装配及 RPC 均复验。
18
+ - CI 增加精确 0.2.1-rc.1 的真实 Typert host/browser 校验;测试 helper 显式选取 browser 条件,兼容上游新增的 Node/browser 双入口。
19
+ - 333 项本地测试通过,包括先失败后修复的服务延迟激活/替换回归;新旧平台各 18 项贡献/产物/宿主契约测试通过。真实账户与厂商接口不属于本次兼容性测试,余额使用本地 fixture。
20
+
9
21
  ## [0.4.6] - 2026-10-14
10
22
 
11
23
  ### Fixed
@@ -115,7 +127,8 @@
115
127
 
116
128
  0.4.5起建立版本tag/Release;更早发布没有保存这些引用。0.3.0至0.4.4的比较端点来自各npm版本的gitHead;0.2系列引用对应实现提交,不能替代当时没有保存的正式发布产物。早期日期沿用历史版本记录。今后版本应按发布流程建立稳定引用。
117
129
 
118
- [Unreleased]: https://github.com/takboo/dsh-usage-state/compare/v0.4.6...HEAD
130
+ [Unreleased]: https://github.com/takboo/dsh-usage-state/compare/v0.4.7...HEAD
131
+ [0.4.7]: https://github.com/takboo/dsh-usage-state/compare/v0.4.6...v0.4.7
119
132
  [0.4.6]: https://github.com/takboo/dsh-usage-state/compare/v0.4.5...v0.4.6
120
133
  [0.4.5]: https://github.com/takboo/dsh-usage-state/compare/3ad9a71e2f7e4b9a05c69bc529e396a364ae6aeb...v0.4.5
121
134
  [0.4.4]: https://github.com/takboo/dsh-usage-state/compare/885541638ffa4da05b39bd1864085ba6d9acc288...3ad9a71e2f7e4b9a05c69bc529e396a364ae6aeb
package/README.en.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![CI](https://github.com/takboo/dsh-usage-state/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/takboo/dsh-usage-state/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/dsh-usage-state)](https://www.npmjs.com/package/dsh-usage-state)
6
6
 
7
- > **Release status:** Current version **0.4.6** adds automatic Kimi Code provider usage detection, regional endpoints, and current/legacy quota responses. See the [GitHub Release](https://github.com/takboo/dsh-usage-state/releases/tag/v0.4.6) for the tarball and checksum and the [Changelog](CHANGELOG.md#046---2026-10-14) for details.
7
+ > **Release status:** Current version **0.4.7** verifies compatibility with DSH **0.2.1-rc.1** and fixes credential-service lookup across startup ordering. See the [GitHub Release](https://github.com/takboo/dsh-usage-state/releases/tag/v0.4.7) for the tarball and checksum and the [Changelog](CHANGELOG.md#047---2026-10-17) for details.
8
8
 
9
9
  Show the current model provider's **account balance** or **coding-plan quota** above the composer input in [DSH (DeepSeek Harness)](https://github.com/deepseek-ai/deepseek-harness). The line matches the input card's width and preserves the native statistics and context meter.
10
10
 
@@ -23,7 +23,7 @@ DeepSeek · ¥58.13
23
23
 
24
24
  ## Install
25
25
 
26
- Requires DSH matching `>=0.2.0-rc.2 <0.3.0-0`. The prebuilt plugin declares Node ≥20. Install into the `web` profile you actually use.
26
+ Requires DSH matching `^0.2.0-rc.2 || ^0.2.1-rc.1` (both candidates revalidated). The prebuilt plugin declares Node ≥20. Install into the `web` profile you actually use.
27
27
 
28
28
  Install from npm:
29
29
 
@@ -83,7 +83,7 @@ Provider settings and advanced controls:
83
83
 
84
84
  The host schedules refreshes 2 seconds after a turn ends and has a 5-minute fallback timer. The browser reads the RPC mirror every 30 seconds. Ordinary polling initializes a missing or changed account identity, otherwise it does not shorten idle queries to once a minute. Successful requests have a default 60-second minimum; explicit refresh can bypass it, and active retries after failure are not throttled by that successful-request interval. Editing the idle interval reschedules the timer.
85
85
 
86
- The plugin queries balances/quotas and reads the selected model and provider catalog. It writes no session logs and reports no readings to third parties. The host does not return stored key values to the browser; a key the user actively pastes is sent through DSH's credential service to the credential file in the selected home. Environment values take precedence and usually cannot be edited in settings.
86
+ The plugin queries balances/quotas and reads the selected model and provider catalog. It writes no session logs and reports no readings to third parties. The host does not return stored key values to the browser; a key the user actively pastes is sent through DSH's credential service to the credential file in the selected home. Credential precedence follows the host: DSH 0.2.1-rc.1 Web/Desktop prefers saved credentials, with environment values as fallback; 0.2.0-rc.2 prefers the environment. The settings page reflects the host’s actual write permissions.
87
87
 
88
88
  ## Known limitations
89
89
 
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![CI](https://github.com/takboo/dsh-usage-state/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/takboo/dsh-usage-state/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/dsh-usage-state)](https://www.npmjs.com/package/dsh-usage-state)
6
6
 
7
- > **发布状态**:当前版本 **0.4.6**,增加 Kimi Code provider 自动用量检测,兼容国内/国际端点和新旧套餐响应。安装包及校验文件见 [GitHub Release](https://github.com/takboo/dsh-usage-state/releases/tag/v0.4.6),详情见 [更新日志](CHANGELOG.md#046---2026-10-14)。
7
+ > **发布状态**:当前版本 **0.4.7**,已验证 DSH **0.2.1-rc.1** 兼容性,并修复启动顺序导致的凭据服务读取问题。安装包及校验文件见 [GitHub Release](https://github.com/takboo/dsh-usage-state/releases/tag/v0.4.7),详情见 [更新日志](CHANGELOG.md#047---2026-10-17)。
8
8
 
9
9
  在 [DSH(DeepSeek Harness)](https://github.com/deepseek-ai/deepseek-harness) 输入框上方显示当前模型供应商的**账户余额**或**套餐额度**。状态行与输入卡片同宽,保留原生统计行和上下文计量器。
10
10
 
@@ -23,7 +23,7 @@ DeepSeek · ¥58.13
23
23
 
24
24
  ## 安装
25
25
 
26
- 要求:DSH版本满足 `>=0.2.0-rc.2 <0.3.0-0`,运行预构建插件声明Node≥20,安装到正在使用的 `web` profile。
26
+ 要求:DSH版本满足 `^0.2.0-rc.2 || ^0.2.1-rc.1`(已复验这两个候选版本),运行预构建插件声明Node≥20,安装到正在使用的 `web` profile。
27
27
 
28
28
  从npm安装:
29
29
 
@@ -83,7 +83,7 @@ OpenCode Zen Go三个窗口,独立状态行位于输入框上方:
83
83
 
84
84
  宿主默认在回合结束2秒后调度刷新,并有5分钟兜底定时器;浏览器每30秒拉取RPC镜像。普通轮询仅在读数缺失或有效身份变化时初始化查询,不把idle查询改成每分钟一次。成功请求的默认最小间隔为60秒,显式刷新可绕过,失败的主动重试不受该成功间隔限制;修改空闲间隔会重调定时器。
85
85
 
86
- 插件查询余额/额度并读取当前模型及供应商目录,不写会话日志,也不向第三方上报这些读数。宿主不把已保存的密钥值返回浏览器;用户主动粘贴的草稿经DSH凭据服务写入所用home的凭据文件。环境变量值优先,通常不能在设置页修改。
86
+ 插件查询余额/额度并读取当前模型及供应商目录,不写会话日志,也不向第三方上报这些读数。宿主不把已保存的密钥值返回浏览器;用户主动粘贴的草稿经DSH凭据服务写入所用home的凭据文件。凭据优先级跟随宿主:DSH 0.2.1-rc.1 的 Web/桌面端优先使用已保存凭据,环境变量作为回退;0.2.0-rc.2 则优先使用环境变量。凭据权限以设置页实际返回为准。
87
87
 
88
88
  ## 已知限制
89
89
 
package/lib/index.js CHANGED
@@ -1803,22 +1803,23 @@ function readNamespace(ctx, namespace) {
1803
1803
  * refresh loop.
1804
1804
  */
1805
1805
  function createCredentialLookup(ctx, fallback = {}) {
1806
- const provider = ctx.get("credentials");
1807
1806
  const platform = {
1808
1807
  resolve: async (ref) => {
1809
- if (provider === void 0) return void 0;
1810
1808
  try {
1809
+ const provider = ctx.get("credentials");
1810
+ if (provider === void 0) return void 0;
1811
1811
  return await provider.resolve(ref);
1812
1812
  } catch {
1813
1813
  return;
1814
1814
  }
1815
1815
  },
1816
1816
  describe: async (ref) => {
1817
- if (provider === void 0) return {
1818
- configured: false,
1819
- writable: false
1820
- };
1821
1817
  try {
1818
+ const provider = ctx.get("credentials");
1819
+ if (provider === void 0) return {
1820
+ configured: false,
1821
+ writable: false
1822
+ };
1822
1823
  return await provider.describe(ref);
1823
1824
  } catch {
1824
1825
  return {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "dsh-usage-state",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "packageManager": "npm@11.19.1",
5
5
  "type": "module",
6
6
  "description": "DSH plugin: show account balance (API mode) or coding-plan quota (5h/7d/30d) for the model in use",
7
7
  "license": "MIT",
8
8
  "engines": {
9
9
  "node": ">=20",
10
- "dsh": ">=0.2.0-rc.2 <0.3.0-0"
10
+ "dsh": "^0.2.0-rc.2 || ^0.2.1-rc.1"
11
11
  },
12
12
  "scripts": {
13
13
  "test": "node --import ./tests/support/client-render-hook.mjs --test",
@@ -56,7 +56,7 @@
56
56
  "unrun": "^0.3.1"
57
57
  },
58
58
  "peerDependencies": {
59
- "@deepseek-ai/dsh-settings": "^0.2.0-rc.2",
59
+ "@deepseek-ai/dsh-settings": "^0.2.0-rc.2 || ^0.2.1-rc.1",
60
60
  "@deepseek-ai/schemastery": "^3.18.3"
61
61
  },
62
62
  "dependencies": {