/**
 * RULING-124 (#5322): the engine never closes a compact peer's socket without saying why. Every engine-initiated close
 * takes one of these codes, and a peer that selected compact events receives `socket_closing {code, retryable,
 * detail?}` as its last record before the close. `retryable` is fixed per code: true when the cause belongs to this
 * connection, so a new one with the same selection may succeed; false when it would get the same answer.
 */
export declare const SOCKET_CLOSING_CODES: {
    /** A required or mirrored stream's checkpoint could not be frozen (compact storage or generation space). */
    readonly checkpoint_unavailable: {
        readonly retryable: true;
    };
    /** The connection's event queue failed: byte overflow, a missed liveness deadline, or a transport write error. */
    readonly event_queue_failed: {
        readonly retryable: true;
    };
    /** An event could not be leased: the peer's lease bound, or the content could not be staged. */
    readonly event_lease_refused: {
        readonly retryable: true;
    };
    /** A compact mirror of a session this host serves only on the legacy wire. */
    readonly compact_endpoint_unsupported: {
        readonly retryable: false;
    };
    /** The host is shutting down, after its sessions' `session_closed` records. */
    readonly host_shutdown: {
        readonly retryable: true;
    };
    /** The host is draining for a newer generation, after its sessions' handoff park records. */
    readonly host_handoff: {
        readonly retryable: true;
    };
};
export type SocketClosingCode = keyof typeof SOCKET_CLOSING_CODES;
/** The record a compact peer receives last before an engine-initiated close; best effort, never guaranteed. */
export interface RpcSocketClosingEvent {
    readonly type: "socket_closing";
    readonly code: SocketClosingCode;
    readonly retryable: boolean;
    readonly detail?: string;
}
interface ClosingTransport {
    readonly writeRaw: (chunk: string) => void;
    readonly waitForBackpressure: () => Promise<void>;
    readonly close?: () => void;
}
/**
 * The one way the engine closes a peer's socket. A legacy or flag-off peer is closed exactly as before, synchronously
 * and with no new bytes. A compact peer's record queue is stopped first, so nothing follows the record, then
 * `socket_closing` is written and the close waits for it to drain for at most `SOCKET_CLOSING_FLUSH_MS`; a broken transport (the write
 * throws or the drain rejects) is closed at once (RULING-124 (a), (b)).
 */
export declare function closeSocket(transport: ClosingTransport, queue: {
    close(): void;
}, compact: boolean, code: SocketClosingCode, detail?: string): Promise<void>;
/** The `detail` of an `event_queue_failed` close: which of the queue's failures ended it. */
export declare function queueFailureDetail(cause: unknown): string;
export {};
//# sourceMappingURL=socket-closing.d.ts.map