import type { InternalAgentChannel } from "@earendil-works/pi-agent-core";
import { type AssistantProgress } from "@earendil-works/pi-ai";
import type { AgentSessionEvent } from "./agent-session.ts";
/** One record of a session's internal structured lane: a session event or a block control, in session order. */
export type AgentSessionStructuredRecord = AgentSessionEvent | AssistantProgress;
type StructuredListener = (record: AgentSessionStructuredRecord) => void;
type StructuredFailure = (cause: unknown) => void;
export declare class StructuredLaneUnavailableError extends Error {
    constructor();
}
/**
 * The AgentSession end of the internal-only agent channel (senpi#4272, R3.C6.2). While a structured listener is
 * attached, it holds the channel's capture subscription; block controls enter the session's own event queue, so they
 * keep their position among the ordinary events. Extension listeners, `session.subscribe` and every legacy
 * destination never see a control.
 *
 * The capture subscription is module-wide (`subscribeAssistantCapture`): while it is held, every capture-enabled
 * provider stream in the process that first pushes afterwards builds capture records, including streams of sessions
 * with no structured listener, which drop them at their public iterator.
 */
export declare class StructuredSessionLane {
    #private;
    private readonly listeners;
    private releaseChannel;
    /** `own` binds a block control to the message open when it leaves the session queue (its emission point). */
    constructor(channel: InternalAgentChannel | undefined, enqueue: (deliver: () => void) => void, own?: (control: object) => void);
    get active(): boolean;
    /** Whether this session's Agent was built with the internal channel, so `subscribe` can succeed. */
    get available(): boolean;
    /** `failed` hears a record this lane could not build; that record is skipped, never the event's legacy delivery. */
    subscribe(listener: StructuredListener, failed?: StructuredFailure): () => void;
    /** Publishes a session event with the provider capture of its `source` agent event. */
    emitEvent(event: AgentSessionEvent, source: object): void;
    dispose(): void;
    private emit;
}
export {};
//# sourceMappingURL=structured-session-lane.d.ts.map