dsh-plugin-wsl-env 0.26.0 → 0.26.2

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/README.md +55 -158
  3. package/SUPPORT.md +2 -2
  4. package/SUPPORT.zh.md +2 -2
  5. package/docs/ARCHITECTURE.md +21 -5
  6. package/docs/ARCHITECTURE.zh.md +17 -4
  7. package/docs/CONFIGURATION.md +7 -9
  8. package/docs/CONFIGURATION.zh.md +6 -7
  9. package/docs/DIAGNOSTICS.md +21 -0
  10. package/docs/DIAGNOSTICS.zh.md +15 -0
  11. package/docs/LIMITATIONS.md +13 -1
  12. package/docs/LIMITATIONS.zh.md +12 -2
  13. package/docs/MIGRATION.md +4 -1
  14. package/docs/MIGRATION.zh.md +4 -1
  15. package/docs/PEER-PARITY.md +16 -0
  16. package/docs/QUICKSTART.md +22 -15
  17. package/docs/QUICKSTART.zh.md +19 -16
  18. package/docs/README.zh.md +59 -146
  19. package/docs/RELEASING.md +2 -2
  20. package/docs/REQUIREMENTS.zh.md +2 -2
  21. package/docs/ROADMAP-1.0.md +1 -1
  22. package/docs/VALUE.md +27 -0
  23. package/docs/VALUE.zh.md +27 -0
  24. package/docs/screenshots/with-plugin.png +0 -0
  25. package/docs/screenshots/with-plugin.svg +59 -0
  26. package/docs/screenshots/with-plugin.zh.png +0 -0
  27. package/docs/screenshots/with-plugin.zh.svg +56 -0
  28. package/docs/screenshots/without-plugin.png +0 -0
  29. package/docs/screenshots/without-plugin.svg +50 -0
  30. package/docs/screenshots/without-plugin.zh.png +0 -0
  31. package/docs/screenshots/without-plugin.zh.svg +45 -0
  32. package/lib/doctor-report.js +8 -1
  33. package/lib/git-exec.d.ts +39 -7
  34. package/lib/git-exec.js +151 -18
  35. package/lib/listing.d.ts +17 -0
  36. package/lib/listing.js +20 -0
  37. package/lib/messages.d.ts +27 -0
  38. package/lib/messages.js +26 -2
  39. package/lib/peer-versions.d.ts +53 -0
  40. package/lib/peer-versions.js +137 -0
  41. package/lib/picker.js +33 -19
  42. package/lib/search-exec.d.ts +45 -9
  43. package/lib/search-exec.js +152 -20
  44. package/lib/subprocess.d.ts +4 -1
  45. package/lib/subprocess.js +16 -3
  46. package/lib/update-check.d.ts +2 -2
  47. package/lib/update-check.js +2 -2
  48. package/lib/wsl-doctor-command.js +2 -1
  49. package/lib/wsl.d.ts +21 -0
  50. package/lib/wsl.js +24 -0
  51. package/package.json +9 -2
  52. package/scripts/doctor.mjs +148 -22
package/CHANGELOG.md CHANGED
@@ -16,6 +16,143 @@ were part of the record.
16
16
 
17
17
  ## [Unreleased]
18
18
 
