dsh-plugin-wsl-env 0.22.0 → 0.23.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 (81) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/CONTRIBUTING.md +7 -3
  3. package/README.md +11 -9
  4. package/SUPPORT.md +1 -1
  5. package/cordis.patch.yml +4 -4
  6. package/docs/AGENT-PROTOCOL-V7.md +4 -4
  7. package/docs/API.md +12 -2
  8. package/docs/ARCHITECTURE.md +59 -19
  9. package/docs/CONFIGURATION.md +40 -18
  10. package/docs/CONFIGURATION.zh.md +44 -8
  11. package/docs/DIAGNOSTICS.md +19 -6
  12. package/docs/DIAGNOSTICS.zh.md +15 -6
  13. package/docs/LIMITATIONS.md +42 -17
  14. package/docs/LIMITATIONS.zh.md +47 -12
  15. package/docs/MIGRATION.md +1 -1
  16. package/docs/PEER-PARITY.md +8 -7
  17. package/docs/QUICKSTART.md +16 -8
  18. package/docs/QUICKSTART.zh.md +22 -4
  19. package/docs/README.zh.md +19 -10
  20. package/docs/RELEASING.md +8 -3
  21. package/docs/REQUIREMENTS.zh.md +11 -6
  22. package/docs/ROADMAP-1.0.md +12 -11
  23. package/docs/ROADMAP.md +10 -8
  24. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +3 -2
  25. package/docs/UPSTREAM-FSIO-EXPORT.md +8 -9
  26. package/docs/UPSTREAM-SERVICE-SWAP.md +9 -5
  27. package/docs/UPSTREAM-TERMINAL-TITLE.md +9 -8
  28. package/docs/VALUE.zh.md +5 -5
  29. package/docs/root-fs-routing.md +26 -19
  30. package/lib/agent-confined.d.ts +2 -2
  31. package/lib/agent-confined.js +0 -1
  32. package/lib/agent-exec.d.ts +2 -11
  33. package/lib/agent-protocol.d.ts +6 -5
  34. package/lib/agent.d.ts +5 -5
  35. package/lib/auto-preset.d.ts +4 -3
  36. package/lib/bwrap.d.ts +2 -1
  37. package/lib/client-host.d.ts +1 -1
  38. package/lib/client-host.js +1 -1
  39. package/lib/cwd-prompt-tool.d.ts +4 -20
  40. package/lib/cwd-prompt.d.ts +11 -10
  41. package/lib/distro-route.d.ts +3 -2
  42. package/lib/doctor-live.d.ts +2 -1
  43. package/lib/fs-routing.d.ts +29 -1
  44. package/lib/fs-routing.js +30 -3
  45. package/lib/fs-substrate.d.ts +0 -1
  46. package/lib/fs-substrate.js +0 -1
  47. package/lib/fsio-agent.d.ts +3 -21
  48. package/lib/fsio-agent.js +2 -4
  49. package/lib/git-exec.d.ts +3 -2
  50. package/lib/git-route.d.ts +4 -2
  51. package/lib/git-route.js +4 -2
  52. package/lib/index.d.ts +9 -10
  53. package/lib/index.js +124 -12
  54. package/lib/listing.d.ts +2 -1
  55. package/lib/messages.d.ts +1 -1
  56. package/lib/native-agent.d.ts +3 -2
  57. package/lib/paths.d.ts +2 -1
  58. package/lib/picker.d.ts +1 -14
  59. package/lib/picker.js +1 -2
  60. package/lib/preflight.d.ts +5 -4
  61. package/lib/probe-cache.d.ts +2 -1
  62. package/lib/sandbox-core.d.ts +2 -11
  63. package/lib/sandbox-core.js +1 -1
  64. package/lib/sandbox.d.ts +0 -1
  65. package/lib/sandbox.js +0 -4
  66. package/lib/search-exec.d.ts +2 -1
  67. package/lib/session-runtime.d.ts +3 -2
  68. package/lib/shell-env.d.ts +3 -2
  69. package/lib/shell.d.ts +1 -1
  70. package/lib/shell.js +1 -1
  71. package/lib/subprocess.d.ts +1 -1
  72. package/lib/update-check.d.ts +3 -3
  73. package/lib/wsl-doctor-command.d.ts +38 -10
  74. package/lib/wsl-doctor-command.js +168 -27
  75. package/lib/wsl-doctor-tool.d.ts +9 -16
  76. package/lib/wsl-doctor-tool.js +10 -4
  77. package/lib/wsl.d.ts +3 -2
  78. package/package.json +27 -33
  79. package/scripts/bootstrap-import.sh +189 -0
  80. package/scripts/open-wsl-vscode.ps1 +36 -0
  81. package/examples/preset-wsl-session-sandbox.cordis.patch.yml +0 -178
