/**
 * Message State Store - 消息状态管理
 *
 * 这是消息管理的核心 store，负责管理所有聊天消息的状态
 * 包括：消息的增删改查、流式更新、批量导入导出等
 */
import { ChatMessage, PlanStep, Role, Status } from "../types";
import { paginationActions, paginationStore$ } from "./pagination-store";
type StoredMessage = Omit<ChatMessage, "abortController"> & {
    abortController?: undefined;
};
export declare const messageStore$: import("@legendapp/state").Observable<{
    loadedMessages: Record<string, StoredMessage>;
    messageOrder: string[];
}>;
export declare const messageComputed$: {
    currentMessages: () => StoredMessage[];
    shouldShowWelcome: () => boolean;
    messageStats: () => {
        total: number;
        byRole: {
            user: number;
            assistant: number;
            system: number;
        };
        byStatus: {
            pending: number;
            sending: number;
            streaming: number;
            completed: number;
            failed: number;
            cancelled: number;
        };
    };
    getMessage: (messageId: string) => {
        error?: {
            code?: string | undefined;
            message: string;
            retryable?: boolean | undefined;
            timestamp: string;
        } | undefined;
        id: string;
        metadata?: {
            [x: string]: unknown;
            executionTime?: number | undefined;
            model?: string | undefined;
            planSteps?: Array<{
                completed: boolean;
                description: string;
                id: string;
            }> | undefined;
            promptTokens?: number | undefined;
            referencedFiles?: string[] | undefined;
            responseTokens?: number | undefined;
            steps?: Array<{
                completed: boolean;
                description: string;
                id: string;
            }> | undefined;
            toolsUsed?: string[] | undefined;
        } | undefined;
        isStreaming?: boolean | undefined;
        attachments?: import("..").Attachment[] | undefined;
        childMessageIds?: string[] | undefined;
        contentSegments?: import("..").ContentSegment[] | undefined;
        contentType?: string | undefined;
        feedback?: {
            additionalComments?: string | undefined;
            ratedAt: string;
            rating: "positive" | "negative";
            reason?: string | undefined;
        } | undefined;
        height?: number | undefined;
        lastUpdatedBy?: string | undefined;
        maxRetries?: number | undefined;
        mentions?: import("..").Mention[] | undefined;
        parentMessageId?: string | undefined;
        ratedAt?: string | undefined;
        rating?: "positive" | "negative" | null | undefined;
        retry?: {
            currentRetry: number;
            lastAttempt?: string | undefined;
            maxRetries: number;
        } | undefined;
        retryCount?: number | undefined;
        segments?: import("..").ContentSegment[] | undefined;
        timestamp?: string | undefined;
        content: string;
        role: Role;
        status: Status;
        createdAt: string;
        updatedAt?: string | undefined;
        version: number;
        abortController?: undefined | undefined;
    };
    hasMessage: (messageId: string) => boolean;
    getMessagePlan: (messageId: string) => PlanStep[] | undefined;
    retryableMessages: () => string[];
};
export declare const messageActions: {
    addMessage: (message: Partial<ChatMessage> & {
        id: string;
    }) => string;
    addUserMessage: (content: string, attachments?: ChatMessage["attachments"]) => string;
    addAssistantMessage: (content: string) => string;
    updateMessage: (messageId: string, updates: Partial<ChatMessage>) => void;
    removeMessage: (messageId: string) => void;
    replaceMessage: (oldMessageId: string, newMessage: Partial<ChatMessage> & {
        id: string;
    }) => void;
    setMessages: (messages: ChatMessage[]) => void;
    appendMessages: (messages: ChatMessage[], position?: "start" | "end") => void;
    clearMessages: () => void;
    startStreamingMessage: (messageId: string) => void;
    stopStreamingMessage: (messageId: string) => void;
    /**
     * 更新流式消息内容，处理消息类型变化时的分离逻辑
     *
     * 重要功能：当消息类型发生变化时（如从文本变为代码块），
     * 会自动创建新消息来承载新类型的内容，确保不同类型的内容分离显示
     */
    updateStreamingMessage: (messageId: string, content: string, metadata?: {
        chunkType?: string;
        planSteps?: Array<{
            completed: boolean;
            description: string;
            id: string;
        }>;
    }) => {
        messageId: string;
        isNewMessage: boolean;
    };
    /**
     * 重试失败的消息
     * 将失败消息重置为 pending 状态，并增加重试计数
     */
    retryMessage: (messageId: string) => void;
    /**
     * 批量导入消息（用于历史记录加载等）
     *
     * @param messages - 要导入的消息数组
     * @param options.clearExisting - 是否清空现有消息
     * @param options.preserveOrder - 是否按时间戳保持顺序
     */
    importMessages: (messages: ChatMessage[], options?: {
        clearExisting?: boolean;
        preserveOrder?: boolean;
    }) => void;
    /**
     * 更新所有失败消息的状态
     * 可用于批量重试或取消失败消息
     */
    updateFailedMessages: (status: Status) => void;
    resetMessages: () => void;
    deleteMessage: (messageId: string) => void;
    cancelStreamingMessage: (messageId: string) => void;
    loadMessages: (messages: ChatMessage[], append?: boolean) => void;
};
export { paginationActions, paginationStore$ };
