import type { ParsedMessage } from "shared/types/index.js";
/** Loose typing of the on-disk state.json — only the fields we read. */
interface RawState {
    id?: string;
    messages?: unknown[];
    previousResponseId?: string;
    createdAt?: number;
    updatedAt?: number;
}
/**
 * Read an OR session directory and project it into ParsedMessage[]. This is
 * the function the SessionProvider should call — `parseOpenRouterState`
 * below is the lower-level primitive that ignores request.json files and
 * is kept for tests + post-compaction sessions where state.messages becomes
 * self-contained.
 */
export declare function readOpenRouterSession(sessionDir: string): ParsedMessage[];
/**
 * Read state.json (if present) and translate its messages into
 * ParsedMessage[]. Returns [] for sessions with no state on disk
 * (in-memory runs, or sessions that errored before the first save).
 *
 * `timestamps` is an optional ordered list of ISO timestamps from each
 * request.json in the session directory; the parser interleaves them onto
 * user / first-assistant messages as a best-effort decoration. When omitted,
 * messages carry no per-row timestamp (matches the Claude provider's
 * behavior for sessions whose JSONL entries lack `timestamp`).
 */
export declare function parseOpenRouterState(state: RawState, timestamps?: string[]): ParsedMessage[];
/**
 * Best-effort extraction of a displayable string from the various content
 * shapes the OR/OpenAI schema permits:
 *  - plain string → as-is
 *  - array of blocks → concatenate text-bearing blocks
 *  - object with `.text` → that text
 * Anything else falls through to JSON.stringify (or empty string for null).
 */
export declare function extractTextContent(content: unknown): string;
/**
 * Walk `<sessionDir>/req_*` directories in chronological order (by mtime
 * since OR's request IDs are random ULIDs, not sortable) and collect their
 * recorded ISO timestamps. Used by parseOpenRouterState to decorate user
 * messages with when the request was issued.
 */
export declare function readRequestTimestamps(sessionDir: string): string[];
/**
 * Read and parse a session's state.json. Returns `null` when the file is
 * missing (in-memory session, or session created but never persisted).
 */
export declare function readStateJson(sessionDir: string): RawState | null;
/**
 * Read and return the first user prompt for this session — pulled from the
 * earliest `req_<id>/request.json`. Used for the chat-list preview.
 */
export declare function readFirstUserPrompt(sessionDir: string): string | null;
export {};
//# sourceMappingURL=sessionParser.d.ts.map