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
@@ -67,18 +67,8 @@ export interface AgentExecRunner {
67
67
  /** Run one command. */
68
68
  exec: (request: AgentExecRequest) => Promise<AgentExecResult>;
69
69
  }
70
- /** How the exec promise settled: the result, or the failure to propagate. */
71
- export type SettledExec = {
72
- ok: true;
73
- result: AgentExecResult;
74
- error?: undefined;
75
- } | {
76
- ok: false;
77
- result?: undefined;
78
- error: unknown;
79
- };
80
70
  /** The memory-reader slice of one output stream. */
81
- export interface OutputReader {
71
+ interface OutputReader {
82
72
  /** Read the stream from a byte offset. */
83
73
  readFrom: (fromByte: number) => {
84
74
  text: string;
@@ -168,3 +158,4 @@ export declare function agentExecutionHandle({ agent, cwd, argv, timeoutMs, maxO
168
158
  */
169
159
  onStarted?: (proc: object) => void;
170
160
  }): AgentExecutionHandle;
161
+ export {};
@@ -53,7 +53,7 @@ export declare function encodeB64(value: string | Uint8Array): string;
53
53
  */
54
54
  export declare function decodeB64(value: string): Buffer;
55
55
  /** One EXEC frame's inputs. */
56
- export interface ExecFrameRequest {
56
+ interface ExecFrameRequest {
57
57
  /** Caller-chosen request id (unique per agent). */
58
58
  id: string;
59
59
  /** Linux path to cd into before exec. */
@@ -112,7 +112,7 @@ export declare function encodeSetEnv(key: string, value: string): string;
112
112
  */
113
113
  export declare function encodeKill(id: string): string;
114
114
  /** One FS frame's inputs. */
115
- export interface FsFrameRequest {
115
+ interface FsFrameRequest {
116
116
  /** Caller-chosen request id (unique per agent). */
117
117
  id: string;
118
118
  /** One of the op names `encodeFsFrame` documents. */
@@ -147,7 +147,7 @@ export interface FsFrameRequest {
147
147
  */
148
148
  export declare function encodeFsFrame({ id, op, args, timeoutMs }: FsFrameRequest): string[];
149
149
  /** One op inside a batch frame — the same shape as an FS frame's op and args. */
150
- export interface FsBatchOp {
150
+ interface FsBatchOp {
151
151
  /** The op name (`stat`, `lstat`, `list`, `read`, … — the FS vocabulary). */
152
152
  op: string;
153
153
  /** Op arguments, one wire line each. */
@@ -195,7 +195,7 @@ export interface HelloMessage {
195
195
  caps?: string[];
196
196
  }
197
197
  /** `PONG` — the liveness answer to `PING`. */
198
- export interface PongMessage {
198
+ interface PongMessage {
199
199
  type: "pong";
200
200
  }
201
201
  /**
@@ -246,7 +246,7 @@ export interface FsErrorMessage {
246
246
  * logged and dropped, because a `RES` for a request the host already gave up
247
247
  * on is expected noise.)
248
248
  */
249
- export interface UnknownMessage {
249
+ interface UnknownMessage {
250
250
  type: "unknown";
251
251
  line: string;
252
252
  }
@@ -259,3 +259,4 @@ export type AgentMessage = HelloMessage | PongMessage | AckMessage | ResultMessa
259
259
  * @returns the line's verdict; the message interfaces document each variant.
260
260
  */
261
261
  export declare function parseAgentLine(line: string): AgentMessage;
262
+ export {};
package/lib/agent.d.ts CHANGED
@@ -41,7 +41,7 @@
41
41
  */
42
42
  import type { ChildProcess } from "node:child_process";
43
43
  /** One settled command result, as `exec` resolves it. */
44
- export interface ExecResult {
44
+ interface ExecResult {
45
45
  /** The command's exit status. */
46
46
  exitCode: number;
47
47
  /** Captured stdout. */
@@ -64,7 +64,7 @@ export interface ExecResult {
64
64
  * One request in flight on an agent: its frame, its settlement callbacks, and
65
65
  * the ACK-armed watchdog.
66
66
  */
67
- export interface PendingRequest {
67
+ interface PendingRequest {
68
68
  /** The request id, as the agent echoes it. */
69
69
  id: string;
70
70
  /** The request's numeric sequence; newer requests have a larger one. */
@@ -105,7 +105,7 @@ export interface PendingRequest {
105
105
  signalTimer: NodeJS.Timeout | null;
106
106
  }
107
107
  /** Per-kind request metrics. */
108
- export interface RequestMetrics {
108
+ interface RequestMetrics {
109
109
  /** Requests that settled (successful, failed or cancelled). */
110
110
  requests: number;
111
111
  /** Total queue wait (submission -> ACK), ms. */
@@ -139,7 +139,7 @@ export interface AgentStatus {
139
139
  pending: number;
140
140
  }
141
141
  /** The agent's cumulative request metrics. */
142
- export interface AgentMetrics {
142
+ interface AgentMetrics {
143
143
  /** FS frames. */
144
144
  fs: RequestMetrics;
145
145
  /** EXEC frames (commands, ping). */
@@ -148,7 +148,7 @@ export interface AgentMetrics {
148
148
  inFlightMax: number;
149
149
  }
150
150
  /** The entry an async preparation may select before the first spawn. */
151
- export interface WslAgentPrepared {
151
+ interface WslAgentPrepared {
152
152
  /** The agent entrypoint (the shell script or the native cache path). */
153
153
  scriptPath: string;
154
154
  /** The HELLO digest to verify. */
@@ -53,7 +53,7 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
53
53
  retryMs: z<number, number, "defined">;
54
54
  }>>, "plain">;
55
55
  /** The config schema's validated output. */
56
- export interface AutoPresetConfig {
56
+ interface AutoPresetConfig {
57
57
  /** Preset to bind for a WSL workspace. */
58
58
  preset?: string;
59
59
  /** Attempts before giving up; each waits `retryMs`. */
@@ -65,7 +65,7 @@ export interface AutoPresetConfig {
65
65
  * The slice of a created agent this plugin inspects; the harness's agent
66
66
  * object is structural here.
67
67
  */
68
- export interface CreatedAgentView {
68
+ interface CreatedAgentView {
69
69
  /** The agent's id. */
70
70
  id: string;
71
71
  /** The session stub, when mounted. */
@@ -83,7 +83,7 @@ export interface CreatedAgentView {
83
83
  * packages, whose declarations are not visible to this plugin, so they are
84
84
  * spelled structurally on top of the framework's {@link Context}.
85
85
  */
86
- export type AutoPresetContext = Context & {
86
+ type AutoPresetContext = Context & {
87
87
  agents: {
88
88
  list: () => CreatedAgentView[];
89
89
  };
@@ -108,3 +108,4 @@ export type AutoPresetContext = Context & {
108
108
  * @param config - the schema-validated plugin config.
109
109
  */
110
110
  export declare function apply(ctx: AutoPresetContext, config?: AutoPresetConfig): Promise<void>;
111
+ export {};
package/lib/bwrap.d.ts CHANGED
@@ -24,7 +24,7 @@
24
24
  * @module dsh-plugin-wsl-env/bwrap
25
25
  */
26
26
  /** Profile options shared by the two confinement sites. */
27
- export interface BwrapProfileOptions {
27
+ interface BwrapProfileOptions {
28
28
  /** Shadow `/mnt` with an empty tmpfs. */
29
29
  maskWindowsDrive?: boolean;
30
30
  /**
@@ -96,3 +96,4 @@ export declare function bwrapArgvPrefix(policy: {
96
96
  mode: string;
97
97
  workspaceRoot: string;
98
98
  }, options?: BwrapProfileOptions): string[];
99
+ export {};
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * Compositions that still mount the bare name get the client half (the doctor
18
18
  * composer button) and nothing else; the executor keeps its behavior through
19
- * the explicit subpath. Before 0.20.0 `.` resolved to the executor itself —
19
+ * the explicit subpath. Before 0.21.0 `.` resolved to the executor itself —
20
20
  * a profile that relied on that shape must switch to `dsh-plugin-wsl-env/shell`.
21
21
  *
22
22
  * This is a TypeScript source built to `lib/client-host.js`; edit THIS file and
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * Compositions that still mount the bare name get the client half (the doctor
18
18
  * composer button) and nothing else; the executor keeps its behavior through
19
- * the explicit subpath. Before 0.20.0 `.` resolved to the executor itself —
19
+ * the explicit subpath. Before 0.21.0 `.` resolved to the executor itself —
20
20
  * a profile that relied on that shape must switch to `dsh-plugin-wsl-env/shell`.
21
21
  *
22
22
  * This is a TypeScript source built to `lib/client-host.js`; edit THIS file and
@@ -39,37 +39,20 @@ export declare const name = "wsl-cwd-prompt-tool";
39
39
  * the design (a missing service is a composition error, not a degradation).
40
40
  */
41
41
  export declare const inject: string[];
42
- /** The config schema's validated output: the row takes no options. */
43
- export interface CwdPromptToolConfig {
44
- /** Reserved; the wrapper has no options today. */
45
- enabled?: boolean;
46
- }
47
42
  /** The tool registry slice this service consumes. */
48
- export interface ToolRegistrySlice {
43
+ interface ToolRegistrySlice {
49
44
  register: (tool: unknown) => unknown;
50
45
  }
51
46
  /** The harness's `workingDirectory` service slice the shipped tool uses. */
52
- export interface WorkingDirectoryToolSlice {
47
+ interface WorkingDirectoryToolSlice {
53
48
  ensure: (agent: unknown, signal?: unknown) => Promise<string>;
54
49
  set: (agent: unknown, path: string, signal?: unknown) => Promise<string>;
55
50
  }
56
51
  /** The cordis context slice this service consumes. */
57
- export type CwdPromptToolContext = {
52
+ type CwdPromptToolContext = {
58
53
  tools: ToolRegistrySlice;
59
54
  workingDirectory: WorkingDirectoryToolSlice;
60
55
  };
61
- /** A resolved tool call: what the shipped tool's `execute` receives. */
62
- export interface ToolExec {
63
- /** The live agent, required by the shipped tool too. */
64
- agent: unknown;
65
- /** Cancellation for the underlying directory operations. */
66
- signal?: unknown;
67
- }
68
- /** The tool's result: one rewritten absolute path. */
69
- export interface WorkingDirectoryResult {
70
- /** The current absolute working directory, distro-native on WSL sessions. */
71
- cwd: string;
72
- }
73
56
  /**
74
57
  * A raw absolute path as the model should see it: the POSIX path a WSL UNC
75
58
  * names, and every other path unchanged. This is the single-path sibling of
@@ -86,3 +69,4 @@ export declare function rewriteUncPath(path: string): string;
86
69
  * tool row is disabled by the patch layer).
87
70
  */
88
71
  export declare function apply(ctx: CwdPromptToolContext): Promise<void>;
72
+ export {};
@@ -51,12 +51,12 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
51
51
  enabled: z<boolean, boolean, "defined">;
52
52
  }>>, "plain">;
53
53
  /** The config schema's validated output. */
54
- export interface CwdPromptConfig {
54
+ interface CwdPromptConfig {
55
55
  /** Whether the runtime-context rewrite runs at all. */
56
56
  enabled?: boolean;
57
57
  }
58
58
  /** One named contribution to the assembled system prompt. */
59
- export interface PromptContextEntry {
59
+ interface PromptContextEntry {
60
60
  /** The registry name; the harness's entry is `working-directory:current`. */
61
61
  name?: string;
62
62
  /** The literal contribution text, already resolved by its provider. */
@@ -65,16 +65,16 @@ export interface PromptContextEntry {
65
65
  interpolate?: boolean;
66
66
  }
67
67
  /** The slice of the assembly the waterfall hands around. */
68
- export interface PromptAssembly {
68
+ interface PromptAssembly {
69
69
  /** The named contributions, ordered by registry order. */
70
70
  contexts?: PromptContextEntry[];
71
71
  }
72
72
  /** The waterfall's continuation; resolves to the (possibly rewritten) assembly. */
73
- export type AssembleNext = () => Promise<PromptAssembly>;
73
+ type AssembleNext = () => Promise<PromptAssembly>;
74
74
  /** The waterfall listener's signature, as the harness's own services use it. */
75
- export type AssembleListener = (assembly: PromptAssembly, context: unknown, next: AssembleNext) => Promise<PromptAssembly>;
75
+ type AssembleListener = (assembly: PromptAssembly, context: unknown, next: AssembleNext) => Promise<PromptAssembly>;
76
76
  /** The `systemPrompt` slice an injected agent scope exposes. */
77
- export interface CwdPromptScope {
77
+ interface CwdPromptScope {
78
78
  systemPrompt: {
79
79
  /** Register one context entry in this scope's layer. */
80
80
  context: (entry: {
@@ -89,7 +89,7 @@ export interface CwdPromptScope {
89
89
  };
90
90
  }
91
91
  /** The assembly request context: what a provider's `text` receives. */
92
- export interface AssembleRequestContext {
92
+ interface AssembleRequestContext {
93
93
  /** The live agent, when the assembly runs inside one. */
94
94
  agent?: {
95
95
  session?: {
@@ -100,7 +100,7 @@ export interface AssembleRequestContext {
100
100
  } | undefined;
101
101
  }
102
102
  /** The slice of a created agent this service inspects and injects into. */
103
- export interface CwdPromptAgent {
103
+ interface CwdPromptAgent {
104
104
  /** The session stub, when mounted. */
105
105
  session?: {
106
106
  header?: {
@@ -117,11 +117,11 @@ export interface CwdPromptAgent {
117
117
  * The harness's `working-directory` service, read structurally: only `get`
118
118
  * is consumed, and its absence degrades to the session header's cwd.
119
119
  */
120
- export interface WorkingDirectorySlice {
120
+ interface WorkingDirectorySlice {
121
121
  get?: (session: unknown) => string | undefined;
122
122
  }
123
123
  /** The cordis context slice this service consumes. */
124
- export type CwdPromptContext = {
124
+ type CwdPromptContext = {
125
125
  logger?: {
126
126
  debug?: (message: string) => void;
127
127
  };
@@ -164,3 +164,4 @@ export declare function entryText(agent: AssembleRequestContext["agent"], workin
164
164
  * @param config - the schema-validated plugin config.
165
165
  */
166
166
  export declare function apply(ctx: CwdPromptContext, config?: CwdPromptConfig): void;
167
+ export {};
@@ -17,9 +17,9 @@
17
17
  * @module dsh-plugin-wsl-env/distro-route
18
18
  */
19
19
  /** Why a distro was selected, for diagnostics and for the docs. */
20
- export type DistroSource = "pinned" | "workspace" | "default";
20
+ type DistroSource = "pinned" | "workspace" | "default";
21
21
  /** One distro selection. */
22
- export interface DistroChoice {
22
+ interface DistroChoice {
23
23
  /** The distro name to use. */
24
24
  distro: string;
25
25
  /** Whether the name came from the config, the path, or WSL's default. */
@@ -73,3 +73,4 @@ export declare function selectDistro({ configured, candidates, fallback }: {
73
73
  /** WSL's default distro, already resolved by the caller. */
74
74
  fallback: string;
75
75
  }): DistroChoice;
76
+ export {};
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { AgentStatus } from "./agent.js";
17
17
  /** One check line of the doctor's versioned JSON report. */
18
- export interface DoctorCheck {
18
+ interface DoctorCheck {
19
19
  /** The stable check id, e.g. `agent.handshake`. */
20
20
  id: string;
21
21
  /** `ok` | `warn` | `fail` | `info` | `skipped`. */
@@ -55,3 +55,4 @@ export interface DoctorReport {
55
55
  * there is nothing to merge.
56
56
  */
57
57
  export declare function mergeLiveResidentStatus(report: DoctorReport, status: AgentStatus | undefined): DoctorReport;
58
+ export {};
@@ -47,7 +47,7 @@ type MoveFileOptions = Parameters<FileSystem["moveFile"]>[2];
47
47
  * routed backend reads. The distro keys are `??`-defaulted, so a host-only
48
48
  * config stays valid.
49
49
  */
50
- export interface RoutingConfig {
50
+ interface RoutingConfig {
51
51
  /** The host backend's base directory. */
52
52
  cwd?: string;
53
53
  /** The host backend's overwrite-diff byte bound. */
@@ -265,7 +265,35 @@ export declare class WslRoutingFileSystem extends LocalFileSystem {
265
265
  */
266
266
  contains(parent: FsTarget, child: FsTarget): boolean;
267
267
  /**
268
+ * The host spelling for a distro target: its canonical UNC identity.
269
+ *
270
+ * `processPath` answers "the path in this filesystem's execution world", and
271
+ * the routed backend's target key already IS the coordinate the Host I/O
272
+ * stack uses — the same answer the session backend gives, because it inherits
273
+ * the host implementation (`String(targetKey)`). The root router answered in
274
+ * Linux form before this change; that broke every consumer that treats
275
+ * `processPath` as a HOST path. `session.openWorkspacePath` and
276
+ * `session.workspacePathApplications` verify a path by requiring
277
+ * `fs.processPath(await fs.resolve(fs.processPathFromHostPath(hostPath)))`
278
+ * to equal `hostPath` (`packages/api/session-controller`,
279
+ * `verifyDesktopPath`), and `processPathFromHostPath` is the inherited host
280
+ * implementation — so with a Linux answer the round trip could never close
281
+ * and "Open in app" / "Reveal in file manager" refused every distro file
282
+ * with `Path has no verified Host path`. The same equality drives
283
+ * `ui-deliverables`' presented-file route.
284
+ *
285
+ * The Linux path is still the target's `displayPath` (what the model sees),
286
+ * and `contains` still compares POSIX coordinates; only this accessor — the
287
+ * one the Host's path-taking consumers read — speaks host spelling.
288
+ *
289
+ * The share root is the one spelling the substrate and the Host disagree on:
290
+ * `posixToUnc(distro, "/")` renders `\\wsl.localhost\<distro>\` (a trailing
291
+ * separator), while the Host's `path.resolve` normalizes the same directory
292
+ * to `\\wsl.localhost\<distro>`. Stripping it keeps the round trip closed for
293
+ * a distro root chosen as the workspace.
294
+ *
268
295
  * @param target - the resolved target.
296
+ * @returns the canonical UNC for a distro target, the host path otherwise.
269
297
  */
270
298
  processPath(target: FsTarget): string;
271
299
  }
package/lib/fs-routing.js CHANGED
@@ -356,12 +356,39 @@ export class WslRoutingFileSystem extends LocalFileSystem {
356
356
  return super.contains(parent, child);
357
357
  }
358
358
  /**
359
+ * The host spelling for a distro target: its canonical UNC identity.
360
+ *
361
+ * `processPath` answers "the path in this filesystem's execution world", and
362
+ * the routed backend's target key already IS the coordinate the Host I/O
363
+ * stack uses — the same answer the session backend gives, because it inherits
364
+ * the host implementation (`String(targetKey)`). The root router answered in
365
+ * Linux form before this change; that broke every consumer that treats
366
+ * `processPath` as a HOST path. `session.openWorkspacePath` and
367
+ * `session.workspacePathApplications` verify a path by requiring
368
+ * `fs.processPath(await fs.resolve(fs.processPathFromHostPath(hostPath)))`
369
+ * to equal `hostPath` (`packages/api/session-controller`,
370
+ * `verifyDesktopPath`), and `processPathFromHostPath` is the inherited host
371
+ * implementation — so with a Linux answer the round trip could never close
372
+ * and "Open in app" / "Reveal in file manager" refused every distro file
373
+ * with `Path has no verified Host path`. The same equality drives
374
+ * `ui-deliverables`' presented-file route.
375
+ *
376
+ * The Linux path is still the target's `displayPath` (what the model sees),
377
+ * and `contains` still compares POSIX coordinates; only this accessor — the
378
+ * one the Host's path-taking consumers read — speaks host spelling.
379
+ *
380
+ * The share root is the one spelling the substrate and the Host disagree on:
381
+ * `posixToUnc(distro, "/")` renders `\\wsl.localhost\<distro>\` (a trailing
382
+ * separator), while the Host's `path.resolve` normalizes the same directory
383
+ * to `\\wsl.localhost\<distro>`. Stripping it keeps the round trip closed for
384
+ * a distro root chosen as the workspace.
385
+ *
359
386
  * @param target - the resolved target.
387
+ * @returns the canonical UNC for a distro target, the host path otherwise.
360
388
  */
361
389
  processPath(target) {
362
- const parsed = uncToPosix(target.targetKey);
363
- if (parsed !== undefined)
364
- return parsed.linuxPath.length > 0 ? parsed.linuxPath : "/";
390
+ if (targetIsDistro(target.targetKey))
391
+ return String(target.targetKey).replace(/\\+$/, "");
365
392
  return super.processPath(target);
366
393
  }
367
394
  }
@@ -336,4 +336,3 @@ export declare class AgentSubstrate {
336
336
  };
337
337
  }>;
338
338
  }
339
- export default AgentSubstrate;
@@ -489,4 +489,3 @@ export class AgentSubstrate {
489
489
  }));
490
490
  }
491
491
  }
492
- export default AgentSubstrate;
@@ -21,23 +21,7 @@
21
21
  *
22
22
  * @module dsh-plugin-wsl-env/fsio-agent
23
23
  */
24
- import { normalizeLineEndings, restoreLineEndings, applyLiteralEdit } from "./fsio-text.js";
25
24
  import type { WslAgent } from "./agent.js";
26
- /** One agent FS round trip's result — the shape `WslAgent#fs` resolves to. */
27
- export interface AgentFsResult {
28
- /** The op's exit status. */
29
- exitCode: number;
30
- /** The op's payload bytes. */
31
- stdout: Buffer;
32
- /** The op's diagnostic line(s). */
33
- stderr: Buffer;
34
- /**
35
- * Protocol 7's FS refusal token, when the op failed through the structured
36
- * FSERR line; the adapter maps it onto `FsErrorCode` directly. Undefined
37
- * for legacy (v6) agents, whose refusal rides the stderr convention.
38
- */
39
- reason?: string;
40
- }
41
25
  /**
42
26
  * Normalize one agent timestamp ("seconds.frac", 9 or 10 fractional digits
43
27
  * depending on whether stat or find produced it) into the peer's nanosecond
@@ -91,7 +75,6 @@ export interface ResolvedTarget {
91
75
  /** The UNC identity this target keys on. */
92
76
  targetKey: string;
93
77
  }
94
- export declare const REASON_CODES: Record<string, string>;
95
78
  /**
96
79
  * Map one wire reason token onto the peer's `FsErrorCode` vocabulary.
97
80
  *
@@ -100,7 +83,7 @@ export declare const REASON_CODES: Record<string, string>;
100
83
  */
101
84
  export declare function reasonToCode(reason: string): string;
102
85
  /** One `find` listing row, as `listChildren` shapes it. */
103
- export interface ChildRow {
86
+ interface ChildRow {
104
87
  name: string;
105
88
  type: string;
106
89
  target: {
@@ -111,7 +94,7 @@ export interface ChildRow {
111
94
  size?: number;
112
95
  }
113
96
  /** The stat row `stat` returns. */
114
- export interface StatRow {
97
+ interface StatRow {
115
98
  type: string;
116
99
  mode: number;
117
100
  size: number;
@@ -426,5 +409,4 @@ export declare class DistroFs {
426
409
  */
427
410
  readTextForDiff(target: ResolvedTarget, maxBytes: number, signal?: AbortSignal): Promise<string | null>;
428
411
  }
429
- export { applyLiteralEdit, normalizeLineEndings, restoreLineEndings };
430
- export default DistroFs;
412
+ export {};
package/lib/fsio-agent.js CHANGED
@@ -22,7 +22,7 @@
22
22
  * @module dsh-plugin-wsl-env/fsio-agent
23
23
  */
24
24
  import { FS_READ_CHUNK_BYTES } from "./agent-protocol.js";
25
- import { BINARY_SAMPLE_BYTES, FsCodedError, decodeUtf8, decodeUtf8Stream, detectLineEndings, normalizeLineEndings, restoreLineEndings, applyLiteralEdit, throwIfAborted, } from "./fsio-text.js";
25
+ import { BINARY_SAMPLE_BYTES, FsCodedError, decodeUtf8, decodeUtf8Stream, detectLineEndings, normalizeLineEndings, throwIfAborted, } from "./fsio-text.js";
26
26
  import { posixToUnc, uncToPosix } from "./paths.js";
27
27
  /** One FS frame's in-distro watchdog; fs ops are short, writes bounded by content size. */
28
28
  const FS_OP_TIMEOUT_MS = 30_000;
@@ -73,7 +73,7 @@ export function parseStatRecord(stdout) {
73
73
  version: versionOf({ dev, ino, size, mtimeNs: nanoseconds(mtime), ctimeNs: nanoseconds(ctime) }),
74
74
  };
75
75
  }
76
- export const REASON_CODES = {
76
+ const REASON_CODES = {
77
77
  notfound: "FS_NOT_FOUND",
78
78
  notdir: "FS_NOT_DIRECTORY",
79
79
  perm: "FS_IO_ERROR",
@@ -689,5 +689,3 @@ export class DistroFs {
689
689
  }
690
690
  }
691
691
  }
692
- export { applyLiteralEdit, normalizeLineEndings, restoreLineEndings };
693
- export default DistroFs;
package/lib/git-exec.d.ts CHANGED
@@ -38,7 +38,7 @@
38
38
  */
39
39
  import type { AgentExecRunner } from "./agent-exec.js";
40
40
  /** One collected-stream reader with the seam's standard shape. */
41
- export interface GitStreamReader {
41
+ interface GitStreamReader {
42
42
  /** Read the stream from a byte offset; `lossy` says the cap cut it. */
43
43
  readFrom: (from: number) => {
44
44
  text: string;
@@ -65,7 +65,7 @@ export interface GitExecutionHandle {
65
65
  kill?: () => boolean | void;
66
66
  }
67
67
  /** Per-stream capture budgets the caller declared on its `stdio` spec. */
68
- export interface GitStreamCaps {
68
+ interface GitStreamCaps {
69
69
  /** The stdout budget in bytes; the snapshot's `outputMaxBytes`. */
70
70
  stdout: number;
71
71
  /** The stderr tail budget in bytes. */
@@ -115,3 +115,4 @@ export declare function gitExecutionHandle({ agent, cwd, argv, env, stdin, caps,
115
115
  */
116
116
  spawnFallback: () => GitExecutionHandle;
117
117
  }): GitExecutionHandle;
118
+ export {};
@@ -44,8 +44,10 @@
44
44
  * two shapes into distro paths with the same pure translations the fs seam
45
45
  * uses, forwards every other value verbatim (`GIT_CONFIG_COUNT=0` and
46
46
  * friends), and returns the names that must ride `WSLENV`. One documented
47
- * limit: a colon-separated multi-directory value (none of the current
48
- * callers set one) passes through untranslated.
47
+ * limit: the translation is single-valued, so a Windows-form multi-directory
48
+ * value is not skipped — it folds onto the first drive's mount (`C:\a;D:\b`
49
+ * becomes `/mnt/c/a;D:/b`) — and only a POSIX-form colon list (`/a:/b`)
50
+ * passes through untranslated (none of the current callers set a list).
49
51
  *
50
52
  * This is a TypeScript source built to `lib/git-route.js`; edit THIS file and
51
53
  * run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
package/lib/git-route.js CHANGED
@@ -44,8 +44,10 @@
44
44
  * two shapes into distro paths with the same pure translations the fs seam
45
45
  * uses, forwards every other value verbatim (`GIT_CONFIG_COUNT=0` and
46
46
  * friends), and returns the names that must ride `WSLENV`. One documented
47
- * limit: a colon-separated multi-directory value (none of the current
48
- * callers set one) passes through untranslated.
47
+ * limit: the translation is single-valued, so a Windows-form multi-directory
48
+ * value is not skipped — it folds onto the first drive's mount (`C:\a;D:\b`
49
+ * becomes `/mnt/c/a;D:/b`) — and only a POSIX-form colon list (`/a:/b`)
50
+ * passes through untranslated (none of the current callers set a list).
49
51
  *
50
52
  * This is a TypeScript source built to `lib/git-route.js`; edit THIS file and
51
53
  * run `pnpm run build` — the artifact under `lib/` is generated, and `pnpm test`
package/lib/index.d.ts CHANGED
@@ -68,21 +68,15 @@ type MoveFileOptions = Parameters<FileSystem["moveFile"]>[2];
68
68
  * execution types ride in through the executor's own signatures.
69
69
  */
70
70
  export type ShellExecSpec = Parameters<LocalBashExecutor["execute"]>[0];
71
- export type ShellExecRequest = Parameters<LocalBashExecutor["resolve"]>[0];
71
+ type ShellExecRequest = Parameters<LocalBashExecutor["resolve"]>[0];
72
72
  export type ShellExecution = Awaited<ReturnType<LocalBashExecutor["execute"]>>;
73
- /**
74
- * One confined command's distro-side profile, as the confinement returns it:
75
- * the wrapped argv, the enforcement completeness, the denial dialect, the
76
- * runner-failure rules and the Windows-drive masking fact.
77
- */
78
- export type ConfinedProfile = Awaited<ReturnType<InstanceType<typeof WslSandbox>["confine"]>>;
79
73
  /**
80
74
  * The resolved spec this executor stamps with its home-marker fields: an empty
81
75
  * `workdir` plus the relative tail that {@link WslShellExecutor.withDefaultWorkdir}
82
76
  * joins against the distro home. The extra keys are this provider's own; the
83
77
  * seam's `ShellExecSpec` does not know them.
84
78
  */
85
- export type WslExecSpec = ShellExecSpec & {
79
+ type WslExecSpec = ShellExecSpec & {
86
80
  relativeWorkdir?: string;
87
81
  };
88
82
  /**
@@ -101,6 +95,7 @@ export type WslExecSpec = ShellExecSpec & {
101
95
  *
102
96
  * @param distro - the distro the doctor examines.
103
97
  * @param options - `doctorPath` overrides the shipped script (tests);
98
+ * `timeoutMs` bounds the run; `signal` lets the caller cancel it;
104
99
  * `liveStatus` overrides the in-process status snapshot (tests).
105
100
  * @returns the merged report.
106
101
  */
@@ -126,6 +121,10 @@ export declare function doctorReport(distro: string, options?: {
126
121
  * the ambiguity this option removes.
127
122
  */
128
123
  envPath?: string;
124
+ /** Hard deadline for the subprocess; defaults to two minutes. */
125
+ timeoutMs?: number;
126
+ /** The caller's cancellation (the tool's `exec.signal`); aborts the child. */
127
+ signal?: AbortSignal;
129
128
  liveStatus?: AgentStatus;
130
129
  }): Promise<DoctorReport>;
131
130
  /**
@@ -150,7 +149,7 @@ export declare function effectiveMaskWindowsDrive(config: {
150
149
  interopVisibility?: "visible" | "masked" | "disabled";
151
150
  maskWindowsDrive?: boolean;
152
151
  }): boolean;
153
- export interface WslShellExecutorConfig {
152
+ interface WslShellExecutorConfig {
154
153
  /** The pinned distro; empty means WSL's default. */
155
154
  distro: string;
156
155
  /** The `wsl.exe` path. */
@@ -853,7 +852,7 @@ export declare class WslShellExecutor extends LocalBashExecutor {
853
852
  * type does not know. This provider has no volatile fields: every key is read
854
853
  * as its plain value.
855
854
  */
856
- export interface WslFileSystemConfig {
855
+ interface WslFileSystemConfig {
857
856
  /** The pinned distro; empty resolves WSL's default. */
858
857
  distro: string;
859
858
  /** The base directory for relative input. */