import type { Message } from '@wrongstack/core/types'; import type { HistoryEntry } from './components/history/types.js'; export declare function contentBlocksText(content: unknown): string; /** * Convert restored session messages into TUI history entries so a resumed * session renders its prior conversation visually, not just in the LLM context. * * Order MUST match what the user saw before the crash — assistant text and * tool executions are interleaved chronologically. The data path makes this * straightforward: * * - `messages` carries user_input / llm_response / tool_result events in * JSONL order (see DefaultSessionStore.load). * - For assistant messages whose `content` is an array, tool_use blocks * appear in JSONL order. Each has a stable `id`. * - `toolCalls` is the JSONL-ordered list of `tool_call_end` events, each * carrying the same `id` as the tool_use block it resolves. * * Algorithm: * - System messages are skipped (not displayed). * - User messages → `kind: 'user'`. * - Assistant messages → `kind: 'assistant'` (text only; tool_use blocks * are dropped from the body since the tool entry renders the execution). * - After each assistant message, emit a `kind: 'tool'` entry for each * tool_use id that appears in that assistant's content, looking up the * matching tool_call_end by id. If the assistant has multiple tool_use * blocks, the tool entries appear in the same order as those blocks. * - Unmatched tool_call_ends (legacy / id drift) are appended at the end * in their original JSONL order so they aren't silently dropped. */ export declare function rehydrateHistory(messages: Message[], startId: number, toolCalls?: Array<{ name: string; id: string; durationMs: number; ok: boolean; outputBytes?: number | undefined; outputTokens?: number | undefined; outputLines?: number | undefined; }> | undefined): HistoryEntry[]; //# sourceMappingURL=rehydrate-history.d.ts.map