19
+ ## [0.26.2] - 2026-11-17
20
+
21
+ One theme: a broken distro's failures surface as the program's own —
22
+ actionable exit codes and remedies instead of opaque provider errors — while
23
+ the doctor's quick pass spots the missing tools before the model does.
24
+
25
+ ### Fixed
26
+
27
+ - **A search in a distro without ripgrep reports rg's failure, not an opaque
28
+ provider error.** The file-search tool reads rg's exit dialect (`1` = no
29
+ matches, `2` = rg failed), but `search-exec.js` treated only
30
+ `AgentUnavailableError` as a cue: the native resident's `SpawnError` — a
31
+ missing `rg` on the PATH the agent inherits from `wsl.exe`, which never
32
+ holds `~/.local/bin` — rejected `done`, and the tool rendered
33
+ "subprocess failed before reporting an outcome (ripgrep provider failure)".
34
+ The handle now synthesizes the documented shape: exit 127 with a message
35
+ naming the program, the distro, the user-local-PATH cause, and the
36
+ `scripts/bootstrap.sh <distro> --install` remedy. A missing working
37
+ directory becomes rg's error code 2 with the relay-shaped `chdir(...)` line
38
+ — never `1`, which the tool reads as "no matches". The one-shot fallback
39
+ translates the relay's `execvpe(rg) failed: No such file or directory` the
40
+ same way, and pins `WSL_UTF8=1` so that line (and every other relay
41
+ diagnostic) arrives readable. A spawn failure deliberately does not retry
42
+ one-shot: `wsl.exe --cd` does not fail on a missing directory — it warns and
43
+ runs the command in `/` — so the retry could turn a wrong directory into a
44
+ successful empty search. Pinned by `test/search-exec.test.mjs`;
45
+ `docs/LIMITATIONS.md` and `docs/ARCHITECTURE.md` record the failure shapes
46
+ and the PATH fact.
47
+
48
+ - **A git snapshot on a distro without git reports git's failure instead of a
49
+ silently empty change review.** `git-exec.js` had the same only-
50
+ `AgentUnavailableError` cue: the native resident's `SpawnError` (a missing
51
+ system `git` on the agent's inherited PATH) rejected `done`, and the
52
+ one-shot fallback would have been worse — `wsl.exe --cd <missing>` runs git
53
+ in `/`, where "not a git repository" reads as "no changes". The handle now
54
+ settles a missing program as exit 127 with the bootstrap remedy, a missing
55
+ directory as git's own `fatal: cannot change to ...` at exit 128, and
56
+ post-processes the one-shot relay's `execvpe(git) failed` / `chdir(...)
57
+ failed` lines into the same shapes (that path now pins `WSL_UTF8=1`). The
58
+ relay parsers are shared from `wsl.ts` (`execProgramFailure` joins
59
+ `workdirFailure`); pinned by `test/git-exec.test.mjs` and
60
+ `test/shell.test.mjs`, with `docs/LIMITATIONS.md` and
61
+ `docs/ARCHITECTURE.md` recording the contract.
62
+
63
+ - **A discovery answer's UNC translation no longer depends on the transport.**
64
+ When the host has no Windows git, the snapshot's sentinel `rev-parse`
65
+ discovery call routes into the distro; with the resident out, the one-shot
66
+ fallback returned that call's Linux absolute paths untranslated, so
67
+ `workspace-changes` resolved them in the host's coordinate system instead of
68
+ `\\wsl.localhost\<distro>`. The fallback now passes the delegated stdout
69
+ through `translateDiscoveryOutput` exactly as the agent path does, carrying
70
+ the delegate's per-stream cut flags over. Pinned by
71
+ `test/git-exec.test.mjs`.
72
+
73
+ - **The directory picker can no longer create a directory in `/` while
74
+ reporting the requested target.** `createDirectory`'s one-shot fallback ran
75
+ a relative `mkdir -- <name>` under `--cd <parent>`; a parent that vanished
76
+ makes `wsl.exe` warn, run in `/`, and exit 0 — where a writable root (a
77
+ root-default image) turns that into a created `/name` reported as the UNC
78
+ target. The argv now names the absolute target on both transports
79
+ (`distroMkdirArgv`), and the picker maps the agent's `CwdError` /
80
+ `SpawnError` to `DirectoryPickerError` instead of leaking an opaque provider
81
+ error. Pinned by `test/listing.test.mjs`; the peer-bound row itself remains
82
+ probe-covered.
83
+
84
+ ### Changed
85
+
86
+ - **The doctor's quick pass now includes the optional-tool probe.**
87
+ `tools.rg`, `tools.git` and `tools.inotifywait` ran only in a full scan, so
88
+ a distro without ripgrep surfaced at the model's first `grep`/`glob` and not
89
+ in the sidebar's quick check. One combined in-distro probe (a single
90
+ `wsl.exe`, not three) now answers all three in the quick profile too; a
91
+ missing `rg` warns with the install remedy, and a probe that answers nothing
92
+ reports `info` instead of fabricating "missing". Pinned by
93
+ `test/doctor.test.mjs`; `docs/CONFIGURATION.md`, `docs/QUICKSTART.md` and
94
+ `docs/DIAGNOSTICS.md` describe the quick scope, and the READMEs' `glob`/
95
+ `grep` troubleshooting row names the failure (exit 127) alongside the
96
+ slowness.
97
+
98
+ ## [0.26.1] - 2026-11-16
99
+
100
+ One theme: the peer self-check now answers for the set the running plugin
101
+ actually loads, so a stale tree beside the runtime mirror can no longer fail
102
+ it; the README/docs pass that leads with the desktop-app path ships too.
103
+
104
+ ### Fixed
105
+
106
+ - **The `peers.versions` self-check no longer reports a stale `node_modules`
107
+ above the runtime mirror.** A linked plugin's declared peers are resolved by
108
+ the host's profile projection onto the installation's single copies, but the
109
+ doctor is a separate process: its native lookup walked past the mirror into
110
+ whatever `node_modules` sat above it — after a harness upgrade, the previous
111
+ installation's tree — and failed the check against versions the plugin never
112
+ loads. The in-app spawners now hand the versions this process resolved to the
113
+ doctor in `DSH_WSL_DOCTOR_PEERS`; a present map is authoritative even when it
114
+ is partial or empty, so a peer the host could not resolve is unchecked rather
115
+ than backfilled from the plugin's tree. The standalone CLI, which has no
116
+ projection, counts only a copy at the plugin's own peer position and reports
117
+ peers it cannot see as unchecked instead of failed.
118
+ Pinned by `test/doctor.test.mjs` (host-map preference, malformed-map fallback,
119
+ the peer-position walk, and the collector's hand-off).
120
+ `docs/DIAGNOSTICS.md`, `docs/ARCHITECTURE.md` and `docs/PEER-PARITY.md` record
121
+ the two answers and why they differ.
122
+
123
+ ### Documentation
124
+
125
+ - **The user-facing docs demonstrate only the desktop app's path.** The
126
+ Windows desktop app ships no `dsh` executable, so the install, verify,
127
+ upgrade, uninstall and troubleshooting steps no longer present the
128
+ `dsh ...` forms of the npm CLI distribution as an alternative — the
129
+ Plugins page, the profile's `package.json` and `cordis.patch.yml`, and the
130
+ doctor surfaces are the only demonstrated way. The CLI keeps one home: the
131
+ README's "Do I need this plugin?" decision table, where it is the
132
+ alternative to this plugin, not a way to use it. MIGRATION's local
133
+ verification block, the ROADMAP-1.0 P1.3 gate, the first-use record
134
+ template, the probe profile headers (the `dsh wslfs ...` lines become the
135
+ real `ELECTRON_RUN_AS_NODE` launch documented in the header of
136
+ `test/probe/run.sh`) and the update-check service comment carry the same
137
+ reality; the CHANGELOG's older entries are history and stay as written.
138
+
139
+ - **The README pair is now a one-page pitch: a one-line definition that
140
+ names DSH's two delivery forms and the one combination the plugin serves,
141
+ a bilingual without/with diagram pair, a three-step install, and short
142
+ sections that link the owning document for every detail.** The diagrams
143
+ carry the core pain and label the two workspace modes — a Windows
144
+ workspace gets CMD/PowerShell, a WSL workspace only reaches POSIX through
145
+ stateless `wsl.exe` wrappers — and the first "Why this plugin" bullet
146
+ states it. The contrast table, the doctor walkthrough, the configure
147
+ table and the architecture/sandbox detail moved out of the README; the
148
+ CLI install commands moved to QUICKSTART §0, the upgrade/uninstall and
149
+ no-host-patch notes to QUICKSTART §2, the "Why Linux, not PowerShell"
150
+ essay into VALUE's six-sources section, and VALUE also gained a
151
+ Remote-SSH comparison for the Windows host (reach, sshd setup, in-distro
152
+ footprint, sandbox). Anchored headings keep their names, the decision
153
+ table stays, and the sandbox section keeps the `partial` wording. The
154
+ diagram SVGs ship in the tarball. `pnpm test`: 119 pass.
155
+
19
156
  ## [0.26.0] - 2026-11-12
20
157
 
21
158
  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
 
@@ -212,13 +114,13 @@ Enforcement is reported as `partial`. A command inside the distro can still star
212
114
  |---|---|
213
115
  | every command reports `SANDBOX_UNAVAILABLE` | install `bubblewrap` in the distro, or set `sandbox: false` |
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
- | `glob` and `grep` are slow in the distro | run `pnpm run bootstrap <distro>` and use its printed install command to install `ripgrep` |
117
+ | `glob` and `grep` are slow in the distro, or fail with exit 127 (no `rg`) | run `pnpm run bootstrap <distro>` and use its printed install command to install `ripgrep`; a user-local install under `~/.local/bin` is not on the PATH commands run with |
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
 
@@ -132,7 +131,14 @@ launches into the distro — the file-search tool's packaged ripgrep and git
132
131
  snapshot commands (each agent-first on the warm resident — protocol v6 carries
133
132
  a git call's stdin, and a one-shot call costs ~230 ms of `wsl.exe` startup
134
133
  against the resident's ~2 ms — with the one-shot `wsl.exe --exec` handle as
135
- the fallback when the agent is out). When the HOST has no git,
134
+ the fallback when the agent is out). A distro without rg or git does not
135
+ degrade into a silent fallback: the search handle translates the resident's
136
+ spawn failure into exit 127 with the bootstrap remedy, and a missing working
137
+ directory into rg's error code 2 (`1` means "no matches" and is never reused);
138
+ the snapshot handle uses the same 127 shape for a missing git and git's own
139
+ `fatal: cannot change to ...` (exit 128) for a missing directory, so a
140
+ snapshot cannot read as "no changes". `lib/search-exec.js` and
141
+ `lib/git-exec.js` own those translations. When the HOST has no git,
136
142
  `resolveExecutable` answers git with a distro sentinel path, and the snapshot
137
143
  command's discovery call (`rev-parse --show-toplevel ...`) routes too, its
138
144
  absolute-path output translated back into UNC form — so full WSL change review
@@ -386,6 +392,16 @@ The Windows copy at `default-workspace/dsh-plugin-wsl` is a runtime mirror.
386
392
  [`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
