dsh-multi-provider-usage 0.7.3 → 0.7.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
@@ -172,15 +172,11 @@ When the balance is not configured (or the console login is fixable), the
172
172
  OpenCode GO card in the plugin settings renders a step-by-step **setup guide**
173
173
  in place of the static hint. The lead-in names the state-specific fix (nothing
174
174
  configured, an API-key login, or an expired sign-in). Step ① shows the
175
- `opencode auth login` CLI command with a **Copy command** button; step ② is the
176
- manual path — copy the console token and store it as the `OPENCODE_CONSOLE_TOKEN`
177
- credential — with a **Copy credential ref** button and a link to the OpenCode
178
- console website (derived from `opencodeConsoleBaseUrl`, ending in `/console`);
179
- step ③ offers a **Re-check** button that re-reads the sign-in state and forces
180
- one upstream usage read, so a fresh login shows the balance without restarting
181
- DSH (unsaved form edits are never discarded by the re-check). The
182
- `/provider-usage` command gives the same state-specific guidance as text for
183
- all three fixable states.
175
+ `opencode auth login` CLI command with a **Copy command** button; step ② offers
176
+ a **Re-check** button that re-reads the sign-in state and forces one upstream
177
+ usage read, so a fresh login shows the balance without restarting DSH (unsaved
178
+ form edits are never discarded by the re-check). The `/provider-usage` command
179
+ gives the same state-specific guidance as text for all three fixable states.
184
180
 
185
181
  The optional `opencodeConsoleAuthFile` overrides the auth file (and its
186
182
  directory is used to locate `opencode.db`), `opencodeConsoleOrgId` supplies the
@@ -423,7 +419,7 @@ network and no real keys. They cover the schema, all three adapters, OpenCode
423
419
  GO service integration/fallback, aggregation and error isolation, caching and
424
420
  forced refresh, settings conflicts/whitelisting, the client bundle contract,
425
421
  top-up balance discovery (credential and local auth.json) and failure
426
- isolation, and the session-header injection. 98 tests, all offline.
422
+ isolation, and the session-header injection. 102 tests, all offline.
427
423
 
428
424
  ## License
429
425
 
