dsh-plugin-wsl-env 0.26.0 → 0.26.2
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 +137 -0
- package/README.md +55 -158
- package/SUPPORT.md +2 -2
- package/SUPPORT.zh.md +2 -2
- package/docs/ARCHITECTURE.md +21 -5
- package/docs/ARCHITECTURE.zh.md +17 -4
- package/docs/CONFIGURATION.md +7 -9
- package/docs/CONFIGURATION.zh.md +6 -7
- package/docs/DIAGNOSTICS.md +21 -0
- package/docs/DIAGNOSTICS.zh.md +15 -0
- package/docs/LIMITATIONS.md +13 -1
- package/docs/LIMITATIONS.zh.md +12 -2
- package/docs/MIGRATION.md +4 -1
- package/docs/MIGRATION.zh.md +4 -1
- package/docs/PEER-PARITY.md +16 -0
- package/docs/QUICKSTART.md +22 -15
- package/docs/QUICKSTART.zh.md +19 -16
- package/docs/README.zh.md +59 -146
- package/docs/RELEASING.md +2 -2
- package/docs/REQUIREMENTS.zh.md +2 -2
- package/docs/ROADMAP-1.0.md +1 -1
- package/docs/VALUE.md +27 -0
- package/docs/VALUE.zh.md +27 -0
- package/docs/screenshots/with-plugin.png +0 -0
- package/docs/screenshots/with-plugin.svg +59 -0
- package/docs/screenshots/with-plugin.zh.png +0 -0
- package/docs/screenshots/with-plugin.zh.svg +56 -0
- package/docs/screenshots/without-plugin.png +0 -0
- package/docs/screenshots/without-plugin.svg +50 -0
- package/docs/screenshots/without-plugin.zh.png +0 -0
- package/docs/screenshots/without-plugin.zh.svg +45 -0
- package/lib/doctor-report.js +8 -1
- package/lib/git-exec.d.ts +39 -7
- package/lib/git-exec.js +151 -18
- package/lib/listing.d.ts +17 -0
- package/lib/listing.js +20 -0
- package/lib/messages.d.ts +27 -0
- package/lib/messages.js +26 -2
- package/lib/peer-versions.d.ts +53 -0
- package/lib/peer-versions.js +137 -0
- package/lib/picker.js +33 -19
- package/lib/search-exec.d.ts +45 -9
- package/lib/search-exec.js +152 -20
- package/lib/subprocess.d.ts +4 -1
- package/lib/subprocess.js +16 -3
- package/lib/update-check.d.ts +2 -2
- package/lib/update-check.js +2 -2
- package/lib/wsl-doctor-command.js +2 -1
- package/lib/wsl.d.ts +21 -0
- package/lib/wsl.js +24 -0
- package/package.json +9 -2
- package/scripts/doctor.mjs +148 -22
package/lib/search-exec.d.ts
CHANGED
|
@@ -10,15 +10,45 @@
|
|
|
10
10
|
*
|
|
11
11
|
* The agent being out is not an error condition here — it is the fallback
|
|
12
12
|
* cue. `spawnFallback` (the shipped one-shot handle the caller builds) is
|
|
13
|
-
* consulted lazily inside `done
|
|
14
|
-
*
|
|
15
|
-
* the
|
|
13
|
+
* consulted lazily inside `done`. Cancellation shares one channel: the
|
|
14
|
+
* caller's `signal` and `kill()` abort the agent exec, which settles `done`
|
|
15
|
+
* as killed (`{exitCode: null, signal: "SIGTERM"}`) — the same shape the
|
|
16
|
+
* one-shot path reports for a killed search.
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* ## Failure surfacing: the tool must read rg's own failure, not a provider blow-up
|
|
19
|
+
*
|
|
20
|
+
* rg's exit codes are a contract the tool reads: `1` is "no matches", `2` is
|
|
21
|
+
* "rg itself failed", and anything else is a provider-class failure. A distro
|
|
22
|
+
* without ripgrep is the common, actionable failure — `docs/LIMITATIONS.md`
|
|
23
|
+
* promises it surfaces as exit 127 with the bootstrap remedy — so this module
|
|
24
|
+
* turns the agent's two local failures into that shape instead of rejecting
|
|
25
|
+
* `done` (which the tool renders as an opaque "ripgrep provider failure", with
|
|
26
|
+
* no program name and no remedy):
|
|
27
|
+
*
|
|
28
|
+
* - A `SpawnError` means the agent could not start the program. The native
|
|
29
|
+
* agent reports both a missing executable and a missing working directory
|
|
30
|
+
* that way, without naming either, so the synthesized message names both
|
|
31
|
+
* possibilities and the install remedy; the exit code is 127.
|
|
32
|
+
* - A `CwdError` names the directory that could not be entered. It is
|
|
33
|
+
* synthesized as rg's own error exit code (`2`) with relay-shaped text —
|
|
34
|
+
* never `1`, which the tool would read as "no matches" and report as an
|
|
35
|
+
* empty success.
|
|
36
|
+
*
|
|
37
|
+
* Neither failure falls back to the one-shot path. A missing program would
|
|
38
|
+
* only produce the relay's `execvpe(rg) failed` at exit `1` (again the
|
|
39
|
+
* "no matches" dialect), and a missing directory is worse: `wsl.exe --cd`
|
|
40
|
+
* does not fail on it — it warns, runs the command in `/`, and exits 0. The
|
|
41
|
+
* shell executor can afford the one-shot retry because it decorates the
|
|
42
|
+
* result with its workdir verdict; this handle has no such decoration point.
|
|
43
|
+
* Everything else — a genuine agent failure that is not `AgentUnavailableError`
|
|
44
|
+
* — still propagates through `done` as a rejection.
|
|
45
|
+
*
|
|
46
|
+
* The one-shot delegate is post-processed the same way, because the agent
|
|
47
|
+
* being out must not change what a broken environment looks like: a missing
|
|
48
|
+
* program's `execvpe(rg) failed` line (exit 1) becomes the same 127, and the
|
|
49
|
+
* relay's `chdir(...) failed` warning — which `wsl.exe` writes while it runs
|
|
50
|
+
* the search in `/` and exits 0/1 — becomes the same explicit directory
|
|
51
|
+
* failure instead of a silent wrong-directory result.
|
|
22
52
|
*
|
|
23
53
|
* Pure shaping over injected collaborators, so the handle semantics are
|
|
24
54
|
* unit-testable without a distro.
|
|
@@ -70,7 +100,7 @@ export interface SearchExecutionHandle {
|
|
|
70
100
|
* @param object - the handle's collaborators.
|
|
71
101
|
* @returns the search handle (`done`, `collected`, `kill`).
|
|
72
102
|
*/
|
|
73
|
-
export declare function searchExecutionHandle({ agent, cwd, argv, maxOutputBytes, signal, spawnFallback }: {
|
|
103
|
+
export declare function searchExecutionHandle({ agent, cwd, argv, distro, maxOutputBytes, signal, spawnFallback }: {
|
|
74
104
|
/**
|
|
75
105
|
* The {@link WslAgent}-like runner: `exec` accepting
|
|
76
106
|
* `{cwd, argv, maxOutputBytes, signal}` and resolving
|
|
@@ -81,6 +111,12 @@ export declare function searchExecutionHandle({ agent, cwd, argv, maxOutputBytes
|
|
|
81
111
|
cwd: string;
|
|
82
112
|
/** The distro-side argv (`rg` and its arguments). */
|
|
83
113
|
argv: string[];
|
|
114
|
+
/**
|
|
115
|
+
* The distro name, for the failures' remedies and the relay
|
|
116
|
+
* post-processing. The synthesized text names the distro so the model can
|
|
117
|
+
* relay an install command without another probe.
|
|
118
|
+
*/
|
|
119
|
+
distro: string;
|
|
84
120
|
/**
|
|
85
121
|
* Per-stream capture ceiling the agent enforces; the tool's own raw-output
|
|
86
122
|
* budget rides here.
|
package/lib/search-exec.js
CHANGED
|
@@ -10,15 +10,45 @@
|
|
|
10
10
|
*
|
|
11
11
|
* The agent being out is not an error condition here — it is the fallback
|
|
12
12
|
* cue. `spawnFallback` (the shipped one-shot handle the caller builds) is
|
|
13
|
-
* consulted lazily inside `done
|
|
14
|
-
*
|
|
15
|
-
* the
|
|
13
|
+
* consulted lazily inside `done`. Cancellation shares one channel: the
|
|
14
|
+
* caller's `signal` and `kill()` abort the agent exec, which settles `done`
|
|
15
|
+
* as killed (`{exitCode: null, signal: "SIGTERM"}`) — the same shape the
|
|
16
|
+
* one-shot path reports for a killed search.
|
|
16
17
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* ## Failure surfacing: the tool must read rg's own failure, not a provider blow-up
|
|
19
|
+
*
|
|
20
|
+
* rg's exit codes are a contract the tool reads: `1` is "no matches", `2` is
|
|
21
|
+
* "rg itself failed", and anything else is a provider-class failure. A distro
|
|
22
|
+
* without ripgrep is the common, actionable failure — `docs/LIMITATIONS.md`
|
|
23
|
+
* promises it surfaces as exit 127 with the bootstrap remedy — so this module
|
|
24
|
+
* turns the agent's two local failures into that shape instead of rejecting
|
|
25
|
+
* `done` (which the tool renders as an opaque "ripgrep provider failure", with
|
|
26
|
+
* no program name and no remedy):
|
|
27
|
+
*
|
|
28
|
+
* - A `SpawnError` means the agent could not start the program. The native
|
|
29
|
+
* agent reports both a missing executable and a missing working directory
|
|
30
|
+
* that way, without naming either, so the synthesized message names both
|
|
31
|
+
* possibilities and the install remedy; the exit code is 127.
|
|
32
|
+
* - A `CwdError` names the directory that could not be entered. It is
|
|
33
|
+
* synthesized as rg's own error exit code (`2`) with relay-shaped text —
|
|
34
|
+
* never `1`, which the tool would read as "no matches" and report as an
|
|
35
|
+
* empty success.
|
|
36
|
+
*
|
|
37
|
+
* Neither failure falls back to the one-shot path. A missing program would
|
|
38
|
+
* only produce the relay's `execvpe(rg) failed` at exit `1` (again the
|
|
39
|
+
* "no matches" dialect), and a missing directory is worse: `wsl.exe --cd`
|
|
40
|
+
* does not fail on it — it warns, runs the command in `/`, and exits 0. The
|
|
41
|
+
* shell executor can afford the one-shot retry because it decorates the
|
|
42
|
+
* result with its workdir verdict; this handle has no such decoration point.
|
|
43
|
+
* Everything else — a genuine agent failure that is not `AgentUnavailableError`
|
|
44
|
+
* — still propagates through `done` as a rejection.
|
|
45
|
+
*
|
|
46
|
+
* The one-shot delegate is post-processed the same way, because the agent
|
|
47
|
+
* being out must not change what a broken environment looks like: a missing
|
|
48
|
+
* program's `execvpe(rg) failed` line (exit 1) becomes the same 127, and the
|
|
49
|
+
* relay's `chdir(...) failed` warning — which `wsl.exe` writes while it runs
|
|
50
|
+
* the search in `/` and exits 0/1 — becomes the same explicit directory
|
|
51
|
+
* failure instead of a silent wrong-directory result.
|
|
22
52
|
*
|
|
23
53
|
* Pure shaping over injected collaborators, so the handle semantics are
|
|
24
54
|
* unit-testable without a distro.
|
|
@@ -29,20 +59,56 @@
|
|
|
29
59
|
*
|
|
30
60
|
* @module dsh-plugin-wsl-env/search-exec
|
|
31
61
|
*/
|
|
32
|
-
import { AgentUnavailableError } from "./agent-errors.js";
|
|
62
|
+
import { AgentUnavailableError, CwdError, SpawnError } from "./agent-errors.js";
|
|
63
|
+
import { execProgramFailure, workdirFailure } from "./wsl.js";
|
|
64
|
+
import { t } from "./messages.js";
|
|
65
|
+
/** The program the search spawn runs, when the caller's argv does not say. */
|
|
66
|
+
const SEARCH_PROGRAM = "rg";
|
|
67
|
+
/**
|
|
68
|
+
* The exit code the synthesized results use for a failed search. `2` is rg's
|
|
69
|
+
* own error code: `1` belongs to "no matches", which the tool renders as an
|
|
70
|
+
* empty result rather than a failure.
|
|
71
|
+
*/
|
|
72
|
+
const SEARCH_ERROR_EXIT = 2;
|
|
73
|
+
/** The exit code a shell reports for a command it could not run. */
|
|
74
|
+
const COMMAND_NOT_FOUND_EXIT = 127;
|
|
75
|
+
/**
|
|
76
|
+
* The synthesized failure one search settles with when the program could not
|
|
77
|
+
* start: rg's error dialect is not available, so the message carries both
|
|
78
|
+
* plausible causes (a missing program and a missing directory) and the
|
|
79
|
+
* install remedy the docs promise.
|
|
80
|
+
*
|
|
81
|
+
* @param object - the failure facts.
|
|
82
|
+
* @returns the stderr text.
|
|
83
|
+
*/
|
|
84
|
+
function programFailureText({ program, distro, detail }) {
|
|
85
|
+
return t("searchProgramMissing", { program, distro, detail });
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The relay-shaped stderr one search settles with when its working directory
|
|
89
|
+
* is gone — the same line the typed `CwdError` carries into a shell command's
|
|
90
|
+
* synthesized result, plus the directory's own remedy.
|
|
91
|
+
*
|
|
92
|
+
* @param linuxPath - the directory the agent could not enter.
|
|
93
|
+
* @returns the stderr text.
|
|
94
|
+
*/
|
|
95
|
+
function workdirFailureText(linuxPath) {
|
|
96
|
+
return `<3>WSL: CreateProcessCommon: chdir(${linuxPath}) failed: No such file or directory\n${t("searchWorkdirMissing", { path: linuxPath })}`;
|
|
97
|
+
}
|
|
33
98
|
/**
|
|
34
99
|
* Run one search command through the agent and present it as a search handle.
|
|
35
100
|
*
|
|
36
101
|
* @param object - the handle's collaborators.
|
|
37
102
|
* @returns the search handle (`done`, `collected`, `kill`).
|
|
38
103
|
*/
|
|
39
|
-
export function searchExecutionHandle({ agent, cwd, argv, maxOutputBytes = 0, signal, spawnFallback }) {
|
|
104
|
+
export function searchExecutionHandle({ agent, cwd, argv, distro, maxOutputBytes = 0, signal, spawnFallback }) {
|
|
40
105
|
const state = { delegate: undefined, stdout: undefined, stderr: undefined };
|
|
41
106
|
const controller = new AbortController();
|
|
42
107
|
if (signal?.aborted)
|
|
43
108
|
controller.abort(signal.reason);
|
|
44
109
|
else
|
|
45
110
|
signal?.addEventListener("abort", () => controller.abort(signal.reason), { once: true });
|
|
111
|
+
const program = argv[0] ?? SEARCH_PROGRAM;
|
|
46
112
|
const reader = (slot) => ({
|
|
47
113
|
readFrom(from) {
|
|
48
114
|
const buffer = state[slot] ?? Buffer.alloc(0);
|
|
@@ -50,6 +116,63 @@ export function searchExecutionHandle({ agent, cwd, argv, maxOutputBytes = 0, si
|
|
|
50
116
|
return { text: buffer.subarray(start).toString("utf8"), lossy: false, nextOffset: buffer.length };
|
|
51
117
|
},
|
|
52
118
|
});
|
|
119
|
+
/**
|
|
120
|
+
* Settle on a synthesized failure: drop any delegate so `collected` serves
|
|
121
|
+
* the buffers this facade owns, and keep the streams empty on stdout.
|
|
122
|
+
*
|
|
123
|
+
* @param exitCode - rg's dialect exit code for the failure.
|
|
124
|
+
* @param stderr - the model-facing diagnostic, remedy included.
|
|
125
|
+
* @returns the settled outcome.
|
|
126
|
+
*/
|
|
127
|
+
const settleFailure = (exitCode, stderr) => {
|
|
128
|
+
state.delegate = undefined;
|
|
129
|
+
state.stdout = Buffer.alloc(0);
|
|
130
|
+
state.stderr = Buffer.from(stderr, "utf8");
|
|
131
|
+
return { exitCode, signal: null };
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* The 127 result for a program the distro could not start.
|
|
135
|
+
*
|
|
136
|
+
* @param detail - the agent's or the relay's own spawn diagnostic.
|
|
137
|
+
* @returns the settled outcome.
|
|
138
|
+
*/
|
|
139
|
+
const settleProgramMissing = (detail) => settleFailure(COMMAND_NOT_FOUND_EXIT, programFailureText({ program, distro, detail }));
|
|
140
|
+
/**
|
|
141
|
+
* The rg-error result for a directory the distro could not enter.
|
|
142
|
+
*
|
|
143
|
+
* @param linuxPath - the directory that could not be entered.
|
|
144
|
+
* @returns the settled outcome.
|
|
145
|
+
*/
|
|
146
|
+
const settleWorkdirMissing = (linuxPath) => settleFailure(SEARCH_ERROR_EXIT, workdirFailureText(linuxPath));
|
|
147
|
+
/**
|
|
148
|
+
* Delegate one agent-unavailable request to the one-shot handle, translating
|
|
149
|
+
* the relay's missing-program failure into the documented 127 shape. A
|
|
150
|
+
* delegated outcome that names no missing program passes through verbatim
|
|
151
|
+
* (its collected streams stay the delegate's).
|
|
152
|
+
*
|
|
153
|
+
* @returns the settled outcome.
|
|
154
|
+
*/
|
|
155
|
+
const settleDelegate = async () => {
|
|
156
|
+
const delegate = spawnFallback();
|
|
157
|
+
state.delegate = delegate;
|
|
158
|
+
const outcome = await delegate.done;
|
|
159
|
+
if (outcome.exitCode === null)
|
|
160
|
+
return outcome;
|
|
161
|
+
const text = delegate.collected.stderr?.readFrom(0).text ?? "";
|
|
162
|
+
// `wsl.exe --cd <missing>` warns, then runs the command in `/` and exits
|
|
163
|
+
// 0/1 — a silent wrong-directory search. The relay warning is the only
|
|
164
|
+
// evidence, so it becomes the same explicit failure the agent's CwdError
|
|
165
|
+
// produces.
|
|
166
|
+
const missingDir = workdirFailure("", text);
|
|
167
|
+
if (missingDir !== undefined)
|
|
168
|
+
return settleWorkdirMissing(missingDir);
|
|
169
|
+
// A missing program surfaces as `execvpe(rg) failed` at exit 1 — the
|
|
170
|
+
// tool's no-matches dialect. Translate it into the documented 127.
|
|
171
|
+
const relayFailure = execProgramFailure("", text);
|
|
172
|
+
if (relayFailure !== undefined)
|
|
173
|
+
return settleProgramMissing(relayFailure);
|
|
174
|
+
return outcome;
|
|
175
|
+
};
|
|
53
176
|
const handle = {
|
|
54
177
|
get collected() {
|
|
55
178
|
if (state.delegate !== undefined)
|
|
@@ -64,17 +187,26 @@ export function searchExecutionHandle({ agent, cwd, argv, maxOutputBytes = 0, si
|
|
|
64
187
|
state.stderr = result.stderr;
|
|
65
188
|
}
|
|
66
189
|
catch (error) {
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
190
|
+
if (controller.signal.aborted) {
|
|
191
|
+
// Our kill() or the caller's cancellation: the killed outcome the
|
|
192
|
+
// one-shot path reports, not a failure.
|
|
193
|
+
return { exitCode: null, signal: "SIGTERM" };
|
|
194
|
+
}
|
|
195
|
+
if (error instanceof CwdError) {
|
|
196
|
+
// The directory is gone. Synthesize rg's own error code with the
|
|
197
|
+
// relay-shaped line, so the tool reports a failure that names the
|
|
198
|
+
// path instead of rejecting as a provider failure.
|
|
199
|
+
return settleWorkdirMissing(error.linuxPath);
|
|
74
200
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
201
|
+
if (error instanceof SpawnError) {
|
|
202
|
+
// The agent could not start the program. The native agent reports
|
|
203
|
+
// both a missing executable and a missing workdir this way, so the
|
|
204
|
+
// message names both and the remedy makes it actionable.
|
|
205
|
+
return settleProgramMissing(error.message);
|
|
206
|
+
}
|
|
207
|
+
if (!(error instanceof AgentUnavailableError))
|
|
208
|
+
throw error;
|
|
209
|
+
return await settleDelegate();
|
|
78
210
|
}
|
|
79
211
|
return { exitCode: result.exitCode, signal: null };
|
|
80
212
|
})(),
|
package/lib/subprocess.d.ts
CHANGED
|
@@ -295,7 +295,10 @@ export declare class WslSubprocessRuntime extends LocalSubprocessRuntime {
|
|
|
295
295
|
* shipped handle's). Both decisions are pure coordinate functions
|
|
296
296
|
* (`search-route.js`, `git-route.js`); a spawn neither names (any other
|
|
297
297
|
* program, any drive or relative directory) reaches the shipped
|
|
298
|
-
* implementation verbatim.
|
|
298
|
+
* implementation verbatim. A broken distro surfaces the program's own
|
|
299
|
+
* failure instead of a provider rejection: a missing rg or git reports
|
|
300
|
+
* exit 127 with the bootstrap remedy, and a missing workdir reports that
|
|
301
|
+
* directory; `search-exec.js` and `git-exec.js` own those translations.
|
|
299
302
|
*
|
|
300
303
|
* @param spec - the spawn request.
|
|
301
304
|
* @returns the live search handle.
|
package/lib/subprocess.js
CHANGED
|
@@ -332,7 +332,10 @@ export class WslSubprocessRuntime extends LocalSubprocessRuntime {
|
|
|
332
332
|
* shipped handle's). Both decisions are pure coordinate functions
|
|
333
333
|
* (`search-route.js`, `git-route.js`); a spawn neither names (any other
|
|
334
334
|
* program, any drive or relative directory) reaches the shipped
|
|
335
|
-
* implementation verbatim.
|
|
335
|
+
* implementation verbatim. A broken distro surfaces the program's own
|
|
336
|
+
* failure instead of a provider rejection: a missing rg or git reports
|
|
337
|
+
* exit 127 with the bootstrap remedy, and a missing workdir reports that
|
|
338
|
+
* directory; `search-exec.js` and `git-exec.js` own those translations.
|
|
336
339
|
*
|
|
337
340
|
* @param spec - the spawn request.
|
|
338
341
|
* @returns the live search handle.
|
|
@@ -351,7 +354,11 @@ export class WslSubprocessRuntime extends LocalSubprocessRuntime {
|
|
|
351
354
|
...spec,
|
|
352
355
|
argv: gitRewrite.wslArgv,
|
|
353
356
|
cwd: this.hostCwd(),
|
|
354
|
-
|
|
357
|
+
// The relay's own diagnostics are UTF-16LE unless this is set; the
|
|
358
|
+
// snapshot handle reads the `chdir(...) failed` / `execvpe(git)
|
|
359
|
+
// failed` lines to turn a broken distro into git's own failure
|
|
360
|
+
// shape instead of a silent "not a repository".
|
|
361
|
+
env: { ...(wslenv.length > 0 ? { ...env, WSLENV: wslEnvValue(wslenv) } : env), WSL_UTF8: "1" },
|
|
355
362
|
});
|
|
356
363
|
// Agent-first: the warm resident answers a git call in ~2 ms where a
|
|
357
364
|
// one-shot `wsl.exe` spends ~230 ms of process startup, and a snapshot
|
|
@@ -392,6 +399,7 @@ export class WslSubprocessRuntime extends LocalSubprocessRuntime {
|
|
|
392
399
|
agent: sharedAgent(rewrite.distro),
|
|
393
400
|
cwd: rewrite.linuxCwd,
|
|
394
401
|
argv: rewrite.rgArgv,
|
|
402
|
+
distro: rewrite.distro,
|
|
395
403
|
// One budget serves both streams; the stdout budget is the binding one,
|
|
396
404
|
// and a pathological stderr is still bounded by it.
|
|
397
405
|
maxOutputBytes: spec.stdio.stdout?.maxBytes ?? 0,
|
|
@@ -402,7 +410,12 @@ export class WslSubprocessRuntime extends LocalSubprocessRuntime {
|
|
|
402
410
|
// `wsl.exe --cd` carries the Linux directory; the host process itself
|
|
403
411
|
// must start in a Windows directory, as with a terminal launch.
|
|
404
412
|
cwd: this.hostCwd(),
|
|
405
|
-
|
|
413
|
+
// The relay writes its own diagnostics as UTF-16LE unless this is
|
|
414
|
+
// set. The search handle reads the `execvpe(rg) failed` line to turn
|
|
415
|
+
// a missing distro rg into rg's documented exit 127, so the line
|
|
416
|
+
// must arrive as UTF-8 — and a human reading the raw relay text gets
|
|
417
|
+
// a readable message too.
|
|
418
|
+
env: { ...this.forwardedEnv(spec), WSL_UTF8: "1" },
|
|
406
419
|
}),
|
|
407
420
|
});
|
|
408
421
|
}
|
package/lib/update-check.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The plugin's update check: notice when a newer release exists, stop there.
|
|
3
3
|
*
|
|
4
|
-
* Upgrading today means re-installing by hand (Plugins page
|
|
5
|
-
*
|
|
4
|
+
* Upgrading today means re-installing by hand (the Plugins page) and the
|
|
5
|
+
* harness's own plugin-manager already answers
|
|
6
6
|
* "which versions exist and do they fit this DSH" — `listVersions` resolves
|
|
7
7
|
* dist-tags, deprecation, and the `engines.dsh`/peer compatibility of every
|
|
8
8
|
* candidate against the running DSH. This service makes that answer arrive
|
package/lib/update-check.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The plugin's update check: notice when a newer release exists, stop there.
|
|
3
3
|
*
|
|
4
|
-
* Upgrading today means re-installing by hand (Plugins page
|
|
5
|
-
*
|
|
4
|
+
* Upgrading today means re-installing by hand (the Plugins page) and the
|
|
5
|
+
* harness's own plugin-manager already answers
|
|
6
6
|
* "which versions exist and do they fit this DSH" — `listVersions` resolves
|
|
7
7
|
* dist-tags, deprecation, and the `engines.dsh`/peer compatibility of every
|
|
8
8
|
* candidate against the running DSH. This service makes that answer arrive
|
|
@@ -31,6 +31,7 @@ import { spawn } from "node:child_process";
|
|
|
31
31
|
import { dirname, resolve } from "node:path";
|
|
32
32
|
import { fileURLToPath } from "node:url";
|
|
33
33
|
import { distroOfUnc } from "./distro-route.js";
|
|
34
|
+
import { withHostPeerVersions } from "./peer-versions.js";
|
|
34
35
|
import { digestReport, renderDigest, SECTIONS } from "./wsl-doctor-tool.js";
|
|
35
36
|
import { mergeAutoPresetSeam } from "./doctor-live.js";
|
|
36
37
|
export const name = "wsl-doctor-command";
|
|
@@ -133,7 +134,7 @@ export function parseDoctorInput(rawInput) {
|
|
|
133
134
|
export function runDoctorCli(argv, signal, timeoutMs = DOCTOR_CLI_TIMEOUT_MS) {
|
|
134
135
|
return new Promise((resolvePromise, rejectPromise) => {
|
|
135
136
|
const child = spawn(process.execPath, [DOCTOR_SCRIPT, ...argv], {
|
|
136
|
-
env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" },
|
|
137
|
+
env: withHostPeerVersions({ ...process.env, ELECTRON_RUN_AS_NODE: "1" }),
|
|
137
138
|
windowsHide: true,
|
|
138
139
|
stdio: ["ignore", "pipe", "pipe"],
|
|
139
140
|
signal,
|
package/lib/wsl.d.ts
CHANGED
|
@@ -146,6 +146,27 @@ export declare function shellArgs(shellPath: string, login: boolean): string[];
|
|
|
146
146
|
* @returns the directory that could not be entered, or undefined.
|
|
147
147
|
*/
|
|
148
148
|
export declare function workdirFailure(stdout?: string, stderr?: string): string | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* The relay line for a program `wsl.exe --exec` could not start, when its
|
|
151
|
+
* output carries one.
|
|
152
|
+
*
|
|
153
|
+
* A missing `--exec` binary does not surface as a shell's `127`: the relay
|
|
154
|
+
* writes a `CreateProcessCommon: execvpe(<program>) failed: No such file or
|
|
155
|
+
* directory` line to STDERR and exits **1** — the exit code callers such as a
|
|
156
|
+
* search or a git snapshot read as "empty result", not as a failure. The line
|
|
157
|
+
* is matched here (on NUL-stripped text, because the relay answers in UTF-16LE
|
|
158
|
+
* unless `WSL_UTF8` was pinned) so a facade can turn a missing distro program
|
|
159
|
+
* into its own actionable failure.
|
|
160
|
+
*
|
|
161
|
+
* The whole matched line is returned, not just the program name: it is the
|
|
162
|
+
* relay's own evidence and reads well as the parenthesized detail of a
|
|
163
|
+
* caller's message.
|
|
164
|
+
*
|
|
165
|
+
* @param stdout - a command's captured stdout; absent reads as empty.
|
|
166
|
+
* @param stderr - its captured stderr; absent reads as empty.
|
|
167
|
+
* @returns the matched relay line, or undefined.
|
|
168
|
+
*/
|
|
169
|
+
export declare function execProgramFailure(stdout?: string, stderr?: string): string | undefined;
|
|
149
170
|
/**
|
|
150
171
|
* The flags that make an interactive shell a login shell.
|
|
151
172
|
*
|
package/lib/wsl.js
CHANGED
|
@@ -214,6 +214,30 @@ export function workdirFailure(stdout, stderr) {
|
|
|
214
214
|
const match = /<3>WSL[^\n]*CreateProcessCommon[^\n]*chdir\(([^)]*)\) failed/.exec(text);
|
|
215
215
|
return match?.[1];
|
|
216
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* The relay line for a program `wsl.exe --exec` could not start, when its
|
|
219
|
+
* output carries one.
|
|
220
|
+
*
|
|
221
|
+
* A missing `--exec` binary does not surface as a shell's `127`: the relay
|
|
222
|
+
* writes a `CreateProcessCommon: execvpe(<program>) failed: No such file or
|
|
223
|
+
* directory` line to STDERR and exits **1** — the exit code callers such as a
|
|
224
|
+
* search or a git snapshot read as "empty result", not as a failure. The line
|
|
225
|
+
* is matched here (on NUL-stripped text, because the relay answers in UTF-16LE
|
|
226
|
+
* unless `WSL_UTF8` was pinned) so a facade can turn a missing distro program
|
|
227
|
+
* into its own actionable failure.
|
|
228
|
+
*
|
|
229
|
+
* The whole matched line is returned, not just the program name: it is the
|
|
230
|
+
* relay's own evidence and reads well as the parenthesized detail of a
|
|
231
|
+
* caller's message.
|
|
232
|
+
*
|
|
233
|
+
* @param stdout - a command's captured stdout; absent reads as empty.
|
|
234
|
+
* @param stderr - its captured stderr; absent reads as empty.
|
|
235
|
+
* @returns the matched relay line, or undefined.
|
|
236
|
+
*/
|
|
237
|
+
export function execProgramFailure(stdout, stderr) {
|
|
238
|
+
const text = `${stdout ?? ""}\n${stderr ?? ""}`.replace(/\0/g, "");
|
|
239
|
+
return /execvpe\([^)\n]*\) failed:[^\n]*No such file or directory/iu.exec(text)?.[0];
|
|
240
|
+
}
|
|
217
241
|
/**
|
|
218
242
|
* Shells whose `-l` flag means a login shell.
|
|
219
243
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-wsl-env",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.2",
|
|
4
4
|
"description": "在 WSL 的 Linux 实例中打开项目工作区,在对应 Linux 空间中进行命令执行、运行 shell 脚本和文件访问,以获得全套 Linux Shell 工具链收益,并通过 bubblewrap 对命令进行沙箱隔离",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
"dsh-plugin",
|
|
9
9
|
"cordis",
|
|
10
10
|
"wsl",
|
|
11
|
-
"
|
|
11
|
+
"wsl2",
|
|
12
|
+
"windows",
|
|
13
|
+
"linux",
|
|
14
|
+
"deepseek",
|
|
15
|
+
"ai-agent",
|
|
16
|
+
"coding-agent",
|
|
17
|
+
"bubblewrap"
|
|
12
18
|
],
|
|
13
19
|
"type": "module",
|
|
14
20
|
"types": "./lib/client-host.d.ts",
|
|
@@ -149,6 +155,7 @@
|
|
|
149
155
|
"docs/README.zh.md",
|
|
150
156
|
"docs/QUICKSTART.md",
|
|
151
157
|
"docs/screenshots/*.png",
|
|
158
|
+
"docs/screenshots/*.svg",
|
|
152
159
|
"docs/PERFORMANCE.md",
|
|
153
160
|
"docs/COMPATIBILITY.md",
|
|
154
161
|
"docs/CONFIGURATION.md",
|