@max-null/dsh-plugin-center 0.2.13 → 0.2.14
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/client.js +512 -15
- package/dist/engine.d.ts +21 -1
- package/dist/engine.js +65 -2
- package/dist/llm-log.d.ts +25 -0
- package/dist/llm-log.js +70 -0
- package/dist/rpc.js +39 -0
- package/dist/update.d.ts +57 -0
- package/dist/update.js +205 -2
- package/package.json +7 -4
- package/skills/dsh-plugin-upgrade/SKILL.md +121 -0
package/client.js
CHANGED
|
@@ -32,6 +32,34 @@ __export(index_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(index_exports);
|
|
33
33
|
var import_react_dom = require("react-dom");
|
|
34
34
|
var import_react = require("react");
|
|
35
|
+
|
|
36
|
+
// client/llm-decision.ts
|
|
37
|
+
function decideLlmState(input) {
|
|
38
|
+
const { rec, sessionRunning, graceActive } = input;
|
|
39
|
+
if (rec !== null && rec.status !== "running" && rec.status !== "pending") {
|
|
40
|
+
return rec.status === "success" ? "success" : rec.status === "failed" ? "failed" : "ended";
|
|
41
|
+
}
|
|
42
|
+
if (sessionRunning === false && graceActive !== true) return "ended";
|
|
43
|
+
return "continue";
|
|
44
|
+
}
|
|
45
|
+
function decideLlmRestore(input) {
|
|
46
|
+
const { rec, sessionRunning } = input;
|
|
47
|
+
if (rec === null) return "none";
|
|
48
|
+
if (rec.status !== "running" && rec.status !== "pending") return "none";
|
|
49
|
+
return sessionRunning === false ? "ended" : "continue";
|
|
50
|
+
}
|
|
51
|
+
function llmResultLabelKey(status, action) {
|
|
52
|
+
if (status === "failed") return "llmRes_failed";
|
|
53
|
+
if (status === "ended") return "llmRes_ended";
|
|
54
|
+
if (status === "success") return action === "keep" ? "llmRes_keep" : "llmRes_success";
|
|
55
|
+
return "llmRes_running";
|
|
56
|
+
}
|
|
57
|
+
function pickLlmArchives(rows, name, isBatch, keepId) {
|
|
58
|
+
const marker = isBatch ? "\u63D2\u4EF6\u66F4\u65B0(\u6279\u91CF)" : `\u63D2\u4EF6\u66F4\u65B0: ${name}`;
|
|
59
|
+
return rows.filter((r) => ((r.displayTitle ?? "") + (r.title ?? "")).includes(marker) && r.id !== void 0 && r.id !== keepId && r.running !== true).map((r) => r.id);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// client/index.tsx
|
|
35
63
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
64
|
var CSS = `
|
|
37
65
|
.pc-title { font-size: 18px; font-weight: 600; line-height: 26px; color: var(--dsw-alias-label-primary); }
|
|
@@ -63,6 +91,7 @@ var CSS = `
|
|
|
63
91
|
.pc-badge.local, .pc-badge.builtin { background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-tertiary); }
|
|
64
92
|
.pc-tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; line-height: 17px; white-space: nowrap; background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); }
|
|
65
93
|
.pc-tag.danger { background: var(--dsw-alias-interactive-bg-hover-danger); color: var(--dsw-alias-state-error-primary); }
|
|
94
|
+
.pc-tag.warn { background: var(--dsw-alias-bg-module-warning); color: var(--dsw-alias-state-warning-primary); }
|
|
66
95
|
.pc-switch { position: relative; flex: none; width: 40px; height: 22px; border-radius: 11px; border: none; background: var(--dsw-alias-border-l4, rgba(0,0,0,.16)); cursor: pointer; transition: background .15s ease; padding: 0; }
|
|
67
96
|
.pc-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s ease; }
|
|
68
97
|
.pc-switch.on { background: var(--dsw-alias-state-business-primary, #4FC3F7); }
|
|
@@ -85,7 +114,7 @@ var CSS = `
|
|
|
85
114
|
.pc-chip:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
86
115
|
.pc-chip.active { background: var(--dsw-alias-label-primary); border-color: var(--dsw-alias-label-primary); color: var(--dsw-alias-bg-layer-3); }
|
|
87
116
|
|
|
88
|
-
.pc-btn { padding: 5px 14px; border-radius: 8px; border: 1px solid var(--dsw-alias-border-l2); background: transparent; color: var(--dsw-alias-label-primary); font-size: 13px; line-height: 1.5; cursor: pointer; font-family: inherit; }
|
|
117
|
+
.pc-btn { padding: 5px 14px; border-radius: 8px; border: 1px solid var(--dsw-alias-border-l2); background: transparent; color: var(--dsw-alias-label-primary); font-size: 13px; line-height: 1.5; cursor: pointer; font-family: inherit; flex-shrink: 0; white-space: nowrap; }
|
|
89
118
|
.pc-btn:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
90
119
|
.pc-btn.primary { border: none; background: var(--dsw-alias-button-primary-fill); color: var(--dsw-alias-label-primary-foreground); }
|
|
91
120
|
.pc-btn.primary:hover { background: var(--dsw-alias-button-primary-hover); }
|
|
@@ -226,6 +255,7 @@ function useWhatsNewOpen() {
|
|
|
226
255
|
var readCache = {};
|
|
227
256
|
var installedCache = null;
|
|
228
257
|
var marketCache = {};
|
|
258
|
+
var updatesCache = null;
|
|
229
259
|
var countsState = { installed: 0, market: 0, dshMarket: 0, failed: 0 };
|
|
230
260
|
var countListeners = /* @__PURE__ */ new Set();
|
|
231
261
|
function setCounts(partial) {
|
|
@@ -241,6 +271,164 @@ function setUpdating(name, on) {
|
|
|
241
271
|
else updatingPlugins.delete(name);
|
|
242
272
|
updatingListeners.forEach((l) => l());
|
|
243
273
|
}
|
|
274
|
+
var llmUpdating = /* @__PURE__ */ new Set();
|
|
275
|
+
var llmUpdatingListeners = /* @__PURE__ */ new Set();
|
|
276
|
+
function setLlmUpdating(name, on) {
|
|
277
|
+
if (on) llmUpdating.add(name);
|
|
278
|
+
else llmUpdating.delete(name);
|
|
279
|
+
llmUpdatingListeners.forEach((l) => l());
|
|
280
|
+
}
|
|
281
|
+
function useLlmUpdatingVersion() {
|
|
282
|
+
const [v, setV] = (0, import_react.useState)(0);
|
|
283
|
+
(0, import_react.useEffect)(() => {
|
|
284
|
+
const l = () => {
|
|
285
|
+
setV((x) => x + 1);
|
|
286
|
+
};
|
|
287
|
+
llmUpdatingListeners.add(l);
|
|
288
|
+
return () => {
|
|
289
|
+
llmUpdatingListeners.delete(l);
|
|
290
|
+
};
|
|
291
|
+
}, []);
|
|
292
|
+
return v;
|
|
293
|
+
}
|
|
294
|
+
var llmConfirm = null;
|
|
295
|
+
var llmConfirmListeners = /* @__PURE__ */ new Set();
|
|
296
|
+
function setLlmConfirm(state) {
|
|
297
|
+
llmConfirm = state;
|
|
298
|
+
llmConfirmListeners.forEach((l) => l());
|
|
299
|
+
}
|
|
300
|
+
function useLlmConfirm() {
|
|
301
|
+
const [state, setState] = (0, import_react.useState)(llmConfirm);
|
|
302
|
+
(0, import_react.useEffect)(() => {
|
|
303
|
+
const l = () => {
|
|
304
|
+
setState(llmConfirm);
|
|
305
|
+
};
|
|
306
|
+
llmConfirmListeners.add(l);
|
|
307
|
+
return () => {
|
|
308
|
+
llmConfirmListeners.delete(l);
|
|
309
|
+
};
|
|
310
|
+
}, []);
|
|
311
|
+
return state;
|
|
312
|
+
}
|
|
313
|
+
var llmSessionId = null;
|
|
314
|
+
function setLlmSessionId(id) {
|
|
315
|
+
llmSessionId = id;
|
|
316
|
+
}
|
|
317
|
+
var llmFallbackPrompt = null;
|
|
318
|
+
var llmFallbackListeners = /* @__PURE__ */ new Set();
|
|
319
|
+
function setLlmFallback(prompt) {
|
|
320
|
+
llmFallbackPrompt = prompt;
|
|
321
|
+
llmFallbackListeners.forEach((l) => l());
|
|
322
|
+
}
|
|
323
|
+
function useLlmFallback() {
|
|
324
|
+
const [p, setP] = (0, import_react.useState)(llmFallbackPrompt);
|
|
325
|
+
(0, import_react.useEffect)(() => {
|
|
326
|
+
const l = () => {
|
|
327
|
+
setP(llmFallbackPrompt);
|
|
328
|
+
};
|
|
329
|
+
llmFallbackListeners.add(l);
|
|
330
|
+
return () => {
|
|
331
|
+
llmFallbackListeners.delete(l);
|
|
332
|
+
};
|
|
333
|
+
}, []);
|
|
334
|
+
return p;
|
|
335
|
+
}
|
|
336
|
+
var sessionsSvc = null;
|
|
337
|
+
var workspacesSvc = null;
|
|
338
|
+
var llmResults = /* @__PURE__ */ new Map();
|
|
339
|
+
var llmResultListeners = /* @__PURE__ */ new Set();
|
|
340
|
+
function setLlmResult(name, rec) {
|
|
341
|
+
if (rec === null) llmResults.delete(name);
|
|
342
|
+
else llmResults.set(name, rec);
|
|
343
|
+
llmResultListeners.forEach((l) => l());
|
|
344
|
+
}
|
|
345
|
+
function useLlmResultVersion() {
|
|
346
|
+
const [v, setV] = (0, import_react.useState)(0);
|
|
347
|
+
(0, import_react.useEffect)(() => {
|
|
348
|
+
const l = () => {
|
|
349
|
+
setV((x) => x + 1);
|
|
350
|
+
};
|
|
351
|
+
llmResultListeners.add(l);
|
|
352
|
+
return () => {
|
|
353
|
+
llmResultListeners.delete(l);
|
|
354
|
+
};
|
|
355
|
+
}, []);
|
|
356
|
+
return v;
|
|
357
|
+
}
|
|
358
|
+
var llmPollTimers = /* @__PURE__ */ new Map();
|
|
359
|
+
var LLM_POLL_MS = 5e3;
|
|
360
|
+
var LLM_POLL_MAX = 240;
|
|
361
|
+
function stopLlmPolling(name) {
|
|
362
|
+
const t = llmPollTimers.get(name);
|
|
363
|
+
if (t !== void 0) {
|
|
364
|
+
window.clearInterval(t);
|
|
365
|
+
llmPollTimers.delete(name);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
async function convergeLlmState(name) {
|
|
369
|
+
const rec = await rpc("llm-update.result", { name }).catch(() => null);
|
|
370
|
+
const sid = llmSessionByPlugin.get(name);
|
|
371
|
+
const sessionRunning = sid === void 0 ? void 0 : sessionsSvc?.list?.getSnapshot?.()?.byId?.[sid]?.running ?? false;
|
|
372
|
+
const graceActive = Date.now() - (llmStartedAt.get(name) ?? 0) < LLM_GRACE_MS;
|
|
373
|
+
const decision = decideLlmState({ rec, sessionRunning, graceActive });
|
|
374
|
+
if (decision === "continue") return false;
|
|
375
|
+
stopLlmPolling(name);
|
|
376
|
+
setLlmUpdating(name, false);
|
|
377
|
+
if (decision === "success" || decision === "failed") {
|
|
378
|
+
setLlmResult(name, rec);
|
|
379
|
+
const S = STRINGS[localeId];
|
|
380
|
+
const brief = (rec?.detail ?? "").length > 120 ? `${(rec?.detail ?? "").slice(0, 120)}\u2026` : rec?.detail ?? "";
|
|
381
|
+
const msg = decision === "failed" ? S.llmFailed.replace("{name}", name).replace("{d}", brief) : rec?.action === "keep" ? S.llmKept.replace("{name}", name).replace("{d}", brief) : S.llmDone.replace("{name}", name).replace("{d}", brief);
|
|
382
|
+
showToast(msg, decision === "success" ? "ok" : "error", 12e3);
|
|
383
|
+
} else {
|
|
384
|
+
setLlmResult(name, { at: Date.now(), action: "ended", detail: "", status: "ended" });
|
|
385
|
+
showToast(STRINGS[localeId].llmEnded.replace("{name}", name), "error", 1e4);
|
|
386
|
+
}
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
function startLlmPolling(name) {
|
|
390
|
+
if (llmPollTimers.has(name)) return;
|
|
391
|
+
let count = 0;
|
|
392
|
+
const timer = window.setInterval(() => {
|
|
393
|
+
count++;
|
|
394
|
+
void convergeLlmState(name).then((done) => {
|
|
395
|
+
if (!done && count >= LLM_POLL_MAX) stopLlmPolling(name);
|
|
396
|
+
});
|
|
397
|
+
}, LLM_POLL_MS);
|
|
398
|
+
llmPollTimers.set(name, timer);
|
|
399
|
+
}
|
|
400
|
+
async function restoreLlmStates(names) {
|
|
401
|
+
const list = sessionsSvc?.list?.getSnapshot?.();
|
|
402
|
+
const rows = list?.byId === void 0 ? [] : Object.values(list.byId);
|
|
403
|
+
for (const name of names) {
|
|
404
|
+
if (llmUpdating.has(name) || llmResults.has(name)) continue;
|
|
405
|
+
try {
|
|
406
|
+
const rec = await rpc("llm-update.result", { name });
|
|
407
|
+
if (rec === null) continue;
|
|
408
|
+
if (rec.status === "running" || rec.status === "pending") {
|
|
409
|
+
const exact = rows.find((r) => ((r.displayTitle ?? "") + (r.title ?? "")).includes(`\u63D2\u4EF6\u66F4\u65B0: ${name}`));
|
|
410
|
+
const batch = rows.find((r) => ((r.displayTitle ?? "") + (r.title ?? "")).includes("\u63D2\u4EF6\u66F4\u65B0(\u6279\u91CF)"));
|
|
411
|
+
const sess = exact ?? batch;
|
|
412
|
+
const decision = decideLlmRestore({ rec, sessionRunning: sess?.running ?? false });
|
|
413
|
+
if (decision === "continue" && sess !== void 0 && sess.id !== void 0) {
|
|
414
|
+
setLlmUpdating(name, true);
|
|
415
|
+
llmSessionByPlugin.set(name, sess.id);
|
|
416
|
+
startLlmPolling(name);
|
|
417
|
+
} else {
|
|
418
|
+
setLlmUpdating(name, false);
|
|
419
|
+
if (sess?.id !== void 0) llmSessionByPlugin.set(name, sess.id);
|
|
420
|
+
setLlmResult(name, { at: rec.at, action: "ended", detail: "", status: "ended" });
|
|
421
|
+
}
|
|
422
|
+
} else {
|
|
423
|
+
setLlmResult(name, rec);
|
|
424
|
+
}
|
|
425
|
+
} catch {
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
var llmSessionByPlugin = /* @__PURE__ */ new Map();
|
|
430
|
+
var llmStartedAt = /* @__PURE__ */ new Map();
|
|
431
|
+
var LLM_GRACE_MS = 3e4;
|
|
244
432
|
var pendingToggles = /* @__PURE__ */ new Map();
|
|
245
433
|
var pendingListeners = /* @__PURE__ */ new Set();
|
|
246
434
|
function setPendingToggle(id, action) {
|
|
@@ -352,15 +540,24 @@ function useToast() {
|
|
|
352
540
|
}, [t]);
|
|
353
541
|
return t;
|
|
354
542
|
}
|
|
543
|
+
var wnToday = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
544
|
+
var wnShownTodayCache = null;
|
|
545
|
+
function wnShownToday() {
|
|
546
|
+
if (wnShownTodayCache === null) {
|
|
547
|
+
wnShownTodayCache = rpc("whatsNewDaily").then((v) => String(v?.day ?? "") === wnToday()).catch(() => false);
|
|
548
|
+
}
|
|
549
|
+
return wnShownTodayCache;
|
|
550
|
+
}
|
|
355
551
|
async function checkWhatNew() {
|
|
356
552
|
try {
|
|
357
553
|
const since = new Date(Date.now() - 30 * 864e5).toISOString();
|
|
358
554
|
const digests = await rpc("checkUpdates", { since });
|
|
359
555
|
readCache = await rpc("readVersions");
|
|
360
556
|
const fresh = digests.filter((d) => readCache[d.name] !== d.toVersion);
|
|
361
|
-
if (fresh.length > 0) {
|
|
557
|
+
if (fresh.length > 0 && !await wnShownToday()) {
|
|
362
558
|
whatsNewDigests = fresh;
|
|
363
559
|
whatsNewOpen = true;
|
|
560
|
+
void rpc("markWhatsNewDaily", { day: wnToday() });
|
|
364
561
|
whatsNewListeners.forEach((l) => l());
|
|
365
562
|
}
|
|
366
563
|
} catch {
|
|
@@ -398,6 +595,37 @@ var STRINGS = {
|
|
|
398
595
|
incompat: "\u4E0D\u517C\u5BB9\u5F53\u524D DSH",
|
|
399
596
|
update: "\u66F4\u65B0",
|
|
400
597
|
updating: "\u66F4\u65B0\u4E2D\u2026",
|
|
598
|
+
llmUpdate: "LLM \u66F4\u65B0",
|
|
599
|
+
llmUpdating: "LLM \u51B3\u7B56\u4E2D\u2026",
|
|
600
|
+
llmConfirmTitle: "\u786E\u8BA4 LLM \u66F4\u65B0",
|
|
601
|
+
llmSourceBadge: "\u6765\u6E90\uFF1A{s}",
|
|
602
|
+
llmVendorWarn: "\u672C\u5730\u5B9A\u5236!\u673A\u68B0\u66F4\u65B0\u4F1A\u8986\u76D6,\u5148\u6838\u5BF9\u4F5C\u8005\u662F\u5426\u5DF2\u91C7\u7EB3",
|
|
603
|
+
llmMismatch: "\u540C\u540D\u5F02\u6E90",
|
|
604
|
+
llmMismatchHint: "npm \u540C\u540D\u5305\u4E0E\u672C\u5730\u4E0A\u6E38\u4E0D\u662F\u540C\u4E00\u9879\u76EE,\u5347\u7EA7\u4F1A\u4E22\u5931\u5B9A\u5236\u529F\u80FD",
|
|
605
|
+
llmScopeSsid: "\u66F4\u65B0\u8303\u56F4\uFF1A\u4EC5\u601D\u7075\u5E94\u7528\u5185\u7684\u63D2\u4EF6\uFF08AI \u52A9\u624B\u53EA\u52A8\u8FD9\u4E00\u5904\uFF0C\u4E0D\u4F1A\u5F71\u54CD\u4F60\u5176\u4ED6\u5730\u65B9\u7684\u5B89\u88C5\uFF09",
|
|
606
|
+
llmScopeWeb: "\u66F4\u65B0\u8303\u56F4\uFF1A\u4EC5\u5F53\u524D DSH Web \u5E94\u7528\u5185\u7684\u63D2\u4EF6\uFF08AI \u52A9\u624B\u53EA\u52A8\u8FD9\u4E00\u5904\uFF0C\u4E0D\u4F1A\u5F71\u54CD\u4F60\u5176\u4ED6\u5730\u65B9\u7684\u5B89\u88C5\uFF09",
|
|
607
|
+
llmConfirm: "\u786E\u8BA4\u5E76\u6267\u884C",
|
|
608
|
+
llmCancel: "\u53D6\u6D88",
|
|
609
|
+
llmPromptReady: "LLM \u66F4\u65B0\u5DF2\u53D1\u8D77\uFF1A{name}\u3002\u8BF7\u5728\u4F1A\u8BDD\u4E2D\u6309 dsh-plugin-upgrade skill \u51B3\u7B56\u6267\u884C\u3002",
|
|
610
|
+
llmPreparing: "\u91C7\u96C6\u63D2\u4EF6\u4FE1\u606F\u4E2D\u2026",
|
|
611
|
+
llmPreparedError: "\u4FE1\u606F\u5305\u91C7\u96C6\u5931\u8D25\uFF1A{e}",
|
|
612
|
+
llmSessionLink: "\u67E5\u770B\u4F1A\u8BDD",
|
|
613
|
+
llmSessionMissing: "\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728(\u53EF\u80FD\u88AB\u6E05\u7406),\u8BF7\u5728\u4F1A\u8BDD\u5217\u8868\u4E2D\u67E5\u770B\u5386\u53F2\u8BB0\u5F55",
|
|
614
|
+
llmBusy: "LLM \u6267\u884C\u4E2D\u2026",
|
|
615
|
+
llmDone: "LLM \u66F4\u65B0\u5B8C\u6210\uFF1A{name} \u2014 {d}",
|
|
616
|
+
llmFailed: "LLM \u66F4\u65B0\u5931\u8D25\uFF1A{name} \u2014 {d}",
|
|
617
|
+
llmKept: "LLM \u51B3\u7B56\uFF1A\u4FDD\u6301 {name}\uFF08\u672A\u66F4\u65B0\uFF09\u2014 {d}",
|
|
618
|
+
llmRes_success: "LLM \u5DF2\u66F4\u65B0",
|
|
619
|
+
llmRes_keep: "LLM \u4FDD\u6301\u4E0D\u52A8",
|
|
620
|
+
llmRes_failed: "LLM \u5931\u8D25",
|
|
621
|
+
llmRes_running: "LLM \u6267\u884C\u4E2D",
|
|
622
|
+
llmRes_ended: "LLM \u5DF2\u7ED3\u675F",
|
|
623
|
+
llmEnded: "LLM \u66F4\u65B0\u5DF2\u7ED3\u675F\uFF1A{name}(\u672A\u56DE\u4F20\u51B3\u7B56,\u53EF\u67E5\u770B\u4F1A\u8BDD)",
|
|
624
|
+
llmUpdateAll: "LLM \u66F4\u65B0\u5168\u90E8\uFF08{n}\uFF09",
|
|
625
|
+
llmConfirmBody: "\u4EE5\u4E0B {n} \u4E2A\u63D2\u4EF6\u5C06\u7531 LLM Agent \u6309 dsh-plugin-upgrade skill \u51B3\u7B56\u5E76\u6267\u884C\u66F4\u65B0\u3002",
|
|
626
|
+
llmConfirmSkipped: "\u91C7\u96C6\u5931\u8D25\u5C06\u8DF3\u8FC7\uFF1A{s}",
|
|
627
|
+
llmFallbackTitle: "\u5C06\u63D0\u793A\u8BCD\u7C98\u8D34\u5230\u4F1A\u8BDD\u6267\u884C",
|
|
628
|
+
llmFallbackHint: "\u65E0\u6CD5\u81EA\u52A8\u53D1\u8D77\u300C\u63D2\u4EF6\u66F4\u65B0\u300D\u4F1A\u8BDD\uFF08\u4F1A\u8BDD/\u5DE5\u4F5C\u533A\u670D\u52A1\u4E0D\u53EF\u7528\u6216\u6CA1\u6709\u53EF\u7528\u5DE5\u4F5C\u533A\uFF09\u3002\u8BF7\u590D\u5236\u4EE5\u4E0B\u63D0\u793A\u8BCD\uFF0C\u5728\u4EFB\u610F\u4F1A\u8BDD\u4E2D\u7C98\u8D34\u5E76\u53D1\u9001\uFF0CAgent \u5C06\u6309 dsh-plugin-upgrade skill \u51B3\u7B56\u6267\u884C\u3002",
|
|
401
629
|
install: "\u5B89\u88C5",
|
|
402
630
|
installing: "\u5B89\u88C5\u4E2D\u2026",
|
|
403
631
|
pendingRestart: "\u5F85\u91CD\u542F\u751F\u6548",
|
|
@@ -485,6 +713,37 @@ var STRINGS = {
|
|
|
485
713
|
incompat: "Incompatible with current DSH",
|
|
486
714
|
update: "Update",
|
|
487
715
|
updating: "Updating\u2026",
|
|
716
|
+
llmUpdate: "LLM update",
|
|
717
|
+
llmUpdating: "LLM deciding\u2026",
|
|
718
|
+
llmConfirmTitle: "Confirm LLM update",
|
|
719
|
+
llmSourceBadge: "Source: {s}",
|
|
720
|
+
llmVendorWarn: "Local custom build! Mechanical update would overwrite \u2014 verify upstream adoption first",
|
|
721
|
+
llmMismatch: "Mismatched upstream",
|
|
722
|
+
llmMismatchHint: "The npm package with this name is a different project \u2014 updating would lose local customizations",
|
|
723
|
+
llmScopeSsid: "Scope: plugins inside SSiD only (AI touches just this place, nothing elsewhere)",
|
|
724
|
+
llmScopeWeb: "Scope: plugins inside this DSH Web app only (AI touches just this place, nothing elsewhere)",
|
|
725
|
+
llmConfirm: "Confirm & run",
|
|
726
|
+
llmCancel: "Cancel",
|
|
727
|
+
llmPromptReady: "LLM update launched: {name}. Decide & execute in session per dsh-plugin-upgrade skill.",
|
|
728
|
+
llmPreparing: "Preparing plugin info\u2026",
|
|
729
|
+
llmPreparedError: "Prepare failed: {e}",
|
|
730
|
+
llmSessionLink: "View session",
|
|
731
|
+
llmSessionMissing: "Session no longer exists (may have been cleaned up); check the session list",
|
|
732
|
+
llmBusy: "LLM running\u2026",
|
|
733
|
+
llmDone: "LLM update done: {name} \u2014 {d}",
|
|
734
|
+
llmFailed: "LLM update failed: {name} \u2014 {d}",
|
|
735
|
+
llmKept: "LLM decided: keep {name} (no update) \u2014 {d}",
|
|
736
|
+
llmRes_success: "LLM updated",
|
|
737
|
+
llmRes_keep: "LLM kept",
|
|
738
|
+
llmRes_failed: "LLM failed",
|
|
739
|
+
llmRes_running: "LLM running",
|
|
740
|
+
llmRes_ended: "LLM ended",
|
|
741
|
+
llmEnded: "LLM update ended: {name} (no decision returned; view session)",
|
|
742
|
+
llmUpdateAll: "LLM update all\uFF08{n}\uFF09",
|
|
743
|
+
llmConfirmBody: "LLM Agent will decide & run the update for these {n} plugin(s) per the dsh-plugin-upgrade skill.",
|
|
744
|
+
llmConfirmSkipped: "Skipped (prepare failed): {s}",
|
|
745
|
+
llmFallbackTitle: "Paste the prompt into a session",
|
|
746
|
+
llmFallbackHint: 'Could not auto-launch a "plugin update" session (sessions/workspaces unavailable or no workspace). Copy the prompt below and paste it into any session; the agent will decide per the dsh-plugin-upgrade skill.',
|
|
488
747
|
install: "Install",
|
|
489
748
|
installing: "Installing\u2026",
|
|
490
749
|
pendingRestart: "Restart pending",
|
|
@@ -811,6 +1070,12 @@ function MarketView({ category, single, source, search, onCount }) {
|
|
|
811
1070
|
function UpdatesView({ updates, refresh, updateOne, busy, doneUpdates, onDoneClick }) {
|
|
812
1071
|
const t = useT();
|
|
813
1072
|
useUpdatingVersion();
|
|
1073
|
+
useLlmUpdatingVersion();
|
|
1074
|
+
useLlmResultVersion();
|
|
1075
|
+
(0, import_react.useEffect)(() => {
|
|
1076
|
+
if (updates === null) return;
|
|
1077
|
+
void restoreLlmStates(updates.map((u) => u.name));
|
|
1078
|
+
}, [updates]);
|
|
814
1079
|
if (updates === null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "pc-sub", children: t("checkingUpdates") });
|
|
815
1080
|
const doneOnly = doneUpdates.filter((d) => !(updates ?? []).some((u) => u.name === d.name));
|
|
816
1081
|
if (updates.length === 0 && doneOnly.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
@@ -826,10 +1091,27 @@ function UpdatesView({ updates, refresh, updateOne, busy, doneUpdates, onDoneCli
|
|
|
826
1091
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { color: "var(--dsw-alias-state-business-primary)", fontWeight: 500 }, children: u.toVersion }),
|
|
827
1092
|
u.compat === "incompatible" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-tag danger", children: t("incompat") }),
|
|
828
1093
|
pendingInstall.has(u.name) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-tag", children: t("pendingRestart") }),
|
|
1094
|
+
llmUpdating.has(u.name) && llmResults.get(u.name) === void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-tag", children: t("llmBusy") }),
|
|
1095
|
+
llmResults.get(u.name) !== void 0 && (() => {
|
|
1096
|
+
const r = llmResults.get(u.name);
|
|
1097
|
+
const cls = r.status === "success" ? "" : r.status === "failed" ? "danger" : "warn";
|
|
1098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `pc-tag ${cls}`, title: r.detail, children: t(llmResultLabelKey(r.status, r.action)) });
|
|
1099
|
+
})(),
|
|
829
1100
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-spacer" }),
|
|
830
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "pc-btn
|
|
831
|
-
|
|
832
|
-
|
|
1101
|
+
llmSessionByPlugin.has(u.name) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "pc-btn", onClick: () => {
|
|
1102
|
+
const id = llmSessionByPlugin.get(u.name);
|
|
1103
|
+
if (id === void 0) return;
|
|
1104
|
+
if (sessionsSvc?.list?.getSnapshot?.()?.byId?.[id] !== void 0) {
|
|
1105
|
+
settingsClose?.();
|
|
1106
|
+
closeOverlay();
|
|
1107
|
+
sessionsSvc?.open?.(id);
|
|
1108
|
+
} else {
|
|
1109
|
+
showToast(STRINGS[localeId].llmSessionMissing, "error", 5e3);
|
|
1110
|
+
}
|
|
1111
|
+
}, children: t("llmSessionLink") }),
|
|
1112
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "pc-btn primary", disabled: busy !== null || pendingInstall.has(u.name) || llmUpdating.has(u.name) && llmResults.get(u.name) === void 0, onClick: () => {
|
|
1113
|
+
llmPrepare(u.name);
|
|
1114
|
+
}, children: t("llmUpdate") })
|
|
833
1115
|
] }),
|
|
834
1116
|
u.changelog.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "pc-wn-list", children: u.changelog.slice(0, 5).map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: line }, i)) })
|
|
835
1117
|
] }, u.name)),
|
|
@@ -995,9 +1277,203 @@ function RestartDialog({ count, onRestart, onClose }) {
|
|
|
995
1277
|
document.body
|
|
996
1278
|
);
|
|
997
1279
|
}
|
|
998
|
-
function
|
|
1280
|
+
function llmPrepare(name) {
|
|
1281
|
+
if (llmConfirm?.preparing === true) return;
|
|
1282
|
+
setLlmConfirm({ name, pkgs: [], error: null, skipped: [], preparing: true });
|
|
1283
|
+
void rpc("llm-update.prepare", { name }).then(
|
|
1284
|
+
(v) => setLlmConfirm({ name, pkgs: [v], error: null, skipped: [], preparing: false }),
|
|
1285
|
+
(e) => setLlmConfirm({ name, pkgs: [], error: e instanceof Error ? e.message : String(e), skipped: [], preparing: false })
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
function llmPrepareAll(names) {
|
|
1289
|
+
setLlmConfirm({ name: "__all__", pkgs: [], error: null, skipped: [], preparing: true });
|
|
1290
|
+
void (async () => {
|
|
1291
|
+
const pkgs = [];
|
|
1292
|
+
const skipped = [];
|
|
1293
|
+
for (const n of names) {
|
|
1294
|
+
try {
|
|
1295
|
+
pkgs.push(await rpc("llm-update.prepare", { name: n }));
|
|
1296
|
+
} catch (e) {
|
|
1297
|
+
skipped.push(`${n}: ${e instanceof Error ? e.message : String(e)}`);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
setLlmConfirm({ name: "__all__", pkgs, error: null, skipped, preparing: false });
|
|
1301
|
+
})();
|
|
1302
|
+
}
|
|
1303
|
+
async function ensureLlmUpdateSession(isBatch, profileDir) {
|
|
1304
|
+
const list = sessionsSvc?.list?.getSnapshot?.();
|
|
1305
|
+
const rows = list?.byId === void 0 ? [] : Object.values(list.byId);
|
|
1306
|
+
if (isBatch) {
|
|
1307
|
+
const existing = rows.find((r) => ((r.displayTitle ?? "") + (r.title ?? "")).includes("\u63D2\u4EF6\u66F4\u65B0(\u6279\u91CF)"));
|
|
1308
|
+
if (existing?.id !== void 0 && existing.running !== false) {
|
|
1309
|
+
sessionsSvc?.open?.(existing.id);
|
|
1310
|
+
return existing.id;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
const ws = workspacesSvc?.list?.getSnapshot?.();
|
|
1314
|
+
let wsId;
|
|
1315
|
+
if (profileDir !== void 0 && profileDir !== "") {
|
|
1316
|
+
try {
|
|
1317
|
+
const wsv = await workspacesSvc?.create?.({ path: profileDir });
|
|
1318
|
+
wsId = typeof wsv === "string" ? wsv : wsv?.workspaceId;
|
|
1319
|
+
if (wsId !== void 0) void workspacesSvc?.rename?.(wsId, "\u63D2\u4EF6\u66F4\u65B0").catch(() => {
|
|
1320
|
+
});
|
|
1321
|
+
} catch {
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
const finalWsId = wsId ?? ws?.recentWorkspaceId ?? ws?.items?.[0]?.id;
|
|
1325
|
+
if (finalWsId === void 0 || finalWsId === "") return null;
|
|
1326
|
+
const id = await workspacesSvc?.connectWorkspace?.(finalWsId);
|
|
1327
|
+
if (id === void 0 || id === "") return null;
|
|
1328
|
+
sessionsSvc?.open?.(id);
|
|
1329
|
+
return id;
|
|
1330
|
+
}
|
|
1331
|
+
async function llmExecute(pkgs, name) {
|
|
1332
|
+
const S = STRINGS[localeId];
|
|
1333
|
+
setLlmConfirm(null);
|
|
1334
|
+
for (const p of pkgs) {
|
|
1335
|
+
setLlmResult(p.name, null);
|
|
1336
|
+
setLlmUpdating(p.name, true);
|
|
1337
|
+
}
|
|
1338
|
+
const prompt = pkgs.length === 1 ? pkgs[0].prompt : [
|
|
1339
|
+
`\u8BF7\u4F9D\u6B21\u5904\u7406\u4EE5\u4E0B ${pkgs.length} \u4E2A\u63D2\u4EF6\u7684\u66F4\u65B0(\u6BCF\u4E2A\u63D2\u4EF6\u72EC\u7ACB\u6309 dsh-plugin-upgrade skill \u51B3\u7B56):`,
|
|
1340
|
+
"",
|
|
1341
|
+
...pkgs.flatMap((p, i) => [`===== \u63D2\u4EF6 ${i + 1}/${pkgs.length}: ${p.name} =====`, p.prompt])
|
|
1342
|
+
].join("\n");
|
|
1343
|
+
void rpc("llm-update.log", { name, action: "prompt-sent", detail: prompt.split("\n").slice(0, 3).join(" "), status: "running" });
|
|
1344
|
+
try {
|
|
1345
|
+
const isBatch = name === "__all__" || pkgs.length > 1;
|
|
1346
|
+
const id = await ensureLlmUpdateSession(isBatch, pkgs[0]?.profileDir);
|
|
1347
|
+
if (id === null) throw new Error("no-session-target");
|
|
1348
|
+
const session = sessionsSvc?.binding?.(id)?.session;
|
|
1349
|
+
if (session?.prompt === void 0) throw new Error("no-session-face");
|
|
1350
|
+
const res = await session.prompt([{ type: "text", text: prompt }], "queue");
|
|
1351
|
+
if (res?.ok !== true) {
|
|
1352
|
+
throw new Error(res?.error?.message ?? "prompt rejected");
|
|
1353
|
+
}
|
|
1354
|
+
if (isBatch) session.rename?.("\u63D2\u4EF6\u66F4\u65B0(\u6279\u91CF)").catch(() => {
|
|
1355
|
+
});
|
|
1356
|
+
else session.rename?.(`\u63D2\u4EF6\u66F4\u65B0: ${pkgs[0].name}`).catch(() => {
|
|
1357
|
+
});
|
|
1358
|
+
for (const p of pkgs) llmStartedAt.set(p.name, Date.now());
|
|
1359
|
+
const rows = Object.values(sessionsSvc?.list?.getSnapshot?.()?.byId ?? {});
|
|
1360
|
+
for (const oldId of pickLlmArchives(rows, pkgs[0]?.name ?? "", isBatch, id)) {
|
|
1361
|
+
void workspacesSvc?.archiveSession?.(oldId).catch(() => {
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
setLlmSessionId(id);
|
|
1365
|
+
for (const p of pkgs) llmSessionByPlugin.set(p.name, id);
|
|
1366
|
+
for (const p of pkgs) startLlmPolling(p.name);
|
|
1367
|
+
showToast(S.llmPromptReady.replace("{name}", pkgs.length === 1 ? pkgs[0].name : `${pkgs.length} \u4E2A\u63D2\u4EF6`), "ok", 8e3);
|
|
1368
|
+
if (isBatch) closeWhatsNew();
|
|
1369
|
+
} catch (e) {
|
|
1370
|
+
for (const p of pkgs) setLlmUpdating(p.name, false);
|
|
1371
|
+
setLlmFallback(prompt);
|
|
1372
|
+
showToast(`${e instanceof Error ? e.message : String(e)}`, "error", 6e3);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
function LlmConfirmDialog() {
|
|
1376
|
+
const t = useT();
|
|
1377
|
+
const state = useLlmConfirm();
|
|
1378
|
+
if (state === null) return null;
|
|
1379
|
+
const skipText = state.skipped.length === 0 ? null : t("llmConfirmSkipped", { s: state.skipped.join("\uFF1B") });
|
|
1380
|
+
const failText = state.error !== null && state.error !== "" ? state.error : state.skipped.length > 0 ? state.skipped.join("\uFF1B") : "(unknown)";
|
|
1381
|
+
const body = state.preparing ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 12, color: "var(--dsw-alias-label-secondary, #67748a)" }, children: t("llmPreparing") }) : state.pkgs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 12, color: "var(--dsw-alias-state-error-fill, #e5534b)", lineHeight: 1.5 }, children: t("llmPreparedError", { e: failText }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8, maxHeight: "46vh", overflow: "auto" }, children: [
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 12, color: "var(--dsw-alias-label-secondary, #67748a)", lineHeight: 1.5 }, children: t("llmConfirmBody", { n: state.pkgs.length }) }),
|
|
1383
|
+
skipText !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 11.5, color: "var(--dsw-alias-state-warning-fill, #d9a53f)" }, children: skipText }),
|
|
1384
|
+
state.pkgs.map((p) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { border: "1px solid var(--dsw-alias-border-l2, #1e2836)", borderRadius: 8, padding: "8px 10px", display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
1385
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pc-row", style: { flexWrap: "nowrap" }, children: [
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-name", children: p.name }),
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-ver", children: p.fromVersion }),
|
|
1388
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-ver", children: "\u2192" }),
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { color: "var(--dsw-alias-state-business-primary)", fontWeight: 500 }, children: p.toVersion ?? "\u2014" }),
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `pc-tag${p.source === "npm" || p.source === "official" ? "" : " warn"}`, children: t("llmSourceBadge", { s: p.source }) }),
|
|
1391
|
+
p.isVendorModified && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-tag warn", title: t("llmVendorWarn"), children: "vendor" }),
|
|
1392
|
+
p.upstreamMismatch && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-tag warn", title: t("llmMismatchHint"), children: t("llmMismatch") }),
|
|
1393
|
+
p.compat === "incompatible" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-tag danger", children: t("incompat") })
|
|
1394
|
+
] }),
|
|
1395
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 11.5, color: "var(--dsw-alias-label-secondary, #67748a)" }, children: p.runtimeLabel === "SSID" ? t("llmScopeSsid") : t("llmScopeWeb") }),
|
|
1396
|
+
p.changelog.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "pc-wn-list", style: { margin: 0 }, children: p.changelog.slice(0, 5).map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: line }, i)) })
|
|
1397
|
+
] }, p.name))
|
|
1398
|
+
] });
|
|
1399
|
+
const canRun = state.preparing === false && state.pkgs.length > 0;
|
|
1400
|
+
return (0, import_react_dom.createPortal)(
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "fixed", inset: 0, background: "rgba(0,0,0,.55)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 1e4 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { width: "min(560px, 92vw)", background: "var(--dsw-alias-bg-layer-3)", border: "1px solid var(--dsw-alias-border-l2)", borderRadius: 12, padding: 14, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
1402
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 13, fontWeight: 600, color: "var(--dsw-alias-label-primary, #d8e0ea)" }, children: t("llmConfirmTitle") }),
|
|
1403
|
+
body,
|
|
1404
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", gap: 8, justifyContent: "flex-end" }, children: [
|
|
1405
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "pc-btn", disabled: state.preparing, onClick: () => {
|
|
1406
|
+
setLlmConfirm(null);
|
|
1407
|
+
}, children: t("llmCancel") }),
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1409
|
+
"button",
|
|
1410
|
+
{
|
|
1411
|
+
type: "button",
|
|
1412
|
+
style: {
|
|
1413
|
+
padding: "3px 12px",
|
|
1414
|
+
fontSize: 11.5,
|
|
1415
|
+
border: "none",
|
|
1416
|
+
borderRadius: 6,
|
|
1417
|
+
cursor: canRun ? "pointer" : "not-allowed",
|
|
1418
|
+
fontWeight: 600,
|
|
1419
|
+
background: "var(--dsw-alias-button-primary-fill)",
|
|
1420
|
+
color: "var(--dsw-alias-label-primary-foreground)",
|
|
1421
|
+
opacity: canRun ? 1 : 0.55
|
|
1422
|
+
},
|
|
1423
|
+
disabled: !canRun,
|
|
1424
|
+
onClick: () => {
|
|
1425
|
+
void llmExecute(state.pkgs, state.name);
|
|
1426
|
+
},
|
|
1427
|
+
children: t("llmConfirm")
|
|
1428
|
+
}
|
|
1429
|
+
)
|
|
1430
|
+
] })
|
|
1431
|
+
] }) }),
|
|
1432
|
+
document.body
|
|
1433
|
+
);
|
|
1434
|
+
}
|
|
1435
|
+
function LlmPromptFallbackDialog() {
|
|
1436
|
+
const t = useT();
|
|
1437
|
+
const prompt = useLlmFallback();
|
|
1438
|
+
if (prompt === null) return null;
|
|
1439
|
+
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
1440
|
+
return (0, import_react_dom.createPortal)(
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "fixed", inset: 0, background: "rgba(0,0,0,.55)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 1e4 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { width: "min(680px, 92vw)", background: "var(--dsw-alias-bg-layer-3)", border: "1px solid var(--dsw-alias-border-l2)", borderRadius: 12, padding: 14, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
1442
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 13, fontWeight: 600, color: "var(--dsw-alias-label-primary, #d8e0ea)" }, children: t("llmFallbackTitle") }),
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 12, color: "var(--dsw-alias-label-secondary, #67748a)", lineHeight: 1.5 }, children: t("llmFallbackHint") }),
|
|
1444
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1445
|
+
"textarea",
|
|
1446
|
+
{
|
|
1447
|
+
readOnly: true,
|
|
1448
|
+
value: prompt,
|
|
1449
|
+
rows: Math.min(10, prompt.split("\n").length + 1),
|
|
1450
|
+
style: { width: "100%", boxSizing: "border-box", background: "var(--dsw-alias-bg-module-platform, rgba(128,148,168,.12))", color: "var(--dsw-alias-label-primary, #d8e0ea)", border: "1px solid var(--dsw-alias-border-l2, #1e2836)", borderRadius: 6, padding: "8px 10px", fontSize: 12, fontFamily: "monospace", resize: "vertical" }
|
|
1451
|
+
}
|
|
1452
|
+
),
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", gap: 8, justifyContent: "flex-end" }, children: [
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "pc-btn", onClick: () => {
|
|
1455
|
+
void navigator.clipboard.writeText(prompt).then(() => setCopied(true)).catch(() => {
|
|
1456
|
+
});
|
|
1457
|
+
}, children: copied ? t("commandCopied") : t("commandCopy") }),
|
|
1458
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "pc-btn primary", onClick: () => {
|
|
1459
|
+
setLlmFallback(null);
|
|
1460
|
+
}, children: t("close") })
|
|
1461
|
+
] })
|
|
1462
|
+
] }) }),
|
|
1463
|
+
document.body
|
|
1464
|
+
);
|
|
1465
|
+
}
|
|
1466
|
+
var settingsClose = null;
|
|
1467
|
+
function CenterPanel({ variant = "section", close }) {
|
|
999
1468
|
const t = useT();
|
|
1469
|
+
(0, import_react.useEffect)(() => {
|
|
1470
|
+
settingsClose = close ?? null;
|
|
1471
|
+
return () => {
|
|
1472
|
+
settingsClose = null;
|
|
1473
|
+
};
|
|
1474
|
+
}, [close]);
|
|
1000
1475
|
const [view, setView] = (0, import_react.useState)("installed");
|
|
1476
|
+
const activeLlmCount = [...llmUpdating].filter((n) => !llmResults.has(n)).length;
|
|
1001
1477
|
const [category, setCategory] = (0, import_react.useState)(null);
|
|
1002
1478
|
const [single, setSingle] = (0, import_react.useState)(false);
|
|
1003
1479
|
const [source, setSource] = (0, import_react.useState)("awesome");
|
|
@@ -1006,7 +1482,9 @@ function CenterPanel({ variant = "section" }) {
|
|
|
1006
1482
|
const [marketSearch, setMarketSearch] = (0, import_react.useState)("");
|
|
1007
1483
|
const [installedSource, setInstalledSource] = (0, import_react.useState)(null);
|
|
1008
1484
|
const counts = useCounts();
|
|
1009
|
-
|
|
1485
|
+
useLlmUpdatingVersion();
|
|
1486
|
+
useLlmResultVersion();
|
|
1487
|
+
const [updates, setUpdates] = (0, import_react.useState)(updatesCache);
|
|
1010
1488
|
const [busyUpdate, setBusyUpdate] = (0, import_react.useState)(null);
|
|
1011
1489
|
const [checking, setChecking] = (0, import_react.useState)(false);
|
|
1012
1490
|
const [togglingId, setTogglingId] = (0, import_react.useState)(null);
|
|
@@ -1090,6 +1568,9 @@ function CenterPanel({ variant = "section" }) {
|
|
|
1090
1568
|
}
|
|
1091
1569
|
);
|
|
1092
1570
|
}, [t]);
|
|
1571
|
+
(0, import_react.useEffect)(() => {
|
|
1572
|
+
updatesCache = updates;
|
|
1573
|
+
}, [updates]);
|
|
1093
1574
|
(0, import_react.useEffect)(() => {
|
|
1094
1575
|
void rpc("listInstalled").then(
|
|
1095
1576
|
(v) => {
|
|
@@ -1250,14 +1731,14 @@ function CenterPanel({ variant = "section" }) {
|
|
|
1250
1731
|
] });
|
|
1251
1732
|
const head = (showTitle) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pc-head", children: [
|
|
1252
1733
|
showTitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-title", children: t("title") }),
|
|
1253
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-sub", children: t("headSummary", { a: counts.installed, b: updates
|
|
1734
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-sub", children: t("headSummary", { a: counts.installed, b: updates === null ? "\u2026" : updates.length, c: counts.failed }) }),
|
|
1254
1735
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pc-spacer" }),
|
|
1255
1736
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "pc-btn", disabled: checking, onClick: () => {
|
|
1256
1737
|
refreshUpdates();
|
|
1257
1738
|
}, children: checking ? t("checking") : t("check") }),
|
|
1258
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "pc-btn primary", disabled:
|
|
1259
|
-
|
|
1260
|
-
}, children: t("
|
|
1739
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "pc-btn primary", disabled: updates === null || updates.length === 0 || busyUpdate !== null || activeLlmCount > 0, onClick: () => {
|
|
1740
|
+
llmPrepareAll((updates ?? []).map((u) => u.name));
|
|
1741
|
+
}, children: updates === null ? t("checking") : activeLlmCount > 0 ? t("llmBusy") : t("llmUpdateAll", { n: updates.length }) })
|
|
1261
1742
|
] });
|
|
1262
1743
|
const installedToolbar = view === "installed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pc-filter", children: [
|
|
1263
1744
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pc-toolbar pc-toolbar-main", children: [
|
|
@@ -1413,6 +1894,10 @@ function WhatsNewDialog() {
|
|
|
1413
1894
|
const t = useT();
|
|
1414
1895
|
const open = useWhatsNewOpen();
|
|
1415
1896
|
const [busy, setBusy] = (0, import_react.useState)(false);
|
|
1897
|
+
useLlmUpdatingVersion();
|
|
1898
|
+
useLlmResultVersion();
|
|
1899
|
+
useLlmConfirm();
|
|
1900
|
+
const activeLlmCount = [...llmUpdating].filter((n) => !llmResults.has(n)).length;
|
|
1416
1901
|
if (!open || whatsNewDigests.length === 0) return null;
|
|
1417
1902
|
const updateNow = async () => {
|
|
1418
1903
|
setBusy(true);
|
|
@@ -1468,13 +1953,13 @@ function WhatsNewDialog() {
|
|
|
1468
1953
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pc-panel-footer", children: [
|
|
1469
1954
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "pc-btn", onClick: closeWhatsNew, children: t("later") }),
|
|
1470
1955
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "pc-btn", onClick: closeWhatsNew, children: t("markAllRead") }),
|
|
1471
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "pc-btn primary", disabled: busy, onClick: () => {
|
|
1472
|
-
|
|
1473
|
-
}, children:
|
|
1956
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "pc-btn primary", disabled: busy || activeLlmCount > 0 || llmConfirm !== null, onClick: () => {
|
|
1957
|
+
llmPrepareAll(whatsNewDigests.map((u) => u.name));
|
|
1958
|
+
}, children: activeLlmCount > 0 ? t("llmBusy") : t("llmUpdateAll", { n: whatsNewDigests.length }) })
|
|
1474
1959
|
] })
|
|
1475
1960
|
] }) });
|
|
1476
1961
|
}
|
|
1477
|
-
var inject = ["slots", "connection"];
|
|
1962
|
+
var inject = ["slots", "connection", "sessions", "workspaces"];
|
|
1478
1963
|
var GLOBAL_KEYS = ["__pluginCenterOpen", "__pluginCenterToggle", "__pluginCenterClose"];
|
|
1479
1964
|
function installGlobals() {
|
|
1480
1965
|
const w = window;
|
|
@@ -1490,6 +1975,8 @@ function cleanupGlobals() {
|
|
|
1490
1975
|
}
|
|
1491
1976
|
function apply(ctx) {
|
|
1492
1977
|
injectCss();
|
|
1978
|
+
sessionsSvc = ctx.sessions ?? null;
|
|
1979
|
+
workspacesSvc = ctx.workspaces ?? null;
|
|
1493
1980
|
ctx.effect?.(() => registerSettingsNavIcon(() => STRINGS[localeId].title), "dsh-plugin-center: settings navigation icon");
|
|
1494
1981
|
if (window.__pluginCenterGlobalsInstalled !== true) {
|
|
1495
1982
|
installGlobals();
|
|
@@ -1532,6 +2019,16 @@ function apply(ctx) {
|
|
|
1532
2019
|
id: "plugin-center-toast",
|
|
1533
2020
|
order: 52
|
|
1534
2021
|
}, Toast));
|
|
2022
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
2023
|
+
name: "shell.overlay",
|
|
2024
|
+
id: "plugin-center-llm-confirm",
|
|
2025
|
+
order: 53
|
|
2026
|
+
}, LlmConfirmDialog));
|
|
2027
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
2028
|
+
name: "shell.overlay",
|
|
2029
|
+
id: "plugin-center-llm-fallback",
|
|
2030
|
+
order: 54
|
|
2031
|
+
}, LlmPromptFallbackDialog));
|
|
1535
2032
|
void checkWhatNew();
|
|
1536
2033
|
}
|
|
1537
2034
|
return module.exports;
|