dsh-plugin-wsl-env 0.17.1 → 0.19.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 (110) hide show
  1. package/CHANGELOG.md +225 -0
  2. package/CONTRIBUTING.md +37 -5
  3. package/README.md +61 -6
  4. package/SUPPORT.md +3 -3
  5. package/agent/native/linux-aarch64/dsh-wsl-agent +0 -0
  6. package/agent/native/linux-x86_64/dsh-wsl-agent +0 -0
  7. package/agent/wsl-agent.sh +331 -11
  8. package/cordis.patch.yml +10 -5
  9. package/docs/AGENT-PROTOCOL-V7.md +175 -0
  10. package/docs/API.md +24 -0
  11. package/docs/ARCHITECTURE.md +20 -6
  12. package/docs/COMPATIBILITY.md +1 -1
  13. package/docs/CONFIGURATION.md +33 -5
  14. package/docs/CONFIGURATION.zh.md +25 -4
  15. package/docs/LIMITATIONS.md +39 -7
  16. package/docs/LIMITATIONS.zh.md +31 -6
  17. package/docs/MIGRATION.md +4 -4
  18. package/docs/PEER-PARITY.md +94 -35
  19. package/docs/QUICKSTART.md +19 -2
  20. package/docs/QUICKSTART.zh.md +16 -1
  21. package/docs/README.zh.md +47 -7
  22. package/docs/RELEASING.md +3 -2
  23. package/docs/REQUIREMENTS.zh.md +11 -6
  24. package/docs/ROADMAP-1.0.md +40 -29
  25. package/docs/ROADMAP.md +10 -6
  26. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +6 -1
  27. package/docs/UPSTREAM-FSIO-EXPORT.md +2 -2
  28. package/docs/UPSTREAM-SERVICE-SWAP.md +124 -0
  29. package/docs/UPSTREAM-SESSION-NOTICE.md +3 -1
  30. package/docs/UPSTREAM-TERMINAL-TITLE.md +3 -0
  31. package/docs/root-fs-routing.md +3 -3
  32. package/lib/agent-confined.js +4 -4
  33. package/lib/agent-errors.d.ts +1 -1
  34. package/lib/agent-errors.js +1 -1
  35. package/lib/agent-exec.d.ts +1 -1
  36. package/lib/agent-exec.js +1 -1
  37. package/lib/agent-protocol.d.ts +58 -8
  38. package/lib/agent-protocol.js +40 -7
  39. package/lib/agent-shared.d.ts +1 -1
  40. package/lib/agent-shared.js +1 -1
  41. package/lib/agent.d.ts +171 -1
  42. package/lib/agent.js +448 -288
  43. package/lib/auto-preset.d.ts +1 -1
  44. package/lib/auto-preset.js +1 -1
  45. package/lib/bwrap.d.ts +1 -1
  46. package/lib/bwrap.js +1 -1
  47. package/lib/distro-route.d.ts +1 -1
  48. package/lib/distro-route.js +1 -1
  49. package/lib/doctor-live.d.ts +53 -0
  50. package/lib/doctor-live.js +37 -0
  51. package/lib/file-reference-wsl.d.ts +1 -1
  52. package/lib/file-reference-wsl.js +1 -1
  53. package/lib/fs-decisions.d.ts +1 -1
  54. package/lib/fs-decisions.js +1 -1
  55. package/lib/fs-routing.d.ts +52 -2
  56. package/lib/fs-routing.js +56 -1
  57. package/lib/fs-substrate.d.ts +90 -11
  58. package/lib/fs-substrate.js +202 -1
  59. package/lib/fs.d.ts +1 -1
  60. package/lib/fs.js +1 -1
  61. package/lib/fsio-agent.d.ts +128 -4
  62. package/lib/fsio-agent.js +224 -15
  63. package/lib/fsio-text.d.ts +1 -1
  64. package/lib/fsio-text.js +1 -1
  65. package/lib/git-exec.d.ts +1 -1
  66. package/lib/git-exec.js +1 -1
  67. package/lib/git-route.d.ts +1 -1
  68. package/lib/git-route.js +1 -1
  69. package/lib/index.d.ts +127 -3
  70. package/lib/index.js +301 -99
  71. package/lib/listing.d.ts +1 -1
  72. package/lib/listing.js +1 -1
  73. package/lib/native-agent.d.ts +1 -1
  74. package/lib/native-agent.js +2 -2
  75. package/lib/paths.d.ts +6 -3
  76. package/lib/paths.js +4 -4
  77. package/lib/picker.d.ts +1 -1
  78. package/lib/picker.js +7 -7
  79. package/lib/ports.d.ts +1 -1
  80. package/lib/ports.js +1 -1
  81. package/lib/preflight.d.ts +1 -1
  82. package/lib/preflight.js +1 -1
  83. package/lib/sandbox-core.d.ts +1 -1
  84. package/lib/sandbox-core.js +2 -2
  85. package/lib/sandbox.d.ts +1 -1
  86. package/lib/sandbox.js +1 -1
  87. package/lib/search-exec.d.ts +1 -1
  88. package/lib/search-exec.js +1 -1
  89. package/lib/search-route.d.ts +1 -1
  90. package/lib/search-route.js +1 -1
  91. package/lib/session-runtime.d.ts +1 -1
  92. package/lib/session-runtime.js +2 -2
  93. package/lib/session-scope.d.ts +1 -1
  94. package/lib/session-scope.js +1 -1
  95. package/lib/shell-env.d.ts +1 -1
  96. package/lib/shell-env.js +1 -1
  97. package/lib/shell.d.ts +1 -1
  98. package/lib/shell.js +1 -1
  99. package/lib/subprocess.d.ts +1 -1
  100. package/lib/subprocess.js +2 -2
  101. package/lib/terminal-activity.d.ts +1 -1
  102. package/lib/terminal-activity.js +1 -1
  103. package/lib/terminal-route.d.ts +1 -1
  104. package/lib/terminal-route.js +1 -1
  105. package/lib/watcher.d.ts +1 -1
  106. package/lib/watcher.js +1 -1
  107. package/lib/wsl.d.ts +1 -31
  108. package/lib/wsl.js +1 -21
  109. package/package.json +41 -28
  110. package/scripts/doctor.mjs +34 -11
