import type { MountConfig, MountConfigJsonObject, NativeMountPluginDescriptor } from "./agent-os.js"; import type { Bindings } from "./bindings.js"; export interface AgentOsSandboxProcessResult { stdout?: string; stderr?: string; exitCode?: number | null; timedOut?: boolean; durationMs?: number; } export interface AgentOsSandboxProcessInfo { id: string; command?: string; args?: string[]; status?: string; exitCode?: number | null; pid?: number | null; } export interface AgentOsSandboxProcessLogs { entries: Array<{ data: string; encoding?: "base64" | string; stream?: "stdout" | "stderr" | "combined" | string; timestampMs?: number; }>; } export interface AgentOsSandboxClient { dispose?(): Promise | void; runProcess(options: { command: string; args?: string[]; cwd?: string; env?: Record; timeoutMs?: number; }): Promise; createProcess(options: { command: string; args?: string[]; cwd?: string; env?: Record; }): Promise; listProcesses(): Promise<{ processes: AgentOsSandboxProcessInfo[]; }>; stopProcess(id: string): Promise; killProcess(id: string): Promise; getProcessLogs(id: string, options?: { stream?: "stdout" | "stderr" | "combined"; tail?: number; }): Promise; sendProcessInput(id: string, input: { data: string; encoding: "base64"; }): Promise; } export interface AgentOsSandboxProvider { start(): Promise; } export interface AgentOsSandboxCommonOptions { /** Mount path inside the agentOS VM. Defaults to "/mnt/sandbox". */ mountPath?: string; /** Root path inside the external sandbox provider. Defaults to "/". */ sandboxRoot?: string; /** Per-request timeout for sandbox-agent filesystem calls. */ timeoutMs?: number; /** Maximum file size allowed for buffered pread/truncate fallbacks. */ maxFullReadBytes?: number; /** Marks the VM mount read-only. Defaults to false. */ readOnly?: boolean; } export interface AgentOsSandboxProviderOptions extends AgentOsSandboxCommonOptions { /** Provider used to start a Sandbox Agent client for this VM. */ provider: AgentOsSandboxProvider; } export interface AgentOsSandboxClientOptions extends AgentOsSandboxCommonOptions { /** Externally provisioned Sandbox Agent-compatible client instance. */ client: AgentOsSandboxClient; /** * Advanced lifecycle control. Set true to dispose `client` with the VM, or * provide a custom dispose hook. Defaults to false for the object form. */ dispose?: boolean | (() => void | Promise); } export type AgentOsSandboxOptions = AgentOsSandboxProviderOptions | AgentOsSandboxClientOptions; export type AgentOsSandboxInput = AgentOsSandboxOptions; declare const sandboxDisposeHooks: unique symbol; type SandboxDisposeHook = () => void | Promise; export type AgentOsSandboxExpandedOptions = { mounts?: MountConfig[]; bindings?: Bindings[]; [sandboxDisposeHooks]?: SandboxDisposeHook[]; }; type ResolvedSandboxOptions = AgentOsSandboxCommonOptions & { client: AgentOsSandboxClient; }; export type SandboxMountPluginConfig = MountConfigJsonObject & { baseUrl: string; token?: string; headers?: Record; basePath?: string; timeoutMs?: number; maxFullReadBytes?: number; }; export declare function createSandboxFs(input: ResolvedSandboxOptions | AgentOsSandboxClientOptions): NativeMountPluginDescriptor; export declare function createSandboxBindings(input: ResolvedSandboxOptions | AgentOsSandboxClientOptions): Bindings; export declare function getSandboxDisposeHooks(options: object | undefined): SandboxDisposeHook[]; export declare function resolveSandboxOptions(options: T): Promise & { mounts?: MountConfig[]; bindings?: Bindings[]; }>; export {};