dsh-plugin-wsl-env 0.21.0 → 0.22.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 +66 -1
- package/client.js +153 -33
- package/cordis.patch.yml +9 -0
- package/docs/CONFIGURATION.md +10 -1
- package/docs/DIAGNOSTICS.md +28 -1
- package/docs/DIAGNOSTICS.zh.md +24 -1
- package/lib/index.d.ts +11 -0
- package/lib/index.js +4 -0
- package/lib/messages.d.ts +81 -0
- package/lib/messages.js +94 -1
- package/lib/wsl-doctor-command.d.ts +105 -0
- package/lib/wsl-doctor-command.js +240 -0
- package/lib/wsl-doctor-tool.d.ts +99 -7
- package/lib/wsl-doctor-tool.js +284 -22
- package/locale/doctor/en.json +30 -0
- package/locale/doctor/zh.json +30 -0
- package/package.json +7 -3
- package/scripts/doctor.mjs +569 -141
package/CHANGELOG.md
CHANGED
|
@@ -14,7 +14,72 @@ document: the 0.1.0 entry's `design-history §` references are to
|
|
|
14
14
|
keeps the superseded designs under the section numbers they had while they
|
|
15
15
|
were part of the record.
|
|
16
16
|
|
|
17
|
-
## [
|
|
17
|
+
## [0.22.0] - 2026-11-08
|
|
18
|
+
|
|
19
|
+
One theme: the doctor's report becomes something a human can read and act on —
|
|
20
|
+
every check itemized with an explicit status marker, the run reachable as a
|
|
21
|
+
global `/wsl-doctor` command that renders outside model history, and the fixed
|
|
22
|
+
skeleton localized to the host language.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- **The `wsl_doctor` tool is interactive: quick first, sections for
|
|
27
|
+
follow-ups, per-section tallies in every answer.** The old shape was one
|
|
28
|
+
blocking call (100 s+ across every distro) that returned a bare verdict
|
|
29
|
+
plus the fail list — the conversation hung and the result said nothing
|
|
30
|
+
about what had been tested. The tool now takes `depth: "quick"` (the
|
|
31
|
+
prerequisites: host facts, the session quartet, bubblewrap — ~10 s in one
|
|
32
|
+
distro, no smokes, no registry, no port survey) and `section` (one of
|
|
33
|
+
host/sandbox/session/conf/net/agent) for focused follow-ups; `depth:
|
|
34
|
+
"full"` stays the complete scan. Every digest carries per-section tallies
|
|
35
|
+
(ok/warn/fail/unknown), so the passed checks are visible instead of
|
|
36
|
+
silent. The CLI mirrors the scoping (`--quick`, `--sections <csv>`, a
|
|
37
|
+
`scope` block in the scoped `--json` report; `--fix` still requires a full
|
|
38
|
+
run). One tool, multiple calls — the progress story is the call sequence,
|
|
39
|
+
because the tool pipeline has no mid-execution event channel (verified
|
|
40
|
+
end-to-end: `dsh-tools` contract, `dsh-session` event map, and the
|
|
41
|
+
conversation UI's surface projection all lack one; to be proposed
|
|
42
|
+
upstream).
|
|
43
|
+
|
|
44
|
+
- **The doctor's report itemizes every check, and `/wsl-doctor` runs it
|
|
45
|
+
detached from model history.** A scoped run used to say nothing about the
|
|
46
|
+
checks its profile never executed, and a multi-distro report flattened into
|
|
47
|
+
one undifferentiated block. `digestReport` now carries per-distro tallies
|
|
48
|
+
(first-appearance order, the session's distro flagged) and an itemized
|
|
49
|
+
listing — every check with an explicit `[OK]`/`[WARN]`/`[FAIL]`/`[INFO]`/
|
|
50
|
+
`[SKIP]`/`[??]` marker, its title and what it found, the copy-paste remedy
|
|
51
|
+
under every failure; scoped runs surface untouched checks as `[SKIP]` rows
|
|
52
|
+
driven by a check catalog. The `wsl_doctor` tool's structured result field
|
|
53
|
+
is `report` now, and `depth` defaults to `quick`. The new `/wsl-doctor`
|
|
54
|
+
command registers globally and spawns the standalone doctor CLI as a host
|
|
55
|
+
subprocess: the report renders without consuming tokens, and the diagnosis
|
|
56
|
+
still answers when the plugin's own runtime is what is broken. The composer
|
|
57
|
+
button becomes a mode menu (quick/full + the six sections); deployments
|
|
58
|
+
without a command adapter keep the CLI.
|
|
59
|
+
|
|
60
|
+
- **The doctor's fixed skeleton localizes.** Check catalogs live in
|
|
61
|
+
`locale/doctor/{en,zh}.json`; a `--locale` flag and `DSH_WSL_DOCTOR_LOCALE`
|
|
62
|
+
override exist, and the Windows locale is detected through `reg query`
|
|
63
|
+
(no PowerShell startup). `--json` stays language-independent.
|
|
64
|
+
`installMessagesLocale` falls back to the OS ICU locale when no Settings
|
|
65
|
+
preference was stored, so a provisional-Chinese UI renders Chinese; an
|
|
66
|
+
explicit Settings choice always wins.
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- **A transport flake no longer reports a config verdict.** Under the
|
|
71
|
+
doctor's concurrent probing of several distros on one VM, `wsl.exe` calls
|
|
72
|
+
can time out (`Wsl/Service/WSAETIMEDOUT`) or answer from a cold,
|
|
73
|
+
mid-boot distro — and those reads were reported as authoritative `fail`s:
|
|
74
|
+
a static `/etc/wsl.conf` read broken one run and fine the next. Every
|
|
75
|
+
in-distro probe now retries once after a settle delay when a capture smells
|
|
76
|
+
like a flake (execFile deadline, or WSL's own wedged-service error text);
|
|
77
|
+
a flake that survives the retry reports the new `unknown` status — it
|
|
78
|
+
names the flake in its detail, never blocks, and never feeds a config
|
|
79
|
+
verdict. The smoke sessions (EXEC/FSB, the confined fence) retry once on
|
|
80
|
+
failure too, so the most alarming row in the report cannot rest on one
|
|
81
|
+
wedged transport. A one-shot flake recovers invisibly; a persistent one
|
|
82
|
+
earns a rerun remedy, not a false remedy for a healthy machine.
|
|
18
83
|
|
|
19
84
|
## [0.21.0] - 2026-11-08
|
|
20
85
|
|
package/client.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The doctor's GUI button: a pill in the conversation composer dock that
|
|
3
|
-
*
|
|
2
|
+
* The doctor's GUI button: a pill in the conversation composer dock that opens
|
|
3
|
+
* a small menu of wsl_doctor run modes — two depths (quick, full) and the
|
|
4
|
+
* six single-section scopes. Picking an entry drops the matching `/wsl-doctor`
|
|
5
|
+
* command into the current session's input and submits it; the commands
|
|
6
|
+
* registry executes it host-side and the report renders in the UI without a
|
|
7
|
+
* model turn.
|
|
4
8
|
*
|
|
5
9
|
* The composer dock's slot components receive the harness's standard props —
|
|
6
10
|
* `inputActions` among them. Sending is `setDraft(text)` (replace the whole
|
|
7
11
|
* draft with plain text) followed by `submit()` (send the current draft — the
|
|
8
12
|
* published face has no submit-with-text verb). When those verbs are missing
|
|
9
|
-
* the
|
|
13
|
+
* the menu degrades to a draft prefill, never to a broken control.
|
|
10
14
|
*
|
|
11
15
|
* Loaded by the harness's web client loader through the `dsh.client`
|
|
12
16
|
* declaration in package.json; the composition's bare-name row
|
|
@@ -18,13 +22,54 @@ window.__ModuleLoader__.load({
|
|
|
18
22
|
factory(require) {
|
|
19
23
|
const React = require("react");
|
|
20
24
|
const h = React.createElement;
|
|
25
|
+
const useEffect = React.useEffect;
|
|
26
|
+
const useState = React.useState;
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
// The command plane, not the model: each entry drops a `/wsl-doctor` line.
|
|
29
|
+
// Slash commands execute in the UI command plane against the commands
|
|
30
|
+
// registry (`dsh-commands` contract) — the handler spawns the standalone
|
|
31
|
+
// doctor CLI and the settled report renders detached from model history,
|
|
32
|
+
// adding no tokens. A deployment without the command adapter rejects the
|
|
33
|
+
// line at the composer instead of sending a prompt.
|
|
34
|
+
const commandFor = (mode) => {
|
|
35
|
+
if (mode.kind === "quick") return "/wsl-doctor quick";
|
|
36
|
+
if (mode.kind === "full") return "/wsl-doctor full";
|
|
37
|
+
return "/wsl-doctor " + mode.section;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Menu layout: two depth entries, then the section scopes the wsl_doctor
|
|
41
|
+
// tool accepts. Labels mirror the tool's own depth/section vocabulary.
|
|
42
|
+
const MENU = [
|
|
43
|
+
{ header: "诊断深度" },
|
|
44
|
+
{ label: "快速诊断(推荐)", hint: "仅前置项,约 10 秒", mode: { kind: "quick" } },
|
|
45
|
+
{ label: "完整诊断", hint: "全部检查项含 agent 冒烟", mode: { kind: "full" } },
|
|
46
|
+
{ header: "分区诊断" },
|
|
47
|
+
{ label: "host", mode: { kind: "section", section: "host" } },
|
|
48
|
+
{ label: "sandbox", mode: { kind: "section", section: "sandbox" } },
|
|
49
|
+
{ label: "session", mode: { kind: "section", section: "session" } },
|
|
50
|
+
{ label: "conf", mode: { kind: "section", section: "conf" } },
|
|
51
|
+
{ label: "net", mode: { kind: "section", section: "net" } },
|
|
52
|
+
{ label: "agent", mode: { kind: "section", section: "agent" } },
|
|
53
|
+
];
|
|
25
54
|
|
|
26
55
|
function DoctorButton(props) {
|
|
27
|
-
const
|
|
56
|
+
const [open, setOpen] = useState(false);
|
|
57
|
+
const [root, setRoot] = useState(null);
|
|
58
|
+
|
|
59
|
+
// Close on any outside click; the root node ref keeps the listener's
|
|
60
|
+
// contains() check exact without querying the DOM.
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!open || !root) return undefined;
|
|
63
|
+
const close = (event) => {
|
|
64
|
+
if (root && !root.contains(event.target)) setOpen(false);
|
|
65
|
+
};
|
|
66
|
+
document.addEventListener("mousedown", close);
|
|
67
|
+
return () => document.removeEventListener("mousedown", close);
|
|
68
|
+
}, [open, root]);
|
|
69
|
+
|
|
70
|
+
const send = (mode) => {
|
|
71
|
+
setOpen(false);
|
|
72
|
+
const command = commandFor(mode);
|
|
28
73
|
const actions = props && props.inputActions;
|
|
29
74
|
// The published InputActions face has no submit(text): submit() sends
|
|
30
75
|
// the CURRENT draft, and insertText needs a captureInsertion() span.
|
|
@@ -32,7 +77,7 @@ window.__ModuleLoader__.load({
|
|
|
32
77
|
// sends it — one click, no span bookkeeping.
|
|
33
78
|
if (actions && typeof actions.setDraft === "function" && typeof actions.submit === "function") {
|
|
34
79
|
try {
|
|
35
|
-
actions.setDraft(
|
|
80
|
+
actions.setDraft(command);
|
|
36
81
|
actions.submit();
|
|
37
82
|
return;
|
|
38
83
|
} catch (error) {
|
|
@@ -42,40 +87,115 @@ window.__ModuleLoader__.load({
|
|
|
42
87
|
}
|
|
43
88
|
if (actions && typeof actions.setDraft === "function") {
|
|
44
89
|
try {
|
|
45
|
-
actions.setDraft(
|
|
90
|
+
actions.setDraft(command);
|
|
46
91
|
return;
|
|
47
92
|
} catch (error) {
|
|
48
93
|
// Ignored: the draft stays untouched rather than half-filled.
|
|
49
94
|
}
|
|
50
95
|
}
|
|
51
96
|
};
|
|
97
|
+
|
|
98
|
+
const menu = open
|
|
99
|
+
? h(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
// Anchored above the pill; the dock sits at the composer's
|
|
103
|
+
// bottom edge, so the menu opens upward.
|
|
104
|
+
style: {
|
|
105
|
+
position: "absolute",
|
|
106
|
+
bottom: "calc(100% + 6px)",
|
|
107
|
+
right: 0,
|
|
108
|
+
minWidth: 220,
|
|
109
|
+
padding: "4px 0",
|
|
110
|
+
borderRadius: 8,
|
|
111
|
+
background: "var(--dsh-bg, #1f1f1f)",
|
|
112
|
+
color: "inherit",
|
|
113
|
+
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.35)",
|
|
114
|
+
border: "1px solid rgba(128, 128, 128, 0.35)",
|
|
115
|
+
zIndex: 50,
|
|
116
|
+
fontSize: 12,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
MENU.map((entry, index) => {
|
|
120
|
+
if (entry.header) {
|
|
121
|
+
return h(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
key: "header-" + entry.header,
|
|
125
|
+
style: {
|
|
126
|
+
padding: "5px 12px 3px",
|
|
127
|
+
opacity: 0.55,
|
|
128
|
+
fontSize: 11,
|
|
129
|
+
userSelect: "none",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
entry.header
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
return h(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
key: "item-" + String(index),
|
|
139
|
+
onClick: () => send(entry.mode),
|
|
140
|
+
style: {
|
|
141
|
+
display: "flex",
|
|
142
|
+
justifyContent: "space-between",
|
|
143
|
+
gap: 10,
|
|
144
|
+
padding: "6px 12px",
|
|
145
|
+
cursor: "pointer",
|
|
146
|
+
whiteSpace: "nowrap",
|
|
147
|
+
},
|
|
148
|
+
onMouseEnter: (event) => {
|
|
149
|
+
event.currentTarget.style.background = "rgba(128, 128, 128, 0.2)";
|
|
150
|
+
},
|
|
151
|
+
onMouseLeave: (event) => {
|
|
152
|
+
event.currentTarget.style.background = "transparent";
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
h("span", null, entry.label),
|
|
156
|
+
entry.hint
|
|
157
|
+
? h("span", { style: { opacity: 0.55, fontSize: 11 } }, entry.hint)
|
|
158
|
+
: null
|
|
159
|
+
);
|
|
160
|
+
})
|
|
161
|
+
)
|
|
162
|
+
: null;
|
|
163
|
+
|
|
52
164
|
return h(
|
|
53
|
-
"
|
|
165
|
+
"div",
|
|
54
166
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
alignItems: "center",
|
|
61
|
-
gap: 5,
|
|
62
|
-
// The dock is a centered flex row; an auto left margin overrides
|
|
63
|
-
// the group centering for this item alone and pins the pill to
|
|
64
|
-
// the dock's right edge.
|
|
65
|
-
marginLeft: "auto",
|
|
66
|
-
padding: "2px 10px",
|
|
67
|
-
borderRadius: 999,
|
|
68
|
-
fontSize: 12,
|
|
69
|
-
border: "none",
|
|
70
|
-
outline: "none",
|
|
71
|
-
background: "transparent",
|
|
72
|
-
color: "inherit",
|
|
73
|
-
opacity: 0.75,
|
|
74
|
-
cursor: "pointer",
|
|
75
|
-
userSelect: "none",
|
|
76
|
-
},
|
|
167
|
+
ref: setRoot,
|
|
168
|
+
// The dock is a centered flex row; an auto left margin overrides the
|
|
169
|
+
// group centering for this item alone and pins the pill to the
|
|
170
|
+
// dock's right edge.
|
|
171
|
+
style: { position: "relative", marginLeft: "auto" },
|
|
77
172
|
},
|
|
78
|
-
|
|
173
|
+
menu,
|
|
174
|
+
h(
|
|
175
|
+
"button",
|
|
176
|
+
{
|
|
177
|
+
type: "button",
|
|
178
|
+
onClick: () => setOpen(!open),
|
|
179
|
+
title: "运行 WSL 环境诊断(doctor):选择诊断模式",
|
|
180
|
+
style: {
|
|
181
|
+
display: "flex",
|
|
182
|
+
alignItems: "center",
|
|
183
|
+
gap: 5,
|
|
184
|
+
padding: "2px 10px",
|
|
185
|
+
borderRadius: 999,
|
|
186
|
+
fontSize: 12,
|
|
187
|
+
border: "none",
|
|
188
|
+
outline: "none",
|
|
189
|
+
background: "transparent",
|
|
190
|
+
color: "inherit",
|
|
191
|
+
opacity: 0.75,
|
|
192
|
+
cursor: "pointer",
|
|
193
|
+
userSelect: "none",
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
"WSL 诊断",
|
|
197
|
+
h("span", { style: { fontSize: 9, opacity: 0.8 } }, open ? "▲" : "▼")
|
|
198
|
+
)
|
|
79
199
|
);
|
|
80
200
|
}
|
|
81
201
|
|
package/cordis.patch.yml
CHANGED
|
@@ -163,6 +163,15 @@
|
|
|
163
163
|
- id: wsl-env-client-host
|
|
164
164
|
name: 'dsh-plugin-wsl-env'
|
|
165
165
|
|
|
166
|
+
# The human-facing `/wsl-doctor` command (the composer button's target):
|
|
167
|
+
# registered globally so any session can run the diagnosis, not only WSL
|
|
168
|
+
# preset agents. The handler spawns the standalone doctor CLI — no model
|
|
169
|
+
# turn, no in-process collector — so the command still answers when the
|
|
170
|
+
# plugin's own runtime is the thing being diagnosed. Deployments without a
|
|
171
|
+
# command adapter leave this row a no-op.
|
|
172
|
+
- id: wsl-doctor-command
|
|
173
|
+
name: 'dsh-plugin-wsl-env/wsl-doctor-command'
|
|
174
|
+
|
|
166
175
|
- id: fs-routing
|
|
167
176
|
name: 'dsh-plugin-wsl-env/fs-routing'
|
|
168
177
|
config:
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -324,7 +324,16 @@ layer matches on those strings byte-for-byte), and the standalone
|
|
|
324
324
|
|
|
325
325
|
In a session the model can run the diagnosis itself: the `wsl_doctor` tool
|
|
326
326
|
(mounted inside `preset-wsl`) calls the doctor in-process and returns the
|
|
327
|
-
verdict with per-failure remedies — the user just
|
|
327
|
+
verdict with per-section tallies and per-failure remedies — the user just
|
|
328
|
+
asks for a diagnosis. The tool is interactive by design: `depth: "quick"`
|
|
329
|
+
runs the prerequisites only (~10 s in one distro: host facts, the session
|
|
330
|
+
sandbox quartet, bubblewrap — no smokes, no registry query, no port survey)
|
|
331
|
+
and is the right first call; `section` narrows a follow-up to one area
|
|
332
|
+
(`host`, `sandbox`, `session`, `conf`, `net`, `agent`); `depth: "full"` is
|
|
333
|
+
the complete scan and answers for everything. The CLI mirrors the same
|
|
334
|
+
scoping: `--quick` and `--sections <csv>` bound what a run probes, and a
|
|
335
|
+
scoped `--json` report carries its `scope` so a verdict always names the
|
|
336
|
+
scope it answers for (`--fix` still requires a full run).
|
|
328
337
|
`DSH_WSL_DOCTOR` additionally carries a ready-to-run command that executes
|
|
329
338
|
the doctor script from inside the distro (the app's own runtime as Node,
|
|
330
339
|
through interop) — run it as `sh -c "$DSH_WSL_DOCTOR --json"`. And
|
package/docs/DIAGNOSTICS.md
CHANGED
|
@@ -24,7 +24,12 @@ 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
26
|
A leg whose prerequisite failed reports `skipped` with the blocker named;
|
|
27
|
-
`skipped` never blocks.
|
|
27
|
+
`skipped` never blocks. A read the transport could not vouch for — `wsl.exe`
|
|
28
|
+
timed out or wedged mid-probe, common when several distros are probed
|
|
29
|
+
concurrently and one of them is cold-booting — reports `unknown` after one
|
|
30
|
+
automatic retry, names the flake in its detail, and never blocks or feeds a
|
|
31
|
+
config verdict: a flaked read of `/etc/wsl.conf` says the read failed, never
|
|
32
|
+
that the file is broken. Rerun the doctor for a clean answer.
|
|
28
33
|
|
|
29
34
|
`--fix` ends in a re-verified report: every fix is followed by a fresh probe
|
|
30
35
|
of what it claims to have fixed, the affected checks carry the after state,
|
|
@@ -38,6 +43,28 @@ configuration) for a setup report; `--redact` replaces home and DSH paths
|
|
|
38
43
|
with `<redacted-*>` placeholders. The bundle contains no file contents, no
|
|
39
44
|
environment variables, and no telemetry.
|
|
40
45
|
|
|
46
|
+
## The surfaces
|
|
47
|
+
|
|
48
|
+
The doctor answers through three surfaces with one report:
|
|
49
|
+
|
|
50
|
+
- **The standalone CLI** — `node scripts/doctor.mjs [distro] [--json] [--quick] [--sections …] [--locale <tag>]`.
|
|
51
|
+
The authoritative surface: it loads **no peer dependency and no host
|
|
52
|
+
service**, so it still starts when the plugin's own runtime is the thing
|
|
53
|
+
that is broken. Only pure, peer-free `lib/` modules are imported; the two
|
|
54
|
+
helpers that used to live behind peer-tainted modules (`lib/index.js`,
|
|
55
|
+
`lib/update-check.js`) are inlined and drift-pinned against the lib exports
|
|
56
|
+
by `test/doctor.test.mjs`. Exit 0 = `ready`, 1 = `blocked`.
|
|
57
|
+
- **The `/wsl-doctor` UI command** — the composer button drops a
|
|
58
|
+
`/wsl-doctor [quick|full|<section>] [--distro <name>]` line; the commands
|
|
59
|
+
registry executes it host-side, the handler spawns the standalone CLI, and
|
|
60
|
+
the itemized report renders detached from model history (no model turn, no
|
|
61
|
+
tokens). Without a command adapter (headless, ACP) the row is a no-op and
|
|
62
|
+
the CLI is the surface.
|
|
63
|
+
- **The `wsl_doctor` model tool** — in-process via `doctorReport()`, so the
|
|
64
|
+
live resident's state merges in. This is the only surface that depends on
|
|
65
|
+
the model path; use the command or the CLI when the plugin's runtime itself
|
|
66
|
+
is under suspicion.
|
|
67
|
+
|
|
41
68
|
## The map
|
|
42
69
|
|
|
43
70
|
Class legend:
|
package/docs/DIAGNOSTICS.zh.md
CHANGED
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
`verdict: ready` 表示首条命令应在目标 distro、预期 scope 下成功;smoke 腿
|
|
20
20
|
(`functional.exec`、`functional.sandbox`、`functional.fs`)证明链路本身——
|
|
21
21
|
帧 I/O、受限围栏、批量 substrate——而不只是前置条件。前置失败的腿以
|
|
22
|
-
`skipped` 报告并点名阻断者;`skipped`
|
|
22
|
+
`skipped` 报告并点名阻断者;`skipped` 永不阻断。传输层无法担保的读数——
|
|
23
|
+
`wsl.exe` 超时或探测中途卡死(多个 distro 并发探测、其中一个正在冷启动时
|
|
24
|
+
最常见)——在自动重试一次后报告 `unknown`,detail 点名该次抖动;`unknown`
|
|
25
|
+
永不阻断,也不构成配置裁决:`/etc/wsl.conf` 读数抖动说明的是读取失败,
|
|
26
|
+
而不是文件损坏。重跑 doctor 即可得到干净答案。
|
|
23
27
|
|
|
24
28
|
`--fix` 以复验报告收尾:每个修复后都跟着一次对它声称修好的东西的全新探查,
|
|
25
29
|
受影响的检查项携带 after 状态,verdict 重算——`ready`,或剩余阻断者。
|
|
@@ -30,6 +34,25 @@
|
|
|
30
34
|
report 附带;`--redact` 把 home 与 DSH 路径替换为 `<redacted-*>` 占位符。
|
|
31
35
|
bundle 不含文件内容、环境变量,也没有遥测。
|
|
32
36
|
|
|
37
|
+
## 三个入口
|
|
38
|
+
|
|
39
|
+
doctor 通过三个入口给出同一份报告:
|
|
40
|
+
|
|
41
|
+
- **独立 CLI**——`node scripts/doctor.mjs [distro] [--json] [--quick] [--sections …] [--locale <tag>]`。
|
|
42
|
+
这是权威入口:它**不加载任何 peer 依赖、任何宿主服务**,即使插件的运行时
|
|
43
|
+
本身就是故障源,它也能启动。只 import 纯净、无 peer 的 `lib/` 模块;原先
|
|
44
|
+
挂在 peer 污染模块(`lib/index.js`、`lib/update-check.js`)后面的两个
|
|
45
|
+
helper 已内联,并由 `test/doctor.test.mjs` 与 lib 导出对拍防漂移。
|
|
46
|
+
退出码 0 = `ready`,1 = `blocked`。
|
|
47
|
+
- **`/wsl-doctor` UI 命令**——composer 按钮投下
|
|
48
|
+
`/wsl-doctor [quick|full|<分区>] [--distro <名称>]`;命令面在宿主侧执行,
|
|
49
|
+
handler 子进程运行独立 CLI,逐项报告直接渲染在 UI 上、不进模型历史
|
|
50
|
+
(无模型回合、零 token)。没有命令适配器的部署(headless、ACP)中该行是
|
|
51
|
+
no-op,CLI 就是入口。
|
|
52
|
+
- **`wsl_doctor` 模型工具**——经 `doctorReport()` 进程内采集,会合并常驻
|
|
53
|
+
agent 的实时状态。这是唯一依赖模型链路的入口;怀疑插件运行时本身时,
|
|
54
|
+
用命令或 CLI。
|
|
55
|
+
|
|
33
56
|
## 地图
|
|
34
57
|
|
|
35
58
|
类别图例:
|
package/lib/index.d.ts
CHANGED
|
@@ -108,6 +108,17 @@ export declare function doctorReport(distro: string, options?: {
|
|
|
108
108
|
doctorPath?: string;
|
|
109
109
|
/** The `wsl.exe` the doctor probes with; forwarded as `--wsl <path>`. */
|
|
110
110
|
wslPath?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Run the quick profile instead of the full scan: first-command
|
|
113
|
+
* prerequisites only (host/session/sandbox, no smokes, no registry query,
|
|
114
|
+
* no port survey) — forwarded as `--quick`.
|
|
115
|
+
*/
|
|
116
|
+
quick?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Restrict the run to these doctor sections (host, sandbox, session, conf,
|
|
119
|
+
* net, agent); forwarded as `--sections <csv>`. Undefined runs everything.
|
|
120
|
+
*/
|
|
121
|
+
sections?: readonly string[];
|
|
111
122
|
/**
|
|
112
123
|
* Prepended to the doctor subprocess's PATH — a caller that stages a fake
|
|
113
124
|
* `wsl.exe` (tests) passes the staging directory here instead of mutating
|
package/lib/index.js
CHANGED
|
@@ -204,6 +204,10 @@ const DOCTOR_SCRIPT = join(dirname(fileURLToPath(import.meta.url)), "..", "scrip
|
|
|
204
204
|
export async function doctorReport(distro, options) {
|
|
205
205
|
const script = options?.doctorPath ?? DOCTOR_SCRIPT;
|
|
206
206
|
const argv = [script, distro, "--json"];
|
|
207
|
+
if (options?.quick === true)
|
|
208
|
+
argv.push("--quick");
|
|
209
|
+
if (options?.sections !== undefined && options.sections.length > 0)
|
|
210
|
+
argv.push("--sections", [...options.sections].join(","));
|
|
207
211
|
if (options?.wslPath !== undefined)
|
|
208
212
|
argv.push("--wsl", options.wslPath);
|
|
209
213
|
// A nonzero doctor exit usually means an environment check FAILED on the
|
package/lib/messages.d.ts
CHANGED
|
@@ -92,6 +92,71 @@ declare const en: {
|
|
|
92
92
|
workdir: string;
|
|
93
93
|
distro: string;
|
|
94
94
|
}) => string;
|
|
95
|
+
/** `wsl_doctor` digest: the verdict line. `verdict` is the report's own `ready`/`blocked`. */
|
|
96
|
+
doctorDigestVerdict: ({ verdict }: {
|
|
97
|
+
verdict: string;
|
|
98
|
+
}) => string;
|
|
99
|
+
/** `wsl_doctor` digest: the host-wide group heading. */
|
|
100
|
+
doctorDigestHostLabel: () => string;
|
|
101
|
+
/** `wsl_doctor` digest: the heading for checks the run's scope never executed. */
|
|
102
|
+
doctorDigestNotRunLabel: () => string;
|
|
103
|
+
/** `wsl_doctor` digest: marks which distro group is the session's own. */
|
|
104
|
+
doctorDigestSessionLabel: ({ name }: {
|
|
105
|
+
name: string;
|
|
106
|
+
}) => string;
|
|
107
|
+
/** `wsl_doctor` digest: one summary line for the checks the run's scope never executed; `reason` says why (the run's scope profile). */
|
|
108
|
+
doctorDigestSkipRow: ({ n, reason, ids }: {
|
|
109
|
+
n: number;
|
|
110
|
+
reason: string;
|
|
111
|
+
ids: string;
|
|
112
|
+
}) => string;
|
|
113
|
+
/** `wsl_doctor` digest: the scope reason for a quick run's skip line. */
|
|
114
|
+
doctorSkipReasonQuick: () => string;
|
|
115
|
+
/** `wsl_doctor` digest: the scope reason for a section-filtered run's skip line. */
|
|
116
|
+
doctorSkipReasonSections: ({ sections }: {
|
|
117
|
+
sections: string;
|
|
118
|
+
}) => string;
|
|
119
|
+
/** `wsl_doctor` digest: the scope reason when the report recorded none. */
|
|
120
|
+
doctorSkipReasonGeneric: () => string;
|
|
121
|
+
/** `wsl_doctor` digest: one line per check a failed prerequisite gated out; `reason` names the blocker. */
|
|
122
|
+
doctorSkipGated: ({ id, reason }: {
|
|
123
|
+
id: string;
|
|
124
|
+
reason: string;
|
|
125
|
+
}) => string;
|
|
126
|
+
/** `wsl_doctor` digest: per-group tallies, one entry per non-zero status. */
|
|
127
|
+
doctorTallyOk: ({ n }: {
|
|
128
|
+
n: number;
|
|
129
|
+
}) => string;
|
|
130
|
+
doctorTallyWarn: ({ n }: {
|
|
131
|
+
n: number;
|
|
132
|
+
}) => string;
|
|
133
|
+
doctorTallyFail: ({ n }: {
|
|
134
|
+
n: number;
|
|
135
|
+
}) => string;
|
|
136
|
+
doctorTallyUnknown: ({ n }: {
|
|
137
|
+
n: number;
|
|
138
|
+
}) => string;
|
|
139
|
+
doctorTallyInfo: ({ n }: {
|
|
140
|
+
n: number;
|
|
141
|
+
}) => string;
|
|
142
|
+
doctorTallySkipped: ({ n }: {
|
|
143
|
+
n: number;
|
|
144
|
+
}) => string;
|
|
145
|
+
/** `wsl_doctor` digest: the remedy prefix under a failed check. */
|
|
146
|
+
doctorDigestFixPrefix: ({ remedy }: {
|
|
147
|
+
remedy: string;
|
|
148
|
+
}) => string;
|
|
149
|
+
/** `wsl_doctor` digest: the ready note (how to attach the full report). */
|
|
150
|
+
doctorDigestNoteReady: () => string;
|
|
151
|
+
/** `wsl_doctor` digest: the blocked note (the rerun is the re-verification). */
|
|
152
|
+
doctorDigestNoteBlocked: () => string;
|
|
153
|
+
/** `wsl_doctor` digest: the blocked summary tail; `noneBlocking` is the fixed clause. */
|
|
154
|
+
doctorDigestBlockedTail: ({ blockers, warnings, skipped, note }: {
|
|
155
|
+
blockers: string;
|
|
156
|
+
warnings: number;
|
|
157
|
+
skipped: number;
|
|
158
|
+
note: string;
|
|
159
|
+
}) => string;
|
|
95
160
|
};
|
|
96
161
|
type Catalog = typeof en;
|
|
97
162
|
type MessageKey = keyof Catalog;
|
|
@@ -147,6 +212,13 @@ export declare function resolveMessagesLocale(preference: unknown): MessagesLoca
|
|
|
147
212
|
* which also covers the `locale` entry activating after this row did. A read
|
|
148
213
|
* that throws keeps the previous language: this is presentation, not gating.
|
|
149
214
|
*
|
|
215
|
+
* A browser whose user never picked a language in Settings has NO persisted
|
|
216
|
+
* `locale.preference` — its Chinese UI came from the navigator's provisional
|
|
217
|
+
* match, which the Host settings never record. For that case the fallback
|
|
218
|
+
* reads the process's ICU default locale (Electron: the OS UI language), so
|
|
219
|
+
* a zh-CN Windows with a provisional-Chinese UI still renders Chinese. An
|
|
220
|
+
* explicit Settings choice always wins over the fallback.
|
|
221
|
+
*
|
|
150
222
|
* @param ctx - the row's composition context.
|
|
151
223
|
*/
|
|
152
224
|
export declare function installMessagesLocale(ctx: Context): void;
|
|
@@ -154,4 +226,13 @@ export declare function installMessagesLocale(ctx: Context): void;
|
|
|
154
226
|
* Restore English. Tests only: production wiring is process-wide by design.
|
|
155
227
|
*/
|
|
156
228
|
export declare function resetMessagesLocaleForTests(): void;
|
|
229
|
+
/**
|
|
230
|
+
* The no-settings fallback: the process's ICU default locale, which in the
|
|
231
|
+
* desktop app follows the OS UI language (a zh-CN Windows yields `zh-CN`).
|
|
232
|
+
* Under Node's small-icu builds this is `en-US`, which maps to English — the
|
|
233
|
+
* previous default. Exported for tests.
|
|
234
|
+
*
|
|
235
|
+
* @returns {"en" | "zh"} the language the OS-level locale selects.
|
|
236
|
+
*/
|
|
237
|
+
export declare function hostFallbackLocale(): MessagesLocale;
|
|
157
238
|
export {};
|