@goodandready/dsh-ollama-cloud-provider 0.1.11 → 0.1.12

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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.12 — 2026-10-29
4
+
5
+ - The sidebar quota card and panel now pause polling while the document is
6
+ hidden and refresh immediately when it becomes visible again.
7
+ - Settings gained a **Service status** row: a local, keyless probe of the
8
+ public tag endpoint with latency, checked time and an error state. Ollama
9
+ Cloud has no public status page, so this row reports host-to-gateway
10
+ reachability only.
11
+ - Error mapping now recognizes context-window overflow (using the harness
12
+ `CONTEXT_WINDOW_EXCEEDED_CODE`), model capability rejections for images/tools
13
+ and oversized request bodies, instead of returning a generic 400 message.
14
+
3
15
  ## 0.1.11 — 2026-10-29
4
16
 
5
17
  - Compatibility declarations now use the same-channel range
package/README.md CHANGED
@@ -103,17 +103,17 @@ npm pack
103
103
  Install the published package:
104
104
 
105
105
  ```bash
106
- dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.11
106
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.12
107
107
  # DSH Desktop:
108
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.11
108
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.12
109
109
  ```
110
110
 
111
111
  Or install the packed tarball into a profile:
112
112
 
113
113
  ```bash
114
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.11.tgz
114
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.12.tgz
115
115
  # DSH Desktop:
116
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.11.tgz
116
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.12.tgz
117
117
  ```
118
118
 
119
119
  Restart dsh (or DSH Desktop), then pick **Ollama Cloud** in the model picker.
@@ -194,7 +194,7 @@ Open **Settings → Ollama Cloud**:
194
194
  - **Sidebar** — show or hide the quota card, and an optional plan label (for example `PRO`) shown next to the provider name.
195
195
  - **Plugin update** — current/latest version and **Update now**.
196
196
 
197
- The Host serves `/dsh-ollama/state`, `/health`, `/analytics`, `/usage`, `/balance`, `/config`, `/key`, `/key/clear`, `/refresh`, `/models/refresh`, `/test` and `/update`. Writes require JSON, an `Origin` or `Referer` matching `Host` (the Desktop renderer is identified by its `dsh-auth-*` cookie and desktop user agent when both headers are absent), and are restricted to loopback (`127.0.0.1` / `::1`); a write without any source identity is rejected with 403.
197
+ The Host serves `/dsh-ollama/state`, `/health`, `/status`, `/analytics`, `/usage`, `/balance`, `/config`, `/key`, `/key/clear`, `/refresh`, `/models/refresh`, `/test` and `/update`. `/status` probes the public tag endpoint without a key or quota. Writes require JSON, an `Origin` or `Referer` matching `Host` (the Desktop renderer is identified by its `dsh-auth-*` cookie and desktop user agent when both headers are absent), and are restricted to loopback (`127.0.0.1` / `::1`); a write without any source identity is rejected with 403.
198
198
 
199
199
  ## Command
200
200
 
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.11
106
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.12
107
107
  # DSH Desktop:
108
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.11
108
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.12
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.11.tgz
114
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.12.tgz
115
115
  # DSH Desktop:
116
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.11.tgz
116
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.12.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.11
105
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.12
106
106
  # DSH 桌面端:
107
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.11
107
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.12
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.11.tgz
113
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.12.tgz
114
114
  # DSH 桌面端:
