@linxin666/dsh-client-ui-plugin-manager 0.4.12 → 0.4.13

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
@@ -7,6 +7,7 @@ window.__ModuleLoader__.load({
7
7
  let react = require("react");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
9
  let react_dom_client = require("react-dom/client");
10
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
10
11
  //#region src/core/version.ts
11
12
  const MINIMUM_RANGE_PATTERN = /^>=\s*(v?\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;
12
13
  /**
@@ -25,7 +26,7 @@ window.__ModuleLoader__.load({
25
26
  }
26
27
  //#endregion
27
28
  //#region \0dsh-css:packages/dsh-plugin-manager/src/client/plugin-manager.module.css.mjs
28
- 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}.ZsMDKq_mount{align-self:center;margin-left:auto;position:relative}.ZsMDKq_toolbar{color:var(--dsw-alias-label-primary);align-items:center;gap:8px;font-size:12.5px;line-height:18px;display:flex;position:relative}.ZsMDKq_toolbarButton{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:3px 10px}.ZsMDKq_toolbarButton:hover:enabled{background:var(--dsw-alias-interactive-bg-hover)}.ZsMDKq_toolbarButton:disabled{cursor:default;opacity:.55}.ZsMDKq_toolbarButton:focus-visible,.ZsMDKq_toolbarSummary: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_toolbarSummary{font:inherit;cursor:pointer;color:var(--dsw-alias-label-secondary);background:0 0;border:0;padding:3px 2px}.ZsMDKq_toolbarSummary:hover{color:var(--dsw-alias-label-primary)}.ZsMDKq_toolbarHint{max-width:320px;color:var(--dsw-alias-label-tertiary)}.ZsMDKq_panel{z-index:40;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);width:max-content;min-width:260px;max-width:min(440px,60vw);max-height:320px;box-shadow:var(--dsw-shadow-lv3,0 8px 24px #00000024);text-align:left;border-radius:10px;flex-direction:column;gap:8px;padding:12px;display:flex;position:absolute;top:calc(100% + 6px);right:0;overflow:auto}.ZsMDKq_panelActions{justify-content:flex-end;gap:8px;display:flex}.ZsMDKq_panelList{flex-direction:column;gap:6px;margin:0;padding:0;list-style:none;display:flex}.ZsMDKq_panelRow{flex-wrap:wrap;align-items:baseline;gap:6px;display:flex}.ZsMDKq_panelName{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);word-break:break-all;font-size:12px}.ZsMDKq_panelVersion{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:12px}.ZsMDKq_restartRequired{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.ZsMDKq_restartRequiredLine{color:var(--dsw-alias-label-secondary);font-size:12px}";
29
+ 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{transform-origin:0;width:100%;height:100%;transform:scaleX(var(--plugin-manager-progress,0));background:var(--dsw-alias-state-business-primary);transition:transform .2s}.ZsMDKq_progressBar[data-indeterminate=true]{width:40%;animation:1.2s ease-in-out infinite ZsMDKq_pluginManagerIndeterminate;transform:none}@keyframes ZsMDKq_pluginManagerIndeterminate{0%{transform:translate(-100%)}to{transform:translate(250%)}}@media (prefers-reduced-motion:reduce){.ZsMDKq_progressBar{transition:none}.ZsMDKq_progressBar[data-indeterminate=true]{width:40%;animation:none;transform: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}.ZsMDKq_mount{align-self:center;margin-left:auto;position:relative}.ZsMDKq_toolbar{color:var(--dsw-alias-label-primary);align-items:center;gap:8px;font-size:12.5px;line-height:18px;display:flex;position:relative}.ZsMDKq_toolbarButton{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:3px 10px}.ZsMDKq_toolbarButton:hover:enabled{background:var(--dsw-alias-interactive-bg-hover)}.ZsMDKq_toolbarButton:disabled{cursor:default;opacity:.55}.ZsMDKq_toolbarButton:focus-visible,.ZsMDKq_toolbarSummary: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_toolbarSummary{font:inherit;cursor:pointer;color:var(--dsw-alias-label-secondary);background:0 0;border:0;padding:3px 2px}.ZsMDKq_toolbarSummary:hover{color:var(--dsw-alias-label-primary)}.ZsMDKq_toolbarHint{max-width:320px;color:var(--dsw-alias-label-tertiary)}.ZsMDKq_panel{z-index:40;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);width:max-content;min-width:260px;max-width:min(440px,60vw);max-height:320px;box-shadow:var(--dsw-shadow-lv3,0 8px 24px #00000024);text-align:left;border-radius:10px;flex-direction:column;gap:8px;padding:12px;display:flex;position:absolute;top:calc(100% + 6px);right:0;overflow:auto}.ZsMDKq_panelActions{justify-content:flex-end;gap:8px;display:flex}.ZsMDKq_panelList{flex-direction:column;gap:6px;margin:0;padding:0;list-style:none;display:flex}.ZsMDKq_panelRow{flex-wrap:wrap;align-items:baseline;gap:6px;display:flex}.ZsMDKq_panelName{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);word-break:break-all;font-size:12px}.ZsMDKq_panelVersion{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:12px}.ZsMDKq_restartRequired{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.ZsMDKq_restartRequiredLine{color:var(--dsw-alias-label-secondary);font-size:12px}.ZsMDKq_builtinMount{min-width:0}.ZsMDKq_builtinGroup{min-width:0;color:var(--dsw-alias-label-primary);flex-direction:column;gap:8px;display:flex}.ZsMDKq_builtinHead{align-items:center;gap:8px;min-width:0;display:flex}.ZsMDKq_builtinTitle{min-width:0;margin:0;font-size:14px;font-weight:500;line-height:22px}.ZsMDKq_builtinCount{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:12px;line-height:18px}.ZsMDKq_builtinScope{font:inherit;cursor:pointer;color:var(--dsw-alias-label-secondary);background:0 0;border:0;flex:none;margin-inline-start:auto;padding:3px 2px;font-size:12px;line-height:18px}.ZsMDKq_builtinScope:hover{color:var(--dsw-alias-label-primary)}.ZsMDKq_builtinScope: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_builtinList{flex-direction:column;gap:2px;margin:0;padding:0;list-style:none;display:flex}.ZsMDKq_builtinRow{border-bottom:.5px solid var(--dsw-alias-border-l2);align-items:flex-start;gap:12px;min-width:0;padding:12px 2px;display:flex}.ZsMDKq_builtinRow:last-child{border-bottom:0}.ZsMDKq_builtinMain{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.ZsMDKq_builtinName{overflow-wrap:anywhere;font-size:13px;line-height:20px}.ZsMDKq_builtinModule{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;font-size:12px;line-height:18px}.ZsMDKq_builtinOwner{color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;font-size:12px;line-height:18px}.ZsMDKq_builtinReason{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere;font-size:12px;line-height:18px}.ZsMDKq_presetGroup{border-top:.5px solid var(--dsw-alias-border-l2);flex-direction:column;gap:6px;min-width:0;padding-top:12px;display:flex}.ZsMDKq_presetTitle{margin:0;font-size:13px;font-weight:500;line-height:20px}.ZsMDKq_presetList{flex-direction:column;gap:6px;margin:0;padding:0;list-style:none;display:flex}.ZsMDKq_presetCard{flex-direction:column;gap:2px;min-width:0;display:flex}.ZsMDKq_presetHead{align-items:baseline;gap:6px;min-width:0;display:flex}.ZsMDKq_presetName{overflow-wrap:anywhere;font-size:13px;line-height:20px}.ZsMDKq_presetTag{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.ZsMDKq_presetRows{flex-direction:column;gap:2px;margin:0;padding:0 0 0 12px;list-style:none;display:flex}.ZsMDKq_presetRow{align-items:baseline;gap:8px;min-width:0;font-size:12px;line-height:18px;display:flex}.ZsMDKq_presetRowName{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.ZsMDKq_presetRowState{color:var(--dsw-alias-label-tertiary);flex:none}";
29
30
  const tagId = "@linxin666/dsh-client-ui-plugin-manager/packages/dsh-plugin-manager/src/client/plugin-manager.module.css";
30
31
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
31
32
  const tag = document.createElement("style");
@@ -36,6 +37,19 @@ window.__ModuleLoader__.load({
36
37
  }
37
38
  var plugin_manager_module_css_default = {
38
39
  "actionRow": "ZsMDKq_actionRow",
40
+ "builtinCount": "ZsMDKq_builtinCount",
41
+ "builtinGroup": "ZsMDKq_builtinGroup",
42
+ "builtinHead": "ZsMDKq_builtinHead",
43
+ "builtinList": "ZsMDKq_builtinList",
44
+ "builtinMain": "ZsMDKq_builtinMain",
45
+ "builtinModule": "ZsMDKq_builtinModule",
46
+ "builtinMount": "ZsMDKq_builtinMount",
47
+ "builtinName": "ZsMDKq_builtinName",
48
+ "builtinOwner": "ZsMDKq_builtinOwner",
49
+ "builtinReason": "ZsMDKq_builtinReason",
50
+ "builtinRow": "ZsMDKq_builtinRow",
51
+ "builtinScope": "ZsMDKq_builtinScope",
52
+ "builtinTitle": "ZsMDKq_builtinTitle",
39
53
  "button": "ZsMDKq_button",
40
54
  "compatBlocked": "ZsMDKq_compatBlocked",
41
55
  "compatHint": "ZsMDKq_compatHint",
@@ -52,6 +66,17 @@ window.__ModuleLoader__.load({
52
66
  "panelRow": "ZsMDKq_panelRow",
53
67
  "panelVersion": "ZsMDKq_panelVersion",
54
68
  "pluginManagerIndeterminate": "ZsMDKq_pluginManagerIndeterminate",
69
+ "presetCard": "ZsMDKq_presetCard",
70
+ "presetGroup": "ZsMDKq_presetGroup",
71
+ "presetHead": "ZsMDKq_presetHead",
72
+ "presetList": "ZsMDKq_presetList",
73
+ "presetName": "ZsMDKq_presetName",
74
+ "presetRow": "ZsMDKq_presetRow",
75
+ "presetRowName": "ZsMDKq_presetRowName",
76
+ "presetRowState": "ZsMDKq_presetRowState",
77
+ "presetRows": "ZsMDKq_presetRows",
78
+ "presetTag": "ZsMDKq_presetTag",
79
+ "presetTitle": "ZsMDKq_presetTitle",
55
80
  "primary": "ZsMDKq_primary",
56
81
  "progressBar": "ZsMDKq_progressBar",
57
82
  "progressRow": "ZsMDKq_progressRow",
@@ -88,6 +113,12 @@ window.__ModuleLoader__.load({
88
113
  * official primitives bundle.
89
114
  * @module @linxin666/dsh-client-ui-plugin-manager/client
90
115
  */
116
+ /**
117
+ * The custom property carrying the determinate fraction (0 to 1). The bar is a
118
+ * full-width element the stylesheet scales along its own axis, so a progress
119
+ * tick repaints one compositor property instead of re-laying-out the row.
120
+ */
121
+ const PROGRESS_VARIABLE = "--plugin-manager-progress";
91
122
  /** Error text for a caught request or lifecycle failure. */
92
123
  function messageOf$1(error) {
93
124
  if (error instanceof AggregateError) {
@@ -254,8 +285,9 @@ window.__ModuleLoader__.load({
254
285
  className: plugin_manager_module_css_default.progressTrack,
255
286
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
256
287
  className: plugin_manager_module_css_default.progressBar,
257
- style: progress.percent === void 0 ? void 0 : { width: `${String(progress.percent)}%` },
258
- "data-indeterminate": progress.percent === void 0 ? "true" : void 0
288
+ style: progress.percent === void 0 ? void 0 : { [PROGRESS_VARIABLE]: String(progress.percent / 100) },
289
+ "data-indeterminate": progress.percent === void 0 ? "true" : void 0,
290
+ "data-update-progress": progress.percent === void 0 ? "indeterminate" : "determinate"
259
291
  })
260
292
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
261
293
  className: plugin_manager_module_css_default.hint,
@@ -368,6 +400,638 @@ window.__ModuleLoader__.load({
368
400
  };
369
401
  }
370
402
  //#endregion
403
+ //#region src/core/builtin.ts
404
+ /**
405
+ * Select the built-in group's two scopes in one pass: every Loader entry, the
406
+ * ones no installed bundle contributes, and which bundle contributes the rest.
407
+ *
408
+ * The default scope is the subtraction the group shipped with; the wider scope is
409
+ * the same rows plus the ones a bundle's patch inserts, each named after that
410
+ * bundle — the reason a reader meets them again on the bundle's own page.
411
+ * @param inventory - the Loader snapshot.
412
+ * @param bundles - every installed bundle, or undefined when `listBundles()`
413
+ * failed; both scopes then list every entry and the group says so.
414
+ * @param plugins - the manager's plugin rows, or undefined when that read
415
+ * failed; an unread row is reported as `unknown` rather than guessed writable.
416
+ * @returns both scopes, the ownership map behind them, and the roster state.
417
+ */
418
+ function selectBuiltinEntries(inventory, bundles, plugins) {
419
+ const owners = /* @__PURE__ */ new Map();
420
+ for (const bundle of bundles ?? []) {
421
+ if (bundle.installed === false) continue;
422
+ for (const row of bundle.rows ?? []) if (row.entryId !== void 0 && !owners.has(row.entryId)) owners.set(row.entryId, bundle.name ?? "");
423
+ }
424
+ const writability = /* @__PURE__ */ new Map();
425
+ for (const plugin of plugins ?? []) writability.set(plugin.entryId, plugin.readOnlyReason ?? "writable");
426
+ const allRows = inventory.entries.map((entry) => {
427
+ const shared = {
428
+ entryId: entry.entryId,
429
+ moduleName: entry.moduleName,
430
+ meta: entry.meta,
431
+ enabled: entry.enabled,
432
+ write: writability.get(entry.entryId) ?? "unknown"
433
+ };
434
+ const ownedBy = owners.get(entry.entryId);
435
+ return ownedBy === void 0 ? shared : {
436
+ ...shared,
437
+ ownedBy
438
+ };
439
+ });
440
+ return {
441
+ rows: allRows.filter((row) => row.ownedBy === void 0),
442
+ allRows,
443
+ owners,
444
+ bundles: bundles === void 0 ? "unconfirmed" : "confirmed"
445
+ };
446
+ }
447
+ /**
448
+ * Read one `remote.<namespace>` answer.
449
+ *
450
+ * The API gateway wraps every namespace result as `{ ok, value | error }`, and a
451
+ * carrier that hands the bare value back must not be mistaken for a failure —
452
+ * so an object is treated as an envelope only when its `ok` really is a boolean,
453
+ * and anything else passes through as the value itself.
454
+ * @param raw - the resolved answer, exactly as the namespace returned it.
455
+ * @returns the unwrapped value, or the envelope's error code.
456
+ */
457
+ function readRemoteAnswer(raw) {
458
+ if (typeof raw === "object" && raw !== null && typeof raw.ok === "boolean") {
459
+ const envelope = raw;
460
+ if (envelope.ok) return {
461
+ ok: true,
462
+ value: envelope.value
463
+ };
464
+ return {
465
+ ok: false,
466
+ code: envelope.error?.code
467
+ };
468
+ }
469
+ return {
470
+ ok: true,
471
+ value: raw
472
+ };
473
+ }
474
+ /**
475
+ * Read one `setPluginEnabled` answer.
476
+ *
477
+ * The official manager folds a refusal into the resolved result
478
+ * (`application: 'failed'` with an `error.code`) instead of rejecting, so a
479
+ * resolved promise is not a success. Both answer shapes are accepted because
480
+ * the gateway's envelope and the bare `ChangeResult` are the same call seen
481
+ * through two carriers.
482
+ * @param raw - the resolved answer.
483
+ * @returns the outcome the switch should show.
484
+ */
485
+ function readChangeResult(raw) {
486
+ const answer = readRemoteAnswer(raw);
487
+ if (!answer.ok) return {
488
+ ok: false,
489
+ code: answer.code ?? "operation-error"
490
+ };
491
+ const result = answer.value;
492
+ const application = result?.application;
493
+ if (application === void 0) return {
494
+ ok: false,
495
+ code: "operation-error"
496
+ };
497
+ if (application === "failed" || application === "cancelled") return {
498
+ ok: false,
499
+ code: result.error?.code ?? application
500
+ };
501
+ return {
502
+ ok: true,
503
+ application,
504
+ restartReason: result.restartReason
505
+ };
506
+ }
507
+ //#endregion
508
+ //#region src/client/BuiltinPlugins.tsx
509
+ /**
510
+ * The "Built-in plugins" group at the bottom of the official Plugins page.
511
+ *
512
+ * By default it lists every global Loader entry no installed bundle contributes —
513
+ * the rows a profile patch inserts itself (the Computer Use pair among them) and
514
+ * the rows the host ships globally — each with the official manager's own switch,
515
+ * so a row is enabled or disabled by exactly the call the official page makes.
516
+ * One control widens that list to every Loader entry and names, on each row a
517
+ * bundle adds, the bundle that adds it: those rows are the ones a reader also
518
+ * meets on that bundle's own page, and the answer to "why is this here twice" is
519
+ * that sentence. Below it, the agent preset compositions the same inventory
520
+ * reports are rendered read-only: a preset's rows are composed per session and
521
+ * only a Loader context can decide a `!!js` condition, so nothing here offers
522
+ * them a switch.
523
+ *
524
+ * Every state shown is the Loader's own: after an accepted write the group
525
+ * re-reads instead of trusting the answer, a refusal is named by the code the
526
+ * manager returned, and a locked row says which lock it is.
527
+ * @module @linxin666/dsh-client-ui-plugin-manager/client
528
+ */
529
+ /** Which refusal code reads as which sentence. */
530
+ const REFUSAL_KEYS = {
531
+ "management-required": "builtinReasonManagementRequired",
532
+ "unaddressable": "builtinReasonUnaddressable"
533
+ };
534
+ /** Which restart reason reads as which sentence. */
535
+ const RESTART_KEYS = {
536
+ "no-hmr": "builtinRestartNoHmr",
537
+ "package-moved": "builtinRestartPackageMoved",
538
+ "host-module": "builtinRestartHostModule",
539
+ "unmanaged-plugin": "builtinRestartUnmanagedPlugin",
540
+ "module-comparison": "builtinRestartModuleComparison"
541
+ };
542
+ /**
543
+ * The one reason a failure this component could not name may show: the manager's
544
+ * own generic code. A caught exception keeps its message out of the interface —
545
+ * a host diagnostic can carry an absolute path — and is logged instead.
546
+ */
547
+ const FALLBACK_CODE = "operation-error";
548
+ /** Log one caught failure where a developer can read it, naming what failed. */
549
+ function warnFailure(what, error) {
550
+ console.warn(`plugin-manager: ${what}`, error);
551
+ }
552
+ /**
553
+ * What one refusal code reads as. A code this package has no sentence for is
554
+ * shown as the code itself: the manager named it, and a guessed sentence would
555
+ * be worse than the name it gave.
556
+ */
557
+ function refusalText(code, t) {
558
+ const key = REFUSAL_KEYS[code];
559
+ return key === void 0 ? code : t(key);
560
+ }
561
+ /** Why a row's switch is locked, in the reader's language. */
562
+ function writeReason(write, t) {
563
+ if (write === "writable") return "";
564
+ if (write === "unknown") return t("builtinReasonUnknown");
565
+ return refusalText(write, t);
566
+ }
567
+ /** Why a write needs a restart, in the reader's language. */
568
+ function restartReason(reason, t) {
569
+ if (reason === void 0) return t("builtinRestartUnnamed");
570
+ const key = RESTART_KEYS[reason];
571
+ return key === void 0 ? t("builtinRestartUnnamed") : t(key);
572
+ }
573
+ /** One row's display title, falling back to the module it names. */
574
+ function rowTitle(row, resolveText) {
575
+ const title = row.meta?.title;
576
+ if (title === void 0) return row.moduleName;
577
+ const resolved = resolveText(title);
578
+ return resolved === "" ? row.moduleName : resolved;
579
+ }
580
+ /** One preset row's state, as the composition reports it. */
581
+ function presetRowState(row) {
582
+ if (row.enabled === "conditional") return "conditional";
583
+ return row.enabled ? "on" : "off";
584
+ }
585
+ /** One preset row's state text; a conditional row names its own expression. */
586
+ function presetRowText(row, t) {
587
+ if (row.enabled === "conditional") return row.condition === void 0 ? t("presetRowConditionalUnnamed") : t("presetRowConditional", { condition: row.condition });
588
+ return row.enabled ? t("presetRowOn") : t("presetRowOff");
589
+ }
590
+ /**
591
+ * Read one manager list, treating a refused or failed read as unknown. A row
592
+ * whose writability could not be read is shown locked, never writable.
593
+ */
594
+ async function readList(read) {
595
+ try {
596
+ const answer = readRemoteAnswer(await read());
597
+ if (!answer.ok) return void 0;
598
+ return Array.isArray(answer.value) ? answer.value : void 0;
599
+ } catch (error) {
600
+ warnFailure("built-in group list read failed", error);
601
+ return;
602
+ }
603
+ }
604
+ /**
605
+ * Whether an inventory answer is really a snapshot. The namespace hands back
606
+ * `entries`; anything else — a bare null, an envelope with no value, a value
607
+ * whose entries is not a list — is a failure this group reports rather than one
608
+ * it walks into.
609
+ */
610
+ function isInventory(value) {
611
+ return typeof value === "object" && value !== null && Array.isArray(value.entries);
612
+ }
613
+ /**
614
+ * Read the whole group: the Loader snapshot, then the two manager lists that
615
+ * decide which entries are built-in and which of them can be written.
616
+ * @param remote - the sampled official faces.
617
+ * @returns the group's state; a read this deployment cannot serve stays a state,
618
+ * never an exception.
619
+ */
620
+ async function readGroup(remote) {
621
+ const inventoryFace = remote.inventory;
622
+ if (inventoryFace === null) return { kind: "unavailable" };
623
+ try {
624
+ const answer = readRemoteAnswer(await inventoryFace.list());
625
+ if (!answer.ok) return {
626
+ kind: "failed",
627
+ code: answer.code ?? FALLBACK_CODE
628
+ };
629
+ if (!isInventory(answer.value)) return {
630
+ kind: "failed",
631
+ code: FALLBACK_CODE
632
+ };
633
+ const inventory = answer.value;
634
+ const manager = remote.manager;
635
+ const [plugins, bundles] = await Promise.all([manager === null ? Promise.resolve(void 0) : readList(() => manager.listPlugins()), manager === null ? Promise.resolve(void 0) : readList(() => manager.listBundles())]);
636
+ const selection = selectBuiltinEntries(inventory, bundles, plugins);
637
+ return {
638
+ kind: "ready",
639
+ rows: selection.rows,
640
+ allRows: selection.allRows,
641
+ bundles: selection.bundles,
642
+ presets: Array.isArray(inventory.agentPresets) ? inventory.agentPresets : []
643
+ };
644
+ } catch (error) {
645
+ warnFailure("built-in group read failed", error);
646
+ return {
647
+ kind: "failed",
648
+ code: FALLBACK_CODE
649
+ };
650
+ }
651
+ }
652
+ /**
653
+ * The group itself. All state is local: the page around it owns the plugin list,
654
+ * and the Loader is the only truth this component reports.
655
+ */
656
+ function BuiltinPlugins(props) {
657
+ const { t, remote, resolveText } = props;
658
+ const [state, setState] = (0, react.useState)({ kind: "loading" });
659
+ /** Bumped after an accepted write, so the group reads the Loader again. */
660
+ const [reload, setReload] = (0, react.useState)(0);
661
+ /** The one write in flight, mirrored into the switches before the re-read. */
662
+ const [pending, setPending] = (0, react.useState)(void 0);
663
+ /** Synchronous in-flight mirror: two clicks can land in one frame. */
664
+ const writingRef = (0, react.useRef)(false);
665
+ const [notice, setNotice] = (0, react.useState)(void 0);
666
+ (0, react.useEffect)(() => {
667
+ let live = true;
668
+ readGroup(remote).then((next) => {
669
+ if (live) setState(next);
670
+ });
671
+ return () => {
672
+ live = false;
673
+ };
674
+ }, [remote, reload]);
675
+ /**
676
+ * Which scope the list shows. Switching it only picks between the two sets the
677
+ * last read already answered with: it never reads again and never touches a
678
+ * row's enablement, so a reader can widen the list without the Loader moving.
679
+ */
680
+ const [scope, setScope] = (0, react.useState)("default");
681
+ const listId = (0, react.useId)();
682
+ const ready = state.kind === "ready" ? state : void 0;
683
+ const rows = ready === void 0 ? [] : scope === "all" ? ready.allRows : ready.rows;
684
+ /** Rows the default scope leaves out: what the scope control would add. */
685
+ const ownedCount = ready === void 0 ? 0 : ready.allRows.length - ready.rows.length;
686
+ const presets = ready === void 0 ? [] : ready.presets;
687
+ /**
688
+ * The visible label of each row: its name, and the line under it — the module, or
689
+ * the entry id when the name already is that module. Two rows carrying the same
690
+ * pair read identically, which is the only case where the row has to say which
691
+ * entry it is; a title two rows share is exactly that case, and so is a module
692
+ * several rows name. Counted over the list on screen, so each scope answers for
693
+ * itself and switching scope neither reads nor writes anything.
694
+ */
695
+ const labels = /* @__PURE__ */ new Map();
696
+ const labelCounts = /* @__PURE__ */ new Map();
697
+ for (const row of rows) {
698
+ const title = rowTitle(row, resolveText);
699
+ const label = `${title}\u0000${title === row.moduleName ? row.entryId : row.moduleName}`;
700
+ labels.set(row.entryId, label);
701
+ labelCounts.set(label, (labelCounts.get(label) ?? 0) + 1);
702
+ }
703
+ /** Whether this row's visible labels are shared with another row on screen. */
704
+ const collides = (entryId) => (labelCounts.get(labels.get(entryId) ?? "") ?? 0) > 1;
705
+ /**
706
+ * Ask the official manager to enable or disable one row, then re-read. The
707
+ * switch moves first and comes back on a refusal, so what it shows afterwards
708
+ * is the answer this deployment gave rather than the click that produced it.
709
+ */
710
+ const toggle = (row, next) => {
711
+ const manager = remote.manager;
712
+ if (manager === null || row.write !== "writable" || writingRef.current) return;
713
+ writingRef.current = true;
714
+ setPending({
715
+ entryId: row.entryId,
716
+ enabled: next
717
+ });
718
+ setNotice(void 0);
719
+ (async () => {
720
+ let outcome;
721
+ try {
722
+ outcome = readChangeResult(await manager.setPluginEnabled(row.entryId, next));
723
+ } catch (error) {
724
+ warnFailure("built-in group write failed", error);
725
+ outcome = {
726
+ ok: false,
727
+ code: FALLBACK_CODE
728
+ };
729
+ }
730
+ writingRef.current = false;
731
+ setPending(void 0);
732
+ if (!outcome.ok) {
733
+ setNotice({
734
+ tone: "error",
735
+ text: t(next ? "builtinFailedEnable" : "builtinFailedDisable", { reason: refusalText(outcome.code, t) })
736
+ });
737
+ return;
738
+ }
739
+ setNotice(outcome.application === "restart-required" ? {
740
+ tone: "note",
741
+ text: t("builtinRestartRequired", { reason: restartReason(outcome.restartReason, t) })
742
+ } : outcome.application === "overridden" ? {
743
+ tone: "note",
744
+ text: t("builtinOverridden", { name: rowTitle(row, resolveText) })
745
+ } : void 0);
746
+ setReload((token) => token + 1);
747
+ })();
748
+ };
749
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
750
+ className: plugin_manager_module_css_default.builtinGroup,
751
+ "data-dsh-plugin": "plugin-manager",
752
+ "data-dsh-part": "builtin-group",
753
+ "data-builtin-state": state.kind,
754
+ "data-builtin-bundles": state.kind === "ready" ? state.bundles : void 0,
755
+ "data-builtin-scope": scope,
756
+ "aria-busy": state.kind === "loading",
757
+ children: [
758
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
759
+ className: plugin_manager_module_css_default.builtinHead,
760
+ children: [
761
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
762
+ className: plugin_manager_module_css_default.builtinTitle,
763
+ children: t("builtinGroup")
764
+ }),
765
+ ready !== void 0 && ready.bundles === "confirmed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
766
+ className: plugin_manager_module_css_default.builtinCount,
767
+ "data-builtin-count": rows.length,
768
+ children: rows.length
769
+ }),
770
+ ownedCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
771
+ type: "button",
772
+ className: plugin_manager_module_css_default.builtinScope,
773
+ "data-dsh-part": "builtin-scope",
774
+ "aria-expanded": scope === "all",
775
+ "aria-controls": listId,
776
+ onClick: () => {
777
+ setScope(scope === "all" ? "default" : "all");
778
+ },
779
+ children: t(scope === "all" ? "builtinScopeCollapse" : "builtinScopeExpand", { count: String(ownedCount) })
780
+ })
781
+ ]
782
+ }),
783
+ state.kind === "loading" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
784
+ className: plugin_manager_module_css_default.hint,
785
+ role: "status",
786
+ children: t("builtinReading")
787
+ }),
788
+ state.kind === "unavailable" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
789
+ className: plugin_manager_module_css_default.hint,
790
+ children: t("builtinUnavailable")
791
+ }),
792
+ state.kind === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
793
+ className: plugin_manager_module_css_default.error,
794
+ role: "alert",
795
+ children: t("builtinFailed", { reason: state.code })
796
+ }),
797
+ state.kind === "ready" && state.bundles === "unconfirmed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
798
+ className: plugin_manager_module_css_default.hint,
799
+ "data-builtin-unconfirmed": true,
800
+ children: t("builtinUnconfirmed")
801
+ }),
802
+ notice !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
803
+ className: notice.tone === "error" ? plugin_manager_module_css_default.error : plugin_manager_module_css_default.hint,
804
+ role: notice.tone === "error" ? "alert" : "status",
805
+ "data-dsh-part": "builtin-notice",
806
+ "data-notice-tone": notice.tone,
807
+ children: notice.text
808
+ }),
809
+ ready !== void 0 && rows.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
810
+ className: plugin_manager_module_css_default.hint,
811
+ children: t("builtinEmpty")
812
+ }),
813
+ rows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
814
+ className: plugin_manager_module_css_default.builtinList,
815
+ id: listId,
816
+ children: rows.map((row) => {
817
+ const title = rowTitle(row, resolveText);
818
+ const reason = writeReason(row.write, t);
819
+ const locked = row.write !== "writable";
820
+ const checked = pending?.entryId === row.entryId ? pending.enabled : row.enabled;
821
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
822
+ className: plugin_manager_module_css_default.builtinRow,
823
+ "data-dsh-part": "builtin-row",
824
+ "data-entry-id": row.entryId,
825
+ "data-write": row.write,
826
+ "data-owned-by": row.ownedBy,
827
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
828
+ className: plugin_manager_module_css_default.builtinMain,
829
+ children: [
830
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
831
+ className: plugin_manager_module_css_default.builtinName,
832
+ children: title
833
+ }),
834
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
835
+ className: plugin_manager_module_css_default.builtinModule,
836
+ children: title === row.moduleName ? row.entryId : row.moduleName
837
+ }),
838
+ collides(row.entryId) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
839
+ className: plugin_manager_module_css_default.builtinModule,
840
+ "data-entry-revealed": row.entryId,
841
+ children: row.entryId
842
+ }),
843
+ row.ownedBy !== void 0 && row.ownedBy !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
844
+ className: plugin_manager_module_css_default.builtinOwner,
845
+ "data-dsh-part": "builtin-owner",
846
+ children: t("builtinOwnedBy", { name: row.ownedBy })
847
+ }),
848
+ locked && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
849
+ className: plugin_manager_module_css_default.builtinReason,
850
+ children: reason
851
+ })
852
+ ]
853
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Switch, {
854
+ checked,
855
+ label: t("builtinToggle", { name: title }),
856
+ disabled: locked || pending !== void 0 || remote.manager === null,
857
+ ...locked ? { title: reason } : {},
858
+ onChange: (next) => {
859
+ toggle(row, next);
860
+ }
861
+ })]
862
+ }, row.entryId);
863
+ })
864
+ }),
865
+ presets.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
866
+ className: plugin_manager_module_css_default.presetGroup,
867
+ "data-dsh-part": "preset-group",
868
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
869
+ className: plugin_manager_module_css_default.presetTitle,
870
+ children: t("presetGroup")
871
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
872
+ className: plugin_manager_module_css_default.presetList,
873
+ children: presets.map((preset) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
874
+ className: plugin_manager_module_css_default.presetCard,
875
+ "data-dsh-part": "preset",
876
+ "data-preset-id": preset.id,
877
+ "data-default": preset.isDefault ? "yes" : "no",
878
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
879
+ className: plugin_manager_module_css_default.presetHead,
880
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
881
+ className: plugin_manager_module_css_default.presetName,
882
+ children: preset.name ?? preset.id
883
+ }), preset.isDefault && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
884
+ className: plugin_manager_module_css_default.presetTag,
885
+ children: t("presetDefault")
886
+ })]
887
+ }), preset.broken === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
888
+ className: plugin_manager_module_css_default.presetRows,
889
+ children: preset.rows.map((row, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
890
+ className: plugin_manager_module_css_default.presetRow,
891
+ "data-dsh-part": "preset-row",
892
+ "data-preset-state": presetRowState(row),
893
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
894
+ className: plugin_manager_module_css_default.presetRowName,
895
+ children: row.moduleName
896
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
897
+ className: plugin_manager_module_css_default.presetRowState,
898
+ children: presetRowText(row, t)
899
+ })]
900
+ }, row.entryId ?? `${preset.id}:${String(index)}`))
901
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
902
+ className: plugin_manager_module_css_default.hint,
903
+ children: t("presetBroken", { reason: preset.broken })
904
+ })]
905
+ }, preset.id))
906
+ })]
907
+ })
908
+ ]
909
+ });
910
+ }
911
+ /**
912
+ * The official page's installed panel, when the list view is mounted.
913
+ * @returns the element the group belongs after, or undefined off the list view.
914
+ */
915
+ function builtinGroupSeat() {
916
+ const panel = document.querySelector("[data-plugin-panel]")?.querySelector("[data-plugin-group=\"bundles\"]")?.parentElement;
917
+ return panel instanceof HTMLElement ? panel : void 0;
918
+ }
919
+ /**
920
+ * Mount the built-in plugin group after the installed panel.
921
+ * @param options - props factory and the optional locale subscription.
922
+ * @returns disposer removing the container, its observers and its React root.
923
+ */
924
+ function mountBuiltinPluginGroup(options) {
925
+ if (typeof document === "undefined") return () => {};
926
+ if (document.querySelector("[data-dsh-plugin-manager-builtin]") !== null) return () => {};
927
+ const container = document.createElement("div");
928
+ container.setAttribute("data-dsh-plugin-manager-builtin", "");
929
+ container.className = plugin_manager_module_css_default.builtinMount;
930
+ const root = (0, react_dom_client.createRoot)(container);
931
+ const render = () => {
932
+ root.render((0, react.createElement)(BuiltinPlugins, options.props()));
933
+ };
934
+ render();
935
+ /**
936
+ * Keep the container immediately after the installed panel; detach while the
937
+ * list is away. React owns the page's children and appends its own blocks
938
+ * (a failure notice among them) after that panel, so the anchor is the
939
+ * panel's next sibling rather than the panel's last child.
940
+ */
941
+ const place = () => {
942
+ const seat = builtinGroupSeat();
943
+ if (seat === void 0) {
944
+ container.remove();
945
+ return;
946
+ }
947
+ if (container.previousElementSibling !== seat) seat.after(container);
948
+ };
949
+ place();
950
+ const unsubscribeBody = subscribeBodyInvalidations(place);
951
+ const unsubscribeLocale = options.subscribe === void 0 ? (() => {}) : options.subscribe(render);
952
+ return () => {
953
+ unsubscribeBody();
954
+ unsubscribeLocale();
955
+ root.unmount();
956
+ container.remove();
957
+ };
958
+ }
959
+ //#endregion
960
+ //#region src/client/native-faces.ts
961
+ let snapshot = {
962
+ version: 0,
963
+ inventory: null,
964
+ manager: null
965
+ };
966
+ const listeners = /* @__PURE__ */ new Set();
967
+ /**
968
+ * Merge one face change into the snapshot and notify subscribers. `version`
969
+ * always moves, so a consumer that keys its read on it re-reads after a swap.
970
+ * @param patch - the faces to replace; an omitted face keeps its current value.
971
+ */
972
+ function patchRemote(patch) {
973
+ snapshot = {
974
+ version: snapshot.version + 1,
975
+ inventory: patch.inventory === void 0 ? snapshot.inventory : patch.inventory,
976
+ manager: patch.manager === void 0 ? snapshot.manager : patch.manager
977
+ };
978
+ for (const listener of [...listeners]) try {
979
+ listener();
980
+ } catch {}
981
+ }
982
+ /** The current snapshot (stable reference between changes). */
983
+ function getRemoteSnapshot() {
984
+ return snapshot;
985
+ }
986
+ /**
987
+ * Subscribe to snapshot changes.
988
+ * @param listener - called after every face swap or forwarded change event.
989
+ * @returns the unsubscribe function.
990
+ */
991
+ function subscribeRemote(listener) {
992
+ listeners.add(listener);
993
+ return () => {
994
+ listeners.delete(listener);
995
+ };
996
+ }
997
+ /**
998
+ * Bridge the official faces into the snapshot. Uses `ctx.inject` (not the
999
+ * plugin's module-level inject array) so each face stays optional.
1000
+ * @param ctx - the client context the plugin runs in.
1001
+ */
1002
+ function bridgeRemoteNamespaces(ctx) {
1003
+ ctx.inject(["remote.pluginInventory"], (inner) => {
1004
+ inner.effect(() => {
1005
+ patchRemote({ inventory: inner.get("remote.pluginInventory") ?? null });
1006
+ return () => {
1007
+ patchRemote({ inventory: null });
1008
+ };
1009
+ }, "plugin-manager: built-in group inventory face");
1010
+ });
1011
+ ctx.inject(["remote.pluginManager"], (inner) => {
1012
+ inner.effect(() => {
1013
+ patchRemote({ manager: inner.get("remote.pluginManager") ?? null });
1014
+ return () => {
1015
+ patchRemote({ manager: null });
1016
+ };
1017
+ }, "plugin-manager: built-in group manager face");
1018
+ });
1019
+ ctx.inject(["remote"], (inner) => {
1020
+ inner.effect(() => {
1021
+ const remote = inner.get("remote");
1022
+ let off;
1023
+ try {
1024
+ off = remote?.$on?.("plugin-manager/changed", () => {
1025
+ patchRemote({});
1026
+ });
1027
+ } catch {}
1028
+ return () => {
1029
+ off?.();
1030
+ };
1031
+ }, "plugin-manager: built-in group change feed");
1032
+ });
1033
+ }
1034
+ //#endregion
371
1035
  //#region src/core/updates.ts
