import type { AgentTodo, ChatMessage, HistoryMessage } from './types.js';
export declare function compareUserText(text: string): string;
export declare function userTextsEquivalent(ta: string, tb: string): boolean;
export declare function userMessagesEquivalent(a: ChatMessage, b: ChatMessage): boolean;
/**
 * JSONL `flatIndex` = file line number (~1..N); Cursor DOM = `data-flat-index` (often 1000+).
 * When DOM is ahead of the archive tail, fuzzy cover hid live rows (debug: NEEDS_DOM_OVERLAY, overlay 0).
 */
export declare const JSONL_DOM_ORDER_GAP = 32;
export declare function maxArchiveOrderKey(archive: ChatMessage[]): number;
export declare function isDomOrderAheadOfJsonlArchive(overlay: ChatMessage, maxArchiveKey: number): boolean;
/** Exact / near-exact match only — no word-bag (safe when DOM timeline > JSONL tail). */
export declare function archiveCoversOverlayStrict(archive: ChatMessage, overlay: ChatMessage): boolean;
/**
 * Viewport rows for the live tail: not yet represented in JSONL archive.
 * Uses `archiveCoversOverlay` (strict / fuzzy / streaming) — same rule for idle and generating.
 */
export declare function selectDomOverlayFromViewport(viewport: ChatMessage[], archive: ChatMessage[]): ChatMessage[];
/** JSONL archive covers a DOM overlay row (DOM may be a truncated viewport). */
export declare function archiveCoversOverlay(archive: ChatMessage, overlay: ChatMessage, opts?: {
    maxArchiveKey?: number;
}): boolean;
/** Apply live composer todo statuses to archived CreatePlan cards (JSONL has no status). */
export declare function enrichPlanBlocksFromTodos(messages: ChatMessage[], liveTodos: AgentTodo[]): ChatMessage[];
export declare function messagesEquivalent(a: ChatMessage, b: ChatMessage): boolean;
export declare function pickPreferredMessage(prev: ChatMessage, next: ChatMessage, preferNext: boolean): ChatMessage;
export declare function messageOrderKey(m: ChatMessage): number;
/** DOM flat-index vs JSONL line ts — see app `anchorDomOverlaySortKeys`. */
export declare function anchorDomOverlaySortKeys(history: ChatMessage[], live: ChatMessage[]): ChatMessage[];
export declare function sortMessagesChronologically(messages: ChatMessage[]): ChatMessage[];
/** JSONL+DOM compose order — do not re-sort by flatIndex before dedupe. */
export declare function dedupeUsersInComposeOrder(messages: ChatMessage[]): ChatMessage[];
export declare function prepareChatMessagesForDisplay(messages: ChatMessage[]): ChatMessage[];
export declare function mergeHistoryTail(prev: ChatMessage[], incoming: ChatMessage[]): ChatMessage[];
/** Document order inside one DOM extract — never Cursor viewport flatIndex alone. */
export declare function sortByDomDocumentOrder(messages: ChatMessage[]): ChatMessage[];
/** Force overlay keys above archive so any sort by flatIndex stays below JSONL tail. */
export declare function stampOverlayAfterArchive(archiveFloor: number, overlay: ChatMessage[]): ChatMessage[];
export declare function archiveOrderFloor(jsonlHistory: ChatMessage[], rawJsonlRows: number): number;
/** Dedupe/collapse overlay only; order = domSeq (then stamped flatIndex). */
export declare function prepareDomOverlayForDisplay(overlay: ChatMessage[]): ChatMessage[];
/**
 * Lenta for app: JSONL archive first, DOM overlay append-only.
 * Order = array order here; app must not re-sort by flatIndex across the join.
 */
export declare function composeDisplayLenta(jsonlHistory: ChatMessage[], domOverlay: ChatMessage[], liveTodos?: AgentTodo[]): ChatMessage[];
/** Dev: warn if composed lenta inverts archive keys. */
export declare function assertMonotonicLenta(messages: ChatMessage[], label: string): void;
/** @deprecated Use `composeDisplayLenta` — kept for tests/tools. */
export declare function mergeDomWithHistory(history: ChatMessage[], live: ChatMessage[]): ChatMessage[];
export declare function historyRowsToChat(rows: HistoryMessage[]): ChatMessage[];
export declare function filterClientDisplayList(messages: ChatMessage[]): ChatMessage[];
export declare function userMessageCoversExisting(existing: ChatMessage, sentText: string): boolean;
