/**
 * antigravity-cli-transcript — Daemon-side built-in native history adapter for antigravity-cli.
 *
 * Antigravity CLI stores conversations in multiple complementary locations:
 *
 *   1. ~/.gemini/antigravity-cli/history.jsonl
 *      Lightweight index of user prompts, one row per turn:
 *        { conversationId: string, display: string, workspace: string, timestamp: number }
 *
 *   2. ~/.gemini/antigravity-cli/brain/<uuid>/.system_generated/logs/transcript*.jsonl
 *      Per-session full transcript, one row per agent step:
 *        { source: 'USER_EXPLICIT'|'MODEL', type: string, content: string, status: 'DONE'|..., created_at: number }
 *
 *   3. ~/.gemini/antigravity-cli/conversations/<uuid>.pb
 *      Legacy protobuf binary — schema not publicly documented. Adapter extracts
 *      printable UTF-8 text runs as best-effort content (no proto library needed).
 *
 *   4. ~/.gemini/antigravity-cli/conversations/<uuid>.db  ← current format
 *      Per-session SQLite database. Recent antigravity migrated conversation
 *      storage from .pb (+ brain/*.jsonl) to a per-session SQLite db. The
 *      schema is a trajectory of `steps`, NOT a simple messages(role,content)
 *      table:
 *        steps(idx INTEGER PK, step_type INTEGER, status INTEGER,
 *              step_payload BLOB [protobuf], ...)
 *      Each `step_payload` is a protobuf message. Empirically (introspected
 *      from real stores):
 *        - step_type 14 → a USER turn. The prompt text is the largest
 *          contiguous UTF-8 run inside the payload (field 19 subtree).
 *        - step_type 15 → a MODEL/assistant turn. The assistant's final
 *          natural-language answer lives at payload field 20 → field 1
 *          (identical to field 8). Field 20 → field 3 is the internal
 *          reasoning summary and is intentionally NOT surfaced.
 *        - other step types are tool calls / ephemeral system context.
 *      We read the blobs with a tiny dependency-free protobuf field walker
 *      (no proto schema / codegen needed) and map the two message step types.
 *      Because the daemon does NOT read this db, native history previously
 *      returned 0 rows for these sessions and read_chat fell back to the
 *      pty parser (which only echoes the user's own input) — assistant
 *      answers appeared lost even though they were on disk.
 *
 *      Schema-drift resilience: the exact field path (20 → 1/8 for the answer,
 *      19 → 2/3 for the prompt) is empirically verified against real stores, but
 *      antigravity may move it in a future build. So when the known path yields
 *      no text, instead of silently dropping the turn we fall back to a UTF-8
 *      printable-run scan of the payload (recoverMessageText) that recovers the
 *      answer/prompt even if the field number drifted — while explicitly
 *      EXCLUDING the reasoning subtree (20 → 3) so internal reasoning is never
 *      surfaced as the answer. Only when even that finds nothing beyond
 *      reasoning/metadata is the step dropped, and a content-free DEBUG
 *      breadcrumb is logged so a real drift is greppable rather than invisible.
 *
 * This adapter provides:
 *   - Full coverage from a per-session .db (current format) — preferred.
 *   - Full coverage when a brain transcript exists (legacy authoritative source).
 *   - Partial coverage (user prompts only) from history.jsonl as fallback.
 *   - Best-effort raw-string extraction from .pb files when no other source exists.
 *
 * watchPath (from provider.v1.json):
 *   ~/.gemini/antigravity-cli/history.jsonl
 *   ~/.gemini/antigravity-cli/brain/{uuid}/.system_generated/logs/transcript*.jsonl
 *   ~/.gemini/antigravity-cli/conversations/{uuid}.pb
 *   ~/.gemini/antigravity-cli/conversations/{uuid}.db
 *
 * OSS code (AGPL-3.0). Must not import from packages/ (proprietary).
 */
export type NativeHistoryRole = 'user' | 'assistant' | 'system';
export type NativeHistoryKind = 'standard' | 'tool' | 'session_start';
export interface NativeHistoryMessage {
    ts: string;
    receivedAt: number;
    role: NativeHistoryRole;
    content: string;
    kind: NativeHistoryKind;
    senderName?: string;
    agent: 'antigravity-cli';
    historySessionId: string;
    workspace?: string;
    /** Stable per-message identity (v2 contract). */
    providerUnitKey?: string;
}
export interface NativeHistorySession {
    messages: NativeHistoryMessage[];
    providerSessionId: string;
    source: 'provider-native';
    sourcePath: string;
    sourceMtimeMs: number;
    /**
     * 'full' — brain transcript was available and parsed.
     * 'partial' — only history.jsonl user-prompts are available.
     * 'best-effort' — .pb file bytes were used for raw text extraction.
     */
    nativeHistoryCoverage: 'full' | 'partial' | 'best-effort';
    workspace?: string;
    partialReason?: string;
}
export interface NativeHistorySessionMeta {
    historySessionId: string;
    sessionId: string;
    sourcePath: string;
    sourceMtimeMs: number;
    messageCount: number;
    firstMessageAt: number;
    lastMessageAt: number;
    sessionTitle?: string;
    preview?: string;
    workspace?: string;
    agent: 'antigravity-cli';
    source: 'provider-native';
    nativeHistoryCoverage: 'full' | 'partial' | 'best-effort';
    partialReason?: string;
}
/**
 * Read a single Antigravity CLI session by its source file path.
 *
 * `sessionPath` is the absolute path to one of:
 *   - A brain transcript JSONL: ~/.gemini/antigravity-cli/brain/<uuid>/.system_generated/logs/transcript*.jsonl
 *   - The shared history.jsonl: ~/.gemini/antigravity-cli/history.jsonl
 *   - A conversation SQLite db: ~/.gemini/antigravity-cli/conversations/<uuid>.db
 *   - A conversation protobuf: ~/.gemini/antigravity-cli/conversations/<uuid>.pb
 *
 * The session UUID is inferred from the directory name (brain), filename (pb), or
 * must be provided explicitly via `sessionId` for history.jsonl paths.
 *
 * Returns `null` when the file is missing, empty, or yields no parseable messages.
 */
export declare function readSession(sessionPath: string, sessionId?: string, workspace?: string): NativeHistorySession | null;
/**
 * List all Antigravity CLI sessions found across all watchPath locations.
 *
 * Priority:
 *   1. Brain transcript sessions (full coverage) — preferred source.
 *   2. History JSONL entries without a brain transcript (partial coverage).
 *   3. .pb conversation files without any other source (best-effort).
 *
 * Returns summary metadata sorted by most recently updated first.
 */
export declare function listSessions(_watchPath: string): Promise<NativeHistorySessionMeta[]>;
