@goodandready/dsh-ollama-cloud-provider 0.1.12 → 0.1.14
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 +20 -0
- package/README.md +5 -4
- package/README.ru.md +4 -4
- package/README.zh.md +4 -4
- package/lib/client.js +17 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +54 -2
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.14 — 2026-10-29
|
|
4
|
+
|
|
5
|
+
- Model-scoped rejections (unsupported model or per-model quota) mark only that
|
|
6
|
+
account+model for five minutes; the key remains usable for other and free
|
|
7
|
+
models. Account-wide quota, credential and rate-limit rejections still cool
|
|
8
|
+
the key.
|
|
9
|
+
|
|
10
|
+
## 0.1.13 — 2026-10-29
|
|
11
|
+
|
|
12
|
+
- Account cards now show per-account balance/remaining credits, purchased
|
|
13
|
+
amount, reset date and the time of the last usage read (or the 5-hour/weekly
|
|
14
|
+
bars for legacy accounts).
|
|
15
|
+
- Model-scoped rejections (unsupported model or per-model quota) now mark only
|
|
16
|
+
that account+model for five minutes; the key stays usable for other and free
|
|
17
|
+
models. Account-wide quota still cools the key.
|
|
18
|
+
- Added `npm run test:engine`: an isolated boot matrix that installs every
|
|
19
|
+
declared `dshReleases` core, composes the plugin, checks `--dump-config` and
|
|
20
|
+
waits for `/dsh-ollama/health` in a real web host. Supports
|
|
21
|
+
`--versions 0.2.1-rc.4` for a single release.
|
|
22
|
+
|
|
3
23
|
## 0.1.12 — 2026-10-29
|
|
4
24
|
|
|
5
25
|
- The sidebar quota card and panel now pause polling while the document is
|
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.
|
|
107
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.14
|
|
107
108
|
# DSH Desktop:
|
|
108
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
109
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.14
|
|
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.
|
|
115
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.tgz
|
|
115
116
|
# DSH Desktop:
|
|
116
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
117
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.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.
|
|
106
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.14
|
|
107
107
|
# DSH Desktop:
|
|
108
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
108
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.14
|
|
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.
|
|
114
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.tgz
|
|
115
115
|
# DSH Desktop:
|
|
116
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
116
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.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.
|
|
105
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.14
|
|
106
106
|
# DSH 桌面端:
|
|
107
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
107
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.14
|
|
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.
|
|
113
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.tgz
|
|
114
114
|
# DSH 桌面端:
|
|
115
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
115
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.tgz
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
|
package/lib/client.js
CHANGED
|
@@ -49,6 +49,7 @@ window.__ModuleLoader__.load({
|
|
|
49
49
|
tokens: "Tokens",
|
|
50
50
|
spend7d: "7-day spend",
|
|
51
51
|
remaining: "remaining",
|
|
52
|
+
until: "until",
|
|
52
53
|
purchased: "Purchased",
|
|
53
54
|
range: "Range",
|
|
54
55
|
last24h: "Last 24 hours",
|
|
@@ -215,6 +216,7 @@ window.__ModuleLoader__.load({
|
|
|
215
216
|
tokens: "Token",
|
|
216
217
|
spend7d: "7 天费用",
|
|
217
218
|
remaining: "剩余",
|
|
219
|
+
until: "至",
|
|
218
220
|
purchased: "已购买",
|
|
219
221
|
range: "范围",
|
|
220
222
|
last24h: "最近 24 小时",
|
|
@@ -2105,6 +2107,20 @@ window.__ModuleLoader__.load({
|
|
|
2105
2107
|
})
|
|
2106
2108
|
]
|
|
2107
2109
|
}),
|
|
2110
|
+
known?.usage?.report === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2111
|
+
className: "ocl-hint",
|
|
2112
|
+
children: t("noUsage")
|
|
2113
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2114
|
+
className: "ocl-accountUsage",
|
|
2115
|
+
children: [quotaBars(known.usage.report).map((bar) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2116
|
+
className: "ocl-badge",
|
|
2117
|
+
title: bar.detail,
|
|
2118
|
+
children: [bar.detail ?? `${bar.label}: ${bar.remainingPercent.toFixed(0)}% ${t("remaining")}`, bar.resetsAt === void 0 ? "" : ` · ${t("until")} ${new Date(bar.resetsAt).toLocaleDateString()}`]
|
|
2119
|
+
}, bar.key)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2120
|
+
className: "ocl-hint",
|
|
2121
|
+
children: new Date(known.usage.checkedAt).toLocaleTimeString()
|
|
2122
|
+
})]
|
|
2123
|
+
}),
|
|
2108
2124
|
known?.usage?.report?.windows.d7 === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2109
2125
|
className: "ocl-row",
|
|
2110
2126
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -2653,6 +2669,7 @@ window.__ModuleLoader__.load({
|
|
|
2653
2669
|
.ocl-model-section .ocl-hint { margin: 0 0 4px; }
|
|
2654
2670
|
.ocl-account { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 8px; align-items: center; }
|
|
2655
2671
|
.ocl-account-block { display: flex; flex-direction: column; gap: 6px; padding: 9px; border: 1px solid var(--ocl-border-soft); border-radius: 8px; background: var(--ocl-fill); }
|
|
2672
|
+
.ocl-accountUsage { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
|
|
2656
2673
|
.ocl-notice { font-size: 12px; padding: 7px 10px; border-radius: 7px; background: var(--ocl-accent-soft); border: 1px solid var(--ocl-accent-border); }
|
|
2657
2674
|
.ocl-error { font-size: 12px; padding: 7px 10px; border-radius: 7px; background: var(--ocl-danger-soft); border: 1px solid var(--ocl-danger-border); color: var(--ocl-danger); }
|
|
2658
2675
|
[class*="_footerActions"]:has(.ocl-foot), [class*="_footerActions"]:has(.ocl-railButton) { flex-direction: column; }
|
package/lib/index.d.ts
CHANGED
|
@@ -191,6 +191,8 @@ declare class OllamaCloudAdapter extends LlmAdapter {
|
|
|
191
191
|
private stickyWrites;
|
|
192
192
|
/** key fingerprint → cooldown deadline and the rejection that caused it. */
|
|
193
193
|
private readonly cooldowns;
|
|
194
|
+
/** key fingerprint + model → short preference mark for model-scoped rejections. */
|
|
195
|
+
private readonly modelCooldowns;
|
|
194
196
|
private readonly sticky;
|
|
195
197
|
private readonly routing;
|
|
196
198
|
private warnedTools;
|
|
@@ -215,6 +217,15 @@ declare class OllamaCloudAdapter extends LlmAdapter {
|
|
|
215
217
|
private send;
|
|
216
218
|
private keyId;
|
|
217
219
|
private coolingDown;
|
|
220
|
+
private modelKey;
|
|
221
|
+
private modelCoolingDown;
|
|
222
|
+
private markModelCooldown;
|
|
223
|
+
/**
|
|
224
|
+
* A model-scoped rejection says nothing about the key's other models:
|
|
225
|
+
* `:free` models and other paid models may still work on the same account.
|
|
226
|
+
* Only account-wide quota, credential and rate-limit responses cool the key.
|
|
227
|
+
*/
|
|
228
|
+
private modelScoped;
|
|
218
229
|
/** Current cooldown for one resolved key, if any. */
|
|
219
230
|
accountHealth(key: string): {
|
|
220
231
|
coolingUntil: number;
|
package/lib/index.js
CHANGED
|
@@ -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.
|
|
52
|
+
const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.14";
|
|
53
53
|
const DEFAULT_CONTEXT_WINDOW = 131072;
|
|
54
54
|
const DEFAULT_MAX_TOKENS = 32768;
|
|
55
55
|
const DEFAULT_GENERATE_MAX_TOKENS = 131072;
|
|
@@ -2256,6 +2256,8 @@ var OllamaCloudAdapter = class extends LlmAdapter {
|
|
|
2256
2256
|
stickyWrites = Promise.resolve();
|
|
2257
2257
|
/** key fingerprint → cooldown deadline and the rejection that caused it. */
|
|
2258
2258
|
cooldowns = /* @__PURE__ */ new Map();
|
|
2259
|
+
/** key fingerprint + model → short preference mark for model-scoped rejections. */
|
|
2260
|
+
modelCooldowns = /* @__PURE__ */ new Map();
|
|
2259
2261
|
sticky = /* @__PURE__ */ new Map();
|
|
2260
2262
|
routing = [];
|
|
2261
2263
|
warnedTools = false;
|
|
@@ -2356,6 +2358,9 @@ var OllamaCloudAdapter = class extends LlmAdapter {
|
|
|
2356
2358
|
}
|
|
2357
2359
|
}
|
|
2358
2360
|
}
|
|
2361
|
+
const availableKeys = keys.filter((entry) => !this.coolingDown(entry.key));
|
|
2362
|
+
const preferredKeys = availableKeys.filter((entry) => !this.modelCoolingDown(entry.key, options.model));
|
|
2363
|
+
keys = preferredKeys.length > 0 ? preferredKeys : availableKeys;
|
|
2359
2364
|
const url = endpointFor(model.transport, config);
|
|
2360
2365
|
let images;
|
|
2361
2366
|
if (hasImages(options)) {
|
|
@@ -2408,6 +2413,12 @@ var OllamaCloudAdapter = class extends LlmAdapter {
|
|
|
2408
2413
|
lastError = error;
|
|
2409
2414
|
logAttempt(false, error.code);
|
|
2410
2415
|
const canRotate = index < keys.length - 1;
|
|
2416
|
+
if (this.modelScoped(error)) {
|
|
2417
|
+
this.markModelCooldown(entry.key, options.model, error.code === "UNSUPPORTED_MODEL" ? "model-unsupported" : "model-quota");
|
|
2418
|
+
responseFailure = true;
|
|
2419
|
+
if (canRotate) continue;
|
|
2420
|
+
throw error;
|
|
2421
|
+
}
|
|
2411
2422
|
const retryable = error.code === "INVALID_CREDENTIAL" || error.code === "RATE_LIMIT" || error.code === "QUOTA" || error.code === "SERVER";
|
|
2412
2423
|
const credentialOrQuota = error.code === "INVALID_CREDENTIAL" || error.code === "RATE_LIMIT" || error.code === "QUOTA";
|
|
2413
2424
|
if (retryable) {
|
|
@@ -2441,8 +2452,13 @@ var OllamaCloudAdapter = class extends LlmAdapter {
|
|
|
2441
2452
|
if (started || options.signal?.aborted === true) throw error;
|
|
2442
2453
|
lastError = classified;
|
|
2443
2454
|
const transient = this.isTransient(classified);
|
|
2444
|
-
const canRotate = index < keys.length - 1 && transient;
|
|
2455
|
+
const canRotate = index < keys.length - 1 && (transient || this.modelScoped(classified));
|
|
2445
2456
|
const credentialOrQuota = classified.code === "INVALID_CREDENTIAL" || classified.code === "RATE_LIMIT" || classified.code === "QUOTA";
|
|
2457
|
+
if (this.modelScoped(classified)) {
|
|
2458
|
+
this.markModelCooldown(entry.key, options.model, classified.code === "UNSUPPORTED_MODEL" ? "model-unsupported" : "model-quota");
|
|
2459
|
+
if (!canRotate) throw classified;
|
|
2460
|
+
continue;
|
|
2461
|
+
}
|
|
2446
2462
|
if (!responseFailure && (canRotate || credentialOrQuota)) this.markCooldown(entry.key, 0);
|
|
2447
2463
|
if (!canRotate) throw classified;
|
|
2448
2464
|
}
|
|
@@ -2583,6 +2599,42 @@ var OllamaCloudAdapter = class extends LlmAdapter {
|
|
|
2583
2599
|
}
|
|
2584
2600
|
return true;
|
|
2585
2601
|
}
|
|
2602
|
+
modelKey(key, model) {
|
|
2603
|
+
return `${this.keyId(key)}:${model}`;
|
|
2604
|
+
}
|
|
2605
|
+
modelCoolingDown(key, model) {
|
|
2606
|
+
const id = this.modelKey(key, model);
|
|
2607
|
+
const entry = this.modelCooldowns.get(id);
|
|
2608
|
+
if (entry === void 0) return false;
|
|
2609
|
+
if (entry.until <= Date.now()) {
|
|
2610
|
+
this.modelCooldowns.delete(id);
|
|
2611
|
+
return false;
|
|
2612
|
+
}
|
|
2613
|
+
return true;
|
|
2614
|
+
}
|
|
2615
|
+
markModelCooldown(key, model, reason) {
|
|
2616
|
+
const now = Date.now();
|
|
2617
|
+
for (const [id, entry] of this.modelCooldowns) if (entry.until <= now) this.modelCooldowns.delete(id);
|
|
2618
|
+
this.modelCooldowns.set(this.modelKey(key, model), {
|
|
2619
|
+
until: now + 3e5,
|
|
2620
|
+
reason
|
|
2621
|
+
});
|
|
2622
|
+
const overflow = this.modelCooldowns.size - 200;
|
|
2623
|
+
if (overflow <= 0) return;
|
|
2624
|
+
const oldest = [...this.modelCooldowns.entries()].sort((a, b) => a[1].until - b[1].until).slice(0, overflow);
|
|
2625
|
+
for (const [id] of oldest) this.modelCooldowns.delete(id);
|
|
2626
|
+
}
|
|
2627
|
+
/**
|
|
2628
|
+
* A model-scoped rejection says nothing about the key's other models:
|
|
2629
|
+
* `:free` models and other paid models may still work on the same account.
|
|
2630
|
+
* Only account-wide quota, credential and rate-limit responses cool the key.
|
|
2631
|
+
*/
|
|
2632
|
+
modelScoped(error) {
|
|
2633
|
+
if (error.code === "UNSUPPORTED_MODEL") return true;
|
|
2634
|
+
if (error.code !== "QUOTA") return false;
|
|
2635
|
+
const detail = error.message.toLowerCase();
|
|
2636
|
+
return detail.includes("model") && (detail.includes("credit") || detail.includes("quota") || detail.includes("allowance") || detail.includes("limit"));
|
|
2637
|
+
}
|
|
2586
2638
|
/** Current cooldown for one resolved key, if any. */
|
|
2587
2639
|
accountHealth(key) {
|
|
2588
2640
|
const id = this.keyId(key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-ollama-cloud-provider",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Ollama Cloud LLM provider plugin for DeepSeek Harness (dsh).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"typecheck": "tsc --noEmit",
|
|
73
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
|
+
"test:engine": "node scripts/test-engines.mjs",
|
|
75
76
|
"release": "npm run check && npm pack",
|
|
76
77
|
"sync:models": "node scripts/sync-models.mjs"
|
|
77
78
|
},
|