import type { EventEmitter } from 'node:events'; import type { BrokerToClient, ClientToBroker } from '../runtime/broker-protocol.js'; export interface Transport extends EventEmitter { /** Open the connection. Emits 'connect' on success, 'error' on a fatal * connect-time failure. Call once. */ connect(): void; /** Re-establish the connection to the SAME target after a drop. Resolves on * a fresh 'connect'; rejects on a retryable dial failure (the caller's * reconnect supervisor decides whether to try again). */ redial(): Promise; /** Encode + send one client→broker frame. No-op on a dead/absent connection; * never throws. */ send(frame: ClientToBroker): void; /** Tear down the connection. 'close' fires if it has not already. */ destroy(): void; on(event: 'connect', listener: () => void): this; on(event: 'frame', listener: (frame: BrokerToClient) => void): this; on(event: 'close', listener: () => void): this; on(event: 'error', listener: (err: Error) => void): this; once(event: 'connect', listener: () => void): this; once(event: 'error', listener: (err: Error) => void): this; off(event: 'connect', listener: () => void): this; off(event: 'error', listener: (err: Error) => void): this; } /** Surfaced when a Transport's target has no reachable broker — locally, no * socket file / nothing listening; remotely, a relay close signaling "no * broker for this node". The command catches this to exit non-zero with a * focus/revive hint — same meaning regardless of which Transport raised it. */ export declare class BrokerUnavailableError extends Error { readonly nodeId: string; constructor(nodeId: string); }