@@ -42,6 +42,24 @@ export const name = "wsl-doctor-command";
42
42
  * `wsl_doctor` tool uses for its optional collector.
43
43
  */
44
44
  export const inject = [];
45
+ /** How long the cwd service may take before the command gives up on it. */
46
+ const CWD_SERVICE_TIMEOUT_MS = 5_000;
47
+ /**
48
+ * How long a distro-scoped doctor CLI run may take. A scoped quick run takes
49
+ * seconds and a scoped full run ~15 s, so only a stall reaches this; it sits
50
+ * below the command dispatcher's own deadline so the run settles with a
51
+ * message naming what happened instead of the dispatcher's opaque "operation
52
+ * was aborted".
53
+ */
54
+ export const DOCTOR_CLI_TIMEOUT_MS = 120_000;
55
+ /**
56
+ * How long an UNRESOLVED-target run may take. Without a distro the CLI's
57
+ * effective configuration decides, and the shipped `auto` probes every
58
+ * installed distro — minutes on a machine with several, with no progress to
59
+ * show in the UI. Failing fast with the narrowing hint beats a card that sits
60
+ * "executing" for the dispatcher's whole budget.
61
+ */
62
+ export const DOCTOR_CLI_SWEEP_TIMEOUT_MS = 60_000;
45
63
  /** The doctor CLI this row spawns, resolved from the built module's package root. */
46
64
  export const DOCTOR_SCRIPT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "scripts", "doctor.mjs");
47
65
  /** The usage text a grammar violation settles with. */
