dsh-plugin-wsl-env 0.21.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.
- package/CHANGELOG.md +119 -0
- package/CONTRIBUTING.md +7 -3
- package/README.md +11 -9
- package/SUPPORT.md +1 -1
- package/client.js +153 -33
- package/cordis.patch.yml +13 -4
- package/docs/AGENT-PROTOCOL-V7.md +4 -4
- package/docs/API.md +12 -2
- package/docs/ARCHITECTURE.md +59 -19
- package/docs/CONFIGURATION.md +44 -13
- package/docs/CONFIGURATION.zh.md +44 -8
- package/docs/DIAGNOSTICS.md +41 -1
- package/docs/DIAGNOSTICS.zh.md +34 -2
- package/docs/LIMITATIONS.md +42 -17
- package/docs/LIMITATIONS.zh.md +47 -12
- package/docs/MIGRATION.md +1 -1
- package/docs/PEER-PARITY.md +8 -7
- package/docs/QUICKSTART.md +16 -8
- package/docs/QUICKSTART.zh.md +22 -4
- package/docs/README.zh.md +19 -10
- package/docs/RELEASING.md +8 -3
- package/docs/REQUIREMENTS.zh.md +11 -6
- package/docs/ROADMAP-1.0.md +12 -11
- package/docs/ROADMAP.md +10 -8
- package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +3 -2
- package/docs/UPSTREAM-FSIO-EXPORT.md +8 -9
- package/docs/UPSTREAM-SERVICE-SWAP.md +9 -5
- package/docs/UPSTREAM-TERMINAL-TITLE.md +9 -8
- package/docs/VALUE.zh.md +5 -5
- package/docs/root-fs-routing.md +26 -19
- package/lib/agent-confined.d.ts +2 -2
- package/lib/agent-confined.js +0 -1
- package/lib/agent-exec.d.ts +2 -11
- package/lib/agent-protocol.d.ts +6 -5
- package/lib/agent.d.ts +5 -5
- package/lib/auto-preset.d.ts +4 -3
- package/lib/bwrap.d.ts +2 -1
- package/lib/client-host.d.ts +1 -1
- package/lib/client-host.js +1 -1
- package/lib/cwd-prompt-tool.d.ts +4 -20
- package/lib/cwd-prompt.d.ts +11 -10
- package/lib/distro-route.d.ts +3 -2
- package/lib/doctor-live.d.ts +2 -1
- package/lib/fs-routing.d.ts +29 -1
- package/lib/fs-routing.js +30 -3
- package/lib/fs-substrate.d.ts +0 -1
- package/lib/fs-substrate.js +0 -1
- package/lib/fsio-agent.d.ts +3 -21
- package/lib/fsio-agent.js +2 -4
- package/lib/git-exec.d.ts +3 -2
- package/lib/git-route.d.ts +4 -2
- package/lib/git-route.js +4 -2
- package/lib/index.d.ts +20 -10
- package/lib/index.js +128 -12
- package/lib/listing.d.ts +2 -1
- package/lib/messages.d.ts +82 -1
- package/lib/messages.js +94 -1
- package/lib/native-agent.d.ts +3 -2
- package/lib/paths.d.ts +2 -1
- package/lib/picker.d.ts +1 -14
- package/lib/picker.js +1 -2
- package/lib/preflight.d.ts +5 -4
- package/lib/probe-cache.d.ts +2 -1
- package/lib/sandbox-core.d.ts +2 -11
- package/lib/sandbox-core.js +1 -1
- package/lib/sandbox.d.ts +0 -1
- package/lib/sandbox.js +0 -4
- package/lib/search-exec.d.ts +2 -1
- package/lib/session-runtime.d.ts +3 -2
- package/lib/shell-env.d.ts +3 -2
- package/lib/shell.d.ts +1 -1
- package/lib/shell.js +1 -1
- package/lib/subprocess.d.ts +1 -1
- package/lib/update-check.d.ts +3 -3
- package/lib/wsl-doctor-command.d.ts +133 -0
- package/lib/wsl-doctor-command.js +381 -0
- package/lib/wsl-doctor-tool.d.ts +101 -16
- package/lib/wsl-doctor-tool.js +290 -22
- package/lib/wsl.d.ts +3 -2
- package/locale/doctor/en.json +30 -0
- package/locale/doctor/zh.json +30 -0
- package/package.json +29 -31
- package/scripts/bootstrap-import.sh +189 -0
- package/scripts/doctor.mjs +569 -141
- package/scripts/open-wsl-vscode.ps1 +36 -0
- package/examples/preset-wsl-session-sandbox.cordis.patch.yml +0 -178
package/CHANGELOG.md
CHANGED
|
@@ -16,6 +16,125 @@ were part of the record.
|
|
|
16
16
|
|
|
17
17
|
## [Unreleased]
|
|
18
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
|
+
|
|
71
|
+
## [0.22.0] - 2026-11-08
|
|
72
|
+
|
|
73
|
+
One theme: the doctor's report becomes something a human can read and act on —
|
|
74
|
+
every check itemized with an explicit status marker, the run reachable as a
|
|
75
|
+
global `/wsl-doctor` command that renders outside model history, and the fixed
|
|
76
|
+
skeleton localized to the host language.
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
|
|
80
|
+
- **The `wsl_doctor` tool is interactive: quick first, sections for
|
|
81
|
+
follow-ups, per-section tallies in every answer.** The old shape was one
|
|
82
|
+
blocking call (100 s+ across every distro) that returned a bare verdict
|
|
83
|
+
plus the fail list — the conversation hung and the result said nothing
|
|
84
|
+
about what had been tested. The tool now takes `depth: "quick"` (the
|
|
85
|
+
prerequisites: host facts, the session quartet, bubblewrap — ~10 s in one
|
|
86
|
+
distro, no smokes, no registry, no port survey) and `section` (one of
|
|
87
|
+
host/sandbox/session/conf/net/agent) for focused follow-ups; `depth:
|
|
88
|
+
"full"` stays the complete scan. Every digest carries per-section tallies
|
|
89
|
+
(ok/warn/fail/unknown), so the passed checks are visible instead of
|
|
90
|
+
silent. The CLI mirrors the scoping (`--quick`, `--sections <csv>`, a
|
|
91
|
+
`scope` block in the scoped `--json` report; `--fix` still requires a full
|
|
92
|
+
run). One tool, multiple calls — the progress story is the call sequence,
|
|
93
|
+
because the tool pipeline has no mid-execution event channel (verified
|
|
94
|
+
end-to-end: `dsh-tools` contract, `dsh-session` event map, and the
|
|
95
|
+
conversation UI's surface projection all lack one; to be proposed
|
|
96
|
+
upstream).
|
|
97
|
+
|
|
98
|
+
- **The doctor's report itemizes every check, and `/wsl-doctor` runs it
|
|
99
|
+
detached from model history.** A scoped run used to say nothing about the
|
|
100
|
+
checks its profile never executed, and a multi-distro report flattened into
|
|
101
|
+
one undifferentiated block. `digestReport` now carries per-distro tallies
|
|
102
|
+
(first-appearance order, the session's distro flagged) and an itemized
|
|
103
|
+
listing — every check with an explicit `[OK]`/`[WARN]`/`[FAIL]`/`[INFO]`/
|
|
104
|
+
`[SKIP]`/`[??]` marker, its title and what it found, the copy-paste remedy
|
|
105
|
+
under every failure; scoped runs surface untouched checks as `[SKIP]` rows
|
|
106
|
+
driven by a check catalog. The `wsl_doctor` tool's structured result field
|
|
107
|
+
is `report` now, and `depth` defaults to `quick`. The new `/wsl-doctor`
|
|
108
|
+
command registers globally and spawns the standalone doctor CLI as a host
|
|
109
|
+
subprocess: the report renders without consuming tokens, and the diagnosis
|
|
110
|
+
still answers when the plugin's own runtime is what is broken. The composer
|
|
111
|
+
button becomes a mode menu (quick/full + the six sections); deployments
|
|
112
|
+
without a command adapter keep the CLI.
|
|
113
|
+
|
|
114
|
+
- **The doctor's fixed skeleton localizes.** Check catalogs live in
|
|
115
|
+
`locale/doctor/{en,zh}.json`; a `--locale` flag and `DSH_WSL_DOCTOR_LOCALE`
|
|
116
|
+
override exist, and the Windows locale is detected through `reg query`
|
|
117
|
+
(no PowerShell startup). `--json` stays language-independent.
|
|
118
|
+
`installMessagesLocale` falls back to the OS ICU locale when no Settings
|
|
119
|
+
preference was stored, so a provisional-Chinese UI renders Chinese; an
|
|
120
|
+
explicit Settings choice always wins.
|
|
121
|
+
|
|
122
|
+
### Fixed
|
|
123
|
+
|
|
124
|
+
- **A transport flake no longer reports a config verdict.** Under the
|
|
125
|
+
doctor's concurrent probing of several distros on one VM, `wsl.exe` calls
|
|
126
|
+
can time out (`Wsl/Service/WSAETIMEDOUT`) or answer from a cold,
|
|
127
|
+
mid-boot distro — and those reads were reported as authoritative `fail`s:
|
|
128
|
+
a static `/etc/wsl.conf` read broken one run and fine the next. Every
|
|
129
|
+
in-distro probe now retries once after a settle delay when a capture smells
|
|
130
|
+
like a flake (execFile deadline, or WSL's own wedged-service error text);
|
|
131
|
+
a flake that survives the retry reports the new `unknown` status — it
|
|
132
|
+
names the flake in its detail, never blocks, and never feeds a config
|
|
133
|
+
verdict. The smoke sessions (EXEC/FSB, the confined fence) retry once on
|
|
134
|
+
failure too, so the most alarming row in the report cannot rest on one
|
|
135
|
+
wedged transport. A one-shot flake recovers invisibly; a persistent one
|
|
136
|
+
earns a rerun remedy, not a false remedy for a healthy machine.
|
|
137
|
+
|
|
19
138
|
## [0.21.0] - 2026-11-08
|
|
20
139
|
|
|
21
140
|
One theme: the doctor and the preflight reach the GUI — the readiness probes
|
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
|
|
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`, `
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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/client.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The doctor's GUI button: a pill in the conversation composer dock that
|
|
3
|
-
*
|
|
2
|
+
* The doctor's GUI button: a pill in the conversation composer dock that opens
|
|
3
|
+
* a small menu of wsl_doctor run modes — two depths (quick, full) and the
|
|
4
|
+
* six single-section scopes. Picking an entry drops the matching `/wsl-doctor`
|
|
5
|
+
* command into the current session's input and submits it; the commands
|
|
6
|
+
* registry executes it host-side and the report renders in the UI without a
|
|
7
|
+
* model turn.
|
|
4
8
|
*
|
|
5
9
|
* The composer dock's slot components receive the harness's standard props —
|
|
6
10
|
* `inputActions` among them. Sending is `setDraft(text)` (replace the whole
|
|
7
11
|
* draft with plain text) followed by `submit()` (send the current draft — the
|
|
8
12
|
* published face has no submit-with-text verb). When those verbs are missing
|
|
9
|
-
* the
|
|
13
|
+
* the menu degrades to a draft prefill, never to a broken control.
|
|
10
14
|
*
|
|
11
15
|
* Loaded by the harness's web client loader through the `dsh.client`
|
|
12
16
|
* declaration in package.json; the composition's bare-name row
|
|
@@ -18,13 +22,54 @@ window.__ModuleLoader__.load({
|
|
|
18
22
|
factory(require) {
|
|
19
23
|
const React = require("react");
|
|
20
24
|
const h = React.createElement;
|
|
25
|
+
const useEffect = React.useEffect;
|
|
26
|
+
const useState = React.useState;
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
// The command plane, not the model: each entry drops a `/wsl-doctor` line.
|
|
29
|
+
// Slash commands execute in the UI command plane against the commands
|
|
30
|
+
// registry (`dsh-commands` contract) — the handler spawns the standalone
|
|
31
|
+
// doctor CLI and the settled report renders detached from model history,
|
|
32
|
+
// adding no tokens. A deployment without the command adapter rejects the
|
|
33
|
+
// line at the composer instead of sending a prompt.
|
|
34
|
+
const commandFor = (mode) => {
|
|
35
|
+
if (mode.kind === "quick") return "/wsl-doctor quick";
|
|
36
|
+
if (mode.kind === "full") return "/wsl-doctor full";
|
|
37
|
+
return "/wsl-doctor " + mode.section;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Menu layout: two depth entries, then the section scopes the wsl_doctor
|
|
41
|
+
// tool accepts. Labels mirror the tool's own depth/section vocabulary.
|
|
42
|
+
const MENU = [
|
|
43
|
+
{ header: "诊断深度" },
|
|
44
|
+
{ label: "快速诊断(推荐)", hint: "仅前置项,约 10 秒", mode: { kind: "quick" } },
|
|
45
|
+
{ label: "完整诊断", hint: "全部检查项含 agent 冒烟", mode: { kind: "full" } },
|
|
46
|
+
{ header: "分区诊断" },
|
|
47
|
+
{ label: "host", mode: { kind: "section", section: "host" } },
|
|
48
|
+
{ label: "sandbox", mode: { kind: "section", section: "sandbox" } },
|
|
49
|
+
{ label: "session", mode: { kind: "section", section: "session" } },
|
|
50
|
+
{ label: "conf", mode: { kind: "section", section: "conf" } },
|
|
51
|
+
{ label: "net", mode: { kind: "section", section: "net" } },
|
|
52
|
+
{ label: "agent", mode: { kind: "section", section: "agent" } },
|
|
53
|
+
];
|
|
25
54
|
|
|
26
55
|
function DoctorButton(props) {
|
|
27
|
-
const
|
|
56
|
+
const [open, setOpen] = useState(false);
|
|
57
|
+
const [root, setRoot] = useState(null);
|
|
58
|
+
|
|
59
|
+
// Close on any outside click; the root node ref keeps the listener's
|
|
60
|
+
// contains() check exact without querying the DOM.
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!open || !root) return undefined;
|
|
63
|
+
const close = (event) => {
|
|
64
|
+
if (root && !root.contains(event.target)) setOpen(false);
|
|
65
|
+
};
|
|
66
|
+
document.addEventListener("mousedown", close);
|
|
67
|
+
return () => document.removeEventListener("mousedown", close);
|
|
68
|
+
}, [open, root]);
|
|
69
|
+
|
|
70
|
+
const send = (mode) => {
|
|
71
|
+
setOpen(false);
|
|
72
|
+
const command = commandFor(mode);
|
|
28
73
|
const actions = props && props.inputActions;
|
|
29
74
|
// The published InputActions face has no submit(text): submit() sends
|
|
30
75
|
// the CURRENT draft, and insertText needs a captureInsertion() span.
|
|
@@ -32,7 +77,7 @@ window.__ModuleLoader__.load({
|
|
|
32
77
|
// sends it — one click, no span bookkeeping.
|
|
33
78
|
if (actions && typeof actions.setDraft === "function" && typeof actions.submit === "function") {
|
|
34
79
|
try {
|
|
35
|
-
actions.setDraft(
|
|
80
|
+
actions.setDraft(command);
|
|
36
81
|
actions.submit();
|
|
37
82
|
return;
|
|
38
83
|
} catch (error) {
|
|
@@ -42,40 +87,115 @@ window.__ModuleLoader__.load({
|
|
|
42
87
|
}
|
|
43
88
|
if (actions && typeof actions.setDraft === "function") {
|
|
44
89
|
try {
|
|
45
|
-
actions.setDraft(
|
|
90
|
+
actions.setDraft(command);
|
|
46
91
|
return;
|
|
47
92
|
} catch (error) {
|
|
48
93
|
// Ignored: the draft stays untouched rather than half-filled.
|
|
49
94
|
}
|
|
50
95
|
}
|
|
51
96
|
};
|
|
97
|
+
|
|
98
|
+
const menu = open
|
|
99
|
+
? h(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
// Anchored above the pill; the dock sits at the composer's
|
|
103
|
+
// bottom edge, so the menu opens upward.
|
|
104
|
+
style: {
|
|
105
|
+
position: "absolute",
|
|
106
|
+
bottom: "calc(100% + 6px)",
|
|
107
|
+
right: 0,
|
|
108
|
+
minWidth: 220,
|
|
109
|
+
padding: "4px 0",
|
|
110
|
+
borderRadius: 8,
|
|
111
|
+
background: "var(--dsh-bg, #1f1f1f)",
|
|
112
|
+
color: "inherit",
|
|
113
|
+
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.35)",
|
|
114
|
+
border: "1px solid rgba(128, 128, 128, 0.35)",
|
|
115
|
+
zIndex: 50,
|
|
116
|
+
fontSize: 12,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
MENU.map((entry, index) => {
|
|
120
|
+
if (entry.header) {
|
|
121
|
+
return h(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
key: "header-" + entry.header,
|
|
125
|
+
style: {
|
|
126
|
+
padding: "5px 12px 3px",
|
|
127
|
+
opacity: 0.55,
|
|
128
|
+
fontSize: 11,
|
|
129
|
+
userSelect: "none",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
entry.header
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
return h(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
key: "item-" + String(index),
|
|
139
|
+
onClick: () => send(entry.mode),
|
|
140
|
+
style: {
|
|
141
|
+
display: "flex",
|
|
142
|
+
justifyContent: "space-between",
|
|
143
|
+
gap: 10,
|
|
144
|
+
padding: "6px 12px",
|
|
145
|
+
cursor: "pointer",
|
|
146
|
+
whiteSpace: "nowrap",
|
|
147
|
+
},
|
|
148
|
+
onMouseEnter: (event) => {
|
|
149
|
+
event.currentTarget.style.background = "rgba(128, 128, 128, 0.2)";
|
|
150
|
+
},
|
|
151
|
+
onMouseLeave: (event) => {
|
|
152
|
+
event.currentTarget.style.background = "transparent";
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
h("span", null, entry.label),
|
|
156
|
+
entry.hint
|
|
157
|
+
? h("span", { style: { opacity: 0.55, fontSize: 11 } }, entry.hint)
|
|
158
|
+
: null
|
|
159
|
+
);
|
|
160
|
+
})
|
|
161
|
+
)
|
|
162
|
+
: null;
|
|
163
|
+
|
|
52
164
|
return h(
|
|
53
|
-
"
|
|
165
|
+
"div",
|
|
54
166
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
alignItems: "center",
|
|
61
|
-
gap: 5,
|
|
62
|
-
// The dock is a centered flex row; an auto left margin overrides
|
|
63
|
-
// the group centering for this item alone and pins the pill to
|
|
64
|
-
// the dock's right edge.
|
|
65
|
-
marginLeft: "auto",
|
|
66
|
-
padding: "2px 10px",
|
|
67
|
-
borderRadius: 999,
|
|
68
|
-
fontSize: 12,
|
|
69
|
-
border: "none",
|
|
70
|
-
outline: "none",
|
|
71
|
-
background: "transparent",
|
|
72
|
-
color: "inherit",
|
|
73
|
-
opacity: 0.75,
|
|
74
|
-
cursor: "pointer",
|
|
75
|
-
userSelect: "none",
|
|
76
|
-
},
|
|
167
|
+
ref: setRoot,
|
|
168
|
+
// The dock is a centered flex row; an auto left margin overrides the
|
|
169
|
+
// group centering for this item alone and pins the pill to the
|
|
170
|
+
// dock's right edge.
|
|
171
|
+
style: { position: "relative", marginLeft: "auto" },
|
|
77
172
|
},
|
|
78
|
-
|
|
173
|
+
menu,
|
|
174
|
+
h(
|
|
175
|
+
"button",
|
|
176
|
+
{
|
|
177
|
+
type: "button",
|
|
178
|
+
onClick: () => setOpen(!open),
|
|
179
|
+
title: "运行 WSL 环境诊断(doctor):选择诊断模式",
|
|
180
|
+
style: {
|
|
181
|
+
display: "flex",
|
|
182
|
+
alignItems: "center",
|
|
183
|
+
gap: 5,
|
|
184
|
+
padding: "2px 10px",
|
|
185
|
+
borderRadius: 999,
|
|
186
|
+
fontSize: 12,
|
|
187
|
+
border: "none",
|
|
188
|
+
outline: "none",
|
|
189
|
+
background: "transparent",
|
|
190
|
+
color: "inherit",
|
|
191
|
+
opacity: 0.75,
|
|
192
|
+
cursor: "pointer",
|
|
193
|
+
userSelect: "none",
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
"WSL 诊断",
|
|
197
|
+
h("span", { style: { fontSize: 9, opacity: 0.8 } }, open ? "▲" : "▼")
|
|
198
|
+
)
|
|
79
199
|
);
|
|
80
200
|
}
|
|
81
201
|
|
package/cordis.patch.yml
CHANGED
|
@@ -163,6 +163,15 @@
|
|
|
163
163
|
- id: wsl-env-client-host
|
|
164
164
|
name: 'dsh-plugin-wsl-env'
|
|
165
165
|
|
|
166
|
+
# The human-facing `/wsl-doctor` command (the composer button's target):
|
|
167
|
+
# registered globally so any session can run the diagnosis, not only WSL
|
|
168
|
+
# preset agents. The handler spawns the standalone doctor CLI — no model
|
|
169
|
+
# turn, no in-process collector — so the command still answers when the
|
|
170
|
+
# plugin's own runtime is the thing being diagnosed. Deployments without a
|
|
171
|
+
# command adapter leave this row a no-op.
|
|
172
|
+
- id: wsl-doctor-command
|
|
173
|
+
name: 'dsh-plugin-wsl-env/wsl-doctor-command'
|
|
174
|
+
|
|
166
175
|
- id: fs-routing
|
|
167
176
|
name: 'dsh-plugin-wsl-env/fs-routing'
|
|
168
177
|
config:
|
|
@@ -258,9 +267,8 @@
|
|
|
258
267
|
# `name`/`description` for the mode selector, `order: 2`.
|
|
259
268
|
# Regenerate it when an app update changes the preset: take
|
|
260
269
|
# `packages/bundle/web-app/presets/standard.patch.yml` from the harness tree
|
|
261
|
-
# the peer pins track
|
|
262
|
-
#
|
|
263
|
-
# 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.
|
|
264
272
|
# ═════════════════════════════════════════════════════════════════════════════
|
|
265
273
|
- id: preset-wsl
|
|
266
274
|
name: '@deepseek-ai/dsh-agent-preset'
|
|
@@ -292,7 +300,8 @@
|
|
|
292
300
|
# session. This needs systemd as PID 1 (`[boot] systemd=true` in
|
|
293
301
|
# /etc/wsl.conf) and a lingering user manager (`loginctl
|
|
294
302
|
# enable-linger <user>`); the preflight refuses with those remedies
|
|
295
|
-
# when one is missing. Set `sessionSandbox
|
|
303
|
+
# when one is missing. Set `sessionSandbox` to `auto` (falls back
|
|
304
|
+
# to the per-command shape without systemd) or `false` for the old
|
|
296
305
|
# per-command shape. Bubblewrap is still required for the mount
|
|
297
306
|
# profile; without it the providers fail closed.
|
|
298
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
|
|
34
|
-
|
|
35
|
-
gates new frames on `HELLO.version ≥ 7
|
|
36
|
-
the negotiated pair
|
|
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
|
-
| `.` |
|
|
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.
|