@goodandready/dsh-ollama-cloud-provider 0.1.27 → 0.1.29
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 +11 -0
- package/README.md +4 -20
- package/README.ru.md +4 -4
- package/README.zh.md +4 -4
- package/lib/client.js +112 -362
- package/lib/index.d.ts +1 -19
- package/lib/index.js +34 -569
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.29 — 2026-11-05
|
|
4
|
+
|
|
5
|
+
- Made the plugin cloud-only. Removed the local endpoint mode, local model
|
|
6
|
+
management (`/api/tags`, `/api/ps`, pull/remove), local GUI/CLI, `/api/show`
|
|
7
|
+
probes and the empty-key local credential path. `apiKeyEnv` now falls back to
|
|
8
|
+
the cloud credential reference instead of enabling a local endpoint.
|
|
9
|
+
- Added the native `settings.models.provider-card` provider card showing
|
|
10
|
+
provider identity, key state, model count, transport and quota bars; the
|
|
11
|
+
existing settings page remains available.
|
|
12
|
+
- Removed local tests/docs and added provider-card render coverage; 130/130.
|
|
13
|
+
|
|
3
14
|
## 0.1.27 — 2026-11-05
|
|
4
15
|
|
|
5
16
|
- Usage reader keeps the last good snapshot per key/range and returns it as
|
package/README.md
CHANGED
|
@@ -52,22 +52,6 @@ Select it in the profile:
|
|
|
52
52
|
fetchProvider: ollama-cloud
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
## Local Ollama
|
|
56
|
-
|
|
57
|
-
Set `apiKeyEnv` to an empty string and point `apiBase` at the local or
|
|
58
|
-
self-hosted Ollama server. No `Authorization` header is sent, and cloud
|
|
59
|
-
usage/balance reads are skipped.
|
|
60
|
-
|
|
61
|
-
```yaml
|
|
62
|
-
- id: llm-ollama-cloud
|
|
63
|
-
config:
|
|
64
|
-
apiKeyEnv: ''
|
|
65
|
-
apiBase: http://127.0.0.1:11434
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Local model discovery uses `/api/tags` and enriches each model through
|
|
69
|
-
`/api/show`; successful capability probes are cached for five minutes.
|
|
70
|
-
|
|
71
55
|
## Architecture
|
|
72
56
|
|
|
73
57
|
```mermaid
|
|
@@ -137,17 +121,17 @@ npm pack
|
|
|
137
121
|
Install the published package:
|
|
138
122
|
|
|
139
123
|
```bash
|
|
140
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
124
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.29
|
|
141
125
|
# DSH Desktop:
|
|
142
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
126
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.29
|
|
143
127
|
```
|
|
144
128
|
|
|
145
129
|
Or install the packed tarball into a profile:
|
|
146
130
|
|
|
147
131
|
```bash
|
|
148
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
132
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.29.tgz
|
|
149
133
|
# DSH Desktop:
|
|
150
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
134
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.29.tgz
|
|
151
135
|
```
|
|
152
136
|
|
|
153
137
|
Restart dsh (or DSH Desktop), then pick **Ollama Cloud** in the model picker.
|
package/README.ru.md
CHANGED
|
@@ -103,17 +103,17 @@ npm pack
|
|
|
103
103
|
Установка опубликованного пакета из npm:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
106
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.29
|
|
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.29
|
|
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.29.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.29.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.29
|
|
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.29
|
|
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.29.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.29.tgz
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
|
package/lib/client.js
CHANGED
|
@@ -133,7 +133,7 @@ window.__ModuleLoader__.load({
|
|
|
133
133
|
discoverHint: "Probe an unsaved endpoint and show its catalog without changing current settings.",
|
|
134
134
|
endpoint: "Endpoint",
|
|
135
135
|
oneShotKey: "One-shot API key",
|
|
136
|
-
oneShotKeyPlaceholder: "optional
|
|
136
|
+
oneShotKeyPlaceholder: "optional",
|
|
137
137
|
oneShotKeyHint: "Used only for this request; never stored, saved or logged.",
|
|
138
138
|
discovering: "Discovering…",
|
|
139
139
|
discoverAction: "Discover models",
|
|
@@ -151,6 +151,8 @@ window.__ModuleLoader__.load({
|
|
|
151
151
|
reasoningEfforts: "Reasoning efforts",
|
|
152
152
|
manualEffortsHint: "Comma-separated levels, e.g. off, low, medium, high.",
|
|
153
153
|
defaultReasoning: "Default effort",
|
|
154
|
+
noKey: "No API key",
|
|
155
|
+
providerCardHint: "Native provider card on the Models page. Open the Ollama Cloud settings section for full configuration.",
|
|
154
156
|
enabled: "Enabled",
|
|
155
157
|
edit: "Edit",
|
|
156
158
|
overrideEditor: "Model overrides",
|
|
@@ -181,26 +183,6 @@ window.__ModuleLoader__.load({
|
|
|
181
183
|
autoRefresh: "Refresh model catalog automatically",
|
|
182
184
|
refreshMinutes: "Refresh interval (minutes)",
|
|
183
185
|
autoRefreshHint: "Mount refresh plus this interval; 0 keeps the mount refresh only.",
|
|
184
|
-
localModels: "Local Ollama models",
|
|
185
|
-
localModelsHint: "List, inspect, pull and remove models on the configured local endpoint. Remove always asks for confirmation.",
|
|
186
|
-
localDisk: "Disk",
|
|
187
|
-
localRunning: "Running",
|
|
188
|
-
localPullPlaceholder: "model name, for example llama3.2",
|
|
189
|
-
localPull: "Pull",
|
|
190
|
-
localPulling: "Pulling…",
|
|
191
|
-
localRefresh: "Reload",
|
|
192
|
-
localNoModels: "No local models.",
|
|
193
|
-
localRunningBadge: "running",
|
|
194
|
-
localShow: "Details",
|
|
195
|
-
localRemove: "Remove",
|
|
196
|
-
localConfirmRemove: "Confirm remove",
|
|
197
|
-
localCancel: "Cancel",
|
|
198
|
-
localModified: "Modified",
|
|
199
|
-
localCapabilities: "Capabilities",
|
|
200
|
-
localPullFailed: "Pull failed",
|
|
201
|
-
localRemoveDone: "removed",
|
|
202
|
-
localRemoveFailed: "Remove failed",
|
|
203
|
-
localShowFailed: "Details unavailable",
|
|
204
186
|
sidebar: "Sidebar",
|
|
205
187
|
serviceStatus: "Service status",
|
|
206
188
|
serviceStatusHint: "Checks the public Ollama Cloud tag endpoint without using your key or quota.",
|
|
@@ -403,6 +385,8 @@ window.__ModuleLoader__.load({
|
|
|
403
385
|
reasoningEfforts: "推理档位",
|
|
404
386
|
manualEffortsHint: "逗号分隔,例如 off, low, medium, high。",
|
|
405
387
|
defaultReasoning: "默认档位",
|
|
388
|
+
noKey: "无 API 密钥",
|
|
389
|
+
providerCardHint: "模型页面上的原生提供方卡片。完整配置请打开 Ollama Cloud 设置部分。",
|
|
406
390
|
enabled: "启用",
|
|
407
391
|
edit: "编辑",
|
|
408
392
|
overrideEditor: "模型覆盖",
|
|
@@ -433,26 +417,6 @@ window.__ModuleLoader__.load({
|
|
|
433
417
|
autoRefresh: "自动刷新模型目录",
|
|
434
418
|
refreshMinutes: "刷新间隔(分钟)",
|
|
435
419
|
autoRefreshHint: "启动时刷新,并按此间隔刷新;0 仅启动时刷新。",
|
|
436
|
-
localModels: "本地 Ollama 模型",
|
|
437
|
-
localModelsHint: "列出、查看、拉取和删除已配置本地端点上的模型。删除始终需要确认。",
|
|
438
|
-
localDisk: "磁盘",
|
|
439
|
-
localRunning: "运行中",
|
|
440
|
-
localPullPlaceholder: "模型名称,例如 llama3.2",
|
|
441
|
-
localPull: "拉取",
|
|
442
|
-
localPulling: "拉取中…",
|
|
443
|
-
localRefresh: "重新加载",
|
|
444
|
-
localNoModels: "没有本地模型。",
|
|
445
|
-
localRunningBadge: "运行中",
|
|
446
|
-
localShow: "详情",
|
|
447
|
-
localRemove: "删除",
|
|
448
|
-
localConfirmRemove: "确认删除",
|
|
449
|
-
localCancel: "取消",
|
|
450
|
-
localModified: "修改时间",
|
|
451
|
-
localCapabilities: "能力",
|
|
452
|
-
localPullFailed: "拉取失败",
|
|
453
|
-
localRemoveDone: "已删除",
|
|
454
|
-
localRemoveFailed: "删除失败",
|
|
455
|
-
localShowFailed: "详情不可用",
|
|
456
420
|
sidebar: "侧边栏",
|
|
457
421
|
serviceStatus: "服务状态",
|
|
458
422
|
serviceStatusHint: "检查 Ollama Cloud 公共 tag 端点,不使用密钥或额度。",
|
|
@@ -622,80 +586,6 @@ window.__ModuleLoader__.load({
|
|
|
622
586
|
})
|
|
623
587
|
});
|
|
624
588
|
}
|
|
625
|
-
function fetchLocalModels() {
|
|
626
|
-
return call("/dsh-ollama/local/models");
|
|
627
|
-
}
|
|
628
|
-
function fetchLocalShow(model) {
|
|
629
|
-
return call(`/dsh-ollama/local/show?model=${encodeURIComponent(model)}`);
|
|
630
|
-
}
|
|
631
|
-
async function pullLocalModel(model, onProgress) {
|
|
632
|
-
const response = await fetch("/dsh-ollama/local/pull", {
|
|
633
|
-
method: "POST",
|
|
634
|
-
credentials: "same-origin",
|
|
635
|
-
headers: {
|
|
636
|
-
accept: "application/x-ndjson",
|
|
637
|
-
"content-type": "application/json"
|
|
638
|
-
},
|
|
639
|
-
body: JSON.stringify({ model })
|
|
640
|
-
});
|
|
641
|
-
if (!response.ok) {
|
|
642
|
-
const body = await response.json().catch(() => ({}));
|
|
643
|
-
throw new Error(body.error ?? `HTTP ${response.status}`);
|
|
644
|
-
}
|
|
645
|
-
if (response.body === null) throw new Error("empty pull stream");
|
|
646
|
-
const reader = response.body.getReader();
|
|
647
|
-
const decoder = new TextDecoder();
|
|
648
|
-
let buffer = "";
|
|
649
|
-
let last = { status: "starting" };
|
|
650
|
-
const consume = (line) => {
|
|
651
|
-
if (line.trim() === "") return;
|
|
652
|
-
let event;
|
|
653
|
-
try {
|
|
654
|
-
event = JSON.parse(line);
|
|
655
|
-
} catch {
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
if (typeof event.error === "string" && event.error !== "") throw new Error(event.error);
|
|
659
|
-
if (typeof event.status === "string") last = event;
|
|
660
|
-
onProgress(event);
|
|
661
|
-
};
|
|
662
|
-
for (;;) {
|
|
663
|
-
const { done, value } = await reader.read();
|
|
664
|
-
buffer += decoder.decode(value, { stream: !done });
|
|
665
|
-
const lines = buffer.split("\n");
|
|
666
|
-
buffer = lines.pop() ?? "";
|
|
667
|
-
for (const line of lines) consume(line);
|
|
668
|
-
if (done) break;
|
|
669
|
-
}
|
|
670
|
-
if (buffer.trim() !== "") consume(buffer);
|
|
671
|
-
return last;
|
|
672
|
-
}
|
|
673
|
-
function removeLocalModel(model) {
|
|
674
|
-
return call("/dsh-ollama/local/remove", {
|
|
675
|
-
method: "POST",
|
|
676
|
-
body: JSON.stringify({
|
|
677
|
-
model,
|
|
678
|
-
confirm: true
|
|
679
|
-
})
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
|
-
function formatBytes(bytes) {
|
|
683
|
-
if (!Number.isFinite(bytes) || bytes <= 0) return "0 B";
|
|
684
|
-
const units = [
|
|
685
|
-
"B",
|
|
686
|
-
"KB",
|
|
687
|
-
"MB",
|
|
688
|
-
"GB",
|
|
689
|
-
"TB"
|
|
690
|
-
];
|
|
691
|
-
let value = bytes;
|
|
692
|
-
let index = 0;
|
|
693
|
-
while (value >= 1024 && index < units.length - 1) {
|
|
694
|
-
value /= 1024;
|
|
695
|
-
index += 1;
|
|
696
|
-
}
|
|
697
|
-
return `${value >= 10 || index === 0 ? value.toFixed(0) : value.toFixed(1)} ${units[index]}`;
|
|
698
|
-
}
|
|
699
589
|
function saveConfig(patch) {
|
|
700
590
|
return call("/dsh-ollama/config", {
|
|
701
591
|
method: "POST",
|
|
@@ -1918,246 +1808,6 @@ window.__ModuleLoader__.load({
|
|
|
1918
1808
|
function mergeLoadedDraft(current, next, preserve) {
|
|
1919
1809
|
return preserve && current !== null ? current : next;
|
|
1920
1810
|
}
|
|
1921
|
-
// src/client/local-models-card.tsx
|
|
1922
|
-
function isLocalConfig(config) {
|
|
1923
|
-
if (config.apiKeyEnv === "") return true;
|
|
1924
|
-
try {
|
|
1925
|
-
const host = new URL(config.apiBase).hostname;
|
|
1926
|
-
return host === "127.0.0.1" || host === "localhost" || host === "::1" || host === "[::1]";
|
|
1927
|
-
} catch {
|
|
1928
|
-
return false;
|
|
1929
|
-
}
|
|
1930
|
-
}
|
|
1931
|
-
function LocalModelsCard(props) {
|
|
1932
|
-
const { t, config, onChanged } = props;
|
|
1933
|
-
const [inventory, setInventory] = (0, react.useState)(null);
|
|
1934
|
-
const [details, setDetails] = (0, react.useState)(null);
|
|
1935
|
-
const [error, setError] = (0, react.useState)(null);
|
|
1936
|
-
const [notice, setNotice] = (0, react.useState)(null);
|
|
1937
|
-
const [pullName, setPullName] = (0, react.useState)("");
|
|
1938
|
-
const [pulling, setPulling] = (0, react.useState)(false);
|
|
1939
|
-
const [progress, setProgress] = (0, react.useState)(null);
|
|
1940
|
-
const [confirmRemove, setConfirmRemove] = (0, react.useState)(null);
|
|
1941
|
-
const local = isLocalConfig(config);
|
|
1942
|
-
const load = (0, react.useCallback)(async () => {
|
|
1943
|
-
if (!local) return;
|
|
1944
|
-
try {
|
|
1945
|
-
setInventory(await fetchLocalModels());
|
|
1946
|
-
setError(null);
|
|
1947
|
-
} catch (cause) {
|
|
1948
|
-
setError(cause instanceof Error ? cause.message : "local models failed");
|
|
1949
|
-
}
|
|
1950
|
-
}, [local]);
|
|
1951
|
-
(0, react.useEffect)(() => {
|
|
1952
|
-
load();
|
|
1953
|
-
}, [
|
|
1954
|
-
load,
|
|
1955
|
-
config.apiKeyEnv,
|
|
1956
|
-
config.apiBase
|
|
1957
|
-
]);
|
|
1958
|
-
if (!local) return null;
|
|
1959
|
-
const pull = async () => {
|
|
1960
|
-
const model = pullName.trim();
|
|
1961
|
-
if (model === "" || pulling) return;
|
|
1962
|
-
setPulling(true);
|
|
1963
|
-
setError(null);
|
|
1964
|
-
setNotice(null);
|
|
1965
|
-
setProgress({ status: "starting" });
|
|
1966
|
-
try {
|
|
1967
|
-
const last = await pullLocalModel(model, setProgress);
|
|
1968
|
-
setNotice(`${model}: ${last.status}`);
|
|
1969
|
-
setPullName("");
|
|
1970
|
-
await load();
|
|
1971
|
-
onChanged?.();
|
|
1972
|
-
} catch (cause) {
|
|
1973
|
-
setError(cause instanceof Error ? cause.message : t("localPullFailed"));
|
|
1974
|
-
} finally {
|
|
1975
|
-
setPulling(false);
|
|
1976
|
-
setProgress(null);
|
|
1977
|
-
}
|
|
1978
|
-
};
|
|
1979
|
-
const remove = async (model) => {
|
|
1980
|
-
setError(null);
|
|
1981
|
-
setNotice(null);
|
|
1982
|
-
try {
|
|
1983
|
-
await removeLocalModel(model);
|
|
1984
|
-
setConfirmRemove(null);
|
|
1985
|
-
setDetails((current) => current?.name === model ? null : current);
|
|
1986
|
-
setNotice(`${model}: ${t("localRemoveDone")}`);
|
|
1987
|
-
await load();
|
|
1988
|
-
onChanged?.();
|
|
1989
|
-
} catch (cause) {
|
|
1990
|
-
setError(cause instanceof Error ? cause.message : t("localRemoveFailed"));
|
|
1991
|
-
}
|
|
1992
|
-
};
|
|
1993
|
-
const show = async (model) => {
|
|
1994
|
-
setError(null);
|
|
1995
|
-
try {
|
|
1996
|
-
setDetails(await fetchLocalShow(model));
|
|
1997
|
-
} catch (cause) {
|
|
1998
|
-
setError(cause instanceof Error ? cause.message : t("localShowFailed"));
|
|
1999
|
-
}
|
|
2000
|
-
};
|
|
2001
|
-
const running = new Set(inventory?.running.map((entry) => entry.name) ?? []);
|
|
2002
|
-
const percent = progress?.total !== void 0 && progress.total > 0 ? Math.min(100, Math.round((progress.completed ?? 0) / progress.total * 100)) : null;
|
|
2003
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
2004
|
-
className: "ocl-card",
|
|
2005
|
-
children: [
|
|
2006
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
2007
|
-
className: "ocl-card-title",
|
|
2008
|
-
children: t("localModels")
|
|
2009
|
-
}),
|
|
2010
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2011
|
-
className: "ocl-hint",
|
|
2012
|
-
children: t("localModelsHint")
|
|
2013
|
-
}),
|
|
2014
|
-
inventory !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
2015
|
-
className: "ocl-hint",
|
|
2016
|
-
children: [
|
|
2017
|
-
t("localDisk"),
|
|
2018
|
-
": ",
|
|
2019
|
-
formatBytes(inventory.diskBytes),
|
|
2020
|
-
" · ",
|
|
2021
|
-
t("localRunning"),
|
|
2022
|
-
": ",
|
|
2023
|
-
formatBytes(inventory.runningBytes)
|
|
2024
|
-
]
|
|
2025
|
-
}),
|
|
2026
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2027
|
-
className: "ocl-row",
|
|
2028
|
-
children: [
|
|
2029
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2030
|
-
className: "ocl-input",
|
|
2031
|
-
value: pullName,
|
|
2032
|
-
placeholder: t("localPullPlaceholder"),
|
|
2033
|
-
onChange: (event) => setPullName(event.target.value),
|
|
2034
|
-
onKeyDown: (event) => {
|
|
2035
|
-
if (event.key === "Enter") {
|
|
2036
|
-
event.preventDefault();
|
|
2037
|
-
pull();
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
}),
|
|
2041
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2042
|
-
type: "button",
|
|
2043
|
-
className: "ocl-button",
|
|
2044
|
-
disabled: pulling || pullName.trim() === "",
|
|
2045
|
-
onClick: () => {
|
|
2046
|
-
pull();
|
|
2047
|
-
},
|
|
2048
|
-
children: pulling ? t("localPulling") : t("localPull")
|
|
2049
|
-
}),
|
|
2050
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2051
|
-
type: "button",
|
|
2052
|
-
className: "ocl-button",
|
|
2053
|
-
onClick: () => {
|
|
2054
|
-
load();
|
|
2055
|
-
},
|
|
2056
|
-
children: t("localRefresh")
|
|
2057
|
-
})
|
|
2058
|
-
]
|
|
2059
|
-
}),
|
|
2060
|
-
progress !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2061
|
-
className: "ocl-row",
|
|
2062
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2063
|
-
className: "ocl-hint",
|
|
2064
|
-
children: percent === null ? progress.status : `${progress.status} · ${percent}%`
|
|
2065
|
-
})
|
|
2066
|
-
}),
|
|
2067
|
-
notice !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2068
|
-
className: "ocl-notice",
|
|
2069
|
-
children: notice
|
|
2070
|
-
}),
|
|
2071
|
-
error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2072
|
-
className: "ocl-error",
|
|
2073
|
-
children: error
|
|
2074
|
-
}),
|
|
2075
|
-
inventory !== null && inventory.models.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2076
|
-
className: "ocl-hint",
|
|
2077
|
-
children: t("localNoModels")
|
|
2078
|
-
}),
|
|
2079
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2080
|
-
className: "ocl-models",
|
|
2081
|
-
children: (inventory?.models ?? []).map((model) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2082
|
-
className: "ocl-model",
|
|
2083
|
-
children: [
|
|
2084
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2085
|
-
className: "ocl-model-name",
|
|
2086
|
-
children: model.name
|
|
2087
|
-
}),
|
|
2088
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2089
|
-
className: "ocl-badge",
|
|
2090
|
-
children: formatBytes(model.size)
|
|
2091
|
-
}),
|
|
2092
|
-
running.has(model.name) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2093
|
-
className: "ocl-badge ocl-badge-ok",
|
|
2094
|
-
children: t("localRunningBadge")
|
|
2095
|
-
}),
|
|
2096
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2097
|
-
type: "button",
|
|
2098
|
-
className: "ocl-button",
|
|
2099
|
-
onClick: () => {
|
|
2100
|
-
show(model.name);
|
|
2101
|
-
},
|
|
2102
|
-
children: t("localShow")
|
|
2103
|
-
}),
|
|
2104
|
-
confirmRemove === model.name ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2105
|
-
type: "button",
|
|
2106
|
-
className: "ocl-button ocl-button-danger",
|
|
2107
|
-
onClick: () => {
|
|
2108
|
-
remove(model.name);
|
|
2109
|
-
},
|
|
2110
|
-
children: t("localConfirmRemove")
|
|
2111
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2112
|
-
type: "button",
|
|
2113
|
-
className: "ocl-button",
|
|
2114
|
-
onClick: () => setConfirmRemove(null),
|
|
2115
|
-
children: t("localCancel")
|
|
2116
|
-
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2117
|
-
type: "button",
|
|
2118
|
-
className: "ocl-button ocl-button-danger",
|
|
2119
|
-
onClick: () => setConfirmRemove(model.name),
|
|
2120
|
-
children: t("localRemove")
|
|
2121
|
-
})
|
|
2122
|
-
]
|
|
2123
|
-
}, model.name))
|
|
2124
|
-
}),
|
|
2125
|
-
details !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2126
|
-
className: "ocl-model-section",
|
|
2127
|
-
children: [
|
|
2128
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2129
|
-
className: "ocl-model-section-head",
|
|
2130
|
-
children: details.name
|
|
2131
|
-
}),
|
|
2132
|
-
details.modifiedAt !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
2133
|
-
className: "ocl-hint",
|
|
2134
|
-
children: [
|
|
2135
|
-
t("localModified"),
|
|
2136
|
-
": ",
|
|
2137
|
-
details.modifiedAt
|
|
2138
|
-
]
|
|
2139
|
-
}),
|
|
2140
|
-
details.details !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2141
|
-
className: "ocl-hint",
|
|
2142
|
-
children: [
|
|
2143
|
-
details.details.family,
|
|
2144
|
-
details.details.parameterSize,
|
|
2145
|
-
details.details.quantization
|
|
2146
|
-
].filter((entry) => entry !== void 0).join(" · ")
|
|
2147
|
-
}),
|
|
2148
|
-
details.capabilities.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
2149
|
-
className: "ocl-hint",
|
|
2150
|
-
children: [
|
|
2151
|
-
t("localCapabilities"),
|
|
2152
|
-
": ",
|
|
2153
|
-
details.capabilities.join(", ")
|
|
2154
|
-
]
|
|
2155
|
-
})
|
|
2156
|
-
]
|
|
2157
|
-
})
|
|
2158
|
-
]
|
|
2159
|
-
});
|
|
2160
|
-
}
|
|
2161
1811
|
// src/client/model-groups.ts
|
|
2162
1812
|
function formatContext(value) {
|
|
2163
1813
|
if (value >= 1e6) return `${(value / 1e6).toFixed(value % 1e6 === 0 ? 0 : 1)}M`;
|
|
@@ -3559,13 +3209,6 @@ window.__ModuleLoader__.load({
|
|
|
3559
3209
|
}, `${model.id}-${index}`))
|
|
3560
3210
|
]
|
|
3561
3211
|
}),
|
|
3562
|
-
state !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LocalModelsCard, {
|
|
3563
|
-
t,
|
|
3564
|
-
config: state.config,
|
|
3565
|
-
onChanged: () => {
|
|
3566
|
-
reloadModels();
|
|
3567
|
-
}
|
|
3568
|
-
}),
|
|
3569
3212
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
3570
3213
|
className: "ocl-card",
|
|
3571
3214
|
children: [
|
|
@@ -3923,6 +3566,108 @@ window.__ModuleLoader__.load({
|
|
|
3923
3566
|
]
|
|
3924
3567
|
});
|
|
3925
3568
|
}
|
|
3569
|
+
// src/client/provider-card.tsx
|
|
3570
|
+
function OllamaProviderCardView(props) {
|
|
3571
|
+
const { t, state, error } = props;
|
|
3572
|
+
const report = state?.usage?.report;
|
|
3573
|
+
const bars = quotaBars(report);
|
|
3574
|
+
const worst = worstUsedPercent(report);
|
|
3575
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3576
|
+
className: "ocl-card",
|
|
3577
|
+
"data-ollama-provider-card": "true",
|
|
3578
|
+
children: [
|
|
3579
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3580
|
+
className: "ocl-row",
|
|
3581
|
+
children: [
|
|
3582
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: "Ollama Cloud" }),
|
|
3583
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3584
|
+
className: "ocl-badge",
|
|
3585
|
+
children: "ollama-cloud"
|
|
3586
|
+
}),
|
|
3587
|
+
state === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3588
|
+
className: "ocl-badge ocl-badge-warn",
|
|
3589
|
+
children: t("loading")
|
|
3590
|
+
}) : state.key.configured ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3591
|
+
className: "ocl-badge ocl-badge-ok",
|
|
3592
|
+
children: t("keyConfigured")
|
|
3593
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3594
|
+
className: "ocl-badge ocl-badge-warn",
|
|
3595
|
+
children: t("noKey")
|
|
3596
|
+
})
|
|
3597
|
+
]
|
|
3598
|
+
}),
|
|
3599
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3600
|
+
className: "ocl-hint",
|
|
3601
|
+
children: t("providerCardHint")
|
|
3602
|
+
}),
|
|
3603
|
+
error !== void 0 && error !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3604
|
+
className: "ocl-error",
|
|
3605
|
+
children: error
|
|
3606
|
+
}) : null,
|
|
3607
|
+
state !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3608
|
+
className: "ocl-row",
|
|
3609
|
+
children: [
|
|
3610
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
3611
|
+
t("models"),
|
|
3612
|
+
": ",
|
|
3613
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: state.models.length })
|
|
3614
|
+
] }),
|
|
3615
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
3616
|
+
t("transport"),
|
|
3617
|
+
": ",
|
|
3618
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: state.config.transport })
|
|
3619
|
+
] }),
|
|
3620
|
+
bars.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
3621
|
+
t("quotaCardName"),
|
|
3622
|
+
": ",
|
|
3623
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("strong", { children: [worst.toFixed(0), "%"] })
|
|
3624
|
+
] })
|
|
3625
|
+
]
|
|
3626
|
+
}),
|
|
3627
|
+
state?.usage?.stale === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3628
|
+
className: "ocl-notice",
|
|
3629
|
+
children: t("lastGoodUsage")
|
|
3630
|
+
}) : null,
|
|
3631
|
+
bars.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3632
|
+
className: "ocl-models",
|
|
3633
|
+
children: bars.map((bar) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3634
|
+
className: "ocl-row",
|
|
3635
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3636
|
+
className: "ocl-model-name",
|
|
3637
|
+
children: bar.labelKey === void 0 ? bar.label : t(bar.labelKey)
|
|
3638
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3639
|
+
className: "ocl-badge",
|
|
3640
|
+
children: [
|
|
3641
|
+
bar.remainingPercent.toFixed(0),
|
|
3642
|
+
"% ",
|
|
3643
|
+
t("remaining")
|
|
3644
|
+
]
|
|
3645
|
+
})]
|
|
3646
|
+
}, bar.key))
|
|
3647
|
+
})
|
|
3648
|
+
]
|
|
3649
|
+
});
|
|
3650
|
+
}
|
|
3651
|
+
function OllamaProviderCard(props) {
|
|
3652
|
+
const [state, setState] = (0, react.useState)(null);
|
|
3653
|
+
const [error, setError] = (0, react.useState)(null);
|
|
3654
|
+
(0, react.useEffect)(() => {
|
|
3655
|
+
let active = true;
|
|
3656
|
+
fetchState().then((next) => {
|
|
3657
|
+
if (active) setState(next);
|
|
3658
|
+
}).catch((caught) => {
|
|
3659
|
+
if (active) setError(caught instanceof Error ? caught.message : props.t("failed"));
|
|
3660
|
+
});
|
|
3661
|
+
return () => {
|
|
3662
|
+
active = false;
|
|
3663
|
+
};
|
|
3664
|
+
}, [props.t]);
|
|
3665
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OllamaProviderCardView, {
|
|
3666
|
+
t: props.t,
|
|
3667
|
+
state,
|
|
3668
|
+
error
|
|
3669
|
+
});
|
|
3670
|
+
}
|
|
3926
3671
|
// src/client/styles.ts
|
|
3927
3672
|
const CSS_ID = "dsh-ollama-cloud-provider";
|
|
3928
3673
|
const CSS = `
|
|
@@ -4081,6 +3826,11 @@ window.__ModuleLoader__.load({
|
|
|
4081
3826
|
label: () => t("nav"),
|
|
4082
3827
|
locale: NS
|
|
4083
3828
|
}, OllamaCloudSettingsPage));
|
|
3829
|
+
ctx.slots.inject("settings.models.provider-card", () => slots.register({
|
|
3830
|
+
name: "settings.models.provider-card",
|
|
3831
|
+
key: "ollama-cloud",
|
|
3832
|
+
locale: NS
|
|
3833
|
+
}, OllamaProviderCard));
|
|
4084
3834
|
ctx.slots.inject("main", () => slots.register({
|
|
4085
3835
|
name: "main",
|
|
4086
3836
|
key: "ollama-panel",
|
package/lib/index.d.ts
CHANGED
|
@@ -476,8 +476,6 @@ interface RouteDeps {
|
|
|
476
476
|
readonly verifyDesktop?: (req: IncomingMessage) => Promise<boolean>;
|
|
477
477
|
/** Same verifier for private reads; falls back to `verifyDesktop`. */
|
|
478
478
|
readonly verifyHost?: (req: IncomingMessage) => Promise<boolean>;
|
|
479
|
-
/** Test seam for local Ollama inventory and mutation routes. */
|
|
480
|
-
readonly localFetch?: typeof fetch;
|
|
481
479
|
/** Test seam for unsaved-endpoint discovery. */
|
|
482
480
|
readonly discoveryFetch?: typeof fetch;
|
|
483
481
|
}
|
|
@@ -519,22 +517,6 @@ interface EffectiveModel extends OllamaCloudModelMeta {
|
|
|
519
517
|
}
|
|
520
518
|
declare function effectiveModel(id: string, config: ResolvedConfig): EffectiveModel;
|
|
521
519
|
declare function describeModel(meta: EffectiveModel, config: ResolvedConfig): string;
|
|
522
|
-
interface ModelProbe {
|
|
523
|
-
readonly contextWindow?: number;
|
|
524
|
-
readonly input: readonly ('text' | 'image')[];
|
|
525
|
-
readonly reasoning: readonly string[];
|
|
526
|
-
readonly reasoningToggle: boolean;
|
|
527
|
-
readonly tools: boolean;
|
|
528
|
-
readonly available: boolean;
|
|
529
|
-
}
|
|
530
|
-
declare function probeModel(config: ResolvedConfig, model: string, fetchImpl?: typeof fetch): Promise<ModelProbe | undefined>;
|
|
531
|
-
/** Clear all probe entries, or only entries for one endpoint. */
|
|
532
|
-
declare function clearModelProbeCache(baseURL?: string): void;
|
|
533
|
-
declare function modelProbeCacheInfo(): Array<{
|
|
534
|
-
baseURL: string;
|
|
535
|
-
model: string;
|
|
536
|
-
at: number;
|
|
537
|
-
}>;
|
|
538
520
|
declare const name = "llm-ollama-cloud";
|
|
539
521
|
declare const inject: string[];
|
|
540
522
|
/**
|
|
@@ -543,5 +525,5 @@ declare const inject: string[];
|
|
|
543
525
|
* without a restart.
|
|
544
526
|
*/
|
|
545
527
|
declare function apply(ctx: Context, config: Config): void;
|
|
546
|
-
export { type CommandDeps, Config, type Config as OllamaCloudConfig, OllamaCloudAdapter, type OllamaCloudAdapterDeps, PROVIDER, type ResolvedConfig, type ResolvedKey, type RouteDeps, type TransportId, type UsageReport, type UsageResult, type UsageWindow, apply, applyCommands, applyRoutes, classifyResponseError, clearCatalogCache,
|
|
528
|
+
export { type CommandDeps, Config, type Config as OllamaCloudConfig, OllamaCloudAdapter, type OllamaCloudAdapterDeps, PROVIDER, type ResolvedConfig, type ResolvedKey, type RouteDeps, type TransportId, type UsageReport, type UsageResult, type UsageWindow, apply, applyCommands, applyRoutes, classifyResponseError, clearCatalogCache, createKeyPool, createKeyResolver, createUsageReader, describeModel, effectiveModel, inject, name, normalizeBalance, normalizeUsage, resolveConfig };
|
|
547
529
|
//# sourceMappingURL=index.d.ts.map
|