@goodandready/dsh-opencode-provider 0.5.10 → 0.5.11

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
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.11
4
+
5
+ - **Usage fetch retry**: the quota reader retries one transient Node/undici network failure before caching `fetch failed`, so a brief connect timeout no longer leaves the quota panel without usage data.
6
+ - 91 tests.
7
+
3
8
  ## 0.5.10
4
9
 
5
10
  - **Migration hint**: Settings → OpenCode explains the 0.5.7 provider-id split and why legacy `opencode`/`opencode-go` sessions stay on the built-in pi-ai routes. The analytics hint/empty state also distinguishes plugin routes from legacy traffic.
package/README.md CHANGED
@@ -130,12 +130,12 @@ npm pack
130
130
  Install the **packed tarball** into a profile:
131
131
 
132
132
  ```bash
133
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.10.tgz
133
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.11.tgz
134
134
  # DSH Desktop:
135
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.10.tgz
135
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.11.tgz
136
136
 
137
137
  # Or install the published package:
138
- dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.10
138
+ dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.11
139
139
  ```
140
140
 
141
141
  Restart dsh (or DSH Desktop), then pick **OpenCode (plugin)** or **OpenCode Go (plugin)** in the model picker.
package/README.ru.md CHANGED
@@ -129,12 +129,12 @@ npm pack
129
129
  Установка из **упакованного tarball**:
130
130
 
131
131
  ```bash
132
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.10.tgz
132
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.11.tgz
133
133
  # DSH Desktop:
134
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.10.tgz
134
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.11.tgz
135
135
 
136
136
  # Либо установка опубликованного пакета из npm:
137
- dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.10
137
+ dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.11
138
138
  ```
139
139
 
140
140
  После установки перезапустите dsh (или DSH Desktop) и выберите **OpenCode (plugin)** или **OpenCode Go (plugin)** в списке моделей.
package/README.zh.md CHANGED
@@ -124,12 +124,12 @@ npm pack
124
124
  通过**打包文件 (.tgz)**安装:
125
125
 
126
126
  ```bash
127
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.10.tgz
127
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.11.tgz
128
128
  # DSH 桌面端:
129
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.10.tgz
129
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-opencode-provider-0.5.11.tgz
130
130
 
131
131
  # 或从 npm 安装已发布版本:
132
- dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.10
132
+ dsh plugin --profile web add @goodandready/dsh-opencode-provider@0.5.11
133
133
  ```
134
134
 
135
135
  安装完成后重启 dsh 或 DSH 桌面端,在模型选择器中选择 **OpenCode (plugin)** 或 **OpenCode Go (plugin)** 即可。
package/lib/index.js CHANGED
@@ -17,7 +17,7 @@ const DEFAULT_GO_API_BASE = "https://opencode.ai/inference/go";
17
17
  const DEFAULT_GO_ZEN_BASE = "https://opencode.ai/zen/go/v1";
18
18
  const DEFAULT_USAGE_URL = "https://opencode.ai/zen/go/v1/usage";
19
19
  const DEFAULT_AUTH_ENTRY = "opencode-go";
20
- const DEFAULT_USER_AGENT = "dsh-opencode-provider/0.5.10";
20
+ const DEFAULT_USER_AGENT = "dsh-opencode-provider/0.5.11";
21
21
  const DEFAULT_CONTEXT_WINDOW = 262144;
22
22
  const DEFAULT_MAX_TOKENS = 32768;
23
23
  const DEFAULT_GENERATE_MAX_TOKENS = 32768;
@@ -5210,6 +5210,7 @@ function applyOpenCodeTuiSettings(ctx, deps) {
5210
5210
  const SUCCESS_TTL_MS = 3e5;
5211
5211
  const FAILURE_TTL_MS = 45e3;
5212
5212
  const USAGE_TIMEOUT_MS = 2e4;
5213
+ const RETRY_DELAY_MS = 250;
5213
5214
  function windowOf(raw) {
5214
5215
  if (raw === void 0) return void 0;
5215
5216
  if (typeof raw.percent !== "number" || !Number.isFinite(raw.percent)) return void 0;
@@ -5256,16 +5257,27 @@ function createUsageReader(config, resolveKey, fetchImpl = fetch) {
5256
5257
  if (Date.now() - cached.checkedAt < ttl) return cached;
5257
5258
  }
5258
5259
  const result = async () => {
5260
+ const signal = AbortSignal.timeout(USAGE_TIMEOUT_MS);
5259
5261
  try {
5260
- const response = await fetchImpl(current.usageUrl, {
5261
- headers: {
5262
- authorization: `Bearer ${key}`,
5263
- accept: "application/json",
5264
- "user-agent": current.userAgent,
5265
- "x-opencode-session": "dsh_usage"
5266
- },
5267
- signal: AbortSignal.timeout(USAGE_TIMEOUT_MS)
5268
- });
5262
+ let response;
5263
+ let lastNetworkError;
5264
+ for (let attempt = 0; attempt < 2; attempt += 1) try {
5265
+ response = await fetchImpl(current.usageUrl, {
5266
+ headers: {
5267
+ authorization: `Bearer ${key}`,
5268
+ accept: "application/json",
5269
+ "user-agent": current.userAgent,
5270
+ "x-opencode-session": "dsh_usage"
5271
+ },
5272
+ signal
5273
+ });
5274
+ break;
5275
+ } catch (error) {
5276
+ lastNetworkError = error;
5277
+ if (signal.aborted || attempt === 1) throw error;
5278
+ await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));
5279
+ }
5280
+ if (response === void 0) throw lastNetworkError ?? /* @__PURE__ */ new Error("usage request failed");
5269
5281
  if (response.status === 401 || response.status === 403) return {
5270
5282
  error: "usage endpoint rejected the key (inference may still work)",
5271
5283
  checkedAt: Date.now()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-opencode-provider",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "description": "OpenCode / OpenCode Go LLM provider plugin for DeepSeek Harness (dsh).",
5
5
  "license": "MIT",
6
6
  "type": "module",