@linxin666/dsh-client-ui-plugin-manager 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # node scripts/verify-docs.mjs --write <dir>
5
- README.md: b73785fe9b13fafc4801b8d008aaed9b892c69d9
6
- README.zh.md: 35ecee296030f97e49abe3a55520ac7db132a21d
5
+ README.md: 427494228934f4fb417d62cfb866046443ecc1ba
6
+ README.zh.md: e8f637e0d422f728f4171ad0f0750a820e65e5ba
package/README.md CHANGED
@@ -10,6 +10,7 @@ Plugin manager tab for the dsh web GUI Plugins settings section: installs plugin
10
10
  - Dual-channel transport: on runtimes with the official installer services (DSHCode and the 1.0.4 checkout web), every operation rides the official `/plugin-installer` and `/plugin-control` loopback RPC channels; on the npm-published web runtime those channels do not exist, so the package's host half mounts a loopback-fenced HTTP gateway that spawns the official `dsh plugin` CLI for installs/removals (the single writer) and writes `disabled` override rows for enablement.
11
11
  - Installs plugins from an npm package name or a git repository URL, with progress.
12
12
  - Lists installed user plugins with next-start enable switches, update checks (registry, npm sources), verified npm updates, and uninstall.
13
+ - Verifies DSH runtime compatibility before npm updates (issue #754): update checks read the declared minimum DSH version from the latest manifest (`dsh.engines.dsh` with a top-level `engines.dsh` fallback), show the requirement beside the update button, disable the button when the running DSH is below it, and the host update route returns 412 before starting any CLI job when the runtime cannot be verified.
13
14
  - Shows the built-in product switches when the official plugin-control surface exists.
14
15
  - Surfaces install-time conflict actions: the product-snapshot diff around each install (official mode) or the profile layer diff around each CLI run (gateway mode), with undo for reversible actions and an `Ask the agent to fix` handoff on every conflict row.
15
16
  - Protects the next boot on the npm runtime: after each install the gateway verifies the dependency actually landed, rejects duplicate entry-id claims and insert rows naming unresolvable packages, and composes the profile with the CLI's `--dump-config` preflight; a conflicting or failing install is rolled back through the official remove path (the existing plugins are never touched), with the error and repair handoff on the error row.
@@ -48,6 +49,8 @@ The browser half provides the shared dual-channel face as the cordis service `pl
48
49
  - `install(spec): Promise<InstalledPluginItem>` — install one plugin from an npm spec or git URL.
49
50
  - `uninstall(id): Promise<InstalledPluginItem[]>` — remove one plugin.
50
51
  - `status(): Promise<InstallProgressItem>` — read the current install/update progress.
52
+ - `failures(): Promise<PluginFailuresSnapshot>` — read the recorded plugin boot-failure ring (plugin id, message, stack, install path); runtimes without a ring answer an empty snapshot.
53
+ - `setEnabled(id, enabled): Promise<InstalledPluginItem>` — flip one plugin's next-start enablement through the active channel (official installer RPC or gateway patch `disabled` row); takes effect after the host restart.
51
54
  - `onChange(cb): () => void` — subscribe to successful mutations; fires after `install()`, `update()`, `uninstall()`, or `setEnabled()` resolves, and returns the unsubscribe function.
52
55
 
53
56
  The contract source of truth is `src/core/service.ts` (`PluginManagerService`). The service is provided for the plugin's lifetime and disappears when the plugin is unloaded. The service and the Plugin manager tab share one face, so `onChange` subscribers observe mutations from both.
@@ -55,7 +58,8 @@ The contract source of truth is `src/core/service.ts` (`PluginManagerService`).
55
58
  ## Known limitations
56
59
 
57
60
  - Loopback-only: on a LAN or remote browser the tab renders a local-only notice (the same boundary the official installer tab enforces; the gateway refuses non-loopback requests with 403).
58
- - On the npm-published web runtime, gateway writes go through the official CLI, so the `dsh` binary must be on the host process PATH; installs of git sources can take minutes and run as background jobs. Gateway updates apply only to npm registry sources, resolve the latest version on the host, and succeed only after the same installed package reports that exact version.
61
+ - On the npm-published web runtime, gateway writes go through the official CLI. The gateway resolves `dsh` from the host process PATH first and then from `node_modules/.bin` project roots above the running host entry, which covers local-wrapper and npx launches. If neither source contains the CLI, writes remain unavailable. Installs of git sources can take minutes and run as background jobs. Gateway updates apply only to npm registry sources, resolve the latest version on the host, and succeed only after the same installed package reports that exact version.
62
+ - Compatibility gating applies only when the target manifest declares a minimum DSH version; packages without `dsh.engines.dsh` update unchecked, and official-installer runtimes (DSHCode and the checkout web) are not gated here because their updates go through the official installer.
59
63
  - On the npm-published web runtime there is no boot-failure ring and no safe mode: those surfaces degrade to empty, and only install errors offer the repair handoff.
60
64
  - Enablement on the npm runtime writes bare `disabled` override rows into the profile's cordis.patch.yml; the runtime's loader honors them at the next start, but this path is less exercised than the official desktop writer's.
61
65
  - The web build has no in-place restart: changes apply at the next manual restart.
@@ -69,8 +73,9 @@ The contract source of truth is `src/core/service.ts` (`PluginManagerService`).
69
73
 
70
74
  - Trust boundary is the loopback fence: every gateway route requires a loopback socket address, a loopback Host header, and a non-cross-site origin (socket + Host + Origin + `sec-fetch-site`), the same authority the official installer channels enforce. There is no browser-reachable path from a remote origin.
71
75
  - Mutation routes (install / update / remove / set-enabled) carry no token: the loopback authority *is* the local user, matching the official channels. Any local process can therefore drive plugin installs and removals, and npm installs run package install scripts — treat the gateway as local code execution by design and never expose it beyond loopback.
72
- - Install specs and package ids are rejected when they contain shell metacharacters (`& | < >`, quotes, backtick, control characters). The gateway always spawns the official CLI without a shell; on Windows it resolves the npm-generated `dsh.cmd` to `node.exe` + the package `bin.js` so paths with spaces survive and `cmd.exe` never re-parses arguments. Residual upstream note: the official CLI itself forwards to pnpm with a `cmd.exe` shell on Windows, which this package cannot change — the metachar validation is the mitigation inside this repository.
76
+ - Install specs and package ids are rejected when they contain command-shell expansion characters or control characters. On Windows, npm shims are resolved to `node.exe` plus the package `bin.js`; packaged Desktop shims have no adjacent npm layout, so they run through `cmd.exe /d /s /c` with a pre-quoted, verbatim argument envelope. Desktop profile discovery reads the packaged launcher's profile environment value or persisted profile selection, and its in-process official installer is confirmed through the browser RPC capability probe.
73
77
  - Mutations are serialized through one queue, so concurrent jobs never interleave their before/after profile captures. An install is only `done` when the new dependency actually landed in the profile (and a removal only when it is gone); a success exit code alone is never trusted.
78
+ - Enablement re-reads the current profile manifest under that mutation queue and rejects stale or unknown package ids with `404` before writing, so a panel row left behind by an uninstall cannot create an orphan `disabled` override.
74
79
  - Conflict handling is owner-aware: a duplicate entry id or an insert row naming an unresolvable package rolls the *new* package back through the official remove path. The gateway never writes `disabled` rows for a shared id (such rows cannot stop the loader's duplicate check and would flag the existing owner).
75
80
  - The boot preflight (`--dump-config`) composes patch layers without importing entries: it catches composition failures, not import-time failures, which still surface at the first real boot.
76
81
  - The profile name (from `--profile` / `DSH_PROFILE`) is validated against path traversal before any file is touched; patch writes go through a backup copy plus tmp-write + atomic rename (`cordis.patch.yml.bak-plugin-manager`).
package/README.zh.md CHANGED
@@ -10,6 +10,7 @@
10
10
  - 双通道传输:带官方安装器服务的运行时(DSHCode 与 1.0.4 checkout 版 web)走官方 `/plugin-installer`、`/plugin-control` loopback RPC 通道;npm 发布的官方 web 没有这些通道,本包的 host 半区挂载 loopback 门禁的 HTTP 网关——安装/卸载 spawn 官方 `dsh plugin` CLI(唯一写入器),启停写入 `disabled` 覆盖行。
11
11
  - 从 npm 包名或 git 仓库 URL 安装插件,带进度。
12
12
  - 列出已装用户插件:下次启动生效的启用开关、更新检查(npm 源走 registry)、已核验的 npm 更新与卸载。
13
+ - 更新前校验 DSH 运行时兼容(issue #754):更新检查读取最新版本清单声明的 DSH 最低版本(`dsh.engines.dsh`,兼容回退读顶层 `engines.dsh`),在更新按钮旁显示要求,运行 DSH 低于要求时禁用按钮;host 更新路由在启动任何 CLI 任务前若无法核实时也会返回 412 并拒绝。
13
14
  - 官方 plugin-control 面存在时展示内置产品开关。
14
15
  - 安装时冲突对账:官方模式对产品快照前后 diff;网关模式对每次 CLI 运行前后的 profile 层 diff,可撤销的动作给一键撤销,每条冲突都给「让 Agent 修复」转交。
15
16
  - 按插件渲染启动失败环:「让 Agent 修复」(以插件安装根为工作区的修复会话)与「复制错误」;npm web 运行时没有失败环,只有安装错误提供修复转交。
@@ -48,6 +49,8 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
48
49
  - `install(spec): Promise<InstalledPluginItem>` — 从 npm spec 或 git URL 安装一个插件。
49
50
  - `uninstall(id): Promise<InstalledPluginItem[]>` — 卸载一个插件。
50
51
  - `status(): Promise<InstallProgressItem>` — 读取当前安装/更新进度。
52
+ - `failures(): Promise<PluginFailuresSnapshot>` — 读取宿主侧记录的插件启动失败环(插件 id、消息、堆栈、安装路径);无失败环的运行时返回空快照。
53
+ - `setEnabled(id, enabled): Promise<InstalledPluginItem>` — 经当前通道(官方安装器 RPC,或网关写 profile patch 的 `disabled` 行)翻转插件的下次启动启用状态;宿主重启后生效。
51
54
  - `onChange(cb): () => void` — 订阅成功变更;`install()`、`update()`、`uninstall()`、`setEnabled()` 任一成功 resolve 后触发,返回退订函数。
52
55
 
53
56
  契约事实源在 `src/core/service.ts`(`PluginManagerService`)。服务随插件生命周期提供,插件卸载即消失。服务与「插件管理」Tab 共享同一个 face,因此 `onChange` 订阅者对两侧发起的变更都能收到通知。
@@ -55,7 +58,8 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
55
58
  ## 已知限制
56
59
 
57
60
  - 仅限本机:LAN 或远程浏览器只显示「仅限本机操作」提示(与官方安装器 Tab 同一边界;网关对非 loopback 请求返回 403)。
58
- - npm 发布的官方 web 上,网关写入经官方 CLI 执行,因此 host 进程 PATH 里必须有 `dsh`;git 源安装可能耗时数分钟,以后台任务运行。网关更新只适用于 npm registry 源,由 host 解析最新版本,且仅当同一已装包报告该精确版本时才算成功。
61
+ - npm 发布的官方 web 上,网关写入经官方 CLI 执行。网关先从 host 进程 PATH 解析 `dsh`,再从运行中 host 入口上层各项目根的 `node_modules/.bin` 回退查找,覆盖本地包装器与 npx 启动;两处都没有 CLI 时才不可写。git 源安装可能耗时数分钟,以后台任务运行。网关更新只适用于 npm registry 源,由 host 解析最新版本,且仅当同一已装包报告该精确版本时才算成功。
62
+ - 兼容性门禁只在目标清单声明了最低 DSH 版本时生效;未声明 `dsh.engines.dsh` 的包更新不被检查,官方安装器运行时(DSHCode 与 checkout 版 web)不经过本门禁(其更新走官方安装器)。
59
63
  - npm 发布的官方 web 没有启动失败环与安全模式:这两处界面降级为空,只有安装错误提供修复转交。
60
64
  - npm 运行时上的启停会在 profile 的 cordis.patch.yml 写入裸 `disabled` 覆盖行;该运行时 loader 在下次启动时认读这些行,但这条路径不如官方桌面写入器经过充分锻炼。
61
65
  - web 端无壳内重启:变更在下次手动重启后生效。
@@ -69,8 +73,9 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
69
73
 
70
74
  - 信任边界是 loopback 门禁:每条网关路由都要求 loopback socket 地址、loopback Host 头与非跨站来源(socket + Host + Origin + `sec-fetch-site` 四重),与官方安装器通道同一权威。远程来源的浏览器没有可达路径。
71
75
  - 变更类路由(install / update / remove / set-enabled)不带 token:loopback 权威即本机用户,与官方通道同模型。因此任何本机进程都能驱动插件安装与卸载,且 npm 安装会执行包的 install 脚本——请将本网关视为「设计上即本机代码执行」,绝不暴露到 loopback 之外。
72
- - 安装 spec 与包 id 含 shell 元字符(`& | < >`、引号、反引号、控制字符)时一律拒绝。网关在所有平台无 shell spawn 官方 CLI;Windows 下把 npm 生成的 `dsh.cmd` 解析为 `node.exe` + 包内 `bin.js`,含空格路径不被截断、`cmd.exe` 不再二次解析参数。上游残留说明:官方 CLI 内部向 pnpm 转发时在 Windows 上仍走 `cmd.exe` shell,本仓库无法改变——元字符校验即本仓库内的缓解。
76
+ - 安装 spec 与包 id 含命令行展开字符或控制字符时一律拒绝。Windows 下,npm shim 会解析为 `node.exe` 加包内 `bin.js`;DSH Desktop 打包 shim 附近没有 npm 布局,因此通过带完整预引用、逐字参数封套的 `cmd.exe /d /s /c` 执行。桌面 profile 从打包启动器环境值或持久化的 profile 选择中读取,进程内官方安装器则由浏览器 RPC 能力探测确认。
73
77
  - 变更经同一队列串行,并发任务的 before/after profile 快照绝不交错。安装只有在依赖真实落入 profile 后才判 done(卸载以依赖消失为准),绝不轻信成功退出码。
78
+ - 启停操作会在该变更队列内重新读取最新 profile 清单,并在写入前以 `404` 拒绝过期或未知的包 id,因此卸载后遗留在面板里的旧行不会制造孤儿 `disabled` 覆盖。
74
79
  - 冲突处置是 owner-aware 的:重复入口 id 或引用不可解析包的 insert 行会经官方 remove 路径回滚**新**包;网关绝不对共享 id 写 `disabled` 行(那既阻止不了 loader 的重复检查,又会误伤现有插件)。
75
80
  - 启动预检(`--dump-config`)只组合 patch 层、不 import 条目:能抓组合失败,抓不到 import 期失败——后者仍在首次真实启动时暴露。
76
81
  - profile 名(来自 `--profile` / `DSH_PROFILE`)在任何文件读写前做路径穿越校验;patch 写入走备份 + tmp + 原子 rename(`cordis.patch.yml.bak-plugin-manager`)。
package/lib/client.js CHANGED
@@ -126,8 +126,23 @@ window.__ModuleLoader__.load({
126
126
  ].join("\n\n");
127
127
  }
128
128
  //#endregion
129
+ //#region src/core/version.ts
130
+ const MINIMUM_RANGE_PATTERN = /^>=\s*(v?\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;
131
+ /**
132
+ * The bare minimum version for display: strips the `>=` operator (and an
133
+ * optional leading `v`) from a declared requirement so UI copy that already
134
+ * contains the comparison operator renders `0.1.1-rc.1` instead of
135
+ * `>= >=0.1.1-rc.1`. Unsupported range forms render unchanged.
136
+ * @param minimum - the declared minimum range.
137
+ * @returns the version portion for display.
138
+ */
139
+ function displayMinimumVersion(minimum) {
140
+ const match = MINIMUM_RANGE_PATTERN.exec(minimum.trim());
141
+ return match === null ? minimum.trim() : match[1].replace(/^v/, "");
142
+ }
143
+ //#endregion
129
144
  //#region \0dsh-css:packages/dsh-plugin-manager/src/client/plugin-manager.module.css.mjs
130
- 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_installRow{gap:8px;display:flex}.ZsMDKq_spec{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);min-width:0;color:var(--dsw-alias-label-primary);border-radius:6px;flex:1;padding:6px 10px}.ZsMDKq_spec:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary)}.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_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_switch{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);cursor:pointer;border-radius:10px;width:34px;height:20px;padding:0;transition:background .2s;position:relative}.ZsMDKq_switch:after{content:\"\";background:var(--dsw-alias-label-on-danger,#fff);border-radius:50%;width:14px;height:14px;transition:transform .2s;position:absolute;top:2px;left:2px}.ZsMDKq_switch[aria-checked=true]{background:var(--dsw-alias-state-success-primary)}.ZsMDKq_switch[aria-checked=true]:after{transform:translate(14px)}.ZsMDKq_switch:disabled{opacity:.5;cursor:not-allowed}.ZsMDKq_switch:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary)}@media (prefers-reduced-motion:reduce){.ZsMDKq_switch,.ZsMDKq_switch:after{transition:none}}.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}.ZsMDKq_confirmBody{color:var(--dsw-alias-label-secondary);margin:0 0 12px}.ZsMDKq_modalActions{justify-content:flex-end;gap:8px;display:flex}.ZsMDKq_dangerButton{background:var(--dsw-alias-label-danger)!important;color:var(--dsw-alias-label-on-danger)!important}";
145
+ const css = ".ZsMDKq_section{flex-direction:column;gap:12px;display:flex}.ZsMDKq_notice{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:8px;flex-direction:column;gap:8px;padding:16px;display:flex}.ZsMDKq_notice p{color:var(--dsw-alias-label-secondary);margin:0}.ZsMDKq_state{color:var(--dsw-alias-label-secondary);padding:16px 0}.ZsMDKq_installRow{gap:8px;display:flex}.ZsMDKq_spec{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);min-width:0;color:var(--dsw-alias-label-primary);border-radius:6px;flex:1;padding:6px 10px}.ZsMDKq_spec:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary)}.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_switch{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);cursor:pointer;border-radius:10px;width:34px;height:20px;padding:0;transition:background .2s;position:relative}.ZsMDKq_switch:after{content:\"\";background:var(--dsw-alias-label-on-danger,#fff);border-radius:50%;width:14px;height:14px;transition:transform .2s;position:absolute;top:2px;left:2px}.ZsMDKq_switch[aria-checked=true]{background:var(--dsw-alias-state-success-primary)}.ZsMDKq_switch[aria-checked=true]:after{transform:translate(14px)}.ZsMDKq_switch:disabled{opacity:.5;cursor:not-allowed}.ZsMDKq_switch:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary)}@media (prefers-reduced-motion:reduce){.ZsMDKq_switch,.ZsMDKq_switch:after{transition:none}}.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}.ZsMDKq_confirmBody{color:var(--dsw-alias-label-secondary);margin:0 0 12px}.ZsMDKq_modalActions{justify-content:flex-end;gap:8px;display:flex}.ZsMDKq_dangerButton{background:var(--dsw-alias-label-danger)!important;color:var(--dsw-alias-label-on-danger)!important}";
131
146
  const tagId = "@linxin666/dsh-client-ui-plugin-manager/plugin-manager.module.css";
132
147
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
133
148
  const tag = document.createElement("style");
@@ -141,6 +156,8 @@ window.__ModuleLoader__.load({
141
156
  "actionsRow": "ZsMDKq_actionsRow",
142
157
  "applying": "ZsMDKq_applying",
143
158
  "badge": "ZsMDKq_badge",
159
+ "compatBlocked": "ZsMDKq_compatBlocked",
160
+ "compatHint": "ZsMDKq_compatHint",
144
161
  "confirmBody": "ZsMDKq_confirmBody",
145
162
  "conflicts": "ZsMDKq_conflicts",
146
163
  "dangerButton": "ZsMDKq_dangerButton",
@@ -402,7 +419,7 @@ window.__ModuleLoader__.load({
402
419
  const onCheck = () => {
403
420
  run({ kind: "check" }, async () => {
404
421
  const found = await checkUpdates();
405
- setUpdates(new Map(found.map((item) => [item.id, item.latest])));
422
+ setUpdates(new Map(found.map((item) => [item.id, item])));
406
423
  });
407
424
  };
408
425
  const onUpdate = (id) => {
@@ -643,7 +660,9 @@ window.__ModuleLoader__.load({
643
660
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
644
661
  className: plugin_manager_module_css_default.list,
645
662
  children: view.plugins.map((plugin) => {
646
- const latest = updates.get(plugin.id);
663
+ const updateItem = updates.get(plugin.id);
664
+ const latest = updateItem?.latest;
665
+ const dshRequirement = updateItem?.requiresDsh;
647
666
  const failure = attributable.get(plugin.id);
648
667
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
649
668
  className: plugin_manager_module_css_default.row,
@@ -678,6 +697,10 @@ window.__ModuleLoader__.load({
678
697
  className: plugin_manager_module_css_default.latest,
679
698
  children: t("latest", { version: latest })
680
699
  }),
700
+ updateItem !== void 0 && dshRequirement !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
701
+ className: updateItem.compatible === false ? plugin_manager_module_css_default.compatBlocked : plugin_manager_module_css_default.compatHint,
702
+ children: updateItem.compatible === false ? t("updateBlockedDsh", { min: displayMinimumVersion(dshRequirement) }) : t("updateRequiresDsh", { min: displayMinimumVersion(dshRequirement) })
703
+ }),
681
704
  failure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
682
705
  className: plugin_manager_module_css_default.failure,
683
706
  "data-plugin-failure": plugin.id,
@@ -733,7 +756,7 @@ window.__ModuleLoader__.load({
733
756
  }),
734
757
  latest !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
735
758
  variant: "outline",
736
- disabled: busy !== void 0,
759
+ disabled: busy !== void 0 || updateItem?.compatible === false,
737
760
  onClick: () => {
738
761
  onUpdate(plugin.id);
739
762
  },
@@ -932,6 +955,8 @@ window.__ModuleLoader__.load({
932
955
  checkUpdates: "检查更新",
933
956
  checking: "检查中…",
934
957
  noUpdates: "所有插件都是最新版本。",
958
+ updateRequiresDsh: "需要 DSH ≥ {min}",
959
+ updateBlockedDsh: "需要 DSH ≥ {min},请先升级 DSH 再更新",
935
960
  uninstall: "卸载",
936
961
  uninstallConfirmTitle: "卸载插件",
937
962
  uninstallConfirmBody: "将删除 {name} 的安装目录与配置行,并在重启后生效。",
@@ -1012,6 +1037,8 @@ window.__ModuleLoader__.load({
1012
1037
  checkUpdates: "Check for updates",
1013
1038
  checking: "Checking…",
1014
1039
  noUpdates: "All plugins are up to date.",
1040
+ updateRequiresDsh: "Requires DSH >= {min}",
1041
+ updateBlockedDsh: "Requires DSH >= {min}; upgrade DSH before updating",
1015
1042
  uninstall: "Uninstall",
1016
1043
  uninstallConfirmTitle: "Uninstall plugin",
1017
1044
  uninstallConfirmBody: "{name} and its configuration row will be removed; the change applies after a restart.",
@@ -1153,11 +1180,20 @@ window.__ModuleLoader__.load({
1153
1180
  if (!isRecord(value) || !Array.isArray(value.updates)) throw new Error("plugin-manager: response must contain an updates array");
1154
1181
  return value.updates.map((update, index) => {
1155
1182
  if (!isRecord(update) || !isString(update.id) || !isString(update.current) || !isString(update.latest)) throw new Error(`plugin-manager: update row ${String(index)} is invalid`);
1156
- return {
1183
+ const row = {
1157
1184
  id: update.id,
1158
1185
  current: update.current,
1159
1186
  latest: update.latest
1160
1187
  };
1188
+ if (update.requiresDsh !== void 0) {
1189
+ if (!isString(update.requiresDsh)) throw new Error(`plugin-manager: update row ${String(index)} is invalid`);
1190
+ row.requiresDsh = update.requiresDsh;
1191
+ }
1192
+ if (update.compatible !== void 0) {
1193
+ if (typeof update.compatible !== "boolean") throw new Error(`plugin-manager: update row ${String(index)} is invalid`);
1194
+ row.compatible = update.compatible;
1195
+ }
1196
+ return row;
1161
1197
  });
1162
1198
  }
1163
1199
  /**