@goodandready/dsh-ollama-cloud-provider 0.1.31 → 0.1.33

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.33 — 2026-11-07
4
+
5
+ - Security: closed fake-cookie verification bypass on write routes (`/config`, `/key`) and sensitive read routes (`/state`, `/analytics`, `/usage`, `/balance`) by requiring an anonymous control probe to fail with 401 or 403, failing closed against public or synthetic hosts (#42, #56).
6
+ - Localization: localized weekday labels in request heatmap and tooltips/KPI descriptions in usage analytics across English and Chinese interfaces (#55).
7
+ - Model Visibility: fixed zero-model selection to persist `showAllModels: false` and clear positive overrides, added "Hide all" UI action, and pruned stale `modelVisibility` overrides (#63).
8
+ - Test Hygiene: replaced forbidden `rm(..., { recursive: true, force: true })` calls across all unit tests with safe non-force directory cleanup and graceful ENOENT handling (#106).
9
+ - Automated UI Coverage: added automated component action and interaction test suite covering settings loading/saving, updater retry/update flows, language switching, and clean unmounting (#61).
10
+
11
+ ## 0.1.32 — 2026-11-06
12
+
13
+ - Reliability: handled already-aborted signal check in adapter test mock to prevent hanging promises under load (#102).
14
+ - Diagnostics: routed catalog snapshot cleanup and TUI registration errors through `bestEffortFailed` (#103).
15
+ - Accessibility: added `aria-expanded` and CSS-rotated chevron indicator to collapsible model groups (#104).
16
+
3
17
  ## 0.1.31 — 2026-11-06
4
18
 
5
19
  - Robustness: wrapped ndjson streaming chunk and tail JSON parsing in try/catch
package/README.md CHANGED
@@ -121,17 +121,17 @@ npm pack
121
121
  Install the published package:
122
122
 
123
123
  ```bash
124
- dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.31
124
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.33
125
125
  # DSH Desktop:
126
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.31
126
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.33
127
127
  ```
128
128
 
129
129
  Or install the packed tarball into a profile:
130
130
 
131
131
  ```bash
132
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.31.tgz
132
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.33.tgz
133
133
  # DSH Desktop:
134
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.31.tgz
134
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.33.tgz
135
135
  ```
136
136
 
137
137
  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.31
106
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.33
107
107
  # DSH Desktop:
108
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.31
108
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.33
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.31.tgz
114
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.33.tgz
115
115
  # DSH Desktop:
116
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.31.tgz
116
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.33.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.31
105
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.33
106
106
  # DSH 桌面端:
107
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.31
107
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.33
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.31.tgz
113
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.33.tgz
114
114
  # DSH 桌面端:
115
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.31.tgz
115
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.33.tgz
116
116
  ```
117
117
 
118
118
  安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
package/lib/client.js CHANGED
@@ -95,6 +95,17 @@ window.__ModuleLoader__.load({
95
95
  filterModelsByPlan: "Hide models unavailable in the API",
96
96
  filterModelsByPlanHint: "Models the cloud marks as hidden or unsupported in the API are omitted from the picker.",
97
97
  showAll: "Show all",
98
+ hideAll: "Hide all",
99
+ dayMon: "Mon",
100
+ dayTue: "Tue",
101
+ dayWed: "Wed",
102
+ dayThu: "Thu",
103
+ dayFri: "Fri",
104
+ daySat: "Sat",
105
+ daySun: "Sun",
106
+ successRateTooltip: "Recorded session steps; failed attempts are not exposed by the local projection.",
107
+ reasoningTooltip: "Reasoning tokens are not exposed by the local session projection.",
108
+ errorsTooltip: "The local projection does not expose failed attempts.",
98
109
  free: "FREE",
99
110
  legendFree: "free model",
100
111
  legendPrice: "$in/$out per 1M tokens",
@@ -329,6 +340,17 @@ window.__ModuleLoader__.load({
329
340
  filterModelsByPlan: "隐藏 API 不可用的模型",
330
341
  filterModelsByPlanHint: "云标记为隐藏或 API 不支持的模型不会出现在选择器中。",
331
342
  showAll: "全部显示",
343
+ hideAll: "全部隐藏",
344
+ dayMon: "周一",
345
+ dayTue: "周二",
346
+ dayWed: "周三",
347
+ dayThu: "周四",
348
+ dayFri: "周五",
349
+ daySat: "周六",
350
+ daySun: "周日",
351
+ successRateTooltip: "已记录的会话步骤;本地投影不公开失败的尝试。",
352
+ reasoningTooltip: "本地会话投影不公开推理 Token。",
353
+ errorsTooltip: "本地投影不公开失败的尝试。",
332
354
  free: "免费",
333
355
  legendFree: "免费模型",
334
356
  legendPrice: "每 100 万 token 的输入/输出价格",
@@ -630,15 +652,19 @@ window.__ModuleLoader__.load({
630
652
  });
631
653
  }
632
654
  // src/client/heatmap.tsx
633
- const DAYS = [
634
- "Mon",
635
- "Tue",
636
- "Wed",
637
- "Thu",
638
- "Fri",
639
- "Sat",
640
- "Sun"
655
+ const DAY_KEYS = [
656
+ "dayMon",
657
+ "dayTue",
658
+ "dayWed",
659
+ "dayThu",
660
+ "dayFri",
661
+ "daySat",
662
+ "daySun"
641
663
  ];
664
+ function dayLabel(day, t) {
665
+ const key = DAY_KEYS[day];
666
+ return key !== void 0 ? t(key) : "";
667
+ }
642
668
  function cellColor(value, max) {
643
669
  if (value === 0 || max <= 0) return "color-mix(in srgb, var(--ocl-text-tertiary) 10%, transparent)";
644
670
  const ratio = Math.min(1, value / max);
@@ -778,11 +804,11 @@ window.__ModuleLoader__.load({
778
804
  }, `h${hour}`)),
779
805
  view.grid.map((row, day) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
780
806
  className: "ocl-heat-day",
781
- children: DAYS[day] ?? ""
807
+ children: dayLabel(day, t)
782
808
  }), row.map((value, hour) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
783
809
  className: "ocl-heat-cell",
784
810
  style: { background: cellColor(value, max) },
785
- title: `${DAYS[day] ?? ""} ${pad(hour)}:00 — ${value}`
811
+ title: `${dayLabel(day, t)} ${pad(hour)}:00 — ${value}`
786
812
  }, `c${day}-${hour}`))] }, `d${day}`))
787
813
  ]
788
814
  }),
@@ -1043,7 +1069,7 @@ window.__ModuleLoader__.load({
1043
1069
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Kpi, {
1044
1070
  label: t("successRate"),
1045
1071
  value: summary.successRate === null ? "—" : `${Math.round(summary.successRate)}%`,
1046
- title: "Recorded session steps; failed attempts are not exposed by the local projection."
1072
+ title: t("successRateTooltip")
1047
1073
  }),
1048
1074
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Kpi, {
1049
1075
  label: t("input"),
@@ -1056,7 +1082,7 @@ window.__ModuleLoader__.load({
1056
1082
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Kpi, {
1057
1083
  label: t("reasoning"),
1058
1084
  value: summary.reasoningTokens === null ? "—" : compact(summary.reasoningTokens),
1059
- title: "Reasoning tokens are not exposed by the local session projection."
1085
+ title: t("reasoningTooltip")
1060
1086
  }),
1061
1087
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Kpi, {
1062
1088
  label: t("cacheRead"),
@@ -1077,7 +1103,7 @@ window.__ModuleLoader__.load({
1077
1103
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Kpi, {
1078
1104
  label: t("errors"),
1079
1105
  value: summary.errors === null ? "—" : String(summary.errors),
1080
- title: "The local projection does not expose failed attempts."
1106
+ title: t("errorsTooltip")
1081
1107
  })
1082
1108
  ]
1083
1109
  }),
@@ -1756,7 +1782,7 @@ window.__ModuleLoader__.load({
1756
1782
  visibleModels: draft.showAll ? [] : draft.visibleModels,
1757
1783
  showAllModels: draft.showAll,
1758
1784
  filterModelsByPlan: draft.filterModelsByPlan,
1759
- modelVisibility: draft.modelVisibility,
1785
+ modelVisibility: draft.showAll ? draft.modelVisibility : Object.fromEntries(Object.entries(draft.modelVisibility).filter(([id, val]) => val === false || draft.visibleModels.includes(id))),
1760
1786
  manualModels: draft.manualModels.filter((model) => model.id.trim() !== "").map((model) => ({
1761
1787
  id: model.id.trim(),
1762
1788
  enabled: model.enabled,
@@ -2450,11 +2476,14 @@ window.__ModuleLoader__.load({
2450
2476
  };
2451
2477
  const toggleModel = (id, visible) => {
2452
2478
  const current = new Set(draft.visibleModels);
2479
+ const nextVisibility = { ...draft.modelVisibility };
2453
2480
  if (visible) current.add(id);
2454
2481
  else current.delete(id);
2482
+ delete nextVisibility[id];
2455
2483
  update({
2456
2484
  visibleModels: [...current],
2457
- showAll: false
2485
+ showAll: false,
2486
+ modelVisibility: nextVisibility
2458
2487
  });
2459
2488
  };
2460
2489
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -2987,6 +3016,16 @@ window.__ModuleLoader__.load({
2987
3016
  visibleModels: state.models.map((model) => model.id)
2988
3017
  }),
2989
3018
  children: t("showAll")
3019
+ }),
3020
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3021
+ type: "button",
3022
+ className: "ocl-button",
3023
+ onClick: () => update({
3024
+ showAll: false,
3025
+ visibleModels: [],
3026
+ modelVisibility: {}
3027
+ }),
3028
+ children: t("hideAll")
2990
3029
  })
2991
3030
  ]
2992
3031
  }),
@@ -3067,18 +3106,22 @@ window.__ModuleLoader__.load({
3067
3106
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
3068
3107
  type: "button",
3069
3108
  className: "ocl-model-group-head",
3109
+ "aria-expanded": collapsedGroups[group.key] !== true,
3070
3110
  onClick: () => toggleGroup(group.key),
3071
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
3072
- collapsedGroups[group.key] === true ? "▸" : "▾",
3073
- " ",
3074
- group.label
3075
- ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3111
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3112
+ className: "ocl-group-title",
3113
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3114
+ className: `ocl-chevron ${collapsedGroups[group.key] === true ? "ocl-chevron-collapsed" : ""}`,
3115
+ "aria-hidden": "true",
3116
+ children: "▾"
3117
+ }), group.label]
3118
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3076
3119
  className: "ocl-badge",
3077
3120
  children: group.models.length
3078
3121
  })]
3079
3122
  }), collapsedGroups[group.key] === true ? null : group.models.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelEntry, {
3080
3123
  model,
3081
- visible: draft.showAll || draft.visibleModels.includes(model.id),
3124
+ visible: draft.modelVisibility[model.id] ?? (draft.showAll || draft.visibleModels.includes(model.id)),
3082
3125
  transport: draft.modelTransports[model.id] ?? "",
3083
3126
  dragging: dragId === model.id,
3084
3127
  onDragStart: () => setDragId(model.id),
@@ -3749,6 +3792,9 @@ window.__ModuleLoader__.load({
3749
3792
  .ocl-drag-handle { cursor: grab; color: var(--ocl-text-secondary); user-select: none; }
3750
3793
  .ocl-dragging { opacity: 0.5; }
3751
3794
  .ocl-model-group { display: flex; flex-direction: column; gap: 2px; }
3795
+ .ocl-group-title { display: inline-flex; align-items: center; gap: 6px; }
3796
+ .ocl-chevron { display: inline-block; transition: transform 0.15s ease; font-size: 10px; line-height: 1; }
3797
+ .ocl-chevron-collapsed { transform: rotate(-90deg); }
3752
3798
  .ocl-model-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 4px 0; border: 0; background: none; color: var(--ocl-text-secondary); font-size: 11px; font-weight: 650; cursor: pointer; text-align: left; }
3753
3799
  .ocl-model-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3754
3800
  .ocl-model-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--ocl-text-secondary); font-size: 11px; }
package/lib/index.js CHANGED
@@ -88,7 +88,7 @@ function setBestEffortLogger(logger) {
88
88
  function bestEffortFailed(label, error) {
89
89
  try {
90
90
  sink?.debug?.(`${label}: ${redactText(error instanceof Error ? error.message : String(error))}`);
91
- } catch {}
91
+ } catch (caught) {}
92
92
  }
93
93
  // src/attempt.ts
94
94
  /** One abort/timeout budget for one attempt; callers create a fresh one per retry. */
@@ -110,7 +110,6 @@ function createAttemptBudget(timeoutMs, caller) {
110
110
  budget.timedOut = true;
111
111
  controller.abort();
112
112
  }, timeoutMs) : void 0;
113
- timer?.unref?.();
114
113
  budget.dispose = () => {
115
114
  if (timer !== void 0) clearTimeout(timer);
116
115
  caller?.removeEventListener("abort", onAbort);
@@ -124,7 +123,7 @@ const DEFAULT_API_BASE = "https://ollama.com";
124
123
  const DEFAULT_OPENAI_BASE = "https://ollama.com/v1";
125
124
  const DEFAULT_USAGE_URL = "https://ollama.com/api/usage";
126
125
  const DEFAULT_BALANCE_URL = "https://ollama.com/api/balance";
127
- const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.31";
126
+ const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.33";
128
127
  const DEFAULT_CONTEXT_WINDOW = 131072;
129
128
  const DEFAULT_MAX_TOKENS = 32768;
130
129
  const DEFAULT_GENERATE_MAX_TOKENS = 131072;
@@ -451,14 +450,18 @@ async function saveCatalogSnapshot(baseURL, ids, meta) {
451
450
  bestEffortFailed("catalog cache write failed", error);
452
451
  try {
453
452
  await unlink(temp);
454
- } catch {}
453
+ } catch (unlinkError) {
454
+ bestEffortFailed("cleanup temp cache failed", unlinkError);
455
+ }
455
456
  }
456
457
  }
457
458
  /** Remove the persistent snapshot together with the in-memory cache. */
458
459
  function clearCatalogSnapshot() {
459
460
  try {
460
461
  unlinkSync(catalogCachePath());
461
- } catch {}
462
+ } catch (error) {
463
+ if (error.code !== "ENOENT") bestEffortFailed("clear catalog snapshot failed", error);
464
+ }
462
465
  }
463
466
  // src/models.generated.ts
464
467
  const GENERATED_MODELS = {
@@ -4592,16 +4595,15 @@ async function defaultVerifyHost(req) {
4592
4595
  });
4593
4596
  await response.body?.cancel();
4594
4597
  if (response.status >= 300 && response.status < 400) return false;
4595
- if (response.status === 404) {
4596
- const anonymous = await fetch(`${localOrigin}/api/version`, {
4597
- headers: { accept: "application/json" },
4598
- redirect: "manual",
4599
- signal: AbortSignal.timeout(2500)
4600
- });
4601
- await anonymous.body?.cancel();
4602
- return anonymous.status === 401 || anonymous.status === 403;
4603
- }
4604
- return response.status < 500 && response.status !== 401 && response.status !== 403;
4598
+ if (response.status === 401 || response.status === 403 || response.status >= 500) return false;
4599
+ const anonymous = await fetch(`${localOrigin}/api/version`, {
4600
+ headers: { accept: "application/json" },
4601
+ redirect: "manual",
4602
+ signal: AbortSignal.timeout(2500)
4603
+ });
4604
+ await anonymous.body?.cancel();
4605
+ if (anonymous.status !== 401 && anonymous.status !== 403) return false;
4606
+ return response.status >= 200 && response.status < 300 || response.status === 404;
4605
4607
  } catch {
4606
4608
  return false;
4607
4609
  }
@@ -5403,8 +5405,9 @@ function applyOllamaTuiSettings(ctx, deps) {
5403
5405
  remove?.();
5404
5406
  try {
5405
5407
  remove = service.register(buildOllamaTuiSection(deps));
5406
- } catch {
5408
+ } catch (error) {
5407
5409
  remove = void 0;
5410
+ bestEffortFailed("tui section registration failed", error);
5408
5411
  }
5409
5412
  };
5410
5413
  refresh();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-ollama-cloud-provider",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "description": "Ollama Cloud LLM provider plugin for DeepSeek Harness (dsh).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -73,7 +73,7 @@
73
73
  "build": "tsdown",
74
74
  "prepare": "tsdown 1>&2",
75
75
  "typecheck": "tsc --noEmit",
76
- "test": "node --import tsx --test --test-concurrency=1 tests/core.test.ts tests/usage.test.ts tests/adapter.test.ts tests/routes.test.ts tests/native.test.ts tests/openai-chat.test.ts tests/commands.test.ts tests/tui-settings.test.ts tests/analytics.test.ts tests/apply.test.ts tests/account-rules.test.ts tests/request-log.test.ts tests/image-budget.test.ts tests/tool-schema.test.ts tests/tools.test.ts tests/plugin-updater.test.ts tests/compat.test.ts tests/status.test.ts tests/settings-draft.test.ts tests/update-state.test.ts tests/ui-render.test.tsx tests/update-card-view.test.tsx tests/web.test.ts tests/mock-ollama.test.ts tests/reasoning.test.ts tests/catalog-cache.test.ts tests/attempt.test.ts tests/model-groups.test.tsx tests/discovery.test.ts tests/sanitize.test.ts tests/retry.test.ts tests/provider-card.test.tsx tests/host-verification.test.ts",
76
+ "test": "node --import tsx --test --test-concurrency=1 tests/core.test.ts tests/usage.test.ts tests/adapter.test.ts tests/routes.test.ts tests/native.test.ts tests/openai-chat.test.ts tests/commands.test.ts tests/tui-settings.test.ts tests/analytics.test.ts tests/apply.test.ts tests/account-rules.test.ts tests/request-log.test.ts tests/image-budget.test.ts tests/tool-schema.test.ts tests/tools.test.ts tests/plugin-updater.test.ts tests/compat.test.ts tests/status.test.ts tests/settings-draft.test.ts tests/update-state.test.ts tests/ui-render.test.tsx tests/update-card-view.test.tsx tests/web.test.ts tests/mock-ollama.test.ts tests/reasoning.test.ts tests/catalog-cache.test.ts tests/attempt.test.ts tests/model-groups.test.tsx tests/discovery.test.ts tests/sanitize.test.ts tests/retry.test.ts tests/provider-card.test.tsx tests/host-verification.test.ts tests/ui-actions.test.tsx",
77
77
  "check": "npm run typecheck && npm test && npm run build",
78
78
  "release": "npm run check && npm pack",
79
79
  "sync:models": "node scripts/sync-models.mjs"
@@ -121,6 +121,7 @@
121
121
  "@types/node": "^22.0.0",
122
122
  "@types/react": "^18.3.1",
123
123
  "@types/react-dom": "18.3.7",
124
+ "happy-dom": "^21.0.4",
124
125
  "react": "^18.3.1",
125
126
  "react-dom": "18.3.1",
126
127
  "tsdown": "^0.22.2",