372
1036
  /** The npm scope DSH's own packages are published under. */
373
1037
  const OFFICIAL_SCOPE = "@deepseek-ai/";
@@ -840,6 +1504,36 @@ window.__ModuleLoader__.load({
840
1504
  "downloadingPercent": "正在下载 {percent}%",
841
1505
  "extracting": "正在解压…",
842
1506
  "writing": "正在写入配置…",
1507
+ "builtinGroup": "内置插件",
1508
+ "builtinReading": "正在读取内置插件…",
1509
+ "builtinEmpty": "没有内置插件。",
1510
+ "builtinUnavailable": "当前部署没有提供插件清单接口,无法列出内置插件。",
1511
+ "builtinFailed": "无法读取内置插件:{reason}",
1512
+ "builtinUnconfirmed": "无法读取已安装组合包的行清单,这里按全部 Loader 条目列出。",
1513
+ "builtinScopeExpand": "显示已归属组合包的行({count})",
1514
+ "builtinScopeCollapse": "隐藏已归属组合包的行({count})",
1515
+ "builtinOwnedBy": "来自 {name}",
1516
+ "builtinToggle": "启用插件 {name}",
1517
+ "builtinFailedEnable": "启用失败:{reason}",
1518
+ "builtinFailedDisable": "停用失败:{reason}",
1519
+ "builtinReasonManagementRequired": "插件管理所需,不能停用或卸载",
1520
+ "builtinReasonUnaddressable": "当前 profile 的 patch 无法唯一定位这一项",
1521
+ "builtinReasonUnknown": "无法确定这一项能否改写",
1522
+ "builtinRestartRequired": "这次改动需要重启 DSH 才能加载:{reason}",
1523
+ "builtinOverridden": "更高层的 profile 覆盖了 {name} 的这一改动,未生效。",
1524
+ "builtinRestartUnnamed": "当前 profile 只在启动时应用更改。",
1525
+ "builtinRestartNoHmr": "这个 profile 只在启动时应用更改。",
1526
+ "builtinRestartPackageMoved": "已安装的插件包解析到了另一个目录,或者改动替换了 DSH 安装自带的包。",
1527
+ "builtinRestartHostModule": "改动涉及 DSH 自身已加载的模块。",
1528
+ "builtinRestartUnmanagedPlugin": "改动涉及一个不受插件列表管理的插件。",
1529
+ "builtinRestartModuleComparison": "DSH 无法把已加载的插件与磁盘上的文件做比较。",
1530
+ "presetGroup": "Agent 预设",
1531
+ "presetDefault": "默认",
1532
+ "presetBroken": "无法读取该预设的组合:{reason}",
1533
+ "presetRowOn": "已开启",
1534
+ "presetRowOff": "已关闭",
1535
+ "presetRowConditional": "条件启用:{condition}",
1536
+ "presetRowConditionalUnnamed": "条件启用",
843
1537
  "localOnlyTitle": "仅限本机操作",
844
1538
  "localOnlyBody": "为了保护主机配置,插件管理只能从本机打开。"
845
1539
  };
@@ -881,6 +1575,36 @@ window.__ModuleLoader__.load({
881
1575
  "downloadingPercent": "Downloading {percent}%",
882
1576
  "extracting": "Extracting…",
883
1577
  "writing": "Writing configuration…",
1578
+ "builtinGroup": "Built-in plugins",
1579
+ "builtinReading": "Reading built-in plugins…",
1580
+ "builtinEmpty": "No built-in plugins.",
1581
+ "builtinUnavailable": "This deployment publishes no plugin inventory, so built-in plugins cannot be listed.",
1582
+ "builtinFailed": "Could not read the built-in plugins: {reason}",
1583
+ "builtinUnconfirmed": "The installed bundles could not be read, so every Loader entry is listed here.",
1584
+ "builtinScopeExpand": "Show the rows these bundles own ({count})",
1585
+ "builtinScopeCollapse": "Hide the rows these bundles own ({count})",
1586
+ "builtinOwnedBy": "From {name}",
1587
+ "builtinToggle": "Enable plugin {name}",
1588
+ "builtinFailedEnable": "Could not enable it: {reason}",
1589
+ "builtinFailedDisable": "Could not disable it: {reason}",
1590
+ "builtinReasonManagementRequired": "Plugin management needs it; it cannot be switched off or uninstalled",
1591
+ "builtinReasonUnaddressable": "The profile patch cannot address this one uniquely",
1592
+ "builtinReasonUnknown": "Whether this one can be written is unknown",
1593
+ "builtinRestartRequired": "This change needs a DSH restart: {reason}",
1594
+ "builtinOverridden": "A higher profile layer overrides this change to {name}, so it did not take effect.",
1595
+ "builtinRestartUnnamed": "This profile applies changes only at startup.",
1596
+ "builtinRestartNoHmr": "This profile applies changes only at startup.",
1597
+ "builtinRestartPackageMoved": "An installed package now resolves to another directory, or the change replaces a package the DSH installation provides.",
1598
+ "builtinRestartHostModule": "The change reaches modules DSH itself loaded.",
1599
+ "builtinRestartUnmanagedPlugin": "The change reaches a plugin running outside the plugin list.",
1600
+ "builtinRestartModuleComparison": "DSH could not compare the loaded plugins with their files.",
1601
+ "presetGroup": "Agent presets",
1602
+ "presetDefault": "Default",
1603
+ "presetBroken": "This preset composition cannot be read: {reason}",
1604
+ "presetRowOn": "On",
1605
+ "presetRowOff": "Off",
1606
+ "presetRowConditional": "Conditional: {condition}",
1607
+ "presetRowConditionalUnnamed": "Conditional",
884
1608
  "localOnlyTitle": "Available on this computer only",
885
1609
  "localOnlyBody": "To protect host configuration, plugin management is only available from a local browser."
886
1610
  };
@@ -1058,7 +1782,7 @@ window.__ModuleLoader__.load({
1058
1782
  /** The building package's version, when the bundle carries it. */
1059
1783
  function bakedVersion() {
1060
1784
  try {
1061
- return "0.4.12";
1785
+ return "0.4.13";
1062
1786
  } catch {
1063
1787
  return;
1064
1788
  }
@@ -1370,6 +2094,11 @@ window.__ModuleLoader__.load({
1370
2094
  try {
1371
2095
  if (!ctx.get("pluginManager")) ctx.provide(PLUGIN_MANAGER_SERVICE, face);
1372
2096
  } catch {}
2097
+ try {
2098
+ bridgeRemoteNamespaces(ctx);
2099
+ } catch (error) {
2100
+ console.warn("plugin-manager: bridging the official plugin faces failed", error);
2101
+ }
1373
2102
  ctx.effect(() => {
1374
2103
  try {
1375
2104
  return mountPluginListToolbar({
@@ -1387,6 +2116,28 @@ window.__ModuleLoader__.load({
1387
2116
  return () => {};
1388
2117
  }
1389
2118
  }, "plugin-manager: update toolbar");
2119
+ ctx.effect(() => {
2120
+ try {
2121
+ return mountBuiltinPluginGroup({
2122
+ props: () => ({
2123
+ remote: getRemoteSnapshot(),
2124
+ resolveText: (text) => ctx.locale.resolveText(text),
2125
+ t: ctx.locale.bind(NS)
2126
+ }),
2127
+ subscribe: (listener) => {
2128
+ const offLocale = ctx.locale.subscribe(listener);
2129
+ const offRemote = subscribeRemote(listener);
2130
+ return () => {
2131
+ offLocale();
2132
+ offRemote();
2133
+ };
2134
+ }
2135
+ });
2136
+ } catch (error) {
2137
+ console.warn("plugin-manager: mounting the built-in plugin group failed", error);
2138
+ return () => {};
2139
+ }
2140
+ }, "plugin-manager: built-in plugin group");
1390
2141
  ctx.slots.inject("plugins.detail.section", () => {
1391
2142
  try {
1392
2143
  return ctx.slots.register({