import { type TerminalDaemonRequest } from "./terminal-daemon-protocol.js"; import { type TerminalAttachResult, type TerminalHost, type TerminalSpawnRequest } from "./terminal-host.js"; import { type StructuredExecHost, type StructuredExecProcess, type StructuredSpawnRequest, type StructuredRunState } from "./structured-exec-host.js"; export declare class TerminalDaemonClient implements TerminalHost, StructuredExecHost { private readonly socketPath; private readonly token; readonly persistent = true; private socket; private buffer; private nextRequestId; private readonly pending; private readonly inventory; private readonly handles; private readonly pendingEvents; private readonly structuredInventory; private readonly structuredHandles; private readonly pendingStructuredEvents; private disposed; private reconnectTimer; private reconnectDelayMs; private reconnectFailureLogged; constructor(socketPath: string, token: string); connect(): Promise; attach(sessionId: string, afterSeq?: number): TerminalAttachResult | null; createOrAttach(request: TerminalSpawnRequest, afterSeq?: number): Promise; forget(sessionId: string): void; spawnStructured(request: StructuredSpawnRequest): Promise; attachRun(runId: string): Promise; adoptRun(runId: string): Promise; listRuns(): Promise; forgetRun(runId: string): void; /** Refresh the structured inventory and catch live handles up after a reconnect. */ private refreshStructuredAfterReconnect; private handleFromState; disconnect(): void; /** * Socket teardown path. Without a reconnect, a daemon restart would leave * every RemoteTerminalProcess silently dead while ProcessManager keeps the * session status at "running" forever. */ private handleDisconnect; private scheduleReconnect; private tryReconnect; /** * Diff the pre-disconnect inventory against the daemon's fresh `list`. * Sessions that vanished (daemon restart/forget) or exited while we were * disconnected get a synthetic exit delivered to their existing handle so * ProcessManager finalizes them; live sessions replay chunks missed during * the gap. */ private reconcileAfterReconnect; request(method: TerminalDaemonRequest["method"], params?: Record): Promise; reportOperationError(sessionId: string, error: unknown): void; private resultFromState; private consume; private routeEvent; /** Structured run events update the inventory and feed live handles. */ private routeStructuredEvent; private rejectPending; } export declare function createTerminalHost(configPath: string): Promise; /** Connect to an already-running terminal daemon without starting a replacement. */ export declare function connectExistingTerminalHost(configPath: string): Promise;