import { type AiChangeInfoPush, type AiMessagePush, type AiChatMessage, type AiChatSummary, type Attachment } from "@superblocksteam/library-shared/types";
import { type Logger } from "../../util/logger.js";
import type { AutoConnectingRpcClient } from "../../server-rpc/index.js";
import type { AiWorkflowEvent } from "@superblocksteam/shared";
export type AiChatItem = AiChatMessage | AiChatSummary;
export type AiChatSummaryWithOutcome = AiChatSummary & {
    outcome: "accepted" | "rejected" | "unknown";
};
export declare function isAiChatMessage(item: AiChatItem): item is AiChatMessage;
export declare function isAiChatSummary(item: AiChatItem): item is AiChatSummary;
/**
 * Default maximum number of messages to load from the server.
 * This prevents large requests from failing when there are many messages.
 */
export declare const DEFAULT_MESSAGE_LIMIT = 3000;
interface ChatSessionStoreConfig {
    applicationId: string;
    rpcClient: AutoConnectingRpcClient;
    logger: Logger;
    /**
     * Maximum number of messages to load from the server.
     * Defaults to DEFAULT_MESSAGE_LIMIT (1000).
     */
    messageLimit?: number;
}
export declare class ChatSessionStore {
    private applicationId;
    private rpcClient;
    private logger;
    private messages;
    private inFlightLoadFromServer;
    private loadedFromServer;
    private inProgressMessages;
    private messageLimit;
    constructor(config: ChatSessionStoreConfig);
    /***
     * Validates and sanitizes the attachments array
     * @param attachments - The attachments array to validate
     * @returns A tuple containing:
     *   - a boolean indicating if the attachments are valid
     *   - the sanitized attachments array
     */
    private validateAttachments;
    private validateChatMessageV1;
    private validateChatSummaryV1;
    private validateChatItemV1;
    private ensureLoadedFromServer;
    getLastUserMessage(): AiChatMessage | undefined;
    getMessages(options?: {
        force?: boolean;
    }): Promise<AiChatMessage[]>;
    /**
     * Get the most recent commitId from draftCommitted or commitRestored messages.
     * Waits for messages to load from server first.
     * Returns undefined if no commits found.
     */
    getLatestCommitId(): Promise<string | undefined>;
    newChat(): Promise<void>;
    truncateAfterTimestamp(sinceTimestamp: number): Promise<void>;
    recordUser(text: string, options?: {
        attachments?: Array<Attachment>;
    }): Promise<string>;
    recordUserAcceptance(): Promise<string>;
    recordUserRejection(): Promise<string>;
    recordUserResponse(text: string, responseType: "multi_choice_response" | "confirm_response" | "plan_response", metadata: {
        responseToMessageId: string;
        selectedChoiceIndices?: number[];
        enableTesting?: boolean;
        approved?: boolean;
    }): Promise<string>;
    recordInProgressMessage(payload: {
        id: string;
        text: string;
        type: "text" | "reasoning";
    }): void;
    commitMessage(id: string, type: "text" | "reasoning", group?: string): Promise<void>;
    recordAssistant(payload: AiMessagePush): Promise<void>;
    recordAssistantChangeInfo(payload: AiChangeInfoPush): Promise<void>;
    private appendMessage;
    submitWorkflowSummary(summary: AiWorkflowEvent): Promise<void>;
    private determineSummaryOutcome;
    recordSummary(summaryData: {
        summary: string;
        relevantFilePaths: string[];
        goals: string[];
        decisions: string[];
        adviceToAgents: string;
    }): Promise<void>;
    getSummaries(): Promise<AiChatSummary[]>;
    getLatestSummary(): Promise<AiChatSummaryWithOutcome | undefined>;
    getLatestSummaries(count: number): Promise<AiChatSummaryWithOutcome[]>;
    /**
     * Invalidate the loaded cache to force a fresh reload from the server
     * Used when checkpoint is restored to ensure ineligible summaries are filtered out
     */
    invalidateCache(): void;
}
export {};
//# sourceMappingURL=chat-session-store.d.ts.map