/** One frame's decode outcome. */ export interface FrameDecodeResult { /** Concatenated UTF-8 text of every frame that decoded. */ text: string; /** Total frames found in the stream. */ frames: number; /** Frames that failed to decode, normally only a truncated tail. */ failed: number; } /** * Split a zstd stream into its concatenated frames. * * The scan is a magic-number search rather than a real parser: frame headers * carry no length, and a full parse would mean reimplementing zstd. A magic * sequence occurring inside compressed payload is possible in principle; in * that case the bogus split yields one extra undecodable frame, which is * counted in `failed` and does not affect the frames around it. * @param buffer - The complete file contents. * @returns One buffer per frame, in stream order. */ export declare function splitZstdFrames(buffer: Buffer): Buffer[]; /** * Decode an in-memory zstd session stream into text. * @param buffer - The complete file contents. * @returns The decoded text plus frame statistics. */ export declare function decodeSessionBuffer(buffer: Buffer): FrameDecodeResult; /** * Decode a session log file from disk. * @param file - Absolute path to a `session.v*.jsonl.zstd` file. * @returns The decoded text plus frame statistics. */ export declare function decodeSessionFile(file: string): FrameDecodeResult; /** * A parsed session-log line, before narrowing. * * Most events carry their payload under `data`, but the first `session` header * does NOT: it puts `id`, `createdAt`, `cwd`, and `agentPreset` directly on the * event. Reading `header.data.cwd` therefore yields `undefined` for every * session, which is exactly the bug that made the panel report the working * directory as `(unknown)`. The index signature keeps both shapes reachable. */ export interface RawLogEvent { /** Durable event type, for example `assistant/message`. */ type?: string; /** Monotonic sequence number within the log. */ seq?: number; /** Epoch milliseconds the harness stamped on the event. */ time?: number; /** Event payload; shape depends on `type`. */ data?: Record; /** Header fields (`id`, `cwd`, `createdAt`, `agentPreset`) live here. */ [key: string]: unknown; } /** * Parse decoded log text into events, skipping undecodable lines. * * A live session's final line can be a partially flushed JSON object, so parse * failures are counted rather than thrown. * @param text - Decoded newline-delimited JSON. * @returns The events and the number of lines that failed to parse. */ export declare function parseLogEvents(text: string): { events: RawLogEvent[]; malformed: number; };