import type { Message } from "@kenkaiiii/gg-ai"; /** * Markdown transcript export. * * Renders a session's persisted messages into a single self-contained `.md` * file a human can read, paste into a PR, or hand to a teammate. Deliberately * NOT built on the webview's `Item[]`: the app keeps tool activity in the * pinned LiveToolPanel and never in the transcript, so serializing from there * would export a chat with the actual work missing. * * Bubble text goes through the SAME `restoreUserRow` / `restoreAssistantTexts` * helpers the `/history` resume path uses, so what lands in the file matches * what the user saw on screen (steering wrappers, attachment notes and * autopilot preambles stripped) rather than the raw provider payload. */ /** Hard cap on a single tool result's rendered text. Sessions already cap * persisted tool text at 40k chars; an export is for reading, so it gets a * much tighter budget — enough to see what happened, not a data dump. */ export declare const MAX_TOOL_RESULT_CHARS = 1500; /** Hard cap on a single tool call's rendered arguments. */ export declare const MAX_TOOL_ARGS_CHARS = 800; export interface SessionExportMeta { /** Workspace mode this session ran in — picks the filename + title wording. */ mode: "chat" | "code"; cwd: string; provider: string; model: string; /** Session id (a short prefix is shown in the header). */ sessionId?: string; /** Export timestamp. Defaults to now. */ date?: Date; } /** * How much of the agent's tool work to render. * * - `summary` (default) — one dim line per burst of tool calls, naming what ran * (`read src/a.ts`, `bash pnpm build`). Keeps the narrative of what the agent * did without the payloads. A real 1,346-message session is 708KB at `full` * and 71KB here — the same story, minus the 90% no human was going to read. * - `none` — pure conversation, nothing but the two voices. * - `full` — collapsed `
` with arguments and (truncated) results. For * debugging and bug reports, not for sharing. */ export type ToolDetail = "none" | "summary" | "full"; export interface SessionExportOptions { /** How much tool work to render. Default `summary`. */ toolDetail?: ToolDetail; /** Render the model's reasoning blocks. Default false — thinking is scratch * work, and a shared transcript is better without it. */ includeThinking?: boolean; } /** `2026-07-26-1402` — local time, sortable, and unique enough that two * exports in the same day don't silently collide in the save dialog. */ export declare function exportTimestamp(date: Date): string; /** * Default filename offered in the native save dialog, e.g. * `your-chat-2026-07-26-1402.md`. Coding sessions say `session` instead of * `chat` so a folder of exports stays self-describing. */ export declare function defaultExportFilename(mode: "chat" | "code", date?: Date): string; /** One-line summary of a tool call for the `
` summary row: the tool * name plus its most identifying argument (path, command, pattern, …). */ export declare function toolSummary(name: string, args: Record): string; /** * Render a tool call's arguments, or null when there's nothing worth showing. * * A lone string argument (the overwhelmingly common shape — `bash`'s command, a * `web_fetch` url) is rendered raw in a fence: `JSON.stringify` would turn a * shell one-liner into unreadable `\"` / `\n` soup. It's dropped entirely when * the summary row already showed that exact value in full, so short calls don't * say the same thing twice. Everything else falls back to pretty JSON. */ export declare function renderToolArgs(args: Record): string | null; /** * One dim line standing in for a burst of tool calls, e.g. * `_🔧 read src/a.ts · bash pnpm build · edit App.tsx · +4 more_`. * * Entries are deduped so an agent that reads the same file three times says it * once, and capped so a 40-tool burst doesn't become a wall. Failures are still * called out — a reader skimming for what went wrong shouldn't have to re-export * at `full` to discover that something did. */ export declare function renderToolSummaryLine(calls: readonly { name: string; args: Record; failed: boolean; }[]): string | null; /** * Render a session's messages as Markdown. * * System messages are always dropped (the system prompt is ours, not the * user's, and shipping it in a shared file leaks internals). Compaction * summaries and self-correction hook prompts are machine-facing injections — * they render as a quiet italic marker instead of a user bubble, exactly like * the app shows them. */ export declare function sessionToMarkdown(meta: SessionExportMeta, messages: readonly Message[], options?: SessionExportOptions): string; //# sourceMappingURL=session-export.d.ts.map