dsh-drydock 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -1,351 +1,102 @@
1
- # dsh-drydock (formerly dsh-plugin-manager-pro)
1
+ <p align="center"><img src="docs/images/logo.svg" width="88" height="88" alt="DSH engine drydock"></p>
2
2
 
3
- > **Version of record: 1.0.3** — this file is the English README for 1.0.3, not an archive of the v0.9.1 era.
4
- > The Chinese README is [README.md](README.md), the full v0.9.1-era Chinese text is [docs/README-full.md](docs/README-full.md), release notes are in [docs/releases/](docs/releases/), and the release process is [docs/RELEASING.md](docs/RELEASING.md).
3
+ # DSH engine drydock (dsh-drydock)
5
4
 
6
- > A local plugin manager for [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness): a **standalone plugin page** (visual plugin management) plus a **standalone brick-rescue toolchain**.
7
-
8
- ![badge](https://img.shields.io/badge/dsh-0.1.7+-blue) ![license](https://img.shields.io/badge/license-MIT-green) ![version](https://img.shields.io/npm/v/dsh-drydock?color=orange) ![npm](https://img.shields.io/npm/dt/dsh-drydock)
9
-
10
- > Community plugin — not an official DSH package. npm: `dsh-drydock` (formerly `dsh-plugin-manager-pro`, which is **deprecated** on npm but not deleted; it is kept for installing historical versions) · GitHub: [nonentity303/dsh-drydock](https://github.com/nonentity303/dsh-drydock) · Cross-platform (Windows / macOS / Linux).
5
+ > **When the engine won't start, it is still there.** A **boot-time reliability toolchain** for [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness): standalone processes and ports for pre-boot self-check, broken-plugin quarantine and engine rescue (3081 / 3082), plus a tidy plugin manager.
11
6
  >
12
- > **Current version: 1.0.3** (npm `latest`, 2026-11-27). Check what is published any time with `npm view dsh-drydock version`; tags: <https://github.com/nonentity303/dsh-drydock/tags>.
13
- > ⚠️ A brand-new release is blocked by pnpm's 24 h cool-down (`minimumReleaseAge`) — pin the version explicitly if it does not install (see "Install" below).
14
-
15
- ### Update-source trust model (1.0.3)
16
-
17
- Read this before configuring sources:
18
-
19
- - **Default sources**: npm official (`registry.npmjs.org`) / GitHub official repo / npmmirror (`registry.npmmirror.com`). **The registry version is authoritative** — when an authoritative source has a definite version, only authoritative sources are compared (random tie-break); other sources do not take part in that decision.
20
- - **Custom sources are fallback only**: a source you add lands in the `custom` layer with `authoritative: false` and is **no longer mixed with the official sources**. It is used only when no authoritative version exists (flagged `degraded`). Promote it deliberately with `authoritative: true`.
21
- - **`http://` sources are allowed but labelled "plaintext · fallback only"** (intranet registries / proxies are a real case): a plaintext source can be promoted to authoritative only with **both** `authoritative: true` and `allowInsecure: true`; otherwise it stays fallback and the downgrade reason is reported in a readable note, never silently swallowed.
22
- - **`official` is decided server-side** from the built-in allowlist (npm official, npmmirror, compared after URL normalization); a client-supplied `official` is ignored.
23
- - **Only `@deepseek-ai/*` uses the `next` track** (and only from a built-in authoritative source). Every other package takes `latest` only, and a `latest` that is itself a semver prerelease (contains `-`) counts as "no usable version" — no RC is pushed to regular users.
24
- - **Auto-install from the downloads folder requires provenance**: an archive in `$DSH_HOME/downloads` is installed only if it matches a record this manager wrote (package name + version + source + expected digest, valid 7 days); otherwise it is refused and stamped `.failed`. A byte size alone is **not** treated as a content check.
25
- - **Digest is the only "verified" state**: redirects are checked hop by hop, any hop that downgrades to plaintext `http` is refused unless `allowInsecure` is set, and downloads without a digest are refused by default (`security.unverifiedDownloads: allow` only relaxes that, and the receipt still says "unverified").
26
-
27
- §"Why this manager exists" below keeps the 0.9.1-era capability comparison and competitor history as evidence; the compatibility and install tables have been updated to the 1.0.x line.
28
-
29
- ![Standalone plugin page: sidebar entry "Plugin manager" + five sections](https://raw.githubusercontent.com/nonentity303/dsh-drydock/master/docs/images/pm-090-official2.png)
30
-
31
- <sub>**Figure 1** · the 0.9 standalone plugin page (captured in an isolated rehearsal environment on DSH **0.1.7-rc.2**, 2026-09-28): the sidebar entry "Plugin manager" and the five section tabs — Official built-ins (optional) · All plugins · Market · Operations & scenarios · Maintenance. Source image: `docs/images/pm-090-official2.png`.</sub>
32
-
33
- ---
34
-
35
- ## 🧭 Why this manager exists: the official page does the basics, this one covers the rest
36
-
37
- Since DSH **0.1.6** the plugin manager is part of the engine itself: a host service `@deepseek-ai/dsh-plugin-manager` (a new `id: plugin-manager` row in the `dsh-base` bundle) plus a client page `@deepseek-ai/dsh-client-ui-plugin-manager`.¹³
38
-
39
- This manager is not "one more plugin list". It **takes over that page and adds what the official one does not do**: a complete install/uninstall loop (impact preview → transactional uninstall → rollback on failure → one-click undo), operation history and named scenarios, and **rescue when the engine itself will not start**.
40
-
41
- ### Capability comparison
42
-
43
- | Capability | Official built-in page (DSH 0.1.7) | LX2000WASD/dsh-web-plugin-manager (**discontinued**) | This manager (1.0.3) |
44
- |---|---|---|---|
45
- | Starts on DSH 0.1.7 | ✅ shipped with the engine | ❌ breaks the profile since 0.1.6 (loader entry id collision)¹ | ✅ verified on 0.1.7-rc.2: rehearsal + clean-environment install⁴ |
46
- | Transactional uninstall (impact preview → backup → remove → pre-boot self-check → rollback) | ❌ only bundle layer add/remove (`installBundle` / `removeBundle`); no preview, no undo³ | ⚠️ can uninstall (incl. bundles) but **not transactionally**: failures only say "restart to take effect", recovery means editing `cordis.patch.yml` by hand¹ | ✅ full loop, plus **one-click undo**⁴ |
47
- | Automatic rollback | ⚠️ restores profile files when a bundle install/remove fails³ | ⚠️ quality gate + rollback for install/update; **none for uninstall**¹ | ✅ rollback on uninstall *and* on "auto-install from the downloads folder"⁴ |
48
- | Standalone rescue (works when the engine is down) | ❌ the rescue page is served by the engine, so it dies with it⁵ | ❌ no standalone daemon/launcher; its own "known limitations" say the auto-restart chain can hang and needs manual recovery¹ | ✅ 3081 launcher + 3082 rescue service, independent of the main process⁴ |
49
- | Operation history / undo | ❌ | ❌ not in its feature list or CLI¹ | ✅ last 20 operations, one-click undo⁴ |
50
- | GitHub Releases | — (released with the engine) | **0** | **11** (incl. v0.9.0 with a tgz asset)² |
51
-
52
- **Sources** (each one verifiable):
53
-
54
- 1. Competitor README (announcement + feature list + known limitations + CLI): <https://raw.githubusercontent.com/LX2000WASD/dsh-web-plugin-manager/master/README.md> (mirror if raw is unreachable: <https://cdn.jsdelivr.net/gh/LX2000WASD/dsh-web-plugin-manager@master/README.md>) · repo <https://github.com/LX2000WASD/dsh-web-plugin-manager>. It contains `TypeError: duplicate loader entry id: plugin-manager` and "do not install on 0.1.6-alpha.2 or later".
55
- 2. GitHub API, measured 2026-10-03: competitor `releases` → `[]` (<https://api.github.com/repos/LX2000WASD/dsh-web-plugin-manager/releases>); this repo → **11** releases, latest `v0.9.0` (2026-09-30) with asset `dsh-plugin-manager-pro-0.9.0.tgz` (<https://api.github.com/repos/nonentity303/dsh-drydock/releases>).
56
- 3. Official page capability surface (0.1.7-rc.2) = the 12 remote methods of `@deepseek-ai/dsh-plugin-manager`: `listPlugins` / `listBundles` / `registries` / `inspect` / `setPluginEnabled` / `setBundleEnabled` / `installBundle` / `waitForInstall` / `cancelInstall` / `removeBundle` / `listVersionExemptions` / `setVersionExemption` (<https://www.npmjs.com/package/@deepseek-ai/dsh-plugin-manager>); the page itself is <https://www.npmjs.com/package/@deepseek-ai/dsh-client-ui-plugin-manager>. There are **no** impact preview, history/undo, scenarios or rescue methods.
57
- 4. This repository: `cordis.patch.yml` (disable the built-in page, insert our own row id), `lib/index.js` (uninstall transaction, history, sidecar), `bin/rescue-daemon.mjs` · `bin/open-boot.mjs` · `bin/dsh-boot.mjs` (matching `package.json` `bin`); 0.1.7-rc.2 evidence in `docs/releases/RELEASE_NOTES_0.8.3-1.md` and `docs/releases/0.9.0.md`.
58
- 5. `/rescue` is registered by **our host code** through the engine's `webServer` — hence it dies with the engine. That is exactly why the standalone services exist (`bin/rescue-daemon.mjs` header, [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)).
59
-
60
- ### "Why the old manager died" — and why this one is alive
61
-
62
- Since DSH 0.1.6 a third-party manager hits the same wall: **declare a loader entry id that the official bundle already uses and the profile crashes on startup**:
63
-
64
- ```
65
- TypeError: duplicate loader entry id: plugin-manager
66
- ```
67
-
68
- The leading competitor [LX2000WASD/dsh-web-plugin-manager](https://github.com/LX2000WASD/dsh-web-plugin-manager) (measured 2026-10-03: 68 stars / 3 forks / last push 2026-09-20 / **0 releases**) left the field that way: in 2026-09 it announced end-of-maintenance on its README front page ("for DSH <= 0.1.5-rc.2", "**do not install on 0.1.6-alpha.2 or later**").¹
69
-
70
- **This manager hit the same pit and survived** — by not fighting over the id:
71
-
72
- | What it does | Where |
73
- |---|---|
74
- | ① Disable the built-in page row: `- id: ui-plugin-manager` / `disabled: true` | `cordis.patch.yml` (in the package) |
75
- | ② Insert its own row with its own id `drydock` — **never the official `plugin-manager`** | `cordis.patch.yml` |
76
- | ③ Register into `main` (key=`plugins`) and `sidebar.panellist` (id=`plugins`) and declare the 7 `plugins.*` child slots the built-in page used to own (so third-party config cards have a real home) | `src/client.jsx` |
77
-
78
- Verified on **DSH 0.1.7-rc.2**: the engine boots cleanly, the sidebar shows "Plugin manager" and all five sections — that is Figure 1.
79
-
80
- > **Which version should I install?** DSH **0.1.7-rc.2 or later (and `<0.3.0-0`) → 1.0.3**. Engines older than 0.1.7-rc.2 are outside this package's `engines.dsh` range — stay on the historical release you already have. Rollback between 1.0.x releases uses the same package name: `dsh plugin --profile web add dsh-drydock@1.0.2`.
81
-
82
- ![Impact preview of a transactional uninstall plus the rescue/diagnostics entries in the same card](https://raw.githubusercontent.com/nonentity303/dsh-drydock/master/docs/images/pm4-uninstall-preview.png)
83
-
84
- <sub>**Figure 2** · the **impact preview** of a transactional uninstall (rehearsal environment, 2026-09-28): what will be removed and what is affected, before `package.json` is touched; the same "diagnostics" card also carries the rescue entries (`Repair engine` / `Restart engine` / `Pre-boot self-check` / `auto-quarantine failing plugins`). Source image: `docs/images/pm4-uninstall-preview.png`.</sub>
85
-
86
- ---
87
-
88
- ## ✨ Highlights
89
-
90
- - **Standalone plugin page** (v0.9.0): a first-level sidebar entry "Plugin manager" instead of a tab inside Settings — see plugins, install, **configure**, uninstall and rescue on one page, in five sections: **Official built-ins (optional) · All plugins · Market · Operations & scenarios · Maintenance**.
91
- - **Third-party config entries have a home** (v0.9.0): after taking over the built-in page, plugin-registered config cards still work — one summary line in the row, and the plugin's own full config card when expanded.
92
- - **Transactional uninstall** (v0.8): impact preview (dependents / entries / toggle rows) → backup → remove → pre-boot self-check → **automatic rollback on failure**; **one-click undo** afterwards.
93
- - **Operation history + scenarios** (v0.8): the last 20 operations are undoable; save a plugin combination as a named scenario and switch with a change preview.
94
- - **Rescue decoupled from the engine** (v0.7+): with the engine down, the **3081 launcher (with a built-in rescue page) and the 3082 rescue service** still self-check, repair and start it.
95
- - **Browser as launcher**: set your home page to `http://127.0.0.1:3081/` (`http://localhost:3081/` works the same way) — opening the browser runs self-check → repair → start → jumps to the main UI.
96
- - **Local write endpoints are guarded** (v0.9.1): same-origin `Origin` (same-host, same-port allowlist: `127.0.0.1` / `localhost` / `[::1]`) + one-time token + single-flight, so a third-party page cannot start/stop anything; `--status` also appends a `health.log` line (7 days / 1000 lines).
97
- - **Update-source trust model** (1.0.3): npm official / GitHub official repo / npmmirror by default, the registry is authoritative, custom sources are fallback-only (never mixed with the official ones) unless explicitly marked `authoritative`, plain `http://` sources are allowed but labelled "plaintext · fallback only", only `@deepseek-ai/*` uses the `next` track, and auto-install from the downloads folder requires a provenance record. Full rules in the trust-model block at the top.
98
-
99
- ---
100
-
101
- ## 📋 Feature overview (v1.0.3)
102
-
103
- ### Plugin page (sidebar "Plugin manager")
104
-
105
- Five sections, switching keeps your scroll position:
106
-
107
- | Section | Contents |
108
- |---|---|
109
- | **Official built-ins (optional)** | Engine-provided bundles that are disabled by default (one-click enable/disable) + official plugins with their own config page + version exemptions |
110
- | **All plugins** | Plugin list: search, collapsible groups, origin filter, enable/disable, inline config, inline uninstall, version & origin, manual origin override |
111
- | **Market** | ADP curated catalog (browse by category / search / sort), one-click install |
112
- | **Operations & scenarios** | Transactional uninstall with impact preview, **pre-uninstall health check**, operation history undo, scenarios |
113
- | **Maintenance** | Update sources, pre-boot self-check, rescue center entries, downloads folder |
114
-
115
- ### Plugin list
116
-
117
- - **Collapsible groups** by necessity (🔴 required / 🟡 recommended / 🟢 optional) with enable counters and update badges; search expands automatically.
118
- - **Origin classification**: built into the architecture vs user-installed (`dsh plugin add` / market), with filter chips and row badges.
119
- - **Manual origin override** per row (npm / GitHub / local / built-in), persisted.
120
- - **Status at a glance**: 🔴 error/needs attention · 🟡 update available · ⚪ disabled · 🟢 enabled, plus name, summary, necessity, installed→latest version, origin and a toggle.
121
- - **Automatic one-line summaries** from a built-in catalog, or from `README.zh.md` / `package.json.description` / `README.md`.
122
- - **Architecture protection**: rows the web layer deliberately disables (e.g. `tool-fs`) and UI skeleton plugins cannot be toggled (🔒 with a reason).
123
- - **Third-party config cards** (v0.9.0): entries registered through `plugins.row.config` (per row) and `plugins.bundle.config` (per bundle) are rendered inline; plugins without a config registration get no empty button.
7
+ > The official page and plugin markets handle **getting plugins in**; the drydock handles **what happens afterwards** — undo a bad install, rescue a dead engine. *It fixes this boot; we fix why the next one would break.*
124
8
 
125
- ### Transactional uninstall, history and scenarios
126
-
127
- - **Impact preview**: dependents (reverse `dependencies` / `peerDependencies` graph), entries to be removed, toggle rows to be cleaned, bundle declarations.
128
- - **Pre-uninstall health check** (v0.9.1): a verdict line (**safe / caution / risky** + one-line reason) and three checks — ① broken dependencies (high for `dependencies`/`peerDependencies`, info for optional/recommended; downgraded when the dependent is itself depended on) ② **patch residue** in `cordis.patch.yml` (report only — never auto-deleted) ③ **service / port conflicts** (`dsh.services` / `service` / `provides` / `ports`).
129
- - **The transaction**: back up `package.json` + `cordis.patch.yml` (`.rescue-bak-*`) → `pnpm remove` + drop bundles/toggle rows → run the pre-boot self-check → **roll back on any failure** (restore backups + reinstall dependencies). Directories locked by Windows are queued in `pendingRemovals` and retried on the next start.
130
- - **Before uninstalling the manager itself**, the package's own `bin/open-boot.mjs --uninstall` is called first (older versions have no such flag → recorded as "skipped", never blocking).
131
- - **Operation history**: the last 20 operations (uninstall / toggle / quarantine / scenario / reset), one-click undo, persisted across restarts.
132
- - **Scenarios**: save the current enable/disable state under a name and apply it later, with a change preview first.
133
-
134
- ### Updates and downloads
135
-
136
- - **Authoritative registry, fallback-only custom sources** (1.0.3): the trust layer is decided by each source's `authoritative` flag, not by its type; authoritative sources are compared among themselves (random tie-break) and other sources only step in when no authoritative version exists (`degraded`). See the trust-model block at the top.
137
- - **Circuit breaking**: GitHub API 403/429 cools down for 10 minutes; full refresh runs 8 concurrent queries and results are cached for 30 minutes (a cache hit returns instantly; refresh duration depends on your network and the number of enabled sources).
138
- - **Download order**: ① native browser download (hidden iframe, capturable by download managers) → ② external downloader → ③ built-in fallback (HTTP / aria2c / P2P magnet·torrent).
139
- - **Auto-install from the downloads folder requires provenance** (1.0.3): drop `.tgz` / `.tar.gz` into `$DSH_HOME\downloads`; the archive's own `package.json` is read first and installation happens only when it matches a record this manager wrote (package name + version + source + expected digest, valid 7 days). Anything else is refused with a `.failed` stamp ("no provenance record — not a download link produced by this manager; delete `.failed` to retry after you have confirmed the source"), and the record is removed once the install succeeds.
140
- - **Verified means digest**: a byte size alone is not a content check; redirects are validated hop by hop (any hop downgrading to plaintext `http` is refused unless `allowInsecure`); archives without a digest are refused by default.
141
-
142
- ### Market
143
-
144
- - Catalog endpoint `https://awesome-dsh-plugin.com/plugins.json` (`CATALOG_URL` in `lib/index.js`) with localized descriptions / stars / categories; entry count changes upstream; 10-minute host cache. Falls back to GitHub `topic:dsh-plugin` search when offline.
145
- - **Zero round-trips**: the catalog is fetched once; search / category chips / sort / paging happen client-side.
146
- - **One-click install**: npm-backed entries install straight from the registry; GitHub repos go through the built-in downloader; two-step confirmation; ✓ badge when installed.
147
- - **Post-install validation**: `dsh.bundle` / `dsh.client` manifests are verified and rolled back if broken; pnpm hoist drift and `minimumReleaseAge` traps are recovered automatically.
148
-
149
- ### Rescue
150
-
151
- - **Standalone rescue page `/rescue`**: self-contained HTML that talks straight to the host gateway, usable even when the UI is broken (diagnose / quarantine / repair / restart / uninstall).
152
- - **Floating rescue button** (🛟, bottom right) as an entry point when the settings page is broken.
153
- - **Auto-quarantine**: optional (**off by default**) and only for plugins that fail repeatedly; UI skeleton and infrastructure entries are protected and never disabled automatically.
154
- - **Pre-boot self-check**: `verifyProfile` / `fixProfile` — broken bundles can take the engine down at boot; one-click check and quarantine repair.
155
- - **Runtime quarantine**: when a plugin is incompatible with the engine, the loader can take the whole tree down (a static check cannot see it) — open-boot / rescue-daemon / dsh-boot parse the boot log, quarantine the failing entry and retry; quarantine rows are backed up and reversible.
156
-
157
- ![Maintenance → rescue: the diagnostics card](https://raw.githubusercontent.com/nonentity303/dsh-drydock/master/docs/images/pm-maintenance-rescue.png)
158
-
159
- <sub>**Figure 3** · the rescue side (same rehearsal environment, 2026-09-28): the "diagnostics" card in Maintenance with `Repair engine`, `Restart engine`, `Pre-boot self-check`, `auto-quarantine failing plugins`, and the list of uninstallable profile dependencies. Source image: `docs/images/pm-maintenance-rescue.png`.</sub>
160
-
161
- ### 🧰 Standalone rescue toolchain
162
-
163
- > A classic rescue page is registered by the engine — **when the engine is down, so is the rescue page**. Since v0.7 the rescue capability runs independently of the main process. No new dependencies (plain Node + the existing `yaml`).
164
-
165
- | Tool | What it does | Usage |
166
- |---|---|---|
167
- | `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` |
168
- | `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` |
169
- | `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) |
170
-
171
- #### Resident launcher and autostart
172
-
173
- | Command | Effect |
174
- |---|---|
175
- | `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` |
176
- | `npx dsh-drydock --ensure` | One-shot: make sure the port has this launcher (exit 0/1) |
177
- | `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) |
178
- | `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 |
179
- | `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 |
180
- | `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 |
181
- | `npx dsh-drydock --help` / `npx dsh-drydock-boot --help` | Show usage (unknown flags are reported, not silently ignored) |
182
-
183
- 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):
184
-
185
- ```sh
186
- node "$DSH_HOME/profiles/web/node_modules/dsh-drydock/bin/open-boot.mjs" --status
187
- ```
188
-
189
- - **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).
190
- - **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`.
191
- - **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).
9
+ ![badge](https://img.shields.io/badge/dsh-0.1.7+-blue) ![license](https://img.shields.io/badge/license-MIT-green) ![version](https://img.shields.io/npm/v/dsh-drydock?color=orange) ![npm](https://img.shields.io/npm/dt/dsh-drydock)
192
10
 
193
- > **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.
11
+ > Community plugin — not an official DSH package. npm: `dsh-drydock` (formerly `dsh-plugin-manager-pro`, which is deprecated on npm but not deleted; kept for installing historical versions) · GitHub: [nonentity303/dsh-drydock](https://github.com/nonentity303/dsh-drydock) · Cross-platform (Windows / macOS / Linux).
194
12
  >
195
- > **Working directory**: the engine and launcher use a **stable cwd** (your home directory by default; override with `--cwd <dir>` or `DSH_ENGINE_CWD`). Early versions put the cwd inside the package, which locked the directory during self-update/uninstall (`ERR_PNPM_EPERM`).
196
-
197
- ---
198
-
199
- ## Requirements
200
-
201
- - Windows 10/11 · macOS · Linux (`/rescue` and the three CLI tools are cross-platform; **`--install-autostart` is Windows-only**, on macOS/Linux use `--supervise` with your own service manager).
202
- - Node.js ≥ 18 · DeepSeek Harness `dsh` (global or via npx) · `pnpm` (required by `dsh plugin` and the update features).
203
- - **`engines.node` in `package.json` is the only statement of record** — this release still declares `>=18.0.0` and was **not** tightened here (engine tightening is planned for 1.1.x). Node 18 is EOL and pnpm 11 no longer supports 18/20/21, so run it on **Node 22 LTS or newer**.
204
- - **The engine version decides which manager version you install** (table below) — installing the wrong one means no plugin page, or a profile that will not start.
13
+ > **Current version: 1.0.4** (`npm view dsh-drydock version`; tags: <https://github.com/nonentity303/dsh-drydock/tags>).
14
+ > ⚠️ A brand-new release is blocked by pnpm's **24 h cool-down** (`minimumReleaseAge`) — pin the version explicitly if it does not install (see "Install" below).
205
15
 
206
- ### Engine compatibility matrix (engine × manager)
16
+ ## Four signature features
207
17
 
208
- | Your DSH engine | Manager version | Status | Verified | Notes / sources |
209
- |---|---|---|---|---|
210
- | **≥ 0.1.7-rc.2** (incl. 0.2.x, `<0.3.0-0`) | **1.0.3** (recommended) · 1.0.2 / 1.0.1 / 1.0.0 | ✅ supported | 1.0.x verified on 0.2.x engines (isolated rehearsal + main environment); **the count of record is the output of `node test-launcher.mjs --strict`** (it moves with the tree) | `engines.dsh` = `>=0.1.7-rc.2 <0.3.0-0`; per-version evidence in [docs/releases/](docs/releases/) |
211
- | **0.1.6 and later** (incl. 0.1.6-alpha.2) | **1.0.3** | ✅ recommended (takes over the built-in page) | 0.1.7-rc.2 verified; **0.1.6-alpha.x not tested individually** | The official page became part of the engine in 0.1.6; the `ui-plugin-manager` row our `cordis.patch.yml` disables is exactly that page (`@deepseek-ai/dsh-client-ui-plugin-manager`) |
212
- | **before 0.1.7-rc.2** (0.1.0-rc.6 ~ 0.1.5) | not supported by 1.0.x | ⚠️ stay on the historical release you already have | — | 1.0.x `engines.dsh` starts at 0.1.7-rc.2; the old package name is deprecated (notice live on npm) but not deleted |
18
+ ### ① Standalone rescue toolchain — works when the engine does not
19
+ The 3081 launcher (`/` boot page, `/plugins` fallback manager, `/rescue` rescue page) and the 3082 backup rescue daemon run in **separate processes and ports**, independent of the Cordis runtime; `verify / fix / start / stop / status` return explicit exit codes (0 ready / 1 start failed / 2 repair incomplete) and are script-callable. → [docs/RESCUE.md](docs/RESCUE.md)
213
20
 
214
- > **One line**: engine **≥ 0.1.7-rc.2 → install 1.0.3**. Rollback between 1.0.x releases uses the same package name: `dsh plugin --profile web add dsh-drydock@1.0.2`.
215
- > The "verified" records come from the rehearsal environment, the clean-environment install report and the real-machine install archive (`docs/releases/0.9.0-verify.md`; developer workspace `upgrade-rehearsal/`, `audit/install-090/` — the latter two are not part of the npm package). The process is repeated for every release per `docs/RELEASING.md`.
21
+ ### ② Transactional uninstall / rollback / one-click undo
22
+ Impact preview + pre-uninstall verdict (safe / caution / risky) → backup → remove → verify every step → **automatic rollback on any failure**; Windows file-lock leftovers are queued in `pendingRemovals` and retried on the next start; the last 20 operations are undoable and plugin combinations can be saved as **named scenarios**. → [docs/USAGE.md](docs/USAGE.md)
216
23
 
217
- ## 🔐 Permissions and data scope
24
+ ### ③ Update-source trust model + download provenance
25
+ Defaults are npm official `registry.npmjs.org` / GitHub official repo / npmmirror, and **the registry version is authoritative**; custom sources are `authoritative: false` by default and **fallback only** (never mixed with the official ones); `http://` sources are allowed but labelled "**plaintext · fallback only**" and need explicit `authoritative: true` + `allowInsecure: true` to take part in version decisions; only `@deepseek-ai/*` uses the `next` track; auto-install from the downloads folder requires a matching **provenance** record (name + version + source + digest, valid 7 days). → [docs/SECURITY.md](docs/SECURITY.md)
218
26
 
219
- > What does it actually touch? Everything it reads or writes stays inside your **local profile directory** and the **update sources you configure**: no account, no cloud, no telemetry. Every write is preceded by a `.rescue-bak-*` backup and goes through an atomic "temp file + rename".
27
+ ### ④ 3081 fallback page + cross-platform Chinese UI
28
+ With the engine down, `http://127.0.0.1:3081/plugins` still enables / disables, updates, uninstalls and restarts it; fully localised (Chinese) UI, light/dark theme following the system; Windows / macOS / Linux (`--install-autostart` is Windows-only). → [docs/USAGE.md](docs/USAGE.md)
220
29
 
221
- | Data | Purpose | Leaves the machine? |
222
- |---|---|---|
223
- | `~/.dsh/profiles/<name>/package.json` | read the installed plugin list (`dependencies` / `dsh.bundle` / `dsh.client`); written back by install/uninstall/scenario operations (backed up first) | No |
224
- | `~/.dsh/profiles/<name>/cordis.patch.yml` | read/write enable-state and quarantine rows (only rows carrying the `Managed by dsh-drydock` marker; pre-rename rows carry the old `dsh-plugin-manager-pro` marker and are still recognized; backed up first) | No |
225
- | `~/.dsh/profiles/<name>/plugin-manager.json` (sidecar) | operation history (last 20), scenarios, manual origin overrides, pending removals, update-source config | No |
226
- | `~/.dsh/profiles/<name>/node_modules/**` | read the dependency graph and package summaries; uninstall/quarantine deletes package directories via `pnpm` (Windows file locks are queued for the next start) | No (pnpm talks to the registry during install/uninstall) |
227
- | `~/.dsh/profiles/<name>/vendor/downloads/*.tgz` | archive staging for browser downloads; archives still referenced by dependencies are never deleted | No |
228
- | `$DSH_HOME/downloads/*` | "auto-install from the downloads folder" scans archives; only archives matching a provenance record (package name + version + source + digest) are installed; writes `.installed` / `.failed` stamps | No |
229
- | Local npm global root (Windows `%APPDATA%\npm`, macOS/Linux `npm root -g` and common paths) | **read-only**: locate the engine-provided `@deepseek-ai/*` packages and extract plugin summaries | No |
230
- | Update sources: npm registry (`registry.npmjs.org` by default), GitHub, mirrors you add (e.g. `registry.npmmirror.com`) | query versions and download archives | **Queries only** (GET metadata / archives) — no local data is uploaded |
231
- | GitHub API: `api.github.com`, `raw.githubusercontent.com`, `codeload.github.com` | read releases and repository `package.json`, download tgz | same |
232
- | Catalog `awesome-dsh-plugin.com/plugins.json` | market catalog (10-minute host cache) | same |
233
- | 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) |
234
- | 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 |
235
- | 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 |
236
-
237
- > **What it never touches**: conversation content, `settings.yaml`, `.credentials.yaml` (API keys) — there is no code path reading them in `lib/`.
238
-
239
- ## Install
240
-
241
- > **Install from npm** (`dsh plugin … add` is pnpm underneath and reuses the engine-provided `@deepseek-ai/*`).
30
+ ## Install (30 seconds)
242
31
 
243
32
  ```sh
244
- # 1) recommended (engine >= 0.1.7-rc.2) — current package name
245
- dsh plugin --profile web add dsh-drydock
246
-
247
- # 2) right after a release (or during the 24 h cool-down) — pin the version, always reliable
248
- dsh plugin --profile web add dsh-drydock@1.0.3
249
-
250
- # 3) offline tarball (downloaded from the GitHub Release page, or built with npm pack)
251
- dsh plugin --profile web add ./dsh-drydock-1.0.3.tgz
33
+ # Recommended: pin the version so pnpm's 24 h cool-down cannot block it
34
+ dsh plugin --profile web add dsh-drydock@1.0.4
252
35
 
253
- # 4) roll back to the previous stable release (same package name for the whole 1.0.x line)
254
- dsh plugin --profile web add dsh-drydock@1.0.2
255
-
256
- # restart the web engine to load the client bundle
36
+ # Restart the web engine (client bundles load at engine startup)
257
37
  dsh web
258
38
  ```
259
39
 
260
- > **Does not install / still shows the old UI?** Two usual causes: ① the engine loads client bundles **at startup** — restart `dsh web`; ② pnpm 11's **24 h cool-down** (`minimumReleaseAge`, default 1440 minutes) refuses versions published today unless you pin them (you can also add `dsh-drydock@1.0.3` to `minimumReleaseAgeExclude` in the profile's `pnpm-workspace.yaml`).
40
+ Then use the sidebar **"Plugin manager"** on `http://127.0.0.1:3080`, or the fallback page `http://127.0.0.1:3081/plugins`. Set your browser home page to `http://127.0.0.1:3081/` and opening the browser self-checks, repairs and starts the engine.
261
41
 
262
- After installing: the sidebar shows the first-level entry **"Plugin manager"** (the built-in page is disabled and taken over by this package's patch). 🛟 in the bottom right opens the rescue center; the engine-hosted rescue page is `http://127.0.0.1:3080/rescue`.
42
+ - **Do not want a profile install?** `npx dsh-drydock` runs the 3081 launcher, `npx dsh-drydock-boot --repair-only` self-checks and repairs, `npx dsh-drydock-rescue` runs the 3082 backup rescue.
43
+ - **Did not install / still the old UI?** ① client bundles load at startup — **restart `dsh web`**; ② pin the version during the 24 h cool-down (or add `dsh-drydock@1.0.4` to `minimumReleaseAgeExclude` in the profile's `pnpm-workspace.yaml`). Full install / update / uninstall / rollback / offline tgz / autostart: [docs/INSTALL.md](docs/INSTALL.md).
263
44
 
264
- > ### Why `dsh plugin --profile web add` and not `npm install` in the directory?
265
- >
266
- > - This is a **plugin for the DSH engine** and needs modules the engine provides (`@deepseek-ai/*`). `dsh plugin add` uses **pnpm**, and the profile disables `autoInstallPeers`, so the engine's copy is reused instead of being installed twice.
267
- > - The engine's `@deepseek-ai/*` packages are **pre-release versions** on npm (`-rc.*` / `-alpha.*`) with a messy version history (e.g. `dsh-home-paths` `latest` is stuck at `0.0.1-rc.3` while engines ship `0.1.7-rc.2`). Installing this package with **npm** makes npm resolve those pre-release ranges with its own peer rules — behaviour differs per npm version (a warning, or a hard `ERESOLVE`). **That is a fact about the engine's packages, not a defect of this plugin**; this package's own runtime dependencies are just `yaml` and `zod`.
268
- > - If your npm config is strict about pre-release peers, add `--legacy-peer-deps`.
269
- > - Conclusion: **always install into a profile with `dsh plugin … add`**; `npm install` is only for the devDependencies of this repository (see "Development and tests").
45
+ ## Upgrade check (users on pre-0.9.1 builds)
46
+
47
+ > ⛔ **`dsh-plugin-manager-pro` releases before 0.9.1 (including `0.9.1-rc2`) are retired**: they carry known supply-chain risk and crash on load with Node < 22.14. npm now shows a **strengthened deprecation notice** (packages are not deleted; historical versions remain installable but should not be used).
270
48
 
271
- Uninstall:
49
+ Upgrade with one command:
272
50
 
273
51
  ```sh
274
- dsh plugin --profile web remove dsh-drydock # calls --uninstall below to clean autostart/supervisor/shims first
275
- npx dsh-drydock --uninstall-autostart # Windows: remove autostart (idempotent)
276
- npx dsh-drydock --uninstall # optional: remove every launcher trace (stop supervisor + delete DSHWeb* + shims + pid)
52
+ dsh plugin --profile web remove dsh-plugin-manager-pro # drop the old package
53
+ dsh plugin --profile web add dsh-drydock@^1.0.4 # the only recommended entry
54
+ dsh web # restart to apply
277
55
  ```
278
56
 
279
- ## Rescue quick reference
57
+ `dsh-drydock` is the only recommended package name; rollback inside 1.0.x uses the same name (e.g. `dsh-drydock@1.0.3`). The engine must be ≥ 0.1.7-rc.2; older engines should stay on their historical release. See [docs/INSTALL.md](docs/INSTALL.md) and [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
280
58
 
281
- | Situation | What to do |
282
- |---|---|
283
- | Engine is fine, UI is broken | `http://127.0.0.1:3080/rescue` (rescue page / 🛟 button) |
284
- | 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**) |
285
- | 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` |
286
- | 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) |
287
- | 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 |
288
- | 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) |
289
- | 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) |
290
- | 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 |
291
- | Installed but the UI is still old | The engine loads client bundles at startup — restart `dsh web` (or let the launcher restart the engine) |
292
- | 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) |
59
+ ## Entries
293
60
 
294
- ---
61
+ | Entry | Address | Purpose |
62
+ | --- | --- | --- |
63
+ | Manager (3080) | `http://127.0.0.1:3080` → sidebar "Plugin manager" | Everyday entry: list / install / configure / uninstall / rescue |
64
+ | Fallback page (3081) | `http://127.0.0.1:3081/plugins` | Available with the engine down: toggle / update / uninstall / health check / restart |
65
+ | Boot page (3081) | `http://127.0.0.1:3081/` | Open and it self-checks → repairs → starts (best as browser home page) |
66
+ | Rescue page (3081) | `http://127.0.0.1:3081/rescue` | verify / fix / start / stop / status |
67
+ | Rescue button 🛟 | bottom-right of 3080 | Draggable, remembered position; entry when settings are broken |
295
68
 
296
- ## How it works
69
+ > The engine also serves `/rescue` at `http://127.0.0.1:3080/rescue`, but it goes through host admission: **entering from inside the app** (rescue button / plugin page) works; typing it in the address bar is an origin-less top-level navigation and gets 403. Use the 3081 page when the engine is down.
297
70
 
298
- - **Host** (`lib/index.js`): reads live Cordis loader state (enabled / runtime phase / error) and exposes remote methods through the Typert gateway (list / setEnabled / update / verifyProfile / fixProfile / marketCatalog / …). Convergence is judged from real engine fields (`Entry.disabled` / `_initTask` / `fiber.state`) and honestly reports "restart required" instead of pretending.
299
- - **Plugin page takeover** (`src/client.jsx` + `cordis.patch.yml`): registers into `main` (key=`plugins`) and `sidebar.panellist` (id=`plugins`), disables the built-in `ui-plugin-manager` row and declares the 7 `plugins.*` child slots; the three that third-party plugins really use (`plugins.row.config` / `plugins.bundle.config` / `plugins.item`) have real render exits — **an unregistered key never produces an empty button**.
300
- - **Toggle persistence**: rows written into the profile's `cordis.patch.yml`, always carrying the `Managed by dsh-drydock` marker (legacy `dsh-plugin-manager-pro` markers are still read) so user-owned patch rows are never touched.
301
- - **Update aggregation** (`lib/aggregate.js` + `compare-versions.js`): the trust layer is decided by each source's `authoritative` flag (not by its type) → highest among authoritative sources (random tie-break) → fallback only when no authoritative version exists (`degraded`); 10-minute circuit breaking on 403/429; prereleases only on the `@deepseek-ai/*` `next` track.
302
- - **Downloader** (`lib/downloader.js`): streaming HTTP; magnet/.torrent prefer an external downloader (cross-platform where/which) → built-in webtorrent → manual import; downloads-folder auto-install is gated by the `pendingDownloads` provenance records in the sidecar.
303
- - **Cross-platform** (`lib/platform.js`): npm global root via `%APPDATA%\npm` on Windows, `npm root -g` plus common paths and nvm directories elsewhere (10-minute cache).
304
- - **Standalone rescue** (`lib/preflight.mjs` + `lib/enginectl.mjs`): plain-Node self-check/repair and engine lifecycle shared by all three CLI tools; port split: 3081 launcher (single web entry with `/rescue`), 3082 backup rescue service, 4081 supervisor lock.
305
- - **Local write-endpoint guards** (v0.9.1, `lib/enginectl.mjs`: `newApiToken` / `allowedOriginsOf` / `guardWriteRequest` / `createSingleFlight`): the local write endpoints (`POST /api/boot`, `/rescue/api/start|fix|stop`) require a **same-origin `Origin`** — the same-host, same-port allowlist `127.0.0.1` / `localhost` / `[::1]`, **never derived from the `Host` header** (`localhost:3081` and `127.0.0.1:3081` are equivalent; another port is not) — plus a page-injected one-time token (`X-DSH-PM-Token`, 48 hex chars, never written to disk, rotated on every start); a missing `Origin` (local tools) still requires the token, otherwise 401. Boot/start are single-flighted (a concurrent second request gets 409), so a third-party web page cannot start/stop anything. Read endpoints (`GET /api/status|verify`) stay open for local tools.
306
- - **Health trail**: `--status` appends `OK|FAIL boot=…@3081 engine=…@3080` to `profile/health.log` (7 days / 1000 lines).
307
- - **Protected entries**: the manager itself, loader infrastructure, webserver/connection/ui-layout etc. cannot be toggled; the rescue and auto-quarantine protection sets share one source, and auto-quarantine additionally needs repeated failures.
308
- - **Deep dive**: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) (process diagram, slot contract, sidecar fields, uninstall transaction) and [docs/LAUNCHER.md](docs/LAUNCHER.md) (command/exit-code tables).
71
+ ## Requirements
309
72
 
310
- ---
73
+ - Windows 10/11 · macOS · Linux (rescue toolchain and all three bins are cross-platform; **autostart management is Windows-only**).
74
+ - Node.js: `engines.node` declares `>=18.0.0` (not tightened in this release), but Node 18 is EOL and pnpm 11 no longer supports 18/20/21 — **run Node 22 LTS or newer**.
75
+ - DSH `dsh` ≥ `0.1.7-rc.2` (`<0.3.0-0`) and `pnpm` (`dsh plugin` and updates depend on it).
76
+ - Loopback ports `3080` (engine) · `3081` (launcher) · `3082` (backup rescue) · `4081` (supervisor lock = 3081+1000), all bound to `127.0.0.1`.
311
77
 
312
- ## Development and tests
78
+ Details: [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
313
79
 
314
- ```sh
315
- npm install # if npm blocks the esbuild install script: npm approve-scripts esbuild
316
- npm run build # bundle the browser side → lib/client.js
317
- npm test # build + bundle + render + integration + launcher
318
- node test-launcher.mjs --strict # launcher tests (random ports + temp profile, never touches a real profile/registry)
319
- node tools/test-host-fixes.mjs # host-side regression assertions
320
- npm run check:vendor # vendor consistency (per-file sha256 inside the tgz == working tree)
321
- npm run pack # build + npm pack
322
- node tools/dev/gen-changelog.mjs # regenerate CHANGELOG.md from docs/releases/*.md
323
- node tools/dev/gen-changelog.mjs --check # verify CHANGELOG.md is up to date (exit 1 when stale)
324
- node test-docs.mjs # docs/version consistency (offline, no deps: README version == package.json, release notes + CHANGELOG contain 1.0.3)
325
- ```
326
-
327
- Docs: [docs/RELEASING.md](docs/RELEASING.md) (release flow), [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md), [docs/LAUNCHER.md](docs/LAUNCHER.md), [CHANGELOG.md](CHANGELOG.md) (generated) and [docs/releases/](docs/releases/).
80
+ ## Docs
328
81
 
329
- ## FAQ
82
+ The detailed docs are currently **Chinese only** — English deep-dive docs have **not been split yet**; `README.en.md` is a condensed entry and links below point to the Chinese docs.
330
83
 
331
- | Symptom | Cause & fix |
332
- |---|---|
333
- | 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) |
334
- | Plugin state does not change after toggling | The engine applies entries at startup: written to config immediately, **effective after an engine restart** |
335
- | `dsh plugin add` says "Already up to date" | pnpm caches tarballs by version: **bump the version** before adding again |
336
- | 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` |
337
- | 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 |
338
- | 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 |
339
- | Browser reports `waiting for service: remote.xxx` | A client `inject` must not include its own remote (deadlock); inject only keeps `["slots","locale","remote"]` |
340
- | A third-party plugin has no ⚙ config entry | Since 0.9.0 entries are generated for its registered slots; if the plugin has not adopted the 0.1.7 slots yet, report it to the plugin author |
341
- | P2P magnet links will not download | Install aria2c (auto-detected) or webtorrent, or import the file manually into your download manager |
84
+ | Doc | Content |
85
+ | --- | --- |
86
+ | [docs/INSTALL.md](docs/INSTALL.md) | Install / update / uninstall / rollback / offline tgz / 24 h cool-down / autostart / ports / upgrading from the old package |
87
+ | [docs/USAGE.md](docs/USAGE.md) | Carriers, origin three-way sections and tabs, transactional uninstall, history, scenarios, updates & downloads, market, fallback page |
88
+ | [docs/SECURITY.md](docs/SECURITY.md) | Permissions and data scope, update-source trust model, download provenance, write-endpoint guards, admission, threat model |
89
+ | [docs/RESCUE.md](docs/RESCUE.md) | Standalone rescue toolchain, rescue quick reference, 3081 API, how it works, 3082 |
90
+ | [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md) | Requirements, engine compatibility matrix, Node, platforms and ports |
91
+ | [docs/FAQ.md](docs/FAQ.md) | FAQ and troubleshooting (including old-package upgrades) |
92
+ | [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | Three-process architecture, slot contract, sidecar fields, uninstall transaction |
93
+ | [docs/LAUNCHER.md](docs/LAUNCHER.md) | All CLI commands and exit codes, `--uninstall` loop, write-endpoint guards |
94
+ | [CHANGELOG.md](CHANGELOG.md) | Version history (generated) |
95
+ | [docs/releases/](docs/releases/) | Per-release notes ([1.0.4](docs/releases/1.0.4.md)) |
96
+ | [docs/README-full.md](docs/README-full.md) | v0.9.1-era full archive — **not the current manual** |
342
97
 
343
98
  ## License
344
99
 
345
100
  MIT. The patch-persistence approach is inspired by [hrhgit/deepseek-harness-plugin-manager](https://github.com/hrhgit/deepseek-harness-plugin-manager) (MIT).
346
101
 
347
- ---
348
-
349
- ## 中文
350
-
351
- 中文说明(主文档):[README.md](README.md) — 与本文的功能清单与命令保持一致。
102
+ Chinese (main) documentation: [README.md](README.md).
package/README.md CHANGED
@@ -1,349 +1,139 @@
1
1
  <p align="center"><img src="docs/images/logo.svg" width="88" height="88" alt="DSH 引擎船坞 drydock"></p>
2
2
 
3
- # DSH 引擎船坞(dsh-drydock,原名 dsh-plugin-manager-pro)
3
+ # DSH 引擎船坞(dsh-drydock)
4
4
 
5
- > **当引擎起不来的时候,它还在。** 为 [DeepSeek Harness(DSH)](https://github.com/deepseek-ai/deepseek-harness) 提供**启动期可靠性工具链**:独立进程、独立端口的启动前自检、坏插件隔离、引擎拉起与救援(3081 / 3082),外加一个顺手的插件管理台。日常的逛与装请用官方插件页或插件市场——我们不重复做。
5
+ > **当引擎起不来的时候,它还在。** 为 [DeepSeek Harness(DSH)](https://github.com/deepseek-ai/deepseek-harness) 提供**启动期可靠性工具链**:独立进程、独立端口的启动前自检、坏插件隔离、引擎拉起与救援(3081 / 3082),外加一个顺手的插件管理台。
6
+ >
7
+ > 官方与插件市场负责「装进来」;引擎船坞负责「装完之后」——**装坏了能撤,引擎崩了能救**。它修这次启动,我们修下一次为什么还会坏。
6
8
 
7
9
  ![badge](https://img.shields.io/badge/dsh-0.1.7+-blue) ![license](https://img.shields.io/badge/license-MIT-green) ![version](https://img.shields.io/npm/v/dsh-drydock?color=orange) ![npm](https://img.shields.io/npm/dt/dsh-drydock)
8
10
 
9
11
  > 社区/本地插件,非 DSH 官方包。npm:`dsh-drydock`(原名 `dsh-plugin-manager-pro`,旧包已挂弃用提示、不删包,仅保留供历史版本安装)· GitHub:[nonentity303/dsh-drydock](https://github.com/nonentity303/dsh-drydock) · 跨平台(Windows / macOS / Linux)
10
12
  >
11
- > **本页对应版本:1.0.3(npm latest,2026-11-27)**。核对:`npm view dsh-drydock version`;标签见 <https://github.com/nonentity303/dsh-drydock/tags>。
12
- > **包名迁移已完成**:npm 包名就是 `dsh-drydock`(旧包名只保留供历史版本安装);GitHub 仓库已改名(旧链接自动跳转)。安装方式见下文[安装](#安装--更新--卸载)。
13
- > ⚠️ 刚发布的版本会被 pnpm 的 24 小时冷静期(`minimumReleaseAge`)挡住,装不到时请**显式写版本号**(见下文[安装](#安装--更新--卸载))。
14
-
15
- **本管理器接管引擎内置的插件管理页,并补上官方不做的部分**:装卸的完整闭环(影响预览 → 事务化卸载 → 失败回滚 → 一键撤销)、操作历史与场景方案、引擎不可用时依然可用的兜底管理页,以及**主引擎起不来时的独立救援工具链**。任一载体失效时,其余载体仍可完成启停、卸载与恢复操作。
16
-
17
- ### 定位:装完之后的事,交给引擎船坞
18
-
19
- | 场景 | 谁来管 |
20
- | --- | --- |
21
- | 找插件、逛市场、一键装 | 官方插件页 / 插件市场(dshmarket 等)——这条赛道已封顶;本工具**不自建目录**,市场页签只是借 ADP 目录的顺手入口 |
22
- | 装坏了怎么办 | **本工具**:事务化卸载(影响预览 → 体检 → 备份 → 删除 → 验证 → 失败自动回滚)+ 一键撤销(最近 20 次操作留痕) |
23
- | 装多了怎么管 | **本工具**:来源三分区 + 场景方案(启停组合一键切换)+ 操作历史 |
24
- | 引擎起不来怎么办 | **本工具**:独立进程 3081 的 `verify / fix / start / stop / status`,不依赖 Cordis 运行时;带明确退出码,可被脚本/外部调用 |
25
-
26
- > **一句对外口径**:官方与插件市场负责「装进来」;我们负责「装完之后」——装坏了能撤、引擎崩了能救。**它修这次启动,我们修下一次为什么还会坏。**
27
- >
28
- > **不做清单**(请直接使用对应工具,不必在本工具里找):备份恢复 / WebDAV · 主题切换 · 安全静态扫描 · 评论区与截图分享——这些 dshmarket 已成熟;本工具只专注运维与救援,不做它们的替代品。
29
-
30
- ![独立插件页:侧边栏一级入口「插件管理」+ 五个页签](https://raw.githubusercontent.com/nonentity303/dsh-drydock/master/docs/images/pm-090-official2.png)
31
-
32
- <sub>**图 1** · 独立插件页实拍:侧边栏一级入口「插件管理」,页签为 官方内置(可选)· 全部插件 · 插件市场 · 操作与场景 · 维护。**1.0 起列表内部改为来源三分区**(见下文),页签结构不变。源图:`docs/images/pm-090-official2.png`。</sub>
33
-
34
- ---
35
-
36
- ## 载体一览
37
-
38
- | 载体 | 入口 | 说明 |
39
- | --- | --- | --- |
40
- | **管理台(3080)** | `http://127.0.0.1:3080` → 侧边栏「插件管理」 | 接管引擎内置插件页;功能最全的日常入口,跟随 DSH 主题变量 |
41
- | **兜底页(3081)** | `http://127.0.0.1:3081/plugins` | 纯 Node 进程托管,不依赖引擎运行;扁平设计,深浅主题(自动跟随引擎外观与系统偏好) |
42
- | 启动页(3081) | `http://127.0.0.1:3081/` | 打开即自检并启动引擎(浏览器主页设为它 = "打开即启动") |
43
- | 救援球 🛟 | 3080 右下角浮动按钮 | 可拖动换位(位置持久记忆),单击打开救援页 |
44
- | 救援页 | `http://127.0.0.1:3081/rescue` | verify / fix / start / stop / status 全套修复能力 |
45
-
46
- ## ✨ 亮点
47
-
48
- - **独立插件页**:插件管理不挤在设置页里——侧边栏一级入口,一个页面完成看插件、装插件、**配插件**、卸插件、救引擎
49
- - **来源三分区列表**(v1.0):核心组件(锁定)/ 引擎内置组件 / 用户插件,语义与引擎实际情况一一对应;来源筛选与分区联动
50
- - **第三方配置入口有落点**:插件行内一行摘要,展开即是它自己的完整配置卡片(`plugins.row.config` / `plugins.bundle.config` 槽位)
51
- - **事务化卸载**(v1.0 加固):卸载前**影响预览与体检** → 备份 → `pnpm remove` → 清理补丁条目 → 逐项验证 → **失败自动回滚**;卸载后可**一键撤销**
52
- - **操作历史 + 场景方案**:最近 20 次操作留痕可撤销;插件组合保存为命名场景,一键切换(应用前展示变更预览)
53
- - **兜底页独立于引擎**(v1.0):引擎挂了,`http://127.0.0.1:3081/plugins` 依然能启停 / 更新 / 卸载 / 体检 / 重启引擎
54
- - **多源更新聚合**:默认 npm 官方 / GitHub 官方仓库 / npmmirror 三源,**registry 版本权威**;自定义源默认只作降级兜底(不与官方源混比),`http://` 源默认标「明文 · 仅兜底」;仅 `@deepseek-ai/*` 才走 `next` 轨道,其余只取 `latest` 并过滤预发布
55
- - **下载目录自动安装有来源记录**(1.0.3):`$DSH_HOME\downloads` 里的归档必须对上管理器自己生成的 provenance 记录(包名 + 版本 + 来源 + 摘要)才会自动安装,对不上的拒绝并写 `.failed`
56
- - **浏览器即启动器**:主页设为 `http://127.0.0.1:3081/`,打开浏览器 = 自动自检 → 修复 → 启动 → 跳转主界面
57
- - **本地写接口有防护**(v0.9.1):`Origin`(同机同端口白名单)+ 一次性令牌 + 单飞闸门,第三方网页无法触发启动/停止
58
-
59
- ## 📋 功能总览(1.0.3)
60
-
61
- ### 管理台(3080)
62
-
63
- #### 分区模型(v1.0)
64
-
65
- 插件列表按来源分三区,语义与引擎实际情况一一对应:
66
-
67
- | 分区 | 判定 | 行为 |
68
- | --- | --- | --- |
69
- | **核心组件(引擎必需,不允许禁用)** | 包名白名单(dsh-base / dsh-web-app) | 锁定展示,开关与卸载均拒绝 |
70
- | **引擎内置组件** | 引擎自带(origin=builtin) | 可启停、可查看;行徽章「内置」,区内按名称排序 |
71
- | **用户插件** | 用户安装(origin=user) | 完整操作:启停 / 更新 / 卸载 / 配置 |
72
-
73
- - 「推荐」不再是分区,而是**行内标签**:仅真正的第三方推荐加装件(如 browser-control)显示,重要引擎组件不再混入推荐清单
74
- - 来源筛选(全部 / 架构自带 / 用户安装)、搜索、分区折叠与计数互相联动
75
- - **来源人工修正**:自动判定来源标签(npm / GitHub / 本地 / 内置),每行可手动覆盖并持久化
76
- - **状态一目了然**:启用状态(🔴 错误/需检查 · 🟡 需更新 · ⚪ 未启用 · 🟢 启用)、名称、功能简介、已装→最新版本 + 来源、开关按键
77
- - **简介自动提取**:内置中文目录优先;未收录的 mod 自动从 `README.zh.md`(优先)/ `package.json.description` / `README.md` 提取一句话简介
78
- - **核心保护**:核心组件白名单行禁止开关与卸载(🔒 标记)
79
-
80
- #### 页签
81
-
82
- - **官方内置(可选)**:引擎自带、默认未启用的组合包一键启用/停用 + 版本豁免
83
- - **全部插件**:插件清单(见上文分区模型)
84
- - **插件市场**:ADP 精选目录,一键安装(见下文)
85
- - **操作与场景**:事务化卸载与影响预览、**卸载前体检**、操作历史一键撤销、场景方案
86
- - **维护**:更新源与刷新、启动前自检、救援中心入口、下载目录
87
-
88
- 行内操作:启停开关(写前自动备份)、市场详情、卸载(卸载前体检预览)、配置页(运行时 slot 注册的插件)。
89
-
90
- #### 管理器自身的禁用与卸载(统一口径)
91
-
92
- 管理器不能在自身管理界面(3080)中停用自己;如需禁用或卸载,请前往启动器兜底页(3081 /plugins)或使用 dsh 命令行——兜底页独立于引擎存活,禁用后仍可恢复。
93
-
94
- 3080 内允许的例外是**卸载**:走额外警告路径,卸载前自动清理开机自启,结果写入卸载报告;卸载后 3080 管理界面消失、3081 兜底页存活至启动器进程结束。
95
-
96
- ### 🔐 事务化卸载、历史与场景
97
-
98
- - **卸载影响预览**:卸载前展示「影响范围」——依赖该包的已安装插件(`dependencies` / `peerDependencies` 反向图)、将移除的插件条目、将清理的开关行、bundles 声明
99
- - **事务化卸载**:备份 `package.json` + `cordis.patch.yml`(`.rescue-bak-*`)→ `pnpm remove` + 清理补丁条目 + 移除 bundles/开关行 → 逐项验证 → **任何失败自动回滚**;Windows 文件锁残留目录登记 `pendingRemovals`,下次启动自动清理
100
- - **加固(v1.0)**:`pnpm remove` 超时或进程状态不明时**不**盲目回滚——标记「未知」请人工确认,避免把半删状态变成更坏状态;EBUSY 引导(引擎运行中且目标启用时拒绝硬删,提示「先禁用 → 重启引擎 → 再操作」)
101
- - **卸载报告**:自检结果、清理开关行数、级联卸载包、残留列表;支持级联卸载依赖它的可卸载包
102
- - **卸载前体检**(v0.9.1):预览里给出**结论行**(安全 / 需注意 / 有风险 + 一句理由),并列出三类检查——① 依赖断裂 ② `cordis.patch.yml` 补丁残留(**只提示、绝不自动删**)③ service 与端口冲突
103
- - **操作历史**:最近 20 次操作(卸载/启停/隔离/场景应用/重置开关),一键撤销,侧车持久化跨重启
104
- - **场景方案**:把当前启停状态保存为命名场景(如「办公/写作/演示」),一键应用——先展示**变更预览**,确认后切换;可更新、删除
105
- - **卸载管理器自身前先清理自启**:删包之前先调用包内 `bin/open-boot.mjs --uninstall`(旧版本无该能力 → 记为"已跳过",不阻断卸载)
106
-
107
- ### 📥 更新与下载
108
-
109
- #### 更新源信任模型(1.0.3 新口径)
110
-
111
- - **默认更新源(三个)**:npm 官方(`registry.npmjs.org`)/ GitHub 官方仓库 / npmmirror 镜像(`registry.npmmirror.com`)
112
- - **registry 版本权威**:权威源给出确定版本时,**只在权威源之间**取最高(并列随机),其它源不参与这次裁决;权威源都没有版本时才降级兜底,并在界面与回执里标 `degraded`
113
- - **自定义源默认只作兜底**:用户新增的源落在 `custom` 层,默认 `authoritative: false`,**不再与官方源混比**;要让它独立裁决版本,必须显式 `authoritative: true`(内网 / 离线部署用,意味着"此后版本裁决与安装均来自该源")
114
- - **`http://` 源允许但默认"明文 · 仅兜底"**:内网 registry / 代理是真实场景,所以不禁止;但默认不进权威层。升权威需显式 `authoritative: true`,明文源还要再给 `allowInsecure: true` 才真正生效,否则自动降级并把原因写进可读 note(不静默)
115
- - **`official` 徽标由服务端判定**:内置权威白名单只有 npm 官方与 npmmirror(按规范化 URL 比较),客户端提交的 `official` 一律忽略
116
- - **只有 `@deepseek-ai/*` 有 `next` 轨道**:仅该命名空间(且源是内置权威源)才优先 `dist-tags.next`;其余包只取 `latest`,`latest` 本身是 semver 预发布(含 `-`)时视为"无可用版本"——不把 RC 推给普通用户
117
-
118
- #### 下载
119
-
120
- - **限流熔断**:GitHub API 403/429 自动冷却 10 分钟;全量刷新 8 并发、结果缓存 30 分钟
121
- - **下载优先级**:① 浏览器原生下载(隐藏 iframe,NDM 等扩展可捕获)→ ② 外部下载软件 → ③ 内置下载器兜底(HTTP 直链 / aria2c / P2P magnet·torrent)
122
- - **下载目录自动安装需来源记录(provenance)**:`.tgz` / `.tar.gz` 放进 `$DSH_HOME\downloads` 后,先读归档内的 `package.json`,只有能与管理器自己生成的下载记录(包名 + 版本 + 来源 + 期望摘要,7 天有效)对上的才自动安装;对不上的拒绝并写 `.failed`(提示"未找到来源记录——不是本管理器生成的下载链接;确认可信后再删除 .failed 重试"),安装成功后记录移除
123
- - **校验口径**:只有内容摘要(integrity / shasum)才算"已校验",**字节数单独存在不算**;重定向逐跳校验,任何一跳降级到明文 `http` 都拒绝(除非显式 `allowInsecure`);无摘要的下载默认拒绝,`security.unverifiedDownloads: allow` 放行时回执也会明说"未校验"
13
+ > **本页对应版本:1.0.4**(核对:`npm view dsh-drydock version`;标签见 <https://github.com/nonentity303/dsh-drydock/tags>)
14
+ > ⚠️ 刚发布的版本会被 pnpm 的 **24 小时冷静期**(`minimumReleaseAge`)挡住:装不到或装完还是旧版时,**显式写版本号**(见下方安装)。
124
15
 
125
- ### 🛒 插件市场
16
+ ## 四个主打特色
126
17
 
127
- - **ADP 精选目录**:数据来自 awesome-dsh-plugin 收录池,带本地化描述 / 星标 / 收录日期与分类;条目数随上游变化,host 端 10 分钟缓存
128
- - **零往返过滤**:目录一次拉全量,搜索 / 分类 chips / 排序 / 分页全部客户端本地完成
129
- - **一键安装**:带 npm 名的条目优先 **npm registry 直装**;GitHub 仓库走内置下载器;两步确认防误触;已装 ✓ 徽标
130
- - **装后防砖校验**:自动验证 `dsh.bundle` / `dsh.client` 清单,缺失自动卸载;pnpm hoist 漂移 / `minimumReleaseAge` 陷阱自动恢复
18
+ ### ① 独立救援工具链:引擎挂了还能救
19
+ 3081 启动器(`/` 打开即自检启动、`/plugins` 兜底管理页、`/rescue` 救援页)与 3082 备份救援守护跑在**独立进程、独立端口**,不依赖 Cordis 运行时;`verify / fix / start / stop / status` 带明确退出码(0 就绪 / 1 启动失败 / 2 修复未完成),可被外部脚本调用。→ [docs/RESCUE.md](docs/RESCUE.md)
131
20
 
132
- ### 🛟 兜底页(3081 /plugins,v1.0 新增)
21
+ ### ② 事务化卸载 / 失败回滚 / 一键撤销
22
+ 卸载前给**影响预览 + 体检结论**(安全 / 需注意 / 有风险)→ 备份 → 卸载 → 逐项验证 → **任何失败自动回滚**;Windows 文件锁残留登记 `pendingRemovals`,下次启动自动清理;最近 20 次操作一键撤销,插件组合存为**场景方案**一键切换。→ [docs/USAGE.md](docs/USAGE.md)
133
23
 
134
- 引擎不可用时依然可用的管理入口(纯 Node 进程托管,扁平设计 + 深浅主题):
24
+ ### ③ 更新源信任模型 + 下载 provenance
25
+ 默认 npm 官方 `registry.npmjs.org` / GitHub 官方仓库 / npmmirror 三源,**registry 版本权威**;自定义源默认 `authoritative: false` **只作兜底**、不与官方源混比;`http://` 源允许但默认标「**明文 · 仅兜底**」,升权威需显式 `authoritative: true` + `allowInsecure: true`;只有 `@deepseek-ai/*` 走 `next` 轨道;下载目录自动安装必须对上**来源记录 provenance**(包名 + 版本 + 来源 + 摘要,7 天有效)。→ [docs/SECURITY.md](docs/SECURITY.md)
135
26
 
136
- - **启停 / 更新 / 卸载**:toggle 写 `dsh.profile.bundles`(写前备份);`pnpm outdated` 批量比对、逐个更新;事务性卸载(同上,每步落日志)
137
- - **mod 体检**:只读 preflight + 引擎日志尾部按包聚合,verdict 三档(ok / suspect / broken)
138
- - **重启引擎 / 停止启动器**:确认框 + toast,写接口全部走 Origin + 一次性令牌防护
139
- - **有意不做**:行内配置面板、场景管理、下载诊断(依赖引擎 Cordis 运行时,与兜底页定位冲突)——完整功能在 3080 管理台
27
+ ### ④ 3081 兜底页 + 跨平台中文 UI
28
+ 引擎挂了也能在 `http://127.0.0.1:3081/plugins` 启停 / 更新 / 卸载 / 体检 / 重启引擎;全中文界面、深浅主题自动跟随系统偏好;Windows / macOS / Linux 全平台(开机自启管理目前为 Windows)。→ [docs/USAGE.md](docs/USAGE.md)
140
29
 
141
- ### 🛟 救援
30
+ ## 安装(30 秒)
142
31
 
143
- - **独立救援页 `/rescue`**:自包含 HTML 直连宿主网关,UI 全坏仍可诊断/隔离/一键修复/重启/卸载
144
- - **浮动救援球**:右下角 🛟 按钮,可拖动换位(位置记忆),设置页损坏时的入口
145
- - **自动隔离**:可选开关(**默认关**),只隔离**连续失败达阈值**的插件;界面骨架与基础设施条目在保护集内,永不自动禁用
146
- - **启动前自检**:`verifyProfile` / `fixProfile`——坏 bundle 会在启动阶段拖垮引擎,一键检查与隔离修复
147
- - **运行期失败条目自动隔离**:启动失败后自动**解析启动日志 → 隔离失败条目 → 重试**,隔离行带备份可逆(3081 的「重启引擎」也会执行一次)
148
-
149
- ![维护 → 救砖:诊断中心](https://raw.githubusercontent.com/nonentity303/dsh-drydock/master/docs/images/pm-maintenance-rescue.png)
150
-
151
- <sub>**图 2** · 维护页签的「诊断中心」实拍:一键修复引擎 / 重启引擎 / 启动前自检 / 失败插件自动隔离。源图:`docs/images/pm-maintenance-rescue.png`。</sub>
152
-
153
- ## 🧰 独立救援工具链(核心亮点)
154
-
155
- > 引擎不可用时,宿主编排的恢复界面(含插件市场内建的恢复面板)能力受限。本工具的差异是**进程级**:救援链跑在独立进程、独立端口(3081),`verify / fix / start / stop / status` 带明确退出码(0 就绪 / 1 启动失败 / 2 修复未完成),可被外部脚本调用,不依赖主引擎是否活着。零新依赖(纯 Node + 项目已有 yaml)。
156
-
157
- | 工具 | 用途 | 用法 |
158
- |---|---|---|
159
- | `bin/open-boot.mjs` | **唯一网页入口 + 常驻守护**(3081):`/` 是"打开即启动"页;**`/plugins` 是兜底管理页**(v1.0);`/rescue` 是救援页。设为浏览器主页即"打开即启动"。平时完全隐藏,只有引擎需要拉起时才弹一个可见启动窗口(`--no-window` 可关)。健康判定 = HTTP 握手 + 身份指纹;写接口带 Origin + 一次性令牌防护;`--uninstall` 一键清理(退出码 0/1/2,2 = 归属未确认时不动任何进程) | `npx dsh-drydock` |
160
- | `bin/rescue-daemon.mjs` | **独立备份救援守护**(默认端口 **3082**):自包含中文救援页 + `verify/fix/start/stop/status` API,不依赖主引擎。**不与 3081 抢端口**(被占时明确报错退出,不静默漂移) | `npx dsh-drydock-rescue`(默认 3082) |
161
- | `bin/dsh-boot.mjs` / `.cmd` | **Steam 式启动序列**:verify → 自动隔离坏插件 → 启动 → 健康等待。`--repair-only` 只自检+修复不启动;退出码 0=就绪 / 1=启动失败 / 2=修复未完成;启动即失败会**立即返回**并打印日志绝对路径 | `npx dsh-drydock-boot`(Windows 双击:**包内** `bin\dsh-boot.cmd`) |
162
-
163
- > 端口的完整分工、退出码表、写接口防护与 `--uninstall` 四步见 [docs/LAUNCHER.md](docs/LAUNCHER.md);进程与槽位架构见 [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)。
164
-
165
- #### 启动器常驻与开机自启
166
-
167
- | 命令 | 作用 |
168
- |---|---|
169
- | `npx dsh-drydock --supervise [--interval 60] [--heartbeat-min 10]` | **常驻守护**:静默确保 3081 有服务;锁端口(`port+1000`)单实例;只有 HTTP 握手失败才拉起,绝不误杀健康实例 |
170
- | `npx dsh-drydock --ensure` | 一次性确保 3081(桌面快捷方式用,退出码 0/1) |
171
- | `npx dsh-drydock --status` | **状态自检 + 健康留痕**:启动器/守护/引擎/PID/cwd/日志与最后心跳;每次追加一行 `profile/health.log`(保留 7 天 / 1000 行) |
172
- | `npx dsh-drydock --install-autostart` | **写开机自启**(Windows):HKCU Run + 登录静默常驻;包装脚本正文纯 ASCII,中文用户名/含空格路径不乱码 |
173
- | `npx dsh-drydock --uninstall-autostart` / `--autostart-status` | 移除自启 / 查看状态;未安装时**幂等**(exit 0) |
174
- | `npx dsh-drydock --uninstall` | **卸载闭环**:三重归属校验停守护 → 删 HKCU\...\Run 下**所有** `DSHWeb*` 值 → 删 shim → 清 pid(**日志保留**)。退出码 0=完成 / 1=出错 / **2=归属未确认**(不动任何进程、保留 pid);引擎 3080 不动。管理器卸载自身前会自动调用它 |
175
- | `npx dsh-drydock --help` / `npx dsh-drydock-boot --help` | 显示用法(参数不再被静默忽略) |
176
-
177
- > **健康判定与"停引擎"的安全性**:引擎/启动器就绪 = **HTTP 握手成功且响应带 dsh 身份指纹**(裸 TCP 监听器一律判不健康)。端口被别的进程占用时明确报错,不静默换端口。`stopEngine()` 前三重校验(pid 存活 / 进程镜像 / 端口归属),不过一律拒绝,需要时可在救援页"强制停止"。PID 文件均为 JSON(`profile/.rescue-daemon.pid` / `.open-boot.pid`)。
178
- >
179
- > ⚠️ **实现注意**:自启包装脚本一律「wscript → node」,不用隐藏 PowerShell(会被部分杀软误判删除);守护拉起引擎时刻意不加 `windowsHide`。
180
-
181
- ## 环境要求
182
-
183
- - Windows 10/11 · macOS · Linux(`/rescue` 与三个 bin 工具全平台可用;**开机自启管理目前为 Windows**)
184
- - Node.js ≥ 18 · DeepSeek Harness `dsh`(全局安装或 npx)· `pnpm`(`dsh plugin` 与更新功能依赖)
185
- - `engines.node` 以 `package.json` 为准(本版仍是 `>=18.0.0`,**未收紧**);但 Node 18 已 EOL、pnpm 11 也不再支持 18/20/21,实际请在 **Node 22 LTS 或更新**上运行。engines 收紧排在 1.1.x。
186
- - 端口(均只监听 `127.0.0.1`):**3080** 引擎主界面 · **3081** 启动器(启动页 / 兜底页 / 救援页)· **3082** 备份救援 · **4081**(3081+1000)守护单实例锁;`DSH_LAUNCHER_PORT` / `DSH_ENGINE_PORT` 可覆盖
32
+ ```sh
33
+ # 推荐:显式版本号,不会被 24 小时冷静期挡住
34
+ dsh plugin --profile web add dsh-drydock@1.0.4
187
35
 
188
- ### 引擎兼容性矩阵
36
+ # 发版满 24 小时后,也可以用 latest
37
+ dsh plugin --profile web add dsh-drydock
189
38
 
190
- | 你的 DSH 引擎 | 本管理器版本 | 说明 |
191
- |---|---|---|
192
- | **≥ 0.1.7-rc.2**(含 0.2.x,`<0.3.0-0`) | **1.0.3**(推荐)/ 1.0.2 / 1.0.1 / 1.0.0 | 独立插件页 + 兜底页 + 救援工具链全套;1.0.x 实测于 0.2.x 引擎(三分区 / 统一口径 / 事务卸载,隔离环境 + 主环境双验证) |
193
- | 0.1.6 及以后 | **1.0.3** | 官方 0.1.6 起内置插件管理页,本包接管(停用 `ui-plugin-manager` + 自己的行 id) |
194
- | **0.1.7-rc.2 之前**(0.1.0-rc.6 ~ 0.1.5) | 不支持 | 1.0.x 的 engines 下界就是 `0.1.7-rc.2`;旧引擎请留在旧包名的历史版本(该包已挂弃用提示,包未删除) |
39
+ # 离线 tgz(GitHub Release 页下载,或 npm pack 自建)
40
+ dsh plugin --profile web add ./dsh-drydock-1.0.4.tgz
195
41
 
196
- > **一句话**:引擎 ≥ 0.1.7-rc.2 用 1.0.3。回退上一个正式版:`dsh plugin --profile web add dsh-drydock@1.0.2`。
42
+ # 回退上一个正式版(1.0.x 之间回退走同一包名)
43
+ dsh plugin --profile web add dsh-drydock@1.0.3
197
44
 
198
- ## 🔐 权限与数据范围
45
+ # 重启 web 生效(客户端 bundle 在引擎启动时加载)
46
+ dsh web
47
+ ```
199
48
 
200
- > 回答"它到底动了我什么"。所有读写都在**本机 profile 目录**与**你自己配置的更新源**范围内:没有账号、没有云端、没有遥测。写文件前都会先留 `.rescue-bak-*` 备份,写盘用「临时文件 + 改名」的原子写法。
49
+ 装好后两个入口:**3080 侧边栏「插件管理」**(接管引擎内置插件页)与 **3081 兜底页** `http://127.0.0.1:3081/plugins`。浏览器主页设为 `http://127.0.0.1:3081/` = 打开即自检 → 修复 → 启动 → 跳转主界面。
201
50
 
202
- | 数据 | 用途 | 是否外传 |
203
- |---|---|---|
204
- | `~/.dsh/profiles/<名字>/package.json` | 读已装插件清单;安装、卸载、场景等操作会写回,改前备份 | 否 |
205
- | `~/.dsh/profiles/<名字>/cordis.patch.yml` | 读/写插件启用状态与隔离行(只动带归属标记的部分,改前备份) | 否 |
206
- | `~/.dsh/profiles/<名字>/plugin-manager.json`(侧车) | 操作历史(20 条)、场景方案、来源人工修正、待清理列表、更新源配置 | 否 |
207
- | `~/.dsh/profiles/<名字>/node_modules/**` | 读依赖反向图与包简介;卸载/隔离时经 `pnpm` 删除 | 否(装卸时由 pnpm 访问 registry) |
208
- | `$DSH_HOME/downloads/*` | 「下载目录自动安装」扫描归档;只有带 provenance 记录(包名+版本+来源+摘要)的归档才会被自动安装;写 `.installed` / `.failed` 标记 | 否 |
209
- | 本机 npm 全局根 | **只读**:定位引擎自带的 `@deepseek-ai/*`、提取简介 | 否 |
210
- | 更新源(npm registry / GitHub / 你加的镜像) | 查询最新版本、下载归档 | **只查询**,不上传本地数据 |
211
- | 本机回环端口 3080 / 3081 / 3082 / 4081 | 主界面 / 启动器 / 备份救援 / 守护锁;全部只绑 `127.0.0.1` | 否(不出本机) |
212
- | Windows 注册表 `HKCU\...\Run\DSHWebFront` | **仅在显式执行 `--install-autostart` 时写入**;`--uninstall-autostart` 可清理 | 否 |
213
- | profile 内 `.rescue-daemon.pid`、`.open-boot.pid`、`health.log` 等 | 守护/启动器的 PID、日志与自检留痕(7 天 / 1000 行) | 否 |
51
+ - **不想装进 profile?** `npx dsh-drydock` 起 3081 启动器、`npx dsh-drydock-boot --repair-only` 命令行自检 + 修复、`npx dsh-drydock-rescue` 起 3082 备份救援——都无需安装。
52
+ - **装不到 / 装完还是旧版?** ① 客户端 bundle 只在引擎启动时加载,**必须重启 `dsh web`**;② 24 小时冷静期内务必写显式版本号(或把 `dsh-drydock@1.0.4` 加入 profile `pnpm-workspace.yaml` 的 `minimumReleaseAgeExclude`)。完整安装 / 更新 / 卸载 / 回退 / 离线 tgz / 开机自启见 [docs/INSTALL.md](docs/INSTALL.md)。
214
53
 
215
- > **不会碰的东西**:会话内容、`settings.yaml`、`.credentials.yaml`(API Key)——`lib/` 里没有读取它们的代码路径。
54
+ ## 升级自查(0.9.1 之前的老用户必看)
216
55
 
217
- ## 安装 / 更新 / 卸载
56
+ > ⛔ **0.9.1 之前的 `dsh-plugin-manager-pro`(含 `0.9.1-rc2`)已淘汰**:存在已知供应链风险,且 Node < 22.14 加载即崩。npm 上已挂**强化弃用提示**(不删包,历史版本仍可安装,但**不要用**)。
218
57
 
219
- > **推荐从 npm 安装**(`dsh plugin … add` 底层是 pnpm,会自动复用引擎自带的 `@deepseek-ai/*`;不要在 profile 目录里直接 `npm install`——npm 对引擎预发布 peer 的解析在不同版本下表现不一,可能 `ERESOLVE`)。
58
+ 一条命令升级到新包名:
220
59
 
221
60
  ```sh
222
- # 方式一(推荐):npm
223
- dsh plugin --profile web add dsh-drydock
61
+ dsh plugin --profile web remove dsh-plugin-manager-pro # 移除旧包(保留 profile 备份)
62
+ dsh plugin --profile web add dsh-drydock@^1.0.4 # 安装唯一推荐入口
63
+ dsh web # 重启生效
64
+ ```
224
65
 
225
- # 方式二:刚发版时(或在 24 小时冷静期内)——显式写版本号,最可靠
226
- dsh plugin --profile web add dsh-drydock@1.0.3
66
+ 新包名 `dsh-drydock` 是唯一推荐入口;1.0.x 之间回退用同一包名(如 `dsh-drydock@1.0.3`)。引擎要求 ≥ 0.1.7-rc.2,更老的引擎请留在历史版本。详见 [docs/INSTALL.md](docs/INSTALL.md) 与 [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md)。
227
67
 
228
- # 方式三:离线 tgz(GitHub Release 页下载,或 npm pack 自建)
229
- dsh plugin --profile web add ./dsh-drydock-1.0.3.tgz
68
+ ## 入口速查
230
69
 
231
- # 回退上一个正式版(1.0.x 之间回退都走同一个包名,不需要旧包)
232
- dsh plugin --profile web add dsh-drydock@1.0.2
70
+ | 入口 | 地址 | 用途 |
71
+ | --- | --- | --- |
72
+ | 管理台(3080) | `http://127.0.0.1:3080` → 侧边栏「插件管理」 | 日常入口:看 / 装 / 配 / 卸 / 救引擎,功能最全 |
73
+ | 兜底管理页(3081) | `http://127.0.0.1:3081/plugins` | 引擎不可用时仍可用:启停 / 更新 / 卸载 / 体检 / 重启引擎 |
74
+ | 启动页(3081) | `http://127.0.0.1:3081/` | 打开即自检 → 修复 → 启动(设为浏览器主页最省心) |
75
+ | 救援页(3081) | `http://127.0.0.1:3081/rescue` | verify / fix / start / stop / status 全套修复能力 |
76
+ | 救援球 🛟 | 3080 右下角浮动按钮 | 可拖动换位(位置记忆),设置页损坏时的入口 |
233
77
 
234
- # 重启 web 生效(客户端 bundle 在引擎启动时加载,装完必须重启)
235
- dsh web
236
- ```
78
+ > 引擎内也注册了一份 `/rescue`(`http://127.0.0.1:3080/rescue`),但它经宿主准入:**从应用内**(救援球 / 插件页)进入正常;在地址栏直开属无来源顶层导航,会被 403 拒绝。引擎起不来时请用 3081 的独立救援页。
237
79
 
238
- > **装不到 / 装完还是旧版?** ① 客户端 bundle 只在引擎**启动时**加载——装完必须重启 `dsh web`;
239
- > ② pnpm 11 起有 **24 小时冷静期**(`minimumReleaseAge` 默认 1440 分钟),当天刚发布的版本不带版本号会解析到旧版——用"方式二"的显式版本号即可(也可把 `dsh-drydock@1.0.3` 加入 profile 的 `pnpm-workspace.yaml` 的 `minimumReleaseAgeExclude`)。
80
+ ## 日常怎么用(3 分钟)
240
81
 
241
- 装好后两个入口:3080 侧边栏**「插件管理」**(内置插件页已接管);3081 `http://127.0.0.1:3081/plugins`(引擎不可用时仍可用)。浏览器主页设为 `http://127.0.0.1:3081/` = 打开即自检启动引擎。
82
+ 1. **启停插件**:3080 侧边栏「插件管理」→ 列表开关(核心组件锁定,不可禁用 / 卸载);改动写入 profile 的 `cordis.patch.yml`,**重启引擎生效**(界面会提示)。
83
+ 2. **更新**:维护页签「检查更新」→「更新」;或 `pnpm update dsh-drydock --latest --dir <profile>`。更新源按信任模型裁决(见特色 ③)。
84
+ 3. **卸载**:行内卸载 → 影响预览 + 体检结论 → 备份 → 执行 → 逐项验证,失败自动回滚;「操作与场景」页签可一键撤销。
85
+ 4. **救援**:见下方「出问题了先看这里」,全量命令与退出码见 [docs/RESCUE.md](docs/RESCUE.md)。
242
86
 
243
- ```sh
244
- # 更新:3081 兜底页「检查更新」→「更新」,或
245
- pnpm update dsh-drydock --latest --dir <profile>
87
+ ## 它管什么、不管什么
246
88
 
247
- # 卸载:3081 兜底页「卸载」(带备份、验证与失败回滚),或
248
- dsh plugin --profile web remove dsh-drydock # 卸载前自动清理自启/守护/shim
249
- npx dsh-drydock --uninstall-autostart # Windows:清理开机自启(幂等)
250
- npx dsh-drydock --uninstall # 需要时:彻底清理启动器痕迹(引擎 3080 与日志保留)
251
- ```
89
+ | 场景 | 谁来管 |
90
+ | --- | --- |
91
+ | 找插件、逛市场、一键装 | 官方插件页 / 插件市场(dshmarket 等)——本工具**不自建目录**,市场页签只是顺手入口 |
92
+ | 装坏了怎么办 | **本工具**:事务化卸载 + 一键撤销(最近 20 次操作) |
93
+ | 装多了怎么管 | **本工具**:来源三分区 + 场景方案 + 操作历史 |
94
+ | 引擎起不来怎么办 | **本工具**:3081 / 3082 独立救援,不依赖引擎进程 |
95
+ | 备份恢复 / WebDAV / 主题切换 / 静态安全扫描 | 不做——这些 dshmarket 已成熟,请直接用对应工具 |
252
96
 
253
- ## 救援流程速查
97
+ ## 出问题了先看这里
254
98
 
255
99
  | 症状 | 入口 |
256
100
  | --- | --- |
257
- | 引擎在跑,但 3080 界面/插件页异常 | 3080 右下角 🛟 救援球,或 `http://127.0.0.1:3080/rescue` |
258
- | 引擎起不来、3080 打不开 | `http://127.0.0.1:3081/`:自检 → 修复 → 启动 → 跳转带 token 的入口 URL |
259
- | 插件被禁用到界面起不来 | `http://127.0.0.1:3081/plugins` 直接 toggle(该页不依赖引擎) |
260
- | 某个插件把引擎打挂 | 3081 `/plugins` → mod 体检看 verdict → 禁用观察或卸载(带备份与验证) |
261
- | 卸载/更新被引擎占用 | 拒绝硬删并引导:先禁用 → 重启引擎 → 再操作 |
262
- | 需要独立于 3081 的备份救援入口 | `npx dsh-drydock-rescue`(默认 3082,不抢端口) |
263
- | 想知道 3080/3081/3082/4081 到底什么状态 | `npx dsh-drydock --status`(并追加一条 `health.log` 留痕) |
264
- | 命令行一键自检+启动 | `npx dsh-drydock-boot`(启动)或 `npx dsh-drydock-boot --repair-only`(只自检+修复) |
265
- | 彻底移除启动器 | `npx dsh-drydock --uninstall`(退出码 2 = 归属未确认:不动任何进程) |
101
+ | 引擎在跑,但 3080 界面 / 插件页异常 | 3080 右下角 🛟 救援球,或从插件页进入 3080 `/rescue` |
102
+ | 引擎起不来、3080 打不开 | `http://127.0.0.1:3081/`:自检 → 修复 → 启动 → 跳转 |
103
+ | 插件被禁用到界面起不来 | `http://127.0.0.1:3081/plugins` 直接 toggle(不依赖引擎) |
104
+ | 某个插件把引擎打挂 | 3081 `/plugins` → 体检 verdict → 禁用观察或卸载 |
105
+ | 卸载 / 更新被引擎占用 | 拒绝硬删,引导「先禁用 → 重启引擎 → 再操作」 |
106
+ | 想知道 3080/3081/3082/4081 状态 | `npx dsh-drydock --status`(并追加一条 `health.log`) |
107
+ | 彻底移除启动器痕迹 | `npx dsh-drydock --uninstall`(退出码 2 = 归属未确认:不动任何进程) |
266
108
 
267
- > **已知限制**:入口 token URL 只有在引擎 stdout 落到 `<DSH_HOME>/logs/web.log` 时才取得到(启动器经 `enginectl` 拉起时正常落盘)。若引擎由其他路径拉起(如 `dsh-boot` 的弹窗路径),3081 可能给不出可直接跳转的链接——到 `/rescue` 执行一次「重启引擎」即可恢复。
109
+ ## 环境与端口(装前核对一眼)
268
110
 
269
- ## API 参考(3081)
111
+ - **平台**:Windows 10/11 · macOS · Linux(救援工具链与三个 bin 全平台;开机自启管理目前为 Windows)
112
+ - **Node**:`engines.node` 为 `>=18.0.0`(本版未收紧),但 Node 18 已 EOL、pnpm 11 也不再支持 18/20/21,**实际请在 Node 22 LTS 或更新上运行**
113
+ - **引擎**:DeepSeek Harness `dsh` ≥ `0.1.7-rc.2`(`<0.3.0-0`),并需要 `pnpm`(`dsh plugin` 与更新依赖)
114
+ - **端口**(均只监听 `127.0.0.1`):**3080** 引擎主界面 · **3081** 启动器(启动页 / 兜底页 / 救援页)· **3082** 备份救援 · **4081**(3081+1000)守护单实例锁
270
115
 
271
- | 方法 | 路径 | 说明 |
272
- | --- | --- | --- |
273
- | GET | `/api/status` | 启动器 + 引擎状态 |
274
- | POST | `/api/boot` | 自检启动(单飞闸门) |
275
- | POST | `/api/launcher/stop` | 优雅停止本启动器(pid 归属校验) |
276
- | GET/POST | `/plugins/api/bundles` | 列出 / 启停 bundle(写前备份) |
277
- | GET | `/plugins/api/updates` | `pnpm outdated` 投影用户插件 |
278
- | POST | `/plugins/api/update` | 更新单个用户插件(EBUSY 引导) |
279
- | POST | `/plugins/api/uninstall` | 事务性卸载(steps 日志;超时/进程不明时标记「未知」不回滚) |
280
- | GET | `/plugins/api/health` | mod 体检(只读) |
281
- | POST | `/plugins/api/engine/restart` | 重启引擎(失败条目自动隔离一次) |
282
- | GET/POST | `/rescue/api/*` | 救援中心 verify / fix / start / stop / status |
283
-
284
- 写接口(POST)需要同源 Origin + `X-DSH-PM-Token`(页面 meta 自动携带,不落盘、不写日志)。
285
-
286
- ## 工作原理
287
-
288
- - **宿主端**(`lib/index.js`):读取 Cordis Loader 实时状态(启用/运行期阶段/错误),经 Typert 网关暴露远程方法(list/setEnabled/update/verifyProfile/fixProfile/marketCatalog/…)。收敛判定基于引擎真实字段,**不收敛时如实提示需要重启,不谎报**
289
- - **来源三分区判定**(v1.0):核心组件 = 包名白名单;内置/用户 = 引擎 origin 字段(origin=builtin / origin=user),与引擎实际状态一一对应
290
- - **运行期错误**:从 cordis 的 `fiber._error` 取真实错误文本(诊断与救援页能看到失败原因)
291
- - **插件页接管**(`src/client.jsx` + `cordis.patch.yml`):客户端注册进 `main`(key=`plugins`)与 `sidebar.panellist`(id=`plugins`),patch 停用内置 `ui-plugin-manager`;用自己的行 id `drydock` 不与官方同名;注册内置页原有的 `plugins.*` 子槽位,第三方配置卡片有真实渲染出口
292
- - **开关持久化**:写入 profile 的 `cordis.patch.yml`(带归属注释行,不触碰用户自有补丁)
293
- - **更新源聚合**(`lib/aggregate.js` + `compare-versions.js`):信任层按源 `authoritative` 判定(不是按源类型)→ 权威源之间取最高(并列随机)→ 没有权威版本才降级兜底并标 `degraded`;源级熔断;预发布只出现在 `@deepseek-ai/*` 的 `next` 轨道
294
- - **下载器**(`lib/downloader.js`):HTTP 直链流式;magnet/.torrent 优先外部下载器 → 内置 webtorrent → 提示手动导入;下载目录自动安装靠侧车 `pendingDownloads` 记录做 provenance 比对
295
- - **跨平台**(`lib/platform.js`):npm 全局根按平台定位(10 分钟缓存)
296
- - **独立救援**(`lib/preflight.mjs` + `lib/enginectl.mjs`):纯 Node 自检/修复 + 引擎生命周期,被三个 bin 工具复用;与 host 方法同源逻辑
297
- - **本地写接口防护**:`Origin` + 一次性令牌 + 单飞三道闸,第三方网页无法触发启动/停止
298
- - **详细架构**:[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md);命令行口径:[docs/LAUNCHER.md](docs/LAUNCHER.md)
299
-
300
- ## 测试 / 构建
301
-
302
- ```bash
303
- npm install # 如遇 npm 拦截 esbuild 安装脚本:npm approve-scripts esbuild
304
- npm ci # 依赖树必须来自 lockfile(见 docs/RELEASING.md §2bis)
305
- node build.mjs # src/client.jsx -> lib/client.js(可复现:连跑两次哈希相同)
306
- node test-bundle.mjs # 构建产物契约(含 origin 来源契约,11 项)
307
- node test-render.mjs # jsdom 真渲染回归(分区模型 / 徽章 / 推荐标签等 19 项)
308
- node test-integration.mjs # host 逻辑进程内集成(需 devDependency @deepseek-ai/dsh-home-paths)
309
- node test-transactional.mjs # 事务性卸载回归
310
- node test-launcher.mjs # 启动器全量回归(354 项;--strict 把已知写域外缺陷算失败)
311
- node tools/smoke-plugins-api.mjs # 独立端口 + 临时 DSH_HOME 的 /plugins API 冒烟(28 项)
312
- npm run check:vendor # 迁移件内容级校验(tgz 内文件 sha256 == 工作树)
313
- node tools/dev/gen-changelog.mjs # 从 docs/releases/*.md 生成 CHANGELOG.md(--check 校验一致)
314
- node test-docs.mjs # 文档/版本号口径断言(离线、零依赖:README 版本号 == package.json、发布说明与 CHANGELOG 含 1.0.3)
315
- npm run pack # build + npm pack(产出安装用 tarball)
316
- ```
317
-
318
- > `test-launcher.mjs` 会重写 `<DSH_HOME>/scripts/dsh-launcher.cmd`;不想动真实 `~/.dsh` 时先设 `DSH_HOME=<临时目录>`。
116
+ 详见 [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md)。
319
117
 
320
- 文档:发布流程 [`docs/RELEASING.md`](docs/RELEASING.md);架构 [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md);命令行 [`docs/LAUNCHER.md`](docs/LAUNCHER.md);版本历史 [`CHANGELOG.md`](CHANGELOG.md)(脚本生成)与 [`docs/releases/`](docs/releases/);0.9.1 时代的完整文档(能力对比、兼容性矩阵全文)存档于 [`docs/README-full.md`](docs/README-full.md)。
118
+ ## 文档索引
321
119
 
322
- ## 常见问题(排错)
323
-
324
- | 现象 | 原因与解决 |
325
- |---|---|
326
- | 装完界面还是旧的 / 新页面不出现 | 客户端 bundle 在引擎启动时加载:**必须重启 `dsh web`**(或让启动器重新拉起引擎) |
327
- | 启停插件后列表状态没变 | 引擎在启动时套用条目:配置已写入,**重启引擎后生效**(界面会在需要重启时提示) |
328
- | `dsh plugin add` 报 "Already up to date" 不更新 | pnpm 按版本号缓存 tarball;**修改后必须升版本号**再 add |
329
- | 引擎起不来(坏 bundle 进 package.json) | 开 `http://127.0.0.1:3081/rescue` → 运行检查 → 修复 → 启动;或 `npx dsh-drydock-boot --repair-only` |
330
- | 想禁用管理器自己 | 3080 界面内不可自禁:去 `http://127.0.0.1:3081/plugins`(独立于引擎存活)或用 `dsh plugin remove`;3080 内允许的是**卸载**(额外警告路径,自动清理自启) |
331
- | 列表分区和我认知的不一样 | v1.0 起按来源三分区(核心组件 / 引擎内置组件 / 用户插件);「推荐」只是行内标签,不再是分区 |
332
- | 担心第三方网页能触发启动/停止 | 不会:写接口要**同源 `Origin` + 一次性令牌**,并发受单飞闸门限制(403 / 401 / 409)——见 [docs/LAUNCHER.md](docs/LAUNCHER.md) §4 |
333
- | 浏览器报 `waiting for service: remote.xxx` | 客户端 inject 不能包含自身挂载的 remote(死锁);inject 只保留 `["slots","locale","remote"]` |
334
- | 第三方插件没有 ⚙ 配置入口 | 它尚未注册 `plugins.row.config` 槽位——请向插件作者反馈 |
335
- | P2P 磁力链接无法下载 | 安装 aria2c(自动启用)或装 webtorrent,或用 NDM/比特彗星手动导入 |
120
+ | 文档 | 内容 |
121
+ | --- | --- |
122
+ | [docs/INSTALL.md](docs/INSTALL.md) | 安装 / 更新 / 卸载 / 回退 / 离线 tgz / 24h 冷静期 / 开机自启 / 端口 / 从旧包升级 |
123
+ | [docs/USAGE.md](docs/USAGE.md) | 载体、管理台分区模型与页签、事务化卸载、操作历史、场景方案、更新与下载、插件市场、兜底页 |
124
+ | [docs/SECURITY.md](docs/SECURITY.md) | 权限与数据范围、更新源信任模型、下载 provenance、写接口防护、救援路由准入、威胁模型 |
125
+ | [docs/RESCUE.md](docs/RESCUE.md) | 独立救援工具链、救援流程速查、3081 API 参考、工作原理、3082 说明 |
126
+ | [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md) | 环境要求、引擎兼容矩阵、Node 版本、平台与端口 |
127
+ | [docs/FAQ.md](docs/FAQ.md) | 常见问题与排错(含旧包升级问题) |
128
+ | [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | 三进程架构、槽位契约、侧车字段、卸载事务数据流 |
129
+ | [docs/LAUNCHER.md](docs/LAUNCHER.md) | 三个 bin 的全部命令与退出码、`--uninstall` 闭环、写接口防护 |
130
+ | [docs/RELEASING.md](docs/RELEASING.md) | 发布流程 |
131
+ | [CHANGELOG.md](CHANGELOG.md) | 版本历史(脚本生成) |
132
+ | [docs/releases/](docs/releases/) | 每版发布说明(本页对应 [1.0.4](docs/releases/1.0.4.md)) |
133
+ | [docs/README-full.md](docs/README-full.md) | 0.9.1 时代完整存档(能力对比 / 兼容矩阵全文),**非当前手册** |
336
134
 
337
135
  ## 许可证
338
136
 
339
137
  MIT。补丁持久化机制借鉴 [hrhgit/deepseek-harness-plugin-manager](https://github.com/hrhgit/deepseek-harness-plugin-manager)(MIT)。
340
138
 
341
- ---
342
-
343
- ## English
344
-
345
- An English README lives at [README.en.md](README.en.md). Quick version:
346
-
347
- A local plugin manager for DeepSeek Harness. It takes over the engine's built-in plugin page as a **standalone page** (sidebar entry "Plugin manager"): since **1.0.0** the list is grouped **by origin** — **Core components (locked) · Engine built-ins · User plugins** — with "Recommended" demoted to an inline row tag. Sections: Official built-ins (optional) · All plugins · Market · Operations & scenarios · Maintenance. It also ships a **standalone rescue toolchain**: `open-boot` (the single web entry on **3081**: boot page `/` + fallback manager page `/plugins` + rescue page `/rescue`), `rescue-daemon` (independent backup rescue service on **3082**), and `dsh-boot` (Steam-style boot sequence with exit codes). Transactional uninstall with impact preview, pre-uninstall health check, operation history (undo) and named scenarios included. Cross-platform, zero new runtime dependencies. **Update-source trust model (1.0.3)**: npm official / GitHub official repo / npmmirror by default, the registry is authoritative, custom sources are fallback-only unless explicitly marked `authoritative`, plain `http://` sources are allowed but labelled "plaintext · fallback only", only `@deepseek-ai/*` uses the `next` track, and auto-install from the downloads folder now requires a provenance record.
348
-
349
- Install: `dsh plugin --profile web add dsh-drydock` (pin `@1.0.3` if the release is less than 24 h old — pnpm's `minimumReleaseAge` default blocks brand-new versions) → restart `dsh web` → open the sidebar "Plugin manager". Details: [README.en.md](README.en.md).
139
+ English: [README.en.md](README.en.md)(精简入口;英文详解文档暂未拆分,细节以中文 `docs/` 为准)。
@@ -11,6 +11,12 @@
11
11
  * POST /api/stop → 按 PID 结束引擎(多重校验;拒绝时可用 {"force":true} 强制)
12
12
  * GET /api/status → { app, engineUp, port, pid, ... }(app 字段供身份校验)
13
13
  *
14
+ * v1.0.4(攻击测试残留收口):
15
+ * - 请求入口加 Host 白名单(`127.0.0.1:<port>` / `localhost:<port>` / `[::1]:<port>`,
16
+ * 大小写不敏感、必须带端口;不匹配 → 421 JSON),放在路由之前(防 DNS rebinding)。
17
+ * - 所有响应(页面 / API / 421 / 写接口 401/403)统一附加安全头(CSP / XFO / nosniff / Referrer)。
18
+ * - 既有 Origin + 一次性令牌写接口判定保持不变。
19
+ *
14
20
  * v0.9.1(审计③ R7 端口分工 + L11 写接口防护):
15
21
  * - **默认端口 3081 → 3082**:3081 由 `bin/open-boot.mjs` 独家占用(唯一网页入口,且它已内建
16
22
  * 完整救援能力:`/rescue` 页面 + `/rescue/api/*`)。本守护退化为**独立备份入口**,
@@ -47,6 +53,37 @@ import {
47
53
  const SELF = fileURLToPath(import.meta.url);
48
54
  const PROFILE_DEFAULT = join(homedir(), ".dsh", "profiles", "web");
49
55
  const SERVER_LOG = "rescue-daemon-server.log";
56
+ /**
57
+ * 救援入口统一安全响应头(1.0.4 安全残留收口)。
58
+ *
59
+ * **必须与 lib/index.js 的 RESCUE_SECURITY_HEADERS 保持一致**:3082 是独立进程,
60
+ * 不导入插件模块(也不应依赖 @deepseek-ai/* 运行时依赖),因此在这里定义一份副本。
61
+ * - CSP:救援页脚本/样式都是内联的 → 保留 unsafe-inline;`connect-src 'self'` 放行
62
+ * 页面 fetch 同源 `/api/*`;`frame-ancestors 'none'` / `base-uri 'none'` 防嵌套/base 劫持。
63
+ * - XFO / nosniff / Referrer-Policy 同引擎侧救援路由。
64
+ * 所有响应(页面 200、API、Host 校验失败 421、写接口 401/403)都带这一套头。
65
+ */
66
+ const RESCUE_SECURITY_HEADERS = Object.freeze({
67
+ "content-security-policy": "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'",
68
+ "x-frame-options": "DENY",
69
+ "x-content-type-options": "nosniff",
70
+ "referrer-policy": "no-referrer"
71
+ });
72
+ /** 把安全头预设到响应上;Node 会在后续 writeHead 时合并(writeHead 同名头优先)。 */
73
+ function applySecurityHeaders(res) {
74
+ for (const [name, value] of Object.entries(RESCUE_SECURITY_HEADERS)) res.setHeader(name, value);
75
+ }
76
+ /**
77
+ * Host 白名单:只接受回环地址 + **本守护端口**,大小写不敏感、必须带端口。
78
+ * 覆盖 `127.0.0.1:<port>` / `localhost:<port>` / `[::1]:<port>`;
79
+ * 其余(含无端口、外部域名、DNS rebinding 形式)一律 421。
80
+ */
81
+ function isAllowedHost(hostHeader, port) {
82
+ if (typeof hostHeader !== "string") return false;
83
+ const value = hostHeader.trim().toLowerCase();
84
+ const expected = String(port);
85
+ return value === `127.0.0.1:${expected}` || value === `localhost:${expected}` || value === `[::1]:${expected}`;
86
+ }
50
87
  /**
51
88
  * v0.9.1:3081 归 open-boot(唯一网页入口),本守护退到 3082。
52
89
  * 端口可用 `DSH_RESCUE_PORT` 覆盖(默认 3082);`--port` 优先。
@@ -386,7 +423,14 @@ function main() {
386
423
  process.on("exit", (code) => serverLog(`进程退出:code ${code}(pid ${process.pid},cwd ${process.cwd()})`));
387
424
 
388
425
  const server = createServer(async (req, res) => {
426
+ // 1.0.4:先预设安全头(页面/API/421/401/403 全部生效),再做 Host 校验,最后才路由。
427
+ applySecurityHeaders(res);
389
428
  const url = new URL(req.url, "http://127.0.0.1");
429
+ if (!isAllowedHost(req.headers.host, args.port)) {
430
+ res.writeHead(421, { "Content-Type": "application/json; charset=utf-8" });
431
+ res.end(JSON.stringify({ ok: false, code: 421, error: "Host 不被允许(仅接受回环地址)" }));
432
+ return;
433
+ }
390
434
  const pathname = url.pathname;
391
435
  if (pathname === "/" || pathname === "/rescue") {
392
436
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store" });
package/lib/index.js CHANGED
@@ -1782,6 +1782,29 @@ const DEFAULT_PROTECTED_IDS = new Set([
1782
1782
  "drydock"
1783
1783
  ]);
1784
1784
 
1785
+ /**
1786
+ * 救援路由统一安全响应头(1.0.4 攻击测试残留收口)。
1787
+ *
1788
+ * 适用范围:/rescue 200、/rescue 401/403、/plugins-launcher 200。
1789
+ * - CSP:`default-src 'none'` 全禁;救援页脚本/样式都是内联的,所以保留
1790
+ * `script-src 'unsafe-inline'` / `style-src 'unsafe-inline'`;图片只允许 self/data;
1791
+ * `connect-src 'self'` 放行同源 RPC(页面用 fetch 调同源救援 API);
1792
+ * `frame-ancestors 'none'` / `base-uri 'none'` 防嵌套与 base 劫持。
1793
+ * - X-Frame-Options: DENY(老浏览器兼容 CSP frame-ancestors)。
1794
+ * - X-Content-Type-Options: nosniff(禁止 MIME 嗅探)。
1795
+ * - Referrer-Policy: no-referrer(页面 URL 不外泄给第三方)。
1796
+ *
1797
+ * 注意:bin/rescue-daemon.mjs 里定义了一份**相同的副本**(3082 独立入口不经本插件导入;
1798
+ * 该入口被 open-boot 复用时也不应依赖插件模块),两处必须保持一致,
1799
+ * test-daemon-security.mjs 会校验 3082 侧。
1800
+ */
1801
+ export const RESCUE_SECURITY_HEADERS = Object.freeze({
1802
+ "content-security-policy": "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'",
1803
+ "x-frame-options": "DENY",
1804
+ "x-content-type-options": "nosniff",
1805
+ "referrer-policy": "no-referrer"
1806
+ });
1807
+
1785
1808
  /** 本地插件管理器宿主服务。 */
1786
1809
  let PluginManagerPro = (() => {
1787
1810
  let _classSuper = TypertRemoteService;
@@ -3118,6 +3141,13 @@ setTimeout(() => {
3118
3141
  getRescueConfig() {
3119
3142
  return { autoQuarantine: this.rescueConfig?.autoQuarantine === true };
3120
3143
  }
3144
+ //#region 救援路由安全响应头(1.0.4)
3145
+ /* 常量本身在模块顶层(RESCUE_SECURITY_HEADERS),这里只做使用说明:
3146
+ * /rescue 200、/rescue 401/403、/plugins-launcher 200 统一附加。
3147
+ * 注意:bin/rescue-daemon.mjs 里同样定义了一份(3082 独立入口不经本插件导入),
3148
+ * 两处必须保持一致;test-daemon-security.mjs 会校验 3082 侧。 */
3149
+ //#endregion
3150
+
3121
3151
  /**
3122
3152
  * 宿主准入:把 DSH Connection 的 Host/Origin 校验与浏览器认证应用到本插件的
3123
3153
  * Web 路由(/rescue、/plugins-launcher)。这两条路由经 webServer.register 直接
@@ -3154,6 +3184,7 @@ setTimeout(() => {
3154
3184
  /** 拒绝一次请求:401 未认证 / 403 来源被拒(中文优先,救援场景更好读)。 */
3155
3185
  rejectForAdmission(res, status) {
3156
3186
  res.writeHead(status, {
3187
+ ...RESCUE_SECURITY_HEADERS,
3157
3188
  "content-type": "text/plain; charset=utf-8",
3158
3189
  "cache-control": "no-store"
3159
3190
  });
@@ -3174,6 +3205,7 @@ setTimeout(() => {
3174
3205
  return;
3175
3206
  }
3176
3207
  res.writeHead(200, {
3208
+ ...RESCUE_SECURITY_HEADERS,
3177
3209
  "content-type": "text/html; charset=utf-8",
3178
3210
  "cache-control": "no-store"
3179
3211
  });
@@ -3204,6 +3236,7 @@ setTimeout(() => {
3204
3236
  return;
3205
3237
  }
3206
3238
  res.writeHead(200, {
3239
+ ...RESCUE_SECURITY_HEADERS,
3207
3240
  "content-type": "application/json; charset=utf-8",
3208
3241
  "cache-control": "no-store"
3209
3242
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-drydock",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "DSH 引擎船坞(drydock,原名 dsh-plugin-manager-pro):本地插件管理器——分类折叠(核心组件/引擎内置组件/用户插件)、更新源一键更新(npm/GitHub/自定义镜像)、浏览器下载优先、下载目录自动安装、插件市场(ADP 精选目录)、README 简介提取、救援与启动前自检;事务化卸载(备份→删除→校验→回滚)、操作历史一键撤销、场景方案、来源人工修正、依赖关系感知;独立救援工具链(3082 rescue-daemon / open-boot 浏览器触发自启 / dsh-boot 启动序列);跨平台(Windows/macOS/Linux)",
5
5
  "author": "nonentity303",
6
6
  "repository": {
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "scripts": {
66
66
  "build": "node build.mjs",
67
- "test": "node build.mjs && node test-bundle.mjs && node test-admission.mjs && node test-render.mjs && node test-integration.mjs && node test-launcher.mjs && node test-ux.mjs && node test-downloader.mjs && node test-security-provenance.mjs && node test-docs.mjs",
67
+ "test": "node build.mjs && node test-bundle.mjs && node test-admission.mjs && node test-daemon-security.mjs && node test-render.mjs && node test-integration.mjs && node test-launcher.mjs && node test-ux.mjs && node test-downloader.mjs && node test-security-provenance.mjs && node test-docs.mjs",
68
68
  "test:admission": "node test-admission.mjs",
69
69
  "test:launcher": "node test-launcher.mjs",
70
70
  "test:strict": "node test-launcher.mjs --strict",
@@ -79,7 +79,8 @@
79
79
  "publish:webauth": "node tools/dev/publish-webauth.mjs",
80
80
  "publish:all": "node tools/dev/publish-all.mjs",
81
81
  "publish:status": "node tools/dev/publish-all.mjs --status",
82
- "verify:triple": "node tools/dev/verify-triple.mjs"
82
+ "verify:triple": "node tools/dev/verify-triple.mjs",
83
+ "test:daemon": "node test-daemon-security.mjs"
83
84
  },
84
85
  "dependencies": {
85
86
  "yaml": "^2.9.0",