115
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.11.tgz
115
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.12.tgz
116
116
  ```
117
117
 
118
118
  安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
package/lib/client.js CHANGED
@@ -118,6 +118,13 @@ window.__ModuleLoader__.load({
118
118
  maxOutputTokens: "Output limit (0 = provider default)",
119
119
  contextWindow: "Context window override",
120
120
  sidebar: "Sidebar",
121
+ serviceStatus: "Service status",
122
+ serviceStatusHint: "Checks the public Ollama Cloud tag endpoint without using your key or quota.",
123
+ serviceOnline: "Reachable",
124
+ serviceOffline: "Unreachable",
125
+ serviceUnknown: "Not checked",
126
+ refreshStatus: "Check now",
127
+ checkingService: "Checking…",
121
128
  showSidebarQuota: "Show the quota card in the sidebar",
122
129
  showSidebarQuotaHint: "The card appears above Settings and opens this panel.",
123
130
  planLabel: "Plan label",
@@ -277,6 +284,13 @@ window.__ModuleLoader__.load({
277
284
  maxOutputTokens: "输出上限(0 = 提供方默认)",
278
285
  contextWindow: "上下文窗口覆盖",
279
286
  sidebar: "侧边栏",
287
+ serviceStatus: "服务状态",
288
+ serviceStatusHint: "检查 Ollama Cloud 公共 tag 端点,不使用密钥或额度。",
289
+ serviceOnline: "可访问",
290
+ serviceOffline: "不可访问",
291
+ serviceUnknown: "未检查",
292
+ refreshStatus: "立即检查",
293
+ checkingService: "检查中…",
280
294
  showSidebarQuota: "在侧边栏显示配额卡片",
281
295
  showSidebarQuotaHint: "卡片显示在设置上方,点击可打开此面板。",
282
296
  planLabel: "套餐标签",
@@ -401,6 +415,9 @@ window.__ModuleLoader__.load({
401
415
  function fetchState() {
402
416
  return call("/dsh-ollama/state");
403
417
  }
418
+ function fetchServiceStatus() {
419
+ return call("/dsh-ollama/status");
420
+ }
404
421
  function refreshState() {
405
422
  return call("/dsh-ollama/refresh", {
406
423
  method: "POST",
@@ -990,9 +1007,16 @@ window.__ModuleLoader__.load({
990
1007
  (0, react.useEffect)(() => {
991
1008
  load();
992
1009
  const timer = setInterval(() => {
993
- load();
1010
+ if (document.visibilityState !== "hidden") load();
994
1011
  }, intervalMs);
995
- return () => clearInterval(timer);
1012
+ const onVisibility = () => {
1013
+ if (document.visibilityState !== "hidden") load();
1014
+ };
1015
+ document.addEventListener("visibilitychange", onVisibility);
1016
+ return () => {
1017
+ clearInterval(timer);
1018
+ document.removeEventListener("visibilitychange", onVisibility);
1019
+ };
996
1020
  }, [load, intervalMs]);
997
1021
  return {
998
1022
  state,
@@ -1672,6 +1696,9 @@ window.__ModuleLoader__.load({
1672
1696
  const [testModel, setTestModel] = (0, react.useState)("gpt-oss:120b");
1673
1697
  const [testing, setTesting] = (0, react.useState)(false);
1674
1698
  const [testResult, setTestResult] = (0, react.useState)(null);
1699
+ const [service, setService] = (0, react.useState)(null);
1700
+ const [serviceBusy, setServiceBusy] = (0, react.useState)(false);
1701
+ const [serviceError, setServiceError] = (0, react.useState)(null);
1675
1702
  const load = (0, react.useCallback)(async () => {
1676
1703
  setLoading(true);
1677
1704
  try {
@@ -1733,6 +1760,20 @@ window.__ModuleLoader__.load({
1733
1760
  setError(caught instanceof Error ? caught.message : t("failed"));
1734
1761
  }
1735
1762
  }, [t]);
1763
+ const loadService = (0, react.useCallback)(async () => {
1764
+ setServiceBusy(true);
1765
+ try {
1766
+ setService(await fetchServiceStatus());
1767
+ setServiceError(null);
1768
+ } catch (caught) {
1769
+ setServiceError(caught instanceof Error ? caught.message : t("failed"));
1770
+ } finally {
1771
+ setServiceBusy(false);
1772
+ }
1773
+ }, [t]);
1774
+ (0, react.useEffect)(() => {
1775
+ loadService();
1776
+ }, [loadService]);
1736
1777
  if (loading && state === null) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1737
1778
  className: "ocl-hint",
1738
1779
  children: t("loading")
@@ -1906,6 +1947,47 @@ window.__ModuleLoader__.load({
1906
1947
  })
1907
1948
  ]
1908
1949
  }),
1950
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1951
+ className: "ocl-card",
1952
+ children: [
1953
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
1954
+ className: "ocl-card-title",
1955
+ children: t("serviceStatus")
1956
+ }),
1957
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1958
+ className: "ocl-row ocl-statusRow",
1959
+ children: [
1960
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: `ocl-statusDot${service?.ok === true ? " ocl-statusDotOk" : service === null ? "" : " ocl-statusDotBad"}` }),
1961
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: service === null ? serviceBusy ? t("checkingService") : t("serviceUnknown") : service.ok ? t("serviceOnline") : t("serviceOffline") }),
1962
+ service === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1963
+ className: "ocl-hint",
1964
+ children: [
1965
+ service.latencyMs,
1966
+ " ms · ",
1967
+ new Date(service.checkedAt).toLocaleTimeString()
1968
+ ]
1969
+ }),
1970
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1971
+ type: "button",
1972
+ className: "ocl-button",
1973
+ disabled: serviceBusy,
1974
+ onClick: () => {
1975
+ loadService();
1976
+ },
1977
+ children: serviceBusy ? t("checkingService") : t("refreshStatus")
1978
+ })
1979
+ ]
1980
+ }),
1981
+ serviceError === null && service?.error === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1982
+ className: "ocl-hint",
1983
+ children: serviceError ?? service?.error
1984
+ }),
1985
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1986
+ className: "ocl-hint",
1987
+ children: t("serviceStatusHint")
1988
+ })
1989
+ ]
1990
+ }),
1909
1991
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1910
1992
  className: "ocl-card",
1911
1993
  children: [
@@ -2595,6 +2677,10 @@ window.__ModuleLoader__.load({
2595
2677
  .ocl-railButton:hover { color: var(--ocl-text); background: var(--ocl-fill-hover); }
2596
2678
  .ocl-railButton:focus-visible { outline: var(--dsw-focus-ring-width, 2px) solid var(--ocl-focus); outline-offset: -2px; }
2597
2679
  .ocl-ring { flex: none; display: inline-flex; }
2680
+ .ocl-statusRow { align-items: center; gap: 8px; flex-wrap: wrap; }
2681
+ .ocl-statusDot { width: 8px; height: 8px; border-radius: 999px; background: var(--ocl-text-secondary); flex: none; }
2682
+ .ocl-statusDotOk { background: var(--ocl-accent); }
2683
+ .ocl-statusDotBad { background: var(--ocl-danger); }
2598
2684
  .ocl-panel { display: flex; flex-direction: column; gap: 14px; padding: 18px; max-width: 760px; margin: 0 auto; height: 100%; max-height: calc(100vh - 56px); min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
2599
2685
  .ocl-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
2600
2686
  .ocl-limits { margin-top: 8px; }
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ import { existsSync, readFileSync, statSync } from "node:fs";
3
3
  import { appendFile, mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
4
4
  import { homedir } from "node:os";
5
5
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
6
- import { LlmAdapter, LlmError, ReasoningEffortId, ToolCallId, attributionHeaders, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
6
+ import { CONTEXT_WINDOW_EXCEEDED_CODE, LlmAdapter, LlmError, ReasoningEffortId, ToolCallId, attributionHeaders, isContextWindowExceededError, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
7
7
  import z from "@deepseek-ai/schemastery";
8
8
  import { credentialRef } from "@deepseek-ai/dsh-credentials";
9
9
  import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
@@ -49,7 +49,7 @@ const DEFAULT_API_BASE = "https://ollama.com";
49
49
  const DEFAULT_OPENAI_BASE = "https://ollama.com/v1";
50
50
  const DEFAULT_USAGE_URL = "https://ollama.com/api/usage";
51
51
  const DEFAULT_BALANCE_URL = "https://ollama.com/api/balance";
52
- const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.11";
52
+ const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.12";
53
53
  const DEFAULT_CONTEXT_WINDOW = 131072;
54
54
  const DEFAULT_MAX_TOKENS = 32768;
55
55
  const DEFAULT_GENERATE_MAX_TOKENS = 131072;
@@ -1042,6 +1042,9 @@ function classifyResponseError(status, text, headers) {
1042
1042
  if (status === 401 || status === 403) return new LlmError(`Ollama Cloud rejected the credential: ${message}. Create a key at https://ollama.com/settings/keys and store it through the credentials service.`, "INVALID_CREDENTIAL", options);
