import type { AgentSession, PromptDisposition } from "../../core/agent-session.ts";
import type { AgentSessionRuntime } from "../../core/agent-session-runtime.ts";
import { type ClientAdmissionRecord, type ClientMessageAdmission, type RpcClientInput } from "./client-admission-record.ts";
import { type AdmissionHooks } from "./client-admission-intake.ts";
import type { EffectActor } from "./effect-record.ts";
/** One ledger per runtime; the transcript, not an attachment or request id, owns its history. */
/** The client (and abort effect) an `abortedBy` names. */
export type ClientAbort = {
    readonly connectionId: string;
    readonly effectId?: string;
};
export declare class ClientAdmissions {
    private readonly records;
    private readonly pending;
    private restoring;
    /** How the current turn ended, read at its final `agent_end` and written by the `agent_idle` seal. */
    private turnOutcome;
    /** The client whose `abort` reached the current turn, for `outcome.abortedBy`. */
    private turnAbortedBy;
    private lastAbort;
    private readonly session;
    private readonly durableSessionId;
    private readonly unsubscribeAgent;
    private readonly unsubscribeSession;
    hasIdentities: boolean;
    readonly ready: Promise<void>;
    private constructor();
    /** Mark queued input cleared on a session whose ledger exists; never builds one (that would restore queued input). */
    static clearQueuedFor(session: AgentSession): void;
    /**
     * Whenever `runtime` replaces its session, give the outgoing session's still-queued inputs a
     * `dropped_by_replace` receipt. Only a ledger that already exists is touched: building one now would
     * restore (replay) persisted queued input into a session that is being torn down.
     */
    static sealQueuedOnReplace(runtime: AgentSessionRuntime): () => void;
    static forSession(session: AgentSession): ClientAdmissions;
    /** The newest record for `clientMessageId` in this session, for effect status queries. */
    record(clientMessageId: string): ClientAdmissionRecord | undefined;
    /**
     * An edit of a still-queued input: its stored prepared content takes the new text (images kept), so a
     * reopen restores what the client edited, not what it first sent. The fingerprint stays the original
     * send's, so a retry of that send still replays.
     */
    editQueuedText(clientMessageId: string, text: string): void;
    /** Remember who aborted the running turn; the turn's receipts name them once it ends. */
    /** Record who aborted; the returned record is the token `forgetAbort` takes. */
    noteAbort(by: EffectActor, effectId?: string): ClientAbort;
    /** The client (and abort effect) that aborted the current turn, for `agent_end`/`session_abort.abortedBy`. */
    get abortedBy(): {
        readonly connectionId: string;
        readonly effectId?: string;
    } | undefined;
    /**
     * A client abort that reached no turn has settled: it must not name a later, unrelated abort.
     * Only that abort is forgotten; a newer one recorded meanwhile stays.
     */
    forgetAbort(abort: ClientAbort): void;
    /**
     * The queues are about to be drained (`clear_queue`, `abort` or `unload_session` with `clearQueue`, a session
     * release is not one: its queued deliveries stay unwritten so the sender redelivers them): give every still-queued input an honest `cleared` receipt first, so the drain's `queue_update` cannot
     * read it as delivered (senpi#3412).
     */
    clearQueued(): void;
    /**
     * The session is being replaced (`new_session`, `switch_session`, `fork`) and its queue is about to be
     * discarded with it: give every still-queued input an honest terminal receipt in its own transcript, so
     * a reopen of that file neither restores it nor reports it as delivered.
     */
    dropQueuedByReplace(): void;
    private endOutcome;
    private restore;
    private save;
    admit(command: RpcClientInput, invoke: (hooks: AdmissionHooks) => Promise<PromptDisposition>): Promise<ClientMessageAdmission | undefined>;
}
//# sourceMappingURL=client-admissions.d.ts.map