dsh-plugin-wsl-env 0.18.0 → 0.21.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 +274 -0
- package/CONTRIBUTING.md +37 -5
- package/README.md +60 -5
- package/SUPPORT.md +3 -3
- package/agent/native/linux-aarch64/dsh-wsl-agent +0 -0
- package/agent/native/linux-x86_64/dsh-wsl-agent +0 -0
- package/agent/wsl-agent.sh +331 -11
- package/client.d.ts +5 -0
- package/client.js +98 -0
- package/cordis.patch.yml +66 -1
- package/docs/AGENT-PROTOCOL-V7.md +175 -0
- package/docs/API.md +25 -0
- package/docs/ARCHITECTURE.md +14 -1
- package/docs/CONFIGURATION.md +47 -6
- package/docs/CONFIGURATION.zh.md +20 -4
- package/docs/DIAGNOSTICS.md +83 -0
- package/docs/DIAGNOSTICS.zh.md +73 -0
- package/docs/LIMITATIONS.md +41 -4
- package/docs/LIMITATIONS.zh.md +27 -11
- package/docs/MIGRATION.md +4 -4
- package/docs/PEER-PARITY.md +50 -33
- package/docs/QUICKSTART.md +37 -4
- package/docs/QUICKSTART.zh.md +16 -1
- package/docs/README.zh.md +43 -4
- package/docs/RELEASING.md +4 -1
- package/docs/REQUIREMENTS.zh.md +3 -2
- package/docs/ROADMAP-1.0.md +75 -19
- package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +8 -1
- package/docs/UPSTREAM-OPEN-IN-APP.md +33 -0
- package/docs/UPSTREAM-SESSION-NOTICE.md +3 -1
- package/docs/UPSTREAM-TERMINAL-TITLE.md +3 -0
- package/docs/root-fs-routing.md +3 -3
- package/lib/agent-confined.js +4 -4
- package/lib/agent-errors.d.ts +1 -1
- package/lib/agent-errors.js +1 -1
- package/lib/agent-exec.d.ts +1 -1
- package/lib/agent-exec.js +1 -1
- package/lib/agent-protocol.d.ts +58 -8
- package/lib/agent-protocol.js +40 -7
- package/lib/agent-shared.d.ts +1 -1
- package/lib/agent-shared.js +1 -1
- package/lib/agent.d.ts +171 -1
- package/lib/agent.js +448 -288
- package/lib/auto-preset.d.ts +1 -1
- package/lib/auto-preset.js +1 -1
- package/lib/bwrap.d.ts +1 -1
- package/lib/bwrap.js +1 -1
- package/lib/client-host.d.ts +29 -0
- package/lib/client-host.js +29 -0
- package/lib/cwd-prompt-tool.d.ts +88 -0
- package/lib/cwd-prompt-tool.js +94 -0
- package/lib/cwd-prompt.d.ts +166 -0
- package/lib/cwd-prompt.js +203 -0
- package/lib/distro-route.d.ts +1 -1
- package/lib/distro-route.js +1 -1
- package/lib/doctor-live.d.ts +57 -0
- package/lib/doctor-live.js +38 -0
- package/lib/file-reference-wsl.d.ts +1 -1
- package/lib/file-reference-wsl.js +1 -1
- package/lib/fs-decisions.d.ts +1 -1
- package/lib/fs-decisions.js +1 -1
- package/lib/fs-routing.d.ts +1 -1
- package/lib/fs-routing.js +1 -1
- package/lib/fs-substrate.d.ts +90 -11
- package/lib/fs-substrate.js +202 -1
- package/lib/fs.d.ts +1 -1
- package/lib/fs.js +1 -1
- package/lib/fsio-agent.d.ts +128 -4
- package/lib/fsio-agent.js +224 -15
- package/lib/fsio-text.d.ts +1 -1
- package/lib/fsio-text.js +1 -1
- package/lib/git-exec.d.ts +1 -1
- package/lib/git-exec.js +1 -1
- package/lib/git-route.d.ts +1 -1
- package/lib/git-route.js +1 -1
- package/lib/index.d.ts +105 -30
- package/lib/index.js +272 -130
- package/lib/listing.d.ts +1 -1
- package/lib/listing.js +1 -1
- package/lib/messages.d.ts +157 -0
- package/lib/messages.js +199 -0
- package/lib/native-agent.d.ts +1 -1
- package/lib/native-agent.js +2 -2
- package/lib/paths.d.ts +6 -3
- package/lib/paths.js +4 -4
- package/lib/picker.d.ts +1 -1
- package/lib/picker.js +7 -7
- package/lib/ports.d.ts +1 -1
- package/lib/ports.js +1 -1
- package/lib/preflight.d.ts +25 -1
- package/lib/preflight.js +112 -12
- package/lib/sandbox-core.d.ts +1 -1
- package/lib/sandbox-core.js +9 -16
- package/lib/sandbox.d.ts +1 -1
- package/lib/sandbox.js +1 -1
- package/lib/search-exec.d.ts +1 -1
- package/lib/search-exec.js +1 -1
- package/lib/search-route.d.ts +1 -1
- package/lib/search-route.js +1 -1
- package/lib/session-runtime.d.ts +1 -1
- package/lib/session-runtime.js +2 -2
- package/lib/session-scope.d.ts +1 -1
- package/lib/session-scope.js +11 -6
- package/lib/shell-env.d.ts +26 -1
- package/lib/shell-env.js +57 -1
- package/lib/shell.d.ts +4 -2
- package/lib/shell.js +4 -2
- package/lib/subprocess.d.ts +1 -1
- package/lib/subprocess.js +2 -2
- package/lib/terminal-activity.d.ts +1 -1
- package/lib/terminal-activity.js +1 -1
- package/lib/terminal-route.d.ts +1 -1
- package/lib/terminal-route.js +1 -1
- package/lib/update-check.d.ts +197 -0
- package/lib/update-check.js +211 -0
- package/lib/watcher.d.ts +1 -1
- package/lib/watcher.js +1 -1
- package/lib/wsl-doctor-tool.d.ts +122 -0
- package/lib/wsl-doctor-tool.js +161 -0
- package/lib/wsl.d.ts +1 -31
- package/lib/wsl.js +1 -21
- package/package.json +55 -6
- package/scripts/doctor.mjs +1196 -166
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Agent protocol v7 — design note (WSL-312)
|
|
2
|
+
|
|
3
|
+
Status: accepted · Supersedes: the v6 increment's unclaimed FS part ·
|
|
4
|
+
Author: the plugin maintainers · Date: 2026-11-05
|
|
5
|
+
|
|
6
|
+
## What v7 is
|
|
7
|
+
|
|
8
|
+
Protocol v6 (0.17.0) took the EXEC stdin-payload increment; the FS half of
|
|
9
|
+
WSL-312 was deferred. v7 is the FS half, plus the substrate for the peer's
|
|
10
|
+
new `patchText` / `deleteFile` / `moveFile` operations. One revision, one
|
|
11
|
+
negotiation rule, four capabilities.
|
|
12
|
+
|
|
13
|
+
## What ships
|
|
14
|
+
|
|
15
|
+
| Capability | Wire | Native agent | Shell agent | Host |
|
|
16
|
+
|---|---|---|---|---|
|
|
17
|
+
| Capability advertisement | HELLO gains a 6th field | `conc,batch` | `batch` | capability-aware FS scheduling |
|
|
18
|
+
| Structured FS errors | new `FSERR\|id\|reason\|b64 message` line | yes | yes | direct FsError mapping (the `dsh-fs\|…` stderr-line sniffing stays as a fallback for older agents) |
|
|
19
|
+
| Batched FS reads | new `FSB\|id\|timeout\|nops` frame, `OP\|op\|nargs` op specs follow | sequential under `fs_lock`, one RES | sequential in one worker, one RES | GUI-preview-shaped page reads in one round trip |
|
|
20
|
+
| `delete` / `move` FS ops | new op names in the FS frame vocabulary | yes | yes | guarded, mapped to `FsDeleteOutcome` / `FsMoveOutcome` |
|
|
21
|
+
| `patchText` | **no wire change** — host-side hunk application + a guarded `replace` write | n/a | n/a | hunks applied in-process via `@deepseek-ai/dsh-fs-patch` (a new peer dependency, the peer's own `applyHunks` — perfect error parity, `FS_PATCH_MISMATCH` free) |
|
|
22
|
+
|
|
23
|
+
`PROTOCOL_VERSION` becomes 7. `@deepseek-ai/dsh-fs-patch@0.2.2-rc.1` is added
|
|
24
|
+
to `peerDependencies` (the host imports `applyHunks` at runtime) and pinned in
|
|
25
|
+
`devDependencies`.
|
|
26
|
+
|
|
27
|
+
## Negotiation rule (unchanged in spirit, sharpened)
|
|
28
|
+
|
|
29
|
+
The version in HELLO is the AGENT's floor for the frames it accepts: a v7
|
|
30
|
+
agent parses every v5/v6 frame forever. The HOST decides what it may send:
|
|
31
|
+
|
|
32
|
+
- a host sends `FSB` / `FSERR`-expecting frames only against `HELLO ≥ 7`;
|
|
33
|
+
- a v6 host (an older mirror) against a v7 agent sees `HELLO|…|6` never —
|
|
34
|
+
wait, the agent reports its own version. The rule that matters: **the host
|
|
35
|
+
gates new frames on `HELLO.version ≥ 7`, and the doctor's handshake reports
|
|
36
|
+
the negotiated pair**. A half-synced mirror (agent 6, host 7) therefore
|
|
37
|
+
degrades to v6 behaviour instead of desyncing — the digest check still
|
|
38
|
+
catches script drift, and version mismatch is the same recoverable state it
|
|
39
|
+
is today (rebuild once, then one-shot fallback).
|
|
40
|
+
|
|
41
|
+
Concurrency capability is negotiated separately, because the two backends
|
|
42
|
+
honestly differ:
|
|
43
|
+
|
|
44
|
+
- `conc` — the agent runs FS ops concurrently and may answer out of order
|
|
45
|
+
(the native agent already does: worker threads + `fs_lock` on mutations).
|
|
46
|
+
- `batch` — the agent accepts `FSB` (any backend; a batch is sequential
|
|
47
|
+
inside one worker, which is exactly why it is safe everywhere).
|
|
48
|
+
- The SHELL agent does **not** advertise `conc`: its read loop is serial and
|
|
49
|
+
POSIX sh gives no safe way to interleave 1 MB base64 lines on one pipe.
|
|
50
|
+
The host therefore serializes single FS frames against `batch`-only agents
|
|
51
|
+
and may pipeline them against `conc` agents. Batched reads — the actual
|
|
52
|
+
GUI-preview win — work on both backends.
|
|
53
|
+
|
|
54
|
+
## Frame details
|
|
55
|
+
|
|
56
|
+
### HELLO v7
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
HELLO|wsl-agent|7|<sha256>|<pid>|<caps>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`caps` is a comma-separated token list (`conc`, `batch`). Absent or empty
|
|
63
|
+
(a v6 peer, a fake) means no capabilities — the host behaves exactly as
|
|
64
|
+
today. The host-side parser keeps accepting 5-field HELLOs.
|
|
65
|
+
|
|
66
|
+
### FSERR
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
FSERR|<id>|<reason>|<b64 message>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Emitted by both agents wherever an FS op fails (replacing the
|
|
73
|
+
`dsh-fs|reason|b64` first-stderr-line convention, which stays parsed as a
|
|
74
|
+
fallback). The host maps `reason` → `FsErrorCode` directly; `reason`
|
|
75
|
+
vocabulary is the existing `notfound notdir perm loop exists stale io
|
|
76
|
+
protocol` set.
|
|
77
|
+
|
|
78
|
+
### FSB — batched FS
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
FSB|<id>|<timeout seconds|0>|<n ops>
|
|
82
|
+
OP|<op>|<n args>
|
|
83
|
+
<b64 arg>…
|
|
84
|
+
OP|…
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
One `ACK`, then ONE `RES|<id>|0|<b64 payload>` where the payload is the
|
|
88
|
+
concatenated per-op records:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
OK <i>|<b64 payload>
|
|
92
|
+
BAD <i>|<reason>|<b64 message>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Ops run in order in ONE worker; a failed op records `BAD` and continues with
|
|
96
|
+
the next (a batch is a set of independent reads, not a transaction). Payloads
|
|
97
|
+
are the op's normal stdout (stat record, list records, read bytes). The
|
|
98
|
+
per-op exit is visible per record, so the host can retry one member
|
|
99
|
+
individually.
|
|
100
|
+
|
|
101
|
+
### `delete` / `move` FS ops
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
delete <path> <expected version|->
|
|
105
|
+
move <src path> <dst path> <dst mode|-> <dst publish replace|no-replace> <src expected version|-> <dst expected version|->
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Both reuse the write machinery's guards: version re-verification against a
|
|
109
|
+
fresh stat before the destructive step, staging + atomic publish for the
|
|
110
|
+
destination (`no-replace` = hard-link no-replace, `exists` refusal on a
|
|
111
|
+
concurrent creator), source removal after destination publication. A failed
|
|
112
|
+
source removal after a published destination is reported in the payload
|
|
113
|
+
(`sourceDeleted=false` plus the failure record) — the two-effect shape of the
|
|
114
|
+
peer's `FsMoveOutcome`, honestly preserved.
|
|
115
|
+
|
|
116
|
+
## `patchText` — why there is no frame
|
|
117
|
+
|
|
118
|
+
Hunks are JSON-serializable, but hunk APPLICATION belongs to
|
|
119
|
+
`@deepseek-ai/dsh-fs-patch`'s `applyHunks` — the peer's own matcher, whose
|
|
120
|
+
`FS_PATCH_MISMATCH` dialect (`hunk at patch line N (stage) does not match`)
|
|
121
|
+
this plugin must reproduce verbatim to stay in parity. Reimplementing it in
|
|
122
|
+
awk or Rust is a permanent second source of truth for the subtleties
|
|
123
|
+
(anchors, EOF-candidate retries, trailing-sentinel handling). So v7 does it
|
|
124
|
+
the parity way:
|
|
125
|
+
|
|
126
|
+
1. host `read`s the file (one round trip — batchable with the stat next to
|
|
127
|
+
it),
|
|
128
|
+
2. applies `applyHunks` in-process (`FS_PATCH_MISMATCH` on failure, verbatim
|
|
129
|
+
dialect),
|
|
130
|
+
3. issues a guarded `replace` write with the original version (one round
|
|
131
|
+
trip).
|
|
132
|
+
|
|
133
|
+
Two round trips, zero new wire semantics, zero second implementation. The
|
|
134
|
+
`dsh-fs-patch` peer floor is `0.2.2-rc.1`, the same line the plugin already
|
|
135
|
+
targets.
|
|
136
|
+
|
|
137
|
+
## What breaks
|
|
138
|
+
|
|
139
|
+
Nothing for a correct peer. The compatibility matrix:
|
|
140
|
+
|
|
141
|
+
| host \ agent | 6 | 7 |
|
|
142
|
+
|---|---|---|
|
|
143
|
+
| v6 host (old mirror) | today | sends no v7 frames; HELLO extra field ignored |
|
|
144
|
+
| v7 host | no `FSB`/`FSERR`/`delete`/`move` (version-gated); parity gap stays | everything |
|
|
145
|
+
|
|
146
|
+
The host-side risk is bounded by the same rebuild-once-then-one-shot ladder
|
|
147
|
+
the executor already runs on any handshake mismatch.
|
|
148
|
+
|
|
149
|
+
## Acceptance mapping
|
|
150
|
+
|
|
151
|
+
- design note — this file.
|
|
152
|
+
- batched-read benchmark — `test/probe/gui-preview-batch.sh`: stat+list+read page
|
|
153
|
+
shape, FSB vs five individual frames, both backends. Measured 2026-11-05 on
|
|
154
|
+
`ubuntu` (five runs each, two samples): native (the shipped default)
|
|
155
|
+
**4.4–7.4 → 1.9–2.1 ms/view (2.3–3.5x)**; shell backend 1.0–1.2x — its
|
|
156
|
+
per-op cost is coreutils forks, not transport round trips, so batching
|
|
157
|
+
there is a wash (the fork cost dominates either shape).
|
|
158
|
+
- lockstep — `agent/native/spike/test.mjs` gains v7 frames against the
|
|
159
|
+
native binary; `test/agent-fs-script.test.mjs` gains them against the
|
|
160
|
+
shell script; the doctor's handshake reports the negotiated version and
|
|
161
|
+
capabilities; `PROTOCOL_VERSION = 7`.
|
|
162
|
+
- substrate — `fsio-agent`/`fs-substrate` serve `patchText`/`deleteFile`/
|
|
163
|
+
`moveFile` for real; the composition tests flip from refusal to behaviour;
|
|
164
|
+
`docs/PEER-PARITY.md`'s declared-gap section becomes an implementation
|
|
165
|
+
record.
|
|
166
|
+
|
|
167
|
+
## The SETENV verb: implemented, host-refused
|
|
168
|
+
|
|
169
|
+
`SETENV|id|key|value-b64` is a protocol-6 verb both agent implementations
|
|
170
|
+
still answer (`agent/wsl-agent.sh`, the native binary) and the suite still
|
|
171
|
+
tests, but no host code sends it: per-request environment rides the EXEC
|
|
172
|
+
frame's env block, and a global mutation would outlive the request that
|
|
173
|
+
made it. The verb is reserved — a host that wants idempotent
|
|
174
|
+
environment pre-warming can adopt it without a protocol bump. Until then
|
|
175
|
+
it is dormant surface, kept because removing it means a native rebuild.
|
package/docs/API.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# API surface
|
|
2
|
+
|
|
3
|
+
The published API is the generated `lib/*.d.ts` next to each compiled module
|
|
4
|
+
(`pnpm run build` keeps them byte-fresh; `lint:build` fails on drift). The
|
|
5
|
+
`exports` map in `package.json` is the authority on what a consumer can import;
|
|
6
|
+
this page is the quick tour.
|
|
7
|
+
|
|
8
|
+
| Subpath | Exports | Role |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| `.` | `WslShellExecutor` | the model-facing shell executor (`ctx.shell`) |
|
|
11
|
+
| `./fs` | `WslFileSystem` | the filesystem provider over the distro (`ctx.fs`) |
|
|
12
|
+
| `./index` | `WslShellExecutor`, `WslFileSystem`, `doctorReport`, `effectiveMaskWindowsDrive`, … | the composition root's full named surface — the integration API (`doctorReport` for tooling that wants the doctor's versioned report) |
|
|
13
|
+
| `./fs-routing` | `WslRoutingFileSystem` | the root-plane coordinate router |
|
|
14
|
+
| `./wsl` | `defaultShell`, `listDistros`, `shellArgs`, `wslTerminalArgv`, … | the `wsl.exe` interop primitives |
|
|
15
|
+
| `./agent` | `WslAgent` | the resident-agent transport |
|
|
16
|
+
| `./subprocess` | `WslSubprocessRuntime` | the terminal/subprocess runtime |
|
|
17
|
+
| `./preflight` | the `wsl-preflight` row | session-start advisories |
|
|
18
|
+
| `./paths` | `uncToPosix`, `toLinuxPath`, `toWorldPath`, … | the coordinate mappers |
|
|
19
|
+
| `./picker` | `WslDirectoryPicker` | the distro-aware directory picker |
|
|
20
|
+
| `./auto-preset` | the `auto-preset` row | first-run profile bootstrap |
|
|
21
|
+
| `./shell-env` | the `wsl-shell-env` row | the `DSH_WSL_*` facts registry |
|
|
22
|
+
| `./update-check` | the `wsl-update-check` row | the once-a-day update notice (fact store + host-delegated check) |
|
|
23
|
+
|
|
24
|
+
Stability: tool names and error codes are API (docs/MIGRATION.md); the
|
|
25
|
+
runtime rows' config keys are documented in docs/CONFIGURATION.md.
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -77,7 +77,9 @@ Three modules support them and import no DSH package.
|
|
|
77
77
|
|
|
78
78
|
[`cordis.patch.yml`](../cordis.patch.yml) is the bundle layer. It is a top-level
|
|
79
79
|
YAML array of patch entries, and `dsh plugin --profile <name> add
|
|
80
|
-
dsh-plugin-wsl-env` applies it as one layer
|
|
80
|
+
dsh-plugin-wsl-env` applies it as one layer on the CLI distribution; the
|
|
81
|
+
desktop app applies the same bundle through its sidebar **Plugins** page
|
|
82
|
+
(**Add plugin**) and records it in the profile's `dsh.profile.bundles`.
|
|
81
83
|
|
|
82
84
|
The environment is per session, not per process:
|
|
83
85
|
|
|
@@ -318,6 +320,8 @@ own dialect, described after the table.
|
|
|
318
320
|
| `FS_ABORTED` | `lib/fsio-agent.js`, `lib/fsio-text.js` | the caller's signal was aborted before or during the operation | not a refusal — the caller cancelled; a fresh call clears it |
|
|
319
321
|
| `FS_EDIT_NOT_FOUND` | `lib/fsio-text.js` (`applyLiteralEdit`) | `old_string` was empty, or matched nothing in the file | give an `old_string` the file actually contains |
|
|
320
322
|
| `FS_AMBIGUOUS_EDIT` | `lib/fsio-text.js` (`applyLiteralEdit`) | `old_string` matched more than once and `replace_all` was not set | make `old_string` unique, or set `replace_all` |
|
|
323
|
+
| `FS_PATCH_MISMATCH` | `lib/fs-substrate.js` (`patchText`; the agent's record dialect, `docs/AGENT-PROTOCOL-V7.md`) | a hunk's `oldLines` no longer match the file at the lines the hunks name — the text drifted between the caller's read and the patch | re-read the file and rebuild the hunks against the fresh text |
|
|
324
|
+
| `FS_SAME_TARGET` | `lib/fs-substrate.js` (`moveFile`) | `moveFile`'s source and destination resolve to the same file | give two distinct paths, or drop the call |
|
|
321
325
|
|
|
322
326
|
The GUI file service keeps the shipped `workspace-files` row, so its wire
|
|
323
327
|
refusals are the peer's `workspace-file/*` dialect (plus `gateway/bad-request`
|
|
@@ -486,3 +490,12 @@ src/wsl.ts wsl.exe interop primitives (no DSH imports)
|
|
|
486
490
|
same three archived files, the second so a reader who does not read Chinese can
|
|
487
491
|
still tell what is there; the records themselves are Chinese.
|
|
488
492
|
- [`README.md`](../README.md) is the only statement of current state.
|
|
493
|
+
|
|
494
|
+
## Diagnostics
|
|
495
|
+
|
|
496
|
+
`pnpm run doctor` (and `pnpm run diagnose`) is the operator-facing entry
|
|
497
|
+
point over everything above: it probes the Windows/WSL versions, the distro
|
|
498
|
+
and its shell, bubblewrap, systemd/Linger, the peer floor, a fresh agent
|
|
499
|
+
handshake and the stale session scopes, and reports the versioned
|
|
500
|
+
`doctorReport` structure (`scripts/doctor.mjs`, `lib/doctor-live.js`) with a
|
|
501
|
+
remedy per failure.
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -43,7 +43,8 @@ that row unless you pass `--force`. Prefer manual merging for existing profiles.
|
|
|
43
43
|
To edit the preset manually, replace the entire `preset-wsl` row. Its config is
|
|
44
44
|
not deep-merged: preserve `id`, `order`, and every item in `plugins`. Copy the
|
|
45
45
|
current block from `cordis.patch.yml` or from
|
|
46
|
-
`dsh --profile <name> --dump-config
|
|
46
|
+
`dsh --profile <name> --dump-config` (CLI distribution — the desktop app has no
|
|
47
|
+
`dsh` command), then change the nested values. Re-copy it
|
|
47
48
|
after a plugin upgrade that changes the preset.
|
|
48
49
|
|
|
49
50
|
### `wsl-shell`
|
|
@@ -51,7 +52,7 @@ after a plugin upgrade that changes the preset.
|
|
|
51
52
|
| Key | Default / shipped value | Description |
|
|
52
53
|
|---|---|---|
|
|
53
54
|
| `distro` | `''` (shipped) | Empty or `auto` follows the request workdir's distro. `default` selects WSL's default distro; a name pins commands to that distro. |
|
|
54
|
-
| `shell` | `''` | Empty resolves the distro user's login shell.
|
|
55
|
+
| `shell` | `''` | Empty resolves the distro user's login shell (`getent passwd`, then `$SHELL`). When both probes fail the command errors out instead of running under another shell — set an absolute Linux path here to pin one. |
|
|
55
56
|
| `loginShell` | `true` (shipped) | Use login semantics for POSIX shells. Non-POSIX shells use their own command form. |
|
|
56
57
|
| `agent` | `true` | Use the resident agent. If it is unavailable, commands use the one-shot `wsl.exe` path. Set `false` to always use that path. Cwd and sandbox refusals are returned directly. |
|
|
57
58
|
| `agentBackend` | `auto` (shipped) | `auto` selects the packaged static-musl binary at `agent/native/linux-<arch>/dsh-wsl-agent` or the `DSH_WSL_AGENT_NATIVE` override; otherwise it uses the shell agent. `native` fails if it cannot prepare; `shell` forces the shell agent. Applies to commands, confined writes, and shared reads. |
|
|
@@ -134,8 +135,11 @@ The root router is app-level, not session-owned, so it does not use
|
|
|
134
135
|
| | `wslPath` | `wsl.exe` | Path to `wsl.exe`. |
|
|
135
136
|
| | `sandbox` | `true` | Run the session-start `bwrap` check. |
|
|
136
137
|
| | `sessionSandbox` | `true` | Also check systemd, the user manager, `systemd-run`, and Linger. Set false when the profile does not use a session runtime. |
|
|
138
|
+
| | `startup` | `true` | Also run the same checks once at plugin load — install + restart — against the pinned or WSL-default distro, so the verdict is in the log before any session opens. |
|
|
137
139
|
| `wsl-shell-env` | `distro` | `''` | Distro used to populate the `DSH_WSL_*` environment facts. |
|
|
138
140
|
| | `portsRefreshMs` | `10000` | Listening-port snapshot interval, in milliseconds. |
|
|
141
|
+
| `wsl-update-check` | `enabled` | `true` | Whether the plugin checks the app's plugin manager for a newer stable release. The result is served as `DSH_WSL_PLUGIN_UPDATE`; the check never installs. |
|
|
142
|
+
| | `intervalMs` | `86400000` | Check interval, in milliseconds (first check 2–10 minutes after startup); floored at one minute. |
|
|
139
143
|
|
|
140
144
|
The GUI file tree and previews use the bundled `workspace-files` row through
|
|
141
145
|
`fs-routing`; they do not use a separate WSL provider row. To change its
|
|
@@ -285,7 +289,11 @@ distros, the direct install command is:
|
|
|
285
289
|
wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
|
|
286
290
|
```
|
|
287
291
|
|
|
288
|
-
The `wsl-preflight` row runs these checks when a session opens
|
|
292
|
+
The `wsl-preflight` row runs these checks when a session opens, and — with
|
|
293
|
+
`startup: true`, the default — once at plugin load against the pinned or
|
|
294
|
+
WSL-default distro, so an install plus restart already carries the verdict in
|
|
295
|
+
the log; a session on that distro then repeats only the runtime-context entry.
|
|
296
|
+
It also checks
|
|
289
297
|
the session-runtime prerequisites when `sessionSandbox: true`. The warning is
|
|
290
298
|
advisory: it does not install packages or change the providers' fail-closed
|
|
291
299
|
behavior. Set `sandbox: false` on this row or remove it to silence the
|
|
@@ -297,11 +305,44 @@ without confinement; their `sandboxMode` becomes `undefined`. The tool layer
|
|
|
297
305
|
reports that no sandbox is active. On `fs-routing`, the setting disables the
|
|
298
306
|
mutation fence; that row reports `sandboxMode: undefined` either way.
|
|
299
307
|
|
|
308
|
+
### Message language
|
|
309
|
+
|
|
310
|
+
The plugin's refusal and remedy messages (the `sessionSandbox` preflight
|
|
311
|
+
verdicts, the `bwrap` install and repair hints, and the distro/workdir
|
|
312
|
+
command errors) follow the harness app's Language setting: the preference is
|
|
313
|
+
read from the host `locale` entry's `preference` field through the host
|
|
314
|
+
settings service, and a language switch takes effect without a restart.
|
|
315
|
+
Chinese (`zh`, including `zh-CN` and `zh-Hans` tags) and English ship; every
|
|
316
|
+
other language — and any profile without the settings service, or an unset
|
|
317
|
+
preference — renders English. Commands, config keys and file paths inside a
|
|
318
|
+
message are never translated. Three message groups stay English by design:
|
|
319
|
+
the `FS_*` refusal texts in `fs-decisions` and the fsio replica (the tool
|
|
320
|
+
layer matches on those strings byte-for-byte), and the standalone
|
|
321
|
+
`scripts/doctor.mjs`, which runs outside the app.
|
|
322
|
+
|
|
300
323
|
## Diagnose configuration and refusals
|
|
301
324
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
325
|
+
In a session the model can run the diagnosis itself: the `wsl_doctor` tool
|
|
326
|
+
(mounted inside `preset-wsl`) calls the doctor in-process and returns the
|
|
327
|
+
verdict with per-failure remedies — the user just asks for a diagnosis.
|
|
328
|
+
`DSH_WSL_DOCTOR` additionally carries a ready-to-run command that executes
|
|
329
|
+
the doctor script from inside the distro (the app's own runtime as Node,
|
|
330
|
+
through interop) — run it as `sh -c "$DSH_WSL_DOCTOR --json"`. And
|
|
331
|
+
`pnpm run doctor` is the one-command environment check: Windows/WSL versions,
|
|
332
|
+
the per-distro WSL mode, `.wslconfig` and `/etc/wsl.conf` cross-checks, the
|
|
333
|
+
disk, the clock, DNS, the distro and its shell, bubblewrap, systemd/Linger,
|
|
334
|
+
the peer floor, a fresh agent handshake, stale session scopes, the known
|
|
335
|
+
profile-patch and deprecated-key traps — each failure with a copyable remedy.
|
|
336
|
+
The run ends in a verdict (`ready` or `blocked`) computed under the effective
|
|
337
|
+
configuration: `--json` is the machine contract (schemaVersion 2), `--fix`
|
|
338
|
+
re-verifies what it fixed, `--all` checks every installed distro, `--bundle
|
|
339
|
+
<path>` writes the attachable diagnostic file (`--redact` strips the paths).
|
|
340
|
+
See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the verdict contract and the
|
|
341
|
+
error-code map. With the CLI distribution, `dsh --profile <name> --dump-config` inspects
|
|
342
|
+
the composed profile without booting it and shows whether a row override
|
|
343
|
+
applied; the desktop app has no `dsh` command, so read `cordis.patch.yml` and
|
|
344
|
+
the Plugins page there.
|
|
345
|
+
Use `scripts/bootstrap.sh <distro>` to inspect distro prerequisites.
|
|
305
346
|
|
|
306
347
|
| Symptom | Result | Action |
|
|
307
348
|
|---|---|---|
|
package/docs/CONFIGURATION.zh.md
CHANGED
|
@@ -42,6 +42,7 @@ profile 层;检测到时会打印应使用的块。`--out` 会整体替换目
|
|
|
42
42
|
要手动编辑 preset,需替换整个 `preset-wsl` 行。它的 config
|
|
43
43
|
不做深度合并:保留 `id`、`order` 以及 `plugins` 中的每一项。
|
|
44
44
|
从 `cordis.patch.yml` 或 `dsh --profile <name> --dump-config`
|
|
45
|
+
(CLI 发行版;桌面应用没有 `dsh` 命令)
|
|
45
46
|
复制当前块,再修改嵌套的值。插件升级改变了 preset 后要重新复制。
|
|
46
47
|
|
|
47
48
|
### `wsl-shell`
|
|
@@ -49,7 +50,7 @@ profile 层;检测到时会打印应使用的块。`--out` 会整体替换目
|
|
|
49
50
|
| 键 | 默认 / shipped 值 | 说明 |
|
|
50
51
|
|---|---|---|
|
|
51
52
|
| `distro` | `''`(shipped) | 空或 `auto` 跟随请求工作目录所属的发行版。`default` 选择 WSL 默认发行版;给出名字则把命令固定到该发行版。 |
|
|
52
|
-
| `shell` | `''` | 空则解析发行版用户的登录 shell
|
|
53
|
+
| `shell` | `''` | 空则解析发行版用户的登录 shell(先 `getent passwd`,再 `$SHELL`)。两条探测都失败时命令直接报错,而不是落到另一个 shell——在此设置绝对 Linux 路径可固定一个。 |
|
|
53
54
|
| `loginShell` | `true`(shipped) | 对 POSIX shell 使用登录语义。非 POSIX shell 使用各自的命令形式。 |
|
|
54
55
|
| `agent` | `true` | 使用常驻 agent。不可用时,命令走一次性的 `wsl.exe` 路径。设为 `false` 则总是走该路径。Cwd 与沙箱拒绝会被直接返回。 |
|
|
55
56
|
| `agentBackend` | `auto`(shipped) | `auto` 选择包内 `agent/native/linux-<arch>/dsh-wsl-agent` 的静态 musl 二进制或 `DSH_WSL_AGENT_NATIVE` 覆盖;否则使用 shell agent。`native` 在准备失败时报错;`shell` 强制使用 shell agent。适用于命令、受限写入和共享读取。 |
|
|
@@ -132,6 +133,7 @@ Loader 在挂载该行之前会校验宿主和发行版设置;
|
|
|
132
133
|
| | `wslPath` | `wsl.exe` | `wsl.exe` 的路径。 |
|
|
133
134
|
| | `sandbox` | `true` | 运行会话启动时的 `bwrap` 检查。 |
|
|
134
135
|
| | `sessionSandbox` | `true` | 同时检查 systemd、user manager、`systemd-run` 和 Linger。profile 不使用会话 runtime 时设为 false。 |
|
|
136
|
+
| | `startup` | `true` | 插件加载时(即安装 + 重启后)对 pin 的或 WSL 默认发行版预先运行同一组检查,让判定在任何会话打开之前就出现在日志里。 |
|
|
135
137
|
| `wsl-shell-env` | `distro` | `''` | 用于填充 `DSH_WSL_*` 环境事实的发行版。 |
|
|
136
138
|
| | `portsRefreshMs` | `10000` | 监听端口快照的刷新间隔,单位毫秒。 |
|
|
137
139
|
|
|
@@ -275,7 +277,9 @@ scripts/bootstrap.sh <distro> --install
|
|
|
275
277
|
wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
|
|
276
278
|
```
|
|
277
279
|
|
|
278
|
-
会话打开时,`wsl-preflight`
|
|
280
|
+
会话打开时,`wsl-preflight` 行会运行这些检查;`startup: true`(默认)时,
|
|
281
|
+
插件加载阶段还会对 pin 的或 WSL 默认发行版预先运行同一组检查,因此安装加
|
|
282
|
+
重启之后判定就已经出现在日志里,该发行版上的会话只会重复注入运行时上下文条目。
|
|
279
283
|
`sessionSandbox: true` 时,它还会检查会话 runtime 的前置条件。
|
|
280
284
|
该警告仅供参考:它不会安装软件包,也不会改变提供者关闭(fail-closed)
|
|
281
285
|
的行为。在该行设置 `sandbox: false` 或移除该行可让沙箱警告静音。
|
|
@@ -286,10 +290,22 @@ profile 不使用会话 runtime 时,设置 `sessionSandbox: false`。
|
|
|
286
290
|
会报告没有沙箱生效。在 `fs-routing` 上,该设置会禁用变更围栏;
|
|
287
291
|
无论开关如何,该行都报告 `sandboxMode: undefined`。
|
|
288
292
|
|
|
293
|
+
### 消息语言
|
|
294
|
+
|
|
295
|
+
插件的拒绝与修复消息(`sessionSandbox` 预检判定、`bwrap` 的安装与修复提示、
|
|
296
|
+
发行版/工作目录命令错误)跟随 harness 应用的语言设置:偏好经宿主 settings
|
|
297
|
+
服务从 `locale` 条目的 `preference` 字段读取,切换语言无需重启应用。
|
|
298
|
+
内置中文(`zh`,含 `zh-CN`、`zh-Hans` 标签)与英文;其他语言——以及
|
|
299
|
+
没有 settings 服务的 profile 或未设置偏好的情况——渲染英文。消息内的
|
|
300
|
+
命令、配置键与文件路径一律不翻译。三组消息按设计保持英文:
|
|
301
|
+
`fs-decisions` 中的 `FS_*` 拒绝文本与 fsio 复刻(工具层按字节匹配这些
|
|
302
|
+
字符串),以及独立运行的 `scripts/doctor.mjs`(它在应用之外执行)。
|
|
303
|
+
|
|
289
304
|
## 诊断配置问题与拒绝
|
|
290
305
|
|
|
291
|
-
|
|
292
|
-
|
|
306
|
+
CLI 发行版可用 `dsh --profile <name> --dump-config` 检查合成后的 profile,
|
|
307
|
+
无需真正启动;输出会显示某行的覆盖是否生效。桌面应用没有 `dsh` 命令,
|
|
308
|
+
请直接查看 `cordis.patch.yml` 与 Plugins 页面。
|
|
293
309
|
使用 `scripts/bootstrap.sh <distro>` 检查发行版前置依赖。
|
|
294
310
|
|
|
295
311
|
| 现象 | 结果 | 处理 |
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Diagnostics: the doctor and the error-code map
|
|
2
|
+
|
|
3
|
+
Every refusal this plugin produces is named. This page is the map between
|
|
4
|
+
those names and the doctor: for each error code, whether the `doctor`
|
|
5
|
+
(`pnpm run doctor`, or `node scripts/doctor.mjs --json`) covers its
|
|
6
|
+
precondition, and which check id answers for it. The authoritative meaning
|
|
7
|
+
and remedy of each code live in [ARCHITECTURE.md](ARCHITECTURE.md#error-codes);
|
|
8
|
+
this page adds the diagnostics dimension and the verdict contract.
|
|
9
|
+
|
|
10
|
+
## The doctor's verdict
|
|
11
|
+
|
|
12
|
+
`doctor --json` (schemaVersion 2) ends in `verdict: "ready" | "blocked"`
|
|
13
|
+
with the blocking ids in `blockers`, and a per-distro breakdown in
|
|
14
|
+
`distroVerdicts`. The blocking rule has one invariant: **a `fail` blocks** —
|
|
15
|
+
config-awareness lives in the statuses (a missing systemd only fails under
|
|
16
|
+
`sessionSandbox: true`; `auto` names its per-command fallback and `false`
|
|
17
|
+
names the opt-out, both as warnings), so the verdict answers under the
|
|
18
|
+
**effective configuration** — the profile layers the app loads, overlaid on
|
|
19
|
+
the shipped preset — not the shipped defaults. The `config.effective` check
|
|
20
|
+
reports what was read and from where.
|
|
21
|
+
|
|
22
|
+
`verdict: ready` means the first command should succeed in the target
|
|
23
|
+
distro(s) under the expected scope; the smoke legs (`functional.exec`,
|
|
24
|
+
`functional.sandbox`, `functional.fs`) prove the chain itself — frame I/O,
|
|
25
|
+
the confined fence, the batched substrate — not just the prerequisites.
|
|
26
|
+
A leg whose prerequisite failed reports `skipped` with the blocker named;
|
|
27
|
+
`skipped` never blocks.
|
|
28
|
+
|
|
29
|
+
`--fix` ends in a re-verified report: every fix is followed by a fresh probe
|
|
30
|
+
of what it claims to have fixed, the affected checks carry the after state,
|
|
31
|
+
and the verdict is recomputed — `ready`, or the remaining blockers. Remedies
|
|
32
|
+
that rewrite user- or distro-owned files (`.wslconfig`, `/etc/wsl.conf`, a
|
|
33
|
+
WSL1 conversion, installing a distro) are never automated; the remedy text
|
|
34
|
+
says so.
|
|
35
|
+
|
|
36
|
+
`--bundle <path>` writes a local JSON file (report + versions + effective
|
|
37
|
+
configuration) for a setup report; `--redact` replaces home and DSH paths
|
|
38
|
+
with `<redacted-*>` placeholders. The bundle contains no file contents, no
|
|
39
|
+
environment variables, and no telemetry.
|
|
40
|
+
|
|
41
|
+
## The map
|
|
42
|
+
|
|
43
|
+
Class legend:
|
|
44
|
+
|
|
45
|
+
- **environment** — a machine state the doctor probes; `doctor` green covers
|
|
46
|
+
it.
|
|
47
|
+
- **policy** — a per-call decision (the sandbox fence, the distro fence);
|
|
48
|
+
the doctor proves the fence's shape, the call decides the case.
|
|
49
|
+
- **data** — caller- or data-transient; no machine precondition exists, so
|
|
50
|
+
no doctor check claims it.
|
|
51
|
+
|
|
52
|
+
| Code | Class | Doctor checks | In one line |
|
|
53
|
+
|---|---|---|---|
|
|
54
|
+
| `SANDBOX_UNAVAILABLE` | environment | `sandbox.bwrap`, `sandbox.bwrap-usable`, `functional.sandbox` | the requested confinement cannot be enforced (no usable bubblewrap) |
|
|
55
|
+
| `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 |
|
|
56
|
+
| `FS_OUTSIDE_DISTRO` | policy | `config.effective` (the effective `distro`) | the path names another distro's share while the fence is pinned |
|
|
57
|
+
| `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 |
|
|
58
|
+
| `FS_NOT_FOUND` | data | — | the path does not exist — the ordinary answer |
|
|
59
|
+
| `FS_NOT_REGULAR_FILE` | data | — | a directory, symlink or device where a regular file is required |
|
|
60
|
+
| `FS_NOT_DIRECTORY` | data | — | a list was asked of a non-directory |
|
|
61
|
+
| `FS_NOT_TEXT` | data | — | the content is not UTF-8 text |
|
|
62
|
+
| `FS_TOO_LARGE` | data | — | the content exceeds the caller's byte cap |
|
|
63
|
+
| `FS_ABORTED` | data | — | the caller's own signal cancelled the call |
|
|
64
|
+
| `FS_NOT_OBSERVED` | data | — | a guarded create targeted a file that existed unread |
|
|
65
|
+
| `FS_STALE_VERSION` | data | — | the caller's version is stale; re-read and retry |
|
|
66
|
+
| `FS_EDIT_NOT_FOUND` | data | — | the literal edit matched nothing |
|
|
67
|
+
| `FS_AMBIGUOUS_EDIT` | data | — | the literal edit matched more than once |
|
|
68
|
+
| `FS_PATCH_MISMATCH` | data | — | the hunks no longer match the file; rebuild them |
|
|
69
|
+
| `FS_SAME_TARGET` | data | — | a move whose source and destination are the same file |
|
|
70
|
+
| `AgentUnavailableError` | environment | `agent.handshake`, `agent.native`, `agent.cache`, `functional.exec` | the execution layer's revival budget is spent; the named state says so |
|
|
71
|
+
|
|
72
|
+
The agent's structured FS reasons (`notfound`, `notdir`, `perm`, `loop`,
|
|
73
|
+
`stale`, `io`) map onto the codes above at `lib/fsio-agent.js`; the wire
|
|
74
|
+
dialect itself is [AGENT-PROTOCOL-V7.md](AGENT-PROTOCOL-V7.md).
|
|
75
|
+
|
|
76
|
+
## When the doctor is green but a call still fails
|
|
77
|
+
|
|
78
|
+
That is the **policy** and **data** classes doing their jobs: a refusal the
|
|
79
|
+
doctor cannot predict because it depends on the call, not the machine. If a
|
|
80
|
+
call fails repeatedly with an **environment**-class code while the doctor
|
|
81
|
+
says `ready`, that is a bug — file it with the `doctor --bundle` output (a
|
|
82
|
+
[setup report](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/.github/ISSUE_TEMPLATE/setup_report.yml)
|
|
83
|
+
carries it).
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# 诊断:doctor 与错误码地图
|
|
2
|
+
|
|
3
|
+
本插件产生的每一个拒绝都有名字。本页是这些名字与 doctor 的对照表:
|
|
4
|
+
对每个错误码,说明 `doctor`(`pnpm run doctor`,或
|
|
5
|
+
`node scripts/doctor.mjs --json`)是否覆盖其前置条件、由哪个检查 id 应答。
|
|
6
|
+
每个码的权威含义与修复在 [ARCHITECTURE.md](ARCHITECTURE.md)(错误码一节);
|
|
7
|
+
本页补充诊断维度与 verdict 契约。
|
|
8
|
+
|
|
9
|
+
## doctor 的裁决
|
|
10
|
+
|
|
11
|
+
`doctor --json`(schemaVersion 2)以 `verdict: "ready" | "blocked"` 收尾,
|
|
12
|
+
阻断 id 列在 `blockers`,按 distro 的细分在 `distroVerdicts`。阻断规则只有
|
|
13
|
+
一条不变式:**`fail` 即阻断**——配置感知体现在状态上(缺 systemd 只在
|
|
14
|
+
`sessionSandbox: true` 时 fail;`auto` 点名其 per-command 回退,`false`
|
|
15
|
+
点名选择退出,两者均为 warn),因此裁决回答的是**生效配置**——应用实际
|
|
16
|
+
加载的 profile 层叠加在出厂 preset 之上——而不是出厂默认。`config.effective`
|
|
17
|
+
检查报告读到了什么、从哪里读的。
|
|
18
|
+
|
|
19
|
+
`verdict: ready` 表示首条命令应在目标 distro、预期 scope 下成功;smoke 腿
|
|
20
|
+
(`functional.exec`、`functional.sandbox`、`functional.fs`)证明链路本身——
|
|
21
|
+
帧 I/O、受限围栏、批量 substrate——而不只是前置条件。前置失败的腿以
|
|
22
|
+
`skipped` 报告并点名阻断者;`skipped` 永不阻断。
|
|
23
|
+
|
|
24
|
+
`--fix` 以复验报告收尾:每个修复后都跟着一次对它声称修好的东西的全新探查,
|
|
25
|
+
受影响的检查项携带 after 状态,verdict 重算——`ready`,或剩余阻断者。
|
|
26
|
+
会改写用户或 distro 所有文件的修复(`.wslconfig`、`/etc/wsl.conf`、WSL1
|
|
27
|
+
转换、安装 distro)永不开户自动化;remedy 文本会写明。
|
|
28
|
+
|
|
29
|
+
`--bundle <path>` 写出本地 JSON 文件(报告 + 版本 + 生效配置)供 setup
|
|
30
|
+
report 附带;`--redact` 把 home 与 DSH 路径替换为 `<redacted-*>` 占位符。
|
|
31
|
+
bundle 不含文件内容、环境变量,也没有遥测。
|
|
32
|
+
|
|
33
|
+
## 地图
|
|
34
|
+
|
|
35
|
+
类别图例:
|
|
36
|
+
|
|
37
|
+
- **environment**——doctor 探查的机器状态;doctor 绿即覆盖。
|
|
38
|
+
- **policy**——按调用决定(沙箱围栏、distro 围栏);doctor 证明围栏形状,
|
|
39
|
+
调用决定具体情形。
|
|
40
|
+
- **data**——调用方或数据瞬态;不存在机器前置条件,因此没有 doctor 检查
|
|
41
|
+
认领它。
|
|
42
|
+
|
|
43
|
+
| 码 | 类别 | doctor 检查 | 一句话 |
|
|
44
|
+
|---|---|---|---|
|
|
45
|
+
| `SANDBOX_UNAVAILABLE` | environment | `sandbox.bwrap`、`sandbox.bwrap-usable`、`functional.sandbox` | 所请求的隔离无法强制(无可用 bubblewrap) |
|
|
46
|
+
| `FS_SANDBOX_DENIED` | policy | `functional.sandbox`(围栏形状) | 文件效果策略拒绝了写入,或内核在驻留 agent 的 profile 处拒绝 |
|
|
47
|
+
| `FS_OUTSIDE_DISTRO` | policy | `config.effective`(生效的 `distro`) | 围栏钉死时路径指向另一 distro 的共享 |
|
|
48
|
+
| `FS_IO_ERROR` | environment | `distro.reachable`、`distro.disk`、`agent.handshake`、`functional.exec`、`functional.fs` | 兜底:agent 失联、distro 僵死、磁盘满、无法映射的路径 |
|
|
49
|
+
| `FS_NOT_FOUND` | data | — | 路径不存在——普通答案 |
|
|
50
|
+
| `FS_NOT_REGULAR_FILE` | data | — | 需要常规文件处出现了目录、符号链接或设备 |
|
|
51
|
+
| `FS_NOT_DIRECTORY` | data | — | 对非目录发起列表 |
|
|
52
|
+
| `FS_NOT_TEXT` | data | — | 内容不是 UTF-8 文本 |
|
|
53
|
+
| `FS_TOO_LARGE` | data | — | 内容超出调用方携带的字节上限 |
|
|
54
|
+
| `FS_ABORTED` | data | — | 调用方自己的信号取消了调用 |
|
|
55
|
+
| `FS_NOT_OBSERVED` | data | — | 受守卫的创建命中了存在但未读过的文件 |
|
|
56
|
+
| `FS_STALE_VERSION` | data | — | 调用方版本过期;重读后重试 |
|
|
57
|
+
| `FS_EDIT_NOT_FOUND` | data | — | 字面编辑没有命中 |
|
|
58
|
+
| `FS_AMBIGUOUS_EDIT` | data | — | 字面编辑命中多处 |
|
|
59
|
+
| `FS_PATCH_MISMATCH` | data | — | hunk 与文件不再吻合;按新文本重建 |
|
|
60
|
+
| `FS_SAME_TARGET` | data | — | move 的源与目的地解析为同一文件 |
|
|
61
|
+
| `AgentUnavailableError` | environment | `agent.handshake`、`agent.native`、`agent.cache`、`functional.exec` | 执行层的复活预算耗尽;具名状态会说明 |
|
|
62
|
+
|
|
63
|
+
agent 的结构化 FS 原因(`notfound`、`notdir`、`perm`、`loop`、`stale`、
|
|
64
|
+
`io`)在 `lib/fsio-agent.js` 映射到上表各码;线上方言本身见
|
|
65
|
+
[AGENT-PROTOCOL-V7.md](AGENT-PROTOCOL-V7.md)。
|
|
66
|
+
|
|
67
|
+
## doctor 绿但调用仍失败
|
|
68
|
+
|
|
69
|
+
那是 **policy** 与 **data** 类别在正常工作:doctor 无法预测取决于调用而非
|
|
70
|
+
机器的拒绝。若某个 **environment** 类错误码反复出现而 doctor 显示 `ready`,
|
|
71
|
+
那是缺陷——附上 `doctor --bundle` 输出提报
|
|
72
|
+
([setup report](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/.github/ISSUE_TEMPLATE/setup_report.yml)
|
|
73
|
+
会携带它)。
|
package/docs/LIMITATIONS.md
CHANGED
|
@@ -24,8 +24,11 @@ operations never use the 9p share.
|
|
|
24
24
|
`FS_STALE_VERSION`, but a change between check and rename can still be overwritten.
|
|
25
25
|
- **A cancelled write can have an unknown outcome** — inspect the file before
|
|
26
26
|
retrying.
|
|
27
|
-
- **A successful write is
|
|
28
|
-
|
|
27
|
+
- **A successful write is as crash-durable as the platform's `sync -d`.** The
|
|
28
|
+
staged file is synced, and the containing directory is fsynced best effort
|
|
29
|
+
after the rename (shell agent). The native agent keeps its file-level
|
|
30
|
+
`sync_all` only — see the peer-parity divergence note. A filesystem that
|
|
31
|
+
refuses a directory fsync keeps the peer's own promise.
|
|
29
32
|
- **A Linux filename containing a backslash cannot be addressed** — the backslash is
|
|
30
33
|
the UNC separator, so `a\b.ts` round-trips to `a/b.ts`. Rename away from backslash
|
|
31
34
|
names; this is the coordinate system's own limit.
|
|
@@ -91,6 +94,14 @@ operations never use the 9p share.
|
|
|
91
94
|
[ARCHITECTURE.md](ARCHITECTURE.md#reported-enforcement).
|
|
92
95
|
- **`bubblewrap` must be installed**, or both providers fail with the install
|
|
93
96
|
command; a session-start preflight surfaces the same text as an advisory warning.
|
|
97
|
+
- **Message localization is partial by design** — the preflight verdicts, `bwrap`
|
|
98
|
+
remedies and distro/workdir errors follow the app's Language setting
|
|
99
|
+
([CONFIGURATION.md](CONFIGURATION.md#message-language)); the `FS_*` refusal texts
|
|
100
|
+
in `fs-decisions` and the fsio replica stay byte-identical English because the
|
|
101
|
+
tool layer matches on those strings, and the standalone `scripts/doctor.mjs`
|
|
102
|
+
always prints English because it runs outside the app and cannot read the
|
|
103
|
+
host's locale preference. A remedy composed at probe time keeps the language
|
|
104
|
+
the probe ran in until that probe runs again.
|
|
94
105
|
- A workspace directory deleted mid-session fails with a runner error; the plugin
|
|
95
106
|
does not recreate it. A configured `cwd` that does not exist is reported as an
|
|
96
107
|
error naming the directory.
|
|
@@ -101,6 +112,12 @@ Commands run as `<shell> -lc <command>` — login (profile scripts sourced, so v
|
|
|
101
112
|
managers work) and **non-interactive** (no prompt/plugin output in the model's
|
|
102
113
|
streams). With `loginShell: false` the login flag is dropped (`<shell> -c <command>`).
|
|
103
114
|
|
|
115
|
+
`<shell>` is the distro user's login shell (`getent passwd`, then `$SHELL`). When
|
|
116
|
+
both probes fail — a cold distro, a flaky first `wsl.exe` call, a musl distro
|
|
117
|
+
without `getent` — the command **errors out** instead of silently running under
|
|
118
|
+
bash; the failure is not cached, so a retry re-probes. Set `shell:` to an
|
|
119
|
+
absolute path to pin one.
|
|
120
|
+
|
|
104
121
|
- **`~/.zshrc` / `~/.bashrc` are never read.** Move machine-level PATH setup
|
|
105
122
|
(`fnm`, nvm, cargo) into `~/.zprofile` or `~/.zshenv`; keep prompts and completion
|
|
106
123
|
in the rc file.
|
|
@@ -111,13 +128,33 @@ streams). With `loginShell: false` the login flag is dropped (`<shell> -c <comma
|
|
|
111
128
|
## Agent diagnostics
|
|
112
129
|
|
|
113
130
|
- **The doctor's `agent.handshake` probes a fresh resident**, not the live one —
|
|
114
|
-
a running resident's
|
|
115
|
-
|
|
131
|
+
a running resident's own view is folded in where a shared agent exists
|
|
132
|
+
(`doctorReport` merges `WslAgent.status()` via `mergeLiveResidentStatus`,
|
|
133
|
+
0.18.0), but the CLI's handshake check still names its probe source
|
|
134
|
+
(`probed: a fresh resident`); without an app-side call the `lastError`
|
|
135
|
+
stays in the app log.
|
|
116
136
|
- **`dsh-wsl-*.scope` counts are point-in-time**; `--fix` runs the preflight's sweep.
|
|
117
137
|
- **The doctor's `git.win-safe` probe reports the Windows git trust through interop
|
|
118
138
|
`git.exe`** — the `safe.directory` whitelist that WSL change review needs when
|
|
119
139
|
Windows git is installed (see Terminals below).
|
|
120
140
|
|
|
141
|
+
## The doctor's verdict and remedy boundary
|
|
142
|
+
|
|
143
|
+
The doctor's `verdict` answers under the effective configuration (the profile
|
|
144
|
+
layers the app loads, overlaid on the shipped preset) — but it is a verdict
|
|
145
|
+
about the machine and the configuration, not about a session: the
|
|
146
|
+
**policy**- and **data**-class error codes (see
|
|
147
|
+
[DIAGNOSTICS.md](DIAGNOSTICS.md#the-map)) are per-call decisions the doctor
|
|
148
|
+
cannot predict, and `ready` does not promise them away.
|
|
149
|
+
|
|
150
|
+
The doctor reads and reports; it never rewrites user- or distro-owned files.
|
|
151
|
+
`.wslconfig`, `/etc/wsl.conf`, a WSL1 conversion and distro installation are
|
|
152
|
+
remedy-only — the remedy text carries the exact command — and the fixable set
|
|
153
|
+
is limited to what is safe and reversible (stale scopes, the optional
|
|
154
|
+
packages behind `--install` plus a confirmation, and the Windows git
|
|
155
|
+
safe.directory whitelist behind the same gate). The verdict never upgrades
|
|
156
|
+
the sandbox's security statement: `enforcement: partial` is untouched.
|
|
157
|
+
|
|
121
158
|
## Session-start advisories
|
|
122
159
|
|
|
123
160
|
- **There is no session-UI notice seam in DSH 0.2.1.** `wsl-preflight` failures go
|