dsh-plugin-wsl-env 0.23.0 → 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 +174 -0
- package/README.md +5 -4
- package/client.js +974 -165
- package/cordis.patch.yml +24 -3
- package/docs/API.md +2 -1
- package/docs/ARCHITECTURE.md +8 -4
- package/docs/COMPATIBILITY.md +5 -0
- package/docs/CONFIGURATION.md +37 -9
- package/docs/CONFIGURATION.zh.md +28 -8
- package/docs/DIAGNOSTICS.md +44 -18
- package/docs/DIAGNOSTICS.zh.md +33 -13
- package/docs/LIMITATIONS.md +19 -5
- package/docs/LIMITATIONS.zh.md +15 -4
- package/docs/QUICKSTART.md +30 -7
- package/docs/QUICKSTART.zh.md +22 -7
- package/docs/README.zh.md +5 -4
- package/docs/REQUIREMENTS.zh.md +2 -2
- package/docs/root-fs-routing.md +3 -2
- package/lib/auto-preset.d.ts +27 -0
- package/lib/auto-preset.js +40 -3
- package/lib/client-host.d.ts +2 -2
- package/lib/client-host.js +2 -2
- package/lib/fs-routing.d.ts +6 -5
- package/lib/fs-routing.js +7 -6
- package/lib/listing.d.ts +21 -9
- package/lib/listing.js +25 -21
- package/lib/picker.d.ts +50 -16
- package/lib/picker.js +103 -23
- package/lib/preset-choice.d.ts +22 -3
- package/lib/preset-choice.js +36 -3
- package/lib/status.d.ts +261 -0
- package/lib/status.js +425 -0
- package/lib/wsl-doctor-tool.d.ts +8 -0
- package/lib/wsl-doctor-tool.js +16 -18
- package/lib/wsl.d.ts +12 -0
- package/lib/wsl.js +15 -0
- package/locale/doctor/en.json +3 -2
- package/locale/doctor/zh.json +3 -2
- package/package.json +11 -4
- package/scripts/doctor.mjs +435 -225
package/cordis.patch.yml
CHANGED
|
@@ -163,6 +163,22 @@
|
|
|
163
163
|
- id: wsl-env-client-host
|
|
164
164
|
name: 'dsh-plugin-wsl-env'
|
|
165
165
|
|
|
166
|
+
# Status route for the sidebar panel: `GET /api/wsl-env/status` lists the
|
|
167
|
+
# installed distros and, for one named distro, runs the quick doctor CLI
|
|
168
|
+
# and returns its digested verdict; `POST` on the same route runs the full
|
|
169
|
+
# doctor with `--fix-owned` (stale scopes and a broken agent cache only,
|
|
170
|
+
# both re-verified) and answers with the fix rows. The route rides the
|
|
171
|
+
# authenticated /api channel (`ctx.connection.fetch`), so only the owner
|
|
172
|
+
# browser reads it; a composition without the Web connection leaves this
|
|
173
|
+
# row inert. Probing a stopped distro boots it, so a check or repair only
|
|
174
|
+
# ever starts from an explicit click — never from listing.
|
|
175
|
+
- id: wsl-status
|
|
176
|
+
name: 'dsh-plugin-wsl-env/status'
|
|
177
|
+
config:
|
|
178
|
+
cacheMs: 15000
|
|
179
|
+
timeoutMs: 90000
|
|
180
|
+
wslPath: wsl.exe
|
|
181
|
+
|
|
166
182
|
# The human-facing `/wsl-doctor` command (the composer button's target):
|
|
167
183
|
# registered globally so any session can run the diagnosis, not only WSL
|
|
168
184
|
# preset agents. The handler spawns the standalone doctor CLI — no model
|
|
@@ -264,7 +280,7 @@
|
|
|
264
280
|
# 2. `tool-bash` is enabled and `tool-pwsh` disabled outright, where the
|
|
265
281
|
# shipped copy derives the choice from `process.platform`;
|
|
266
282
|
# 3. the identity and display metadata: row `preset-wsl`, preset `wsl`,
|
|
267
|
-
# `name`/`description` for the mode selector, `order:
|
|
283
|
+
# `name`/`description` for the mode selector, `order: 1`.
|
|
268
284
|
# Regenerate it when an app update changes the preset: take
|
|
269
285
|
# `packages/bundle/web-app/presets/standard.patch.yml` from the harness tree
|
|
270
286
|
# the peer pins track, replace this row to the end of the file with its
|
|
@@ -278,9 +294,14 @@
|
|
|
278
294
|
# selector falls back to the raw id and "no description" unless the
|
|
279
295
|
# declaration carries its own copy (registry policy: user-authored
|
|
280
296
|
# metadata is never localized — write it in the deployment language).
|
|
281
|
-
|
|
297
|
+
#
|
|
298
|
+
# The name says what it is: 标准模式's capabilities in the distro's
|
|
299
|
+
# world, not a fifth task mode. The order ties with 标准模式 (order 1);
|
|
300
|
+
# the registry sorts equal orders by id, and "standard" sorts before
|
|
301
|
+
# "wsl", so the variant sits directly under the mode it extends.
|
|
302
|
+
name: 标准模式(WSL)
|
|
282
303
|
description: 在 WSL 的 Linux 实例中打开项目工作区:命令执行、shell 脚本和文件访问均在 Linux 空间内完成,以获得全套 Linux shell 工具链,受限命令经 bubblewrap 沙箱隔离。
|
|
283
|
-
order:
|
|
304
|
+
order: 1
|
|
284
305
|
plugins:
|
|
285
306
|
- id: wsl-env
|
|
286
307
|
name: cordis:group
|
package/docs/API.md
CHANGED
|
@@ -9,7 +9,7 @@ this page is the quick tour.
|
|
|
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
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
|
|
12
|
+
| `./client` | — (no importable surface) | the browser half the harness's web client loader serves for the bare-name row: the sidebar status panel and the access-mode prompt |
|
|
13
13
|
| `./fs` | `WslFileSystem` | the filesystem provider over the distro (`ctx.fs`) |
|
|
14
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) |
|
|
15
15
|
| `./fs-routing` | `WslRoutingFileSystem` | the root-plane coordinate router |
|
|
@@ -22,6 +22,7 @@ this page is the quick tour.
|
|
|
22
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
23
|
| `./wsl-doctor-tool` | the `wsl-doctor-tool` row | the `wsl_doctor` model tool: in-process diagnosis with scoping (`depth`, `section`) |
|
|
24
24
|
| `./wsl-doctor-command` | the `wsl-doctor-command` row | the `/wsl-doctor` UI command: spawns the standalone doctor CLI, renders detached from model history |
|
|
25
|
+
| `./status` | the `wsl-status` row | the sidebar panel's route over `/api`: installed distros, one distro's quick doctor, and the `--fix-owned` full run (repair when repairable, full check otherwise); the last result persists across reloads and running distros' stored results refresh in the background |
|
|
25
26
|
| `./paths` | `uncToPosix`, `toLinuxPath`, `toWorldPath`, … | the coordinate mappers |
|
|
26
27
|
| `./picker` | `WslDirectoryPicker` | the distro-aware directory picker |
|
|
27
28
|
| `./auto-preset` | the `auto-preset` row | first-run profile bootstrap |
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -65,7 +65,7 @@ functions.
|
|
|
65
65
|
|
|
66
66
|
| Subpath | Class or name | File | What it does |
|
|
67
67
|
|---|---|---|---|
|
|
68
|
-
| `dsh-plugin-wsl-env/picker` | `WslDirectoryPicker` | [`lib/picker.js`](../lib/picker.js) |
|
|
68
|
+
| `dsh-plugin-wsl-env/picker` | `WslDirectoryPicker` | [`lib/picker.js`](../lib/picker.js) | The folder picker's two worlds: a category root with a Windows branch (starting at the drives) and a WSL branch (one row per installed distro); distro levels list from inside the distro (the resident's `find`, one-shot `wsl.exe` when it is out). |
|
|
69
69
|
| `dsh-plugin-wsl-env/auto-preset` | `auto-preset` | [`lib/auto-preset.js`](../lib/auto-preset.js) | Binds the `wsl` agent preset when a new session's workspace is inside a distro. |
|
|
70
70
|
| `dsh-plugin-wsl-env/shell-env` | `wsl-shell-env` | [`lib/shell-env.js`](../lib/shell-env.js) | Contributes `DSH_WSL_DISTRO`, `DSH_WSL_SHELL`, `DSH_WSL_HOME` and `DSH_WSL_PORTS` to the managed `DSH_*` namespace, choosing the session workspace's distro (default/pinned facts are probed at mount; other distros are warmed when their session appears). The port list is a snapshot per active distro, refreshed every `portsRefreshMs` (10000 by default), so a server started moments ago may not be listed yet. |
|
|
71
71
|
| `dsh-plugin-wsl-env/preflight` | `wsl-preflight` | [`lib/preflight.js`](../lib/preflight.js) | Runs the environment advisory at session start — and, with `startup: true` (the default), once at plugin load — surfacing the doctor-style verdict as a non-gating warning. |
|
|
@@ -74,7 +74,8 @@ functions.
|
|
|
74
74
|
| `dsh-plugin-wsl-env/cwd-prompt-tool` | `wsl-cwd-prompt-tool` | [`lib/cwd-prompt-tool.js`](../lib/cwd-prompt-tool.js) | Serves the model's read/`cd` tool with the same semantics the harness ships, rewriting the returned `cwd` to the distro's POSIX form. |
|
|
75
75
|
| `dsh-plugin-wsl-env/wsl-doctor-tool` | `wsl-doctor-tool` | [`lib/wsl-doctor-tool.js`](../lib/wsl-doctor-tool.js) | The `wsl_doctor` model tool: the doctor in-process (merging the live resident's state), scoped by `depth`/`section`, rendered as the itemized digest. |
|
|
76
76
|
| `dsh-plugin-wsl-env/wsl-doctor-command` | `wsl-doctor-command` | [`lib/wsl-doctor-command.js`](../lib/wsl-doctor-command.js) | The `/wsl-doctor` UI command: spawns the standalone doctor CLI as a host subprocess and renders the same digest detached from model history. |
|
|
77
|
-
| `dsh-plugin-wsl-env`
|
|
77
|
+
| `dsh-plugin-wsl-env/status` | `wsl-status` | [`lib/status.js`](../lib/status.js) | The sidebar panel's route (`GET /api/wsl-env/status`): lists the installed distros and runs one distro's quick doctor; `POST` on the same route runs the full doctor with `--fix-owned` (labeled repair when stale scopes or a broken agent cache are repairable, a full check otherwise; both re-verified). Answered over the Host connection's authenticated exact-Fetch channel; the last result per distro is persisted under `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json` and stored results for running distros are refreshed in the background. |
|
|
78
|
+
| `dsh-plugin-wsl-env` (bare name) | `wsl-env-client-host` | [`lib/client-host.js`](../lib/client-host.js) | The deliberate no-op host half whose bare-name mount lets the web client roster serve `./client`: the sidebar's WSL environment panel and the post-add access-mode prompt. |
|
|
78
79
|
|
|
79
80
|
Three modules support them and import no DSH package.
|
|
80
81
|
[`lib/paths.js`](../lib/paths.js) translates paths.
|
|
@@ -97,7 +98,7 @@ The environment is per session, not per process:
|
|
|
97
98
|
| `subprocess-wsl` | at the app level, called the composition; the shipped `subprocess` row is disabled | because no session identity reaches the terminal controller, see below |
|
|
98
99
|
| `workspace-files` | shipped, not replaced | its client half is the browser `file` resource provider the Sidebar previews need; it reads WSL paths through the routed root filesystem |
|
|
99
100
|
| `fs-routing` | at the app level; the shipped `fs-sandbox` row is disabled | the root `ctx.fs` is session-less, and its write fence has no root-plane consumers |
|
|
100
|
-
| `directory-picker-wsl`, `wsl-shell-env`, `auto-preset`, `wsl-preflight`, `wsl-update-check`, `wsl-cwd-prompt`, `wsl-cwd-prompt-tool`, `wsl-doctor-command`, `wsl-env-client-host` | at the app level | they answer questions that are not scoped to a single preset; `shell-env` resolves its facts per session workspace, and the advisory/diagnosis rows must answer even when a session never opens |
|
|
101
|
+
| `directory-picker-wsl`, `wsl-shell-env`, `auto-preset`, `wsl-preflight`, `wsl-update-check`, `wsl-cwd-prompt`, `wsl-cwd-prompt-tool`, `wsl-doctor-command`, `wsl-status`, `wsl-env-client-host` | at the app level | they answer questions that are not scoped to a single preset; `shell-env` resolves its facts per session workspace, and the advisory/diagnosis rows must answer even when a session never opens |
|
|
101
102
|
| `wsl-doctor-tool` | inside `preset-wsl` (model-facing) | the tool surface follows the preset: a session on a Windows folder keeps the shipped tools |
|
|
102
103
|
|
|
103
104
|
The preset mount requires the isolate realms. Without them the registry rejects the
|
|
@@ -495,6 +496,8 @@ src/terminal-route.ts which execution world a terminal launch belongs to
|
|
|
495
496
|
src/update-check.ts the once-a-day update notice (fact store +
|
|
496
497
|
host-delegated check)
|
|
497
498
|
src/watcher.ts in-distro file watching for WslFileSystem.watch
|
|
499
|
+
src/status.ts the panel's route (distro list, one distro's
|
|
500
|
+
quick doctor, and the --fix-owned repair over /api)
|
|
498
501
|
src/wsl-doctor-command.ts the `/wsl-doctor` UI command row (spawns the
|
|
499
502
|
standalone doctor CLI)
|
|
500
503
|
src/wsl-doctor-tool.ts the `wsl_doctor` model tool row (in-process diagnosis)
|
|
@@ -535,7 +538,8 @@ standalone CLI (peer-free by design, so it starts when the plugin's own
|
|
|
535
538
|
runtime is broken), the `/wsl-doctor` UI command (spawns the CLI host-side,
|
|
536
539
|
renders detached from model history), and the `wsl_doctor` model tool
|
|
537
540
|
(in-process, merging the live resident's state through `lib/doctor-live.js`).
|
|
538
|
-
|
|
541
|
+
The sidebar panel renders the quick digest and posts the repair action the
|
|
542
|
+
same way (`--fix-owned`: plugin-owned state only). A run can be scoped (`--quick`, `--sections <csv>` on the CLI; `depth` /
|
|
539
543
|
`section` on the tool), and the report itemizes every check grouped by
|
|
540
544
|
distro. See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the surfaces and the
|
|
541
545
|
verdict contract.
|
package/docs/COMPATIBILITY.md
CHANGED
|
@@ -76,6 +76,11 @@ Alpine (musl).
|
|
|
76
76
|
| Alpine | Import the **minirootfs** tarball (`wsl --import`), not the standard/cloud images. Create a normal user and set `[user] default=…` in `/etc/wsl.conf` — the imported default is root, and a root agent writes 0600 files the probe user cannot read. Install `coreutils util-linux` (busybox `mktemp`/`ps` lack the used options) and `shadow` for `useradd`. |
|
|
77
77
|
| Fedora / openSUSE / Arch | systemd PID 1 out of the box. openSUSE: `zypper --non-interactive` (the plain `-y` still prompts); Arch: `pacman -Sy --needed`. |
|
|
78
78
|
|
|
79
|
+
On a minimal Alpine image the **shell** agent's FSB enumeration needs GNU
|
|
80
|
+
`findutils` (BusyBox `find` lacks `-printf`); the packaged native agent does
|
|
81
|
+
not, and `auto` prefers it. Install `findutils` only when pinning
|
|
82
|
+
`agentBackend: shell` — the doctor decodes the failure and names that package.
|
|
83
|
+
|
|
79
84
|
Dependencies used everywhere: `bash bubblewrap git nodejs` (node 20–26 all
|
|
80
85
|
pass; the plugin's `engines` floor applies to the harness host, not to probe
|
|
81
86
|
nodes). The probe runner per distro, from inside the distro:
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -12,11 +12,17 @@ rows and values shipped by this plugin.
|
|
|
12
12
|
A profile layer can target a top-level row by `id`. Plugin rows at that level
|
|
13
13
|
include `fs-routing`, `directory-picker-wsl`, `subprocess-wsl`, `wsl-shell-env`,
|
|
14
14
|
`wsl-preflight`, `auto-preset`, `wsl-cwd-prompt`, `wsl-cwd-prompt-tool`,
|
|
15
|
-
`wsl-update-check`, `wsl-doctor-command`, `wsl-env-client-host`, and
|
|
15
|
+
`wsl-update-check`, `wsl-doctor-command`, `wsl-status`, `wsl-env-client-host`, and
|
|
16
16
|
`preset-wsl`. The `wsl-shell`, `wsl-fs` and `wsl-doctor-tool` rows are nested
|
|
17
17
|
inside `preset-wsl.config.plugins`; a profile entry targeting those ids directly
|
|
18
18
|
is ignored with a `patch: entry <id> not found` warning.
|
|
19
19
|
|
|
20
|
+
A root-level `- id: wsl-shell` / `wsl-fs` entry patches a top-level row that
|
|
21
|
+
does not exist in the shipped composition, so it is ignored with a warning.
|
|
22
|
+
An entry indented under `- insert:` is a different thing: it adds a real
|
|
23
|
+
top-level row, which is how a probe profile can mount these providers without
|
|
24
|
+
the preset. The doctor's `config.preset-trap` check only reports the former.
|
|
25
|
+
|
|
20
26
|
A row's `config` is replaced as a whole. Include any non-default values from
|
|
21
27
|
the bundled row that you want to retain. This matters most for `preset-wsl`,
|
|
22
28
|
whose config contains the complete preset and its nested plugins.
|
|
@@ -112,7 +118,7 @@ The root router is app-level, not session-owned, so it does not use
|
|
|
112
118
|
| Row | Key | Default / shipped value | Description |
|
|
113
119
|
|---|---|---|---|
|
|
114
120
|
| `directory-picker-wsl` | `preferredDistro` | `''` (shipped) | Distro shown first and used for the Home location. |
|
|
115
|
-
| | `includeHostHome` | `true` (shipped) |
|
|
121
|
+
| | `includeHostHome` | `true` (shipped) | Offer the Windows path branch; its walk starts at the drive roots. |
|
|
116
122
|
| | `maxEntries` | `1000` (shipped) | Maximum entries returned for one directory. |
|
|
117
123
|
| | `wslPath` | `wsl.exe` | Path to `wsl.exe`. |
|
|
118
124
|
| | `distroCacheMs` | `5000` | Cache lifetime for the distro list. |
|
|
@@ -133,6 +139,10 @@ The root router is app-level, not session-owned, so it does not use
|
|
|
133
139
|
| `auto-preset` | `preset` | `wsl` | Preset to bind when a session workspace is inside a distro. An explicit operator selection is preserved. |
|
|
134
140
|
| | `attempts` | `6` | Number of attempts to bind the preset. |
|
|
135
141
|
| | `retryMs` | `150` | Delay between attempts, in milliseconds. |
|
|
142
|
+
| | `windowsWorkspaces` | `[]` | Distro directories opened for Windows access (UNC paths). Sessions under them keep the host preset; the add-workspace prompt writes here, and Settings can change it back. |
|
|
143
|
+
| `wsl-status` | `cacheMs` | `15000` | How long one distro's verdict stays fresh in memory, in milliseconds (the last result is persisted separately). |
|
|
144
|
+
| | `timeoutMs` | `90000` | Deadline for one check or repair run, in milliseconds. |
|
|
145
|
+
| | `wslPath` | `wsl.exe` | `wsl.exe` used to list the distros. |
|
|
136
146
|
| `wsl-preflight` | `distro` | `''` | Distro to check. Empty or `auto` follows the session workspace. |
|
|
137
147
|
| | `wslPath` | `wsl.exe` | Path to `wsl.exe`. |
|
|
138
148
|
| | `sandbox` | `true` | Run the session-start `bwrap` check. |
|
|
@@ -300,13 +310,17 @@ It also checks
|
|
|
300
310
|
the session-runtime prerequisites when `sessionSandbox: true`. The warning is
|
|
301
311
|
advisory: it does not install packages or change the providers' fail-closed
|
|
302
312
|
behavior. Set `sandbox: false` on this row or remove it to silence the
|
|
303
|
-
|
|
313
|
+
preflight warning. Set `sessionSandbox: false` when the profile does not use a
|
|
304
314
|
session runtime.
|
|
305
315
|
|
|
306
316
|
Setting `sandbox: false` on `wsl-shell` or `wsl-fs` runs commands or writes
|
|
307
317
|
without confinement; their `sandboxMode` becomes `undefined`. The tool layer
|
|
308
318
|
reports that no sandbox is active. On `fs-routing`, the setting disables the
|
|
309
|
-
mutation fence; that row reports `sandboxMode: undefined` either way.
|
|
319
|
+
mutation fence; that row reports `sandboxMode: undefined` either way. When
|
|
320
|
+
every surface opts out — `sandbox: false` on all three rows *and*
|
|
321
|
+
`sessionSandbox: false` — the doctor still reports it, as a **warning** that
|
|
322
|
+
names the unconfined posture and skips the fence smoke; the opt-out never
|
|
323
|
+
blocks the verdict.
|
|
310
324
|
|
|
311
325
|
### Message language
|
|
312
326
|
|
|
@@ -359,20 +373,34 @@ the peer floor, a fresh agent handshake, stale session scopes, the known
|
|
|
359
373
|
profile-patch and deprecated-key traps — each failure with a copyable remedy.
|
|
360
374
|
The run ends in a verdict (`ready` or `blocked`) computed under the effective
|
|
361
375
|
configuration: `--json` is the machine contract (schemaVersion 2), `--fix`
|
|
362
|
-
re-verifies what it fixed (
|
|
363
|
-
|
|
376
|
+
re-verifies what it fixed (the plugin-owned stale-scope sweep and agent-cache
|
|
377
|
+
purge are automatic; packages need `--fix --install` and an explicit
|
|
378
|
+
confirmation; `--fix-owned` restricts a run to the plugin-owned two), `--all`
|
|
379
|
+
checks every installed distro, `--bundle
|
|
364
380
|
<path>` writes the attachable diagnostic file (`--redact` strips the paths),
|
|
365
381
|
and `--locale <tag>` (or `DSH_WSL_DOCTOR_LOCALE`) selects the skeleton
|
|
366
382
|
language without re-probing. `--yes` skips the confirmation prompt (not the
|
|
367
383
|
confirmation gate itself), and `--read-only` refuses to run together with
|
|
368
|
-
`--fix` or `--install`.
|
|
369
|
-
registries the on-demand update check asks (comma-separated; empty skips
|
|
370
|
-
it — for air-gapped machines).
|
|
384
|
+
`--fix` or `--install`.
|
|
371
385
|
See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the verdict contract and the
|
|
372
386
|
error-code map. With the CLI distribution, `dsh --profile <name> --dump-config` inspects
|
|
373
387
|
the composed profile without booting it and shows whether a row override
|
|
374
388
|
applied; the desktop app has no `dsh` command, so read `cordis.patch.yml` and
|
|
375
389
|
the Plugins page there.
|
|
390
|
+
The sidebar's **WSL environment** panel renders the same quick digest over
|
|
391
|
+
`GET /api/wsl-env/status` and posts the full-run action to the same route: a
|
|
392
|
+
doctor run with `--fix-owned`, which sweeps stale session scopes and purges a
|
|
393
|
+
broken agent cache, then re-verifies both. Each row states when the check ran, its source (manual or background) and its
|
|
394
|
+
result structure (per-status totals and per-section tallies). The last result
|
|
395
|
+
per distro is stored at `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`
|
|
396
|
+
(`~/.dsh/...` when the host names no home), so a page reload or app restart
|
|
397
|
+
still shows it. On load, a stored result for a distro that is currently
|
|
398
|
+
running is re-checked in the background; a failed background run overwrites
|
|
399
|
+
the stored result. Nothing is labeled expired — delete the file to reset the
|
|
400
|
+
panel's history. The label follows the report: **修复** when
|
|
401
|
+
such a repairable finding is present, **完整检查** otherwise; every other
|
|
402
|
+
warning keeps its manual remedy. It never installs packages or rewrites
|
|
403
|
+
Windows-owned or user configuration.
|
|
376
404
|
Use `scripts/bootstrap.sh <distro>` to inspect distro prerequisites.
|
|
377
405
|
|
|
378
406
|
| Symptom | Result | Action |
|
package/docs/CONFIGURATION.zh.md
CHANGED
|
@@ -12,11 +12,16 @@ profile 设置存放在 `$DSH_HOME/profiles/<name>/cordis.patch.yml`。可以用
|
|
|
12
12
|
profile 层可以按 `id` 指向顶层行。这一层的插件行包括 `fs-routing`、
|
|
13
13
|
`directory-picker-wsl`、`subprocess-wsl`、`wsl-shell-env`、`wsl-preflight`、
|
|
14
14
|
`auto-preset`、`wsl-cwd-prompt`、`wsl-cwd-prompt-tool`、`wsl-update-check`、
|
|
15
|
-
`wsl-doctor-command`、`wsl-env-client-host` 和 `preset-wsl`。
|
|
15
|
+
`wsl-doctor-command`、`wsl-status`、`wsl-env-client-host` 和 `preset-wsl`。
|
|
16
16
|
`wsl-shell`、`wsl-fs` 与 `wsl-doctor-tool` 嵌套在
|
|
17
17
|
`preset-wsl.config.plugins` 内;直接按这些 id 配置的 profile 条目会被忽略,
|
|
18
18
|
并产生 `patch: entry <id> not found` 警告。
|
|
19
19
|
|
|
20
|
+
根级的 `- id: wsl-shell` / `wsl-fs` 条目会去 patch 一个在随包组合里并不存在的
|
|
21
|
+
顶层行,因此被忽略并给出告警;缩进在 `- insert:` 下的条目是另一回事——它会新增
|
|
22
|
+
一个真实的顶层行,探针 profile 正是用这种方式在不启用 preset 的情况下挂载这两个
|
|
23
|
+
provider。doctor 的 `config.preset-trap` 只报告前者。
|
|
24
|
+
|
|
20
25
|
一行的 `config` 是整体替换。如果你想保留随包行中的非默认值,
|
|
21
26
|
必须把它们一并写入。这对 `preset-wsl` 尤其重要:
|
|
22
27
|
它的 config 包含完整的 preset 及其嵌套插件。
|
|
@@ -110,7 +115,7 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
|
|
|
110
115
|
| 行 | 键 | 默认 / shipped 值 | 说明 |
|
|
111
116
|
|---|---|---|---|
|
|
112
117
|
| `directory-picker-wsl` | `preferredDistro` | `''`(shipped) | 首位展示的发行版,也是 Home 位置使用的发行版。 |
|
|
113
|
-
| | `includeHostHome` | `true`(shipped) |
|
|
118
|
+
| | `includeHostHome` | `true`(shipped) | 提供 Windows 路径分支;该分支从驱动器根开始。 |
|
|
114
119
|
| | `maxEntries` | `1000`(shipped) | 单个目录返回的最大条目数。 |
|
|
115
120
|
| | `wslPath` | `wsl.exe` | `wsl.exe` 的路径。 |
|
|
116
121
|
| | `distroCacheMs` | `5000` | 发行版列表的缓存时长。 |
|
|
@@ -131,6 +136,10 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
|
|
|
131
136
|
| `auto-preset` | `preset` | `wsl` | 会话工作区位于发行版内时绑定的 preset。操作者的显式选择会被保留。 |
|
|
132
137
|
| | `attempts` | `6` | 绑定 preset 的尝试次数。 |
|
|
133
138
|
| | `retryMs` | `150` | 两次尝试之间的延迟,单位毫秒。 |
|
|
139
|
+
| | `windowsWorkspaces` | `[]` | 以 Windows 访问方式打开的发行版目录(UNC 路径)。这些路径下的会话保留宿主 preset;添加工作区时的访问方式选择会写入这里,设置页可改回。 |
|
|
140
|
+
| `wsl-status` | `cacheMs` | `15000` | 单个发行版判定在内存中的新鲜时间,单位毫秒(最后一次结果另行持久化)。 |
|
|
141
|
+
| | `timeoutMs` | `90000` | 单次检查或修复运行的死线,单位毫秒。 |
|
|
142
|
+
| | `wslPath` | `wsl.exe` | 列出发行版用的 `wsl.exe`。 |
|
|
134
143
|
| `wsl-preflight` | `distro` | `''` | 要检查的发行版。空或 `auto` 跟随会话工作区。 |
|
|
135
144
|
| | `wslPath` | `wsl.exe` | `wsl.exe` 的路径。 |
|
|
136
145
|
| | `sandbox` | `true` | 运行会话启动时的 `bwrap` 检查。 |
|
|
@@ -287,13 +296,15 @@ wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
|
|
|
287
296
|
重启之后判定就已经出现在日志里,该发行版上的会话只会重复注入运行时上下文条目。
|
|
288
297
|
`sessionSandbox: true` 时,它还会检查会话 runtime 的前置条件。
|
|
289
298
|
该警告仅供参考:它不会安装软件包,也不会改变提供者关闭(fail-closed)
|
|
290
|
-
的行为。在该行设置 `sandbox: false`
|
|
299
|
+
的行为。在该行设置 `sandbox: false` 或移除该行可让预检警告静音。
|
|
291
300
|
profile 不使用会话 runtime 时,设置 `sessionSandbox: false`。
|
|
292
301
|
|
|
293
302
|
在 `wsl-shell` 或 `wsl-fs` 上设置 `sandbox: false` 后,命令或写入
|
|
294
303
|
将无约束地运行;其 `sandboxMode` 变为 `undefined`。工具层
|
|
295
304
|
会报告没有沙箱生效。在 `fs-routing` 上,该设置会禁用变更围栏;
|
|
296
|
-
无论开关如何,该行都报告 `sandboxMode: undefined
|
|
305
|
+
无论开关如何,该行都报告 `sandboxMode: undefined`。当所有表面都选择
|
|
306
|
+
退出——三行均为 `sandbox: false` 且 `sessionSandbox: false`——doctor
|
|
307
|
+
仍会以**警告**点名无约束状态并跳过围栏冒烟;该选择退出永不阻断裁决。
|
|
297
308
|
|
|
298
309
|
### 消息语言
|
|
299
310
|
|
|
@@ -332,16 +343,25 @@ profile 不使用会话 runtime 时,设置 `sessionSandbox: false`。
|
|
|
332
343
|
bubblewrap、systemd/Linger、peer 下限、新 agent 握手、残留会话 scope、已知的
|
|
333
344
|
profile 补丁与废弃键陷阱——每个失败附可复制的修复。运行以生效配置下计算的
|
|
334
345
|
裁决(`ready` 或 `blocked`)收尾:`--json` 是机器契约(schemaVersion 2),
|
|
335
|
-
`--fix`
|
|
336
|
-
`--
|
|
346
|
+
`--fix` 复核它修过的项(插件自有的残留 scope 清扫与 agent 缓存清理是
|
|
347
|
+
自动的;安装软件包需要 `--fix --install` 并显式确认;`--fix-owned` 把运行
|
|
348
|
+
限定在插件自有的这两类),`--all` 检查每个已装发行版,`--bundle <路径>` 写出可附加的诊断文件
|
|
337
349
|
(`--redact` 脱敏路径),`--locale <标签>`(或 `DSH_WSL_DOCTOR_LOCALE`)
|
|
338
350
|
无需重新探测即可选择骨架语言。`--yes` 跳过确认提示(不跳过确认门本身),
|
|
339
|
-
`--read-only` 拒绝与 `--fix` 或 `--install`
|
|
340
|
-
查询可用 `DSH_UPDATE_REGISTRIES` 覆盖(逗号分隔;置空即跳过,气隙机器适用)。
|
|
351
|
+
`--read-only` 拒绝与 `--fix` 或 `--install` 同用。
|
|
341
352
|
判定契约与错误码地图见 [DIAGNOSTICS.zh.md](DIAGNOSTICS.zh.md)。
|
|
342
353
|
CLI 发行版可用 `dsh --profile <name> --dump-config` 检查合成后的 profile,
|
|
343
354
|
无需真正启动;输出会显示某行的覆盖是否生效。桌面应用没有 `dsh` 命令,
|
|
344
355
|
请直接查看 `cordis.patch.yml` 与 Plugins 页面。
|
|
356
|
+
侧边栏的 **WSL 环境** 面板经 `GET /api/wsl-env/status` 渲染同一份快速摘要,
|
|
357
|
+
并把完整运行动作提交到同一路由:以 `--fix-owned` 运行 doctor,清扫残留
|
|
358
|
+
session scope、清理损坏的 agent 缓存并逐一复检。行内显示上次检查时间、来源(手动或后台)与结果结构(各状态计数与分区分布)。
|
|
359
|
+
每个发行版的最后一次结果存放在 `$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`
|
|
360
|
+
(宿主未指定 home 时为 `~/.dsh/...`),页面刷新或应用重启后仍可见。加载时会对
|
|
361
|
+
正在运行的发行版在后台复核;后台失败会覆盖已存结果。不标记“已过期”——删除该
|
|
362
|
+
文件即可重置面板历史。按钮标签随报告切换:
|
|
363
|
+
存在这类可自动修复项时显示“修复”,否则显示“完整检查”;其余告警保留各自的
|
|
364
|
+
手动处理办法。它不会安装软件包,也不会改写 Windows 或用户所有的配置。
|
|
345
365
|
使用 `scripts/bootstrap.sh <distro>` 检查发行版前置依赖。
|
|
346
366
|
|
|
347
367
|
| 现象 | 结果 | 处理 |
|
package/docs/DIAGNOSTICS.md
CHANGED
|
@@ -23,8 +23,14 @@ reports what was read and from where.
|
|
|
23
23
|
distro(s) under the expected scope; the smoke legs (`functional.exec`,
|
|
24
24
|
`functional.sandbox`, `functional.fs`) prove the chain itself — frame I/O,
|
|
25
25
|
the confined fence, the batched substrate — not just the prerequisites.
|
|
26
|
-
|
|
27
|
-
`
|
|
26
|
+
`functional.exec` / `functional.fs` run the shell agent; when `auto` or
|
|
27
|
+
`native` selects the native binary, `functional.native` runs the same EXEC and
|
|
28
|
+
FSB chain over it. The shell agent is then the fallback, so its failures are
|
|
29
|
+
warnings and name their cause (a BusyBox distro without GNU `find` reports
|
|
30
|
+
`find: unrecognized: -printf` and the `findutils` remedy) — unless the shell
|
|
31
|
+
agent is the configured backend, or neither backend answers, where the leg
|
|
32
|
+
blocks. A leg whose prerequisite failed reports `skipped` with the blocker
|
|
33
|
+
named; `skipped` never blocks. A read the transport could not vouch for — `wsl.exe`
|
|
28
34
|
timed out or wedged mid-probe, common when several distros are probed
|
|
29
35
|
concurrently and one of them is cold-booting — reports `unknown` after one
|
|
30
36
|
automatic retry, names the flake in its detail, and never blocks or feeds a
|
|
@@ -33,10 +39,14 @@ that the file is broken. Rerun the doctor for a clean answer.
|
|
|
33
39
|
|
|
34
40
|
`--fix` ends in a re-verified report: every fix is followed by a fresh probe
|
|
35
41
|
of what it claims to have fixed, the affected checks carry the after state,
|
|
36
|
-
and the verdict is recomputed — `ready`, or the remaining blockers.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
and the verdict is recomputed — `ready`, or the remaining blockers. The
|
|
43
|
+
plugin-owned state is repaired automatically: the stale-scope sweep and a
|
|
44
|
+
purge of the agent cache when an entry is not executable (the handshake is
|
|
45
|
+
re-probed after the purge). `--fix-owned` narrows a run to exactly those two —
|
|
46
|
+
the sidebar panel's repair action uses it — and cannot be combined with
|
|
47
|
+
`--install`. Remedies that rewrite user- or distro-owned files (`.wslconfig`,
|
|
48
|
+
`/etc/wsl.conf`, a WSL1 conversion, installing a distro) are never automated;
|
|
49
|
+
the remedy text says so.
|
|
40
50
|
|
|
41
51
|
`--bundle <path>` writes a local JSON file (report + versions + effective
|
|
42
52
|
configuration) for a setup report; `--redact` replaces home and DSH paths
|
|
@@ -45,22 +55,38 @@ environment variables, and no telemetry.
|
|
|
45
55
|
|
|
46
56
|
## The surfaces
|
|
47
57
|
|
|
48
|
-
The doctor answers through three surfaces with one report
|
|
58
|
+
The doctor answers through three surfaces with one report; the sidebar's
|
|
59
|
+
**WSL environment** panel renders the same quick digest over its own route and
|
|
60
|
+
posts the full-run action (`--fix-owned`, labeled 修复 or 完整检查):
|
|
49
61
|
|
|
50
|
-
- **The standalone CLI** — `node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--install] [--yes] [--read-only] [--bundle <path>] [--redact] [--locale <tag>]`
|
|
62
|
+
- **The standalone CLI** — `node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <path>] [--redact] [--locale <tag>]`
|
|
51
63
|
(the same line `--help` prints).
|
|
52
64
|
The authoritative surface: it loads **no peer dependency and no host
|
|
53
65
|
service**, so it still starts when the plugin's own runtime is the thing
|
|
54
|
-
that is broken. Only pure, peer-free `lib/` modules are imported; the
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- **The `/wsl-doctor` UI command** —
|
|
60
|
-
`/wsl-doctor [quick|full|<section>] [--distro <name>]`
|
|
66
|
+
that is broken. Only pure, peer-free `lib/` modules are imported; the one
|
|
67
|
+
helper that used to live behind a peer-tainted module (`lib/index.js`) is
|
|
68
|
+
inlined and drift-pinned against the lib export by `test/doctor.test.mjs`. Exit 0 = `ready`, 1 = `blocked`, 2 = refused
|
|
69
|
+
(`--read-only` with `--fix`/`--install`, `--fix-owned` with `--install`, or
|
|
70
|
+
`--fix` on a scoped run).
|
|
71
|
+
- **The `/wsl-doctor` UI command** — typing
|
|
72
|
+
`/wsl-doctor [quick|full|<section>] [--distro <name>]` in the composer — the commands
|
|
61
73
|
registry executes it host-side, the handler spawns the standalone CLI, and
|
|
62
74
|
the itemized report renders detached from model history (no model turn, no
|
|
63
|
-
tokens).
|
|
75
|
+
tokens). The sidebar's **WSL environment** panel runs the same quick
|
|
76
|
+
check per distro through the authenticated status route, showing a badge with
|
|
77
|
+
numbered failing items and warnings, and a second action on a checked row: the full doctor with `--fix-owned`,
|
|
78
|
+
labeled **修复** when the report carries a repairable finding (stale scopes
|
|
79
|
+
or a broken agent cache) and **完整检查** otherwise, answered with its
|
|
80
|
+
before → after fix rows. The row also states when the check ran, its source
|
|
81
|
+
(manual or the page-load background refresh), and how its results landed —
|
|
82
|
+
per-status totals and per-section tallies. Each checked row expands to the
|
|
83
|
+
full list of checks that run executed, grouped by section with each status
|
|
84
|
+
and its evidence; the catalog rows a quick run never touched are counted
|
|
85
|
+
(`N more in the full run`), not listed as results. The last result is stored locally
|
|
86
|
+
(`$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`, falling back to `~/.dsh`)
|
|
87
|
+
so a reload still shows it; a background refresh runs only for distros that
|
|
88
|
+
are already up, and a failed one replaces the stored result as observed.
|
|
89
|
+
Manual warnings keep their remedies; full diagnosis still uses the entry above and `/wsl-doctor`. Without a command adapter (headless, ACP) the row is a no-op and
|
|
64
90
|
the CLI is the surface. Without `--distro` the handler names the distro from
|
|
65
91
|
the session's live working directory (the agent-scoped `workingDirectory`
|
|
66
92
|
service first, then the Session header's `cwd`); when neither yields a WSL
|
|
@@ -94,7 +120,7 @@ Class legend:
|
|
|
94
120
|
| `SANDBOX_UNAVAILABLE` | environment | `sandbox.bwrap`, `sandbox.bwrap-usable`, `functional.sandbox` | the requested confinement cannot be enforced (no usable bubblewrap) |
|
|
95
121
|
| `FS_SANDBOX_DENIED` | policy | `functional.sandbox` (the fence shape) | the file-effect policy refused the write, or the kernel refused it at the resident's profile |
|
|
96
122
|
| `FS_OUTSIDE_DISTRO` | policy | `config.effective` (the effective `distro`) | the path names another distro's share while the fence is pinned |
|
|
97
|
-
| `FS_IO_ERROR` | environment | `distro.reachable`, `distro.disk`, `agent.handshake`, `functional.exec`, `functional.fs` | the catch-all: an agent outage, a wedged distro, a full disk, an unmappable path |
|
|
123
|
+
| `FS_IO_ERROR` | environment | `distro.reachable`, `distro.disk`, `host.disk`, `agent.handshake`, `agent.home-writable`, `functional.exec`, `functional.fs` | the catch-all: an agent outage, a wedged distro, a full disk, an unmappable path |
|
|
98
124
|
| `FS_NOT_FOUND` | data | — | the path does not exist — the ordinary answer |
|
|
99
125
|
| `FS_NOT_REGULAR_FILE` | data | — | a directory, symlink or device where a regular file is required |
|
|
100
126
|
| `FS_NOT_DIRECTORY` | data | — | a list was asked of a non-directory |
|
|
@@ -107,7 +133,7 @@ Class legend:
|
|
|
107
133
|
| `FS_AMBIGUOUS_EDIT` | data | — | the literal edit matched more than once |
|
|
108
134
|
| `FS_PATCH_MISMATCH` | data | — | the hunks no longer match the file; rebuild them |
|
|
109
135
|
| `FS_SAME_TARGET` | data | — | a move whose source and destination are the same file |
|
|
110
|
-
| `AgentUnavailableError` | environment | `agent.handshake`, `agent.native`, `agent.cache`, `functional.exec` | the execution layer's revival budget is spent; the named state says so |
|
|
136
|
+
| `AgentUnavailableError` | environment | `agent.handshake`, `agent.native`, `agent.cache`, `agent.home-writable`, `functional.exec`, `functional.native` | the execution layer's revival budget is spent; the named state says so |
|
|
111
137
|
|
|
112
138
|
The agent's structured FS reasons (`notfound`, `notdir`, `perm`, `loop`,
|
|
113
139
|
`stale`, `io`) map onto the codes above at `lib/fsio-agent.js`; the wire
|
package/docs/DIAGNOSTICS.zh.md
CHANGED
|
@@ -14,11 +14,18 @@
|
|
|
14
14
|
`sessionSandbox: true` 时 fail;`auto` 点名其 per-command 回退,`false`
|
|
15
15
|
点名选择退出,两者均为 warn),因此裁决回答的是**生效配置**——应用实际
|
|
16
16
|
加载的 profile 层叠加在出厂 preset 之上——而不是出厂默认。`config.effective`
|
|
17
|
-
|
|
17
|
+
检查报告读到了什么、从哪里读的。有意的选择退出从不构成失败:当所有表面都
|
|
18
|
+
关闭隔离(`sandbox: false` 且 `sessionSandbox: false`),沙箱检查发出
|
|
19
|
+
**警告**点名 UNCONFINED 状态,并跳过围栏冒烟——醒目,但不阻断。
|
|
18
20
|
|
|
19
21
|
`verdict: ready` 表示首条命令应在目标 distro、预期 scope 下成功;smoke 腿
|
|
20
22
|
(`functional.exec`、`functional.sandbox`、`functional.fs`)证明链路本身——
|
|
21
|
-
帧 I/O、受限围栏、批量 substrate
|
|
23
|
+
帧 I/O、受限围栏、批量 substrate——而不只是前置条件。`functional.exec` /
|
|
24
|
+
`functional.fs` 运行 shell agent;当 `auto` 或 `native` 选中 native 二进制时,
|
|
25
|
+
`functional.native` 在它之上跑同一条 EXEC 与 FSB 链路。此时 shell agent 是
|
|
26
|
+
回退,其失败降为警告并点名原因(未装 GNU `find` 的 BusyBox 会报
|
|
27
|
+
`find: unrecognized: -printf`,并给出 `findutils` 的处理办法)——除非配置
|
|
28
|
+
钉死 shell agent,或两个后端都答不出,则仍为阻断。前置失败的腿以
|
|
22
29
|
`skipped` 报告并点名阻断者;`skipped` 永不阻断。传输层无法担保的读数——
|
|
23
30
|
`wsl.exe` 超时或探测中途卡死(多个 distro 并发探测、其中一个正在冷启动时
|
|
24
31
|
最常见)——在自动重试一次后报告 `unknown`,detail 点名该次抖动;`unknown`
|
|
@@ -27,8 +34,11 @@
|
|
|
27
34
|
|
|
28
35
|
`--fix` 以复验报告收尾:每个修复后都跟着一次对它声称修好的东西的全新探查,
|
|
29
36
|
受影响的检查项携带 after 状态,verdict 重算——`ready`,或剩余阻断者。
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
插件自有状态会被自动修复:残留 scope 清扫,以及缓存条目不可执行时清理
|
|
38
|
+
agent 缓存(清理后重新握手)。`--fix-owned` 把运行收窄到这两类——侧边栏
|
|
39
|
+
面板的“修复”动作即用它——且不能与 `--install` 同用。会改写用户或 distro
|
|
40
|
+
所有文件的修复(`.wslconfig`、`/etc/wsl.conf`、WSL1 转换、安装 distro)
|
|
41
|
+
永不开启自动化;补救文本会写明。
|
|
32
42
|
|
|
33
43
|
`--bundle <path>` 写出本地 JSON 文件(报告 + 版本 + 生效配置)供 setup
|
|
34
44
|
report 附带;`--redact` 把 home 与 DSH 路径替换为 `<redacted-*>` 占位符。
|
|
@@ -36,20 +46,30 @@ bundle 不含文件内容、环境变量,也没有遥测。
|
|
|
36
46
|
|
|
37
47
|
## 三个入口
|
|
38
48
|
|
|
39
|
-
doctor
|
|
49
|
+
doctor 通过三个入口给出同一份报告;侧边栏的 **WSL 环境** 面板经自己的
|
|
50
|
+
路由渲染同一份快速摘要,并提交完整运行动作(`--fix-owned`,按报告标为修复或完整检查):
|
|
40
51
|
|
|
41
|
-
- **独立 CLI**——`node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--install] [--yes] [--read-only] [--bundle <路径>] [--redact] [--locale <标签>]`
|
|
52
|
+
- **独立 CLI**——`node scripts/doctor.mjs [distro] [--all] [--json] [--quick] [--sections host,sandbox,session,conf,net,agent] [--fix] [--fix-owned] [--install] [--yes] [--read-only] [--bundle <路径>] [--redact] [--locale <标签>]`
|
|
42
53
|
(与 `--help` 输出同一行)。
|
|
43
54
|
这是权威入口:它**不加载任何 peer 依赖、任何宿主服务**,即使插件的运行时
|
|
44
55
|
本身就是故障源,它也能启动。只 import 纯净、无 peer 的 `lib/` 模块;原先
|
|
45
|
-
挂在 peer 污染模块(`lib/index.js
|
|
46
|
-
|
|
56
|
+
挂在 peer 污染模块(`lib/index.js`)后面的唯一 helper 已内联,并由
|
|
57
|
+
`test/doctor.test.mjs` 与 lib 导出对拍防漂移。
|
|
47
58
|
退出码 0 = `ready`,1 = `blocked`,2 = 拒绝(`--read-only` 与
|
|
48
|
-
`--fix`/`--install`
|
|
49
|
-
|
|
59
|
+
`--fix`/`--install` 同用、`--fix-owned` 与 `--install` 同用,或对范围化
|
|
60
|
+
运行使用 `--fix`)。
|
|
61
|
+
- **`/wsl-doctor` UI 命令**——在输入框输入
|
|
50
62
|
`/wsl-doctor [quick|full|<分区>] [--distro <名称>]`;命令面在宿主侧执行,
|
|
51
63
|
handler 子进程运行独立 CLI,逐项报告直接渲染在 UI 上、不进模型历史
|
|
52
|
-
(无模型回合、零 token
|
|
64
|
+
(无模型回合、零 token)。侧边栏的 **WSL 环境** 面板按发行版运行同源的快速检查,
|
|
65
|
+
结果以状态徽标、编号的待修项与告警列出;已检查的行还提供一个完整 doctor 动作(`--fix-owned`):报告中存在可自动修复项
|
|
66
|
+
(残留 scope 或损坏的 agent 缓存)时标为 **修复**,否则标为 **完整检查**;
|
|
67
|
+
返回 before → after 的修复行。行内同时给出上次检查时间、来源(手动或页面加载时的后台复核)与结果结构(各状态
|
|
68
|
+
计数与分区分布)。每个已检查的行可展开查看本次运行执行的全部检查项,按分区分组、逐项带状态与依据;
|
|
69
|
+
快速检查未触及的目录项只以“完整检查还会运行 N 项”计数,不伪装成结果。最后一次结果存放在本地(`$DSH_HOME/cache/dsh-plugin-wsl-env/status.json`,
|
|
70
|
+
缺省回退到 `~/.dsh`),刷新后仍可见;后台复核只针对正在运行的发行版,失败时按
|
|
71
|
+
实际观测覆盖已存结果。手动告警保留各自处理办法;
|
|
72
|
+
完整诊断仍走上面的入口与 `/wsl-doctor`。没有命令适配器的部署(headless、ACP)中该行是
|
|
53
73
|
no-op,CLI 就是入口。未给 `--distro` 时,handler 从会话当前工作目录解析
|
|
54
74
|
发行版(先读 agent 作用域的 `workingDirectory` 服务,再退回 Session 头部
|
|
55
75
|
记录的 `cwd`);两者都给不出 WSL UNC 路径时,由 CLI 的生效配置决定,而
|
|
@@ -77,7 +97,7 @@ doctor 通过三个入口给出同一份报告:
|
|
|
77
97
|
| `SANDBOX_UNAVAILABLE` | environment | `sandbox.bwrap`、`sandbox.bwrap-usable`、`functional.sandbox` | 所请求的隔离无法强制(无可用 bubblewrap) |
|
|
78
98
|
| `FS_SANDBOX_DENIED` | policy | `functional.sandbox`(围栏形状) | 文件效果策略拒绝了写入,或内核在驻留 agent 的 profile 处拒绝 |
|
|
79
99
|
| `FS_OUTSIDE_DISTRO` | policy | `config.effective`(生效的 `distro`) | 围栏钉死时路径指向另一 distro 的共享 |
|
|
80
|
-
| `FS_IO_ERROR` | environment | `distro.reachable`、`distro.disk`、`agent.handshake`、`functional.exec`、`functional.fs` | 兜底:agent 失联、distro 僵死、磁盘满、无法映射的路径 |
|
|
100
|
+
| `FS_IO_ERROR` | environment | `distro.reachable`、`distro.disk`、`host.disk`、`agent.handshake`、`agent.home-writable`、`functional.exec`、`functional.fs` | 兜底:agent 失联、distro 僵死、磁盘满、无法映射的路径 |
|
|
81
101
|
| `FS_NOT_FOUND` | data | — | 路径不存在——普通答案 |
|
|
82
102
|
| `FS_NOT_REGULAR_FILE` | data | — | 需要常规文件处出现了目录、符号链接或设备 |
|
|
83
103
|
| `FS_NOT_DIRECTORY` | data | — | 对非目录发起列表 |
|
|
@@ -90,7 +110,7 @@ doctor 通过三个入口给出同一份报告:
|
|
|
90
110
|
| `FS_AMBIGUOUS_EDIT` | data | — | 字面编辑命中多处 |
|
|
91
111
|
| `FS_PATCH_MISMATCH` | data | — | hunk 与文件不再吻合;按新文本重建 |
|
|
92
112
|
| `FS_SAME_TARGET` | data | — | move 的源与目的地解析为同一文件 |
|
|
93
|
-
| `AgentUnavailableError` | environment | `agent.handshake`、`agent.native`、`agent.cache`、`functional.exec` | 执行层的复活预算耗尽;具名状态会说明 |
|
|
113
|
+
| `AgentUnavailableError` | environment | `agent.handshake`、`agent.native`、`agent.cache`、`agent.home-writable`、`functional.exec`、`functional.native` | 执行层的复活预算耗尽;具名状态会说明 |
|
|
94
114
|
|
|
95
115
|
agent 的结构化 FS 原因(`notfound`、`notdir`、`perm`、`loop`、`stale`、
|
|
96
116
|
`io`)在 `lib/fsio-agent.js` 映射到上表各码;线上方言本身见
|
package/docs/LIMITATIONS.md
CHANGED
|
@@ -29,6 +29,12 @@ operations never use the 9p share.
|
|
|
29
29
|
after the rename (shell agent). The native agent keeps its file-level
|
|
30
30
|
`sync_all` only — see the peer-parity divergence note. A filesystem that
|
|
31
31
|
refuses a directory fsync keeps the peer's own promise.
|
|
32
|
+
- **The shell agent's tool floor is GNU.** It needs coreutils, GNU `find`
|
|
33
|
+
(`-printf`), `realpath` and `od`; a minimal BusyBox image (Alpine without
|
|
34
|
+
`findutils`) fails its FSB stat/list with `find: unrecognized: -printf`. The
|
|
35
|
+
packaged native agent, which `auto` prefers, does not need those tools —
|
|
36
|
+
install `findutils` only when pinning `agentBackend: shell`.
|
|
37
|
+
|
|
32
38
|
- **A Linux filename containing a backslash cannot be addressed** — the backslash is
|
|
33
39
|
the UNC separator, so `a\b.ts` round-trips to `a/b.ts`. Rename away from backslash
|
|
34
40
|
names; this is the coordinate system's own limit.
|
|
@@ -160,13 +166,21 @@ CLI's `--all` says the same thing explicitly). The handler bounds an unresolved
|
|
|
160
166
|
run at 60 s (a resolved one at 120 s) so it settles with the narrowing hint
|
|
161
167
|
instead of leaving the card "executing" for the dispatcher's whole budget.
|
|
162
168
|
|
|
163
|
-
The
|
|
169
|
+
The sidebar's stored result is a record of the last run, not a live verdict:
|
|
170
|
+
its timestamp and source say which run it is, and a probe is never started for
|
|
171
|
+
a stopped distro in the background. The doctor reads and reports; it never
|
|
172
|
+
rewrites user- or distro-owned files.
|
|
164
173
|
`.wslconfig`, `/etc/wsl.conf`, a WSL1 conversion and distro installation are
|
|
165
174
|
remedy-only — the remedy text carries the exact command — and the fixable set
|
|
166
|
-
is limited to what is safe and reversible (stale scopes, the
|
|
167
|
-
packages behind `--install` plus a confirmation, and
|
|
168
|
-
safe.directory whitelist behind the same gate).
|
|
169
|
-
the
|
|
175
|
+
is limited to what is safe and reversible (stale scopes, the plugin-owned
|
|
176
|
+
agent cache, the optional packages behind `--install` plus a confirmation, and
|
|
177
|
+
the Windows git safe.directory whitelist behind the same gate). `--fix-owned`
|
|
178
|
+
narrows a run to the plugin-owned two (stale scopes and the cache); the
|
|
179
|
+
sidebar panel's full-run action is exactly that run, labeled **修复** only when
|
|
180
|
+
one of those findings is present and **完整检查** otherwise, so it can never
|
|
181
|
+
install a package or write Windows-owned configuration, and it never implies
|
|
182
|
+
that a remedy-only warning is auto-fixable. The verdict never upgrades the
|
|
183
|
+
sandbox's security statement: `enforcement: partial` is untouched.
|
|
170
184
|
|
|
171
185
|
## Session-start advisories
|
|
172
186
|
|
package/docs/LIMITATIONS.zh.md
CHANGED
|
@@ -26,6 +26,12 @@ Windows 侧 share 后端(`substrate: "share"`)在启动时被拒绝;WSL
|
|
|
26
26
|
rename 之后所在目录也会尽力 fsync(shell agent)。native agent 目前只有
|
|
27
27
|
文件级 `sync_all` —— 见 peer 对齐文档的分歧注记。拒绝目录 fsync 的
|
|
28
28
|
文件系统保持与对端相同的承诺。
|
|
29
|
+
- **shell agent 的工具下限是 GNU 套件。** 它需要 coreutils、GNU `find`
|
|
30
|
+
(`-printf`)、`realpath` 与 `od`;最小化 BusyBox 镜像(未装 `findutils`
|
|
31
|
+
的 Alpine)会在 FSB stat/list 上失败并报 `find: unrecognized: -printf`。
|
|
32
|
+
`auto` 优先使用的打包 native agent 不需要这些工具——只有在钉死
|
|
33
|
+
`agentBackend: shell` 时才需要安装 `findutils`。
|
|
34
|
+
|
|
29
35
|
- **含反斜杠的 Linux 文件名无法被寻址** —— 反斜杠是 UNC 分隔符,
|
|
30
36
|
`a\b.ts` 会往返成 `a/b.ts`。请把文件名改掉,不要用反斜杠;
|
|
31
37
|
这是坐标系自身的限制。
|
|
@@ -146,11 +152,16 @@ doctor 的 `verdict` 在生效配置(应用加载的 profile 层叠加在随
|
|
|
146
152
|
的运行设 60 秒时限(已解析出发行版时 120 秒),让它带着收窄提示收尾,而不是
|
|
147
153
|
一直显示「执行中」直到命令面的整个预算耗尽。
|
|
148
154
|
|
|
149
|
-
|
|
155
|
+
侧边栏保存的是上一次运行的结果,不是实时裁决:时间戳与来源标明它是哪次运行,
|
|
156
|
+
后台也不会为已停止的发行版启动探测。doctor 只读取和报告,从不改写用户或发行版
|
|
157
|
+
所有的文件。`.wslconfig`、
|
|
150
158
|
`/etc/wsl.conf`、WSL1 转换和发行版安装只以补救命令的形式出现——补救文本
|
|
151
|
-
携带确切的命令;可自动修复的集合仅限安全且可逆的部分(过期 scope
|
|
152
|
-
|
|
153
|
-
`safe.directory`
|
|
159
|
+
携带确切的命令;可自动修复的集合仅限安全且可逆的部分(过期 scope、插件自有的
|
|
160
|
+
agent 缓存、`--install` 加确认后的可选软件包、以及同一道确认门后的
|
|
161
|
+
Windows git `safe.directory` 白名单)。`--fix-owned` 把运行收窄到插件自有
|
|
162
|
+
的两类(过期 scope 与缓存);侧边栏面板的“修复”动作正是这次运行,存在这两类
|
|
163
|
+
可修复项时标为“修复”,否则标为“完整检查”,因此它永远不会安装软件包或
|
|
164
|
+
改写 Windows 所有的配置,也不会暗示仅能手动处理的告警可被自动修复。裁决从不升级沙箱的安全声明:
|
|
154
165
|
`enforcement: partial` 不受影响。
|
|
155
166
|
|
|
156
167
|
## 会话启动建议
|