package/lib/picker.js CHANGED
@@ -45,7 +45,7 @@
45
45
  * `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
46
46
  * fails when it drifts.
47
47
  *
48
- * @module dsh-plugin-wsl/picker
48
+ * @module dsh-plugin-wsl-env/picker
49
49
  */
50
50
  import { mkdir, opendir, stat } from "node:fs/promises";
51
51
  import { homedir } from "node:os";
@@ -327,7 +327,7 @@ export class WslDirectoryPicker extends DirectoryPicker {
327
327
  });
328
328
  if (result.exitCode !== 0) {
329
329
  const detail = result.stderr.toString("utf8").trim();
330
- throw new DirectoryPickerError("directory-unreadable", target, `cannot list ${target}: ${detail.length > 0 ? detail : `ls exited ${result.exitCode}`}`);
330
+ throw new DirectoryPickerError("directory-unreadable", target, `cannot list "${target}": ${detail.length > 0 ? detail : `ls exited ${result.exitCode}`}`);
331
331
  }
332
332
  stdout = result.stdout;
333
333
  }
@@ -338,7 +338,7 @@ export class WslDirectoryPicker extends DirectoryPicker {
338
338
  stdout = await runCapture([this.config.wslPath, "-d", parsed.distro, "--cd", linuxDir, "--exec", ...dirListingArgv(linuxDir)], signal);
339
339
  }
340
340
  catch (fallbackError) {
341
- throw new DirectoryPickerError("directory-unreadable", target, `cannot list ${target}: ${messageOf(fallbackError)}`);
341
+ throw new DirectoryPickerError("directory-unreadable", target, `cannot list "${target}": ${messageOf(fallbackError)}`);
342
342
  }
343
343
  }
344
344
  return parseDirListing(stdout, linuxDir, target, this.config.maxEntries);
@@ -377,7 +377,7 @@ export class WslDirectoryPicker extends DirectoryPicker {
377
377
  }
378
378
  catch (error) {
379
379
  signal?.throwIfAborted();
380
- throw new DirectoryPickerError("directory-unreadable", target, `cannot list ${target}: ${messageOf(error)}`);
380
+ throw new DirectoryPickerError("directory-unreadable", target, `cannot list "${target}": ${messageOf(error)}`);
381
381
  }
382
382
  finally {
383
383
  if (level !== undefined)
@@ -425,7 +425,7 @@ export class WslDirectoryPicker extends DirectoryPicker {
425
425
  if (typeof error === "object" && error !== null && "code" in error && error.code === "EEXIST") {
426
426
  throw new DirectoryPickerError("directory-exists", target, `${target} already exists`);
427
427
  }
428
- throw new DirectoryPickerError("directory-create-failed", target, `cannot create ${target}: ${messageOf(error)}`);
428
+ throw new DirectoryPickerError("directory-create-failed", target, `cannot create "${target}": ${messageOf(error)}`);
429
429
  }
430
430
  }
431
431
  /**
@@ -450,7 +450,7 @@ export class WslDirectoryPicker extends DirectoryPicker {
450
450
  const detail = result.stderr.toString("utf8");
451
451
  if (/File exists/i.test(detail))
452
452
  throw new DirectoryPickerError("directory-exists", target, `${target} already exists`);
453
- throw new DirectoryPickerError("directory-create-failed", target, `cannot create ${target}: ${detail.trim().length > 0 ? detail.trim() : `mkdir exited ${result.exitCode}`}`);
453
+ throw new DirectoryPickerError("directory-create-failed", target, `cannot create "${target}": ${detail.trim().length > 0 ? detail.trim() : `mkdir exited ${result.exitCode}`}`);
454
454
  }
455
455
  catch (error) {
456
456
  if (error instanceof DirectoryPickerError)
@@ -465,7 +465,7 @@ export class WslDirectoryPicker extends DirectoryPicker {
465
465
  const message = messageOf(fallbackError);
466
466
  if (/File exists/i.test(message))
467
467
  throw new DirectoryPickerError("directory-exists", target, `${target} already exists`);
468
- throw new DirectoryPickerError("directory-create-failed", target, `cannot create ${target}: ${message}`);
468
+ throw new DirectoryPickerError("directory-create-failed", target, `cannot create "${target}": ${message}`);
469
469
  }
470
470
  }
471
471
  }
package/lib/ports.d.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
18
18
  * fails when it drifts.
19
19
  *
20
- * @module dsh-plugin-wsl/ports
20
+ * @module dsh-plugin-wsl-env/ports
21
21
  */
22
22
  import type { AgentExecRunner } from "./agent-exec.js";
23
23
  /**
package/lib/ports.js CHANGED
@@ -17,7 +17,7 @@
17
17
  * `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
