/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { type ThoughtSummary } from '../utils/thoughtUtils.js';
import type { PartListUnion, GenerateContentResponseUsageMetadata } from '@google/genai';
import type { AgentLoopContext } from '../config/agent-loop-context.js';
import type { HistoryTurn } from '../core/agentChatHistory.js';
import { type ToolCallRecord, type ConversationRecordExtra, type MessageRecord, type ConversationRecord, type ResumedSessionData, type LoadConversationOptions } from './chatRecordingTypes.js';
export * from './chatRecordingTypes.js';
/**
 * Returns true when a stored message represents conversation content worth
 * surfacing in resume flows.
 */
export declare function isResumableMessageRecord(message: MessageRecord): boolean;
export declare function hasResumableConversationContent(messages: readonly MessageRecord[]): boolean;
export declare function loadConversationRecord(filePath: string, options?: LoadConversationOptions): Promise<(ConversationRecord & {
    messageCount?: number;
    userMessageCount?: number;
    firstUserMessage?: string;
    hasResumableContent?: boolean;
    memoryScratchpadIsStale?: boolean;
}) | null>;
export declare class ChatRecordingService {
    private conversationFile;
    private cachedConversation;
    private sessionId;
    private projectHash;
    private kind?;
    private queuedThoughts;
    private queuedTokens;
    private context;
    constructor(context: AgentLoopContext);
    initialize(resumedSessionData?: ResumedSessionData, kind?: 'main' | 'subagent'): Promise<void>;
    private appendRecord;
    private updateMetadata;
    private pushMessage;
    private getLastMessage;
    private newMessage;
    recordMessage(message: {
        model: string | undefined;
        type: ConversationRecordExtra['type'];
        content: PartListUnion;
        displayContent?: PartListUnion;
        id?: string;
    }): string;
    /**
     * Records a synthetic message (e.g. Binary Received, Snapshot/Summary)
     * and returns its durable ID.
     */
    recordSyntheticMessage(type: ConversationRecordExtra['type'], content: PartListUnion, id?: string): string;
    recordThought(thought: ThoughtSummary): void;
    recordMessageTokens(respUsageMetadata: GenerateContentResponseUsageMetadata): void;
    recordToolCalls(model: string, toolCalls: ToolCallRecord[]): void;
    saveSummary(summary: string): void;
    recordDirectories(directories: readonly string[]): void;
    getConversation(): ConversationRecord | null;
    getConversationFilePath(): string | null;
    /**
     * Deletes a session file by sessionId, filename, or basename.
     * Derives an 8-character shortId to find and delete all associated files
     * (parent and subagents).
     *
     * @throws {Error} If shortId validation fails.
     */
    deleteSession(sessionIdOrBasename: string): Promise<void>;
    /**
     * Asynchronously deletes the current session's chat file and tool outputs.
     * This encapsulates the session ID logic and uses non-blocking I/O to avoid
     * blocking the event loop on exit.
     */
    deleteCurrentSessionAsync(): Promise<void>;
    /**
     * Deletes the current session only if it has no resumable conversation
     * content. This removes abandoned startup-only sessions while preserving any
     * session with a real user prompt, model response, or tool activity.
     */
    deleteCurrentSessionIfNotResumableAsync(): Promise<void>;
    /**
     * Rewinds the conversation to the state just before the specified message ID.
     * All messages from (and including) the specified ID onwards are removed.
     */
    rewindTo(messageId: string): ConversationRecord | null;
    updateMessagesFromHistory(history: readonly HistoryTurn[]): void;
}
