@linxin666/dsh-client-ui-plugin-manager 0.4.2 → 0.4.3

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 CHANGED
@@ -5,107 +5,7 @@ window.__ModuleLoader__.load({
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  let react = require("react");
8
- let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
9
8
  let react_jsx_runtime = require("react/jsx-runtime");
10
- //#region src/core/conflict.ts
11
- /**
12
- * Diff two plugin-control snapshots by id. Only entries present in both
13
- * snapshots with a changed state are reported; entries appearing or
14
- * disappearing are ordinary install/uninstall outcomes, not conflicts.
15
- * @param before - snapshot taken before the install.
16
- * @param after - snapshot taken after the install.
17
- * @returns one change per id whose state moved, in id order.
18
- */
19
- function diffControls(before, after) {
20
- const afterById = new Map(after.map((item) => [item.id, item]));
21
- const changes = [];
22
- for (const item of before) {
23
- const current = afterById.get(item.id);
24
- if (current === void 0 || current.state === item.state) continue;
25
- changes.push({
26
- id: item.id,
27
- name: item.name,
28
- from: item.state,
29
- to: current.state
30
- });
31
- }
32
- return changes;
33
- }
34
- /**
35
- * Classify one control-state change for messaging. A change into `disabled`
36
- * is the conflict rule's action (reversible by re-enabling); a change out of
37
- * `disabled` is a manual undo; anything else is reported neutrally.
38
- * @param change - one diff entry.
39
- * @returns the message kind.
40
- */
41
- function classifyChange(change) {
42
- if (change.to === "disabled") return "rule-disabled";
43
- if (change.from === "disabled") return "rule-enabled";
44
- return "state-change";
45
- }
46
- //#endregion
47
- //#region src/core/repair.ts
48
- /** Default copy (zh): the package's zh dictionary keys map onto these strings. */
49
- const DEFAULT_REPAIR_COPY = {
50
- failureTitle: "正在修复插件启动失败",
51
- failurePluginLabel: "插件",
52
- failureKindLabel: "失败类型",
53
- failureAtLabel: "时间",
54
- failureMessageLabel: "错误信息",
55
- failureStackLabel: "堆栈",
56
- failurePathLabel: "安装路径",
57
- failureAsk: "请修复插件后重新启用并重启 dsh web。",
58
- conflictTitle: "正在处理插件安装冲突",
59
- conflictPluginLabel: "冲突条目",
60
- conflictChangeLabel: "状态变化",
61
- conflictAsk: "请检查冲突双方的入口行 id 与挂载方式,消除重复挂载后告诉我如何重新启用。",
62
- kindNames: {
63
- "load-failure": "加载失败",
64
- hang: "启动挂起",
65
- "late-rejection": "迟到拒绝"
66
- },
67
- stateNames: {
68
- enabled: "已开启",
69
- disabled: "已关闭",
70
- uninstalled: "已卸载"
71
- }
72
- };
73
- /**
74
- * Seed text for one boot-failure ring row: the failure record, so the agent
75
- * can attribute and fix it in place.
76
- * @param failure - the recorded failure row.
77
- * @param copy - localized fragments.
78
- * @returns the repair prompt text.
79
- */
80
- function failureRepairMessage(failure, copy = DEFAULT_REPAIR_COPY) {
81
- const parts = [
82
- copy.failureTitle,
83
- `${copy.failurePluginLabel}: ${failure.pluginId || "-"}`,
84
- `${copy.failureKindLabel}: ${copy.kindNames[failure.kind] ?? failure.kind}`,
85
- `${copy.failureAtLabel}: ${failure.at}`,
86
- `${copy.failureMessageLabel}:\n${failure.message}`
87
- ];
88
- if (failure.stack !== "") parts.push(`${copy.failureStackLabel}:\n${failure.stack}`);
89
- if (failure.installPath !== "") parts.push(`${copy.failurePathLabel}: ${failure.installPath}`);
90
- parts.push(copy.failureAsk);
91
- return parts.join("\n\n");
92
- }
93
- /**
94
- * Seed text for one install-conflict notice: the entry and its state change,
95
- * so the agent can attribute the conflict and resolve the double mount.
96
- * @param change - the conflict change (id, display name, from/to states).
97
- * @param copy - localized fragments.
98
- * @returns the repair prompt text.
99
- */
100
- function conflictRepairMessage(change, copy = DEFAULT_REPAIR_COPY) {
101
- return [
102
- copy.conflictTitle,
103
- `${copy.conflictPluginLabel}: ${change.name} (${change.id})`,
104
- `${copy.conflictChangeLabel}: ${copy.stateNames[change.from] ?? change.from} -> ${copy.stateNames[change.to] ?? change.to}`,
105
- copy.conflictAsk
106
- ].join("\n\n");
107
- }
108
- //#endregion
109
9
  //#region src/core/version.ts
110
10
  const MINIMUM_RANGE_PATTERN = /^>=\s*(v?\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;
111
11
  /**
@@ -122,7 +22,7 @@ window.__ModuleLoader__.load({
122
22
  }
123
23
  //#endregion
124
24
  //#region \0dsh-css:packages/dsh-plugin-manager/src/client/plugin-manager.module.css.mjs
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}";
25
+ const css = ".ZsMDKq_section{max-width:760px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:10px;display:flex}.ZsMDKq_title{margin:0;font-size:13px;font-weight:600;line-height:20px}.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_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px}.ZsMDKq_actionRow{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.ZsMDKq_button{font:inherit;cursor:pointer;border:1px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm,6px);color:var(--dsw-alias-label-primary);background:0 0;padding:5px 12px;font-size:12.5px;line-height:18px}.ZsMDKq_button:hover:enabled{background:var(--dsw-alias-interactive-bg-hover)}.ZsMDKq_button:disabled{cursor:default;opacity:.55}.ZsMDKq_button:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.ZsMDKq_primary{color:var(--dsw-alias-label-primary-foreground);background:var(--dsw-alias-button-primary-fill);border-color:var(--dsw-alias-button-primary-fill)}.ZsMDKq_primary:hover:enabled{background:var(--dsw-alias-button-primary-hover);border-color:var(--dsw-alias-button-primary-hover)}.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_ok{color:var(--dsw-alias-state-success-primary);margin:0;font-size:12px}.ZsMDKq_error{color:var(--dsw-alias-label-danger);word-break:break-word;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%)}}@media (prefers-reduced-motion:reduce){.ZsMDKq_progressBar[data-indeterminate=true]{width:40%;animation:none}}.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}";
126
26
  const tagId = "@linxin666/dsh-client-ui-plugin-manager/packages/dsh-plugin-manager/src/client/plugin-manager.module.css";
127
27
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
128
28
  const tag = document.createElement("style");
@@ -132,67 +32,45 @@ window.__ModuleLoader__.load({
132
32
  document.head.appendChild(tag);
133
33
  }
134
34
  var plugin_manager_module_css_default = {
135
- "actions": "ZsMDKq_actions",
136
- "actionsRow": "ZsMDKq_actionsRow",
137
- "applying": "ZsMDKq_applying",
138
- "badge": "ZsMDKq_badge",
139
- "chevron": "ZsMDKq_chevron",
140
- "childList": "ZsMDKq_childList",
141
- "childName": "ZsMDKq_childName",
142
- "childRow": "ZsMDKq_childRow",
143
- "childrenSummary": "ZsMDKq_childrenSummary",
144
- "childrenToggle": "ZsMDKq_childrenToggle",
35
+ "actionRow": "ZsMDKq_actionRow",
36
+ "button": "ZsMDKq_button",
145
37
  "compatBlocked": "ZsMDKq_compatBlocked",
146
38
  "compatHint": "ZsMDKq_compatHint",
147
- "conflicts": "ZsMDKq_conflicts",
148
- "empty": "ZsMDKq_empty",
149
39
  "error": "ZsMDKq_error",
150
- "errorRow": "ZsMDKq_errorRow",
151
- "failure": "ZsMDKq_failure",
152
- "failureActions": "ZsMDKq_failureActions",
153
- "failureMessage": "ZsMDKq_failureMessage",
154
- "group": "ZsMDKq_group",
155
40
  "hint": "ZsMDKq_hint",
156
41
  "latest": "ZsMDKq_latest",
157
- "link": "ZsMDKq_link",
158
- "list": "ZsMDKq_list",
159
- "lockedHint": "ZsMDKq_lockedHint",
160
- "meta": "ZsMDKq_meta",
161
- "name": "ZsMDKq_name",
162
42
  "notice": "ZsMDKq_notice",
163
43
  "ok": "ZsMDKq_ok",
164
44
  "pluginManagerIndeterminate": "ZsMDKq_pluginManagerIndeterminate",
45
+ "primary": "ZsMDKq_primary",
165
46
  "progressBar": "ZsMDKq_progressBar",
166
- "progressLabel": "ZsMDKq_progressLabel",
167
47
  "progressRow": "ZsMDKq_progressRow",
168
48
  "progressTrack": "ZsMDKq_progressTrack",
169
49
  "restartRow": "ZsMDKq_restartRow",
170
- "row": "ZsMDKq_row",
171
- "safeModeBanner": "ZsMDKq_safeModeBanner",
172
50
  "section": "ZsMDKq_section",
173
- "sectionTitle": "ZsMDKq_sectionTitle",
174
- "sourceBadge": "ZsMDKq_sourceBadge",
175
- "specText": "ZsMDKq_specText",
176
- "state": "ZsMDKq_state",
177
- "stateLabel": "ZsMDKq_stateLabel",
178
- "sub": "ZsMDKq_sub",
179
- "version": "ZsMDKq_version"
51
+ "title": "ZsMDKq_title"
180
52
  };
181
53
  //#endregion
182
- //#region src/client/PluginManagerTab.tsx
54
+ //#region src/client/PluginUpdatePatch.tsx
183
55
  /**
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.
56
+ * The check-for-updates patch contributed to the official Plugins page.
57
+ *
58
+ * This package used to own a "Plugin manager" tab inside the Plugins settings
59
+ * section (`settings.plugins.tab`). Installing, uninstalling, enabling and
60
+ * disabling moved to the official plugin manager page long ago, and the tab's
61
+ * remaining half (read-only inventory, install-conflict ledger, boot-failure
62
+ * repair conversation, safe-mode banner) is UI no official page renders. It is
63
+ * gone; the one capability the official page still lacks is comparing an
64
+ * installed plugin against its registry source.
193
65
  *
194
- * This tab registers into the official Plugins settings section
195
- * (`settings.plugins.tab` slot) next to the official inventory tab.
66
+ * So this package now contributes exactly that, into the seat the official
67
+ * Plugins page declares for contributed sections (`plugins.detail.section`,
68
+ * a root-scope list rendered on every bundle / row / official-plugin page with
69
+ * the page's `subject`). The official page owns the page chrome; this entry
70
+ * renders one compact block, only on an installed bundle's page, drawing only
71
+ * a plain button and its own section so it carries no dependency on the
72
+ * official primitives bundle.
73
+ * @module @linxin666/dsh-client-ui-plugin-manager/client
196
74
  */
197
75
  /** Error text for a caught request or lifecycle failure. */
198
76
  function messageOf(error) {
@@ -202,110 +80,35 @@ window.__ModuleLoader__.load({
202
80
  }
203
81
  return error instanceof Error ? error.message : String(error);
204
82
  }
205
- /** Localized fragments for the repair seed builders, read from the tab's dictionaries. */
206
- function repairCopy(t) {
207
- return {
208
- failureTitle: t("repairFailureTitle"),
209
- failurePluginLabel: t("repairFailurePluginLabel"),
210
- failureKindLabel: t("repairFailureKindLabel"),
211
- failureAtLabel: t("repairFailureAtLabel"),
212
- failureMessageLabel: t("repairFailureMessageLabel"),
213
- failureStackLabel: t("repairFailureStackLabel"),
214
- failurePathLabel: t("repairFailurePathLabel"),
215
- failureAsk: t("repairFailureAsk"),
216
- kindNames: {
217
- "load-failure": t("repairKindLoad"),
218
- hang: t("repairKindHang"),
219
- "late-rejection": t("repairKindLate")
220
- },
221
- conflictTitle: t("repairConflictTitle"),
222
- conflictPluginLabel: t("repairConflictPluginLabel"),
223
- conflictChangeLabel: t("repairConflictChangeLabel"),
224
- conflictAsk: t("repairConflictAsk"),
225
- stateNames: {
226
- enabled: t("repairStateEnabled"),
227
- disabled: t("repairStateDisabled"),
228
- uninstalled: t("repairStateUninstalled")
229
- }
230
- };
231
- }
232
83
  /** Localized label for one install phase, with percent when the download has one. */
233
84
  function progressLabel(progress, t) {
234
- if (progress.stage === "fetch") return t("fetching");
235
- if (progress.stage === "extract") return t("extracting");
236
85
  if (progress.stage === "write") return t("writing");
237
86
  return progress.percent === void 0 ? t("downloading") : t("downloadingPercent", { percent: String(progress.percent) });
238
87
  }
239
- /** The plugin-manager settings tab. */
240
- function PluginManagerTab(props) {
241
- const { t, isLoopback, list, update, checkUpdates, status, failures, setSafeMode, repairPlugin, controlsList, controlsSetEnabled, lastInstallConflicts } = props;
242
- const [view, setView] = (0, react.useState)({ status: "loading" });
88
+ /**
89
+ * The update block on one official Plugins page: one check action, the verdict
90
+ * for this page's bundle, and the update action it unlocks. The check is
91
+ * explicit rather than automatic because one check reads every installed
92
+ * plugin's registry manifest; a page visit must not fan that out.
93
+ */
94
+ function PluginUpdatePatch(props) {
95
+ const { t, subject, isLoopback, checkUpdates, update, status } = props;
96
+ const [checked, setChecked] = (0, react.useState)(false);
97
+ const [found, setFound] = (0, react.useState)(void 0);
243
98
  const [busy, setBusy] = (0, react.useState)(void 0);
244
- const [toggleBusy, setToggleBusy] = (0, react.useState)(void 0);
245
99
  const [error, setError] = (0, react.useState)(void 0);
246
- const [dirty, setDirty] = (0, react.useState)(false);
247
- const [repairing, setRepairing] = (0, react.useState)(void 0);
248
- const [copied, setCopied] = (0, react.useState)(void 0);
249
- const [updates, setUpdates] = (0, react.useState)(/* @__PURE__ */ new Map());
250
- const [conflicts, setConflicts] = (0, react.useState)([]);
251
100
  const [progress, setProgress] = (0, react.useState)({
252
101
  kind: "idle",
253
102
  stage: "fetch"
254
103
  });
255
- /** Parent rows whose aggregate child list is expanded; collapsed by default. */
256
- const [expandedChildren, setExpandedChildren] = (0, react.useState)(() => /* @__PURE__ */ new Set());
257
- /** Synchronous in-flight mirror of `busy`: the render-time guard alone lets a
258
- * click and an Enter land in the same frame and double-fire. */
104
+ const [dirty, setDirty] = (0, react.useState)(false);
105
+ /** Synchronous in-flight mirror of `busy`: the render guard alone lets a click and an Enter land in the same frame and double-fire. */
259
106
  const busyRef = (0, react.useRef)(false);
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
- */
267
- const reload = async () => {
268
- const [plugins, controls, failureSnapshot] = await Promise.all([
269
- list(),
270
- controlsList(),
271
- failures()
272
- ]);
273
- if (lastInstallConflicts !== void 0) setConflicts(lastInstallConflicts());
274
- setView({
275
- status: "ready",
276
- plugins,
277
- controls,
278
- failures: failureSnapshot
279
- });
280
- };
281
- (0, react.useEffect)(() => {
282
- let cancelled = false;
283
- reload().catch(() => {
284
- if (!cancelled) setView({ status: "error" });
285
- });
286
- return () => {
287
- cancelled = true;
288
- };
289
- }, []);
290
- /** One row/form operation: busy state, error row, dirty flag on success. */
291
- const run = async (action, body) => {
292
- if (busyRef.current) return;
293
- busyRef.current = true;
294
- setBusy(action);
295
- setError(void 0);
296
- try {
297
- await body();
298
- setDirty(true);
299
- } catch (reason) {
300
- setError(t("failed", { reason: messageOf(reason) }));
301
- } finally {
302
- busyRef.current = false;
303
- setBusy(void 0);
304
- }
305
- };
306
- /** Poll update progress while such an operation is in flight. */
107
+ const name = subject.kind === "bundle" ? subject.pkg.name : void 0;
108
+ const installed = subject.kind === "bundle" && subject.pkg.installed;
109
+ /** Poll update progress while an update is in flight. */
307
110
  (0, react.useEffect)(() => {
308
- if (busy === void 0 || busy.kind !== "update") {
111
+ if (busy !== "update") {
309
112
  setProgress({
310
113
  kind: "idle",
311
114
  stage: "fetch"
@@ -330,477 +133,108 @@ window.__ModuleLoader__.load({
330
133
  if (timer !== void 0) clearTimeout(timer);
331
134
  };
332
135
  }, [busy, status]);
333
- const toggleDisabled = busy !== void 0 || toggleBusy !== void 0 || view.status === "ready" && view.failures.safeMode;
334
- /** Expand or collapse one aggregate row's child list (pure view state). */
335
- const toggleChildren = (id) => {
336
- setExpandedChildren((current) => {
337
- const next = new Set(current);
338
- if (next.has(id)) next.delete(id);
339
- else next.add(id);
340
- return next;
341
- });
342
- };
343
- const onProductToggle = (id, enabled) => {
344
- setToggleBusy({
345
- kind: "product",
346
- id
347
- });
348
- setError(void 0);
349
- controlsSetEnabled(id, enabled).then((controls) => {
350
- setView((current) => current.status === "ready" ? {
351
- ...current,
352
- controls
353
- } : current);
354
- setConflicts((previous) => previous.filter((change) => change.id !== id));
355
- setDirty(true);
356
- setToggleBusy(void 0);
357
- }).catch((reason) => {
358
- setError(t("failed", { reason: messageOf(reason) }));
359
- setToggleBusy(void 0);
360
- });
361
- };
136
+ if (name === void 0 || !installed) return null;
362
137
  const onCheck = () => {
363
- run({ kind: "check" }, async () => {
364
- const found = await checkUpdates();
365
- setUpdates(new Map(found.map((item) => [item.id, item])));
366
- });
367
- };
368
- const onUpdate = (id) => {
369
- run({
370
- kind: "update",
371
- id
372
- }, async () => {
373
- const before = view.status === "ready" ? view.controls : await controlsList().catch(() => []);
374
- await update(id);
375
- setUpdates((previous) => {
376
- const next = new Map(previous);
377
- next.delete(id);
378
- return next;
379
- });
380
- await reload();
381
- if ((lastInstallConflicts?.() ?? []).length > 0) return;
382
- const after = await controlsList().catch(() => []);
383
- setConflicts(diffControls(before, after));
384
- });
385
- };
386
- /** Open a repair conversation seeded with one boot-failure record. `token`
387
- * identifies the row for the in-flight label (plugin id, or a row key for
388
- * unattributable failures). */
389
- const onRepair = (failure, token) => {
390
- if (view.status !== "ready" || busy !== void 0 || repairing !== void 0) return;
138
+ if (busyRef.current) return;
139
+ busyRef.current = true;
140
+ setBusy("check");
391
141
  setError(void 0);
392
- setRepairing(token);
393
- repairPlugin(view.failures.pluginRoot, failureRepairMessage(failure, repairCopy(t))).then(() => {
394
- setRepairing(void 0);
142
+ checkUpdates().then((items) => {
143
+ setFound(items.find((item) => item.id === name));
144
+ setChecked(true);
395
145
  }).catch((reason) => {
396
146
  setError(t("failed", { reason: messageOf(reason) }));
397
- setRepairing(void 0);
398
- });
399
- };
400
- /** Copy a boot failure's message and stack for a manual repair conversation. */
401
- const onCopy = (failure, token) => {
402
- navigator.clipboard.writeText(`${failure.message}\n\n${failure.stack}`).then(() => {
403
- setCopied(token);
404
- }).catch(() => {
405
- setError(t("failed", { reason: "clipboard unavailable" }));
147
+ }).finally(() => {
148
+ busyRef.current = false;
149
+ setBusy(void 0);
406
150
  });
407
151
  };
408
- const onExitSafeMode = () => {
409
- if (busy !== void 0) return;
152
+ const onUpdate = () => {
153
+ if (busyRef.current || found === void 0) return;
154
+ busyRef.current = true;
155
+ setBusy("update");
410
156
  setError(void 0);
411
- setSafeMode(false).then(() => {
157
+ update(found.id).then(() => {
158
+ setFound(void 0);
159
+ setChecked(false);
412
160
  setDirty(true);
413
- reload().catch((reason) => {
414
- setError(t("failed", { reason: messageOf(reason) }));
415
- });
416
161
  }).catch((reason) => {
417
162
  setError(t("failed", { reason: messageOf(reason) }));
163
+ }).finally(() => {
164
+ busyRef.current = false;
165
+ setBusy(void 0);
418
166
  });
419
167
  };
420
- /** Undo one conflict action by flipping the product switch back. */
421
- const onUndoConflict = (change) => {
422
- if (change.to !== "disabled") return;
423
- onProductToggle(change.id, true);
424
- };
425
- /** Hand one conflict notice off to a repair conversation over the plugin root. */
426
- const onRepairConflict = (change) => {
427
- if (view.status !== "ready" || busy !== void 0 || repairing !== void 0) return;
428
- setError(void 0);
429
- const token = `conflict:${change.id}`;
430
- setRepairing(token);
431
- repairPlugin(view.failures.pluginRoot, conflictRepairMessage({
432
- id: change.id,
433
- name: change.name,
434
- from: change.from === "enabled" || change.from === "disabled" ? change.from : "uninstalled",
435
- to: change.to === "enabled" || change.to === "disabled" ? change.to : "uninstalled"
436
- }, repairCopy(t))).then(() => {
437
- setRepairing(void 0);
438
- }).catch((reason) => {
439
- setError(t("failed", { reason: messageOf(reason) }));
440
- setRepairing(void 0);
441
- });
442
- };
443
- if (!isLoopback) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
168
+ if (!isLoopback) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
444
169
  className: plugin_manager_module_css_default.notice,
170
+ "data-update-patch": true,
171
+ "data-state": "local-only",
445
172
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("localOnlyTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("localOnlyBody") })]
446
173
  });
447
- if (view.status === "loading") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
448
- className: plugin_manager_module_css_default.state,
449
- children: t("loading")
450
- });
451
- if (view.status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
452
- className: plugin_manager_module_css_default.state,
453
- children: t("failed", { reason: "load" })
454
- });
455
- const attributable = new Map(view.failures.items.filter((item) => item.pluginId !== "").map((item) => [item.pluginId, item]));
456
- const unattributable = view.failures.items.filter((item) => item.pluginId === "");
457
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
174
+ const requiresDsh = found?.requiresDsh;
175
+ const blocked = found?.compatible === false;
176
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
458
177
  className: plugin_manager_module_css_default.section,
459
- "aria-busy": busy !== void 0 || toggleBusy !== void 0,
178
+ "data-update-patch": true,
179
+ "aria-busy": busy !== void 0,
460
180
  children: [
461
- view.failures.safeMode && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
462
- className: plugin_manager_module_css_default.safeModeBanner,
463
- "data-safe-mode": true,
464
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("safeModeBanner") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
465
- variant: "primary",
466
- disabled: busy !== void 0,
467
- onClick: onExitSafeMode,
468
- children: t("exitSafeMode")
469
- })]
181
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
182
+ className: plugin_manager_module_css_default.title,
183
+ children: t("updateSection")
470
184
  }),
471
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
472
- className: plugin_manager_module_css_default.hint,
473
- "data-manage-elsewhere": true,
474
- children: t("manageElsewhere")
185
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
186
+ className: plugin_manager_module_css_default.actionRow,
187
+ children: [
188
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
189
+ type: "button",
190
+ className: plugin_manager_module_css_default.button,
191
+ disabled: busy !== void 0,
192
+ onClick: onCheck,
193
+ children: busy === "check" ? t("checking") : t("checkUpdates")
194
+ }),
195
+ checked && found === void 0 && busy === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
196
+ className: plugin_manager_module_css_default.ok,
197
+ children: t("noUpdates")
198
+ }),
199
+ found !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
200
+ className: plugin_manager_module_css_default.latest,
201
+ "data-update-latest": found.latest,
202
+ children: t("latest", { version: found.latest })
203
+ }),
204
+ found !== void 0 && requiresDsh !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
205
+ className: blocked ? plugin_manager_module_css_default.compatBlocked : plugin_manager_module_css_default.compatHint,
206
+ "data-update-compat": blocked ? "blocked" : "ok",
207
+ children: blocked ? t("updateBlockedDsh", { min: displayMinimumVersion(requiresDsh) }) : t("updateRequiresDsh", { min: displayMinimumVersion(requiresDsh) })
208
+ }),
209
+ found !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
210
+ type: "button",
211
+ className: `${plugin_manager_module_css_default.button} ${plugin_manager_module_css_default.primary}`,
212
+ disabled: busy !== void 0 || blocked,
213
+ onClick: onUpdate,
214
+ children: busy === "update" ? t("updating") : t("update")
215
+ })
216
+ ]
475
217
  }),
