@goodandready/dsh-ollama-cloud-provider 0.1.22 → 0.1.24

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,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.24 — 2026-11-05
4
+
5
+ - Added per-model capability/thinking overrides (`modelOverrides`) for
6
+ context, vision, thinking, reasoning efforts/default and enabled; the
7
+ override wins over manual entries and live discovery. Disabled models are
8
+ hidden from the picker.
9
+ - Added a model override editor exposing context, input/output/cacheRead
10
+ prices, visibility, vision/thinking/enabled tri-state and reset-to-live.
11
+ - `/api/show` capability probes remain TTL-cached and are invalidated on local
12
+ pull/remove.
13
+ - Added override precedence and validation tests; 129/129.
14
+
15
+ ## 0.1.23 — 2026-11-05
16
+
17
+ - Richer model catalog rows grouped by effective context, collapsible groups,
18
+ drag reorder persisted as `modelOrder`, and context labels/badges.
19
+ - Added manual catalog entries/overrides with id, display name, context,
20
+ max output, vision, thinking, reasoning efforts/default and tools. Entries
21
+ merge over live discovery; disabled entries are hidden from the picker and
22
+ invalid ids are rejected.
23
+ - Added model grouping/reorder/render tests and manual merge tests; 128/128.
24
+
3
25
  ## 0.1.22 — 2026-11-05
4
26
 
5
27
  - Added `/ollama-context` with 4k/8k/16k/32k/64k/128k presets, custom token
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.22
140
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.24
141
141
  # DSH Desktop:
142
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.22
142
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.24
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.22.tgz
148
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.tgz
149
149
  # DSH Desktop:
150
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.22.tgz
150
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.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.22
106
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.24
107
107
  # DSH Desktop:
108
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.22
108
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.24
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.22.tgz
114
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.tgz
115
115
  # DSH Desktop:
116
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.22.tgz
116
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.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.22
105
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.24
106
106
  # DSH 桌面端:
107
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.22
107
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.24
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.22.tgz
113
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.tgz
114
114
  # DSH 桌面端:
