/**
 * SDK transcript loading, segmentation, prior context extraction,
 * and cycle matching.
 */
import type { SDKMessage, SDKSessionTurn, TrajectoryEntry, PriorContext } from "./types.js";
import { type ArchiveEntry, type ImageCache, type RecoveryStats } from "./image-recovery.js";
/**
 * Normalize a raw JSONL line from Claude SDK or Pi Coding Agent transcripts
 * into the SDKMessage shape expected by segmentation and conversion.
 */
export declare function normalizeTranscriptLine(parsed: Record<string, unknown>): SDKMessage | null;
export interface PerSessionTranscript {
    sessionId: string;
    messages: SDKMessage[];
}
/**
 * Load SDK transcripts grouped by session ID.  Each entry represents one
 * session's messages in chronological order.
 */
export declare function loadSdkTranscripts(transcriptDir: string, sessionIds?: string[]): Promise<PerSessionTranscript[]>;
/**
 * Segment a single session's messages into session turns.
 * Each turn starts at a [Wake Event] or [Session Switch] user message
 * and extends until the next such boundary (or end of messages).
 */
export declare function segmentSdkSessionTurns(sessionId: string, messages: SDKMessage[]): SDKSessionTurn[];
export declare function buildPriorContext(turn: SDKSessionTurn, sidecarIndex: Map<string, ArchiveEntry> | null, stats: RecoveryStats, cache?: ImageCache): Promise<PriorContext | null>;
export declare function convertSdkMessages(messages: SDKMessage[], sidecarIndex?: Map<string, ArchiveEntry> | null, stats?: RecoveryStats, cache?: ImageCache): Promise<TrajectoryEntry[]>;
export declare function buildSdkTrajectory(turn: SDKSessionTurn, sidecarIndex?: Map<string, ArchiveEntry> | null, stats?: RecoveryStats, cache?: ImageCache): Promise<TrajectoryEntry[]>;
/**
 * Build a per-session index: (sessionId, utcTimestamp) → SDKSessionTurn.
 * Also keeps a flat per-session list for fuzzy matching.
 */
export interface SdkTurnIndex {
    exact: Map<string, SDKSessionTurn>;
    bySession: Map<string, SDKSessionTurn[]>;
    /** Wake-event turns across all sessions (for Pi engine session-id mismatch). */
    wakeTurns: SDKSessionTurn[];
}
export declare function buildSdkTurnIndex(allTurns: SDKSessionTurn[]): SdkTurnIndex;
export interface MatchSdkTurnOptions {
    /**
     * Pi/GPT only: when session-scoped match fails, match by wake/init time
     * across all sessions (log session UUID may differ from transcript filename).
     */
    crossSessionWakeFallback?: boolean;
    /** Prefer wake log timestamp for cross-session fallback (defaults to logTimestamp). */
    wakeTimestamp?: string;
    maxCrossSessionDeltaMs?: number;
}
export declare function matchSdkTurn(logTimestamp: string, sessionId: string, index: SdkTurnIndex, options?: MatchSdkTurnOptions): SDKSessionTurn | undefined;
/**
 * Match a log wake cycle to any SDK/Pi transcript turn by timestamp alone.
 * Used when Pi logs reference a different session UUID than the transcript file.
 */
export declare function matchSdkTurnByWakeTime(logTimestamp: string, index: SdkTurnIndex, maxDeltaMs?: number): SDKSessionTurn | undefined;
//# sourceMappingURL=sdk-transcript.d.ts.map