@linxin666/dsh-client-ui-plugin-manager 0.4.3 → 0.4.5
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 +22 -8
- package/README.zh.md +22 -8
- package/cordis.patch.yml +14 -1
- package/lib/client.js +569 -10
- package/lib/client.js.map +1 -1
- package/lib/index.js +393 -22
- package/lib/types/client/PluginListToolbar.d.ts +44 -0
- package/lib/types/client/body-mutations.d.ts +45 -0
- package/lib/types/client/index.d.ts +18 -1
- package/lib/types/client/locales.d.ts +54 -2
- package/lib/types/client/plugin-toolbar-mount.d.ts +47 -0
- package/lib/types/core/protocol.d.ts +13 -0
- package/lib/types/core/updates.d.ts +30 -0
- package/lib/types/core/version.d.ts +4 -1
- package/lib/types/host/gateway.d.ts +107 -3
- package/lib/types/host/restart.d.ts +95 -0
- package/lib/types/host/routes.d.ts +10 -1
- package/lib/types/host/state.d.ts +3 -1
- package/lib/types/index.d.ts +7 -2
- 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: 5640ee3101ede09b832e8e97797b56f9b894c1c3
|
|
6
|
+
README.zh.md: 59a16689e1e6c8bb63f525a4033bf0e6f4a91bb6
|
package/README.md
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-plugin-manager · Client Plugin Manager & Lifecycle Control UI for DeepSeek Harness (DSH)
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://img.shields.io/npm/v/@linxin666/dsh-client-ui-plugin-manager?style=flat-square" alt="Version">
|
|
7
|
+
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.0--rc.2-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
|
+
|
|
10
|
+
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<strong>Client Plugin Manager & Lifecycle Control UI for DeepSeek Harness (DSH)</strong><br>
|
|
15
|
+
<em>Installed Plugin Version Checks · One-Click Batch Updates · Runtime Compatibility Gate · Safety Rollback · Dual Channels</em>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
An update and lifecycle manager for DeepSeek Harness (DSH) Web GUI and official desktop client: adds real-time registry version comparisons with DSH runtime compatibility checks directly into the official Plugins page, providing list-level batch updates, safe rollback mechanisms, and restart-to-apply workflows.
|
|
6
19
|
|
|
7
20
|
## What it does
|
|
8
21
|
|
|
9
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.
|
|
10
|
-
-
|
|
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
|
+
- 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.
|
|
11
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.
|
|
12
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.
|
|
13
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.
|
|
@@ -53,11 +67,11 @@ The contract source of truth is `src/core/service.ts` (`PluginManagerService`).
|
|
|
53
67
|
## Known limitations
|
|
54
68
|
|
|
55
69
|
- 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).
|
|
56
|
-
- 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, and finally from the running host package's own `lib/bin.js` — which covers local-wrapper and npx launches and the packaged desktop runtime, where the CLI ships beside the host process and every `.bin` shim directory is stripped from the installer. 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, writes remain unavailable. 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.
|
|
57
|
-
- An application-owned profile (the packaged Desktop client) runs updates 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 —
|
|
70
|
+
- 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, and finally from the running host package's own `lib/bin.js` — which covers local-wrapper and npx launches and the packaged desktop runtime, where the CLI ships beside the host process and every `.bin` shim directory is stripped from the installer. 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.
|
|
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. Every other runtime keeps the CLI as the single writer of installs, updates and removals.
|
|
58
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.
|
|
59
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.
|
|
60
|
-
- The
|
|
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.
|
|
61
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).
|
|
62
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.
|
|
63
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.
|
|
@@ -66,8 +80,8 @@ The contract source of truth is `src/core/service.ts` (`PluginManagerService`).
|
|
|
66
80
|
## Security model
|
|
67
81
|
|
|
68
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" }`.
|
|
69
|
-
- 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.
|
|
70
|
-
- 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 application-owned profile updates 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.
|
|
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.
|
|
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. 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.
|
|
71
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.
|
|
72
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.
|
|
73
87
|
- 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).
|
package/README.zh.md
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-plugin-manager · DeepSeek Harness (DSH) 客户端插件可视化管理与启停中心
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://img.shields.io/npm/v/@linxin666/dsh-client-ui-plugin-manager?style=flat-square" alt="Version">
|
|
7
|
+
|
|
8
|
+
<img src="https://img.shields.io/badge/DSH-%3E%3D0.2.0--rc.2-4c6ef5?style=flat-square&labelColor=454a54" alt="DSH">
|
|
9
|
+
|
|
10
|
+
<img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<strong>DeepSeek Harness(DSH)官方 Web GUI 与桌面客户端插件生命周期与更新管理中心</strong><br>
|
|
15
|
+
<em>已装插件版本比对 · 一键批量检查更新 · 运行时兼容性门禁 · 冲突预检与安全回滚 · 桌面客户端与 Web 双通道</em>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
面向 dsh web GUI 与官方桌面客户端「插件」面板的更新检查与生命周期管理插件:补齐官方插件管理页没有的能力——把已装插件与其 registry 来源的版本比对(含 DSH 运行时兼容门禁)作为插件页内的一个区块渲染,并在该页「已安装」标题旁加一条列表级工具条:一次检查全部已装插件,一键更新其中的第三方插件,再重启 DSH 使更新生效。安装、卸载与启停由官方页面负责(面板归它所有)。
|
|
6
19
|
|
|
7
20
|
## 功能
|
|
8
21
|
|
|
9
22
|
- 向官方插件页注入「检查更新」区块(该页声明的 `plugins.detail.section` 席位),只渲染在已安装组合包的页面上;「插件」设置分区不再有本包自己的 Tab。
|
|
10
|
-
-
|
|
23
|
+
- 在该页 **已安装** 标题旁加一条列表级工具条。该标题是官方页面自己的 chrome,页面并未为它声明席位(扩展点是 `plugins.detail.*`、`plugins.item`、`plugins.bundle.config`、`plugins.row.config` 与 `plugins.bundle.activation`),因此工具条直接插入该元素,并靠家族共享的 body mutation hub 保持就位。一次点击检查全部已装插件;面板列出有新版本的第三方插件(当前运行时版本不够的行附上其声明的 DSH 最低版本);「全部更新」逐条应用合格行并显示逐行进度,遇到第一个失败即停止并把其余行留在列表里;随后「立即重启」使更新生效(见「已知限制」中的重启说明)。官方 `@deepseek-ai/` 包绝不参与批量更新——它们的版本属于 DSH 安装本身。
|
|
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。
|
|
11
25
|
- 检测旧聚合包 `@linxin666/dsh-web-ui-all`,把更新动作转换为到 `@linxin666/dsh-web-all` 的事务迁移;网关先移除旧包、安装精确版本的新包、恢复旧聚合包的层顺序,并在 `--dump-config` 通过后才报告成功。
|
|
12
26
|
- 更新前校验 DSH 运行时兼容(issue #754):更新检查读取最新版本清单声明的 DSH 最低版本(`dsh.engines.dsh`,兼容回退读顶层 `engines.dsh`),在更新动作旁显示要求,运行 DSH 低于要求时禁用它;host 更新路由在启动任何 CLI 任务前若无法核实时也会返回 412 并拒绝。
|
|
13
27
|
- npm 运行时保护下次启动:安装后网关校验依赖真实落盘、拒绝重复入口 id 认领与引用不可解析包的 insert 行,并用 CLI 的 `--dump-config` 做组合预检;冲突或失败的安装会经官方 remove 路径自动回滚,绝不触碰现有插件。
|
|
@@ -53,11 +67,11 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
|
|
|
53
67
|
## 已知限制
|
|
54
68
|
|
|
55
69
|
- 仅限本机:LAN 或远程浏览器只显示「仅限本机操作」提示(与官方安装器页同一边界;网关对非 loopback 请求返回 403)。
|
|
56
|
-
- npm 发布的官方 web 上,网关写入经官方 CLI 执行。网关先从 host 进程 PATH 解析 `dsh`,再从运行中 host 入口上层各项目根的 `node_modules/.bin` 回退查找,最后回退到运行中 host 包自身的 `lib/bin.js`——覆盖本地包装器与 npx 启动,以及桌面安装包运行时(CLI 与 host 进程同处一树,且安装包会剥除所有 `.bin` shim 目录);Node 脚本形式的 CLI(npm/homebrew shim、`.bin` 符号链接、`lib/bin.js`)由不依赖 PATH 的解释器执行——安装包里 CLI 旁有 `node` 时用它,否则用 host 自身的解释器;CLI 所在目录放在子进程 PATH 首位,使 `dsh plugin` 运行能找到同处安装的 pnpm。全部来源都没有 CLI
|
|
57
|
-
- 应用自有 profile
|
|
70
|
+
- npm 发布的官方 web 上,网关写入经官方 CLI 执行。网关先从 host 进程 PATH 解析 `dsh`,再从运行中 host 入口上层各项目根的 `node_modules/.bin` 回退查找,最后回退到运行中 host 包自身的 `lib/bin.js`——覆盖本地包装器与 npx 启动,以及桌面安装包运行时(CLI 与 host 进程同处一树,且安装包会剥除所有 `.bin` shim 目录);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 解析最新版本,且仅当同一已装包报告该精确版本时才算成功。
|
|
71
|
+
- 应用自有 profile(打包桌面客户端)的安装、更新与卸载走宿主挂载的官方进程内插件管理器——即该 profile 官方插件页所用的同一个写入器:CLI 直接拒绝 `--profile desktop`,启动器则把自带的包管理器调用交给该管理器。任务、状态轮询与校验与 CLI 路径一致:安装必须新增一条此前没有的依赖、卸载必须删除一条依赖、更新必须报告路由解析出的版本;而 CLI 专属的守卫(重复挂载剥离、insert 行与启动预检)仍留在 CLI 写入器一侧,因为该路径下官方管理器会自行校验并应用 bundle。管理器返回的判定会先于 profile 被读取:被拒绝的运行以 `application: 'failed'` 解析而不是抛错,因此任务上报该运行的真实原因(pnpm 诊断文本,或 `incompatible-version` 拒绝点名的包),而不是在 profile 未变之后给出一句空转文案。其余运行时的安装、更新与卸载仍以 CLI 为唯一写入器。
|
|
58
72
|
- 兼容性门禁只在目标清单声明了最低 DSH 版本时生效;未声明 `dsh.engines.dsh` 的包更新不被检查,官方安装器运行时(DSHCode 与 checkout 版 web)不经过本门禁(其更新走官方安装器)。
|
|
59
73
|
- npm 运行时上的启停显示下次启动的真实生效值:profile 覆盖行优先,其次由所装 bundle 自带的 `disabled` 行决定(聚合包的按需开启家族),两层都未提及的行视为启用。开启一个被 bundle 停用的行会写入显式 `disabled: false` 覆盖行——只删除用户行只会退回 bundle 默认值;该运行时 loader 在下次启动时认读这些行,但这条路径不如官方桌面写入器经过充分锻炼。
|
|
60
|
-
- web
|
|
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 后重新打开。无终端的启动(受监督进程、编辑器任务)保持不动,工具条提示手动重启。不重启时,更新后的插件代码在下次启动生效。
|
|
61
75
|
- npm 运行时上重复 insert id 认领在安装后即被检出并自动回滚新插件(共享 id 写 disabled 无法阻止 loader 的重复检查,只会误伤现有插件)。
|
|
62
76
|
- npm 运行时的启动预检(`--dump-config`)能抓组合失败,静态 insert 检查能抓引用不存在包的 insert 行;真正的运行时 import/apply 失败仍要到下次启动才暴露。
|
|
63
77
|
- 重复挂载保护(网关模式):官方 CLI 的 bundle 对账会在任何安装/卸载后把所有声明 `dsh.bundle` 的依赖重新加进 `dsh.profile.bundles`——包括组合树里已由 patch 行挂载的包(bundle 以 patch 行挂载外部插件时),下次启动会重复挂载而失败(`duplicate prefix route`)。每次 CLI 变更成功后,网关只把「本次新增且已被 patch 行挂载」的 bundles 条目剥除(清单写入走备份 + tmp + 原子 rename),并在任务结果上为每个被剥除的条目发一条 notice;正常安装的 bundles 条目与用户此前已有的条目一律不动。
|
|
@@ -66,8 +80,8 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
|
|
|
66
80
|
## 安全模型
|
|
67
81
|
|
|
68
82
|
- 信任边界是 loopback 门禁:每条网关路由都要求 loopback socket 地址、loopback Host 头与非跨站来源(socket + Host + Origin + `sec-fetch-site` 四重),与官方安装器通道同一权威。远程来源的浏览器没有可达路径;被拒请求返回 HTTP 403 与 `{ ok: false, error: "forbidden: loopback-only" }`。
|
|
69
|
-
- 变更类路由(install / update / remove / set-enabled)不带 token:loopback
|
|
70
|
-
- 安装 spec 与包 id 含命令行展开字符或控制字符时一律拒绝。Windows 下,npm shim 会解析为 `node.exe` 加包内 `bin.js`;DSH Desktop 打包 shim 附近没有 npm 布局,因此通过带完整预引用、逐字参数封套的 `cmd.exe /d /s /c` 执行。桌面 profile 从打包启动器环境值或持久化的 profile 选择中读取;应用自有 profile
|
|
83
|
+
- 变更类路由(install / update / remove / set-enabled / restart)不带 token:loopback 权威即本机用户,与官方通道同模型。重启路由是唯一作用在进程层面的路由:它绝不臆造命令行(只重放本进程自身的 `execPath` + argv,并剔除 inspector 开关),对无法确认为终端启动的宿主拒绝重拉,在打包桌面应用下只让本进程退出而把后续交给外壳。因此任何本机进程都能驱动插件安装与卸载,且 npm 安装会执行包的 install 脚本——请将本网关视为「设计上即本机代码执行」,绝不暴露到 loopback 之外。
|
|
84
|
+
- 安装 spec 与包 id 含命令行展开字符或控制字符时一律拒绝。Windows 下,npm shim 会解析为 `node.exe` 加包内 `bin.js`;DSH Desktop 打包 shim 附近没有 npm 布局,因此通过带完整预引用、逐字参数封套的 `cmd.exe /d /s /c` 执行。桌面 profile 从打包启动器环境值或持久化的 profile 选择中读取;应用自有 profile 的安装、更新与卸载由 host 半区直接调用宿主挂载的官方 `pluginManager` 服务(与官方插件页经自身 RPC 面驱动的是同一个写入器),其权威同样是 loopback 门禁加用户点击。
|
|
71
85
|
- 变更经同一队列串行,并发任务的 before/after profile 快照绝不交错。安装只有在依赖真实落入 profile 后才判 done(卸载以依赖消失为准),绝不轻信成功退出码。
|
|
72
86
|
- 启停操作会在该变更队列内重新读取最新 profile 清单,并在写入前以 `404` 拒绝过期或未知的包 id,因此卸载后遗留在面板里的旧行不会制造孤儿 `disabled` 覆盖。
|
|
73
87
|
- 冲突处置是 owner-aware 的:重复入口 id 或引用不可解析包的 insert 行会经官方 remove 路径回滚**新**包;网关绝不对共享 id 写 `disabled` 行(那既阻止不了 loader 的重复检查,又会误伤现有插件)。
|
package/cordis.patch.yml
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
# profile roster. Applied as a profile bundle layer (the `dsh.bundle.patch`
|
|
3
3
|
# manifest field); install with
|
|
4
4
|
# `dsh plugin --profile web add link:<repo>/packages/dsh-plugin-manager`.
|
|
5
|
+
#
|
|
6
|
+
# The row id lives in the loader's GLOBAL id space, one entry per id with
|
|
7
|
+
# later-wins and no diagnostic. The official @deepseek-ai/dsh-web-app bundle
|
|
8
|
+
# already claims `ui-plugin-manager` for its own plugin page (the half that
|
|
9
|
+
# registers the sidebar "Plugins" entry), so this package claims its own id
|
|
10
|
+
# instead; sharing the official id dropped the official row silently and the
|
|
11
|
+
# sidebar entry disappeared with the whole plugin management page.
|
|
12
|
+
#
|
|
13
|
+
# The row `name` must stay exactly the package name: the official
|
|
14
|
+
# @deepseek-ai/dsh-client-modules mounts a package's browser half on the loader
|
|
15
|
+
# row whose specifier resolves to that package's own manifest, so a subpath
|
|
16
|
+
# name (the aggregate's `@linxin666/dsh-web-all/plugin-manager` shape) would
|
|
17
|
+
# mount the host half only.
|
|
5
18
|
- insert:
|
|
6
|
-
- id: ui-plugin-manager
|
|
19
|
+
- id: ui-plugin-manager-update-check
|
|
7
20
|
name: '@linxin666/dsh-client-ui-plugin-manager'
|