@goodandready/dsh-ollama-cloud-provider 0.1.13 → 0.1.15

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,10 +1,80 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.15 — 2026-11-02
4
+
5
+ - Desktop write requests are no longer accepted from a cookie name and a
6
+ Desktop user agent alone. After the loopback Host/socket checks, the plugin
7
+ verifies the `dsh-auth-*` cookie against the host's authenticated
8
+ `/api/version`; a 401/403 or a failed probe rejects the write. Forged
9
+ Desktop headers now return 403 (#42).
10
+ - Truncated streams now fail instead of reporting success: the native parser
11
+ rejects EOF before `done:true`, and the OpenAI parser rejects EOF before
12
+ `[DONE]`/`finish_reason` without emitting `block-end` or `finish`. Malformed
13
+ SSE JSON is an error instead of being skipped (#43).
14
+ - Added project-specific `AGENTS.md` and `index.md` with architecture,
15
+ constraints, compatibility, testing, security, and deployment facts (#44).
16
+ - Investigated the dev-only Zod advisory (#46). DSH core packages pin
17
+ `zod@4.4.3` exactly in rc.4, rc.5, and 0.2.2-alpha, so no in-range
18
+ dependency update exists; forced overrides are not used. The production tree
19
+ (`npm audit --omit=dev`) reports zero because the plugin has no runtime npm
20
+ dependencies. The dev-only advisory remains tracked upstream.
21
+ - Removed the local multi-version `test:engine` loop. It created its own DSH
22
+ runtime, installed a `file:` worktree package, and used forced cleanup,
23
+ contrary to the project test-server rules. Compatibility checks now follow
24
+ the approved test-server procedure in `docs/testing/test-server.md` (#47).
25
+ - SSE normalization now operates on the accumulated buffer, so CRLF split
26
+ between network chunks and split UTF-8 sequences parse correctly (#48).
27
+ - Live catalog metadata is scoped by API base, pruned when models disappear,
28
+ and invalidated together with the cache; a generation guard discards a
29
+ background refresh that finishes after a clear (#49).
30
+ - Request analytics no longer deduplicates independent requests by timestamp;
31
+ concurrent requests that start in the same millisecond and their errors are
32
+ counted (#50).
33
+ - Per-field price overrides now win over generated off-peak rates; partial
34
+ overrides apply only to the overridden field (#51).
35
+ - `/ollama test` disables reasoning, uses 64 tokens, and reports an empty or
36
+ reasoning-only reply as an error instead of `OK` (#52).
37
+ - Analytics scans the newest projection files by mtime when the directory
38
+ exceeds 5000 files and marks the report as truncated; the UI shows the
39
+ incompleteness warning (#53).
40
+ - The update card distinguishes a failed registry check from “up to date” and
41
+ offers a retry; the install button is disabled while the check has failed
42
+ (#54).
43
+ - Quota labels, window labels and credit detail are localized in English and
44
+ Chinese instead of rendering English strings directly (#55).
45
+ - Sensitive read routes (`state`, `analytics`, `usage`, `balance`) require a
46
+ host-verified session cookie; `health` and `status` remain public (#56).
47
+ - The usage reader honors its 30-second failure cache, caches a total failure,
48
+ and deduplicates concurrent reads (#57).
49
+ - Credential config patches and key writes are restricted to the plugin's
50
+ `OLLAMA_*` namespace, closing the two-step `OTHER_PLUGIN_API_KEY` mutation
51
+ path (#60).
52
+ - Saving or clearing a key refreshes server state without discarding an
53
+ unsaved settings draft (#62).
54
+ - Added an explicit `showAllModels` switch: an empty `visibleModels` list with
55
+ `showAllModels:false` now means “hide all” and survives save/reload; legacy
56
+ configs with an absent switch keep the previous empty-means-all behavior
57
+ (#63).
58
+ - Updated the design contract, README install examples and the default user
59
+ agent to the current version (#59).
60
+ - Removed the unused SSE event parser and the redundant stored image `base64`
61
+ field; transports keep using the single `dataUrl` representation (#58).
62
+
63
+ ## 0.1.14 — 2026-10-29
64
+
65
+ - Model-scoped rejections (unsupported model or per-model quota) mark only that
66
+ account+model for five minutes; the key remains usable for other and free
67
+ models. Account-wide quota, credential and rate-limit rejections still cool
68
+ the key.
69
+
3
70
  ## 0.1.13 — 2026-10-29
4
71
 
5
72
  - Account cards now show per-account balance/remaining credits, purchased
6
73
  amount, reset date and the time of the last usage read (or the 5-hour/weekly
7
74
  bars for legacy accounts).
75
+ - Model-scoped rejections (unsupported model or per-model quota) now mark only
76
+ that account+model for five minutes; the key stays usable for other and free
77
+ models. Account-wide quota still cools the key.
8
78
  - Added `npm run test:engine`: an isolated boot matrix that installs every
9
79
  declared `dshReleases` core, composes the plugin, checks `--dump-config` and
10
80
  waits for `/dsh-ollama/health` in a real web host. Supports
package/README.md CHANGED
@@ -80,6 +80,7 @@ graph LR
80
80
  - **Accurate limits** for the dsh picker: context window, input modalities, reasoning levels and their default, tool support, and API visibility.
81
81
  - **Balance and usage** from the official `/api/balance` and `/api/usage` endpoints: included credits, purchased credits, 24-hour / 7-day / 30-day spend, and spend by model.
82
82
  - **Multi-account rotation** before any content is streamed: 401/403/429 and quota rejections mark a key and retry with the next one. Cooldowns persist across restarts.
83
+ - **Model-scoped marks**: an unsupported model or a per-model quota rejection marks only that key+model for five minutes; other and free models keep using the account.
83
84
  - **Sticky accounts** per conversation, plus model → account glob rules.
84
85
  - **Price estimates** from the published Ollama pricing table, including off-peak rates, with per-model overrides.
85
86
  - **Browser UI**:
@@ -103,17 +104,17 @@ npm pack
103
104
  Install the published package:
104
105
 
105
106
  ```bash
106
- dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.13
107
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.15
107
108
  # DSH Desktop:
108
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.13
109
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.15
109
110
  ```
110
111
 
111
112
  Or install the packed tarball into a profile:
112
113
 
113
114
  ```bash
114
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
115
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.15.tgz
115
116
  # DSH Desktop:
116
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
117
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.15.tgz
117
118
  ```
118
119
 
119
120
  Restart dsh (or DSH Desktop), then pick **Ollama Cloud** in the model picker.
package/README.ru.md CHANGED
@@ -103,17 +103,17 @@ npm pack
103
103
  Установка опубликованного пакета из npm:
104
104
 
105
105
  ```bash
106
- dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.13
106
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.15
107
107
  # DSH Desktop:
108
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.13
108
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.15
109
109
  ```
110
110
 
111
111
  Либо установка из упакованного tarball:
112
112
 
113
113
  ```bash
114
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
114
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.15.tgz
115
115
  # DSH Desktop:
116
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
116
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.15.tgz
117
117
  ```
118
118
 
119
119
  После установки перезапустите dsh (или DSH Desktop) и выберите **Ollama Cloud** в списке моделей.
package/README.zh.md CHANGED
@@ -102,17 +102,17 @@ npm pack
102
102
  从 npm 安装已发布版本:
103
103
 
104
104
  ```bash
105
- dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.13
105
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.15
106
106
  # DSH 桌面端:
107
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.13
107
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.15
108
108
  ```
109
109
 
110
110
  或通过打包文件安装:
111
111
 
112
112
  ```bash
113
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
113
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.15.tgz
114
114
  # DSH 桌面端:
115
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
115
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.15.tgz
116
116
  ```
117
117
 
118
118
  安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
package/lib/client.js CHANGED
@@ -49,12 +49,16 @@ window.__ModuleLoader__.load({
49
49
  tokens: "Tokens",
50
50
  spend7d: "7-day spend",
51
51
  remaining: "remaining",
52
+ quotaIncludedCredits: "Included credits",
53
+ quotaFiveHour: "5-hour window",
54
+ quotaWeekly: "Weekly window",
52
55
  until: "until",
53
56
  purchased: "Purchased",
54
57
  range: "Range",
55
58
  last24h: "Last 24 hours",
56
59
  last7d: "Last 7 days",
57
60
  last30d: "Last 30 days",
61
+ last90d: "Last 90 days",
58
62
  activeAccountNow: "Active account",
59
63
  noActiveAccount: "No active account",
60
64
  accounts: "Accounts",
@@ -132,6 +136,7 @@ window.__ModuleLoader__.load({
132
136
  planLabelHint: "Optional label shown on the sidebar card, for example PRO. Ollama does not expose the plan name via API.",
133
137
  usageAnalytics: "Usage analytics",
134
138
  analyticsEmpty: "No Ollama Cloud sessions in this window.",
139
+ analyticsTruncated: "Only the newest session files were scanned; the totals are incomplete.",
135
140
  analyticsHint: "Aggregated from the local session projection cache: numeric metadata only, no prompt text.",
136
141
  days: "Days",
137
142
  sessions: "Sessions",
@@ -165,6 +170,7 @@ window.__ModuleLoader__.load({
165
170
  markTransport: "Transport error",
166
171
  pluginUpdate: "Plugin update",
167
172
  updateCheckFailed: "Could not check for updates",
173
+ retry: "Retry",
168
174
  updateFailed: "Update failed",
169
175
  updateAvailable: "Update available",
170
176
  updateUnavailable: "Automatic update is unavailable in this runtime.",
@@ -216,12 +222,16 @@ window.__ModuleLoader__.load({
216
222
  tokens: "Token",
217
223
  spend7d: "7 天费用",
218
224
  remaining: "剩余",
225
+ quotaIncludedCredits: "包含额度",
226
+ quotaFiveHour: "5 小时窗口",
227
+ quotaWeekly: "每周窗口",
219
228
  until: "至",
220
229
  purchased: "已购买",
221
230
  range: "范围",
222
231
  last24h: "最近 24 小时",
223
232
  last7d: "最近 7 天",
224
233
  last30d: "最近 30 天",
234
+ last90d: "最近 90 天",
225
235
  activeAccountNow: "当前账号",
226
236
  noActiveAccount: "没有可用账号",
227
237
  accounts: "账号",
@@ -299,6 +309,7 @@ window.__ModuleLoader__.load({
299
309
  planLabelHint: "侧边栏卡片上显示的可选标签,例如 PRO。Ollama API 不提供套餐名称。",
300
310
  usageAnalytics: "用量分析",
301
311
  analyticsEmpty: "此窗口内没有 Ollama Cloud 会话。",
312
+ analyticsTruncated: "仅扫描了最新的会话文件,合计数据不完整。",
302
313
  analyticsHint: "来自本地会话投影缓存,仅包含数值元数据,不读取提示词。",
303
314
  days: "天数",
304
315
  sessions: "会话",
@@ -332,6 +343,7 @@ window.__ModuleLoader__.load({
332
343
  markTransport: "传输错误",
333
344
  pluginUpdate: "插件更新",
334
345
  updateCheckFailed: "无法检查更新",
346
+ retry: "重试",
335
347
  updateFailed: "更新失败",
336
348
  updateAvailable: "有可用更新",
337
349
  updateUnavailable: "当前运行环境不支持自动更新。",
@@ -346,15 +358,18 @@ window.__ModuleLoader__.load({
346
358
  };
347
359
  // src/quota-model.ts
348
360
  function bar(key, label, usedPercent, extra = {}) {
361
+ const labelKey = key === "included" ? "quotaIncludedCredits" : key === "fiveHour" ? "quotaFiveHour" : key === "weekly" ? "quotaWeekly" : void 0;
349
362
  const used = Math.max(0, Math.min(100, usedPercent));
350
363
  return {
351
364
  key,
352
365
  label,
366
+ ...labelKey === void 0 ? {} : { labelKey },
353
367
  usedPercent: used,
354
368
  remainingPercent: 100 - used,
355
369
  ...extra.resetsAt === void 0 ? {} : { resetsAt: extra.resetsAt },
356
370
  ...extra.status === void 0 ? {} : { status: extra.status },
357
- ...extra.detail === void 0 ? {} : { detail: extra.detail }
371
+ ...extra.detail === void 0 ? {} : { detail: extra.detail },
372
+ ...extra.detailValues === void 0 ? {} : { detailValues: extra.detailValues }
358
373
  };
359
374
  }
360
375
  function legacyBar(key, label, window) {
@@ -371,6 +386,11 @@ window.__ModuleLoader__.load({
371
386
  const credits = report.credits;
372
387
  return [bar("included", "Included credits", credits.includedAllowance > 0 ? (credits.includedAllowance - credits.includedRemaining) / credits.includedAllowance * 100 : 0, {
373
388
  detail: `$${credits.includedRemaining.toFixed(2)} of $${credits.includedAllowance.toFixed(2)} left` + (credits.purchased > 0 ? ` · $${credits.purchased.toFixed(2)} purchased` : ""),
389
+ detailValues: {
390
+ remaining: credits.includedRemaining,
391
+ allowance: credits.includedAllowance,
392
+ purchased: credits.purchased
393
+ },
374
394
  ...credits.periodUntil === void 0 ? {} : { resetsAt: credits.periodUntil }
375
395
  })];
376
396
  }
@@ -385,16 +405,19 @@ window.__ModuleLoader__.load({
385
405
  report.windows.d24 === void 0 ? void 0 : {
386
406
  key: "24h",
387
407
  label: "24 hours",
408
+ labelKey: "last24h",
388
409
  totals: report.windows.d24
389
410
  },
390
411
  report.windows.d7 === void 0 ? void 0 : {
391
412
  key: "7d",
392
413
  label: "7 days",
414
+ labelKey: "last7d",
393
415
  totals: report.windows.d7
394
416
  },
395
417
  report.windows.d30 === void 0 ? void 0 : {
396
418
  key: "30d",
397
419
  label: "30 days",
420
+ labelKey: "last30d",
398
421
  totals: report.windows.d30
399
422
  }
400
423
  ].filter((entry) => entry !== void 0);
@@ -842,15 +865,15 @@ window.__ModuleLoader__.load({
842
865
  children: [
843
866
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
844
867
  value: "7",
845
- children: "7 days"
868
+ children: t("last7d")
846
869
  }),
847
870
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
848
871
  value: "30",
849
- children: "30 days"
872
+ children: t("last30d")
850
873
  }),
851
874
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
852
875
  value: "90",
853
- children: "90 days"
876
+ children: t("last90d")
854
877
  })
855
878
  ]
856
879
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -871,6 +894,10 @@ window.__ModuleLoader__.load({
871
894
  })]
872
895
  })]
873
896
  }),
897
+ analytics.truncated === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
898
+ className: "ocl-hint",
899
+ children: t("analyticsTruncated")
900
+ }) : null,
874
901
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
875
902
  className: "ocl-kpi-grid",
876
903
  children: [
@@ -963,8 +990,8 @@ window.__ModuleLoader__.load({
963
990
  className: "ocl-bar-row",
964
991
  children: [
965
992
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
966
- title: entry.label,
967
- children: entry.label
993
+ title: entry.labelKey === void 0 ? entry.label : t(entry.labelKey),
994
+ children: entry.labelKey === void 0 ? entry.label : t(entry.labelKey)
968
995
  }),
969
996
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
970
997
  className: "ocl-bar",
@@ -982,9 +1009,20 @@ window.__ModuleLoader__.load({
982
1009
  entry.resetsAt === void 0 ? "" : ` · ${reset(entry.resetsAt)}`
983
1010
  ]
984
1011
  }),
985
- entry.detail === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1012
+ entry.detailValues === void 0 ? entry.detail === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
986
1013
  className: "ocl-hint",
987
1014
  children: entry.detail
1015
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1016
+ className: "ocl-hint",
1017
+ children: [
1018
+ "$",
1019
+ entry.detailValues.remaining.toFixed(2),
1020
+ " / $",
1021
+ entry.detailValues.allowance.toFixed(2),
1022
+ " ",
1023
+ t("remaining"),
1024
+ entry.detailValues.purchased > 0 ? ` · ${t("purchased")} $${entry.detailValues.purchased.toFixed(2)}` : ""
1025
+ ]
988
1026
  })
989
1027
  ]
990
1028
  }, entry.key))
@@ -1100,7 +1138,7 @@ window.__ModuleLoader__.load({
1100
1138
  const worst = worstUsedPercent(report);
1101
1139
  const plan = state?.config.planLabel?.trim() ?? "";
1102
1140
  const name = plan === "" ? t("quotaCardName") : `${t("quotaCardName")} · ${plan}`;
1103
- const detail = bars.map((entry) => `${entry.label}: ${entry.remainingPercent.toFixed(0)}% ${t("remaining")}`).join(" · ");
1141
+ const detail = bars.map((entry) => `${entry.labelKey === void 0 ? entry.label : t(entry.labelKey)}: ${entry.remainingPercent.toFixed(0)}% ${t("remaining")}`).join(" · ");
1104
1142
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1105
1143
  type: "button",
1106
1144
  className: "ocl-foot",
@@ -1131,7 +1169,7 @@ window.__ModuleLoader__.load({
1131
1169
  className: "ocl-footHead",
1132
1170
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1133
1171
  className: "ocl-footLabel",
1134
- children: entry.label
1172
+ children: entry.labelKey === void 0 ? entry.label : t(entry.labelKey)
1135
1173
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1136
1174
  className: "ocl-footAmount",
1137
1175
  children: [
@@ -1288,7 +1326,7 @@ window.__ModuleLoader__.load({
1288
1326
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("spend") }),
1289
1327
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("tokens") })
1290
1328
  ] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
1291
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: row.label }),
1329
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: t(row.labelKey) }),
1292
1330
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: row.totals.requests }),
1293
1331
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", { children: ["$", row.totals.usd.toFixed(3)] }),
1294
1332
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: row.totals.inputTokens + row.totals.outputTokens })
@@ -1467,9 +1505,9 @@ window.__ModuleLoader__.load({
1467
1505
  accounts: state.config.accounts.map((account) => ({ ...account })),
1468
1506
  modelAccountRules: state.config.modelAccountRules.map((rule) => ({ ...rule })),
1469
1507
  stickySession: state.config.stickySession,
1470
- visibleModels: state.config.visibleModels.length === 0 ? allIds : [...state.config.visibleModels],
1508
+ visibleModels: state.config.showAllModels ? allIds : [...state.config.visibleModels],
1471
1509
  filterModelsByPlan: state.config.filterModelsByPlan,
1472
- showAll: state.config.visibleModels.length === 0,
1510
+ showAll: state.config.showAllModels,
1473
1511
  modelTransports: { ...state.config.modelTransports }
1474
1512
  };
1475
1513
  }
@@ -1505,6 +1543,7 @@ window.__ModuleLoader__.load({
1505
1543
  })).filter((rule) => rule.pattern !== "" && rule.account !== ""),
1506
1544
  stickySession: draft.stickySession,
1507
1545
  visibleModels: draft.showAll ? [] : draft.visibleModels,
1546
+ showAllModels: draft.showAll,
1508
1547
  filterModelsByPlan: draft.filterModelsByPlan,
1509
1548
  modelTransports: Object.fromEntries(Object.entries(draft.modelTransports).filter(([, value]) => value !== ""))
1510
1549
  };
@@ -1519,6 +1558,18 @@ window.__ModuleLoader__.load({
1519
1558
  return false;
1520
1559
  }
1521
1560
  }
1561
+ /** Refresh may keep an unsaved draft, but a config save replaces it. */
1562
+ function mergeLoadedDraft(current, next, preserve) {
1563
+ return preserve && current !== null ? current : next;
1564
+ }
1565
+ // src/client/update-state.ts
1566
+ function updateBadge(status) {
1567
+ if (status.latestCheckFailed) return "failed";
1568
+ return status.updateAvailable ? "available" : "current";
1569
+ }
1570
+ function canInstallUpdate(status) {
1571
+ return !status.latestCheckFailed && status.updateAvailable && status.updatedVersion === void 0;
1572
+ }
1522
1573
  // src/client/update-card.tsx
1523
1574
  function PluginUpdateCard(props) {
1524
1575
  const { t } = props;
@@ -1553,7 +1604,10 @@ window.__ModuleLoader__.load({
1553
1604
  children: [
1554
1605
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
1555
1606
  className: "ocl-card-title",
1556
- children: [t("pluginUpdate"), status === null ? null : status.updateAvailable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1607
+ children: [t("pluginUpdate"), status === null ? null : updateBadge(status) === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1608
+ className: "ocl-badge ocl-badge-warn",
1609
+ children: t("updateCheckFailed")
1610
+ }) : updateBadge(status) === "available" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1557
1611
  className: "ocl-badge ocl-badge-warn",
1558
1612
  children: t("updateAvailable")
1559
1613
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -1564,33 +1618,45 @@ window.__ModuleLoader__.load({
1564
1618
  status === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1565
1619
  className: "ocl-hint",
1566
1620
  children: error ?? t("checking")
1567
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1568
- className: "ocl-row",
1569
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1570
- className: "ocl-badge",
1571
- children: [
1572
- t("currentVersion"),
1573
- ": ",
1574
- status.currentVersion
1575
- ]
1576
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1577
- className: "ocl-badge",
1578
- children: [
1579
- t("latestVersion"),
1580
- ": ",
1581
- status.latestVersion ?? "—"
1582
- ]
1583
- })]
1584
- }), status.canAutoUpdate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1585
- type: "button",
1586
- className: "ocl-button",
1587
- disabled: busy || !status.updateAvailable || status.updatedVersion !== void 0,
1588
- onClick: update,
1589
- children: busy ? t("updating") : t("updateNow")
1590
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1591
- className: "ocl-hint",
1592
- children: t("updateUnavailable")
1593
- })] }),
1621
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1622
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1623
+ className: "ocl-row",
1624
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1625
+ className: "ocl-badge",
1626
+ children: [
1627
+ t("currentVersion"),
1628
+ ": ",
1629
+ status.currentVersion
1630
+ ]
1631
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1632
+ className: "ocl-badge",
1633
+ children: [
1634
+ t("latestVersion"),
1635
+ ": ",
1636
+ status.latestVersion ?? "—"
1637
+ ]
1638
+ })]
1639
+ }),
1640
+ status.latestCheckFailed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1641
+ className: "ocl-hint",
1642
+ children: [t("updateCheckFailed"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1643
+ type: "button",
1644
+ className: "ocl-button",
1645
+ onClick: load,
1646
+ children: t("retry")
1647
+ })]
1648
+ }) : null,
1649
+ status.canAutoUpdate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1650
+ type: "button",
1651
+ className: "ocl-button",
1652
+ disabled: busy || !canInstallUpdate(status),
1653
+ onClick: update,
1654
+ children: busy ? t("updating") : t("updateNow")
1655
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1656
+ className: "ocl-hint",
1657
+ children: t("updateUnavailable")
1658
+ })
1659
+ ] }),
1594
1660
  notice === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1595