115
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.22.tgz
115
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.tgz
116
116
  ```
117
117
 
118
118
  安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
package/lib/client.js CHANGED
@@ -124,6 +124,31 @@ window.__ModuleLoader__.load({
124
124
  attemptTimeoutHint: "Whole-attempt timeout; a fresh budget is created for every retry.",
125
125
  maxOutputTokens: "Output limit (0 = provider default)",
126
126
  contextWindow: "Context window override",
127
+ contextGroup: "context",
128
+ dragOrder: "Drag to reorder",
129
+ manualModels: "Manual catalog entries",
130
+ manualModelsHint: "Add or override models beyond live discovery. Disabled entries stay visible here but are hidden from the picker.",
131
+ addManualModel: "Add model",
132
+ removeManualModel: "Remove entry",
133
+ modelId: "Model id",
134
+ modelName: "Display name",
135
+ maxTokens: "Max output tokens",
136
+ reasoningEfforts: "Reasoning efforts",
137
+ manualEffortsHint: "Comma-separated levels, e.g. off, low, medium, high.",
138
+ defaultReasoning: "Default effort",
139
+ enabled: "Enabled",
140
+ edit: "Edit",
141
+ overrideEditor: "Model overrides",
142
+ resetToLive: "Reset to live",
143
+ priceInput: "Input $/1M",
144
+ priceOutput: "Output $/1M",
145
+ priceCacheRead: "Cache read $/1M",
146
+ visibility: "Visibility",
147
+ inherit: "Inherit",
148
+ show: "Show",
149
+ hide: "Hide",
150
+ yes: "Yes",
151
+ no: "No",
127
152
  generation: "Generation defaults",
128
153
  generationHint: "Native Ollama defaults. Empty fields are not sent; request options still win.",
129
154
  temperature: "Temperature",
@@ -336,6 +361,31 @@ window.__ModuleLoader__.load({
336
361
  attemptTimeoutHint: "整次尝试超时;每次重试都会创建新的预算。",
337
362
  maxOutputTokens: "输出上限(0 = 提供方默认)",
338
363
  contextWindow: "上下文窗口覆盖",
364
+ contextGroup: "上下文",
365
+ dragOrder: "拖动排序",
366
+ manualModels: "手动目录条目",
367
+ manualModelsHint: "在实时发现之外添加或覆盖模型。禁用条目仍在此显示,但会从选择器隐藏。",
368
+ addManualModel: "添加模型",
369
+ removeManualModel: "删除条目",
370
+ modelId: "模型 ID",
371
+ modelName: "显示名称",
372
+ maxTokens: "最大输出 token",
373
+ reasoningEfforts: "推理档位",
374
+ manualEffortsHint: "逗号分隔,例如 off, low, medium, high。",
375
+ defaultReasoning: "默认档位",
376
+ enabled: "启用",
377
+ edit: "编辑",
378
+ overrideEditor: "模型覆盖",
379
+ resetToLive: "恢复实时值",
380
+ priceInput: "输入 $/1M",
381
+ priceOutput: "输出 $/1M",
382
+ priceCacheRead: "缓存读取 $/1M",
383
+ visibility: "可见性",
384
+ inherit: "继承",
385
+ show: "显示",
386
+ hide: "隐藏",
387
+ yes: "是",
388
+ no: "否",
339
389
  generation: "生成默认值",
340
390
  generationHint: "Ollama 原生默认值;空字段不发送,请求参数优先。",
341
391
  temperature: "Temperature",
@@ -1675,6 +1725,34 @@ window.__ModuleLoader__.load({
1675
1725
  stickySession: state.config.stickySession,
1676
1726
  visibleModels: state.config.showAllModels ? allIds : [...state.config.visibleModels],
1677
1727
  filterModelsByPlan: state.config.filterModelsByPlan,
1728
+ modelVisibility: { ...state.config.modelVisibility },
1729
+ manualModels: (state.config.manualModels ?? []).map((model) => ({
1730
+ id: model.id,
1731
+ enabled: model.enabled !== false,
1732
+ name: model.name ?? "",
1733
+ contextWindow: model.contextWindow === void 0 ? "" : String(model.contextWindow),
1734
+ maxTokens: model.maxTokens === void 0 ? "" : String(model.maxTokens),
1735
+ image: model.image === true,
1736
+ thinking: model.thinking === true,
1737
+ reasoningEfforts: (model.reasoningEfforts ?? []).join(", "),
1738
+ defaultReasoning: model.defaultReasoning ?? "",
1739
+ tools: model.tools === true
1740
+ })),
1741
+ modelOrder: [...state.config.modelOrder ?? []],
1742
+ contextWindowOverrides: Object.fromEntries(Object.entries(state.config.contextWindowOverrides).map(([id, value]) => [id, String(value)])),
1743
+ priceOverrides: Object.fromEntries(Object.entries(state.config.priceOverrides).map(([id, price]) => [id, {
1744
+ input: price.input === void 0 ? "" : String(price.input),
1745
+ output: price.output === void 0 ? "" : String(price.output),
1746
+ cacheRead: price.cacheRead === void 0 ? "" : String(price.cacheRead)
1747
+ }])),
1748
+ modelOverrides: Object.fromEntries(Object.entries(state.config.modelOverrides ?? {}).map(([id, override]) => [id, {
1749
+ contextWindow: override.contextWindow === void 0 ? "" : String(override.contextWindow),
1750
+ image: override.image === void 0 ? "" : override.image ? "yes" : "no",
1751
+ thinking: override.thinking === void 0 ? "" : override.thinking ? "yes" : "no",
1752
+ reasoningEfforts: (override.reasoningEfforts ?? []).join(", "),
1753
+ defaultEffort: override.defaultEffort ?? "",
1754
+ enabled: override.enabled === void 0 ? "" : override.enabled ? "yes" : "no"
1755
+ }])),
1678
1756
  showAll: state.config.showAllModels,
1679
1757
  modelTransports: { ...state.config.modelTransports }
1680
1758
  };
@@ -1736,6 +1814,41 @@ window.__ModuleLoader__.load({
1736
1814
  visibleModels: draft.showAll ? [] : draft.visibleModels,
1737
1815
  showAllModels: draft.showAll,
1738
1816
  filterModelsByPlan: draft.filterModelsByPlan,
1817
+ modelVisibility: draft.modelVisibility,
1818
+ manualModels: draft.manualModels.filter((model) => model.id.trim() !== "").map((model) => ({
1819
+ id: model.id.trim(),
1820
+ enabled: model.enabled,
1821
+ ...model.name.trim() === "" ? {} : { name: model.name.trim() },
1822
+ ...numberOrNull(model.contextWindow) === null ? {} : { contextWindow: numberOrNull(model.contextWindow) },
1823
+ ...numberOrNull(model.maxTokens) === null ? {} : { maxTokens: numberOrNull(model.maxTokens) },
1824
+ image: model.image,
1825
+ thinking: model.thinking,
1826
+ ...stopList(model.reasoningEfforts).length === 0 ? {} : { reasoningEfforts: stopList(model.reasoningEfforts) },
1827
+ ...model.defaultReasoning.trim() === "" ? {} : { defaultReasoning: model.defaultReasoning.trim() },
1828
+ tools: model.tools
1829
+ })),
1830
+ modelOrder: draft.modelOrder.filter((id) => id !== ""),
1831
+ contextWindowOverrides: Object.fromEntries(Object.entries(draft.contextWindowOverrides).map(([id, value]) => [id, numberOrNull(value)]).filter((entry) => entry[1] !== null && entry[1] > 0)),
1832
+ priceOverrides: Object.fromEntries(Object.entries(draft.priceOverrides).map(([id, price]) => {
1833
+ const out = {};
1834
+ for (const [field, value] of Object.entries(price)) {
1835
+ const parsed = numberOrNull(value);
1836
+ if (parsed !== null) out[field] = parsed;
1837
+ }
1838
+ return [id, out];
1839
+ }).filter((entry) => Object.keys(entry[1]).length > 0)),
1840
+ modelOverrides: Object.fromEntries(Object.entries(draft.modelOverrides).map(([id, override]) => {
1841
+ const contextWindow = numberOrNull(override.contextWindow);
1842
+ const efforts = stopList(override.reasoningEfforts);
1843
+ return [id, {
1844
+ ...contextWindow === null || contextWindow <= 0 ? {} : { contextWindow },
1845
+ ...override.image === "" ? {} : { image: override.image === "yes" },
1846
+ ...override.thinking === "" ? {} : { thinking: override.thinking === "yes" },
1847
+ ...efforts.length === 0 ? {} : { reasoningEfforts: efforts },
1848
+ ...override.defaultEffort.trim() === "" ? {} : { defaultEffort: override.defaultEffort.trim() },
1849
+ ...override.enabled === "" ? {} : { enabled: override.enabled === "yes" }
1850
+ }];
1851
+ }).filter((entry) => Object.keys(entry[1]).length > 0)),
1739
1852
  modelTransports: Object.fromEntries(Object.entries(draft.modelTransports).filter(([, value]) => value !== ""))
1740
1853
  };
1741
1854
  }
@@ -1993,6 +2106,253 @@ window.__ModuleLoader__.load({
1993
2106
  ]
1994
2107
  });
1995
2108
  }
2109
+ // src/client/model-groups.ts
2110
+ function formatContext(value) {
2111
+ if (value >= 1e6) return `${(value / 1e6).toFixed(value % 1e6 === 0 ? 0 : 1)}M`;
2112
+ return `${Math.round(value / 1024)}K`;
2113
+ }
2114
+ /** Stable groups by effective context, richest first. */
2115
+ function groupModels(models, contextLabel) {
2116
+ const groups = /* @__PURE__ */ new Map();
2117
+ for (const model of models) {
2118
+ const existing = groups.get(model.contextWindow);
2119
+ if (existing !== void 0) {
2120
+ existing.models.push(model);
2121
+ continue;
2122
+ }
2123
+ groups.set(model.contextWindow, {
2124
+ key: String(model.contextWindow),
2125
+ label: `${formatContext(model.contextWindow)} ${contextLabel}`,
2126
+ contextWindow: model.contextWindow,
2127
+ models: [model]
2128
+ });
2129
+ }
2130
+ return [...groups.values()].sort((left, right) => right.contextWindow - left.contextWindow);
2131
+ }
2132
+ function reorderIds(order, ids, from, to) {
2133
+ const base = [.../* @__PURE__ */ new Set([...order, ...ids])];
2134
+ const source = base.indexOf(from);
2135
+ const target = base.indexOf(to);
2136
+ if (source < 0 || target < 0 || source === target) return base;
2137
+ const [moved] = base.splice(source, 1);
2138
+ if (moved === void 0) return base;
2139
+ const insertAt = source < target ? target - 1 : target;
2140
+ base.splice(insertAt, 0, moved);
2141
+ return base;
2142
+ }
2143
+ // src/client/model-override-editor.tsx
2144
+ const blankOverride = {
2145
+ contextWindow: "",
2146
+ image: "",
2147
+ thinking: "",
2148
+ reasoningEfforts: "",
2149
+ defaultEffort: "",
2150
+ enabled: ""
2151
+ };
2152
+ function ModelOverrideEditor(props) {
2153
+ const { model, draft, t, update, close } = props;
2154
+ const override = draft.modelOverrides[model.id] ?? blankOverride;
2155
+ const price = draft.priceOverrides[model.id] ?? {
2156
+ input: "",
2157
+ output: "",
2158
+ cacheRead: ""
2159
+ };
2160
+ const context = draft.contextWindowOverrides[model.id] ?? "";
2161
+ const visibility = draft.modelVisibility[model.id];
2162
+ const updateOverride = (patch) => {
2163
+ update({ modelOverrides: {
2164
+ ...draft.modelOverrides,
2165
+ [model.id]: {
2166
+ ...override,
2167
+ ...patch
2168
+ }
2169
+ } });
2170
+ };
2171
+ const updatePrice = (patch) => {
2172
+ update({ priceOverrides: {
2173
+ ...draft.priceOverrides,
2174
+ [model.id]: {
2175
+ ...price,
2176
+ ...patch
2177
+ }
2178
+ } });
2179
+ };
2180
+ const updateVisibility = (value) => {
2181
+ const next = { ...draft.modelVisibility };
2182
+ if (value === "inherit") delete next[model.id];
2183
+ else next[model.id] = value === "show";
2184
+ update({ modelVisibility: next });
2185
+ };
2186
+ const reset = () => {
2187
+ const nextContext = { ...draft.contextWindowOverrides };
2188
+ const nextPrice = { ...draft.priceOverrides };
2189
+ const nextVisibility = { ...draft.modelVisibility };
2190
+ const nextOverrides = { ...draft.modelOverrides };
2191
+ delete nextContext[model.id];
2192
+ delete nextPrice[model.id];
2193
+ delete nextVisibility[model.id];
2194
+ delete nextOverrides[model.id];
2195
+ update({
2196
+ contextWindowOverrides: nextContext,
2197
+ priceOverrides: nextPrice,
2198
+ modelVisibility: nextVisibility,
2199
+ modelOverrides: nextOverrides
2200
+ });
2201
+ };
2202
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
2203
+ className: "ocl-model-section",
2204
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2205
+ className: "ocl-model-section-head",
2206
+ children: [
2207
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
2208
+ t("overrideEditor"),
2209
+ ": ",
2210
+ model.id
2211
+ ] }),
2212
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2213
+ type: "button",
2214
+ className: "ocl-button",
2215
+ onClick: reset,
2216
+ children: t("resetToLive")
2217
+ }),
2218
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2219
+ type: "button",
2220
+ className: "ocl-button",
2221
+ onClick: close,
2222
+ children: t("close")
2223
+ })
2224
+ ]
2225
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2226
+ className: "ocl-grid",
2227
+ children: [
2228
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
2229
+ label: t("contextWindow"),
2230
+ value: context,
2231
+ onChange: (value) => update({ contextWindowOverrides: {
2232
+ ...draft.contextWindowOverrides,
2233
+ [model.id]: value
2234
+ } })
2235
+ }),
2236
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
2237
+ label: t("priceInput"),
2238
+ type: "number",
2239
+ value: price.input,
2240
+ onChange: (value) => updatePrice({ input: value })
2241
+ }),
2242
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
2243
+ label: t("priceOutput"),
2244
+ type: "number",
2245
+ value: price.output,
2246
+ onChange: (value) => updatePrice({ output: value })
2247
+ }),
2248
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
2249
+ label: t("priceCacheRead"),
2250
+ type: "number",
2251
+ value: price.cacheRead,
2252
+ onChange: (value) => updatePrice({ cacheRead: value })
2253
+ }),
2254
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2255
+ className: "ocl-field",
2256
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("visibility") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
2257
+ className: "ocl-select",
2258
+ value: visibility === void 0 ? "inherit" : visibility ? "show" : "hide",
2259
+ onChange: (event) => updateVisibility(event.target.value),
2260
+ children: [
2261
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2262
+ value: "inherit",
2263
+ children: t("inherit")
2264
+ }),
2265
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2266
+ value: "show",
2267
+ children: t("show")
2268
+ }),
2269
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2270
+ value: "hide",
2271
+ children: t("hide")
2272
+ })
2273
+ ]
2274
+ })]
2275
+ }),
2276
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2277
+ className: "ocl-field",
2278
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("vision") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
2279
+ className: "ocl-select",
2280
+ value: override.image,
2281
+ onChange: (event) => updateOverride({ image: event.target.value }),
2282
+ children: [
2283
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2284
+ value: "",
2285
+ children: t("inherit")
2286
+ }),
2287
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2288
+ value: "yes",
2289
+ children: t("yes")
2290
+ }),
2291
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2292
+ value: "no",
2293
+ children: t("no")
2294
+ })
2295
+ ]
2296
+ })]
2297
+ }),
2298
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2299
+ className: "ocl-field",
2300
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("reasoning") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
2301
+ className: "ocl-select",
2302
+ value: override.thinking,
2303
+ onChange: (event) => updateOverride({ thinking: event.target.value }),
2304
+ children: [
2305
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2306
+ value: "",
2307
+ children: t("inherit")
2308
+ }),
2309
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2310
+ value: "yes",
2311
+ children: t("yes")
2312
+ }),
2313
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2314
+ value: "no",
2315
+ children: t("no")
2316
+ })
2317
+ ]
2318
+ })]
2319
+ }),
2320
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2321
+ className: "ocl-field",
2322
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("enabled") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
2323
+ className: "ocl-select",
2324
+ value: override.enabled,
2325
+ onChange: (event) => updateOverride({ enabled: event.target.value }),
2326
+ children: [
2327
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2328
+ value: "",
2329
+ children: t("inherit")
2330
+ }),
2331
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2332
+ value: "yes",
2333
+ children: t("yes")
2334
+ }),
2335
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2336
+ value: "no",
2337
+ children: t("no")
2338
+ })
2339
+ ]
2340
+ })]
2341
+ }),
2342
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
2343
+ label: t("reasoningEfforts"),
2344
+ value: override.reasoningEfforts,
2345
+ onChange: (value) => updateOverride({ reasoningEfforts: value })
2346
+ }),
2347
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
2348
+ label: t("defaultReasoning"),
2349
+ value: override.defaultEffort,
2350
+ onChange: (value) => updateOverride({ defaultEffort: value })
2351
+ })
2352
+ ]
2353
+ })]
2354
+ });
2355
+ }
1996
2356
  // src/client/update-state.ts
1997
2357
  function updateBadge(status) {
1998
2358
  if (status.latestCheckFailed) return "failed";
@@ -2113,10 +2473,22 @@ window.__ModuleLoader__.load({
2113
2473
  }
2114
2474
  // src/client/settings-page.tsx
2115
2475
  function ModelEntry(props) {
2116
- const { model, visible, transport, onVisible, onTransport, t } = props;
2476
+ const { model, visible, transport, onVisible, onTransport, onDragStart, onDrop, onEdit, dragging, t } = props;
2117
2477
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2118
- className: "ocl-model",
2478
+ className: `ocl-model${dragging === true ? " ocl-dragging" : ""}`,
2479
+ draggable: onDragStart !== void 0,
2480
+ onDragStart,
2481
+ onDragOver: (event) => {
2482
+ if (onDrop !== void 0) event.preventDefault();
2483
+ },
2484
+ onDrop,
2119
2485
  children: [
2486
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2487
+ className: "ocl-drag-handle",
2488
+ title: t("dragOrder"),
2489
+ "aria-hidden": "true",
2490
+ children: "⋮⋮"
2491
+ }),
2120
2492
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2121
2493
  type: "checkbox",
2122
2494
  checked: visible,
@@ -2176,6 +2548,12 @@ window.__ModuleLoader__.load({
2176
2548
  })
2177
2549
  ]
2178
2550
  }),
2551
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2552
+ type: "button",
2553
+ className: "ocl-button",
2554
+ onClick: onEdit,
2555
+ children: t("edit")
2556
+ }),
2179
2557
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
2180
2558
  className: "ocl-select",
2181
2559
  value: transport === "" ? model.transport : transport,
@@ -2202,6 +2580,9 @@ window.__ModuleLoader__.load({
2202
2580
  const [loading, setLoading] = (0, react.useState)(true);
2203
2581
  const [saving, setSaving] = (0, react.useState)(false);
2204
2582
  const [search, setSearch] = (0, react.useState)("");
2583
+ const [dragId, setDragId] = (0, react.useState)(null);
2584
+ const [editingModel, setEditingModel] = (0, react.useState)(null);
2585
+ const [collapsedGroups, setCollapsedGroups] = (0, react.useState)({});
2205
2586
  const [keyDraft, setKeyDraft] = (0, react.useState)("");
2206
2587
  const [accountKeys, setAccountKeys] = (0, react.useState)({});
2207
2588
  const [testModel, setTestModel] = (0, react.useState)("gpt-oss:120b");
@@ -2309,6 +2690,41 @@ window.__ModuleLoader__.load({
2309
2690
  const worst = worstUsedPercent(report);
2310
2691
  const activeAccount = state.accounts.find((account) => account.active);
2311
2692
  const filtered = state.models.filter((model) => search.trim() === "" || model.id.toLowerCase().includes(search.trim().toLowerCase()));
2693
+ const groups = groupModels(filtered, t("contextGroup"));
2694
+ const modelIds = state.models.map((model) => model.id);
2695
+ const moveModel = (from, to) => {
2696
+ if (from === to) return;
2697
+ update({ modelOrder: reorderIds(draft.modelOrder, modelIds, from, to) });
2698
+ };
2699
+ const toggleGroup = (key) => {
2700
+ setCollapsedGroups((current) => ({
2701
+ ...current,
2702
+ [key]: current[key] !== true
2703
+ }));
2704
+ };
2705
+ const addManualModel = () => {
2706
+ update({ manualModels: [...draft.manualModels, {
2707
+ id: "",
2708
+ enabled: true,
2709
+ name: "",
2710
+ contextWindow: "",
2711
+ maxTokens: "",
2712
+ image: false,
2713
+ thinking: false,
2714
+ reasoningEfforts: "",
2715
+ defaultReasoning: "",
2716
+ tools: true
2717
+ }] });
2718
+ };
2719
+ const updateManual = (index, patch) => {
2720
+ update({ manualModels: draft.manualModels.map((model, position) => position === index ? {
2721
+ ...model,
2722
+ ...patch
2723
+ } : model) });
2724
+ };
2725
+ const removeManual = (index) => {
2726
+ update({ manualModels: draft.manualModels.filter((_model, position) => position !== index) });
2727
+ };
2312
2728
  const toggleModel = (id, visible) => {
2313
2729
  const current = new Set(draft.visibleModels);
2314
2730
  if (visible) current.add(id);
@@ -2923,22 +3339,153 @@ window.__ModuleLoader__.load({
2923
3339
  children: filtered.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2924
3340
  className: "ocl-hint",
2925
3341
  children: t("modelsEmpty")
2926
- }) : filtered.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelEntry, {
2927
- model,
2928
- visible: draft.showAll || draft.visibleModels.includes(model.id),
2929
- transport: draft.modelTransports[model.id] ?? "",
2930
- onVisible: (visible) => toggleModel(model.id, visible),
2931
- onTransport: (transport) => {
2932
- const next = { ...draft.modelTransports };
2933
- if (transport === "") delete next[model.id];
2934
- else next[model.id] = transport;
2935
- update({ modelTransports: next });
2936
- },
2937
- t
2938
- }, model.id))
3342
+ }) : groups.map((group) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3343
+ className: "ocl-model-group",
3344
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
3345
+ type: "button",
3346
+ className: "ocl-model-group-head",
3347
+ onClick: () => toggleGroup(group.key),
3348
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
3349
+ collapsedGroups[group.key] === true ? "▸" : "▾",
3350
+ " ",
3351
+ group.label
3352
+ ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3353
+ className: "ocl-badge",
3354
+ children: group.models.length
3355
+ })]
3356
+ }), collapsedGroups[group.key] === true ? null : group.models.map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelEntry, {
3357
+ model,
3358
+ visible: draft.showAll || draft.visibleModels.includes(model.id),
3359
+ transport: draft.modelTransports[model.id] ?? "",
3360
+ dragging: dragId === model.id,
3361
+ onDragStart: () => setDragId(model.id),
3362
+ onDrop: () => {
3363
+ if (dragId !== null) moveModel(dragId, model.id);
3364
+ setDragId(null);
3365
+ },
3366
+ onEdit: () => setEditingModel(model.id),
3367
+ onVisible: (visible) => toggleModel(model.id, visible),
3368
+ onTransport: (transport) => {
3369
+ const next = { ...draft.modelTransports };
3370
+ if (transport === "") delete next[model.id];
3371
+ else next[model.id] = transport;
3372
+ update({ modelTransports: next });
3373
+ },
3374
+ t
3375
+ }, model.id))]
3376
+ }, group.key))
2939
3377
  })
2940
3378
  ]
2941
3379
  }),
3380
+ editingModel !== null && state.models.some((model) => model.id === editingModel) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
3381
+ className: "ocl-card",
3382
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelOverrideEditor, {
3383
+ model: state.models.find((model) => model.id === editingModel),
3384
+ draft,
3385
+ t,
3386
+ update,
3387
+ close: () => setEditingModel(null)
3388
+ })
3389
+ }),
3390
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
3391
+ className: "ocl-card",
3392
+ children: [
3393
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
3394
+ className: "ocl-card-title",
3395
+ children: [t("manualModels"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3396
+ type: "button",
3397
+ className: "ocl-button",
3398
+ onClick: addManualModel,
3399
+ children: t("addManualModel")
3400
+ })]
3401
+ }),
3402
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3403
+ className: "ocl-hint",
3404
+ children: t("manualModelsHint")
3405
+ }),
3406
+ draft.manualModels.map((model, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3407
+ className: "ocl-model-section",
3408
+ children: [
3409
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3410
+ className: "ocl-grid",
3411
+ children: [
3412
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
3413
+ label: t("modelId"),
3414
+ value: model.id,
3415
+ onChange: (value) => updateManual(index, { id: value })
3416
+ }),
3417
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
3418
+ label: t("modelName"),
3419
+ value: model.name,
3420
+ onChange: (value) => updateManual(index, { name: value })
3421
+ }),
3422
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
3423
+ label: t("contextWindow"),
3424
+ type: "number",
3425
+ value: model.contextWindow,
3426
+ onChange: (value) => updateManual(index, { contextWindow: value })
3427
+ }),
3428
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
3429
+ label: t("maxTokens"),
3430
+ type: "number",
3431
+ value: model.maxTokens,
3432
+ onChange: (value) => updateManual(index, { maxTokens: value })
3433
+ }),
3434
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
3435
+ label: t("reasoningEfforts"),
3436
+ hint: t("manualEffortsHint"),
3437
+ value: model.reasoningEfforts,
3438
+ onChange: (value) => updateManual(index, { reasoningEfforts: value })
3439
+ }),
3440
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
3441
+ label: t("defaultReasoning"),
3442
+ value: model.defaultReasoning,
3443
+ onChange: (value) => updateManual(index, { defaultReasoning: value })
3444
+ })
3445
+ ]
3446
+ }),
3447
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3448
+ className: "ocl-row",
3449
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3450
+ type: "checkbox",
3451
+ checked: model.enabled,
3452
+ onChange: (event) => updateManual(index, { enabled: event.target.checked })
3453
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("enabled") })]
3454
+ }),
3455
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3456
+ className: "ocl-row",
3457
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3458
+ type: "checkbox",
3459
+ checked: model.image,
3460
+ onChange: (event) => updateManual(index, { image: event.target.checked })
3461
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("vision") })]
3462
+ }),
3463
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3464
+ className: "ocl-row",
3465
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3466
+ type: "checkbox",
3467
+ checked: model.thinking,
3468
+ onChange: (event) => updateManual(index, { thinking: event.target.checked })
3469
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("reasoning") })]
3470
+ }),
3471
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3472
+ className: "ocl-row",
3473
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3474
+ type: "checkbox",
3475
+ checked: model.tools,
3476
+ onChange: (event) => updateManual(index, { tools: event.target.checked })
3477
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("tools") })]
3478
+ }),
3479
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3480
+ type: "button",
3481
+ className: "ocl-button ocl-button-danger",
3482
+ onClick: () => removeManual(index),
3483
+ children: t("removeManualModel")
3484
+ })
3485
+ ]
3486
+ }, `${model.id}-${index}`))
3487
+ ]
3488
+ }),
2942
3489
  state !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LocalModelsCard, {
2943
3490
  t,
2944
3491
  config: state.config,
@@ -3277,7 +3824,11 @@ window.__ModuleLoader__.load({
3277
3824
  .ocl-bar-fill-warn { background: var(--ocl-warning); opacity: 1; }
3278
3825
  .ocl-bar-fill-bad { background: var(--ocl-danger); opacity: 1; }
3279
3826
  .ocl-models { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; padding-right: 4px; }
3280
- .ocl-model { display: grid; grid-template-columns: 22px minmax(0,1fr) 120px; gap: 8px; align-items: center; font-size: 12px; padding: 3px 0; }
3827
+ .ocl-model { display: grid; grid-template-columns: 16px 22px minmax(0,1fr) auto 120px; gap: 8px; align-items: center; font-size: 12px; padding: 3px 0; }
3828
+ .ocl-drag-handle { cursor: grab; color: var(--ocl-text-secondary); user-select: none; }
3829
+ .ocl-dragging { opacity: 0.5; }
3830
+ .ocl-model-group { display: flex; flex-direction: column; gap: 2px; }
3831
+ .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; }
3281
3832
  .ocl-model-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3282
3833
  .ocl-model-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--ocl-text-secondary); font-size: 11px; }
3283
3834
  .ocl-model-legend > span { display: inline-flex; align-items: center; gap: 5px; }
package/lib/index.d.ts CHANGED
@@ -23,6 +23,26 @@ interface ModelPriceOverride {
23
23
  * Plugin configuration. Every field except the literal `apiKey` is volatile:
24
24
  * the harness projects settings forms from schema fields carrying that marker.
25
25
  */
26
+ interface ModelOverride {
27
+ contextWindow?: number;
28
+ image?: boolean;
29
+ thinking?: boolean;
30
+ reasoningEfforts?: string[];
31
+ defaultEffort?: string;
32
+ enabled?: boolean;
33
+ }
34
+ interface ManualModel {
35
+ id: string;
36
+ enabled?: boolean;
37
+ name?: string;
38
+ contextWindow?: number;
39
+ maxTokens?: number;
40
+ image?: boolean;
41
+ thinking?: boolean;
42
+ reasoningEfforts?: string[];
43
+ defaultReasoning?: string;
44
+ tools?: boolean;
45
+ }
26
46
  interface Config {
27
47
  /** Credential reference resolved per request; defaults to `OLLAMA_API_KEY`. */
28
48
  apiKeyEnv?: string;
@@ -52,6 +72,12 @@ interface Config {
52
72
  showAllModels?: boolean;
53
73
  /** Per-model visibility overrides; wins over `visibleModels`. */
54
74
  modelVisibility?: Record<string, boolean>;
75
+ /** Manual catalog entries and overrides; merged over live discovery. */
76
+ manualModels?: ManualModel[];
77
+ /** Per-model capability/thinking overrides; wins over manual entries. */
78
+ modelOverrides?: Record<string, ModelOverride>;
79
+ /** Stable picker order; ids not listed follow by name. */
80
+ modelOrder?: string[];
55
81
  /** Hide models the cloud marks unsupported in the API; defaults to true. */
56
82
  filterModelsByPlan?: boolean;
57
83
  /** Global context-window override. */
@@ -108,6 +134,9 @@ interface ResolvedConfig {
108
134
  visibleModels: readonly string[];
109
135
  showAllModels: boolean;
110
136
  modelVisibility: Readonly<Record<string, boolean>>;
137
+ manualModels: readonly ManualModel[];
138
+ modelOverrides: Readonly<Record<string, ModelOverride>>;
139
+ modelOrder: readonly string[];
111
140
  filterModelsByPlan: boolean;
112
141
  contextWindow?: number;
113
142
  contextWindowOverrides: Readonly<Record<string, number>>;
package/lib/index.js CHANGED
@@ -77,7 +77,7 @@ const DEFAULT_API_BASE = "https://ollama.com";
77
77
  const DEFAULT_OPENAI_BASE = "https://ollama.com/v1";
78
78
  const DEFAULT_USAGE_URL = "https://ollama.com/api/usage";
79
79
  const DEFAULT_BALANCE_URL = "https://ollama.com/api/balance";
80
- const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.22";
80
+ const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.24";
81
81
  const DEFAULT_CONTEXT_WINDOW = 131072;
82
82
  const DEFAULT_MAX_TOKENS = 32768;
83
83
  const DEFAULT_GENERATE_MAX_TOKENS = 131072;
@@ -100,6 +100,27 @@ const Config = z.object({
100
100
  visibleModels: markVolatile(z.array(z.string()).default([])),
101
101
  showAllModels: markVolatile(z.boolean()),
102
102
  modelVisibility: markVolatile(z.dict(z.boolean()).default({})),
103
+ manualModels: markVolatile(z.array(z.object({
104
+ id: z.string(),
105
+ enabled: z.boolean().default(true),
106
+ name: z.string(),
107
+ contextWindow: z.number().min(1).max(1e7).step(1),
108
+ maxTokens: z.number().min(1).max(1e7).step(1),
109
+ image: z.boolean(),
110
+ thinking: z.boolean(),
111
+ reasoningEfforts: z.array(z.string()),
112
+ defaultReasoning: z.string(),
113
+ tools: z.boolean()
114
+ })).default([])),
115
+ modelOverrides: markVolatile(z.dict(z.object({
116
+ contextWindow: z.number().min(1).max(1e7).step(1),
117
+ image: z.boolean(),
118
+ thinking: z.boolean(),
119
+ reasoningEfforts: z.array(z.string()),
120
+ defaultEffort: z.string(),
121
+ enabled: z.boolean()
122
+ })).default({})),
123
+ modelOrder: markVolatile(z.array(z.string()).default([])),
103
124
  filterModelsByPlan: markVolatile(z.boolean().default(true)),
104
125
  contextWindow: markVolatile(z.number().min(1).max(1e7).step(1)),
105
126
  contextWindowOverrides: markVolatile(z.dict(z.number().min(1).max(1e7).step(1)).default({})),
@@ -161,6 +182,59 @@ function nonEmptyStrings(value) {
161
182
  const out = value.filter((entry) => typeof entry === "string" && entry.trim() !== "");
162
183
  return out.length === 0 ? void 0 : out;
163
184
  }
185
+ function modelOverrideRecord(value) {
186
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
187
+ const out = {};
188
+ for (const [id, entry] of Object.entries(value)) {
189
+ if (id === "" || id.includes("..") || typeof entry !== "object" || entry === null || Array.isArray(entry)) continue;
190
+ const record = entry;
191
+ const contextWindow = integerInRange(record.contextWindow, 1, 1e7);
192
+ const efforts = Array.isArray(record.reasoningEfforts) ? record.reasoningEfforts.filter((item) => typeof item === "string" && item.trim() !== "") : void 0;
193
+ const thinking = typeof record.thinking === "boolean" ? record.thinking : void 0;
194
+ const normalizedEfforts = thinking === true && (efforts === void 0 || efforts.length === 0) ? ["off", "high"] : thinking === false ? [] : efforts;
195
+ const defaultEffort = typeof record.defaultEffort === "string" && record.defaultEffort.trim() !== "" ? record.defaultEffort.trim() : void 0;
196
+ if (contextWindow === void 0 && typeof record.image !== "boolean" && thinking === void 0 && efforts === void 0 && defaultEffort === void 0 && typeof record.enabled !== "boolean") continue;
197
+ out[id] = {
198
+ ...contextWindow === void 0 ? {} : { contextWindow },
199
+ ...typeof record.image === "boolean" ? { image: record.image } : {},
200
+ ...thinking === void 0 ? {} : { thinking },
201
+ ...normalizedEfforts === void 0 ? {} : { reasoningEfforts: normalizedEfforts },
202
+ ...defaultEffort === void 0 ? {} : { defaultEffort },
203
+ ...typeof record.enabled === "boolean" ? { enabled: record.enabled } : {}
204
+ };
205
+ }
206
+ return out;
207
+ }
208
+ function manualModelList(value) {
209
+ if (!Array.isArray(value)) return [];
210
+ const out = [];
211
+ for (const entry of value) {
212
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) continue;
213
+ const record = entry;
214
+ const id = typeof record.id === "string" ? record.id.trim() : "";
215
+ if (id === "" || id.includes("..") || !/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/.test(id)) continue;
216
+ const name = typeof record.name === "string" ? record.name.trim() : "";
217
+ const contextWindow = integerInRange(record.contextWindow, 1, 1e7);
218
+ const maxTokens = integerInRange(record.maxTokens, 1, 1e7);
219
+ const efforts = Array.isArray(record.reasoningEfforts) ? record.reasoningEfforts.filter((item) => typeof item === "string" && item.trim() !== "") : void 0;
220
+ const thinking = typeof record.thinking === "boolean" ? record.thinking : void 0;
221
+ const normalizedEfforts = thinking === true && (efforts === void 0 || efforts.length === 0) ? ["off", "high"] : thinking === false ? [] : efforts;
222
+ const defaultReasoning = typeof record.defaultReasoning === "string" && record.defaultReasoning.trim() !== "" ? record.defaultReasoning.trim() : void 0;
223
+ out.push({
224
+ id,
225
+ enabled: record.enabled !== false,
226
+ ...name === "" ? {} : { name },
227
+ ...contextWindow === void 0 ? {} : { contextWindow },
228
+ ...maxTokens === void 0 ? {} : { maxTokens },
229
+ ...typeof record.image === "boolean" ? { image: record.image } : {},
230
+ ...thinking === void 0 ? {} : { thinking },
231
+ ...normalizedEfforts === void 0 ? {} : { reasoningEfforts: normalizedEfforts },
232
+ ...defaultReasoning === void 0 ? {} : { defaultReasoning },
233
+ ...typeof record.tools === "boolean" ? { tools: record.tools } : {}
234
+ });
235
+ }
236
+ return out;
237
+ }
164
238
  function recordOf$1(value) {
165
239
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
166
240
  }
@@ -234,6 +308,9 @@ function resolveConfig(config) {
234
308
  visibleModels,
235
309
  showAllModels: config.showAllModels === true ? true : config.showAllModels === false ? false : visibleModels.length === 0,
236
310
  modelVisibility: booleanRecord(config.modelVisibility),
311
+ manualModels: manualModelList(config.manualModels),
312
+ modelOverrides: modelOverrideRecord(config.modelOverrides),
313
+ modelOrder: Array.isArray(config.modelOrder) ? config.modelOrder.filter((id) => typeof id === "string" && id !== "") : [],
237
314
  filterModelsByPlan: config.filterModelsByPlan !== false,
238
315
  ...typeof config.contextWindow === "number" && Number.isInteger(config.contextWindow) && config.contextWindow > 0 ? { contextWindow: config.contextWindow } : {},
239
316
  contextWindowOverrides: numberRecord(config.contextWindowOverrides),
@@ -1348,12 +1425,25 @@ function baseMeta(id, base) {
1348
1425
  name: id
1349
1426
  } : meta;
1350
1427
  }
1428
+ function manualModelFor(id, config) {
1429
+ return config.manualModels.find((entry) => entry.id === id);
1430
+ }
1351
1431
  function effectiveModel(id, config) {
1352
1432
  const meta = baseMeta(id, config.apiBase);
1433
+ const manual = manualModelFor(id, config);
1434
+ const override = config.modelOverrides[id];
1353
1435
  return {
1354
1436
  ...meta,
1437
+ name: manual?.name ?? meta.name,
1355
1438
  transport: config.modelTransports[id] ?? config.transport,
1356
- contextWindow: config.contextWindowOverrides[id] ?? config.contextWindow ?? meta.contextWindow
1439
+ contextWindow: config.contextWindowOverrides[id] ?? override?.contextWindow ?? manual?.contextWindow ?? config.contextWindow ?? meta.contextWindow,
1440
+ maxTokens: manual?.maxTokens ?? meta.maxTokens,
1441
+ input: (override?.image ?? manual?.image) === true ? ["text", "image"] : (override?.image ?? manual?.image) === false ? ["text"] : meta.input,
1442
+ reasoning: override?.reasoningEfforts ?? manual?.reasoningEfforts ?? meta.reasoning,
1443
+ reasoningToggle: override?.thinking ?? manual?.thinking ?? meta.reasoningToggle,
1444
+ ...(override?.defaultEffort ?? manual?.defaultReasoning ?? meta.defaultReasoning) === void 0 ? {} : { defaultReasoning: override?.defaultEffort ?? manual?.defaultReasoning ?? meta.defaultReasoning },
1445
+ tools: manual?.tools ?? meta.tools,
1446
+ available: override?.enabled === false || manual?.enabled === false ? false : meta.available
1357
1447
  };
1358
1448
  }
1359
1449
  /** Effective per-request output default; `0` means "omit the field". */
@@ -1370,11 +1460,21 @@ function modelVisible(id, config) {
1370
1460
  return config.visibleModels.includes(id);
1371
1461
  }
1372
1462
  function modelAvailable(id, config) {
1463
+ const manual = manualModelFor(id, config);
1464
+ if (config.modelOverrides[id]?.enabled === false || manual?.enabled === false) return false;
1373
1465
  if (!config.filterModelsByPlan) return true;
1374
- return baseMeta(id, config.apiBase).available !== false;
1466
+ return effectiveModel(id, config).available !== false;
1375
1467
  }
1376
1468
  function sortForPicker(ids, config, unfiltered = false) {
1469
+ const order = new Map([...config.modelOrder.map((id, index) => [id, index]), ...config.visibleModels.map((id, index) => [id, config.modelOrder.length + index])]);
1377
1470
  return ids.filter((id) => unfiltered || modelVisible(id, config) && modelAvailable(id, config)).sort((left, right) => {
1471
+ const leftOrder = order.get(left);
1472
+ const rightOrder = order.get(right);
1473
+ if (leftOrder !== void 0 || rightOrder !== void 0) {
1474
+ if (leftOrder === void 0) return 1;
1475
+ if (rightOrder === void 0) return -1;
1476
+ if (leftOrder !== rightOrder) return leftOrder - rightOrder;
1477
+ }
1378
1478
  const a = effectiveModel(left, config);
1379
1479
  const b = effectiveModel(right, config);
1380
1480
  if (a.free !== b.free) return a.free ? -1 : 1;
@@ -2755,7 +2855,12 @@ var OllamaCloudAdapter = class extends LlmAdapter {
2755
2855
  }
2756
2856
  async listModels(provider, opts) {
2757
2857
  const config = this.deps.config();
2758
- return sortForPicker(await refreshCatalog(config, this.fetchImpl), config, opts?.unfiltered === true).map((id) => {
2858
+ const discovered = await refreshCatalog(config, this.fetchImpl);
2859
+ return sortForPicker([.../* @__PURE__ */ new Set([
2860
+ ...discovered,
2861
+ ...config.manualModels.map((model) => model.id),
2862
+ ...Object.keys(config.modelOverrides)
2863
+ ])], config, opts?.unfiltered === true).map((id) => {
2759
2864
  const model = effectiveModel(id, config);
2760
2865
  return {
2761
2866
  provider,
@@ -4457,6 +4562,9 @@ function publicConfig(config) {
4457
4562
  visibleModels: config.visibleModels,
4458
4563
  showAllModels: config.showAllModels,
4459
4564
  modelVisibility: config.modelVisibility,
4565
+ manualModels: config.manualModels,
4566
+ modelOverrides: config.modelOverrides,
4567
+ modelOrder: config.modelOrder,
4460
4568
  filterModelsByPlan: config.filterModelsByPlan,
4461
4569
  contextWindow: config.contextWindow ?? null,
4462
4570
  contextWindowOverrides: config.contextWindowOverrides,
@@ -4573,6 +4681,53 @@ function cleanModelAccountRules(value) {
4573
4681
  }
4574
4682
  return out;
4575
4683
  }
4684
+ function cleanManualModels(value) {
4685
+ if (!Array.isArray(value)) return [];
4686
+ const out = [];
4687
+ for (const entry of value) {
4688
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) continue;
4689
+ const record = entry;
4690
+ const id = typeof record.id === "string" ? record.id.trim() : "";
4691
+ if (id === "" || id.includes("..") || !/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/.test(id)) continue;
4692
+ const efforts = Array.isArray(record.reasoningEfforts) ? record.reasoningEfforts.filter((item) => typeof item === "string" && item.trim() !== "") : void 0;
4693
+ const thinking = typeof record.thinking === "boolean" ? record.thinking : void 0;
4694
+ const normalizedEfforts = thinking === true && (efforts === void 0 || efforts.length === 0) ? ["off", "high"] : thinking === false ? [] : efforts;
4695
+ out.push({
4696
+ id,
4697
+ enabled: record.enabled !== false,
4698
+ ...typeof record.name === "string" && record.name.trim() !== "" ? { name: record.name.trim() } : {},
4699
+ ...typeof record.contextWindow === "number" && Number.isInteger(record.contextWindow) && record.contextWindow > 0 ? { contextWindow: record.contextWindow } : {},
4700
+ ...typeof record.maxTokens === "number" && Number.isInteger(record.maxTokens) && record.maxTokens > 0 ? { maxTokens: record.maxTokens } : {},
4701
+ ...typeof record.image === "boolean" ? { image: record.image } : {},
4702
+ ...thinking === void 0 ? {} : { thinking },
4703
+ ...normalizedEfforts === void 0 ? {} : { reasoningEfforts: normalizedEfforts },
4704
+ ...typeof record.defaultReasoning === "string" && record.defaultReasoning.trim() !== "" ? { defaultReasoning: record.defaultReasoning.trim() } : {},
4705
+ ...typeof record.tools === "boolean" ? { tools: record.tools } : {}
4706
+ });
4707
+ }
4708
+ return out;
4709
+ }
4710
+ function cleanModelOverrides(value) {
4711
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
4712
+ const out = {};
4713
+ for (const [id, entry] of Object.entries(value)) {
4714
+ if (id === "" || id.includes("..") || typeof entry !== "object" || entry === null || Array.isArray(entry)) continue;
4715
+ const record = entry;
4716
+ const efforts = Array.isArray(record.reasoningEfforts) ? record.reasoningEfforts.filter((item) => typeof item === "string" && item.trim() !== "") : void 0;
4717
+ const thinking = typeof record.thinking === "boolean" ? record.thinking : void 0;
4718
+ const normalizedEfforts = thinking === true && (efforts === void 0 || efforts.length === 0) ? ["off", "high"] : thinking === false ? [] : efforts;
4719
+ const outEntry = {
4720
+ ...typeof record.contextWindow === "number" && Number.isInteger(record.contextWindow) && record.contextWindow > 0 ? { contextWindow: record.contextWindow } : {},
4721
+ ...typeof record.image === "boolean" ? { image: record.image } : {},
4722
+ ...thinking === void 0 ? {} : { thinking },
4723
+ ...normalizedEfforts === void 0 ? {} : { reasoningEfforts: normalizedEfforts },
4724
+ ...typeof record.defaultEffort === "string" && record.defaultEffort.trim() !== "" ? { defaultEffort: record.defaultEffort.trim() } : {},
4725
+ ...typeof record.enabled === "boolean" ? { enabled: record.enabled } : {}
4726
+ };
4727
+ if (Object.keys(outEntry).length > 0) out[id] = outEntry;
4728
+ }
4729
+ return out;
4730
+ }
4576
4731
  function cleanBooleanRecord(value) {
4577
4732
  if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
4578
4733
  const out = {};
@@ -4798,6 +4953,9 @@ function configOps(patch) {
4798
4953
  if ("visibleModels" in patch) set("visibleModels", cleanStringArray(patch.visibleModels));
4799
4954
  if ("showAllModels" in patch) set("showAllModels", patch.showAllModels === true);
4800
4955
  if ("modelVisibility" in patch) set("modelVisibility", cleanBooleanRecord(patch.modelVisibility));
4956
+ if ("manualModels" in patch) set("manualModels", cleanManualModels(patch.manualModels));
4957
+ if ("modelOrder" in patch) set("modelOrder", cleanStringArray(patch.modelOrder));
4958
+ if ("modelOverrides" in patch) set("modelOverrides", cleanModelOverrides(patch.modelOverrides));
4801
4959
  if ("filterModelsByPlan" in patch) set("filterModelsByPlan", patch.filterModelsByPlan === true);
4802
4960
  if ("contextWindow" in patch) set("contextWindow", patch.contextWindow);
4803
4961
  if ("contextWindowOverrides" in patch) set("contextWindowOverrides", cleanNumberRecord(patch.contextWindowOverrides));
@@ -5193,8 +5351,10 @@ function applyRoutes(ctx, web, deps) {
5193
5351
  res.write(`${JSON.stringify(value)}\n`);
5194
5352
  };
5195
5353
  try {
5354
+ const last = await pullLocalModel(config, model, write, deps.localFetch);
5355
+ clearModelProbeCache(config.apiBase);
5196
5356
  write({
5197
- status: (await pullLocalModel(config, model, write, deps.localFetch)).status,
5357
+ status: last.status,
5198
5358
  done: true
5199
5359
  });
5200
5360
  } catch (error) {
@@ -5223,6 +5383,7 @@ function applyRoutes(ctx, web, deps) {
5223
5383
  const model = typeof body.model === "string" ? body.model : "";
5224
5384
  try {
5225
5385
  await removeLocalModel(config, model, deps.localFetch);
5386
+ clearModelProbeCache(config.apiBase);
5226
5387
  json(res, 200, {
5227
5388
  ok: true,
5228
5389
  model
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-ollama-cloud-provider",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
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 tests/reasoning.test.ts tests/catalog-cache.test.ts tests/local-models.test.ts tests/attempt.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 tests/catalog-cache.test.ts tests/local-models.test.ts tests/attempt.test.ts tests/model-groups.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"