@@ -101,11 +119,17 @@ export function parseDoctorInput(rawInput) {
101
119
  * verdict*, which is a successful diagnosis — the JSON on stdout still parses;
102
120
  * only a spawn failure or unparseable output is an infrastructure error.
103
121
  *
122
+ * The run is bounded by {@link DOCTOR_CLI_TIMEOUT_MS}. Without a deadline a
123
+ * doctor that never reports keeps the command "executing" until the command
124
+ * dispatcher aborts it, and that abort surfaces as an opaque "operation was
125
+ * aborted" that names neither what ran nor how to narrow it.
126
+ *
104
127
  * @param argv - flags after the script path (no node, no script — added here).
105
128
  * @param signal - the dispatcher's abort signal; abort kills the child.
129
+ * @param timeoutMs - the deadline; tests shrink it to exercise the timeout.
106
130
  * @returns the CLI's stdout (one JSON report).
107
131
  */
108
- export function runDoctorCli(argv, signal) {
132
+ export function runDoctorCli(argv, signal, timeoutMs = DOCTOR_CLI_TIMEOUT_MS) {
109
133
  return new Promise((resolvePromise, rejectPromise) => {
110
134
  const child = spawn(process.execPath, [DOCTOR_SCRIPT, ...argv], {
111
135
  env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" },
@@ -115,19 +139,70 @@ export function runDoctorCli(argv, signal) {
115
139
  });
116
140
  let stdout = "";
117
141
  let stderr = "";
142
+ let settled = false;
143
+ let timedOut = false;
144
+ const settle = (finish) => {
145
+ if (settled)
146
+ return;
147
+ settled = true;
148
+ clearTimeout(deadline);
149
+ finish();
150
+ };
151
+ const deadline = setTimeout(() => {
152
+ timedOut = true;
153
+ try {
154
+ child.kill();
155
+ }
156
+ catch {
157
+ // Already exited: the close handler settles the run.
158
+ }
159
+ }, timeoutMs);
118
160
  child.stdout?.on("data", (chunk) => { stdout += chunk.toString("utf8"); });
119
161
  child.stderr?.on("data", (chunk) => { stderr += chunk.toString("utf8"); });
120
- child.on("error", (error) => rejectPromise(error));
121
- child.on("close", (code) => {
162
+ child.on("error", (error) => {
163
+ // An abort arrives here as an AbortError; normalize it so the settled
164
+ // message names the run rather than the DOMException.
165
+ settle(() => rejectPromise(error.name === "AbortError" ? new Error("doctor CLI 已取消") : error));
166
+ });
167
+ child.on("close", (code, signalName) => {
122
168
  const text = stdout.trim();
123
169
  if (text.startsWith("{")) {
124
- resolvePromise(text);
170
+ settle(() => resolvePromise(text));
125
171
  return;
126
172
  }
127
- rejectPromise(new Error(`doctor CLI 未能给出报告(exit ${code ?? "signal"})${stderr.trim().length > 0 ? `:${stderr.trim().slice(0, 400)}` : ""}`));
173
+ if (timedOut) {
174
+ settle(() => rejectPromise(new Error(`doctor CLI 在 ${timeoutMs / 1000} 秒内没有给出报告;用 --distro <名称> 收窄到单个发行版,或改用 quick / <分区> 重试`)));
175
+ return;
176
+ }
177
+ settle(() => rejectPromise(new Error(`doctor CLI 未能给出报告(exit ${code ?? signalName ?? "signal"})${stderr.trim().length > 0 ? `:${stderr.trim().slice(0, 400)}` : ""}`)));
128
178
  });
129
179
  });
130
180
  }
181
+ /**
182
+ * Await a promise for at most `ms` milliseconds, returning undefined when the
183
+ * budget runs out. Used for the cwd service: naming the distro is a
184
+ * convenience, and a stalled resolution must never delay the diagnosis.
185
+ *
186
+ * @param promise - the pending resolution.
187
+ * @param ms - the budget.
188
+ * @returns the value, or undefined when the budget ran out.
189
+ */
190
+ async function within(promise, ms) {
191
+ let timer;
192
+ try {
193
+ return await Promise.race([
194
+ promise,
195
+ new Promise((resolve) => { timer = setTimeout(() => resolve(undefined), ms); }),
196
+ ]);
197
+ }
198
+ catch {
199
+ return undefined;
200
+ }
201
+ finally {
202
+ if (timer !== undefined)
203
+ clearTimeout(timer);
204
+ }
205
+ }
131
206
  /**
132
207
  * Resolve the commands registry: the provided `commands` service through the
133
208
  * optional `ctx.get`, else the plain property (the test seam). Absent means a
@@ -147,11 +222,20 @@ function resolveCommands(ctx) {
147
222
  }
148
223
  /**
149
224
  * Resolve the distro an invocation targets: the explicit `--distro` wins;
150
- * otherwise the receiving agent's working directory names a distro when it is
151
- * a WSL UNC path; otherwise empty — the CLI's effective configuration decides
225
+ * otherwise the Session's own working directory names a distro when it is a
226
+ * WSL UNC path; otherwise empty — the CLI's effective configuration decides
152
227
  * (the shipped preset's `auto` probes every installed distro).
153
228
  *
154
- * @param ctx - the cordis context (for the cwd service).
229
+ * The `workingDirectory` service is agent-scoped: the preset's tool row
230
+ * injects it, and `wsl-cwd-prompt` reads it from `agent.ctx`. The app-level
231
+ * command row therefore reaches it through the invocation's agent, not through
232
+ * its own `ctx.get` — reading only the row's context silently missed the
233
+ * service, left the distro unresolved, and turned the run into the
234
+ * configuration's `auto` sweep over every installed distro. The Session
235
+ * header's `cwd` is the service-free fallback: it names the distro the
236
+ * session opened in even when the live value is unreachable.
237
+ *
238
+ * @param ctx - the cordis context (the row's own scope, the last resort).
155
239
  * @param invocation - the registry's invocation face.
156
240
  * @param distro - the explicitly requested distro, possibly empty.
157
241
  * @returns the distro name, possibly empty.
@@ -159,24 +243,64 @@ function resolveCommands(ctx) {
159
243
  async function resolveDistro(ctx, invocation, distro) {
160
244
  if (distro.length > 0)
161
245
  return distro;
162
- if (invocation.agent === undefined)
163
- return "";
164
- // The cwd service resolves through `ctx.get` in production (no inject, no
165
- // proxy throw); the plain property is the test seam's face.
166
- const cwdService = typeof ctx.get === "function"
167
- ? ctx.get("workingDirectory") // the service's contract is this module's `ensure` slice; narrowed below
168
- : ctx.workingDirectory;
169
- if (cwdService === undefined || typeof cwdService.ensure !== "function")
246
+ const agent = invocation.agent;
247
+ if (agent === undefined)
170
248
  return "";
249
+ const session = agent.session;
250
+ /** Every candidate service, in the order the resolution tries them. */
251
+ const services = [];
171
252
  try {
172
- const cwd = await cwdService.ensure(invocation.agent, invocation.signal);
173
- return distroOfUnc(cwd) ?? "";
253
+ const scoped = agent.ctx?.get?.("workingDirectory");
254
+ if (scoped !== undefined && scoped !== null)
255
+ services.push(scoped); // the service's contract is this module's slice
174
256
  }
175
257
  catch {
176
- // A cwd that cannot resolve (no session, unreadable directory) must not
177
- // fail the diagnosis: the CLI's own target selection is the fallback.
178
- return "";
258
+ // A context that refuses the read contributes no service; the header cwd
259
+ // below still names the distro.
179
260
  }
261
+ try {
262
+ const rowScoped = typeof ctx.get === "function"
263
+ ? ctx.get("workingDirectory") // absent at app scope in production; harmless when present
264
+ : ctx.workingDirectory;
265
+ if (rowScoped !== undefined && rowScoped !== null)
266
+ services.push(rowScoped);
267
+ }
268
+ catch {
269
+ // Same reason: the row's context is not where the service lives.
270
+ }
271
+ // The live value first (a mid-session `cd` can move the session to another
272
+ // distro), then the header's own cwd, then the async resolution.
273
+ for (const service of services) {
274
+ try {
275
+ const current = service?.get?.(session);
276
+ const fromCurrent = distroOfUnc(current ?? undefined);
277
+ if (fromCurrent !== undefined)
278
+ return fromCurrent;
279
+ }
280
+ catch {
281
+ // A throwing get contributes nothing.
282
+ }
283
+ }
284
+ const fromHeader = distroOfUnc(session?.header?.cwd);
285
+ if (fromHeader !== undefined)
286
+ return fromHeader;
287
+ for (const service of services) {
288
+ if (typeof service?.ensure !== "function")
289
+ continue;
290
+ let pending;
291
+ try {
292
+ pending = service.ensure(agent, invocation.signal);
293
+ }
294
+ catch {
295
+ // A synchronous throw is a failed resolution, never a failed command.
296
+ continue;
297
+ }
298
+ const resolved = await within(pending, CWD_SERVICE_TIMEOUT_MS);
299
+ const fromService = distroOfUnc(resolved);
300
+ if (fromService !== undefined)
301
+ return fromService;
302
+ }
303
+ return "";
180
304
  }
181
305
  /**
182
306
  * Format the CLI's JSON report into the itemized text the UI renders — the
@@ -204,10 +328,20 @@ export async function apply(ctx) {
204
328
  // (`pnpm run doctor`) stays the surface for headless deployments.
205
329
  if (commands === undefined)
206
330
  return;
207
- // The test seam is a plain object: read `doctorCli` only when the cordis
208
- // property proxy is absent, or the read itself throws ("cannot get property
209
- // ... without inject") — the same guard the tool module uses for `doctor`.
210
- const runCli = typeof ctx.get !== "function" && typeof ctx.doctorCli === "function" ? ctx.doctorCli : runDoctorCli;
331
+ // The test seam is a plain object: `doctorCli`, when the context carries it,
332
+ // replaces the subprocess. Reading it may throw under the cordis property
333
+ // proxy ("cannot get property ... without inject"), so the read is guarded —
334
+ // the same shape the tool module uses for its optional `doctor`.
335
+ const runCli = (() => {
336
+ try {
337
+ if (typeof ctx.doctorCli === "function")
338
+ return ctx.doctorCli;
339
+ }
340
+ catch {
341
+ // Production: the row's context has no such property.
342
+ }
343
+ return runDoctorCli;
344
+ })();
211
345
  commands.register({
212
346
  name: "wsl-doctor",
213
347
  description: "运行 WSL 环境诊断(独立 doctor CLI):结果直接显示在此,不进入模型对话。省略参数为快速诊断。",
@@ -228,12 +362,19 @@ export async function apply(ctx) {
228
362
  argv.push("--sections", parsed.section);
229
363
  if (distro.length > 0)
230
364
  argv.push("--distro", distro);
365
+ // A resolved target is one distro and finishes in seconds; an unresolved
366
+ // one hands the choice to the configuration, whose `auto` sweeps every
367
+ // installed distro — bounded tightly so it cannot sit "executing".
368
+ const budget = distro.length > 0 ? DOCTOR_CLI_TIMEOUT_MS : DOCTOR_CLI_SWEEP_TIMEOUT_MS;
231
369
  try {
232
- const json = await runCli(argv, invocation.signal);
370
+ const json = await runCli(argv, invocation.signal, budget);
233
371
  return { kind: "success", text: formatDoctorReport(json, distro) };
234
372
  }
235
373
  catch (error) {
236
- return { kind: "error", text: `doctor 运行失败:${error instanceof Error ? error.message : String(error)}` };
374
+ const target = distro.length > 0
375
+ ? `发行版 ${distro}`
376
+ : "配置指定的目标(未从会话工作目录解析出发行版,auto 会逐个检查所有已安装发行版)";
377
+ return { kind: "error", text: `doctor 运行失败(${target}):${error instanceof Error ? error.message : String(error)}` };
237
378
  }
238
379
  },
239
380
  });
@@ -36,11 +36,11 @@ export declare const name = "wsl-doctor-tool";
36
36
  */
37
37
  export declare const inject: string[];
38
38
  /** The tool registry slice this service consumes. */
39
- export interface ToolRegistrySlice {
39
+ interface ToolRegistrySlice {
40
40
  register: (tool: unknown) => unknown;
41
41
  }
42
42
  /** The harness's `workingDirectory` service slice (cwd resolution). */
43
- export interface WorkingDirectoryToolSlice {
43
+ interface WorkingDirectoryToolSlice {
44
44
  ensure: (agent: unknown, signal?: unknown) => Promise<string>;
45
45
  }
46
46
  /** The doctor report this tool digests — the doctor CLI's versioned shape. */
@@ -68,12 +68,13 @@ export interface DoctorReportLike {
68
68
  };
69
69
  }
70
70
  /** The doctor report collector: distro plus run scope in, report out. */
71
- export type DoctorCollector = (distro: string, options?: {
71
+ type DoctorCollector = (distro: string, options?: {
72
72
  quick?: boolean;
73
73
  sections?: readonly string[];
74
+ signal?: AbortSignal;
74
75
  }) => Promise<DoctorReportLike>;
75
76
  /** The context slice this service consumes. */
76
- export type WslDoctorToolContext = {
77
+ type WslDoctorToolContext = {
77
78
  tools: ToolRegistrySlice;
78
79
  workingDirectory: WorkingDirectoryToolSlice;
79
80
  /** Optional cordis-style lookup: how production resolves `doctor` without an inject. */
@@ -81,13 +82,8 @@ export type WslDoctorToolContext = {
81
82
  /** The in-process collector: a provided `doctor` service, or the test seam's fake. */
82
83
  doctor?: DoctorCollector;
83
84
  };
84
- /** The tool's config: the row takes no options. */
85
- export interface WslDoctorToolConfig {
86
- /** Reserved; the wrapper has no options today. */
87
- enabled?: boolean;
88
- }
89
85
  /** One failing check as the digest carries it: what failed and what to do. */
90
- export interface FailingCheck {
86
+ interface FailingCheck {
91
87
  id: string;
92
88
  detail: string;
93
89
  remedy: string;
@@ -95,7 +91,7 @@ export interface FailingCheck {
95
91
  distro?: string;
96
92
  }
97
93
  /** Per-distro tallies: what was tested in each distro and how it came out. */
98
- export interface DistroTally {
94
+ interface DistroTally {
99
95
  name: string;
100
96
  ok: number;
101
97
  warn: number;
@@ -109,7 +105,7 @@ export interface DistroTally {
109
105
  verdict?: string;
110
106
  }
111
107
  /** One check as the itemized listing carries it: what was tested and how it came out. */
112
- export interface CheckItem {
108
+ interface CheckItem {
113
109
  id: string;
114
110
  /** The check's display name; falls back to the id when the report omits it. */
115
111
  title: string;
@@ -160,10 +156,6 @@ export interface DoctorDigest {
160
156
  export declare function sectionOf(id: string): "host" | "sandbox" | "session" | "conf" | "net" | "agent";
161
157
  /** The sections in report order, matching the doctor CLI's SECTIONS list. */
162
158
  export declare const SECTIONS: string[];
163
- /** The detail a scope-filtered skip row carries; the marker the renderer buckets on. */
164
- export declare const SCOPE_SKIP_DETAIL = "not run in this scope";
165
- /** The detail prefix a CLI-gated skip row carries (the blocker follows it). */
166
- export declare const SKIP_DETAIL_PREFIX = "skipped: ";
167
159
  /**
168
160
  * Every check id the doctor can emit — the CLI's whole probing surface,
169
161
  * including the ids that only appear conditionally (`distro.present` for a
@@ -212,3 +204,4 @@ export declare function renderDigest(digest: DoctorDigest): string;
212
204
  * registry and the workingDirectory service are reachable).
213
205
  */
214
206
  export declare function apply(ctx: WslDoctorToolContext): Promise<void>;
207
+ export {};
@@ -65,9 +65,9 @@ export const SECTIONS = ["host", "sandbox", "session", "conf", "net", "agent"];
65
65
  /** The pseudo-distro a check lands under when this run's scope never executed it. */
66
66
  const NOT_RUN = "(not run)";
67
67
  /** The detail a scope-filtered skip row carries; the marker the renderer buckets on. */
68
- export const SCOPE_SKIP_DETAIL = "not run in this scope";
68
+ const SCOPE_SKIP_DETAIL = "not run in this scope";
69
69
  /** The detail prefix a CLI-gated skip row carries (the blocker follows it). */
70
- export const SKIP_DETAIL_PREFIX = "skipped: ";
70
+ const SKIP_DETAIL_PREFIX = "skipped: ";
71
71
  /**
72
72
  * Every check id the doctor can emit — the CLI's whole probing surface,
73
73
  * including the ids that only appear conditionally (`distro.present` for a
@@ -372,7 +372,7 @@ async function doctorCollector(ctx) {
372
372
  export async function apply(ctx) {
373
373
  ctx.tools.register(defineTool({
374
374
  name: "wsl_doctor",
375
- description: "Run the WSL environment doctor for this session's distro and return the verdict: ready (the first command should succeed), or blocked with per-failure copy-paste remedies. Interactive by design: start with depth \"quick\" (prerequisites only, ~10 s) and narrate the result, then narrow with \"section\" (one of host/sandbox/session/conf/net/agent) or run depth \"full\" only when the user asked for a complete diagnosis — each call probes its scope and itemizes every check it tested with an explicit status marker, grouped by distro.",
375
+ description: "Run the WSL environment doctor for this session's distro and return the verdict: ready (the first command should succeed), or blocked with per-failure copy-paste remedies. Interactive by design: start with depth \"quick\" (prerequisites only, ~10 s for the session's own distro) and narrate the result, then narrow with \"section\" (one of host/sandbox/session/conf/net/agent) or run depth \"full\" only when the user asked for a complete diagnosis — each call probes its scope and itemizes every check it tested with an explicit status marker, grouped by distro.",
376
376
  parameters: {
377
377
  distro: {
378
378
  type: "string",
@@ -416,7 +416,13 @@ export async function apply(ctx) {
416
416
  const quick = argv.section === undefined || argv.section.length === 0 ? argv.depth !== "full" : false;
417
417
  const sections = argv.section !== undefined && argv.section.length > 0 ? [argv.section] : undefined;
418
418
  const doctor = await doctorCollector(ctx);
419
- const digest = digestReport(await doctor(distro, { ...(quick ? { quick: true } : {}), ...(sections !== undefined ? { sections } : {}) }), distro);
419
+ const digest = digestReport(await doctor(distro, {
420
+ ...(quick ? { quick: true } : {}),
421
+ ...(sections !== undefined ? { sections } : {}),
422
+ // The run is a subprocess: the caller's cancellation (Esc on the
423
+ // tool call) kills it instead of leaving it to finish unwatched.
424
+ ...(exec.signal === undefined ? {} : { signal: exec.signal }),
425
+ }), distro);
420
426
  return { verdict: digest.verdict, blockers: digest.blockers.join(", "), report: renderDigest(digest) };
421
427
  }
422
428
  }));
package/lib/wsl.d.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  /**
16
16
  * What every `wsl.exe` call may tune: the executable path and cancellation.
17
17
  */
18
- export interface WslCallOptions {
18
+ interface WslCallOptions {
19
19
  /**
20
20
  * Executable name or absolute path; defaults to `wsl.exe`, resolved through
21
21
  * PATH.
@@ -214,7 +214,7 @@ export declare function wslErrorCode(stdout?: string, stderr?: string): string |
214
214
  /**
215
215
  * What {@link defaultShell} may tune: the `wsl.exe` path and cancellation.
216
216
  */
217
- export interface WslShellProbeOptions {
217
+ interface WslShellProbeOptions {
218
218
  /** Executable name or absolute path. */
219
219
  wslPath?: string;
220
220
  /** Optional cancellation. */
@@ -234,3 +234,4 @@ export interface WslShellProbeOptions {
234
234
  * both probes failed.
235
235
  */
236
236
  export declare function defaultShell(distro: string, options?: WslShellProbeOptions): Promise<string | undefined>;
237
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-wsl-env",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "在 WSL 的 Linux 实例中打开项目工作区,在对应 Linux 空间中进行命令执行、运行 shell 脚本和文件访问,以获得全套 Linux Shell 工具链收益,并通过 bubblewrap 对命令进行沙箱隔离",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -18,10 +18,6 @@
18
18
  "types": "./lib/client-host.d.ts",
19
19
  "default": "./lib/client-host.js"
20
20
  },
21
- "./shell": {
22
- "types": "./lib/shell.d.ts",
23
- "default": "./lib/shell.js"
24
- },
25
21
  "./agent": {
26
22
  "types": "./lib/agent.d.ts",
27
23
  "default": "./lib/agent.js"
@@ -32,6 +28,10 @@
32
28
  },
33
29
  "./auto-preset/locale/en.json": "./locale/auto-preset/en.json",
34
30
  "./auto-preset/locale/zh.json": "./locale/auto-preset/zh.json",
31
+ "./client": {
32
+ "types": "./client.d.ts",
33
+ "default": "./client.js"
34
+ },
35
35
  "./cwd-prompt": {
36
36
  "types": "./lib/cwd-prompt.d.ts",
37
37
  "default": "./lib/cwd-prompt.js"
@@ -40,18 +40,6 @@
40
40
  "types": "./lib/cwd-prompt-tool.d.ts",
41
41
  "default": "./lib/cwd-prompt-tool.js"
42
42
  },
43
- "./wsl-doctor-tool": {
44
- "types": "./lib/wsl-doctor-tool.d.ts",
45
- "default": "./lib/wsl-doctor-tool.js"
46
- },
47
- "./wsl-doctor-command": {
48
- "types": "./lib/wsl-doctor-command.d.ts",
49
- "default": "./lib/wsl-doctor-command.js"
50
- },
51
- "./client": {
52
- "types": "./client.d.ts",
53
- "default": "./client.js"
54
- },
55
43
  "./file-reference-wsl": {
56
44
  "types": "./lib/file-reference-wsl.d.ts",
57
45
  "default": "./lib/file-reference-wsl.js"
@@ -60,14 +48,14 @@
60
48
  "types": "./lib/fs.d.ts",
61
49
  "default": "./lib/fs.js"
62
50
  },
63
- "./index": {
64
- "types": "./lib/index.d.ts",
65
- "default": "./lib/index.js"
66
- },
67
51
  "./fs-routing": {
68
52
  "types": "./lib/fs-routing.d.ts",
69
53
  "default": "./lib/fs-routing.js"
70
54
  },
55
+ "./index": {
56
+ "types": "./lib/index.d.ts",
57
+ "default": "./lib/index.js"
58
+ },
71
59
  "./locale/en.json": "./locale/en.json",
72
60
  "./locale/zh.json": "./locale/zh.json",
73
61
  "./package.json": "./package.json",
@@ -75,16 +63,16 @@
75
63
  "types": "./lib/paths.d.ts",
76
64
  "default": "./lib/paths.js"
77
65
  },
78
- "./preflight": {
79
- "types": "./lib/preflight.d.ts",
80
- "default": "./lib/preflight.js"
81
- },
82
66
  "./picker": {
83
67
  "types": "./lib/picker.d.ts",
84
68
  "default": "./lib/picker.js"
85
69
  },
86
70
  "./picker/locale/en.json": "./locale/picker/en.json",
87
71
  "./picker/locale/zh.json": "./locale/picker/zh.json",
72
+ "./preflight": {
73
+ "types": "./lib/preflight.d.ts",
74
+ "default": "./lib/preflight.js"
75
+ },
88
76
  "./preflight/locale/en.json": "./locale/preflight/en.json",
89
77
  "./preflight/locale/zh.json": "./locale/preflight/zh.json",
90
78
  "./shell": {
@@ -110,6 +98,14 @@
110
98
  "./wsl": {
111
99
  "types": "./lib/wsl.d.ts",
112
100
  "default": "./lib/wsl.js"
101
+ },
102
+ "./wsl-doctor-command": {
103
+ "types": "./lib/wsl-doctor-command.d.ts",
104
+ "default": "./lib/wsl-doctor-command.js"
105
+ },
106
+ "./wsl-doctor-tool": {
107
+ "types": "./lib/wsl-doctor-tool.d.ts",
108
+ "default": "./lib/wsl-doctor-tool.js"
113
109
  }
114
110
  },
115
111
  "dsh": {
@@ -174,12 +170,14 @@
174
170
  "SUPPORT.md",
175
171
  "LICENSE",
176
172
  "scripts/bootstrap.sh",
173
+ "scripts/bootstrap-import.sh",
177
174
  "scripts/diagnose.sh",
178
175
  "scripts/doctor.mjs",
176
+ "scripts/open-wsl-vscode.ps1",
179
177
  "scripts/profile-preset.mjs"
180
178
  ],
181
179
  "scripts": {
182
- "test": "pnpm run lint:style && pnpm run lint:links && pnpm run lint:requirements && pnpm run test:syntax && pnpm run lint:build && pnpm run lint:types && pnpm run test:unit",
180
+ "test": "pnpm run lint:style && pnpm run lint:links && pnpm run lint:requirements && pnpm run lint:docs && pnpm run test:syntax && pnpm run lint:build && pnpm run lint:types && pnpm run test:unit",
183
181
  "lint:types": "tsc --noEmit",
184
182
  "build": "node scripts/build.mjs",
185
183
  "lint:build": "node test/build-freshness.mjs",
@@ -189,6 +187,7 @@
189
187
  "lint:style": "node test/style.mjs",
190
188
  "lint:links": "node scripts/check-links.mjs",
191
189
  "lint:requirements": "node scripts/check-requirements.mjs",
190
+ "lint:docs": "node scripts/check-doc-consistency.mjs",
192
191
  "prepublishOnly": "pnpm test",
193
192
  "probe": "bash test/probe/run.sh",
194
193
  "probe:clean": "rm -rf test/probe/.scratch && mkdir -p test/probe/.scratch",
@@ -217,7 +216,7 @@
217
216
  "e2e:install": "bash test/e2e/install.sh",
218
217
  "canary:peers": "node scripts/peer-canary.mjs"
219
218
  },
220
- "packageManager": "pnpm@11.7.0",
219
+ "packageManager": "pnpm@11.7.0+sha512.19cc852c120c7125760f2443ee6be0ca5b40f9f50598de1a09a1f177503e010e57c23c77646e01e761de59bf874fb22a3398c33ab9691fc13eb946b6f0f4d620",
221
220
  "engines": {
222
221
  "node": "^22.19.0 || >=24.0.0"
223
222
  },
@@ -246,14 +245,13 @@
246
245
  "@deepseek-ai/dsh-fs": "0.2.2-rc.1",
247
246
  "@deepseek-ai/dsh-fs-local": "0.2.2-rc.1",
248
247
  "@deepseek-ai/dsh-fs-patch": "0.2.2-rc.1",
249
- "@deepseek-ai/dsh-fs-sandbox": "0.2.2-rc.1",
250
248
  "@deepseek-ai/dsh-host-directory-picker": "0.2.2-rc.1",
251
249
  "@deepseek-ai/dsh-sandbox": "0.2.2-rc.1",
252
250
  "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.1",
253
251
  "@deepseek-ai/dsh-subprocess": "0.2.2-rc.1",
254
252
  "@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.1",
255
253
  "@deepseek-ai/dsh-tools": "0.2.2-rc.1",
256
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.1",
254
+ "@deepseek-ai/schemastery": "3.19.0",
257
255
  "@types/js-yaml": "^4.0.9",
258
256
  "@types/node": "~22.20.5",
259
257
  "js-yaml": "4.3.2",
@@ -270,7 +268,6 @@
270
268
  "@deepseek-ai/dsh-subprocess": ">=0.2.2-rc.1",
271
269
  "@deepseek-ai/dsh-tools": ">=0.2.2-rc.1",
272
270
  "@deepseek-ai/dsh-subprocess-local": ">=0.2.2-rc.1",
273
- "@deepseek-ai/dsh-typert-protocol": ">=0.2.2-rc.1",
274
271
  "@deepseek-ai/schemastery": "^3.19.0"
275
272
  },
276
273
  "peerDependenciesMeta": {
@@ -298,9 +295,6 @@
298
295
  "@deepseek-ai/dsh-subprocess-local": {
299
296
  "optional": true
300
297
  },
301
- "@deepseek-ai/dsh-typert-protocol": {
302
- "optional": true
303
- },
304
298
  "@deepseek-ai/schemastery": {
305
299
  "optional": true
306
300
  }