1043
1043
  if (status === 404) return new LlmError(`Ollama Cloud does not serve this model: ${message}. Refresh the catalog and check that the id matches the cloud list exactly.`, "UNSUPPORTED_MODEL", options);
1044
1044
  if (status === 429) return new LlmError(`Ollama Cloud rate-limited the request: ${message}`, "RATE_LIMIT", options);
1045
+ if (isContextWindowExceededError(detail)) return new LlmError(`Ollama Cloud rejected the request: context window exceeded: ${message}`, CONTEXT_WINDOW_EXCEEDED_CODE, options);
1046
+ if (/does not support (?:images?|vision|tools?)|unsupported (?:image|tool)|image (?:input|modality) is not supported|tools? (?:are|is) not supported/i.test(detail)) return new LlmError(`Ollama Cloud model does not accept this request: ${message}`, "UNSUPPORTED_MODEL", options);
1047
+ if (/request (?:body|entity) too large|payload too large|node count cannot exceed|maximum (?:request|body) size/i.test(detail)) return new LlmError(`Ollama Cloud rejected the request body as too large: ${message}`, "PROVIDER_HTTP_ERROR", options);
1045
1048
  if (status === 408 || status === 504) return new LlmError(`Ollama Cloud timed out (HTTP ${status}): ${message}`, "TIMEOUT", options);
