dsh-plugin-wsl-env 0.23.1 → 0.24.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 CHANGED
@@ -16,6 +16,166 @@ were part of the record.
16
16
 
17
17
  ## [Unreleased]
18
18
 
19
+ ## [0.24.0] - 2026-11-10
20
+
21
+ One theme: the diagnosis becomes something to act on — a sidebar panel
22
+ that checks a distro and repairs the plugin-owned state — while the
23
+ doctor's catalog is triaged and answers the effective configuration.
24
+
25
+ ### Added
26
+
27
+ - **A diagnostic status panel with a safe repair action, and a real choice when
28
+ a WSL workspace is added.** The navigation column now carries **WSL
29
+ environment**: the installed distros with an on-demand quick doctor check per
30
+ distro (bwrap, systemd, Linger and the other prerequisites, through the same
31
+ standalone CLI as `/wsl-doctor`). A checked row also offers a full run, labeled
32
+ **修复** when a finding is repairable and **完整检查** otherwise: a `POST` to
33
+ the same authenticated route runs the doctor with `--fix-owned`, sweeps stale
34
+ session scopes and purges a broken agent cache, then re-verifies both and
35
+ answers with the before → after `fix.*` rows. The result names what was
36
+ fixed, what failed re-verification, and what remains manual, so the button
37
+ never promises a fix it cannot apply. Each checked row carries its last check
38
+ time (date and time, with a relative hint), its source (manual or the page-load
39
+ background refresh), and a result structure — per-status totals and
40
+ per-section tallies — so the next action is visible at a glance. The last
41
+ result per distro is persisted under
42
+ `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json` (falling back to `~/.dsh`),
43
+ so a page reload or an app restart still shows it; on load, stored results
44
+ for running distros are re-checked in the background, and a failed
45
+ background run overwrites the stored result exactly as observed. Results are
46
+ never labeled expired. The panel opens no workspace, runs no session, and never installs packages or
47
+ rewrites Windows-owned configuration; a click is the only thing that boots a
48
+ stopped distro. Adding a workspace through the picker now asks once how a
49
+ distro folder is opened — **Remote WSL** (the default) or **Windows access**
50
+ (the folder as a 9p share under the host environment). The choice is
51
+ persisted in the `auto-preset` row's `windowsWorkspaces` volatile field, which
52
+ the auto-preset hook reads so later sessions in that workspace keep the host
53
+ preset; the prompt switches the workspace's blank session before its first
54
+ turn.
55
+
56
+ - **A checked distro row expands to every check the run executed.** The row
57
+ already showed the failures, the warnings and the per-section tallies; a green
58
+ verdict was still an assertion the user had to trust. **查看检查详情(N 项)**
59
+ now opens the full list, grouped by the doctor's sections (host / sandbox /
60
+ session / conf / net / agent), each row with its status mark, id, evidence and
61
+ (for a non-ok row) its remedy. The catalog rows a quick run never touches are
62
+ counted in one line — "the full run covers N more" — instead of being listed
63
+ as fake results, and the list is part of the persisted view, so a reload keeps
64
+ it. The detail is also carried for `error` rows (empty) and for older stored
65
+ views (defaulted), so a stale cache cannot break the panel.
66
+
67
+ - **`--fix` repairs the agent cache too, and `--fix-owned` scopes a run to
68
+ plugin-owned state.** A non-executable (or non-runnable) entry under
69
+ `~/.cache/dsh-wsl/agent` is purged and re-inventoried, and a failed handshake
70
+ is re-probed after the purge. `--fix-owned` narrows the fix loop to the stale-scope sweep and the
71
+ cache purge (it implies `--fix`, skips the package install and the Windows
72
+ git whitelist, and refuses `--install`); the sidebar's repair action uses it.
73
+
74
+ - **Four checks for failure modes the catalog missed.**
75
+ `functional.native` execs the cached native binary and verifies its HELLO
76
+ self-digest against the content-addressed cache directory (`skipped` on a
77
+ fresh machine, `fail` under `agentBackend: native`, `warn` under `auto`);
78
+ `agent.home-writable` creates and executes a temp file under `$HOME` to catch
79
+ a read-only home or a `noexec` mount before the native cache is extracted;
80
+ `host.disk` reads the Windows volume that holds the VHDX (fail < 2 GiB,
81
+ warn < 5 GiB), which `distro.disk` cannot see; `distro.unc` proves Windows can
82
+ read `\\wsl.localhost\<distro>`, the path the GUI file service, picker and
83
+ open-in-app use. `distro.wsl-conf-interop` also probes the WSLInterop binfmt
84
+ handler when interop is **enabled**, so a stale boot that breaks `git.exe` /
85
+ `explorer.exe` is named instead of surfacing as command-not-found.
86
+
87
+ - **The folder picker starts at a category level, not inside one home directory.**
88
+ It now opens on
89
+ a category level with **Windows 路径** and **WSL 发行版**; the Windows branch
90
+ starts at the drive roots (`C:\`, `D:\`, …) instead of at one account's home
91
+ directory, and the WSL branch lists the installed distros. Every level keeps
92
+ a **工作区** crumb, so either world is one click away. `includeHostHome` now
93
+ gates the Windows branch as a whole.
94
+
95
+ ### Changed
96
+
97
+ - **The doctor's check catalog was triaged row by row.** The merged rows carry
98
+ their facts together instead of in info-only satellites:
99
+ `host.platform` replaces `host.windows` + `host.wsl` and now fails below the
100
+ WSL 2 build floor (19041); `distro.identity` replaces `distro.shell` +
101
+ `distro.home`; the package family folded into the install remedy (no row) and
102
+ the architecture into `agent.native`; `config.profiles` folded into
103
+ `config.deprecated`. `distro.kernel` is gone. A `substrate: share` profile now
104
+ **fails** the verdict instead of warning: the fs provider throws at
105
+ construction, so the plugin does not boot that profile.
106
+
107
+ - **The sandbox checks answer the effective configuration.** With
108
+ `sandbox: false` on every row *and* `sessionSandbox: false`, nothing is
109
+ confined, so the doctor no longer blocks on a missing bwrap: `sandbox.bwrap`
110
+ reports a warning that names the UNCONFINED posture, and the usability and
111
+ fence-smoke rows skip with that reason. An explicit opt-out is conspicuous,
112
+ never silent.
113
+
114
+ - **The agent checks are config-aware too.** `agent.native`, `agent.cache` and
115
+ the new `agent.home-writable` fail only when `agentBackend: native` makes the
116
+ backend mandatory; under `auto` they warn (the shell agent still serves the
117
+ command), and a missing native binary under `shell` is context. A cache entry
118
+ is now probed for **execution**, not just the mode bit: a `noexec` mount and a
119
+ binary that cannot start both count as broken.
120
+
121
+ - **The Windows entry can run the agent chain.** The doctor translates the
122
+ package root through the distro's automount root (`C:\...` ->
123
+ `/mnt/c/...`, or the configured root), so `agent.handshake`, `functional.exec`
124
+ and `functional.fs` run on the real Windows surface instead of being skipped
125
+ as "the script path is a Windows path"; automount-disabled distros report the
126
+ honest skip. The digest check still reads the script through the host path.
127
+
128
+ - **The quick profile no longer probes the optional tools** (`rg`, `git`,
129
+ `inotifywait`): they are feature-degradation warnings, not first-command
130
+ prerequisites, and each is a process spawn per distro.
131
+
132
+ - **The WSL preset reads as a variant of 标准模式 and sits beside it.** The mode
133
+ picker listed `WSL 模式` as a fifth peer; it is now `标准模式(WSL)` with
134
+ `order: 1`, so it appears directly under 标准模式 (equal orders sort by id, and
135
+ `standard` precedes `wsl`). The composition is unchanged.
136
+
137
+ ### Removed
138
+
139
+ - **The doctor's registry update check is gone.** `update.latest` and its two
140
+ registry GETs were not a diagnosis: the plugin's delegated update service and
141
+ the app's Versions page already answer the question, and the doctor's promise
142
+ is a read-only pass over the machine. `DSH_UPDATE_REGISTRIES` is no longer
143
+ read anywhere (the env-var escape hatch left with the check).
144
+
145
+ - **The composer's WSL 诊断 pill is gone.** Its menu duplicated the sidebar
146
+ panel's per-distro quick check, which now also lists the numbered failing
147
+ items and the warnings. `/wsl-doctor` itself is unchanged and still runs when
148
+ typed in the composer.
149
+
150
+ ### Fixed
151
+
152
+ - **The doctor no longer misreads a top-level `insert:` of the WSL providers as
153
+ a nested-row id patch.** `config.preset-trap` matched an indented
154
+ `- id: wsl-shell` / `wsl-fs` line, so probe profiles that deliberately
155
+ `insert:` those rows at the top level were warned about a patch they do not
156
+ have. Only a root-level id entry — the one that truly targets a top-level row
157
+ and matches nothing — is reported now, and the remedy names the `insert:`
158
+ alternative. Verified against the host's profiles: the probe profiles that
159
+ insert these rows at the top level now scan clean.
160
+
161
+ - **A full doctor run on a BusyBox distro no longer blocks on the shell
162
+ fallback.** The FSB batch failure now decodes its `BAD <op>|<reason>|<base64>`
163
+ payload instead of printing base64, and names the cause: the shell agent's
164
+ GNU `find -printf` floor, which BusyBox lacks (`find: unrecognized: -printf`).
165
+ When `auto`/`native` selects the packaged native agent, the smoke legs over
166
+ the shell agent warn (it is the fallback) while `functional.native` runs the
167
+ same HELLO + EXEC + FSB chain over the cached native binary; the verdict
168
+ stays `ready`. Under `agentBackend: shell`, or when neither backend answers,
169
+ the leg still blocks — with `findutils` as the remedy, not a restart. The
170
+ family probe now knows `apk`, so Alpine's install remedies are `apk add`
171
+ rather than an apt command.
172
+
173
+ - **A full run with nothing to repair is narrated as a check.** The action is
174
+ the same `--fix-owned` run either way, but the row used to say **修复中…**
175
+ even when the button read **完整检查**: the pill, the busy label and the
176
+ running hint now follow the button's intent (检查中… / 完整检查中… / "正在运行
177
+ 完整检查"), so a plain full diagnosis never claims to be repairing anything.
178
+
19
179
  ## [0.23.1] - 2026-11-10
20
180
 
21
181
  ### Fixed
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. 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.
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 announces the environment verdict on every session.
52
52
 
53
53
  ### Why Linux, not PowerShell
54
54
 
@@ -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 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.
118
+ 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` (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 — 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.
119
119
 
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
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. 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
@@ -133,6 +133,7 @@ Open a distro folder as the workspace, for example `\\wsl.localhost\ubuntu\home\
133
133
  - **New terminal** opens a shell in the same distro and directory.
134
134
  - The model sees listening ports and can return the URL of a dev server. WSL 2 forwards localhost to Windows.
135
135
  - The Permissions selector offers `read-only`, `workspace-write` (default) and `danger-full-access`. Only `danger-full-access` runs without the sandbox.
136
+ - 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`.
136
137
 
137
138
  ## Configure
138
139
 
@@ -150,7 +151,7 @@ Settings live on named rows in `$DSH_HOME/profiles/<name>/cordis.patch.yml`. The
150
151
  | | `sandbox` | `true` | check confined writes against the policy |
151
152
  | | `sessionSandbox` | `false`; shipped `true` | run confined writes in the session runtime |
152
153
  | | `substrate` | `agent` | in-distro agent; `share` is rejected at startup |
153
- | `directory-picker-wsl` | `includeHostHome` | `true` | also list the Windows home directory |
154
+ | `directory-picker-wsl` | `includeHostHome` | `true` | also offer the Windows path branch (starting at the drives) |
154
155
  | `subprocess-wsl` | `distro` | `''` | distro mode; empty/`auto` follows the launch directory |
155
156
  | `wsl-preflight` | `distro` | `''` | distro the environment checks probe; empty/`auto` follows the session workspace |
156
157
  | | `startup` | `true` | run the same checks once at plugin load, so the verdict is in the log before any session opens |