476
- busy?.kind === "update" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
218
+ busy === "update" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
477
219
  className: plugin_manager_module_css_default.progressRow,
478
220
  role: "status",
479
221
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
480
222
  className: plugin_manager_module_css_default.progressTrack,
481
223
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
482
224
  className: plugin_manager_module_css_default.progressBar,
483
- style: progress.percent === void 0 ? void 0 : { width: `${progress.percent}%` },
225
+ style: progress.percent === void 0 ? void 0 : { width: `${String(progress.percent)}%` },
484
226
  "data-indeterminate": progress.percent === void 0 ? "true" : void 0
485
227
  })
486
228
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
487
- className: plugin_manager_module_css_default.progressLabel,
229
+ className: plugin_manager_module_css_default.hint,
488
230
  children: progressLabel(progress, t)
489
231
  })]
490
232
  }),
491
- error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
492
- className: plugin_manager_module_css_default.errorRow,
493
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
494
- className: plugin_manager_module_css_default.error,
495
- children: error
496
- })
497
- }),
498
- conflicts.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
499
- className: plugin_manager_module_css_default.conflicts,
500
- children: [
501
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
502
- className: plugin_manager_module_css_default.sectionTitle,
503
- children: t("conflictTitle")
504
- }),
505
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
506
- className: plugin_manager_module_css_default.list,
507
- children: conflicts.map((change) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
508
- className: plugin_manager_module_css_default.row,
509
- "data-conflict": change.id,
510
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
511
- className: plugin_manager_module_css_default.meta,
512
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
513
- className: plugin_manager_module_css_default.name,
514
- children: change.name
515
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
516
- className: plugin_manager_module_css_default.sub,
517
- children: classifyChange(change) === "rule-disabled" ? t("conflictDisabled", { name: change.name }) : classifyChange(change) === "rule-enabled" ? t("conflictEnabled", { name: change.name }) : t("conflictChanged", { name: change.name })
518
- })]
519
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
520
- className: plugin_manager_module_css_default.actions,
521
- children: [change.to === "disabled" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
522
- variant: "outline",
523
- disabled: toggleDisabled,
524
- onClick: () => {
525
- onUndoConflict(change);
526
- },
527
- children: t("undoConflict")
528
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
529
- variant: "outline",
530
- disabled: busy !== void 0 || repairing !== void 0,
531
- onClick: () => {
532
- onRepairConflict(change);
533
- },
534
- children: repairing === `conflict:${change.id}` ? t("repairing") : t("repair")
535
- })]
536
- })]
537
- }, change.id))
538
- }),
539
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
540
- className: plugin_manager_module_css_default.hint,
541
- children: t("conflictHint")
542
- })
543
- ]
544
- }),
545
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
546
- className: plugin_manager_module_css_default.group,
547
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
548
- className: plugin_manager_module_css_default.sectionTitle,
549
- children: t("userPlugins")
550
- }), view.plugins.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
551
- className: plugin_manager_module_css_default.empty,
552
- children: t("empty")
553
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
554
- className: plugin_manager_module_css_default.list,
555
- children: view.plugins.map((plugin) => {
556
- const updateItem = updates.get(plugin.id);
557
- const latest = updateItem?.latest;
558
- const dshRequirement = updateItem?.requiresDsh;
559
- const failure = attributable.get(plugin.id);
560
- const children = plugin.children;
561
- const mixed = children !== void 0 && !plugin.enabled && children.some((child) => child.enabled);
562
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
563
- "data-plugin-id": plugin.id,
564
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
565
- className: plugin_manager_module_css_default.row,
566
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
567
- className: plugin_manager_module_css_default.meta,
568
- children: [
569
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
570
- className: plugin_manager_module_css_default.name,
571
- children: plugin.name
572
- }),
573
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
574
- className: plugin_manager_module_css_default.sub,
575
- children: [
576
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
577
- className: plugin_manager_module_css_default.version,
578
- children: t("version", { version: plugin.version })
579
- }),
580
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
581
- className: plugin_manager_module_css_default.sourceBadge,
582
- "data-source": plugin.source.kind,
583
- children: plugin.source.kind === "npm" ? t("npmSource") : t("gitSource")
584
- }),
585
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
586
- className: plugin_manager_module_css_default.specText,
587
- title: plugin.source.spec,
588
- children: plugin.source.spec
589
- })
590
- ]
591
- }),
592
- latest !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
593
- className: plugin_manager_module_css_default.latest,
594
- children: t("latest", { version: latest })
595
- }),
596
- updateItem !== void 0 && dshRequirement !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
597
- className: updateItem.compatible === false ? plugin_manager_module_css_default.compatBlocked : plugin_manager_module_css_default.compatHint,
598
- children: updateItem.compatible === false ? t("updateBlockedDsh", { min: displayMinimumVersion(dshRequirement) }) : t("updateRequiresDsh", { min: displayMinimumVersion(dshRequirement) })
599
- }),
600
- failure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
601
- className: plugin_manager_module_css_default.failure,
602
- "data-plugin-failure": plugin.id,
603
- children: [
604
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
605
- className: plugin_manager_module_css_default.badge,
606
- children: t("failureBadge")
607
- }),
608
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
609
- className: plugin_manager_module_css_default.failureMessage,
610
- title: failure.message,
611
- children: failure.message
612
- }),
613
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
614
- className: plugin_manager_module_css_default.failureActions,
615
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
616
- variant: "primary",
617
- disabled: busy !== void 0 || repairing !== void 0,
618
- onClick: () => {
619
- onRepair(failure, plugin.id);
620
- },
621
- children: repairing === plugin.id ? t("repairing") : t("repair")
622
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
623
- variant: "outline",
624
- disabled: busy !== void 0,
625
- onClick: () => {
626
- onCopy(failure, plugin.id);
627
- },
628
- children: copied === plugin.id ? t("copied") : t("copyError")
629
- })]
630
- })
631
- ]
632
- })
633
- ]
634
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
635
- className: plugin_manager_module_css_default.actions,
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
- })]
648
- })]
649
- }), children !== void 0 && children.length > 0 && (() => {
650
- const listId = "pm-children-" + plugin.id.replace(/[^a-zA-Z0-9_-]/g, "-");
651
- const expanded = expandedChildren.has(plugin.id);
652
- const enabledCount = children.filter((child) => child.enabled).length;
653
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
654
- type: "button",
655
- className: plugin_manager_module_css_default.childrenToggle,
656
- "aria-expanded": expanded,
657
- "aria-controls": listId,
658
- "aria-label": expanded ? t("childrenHide", { name: plugin.name }) : t("childrenShow", { name: plugin.name }),
659
- onClick: () => {
660
- toggleChildren(plugin.id);
661
- },
662
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
663
- className: plugin_manager_module_css_default.chevron,
664
- "data-expanded": expanded,
665
- "aria-hidden": "true"
666
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
667
- className: plugin_manager_module_css_default.childrenSummary,
668
- children: t("childrenSummary", {
669
- enabled: enabledCount,
670
- total: children.length
671
- })
672
- })]
673
- }), expanded && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
674
- id: listId,
675
- className: plugin_manager_module_css_default.childList,
676
- children: children.map((child) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
677
- className: plugin_manager_module_css_default.childRow,
678
- "data-plugin-row": child.id,
679
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
680
- className: plugin_manager_module_css_default.childName,
681
- title: child.id,
682
- children: child.name
683
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
684
- className: plugin_manager_module_css_default.actions,
685
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
686
- className: plugin_manager_module_css_default.stateLabel,
687
- "data-state": child.enabled ? "enabled" : "disabled",
688
- children: child.enabled ? t("enabled") : t("disabled")
689
- }), child.locked === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
690
- className: plugin_manager_module_css_default.lockedHint,
691
- children: t("lockedRowHint")
692
- }) : null]
693
- })]
694
- }, child.id))
695
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
696
- className: plugin_manager_module_css_default.hint,
697
- children: t("childrenHint")
698
- })] })] });
699
- })()]
700
- }, plugin.id);
701
- })
702
- })]
703
- }),
704
- view.controls.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
705
- className: plugin_manager_module_css_default.group,
706
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
707
- className: plugin_manager_module_css_default.sectionTitle,
708
- children: t("products")
709
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
710
- className: plugin_manager_module_css_default.list,
711
- children: view.controls.map((control) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
712
- className: plugin_manager_module_css_default.row,
713
- "data-product-id": control.id,
714
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
715
- className: plugin_manager_module_css_default.meta,
716
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
717
- className: plugin_manager_module_css_default.name,
718
- children: control.name
719
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
720
- className: plugin_manager_module_css_default.sub,
721
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
722
- className: plugin_manager_module_css_default.link,
723
- href: control.repository,
724
- target: "_blank",
725
- rel: "noreferrer",
726
- children: t("source")
727
- })
728
- })]
729
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
730
- className: plugin_manager_module_css_default.actions,
731
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
732
- className: plugin_manager_module_css_default.stateLabel,
733
- "data-state": control.state,
734
- children: t(control.state)
735
- })
736
- })]
737
- }, control.id))
738
- })]
739
- }),
740
- unattributable.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
741
- className: plugin_manager_module_css_default.group,
742
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
743
- className: plugin_manager_module_css_default.sectionTitle,
744
- children: t("failureGroupTitle")
745
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
746
- className: plugin_manager_module_css_default.list,
747
- children: unattributable.map((failure, index) => {
748
- const token = `other:${index}`;
749
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
750
- className: plugin_manager_module_css_default.row,
751
- "data-plugin-failure": "other",
752
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
753
- className: plugin_manager_module_css_default.meta,
754
- children: [
755
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
756
- className: plugin_manager_module_css_default.badge,
757
- children: t("failureBadge")
758
- }),
759
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
760
- className: plugin_manager_module_css_default.failureMessage,
761
- title: failure.message,
762
- children: failure.message
763
- }),
764
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
765
- className: plugin_manager_module_css_default.failureActions,
766
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
767
- variant: "primary",
768
- disabled: busy !== void 0 || repairing !== void 0,
769
- onClick: () => {
770
- onRepair(failure, token);
771
- },
772
- children: repairing === token ? t("repairing") : t("repair")
773
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
774
- variant: "outline",
775
- disabled: busy !== void 0,
776
- onClick: () => {
777
- onCopy(failure, token);
778
- },
779
- children: copied === token ? t("copied") : t("copyError")
780
- })]
781
- })
782
- ]
783
- })
784
- }, `${failure.at}-${index}`);
785
- })
786
- })]
787
- }),
788
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
789
- className: plugin_manager_module_css_default.actionsRow,
790
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
791
- variant: "outline",
792
- disabled: busy !== void 0,
793
- onClick: onCheck,
794
- children: busy?.kind === "check" ? t("checking") : t("checkUpdates")
795
- }), updates.size === 0 && busy === void 0 && view.plugins.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
796
- className: plugin_manager_module_css_default.ok,
797
- children: t("noUpdates")
798
- })]
799
- }),
800
- toggleBusy !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
801
- className: plugin_manager_module_css_default.applying,
802
- "aria-live": "polite",
803
- children: t("applying")
233
+ error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
234
+ className: plugin_manager_module_css_default.error,
235
+ role: "alert",
236
+ "data-update-error": true,
237
+ children: error
804
238
  }),
