@linxin666/dsh-client-ui-plugin-manager 0.4.15 → 0.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +3 -3
- package/README.zh.md +3 -3
- package/lib/client.js +155 -31
- package/lib/client.js.map +1 -1
- package/lib/index.js +444 -270
- package/lib/types/client/PluginListToolbar.d.ts +18 -5
- package/lib/types/client/index.d.ts +13 -1
- package/lib/types/client/locales.d.ts +9 -0
- package/lib/types/core/protocol.d.ts +59 -0
- package/lib/types/host/gateway.d.ts +204 -74
- package/package.json +13 -13
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:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: f7cbe0b6ac71119a4e94bcb953f7b52c40965470
|
|
6
|
+
README.zh.md: 9da09347983f515a0fe57dae96c1d55c9605539d
|
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
|
|
|
8
|
-
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.2-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
9
|
|
|
10
10
|
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
11
|
</p>
|
|
@@ -20,7 +20,7 @@ An update and lifecycle manager for DeepSeek Harness (DSH) Web GUI and official
|
|
|
20
20
|
## What it does
|
|
21
21
|
|
|
22
22
|
- Contributes a check-for-updates block into the official Plugins page (the `plugins.detail.section` seat that page declares), rendered on an installed bundle's page and nowhere else. There is no tab of its own in the Plugins settings section.
|
|
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
|
|
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 in one host job, in order, with per-row progress — a row the host refuses is named in place with its own reason and the run carries on with the rows behind it; **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
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.
|
|
@@ -70,7 +70,7 @@ The contract source of truth is `src/core/service.ts` (`PluginManagerService`).
|
|
|
70
70
|
|
|
71
71
|
- Loopback-only: on a LAN or remote browser the update block renders a local-only notice (the same boundary the official installer page enforces; the gateway refuses non-loopback requests with 403).
|
|
72
72
|
- On the npm-published web runtime, gateway writes go through the official CLI. The gateway resolves `dsh` from the host process PATH first, then from `node_modules/.bin` project roots above the running host entry, then from the running host package's own `lib/bin.js`, and finally from the packaged Desktop install's own CLI launcher under the Electron resource directory (`runtime/cli/bin/dsh.cmd` on Windows, `runtime/cli/bin/dsh` elsewhere) — the last one covers a packaged Desktop, where the host runs from inside `app.asar`, the private host package ships no `lib/bin.js`, every `.bin` shim directory is stripped from the installer, and the launcher puts only the bundled `node` on the host's PATH. A Node-script CLI (an npm or homebrew shim, a `.bin` symlink, a `lib/bin.js`) runs under an interpreter resolved without PATH: the `node` installed beside the CLI when the installation ships one, otherwise the host's own interpreter. The CLI's own directory goes first on the child PATH, so the `dsh plugin` run finds the pnpm installed beside it. If no source contains the CLI, CLI-backed writes remain unavailable — an application-owned profile writes through the official in-process manager and needs no binary, so its install, update and removal routes never demand one. CLI output is decoded as bytes in one pass, so a Windows console's code page (CP936/GBK) renders as readable text instead of replacement characters. 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.
|
|
73
|
-
- 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.
|
|
73
|
+
- 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.2-rc.1 that manager also owns the replacement itself: `updateBundle(name, version, { requestId })` checks the target on the registry (it must exist, declare a bundle and accept the running DSH version), removes the installed version while the host mounts `hmr`, installs the target with the selection it found, and reinstalls the version it removed when that installation fails or is cancelled — so an update is one official call rather than a sequence this package assembles, and a failure leaves a working plugin because the manager itself puts the old version back. This half adds only the two facts that call does not cover: the bundle is put back at the index it held in `dsh.profile.bundles` (the removal and reinstall append it at the end, and that array is the layer order the loader applies patches in), and a `bundle-in-use` removal refusal is answered with exactly one retry against the state the guard's own reload left on disk, after which the report names the restart and restores the deselected bundle. A manager without `updateBundle` is reported as such instead of falling back to a hand-written replacement — the package's `dsh.engines.dsh` floor is that premise. The batch action rides the same primitive: one gateway job (`POST /api/plugin-manager/updates`) resolves each id with the single route's own rules and applies the rows in order, so a refused row is that row's answer rather than the end of the run. Every other runtime keeps the CLI as the single writer of installs, updates and removals.
|
|
74
74
|
- 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.
|
|
75
75
|
- 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.
|
|
76
76
|
- Restart is explicit, user-clicked and four-mode. The route is method-aware: `GET /api/plugin-manager/restart` reads the plan (returning `{ restart: { mode, unit? } }` with no side effects, so a prefetch or a typed URL can never stop a host) and `POST` carries it out (responding with `{ restart: { mode } }`); 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 a provable systemd user service (`INVOCATION_ID` exists, cgroup ends in `*.service` under `/user.slice/`, and `$XDG_RUNTIME_DIR/systemd/private` exists; system scope and other supervised launches remain manual), the confirmation panel explicitly names the unit to be restarted, and the host strictly answers 202 before requesting systemd to run `systemctl --user restart <unit>` (because systemd begins the stop job as soon as the request is queued), logging any failure to `$DSH_HOME/logs/plugin-manager-restart.log` while continuing to serve. 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 and no provable systemd user service (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.
|
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
|
|
|
8
|
-
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.2-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
9
|
|
|
10
10
|
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
11
|
</p>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
## 功能
|
|
21
21
|
|
|
22
22
|
- 向官方插件页注入「检查更新」区块(该页声明的 `plugins.detail.section` 席位),只渲染在已安装组合包的页面上;「插件」设置分区不再有本包自己的 Tab。
|
|
23
|
-
- 在该页 **已安装** 标题旁加一条列表级工具条。该标题是官方页面自己的 chrome,页面并未为它声明席位(扩展点是 `plugins.detail.*`、`plugins.item`、`plugins.bundle.config`、`plugins.row.config` 与 `plugins.bundle.activation`),因此工具条直接插入该元素,并靠家族共享的 body mutation hub 保持就位。一次点击检查全部已装插件;面板列出有新版本的第三方插件(当前运行时版本不够的行附上其声明的 DSH
|
|
23
|
+
- 在该页 **已安装** 标题旁加一条列表级工具条。该标题是官方页面自己的 chrome,页面并未为它声明席位(扩展点是 `plugins.detail.*`、`plugins.item`、`plugins.bundle.config`、`plugins.row.config` 与 `plugins.bundle.activation`),因此工具条直接插入该元素,并靠家族共享的 body mutation hub 保持就位。一次点击检查全部已装插件;面板列出有新版本的第三方插件(当前运行时版本不够的行附上其声明的 DSH 最低版本);「全部更新」用一个 host 任务按顺序应用合格行并显示逐行进度——被拒的行就地写明原因,整批继续跑后面的行;随后「立即重启」使更新生效(见「已知限制」中的重启说明)。官方 `@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
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。
|
|
@@ -70,7 +70,7 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
|
|
|
70
70
|
|
|
71
71
|
- 仅限本机:LAN 或远程浏览器只显示「仅限本机操作」提示(与官方安装器页同一边界;网关对非 loopback 请求返回 403)。
|
|
72
72
|
- npm 发布的官方 web 上,网关写入经官方 CLI 执行。网关先从 host 进程 PATH 解析 `dsh`,再从运行中 host 入口上层各项目根的 `node_modules/.bin` 回退查找,然后回退到运行中 host 包自身的 `lib/bin.js`,最后回退到桌面安装包自带的 CLI 启动器(位于 Electron 资源目录下:Windows 为 `runtime/cli/bin/dsh.cmd`,其他平台为 `runtime/cli/bin/dsh`)——最后这条覆盖打包桌面端:host 从 `app.asar` 内运行、私有 host 包不带 `lib/bin.js`、安装包剥除所有 `.bin` shim 目录,且启动器只把自带的 `node` 放进 host 的 PATH;Node 脚本形式的 CLI(npm/homebrew shim、`.bin` 符号链接、`lib/bin.js`)由不依赖 PATH 的解释器执行——安装包里 CLI 旁有 `node` 时用它,否则用 host 自身的解释器;CLI 所在目录放在子进程 PATH 首位,使 `dsh plugin` 运行能找到同处安装的 pnpm。全部来源都没有 CLI 时,走 CLI 的写入才不可用——应用自有 profile 由官方进程内管理器写入,不需要任何二进制,其安装、更新与卸载路由也不要求它。CLI 输出按字节一次性解码,Windows 中文控制台(CP936/GBK)的报错文本可读而不再是替换字符。git 源安装可能耗时数分钟,以后台任务运行。网关更新只适用于 npm registry 源,由 host 解析最新版本,且仅当同一已装包报告该精确版本时才算成功。
|
|
73
|
-
- 应用自有 profile(打包桌面客户端)的安装、更新与卸载走宿主挂载的官方进程内插件管理器——即该 profile 官方插件页所用的同一个写入器:CLI 直接拒绝 `--profile desktop`,启动器则把自带的包管理器调用交给该管理器。任务、状态轮询与校验与 CLI 路径一致:安装必须新增一条此前没有的依赖、卸载必须删除一条依赖、更新必须报告路由解析出的版本;而 CLI 专属的守卫(重复挂载剥离、insert 行与启动预检)仍留在 CLI 写入器一侧,因为该路径下官方管理器会自行校验并应用 bundle。管理器返回的判定会先于 profile 被读取:被拒绝的运行以 `application: 'failed'` 解析而不是抛错,因此任务上报该运行的真实原因(pnpm 诊断文本,或 `incompatible-version` 拒绝点名的包),而不是在 profile 未变之后给出一句空转文案。自 0.2.
|
|
73
|
+
- 应用自有 profile(打包桌面客户端)的安装、更新与卸载走宿主挂载的官方进程内插件管理器——即该 profile 官方插件页所用的同一个写入器:CLI 直接拒绝 `--profile desktop`,启动器则把自带的包管理器调用交给该管理器。任务、状态轮询与校验与 CLI 路径一致:安装必须新增一条此前没有的依赖、卸载必须删除一条依赖、更新必须报告路由解析出的版本;而 CLI 专属的守卫(重复挂载剥离、insert 行与启动预检)仍留在 CLI 写入器一侧,因为该路径下官方管理器会自行校验并应用 bundle。管理器返回的判定会先于 profile 被读取:被拒绝的运行以 `application: 'failed'` 解析而不是抛错,因此任务上报该运行的真实原因(pnpm 诊断文本,或 `incompatible-version` 拒绝点名的包),而不是在 profile 未变之后给出一句空转文案。自 0.2.2-rc.1 起,替换本身也由该管理器负责:`updateBundle(name, version, { requestId })` 先核验目标(必须存在、声明 bundle、接受当前 DSH 版本),宿主挂载 `hmr` 时移除已装版本,用找到的勾选状态安装目标,安装失败或取消时把被移除的版本装回——因此一次更新就是一次官方调用,而不是本包自己拼的阶段序列;失败时旧版本由管理器自己放回,插件仍是可用的。本包只补两件该调用没覆盖的事:更新落地后把这个组合包放回它在 `dsh.profile.bundles` 里的原位(移除加重装会把它追加到末尾,而该数组就是 loader 套用 patch 的层级顺序),以及 `bundle-in-use` 移除拒绝只重试一次、针对官方守卫自己 reload 后留下的状态,第二次仍被拒才在报告里点名重启并还原被取消的勾选。没有 `updateBundle` 的管理器会被如实报告,而不是退回手写的两阶段——本包 `dsh.engines.dsh` 的下限就是这个前提。批量动作走同一原语:一个网关任务(`POST /api/plugin-manager/updates`)按单条路由同一套规则解析每个 id,再按顺序逐条应用,因此被拒的行是那一行的答案,而不是整批的终点。其余运行时的安装、更新与卸载仍以 CLI 为唯一写入器。
|
|
74
74
|
- 兼容性门禁只在目标清单声明了最低 DSH 版本时生效;未声明 `dsh.engines.dsh` 的包更新不被检查,官方安装器运行时(DSHCode 与 checkout 版 web)不经过本门禁(其更新走官方安装器)。运行中的 DSH 版本读取安装自身的 `@deepseek-ai/dsh` 清单——启动器把它作为 profile 的 install anchor 发布——无需子进程、无需 PATH,因此打包桌面端也能作答;运行时不发布 anchor 时回退到 `dsh --version`。宿主完全无法核验的要求按「无法确认」呈现,而不是报成低于下限:两者都拦住更新,但只有后者会让用户去升级 DSH。
|
|
75
75
|
- npm 运行时上的启停显示下次启动的真实生效值:profile 覆盖行优先,其次由所装 bundle 自带的 `disabled` 行决定(聚合包的按需开启家族),两层都未提及的行视为启用。开启一个被 bundle 停用的行会写入显式 `disabled: false` 覆盖行——只删除用户行只会退回 bundle 默认值;该运行时 loader 在下次启动时认读这些行,但这条路径不如官方桌面写入器经过充分锻炼。
|
|
76
76
|
- 重启是显式、需用户点击且有四种模式的动作,路由按方法区分:`GET /api/plugin-manager/restart` 只读「重启方案」(wire 形状为 `{ restart: { mode, unit? } }`,无副作用,因此浏览器预取或直接输入 URL 都不会停掉宿主),`POST` 才执行(应答 `{ restart: { mode } }`);其他方法一律 405 拒绝。工具条先读方案,确认面板说的后果与实际执行的一致。终端启动(`dsh web`)时宿主启动一个 detached helper:等旧进程退出后按原命令行重新拉起,端口先释放再被替换进程绑定,替换进程的输出写入 `$DSH_HOME/logs/plugin-manager-restart.log`。可证明的 systemd 用户服务下(`INVOCATION_ID` 存在、cgroup 末段是 `*.service`、路径在 `/user.slice/` 下且 `$XDG_RUNTIME_DIR/systemd/private` 存在;system scope 与其它受监督启动维持 manual),确认面板会明确写明将要重启的 unit 名;执行时严格先应答 202 再请 systemd 执行 `systemctl --user restart <unit>` 由 systemd 停旧起新(因 stop job 在请求入队即开始),若命令失败只记录到 `$DSH_HOME/logs/plugin-manager-restart.log`,宿主继续服务。打包桌面应用下本插件无法重启任何东西——进程树归 Electron,detached 重拉只会与桌面外壳抢同一端口,而官方外壳对宿主退出只做 `fail("dsh desktop host stopped")` 并显示错误页,没有「请壳重启宿主」的通道——因此桌面端只在壳导出 `DSH_SHELL_RESTARTS_HOST=1`(宣告会把退出的宿主重新拉起)时才让宿主退出;壳没有这个保证时,重启面板如实写「当前进程无法自动重启,请手动重启 DSH。」、给出替代路径——退出 DeepSeek Harness 后重新打开,并且不提供确认按钮。无终端且非可证明 systemd 用户服务的启动(受监督进程、编辑器任务)同样保持不动,工具条提示手动重启。不重启时,更新后的插件代码在下次启动生效。
|
package/lib/client.js
CHANGED
|
@@ -1094,11 +1094,10 @@ window.__ModuleLoader__.load({
|
|
|
1094
1094
|
* list, and a restart tears this component down anyway.
|
|
1095
1095
|
*/
|
|
1096
1096
|
function PluginListToolbar(props) {
|
|
1097
|
-
const { t, isLoopback, checkUpdates,
|
|
1097
|
+
const { t, isLoopback, checkUpdates, updateAll, restartPlan, restart } = props;
|
|
1098
1098
|
const [phase, setPhase] = (0, react.useState)("idle");
|
|
1099
1099
|
const [checked, setChecked] = (0, react.useState)(false);
|
|
1100
1100
|
/** Every third-party row the last check reported, including the applied ones. */
|
|
1101
|
-
const [found, setFound] = (0, react.useState)(0);
|
|
1102
1101
|
const [rows, setRows] = (0, react.useState)([]);
|
|
1103
1102
|
const [applied, setApplied] = (0, react.useState)([]);
|
|
1104
1103
|
/**
|
|
@@ -1108,6 +1107,12 @@ window.__ModuleLoader__.load({
|
|
|
1108
1107
|
* claiming a plain success.
|
|
1109
1108
|
*/
|
|
1110
1109
|
const [restartRequired, setRestartRequired] = (0, react.useState)([]);
|
|
1110
|
+
/**
|
|
1111
|
+
* Rows the last run could not apply, with the host's reason. They stay in
|
|
1112
|
+
* `rows` — the user has to see which plugin is stuck and why, beside the
|
|
1113
|
+
* version it is stuck on — and only the whole-call failure reaches `error`.
|
|
1114
|
+
*/
|
|
1115
|
+
const [failures, setFailures] = (0, react.useState)([]);
|
|
1111
1116
|
const [cursor, setCursor] = (0, react.useState)(void 0);
|
|
1112
1117
|
const [error, setError] = (0, react.useState)(void 0);
|
|
1113
1118
|
const [panel, setPanel] = (0, react.useState)("none");
|
|
@@ -1137,9 +1142,9 @@ window.__ModuleLoader__.load({
|
|
|
1137
1142
|
checkUpdates().then((items) => {
|
|
1138
1143
|
const thirdParty = thirdPartyUpdates(items);
|
|
1139
1144
|
setRows(thirdParty);
|
|
1140
|
-
setFound(thirdParty.length);
|
|
1141
1145
|
setApplied([]);
|
|
1142
1146
|
setRestartRequired([]);
|
|
1147
|
+
setFailures([]);
|
|
1143
1148
|
setChecked(true);
|
|
1144
1149
|
setPanel("list");
|
|
1145
1150
|
}).catch((reason) => {
|
|
@@ -1157,30 +1162,30 @@ window.__ModuleLoader__.load({
|
|
|
1157
1162
|
busyRef.current = true;
|
|
1158
1163
|
setPhase("updating");
|
|
1159
1164
|
setError(void 0);
|
|
1160
|
-
(
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
}
|
|
1165
|
+
setFailures([]);
|
|
1166
|
+
updateAll(queue.map((row) => row.id), (row) => {
|
|
1167
|
+
setCursor({
|
|
1168
|
+
name: row.id,
|
|
1169
|
+
index: row.index,
|
|
1170
|
+
total: row.total
|
|
1171
|
+
});
|
|
1172
|
+
}).then((result) => {
|
|
1173
|
+
const landed = new Set(result.applied.map((row) => row.id));
|
|
1174
|
+
const restart = result.applied.filter((row) => row.restartRequired === true).map((row) => ({
|
|
1175
|
+
id: row.id,
|
|
1176
|
+
version: row.landed ?? ""
|
|
1177
|
+
}));
|
|
1178
|
+
setApplied((current) => [...current, ...result.applied.map((row) => row.id)]);
|
|
1179
|
+
setRestartRequired((current) => [...current, ...restart]);
|
|
1180
|
+
setFailures(result.failed.map((row) => ({
|
|
1181
|
+
id: row.id,
|
|
1182
|
+
error: row.error ?? t("updateFailedUnknown")
|
|
1183
|
+
})));
|
|
1184
|
+
setRows((current) => current.filter((item) => !landed.has(item.id)));
|
|
1185
|
+
}).catch((reason) => {
|
|
1186
|
+
setError(t("failed", { reason: messageOf(reason) }));
|
|
1187
|
+
}).finally(() => {
|
|
1182
1188
|
setCursor(void 0);
|
|
1183
|
-
})().finally(() => {
|
|
1184
1189
|
busyRef.current = false;
|
|
1185
1190
|
setPhase("idle");
|
|
1186
1191
|
});
|
|
@@ -1247,12 +1252,21 @@ window.__ModuleLoader__.load({
|
|
|
1247
1252
|
children: error
|
|
1248
1253
|
});
|
|
1249
1254
|
/** What is still pending after a partial run (the applied rows leave the list). */
|
|
1250
|
-
const remaining =
|
|
1255
|
+
const remaining = rows.length;
|
|
1256
|
+
const failedCount = failures.length;
|
|
1257
|
+
/**
|
|
1258
|
+
* One line for the whole run: the row in flight, what is still pending, and —
|
|
1259
|
+
* once nothing is — whether the run landed everything or only part of it. A
|
|
1260
|
+
* partial run must not read as a clean one.
|
|
1261
|
+
*/
|
|
1251
1262
|
const summary = cursor !== void 0 ? t("updatingAll", {
|
|
1252
1263
|
name: cursor.name,
|
|
1253
1264
|
index: String(cursor.index),
|
|
1254
1265
|
total: String(cursor.total)
|
|
1255
|
-
}) : remaining > 0 ? t("updatesAvailable", { count: String(remaining) }) :
|
|
1266
|
+
}) : remaining > 0 ? t("updatesAvailable", { count: String(remaining) }) : failedCount > 0 ? t("updateAllPartial", {
|
|
1267
|
+
done: String(applied.length),
|
|
1268
|
+
failed: String(failedCount)
|
|
1269
|
+
}) : applied.length > 0 ? t("updateAllDone") : t("noUpdates");
|
|
1256
1270
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1257
1271
|
className: plugin_manager_module_css_default.toolbar,
|
|
1258
1272
|
...shellProps,
|
|
@@ -1310,7 +1324,10 @@ window.__ModuleLoader__.load({
|
|
|
1310
1324
|
applied.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1311
1325
|
className: plugin_manager_module_css_default.ok,
|
|
1312
1326
|
"data-update-applied": true,
|
|
1313
|
-
children: t("
|
|
1327
|
+
children: failedCount > 0 ? t("updateAllPartial", {
|
|
1328
|
+
done: String(applied.length),
|
|
1329
|
+
failed: String(failedCount)
|
|
1330
|
+
}) : t("updateAllDone")
|
|
1314
1331
|
}),
|
|
1315
1332
|
restartRequired.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1316
1333
|
className: plugin_manager_module_css_default.restartRequired,
|
|
@@ -1335,6 +1352,7 @@ window.__ModuleLoader__.load({
|
|
|
1335
1352
|
className: plugin_manager_module_css_default.panelList,
|
|
1336
1353
|
children: rows.map((row) => {
|
|
1337
1354
|
const gate = dshGateOf(row);
|
|
1355
|
+
const failure = failures.find((item) => item.id === row.id);
|
|
1338
1356
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
1339
1357
|
className: plugin_manager_module_css_default.panelRow,
|
|
1340
1358
|
"data-update-row": row.id,
|
|
@@ -1356,6 +1374,11 @@ window.__ModuleLoader__.load({
|
|
|
1356
1374
|
className: plugin_manager_module_css_default.compatBlocked,
|
|
1357
1375
|
"data-update-row-compat-reason": gate,
|
|
1358
1376
|
children: row.requiresDsh !== void 0 ? t(gate === "unverified" ? "updateUnverifiedDsh" : "updateBlockedDsh", { min: displayMinimumVersion(row.requiresDsh) }) : t("updateUnverifiedDshUnknownRange")
|
|
1377
|
+
}),
|
|
1378
|
+
failure === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1379
|
+
className: plugin_manager_module_css_default.compatBlocked,
|
|
1380
|
+
"data-update-row-error": failure.id,
|
|
1381
|
+
children: t("updateFailedRow", { reason: failure.error })
|
|
1359
1382
|
})
|
|
1360
1383
|
]
|
|
1361
1384
|
}, row.id);
|
|
@@ -1502,6 +1525,9 @@ window.__ModuleLoader__.load({
|
|
|
1502
1525
|
"updateAll": "全部更新({count})",
|
|
1503
1526
|
"updatingAll": "更新 {name}({index}/{total})",
|
|
1504
1527
|
"updateAllDone": "更新完成,重启后生效。",
|
|
1528
|
+
"updateAllPartial": "已更新 {done} 个,{failed} 个失败",
|
|
1529
|
+
"updateFailedRow": "更新失败:{reason}",
|
|
1530
|
+
"updateFailedUnknown": "宿主没有说明失败原因",
|
|
1505
1531
|
"updateRestartRequired": "已更新到 {version},需重启 DSH 后生效",
|
|
1506
1532
|
"updatesPanelTitle": "插件更新",
|
|
1507
1533
|
"thirdPartyOnly": "只检查第三方插件;官方 @deepseek-ai/ 包随 DSH 本体升级。",
|
|
@@ -1574,6 +1600,9 @@ window.__ModuleLoader__.load({
|
|
|
1574
1600
|
"updateAll": "Update all ({count})",
|
|
1575
1601
|
"updatingAll": "Updating {name} ({index}/{total})",
|
|
1576
1602
|
"updateAllDone": "Updated; restart to take effect.",
|
|
1603
|
+
"updateAllPartial": "Updated {done}; {failed} failed",
|
|
1604
|
+
"updateFailedRow": "Update failed: {reason}",
|
|
1605
|
+
"updateFailedUnknown": "The host gave no reason",
|
|
1577
1606
|
"updateRestartRequired": "Updated to {version}; restart DSH for it to take effect",
|
|
1578
1607
|
"updatesPanelTitle": "Plugin updates",
|
|
1579
1608
|
"thirdPartyOnly": "Third-party plugins only; @deepseek-ai/ packages upgrade with DSH itself.",
|
|
@@ -1771,6 +1800,54 @@ window.__ModuleLoader__.load({
|
|
|
1771
1800
|
});
|
|
1772
1801
|
}
|
|
1773
1802
|
/**
|
|
1803
|
+
* Validate and normalize the rows of a batch update, as a gateway job carries
|
|
1804
|
+
* them under `results`.
|
|
1805
|
+
*
|
|
1806
|
+
* Deliberately tolerant in the same way {@link parseRestartRequired} is: every
|
|
1807
|
+
* row is an outcome the panel has to render, and refusing the whole list over one
|
|
1808
|
+
* malformed row would hide the rows that did land. A row missing its id or phase
|
|
1809
|
+
* is that row's problem, so it is dropped rather than thrown; an unreadable
|
|
1810
|
+
* `results` value reads as "no rows", which the caller shows as a run without a
|
|
1811
|
+
* per-row verdict.
|
|
1812
|
+
* @param value - decoded but untrusted job value.
|
|
1813
|
+
* @returns the typed rows, in the order the host applied them.
|
|
1814
|
+
*/
|
|
1815
|
+
function parseUpdateOutcomes(value) {
|
|
1816
|
+
if (!Array.isArray(value)) return [];
|
|
1817
|
+
const rows = [];
|
|
1818
|
+
for (const item of value) {
|
|
1819
|
+
if (!isRecord(item) || !isString(item.id) || item.id === "") continue;
|
|
1820
|
+
const phase = item.phase;
|
|
1821
|
+
if (phase !== "pending" && phase !== "running" && phase !== "done" && phase !== "error") continue;
|
|
1822
|
+
const row = {
|
|
1823
|
+
id: item.id,
|
|
1824
|
+
phase
|
|
1825
|
+
};
|
|
1826
|
+
if (isString(item.targetVersion) && item.targetVersion !== "") row.targetVersion = item.targetVersion;
|
|
1827
|
+
if (isString(item.landed) && item.landed !== "") row.landed = item.landed;
|
|
1828
|
+
if (isString(item.error) && item.error !== "") row.error = item.error;
|
|
1829
|
+
if (item.restartRequired === true) row.restartRequired = true;
|
|
1830
|
+
rows.push(row);
|
|
1831
|
+
}
|
|
1832
|
+
return rows;
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* Split a finished batch's rows by outcome, the shape the toolbar renders.
|
|
1836
|
+
* A row still in flight is neither: it is simply not in either half.
|
|
1837
|
+
* @param rows - the rows the host reported.
|
|
1838
|
+
* @returns the applied and failed rows.
|
|
1839
|
+
*/
|
|
1840
|
+
function batchUpdateResult(rows) {
|
|
1841
|
+
const applied = [];
|
|
1842
|
+
const failed = [];
|
|
1843
|
+
for (const row of rows) if (row.phase === "done") applied.push(row);
|
|
1844
|
+
else if (row.phase === "error") failed.push(row);
|
|
1845
|
+
return {
|
|
1846
|
+
applied,
|
|
1847
|
+
failed
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1850
|
+
/**
|
|
1774
1851
|
* Validate and normalize a `restart` response value, reading the mode a POST
|
|
1775
1852
|
* answer carries.
|
|
1776
1853
|
* @param value - decoded but untrusted response value.
|
|
@@ -1840,7 +1917,7 @@ window.__ModuleLoader__.load({
|
|
|
1840
1917
|
/** The building package's version, when the bundle carries it. */
|
|
1841
1918
|
function bakedVersion() {
|
|
1842
1919
|
try {
|
|
1843
|
-
return "0.4.
|
|
1920
|
+
return "0.4.17";
|
|
1844
1921
|
} catch {
|
|
1845
1922
|
return;
|
|
1846
1923
|
}
|
|
@@ -1930,6 +2007,7 @@ window.__ModuleLoader__.load({
|
|
|
1930
2007
|
const LIST_ENDPOINT = "list";
|
|
1931
2008
|
const INSTALL_ENDPOINT = "install";
|
|
1932
2009
|
const UPDATE_ENDPOINT = "update";
|
|
2010
|
+
const UPDATES_ENDPOINT = "updates";
|
|
1933
2011
|
const UNINSTALL_ENDPOINT = "uninstall";
|
|
1934
2012
|
const SET_ENABLED_ENDPOINT = "set-enabled";
|
|
1935
2013
|
const CHECK_UPDATES_ENDPOINT = "check-updates";
|
|
@@ -1947,6 +2025,10 @@ window.__ModuleLoader__.load({
|
|
|
1947
2025
|
"locale",
|
|
1948
2026
|
"connection"
|
|
1949
2027
|
];
|
|
2028
|
+
/** Error text for a failed call, keeping the reason a thrown value carries. */
|
|
2029
|
+
function failureText(error) {
|
|
2030
|
+
return error instanceof Error ? error.message : String(error);
|
|
2031
|
+
}
|
|
1950
2032
|
/**
|
|
1951
2033
|
* Build the dual-channel face once: official-channel and gateway-channel
|
|
1952
2034
|
* implementations, the mode detection that picks between them, and the
|
|
@@ -1977,7 +2059,30 @@ window.__ModuleLoader__.load({
|
|
|
1977
2059
|
})),
|
|
1978
2060
|
checkUpdates: async () => parseUpdateList(await call(CHECK_UPDATES_ENDPOINT, {})),
|
|
1979
2061
|
status: async () => parseInstallStatus(await call(STATUS_ENDPOINT, {})),
|
|
1980
|
-
failures: async () => parseFailuresSnapshot(await call(FAILURES_ENDPOINT, {}))
|
|
2062
|
+
failures: async () => parseFailuresSnapshot(await call(FAILURES_ENDPOINT, {})),
|
|
2063
|
+
updateAll: async (ids) => {
|
|
2064
|
+
const applied = [];
|
|
2065
|
+
const failed = [];
|
|
2066
|
+
for (const id of ids) try {
|
|
2067
|
+
const result = await official.update(id);
|
|
2068
|
+
applied.push({
|
|
2069
|
+
id,
|
|
2070
|
+
phase: "done",
|
|
2071
|
+
landed: result.plugin.version,
|
|
2072
|
+
...result.restartRequired.length > 0 ? { restartRequired: true } : {}
|
|
2073
|
+
});
|
|
2074
|
+
} catch (error) {
|
|
2075
|
+
failed.push({
|
|
2076
|
+
id,
|
|
2077
|
+
phase: "error",
|
|
2078
|
+
error: failureText(error)
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
return {
|
|
2082
|
+
applied,
|
|
2083
|
+
failed
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
1981
2086
|
};
|
|
1982
2087
|
const gatewayJson = async (path, init) => {
|
|
1983
2088
|
const response = await fetch(path, {
|
|
@@ -2042,6 +2147,19 @@ window.__ModuleLoader__.load({
|
|
|
2042
2147
|
gatewayInflight = false;
|
|
2043
2148
|
}
|
|
2044
2149
|
},
|
|
2150
|
+
updateAll: async (ids) => {
|
|
2151
|
+
gatewayInflight = true;
|
|
2152
|
+
try {
|
|
2153
|
+
const started = await gatewayJson(`${GATEWAY_PREFIX}/${UPDATES_ENDPOINT}`, {
|
|
2154
|
+
method: "POST",
|
|
2155
|
+
body: JSON.stringify({ ids: [...ids] })
|
|
2156
|
+
});
|
|
2157
|
+
if (started.jobId === void 0) throw new Error("plugin-manager: gateway updates returned no job");
|
|
2158
|
+
return batchUpdateResult(parseUpdateOutcomes((await waitJob(started.jobId)).results));
|
|
2159
|
+
} finally {
|
|
2160
|
+
gatewayInflight = false;
|
|
2161
|
+
}
|
|
2162
|
+
},
|
|
2045
2163
|
uninstall: async (id) => {
|
|
2046
2164
|
gatewayInflight = true;
|
|
2047
2165
|
try {
|
|
@@ -2112,6 +2230,11 @@ window.__ModuleLoader__.load({
|
|
|
2112
2230
|
notifyChange();
|
|
2113
2231
|
return item;
|
|
2114
2232
|
},
|
|
2233
|
+
updateAll: async (ids) => {
|
|
2234
|
+
const result = await (await ensureMode() === "official" ? official.updateAll(ids) : gateway.updateAll(ids));
|
|
2235
|
+
if (result.applied.length > 0) notifyChange();
|
|
2236
|
+
return result;
|
|
2237
|
+
},
|
|
2115
2238
|
uninstall: async (id) => {
|
|
2116
2239
|
const rows = await (await ensureMode() === "official" ? official.uninstall(id) : gateway.uninstall(id));
|
|
2117
2240
|
notifyChange();
|
|
@@ -2164,6 +2287,7 @@ window.__ModuleLoader__.load({
|
|
|
2164
2287
|
isLoopback: face.isLoopback,
|
|
2165
2288
|
checkUpdates: face.checkUpdates,
|
|
2166
2289
|
update: face.update,
|
|
2290
|
+
updateAll: face.updateAll,
|
|
2167
2291
|
restartPlan: face.restartPlan,
|
|
2168
2292
|
restart: face.restart,
|
|
2169
2293
|
t: ctx.locale.bind(NS)
|