eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
50 lines (49 loc) • 2.37 kB
TypeScript
import type { SandboxBackend } from "#public/definitions/sandbox-backend.js";
import type { DockerSandboxCreateOptions } from "#public/sandbox/docker-sandbox.js";
import type { JustBashSandboxCreateOptions } from "#public/sandbox/just-bash-sandbox.js";
import type { MicrosandboxCreateOptions } from "#public/sandbox/microsandbox-sandbox.js";
import type { VercelSandboxCreateOptions } from "#public/sandbox/vercel-sandbox.js";
/**
* Input to {@link defaultSandbox}: a separate options bag per inner
* backend. The framework picks one backend at runtime based on
* availability and passes it the matching bag; the others are ignored.
*/
export interface DefaultSandboxOptions {
readonly docker?: DockerSandboxCreateOptions;
readonly justBash?: JustBashSandboxCreateOptions;
readonly microsandbox?: MicrosandboxCreateOptions;
readonly vercel?: VercelSandboxCreateOptions;
}
/**
* Availability probes behind {@link defaultSandbox}'s selection chain.
* Injectable so selection logic is testable without touching the host.
*/
export interface DefaultSandboxProbes {
readonly isDeployedOnVercel: () => boolean;
readonly isDockerAvailable: () => boolean;
readonly isMicrosandboxSupported: () => boolean;
}
/**
* Constructs an availability-aware sandbox backend. On first use it
* picks the best backend the host supports, in priority order:
*
* 1. **Vercel Sandbox** when deploying on Vercel (`process.env.VERCEL`
* is set) — local container/VM runtimes cannot run there.
* 2. **Docker** when a Docker daemon is reachable.
* 3. **microsandbox** when the host supports it (macOS on Apple
* Silicon, or glibc Linux with KVM); `eve dev` auto-installs the
* package into the project.
* 4. **just-bash** as the dependency-free fallback; `eve dev`
* auto-installs the package into the project.
*
* The selection is cached for the process lifetime. To pin a backend
* unconditionally, configure its factory directly (`docker()`,
* `microsandbox()`, `justbash()`,
* `vercel()`).
*/
export declare function defaultSandbox(opts?: DefaultSandboxOptions): SandboxBackend;
/**
* The selection chain behind {@link defaultSandbox}. Internal —
* exported for tests, which inject probes.
*/
export declare function selectDefaultSandbox(opts: DefaultSandboxOptions | undefined, probes: DefaultSandboxProbes): SandboxBackend;