import type { SandboxControlCommand, SandboxControlEvent, SandboxControlFsCommand } from "./control-codec.ts"; type SandboxControlFsRequest = SandboxControlFsCommand extends infer T ? T extends SandboxControlFsCommand ? Omit : never : never; export interface SandboxControl extends Transport { requestFileSystem(command: SandboxControlFsRequest): Promise>; exec(input: { readonly id?: string; readonly argv: readonly string[]; readonly env?: Record; readonly cwd: string; readonly timeoutMs?: number; readonly signal?: AbortSignal; }): Promise>; spawn(input: { readonly id?: string; readonly argv: readonly string[]; readonly env?: Record; readonly cwd: string; readonly pipes: readonly number[]; }): ControlBackedSandboxProcess; pty(input: { readonly id?: string; readonly argv: readonly string[]; readonly env?: Record; readonly cwd: string; readonly size: { readonly rows: number; readonly cols: number; }; }): ControlBackedSandboxPty; openConnection(input: { readonly hostname: string; readonly port: number; readonly secure: boolean; readonly timeoutMs: number; readonly serverName?: string; }): ControlBackedGuestConnection; } export interface Transport { readonly incoming: AsyncIterable; send(message: TOutgoing): Promise; close(): Promise; } export interface HostControlChannel { readonly packets: AsyncIterable; writeControlPacket(packet: Uint8Array): void; } type SandboxProcessSignal = "SIGHUP" | "SIGINT" | "SIGQUIT" | "SIGTERM" | "SIGKILL"; export declare class HostControlTransport implements SandboxControl { #private; readonly incoming: AsyncIterable; constructor(options?: { readonly connected?: boolean; readonly channel?: HostControlChannel; }); send(message: SandboxControlCommand): Promise; requestFileSystem(command: SandboxControlFsRequest): Promise>; exec(input: { readonly id?: string; readonly argv: readonly string[]; readonly env?: Record; readonly cwd: string; readonly timeoutMs?: number; readonly signal?: AbortSignal; }): Promise>; spawn(input: { readonly id?: string; readonly argv: readonly string[]; readonly env?: Record; readonly cwd: string; readonly pipes: readonly number[]; }): ControlBackedSandboxProcess; pty(input: { readonly id?: string; readonly argv: readonly string[]; readonly env?: Record; readonly cwd: string; readonly size: { readonly rows: number; readonly cols: number; }; }): ControlBackedSandboxPty; openConnection(input: { readonly hostname: string; readonly port: number; readonly secure: boolean; readonly timeoutMs: number; readonly serverName?: string; }): ControlBackedGuestConnection; close(): Promise; emit(event: SandboxControlEvent): void; } export declare class ControlBackedGuestConnection { #private; readonly opened: Promise; constructor(id: string, control: SandboxControl, onClose: () => void); onError(handler: (error: Error) => void): void; write(data: Uint8Array): Promise; read(maxBytes: number): Promise; close(): void; emit(event: Extract): void; fail(error: unknown): void; } export declare class ControlBackedSandboxProcess { #private; readonly stdin: WritableStream; readonly stdout: ReadableStream; readonly stderr: ReadableStream; readonly pipes: ReadonlyMap; readonly ready: Promise; readonly exit: Promise<{ readonly exitCode: number | null; readonly signal: SandboxProcessSignal | null; }>; constructor(id: string, control: SandboxControl, pipes: readonly number[]); emit(event: Extract): void; resolveReady(): void; rejectReady(error: unknown): void; kill(signal?: SandboxProcessSignal): void; fail(error: unknown): void; } export declare class ControlBackedSandboxProcessPipe { #private; readonly input: WritableStream; readonly output: ReadableStream; constructor(control: SandboxControl, id: string, fd: number); enqueue(chunk: Uint8Array): void; closeFromGuest(error: unknown): void; closeOutputFromGuest(): void; fail(error: unknown): void; } export declare class ControlBackedSandboxPty { #private; readonly input: WritableStream; readonly output: ReadableStream; readonly ready: Promise; readonly exit: Promise<{ readonly exitCode: number | null; readonly signal: SandboxProcessSignal | null; }>; constructor(id: string, control: SandboxControl); emit(event: Extract): void; resolveReady(): void; rejectReady(error: unknown): void; resize(size: { readonly rows: number; readonly cols: number; }): void; kill(signal?: SandboxProcessSignal): void; fail(error: unknown): void; } export {}; //# sourceMappingURL=control.d.ts.map