@ai-hero/sandcastle 0.4.0 → 0.4.2

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 (96) hide show
  1. package/README.md +185 -126
  2. package/dist/AgentProvider.d.ts +22 -2
  3. package/dist/AgentProvider.d.ts.map +1 -1
  4. package/dist/AgentProvider.js +18 -2
  5. package/dist/AgentProvider.js.map +1 -1
  6. package/dist/InitService.d.ts.map +1 -1
  7. package/dist/InitService.js +55 -6
  8. package/dist/InitService.js.map +1 -1
  9. package/dist/MountConfig.d.ts +15 -0
  10. package/dist/MountConfig.d.ts.map +1 -0
  11. package/dist/MountConfig.js +7 -0
  12. package/dist/MountConfig.js.map +1 -0
  13. package/dist/Orchestrator.d.ts +0 -1
  14. package/dist/Orchestrator.d.ts.map +1 -1
  15. package/dist/Orchestrator.js +29 -19
  16. package/dist/Orchestrator.js.map +1 -1
  17. package/dist/SandboxFactory.d.ts +16 -10
  18. package/dist/SandboxFactory.d.ts.map +1 -1
  19. package/dist/SandboxFactory.js +20 -22
  20. package/dist/SandboxFactory.js.map +1 -1
  21. package/dist/SandboxLifecycle.d.ts +1 -1
  22. package/dist/SandboxLifecycle.d.ts.map +1 -1
  23. package/dist/SandboxLifecycle.js +2 -2
  24. package/dist/SandboxLifecycle.js.map +1 -1
  25. package/dist/SandboxProvider.d.ts +31 -21
  26. package/dist/SandboxProvider.d.ts.map +1 -1
  27. package/dist/SandboxProvider.js +2 -2
  28. package/dist/SandboxProvider.js.map +1 -1
  29. package/dist/TextDeltaBuffer.d.ts +24 -0
  30. package/dist/TextDeltaBuffer.d.ts.map +1 -0
  31. package/dist/TextDeltaBuffer.js +68 -0
  32. package/dist/TextDeltaBuffer.js.map +1 -0
  33. package/dist/WorktreeManager.d.ts +2 -0
  34. package/dist/WorktreeManager.d.ts.map +1 -1
  35. package/dist/WorktreeManager.js +3 -0
  36. package/dist/WorktreeManager.js.map +1 -1
  37. package/dist/cli.d.ts.map +1 -1
  38. package/dist/cli.js +11 -7
  39. package/dist/cli.js.map +1 -1
  40. package/dist/createSandbox.d.ts +6 -5
  41. package/dist/createSandbox.d.ts.map +1 -1
  42. package/dist/createSandbox.js +18 -8
  43. package/dist/createSandbox.js.map +1 -1
  44. package/dist/index.d.ts +3 -2
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +1 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/mergeProviderEnv.d.ts +13 -0
  49. package/dist/mergeProviderEnv.d.ts.map +1 -0
  50. package/dist/mergeProviderEnv.js +23 -0
  51. package/dist/mergeProviderEnv.js.map +1 -0
  52. package/dist/run.d.ts +7 -2
  53. package/dist/run.d.ts.map +1 -1
  54. package/dist/run.js +20 -6
  55. package/dist/run.js.map +1 -1
  56. package/dist/sandboxes/daytona.d.ts +48 -0
  57. package/dist/sandboxes/daytona.d.ts.map +1 -0
  58. package/dist/sandboxes/daytona.js +125 -0
  59. package/dist/sandboxes/daytona.js.map +1 -0
  60. package/dist/sandboxes/docker.d.ts +11 -3
  61. package/dist/sandboxes/docker.d.ts.map +1 -1
  62. package/dist/sandboxes/docker.js +69 -43
  63. package/dist/sandboxes/docker.js.map +1 -1
  64. package/dist/sandboxes/podman.d.ts +46 -0
  65. package/dist/sandboxes/podman.d.ts.map +1 -0
  66. package/dist/sandboxes/podman.js +195 -0
  67. package/dist/sandboxes/podman.js.map +1 -0
  68. package/dist/sandboxes/test-isolated.d.ts +3 -7
  69. package/dist/sandboxes/test-isolated.d.ts.map +1 -1
  70. package/dist/sandboxes/test-isolated.js +57 -47
  71. package/dist/sandboxes/test-isolated.js.map +1 -1
  72. package/dist/sandboxes/vercel.d.ts +92 -0
  73. package/dist/sandboxes/vercel.d.ts.map +1 -0
  74. package/dist/sandboxes/vercel.js +165 -0
  75. package/dist/sandboxes/vercel.js.map +1 -0
  76. package/dist/syncOut.d.ts +1 -1
  77. package/dist/syncOut.js +3 -3
  78. package/dist/syncOut.js.map +1 -1
  79. package/dist/templates/parallel-planner/main.mts +6 -3
  80. package/dist/templates/parallel-planner-with-review/.env.example +5 -0
  81. package/dist/templates/parallel-planner-with-review/CODING_STANDARDS.md +27 -0
  82. package/dist/templates/parallel-planner-with-review/implement-prompt.md +62 -0
  83. package/dist/templates/parallel-planner-with-review/main.mts +251 -0
  84. package/dist/templates/parallel-planner-with-review/merge-prompt.md +22 -0
  85. package/dist/templates/parallel-planner-with-review/plan-prompt.md +33 -0
  86. package/dist/templates/parallel-planner-with-review/review-prompt.md +55 -0
  87. package/dist/templates/parallel-planner-with-review/template.json +4 -0
  88. package/dist/templates/sequential-reviewer/CODING_STANDARDS.md +27 -0
  89. package/dist/templates/sequential-reviewer/implement-prompt.md +34 -45
  90. package/dist/templates/sequential-reviewer/main.mts +4 -2
  91. package/dist/templates/sequential-reviewer/review-prompt.md +1 -1
  92. package/dist/templates/simple-loop/main.mts +6 -0
  93. package/dist/testSandbox.d.ts.map +1 -1
  94. package/dist/testSandbox.js +58 -53
  95. package/dist/testSandbox.js.map +1 -1
  96. package/package.json +25 -1
