@ai-hero/sandcastle 0.13.0 → 0.14.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 (66) hide show
  1. package/README.md +3 -3
  2. package/dist/{SandboxProvider-YCL97qco.d.ts → SandboxProvider-Chsi-Zs6.d.ts} +3 -2
  3. package/dist/{chunk-767EAJVT.js → chunk-ATA2V2TC.js} +3 -3
  4. package/dist/{chunk-767EAJVT.js.map → chunk-ATA2V2TC.js.map} +1 -1
  5. package/dist/{chunk-4EIVTSOZ.js → chunk-BIF2X6QB.js} +4 -3
  6. package/dist/chunk-BIF2X6QB.js.map +1 -0
  7. package/dist/{chunk-XCYK7I45.js → chunk-BVZWLFFT.js} +2 -2
  8. package/dist/chunk-BVZWLFFT.js.map +1 -0
  9. package/dist/chunk-EXYXBRCX.js +60 -0
  10. package/dist/chunk-EXYXBRCX.js.map +1 -0
  11. package/dist/chunk-G2R53CVZ.js +3172 -0
  12. package/dist/chunk-G2R53CVZ.js.map +1 -0
  13. package/dist/{chunk-U42XXICG.js → chunk-GCLEXPXG.js} +7 -4
  14. package/dist/chunk-GCLEXPXG.js.map +1 -0
  15. package/dist/chunk-H2PEFS4W.js +1244 -0
  16. package/dist/chunk-H2PEFS4W.js.map +1 -0
  17. package/dist/{chunk-NMQ5Z6YG.js → chunk-HSXPRZKG.js} +5 -3
  18. package/dist/chunk-HSXPRZKG.js.map +1 -0
  19. package/dist/{chunk-J5J5YJ5S.js → chunk-IBK2XNSS.js} +3 -3
  20. package/dist/{chunk-J5J5YJ5S.js.map → chunk-IBK2XNSS.js.map} +1 -1
  21. package/dist/chunk-RDW7FNN6.js +792 -0
  22. package/dist/chunk-RDW7FNN6.js.map +1 -0
  23. package/dist/{chunk-A4C2FG74.js → chunk-S6UHPTRG.js} +43 -42
  24. package/dist/chunk-S6UHPTRG.js.map +1 -0
  25. package/dist/{chunk-LWNC4UTZ.js → chunk-STB2U7BB.js} +5414 -9389
  26. package/dist/chunk-STB2U7BB.js.map +1 -0
  27. package/dist/{chunk-XCWKLDH4.js → chunk-VRXR2T3S.js} +3 -3
  28. package/dist/{chunk-XCWKLDH4.js.map → chunk-VRXR2T3S.js.map} +1 -1
  29. package/dist/index.d.ts +6 -2
  30. package/dist/index.js +458 -1675
  31. package/dist/index.js.map +1 -1
  32. package/dist/main.js +262 -247
  33. package/dist/main.js.map +1 -1
  34. package/dist/sandboxes/bwrap.d.ts +1 -1
  35. package/dist/sandboxes/bwrap.js +9 -6
  36. package/dist/sandboxes/bwrap.js.map +1 -1
  37. package/dist/sandboxes/daytona.d.ts +1 -1
  38. package/dist/sandboxes/daytona.js +179 -135
  39. package/dist/sandboxes/daytona.js.map +1 -1
  40. package/dist/sandboxes/docker.d.ts +1 -1
  41. package/dist/sandboxes/docker.js +6 -3
  42. package/dist/sandboxes/e2b.d.ts +41 -0
  43. package/dist/sandboxes/e2b.js +202 -0
  44. package/dist/sandboxes/e2b.js.map +1 -0
  45. package/dist/sandboxes/modal.d.ts +78 -0
  46. package/dist/sandboxes/modal.js +171 -0
  47. package/dist/sandboxes/modal.js.map +1 -0
  48. package/dist/sandboxes/no-sandbox.d.ts +1 -1
  49. package/dist/sandboxes/podman.d.ts +1 -1
  50. package/dist/sandboxes/podman.js +6 -3
  51. package/dist/sandboxes/podman.js.map +1 -1
  52. package/dist/sandboxes/seatbelt.d.ts +1 -1
  53. package/dist/sandboxes/seatbelt.js +9 -6
  54. package/dist/sandboxes/seatbelt.js.map +1 -1
  55. package/dist/sandboxes/sprites.d.ts +54 -0
  56. package/dist/sandboxes/sprites.js +198 -0
  57. package/dist/sandboxes/sprites.js.map +1 -0
  58. package/dist/sandboxes/vercel.d.ts +1 -1
  59. package/dist/sandboxes/vercel.js +1 -1
  60. package/package.json +30 -2
  61. package/dist/chunk-4EIVTSOZ.js.map +0 -1
  62. package/dist/chunk-A4C2FG74.js.map +0 -1
  63. package/dist/chunk-LWNC4UTZ.js.map +0 -1
  64. package/dist/chunk-NMQ5Z6YG.js.map +0 -1
  65. package/dist/chunk-U42XXICG.js.map +0 -1
  66. package/dist/chunk-XCYK7I45.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/nativeSandboxIo.ts","../src/hostPathToolchain.ts","../src/identityMounts.ts"],"names":[],"mappings":";;;;;;;;AAeO,IAAM,aAAA,GAAgB,CAC3B,IAAA,EACA,MAAA,EACA,YAAA,KAC+C;AAC/C,EAAA,MAAM,YAAY,MAAA,KAAW,MAAA;AAC7B,EAAA,MAAM,MAAA,GAAS,YACX,IAAI,WAAA,CAAY,cAAc,IAAI,CAAA,GAClC,IAAI,WAAA,CAAY,QAAQ,CAAA;AAC5B,EAAA,MAAM,MAAA,GAAS,IAAI,WAAA,CAAY,SAAA,GAAY,eAAe,QAAQ,CAAA;AAClE,EAAA,IAAI,WAAW,MAAA,EAAW;AACxB,IAAA,IAAA,CAAK,MAAA,CAAO,EAAA,CAAG,MAAA,EAAQ,CAAC,KAAA,KAAkB;AACxC,MAAA,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,QAAA,EAAU,CAAA;AAAA,IAC9B,CAAC,CAAA;AAAA,EACH,CAAA,MAAO;AACL,IAAA,eAAA,CAAgB,EAAE,OAAO,IAAA,CAAK,MAAA,EAAQ,CAAA,CAAE,EAAA,CAAG,MAAA,EAAQ,CAAC,IAAA,KAAS;AAC3D,MAAA,MAAA,CAAO,KAAK,IAAI,CAAA;AAChB,MAAA,MAAA,CAAO,IAAI,CAAA;AAAA,IACb,CAAC,CAAA;AAAA,EACH;AACA,EAAA,IAAA,CAAK,MAAA,CAAO,EAAA,CAAG,MAAA,EAAQ,CAAC,KAAA,KAAkB;AACxC,IAAA,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,QAAA,EAAU,CAAA;AAAA,EAC9B,CAAC,CAAA;AACD,EAAA,OAAO,OAAO,EAAE,MAAA,EAAQ,MAAA,CAAO,UAAS,EAAG,MAAA,EAAQ,MAAA,CAAO,QAA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A,EAAiB,SAAS,WAAW,CAAA,EAAA;AAAA,KACtG;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL,UAAU,QAAA,CAAS,QAAA;AAAA,IACnB,QAAA,EAAU,SAAS,QAAA,KAAa;AAAA,GAClC;AACF,CAAC","file":"chunk-NMQ5Z6YG.js","sourcesContent":["/**\n * Provider-agnostic helpers for the native sandbox providers (`bwrap()`,\n * `seatbelt()`): collecting a child process's output, and copying a file\n * between host paths. Each is purely a function of its inputs.\n */\n\nimport type { ChildProcessWithoutNullStreams } from \"node:child_process\";\nimport { dirname } from \"node:path\";\nimport { createInterface } from \"node:readline\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Effect } from \"effect\";\nimport { BoundedTail } from \"./boundedTail.js\";\nimport { CopyError } from \"./errors.js\";\n\n/** Collects a child's output: streamed line by line with a bounded tail, or whole. */\nexport const collectOutput = (\n proc: ChildProcessWithoutNullStreams,\n onLine: ((line: string) => void) | undefined,\n maxTailChars: number,\n): (() => { stdout: string; stderr: string }) => {\n const streaming = onLine !== undefined;\n const stdout = streaming\n ? new BoundedTail(maxTailChars, \"\\n\")\n : new BoundedTail(Infinity);\n const stderr = new BoundedTail(streaming ? maxTailChars : Infinity);\n if (onLine === undefined) {\n proc.stdout.on(\"data\", (chunk: Buffer) => {\n stdout.push(chunk.toString());\n });\n } else {\n createInterface({ input: proc.stdout }).on(\"line\", (line) => {\n stdout.push(line);\n onLine(line);\n });\n }\n proc.stderr.on(\"data\", (chunk: Buffer) => {\n stderr.push(chunk.toString());\n });\n return () => ({ stdout: stdout.toString(), stderr: stderr.toString() });\n};\n\n/** Copies a file, creating the target's parent dirs. */\nexport const copyCreatingParents = (\n from: string,\n to: string,\n): Effect.Effect<void, CopyError, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n yield* fs.makeDirectory(dirname(to), { recursive: true });\n yield* fs.copyFile(from, to);\n }).pipe(\n Effect.mapError(\n (e) =>\n new CopyError({\n message: `Couldn't copy ${from} to ${to}: ${e.message}`,\n }),\n ),\n );\n","/**\n * Resolves the host toolchain a native sandbox provider should make readable,\n * from the host `PATH`: every `PATH` dir, plus the install root of each\n * executable symlinked from those dirs (an nvm-installed `codex`, a `claude`\n * symlinked into `~/.local/bin`). A dir equal to the home dir or an ancestor\n * of it is refused, so the toolchain never exposes the whole home, and an\n * install root that holds a `.git` is refused, so it never exposes a repo.\n *\n * Provider-agnostic: it takes paths and returns paths. Shared by the native\n * sandbox providers.\n */\n\nimport { homedir } from \"node:os\";\nimport { posix } from \"node:path\";\nimport { FileSystem } from \"@effect/platform\";\nimport { Config, Effect, Option } from \"effect\";\n\n/** What to resolve the toolchain from. */\nexport interface HostPathToolchainInput {\n /** The host `PATH`. */\n readonly path: string;\n /** The host home dir: it and its ancestors are never made readable. */\n readonly home: string;\n /** Dirs the sandbox already shows: nothing inside them is returned to mount. */\n readonly coveredRoots: readonly string[];\n /** Dirs that must stay hidden: `PATH` dirs and install roots inside them are refused. */\n readonly deniedRoots: readonly string[];\n}\n\n/** The toolchain a sandbox needs, all at host paths. */\nexport interface HostPathToolchain {\n /** The `PATH` for the sandboxed child: the host `PATH` dirs it can see, in order. */\n readonly pathEntries: readonly string[];\n /** Real dirs to make readable at their own paths. */\n readonly readableDirs: readonly string[];\n /** `PATH` dirs that are symlinks on the host, to recreate pointing at their real dir. */\n readonly symlinks: readonly {\n readonly path: string;\n readonly target: string;\n }[];\n}\n\nconst isWithin = (path: string, root: string): boolean =>\n root === \"/\" || path === root || path.startsWith(`${root}/`);\n\nconst isWithinAny = (path: string, roots: readonly string[]): boolean =>\n roots.some((root) => isWithin(path, root));\n\n/** True for the home dir itself and every ancestor of it, `/` included. */\nconst isHomeOrAncestor = (path: string, home: string): boolean =>\n isWithin(home, path);\n\nconst normalizeEntry = (entry: string): string => {\n const normalized = posix.normalize(entry);\n return normalized.length > 1 && normalized.endsWith(\"/\")\n ? normalized.slice(0, -1)\n : normalized;\n};\n\nconst realPathOf = (\n fs: FileSystem.FileSystem,\n path: string,\n): Effect.Effect<Option.Option<string>> => Effect.option(fs.realPath(path));\n\n/** True when `dir` sits inside a `node_modules` tree. */\nconst isInNodeModules = (dir: string): boolean =>\n dir.split(\"/\").includes(\"node_modules\");\n\n/**\n * The install root of an executable's real file: the nearest ancestor holding\n * a `package.json` inside a `node_modules` tree (a globally installed Node\n * package's bin pulls in its own files), else the file's dir. A `package.json`\n * outside `node_modules` (an `npm link`ed checkout, a stray one above a\n * projects dir) is not an install root: mounting it would expose a project.\n * The search stops below the home dir.\n */\nconst installRootOf = (\n fs: FileSystem.FileSystem,\n file: string,\n home: string,\n): Effect.Effect<string> =>\n Effect.gen(function* () {\n const fileDir = posix.dirname(file);\n let dir = fileDir;\n while (isInNodeModules(dir) && !isHomeOrAncestor(dir, home)) {\n const hasPackageJson = yield* fs\n .exists(posix.join(dir, \"package.json\"))\n .pipe(Effect.orElseSucceed(() => false));\n if (hasPackageJson) {\n return dir;\n }\n dir = posix.dirname(dir);\n }\n return fileDir;\n });\n\n/** True when `dir` holds a `.git`: a repo's checkout is never an install root. */\nconst isRepoRoot = (\n fs: FileSystem.FileSystem,\n dir: string,\n): Effect.Effect<boolean> =>\n fs.exists(posix.join(dir, \".git\")).pipe(Effect.orElseSucceed(() => false));\n\n/** The real files behind the symlinks directly inside `dir`. */\nconst symlinkTargetsIn = (\n fs: FileSystem.FileSystem,\n dir: string,\n): Effect.Effect<string[]> =>\n Effect.gen(function* () {\n const names = yield* fs\n .readDirectory(dir)\n .pipe(Effect.orElseSucceed((): string[] => []));\n const targets = yield* Effect.forEach(\n names,\n (name) =>\n Effect.gen(function* () {\n const entry = posix.join(dir, name);\n const link = yield* Effect.option(fs.readLink(entry));\n return Option.isSome(link)\n ? yield* realPathOf(fs, entry)\n : Option.none<string>();\n }),\n { concurrency: 32 },\n );\n return targets.flatMap((t) => (Option.isSome(t) ? [t.value] : []));\n });\n\n/** The rules every resolved path is held to. */\ninterface Rules {\n readonly home: string;\n readonly coveredRoots: readonly string[];\n readonly deniedRoots: readonly string[];\n}\n\nconst isRefused = (path: string, rules: Rules): boolean =>\n isHomeOrAncestor(path, rules.home) || isWithinAny(path, rules.deniedRoots);\n\n/** A `PATH` entry the sandbox may see, and the real dir behind it. */\ninterface AcceptedEntry {\n readonly entry: string;\n readonly real: string;\n}\n\n/** Accepts a `PATH` entry that exists and isn't refused, by itself or by its real dir. */\nconst acceptEntry = (\n fs: FileSystem.FileSystem,\n entry: string,\n rules: Rules,\n): Effect.Effect<Option.Option<AcceptedEntry>> =>\n isRefused(entry, rules)\n ? Effect.succeed(Option.none())\n : realPathOf(fs, entry).pipe(\n Effect.map(Option.filter((real) => !isRefused(real, rules))),\n Effect.map(Option.map((real) => ({ entry, real }))),\n );\n\n/** The install roots of the executables symlinked from `dir` to outside it. */\nconst installRootsIn = (\n fs: FileSystem.FileSystem,\n dir: string,\n rules: Rules,\n): Effect.Effect<string[]> =>\n Effect.gen(function* () {\n const targets = (yield* symlinkTargetsIn(fs, dir)).filter(\n (target) =>\n !isWithin(target, dir) && !isWithinAny(target, rules.coveredRoots),\n );\n const roots = yield* Effect.all(\n targets.map((target) => installRootOf(fs, target, rules.home)),\n );\n return yield* Effect.filter(\n roots.filter((root) => !isRefused(root, rules)),\n (root) => Effect.map(isRepoRoot(fs, root), (isRepo) => !isRepo),\n );\n });\n\n/** Keeps only the dirs not inside another dir of the list. */\nconst outermost = (dirs: readonly string[]): string[] => {\n const unique = [...new Set(dirs)];\n return unique.filter(\n (dir) => !unique.some((other) => other !== dir && isWithin(dir, other)),\n );\n};\n\n/** Resolves the toolchain a sandbox needs from the host `PATH`. */\nexport const resolveHostPathToolchain = (\n input: HostPathToolchainInput,\n): Effect.Effect<HostPathToolchain, never, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const rules: Rules = { ...input, home: normalizeEntry(input.home) };\n const entries = [\n ...new Set(\n input.path\n .split(\":\")\n .filter((entry) => entry.startsWith(\"/\"))\n .map((entry) => normalizeEntry(entry)),\n ),\n ];\n const accepted = (yield* Effect.all(\n entries.map((entry) => acceptEntry(fs, entry, rules)),\n )).flatMap((a) => (Option.isSome(a) ? [a.value] : []));\n const uncovered = accepted.filter(\n (a) => !isWithinAny(a.real, rules.coveredRoots),\n );\n const installRoots = yield* Effect.all(\n [...new Set(accepted.map((a) => a.real))].map((dir) =>\n installRootsIn(fs, dir, rules),\n ),\n );\n return {\n pathEntries: accepted.map((a) => a.entry),\n readableDirs: outermost([\n ...uncovered.map((a) => a.real),\n ...installRoots.flat(),\n ]),\n symlinks: uncovered\n .filter(\n (a) =>\n a.real !== a.entry && !isWithinAny(a.entry, rules.coveredRoots),\n )\n .map((a) => ({ path: a.entry, target: a.real })),\n };\n });\n\n/**\n * {@link resolveHostPathToolchain} for this process: the host `PATH` and home\n * dir come from the environment.\n */\nexport const hostPathToolchainFromEnv = (roots: {\n readonly coveredRoots: readonly string[];\n readonly deniedRoots: readonly string[];\n}): Effect.Effect<HostPathToolchain, never, FileSystem.FileSystem> =>\n Effect.gen(function* () {\n const path = yield* Config.string(\"PATH\").pipe(Config.withDefault(\"\"));\n return yield* resolveHostPathToolchain({ path, home: homedir(), ...roots });\n }).pipe(Effect.orDie);\n","/**\n * Identity mounts: the `mounts` option of the native sandbox providers, where\n * every path appears inside the sandbox at its own host path. Provider-agnostic:\n * shared by the native sandbox providers.\n */\n\nimport type { MountConfig } from \"./MountConfig.js\";\nimport { resolveUserMounts } from \"./mountUtils.js\";\n\nexport type { MountConfig } from \"./MountConfig.js\";\n\n/** A resolved mount that appears at its own host path. */\nexport interface IdentityMount {\n readonly hostPath: string;\n readonly readonly: boolean;\n}\n\n/**\n * Resolves `mounts` (tilde and relative paths, as for every provider) and\n * checks each appears at its own host path. Throws, naming `provider`, when a\n * resolved `sandboxPath` differs from its resolved `hostPath`, or when a\n * `hostPath` doesn't exist.\n */\nexport const resolveIdentityMounts = (\n provider: string,\n mounts: readonly MountConfig[],\n sandboxHomedir: string,\n): IdentityMount[] =>\n resolveUserMounts(mounts, sandboxHomedir).map((resolved, i) => {\n if (resolved.sandboxPath !== resolved.hostPath) {\n const given = mounts[i];\n throw new Error(\n `${provider}() mounts appear at their host path, so sandboxPath must equal hostPath: ` +\n `got hostPath ${given?.hostPath ?? resolved.hostPath} (resolved to ${resolved.hostPath}) ` +\n `and sandboxPath ${given?.sandboxPath ?? resolved.sandboxPath} (resolved to ${resolved.sandboxPath}).`,\n );\n }\n return {\n hostPath: resolved.hostPath,\n readonly: resolved.readonly === true,\n };\n });\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/DockerLifecycle.ts","../src/sandboxes/docker.ts"],"names":["resolve","execFile"],"mappings":";;;;;;;;;;AAWA,IAAM,aAAa,CAAC,IAAA,KAClB,cAAA,CAAO,KAAA,CAAM,CAAC,MAAA,KAAW;AACvB,EAAA,QAAA;AAAA,IACE,QAAA;AAAA,IACA,IAAA;AAAA,IACA,EAAE,SAAA,EAAW,EAAA,GAAK,IAAA,GAAO,IAAA,EAAK;AAAA,IAC9B,CAAC,KAAA,EAAO,MAAA,EAAQ,MAAA,KAAW;AACzB,MAAA,IAAI,KAAA,EAAO;AACT,QAAA,MAAA;AAAA,UACE,cAAA,CAAO,IAAA;AAAA,YACL,IAAI,WAAA,CAAY;AAAA,cACd,OAAA,EAAS,UAAU,IAAA,CAAK,CAAC,CAAC,CAAA,SAAA,EAAY,MAAA,IAAU,MAAM,OAAO,CAAA;AAAA,aAC9D;AAAA;AACH,SACF;AAAA,MACF,CAAA,MAAO;AACL,QAAA,MAAA,CAAO,cAAA,CAAO,OAAA,CAAQ,MAAM,CAAC,CAAA;AAAA,MAC/B;AAAA,IACF;AAAA,GACF;AACF,CAAC,CAAA;AASI,IAAM,aAAa,CACxB,SAAA,EACA,eACA,OAAA,KAKA,cAAA,CAAO,IAAI,aAAa;AACtB,EAAA,MAAM,gBAAgB,MAAA,CAAO,OAAA,CAAQ,SAAS,SAAA,IAAa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,SACF;AACA,QAAA;AAAA,MACF;AACA,MAAA,MAAM,SAAA,GAAA,CAAa,MAAA,IAAU,EAAA,EAAI,IAAA,EAAK;AACtC,MAAA,IAAI,CAAC,SAAA,EAAW;AAEd,QAAAD,QAAAA,EAAQ;AACR,QAAA;AAAA,MACF;AACA,MAAA,MAAM,UAAU,SAAA,CAAU,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,IAAK,EAAA;AAC3C,MAAA,MAAM,QAAA,GAAW,MAAA,CAAO,QAAA,CAAS,OAAA,EAAS,EAAE,CAAA;AAC5C,MAAA,IAAI,KAAA,CAAM,QAAQ,CAAA,EAAG;AAEnB,QAAAA,QAAAA,EAAQ;AACR,QAAA;AAAA,MACF;AACA,MAAA,IAAI,aAAa,WAAA,EAAa;AAC5B,QAAAA,QAAAA,EAAQ;AAAA,MACV,CAAA,MAAO;AACL,QAAA,MAAA;AAAA,UACE,IAAI,KAAA;AAAA,YACF,wBAAwB,SAAS,CAAA,qBAAA,EAAwB,QAAQ,CAAA,0BAAA,EACpC,WAAW,mFAEb,QAAQ,CAAA,gCAAA;AAAA;AACrC,SACF;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF,CAAC,CAAA","file":"chunk-U42XXICG.js","sourcesContent":["import { Effect } from \"effect\";\nimport { execFile } from \"node:child_process\";\nimport { resolve } from \"node:path\";\nimport { DockerError, ImageNotFoundError } from \"./errors.js\";\nimport { formatVolumeMount } from \"./mountUtils.js\";\nimport type { SelinuxLabel } from \"./mountUtils.js\";\nimport type { LinuxCapability } from \"./LinuxCapability.js\";\n\n// Re-exported so docker.ts gets it with the lifecycle it already imports.\nexport type { LinuxCapability } from \"./LinuxCapability.js\";\n\nconst dockerExec = (args: string[]): Effect.Effect<string, DockerError> =>\n Effect.async((resume) => {\n execFile(\n \"docker\",\n args,\n { maxBuffer: 10 * 1024 * 1024 },\n (error, stdout, stderr) => {\n if (error) {\n resume(\n Effect.fail(\n new DockerError({\n message: `docker ${args[0]} failed: ${stderr || error.message}`,\n }),\n ),\n );\n } else {\n resume(Effect.succeed(stdout));\n }\n },\n );\n });\n\n/**\n * Build the sandcastle Docker image.\n *\n * When `dockerfile` is provided, uses `docker build -f <dockerfile> <cwd>`\n * so COPY instructions resolve relative to the current working directory.\n * Otherwise, uses `docker build <dockerfileDir>` (the default .sandcastle/ directory).\n */\nexport const buildImage = (\n imageName: string,\n dockerfileDir: string,\n options?: {\n readonly dockerfile?: string;\n readonly buildArgs?: Record<string, string>;\n },\n): Effect.Effect<void, DockerError> =>\n Effect.gen(function* () {\n const buildArgFlags = Object.entries(options?.buildArgs ?? {}).flatMap(\n ([k, v]) => [\"--build-arg\", `${k}=${v}`],\n );\n const dockerfile = options?.dockerfile;\n const buildContext =\n dockerfile !== undefined && dockerfile !== \"\"\n ? [\"-f\", resolve(dockerfile), process.cwd()]\n : [resolve(dockerfileDir)];\n yield* dockerExec([\n \"build\",\n \"-t\",\n imageName,\n ...buildArgFlags,\n ...buildContext,\n ]);\n });\n\nexport interface VolumeMount {\n readonly hostPath: string;\n readonly sandboxPath: string;\n readonly readonly?: boolean;\n}\n\nexport interface StartContainerOptions {\n readonly volumeMounts?: readonly VolumeMount[];\n readonly workdir?: string;\n /** Run the container as this uid:gid instead of the Dockerfile's USER. */\n readonly user?: string;\n /** Docker network(s) to attach the container to. Passed as `--network` flags. */\n readonly network?: string | readonly string[];\n /** Supplementary groups to add the container user to. Passed as `--group-add` flags. */\n readonly groups?: readonly (string | number)[];\n /** Linux capabilities to drop from the container. Passed as `--cap-drop` flags. */\n readonly capDrop?: readonly LinuxCapability[];\n /** Host devices to expose to the container. Passed as `--device` flags. */\n readonly devices?: readonly string[];\n /** Limit CPU resources via `--cpus` (e.g. `1.5`). Fractional values allowed. */\n readonly cpus?: number;\n /**\n * SELinux volume label suffix applied to bind mounts (default `\"z\"`).\n *\n * - `\"z\"` — shared label. No-op on non-SELinux systems.\n * - `\"Z\"` — private label; only this container can access the mount.\n * - `false` — disable labeling entirely.\n */\n readonly selinuxLabel?: SelinuxLabel;\n}\n\n/**\n * Start a new container with environment variables injected.\n */\nexport const startContainer = (\n containerName: string,\n imageName: string,\n env: Record<string, string>,\n options?: StartContainerOptions,\n): Effect.Effect<void, DockerError> =>\n Effect.gen(function* () {\n // Check if container already exists\n const existing = yield* dockerExec([\n \"ps\",\n \"-a\",\n \"--filter\",\n `name=^${containerName}$`,\n \"--format\",\n \"{{.Names}}\",\n ]);\n\n if (existing.trim() === containerName) {\n return yield* new DockerError({\n message: `Container '${containerName}' already exists. Run cleanup first.`,\n });\n }\n\n const envFlags = Object.entries(env).flatMap(([k, v]) => [\n \"-e\",\n `${k}=${v}`,\n ]);\n\n const selinuxLabel = options?.selinuxLabel ?? \"z\";\n const volumeFlags = (options?.volumeMounts ?? []).flatMap((mount) => [\n \"-v\",\n formatVolumeMount(mount, selinuxLabel),\n ]);\n\n const workdir = options?.workdir;\n const workdirFlags =\n workdir !== undefined && workdir !== \"\" ? [\"-w\", workdir] : [];\n const user = options?.user;\n const userFlags = user !== undefined && user !== \"\" ? [\"--user\", user] : [];\n const network = options?.network;\n const networks =\n network === undefined || network === \"\" ? [] : [network].flat();\n const networkFlags = networks.flatMap((n) => [\"--network\", n]);\n const groupAddFlags = (options?.groups ?? []).flatMap((g) => [\n \"--group-add\",\n String(g),\n ]);\n const capDropFlags = (options?.capDrop ?? []).flatMap((cap) => [\n \"--cap-drop\",\n cap,\n ]);\n const deviceFlags = (options?.devices ?? []).flatMap((d) => [\n \"--device\",\n d,\n ]);\n const cpusFlags =\n options?.cpus === undefined ? [] : [\"--cpus\", String(options.cpus)];\n\n return yield* dockerExec([\n \"run\",\n \"-d\",\n \"--name\",\n containerName,\n ...envFlags,\n ...volumeFlags,\n ...workdirFlags,\n ...userFlags,\n ...networkFlags,\n ...groupAddFlags,\n ...capDropFlags,\n ...deviceFlags,\n ...cpusFlags,\n imageName,\n ]).pipe(Effect.asVoid);\n });\n\n/**\n * Stop and remove a container without removing the image.\n */\nexport const removeContainer = (\n containerName: string,\n): Effect.Effect<void, DockerError> =>\n Effect.gen(function* () {\n // Stop container (ignore errors if already stopped)\n yield* Effect.ignore(dockerExec([\"stop\", containerName]));\n // Remove container (ignore errors if not found)\n yield* Effect.ignore(dockerExec([\"rm\", containerName]));\n });\n\n/**\n * Remove a Docker image.\n */\nexport const removeImage = (\n imageName: string,\n): Effect.Effect<void, DockerError | ImageNotFoundError> =>\n dockerExec([\"rmi\", imageName]).pipe(\n Effect.asVoid,\n Effect.catchTag(\n \"DockerError\",\n (error): Effect.Effect<never, DockerError | ImageNotFoundError> =>\n error.message.includes(\"No such image\")\n ? Effect.fail(\n new ImageNotFoundError({\n message: `Docker image '${imageName}' does not exist, so there is nothing to remove.`,\n }),\n )\n : Effect.fail(error),\n ),\n );\n","/**\n * Docker sandbox provider — wraps DockerLifecycle into a SandboxProvider.\n *\n * Usage:\n * import { docker } from \"sandcastle/sandboxes/docker\";\n * await run({ agent: claudeCode(\"claude-opus-4-8\"), sandbox: docker() });\n */\n\nimport { execFile, execFileSync, spawn } from \"node:child_process\";\nimport type { StdioOptions } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { createInterface } from \"node:readline\";\nimport { Effect } from \"effect\";\nimport { startContainer, removeContainer } from \"../DockerLifecycle.js\";\nimport type { LinuxCapability } from \"../DockerLifecycle.js\";\nimport { createBindMountSandboxProvider } from \"../SandboxProvider.js\";\nimport type {\n SandboxProvider,\n BindMountCreateOptions,\n BindMountSandboxHandle,\n ExecResult,\n InteractiveExecOptions,\n} from \"../SandboxProvider.js\";\nimport type { MountConfig } from \"../MountConfig.js\";\nimport type { SelinuxLabel } from \"../mountUtils.js\";\nimport {\n defaultImageName,\n resolveUserMounts,\n processFileMountParents,\n} from \"../mountUtils.js\";\nimport { BoundedTail, MAX_TAIL_CHARS } from \"../boundedTail.js\";\nimport { registerShutdown } from \"../shutdownRegistry.js\";\n\nexport interface DockerOptions {\n /** Docker image name (default: derived from repo directory name). */\n readonly imageName?: string;\n /**\n * The UID of the `agent` user inside the container image (default: host UID via `process.getuid()`, or 1000).\n *\n * Must match the UID baked into the image at build time. Used as the `--user` flag value\n * and checked against the image's configured UID in the pre-flight diagnostic.\n */\n readonly containerUid?: number;\n /**\n * The GID of the `agent` user inside the container image (default: host GID via `process.getgid()`, or 1000).\n *\n * Must match the GID baked into the image at build time. Used as the `--user` flag value.\n */\n readonly containerGid?: number;\n /**\n * SELinux volume label suffix applied to bind mounts.\n *\n * - `\"z\"` — shared label (default). No-op on non-SELinux systems.\n * - `\"Z\"` — private label; only this container can access the mount.\n * - `false` — disable labeling entirely.\n */\n readonly selinuxLabel?: SelinuxLabel;\n /**\n * Additional host directories to bind-mount into the sandbox.\n *\n * Each entry specifies a `hostPath` (tilde-expanded) and `sandboxPath`.\n * If `hostPath` does not exist, sandbox creation fails with a clear error.\n */\n readonly mounts?: readonly MountConfig[];\n /** Environment variables injected by this provider. Merged at launch time with env resolver and agent provider env. */\n readonly env?: Record<string, string>;\n /**\n * Docker network(s) to attach the container to.\n *\n * - `\"my-network\"` → `--network my-network`\n * - `[\"net1\", \"net2\"]` → `--network net1 --network net2`\n *\n * When omitted, Docker's default bridge network is used.\n */\n readonly network?: string | readonly string[];\n /**\n * Supplementary groups to add the container user to, via `--group-add`.\n *\n * Accepts group names or numeric GIDs:\n *\n * - `[\"docker\"]` → `--group-add docker`\n * - `[999]` → `--group-add 999`\n * - `[\"docker\", 999]` → `--group-add docker --group-add 999`\n *\n * Useful for granting access to a bind-mounted Docker socket (Docker-outside-of-Docker).\n * When omitted, no `--group-add` flags are added.\n */\n readonly groups?: readonly (string | number)[];\n /**\n * Linux capabilities to drop from the container, via `--cap-drop`.\n *\n * Names are written without the `CAP_` prefix, as `docker run` accepts them,\n * and a misspelt name is a type error:\n *\n * - `[\"NET_RAW\"]` → `--cap-drop NET_RAW` (no raw sockets, so no `ping`)\n * - `[\"NET_RAW\", \"MKNOD\"]` → `--cap-drop NET_RAW --cap-drop MKNOD`\n * - `[\"ALL\"]` → `--cap-drop ALL` (drop every capability)\n *\n * When omitted, no `--cap-drop` flags are added and the container keeps\n * Docker's default capability set.\n */\n readonly capDrop?: readonly LinuxCapability[];\n /**\n * Host devices to expose to the container, via `--device`.\n *\n * Each entry is a full device spec in `host[:container[:permissions]]` form:\n *\n * - `[\"/dev/kvm\"]` → `--device /dev/kvm`\n * - `[\"/dev/sda:/dev/xvda:rwm\"]` → `--device /dev/sda:/dev/xvda:rwm`\n * - `[\"/dev/kvm\", \"/dev/fuse\"]` → `--device /dev/kvm --device /dev/fuse`\n *\n * When omitted, no `--device` flags are added.\n */\n readonly devices?: readonly string[];\n /**\n * Maximum number of characters of streamed `exec` output retained per stream\n * (stdout and stderr) when an `onLine` callback is supplied (default: 64KiB).\n *\n * Output is delivered live to `onLine` regardless; this only bounds the tail\n * returned in `ExecResult`, preventing a long-running agent's output from\n * overflowing V8's max string length and crashing the run.\n */\n readonly maxOutputTailChars?: number;\n /**\n * Limit the CPU resources available to the container, via `--cpus`.\n *\n * Maps directly to `docker run --cpus`. Accepts fractional values:\n *\n * - `2` → `--cpus 2` (at most 2 CPUs)\n * - `1.5` → `--cpus 1.5` (at most 1.5 CPUs)\n *\n * When omitted, no `--cpus` flag is added and the container is unconstrained.\n */\n readonly cpus?: number;\n}\n\n/**\n * Create a Docker sandbox provider.\n *\n * The returned provider creates Docker containers with bind-mounts\n * for the worktree and git directories.\n */\nexport const docker = (options?: DockerOptions): SandboxProvider => {\n const configuredImageName = options?.imageName;\n const selinuxLabel = options?.selinuxLabel ?? \"z\";\n const maxOutputTailChars = options?.maxOutputTailChars ?? MAX_TAIL_CHARS;\n const sandboxHomedir = \"/home/agent\";\n const userMounts = options?.mounts\n ? resolveUserMounts(options.mounts, sandboxHomedir)\n : [];\n // Validate file mounts and collect parent dirs to create at container start.\n // Throws at construction time if any file mount parent is outside sandboxHomedir.\n const parentDirsToCreate = processFileMountParents(\n userMounts,\n sandboxHomedir,\n );\n\n return createBindMountSandboxProvider({\n name: \"docker\",\n env: options?.env,\n sandboxHomedir,\n create: async (\n createOptions: BindMountCreateOptions,\n ): Promise<BindMountSandboxHandle> => {\n const containerName = `sandcastle-${randomUUID()}`;\n\n const worktreePath =\n createOptions.mounts.find(\n (m) => m.hostPath === createOptions.worktreePath,\n )?.sandboxPath ?? \"/home/agent/workspace\";\n\n // Build volume mount list (internal mounts + user-provided mounts)\n const allMounts = [...createOptions.mounts, ...userMounts];\n const volumeMounts = allMounts.map((m) => ({\n hostPath: m.hostPath,\n sandboxPath: m.sandboxPath,\n readonly: m.readonly,\n }));\n\n // Resolve image name\n const imageName =\n configuredImageName ?? defaultImageName(createOptions.hostRepoPath);\n\n const containerUid = options?.containerUid ?? process.getuid?.() ?? 1000;\n const containerGid = options?.containerGid ?? process.getgid?.() ?? 1000;\n\n // Pre-flight: verify image exists and UID matches\n await checkImageUid(imageName, containerUid);\n\n // Start container\n await Effect.runPromise(\n startContainer(\n containerName,\n imageName,\n {\n ...createOptions.env,\n HOME: \"/home/agent\",\n },\n {\n volumeMounts,\n workdir: worktreePath,\n user: `${containerUid}:${containerGid}`,\n network: options?.network,\n groups: options?.groups,\n capDrop: options?.capDrop,\n devices: options?.devices,\n cpus: options?.cpus,\n selinuxLabel,\n },\n ),\n );\n\n // Create parent directories for file mounts and chown to the container user\n for (const dir of parentDirsToCreate) {\n await new Promise<void>((resolve, reject) => {\n execFile(\n \"docker\",\n [\n \"exec\",\n \"--user\",\n \"0:0\",\n containerName,\n \"sh\",\n \"-c\",\n `mkdir -p \"$1\" && chown \"$2\" \"$1\"`,\n \"sh\",\n dir,\n `${containerUid}:${containerGid}`,\n ],\n (error) => {\n if (error) {\n reject(\n new Error(\n `Failed to create parent directory '${dir}' in container: ${error.message}`,\n ),\n );\n } else {\n resolve();\n }\n },\n );\n });\n }\n\n // Register synchronous container cleanup via the shared shutdown registry\n // so concurrent sandboxes share a single exit/SIGINT/SIGTERM listener\n // instead of tripping Node's MaxListenersExceededWarning.\n const removeContainerSync = () => {\n try {\n execFileSync(\"docker\", [\"rm\", \"-f\", containerName], {\n stdio: \"ignore\",\n });\n } catch {\n /* best-effort */\n }\n };\n const unregisterShutdown = registerShutdown(removeContainerSync);\n\n const handle: BindMountSandboxHandle = {\n worktreePath,\n sandboxId: containerName,\n\n exec: async (\n command: string,\n opts?: {\n onLine?: (line: string) => void;\n cwd?: string;\n sudo?: boolean;\n stdin?: string;\n },\n ): Promise<ExecResult> => {\n const args = [\"exec\"];\n // Elevate by running as root through the engine, not a `sudo`\n // prefix: the image needs no sudo binary, and the whole command\n // (`a && b`, not just `a`) runs as root.\n if (opts?.sudo === true) {\n args.push(\"--user\", \"0:0\");\n }\n if (opts?.stdin !== undefined) {\n args.push(\"-i\");\n }\n if (opts?.cwd !== undefined && opts.cwd !== \"\") {\n args.push(\"-w\", opts.cwd);\n }\n args.push(containerName, \"sh\", \"-c\", command);\n\n return new Promise((resolve, reject) => {\n const stdin = opts?.stdin;\n // Two literal `stdio` tuples, so the types know stdout and stderr\n // are always piped.\n const proc =\n stdin === undefined\n ? spawn(\"docker\", args, { stdio: [\"ignore\", \"pipe\", \"pipe\"] })\n : spawn(\"docker\", args, { stdio: [\"pipe\", \"pipe\", \"pipe\"] });\n\n if (stdin !== undefined) {\n proc.stdin?.write(stdin);\n proc.stdin?.end();\n }\n\n proc.on(\"error\", (error: Error) => {\n reject(new Error(`docker exec failed: ${error.message}`));\n });\n\n if (opts?.onLine) {\n const { onLine } = opts;\n const stdoutTail = new BoundedTail(maxOutputTailChars, \"\\n\");\n const stderrTail = new BoundedTail(maxOutputTailChars, \"\");\n const rl = createInterface({ input: proc.stdout });\n rl.on(\"line\", (line) => {\n stdoutTail.push(line);\n onLine(line);\n });\n proc.stderr.on(\"data\", (chunk: Buffer) => {\n stderrTail.push(chunk.toString());\n });\n proc.on(\"close\", (code: number | null) => {\n resolve({\n stdout: stdoutTail.toString(),\n stderr: stderrTail.toString(),\n exitCode: code ?? 0,\n });\n });\n } else {\n const stdoutChunks: string[] = [];\n const stderrChunks: string[] = [];\n proc.stdout.on(\"data\", (chunk: Buffer) => {\n stdoutChunks.push(chunk.toString());\n });\n proc.stderr.on(\"data\", (chunk: Buffer) => {\n stderrChunks.push(chunk.toString());\n });\n proc.on(\"close\", (code: number | null) => {\n resolve({\n stdout: stdoutChunks.join(\"\"),\n stderr: stderrChunks.join(\"\"),\n exitCode: code ?? 0,\n });\n });\n }\n });\n },\n\n interactiveExec: async (\n args: string[],\n opts: InteractiveExecOptions,\n ): Promise<{ exitCode: number }> =>\n new Promise((resolve, reject) => {\n const dockerArgs = [\"exec\"];\n // Allocate a pseudo-terminal when stdin looks like a TTY\n if (\n \"isTTY\" in opts.stdin &&\n (opts.stdin as { isTTY?: boolean }).isTTY === true\n ) {\n dockerArgs.push(\"-it\");\n } else {\n dockerArgs.push(\"-i\");\n }\n if (opts.cwd !== undefined && opts.cwd !== \"\") {\n dockerArgs.push(\"-w\", opts.cwd);\n }\n dockerArgs.push(containerName, ...args);\n\n const proc = spawn(\"docker\", dockerArgs, {\n stdio: [opts.stdin, opts.stdout, opts.stderr] as StdioOptions,\n });\n\n proc.on(\"error\", (error: Error) => {\n reject(new Error(`docker exec failed: ${error.message}`));\n });\n\n proc.on(\"close\", (code: number | null) => {\n resolve({ exitCode: code ?? 0 });\n });\n }),\n copyFileIn: async (\n hostPath: string,\n sandboxPath: string,\n ): Promise<void> =>\n new Promise((resolve, reject) => {\n execFile(\n \"docker\",\n [\"cp\", hostPath, `${containerName}:${sandboxPath}`],\n (error) => {\n if (error) {\n reject(new Error(`docker cp (in) failed: ${error.message}`));\n } else {\n resolve();\n }\n },\n );\n }),\n\n copyFileOut: async (\n sandboxPath: string,\n hostPath: string,\n ): Promise<void> =>\n new Promise((resolve, reject) => {\n execFile(\n \"docker\",\n [\"cp\", `${containerName}:${sandboxPath}`, hostPath],\n (error) => {\n if (error) {\n reject(new Error(`docker cp (out) failed: ${error.message}`));\n } else {\n resolve();\n }\n },\n );\n }),\n\n close: async (): Promise<void> => {\n unregisterShutdown();\n await Effect.runPromise(removeContainer(containerName));\n },\n };\n\n return handle;\n },\n });\n};\n\nexport type { LinuxCapability } from \"../DockerLifecycle.js\";\n\n// Re-export for backwards compatibility\nexport { defaultImageName } from \"../mountUtils.js\";\n\nconst checkImageUid = async (\n imageName: string,\n expectedUid: number,\n): Promise<void> =>\n new Promise<void>((resolve, reject) => {\n execFile(\n \"docker\",\n [\"image\", \"inspect\", imageName, \"--format\", \"{{.Config.User}}\"],\n (error, stdout) => {\n if (error) {\n reject(\n new Error(\n `Image '${imageName}' not found locally. Build it first with 'sandcastle docker build-image'.`,\n ),\n );\n return;\n }\n const imageUser = (stdout ?? \"\").trim();\n if (!imageUser) {\n // No USER directive in image — skip check\n resolve();\n return;\n }\n const uidPart = imageUser.split(\":\")[0] ?? \"\";\n const imageUid = Number.parseInt(uidPart, 10);\n if (isNaN(imageUid)) {\n // Non-numeric user (e.g. \"agent\") — can't compare, skip check\n resolve();\n return;\n }\n if (imageUid === expectedUid) {\n resolve();\n } else {\n reject(\n new Error(\n `UID mismatch: image '${imageName}' was built with UID ${imageUid}, ` +\n `but the expected UID is ${expectedUid}. ` +\n `Rebuild the image with 'sandcastle docker build-image', ` +\n `or pass containerUid: ${imageUid} to docker() to match the image.`,\n ),\n );\n }\n },\n );\n });\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/SandboxProvider.ts"],"names":[],"mappings":";;;;;AA+UO,IAAM,8BAAA,GAAiC,CAC5C,MAAA,MAC8B;AAAA,EAC9B,GAAA,EAAK,YAAA;AAAA,EACL,MAAM,MAAA,CAAO,IAAA;AAAA,EACb,GAAA,EAAK,MAAA,CAAO,GAAA,IAAO,EAAC;AAAA,EACpB,gBAAgB,MAAA,CAAO,cAAA;AAAA,EACvB,QAAQ,MAAA,CAAO;AACjB,CAAA;AAMO,IAAM,6BAAA,GAAgC,CAC3C,MAAA,MAC6B;AAAA,EAC7B,GAAA,EAAK,UAAA;AAAA,EACL,MAAM,MAAA,CAAO,IAAA;AAAA,EACb,GAAA,EAAK,MAAA,CAAO,GAAA,IAAO,EAAC;AAAA,EACpB,QAAQ,MAAA,CAAO;AACjB,CAAA","file":"chunk-XCYK7I45.js","sourcesContent":["/**\n * Sandbox provider types — the pluggable interface for sandbox runtimes.\n *\n * Provider authors implement a small Promise-based interface. Sandcastle\n * handles worktree creation, git mount resolution, and commit extraction.\n */\n\n/** Result of executing a command inside a sandbox. */\nexport interface ExecResult {\n readonly stdout: string;\n readonly stderr: string;\n readonly exitCode: number;\n}\n\n/** Options for interactiveExec — the streams the provider should wire to the spawned process. */\nexport interface InteractiveExecOptions {\n readonly stdin: NodeJS.ReadableStream;\n readonly stdout: NodeJS.WritableStream;\n readonly stderr: NodeJS.WritableStream;\n readonly cwd?: string;\n}\n\n/** Handle to a running bind-mount sandbox. */\nexport interface BindMountSandboxHandle {\n /** Absolute path to the worktree inside the sandbox. */\n readonly worktreePath: string;\n /**\n * The id a supervisor outside this process can use to address the sandbox\n * with the runtime's own tools, e.g. `docker()` and `podman()` set it to the\n * container name (`docker rm -f <sandboxId>`). Surfaced as\n * `Sandbox.sandboxId`. Omit it when there is nothing outside the process to\n * address, as for the native `bwrap()` and `seatbelt()` sandboxes, whose\n * sandbox is a child process of this one.\n */\n readonly sandboxId?: string;\n /**\n * Absolute path to the agent's home directory, as commands running inside\n * the sandbox see it. Sandcastle runs commands there to find and place agent\n * session files. Omit when it is `/home/agent`, as in the Docker image.\n */\n readonly sandboxHomedir?: string;\n /**\n * Absolute path to a writable temp directory, as commands running inside\n * the sandbox see it. Omit when it is `/tmp`.\n */\n readonly sandboxTmpdir?: string;\n /**\n * Execute a command in the sandbox.\n *\n * Implementations MUST support line-by-line streaming via `onLine`. This is\n * how Sandcastle delivers live feedback to the user and enforces idle timeouts —\n * without a streaming implementation, neither will work. A buffered/batch\n * implementation that only calls `onLine` after the process exits does NOT\n * satisfy this contract.\n *\n * When `stdin` is set, the implementation pipes the string to the child\n * process's stdin and closes it. This avoids the Linux 128 KB per-arg limit.\n */\n exec(\n command: string,\n options?: {\n onLine?: (line: string) => void;\n cwd?: string;\n sudo?: boolean;\n stdin?: string;\n },\n ): Promise<ExecResult>;\n /**\n * Launch an interactive process inside the sandbox.\n * Optional — providers that support interactive sessions implement this.\n * The provider detects TTY mode from the streams (e.g. stdin.isTTY) and\n * allocates a pseudo-terminal accordingly.\n */\n interactiveExec?(\n args: string[],\n options: InteractiveExecOptions,\n ): Promise<{ exitCode: number }>;\n /** Copy a single file from the host into the sandbox. */\n copyFileIn(hostPath: string, sandboxPath: string): Promise<void>;\n /** Copy a single file from the sandbox to the host. */\n copyFileOut(sandboxPath: string, hostPath: string): Promise<void>;\n /** Tear down the sandbox. */\n close(): Promise<void>;\n}\n\n/** Options passed to a bind-mount provider's `create` function. */\nexport interface BindMountCreateOptions {\n /** Host-side path to the worktree directory. */\n readonly worktreePath: string;\n /** Host-side path to the original repo root. */\n readonly hostRepoPath: string;\n /** Volume mounts to apply (host:sandbox pairs). */\n readonly mounts: {\n hostPath: string;\n sandboxPath: string;\n readonly?: boolean;\n }[];\n /** Environment variables to inject into the sandbox. */\n readonly env: Record<string, string>;\n}\n\n/** Configuration for createBindMountSandboxProvider. */\nexport interface BindMountSandboxProviderConfig {\n /** Human-readable name for this provider (e.g. \"docker\", \"podman\"). */\n readonly name: string;\n /** Environment variables injected by this provider. Merged at launch time. */\n readonly env?: Record<string, string>;\n /**\n * Absolute path to the home directory inside the sandbox (e.g. `\"/home/agent\"`).\n * Used to expand `~` in user-provided `sandboxPath` mount configs.\n * Set to `undefined` for providers that do not have a fixed home directory.\n */\n readonly sandboxHomedir?: string;\n /** Create a sandbox handle from the given options. */\n readonly create: (\n options: BindMountCreateOptions,\n ) => Promise<BindMountSandboxHandle>;\n}\n\n/** Handle to a running isolated sandbox (extends bind-mount with file transfer). */\nexport interface IsolatedSandboxHandle {\n /** Absolute path to the worktree inside the sandbox. */\n readonly worktreePath: string;\n /**\n * The vendor's id for the sandbox, so a supervisor outside this process can\n * address it with the vendor's own CLI or API, e.g. `vercel()` and\n * `daytona()` set it to the Vercel and Daytona sandbox ids. Surfaced as\n * `Sandbox.sandboxId`. Omit it when the provider has no such id.\n */\n readonly sandboxId?: string;\n /**\n * Execute a command in the sandbox.\n *\n * Implementations MUST support line-by-line streaming via `onLine`. This is\n * how Sandcastle delivers live feedback to the user and enforces idle timeouts —\n * without a streaming implementation, neither will work. A buffered/batch\n * implementation that only calls `onLine` after the process exits does NOT\n * satisfy this contract.\n *\n * When `stdin` is set, the implementation pipes the string to the child\n * process's stdin and closes it. This avoids the Linux 128 KB per-arg limit.\n */\n exec(\n command: string,\n options?: {\n onLine?: (line: string) => void;\n cwd?: string;\n sudo?: boolean;\n stdin?: string;\n },\n ): Promise<ExecResult>;\n /**\n * Launch an interactive process inside the sandbox.\n * Optional — providers that support interactive sessions implement this.\n * The provider detects TTY mode from the streams (e.g. stdin.isTTY) and\n * allocates a pseudo-terminal accordingly.\n */\n interactiveExec?(\n args: string[],\n options: InteractiveExecOptions,\n ): Promise<{ exitCode: number }>;\n /** Copy a file or directory from the host into the sandbox. */\n copyIn(hostPath: string, sandboxPath: string): Promise<void>;\n /** Copy a single file from the sandbox to the host. */\n copyFileOut(sandboxPath: string, hostPath: string): Promise<void>;\n /** Tear down the sandbox. */\n close(): Promise<void>;\n}\n\n/** Options passed to an isolated provider's `create` function. */\nexport interface IsolatedCreateOptions {\n /** Environment variables to inject into the sandbox. */\n readonly env: Record<string, string>;\n}\n\n/** Configuration for createIsolatedSandboxProvider. */\nexport interface IsolatedSandboxProviderConfig {\n /** Human-readable name for this provider (e.g. \"daytona\", \"e2b\"). */\n readonly name: string;\n /** Environment variables injected by this provider. Merged at launch time. */\n readonly env?: Record<string, string>;\n /** Create an isolated sandbox handle from the given options. */\n readonly create: (\n options: IsolatedCreateOptions,\n ) => Promise<IsolatedSandboxHandle>;\n}\n\n/** A bind-mount sandbox provider. */\nexport interface BindMountSandboxProvider {\n /** @internal Discriminator for internal dispatch. */\n readonly tag: \"bind-mount\";\n /** Human-readable provider name. */\n readonly name: string;\n /** Environment variables injected by this provider. */\n readonly env: Record<string, string>;\n /**\n * Absolute path to the home directory inside the sandbox (e.g. `\"/home/agent\"`).\n * `undefined` when the provider does not declare a sandbox home directory.\n */\n readonly sandboxHomedir: string | undefined;\n /** @internal Create a sandbox handle. */\n readonly create: (\n options: BindMountCreateOptions,\n ) => Promise<BindMountSandboxHandle>;\n}\n\n/** An isolated sandbox provider. */\nexport interface IsolatedSandboxProvider {\n /** @internal Discriminator for internal dispatch. */\n readonly tag: \"isolated\";\n /** Human-readable provider name. */\n readonly name: string;\n /** Environment variables injected by this provider. */\n readonly env: Record<string, string>;\n /** @internal Create an isolated sandbox handle. */\n readonly create: (\n options: IsolatedCreateOptions,\n ) => Promise<IsolatedSandboxHandle>;\n}\n\n/** Handle to a no-sandbox session — runs commands directly on the host. */\nexport interface NoSandboxHandle {\n /** Absolute path to the worktree on the host. */\n readonly worktreePath: string;\n /**\n * Execute a command on the host.\n *\n * Implementations MUST support line-by-line streaming via `onLine`. This is\n * how Sandcastle delivers live feedback to the user and enforces idle timeouts —\n * without a streaming implementation, neither will work.\n *\n * When `stdin` is set, the implementation pipes the string to the child\n * process's stdin and closes it. This avoids the Linux 128 KB per-arg limit.\n */\n exec(\n command: string,\n options?: {\n onLine?: (line: string) => void;\n cwd?: string;\n sudo?: boolean;\n stdin?: string;\n },\n ): Promise<ExecResult>;\n /**\n * Launch an interactive process on the host with inherited stdio.\n */\n interactiveExec(\n args: string[],\n options: InteractiveExecOptions,\n ): Promise<{ exitCode: number }>;\n /** No-op — no container to tear down. */\n close(): Promise<void>;\n}\n\n/** A no-sandbox provider — runs the agent directly on the host with no container isolation. */\nexport interface NoSandboxProvider {\n /** @internal Discriminator for internal dispatch. */\n readonly tag: \"none\";\n /** Human-readable provider name. */\n readonly name: string;\n /** Environment variables injected by this provider. */\n readonly env: Record<string, string>;\n /** @internal Create a no-sandbox handle. */\n readonly create: (options: {\n readonly worktreePath: string;\n readonly env: Record<string, string>;\n }) => Promise<NoSandboxHandle>;\n}\n\n// ---------- Branch strategy types ----------\n\n/** Head strategy: agent writes directly to host working directory. Bind-mount only. */\nexport interface HeadBranchStrategy {\n readonly type: \"head\";\n}\n\n/** Merge-to-head strategy: temp branch, merge back to HEAD, delete temp branch. */\nexport interface MergeToHeadBranchStrategy {\n readonly type: \"merge-to-head\";\n}\n\n/** Branch strategy: commits land on an explicit named branch. */\nexport interface NamedBranchStrategy {\n readonly type: \"branch\";\n readonly branch: string;\n /**\n * Git ref to use as the starting point when creating a new branch.\n * Only used when the branch doesn't already exist — ignored otherwise.\n * Callers are responsible for ensuring the ref is current (e.g. `git fetch`).\n * Defaults to `HEAD` when omitted.\n */\n readonly baseBranch?: string;\n}\n\n/** Branch strategy for bind-mount providers (all three variants). */\nexport type BindMountBranchStrategy =\n | HeadBranchStrategy\n | MergeToHeadBranchStrategy\n | NamedBranchStrategy;\n\n/** Branch strategy for isolated providers (no head — can't write to host). */\nexport type IsolatedBranchStrategy =\n | MergeToHeadBranchStrategy\n | NamedBranchStrategy;\n\n/** Branch strategy for no-sandbox providers (all three — same as bind-mount). */\nexport type NoSandboxBranchStrategy =\n | HeadBranchStrategy\n | MergeToHeadBranchStrategy\n | NamedBranchStrategy;\n\n/** Union of all branch strategy variants. */\nexport type BranchStrategy =\n | BindMountBranchStrategy\n | IsolatedBranchStrategy\n | NoSandboxBranchStrategy;\n\n/**\n * A sandbox provider — the pluggable unit that `run()`, `interactive()`, and\n * `createSandbox()` accept. Tagged for internal dispatch: \"bind-mount\",\n * \"isolated\", or \"none\". When `NoSandboxProvider` is used, the agent runs\n * directly on the host with no container isolation — opt in at your own risk.\n */\nexport type SandboxProvider =\n | BindMountSandboxProvider\n | IsolatedSandboxProvider\n | NoSandboxProvider;\n\n/** @deprecated Use `SandboxProvider` — it now includes `NoSandboxProvider`. */\nexport type AnySandboxProvider = SandboxProvider;\n\n/**\n * Create a bind-mount sandbox provider from a config object.\n * The returned provider can be passed to `run()` or `createSandbox()`.\n */\nexport const createBindMountSandboxProvider = (\n config: BindMountSandboxProviderConfig,\n): BindMountSandboxProvider => ({\n tag: \"bind-mount\",\n name: config.name,\n env: config.env ?? {},\n sandboxHomedir: config.sandboxHomedir,\n create: config.create,\n});\n\n/**\n * Create an isolated sandbox provider from a config object.\n * The returned provider can be passed to `run()` or `createSandbox()`.\n */\nexport const createIsolatedSandboxProvider = (\n config: IsolatedSandboxProviderConfig,\n): IsolatedSandboxProvider => ({\n tag: \"isolated\",\n name: config.name,\n env: config.env ?? {},\n create: config.create,\n});\n"]}