dsh-drydock 1.0.1 → 1.1.0-rc.1

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.en.md CHANGED
@@ -151,30 +151,30 @@ Five sections, switching keeps your scroll position:
151
151
 
152
152
  | Tool | What it does | Usage |
153
153
  |---|---|---|
154
- | `bin/open-boot.mjs` | **The single web entry + resident supervisor** (3081): `/` is the "open the browser and it starts" page, **`/rescue` is the rescue page** (with `/rescue/api/*`). Set it as your home page (`127.0.0.1` / `localhost` / `[::1]` are equivalent as long as the port matches). It stays hidden and only pops a visible progress window when the engine really needs starting (`--no-window` disables that). Health = **HTTP handshake + identity fingerprint**; write endpoints are guarded by **Origin + one-time token**; `--uninstall` cleans everything (stop supervisor → remove autostart → remove shims → clear pid; exit codes 0 = completed / 1 = error / **2 = ownership unconfirmed** — nothing stopped, pid file kept) | `npx dsh-pm-launcher` |
155
- | `bin/rescue-daemon.mjs` | **Independent backup rescue service** (default port **3082**): self-contained rescue page + `verify/fix/start/stop/status` API, no engine dependency. `stop` first verifies pid and port ownership (`{"force":true}` to force). **No longer competes with the 3081 launcher** (an occupied port is a hard error, never a silent port shift) | `npx dsh-pm-rescue` |
156
- | `bin/dsh-boot.mjs` / `.cmd` | **Steam-style boot sequence**: verify → auto-quarantine broken plugins → start → wait for health. `--repair-only` (self-check + repair only, no start), `--pause`, `--help`; exit codes 0 = ready / 1 = failed to start / 2 = repair incomplete. Immediate failures (bad command, port conflict) return at once with the absolute log path | `npx dsh-pm-boot` (double-clickable equivalent on Windows: `bin\dsh-boot.cmd` inside the package) |
154
+ | `bin/open-boot.mjs` | **The single web entry + resident supervisor** (3081): `/` is the "open the browser and it starts" page, **`/rescue` is the rescue page** (with `/rescue/api/*`). Set it as your home page (`127.0.0.1` / `localhost` / `[::1]` are equivalent as long as the port matches). It stays hidden and only pops a visible progress window when the engine really needs starting (`--no-window` disables that). Health = **HTTP handshake + identity fingerprint**; write endpoints are guarded by **Origin + one-time token**; `--uninstall` cleans everything (stop supervisor → remove autostart → remove shims → clear pid; exit codes 0 = completed / 1 = error / **2 = ownership unconfirmed** — nothing stopped, pid file kept) | `npx dsh-drydock` |
155
+ | `bin/rescue-daemon.mjs` | **Independent backup rescue service** (default port **3082**): self-contained rescue page + `verify/fix/start/stop/status` API, no engine dependency. `stop` first verifies pid and port ownership (`{"force":true}` to force). **No longer competes with the 3081 launcher** (an occupied port is a hard error, never a silent port shift) | `npx dsh-drydock-rescue` |
156
+ | `bin/dsh-boot.mjs` / `.cmd` | **Steam-style boot sequence**: verify → auto-quarantine broken plugins → start → wait for health. `--repair-only` (self-check + repair only, no start), `--pause`, `--help`; exit codes 0 = ready / 1 = failed to start / 2 = repair incomplete. Immediate failures (bad command, port conflict) return at once with the absolute log path | `npx dsh-drydock-boot` (double-clickable equivalent on Windows: `bin\dsh-boot.cmd` inside the package) |
157
157
 
158
158
  #### Resident launcher and autostart
159
159
 
160
160
  | Command | Effect |
161
161
  |---|---|
162
- | `npx dsh-pm-launcher --supervise [--interval 60] [--heartbeat-min 10]` | **Resident supervisor**: quietly keeps 3081 alive; a lock port (`port+1000`) guarantees a single instance; only a failed HTTP handshake triggers a start — healthy instances are never killed. Writes four kinds of log lines (state change / heartbeat / exit / uncaught exception) to `profile/open-boot-supervisor.log` |
163
- | `npx dsh-pm-launcher --ensure` | One-shot: make sure the port has this launcher (exit 0/1) |
164
- | `npx dsh-pm-launcher --status` | **Status self-check + health trail**: launcher (handshake + identity) / supervisor (lock port ownership) / engine (3080 handshake) / pid file / cwd / logs and last heartbeat; exit 0 = launcher healthy. Reports the occupying pid when the port belongs to someone else. **Appends a `health.log` line every run** (7 days / 1000 lines kept) |
165
- | `npx dsh-pm-launcher --install-autostart` | **Install autostart** (Windows): writes `HKCU\...\Run\DSHWebFront` plus `open-boot-autostart.vbs` (silent resident on login) and `open-boot-ui.vbs` (ensure 3081 then open the browser). The wrapper scripts are pure ASCII and self-resolve their path, so non-ASCII user names or profile paths with spaces no longer break |
166
- | `npx dsh-pm-launcher --uninstall-autostart` / `--autostart-status` | Remove / inspect autostart (shim presence, supervisor liveness, whether the port is this launcher). Idempotent (exit 0) when nothing is installed |
167
- | `npx dsh-pm-launcher --uninstall` | **Uninstall loop (R13)**: stop this profile's supervisor (three-fold ownership check: pid file + lock port `port+1000` + process image; refuses and never touches other processes) → delete **all** `DSHWeb*` Run values (including the legacy `DSHWebRescue`) → delete both `.vbs` shims → clear `.open-boot.pid` (logs kept). Exit codes: **0** = completed (including a confirmed "nothing to clean") / **1** = error / **2** = **ownership unconfirmed** (`netstat`/`tasklist` probes unavailable: no process stopped, pid file kept, never reports "uninstall complete"). Still idempotent; the engine on 3080 is left alone. The manager calls it before uninstalling itself |
168
- | `npx dsh-pm-launcher --help` / `npx dsh-pm-boot --help` | Show usage (unknown flags are reported, not silently ignored) |
162
+ | `npx dsh-drydock --supervise [--interval 60] [--heartbeat-min 10]` | **Resident supervisor**: quietly keeps 3081 alive; a lock port (`port+1000`) guarantees a single instance; only a failed HTTP handshake triggers a start — healthy instances are never killed. Writes four kinds of log lines (state change / heartbeat / exit / uncaught exception) to `profile/open-boot-supervisor.log` |
163
+ | `npx dsh-drydock --ensure` | One-shot: make sure the port has this launcher (exit 0/1) |
164
+ | `npx dsh-drydock --status` | **Status self-check + health trail**: launcher (handshake + identity) / supervisor (lock port ownership) / engine (3080 handshake) / pid file / cwd / logs and last heartbeat; exit 0 = launcher healthy. Reports the occupying pid when the port belongs to someone else. **Appends a `health.log` line every run** (7 days / 1000 lines kept) |
165
+ | `npx dsh-drydock --install-autostart` | **Install autostart** (Windows): writes `HKCU\...\Run\DSHWebFront` plus `open-boot-autostart.vbs` (silent resident on login) and `open-boot-ui.vbs` (ensure 3081 then open the browser). The wrapper scripts are pure ASCII and self-resolve their path, so non-ASCII user names or profile paths with spaces no longer break |
166
+ | `npx dsh-drydock --uninstall-autostart` / `--autostart-status` | Remove / inspect autostart (shim presence, supervisor liveness, whether the port is this launcher). Idempotent (exit 0) when nothing is installed |
167
+ | `npx dsh-drydock --uninstall` | **Uninstall loop (R13)**: stop this profile's supervisor (three-fold ownership check: pid file + lock port `port+1000` + process image; refuses and never touches other processes) → delete **all** `DSHWeb*` Run values (including the legacy `DSHWebRescue`) → delete both `.vbs` shims → clear `.open-boot.pid` (logs kept). Exit codes: **0** = completed (including a confirmed "nothing to clean") / **1** = error / **2** = **ownership unconfirmed** (`netstat`/`tasklist` probes unavailable: no process stopped, pid file kept, never reports "uninstall complete"). Still idempotent; the engine on 3080 is left alone. The manager calls it before uninstalling itself |
168
+ | `npx dsh-drydock --help` / `npx dsh-drydock-boot --help` | Show usage (unknown flags are reported, not silently ignored) |
169
169
 
170
- After installation the three commands come from the `bin` field of `package.json` (`dsh-pm-launcher` / `dsh-pm-boot` / `dsh-pm-rescue`). `npx` works without installing, and you can always run the file inside the package (path is independent of cwd):
170
+ After installation the three commands come from the `bin` field of `package.json` (`dsh-drydock` / `dsh-drydock-boot` / `dsh-drydock-rescue`). `npx` works without installing, and you can always run the file inside the package (path is independent of cwd):
171
171
 
172
172
  ```sh
173
173
  node "$DSH_HOME/profiles/web/node_modules/dsh-drydock/bin/open-boot.mjs" --status
174
174
  ```
175
175
 