18
18
  * fails when it drifts.
19
19
  *
20
- * @module dsh-plugin-wsl/ports
20
+ * @module dsh-plugin-wsl-env/ports
21
21
  */
22
22
  /**
23
23
  * Parse one `/proc/net/tcp{,6}` body into listening ports.
@@ -21,7 +21,7 @@
21
21
  * run `pnpm run build` — the artifact under `lib/` is generated, and
22
22
  * `pnpm test` fails when it drifts.
23
23
  *
24
- * @module dsh-plugin-wsl/preflight
24
+ * @module dsh-plugin-wsl-env/preflight
25
25
  */
26
26
  import z from "@deepseek-ai/schemastery";
27
27
  import type { Context } from "@deepseek-ai/cordis";
package/lib/preflight.js CHANGED
@@ -21,7 +21,7 @@
21
21
  * run `pnpm run build` — the artifact under `lib/` is generated, and
22
22
  * `pnpm test` fails when it drifts.
23
23
  *
24
- * @module dsh-plugin-wsl/preflight
24
+ * @module dsh-plugin-wsl-env/preflight
25
25
  */
26
26
  import z from "@deepseek-ai/schemastery";
27
27
  import { isWslUnc } from "./paths.js";
@@ -14,7 +14,7 @@
14
14
  * and run `pnpm run build` — the artifact under `lib/` is generated, and
15
15
  * `pnpm test` fails when it drifts.
16
16
  *
17
- * @module dsh-plugin-wsl/sandbox-core
17
+ * @module dsh-plugin-wsl-env/sandbox-core
18
18
  */
19
19
  /**
20
20
  * The canonical remedy for a distro whose `bwrap` is missing — also the
@@ -14,7 +14,7 @@
14
14
  * and run `pnpm run build` — the artifact under `lib/` is generated, and
15
15
  * `pnpm test` fails when it drifts.
16
16
  *
17
- * @module dsh-plugin-wsl/sandbox-core
17
+ * @module dsh-plugin-wsl-env/sandbox-core
18
18
  */
19
19
  import { createProbeCache } from "./probe-cache.js";
20
20
  import { toLinuxPath } from "./paths.js";
