@linxin666/dsh-client-ui-plugin-manager 0.4.2 → 0.4.4
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 +17 -25
- package/README.zh.md +17 -25
- package/lib/client.js +170 -913
- package/lib/client.js.map +1 -1
- package/lib/index.js +596 -55
- package/lib/types/client/PluginUpdatePatch.d.ts +70 -0
- package/lib/types/client/index.d.ts +33 -21
- package/lib/types/client/locales.d.ts +19 -170
- package/lib/types/core/conflict.d.ts +13 -35
- package/lib/types/core/protocol.d.ts +0 -13
- package/lib/types/host/gateway.d.ts +217 -9
- package/lib/types/host/profile.d.ts +60 -5
- package/lib/types/host/routes.d.ts +5 -1
- package/lib/types/mount-once.d.ts +38 -7
- package/package.json +15 -19
- package/lib/types/client/PluginManagerTab.d.ts +0 -32
- package/lib/types/core/repair.d.ts +0 -58
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: 0993b379775c06c6fd6a2c26d0c454f1c3a22d50
|
|
6
|
+
README.zh.md: f3e5ada8df6a2641133bad312206015aa75b1cc3
|
package/README.md
CHANGED
|
@@ -2,23 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
Update
|
|
5
|
+
Update checking for the dsh web GUI's Plugins panel: it contributes the one surface the official plugin manager page does not own — comparing an installed plugin against the version its registry source serves, with the DSH-runtime compatibility gate — as a section inside that page. Installing, uninstalling, enabling and disabling belong to the official page, which owns the panel; this package used to add a separate `Plugin manager` tab there and no longer does.
|
|
6
6
|
|
|
7
7
|
## What it does
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- Dual-channel transport: on runtimes with the official installer services (DSHCode and the 1.0.4 checkout web), every operation rides the official `/plugin-installer` and `/plugin-control` loopback RPC channels; on the npm-published web runtime those channels do not exist, so the package's host half mounts a loopback-fenced HTTP gateway that spawns the official `dsh plugin` CLI for installs/removals (the single writer) and writes `disabled` override rows for enablement.
|
|
11
|
-
- Renders the inventory read-only and points at the official plugin manager page (the `Plugins` sidebar entry) for installing, uninstalling and switching a bundle or a row; the official page applies those changes live.
|
|
12
|
-
- Lists installed user plugins with name, version, source badge and effective state, with registry update checks (npm sources) and verified npm updates.
|
|
13
|
-
- Grouped aggregate rows stay readable: a bundle claiming several entry rows, such as `@linxin666/dsh-web-all`, expands into a child list showing every family plugin's effective state, with locked rows noted. The rows' switches live on the official page.
|
|
14
|
-
- The aggregate child list is collapsed by default: the row shows only a `N/M child plugins on` summary that expands on click, so a bundle carrying 20+ family rows no longer stretches the settings page.
|
|
9
|
+
- 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
|
+
- 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.
|
|
15
11
|
- 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.
|
|
16
|
-
- 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
|
|
17
|
-
-
|
|
18
|
-
- Surfaces the install-conflict ledger: the changes the host recorded around the last install or update through this package's gateway channel, or the product-snapshot diff around an update this tab performs on the official channel, with undo for reversible actions and an `Ask the agent to fix` handoff on every conflict row.
|
|
19
|
-
- Protects the next boot on the npm runtime: after each install the gateway verifies the dependency actually landed, rejects duplicate entry-id claims and insert rows naming unresolvable packages, and composes the profile with the CLI's `--dump-config` preflight; a conflicting or failing install is rolled back through the official remove path (the existing plugins are never touched), with the error and repair handoff on the error row.
|
|
20
|
-
- Renders the boot-failure ring per plugin with `Ask the agent to fix` (a repair conversation over the plugin install root) and `Copy error`.
|
|
21
|
-
- Shows the host's safe-mode banner and the `Restore normal mode` affordance (the web build applies it at the next manual restart).
|
|
12
|
+
- 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
|
+
- 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.
|
|
22
14
|
|
|
23
15
|
## Install
|
|
24
16
|
|
|
@@ -37,11 +29,11 @@ pnpm install && pnpm -r build
|
|
|
37
29
|
dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
|
|
38
30
|
```
|
|
39
31
|
|
|
40
|
-
Restart `dsh web`; the
|
|
32
|
+
Restart `dsh web`; the update block appears on a bundle's page inside the official Plugins panel.
|
|
41
33
|
|
|
42
34
|
## Config
|
|
43
35
|
|
|
44
|
-
The
|
|
36
|
+
The package carries no configuration namespace. Update writes apply at the next restart.
|
|
45
37
|
|
|
46
38
|
## Cordis service
|
|
47
39
|
|
|
@@ -56,32 +48,32 @@ The browser half provides the shared dual-channel face as the cordis service `pl
|
|
|
56
48
|
- `setEnabled(id, enabled): Promise<InstalledPluginItem>` — flip one plugin's next-start enablement through the active channel (official installer RPC or gateway patch `disabled` row); takes effect after the host restart.
|
|
57
49
|
- `onChange(cb): () => void` — subscribe to successful mutations; fires after `install()`, `update()`, `uninstall()`, or `setEnabled()` resolves, and returns the unsubscribe function.
|
|
58
50
|
|
|
59
|
-
The contract source of truth is `src/core/service.ts` (`PluginManagerService`). The service is provided for the plugin's lifetime and disappears when the plugin is unloaded. The service and the
|
|
51
|
+
The contract source of truth is `src/core/service.ts` (`PluginManagerService`). The service is provided for the plugin's lifetime and disappears when the plugin is unloaded. The service and the update block share one face, so `onChange` subscribers observe the same mutations.
|
|
60
52
|
|
|
61
53
|
## Known limitations
|
|
62
54
|
|
|
63
|
-
- Loopback-only: on a LAN or remote browser the
|
|
64
|
-
- 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
|
|
55
|
+
- 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, 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.
|
|
57
|
+
- 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.
|
|
65
58
|
- 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.
|
|
66
|
-
- On the npm-published web runtime there is no boot-failure ring and no safe mode: those surfaces degrade to empty, and only install errors offer the repair handoff.
|
|
67
59
|
- 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.
|
|
68
60
|
- The web build has no in-place restart: changes apply at the next manual restart.
|
|
69
|
-
-
|
|
70
|
-
- 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
|
|
61
|
+
- 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
|
+
- 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.
|
|
71
63
|
- 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.
|
|
72
|
-
- The wire shapes mirror the official installer
|
|
73
|
-
- The repair conversation's workspace keeps its path-derived default title.
|
|
64
|
+
- The wire shapes mirror the official installer protocol; on drift the tolerant parsers degrade to error rows rather than misbehaving.
|
|
74
65
|
|
|
75
66
|
## Security model
|
|
76
67
|
|
|
77
68
|
- 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" }`.
|
|
78
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.
|
|
79
|
-
- 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
|
|
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 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.
|
|
80
71
|
- 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.
|
|
81
72
|
- 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.
|
|
82
73
|
- 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).
|
|
83
74
|
- The boot preflight (`--dump-config`) composes patch layers without importing entries: it catches composition failures, not import-time failures, which still surface at the first real boot.
|
|
84
|
-
- The profile
|
|
75
|
+
- The boot profile resolves from `--profile`, then the launched profile the Host publishes on `profileContext`, then the profile directory the packaged launcher carries in its own argv (Electron strips exec switches, so the desktop host sees its profile directory positionally), then `DSH_PROFILE`, then the `web` subcommand, then the packaged app's persisted selection. The published profile outranks the variable because the packaged Desktop client exports neither and a global `DSH_PROFILE` workaround can name a profile the running Host never reads.
|
|
76
|
+
- The launched profile the Host publishes is foreign input: its name is traversal-checked, its directory must be an absolute traversal-free path, and its patch path is accepted only when it is that profile's own `cordis.patch.yml` — the patch path is a write target. Patch writes go through a backup copy plus tmp-write + atomic rename (`cordis.patch.yml.bak-plugin-manager`).
|
|
85
77
|
- The duplicate-mount safeguard writes only the profile manifest's `dsh.profile.bundles`, under the same backup + tmp-write + atomic-rename discipline as patch writes (`package.json.bak-plugin-manager`). It removes only entries the CLI just added that duplicate an existing patch-row mount, and a failed safeguard write fails the job visibly rather than silently leaving a boot-breaking state.
|
|
86
78
|
|
|
87
79
|
## Telemetry
|
package/README.zh.md
CHANGED
|
@@ -2,23 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
面向 dsh web GUI
|
|
5
|
+
面向 dsh web GUI 官方「插件」面板的更新检查:把官方插件管理页唯一没有的能力——已装插件与其 registry 来源的版本比对,以及 DSH 运行时兼容门禁——作为该页面内的一个区块渲染。安装、卸载与启停由官方页面负责(面板归它所有);本包此前在该分区另注册一个「插件管理」Tab,现已移除。
|
|
6
6
|
|
|
7
7
|
## 功能
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- 双通道传输:带官方安装器服务的运行时(DSHCode 与 1.0.4 checkout 版 web)走官方 `/plugin-installer`、`/plugin-control` loopback RPC 通道;npm 发布的官方 web 没有这些通道,本包的 host 半区挂载 loopback 门禁的 HTTP 网关——安装/卸载 spawn 官方 `dsh plugin` CLI(唯一写入器),启停写入 `disabled`
|
|
11
|
-
- 清单只读呈现,并指向官方插件管理页(侧边栏「插件」)执行安装、卸载与启停;官方页面的改动实时生效。
|
|
12
|
-
- 列出已装用户插件:名称、版本、来源徽标与生效状态,并提供更新检查(npm 源走 registry)与已核验的 npm 更新。
|
|
13
|
-
- 聚合包行仍可读:`@linxin666/dsh-web-all` 等声明多条入口行的聚合包展开为子行列表,逐个显示家族插件的生效状态,锁定行有标注;这些行的开关在官方页面上。
|
|
14
|
-
- 聚合包子插件列表默认收起:行上只显示「子插件 N/M 已启用」摘要,点击展开,携带 20+ 家族行的全家桶不再把设置页拉长。
|
|
9
|
+
- 向官方插件页注入「检查更新」区块(该页声明的 `plugins.detail.section` 席位),只渲染在已安装组合包的页面上;「插件」设置分区不再有本包自己的 Tab。
|
|
10
|
+
- 双通道传输:带官方安装器服务的运行时(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。
|
|
15
11
|
- 检测旧聚合包 `@linxin666/dsh-web-ui-all`,把更新动作转换为到 `@linxin666/dsh-web-all` 的事务迁移;网关先移除旧包、安装精确版本的新包、恢复旧聚合包的层顺序,并在 `--dump-config` 通过后才报告成功。
|
|
16
|
-
- 更新前校验 DSH 运行时兼容(issue #754):更新检查读取最新版本清单声明的 DSH 最低版本(`dsh.engines.dsh`,兼容回退读顶层 `engines.dsh
|
|
17
|
-
-
|
|
18
|
-
- 冲突对账:host 记录本包网关通道上最近一次安装/更新的层变化;官方通道上则对本次 Tab 执行的更新做产品快照前后 diff。可撤销的动作给一键撤销,每条冲突都给「让 Agent 修复」转交。
|
|
19
|
-
- 按插件渲染启动失败环:「让 Agent 修复」(以插件安装根为工作区的修复会话)与「复制错误」。
|
|
20
|
-
- 显示宿主安全模式横幅与「恢复正常模式」操作(web 端在下次手动重启时生效)。
|
|
21
|
-
- npm 运行时保护下次启动:安装后网关校验依赖真实落盘、拒绝重复入口 id 认领与引用不可解析包的 insert 行,并用 CLI 的 `--dump-config` 做组合预检;冲突或失败的安装会经官方 remove 路径自动回滚(绝不触碰现有插件),错误行带修复转交。
|
|
12
|
+
- 更新前校验 DSH 运行时兼容(issue #754):更新检查读取最新版本清单声明的 DSH 最低版本(`dsh.engines.dsh`,兼容回退读顶层 `engines.dsh`),在更新动作旁显示要求,运行 DSH 低于要求时禁用它;host 更新路由在启动任何 CLI 任务前若无法核实时也会返回 412 并拒绝。
|
|
13
|
+
- npm 运行时保护下次启动:安装后网关校验依赖真实落盘、拒绝重复入口 id 认领与引用不可解析包的 insert 行,并用 CLI 的 `--dump-config` 做组合预检;冲突或失败的安装会经官方 remove 路径自动回滚,绝不触碰现有插件。
|
|
22
14
|
|
|
23
15
|
## 安装
|
|
24
16
|
|
|
@@ -37,11 +29,11 @@ pnpm install && pnpm -r build
|
|
|
37
29
|
dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
|
|
38
30
|
```
|
|
39
31
|
|
|
40
|
-
重启 `dsh web`
|
|
32
|
+
重启 `dsh web` 后,官方「插件」面板中的组合包页面出现该更新区块。
|
|
41
33
|
|
|
42
34
|
## 配置
|
|
43
35
|
|
|
44
|
-
|
|
36
|
+
本包不携带配置命名空间。更新的写入在下次重启后生效。
|
|
45
37
|
|
|
46
38
|
## cordis 服务
|
|
47
39
|
|
|
@@ -56,32 +48,32 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
|
|
|
56
48
|
- `setEnabled(id, enabled): Promise<InstalledPluginItem>` — 经当前通道(官方安装器 RPC,或网关写 profile patch 的 `disabled` 行)翻转插件的下次启动启用状态;宿主重启后生效。
|
|
57
49
|
- `onChange(cb): () => void` — 订阅成功变更;`install()`、`update()`、`uninstall()`、`setEnabled()` 任一成功 resolve 后触发,返回退订函数。
|
|
58
50
|
|
|
59
|
-
契约事实源在 `src/core/service.ts`(`PluginManagerService
|
|
51
|
+
契约事实源在 `src/core/service.ts`(`PluginManagerService`)。服务随插件生命周期提供,插件卸载即消失。服务与更新区块共享同一个 face,因此 `onChange` 订阅者观察到的是同一批变更。
|
|
60
52
|
|
|
61
53
|
## 已知限制
|
|
62
54
|
|
|
63
|
-
- 仅限本机:LAN
|
|
64
|
-
- npm 发布的官方 web 上,网关写入经官方 CLI 执行。网关先从 host 进程 PATH 解析 `dsh`,再从运行中 host 入口上层各项目根的 `node_modules/.bin` 回退查找,最后回退到运行中 host 包自身的 `lib/bin.js`——覆盖本地包装器与 npx 启动,以及桌面安装包运行时(CLI 与 host 进程同处一树,且安装包会剥除所有 `.bin` shim
|
|
55
|
+
- 仅限本机: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 时,走 CLI 的写入才不可用——应用自有 profile 由官方进程内管理器写入,不需要任何二进制,其安装、更新与卸载路由也不要求它。CLI 输出按字节一次性解码,Windows 中文控制台(CP936/GBK)的报错文本可读而不再是替换字符。git 源安装可能耗时数分钟,以后台任务运行。网关更新只适用于 npm registry 源,由 host 解析最新版本,且仅当同一已装包报告该精确版本时才算成功。
|
|
57
|
+
- 应用自有 profile(打包桌面客户端)的安装、更新与卸载走宿主挂载的官方进程内插件管理器——即该 profile 官方插件页所用的同一个写入器:CLI 直接拒绝 `--profile desktop`,启动器则把自带的包管理器调用交给该管理器。任务、状态轮询与校验与 CLI 路径一致:安装必须新增一条此前没有的依赖、卸载必须删除一条依赖、更新必须报告路由解析出的版本;而 CLI 专属的守卫(重复挂载剥离、insert 行与启动预检)仍留在 CLI 写入器一侧,因为该路径下官方管理器会自行校验并应用 bundle。管理器返回的判定会先于 profile 被读取:被拒绝的运行以 `application: 'failed'` 解析而不是抛错,因此任务上报该运行的真实原因(pnpm 诊断文本,或 `incompatible-version` 拒绝点名的包),而不是在 profile 未变之后给出一句空转文案。其余运行时的安装、更新与卸载仍以 CLI 为唯一写入器。
|
|
65
58
|
- 兼容性门禁只在目标清单声明了最低 DSH 版本时生效;未声明 `dsh.engines.dsh` 的包更新不被检查,官方安装器运行时(DSHCode 与 checkout 版 web)不经过本门禁(其更新走官方安装器)。
|
|
66
|
-
- npm 发布的官方 web 没有启动失败环与安全模式:这两处界面降级为空,只有安装错误提供修复转交。
|
|
67
59
|
- npm 运行时上的启停显示下次启动的真实生效值:profile 覆盖行优先,其次由所装 bundle 自带的 `disabled` 行决定(聚合包的按需开启家族),两层都未提及的行视为启用。开启一个被 bundle 停用的行会写入显式 `disabled: false` 覆盖行——只删除用户行只会退回 bundle 默认值;该运行时 loader 在下次启动时认读这些行,但这条路径不如官方桌面写入器经过充分锻炼。
|
|
68
60
|
- web 端无壳内重启:变更在下次手动重启后生效。
|
|
69
|
-
-
|
|
70
|
-
- npm 运行时的启动预检(`--dump-config`)能抓组合失败,静态 insert 检查能抓引用不存在包的 insert 行;真正的运行时 import/apply
|
|
61
|
+
- npm 运行时上重复 insert id 认领在安装后即被检出并自动回滚新插件(共享 id 写 disabled 无法阻止 loader 的重复检查,只会误伤现有插件)。
|
|
62
|
+
- npm 运行时的启动预检(`--dump-config`)能抓组合失败,静态 insert 检查能抓引用不存在包的 insert 行;真正的运行时 import/apply 失败仍要到下次启动才暴露。
|
|
71
63
|
- 重复挂载保护(网关模式):官方 CLI 的 bundle 对账会在任何安装/卸载后把所有声明 `dsh.bundle` 的依赖重新加进 `dsh.profile.bundles`——包括组合树里已由 patch 行挂载的包(bundle 以 patch 行挂载外部插件时),下次启动会重复挂载而失败(`duplicate prefix route`)。每次 CLI 变更成功后,网关只把「本次新增且已被 patch 行挂载」的 bundles 条目剥除(清单写入走备份 + tmp + 原子 rename),并在任务结果上为每个被剥除的条目发一条 notice;正常安装的 bundles 条目与用户此前已有的条目一律不动。
|
|
72
|
-
- wire
|
|
73
|
-
- 修复会话工作区保留路径派生的默认标题。
|
|
64
|
+
- wire 形状镜像官方安装器协议;漂移时宽容解析器降级为错误行,不误操作。
|
|
74
65
|
|
|
75
66
|
## 安全模型
|
|
76
67
|
|
|
77
68
|
- 信任边界是 loopback 门禁:每条网关路由都要求 loopback socket 地址、loopback Host 头与非跨站来源(socket + Host + Origin + `sec-fetch-site` 四重),与官方安装器通道同一权威。远程来源的浏览器没有可达路径;被拒请求返回 HTTP 403 与 `{ ok: false, error: "forbidden: loopback-only" }`。
|
|
78
69
|
- 变更类路由(install / update / remove / set-enabled)不带 token:loopback 权威即本机用户,与官方通道同模型。因此任何本机进程都能驱动插件安装与卸载,且 npm 安装会执行包的 install 脚本——请将本网关视为「设计上即本机代码执行」,绝不暴露到 loopback 之外。
|
|
79
|
-
- 安装 spec 与包 id 含命令行展开字符或控制字符时一律拒绝。Windows 下,npm shim 会解析为 `node.exe` 加包内 `bin.js`;DSH Desktop 打包 shim 附近没有 npm 布局,因此通过带完整预引用、逐字参数封套的 `cmd.exe /d /s /c` 执行。桌面 profile 从打包启动器环境值或持久化的 profile
|
|
70
|
+
- 安装 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 门禁加用户点击。
|
|
80
71
|
- 变更经同一队列串行,并发任务的 before/after profile 快照绝不交错。安装只有在依赖真实落入 profile 后才判 done(卸载以依赖消失为准),绝不轻信成功退出码。
|
|
81
72
|
- 启停操作会在该变更队列内重新读取最新 profile 清单,并在写入前以 `404` 拒绝过期或未知的包 id,因此卸载后遗留在面板里的旧行不会制造孤儿 `disabled` 覆盖。
|
|
82
73
|
- 冲突处置是 owner-aware 的:重复入口 id 或引用不可解析包的 insert 行会经官方 remove 路径回滚**新**包;网关绝不对共享 id 写 `disabled` 行(那既阻止不了 loader 的重复检查,又会误伤现有插件)。
|
|
83
74
|
- 启动预检(`--dump-config`)只组合 patch 层、不 import 条目:能抓组合失败,抓不到 import 期失败——后者仍在首次真实启动时暴露。
|
|
84
|
-
- profile
|
|
75
|
+
- 启动 profile 的解析顺序为 `--profile`、宿主在 `profileContext` 上发布的启动 profile、打包启动器 argv 中按位置携带的 profile 目录(Electron 会剥掉 exec 开关,桌面宿主因此按位置拿到 profile 目录)、`DSH_PROFILE`、`web` 子命令、打包应用持久化的选择。已发布 profile 优先于环境变量:打包桌面端两者都不传,而全局 `DSH_PROFILE` workaround 可能指向运行中宿主根本不读的 profile。
|
|
76
|
+
- 宿主发布的启动 profile 属外来输入:其名称做路径穿越校验,其目录必须是绝对且不含穿越的路径,其 patch 路径只有等于该 profile 自己的 `cordis.patch.yml` 时才被接受——patch 路径是写入目标。patch 写入走备份 + tmp + 原子 rename(`cordis.patch.yml.bak-plugin-manager`)。
|
|
85
77
|
- 重复挂载保护只写 profile 清单的 `dsh.profile.bundles`,与 patch 写入同一纪律(备份 + tmp + 原子 rename,备份为 `package.json.bak-plugin-manager`);只移除 CLI 刚加入且与既有 patch 行挂载重复的条目;保护写回失败会让任务显式失败,绝不静默留下破坏下次启动的状态。
|
|
86
78
|
|
|
87
79
|
## 数据遥测
|