import { type Ref } from 'vue';
import { MessageRole } from '@blueking/chat-helper';
import type { ChatBusinessConfig, IEventEmitter, SendMessageOptions } from './types';
import type { IAgentModule, IMessage, IMessageModule, ISessionModule, IUserMessage } from '@blueking/chat-helper';
/**
 * 聊天业务管理器
 *
 * 职责：
 * - 封装聊天流程
 * - 处理引用文本、欢迎语等小鲸特有逻辑
 * - 管理聊天状态
 * - 处理消息发送后的副作用（如自动重命名）
 * - 不管理数据，只编排业务流程
 */
export declare class ChatBusinessManager {
    private _isGenerating;
    private _isStopLoading;
    private agentModule;
    private config;
    private eventEmitter;
    private messageModule;
    private sessionModule;
    /**
     * 自动重命名会话（当第一条消息发送成功后）
     * @param sessionCode 会话编码
     */
    private autoRenameSessionIfNeeded;
    /**
     * 发射事件（内部方法）
     */
    private emit;
    constructor(agentModule: IAgentModule, messageModule: IMessageModule, sessionModule?: ISessionModule | null, eventEmitter?: IEventEmitter | null, config?: ChatBusinessConfig);
    /**
     * 是否正在生成
     */
    get isGenerating(): Ref<boolean, boolean>;
    /**
     * 停止生成接口是否正在调用中
     */
    get isStopLoading(): Ref<boolean, boolean>;
    get isMessagesLoading(): Ref<boolean, boolean>;
    /**
     * 暴露消息列表
     */
    get messages(): Ref<({
        activityType: import("@blueking/chat-helper").ActivityType;
        content: {
            nodes: Record<string, import("@blueking/chat-helper").IFlowAgentNode>;
            task_id: number;
            task_name: string;
            task_outputs: string[];
            task_state: import("@blueking/chat-helper").FlowTaskState;
        } | {
            content: string;
            referenceDocument: {
                name: string;
                originFileUrl?: string;
                url: string;
            }[];
        } | {
            name: string;
            originFileUrl?: string;
            url: string;
        }[];
        role: MessageRole.Activity;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content?: string;
        property?: {
            [x: string]: unknown;
            extra?: {
                [x: string]: unknown;
                cite?: string | {
                    data: {
                        key: string;
                        value: string;
                    }[];
                    title: string;
                    type: string;
                };
                command?: string;
                context?: Array<Record<string, unknown>>;
                resources?: Array<Record<string, unknown>>;
            };
        };
        role: MessageRole.Assistant;
        toolCalls?: {
            function: {
                arguments: string;
                description?: string;
                mcpName?: string;
                name: string;
            };
            id: string;
            type: import("@blueking/chat-helper").MessageType.Function;
        }[];
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Developer;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Guide;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.HiddenAssistant;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.HiddenGuide;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Hidden;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.HiddenSystem;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.HiddenUser;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Info;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Pause;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Placeholder;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string[];
        duration?: number;
        role: MessageRole.Reasoning;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.System;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.TemplateAssistant;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.TemplateGuide;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.TemplateHidden;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.TemplateSystem;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.TemplateUser;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        duration?: number;
        error?: string;
        role: MessageRole.Tool;
        toolCallId: string;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string | ({
            data?: string;
            filename?: string;
            id?: string;
            mimeType: string;
            type: import("@blueking/chat-helper").MessageType.Binary;
            url?: string;
        } | {
            text: string;
            type: import("@blueking/chat-helper").MessageType.Text;
        })[];
        property?: {
            [x: string]: unknown;
            extra?: {
                [x: string]: unknown;
                cite?: string | {
                    data: {
                        key: string;
                        value: string;
                    }[];
                    title: string;
                    type: string;
                };
                command?: string;
                context?: Array<Record<string, unknown>>;
                resources?: Array<Record<string, unknown>>;
            };
        };
        role: MessageRole.User;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    })[], IMessage[] | ({
        activityType: import("@blueking/chat-helper").ActivityType;
        content: {
            nodes: Record<string, import("@blueking/chat-helper").IFlowAgentNode>;
            task_id: number;
            task_name: string;
            task_outputs: string[];
            task_state: import("@blueking/chat-helper").FlowTaskState;
        } | {
            content: string;
            referenceDocument: {
                name: string;
                originFileUrl?: string;
                url: string;
            }[];
        } | {
            name: string;
            originFileUrl?: string;
            url: string;
        }[];
        role: MessageRole.Activity;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content?: string;
        property?: {
            [x: string]: unknown;
            extra?: {
                [x: string]: unknown;
                cite?: string | {
                    data: {
                        key: string;
                        value: string;
                    }[];
                    title: string;
                    type: string;
                };
                command?: string;
                context?: Array<Record<string, unknown>>;
                resources?: Array<Record<string, unknown>>;
            };
        };
        role: MessageRole.Assistant;
        toolCalls?: {
            function: {
                arguments: string;
                description?: string;
                mcpName?: string;
                name: string;
            };
            id: string;
            type: import("@blueking/chat-helper").MessageType.Function;
        }[];
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Developer;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Guide;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.HiddenAssistant;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.HiddenGuide;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Hidden;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.HiddenSystem;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.HiddenUser;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Info;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Pause;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.Placeholder;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string[];
        duration?: number;
        role: MessageRole.Reasoning;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.System;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.TemplateAssistant;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.TemplateGuide;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.TemplateHidden;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.TemplateSystem;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        role: MessageRole.TemplateUser;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string;
        duration?: number;
        error?: string;
        role: MessageRole.Tool;
        toolCallId: string;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    } | {
        content: string | ({
            data?: string;
            filename?: string;
            id?: string;
            mimeType: string;
            type: import("@blueking/chat-helper").MessageType.Binary;
            url?: string;
        } | {
            text: string;
            type: import("@blueking/chat-helper").MessageType.Text;
        })[];
        property?: {
            [x: string]: unknown;
            extra?: {
                [x: string]: unknown;
                cite?: string | {
                    data: {
                        key: string;
                        value: string;
                    }[];
                    title: string;
                    type: string;
                };
                command?: string;
                context?: Array<Record<string, unknown>>;
                resources?: Array<Record<string, unknown>>;
            };
        };
        role: MessageRole.User;
        id?: string;
        messageId?: string;
        name?: string;
        sessionCode?: string;
        status: import("@blueking/chat-helper").MessageStatus;
    })[]>;
    /**
     * 欢迎语
     */
    get openingRemark(): string;
    /**
     * 预定义问题
     */
    get predefinedQuestions(): string[];
    /**
     * 批量删除消息
     * @param messages 消息数组（会自动筛选 user message 的 id 进行删除）
     */
    batchDeleteMessages(messages: IMessage[]): Promise<void>;
    /**
     * 删除消息
     * @param message 消息对象（必须是 user message，API 会自动删除对应的 AI 回复）
     */
    deleteMessage(message: IMessage): Promise<void>;
    /**
     * 处理流式响应结束
     */
    handleStreamEnd(): void;
    /**
     * 处理流式响应错误
     */
    handleStreamError(error: Error): void;
    /**
     * 处理流式响应开始
     */
    handleStreamStart(): void;
    /**
     * 从 AI 消息组重新生成
     * 找到 AI 消息组前面的用户消息，然后执行重新生成
     *
     * @param aiMessages AI 消息组（来自 MessageContainer 的 onAgentAction）
     * @param sessionCode 当前会话编码
     */
    regenerateFromAIMessages(aiMessages: IMessage[], sessionCode: string): Promise<void>;
    /**
     * 重新生成消息（乐观更新）
     * 从指定的用户消息位置开始，删除该消息及后续消息并重新发送
     *
     * @param messageId 用户消息 ID（id 字段，字符串形式）
     * @param sessionCode 当前会话编码
     */
    regenerateMessage(messageId: string, sessionCode: string): Promise<void>;
    /**
     * 重新发送消息（带新内容和属性）
     * 删除指定用户消息及其后续所有消息，然后用新内容重新发送
     *
     * @param messageId 用户消息 ID（id 字段，字符串形式）
     * @param sessionCode 当前会话编码
     * @param newContent 新的消息内容
     * @param newProperty 新的消息属性（可选）
     */
    resendMessageWithProperty(messageId: string, sessionCode: string, newContent: string, newProperty?: IUserMessage['property']): Promise<void>;
    /**
     * 重试消息
     * @param messageId 消息 ID
     */
    retryMessage(messageId: string): Promise<void>;
    /**
     * 发送消息
     * @param content 消息内容（字符串或多模态内容数组）
     * @param sessionCode 会话编码
     * @param options 发送选项
     */
    sendMessage(content: IUserMessage['content'], sessionCode: string, options?: SendMessageOptions): Promise<void>;
    /**
     * 停止生成
     */
    stopGeneration(): Promise<void>;
}
//# sourceMappingURL=chat-business-manager.d.ts.map