This page documents the shared types that appear acrossDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/mattpocock/sandcastle/llms.txt
Use this file to discover all available pages before exploring further.
run(), createSandbox(), createWorktree(), and interactive(). All types are exported from @ai-hero/sandcastle.
Sandbox provider types
Sandcastle dispatches on atag discriminant to determine how to start and manage a sandbox at runtime.
SandboxProvider
run() and createSandbox(). Does not include NoSandboxProvider — that is only valid for interactive().
AnySandboxProvider
interactive() and wt.interactive(). Adds NoSandboxProvider to the base union.
BindMountSandboxProvider
Providers that mount the host worktree directly into the container — no file transfer needed. Built-in examples: docker(), podman().
Discriminant used for internal dispatch.
Human-readable provider name.
Environment variables injected by this provider at launch time.
Absolute path to the home directory inside the sandbox (for example
/home/agent). Used to expand ~ in sandboxPath mount configs.IsolatedSandboxProvider
Providers with their own filesystem where the repo must be copied in and out. Built-in example: vercel().
Discriminant used for internal dispatch.
Human-readable provider name.
Environment variables injected by this provider at launch time.
NoSandboxProvider
Runs the agent directly on the host with no container. Only valid for interactive() and wt.interactive().
Discriminant used for internal dispatch.
Human-readable provider name.
Environment variables injected by this provider.
Custom providers
Create a bind-mount provider withcreateBindMountSandboxProvider(config) or an isolated provider with createIsolatedSandboxProvider(config), both exported from @ai-hero/sandcastle.
BranchStrategy
Controls where the agent’s commits land. Three variants are available.
HeadBranchStrategy
MergeToHeadBranchStrategy
NamedBranchStrategy
baseBranch (defaults to HEAD) if it does not already exist.
Strategy discriminant.
The explicit branch name to create or check out.
Git ref to branch from when the branch does not yet exist. Defaults to
HEAD.SandboxHooks
Lifecycle hooks grouped by where they run.
host.onWorktreeReady
Runs on the host after copyToWorktree completes, before the sandbox container starts. Working directory is the worktree path (or the host repo root under head strategy). Hooks run sequentially in declared order.
Each entry accepts:
Shell command to run on the host.
Per-hook timeout in milliseconds. Overrides the default 60 s.
host.onSandboxReady
Runs on the host after the sandbox container is up, in parallel with sandbox.onSandboxReady. Working directory is the worktree path.
Same entry shape as host.onWorktreeReady.
sandbox.onSandboxReady
Runs inside the sandbox container after it starts, in parallel with host.onSandboxReady. Working directory is the sandbox repo directory.
Each entry accepts:
Shell command to run inside the sandbox.
Run the command with elevated privileges.
Per-hook timeout in milliseconds.
copyToWorktree → host.onWorktreeReady (sequential) → sandbox created → host.onSandboxReady + sandbox.onSandboxReady (parallel).
MountConfig
A single bind-mount descriptor for docker() and podman() providers. Pass an array of these as mounts in the provider factory.
Path on the host. Supports absolute paths (
/data/cache), tilde-expanded paths (~/data), and relative paths (data) resolved from process.cwd().Path inside the sandbox container. Supports absolute paths, tilde-expanded paths (resolved using the provider’s sandbox home directory), and relative paths resolved from the sandbox repo directory.
Mount the directory as read-only.
Timeouts
Override default timeouts for built-in lifecycle steps. Unset keys keep their defaults.
Timeout in milliseconds for the host-side copy of
copyToWorktree paths into the worktree.