@linxin666/dsh-client-ui-plugin-manager 0.4.6 → 0.4.8

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: 7caf841a6dc01ff9b7bec7f6ad40590b54c960d7
6
- README.zh.md: 750fb0033e2ffea591880c09235fde65a662bb40
5
+ README.md: 1c69fcaac099c5e3635f8450c721f5db8148abad
6
+ README.zh.md: af3a7b0efcafe92cc9d2cf71854eac5711adc0fb
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.0--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.2-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
@@ -68,7 +68,7 @@ The contract source of truth is `src/core/service.ts` (`PluginManagerService`).
68
68
 
69
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).
70
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, 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.
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.
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
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.
@@ -81,7 +81,7 @@ The contract source of truth is `src/core/service.ts` (`PluginManagerService`).
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
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.
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.
87
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
@@ -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.0--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.2-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
  ## 安装
@@ -68,7 +68,7 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
68
68
 
69
69
  - 仅限本机:LAN 或远程浏览器只显示「仅限本机操作」提示(与官方安装器页同一边界;网关对非 loopback 请求返回 403)。
70
70
  - 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 解析最新版本,且仅当同一已装包报告该精确版本时才算成功。
71
- - 应用自有 profile(打包桌面客户端)的安装、更新与卸载走宿主挂载的官方进程内插件管理器——即该 profile 官方插件页所用的同一个写入器:CLI 直接拒绝 `--profile desktop`,启动器则把自带的包管理器调用交给该管理器。任务、状态轮询与校验与 CLI 路径一致:安装必须新增一条此前没有的依赖、卸载必须删除一条依赖、更新必须报告路由解析出的版本;而 CLI 专属的守卫(重复挂载剥离、insert 行与启动预检)仍留在 CLI 写入器一侧,因为该路径下官方管理器会自行校验并应用 bundle。管理器返回的判定会先于 profile 被读取:被拒绝的运行以 `application: 'failed'` 解析而不是抛错,因此任务上报该运行的真实原因(pnpm 诊断文本,或 `incompatible-version` 拒绝点名的包),而不是在 profile 未变之后给出一句空转文案。其余运行时的安装、更新与卸载仍以 CLI 为唯一写入器。
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
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 后重新打开。无终端的启动(受监督进程、编辑器任务)保持不动,工具条提示手动重启。不重启时,更新后的插件代码在下次启动生效。
@@ -81,7 +81,7 @@ dsh plugin --profile web add link:$(pwd)/packages/dsh-plugin-manager
81
81
 
82
82
  - 信任边界是 loopback 门禁:每条网关路由都要求 loopback socket 地址、loopback Host 头与非跨站来源(socket + Host + Origin + `sec-fetch-site` 四重),与官方安装器通道同一权威。远程来源的浏览器没有可达路径;被拒请求返回 HTTP 403 与 `{ ok: false, error: "forbidden: loopback-only" }`。
