/**
 * Chat SSE → JSON转换器
 * 将SSE事件流聚合为ChatCompletion响应
 */
import { DEFAULT_CHAT_CONVERSION_CONFIG } from '../types/index.js';
import type { ChatCompletionResponse, ChatSseEvent, SseToChatJsonOptions, ChatEventStats } from '../types/index.js';
/**
 * Chat SSE到JSON转换器
 */
export declare class ChatSseToJsonConverter {
    private config;
    private contexts;
    constructor(config?: Partial<typeof DEFAULT_CHAT_CONVERSION_CONFIG>);
    /**
     * 将SSE流转换为Chat Completion响应
     */
    convertSseToJson(sseStream: AsyncIterable<ChatSseEvent> | AsyncIterable<string | Buffer>, options: SseToChatJsonOptions): Promise<ChatCompletionResponse>;
    /**
     * 将SSE流转换为流式响应
     */
    aggregateSseStream(sseStream: AsyncIterable<ChatSseEvent> | AsyncIterable<string | Buffer>, options: SseToChatJsonOptions): AsyncGenerator<ChatCompletionResponse>;
    /**
     * 确保输入流转换为 ChatSseEvent 流
     */
    private ensureEventStream;
    /**
     * 将SSE文本块解析为Chat事件
     */
    private parseSseChunk;
    /**
     * 创建转换上下文
     */
    private createContext;
    /**
     * 处理SSE事件
     */
    private processSseEvent;
    /**
     * 处理chat_chunk事件
     */
    private processChatChunk;
    private parseChatChunkPayload;
    private ensureChoiceBuilder;
    private tryProcessDeepSeekWebPatchEvent;
    private getDeepSeekPatchState;
    /**
     * 处理choice
     */
    private processChoice;
    /**
     * 创建choice构建器
     */
    private createChoiceBuilder;
    /**
     * 将reasoning文本附加到消息内容
     */
    private appendReasoningToMessageContent;
    /**
     * 处理delta
     */
    private processDelta;
    /**
     * 处理tool_call delta
     */
    private processToolCallDelta;
    /**
     * 更新响应中的choice
     */
    private updateResponseChoice;
    /**
     * 将reasoning内容规范化为独立字段并抽取工具调用
     */
    private normalizeReasoning;
    /**
     * 处理done事件
     */
    private processDoneEvent;
    /**
     * 处理error事件
     */
    private processErrorEvent;
    /**
     * 构建部分响应
     */
    private buildPartialResponse;
    /**
     * 完成响应构建
     */
    private finalizeResponse;
    /**
     * 构建使用量信息
     */
    private buildUsageInfo;
    /**
     * 验证SSE事件
     */
    private validateSseEvent;
    /**
     * 验证Chat chunk
     */
    private validateChatChunk;
    /**
     * 更新统计信息
     */
    private updateStats;
    /**
     * 获取转换统计
     */
    getStats(requestId: string): ChatEventStats | undefined;
    /**
     * 清理上下文
     */
    cleanup(requestId: string): void;
    /**
     * 清理所有上下文
     */
    cleanupAll(): void;
}
export declare const defaultChatSseToJsonConverter: ChatSseToJsonConverter;
