dsh-provider-usage 0.3.3 → 0.3.4

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
@@ -4,7 +4,7 @@
4
4
 
5
5
  <p align="center">
6
6
  <a href="https://www.npmjs.com/package/dsh-provider-usage"><img src="https://img.shields.io/npm/v/dsh-provider-usage.svg?cacheSeconds=300" alt="npm version"></a>
7
- <a href="./LICENSE"><img src="https://img.shields.io/npm/l/dsh-provider-usage.svg?cacheSeconds=300" alt="MIT license"></a>
7
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT license"></a>
8
8
  <img src="https://img.shields.io/badge/DeepSeek%20Harness-plugin-202724" alt="DeepSeek Harness plugin">
9
9
  </p>
10
10
 
@@ -68,16 +68,15 @@ Then restart `dsh web` and refresh the page. If the release you want was publish
68
68
 
69
69
  ## Configuration
70
70
 
71
- Defaults work out of the box: the plugin auto-detects every provider route of the active profile. A trusted profile can tune behavior in `~/.dsh/profiles/web/cordis.patch.yml`:
71
+ Defaults work out of the box: the plugin auto-detects every provider route of the active profile. A trusted profile can tune behavior in `~/.dsh/profiles/web/cordis.patch.yml` — **override the bundle's row by id** (the package's own bundle patch already inserts it; a second `insert` of the same id fails the boot with `duplicate loader entry id`):
72
72
 
73
73
  ```yaml
74
- - insert:
75
- - id: provider-usage
76
- name: dsh-provider-usage
77
- config:
78
- refreshSeconds: 60 # suggested panel refresh interval (5–86400)
79
- autoDetect: true # enumerate provider routes from the llm registry
80
- providers: [] # manual specs; an id matching a detected route overrides it
74
+ - id: provider-usage
75
+ name: dsh-provider-usage
76
+ config:
77
+ refreshSeconds: 60 # suggested panel refresh interval (5–86400)
78
+ autoDetect: true # enumerate provider routes from the llm registry
79
+ providers: [] # manual specs; an id matching a detected route overrides it
81
80
  ```
82
81
 
83
82
  | Field | Type | Default | Description |
package/README_ZH.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <p align="center">
6
6
  <a href="https://www.npmjs.com/package/dsh-provider-usage"><img src="https://img.shields.io/npm/v/dsh-provider-usage.svg?cacheSeconds=300" alt="npm version"></a>
7
- <a href="./LICENSE"><img src="https://img.shields.io/npm/l/dsh-provider-usage.svg?cacheSeconds=300" alt="MIT license"></a>
7
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT license"></a>
8
8
  <img src="https://img.shields.io/badge/DeepSeek%20Harness-plugin-202724" alt="DeepSeek Harness plugin">
9
9
  </p>
10
10
 
@@ -68,16 +68,15 @@ dsh plugin --profile web add dsh-provider-usage@latest
68
68
 
69
69
  ## 配置说明
70
70
 
71
- 默认开箱即用:自动探测当前 profile 的所有 provider 路由。也可以在 `~/.dsh/profiles/web/cordis.patch.yml` 中调整:
71
+ 默认开箱即用:自动探测当前 profile 的所有 provider 路由。也可以在 `~/.dsh/profiles/web/cordis.patch.yml` 中调整——**按 id 覆盖**包内 bundle 已挂载的行(包自带的 bundle patch 已经 insert 过该行,再 insert 一次相同 id 会导致启动报 `duplicate loader entry id`):
72
72
 
73
73
  ```yaml
74
- - insert:
75
- - id: provider-usage
76
- name: dsh-provider-usage
77
- config:
78
- refreshSeconds: 60 # 面板默认刷新周期(秒)
79
- autoDetect: true # 自动枚举 llm 注册表中的 provider
80
- providers: [] # 手动补充/覆盖 provider(id 相同则覆盖自动探测结果)
74
+ - id: provider-usage
75
+ name: dsh-provider-usage
76
+ config:
77
+ refreshSeconds: 60 # 面板默认刷新周期(秒)
78
+ autoDetect: true # 自动枚举 llm 注册表中的 provider
79
+ providers: [] # 手动补充/覆盖 provider(id 相同则覆盖自动探测结果)
81
80
  ```
82
81
 
83
82
  | 字段 | 类型 | 默认 | 说明 |
package/lib/index.js CHANGED
@@ -1,30 +1,13 @@
1
- import { createRequire } from "node:module";
2
1
  import z from "@deepseek-ai/schemastery";
3
2
  import { credentialRef } from "@deepseek-ai/dsh-credentials";
4
3
  import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
5
4
  import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
6
5
  import { Remote, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
7
6
  //#region src/index.ts
8
- /**
9
- * provider-usage — host half.
10
- *
11
- * A `ctx.usage` Typert Remote service that reports the account balance/quota
12
- * of every configured LLM provider route. Provider routes are auto-detected
13
- * from the live `llm` registry plus the composed settings sections, keys are
14
- * resolved per request through the credentials service (never cached), and
15
- * each provider kind has its own wire adapter:
16
- *
17
- * - `deepseek` → GET {baseURL}/user/balance (充值余额)
18
- * - `kimi-coding` → GET {baseURL}/v1/usages (订阅配额, weekly / 5h windows)
19
- * - `moonshot` → GET {baseURL}/users/me/balance (开放平台余额)
20
- *
21
- * The browser widget polls `usage/list` on its own configurable interval, so
22
- * this service stays stateless: every call fetches live values.
23
- * @module dsh-provider-usage
24
- */
25
7
  const name = "provider-usage";
26
- /** Own package version, read from the installed package.json (lib/index.js sits one level below the root). */
27
- const version = createRequire(import.meta.url)("../package.json").version;
8
+ /** Own package version, baked in by tsdown `define` at build time (the
9
+ fallback only fires if the sources are compiled some other way). */
10
+ const version = "0.3.4";
28
11
  const NS = settingsNamespace("provider-usage");
29
12
  const ProviderSpec = z.object({
30
13
  /** Route id this spec describes (manual specs may use any unique id). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-provider-usage",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "DeepSeek Harness plugin: live account balance/usage panel for every configured LLM provider (draggable floating-ball widget, configurable refresh interval)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",