83
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 门禁加用户点击。
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` 覆盖。
87
87
  - 冲突处置是 owner-aware 的:重复入口 id 或引用不可解析包的 insert 行会经官方 remove 路径回滚**新**包;网关绝不对共享 id 写 `disabled` 行(那既阻止不了 loader 的重复检查,又会误伤现有插件)。
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
  */
@@ -98,6 +100,17 @@ window.__ModuleLoader__.load({
98
100
  return progress.percent === void 0 ? t("downloading") : t("downloadingPercent", { percent: String(progress.percent) });
99
101
  }
100
102
  /**
103
+ * Read the gate state out of one wire row.
104
+ * @param item - the update row, or undefined when no check has answered yet.
105
+ * @returns `open` when nothing blocks the update, otherwise the reason it is
106
+ * held back: `below-minimum` only when the host compared a version it read,
107
+ * `unverified` when it could not make that comparison.
108
+ */
109
+ function dshGateOf(item) {
110
+ if (item?.compatible !== false) return "open";
111
+ return item.hostVersion === void 0 ? "unverified" : "below-minimum";
112
+ }
113
+ /**
101
114
  * The update block on one official Plugins page: one check action, the verdict
102
115
  * for this page's bundle, and the update action it unlocks. The check is
103
116
  * explicit rather than automatic because one check reads every installed
@@ -184,8 +197,8 @@ window.__ModuleLoader__.load({
184
197
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("localOnlyTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("localOnlyBody") })]
185
198
  });
186
199
  const requiresDsh = found?.requiresDsh;
187
- const blocked = found?.compatible === false;
188
- const unverified = blocked && found?.hostVersion === void 0;
200
+ const gate = dshGateOf(found);
201
+ const blocked = gate !== "open";
189
202
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
190
203
  className: plugin_manager_module_css_default.section,
191
204
  "data-update-patch": true,
@@ -214,11 +227,11 @@ window.__ModuleLoader__.load({
214
227
  "data-update-latest": found.latest,
215
228
  children: t("latest", { version: found.latest })
216
229
  }),
217
- found !== void 0 && requiresDsh !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
230
+ found !== void 0 && (requiresDsh !== void 0 || blocked) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
218
231
  className: blocked ? plugin_manager_module_css_default.compatBlocked : plugin_manager_module_css_default.compatHint,
219
232
  "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) })
233
+ "data-update-compat-reason": blocked ? gate : void 0,
234
+ children: requiresDsh !== void 0 ? t(gate === "open" ? "updateRequiresDsh" : gate === "unverified" ? "updateUnverifiedDsh" : "updateBlockedDsh", { min: displayMinimumVersion(requiresDsh) }) : t("updateUnverifiedDshUnknownRange")
222
235
  }),
223
236
  found !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
224
237
  type: "button",
@@ -602,30 +615,33 @@ window.__ModuleLoader__.load({
602
615
  }),
603
616
  rows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
604
617
  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))
618
+ children: rows.map((row) => {
619
+ const gate = dshGateOf(row);
620
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
621
+ className: plugin_manager_module_css_default.panelRow,
622
+ "data-update-row": row.id,
623
+ "data-compatible": gate === "open" ? "yes" : "no",
624
+ children: [
625
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
626
+ className: plugin_manager_module_css_default.panelName,
627
+ children: row.id
628
+ }),
629
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
630
+ className: plugin_manager_module_css_default.panelVersion,
631
+ children: [
632
+ row.current,
633
+ " → ",
634
+ row.latest
635
+ ]
636
+ }),
637
+ gate === "open" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
638
+ className: plugin_manager_module_css_default.compatBlocked,
639
+ "data-update-row-compat-reason": gate,
640
+ children: row.requiresDsh !== void 0 ? t(gate === "unverified" ? "updateUnverifiedDsh" : "updateBlockedDsh", { min: displayMinimumVersion(row.requiresDsh) }) : t("updateUnverifiedDshUnknownRange")
641
+ })
642
+ ]
643
+ }, row.id);
644
+ })
629
645
  }),
630
646
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
631
647
  className: plugin_manager_module_css_default.panelActions,
@@ -761,7 +777,8 @@ window.__ModuleLoader__.load({
761
777
  "latest": "最新 {version}",
762
778
  "updateRequiresDsh": "需要 DSH ≥ {min}",
763
779
  "updateBlockedDsh": "需要 DSH ≥ {min},请先升级 DSH 再更新",
764
- "updateUnverifiedDsh": "无法确认本机 DSH 版本(需要 DSH ≥ {min}),已暂停更新",
780
+ "updateUnverifiedDsh": "无法核验本机 DSH 与该声明的兼容性(需要 DSH ≥ {min}),已暂停更新",
781
+ "updateUnverifiedDshUnknownRange": "无法核验该插件声明的 DSH 兼容范围,已暂停更新",
765
782
  "restartHint": "插件变更将在重启应用后生效。",
766
783
  "updatesAvailable": "{count} 个可更新",
767
784
  "updateAll": "全部更新({count})",
@@ -773,7 +790,7 @@ window.__ModuleLoader__.load({
773
790
  "restarting": "正在重启…",
774
791
  "restartConfirm": "确认重启",
775
792
  "restartPlanRelaunch": "会重启 DSH 服务,正在运行的任务会中断。",
776
- "restartPlanShell": "桌面版通过系统对话框重启:确认后会弹出官方的「应用无法启动或已意外停止」对话框,请在对话框中点「重启」。",
793
+ "restartPlanShell": "桌面版重启由应用外壳执行:确认后宿主进程会退出,由外壳重新拉起。",
777
794
  "restartPlanManual": "当前进程无法自动重启,请手动重启 DSH。",
778
795
  "restartShellWarning": "它同时会写一份崩溃报告;也可以手动重启:退出 DeepSeek Harness(⌘Q)后重新打开。",
779
796
  "restartDesktopHint": "请在随后出现的系统对话框中选择「重启」。",
@@ -800,7 +817,8 @@ window.__ModuleLoader__.load({
800
817
  "latest": "Latest {version}",
801
818
  "updateRequiresDsh": "Requires DSH >= {min}",
802
819
  "updateBlockedDsh": "Requires DSH >= {min}; upgrade DSH before updating",
803
- "updateUnverifiedDsh": "Cannot confirm the local DSH version (this update needs DSH >= {min}); update paused",
820
+ "updateUnverifiedDsh": "Cannot verify this host against the declared DSH range (this update needs DSH >= {min}); update paused",
821
+ "updateUnverifiedDshUnknownRange": "Cannot verify the DSH range this plugin declares; update paused",
804
822
  "restartHint": "Plugin changes take effect after restarting the application.",
805
823
  "updatesAvailable": "{count} updates available",
806
824
  "updateAll": "Update all ({count})",
@@ -812,7 +830,7 @@ window.__ModuleLoader__.load({
812
830
  "restarting": "Restarting…",
813
831
  "restartConfirm": "Restart",
814
832
  "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.",
833
+ "restartPlanShell": "The desktop app performs the restart: confirming stops the host process and the shell brings a new one up.",
816
834
  "restartPlanManual": "This process cannot restart itself; restart DSH yourself.",
817
835
  "restartShellWarning": "It also writes a crash report. You can instead restart manually: quit DeepSeek Harness (Cmd+Q) and open it again.",
818
836
  "restartDesktopHint": "Choose Restart in the system dialog that follows.",
@@ -977,17 +995,39 @@ window.__ModuleLoader__.load({
977
995
  const PLUGIN_MANAGER_SERVICE = "pluginManager";
978
996
  //#endregion
979
997
  //#region src/client/telemetry.ts
998
+ /** localStorage key carrying the family-wide telemetry opt-out ('1' = off). */
999
+ const TELEMETRY_OPT_OUT_KEY = "dsh-web-ui-telemetry-opt-out";
980
1000
  const VISITOR_KEY = "dsh-web-ui-telemetry-visitor";
981
1001
  const DAY_KEY_PREFIX = "dsh-web-ui-telemetry-day:";
982
1002
  const ENDPOINT = "https://dsh-market.com/api/telemetry/event";
983
1003
  /** The building package's version, when the bundle carries it. */
984
1004
  function bakedVersion() {
985
1005
  try {
986
- return "0.4.6";
1006
+ return "0.4.8";
987
1007
  } catch {
988
1008
  return;
989
1009
  }
990
1010
  }
1011
+ /** Whether the user switched the family-wide opt-out on (reads storage only). */
1012
+ function isTelemetryOptedOut() {
1013
+ try {
1014
+ return localStorage.getItem(TELEMETRY_OPT_OUT_KEY) === "1";
1015
+ } catch {
1016
+ return false;
1017
+ }
1018
+ }
1019
+ /** Whether the browser itself asks not to be tracked; a failed read means no signal. */
1020
+ function doNotTrackRequested() {
1021
+ try {
1022
+ return navigator.doNotTrack === "1" || navigator.doNotTrack === "yes";
1023
+ } catch {
1024
+ return false;
1025
+ }
1026
+ }
1027
+ /** Whether a heartbeat must be suppressed right now: opt-out stored, or the browser asks not to be tracked. */
1028
+ function isTelemetrySuppressed() {
1029
+ return isTelemetryOptedOut() || doNotTrackRequested();
1030
+ }
991
1031
  /** Read or lazily create the anonymous visitor id; null when storage is unavailable. */
992
1032
  function visitorId() {
993
1033
  try {
@@ -1016,6 +1056,7 @@ window.__ModuleLoader__.load({
1016
1056
  */
1017
1057
  function reportDailyHeartbeat(items) {
1018
1058
  try {
1059
+ if (isTelemetrySuppressed()) return;
1019
1060
  if (items.length === 0) return;
1020
1061
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1021
1062
  if (navigator.webdriver) return;