import type { SandboxProcessManager } from './process'; export type ProviderStatus = 'pending' | 'initializing' | 'ready' | 'starting' | 'running' | 'stopping' | 'stopped' | 'destroying' | 'destroyed' | 'error'; export type FileContent = string | Buffer | Uint8Array; export interface FileEntry { name: string; type: 'file' | 'directory'; size?: number; } export interface FileStat { name: string; path: string; type: 'file' | 'directory'; size: number; createdAt: Date; modifiedAt: Date; } export interface AbortableOptions { abortSignal?: AbortSignal; } export interface ReadOptions extends AbortableOptions { encoding?: BufferEncoding; } export interface WriteOptions extends AbortableOptions { recursive?: boolean; overwrite?: boolean; } export interface ListOptions extends AbortableOptions { recursive?: boolean; extension?: string; } export interface RemoveOptions extends AbortableOptions { recursive?: boolean; force?: boolean; } export interface CopyOptions extends AbortableOptions { overwrite?: boolean; recursive?: boolean; } export interface MkdirOptions extends AbortableOptions { recursive?: boolean; } export type AppendOptions = AbortableOptions; export interface MountConfig { type: 'local'; basePath: string; } export interface WorkspaceFilesystem { readonly id: string; readonly name: string; readonly provider: string; readonly readOnly?: boolean; readonly basePath?: string; status: ProviderStatus; readFile(path: string, options?: ReadOptions): Promise; writeFile(path: string, content: FileContent, options?: WriteOptions): Promise; appendFile(path: string, content: FileContent, options?: AppendOptions): Promise; deleteFile(path: string, options?: RemoveOptions): Promise; copyFile(src: string, dest: string, options?: CopyOptions): Promise; moveFile(src: string, dest: string, options?: CopyOptions): Promise; mkdir(path: string, options?: MkdirOptions): Promise; rmdir(path: string, options?: RemoveOptions): Promise; readdir(path: string, options?: ListOptions): Promise; exists(path: string, options?: AbortableOptions): Promise; stat(path: string, options?: AbortableOptions): Promise; init?(): Promise; destroy?(): Promise; _init?(): Promise; _destroy?(): Promise; getInstructions?(): string; getMountConfig?(): MountConfig; } export interface CommandResult { success: boolean; exitCode: number; stdout: string; stderr: string; executionTimeMs: number; timedOut?: boolean; killed?: boolean; command?: string; args?: string[]; } export interface CommandOptions { timeout?: number; env?: NodeJS.ProcessEnv; cwd?: string; onStdout?: (data: string) => void; onStderr?: (data: string) => void; abortSignal?: AbortSignal; } export type ExecuteCommandOptions = CommandOptions; export interface SandboxInfo { id: string; name: string; provider: string; status: ProviderStatus; createdAt?: Date; resources?: { memoryMB?: number; cpuCores?: number; }; metadata?: Record; } export interface WorkspaceSandbox { readonly id: string; readonly name: string; readonly provider: string; status: ProviderStatus; getInstructions?(): string; executeCommand?(command: string, args?: string[], options?: ExecuteCommandOptions): Promise; readonly processes?: SandboxProcessManager; start?(): Promise; stop?(): Promise; destroy?(): Promise; _start?(): Promise; _stop?(): Promise; _destroy?(): Promise; } export type SpawnProcessOptions = CommandOptions; export interface ProcessInfo { pid: number; command?: string; exitCode?: number; } export { SandboxProcessManager, ProcessHandle } from './process'; export interface BaseSandboxOptions { processes?: SandboxProcessManager; onStart?: (args: { sandbox: WorkspaceSandbox; }) => void | Promise; onStop?: (args: { sandbox: WorkspaceSandbox; }) => void | Promise; onDestroy?: (args: { sandbox: WorkspaceSandbox; }) => void | Promise; } export interface LocalFilesystemOptions { id?: string; basePath: string; contained?: boolean; readOnly?: boolean; instructions?: string; } export interface LocalSandboxOptions { id?: string; workingDirectory?: string; env?: NodeJS.ProcessEnv; timeout?: number; instructions?: string; } export interface DaytonaSandboxOptions { id?: string; apiKey?: string; apiUrl?: string; timeout?: number; language?: 'typescript' | 'javascript' | 'python'; resources?: { cpu?: number; memory?: number; disk?: number; }; env?: Record; labels?: Record; snapshot?: string; image?: string; ephemeral?: boolean; autoStopInterval?: number; name?: string; networkBlockAll?: boolean; networkAllowList?: string; } export interface WorkspaceConfig { id?: string; name?: string; filesystem?: WorkspaceFilesystem; sandbox?: WorkspaceSandbox; } export interface MountResult { success: boolean; mountPath: string; error?: string; }