/**
 * What lets a terminal control endpoint serve its session the way a host does: a host
 * `SessionEventWriter` fed by the one session record projection (`subscribeSessionRecords`), so an
 * attached client reads the same records, ordering and in-flight replay as from a host, and a status
 * stream over this one session for `subscribe_sessions` (with the same `mirror` opt-in). Every
 * connection's answers go through the writer, so a command's answer is ordered with the records around it.
 *
 * The terminal itself is one attachment; each attached client adds one. A client that only subscribed
 * (mirror included) is not an attachment.
 *
 * It also keeps what a host keeps per connection and per session for the drive set (senpi#4267): the roles each
 * connection declared with `set_client_info`, and the admission receipt of every input sent with a `clientMessageId`,
 * so a retry is answered from its receipt instead of being delivered twice.
 */
import type { AgentSession } from "../../core/agent-session.ts";
import { ConnectionRoles } from "../rpc/connection-roles.ts";
import { SessionEventWriter } from "../rpc/session-event-writer.ts";
import type { ControlConnection } from "./session-control-server.ts";
import type { TerminalPresenterSurface } from "./terminal-presenter-surface.ts";
export declare class ControlAttachments {
    readonly writer: SessionEventWriter;
    readonly roles: ConnectionRoles;
    readonly receipts: Map<string, TerminalInputReceipt>;
    private readonly attached;
    private readonly stopRecords;
    private readonly session;
    /** The terminal's MCP form presenters (D11 S3-6b), when enforcement is on. */
    readonly presenters: TerminalPresenterSurface | undefined;
    constructor(session: AgentSession, pendingQuestions: () => number, presenters?: TerminalPresenterSurface);
    /** The routing handle records carry: this terminal's session id. */
    get handle(): string;
    opened(connection: ControlConnection): void;
    closed(connection: ControlConnection): void;
    /** Drops this connection's attachment (`release_attachment`); false when it was not attached. */
    detach(connection: ControlConnection): boolean;
    /** Attaches the connection: it is replayed the in-flight snapshot, then receives the session's records. */
    attach(connection: ControlConnection): boolean;
    isAttached(connection: ControlConnection): boolean;
    /** Runs a command with this connection as the writer's current one (its targeted records reach it). */
    run<T>(connection: ControlConnection, task: () => T): T;
    respond(connection: ControlConnection, answer: object): void;
    dispose(): void;
    private entryView;
}
/** The receipt a terminal answers an input sent with a `clientMessageId` with, and answers again on a retry. */
export interface TerminalInputReceipt {
    /** What was sent: a retry with the same id and different content is a conflict, as on a host. */
    readonly fingerprint: string;
    /** `held`: kept as a held notice under a Stop or an interrupted run until the person releases it (senpi#6490). */
    readonly disposition: "started" | "queued" | "held";
    readonly admission: {
        readonly clientMessageId: string;
        readonly durableSessionId: string;
        readonly disposition: "started" | "queued" | "held";
    };
}
/** The writer's id for one control connection. */
export declare function keyOf(connection: ControlConnection): string;
//# sourceMappingURL=session-control-attach.d.ts.map