@linxin666/dsh-client-ui-plugin-manager 0.3.24 → 0.4.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/README.i18n.yaml +2 -2
- package/README.md +9 -9
- package/README.zh.md +9 -9
- package/icon.svg +3 -0
- package/lib/client.js +56 -281
- package/lib/client.js.map +1 -1
- package/lib/index.js +23 -1
- package/lib/types/client/PluginManagerTab.d.ts +1 -7
- package/lib/types/client/locales.d.ts +3 -45
- package/lib/types/core/repair.d.ts +3 -16
- package/lib/types/host/http.d.ts +18 -1
- package/package.json +19 -14
package/lib/client.js
CHANGED
|
@@ -47,10 +47,6 @@ window.__ModuleLoader__.load({
|
|
|
47
47
|
//#region src/core/repair.ts
|
|
48
48
|
/** Default copy (zh): the package's zh dictionary keys map onto these strings. */
|
|
49
49
|
const DEFAULT_REPAIR_COPY = {
|
|
50
|
-
installTitle: "正在修复插件安装失败",
|
|
51
|
-
installSpecLabel: "安装目标",
|
|
52
|
-
installErrorLabel: "安装错误",
|
|
53
|
-
installAsk: "请在插件安装根目录内检查插件包或依赖并修复,然后重试安装。",
|
|
54
50
|
failureTitle: "正在修复插件启动失败",
|
|
55
51
|
failurePluginLabel: "插件",
|
|
56
52
|
failureKindLabel: "失败类型",
|
|
@@ -75,22 +71,6 @@ window.__ModuleLoader__.load({
|
|
|
75
71
|
}
|
|
76
72
|
};
|
|
77
73
|
/**
|
|
78
|
-
* Seed text for a failed install: the target and the rendered error,
|
|
79
|
-
* self-contained for the agent.
|
|
80
|
-
* @param spec - the install target (npm spec or git URL) that failed.
|
|
81
|
-
* @param error - the rendered install error text.
|
|
82
|
-
* @param copy - localized fragments.
|
|
83
|
-
* @returns the repair prompt text.
|
|
84
|
-
*/
|
|
85
|
-
function installRepairMessage(spec, error, copy = DEFAULT_REPAIR_COPY) {
|
|
86
|
-
return [
|
|
87
|
-
copy.installTitle,
|
|
88
|
-
`${copy.installSpecLabel}: ${spec}`,
|
|
89
|
-
`${copy.installErrorLabel}:\n${error}`,
|
|
90
|
-
copy.installAsk
|
|
91
|
-
].join("\n\n");
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
74
|
* Seed text for one boot-failure ring row: the failure record, so the agent
|
|
95
75
|
* can attribute and fix it in place.
|
|
96
76
|
* @param failure - the recorded failure row.
|
|
@@ -142,7 +122,7 @@ window.__ModuleLoader__.load({
|
|
|
142
122
|
}
|
|
143
123
|
//#endregion
|
|
144
124
|
//#region \0dsh-css:packages/dsh-plugin-manager/src/client/plugin-manager.module.css.mjs
|
|
145
|
-
const css = ".ZsMDKq_section{flex-direction:column;gap:12px;display:flex}.ZsMDKq_notice{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:8px;flex-direction:column;gap:8px;padding:16px;display:flex}.ZsMDKq_notice p{color:var(--dsw-alias-label-secondary);margin:0}.ZsMDKq_state{color:var(--dsw-alias-label-secondary);padding:16px 0}.
|
|
125
|
+
const css = ".ZsMDKq_section{flex-direction:column;gap:12px;display:flex}.ZsMDKq_notice{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:8px;flex-direction:column;gap:8px;padding:16px;display:flex}.ZsMDKq_notice p{color:var(--dsw-alias-label-secondary);margin:0}.ZsMDKq_state{color:var(--dsw-alias-label-secondary);padding:16px 0}.ZsMDKq_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px}.ZsMDKq_progressRow{flex-direction:column;gap:6px;display:flex}.ZsMDKq_progressTrack{background:var(--dsw-alias-bg-layer-2);border-radius:3px;height:6px;overflow:hidden}.ZsMDKq_progressBar{background:var(--dsw-alias-state-business-primary);height:100%;transition:width .2s}.ZsMDKq_progressBar[data-indeterminate=true]{width:40%;animation:1.2s ease-in-out infinite ZsMDKq_pluginManagerIndeterminate}@keyframes ZsMDKq_pluginManagerIndeterminate{0%{transform:translate(-100%)}to{transform:translate(250%)}}.ZsMDKq_progressLabel{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px}@media (prefers-reduced-motion:reduce){.ZsMDKq_progressBar[data-indeterminate=true]{width:40%;animation:none}}.ZsMDKq_errorRow{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-danger);border-radius:8px;flex-wrap:wrap;align-items:center;gap:8px;padding:8px 12px;display:flex}.ZsMDKq_error{min-width:200px;color:var(--dsw-alias-label-danger);word-break:break-all;flex:1}.ZsMDKq_group{flex-direction:column;gap:8px;display:flex}.ZsMDKq_sectionTitle{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;font-weight:600}.ZsMDKq_list{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.ZsMDKq_row{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:8px;justify-content:space-between;align-items:flex-start;gap:12px;padding:10px 12px;display:flex}.ZsMDKq_meta{flex-direction:column;gap:4px;min-width:0;display:flex}.ZsMDKq_name{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-weight:600;overflow:hidden}.ZsMDKq_sub{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;align-items:center;gap:6px;min-width:0;font-size:12px;display:flex}.ZsMDKq_version{white-space:nowrap}.ZsMDKq_sourceBadge{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);border-radius:4px;padding:0 4px;font-size:11px}.ZsMDKq_specText{text-overflow:ellipsis;white-space:nowrap;max-width:320px;overflow:hidden}.ZsMDKq_latest{color:var(--dsw-alias-state-business-primary);font-size:12px}.ZsMDKq_compatHint{color:var(--dsw-alias-label-tertiary);font-size:12px}.ZsMDKq_compatBlocked{color:var(--dsw-alias-label-danger);font-size:12px}.ZsMDKq_actions{flex-shrink:0;align-items:center;gap:8px;display:flex}.ZsMDKq_empty{color:var(--dsw-alias-label-tertiary);margin:0}.ZsMDKq_link{color:var(--dsw-alias-state-business-primary)}.ZsMDKq_stateLabel{color:var(--dsw-alias-label-secondary);font-size:12px}.ZsMDKq_stateLabel[data-state=enabled]{color:var(--dsw-alias-state-success-primary)}.ZsMDKq_stateLabel[data-state=disabled]{color:var(--dsw-alias-label-tertiary)}.ZsMDKq_stateLabel[data-state=mixed]{color:var(--dsw-alias-state-warning-primary,var(--dsw-alias-label-secondary))}.ZsMDKq_childrenToggle{width:100%;color:var(--dsw-alias-label-secondary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:6px;margin:6px 0 0;padding:4px 8px;font-size:12px;display:flex}.ZsMDKq_childrenToggle:hover{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}.ZsMDKq_childrenToggle:focus-visible{outline:2px solid var(--dsw-alias-border-l2);outline-offset:1px}.ZsMDKq_chevron{border-top:4px solid #0000;border-bottom:4px solid #0000;border-left:5px solid;flex:none;width:0;height:0;transition:transform .15s}.ZsMDKq_chevron[data-expanded=true]{transform:rotate(90deg)}@media (prefers-reduced-motion:reduce){.ZsMDKq_chevron{transition:none}}.ZsMDKq_childrenSummary{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.ZsMDKq_childList{border-left:2px solid var(--dsw-alias-border-l1);flex-direction:column;gap:4px;margin:6px 0 0;padding:2px 0 2px 16px;list-style:none;display:flex}.ZsMDKq_childRow{justify-content:space-between;align-items:center;gap:12px;padding:4px 8px;display:flex}.ZsMDKq_childName{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:13px;overflow:hidden}.ZsMDKq_lockedHint{color:var(--dsw-alias-label-tertiary);font-size:12px}.ZsMDKq_failure{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-danger);border-radius:6px;flex-direction:column;gap:6px;margin-top:4px;padding:8px;display:flex}.ZsMDKq_badge{background:var(--dsw-alias-label-danger);color:var(--dsw-alias-label-on-danger);border-radius:10px;align-self:flex-start;padding:2px 8px;font-size:11px}.ZsMDKq_failureMessage{color:var(--dsw-alias-label-danger);word-break:break-all;font-size:12px}.ZsMDKq_failureActions{flex-wrap:wrap;gap:8px;display:flex}.ZsMDKq_conflicts{flex-direction:column;gap:8px;display:flex}.ZsMDKq_actionsRow{align-items:center;gap:12px;display:flex}.ZsMDKq_ok{color:var(--dsw-alias-state-success-primary);margin:0;font-size:12px}.ZsMDKq_applying{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px}.ZsMDKq_restartRow{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-brand);border-radius:8px;padding:10px 12px}.ZsMDKq_restartRow p{color:var(--dsw-alias-brand-primary);margin:0}.ZsMDKq_safeModeBanner{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-warning);border-radius:8px;justify-content:space-between;align-items:center;gap:12px;padding:10px 12px;display:flex}.ZsMDKq_safeModeBanner p{color:var(--dsw-alias-label-primary);margin:0}";
|
|
146
126
|
const tagId = "@linxin666/dsh-client-ui-plugin-manager/packages/dsh-plugin-manager/src/client/plugin-manager.module.css";
|
|
147
127
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
148
128
|
const tag = document.createElement("style");
|
|
@@ -164,9 +144,7 @@ window.__ModuleLoader__.load({
|
|
|
164
144
|
"childrenToggle": "ZsMDKq_childrenToggle",
|
|
165
145
|
"compatBlocked": "ZsMDKq_compatBlocked",
|
|
166
146
|
"compatHint": "ZsMDKq_compatHint",
|
|
167
|
-
"confirmBody": "ZsMDKq_confirmBody",
|
|
168
147
|
"conflicts": "ZsMDKq_conflicts",
|
|
169
|
-
"dangerButton": "ZsMDKq_dangerButton",
|
|
170
148
|
"empty": "ZsMDKq_empty",
|
|
171
149
|
"error": "ZsMDKq_error",
|
|
172
150
|
"errorRow": "ZsMDKq_errorRow",
|
|
@@ -175,13 +153,11 @@ window.__ModuleLoader__.load({
|
|
|
175
153
|
"failureMessage": "ZsMDKq_failureMessage",
|
|
176
154
|
"group": "ZsMDKq_group",
|
|
177
155
|
"hint": "ZsMDKq_hint",
|
|
178
|
-
"installRow": "ZsMDKq_installRow",
|
|
179
156
|
"latest": "ZsMDKq_latest",
|
|
180
157
|
"link": "ZsMDKq_link",
|
|
181
158
|
"list": "ZsMDKq_list",
|
|
182
159
|
"lockedHint": "ZsMDKq_lockedHint",
|
|
183
160
|
"meta": "ZsMDKq_meta",
|
|
184
|
-
"modalActions": "ZsMDKq_modalActions",
|
|
185
161
|
"name": "ZsMDKq_name",
|
|
186
162
|
"notice": "ZsMDKq_notice",
|
|
187
163
|
"ok": "ZsMDKq_ok",
|
|
@@ -196,30 +172,27 @@ window.__ModuleLoader__.load({
|
|
|
196
172
|
"section": "ZsMDKq_section",
|
|
197
173
|
"sectionTitle": "ZsMDKq_sectionTitle",
|
|
198
174
|
"sourceBadge": "ZsMDKq_sourceBadge",
|
|
199
|
-
"spec": "ZsMDKq_spec",
|
|
200
175
|
"specText": "ZsMDKq_specText",
|
|
201
176
|
"state": "ZsMDKq_state",
|
|
202
177
|
"stateLabel": "ZsMDKq_stateLabel",
|
|
203
178
|
"sub": "ZsMDKq_sub",
|
|
204
|
-
"switch": "ZsMDKq_switch",
|
|
205
179
|
"version": "ZsMDKq_version"
|
|
206
180
|
};
|
|
207
181
|
//#endregion
|
|
208
182
|
//#region src/client/PluginManagerTab.tsx
|
|
209
183
|
/**
|
|
210
|
-
* The plugin-manager tab
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
184
|
+
* The plugin-manager tab keeps only what the official plugin manager page does
|
|
185
|
+
* not do. Installing, uninstalling and enabling or disabling a bundle or a row
|
|
186
|
+
* — with live switching and a build-script approval dialog — belong to the
|
|
187
|
+
* official page since 0.1.6-alpha.2, so this tab renders a read-only inventory
|
|
188
|
+
* and points there. Its own surface is the differentiating half: registry
|
|
189
|
+
* update checks with DSH-runtime compatibility gating, the install-conflict
|
|
190
|
+
* ledger the host records around an install or update (with undo and a repair
|
|
191
|
+
* handoff), the boot-failure ring with its repair conversation, and the
|
|
192
|
+
* safe-mode banner. Changes that need a restart say so.
|
|
218
193
|
*
|
|
219
194
|
* This tab registers into the official Plugins settings section
|
|
220
|
-
* (`settings.plugins.tab` slot) next to the official
|
|
221
|
-
* value over that tab is the conflict ledger, the bilingual repair seeds, and
|
|
222
|
-
* the family card vocabulary.
|
|
195
|
+
* (`settings.plugins.tab` slot) next to the official inventory tab.
|
|
223
196
|
*/
|
|
224
197
|
/** Error text for a caught request or lifecycle failure. */
|
|
225
198
|
function messageOf(error) {
|
|
@@ -232,10 +205,6 @@ window.__ModuleLoader__.load({
|
|
|
232
205
|
/** Localized fragments for the repair seed builders, read from the tab's dictionaries. */
|
|
233
206
|
function repairCopy(t) {
|
|
234
207
|
return {
|
|
235
|
-
installTitle: t("repairInstallTitle"),
|
|
236
|
-
installSpecLabel: t("repairInstallSpecLabel"),
|
|
237
|
-
installErrorLabel: t("repairInstallErrorLabel"),
|
|
238
|
-
installAsk: t("repairInstallAsk"),
|
|
239
208
|
failureTitle: t("repairFailureTitle"),
|
|
240
209
|
failurePluginLabel: t("repairFailurePluginLabel"),
|
|
241
210
|
failureKindLabel: t("repairFailureKindLabel"),
|
|
@@ -269,19 +238,15 @@ window.__ModuleLoader__.load({
|
|
|
269
238
|
}
|
|
270
239
|
/** The plugin-manager settings tab. */
|
|
271
240
|
function PluginManagerTab(props) {
|
|
272
|
-
const { t, isLoopback, list,
|
|
241
|
+
const { t, isLoopback, list, update, checkUpdates, status, failures, setSafeMode, repairPlugin, controlsList, controlsSetEnabled, lastInstallConflicts } = props;
|
|
273
242
|
const [view, setView] = (0, react.useState)({ status: "loading" });
|
|
274
243
|
const [busy, setBusy] = (0, react.useState)(void 0);
|
|
275
244
|
const [toggleBusy, setToggleBusy] = (0, react.useState)(void 0);
|
|
276
245
|
const [error, setError] = (0, react.useState)(void 0);
|
|
277
|
-
const [failedSpec, setFailedSpec] = (0, react.useState)(void 0);
|
|
278
|
-
const [installError, setInstallError] = (0, react.useState)(void 0);
|
|
279
|
-
const [spec, setSpec] = (0, react.useState)("");
|
|
280
246
|
const [dirty, setDirty] = (0, react.useState)(false);
|
|
281
247
|
const [repairing, setRepairing] = (0, react.useState)(void 0);
|
|
282
248
|
const [copied, setCopied] = (0, react.useState)(void 0);
|
|
283
249
|
const [updates, setUpdates] = (0, react.useState)(/* @__PURE__ */ new Map());
|
|
284
|
-
const [uninstallTarget, setUninstallTarget] = (0, react.useState)(void 0);
|
|
285
250
|
const [conflicts, setConflicts] = (0, react.useState)([]);
|
|
286
251
|
const [progress, setProgress] = (0, react.useState)({
|
|
287
252
|
kind: "idle",
|
|
@@ -292,13 +257,20 @@ window.__ModuleLoader__.load({
|
|
|
292
257
|
/** Synchronous in-flight mirror of `busy`: the render-time guard alone lets a
|
|
293
258
|
* click and an Enter land in the same frame and double-fire. */
|
|
294
259
|
const busyRef = (0, react.useRef)(false);
|
|
295
|
-
/**
|
|
260
|
+
/**
|
|
261
|
+
* Reload every snapshot into the ready view. The conflict ledger is the
|
|
262
|
+
* host's record of the last install or update that ran through this
|
|
263
|
+
* package's gateway channel — including a Workshop install driven through
|
|
264
|
+
* the shared service — so it is read here rather than diffed around an
|
|
265
|
+
* install this tab no longer performs.
|
|
266
|
+
*/
|
|
296
267
|
const reload = async () => {
|
|
297
268
|
const [plugins, controls, failureSnapshot] = await Promise.all([
|
|
298
269
|
list(),
|
|
299
270
|
controlsList(),
|
|
300
271
|
failures()
|
|
301
272
|
]);
|
|
273
|
+
if (lastInstallConflicts !== void 0) setConflicts(lastInstallConflicts());
|
|
302
274
|
setView({
|
|
303
275
|
status: "ready",
|
|
304
276
|
plugins,
|
|
@@ -331,38 +303,9 @@ window.__ModuleLoader__.load({
|
|
|
331
303
|
setBusy(void 0);
|
|
332
304
|
}
|
|
333
305
|
};
|
|
334
|
-
/**
|
|
335
|
-
const onInstall = () => {
|
|
336
|
-
const target = spec.trim();
|
|
337
|
-
if (target === "" || busy !== void 0 || busyRef.current) return;
|
|
338
|
-
(async () => {
|
|
339
|
-
busyRef.current = true;
|
|
340
|
-
const before = view.status === "ready" ? view.controls : await controlsList().catch(() => []);
|
|
341
|
-
setBusy({ kind: "install" });
|
|
342
|
-
setError(void 0);
|
|
343
|
-
setFailedSpec(void 0);
|
|
344
|
-
setInstallError(void 0);
|
|
345
|
-
try {
|
|
346
|
-
await install(target);
|
|
347
|
-
setSpec("");
|
|
348
|
-
setDirty(true);
|
|
349
|
-
const after = await controlsList().catch(() => []);
|
|
350
|
-
setConflicts(lastInstallConflicts !== void 0 ? lastInstallConflicts() : diffControls(before, after));
|
|
351
|
-
await reload();
|
|
352
|
-
} catch (reason) {
|
|
353
|
-
const reasonText = messageOf(reason);
|
|
354
|
-
setFailedSpec(target);
|
|
355
|
-
setInstallError(reasonText);
|
|
356
|
-
setError(t("failed", { reason: reasonText }));
|
|
357
|
-
} finally {
|
|
358
|
-
busyRef.current = false;
|
|
359
|
-
setBusy(void 0);
|
|
360
|
-
}
|
|
361
|
-
})();
|
|
362
|
-
};
|
|
363
|
-
/** Poll install/update progress while such an operation is in flight. */
|
|
306
|
+
/** Poll update progress while such an operation is in flight. */
|
|
364
307
|
(0, react.useEffect)(() => {
|
|
365
|
-
if (busy === void 0 || busy.kind !== "
|
|
308
|
+
if (busy === void 0 || busy.kind !== "update") {
|
|
366
309
|
setProgress({
|
|
367
310
|
kind: "idle",
|
|
368
311
|
stage: "fetch"
|
|
@@ -397,24 +340,6 @@ window.__ModuleLoader__.load({
|
|
|
397
340
|
return next;
|
|
398
341
|
});
|
|
399
342
|
};
|
|
400
|
-
const onUserToggle = (id, enabled) => {
|
|
401
|
-
setToggleBusy({
|
|
402
|
-
kind: "user",
|
|
403
|
-
id
|
|
404
|
-
});
|
|
405
|
-
setError(void 0);
|
|
406
|
-
setEnabled(id, enabled).then((plugin) => {
|
|
407
|
-
setView((current) => current.status === "ready" ? {
|
|
408
|
-
...current,
|
|
409
|
-
plugins: current.plugins.map((item) => item.id === plugin.id ? plugin : item)
|
|
410
|
-
} : current);
|
|
411
|
-
setDirty(true);
|
|
412
|
-
setToggleBusy(void 0);
|
|
413
|
-
}).catch((reason) => {
|
|
414
|
-
setError(t("failed", { reason: messageOf(reason) }));
|
|
415
|
-
setToggleBusy(void 0);
|
|
416
|
-
});
|
|
417
|
-
};
|
|
418
343
|
const onProductToggle = (id, enabled) => {
|
|
419
344
|
setToggleBusy({
|
|
420
345
|
kind: "product",
|
|
@@ -445,6 +370,7 @@ window.__ModuleLoader__.load({
|
|
|
445
370
|
kind: "update",
|
|
446
371
|
id
|
|
447
372
|
}, async () => {
|
|
373
|
+
const before = view.status === "ready" ? view.controls : await controlsList().catch(() => []);
|
|
448
374
|
await update(id);
|
|
449
375
|
setUpdates((previous) => {
|
|
450
376
|
const next = new Map(previous);
|
|
@@ -452,18 +378,9 @@ window.__ModuleLoader__.load({
|
|
|
452
378
|
return next;
|
|
453
379
|
});
|
|
454
380
|
await reload();
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
const target = uninstallTarget;
|
|
459
|
-
if (target === void 0) return;
|
|
460
|
-
run({
|
|
461
|
-
kind: "uninstall",
|
|
462
|
-
id: target.id
|
|
463
|
-
}, async () => {
|
|
464
|
-
await uninstall(target.id);
|
|
465
|
-
setUninstallTarget(void 0);
|
|
466
|
-
await reload();
|
|
381
|
+
if ((lastInstallConflicts?.() ?? []).length > 0) return;
|
|
382
|
+
const after = await controlsList().catch(() => []);
|
|
383
|
+
setConflicts(diffControls(before, after));
|
|
467
384
|
});
|
|
468
385
|
};
|
|
469
386
|
/** Open a repair conversation seeded with one boot-failure record. `token`
|
|
@@ -480,23 +397,6 @@ window.__ModuleLoader__.load({
|
|
|
480
397
|
setRepairing(void 0);
|
|
481
398
|
});
|
|
482
399
|
};
|
|
483
|
-
/** Hand the latest failed install off to a repair conversation over the
|
|
484
|
-
* install root. The seed carries the install's own error (installError), not
|
|
485
|
-
* whatever error the row currently shows. */
|
|
486
|
-
const onRepairInstall = () => {
|
|
487
|
-
if (view.status !== "ready" || repairing !== void 0) return;
|
|
488
|
-
setError(void 0);
|
|
489
|
-
setRepairing("install");
|
|
490
|
-
repairPlugin(view.failures.pluginRoot, installRepairMessage(failedSpec ?? "", installError ?? "", repairCopy(t))).then(() => {
|
|
491
|
-
setError(void 0);
|
|
492
|
-
setFailedSpec(void 0);
|
|
493
|
-
setInstallError(void 0);
|
|
494
|
-
setRepairing(void 0);
|
|
495
|
-
}).catch((reason) => {
|
|
496
|
-
setError(t("failed", { reason: messageOf(reason) }));
|
|
497
|
-
setRepairing(void 0);
|
|
498
|
-
});
|
|
499
|
-
};
|
|
500
400
|
/** Copy a boot failure's message and stack for a manual repair conversation. */
|
|
501
401
|
const onCopy = (failure, token) => {
|
|
502
402
|
navigator.clipboard.writeText(`${failure.message}\n\n${failure.stack}`).then(() => {
|
|
@@ -568,32 +468,12 @@ window.__ModuleLoader__.load({
|
|
|
568
468
|
children: t("exitSafeMode")
|
|
569
469
|
})]
|
|
570
470
|
}),
|
|
571
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
572
|
-
className: plugin_manager_module_css_default.installRow,
|
|
573
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
574
|
-
className: plugin_manager_module_css_default.spec,
|
|
575
|
-
type: "text",
|
|
576
|
-
value: spec,
|
|
577
|
-
placeholder: t("installPlaceholder"),
|
|
578
|
-
disabled: busy !== void 0,
|
|
579
|
-
onChange: (event) => {
|
|
580
|
-
setSpec(event.target.value);
|
|
581
|
-
},
|
|
582
|
-
onKeyDown: (event) => {
|
|
583
|
-
if (event.key === "Enter" && spec.trim() !== "" && busy === void 0) onInstall();
|
|
584
|
-
}
|
|
585
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
586
|
-
variant: "primary",
|
|
587
|
-
disabled: spec.trim() === "" || busy !== void 0,
|
|
588
|
-
onClick: onInstall,
|
|
589
|
-
children: busy !== void 0 && busy.kind === "install" ? t("installing") : t("install")
|
|
590
|
-
})]
|
|
591
|
-
}),
|
|
592
471
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
593
472
|
className: plugin_manager_module_css_default.hint,
|
|
594
|
-
|
|
473
|
+
"data-manage-elsewhere": true,
|
|
474
|
+
children: t("manageElsewhere")
|
|
595
475
|
}),
|
|
596
|
-
|
|
476
|
+
busy?.kind === "update" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
597
477
|
className: plugin_manager_module_css_default.progressRow,
|
|
598
478
|
role: "status",
|
|
599
479
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -608,17 +488,12 @@ window.__ModuleLoader__.load({
|
|
|
608
488
|
children: progressLabel(progress, t)
|
|
609
489
|
})]
|
|
610
490
|
}),
|
|
611
|
-
error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.
|
|
491
|
+
error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
612
492
|
className: plugin_manager_module_css_default.errorRow,
|
|
613
|
-
children:
|
|
493
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
614
494
|
className: plugin_manager_module_css_default.error,
|
|
615
495
|
children: error
|
|
616
|
-
})
|
|
617
|
-
variant: "outline",
|
|
618
|
-
disabled: repairing !== void 0,
|
|
619
|
-
onClick: onRepairInstall,
|
|
620
|
-
children: repairing === "install" ? t("repairing") : t("repair")
|
|
621
|
-
})]
|
|
496
|
+
})
|
|
622
497
|
}),
|
|
623
498
|
conflicts.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
624
499
|
className: plugin_manager_module_css_default.conflicts,
|
|
@@ -758,43 +633,18 @@ window.__ModuleLoader__.load({
|
|
|
758
633
|
]
|
|
759
634
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
760
635
|
className: plugin_manager_module_css_default.actions,
|
|
761
|
-
children: [
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
disabled: toggleDisabled,
|
|
774
|
-
onClick: () => {
|
|
775
|
-
onUserToggle(plugin.id, !plugin.enabled);
|
|
776
|
-
}
|
|
777
|
-
}),
|
|
778
|
-
latest !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
779
|
-
variant: "outline",
|
|
780
|
-
disabled: busy !== void 0 || updateItem?.compatible === false,
|
|
781
|
-
onClick: () => {
|
|
782
|
-
onUpdate(plugin.id);
|
|
783
|
-
},
|
|
784
|
-
children: busy?.kind === "update" && busy.id === plugin.id ? t("updating") : t("update")
|
|
785
|
-
}),
|
|
786
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
787
|
-
variant: "outline",
|
|
788
|
-
disabled: busy !== void 0,
|
|
789
|
-
onClick: () => {
|
|
790
|
-
setUninstallTarget({
|
|
791
|
-
id: plugin.id,
|
|
792
|
-
name: plugin.name
|
|
793
|
-
});
|
|
794
|
-
},
|
|
795
|
-
children: t("uninstall")
|
|
796
|
-
})
|
|
797
|
-
]
|
|
636
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
637
|
+
className: plugin_manager_module_css_default.stateLabel,
|
|
638
|
+
"data-state": plugin.enabled ? "enabled" : mixed ? "mixed" : "disabled",
|
|
639
|
+
children: plugin.enabled ? t("enabled") : mixed ? t("mixed") : t("disabled")
|
|
640
|
+
}), latest !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
641
|
+
variant: "outline",
|
|
642
|
+
disabled: busy !== void 0 || updateItem?.compatible === false,
|
|
643
|
+
onClick: () => {
|
|
644
|
+
onUpdate(plugin.id);
|
|
645
|
+
},
|
|
646
|
+
children: busy?.kind === "update" && busy.id === plugin.id ? t("updating") : t("update")
|
|
647
|
+
})]
|
|
798
648
|
})]
|
|
799
649
|
}), children !== void 0 && children.length > 0 && (() => {
|
|
800
650
|
const listId = "pm-children-" + plugin.id.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
@@ -839,17 +689,7 @@ window.__ModuleLoader__.load({
|
|
|
839
689
|
}), child.locked === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
840
690
|
className: plugin_manager_module_css_default.lockedHint,
|
|
841
691
|
children: t("lockedRowHint")
|
|
842
|
-
}) :
|
|
843
|
-
type: "button",
|
|
844
|
-
role: "switch",
|
|
845
|
-
"aria-checked": child.enabled,
|
|
846
|
-
"aria-label": child.enabled ? t("disableSwitch", { name: child.name }) : t("enableSwitch", { name: child.name }),
|
|
847
|
-
className: plugin_manager_module_css_default.switch,
|
|
848
|
-
disabled: toggleDisabled,
|
|
849
|
-
onClick: () => {
|
|
850
|
-
onUserToggle(child.id, !child.enabled);
|
|
851
|
-
}
|
|
852
|
-
})]
|
|
692
|
+
}) : null]
|
|
853
693
|
})]
|
|
854
694
|
}, child.id))
|
|
855
695
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
@@ -886,23 +726,13 @@ window.__ModuleLoader__.load({
|
|
|
886
726
|
children: t("source")
|
|
887
727
|
})
|
|
888
728
|
})]
|
|
889
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.
|
|
729
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
890
730
|
className: plugin_manager_module_css_default.actions,
|
|
891
|
-
children:
|
|
731
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
892
732
|
className: plugin_manager_module_css_default.stateLabel,
|
|
893
733
|
"data-state": control.state,
|
|
894
734
|
children: t(control.state)
|
|
895
|
-
})
|
|
896
|
-
type: "button",
|
|
897
|
-
role: "switch",
|
|
898
|
-
"aria-checked": control.state === "enabled",
|
|
899
|
-
"aria-label": control.state === "enabled" ? t("disableSwitch", { name: control.name }) : t("enableSwitch", { name: control.name }),
|
|
900
|
-
className: plugin_manager_module_css_default.switch,
|
|
901
|
-
disabled: toggleDisabled,
|
|
902
|
-
onClick: () => {
|
|
903
|
-
onProductToggle(control.id, control.state !== "enabled");
|
|
904
|
-
}
|
|
905
|
-
}) : null]
|
|
735
|
+
})
|
|
906
736
|
})]
|
|
907
737
|
}, control.id))
|
|
908
738
|
})]
|
|
@@ -975,34 +805,6 @@ window.__ModuleLoader__.load({
|
|
|
975
805
|
dirty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
976
806
|
className: plugin_manager_module_css_default.restartRow,
|
|
977
807
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("restartHint") })
|
|
978
|
-
}),
|
|
979
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
980
|
-
title: t("uninstallConfirmTitle"),
|
|
981
|
-
open: uninstallTarget !== void 0,
|
|
982
|
-
onClose: () => {
|
|
983
|
-
setUninstallTarget(void 0);
|
|
984
|
-
},
|
|
985
|
-
closeLabel: t("cancel"),
|
|
986
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
987
|
-
className: plugin_manager_module_css_default.confirmBody,
|
|
988
|
-
children: t("uninstallConfirmBody", { name: uninstallTarget?.name ?? "" })
|
|
989
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
990
|
-
className: plugin_manager_module_css_default.modalActions,
|
|
991
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
992
|
-
variant: "outline",
|
|
993
|
-
disabled: busy !== void 0,
|
|
994
|
-
onClick: () => {
|
|
995
|
-
setUninstallTarget(void 0);
|
|
996
|
-
},
|
|
997
|
-
children: t("cancel")
|
|
998
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
999
|
-
variant: "primary",
|
|
1000
|
-
className: plugin_manager_module_css_default.dangerButton,
|
|
1001
|
-
disabled: busy !== void 0,
|
|
1002
|
-
onClick: onUninstall,
|
|
1003
|
-
children: t("confirm")
|
|
1004
|
-
})]
|
|
1005
|
-
})]
|
|
1006
808
|
})
|
|
1007
809
|
]
|
|
1008
810
|
});
|
|
@@ -1017,6 +819,7 @@ window.__ModuleLoader__.load({
|
|
|
1017
819
|
/** Simplified Chinese copy (the key-set source of truth). */
|
|
1018
820
|
const STATIC_ZH = {
|
|
1019
821
|
tab: "插件管理",
|
|
822
|
+
manageElsewhere: "安装、卸载与启停已由官方插件管理页负责(侧边栏「插件」);这里保留更新检查、安装冲突与启动失败修复。",
|
|
1020
823
|
loading: "正在读取插件…",
|
|
1021
824
|
empty: "尚未安装任何用户插件。",
|
|
1022
825
|
userPlugins: "用户插件",
|
|
@@ -1027,10 +830,6 @@ window.__ModuleLoader__.load({
|
|
|
1027
830
|
conflictChanged: "{name} 的状态已变更。",
|
|
1028
831
|
undoConflict: "撤销",
|
|
1029
832
|
conflictHint: "冲突动作在安装时自动执行,撤销会写回开关并在重启后生效。",
|
|
1030
|
-
installPlaceholder: "npm 包名(如 @scope/name)或 git 仓库 URL",
|
|
1031
|
-
install: "安装",
|
|
1032
|
-
installing: "安装中…",
|
|
1033
|
-
installHint: "在 GitHub 或 npm 找到插件后,粘贴其 npm 包名或仓库地址安装;应用重启后插件生效。",
|
|
1034
833
|
version: "已安装 {version}",
|
|
1035
834
|
latest: "最新 {version}",
|
|
1036
835
|
update: "更新",
|
|
@@ -1040,11 +839,6 @@ window.__ModuleLoader__.load({
|
|
|
1040
839
|
noUpdates: "所有插件都是最新版本。",
|
|
1041
840
|
updateRequiresDsh: "需要 DSH ≥ {min}",
|
|
1042
841
|
updateBlockedDsh: "需要 DSH ≥ {min},请先升级 DSH 再更新",
|
|
1043
|
-
uninstall: "卸载",
|
|
1044
|
-
uninstallConfirmTitle: "卸载插件",
|
|
1045
|
-
uninstallConfirmBody: "将删除 {name} 的安装目录与配置行,并在重启后生效。",
|
|
1046
|
-
confirm: "确认卸载",
|
|
1047
|
-
cancel: "取消",
|
|
1048
842
|
restartHint: "插件变更将在重启应用后生效。",
|
|
1049
843
|
failed: "操作失败:{reason}",
|
|
1050
844
|
enabled: "已开启",
|
|
@@ -1071,17 +865,11 @@ window.__ModuleLoader__.load({
|
|
|
1071
865
|
exitSafeMode: "恢复正常模式并重启",
|
|
1072
866
|
npmSource: "npm",
|
|
1073
867
|
gitSource: "git",
|
|
1074
|
-
enableSwitch: "开启 {name}",
|
|
1075
|
-
disableSwitch: "关闭 {name}",
|
|
1076
868
|
lockedRowHint: "核心行",
|
|
1077
|
-
childrenHint: "
|
|
869
|
+
childrenHint: "子插件的启停在官方插件管理页操作;停用后不再加载,代码仍随全家桶更新。",
|
|
1078
870
|
childrenSummary: "子插件 {enabled}/{total} 已启用",
|
|
1079
871
|
childrenShow: "展开 {name} 的子插件",
|
|
1080
872
|
childrenHide: "收起 {name} 的子插件",
|
|
1081
|
-
repairInstallTitle: "插件安装失败,请帮我诊断并修复。",
|
|
1082
|
-
repairInstallSpecLabel: "安装目标",
|
|
1083
|
-
repairInstallErrorLabel: "错误信息",
|
|
1084
|
-
repairInstallAsk: "请检查该插件并重新安装;完成后告诉我结果。",
|
|
1085
873
|
repairFailureTitle: "插件上次启动失败。请修复它。",
|
|
1086
874
|
repairFailurePluginLabel: "插件",
|
|
1087
875
|
repairFailureKindLabel: "失败类型",
|
|
@@ -1104,6 +892,7 @@ window.__ModuleLoader__.load({
|
|
|
1104
892
|
/** English copy, checked complete against the zh key set. */
|
|
1105
893
|
const STATIC_EN = {
|
|
1106
894
|
tab: "Plugin manager",
|
|
895
|
+
manageElsewhere: "Installing, uninstalling and enabling plugins now live on the official plugin manager page (the Plugins entry in the sidebar); this tab keeps update checks, install conflicts and startup-failure repair.",
|
|
1107
896
|
loading: "Reading plugins…",
|
|
1108
897
|
empty: "No user plugins installed yet.",
|
|
1109
898
|
userPlugins: "User plugins",
|
|
@@ -1114,10 +903,6 @@ window.__ModuleLoader__.load({
|
|
|
1114
903
|
conflictChanged: "The state of {name} changed.",
|
|
1115
904
|
undoConflict: "Undo",
|
|
1116
905
|
conflictHint: "Conflict actions run automatically at install time; undoing writes the switch back and applies after a restart.",
|
|
1117
|
-
installPlaceholder: "npm package (e.g. @scope/name) or git repository URL",
|
|
1118
|
-
install: "Install",
|
|
1119
|
-
installing: "Installing…",
|
|
1120
|
-
installHint: "Find a plugin on GitHub or npm, then paste its npm package name or repository URL; plugins load after a restart.",
|
|
1121
906
|
version: "Installed {version}",
|
|
1122
907
|
latest: "Latest {version}",
|
|
1123
908
|
update: "Update",
|
|
@@ -1127,11 +912,6 @@ window.__ModuleLoader__.load({
|
|
|
1127
912
|
noUpdates: "All plugins are up to date.",
|
|
1128
913
|
updateRequiresDsh: "Requires DSH >= {min}",
|
|
1129
914
|
updateBlockedDsh: "Requires DSH >= {min}; upgrade DSH before updating",
|
|
1130
|
-
uninstall: "Uninstall",
|
|
1131
|
-
uninstallConfirmTitle: "Uninstall plugin",
|
|
1132
|
-
uninstallConfirmBody: "{name} and its configuration row will be removed; the change applies after a restart.",
|
|
1133
|
-
confirm: "Uninstall",
|
|
1134
|
-
cancel: "Cancel",
|
|
1135
915
|
restartHint: "Plugin changes take effect after restarting the application.",
|
|
1136
916
|
failed: "Operation failed: {reason}",
|
|
1137
917
|
enabled: "On",
|
|
@@ -1158,17 +938,11 @@ window.__ModuleLoader__.load({
|
|
|
1158
938
|
exitSafeMode: "Restore normal mode and restart",
|
|
1159
939
|
npmSource: "npm",
|
|
1160
940
|
gitSource: "git",
|
|
1161
|
-
enableSwitch: "Turn on {name}",
|
|
1162
|
-
disableSwitch: "Turn off {name}",
|
|
1163
941
|
lockedRowHint: "Core row",
|
|
1164
|
-
childrenHint: "Bundle child plugins
|
|
942
|
+
childrenHint: "Bundle child plugins are switched on the official plugin manager page; a disabled child is never loaded, while its code still updates with the bundle.",
|
|
1165
943
|
childrenSummary: "{enabled}/{total} child plugins on",
|
|
1166
944
|
childrenShow: "Show child plugins of {name}",
|
|
1167
945
|
childrenHide: "Hide child plugins of {name}",
|
|
1168
|
-
repairInstallTitle: "The plugin installation failed. Please diagnose and fix it.",
|
|
1169
|
-
repairInstallSpecLabel: "Install target",
|
|
1170
|
-
repairInstallErrorLabel: "Error message",
|
|
1171
|
-
repairInstallAsk: "Please inspect the plugin and reinstall it; tell me when it is done.",
|
|
1172
946
|
repairFailureTitle: "A plugin failed to start last time. Please fix it.",
|
|
1173
947
|
repairFailurePluginLabel: "Plugin",
|
|
1174
948
|
repairFailureKindLabel: "Failure kind",
|
|
@@ -1345,7 +1119,7 @@ window.__ModuleLoader__.load({
|
|
|
1345
1119
|
/** The building package's version, when the bundle carries it. */
|
|
1346
1120
|
function bakedVersion() {
|
|
1347
1121
|
try {
|
|
1348
|
-
return "0.
|
|
1122
|
+
return "0.4.0";
|
|
1349
1123
|
} catch {
|
|
1350
1124
|
return;
|
|
1351
1125
|
}
|
|
@@ -1432,7 +1206,8 @@ window.__ModuleLoader__.load({
|
|
|
1432
1206
|
"locale",
|
|
1433
1207
|
"connection",
|
|
1434
1208
|
"workspaces",
|
|
1435
|
-
"sessions"
|
|
1209
|
+
"sessions",
|
|
1210
|
+
"uiWorkspace"
|
|
1436
1211
|
];
|
|
1437
1212
|
/**
|
|
1438
1213
|
* Build the dual-channel face once: official-channel and gateway-channel
|
|
@@ -1617,7 +1392,7 @@ window.__ModuleLoader__.load({
|
|
|
1617
1392
|
text: message
|
|
1618
1393
|
}], "queue");
|
|
1619
1394
|
if (!result.ok) throw new Error(`plugin-manager: repair prompt failed: ${result.error.code}: ${result.error.message}`);
|
|
1620
|
-
ctx.
|
|
1395
|
+
ctx.uiWorkspace.openSession(sessionId);
|
|
1621
1396
|
};
|
|
1622
1397
|
/** Listeners subscribed through onChange; fired after successful mutations. */
|
|
1623
1398
|
const listeners = /* @__PURE__ */ new Set();
|