@linxin666/dsh-client-ui-plugin-manager 0.4.7 → 0.4.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: dc8c77b9f1423ef1444777ee7a40313ff30a89bc
6
- README.zh.md: 018d1b32436acdb60cca31062d98a0076f97f00a
5
+ README.md: 5d35d6f70cb0a3d917c56cab48e34e1c9592d8db
6
+ README.zh.md: cb538a8fb9b665d762c5b44698c88285a3027da8
package/README.md CHANGED
@@ -5,7 +5,7 @@ English | [中文](README.zh.md)
5
5
  <p align="center">
6
6
  <img src="https://img.shields.io/npm/v/@linxin666/dsh-client-ui-plugin-manager?style=flat-square" alt="Version">
7
7
  &nbsp;
8
- <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.2-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
8
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.3-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
9
9
  &nbsp;
10
10
  <img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
11
11
  </p>
@@ -23,7 +23,7 @@ An update and lifecycle manager for DeepSeek Harness (DSH) Web GUI and official
23
23
  - Adds a list-level toolbar beside that page's **Installed** heading. The heading is the page's own chrome and the page declares no seat beside it (its extension points are `plugins.detail.*`, `plugins.item`, `plugins.bundle.config`, `plugins.row.config` and `plugins.bundle.activation`), so the toolbar is inserted into that element and kept in place through the family's shared body-mutation hub. One click checks every installed plugin; the panel lists the third-party rows that have a newer release, with the declared DSH minimum for any row this runtime is too old for; **Update all** applies the eligible rows one at a time with per-row progress and stops at the first failure, leaving the rest listed; **Restart now** then makes the update effective (see the restart note under Known limitations). Official `@deepseek-ai/` packages are never updated in bulk — their version belongs to the DSH installation.
24
24
  - 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. An application-owned profile (a packaged Desktop launch) takes the third writer for installs, updates and removals: the official in-process plugin manager the host mounts, because the CLI refuses to write that profile at all.
25
25
  - Detects the legacy aggregate `@linxin666/dsh-web-ui-all` and converts its update action into a transactional migration to `@linxin666/dsh-web-all`; the gateway removes the legacy package, installs the current package at an exact version, restores the legacy layer position, and verifies `--dump-config` before reporting success.
26
- - 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 action, disable it 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.
26
+ - 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), evaluate it as a node-semver range with the call the official boot gate makes — `semver.satisfies(host, range, { includePrerelease: true })` — so `||` alternatives, `^` and `~`, whitespace-separated comparators and x-ranges decide here exactly as they decide at boot, and show the requirement beside the update action. A requirement the running DSH does not satisfy disables the action and says to upgrade DSH. A requirement the host could not verify — an unreadable running version, or a declaration that is not a range node-semver parses — is a different verdict with its own copy: it names no cause and never sends the user to upgrade a DSH that was never compared. Neither verdict lets the update run, and the host update route answers 412 before starting any CLI job in both cases.
27
27
  - 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 and the existing plugins are never touched.
28
28
 
29
29
  ## Install
@@ -71,7 +71,7 @@ The contract source of truth is `src/core/service.ts` (`PluginManagerService`).
71
71
  - An application-owned profile (the packaged Desktop client) runs installs, updates and removals through the official in-process plugin manager the host mounts, the same writer that profile's official Plugins page drives: the CLI refuses `--profile desktop` outright, and the launcher hands that manager its bundled package-manager invocation. The job, its status polling and its verification are identical to the CLI path — an install must add a dependency the profile did not carry, a removal must drop one, and an update must still report the version the route resolved — while the CLI-specific guards (duplicate-mount stripping, insert-row and boot preflight) stay with the CLI writer, because there the official manager validates and applies the bundle itself. The manager's own verdict is read before the profile is: it resolves a refused run with `application: 'failed'` instead of rejecting, so the job reports that run's real reason (the pnpm diagnostic, or the packages an incompatible-version refusal names) rather than a no-op after an unchanged profile. Since 0.2.1-rc.2 that manager also refuses to install a dependency the profile already carries while the host mounts `hmr` — every profile host — so an update there runs as its two phases instead: remove the installed bundle, then install the target spec through the same manager, and a second phase that fails reinstalls the spec the profile carried before the run, so a failed update leaves a working plugin rather than an empty slot. The single call stays first, so an upstream in-place update would need no change here. Every other runtime keeps the CLI as the single writer of installs, updates and removals.
72
72
  - 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. The running DSH version is read from the installation's own `@deepseek-ai/dsh` manifest, which the launcher publishes as the profile's install anchor — no subprocess, no PATH, and therefore an answer on a packaged Desktop host — with `dsh --version` kept as the fallback for a runtime that publishes no anchor. A requirement the host cannot verify at all is reported as unverified rather than as a version below the minimum: both hold the update back, but only the second sends the user to upgrade DSH.
73
73
  - Enablement on the npm runtime reports the effective next-start value: a profile override row wins where present, otherwise the installed bundle's own `disabled` rows decide (the aggregate's inactive-by-default families), and rows no layer mentions are enabled. Enabling a row the bundle disables writes an explicit `disabled: false` override, because deleting the user row would only restore the bundle default; the runtime's loader honors these rows at the next start, but this path is less exercised than the official desktop writer's.