805
239
  dirty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
806
240
  className: plugin_manager_module_css_default.restartRow,
@@ -812,155 +246,56 @@ window.__ModuleLoader__.load({
812
246
  //#endregion
813
247
  //#region src/client/locales.ts
814
248
  /**
815
- * Locale dictionaries for the plugin-manager tab. The zh dictionary is the
816
- * key source; the en dictionary mirrors the exact key set.
249
+ * Locale dictionaries for the plugin-manager's official-page patch. The zh
250
+ * dictionary is the key source; the en dictionary mirrors the exact key set.
251
+ *
252
+ * The key set covers only what this package still renders: the
253
+ * check-for-updates block on a bundle's page in the official Plugins panel.
254
+ * The former tab's keys (inventory, conflicts, repair seeds, safe mode,
255
+ * aggregate children) left with that tab.
817
256
  * @module @linxin666/dsh-client-ui-plugin-manager/client
818
257
  */
819
258
  /** Simplified Chinese copy (the key-set source of truth). */
820
259
  const STATIC_ZH = {
821
- tab: "插件管理",
822
- manageElsewhere: "安装、卸载与启停已由官方插件管理页负责(侧边栏「插件」);这里保留更新检查、安装冲突与启动失败修复。",
823
- loading: "正在读取插件…",
824
- empty: "尚未安装任何用户插件。",
825
- userPlugins: "用户插件",
826
- products: "内置产品",
827
- conflictTitle: "安装冲突",
828
- conflictDisabled: "已自动禁用 {name},避免重复挂载。",
829
- conflictEnabled: "已重新启用 {name}。",
830
- conflictChanged: "{name} 的状态已变更。",
831
- undoConflict: "撤销",
832
- conflictHint: "冲突动作在安装时自动执行,撤销会写回开关并在重启后生效。",
833
- version: "已安装 {version}",
834
- latest: "最新 {version}",
835
- update: "更新",
836
- updating: "更新中…",
837
- checkUpdates: "检查更新",
838
- checking: "检查中…",
839
- noUpdates: "所有插件都是最新版本。",
840
- updateRequiresDsh: "需要 DSH ≥ {min}",
841
- updateBlockedDsh: "需要 DSH ≥ {min},请先升级 DSH 再更新",
842
- restartHint: "插件变更将在重启应用后生效。",
843
- failed: "操作失败:{reason}",
844
- enabled: "已开启",
845
- disabled: "已关闭",
846
- mixed: "部分开启",
847
- unavailable: "不可用",
848
- uninstalled: "已卸载",
849
- source: "查看源码",
850
- applying: "正在应用更改…",
851
- fetching: "正在获取插件信息…",
852
- downloading: "正在下载…",
853
- downloadingPercent: "正在下载 {percent}%",
854
- extracting: "正在解压…",
855
- writing: "正在写入配置…",
856
- localOnlyTitle: "仅限本机操作",
857
- localOnlyBody: "为了保护主机配置,插件管理只能从本机打开。",
858
- failureBadge: "启动失败",
859
- failureGroupTitle: "其他启动失败",
860
- repair: "让 Agent 修复",
861
- repairing: "正在创建修复对话…",
862
- copyError: "复制错误",
863
- copied: "已复制",
864
- safeModeBanner: "安全模式:用户插件配置已跳过,插件开关不可用。",
865
- exitSafeMode: "恢复正常模式并重启",
866
- npmSource: "npm",
867
- gitSource: "git",
868
- lockedRowHint: "核心行",
869
- childrenHint: "子插件的启停在官方插件管理页操作;停用后不再加载,代码仍随全家桶更新。",
870
- childrenSummary: "子插件 {enabled}/{total} 已启用",
871
- childrenShow: "展开 {name} 的子插件",
872
- childrenHide: "收起 {name} 的子插件",
873
- repairFailureTitle: "插件上次启动失败。请修复它。",
874
- repairFailurePluginLabel: "插件",
875
- repairFailureKindLabel: "失败类型",
876
- repairFailureAtLabel: "时间",
877
- repairFailureMessageLabel: "失败详情",
878
- repairFailureStackLabel: "原始堆栈",
879
- repairFailurePathLabel: "插件安装目录",
880
- repairFailureAsk: "请检查并修复该插件;修复完成后告诉我如何重新启用。",
881
- repairKindLoad: "加载失败",
882
- repairKindHang: "启动挂起",
883
- repairKindLate: "迟到拒绝",
884
- repairConflictTitle: "正在处理插件安装冲突",
885
- repairConflictPluginLabel: "冲突条目",
886
- repairConflictChangeLabel: "状态变化",
887
- repairConflictAsk: "请检查冲突双方的入口行 id 与挂载方式,消除重复挂载后告诉我如何重新启用。",
888
- repairStateEnabled: "已开启",
889
- repairStateDisabled: "已关闭",
890
- repairStateUninstalled: "已卸载"
260
+ "updateSection": "更新",
261
+ "checkUpdates": "检查更新",
262
+ "checking": "检查中…",
263
+ "noUpdates": "已是最新版本。",
264
+ "update": "更新",
265
+ "updating": "更新中…",
266
+ "latest": "最新 {version}",
267
+ "updateRequiresDsh": "需要 DSH ≥ {min}",
268
+ "updateBlockedDsh": "需要 DSH ≥ {min},请先升级 DSH 再更新",
269
+ "restartHint": "插件变更将在重启应用后生效。",
270
+ "failed": "操作失败:{reason}",
271
+ "fetching": "正在获取插件信息…",
272
+ "downloading": "正在下载…",
273
+ "downloadingPercent": "正在下载 {percent}%",
274
+ "extracting": "正在解压…",
275
+ "writing": "正在写入配置…",
276
+ "localOnlyTitle": "仅限本机操作",
277
+ "localOnlyBody": "为了保护主机配置,插件管理只能从本机打开。"
891
278
  };
892
279
  /** English copy, checked complete against the zh key set. */
893
280
  const STATIC_EN = {
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.",
896
- loading: "Reading plugins…",
897
- empty: "No user plugins installed yet.",
898
- userPlugins: "User plugins",
899
- products: "Built-in products",
900
- conflictTitle: "Install conflicts",
901
- conflictDisabled: "Automatically disabled {name} to avoid double mounting.",
902
- conflictEnabled: "Re-enabled {name}.",
903
- conflictChanged: "The state of {name} changed.",
904
- undoConflict: "Undo",
905
- conflictHint: "Conflict actions run automatically at install time; undoing writes the switch back and applies after a restart.",
906
- version: "Installed {version}",
907
- latest: "Latest {version}",
908
- update: "Update",
909
- updating: "Updating…",
910
- checkUpdates: "Check for updates",
911
- checking: "Checking…",
912
- noUpdates: "All plugins are up to date.",
913
- updateRequiresDsh: "Requires DSH >= {min}",
914
- updateBlockedDsh: "Requires DSH >= {min}; upgrade DSH before updating",
915
- restartHint: "Plugin changes take effect after restarting the application.",
916
- failed: "Operation failed: {reason}",
917
- enabled: "On",
918
- disabled: "Off",
919
- mixed: "Partially on",
920
- unavailable: "Unavailable",
921
- uninstalled: "Uninstalled",
922
- source: "View source",
923
- applying: "Applying change…",
924
- fetching: "Fetching plugin metadata…",
925
- downloading: "Downloading…",
926
- downloadingPercent: "Downloading {percent}%",
927
- extracting: "Extracting…",
928
- writing: "Writing configuration…",
929
- localOnlyTitle: "Available on this computer only",
930
- localOnlyBody: "To protect host configuration, plugin management is only available from a local browser.",
931
- failureBadge: "Startup failure",
932
- failureGroupTitle: "Other startup failures",
933
- repair: "Ask the agent to fix",
934
- repairing: "Opening repair conversation…",
935
- copyError: "Copy error",
936
- copied: "Copied",
937
- safeModeBanner: "Safe mode: user plugin configuration is skipped; plugin switches are disabled.",
938
- exitSafeMode: "Restore normal mode and restart",
939
- npmSource: "npm",
940
- gitSource: "git",
941
- lockedRowHint: "Core row",
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.",
943
- childrenSummary: "{enabled}/{total} child plugins on",
944
- childrenShow: "Show child plugins of {name}",
945
- childrenHide: "Hide child plugins of {name}",
946
- repairFailureTitle: "A plugin failed to start last time. Please fix it.",
947
- repairFailurePluginLabel: "Plugin",
948
- repairFailureKindLabel: "Failure kind",
949
- repairFailureAtLabel: "At",
950
- repairFailureMessageLabel: "Failure details",
951
- repairFailureStackLabel: "Original stack",
952
- repairFailurePathLabel: "Plugin install directory",
953
- repairFailureAsk: "Please inspect and fix the plugin; tell me how to re-enable it afterwards.",
954
- repairKindLoad: "Load failure",
955
- repairKindHang: "Startup hang",
956
- repairKindLate: "Late rejection",
957
- repairConflictTitle: "Handling a plugin install conflict",
958
- repairConflictPluginLabel: "Conflicting entry",
959
- repairConflictChangeLabel: "State change",
960
- repairConflictAsk: "Inspect the entry ids and mounting of both sides, resolve the double mount, and tell me how to re-enable.",
961
- repairStateEnabled: "On",
962
- repairStateDisabled: "Off",
963
- repairStateUninstalled: "Uninstalled"
281
+ "updateSection": "Update",
282
+ "checkUpdates": "Check for updates",
283
+ "checking": "Checking…",
284
+ "noUpdates": "The installed version is the latest.",
285
+ "update": "Update",
286
+ "updating": "Updating…",
287
+ "latest": "Latest {version}",
288
+ "updateRequiresDsh": "Requires DSH >= {min}",
289
+ "updateBlockedDsh": "Requires DSH >= {min}; upgrade DSH before updating",
290
+ "restartHint": "Plugin changes take effect after restarting the application.",
291
+ "failed": "Operation failed: {reason}",
292
+ "fetching": "Fetching plugin metadata…",
293
+ "downloading": "Downloading…",
294
+ "downloadingPercent": "Downloading {percent}%",
295
+ "extracting": "Extracting…",
296
+ "writing": "Writing configuration…",
297
+ "localOnlyTitle": "Available on this computer only",
298
+ "localOnlyBody": "To protect host configuration, plugin management is only available from a local browser."
964
299
  };
965
300
  const zh = STATIC_ZH;
966
301
  const en = STATIC_EN;
@@ -1022,23 +357,6 @@ window.__ModuleLoader__.load({
1022
357
  return parsePlugin(value.plugin, 0);
1023
358
  }
1024
359
  /**
1025
- * Validate and normalize a plugin-control `list` / `set-enabled` response value.
1026
- * @param value - decoded but untrusted response value.
1027
- * @returns the typed control items.
1028
- */
1029
- function parsePluginControlSnapshot(value) {
1030
- if (!isRecord(value) || !Array.isArray(value.controls)) throw new Error("plugin-manager: response must contain a controls array");
1031
- return value.controls.map((control, index) => {
1032
- if (!isRecord(control) || !isString(control.id) || !isString(control.name) || !isString(control.repository) || control.state !== "enabled" && control.state !== "disabled" && control.state !== "mixed" && control.state !== "unavailable" && control.state !== "uninstalled") throw new Error(`plugin-manager: control row ${String(index)} is invalid`);
1033
- return {
1034
- id: control.id,
1035
- name: control.name,
1036
- repository: control.repository,
1037
- state: control.state
1038
- };
1039
- });
1040
- }
1041
- /**
1042
360
  * Validate and normalize a `status` response value.
1043
361
  * @param value - decoded but untrusted response value.
1044
362
  * @returns the typed progress state.
@@ -1119,7 +437,7 @@ window.__ModuleLoader__.load({
1119
437
  /** The building package's version, when the bundle carries it. */
1120
438
  function bakedVersion() {
1121
439
  try {
1122
- return "0.4.2";
440
+ return "0.4.3";
1123
441
  } catch {
1124
442
  return;
1125
443
  }
@@ -1185,7 +503,6 @@ window.__ModuleLoader__.load({
1185
503
  //#region src/client/index.ts
1186
504
  const NS = "settings.pluginManager";
1187
505
  const CHANNEL = "/plugin-installer";
1188
- const CONTROL_CHANNEL = "/plugin-control";
1189
506
  const LIST_ENDPOINT = "list";
1190
507
  const INSTALL_ENDPOINT = "install";
1191
508
  const UPDATE_ENDPOINT = "update";
@@ -1194,28 +511,24 @@ window.__ModuleLoader__.load({
1194
511
  const CHECK_UPDATES_ENDPOINT = "check-updates";
1195
512
  const STATUS_ENDPOINT = "status";
1196
513
  const FAILURES_ENDPOINT = "failures";
1197
- const SET_SAFE_MODE_ENDPOINT = "set-safe-mode";
1198
514
  const GATEWAY_PREFIX = "api/plugin-manager";
1199
515
  /** Gateway job polling cadence. */
1200
516
  const JOB_POLL_MS = 500;
1201
517
  /** Gateway job wait ceiling (the host add deadline is six minutes). */
1202
518
  const JOB_WAIT_MS = 7 * 6e4;
1203
- /** Services required by the slot registration and both channels. */
519
+ /** Services required by the patch registration and both channels. */
1204
520
  const inject = [
1205
521
  "slots",
1206
522
  "locale",
1207
- "connection",
1208
- "workspaces",
1209
- "sessions",
1210
- "uiWorkspace"
523
+ "connection"
1211
524
  ];
1212
525
  /**
1213
526
  * Build the dual-channel face once: official-channel and gateway-channel
1214
- * implementations, the mode detection that picks between them, the repair
1215
- * handoff, and the change-notification listener set. The returned face is
1216
- * both the tab's injected props and the value provided as the
527
+ * implementations, the mode detection that picks between them, and the
528
+ * change-notification listener set. The returned face is both the update
529
+ * patch's injected props and the value provided as the
1217
530
  * `'pluginManager'` cordis service.
1218
- * @param ctx - the client context (connection, workspaces, sessions).
531
+ * @param ctx - the client context (connection).
1219
532
  * @returns the shared face.
1220
533
  */
1221
534
  function createPluginManagerFace(ctx) {
@@ -1236,21 +549,7 @@ window.__ModuleLoader__.load({
1236
549
  })),
1237
550
  checkUpdates: async () => parseUpdateList(await call(CHECK_UPDATES_ENDPOINT, {})),
1238
551
  status: async () => parseInstallStatus(await call(STATUS_ENDPOINT, {})),
1239
- failures: async () => parseFailuresSnapshot(await call(FAILURES_ENDPOINT, {})),
1240
- setSafeMode: async (enabled) => {
1241
- await call(SET_SAFE_MODE_ENDPOINT, { enabled });
1242
- },
1243
- controlsList: async () => parsePluginControlSnapshot(await connection.rpc.call(CONTROL_CHANNEL, "list", {}).then((result) => {
1244
- if (!result.ok) throw new Error(`plugin-control list failed: ${result.error.code}: ${result.error.message}`);
1245
- return result.value;
1246
- })),
1247
- controlsSetEnabled: async (pluginId, enabled) => parsePluginControlSnapshot(await connection.rpc.call(CONTROL_CHANNEL, "set-enabled", {
1248
- pluginId,
1249
- enabled
1250
- }).then((result) => {
1251
- if (!result.ok) throw new Error(`plugin-control set-enabled failed: ${result.error.code}: ${result.error.message}`);
1252
- return result.value;
1253
- }))
552
+ failures: async () => parseFailuresSnapshot(await call(FAILURES_ENDPOINT, {}))
1254
553
  };
1255
554
  const gatewayJson = async (path, init) => {
1256
555
  const response = await fetch(path, {
@@ -1281,8 +580,6 @@ window.__ModuleLoader__.load({
1281
580
  });
1282
581
  }
1283
582
  };
1284
- /** The conflict ledger of the last settled gateway install. */
1285
- let lastInstallConflicts = [];
1286
583
  /** Whether a gateway install/remove is in flight (drives the progress row). */
1287
584
  let gatewayInflight = false;
1288
585
  const gateway = {
@@ -1295,9 +592,7 @@ window.__ModuleLoader__.load({
1295
592
  body: JSON.stringify({ spec })
1296
593
  });
1297
594
  if (started.jobId === void 0) throw new Error("plugin-manager: gateway install returned no job");
1298
- const job = await waitJob(started.jobId);
1299
- lastInstallConflicts = Array.isArray(job.conflicts) ? job.conflicts : [];
1300
- return parseInstalledPlugin({ plugin: job.plugin });
595
+ return parseInstalledPlugin({ plugin: (await waitJob(started.jobId)).plugin });
1301
596
  } finally {
1302
597
  gatewayInflight = false;
1303
598
  }
@@ -1310,9 +605,7 @@ window.__ModuleLoader__.load({
1310
605
  body: JSON.stringify({ id })
1311
606
  });
1312
607
  if (started.jobId === void 0) throw new Error("plugin-manager: gateway update returned no job");
1313
- const job = await waitJob(started.jobId);
1314
- lastInstallConflicts = Array.isArray(job.conflicts) ? job.conflicts : [];
1315
- return parseInstalledPlugin({ plugin: job.plugin });
608
+ return parseInstalledPlugin({ plugin: (await waitJob(started.jobId)).plugin });
1316
609
  } finally {
1317
610
  gatewayInflight = false;
1318
611
  }
@@ -1346,15 +639,7 @@ window.__ModuleLoader__.load({
1346
639
  kind: "idle",
1347
640
  stage: "fetch"
1348
641
  },
1349
- failures: async () => parseFailuresSnapshot(await gatewayJson(`${GATEWAY_PREFIX}/failures`)),
1350
- setSafeMode: async () => {
1351
- throw new Error("plugin-manager: safe mode is unavailable in this runtime");
1352
- },
1353
- controlsList: async () => [],
1354
- controlsSetEnabled: async (pluginId, enabled) => {
1355
- await gateway.setEnabled(pluginId, enabled);
1356
- return [];
1357
- }
642
+ failures: async () => parseFailuresSnapshot(await gatewayJson(`${GATEWAY_PREFIX}/failures`))
1358
643
  };
1359
644
  let modePromise;
1360
645
  const ensureMode = () => {
@@ -1372,28 +657,6 @@ window.__ModuleLoader__.load({
1372
657
  })();
1373
658
  return modePromise;
1374
659
  };
1375
- /**
1376
- * Start a repair conversation for a failed plugin: resolve a workspace over
1377
- * the plugin install root (created once, reused after), open a fresh
1378
- * session there, and seed its first prompt with the failure details. The
1379
- * session's workspace is the plugin home so the agent's file tools reach
1380
- * the plugin code without leaving the workspace boundary.
1381
- * @param pluginRoot - absolute plugin install root.
1382
- * @param message - the seeded first user message.
1383
- * @returns resolution after the prompt is accepted and the session opens.
1384
- */
1385
- const repairPlugin = async (pluginRoot, message) => {
1386
- const workspace = await ctx.workspaces.create({ path: pluginRoot });
1387
- const sessionId = await ctx.sessions.create({ workspaceId: workspace.workspaceId });
1388
- const binding = ctx.sessions.binding(sessionId);
1389
- if (binding === void 0) throw new Error(`plugin-manager: repair session ${sessionId} is unavailable`);
1390
- const result = await binding.session.prompt([{
1391
- type: "text",
1392
- text: message
1393
- }], "queue");
1394
- if (!result.ok) throw new Error(`plugin-manager: repair prompt failed: ${result.error.code}: ${result.error.message}`);
1395
- ctx.uiWorkspace.openSession(sessionId);
1396
- };
1397
660
  /** Listeners subscribed through onChange; fired after successful mutations. */
1398
661
  const listeners = /* @__PURE__ */ new Set();
1399
662
  /** Notify every listener; one listener throwing never breaks the others. */
@@ -1428,11 +691,6 @@ window.__ModuleLoader__.load({
1428
691
  checkUpdates: async () => await ensureMode() === "official" ? official.checkUpdates() : gateway.checkUpdates(),
1429
692
  status: async () => await ensureMode() === "official" ? official.status() : gateway.status(),
1430
693
  failures: async () => await ensureMode() === "official" ? official.failures() : gateway.failures(),
1431
- setSafeMode: async (enabled) => await ensureMode() === "official" ? official.setSafeMode(enabled) : gateway.setSafeMode(),
1432
- repairPlugin,
1433
- controlsList: async () => await ensureMode() === "official" ? official.controlsList() : gateway.controlsList(),
1434
- controlsSetEnabled: async (id, enabled) => await ensureMode() === "official" ? official.controlsSetEnabled(id, enabled) : gateway.controlsSetEnabled(id, enabled),
1435
- lastInstallConflicts: () => lastInstallConflicts,
1436
694
  onChange: (cb) => {
1437
695
  listeners.add(cb);
1438
696
  return () => {
@@ -1441,7 +699,7 @@ window.__ModuleLoader__.load({
1441
699
  }
1442
700
  };
1443
701
  }
1444
- /** Contribute the family plugin-manager tab and provide the shared face. */
702
+ /** Contribute the check-for-updates patch and provide the shared face. */
1445
703
  function apply(ctx) {
1446
704
  reportDailyHeartbeat([{ name: "@linxin666/dsh-client-ui-plugin-manager" }]);
1447
705
  ctx.effect(() => {
@@ -1458,16 +716,15 @@ window.__ModuleLoader__.load({
1458
716
  try {
1459
717
  if (!ctx.get("pluginManager")) ctx.provide(PLUGIN_MANAGER_SERVICE, face);
1460
718
  } catch {}
1461
- ctx.slots.inject("settings.plugins.tab", () => {
719
+ ctx.slots.inject("plugins.detail.section", () => {
1462
720
  try {
1463
721
  return ctx.slots.register({
1464
- name: "settings.plugins.tab",
1465
- id: "family-plugins",
1466
- order: 20,
1467
- label: () => ctx.locale.bind(NS)("tab"),
722
+ name: "plugins.detail.section",
723
+ id: "family-update-check",
724
+ order: 30,
1468
725
  locale: NS,
1469
726
  inject: () => face
1470
- }, PluginManagerTab);
727
+ }, PluginUpdatePatch);
1471
728
  } catch {
1472
729
  return () => {};
1473
730
  }