dsh-plugin-wsl-env 0.22.0 → 0.23.0

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 (81) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/CONTRIBUTING.md +7 -3
  3. package/README.md +11 -9
  4. package/SUPPORT.md +1 -1
  5. package/cordis.patch.yml +4 -4
  6. package/docs/AGENT-PROTOCOL-V7.md +4 -4
  7. package/docs/API.md +12 -2
  8. package/docs/ARCHITECTURE.md +59 -19
  9. package/docs/CONFIGURATION.md +40 -18
  10. package/docs/CONFIGURATION.zh.md +44 -8
  11. package/docs/DIAGNOSTICS.md +19 -6
  12. package/docs/DIAGNOSTICS.zh.md +15 -6
  13. package/docs/LIMITATIONS.md +42 -17
  14. package/docs/LIMITATIONS.zh.md +47 -12
  15. package/docs/MIGRATION.md +1 -1
  16. package/docs/PEER-PARITY.md +8 -7
  17. package/docs/QUICKSTART.md +16 -8
  18. package/docs/QUICKSTART.zh.md +22 -4
  19. package/docs/README.zh.md +19 -10
  20. package/docs/RELEASING.md +8 -3
  21. package/docs/REQUIREMENTS.zh.md +11 -6
  22. package/docs/ROADMAP-1.0.md +12 -11
  23. package/docs/ROADMAP.md +10 -8
  24. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +3 -2
  25. package/docs/UPSTREAM-FSIO-EXPORT.md +8 -9
  26. package/docs/UPSTREAM-SERVICE-SWAP.md +9 -5
  27. package/docs/UPSTREAM-TERMINAL-TITLE.md +9 -8
  28. package/docs/VALUE.zh.md +5 -5
  29. package/docs/root-fs-routing.md +26 -19
  30. package/lib/agent-confined.d.ts +2 -2
  31. package/lib/agent-confined.js +0 -1
  32. package/lib/agent-exec.d.ts +2 -11
  33. package/lib/agent-protocol.d.ts +6 -5
  34. package/lib/agent.d.ts +5 -5
  35. package/lib/auto-preset.d.ts +4 -3
  36. package/lib/bwrap.d.ts +2 -1
  37. package/lib/client-host.d.ts +1 -1
  38. package/lib/client-host.js +1 -1
  39. package/lib/cwd-prompt-tool.d.ts +4 -20
  40. package/lib/cwd-prompt.d.ts +11 -10
  41. package/lib/distro-route.d.ts +3 -2
  42. package/lib/doctor-live.d.ts +2 -1
  43. package/lib/fs-routing.d.ts +29 -1
  44. package/lib/fs-routing.js +30 -3
  45. package/lib/fs-substrate.d.ts +0 -1
  46. package/lib/fs-substrate.js +0 -1
  47. package/lib/fsio-agent.d.ts +3 -21
  48. package/lib/fsio-agent.js +2 -4
  49. package/lib/git-exec.d.ts +3 -2
  50. package/lib/git-route.d.ts +4 -2
  51. package/lib/git-route.js +4 -2
  52. package/lib/index.d.ts +9 -10
  53. package/lib/index.js +124 -12
  54. package/lib/listing.d.ts +2 -1
  55. package/lib/messages.d.ts +1 -1
  56. package/lib/native-agent.d.ts +3 -2
  57. package/lib/paths.d.ts +2 -1
  58. package/lib/picker.d.ts +1 -14
  59. package/lib/picker.js +1 -2
  60. package/lib/preflight.d.ts +5 -4
  61. package/lib/probe-cache.d.ts +2 -1
  62. package/lib/sandbox-core.d.ts +2 -11
  63. package/lib/sandbox-core.js +1 -1
  64. package/lib/sandbox.d.ts +0 -1
  65. package/lib/sandbox.js +0 -4
  66. package/lib/search-exec.d.ts +2 -1
  67. package/lib/session-runtime.d.ts +3 -2
  68. package/lib/shell-env.d.ts +3 -2
  69. package/lib/shell.d.ts +1 -1
  70. package/lib/shell.js +1 -1
  71. package/lib/subprocess.d.ts +1 -1
  72. package/lib/update-check.d.ts +3 -3
  73. package/lib/wsl-doctor-command.d.ts +38 -10
  74. package/lib/wsl-doctor-command.js +168 -27
  75. package/lib/wsl-doctor-tool.d.ts +9 -16
  76. package/lib/wsl-doctor-tool.js +10 -4
  77. package/lib/wsl.d.ts +3 -2
  78. package/package.json +27 -33
  79. package/scripts/bootstrap-import.sh +189 -0
  80. package/scripts/open-wsl-vscode.ps1 +36 -0
  81. package/examples/preset-wsl-session-sandbox.cordis.patch.yml +0 -178
package/CHANGELOG.md CHANGED
@@ -14,6 +14,60 @@ document: the 0.1.0 entry's `design-history §` references are to
14
14
  keeps the superseded designs under the section numbers they had while they
15
15
  were part of the record.
16
16
 