package/README.zh.md CHANGED
@@ -140,11 +140,9 @@ Plugins 面板中的设置页,悬停提示修复方式:运行 `opencode auth
140
140
 
141
141
  余额未配置或控制台登录可修复时,插件设置页的 OpenCode GO 卡片不再给一句静态
142
142
  提示,而是渲染分步**引导**:引言按当前状态指明修复方式(未配置 / API Key 登录 /
143
- 登录已过期)。第①步给出 `opencode auth login` 命令与「复制命令」按钮;第②步是
144
- 手动路径——从控制台网页复制令牌、保存为 `OPENCODE_CONSOLE_TOKEN` 凭据——带
145
- 「复制凭据名」按钮和打开 OpenCode 控制台网页的链接(由 `opencodeConsoleBaseUrl`
146
- 推导,以 `/console` 结尾);第③步提供「重新检测」按钮,重读登录状态并强制刷新
147
- 一次用量,新登录无需重启 DSH 即可显示余额(重新检测不会丢弃表单里未保存的修改)。
143
+ 登录已过期)。第①步给出 `opencode auth login` 命令与「复制命令」按钮;第②步提供
144
+ 「重新检测」按钮,重读登录状态并强制刷新一次用量,新登录无需重启 DSH 即可显示
145
+ 余额(重新检测不会丢弃表单里未保存的修改)。
148
146
  `/provider-usage` 命令对三种可修复状态都会给出同样的文字引导。
149
147
 
150
148
  可用 `opencodeConsoleAuthFile` 覆盖 auth.json 路径(其目录也用于定位
@@ -371,7 +369,7 @@ npm test
371
369
  测试是封闭的:伪造 `globalThis.fetch` + stub Cordis 上下文,不访问网络、不使用真实
372
370
  密钥。覆盖 schema、三个适配器、OpenCode GO 服务集成/回退、聚合与故障隔离、缓存与
373
371
  强制刷新、设置冲突/白名单、客户端 bundle 契约、充值余额发现(凭据 / 本地
374
- auth.json)与失败隔离、会话头注入、余额变化动画;共 98 个测试。
372
+ auth.json)与失败隔离、会话头注入、余额变化动画;共 102 个测试。
375
373
 
376
374
  ## 许可证
377
375
 
package/lib/client.js CHANGED
@@ -179,11 +179,8 @@ window.__ModuleLoader__.load({
179
179
  "cfg.console.expired": "控制台登录已过期,请重新运行 opencode auth login 后再刷新。",
180
180
  "cfg.console.guide.title": "如何显示充值余额",
181
181
  "cfg.console.guide.step1": "在终端运行以下命令,选择 OpenCode Console 账号登录:",
182
- "cfg.console.guide.step2": "或从控制台网页复制令牌,保存为 DSH 凭据:",
183
- "cfg.console.guide.step3": "完成后点击重新检测,插件会重读登录状态并立即刷新余额,无需重启 DSH。",
184
- "cfg.console.guide.link": "打开 OpenCode 控制台 ↗",
182
+ "cfg.console.guide.step2": "完成后点击重新检测,插件会重读登录状态并立即刷新余额,无需重启 DSH。",
185
183
  "cfg.console.copy.command": "复制命令",
186
- "cfg.console.copy.ref": "复制凭据名",
187
184
  "cfg.console.recheck": "重新检测",
188
185
  "cfg.console.rechecking": "检测中…",
189
186
  "cfg.console.copied": "已复制",
@@ -307,11 +304,8 @@ window.__ModuleLoader__.load({
307
304
  "cfg.console.expired": "The console sign-in expired; run opencode auth login again and refresh.",
308
305
  "cfg.console.guide.title": "How to show the top-up balance",
309
306
  "cfg.console.guide.step1": "Run this command in a terminal and choose the OpenCode Console account:",
310
- "cfg.console.guide.step2": "Or copy the token from the console website and store it as a DSH credential:",
311
- "cfg.console.guide.step3": "When done, click Re-check — the plugin re-reads the sign-in state and refreshes the balance immediately; no DSH restart needed.",
312
- "cfg.console.guide.link": "Open the OpenCode console ↗",
307
+ "cfg.console.guide.step2": "When done, click Re-check — the plugin re-reads the sign-in state and refreshes the balance immediately; no DSH restart needed.",
313
308
  "cfg.console.copy.command": "Copy command",
314
- "cfg.console.copy.ref": "Copy credential ref",
315
309
  "cfg.console.recheck": "Re-check",
316
310
  "cfg.console.rechecking": "Checking…",
317
311
  "cfg.console.copied": "Copied",
@@ -1480,11 +1474,10 @@ window.__ModuleLoader__.load({
1480
1474
  /**
1481
1475
  * The balance setup guide on the OpenCode GO card, shown whenever the
1482
1476
  * console read is not configured or names a fixable reason (API-key
1483
- * login, expired sign-in). Three steps, each with an actionable row:
1484
- * the CLI sign-in command (copyable), the manual credential path with
1485
- * a console link, and a re-check that re-reads the sign-in state and
1486
- * refreshes the balance without restarting DSH. The lead-in names the
1487
- * state-specific fix.
1477
+ * login, expired sign-in). Two steps, each with an actionable row:
1478
+ * the CLI sign-in command (copyable), and a re-check that re-reads
1479
+ * the sign-in state and refreshes the balance without restarting DSH.
1480
+ * The lead-in names the state-specific fix.
1488
1481
  */
1489
1482
  function ConsoleGuide(props) {
1490
1483
  const t = props.t;
@@ -1501,9 +1494,6 @@ window.__ModuleLoader__.load({
1501
1494
  const leadIn = props.reason === "api-key"
1502
1495
  ? t("cfg.console.apiKey")
1503
1496
  : props.reason === "expired" ? t("cfg.console.expired") : t("cfg.console.hint");
1504
- const credentialRef = typeof props.credentialRef === "string" && props.credentialRef !== ""
1505
- ? props.credentialRef
1506
- : "OPENCODE_CONSOLE_TOKEN";
1507
1497
  const command = "opencode auth login";
1508
1498
  const copyKeys = { copiedKey: "cfg.console.copied", failedKey: "cfg.console.copyFailed" };
1509
1499
  const stepRow = (key, text) => react_jsx_runtime.jsx("p", { style: PS.hint, children: text }, key);
@@ -1529,30 +1519,6 @@ window.__ModuleLoader__.load({
1529
1519
  ] }, "guide-step1"),
1530
1520
  react_jsx_runtime.jsx("div", { style: PS.guideStep, children: [
1531
1521
  stepRow("guide-step2-text", t("cfg.console.guide.step2")),
1532
- react_jsx_runtime.jsx("div", {
1533
- style: PS.inviteRow,
1534
- children: [
1535
- react_jsx_runtime.jsx("code", { style: PS.guideCode, children: credentialRef }, "guide-ref"),
1536
- react_jsx_runtime.jsx(CopyButton, {
1537
- t: t,
1538
- value: credentialRef,
1539
- label: t("cfg.console.copy.ref"),
1540
- ...copyKeys
1541
- }, "guide-step2-copy")
1542
- ]
1543
- }, "guide-step2-row"),
1544
- typeof props.consoleUrl === "string" && props.consoleUrl !== ""
1545
- ? react_jsx_runtime.jsx("a", {
1546
- style: PS.inviteLink,
1547
- href: props.consoleUrl,
1548
- target: "_blank",
1549
- rel: "noreferrer",
1550
- children: t("cfg.console.guide.link")
1551
- }, "guide-link")
1552
- : null
1553
- ] }, "guide-step2"),
1554
- react_jsx_runtime.jsx("div", { style: PS.guideStep, children: [
1555
- stepRow("guide-step3-text", t("cfg.console.guide.step3")),
1556
1522
  react_jsx_runtime.jsx("button", {
1557
1523
  type: "button",
1558
1524
  style: checking || props.disabled === true
@@ -1562,7 +1528,7 @@ window.__ModuleLoader__.load({
1562
1528
  onClick: recheck,
1563
1529
  children: checking ? t("cfg.console.rechecking") : t("cfg.console.recheck")
1564
1530
  }, "guide-recheck")
1565
- ] }, "guide-step3")
1531
+ ] }, "guide-step2")
1566
1532
  ]
1567
1533
  });
1568
1534
  }
@@ -1857,15 +1823,6 @@ window.__ModuleLoader__.load({
1857
1823
  const server = formFromValue(state.value || {});
1858
1824
  const dirty = Object.keys(form).some((key) => !fieldEquals(form[key], server[key]));
1859
1825
 
1860
- // The balance guide's manual path: the configured console credential
1861
- // ref (default OPENCODE_CONSOLE_TOKEN) and the console website
1862
- // derived from the configured console origin.
1863
- const consoleValue = state.value && typeof state.value === "object" ? state.value : {};
1864
- const consoleRef = typeof consoleValue.opencodeConsoleApiKeyEnv === "string" && consoleValue.opencodeConsoleApiKeyEnv !== ""
1865
- ? consoleValue.opencodeConsoleApiKeyEnv
1866
- : "OPENCODE_CONSOLE_TOKEN";
1867
- const consoleLink = String(consoleValue.opencodeConsoleBaseUrl || "https://opencode.ai").replace(/\/+$/, "") + "/console";
1868
-
1869
1826
  /**
1870
1827
  * Re-check the console balance: re-read the detection report
1871
1828
  * (configured / reason) and force one upstream usage read, so a
@@ -2031,8 +1988,6 @@ window.__ModuleLoader__.load({
2031
1988
  // session) names the fix in the guide's lead-in
2032
1989
  // instead of the generic hint.
2033
1990
  reason: consoleFixable ? consoleInfo.reason : "",
2034
- credentialRef: consoleRef,
2035
- consoleUrl: consoleLink,
2036
1991
  disabled: disabled,
2037
1992
  onRecheck: recheckBalance
2038
1993
  }, "console-guide"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-multi-provider-usage",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "DSH (DeepSeek Harness) plugin: one collapsible sidebar widget for OpenCode GO, Command Code and GLM Code Plan quotas plus top-up balances, a periodic balance-change animation, automatic checkout and installed-package updates, same-origin usage proxies, a Plugins-panel settings page and a /provider-usage chat command (DSH 0.1.7+ and 0.2.0 compatible)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",