import { multiplexFrame } from "@volter/browser-runtime/docker-engine.js"; export interface RemoteProcessOptions { cwd?: string; env?: Record; stdin?: string; stdinStream?: AsyncIterable; terminal?: { columns: number; rows: number; onResize?: (listener: (columns: number, rows: number) => void) => () => void; }; onStdout?: (chunk: string) => void; onStderr?: (chunk: string) => void; } export interface RemoteProcessResult { stdout: string; stderr: string; exitCode: number; cwd?: string; env?: Record; } export interface RemoteProcessHandle { pid: number; command: string; startedAt: number; readonly state: "running" | "exited" | "failed"; result: Promise; kill(): void; resize(columns: number, rows: number): void; } export interface RemoteProcessInfo { pid: number; command: string; startedAt: number; state: string; } export interface RemotePtyOptions { command?: string; cols?: number; rows?: number; cwd?: string; env?: Record; } export interface RemotePtySession { id: string; pid: number; cols: number; rows: number; allocator: "exec"; resizable: true; write(data: string | Uint8Array): Promise; resize(cols: number, rows: number): Promise<{ cols: number; rows: number; }>; onData(listener: (bytes: Uint8Array) => void): () => void; kill(): void; exited: Promise; } export interface RemoteFileEntry { name: string; type: "file" | "directory"; size: number; } export interface RemoteArchive { format: "tar"; bytes: Uint8Array; integrity: string | null; entries: number; fileBytes: number; } export interface RemoteImportResult { format: string; integrity: string; entries: number; fileBytes: number; } export interface RemoteHealth { ok: boolean; root: string; portDiscovery: string; ports: number[]; startedAt: number; lastActivityAt: number; liveProcesses: number; confinement?: unknown; } export interface RemoteRuntimeOptions { /** * The network to use. A tab's runtime patches the global fetch so loopback * hosts become its virtual network; a page that drives a real sandbox passes * the fetch it captured before booting the runtime. */ fetch?: typeof fetch; /** Makes the socket for an exec; a tab passes the page's own, the default is a real WebSocket. */ socket?: (url: string) => WebSocket; } export type RemoteBearerToken = string | (() => string | undefined); type Listener = (event: Record) => void; export declare class RemoteRuntime { readonly files: { read(path: string): Promise; readText(path: string): Promise; write(path: string, data: string | Uint8Array): Promise<{ ok: true; }>; list(path: string): Promise; mkdir(path: string): Promise<{ ok: true; }>; remove(path: string): Promise<{ ok: true; }>; export(root?: string, format?: "tar", options?: { exclude?: readonly string[]; }): Promise; import(bytes: Uint8Array, options?: { root?: string; replace?: boolean; }): Promise; }; private readonly base; private readonly token; private readonly network; private readonly makeSocket; private readonly listeners; private readonly abort; /** The one container this daemon holds, known after `connect`. */ private containerId; private startedAt; constructor(baseUrl: string, token: RemoteBearerToken, options?: RemoteRuntimeOptions); private get container(); /** * Pings the daemon, finds its one container, opens the event stream, and * returns the container's health. A server that is not a Docker daemon of * ours is refused with its status. */ connect(): Promise; private consume; private dispatch; on(type: string, listener: Listener): () => void; private execCreate; private execExitCode; private execSocket; start(command: string, options?: RemoteProcessOptions): Promise; spawn(command: string, options?: RemoteProcessOptions): Promise; /** A terminal session: an exec of the command with a TTY over the socket; bytes in, bytes out. */ openPty(options?: RemotePtyOptions): Promise; /** The container's health, from inspect and top; never counts as activity on the daemon's clock beyond the request. */ health(): Promise; processes(): Promise; ports(): Promise; portUrl(port: number): string; request(port: number, input?: string | URL, init?: RequestInit): Promise; /** The profiler's rows, carried under `substrate` in Docker's stats. */ metrics(): Promise>; /** A WebSocket to a guest port, tunnelled through the daemon. */ webSocket(port: number, input?: string | URL): WebSocket; close(): void; private call; private tokenValue; private ok; private json; } /** Frames a chunk the way the daemon frames stdout, for tests and tools that need the shape. */ export declare const dockerFrame: typeof multiplexFrame; export {}; //# sourceMappingURL=client.d.ts.map