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.
Files changed (123) hide show
  1. package/CHANGELOG.md +274 -0
  2. package/CONTRIBUTING.md +37 -5
  3. package/README.md +60 -5
  4. package/SUPPORT.md +3 -3
  5. package/agent/native/linux-aarch64/dsh-wsl-agent +0 -0
  6. package/agent/native/linux-x86_64/dsh-wsl-agent +0 -0
  7. package/agent/wsl-agent.sh +331 -11
  8. package/client.d.ts +5 -0
  9. package/client.js +98 -0
  10. package/cordis.patch.yml +66 -1
  11. package/docs/AGENT-PROTOCOL-V7.md +175 -0
  12. package/docs/API.md +25 -0
  13. package/docs/ARCHITECTURE.md +14 -1
  14. package/docs/CONFIGURATION.md +47 -6
  15. package/docs/CONFIGURATION.zh.md +20 -4
  16. package/docs/DIAGNOSTICS.md +83 -0
  17. package/docs/DIAGNOSTICS.zh.md +73 -0
  18. package/docs/LIMITATIONS.md +41 -4
  19. package/docs/LIMITATIONS.zh.md +27 -11
  20. package/docs/MIGRATION.md +4 -4
  21. package/docs/PEER-PARITY.md +50 -33
  22. package/docs/QUICKSTART.md +37 -4
  23. package/docs/QUICKSTART.zh.md +16 -1
  24. package/docs/README.zh.md +43 -4
  25. package/docs/RELEASING.md +4 -1
  26. package/docs/REQUIREMENTS.zh.md +3 -2
  27. package/docs/ROADMAP-1.0.md +75 -19
  28. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +8 -1
  29. package/docs/UPSTREAM-OPEN-IN-APP.md +33 -0
  30. package/docs/UPSTREAM-SESSION-NOTICE.md +3 -1
  31. package/docs/UPSTREAM-TERMINAL-TITLE.md +3 -0
  32. package/docs/root-fs-routing.md +3 -3
  33. package/lib/agent-confined.js +4 -4
  34. package/lib/agent-errors.d.ts +1 -1
  35. package/lib/agent-errors.js +1 -1
  36. package/lib/agent-exec.d.ts +1 -1
  37. package/lib/agent-exec.js +1 -1
  38. package/lib/agent-protocol.d.ts +58 -8
  39. package/lib/agent-protocol.js +40 -7
  40. package/lib/agent-shared.d.ts +1 -1
  41. package/lib/agent-shared.js +1 -1
  42. package/lib/agent.d.ts +171 -1
  43. package/lib/agent.js +448 -288
  44. package/lib/auto-preset.d.ts +1 -1
  45. package/lib/auto-preset.js +1 -1
  46. package/lib/bwrap.d.ts +1 -1
  47. package/lib/bwrap.js +1 -1
  48. package/lib/client-host.d.ts +29 -0
  49. package/lib/client-host.js +29 -0
  50. package/lib/cwd-prompt-tool.d.ts +88 -0
  51. package/lib/cwd-prompt-tool.js +94 -0
  52. package/lib/cwd-prompt.d.ts +166 -0
  53. package/lib/cwd-prompt.js +203 -0
  54. package/lib/distro-route.d.ts +1 -1
  55. package/lib/distro-route.js +1 -1
  56. package/lib/doctor-live.d.ts +57 -0
  57. package/lib/doctor-live.js +38 -0
  58. package/lib/file-reference-wsl.d.ts +1 -1
  59. package/lib/file-reference-wsl.js +1 -1
  60. package/lib/fs-decisions.d.ts +1 -1
  61. package/lib/fs-decisions.js +1 -1
  62. package/lib/fs-routing.d.ts +1 -1
  63. package/lib/fs-routing.js +1 -1
  64. package/lib/fs-substrate.d.ts +90 -11
  65. package/lib/fs-substrate.js +202 -1
  66. package/lib/fs.d.ts +1 -1
  67. package/lib/fs.js +1 -1
  68. package/lib/fsio-agent.d.ts +128 -4
  69. package/lib/fsio-agent.js +224 -15
  70. package/lib/fsio-text.d.ts +1 -1
  71. package/lib/fsio-text.js +1 -1
  72. package/lib/git-exec.d.ts +1 -1
  73. package/lib/git-exec.js +1 -1
  74. package/lib/git-route.d.ts +1 -1
  75. package/lib/git-route.js +1 -1
  76. package/lib/index.d.ts +105 -30
  77. package/lib/index.js +272 -130
  78. package/lib/listing.d.ts +1 -1
  79. package/lib/listing.js +1 -1
  80. package/lib/messages.d.ts +157 -0
  81. package/lib/messages.js +199 -0
  82. package/lib/native-agent.d.ts +1 -1
  83. package/lib/native-agent.js +2 -2
  84. package/lib/paths.d.ts +6 -3
  85. package/lib/paths.js +4 -4
  86. package/lib/picker.d.ts +1 -1
  87. package/lib/picker.js +7 -7
  88. package/lib/ports.d.ts +1 -1
  89. package/lib/ports.js +1 -1
  90. package/lib/preflight.d.ts +25 -1
  91. package/lib/preflight.js +112 -12
  92. package/lib/sandbox-core.d.ts +1 -1
  93. package/lib/sandbox-core.js +9 -16
  94. package/lib/sandbox.d.ts +1 -1
  95. package/lib/sandbox.js +1 -1
  96. package/lib/search-exec.d.ts +1 -1
  97. package/lib/search-exec.js +1 -1
  98. package/lib/search-route.d.ts +1 -1
  99. package/lib/search-route.js +1 -1
  100. package/lib/session-runtime.d.ts +1 -1
  101. package/lib/session-runtime.js +2 -2
  102. package/lib/session-scope.d.ts +1 -1
  103. package/lib/session-scope.js +11 -6
  104. package/lib/shell-env.d.ts +26 -1
  105. package/lib/shell-env.js +57 -1
  106. package/lib/shell.d.ts +4 -2
  107. package/lib/shell.js +4 -2
  108. package/lib/subprocess.d.ts +1 -1
  109. package/lib/subprocess.js +2 -2
  110. package/lib/terminal-activity.d.ts +1 -1
  111. package/lib/terminal-activity.js +1 -1
  112. package/lib/terminal-route.d.ts +1 -1
  113. package/lib/terminal-route.js +1 -1
  114. package/lib/update-check.d.ts +197 -0
  115. package/lib/update-check.js +211 -0
  116. package/lib/watcher.d.ts +1 -1
  117. package/lib/watcher.js +1 -1
  118. package/lib/wsl-doctor-tool.d.ts +122 -0
  119. package/lib/wsl-doctor-tool.js +161 -0
  120. package/lib/wsl.d.ts +1 -31
  121. package/lib/wsl.js +1 -21
  122. package/package.json +55 -6
  123. package/scripts/doctor.mjs +1196 -166
