dsh-plugin-wsl-env 0.28.0 → 0.29.1
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 +368 -0
- package/CONTRIBUTING.md +68 -12
- package/CONTRIBUTING.zh.md +34 -4
- package/README.md +1 -1
- package/agent/native/linux-aarch64/dsh-wsl-agent +0 -0
- package/agent/native/linux-x86_64/dsh-wsl-agent +0 -0
- package/agent/wsl-agent.sh +15 -4
- package/client.js +540 -160
- package/cordis.patch.yml +28 -7
- package/docs/AGENT-PROTOCOL-V7.md +4 -2
- package/docs/API.md +1 -1
- package/docs/API.zh.md +1 -1
- package/docs/ARCHITECTURE.md +7 -4
- package/docs/ARCHITECTURE.zh.md +6 -4
- package/docs/COMPATIBILITY.md +1 -1
- package/docs/COMPATIBILITY.zh.md +1 -1
- package/docs/CONFIGURATION.md +28 -15
- package/docs/CONFIGURATION.zh.md +20 -11
- package/docs/DIAGNOSTICS.md +45 -19
- package/docs/DIAGNOSTICS.zh.md +33 -15
- package/docs/LIMITATIONS.md +70 -10
- package/docs/LIMITATIONS.zh.md +53 -8
- package/docs/PERFORMANCE.md +29 -1
- package/docs/PERFORMANCE.zh.md +23 -1
- package/docs/QUICKSTART.md +21 -15
- package/docs/QUICKSTART.zh.md +13 -11
- package/docs/README.zh.md +1 -1
- package/docs/RELEASING.md +29 -6
- package/docs/RELEASING.zh.md +9 -0
- package/docs/adr/0002-native-agent.md +50 -2
- package/lib/agent-confined.js +15 -4
- package/lib/agent-errors.d.ts +16 -0
- package/lib/agent-errors.js +19 -0
- package/lib/agent-exec.d.ts +8 -1
- package/lib/agent-exec.js +2 -1
- package/lib/agent-shared.d.ts +85 -2
- package/lib/agent-shared.js +167 -38
- package/lib/agent.d.ts +60 -6
- package/lib/agent.js +177 -28
- package/lib/auto-preset.js +7 -2
- package/lib/doctor-live.d.ts +36 -7
- package/lib/doctor-live.js +61 -12
- package/lib/doctor-process.d.ts +68 -0
- package/lib/doctor-process.js +139 -0
- package/lib/doctor-report.js +11 -109
- package/lib/fs-substrate.js +3 -3
- package/lib/fsio-agent.d.ts +57 -6
- package/lib/fsio-agent.js +168 -75
- package/lib/git-exec.d.ts +7 -1
- package/lib/git-exec.js +14 -2
- package/lib/native-agent.d.ts +25 -4
- package/lib/native-agent.js +52 -9
- package/lib/picker.d.ts +2 -1
- package/lib/picker.js +30 -13
- package/lib/plugin-update.js +18 -14
- package/lib/provider-common.d.ts +112 -0
- package/lib/provider-common.js +171 -0
- package/lib/sandbox-core.js +52 -13
- package/lib/search-exec.d.ts +6 -0
- package/lib/search-exec.js +10 -2
- package/lib/session-runtime.d.ts +46 -1
- package/lib/session-runtime.js +57 -7
- package/lib/session-scope.d.ts +22 -1
- package/lib/session-scope.js +33 -7
- package/lib/shell-env.js +125 -12
- package/lib/socket-isolation.d.ts +12 -4
- package/lib/socket-isolation.js +27 -10
- package/lib/status.d.ts +7 -4
- package/lib/status.js +72 -16
- package/lib/subprocess.js +3 -3
- package/lib/terminal-activity.js +6 -9
- package/lib/wsl-doctor-command.js +36 -80
- package/lib/wsl-filesystem.d.ts +9 -4
- package/lib/wsl-filesystem.js +26 -10
- package/lib/wsl-shell.d.ts +27 -17
- package/lib/wsl-shell.js +83 -24
- package/lib/wsl.d.ts +3 -1
- package/lib/wsl.js +82 -7
- package/package.json +5 -4
- package/scripts/bootstrap.sh +36 -12
- package/scripts/doctor.mjs +514 -201
package/CHANGELOG.md
CHANGED
|
@@ -16,6 +16,374 @@ were part of the record.
|
|
|
16
16
|
|
|
17
17
|
## [Unreleased]
|
|
18
18
|
|
|
19
|
+
## [0.29.1] - 2026-11-25
|
|
20
|
+
|
|
21
|
+
Correctness and performance fixes across the resident agent, the session
|
|
22
|
+
runtime, isolation and diagnostics (#72-#78, #85, #89-#91).
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **A command runs when the resident agent is out.** The shell executor's
|
|
27
|
+
one-shot `wsl.exe` fallback only answered a synchronous throw from the agent
|
|
28
|
+
factory. The real `WslAgent.exec` is async, so a dead or backing-off resident,
|
|
29
|
+
or one whose handshake failed, failed the command with the bare refusal
|
|
30
|
+
instead of falling back, as the docs promise. Every refusal that arrives
|
|
31
|
+
asynchronously through `result()` now takes the fallback. A command that was
|
|
32
|
+
already in flight when the resident was lost is the deliberate exception:
|
|
33
|
+
it may have run, so it fails as "state is unknown" and is not executed a
|
|
34
|
+
second time (#72).
|
|
35
|
+
- **A command run through the resident agent releases its handle when it
|
|
36
|
+
settles.** The agent-backed handle never called the executor's settlement
|
|
37
|
+
hook, so every confined command kept its handle — captured output included
|
|
38
|
+
— in the executor's fact table for the life of the process, and a background
|
|
39
|
+
process started through the resident reported no sandbox facts. The handle
|
|
40
|
+
now settles exactly where upstream's own one does.
|
|
41
|
+
- **A session runtime is released when its session ends.** The shell and
|
|
42
|
+
filesystem providers registered the release as a disposer on the preset's
|
|
43
|
+
realm, but upstream keeps that realm for the process and disposes it only
|
|
44
|
+
when the preset is unregistered — so nothing was released per session. The
|
|
45
|
+
providers now listen for the harness's `agent/disposed`, drop their own
|
|
46
|
+
references for that session, and end it in the registry
|
|
47
|
+
(`SessionRuntimes.releaseSession`); a session resumed under the same id
|
|
48
|
+
acquires a fresh runtime instead of reusing a closed agent. A sweep
|
|
49
|
+
underneath ends a session whose runtimes have been quiet for ten minutes
|
|
50
|
+
with no live agent behind them. Note: Harness 0.2.2-rc.5 disposes an agent
|
|
51
|
+
only at teardown, not when a session view is closed, so on that version a
|
|
52
|
+
session's runtime still lives as long as its agent (#73).
|
|
53
|
+
- **Stopping a session scope now stops the scope.** The stop named the unit
|
|
54
|
+
without the `.scope` suffix `systemd-run --scope` adds, so `systemctl
|
|
55
|
+
--user stop` resolved a `.service` that was never loaded and exited 5. An
|
|
56
|
+
empty scope died with its agent anyway; a session that left a background
|
|
57
|
+
process behind kept it. The teardown leg of `test/probe/native-session.mjs`
|
|
58
|
+
was passing vacuously on the same two grounds and now leaves a background
|
|
59
|
+
process in the scope and reads the `.scope` unit back.
|
|
60
|
+
- **The native agent handles a stdin payload of any size.** It wrote the
|
|
61
|
+
payload from the request's own thread before the output readers started. A
|
|
62
|
+
child that echoes — `cat` with 1.25 MiB or more on stdin — filled its
|
|
63
|
+
stdout pipe, stopped reading, and the feed blocked with the request's
|
|
64
|
+
timeout queued behind it, until the host watchdog killed the transport
|
|
65
|
+
eighteen seconds in. The feed runs on its own thread, after both readers
|
|
66
|
+
(#74).
|
|
67
|
+
- **Native agent filesystem fixes (#78).** Each is pinned by a check in
|
|
68
|
+
`agent/native/spike/test.mjs` that fails against the previous binary:
|
|
69
|
+
- Only mutations take `fs_lock`, and the `ACK` reports the dequeue before
|
|
70
|
+
any lock: a `stat` no longer waits behind a slow write or move.
|
|
71
|
+
- A listing skips an entry that vanished between the directory read and its
|
|
72
|
+
own stat instead of failing as `notfound`; the shell agent's `find` is
|
|
73
|
+
tolerated the same way.
|
|
74
|
+
- The in-distro timeout takes the cancel path's TERM-then-KILL grace
|
|
75
|
+
instead of `KILL` after 100 ms, so a command that cleans up on `TERM`
|
|
76
|
+
can.
|
|
77
|
+
- A `move` on one filesystem is a `rename` (with `renameat2(RENAME_NOREPLACE)`
|
|
78
|
+
for the no-replace guard) instead of a whole-file copy under the lock;
|
|
79
|
+
across filesystems it is still copied.
|
|
80
|
+
- A write sweeps the target's staging directories whose creating process is
|
|
81
|
+
gone. Both agents now stage under `.<base>.<pid>.<token>.tmpdir`, so
|
|
82
|
+
either sweep recognises the other's leftovers.
|
|
83
|
+
- **Search and git results cut at the agent's capture cap are reported as
|
|
84
|
+
cut.** On the resident path neither handle read the agent's truncation
|
|
85
|
+
flags, so a result past the cap was parsed as complete — later matches and
|
|
86
|
+
changed files silently missing — and the git handle kept the head of an
|
|
87
|
+
over-budget stream where the one-shot handle keeps the tail. Both handles
|
|
88
|
+
now carry the flags, and a cut keeps the tail (#75).
|
|
89
|
+
- **A dead resident is no longer replaced, and the native agent is demoted
|
|
90
|
+
only on evidence (#77).** `sharedAgent()` swapped in a fresh agent as soon
|
|
91
|
+
as the shared one was `dead` — including the two-second backoff window —
|
|
92
|
+
which reset the revival budget and, on any death, retired the native entry
|
|
93
|
+
for the rest of the process. The filesystem provider kept the old instance,
|
|
94
|
+
so commands ran on one agent and file operations on another. There is now
|
|
95
|
+
one instance per distro for the life of the process, and every holder
|
|
96
|
+
addresses it. The native entry is demoted only when it fails a start that
|
|
97
|
+
the shell entry then makes on the same distro, for five minutes, and is
|
|
98
|
+
tried again; a distro that is down fails both entries alike and is not
|
|
99
|
+
held against the native one. A failed native preparation (copy, digest,
|
|
100
|
+
execute check) is no longer cached for the process — the next start
|
|
101
|
+
prepares again — and its reason is kept for the doctor to report.
|
|
102
|
+
- **`wsl_doctor` sees a dead resident, and stops warning after a recovery
|
|
103
|
+
(#81).** The merge that folds the live resident into a report required a
|
|
104
|
+
pid, and every path into `dead` clears it, so the resident that was down —
|
|
105
|
+
with file operations failing closed behind it — was reported as the fresh
|
|
106
|
+
probe's `ready`. The merge now fires for any resident this process held; a
|
|
107
|
+
dead one fails the check, and the report's blockers, verdict and per-distro
|
|
108
|
+
verdicts follow. An accepted handshake clears the last failure, so a
|
|
109
|
+
resident that recovered is diagnosed by what it is instead of warning on
|
|
110
|
+
the crash it survived until the app restarted.
|
|
111
|
+
- **The port poller follows the sessions and leaves a stopped distro alone
|
|
112
|
+
(#80).** A polling timer, once started for a distro, ran until the row was
|
|
113
|
+
disposed: with no session left using the distro it kept scanning every ten
|
|
114
|
+
seconds and kept the shared resident from ever idling out, and after a
|
|
115
|
+
`wsl --terminate` or `--shutdown` its next `wsl.exe -d <distro>` booted the
|
|
116
|
+
distro back. Polling now stops when no live session works in the distro;
|
|
117
|
+
each round asks WSL which distros are running before it probes, so a
|
|
118
|
+
stopped distro is not probed and `DSH_WSL_PORTS` reads empty for it; and a
|
|
119
|
+
scan still in flight is not overlapped by the next tick.
|
|
120
|
+
- **The WSL panel keeps a full diagnosis and a repair across a page load, and
|
|
121
|
+
one check at a time (#79).** The page load's background re-check is a quick
|
|
122
|
+
one; it used to replace a stored full diagnosis or repair sixty seconds
|
|
123
|
+
after the user last opened the panel, dropping the repair button and the
|
|
124
|
+
repair's before → after evidence. The panel no longer queues it for such a
|
|
125
|
+
result, and the route answers a stored full or repaired result as it is to
|
|
126
|
+
a background request that asks anyway (a failed full run is still
|
|
127
|
+
re-checkable). The list read now merges into the rows instead of replacing
|
|
128
|
+
the table, so a check in flight keeps its state, and **刷新** is disabled
|
|
129
|
+
while any check is running. The status route joins requests for the same
|
|
130
|
+
distro and mode into one run, so two doctors no longer sweep one distro
|
|
131
|
+
concurrently. The plugin-update route takes its one-at-a-time lock before
|
|
132
|
+
the version check instead of after it: inside a cold or stale check —
|
|
133
|
+
seconds of registry round trip — two clicks each ran their own removal and
|
|
134
|
+
install.
|
|
135
|
+
- **Large file operations no longer stall the host, and symlink-heavy
|
|
136
|
+
directories list in one round trip (#76).** Three independent costs, each
|
|
137
|
+
measured on a real distro with the native agent (median; the previous code
|
|
138
|
+
on the same machine in parentheses):
|
|
139
|
+
- The line splitter joined every arriving chunk into one growing string and
|
|
140
|
+
rescanned it, which is quadratic: a 16 MiB read frame in 64 KiB chunks
|
|
141
|
+
held the host's event loop for 2678 ms. It now keeps a list of chunks,
|
|
142
|
+
searches each once and joins a line once: 83 ms.
|
|
143
|
+
- The stat and the first read window of a whole-file read shared one batched
|
|
144
|
+
frame, which put the window's bytes through base64 twice. The two frames
|
|
145
|
+
now go out back to back instead, so the read is a plain frame and the
|
|
146
|
+
pair still costs one round trip: 26.6 ms → 15.0 ms for 1 MiB.
|
|
147
|
+
- A directory's symlinks were followed one at a time, two round trips each.
|
|
148
|
+
They are now collected and sent in one batched frame per 256 links, stat
|
|
149
|
+
and realpath together: a directory of 200 symlinks went from 136.3 ms to
|
|
150
|
+
6.1 ms. A resident without the batch capability keeps the serial road.
|
|
151
|
+
- A byte-capped read asked for the whole allowance in one request, which
|
|
152
|
+
cancelled the windowing — an edit's diff basis, bounded at 10 MiB, was
|
|
153
|
+
one multi-megabyte frame. Every window is now at most one chunk wide.
|
|
154
|
+
- **The packaged native binaries were rebuilt** from the hardened source with
|
|
155
|
+
the pinned toolchain (1.99.1). They were linked with the toolchain's
|
|
156
|
+
self-contained musl objects rather than by the CI job's `musl-gcc`/zig
|
|
157
|
+
linkers; both pass the full 35-check suite (aarch64 under qemu-user), the
|
|
158
|
+
native wiring check and the session-runtime probe.
|
|
159
|
+
- **`preset-wsl` is regenerated from the rc.2 standard preset, and a parity
|
|
160
|
+
check keeps it there (#82).** The copy still followed `dsh-v0.2.2-rc.1`
|
|
161
|
+
while the peer pins had moved to rc.2, so every WSL session lacked three
|
|
162
|
+
things the app's own standard mode had: the `tool-office` row, the
|
|
163
|
+
`skill-filesystem` row's `customSkillDirs` (the preset package's bundled
|
|
164
|
+
skills), and `tool-subagent-control`'s `interrupt: false`. All three are
|
|
165
|
+
upstream's, verbatim. `pnpm run preset:sync`
|
|
166
|
+
([scripts/preset-sync.mjs](https://github.com/Big-Dao/dsh-plugin-wsl-env/blob/main/scripts/preset-sync.mjs))
|
|
167
|
+
compares the row with a committed snapshot of the pinned line's
|
|
168
|
+
`standard.patch.yml` — the dependency tree ships none — row by row and in
|
|
169
|
+
order, nested groups included, and `pnpm test` runs the same check
|
|
170
|
+
(`test/preset-sync.test.mjs`). The snapshot's name is tied to the dev pin,
|
|
171
|
+
so raising the pins without refreshing it fails. Two things worth knowing:
|
|
172
|
+
the `customSkillDirs` expression is evaluated with the root Include's
|
|
173
|
+
`baseUrl` — the same for every row of the composition, this bundle's
|
|
174
|
+
included, which a real-Loader check now pins — and on the Desktop package
|
|
175
|
+
the bundled skills stay unreadable from a distro, because the app's
|
|
176
|
+
`node_modules` sit inside `app.asar`; that root is skipped as absent and is
|
|
177
|
+
documented in LIMITATIONS.
|
|
178
|
+
- **The doctor's failure paths stop reporting success they cannot see (#83).**
|
|
179
|
+
Four defects in `scripts/doctor.mjs`, each reached when a fix or a probe
|
|
180
|
+
fails:
|
|
181
|
+
- The recheck after the stale-scope sweep and after the agent-cache purge
|
|
182
|
+
took one un-retried read and never looked at whether it succeeded, so a
|
|
183
|
+
read that timed out or flaked counted as "0 stale" / "0 invalid" and the
|
|
184
|
+
fix was recorded as done. Both now go through the flake-aware probe, and
|
|
185
|
+
a recheck that still does not answer makes the `fix.*` row `unknown`;
|
|
186
|
+
`runtime.scopes` is `unknown` too, while `agent.cache` keeps its
|
|
187
|
+
before-the-fix verdict rather than being cleared on no evidence.
|
|
188
|
+
- A failed fix said "see the output above", and the doctor never printed
|
|
189
|
+
output. The tail of it now rides the `fix.*` row (install, sweep, purge,
|
|
190
|
+
git whitelist), and wsl.exe's error class (`Wsl/Service/WSAETIMEDOUT`)
|
|
191
|
+
is quoted instead of the first 80 characters of a localized sentence.
|
|
192
|
+
- `--fix --install` had no `apt-get update` (a fresh Debian or Ubuntu
|
|
193
|
+
answers `E: Unable to locate package`), gave a whole install the 60 s
|
|
194
|
+
deadline every host command shares (a `dpkg` killed mid-configure is
|
|
195
|
+
left half-configured), and used pacman's `-Sy`, the index-only refresh
|
|
196
|
+
Arch advises against. apt now refreshes the index first, the install
|
|
197
|
+
gets ten minutes, and pacman takes `-S --noconfirm --needed`. The printed
|
|
198
|
+
remedy goes through `sh -c "…"`, which keeps the `&&` inside the distro
|
|
199
|
+
in cmd, PowerShell 5.1 and PowerShell 7 alike. `scripts/bootstrap.sh` and
|
|
200
|
+
the sandbox provider's fail-closed message print and run the same
|
|
201
|
+
command, and the docs that quote it follow.
|
|
202
|
+
- The handshake — a blocking check whose `fail` skips both smoke legs —
|
|
203
|
+
ran on one 5 s attempt with no retry, while the warn-level smoke legs
|
|
204
|
+
had 30 s and a second try. It now waits 15 s for the HELLO and retries a
|
|
205
|
+
transport flake once; a deterministic failure is answered at once.
|
|
206
|
+
- Two smaller ones from the same review: one scope's `pids` no longer leak
|
|
207
|
+
into every following line of the stale-scope report, and the `--bundle`
|
|
208
|
+
note and the confirmation prompt go to stderr, so `--json` output is the
|
|
209
|
+
report alone.
|
|
210
|
+
- **The test suite's own gaps close (#84).** Three places where a green line
|
|
211
|
+
did not mean the named behaviour was exercised:
|
|
212
|
+
- The fence around `deleteFile`, `moveFile`, `patchText` and `editText` had
|
|
213
|
+
no test — only `writeText` did — although a test named for it existed and
|
|
214
|
+
proved only that the wrappers reached a stub. A table-driven check now
|
|
215
|
+
refuses every mutation route under workspace-write with a target outside
|
|
216
|
+
every writable root and under read-only with a target inside the
|
|
217
|
+
workspace, asserts `FS_SANDBOX_DENIED` and that the substrate was never
|
|
218
|
+
asked, and runs the same table once under an allowing policy as the
|
|
219
|
+
control. Removing one wrapper's fence fails it.
|
|
220
|
+
- Three checks could not see what they were named for. The PID-namespaced
|
|
221
|
+
resident asserted before the delayed cancel signal could fire (it now
|
|
222
|
+
waits, and fails when a prefixed resident is signalled); the watch check
|
|
223
|
+
asserted only "some error" (it now runs the real `armDistroWatcher` over a
|
|
224
|
+
recording `wsl.exe` and reads back the argv: the distro, the Linux path,
|
|
225
|
+
and the stopper's pid); the workspace-prompt check had no WSL workspace in
|
|
226
|
+
its startup catalog (it now covers a WSL-only catalog, a reorder, and a
|
|
227
|
+
later addition).
|
|
228
|
+
- A check that returned early because the host could not run it printed
|
|
229
|
+
PASS. The script-style suites now defer through a shared `skip()`
|
|
230
|
+
(`test/skip.mjs`), print `SKIP` with the reason and count it in the
|
|
231
|
+
summary. On the Windows CI leg that is one agent check, two native-agent
|
|
232
|
+
checks, three watcher checks and seven provider checks that now say so.
|
|
233
|
+
The honest SKIP surfaced one more: the watcher's pipe-close check skipped
|
|
234
|
+
itself on every host with `inotify-tools`, although its file target never
|
|
235
|
+
starts inotify — it runs there now.
|
|
236
|
+
- **A large stdin payload no longer pays a fixed ~100 ms (#86).** A frame
|
|
237
|
+
above one Windows pipe buffer (64 KiB) written to the resident's stdin as
|
|
238
|
+
one `write()` cost about 100 ms before the resident had the rest of it.
|
|
239
|
+
Measured on the production path — Node on the Windows host, `wsl.exe`, the
|
|
240
|
+
native agent — a 68 KiB payload answered in 14 ms with the same binary
|
|
241
|
+
started directly inside the distro and in 114 ms through `wsl.exe`, and it
|
|
242
|
+
was the resident's `ACK` that came late: the frame, not the request, was
|
|
243
|
+
slow to arrive. Neither the piece size nor the reader is the cause; a timer
|
|
244
|
+
turn between pieces removes it. Since a timer turn costs about 10 ms on a
|
|
245
|
+
Windows host, frames between 64 KiB and half a mebibyte now go out in
|
|
246
|
+
60 KiB pieces with a turn between them and every other frame stays the
|
|
247
|
+
single write it was: time to result for a 64 / 96 / 128 / 256 KiB payload
|
|
248
|
+
went from 114 / 115 / 117 / 117 ms to 24 / 32 / 35 / 67 ms, with 512 KiB
|
|
249
|
+
and above unchanged (one write is the faster schedule there). Frames queue
|
|
250
|
+
behind a pieced one in order, and a rebuilt resident gets a fresh queue.
|
|
251
|
+
`test/probe/fs-queue.mjs` prints a `stdin write` row per payload size.
|
|
252
|
+
- **A check no longer rewrites the tree it checks (#89).** `lint:build` ran
|
|
253
|
+
the real build over `lib/` and restored it from a snapshot, so a check
|
|
254
|
+
killed midway — Ctrl-C, the watchdog — left the artifacts rewritten and any
|
|
255
|
+
new one behind. It now runs the same build script with `--outDir` into a
|
|
256
|
+
scratch directory and byte-compares what was emitted; nothing under `lib/`
|
|
257
|
+
is written (verified by comparing every file's mtime across a run). The
|
|
258
|
+
same review closed a few smaller gaps in the gates:
|
|
259
|
+
- `lint:links` reads every Markdown file at the package root; seven were
|
|
260
|
+
never scanned (CONTRIBUTING, SECURITY, SUPPORT and CODE_OF_CONDUCT in
|
|
261
|
+
both languages). It also reports a pairing exemption whose counterpart
|
|
262
|
+
has appeared since, and its one exemption — the requirements register —
|
|
263
|
+
states the real reason (it is Chinese-only by decision and does ship).
|
|
264
|
+
The stale copy of that exemption is gone from the style gate.
|
|
265
|
+
- `scripts/doctor.mjs` is named in the type gate's `include` instead of
|
|
266
|
+
reaching it only through a test's import.
|
|
267
|
+
- The doc-consistency scope no longer lists CONTRIBUTING.md twice (its
|
|
268
|
+
summary said 32 files for 31), and its peer-version rule reports the day
|
|
269
|
+
the peer floors stop being release candidates, when it would otherwise
|
|
270
|
+
match nothing and pass in silence.
|
|
271
|
+
- **Release and patrol scripts (#87 c, d).** The npm dist-tag now comes from
|
|
272
|
+
the script that already owns the tag/version rule:
|
|
273
|
+
`node scripts/check-release-tag.mjs --dist-tag` answers `next` for ANY
|
|
274
|
+
prerelease segment, where the workflow's list of four identifiers let a
|
|
275
|
+
version such as `0.30.0-preview.1` through to `latest`. The tag check also
|
|
276
|
+
refuses a version that is not `MAJOR.MINOR.PATCH` with an optional
|
|
277
|
+
`-prerelease`. The peer-canary's scratch install turns pnpm's release-age
|
|
278
|
+
window off (`--config.minimum-release-age=0`, as the release workflow's
|
|
279
|
+
install does), so a `next` line published inside the 24-hour window is no
|
|
280
|
+
longer refused and reported as a failed install; and it no longer re-runs
|
|
281
|
+
the composition boot test that `pnpm test` already includes. The publish
|
|
282
|
+
step's change is covered by the workflow-text assertions only — it has not
|
|
283
|
+
run on a release runner.
|
|
284
|
+
- **The doctor's per-distro probes go out as composed batches, and one stuck
|
|
285
|
+
probe settles inside the runner's budget (#85).** Every fact the doctor read
|
|
286
|
+
in a distro was its own `wsl.exe` — 15 spawns in the quick profile, 29 in a
|
|
287
|
+
full run — and each spawn's startup delay is the one cost concurrency cannot
|
|
288
|
+
remove. The pure reads now ride one composed `sh` script whose emitters each
|
|
289
|
+
print a `KEY=value` line (multiline readings ride base64), and the
|
|
290
|
+
systemd-class commands — `systemctl --user`, `loginctl`, the stale-scope
|
|
291
|
+
report — ride a small second batch with a `timeout` on each, so a wedged
|
|
292
|
+
user manager costs its own slice instead of the run. A quick run pays two
|
|
293
|
+
in-distro spawns and a full run about eight; the fix rechecks (scope sweep,
|
|
294
|
+
cache purge, bwrap install) keep their standalone probes. The new
|
|
295
|
+
`--probe-timeout <ms>` bounds one batch probe's deadline (the shared 60 s
|
|
296
|
+
default stands without it), and both in-app runners pass it with `2T + 2s`
|
|
297
|
+
strictly below their budget (the 2 s is the flake-retry settle), so a stuck
|
|
298
|
+
probe lands as the row's own `unknown` instead of vanishing under the outer
|
|
299
|
+
kill's generic timeout. The two `wsl.exe --list` spawns of the human-only
|
|
300
|
+
surveys no longer run for `--json`. The composed batch was verified against
|
|
301
|
+
a real distro: 19 facts in one spawn.
|
|
302
|
+
- **The doctor and sandbox suites run on Windows too (#89 d).** Both skipped
|
|
303
|
+
themselves whole on `win32` because their fake `wsl.exe` was a `#!/bin/sh`
|
|
304
|
+
script, and Windows cannot execute one — so the platform this plugin runs
|
|
305
|
+
on had no unit coverage of the doctor or the sandbox probe at all.
|
|
306
|
+
Windows resolves the real `System32\wsl.exe` before `PATH`, so no PATH
|
|
307
|
+
fake can shadow it; the fakes are Node scripts now, and the code under
|
|
308
|
+
test grew the one seam that makes that work: the doctor takes
|
|
309
|
+
`--wsl <script.mjs>` / `--cmd <script.mjs>` (a path ending in `.mjs` runs
|
|
310
|
+
under the current runtime), and the sandbox core treats a `.mjs` `wslPath`
|
|
311
|
+
the same way. No production path names a `.mjs`; a nonsensical value fails
|
|
312
|
+
closed at spawn. The doctor suite's two checks that would write the
|
|
313
|
+
runner's real git config through an unfaked `git.exe` defer with `skip()`
|
|
314
|
+
on Windows; everything else — the probe batches, the fault injections, the
|
|
315
|
+
spawn counts — runs there now.
|
|
316
|
+
- **The probe suite bounds each probe and cleans up after itself (#90).** The
|
|
317
|
+
four no-boot probes (agent, exec, substrate, watch) share
|
|
318
|
+
`test/probe/probe-env.sh` and `test/probe/check.mjs` now: the distro comes
|
|
319
|
+
from `DSH_WSL_ENV_DISTRO`, then `WSL_DISTRO_NAME`, and a host that names
|
|
320
|
+
neither is refused loudly instead of the embedded Node silently probing a
|
|
321
|
+
distro called "ubuntu"; the fnm PATH fallback and the `check()`/`Skip`
|
|
322
|
+
runner live in one copy. Every probe runs under its own deadline
|
|
323
|
+
(`DSH_WSL_ENV_PROBE_TIMEOUT`, default 900 s) and a timeout is its own
|
|
324
|
+
`FAIL <probe> (timeout …)` verdict — a wedged probe no longer holds the
|
|
325
|
+
suite with nothing on the terminal (the output goes to the detached log).
|
|
326
|
+
Probe scratch directories go through EXIT traps on every exit path, not
|
|
327
|
+
just the happy one; watch's cleanup covers every directory its counter
|
|
328
|
+
handed out (the fixed loop covered six of seven and left one behind per
|
|
329
|
+
run), and the doctor's home-writability probe removes its temp dir when
|
|
330
|
+
the batch is killed halfway. The bundle's `--redact` also replaces the
|
|
331
|
+
DISTRO user's home (it rides the identity row and is not the host's home
|
|
332
|
+
on a real Windows machine — the old split left the distro user name in
|
|
333
|
+
the attachable file). RELEASING.md now states what the launcher
|
|
334
|
+
really does: it closes ordinary Harness processes itself, announcing the
|
|
335
|
+
PIDs, and `--wait-only` keeps the manual-close workflow — it never merely
|
|
336
|
+
"waits until it exits".
|
|
337
|
+
- **The web client is under the type gate (#89 e, f).** `client.js` — the
|
|
338
|
+
plugin's 1 800-line browser entry, loaded through the harness's web-client
|
|
339
|
+
loader — was only syntax-checked. `tsc --noEmit` now covers it, and the
|
|
340
|
+
file is typed to zero errors with JSDoc: its wire and state shapes reuse
|
|
341
|
+
the built modules' exported types (`DistroStatusView`,
|
|
342
|
+
`PluginVersionView`, …), and the browser surface it touches is declared
|
|
343
|
+
locally — one `ClientPlatform` sample of `globalThis` — rather than by
|
|
344
|
+
adding a DOM lib, which would have let Node-side code use `document` too.
|
|
345
|
+
No runtime behavior changed; the browser e2e suite and the client's 25
|
|
346
|
+
unit checks pin that. The gate changes around it: the style gate now
|
|
347
|
+
requires every `test/*.test.mjs` on disk to be listed in both unit
|
|
348
|
+
scripts, the three byte-identical fake-resident `close()` copies share
|
|
349
|
+
`test/resident-close.mjs`, and the process-tree check polls for the clean
|
|
350
|
+
tree instead of sleeping a fixed 4.5 s.
|
|
351
|
+
|
|
352
|
+
### Verification
|
|
353
|
+
|
|
354
|
+
- `pnpm test`, `pnpm run test:coverage`, `pnpm run test:browser` and
|
|
355
|
+
`pnpm run e2e:install` passed (2026-11-25); the e2e leg upgraded the newest
|
|
356
|
+
published stable (0.29.0) to this version and booted it with all three
|
|
357
|
+
takeovers served by this plugin. The closed-app real-machine probe suite was
|
|
358
|
+
not run while preparing this release; the tag's candidate and post-release
|
|
359
|
+
gates produce their own official-package evidence.
|
|
360
|
+
|
|
361
|
+
## [0.29.0] - 2026-11-23
|
|
362
|
+
|
|
363
|
+
WSL panel release: diagnosis and repair are separate actions, with clearer
|
|
364
|
+
progress feedback and accessible controls.
|
|
365
|
+
|
|
366
|
+
### Changed
|
|
367
|
+
|
|
368
|
+
- **Full diagnosis is read-only.** Repairing plugin-owned state now requires a
|
|
369
|
+
separate explicit action, followed by verification; it does not install
|
|
370
|
+
packages or rewrite Windows configuration.
|
|
371
|
+
- **The WSL panel is more concise and accessible.** Detailed guidance starts
|
|
372
|
+
collapsed, and checks/repairs state the current action and possible distro
|
|
373
|
+
startup without inventing progress or elapsed-time estimates. Controls work
|
|
374
|
+
with the keyboard, and status/error updates expose screen-reader semantics.
|
|
375
|
+
- **Release workflow hardening.** The workflow default permission is now
|
|
376
|
+
`contents: read`; only the publish job holds `contents: write` and
|
|
377
|
+
`id-token: write`. The `upload-artifact` and `download-artifact` actions are
|
|
378
|
+
pinned to commit SHAs like the other actions. No plugin runtime behavior
|
|
379
|
+
changed.
|
|
380
|
+
|
|
381
|
+
### Verification
|
|
382
|
+
|
|
383
|
+
- `pnpm test`, `pnpm run test:coverage`, and `pnpm run test:browser` passed.
|
|
384
|
+
The Windows/WSL real-machine probe suite was not run in this Linux
|
|
385
|
+
environment, which has no WSL or Harness installation.
|
|
386
|
+
|
|
19
387
|
## [0.28.0] - 2026-11-22
|
|
20
388
|
|
|
21
389
|
Release-evidence release: the official-package smoke gates publication and
|
package/CONTRIBUTING.md
CHANGED
|
@@ -118,10 +118,13 @@ Rules that keep this honest:
|
|
|
118
118
|
every module.
|
|
119
119
|
- `lint:build` (`test/build-freshness.mjs`) enforces that the corpus is closed
|
|
120
120
|
— every `lib/*.js` has its `src/<name>.ts`, every source has both artifacts —
|
|
121
|
-
then
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
then runs the same build script (`scripts/build.mjs --outDir <scratch>`) so
|
|
122
|
+
the same program emits into a scratch directory, and byte-compares what it
|
|
123
|
+
emitted with what is committed. The check never writes under `lib/`: a
|
|
124
|
+
check, not a rebuild — an earlier version rebuilt the tree and restored from
|
|
125
|
+
a snapshot, and one killed midway left the artifacts rewritten. The remedy
|
|
126
|
+
for drift is `pnpm run build` plus a commit. It is part of the gate chain
|
|
127
|
+
after `test:syntax`.
|
|
125
128
|
- Generated files are not in the `checkJs` gate at all (`tsconfig.json` covers
|
|
126
129
|
`test/**` and the ambient types); their sources are type-checked by the build
|
|
127
130
|
program with `noEmitOnError`, so a broken build never overwrites `lib/`.
|
|
@@ -156,6 +159,36 @@ Rules that keep this honest:
|
|
|
156
159
|
`locale/**/*.json`, and `lint:style` fails an `exports` target that does not
|
|
157
160
|
exist.
|
|
158
161
|
|
|
162
|
+
## Keeping the preset copy in step (`preset-wsl`)
|
|
163
|
+
|
|
164
|
+
`cordis.patch.yml`'s `preset-wsl` is a derived copy of the app's own standard
|
|
165
|
+
preset (`packages/bundle/web-app/presets/standard.patch.yml`): the standard
|
|
166
|
+
mode's rows, mounted on the distro's shell and filesystem. A row the app adds
|
|
167
|
+
to its own preset is missing from every WSL session until the copy is
|
|
168
|
+
regenerated, and the pinned dependency tree ships no preset to compare against
|
|
169
|
+
— which is how the rc.2 line's office tool, bundled skill root and subagent
|
|
170
|
+
switch went missing for a whole release line.
|
|
171
|
+
|
|
172
|
+
`pnpm run preset:sync` (`scripts/preset-sync.mjs`) pins the copy to one
|
|
173
|
+
reproducible line. `test/fixtures/standard.patch.dsh-<version>.yml` is the
|
|
174
|
+
upstream file of the line the dev pins name; the script parses both files with
|
|
175
|
+
the include's own `!!js` dialect, passes the upstream rows through exactly the
|
|
176
|
+
changes the copy documents (the plugin's own rows, the fixed shell-tool
|
|
177
|
+
choice), and compares row by row, in order, nested groups included. `pnpm
|
|
178
|
+
test` runs the same check. The snapshot's name must equal the exact version
|
|
179
|
+
`devDependencies` pins `@deepseek-ai/dsh-fs` at, so raising the pins without
|
|
180
|
+
refreshing it fails the check; `--upstream <file>` takes any preset from a
|
|
181
|
+
harness source tree, to preview the differences before the pins move.
|
|
182
|
+
|
|
183
|
+
To follow a newer line:
|
|
184
|
+
|
|
185
|
+
1. Replace the snapshot with the new tag's `standard.patch.yml`: in a harness
|
|
186
|
+
source tree, `git show <tag>:packages/bundle/web-app/presets/standard.patch.yml`;
|
|
187
|
+
the published `@deepseek-ai/dsh-web-app` tarball carries the same file.
|
|
188
|
+
2. Run `pnpm run preset:sync` to see what moved upstream.
|
|
189
|
+
3. Regenerate the row as the comment above `preset-wsl` describes.
|
|
190
|
+
4. Raise the pins in the same commit.
|
|
191
|
+
|
|
159
192
|
## The development loop
|
|
160
193
|
|
|
161
194
|
1. Clone the repository inside the distro. Most contributors develop there.
|
|
@@ -195,6 +228,7 @@ terminal if you would rather not see the prompt.
|
|
|
195
228
|
| `pnpm run lint:style` | style and lint rules | no |
|
|
196
229
|
| `pnpm run lint:build` | the build-freshness check: every source has its artifacts and the committed bytes match a real build | no |
|
|
197
230
|
| `pnpm run lint:types` | the TypeScript check over `test/**` and the ambient types (`tsc --noEmit`) | no |
|
|
231
|
+
| `pnpm run preset:sync` | `preset-wsl` against the snapshot of the pinned line's standard preset, row by row; `pnpm test` runs the same check | no |
|
|
198
232
|
| `pnpm run e2e:install` | packed-tarball install/upgrade/uninstall into a temporary `DSH_HOME`; the newest published → current leg boots the profile with an overlay probe and asserts the three takeovers mount | yes; Windows + WSL |
|
|
199
233
|
| `pnpm run doctor` | the environment prerequisites, peers and caches (`--json` for scripts; `diagnose` is the read-only alias) | no; inside the distro |
|
|
200
234
|
| `pnpm run probe` | filesystem behaviour against a real distro | yes |
|
|
@@ -229,9 +263,11 @@ there because the plugin targets Windows; the coverage thresholds need Node 22.8
|
|
|
229
263
|
newer, which is why that job runs on one version.
|
|
230
264
|
|
|
231
265
|
`.github/workflows/cloud-wsl-gate.yml` adds an independent hosted DeepSeek
|
|
232
|
-
Harness Desktop and WSL gate. On pushes and pull requests targeting `main`
|
|
233
|
-
|
|
234
|
-
|
|
266
|
+
Harness Desktop and WSL gate. On pushes and pull requests targeting `main` that
|
|
267
|
+
touch the plugin sources, composition, probes or that workflow (and on manual
|
|
268
|
+
`workflow_dispatch`), it builds the unsigned Windows Desktop package from the
|
|
269
|
+
upstream tag on `windows-latest` — cached by pinned tag and workflow recipe —
|
|
270
|
+
provisions Ubuntu 24.04 through `.github/actions/provision-wsl`, uses
|
|
235
271
|
the desktop app's bundled CLI to create a `wsl` profile, installs the local
|
|
236
272
|
checkout into that profile, verifies the composed dump contains
|
|
237
273
|
`dsh-plugin-wsl-env`, launches the desktop app's configured Web service and waits
|
|
@@ -302,13 +338,18 @@ in `package.json` name their files explicitly; a test that only touches this
|
|
|
302
338
|
repository belongs in both. Keep the lists synchronized without duplicate entries.
|
|
303
339
|
|
|
304
340
|
Both scripts run their list under `scripts/test-watchdog.mjs`, which bounds the
|
|
305
|
-
whole run at
|
|
341
|
+
whole run at 300 s (`DSH_TEST_WATCHDOG_MS` overrides). `node --test` has no
|
|
306
342
|
per-file deadline, so a script-style file that leaves a handle alive behind an
|
|
307
343
|
unsettled top-level await would otherwise hang the gate until the caller kills
|
|
308
344
|
it; at the deadline the wrapper interrupts the run and node's "Interrupted while
|
|
309
345
|
running" list names the file that never finished. The scripts also pass
|
|
310
|
-
`--test-timeout=
|
|
311
|
-
the watchdog is what covers a hang at module evaluation
|
|
346
|
+
`--test-timeout=240000`. On Node 24 it bounds only tests a file registers
|
|
347
|
+
with `test()`, and the watchdog is what covers a hang at module evaluation;
|
|
348
|
+
Node 22 also counts a script-style file's top-level evaluation against it,
|
|
349
|
+
so it has to exceed the slowest file — the doctor suite, which starts
|
|
350
|
+
dozens of fake processes per run on two platforms now and waits out the
|
|
351
|
+
real delays of flake
|
|
352
|
+
retries, takes about a minute.
|
|
312
353
|
|
|
313
354
|
`test:coverage` runs that list through `scripts/coverage-gate.mjs` as well.
|
|
314
355
|
Node's coverage is load-based — a module no test imports has no row, so the
|
|
@@ -332,8 +373,23 @@ contract, which leaves only the one-line peer binding in `lib/sandbox.js`. That
|
|
|
332
373
|
line is covered by the harness probes, which boot the plugin and so reach
|
|
333
374
|
`WslSandbox` through `lib/index.js` — not by `probe:sandbox`, which reads only
|
|
334
375
|
the argument builder out of `lib/bwrap.js`. A test that cannot run everywhere
|
|
335
|
-
must skip itself — print a `SKIP` line and exit 0
|
|
336
|
-
|
|
376
|
+
must skip itself — print a `SKIP` line and exit 0. When the blocker is only
|
|
377
|
+
the fake's shape, prefer making the fake portable instead: the sandbox and
|
|
378
|
+
doctor suites drive the code under test through Node-script fakes riding the
|
|
379
|
+
`.mjs` seam (`--wsl <script.mjs>` / `--cmd <script.mjs>` for the doctor),
|
|
380
|
+
because Windows resolves the real `System32` binaries before `PATH` and a
|
|
381
|
+
`#!` script cannot shadow them.
|
|
382
|
+
|
|
383
|
+
One check inside a script-style suite defers through `test/skip.mjs`: when its
|
|
384
|
+
body finds this host cannot run it, it calls `skip("<reason>")` — which throws,
|
|
385
|
+
so nothing after it executes — and the shared `runCheck` prints a `SKIP` line
|
|
386
|
+
with the reason, while the summary (`summaryLine` / `skipNote`) says
|
|
387
|
+
`(N skipped: <reason>)`. Do not return early instead: a runner prints PASS
|
|
388
|
+
once the body returns, so such a check reads green in the log while it never
|
|
389
|
+
ran — as the only unit test of the host's real cancel path did on the Windows
|
|
390
|
+
CI leg. Give a skip its specific reason, and when one leaves a behaviour
|
|
391
|
+
without a unit test on every host, first ask whether the check can be made to
|
|
392
|
+
run everywhere (a file target instead of an inotify directory watch, say).
|
|
337
393
|
|
|
338
394
|
### Browser E2E
|
|
339
395
|
|
package/CONTRIBUTING.zh.md
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
让这一点保持诚实的规则:
|
|
49
49
|
|
|
50
50
|
- 绝不要编辑 `lib/` 下的生成文件——其模块文档会指明应编辑的源码,两者一旦偏移,`lint:build` 就会失败。生成产物保持 tsc 的规范格式(四空格缩进、紧凑格式);审查每个模块时看 `src/`。
|
|
51
|
-
- `lint:build`(`test/build-freshness.mjs`)强制文件集合闭合——每个 `lib/*.js` 都有对应的 `src/<name>.ts
|
|
51
|
+
- `lint:build`(`test/build-freshness.mjs`)强制文件集合闭合——每个 `lib/*.js` 都有对应的 `src/<name>.ts`,每个源码都有两个产物——然后用同一个构建脚本(`scripts/build.mjs --outDir <临时目录>`)把同一份程序构建到临时目录,与提交的产物逐字节比较。检查从不写入 `lib/`:这是一次检查,不是重建;偏移的补救办法是 `pnpm run build` 加一次提交。它位于 `test:syntax` 之后的检查链中。
|
|
52
52
|
- 生成文件完全不进入 `checkJs` 检查(`tsconfig.json` 覆盖 `test/**` 和环境类型声明);它们的源码由构建程序以 `noEmitOnError` 做类型检查,因此损坏的构建永远不会覆盖 `lib/`。
|
|
53
53
|
- 每个 JavaScript 导出都带有 `types` 条件(由 `lint:style` 强制),因此下游能解析这些声明;不存在第二套手写类型表面。
|
|
54
54
|
- 协议消息联合体及相关类型现在是唯一的定义处:使用方直接 import 它们(`@typedef {import("./agent-protocol.js").AgentMessage} AgentMessage`),而不是重新声明;`lib/agent.js` 和脚本驱动的测试就是这样读取它们。
|
|
@@ -59,6 +59,33 @@
|
|
|
59
59
|
2. 运行 `pnpm run build`,再运行 `pnpm test`。无需维护排除列表,也没有注册步骤:构建和 `lint:build` 从 `src/` 推导一切,`lib/` 是生成输出——绝不要手工编辑。
|
|
60
60
|
3. 如果模块在 Plugins 页面拥有自己的一行,把它的显示元数据添加为 `locale/<name>/en.json` 和 `locale/<name>/zh.json`——各含一对 `meta.title` / `meta.description`——并通过 `exports` 暴露两者(`./<name>/locale/en.json`、`./<name>/locale/zh.json`),该页面会先读取它们,再回退到包的 `description`。bundle 自己的那一对是 `locale/en.json` / `locale/zh.json`,`subprocess`、`picker`、`shell-env` 和 `auto-preset` 各自带有自己的那一对。有一组运行时 catalog 不是 `exports` 条目:`locale/doctor/*.json` 为独立 CLI 的固定骨架提供本地化,由脚本自身从包根目录读取。`files` 已随包发布 `locale/**/*.json`,而 `lint:style` 会让不存在的 `exports` 目标失败。
|
|
61
61
|
|
|
62
|
+
## 预设副本的同步(`preset-wsl`)
|
|
63
|
+
|
|
64
|
+
`cordis.patch.yml` 的 `preset-wsl` 是应用自带标准 preset
|
|
65
|
+
(`packages/bundle/web-app/presets/standard.patch.yml`)的派生副本:标准模式
|
|
66
|
+
的各行挂到发行版的 shell 和文件系统上。应用给自己的 preset 加一行,WSL
|
|
67
|
+
会话就缺一行,直到副本重新生成;而 pinned 依赖树里并没有这份 preset 可供
|
|
68
|
+
比对,rc.2 新增的 office 工具、内置 skill 根和 subagent 开关因此漏了整条
|
|
69
|
+
版本线。
|
|
70
|
+
|
|
71
|
+
`pnpm run preset:sync`(`scripts/preset-sync.mjs`)把副本钉在一条可复现的
|
|
72
|
+
版本线上。`test/fixtures/standard.patch.dsh-<版本>.yml` 是 dev pin 所指
|
|
73
|
+
版本的那份上游文件;脚本用 include 自带的 `!!js` 方言解析两份文件,让上游
|
|
74
|
+
各行经过副本注明的那几处改动(本插件自己的行、固定的 shell 工具选择),
|
|
75
|
+
再逐行、按顺序比对,嵌套组一并比对。`pnpm test` 运行的是同一份检查。快照
|
|
76
|
+
的文件名必须等于 `devDependencies` 里 `@deepseek-ai/dsh-fs` 的精确版本,
|
|
77
|
+
所以只抬高 pin、不换快照会让检查失败;`--upstream <文件>` 可以指定 harness
|
|
78
|
+
源码树里的任意一份 preset,在 pin 移动之前预览差异。
|
|
79
|
+
|
|
80
|
+
跟随新版本线的步骤:
|
|
81
|
+
|
|
82
|
+
1. 用新 tag 的 `standard.patch.yml` 替换快照:harness 源码树里是
|
|
83
|
+
`git show <tag>:packages/bundle/web-app/presets/standard.patch.yml`;发布包
|
|
84
|
+
`@deepseek-ai/dsh-web-app` 的 tarball 里带着同一份文件。
|
|
85
|
+
2. 运行 `pnpm run preset:sync`,看上游改了什么。
|
|
86
|
+
3. 按 `preset-wsl` 行上方的注释重新生成该行。
|
|
87
|
+
4. 在同一提交里抬高 pin。
|
|
88
|
+
|
|
62
89
|
## 开发循环
|
|
63
90
|
|
|
64
91
|
1. 在发行版内克隆仓库。多数贡献者在那里开发。
|
|
@@ -89,6 +116,7 @@ pnpm run sync:windows
|
|
|
89
116
|
| `pnpm run lint:style` | 风格与 lint 规则 | 否 |
|
|
90
117
|
| `pnpm run lint:build` | 构建新鲜度检查:每个源码都有产物,且提交的字节匹配真实构建 | 否 |
|
|
91
118
|
| `pnpm run lint:types` | 对 `test/**` 和环境类型声明的 TypeScript 检查(`tsc --noEmit`) | 否 |
|
|
119
|
+
| `pnpm run preset:sync` | `preset-wsl` 与 pinned 版本的标准 preset 快照逐行比对;`pnpm test` 内含同一检查 | 否 |
|
|
92
120
|
| `pnpm run e2e:install` | 在临时 `DSH_HOME` 中安装/升级/卸载打包 tarball;“最新已发布版 → 当前版本”leg 会用 overlay 探针启动 profile,断言三个接管实际挂载 | 是;Windows + WSL |
|
|
93
121
|
| `pnpm run doctor` | 环境前置项、peer 和缓存(脚本使用 `--json`;`diagnose` 是只读别名) | 否;在发行版内 |
|
|
94
122
|
| `pnpm run probe` | 针对真实发行版的文件系统行为 | 是 |
|
|
@@ -114,7 +142,7 @@ pnpm run sync:windows
|
|
|
114
142
|
|
|
115
143
|
CI 在 `ubuntu-latest` 和 `windows-latest` 上,用 Node 22 和 24 运行 `pnpm test`;在 Node 24 上运行 `pnpm run test:coverage`,并在安装 Chromium 后于一个 Ubuntu runner 上运行 `pnpm run test:browser`。Windows runner 的存在是因为插件面向 Windows;覆盖率门槛需要 Node 22.8 或更新版本,因此该任务只在一个版本上运行。
|
|
116
144
|
|
|
117
|
-
`.github/workflows/cloud-wsl-gate.yml` 增加了一道托管 DeepSeek Harness 桌面版与 WSL
|
|
145
|
+
`.github/workflows/cloud-wsl-gate.yml` 增加了一道托管 DeepSeek Harness 桌面版与 WSL 门禁。它在目标为 `main`、且改动触及插件源码、组合、探针或该 workflow 的 push/pull request(以及手动 `workflow_dispatch`)时,在 `windows-latest` 上从 upstream tag 构建 unsigned Windows Desktop——构建产物按固定 tag 与 workflow 配方缓存——经 `.github/actions/provision-wsl` 安装 Ubuntu 24.04、第二个 Ubuntu probe 实例、Node 24、systemd 与 `bubblewrap`,通过桌面 app 自带 CLI 创建 `wsl` profile、向 profile 安装当前检出的本地插件并核对组合配置,启动桌面应用的配置化 Web 服务并等待 HTTP 可访问,验证发行版内的 bwrap 工作区围栏,准备 `wslfs` probe profile 后在应用退出时运行 `test/probe/run-all-when-closed.sh --include-fs`。只有每项 probe 都报告 PASS 且没有 SKIP 或 NOT RUN 时,托管门禁才算通过。
|
|
118
146
|
|
|
119
147
|
当前闭合套件共有 19 项:`run.sh`、`terminal.sh`、`mode.sh`、
|
|
120
148
|
`missing-wsl.sh`、`sandbox.sh`、`cache-write.sh`、`sandbox-shell.sh`、
|
|
@@ -149,13 +177,15 @@ Windows+WSL runner,请使用 `self-hosted-wsl` 等无歧义标签,不要复
|
|
|
149
177
|
|
|
150
178
|
单元测试在 `node --test` 下运行。`package.json` 中的 `test:unit` 和 `test:coverage` 列表显式列出各自的文件;只涉及本仓库的测试应同时出现在两者中。保持两个列表同步且没有重复条目。
|
|
151
179
|
|
|
152
|
-
两个脚本都在 `scripts/test-watchdog.mjs` 下运行各自的列表,该 watchdog 把整次运行限制在
|
|
180
|
+
两个脚本都在 `scripts/test-watchdog.mjs` 下运行各自的列表,该 watchdog 把整次运行限制在 300 秒内(可用 `DSH_TEST_WATCHDOG_MS` 覆盖)。`node --test` 没有逐文件截止时间,因此一个脚本式文件如果在尚未完成的顶层 await 背后留下活动句柄,就会让检查挂起,直到调用方杀掉它;到达截止时间时,包装器会中断运行,node 的 “Interrupted while running” 列表会指出从未完成的文件。脚本还会传入 `--test-timeout=240000`。在 Node 24 上它只限制文件用 `test()` 注册的测试,模块求值阶段的挂起由 watchdog 覆盖;Node 22 还把脚本式文件的顶层求值整个计入这个时限,所以它必须高于最慢的文件——doctor 套件每次运行要起几十个假进程(两个平台都跑),还要等完抖动重试的真实延迟。
|
|
153
181
|
|
|
154
182
|
`test:coverage` 还会通过 `scripts/coverage-gate.mjs` 运行该列表。Node 的覆盖率基于加载——没有测试 import 的模块不会有一行记录,因此全局百分比会静默地只衡量一个子集——所以该检查要求每个 `lib/*.js` 都被测量,或在 `test/coverage-allowlist.json` 中列出并说明为何无法被受检查的测试套件加载;每个被测量的模块都要满足 85 行 / 70 分支 / 60 函数的下限。没有测试的新模块会让检查失败,已不存在模块的允许列表条目同样如此。新增测试是首选修复;允许列表让其余仅由探针覆盖的行保持可见,而不是让它们从分母中消失。
|
|
155
183
|
|
|
156
184
|
import 固定版本 `@deepseek-ai/*` 包的测试也进入同样的列表,无需额外防护——CI 在 `pnpm test` 之前对锁定树运行 `pnpm install --frozen-lockfile`。例如,`test/provider.test.mjs` 覆盖装配后的服务行,`test/composition.test.mjs` 运行 loader 的真实 patch 算法。
|
|
157
185
|
|
|
158
|
-
凡是存在无 peer 的接缝,优先使用它。`test/sandbox.test.mjs` 针对 `lib/sandbox-core.js` 运行,并用一个替身代替 peer 的 `SandboxUnavailableError` 契约,这样 `lib/sandbox.js` 中只剩一行 peer 绑定。那一行由 harness 探针覆盖——它们启动插件,从而通过 `lib/index.js` 到达 `WslSandbox`——而不是由 `probe:sandbox` 覆盖,后者只从 `lib/bwrap.js` 读取参数构建器。无法在所有环境运行的测试必须自行跳过——打印一行 `SKIP` 并以 0
|
|
186
|
+
凡是存在无 peer 的接缝,优先使用它。`test/sandbox.test.mjs` 针对 `lib/sandbox-core.js` 运行,并用一个替身代替 peer 的 `SandboxUnavailableError` 契约,这样 `lib/sandbox.js` 中只剩一行 peer 绑定。那一行由 harness 探针覆盖——它们启动插件,从而通过 `lib/index.js` 到达 `WslSandbox`——而不是由 `probe:sandbox` 覆盖,后者只从 `lib/bwrap.js` 读取参数构建器。无法在所有环境运行的测试必须自行跳过——打印一行 `SKIP` 并以 0 退出。当障碍只是假件的形态时,优先把假件改成可移植的:sandbox 与 doctor 两套测试经 `.mjs` 接缝用 Node 脚本假件驱动被测代码(doctor 是 `--wsl <脚本.mjs>` / `--cmd <脚本.mjs>`),因为 Windows 解析真实的 `System32` 二进制先于 `PATH`,`#!` 脚本无法遮蔽它们。
|
|
187
|
+
|
|
188
|
+
脚本式套件里的单条检查经 `test/skip.mjs` 延后:检查体确认本机跑不了时调用 `skip("<原因>")`(它会抛出,其后的代码不再执行),由共享的 `runCheck` 打印带原因的 `SKIP` 行,汇总行(`summaryLine` / `skipNote`)写出 `(N skipped: <原因>)`。不要用提前 `return` 代替——runner 在函数返回后打印 PASS,这样的检查在日志里是绿的,实际从未运行;Windows CI 上宿主真实 cancel 路径的唯一单测曾长期如此。跳过要带具体原因:一次跳过若让某条行为在所有环境都没有单测,应先问这条检查能否改成在所有环境运行(例如把 inotify 目录监听换成文件目标)。
|
|
159
189
|
|
|
160
190
|
### 浏览器 E2E
|
|
161
191
|
|
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ The full argument (why Linux rather than PowerShell, value and costs) is in [doc
|
|
|
31
31
|
|
|
32
32
|
The desktop app has no `dsh` executable; the plugin installs through the in-app Plugins page. Three steps:
|
|
33
33
|
|
|
34
|
-
1. `wsl.exe -d <distro> -u root -- apt-get install -y bubblewrap`
|
|
34
|
+
1. `wsl.exe -d <distro> -u root -- sh -c "apt-get update -qq && apt-get install -y --no-install-recommends bubblewrap"`
|
|
35
35
|
2. Plugins page: **Add plugin** → `dsh-plugin-wsl-env`, enable it.
|
|
36
36
|
3. Restart the app, open a folder inside the distro; type `/wsl-doctor` (host-side) for a `ready`/`blocked` verdict.
|
|
37
37
|
|
|
Binary file
|
|
Binary file
|