74
- - Restart is explicit, user-clicked and three-mode. The route is method-aware: `GET /api/plugin-manager/restart` reads the plan (no side effects, so a prefetch or a typed URL can never stop a host) and `POST` carries it out; every other method is refused with 405. The toolbar reads the plan first, so the confirmation names the same consequence the host will produce. On a terminal launch (`dsh web`) the host starts a detached helper that waits for the outgoing process to exit and then re-executes the same command line, so the port is free before the replacement binds it, and the replacement's output goes to `$DSH_HOME/logs/plugin-manager-restart.log`. Under the packaged Desktop app the plugin cannot relaunch anything — Electron owns the process tree, a detached respawn would fight the shell for the same port, and the shell's own recovery dialog is the only restart it offers — so that confirmation says what its dialog does before running it: confirming stops the host, the shell shows its error-titled dialog, and the dialog's Restart finishes `app.relaunch()` (a crash report is written with it); the manual way out, quitting DeepSeek Harness and opening it again, is named beside it. A launch with no terminal (a supervisor, an editor task) is left running and the toolbar says to restart manually. Without a restart, updated plugin code is loaded at the next start.
74
+ - Restart is explicit, user-clicked and three-mode. The route is method-aware: `GET /api/plugin-manager/restart` reads the plan (no side effects, so a prefetch or a typed URL can never stop a host) and `POST` carries it out; every other method is refused with 405. The toolbar reads the plan first, so the confirmation names the same consequence the host will produce. On a terminal launch (`dsh web`) the host starts a detached helper that waits for the outgoing process to exit and then re-executes the same command line, so the port is free before the replacement binds it, and the replacement's output goes to `$DSH_HOME/logs/plugin-manager-restart.log`. Under the packaged Desktop app the plugin cannot relaunch anything — Electron owns the process tree, a detached respawn would fight the shell for the same port, and the official shell answers a host exit with `fail("dsh desktop host stopped")` and an error page, because it exposes no way to ask the shell to restart — so the host exits there only when the shell exports `DSH_SHELL_RESTARTS_HOST=1`, its own declaration that an exiting host is brought back. Without that guarantee the restart panel states that this process cannot restart itself, names the manual way out (quit DeepSeek Harness and open it again), and offers no confirmation button: that path would not restart anything. A launch with no terminal (a supervisor, an editor task) is left running and the toolbar says to restart manually. Without a restart, updated plugin code is loaded at the next start.
75
75
  - On the npm runtime, duplicate insert-id claims are detected after install and the new plugin is rolled back automatically (a shared id can never be `disabled` away: the loader's duplicate check has no disabled exemption).
76
76
  - The npm runtime's boot preflight (`--dump-config`) catches composition failures, and the static insert check catches insert rows naming packages that resolve nowhere; runtime import/apply failures still surface only at the next real start.
77
77
  - Duplicate-mount safeguard (gateway mode): the official CLI's bundle reconciliation re-adds every bundle-declaring dependency to `dsh.profile.bundles` after any install/remove — including packages the composition already mounts through a patch row (a bundle that mounts an external plugin by row), which would double-mount and fail the next boot (`duplicate prefix route`). After every successful CLI mutation the gateway strips exactly the newly added, already-row-mounted bundles entries back out (the manifest write goes through backup + tmp + atomic rename), reports one notice per stripped entry on the job result, and leaves normal installs' bundles entries — and every entry the user had before — untouched.
@@ -80,7 +80,7 @@ The contract source of truth is `src/core/service.ts` (`PluginManagerService`).
80
80
  ## Security model
81
81
 
82
82
  - 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; rejected requests receive HTTP 403 with `{ ok: false, error: "forbidden: loopback-only" }`.
83
- - Mutation routes (install / update / remove / set-enabled / restart) carry no token: the loopback authority *is* the local user, matching the official channels. The restart route is the one route whose effect is process-level: it never invents a command line (it re-executes this process's own `execPath` + argv, dropping inspector flags), it refuses to relaunch anything it cannot identify as a terminal launch, and under the packaged Desktop app it only stops this process so the shell decides what happens next. 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.
83
+ - Mutation routes (install / update / remove / set-enabled / restart) carry no token: the loopback authority *is* the local user, matching the official channels. The restart route is the one route whose effect is process-level: it never invents a command line (it re-executes this process's own `execPath` + argv, dropping inspector flags), it refuses to relaunch anything it cannot identify as a terminal launch, and under the packaged Desktop app it stops this process only when the shell declares `DSH_SHELL_RESTARTS_HOST=1`. 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.
84
84
  - 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. That command processor is addressed by absolute path (`ComSpec`, otherwise `%SystemRoot%\System32\cmd.exe`) instead of by bare name, so a host whose PATH omits the system directories still runs the shim; a spawn that still fails settles as a failed job carrying the reason instead of taking the dsh host process down. Desktop profile discovery reads the packaged launcher's profile environment value or persisted profile selection, and application-owned profile installs, updates and removals run in the host half through the mounted official `pluginManager` service — the same writer that profile's official Plugins page drives through its own RPC face — under the same loopback fence and user click.
85
85
  - 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.
86
86
  - 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.
package/README.zh.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <p align="center">
6
6
  <img src="https://img.shields.io/npm/v/@linxin666/dsh-client-ui-plugin-manager?style=flat-square" alt="Version">
7
7
  &nbsp;
8
- <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.2-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
8
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.3-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
9
9
  &nbsp;
10
10
  <img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
11
11
  </p>
@@ -23,7 +23,7 @@
23
23
  - 在该页 **已安装** 标题旁加一条列表级工具条。该标题是官方页面自己的 chrome,页面并未为它声明席位(扩展点是 `plugins.detail.*`、`plugins.item`、`plugins.bundle.config`、`plugins.row.config` 与 `plugins.bundle.activation`),因此工具条直接插入该元素,并靠家族共享的 body mutation hub 保持就位。一次点击检查全部已装插件;面板列出有新版本的第三方插件(当前运行时版本不够的行附上其声明的 DSH 最低版本);「全部更新」逐条应用合格行并显示逐行进度,遇到第一个失败即停止并把其余行留在列表里;随后「立即重启」使更新生效(见「已知限制」中的重启说明)。官方 `@deepseek-ai/` 包绝不参与批量更新——它们的版本属于 DSH 安装本身。
24
24
  - 双通道传输:带官方安装器服务的运行时(DSHCode 与 1.0.4 checkout 版 web)走官方 `/plugin-installer`、`/plugin-control` loopback RPC 通道;npm 发布的官方 web 没有这些通道,本包的 host 半区挂载 loopback 门禁的 HTTP 网关——安装/卸载 spawn 官方 `dsh plugin` CLI(唯一写入器),启停写入 `disabled` 覆盖行。应用自有 profile(打包桌面启动)的安装、更新与卸载走第三种写入器:宿主挂载的官方进程内插件管理器,因为 CLI 完全拒绝写该 profile。
25
25
  - 检测旧聚合包 `@linxin666/dsh-web-ui-all`,把更新动作转换为到 `@linxin666/dsh-web-all` 的事务迁移;网关先移除旧包、安装精确版本的新包、恢复旧聚合包的层顺序,并在 `--dump-config` 通过后才报告成功。
26
- - 更新前校验 DSH 运行时兼容(issue #754):更新检查读取最新版本清单声明的 DSH 最低版本(`dsh.engines.dsh`,兼容回退读顶层 `engines.dsh`),在更新动作旁显示要求,运行 DSH 低于要求时禁用它;host 更新路由在启动任何 CLI 任务前若无法核实时也会返回 412 并拒绝。
26
+ - 更新前校验 DSH 运行时兼容(issue #754):更新检查读取最新版本清单声明的 DSH 最低版本(`dsh.engines.dsh`,兼容回退读顶层 `engines.dsh`),按 node-semver 范围求值——用的正是官方启动门禁那一句 `semver.satisfies(host, range, { includePrerelease: true })`,因此 `||` 备选、`^` 与 `~`、空格分隔的多比较器与 x-range 在这里的判定与启动时完全一致——并在更新动作旁显示要求。运行 DSH 确实不满足要求时禁用更新并提示升级 DSH。宿主无法核验要求时(运行版本读不出来,或声明不是 node-semver 能解析的范围)是另一种结论,有独立文案:不预设原因,也绝不把用户推去升级一个从未参与比较的 DSH。两种结论都不放行更新,host 更新路由在两种情况下都会在启动任何 CLI 任务前返回 412。
27
27
  - npm 运行时保护下次启动:安装后网关校验依赖真实落盘、拒绝重复入口 id 认领与引用不可解析包的 insert 行,并用 CLI 的 `--dump-config` 做组合预检;冲突或失败的安装会经官方 remove 路径自动回滚,绝不触碰现有插件。
28
28
 
29
29
  ## 安装
@@ -71,7 +71,7 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
71
71
  - 应用自有 profile(打包桌面客户端)的安装、更新与卸载走宿主挂载的官方进程内插件管理器——即该 profile 官方插件页所用的同一个写入器:CLI 直接拒绝 `--profile desktop`,启动器则把自带的包管理器调用交给该管理器。任务、状态轮询与校验与 CLI 路径一致:安装必须新增一条此前没有的依赖、卸载必须删除一条依赖、更新必须报告路由解析出的版本;而 CLI 专属的守卫(重复挂载剥离、insert 行与启动预检)仍留在 CLI 写入器一侧,因为该路径下官方管理器会自行校验并应用 bundle。管理器返回的判定会先于 profile 被读取:被拒绝的运行以 `application: 'failed'` 解析而不是抛错,因此任务上报该运行的真实原因(pnpm 诊断文本,或 `incompatible-version` 拒绝点名的包),而不是在 profile 未变之后给出一句空转文案。自 0.2.1-rc.2 起,该管理器在宿主挂载 `hmr` 时还会拒绝安装 profile 已携带的依赖——而那是每个 profile 宿主——因此那里的更新改为按两个阶段执行:先移除已安装的组合包,再用同一个管理器安装目标 spec;第二阶段失败时,装回运行前 profile 携带的 spec,使失败的更新留下可用的插件而不是空槽。单次调用仍排在最前,因此上游哪天接受原地更新,这里无需改动。其余运行时的安装、更新与卸载仍以 CLI 为唯一写入器。
72
72
  - 兼容性门禁只在目标清单声明了最低 DSH 版本时生效;未声明 `dsh.engines.dsh` 的包更新不被检查,官方安装器运行时(DSHCode 与 checkout 版 web)不经过本门禁(其更新走官方安装器)。运行中的 DSH 版本读取安装自身的 `@deepseek-ai/dsh` 清单——启动器把它作为 profile 的 install anchor 发布——无需子进程、无需 PATH,因此打包桌面端也能作答;运行时不发布 anchor 时回退到 `dsh --version`。宿主完全无法核验的要求按「无法确认」呈现,而不是报成低于下限:两者都拦住更新,但只有后者会让用户去升级 DSH。
73
73
  - npm 运行时上的启停显示下次启动的真实生效值:profile 覆盖行优先,其次由所装 bundle 自带的 `disabled` 行决定(聚合包的按需开启家族),两层都未提及的行视为启用。开启一个被 bundle 停用的行会写入显式 `disabled: false` 覆盖行——只删除用户行只会退回 bundle 默认值;该运行时 loader 在下次启动时认读这些行,但这条路径不如官方桌面写入器经过充分锻炼。
74
- - 重启是显式、需用户点击且有三种模式的动作,路由按方法区分:`GET /api/plugin-manager/restart` 只读「重启方案」(无副作用,因此浏览器预取或直接输入 URL 都不会停掉宿主),`POST` 才执行;其他方法一律 405 拒绝。工具条先读方案,确认面板说的后果与实际执行的一致。终端启动(`dsh web`)时宿主启动一个 detached helper:等旧进程退出后按原命令行重新拉起,端口先释放再被替换进程绑定,替换进程的输出写入 `$DSH_HOME/logs/plugin-manager-restart.log`。打包桌面应用下本插件无法重启任何东西——进程树归 Electron,detached 重拉只会与桌面外壳抢同一端口,而外壳只提供它自己的恢复对话框这一条重启路径——因此那里的确认面板会先写明该对话框会做什么:确认后宿主退出,外壳弹出错误样式的「应用无法启动或已意外停止」对话框,在对话框里点「重启」即完成 `app.relaunch()`(同时写一份崩溃报告);旁边给出替代路径——退出 DeepSeek Harness 后重新打开。无终端的启动(受监督进程、编辑器任务)保持不动,工具条提示手动重启。不重启时,更新后的插件代码在下次启动生效。
74
+ - 重启是显式、需用户点击且有三种模式的动作,路由按方法区分:`GET /api/plugin-manager/restart` 只读「重启方案」(无副作用,因此浏览器预取或直接输入 URL 都不会停掉宿主),`POST` 才执行;其他方法一律 405 拒绝。工具条先读方案,确认面板说的后果与实际执行的一致。终端启动(`dsh web`)时宿主启动一个 detached helper:等旧进程退出后按原命令行重新拉起,端口先释放再被替换进程绑定,替换进程的输出写入 `$DSH_HOME/logs/plugin-manager-restart.log`。打包桌面应用下本插件无法重启任何东西——进程树归 Electron,detached 重拉只会与桌面外壳抢同一端口,而官方外壳对宿主退出只做 `fail("dsh desktop host stopped")` 并显示错误页,没有「请壳重启宿主」的通道——因此桌面端只在壳导出 `DSH_SHELL_RESTARTS_HOST=1`(宣告会把退出的宿主重新拉起)时才让宿主退出;壳没有这个保证时,重启面板如实写「当前进程无法自动重启,请手动重启 DSH。」、给出替代路径——退出 DeepSeek Harness 后重新打开,并且不提供确认按钮。无终端的启动(受监督进程、编辑器任务)同样保持不动,工具条提示手动重启。不重启时,更新后的插件代码在下次启动生效。
75
75
  - npm 运行时上重复 insert id 认领在安装后即被检出并自动回滚新插件(共享 id 写 disabled 无法阻止 loader 的重复检查,只会误伤现有插件)。
76
76
  - npm 运行时的启动预检(`--dump-config`)能抓组合失败,静态 insert 检查能抓引用不存在包的 insert 行;真正的运行时 import/apply 失败仍要到下次启动才暴露。
77
77
  - 重复挂载保护(网关模式):官方 CLI 的 bundle 对账会在任何安装/卸载后把所有声明 `dsh.bundle` 的依赖重新加进 `dsh.profile.bundles`——包括组合树里已由 patch 行挂载的包(bundle 以 patch 行挂载外部插件时),下次启动会重复挂载而失败(`duplicate prefix route`)。每次 CLI 变更成功后,网关只把「本次新增且已被 patch 行挂载」的 bundles 条目剥除(清单写入走备份 + tmp + 原子 rename),并在任务结果上为每个被剥除的条目发一条 notice;正常安装的 bundles 条目与用户此前已有的条目一律不动。
@@ -80,7 +80,7 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
80
80
  ## 安全模型
81
81
 
82
82
  - 信任边界是 loopback 门禁:每条网关路由都要求 loopback socket 地址、loopback Host 头与非跨站来源(socket + Host + Origin + `sec-fetch-site` 四重),与官方安装器通道同一权威。远程来源的浏览器没有可达路径;被拒请求返回 HTTP 403 与 `{ ok: false, error: "forbidden: loopback-only" }`。
83
- - 变更类路由(install / update / remove / set-enabled / restart)不带 token:loopback 权威即本机用户,与官方通道同模型。重启路由是唯一作用在进程层面的路由:它绝不臆造命令行(只重放本进程自身的 `execPath` + argv,并剔除 inspector 开关),对无法确认为终端启动的宿主拒绝重拉,在打包桌面应用下只让本进程退出而把后续交给外壳。因此任何本机进程都能驱动插件安装与卸载,且 npm 安装会执行包的 install 脚本——请将本网关视为「设计上即本机代码执行」,绝不暴露到 loopback 之外。
83
+ - 变更类路由(install / update / remove / set-enabled / restart)不带 token:loopback 权威即本机用户,与官方通道同模型。重启路由是唯一作用在进程层面的路由:它绝不臆造命令行(只重放本进程自身的 `execPath` + argv,并剔除 inspector 开关),对无法确认为终端启动的宿主拒绝重拉,在打包桌面应用下只在壳声明 `DSH_SHELL_RESTARTS_HOST=1` 时才让本进程退出。因此任何本机进程都能驱动插件安装与卸载,且 npm 安装会执行包的 install 脚本——请将本网关视为「设计上即本机代码执行」,绝不暴露到 loopback 之外。
84
84
  - 安装 spec 与包 id 含命令行展开字符或控制字符时一律拒绝。Windows 下,npm shim 会解析为 `node.exe` 加包内 `bin.js`;DSH Desktop 打包 shim 附近没有 npm 布局,因此通过带完整预引用、逐字参数封套的 `cmd.exe /d /s /c` 执行;该命令解释器按绝对路径定位(`ComSpec`,其次 `%SystemRoot%\System32\cmd.exe`)而不再依赖裸名的 PATH 查找,因此 PATH 缺系统目录的宿主仍能执行 shim;若 spawn 仍失败,则该次作业以失败结算并带出原因,绝不带走 dsh 宿主进程。桌面 profile 从打包启动器环境值或持久化的 profile 选择中读取;应用自有 profile 的安装、更新与卸载由 host 半区直接调用宿主挂载的官方 `pluginManager` 服务(与官方插件页经自身 RPC 面驱动的是同一个写入器),其权威同样是 loopback 门禁加用户点击。
85
85
  - 变更经同一队列串行,并发任务的 before/after profile 快照绝不交错。安装只有在依赖真实落入 profile 后才判 done(卸载以依赖消失为准),绝不轻信成功退出码。
86
86
  - 启停操作会在该变更队列内重新读取最新 profile 清单,并在写入前以 `404` 拒绝过期或未知的包 id,因此卸载后遗留在面板里的旧行不会制造孤儿 `disabled` 覆盖。
package/lib/client.js CHANGED
@@ -13,7 +13,9 @@ window.__ModuleLoader__.load({
13
13
  * The bare minimum version for display: strips the `>=` operator (and an
14
14
  * optional leading `v`) from a declared requirement so UI copy that already
15
15
  * contains the comparison operator renders `0.1.1-rc.1` instead of
16
- * `>= >=0.1.1-rc.1`. Unsupported range forms render unchanged.
16
+ * `>= >=0.1.1-rc.1`. Every other range form renders unchanged — the browser
17
+ * half does not evaluate a range (the host does, in `../host/dsh-compat.ts`),
18
+ * so it must not pull a range parser into the client bundle to shorten copy.
17
19
  * @param minimum - the declared minimum range.
18
20
  * @returns the version portion for display.
19
21
  */
@@ -23,7 +25,7 @@ window.__ModuleLoader__.load({
23
25
  }
24
26
  //#endregion
25
27
  //#region \0dsh-css:packages/dsh-plugin-manager/src/client/plugin-manager.module.css.mjs
26
- 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}";
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}";
27
29
  const tagId = "@linxin666/dsh-client-ui-plugin-manager/packages/dsh-plugin-manager/src/client/plugin-manager.module.css";
28
30
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
29
31
  const tag = document.createElement("style");
@@ -54,6 +56,8 @@ window.__ModuleLoader__.load({
54
56
  "progressBar": "ZsMDKq_progressBar",
55
57
  "progressRow": "ZsMDKq_progressRow",
56
58
  "progressTrack": "ZsMDKq_progressTrack",
59
+ "restartRequired": "ZsMDKq_restartRequired",
60
+ "restartRequiredLine": "ZsMDKq_restartRequiredLine",
57
61
  "restartRow": "ZsMDKq_restartRow",
58
62
  "section": "ZsMDKq_section",
59
63
  "title": "ZsMDKq_title",
@@ -98,6 +102,17 @@ window.__ModuleLoader__.load({
98
102
  return progress.percent === void 0 ? t("downloading") : t("downloadingPercent", { percent: String(progress.percent) });
99
103
  }
100
104
  /**
105
+ * Read the gate state out of one wire row.
106
+ * @param item - the update row, or undefined when no check has answered yet.
107
+ * @returns `open` when nothing blocks the update, otherwise the reason it is
108
+ * held back: `below-minimum` only when the host compared a version it read,
109
+ * `unverified` when it could not make that comparison.
110
+ */
111
+ function dshGateOf(item) {
112
+ if (item?.compatible !== false) return "open";
113
+ return item.hostVersion === void 0 ? "unverified" : "below-minimum";
114
+ }
115
+ /**
101
116
  * The update block on one official Plugins page: one check action, the verdict
102
117
  * for this page's bundle, and the update action it unlocks. The check is
103
118
  * explicit rather than automatic because one check reads every installed
@@ -114,6 +129,8 @@ window.__ModuleLoader__.load({
114
129
  stage: "fetch"
115
130
  });
116
131
  const [dirty, setDirty] = (0, react.useState)(false);
132
+ /** Version the update landed on when this process cannot load it without a restart. */
133
+ const [restartRequired, setRestartRequired] = (0, react.useState)(void 0);
117
134
  /** Synchronous in-flight mirror of `busy`: the render guard alone lets a click and an Enter land in the same frame and double-fire. */
118
135
  const busyRef = (0, react.useRef)(false);
119
136
  const name = subject.kind === "bundle" ? subject.pkg.name : void 0;
@@ -166,10 +183,11 @@ window.__ModuleLoader__.load({
166
183
  busyRef.current = true;
167
184
  setBusy("update");
168
185
  setError(void 0);
169
- update(found.id).then(() => {
186
+ update(found.id).then((result) => {
170
187
  setFound(void 0);
171
188
  setChecked(false);
172
189
  setDirty(true);
190
+ setRestartRequired(result.restartRequired.length > 0 ? result.plugin.version : void 0);
173
191
  }).catch((reason) => {
174
192
  setError(t("failed", { reason: messageOf$1(reason) }));
175
193
  }).finally(() => {
@@ -184,8 +202,8 @@ window.__ModuleLoader__.load({
184
202
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("localOnlyTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("localOnlyBody") })]
185
203
  });
186
204
  const requiresDsh = found?.requiresDsh;
187
- const blocked = found?.compatible === false;
188
- const unverified = blocked && found?.hostVersion === void 0;
205
+ const gate = dshGateOf(found);
206
+ const blocked = gate !== "open";
189
207
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
190
208
  className: plugin_manager_module_css_default.section,
191
209
  "data-update-patch": true,
@@ -214,11 +232,11 @@ window.__ModuleLoader__.load({
214
232
  "data-update-latest": found.latest,
215
233
  children: t("latest", { version: found.latest })
216
234
  }),
217
- found !== void 0 && requiresDsh !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
235
+ found !== void 0 && (requiresDsh !== void 0 || blocked) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
218
236
  className: blocked ? plugin_manager_module_css_default.compatBlocked : plugin_manager_module_css_default.compatHint,
219
237
  "data-update-compat": blocked ? "blocked" : "ok",
220
- "data-update-compat-reason": blocked ? unverified ? "unverified" : "below-minimum" : void 0,
221
- children: !blocked ? t("updateRequiresDsh", { min: displayMinimumVersion(requiresDsh) }) : unverified ? t("updateUnverifiedDsh", { min: displayMinimumVersion(requiresDsh) }) : t("updateBlockedDsh", { min: displayMinimumVersion(requiresDsh) })
238
+ "data-update-compat-reason": blocked ? gate : void 0,
239
+ children: requiresDsh !== void 0 ? t(gate === "open" ? "updateRequiresDsh" : gate === "unverified" ? "updateUnverifiedDsh" : "updateBlockedDsh", { min: displayMinimumVersion(requiresDsh) }) : t("updateUnverifiedDshUnknownRange")
222
240
  }),
223
241
  found !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
224
242
  type: "button",
@@ -250,7 +268,11 @@ window.__ModuleLoader__.load({
250
268
  "data-update-error": true,
251
269
  children: error
252
270
  }),
253
- dirty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
271
+ restartRequired !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
272
+ className: plugin_manager_module_css_default.restartRow,
273
+ "data-update-restart-required": "yes",
274
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("updateRestartRequired", { version: restartRequired }) })
275
+ }) : dirty && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
254
276
  className: plugin_manager_module_css_default.restartRow,
255
277
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("restartHint") })
256
278
  })
@@ -404,6 +426,13 @@ window.__ModuleLoader__.load({
404
426
  const [found, setFound] = (0, react.useState)(0);
405
427
  const [rows, setRows] = (0, react.useState)([]);
406
428
  const [applied, setApplied] = (0, react.useState)([]);
429
+ /**
430
+ * Updates this run applied whose new version the running host has not loaded,
431
+ * with the version that landed. They stay in `applied` — the update did go
432
+ * through — and are listed as needing a restart instead of leaving the panel
433
+ * claiming a plain success.
434
+ */
435
+ const [restartRequired, setRestartRequired] = (0, react.useState)([]);
407
436
  const [cursor, setCursor] = (0, react.useState)(void 0);
408
437
  const [error, setError] = (0, react.useState)(void 0);
409
438
  const [panel, setPanel] = (0, react.useState)("none");
@@ -435,6 +464,7 @@ window.__ModuleLoader__.load({
435
464
  setRows(thirdParty);
436
465
  setFound(thirdParty.length);
437
466
  setApplied([]);
467
+ setRestartRequired([]);
438
468
  setChecked(true);
439
469
  setPanel("list");
440
470
  }).catch((reason) => {
@@ -461,7 +491,11 @@ window.__ModuleLoader__.load({
461
491
  total: queue.length
462
492
  });
463
493
  try {
464
- await update(row.id);
494
+ const result = await update(row.id);
495
+ if (result.restartRequired.length > 0) setRestartRequired((current) => [...current, {
496
+ id: row.id,
497
+ version: result.plugin.version
498
+ }]);
465
499
  } catch (reason) {
466
500
  setError(t("failed", { reason: messageOf(reason) }));
467
501
  break;
@@ -596,36 +630,54 @@ window.__ModuleLoader__.load({
596
630
  "data-update-applied": true,
597
631
  children: t("updateAllDone")
598
632
  }),
633
+ restartRequired.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
634
+ className: plugin_manager_module_css_default.restartRequired,
635
+ "data-update-restart-required": true,
636
+ children: restartRequired.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
637
+ className: plugin_manager_module_css_default.panelRow,
638
+ "data-update-restart-row": item.id,
639
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
640
+ className: plugin_manager_module_css_default.panelName,
641
+ children: item.id
642
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
643
+ className: plugin_manager_module_css_default.restartRequiredLine,
644
+ children: t("updateRestartRequired", { version: item.version })
645
+ })]
646
+ }, item.id))
647
+ }),
599
648
  rows.length === 0 && applied.length === 0 && error === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
600
649
  className: plugin_manager_module_css_default.hint,
601
650
  children: t("noUpdates")
602
651
  }),
603
652
  rows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
604
653
  className: plugin_manager_module_css_default.panelList,
605
- children: rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
606
- className: plugin_manager_module_css_default.panelRow,
607
- "data-update-row": row.id,
608
- "data-compatible": isUpdateApplicable(row) ? "yes" : "no",
609
- children: [
610
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
611
- className: plugin_manager_module_css_default.panelName,
612
- children: row.id
613
- }),
614
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
615
- className: plugin_manager_module_css_default.panelVersion,
616
- children: [
617
- row.current,
618
- " → ",
619
- row.latest
620
- ]
621
- }),
622
- row.compatible === false && row.requiresDsh !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
623
- className: plugin_manager_module_css_default.compatBlocked,
624
- "data-update-row-compat-reason": row.hostVersion === void 0 ? "unverified" : "below-minimum",
625
- children: row.hostVersion === void 0 ? t("updateUnverifiedDsh", { min: displayMinimumVersion(row.requiresDsh) }) : t("updateBlockedDsh", { min: displayMinimumVersion(row.requiresDsh) })
626
- })
627
- ]
628
- }, row.id))
654
+ children: rows.map((row) => {
655
+ const gate = dshGateOf(row);
656
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
657
+ className: plugin_manager_module_css_default.panelRow,
658
+ "data-update-row": row.id,
659
+ "data-compatible": gate === "open" ? "yes" : "no",
660
+ children: [
661
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
662
+ className: plugin_manager_module_css_default.panelName,
663
+ children: row.id
664
+ }),
665
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
666
+ className: plugin_manager_module_css_default.panelVersion,
667
+ children: [
668
+ row.current,
669
+ " → ",
670
+ row.latest
671
+ ]
672
+ }),
673
+ gate === "open" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
674
+ className: plugin_manager_module_css_default.compatBlocked,
675
+ "data-update-row-compat-reason": gate,
676
+ children: row.requiresDsh !== void 0 ? t(gate === "unverified" ? "updateUnverifiedDsh" : "updateBlockedDsh", { min: displayMinimumVersion(row.requiresDsh) }) : t("updateUnverifiedDshUnknownRange")
677
+ })
678
+ ]
679
+ }, row.id);
680
+ })
629
681
  }),