393
  step with the checkout, and `pnpm run sync:windows` runs that script.
388
394
 
395
+ The mirror carries no `node_modules` by design: the harness's linked-plugin
396
+ resolution projects the peers the manifest declares onto the installation's
397
+ single copies, so the mirror and the running app share one peer set. A separate
398
+ process (the doctor child, `DSH_WSL_DOCTOR`) has no such resolution, so the
399
+ in-app surfaces hand the peer versions this process resolved to the doctor.
400
+ That hand-off is authoritative even when only some peers resolved: a missing
401
+ peer is unchecked, not read back from a copy beside the plugin. A stale
402
+ `node_modules` above the mirror — the tree an earlier harness installation
403
+ leaves behind — neither feeds the runtime nor counts in the check.
404
+
389
405
  ## Test layers
390
406
 
391
407
  | 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
 
@@ -117,7 +116,13 @@ agent preset 在其隔离域中运行服务。preset registry 在自己的上下
117
116
  发行版内——文件搜索工具随包的 ripgrep 和 git 快照命令(两者都优先走已预热的
118
117
  常驻 agent——协议 v6 承载 git 调用的 stdin,而一次性调用要付出约 230 ms 的
119
118
  `wsl.exe` 启动开销,常驻 agent 只需约 2 ms——agent 不在时以一次性的
120
- `wsl.exe --exec` 句柄为回退)。宿主没有 git 时,`resolveExecutable` 对 git
119
+ `wsl.exe --exec` 句柄为回退)。没有 rg 或 git 的发行版不会退化为静默回退:
120
+ 搜索句柄把常驻 agent 的 spawn 失败翻译为退出码 127 并附 bootstrap 安装指引,
121
+ 工作目录缺失则翻译为 rg 的错误码 2(`1` 属于“无匹配”,不能占用);快照句柄
122
+ 对缺 git 用同一 127 形状,对缺失目录用 git 自身的
123
+ `fatal: cannot change to ...`(退出码 128)——不会让快照读成“无变更”。这两层
124
+ 翻译分别由 `lib/search-exec.js` 与 `lib/git-exec.js` 拥有。宿主没有 git 时,
125
+ `resolveExecutable` 对 git
121
126
  返回一个发行版哨兵路径,快照命令的发现调用(`rev-parse --show-toplevel ...`)
