export type RouteRecord = Readonly<Record<string, unknown>>;
export declare class RouteDisconnected extends Error {
    readonly sent: boolean;
    constructor(sent: boolean);
}
/**
 * How long a predecessor may leave a request unanswered before it has to show it is alive: the host's own stall
 * threshold. A late answer is followed by a liveness probe, and a predecessor that answers neither is stalled.
 */
export declare const PREDECESSOR_REQUEST_TIMEOUT_MS = 5000;
/** A request the predecessor did not answer in time (`predecessor_request_timeout`); the connection is cut. */
export declare class RouteTimedOut extends Error {
    constructor();
}
export interface RouteEndpoint {
    socket: string;
    launchId: string;
    instanceId: string;
    keyRoot: string;
}
/** One authenticated attachment per downstream connection and session. IDs and requester-only records never mix. */
export declare class PredecessorPeer {
    private readonly pending;
    private readonly socket;
    readonly generation: number;
    private constructor();
    static connect(endpoint: RouteEndpoint, onRecord: (record: RouteRecord) => void, onEnd: () => void): Promise<PredecessorPeer>;
    /**
     * Every request is bounded. `deadlineMs` is a fixed limit; without it the request waits while the predecessor stays
     * alive, so a long command (`bash`, `compact` answer when their work is done) is never cut.
     */
    request(command: RouteRecord, deadlineMs?: number): Promise<RouteRecord>;
    private answerWhileAlive;
    send(record: RouteRecord): void;
    close(): void;
}
//# sourceMappingURL=predecessor-peer.d.ts.map