export { SeedCommandInput, SeedCommandResult, SeedDaemonInfo, SeedEventFilter, SeedHealthPayload, SeedInvocationResult, SeedScriptConfig, daemonSeedScript, daemonSeedScriptCommand, parseSeedInvocationOutput } from 'daemond'; /** * Universal Sandbox Interface * * The canonical interface for all ComputeSDK sandboxes. Providers using * @computesdk/provider implement this shape (re-exported as SandboxInterface). */ /** * Code execution result */ interface CodeResult { output: string; exitCode: number; language: string; } /** * Command execution result */ interface CommandResult { stdout: string; stderr: string; exitCode: number; durationMs: number; } /** * Sandbox information */ interface SandboxInfo { /** Unique identifier for the sandbox */ id: string; /** Provider hosting the sandbox */ provider: string; /** Current status of the sandbox */ status: 'running' | 'stopped' | 'error'; /** When the sandbox was created */ createdAt: Date; /** Execution timeout in milliseconds */ timeout: number; /** Additional provider-specific metadata */ metadata?: Record; } /** * File entry from directory listing */ interface FileEntry { name: string; type: 'file' | 'directory'; size?: number; modified?: Date; } /** * Options for running a command */ interface RunCommandOptions { cwd?: string; env?: Record; timeout?: number; background?: boolean; /** * Callback for streamed stdout chunks when supported by the provider. */ onStdout?: (data: string) => void; /** * Callback for streamed stderr chunks when supported by the provider. */ onStderr?: (data: string) => void; } /** * Snapshot information */ interface Snapshot { /** Unique identifier for the snapshot */ id: string; /** Provider hosting the snapshot */ provider: string; /** When the snapshot was created */ createdAt: Date; /** Additional provider-specific metadata */ metadata?: Record; } /** * Filesystem operations interface */ interface SandboxFileSystem { readFile(path: string): Promise; writeFile(path: string, content: string): Promise; readdir(path: string): Promise; mkdir(path: string): Promise; exists(path: string): Promise; remove(path: string): Promise; } /** * Options for creating a sandbox * * Providers can extend this with additional properties specific to their implementation */ interface CreateSandboxOptions$1 { timeout?: number; /** Provider-agnostic template/image ID to boot from */ templateId?: string; /** * Snapshot ID to restore from when creating a sandbox. * * Each provider maps this to its native concept: * - E2B: passed directly as the template/image ID * - Daytona: sets `createParams.snapshot` * - Modal: loads the image via `client.images.fromId(snapshotId)` * - CodeSandbox: calls `sdk.sandboxes.resume(snapshotId)` * - Runloop: maps to `snapshot_id` in devbox creation params */ snapshotId?: string; metadata?: Record; envs?: Record; name?: string; namespace?: string; directory?: string; [key: string]: any; } /** * Universal Sandbox Interface * * All ComputeSDK sandboxes implement this interface. * Core methods are required, advanced features are optional. * * Note: Implementations may use slightly different types for return values * as long as they are structurally compatible. For example, getInfo() might * return additional fields beyond the base SandboxInfo. */ interface Sandbox { /** Unique identifier for the sandbox */ readonly sandboxId: string; /** Provider name (e2b, railway, modal, etc.) */ readonly provider: string; /** * Execute shell command * * Send raw command string to the sandbox - no preprocessing. * The provider/server handles shell invocation and execution details. */ runCommand(command: string, options?: RunCommandOptions): Promise; /** Get information about the sandbox */ getInfo(): Promise; /** Get URL for accessing the sandbox on a specific port */ getUrl(options: { port: number; protocol?: string; }): Promise; /** Destroy the sandbox and clean up resources */ destroy(): Promise; /** File system operations */ readonly filesystem: SandboxFileSystem; } /** * Compute API - Direct Provider Implementation * * `compute` delegates to one or more configured provider instances directly. */ interface CreateSandboxOptions extends CreateSandboxOptions$1 { /** Optional provider name override (must match provider.name) */ provider?: string; } interface CreateSnapshotOptions { name?: string; metadata?: Record; /** Optional provider name override (must match provider.name) */ provider?: string; } interface ProviderSandboxManager { create(options?: CreateSandboxOptions): Promise; getById(sandboxId: string): Promise; list?(): Promise; destroy(sandboxId: string): Promise; } interface ProviderSnapshotManager { create(sandboxId: string, options?: { name?: string; metadata?: Record; }): Promise<{ id: string; provider: string; createdAt: Date | string; metadata?: Record; }>; list(): Promise; }>>; delete(snapshotId: string): Promise; } interface DirectProvider { readonly name?: string; readonly sandbox: ProviderSandboxManager; readonly snapshot?: ProviderSnapshotManager; } /** * Explicit compute configuration for callable mode. * * Use `provider` for single-provider mode or `providers` for multi-provider mode. */ interface ExplicitComputeConfig { /** Single-provider mode */ provider?: DirectProvider; /** Multi-provider mode (recommended for resilient routing) */ providers?: DirectProvider[]; /** Provider selection strategy when no explicit provider is passed */ providerStrategy?: 'priority' | 'round-robin'; /** Retry the next provider when create fails */ fallbackOnError?: boolean; } declare class ComputeManager { private providers; private providerStrategy; private fallbackOnError; private roundRobinCursor; private sandboxProviders; private snapshotProviders; private getProviders; private getProviderByName; private registerSandboxProvider; private getCreateCandidates; private getByIdCandidates; private getSnapshotDeleteCandidates; private getSnapshotCreateCandidates; private createWithFallback; setConfig(config: ExplicitComputeConfig): void; sandbox: { create: (options?: CreateSandboxOptions) => Promise; getById: (sandboxId: string) => Promise; list: () => Promise; destroy: (sandboxId: string) => Promise; }; snapshot: { create: (sandboxId: string, options?: CreateSnapshotOptions) => Promise<{ id: string; provider: string; createdAt: Date; metadata?: Record; }>; list: () => Promise; }>>; delete: (snapshotId: string) => Promise; }; } interface CallableCompute extends ComputeManager { (config: ExplicitComputeConfig): ComputeManager; setConfig(config: ExplicitComputeConfig): void; } declare const compute: CallableCompute; export { type CallableCompute, type CodeResult, type CommandResult, type CreateSandboxOptions$1 as CreateSandboxOptions, type ExplicitComputeConfig, type FileEntry, type RunCommandOptions, type SandboxFileSystem, type SandboxInfo, type Sandbox as SandboxInterface, type Snapshot, compute };