import type { ContentPart, TextContent, ToolCall } from "@kenkaiiii/gg-ai"; /** * Primitives shared by every foreign-transcript parser (Claude Code, Codex, * Cursor): content-block normalization, tool-call extraction and timestamps. * * The formats differ in their envelopes but agree on the substance — text, * thinking, tool calls and tool results — so the per-format parsers stay thin * and the risky normalization lives in exactly one place. */ /** Loose JSON object guard; foreign records are untrusted input. */ export declare function isRecord(value: unknown): value is Record; export declare function asString(value: unknown): string | undefined; /** Parse one JSONL line, returning undefined for blank or malformed lines. */ export declare function parseJsonLine(line: string): Record | undefined; /** * Normalize a record's timestamp to epoch millis. Foreign formats use ISO * strings (Claude, Codex) or numeric epochs in seconds or millis (Cursor). * Returns undefined rather than guessing when the value is unusable. */ export declare function normalizeTimestamp(value: unknown): number | undefined; /** Collapse a text block list into one string, dropping empties. */ export declare function joinText(parts: readonly string[]): string; export declare function textPart(text: string): TextContent; /** * Build a tool-call part from a foreign record. `args` may arrive as an object * (Claude `input`) or a JSON string (Codex `arguments`); an unparseable string * is preserved verbatim under `raw` rather than dropped, so a resumed thread * still shows what was attempted. */ export declare function toolCallPart(id: string, name: string, args: unknown): ToolCall; export declare function normalizeToolArgs(args: unknown): Record; /** * Flatten a foreign tool result into plain text. Import is lossy by design: we * never fabricate structure we did not read, so anything that is not text * becomes a short placeholder instead of an invented block. */ export declare function toolResultText(content: unknown): string; /** Drop empty text parts so an import never produces a blank message. */ export declare function compactParts(parts: ContentPart[]): ContentPart[]; /** * Extract the real prompt from a Cursor user message. * * Cursor wraps the typed prompt in `` and prepends context blocks * (``, ``, …). Importing the raw string leaks that * scaffolding into the session preview and title. We take the trailing * `` only when everything before it is recognized context; * otherwise the message is returned unchanged, because unknown leading context * may be part of what the user actually said. */ export declare function extractCursorUserQuery(raw: string): string; //# sourceMappingURL=foreign-transcript-blocks.d.ts.map