dsh-plugin-wsl-env 0.26.1 → 0.26.3-rc.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 (47) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/CONTRIBUTING.md +2 -1
  3. package/CONTRIBUTING.zh.md +2 -1
  4. package/README.md +1 -1
  5. package/docs/ARCHITECTURE.md +13 -2
  6. package/docs/ARCHITECTURE.zh.md +11 -2
  7. package/docs/CONFIGURATION.md +2 -1
  8. package/docs/CONFIGURATION.zh.md +2 -1
  9. package/docs/DIAGNOSTICS.md +20 -0
  10. package/docs/DIAGNOSTICS.zh.md +17 -0
  11. package/docs/LIMITATIONS.md +37 -12
  12. package/docs/LIMITATIONS.zh.md +30 -9
  13. package/docs/MIGRATION.md +4 -2
  14. package/docs/MIGRATION.zh.md +4 -2
  15. package/docs/QUICKSTART.md +2 -1
  16. package/docs/QUICKSTART.zh.md +2 -1
  17. package/docs/README.zh.md +1 -1
  18. package/docs/REQUIREMENTS.zh.md +1 -1
  19. package/docs/UPSTREAM-SERVICE-SWAP.md +35 -9
  20. package/docs/root-fs-routing.md +1 -1
  21. package/lib/fs-routing.d.ts +16 -1
  22. package/lib/fs-routing.js +18 -1
  23. package/lib/git-exec.d.ts +39 -7
  24. package/lib/git-exec.js +151 -18
  25. package/lib/listing.d.ts +17 -0
  26. package/lib/listing.js +20 -0
  27. package/lib/messages.d.ts +27 -0
  28. package/lib/messages.js +26 -2
  29. package/lib/picker.d.ts +52 -1
  30. package/lib/picker.js +63 -22
  31. package/lib/search-exec.d.ts +45 -9
  32. package/lib/search-exec.js +152 -20
  33. package/lib/service-takeover.d.ts +46 -0
  34. package/lib/service-takeover.js +65 -0
  35. package/lib/status.d.ts +7 -0
  36. package/lib/status.js +6 -3
  37. package/lib/subprocess.d.ts +112 -2
  38. package/lib/subprocess.js +36 -4
  39. package/lib/takeover-report.d.ts +80 -0
  40. package/lib/takeover-report.js +119 -0
  41. package/lib/wsl-doctor-command.d.ts +4 -1
  42. package/lib/wsl-doctor-command.js +7 -3
  43. package/lib/wsl-doctor-tool.js +6 -2
  44. package/lib/wsl.d.ts +35 -0
  45. package/lib/wsl.js +54 -1
  46. package/package.json +6 -4
  47. package/scripts/doctor.mjs +21 -13
package/CHANGELOG.md CHANGED
@@ -16,6 +16,149 @@ were part of the record.
16
16
 
17
17
  ## [Unreleased]
18
18
 
