dsh-plugin-wsl-env 0.19.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 +188 -1
- package/README.md +2 -2
- package/client.d.ts +5 -0
- package/client.js +218 -0
- package/cordis.patch.yml +75 -1
- package/docs/API.md +1 -0
- package/docs/CONFIGURATION.md +48 -5
- package/docs/CONFIGURATION.zh.md +15 -1
- package/docs/DIAGNOSTICS.md +110 -0
- package/docs/DIAGNOSTICS.zh.md +96 -0
- package/docs/LIMITATIONS.md +25 -0
- package/docs/LIMITATIONS.zh.md +7 -0
- package/docs/MIGRATION.md +1 -1
- package/docs/QUICKSTART.md +19 -3
- package/docs/RELEASING.md +3 -0
- package/docs/ROADMAP-1.0.md +49 -4
- package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +5 -0
- package/docs/UPSTREAM-OPEN-IN-APP.md +33 -0
- 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/doctor-live.d.ts +5 -1
- package/lib/doctor-live.js +3 -2
- package/lib/index.d.ts +11 -0
- package/lib/index.js +10 -8
- package/lib/messages.d.ts +238 -0
- package/lib/messages.js +292 -0
- package/lib/preflight.d.ts +24 -0
- package/lib/preflight.js +111 -11
- package/lib/sandbox-core.js +7 -14
- package/lib/session-scope.js +10 -5
- package/lib/shell-env.d.ts +25 -0
- package/lib/shell-env.js +56 -0
- package/lib/shell.d.ts +3 -1
- package/lib/shell.js +3 -1
- package/lib/update-check.d.ts +197 -0
- package/lib/update-check.js +211 -0
- package/lib/wsl-doctor-command.d.ts +105 -0
- package/lib/wsl-doctor-command.js +240 -0
- package/lib/wsl-doctor-tool.d.ts +214 -0
- package/lib/wsl-doctor-tool.js +423 -0
- package/locale/doctor/en.json +30 -0
- package/locale/doctor/zh.json +30 -0
- package/package.json +47 -5
- package/scripts/doctor.mjs +1606 -171
package/CHANGELOG.md
CHANGED
|
@@ -14,7 +14,194 @@ 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.
|
|
83
|
+
|
|
84
|
+
## [0.21.0] - 2026-11-08
|
|
85
|
+
|
|
86
|
+
One theme: the doctor and the preflight reach the GUI — the readiness probes
|
|
87
|
+
run at plugin load, the doctor lands as a composer button and a per-session
|
|
88
|
+
`DSH_WSL_DOCTOR` fact, and the bare package name becomes the client host half
|
|
89
|
+
that makes both loadable.
|
|
90
|
+
|
|
91
|
+
### Changed
|
|
92
|
+
|
|
93
|
+
- **BREAKING: `.` is now the no-op web client host half; the shell executor
|
|
94
|
+
moved to `dsh-plugin-wsl-env/shell`.** The web app's client-modules roster
|
|
95
|
+
only scans Loader rows whose name is an exact package name, so the doctor's
|
|
96
|
+
composer button (declared under `dsh.client`) loads only when the package
|
|
97
|
+
is mounted at its bare name — and the shell executor that used to own `.`
|
|
98
|
+
cannot run at the composition root without shadowing the shipped host
|
|
99
|
+
shell. The bundle's patch layer therefore mounts the bare name as a no-op
|
|
100
|
+
row (`wsl-env-client-host`) that puts the package on the web bundle list,
|
|
101
|
+
while the preset mounts the executor through the explicit `./shell` subpath.
|
|
102
|
+
The doctor button is the plugin's own feature again — the interim
|
|
103
|
+
`dsh-wsl-env-doctor-button` companion bundle is removed. A profile that
|
|
104
|
+
mounted `dsh-plugin-wsl-env` directly for the executor must switch to
|
|
105
|
+
`dsh-plugin-wsl-env/shell`.
|
|
106
|
+
|
|
107
|
+
### Added
|
|
108
|
+
|
|
109
|
+
- **The preflight runs at plugin load, not only at session open.** A new
|
|
110
|
+
`startup` key (default `true`) on `wsl-preflight` runs the same `bwrap` and
|
|
111
|
+
session-runtime probes once at mount — install plus restart — against the
|
|
112
|
+
pinned or WSL-default distro, so the verdict is in the log before any
|
|
113
|
+
session opens. A session on that distro repeats only the runtime-context
|
|
114
|
+
entry (a shared single-flight verdict plus per-process dedupe keeps the log
|
|
115
|
+
to one line); other distros keep the session-open check unchanged, and
|
|
116
|
+
`startup: false` restores the old behavior exactly.
|
|
117
|
+
|
|
118
|
+
- **The doctor entered the GUI.** A new `DSH_WSL_DOCTOR` fact rides every
|
|
119
|
+
distro session: a ready-to-run command that executes the doctor from
|
|
120
|
+
inside the session, using the app's own runtime as Node through interop —
|
|
121
|
+
a GUI user can ask the model for a diagnosis (`sh -c
|
|
122
|
+
"$DSH_WSL_DOCTOR --json"`) without a terminal or a separate Node install.
|
|
123
|
+
The session-start preflight now publishes its verdict on healthy sessions
|
|
124
|
+
too (`WSL preflight: ready — …`), so the transcript reads as a verdict on
|
|
125
|
+
every session start, not only on failures. And a new `wsl_doctor` tool
|
|
126
|
+
(mounted inside `preset-wsl`) lets the model run the doctor itself —
|
|
127
|
+
in-process through `doctorReport()` with the live resident's state merged
|
|
128
|
+
in — returning the verdict, blockers and per-failure remedies to the
|
|
129
|
+
transcript. The whole entry is the plugin's own; the page-level action
|
|
130
|
+
proposed upstream (discussion #12499) was withdrawn the same day as
|
|
131
|
+
unnecessary coupling — the cohesive shape needs no upstream surface.
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
- **The doctor's verdict closes the loop: green means the first command
|
|
135
|
+
works.** The report moves to schemaVersion 2 — `verdict: ready | blocked`,
|
|
136
|
+
`blockers`, per-distro verdicts and per-check `distro` /
|
|
137
|
+
`blocksFirstCommand` — computed under the **effective configuration** (the
|
|
138
|
+
profile layers the app loads, not the shipped defaults): a missing systemd
|
|
139
|
+
only blocks under `sessionSandbox: true`, while `auto` names its fallback
|
|
140
|
+
and `false` names the opt-out. New checks: the per-distro WSL mode (WSL1
|
|
141
|
+
named as the root cause, with the `--set-version` remedy), `.wslconfig`
|
|
142
|
+
validation with its semantics (the silent-ignore trap, unknown keys,
|
|
143
|
+
memory hazards, `localhostForwarding`), `/etc/wsl.conf` cross-checks
|
|
144
|
+
(boot/interop/automount against the runtime, terminate remedies), the
|
|
145
|
+
disk, the clock and DNS. Three smoke legs prove the chain — one EXEC
|
|
146
|
+
frame, the confined fence (write inside runs, write outside is refused),
|
|
147
|
+
one FSB batch over a temp dir that is cleaned up. `--all` (and the
|
|
148
|
+
effective `auto`/`default` target set) check every installed distro; one
|
|
149
|
+
wedged distro cannot mask the others. `--fix` ends in a re-verified
|
|
150
|
+
report: every fix is followed by a fresh probe, the affected checks carry
|
|
151
|
+
the after state, and the Windows git trust whitelist joins the fixable set
|
|
152
|
+
behind the confirmation gate. `--bundle <path>` writes the attachable
|
|
153
|
+
diagnostic file (`--redact` strips home and DSH paths), deprecated profile
|
|
154
|
+
keys (`substrate: share`, `distro: ''`) are named with their migration, and
|
|
155
|
+
per-phase timings ride the report. The doctor targets every installed
|
|
156
|
+
distro the effective configuration can reach; remedies that would rewrite
|
|
157
|
+
user- or distro-owned files stay manual, and the verdict never upgrades the
|
|
158
|
+
`enforcement: partial` statement. [DIAGNOSTICS.md](docs/DIAGNOSTICS.md)
|
|
159
|
+
maps every error code to its check or its transient class.
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
- **The plugin's refusal messages follow the harness language.** A new
|
|
163
|
+
`lib/messages.js` catalog renders the `sessionSandbox` preflight verdicts,
|
|
164
|
+
the `bwrap` install and repair hints, and the distro/workdir command errors
|
|
165
|
+
in English or Chinese, selected from the host `locale` entry's `preference`
|
|
166
|
+
field through an optional `settings` injection (the base bundle's service; a
|
|
167
|
+
profile without it, an unset preference, or any other language keeps
|
|
168
|
+
English). The read refreshes on `settings/document-updated`, so switching
|
|
169
|
+
the app's language takes effect without a restart. Commands, config keys
|
|
170
|
+
and file paths stay verbatim in both catalogs. The English templates are the
|
|
171
|
+
shipped texts byte-for-byte, and three groups stay English by design — the
|
|
172
|
+
`FS_*` refusals in `fs-decisions` and the fsio replica (the tool layer
|
|
173
|
+
matches on those strings) and the standalone `scripts/doctor.mjs` — see
|
|
174
|
+
[CONFIGURATION.md — Message language](docs/CONFIGURATION.md#message-language)
|
|
175
|
+
and [LIMITATIONS.md](docs/LIMITATIONS.md).
|
|
176
|
+
|
|
177
|
+
- **The plugin notices its own updates.** A new `wsl-update-check` row asks the
|
|
178
|
+
app's plugin manager for this package's version list on a slow timer (first
|
|
179
|
+
check 2–10 minutes after startup, then once a day; `intervalMs` configures
|
|
180
|
+
it, floored at one minute, and `enabled: false` stops the check). When the
|
|
181
|
+
stable channel has moved, the managed `DSH_WSL_PLUGIN_UPDATE` variable in
|
|
182
|
+
every distro session carries the fact, deprecation and "requires a newer
|
|
183
|
+
DSH" marks included; every other answer — no host plugin-manager, a linked
|
|
184
|
+
checkout, an unreachable registry — stays silent at debug level. The check
|
|
185
|
+
never fetches on its own and never installs: upgrading stays manual (Plugins
|
|
186
|
+
page, or `dsh plugin add`), then a restart, because the harness has no hot
|
|
187
|
+
reload. `node scripts/doctor.mjs` gained an `update.latest` section that
|
|
188
|
+
asks the same question on demand, `DSH_UPDATE_REGISTRIES` pins or empties
|
|
189
|
+
its registry list.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### Fixed
|
|
193
|
+
|
|
194
|
+
- **The tool rows mount again: the context reads are declared.** Both tool
|
|
195
|
+
rows (`wsl-cwd-prompt-tool`, `wsl-doctor-tool`) read `ctx.tools` (and the
|
|
196
|
+
`workingDirectory` service) without exporting `inject`, so cordis 4 threw
|
|
197
|
+
`cannot get property "tools" without inject` at activation — the shipped
|
|
198
|
+
`working_directory` tool stayed disabled with no replacement registered.
|
|
199
|
+
Both rows now declare `inject = ["tools", "workingDirectory"]`. The
|
|
200
|
+
`wsl_doctor` tool additionally resolves its collector per call instead of
|
|
201
|
+
reading a `ctx.doctor` service nothing provides: a provided `doctor`
|
|
202
|
+
service through the optional `ctx.get`, else the test seam's `doctor`
|
|
203
|
+
property, else the package's own `doctorReport` — a required inject of a
|
|
204
|
+
nonexistent service would have failed the whole `preset-wsl` mount.
|
|
18
205
|
|
|
19
206
|
## [0.19.0] - 2026-11-06
|
|
20
207
|
|
package/README.md
CHANGED
|
@@ -115,9 +115,9 @@ Install `bubblewrap` before the first command:
|
|
|
115
115
|
wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
From a checkout, `pnpm run doctor` is the one-command environment check: Windows/WSL versions, the distro and
|
|
118
|
+
From a checkout, `pnpm run doctor` is the one-command environment check: Windows/WSL versions, the per-distro WSL mode, `.wslconfig` and `/etc/wsl.conf` cross-checks, the disk, clock and DNS, bubblewrap usability, systemd / the user manager / Linger, the optional tools, peer versions, the agent cache, a fresh-agent handshake, three smoke legs that prove the chain (frame I/O, the confined fence, the batched substrate), stale session scopes, the known profile-patch and deprecated-key traps, and whether a newer stable release exists on the registry. The run ends in a verdict — `ready` (the first command should succeed) or `blocked` (the named checks to fix) — computed under the effective configuration. Each failure prints one copy-paste remedy; `--json` is the machine contract, `--fix` re-verifies what it fixed (packages need `--fix --install` and an explicit confirmation), `--all` checks every installed distro, and `--bundle <path>` writes the diagnostic file a setup report attaches (`--redact` strips the paths). `pnpm run diagnose` is its read-only alias. `pnpm run bootstrap <distro>` remains the narrower tool-install helper.
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
The plugin notices its own updates about once a day (first check a few minutes after startup) by asking the app's plugin manager — it never fetches on its own. When a newer stable release exists, the managed `DSH_WSL_PLUGIN_UPDATE` variable in every distro session carries the fact; `wsl-update-check.enabled: false` in the patch config turns the check off, and `DSH_UPDATE_REGISTRIES` overrides which registries the doctor's on-demand check asks (comma-separated, or empty to skip it on an air-gapped machine). Upgrading stays manual, because the harness has no hot reload: install again (Plugins page, or the `add` command), then restart. Uninstall on
|
|
121
121
|
the Plugins page, or with `dsh plugin --profile wsl remove dsh-plugin-wsl-env`
|
|
122
122
|
where the CLI is installed; the agent cache under `~/.cache/dsh-wsl` can then be
|
|
123
123
|
deleted. If you added a local `workspace-files-wsl` workaround to your profile to
|
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
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.
|
|
8
|
+
*
|
|
9
|
+
* The composer dock's slot components receive the harness's standard props —
|
|
10
|
+
* `inputActions` among them. Sending is `setDraft(text)` (replace the whole
|
|
11
|
+
* draft with plain text) followed by `submit()` (send the current draft — the
|
|
12
|
+
* published face has no submit-with-text verb). When those verbs are missing
|
|
13
|
+
* the menu degrades to a draft prefill, never to a broken control.
|
|
14
|
+
*
|
|
15
|
+
* Loaded by the harness's web client loader through the `dsh.client`
|
|
16
|
+
* declaration in package.json; the composition's bare-name row
|
|
17
|
+
* (`wsl-env-client-host`, mounting the no-op root export) is what puts this
|
|
18
|
+
* package on the web bundle list.
|
|
19
|
+
*/
|
|
20
|
+
window.__ModuleLoader__.load({
|
|
21
|
+
id: "dsh-plugin-wsl-env",
|
|
22
|
+
factory(require) {
|
|
23
|
+
const React = require("react");
|
|
24
|
+
const h = React.createElement;
|
|
25
|
+
const useEffect = React.useEffect;
|
|
26
|
+
const useState = React.useState;
|
|
27
|
+
|
|
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
|
+
];
|
|
54
|
+
|
|
55
|
+
function DoctorButton(props) {
|
|
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);
|
|
73
|
+
const actions = props && props.inputActions;
|
|
74
|
+
// The published InputActions face has no submit(text): submit() sends
|
|
75
|
+
// the CURRENT draft, and insertText needs a captureInsertion() span.
|
|
76
|
+
// setDraft replaces the whole draft with plain text, then submit()
|
|
77
|
+
// sends it — one click, no span bookkeeping.
|
|
78
|
+
if (actions && typeof actions.setDraft === "function" && typeof actions.submit === "function") {
|
|
79
|
+
try {
|
|
80
|
+
actions.setDraft(command);
|
|
81
|
+
actions.submit();
|
|
82
|
+
return;
|
|
83
|
+
} catch (error) {
|
|
84
|
+
// Fall through to the draft prefill below; the command text is the
|
|
85
|
+
// same either way.
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (actions && typeof actions.setDraft === "function") {
|
|
89
|
+
try {
|
|
90
|
+
actions.setDraft(command);
|
|
91
|
+
return;
|
|
92
|
+
} catch (error) {
|
|
93
|
+
// Ignored: the draft stays untouched rather than half-filled.
|
|
94
|
+
}
|
|
95
|
+
}
|
|
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
|
+
|
|
164
|
+
return h(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
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" },
|
|
172
|
+
},
|
|
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
|
+
)
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
inject: ["slots"],
|
|
204
|
+
apply(ctx) {
|
|
205
|
+
ctx.slots.inject("conversation.composer.dock", function* () {
|
|
206
|
+
yield ctx.slots.register(
|
|
207
|
+
{
|
|
208
|
+
name: "conversation.composer.dock",
|
|
209
|
+
id: "wsl-doctor-button",
|
|
210
|
+
order: 9,
|
|
211
|
+
},
|
|
212
|
+
DoctorButton
|
|
213
|
+
);
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
},
|
|
218
|
+
});
|
package/cordis.patch.yml
CHANGED
|
@@ -139,7 +139,39 @@
|
|
|
139
139
|
- id: fs-sandbox
|
|
140
140
|
disabled: true
|
|
141
141
|
|
|
142
|
+
# The shipped `working_directory` tool prints the host-canonical UNC spelling
|
|
143
|
+
# (`fs.processPath()`), which the distro shell cannot resolve — the same
|
|
144
|
+
# failure mode the cwd rewrite below removes. Disable the shipped row by id
|
|
145
|
+
# (a top-level entry: a disable inside an insert list is duplicate-id data,
|
|
146
|
+
# see the comment above), then mount the replacement in the insert list.
|
|
147
|
+
- id: tool-working-directory
|
|
148
|
+
disabled: true
|
|
149
|
+
|
|
142
150
|
- insert:
|
|
151
|
+
# ═════════════════════════════════════════════════════════════════════════════
|
|
152
|
+
# The web client host half.
|
|
153
|
+
#
|
|
154
|
+
# The web app's client-modules roster only scans Loader rows whose name is
|
|
155
|
+
# an exact package name, and this package's service rows are all subpath
|
|
156
|
+
# mounts — so without this row the browser half declared under `dsh.client`
|
|
157
|
+
# (the doctor composer button) would never load. `.` is the no-op client
|
|
158
|
+
# host half (lib/client-host.js), safe at the composition root; the shell
|
|
159
|
+
# executor that used to own `.` lives at `dsh-plugin-wsl-env/shell` since
|
|
160
|
+
# 0.20.0 and is mounted inside the preset below. The bare specifier is
|
|
161
|
+
# load-bearing: do not "simplify" it to a subpath.
|
|
162
|
+
# ═════════════════════════════════════════════════════════════════════════════
|
|
163
|
+
- id: wsl-env-client-host
|
|
164
|
+
name: 'dsh-plugin-wsl-env'
|
|
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
|
+
|
|
143
175
|
- id: fs-routing
|
|
144
176
|
name: 'dsh-plugin-wsl-env/fs-routing'
|
|
145
177
|
config:
|
|
@@ -172,6 +204,40 @@
|
|
|
172
204
|
- id: wsl-preflight
|
|
173
205
|
name: 'dsh-plugin-wsl-env/preflight'
|
|
174
206
|
|
|
207
|
+
# Distro-native working directory in the runtime context: rewrite the
|
|
208
|
+
# `working-directory:current` entry so a distro session reads its cwd as
|
|
209
|
+
# the POSIX path its own commands use (`/home/...`) instead of the host
|
|
210
|
+
# UNC spelling (`\\wsl.localhost\<distro>\...`). Display only: it touches
|
|
211
|
+
# one prompt entry, leaves drive paths and every other context alone, and
|
|
212
|
+
# degrades to a no-op on a harness without the assemble waterfall.
|
|
213
|
+
- id: wsl-cwd-prompt
|
|
214
|
+
name: 'dsh-plugin-wsl-env/cwd-prompt'
|
|
215
|
+
config:
|
|
216
|
+
enabled: true
|
|
217
|
+
|
|
218
|
+
# Distro-native `working_directory` tool: the third surface the cwd reaches
|
|
219
|
+
# the model through. Same tool name, parameters, and `cd` semantics (the
|
|
220
|
+
# harness's `workingDirectory` service still owns all directory state);
|
|
221
|
+
# the returned path is rewritten to the distro's POSIX form. Non-WSL paths
|
|
222
|
+
# pass through byte for byte. Pairs with the top-level disable of
|
|
223
|
+
# `tool-working-directory` above.
|
|
224
|
+
- id: wsl-cwd-prompt-tool
|
|
225
|
+
name: 'dsh-plugin-wsl-env/cwd-prompt-tool'
|
|
226
|
+
|
|
227
|
+
# Update check: on a slow timer (first check 2-10 minutes after boot, then
|
|
228
|
+
# once a day) ask the host's plugin-manager whether a newer stable release
|
|
229
|
+
# of this package exists, and publish one fact the shell-env row serves as
|
|
230
|
+
# DSH_WSL_PLUGIN_UPDATE. Advisory only: it never installs, never fetches on
|
|
231
|
+
# its own (the host's plugin-manager does the registry work), and a host
|
|
232
|
+
# without the service — or a bundle loaded from a linked checkout — skips
|
|
233
|
+
# the check quietly. Upgrading stays manual; the harness has no HMR, so a
|
|
234
|
+
# fresh version needs a restart to take effect.
|
|
235
|
+
- id: wsl-update-check
|
|
236
|
+
name: 'dsh-plugin-wsl-env/update-check'
|
|
237
|
+
config:
|
|
238
|
+
enabled: true
|
|
239
|
+
intervalMs: 86400000
|
|
240
|
+
|
|
175
241
|
- insert:
|
|
176
242
|
# ═════════════════════════════════════════════════════════════════════════════
|
|
177
243
|
# preset-wsl — the WSL environment, scoped to agents that select this preset.
|
|
@@ -239,7 +305,7 @@
|
|
|
239
305
|
# per-command shape. Bubblewrap is still required for the mount
|
|
240
306
|
# profile; without it the providers fail closed.
|
|
241
307
|
- id: wsl-shell
|
|
242
|
-
name: 'dsh-plugin-wsl-env'
|
|
308
|
+
name: 'dsh-plugin-wsl-env/shell'
|
|
243
309
|
config:
|
|
244
310
|
# auto: follow the request workdir's UNC distro; "default"
|
|
245
311
|
# forces WSL's default, and a name pins. Empty is auto.
|
|
@@ -300,6 +366,14 @@
|
|
|
300
366
|
sampleOverCapGlobResults: false
|
|
301
367
|
- id: tool-jobs
|
|
302
368
|
name: '@deepseek-ai/dsh-tool-jobs'
|
|
369
|
+
|
|
370
|
+
# The model runs the environment doctor itself: the verdict
|
|
371
|
+
# lands in the transcript (ready, or blocked with per-failure
|
|
372
|
+
# copy-paste remedies). In-process via doctorReport(), so the
|
|
373
|
+
# live resident's state merges in; mounts inside this preset
|
|
374
|
+
# because a host-preset agent has no distro to examine.
|
|
375
|
+
- id: wsl-doctor-tool
|
|
376
|
+
name: 'dsh-plugin-wsl-env/wsl-doctor-tool'
|
|
303
377
|
- id: tool-schedule
|
|
304
378
|
name: '@deepseek-ai/dsh-tool-schedule'
|
|
305
379
|
- id: skill-filesystem
|
package/docs/API.md
CHANGED
|
@@ -19,6 +19,7 @@ this page is the quick tour.
|
|
|
19
19
|
| `./picker` | `WslDirectoryPicker` | the distro-aware directory picker |
|
|
20
20
|
| `./auto-preset` | the `auto-preset` row | first-run profile bootstrap |
|
|
21
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) |
|
|
22
23
|
|
|
23
24
|
Stability: tool names and error codes are API (docs/MIGRATION.md); the
|
|
24
25
|
runtime rows' config keys are documented in docs/CONFIGURATION.md.
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -135,8 +135,11 @@ The root router is app-level, not session-owned, so it does not use
|
|
|
135
135
|
| | `wslPath` | `wsl.exe` | Path to `wsl.exe`. |
|
|
136
136
|
| | `sandbox` | `true` | Run the session-start `bwrap` check. |
|
|
137
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. |
|
|
138
139
|
| `wsl-shell-env` | `distro` | `''` | Distro used to populate the `DSH_WSL_*` environment facts. |
|
|
139
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. |
|
|
140
143
|
|
|
141
144
|
The GUI file tree and previews use the bundled `workspace-files` row through
|
|
142
145
|
`fs-routing`; they do not use a separate WSL provider row. To change its
|
|
@@ -286,7 +289,11 @@ distros, the direct install command is:
|
|
|
286
289
|
wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
|
|
287
290
|
```
|
|
288
291
|
|
|
289
|
-
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
|
|
290
297
|
the session-runtime prerequisites when `sessionSandbox: true`. The warning is
|
|
291
298
|
advisory: it does not install packages or change the providers' fail-closed
|
|
292
299
|
behavior. Set `sandbox: false` on this row or remove it to silence the
|
|
@@ -298,13 +305,49 @@ without confinement; their `sandboxMode` becomes `undefined`. The tool layer
|
|
|
298
305
|
reports that no sandbox is active. On `fs-routing`, the setting disables the
|
|
299
306
|
mutation fence; that row reports `sandboxMode: undefined` either way.
|
|
300
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
|
+
|
|
301
323
|
## Diagnose configuration and refusals
|
|
302
324
|
|
|
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-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).
|
|
337
|
+
`DSH_WSL_DOCTOR` additionally carries a ready-to-run command that executes
|
|
338
|
+
the doctor script from inside the distro (the app's own runtime as Node,
|
|
339
|
+
through interop) — run it as `sh -c "$DSH_WSL_DOCTOR --json"`. And
|
|
303
340
|
`pnpm run doctor` is the one-command environment check: Windows/WSL versions,
|
|
304
|
-
the distro
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
341
|
+
the per-distro WSL mode, `.wslconfig` and `/etc/wsl.conf` cross-checks, the
|
|
342
|
+
disk, the clock, DNS, the distro and its shell, bubblewrap, systemd/Linger,
|
|
343
|
+
the peer floor, a fresh agent handshake, stale session scopes, the known
|
|
344
|
+
profile-patch and deprecated-key traps — each failure with a copyable remedy.
|
|
345
|
+
The run ends in a verdict (`ready` or `blocked`) computed under the effective
|
|
346
|
+
configuration: `--json` is the machine contract (schemaVersion 2), `--fix`
|
|
347
|
+
re-verifies what it fixed, `--all` checks every installed distro, `--bundle
|
|
348
|
+
<path>` writes the attachable diagnostic file (`--redact` strips the paths).
|
|
349
|
+
See [DIAGNOSTICS.md](DIAGNOSTICS.md) for the verdict contract and the
|
|
350
|
+
error-code map. With the CLI distribution, `dsh --profile <name> --dump-config` inspects
|
|
308
351
|
the composed profile without booting it and shows whether a row override
|
|
309
352
|
applied; the desktop app has no `dsh` command, so read `cordis.patch.yml` and
|
|
310
353
|
the Plugins page there.
|