@goodandready/dsh-ollama-cloud-provider 0.1.14 → 0.1.16
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 +74 -0
- package/README.md +4 -4
- package/README.ru.md +4 -4
- package/README.zh.md +4 -4
- package/lib/client.js +124 -46
- package/lib/index.d.ts +12 -1
- package/lib/index.js +219 -72
- package/package.json +34 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.16 — 2026-11-04
|
|
4
|
+
|
|
5
|
+
- Added DSH 0.2.2 support: `0.2.2-alpha.2`, `0.2.2-alpha.3` and `0.2.2-rc.1`
|
|
6
|
+
are in `compatibility.dshReleases`; the accepted range is now
|
|
7
|
+
`0.2.0-rc.2 || >=0.2.1-rc.2 <0.2.3-0` in `engines.dsh`,
|
|
8
|
+
`compatibility.dsh` and every DSH peer dependency.
|
|
9
|
+
- Added the Cordis and Schemastery generations used by 0.2.2:
|
|
10
|
+
`~4.0.6-alpha.1`/`~4.1.0` and `~3.18.6-alpha.1`/`~3.19.0`.
|
|
11
|
+
- Adapted host route registration to the 0.2.2 `WebRoute | WebResourceRoute`
|
|
12
|
+
union; command handlers use `WebRoute['handler']` without changing runtime
|
|
13
|
+
behavior.
|
|
14
|
+
- Verified 0.2.2-alpha.3 and 0.2.2-alpha.2 with typecheck/build and the key
|
|
15
|
+
runtime suites; 0.2.2-rc.1 passes the full 99-test suite, typecheck and build.
|
|
16
|
+
|
|
17
|
+
## 0.1.15 — 2026-11-02
|
|
18
|
+
|
|
19
|
+
- Desktop write requests are no longer accepted from a cookie name and a
|
|
20
|
+
Desktop user agent alone. After the loopback Host/socket checks, the plugin
|
|
21
|
+
verifies the `dsh-auth-*` cookie against the host's authenticated
|
|
22
|
+
`/api/version`; a 401/403 or a failed probe rejects the write. Forged
|
|
23
|
+
Desktop headers now return 403 (#42).
|
|
24
|
+
- Truncated streams now fail instead of reporting success: the native parser
|
|
25
|
+
rejects EOF before `done:true`, and the OpenAI parser rejects EOF before
|
|
26
|
+
`[DONE]`/`finish_reason` without emitting `block-end` or `finish`. Malformed
|
|
27
|
+
SSE JSON is an error instead of being skipped (#43).
|
|
28
|
+
- Added project-specific `AGENTS.md` and `index.md` with architecture,
|
|
29
|
+
constraints, compatibility, testing, security, and deployment facts (#44).
|
|
30
|
+
- Investigated the dev-only Zod advisory (#46). DSH core packages pin
|
|
31
|
+
`zod@4.4.3` exactly in rc.4, rc.5, and 0.2.2-alpha, so no in-range
|
|
32
|
+
dependency update exists; forced overrides are not used. The production tree
|
|
33
|
+
(`npm audit --omit=dev`) reports zero because the plugin has no runtime npm
|
|
34
|
+
dependencies. The dev-only advisory remains tracked upstream.
|
|
35
|
+
- Removed the local multi-version `test:engine` loop. It created its own DSH
|
|
36
|
+
runtime, installed a `file:` worktree package, and used forced cleanup,
|
|
37
|
+
contrary to the project test-server rules. Compatibility checks now follow
|
|
38
|
+
the approved test-server procedure in `docs/testing/test-server.md` (#47).
|
|
39
|
+
- SSE normalization now operates on the accumulated buffer, so CRLF split
|
|
40
|
+
between network chunks and split UTF-8 sequences parse correctly (#48).
|
|
41
|
+
- Live catalog metadata is scoped by API base, pruned when models disappear,
|
|
42
|
+
and invalidated together with the cache; a generation guard discards a
|
|
43
|
+
background refresh that finishes after a clear (#49).
|
|
44
|
+
- Request analytics no longer deduplicates independent requests by timestamp;
|
|
45
|
+
concurrent requests that start in the same millisecond and their errors are
|
|
46
|
+
counted (#50).
|
|
47
|
+
- Per-field price overrides now win over generated off-peak rates; partial
|
|
48
|
+
overrides apply only to the overridden field (#51).
|
|
49
|
+
- `/ollama test` disables reasoning, uses 64 tokens, and reports an empty or
|
|
50
|
+
reasoning-only reply as an error instead of `OK` (#52).
|
|
51
|
+
- Analytics scans the newest projection files by mtime when the directory
|
|
52
|
+
exceeds 5000 files and marks the report as truncated; the UI shows the
|
|
53
|
+
incompleteness warning (#53).
|
|
54
|
+
- The update card distinguishes a failed registry check from “up to date” and
|
|
55
|
+
offers a retry; the install button is disabled while the check has failed
|
|
56
|
+
(#54).
|
|
57
|
+
- Quota labels, window labels and credit detail are localized in English and
|
|
58
|
+
Chinese instead of rendering English strings directly (#55).
|
|
59
|
+
- Sensitive read routes (`state`, `analytics`, `usage`, `balance`) require a
|
|
60
|
+
host-verified session cookie; `health` and `status` remain public (#56).
|
|
61
|
+
- The usage reader honors its 30-second failure cache, caches a total failure,
|
|
62
|
+
and deduplicates concurrent reads (#57).
|
|
63
|
+
- Credential config patches and key writes are restricted to the plugin's
|
|
64
|
+
`OLLAMA_*` namespace, closing the two-step `OTHER_PLUGIN_API_KEY` mutation
|
|
65
|
+
path (#60).
|
|
66
|
+
- Saving or clearing a key refreshes server state without discarding an
|
|
67
|
+
unsaved settings draft (#62).
|
|
68
|
+
- Added an explicit `showAllModels` switch: an empty `visibleModels` list with
|
|
69
|
+
`showAllModels:false` now means “hide all” and survives save/reload; legacy
|
|
70
|
+
configs with an absent switch keep the previous empty-means-all behavior
|
|
71
|
+
(#63).
|
|
72
|
+
- Updated the design contract, README install examples and the default user
|
|
73
|
+
agent to the current version (#59).
|
|
74
|
+
- Removed the unused SSE event parser and the redundant stored image `base64`
|
|
75
|
+
field; transports keep using the single `dataUrl` representation (#58).
|
|
76
|
+
|
|
3
77
|
## 0.1.14 — 2026-10-29
|
|
4
78
|
|
|
5
79
|
- Model-scoped rejections (unsupported model or per-model quota) mark only that
|
package/README.md
CHANGED
|
@@ -104,17 +104,17 @@ npm pack
|
|
|
104
104
|
Install the published package:
|
|
105
105
|
|
|
106
106
|
```bash
|
|
107
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
107
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.16
|
|
108
108
|
# DSH Desktop:
|
|
109
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
109
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.16
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
Or install the packed tarball into a profile:
|
|
113
113
|
|
|
114
114
|
```bash
|
|
115
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
115
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.16.tgz
|
|
116
116
|
# DSH Desktop:
|
|
117
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
117
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.16.tgz
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
Restart dsh (or DSH Desktop), then pick **Ollama Cloud** in the model picker.
|
package/README.ru.md
CHANGED
|
@@ -103,17 +103,17 @@ npm pack
|
|
|
103
103
|
Установка опубликованного пакета из npm:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
106
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.16
|
|
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.16
|
|
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.16.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.16.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.16
|
|
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.16
|
|
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.16.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.16.tgz
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
|
package/lib/client.js
CHANGED
|
@@ -49,12 +49,16 @@ window.__ModuleLoader__.load({
|
|
|
49
49
|
tokens: "Tokens",
|
|
50
50
|
spend7d: "7-day spend",
|
|
51
51
|
remaining: "remaining",
|
|
52
|
+
quotaIncludedCredits: "Included credits",
|
|
53
|
+
quotaFiveHour: "5-hour window",
|
|
54
|
+
quotaWeekly: "Weekly window",
|
|
52
55
|
until: "until",
|
|
53
56
|
purchased: "Purchased",
|
|
54
57
|
range: "Range",
|
|
55
58
|
last24h: "Last 24 hours",
|
|
56
59
|
last7d: "Last 7 days",
|
|
57
60
|
last30d: "Last 30 days",
|
|
61
|
+
last90d: "Last 90 days",
|
|
58
62
|
activeAccountNow: "Active account",
|
|
59
63
|
noActiveAccount: "No active account",
|
|
60
64
|
accounts: "Accounts",
|
|
@@ -132,6 +136,7 @@ window.__ModuleLoader__.load({
|
|
|
132
136
|
planLabelHint: "Optional label shown on the sidebar card, for example PRO. Ollama does not expose the plan name via API.",
|
|
133
137
|
usageAnalytics: "Usage analytics",
|
|
134
138
|
analyticsEmpty: "No Ollama Cloud sessions in this window.",
|
|
139
|
+
analyticsTruncated: "Only the newest session files were scanned; the totals are incomplete.",
|
|
135
140
|
analyticsHint: "Aggregated from the local session projection cache: numeric metadata only, no prompt text.",
|
|
136
141
|
days: "Days",
|
|
137
142
|
sessions: "Sessions",
|
|
@@ -165,6 +170,7 @@ window.__ModuleLoader__.load({
|
|
|
165
170
|
markTransport: "Transport error",
|
|
166
171
|
pluginUpdate: "Plugin update",
|
|
167
172
|
updateCheckFailed: "Could not check for updates",
|
|
173
|
+
retry: "Retry",
|
|
168
174
|
updateFailed: "Update failed",
|
|
169
175
|
updateAvailable: "Update available",
|
|
170
176
|
updateUnavailable: "Automatic update is unavailable in this runtime.",
|
|
@@ -216,12 +222,16 @@ window.__ModuleLoader__.load({
|
|
|
216
222
|
tokens: "Token",
|
|
217
223
|
spend7d: "7 天费用",
|
|
218
224
|
remaining: "剩余",
|
|
225
|
+
quotaIncludedCredits: "包含额度",
|
|
226
|
+
quotaFiveHour: "5 小时窗口",
|
|
227
|
+
quotaWeekly: "每周窗口",
|
|
219
228
|
until: "至",
|
|
220
229
|
purchased: "已购买",
|
|
221
230
|
range: "范围",
|
|
222
231
|
last24h: "最近 24 小时",
|
|
223
232
|
last7d: "最近 7 天",
|
|
224
233
|
last30d: "最近 30 天",
|
|
234
|
+
last90d: "最近 90 天",
|
|
225
235
|
activeAccountNow: "当前账号",
|
|
226
236
|
noActiveAccount: "没有可用账号",
|
|
227
237
|
accounts: "账号",
|
|
@@ -299,6 +309,7 @@ window.__ModuleLoader__.load({
|
|
|
299
309
|
planLabelHint: "侧边栏卡片上显示的可选标签,例如 PRO。Ollama API 不提供套餐名称。",
|
|
300
310
|
usageAnalytics: "用量分析",
|
|
301
311
|
analyticsEmpty: "此窗口内没有 Ollama Cloud 会话。",
|
|
312
|
+
analyticsTruncated: "仅扫描了最新的会话文件,合计数据不完整。",
|
|
302
313
|
analyticsHint: "来自本地会话投影缓存,仅包含数值元数据,不读取提示词。",
|
|
303
314
|
days: "天数",
|
|
304
315
|
sessions: "会话",
|
|
@@ -332,6 +343,7 @@ window.__ModuleLoader__.load({
|
|
|
332
343
|
markTransport: "传输错误",
|
|
333
344
|
pluginUpdate: "插件更新",
|
|
334
345
|
updateCheckFailed: "无法检查更新",
|
|
346
|
+
retry: "重试",
|
|
335
347
|
updateFailed: "更新失败",
|
|
336
348
|
updateAvailable: "有可用更新",
|
|
337
349
|
updateUnavailable: "当前运行环境不支持自动更新。",
|
|
@@ -346,15 +358,18 @@ window.__ModuleLoader__.load({
|
|
|
346
358
|
};
|
|
347
359
|
// src/quota-model.ts
|
|
348
360
|
function bar(key, label, usedPercent, extra = {}) {
|
|
361
|
+
const labelKey = key === "included" ? "quotaIncludedCredits" : key === "fiveHour" ? "quotaFiveHour" : key === "weekly" ? "quotaWeekly" : void 0;
|
|
349
362
|
const used = Math.max(0, Math.min(100, usedPercent));
|
|
350
363
|
return {
|
|
351
364
|
key,
|
|
352
365
|
label,
|
|
366
|
+
...labelKey === void 0 ? {} : { labelKey },
|
|
353
367
|
usedPercent: used,
|
|
354
368
|
remainingPercent: 100 - used,
|
|
355
369
|
...extra.resetsAt === void 0 ? {} : { resetsAt: extra.resetsAt },
|
|
356
370
|
...extra.status === void 0 ? {} : { status: extra.status },
|
|
357
|
-
...extra.detail === void 0 ? {} : { detail: extra.detail }
|
|
371
|
+
...extra.detail === void 0 ? {} : { detail: extra.detail },
|
|
372
|
+
...extra.detailValues === void 0 ? {} : { detailValues: extra.detailValues }
|
|
358
373
|
};
|
|
359
374
|
}
|
|
360
375
|
function legacyBar(key, label, window) {
|
|
@@ -371,6 +386,11 @@ window.__ModuleLoader__.load({
|
|
|
371
386
|
const credits = report.credits;
|
|
372
387
|
return [bar("included", "Included credits", credits.includedAllowance > 0 ? (credits.includedAllowance - credits.includedRemaining) / credits.includedAllowance * 100 : 0, {
|
|
373
388
|
detail: `$${credits.includedRemaining.toFixed(2)} of $${credits.includedAllowance.toFixed(2)} left` + (credits.purchased > 0 ? ` · $${credits.purchased.toFixed(2)} purchased` : ""),
|
|
389
|
+
detailValues: {
|
|
390
|
+
remaining: credits.includedRemaining,
|
|
391
|
+
allowance: credits.includedAllowance,
|
|
392
|
+
purchased: credits.purchased
|
|
393
|
+
},
|
|
374
394
|
...credits.periodUntil === void 0 ? {} : { resetsAt: credits.periodUntil }
|
|
375
395
|
})];
|
|
376
396
|
}
|
|
@@ -385,16 +405,19 @@ window.__ModuleLoader__.load({
|
|
|
385
405
|
report.windows.d24 === void 0 ? void 0 : {
|
|
386
406
|
key: "24h",
|
|
387
407
|
label: "24 hours",
|
|
408
|
+
labelKey: "last24h",
|
|
388
409
|
totals: report.windows.d24
|
|
389
410
|
},
|
|
390
411
|
report.windows.d7 === void 0 ? void 0 : {
|
|
391
412
|
key: "7d",
|
|
392
413
|
label: "7 days",
|
|
414
|
+
labelKey: "last7d",
|
|
393
415
|
totals: report.windows.d7
|
|
394
416
|
},
|
|
395
417
|
report.windows.d30 === void 0 ? void 0 : {
|
|
396
418
|
key: "30d",
|
|
397
419
|
label: "30 days",
|
|
420
|
+
labelKey: "last30d",
|
|
398
421
|
totals: report.windows.d30
|
|
399
422
|
}
|
|
400
423
|
].filter((entry) => entry !== void 0);
|
|
@@ -842,15 +865,15 @@ window.__ModuleLoader__.load({
|
|
|
842
865
|
children: [
|
|
843
866
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
844
867
|
value: "7",
|
|
845
|
-
children: "
|
|
868
|
+
children: t("last7d")
|
|
846
869
|
}),
|
|
847
870
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
848
871
|
value: "30",
|
|
849
|
-
children: "
|
|
872
|
+
children: t("last30d")
|
|
850
873
|
}),
|
|
851
874
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
852
875
|
value: "90",
|
|
853
|
-
children: "
|
|
876
|
+
children: t("last90d")
|
|
854
877
|
})
|
|
855
878
|
]
|
|
856
879
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -871,6 +894,10 @@ window.__ModuleLoader__.load({
|
|
|
871
894
|
})]
|
|
872
895
|
})]
|
|
873
896
|
}),
|
|
897
|
+
analytics.truncated === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
898
|
+
className: "ocl-hint",
|
|
899
|
+
children: t("analyticsTruncated")
|
|
900
|
+
}) : null,
|
|
874
901
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
875
902
|
className: "ocl-kpi-grid",
|
|
876
903
|
children: [
|
|
@@ -963,8 +990,8 @@ window.__ModuleLoader__.load({
|
|
|
963
990
|
className: "ocl-bar-row",
|
|
964
991
|
children: [
|
|
965
992
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
966
|
-
title: entry.label,
|
|
967
|
-
children: entry.label
|
|
993
|
+
title: entry.labelKey === void 0 ? entry.label : t(entry.labelKey),
|
|
994
|
+
children: entry.labelKey === void 0 ? entry.label : t(entry.labelKey)
|
|
968
995
|
}),
|
|
969
996
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
970
997
|
className: "ocl-bar",
|
|
@@ -982,9 +1009,20 @@ window.__ModuleLoader__.load({
|
|
|
982
1009
|
entry.resetsAt === void 0 ? "" : ` · ${reset(entry.resetsAt)}`
|
|
983
1010
|
]
|
|
984
1011
|
}),
|
|
985
|
-
entry.detail === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1012
|
+
entry.detailValues === void 0 ? entry.detail === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
986
1013
|
className: "ocl-hint",
|
|
987
1014
|
children: entry.detail
|
|
1015
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1016
|
+
className: "ocl-hint",
|
|
1017
|
+
children: [
|
|
1018
|
+
"$",
|
|
1019
|
+
entry.detailValues.remaining.toFixed(2),
|
|
1020
|
+
" / $",
|
|
1021
|
+
entry.detailValues.allowance.toFixed(2),
|
|
1022
|
+
" ",
|
|
1023
|
+
t("remaining"),
|
|
1024
|
+
entry.detailValues.purchased > 0 ? ` · ${t("purchased")} $${entry.detailValues.purchased.toFixed(2)}` : ""
|
|
1025
|
+
]
|
|
988
1026
|
})
|
|
989
1027
|
]
|
|
990
1028
|
}, entry.key))
|
|
@@ -1100,7 +1138,7 @@ window.__ModuleLoader__.load({
|
|
|
1100
1138
|
const worst = worstUsedPercent(report);
|
|
1101
1139
|
const plan = state?.config.planLabel?.trim() ?? "";
|
|
1102
1140
|
const name = plan === "" ? t("quotaCardName") : `${t("quotaCardName")} · ${plan}`;
|
|
1103
|
-
const detail = bars.map((entry) => `${entry.label}: ${entry.remainingPercent.toFixed(0)}% ${t("remaining")}`).join(" · ");
|
|
1141
|
+
const detail = bars.map((entry) => `${entry.labelKey === void 0 ? entry.label : t(entry.labelKey)}: ${entry.remainingPercent.toFixed(0)}% ${t("remaining")}`).join(" · ");
|
|
1104
1142
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1105
1143
|
type: "button",
|
|
1106
1144
|
className: "ocl-foot",
|
|
@@ -1131,7 +1169,7 @@ window.__ModuleLoader__.load({
|
|
|
1131
1169
|
className: "ocl-footHead",
|
|
1132
1170
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1133
1171
|
className: "ocl-footLabel",
|
|
1134
|
-
children: entry.label
|
|
1172
|
+
children: entry.labelKey === void 0 ? entry.label : t(entry.labelKey)
|
|
1135
1173
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1136
1174
|
className: "ocl-footAmount",
|
|
1137
1175
|
children: [
|
|
@@ -1288,7 +1326,7 @@ window.__ModuleLoader__.load({
|
|
|
1288
1326
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("spend") }),
|
|
1289
1327
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", { children: t("tokens") })
|
|
1290
1328
|
] }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
|
|
1291
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: row.
|
|
1329
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: t(row.labelKey) }),
|
|
1292
1330
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: row.totals.requests }),
|
|
1293
1331
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", { children: ["$", row.totals.usd.toFixed(3)] }),
|
|
1294
1332
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: row.totals.inputTokens + row.totals.outputTokens })
|
|
@@ -1467,9 +1505,9 @@ window.__ModuleLoader__.load({
|
|
|
1467
1505
|
accounts: state.config.accounts.map((account) => ({ ...account })),
|
|
1468
1506
|
modelAccountRules: state.config.modelAccountRules.map((rule) => ({ ...rule })),
|
|
1469
1507
|
stickySession: state.config.stickySession,
|
|
1470
|
-
visibleModels: state.config.
|
|
1508
|
+
visibleModels: state.config.showAllModels ? allIds : [...state.config.visibleModels],
|
|
1471
1509
|
filterModelsByPlan: state.config.filterModelsByPlan,
|
|
1472
|
-
showAll: state.config.
|
|
1510
|
+
showAll: state.config.showAllModels,
|
|
1473
1511
|
modelTransports: { ...state.config.modelTransports }
|
|
1474
1512
|
};
|
|
1475
1513
|
}
|
|
@@ -1505,6 +1543,7 @@ window.__ModuleLoader__.load({
|
|
|
1505
1543
|
})).filter((rule) => rule.pattern !== "" && rule.account !== ""),
|
|
1506
1544
|
stickySession: draft.stickySession,
|
|
1507
1545
|
visibleModels: draft.showAll ? [] : draft.visibleModels,
|
|
1546
|
+
showAllModels: draft.showAll,
|
|
1508
1547
|
filterModelsByPlan: draft.filterModelsByPlan,
|
|
1509
1548
|
modelTransports: Object.fromEntries(Object.entries(draft.modelTransports).filter(([, value]) => value !== ""))
|
|
1510
1549
|
};
|
|
@@ -1519,6 +1558,18 @@ window.__ModuleLoader__.load({
|
|
|
1519
1558
|
return false;
|
|
1520
1559
|
}
|
|
1521
1560
|
}
|
|
1561
|
+
/** Refresh may keep an unsaved draft, but a config save replaces it. */
|
|
1562
|
+
function mergeLoadedDraft(current, next, preserve) {
|
|
1563
|
+
return preserve && current !== null ? current : next;
|
|
1564
|
+
}
|
|
1565
|
+
// src/client/update-state.ts
|
|
1566
|
+
function updateBadge(status) {
|
|
1567
|
+
if (status.latestCheckFailed) return "failed";
|
|
1568
|
+
return status.updateAvailable ? "available" : "current";
|
|
1569
|
+
}
|
|
1570
|
+
function canInstallUpdate(status) {
|
|
1571
|
+
return !status.latestCheckFailed && status.updateAvailable && status.updatedVersion === void 0;
|
|
1572
|
+
}
|
|
1522
1573
|
// src/client/update-card.tsx
|
|
1523
1574
|
function PluginUpdateCard(props) {
|
|
1524
1575
|
const { t } = props;
|
|
@@ -1548,12 +1599,27 @@ window.__ModuleLoader__.load({
|
|
|
1548
1599
|
setError(caught instanceof Error ? caught.message : t("updateFailed"));
|
|
1549
1600
|
}).finally(() => setBusy(false));
|
|
1550
1601
|
};
|
|
1602
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PluginUpdateCardView, {
|
|
1603
|
+
status,
|
|
1604
|
+
error,
|
|
1605
|
+
busy,
|
|
1606
|
+
notice,
|
|
1607
|
+
t,
|
|
1608
|
+
onRetry: load,
|
|
1609
|
+
onUpdate: update
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
function PluginUpdateCardView(props) {
|
|
1613
|
+
const { status, error, busy, notice, t, onRetry, onUpdate } = props;
|
|
1551
1614
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1552
1615
|
className: "ocl-card",
|
|
1553
1616
|
children: [
|
|
1554
1617
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
|
|
1555
1618
|
className: "ocl-card-title",
|
|
1556
|
-
children: [t("pluginUpdate"), status === null ? null : status
|
|
1619
|
+
children: [t("pluginUpdate"), status === null ? null : updateBadge(status) === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1620
|
+
className: "ocl-badge ocl-badge-warn",
|
|
1621
|
+
children: t("updateCheckFailed")
|
|
1622
|
+
}) : updateBadge(status) === "available" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1557
1623
|
className: "ocl-badge ocl-badge-warn",
|
|
1558
1624
|
children: t("updateAvailable")
|
|
1559
1625
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -1564,33 +1630,45 @@ window.__ModuleLoader__.load({
|
|
|
1564
1630
|
status === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1565
1631
|
className: "ocl-hint",
|
|
1566
1632
|
children: error ?? t("checking")
|
|
1567
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1633
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1634
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1635
|
+
className: "ocl-row",
|
|
1636
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1637
|
+
className: "ocl-badge",
|
|
1638
|
+
children: [
|
|
1639
|
+
t("currentVersion"),
|
|
1640
|
+
": ",
|
|
1641
|
+
status.currentVersion
|
|
1642
|
+
]
|
|
1643
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1644
|
+
className: "ocl-badge",
|
|
1645
|
+
children: [
|
|
1646
|
+
t("latestVersion"),
|
|
1647
|
+
": ",
|
|
1648
|
+
status.latestVersion ?? "—"
|
|
1649
|
+
]
|
|
1650
|
+
})]
|
|
1651
|
+
}),
|
|
1652
|
+
status.latestCheckFailed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1653
|
+
className: "ocl-hint",
|
|
1654
|
+
children: [t("updateCheckFailed"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1655
|
+
type: "button",
|
|
1656
|
+
className: "ocl-button",
|
|
1657
|
+
onClick: onRetry,
|
|
1658
|
+
children: t("retry")
|
|
1659
|
+
})]
|
|
1660
|
+
}) : null,
|
|
1661
|
+
status.canAutoUpdate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1662
|
+
type: "button",
|
|
1663
|
+
className: "ocl-button",
|
|
1664
|
+
disabled: busy || !canInstallUpdate(status),
|
|
1665
|
+
onClick: onUpdate,
|
|
1666
|
+
children: busy ? t("updating") : t("updateNow")
|
|
1667
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1668
|
+
className: "ocl-hint",
|
|
1669
|
+
children: t("updateUnavailable")
|
|
1670
|
+
})
|
|
1671
|
+
] }),
|
|
1594
1672
|
notice === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1595
1673
|
className: "ocl-notice",
|
|
1596
1674
|
children: notice
|
|
@@ -1701,14 +1779,14 @@ window.__ModuleLoader__.load({
|
|
|
1701
1779
|
const [service, setService] = (0, react.useState)(null);
|
|
1702
1780
|
const [serviceBusy, setServiceBusy] = (0, react.useState)(false);
|
|
1703
1781
|
const [serviceError, setServiceError] = (0, react.useState)(null);
|
|
1704
|
-
const load = (0, react.useCallback)(async () => {
|
|
1782
|
+
const load = (0, react.useCallback)(async (preserveDraft = false) => {
|
|
1705
1783
|
setLoading(true);
|
|
1706
1784
|
try {
|
|
1707
1785
|
const next = await fetchState();
|
|
1708
1786
|
setState(next);
|
|
1709
1787
|
const draftNext = draftOf(next);
|
|
1710
|
-
setDraft(draftNext);
|
|
1711
|
-
setOriginal(draftNext);
|
|
1788
|
+
setDraft((current) => mergeLoadedDraft(current, draftNext, preserveDraft));
|
|
1789
|
+
setOriginal((current) => mergeLoadedDraft(current, draftNext, preserveDraft));
|
|
1712
1790
|
setError(null);
|
|
1713
1791
|
} catch (caught) {
|
|
1714
1792
|
setError(caught instanceof Error ? caught.message : t("failed"));
|
|
@@ -1884,7 +1962,7 @@ window.__ModuleLoader__.load({
|
|
|
1884
1962
|
saveKey(draft.apiKeyEnv || "OLLAMA_API_KEY", keyDraft.trim()).then(() => {
|
|
1885
1963
|
setKeyDraft("");
|
|
1886
1964
|
setNotice(t("saved"));
|
|
1887
|
-
return load();
|
|
1965
|
+
return load(true);
|
|
1888
1966
|
}).catch((caught) => setError(caught instanceof Error ? caught.message : t("failed")));
|
|
1889
1967
|
},
|
|
1890
1968
|
children: t("saveKey")
|
|
@@ -1895,7 +1973,7 @@ window.__ModuleLoader__.load({
|
|
|
1895
1973
|
onClick: () => {
|
|
1896
1974
|
clearKey(draft.apiKeyEnv || "OLLAMA_API_KEY").then(() => {
|
|
1897
1975
|
setNotice(t("saved"));
|
|
1898
|
-
return load();
|
|
1976
|
+
return load(true);
|
|
1899
1977
|
}).catch((caught) => setError(caught instanceof Error ? caught.message : t("failed")));
|
|
1900
1978
|
},
|
|
1901
1979
|
children: t("clearKey")
|
|
@@ -2160,7 +2238,7 @@ window.__ModuleLoader__.load({
|
|
|
2160
2238
|
[account.label]: ""
|
|
2161
2239
|
}));
|
|
2162
2240
|
setNotice(t("saved"));
|
|
2163
|
-
return load();
|
|
2241
|
+
return load(true);
|
|
2164
2242
|
}).catch((caught) => setError(caught instanceof Error ? caught.message : t("failed")));
|
|
2165
2243
|
},
|
|
2166
2244
|
children: t("saveKey")
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { GenerateOptions, LlmAdapter, LlmError, LlmModelInfo, LlmProviderInfo, L
|
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
3
|
import { Context } from "@deepseek-ai/cordis";
|
|
4
4
|
import { AttachmentStore } from "@deepseek-ai/dsh-attachment";
|
|
5
|
+
import { IncomingMessage } from "node:http";
|
|
5
6
|
import { WebServer } from "@deepseek-ai/dsh-host-webserver";
|
|
6
7
|
type TransportId = 'native' | 'openai-chat';
|
|
7
8
|
interface AccountConfig {
|
|
@@ -43,8 +44,10 @@ interface Config {
|
|
|
43
44
|
requestTimeoutMs?: number;
|
|
44
45
|
/** Milliseconds a stream may stall; defaults to 300s. */
|
|
45
46
|
streamIdleTimeoutMs?: number;
|
|
46
|
-
/** Visible-model allowlist; empty means
|
|
47
|
+
/** Visible-model allowlist; empty with `showAllModels:false` means none. */
|
|
47
48
|
visibleModels?: string[];
|
|
49
|
+
/** Explicit all-models switch; absent means derive from `visibleModels`. */
|
|
50
|
+
showAllModels?: boolean;
|
|
48
51
|
/** Per-model visibility overrides; wins over `visibleModels`. */
|
|
49
52
|
modelVisibility?: Record<string, boolean>;
|
|
50
53
|
/** Hide models the cloud marks unsupported in the API; defaults to true. */
|
|
@@ -85,6 +88,7 @@ interface ResolvedConfig {
|
|
|
85
88
|
requestTimeoutMs: number;
|
|
86
89
|
streamIdleTimeoutMs: number;
|
|
87
90
|
visibleModels: readonly string[];
|
|
91
|
+
showAllModels: boolean;
|
|
88
92
|
modelVisibility: Readonly<Record<string, boolean>>;
|
|
89
93
|
filterModelsByPlan: boolean;
|
|
90
94
|
contextWindow?: number;
|
|
@@ -380,6 +384,9 @@ interface AnalyticsReport {
|
|
|
380
384
|
summary: AnalyticsSummary;
|
|
381
385
|
days: DayUsageRow[];
|
|
382
386
|
sessions: SessionUsageRow[];
|
|
387
|
+
/** The projection directory held more files than the bounded scan. */
|
|
388
|
+
truncated?: boolean;
|
|
389
|
+
totalFiles?: number;
|
|
383
390
|
}
|
|
384
391
|
interface RouteDeps {
|
|
385
392
|
readonly config: () => ResolvedConfig;
|
|
@@ -389,6 +396,10 @@ interface RouteDeps {
|
|
|
389
396
|
readonly analytics?: (days: number) => Promise<AnalyticsReport>;
|
|
390
397
|
readonly heatmap?: (days: number) => Promise<RequestHeatmap>;
|
|
391
398
|
readonly refreshTui?: () => void;
|
|
399
|
+
/** Test seam; defaults to verifying the cookie against the host API. */
|
|
400
|
+
readonly verifyDesktop?: (req: IncomingMessage) => Promise<boolean>;
|
|
401
|
+
/** Same verifier for private reads; falls back to `verifyDesktop`. */
|
|
402
|
+
readonly verifyHost?: (req: IncomingMessage) => Promise<boolean>;
|
|
392
403
|
}
|
|
393
404
|
/** Register the Host HTTP surface consumed by the browser settings page. */
|
|
394
405
|
declare function applyRoutes(ctx: Context, web: WebServer, deps: RouteDeps): void;
|