/**
 * AIChatRTC.session.js — RTCChatSession 类（VolcEngine RTC 语音会话生命周期）
 *
 * 由 AIChatRTC.js 导入，不单独使用。
 */
/** RTC 引擎/SDK 宽松调用类型（方法返回 any 以便链式调用） */
type RTCAny = Record<string, any>;
declare class RTCChatSession {
    aiChatRTC: RTCAny;
    sdk: RTCAny;
    options: Record<string, unknown>;
    rtcEngine: RTCAny;
    sandbox: RTCAny;
    _listeners: Record<string, Array<(data?: unknown) => void>>;
    _subtitleBuffer: Record<string, {
        text: string;
        isUser: boolean;
        [k: string]: unknown;
    }>;
    _history: Array<Record<string, unknown>>;
    _pendingMessages: Array<{
        targetUserId?: string;
        binaryData?: unknown;
        label?: string;
        isRoomMessage?: boolean;
        [k: string]: unknown;
    }>;
    _comfortSentTypes: Set<string>;
    _chatReassemblyBuffer: Record<string, {
        chunks: string[];
        userId?: unknown;
        username?: unknown;
        timestamp?: unknown;
        [k: string]: unknown;
    }>;
    _autoPlayFailUsers: unknown[];
    enabledToolCategories: unknown;
    customTools: unknown[];
    agentState: number;
    isActive: boolean;
    isMuted: boolean;
    isConnected: boolean;
    isScreenSharing: boolean;
    isCameraSharing: boolean;
    mode: string;
    appId: unknown;
    roomId: string;
    userId: string;
    taskId: string;
    agentUserId: string;
    _chatGroupId: number;
    _imageGroupId: number;
    _cleanupChildSessions: () => void;
    _cancelDebounceTimers: () => void;
    _consumePendingChildResults: () => unknown[];
    [key: string]: unknown;
    /**
     * @param {AIChatRTC} aiChatRTC - Parent AIChatRTC instance
     * @param {Object} config - Session configuration (see AIChatRTC.createSession)
     */
    constructor(aiChatRTC: Record<string, unknown>, config?: Record<string, unknown>);
    /**
     * Subscribe to an event.
     * @param {string} event
     * @param {Function} callback
     * @returns {RTCChatSession} this (for chaining)
     */
    on(event: string, callback: (data?: unknown) => void): this;
    /**
     * Unsubscribe from an event.
     * @param {string} event
     * @param {Function} callback
     * @returns {RTCChatSession}
     */
    off(event: string, callback: (data?: unknown) => void): this;
    /**
     * Emit an event to all subscribers.
     * @param {string} event
     * @param {*} data
     */
    emit(event: string, data?: unknown): void;
    /**
     * Start the session: load RTC SDK → fetch token → join room → start audio.
     * In 'ai' mode, also starts the server-side AI voice agent.
     * In 'human' mode, only joins the RTC room for multi-user voice/text chat.
     * @returns {Promise<void>}
     */
    start(): Promise<void>;
    /**
     * Stop the session and leave the RTC room.
     * In 'ai' mode, also stops the server-side AI voice agent.
     * @returns {Promise<void>}
     */
    stop(): Promise<void>;
    /**
     * Update an active voice chat session via REST API.
     * Supports commands: ExternalTextToSpeech, UpdateParameters, interrupt, etc.
     * @param {string} command - Command type
     * @param {Object} [options] - Additional fields (Message, InterruptMode, Parameters, etc.)
     * @returns {Promise<Object>} API response
     */
    updateVoiceChat(command: string, options?: Record<string, unknown>): Promise<unknown>;
    /**
     * Update LLM/TTS/etc. parameters without leaving the RTC room.
     * @param {Object} config - New Config block for VolcEngine UpdateParameters
     * @param {Object} [options] - Additional UpdateVoiceChat fields
     * @returns {Promise<Object>} API response
     */
    updateParameters(config?: unknown, options?: Record<string, unknown>): Promise<unknown>;
    /** Alias for stop() + full cleanup */
    destroy(): Promise<void>;
    _cleanup(): void;
    _cleanupChildSessionsSafe(): void;
    _ensureSandbox(): RTCAny;
    /**
     * Send a message using a ChatSession-like API.
     * Supports delayed child-agent result injection and local `${...}` template
     * expansion via `runCode` before sending through the RTC text channel.
     *
     * Returns the text submitted into the RTC pipeline. The actual assistant
     * response continues to arrive via RTC events such as `subtitle`.
     *
     * @param {string|Object|null} userMessage
     * @param {Object} [options]
     * @param {boolean} [options.runCode=false] - Resolve `${...}` expressions via sandbox before sending
     * @returns {Promise<string|null>}
     */
    send(userMessage: unknown, options?: Record<string, unknown>): Promise<string | null>;
    /**
     * Send text. In 'ai' mode, sends to the agent's LLM via RTC binary channel.
     * In 'human' mode, broadcasts to all room members via sendRoomText().
     * @param {string} text
     */
    sendText(text: string): void;
    /**
     * Broadcast a text message to all users in the RTC room.
     * Works in both 'ai' and 'human' modes.
     * Automatically chunks messages that exceed 1 KB.
     * @param {string} text
     */
    sendRoomText(text: string): void;
    /**
     * Send background context to the agent's LLM via RTC binary channel.
     * Uses ExternalPromptsForLLM: injected as context for the next reply
     * without triggering an immediate response.
     * @param {string} text - Context text to inject
     * @param {Object} [options]
     * @param {boolean} [options.useREST=false] - Use REST API instead of binary channel
     */
    sendContext(text: string, options?: Record<string, unknown>): unknown;
    /**
     * Send text to the agent's TTS (text-to-speech) via RTC binary channel.
     * @param {string} text
     * @param {Object} [options]
     * @param {boolean} [options.useREST=false] - Use REST API instead of binary channel (supports InterruptMode)
     * @param {number} [options.interruptMode] - REST only: 1=high/2=medium/3=low priority
     */
    sendTTS(text: string, options?: Record<string, unknown>): unknown;
    /**
     * Send an interrupt command to stop the agent mid-speech.
     */
    interrupt(): void;
    /**
     * Send a base64-encoded image with text to the agent's LLM.
     * Automatically splits into 1 KB TLV chunks per VolcEngine protocol.
     * @param {string} imageBase64 - Base64 image data (no data URI prefix)
     * @param {string} text - Accompanying text message
     */
    sendImageWithText(imageBase64: string, text: string, options?: Record<string, unknown>): Promise<void>;
    /**
     * Mute the local microphone.
     * Idempotent: no-op if already muted; swallows RTC SDK promise rejections
     * (e.g. "Has already stop capture") so callers don't see UnhandledPromiseRejection.
     */
    mute(): void;
    /**
     * Unmute the local microphone.
     * Idempotent: no-op if already unmuted; swallows RTC SDK promise rejections
     * (e.g. "Has already capture") so callers don't see UnhandledPromiseRejection.
     */
    unmute(): void;
    /**
     * Start sharing the screen. The agent can see the shared screen.
     */
    startScreenShare(): Promise<void>;
    /**
     * Start sharing the camera. The agent can see the camera feed.
     */
    startCameraShare(): Promise<void>;
    /**
     * Stop any active video sharing (screen or camera).
     */
    stopVideoShare(): Promise<void>;
    /**
     * Try to resume audio playback after an autoplay failure.
     * Call this in response to a user interaction (click/tap).
     */
    resumeAudio(): void;
    /**
     * Get accumulated subtitle history.
     * @returns {Array<{ role: string, text: string, roundId: string }>}
     */
    getHistory(): Record<string, unknown>[];
    /** Clear subtitle history. */
    clear(): void;
    /**
     * Restart the RTC agent session with an optional prompt file.
     *
     * Behavior:
     * - No promptFile: restores settings to initial defaults.
     * - Pure markdown (only system_prompt): changes only system prompt.
     * - Full config: temporarily overrides; next empty restart reverts to defaults.
     *
     * @param {string} [promptFile] - URL or path to agent config file.
     * @param {string[]} [tools] - Optional tool category override. Empty means inherit defaults.
     * @returns {Promise<Object>} { configSource }
     */
    restartAgent(promptFile?: string, tools?: unknown): Promise<{
        configSource: unknown;
    }>;
    _resolveLocalModelSettings(model: string): RTCAny;
    _buildVoiceChatBody(copilotToolDefs: unknown): Promise<RTCAny>;
    _buildVoiceChatConfigForAPI(copilotToolDefs: unknown, sourceConfig?: unknown, options?: Record<string, unknown>): Promise<RTCAny>;
    _buildVoiceChatUpdateConfig(config?: RTCAny): RTCAny;
    /**
     * Expand all ${...} template expressions in SystemMessages using the sandbox.
     */
    _expandSystemMessages(config: RTCAny): Promise<void>;
    _setupRTCEvents(): void;
    _handleConnectionStateChanged({ state }: {
        state?: unknown;
    }): void;
    _handleBinaryMessage(event: RTCAny): Promise<void>;
    _handleChatMessage(parsed: RTCAny): void;
    _handleSubtitleData(parsed: RTCAny): void;
    _handleLegacySubtitle(event: RTCAny): void;
    _handleAgentBrief(parsed: RTCAny): void;
    _handleFunctionCallInfo(parsed: RTCAny): void;
    _handleFunctionCall(parsed: RTCAny): Promise<void>;
    _sendCommand(command: string, message: string): void;
    _sendBinaryMessageSafe(targetUserId: string, binaryData: unknown, label: string): boolean;
    _flushPendingMessages(): void;
    /**
     * Split a string into chunks whose JSON-encoded byte length fits within maxBytes.
     * Accounts for JSON string escaping (e.g. quotes, backslashes, control chars).
     */
    _splitTextForTLV(text: string, maxBytes: number): string[];
    /**
     * Send a function-call result back to the agent, chunking if it exceeds 1 KB.
     * Uses IsPartial + FragmentID on the 'func' TLV type (mirrors image chunking).
     */
    _sendFuncResultChunked(toolCallId: string, content: string, funcName: string): Promise<void>;
    /**
     * Send a text command (e.g. ExternalTextToLLM) that may exceed 1 KB.
     * Splits into multiple sequential ctrl messages if necessary.
     */
    _sendCommandChunked(command: string, message: string): Promise<void>;
    /**
     * Send a base64 image in chunks via sendUserBinaryMessage.
     * Per VolcEngine docs: default per-message limit is 1 KB.
     * IsPartial=true / FragmentID for intermediate chunks.
     * Message text only in the last chunk (IsPartial=false).
     */
    _sendImageChunked(imageBase64: string, message: string, groupId: number): Promise<void>;
    _addHistory(role: string, text: string, roundId?: unknown): void;
}
/**
 * 安装 RTCChatSession 的 ChildSessionMixin 相关 prototype 注册：
 * 1. 将 childSessionMethods 混入 RTCChatSession.prototype
 * 2. 覆盖 RTCChatSession.prototype._triggerImmediateCallback
 *
 * 注意：必须用「导出函数 + 在聚合入口（AIChatRTC.ts）实际调用」的方式注册，
 * 而非模块顶层裸语句。后者是对被聚合引用类的无返回值顶层副作用语句，
 * Rollup tree-shaking 会因其无外部可观测副作用而删除，导致 RTC 子 agent 方法
 * （_triggerImmediateCallback / queueChildResult 等）在打包产物中缺失。
 * 集中到本函数并由 AIChatRTC.ts 引用调用，可被 Rollup 当作有副作用的调用保留。
 */
export declare function installRTCChatSessionMixin(): void;
export default RTCChatSession;
export { RTCChatSession };
//# sourceMappingURL=AIChatRTC.session.d.ts.map