dsh-plugin-wsl-env 0.26.0 → 0.26.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/CHANGELOG.md CHANGED
@@ -16,6 +16,64 @@ were part of the record.
16
16
 
17
17
  ## [Unreleased]
18
18
 
19
+ ## [0.26.1] - 2026-11-16
20
+
21
+ One theme: the peer self-check now answers for the set the running plugin
22
+ actually loads, so a stale tree beside the runtime mirror can no longer fail
23
+ it; the README/docs pass that leads with the desktop-app path ships too.
24
+
25
+ ### Fixed
26
+
27
+ - **The `peers.versions` self-check no longer reports a stale `node_modules`
28
+ above the runtime mirror.** A linked plugin's declared peers are resolved by
29
+ the host's profile projection onto the installation's single copies, but the
30
+ doctor is a separate process: its native lookup walked past the mirror into
31
+ whatever `node_modules` sat above it — after a harness upgrade, the previous
32
+ installation's tree — and failed the check against versions the plugin never
33
+ loads. The in-app spawners now hand the versions this process resolved to the
34
+ doctor in `DSH_WSL_DOCTOR_PEERS`; a present map is authoritative even when it
35
+ is partial or empty, so a peer the host could not resolve is unchecked rather
36
+ than backfilled from the plugin's tree. The standalone CLI, which has no
37
+ projection, counts only a copy at the plugin's own peer position and reports
38
+ peers it cannot see as unchecked instead of failed.
39
+ Pinned by `test/doctor.test.mjs` (host-map preference, malformed-map fallback,
40
+ the peer-position walk, and the collector's hand-off).
41
+ `docs/DIAGNOSTICS.md`, `docs/ARCHITECTURE.md` and `docs/PEER-PARITY.md` record
42
+ the two answers and why they differ.
43
+
44
+ ### Documentation
45
+
46
+ - **The user-facing docs demonstrate only the desktop app's path.** The
47
+ Windows desktop app ships no `dsh` executable, so the install, verify,
48
+ upgrade, uninstall and troubleshooting steps no longer present the
49
+ `dsh ...` forms of the npm CLI distribution as an alternative — the
50
+ Plugins page, the profile's `package.json` and `cordis.patch.yml`, and the
51
+ doctor surfaces are the only demonstrated way. The CLI keeps one home: the
52
+ README's "Do I need this plugin?" decision table, where it is the
53
+ alternative to this plugin, not a way to use it. MIGRATION's local
54
+ verification block, the ROADMAP-1.0 P1.3 gate, the first-use record
55
+ template, the probe profile headers (the `dsh wslfs ...` lines become the
56
+ real `ELECTRON_RUN_AS_NODE` launch documented in the header of
57
+ `test/probe/run.sh`) and the update-check service comment carry the same
58
+ reality; the CHANGELOG's older entries are history and stay as written.
59
+
60
+ - **The README pair is now a one-page pitch: a one-line definition that
61
+ names DSH's two delivery forms and the one combination the plugin serves,
62
+ a bilingual without/with diagram pair, a three-step install, and short
63
+ sections that link the owning document for every detail.** The diagrams
64
+ carry the core pain and label the two workspace modes — a Windows
65
+ workspace gets CMD/PowerShell, a WSL workspace only reaches POSIX through
66
+ stateless `wsl.exe` wrappers — and the first "Why this plugin" bullet
67
+ states it. The contrast table, the doctor walkthrough, the configure
68
+ table and the architecture/sandbox detail moved out of the README; the
69
+ CLI install commands moved to QUICKSTART §0, the upgrade/uninstall and
70
+ no-host-patch notes to QUICKSTART §2, the "Why Linux, not PowerShell"
71
+ essay into VALUE's six-sources section, and VALUE also gained a
72
+ Remote-SSH comparison for the Windows host (reach, sshd setup, in-distro
73
+ footprint, sandbox). Anchored headings keep their names, the decision
74
+ table stays, and the sandbox section keeps the `partial` wording. The
75
+ diagram SVGs ship in the tarball. `pnpm test`: 119 pass.
76
+
19
77
  ## [0.26.0] - 2026-11-12
20
78
 
21
79
  One theme: adapted to DeepSeek Harness `0.2.2-rc.2` without patching the host —
package/README.md CHANGED
@@ -6,62 +6,67 @@
6
6
  [![npm](https://img.shields.io/npm/v/dsh-plugin-wsl-env)](https://www.npmjs.com/package/dsh-plugin-wsl-env)
7
7
  [![license](https://img.shields.io/npm/l/dsh-plugin-wsl-env)](LICENSE)
8
8
 
9
- A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) plugin that opens the project workspace inside a WSL 2 distribution on Windows.
9
+ Turns a WSL 2 distro into the execution environment of a [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) desktop session: commands, files and the terminal all run inside the distro, while the harness stays on Windows. DeepSeek Harness ships in two forms — an npm CLI with a web UI, and a desktop app for macOS and Windows; this plugin serves one combination only, the desktop app on Windows with the project in a WSL 2 distro. No service installed in the distro, no port opened; confined commands run under the `bubblewrap` sandbox.
10
10
 
11
- The harness process stays on Windows. Command execution, shell scripts and file access all run in the distro's Linux environment for the full Linux shell toolchain. No helper service or daemon is installed, no port is opened, and confined commands run under `bubblewrap`.
11
+ ![Without the plugin: the desktop app runs entirely on Windows — commands land in CMD/PowerShell, files reach the distro over a 9p share](docs/screenshots/without-plugin.svg)
12
12
 
13
- Windows + WSL 2 only.
13
+ ![With the plugin: the GUI and model calls stay on Windows, commands and files run in the distro, joined by one stdio pipe](docs/screenshots/with-plugin.svg)
14
14
 
15
- **New here?** Start with [docs/QUICKSTART.md](docs/QUICKSTART.md) — prerequisites, recipes and the compatibility table.
15
+ **New here?** Start with [docs/QUICKSTART.md](docs/QUICKSTART.md).
16
16
 
17
- ## Do I need this plugin?
17
+ ## Why this plugin
18
18
 
19
- If the harness itself can run in the distro, it is simpler **not** to use this
20
- plugin: install the CLI there and run it from the distro's shell. No UNC paths,
21
- no 9p round trips, no Windows-to-distro agent.
19
+ "When the agent keeps failing on a WSL project, make the desktop app work directly in the distro's environment — no moving, no service, no giving up the sandbox."
22
20
 
23
- ```bash
24
- # inside the distro; the CLI needs Node >= 24.9
25
- npm install -g @deepseek-ai/dsh
26
- dsh web # browser UI, reached through WSL's localhost forwarding
27
- dsh headless "run the tests" # one task, one answer, exit
28
- ```
21
+ - The model's strength is POSIX, its weakness CMD/PowerShell: a Windows workspace gets only the weakness, and a WSL workspace gets `wsl.exe` wrapping that loses environment and state. This plugin runs the scripts unchanged in a persistent distro session.
22
+ - Commands run in the distro's login shell: `PATH`, `nvm`, `cargo`, `pyenv` and rc files all apply.
23
+ - No service in the distro, no port; the only persisted artifact is the agent cache under `~/.cache/dsh-wsl/agent/`.
24
+ - Confined commands run under `bubblewrap` by default; without bwrap the command fails, never runs unconfined.
25
+ - The environment is per session: a distro folder runs in the distro, a Windows folder stays Windows — both in one process.
26
+ - GUI integrated: the folder picker lists distros, the terminal opens in the distro, the model sees listening ports.
29
27
 
30
- Use this plugin when the harness has to stay on Windows:
28
+ The full argument (why Linux rather than PowerShell, value and costs) is in [docs/VALUE.md](docs/VALUE.md).
31
29
 
32
- | Your setup | What to use |
33
- |---|---|
34
- | Work happens inside WSL; a terminal or browser UI is enough | the CLI installed in the distro |
35
- | You want the Windows desktop app, with commands and files in the distro | this plugin |
36
- | One session must reach Windows and WSL folders at once | this plugin — per-path routing is the point |
30
+ ## Install
37
31
 
38
- Mixing the two has one trap: the `desktop` profile name is owned by the Electron
39
- app, and the npm CLI refuses to manage that profile's plugins — use the app's
40
- Plugins page for it. [docs/VALUE.md](docs/VALUE.md) has the full
41
- comparison and the cases this plugin is not for.
32
+ The desktop app has no `dsh` executable; the plugin installs through the in-app Plugins page. Three steps:
42
33
 
43
- ## Why this plugin
34
+ 1. `wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap`
35
+ 2. Plugins page: **Add plugin** → `dsh-plugin-wsl-env`, enable it.
36
+ 3. Restart the app, open a folder inside the distro; type `/wsl-doctor` (host-side) for a `ready`/`blocked` verdict.
44
37
 
45
- A Windows coding tool that works on WSL projects has three options: run the whole tool inside the distro, connect to a helper server inside the distro, or let the plugin provide the distro environment. This plugin is the third option. One workflow covers both kinds of session, with the distro's real tools and the command sandbox intact.
38
+ Remaining prerequisites (no Node.js needed inside the distro):
46
39
 
47
- - **Real Linux environment.** Commands run in the distro's own login shell. Its `PATH`, `nvm`, `cargo`, `pyenv` and rc files apply. File tools access distro paths through an in-distro agent; the backing filesystem depends on the path.
48
- - **No service in the distro.** There is no helper server, no daemon and no listening port. The only persisted artifact is a content-addressed copy of the native agent in `~/.cache/dsh-wsl/agent/`.
49
- - **Sandboxed by default.** Confined commands run under `bubblewrap` inside the distro. If `bubblewrap` is missing, the command fails; it does not run unconfined.
50
- - **Per-session.** A session opened on a distro folder gets the distro environment. A session opened on a Windows folder keeps the normal Windows tools. Both can run in one harness process.
51
- - **Integrated with the GUI.** The folder picker lists installed distros, the terminal opens a shell in the distro, and the model can see listening ports. The sidebar's **WSL environment** panel runs a quick doctor check per distro — host-side, no model turn — and the session-start preflight logs the environment verdict on every session, adding a blocked verdict to the session's context.
40
+ | Prerequisite | Notes |
41
+ |---|---|
42
+ | Windows 10/11 + WSL 2 + ≥1 distro | `wsl.exe -l -v` shows `VERSION 2`; otherwise `wsl.exe --install` |
43
+ | systemd + Linger (default session sandbox) | `[boot] systemd=true` in `/etc/wsl.conf`, `wsl --shutdown`, run `loginctl enable-linger "$USER"` once; without systemd set `sessionSandbox` to `auto` or `false` |
44
+ | Optional: `ripgrep`, `git`, `inotify-tools` | `pnpm run bootstrap <distro>` prints the install commands |
52
45
 
53
- ### Why Linux, not PowerShell
46
+ The plugin never edits the installed `resources/app.asar`. Upgrade = install again and restart; uninstall on the Plugins page, then `~/.cache/dsh-wsl` can be deleted. Details in [docs/QUICKSTART.md](docs/QUICKSTART.md).
54
47
 
55
- Most coding agents learn from Linux-first material, and most open-source toolchains are built and tested on Linux first. Asking an agent to work through a Windows shell adds a translation layer on every call:
48
+ ## Do I need this plugin?
56
49
 
57
- - **Training prior.** Examples, CI scripts, Dockerfiles and most public answers use POSIX shells and GNU tools. A model's first instinct is `bash`, not PowerShell.
58
- - **Toolchain support.** Node, Python, Rust, Go, C/C++ and most build systems are validated on Linux first. Windows support is often a port with different quoting, paths, line endings and file locking.
59
- - **Shell semantics.** PowerShell and `cmd` differ from POSIX in quoting, escaping, pipelines, environment variables, exit codes and path separators. Mixing the two produces errors that look like model mistakes.
60
- - **Environment drift.** Windows setups vary by PowerShell version, execution policy, PATH and installed tools. Linux environments are easier to reproduce and containerize.
50
+ If the harness can run entirely inside the distro, skip this plugin: install the CLI in the distro (commands in [QUICKSTART §0](docs/QUICKSTART.md)). Use this plugin when the harness must stay on Windows:
61
51
 
62
- The result is more failed commands, more retries and more time spent on syntax instead of the task. Generated code is affected too: shell snippets, build commands and CI-style one-liners are usually written for POSIX, and the distro is where they run unchanged. A real Linux login shell removes that translation layer. Modern PowerShell and Windows-native toolchains narrow the gap, but the default prior and most project scripts still assume POSIX.
52
+ | Setup | What to use |
53
+ |---|---|
54
+ | a terminal or browser UI is enough | the CLI inside the distro |
55
+ | the Windows desktop app, commands and files in the distro | this plugin |
56
+ | one session reaching both Windows and WSL folders | this plugin |
63
57
 
64
- This plugin keeps the GUI on Windows and moves only the execution environment into the distro, so the agent gets the shell that its training and the toolchain both assume.
58
+ One trap: the `desktop` profile name is owned by the Electron app, and the npm CLI refuses to manage its plugins — use the in-app Plugins page. Full comparison in [docs/VALUE.md](docs/VALUE.md).
59
+
60
+ ## Using it
61
+
62
+ Open a distro folder as the workspace, e.g. `\\wsl.localhost\ubuntu\home\you\project`.
63
+
64
+ - A folder opened in any distro runs in that distro.
65
+ - Commands run in the distro's login shell; `/home/you/x` and `\\wsl.localhost\ubuntu\home\you\x` are the same file.
66
+ - **New terminal** opens a shell in the same distro and directory.
67
+ - The model sees listening ports and returns dev-server URLs (WSL 2 forwards localhost).
68
+ - Permissions: `read-only` / `workspace-write` (default) / `danger-full-access`; only the last runs without the sandbox.
69
+ - The sidebar **WSL environment** panel diagnoses per distro; see [docs/DIAGNOSTICS.md](docs/DIAGNOSTICS.md).
65
70
 
66
71
  ## How it compares
67
72
 
@@ -72,112 +77,16 @@ This plugin keeps the GUI on Windows and moves only the execution environment in
72
77
  | Command sandbox | none | `bubblewrap` |
73
78
  | Removal | delete the server | delete the cache |
74
79
 
75
- A desktop remote reconnects faster and is more mature. A CLI agent installed inside WSL is simpler if it covers your work. This plugin is for the case where the harness stays on Windows and commands must be sandboxed.
76
-
77
- ## Requirements
78
-
79
- - Windows 10 or 11 with WSL 2 and at least one distro.
80
- - `bubblewrap` in the distro. It is required.
81
- - systemd in the distro for the default session sandbox: set `[boot] systemd=true` in `/etc/wsl.conf`, restart WSL, then run `loginctl enable-linger "$USER"` once. Without systemd, set `sessionSandbox` to `auto` (the scope when available, otherwise per-command confinement) or explicit `false` on both `wsl-shell` and `wsl-fs`.
82
- - Optional: `ripgrep` for search, `git` for change snapshots, `inotify-tools` for file watching.
83
-
84
- No Node.js is required inside the distro.
85
-
86
- ## Install
87
-
88
- The Windows desktop app ships **no `dsh` executable**: the installer writes
89
- `DeepSeek Harness.exe`, and the CLI entry lives inside `resources/app.asar`
90
- (the probe scripts launch it through `ELECTRON_RUN_AS_NODE`). Use the
91
- distribution you have.
92
-
93
- **Desktop app.** Open **Plugins** in the sidebar, choose **Add plugin**, enter
94
- the exact package name `dsh-plugin-wsl-env`, then enable it. The plugin manager
95
- writes the active profile's `package.json` — the dependency and the
96
- `dsh.profile.bundles` entry — which is the same state the CLI command below
97
- produces. To run from a checkout, add it as a linked package instead of a
98
- name. Start it the way the installer's shortcut does: `DeepSeek Harness.exe`,
99
- no arguments. The app opens the profile it is configured with — the one the
100
- Plugins page writes into — so a different profile is a CLI-distribution thing
101
- (`dsh --profile <name>`).
102
-
103
- **No host patch.** The plugin never edits the installed
104
- `resources/app.asar`. The **在 VS Code 中打开(WSL)** bridge is a plugin row, so
105
- an app upgrade cannot drop it and a plugin update only needs reinstall plus
106
- restart — there is no archive re-patch step. The shipped "Open in app" item is a
107
- separate upstream defect; see [docs/UPSTREAM-OPEN-IN-APP.md](docs/UPSTREAM-OPEN-IN-APP.md).
108
-
109
- **CLI distribution** (`dsh` on `PATH`), in a Windows terminal:
110
-
111
- ```powershell
112
- dsh wsl --from-default-profile web --dump-config # create a profile named wsl
113
- dsh plugin --profile wsl add dsh-plugin-wsl-env # install the plugin and its settings
114
- dsh --profile wsl --dump-config # verify: prints "# == dsh-plugin-wsl-env"
115
- dsh --profile wsl # start
116
- ```
117
-
118
- Install `bubblewrap` before the first command:
119
-
120
- ```powershell
121
- wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
122
- ```
123
-
124
- From a checkout, `pnpm run doctor` is the one-command environment check: the Windows/WSL platform, the per-distro WSL mode and identity, `.wslconfig` and `/etc/wsl.conf` cross-checks, the distro and host volumes, clock and DNS, bubblewrap usability, systemd / the user manager / Linger, the optional tools, peer versions, the native agent and its cache, a fresh-agent handshake, the shell smoke legs that prove the chain (frame I/O, the confined fence, the batched substrate) and a native HELLO leg, stale session scopes, and the known profile-patch and deprecated-key traps. The report itemizes every check — grouped by distro, each with an explicit status marker and a copy-paste remedy under every failure — and ends in a verdict, `ready` (every check that run covered passed — not a promise about a later command) or `blocked` (the named checks to fix), computed under the effective configuration. A run can be scoped: `--quick` probes the first-command prerequisites only (~10 s), `--sections <list>` (comma-separated) runs the named sections, and a scoped report lists the checks it did not run as explicit skips. `--json` is the machine contract; `--fix` re-verifies what it fixed — the plugin-owned stale-scope sweep and agent-cache purge are safe and automatic, packages need `--fix --install` and an explicit confirmation, and `--fix-owned` narrows a run to the plugin-owned two — `--all` checks every installed distro, and `--bundle <path>` writes the diagnostic file a setup report attaches (`--redact` strips the paths). The fixed skeleton renders in the host's language — detected from the Windows locale, overridable with `--locale <tag>` or `DSH_WSL_DOCTOR_LOCALE`; `--json` stays language-independent. The same report answers through three surfaces: this CLI, the `/wsl-doctor` command (typed in the composer — host-side, no model turn), and the `wsl_doctor` model tool (in-process, merging the live resident's state). `DSH_WSL_DOCTOR` additionally carries a ready-to-run command (`sh -c "$DSH_WSL_DOCTOR --json"`) that replays the doctor inside the distro. `pnpm run diagnose` is the CLI's read-only alias. `pnpm run bootstrap <distro>` remains the narrower tool-install helper.
125
-
126
- The plugin notices its own updates about once a day (first check 2–10 minutes after startup) by asking the app's plugin manager — it never fetches on its own. When a newer stable release exists, the managed `DSH_WSL_PLUGIN_UPDATE` variable in every distro session carries the fact; `wsl-update-check.enabled: false` in the patch config turns the check off. Upgrading stays manual, because the harness has no hot reload: install again (Plugins page, or the `add` command), then restart. Uninstall on
127
- the Plugins page, or with `dsh plugin --profile wsl remove dsh-plugin-wsl-env`
128
- where the CLI is installed; the agent cache under `~/.cache/dsh-wsl` can then be
129
- deleted. If you added a local `workspace-files-wsl` workaround to your profile to
130
- restore previews, remove it after upgrading: the plugin no longer mounts that
131
- row.
132
-
133
- ## Using it
134
-
135
- Open a distro folder as the workspace, for example `\\wsl.localhost\ubuntu\home\you\project`.
136
-
137
- - Opening a folder in any distro runs there, even when it is not WSL's default.
138
- - Commands run in the distro's login shell. `/home/you/x` and `\\wsl.localhost\ubuntu\home\you\x` are the same file.
139
- - **New terminal** opens a shell in the same distro and directory.
140
- - The model sees listening ports and can return the URL of a dev server. WSL 2 forwards localhost to Windows.
141
- - The Permissions selector offers `read-only`, `workspace-write` (default) and `danger-full-access`. Only `danger-full-access` runs without the sandbox.
142
- - The sidebar's **WSL environment** panel is the diagnostic page: the installed distros, an on-demand quick doctor check per distro (bwrap / systemd / Linger and the other prerequisites), and a full-run action (`--fix-owned`, labeled **修复** when a finding is one the plugin can repair and **完整检查** otherwise) that sweeps stale session scopes and purges a broken agent cache, then re-verifies both — without touching packages or Windows-owned configuration; every other warning keeps its manual remedy. Each checked row also states when the check ran, where it came from (**手动** or the page-load **后台** refresh), and how its results landed — the per-status totals and the per-section tallies. Each checked row also expands to the full list of checks that run executed, grouped by section with each status and its evidence (the catalog rows a quick run never touched are counted, not listed), so a green or blocked row can be audited instead of trusted. The next action is visible without opening the doctor. The last result per distro is stored under `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json` (falling back to `~/.dsh`), so a page reload or an app restart still shows it; on load, stored results for distros that are currently running are re-checked in the background (never a stopped one), and a failed background run replaces the stored result exactly as observed. No result is labeled expired: the timestamp is the timestamp. **Add workspace** on a distro folder asks once between **Remote WSL** (the default, everything runs in the distro) and **Windows access** (the folder as a 9p share, without the Linux toolchain), recorded in the `auto-preset` row's `windowsWorkspaces`. Those recorded directories are also called out where the consequence is felt: a distro workspace running a non-WSL preset keeps a warning above the composer (a one-click switch while the session is still blank, and the durable access-record fix once a turn has started), the session header keeps a small **WSL工作区正以Windows模式打开** marker after the warning is collapsed, and the panel lists the recorded directories for audit.
80
+ A desktop remote is more mature; a CLI inside WSL is simpler. This plugin is for: the harness stays on Windows and commands must be sandboxed.
143
81
 
144
82
  ## Configure
145
83
 
146
- Settings live on named rows in `$DSH_HOME/profiles/<name>/cordis.patch.yml`. The main values:
147
-
148
- | Row | Key | Default | Purpose |
149
- |---|---|---|---|
150
- | `wsl-shell` | `distro` | `''` | distro mode; empty/`auto` follows the workspace, `default` forces WSL's default |
151
- | | `sandbox` | `true` | confine commands with `bubblewrap` |
152
- | | `sessionSandbox` | `false`; shipped `true` | run the session's commands in one systemd user scope |
153
- | | `agentBackend` | `auto` | `auto`, `native` or `shell` for the in-distro agent |
154
- | | `maskWindowsDrive` | `false` | hide `/mnt` from confined commands |
155
- | | `writableRoots` | `[]` | extra distro directories to grant (toolchain caches; put the same list on `wsl-fs`) |
156
- | `wsl-fs` | `distro` | `''` | distro mode; empty/`auto` follows each target path |
157
- | | `restrictToDistro` | `true` | under a fixed distro, refuse paths that belong to another distro |
158
- | | `sandbox` | `true` | check confined writes against the policy |
159
- | | `sessionSandbox` | `false`; shipped `true` | run confined writes in the session runtime |
160
- | | `substrate` | `agent` | in-distro agent; `share` is rejected at startup |
161
- | | `writableRoots` | `[]` | the same extra-writable list as `wsl-shell` |
162
- | `directory-picker-wsl` | `includeHostHome` | `true` | also offer the Windows path branch (starting at the drives) |
163
- | `subprocess-wsl` | `distro` | `''` | distro mode; empty/`auto` follows the launch directory |
164
- | `wsl-preflight` | `distro` | `''` | distro the environment checks probe; empty/`auto` follows the session workspace |
165
- | | `startup` | `true` | run the same checks once at plugin load, so the verdict is in the log before any session opens |
166
-
167
- `fs-routing` is the top-level router for root-level `ctx.fs` calls: its distro
168
- settings are independent of `wsl-fs`, and it is a top-level row patched by id
169
- like the others. `wsl-shell` and `wsl-fs` are inside the shipped `wsl` preset,
170
- so overriding them by id does not work. Override the whole `preset-wsl` row
171
- instead; [docs/CONFIGURATION.md](docs/CONFIGURATION.md) has the recipe and the
172
- remaining keys. [`cordis.patch.yml`](cordis.patch.yml) is the commented
173
- reference for every shipped value.
84
+ Settings live on named rows in `$DSH_HOME/profiles/<name>/cordis.patch.yml`. `wsl-shell`/`wsl-fs` are nested inside `preset-wsl`; overriding them by id does not work — override the whole row. Every key and recipe is in [docs/CONFIGURATION.md](docs/CONFIGURATION.md); [`cordis.patch.yml`](cordis.patch.yml) is the commented reference for the shipped values.
174
85
 
175
86
  ## Architecture
176
87
 
177
- One harness process can serve Windows-folder and distro-folder sessions at the same time. Services attach at two levels:
178
-
179
88
  ```text
180
- app level (one per process)
89
+ app level (per process)
181
90
  ├─ directory-picker-wsl, workspace-files, subprocess-wsl
182
91
  ├─ fs-routing: root filesystem routed by path
183
92
  └─ auto-preset: binds the wsl preset when a session opens a distro folder
@@ -187,24 +96,17 @@ wsl preset (per session)
187
96
  └─ wsl-fs: file operations
188
97
  ```
189
98
 
190
- - `wsl-shell` runs commands through one resident agent inside a systemd user scope. The agent is the packaged static-musl `dsh-wsl-agent` for the distro's architecture (`x86_64` or `aarch64`), with the shell agent as fallback. Each command runs in the login shell under a `bubblewrap` mount profile. The scope outlives the command, so background servers survive and `ps` sees the session. With `sessionSandbox: false`, the agent stays per distro and each command gets its own profile.
191
- - `wsl-fs` serves reads and writes through the same in-distro agent. Confined writes run in a long-lived agent whose mount profile matches the policy, so the kernel enforces the write boundary. There is no host-side file fallback: if the agent is unavailable, file operations fail.
192
- - The GUI file tree and previews are the shipped `workspace-files` row, not a plugin replacement: its client half is the browser `file` provider. It reads WSL paths through the routed root filesystem, so it stays distro-side, at the cost of a few extra agent round trips.
193
- - App-level services route by path. A distro UNC path goes to the distro; a Windows drive path stays on the host. See [docs/root-fs-routing.md](docs/root-fs-routing.md).
99
+ Commands and file operations go through a resident agent in the distro (systemd user scope + `bubblewrap` profile). Distro UNC paths route to the distro; drive-letter paths stay on the host. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
194
100
 
195
101
  ## Sandbox
196
102
 
197
103
  | Mode | What a command can do |
198
104
  |---|---|
199
- | `read-only` | read the whole distro; a fresh `/dev` is mounted, nothing else is writable |
200
- | `workspace-write` | the above, plus the session workspace and any configured `writableRoots`; `/tmp` is the distro's real `/tmp` with the session runtime |
105
+ | `read-only` | read the whole distro; only a fresh `/dev` is mounted, nothing else writable |
106
+ | `workspace-write` | plus the session workspace and any configured `writableRoots` |
201
107
  | `danger-full-access` | no sandbox |
202
108
 
203
- With `sessionSandbox: false`, a `workspace-write` command gets a private `/tmp` instead of the distro's real one. `read-only` does not mount a writable `/tmp`.
204
-
205
- `bubblewrap` is required. If it is missing or broken, confined commands report `SANDBOX_UNAVAILABLE` and do not run. Setting `sandbox: false` on the owning row disables confinement; the model is told that the operation is unsandboxed.
206
-
207
- Enforcement is reported as `partial`. A command inside the distro can still start a Windows executable through `/mnt/c`, and `bubblewrap` cannot control Windows processes. `maskWindowsDrive: true` hides `/mnt` from the confined view unless overridden by `interopVisibility: visible`; this narrows the hole but does not close it. Disabling WSL interop requires a separate distro-level change: set `[interop] enabled=false` in `/etc/wsl.conf`. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#sandbox) and [SECURITY.md](SECURITY.md).
109
+ Without `bubblewrap`, confined commands report `SANDBOX_UNAVAILABLE` and do not run. Enforcement is `partial`: a process inside the distro can still start Windows programs through `/mnt/c`. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#sandbox) and [SECURITY.md](SECURITY.md).
208
110
 
209
111
  ## Troubleshooting
210
112
 
@@ -214,11 +116,11 @@ Enforcement is reported as `partial`. A command inside the distro can still star
214
116
  | the session refuses before the first command | run `pnpm run doctor`; enable systemd and linger, or set `sessionSandbox` to `auto` or `false` on `wsl-shell` and `wsl-fs` |
215
117
  | `glob` and `grep` are slow in the distro | run `pnpm run bootstrap <distro>` and use its printed install command to install `ripgrep` |
216
118
  | `npm install` / `pnpm add` fail with `EROFS` | the sandbox grants only the workspace by default; configure `writableRoots` on `wsl-shell` and `wsl-fs` (e.g. `~/.npm`, `~/.cache`, `~/.local/share/pnpm`); see [CONFIGURATION](docs/CONFIGURATION.md#toolchain-caches-and-extra-writable-roots) |
217
- | `dsh plugin add` prints nothing, or the Plugins page finishes without feedback | trust the profile's `package.json` and its `dsh.profile.bundles` entry: the plugin listed there is installed |
119
+ | the Plugins page finishes without feedback | trust the profile's `package.json` and its `dsh.profile.bundles` entry: the plugin listed there is installed |
218
120
  | a profile patch for `wsl-shell`/`wsl-fs` changes nothing | those rows are nested inside `preset-wsl`. Run `pnpm run preset --check <patch>`; it fails with the complete block to paste |
219
121
  | changes under `lib/` have no effect | run `pnpm run sync:windows`, then restart the app |
220
122
 
221
- More error codes and refusals are in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#error-codes). Everything the plugin does not do is in [docs/LIMITATIONS.md](docs/LIMITATIONS.md).
123
+ More error codes in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md#error-codes); what the plugin does not do is in [docs/LIMITATIONS.md](docs/LIMITATIONS.md).
222
124
 
223
125
  ## Development
224
126
 
@@ -230,12 +132,7 @@ pnpm run test:coverage # unit tests with coverage thresholds
230
132
  pnpm run sync:windows # update the Windows-side copy the app loads
231
133
  ```
232
134
 
233
- The toolchain follows the harness host: Node `^22.19.0 || >=24.0.0`. `src/` is TypeScript; `lib/` is generated and must stay in sync. The app loads a Windows-side copy of `lib/`, so run `sync:windows` and restart the app after a build.
234
-
235
- Real-machine probes run on Windows + WSL only. See [CONTRIBUTING.md](CONTRIBUTING.md) and `test/probe/`.
236
-
237
- Community-facing documents are available in English and Chinese. The Chinese
238
- README is [docs/README.zh.md](docs/README.zh.md).
135
+ Node `^22.19.0 || >=24.0.0`; `src/` is TypeScript, `lib/` is the committed build output. Real-machine probes run on Windows + WSL only. See [CONTRIBUTING.md](CONTRIBUTING.md) and `test/probe/`.
239
136
 
240
137
  ## Documentation
241
138
 
package/SUPPORT.md CHANGED
@@ -98,13 +98,13 @@ what it cannot see:
98
98
  | The diagnose report | `pnpm run diagnose <distro>` (read-only; review and redact before sharing) |
99
99
  | Plugin version | `npm ls dsh-plugin-wsl-env`, or the git tag you built from |
100
100
  | DSH version | the version of the harness you run |
101
- | The composed configuration | On the CLI distribution, `dsh --profile <name> --dump-config` (the `dsh-plugin-wsl-env` layer and the rows it patches). The desktop app has no `dsh` command; attach the profile's `cordis.patch.yml` instead |
101
+ | The composed configuration | the profile's `package.json` and `cordis.patch.yml` (the `dsh-plugin-wsl-env` layer and the rows it patches). The desktop app has no `dsh` command |
102
102
  | Sandbox behaviour, in depth | the output of `npm run probe:sandbox`, run from inside the distro (`wsl.exe -d <distro>` first) — the probe calls `bwrap` and reads `lib/bwrap.js` there, so it needs both in the distro |
103
103
  | What you expected and what happened | one paragraph each |
104
104
  | A reproduction | the exact command, or the exact sequence of clicks |
105
105
 
106
106
  Redact your user name and any path you would rather not publish. The useful part
107
- of `--dump-config` is usually the layer heading and the patched rows, not the whole
107
+ of `cordis.patch.yml` is usually the layer heading and the patched rows, not the whole
108
108
  file.
109
109
 
110
110
  ## Response times
package/SUPPORT.zh.md CHANGED
@@ -85,12 +85,12 @@ Schemastery 使用 caret peer 区间。接受的区间并不保证与每个更
85
85
  | 诊断报告 | `pnpm run diagnose <distro>`(只读;分享前审查并脱敏) |
86
86
  | 插件版本 | `npm ls dsh-plugin-wsl-env`,或你构建所用的 git tag |
87
87
  | DSH 版本 | 你运行的 harness 版本 |
88
- | 合成配置 | 在 CLI 发行版上,`dsh --profile <name> --dump-config`(`dsh-plugin-wsl-env` 层及其修补的行)。桌面应用没有 `dsh` 命令;请改附 profile 的 `cordis.patch.yml` |
88
+ | 合成配置 | profile 的 `package.json` 与 `cordis.patch.yml`(`dsh-plugin-wsl-env` 层及其修补的行)。桌面应用没有 `dsh` 命令 |
89
89
  | 沙箱行为(深入) | 在发行版内运行(先 `wsl.exe -d <distro>`)`npm run probe:sandbox` 的输出——探针会调用 `bwrap` 并读取那里的 `lib/bwrap.js`,因此发行版内两者都需要 |
90
90
  | 你期望什么、实际发生了什么 | 各写一段 |
91
91
  | 复现 | 精确命令,或精确的点击顺序 |
92
92
 
93
- 隐去你的用户名以及任何你不愿公开的路径。`--dump-config` 中有用的部分通常是
93
+ 隐去你的用户名以及任何你不愿公开的路径。`cordis.patch.yml` 中有用的部分通常是
94
94
  层标题与被修补的行,而不是整个文件。
95
95
 
96
96
  ## 响应时间
@@ -92,10 +92,9 @@ between the shell and filesystem providers.
92
92
  ## How the pieces are mounted
93
93
 
94
94
  [`cordis.patch.yml`](../cordis.patch.yml) is the bundle layer. It is a top-level
95
- YAML array of patch entries, and `dsh plugin --profile <name> add
96
- dsh-plugin-wsl-env` applies it as one layer on the CLI distribution; the
97
- desktop app applies the same bundle through its sidebar **Plugins** page
98
- (**Add plugin**) and records it in the profile's `dsh.profile.bundles`.
95
+ YAML array of patch entries; the desktop app applies it as one layer through
96
+ its sidebar **Plugins** page (**Add plugin**) and records it in the profile's
97
+ `dsh.profile.bundles`.
99
98
 
100
99
  The environment is per session, not per process:
101
100
 
@@ -386,6 +385,16 @@ The Windows copy at `default-workspace/dsh-plugin-wsl` is a runtime mirror.
386
385
  [`test/probe/sync-to-windows.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/sync-to-windows.sh) keeps it in
387
386
  step with the checkout, and `pnpm run sync:windows` runs that script.
388
387
 
388
+ The mirror carries no `node_modules` by design: the harness's linked-plugin
389
+ resolution projects the peers the manifest declares onto the installation's
390
+ single copies, so the mirror and the running app share one peer set. A separate
391
+ process (the doctor child, `DSH_WSL_DOCTOR`) has no such resolution, so the
392
+ in-app surfaces hand the peer versions this process resolved to the doctor.
393
+ That hand-off is authoritative even when only some peers resolved: a missing
394
+ peer is unchecked, not read back from a copy beside the plugin. A stale
395
+ `node_modules` above the mirror — the tree an earlier harness installation
396
+ leaves behind — neither feeds the runtime nor counts in the check.
397
+
389
398
  ## Test layers
390
399
 
391
400
  | Layer | Location | Needs a harness |
@@ -83,9 +83,8 @@ GUI 文件树与预览保留随包的 `workspace-files` 行。它的客户端半
83
83
  ## 各部件如何挂载
84
84
 
85
85
  [`cordis.patch.yml`](../cordis.patch.yml) 是 bundle 层。它是 patch 条目的顶层
86
- YAML 数组,`dsh plugin --profile <name> add dsh-plugin-wsl-env` 在 CLI 发行版上
87
- 把它作为一层应用;桌面应用通过侧边栏 **Plugins** 页面(**Add plugin**)应用
88
- 同一个 bundle,并记录到 profile 的 `dsh.profile.bundles` 中。
86
+ YAML 数组;桌面应用通过侧边栏 **Plugins** 页面(**Add plugin**)把它作为一层
87
+ 应用,并记录到 profile 的 `dsh.profile.bundles` 中。
89
88
 
90
89
  环境按会话而非按进程:
91
90
 
@@ -339,6 +338,14 @@ harness 无法从发行版内的检出目录加载插件。
339
338
  [`test/probe/sync-to-windows.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/sync-to-windows.sh)
340
339
  让它与检出目录保持一致,`pnpm run sync:windows` 运行该脚本。
341
340
 
341
+ 镜像按设计不带 `node_modules`:harness 的链接插件解析会把镜像清单里声明的
342
+ peer 投影到安装处的同一份副本,因此镜像与运行中的应用共享一套对等包。独立
343
+ 进程(doctor 子进程、`DSH_WSL_DOCTOR`)没有这层解析,所以应用内入口把本进程
344
+ 解析出的 peer 版本交给 doctor;这份交接即使只解析到部分 peer 也是权威的,
345
+ 缺失项记作 unchecked,不再回读插件目录旁的旧副本。镜像上方遗留的旧
346
+ `node_modules`——例如 harness 升级前留下的树——既不参与运行时解析,也不计入
347
+ 检查。
348
+
342
349
  ## 测试分层
343
350
 
344
351
  | 分层 | 位置 | 需要 harness |
@@ -50,10 +50,8 @@ that row unless you pass `--force`. Prefer manual merging for existing profiles.
50
50
 
51
51
  To edit the preset manually, replace the entire `preset-wsl` row. Its config is
52
52
  not deep-merged: preserve `id`, `order`, and every item in `plugins`. Copy the
53
- current block from `cordis.patch.yml` or from
54
- `dsh --profile <name> --dump-config` (CLI distribution — the desktop app has no
55
- `dsh` command), then change the nested values. Re-copy it
56
- after a plugin upgrade that changes the preset.
53
+ current block from the profile's `cordis.patch.yml`, then change the nested
54
+ values. Re-copy it after a plugin upgrade that changes the preset.
57
55
 
58
56
  ### `wsl-shell`
59
57
 
@@ -426,10 +424,9 @@ language without re-probing. `--yes` skips the confirmation prompt (not the
426
424
  confirmation gate itself), and `--read-only` refuses to run together with
427
425
  `--fix` or `--install`.
428
426
  See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the verdict contract and the
429
- error-code map. With the CLI distribution, `dsh --profile <name> --dump-config` inspects
430
- the composed profile without booting it and shows whether a row override
431
- applied; the desktop app has no `dsh` command, so read `cordis.patch.yml` and
432
- the Plugins page there.
427
+ error-code map. Whether a row override applied, read from the profile's
428
+ `cordis.patch.yml` and the Plugins page: the desktop app has no `dsh` command,
429
+ so the composed profile has no command-line view.
433
430
  The sidebar's **WSL environment** panel renders the same quick digest over
434
431
  `GET /api/wsl-env/status` and posts the full-run action to the same route: a
435
432
  doctor run with `--fix-owned`, which sweeps stale session scopes and purges a
@@ -48,9 +48,8 @@ profile 层;检测到时会打印应使用的块。`--out` 会整体替换目
48
48
 
49
49
  要手动编辑 preset,需替换整个 `preset-wsl` 行。它的 config
50
50
  不做深度合并:保留 `id`、`order` 以及 `plugins` 中的每一项。
51
- 从 `cordis.patch.yml` 或 `dsh --profile <name> --dump-config`
52
- (CLI 发行版;桌面应用没有 `dsh` 命令)
53
- 复制当前块,再修改嵌套的值。插件升级改变了 preset 后要重新复制。
51
+ 从 profile 的 `cordis.patch.yml` 复制当前块,再修改嵌套的值。
52
+ 插件升级改变了 preset 后要重新复制。
54
53
 
55
54
  ### `wsl-shell`
56
55
 
@@ -386,9 +385,8 @@ profile 补丁与废弃键陷阱——每个失败附可复制的修复。运行
386
385
  无需重新探测即可选择骨架语言。`--yes` 跳过确认提示(不跳过确认门本身),
387
386
  `--read-only` 拒绝与 `--fix` 或 `--install` 同用。
388
387
  判定契约与错误码地图见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
389
- CLI 发行版可用 `dsh --profile <name> --dump-config` 检查合成后的 profile,
390
- 无需真正启动;输出会显示某行的覆盖是否生效。桌面应用没有 `dsh` 命令,
391
- 请直接查看 `cordis.patch.yml` 与 Plugins 页面。
388
+ 某行的覆盖是否生效,直接查看 profile 的 `cordis.patch.yml` 与 Plugins 页面:
389
+ 桌面应用没有 `dsh` 命令,合成后的 profile 没有命令行视图。
392
390
  侧边栏的 **WSL 环境** 面板经 `GET /api/wsl-env/status` 渲染同一份快速摘要,
393
391
  并把完整运行动作提交到同一路由:以 `--fix-owned` 运行 doctor,清扫残留
394
392
  session scope、清理损坏的 agent 缓存并逐一复检。行内显示上次检查时间、来源(手动或后台)与结果结构(各状态计数与分区分布)。
@@ -113,6 +113,22 @@ process. That is host-process state, so the standalone CLI cannot see it; the
113
113
  command, the panel and the model tool merge the row in. A missing row in a CLI
114
114
  report means "not observable from a subprocess", not "the seam is fine".
115
115
 
116
+ `peers.versions` is surface-dependent for the same reason: it asks which peer
117
+ copies this process loads. The host runtime projects a linked plugin's declared
118
+ peers onto the installation's single copies, so the same plugin can load the
119
+ app's versions while a separate Node process resolves something else. Before
120
+ the check learned the plugin's peer position, the standalone CLI's native
121
+ lookup walked past the mirror into an older `node_modules` above it — the tree
122
+ an earlier harness installation left behind — and compared that tree's
123
+ versions. It now stops at the first position that declares the peer (the
124
+ plugin's own), counts the copy there, and reports every other peer as
125
+ unchecked, never as a failure. The in-app surfaces (panel, `/wsl-doctor`,
126
+ `wsl_doctor`) instead hand the versions this process resolved to the doctor
127
+ child in `DSH_WSL_DOCTOR_PEERS`. A present variable is authoritative even when
128
+ the map is partial or empty: the peers it omits could not be resolved by the
129
+ host, so they are unchecked rather than looked up again in the plugin's
130
+ physical tree.
131
+
116
132
  ## The map
117
133
 
118
134
  Class legend:
@@ -85,6 +85,17 @@ doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面
85
85
  会杀掉它,而两分钟时限加上有界的管道排空窗口,能让子进程不再报告时也有
86
86
  结论。这是唯一依赖模型链路的入口;怀疑插件运行时本身时,用命令或 CLI。
87
87
 
88
+ `peers.versions` 也按入口而异,因为它问的是本进程实际加载的对等包版本。宿主
89
+ 运行时会把链接插件声明的 peer 投影到安装处的同一份副本上,所以同一份插件在
90
+ 应用内加载的是应用自带的版本,而独立 Node 进程解析到的可能完全不同。修复前,
91
+ 独立 CLI 的原生查找会越过镜像、落进其上方的旧 `node_modules`——上一次
92
+ harness 安装留下的树——并比较那棵树的版本。现在查找在第一个声明该 peer 的
93
+ 位置(插件自身)停止,只计入那里的副本,其余记作 unchecked,而不是失败。
94
+ 应用内入口(面板、`/wsl-doctor`、`wsl_doctor`)则把本进程解析出的版本经
95
+ `DSH_WSL_DOCTOR_PEERS` 交给 doctor 子进程;该变量一旦出现就是权威答案,即使
96
+ 映射为空或只有部分项——缺失项说明宿主没有解析到,doctor 记作 unchecked,不再
97
+ 回退到插件目录旁的本地副本。
98
+
88
99
  ## 地图
89
100
 
90
101
  类别图例:
package/docs/MIGRATION.md CHANGED
@@ -97,8 +97,11 @@ ships through the tag workflow, but its notes say which gates were executed.
97
97
  ```bash
98
98
  pnpm run preset --distro default --check <profile>/cordis.patch.yml # no nested-row trap
99
99
  pnpm run doctor --json # effective environment facts
100
- dsh --profile <name> --dump-config # composed rows (CLI distribution)
100
+ pnpm run e2e:install # packed install/upgrade/uninstall chain
101
101
  ```
102
102
 
103
+ The desktop app has no `dsh` command; the composed state is the profile's
104
+ `package.json` and `cordis.patch.yml`, read directly.
105
+
103
106
  A profile that fails to boot after a migration should name the remedy in the
104
107
  error; if it does not, that is a bug — report it with the `doctor --json` output.
@@ -84,8 +84,11 @@ aarch64 qemu 是 CI 门禁。发布说明不得声称未运行的行,
84
84
  ```bash
85
85
  pnpm run preset --distro default --check <profile>/cordis.patch.yml # 无嵌套行陷阱
86
86
  pnpm run doctor --json # 生效的环境事实
87
- dsh --profile <name> --dump-config # 合成后的行(CLI 发行版)
87
+ pnpm run e2e:install # 打包安装/升级/卸载全链
88
88
  ```
89
89
 
90
+ 桌面应用没有 `dsh` 命令;合成后的状态就是 profile 的 `package.json` 与
91
+ `cordis.patch.yml`,直接查看即可。
92
+
90
93
  迁移后启动失败的 profile 应在错误中指明补救方法;若没有,那就是 bug——
91
94
  请附上 `doctor --json` 输出报告它。
@@ -192,6 +192,22 @@ and `test/agent-protocol.test.mjs` (HELLO caps, FSERR, FSB encoding).
192
192
  Divergence 4's binary/UTF-8 dialect note now also covers the patch path, which
193
193
  re-reads through `readForEdit`.
194
194
 
195
+ ## The check that reports this set
196
+
197
+ `peers.versions` names the versions the plugin is loaded against, which is not
198
+ always what a native lookup beside the runtime mirror finds. The host's profile
199
+ resolution projects this package's declared peers onto the installation's single
200
+ copies (a linked plugin's own `node_modules` is the input, not the answer), and
201
+ the in-app doctor spawners pass that resolved map to the CLI in
202
+ `DSH_WSL_DOCTOR_PEERS`; the variable's presence is authoritative even when the
203
+ map is partial or empty, so a peer the host could not resolve is unchecked
204
+ rather than looked up beside the mirror. The standalone CLI has no projection,
205
+ so it counts only a copy at the plugin's own peer position and reports every
206
+ other peer as unchecked instead of failing it — a stale `node_modules` above the
207
+ mirror (the previous harness installation's tree, for example) is not this
208
+ plugin's peer set. The versions above remain the ones the
209
+ standalone `pnpm run doctor` reports from this checkout's pinned dev set.
210
+
195
211
  ## Maintenance
196
212
 
197
213
  When a peer floor or dev pin moves in `package.json`, re-run the comparison