package/CHANGELOG.md CHANGED
@@ -16,6 +16,280 @@ were part of the record.
16
16
 
17
17
  ## [Unreleased]
18
18
 
19
+ ## [0.21.0] - 2026-11-08
20
+
21
+ One theme: the doctor and the preflight reach the GUI — the readiness probes
22
+ run at plugin load, the doctor lands as a composer button and a per-session
23
+ `DSH_WSL_DOCTOR` fact, and the bare package name becomes the client host half
24
+ that makes both loadable.
25
+
26
+ ### Changed
27
+
28
+ - **BREAKING: `.` is now the no-op web client host half; the shell executor
29
+ moved to `dsh-plugin-wsl-env/shell`.** The web app's client-modules roster
30
+ only scans Loader rows whose name is an exact package name, so the doctor's
31
+ composer button (declared under `dsh.client`) loads only when the package
32
+ is mounted at its bare name — and the shell executor that used to own `.`
33
+ cannot run at the composition root without shadowing the shipped host
34
+ shell. The bundle's patch layer therefore mounts the bare name as a no-op
35
+ row (`wsl-env-client-host`) that puts the package on the web bundle list,
36
+ while the preset mounts the executor through the explicit `./shell` subpath.
37
+ The doctor button is the plugin's own feature again — the interim
38
+ `dsh-wsl-env-doctor-button` companion bundle is removed. A profile that
39
+ mounted `dsh-plugin-wsl-env` directly for the executor must switch to
40
+ `dsh-plugin-wsl-env/shell`.
41
+
42
+ ### Added
43
+
44
+ - **The preflight runs at plugin load, not only at session open.** A new
45
+ `startup` key (default `true`) on `wsl-preflight` runs the same `bwrap` and
46
+ session-runtime probes once at mount — install plus restart — against the
47
+ pinned or WSL-default distro, so the verdict is in the log before any
48
+ session opens. A session on that distro repeats only the runtime-context
49
+ entry (a shared single-flight verdict plus per-process dedupe keeps the log
50
+ to one line); other distros keep the session-open check unchanged, and
51
+ `startup: false` restores the old behavior exactly.
52
+
53
+ - **The doctor entered the GUI.** A new `DSH_WSL_DOCTOR` fact rides every
54
+ distro session: a ready-to-run command that executes the doctor from
55
+ inside the session, using the app's own runtime as Node through interop —
56
+ a GUI user can ask the model for a diagnosis (`sh -c
57
+ "$DSH_WSL_DOCTOR --json"`) without a terminal or a separate Node install.
58
+ The session-start preflight now publishes its verdict on healthy sessions
59
+ too (`WSL preflight: ready — …`), so the transcript reads as a verdict on
60
+ every session start, not only on failures. And a new `wsl_doctor` tool
61
+ (mounted inside `preset-wsl`) lets the model run the doctor itself —
62
+ in-process through `doctorReport()` with the live resident's state merged
63
+ in — returning the verdict, blockers and per-failure remedies to the
64
+ transcript. The whole entry is the plugin's own; the page-level action
65
+ proposed upstream (discussion #12499) was withdrawn the same day as
66
+ unnecessary coupling — the cohesive shape needs no upstream surface.
67
+
68
+
69
+ - **The doctor's verdict closes the loop: green means the first command
70
+ works.** The report moves to schemaVersion 2 — `verdict: ready | blocked`,
71
+ `blockers`, per-distro verdicts and per-check `distro` /
72
+ `blocksFirstCommand` — computed under the **effective configuration** (the
73
+ profile layers the app loads, not the shipped defaults): a missing systemd
74
+ only blocks under `sessionSandbox: true`, while `auto` names its fallback
75
+ and `false` names the opt-out. New checks: the per-distro WSL mode (WSL1
76
+ named as the root cause, with the `--set-version` remedy), `.wslconfig`
77
+ validation with its semantics (the silent-ignore trap, unknown keys,
78
+ memory hazards, `localhostForwarding`), `/etc/wsl.conf` cross-checks
79
+ (boot/interop/automount against the runtime, terminate remedies), the
80
+ disk, the clock and DNS. Three smoke legs prove the chain — one EXEC
81
+ frame, the confined fence (write inside runs, write outside is refused),
82
+ one FSB batch over a temp dir that is cleaned up. `--all` (and the
83
+ effective `auto`/`default` target set) check every installed distro; one
84
+ wedged distro cannot mask the others. `--fix` ends in a re-verified
85
+ report: every fix is followed by a fresh probe, the affected checks carry
86
+ the after state, and the Windows git trust whitelist joins the fixable set
87
+ behind the confirmation gate. `--bundle <path>` writes the attachable
88
+ diagnostic file (`--redact` strips home and DSH paths), deprecated profile
89
+ keys (`substrate: share`, `distro: ''`) are named with their migration, and
90
+ per-phase timings ride the report. The doctor targets every installed
91
+ distro the effective configuration can reach; remedies that would rewrite
92
+ user- or distro-owned files stay manual, and the verdict never upgrades the
93
+ `enforcement: partial` statement. [DIAGNOSTICS.md](docs/DIAGNOSTICS.md)
94
+ maps every error code to its check or its transient class.
95
+
96
+
97
+ - **The plugin's refusal messages follow the harness language.** A new
98
+ `lib/messages.js` catalog renders the `sessionSandbox` preflight verdicts,
99
+ the `bwrap` install and repair hints, and the distro/workdir command errors
100
+ in English or Chinese, selected from the host `locale` entry's `preference`
101
+ field through an optional `settings` injection (the base bundle's service; a
102
+ profile without it, an unset preference, or any other language keeps
103
+ English). The read refreshes on `settings/document-updated`, so switching
104
+ the app's language takes effect without a restart. Commands, config keys
105
+ and file paths stay verbatim in both catalogs. The English templates are the
106
+ shipped texts byte-for-byte, and three groups stay English by design — the
107
+ `FS_*` refusals in `fs-decisions` and the fsio replica (the tool layer
108
+ matches on those strings) and the standalone `scripts/doctor.mjs` — see
109
+ [CONFIGURATION.md — Message language](docs/CONFIGURATION.md#message-language)
110
+ and [LIMITATIONS.md](docs/LIMITATIONS.md).
111
+
112
+ - **The plugin notices its own updates.** A new `wsl-update-check` row asks the
113
+ app's plugin manager for this package's version list on a slow timer (first
114
+ check 2–10 minutes after startup, then once a day; `intervalMs` configures
115
+ it, floored at one minute, and `enabled: false` stops the check). When the
116
+ stable channel has moved, the managed `DSH_WSL_PLUGIN_UPDATE` variable in
117
+ every distro session carries the fact, deprecation and "requires a newer
118
+ DSH" marks included; every other answer — no host plugin-manager, a linked
119
+ checkout, an unreachable registry — stays silent at debug level. The check
120
+ never fetches on its own and never installs: upgrading stays manual (Plugins
121
+ page, or `dsh plugin add`), then a restart, because the harness has no hot
122
+ reload. `node scripts/doctor.mjs` gained an `update.latest` section that
123
+ asks the same question on demand, `DSH_UPDATE_REGISTRIES` pins or empties
124
+ its registry list.
125
+
126
+
127
+ ### Fixed
128
+
129
+ - **The tool rows mount again: the context reads are declared.** Both tool
130
+ rows (`wsl-cwd-prompt-tool`, `wsl-doctor-tool`) read `ctx.tools` (and the
131
+ `workingDirectory` service) without exporting `inject`, so cordis 4 threw
132
+ `cannot get property "tools" without inject` at activation — the shipped
133
+ `working_directory` tool stayed disabled with no replacement registered.
134
+ Both rows now declare `inject = ["tools", "workingDirectory"]`. The
135
+ `wsl_doctor` tool additionally resolves its collector per call instead of
136
+ reading a `ctx.doctor` service nothing provides: a provided `doctor`
137
+ service through the optional `ctx.get`, else the test seam's `doctor`
138
+ property, else the package's own `doctorReport` — a required inject of a
139
+ nonexistent service would have failed the whole `preset-wsl` mount.
140
+
141
+ ## [0.19.0] - 2026-11-06
142
+
143
+ One theme: the wire and the doctor catch up with the substrate — protocol v7
144
+ (WSL-312), the live-resident report (WSL-313), and the probe/e2e evidence a
145
+ behaviour change owes the release notes.
146
+
147
+ ### Added
148
+
149
+ - **`doctor --wsl <path>` pins the `wsl.exe` every probe uses.** The doctor's
150
+ probes resolved `wsl.exe` from `PATH`, so a PATH race (one probe seeing one
151
+ binary, the next another) could not be ruled out; the flag rebinds every
152
+ probe and `doctorReport` forwards it, and the reject path carries the full
153
+ diagnostics.
154
+
155
+ - **`./index` is a public subpath.** The composition root's named surface
156
+ (`WslShellExecutor`, `WslFileSystem`, `doctorReport`,
157
+ `effectiveMaskWindowsDrive`, the row factories) is importable as
158
+ `dsh-plugin-wsl-env/index`, so tooling that wants the doctor's report or the
159
+ composition root's symbols no longer reaches into `lib/index.js` by file
160
+ path. The exports map and the generated `lib/index.d.ts` are the contract;
161
+ `docs/API.md` is the tour.
162
+
163
+ - **Agent protocol v7 (WSL-312): concurrent-ready FS frames, structured
164
+ errors, batched reads, and the peer's patch/delete/move operations.** HELLO
165
+ now advertises capabilities (`conc`, `batch`); failed FS ops answer with the
166
+ structured `FSERR|id|reason|b64` line; the new `FSB` batch frame answers a
167
+ GUI-preview-shaped stat+list+read in one round trip
168
+ (`test/probe/gui-preview-batch.sh` measures it); and the FS vocabulary grows
169
+ `delete`/`move` with the peer's guard dialects. `patchText` applies hunks
170
+ in-process through `@deepseek-ai/dsh-fs-patch` (new peer dependency), so the
171
+ `FS_PATCH_MISMATCH` dialect is the peer's byte-for-byte. Both agent
172
+ implementations ship v7 in lockstep (shell script + native binaries for
173
+ x86_64/aarch64), the host accepts agents 6–7 and gates every v7 frame on the
174
+ negotiated version, and the `0.18.0` declared gap for the peer's three new
175
+ operations is closed. Design: [docs/AGENT-PROTOCOL-V7.md](docs/AGENT-PROTOCOL-V7.md);
176
+ evidence: `agent/native/spike/test.mjs` (28 checks), `test/fs-substrate.test.mjs`
177
+ (17), `test/agent-protocol.test.mjs` (20).
178
+
179
+ - **The doctor can now report a live resident's failures (WSL-313).** The
180
+ CLI's handshake check states its probe source ("probed: a fresh resident")
181
+ and keeps saying that a live resident's `lastError` is host-private — the
182
+ CLI is a separate process and no IPC is invented. The merge happens only
183
+ where the context is reachable: `doctorReport(distro)` in `lib/index.js`
184
+ collects the shipped script as a subprocess and folds
185
+ `sharedAgent(distro).status()` in via `mergeLiveResidentStatus`
186
+ (`lib/doctor-live.js`) — a snapshot that answers for no resident changes
187
+ nothing; a `dead` live resident fails the check; a `lastError` on a running
188
+ one surfaces as `warn` with deaths/pending named, and the report tally
189
+ follows.
190
+
191
+ ### Changed
192
+
193
+ - **A failed login-shell probe now refuses the command instead of silently
194
+ running it under bash.** `wsl-shell`'s `shell` key stays empty by default and
195
+ resolves the distro user's login shell (`getent passwd`, then `$SHELL`); when
196
+ both probes fail — a cold distro, a flaky first `wsl.exe` call, a musl distro
197
+ without `getent` — the executor used to answer the literal `bash` for that
198
+ one call, running the command under an interpreter the user never configured
199
+ and telling no one. The resolvers now throw the refusal `runInDistro` used
200
+ before its removal (the distro, both probes, and the `shell:` escape hatch); the failure is
201
+ still not cached, so a retry re-probes; and the tool's self-presentation
202
+ reads `shell` rather than a bash that nothing resolved.
203
+
204
+ - **`toLinuxPath` no longer accepts a `distro` option.** The mapping is
205
+ coordinate-only and read no pin: the option was forwarded into the function's
206
+ own recursion and never consulted. The signature narrows to
207
+ `{ cwd?: string }`, the seven call sites that passed the pin drop it, and
208
+ every mapping result is unchanged — `test/paths.test.mjs` pins the UNC, drive
209
+ and relative forms without the option.
210
+
211
+ ### Removed
212
+
213
+ - **`runInDistro`.** The `./wsl` helper had no callers left: the shell
214
+ resolvers and the `shell-env` row probe through their own paths, so what
215
+ remained was dead public surface on a package whose exported names and error
216
+ codes are API. Its refusal wording is not lost — the executor's resolvers
217
+ throw `dsh-plugin-wsl: distro "…" named no usable shell (passwd probe and
218
+ $SHELL both failed)`, which the Changed entry above describes. The ignored
219
+ `toLinuxPath` option went in the same pass.
220
+
221
+ ### Fixed
222
+
223
+ - **The published name survives a power loss with its contents.** The shell
224
+ agent synced the staged file but not the containing directory, so the
225
+ rename that published a write or a move could vanish on restart while the
226
+ data survived (REVIEW 2026-10-03, still-open 1). After the publish rename —
227
+ both the write path and the move-over path — the agent now fsyncs the
228
+ destination's containing directory (`sync -d`, best effort: sync builds
229
+ without `-d` and filesystems refusing a directory fsync degrade to the
230
+ peer's promise silently). The native agent keeps its file-level `sync_all`
231
+ until its next build; the divergence is declared in `docs/PEER-PARITY.md`
232
+ (divergence 6).
233
+ - **A wedged unit-test file now fails in three minutes instead of hanging the
234
+ run.** `node --test` has no per-file deadline, and `--test-timeout` bounds
235
+ only tests a file has registered — a script-style suite that leaves a handle
236
+ alive behind an unsettled top-level await hangs before registration, and the
237
+ runner's "Promise resolution is still pending" message never arrives because
238
+ the loop never drains. `scripts/test-watchdog.mjs` now wraps `test:unit` and
239
+ `test:coverage`: the command runs untouched, and at the 180 s deadline the
240
+ wrapper interrupts the process group (SIGINT, so node prints its
241
+ "Interrupted while running" list naming the still-running file;
242
+ `taskkill /T` on Windows) and exits 124. `DSH_TEST_WATCHDOG_MS` overrides the
243
+ deadline. Observed shape: `test/shell-env.test.mjs` sat 584 s inside a 587 s
244
+ run, so every re-run paid the caller's whole command budget.
245
+
246
+ - **The coverage gate now proves every shipped module is measured.** Node's
247
+ coverage is load-based: `lib/git-exec.js` and the three peer-bound rows
248
+ (`picker`, `auto-preset`, `subprocess`) had no row at all, so the 96.65%
249
+ headline was computed over 35 of 41 modules. `test/git-exec.test.mjs` — nine
250
+ checks that passed but were in neither gate list — is wired into both, and
251
+ `scripts/coverage-gate.mjs` wraps `test:coverage`: every `lib/*.js` must be
252
+ measured or carry a reason in `test/coverage-allowlist.json`, every measured
253
+ module must clear 85/70/60 (line/branch/function), and a stale allowlist
254
+ entry fails the run. `test/provider.test.mjs` also asserts the
255
+ `lib/shell.js` and `lib/fs.js` re-exports now, so the measured set is 38 of
256
+ 41 instead of 35.
257
+
258
+ - **Two test-harness defects that could hang the gate or misreport it.** The
259
+ `check()` helper in `test/doctor.test.mjs` called its body synchronously
260
+ while two checks were `async`: `PASS` printed before any assertion ran, a
261
+ rejection escaped as an unhandled one, and the fixture cleanup could delete
262
+ the fake `wsl.exe` while `doctorReport` was still spawning it. The helper now
263
+ awaits. The live-agent helpers in `test/fs-substrate.test.mjs` and
264
+ `test/fsio-agent.test.mjs` close in `finally`, and the `close()` methods of
265
+ the three script-backed harnesses bound the SHUTDOWN wait at 2 s and kill on
266
+ timeout, so a failing check cannot leak a `sh` that makes `node --test` wait
267
+ forever.
268
+
269
+ ### Documentation
270
+
271
+ - **The install steps no longer assume a `dsh` executable.** The Windows
272
+ desktop app ships `DeepSeek Harness.exe` only — the CLI entry lives inside
273
+ `resources/app.asar`, and the probe scripts start it through
274
+ `ELECTRON_RUN_AS_NODE`. The README, QUICKSTART (both languages),
275
+ CONFIGURATION, MIGRATION, ARCHITECTURE, SUPPORT and the first-use template
276
+ now lead with the desktop path (**Plugins** in the sidebar, then **Add
277
+ plugin** — which writes the profile's `package.json` and
278
+ `dsh.profile.bundles`) and label the
279
+ `dsh ...` forms as the CLI distribution's.
280
+
281
+ - **The README asks whether the plugin is needed before it says how to install
282
+ it.** A harness that can live in the distro — the CLI in a terminal, or
283
+ `dsh web` in a browser — needs no bridge at all, and the new decision table
284
+ says so. It also records the one trap when the two are mixed: `desktop` is
285
+ the Electron app's reserved profile, and the npm CLI refuses to manage that
286
+ profile's plugins.
287
+
288
+ - **The desktop start line is the executable, not a command.** The installer's
289
+ shortcut launches `DeepSeek Harness.exe` with no arguments, and the GUI opens
290
+ the profile it is configured with — the one the Plugins page writes into.
291
+ `dsh --profile <name>` stays a CLI-distribution line.
292
+
19
293
  ## [0.18.0] - 2026-11-05
20
294
 
21
295
  Track the desktop `0.2.2-rc.1` release: the bundle layer is regenerated from
package/CONTRIBUTING.md CHANGED
@@ -23,9 +23,10 @@ Developing and running the gates do have dependencies. The tests import pinned
23
23
  algorithm, and the boot test starts a row through the real Loader — so a fresh
24
24
  checkout needs one `pnpm install` before the gates pass.
25
25
 
26
- Those pins are deliberate, and they split by role. The `devDependencies` stay
27
- exact so the gates and the `docs/PEER-PARITY.md` audit name one reproducible
28
- line. The `peerDependencies` are floors — `>=` for the `@deepseek-ai/dsh-*`
26
+ Those pins are deliberate, and they split by role. The `@deepseek-ai/*`
27
+ `devDependencies` stay exact so the gates and the `docs/PEER-PARITY.md` audit
28
+ name one reproducible line (the toolchain deps — typescript, js-yaml,
29
+ `@types/*` — ride ranges and move by hand). The `peerDependencies` are floors — `>=` for the `@deepseek-ai/dsh-*`
29
30
  packages, caret for `@deepseek-ai/cordis` and `@deepseek-ai/schemastery` — so
30
31
  an app that ships a newer harness keeps installing the plugin without waiting
31
32
  for a plugin release. A floor is still raised on purpose, not by drift: it
@@ -184,7 +185,7 @@ terminal if you would rather not see the prompt.
184
185
  |---|---|---|
185
186
  | `pnpm test` | style checks, relative links, syntax pass, build consistency, type check, and unit tests | no |
186
187
  | `pnpm run lint:links` | relative Markdown links in README, CONTRIBUTING, AGENTS and `docs/**` | no |
187
- | `pnpm run test:coverage` | unit tests with coverage | no |
188
+ | `pnpm run test:coverage` | unit tests with coverage, then the per-module gate: every `lib/*.js` measured or allowlisted, per-module floors 85/70/60 | no |
188
189
  | `pnpm run lint:style` | style and lint rules | no |
189
190
  | `pnpm run lint:build` | the build-freshness check: every source has its artifacts and the committed bytes match a real build | no |
190
191
  | `pnpm run lint:types` | the TypeScript check over `test/**` and the ambient types (`tsc --noEmit`) | no |
@@ -226,7 +227,7 @@ still need Windows and WSL2, but no harness boot and no profile: run them from a
226
227
  distro terminal with Node available, and they reach `wsl.exe` through interop.
227
228
 
228
229
  Two conveniences for the real-machine set. `test/probe/run-all-when-closed.sh
229
- --include-fs` runs all fifteen probes once the app has exited. The interop shell
230
+ --include-fs` runs all seventeen probes once the app has exited. The interop shell
230
231
  matrix uses the `wslfs` profile, systemd and a lingering user manager; it fails
231
232
  when Windows interop or its temporary marker cannot be verified. And `ci.yml` has a
232
233
  scheduled and manually dispatched `probes` job: `sandbox` runs whenever a default distro
@@ -236,6 +237,18 @@ its `runs-on` carries the GitHub-hosted `windows-latest` label; when the hosted
236
237
  runner has no usable distro the job is a green no-op (`skip all`). Where a default
237
238
  distro launches without bubblewrap, the `sandbox` leg fails, not skips.
238
239
 
240
+ **Self-hosted runner label collision — known exposure.** The development
241
+ machine's self-hosted runner fulfills the GitHub-hosted `windows-latest` label,
242
+ so the unit matrix's Windows legs execute there on every push and PR. PR code
243
+ from a fork is skipped on those legs (`ci.yml`'s step-level fork gate), but the
244
+ durable fix is renaming the runner's label to something unambiguous (for
245
+ example `self-hosted-wsl`) in the runner's settings and repointing the two
246
+ `windows-latest` consumers in `ci.yml` at it — until then, treat the label as
247
+ shared infrastructure, not hosted capacity. Also note the install steps carry
248
+ `--config.minimum-release-age=0` (pnpm 11.7's lockfile re-verification ignores
249
+ `minimumReleaseAgeExclude`; the flag is the documented remedy in
250
+ `release.yml`).
251
+
239
252
  ## Adding a test
240
253
 
241
254
  Choose the layer by what the test needs.
@@ -249,6 +262,25 @@ Unit tests run under `node --test`. The `test:unit` and the `test:coverage` list
249
262
  in `package.json` name their files explicitly; a test that only touches this
250
263
  repository belongs in both. Keep the lists synchronized without duplicate entries.
251
264
 
265
+ Both scripts run their list under `scripts/test-watchdog.mjs`, which bounds the
266
+ whole run at 180 s (`DSH_TEST_WATCHDOG_MS` overrides). `node --test` has no
267
+ per-file deadline, so a script-style file that leaves a handle alive behind an
268
+ unsettled top-level await would otherwise hang the gate until the caller kills
269
+ it; at the deadline the wrapper interrupts the run and node's "Interrupted while
270
+ running" list names the file that never finished. The scripts also pass
271
+ `--test-timeout=60000`, which bounds only tests a file registers with `test()` —
272
+ the watchdog is what covers a hang at module evaluation.
273
+
274
+ `test:coverage` runs that list through `scripts/coverage-gate.mjs` as well.
275
+ Node's coverage is load-based — a module no test imports has no row, so the
276
+ global percentage silently measures a subset — so the gate requires every
277
+ `lib/*.js` to be measured or named in `test/coverage-allowlist.json` with the
278
+ reason it cannot be loaded by the gated suite, and holds every measured module
279
+ to floors of 85 lines / 70 branches / 60 functions. A new module without a test
280
+ fails the gate, and so does an allowlist entry for a module that no longer
281
+ exists. Adding a test is the preferred fix; the allowlist keeps the remaining
282
+ probe-only rows visible instead of letting them vanish from the denominator.
283
+
252
284
  A test that imports a pinned `@deepseek-ai/*` package goes in the same lists and
253
285
  needs no guarding — CI runs `pnpm install --frozen-lockfile` over the locked tree
254
286
  before `pnpm test`. For example,
package/README.md CHANGED
@@ -14,6 +14,32 @@ Windows + WSL 2 only.
14
14
 
15
15
  **New here?** Start with [docs/QUICKSTART.md](docs/QUICKSTART.md) — prerequisites, recipes and the compatibility table.
16
16
 
17
+ ## Do I need this plugin?
18
+
19
+ If the harness itself can run in the distro, it is simpler **not** to use this
20
+ plugin: install the CLI there and run it from the distro's shell. No UNC paths,
21
+ no 9p round trips, no Windows-to-distro agent.
22
+
23
+ ```bash
24
+ # inside the distro; the CLI needs Node >= 24.9
25
+ npm install -g @deepseek-ai/dsh
26
+ dsh web # browser UI, reached through WSL's localhost forwarding
27
+ dsh headless "run the tests" # one task, one answer, exit
28
+ ```
29
+
30
+ Use this plugin when the harness has to stay on Windows:
31
+
32
+ | Your setup | What to use |
33
+ |---|---|
34
+ | Work happens inside WSL; a terminal or browser UI is enough | the CLI installed in the distro |
35
+ | You want the Windows desktop app, with commands and files in the distro | this plugin |
36
+ | One session must reach Windows and WSL folders at once | this plugin — per-path routing is the point |
37
+
38
+ Mixing the two has one trap: the `desktop` profile name is owned by the Electron
39
+ app, and the npm CLI refuses to manage that profile's plugins — use the app's
40
+ Plugins page for it. [docs/VALUE.zh.md](docs/VALUE.zh.md) has the full
41
+ comparison and the cases this plugin is not for.
42
+
17
43
  ## Why this plugin
18
44
 
19
45
  A Windows coding tool that works on WSL projects has three options: run the whole tool inside the distro, connect to a helper server inside the distro, or let the plugin provide the distro environment. This plugin is the third option. One workflow covers both kinds of session, with the distro's real tools and the command sandbox intact.
@@ -59,10 +85,25 @@ No Node.js is required inside the distro.
59
85
 
60
86
  ## Install
61
87
 
62
- Run these commands in a Windows terminal:
88
+ The Windows desktop app ships **no `dsh` executable**: the installer writes
89
+ `DeepSeek Harness.exe`, and the CLI entry lives inside `resources/app.asar`
90
+ (the probe scripts launch it through `ELECTRON_RUN_AS_NODE`). Use the
91
+ distribution you have.
92
+
93
+ **Desktop app.** Open **Plugins** in the sidebar, choose **Add plugin**, enter
94
+ the exact package name `dsh-plugin-wsl-env`, then enable it. The plugin manager
95
+ writes the active profile's `package.json` — the dependency and the
96
+ `dsh.profile.bundles` entry — which is the same state the CLI command below
97
+ produces. To run from a checkout, add it as a linked package instead of a
98
+ name. Start it the way the installer's shortcut does: `DeepSeek Harness.exe`,
99
+ no arguments. The app opens the profile it is configured with — the one the
100
+ Plugins page writes into — so a different profile is a CLI-distribution thing
101
+ (`dsh --profile <name>`).
102
+
103
+ **CLI distribution** (`dsh` on `PATH`), in a Windows terminal:
63
104
 
64
105
  ```powershell
65
- dsh wsl --from-default-profile web --dump-config # create the profile
106
+ dsh wsl --from-default-profile web --dump-config # create a profile named wsl
66
107
  dsh plugin --profile wsl add dsh-plugin-wsl-env # install the plugin and its settings
67
108
  dsh --profile wsl --dump-config # verify: prints "# == dsh-plugin-wsl-env"
68
109
  dsh --profile wsl # start
@@ -74,9 +115,14 @@ Install `bubblewrap` before the first command:
74
115
  wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap
75
116
  ```
76
117
 
77
- From a checkout, `pnpm run doctor` is the one-command environment check: Windows/WSL versions, the distro and its shell, bubblewrap usability, systemd / the user manager / Linger, the optional tools, peer versions, the agent cache, a fresh-agent handshake, stale session scopes and the known profile-patch trap. Each failure prints one copy-paste remedy; `--json` is for scripts, and `--fix` sweeps stale scopes (package installation needs `--fix --install` and an explicit confirmation). `pnpm run diagnose` is its read-only alias. `pnpm run bootstrap <distro>` remains the narrower tool-install helper.
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.
78
119
 
79
- Upgrade by running the `add` command again. Uninstall with `dsh plugin --profile wsl remove dsh-plugin-wsl-env`; the agent cache under `~/.cache/dsh-wsl` can then be deleted. If you added a local `workspace-files-wsl` workaround to your profile to restore previews, remove it after upgrading: the plugin no longer mounts that row.
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
+ the Plugins page, or with `dsh plugin --profile wsl remove dsh-plugin-wsl-env`
122
+ where the CLI is installed; the agent cache under `~/.cache/dsh-wsl` can then be
123
+ deleted. If you added a local `workspace-files-wsl` workaround to your profile to
124
+ restore previews, remove it after upgrading: the plugin no longer mounts that
125
+ row.
80
126
 
81
127
  ## Using it
82
128
 
@@ -107,7 +153,13 @@ Settings live on named rows in `$DSH_HOME/profiles/<name>/cordis.patch.yml`. The
107
153
  | `directory-picker-wsl` | `includeHostHome` | `true` | also list the Windows home directory |
108
154
  | `subprocess-wsl` | `distro` | `''` | distro mode; empty/`auto` follows the launch directory |
109
155
 
110
- `wsl-shell` and `wsl-fs` are inside the shipped `wsl` preset, so overriding them by id does not work. Override the whole `preset-wsl` row instead; [docs/CONFIGURATION.md](docs/CONFIGURATION.md) has the recipe and the remaining keys. [`cordis.patch.yml`](cordis.patch.yml) is the commented reference for every shipped value.
156
+ `fs-routing` is the top-level router for root-level `ctx.fs` calls: its distro
157
+ settings are independent of `wsl-fs`, and it is a top-level row patched by id
158
+ like the others. `wsl-shell` and `wsl-fs` are inside the shipped `wsl` preset,
159
+ so overriding them by id does not work. Override the whole `preset-wsl` row
160
+ instead; [docs/CONFIGURATION.md](docs/CONFIGURATION.md) has the recipe and the
161
+ remaining keys. [`cordis.patch.yml`](cordis.patch.yml) is the commented
162
+ reference for every shipped value.
111
163
 
112
164
  ## Architecture
113
165
 
@@ -176,6 +228,9 @@ Real-machine probes run on Windows + WSL only. See [CONTRIBUTING.md](CONTRIBUTIN
176
228
  |---|---|
177
229
  | [docs/QUICKSTART.md](docs/QUICKSTART.md) | first run, recipes, compatibility |
178
230
  | [docs/PERFORMANCE.md](docs/PERFORMANCE.md) | ext4 agent vs 9p, measured latency, how to reproduce |
231
+ | [docs/MIGRATION.md](docs/MIGRATION.md) | upgrading from earlier versions, release gates |
232
+ | [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md) | the tested Windows/WSL/distro matrix and scope decisions |
233
+ | [docs/API.md](docs/API.md) | the package's subpath exports at a glance |
179
234
  | [docs/CONFIGURATION.md](docs/CONFIGURATION.md) | every configuration key and how to override it |
180
235
  | [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | services, path routing, sandbox, error codes |
181
236
  | [docs/LIMITATIONS.md](docs/LIMITATIONS.md) | what the plugin does not do |
package/SUPPORT.md CHANGED
@@ -6,7 +6,7 @@
6
6
  |---|---|
7
7
  | Operating system | Windows 10 and Windows 11 |
8
8
  | Linux side | WSL2 with at least one distro, and systemd as PID 1 with a lingering user manager (`loginctl enable-linger`) for the shipped session runtime. Set `sessionSandbox: false` on the preset's `wsl-shell` to keep the per-command sandbox instead |
9
- | DSH packages | `peerDependencies` declares a `0.2.1-rc.3` floor; newer versions require compatibility validation |
9
+ | DSH packages | `peerDependencies` declares a `0.2.2-rc.1` floor; newer versions require compatibility validation |
10
10
  | Plugin version | the latest published version only |
11
11
  | Node | 22.19+ (`^22.19.0`), or 24 and later (`>=24.0.0`) |
12
12
 
@@ -60,7 +60,7 @@ issue for one.
60
60
 
61
61
  ## Compatibility expectations
62
62
 
63
- The DSH peer ranges start at `0.2.1-rc.3`; development dependencies pin that
63
+ The DSH peer ranges start at `0.2.2-rc.1`; development dependencies pin that
64
64
  version exactly for testing. Cordis and Schemastery use caret peer ranges.
65
65
  The accepted range does not guarantee compatibility with every newer release:
66
66
  an upstream change can require a new release of this plugin.
@@ -96,7 +96,7 @@ what it cannot see:
96
96
  | The diagnose report | `pnpm run diagnose <distro>` (read-only; review and redact before sharing) |
97
97
  | Plugin version | `npm ls dsh-plugin-wsl-env`, or the git tag you built from |
98
98
  | DSH version | the version of the harness you run |
99
- | The composed configuration | `dsh --profile <name> --dump-config`, in particular the `dsh-plugin-wsl-env` layer and the rows it patches |
99
+ | The composed configuration | On the CLI distribution, `dsh --profile <name> --dump-config` (the `dsh-plugin-wsl-env` layer and the rows it patches). The desktop app has no `dsh` command; attach the profile's `cordis.patch.yml` instead |
100
100
  | Sandbox behaviour, in depth | the output of `npm run probe:sandbox`, run from inside the distro (`wsl.exe -d <distro>` first) — the probe calls `bwrap` and reads `lib/bwrap.js` there, so it needs both in the distro |
101
101
  | What you expected and what happened | one paragraph each |
102
102
  | A reproduction | the exact command, or the exact sequence of clicks |