17
+ ## [Unreleased]
18
+
19
+ ## [0.23.0] - 2026-11-10
20
+
21
+ One headline: the root filesystem answers host spelling where the Host's path
22
+ consumers read it, so "Open in app" and "Reveal in file manager" work on WSL
23
+ files again.
24
+
25
+ ### Fixed
26
+
27
+ - **"Open in app" and "Reveal in file manager" work on WSL files again
28
+ (issue #37).** The root router answered `processPath` for a distro target in
29
+ Linux form, while the Host's `verifyDesktopPath` requires
30
+ `processPath(resolve(processPathFromHostPath(hostPath))) === hostPath` and
31
+ `processPathFromHostPath` is the inherited host implementation — a Linux
32
+ answer can never reproduce a UNC host path. Every file gesture routed through
33
+ `session.openWorkspacePath` / `session.workspacePathApplications` (the
34
+ preview header's application menu, the file context menu's "Show in folder",
35
+ the deliverables open route) was refused with `Path has no verified Host
36
+ path`. The router now answers the target's canonical UNC — the same answer the
37
+ session `WslFileSystem` and the
38
+ shipped host backend give — and strips the share root's trailing separator so
39
+ a distro-root workspace closes too. `displayPath` stays Linux and `contains`
40
+ still compares POSIX coordinates. Known cost: the GUI change feed and
41
+ `stat.absolutePath` now carry the UNC spelling, and the client's
42
+ `fileMediaUrl` rejects a `\\`-prefixed path, so relative Markdown images in a
43
+ WSL preview no longer resolve (chat images already had that gap).
44
+
45
+ - **`/wsl-doctor` no longer spends minutes "executing" and then dies as an
46
+ opaque "operation was aborted".** The command resolved the session's distro
47
+ through its own app-level context, but the `workingDirectory` service lives in
48
+ the *agent's* scope, so the lookup missed: the handler fell back to the
49
+ shipped `auto` configuration, which probes **every** installed distro
50
+ (measured 234 s for the eight on this machine, against ~9 s scoped), and the
51
+ command dispatcher's deadline cut the run off with `This operation was
52
+ aborted` — naming neither the target nor a next step. The handler now reads
53
+ the live cwd from the agent-scoped service, falls back to the Session header's
54
+ `cwd`, and bounds the CLI subprocess — 120 s with a resolved distro, 60 s when
55
+ the configuration has to choose, both below the dispatcher's deadline — so a
56
+ stalled or unscoped run settles with a message naming the target it examined
57
+ and how to narrow it (`--distro <name>`, `quick`, or a section). Three concurrent `/wsl-doctor` sweeps had also saturated `wsl.exe`
58
+ enough that every new WSL agent handshake timed out at 15 s; the scoped run
59
+ removes that load.
60
+
61
+ - **The `wsl_doctor` tool no longer blocks the Host process while the doctor
62
+ runs.** `doctorReport()` collected the report with `spawnSync`, freezing the
63
+ Host's event loop for up to the two-minute deadline: the tool card sat
64
+ "executing", every other tool stalled behind it, and the call could not be
65
+ cancelled. The collector now spawns the CLI asynchronously, forwards the tool
66
+ call's abort signal (cancellation kills the child), enforces a deadline with
67
+ a bounded post-exit drain window so a grandchild holding the pipes cannot
68
+ stall it, and caps the captured output at 4 MiB. The rejection text now names
69
+ which of those ended the run.
70
+
17
71
  ## [0.22.0] - 2026-11-08
18
72
 
19
73
  One theme: the doctor's report becomes something a human can read and act on —
package/CONTRIBUTING.md CHANGED
@@ -147,7 +147,10 @@ Rules that keep this honest:
147
147
  `exports` (`./<name>/locale/en.json`, `./<name>/locale/zh.json`), which is
148
148
  what that page reads before falling back to the package `description`. The
149
149
  bundle's own pair is `locale/en.json` / `locale/zh.json`, and `subprocess`,
150
- `picker`, `shell-env` and `auto-preset` carry theirs; `files` already ships
150
+ `picker`, `shell-env` and `auto-preset` carry theirs. One runtime catalog
151
+ set is not an `exports` entry: `locale/doctor/*.json` localizes the
152
+ standalone CLI's fixed skeleton and is read from the package root by the
153
+ script itself. `files` already ships
151
154
  `locale/**/*.json`, and `lint:style` fails an `exports` target that does not
152
155
  exist.
153
156
 
@@ -183,7 +186,7 @@ terminal if you would rather not see the prompt.
183
186
 
184
187
  | Command | Covers | Needs a harness |
185
188
  |---|---|---|
186
- | `pnpm test` | style checks, relative links, syntax pass, build consistency, type check, and unit tests | no |
189
+ | `pnpm test` | style checks, relative links, requirement citations, doc consistency, syntax pass, build consistency, type check, and unit tests | no |
187
190
  | `pnpm run lint:links` | relative Markdown links in README, CONTRIBUTING, AGENTS and `docs/**` | no |
188
191
  | `pnpm run test:coverage` | unit tests with coverage, then the per-module gate: every `lib/*.js` measured or allowlisted, per-module floors 85/70/60 | no |
189
192
  | `pnpm run lint:style` | style and lint rules | no |
@@ -209,7 +212,8 @@ terminal if you would rather not see the prompt.
209
212
  | `pnpm run probe:sandbox-off` | the documented opt-out on both providers | yes |
210
213
 
211
214
  Every script above is wired in `package.json`. `pnpm test` runs `lint:style`,
212
- `lint:links`, `test:syntax`, `lint:build`, `lint:types` and `test:unit` in that order.
215
+ `lint:links`, `lint:requirements`, `lint:docs`, `test:syntax`, `lint:build`,
216
+ `lint:types` and `test:unit` in that order.
213
217
  `prepublishOnly` runs `pnpm test` again at publish time, so a broken gate stops a
214
218
  release before the upload.
215
219
 
package/README.md CHANGED
@@ -48,7 +48,7 @@ A Windows coding tool that works on WSL projects has three options: run the whol
48
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
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
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.
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. A doctor button in the composer runs the environment diagnosis as a `/wsl-doctor` command — host-side, no model turn — and the session-start preflight announces the environment verdict on every session.
52
52
 
53
53
  ### Why Linux, not PowerShell
54
54
 
@@ -78,7 +78,7 @@ A desktop remote reconnects faster and is more mature. A CLI agent installed ins
78
78
 
79
79
  - Windows 10 or 11 with WSL 2 and at least one distro.
80
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: false` on both `wsl-shell` and `wsl-fs`.
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
82
  - Optional: `ripgrep` for search, `git` for change snapshots, `inotify-tools` for file watching.
83
83
 
84
84
  No Node.js is required inside the distro.
@@ -115,9 +115,9 @@ Install `bubblewrap` before the first command:
115
115
  wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
116
116
  ```
117
117
 
118
- From a checkout, `pnpm run doctor` is the one-command environment check: Windows/WSL versions, the per-distro WSL mode, `.wslconfig` and `/etc/wsl.conf` cross-checks, the disk, clock and DNS, bubblewrap usability, systemd / the user manager / Linger, the optional tools, peer versions, the agent cache, a fresh-agent handshake, three smoke legs that prove the chain (frame I/O, the confined fence, the batched substrate), stale session scopes, the known profile-patch and deprecated-key traps, and whether a newer stable release exists on the registry. The run ends in a verdict — `ready` (the first command should succeed) or `blocked` (the named checks to fix) — computed under the effective configuration. Each failure prints one copy-paste remedy; `--json` is the machine contract, `--fix` re-verifies what it fixed (packages need `--fix --install` and an explicit confirmation), `--all` checks every installed distro, and `--bundle <path>` writes the diagnostic file a setup report attaches (`--redact` strips the paths). `pnpm run diagnose` is its read-only alias. `pnpm run bootstrap <distro>` remains the narrower tool-install helper.
118
+ From a checkout, `pnpm run doctor` is the one-command environment check: Windows/WSL versions, the per-distro WSL mode, `.wslconfig` and `/etc/wsl.conf` cross-checks, the disk, clock and DNS, bubblewrap usability, systemd / the user manager / Linger, the optional tools, peer versions, the agent cache, a fresh-agent handshake, three smoke legs that prove the chain (frame I/O, the confined fence, the batched substrate), stale session scopes, the known profile-patch and deprecated-key traps, and whether a newer stable release exists on the registry. 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` (the first command should succeed) 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 (packages need `--fix --install` and an explicit confirmation), `--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 (the composer button — 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.
119
119
 
120
- The plugin notices its own updates about once a day (first check a few 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, and `DSH_UPDATE_REGISTRIES` overrides which registries the doctor's on-demand check asks (comma-separated, or empty to skip it on an air-gapped machine). Upgrading stays manual, because the harness has no hot reload: install again (Plugins page, or the `add` command), then restart. Uninstall on
120
+ 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, and `DSH_UPDATE_REGISTRIES` overrides which registries the doctor's on-demand check asks (comma-separated, or empty to skip it on an air-gapped machine). Upgrading stays manual, because the harness has no hot reload: install again (Plugins page, or the `add` command), then restart. Uninstall on
121
121
  the Plugins page, or with `dsh plugin --profile wsl remove dsh-plugin-wsl-env`
122
122
  where the CLI is installed; the agent cache under `~/.cache/dsh-wsl` can then be
123
123
  deleted. If you added a local `workspace-files-wsl` workaround to your profile to
@@ -142,16 +142,18 @@ Settings live on named rows in `$DSH_HOME/profiles/<name>/cordis.patch.yml`. The
142
142
  |---|---|---|---|
143
143
  | `wsl-shell` | `distro` | `''` | distro mode; empty/`auto` follows the workspace, `default` forces WSL's default |
144
144
  | | `sandbox` | `true` | confine commands with `bubblewrap` |
145
- | | `sessionSandbox` | shipped `true` | run the session's commands in one systemd user scope |
145
+ | | `sessionSandbox` | `false`; shipped `true` | run the session's commands in one systemd user scope |
146
146
  | | `agentBackend` | `auto` | `auto`, `native` or `shell` for the in-distro agent |
147
147
  | | `maskWindowsDrive` | `false` | hide `/mnt` from confined commands |
148
148
  | `wsl-fs` | `distro` | `''` | distro mode; empty/`auto` follows each target path |
149
149
  | | `restrictToDistro` | `true` | under a fixed distro, refuse paths that belong to another distro |
150
150
  | | `sandbox` | `true` | check confined writes against the policy |
151
- | | `sessionSandbox` | shipped `true` | run confined writes in the session runtime |
151
+ | | `sessionSandbox` | `false`; shipped `true` | run confined writes in the session runtime |
152
152
  | | `substrate` | `agent` | in-distro agent; `share` is rejected at startup |
153
153
  | `directory-picker-wsl` | `includeHostHome` | `true` | also list the Windows home directory |
154
154
  | `subprocess-wsl` | `distro` | `''` | distro mode; empty/`auto` follows the launch directory |
155
+ | `wsl-preflight` | `distro` | `''` | distro the environment checks probe; empty/`auto` follows the session workspace |
156
+ | | `startup` | `true` | run the same checks once at plugin load, so the verdict is in the log before any session opens |
155
157
 
156
158
  `fs-routing` is the top-level router for root-level `ctx.fs` calls: its distro
157
159
  settings are independent of `wsl-fs`, and it is a top-level row patched by id
@@ -200,9 +202,9 @@ Enforcement is reported as `partial`. A command inside the distro can still star
200
202
  | Symptom | Fix |
201
203
  |---|---|
202
204
  | every command reports `SANDBOX_UNAVAILABLE` | install `bubblewrap` in the distro, or set `sandbox: false` |
203
- | the session refuses before the first command | run `pnpm run doctor`; enable systemd and linger, or set `sessionSandbox: false` on `wsl-shell` and `wsl-fs` |
205
+ | 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` |
204
206
  | `glob` and `grep` are slow in the distro | run `pnpm run bootstrap <distro>` and use its printed install command to install `ripgrep` |
205
- | `dsh plugin add` prints nothing | the plugin is already installed; this is success |
207
+ | `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 |
206
208
  | 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 |
207
209
  | changes under `lib/` have no effect | run `pnpm run sync:windows`, then restart the app |
208
210
 
@@ -213,7 +215,7 @@ More error codes and refusals are in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md
213
215
  ```bash
214
216
  pnpm install # development dependencies
215
217
  pnpm run build # compile src/ into lib/ (lib/ is committed)
216
- pnpm test # style, syntax, build consistency, types, unit tests
218
+ pnpm test # style, links, requirement citations, doc consistency, syntax, build consistency, types, unit tests
217
219
  pnpm run test:coverage # unit tests with coverage thresholds
218
220
  pnpm run sync:windows # update the Windows-side copy the app loads
219
221
  ```
package/SUPPORT.md CHANGED
@@ -5,7 +5,7 @@
5
5
  | Area | Supported |
6
6
  |---|---|
7
7
  | Operating system | Windows 10 and Windows 11 |
8
- | Linux side | WSL2 with at least one distro, and systemd as PID 1 with a lingering user manager (`loginctl enable-linger`) for the shipped session runtime. Set `sessionSandbox: false` on the preset's `wsl-shell` to keep the per-command sandbox instead |
8
+ | Linux side | WSL2 with at least one distro, and systemd as PID 1 with a lingering user manager (`loginctl enable-linger`) for the shipped session runtime. Set `sessionSandbox: false` on both `wsl-shell` and `wsl-fs` in the preset to keep the per-command sandbox instead |
9
9
  | DSH packages | `peerDependencies` declares a `0.2.2-rc.1` floor; newer versions require compatibility validation |
10
10
  | Plugin version | the latest published version only |
11
11
  | Node | 22.19+ (`^22.19.0`), or 24 and later (`>=24.0.0`) |
package/cordis.patch.yml CHANGED
@@ -267,9 +267,8 @@
267
267
  # `name`/`description` for the mode selector, `order: 2`.
268
268
  # Regenerate it when an app update changes the preset: take
269
269
  # `packages/bundle/web-app/presets/standard.patch.yml` from the harness tree
270
- # the peer pins track and run `node scripts/build-preset-wsl.mjs <that
271
- # file>`, then replace this row to the end of the file. The script applies
272
- # changes 1 and 2 itself, so only change 3 is yours.
270
+ # the peer pins track, replace this row to the end of the file with its
271
+ # content, then re-apply changes 1–3 by hand.
273
272
  # ═════════════════════════════════════════════════════════════════════════════
274
273
  - id: preset-wsl
275
274
  name: '@deepseek-ai/dsh-agent-preset'
@@ -301,7 +300,8 @@
301
300
  # session. This needs systemd as PID 1 (`[boot] systemd=true` in
302
301
  # /etc/wsl.conf) and a lingering user manager (`loginctl
303
302
  # enable-linger <user>`); the preflight refuses with those remedies
304
- # when one is missing. Set `sessionSandbox: false` for the old
303
+ # when one is missing. Set `sessionSandbox` to `auto` (falls back
304
+ # to the per-command shape without systemd) or `false` for the old
305
305
  # per-command shape. Bubblewrap is still required for the mount
306
306
  # profile; without it the providers fail closed.
307
307
  - id: wsl-shell
@@ -30,10 +30,10 @@ The version in HELLO is the AGENT's floor for the frames it accepts: a v7
30
30
  agent parses every v5/v6 frame forever. The HOST decides what it may send:
31
31
 
32
32
  - a host sends `FSB` / `FSERR`-expecting frames only against `HELLO ≥ 7`;
33
- - a v6 host (an older mirror) against a v7 agent sees `HELLO|…|6` never —
34
- wait, the agent reports its own version. The rule that matters: **the host
35
- gates new frames on `HELLO.version ≥ 7`, and the doctor's handshake reports
36
- the negotiated pair**. A half-synced mirror (agent 6, host 7) therefore
33
+ - a v6 host (an older mirror) against a v7 agent still reads `HELLO|…|7` — the
34
+ agent reports its own version — but the host's rule is what matters: **the
35
+ host gates new frames on `HELLO.version ≥ 7`**, and the doctor's handshake
36
+ reports the negotiated pair. A half-synced mirror (agent 6, host 7) therefore
37
37
  degrades to v6 behaviour instead of desyncing — the digest check still
38
38
  catches script drift, and version mismatch is the same recoverable state it
39
39
  is today (rebuild once, then one-shot fallback).
package/docs/API.md CHANGED
@@ -7,19 +7,29 @@ this page is the quick tour.
7
7
 
8
8
  | Subpath | Exports | Role |
9
9
  |---|---|---|
10
- | `.` | `WslShellExecutor` | the model-facing shell executor (`ctx.shell`) |
10
+ | `.` | — | the no-op root host half: a deliberate no-op plugin mounted at the bare package name, anchoring the browser client below (before 0.21.0 this resolved to the executor itself — see `./shell`) |
11
+ | `./shell` | `WslShellExecutor` | the model-facing shell executor (`ctx.shell`), mounted inside the WSL preset's isolate realm |
12
+ | `./client` | — (no importable surface) | the browser half the harness's web client loader serves for the bare-name row: the composer doctor button |
11
13
  | `./fs` | `WslFileSystem` | the filesystem provider over the distro (`ctx.fs`) |
12
14
  | `./index` | `WslShellExecutor`, `WslFileSystem`, `doctorReport`, `effectiveMaskWindowsDrive`, … | the composition root's full named surface — the integration API (`doctorReport` for tooling that wants the doctor's versioned report) |
13
15
  | `./fs-routing` | `WslRoutingFileSystem` | the root-plane coordinate router |
14
16
  | `./wsl` | `defaultShell`, `listDistros`, `shellArgs`, `wslTerminalArgv`, … | the `wsl.exe` interop primitives |
15
17
  | `./agent` | `WslAgent` | the resident-agent transport |
16
18
  | `./subprocess` | `WslSubprocessRuntime` | the terminal/subprocess runtime |
17
- | `./preflight` | the `wsl-preflight` row | session-start advisories |
19
+ | `./preflight` | the `wsl-preflight` row | session-start advisories (and once at plugin load with `startup: true`) |
20
+ | `./cwd-prompt` | the `wsl-cwd-prompt` row | rewrites the runtime context's working directory to the distro's POSIX form |
21
+ | `./cwd-prompt-tool` | the `wsl-cwd-prompt-tool` row | serves the model's read/`cd` tool with distro-POSIX `cwd` output |
22
+ | `./file-reference-wsl` | `traversalArgv`, `parseTraversalListing`, `FileReferenceTraversal`, … | the distro-side traversal strategy for `@` completion (pure library — built and tested, not yet wired to a row; see ARCHITECTURE) |
23
+ | `./wsl-doctor-tool` | the `wsl-doctor-tool` row | the `wsl_doctor` model tool: in-process diagnosis with scoping (`depth`, `section`) |
24
+ | `./wsl-doctor-command` | the `wsl-doctor-command` row | the `/wsl-doctor` UI command: spawns the standalone doctor CLI, renders detached from model history |
18
25
  | `./paths` | `uncToPosix`, `toLinuxPath`, `toWorldPath`, … | the coordinate mappers |
19
26
  | `./picker` | `WslDirectoryPicker` | the distro-aware directory picker |
20
27
  | `./auto-preset` | the `auto-preset` row | first-run profile bootstrap |
21
28
  | `./shell-env` | the `wsl-shell-env` row | the `DSH_WSL_*` facts registry |
22
29
  | `./update-check` | the `wsl-update-check` row | the once-a-day update notice (fact store + host-delegated check) |
23
30
 
31
+ The `./<name>/locale/*.json` subpaths carry the Plugins-page display metadata
32
+ and the runtime message catalogs; `./package.json` re-exports the manifest.
33
+
24
34
  Stability: tool names and error codes are API (docs/MIGRATION.md); the
25
35
  runtime rows' config keys are documented in docs/CONFIGURATION.md.
@@ -11,8 +11,9 @@ DSH exposes its capabilities as services. The model-facing tools (`bash`, `read`
11
11
  `write`, `edit`, `glob`, `grep`) consume those services. They never touch a
12
12
  filesystem or a shell directly.
13
13
 
14
- This plugin supplies WSL-backed implementations of three of them, takes over two
15
- root-plane services, and adds three smaller integrations.
14
+ This plugin supplies WSL-backed implementations of three of them, replaces three
15
+ app-level rows (`subprocess`, `fs-sandbox`, `directory-picker`), and adds the
16
+ smaller integrations listed below.
16
17
 
17
18
  ## The three service providers
18
19
 
@@ -28,9 +29,9 @@ overridden.
28
29
 
29
30
  ## The root-plane filesystem takeover
30
31
 
31
- One of the shipped services is session-less — the root `ctx.fs` — so it cannot
32
- be served from an agent preset. The layer replaces its shipped row outright with
33
- a subclass that routes by coordinate:
32
+ The root `ctx.fs` is session-less, so it cannot be served from an agent preset.
33
+ The layer replaces its shipped row outright with a subclass that routes by
34
+ coordinate:
34
35
 
35
36
  | Service | Class | File | What it does |
36
37
  |---|---|---|---|
@@ -60,13 +61,20 @@ into `cordis.patch.yml` — the seam it consumes is an upstream proposal
60
61
  reaching the funnels without it would mean subclassing past module-internal
61
62
  functions.
62
63
 
63
- ## The three smaller integrations
64
+ ## The smaller integrations
64
65
 
65
66
  | Subpath | Class or name | File | What it does |
66
67
  |---|---|---|---|
67
68
  | `dsh-plugin-wsl-env/picker` | `WslDirectoryPicker` | [`lib/picker.js`](../lib/picker.js) | Adds the installed distros to the folder picker, next to the Windows home directory, and lists distro levels from inside the distro (the resident's `find`, one-shot `wsl.exe` when it is out). |
68
69
  | `dsh-plugin-wsl-env/auto-preset` | `auto-preset` | [`lib/auto-preset.js`](../lib/auto-preset.js) | Binds the `wsl` agent preset when a new session's workspace is inside a distro. |
69
70
  | `dsh-plugin-wsl-env/shell-env` | `wsl-shell-env` | [`lib/shell-env.js`](../lib/shell-env.js) | Contributes `DSH_WSL_DISTRO`, `DSH_WSL_SHELL`, `DSH_WSL_HOME` and `DSH_WSL_PORTS` to the managed `DSH_*` namespace, choosing the session workspace's distro (default/pinned facts are probed at mount; other distros are warmed when their session appears). The port list is a snapshot per active distro, refreshed every `portsRefreshMs` (10000 by default), so a server started moments ago may not be listed yet. |
71
+ | `dsh-plugin-wsl-env/preflight` | `wsl-preflight` | [`lib/preflight.js`](../lib/preflight.js) | Runs the environment advisory at session start — and, with `startup: true` (the default), once at plugin load — surfacing the doctor-style verdict as a non-gating warning. |
72
+ | `dsh-plugin-wsl-env/update-check` | `wsl-update-check` | [`lib/update-check.js`](../lib/update-check.js) | Asks the app's plugin manager about a newer stable release about once a day and carries the fact in `DSH_WSL_PLUGIN_UPDATE`; never fetches on its own. |
73
+ | `dsh-plugin-wsl-env/cwd-prompt` | `wsl-cwd-prompt` | [`lib/cwd-prompt.js`](../lib/cwd-prompt.js) | Rewrites the runtime context's working-directory entry to the distro's POSIX form. |
74
+ | `dsh-plugin-wsl-env/cwd-prompt-tool` | `wsl-cwd-prompt-tool` | [`lib/cwd-prompt-tool.js`](../lib/cwd-prompt-tool.js) | Serves the model's read/`cd` tool with the same semantics the harness ships, rewriting the returned `cwd` to the distro's POSIX form. |
75
+ | `dsh-plugin-wsl-env/wsl-doctor-tool` | `wsl-doctor-tool` | [`lib/wsl-doctor-tool.js`](../lib/wsl-doctor-tool.js) | The `wsl_doctor` model tool: the doctor in-process (merging the live resident's state), scoped by `depth`/`section`, rendered as the itemized digest. |
76
+ | `dsh-plugin-wsl-env/wsl-doctor-command` | `wsl-doctor-command` | [`lib/wsl-doctor-command.js`](../lib/wsl-doctor-command.js) | The `/wsl-doctor` UI command: spawns the standalone doctor CLI as a host subprocess and renders the same digest detached from model history. |
77
+ | `dsh-plugin-wsl-env` (bare name) | `wsl-env-client-host` | [`lib/client-host.js`](../lib/client-host.js) | The deliberate no-op host half whose bare-name mount lets the web client roster serve the composer button (`./client`). |
70
78
 
71
79
  Three modules support them and import no DSH package.
72
80
  [`lib/paths.js`](../lib/paths.js) translates paths.
@@ -89,7 +97,8 @@ The environment is per session, not per process:
89
97
  | `subprocess-wsl` | at the app level, called the composition; the shipped `subprocess` row is disabled | because no session identity reaches the terminal controller, see below |
90
98
  | `workspace-files` | shipped, not replaced | its client half is the browser `file` resource provider the Sidebar previews need; it reads WSL paths through the routed root filesystem |
91
99
  | `fs-routing` | at the app level; the shipped `fs-sandbox` row is disabled | the root `ctx.fs` is session-less, and its write fence has no root-plane consumers |
92
- | `directory-picker-wsl`, `wsl-shell-env`, `auto-preset` | at the app level | they answer questions that are not scoped to a single preset; `shell-env` resolves its facts per session workspace |
100
+ | `directory-picker-wsl`, `wsl-shell-env`, `auto-preset`, `wsl-preflight`, `wsl-update-check`, `wsl-cwd-prompt`, `wsl-cwd-prompt-tool`, `wsl-doctor-command`, `wsl-env-client-host` | at the app level | they answer questions that are not scoped to a single preset; `shell-env` resolves its facts per session workspace, and the advisory/diagnosis rows must answer even when a session never opens |
101
+ | `wsl-doctor-tool` | inside `preset-wsl` (model-facing) | the tool surface follows the preset: a session on a Windows folder keeps the shipped tools |
93
102
 
94
103
  The preset mount requires the isolate realms. Without them the registry rejects the
95
104
  providers with `Preset services require isolate realms: shell, fs`.
@@ -162,8 +171,9 @@ profile carrying the value is refused at boot, and no file tool crosses the
162
171
  `realpath` and publication uses the kernel's rename or link.
163
172
  - **Guarded writes** carry their intent to the publication: a `createIfAbsent`
164
173
  publishes with a no-replace link, closing the check-then-write window for
165
- creates outright; an overwrite or edit carries its version into the write op
166
- and the agent re-verifies it before the rename. A mismatch returns
174
+ creates outright; an overwrite, edit, patch, delete or move carries its
175
+ expected version into the operation and the agent re-verifies it before the
176
+ rename or removal (`moveFile` checks both endpoints). A mismatch returns
167
177
  `FS_STALE_VERSION`, but a change after that check can still be overwritten.
168
178
  - **Kernel enforcement** is stage two: a mutation runs on a confined resident —
169
179
  one long-lived agent per (distro, policy), whose bwrap profile binds exactly
@@ -243,12 +253,14 @@ the row keys, and `lib/sandbox-core.js` states its honest ceiling.
243
253
  with one deliberate translation: for a session inside a distro the temp root is the
244
254
  distro's own `/tmp`, and the Windows temp directory is *not* granted, because it lies
245
255
  outside the execution world the policy describes. That avoids a mismatch where `bash`
246
- could write `/tmp` but the write tool could not. The two `/tmp`s are still different
247
- directories — the command's is a fresh tmpfs — see [LIMITATIONS.md](LIMITATIONS.md). The fence is complete for the model's reach: `writeText` and `editText` are
248
- the only mutation calls the model-facing file tools make on the filesystem seam,
249
- so checking those two checks everything the model can mutate. Both providers
250
- report their mode through `sandboxMode`. The tool layer and the Permissions
251
- selector read that value.
256
+ could write `/tmp` but the write tool could not. In the per-command profile
257
+ (`sessionSandbox: false`) the two `/tmp`s are different directories — the
258
+ command's is a fresh tmpfs; the shipped session runtime shares the distro's real
259
+ `/tmp` — see [LIMITATIONS.md](LIMITATIONS.md). The provider's mutation surface is
260
+ `writeText`, `editText`, `patchText`, `deleteFile` and `moveFile`; each runs
261
+ through `checkedTarget`, so the fence covers every mutation the provider can
262
+ serve. Both providers report their mode through `sandboxMode`. The tool layer
263
+ and the Permissions selector read that value.
252
264
 
253
265
  ### Reported enforcement
254
266
 
@@ -366,13 +378,14 @@ step with the checkout, and `pnpm run sync:windows` runs that script.
366
378
  | Type check | `tsc --noEmit` over `test/**` and `types/*.d.ts` (`src/` is checked by the build itself) | no |
367
379
  | Unit tests | `test/*.test.mjs` | no |
368
380
  | Requirements matrix | [`scripts/check-requirements.mjs`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/scripts/check-requirements.mjs) | no; every cited test must exist and stay wired |
381
+ | Doc consistency | [`scripts/check-doc-consistency.mjs`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/scripts/check-doc-consistency.mjs) | no; repeated facts, doctor surface and bilingual pair completeness |
369
382
  | Sandbox probe | [`test/probe/sandbox.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/sandbox.sh) | no; it applies the profile arguments directly |
370
383
  | Harness probes | [`test/probe/run.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/run.sh), `terminal.sh`, `sandbox-shell.sh`, `interop-shell.sh`, `picker.sh`, `fs-routing.sh`, `missing-wsl.sh`, `sandbox-off.sh`, `native-session.sh` | yes: Windows, WSL2, a mounted profile, and a linked checkout |
371
384
  | Distro probes | [`test/probe/substrate.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/substrate.sh), `watch.sh`, `agent.sh`, `exec.sh`, `session-sandbox.sh`, `gui-preview.sh`, `file-reference-9p.sh` | Windows and WSL2, but no harness boot and no profile: they run from a distro terminal with Node available, reaching `wsl.exe` through interop |
372
385
  | Host probe | [`test/probe/mode.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/mode.sh) | Windows Node, no harness |
373
386
  | Probe plugins | the `*-probe.mjs` and `*-probe.yml` files in `test/probe/` (plus standalone measurers such as `gui-preview.mjs`, `native-session.mjs`, `fs-probe.mjs`, `fs-queue.mjs`) | loaded or invoked by the scripts above |
374
387
 
375
- `pnpm test` runs `lint:style`, `lint:links`, `lint:requirements`,
388
+ `pnpm test` runs `lint:style`, `lint:links`, `lint:requirements`, `lint:docs`,
376
389
  `test:syntax`, `lint:build`, `lint:types` and `test:unit`, in that order.
377
390
  [`test/probe/run-all-when-closed.sh`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/test/probe/run-all-when-closed.sh)
378
391
  waits for the app to exit and then runs the whole real-machine suite once —
@@ -432,8 +445,16 @@ src/auto-preset.ts per-session environment selection
432
445
  src/bwrap.ts the bwrap command line every confinement site
433
446
  assembles (no imports, so a bare checkout can
434
447
  assert it)
448
+ src/client-host.ts the bare-name host half — a deliberate no-op that
449
+ anchors the browser client
450
+ src/cwd-prompt.ts rewrites the runtime context's working directory
451
+ to the distro's POSIX form
452
+ src/cwd-prompt-tool.ts serves the model's read/cd tool with distro-POSIX
453
+ cwd output
435
454
  src/distro-route.ts the pure distro-mode selector (pinned / workspace /
436
455
  default) shared by shell, fs, preflight and env
456
+ src/doctor-live.ts merges the live resident's status into a collected
457
+ doctor report
437
458
  src/file-reference-wsl.ts the distro-side `@`-completion traversal — built,
438
459
  tested, not yet wired (see above)
439
460
  src/fs.ts the ctx.fs subpath entry point
@@ -444,9 +465,12 @@ src/fs-substrate.ts the agent substrate's provider-shaped operations
444
465
  src/fsio-agent.ts fsio's mechanics over the agent's FS frames
445
466
  src/fsio-text.ts the peer's pure text mechanics, replicated pending
446
467
  the upstream fsio export (UPSTREAM-FSIO-EXPORT.md)
468
+ src/git-exec.ts the agent-backed execution handle for the
469
+ git-snapshot spawn
447
470
  src/git-route.ts which git spawns belong inside the distro (pure)
448
471
  src/index.ts WslShellExecutor (ctx.shell) and WslFileSystem (ctx.fs)
449
472
  src/listing.ts pure directory listing and breadcrumb helpers
473
+ src/messages.ts the en/zh message catalogs and the host-locale wiring
450
474
  src/native-agent.ts native binary selection and preparation
451
475
  src/paths.ts pure conversion between the three path formats
452
476
  src/picker.ts WslDirectoryPicker (ctx.directoryPicker)
@@ -468,7 +492,12 @@ src/subprocess.ts WslSubprocessRuntime (ctx.subprocess), the GUI
468
492
  src/terminal-activity.ts the distro-side activity probe for idle terminal
469
493
  reclamation
470
494
  src/terminal-route.ts which execution world a terminal launch belongs to (pure)
495
+ src/update-check.ts the once-a-day update notice (fact store +
496
+ host-delegated check)
471
497
  src/watcher.ts in-distro file watching for WslFileSystem.watch
498
+ src/wsl-doctor-command.ts the `/wsl-doctor` UI command row (spawns the
499
+ standalone doctor CLI)
500
+ src/wsl-doctor-tool.ts the `wsl_doctor` model tool row (in-process diagnosis)
472
501
  src/wsl.ts wsl.exe interop primitives (no DSH imports)
473
502
  ```
474
503
 
@@ -481,7 +510,8 @@ src/wsl.ts wsl.exe interop primitives (no DSH imports)
481
510
  names the documentation a reader would have acted on that is no longer true.
482
511
  - [`REQUIREMENTS.zh.md`](REQUIREMENTS.zh.md) is the requirements register: every
483
512
  documented behaviour commitment numbered, with where it is specified and what
484
- verifies it, plus the open items (Chinese, maintainer-facing, not packaged).
513
+ verifies it, plus the open items (Chinese, maintainer-facing, shipped in the
514
+ npm package).
485
515
  - [`archive/engineering-record.zh.md`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/docs/archive/engineering-record.zh.md) is the
486
516
  full engineering record, in Chinese: measured contracts, debugging rounds, and
487
517
  the conclusions as they stood then.
@@ -489,7 +519,9 @@ src/wsl.ts wsl.exe interop primitives (no DSH imports)
489
519
  [`archive/README.en.md`](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/docs/archive/README.en.md) are two English indexes of the
490
520
  same three archived files, the second so a reader who does not read Chinese can
491
521
  still tell what is there; the records themselves are Chinese.
492
- - [`README.md`](../README.md) is the only statement of current state.
522
+ - [`README.md`](../README.md) and [`docs/README.zh.md`](README.zh.md) are the
523
+ current-state statement; the Chinese README is authoritative and the English
524
+ file is its translation (see the documentation map).
493
525
 
494
526
  ## Diagnostics
495
527
 
@@ -498,4 +530,12 @@ point over everything above: it probes the Windows/WSL versions, the distro
498
530
  and its shell, bubblewrap, systemd/Linger, the peer floor, a fresh agent
499
531
  handshake and the stale session scopes, and reports the versioned
500
532
  `doctorReport` structure (`scripts/doctor.mjs`, `lib/doctor-live.js`) with a
501
- remedy per failure.
533
+ remedy per failure. The same report answers through three surfaces: this
534
+ standalone CLI (peer-free by design, so it starts when the plugin's own
535
+ runtime is broken), the `/wsl-doctor` UI command (spawns the CLI host-side,
536
+ renders detached from model history), and the `wsl_doctor` model tool
537
+ (in-process, merging the live resident's state through `lib/doctor-live.js`).
538
+ A run can be scoped (`--quick`, `--sections <csv>` on the CLI; `depth` /
539
+ `section` on the tool), and the report itemizes every check grouped by
540
+ distro. See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the surfaces and the
541
+ verdict contract.
@@ -1,6 +1,6 @@
1
1
  # Configuration
2
2
 
3
- *A Chinese translation lives at [CONFIGURATION.zh](CONFIGURATION.zh.md); the English version is authoritative.*
3
+ *The Chinese version ([CONFIGURATION.zh](CONFIGURATION.zh.md)) is authoritative; this page is its English translation.*
4
4
 
5
5
  ## Profile patches
6
6
 
@@ -11,9 +11,11 @@ rows and values shipped by this plugin.
11
11
 
12
12
  A profile layer can target a top-level row by `id`. Plugin rows at that level
13
13
  include `fs-routing`, `directory-picker-wsl`, `subprocess-wsl`, `wsl-shell-env`,
14
- `wsl-preflight`, `auto-preset`, and `preset-wsl`. The `wsl-shell` and `wsl-fs`
15
- rows are nested inside `preset-wsl.config.plugins`; a profile entry targeting
16
- either id directly is ignored with a `patch: entry <id> not found` warning.
14
+ `wsl-preflight`, `auto-preset`, `wsl-cwd-prompt`, `wsl-cwd-prompt-tool`,
15
+ `wsl-update-check`, `wsl-doctor-command`, `wsl-env-client-host`, and
16
+ `preset-wsl`. The `wsl-shell`, `wsl-fs` and `wsl-doctor-tool` rows are nested
17
+ inside `preset-wsl.config.plugins`; a profile entry targeting those ids directly
18
+ is ignored with a `patch: entry <id> not found` warning.
17
19
 
18
20
  A row's `config` is replaced as a whole. Include any non-default values from
19
21
  the bundled row that you want to retain. This matters most for `preset-wsl`,
@@ -138,6 +140,7 @@ The root router is app-level, not session-owned, so it does not use
138
140
  | | `startup` | `true` | Also run the same checks once at plugin load — install + restart — against the pinned or WSL-default distro, so the verdict is in the log before any session opens. |
139
141
  | `wsl-shell-env` | `distro` | `''` | Distro used to populate the `DSH_WSL_*` environment facts. |
140
142
  | | `portsRefreshMs` | `10000` | Listening-port snapshot interval, in milliseconds. |
143
+ | `wsl-cwd-prompt` | `enabled` | `true` (shipped) | Rewrite the runtime context's working-directory entry to the distro's POSIX form. |
141
144
  | `wsl-update-check` | `enabled` | `true` | Whether the plugin checks the app's plugin manager for a newer stable release. The result is served as `DSH_WSL_PLUGIN_UPDATE`; the check never installs. |
142
145
  | | `intervalMs` | `86400000` | Check interval, in milliseconds (first check 2–10 minutes after startup); floored at one minute. |
143
146
 
@@ -313,24 +316,36 @@ command errors) follow the harness app's Language setting: the preference is
313
316
  read from the host `locale` entry's `preference` field through the host
314
317
  settings service, and a language switch takes effect without a restart.
315
318
  Chinese (`zh`, including `zh-CN` and `zh-Hans` tags) and English ship; every
316
- other language — and any profile without the settings service, or an unset
317
- preference — renders English. Commands, config keys and file paths inside a
318
- message are never translated. Three message groups stay English by design:
319
- the `FS_*` refusal texts in `fs-decisions` and the fsio replica (the tool
320
- layer matches on those strings byte-for-byte), and the standalone
321
- `scripts/doctor.mjs`, which runs outside the app.
319
+ other language renders English. A profile without the settings service, or
320
+ one whose user never picked a language, falls back to the process's ICU
321
+ default locale — the OS UI language in the desktop app — so a zh-CN Windows
322
+ with a provisional-Chinese UI still renders Chinese; an explicit Settings
323
+ choice always wins over that fallback. Commands, config keys and file paths
324
+ inside a message are never translated. Two message groups stay English by
325
+ design: the `FS_*` refusal texts in `fs-decisions` and the fsio replica (the
326
+ tool layer matches on those strings byte-for-byte). The standalone
327
+ `scripts/doctor.mjs` carries its own catalogs: its fixed skeleton renders in
328
+ the host language — detected from the Windows locale, overridable with
329
+ `--locale <tag>` or `DSH_WSL_DOCTOR_LOCALE` — while per-check titles, details
330
+ and remedies stay English (remedies carry copy-paste commands), and `--json`
331
+ stays language-independent.
322
332
 
323
333
  ## Diagnose configuration and refusals
324
334
 
325
335
  In a session the model can run the diagnosis itself: the `wsl_doctor` tool
326
336
  (mounted inside `preset-wsl`) calls the doctor in-process and returns the
327
- verdict with per-section tallies and per-failure remedies — the user just
328
- asks for a diagnosis. The tool is interactive by design: `depth: "quick"`
329
- runs the prerequisites only (~10 s in one distro: host facts, the session
330
- sandbox quartet, bubblewrap — no smokes, no registry query, no port survey)
331
- and is the right first call; `section` narrows a follow-up to one area
337
+ verdict as an itemized listing — every check with an explicit status marker,
338
+ grouped by distro, the copy-paste remedy under every failure — the user just
339
+ asks for a diagnosis. The tool is interactive by design: `depth: "quick"` (the
340
+ default) runs the prerequisites only (~10 s in one distro: host facts, the
341
+ session sandbox quartet, bubblewrap — no smokes, no registry query, no port
342
+ survey) and is the right first call; `section` narrows a follow-up to one area
332
343
  (`host`, `sandbox`, `session`, `conf`, `net`, `agent`); `depth: "full"` is
333
- the complete scan and answers for everything. The CLI mirrors the same
344
+ the complete scan and answers for everything. The `/wsl-doctor` command (the
345
+ `wsl-doctor-command` row, registered when the deployment has a commands
346
+ registry) runs the same diagnosis host-side — grammar
347
+ `[quick|full|<section>] [--distro <name>]` — and renders the same digest in
348
+ the UI, detached from model history. The CLI mirrors the same
334
349
  scoping: `--quick` and `--sections <csv>` bound what a run probes, and a
335
350
  scoped `--json` report carries its `scope` so a verdict always names the
336
351
  scope it answers for (`--fix` still requires a full run).
@@ -344,8 +359,15 @@ the peer floor, a fresh agent handshake, stale session scopes, the known
344
359
  profile-patch and deprecated-key traps — each failure with a copyable remedy.
345
360
  The run ends in a verdict (`ready` or `blocked`) computed under the effective
346
361
  configuration: `--json` is the machine contract (schemaVersion 2), `--fix`
347
- re-verifies what it fixed, `--all` checks every installed distro, `--bundle
348
- <path>` writes the attachable diagnostic file (`--redact` strips the paths).
362
+ re-verifies what it fixed (packages need `--fix --install` and an explicit
363
+ confirmation), `--all` checks every installed distro, `--bundle
364
+ <path>` writes the attachable diagnostic file (`--redact` strips the paths),
365
+ and `--locale <tag>` (or `DSH_WSL_DOCTOR_LOCALE`) selects the skeleton
366
+ language without re-probing. `--yes` skips the confirmation prompt (not the
367
+ confirmation gate itself), and `--read-only` refuses to run together with
368
+ `--fix` or `--install`. `DSH_UPDATE_REGISTRIES` overrides the
369
+ registries the on-demand update check asks (comma-separated; empty skips
370
+ it — for air-gapped machines).
349
371
  See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the verdict contract and the
350
372
  error-code map. With the CLI distribution, `dsh --profile <name> --dump-config` inspects
351
373
  the composed profile without booting it and shows whether a row override