@goodandready/dsh-ollama-cloud-provider 0.1.18 → 0.1.19
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 +12 -0
- package/README.md +4 -4
- package/README.ru.md +4 -4
- package/README.zh.md +4 -4
- package/lib/client.js +141 -2
- package/lib/index.d.ts +21 -0
- package/lib/index.js +155 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.19 — 2026-11-05
|
|
4
|
+
|
|
5
|
+
- Added configurable native generation defaults: temperature, top_k, top_p,
|
|
6
|
+
min_p, seed, repeat_penalty, repeat_last_n, num_ctx, keep_alive and stop.
|
|
7
|
+
Request options override config; Ollama-only fields are not sent to the
|
|
8
|
+
OpenAI transport. Added settings fields for all values.
|
|
9
|
+
- Normalized thinking ladders: boolean switches become off/high, level lists
|
|
10
|
+
are ordered and deduplicated, and known families get a default effort
|
|
11
|
+
(GLM-5.x/Kimi K3 max, Kimi K2/DeepSeek V4/MiniMax M3 high, GPT-OSS medium,
|
|
12
|
+
Nemotron low) only when that level is offered.
|
|
13
|
+
- Added generation/reasoning tests; 112/112 tests.
|
|
14
|
+
|
|
3
15
|
## 0.1.18 — 2026-11-05
|
|
4
16
|
|
|
5
17
|
- Added local/self-hosted Ollama mode: an explicit empty `apiKeyEnv` means no
|
package/README.md
CHANGED
|
@@ -137,17 +137,17 @@ npm pack
|
|
|
137
137
|
Install the published package:
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
140
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.19
|
|
141
141
|
# DSH Desktop:
|
|
142
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
142
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.19
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
Or install the packed tarball into a profile:
|
|
146
146
|
|
|
147
147
|
```bash
|
|
148
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
148
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.19.tgz
|
|
149
149
|
# DSH Desktop:
|
|
150
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
150
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.19.tgz
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
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.19
|
|
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.19
|
|
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.19.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.19.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.19
|
|
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.19
|
|
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.19.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.19.tgz
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
|
package/lib/client.js
CHANGED
|
@@ -122,6 +122,20 @@ window.__ModuleLoader__.load({
|
|
|
122
122
|
streamIdleTimeoutMs: "Stream idle timeout (ms)",
|
|
123
123
|
maxOutputTokens: "Output limit (0 = provider default)",
|
|
124
124
|
contextWindow: "Context window override",
|
|
125
|
+
generation: "Generation defaults",
|
|
126
|
+
generationHint: "Native Ollama defaults. Empty fields are not sent; request options still win.",
|
|
127
|
+
temperature: "Temperature",
|
|
128
|
+
topK: "Top K",
|
|
129
|
+
topP: "Top P",
|
|
130
|
+
minP: "Min P",
|
|
131
|
+
seed: "Seed",
|
|
132
|
+
repeatPenalty: "Repeat penalty",
|
|
133
|
+
repeatLastN: "Repeat last N",
|
|
134
|
+
numCtx: "num_ctx",
|
|
135
|
+
keepAlive: "Keep alive",
|
|
136
|
+
keepAliveHint: "Ollama keep_alive, for example 5m or -1.",
|
|
137
|
+
stop: "Stop sequences",
|
|
138
|
+
stopHint: "Comma-separated; sent as the native stop list.",
|
|
125
139
|
sidebar: "Sidebar",
|
|
126
140
|
serviceStatus: "Service status",
|
|
127
141
|
serviceStatusHint: "Checks the public Ollama Cloud tag endpoint without using your key or quota.",
|
|
@@ -295,6 +309,20 @@ window.__ModuleLoader__.load({
|
|
|
295
309
|
streamIdleTimeoutMs: "流空闲超时(毫秒)",
|
|
296
310
|
maxOutputTokens: "输出上限(0 = 提供方默认)",
|
|
297
311
|
contextWindow: "上下文窗口覆盖",
|
|
312
|
+
generation: "生成默认值",
|
|
313
|
+
generationHint: "Ollama 原生默认值;空字段不发送,请求参数优先。",
|
|
314
|
+
temperature: "Temperature",
|
|
315
|
+
topK: "Top K",
|
|
316
|
+
topP: "Top P",
|
|
317
|
+
minP: "Min P",
|
|
318
|
+
seed: "Seed",
|
|
319
|
+
repeatPenalty: "Repeat penalty",
|
|
320
|
+
repeatLastN: "Repeat last N",
|
|
321
|
+
numCtx: "num_ctx",
|
|
322
|
+
keepAlive: "Keep alive",
|
|
323
|
+
keepAliveHint: "Ollama keep_alive,例如 5m 或 -1。",
|
|
324
|
+
stop: "Stop sequences",
|
|
325
|
+
stopHint: "逗号分隔,作为原生 stop 列表发送。",
|
|
298
326
|
sidebar: "侧边栏",
|
|
299
327
|
serviceStatus: "服务状态",
|
|
300
328
|
serviceStatusHint: "检查 Ollama Cloud 公共 tag 端点,不使用密钥或额度。",
|
|
@@ -1486,6 +1514,9 @@ window.__ModuleLoader__.load({
|
|
|
1486
1514
|
});
|
|
1487
1515
|
}
|
|
1488
1516
|
// src/client/settings-draft.ts
|
|
1517
|
+
function textOf(value) {
|
|
1518
|
+
return value === null || value === void 0 ? "" : String(value);
|
|
1519
|
+
}
|
|
1489
1520
|
function draftOf(state) {
|
|
1490
1521
|
const allIds = state.models.map((model) => model.id);
|
|
1491
1522
|
return {
|
|
@@ -1497,8 +1528,18 @@ window.__ModuleLoader__.load({
|
|
|
1497
1528
|
transport: state.config.transport,
|
|
1498
1529
|
requestTimeoutMs: String(state.config.requestTimeoutMs),
|
|
1499
1530
|
streamIdleTimeoutMs: String(state.config.streamIdleTimeoutMs),
|
|
1500
|
-
maxOutputTokens:
|
|
1501
|
-
contextWindow:
|
|
1531
|
+
maxOutputTokens: textOf(state.config.maxOutputTokens),
|
|
1532
|
+
contextWindow: textOf(state.config.contextWindow),
|
|
1533
|
+
temperature: textOf(state.config.temperature),
|
|
1534
|
+
topK: textOf(state.config.topK),
|
|
1535
|
+
topP: textOf(state.config.topP),
|
|
1536
|
+
minP: textOf(state.config.minP),
|
|
1537
|
+
seed: textOf(state.config.seed),
|
|
1538
|
+
repeatPenalty: textOf(state.config.repeatPenalty),
|
|
1539
|
+
repeatLastN: textOf(state.config.repeatLastN),
|
|
1540
|
+
numCtx: textOf(state.config.numCtx),
|
|
1541
|
+
keepAlive: state.config.keepAlive ?? "",
|
|
1542
|
+
stop: (state.config.stop ?? []).join(", "),
|
|
1502
1543
|
showSidebarQuota: state.config.showSidebarQuota,
|
|
1503
1544
|
planLabel: state.config.planLabel,
|
|
1504
1545
|
activeAccount: state.config.activeAccount,
|
|
@@ -1518,6 +1559,16 @@ window.__ModuleLoader__.load({
|
|
|
1518
1559
|
if (!Number.isInteger(value) || value < 0) throw new Error(`Invalid number: ${text}`);
|
|
1519
1560
|
return value;
|
|
1520
1561
|
}
|
|
1562
|
+
function boundedNumber(text, min, max, integer) {
|
|
1563
|
+
const trimmed = text.trim();
|
|
1564
|
+
if (trimmed === "") return null;
|
|
1565
|
+
const value = Number(trimmed);
|
|
1566
|
+
if (!Number.isFinite(value) || value < min || value > max || integer && !Number.isInteger(value)) throw new Error(`Invalid number: ${text}`);
|
|
1567
|
+
return value;
|
|
1568
|
+
}
|
|
1569
|
+
function stopList(text) {
|
|
1570
|
+
return text.split(/[\n,]/).map((entry) => entry.trim()).filter((entry) => entry !== "");
|
|
1571
|
+
}
|
|
1521
1572
|
function patchOf(draft) {
|
|
1522
1573
|
return {
|
|
1523
1574
|
apiKeyEnv: draft.apiKeyEnv.trim(),
|
|
@@ -1530,6 +1581,16 @@ window.__ModuleLoader__.load({
|
|
|
1530
1581
|
streamIdleTimeoutMs: numberOrNull(draft.streamIdleTimeoutMs) ?? 3e5,
|
|
1531
1582
|
maxOutputTokens: numberOrNull(draft.maxOutputTokens),
|
|
1532
1583
|
contextWindow: numberOrNull(draft.contextWindow),
|
|
1584
|
+
temperature: boundedNumber(draft.temperature, 0, 2, false),
|
|
1585
|
+
topK: boundedNumber(draft.topK, 1, 1e6, true),
|
|
1586
|
+
topP: boundedNumber(draft.topP, 0, 1, false),
|
|
1587
|
+
minP: boundedNumber(draft.minP, 0, 1, false),
|
|
1588
|
+
seed: boundedNumber(draft.seed, 0, 4294967295, true),
|
|
1589
|
+
repeatPenalty: boundedNumber(draft.repeatPenalty, 0, 2, false),
|
|
1590
|
+
repeatLastN: boundedNumber(draft.repeatLastN, -1, 1e6, true),
|
|
1591
|
+
numCtx: boundedNumber(draft.numCtx, 1, 1e7, true),
|
|
1592
|
+
keepAlive: draft.keepAlive.trim(),
|
|
1593
|
+
stop: stopList(draft.stop),
|
|
1533
1594
|
showSidebarQuota: draft.showSidebarQuota,
|
|
1534
1595
|
planLabel: draft.planLabel.trim(),
|
|
1535
1596
|
activeAccount: draft.activeAccount.trim(),
|
|
@@ -2508,6 +2569,84 @@ window.__ModuleLoader__.load({
|
|
|
2508
2569
|
})
|
|
2509
2570
|
]
|
|
2510
2571
|
}),
|
|
2572
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
2573
|
+
className: "ocl-card",
|
|
2574
|
+
children: [
|
|
2575
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
2576
|
+
className: "ocl-card-title",
|
|
2577
|
+
children: t("generation")
|
|
2578
|
+
}),
|
|
2579
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2580
|
+
className: "ocl-hint",
|
|
2581
|
+
children: t("generationHint")
|
|
2582
|
+
}),
|
|
2583
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2584
|
+
className: "ocl-grid",
|
|
2585
|
+
children: [
|
|
2586
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2587
|
+
label: t("temperature"),
|
|
2588
|
+
type: "number",
|
|
2589
|
+
value: draft.temperature,
|
|
2590
|
+
onChange: (value) => update({ temperature: value })
|
|
2591
|
+
}),
|
|
2592
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2593
|
+
label: t("topK"),
|
|
2594
|
+
type: "number",
|
|
2595
|
+
value: draft.topK,
|
|
2596
|
+
onChange: (value) => update({ topK: value })
|
|
2597
|
+
}),
|
|
2598
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2599
|
+
label: t("topP"),
|
|
2600
|
+
type: "number",
|
|
2601
|
+
value: draft.topP,
|
|
2602
|
+
onChange: (value) => update({ topP: value })
|
|
2603
|
+
}),
|
|
2604
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2605
|
+
label: t("minP"),
|
|
2606
|
+
type: "number",
|
|
2607
|
+
value: draft.minP,
|
|
2608
|
+
onChange: (value) => update({ minP: value })
|
|
2609
|
+
}),
|
|
2610
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2611
|
+
label: t("seed"),
|
|
2612
|
+
type: "number",
|
|
2613
|
+
value: draft.seed,
|
|
2614
|
+
onChange: (value) => update({ seed: value })
|
|
2615
|
+
}),
|
|
2616
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2617
|
+
label: t("repeatPenalty"),
|
|
2618
|
+
type: "number",
|
|
2619
|
+
value: draft.repeatPenalty,
|
|
2620
|
+
onChange: (value) => update({ repeatPenalty: value })
|
|
2621
|
+
}),
|
|
2622
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2623
|
+
label: t("repeatLastN"),
|
|
2624
|
+
type: "number",
|
|
2625
|
+
value: draft.repeatLastN,
|
|
2626
|
+
onChange: (value) => update({ repeatLastN: value })
|
|
2627
|
+
}),
|
|
2628
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2629
|
+
label: t("numCtx"),
|
|
2630
|
+
type: "number",
|
|
2631
|
+
value: draft.numCtx,
|
|
2632
|
+
onChange: (value) => update({ numCtx: value })
|
|
2633
|
+
}),
|
|
2634
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2635
|
+
label: t("keepAlive"),
|
|
2636
|
+
hint: t("keepAliveHint"),
|
|
2637
|
+
value: draft.keepAlive,
|
|
2638
|
+
onChange: (value) => update({ keepAlive: value })
|
|
2639
|
+
}),
|
|
2640
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2641
|
+
label: t("stop"),
|
|
2642
|
+
hint: t("stopHint"),
|
|
2643
|
+
value: draft.stop,
|
|
2644
|
+
onChange: (value) => update({ stop: value })
|
|
2645
|
+
})
|
|
2646
|
+
]
|
|
2647
|
+
})
|
|
2648
|
+
]
|
|
2649
|
+
}),
|
|
2511
2650
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
2512
2651
|
className: "ocl-card",
|
|
2513
2652
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
package/lib/index.d.ts
CHANGED
|
@@ -58,6 +58,17 @@ interface Config {
|
|
|
58
58
|
contextWindowOverrides?: Record<string, number>;
|
|
59
59
|
/** Per-turn output cap; `0` omits `num_predict`/`max_tokens`. */
|
|
60
60
|
maxOutputTokens?: number;
|
|
61
|
+
/** Optional Ollama native generation defaults. */
|
|
62
|
+
temperature?: number;
|
|
63
|
+
topK?: number;
|
|
64
|
+
topP?: number;
|
|
65
|
+
minP?: number;
|
|
66
|
+
seed?: number;
|
|
67
|
+
repeatPenalty?: number;
|
|
68
|
+
repeatLastN?: number;
|
|
69
|
+
numCtx?: number;
|
|
70
|
+
keepAlive?: string;
|
|
71
|
+
stop?: string[];
|
|
61
72
|
/** Extra accounts for rotation. */
|
|
62
73
|
accounts?: AccountConfig[];
|
|
63
74
|
/** Preferred account per model glob; others remain fallbacks. */
|
|
@@ -94,6 +105,16 @@ interface ResolvedConfig {
|
|
|
94
105
|
contextWindow?: number;
|
|
95
106
|
contextWindowOverrides: Readonly<Record<string, number>>;
|
|
96
107
|
maxOutputTokens?: number;
|
|
108
|
+
temperature?: number;
|
|
109
|
+
topK?: number;
|
|
110
|
+
topP?: number;
|
|
111
|
+
minP?: number;
|
|
112
|
+
seed?: number;
|
|
113
|
+
repeatPenalty?: number;
|
|
114
|
+
repeatLastN?: number;
|
|
115
|
+
numCtx?: number;
|
|
116
|
+
keepAlive?: string;
|
|
117
|
+
stop?: readonly string[];
|
|
97
118
|
accounts: readonly AccountConfig[];
|
|
98
119
|
modelAccountRules: readonly ModelAccountRule[];
|
|
99
120
|
stickySession: boolean;
|
package/lib/index.js
CHANGED
|
@@ -50,7 +50,7 @@ const DEFAULT_API_BASE = "https://ollama.com";
|
|
|
50
50
|
const DEFAULT_OPENAI_BASE = "https://ollama.com/v1";
|
|
51
51
|
const DEFAULT_USAGE_URL = "https://ollama.com/api/usage";
|
|
52
52
|
const DEFAULT_BALANCE_URL = "https://ollama.com/api/balance";
|
|
53
|
-
const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.
|
|
53
|
+
const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.19";
|
|
54
54
|
const DEFAULT_CONTEXT_WINDOW = 131072;
|
|
55
55
|
const DEFAULT_MAX_TOKENS = 32768;
|
|
56
56
|
const DEFAULT_GENERATE_MAX_TOKENS = 131072;
|
|
@@ -76,6 +76,16 @@ const Config = z.object({
|
|
|
76
76
|
contextWindow: markVolatile(z.number().min(1).max(1e7).step(1)),
|
|
77
77
|
contextWindowOverrides: markVolatile(z.dict(z.number().min(1).max(1e7).step(1)).default({})),
|
|
78
78
|
maxOutputTokens: markVolatile(z.number().min(0).max(1e7).step(1)),
|
|
79
|
+
temperature: markVolatile(z.number().min(0).max(2)),
|
|
80
|
+
topK: markVolatile(z.number().min(1).max(1e6).step(1)),
|
|
81
|
+
topP: markVolatile(z.number().min(0).max(1)),
|
|
82
|
+
minP: markVolatile(z.number().min(0).max(1)),
|
|
83
|
+
seed: markVolatile(z.number().min(0).max(4294967295).step(1)),
|
|
84
|
+
repeatPenalty: markVolatile(z.number().min(0).max(2)),
|
|
85
|
+
repeatLastN: markVolatile(z.number().min(-1).max(1e6).step(1)),
|
|
86
|
+
numCtx: markVolatile(z.number().min(1).max(1e7).step(1)),
|
|
87
|
+
keepAlive: markVolatile(z.string()),
|
|
88
|
+
stop: markVolatile(z.array(z.string())),
|
|
79
89
|
accounts: markVolatile(z.array(z.object({
|
|
80
90
|
label: z.string(),
|
|
81
91
|
apiKeyEnv: z.string().role("credential-ref"),
|
|
@@ -109,6 +119,18 @@ function unwrapVolatileConfig(config) {
|
|
|
109
119
|
function positiveInt(value, fallback) {
|
|
110
120
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : fallback;
|
|
111
121
|
}
|
|
122
|
+
function numberInRange(value, min, max) {
|
|
123
|
+
return typeof value === "number" && Number.isFinite(value) && value >= min && value <= max ? value : void 0;
|
|
124
|
+
}
|
|
125
|
+
function integerInRange(value, min, max) {
|
|
126
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < min || value > max) return void 0;
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
function nonEmptyStrings(value) {
|
|
130
|
+
if (!Array.isArray(value)) return void 0;
|
|
131
|
+
const out = value.filter((entry) => typeof entry === "string" && entry.trim() !== "");
|
|
132
|
+
return out.length === 0 ? void 0 : out;
|
|
133
|
+
}
|
|
112
134
|
function recordOf(value) {
|
|
113
135
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
114
136
|
}
|
|
@@ -158,6 +180,15 @@ function ruleList(value) {
|
|
|
158
180
|
function resolveConfig(config) {
|
|
159
181
|
const apiKey = typeof config.apiKey === "string" && config.apiKey.trim() !== "" ? config.apiKey.trim() : void 0;
|
|
160
182
|
const visibleModels = Array.isArray(config.visibleModels) ? config.visibleModels.filter((id) => typeof id === "string" && id !== "") : [];
|
|
183
|
+
const temperature = numberInRange(config.temperature, 0, 2);
|
|
184
|
+
const topK = integerInRange(config.topK, 1, 1e6);
|
|
185
|
+
const topP = numberInRange(config.topP, 0, 1);
|
|
186
|
+
const minP = numberInRange(config.minP, 0, 1);
|
|
187
|
+
const seed = integerInRange(config.seed, 0, 4294967295);
|
|
188
|
+
const repeatPenalty = numberInRange(config.repeatPenalty, 0, 2);
|
|
189
|
+
const repeatLastN = integerInRange(config.repeatLastN, -1, 1e6);
|
|
190
|
+
const numCtx = integerInRange(config.numCtx, 1, 1e7);
|
|
191
|
+
const stop = nonEmptyStrings(config.stop);
|
|
161
192
|
return {
|
|
162
193
|
apiKeyEnv: typeof config.apiKeyEnv === "string" ? config.apiKeyEnv.trim() : DEFAULT_API_KEY_ENV,
|
|
163
194
|
...apiKey === void 0 ? {} : { apiKey },
|
|
@@ -176,6 +207,16 @@ function resolveConfig(config) {
|
|
|
176
207
|
...typeof config.contextWindow === "number" && Number.isInteger(config.contextWindow) && config.contextWindow > 0 ? { contextWindow: config.contextWindow } : {},
|
|
177
208
|
contextWindowOverrides: numberRecord(config.contextWindowOverrides),
|
|
178
209
|
...typeof config.maxOutputTokens === "number" && Number.isInteger(config.maxOutputTokens) && config.maxOutputTokens >= 0 ? { maxOutputTokens: config.maxOutputTokens } : {},
|
|
210
|
+
...temperature === void 0 ? {} : { temperature },
|
|
211
|
+
...topK === void 0 ? {} : { topK },
|
|
212
|
+
...topP === void 0 ? {} : { topP },
|
|
213
|
+
...minP === void 0 ? {} : { minP },
|
|
214
|
+
...seed === void 0 ? {} : { seed },
|
|
215
|
+
...repeatPenalty === void 0 ? {} : { repeatPenalty },
|
|
216
|
+
...repeatLastN === void 0 ? {} : { repeatLastN },
|
|
217
|
+
...numCtx === void 0 ? {} : { numCtx },
|
|
218
|
+
...typeof config.keepAlive === "string" && config.keepAlive.trim() !== "" ? { keepAlive: config.keepAlive.trim() } : {},
|
|
219
|
+
...stop === void 0 ? {} : { stop },
|
|
179
220
|
accounts: Array.isArray(config.accounts) ? config.accounts : [],
|
|
180
221
|
modelAccountRules: ruleList(config.modelAccountRules),
|
|
181
222
|
stickySession: config.stickySession !== false,
|
|
@@ -863,6 +904,74 @@ function formatUsd(value) {
|
|
|
863
904
|
if (Math.abs(value) >= .01) return `$${value.toFixed(3)}`;
|
|
864
905
|
return `$${value.toFixed(4)}`;
|
|
865
906
|
}
|
|
907
|
+
// src/reasoning.ts
|
|
908
|
+
const EFFORT_ORDER = [
|
|
909
|
+
"off",
|
|
910
|
+
"minimal",
|
|
911
|
+
"low",
|
|
912
|
+
"medium",
|
|
913
|
+
"high",
|
|
914
|
+
"xhigh",
|
|
915
|
+
"max"
|
|
916
|
+
];
|
|
917
|
+
const FAMILY_DEFAULTS = [
|
|
918
|
+
{
|
|
919
|
+
prefix: "glm-5.3",
|
|
920
|
+
effort: "max"
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
prefix: "glm-5.2",
|
|
924
|
+
effort: "max"
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
prefix: "kimi-k3",
|
|
928
|
+
effort: "max"
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
prefix: "kimi-k2",
|
|
932
|
+
effort: "high"
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
prefix: "deepseek-v4",
|
|
936
|
+
effort: "high"
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
prefix: "minimax-m3",
|
|
940
|
+
effort: "high"
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
prefix: "gpt-oss",
|
|
944
|
+
effort: "medium"
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
prefix: "nemotron",
|
|
948
|
+
effort: "low"
|
|
949
|
+
}
|
|
950
|
+
];
|
|
951
|
+
function normalizeEfforts(levels) {
|
|
952
|
+
const seen = /* @__PURE__ */ new Set();
|
|
953
|
+
for (const level of levels) {
|
|
954
|
+
const clean = level.trim().toLowerCase();
|
|
955
|
+
if (clean !== "") seen.add(clean);
|
|
956
|
+
}
|
|
957
|
+
const ordered = EFFORT_ORDER.filter((level) => seen.has(level));
|
|
958
|
+
const extra = [...seen].filter((level) => !EFFORT_ORDER.includes(level)).sort();
|
|
959
|
+
return [...ordered, ...extra];
|
|
960
|
+
}
|
|
961
|
+
function defaultEffortFor(id, levels) {
|
|
962
|
+
const family = id.split(":")[0]?.toLowerCase() ?? "";
|
|
963
|
+
for (const entry of FAMILY_DEFAULTS) if (family.startsWith(entry.prefix) && levels.includes(entry.effort)) return entry.effort;
|
|
964
|
+
}
|
|
965
|
+
/** Normalize boolean switches and level ladders, then apply the known family default. */
|
|
966
|
+
function normalizeThinking(id, levels, toggle, fallback) {
|
|
967
|
+
const reasoning = normalizeEfforts(levels);
|
|
968
|
+
if (reasoning.length === 0 && toggle) reasoning.push("off", "high");
|
|
969
|
+
const candidate = fallback !== void 0 && reasoning.includes(fallback) ? fallback : defaultEffortFor(id, reasoning) ?? (toggle && reasoning.includes("high") ? "high" : void 0);
|
|
970
|
+
return {
|
|
971
|
+
reasoning,
|
|
972
|
+
...candidate === void 0 ? {} : { defaultReasoning: candidate }
|
|
973
|
+
};
|
|
974
|
+
}
|
|
866
975
|
// src/catalog.ts
|
|
867
976
|
const CATALOG_TTL_MS = 6e5;
|
|
868
977
|
const CATALOG_TIMEOUT_MS = 15e3;
|
|
@@ -926,6 +1035,7 @@ function metaFromLive(entry, caps) {
|
|
|
926
1035
|
const toggle = (caps?.has("thinking") === true || levels.length > 0) && levels.length === 0;
|
|
927
1036
|
const modalities = strings(entry.input_modalities);
|
|
928
1037
|
const image = modalities.includes("image") || base?.input.includes("image") === true && modalities.length === 0;
|
|
1038
|
+
const normalized = normalizeThinking(id, levels.length > 0 ? levels : base?.reasoning ?? [], toggle || base?.reasoningToggle === true, str$1(entry.default_reasoning_level) ?? base?.defaultReasoning);
|
|
929
1039
|
return {
|
|
930
1040
|
id,
|
|
931
1041
|
name: str$1(entry.display_name) ?? id,
|
|
@@ -933,12 +1043,12 @@ function metaFromLive(entry, caps) {
|
|
|
933
1043
|
contextWindow: num$1(entry.context_window) ?? num$1(entry.max_context_window) ?? base?.contextWindow ?? 131072,
|
|
934
1044
|
maxTokens: base?.maxTokens ?? 32768,
|
|
935
1045
|
input: image ? ["text", "image"] : ["text"],
|
|
936
|
-
reasoning:
|
|
937
|
-
reasoningToggle: toggle || base?.reasoningToggle === true
|
|
1046
|
+
reasoning: normalized.reasoning,
|
|
1047
|
+
reasoningToggle: toggle || base?.reasoningToggle === true,
|
|
938
1048
|
tools: caps?.has("tools") === true || base?.tools === true || base === void 0,
|
|
939
1049
|
free: base?.free === true,
|
|
940
1050
|
available: entry.supported_in_api !== false && entry.visibility !== "hide",
|
|
941
|
-
...
|
|
1051
|
+
...normalized.defaultReasoning === void 0 ? {} : { defaultReasoning: normalized.defaultReasoning },
|
|
942
1052
|
cost: base?.cost ?? {
|
|
943
1053
|
input: 0,
|
|
944
1054
|
output: 0,
|
|
@@ -949,6 +1059,7 @@ function metaFromLive(entry, caps) {
|
|
|
949
1059
|
function metaFromProbe(id, probe) {
|
|
950
1060
|
if (probe === void 0) return void 0;
|
|
951
1061
|
const base = GENERATED_MODELS[id];
|
|
1062
|
+
const normalized = normalizeThinking(id, probe.reasoning.length > 0 ? probe.reasoning : base?.reasoning ?? [], probe.reasoningToggle || base?.reasoningToggle === true, base?.defaultReasoning);
|
|
952
1063
|
return {
|
|
953
1064
|
id,
|
|
954
1065
|
name: base?.name ?? id,
|
|
@@ -956,12 +1067,12 @@ function metaFromProbe(id, probe) {
|
|
|
956
1067
|
contextWindow: probe.contextWindow ?? base?.contextWindow ?? 131072,
|
|
957
1068
|
maxTokens: base?.maxTokens ?? 32768,
|
|
958
1069
|
input: [...probe.input],
|
|
959
|
-
reasoning:
|
|
1070
|
+
reasoning: normalized.reasoning,
|
|
960
1071
|
reasoningToggle: probe.reasoningToggle || base?.reasoningToggle === true,
|
|
961
1072
|
tools: probe.tools || base?.tools === true,
|
|
962
1073
|
free: base?.free === true,
|
|
963
1074
|
available: probe.available,
|
|
964
|
-
...
|
|
1075
|
+
...normalized.defaultReasoning === void 0 ? {} : { defaultReasoning: normalized.defaultReasoning },
|
|
965
1076
|
cost: base?.cost ?? {
|
|
966
1077
|
input: 0,
|
|
967
1078
|
output: 0,
|
|
@@ -1516,10 +1627,19 @@ function buildNativeBody(options, model, config, images) {
|
|
|
1516
1627
|
const tools = buildTools(options.tools);
|
|
1517
1628
|
const maxTokens = options.maxTokens ?? effectiveMaxTokens(model, config);
|
|
1518
1629
|
const think = nativeThink(options.reasoningEffort === void 0 ? void 0 : String(options.reasoningEffort), model);
|
|
1630
|
+
const temperature = options.temperature ?? config.temperature;
|
|
1631
|
+
const stop = options.stop ?? config.stop;
|
|
1519
1632
|
const nativeOptions = {
|
|
1520
|
-
...
|
|
1633
|
+
...temperature === void 0 ? {} : { temperature },
|
|
1634
|
+
...config.topK === void 0 ? {} : { top_k: config.topK },
|
|
1635
|
+
...config.topP === void 0 ? {} : { top_p: config.topP },
|
|
1636
|
+
...config.minP === void 0 ? {} : { min_p: config.minP },
|
|
1637
|
+
...config.seed === void 0 ? {} : { seed: config.seed },
|
|
1638
|
+
...config.repeatPenalty === void 0 ? {} : { repeat_penalty: config.repeatPenalty },
|
|
1639
|
+
...config.repeatLastN === void 0 ? {} : { repeat_last_n: config.repeatLastN },
|
|
1640
|
+
...config.numCtx === void 0 ? {} : { num_ctx: config.numCtx },
|
|
1521
1641
|
...maxTokens === void 0 || maxTokens <= 0 ? {} : { num_predict: maxTokens },
|
|
1522
|
-
...
|
|
1642
|
+
...stop === void 0 || stop.length === 0 ? {} : { stop }
|
|
1523
1643
|
};
|
|
1524
1644
|
return {
|
|
1525
1645
|
model: options.model,
|
|
@@ -1527,6 +1647,7 @@ function buildNativeBody(options, model, config, images) {
|
|
|
1527
1647
|
stream: true,
|
|
1528
1648
|
...tools === void 0 ? {} : { tools },
|
|
1529
1649
|
...think === void 0 ? {} : { think },
|
|
1650
|
+
...config.keepAlive === void 0 ? {} : { keep_alive: config.keepAlive },
|
|
1530
1651
|
...Object.keys(nativeOptions).length === 0 ? {} : { options: nativeOptions }
|
|
1531
1652
|
};
|
|
1532
1653
|
}
|
|
@@ -1617,6 +1738,8 @@ function buildChatBody(options, model, config, images) {
|
|
|
1617
1738
|
const maxTokens = options.maxTokens ?? effectiveMaxTokens(model, config);
|
|
1618
1739
|
const effort = options.reasoningEffort === void 0 ? void 0 : String(options.reasoningEffort);
|
|
1619
1740
|
const reasoning = effort === void 0 || effort === "" ? void 0 : effort === "off" ? "none" : effort;
|
|
1741
|
+
const temperature = options.temperature ?? config.temperature;
|
|
1742
|
+
const stop = options.stop ?? config.stop;
|
|
1620
1743
|
return {
|
|
1621
1744
|
model: options.model,
|
|
1622
1745
|
messages: buildChatMessages(options, images),
|
|
@@ -1626,10 +1749,12 @@ function buildChatBody(options, model, config, images) {
|
|
|
1626
1749
|
tools,
|
|
1627
1750
|
tool_choice: "auto"
|
|
1628
1751
|
},
|
|
1629
|
-
...
|
|
1752
|
+
...temperature === void 0 ? {} : { temperature },
|
|
1753
|
+
...config.topP === void 0 ? {} : { top_p: config.topP },
|
|
1754
|
+
...config.seed === void 0 ? {} : { seed: config.seed },
|
|
1630
1755
|
...maxTokens === void 0 || maxTokens <= 0 ? {} : { max_tokens: maxTokens },
|
|
1631
1756
|
...reasoning === void 0 ? {} : { reasoning_effort: reasoning },
|
|
1632
|
-
...
|
|
1757
|
+
...stop === void 0 || stop.length === 0 ? {} : { stop }
|
|
1633
1758
|
};
|
|
1634
1759
|
}
|
|
1635
1760
|
// src/provider-ids.ts
|
|
@@ -3823,6 +3948,16 @@ function publicConfig(config) {
|
|
|
3823
3948
|
contextWindow: config.contextWindow ?? null,
|
|
3824
3949
|
contextWindowOverrides: config.contextWindowOverrides,
|
|
3825
3950
|
maxOutputTokens: config.maxOutputTokens ?? null,
|
|
3951
|
+
temperature: config.temperature ?? null,
|
|
3952
|
+
topK: config.topK ?? null,
|
|
3953
|
+
topP: config.topP ?? null,
|
|
3954
|
+
minP: config.minP ?? null,
|
|
3955
|
+
seed: config.seed ?? null,
|
|
3956
|
+
repeatPenalty: config.repeatPenalty ?? null,
|
|
3957
|
+
repeatLastN: config.repeatLastN ?? null,
|
|
3958
|
+
numCtx: config.numCtx ?? null,
|
|
3959
|
+
keepAlive: config.keepAlive ?? "",
|
|
3960
|
+
stop: config.stop ?? [],
|
|
3826
3961
|
accounts: config.accounts.map((account) => ({
|
|
3827
3962
|
label: typeof account.label === "string" ? account.label : "",
|
|
3828
3963
|
apiKeyEnv: typeof account.apiKeyEnv === "string" ? account.apiKeyEnv : ""
|
|
@@ -4151,6 +4286,16 @@ function configOps(patch) {
|
|
|
4151
4286
|
if ("contextWindow" in patch) set("contextWindow", patch.contextWindow);
|
|
4152
4287
|
if ("contextWindowOverrides" in patch) set("contextWindowOverrides", cleanNumberRecord(patch.contextWindowOverrides));
|
|
4153
4288
|
if ("maxOutputTokens" in patch) set("maxOutputTokens", patch.maxOutputTokens);
|
|
4289
|
+
if ("temperature" in patch) set("temperature", patch.temperature);
|
|
4290
|
+
if ("topK" in patch) set("topK", patch.topK);
|
|
4291
|
+
if ("topP" in patch) set("topP", patch.topP);
|
|
4292
|
+
if ("minP" in patch) set("minP", patch.minP);
|
|
4293
|
+
if ("seed" in patch) set("seed", patch.seed);
|
|
4294
|
+
if ("repeatPenalty" in patch) set("repeatPenalty", patch.repeatPenalty);
|
|
4295
|
+
if ("repeatLastN" in patch) set("repeatLastN", patch.repeatLastN);
|
|
4296
|
+
if ("numCtx" in patch) set("numCtx", patch.numCtx);
|
|
4297
|
+
if ("keepAlive" in patch) set("keepAlive", patch.keepAlive);
|
|
4298
|
+
if ("stop" in patch) set("stop", cleanStringArray(patch.stop));
|
|
4154
4299
|
if ("accounts" in patch) {
|
|
4155
4300
|
const accounts = cleanAccounts(patch.accounts);
|
|
4156
4301
|
for (const account of accounts) if (account.apiKeyEnv !== "" && !isCredentialRef(account.apiKeyEnv)) throw new Error("invalid credential reference");
|
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.19",
|
|
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 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/local.test.ts",
|
|
76
|
+
"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/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/local.test.ts tests/reasoning.test.ts",
|
|
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"
|