@dsh-plus/lifeboat 0.2.29 → 0.3.0
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/lib/client.js +67 -41
- package/lib/index.d.ts +0 -2
- package/lib/index.js +165 -241
- package/package.json +2 -2
- package/src/client/health-styles.ts +4 -2
- package/src/client/health-tab.tsx +63 -36
- package/src/config.ts +0 -14
- package/src/copy-guide.ts +153 -0
- package/src/health-api.ts +6 -11
- package/src/index.ts +22 -23
- package/src/official-copy-status.ts +100 -0
- package/src/state-file.ts +7 -25
- package/src/fallback-llm.ts +0 -355
package/lib/client.js
CHANGED
|
@@ -41,8 +41,13 @@ window.__ModuleLoader__.load({
|
|
|
41
41
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
42
42
|
let react = require("react");
|
|
43
43
|
require("@deepseek-ai/dsh-client-ui-primitives");
|
|
44
|
+
//#region ../shared/src/client/fields.tsx
|
|
45
|
+
var init_fields = __esmMin((() => {}));
|
|
46
|
+
//#endregion
|
|
44
47
|
//#region ../shared/src/client/card.tsx
|
|
45
|
-
var init_card = __esmMin((() => {
|
|
48
|
+
var init_card = __esmMin((() => {
|
|
49
|
+
init_fields();
|
|
50
|
+
}));
|
|
46
51
|
//#endregion
|
|
47
52
|
//#region ../shared/src/client/draft.ts
|
|
48
53
|
/**
|
|
@@ -80,9 +85,6 @@ window.__ModuleLoader__.load({
|
|
|
80
85
|
}
|
|
81
86
|
var init_fetch = __esmMin((() => {}));
|
|
82
87
|
//#endregion
|
|
83
|
-
//#region ../shared/src/client/fields.tsx
|
|
84
|
-
var init_fields = __esmMin((() => {}));
|
|
85
|
-
//#endregion
|
|
86
88
|
//#region ../shared/src/client/icons.tsx
|
|
87
89
|
var init_icons = __esmMin((() => {}));
|
|
88
90
|
//#endregion
|
|
@@ -128,8 +130,10 @@ window.__ModuleLoader__.load({
|
|
|
128
130
|
.dlb-empty{color:var(--dsw-alias-label-tertiary);font-size:13px;margin:4px 0}
|
|
129
131
|
.dlb-title{color:var(--dsw-alias-label-secondary);font-size:13px;font-weight:600;margin:10px 0 0}
|
|
130
132
|
.dlb-notice{color:var(--dsw-alias-label-secondary);font-size:12px;margin:0}
|
|
131
|
-
.dlb-
|
|
132
|
-
.dlb-
|
|
133
|
+
.dlb-copy{border:1px solid var(--dsw-alias-border-l2);border-radius:10px;padding:10px 12px;display:flex;flex-direction:column;gap:6px;background:var(--dsw-alias-bg-layer-3)}
|
|
134
|
+
.dlb-copyTitle{color:var(--dsw-alias-label-secondary);font-size:13px;font-weight:600;margin:0}
|
|
135
|
+
.dlb-copyWarning{color:var(--dsw-alias-label-warning,#e0a03c);font-size:12px;margin:0}
|
|
136
|
+
.dlb-copyHint{color:var(--dsw-alias-label-tertiary);font-size:12px;margin:0;line-height:1.6}
|
|
133
137
|
.dlb-kv{display:flex;align-items:center;gap:8px;font-size:12px;flex-wrap:wrap}
|
|
134
138
|
.dlb-kv span{color:var(--dsw-alias-label-tertiary);flex:none}
|
|
135
139
|
.dlb-kv code{color:var(--dsw-alias-label-primary);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;word-break:break-all}
|
|
@@ -172,6 +176,45 @@ window.__ModuleLoader__.load({
|
|
|
172
176
|
const status = value;
|
|
173
177
|
return Array.isArray(status.journal) && Array.isArray(status.quarantined);
|
|
174
178
|
}
|
|
179
|
+
/** 官方应急副本状态卡片(纯展示:路径/生成时间/覆盖 route/警告 + 应用指引)。 */
|
|
180
|
+
function CopyStatusCard(props) {
|
|
181
|
+
const { copy, t } = props;
|
|
182
|
+
const generated = copy.updatedAt === void 0 ? t("copyMissing") : new Date(copy.updatedAt).toISOString().slice(0, 19).replace("T", " ");
|
|
183
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
184
|
+
className: "dlb-copy",
|
|
185
|
+
role: "status",
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
188
|
+
className: "dlb-copyTitle",
|
|
189
|
+
children: t("copyTitle")
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
192
|
+
className: "dlb-kv",
|
|
193
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("copyPath") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: copy.path })]
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
196
|
+
className: "dlb-kv",
|
|
197
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("copyAt") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: generated })]
|
|
198
|
+
}),
|
|
199
|
+
copy.routes !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
200
|
+
className: "dlb-kv",
|
|
201
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("copyRoutes") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: copy.routes })]
|
|
202
|
+
}) : null,
|
|
203
|
+
copy.detail !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
204
|
+
className: "dlb-copyWarning",
|
|
205
|
+
children: copy.detail
|
|
206
|
+
}) : null,
|
|
207
|
+
copy.warnings.map((warning) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
208
|
+
className: "dlb-copyWarning",
|
|
209
|
+
children: `${t("copyWarning")}:${warning}`
|
|
210
|
+
}, warning)),
|
|
211
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
212
|
+
className: "dlb-copyHint",
|
|
213
|
+
children: t("copyApplyHint")
|
|
214
|
+
})
|
|
215
|
+
]
|
|
216
|
+
});
|
|
217
|
+
}
|
|
175
218
|
function HealthTab(props) {
|
|
176
219
|
const { t } = props;
|
|
177
220
|
const [status, setStatus] = (0, react.useState)(null);
|
|
@@ -229,31 +272,9 @@ window.__ModuleLoader__.load({
|
|
|
229
272
|
role: "status",
|
|
230
273
|
children: notice
|
|
231
274
|
}) : null,
|
|
232
|
-
status.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
children: [
|
|
236
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
237
|
-
className: "dlb-fallbackTitle",
|
|
238
|
-
children: t("fallbackActive")
|
|
239
|
-
}),
|
|
240
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
241
|
-
className: "dlb-kv",
|
|
242
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("fallbackFrom") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("code", { children: [
|
|
243
|
-
status.llmFallback.originalProvider,
|
|
244
|
-
"/",
|
|
245
|
-
status.llmFallback.originalModel
|
|
246
|
-
] })]
|
|
247
|
-
}),
|
|
248
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
249
|
-
className: "dlb-kv",
|
|
250
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("fallbackTo") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: status.llmFallback.fallbackProvider })]
|
|
251
|
-
}),
|
|
252
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
253
|
-
className: "dlb-kv",
|
|
254
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("fallbackAt") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: status.llmFallback.at.slice(0, 19).replace("T", " ") })]
|
|
255
|
-
})
|
|
256
|
-
]
|
|
275
|
+
status.officialCopy !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyStatusCard, {
|
|
276
|
+
copy: status.officialCopy,
|
|
277
|
+
t
|
|
257
278
|
}) : null,
|
|
258
279
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
259
280
|
className: "dlb-title",
|
|
@@ -367,15 +388,17 @@ window.__ModuleLoader__.load({
|
|
|
367
388
|
alert: "dlb-kindAlert",
|
|
368
389
|
quarantine: "dlb-kindQuarantine",
|
|
369
390
|
"quarantine-restore": "dlb-kindRestore",
|
|
370
|
-
"llm-
|
|
371
|
-
"llm-fallback-revert": "dlb-kindRestore"
|
|
391
|
+
"llm-copy-guide": "dlb-kindFallback"
|
|
372
392
|
};
|
|
373
393
|
zhDict = {
|
|
374
394
|
tab: "救生艇",
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
395
|
+
copyTitle: "官方应急 LLM 副本",
|
|
396
|
+
copyPath: "副本路径",
|
|
397
|
+
copyAt: "生成时间",
|
|
398
|
+
copyRoutes: "覆盖 route",
|
|
399
|
+
copyMissing: "未生成",
|
|
400
|
+
copyWarning: "警告",
|
|
401
|
+
copyApplyHint: "应用:dsh <profile> --patch 上述路径(重启/重载生效),或把副本条目并入当前 profile 的 cordis.patch.yml(热应用)。应用即禁用 dsh-plus-llm-pi 并切换 llm-pi-ai 配置;回退只需移除 --patch/并入条目。",
|
|
379
402
|
quarantined: "已隔离插件",
|
|
380
403
|
restore: "恢复",
|
|
381
404
|
restoring: "恢复中…",
|
|
@@ -394,10 +417,13 @@ window.__ModuleLoader__.load({
|
|
|
394
417
|
};
|
|
395
418
|
enDict = {
|
|
396
419
|
tab: "Lifeboat",
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
420
|
+
copyTitle: "Official emergency LLM copy",
|
|
421
|
+
copyPath: "Path",
|
|
422
|
+
copyAt: "Generated",
|
|
423
|
+
copyRoutes: "Routes",
|
|
424
|
+
copyMissing: "not generated",
|
|
425
|
+
copyWarning: "Warning",
|
|
426
|
+
copyApplyHint: "Apply: dsh <profile> --patch <path above> (restart/reload), or merge the rows into this profile's cordis.patch.yml (hot-applied). Applying disables dsh-plus-llm-pi and switches llm-pi-ai; revert by removing the --patch flag/rows.",
|
|
401
427
|
quarantined: "Quarantined plugins",
|
|
402
428
|
restore: "Restore",
|
|
403
429
|
restoring: "Restoring…",
|
package/lib/index.d.ts
CHANGED
|
@@ -5,12 +5,10 @@ import { Context } from "@deepseek-ai/cordis";
|
|
|
5
5
|
declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
6
6
|
enabled: z<boolean, boolean, "defined">;
|
|
7
7
|
patchFile: z<string, string, "defined">;
|
|
8
|
-
llmFallback: z<boolean, boolean, "defined">;
|
|
9
8
|
alertCooldownMs: z<number, number, "defined">;
|
|
10
9
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
11
10
|
enabled: z<boolean, boolean, "defined">;
|
|
12
11
|
patchFile: z<string, string, "defined">;
|
|
13
|
-
llmFallback: z<boolean, boolean, "defined">;
|
|
14
12
|
alertCooldownMs: z<number, number, "defined">;
|
|
15
13
|
}>>, "plain">;
|
|
16
14
|
type LifeboatConfig = Schemastery.TypeT<typeof Config>;
|