/**
 * Response-stream chat display state.
 *
 * Ink's <Static> component is append-only, so live LLM draft text cannot be
 * rendered there without printing every update as a new transcript row. These
 * helpers keep in-flight response streams in a dynamic active block, then
 * remove or commit them into the append-only transcript once terminal events
 * and final-message dedupe decide their durable fate.
 */
import type { DisplayMessage } from './display-message.js';
import type { ResponseStreamResumeState } from './session-resume.js';
export interface SplitResponseStreamDisplayMessages {
    transcriptMessages: DisplayMessage[];
    dynamicMessages: DisplayMessage[];
    activeMessages: DisplayMessage[];
}
export interface ClearResponseStreamResult {
    removedKeys: Set<string>;
    detachedKeys: Set<string>;
}
export interface ActiveResponseStreamUpdate {
    dynamicMessages: DisplayMessage[];
    affectedMessages: DisplayMessage[];
}
export declare function splitResponseStreamDisplayMessages(displayMessages: DisplayMessage[], responseStreamState: ResponseStreamResumeState | null | undefined): SplitResponseStreamDisplayMessages;
/** Build the mutable active-draft lookup used by the live chat renderer. */
export declare function createActiveResponseStreamMessageMap(messages: DisplayMessage[]): Map<string, DisplayMessage>;
/** Replace or insert a live draft in the repaintable chronological tail. */
export declare function upsertDynamicResponseStreamMessage(dynamicMessages: DisplayMessage[], activeMessagesByKey: Map<string, DisplayMessage>, message: DisplayMessage): DisplayMessage[];
/** Remove live drafts without keeping them in the visible chronological tail. */
export declare function removeDynamicResponseStreamMessages(dynamicMessages: DisplayMessage[], activeMessagesByKey: Map<string, DisplayMessage>, keys: Set<string>): ActiveResponseStreamUpdate;
/** Stop repainting live drafts while keeping their current row in chronological order. */
export declare function commitDynamicResponseStreamMessages(dynamicMessages: DisplayMessage[], activeMessagesByKey: Map<string, DisplayMessage>, keys: Set<string>): {
    dynamicMessages: DisplayMessage[];
    committedMessages: DisplayMessage[];
    affectedMessages: DisplayMessage[];
};
/** Append the repaintable chronological tail to the append-only transcript. */
export declare function flushDynamicMessagesIntoTranscript(transcriptMessages: DisplayMessage[], dynamicMessages: DisplayMessage[]): DisplayMessage[];
/** Drop an aborted stream from all tracking maps and return its display key. */
export declare function abortTrackedResponseStream(state: ResponseStreamResumeState, streamId: string, taskId: string | undefined): Set<string>;
/** Clear tracked streams after a durable final message or error arrives. */
export declare function clearTrackedResponseStreamsForTask(state: ResponseStreamResumeState, taskId: string | undefined, options?: {
    preserveContinued?: boolean;
    finalText?: string;
}): ClearResponseStreamResult;
/** Clear tracked terminal streams after root runtime completion. */
export declare function commitTerminalTrackedResponseStreamsForTask(state: ResponseStreamResumeState, taskId: string | undefined): Set<string>;
/** Commit terminal tracked streams for every task, leaving active streams live. */
export declare function commitAllTerminalTrackedResponseStreams(state: ResponseStreamResumeState): Set<string>;
//# sourceMappingURL=response-stream-display-state.d.ts.map