19
+ ## [0.26.3-rc.0] - 2026-11-17
20
+
21
+ First release candidate for 0.26.3: a live enable or HMR upgrade no longer
22
+ rolls back on the three same-name takeovers, the in-app doctor names the
23
+ provider that is actually serving them, and the directory picker survives a
24
+ WSL that cannot answer.
25
+
26
+ ### Added
27
+
28
+ - **The in-app doctor names the provider actually serving the three takeover
29
+ services.** `providers.takeover` (the `wsl_doctor` tool, `/wsl-doctor`, and
30
+ the sidebar panel) reports which class serves `subprocess`, `fs`, and
31
+ `directoryPicker`; a failed live takeover — the HMR upgrade that renders
32
+ `service "subprocess" has been registered at <LocalSubprocessRuntime>` and
33
+ rolls back (#39) — now shows as a warning with the restart/install remedy
34
+ instead of a silently healthy report. The standalone CLI cannot observe live
35
+ services, so the row exists only on the in-app surfaces. See
36
+ [DIAGNOSTICS.md](docs/DIAGNOSTICS.md#effective-providers-in-app-only).
37
+ - **`test/hot-swap.test.mjs` pins the live same-name swap semantics.** It
38
+ mounts the real `LocalSubprocessRuntime` and the rows the loader actually
39
+ uses against the host's cordis and asserts the states the install path
40
+ depends on: the rejected immediate registration while a live consumer holds
41
+ the provision, the takeover after the release, the idle swap, and the
42
+ deferral of all three takeover rows. A host change that alters the race
43
+ fails this file instead of a user's upgrade. The release gates now also name
44
+ the real-machine HMR update path
45
+ ([MIGRATION.md](docs/MIGRATION.md#gates-a-release-must-clear)).
46
+
47
+ ### Fixed
48
+
49
+ - **The directory picker browses Windows directories even when WSL is
50
+ unavailable.** `list()` resolved the preferred distro before the host walk;
51
+ on a machine where `wsl.exe` cannot answer (not installed, broken, or a
52
+ failing probe) a Windows folder could not be listed at all. The preferred
53
+ distro is only the dialog's Home affordance, so its failure now falls back to
54
+ the host home while a cancelled call still cancels; distro levels still
55
+ surface their own error. Caught by the Windows CI leg of
56
+ `test/provider-takeover.test.mjs`, which now pins the fallback.
57
+ - **The directory picker's one-shot fallback listed an empty directory.**
58
+ `runCapture` strips NUL bytes because `wsl.exe` writes its own diagnostics as
59
+ UTF-16LE, but the fallback feeds it `find -print0` output, whose NUL
60
+ separators are data: every name collapsed into one and the level came back
61
+ empty whenever the resident agent was unavailable (a stopped distro's first
62
+ browse, or an exhausted rebuild budget). The picker now uses
63
+ `runCaptureRaw`, which keeps the separators while the generic capture keeps
64
+ its UTF-16 recovery. Found and pinned by
65
+ `test/provider-takeover.test.mjs`; `test/wsl.test.mjs` pins both capture
66
+ contracts.
67
+ - **A live enable or HMR plugin upgrade no longer fails on the three
68
+ same-name takeovers, so the plugin manager no longer rolls the update back
69
+ (#39).** The `subprocess`, `fs`, and `directoryPicker` rows used to register
70
+ their providers immediately; when the outgoing shipped provider was still
71
+ registered — the HMR `updateBundle` window, or a busy-profile enable — cordis
72
+ threw `service "…" has been registered at <…>`, the row entered FAILED, and
73
+ `updateBundle` deleted the target version and reinstalled the old one. The
74
+ rows now mount through `src/service-takeover.ts`:
75
+ they register immediately when the name is free (the cold path, unchanged)
76
+ and otherwise stay active, watch `internal/service` for the slot, and
77
+ register when the outgoing provision releases. The install/update succeeds;
78
+ the takeover lands when the shipped provider drains, or at the next restart
79
+ when a dependent outlives the recomposition. The in-app doctor's
80
+ `providers.takeover` row names whichever provider still serves a name
81
+ ([LIMITATIONS.md](docs/LIMITATIONS.md#enabling-the-plugin-on-a-running-profile)).
82
+
83
+ ## [0.26.2] - 2026-11-17
84
+
85
+ One theme: a broken distro's failures surface as the program's own —
86
+ actionable exit codes and remedies instead of opaque provider errors — while
87
+ the doctor's quick pass spots the missing tools before the model does.
88
+
89
+ ### Fixed
90
+
91
+ - **A search in a distro without ripgrep reports rg's failure, not an opaque
92
+ provider error.** The file-search tool reads rg's exit dialect (`1` = no
93
+ matches, `2` = rg failed), but `search-exec.js` treated only
94
+ `AgentUnavailableError` as a cue: the native resident's `SpawnError` — a
95
+ missing `rg` on the PATH the agent inherits from `wsl.exe`, which never
96
+ holds `~/.local/bin` — rejected `done`, and the tool rendered
97
+ "subprocess failed before reporting an outcome (ripgrep provider failure)".
98
+ The handle now synthesizes the documented shape: exit 127 with a message
99
+ naming the program, the distro, the user-local-PATH cause, and the
100
+ `scripts/bootstrap.sh <distro> --install` remedy. A missing working
101
+ directory becomes rg's error code 2 with the relay-shaped `chdir(...)` line
102
+ — never `1`, which the tool reads as "no matches". The one-shot fallback
103
+ translates the relay's `execvpe(rg) failed: No such file or directory` the
104
+ same way, and pins `WSL_UTF8=1` so that line (and every other relay
105
+ diagnostic) arrives readable. A spawn failure deliberately does not retry
106
+ one-shot: `wsl.exe --cd` does not fail on a missing directory — it warns and
107
+ runs the command in `/` — so the retry could turn a wrong directory into a
108
+ successful empty search. Pinned by `test/search-exec.test.mjs`;
109
+ `docs/LIMITATIONS.md` and `docs/ARCHITECTURE.md` record the failure shapes
110
+ and the PATH fact.
111
+
112
+ - **A git snapshot on a distro without git reports git's failure instead of a
113
+ silently empty change review.** `git-exec.js` had the same only-
114
+ `AgentUnavailableError` cue: the native resident's `SpawnError` (a missing
115
+ system `git` on the agent's inherited PATH) rejected `done`, and the
116
+ one-shot fallback would have been worse — `wsl.exe --cd <missing>` runs git
117
+ in `/`, where "not a git repository" reads as "no changes". The handle now
118
+ settles a missing program as exit 127 with the bootstrap remedy, a missing
119
+ directory as git's own `fatal: cannot change to ...` at exit 128, and
120
+ post-processes the one-shot relay's `execvpe(git) failed` / `chdir(...)
121
+ failed` lines into the same shapes (that path now pins `WSL_UTF8=1`). The
122
+ relay parsers are shared from `wsl.ts` (`execProgramFailure` joins
123
+ `workdirFailure`); pinned by `test/git-exec.test.mjs` and
124
+ `test/shell.test.mjs`, with `docs/LIMITATIONS.md` and
125
+ `docs/ARCHITECTURE.md` recording the contract.
126
+
127
+ - **A discovery answer's UNC translation no longer depends on the transport.**
128
+ When the host has no Windows git, the snapshot's sentinel `rev-parse`
129
+ discovery call routes into the distro; with the resident out, the one-shot
130
+ fallback returned that call's Linux absolute paths untranslated, so
131
+ `workspace-changes` resolved them in the host's coordinate system instead of
132
+ `\\wsl.localhost\<distro>`. The fallback now passes the delegated stdout
133
+ through `translateDiscoveryOutput` exactly as the agent path does, carrying
134
+ the delegate's per-stream cut flags over. Pinned by
135
+ `test/git-exec.test.mjs`.
136
+
137
+ - **The directory picker can no longer create a directory in `/` while
138
+ reporting the requested target.** `createDirectory`'s one-shot fallback ran
139
+ a relative `mkdir -- <name>` under `--cd <parent>`; a parent that vanished
140
+ makes `wsl.exe` warn, run in `/`, and exit 0 — where a writable root (a
141
+ root-default image) turns that into a created `/name` reported as the UNC
142
+ target. The argv now names the absolute target on both transports
143
+ (`distroMkdirArgv`), and the picker maps the agent's `CwdError` /
144
+ `SpawnError` to `DirectoryPickerError` instead of leaking an opaque provider
145
+ error. Pinned by `test/listing.test.mjs`; the peer-bound row itself remains
146
+ probe-covered.
147
+
148
+ ### Changed
149
+
150
+ - **The doctor's quick pass now includes the optional-tool probe.**
151
+ `tools.rg`, `tools.git` and `tools.inotifywait` ran only in a full scan, so
152
+ a distro without ripgrep surfaced at the model's first `grep`/`glob` and not
153
+ in the sidebar's quick check. One combined in-distro probe (a single
154
+ `wsl.exe`, not three) now answers all three in the quick profile too; a
155
+ missing `rg` warns with the install remedy, and a probe that answers nothing
156
+ reports `info` instead of fabricating "missing". Pinned by
157
+ `test/doctor.test.mjs`; `docs/CONFIGURATION.md`, `docs/QUICKSTART.md` and
158
+ `docs/DIAGNOSTICS.md` describe the quick scope, and the READMEs' `glob`/
159
+ `grep` troubleshooting row names the failure (exit 127) alongside the
160
+ slowness.
161
+
19
162
  ## [0.26.1] - 2026-11-16
20
163
 
21
164
  One theme: the peer self-check now answers for the set the running plugin
package/CONTRIBUTING.md CHANGED
@@ -195,7 +195,7 @@ terminal if you would rather not see the prompt.
195
195
  | `pnpm run lint:style` | style and lint rules | no |
196
196
  | `pnpm run lint:build` | the build-freshness check: every source has its artifacts and the committed bytes match a real build | no |
197
197
  | `pnpm run lint:types` | the TypeScript check over `test/**` and the ambient types (`tsc --noEmit`) | no |
198
- | `pnpm run e2e:install` | packed-tarball install/upgrade/uninstall into a temporary `DSH_HOME` | yes; Windows + WSL |
198
+ | `pnpm run e2e:install` | packed-tarball install/upgrade/uninstall into a temporary `DSH_HOME`; the newest published → current leg boots the profile with an overlay probe and asserts the three takeovers mount | yes; Windows + WSL |
199
199
  | `pnpm run doctor` | the environment prerequisites, peers and caches (`--json` for scripts; `diagnose` is the read-only alias) | no; inside the distro |
200
200
  | `pnpm run probe` | filesystem behaviour against a real distro | yes |
201
201
  | `pnpm run probe:sandbox` | what bubblewrap confines and what it does not | no |
@@ -213,6 +213,7 @@ terminal if you would rather not see the prompt.
213
213
  | `pnpm run probe:fs-routing` | the root-plane router: distro coordinate, host plane, cross-distro fence | yes |
214
214
  | `pnpm run probe:mode` | which POSIX-mode facts survive the share | no; Windows Node |
215
215
  | `pnpm run probe:sandbox-off` | the documented opt-out on both providers | yes |
216
+ | `pnpm run probe:session-sandbox` | the ADR 0001 primitives: user manager, transient scope lifetime, `/tmp` sharing and `--unshare-pid` behavior | no; from a real WSL terminal, not inside DSH |
216
217
 
217
218
  Every script above is wired in `package.json`. `pnpm test` runs `lint:style`,
218
219
  `lint:links`, `lint:requirements`, `lint:docs`, `test:syntax`, `lint:build`,
@@ -89,7 +89,7 @@ pnpm run sync:windows
89
89
  | `pnpm run lint:style` | 风格与 lint 规则 | 否 |
90
90
  | `pnpm run lint:build` | 构建新鲜度检查:每个源码都有产物,且提交的字节匹配真实构建 | 否 |
91
91
  | `pnpm run lint:types` | 对 `test/**` 和环境类型声明的 TypeScript 检查(`tsc --noEmit`) | 否 |
92
- | `pnpm run e2e:install` | 在临时 `DSH_HOME` 中安装/升级/卸载打包 tarball | 是;Windows + WSL |
92
+ | `pnpm run e2e:install` | 在临时 `DSH_HOME` 中安装/升级/卸载打包 tarball;“最新已发布版 → 当前版本”leg 会用 overlay 探针启动 profile,断言三个接管实际挂载 | 是;Windows + WSL |
93
93
  | `pnpm run doctor` | 环境前置项、peer 和缓存(脚本使用 `--json`;`diagnose` 是只读别名) | 否;在发行版内 |
94
94
  | `pnpm run probe` | 针对真实发行版的文件系统行为 | 是 |
95
95
  | `pnpm run probe:sandbox` | bubblewrap 隔离了什么、没有隔离什么 | 否 |
@@ -107,6 +107,7 @@ pnpm run sync:windows
107
107
  | `pnpm run probe:fs-routing` | 根平面路由器:发行版坐标、宿主平面、跨发行版围栏 | 是 |
108
108
  | `pnpm run probe:mode` | 哪些 POSIX 模式事实能在共享中保留 | 否;Windows Node |
109
109
  | `pnpm run probe:sandbox-off` | 两个 provider 上文档说明的退出选项 | 是 |
110
+ | `pnpm run probe:session-sandbox` | ADR 0001 的原语:user manager、transient scope 生命周期、`/tmp` 共享与 `--unshare-pid` 行为 | 否;在真实 WSL 终端运行,不在 DSH 内 |
110
111
 
111
112
  上述每个脚本都在 `package.json` 中定义。`pnpm test` 按顺序运行 `lint:style`、`lint:links`、`lint:requirements`、`lint:docs`、`test:syntax`、`lint:build`、`lint:types` 和 `test:unit`。`prepublishOnly` 在发布时再次运行 `pnpm test`,因此损坏的检查会在上传前阻止发布。
112
113
 
package/README.md CHANGED
@@ -114,7 +114,7 @@ Without `bubblewrap`, confined commands report `SANDBOX_UNAVAILABLE` and do not
114
114
  |---|---|
115
115
  | every command reports `SANDBOX_UNAVAILABLE` | install `bubblewrap` in the distro, or set `sandbox: false` |
116
116
  | the session refuses before the first command | run `pnpm run doctor`; enable systemd and linger, or set `sessionSandbox` to `auto` or `false` on `wsl-shell` and `wsl-fs` |
117
- | `glob` and `grep` are slow in the distro | run `pnpm run bootstrap <distro>` and use its printed install command to install `ripgrep` |
117
+ | `glob` and `grep` are slow in the distro, or fail with exit 127 (no `rg`) | run `pnpm run bootstrap <distro>` and use its printed install command to install `ripgrep`; a user-local install under `~/.local/bin` is not on the PATH commands run with |
118
118
  | `npm install` / `pnpm add` fail with `EROFS` | the sandbox grants only the workspace by default; configure `writableRoots` on `wsl-shell` and `wsl-fs` (e.g. `~/.npm`, `~/.cache`, `~/.local/share/pnpm`); see [CONFIGURATION](docs/CONFIGURATION.md#toolchain-caches-and-extra-writable-roots) |
119
119
  | the Plugins page finishes without feedback | trust the profile's `package.json` and its `dsh.profile.bundles` entry: the plugin listed there is installed |
120
120
  | a profile patch for `wsl-shell`/`wsl-fs` changes nothing | those rows are nested inside `preset-wsl`. Run `pnpm run preset --check <patch>`; it fails with the complete block to paste |
@@ -53,7 +53,11 @@ the replacement — because a `disabled` written *inside* an insert list is not
53
53
  patch but a duplicate-id data row, and a nested `insert:` is never interpreted at
54
54
  all. [`cordis.patch.yml`](../cordis.patch.yml) carries the full row list, and
55
55
  `test/composition.test.mjs` runs the file through the real patch algorithm to
56
- keep the shape honest.
56
+ keep the shape honest. The replacement rows mount through
57
+ [`lib/service-takeover.js`](../lib/service-takeover.js): they register their
58
+ providers immediately when the service name is free, and otherwise stay active
59
+ until the outgoing provision releases, so a live enable or HMR upgrade
60
+ completes instead of colliding (see [UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md)).
57
61
 
58
62
  One further module ships built but deliberately unwired:
59
63
  [`lib/file-reference-wsl.js`](../lib/file-reference-wsl.js), the distro-side
@@ -131,7 +135,14 @@ launches into the distro — the file-search tool's packaged ripgrep and git
131
135
  snapshot commands (each agent-first on the warm resident — protocol v6 carries
132
136
  a git call's stdin, and a one-shot call costs ~230 ms of `wsl.exe` startup
133
137
  against the resident's ~2 ms — with the one-shot `wsl.exe --exec` handle as
134
- the fallback when the agent is out). When the HOST has no git,
138
+ the fallback when the agent is out). A distro without rg or git does not
139
+ degrade into a silent fallback: the search handle translates the resident's
140
+ spawn failure into exit 127 with the bootstrap remedy, and a missing working
141
+ directory into rg's error code 2 (`1` means "no matches" and is never reused);
142
+ the snapshot handle uses the same 127 shape for a missing git and git's own
143
+ `fatal: cannot change to ...` (exit 128) for a missing directory, so a
144
+ snapshot cannot read as "no changes". `lib/search-exec.js` and
145
+ `lib/git-exec.js` own those translations. When the HOST has no git,
135
146
  `resolveExecutable` answers git with a distro sentinel path, and the snapshot
136
147
  command's discovery call (`rev-parse --show-toplevel ...`) routes too, its
137
148
  absolute-path output translated back into UNC form — so full WSL change review
@@ -46,7 +46,10 @@ GUI 文件树与预览保留随包的 `workspace-files` 行。它的客户端半
46
46
  `insert:` 列表——因为写在 insert 列表*内部*的 `disabled` 不是 patch,而是一行
47
47
  重复 id 的数据行;而嵌套的 `insert:` 根本不会被解释。
48
48
  [`cordis.patch.yml`](../cordis.patch.yml) 承载完整的行列表,`test/composition.test.mjs`
49
- 用真实的 patch 算法跑一遍该文件,以保持结构诚实。
49
+ 用真实的 patch 算法跑一遍该文件,以保持结构诚实。替代行通过
50
+ [`lib/service-takeover.js`](../lib/service-takeover.js) 挂载:服务名空闲时立即
51
+ 注册 provider,否则保持激活、等旧提供者释放后再注册,因此运行中的启用或 HMR
52
+ 升级会完成而不是相撞(见 [UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md))。
50
53
 
51
54
  还有一个模块随包构建,但有意不接线:
52
55
  [`lib/file-reference-wsl.js`](../lib/file-reference-wsl.js),即 `@` 补全的
@@ -116,7 +119,13 @@ agent preset 在其隔离域中运行服务。preset registry 在自己的上下
116
119
  发行版内——文件搜索工具随包的 ripgrep 和 git 快照命令(两者都优先走已预热的
117
120
  常驻 agent——协议 v6 承载 git 调用的 stdin,而一次性调用要付出约 230 ms 的
118
121
  `wsl.exe` 启动开销,常驻 agent 只需约 2 ms——agent 不在时以一次性的
119
- `wsl.exe --exec` 句柄为回退)。宿主没有 git 时,`resolveExecutable` 对 git
122
+ `wsl.exe --exec` 句柄为回退)。没有 rg 或 git 的发行版不会退化为静默回退:
123
+ 搜索句柄把常驻 agent 的 spawn 失败翻译为退出码 127 并附 bootstrap 安装指引,
124
+ 工作目录缺失则翻译为 rg 的错误码 2(`1` 属于“无匹配”,不能占用);快照句柄
125
+ 对缺 git 用同一 127 形状,对缺失目录用 git 自身的
126
+ `fatal: cannot change to ...`(退出码 128)——不会让快照读成“无变更”。这两层
127
+ 翻译分别由 `lib/search-exec.js` 与 `lib/git-exec.js` 拥有。宿主没有 git 时,
128
+ `resolveExecutable` 对 git
120
129
  返回一个发行版哨兵路径,快照命令的发现调用(`rev-parse --show-toplevel ...`)
121
130
  也随之路由,其绝对路径输出再转换回 UNC 形式——因此没有 Windows git 也能完成
122
131
  完整的 WSL 变更审阅。两个 spawn 决策都是纯坐标函数(`lib/search-route.js`、
@@ -393,7 +393,8 @@ verdict as an itemized listing — every check with an explicit status marker,
393
393
  grouped by distro, the copy-paste remedy under every failure — the user just
394
394
  asks for a diagnosis. The tool is interactive by design: `depth: "quick"` (the
395
395
  default) runs the prerequisites only (~10 s in one distro: host facts, the
396
- session sandbox quartet, bubblewrap — no smokes, no registry query, no port
396
+ session sandbox quartet, bubblewrap, and one combined optional-tool probe —
397
+ rg/git/inotifywait — no smokes, no registry query, no port
397
398
  survey) and is the right first call; `section` narrows a follow-up to one area
398
399
  (`host`, `sandbox`, `session`, `conf`, `net`, `agent`); `depth: "full"` is
399
400
  the complete scan and answers for everything. The `/wsl-doctor` command (the
@@ -363,7 +363,8 @@ profile 不使用会话 runtime 时,设置 `sessionSandbox: false`。
363
363
  进程内调用 doctor,以逐项清单返回判定——每个检查带显式状态标记、按 distro
364
364
  分组、失败项下附可复制的修复——用户只要请求诊断即可。该工具按设计是交互式
365
365
  的:`depth: "quick"`(默认)只跑前置项(单 distro 约 10 秒:宿主事实、会话
366
- 沙箱四件套、bubblewrap——无冒烟、无 registry 查询、无端口勘察),是正确的
366
+ 沙箱四件套、bubblewrap,以及一次合并的可选工具探测——rg/git/inotifywait——
367
+ 无冒烟、无 registry 查询、无端口勘察),是正确的
367
368
  首次调用;`section` 把跟进收窄到一个区域(`host`、`sandbox`、`session`、
368
369
  `conf`、`net`、`agent`);`depth: "full"` 是完整扫描,对所有检查负责。
369
370
  `/wsl-doctor` 命令(`wsl-doctor-command` 行,部署具有命令注册表时注册)在
@@ -107,6 +107,11 @@ posts the full-run action (`--fix-owned`, labeled 修复 or 完整检查):
107
107
  never reports. This is the only surface that depends on the model path; use
108
108
  the command or the CLI when the plugin's runtime itself is under suspicion.
109
109
 
110
+ The quick profile carries the optional-tool probe (`tools.rg`, `tools.git`,
111
+ `tools.inotifywait`) in one combined spawn, so a missing `rg` is visible in
112
+ the panel before the model's first `grep`/`glob`; those ids live in the `host`
113
+ section, and the quick scope covers them.
114
+
110
115
  One check is surface-dependent by construction: `session.preset-seam` reports
111
116
  whether `auto-preset` could wrap the host's `agents.createSession` in this
112
117
  process. That is host-process state, so the standalone CLI cannot see it; the
@@ -129,6 +134,21 @@ the map is partial or empty: the peers it omits could not be resolved by the
129
134
  host, so they are unchecked rather than looked up again in the plugin's
130
135
  physical tree.
131
136
 
137
+ ### Effective providers (in-app only)
138
+
139
+ The three root-plane takeovers (`subprocess`, `fs`, `directoryPicker`) can fail
140
+ to activate on a live recomposition — a HMR plugin upgrade is the common case
141
+ ([UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md)). The standalone CLI runs
142
+ in its own process and cannot see them, so the in-app surfaces (the `wsl_doctor`
143
+ tool, `/wsl-doctor`, and the sidebar panel) append `providers.takeover`: it
144
+ names the class serving each service. `ok` means this plugin's providers serve
145
+ all three; `warn` names the shipped provider still in place and carries the
146
+ restart remedy. A deferred takeover — the plugin's row waiting for an outgoing
147
+ provision to release (`src/service-takeover.ts`) — is exactly this warning, and
148
+ it clears by itself when the old provider drains; if it persists, restarting
149
+ the app applies the takeover. A context that cannot see any of the three (a
150
+ preset realm, the standalone run) adds no row.
151
+
132
152
  ## The map
133
153
 
134
154
  Class legend:
@@ -85,6 +85,10 @@ doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面
85
85
  会杀掉它,而两分钟时限加上有界的管道排空窗口,能让子进程不再报告时也有
86
86
  结论。这是唯一依赖模型链路的入口;怀疑插件运行时本身时,用命令或 CLI。
87
87
 
88
+ quick 档在一次合并探测中带上可选工具(`tools.rg`、`tools.git`、
89
+ `tools.inotifywait`),因此缺少 `rg` 会在模型第一次 `grep`/`glob` 之前就出现在
90
+ 面板里;这些 id 属于 `host` 分区,也在 quick 档的覆盖范围内。
91
+
88
92
  `peers.versions` 也按入口而异,因为它问的是本进程实际加载的对等包版本。宿主
89
93
  运行时会把链接插件声明的 peer 投影到安装处的同一份副本上,所以同一份插件在
90
94
  应用内加载的是应用自带的版本,而独立 Node 进程解析到的可能完全不同。修复前,
@@ -96,6 +100,19 @@ harness 安装留下的树——并比较那棵树的版本。现在查找在第
96
100
  映射为空或只有部分项——缺失项说明宿主没有解析到,doctor 记作 unchecked,不再
97
101
  回退到插件目录旁的本地副本。
98
102
 
103
+ ### 生效的 provider(仅 in-app)
104
+
105
+ 三个根面接管(`subprocess`、`fs`、`directoryPicker`)可能在运行中的重组里
106
+ 激活失败——HMR 插件升级是最常见的情形
107
+ ([UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md))。独立 CLI 在自己的
108
+ 进程里运行、看不到这些服务,因此 in-app 入口(`wsl_doctor` 工具、
109
+ `/wsl-doctor`、侧栏面板)会追加 `providers.takeover` 行,列出每个服务当前由
110
+ 哪个类提供:`ok` 表示三个都由本插件的 provider 提供;`warn` 会点名仍在位上的
111
+ 随包 provider,并带上重启的补救。接管处于延迟状态(本插件的行在等旧提供者
112
+ 释放,见 `src/service-takeover.ts`)正是这条警告;旧 provider 释放后它会自行
113
+ 消失,若一直存在,重启应用即完成接管。看不到任何一个服务的上下文(preset
114
+ realm、独立 CLI 运行)不会加这一行。
115
+
99
116
  ## 地图
100
117
 
101
118
  类别图例:
@@ -43,7 +43,12 @@ operations never use the 9p share.
43
43
  required; a policy change pays one agent startup; a write granted to `/tmp` lands
44
44
  in the distro's real `/tmp`.
45
45
  - **`glob`/`grep` run the distro's rg**; a distro without rg fails the search
46
- (exit 127). Install: `wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
46
+ with exit 127, naming the program and the install remedy below — no silent
47
+ fallback, and not an opaque provider error; a missing working directory
48
+ fails explicitly too (rg's error code 2, because `1` means "no matches").
49
+ Commands and the resident agent both inherit `wsl.exe`'s default PATH, so a
50
+ user-local install under `~/.local/bin` is invisible — install it
51
+ system-wide, or somewhere on that PATH. Install: `wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
47
52
  git ripgrep inotify-tools` (or the detected family's spelling). `--install` runs it
48
53
  only for a missing `bubblewrap`.
49
54
  - **`watch()` is coarse invalidation, not per-file notifications**: inotify events
@@ -247,6 +252,13 @@ sandbox's security statement: `enforcement: partial` is untouched.
247
252
  app. Two alternatives: the doctor's `git.win-safe` probe reports the state, and a
248
253
  machine **without** Windows git needs nothing — the provider routes discovery into
249
254
  the distro and translates the output into UNC form.
255
+ - **A distro without a system git never disguises change review as "no
256
+ changes"**: a snapshot call fails with exit 127, naming git, the agent
257
+ PATH's user-local blind spot (`~/.local/bin` is invisible), and the
258
+ bootstrap remedy; a missing snapshot directory fails in git's own dialect —
259
+ `fatal: cannot change to ...` at exit 128 — instead of returning an empty
260
+ result. The one-shot fallback translates the same relay lines
261
+ (`execvpe(git) failed`, `chdir(...) failed`) the same way.
250
262
  - **A multi-directory `GIT_*` value is translated, not skipped — and a
251
263
  Windows-form list comes out wrong.** The translation applies the single-value
252
264
  translator to every `GIT_*` value unchecked, so a list folds onto the first
@@ -269,18 +281,31 @@ sandbox's security statement: `enforcement: partial` is untouched.
269
281
 
270
282
  ## Enabling the plugin on a running profile
271
283
 
272
- - **A GUI enable of this bundle can fail on a busy profile, and a restart
273
- applies it.** The three root-plane takeovers (`subprocess`, `fs`,
274
- `directoryPicker`) replace shipped services under the same names. On
275
- app `0.2.2-rc.1` (cordis 4.1.0), a disposing provider keeps its service
276
- registration until every dependent releases, so the replacements
277
- collide with the shipped providers while sessions are live and the
278
- enable reports them as failed. The selection is persisted either way;
279
- **restarting the app loads the plugin** (the cold composition is
280
- correct). Closing sessions before enabling usually lets the hot path
281
- succeed — with no dependents the shipped providers release inside the
282
- recomposition. Mechanism and repro:
284
+ - **A live enable of this bundle defers the takeover until the outgoing
285
+ provider releases, instead of failing.** The three root-plane takeovers
286
+ (`subprocess`, `fs`, `directoryPicker`) replace shipped services under the
287
+ same names. When the previous provision is still registered during a live
288
+ recomposition, the plugin's rows stay ACTIVE and register after
289
+ `internal/service` reports the slot released (`src/service-takeover.ts`), so
290
+ cordis's duplicate-service error no longer fails the enable. The shipped
291
+ provider keeps serving until then; `/wsl-doctor`'s `providers.takeover` row
292
+ names it. If a dependent never releases, restarting the app completes the
293
+ takeover (the cold composition is correct). Mechanism and repro:
283
294
  [UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md).
295
+ - **Upgrading through the plugin manager no longer rolls back; the takeover may
296
+ wait for a restart.** With HMR, `updateBundle` calls `removeBundle` before
297
+ installing the target. The moment the old layer is removed, this patch's
298
+ takeover entries (`- id: subprocess` / `disabled: true`, …) disappear with
299
+ it and the shipped rows re-activate; when the incoming layer arrives, this
300
+ plugin's rows find the slots occupied and wait for the release, so the
301
+ manager sees a success and keeps the target version. If a shipped provider is
302
+ never released (a dependent outlives the recomposition), the takeover
303
+ completes at the next restart, and `providers.takeover` names the shipped
304
+ provider meanwhile. The host-side remove→install window remains an upstream
305
+ issue ([deepseek-harness#12510](https://github.com/deepseek-ai/deepseek-harness/discussions/12510))
306
+ that can still fail other bundles; this plugin no longer triggers a rollback.
307
+ [#39](https://github.com/Big-Dao/dsh-plugin-wsl-env/issues/39) records the
308
+ actual `0.24.0 → 0.26.2` behavior.
284
309
 
285
310
  ## Host "Open in app"
286
311
 
@@ -39,8 +39,12 @@ Windows 侧 share 后端(`substrate: "share"`)在启动时被拒绝;WSL
39
39
  工作区之外以 `FS_SANDBOX_DENIED` 拒绝。代价:需要 `bubblewrap`;
40
40
  策略变更要付出一次 agent 启动;授予 `/tmp` 的写入落在发行版真实的
41
41
  `/tmp` 中。
42
- - **`glob`/`grep` 使用发行版的 rg**;没有 rg 的发行版搜索失败
43
- (退出码 127)。安装:`wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
42
+ - **`glob`/`grep` 使用发行版的 rg**;没有 rg 的发行版搜索失败,
43
+ 以退出码 127 报出程序名与下面的安装指引——不会静默回退,也不是不可读的
44
+ provider 错误;工作目录缺失同样显式失败(rg 的错误码 2,`1` 只表示"无
45
+ 匹配")。命令与常驻 agent 都继承 `wsl.exe` 的默认 PATH,因此
46
+ `~/.local/bin` 下的用户级安装不可见——请装成系统级,或放在那个 PATH 上。
47
+ 安装:`wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
44
48
  git ripgrep inotify-tools`(或检测到的包管理族对应的写法)。`--install` 只在
45
49
  缺少 `bubblewrap` 时才执行安装。
46
50
  - **`watch()` 是粗粒度失效,不是逐文件通知**:inotify 事件合并到 0.5 s,
@@ -218,6 +222,12 @@ Windows git `safe.directory` 白名单)。`--fix-owned` 把运行收窄到插
218
222
  应用。两个替代方案:doctor 的 `git.win-safe` 探针可报告该状态;而
219
223
  **没有** Windows git 的机器什么都不用做——提供者把发现请求路由进
220
224
  发行版,并把输出转写成 UNC 形式。
225
+ - **没有系统级 git 的发行版不会把变更审阅伪装成“无变更”**:快照调用以退出码
226
+ 127 报出 git 无法启动、agent PATH 的成因(`~/.local/bin` 下的安装不可见)
227
+ 与 bootstrap 安装指引;快照目录缺失则用 git 自身的
228
+ `fatal: cannot change to ...`(退出码 128)失败,而不是静默返回空结果。
229
+ 一次性回退路径上的同类 relay 文本(`execvpe(git) failed`、`chdir(...) failed`)
230
+ 做同样的翻译。
221
231
  - **多目录 `GIT_*` 值会被转写而不是跳过——Windows 形态的列表会译坏。**
222
232
  git 环境转写对每个 `GIT_*` 值无条件套用单值翻译,列表被折叠进首个盘符的
223
233
  挂载点(`C:\a;D:\b` 变成 `/mnt/c/a;D:/b`);只有 POSIX 形态的冒号列表
@@ -237,14 +247,25 @@ Windows git `safe.directory` 白名单)。`--fix-owned` 把运行收窄到插
237
247
 
238
248
  ## 在运行中的 profile 上启用本插件
239
249
 
240
- - **在繁忙的 profile 上通过 GUI 启用本 bundle 可能失败,重启应用即可生效。**
241
- 三个根面接管行(`subprocess`、`fs`、`directoryPicker`)以同名替换随包服务。
242
- 在应用 `0.2.2-rc.1`(cordis 4.1.0)上,正在销毁的提供者在全部依赖方释放之前
243
- 一直持有服务注册,因此会话存活期间替换行会与随包提供者相撞,启用操作将它们
244
- 报告为失败。无论如何选择都会持久化;**重启应用即可加载插件**(冷启动组合是
245
- 正确的)。启用前先关闭会话通常能让热路径成功——没有依赖方时,随包提供者会在
246
- 重组期间释放。机制与复现:
250
+ - **在运行中的 profile 上启用本 bundle 时,接管会推迟到旧提供者释放,而不是
251
+ 失败。** 三个根面接管行(`subprocess`、`fs`、`directoryPicker`)以同名替换
252
+ 随包服务。运行中的重组里旧提供者可能仍持有服务注册;本插件的行保持激活,
253
+ 等 `internal/service` 报告槽位释放后再注册(`src/service-takeover.ts`),
254
+ 所以 cordis 的重复服务错误不再让启用失败。释放之前随包 provider 继续服务,
255
+ `/wsl-doctor` 的 `providers.takeover` 行会点名它;依赖方始终不释放时,重启
256
+ 应用即可完成接管(冷启动组合是正确的)。机制与复现:
247
257
  [UPSTREAM-SERVICE-SWAP.md](UPSTREAM-SERVICE-SWAP.md)。
258
+ - **通过插件管理器升级不再自动回滚;接管可能推迟到重启。** 有 HMR 时
259
+ `updateBundle` 先 `removeBundle` 再安装目标版本:移除旧层的那一刻,本 patch
260
+ 里的 `- id: subprocess / disabled: true` 等接管条目随之消失,随包行重新激活
261
+ 并注册服务;新层到达时,本插件的行检测到槽位占用后等待释放,管理器看到的是
262
+ 成功,不会删除目标版本。若随包 provider 因依赖方未释放而一直不释放,接管在
263
+ 下次重启完成,期间 `providers.takeover` 报告仍在服务的随包 provider。宿主侧
264
+ 的 remove→install 窗口仍是上游问题
265
+ ([deepseek-harness#12510](https://github.com/deepseek-ai/deepseek-harness/discussions/12510)),
266
+ 其他 bundle 仍可能失败;本插件不再触发回滚。
267
+ [#39](https://github.com/Big-Dao/dsh-plugin-wsl-env/issues/39) 记录了
268
+ `0.24.0 → 0.26.2` 的实际表现。
248
269
 
249
270
  ## 宿主的"在应用中打开"
250
271
 
package/docs/MIGRATION.md CHANGED
@@ -80,8 +80,10 @@ shows the composed value.
80
80
  | `pnpm run test:coverage` | lines 85 / branches 84 / functions 70 | CI (Node 24, Ubuntu) |
81
81
  | `pnpm run test:browser` | the plugin web bundle in headless Chromium (layout, clicks, badge timing); install Chromium once | CI (`browser` job, Ubuntu) and the release `Gates` |
82
82
  | Peer line tested | floor `>=0.2.2-rc.2`; the `peer-canary` workflow resolves `next` and runs the scratch upgrade | CI schedule/manual |
83
- | Packed install/upgrade/uninstall | `pnpm run e2e:install` (temp `DSH_HOME`, 0.17.1 → current over the peer raise, marker) | manual, this machine (10/10 on 2026-11-06; the origin moved 0.11.0 → 0.17.1 because dsh 0.2.2-rc.1 rightly rejects the exact-pin era) |
84
- | Real-machine probe suite | `test/probe/run-all-when-closed.sh --include-fs` (needs the app closed) | manual; 15/15 on 2026-10-31 and again 2026-11-05 (docs/superpowers/probe-runs/); the suite grew to 17 on 2026-11-06 — the first 17-probe run on the same day passed 16 and failed the new `two-distro.sh` on a wrong assertion vehicle (session-scoped `DSH_WSL_DISTRO` is absent on a direct `ctx.shell` seam); after the probe was reworked to per-distro `/tmp` markers it passed alone, giving all 17 probes a pass on this machine (2026-11-06-probe-suite.md); 17/17 again on 2026-11-12 against the rc.2 host |
83
+ | Packed install/upgrade/uninstall + boot | `pnpm run e2e:install` (temp `DSH_HOME`, 0.17.1 → current over the peer raise, marker; newest published stable → current, then a boot-time probe asserts all three takeovers are this plugin's classes; **host-stopped path, not the HMR update**) | manual, this machine (13/13 on 2026-11-17 with the boot leg; the origin moved 0.11.0 → 0.17.1 because dsh 0.2.2-rc.1 rightly rejects the exact-pin era) |
84
+ | HMR update path (running profile) | install the previous published version in a temp `DSH_HOME`, start the desktop app with a live session, upgrade to the candidate through the plugin manager; assert `application: applied` and no rollback, and after a restart that `subprocess`/`fs`/`directoryPicker` are served by this plugin's classes (the update itself may land deferred, with `providers.takeover` a warn) | manual, this machine (**not run yet**; the path #39/#12510 escaped through) |
85
+ | Session-scoped sandbox (ADR 0001) | `pnpm run probe:session-sandbox` from a real WSL terminal (systemd user manager; not inside DSH, not in the closed-app suite) | manual; **11 passed / 0 failed / 0 skipped on 2026-11-17** — run in a fresh WSL session (`wsl.exe -d ubuntu --exec`), which sees systemd as PID 1; the probe asserts manager reachability, linger, transient-scope lifetime, `/tmp` sharing and `--unshare-pid` |
86
+ | Real-machine probe suite | `test/probe/run-all-when-closed.sh --include-fs` (needs the app closed) | manual; 15/15 on 2026-10-31 and again 2026-11-05 (docs/superpowers/probe-runs/); the suite grew to 17 on 2026-11-06 — the first 17-probe run on the same day passed 16 and failed the new `two-distro.sh` on a wrong assertion vehicle (session-scoped `DSH_WSL_DISTRO` is absent on a direct `ctx.shell` seam); after the probe was reworked to per-distro `/tmp` markers it passed alone, giving all 17 probes a pass on this machine (2026-11-06-probe-suite.md); 17/17 again on 2026-11-12 against the rc.2 host; `auto-preset.sh` joined the suite on 2026-11-17 (17 fast probes plus `run.sh`, 18 with `--include-fs`). The first closed-app run was **17/18**: `auto-preset.sh` failed because the `wslfs` probe profile does not compose the plugin bundle, and after that fix it still called `createSession` before auto-preset's `ctx.inject` wrapper had installed. Both causes were probe-side: the probe now layers the package patch, disables the profile's root `wsl-fs`, waits for the auto-preset fiber and the method's identity change, and reports seam/preset diagnostics. The full suite was rerun the same day (2026-11-17 20:16): **18/18, FULL PASS** (docs/superpowers/probe-runs/2026-11-17-partial-probes.md) |
85
87
  | Clean Win11 + Ubuntu first run ≤ 5 min | a clean machine, a stopwatch | **not run** (the project's machine is already configured) |
86
88
  | aarch64 executed | the native 18-check suite under qemu in CI | **run in CI** (physical aarch64 WSL is out of scope; see COMPATIBILITY.md) |
87
89
  | No open P0 bug for 30 days | issue tracker | time-based; cannot be asserted from a checkout |
@@ -68,8 +68,10 @@
68
68
  | `pnpm run test:coverage` | 行 85 / 分支 84 / 函数 70 | CI(Node 24,Ubuntu) |
69
69
  | `pnpm run test:browser` | 无头 Chromium 中的插件 web bundle(布局、点击、badge 时序);安装一次 Chromium | CI(`browser` job,Ubuntu)与发布的 `Gates` |
70
70
  | peer 版本线受测 | 下限 `>=0.2.2-rc.2`;`peer-canary` 工作流解析 `next` 并运行临时升级 | CI 定时/手动 |
71
- | 打包安装/升级/卸载 | `pnpm run e2e:install`(临时 `DSH_HOME`,0.17.1 → 当前版本,跨 peer 下限抬升,marker) | 手动,本机(2026-11-06 为 10/10;起点从 0.11.0 移至 0.17.1,因为 dsh 0.2.2-rc.1 正确拒绝了精确钉版时期) |
72
- | 真机探针套件 | `test/probe/run-all-when-closed.sh --include-fs`(需要应用关闭) | 手动;2026-10-31 与 2026-11-05 均为 15/15(docs/superpowers/probe-runs/);套件在 2026-11-06 增至 17 项——同日首次 17 项运行通过 16 项,新的 `two-distro.sh` 因断言载体错误而失败(会话作用域的 `DSH_WSL_DISTRO` 在直接 `ctx.shell` 接缝上不存在);将探针改为按发行版的 `/tmp` 标记后单独通过,使本机 17 项探针全部通过(2026-11-06-probe-suite.md);2026-11-12 针对 rc.2 宿主再次 17/17 |
71
+ | 打包安装/升级/卸载 + 启动 | `pnpm run e2e:install`(临时 `DSH_HOME`,0.17.1 → 当前版本,跨 peer 下限抬升,marker;最新已发布版 → 当前版本后用探针启动,断言三个接管都是本插件的类;**宿主关闭路径,不含 HMR 更新**) | 手动,本机(2026-11-17 含启动 leg 为 13/13;起点从 0.11.0 移至 0.17.1,因为 dsh 0.2.2-rc.1 正确拒绝了精确钉版时期) |
72
+ | HMR 更新路径(运行中 profile) | 临时 `DSH_HOME` 安装上一个已发布版本 → 启动桌面应用并保留活动会话 → 经插件管理升级到候选版本;断言 `application: applied`、无回滚,重启后 `subprocess`/`fs`/`directoryPicker` 由本插件的类提供(升级当时可能处于延迟接管,`providers.takeover` 为 warn) | 手动,本机(**尚未运行**;#39/#12510 漏测的正是这条路径) |
73
+ | 会话级沙箱(ADR 0001) | 在真实 WSL 终端运行 `pnpm run probe:session-sandbox`(systemd user manager;不在 DSH 内,也不在关闭应用套件里) | 手动;**2026-11-17 为 11 passed / 0 failed / 0 skipped**——在全新 WSL 会话(`wsl.exe -d ubuntu --exec`)中运行,systemd 是 PID 1;探针断言 manager 可达性、linger、transient scope 生命周期、`/tmp` 共享与 `--unshare-pid` |
74
+ | 真机探针套件 | `test/probe/run-all-when-closed.sh --include-fs`(需要应用关闭) | 手动;2026-10-31 与 2026-11-05 均为 15/15(docs/superpowers/probe-runs/);套件在 2026-11-06 增至 17 项——同日首次 17 项运行通过 16 项,新的 `two-distro.sh` 因断言载体错误而失败(会话作用域的 `DSH_WSL_DISTRO` 在直接 `ctx.shell` 接缝上不存在);将探针改为按发行版的 `/tmp` 标记后单独通过,使本机 17 项探针全部通过(2026-11-06-probe-suite.md);2026-11-12 针对 rc.2 宿主再次 17/17;`auto-preset.sh` 于 2026-11-17 加入套件(17 项快速探针,`--include-fs` 时加 `run.sh`,共 18 项)。首次关闭应用的全套结果为 **17/18**:`auto-preset.sh` 失败,原因是 `wslfs` 探针 profile 不组合插件 bundle;修好组合后又发现探针在 auto-preset 的 `ctx.inject` 包装器安装前就调用了 `createSession`。两处都是探针侧问题:探针现在追加包自身的 patch、禁用 profile 的根 `wsl-fs`、等待 auto-preset 行的 fiber 与方法身份变化,并输出 seam/preset 诊断。同日 20:16 重跑整套:**18/18,FULL PASS**(docs/superpowers/probe-runs/2026-11-17-partial-probes.md) |
73
75
  | 干净 Win11 + Ubuntu 首次运行 ≤ 5 分钟 | 干净机器、秒表 | **未运行**(项目机器已配置) |
74
76
  | aarch64 已执行 | CI 中 qemu 下的 native 18 项检查套件 | **已在 CI 运行**(物理 aarch64 WSL 不在范围内;见 COMPATIBILITY.md) |
75
77
  | 30 天内无未关闭的 P0 bug | issue tracker | 基于时间;无法从代码检出中断言 |
@@ -55,7 +55,8 @@ confirmation); `--fix-owned` restricts a fix run to the plugin-owned state
55
55
  (the panel's repair action); `--bundle <path>` writes
56
56
  the diagnostic file a setup report attaches (`--redact` strips the paths
57
57
  from it). A run can be scoped — `--quick` probes the first-command
58
- prerequisites only (~10 s), `--sections <list>` (comma-separated) runs the
58
+ prerequisites plus one combined optional-tool probe (~10 s), `--sections
59
+ <list>` (comma-separated) runs the
59
60
  named sections — or widened with `--all` to every installed distro; the
60
61
  report itemizes every check with an explicit status marker, grouped by
61
62
  distro. The fixed skeleton renders in the host's language
@@ -47,7 +47,8 @@ agent 缓存,两者都会复检;以及确认后的 Windows git 信任)或
47
47
  插件自有状态(面板的“修复”动作);
48
48
  `--bundle <路径>` 写出可附加到问题报告的诊断文件(`--redact`
49
49
  将其中的路径脱敏)。运行可以收窄范围——`--quick` 只探首条命令的前置项
50
- (约 10 秒),`--sections <分区清单>`(逗号分隔)只运行指定分区——
50
+ 与一次合并的可选工具探测(约 10 秒),`--sections <分区清单>`(逗号分隔)
51
+ 只运行指定分区——
51
52
  或用 `--all` 扩展到每个已装发行版;报告按 distro 分组逐项列出每个检查,
52
53
  带显式状态标记。固定骨架按宿主语言渲染(`--locale <标签>` 或
53
54
  `DSH_WSL_DOCTOR_LOCALE` 可覆盖检测)。
package/docs/README.zh.md CHANGED
@@ -114,7 +114,7 @@ wsl preset(每会话)
114
114
  |---|---|
115
115
  | 每条命令都报 `SANDBOX_UNAVAILABLE` | 在发行版内安装 `bubblewrap`,或设置 `sandbox: false` |
116
116
  | 会话在第一条命令前就被拒绝 | 运行 `pnpm run doctor`;启用 systemd 和 linger,或把 `wsl-shell`、`wsl-fs` 上的 `sessionSandbox` 设为 `auto` 或 `false` |
117
- | 发行版内 `glob`、`grep` 很慢 | 运行 `pnpm run bootstrap <发行版>`,使用打印的安装命令安装 `ripgrep` |
117
+ | 发行版内 `glob`、`grep` 很慢,或以退出码 127 失败(没有 `rg`) | 运行 `pnpm run bootstrap <发行版>`,使用打印的安装命令安装 `ripgrep`;`~/.local/bin` 下的用户级安装不在命令使用的 PATH 上 |
118
118
  | `npm install` / `pnpm add` 报 `EROFS` | 沙箱默认只授予工作区;在 `wsl-shell` 和 `wsl-fs` 上配置 `writableRoots`(如 `~/.npm`、`~/.cache`、`~/.local/share/pnpm`),见 [CONFIGURATION](CONFIGURATION.zh.md#工具链缓存与额外可写目录) |
119
119
  | Plugins 页面装完没有任何日志 | 以 profile 的 `package.json` 与 `dsh.profile.bundles` 为准:列出插件即安装成功 |
120
120
  | 对 `wsl-shell`/`wsl-fs` 的 profile 补丁不生效 | 这些行嵌套在 `preset-wsl` 里。运行 `pnpm run preset --check <补丁>`;它会失败并输出需要粘贴的完整块 |
@@ -43,7 +43,7 @@ docs/ 各篇里的行为承诺登记成带编号的需求条目,并给每条
43
43
  | R7 | 模型可见的发行版事实与 WSLENV 政策:受管 `DSH_*` 前缀准入,`PATH` 刻意不转发 | README「Using it」「Recipes」 | ①②③:两个 Windows 路径变量带 `/p` 翻译、`PATH` 不转发的理由成文;传输环境钉死 essentials+`DSH_*`+过滤后 WSLENV;shell 解析失败则省略事实而非报假值(宁可缺报不误报) | `terminal.test.mjs`(`/p` 翻译)、`agent.test.mjs`(传输环境 WSLENV 钉死为受管项)、`provider.test.mjs`(探针失败重试、不钉占位符)、`shell-env.test.mjs`(假 `wsl.exe` 下挂载/清扫/resolve 双路径与 doctorFact/windowsToPosix) | 已闭合(原残差:`lib/shell-env.js` 无单测、覆盖率报告不含该模块):`test:coverage` 实测该模块 行 97.7%/分支 83.6%/函数 92.9%,逐模块地板(85/70/60)达标,`coverage-allowlist` 豁免已撤;未覆盖项仅为需在驻 agent 的端口扫描成功臂(探针层) |
44
44
  | R8 | 权限三档(read-only / workspace-write / danger-full-access)与提权提议流 | README「Sandbox」表;ARCHITECTURE「Error codes」 | ①②:三档行为逐档成表;模型可见两行前缀逐字给出;`FS_SANDBOX_DENIED` 可提权而 `FS_OUTSIDE_DISTRO` 不可,且区分理由明文(宽权限开不出另一个发行版) | `fs-decisions.test.mjs`、`provider.test.mjs`、`fsio-agent.test.mjs`(分类) | — |
45
45
  | R9 | bubblewrap 沙箱:与 Linux runner 同参数、fail-closed、`enforcement: partial` 诚实上报 | ARCHITECTURE「Sandbox」全节;SECURITY「Sandbox enforcement is `partial` by design」 | ①②③⑤⑥:选型依据(ACL 令牌触不到 WSL)、探针失败不缓存、interop 洞 + `maskWindowsDrive` 收窄及其自身极限(binfmt 按内容分发)、完全关闭唯一路径(`wsl.conf`)、`sandbox: false` 退出——行为到边界到逃生门完整成链 | `sandbox.test.mjs`、`probe-cache.test.mjs`;probe:sandbox、probe:sandbox-off | interop 使 enforcement 恒为 partial——已声明的设计边界 |
46
- | R10 | 文件搜索跑发行版自身的 rg,绝不跨 9p share | PARITY「Contract audit」第 2 条;LIMITATIONS「glob 和 grep」条 | ①②③:拦截点与参数逐字转发成文;缺 rg 浮出 exit 127 附 bootstrap 指引;grep 回退被拒绝且理由明文(不读 `.gitignore`,非 rg 替身) | `search-route.test.mjs`、`search-exec.test.mjs` | — |
46
+ | R10 | 文件搜索跑发行版自身的 rg,绝不跨 9p share | PARITY「Contract audit」第 2 条;LIMITATIONS「glob 和 grep」条 | ①②③:拦截点与参数逐字转发成文;缺 rg 浮出 exit 127 附 bootstrap 指引(常驻 agent 的 spawn 失败与一次性回退的 `execvpe` 失败都翻译为该形状);工作目录缺失用 rg 的错误码 2,不复用「无匹配」的 1;grep 回退被拒绝且理由明文(不读 `.gitignore`,非 rg 替身) | `search-route.test.mjs`、`search-exec.test.mjs` | — |
47
47
  | R11 | watch():inotify 优先(无界目录),轮询回退;粗粒度失效 | PARITY「Contract audit」第 1 条;LIMITATIONS watch 两条 | ①②③:契约向上追溯到宿主接缝(`changed()` 无载荷 → 粗粒度失效即可);inotify 递归且 0.5s 合并、文件/限深/无 inotify-tools 回退轮询;更旧 mtime 盲区只属轮询路径、`watchMaxDepth` 旋钮、目标消失响亮报错成文 | `watcher.test.mjs`;probe:watch(无 inotify 时 7/7;装 inotify-tools 后盲区检查改为期望事件) | 轮询回退的 mtime 盲区已声明;inotify 路径依赖发行版的 inotify-tools |
48
48
  | R12 | share 基座退役:携带 `substrate: "share"` 的 profile 在 boot 被拒并附迁移 | README/CONFIGURATION/LIMITATIONS 三处一致 | ①②⑤:旧值处置与用户所见成文,迁移指引内嵌 | `fs-decisions.test.mjs`(拒绝消息与迁移指引文案) | boot 期拒绝分支无测试(构造器调 `shareSubstrateRefusal`,`src/wsl-filesystem.ts:225`):`fs.boot.test.mjs` 只以 `sandbox: true` 启动该行,仓内没有构造 `substrate: "share"` profile 的测试 |
49
49
  | R13 | 会话级 systemd scope:命令共享后台进程/真实 `/tmp`/`ps`,scope 随会话结束停止;systemd + linger 缺失时预检带修复拒绝 | ADR 0001;README/CONFIGURATION/LIMITATIONS 的 `sessionSandbox` 条 | ①②③⑤:scope 生命周期(agent 为主进程、refcount、dispose stop)、`sessionSandbox: false` 退出与 `auto` 回退、systemd/linger/systemd-run 四项预检与缓存策略成文;`/tmp` 与后台进程的保真边界限定在 runtime 开时 | `session-scope.test.mjs`、`session-runtime.test.mjs`、`provider.test.mjs`;真机会话验证(active scope、跨命令后台/`/tmp`、会话结束 0 units) | 硬崩溃可能留下 stale scope(启动清扫未随发,入 LIMITATIONS);受限写入已共享 runtime,读仍走无约束共享 agent,根级 fs-routing 不持有 session runtime |