package/README.md CHANGED
@@ -90,12 +90,21 @@ const result = await run({
90
90
  agent: claudeCode("claude-opus-4-6", { effort: "high" }),
91
91
 
92
92
  // Sandbox provider — required. Import from "@ai-hero/sandcastle/sandboxes/docker".
93
- // Provider-specific config (like imageName and branchStrategy) lives inside the provider factory call.
93
+ // Provider-specific config (like imageName, mounts) lives inside the provider factory call.
94
94
  sandbox: docker({
95
95
  imageName: "sandcastle:local",
96
- branchStrategy: { type: "branch", branch: "agent/fix-42" },
96
+ // Optional: mount host directories into the sandbox (e.g. package manager caches)
97
+ mounts: [
98
+ { hostPath: "~/.npm", sandboxPath: "/home/agent/.npm", readonly: true },
99
+ ],
100
+ // Optional: provider-level env vars merged at launch time
101
+ env: { DOCKER_SPECIFIC: "value" },
97
102
  }),
98
103
 
104
+ // Branch strategy — controls how the agent's changes relate to branches.
105
+ // Defaults to { type: "head" } for bind-mount and { type: "merge-to-head" } for isolated providers.
106
+ branchStrategy: { type: "branch", branch: "agent/fix-42" },
107
+
99
108
  // Prompt source — provide one of these, not both:
100
109
  promptFile: ".sandcastle/prompt.md", // path to a prompt file
101
110
  // prompt: "Fix issue #42 in this repo", // OR an inline prompt string
@@ -212,12 +221,13 @@ if (closeResult.preservedWorktreePath) {
212
221
 
213
222
  #### `CreateSandboxOptions`
214
223
 
215
- | Option | Type | Default | Description |
216
- | --------------- | --------------- | ------- | ------------------------------------------------------------------ |
217
- | `branch` | string | — | **Required.** Explicit branch for the sandbox |
218
- | `sandbox` | SandboxProvider | — | **Required.** Sandbox provider (e.g. `docker()`) |
219
- | `hooks` | object | — | Lifecycle hooks (`onSandboxReady`) — run once at creation time |
220
- | `copyToSandbox` | string[] | — | Host-relative file paths to copy into the sandbox at creation time |
224
+ | Option | Type | Default | Description |
225
+ | -------------------------- | --------------- | ------- | ------------------------------------------------------------------------ |
226
+ | `branch` | string | — | **Required.** Explicit branch for the sandbox |
227
+ | `sandbox` | SandboxProvider | — | **Required.** Sandbox provider (e.g. `docker()`, `podman()`) |
228
+ | `hooks` | object | — | Lifecycle hooks (`onSandboxReady`) — run once at creation time |
229
+ | `copyToSandbox` | string[] | — | Host-relative file paths to copy into the sandbox at creation time |
230
+ | `throwOnDuplicateWorktree` | boolean | `true` | When `false`, reuse an existing worktree instead of failing on collision |
221
231
 
222
232
  #### `Sandbox`
223
233
 
@@ -269,7 +279,7 @@ Sandcastle uses a **branch strategy** configured on the sandbox provider to cont
269
279
 
270
280
  For bind-mount providers (like Docker), the worktree directory is bind-mounted into the container — the agent writes directly to the host filesystem through the mount, so no sync is needed.
271
281
 
272
- From your point of view, you just configure `docker({ branchStrategy: { type: 'branch', branch: 'foo' } })`, and get a commit on branch `foo` once it's complete. All 100% local.
282
+ From your point of view, you just configure `branchStrategy: { type: 'branch', branch: 'foo' }` on `run()`, and get a commit on branch `foo` once it's complete. All 100% local.
273
283
 
274
284
  ## Prompts
275
285
 
@@ -375,12 +385,13 @@ Tell the agent to output your chosen string(s) in the prompt, and the orchestrat
375
385
 
376
386
  `sandcastle init` prompts you to choose a template, which scaffolds a ready-to-use prompt and `main.mts` suited to a specific workflow. If your project's `package.json` has `"type": "module"`, the file will be named `main.ts` instead. Four templates are available:
377
387
 
378
- | Template | Description |
379
- | --------------------- | ----------------------------------------------------------------------- |
380
- | `blank` | Bare scaffold — write your own prompt and orchestration |
381
- | `simple-loop` | Picks GitHub issues one by one and closes them |
382
- | `sequential-reviewer` | Implements issues one by one, with a code review step after each |
383
- | `parallel-planner` | Plans parallelizable issues, executes on separate branches, then merges |
388
+ | Template | Description |
389
+ | ------------------------------ | ------------------------------------------------------------------------- |
390
+ | `blank` | Bare scaffold — write your own prompt and orchestration |
391
+ | `simple-loop` | Picks GitHub issues one by one and closes them |
392
+ | `sequential-reviewer` | Implements issues one by one, with a code review step after each |
393
+ | `parallel-planner` | Plans parallelizable issues, executes on separate branches, then merges |
394
+ | `parallel-planner-with-review` | Plans parallelizable issues, executes with per-branch review, then merges |
384
395
 
385
396
  Select a template during `sandcastle init` when prompted, or re-run init in a fresh repo to try a different one.
386
397
 
@@ -393,7 +404,7 @@ Scaffolds the `.sandcastle/` config directory and builds the Docker image. This
393
404
  | Option | Required | Default | Description |
394
405
  | -------------- | -------- | ---------------------------- | -------------------------------------------------------------------- |
395
406
  | `--image-name` | No | `sandcastle:<repo-dir-name>` | Docker image name |
396
- | `--agent` | No | Interactive prompt | Agent to use (`claude-code`, `pi`, `codex`) |
407
+ | `--agent` | No | Interactive prompt | Agent to use (`claude-code`, `pi`, `codex`, `opencode`) |
397
408
  | `--model` | No | Agent's default model | Model to use (e.g. `claude-sonnet-4-6`). Defaults to agent's default |
398
409
  | `--template` | No | Interactive prompt | Template to scaffold (e.g. `blank`, `simple-loop`) |
399
410
 
@@ -428,20 +439,22 @@ Removes the Docker image.
428
439
 
429
440
  ### `RunOptions`
430
441
 
431
- | Option | Type | Default | Description |
432
- | -------------------- | ------------------ | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
433
- | `agent` | AgentProvider | — | **Required.** Agent provider (e.g. `claudeCode("claude-opus-4-6")`, `pi("claude-sonnet-4-6")`, `codex("gpt-5.4-mini")`) |
434
- | `sandbox` | SandboxProvider | — | **Required.** Sandbox provider (e.g. `docker()`, `docker({ imageName: "sandcastle:local" })`) |
435
- | `prompt` | string | — | Inline prompt (mutually exclusive with `promptFile`) |
436
- | `promptFile` | string | — | Path to prompt file (mutually exclusive with `prompt`) |
437
- | `maxIterations` | number | `1` | Maximum iterations to run |
438
- | `hooks` | object | — | Lifecycle hooks (`onSandboxReady`) |
439
- | `name` | string | — | Display name for the run, shown as a prefix in log output |
440
- | `promptArgs` | PromptArgs | — | Key-value map for `{{KEY}}` placeholder substitution |
441
- | `copyToSandbox` | string[] | | Host-relative file paths to copy into the sandbox before start (not supported with `branchStrategy: { type: 'head' }`) |
442
- | `logging` | object | file (auto-generated) | `{ type: 'file', path }` or `{ type: 'stdout' }` |
443
- | `completionSignal` | string \| string[] | `<promise>COMPLETE</promise>` | String or array of strings the agent emits to stop the iteration loop early |
444
- | `idleTimeoutSeconds` | number | `600` | Idle timeout in seconds resets on each agent output event |
442
+ | Option | Type | Default | Description |
443
+ | -------------------------- | ------------------ | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
444
+ | `agent` | AgentProvider | — | **Required.** Agent provider (e.g. `claudeCode("claude-opus-4-6")`, `pi("claude-sonnet-4-6")`, `codex("gpt-5.4-mini")`, `opencode("opencode/big-pickle")`) |
445
+ | `sandbox` | SandboxProvider | — | **Required.** Sandbox provider (e.g. `docker()`, `podman()`, `docker({ imageName: "sandcastle:local" })`) |
446
+ | `prompt` | string | — | Inline prompt (mutually exclusive with `promptFile`) |
447
+ | `promptFile` | string | — | Path to prompt file (mutually exclusive with `prompt`) |
448
+ | `maxIterations` | number | `1` | Maximum iterations to run |
449
+ | `hooks` | object | — | Lifecycle hooks (`onSandboxReady`) |
450
+ | `name` | string | — | Display name for the run, shown as a prefix in log output |
451
+ | `promptArgs` | PromptArgs | — | Key-value map for `{{KEY}}` placeholder substitution |
452
+ | `branchStrategy` | BranchStrategy | per-provider default | Branch strategy: `{ type: 'head' }`, `{ type: 'merge-to-head' }`, or `{ type: 'branch', branch: '…' }` |
453
+ | `copyToSandbox` | string[] | — | Host-relative file paths to copy into the sandbox before start (not supported with `branchStrategy: { type: 'head' }`) |
454
+ | `logging` | object | file (auto-generated) | `{ type: 'file', path }` or `{ type: 'stdout' }` |
455
+ | `completionSignal` | string \| string[] | `<promise>COMPLETE</promise>` | String or array of strings the agent emits to stop the iteration loop early |
456
+ | `idleTimeoutSeconds` | number | `600` | Idle timeout in seconds — resets on each agent output event |
457
+ | `throwOnDuplicateWorktree` | boolean | `true` | When `false`, reuse an existing worktree for the target branch instead of failing on collision |
445
458
 
446
459
  ### `RunResult`
447
460
 
@@ -465,32 +478,54 @@ agent: claudeCode("claude-opus-4-6", { effort: "high" });
465
478
  | Option | Type | Default | Description |
466
479
  | -------- | -------------------------------------------- | ------- | ------------------------------------------------------- |
467
480
  | `effort` | `"low"` \| `"medium"` \| `"high"` \| `"max"` | — | Claude Code reasoning effort level (`max` is Opus only) |
481
+ | `env` | `Record<string, string>` | `{}` | Environment variables injected by this agent provider |
482
+
483
+ ### Provider `env`
468
484
 
469
- Environment variables are resolved automatically from `.sandcastle/.env` and `process.env` no need to pass them to the API. The required variables depend on the **agent provider** (see `sandcastle init` output for details).
485
+ Both **agent providers** and **sandbox providers** accept an optional `env: Record<string, string>` in their options. These environment variables are merged with the `.sandcastle/.env` resolver output at launch time:
486
+
487
+ ```typescript
488
+ await run({
489
+ agent: claudeCode("claude-opus-4-6", {
490
+ env: { ANTHROPIC_API_KEY: "sk-ant-..." },
491
+ }),
492
+ sandbox: docker({
493
+ env: { DOCKER_SPECIFIC_VAR: "value" },
494
+ }),
495
+ prompt: "Fix issue #42",
496
+ });
497
+ ```
498
+
499
+ **Merge rules:**
500
+
501
+ - Provider env (agent + sandbox) overrides `.sandcastle/.env` resolver output for shared keys
502
+ - Agent provider env and sandbox provider env **must not overlap** — if they share any key, `run()` throws an error
503
+ - When `env` is not provided, it defaults to `{}`
504
+
505
+ Environment variables are also resolved automatically from `.sandcastle/.env` and `process.env` — no need to pass them to the API. The required variables depend on the **agent provider** (see `sandcastle init` output for details).
470
506
 
471
507
  ## Custom Sandbox Providers
472
508
 
473
509
  Sandcastle ships with a Docker provider, but you can create your own. A sandbox provider tells Sandcastle how to execute commands in an isolated environment. There are two kinds:
474
510
 
475
511
  - **Bind-mount** — the sandbox can mount a host directory. Sandcastle creates a worktree on the host and the provider mounts it in. No file sync needed. Use this for Docker, Podman, or any local container runtime.
476
- - **Isolated** — the sandbox has its own filesystem (e.g. a cloud VM). The provider handles syncing code in and out via `copyIn` and `copyOut`. Use this when the sandbox cannot access the host filesystem.
512
+ - **Isolated** — the sandbox has its own filesystem (e.g. a cloud VM). The provider handles syncing code in and out via `copyIn` and `copyFileOut`. Use this when the sandbox cannot access the host filesystem.
477
513
 
478
514
  ### The sandbox handle contract
479
515
 
480
516
  Both provider types return a **sandbox handle** from their `create()` function. The handle exposes:
481
517
 
482
- | Method | Required | Description |
483
- | --------------- | -------- | ------------------------------------------------- |
484
- | `exec` | Both | Run a command, return `ExecResult` when done |
485
- | `execStreaming` | Both | Run a command, call `onLine` for each stdout line |
486
- | `close` | Both | Tear down the sandbox |
487
- | `copyIn` | Isolated | Copy a file from the host into the sandbox |
488
- | `copyOut` | Isolated | Copy a file from the sandbox to the host |
489
- | `workspacePath` | Both | Absolute path to the workspace inside the sandbox |
518
+ | Method | Required | Description |
519
+ | --------------- | -------- | ---------------------------------------------------------------------------- |
520
+ | `exec` | Both | Run a command, optionally streaming stdout line-by-line via `options.onLine` |
521
+ | `close` | Both | Tear down the sandbox |
522
+ | `copyIn` | Isolated | Copy a file or directory from the host into the sandbox |
523
+ | `copyOut` | Isolated | Copy a file from the sandbox to the host |
524
+ | `workspacePath` | Both | Absolute path to the workspace inside the sandbox |
490
525
 
491
526
  ### `ExecResult`
492
527
 
493
- Every `exec` and `execStreaming` call returns an `ExecResult`:
528
+ Every `exec` call returns an `ExecResult`:
494
529
 
495
530
  ```typescript
496
531
  interface ExecResult {
@@ -517,7 +552,6 @@ import { createInterface } from "node:readline";
517
552
  const localProcess = () =>
518
553
  createBindMountSandboxProvider({
519
554
  name: "local-process",
520
- branchStrategy: { type: "merge-to-head" },
521
555
  create: async (
522
556
  options: BindMountCreateOptions,
523
557
  ): Promise<BindMountSandboxHandle> => {
@@ -526,8 +560,43 @@ const localProcess = () =>
526
560
  return {
527
561
  workspacePath,
528
562
 
529
- exec: (command: string, opts?: { cwd?: string }): Promise<ExecResult> =>
530
- new Promise((resolve, reject) => {
563
+ exec: (
564
+ command: string,
565
+ opts?: { onLine?: (line: string) => void; cwd?: string },
566
+ ): Promise<ExecResult> => {
567
+ if (opts?.onLine) {
568
+ const onLine = opts.onLine;
569
+ return new Promise((resolve, reject) => {
570
+ const proc = spawn("sh", ["-c", command], {
571
+ cwd: opts?.cwd ?? workspacePath,
572
+ stdio: ["ignore", "pipe", "pipe"],
573
+ });
574
+
575
+ const stdoutChunks: string[] = [];
576
+ const stderrChunks: string[] = [];
577
+
578
+ const rl = createInterface({ input: proc.stdout! });
579
+ rl.on("line", (line) => {
580
+ stdoutChunks.push(line);
581
+ onLine(line); // forward each line to Sandcastle
582
+ });
583
+
584
+ proc.stderr!.on("data", (chunk: Buffer) => {
585
+ stderrChunks.push(chunk.toString());
586
+ });
587
+
588
+ proc.on("error", (err) => reject(err));
589
+ proc.on("close", (code) => {
590
+ resolve({
591
+ stdout: stdoutChunks.join("\n"),
592
+ stderr: stderrChunks.join(""),
593
+ exitCode: code ?? 0,
594
+ });
595
+ });
596
+ });
597
+ }
598
+
599
+ return new Promise((resolve, reject) => {
531
600
  execFile(
532
601
  "sh",
533
602
  ["-c", command],
@@ -544,41 +613,8 @@ const localProcess = () =>
544
613
  }
545
614
  },
546
615
  );
547
- }),
548
-
549
- execStreaming: (
550
- command: string,
551
- onLine: (line: string) => void,
552
- opts?: { cwd?: string },
553
- ): Promise<ExecResult> =>
554
- new Promise((resolve, reject) => {
555
- const proc = spawn("sh", ["-c", command], {
556
- cwd: opts?.cwd ?? workspacePath,
557
- stdio: ["ignore", "pipe", "pipe"],
558
- });
559
-
560
- const stdoutChunks: string[] = [];
561
- const stderrChunks: string[] = [];
562
-
563
- const rl = createInterface({ input: proc.stdout! });
564
- rl.on("line", (line) => {
565
- stdoutChunks.push(line);
566
- onLine(line); // forward each line to Sandcastle
567
- });
568
-
569
- proc.stderr!.on("data", (chunk: Buffer) => {
570
- stderrChunks.push(chunk.toString());
571
- });
572
-
573
- proc.on("error", (err) => reject(err));
574
- proc.on("close", (code) => {
575
- resolve({
576
- stdout: stdoutChunks.join("\n"),
577
- stderr: stderrChunks.join(""),
578
- exitCode: code ?? 0,
579
- });
580
- });
581
- }),
616
+ });
617
+ },
582
618
 
583
619
  close: async () => {
584
620
  // nothing to tear down for a local process
@@ -607,7 +643,6 @@ import { createInterface } from "node:readline";
607
643
  const tempDir = () =>
608
644
  createIsolatedSandboxProvider({
609
645
  name: "temp-dir",
610
- branchStrategy: { type: "merge-to-head" },
611
646
  create: async (): Promise<IsolatedSandboxHandle> => {
612
647
  const root = await mkdtemp(join(tmpdir(), "sandbox-"));
613
648
  const workspacePath = join(root, "workspace");
@@ -616,8 +651,43 @@ const tempDir = () =>
616
651
  return {
617
652
  workspacePath,
618
653
 
619
- exec: (command: string, opts?: { cwd?: string }): Promise<ExecResult> =>
620
- new Promise((resolve, reject) => {
654
+ exec: (
655
+ command: string,
656
+ opts?: { onLine?: (line: string) => void; cwd?: string },
657
+ ): Promise<ExecResult> => {
658
+ if (opts?.onLine) {
659
+ const onLine = opts.onLine;
660
+ return new Promise((resolve, reject) => {
661
+ const proc = spawn("sh", ["-c", command], {
662
+ cwd: opts?.cwd ?? workspacePath,
663
+ stdio: ["ignore", "pipe", "pipe"],
664
+ });
665
+
666
+ const stdoutChunks: string[] = [];
667
+ const stderrChunks: string[] = [];
668
+
669
+ const rl = createInterface({ input: proc.stdout! });
670
+ rl.on("line", (line) => {
671
+ stdoutChunks.push(line);
672
+ onLine(line);
673
+ });
674
+
675
+ proc.stderr!.on("data", (chunk: Buffer) => {
676
+ stderrChunks.push(chunk.toString());
677
+ });
678
+
679
+ proc.on("error", (err) => reject(err));
680
+ proc.on("close", (code) => {
681
+ resolve({
682
+ stdout: stdoutChunks.join("\n"),
683
+ stderr: stderrChunks.join(""),
684
+ exitCode: code ?? 0,
685
+ });
686
+ });
687
+ });
688
+ }
689
+
690
+ return new Promise((resolve, reject) => {
621
691
  execFile(
622
692
  "sh",
623
693
  ["-c", command],
@@ -634,48 +704,20 @@ const tempDir = () =>
634
704
  }
635
705
  },
636
706
  );
637
- }),
638
-
639
- execStreaming: (
640
- command: string,
641
- onLine: (line: string) => void,
642
- opts?: { cwd?: string },
643
- ): Promise<ExecResult> =>
644
- new Promise((resolve, reject) => {
645
- const proc = spawn("sh", ["-c", command], {
646
- cwd: opts?.cwd ?? workspacePath,
647
- stdio: ["ignore", "pipe", "pipe"],
648
- });
649
-
650
- const stdoutChunks: string[] = [];
651
- const stderrChunks: string[] = [];
652
-
653
- const rl = createInterface({ input: proc.stdout! });
654
- rl.on("line", (line) => {
655
- stdoutChunks.push(line);
656
- onLine(line);
657
- });
658
-
659
- proc.stderr!.on("data", (chunk: Buffer) => {
660
- stderrChunks.push(chunk.toString());
661
- });
662
-
663
- proc.on("error", (err) => reject(err));
664
- proc.on("close", (code) => {
665
- resolve({
666
- stdout: stdoutChunks.join("\n"),
667
- stderr: stderrChunks.join(""),
668
- exitCode: code ?? 0,
669
- });
670
- });
671
- }),
707
+ });
708
+ },
672
709
 
673
710
  copyIn: async (hostPath: string, sandboxPath: string) => {
674
- await mkdir(dirname(sandboxPath), { recursive: true });
675
- await copyFile(hostPath, sandboxPath);
711
+ const info = await stat(hostPath);
712
+ if (info.isDirectory()) {
713
+ await cp(hostPath, sandboxPath, { recursive: true });
714
+ } else {
715
+ await mkdir(dirname(sandboxPath), { recursive: true });
716
+ await copyFile(hostPath, sandboxPath);
717
+ }
676
718
  },
677
719
 
678
- copyOut: async (sandboxPath: string, hostPath: string) => {
720
+ copyFileOut: async (sandboxPath: string, hostPath: string) => {
679
721
  await mkdir(dirname(hostPath), { recursive: true });
680
722
  await copyFile(sandboxPath, hostPath);
681
723
  },
@@ -704,15 +746,30 @@ A branch strategy controls where the agent's commits land. Configure it when con
704
746
  - **`merge-to-head`** — safe default for automation. The agent works on a throwaway branch; if something goes wrong, HEAD is untouched. Use this for CI or unattended runs.
705
747
  - **`branch`** — when you want commits on a specific branch (e.g. for a PR). Pass `{ type: "branch", branch: "agent/fix-42" }`.
706
748
 
749
+ Branch strategy is now configured on `run()`, not on the provider:
750
+
707
751
  ```typescript
708
- // head direct write, bind-mount only
709
- const provider = localProcess();
710
- // merge-to-head — temp branch, merge back (default for isolated)
711
- const provider = tempDir();
712
- // branch — explicit named branch
752
+ import { run, claudeCode } from "@ai-hero/sandcastle";
713
753
  import { docker } from "@ai-hero/sandcastle/sandboxes/docker";
714
- const provider = docker({
754
+
755
+ // head — direct write, bind-mount only (default for bind-mount providers)
756
+ await run({
757
+ agent: claudeCode("claude-opus-4-6"),
758
+ sandbox: docker(),
759
+ prompt: "…",
760
+ });
761
+ // merge-to-head — temp branch, merge back (default for isolated providers)
762
+ await run({
763
+ agent: claudeCode("claude-opus-4-6"),
764
+ sandbox: tempDir(),
765
+ prompt: "…",
766
+ });
767
+ // branch — explicit named branch
768
+ await run({
769
+ agent: claudeCode("claude-opus-4-6"),
770
+ sandbox: docker(),
715
771
  branchStrategy: { type: "branch", branch: "agent/fix-42" },
772
+ prompt: "…",
716
773
  });
717
774
  ```
718
775
 
@@ -735,6 +792,8 @@ const result = await run({
735
792
  For real-world examples, see:
736
793
 
737
794
  - [`src/sandboxes/docker.ts`](src/sandboxes/docker.ts) — bind-mount provider using Docker containers
795
+ - [`src/sandboxes/vercel.ts`](src/sandboxes/vercel.ts) — isolated provider using Vercel Firecracker microVMs via `@vercel/sandbox`
796
+ - [`src/sandboxes/podman.ts`](src/sandboxes/podman.ts) — bind-mount provider using Podman containers (with SELinux label support)
738
797
  - [`src/sandboxes/test-isolated.ts`](src/sandboxes/test-isolated.ts) — isolated provider using temp directories (used in tests)
739
798
 
740
799
  ## Configuration
@@ -11,15 +11,35 @@ export type ParsedStreamEvent = {
11
11
  };
12
12
  export interface AgentProvider {
13
13
  readonly name: string;
14
+ /** Environment variables injected by this agent provider. Merged at launch time with env resolver and sandbox provider env. */
15
+ readonly env: Record<string, string>;
14
16
  buildPrintCommand(prompt: string): string;
15
17
  buildInteractiveArgs(prompt: string): string[];
16
18
  parseStreamLine(line: string): ParsedStreamEvent[];
17
19
  }
18
20
  export declare const DEFAULT_MODEL = "claude-opus-4-6";
19
- export declare const pi: (model: string) => AgentProvider;
20
- export declare const codex: (model: string) => AgentProvider;
21
+ /** Options for the pi agent provider. */
22
+ export interface PiOptions {
23
+ /** Environment variables injected by this agent provider. */
24
+ readonly env?: Record<string, string>;
25
+ }
26
+ export declare const pi: (model: string, options?: PiOptions | undefined) => AgentProvider;
27
+ /** Options for the codex agent provider. */
28
+ export interface CodexOptions {
29
+ /** Environment variables injected by this agent provider. */
30
+ readonly env?: Record<string, string>;
31
+ }
32
+ export declare const codex: (model: string, options?: CodexOptions | undefined) => AgentProvider;
33
+ /** Options for the opencode agent provider. */
34
+ export interface OpenCodeOptions {
35
+ /** Environment variables injected by this agent provider. */
36
+ readonly env?: Record<string, string>;
37
+ }
38
+ export declare const opencode: (model: string, options?: OpenCodeOptions | undefined) => AgentProvider;
21
39
  export interface ClaudeCodeOptions {
22
40
  readonly effort?: "low" | "medium" | "high" | "max";
41
+ /** Environment variables injected by this agent provider. */
42
+ readonly env?: Record<string, string>;
23
43
  }
24
44
  export declare const claudeCode: (model: string, options?: ClaudeCodeOptions | undefined) => AgentProvider;
25
45
  //# sourceMappingURL=AgentProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentProvider.d.ts","sourceRoot":"","sources":["../src/AgentProvider.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AA6DtD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1C,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/C,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAAC;CACpD;AAED,eAAO,MAAM,aAAa,oBAAoB,CAAC;AA2D/C,eAAO,MAAM,EAAE,kCAcb,CAAC;AAwCH,eAAO,MAAM,KAAK,kCAchB,CAAC;AAMH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;CACrD;AAED,eAAO,MAAM,UAAU,2EAoBrB,CAAC"}
1
+ {"version":3,"file":"AgentProvider.d.ts","sourceRoot":"","sources":["../src/AgentProvider.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM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
@@ -108,8 +108,9 @@ const parsePiStreamLine = (line) => {
108
108
  }
109
109
  return [];
110
110
  };
111
- export const pi = (model) => ({
111
+ export const pi = (model, options) => ({
112
112
  name: "pi",
113
+ env: options?.env ?? {},
113
114
  buildPrintCommand(prompt) {
114
115
  return `pi -p --mode json --no-session --model ${shellEscape(model)} ${shellEscape(prompt)}`;
115
116
  },
@@ -151,8 +152,9 @@ const parseCodexStreamLine = (line) => {
151
152
  }
152
153
  return [];
153
154
  };
154
- export const codex = (model) => ({
155
+ export const codex = (model, options) => ({
155
156
  name: "codex",
157
+ env: options?.env ?? {},
156
158
  buildPrintCommand(prompt) {
157
159
  return `codex exec --json --dangerously-bypass-approvals-and-sandbox -m ${shellEscape(model)} ${shellEscape(prompt)}`;
158
160
  },
@@ -163,8 +165,22 @@ export const codex = (model) => ({
163
165
  return parseCodexStreamLine(line);
164
166
  },
165
167
  });
168
+ export const opencode = (model, options) => ({
169
+ name: "opencode",
170
+ env: options?.env ?? {},
171
+ buildPrintCommand(prompt) {
172
+ return `opencode run --model ${shellEscape(model)} ${shellEscape(prompt)}`;
173
+ },
174
+ buildInteractiveArgs(_prompt) {
175
+ return ["opencode", "--model", model];
176
+ },
177
+ parseStreamLine(_line) {
178
+ return [];
179
+ },
180
+ });
166
181
  export const claudeCode = (model, options) => ({
167
182
  name: "claude-code",
183
+ env: options?.env ?? {},
168
184
  buildPrintCommand(prompt) {
169
185
  const effortFlag = options?.effort ? ` --effort ${options.effort}` : "";
170
186
  return `claude --print --verbose --dangerously-skip-permissions --output-format stream-json --model ${shellEscape(model)}${effortFlag} -p ${shellEscape(prompt)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"AgentProvider.js","sourceRoot":"","sources":["../src/AgentProvider.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,GAAG,CAAC;AAEhF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