import type { SessionReader } from "../session-reader.js"; export type HistoryItem = { seq: number; windowId: string; role: "user" | "assistant" | "tool_call" | "tool" | "system" | "developer"; content: string; createdAt: string | undefined; toolName?: string; /** Internal pairing key; never serialized. */ toolCallId?: string; /** Arguments for a standalone bash execution, already serialized as JSON. */ toolArgs?: string; outputTruncated?: boolean; fullOutputPath?: string; toolError?: boolean; }; export type HistoryRole = "user" | "assistant" | "tool" | "context"; export type HistoryEvent = { seq: number; windowId: string; role: HistoryRole; content: string; createdAt: string | undefined; tool?: string; toolError?: boolean; outputTruncated?: boolean; fullOutputPath?: string; }; export type HistoryWindow = { windowId: string; createdAt?: string; items: HistoryEvent[]; }; export type HistoryProjection = { windows: HistoryWindow[]; highestSeq: number; branchSeqs: Set; resultAliases: Map; }; export type HistoryFilter = { window_id?: string | null; roles?: HistoryRole[] | null; }; export declare function contentText(content: unknown): string; /** Build stable internal addresses, then project the active branch into public events. */ export declare function historyFromSession(ctx: SessionReader): HistoryProjection; export declare function visibleItem(item: HistoryEvent, maxChars?: number): { truncated: boolean; total_chars: number; content: string; tool_error?: boolean | undefined; output_truncated?: boolean | undefined; full_output_path?: string | null | undefined; tool?: string | undefined; seq: number; window_id: string; role: HistoryRole; created_at: string | null; }; export declare function allItems(projection: HistoryProjection): HistoryEvent[]; export declare function unknownWindowId(projection: HistoryProjection, params: HistoryFilter): { message: string; known: string[]; } | undefined; /** Default list is a conversation; explicit roles and search show the requested events. */ export declare function filteredItems(projection: HistoryProjection, params: HistoryFilter, mode: "list" | "search"): HistoryEvent[];