@@ -295,7 +295,7 @@ export function createSandboxCore({ SandboxUnavailableError }) {
295
295
  if (!(await this.usable(distro, signal))) {
296
296
  throw new SandboxUnavailableError(policy.mode, bwrapFailure(this.wslPath, distro) ?? missingBwrapRemedy(distro));
297
297
  }
298
- const workspaceRoot = toLinuxPath(policy.workspaceRoot, { distro });
298
+ const workspaceRoot = toLinuxPath(policy.workspaceRoot);
299
299
  const prefix = bwrapArgvPrefix({ ...policy, workspaceRoot }, { maskWindowsDrive: this.maskWindowsDrive });
300
300
  return {
301
301
  argv: [...prefix, ...argv],
package/lib/sandbox.d.ts CHANGED
@@ -34,7 +34,7 @@
34
34
  * `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
35
35
  * fails when it drifts.
36
36
  *
37
- * @module dsh-plugin-wsl/sandbox
37
+ * @module dsh-plugin-wsl-env/sandbox
38
38
  */
39
39
  export { bwrapProfileArgs } from "./bwrap.js";
40
40
  /**
package/lib/sandbox.js CHANGED
@@ -34,7 +34,7 @@
34
34
  * `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
35
35
  * fails when it drifts.
36
36
  *
37
- * @module dsh-plugin-wsl/sandbox
37
+ * @module dsh-plugin-wsl-env/sandbox
38
38
  */
39
39
  import { SandboxUnavailableError } from "@deepseek-ai/dsh-sandbox";
40
40
  import { createSandboxCore } from "./sandbox-core.js";
@@ -27,7 +27,7 @@
27
27
  * run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
28
28
  * fails when it drifts.
29
29
  *
30
- * @module dsh-plugin-wsl/search-exec
30
+ * @module dsh-plugin-wsl-env/search-exec
31
31
  */
32
32
  import type { AgentExecRunner } from "./agent-exec.js";
33
33
  /**
@@ -27,7 +27,7 @@
27
27
  * run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
28
28
  * fails when it drifts.
29
29
  *
30
- * @module dsh-plugin-wsl/search-exec
30
+ * @module dsh-plugin-wsl-env/search-exec
31
31
  */
32
32
  import { AgentUnavailableError } from "./agent-errors.js";
33
33
  /**
@@ -37,7 +37,7 @@
37
37
  * and run `pnpm run build` — the artifact under `lib/` is generated, and
38
38
  * `pnpm test` fails when it drifts.
39
39
  *
40
- * @module dsh-plugin-wsl/search-route
40
+ * @module dsh-plugin-wsl-env/search-route
41
41
  */
42
42
  /**
43
43
  * Whether a spawn's program is the ripgrep binary.
@@ -37,7 +37,7 @@
37
37
  * and run `pnpm run build` — the artifact under `lib/` is generated, and
38
38
  * `pnpm test` fails when it drifts.
39
39
  *
40
- * @module dsh-plugin-wsl/search-route
40
+ * @module dsh-plugin-wsl-env/search-route
41
41
  */
42
42
  import { uncToPosix } from "./paths.js";
43
43
  /** The one program this rewrite passes through to the distro. */
@@ -22,7 +22,7 @@
22
22
  * file and run `pnpm run build` — the artifact under `lib/` is generated, and
23
23
  * `pnpm test` fails when it drifts.
24
24
  *
25
- * @module dsh-plugin-wsl/session-runtime
25
+ * @module dsh-plugin-wsl-env/session-runtime
26
26
  */
27
27
  import { WslAgent } from "./agent.js";
28
28
  /**
@@ -22,7 +22,7 @@
22
22
  * file and run `pnpm run build` — the artifact under `lib/` is generated, and
23
23
  * `pnpm test` fails when it drifts.
24
24
  *
25
- * @module dsh-plugin-wsl/session-runtime
25
+ * @module dsh-plugin-wsl-env/session-runtime
26
26
  */
27
27
  import { spawn } from "node:child_process";
28
28
  import { randomUUID } from "node:crypto";
@@ -165,7 +165,7 @@ export class SessionRuntimes {
165
165
  const unit = sessionScopeUnit(request.distro, this.token());
166
166
  const prefix = sessionScopePrefix(unit);
167
167
  if (request.mode !== "danger-full-access") {
168
- prefix.push(...bwrapArgvPrefix({ mode: request.mode, workspaceRoot: toLinuxPath(request.workspaceRoot, { distro: request.distro }) }, { maskWindowsDrive: request.maskWindowsDrive, realTmp: true, pidNamespace: false }));
168
+ prefix.push(...bwrapArgvPrefix({ mode: request.mode, workspaceRoot: toLinuxPath(request.workspaceRoot) }, { maskWindowsDrive: request.maskWindowsDrive, realTmp: true, pidNamespace: false }));
169
169
  }
170
170
  const agent = this.spawnAgent({
171
171
  distro: request.distro,
@@ -17,7 +17,7 @@
17
17
  * and run `pnpm run build` — the artifact under `lib/` is generated, and
18
18
  * `pnpm test` fails when it drifts.
19
19
  *
20
- * @module dsh-plugin-wsl/session-scope
20
+ * @module dsh-plugin-wsl-env/session-scope
21
21
  */
22
22
  /**
23
23
  * Build the systemd user unit name for one session runtime.
@@ -17,7 +17,7 @@
17
17
  * and run `pnpm run build` — the artifact under `lib/` is generated, and
18
18
  * `pnpm test` fails when it drifts.
19
19
  *
20
- * @module dsh-plugin-wsl/session-scope
20
+ * @module dsh-plugin-wsl-env/session-scope
21
21
  */
22
22
  /** The longest piece of a unit name this builder emits, per component. */
23
23
  const MAX_COMPONENT = 64;
@@ -24,7 +24,7 @@
24
24
  * run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
25
25
  * fails when it drifts.
26
26
  *
27
- * @module dsh-plugin-wsl/shell-env
27
+ * @module dsh-plugin-wsl-env/shell-env
28
28
  */
29
29
  import z from "@deepseek-ai/schemastery";
30
30
  import type { Context } from "@deepseek-ai/cordis";
package/lib/shell-env.js CHANGED
@@ -24,7 +24,7 @@
24
24
  * run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
25
25
  * fails when it drifts.
26
26
  *
27
- * @module dsh-plugin-wsl/shell-env
27
+ * @module dsh-plugin-wsl-env/shell-env
28
28
  */
29
29
  import z from "@deepseek-ai/schemastery";
30
30
  import { uncToPosix } from "./paths.js";
package/lib/shell.d.ts CHANGED
@@ -5,6 +5,6 @@
5
5
  * `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
6
6
  * fails when it drifts.
7
7
  *
8
- * @module dsh-plugin-wsl/shell
8
+ * @module dsh-plugin-wsl-env/shell
9
9
  */
10
10
  export { WslShellExecutor as default, WslShellExecutor } from "./index.js";
package/lib/shell.js CHANGED
@@ -5,6 +5,6 @@
5
5
  * `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
6
6
  * fails when it drifts.
7
7
  *
8
- * @module dsh-plugin-wsl/shell
8
+ * @module dsh-plugin-wsl-env/shell
9
9
  */
10
10
  export { WslShellExecutor as default, WslShellExecutor } from "./index.js";
@@ -80,7 +80,7 @@
80
80
  * run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
81
81
  * fails when it drifts.
82
82
  *
83
- * @module dsh-plugin-wsl/subprocess
83
+ * @module dsh-plugin-wsl-env/subprocess
84
84
  */
85
85
  import z from "@deepseek-ai/schemastery";
86
86
  import { LocalSubprocessRuntime } from "@deepseek-ai/dsh-subprocess-local";
package/lib/subprocess.js CHANGED
@@ -80,7 +80,7 @@
80
80
  * run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
81
81
  * fails when it drifts.
82
82
  *
83
- * @module dsh-plugin-wsl/subprocess
83
+ * @module dsh-plugin-wsl-env/subprocess
84
84
  */
85
85
  import { randomUUID } from "node:crypto";
86
86
  import { Buffer } from "node:buffer";
@@ -224,7 +224,7 @@ export class WslSubprocessRuntime extends LocalSubprocessRuntime {
224
224
  const mounted = windowsToLinuxMount(text);
225
225
  if (mounted !== undefined)
226
226
  return { distro, linuxCwd: mounted };
227
- return { distro, linuxCwd: toLinuxPath(this.config.cwd, { distro }) };
227
+ return { distro, linuxCwd: toLinuxPath(this.config.cwd) };
228
228
  }
229
229
  /**
230
230
  * Open one interactive shell inside the distro over the host's PTY.
@@ -33,7 +33,7 @@
33
33
  * file and run `pnpm run build` — the artifact under `lib/` is generated, and
34
34
  * `pnpm test` fails when it drifts.
35
35
  *
36
- * @module dsh-plugin-wsl/terminal-activity
36
+ * @module dsh-plugin-wsl-env/terminal-activity
37
37
  */
38
38
  import type { SubprocessTerminalHandle } from "@deepseek-ai/dsh-subprocess";
39
39
  /** The env name that marks one terminal's process tree inside the distro. */
@@ -33,7 +33,7 @@
33
33
  * file and run `pnpm run build` — the artifact under `lib/` is generated, and
34
34
  * `pnpm test` fails when it drifts.
35
35
  *
36
- * @module dsh-plugin-wsl/terminal-activity
36
+ * @module dsh-plugin-wsl-env/terminal-activity
37
37
  */
38
38
  /** The env name that marks one terminal's process tree inside the distro. */
39
39
  export const TERMINAL_ID_ENV = "DSH_TERMINAL_ID";
@@ -15,7 +15,7 @@
15
15
  * and run `pnpm run build` — the artifact under `lib/` is generated, and
16
16
  * `pnpm test` fails when it drifts.
17
17
  *
18
- * @module dsh-plugin-wsl/terminal-route
18
+ * @module dsh-plugin-wsl-env/terminal-route
19
19
  */
20
20
  /**
21
21
  * The route decision for one terminal launch.
@@ -15,7 +15,7 @@
15
15
  * and run `pnpm run build` — the artifact under `lib/` is generated, and
16
16
  * `pnpm test` fails when it drifts.
17
17
  *
18
- * @module dsh-plugin-wsl/terminal-route
18
+ * @module dsh-plugin-wsl-env/terminal-route
19
19
  */
20
20
  import { isPosixAbsolute, uncToPosix, windowsToLinuxMount } from "./paths.js";
21
21
  /**
package/lib/watcher.d.ts CHANGED
@@ -44,7 +44,7 @@
44
44
  * run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
45
45
  * fails when it drifts.
46
46
  *
47
- * @module dsh-plugin-wsl/watcher
47
+ * @module dsh-plugin-wsl-env/watcher
48
48
  */
49
49
  import type { ChildProcess } from "node:child_process";
50
50
  /**
package/lib/watcher.js CHANGED
@@ -44,7 +44,7 @@
44
44
  * run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
45
45
  * fails when it drifts.
46
46
  *
47
- * @module dsh-plugin-wsl/watcher
47
+ * @module dsh-plugin-wsl-env/watcher
48
48
  */
49
49
  import { spawn } from "node:child_process";
50
50
  import { createInterface } from "node:readline";
package/lib/wsl.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
11
11
  * fails when it drifts.
12
12
  *
13
- * @module dsh-plugin-wsl/wsl
13
+ * @module dsh-plugin-wsl-env/wsl
14
14
  */
15
15
  /**
16
16
  * What every `wsl.exe` call may tune: the executable path and cancellation.
@@ -234,33 +234,3 @@ export interface WslShellProbeOptions {
234
234
  * both probes failed.
235
235
  */
236
236
  export declare function defaultShell(distro: string, options?: WslShellProbeOptions): Promise<string | undefined>;
237
- /**
238
- * What {@link runInDistro} reads: the `wsl.exe` path, an explicit shell, and
239
- * optional cancellation and login mode.
240
- */
241
- export interface WslRunOptions {
242
- /** Executable name or absolute path. */
243
- wslPath?: string;
244
- /**
245
- * An absolute path to the shell; resolved from the distro when omitted.
246
- */
247
- shell?: string;
248
- /** Optional cancellation. */
249
- signal?: AbortSignal;
250
- /**
251
- * Whether login-shell semantics were requested; defaults to true.
252
- */
253
- loginShell?: boolean;
254
- }
255
- /**
256
- * Run one command inside a distro and return raw stdout. Used by callers that
257
- * want Linux semantics instead of the UNC share's.
258
- *
259
- * @param distro - distro name.
260
- * @param command - a shell command string.
261
- * @param options - the `wsl.exe` path, an explicit `shell`, and optional
262
- * cancellation.
263
- * @returns captured stdout.
264
- * @throws when neither the caller nor the distro names a usable shell.
265
- */
266
- export declare function runInDistro(distro: string, command: string, options?: WslRunOptions): Promise<string>;
package/lib/wsl.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
11
11
  * fails when it drifts.
12
12
  *
13
- * @module dsh-plugin-wsl/wsl
13
+ * @module dsh-plugin-wsl-env/wsl
14
14
  */
15
15
  import { execFile } from "node:child_process";
16
16
  import { posixToUnc } from "./paths.js";
@@ -327,23 +327,3 @@ export async function defaultShell(distro, options = {}) {
327
327
  (await ask('printf %s "$SHELL"')) ??
328
328
  undefined);
329
329
  }
330
- /**
331
- * Run one command inside a distro and return raw stdout. Used by callers that
332
- * want Linux semantics instead of the UNC share's.
333
- *
334
- * @param distro - distro name.
335
- * @param command - a shell command string.
336
- * @param options - the `wsl.exe` path, an explicit `shell`, and optional
337
- * cancellation.
338
- * @returns captured stdout.
339
- * @throws when neither the caller nor the distro names a usable shell.
340
- */
341
- export async function runInDistro(distro, command, options = {}) {
342
- const shell = options.shell ?? (await defaultShell(distro, options));
343
- if (shell === undefined) {
344
- throw new Error(`dsh-plugin-wsl: distro "${distro}" named no usable shell (passwd probe and $SHELL both failed). ` +
345
- `Check the user's login shell in /etc/passwd (\`getent passwd "$(id -u)"\` inside the distro), ` +
346
- `or point this row's \`shell\` at an existing absolute path.`);
347
- }
348
- return runCapture([options.wslPath ?? DEFAULT_WSL_PATH, "-d", distro, "--exec", shell, ...shellArgs(shell, options.loginShell !== false), command], options.signal);
349
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-wsl-env",
3
- "version": "0.17.1",
3
+ "version": "0.19.0",
4
4
  "description": "在 WSL 的 Linux 实例中打开项目工作区,在对应 Linux 空间中进行命令执行、运行 shell 脚本和文件访问,以获得全套 Linux Shell 工具链收益,并通过 bubblewrap 对命令进行沙箱隔离",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -36,6 +36,10 @@
36
36
  "types": "./lib/fs.d.ts",
37
37
  "default": "./lib/fs.js"
38
38
  },
39
+ "./index": {
40
+ "types": "./lib/index.d.ts",
41
+ "default": "./lib/index.js"
42
+ },
39
43
  "./fs-routing": {
40
44
  "types": "./lib/fs-routing.d.ts",
41
45
  "default": "./lib/fs-routing.js"
@@ -103,9 +107,9 @@
103
107
  "docs/LIMITATIONS.zh.md",
104
108
  "docs/CONFIGURATION.zh.md",
105
109
  "docs/QUICKSTART.zh.md",
110
+ "docs/REQUIREMENTS.zh.md",
106
111
  "docs/LIMITATIONS.md",
107
112
  "docs/RELEASING.md",
108
- "docs/REQUIREMENTS.zh.md",
109
113
  "docs/root-fs-routing.md",
110
114
  "docs/VALUE.zh.md",
111
115
  "docs/UPSTREAM-OPEN-IN-APP.md",
@@ -117,7 +121,10 @@
117
121
  "docs/UPSTREAM-FILE-REFERENCE-SEAM.md",
118
122
  "docs/MIGRATION.md",
119
123
  "docs/UPSTREAM-SESSION-NOTICE.md",
124
+ "docs/UPSTREAM-SERVICE-SWAP.md",
125
+ "docs/AGENT-PROTOCOL-V7.md",
120
126
  "docs/UPSTREAM-TERMINAL-TITLE.md",
127
+ "docs/API.md",
121
128
  "docs/ARCHITECTURE.md",
122
129
  "docs/ROADMAP.md",
123
130
  "docs/ROADMAP-1.0.md",
@@ -132,17 +139,20 @@
132
139
  "scripts/profile-preset.mjs"
133
140
  ],
134
141
  "scripts": {
135
- "test": "pnpm run lint:style && pnpm run lint:links && pnpm run test:syntax && pnpm run lint:build && pnpm run lint:types && pnpm run test:unit",
142
+ "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",
136
143
  "lint:types": "tsc --noEmit",
137
144
  "build": "node scripts/build.mjs",
138
145
  "lint:build": "node test/build-freshness.mjs",
139
- "test:coverage": "node --test --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=84 --test-coverage-functions=70 --test-coverage-exclude='scripts/**' --test-coverage-exclude='test/**' test/agent-exec.test.mjs test/agent-fs-script.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/fs-substrate.test.mjs test/fs.boot.test.mjs test/composition.test.mjs test/provider.test.mjs test/file-reference-wsl.test.mjs test/fsio-agent.test.mjs test/fsio-text.test.mjs test/git-route.test.mjs test/listing.test.mjs test/paths.test.mjs test/ports.test.mjs test/preset-choice.test.mjs test/probe-cache.test.mjs test/preflight.test.mjs test/sandbox.test.mjs test/search-exec.test.mjs test/search-route.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal-activity.test.mjs test/terminal.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/doctor.test.mjs test/profile-preset.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs",
146
+ "test:coverage": "node scripts/coverage-gate.mjs -- node --test --test-timeout=60000 --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=84 --test-coverage-functions=70 --test-coverage-exclude='scripts/**' --test-coverage-exclude='test/**' test/agent-exec.test.mjs test/agent-fs-script.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/fs-substrate.test.mjs test/fs.boot.test.mjs test/composition.test.mjs test/provider.test.mjs test/file-reference-wsl.test.mjs test/fsio-agent.test.mjs test/fsio-text.test.mjs test/git-exec.test.mjs test/git-route.test.mjs test/listing.test.mjs test/paths.test.mjs test/ports.test.mjs test/preset-choice.test.mjs test/probe-cache.test.mjs test/preflight.test.mjs test/sandbox.test.mjs test/search-exec.test.mjs test/search-route.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal-activity.test.mjs test/terminal.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/doctor.test.mjs test/profile-preset.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs",
140
147
  "test:syntax": "node test/syntax.mjs",
141
- "test:unit": "node --test test/fs.boot.test.mjs test/fsio-text.test.mjs test/composition.test.mjs test/provider.test.mjs test/file-reference-wsl.test.mjs test/paths.test.mjs test/listing.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal.test.mjs test/probe-cache.test.mjs test/preflight.test.mjs test/preset-choice.test.mjs test/sandbox.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/agent-fs-script.test.mjs test/fsio-agent.test.mjs test/fs-substrate.test.mjs test/agent-exec.test.mjs test/ports.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/git-route.test.mjs test/search-route.test.mjs test/search-exec.test.mjs test/terminal-activity.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/doctor.test.mjs test/profile-preset.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs",
148
+ "test:unit": "node scripts/test-watchdog.mjs -- node --test --test-timeout=60000 test/fs.boot.test.mjs test/fsio-text.test.mjs test/composition.test.mjs test/provider.test.mjs test/file-reference-wsl.test.mjs test/paths.test.mjs test/listing.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal.test.mjs test/probe-cache.test.mjs test/preflight.test.mjs test/preset-choice.test.mjs test/sandbox.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/agent-fs-script.test.mjs test/fsio-agent.test.mjs test/fs-substrate.test.mjs test/agent-exec.test.mjs test/ports.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/git-exec.test.mjs test/git-route.test.mjs test/search-route.test.mjs test/search-exec.test.mjs test/terminal-activity.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/doctor.test.mjs test/profile-preset.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs",
142
149
  "lint:style": "node test/style.mjs",
143
150
  "lint:links": "node scripts/check-links.mjs",
151
+ "lint:requirements": "node scripts/check-requirements.mjs",
144
152
  "prepublishOnly": "pnpm test",
145
153
  "probe": "bash test/probe/run.sh",
154
+ "probe:clean": "rm -rf test/probe/.scratch && mkdir -p test/probe/.scratch",
155
+ "probe:all-closed": "bash test/probe/run-all-when-closed.sh",
146
156
  "probe:missing-wsl": "bash test/probe/missing-wsl.sh",
147
157
  "probe:mode": "bash test/probe/mode.sh",
148
158
  "probe:picker": "bash test/probe/picker.sh",
@@ -158,6 +168,7 @@
158
168
  "probe:exec": "bash test/probe/exec.sh",
159
169
  "probe:fs-routing": "bash test/probe/fs-routing.sh",
160
170
  "probe:gui-preview": "bash test/probe/gui-preview.sh",
171
+ "probe:gui-preview-batch": "bash test/probe/gui-preview-batch.sh",
161
172
  "probe:file-reference": "bash test/probe/file-reference-9p.sh",
162
173
  "bootstrap": "bash scripts/bootstrap.sh",
163
174
  "diagnose": "bash scripts/diagnose.sh",
@@ -188,35 +199,37 @@
188
199
  "url": "https://github.com/Big-Dao/dsh-plugin-wsl-env/issues"
189
200
  },
190
201
  "devDependencies": {
191
- "@deepseek-ai/cordis": "4.0.5",
192
- "@deepseek-ai/cordis-plugin-include": "*",
193
- "@deepseek-ai/cordis-plugin-loader": "*",
194
- "@deepseek-ai/dsh-bash-local": "0.2.1-rc.3",
195
- "@deepseek-ai/dsh-fs": "0.2.1-rc.3",
196
- "@deepseek-ai/dsh-fs-local": "0.2.1-rc.3",
197
- "@deepseek-ai/dsh-fs-sandbox": "0.2.1-rc.3",
198
- "@deepseek-ai/dsh-host-directory-picker": "0.2.1-rc.3",
199
- "@deepseek-ai/dsh-sandbox": "0.2.1-rc.3",
200
- "@deepseek-ai/dsh-sandbox-policy": "0.2.1-rc.3",
201
- "@deepseek-ai/dsh-subprocess": "0.2.1-rc.3",
202
- "@deepseek-ai/dsh-subprocess-local": "0.2.1-rc.3",
203
- "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.3",
202
+ "@deepseek-ai/cordis": "4.1.0",
203
+ "@deepseek-ai/cordis-plugin-include": "1.1.0",
204
+ "@deepseek-ai/cordis-plugin-loader": "1.1.0",
205
+ "@deepseek-ai/dsh-bash-local": "0.2.2-rc.1",
206
+ "@deepseek-ai/dsh-fs": "0.2.2-rc.1",
207
+ "@deepseek-ai/dsh-fs-local": "0.2.2-rc.1",
208
+ "@deepseek-ai/dsh-fs-patch": "0.2.2-rc.1",
209
+ "@deepseek-ai/dsh-fs-sandbox": "0.2.2-rc.1",
210
+ "@deepseek-ai/dsh-host-directory-picker": "0.2.2-rc.1",
211
+ "@deepseek-ai/dsh-sandbox": "0.2.2-rc.1",
212
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.1",
213
+ "@deepseek-ai/dsh-subprocess": "0.2.2-rc.1",
214
+ "@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.1",
215
+ "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.1",
204
216
  "@types/js-yaml": "^4.0.9",
205
217
  "@types/node": "~22.20.5",
206
218
  "js-yaml": "4.3.2",
207
219
  "typescript": "~6.0.3"
208
220
  },
209
221
  "peerDependencies": {
210
- "@deepseek-ai/cordis": "^4.0.5",
211
- "@deepseek-ai/dsh-bash-local": ">=0.2.1-rc.3",
212
- "@deepseek-ai/dsh-fs": ">=0.2.1-rc.3",
213
- "@deepseek-ai/dsh-fs-local": ">=0.2.1-rc.3",
214
- "@deepseek-ai/dsh-host-directory-picker": ">=0.2.1-rc.3",
215
- "@deepseek-ai/dsh-sandbox": ">=0.2.1-rc.3",
216
- "@deepseek-ai/dsh-subprocess": ">=0.2.1-rc.3",
217
- "@deepseek-ai/dsh-subprocess-local": ">=0.2.1-rc.3",
218
- "@deepseek-ai/dsh-typert-protocol": ">=0.2.1-rc.3",
219
- "@deepseek-ai/schemastery": "^3.18.5"
222
+ "@deepseek-ai/cordis": "^4.1.0",
223
+ "@deepseek-ai/dsh-bash-local": ">=0.2.2-rc.1",
224
+ "@deepseek-ai/dsh-fs": ">=0.2.2-rc.1",
225
+ "@deepseek-ai/dsh-fs-local": ">=0.2.2-rc.1",
226
+ "@deepseek-ai/dsh-fs-patch": ">=0.2.2-rc.1",
227
+ "@deepseek-ai/dsh-host-directory-picker": ">=0.2.2-rc.1",
228
+ "@deepseek-ai/dsh-sandbox": ">=0.2.2-rc.1",
229
+ "@deepseek-ai/dsh-subprocess": ">=0.2.2-rc.1",
230
+ "@deepseek-ai/dsh-subprocess-local": ">=0.2.2-rc.1",
231
+ "@deepseek-ai/dsh-typert-protocol": ">=0.2.2-rc.1",
232
+ "@deepseek-ai/schemastery": "^3.19.0"
220
233
  },
221
234
  "peerDependenciesMeta": {
222
235
  "@deepseek-ai/cordis": {