dsh-usage-state 0.4.1 → 0.4.2
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.en.md +5 -4
- package/README.md +6 -5
- package/lib/client.js +18 -11
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# dsh-usage-state
|
|
2
2
|
|
|
3
|
-
See your **account balance** or **coding-plan quota** at a glance in [DSH (DeepSeek Harness)](https://github.com/deepseek-ai) —
|
|
3
|
+
See your **account balance** or **coding-plan quota** at a glance in [DSH (DeepSeek Harness)](https://github.com/deepseek-ai) — on its own line above the composer input, as wide as the input card.
|
|
4
4
|
|
|
5
5
|
> 中文说明见 [README.md](README.md)。
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
|
|
8
|
+
its own line above the composer input: z.ai / GLM · 5h 12% (4h0m) ▓▓▓░░░░░ · 7d 59% (3d17h) ▓▓▓▓▓░░░
|
|
9
9
|
DeepSeek · ¥58.13
|
|
10
10
|
hover any segment: Source DeepSeek · Mode API balance · Granted 0 · Topped up 58.13
|
|
11
11
|
```
|
|
@@ -14,7 +14,7 @@ hover any segment: Source DeepSeek · Mode API balance · Granted 0 ·
|
|
|
14
14
|
|
|
15
15
|
- **Works with zero configuration**: the plugin figures out which data source and mode a provider needs, and reuses the API key DSH already has.
|
|
16
16
|
- **Configured per provider, not per model** — readings are account-level, so each provider gets one setting: `Auto` / `API` / `Coding Plan` / `Hidden`. The model list is informational.
|
|
17
|
-
- **One line, always visible**:
|
|
17
|
+
- **One line, always visible**: its own line above the composer input (DSH 0.2 mounts it at `conversation.input.dock`, width-matched to the input card; the native stats row and context meter are left untouched, not replaced) — no hover, no click.
|
|
18
18
|
- **Never invents data**: a failed refresh keeps the last good value and marks it stale (`12m ago ⚠`); rejected keys, endpoint errors and network problems each get a readable reason.
|
|
19
19
|
- **Hover details**: source and mode, the window's absolute reset time, the granted/topped-up split of a balance, the failure reason with the provider's own message.
|
|
20
20
|
- **Bilingual** (zh / en), following the DSH locale setting.
|
|
@@ -55,7 +55,7 @@ Nothing showing up after installing? See the troubleshooting table at the end of
|
|
|
55
55
|
|
|
56
56
|
1. Open **Settings → Usage state**: one row per provider configured in DSH.
|
|
57
57
|
2. Leave it on **Auto** (it detects the data source and its primary mode), or pick `API` / `Coding Plan` / `Hidden`; use ↑↓ to reorder.
|
|
58
|
-
3. The reading appears
|
|
58
|
+
3. The reading appears on its own line above the composer input, as wide as the input card.
|
|
59
59
|
|
|
60
60
|
If a source needs an endpoint or a key (a self-hosted Sub2API, or a provider without a credential yet), expand that row's **Advanced** block to override the source, set the endpoint, name the credential, or paste a key (written to the DSH credential store).
|
|
61
61
|
|
|
@@ -101,6 +101,7 @@ Expanding **Advanced** lets you override the source and endpoint, name a credent
|
|
|
101
101
|
|
|
102
102
|
- **0.2 line only**: `engines.dsh` = `>=0.2.0-rc.2 <0.3.0-0` (this is what dsh-market's badge and install gate read). On an earlier host, install `0.3.2`.
|
|
103
103
|
- `peerDependencies` carry `@deepseek-ai/dsh-settings` (`^0.2.0-rc.2`) and `@deepseek-ai/schemastery` (`^3.18.2`). The first one is deliberate: the runtime install gate only reads `@deepseek-ai/dsh*` peers, so declaring it makes a 0.1.x host **refuse the install** instead of accepting it and then failing to boot. Both are platform-provided; pnpm may print a `missing peer` warning for them, which is expected.
|
|
104
|
+
- Version `0.4.2` moves the status line to `conversation.input.dock`, giving it **its own line above the composer input** — DSH 0.2 turned the old below-the-input position into a shared row of pills next to the platform's stats and context meter (revisions 19/20).
|
|
104
105
|
- Version `0.4.1` fixes `0.4.0`'s missing readings: the browser half's RPC contribution lacked the `create()` factory 0.2 requires, so `remote.usageState` never mounted — the UI showed **no readings at all** and mislabelled the cause as `Mode not supported`. The same release stops swallowing a rejected mount, says "reading" while the catalog is absent, and adds **real 0.2 registry contract tests** (revision 18). **Use `0.4.1`, not `0.4.0`.**
|
|
105
106
|
- Version `0.4.0` migrates to the 0.2 settings model (`Config` + `configForms`, with cross-entry config read through `configEditor`). Verification and results: [`docs/implementation.md`](docs/implementation.md) §10; rationale: [`docs/design-consensus.md`](docs/design-consensus.md) revision 17.
|
|
106
107
|
- Version `0.3.2` (last of the 0.1 line) only widened `engines.dsh`; **its claimed 0.2 compatibility was wrong** — on `0.2.0-rc.2` it fails the entire web boot because `settingsScope` does not exist there.
|
package/README.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
**中文** | [English](README.en.md)
|
|
4
4
|
|
|
5
|
-
在 [DSH(DeepSeek Harness)](https://github.com/deepseek-ai)
|
|
5
|
+
在 [DSH(DeepSeek Harness)](https://github.com/deepseek-ai) 里一眼看到你的**账户余额**或**套餐额度**——就在输入框上方、与输入卡片同宽的一行(原生统计行与其弹窗原样保留、不做替换)。
|
|
6
6
|
|
|
7
7
|
> A minimal DSH plugin that shows your account **balance** (API mode) or **coding-plan quota** (5h / 7d / 30d) for the model you are using, right under the composer.
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
|
|
10
|
+
输入框上方独立一行: z.ai / GLM · 5h 12% (4h0m) ▓▓▓░░░░░ · 7d 59% (3d17h) ▓▓▓▓▓░░░
|
|
11
11
|
DeepSeek · ¥58.13
|
|
12
12
|
悬停任意一段: Source DeepSeek · Mode API balance · Granted 0 · Topped up 58.13
|
|
13
13
|
```
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
- **零配置可用**:按 provider 自动识别该用哪个数据源与模式,DSH 里配过的密钥会被自动复用,不填任何东西就能看到读数。
|
|
18
18
|
- **账户级配置**:余额与额度是账户级的,所以每个供应商只配一次(`自动` / `API` / `Coding Plan` / `隐藏`),模型清单只作展示。
|
|
19
|
-
-
|
|
19
|
+
- **始终可见一行**:独占一行、位于输入框上方(DSH 0.2 把它挂在 `conversation.input.dock`,与输入卡片同宽居中;原生统计行与上下文计量器原样保留、不做替换),不需要悬停或点击。
|
|
20
20
|
- **失败不撒谎**:请求失败时保留上次成功值并标明「多久之前 + ⚠」,**绝不显示 0 或伪造数据**;密钥无效、接口报错、网络不可达会分别给出可读原因。
|
|
21
21
|
- **悬浮提示**:每段文字悬停显示一行放不下的信息——数据源与模式、窗口的绝对重置时刻、余额的赠送/充值构成、失败原因与原始消息。
|
|
22
22
|
- **中英双语**:跟随 DSH 的语言设置(`locale.preference`),设置页与状态行都不含硬编码文案。
|
|
@@ -57,7 +57,7 @@ dsh plugin --profile web add /path/to/dsh-usage-state
|
|
|
57
57
|
|
|
58
58
|
1. 打开 **设置 → 用量状态**:DSH 里配置的每个供应商一行。
|
|
59
59
|
2. 保持默认的 **自动** 即可(它会识别数据源与主模式);需要时改成 `API` / `Coding Plan` / `隐藏`,或用 ↑↓ 调整顺序。
|
|
60
|
-
3.
|
|
60
|
+
3. 该供应商的账户读数会出现在输入框上方、与输入卡片同宽的一行。
|
|
61
61
|
|
|
62
62
|
若某个数据源需要端点或密钥(例如自建的 Sub2API、或尚未配置的 z.ai),展开该行的 **高级**:可覆盖数据源、填接口地址、指定凭据名、粘贴密钥(写入 DSH 凭据库)。
|
|
63
63
|
|
|
@@ -65,7 +65,7 @@ dsh plugin --profile web add /path/to/dsh-usage-state
|
|
|
65
65
|
|
|
66
66
|
## 截图
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
输入框上方独占一行的账户读数(图示为 OpenCode Zen Go 的三个窗口,悬停任意一段可看数据源、模式与绝对重置时刻):
|
|
69
69
|
|
|
70
70
|

|
|
71
71
|
|
|
@@ -125,6 +125,7 @@ dsh plugin --profile web add /path/to/dsh-usage-state
|
|
|
125
125
|
|
|
126
126
|
- **只支持 DSH 0.2 线**:`engines.dsh` = `>=0.2.0-rc.2 <0.3.0-0`(市场读它做徽标与"可安装"判定)。0.2 之前的宿主请装 `0.3.2`。
|
|
127
127
|
- `peerDependencies` 里有 `@deepseek-ai/dsh-settings`(`^0.2.0-rc.2`)与 `@deepseek-ai/schemastery`(`^3.18.2`):前者是**故意的**——平台的运行时安装闸门只读 `@deepseek-ai/dsh*` 的 peer,声明它可以让 0.1.x 宿主在**安装时**就拒绝,而不是装上之后把启动搞崩;两者都由平台提供,pnpm 可能为此打一行 `missing peer` 警告,属预期。
|
|
128
|
+
- 版本 `0.4.2`:状态行迁到 `conversation.input.dock`,成为**输入框上方的独立一行**(0.1 时代它在输入框之下,而 0.2 把那个位置改成了与平台统计、上下文计量器共排的一排 pill——见修订 19/20)。
|
|
128
129
|
- 版本 `0.4.1`:修 `0.4.0` 的读数缺失——客户端 RPC contribution 的参数 codec 少了 0.2 要求的 `create()`,`remote.usageState` 因此从未挂载,界面表现为**没有任何读数**并误报 `Mode not supported`。同一轮还让挂载失败不再被静默吞掉、catalog 未到时改说「读取中」,并把**真实 0.2 registry 契约测试**写进单测(修订 18)。**请用 `0.4.1`,不要用 `0.4.0`。**
|
|
129
130
|
- 版本 `0.4.0`:迁到 0.2 原生设置模型(`Config` + `configForms`,宿主侧 `configEditor` 读跨条目配置)。验证方式与结论见 [`docs/implementation.md`](docs/implementation.md) §10、决策见 [`docs/design-consensus.md`](docs/design-consensus.md) 修订 17。
|
|
130
131
|
- 版本 `0.3.2`(0.1 线末版):仅放宽 `engines.dsh`;**它声称的 0.2 兼容是错的**(0.3.2 在 0.2.0-rc.2 上会因 `settingsScope` 不存在而让整个 web 启动失败)。
|
package/lib/client.js
CHANGED
|
@@ -1268,24 +1268,31 @@ window.__ModuleLoader__.load({
|
|
|
1268
1268
|
//#endregion
|
|
1269
1269
|
//#region src/client/StatusLine.tsx
|
|
1270
1270
|
/**
|
|
1271
|
-
* The composer mount point: one line
|
|
1272
|
-
*
|
|
1271
|
+
* The composer mount point: one full-width line in the composer stack, directly
|
|
1272
|
+
* above the input card.
|
|
1273
|
+
*
|
|
1274
|
+
* `conversation.input.dock` is a stretched column child (`.composerStack` is a column
|
|
1275
|
+
* flex with no `align-items`), so the width comes from the card's own custom
|
|
1276
|
+
* property, exactly like the platform's queued-message dock in that slot. It is
|
|
1277
|
+
* **not** the row below the card: `conversation.composer.dock` there is one centered
|
|
1278
|
+
* flex row shared with the platform's stats pill and the context meter, where a
|
|
1279
|
+
* contribution can only ever be a pill beside them (revisions 19 and 20).
|
|
1273
1280
|
*/
|
|
1274
1281
|
const DOCK_STYLE = {
|
|
1275
1282
|
display: "flex",
|
|
1276
1283
|
alignItems: "center",
|
|
1277
1284
|
justifyContent: "center",
|
|
1278
|
-
gap: "
|
|
1279
|
-
|
|
1280
|
-
lineHeight: "
|
|
1285
|
+
gap: "6px",
|
|
1286
|
+
font: "inherit",
|
|
1287
|
+
lineHeight: "inherit",
|
|
1281
1288
|
fontVariantNumeric: "tabular-nums",
|
|
1282
1289
|
whiteSpace: "nowrap",
|
|
1283
|
-
|
|
1284
|
-
|
|
1290
|
+
flexWrap: "wrap",
|
|
1291
|
+
rowGap: "2px",
|
|
1285
1292
|
width: "100%",
|
|
1286
|
-
maxWidth: "var(--dsh-
|
|
1293
|
+
maxWidth: "var(--dsh-composer-card-max-width)",
|
|
1287
1294
|
margin: "0 auto",
|
|
1288
|
-
padding: "
|
|
1295
|
+
padding: "0 var(--dsh-composer-side-clearance)"
|
|
1289
1296
|
};
|
|
1290
1297
|
const LABEL_STYLE = { color: "var(--dsw-alias-label-tertiary)" };
|
|
1291
1298
|
const SEPARATOR_STYLE = { color: "var(--dsw-alias-separator-primary, var(--dsw-alias-label-dimmed))" };
|
|
@@ -1626,9 +1633,9 @@ window.__ModuleLoader__.load({
|
|
|
1626
1633
|
//#endregion
|
|
1627
1634
|
//#region src/client/slots.ts
|
|
1628
1635
|
const STATUS_LINE_SLOTS = [{
|
|
1629
|
-
name: "conversation.
|
|
1636
|
+
name: "conversation.input.dock",
|
|
1630
1637
|
id: "usage-state",
|
|
1631
|
-
order:
|
|
1638
|
+
order: 200,
|
|
1632
1639
|
locale: "usage-state"
|
|
1633
1640
|
}];
|
|
1634
1641
|
//#endregion
|