630
682
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
631
683
  className: plugin_manager_module_css_default.panelActions,
@@ -761,19 +813,21 @@ window.__ModuleLoader__.load({
761
813
  "latest": "最新 {version}",
762
814
  "updateRequiresDsh": "需要 DSH ≥ {min}",
763
815
  "updateBlockedDsh": "需要 DSH ≥ {min},请先升级 DSH 再更新",
764
- "updateUnverifiedDsh": "无法确认本机 DSH 版本(需要 DSH ≥ {min}),已暂停更新",
816
+ "updateUnverifiedDsh": "无法核验本机 DSH 与该声明的兼容性(需要 DSH ≥ {min}),已暂停更新",
817
+ "updateUnverifiedDshUnknownRange": "无法核验该插件声明的 DSH 兼容范围,已暂停更新",
765
818
  "restartHint": "插件变更将在重启应用后生效。",
766
819
  "updatesAvailable": "{count} 个可更新",
767
820
  "updateAll": "全部更新({count})",
768
821
  "updatingAll": "更新 {name}({index}/{total})",
769
822
  "updateAllDone": "更新完成,重启后生效。",
823
+ "updateRestartRequired": "已更新到 {version},需重启 DSH 后生效",
770
824
  "updatesPanelTitle": "插件更新",
771
825
  "thirdPartyOnly": "只检查第三方插件;官方 @deepseek-ai/ 包随 DSH 本体升级。",
772
826
  "restartNow": "立即重启",
773
827
  "restarting": "正在重启…",
774
828
  "restartConfirm": "确认重启",
775
829
  "restartPlanRelaunch": "会重启 DSH 服务,正在运行的任务会中断。",
776
- "restartPlanShell": "桌面版通过系统对话框重启:确认后会弹出官方的「应用无法启动或已意外停止」对话框,请在对话框中点「重启」。",
830
+ "restartPlanShell": "桌面版重启由应用外壳执行:确认后宿主进程会退出,由外壳重新拉起。",
777
831
  "restartPlanManual": "当前进程无法自动重启,请手动重启 DSH。",
778
832
  "restartShellWarning": "它同时会写一份崩溃报告;也可以手动重启:退出 DeepSeek Harness(⌘Q)后重新打开。",
779
833
  "restartDesktopHint": "请在随后出现的系统对话框中选择「重启」。",
@@ -800,19 +854,21 @@ window.__ModuleLoader__.load({
800
854
  "latest": "Latest {version}",
801
855
  "updateRequiresDsh": "Requires DSH >= {min}",
802
856
  "updateBlockedDsh": "Requires DSH >= {min}; upgrade DSH before updating",
803
- "updateUnverifiedDsh": "Cannot confirm the local DSH version (this update needs DSH >= {min}); update paused",
857
+ "updateUnverifiedDsh": "Cannot verify this host against the declared DSH range (this update needs DSH >= {min}); update paused",
858
+ "updateUnverifiedDshUnknownRange": "Cannot verify the DSH range this plugin declares; update paused",
804
859
  "restartHint": "Plugin changes take effect after restarting the application.",
805
860
  "updatesAvailable": "{count} updates available",
806
861
  "updateAll": "Update all ({count})",
807
862
  "updatingAll": "Updating {name} ({index}/{total})",
808
863
  "updateAllDone": "Updated; restart to take effect.",
864
+ "updateRestartRequired": "Updated to {version}; restart DSH for it to take effect",
809
865
  "updatesPanelTitle": "Plugin updates",
810
866
  "thirdPartyOnly": "Third-party plugins only; @deepseek-ai/ packages upgrade with DSH itself.",
811
867
  "restartNow": "Restart now",
812
868
  "restarting": "Restarting…",
813
869
  "restartConfirm": "Restart",
814
870
  "restartPlanRelaunch": "The DSH service restarts; running tasks are interrupted.",
815
- "restartPlanShell": "The desktop app restarts through its system dialog: confirming shows the official \"DeepSeek Harness is unavailable\" dialog; click Restart in it.",
871
+ "restartPlanShell": "The desktop app performs the restart: confirming stops the host process and the shell brings a new one up.",
816
872
  "restartPlanManual": "This process cannot restart itself; restart DSH yourself.",
817
873
  "restartShellWarning": "It also writes a crash report. You can instead restart manually: quit DeepSeek Harness (Cmd+Q) and open it again.",
818
874
  "restartDesktopHint": "Choose Restart in the system dialog that follows.",
@@ -888,6 +944,23 @@ window.__ModuleLoader__.load({
888
944
  return parsePlugin(value.plugin, 0);
889
945
  }
890
946
  /**
947
+ * Read the restart-required list off one gateway job (or off anything else
948
+ * carrying it).
949
+ *
950
+ * Deliberately tolerant where the other parsers in this module throw: this list
951
+ * is a hint attached to an update that already landed, so an unreadable value
952
+ * must cost the user the hint only. Throwing would reject an applied update and
953
+ * stop a batch run — the exact outcome the fact exists to avoid.
954
+ * @param value - decoded but untrusted job value.
955
+ * @returns the bundle names, empty when the value is absent or unusable.
956
+ */
957
+ function parseRestartRequired(value) {
958
+ if (!Array.isArray(value)) return [];
959
+ const names = [];
960
+ for (const item of value) if (typeof item === "string" && item !== "") names.push(item);
961
+ return names;
962
+ }
963
+ /**
891
964
  * Validate and normalize a `status` response value.
892
965
  * @param value - decoded but untrusted response value.
893
966
  * @returns the typed progress state.
@@ -977,17 +1050,39 @@ window.__ModuleLoader__.load({
977
1050
  const PLUGIN_MANAGER_SERVICE = "pluginManager";
978
1051
  //#endregion
979
1052
  //#region src/client/telemetry.ts
1053
+ /** localStorage key carrying the family-wide telemetry opt-out ('1' = off). */
1054
+ const TELEMETRY_OPT_OUT_KEY = "dsh-web-ui-telemetry-opt-out";
980
1055
  const VISITOR_KEY = "dsh-web-ui-telemetry-visitor";
981
1056
  const DAY_KEY_PREFIX = "dsh-web-ui-telemetry-day:";
982
1057
  const ENDPOINT = "https://dsh-market.com/api/telemetry/event";
983
1058
  /** The building package's version, when the bundle carries it. */
984
1059
  function bakedVersion() {
985
1060
  try {
986
- return "0.4.7";
1061
+ return "0.4.9";
987
1062
  } catch {
988
1063
  return;
989
1064
  }
990
1065
  }
1066
+ /** Whether the user switched the family-wide opt-out on (reads storage only). */
1067
+ function isTelemetryOptedOut() {
1068
+ try {
1069
+ return localStorage.getItem(TELEMETRY_OPT_OUT_KEY) === "1";
1070
+ } catch {
1071
+ return false;
1072
+ }
1073
+ }
1074
+ /** Whether the browser itself asks not to be tracked; a failed read means no signal. */
1075
+ function doNotTrackRequested() {
1076
+ try {
1077
+ return navigator.doNotTrack === "1" || navigator.doNotTrack === "yes";
1078
+ } catch {
1079
+ return false;
1080
+ }
1081
+ }
1082
+ /** Whether a heartbeat must be suppressed right now: opt-out stored, or the browser asks not to be tracked. */
1083
+ function isTelemetrySuppressed() {
1084
+ return isTelemetryOptedOut() || doNotTrackRequested();
1085
+ }
991
1086
  /** Read or lazily create the anonymous visitor id; null when storage is unavailable. */
992
1087
  function visitorId() {
993
1088
  try {
@@ -1016,6 +1111,7 @@ window.__ModuleLoader__.load({
1016
1111
  */
1017
1112
  function reportDailyHeartbeat(items) {
1018
1113
  try {
1114
+ if (isTelemetrySuppressed()) return;
1019
1115
  if (items.length === 0) return;
1020
1116
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1021
1117
  if (navigator.webdriver) return;
@@ -1088,7 +1184,10 @@ window.__ModuleLoader__.load({
1088
1184
  const official = {
1089
1185
  list: async () => parsePluginList(await call(LIST_ENDPOINT, {})),
1090
1186
  install: async (spec) => parseInstalledPlugin(await call(INSTALL_ENDPOINT, { spec })),
1091
- update: async (id) => parseInstalledPlugin(await call(UPDATE_ENDPOINT, { id })),
1187
+ update: async (id) => ({
1188
+ plugin: parseInstalledPlugin(await call(UPDATE_ENDPOINT, { id })),
1189
+ restartRequired: []
1190
+ }),
1092
1191
  uninstall: async (id) => parsePluginList(await call(UNINSTALL_ENDPOINT, { id })),
1093
1192
  setEnabled: async (id, enabled) => parseInstalledPlugin(await call(SET_ENABLED_ENDPOINT, {
1094
1193
  id,
@@ -1152,7 +1251,11 @@ window.__ModuleLoader__.load({
1152
1251
  body: JSON.stringify({ id })
1153
1252
  });
1154
1253
  if (started.jobId === void 0) throw new Error("plugin-manager: gateway update returned no job");
1155
- return parseInstalledPlugin({ plugin: (await waitJob(started.jobId)).plugin });
1254
+ const job = await waitJob(started.jobId);
1255
+ return {
1256
+ plugin: parseInstalledPlugin({ plugin: job.plugin }),
1257
+ restartRequired: parseRestartRequired(job.restartRequired)
1258
+ };
1156
1259
  } finally {
1157
1260
  gatewayInflight = false;
1158
1261
  }