import type { AppErrorPayload } from "@kenkaiiii/gg-engine/internal/app-error.js"; import type { ToolDetail } from "@kenkaiiii/gg-engine/internal/core/session-export.js"; import type { PrAnswer, PrCardData } from "@kenkaiiii/gg-protocol"; export interface HistoryEntryForWire { role: "user" | "assistant"; text: string; /** Epoch ms the message was recorded (user and assistant text rows only). */ at?: number; images?: string[]; /** Attached files and videos, by name (images ride `images`). */ attachments?: Array<{ kind: "file" | "video"; name: string; }>; hook?: "ideal" | "loop_break" | "regrounding" | null; command?: boolean; compacted?: boolean; /** Persisted counts for a compacted row's "N → M messages" summary. */ compactionCounts?: { originalCount: number; newCount: number; }; /** True when this entry is a Ken Kai (mentor) turn: a `user` row is the `@Ken` * question, an `assistant` row is Ken's reply. The webview renders these in * Ken's color (user bubble tinted; assistant as a Ken bubble). */ ken?: boolean; /** Present when this entry is a persisted autopilot verdict marker (an * `assistant` row with empty `text`). The webview renders it exactly like * the live `autopilot` item — never the raw verdict keyword the model * actually replied with (e.g. `ALL_CLEAR`). */ autopilot?: { phase: "prompted" | "done" | "human" | "capped" | "plan_approved"; reason?: string; body?: string; /** Stable seed derived from persisted marker data for deterministic all-clear copy. */ copySeed?: string; }; /** True when this user prompt came from a Ken "Send to GG Coder" button — * the webview renders the shimmering label instead of the prompt body. */ kenSent?: boolean; /** Enhancer highlight segments for this user prompt (unedited enhanced sends). */ enhancements?: unknown[]; /** Plan-mode entry banner (ASCII logo + reason), persisted at plan_enter. */ plan?: { reason: string; }; /** Task header row (task title), persisted at task_start. */ task?: { title: string; }; /** Error row (headline/message/guidance), persisted by broadcastError. * `scope` selects the live prefix (ken_error → "Ken: ", autopilot_error → * "Autopilot: "). */ error?: AppErrorPayload; /** Webview-copy info row marker (e.g. the video-capability warning). */ infoKind?: "video_warning"; /** Safety-block chat row (persisted `security` app marker). */ security?: { rule: string; target: string; }; /** A command the user ran themselves (persisted `shell` app marker). */ shell?: { runId: string; command: string; cwd: string; exitCode: number | null; durationMs: number; cancelled: boolean; output: string; truncated: boolean; error?: string; }; /** Where the conversation reopened for its branch (persisted `checkout` marker). */ checkoutNotice?: string; /** The user stopped the run here (persisted `run_stopped` marker). */ stopped?: { source: string | null; }; /** A PR card, at the place the live card went (persisted `pr_card` marker). */ prCard?: PrCardData; /** On a user row: the PR card this message answered (persisted `user_hint`). */ prAnswer?: PrAnswer; toolImages?: Array<{ src: string; path?: string; }>; subagentGroup?: Array<{ agentName?: string; status: "done" | "error"; toolUseCount: number; }>; } /** * Detect whether a restored user message is actually an injected self-correction * hook prompt, by its distinctive opening phrase. Returns the hook kind so the * webview can render the short notice line instead of the full prompt body. */ /** `?tools=` on /export. Anything unrecognised (including absent) falls back to * the human-facing `summary` default rather than dumping every payload. */ export declare function parseToolDetail(value: string | null): ToolDetail; export declare function detectHookKind(text: string): "ideal" | "loop_break" | "regrounding" | null;