@banzhe/dsh-devcontainer 0.0.0-stage → 0.2.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.
package/lib/fs.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","names":["KNOWN_CODES"],"sources":["../src/helper-source.ts","../src/rpc/errors.ts","../src/rpc/frames.ts","../src/rpc/client.ts","../src/rpc/pool.ts","../src/rpc/wire.ts","../src/fs.ts"],"sourcesContent":["/**\n * The container-side helper program, as text.\n *\n * The source ships as a plain \\`.mjs\\` next to the bundled rows because the\n * container runs it with its own \\`node\\` — nothing in this repository compiles it.\n * Both layouts resolve through the same relative path: \\`src/helper/main.mjs\\`\n * while running from source, and \\`lib/helper/main.mjs\\` in the built package.\n * @module @banzhe/dsh-devcontainer/helper-source\n */\n\nimport { readFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\n/** Where the helper program lives inside the container. */\nexport const HELPER_CONTAINER_PATH = '/tmp/.dsh-devcontainer/helper.mjs'\n\n/** The container directory the helper is staged in. */\nexport const HELPER_CONTAINER_DIRECTORY = '/tmp/.dsh-devcontainer'\n\nlet cached: string | undefined\n\n/**\n * The absolute path of the helper program on this host.\n * @returns the path of the shipped \\`main.mjs\\`.\n */\nexport function helperSourcePath(): string {\n return join(dirname(fileURLToPath(import.meta.url)), 'helper', 'main.mjs')\n}\n\n/**\n * Read the helper program that is staged into the container.\n * @returns the program text, read once per process.\n * @throws Error naming the missing path when the packaged file is absent.\n */\nexport function helperSource(): string {\n if (cached !== undefined) return cached\n const path = helperSourcePath()\n try {\n cached = readFileSync(path, 'utf8')\n } catch (error: unknown) {\n throw new Error(`devcontainer: cannot read the container helper at \"${path}\"; reinstall the bundle`, { cause: error })\n }\n return cached\n}\n","/**\n * The failure vocabulary of the container filesystem RPC.\n *\n * The helper answers with a `error` frame whose `code` is already a DSH filesystem\n * code, because it maps POSIX errno values (`ENOENT`, `EACCES`, `EISDIR`, ...)\n * inside the container. This module translates that back into the seam's own\n * `FsError`, so a caller cannot tell a remote refusal from a local one.\n * @module @banzhe/dsh-devcontainer/rpc/errors\n */\n\nimport { FsError } from '@deepseek-ai/dsh-fs'\nimport type { FsErrorCode } from '@deepseek-ai/dsh-fs'\n\n/**\n * The seam's failure codes, as a runtime set.\n *\n * The array is typed by `FsErrorCode`, so a code this DSH version does not have\n * fails the build instead of silently becoming a generic I/O failure.\n */\nexport const FS_ERROR_CODES: readonly FsErrorCode[] = [\n 'FS_NOT_FOUND',\n 'FS_NOT_DIRECTORY',\n 'FS_NOT_TEXT',\n 'FS_NOT_REGULAR_FILE',\n 'FS_TOO_LARGE',\n 'FS_PERMISSION_DENIED',\n 'FS_SANDBOX_DENIED',\n 'FS_IO_ERROR',\n 'FS_STALE_VERSION',\n 'FS_NOT_OBSERVED',\n 'FS_AMBIGUOUS_EDIT',\n 'FS_EDIT_NOT_FOUND',\n 'FS_ABORTED',\n]\n\nconst KNOWN_CODES = new Set<string>(FS_ERROR_CODES)\n\n/**\n * A failure the container helper reported.\n *\n * It stays a distinct class so the transport and the filesystem vocabulary are\n * separable: a `code` the seam does not know (an unexpected remote failure)\n * becomes a generic I/O failure rather than an invented taxonomy entry.\n */\nexport class RpcOperationError extends Error {\n /** The remote filesystem code, when the helper named one. */\n readonly code: string | undefined\n\n /**\n * @param message - the remote diagnostic.\n * @param code - the remote `FS_*` code, when it has one.\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'RpcOperationError'\n this.code = code\n }\n}\n\n/**\n * Translate one remote or transport failure into the seam's typed error.\n * @param error - whatever the channel rejected with.\n * @param signal - the caller's cancellation signal, for attributing an abort.\n * @returns the `FsError` the filesystem seam reports.\n */\nexport function rpcFsError(error: unknown, signal?: AbortSignal): FsError {\n if (error instanceof FsError) return error\n if (error instanceof RpcOperationError && error.code !== undefined && KNOWN_CODES.has(error.code)) {\n return new FsError(error.message, error.code as FsErrorCode, { cause: error })\n }\n if (signal?.aborted === true) {\n return new FsError('the container filesystem operation was cancelled', 'FS_ABORTED', { cause: error })\n }\n const message = error instanceof Error ? error.message : String(error)\n return new FsError(message, 'FS_IO_ERROR', { cause: error })\n}\n","/**\n * Frame codec for the container filesystem RPC.\n *\n * The wire form is the one DSH's SSH helper uses\n * (\\`packages/ssh/ssh/src/protocol.ts\\`, \\`SSH_PROTOCOL_VERSION = 3\\`): a four-byte\n * big-endian unsigned length header followed by one UTF-8 JSON document. The\n * host client writes \\`request\\` and \\`cancel\\` frames; the container helper writes\n * \\`result\\` and \\`error\\` frames. Both directions carry the same four frame types.\n * @module @banzhe/dsh-devcontainer/rpc/frames\n */\n\n/** Wire version, pinned to DSH's SSH helper protocol. */\nexport const RPC_PROTOCOL_VERSION = 3\n\n/** Largest single frame either side accepts, header included. */\nexport const MAX_FRAME_BYTES = 64 * 1024 * 1024\n\n/** Bytes of the big-endian length header that opens every frame. */\nexport const FRAME_HEADER_BYTES = 4\n\n/** The structured failure a `error` frame carries. */\nexport interface RpcErrorDetail {\n /** The remote error's class name. */\n readonly name: string\n /** The remote error's message. */\n readonly message: string\n /** A filesystem failure code (`FS_*`) when the remote failure has one. */\n readonly code?: string\n}\n\n/** One request awaiting a response. */\nexport interface RpcRequestFrame {\n readonly type: 'request'\n readonly id: string\n readonly method: string\n readonly params: unknown\n}\n\n/** The successful answer to one request. */\nexport interface RpcResultFrame {\n readonly type: 'result'\n readonly id: string\n readonly value: unknown\n}\n\n/** The failed answer to one request. */\nexport interface RpcErrorFrame {\n readonly type: 'error'\n readonly id: string\n readonly error: RpcErrorDetail\n}\n\n/** Cancellation of one in-flight request; the peer stops the work and answers nothing. */\nexport interface RpcCancelFrame {\n readonly type: 'cancel'\n readonly id: string\n}\n\n/** One frame on the wire. */\nexport type RpcFrame = RpcRequestFrame | RpcResultFrame | RpcErrorFrame | RpcCancelFrame\n\n/**\n * Encode one frame as a length header plus its JSON body.\n * @param frame - the frame to encode.\n * @returns the bytes to write to the pipe.\n * @throws Error when the encoded body is empty or larger than {@link MAX_FRAME_BYTES}.\n */\nexport function encodeFrame(frame: RpcFrame): Buffer {\n const body = Buffer.from(JSON.stringify(frame), 'utf8')\n if (body.length === 0 || body.length > MAX_FRAME_BYTES) {\n throw new Error(`devcontainer: refusing to send a ${body.length}-byte RPC frame`)\n }\n const bytes = Buffer.allocUnsafe(FRAME_HEADER_BYTES + body.length)\n bytes.writeUInt32BE(body.length, 0)\n body.copy(bytes, FRAME_HEADER_BYTES)\n return bytes\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Validate one decoded frame.\n * @param value - the parsed JSON document.\n * @returns the frame, typed.\n * @throws Error when the document is not one of the four frame shapes.\n */\nexport function parseFrame(value: unknown): RpcFrame {\n if (!isRecord(value)) throw new Error('devcontainer: RPC frame is not an object')\n const { type, id } = value\n if (typeof id !== 'string' || id.length === 0) throw new Error('devcontainer: RPC frame carries no request id')\n if (type === 'request') {\n if (typeof value.method !== 'string' || value.method.length === 0) {\n throw new Error('devcontainer: RPC request frame carries no method')\n }\n return { type, id, method: value.method, params: value.params }\n }\n if (type === 'result') return { type, id, value: value.value }\n if (type === 'cancel') return { type, id }\n if (type === 'error') {\n const error = value.error\n if (!isRecord(error) || typeof error.message !== 'string') {\n throw new Error('devcontainer: RPC error frame carries no message')\n }\n return {\n type,\n id,\n error: {\n name: typeof error.name === 'string' ? error.name : 'Error',\n message: error.message,\n ...typeof error.code === 'string' ? { code: error.code } : {},\n },\n }\n }\n throw new Error(`devcontainer: unknown RPC frame type \"${String(type)}\"`)\n}\n\n/**\n * Buffered decoder: pipe chunks arrive at arbitrary boundaries, frames do not.\n *\n * The header of a frame in progress is retained across chunks, and so is its\n * body, so a peer may split a frame anywhere.\n */\nexport class FrameDecoder {\n private header = Buffer.alloc(FRAME_HEADER_BYTES)\n private headerBytes = 0\n private payload: Buffer | undefined\n private payloadBytes = 0\n\n /**\n * Consume one chunk.\n * @param chunk - bytes read from the pipe.\n * @returns every frame the chunk completed, in arrival order.\n * @throws Error when a frame declares an impossible length or is not JSON.\n */\n push(chunk: Buffer): RpcFrame[] {\n const frames: RpcFrame[] = []\n let offset = 0\n while (offset < chunk.length) {\n if (this.payload === undefined) {\n const count = Math.min(FRAME_HEADER_BYTES - this.headerBytes, chunk.length - offset)\n chunk.copy(this.header, this.headerBytes, offset, offset + count)\n this.headerBytes += count\n offset += count\n if (this.headerBytes < FRAME_HEADER_BYTES) continue\n const size = this.header.readUInt32BE(0)\n if (size === 0 || size > MAX_FRAME_BYTES) {\n throw new Error(`devcontainer: peer announced an invalid ${size}-byte RPC frame`)\n }\n this.payload = Buffer.alloc(size)\n this.payloadBytes = 0\n }\n const count = Math.min(this.payload.length - this.payloadBytes, chunk.length - offset)\n chunk.copy(this.payload, this.payloadBytes, offset, offset + count)\n this.payloadBytes += count\n offset += count\n if (this.payloadBytes === this.payload.length) {\n const body = this.payload.toString('utf8')\n this.payload = undefined\n this.headerBytes = 0\n let decoded: unknown\n try {\n decoded = JSON.parse(body)\n } catch (error: unknown) {\n throw new Error('devcontainer: peer sent a frame that is not JSON', { cause: error })\n }\n frames.push(parseFrame(decoded))\n }\n }\n return frames\n }\n\n /**\n * Whether bytes of an unfinished frame are buffered.\n * @returns true when the peer stopped mid-frame.\n */\n get pending(): boolean {\n return this.headerBytes > 0 || this.payload !== undefined\n }\n\n /**\n * The buffered header bytes read as text, when they are printable ASCII.\n *\n * A runtime that cannot start the helper answers the pipe with its own exec\n * diagnostic instead of frames, and those first four bytes decode as a length\n * far above {@link MAX_FRAME_BYTES}. No accepted length can look like this:\n * every frame under the limit starts with a byte below `0x05`, and the rest of\n * the printable range begins at `0x20`.\n * @returns the printable prefix buffered so far, or undefined when the bytes are a frame header.\n */\n get proseHeader(): string | undefined {\n if (this.headerBytes === 0) return undefined\n const bytes = this.header.subarray(0, this.headerBytes)\n for (const byte of bytes) {\n const blank = byte === 0x09 || byte === 0x0a || byte === 0x0d\n if (!blank && (byte < 0x20 || byte > 0x7e)) return undefined\n }\n return bytes.toString('utf8')\n }\n}\n","/**\n * The host half of the container filesystem RPC: one persistent\n * `docker exec -i <container> node <helper>` pipe that carries framed requests.\n *\n * The channel owns the whole exchange — staging the helper into the container,\n * the `hello` handshake, request/response correlation, cancellation, and the\n * teardown that fails every pending call when the pipe dies. It never replays a\n * request: a caller that loses the connection learns that the remote outcome is\n * unknown, which is the only honest answer for a mutation that may have\n * committed.\n * @module @banzhe/dsh-devcontainer/rpc/client\n */\n\nimport { spawn } from 'node:child_process'\nimport { randomUUID } from 'node:crypto'\nimport type { Readable, Writable } from 'node:stream'\nimport { containerCliEnv } from '../exec.ts'\nimport { HELPER_CONTAINER_DIRECTORY, HELPER_CONTAINER_PATH, helperSource } from '../helper-source.ts'\nimport { RpcOperationError } from './errors.ts'\nimport { FrameDecoder, encodeFrame, RPC_PROTOCOL_VERSION } from './frames.ts'\nimport type { RpcFrame } from './frames.ts'\n\n/** Request budget when the row configures none. */\nexport const DEFAULT_RPC_TIMEOUT_MS = 60_000\n\n/** Requests one channel may have in flight before it refuses more. */\nconst DEFAULT_MAX_PENDING = 256\n\n/** Diagnostic bytes kept from the helper's own streams, for the failure that needs them. */\nconst DIAGNOSTIC_BYTES = 4096\n\n/** One long-lived child process with piped stdio. */\nexport interface ContainerChild {\n /** The channel's request bytes. */\n readonly stdin: Writable\n /** The helper's frame bytes. */\n readonly stdout: Readable\n /** Diagnostics; never framed. */\n readonly stderr: Readable\n /** Resolves once the process is gone, however it went. */\n readonly exited: Promise<{ readonly code: number | null, readonly signal: string | null }>\n /** Request termination. */\n kill(signal?: NodeJS.Signals): void\n}\n\n/** Starts one child process for the container; replaced in tests. */\nexport type ContainerChildSpawn = (argv: readonly string[], options?: { readonly cwd?: string }) => ContainerChild\n\n/**\n * Start one child with the filtered CLI environment, so a Docker call carries\n * neither the harness's credentials nor the session's `DSH_*` facts.\n * @param argv - program and arguments, never shell-interpreted.\n * @param options - optional working directory.\n * @returns the child with its piped streams and exit promise.\n */\nexport const spawnContainerChild: ContainerChildSpawn = (argv, options = {}) => {\n const [program, ...args] = argv\n if (program === undefined) throw new Error('devcontainer: empty command')\n const child = spawn(program, args, {\n stdio: ['pipe', 'pipe', 'pipe'],\n windowsHide: true,\n env: containerCliEnv(),\n ...options.cwd === undefined ? {} : { cwd: options.cwd },\n })\n // A staged write into a process that already failed must not raise an\n // unhandled \"error\" event; the exit code carries that failure instead.\n child.stdin.on('error', () => {})\n const exited = new Promise<{ code: number | null, signal: string | null }>((resolve) => {\n child.once('exit', (code, signal) => { resolve({ code, signal }) })\n child.once('error', () => { resolve({ code: null, signal: null }) })\n })\n return { stdin: child.stdin, stdout: child.stdout, stderr: child.stderr, exited, kill: (signal) => { child.kill(signal) } }\n}\n\n/** What the helper reports about itself once the handshake completes. */\nexport interface RpcHandshake {\n /** The wire version it speaks. */\n readonly protocol: number\n /** Its `process.platform`; expected to be the container's. */\n readonly platform: string\n /** Its `process.version`. */\n readonly nodeVersion: string\n /** The workspace the channel was opened for. */\n readonly workspace: string\n /** That workspace's realpath inside the container. */\n readonly workspaceReal: string\n}\n\n/** Which runtime a channel speaks to, and the directory it treats as home. */\nexport type ChannelTarget =\n | { readonly kind: 'docker'; readonly containerId: string; readonly workspace: string }\n | { readonly kind: 'sbx'; readonly sandboxName: string; readonly workspace: string }\n\n/**\n * The argv that runs one program inside the runtime.\n *\n * Both drivers take `-i` so the helper keeps its stdio pipe; `sbx` separates its\n * own flags from the command with `--`, which `docker exec` does not need.\n * @param target - the runtime to run in.\n * @param program - the program and its arguments, never shell-interpreted.\n * @returns the complete argv.\n */\nexport function runtimeExecArgv(target: ChannelTarget, program: readonly string[]): string[] {\n switch (target.kind) {\n case 'docker': return ['docker', 'exec', '-i', target.containerId, ...program]\n case 'sbx': return ['sbx', 'exec', '-i', target.sandboxName, '--', ...program]\n }\n}\n\n/**\n * How a diagnostic names one runtime.\n * @param target - the runtime.\n * @returns `container \"<id>\"` or `sandbox \"<name>\"`.\n */\nfunction runtimeLabel(target: ChannelTarget): string {\n return target.kind === 'sbx' ? `sandbox \"${target.sandboxName}\"` : `container \"${target.containerId}\"`\n}\n\n/** Options for one channel. */\nexport interface ChannelOptions {\n /** The runtime the helper runs in, and its workspace. */\n readonly target: ChannelTarget\n /** The process starter; the Docker / sandbox CLI by default. */\n readonly spawn?: ContainerChildSpawn\n /** Budget for staging, the handshake, and each later request. */\n readonly timeoutMs?: number\n /** In-flight request ceiling. */\n readonly maxPending?: number\n}\n\n/** Options for one request. */\nexport interface RequestOptions {\n /** Cancels the request; the channel tells the helper to stop, it does not roll back. */\n readonly signal?: AbortSignal\n /** Overrides the channel's per-request budget. */\n readonly timeoutMs?: number\n}\n\n/**\n * How one write gives up when the caller behind it does.\n *\n * A request frame is written through the same serialized queue as every other\n * frame, so the wait for a writable pipe has to end with the request itself:\n * otherwise a caller that has already given up stays parked on the write until\n * the pipe drains or dies.\n */\ninterface WriteInterruption {\n /** Ends the wait for the pipe — the request's own budget and cancellation. */\n readonly scope: AbortSignal\n /**\n * The failure the caller reports once the scope ended the write.\n * @returns the cancellation or timeout failure, worded for that request.\n */\n failure(): Error\n}\n\n/** A promise and its settlement functions, for the pending-request table. */\nfunction deferred<T>(): { promise: Promise<T>, resolve(value: T): void, reject(error: Error): void } {\n let resolve!: (value: T) => void\n let reject!: (error: Error) => void\n const promise = new Promise<T>((settle, fail) => {\n resolve = settle\n reject = fail\n })\n return { promise, resolve, reject }\n}\n\n/** Keep the last bytes of a stream, for the failure message that needs them. */\nfunction tail(current: string, chunk: string): string {\n const merged = current + chunk\n return merged.length <= DIAGNOSTIC_BYTES ? merged : merged.slice(merged.length - DIAGNOSTIC_BYTES)\n}\n\n/** Keep the first bytes of a stream, for the failure message that needs them. */\nfunction head(current: string, chunk: string): string {\n const merged = current + chunk\n return merged.length <= DIAGNOSTIC_BYTES ? merged : merged.slice(0, DIAGNOSTIC_BYTES)\n}\n\n/**\n * Resolve once a scope aborts; never reject, because it only ends a race.\n * @param scope - the scope to watch.\n * @returns a promise that settles when the scope aborts.\n */\nfunction abortedScope(scope: AbortSignal): Promise<void> {\n if (scope.aborted) return Promise.resolve()\n return new Promise<void>((resolve) => {\n scope.addEventListener('abort', () => { resolve() }, { once: true })\n })\n}\n\n/** Race one promise against the request budget and the caller's cancellation. */\nasync function withDeadline<T>(\n promise: Promise<T>,\n timeoutMs: number,\n signal: AbortSignal | undefined,\n what: string,\n): Promise<T> {\n const timeout = AbortSignal.timeout(timeoutMs)\n const scope = signal === undefined ? timeout : AbortSignal.any([signal, timeout])\n const expired = new Promise<never>((_resolve, reject) => {\n scope.addEventListener('abort', () => {\n reject(new Error(signal?.aborted === true\n ? `devcontainer: ${what} was cancelled`\n : `devcontainer: ${what} timed out after ${timeoutMs} ms`))\n }, { once: true })\n })\n return await Promise.race([promise, expired])\n}\n\n/**\n * Write the helper program into the runtime and wait for the write to land.\n * @param spawn - the process starter.\n * @param target - the runtime to stage into.\n * @param timeoutMs - budget for the whole stage.\n * @param signal - cancellation.\n * @throws Error when the runtime rejects the write or the budget expires.\n */\nasync function stageHelper(\n spawn: ContainerChildSpawn,\n target: ChannelTarget,\n timeoutMs: number,\n signal: AbortSignal | undefined,\n): Promise<void> {\n const script = `mkdir -p ${HELPER_CONTAINER_DIRECTORY} && cat > ${HELPER_CONTAINER_PATH}`\n const child = spawn(runtimeExecArgv(target, ['sh', '-c', script]))\n let stderr = ''\n child.stderr.on('data', (chunk: Buffer) => { stderr = tail(stderr, chunk.toString('utf8')) })\n const source = helperSource()\n try {\n child.stdin.end(source, 'utf8')\n } catch {\n // The exit code below reports why the container refused it.\n }\n const exit = await withDeadline(child.exited, timeoutMs, signal, 'staging the filesystem helper')\n if (exit.code !== 0) {\n const detail = stderr.trim() === '' ? 'no output' : stderr.trim()\n throw new Error(\n `devcontainer: cannot stage the filesystem helper in ${runtimeLabel(target)} `\n + `(exit ${exit.code === null ? 'unknown' : exit.code}): ${detail}`,\n )\n }\n}\n\n/**\n * One live request/response pipe to a container's filesystem helper.\n *\n * A channel is single-use in the sense that matters: once the pipe fails, every\n * later call rejects, and the pool that owns it opens a fresh one. Nothing is\n * replayed, because a mutation that died mid-flight has an unknown outcome.\n */\nexport class ContainerRpcChannel {\n private readonly pending = new Map<string, { resolve(value: unknown): void, reject(error: Error): void }>()\n private readonly decoder = new FrameDecoder()\n private readonly child: ContainerChild\n private readonly label: string\n private readonly timeoutMs: number\n private readonly maxPending: number\n private readonly closed = deferred<void>()\n private writeTail: Promise<void> = Promise.resolve()\n private stderrTail = ''\n private preface = ''\n private proseOnly = false\n private framesStarted = false\n private failure: Error | undefined\n private handshakeValue: RpcHandshake | undefined\n\n private constructor(child: ContainerChild, label: string, timeoutMs: number, maxPending: number) {\n this.child = child\n this.label = label\n this.timeoutMs = timeoutMs\n this.maxPending = maxPending\n child.stdout.on('data', (chunk: Buffer) => { this.consume(chunk) })\n child.stdout.on('error', (error: Error) => { this.fail(error) })\n child.stderr.on('data', (chunk: Buffer) => { this.stderrTail = tail(this.stderrTail, chunk.toString('utf8')) })\n void child.exited.then(\n (exit) => { this.fail(this.proseOnly ? this.proseFailure(exit) : this.transportFailure(exit)) },\n () => { this.fail(new Error('devcontainer: the container filesystem helper could not be started')) },\n )\n }\n\n /**\n * Stage the helper, start its process, and complete the handshake.\n * @param options - the container, its workspace, and the process starter.\n * @returns the open channel.\n * @throws Error when staging, the process start, or the handshake fails.\n */\n static async open(options: ChannelOptions): Promise<ContainerRpcChannel> {\n const spawn = options.spawn ?? spawnContainerChild\n const timeoutMs = options.timeoutMs ?? DEFAULT_RPC_TIMEOUT_MS\n const target = options.target\n await stageHelper(spawn, target, timeoutMs, undefined)\n const child = spawn(runtimeExecArgv(target, ['node', HELPER_CONTAINER_PATH]))\n const channel = new ContainerRpcChannel(\n child,\n runtimeLabel(target),\n timeoutMs,\n options.maxPending ?? DEFAULT_MAX_PENDING,\n )\n try {\n const hello = await channel.request<RpcHandshake>(\n 'hello',\n { protocol: RPC_PROTOCOL_VERSION, workspace: target.workspace },\n { timeoutMs },\n )\n if (hello.protocol !== RPC_PROTOCOL_VERSION) {\n throw new Error(`devcontainer: the container helper speaks protocol ${hello.protocol}, not ${RPC_PROTOCOL_VERSION}`)\n }\n for (const field of ['platform', 'nodeVersion', 'workspace', 'workspaceReal'] as const) {\n if (typeof hello[field] !== 'string') throw new Error(`devcontainer: the container helper sent no ${field}`)\n }\n channel.handshakeValue = hello\n return channel\n } catch (error: unknown) {\n await channel.close()\n throw error\n }\n }\n\n /** What the helper reported during the handshake. */\n get handshake(): RpcHandshake {\n if (this.handshakeValue === undefined) throw new Error('devcontainer: the container helper is not handshaken')\n return this.handshakeValue\n }\n\n /** Whether the pipe failed or was closed; a closed channel never recovers. */\n get isClosed(): boolean {\n return this.failure !== undefined\n }\n\n /** Resolves once the channel is unusable. */\n get closedPromise(): Promise<void> {\n return this.closed.promise\n }\n\n /**\n * Send one request and settle with the helper's answer.\n *\n * The frame is written under the same scope as the answer, so the budget and\n * the caller's cancellation end a write that is still waiting for a pipe that\n * will not take the bytes. A pipe that stays wedged is reset rather than left\n * to block every later request behind the same write.\n * @param method - the helper operation, for example `fs.readText`.\n * @param params - JSON parameters.\n * @param options - cancellation and a per-request budget.\n * @returns the validated remote value.\n * @throws RpcOperationError for a remote failure, Error for transport, cancellation and timeouts.\n */\n async request<T>(method: string, params: unknown, options: RequestOptions = {}): Promise<T> {\n const { signal } = options\n if (this.failure !== undefined) throw this.failure\n signal?.throwIfAborted()\n if (this.pending.size >= this.maxPending) {\n throw new Error(`devcontainer: the container filesystem helper already has ${this.pending.size} pending requests`)\n }\n const id = randomUUID()\n const settled = deferred<unknown>()\n // A rejection nobody awaited yet must not surface as an unhandled rejection.\n void settled.promise.catch(() => {})\n this.pending.set(id, {\n resolve: (value: unknown) => { settled.resolve(value) },\n reject: (error: Error) => { settled.reject(error) },\n })\n const timeoutMs = options.timeoutMs ?? this.timeoutMs\n const timeout = AbortSignal.timeout(timeoutMs)\n const scope = signal === undefined ? timeout : AbortSignal.any([signal, timeout])\n const giveUp = (): Error => new Error(signal?.aborted === true\n ? `devcontainer: \"${method}\" was cancelled`\n : `devcontainer: \"${method}\" timed out after ${timeoutMs} ms`)\n const cancel = (): void => {\n this.pending.delete(id)\n void this.send({ type: 'cancel', id }).catch(() => {})\n settled.reject(giveUp())\n }\n scope.addEventListener('abort', cancel, { once: true })\n try {\n await this.send({ type: 'request', id, method, params }, { scope, failure: giveUp })\n return await settled.promise as T\n } catch (error: unknown) {\n this.pending.delete(id)\n throw error\n } finally {\n scope.removeEventListener('abort', cancel)\n }\n }\n\n /**\n * Probe the helper's liveness.\n * @param options - cancellation and a per-request budget.\n * @returns the helper's clock, once it answered.\n */\n async ping(options: RequestOptions = {}): Promise<{ readonly pong: boolean, readonly now: number }> {\n return await this.request('ping', {}, options)\n }\n\n /**\n * Stop the helper and fail everything still pending.\n * @param reason - the failure reported to pending callers; a closure message by default.\n */\n async close(reason?: Error): Promise<void> {\n this.fail(reason ?? new Error('devcontainer: the container filesystem channel was closed'))\n await this.closed.promise\n }\n\n private consume(chunk: Buffer): void {\n if (!this.framesStarted) this.preface = head(this.preface, chunk.toString('utf8'))\n if (this.proseOnly) return\n let frames: RpcFrame[]\n try {\n frames = this.decoder.push(chunk)\n } catch (error: unknown) {\n if (this.decoder.proseHeader !== undefined) {\n // Prose, not a frame: the exit handler reports it once the pipe is done.\n this.proseOnly = true\n return\n }\n this.fail(error instanceof Error ? error : new Error(String(error)))\n return\n }\n for (const frame of frames) this.receive(frame)\n if (frames.length > 0) {\n this.framesStarted = true\n this.preface = ''\n }\n }\n\n private receive(frame: RpcFrame): void {\n if (frame.type === 'result' || frame.type === 'error') {\n const pending = this.pending.get(frame.id)\n // A cancelled request may still be answered; its caller already settled.\n if (pending === undefined) return\n this.pending.delete(frame.id)\n if (frame.type === 'result') pending.resolve(frame.value)\n else pending.reject(new RpcOperationError(frame.error.message, frame.error.code))\n return\n }\n this.fail(new Error(`devcontainer: the container helper sent an unexpected ${frame.type} frame`))\n }\n\n /**\n * Put one frame on the pipe.\n * @param frame - the frame to write.\n * @param interruption - ends the write when the caller behind it gives up; omitted for the frames the channel writes on its own behalf.\n * @throws Error when the channel is broken, or when the interruption ended the write.\n */\n private async send(frame: RpcFrame, interruption?: WriteInterruption): Promise<void> {\n if (this.failure !== undefined) throw this.failure\n const bytes = encodeFrame(frame)\n const write = this.writeTail.then(async () => {\n this.throwIfBroken()\n if (interruption === undefined) {\n if (!this.child.stdin.write(bytes)) await this.awaitDrain()\n this.throwIfBroken()\n return\n }\n // A frame whose caller already gave up is not worth writing: a queued\n // write can sit out a whole budget behind one that is stuck.\n if (interruption.scope.aborted) throw interruption.failure()\n if (this.child.stdin.write(bytes)) return\n // Backpressure: wait for the drain, for the pipe to die under us, or for\n // the caller to give up on the answer this frame carries.\n const drained = await this.awaitDrain(interruption.scope)\n this.throwIfBroken()\n // A drained pipe already holds the frame; the caller's cancellation has\n // settled its promise on its own, so the write is done.\n if (drained) return\n // Bytes the pipe will not take leave every later write queued behind this\n // one, so the channel is reset instead of left wedged.\n this.fail(new Error('devcontainer: the container filesystem pipe stopped draining; the channel was closed'))\n throw interruption.failure()\n })\n this.writeTail = write.catch(() => {})\n if (interruption === undefined) {\n await write\n return\n }\n // A write still waiting for its turn behind other frames must not outlive\n // the request either: the caller stops waiting here, and the queued write\n // refuses itself when the queue reaches it.\n await Promise.race([write, abortedScope(interruption.scope)])\n }\n\n /**\n * Wait for the pipe to take buffered bytes.\n * @param scope - ends the wait when the caller gives up.\n * @returns true when the pipe drained, false when the wait ended another way.\n * @throws Error when the pipe died during the wait.\n */\n private async awaitDrain(scope?: AbortSignal): Promise<boolean> {\n let onDrain = (): void => {}\n const drained = new Promise<boolean>((resolve) => {\n onDrain = () => {\n this.child.stdin.off('drain', onDrain)\n resolve(true)\n }\n })\n this.child.stdin.once('drain', onDrain)\n let stopped: (() => void) | undefined\n try {\n return await Promise.race([\n drained,\n this.closed.promise.then(() => false),\n ...(scope === undefined ? [] : [new Promise<boolean>((resolve) => {\n stopped = () => { resolve(false) }\n scope.addEventListener('abort', stopped, { once: true })\n })]),\n ])\n } finally {\n this.child.stdin.off('drain', onDrain)\n if (stopped !== undefined && scope !== undefined) scope.removeEventListener('abort', stopped)\n }\n }\n\n /** Re-read the channel state, which an awaited step may have changed. */\n private throwIfBroken(): void {\n const failure = this.failure\n if (failure !== undefined) throw failure\n }\n\n private transportFailure(exit: { code: number | null, signal: string | null }): Error {\n const detail = this.stderrTail.trim() === '' ? 'no output' : this.stderrTail.trim()\n const status = exit.signal !== null ? `signal ${exit.signal}` : `exit ${exit.code === null ? 'unknown' : exit.code}`\n return new Error(\n `devcontainer: the container filesystem helper stopped (${status}): ${detail}. `\n + 'The outcome of any request that was in flight is unknown.',\n )\n }\n\n /**\n * The failure of a pipe that answered with prose instead of frames.\n *\n * A runtime without the `node` the helper needs replies with its own exec\n * diagnostic, so the first four bytes of `exec: ...` decode as a length header\n * of 1702389091 bytes. Reporting the frame size hides the cause; the collected\n * text is what the reader can act on.\n */\n private proseFailure(exit: { code: number | null, signal: string | null }): Error {\n const status = exit.signal !== null ? `signal ${exit.signal}` : `exit ${exit.code === null ? 'unknown' : exit.code}`\n const detail = this.preface.trim() === '' ? 'no output' : this.preface.trim()\n return new Error(\n `devcontainer: the filesystem helper could not be started in ${this.label} (${status}); `\n + `the runtime answered its pipe with text instead of RPC frames: ${detail}`,\n )\n }\n\n private fail(error: Error): void {\n if (this.failure !== undefined) return\n const partial = this.proseOnly ? false : this.decoder.pending\n this.failure = partial\n ? new Error(`${error.message} (the pipe ended inside a frame)`, { cause: error })\n : error\n for (const pending of this.pending.values()) pending.reject(this.failure)\n this.pending.clear()\n this.closed.resolve()\n try {\n this.child.kill('SIGTERM')\n } catch {\n // An already-dead child needs no termination.\n }\n }\n}\n","/**\n * The channel pool: one live RPC pipe per container, shared by every filesystem\n * call in a composition and re-opened after the pipe or the container dies.\n *\n * A shared open is deliberately not cancellable by one caller's signal: another\n * caller may be waiting for the same handshake, and aborting the open would\n * destroy their connection too. Callers check their own signal before joining.\n * @module @banzhe/dsh-devcontainer/rpc/pool\n */\n\nimport { ContainerRpcChannel, spawnContainerChild } from './client.ts'\nimport type { ChannelTarget, ContainerChildSpawn } from './client.ts'\n\n/** Options one pool needs to open a channel. */\nexport interface ChannelOptions {\n /** Budget for staging, the handshake, and each request. */\n readonly timeoutMs: number\n}\n\nconst SEPARATOR = '\\u0000'\n\n/** The pool key of one runtime endpoint. */\nfunction keyOf(target: ChannelTarget): string {\n const endpoint = target.kind === 'sbx' ? `sbx:${target.sandboxName}` : `docker:${target.containerId}`\n return `${endpoint}${SEPARATOR}${target.workspace}`\n}\n\n/**\n * Live channels, keyed by runtime endpoint and workspace.\n *\n * A channel that failed is dropped as soon as it settles, so the next call\n * handshakes again — that is what makes a restarted container recoverable\n * without restarting the session.\n */\nexport class ContainerRpcPool {\n private readonly channels = new Map<string, Promise<ContainerRpcChannel>>()\n private readonly spawn: ContainerChildSpawn\n\n /**\n * @param spawn - the process starter; the Docker CLI unless a test replaces it.\n */\n constructor(spawn: ContainerChildSpawn = spawnContainerChild) {\n this.spawn = spawn\n }\n\n /**\n * The live channel for one container, opened and handshaken on demand.\n * @param target - the container and the workspace it should treat as home.\n * @param options - the per-request budget.\n * @returns the usable channel.\n * @throws Error when the helper cannot be staged or handshaken.\n */\n async channel(target: ChannelTarget, options: ChannelOptions): Promise<ContainerRpcChannel> {\n const key = keyOf(target)\n const cached = this.channels.get(key)\n if (cached !== undefined) {\n const channel = await cached.catch(() => undefined)\n if (channel !== undefined && !channel.isClosed) return channel\n if (this.channels.get(key) === cached) this.channels.delete(key)\n }\n const opening = ContainerRpcChannel.open({\n target,\n spawn: this.spawn,\n timeoutMs: options.timeoutMs,\n })\n this.channels.set(key, opening)\n const forget = (): void => {\n if (this.channels.get(key) === opening) this.channels.delete(key)\n }\n void opening.then(\n (channel) => { void channel.closedPromise.then(forget) },\n forget,\n ).catch(() => {})\n return await opening\n }\n\n /**\n * Drop one cached channel without touching the others.\n * @param target - the container and workspace to forget.\n */\n forget(target: ChannelTarget): void {\n this.channels.delete(keyOf(target))\n }\n\n /** Close every channel this pool opened, waiting for each process to settle. */\n async closeAll(): Promise<void> {\n const opening = [...this.channels.values()]\n this.channels.clear()\n for (const pending of opening) {\n const channel = await pending.catch(() => undefined)\n if (channel !== undefined) await channel.close()\n }\n }\n}\n","/**\n * The JSON documents the container helper exchanges with the host.\n *\n * These mirror the seam's types with plain strings where the seam brands\n * identity (`FsTargetKey`, `FsVersion`), because a brand cannot cross a wire.\n * Conversion back happens in one place — `src/fs.ts` — so nothing else sees an\n * unbranded key.\n * @module @banzhe/dsh-devcontainer/rpc/wire\n */\n\nimport { FsTargetKey, FsVersion } from '@deepseek-ai/dsh-fs'\nimport type {\n FsDirEntry,\n FsEditOutcome,\n FsErrorCode,\n FsInfo,\n FsPathInfo,\n FsTarget,\n FsWriteOutcome,\n} from '@deepseek-ai/dsh-fs'\nimport { FS_ERROR_CODES } from './errors.ts'\n\nconst KNOWN_CODES = new Set<string>(FS_ERROR_CODES)\n\n/**\n * The outcome of a remote delete.\n *\n * A local shape rather than a seam type: the seam of the DSH build this Bundle\n * compiles against declares no `deleteFile`, so neither does its vocabulary.\n */\nexport interface ContainerDeleteOutcome {\n /** The bounded LF-normalized removed text, or null when no basis is available. */\n readonly before: string | null\n}\n\n/** The outcome of a remote move, with the same local-shape reason as {@link ContainerDeleteOutcome}. */\nexport interface ContainerMoveOutcome {\n /** The bounded LF source basis, or null when it is unavailable. */\n readonly sourceBefore: string | null\n /** The published destination. */\n readonly destination: FsWriteOutcome\n /** Whether the source was removed after publication. */\n readonly sourceDeleted: boolean\n /** Why the source survived, when it did. */\n readonly sourceFailure?: {\n readonly code: FsErrorCode\n readonly message: string\n }\n}\n\n/** A resolved target as it travels. */\nexport interface WireTarget {\n /** The container-side realpath identity. */\n readonly targetKey: string\n /** The container-side spelling the caller sees. */\n readonly displayPath: string\n}\n\n/** `fs.stat` metadata. */\nexport interface WireInfo {\n readonly version: string\n readonly type: 'file' | 'directory' | 'other'\n readonly size?: number\n}\n\n/** `fs.lstat` metadata, which can name the link itself. */\nexport interface WirePathInfo {\n readonly version: string\n readonly type: 'file' | 'directory' | 'symlink' | 'other'\n readonly size?: number\n}\n\n/** One direct child from `fs.list`. */\nexport interface WireDirEntry {\n readonly name: string\n readonly type: 'file' | 'directory' | 'other'\n readonly target: WireTarget\n readonly version?: string\n readonly size?: number\n}\n\n/** The outcome of `fs.write`. */\nexport interface WireWriteOutcome {\n readonly operation: 'create' | 'update'\n readonly version: string\n readonly before: string | null\n readonly after: string\n}\n\n/** The outcome of `fs.edit` and `fs.patch`. */\nexport interface WireEditOutcome {\n readonly version: string\n readonly before: string\n readonly after: string\n}\n\n/** The outcome of `fs.delete`. */\nexport interface WireDeleteOutcome {\n readonly before: string | null\n}\n\n/** The outcome of `fs.move`. */\nexport interface WireMoveOutcome {\n readonly sourceBefore: string | null\n readonly destination: WireWriteOutcome\n readonly sourceDeleted: boolean\n readonly sourceFailure?: {\n readonly code: string\n readonly message: string\n }\n}\n\n/** The handle `fs.stream` opens. */\nexport interface WireStreamId {\n readonly id: string\n}\n\n/** One step of an open text stream. */\nexport interface WireStreamStep {\n readonly done: boolean\n readonly value: string\n}\n\n/** Brand one travelled target back into the seam's identity type. */\nexport function toFsTarget(target: WireTarget): FsTarget {\n return { targetKey: FsTargetKey(target.targetKey), displayPath: target.displayPath }\n}\n\n/** Brand `fs.stat` metadata back into the seam's type. */\nexport function toFsInfo(info: WireInfo): FsInfo {\n return {\n version: FsVersion(info.version),\n type: info.type,\n ...info.size === undefined ? {} : { size: info.size },\n }\n}\n\n/** Brand `fs.lstat` metadata back into the seam's type. */\nexport function toFsPathInfo(info: WirePathInfo): FsPathInfo {\n return {\n version: FsVersion(info.version),\n type: info.type,\n ...info.size === undefined ? {} : { size: info.size },\n }\n}\n\n/** Brand one listing entry back into the seam's type. */\nexport function toFsDirEntry(entry: WireDirEntry): FsDirEntry {\n return {\n name: entry.name,\n type: entry.type,\n target: toFsTarget(entry.target),\n ...entry.version === undefined ? {} : { version: FsVersion(entry.version) },\n ...entry.size === undefined ? {} : { size: entry.size },\n }\n}\n\n/** Brand a write outcome back into the seam's type. */\nexport function toFsWriteOutcome(outcome: WireWriteOutcome): FsWriteOutcome {\n return {\n operation: outcome.operation,\n version: FsVersion(outcome.version),\n before: outcome.before,\n after: outcome.after,\n }\n}\n\n/** Brand an edit or patch outcome back into the seam's type. */\nexport function toFsEditOutcome(outcome: WireEditOutcome): FsEditOutcome {\n return { version: FsVersion(outcome.version), before: outcome.before, after: outcome.after }\n}\n\n/** Pass a delete outcome through; its only field is already plain text. */\nexport function toFsDeleteOutcome(outcome: WireDeleteOutcome): ContainerDeleteOutcome {\n return { before: outcome.before }\n}\n\n/** Brand a move outcome back into the seam's type. */\nexport function toFsMoveOutcome(outcome: WireMoveOutcome): ContainerMoveOutcome {\n const destination = toFsWriteOutcome(outcome.destination)\n if (outcome.sourceDeleted || outcome.sourceFailure === undefined) {\n return { sourceBefore: outcome.sourceBefore, destination, sourceDeleted: true }\n }\n return {\n sourceBefore: outcome.sourceBefore,\n destination,\n sourceDeleted: false,\n sourceFailure: {\n code: KNOWN_CODES.has(outcome.sourceFailure.code) ? outcome.sourceFailure.code as FsErrorCode : 'FS_IO_ERROR',\n message: outcome.sourceFailure.message,\n },\n }\n}\n","/**\n * `ctx.fs` for repositories that declare a Dev Container, or run in a Docker\n * Sandbox.\n *\n * A derived preset promises that nothing the session touches happens on the host. This backend keeps that promise at the filesystem seam instead of\n * fencing the host path by path: in a container-bound session every operation —\n * `resolve`, `lstat`, `stat`, reads, listings, writes, edits, patches, deletes,\n * and moves — is delegated over a persistent RPC pipe to a Node helper running\n * inside the Linux container (see `src/helper/main.mjs` and `src/rpc/`). The\n * container resolves the path, follows the symlink, and performs the I/O, so a\n * Windows drive letter is not merely refused but physically unreachable.\n *\n * Two cases keep their earlier behaviour on purpose:\n *\n * - An ordinary preset in the same repository keeps the host backend, mapped\n * onto the bind mount, so a session that never entered the container sees the\n * files exactly as before this row existed.\n * - A `(devContainer)` preset over a repository that declares no container still\n * fails fast with `FS_PERMISSION_DENIED`: there is nowhere to delegate to, and\n * quietly writing the host while the model believes it wrote Linux is the\n * worst possible outcome.\n *\n * The runtime behind the pipe is either a Docker container or a Docker Sandbox\n * (`ChannelTarget`): the second one mounts the host workspace at its own absolute\n * path, so the delegated paths are the ones the model already writes, and the\n * helper still runs the sandbox's own Linux `node`.\n *\n * Containment inside the runtime is still enforced here — a request, and every\n * identity the runtime resolves, must stay inside the repository's mount, in any\n * spelling that mount has inside the runtime — so a session cannot wander off\n * into the container's own `/etc` either.\n * @module @banzhe/dsh-devcontainer/fs\n */\n\nimport { posix } from 'node:path'\nimport { Context } from '@deepseek-ai/cordis'\nimport z from '@deepseek-ai/schemastery'\nimport { FsError } from '@deepseek-ai/dsh-fs'\nimport type {\n FsDirEntry,\n FsEditOutcome,\n FsEditRequest,\n FsInfo,\n FsPathInfo,\n FsTarget,\n FsVersion,\n FsWriteIntent,\n FsWriteOutcome,\n} from '@deepseek-ai/dsh-fs'\nimport type { Config as LocalFsConfig } from '@deepseek-ai/dsh-fs-local'\nimport { SandboxedFileSystem } from '@deepseek-ai/dsh-fs-sandbox'\nimport { resolveContainerTarget } from './container.ts'\nimport type { ContainerTarget } from './container.ts'\nimport { runContainerCommand } from './exec.ts'\nimport type { ContainerRun } from './exec.ts'\nimport { containerOptionFields, containerOptions } from './options.ts'\nimport {\n containerRemainder,\n hostPathStyle,\n isPathInsideContainer,\n isPosixAbsolute,\n isWindowsPath,\n joinHostRoot,\n relativeWithinHostRoot,\n toContainerPath,\n toHostPath,\n toPosixSlashes,\n} from './paths.ts'\nimport { callingContainerPreset, fsEscapeRefusalText, fsRefusalText, presetKindOf } from './refusal.ts'\nimport { repoRegistry } from './registry.ts'\nimport { asSbxSpec, bindSbxMount, sandboxHostPathFor, sandboxWorkspacePath, sbxSpecFor, sbxWorkspaceRootFor } from './sbx.ts'\nimport { ContainerRpcChannel, DEFAULT_RPC_TIMEOUT_MS, spawnContainerChild } from './rpc/client.ts'\nimport type { ChannelTarget, ContainerChildSpawn, RequestOptions } from './rpc/client.ts'\nimport { RpcOperationError, rpcFsError } from './rpc/errors.ts'\nimport { ContainerRpcPool } from './rpc/pool.ts'\nimport {\n toFsDeleteOutcome,\n toFsDirEntry,\n toFsEditOutcome,\n toFsInfo,\n toFsMoveOutcome,\n toFsPathInfo,\n toFsTarget,\n toFsWriteOutcome,\n} from './rpc/wire.ts'\nimport type {\n ContainerDeleteOutcome,\n ContainerMoveOutcome,\n WireDeleteOutcome,\n WireDirEntry,\n WireEditOutcome,\n WireInfo,\n WireMoveOutcome,\n WirePathInfo,\n WireStreamId,\n WireStreamStep,\n WireTarget,\n WireWriteOutcome,\n} from './rpc/wire.ts'\nimport type { ContainerOptions, RepoContainerSpec } from './types.ts'\nimport type { VariantKind } from './ids.ts'\n\n/** Plugin name used by the Loader row. */\nexport const name = 'devcontainer-fs'\n\n/** The local backend's knobs plus this Bundle's container options. */\nexport interface Config extends LocalFsConfig, ContainerOptions {\n /** Budget for one container filesystem request, in milliseconds. */\n rpcTimeoutMs?: number\n}\n\n/** The local backend's own overwrite-diff budget; the constructor validates it, so it must be defaulted here. */\nconst DEFAULT_DIFF_BASIS_MAX_BYTES = 10 * 1024 * 1024\n\n/** How often a container-backed watch re-probes the target it follows. */\nconst REMOTE_WATCH_INTERVAL_MS = 1_000\n\n/** Key separator for the per-repository container cache. */\nconst KEY_SEPARATOR = '\\u0000'\n\n/** Mirrors `@deepseek-ai/dsh-fs-local`'s schema plus the shared container options. */\nconst ConfigSchema = z.object({\n cwd: z.string().default(process.cwd()),\n diffBasisMaxBytes: z.number().default(DEFAULT_DIFF_BASIS_MAX_BYTES),\n rpcTimeoutMs: z.number().default(DEFAULT_RPC_TIMEOUT_MS),\n ...containerOptionFields(),\n})\n\n/** The row's schema, typed for callers; the loader reads the class's static copy. */\nexport const Config = ConfigSchema as unknown as z<Config>\n\n/** A container-bound call: the repository that owns the path, and the preset that demanded it. */\ninterface RemoteRoute {\n /** The repository whose container performs the work. */\n readonly spec: RepoContainerSpec\n /** The `(devContainer)` preset that issued the call, when one is known. */\n readonly preset: string | undefined\n}\n\n/**\n * Target-taking mutation entry points a NEWER base backend declares.\n *\n * The installed `@deepseek-ai/dsh-fs-sandbox` fences only `writeText` and\n * `editText`, so `patchText`, `deleteFile`, and `moveFile` exist in no type this\n * build can `override`. They are still the way a caller holding a target reaches\n * a file, so each is installed as an own property: a container-bound call is\n * delegated over RPC, and an ordinary one runs the inherited implementation when\n * the base declares it.\n */\nconst INHERITED_MUTATIONS: readonly string[] = ['patchText', 'deleteFile', 'moveFile']\n\n/**\n * The stdio endpoint one resolved runtime offers the helper.\n * @param target - the resolved runtime.\n * @param workspace - the mount point the helper treats as home.\n * @returns the channel target the pool keys and the helper is started against.\n * @throws Error when the runtime has no stdio endpoint at all.\n */\nfunction channelTargetOf(target: ContainerTarget, workspace: string): ChannelTarget {\n switch (target.kind) {\n case 'docker': return { kind: 'docker', containerId: target.containerId, workspace }\n case 'sbx': return { kind: 'sbx', sandboxName: target.sandboxName, workspace }\n case 'devcontainer-cli':\n throw new Error('devcontainer: the Dev Container CLI offers no stdio channel for the filesystem helper')\n }\n}\n\n/** Serialize one target for the wire. */\nfunction wireTargetOf(target: FsTarget): WireTarget {\n return { targetKey: String(target.targetKey), displayPath: target.displayPath }\n}\n\n/**\n * Every folder a container path this session may use starts in.\n *\n * The specification's own mount point comes first. A Docker Sandbox also spells\n * the same workspace the way its host convention does — a Windows drive\n * directory is mounted without the drive colon, so `F:\\personal\\asmr-manager` is\n * `/f/personal/asmr-manager` inside the sandbox — and a listing that reported no\n * mounts leaves that spelling as the only usable one. The container's realpath of\n * the mount point is a third, because a Dev Container feature may have moved it.\n * @param spec - the repository container specification the call runs under.\n * @param workspaceReal - the realpath the container reported for its handshake workspace, when known.\n * @returns the mount spellings a request and a resolved identity may start with.\n */\nfunction containerMountsOf(spec: RepoContainerSpec, workspaceReal: string | undefined): string[] {\n const folders = [spec.containerWorkspaceFolder]\n if (spec.cli === 'sbx') {\n const sandbox = sandboxWorkspacePath(spec.hostWorkspaceRoot)\n if (sandbox !== undefined && sandbox !== spec.containerWorkspaceFolder) folders.push(sandbox)\n }\n if (workspaceReal !== undefined && !folders.includes(workspaceReal)) folders.push(workspaceReal)\n return folders\n}\n\n/**\n * The filesystem seam for container-bound sessions: host behaviour for ordinary\n * presets, full remote delegation for `(devContainer)` ones.\n */\nexport class DevcontainerFileSystem extends SandboxedFileSystem {\n /**\n * The schema the Loader resolves this row's config through; a static because\n * the module's `default` export is this class (see\n * `DevcontainerShellExecutor.Config` for the same reason).\n */\n static override Config = ConfigSchema\n\n /** Test seam: replaces the host CLI runner, the container process starter, and the channel. */\n containerInternals: {\n run?: ContainerRun\n spawn?: ContainerChildSpawn\n channel?: (target: ChannelTarget) => Promise<ContainerRpcChannel>\n } = {}\n\n /** The container options this row was configured with (the inherited `config` is typed by the local backend). */\n private readonly options: ContainerOptions\n\n /** Budget for one RPC round trip. */\n private readonly rpcTimeoutMs: number\n\n /** Whether the configured directory has been walked for a declaration yet. */\n private warmed = false\n\n /** Whether this composition has learned where its sandbox mounts the workspace. */\n private sbxProbed = false\n\n /** One channel per container, shared by every call of this composition. */\n private readonly pool: ContainerRpcPool\n\n /** One resolved runtime per repository, so a burst of calls probes the CLI once. */\n private readonly containers = new Map<string, Promise<ContainerTarget>>()\n\n constructor(ctx: Context, config: Config) {\n super(ctx, config)\n this.options = containerOptions(config)\n this.rpcTimeoutMs = config.rpcTimeoutMs ?? DEFAULT_RPC_TIMEOUT_MS\n this.pool = new ContainerRpcPool((argv, options) => (this.containerInternals.spawn ?? spawnContainerChild)(argv, options))\n this.installTargetMutations()\n ctx.effect(() => {\n const cache = repoRegistry(ctx)\n return () => { cache.reset() }\n })\n ctx.effect(() => () => this.pool.closeAll())\n }\n\n /**\n * Resolve a model-supplied path inside the container, or translate it onto the\n * host bind mount for an ordinary preset.\n * @param path - the path to resolve; relative paths resolve against `opts.cwd`.\n * @param opts - optional cwd override and cancellation signal.\n * @returns the stable target.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this path is outside the repository's mount.\n */\n override async resolve(path: string, opts?: { cwd?: string; signal?: AbortSignal }): Promise<FsTarget> {\n const route = await this.route(path, opts?.cwd)\n if (route === undefined) {\n const mapped = this.mapPath(path, opts?.cwd)\n const next: { cwd?: string; signal?: AbortSignal } = {}\n if (mapped.cwd !== undefined) next.cwd = mapped.cwd\n if (opts?.signal !== undefined) next.signal = opts.signal\n return await super.resolve(mapped.path, next)\n }\n const requested = this.remotePath(path, opts?.cwd, route)\n return await this.withChannel(route.spec, opts?.signal, async (channel) => {\n const answer = await this.request<WireTarget>(channel, 'fs.resolve', { path: requested }, opts?.signal)\n this.assertInsideMount(answer.targetKey, path, route, channel.handshake.workspaceReal)\n return toFsTarget(answer)\n })\n }\n\n /**\n * The host path a target stands for, when the container's spelling is not one.\n *\n * A container path names a directory inside the runtime. On a POSIX host that\n * namespace is still the host's own root, so the container spelling is a usable\n * host path and the inherited identity — the target key, which the wire also\n * carries — is the right answer. A Windows host has no such root: `/f/personal/repo`\n * is a drive-relative path there, and `path.resolve('/f/personal/repo', '.git')`\n * yields `F:\\f\\personal\\repo\\.git`, a directory no repository contains.\n *\n * Host-bound consumers read this value as a HOST path — `WorkingDirectoryService`\n * commits it as the Session directory, the project-root walk appends `.git` to\n * it, and `ctx.subprocess` starts a process in it — so a container spelling that\n * no host path module can resolve would fail them all. A Windows-rooted\n * repository therefore answers the host path of its mount; the container spelling\n * keeps the two jobs it owns, the argv a runtime is started with\n * (`buildExecArgv`) and the payload of an RPC request (`wireTargetOf`).\n * @param target - the resolved target.\n * @returns its host path, or the inherited identity outside a Windows-rooted repository.\n */\n override processPath(target: FsTarget): string {\n const spec = this.repositoryFor(target.displayPath, undefined, this.containerRequirement()?.kind)\n if (spec === undefined || hostPathStyle(spec.hostWorkspaceRoot) !== 'win32') return super.processPath(target)\n return toHostPath(String(target.targetKey), spec)\n }\n\n /**\n * Probe a path inside the container without following its final symlink.\n * @param path - the path to inspect.\n * @param opts - `cwd` overrides the base for relative paths.\n * @param signal - aborts the metadata round-trip.\n * @returns metadata only, or undefined when the path is absent.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this path is outside the repository's mount.\n */\n override async lstat(path: string, opts?: { cwd?: string }, signal?: AbortSignal): Promise<FsPathInfo | undefined> {\n const route = await this.route(path, opts?.cwd)\n if (route === undefined) {\n const mapped = this.mapPath(path, opts?.cwd)\n const next: { cwd?: string } = {}\n if (mapped.cwd !== undefined) next.cwd = mapped.cwd\n return await super.lstat(mapped.path, next, signal)\n }\n const requested = this.remotePath(path, opts?.cwd, route)\n return await this.withChannel(route.spec, signal, async (channel) => {\n const info = await this.request<WirePathInfo | null>(channel, 'fs.lstat', { path: requested }, signal)\n return info === null ? undefined : toFsPathInfo(info)\n })\n }\n\n /**\n * Read metadata of a resolved target.\n * @param target - the resolved target.\n * @param signal - aborts the metadata round-trip.\n * @returns metadata only, or undefined when the target is absent.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this target is not in a container repository.\n */\n override async stat(target: FsTarget, signal?: AbortSignal): Promise<FsInfo | undefined> {\n const route = await this.routeTarget(target)\n if (route === undefined) return await super.stat(this.fenced(target), signal)\n return await this.withChannel(route.spec, signal, async (channel) => {\n this.assertTargetInsideMount(target, route, channel)\n const value = await this.request<WireInfo | null>(channel, 'fs.stat', { target: wireTargetOf(target) }, signal)\n return value === null ? undefined : toFsInfo(value)\n })\n }\n\n /**\n * Read a whole text file inside the container.\n * @param target - the resolved target.\n * @param signal - aborts the read.\n * @returns the file's text.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this target is not in a container repository.\n */\n override async readText(target: FsTarget, signal?: AbortSignal): Promise<string> {\n const route = await this.routeTarget(target)\n if (route === undefined) return await super.readText(this.fenced(target), signal)\n return await this.withChannel(route.spec, signal, async (channel) => {\n this.assertTargetInsideMount(target, route, channel)\n return await this.request<string>(channel, 'fs.readText', { target: wireTargetOf(target) }, signal)\n })\n }\n\n /**\n * Stream a text file through the container helper's iterator.\n *\n * Only the refusal is decided here; the `fs.stream` request belongs to the\n * first iteration, so an iterator nobody reads holds no helper slot.\n * @param target - the resolved target.\n * @param signal - aborts the stream.\n * @returns the text stream.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this target is not in a container repository.\n */\n override async streamText(target: FsTarget, signal?: AbortSignal): Promise<AsyncIterable<string>> {\n const route = await this.routeTarget(target)\n if (route === undefined) return await super.streamText(this.fenced(target), signal)\n const channel = await this.remoteChannel(route.spec, signal)\n this.assertTargetInsideMount(target, route, channel)\n return this.iterate(channel, wireTargetOf(target), route.spec, signal)\n }\n\n /**\n * Read a file as bytes inside the container.\n * @param target - the resolved target.\n * @param signal - aborts the read.\n * @param maxBytes - the exclusive size limit.\n * @returns the file's bytes.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this target is not in a container repository.\n */\n override async readBytes(target: FsTarget, signal: AbortSignal | undefined, maxBytes: number): Promise<Uint8Array> {\n const route = await this.routeTarget(target)\n if (route === undefined) return await super.readBytes(this.fenced(target), signal, maxBytes)\n return await this.withChannel(route.spec, signal, async (channel) => {\n this.assertTargetInsideMount(target, route, channel)\n const encoded = await this.request<string>(\n channel, 'fs.readBytes', { target: wireTargetOf(target), maxBytes }, signal,\n )\n return Buffer.from(encoded, 'base64')\n })\n }\n\n /**\n * Read a bounded byte range inside the container.\n * @param target - the resolved target.\n * @param range - offset and length of the window.\n * @param signal - aborts the read.\n * @returns the bytes of that window.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this target is not in a container repository.\n */\n override async readByteRange(\n target: FsTarget, range: { offset: number; length: number }, signal?: AbortSignal,\n ): Promise<Uint8Array> {\n const route = await this.routeTarget(target)\n if (route === undefined) return await super.readByteRange(this.fenced(target), range, signal)\n return await this.withChannel(route.spec, signal, async (channel) => {\n this.assertTargetInsideMount(target, route, channel)\n const encoded = await this.request<string>(\n channel, 'fs.readRange', { target: wireTargetOf(target), offset: range.offset, length: range.length }, signal,\n )\n return Buffer.from(encoded, 'base64')\n })\n }\n\n /**\n * List one directory inside the container.\n * @param target - the resolved directory target.\n * @param signal - aborts the listing.\n * @returns the direct children with their resolved targets.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this target is not in a container repository.\n */\n override async listDir(target: FsTarget, signal?: AbortSignal): Promise<FsDirEntry[]> {\n const route = await this.routeTarget(target)\n if (route === undefined) return await super.listDir(this.fenced(target), signal)\n return await this.withChannel(route.spec, signal, async (channel) => {\n this.assertTargetInsideMount(target, route, channel)\n const entries = await this.request<WireDirEntry[]>(\n channel, 'fs.list', { target: wireTargetOf(target) }, signal,\n )\n return entries.map(toFsDirEntry)\n })\n }\n\n /**\n * Watch one target for the GUI.\n *\n * A host watcher would have to open a host path, which is exactly the\n * penetration this row exists to prevent, so a container-backed watcher\n * re-probes the target over RPC and reports a change when its version token\n * moves.\n * @param target - the resolved target to watch.\n * @param changed - reports each change, or a watcher failure.\n * @param signal - aborts the watch: aborting stops the polling even when the caller never calls the disposer.\n * @returns the disposer of the watcher.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this target is not in a container repository.\n */\n override async watch(\n target: FsTarget, changed: (error?: Error) => void, signal: AbortSignal,\n ): Promise<() => Promise<void>> {\n const route = await this.routeTarget(target)\n if (route === undefined) return await super.watch(this.fenced(target), changed, signal)\n signal.throwIfAborted()\n const channel = await this.remoteChannel(route.spec, signal)\n this.assertTargetInsideMount(target, route, channel)\n let version = await this.versionOf(channel, target)\n let busy = false\n let disposed = false\n const report = (error?: Error): void => {\n try {\n changed(error)\n } catch {\n // A reporter that throws must not take the poll loop down with it: the\n // watcher is the caller's only signal, and a change it dropped is still\n // visible on the next probe.\n }\n }\n const timer = setInterval(() => {\n if (busy || disposed) return\n busy = true\n void this.versionOf(channel, target).then((next) => {\n if (disposed || next === version) return\n version = next\n report()\n }, (error: unknown) => {\n // A dead container cannot heal by re-probing every interval: report it\n // once and let the caller re-resolve the target.\n stop()\n report(error instanceof Error ? error : new Error(String(error)))\n }).finally(() => { busy = false })\n }, REMOTE_WATCH_INTERVAL_MS)\n timer.unref()\n\n /** Stop polling, once; the caller's disposer and its signal both reach it. */\n const stop = (): void => {\n if (disposed) return\n disposed = true\n clearInterval(timer)\n signal.removeEventListener('abort', stop)\n }\n signal.addEventListener('abort', stop, { once: true })\n return () => {\n stop()\n return Promise.resolve()\n }\n }\n\n /**\n * Write a whole file inside the container.\n *\n * The per-call sandbox policy is deliberately not applied: it describes host\n * paths and a host mode, while the container is the confinement here.\n * @param target - the resolved target to write.\n * @param content - the full new file content.\n * @param expected - the write intent guarding the write; omit for unconditional.\n * @param signal - aborts before atomic publication takes effect.\n * @param _sandboxPolicy - the host policy, unused for a container target.\n * @returns the write outcome from the container helper.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this target is not in a container repository.\n */\n override async writeText(\n target: FsTarget, content: string, expected?: FsWriteIntent, signal?: AbortSignal,\n _sandboxPolicy?: Parameters<SandboxedFileSystem['writeText']>[4],\n ): Promise<FsWriteOutcome> {\n const route = await this.routeTarget(target)\n if (route === undefined) {\n return await super.writeText(this.fenced(target), content, expected, signal, _sandboxPolicy)\n }\n return await this.withChannel(route.spec, signal, async (channel) => {\n this.assertTargetInsideMount(target, route, channel)\n const outcome = await this.request<WireWriteOutcome>(\n channel, 'fs.write', { target: wireTargetOf(target), content, expected }, signal,\n )\n return toFsWriteOutcome(outcome)\n })\n }\n\n /**\n * Apply a literal edit inside the container.\n * @param target - the resolved target to edit.\n * @param edit - the literal search/replace request.\n * @param expected - the version guard; omit for an unconditional edit.\n * @param signal - aborts before atomic publication takes effect.\n * @param _sandboxPolicy - the host policy, unused for a container target.\n * @returns the edit outcome from the container helper.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this target is not in a container repository.\n */\n override async editText(\n target: FsTarget, edit: FsEditRequest, expected?: { version: FsVersion }, signal?: AbortSignal,\n _sandboxPolicy?: Parameters<SandboxedFileSystem['editText']>[4],\n ): Promise<FsEditOutcome> {\n const route = await this.routeTarget(target)\n if (route === undefined) {\n return await super.editText(this.fenced(target), edit, expected, signal, _sandboxPolicy)\n }\n return await this.withChannel(route.spec, signal, async (channel) => {\n this.assertTargetInsideMount(target, route, channel)\n const outcome = await this.request<WireEditOutcome>(\n channel, 'fs.edit', { target: wireTargetOf(target), edit, expected }, signal,\n )\n return toFsEditOutcome(outcome)\n })\n }\n\n /** The container channel for one route, translated into the seam's error vocabulary. */\n private async remoteChannel(spec: RepoContainerSpec, signal?: AbortSignal): Promise<ContainerRpcChannel> {\n signal?.throwIfAborted()\n const runtime = await this.runtimeTarget(spec, signal)\n // A sandbox may mount the workspace under a path of its own, which only its\n // listing reports: the helper starts in the folder that really exists there.\n const target = channelTargetOf(runtime, bindSbxMount(spec, runtime).containerWorkspaceFolder)\n const channel = this.containerInternals.channel\n if (channel !== undefined) return await channel(target)\n return await this.pool.channel(target, { timeoutMs: this.rpcTimeoutMs })\n }\n\n /**\n * Run one operation against a live channel, mapping its failures.\n * @param spec - the repository whose container is used.\n * @param signal - the caller's cancellation.\n * @param operation - the work to run with the channel.\n * @returns what the operation produced.\n * @throws FsError for every transport and remote failure.\n */\n private async withChannel<T>(\n spec: RepoContainerSpec,\n signal: AbortSignal | undefined,\n operation: (channel: ContainerRpcChannel) => Promise<T>,\n ): Promise<T> {\n try {\n const channel = await this.remoteChannel(spec, signal)\n return await operation(channel)\n } catch (error: unknown) {\n // A transport failure may mean the container was recreated, so the cached\n // id is no longer trustworthy and the next call probes again.\n if (!(error instanceof RpcOperationError)) this.forgetContainer(spec)\n throw rpcFsError(error, signal)\n }\n }\n\n /** Send one request with this row's budget. */\n private async request<T>(\n channel: ContainerRpcChannel, method: string, params: unknown, signal?: AbortSignal,\n ): Promise<T> {\n const options: RequestOptions = signal === undefined\n ? { timeoutMs: this.rpcTimeoutMs }\n : { timeoutMs: this.rpcTimeoutMs, signal }\n return await channel.request<T>(method, params, options)\n }\n\n /**\n * One text stream, opened by its first iteration and closed however it ends.\n *\n * Opening inside the generator is what makes the lifecycle airtight: an\n * iterator the caller drops without reading never sends `fs.stream`, and\n * every way an iteration can stop — completion, `break`, a throw, a cancelled\n * scope — runs the `finally` that sends `fs.streamClose`. The helper holds 64\n * streams at most, so a leaked slot is a permanent loss for the session.\n * A broken pipe drops the cached container too.\n * @param channel - the live container channel.\n * @param target - the target to stream, as the helper names it.\n * @param spec - the repository whose container is used.\n * @param signal - aborts the stream.\n * @returns the text stream.\n */\n private iterate(\n channel: ContainerRpcChannel, target: WireTarget, spec: RepoContainerSpec, signal?: AbortSignal,\n ): AsyncIterable<string> {\n const request = async <T>(method: string, params: unknown, scope?: AbortSignal): Promise<T> => {\n try {\n return await this.request<T>(channel, method, params, scope)\n } catch (error: unknown) {\n if (!(error instanceof RpcOperationError)) this.forgetContainer(spec)\n throw rpcFsError(error, scope)\n }\n }\n return (async function* stream(): AsyncIterable<string> {\n let opened: string | undefined\n let ended = false\n try {\n signal?.throwIfAborted()\n opened = (await request<WireStreamId>('fs.stream', { target }, signal)).id\n const id = opened\n while (!ended) {\n signal?.throwIfAborted()\n const step = await request<WireStreamStep>('fs.next', { id }, signal)\n ended = step.done\n if (!ended && step.value.length > 0) yield step.value\n }\n } finally {\n const id = opened\n if (id !== undefined && !ended) await request<null>('fs.streamClose', { id }).catch(() => {})\n }\n })()\n }\n\n /** The version token of one target, for the polling watcher. */\n private async versionOf(channel: ContainerRpcChannel, target: FsTarget): Promise<string> {\n const info = await this.request<WireInfo | null>(channel, 'fs.stat', { target: wireTargetOf(target) })\n return info === null ? 'absent' : info.version\n }\n\n /**\n * The runtime filesystem calls are delegated to.\n * @param spec - the repository container specification.\n * @param signal - cancels the Docker / sandbox probe.\n * @returns the resolved target the channel speaks to.\n * @throws FsError `FS_IO_ERROR` when the runtime has no stdio endpoint for the helper.\n */\n private runtimeTarget(spec: RepoContainerSpec, signal?: AbortSignal): Promise<ContainerTarget> {\n const key = this.containerKey(spec)\n const cached = this.containers.get(key)\n if (cached !== undefined) return cached\n const pending = this.probeContainer(spec, signal)\n this.containers.set(key, pending)\n pending.catch(() => {\n // A failed probe must not cache its failure; the next call retries.\n if (this.containers.get(key) === pending) this.containers.delete(key)\n })\n return pending\n }\n\n /** The cache key of one repository's container. */\n private containerKey(spec: RepoContainerSpec): string {\n return [\n spec.hostWorkspaceRoot, spec.cli, spec.container ?? '', spec.sandbox ?? '', String(spec.ensureUp),\n ].join(KEY_SEPARATOR)\n }\n\n /** Drop one cached runtime, so the next call probes again. */\n private forgetContainer(spec: RepoContainerSpec): void {\n this.containers.delete(this.containerKey(spec))\n }\n\n /** Probe where the repository's container is, requiring an endpoint the helper can be started in. */\n private async probeContainer(spec: RepoContainerSpec, signal?: AbortSignal): Promise<ContainerTarget> {\n const target = await resolveContainerTarget(spec, this.containerInternals.run ?? runContainerCommand, signal)\n if (target.kind === 'devcontainer-cli') {\n // `devcontainer exec` allocates a process of its own and offers no stdio\n // channel, so there is no pipe to run the helper over.\n throw new FsError(\n 'devcontainer: \"' + spec.configPath + '\": the filesystem bridge needs a running Docker container for \"'\n + spec.hostWorkspaceRoot + '\", but none was found; set \"container\" or \"containerName\", or let the '\n + 'Dev Container CLI start one with \"cli: auto\" and \"ensureUp: true\".',\n 'FS_IO_ERROR',\n )\n }\n return target\n }\n\n /** Translate one path for a container-bound call, refusing anything outside the mount. */\n private remotePath(path: string, cwd: string | undefined, route: RemoteRoute): string {\n const base = toContainerPath(cwd ?? this.config.cwd, route.spec)\n const absolute = isWindowsPath(path) || isPosixAbsolute(path)\n ? toContainerPath(path, route.spec)\n : posix.resolve(base, toPosixSlashes(path))\n this.assertInsideMount(absolute, path, route)\n return absolute\n }\n\n /** Refuse a container path that leaves every spelling of the repository's mount. */\n private assertInsideMount(\n containerPath: string, displayPath: string, route: RemoteRoute, workspaceReal?: string,\n ): void {\n for (const folder of containerMountsOf(route.spec, workspaceReal)) {\n if (containerRemainder(containerPath, folder) !== undefined) return\n }\n throw new FsError(fsEscapeRefusalText(displayPath, containerPath, route.preset), 'FS_PERMISSION_DENIED')\n }\n\n /** Refuse an already-resolved target that leaves the repository's mount. */\n private assertTargetInsideMount(target: FsTarget, route: RemoteRoute, channel: ContainerRpcChannel): void {\n this.assertInsideMount(String(target.targetKey), target.displayPath, route, channel.handshake.workspaceReal)\n }\n\n /**\n * Install the target-taking mutations this build's base class may not declare.\n *\n * An own property shadows the inherited method, so the wrapper is what every\n * caller reaches: a container-bound call becomes an RPC, and an ordinary one\n * still runs the inherited implementation — read from the prototype it was\n * reached through — or reports a typed failure when this backend has none.\n */\n private installTargetMutations(): void {\n const backend = this as unknown as Record<string, unknown>\n for (const method of INHERITED_MUTATIONS) {\n const inherited = backend[method]\n Object.defineProperty(this, method, {\n configurable: true,\n writable: true,\n // Async so a refusal rejects like the inherited method, instead of\n // throwing out of a call the seam contracts to answer with a promise.\n value: async (...args: unknown[]): Promise<unknown> => {\n const target = args[0] as FsTarget | undefined\n const route = target === undefined ? undefined : await this.routeTarget(target)\n if (route === undefined) {\n if (typeof inherited !== 'function') {\n throw new FsError(method + ' is not supported by this filesystem backend', 'FS_IO_ERROR')\n }\n return await (inherited as (...rest: unknown[]) => Promise<unknown>).apply(this, args)\n }\n return await this.remoteMutation(method, route, args)\n },\n })\n }\n }\n\n /** Run one installed mutation over RPC. */\n private async remoteMutation(method: string, route: RemoteRoute, args: unknown[]): Promise<unknown> {\n if (method === 'patchText') {\n const [target, hunks, expected, signal] = args as [\n FsTarget, readonly unknown[], { version: FsVersion } | undefined, AbortSignal | undefined,\n ]\n return await this.withChannel(route.spec, signal, async (channel) => {\n this.assertTargetInsideMount(target, route, channel)\n const outcome = await this.request<WireEditOutcome>(\n channel, 'fs.patch', { target: wireTargetOf(target), hunks, expected }, signal,\n )\n const edited: FsEditOutcome = toFsEditOutcome(outcome)\n return edited\n })\n }\n if (method === 'deleteFile') {\n const [target, expected, signal] = args as [\n FsTarget, { version: FsVersion } | undefined, AbortSignal | undefined,\n ]\n return await this.withChannel(route.spec, signal, async (channel) => {\n this.assertTargetInsideMount(target, route, channel)\n const outcome = await this.request<WireDeleteOutcome>(\n channel, 'fs.delete', { target: wireTargetOf(target), expected },\n )\n const deleted: ContainerDeleteOutcome = toFsDeleteOutcome(outcome)\n return deleted\n })\n }\n const [source, destination, options, signal] = args as [\n FsTarget,\n FsTarget,\n {\n hunks?: readonly unknown[]\n expectedSource?: { version: FsVersion }\n expectedDestination?: FsWriteIntent\n } | undefined,\n AbortSignal | undefined,\n ]\n const destinationRoute = await this.routeTarget(destination)\n if (destinationRoute === undefined) {\n throw new FsError('devcontainer: the move destination is outside every container repository', 'FS_PERMISSION_DENIED')\n }\n return await this.withChannel(route.spec, signal, async (channel) => {\n this.assertTargetInsideMount(source, route, channel)\n this.assertTargetInsideMount(destination, destinationRoute, channel)\n const outcome = await this.request<WireMoveOutcome>(\n channel, 'fs.move', { source: wireTargetOf(source), destination: wireTargetOf(destination), options },\n )\n const moved: ContainerMoveOutcome = toFsMoveOutcome(outcome)\n return moved\n })\n }\n\n /**\n * Route one path-taking call.\n * @param path - the path the caller named.\n * @param cwd - the directory relative paths resolve against.\n * @returns the container route, or undefined when this call keeps the host backend.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and nothing declares a container for the path.\n */\n private async route(path: string, cwd: string | undefined): Promise<RemoteRoute | undefined> {\n const requirement = this.containerRequirement()\n await this.prepareSbxMount(requirement?.kind, cwd ?? this.config.cwd)\n const spec = this.repositoryFor(path, cwd, requirement?.kind)\n if (spec === undefined) {\n this.refuseHostAccess(path)\n return undefined\n }\n if (requirement === undefined) return undefined\n return { spec, preset: requirement.preset }\n }\n\n /**\n * Route one already-resolved call.\n * @param target - the target the caller holds.\n * @returns the container route, or undefined when this call keeps the host backend.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and this target is not in a container repository.\n */\n private async routeTarget(target: FsTarget): Promise<RemoteRoute | undefined> {\n const requirement = this.containerRequirement()\n if (requirement === undefined) return undefined\n await this.prepareSbxMount(requirement.kind, this.config.cwd)\n const spec = this.repositoryFor(target.displayPath, undefined, requirement.kind)\n if (spec === undefined) {\n this.refuseHostAccess(target.displayPath)\n return undefined\n }\n return { spec, preset: requirement.preset }\n }\n\n /** Translate one path and its base directory onto the host, refusing a host-only call when the caller is container-bound. */\n private mapPath(path: string, cwd: string | undefined): { path: string; cwd: string | undefined } {\n const repository = this.repositoryFor(path, cwd, this.containerRequirement()?.kind)\n if (repository === undefined) {\n this.refuseHostAccess(path)\n return { path, cwd }\n }\n return {\n path: toHostPath(path, repository),\n cwd: cwd === undefined ? undefined : toHostPath(cwd, repository),\n }\n }\n\n /**\n * The repository whose container governs one path.\n * @param path - a host path, a container path, a sandbox path, or a relative path.\n * @param cwd - the directory relative paths resolve against; the row's configured one when absent.\n * @returns the governing specification, or undefined when the path belongs to no Dev Container repository.\n */\n private repositoryFor(\n path: string, cwd: string | undefined, kind: VariantKind | undefined,\n ): RepoContainerSpec | undefined {\n const base = cwd ?? this.config.cwd\n const options = { ...this.options, cwd: base }\n const registry = repoRegistry(this.ctx)\n const adopt = (spec: RepoContainerSpec): RepoContainerSpec => (kind === 'sbx' ? asSbxSpec(spec) : spec)\n if (!this.warmed) {\n // One walk of the configured directory, so a first call that already speaks\n // in container paths can still be attributed to its repository.\n this.warmed = true\n registry.discover(this.config.cwd, { ...this.options, cwd: this.config.cwd })\n }\n const governing = registry.locate(path, options)\n if (governing !== undefined) return adopt(governing)\n // A container-side base resolves to no host ancestry of its own, so the row's\n // configured cwd is the second chance at naming the repository it belongs to.\n // That chance is conditional: a host path somewhere else on the machine must\n // not inherit this repository's container.\n //\n // Ownership is judged in the spelling the call will run under: a `(sbx)`\n // session names the path its sandbox mounts the repository at, which is not\n // the host spelling the declaration carries, so the specification is adopted\n // first and only then asked whether the path is inside it.\n const fallback = registry.locate(base, { ...this.options, cwd: this.config.cwd })\n if (fallback !== undefined) {\n const adopted = adopt(fallback)\n if (this.belongsTo(path, base, adopted)) return adopted\n }\n if (kind !== 'sbx') return undefined\n // A Docker Sandbox needs no declaration, but the path such a session names is\n // not a host path: it is the workspace's sandbox spelling, which has no host\n // ancestry to walk and, on a host serving several workspaces, no way to reach\n // the configured directory either.\n const attributed = this.specForSandboxPath(path, adopt)\n if (attributed !== undefined) return attributed\n const root = sbxWorkspaceRootFor(path, base, undefined)\n return root === undefined ? undefined : sbxSpecFor(root, this.options)\n }\n\n /**\n * The specification a sandbox-spelled path names, reversed onto the host.\n *\n * A path a sandbox mounts is attributed from the mount itself: the host\n * directory it reported, and the workspace root that directory names — enough\n * even for a workspace that declares no container, which is exactly what a\n * `(sbx)` session mounts. The drive convention names no workspace root, only the\n * spelling this host gives such a path, so it decides only when a repository\n * declares a container above the directory it spells: `/f/…` cannot claim\n * whatever host path it happens to name, and a sandbox path outside every mount\n * stays refused locally.\n * @param path - the path the call named.\n * @param adopt - the calling track's view of a declared specification.\n * @returns the governing specification, or undefined when nothing attributes the path.\n */\n private specForSandboxPath(\n path: string, adopt: (spec: RepoContainerSpec) => RepoContainerSpec,\n ): RepoContainerSpec | undefined {\n const attributed = sandboxHostPathFor(path)\n if (attributed === undefined) return undefined\n const declared = repoRegistry(this.ctx).locate(attributed.host, { ...this.options, cwd: attributed.host })\n if (declared !== undefined) return adopt(declared)\n if (attributed.workspaceRoot === undefined) return undefined\n return sbxSpecFor(attributed.workspaceRoot, this.options)\n }\n\n /**\n * Whether the fallback repository may claim one path.\n *\n * A container path of that repository, a host path under its root, or a\n * relative path that resolves — against the same base the fallback names —\n * to somewhere inside it. Anything else is a host path the repository does\n * not own: `..` traversal and absolute paths elsewhere on the machine\n * included.\n * @param path - the path the call named.\n * @param base - the directory relative paths resolve against.\n * @param spec - the fallback repository specification.\n * @returns true when that repository owns the path.\n */\n private belongsTo(path: string, base: string, spec: RepoContainerSpec): boolean {\n if (isPathInsideContainer(path, spec)) return true\n if (relativeWithinHostRoot(path, spec.hostWorkspaceRoot) !== undefined) return true\n if (isWindowsPath(path) || isPosixAbsolute(path)) return false\n // A relative path resolves against a host directory: the bind mount when the\n // base is container-side, the base itself otherwise.\n const hostBase = toHostPath(base, spec)\n if (!isWindowsPath(hostBase) && !isPosixAbsolute(hostBase)) return true\n return relativeWithinHostRoot(joinHostRoot(hostBase, path), spec.hostWorkspaceRoot) !== undefined\n }\n\n /**\n * Learn where the sandbox really mounts this workspace, before a path is\n * attributed to it.\n *\n * A `(sbx)` session names paths in its sandbox's spelling, while a\n * specification built from a host directory carries the host spelling until a\n * listing reports the mount. Routing therefore asks the runtime once — the same\n * probe the first call would run anyway — so `/f/personal/repo` is measured\n * against the folder the sandbox reports instead of the drive path the host\n * named. A probe that fails is not reported here: the call that needs the\n * container reports it with the runtime's own diagnostic.\n * @param kind - the runtime the calling preset selects, when one does.\n * @param base - the directory this call resolves relative paths against.\n */\n private async prepareSbxMount(kind: VariantKind | undefined, base: string): Promise<void> {\n if (kind !== 'sbx' || this.sbxProbed) return\n this.sbxProbed = true\n const registry = repoRegistry(this.ctx)\n const declared = registry.locate(base, { ...this.options, cwd: this.config.cwd })\n const root = declared?.hostWorkspaceRoot ?? base\n if (root === '') return\n await this.runtimeTarget(sbxSpecFor(root, this.options, declared)).catch(() => {})\n }\n\n /**\n * The container requirement governing this call.\n *\n * A `(devContainer)` preset promises container execution, so its filesystem\n * calls must not reach the host either; `requireContainer` asks for the same\n * guarantee from every preset. Both are read per call, so switching presets\n * mid-session needs no reload.\n * @returns the requirement and the preset that states it, or undefined when this call may use the host.\n */\n private containerRequirement(): { preset: string | undefined, kind: VariantKind | undefined } | undefined {\n const preset = callingContainerPreset(this.ctx)\n if (preset !== undefined) return { preset, kind: presetKindOf(preset) }\n return this.options.requireContainer ? { preset: undefined, kind: undefined } : undefined\n }\n\n /**\n * Refuse a call that would leave the container's repository.\n * @param path - the path the call names, for the diagnostic.\n * @param resolved - the resolved path the helper would use for I/O, when it differs from `path`.\n * @throws FsError `FS_PERMISSION_DENIED` when nothing in that path's ancestry declares a container.\n */\n private refuseHostAccess(path: string, resolved?: string): void {\n const requirement = this.containerRequirement()\n if (requirement === undefined) return\n const text = resolved === undefined\n ? fsRefusalText(path, requirement.preset)\n : fsEscapeRefusalText(path, resolved, requirement.preset)\n throw new FsError(text, 'FS_PERMISSION_DENIED')\n }\n\n /**\n * Fence one already-resolved target for a host call.\n *\n * A target can outlive the state it was resolved under — a preset switched\n * between the read and the write, a declaration deleted mid-session — so the\n * requirement is re-read here rather than trusted from the ingress check. Both\n * spellings a target carries are fenced, because they answer different\n * questions: `displayPath` is the path the caller named, while `targetKey` is\n * the realpath the backend actually opens.\n * @param target - the target the operation would use.\n * @returns the same target, so callers fence in place.\n * @throws FsError `FS_PERMISSION_DENIED` when the caller is container-bound and either spelling belongs to no container repository.\n */\n private fenced(target: FsTarget): FsTarget {\n // Reading the requirement first is what keeps an ordinary session cheap: it\n // is an in-memory lookup, while each `repositoryFor` below may walk the\n // target's ancestors, and neither check can refuse anything when the\n // requirement is absent.\n const requirement = this.containerRequirement()\n if (requirement === undefined) return target\n if (this.repositoryFor(target.displayPath, undefined, requirement.kind) === undefined) {\n this.refuseHostAccess(target.displayPath)\n return target\n }\n const resolved = String(target.targetKey)\n if (this.repositoryFor(resolved, undefined, requirement.kind) === undefined) {\n this.refuseHostAccess(target.displayPath, resolved)\n }\n return target\n }\n}\n\nexport default DevcontainerFileSystem\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAeA,MAAa,wBAAwB;;AAGrC,MAAa,6BAA6B;AAE1C,IAAI;;;;;AAMJ,SAAgB,mBAA2B;CACzC,OAAO,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,UAAU,UAAU;AAC3E;;;;;;AAOA,SAAgB,eAAuB;CACrC,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