176
176
  - **Shared modules**: `lib/preflight.mjs` (standalone self-check/repair, same logic as the host's `verifyProfile`/`fixProfile`), `lib/enginectl.mjs` (engine probing/start/stop/pid management + the write-endpoint guards).
177
- - **Troubleshooting**: engine will not start → ① open `http://127.0.0.1:3081/` (`http://localhost:3081/` is equivalent) → "check → repair → start"; ② `npx dsh-pm-boot --repair-only` to see the quarantine list; ③ `npx dsh-pm-launcher --status` for the real state of launcher/supervisor/engine plus the last `health.log` line; ④ interactive start with `npx dsh-pm-boot`.
177
+ - **Troubleshooting**: engine will not start → ① open `http://127.0.0.1:3081/` (`http://localhost:3081/` is equivalent) → "check → repair → start"; ② `npx dsh-drydock-boot --repair-only` to see the quarantine list; ③ `npx dsh-drydock --status` for the real state of launcher/supervisor/engine plus the last `health.log` line; ④ interactive start with `npx dsh-drydock-boot`.
178
178
  - **Full command/exit-code tables, the four `--uninstall` steps and a troubleshooting table**: [docs/LAUNCHER.md](docs/LAUNCHER.md). Architecture and slot contract: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
179
179
 
180
180
  > **Health semantics and the safety of "stop engine"**: ready = **HTTP handshake succeeded and the response carries a DSH identity fingerprint** (a bare TCP listener is never considered healthy). So when 3080, 3081 or 3082 is occupied by something else, the tools **fail loudly instead of pretending to be ready** and never shift ports silently. `stopEngine()` runs three checks first (pid alive / process image is node·dsh / the port owner matches the recorded pid) and refuses otherwise, explaining why on the rescue page (a "force stop" button — or `POST /api/stop {"force":true}` — is available there). Pid files: `.rescue-daemon.pid` (engine) and `.open-boot.pid` (launcher), both JSON.
@@ -222,7 +222,7 @@ node "$DSH_HOME/profiles/web/node_modules/dsh-drydock/bin/open-boot.mjs" --statu
222
222
  | GitHub API: `api.github.com`, `raw.githubusercontent.com`, `codeload.github.com` | read releases and repository `package.json`, download tgz | same |
223
223
  | Catalog `awesome-dsh-plugin.com/plugins.json` | market catalog (10-minute host cache) | same |
224
224
  | Loopback ports `3080` / `3081` / `3082` (+ lock `4081 = 3081+1000`) | main UI / launcher + rescue page / backup rescue service / single-instance lock — bound to `127.0.0.1` only | No (never leaves the machine) |
225
- | Windows registry `HKCU\...\Run\DSHWebFront` + profile `open-boot-autostart.vbs`, `open-boot-ui.vbs` | written **only when you explicitly run `--install-autostart`**; cleaned by `npx dsh-pm-launcher --uninstall-autostart` (or `--uninstall`) | No |
225
+ | Windows registry `HKCU\...\Run\DSHWebFront` + profile `open-boot-autostart.vbs`, `open-boot-ui.vbs` | written **only when you explicitly run `--install-autostart`**; cleaned by `npx dsh-drydock --uninstall-autostart` (or `--uninstall`) | No |
226
226
  | Profile `.rescue-daemon.pid`, `.open-boot.pid`, `rescue-daemon.log`, `open-boot-supervisor.log`, `health.log` | pids, logs and the self-check trail (`health.log` keeps 7 days / 1000 lines) | No |
227
227
 
228
228
  > **What it never touches**: conversation content, `settings.yaml`, `.credentials.yaml` (API keys) — there is no code path reading them in `lib/`.
@@ -264,8 +264,8 @@ Uninstall:
264
264
 
265
265
  ```sh
266
266
  dsh plugin --profile web remove dsh-plugin-manager-pro # calls --uninstall below to clean autostart/supervisor/shims first
267
- npx dsh-pm-launcher --uninstall-autostart # Windows: remove autostart (idempotent)
268
- npx dsh-pm-launcher --uninstall # optional: remove every launcher trace (stop supervisor + delete DSHWeb* + shims + pid)
267
+ npx dsh-drydock --uninstall-autostart # Windows: remove autostart (idempotent)
268
+ npx dsh-drydock --uninstall # optional: remove every launcher trace (stop supervisor + delete DSHWeb* + shims + pid)
269
269
  ```
270
270
 
271
271
  ## Rescue quick reference
@@ -273,13 +273,13 @@ npx dsh-pm-launcher --uninstall # optional: remove ever
273
273
  | Situation | What to do |
274
274
  |---|---|
275
275
  | Engine is fine, UI is broken | `http://127.0.0.1:3080/rescue` (rescue page / 🛟 button) |
276
- | Engine will not start | `http://127.0.0.1:3081/rescue` (the launcher's rescue page; `/` is the "open and it starts" page; `http://localhost:3081/…` is equivalent) → check → repair → start. Independent backup entry: `npx dsh-pm-rescue` (port **3082**) |
277
- | Want "open the browser and it starts" | Set your home page to `http://127.0.0.1:3081/` (`http://localhost:3081/` is equivalent — same host and port); make it resident with `npx dsh-pm-launcher --install-autostart` |
278
- | Want 3081 resident without windows | `npx dsh-pm-launcher --supervise` (silent; a visible window appears only when the engine must be started; `--no-window` disables it) |
279
- | Want the state of 3080/3081/3082/4081 | `npx dsh-pm-launcher --status` (launcher identity / lock ownership / engine handshake / pid files / last heartbeat) and one `health.log` line |
280
- | Remove every launcher trace | `npx dsh-pm-launcher --uninstall` (exit codes 0 = completed / 1 = error / **2 = ownership unconfirmed**: nothing is stopped and the pid file is kept — re-run from a session where `netstat`/`tasklist` work; the engine on 3080 and the logs stay) |
276
+ | Engine will not start | `http://127.0.0.1:3081/rescue` (the launcher's rescue page; `/` is the "open and it starts" page; `http://localhost:3081/…` is equivalent) → check → repair → start. Independent backup entry: `npx dsh-drydock-rescue` (port **3082**) |
277
+ | Want "open the browser and it starts" | Set your home page to `http://127.0.0.1:3081/` (`http://localhost:3081/` is equivalent — same host and port); make it resident with `npx dsh-drydock --install-autostart` |
278
+ | Want 3081 resident without windows | `npx dsh-drydock --supervise` (silent; a visible window appears only when the engine must be started; `--no-window` disables it) |
279
+ | Want the state of 3080/3081/3082/4081 | `npx dsh-drydock --status` (launcher identity / lock ownership / engine handshake / pid files / last heartbeat) and one `health.log` line |
280
+ | Remove every launcher trace | `npx dsh-drydock --uninstall` (exit codes 0 = completed / 1 = error / **2 = ownership unconfirmed**: nothing is stopped and the pid file is kept — re-run from a session where `netstat`/`tasklist` work; the engine on 3080 and the logs stay) |
281
281
  | Port 3081 serves someone else's page | The port belongs to another process: `--status` reports the pid; kill it or change `--port` and update your home page (the tool **never** shifts ports silently) |
282
- | Command-line check & start | `npx dsh-pm-boot` (start) or `npx dsh-pm-boot --repair-only` (check + repair only); on Windows double-click `bin\dsh-boot.cmd` inside the package |
282
+ | Command-line check & start | `npx dsh-drydock-boot` (start) or `npx dsh-drydock-boot --repair-only` (check + repair only); on Windows double-click `bin\dsh-boot.cmd` inside the package |
283
283
  | Installed but the UI is still old | The engine loads client bundles at startup — restart `dsh web` (or let the launcher restart the engine) |
284
284
  | Toggling a plugin does not change anything | The engine applies entries at startup: the change is written immediately but needs an engine restart (the UI tells you when) |
285
285
 
@@ -324,7 +324,7 @@ Docs: [docs/RELEASING.md](docs/RELEASING.md) (release flow), [docs/ARCHITECTURE.
324
324
  | Installed but the UI is still the old one / no new page | Client bundles load at engine startup: **restart `dsh web`** (or let the launcher restart the engine) |
325
325
  | Plugin state does not change after toggling | The engine applies entries at startup: written to config immediately, **effective after an engine restart** |
326
326
  | `dsh plugin add` says "Already up to date" | pnpm caches tarballs by version: **bump the version** before adding again |
327
- | Engine will not start (broken bundle in `package.json`) | Open `http://127.0.0.1:3081/rescue` → check → repair → start; or `npx dsh-pm-boot --repair-only` |
327
+ | Engine will not start (broken bundle in `package.json`) | Open `http://127.0.0.1:3081/rescue` → check → repair → start; or `npx dsh-drydock-boot --repair-only` |
328
328
  | No `/rescue` on 3081 | 0.9.0 and earlier only had the rescue flow on the launcher's `/` (or on the 3082 service). 0.9.1 serves `/rescue` and `/rescue/api/*` on 3081 — upgrade the plugin |
329
329
  | Worried a third-party page can trigger start/stop | It cannot: write endpoints require a **same-origin `Origin`** — same host *and* the same port only, i.e. `127.0.0.1` / `localhost` / `[::1]`, **never derived from the `Host`/`Referer` header** — plus a one-time token (`X-DSH-PM-Token`; a missing `Origin` still needs it, otherwise 401), and they are single-flighted (403 / 401 / 409) — see [docs/LAUNCHER.md](docs/LAUNCHER.md) §4 |
330
330
  | Browser reports `waiting for service: remote.xxx` | A client `inject` must not include its own remote (deadlock); inject only keeps `["slots","locale","remote"]` |
package/README.md CHANGED
@@ -144,9 +144,9 @@
144
144
 
145
145
  | 工具 | 用途 | 用法 |
146
146
  |---|---|---|
147
- | `bin/open-boot.mjs` | **唯一网页入口 + 常驻守护**(3081):`/` 是"打开即启动"页;**`/plugins` 是兜底管理页**(v1.0);`/rescue` 是救援页。设为浏览器主页即"打开即启动"。平时完全隐藏,只有引擎需要拉起时才弹一个可见启动窗口(`--no-window` 可关)。健康判定 = HTTP 握手 + 身份指纹;写接口带 Origin + 一次性令牌防护;`--uninstall` 一键清理(退出码 0/1/2,2 = 归属未确认时不动任何进程) | `npx dsh-pm-launcher` |
148
- | `bin/rescue-daemon.mjs` | **独立备份救援守护**(默认端口 **3082**):自包含中文救援页 + `verify/fix/start/stop/status` API,不依赖主引擎。**不与 3081 抢端口**(被占时明确报错退出,不静默漂移) | `npx dsh-pm-rescue`(默认 3082) |
149
- | `bin/dsh-boot.mjs` / `.cmd` | **Steam 式启动序列**:verify → 自动隔离坏插件 → 启动 → 健康等待。`--repair-only` 只自检+修复不启动;退出码 0=就绪 / 1=启动失败 / 2=修复未完成;启动即失败会**立即返回**并打印日志绝对路径 | `npx dsh-pm-boot`(Windows 双击:**包内** `bin\dsh-boot.cmd`) |
147
+ | `bin/open-boot.mjs` | **唯一网页入口 + 常驻守护**(3081):`/` 是"打开即启动"页;**`/plugins` 是兜底管理页**(v1.0);`/rescue` 是救援页。设为浏览器主页即"打开即启动"。平时完全隐藏,只有引擎需要拉起时才弹一个可见启动窗口(`--no-window` 可关)。健康判定 = HTTP 握手 + 身份指纹;写接口带 Origin + 一次性令牌防护;`--uninstall` 一键清理(退出码 0/1/2,2 = 归属未确认时不动任何进程) | `npx dsh-drydock` |
148
+ | `bin/rescue-daemon.mjs` | **独立备份救援守护**(默认端口 **3082**):自包含中文救援页 + `verify/fix/start/stop/status` API,不依赖主引擎。**不与 3081 抢端口**(被占时明确报错退出,不静默漂移) | `npx dsh-drydock-rescue`(默认 3082) |
149
+ | `bin/dsh-boot.mjs` / `.cmd` | **Steam 式启动序列**:verify → 自动隔离坏插件 → 启动 → 健康等待。`--repair-only` 只自检+修复不启动;退出码 0=就绪 / 1=启动失败 / 2=修复未完成;启动即失败会**立即返回**并打印日志绝对路径 | `npx dsh-drydock-boot`(Windows 双击:**包内** `bin\dsh-boot.cmd`) |
150
150
 
151
151
  > 端口的完整分工、退出码表、写接口防护与 `--uninstall` 四步见 [docs/LAUNCHER.md](docs/LAUNCHER.md);进程与槽位架构见 [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)。
152
152
 
@@ -154,13 +154,13 @@
154
154
 
155
155
  | 命令 | 作用 |
156
156
  |---|---|
157
- | `npx dsh-pm-launcher --supervise [--interval 60] [--heartbeat-min 10]` | **常驻守护**:静默确保 3081 有服务;锁端口(`port+1000`)单实例;只有 HTTP 握手失败才拉起,绝不误杀健康实例 |
158
- | `npx dsh-pm-launcher --ensure` | 一次性确保 3081(桌面快捷方式用,退出码 0/1) |
159
- | `npx dsh-pm-launcher --status` | **状态自检 + 健康留痕**:启动器/守护/引擎/PID/cwd/日志与最后心跳;每次追加一行 `profile/health.log`(保留 7 天 / 1000 行) |
160
- | `npx dsh-pm-launcher --install-autostart` | **写开机自启**(Windows):HKCU Run + 登录静默常驻;包装脚本正文纯 ASCII,中文用户名/含空格路径不乱码 |
161
- | `npx dsh-pm-launcher --uninstall-autostart` / `--autostart-status` | 移除自启 / 查看状态;未安装时**幂等**(exit 0) |
162
- | `npx dsh-pm-launcher --uninstall` | **卸载闭环**:三重归属校验停守护 → 删 HKCU\...\Run 下**所有** `DSHWeb*` 值 → 删 shim → 清 pid(**日志保留**)。退出码 0=完成 / 1=出错 / **2=归属未确认**(不动任何进程、保留 pid);引擎 3080 不动。管理器卸载自身前会自动调用它 |
163
- | `npx dsh-pm-launcher --help` / `npx dsh-pm-boot --help` | 显示用法(参数不再被静默忽略) |
157
+ | `npx dsh-drydock --supervise [--interval 60] [--heartbeat-min 10]` | **常驻守护**:静默确保 3081 有服务;锁端口(`port+1000`)单实例;只有 HTTP 握手失败才拉起,绝不误杀健康实例 |
158
+ | `npx dsh-drydock --ensure` | 一次性确保 3081(桌面快捷方式用,退出码 0/1) |
159
+ | `npx dsh-drydock --status` | **状态自检 + 健康留痕**:启动器/守护/引擎/PID/cwd/日志与最后心跳;每次追加一行 `profile/health.log`(保留 7 天 / 1000 行) |
160
+ | `npx dsh-drydock --install-autostart` | **写开机自启**(Windows):HKCU Run + 登录静默常驻;包装脚本正文纯 ASCII,中文用户名/含空格路径不乱码 |
161
+ | `npx dsh-drydock --uninstall-autostart` / `--autostart-status` | 移除自启 / 查看状态;未安装时**幂等**(exit 0) |
162
+ | `npx dsh-drydock --uninstall` | **卸载闭环**:三重归属校验停守护 → 删 HKCU\...\Run 下**所有** `DSHWeb*` 值 → 删 shim → 清 pid(**日志保留**)。退出码 0=完成 / 1=出错 / **2=归属未确认**(不动任何进程、保留 pid);引擎 3080 不动。管理器卸载自身前会自动调用它 |
163
+ | `npx dsh-drydock --help` / `npx dsh-drydock-boot --help` | 显示用法(参数不再被静默忽略) |
164
164
 
165
165
  > **健康判定与"停引擎"的安全性**:引擎/启动器就绪 = **HTTP 握手成功且响应带 dsh 身份指纹**(裸 TCP 监听器一律判不健康)。端口被别的进程占用时明确报错,不静默换端口。`stopEngine()` 前三重校验(pid 存活 / 进程镜像 / 端口归属),不过一律拒绝,需要时可在救援页"强制停止"。PID 文件均为 JSON(`profile/.rescue-daemon.pid` / `.open-boot.pid`)。
166
166
  >
@@ -234,8 +234,8 @@ pnpm update dsh-drydock --latest --dir <profile>
234
234
 
235
235
  # 卸载:3081 兜底页「卸载」(带备份、验证与失败回滚),或
236
236
  dsh plugin --profile web remove dsh-drydock # 卸载前自动清理自启/守护/shim
237
- npx dsh-pm-launcher --uninstall-autostart # Windows:清理开机自启(幂等)
238
- npx dsh-pm-launcher --uninstall # 需要时:彻底清理启动器痕迹(引擎 3080 与日志保留)
237
+ npx dsh-drydock --uninstall-autostart # Windows:清理开机自启(幂等)
238
+ npx dsh-drydock --uninstall # 需要时:彻底清理启动器痕迹(引擎 3080 与日志保留)
239
239
  ```
240
240
 
241
241
  ## 救援流程速查
@@ -247,10 +247,10 @@ npx dsh-pm-launcher --uninstall # 需要时:彻底清
247
247
  | 插件被禁用到界面起不来 | `http://127.0.0.1:3081/plugins` 直接 toggle(该页不依赖引擎) |
248
248
  | 某个插件把引擎打挂 | 3081 `/plugins` → mod 体检看 verdict → 禁用观察或卸载(带备份与验证) |
249
249
  | 卸载/更新被引擎占用 | 拒绝硬删并引导:先禁用 → 重启引擎 → 再操作 |
250
- | 需要独立于 3081 的备份救援入口 | `npx dsh-pm-rescue`(默认 3082,不抢端口) |
251
- | 想知道 3080/3081/3082/4081 到底什么状态 | `npx dsh-pm-launcher --status`(并追加一条 `health.log` 留痕) |
252
- | 命令行一键自检+启动 | `npx dsh-pm-boot`(启动)或 `npx dsh-pm-boot --repair-only`(只自检+修复) |
253
- | 彻底移除启动器 | `npx dsh-pm-launcher --uninstall`(退出码 2 = 归属未确认:不动任何进程) |
250
+ | 需要独立于 3081 的备份救援入口 | `npx dsh-drydock-rescue`(默认 3082,不抢端口) |
251
+ | 想知道 3080/3081/3082/4081 到底什么状态 | `npx dsh-drydock --status`(并追加一条 `health.log` 留痕) |
252
+ | 命令行一键自检+启动 | `npx dsh-drydock-boot`(启动)或 `npx dsh-drydock-boot --repair-only`(只自检+修复) |
253
+ | 彻底移除启动器 | `npx dsh-drydock --uninstall`(退出码 2 = 归属未确认:不动任何进程) |
254
254
 
255
255
  > **已知限制**:入口 token URL 只有在引擎 stdout 落到 `<DSH_HOME>/logs/web.log` 时才取得到(启动器经 `enginectl` 拉起时正常落盘)。若引擎由其他路径拉起(如 `dsh-boot` 的弹窗路径),3081 可能给不出可直接跳转的链接——到 `/rescue` 执行一次「重启引擎」即可恢复。
256
256
 
@@ -313,7 +313,7 @@ npm run pack # build + npm pack(产出安装
313
313
  | 装完界面还是旧的 / 新页面不出现 | 客户端 bundle 在引擎启动时加载:**必须重启 `dsh web`**(或让启动器重新拉起引擎) |
314
314
  | 启停插件后列表状态没变 | 引擎在启动时套用条目:配置已写入,**重启引擎后生效**(界面会在需要重启时提示) |
315
315
  | `dsh plugin add` 报 "Already up to date" 不更新 | pnpm 按版本号缓存 tarball;**修改后必须升版本号**再 add |
316
- | 引擎起不来(坏 bundle 进 package.json) | 开 `http://127.0.0.1:3081/rescue` → 运行检查 → 修复 → 启动;或 `npx dsh-pm-boot --repair-only` |
316
+ | 引擎起不来(坏 bundle 进 package.json) | 开 `http://127.0.0.1:3081/rescue` → 运行检查 → 修复 → 启动;或 `npx dsh-drydock-boot --repair-only` |
317
317
  | 想禁用管理器自己 | 3080 界面内不可自禁:去 `http://127.0.0.1:3081/plugins`(独立于引擎存活)或用 `dsh plugin remove`;3080 内允许的是**卸载**(额外警告路径,自动清理自启) |
318
318
  | 列表分区和我认知的不一样 | v1.0 起按来源三分区(核心组件 / 引擎内置组件 / 用户插件);「推荐」只是行内标签,不再是分区 |
319
319
  | 担心第三方网页能触发启动/停止 | 不会:写接口要**同源 `Origin` + 一次性令牌**,并发受单飞闸门限制(403 / 401 / 409)——见 [docs/LAUNCHER.md](docs/LAUNCHER.md) §4 |
package/bin/open-boot.mjs CHANGED
@@ -1522,13 +1522,28 @@ pre{background:#0b0d11;border:1px solid #2a2e38;border-radius:8px;padding:12px;f
1522
1522
  <h1>${drydockLogoMarkSvg(20)} 🚀 DSH 启动器</h1>
1523
1523
  <div class="sub">正在执行 自检 → 修复 → 启动,完成后自动打开主界面…</div>
1524
1524
  <div class="spinner" id="spin"></div>
1525
+ <div class="sub" id="elapsed" aria-live="polite" style="margin:-6px 0 10px;font-size:12.5px"></div>
1525
1526
  <pre id="out"></pre>
1526
1527
  <div class="sub" style="margin:16px 0 0"><a href="/rescue">救援中心</a>(检查 / 修复 / 启动 / 停止 / 状态)· <a href="/plugins">插件管理</a>(启停 mod / 重启引擎 / 停止启动器)</div>
1527
1528
  <script>
1528
1529
  const out = document.getElementById("out");
1530
+ const spin = document.getElementById("spin");
1531
+ const elapsedEl = document.getElementById("elapsed");
1529
1532
  const TOKEN = (document.querySelector('meta[name="dsh-pm-token"]') || {}).content || "";
1533
+ // U1:启动流程是一个长请求(自检→修复→启动),中间没有任何服务端事件 —— 用计时器证明"页面没卡住"
1534
+ let waited = 0;
1535
+ const ticker = setInterval(function(){
1536
+ waited++;
1537
+ elapsedEl.textContent = "已等待 " + waited + " 秒" + (waited >= 15 ? "(首次启动或修复较慢,页面没有卡住,请勿关闭)" : "…");
1538
+ }, 1000);
1539
+ function stopSpin(){
1540
+ clearInterval(ticker);
1541
+ spin.style.display = "none";
1542
+ if (waited > 0) elapsedEl.textContent = "本次等待 " + waited + " 秒";
1543
+ }
1530
1544
  function log(line, cls){ out.innerHTML += (cls?'<span class="'+cls+'">':'') + String(line).replace(/</g,'&lt;') + (cls?'</span>':'') + "\\n"; }
1531
1545
  function goEntry(r){
1546
+ stopSpin();
1532
1547
  if (r && r.entryUrl) { location.href = r.entryUrl; return; }
1533
1548
  // G03:entryUrl=null(引擎本次启动没打印/没写可读的 token 行)→ 降级指引,不渲染假 token 链接。
1534
1549
  log("⚠ 未捕获到本次启动的登录链接(entryUrl=null,引擎可能没有把 token 行写进 web.log)。", "warn");
@@ -1539,7 +1554,7 @@ function goEntry(r){
1539
1554
  link.textContent = "→ 打开 http://127.0.0.1:${enginePort}/";
1540
1555
  out.appendChild(document.createElement("br"));
1541
1556
  out.appendChild(link);
1542
- document.getElementById("spin").style.display = "none";
1557
+ stopSpin();
1543
1558
  }
1544
1559
  (async () => {
1545
1560
  try {
@@ -1549,22 +1564,28 @@ function goEntry(r){
1549
1564
  goEntry(r);
1550
1565
  return;
1551
1566
  }
1552
- if (r.code === 409) { log("⚠ " + (r.error || "已有启动流程在执行中"), "warn"); return; }
1567
+ if (r.code === 409) {
1568
+ // U1:原本这里只写一行日志就 return,转圈图标永远转下去 → 看起来像卡死
1569
+ log("⚠ " + (r.error || "已有启动流程在执行中"), "warn");
1570
+ log("本页不会自动跳转;可等它完成,或打开 " + location.origin + "/rescue 救援中心看状态。", "warn");
1571
+ stopSpin();
1572
+ return;
1573
+ }
1553
1574
  if (r.verifyOk === false) log("自检:⚠ 发现 " + (r.issues||[]).length + " 个问题", "warn");
1554
1575
  else if (r.verifyOk === true) log("自检:✓ 配置正常", "ok");
1555
1576
  if (r.fixed) log("修复:" + (r.fixed.message || "完成"), "ok");
1556
1577
  if (r.window && r.window.ok) log("⧉ " + r.window.message + "(窗口里可看到完整进度,结束时按任意键关闭)", "warn");
1557
- if (r.ok) { log("✓ " + (r.message || "引擎已启动"), "ok"); setTimeout(() => goEntry(r), 600); }
1558
- else if (r.quarantined && r.quarantined.length) { log("⚠ 运行期失败条目已自动隔离:" + r.quarantined.join(", "), "bad"); log("✓ " + (r.message || "重试成功"), "ok"); setTimeout(() => goEntry(r), 600); }
1578
+ if (r.ok) { log("✓ " + (r.message || "引擎已启动"), "ok"); stopSpin(); setTimeout(() => goEntry(r), 600); }
1579
+ else if (r.quarantined && r.quarantined.length) { log("⚠ 运行期失败条目已自动隔离:" + r.quarantined.join(", "), "bad"); log("✓ " + (r.message || "重试成功"), "ok"); stopSpin(); setTimeout(() => goEntry(r), 600); }
1559
1580
  else {
1560
1581
  log("✗ " + (r.message || JSON.stringify(r)), "bad");
1561
1582
  if (r.logPath) log("日志:" + r.logPath, "warn");
1562
1583
  log("可运行 node bin/open-boot.mjs --status 查看启动器/守护/引擎状态,或打开 " + location.origin + "/rescue 救援中心", "warn");
1563
- document.getElementById("spin").style.display = "none";
1584
+ stopSpin();
1564
1585
  }
1565
1586
  } catch (e) {
1566
1587
  log("✗ 请求失败:" + e.message, "bad");
1567
- document.getElementById("spin").style.display = "none";
1588
+ stopSpin();
1568
1589
  }
1569
1590
  })();
1570
1591
  </script>
@@ -2238,6 +2259,9 @@ button.danger:hover{background:var(--bad-bg);color:var(--bad)}
2238
2259
  .toggle input:checked + .knob{background:var(--accent)}
2239
2260
  .toggle input:checked + .knob::after{left:18px}
2240
2261
  .toggle input:disabled + .knob{opacity:.45;cursor:not-allowed}
2262
+ /* U1:禁用的 input 会吞掉鼠标事件(点击落在它身上就什么都不发生)→ 让事件落到 label/knob 上,
2263
+ 这样"点核心组件开关"能弹 toast 解释为什么不能点,而不是一片死寂。 */
2264
+ .toggle input:disabled{pointer-events:none}
2241
2265
  .hint{color:var(--dim);font-size:12px;line-height:1.6}
2242
2266
  .hint a{color:var(--accent)}
2243
2267
  .dim{color:var(--dim)}
@@ -2246,7 +2270,7 @@ pre.log{background:var(--bg);border:1px solid var(--border);border-radius:8px;pa
2246
2270
  .dot{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:7px;vertical-align:baseline}
2247
2271
  .dot.ok{background:var(--ok)}.dot.suspect{background:var(--warn)}.dot.broken{background:var(--bad)}
2248
2272
  /* toast */
2249
- #toasts{position:fixed;top:16px;left:50%;transform:translateX(-50%);z-index:60;display:flex;flex-direction:column;gap:8px;align-items:center}
2273
+ #toasts{position:fixed;top:16px;left:50%;transform:translateX(-50%);z-index:60;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none}
2250
2274
  .toast{background:var(--card);border:1px solid var(--border);border-left:4px solid var(--accent);border-radius:8px;padding:9px 16px;font-size:13px;box-shadow:0 4px 14px rgba(0,0,0,.14);max-width:520px}
2251
2275
  .toast.ok{border-left-color:var(--ok)}.toast.bad{border-left-color:var(--bad)}.toast.warn{border-left-color:var(--warn)}
2252
2276
  /* 确认框 */
@@ -2258,6 +2282,12 @@ pre.log{background:var(--bg);border:1px solid var(--border);border-radius:8px;pa
2258
2282
  #confirmBox .btns{display:flex;justify-content:flex-end;gap:8px}
2259
2283
  .panel{display:none}
2260
2284
  .panel.open{display:block}
2285
+ /* U1:结果卡片落点 —— 操作完成后滚动到位 + 闪一下,避免"结果在视口外 = 按钮没反应" */
2286
+ @keyframes cardflash{0%{box-shadow:0 0 0 0 rgba(59,110,246,0)}35%{box-shadow:0 0 0 3px var(--accent)}100%{box-shadow:0 0 0 0 rgba(59,110,246,0)}}
2287
+ .card.flash{animation:cardflash 1.6s ease-out}
2288
+ /* U1:按钮 loading 态(发起反馈) */
2289
+ button.busy{cursor:progress;opacity:.65}
2290
+ .rowitem.busy{opacity:.6}
2261
2291
  </style></head><body><div class="wrap">
2262
2292
  <header>
2263
2293
  <div>
@@ -2283,17 +2313,6 @@ pre.log{background:var(--bg);border:1px solid var(--border);border-radius:8px;pa
2283
2313
  <div class="hint" style="margin-top:10px"><span id="engstate" class="dim">引擎状态检测中…</span> · 改动启用状态后需重启引擎生效(写前自动备份 package.json)。</div>
2284
2314
  </div>
2285
2315
 
2286
- <div class="card">
2287
- <p class="sect">核心组件(引擎必需,不允许禁用)</p>
2288
- <div class="rows" id="coreRows"></div>
2289
- </div>
2290
-
2291
- <div class="card">
2292
- <p class="sect">用户插件</p>
2293
- <div class="rows" id="userRows"></div>
2294
- <div class="hint" style="margin-top:8px">配置入口在各插件的行内设置(主界面 → 插件管理 → 行内 ⚙);「市场详情」打开主界面市场页。</div>
2295
- </div>
2296
-
2297
2316
  <div class="card panel" id="updPanel">
2298
2317
  <p class="sect">更新检查结果</p>
2299
2318
  <div class="rows" id="updRows"></div>
@@ -2310,6 +2329,17 @@ pre.log{background:var(--bg);border:1px solid var(--border);border-radius:8px;pa
2310
2329
  <div class="rows" id="stepRows"></div>
2311
2330
  </div>
2312
2331
 
2332
+ <div class="card">
2333
+ <p class="sect">核心组件(引擎必需,不允许禁用)</p>
2334
+ <div class="rows" id="coreRows"></div>
2335
+ </div>
2336
+
2337
+ <div class="card">
2338
+ <p class="sect">用户插件</p>
2339
+ <div class="rows" id="userRows"></div>
2340
+ <div class="hint" style="margin-top:8px">配置入口在各插件的行内设置(主界面 → 插件管理 → 行内 ⚙);「市场详情」打开主界面市场页。</div>
2341
+ </div>
2342
+
2313
2343
  <div class="hint" style="margin-top:16px">管理器不能在自身管理界面(引擎 ${enginePort})中停用自己;如需禁用或卸载,请前往启动器兜底页(本页 ${launcherPort} /plugins)或使用 dsh 命令行——兜底页独立于引擎存活,禁用后仍可恢复。<b>可事务性自卸载</b>(含开机自启清理指引)。卸载/更新前若引擎正占用目标包,会引导你先禁用并重启引擎,而不是硬删。</div>
2314
2344
  </div>
2315
2345
 
@@ -2356,6 +2386,7 @@ themeBtn.addEventListener("click", function(){
2356
2386
  var next = document.documentElement.getAttribute("data-theme") === "dark" ? "light" : "dark";
2357
2387
  try { localStorage.setItem(THEME_KEY, next); } catch (e) { /* 写不进去就只在本会话生效 */ }
2358
2388
  applyTheme();
2389
+ toast("主题已切换为" + (next === "dark" ? "深色" : "浅色") + "(本页记忆;长按主题按钮复位为自动)", "ok");
2359
2390
  });
2360
2391
  themeBtn.addEventListener("pointerdown", function(){
2361
2392
  themeLongPressed = false;
@@ -2379,10 +2410,54 @@ function toast(text, cls){
2379
2410
  var box = document.getElementById("toasts");
2380
2411
  var el = document.createElement("div");
2381
2412
  el.className = "toast " + (cls || "");
2413
+ el.setAttribute("role", "status");
2382
2414
  el.textContent = text;
2383
2415
  box.appendChild(el);
2384
2416
  setTimeout(function(){ el.remove(); }, 5200);
2385
2417
  }
2418
+ // —— U1:发起反馈 / 落点反馈的统一实现 ——
2419
+ /** 按钮 loading 态:禁用 + 改文案,结束后逐字还原(防重复点击 + 用户能看出"点到了")。 */
2420
+ function setBusy(btn, busy, label){
2421
+ if (!btn) return;
2422
+ if (busy) {
2423
+ if (btn.dataset.idleText === undefined) btn.dataset.idleText = btn.textContent;
2424
+ btn.disabled = true;
2425
+ btn.classList.add("busy");
2426
+ btn.setAttribute("aria-busy", "true");
2427
+ if (label) btn.textContent = label;
2428
+ } else {
2429
+ btn.disabled = false;
2430
+ btn.classList.remove("busy");
2431
+ btn.removeAttribute("aria-busy");
2432
+ if (btn.dataset.idleText !== undefined) { btn.textContent = btn.dataset.idleText; delete btn.dataset.idleText; }
2433
+ }
2434
+ }
2435
+ async function withBusy(btn, label, fn){
2436
+ setBusy(btn, true, label);
2437
+ try { return await fn(); } finally { setBusy(btn, false); }
2438
+ }
2439
+ /** 结果卡片落点:打开 → 滚进视口(block:nearest,不把页面顶跳)→ 高亮闪一下;toast 是"感知",这是"眼睛的落点"。 */
2440
+ function revealPanel(id){
2441
+ var panel = document.getElementById(id);
2442
+ if (!panel) return;
2443
+ panel.classList.add("open");
2444
+ panel.classList.remove("flash");
2445
+ try { void panel.offsetWidth; } catch (e) { /* 强制重排以重放动画 */ }
2446
+ panel.classList.add("flash");
2447
+ if (panel._flashTimer) clearTimeout(panel._flashTimer);
2448
+ panel._flashTimer = setTimeout(function(){ panel.classList.remove("flash"); }, 1700);
2449
+ try {
2450
+ // 卡片比视口还高时(体检 20+ 行 / 长列表后的步骤日志)nearest 可能只对齐底边,
2451
+ // 标题被切掉一半 → 这种情况对齐卡片顶部,保证"体检结果"这个标题一定在屏幕里。
2452
+ var tall = panel.getBoundingClientRect().height > window.innerHeight * 0.85;
2453
+ panel.scrollIntoView({ block: tall ? "start" : "nearest", behavior: "smooth" });
2454
+ } catch (e) { try { panel.scrollIntoView(false); } catch (e2) { /* 老浏览器不支持时退化为仅高亮 */ } }
2455
+ }
2456
+ /** 失败 toast 必须带原因:服务端没给原因也要说清"没给原因",不许只说"失败"。 */
2457
+ function failText(prefix, r){
2458
+ return prefix + ":" + ((r && r.error) ? r.error : "服务端未返回原因(可看「操作步骤日志」或重启启动器后重试)");
2459
+ }
2460
+
2386
2461
  function confirmBox(title, text, okLabel){
2387
2462
  return new Promise(function(resolveCF){
2388
2463
  var mask = document.getElementById("mask");
@@ -2434,6 +2509,13 @@ function toggleHtml(b){
2434
2509
  input.dataset.name = b.name;
2435
2510
  var knob = document.createElement("span"); knob.className = "knob";
2436
2511
  label.appendChild(input); label.appendChild(knob);
2512
+ if (b.core) {
2513
+ // 核心组件的开关是 disabled 的:点它原本毫无反应(用户以为坏了)→ 现在明确说明为什么不能点
2514
+ label.addEventListener("click", function(ev){
2515
+ ev.preventDefault();
2516
+ toast(b.name + " 是引擎必需的核心组件,不能在这里禁用;确需停用请走救援中心 /rescue 或手工改 profile。", "warn");
2517
+ });
2518
+ }
2437
2519
  return label;
2438
2520
  }
2439
2521
  function renderRows(){
@@ -2476,7 +2558,13 @@ function renderRows(){
2476
2558
  var mk = el("button", null, "市场详情");
2477
2559
  mk.title = "打开主界面(引擎未运行时置灰)";
2478
2560
  mk.disabled = !engineUp;
2479
- mk.addEventListener("click", function(){ window.open("http://127.0.0.1:" + ENGINE_PORT + "/", "_blank"); });
2561
+ mk.addEventListener("click", function(){
2562
+ var url = "http://127.0.0.1:" + ENGINE_PORT + "/";
2563
+ var w = null;
2564
+ try { w = window.open(url, "_blank"); } catch (e) { w = null; }
2565
+ if (!w) toast("浏览器拦截了新标签页:请允许本站弹窗,或手动打开 " + url, "warn");
2566
+ else toast("已在新标签页打开主界面(" + url + ")", "ok");
2567
+ });
2480
2568
  row.appendChild(mk);
2481
2569
  (b.core ? coreRows : userRows).appendChild(row);
2482
2570
  });
@@ -2522,67 +2610,89 @@ function renderSteps(steps){
2522
2610
  });
2523
2611
  }
2524
2612
  async function doUpdate(name, btn){
2525
- btn.disabled = true;
2613
+ setBusy(btn, true, "更新中…");
2526
2614
  await guard(async function(){
2527
2615
  var okGo = await confirmBox("更新 " + name, "将运行 pnpm update --latest。若引擎正在运行且该插件已启用,会拒绝并引导你先禁用。", "更新");
2528
- if (!okGo) return;
2616
+ if (!okGo) { toast("已取消更新 " + name, "warn"); return; }
2617
+ toast("正在更新 " + name + "(pnpm update --latest,可能 10-60s)…", "warn");
2529
2618
  var r = await api("/plugins/api/update", { name: name });
2530
- if (!r.ok) { toast(r.error || "更新失败", r.blocked === "engine-busy" ? "warn" : "bad"); return; }
2531
- toast(r.message || "已更新", "ok");
2532
- await refreshUpdates(false);
2619
+ if (!r.ok) {
2620
+ toast(failText("更新 " + name + " 失败", r) + (r.blocked === "engine-busy" ? "(引擎正占用该包:先禁用该插件并重启引擎,再更新)" : ""), r.blocked === "engine-busy" ? "warn" : "bad");
2621
+ return;
2622
+ }
2623
+ toast("已更新 " + name + (r.message ? ":" + r.message : "(重启引擎后生效)"), "ok");
2624
+ // 刷新更新面板并 revealPanel("updPanel")(refreshUpdates 内部负责滚到位;失败时不会掀出空卡片)
2625
+ await refreshUpdates({ showPanel: true, announce: false });
2533
2626
  });
2534
- btn.disabled = false;
2627
+ setBusy(btn, false);
2535
2628
  }
2536
2629
  async function doUninstall(b, btn){
2537
- btn.disabled = true;
2630
+ setBusy(btn, true, "卸载中…");
2538
2631
  await guard(async function(){
2539
2632
  var warnText = b.self
2540
2633
  ? "这是管理器自身:卸载后引擎 ${enginePort} 内的插件管理界面消失;启动器 ${launcherPort} 本兜底页存活到启动器进程结束;之后请运行 node bin/open-boot.mjs --uninstall 清理开机自启。确定继续?"
2541
2634
  : "将执行事务性卸载:备份清单与 cordis.patch.yml → pnpm remove → 清理补丁行 → 验证;每一步都会留下回滚记录。确定继续?";
2542
2635
  var okGo = await confirmBox("卸载 " + b.name, warnText, "卸载");
2543
- if (!okGo) return;
2636
+ if (!okGo) { toast("已取消卸载 " + b.name, "warn"); return; }
2637
+ toast("正在卸载 " + b.name + "(事务性:备份 → pnpm remove → 清理补丁 → 验证)…", "warn");
2544
2638
  var r = await api("/plugins/api/uninstall", { name: b.name });
2545
- if (!r.ok) { toast(r.error || "卸载失败", r.blocked === "engine-busy" ? "warn" : "bad"); return; }
2546
- toast(r.message || "已卸载", "ok");
2547
- if (Array.isArray(r.steps)) renderSteps(r.steps);
2639
+ if (!r.ok) {
2640
+ toast(failText("卸载 " + b.name + " 失败", r) + (r.blocked === "engine-busy" ? "(引擎正占用该包:先禁用该插件并重启引擎,再卸载)" : ""), r.blocked === "engine-busy" ? "warn" : "bad");
2641
+ return;
2642
+ }
2643
+ toast("已卸载 " + b.name + (r.message ? ":" + r.message : "(重启引擎后生效)"), "ok");
2644
+ if (Array.isArray(r.steps)) { renderSteps(r.steps); revealPanel("stepPanel"); }
2548
2645
  await loadBundles();
2549
2646
  });
2550
- btn.disabled = false;
2647
+ setBusy(btn, false);
2551
2648
  }
2552
- async function loadBundles(){
2649
+ async function loadBundles(announce){
2553
2650
  return guard(async function(){
2554
2651
  var r = await api("/plugins/api/bundles");
2555
- if (!r.ok) { toast(r.error || "读取 bundle 失败", "bad"); return; }
2652
+ if (!r.ok) { toast(failText("读取插件列表失败", r), "bad"); return; }
2556
2653
  bundles = (r.bundles || []).map(function(b){ return { name: b.name, enabled: b.enabled, core: b.core, self: b.name === "dsh-drydock" }; });
2557
2654
  renderRows();
2655
+ if (announce) {
2656
+ var users = bundles.filter(function(b){ return !b.core; }).length;
2657
+ var on = bundles.filter(function(b){ return b.enabled; }).length;
2658
+ toast("已刷新:共 " + bundles.length + " 个组件(用户插件 " + users + " 个,已启用 " + on + " 个)", "ok");
2659
+ }
2558
2660
  });
2559
2661
  }
2560
- async function refreshUpdates(showPanel){
2662
+ async function refreshUpdates(opts){
2663
+ opts = opts || {};
2664
+ var showPanel = opts.showPanel !== false;
2665
+ var announce = opts.announce !== false;
2561
2666
  return guard(async function(){
2562
- var btn = document.getElementById("checkUpdBtn");
2563
- btn.disabled = true;
2667
+ if (announce) toast("正在检查更新:逐个比对用户插件的最新版本…", "warn");
2564
2668
  var r = await api("/plugins/api/updates");
2565
- btn.disabled = false;
2566
- if (!r.ok) { toast(r.error || "检查更新失败", "bad"); return; }
2669
+ if (!r.ok) { toast(failText("检查更新失败", r), "bad"); return; }
2567
2670
  updates = r.updates || [];
2568
- var n = updates.filter(function(u){ return u.needsUpdate; }).length;
2569
- toast(n ? "发现 " + n + " 个可更新插件" : "全部用户插件已是最新", n ? "warn" : "ok");
2671
+ var pending = updates.filter(function(u){ return u.needsUpdate; });
2672
+ var n = pending.length;
2673
+ if (announce) {
2674
+ var names = pending.slice(0, 3).map(function(u){ return u.name; }).join("、");
2675
+ toast(n
2676
+ ? "发现 " + n + " 个可更新插件:" + names + (n > 3 ? " 等" : "") + "(结果在「更新检查结果」卡片)"
2677
+ : "全部 " + updates.length + " 个用户插件已是最新", n ? "warn" : "ok");
2678
+ }
2570
2679
  renderRows();
2571
- if (showPanel !== false) renderUpdateRows();
2680
+ if (showPanel) renderUpdateRows();
2681
+ if (showPanel) revealPanel("updPanel");
2572
2682
  });
2573
2683
  }
2574
2684
  async function runHealth(){
2575
2685
  return guard(async function(){
2576
- var btn = document.getElementById("healthBtn");
2577
- btn.disabled = true;
2686
+ toast("正在做 mod 体检(只读:preflight 校验 + 引擎日志末尾 256KB)…", "warn");
2578
2687
  var r = await api("/plugins/api/health");
2579
- btn.disabled = false;
2580
- if (!r.ok) { toast(r.error || "体检失败", "bad"); return; }
2688
+ if (!r.ok) { toast(failText("mod 体检失败", r), "bad"); return; }
2689
+ var reportRows = r.rows || [];
2690
+ var gi = r.globalIssues || [];
2691
+ var broken = reportRows.filter(function(x){ return x.verdict === "broken"; });
2692
+ var suspect = reportRows.filter(function(x){ return x.verdict === "suspect"; });
2581
2693
  var rows = document.getElementById("healthRows");
2582
- var panel = document.getElementById("healthPanel");
2583
2694
  rows.textContent = "";
2584
- panel.classList.add("open");
2585
- (r.rows || []).forEach(function(row){
2695
+ reportRows.forEach(function(row){
2586
2696
  var item = el("div", "rowitem");
2587
2697
  var meta = el("div", "meta");
2588
2698
  var line = el("div", "name", null);
@@ -2596,7 +2706,6 @@ async function runHealth(){
2596
2706
  rows.appendChild(item);
2597
2707
  });
2598
2708
  // rc.2 P2-4:非 bundle 归属的 preflight 问题与未识别日志错误 → 单独区块
2599
- var gi = r.globalIssues || [];
2600
2709
  if (gi.length) {
2601
2710
  var ghead = el("div", "rowitem");
2602
2711
  ghead.appendChild(el("b", "warn", "⚠ 全局问题(不属于任何已装 bundle,勿按插件处理)"));
@@ -2611,46 +2720,71 @@ async function runHealth(){
2611
2720
  });
2612
2721
  }
2613
2722
  document.getElementById("healthHint").textContent = "日志:" + (r.logPath || "") + ";体检只读(preflight 校验 + 日志末尾 256KB 聚合,30s 缓存),不改任何文件。";
2723
+ var healthy = reportRows.length - broken.length - suspect.length;
2724
+ var head = "体检完成:" + reportRows.length + " 个组件(正常 " + healthy + " / 可疑 " + suspect.length + " / 异常 " + broken.length + ")" + (gi.length ? ",另有 " + gi.length + " 条全局问题" : "");
2725
+ if (!reportRows.length) toast("体检完成:profile 里没有已装组件(「用户插件」列表为空就是原因)", "warn");
2726
+ else if (broken.length) toast(head + ";异常:" + broken.slice(0, 3).map(function(x){ return x.name; }).join("、") + (broken.length > 3 ? " 等" : ""), "bad");
2727
+ else if (suspect.length || gi.length) toast(head, "warn");
2728
+ else toast(head + ",全部正常", "ok");
2729
+ revealPanel("healthPanel");
2614
2730
  });
2615
2731
  }
2616
2732
  document.getElementById("q").addEventListener("input", renderRows);
2617
- document.getElementById("refreshBtn").addEventListener("click", loadBundles);
2618
- document.getElementById("checkUpdBtn").addEventListener("click", function(){ refreshUpdates(true); });
2619
- document.getElementById("healthBtn").addEventListener("click", runHealth);
2733
+ document.getElementById("refreshBtn").addEventListener("click", function(){
2734
+ return withBusy(this, "刷新中…", function(){ return loadBundles(true); });
2735
+ });
2736
+ document.getElementById("checkUpdBtn").addEventListener("click", function(){
2737
+ return withBusy(this, "检查中…", function(){ return refreshUpdates({ showPanel: true, announce: true }); });
2738
+ });
2739
+ document.getElementById("healthBtn").addEventListener("click", function(){
2740
+ return withBusy(this, "体检中…", function(){ return runHealth(); });
2741
+ });
2620
2742
  document.getElementById("restartBtn").addEventListener("click", async function(){
2621
- this.disabled = true;
2622
- await guard(async function(){
2623
- var okGo = await confirmBox("重启引擎", "停旧引擎 → 拉起新引擎(失败条目自动隔离一次)→ 等握手。期间引擎 ${enginePort} 会短暂不可用。", "重启");
2624
- if (!okGo) { document.getElementById("restartBtn").disabled = false; return; }
2625
- toast("重启引擎中…", "warn");
2626
- var r = await api("/plugins/api/engine/restart", {});
2627
- toast(r.message || (r.ok ? "引擎已重启。" : "重启失败。"), r.ok ? "ok" : "bad");
2628
- setEngineState(r.ok);
2629
- // G03:entryUrl=null 时的降级指引(不渲染假 token 链接)
2630
- if (r.ok && r.entryUrl) toast("登录链接已就绪(含 token),可直接打开主界面。", "ok");
2631
- else if (r.ok) toast("未捕获到本次启动的登录链接:① 已登录过的浏览器直接打开 http://127.0.0.1:" + ENGINE_PORT + "/(cookie 仍有效);② 新浏览器请看引擎控制台输出的 dsh web: …?token=…,或到 ~/.dsh/logs/web.log 末尾查找最后一次启动追加的链接。", "warn");
2632
- });
2633
- document.getElementById("restartBtn").disabled = false;
2743
+ setBusy(this, true, "重启中…");
2744
+ try {
2745
+ await guard(async function(){
2746
+ var okGo = await confirmBox("重启引擎", "停旧引擎 → 拉起新引擎(失败条目自动隔离一次)→ 等握手。期间引擎 ${enginePort} 会短暂不可用。", "重启");
2747
+ if (!okGo) { toast("已取消重启引擎", "warn"); return; }
2748
+ toast("正在重启引擎(停旧 → 拉起 → 握手,最长约 30s)…", "warn");
2749
+ var r = await api("/plugins/api/engine/restart", {});
2750
+ if (r.ok) toast("引擎已重启,http://127.0.0.1:" + ENGINE_PORT + "/ 可访问" + (r.entryUrl ? ";登录链接已就绪,可直接打开主界面。" : "。"), "ok");
2751
+ else toast(failText("重启引擎失败", r), "bad");
2752
+ setEngineState(r.ok);
2753
+ // G03:entryUrl=null 时的降级指引(不渲染假 token 链接)
2754
+ if (r.ok && !r.entryUrl) toast("未捕获到本次启动的登录链接:① 已登录过的浏览器直接打开 http://127.0.0.1:" + ENGINE_PORT + "/(cookie 仍有效);② 新浏览器请看引擎控制台输出的 dsh web: …?token=…,或到 ~/.dsh/logs/web.log 末尾查找最后一次启动追加的链接。", "warn");
2755
+ });
2756
+ } finally {
2757
+ setBusy(document.getElementById("restartBtn"), false);
2758
+ }
2634
2759
  });
2635
2760
  document.getElementById("stopBtn").addEventListener("click", async function(){
2636
- this.disabled = true;
2637
- await guard(async function(){
2638
- var okGo = await confirmBox("停止本启动器", "启动器进程将优雅退出并清理 pid 文件;引擎与本页面不受影响,重新打开 ${launcherPort} 会重新拉起启动器。", "停止");
2639
- if (!okGo) { document.getElementById("stopBtn").disabled = false; return; }
2640
- var r = await api("/api/launcher/stop", {});
2641
- toast(r.message || "启动器即将退出。", "warn");
2642
- setTimeout(function(){ location.reload(); }, 1200);
2643
- });
2644
- document.getElementById("stopBtn").disabled = false;
2761
+ setBusy(this, true, "停止中…");
2762
+ try {
2763
+ await guard(async function(){
2764
+ var okGo = await confirmBox("停止本启动器", "启动器进程将优雅退出并清理 pid 文件;引擎与本页面不受影响,重新打开 ${launcherPort} 会重新拉起启动器。", "停止");
2765
+ if (!okGo) { toast("已取消停止启动器", "warn"); return; }
2766
+ toast("正在停止本启动器(引擎与本页面不受影响)…", "warn");
2767
+ var r = await api("/api/launcher/stop", {});
2768
+ toast(r.message || "启动器即将退出;重新打开本页地址会重新拉起启动器。", r.ok === false ? "bad" : "warn");
2769
+ setTimeout(function(){ location.reload(); }, 1200);
2770
+ });
2771
+ } finally {
2772
+ setBusy(document.getElementById("stopBtn"), false);
2773
+ }
2645
2774
  });
2646
2775
  document.getElementById("userRows").addEventListener("change", async function(ev){
2647
2776
  var input = ev.target;
2648
2777
  if (!input || input.dataset.name === undefined) return;
2778
+ var name = input.dataset.name;
2779
+ var want = Boolean(input.checked);
2780
+ var row = input.closest ? input.closest(".rowitem") : null;
2649
2781
  input.disabled = true;
2782
+ if (row) row.classList.add("busy");
2783
+ toast((want ? "正在启用 " : "正在禁用 ") + name + "…", "warn");
2650
2784
  await guard(async function(){
2651
- var r = await api("/plugins/api/bundles", { name: input.dataset.name, action: input.checked ? "enable" : "disable" });
2652
- if (!r.ok) { toast(r.error || "操作失败", "bad"); }
2653
- else toast(r.message || "已更新(重启引擎后生效)", r.changed === false ? "warn" : "ok");
2785
+ var r = await api("/plugins/api/bundles", { name: name, action: want ? "enable" : "disable" });
2786
+ if (!r.ok) toast(failText((want ? "启用 " : "禁用 ") + name + " 失败", r), "bad");
2787
+ else toast((want ? "已启用 " : "已禁用 ") + name + (r.changed === false ? "(本来就是这个状态,未改动)" : ",重启引擎后生效"), r.changed === false ? "warn" : "ok");
2654
2788
  });
2655
2789
  await loadBundles();
2656
2790
  });
@@ -2669,7 +2803,12 @@ async function loadEngine(){
2669
2803
  });
2670
2804
  }
2671
2805
  loadBundles(); loadEngine();
2806
+ // U1:结果区(#updPanel / #healthPanel / #stepPanel)已前移到用户插件列表之上,
2807
+ // 因此 #health 直达既能看见结果,也不会被长列表顶出视口;再靠 revealPanel 的滚动+高亮给落点。
2672
2808
  if (location.hash === "#health") runHealth(); // 3080 RescuePanel 的「mod 体检」入口直达(/plugins#health)
2809
+ window.addEventListener("hashchange", function(){
2810
+ if (location.hash === "#health") runHealth();
2811
+ });
2673
2812
  </script>
2674
2813
  </div></body></html>`;
2675
2814
  }
@@ -2998,5 +3137,7 @@ export {
2998
3137
  main, parseArgs, reportStatus, startServer, uninstallAutostart, writeShim,
2999
3138
  // rc.2 测试面:单测直接驱动这些函数(不经过 HTTP)
3000
3139
  CORE_BUNDLES, MANAGER_SELF_NAME, PKG_NAME_RE, runPnpm, writeFileAtomic, engineBusyGate,
3001
- uninstallPackageTransactional, updatePackage, checkUpdates, healthReport, restartEngine, ensureLauncherCmd
3140
+ uninstallPackageTransactional, updatePackage, checkUpdates, healthReport, restartEngine, ensureLauncherCmd,
3141
+ // U1 测试面:兜底页 HTML 静态断言(test-ux.mjs)直接检查页面结构,不用起浏览器
3142
+ pluginsPageHtml
3002
3143
  };
@@ -238,6 +238,8 @@ h1{font-size:20px;margin:0 0 4px;color:#fff}.sub{color:#8b93a3;font-size:13px;ma
238
238
  .row{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:14px}
239
239
  button{padding:9px 16px;border-radius:8px;border:1px solid #3a4050;background:#242a36;color:#e6e6e6;cursor:pointer;font-size:14px}
240
240
  button:hover{background:#2d3544}button.danger{background:#7f1d1d;border-color:#a03030}
241
+ button:disabled{opacity:.55;cursor:progress}button.done{animation:doneflash .9s ease-out}
242
+ @keyframes doneflash{0%{box-shadow:0 0 0 0 rgba(96,165,250,0)}30%{box-shadow:0 0 0 3px #2563eb}100%{box-shadow:0 0 0 0 rgba(96,165,250,0)}}
241
243
  button.primary{background:#1d4ed8;border-color:#2563eb}
242
244
  pre{background:#0b0d11;border:1px solid #2a2e38;border-radius:8px;padding:12px;font-size:12px;white-space:pre-wrap;max-height:320px;overflow:auto}
243
245
  .result{font-size:13px;white-space:pre-wrap}.ok{color:#4ade80}.bad{color:#f87171}.warn{color:#fbbf24}
@@ -246,11 +248,11 @@ a{color:#60a5fa}
246
248
  <h1>${drydockLogoMarkSvg(22)} 🛟 DSH 独立救援中心</h1>
247
249
  <div class="sub">独立于主引擎的救援入口 · 引擎挂了这里依然可用 · 停止引擎前会校验 pid 与端口归属 · 写操作需同源 + 一次性令牌</div>
248
250
  <div class="row">
249
- <button class="primary" onclick="startAndOpen()">启动引擎并打开主界面</button>
250
- <button onclick="runVerify()">运行检查</button>
251
- <button class="danger" onclick="runFix()">修复引擎配置</button>
252
- <button onclick="runStatus()">状态</button>
253
- <button class="danger" onclick="runStop()">停止引擎</button>
251
+ <button class="primary" onclick="startAndOpen(this)">启动引擎并打开主界面</button>
252
+ <button onclick="runVerify(this)">运行检查</button>
253
+ <button class="danger" onclick="runFix(this)">修复引擎配置</button>
254
+ <button onclick="runStatus(this)">状态</button>
255
+ <button class="danger" onclick="runStop(this)">停止引擎</button>
254
256
  </div>
255
257
  <div class="result" id="out">就绪。先点"运行检查"看 profile 是否健康。</div>
256
258
  <script>
@@ -258,56 +260,89 @@ const API = ${JSON.stringify(apiPrefix)};
258
260
  const TOKEN = (document.querySelector('meta[name="dsh-pm-token"]') || {}).content || "";
259
261
  const out = document.getElementById("out");
260
262
  function show(html, cls){ out.innerHTML = html; out.className = "result " + (cls||""); }
263
+ // U1:每次点击先让按钮进入 loading 态(禁用 + 文案),结束还原并闪一下 —— 用户能看出"点到了/还在跑"
264
+ function busy(btn, label){
265
+ if (!btn) return function(){};
266
+ const old = btn.textContent;
267
+ btn.disabled = true;
268
+ btn.textContent = label || "处理中…";
269
+ return function(){ btn.disabled = false; btn.textContent = old; };
270
+ }
271
+ async function withBusy(btn, label, fn){
272
+ const done = busy(btn, label);
273
+ let result;
274
+ try { result = await fn(); } finally { done(); }
275
+ if (btn) {
276
+ btn.classList.remove("done");
277
+ void btn.offsetWidth;
278
+ btn.classList.add("done");
279
+ setTimeout(function(){ btn.classList.remove("done"); }, 1000);
280
+ }
281
+ return result;
282
+ }
261
283
  async function api(path, method, body){
262
284
  const r = await fetch(API + path, { method: method || "GET", headers: { "Content-Type": "application/json", "X-DSH-PM-Token": TOKEN }, body: body ? JSON.stringify(body) : undefined });
263
285
  return r.json();
264
286
  }
265
- async function runVerify(){
266
- show("检查中…");
267
- try {
268
- const r = await api("/api/verify");
269
- if (r.ok === true && Array.isArray(r.issues) && r.issues.length === 0) show("✓ profile 配置正常,引擎可以正常启动。", "ok");
270
- else if (r.ok === true) show("⚠ 发现 " + r.issues.length + " 个问题:\\n" + r.issues.map(i=>"• "+i.name+": "+i.reason).join("\\n"), "bad");
271
- else show("检查失败:" + (r.error||"未知错误"), "bad");
272
- } catch(e){ show("请求失败:" + e.message, "bad"); }
287
+ async function runVerify(btn){
288
+ return withBusy(btn, "检查中…", async function(){
289
+ show("检查中…(读取 profile 与 bundle 可解析性)");
290
+ try {
291
+ const r = await api("/api/verify");
292
+ if (r.ok === true && Array.isArray(r.issues) && r.issues.length === 0) show("✓ profile 配置正常,引擎可以正常启动。", "ok");
293
+ else if (r.ok === true) show("⚠ 发现 " + r.issues.length + " 个问题:\\n" + r.issues.map(i=>"• "+i.name+": "+i.reason).join("\\n"), "bad");
294
+ else show("检查失败:" + (r.error||"服务端未返回原因"), "bad");
295
+ } catch(e){ show("请求失败:" + e.message, "bad"); }
296
+ });
273
297
  }
274
- async function runFix(){
275
- if(!confirm("确认执行修复?将隔离损坏的 bundle 并还原损坏的补丁文件(均带备份)。")) return;
276
- show("修复中…");
277
- try {
278
- const r = await api("/api/fix", "POST");
279
- if (r.ok === true) show("✓ 修复完成\\n" + (r.message||""), "ok");
280
- else show("修复失败:" + JSON.stringify(r), "bad");
281
- } catch(e){ show("请求失败:" + e.message, "bad"); }
298
+ async function runFix(btn){
299
+ return withBusy(btn, "修复中…", async function(){
300
+ if(!confirm("确认执行修复?将隔离损坏的 bundle 并还原损坏的补丁文件(均带备份)。")) { show("已取消修复(未改动任何文件)。", "warn"); return; }
301
+ show("修复中…(隔离损坏 bundle → 还原补丁 → 逐项验证,均带备份)");
302
+ try {
303
+ const r = await api("/api/fix", "POST");
304
+ if (r.ok === true) show("✓ 修复完成\\n" + (r.message||""), "ok");
305
+ else show("修复失败:" + (r.error || JSON.stringify(r)), "bad");
306
+ } catch(e){ show("请求失败:" + e.message, "bad"); }
307
+ });
282
308
  }
283
- async function runStatus(){
284
- try {
285
- const r = await api("/api/status");
286
- let text = "引擎:" + (r.engineUp ? "运行中(HTTP 握手正常,端口 " + r.enginePort + ")" : "未运行");
287
- if (r.engineOccupiedByOther) text += "\\n⚠ 端口 " + r.enginePort + " 被 pid " + r.engineOccupiedByOther + " 占用,但它不是 dsh 引擎";
288
- if (r.engineProcess) text += "\\n引擎 PID 文件:" + JSON.stringify(r.engineProcess);
289
- text += "\\n救援守护 PID:" + r.pid + "(端口 " + r.port + ")";
290
- show(text, r.engineUp ? "ok" : "warn");
291
- } catch(e){ show("请求失败:" + e.message, "bad"); }
309
+ async function runStatus(btn){
310
+ return withBusy(btn, "读取中…", async function(){
311
+ show("正在读取引擎 / 守护 / 端口状态…");
312
+ try {
313
+ const r = await api("/api/status");
314
+ let text = "引擎:" + (r.engineUp ? "运行中(HTTP 握手正常,端口 " + r.enginePort + ")" : "未运行");
315
+ if (r.engineOccupiedByOther) text += "\\n⚠ 端口 " + r.enginePort + " 被 pid " + r.engineOccupiedByOther + " 占用,但它不是 dsh 引擎";
316
+ if (r.engineProcess) text += "\\n引擎 PID 文件:" + JSON.stringify(r.engineProcess);
317
+ text += "\\n救援守护 PID:" + r.pid + "(端口 " + r.port + ")";
318
+ show(text, r.engineUp ? "ok" : "warn");
319
+ } catch(e){ show("请求失败:" + e.message, "bad"); }
320
+ });
292
321
  }
293
- async function startAndOpen(){
294
- show("正在启动引擎(自检→启动→等待就绪)…");
295
- try {
296
- const r = await api("/api/start", "POST");
297
- show((r.alreadyRunning ? "引擎已在运行。" : (r.message||"已请求启动。")), r.ok ? "ok" : "bad");
298
- if (r.ok) setTimeout(() => location.href = "http://127.0.0.1:${enginePort}/", 800);
299
- } catch(e){ show("请求失败:" + e.message, "bad"); }
322
+ async function startAndOpen(btn){
323
+ return withBusy(btn, "启动中…", async function(){
324
+ show("正在启动引擎(自检→启动→等待就绪)…启动期间本按钮保持禁用,避免重复拉起。");
325
+ try {
326
+ const r = await api("/api/start", "POST");
327
+ show((r.alreadyRunning ? "引擎已在运行。" : (r.message||"已请求启动。")), r.ok ? "ok" : "bad");
328
+ if (r.ok) setTimeout(() => location.href = "http://127.0.0.1:${enginePort}/", 800);
329
+ } catch(e){ show("请求失败:" + e.message, "bad"); }
330
+ });
300
331
  }
301
- async function runStop(){
302
- if(!confirm("确认停止引擎?会先校验 PID 与端口归属,校验不过会被拒绝。")) return;
303
- try {
304
- let r = await api("/api/stop", "POST", {});
305
- if (r.refused) {
306
- if (!confirm("已拒绝结束:\\n" + r.message + "\\n\\n确认强制结束该进程树?(仅在确认 pid 就是本机的 dsh 引擎时使用)")) { show(r.message, "warn"); return; }
307
- r = await api("/api/stop", "POST", { force: true });
308
- }
309
- show(r.message || JSON.stringify(r), r.ok ? "ok" : "bad");
310
- } catch(e){ show("请求失败:" + e.message, "bad"); }
332
+ async function runStop(btn){
333
+ return withBusy(btn, "停止中…", async function(){
334
+ if(!confirm("确认停止引擎?会先校验 PID 与端口归属,校验不过会被拒绝。")) { show("已取消停止(引擎未被动过)。", "warn"); return; }
335
+ show("正在停止引擎(先校验 PID 与端口归属)…");
336
+ try {
337
+ let r = await api("/api/stop", "POST", {});
338
+ if (r.refused) {
339
+ if (!confirm("已拒绝结束:\\n" + r.message + "\\n\\n确认强制结束该进程树?(仅在确认 pid 就是本机的 dsh 引擎时使用)")) { show(r.message, "warn"); return; }
340
+ show("正在强制结束进程树(已确认 pid 归属)…");
341
+ r = await api("/api/stop", "POST", { force: true });
342
+ }
343
+ show(r.message || JSON.stringify(r), r.ok ? "ok" : "bad");
344
+ } catch(e){ show("请求失败:" + e.message, "bad"); }
345
+ });
311
346
  }
312
347
  </script>
313
348
  <div class="sub" style="margin:14px 0 0">唯一网页入口(浏览器主页 / 桌面快捷方式):<a href="${entryUrl}">${entryUrl}</a></div>
package/lib/index.js CHANGED
@@ -2383,7 +2383,7 @@ setTimeout(() => {
2383
2383
  async cleanupOwnAutostart() {
2384
2384
  const skipped = (message) => ({ status: "skipped", exitCode: null, message, command: null });
2385
2385
  const directory = this.ownPackageDirectory();
2386
- if (directory === null) return skipped("无法定位管理器包目录,跳过开机自启清理(可手动执行 dsh-pm-launcher --uninstall)。");
2386
+ if (directory === null) return skipped("无法定位管理器包目录,跳过开机自启清理(可手动执行 dsh-drydock --uninstall)。");
2387
2387
  const script = join(directory, "bin", "open-boot.mjs");
2388
2388
  if (!existsSync(script)) return skipped(`包内没有 bin/open-boot.mjs(旧版本),跳过开机自启清理:${script}`);
2389
2389
  let source = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-drydock",
3
- "version": "1.0.1",
3
+ "version": "1.1.0-rc.1",
4
4
  "description": "DSH 引擎船坞(drydock,原名 dsh-plugin-manager-pro):本地插件管理器——分类折叠(核心组件/引擎内置组件/用户插件)、更新源一键更新(npm/GitHub/插件超市)、浏览器下载优先、下载目录自动安装、插件市场(dshfind 精选目录)、README 简介提取、救援与启动前自检;事务化卸载(备份→删除→校验→回滚)、操作历史一键撤销、场景方案、来源人工修正、依赖关系感知;独立救援工具链(3082 rescue-daemon / open-boot 浏览器触发自启 / dsh-boot 启动序列);跨平台(Windows/macOS/Linux)",
5
5
  "author": "nonentity303",
6
6
  "repository": {
@@ -26,6 +26,9 @@
26
26
  "main": "lib/index.js",
27
27
  "packageManager": "npm@11.19.0",
28
28
  "bin": {
29
+ "dsh-drydock": "bin/open-boot.mjs",
30
+ "dsh-drydock-boot": "bin/dsh-boot.mjs",
31
+ "dsh-drydock-rescue": "bin/rescue-daemon.mjs",
29
32
  "dsh-pm-launcher": "bin/open-boot.mjs",
30
33
  "dsh-pm-boot": "bin/dsh-boot.mjs",
31
34
  "dsh-pm-rescue": "bin/rescue-daemon.mjs"
@@ -61,15 +64,18 @@
61
64
  },
62
65
  "scripts": {
63
66
  "build": "node build.mjs",
64
- "test": "node build.mjs && node test-bundle.mjs && node test-render.mjs && node test-integration.mjs && node test-launcher.mjs",
67
+ "test": "node build.mjs && node test-bundle.mjs && node test-render.mjs && node test-integration.mjs && node test-launcher.mjs && node test-ux.mjs",
65
68
  "test:launcher": "node test-launcher.mjs",
66
69
  "test:strict": "node test-launcher.mjs --strict",
70
+ "test:ux": "node test-ux.mjs",
67
71
  "check:vendor": "node tools/check-vendor.mjs",
68
72
  "pack": "node build.mjs && npm pack",
69
73
  "preflight": "node tools/dev/npm-preflight.mjs",
70
74
  "publish:npm": "node tools/dev/publish-npm.mjs",
71
75
  "publish:npm:apply": "node tools/dev/publish-npm.mjs --apply",
72
76
  "publish:webauth": "node tools/dev/publish-webauth.mjs",
77
+ "publish:all": "node tools/dev/publish-all.mjs",
78
+ "publish:status": "node tools/dev/publish-all.mjs --status",
73
79
  "verify:triple": "node tools/dev/verify-triple.mjs"
74
80
  },
75
81
  "dependencies": {