122
127
  也随之路由,其绝对路径输出再转换回 UNC 形式——因此没有 Windows git 也能完成
123
128
  完整的 WSL 变更审阅。两个 spawn 决策都是纯坐标函数(`lib/search-route.js`、
@@ -339,6 +344,14 @@ harness 无法从发行版内的检出目录加载插件。
339
344
  [`test/probe/sync-to-windows.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/sync-to-windows.sh)
340
345
  让它与检出目录保持一致,`pnpm run sync:windows` 运行该脚本。
341
346
 
347
+ 镜像按设计不带 `node_modules`:harness 的链接插件解析会把镜像清单里声明的
348
+ peer 投影到安装处的同一份副本,因此镜像与运行中的应用共享一套对等包。独立
349
+ 进程(doctor 子进程、`DSH_WSL_DOCTOR`)没有这层解析,所以应用内入口把本进程
350
+ 解析出的 peer 版本交给 doctor;这份交接即使只解析到部分 peer 也是权威的,
351
+ 缺失项记作 unchecked,不再回读插件目录旁的旧副本。镜像上方遗留的旧
352
+ `node_modules`——例如 harness 升级前留下的树——既不参与运行时解析,也不计入
353
+ 检查。
354
+
342
355
  ## 测试分层
343
356
 
344
357
  | 分层 | 位置 | 需要 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
 
@@ -395,7 +393,8 @@ verdict as an itemized listing — every check with an explicit status marker,
395
393
  grouped by distro, the copy-paste remedy under every failure — the user just
396
394
  asks for a diagnosis. The tool is interactive by design: `depth: "quick"` (the
397
395
  default) runs the prerequisites only (~10 s in one distro: host facts, the
398
- session sandbox quartet, bubblewrap — no smokes, no registry query, no port
396
+ session sandbox quartet, bubblewrap, and one combined optional-tool probe —
397
+ rg/git/inotifywait — no smokes, no registry query, no port
399
398
  survey) and is the right first call; `section` narrows a follow-up to one area
400
399
  (`host`, `sandbox`, `session`, `conf`, `net`, `agent`); `depth: "full"` is
401
400
  the complete scan and answers for everything. The `/wsl-doctor` command (the
@@ -426,10 +425,9 @@ language without re-probing. `--yes` skips the confirmation prompt (not the
426
425
  confirmation gate itself), and `--read-only` refuses to run together with
427
426
  `--fix` or `--install`.
428
427
  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.
428
+ error-code map. Whether a row override applied, read from the profile's
429
+ `cordis.patch.yml` and the Plugins page: the desktop app has no `dsh` command,
430
+ so the composed profile has no command-line view.
433
431
  The sidebar's **WSL environment** panel renders the same quick digest over
434
432
  `GET /api/wsl-env/status` and posts the full-run action to the same route: a
435
433
  doctor run with `--fix-owned`, which sweeps stale session scopes and purges a