1661
  className: "ocl-notice",
1596
1662
  children: notice
@@ -1701,14 +1767,14 @@ window.__ModuleLoader__.load({
1701
1767
  const [service, setService] = (0, react.useState)(null);
1702
1768
  const [serviceBusy, setServiceBusy] = (0, react.useState)(false);
1703
1769
  const [serviceError, setServiceError] = (0, react.useState)(null);
1704
- const load = (0, react.useCallback)(async () => {
1770
+ const load = (0, react.useCallback)(async (preserveDraft = false) => {
1705
1771
  setLoading(true);
1706
1772
  try {
1707
1773
  const next = await fetchState();
1708
1774
  setState(next);
1709
1775
  const draftNext = draftOf(next);
1710
- setDraft(draftNext);
1711
- setOriginal(draftNext);
1776
+ setDraft((current) => mergeLoadedDraft(current, draftNext, preserveDraft));
1777
+ setOriginal((current) => mergeLoadedDraft(current, draftNext, preserveDraft));
1712
1778
  setError(null);
1713
1779
  } catch (caught) {
1714
1780
  setError(caught instanceof Error ? caught.message : t("failed"));
@@ -1884,7 +1950,7 @@ window.__ModuleLoader__.load({
1884
1950
  saveKey(draft.apiKeyEnv || "OLLAMA_API_KEY", keyDraft.trim()).then(() => {
1885
1951
  setKeyDraft("");
1886
1952
  setNotice(t("saved"));
1887
- return load();
1953
+ return load(true);
1888
1954
  }).catch((caught) => setError(caught instanceof Error ? caught.message : t("failed")));
1889
1955
  },
1890
1956
  children: t("saveKey")
@@ -1895,7 +1961,7 @@ window.__ModuleLoader__.load({
1895
1961
  onClick: () => {
1896
1962
  clearKey(draft.apiKeyEnv || "OLLAMA_API_KEY").then(() => {
1897
1963
  setNotice(t("saved"));
1898
- return load();
1964
+ return load(true);
1899
1965
  }).catch((caught) => setError(caught instanceof Error ? caught.message : t("failed")));
1900
1966
  },
1901
1967
  children: t("clearKey")
@@ -2160,7 +2226,7 @@ window.__ModuleLoader__.load({
2160
2226
  [account.label]: ""
2161
2227
  }));
2162
2228
  setNotice(t("saved"));
2163
- return load();
2229
+ return load(true);
2164
2230
  }).catch((caught) => setError(caught instanceof Error ? caught.message : t("failed")));
2165
2231
  },
2166
2232
  children: t("saveKey")
package/lib/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { GenerateOptions, LlmAdapter, LlmError, LlmModelInfo, LlmProviderInfo, L
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import { Context } from "@deepseek-ai/cordis";
4
4
  import { AttachmentStore } from "@deepseek-ai/dsh-attachment";
5
+ import { IncomingMessage } from "node:http";
5
6
  import { WebServer } from "@deepseek-ai/dsh-host-webserver";
6
7
  type TransportId = 'native' | 'openai-chat';
7
8
  interface AccountConfig {
@@ -43,8 +44,10 @@ interface Config {
43
44
  requestTimeoutMs?: number;
44
45
  /** Milliseconds a stream may stall; defaults to 300s. */
45
46
  streamIdleTimeoutMs?: number;
46
- /** Visible-model allowlist; empty means "show everything". */
47
+ /** Visible-model allowlist; empty with `showAllModels:false` means none. */
47
48
  visibleModels?: string[];
49
+ /** Explicit all-models switch; absent means derive from `visibleModels`. */
50
+ showAllModels?: boolean;
48
51
  /** Per-model visibility overrides; wins over `visibleModels`. */
49
52
  modelVisibility?: Record<string, boolean>;
50
53
  /** Hide models the cloud marks unsupported in the API; defaults to true. */
@@ -85,6 +88,7 @@ interface ResolvedConfig {
85
88
  requestTimeoutMs: number;
86
89
  streamIdleTimeoutMs: number;
87
90
  visibleModels: readonly string[];
91
+ showAllModels: boolean;
88
92
  modelVisibility: Readonly<Record<string, boolean>>;
89
93
  filterModelsByPlan: boolean;
90
94
  contextWindow?: number;
@@ -191,6 +195,8 @@ declare class OllamaCloudAdapter extends LlmAdapter {
191
195
  private stickyWrites;
192
196
  /** key fingerprint → cooldown deadline and the rejection that caused it. */
193
197
  private readonly cooldowns;
198
+ /** key fingerprint + model → short preference mark for model-scoped rejections. */
199
+ private readonly modelCooldowns;
194
200
  private readonly sticky;
195
201
  private readonly routing;
196
202
  private warnedTools;
@@ -215,6 +221,15 @@ declare class OllamaCloudAdapter extends LlmAdapter {
215
221
  private send;
216
222
  private keyId;
217
223
  private coolingDown;
224
+ private modelKey;
225
+ private modelCoolingDown;
226
+ private markModelCooldown;
227
+ /**
228
+ * A model-scoped rejection says nothing about the key's other models:
229
+ * `:free` models and other paid models may still work on the same account.
230
+ * Only account-wide quota, credential and rate-limit responses cool the key.
231
+ */
232
+ private modelScoped;
218
233
  /** Current cooldown for one resolved key, if any. */
219
234
  accountHealth(key: string): {
220
235
  coolingUntil: number;
@@ -369,6 +384,9 @@ interface AnalyticsReport {
369
384
  summary: AnalyticsSummary;
370
385
  days: DayUsageRow[];
371
386
  sessions: SessionUsageRow[];
387
+ /** The projection directory held more files than the bounded scan. */
388
+ truncated?: boolean;
389
+ totalFiles?: number;
372
390
  }
373
391
  interface RouteDeps {
374
392
  readonly config: () => ResolvedConfig;
@@ -378,6 +396,10 @@ interface RouteDeps {
378
396
  readonly analytics?: (days: number) => Promise<AnalyticsReport>;
379
397
  readonly heatmap?: (days: number) => Promise<RequestHeatmap>;
380
398
  readonly refreshTui?: () => void;
399
+ /** Test seam; defaults to verifying the cookie against the host API. */
400
+ readonly verifyDesktop?: (req: IncomingMessage) => Promise<boolean>;
401
+ /** Same verifier for private reads; falls back to `verifyDesktop`. */
402
+ readonly verifyHost?: (req: IncomingMessage) => Promise<boolean>;
381
403
  }
382
404
  /** Register the Host HTTP surface consumed by the browser settings page. */
383
405
  declare function applyRoutes(ctx: Context, web: WebServer, deps: RouteDeps): void;