1046
1049
  if (status === 503) return new LlmError(`Ollama Cloud is at its concurrency limit or temporarily unavailable: ${message}`, "SERVER", options);
1047
1050
  if (status >= 500) return new LlmError(`Ollama Cloud gateway error (HTTP ${status}): ${message}`, "SERVER", options);
@@ -3588,6 +3591,43 @@ function publicConfig(config) {
3588
3591
  userAgent: config.userAgent
3589
3592
  };
3590
3593
  }
3594
+ // src/status.ts
3595
+ const PROBE_TIMEOUT_MS = 5e3;
3596
+ /**
3597
+ * Probe the public Ollama Cloud tag endpoint. This request carries no key and
3598
+ * does not consume quota; it only answers whether the configured API base is
3599
+ * reachable from this host.
3600
+ */
3601
+ async function probeService(config, fetchImpl = fetch) {
3602
+ const started = Date.now();
3603
+ const controller = new AbortController();
3604
+ const timer = setTimeout(() => controller.abort(), PROBE_TIMEOUT_MS);
3605
+ try {
3606
+ const response = await fetchImpl(tagsUrlFor(config), {
3607
+ method: "GET",
3608
+ signal: controller.signal,
3609
+ headers: { accept: "application/json" }
3610
+ });
3611
+ const latencyMs = Date.now() - started;
3612
+ return {
3613
+ ok: response.ok,
3614
+ status: response.status,
3615
+ latencyMs,
3616
+ checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
3617
+ ...response.ok ? {} : { error: `HTTP ${response.status}` }
3618
+ };
3619
+ } catch (error) {
3620
+ return {
3621
+ ok: false,
3622
+ status: null,
3623
+ latencyMs: Date.now() - started,
3624
+ checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
3625
+ error: controller.signal.aborted ? "timeout" : error instanceof Error ? error.message : String(error)
3626
+ };
3627
+ } finally {
3628
+ clearTimeout(timer);
3629
+ }
3630
+ }
3591
3631
  // src/routes-values.ts
3592
3632
  const TRANSPORTS = /* @__PURE__ */ new Set(["native", "openai-chat"]);
3593
3633
  function cleanAccounts(value) {
@@ -3979,6 +4019,20 @@ function applyRoutes(ctx, web, deps) {
3979
4019
  json(res, 500, { error: error instanceof Error ? error.message : "health failed" });
3980
4020
  }
3981
4021
  });
4022
+ route("/dsh-ollama/status", async (req, res) => {
4023
+ if (!readOnly(req, res)) return;
4024
+ try {
4025
+ json(res, 200, await probeService(deps.config(), fetch));
4026
+ } catch (error) {
4027
+ json(res, 200, {
4028
+ ok: false,
4029
+ status: null,
4030
+ latencyMs: 0,
4031
+ checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
4032
+ error: error instanceof Error ? error.message : "status failed"
4033
+ });
4034
+ }
4035
+ });
3982
4036
  route("/dsh-ollama/analytics", async (req, res) => {
3983
4037
  if (!readOnly(req, res)) return;
3984
4038
  const url = new URL(req.url ?? "/", "http://localhost");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-ollama-cloud-provider",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Ollama Cloud LLM provider plugin for DeepSeek Harness (dsh).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -70,7 +70,7 @@
70
70
  "build": "tsdown",
71
71
  "prepare": "tsdown 1>&2",
72
72
  "typecheck": "tsc --noEmit",
73
- "test": "node --import tsx --test tests/core.test.ts tests/usage.test.ts tests/adapter.test.ts tests/routes.test.ts tests/native.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",
73
+ "test": "node --import tsx --test tests/core.test.ts tests/usage.test.ts tests/adapter.test.ts tests/routes.test.ts tests/native.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",
74
74
  "check": "npm run typecheck && npm test && npm run build",
75
75
  "release": "npm run check && npm pack",
76
76
  "sync:models": "node scripts/sync-models.mjs"