import type { CommandResult } from '../command/command-result.js'; import type { CommandSpec } from '../command/command-spec.js'; export type DisconnectListener = (reason: Error) => void; export interface CommandRunner { /** Idempotent. Establishes the underlying connection if not already connected. */ connect(): Promise; /** Runs a command. Throws a CommandRunnerError subclass on any failure. */ run(spec: CommandSpec): Promise; /** Idempotent. Closes the underlying connection cleanly. */ disconnect(): Promise; /** Subscribes to unexpected disconnects. Returns an unsubscribe function. */ onDisconnect(listener: DisconnectListener): () => void; }