import { EventLeases } from "./compact-event-leases.ts";
import { RecoveryPageRequests } from "./compact-recovery-requests.ts";
import { RecoveryCheckpoints } from "./compact-recovery-state.ts";
import { LegacyReplayStore } from "./legacy-replay-store.ts";
import type { SessionAcceptanceLane } from "./session-acceptance-lane.ts";
import { type RegisteredConnection, type SessionEventWriterConnection } from "./session-event-connection.ts";
export declare class SessionEventFanout {
    requiredSessions?: (peer: string) => readonly string[];
    onSessionForgotten?: (sessionId: string) => void;
    readonly startupCleanup: Promise<import("./compact-recovery-cleanup.ts").RootSweep> | undefined;
    onConnectionClosed?: (id: string) => void;
    /** Each routing session's acceptance lane; retired when the session is sealed or forgotten. */
    readonly acceptance: Map<string, SessionAcceptanceLane>;
    /** Today's retention for a session without a lane (RULING-25 Q5), and the open-view count of both sources. */
    readonly replay: LegacyReplayStore;
    /** The checkpoint tokens this host froze for its peers' baselines and recoveries (S08a). */
    readonly checkpoints: RecoveryCheckpoints;
    /** The ordinary-event leases of peers that selected compact events (S13); absent with the flag off. */
    readonly events: EventLeases | undefined;
    /** The page route over those tokens and leases (S11b, S13); absent with the flag off, so it answers as before. */
    readonly pages: RecoveryPageRequests | undefined;
    private socketEpochs;
    /** Today's shed path with the compact-updates flag off; the cut frozen at the shed with it on. */
    private readonly shedMode;
    private readonly connections;
    private readonly connectionCapabilities;
    /** Per connection, each attached session with the ordinal of the attach that holds it. */
    private readonly connectionSessions;
    private attachOrdinal;
    /** Roots an attach baseline still reads; a seal keeps them readable until that view ends (RULING-51 Q2=A). */
    private readonly attachViews;
    private readonly registeredCapabilityConnections;
    private readonly pins;
    registerConnection(id: string, connection: SessionEventWriterConnection, options?: {
        readonly maxQueueBytes?: number;
        readonly stallMs?: number;
    }): void;
    unregisterConnection(id: string): void;
    /**
     * A first attach is one admission: it freezes the cut C synchronously as that admission's checkpoint (the lane
     * root, read later for the baseline; today's replay view for a session without a lane) and installs that peer's
     * baseline barrier before the session is live for it; a repeated hold adds nothing. The attempt dies with a
     * detach, the peer, or a replacement (new lane epoch), and releases its checkpoint in every case.
     */
    attachConnectionToSession(id: string, sessionId: string, compact?: boolean): void;
    detachConnectionFromSession(id: string, sessionId: string): void;
    setConnectionCapabilities(id: string, capabilities: readonly string[]): void;
    clearConnectionCapabilities(id: string): void;
    hasRegisteredConnectionCapabilities(id: string): boolean;
    getConnectionCapabilities(id: string): readonly string[] | undefined;
    /** Whether a connection advertised a capability. The only capability lookup in this file. */
    connectionHas(id: string | undefined, capability: string): boolean;
    targets(sessionId: string, targetId: string | undefined, isTargeted: boolean, recordType: unknown): readonly (string | undefined)[];
    /** For a record that reaches `id` because it holds `sessionId`: whether that attachment still does; undefined for every other audience. */
    attachmentOf(id: string, sessionId: string, isTargeted: boolean, recordType: unknown): (() => boolean) | undefined;
    /** The admission (the attach ordinal) through which `id` holds `sessionId` now; undefined when it does not. */
    admissionOf(id: string, sessionId: string): string | undefined;
    get(id: string): RegisteredConnection | undefined;
    values(): IterableIterator<RegisteredConnection>;
    /** True when no socket connection is registered, i.e. records must fall back to the stdio lane. */
    isEmpty(): boolean;
    broadcast(line: string): void;
    connectionIds(): readonly string[];
    attachedConnections(sessionId: string): readonly string[];
    /**
     * Pending `question` frames a session has asked and nobody answered yet: the lane's hot count, today's count for a
     * session without a lane, and undefined (unknown) for a lane whose compact state is unavailable. The unknown count
     * is output-equivalent to the old 0: `liveStatus` reads it as `?? 0`, so the runtime's own count decides.
     */
    pendingQuestionCount(sessionId: string): number | undefined;
    /** Deliver one line to the connections attached to a session, never to the rest of the fanout. */
    deliverToSession(sessionId: string, line: string): void;
    /** Retention only for a session without a lane; a lane-owned session's late peers read its frozen view. */
    rememberSnapshot(sessionId: string, value: Record<string, unknown>, line: string, placeholderLine?: string): void;
    /**
     * A seal or forget ends the routing session for good (its handle is never reissued or re-attached): the lane retires
     * (a queued attach view keeps its root) and the session's stream records go on every peer (RULING-56 (2)).
     */
    forgetSession(sessionId: string): void;
    /**
     * The attach holding `sessionId` for `id` now, as a liveness check: true only while that same attach (its ordinal,
     * the rule an attach baseline's liveness uses) still holds it, so a detach and re-attach ends it.
     */
    private attachment;
}
//# sourceMappingURL=session-event-fanout.d.ts.map