/**
 * Responses响应构建器
 * 负责状态机和事件聚合，从SSE事件构建完整的Responses响应对象
 */
import type { ResponsesSseEvent, ResponsesResponse } from '../../types/index.js';
export type ResponseBuilderState = 'initial' | 'building' | 'completed' | 'error';
export interface ResponseBuilderConfig {
    enableStrictValidation: boolean;
    enableEventRecovery: boolean;
    maxOutputItems: number;
    maxContentParts: number;
    maxSequenceGaps: number;
}
export interface OutputItemState {
    id: string;
    type: string;
    status: 'in_progress' | 'completed';
    contentParts: any[];
    currentContentIndex: number;
    accumulatedContent: any[];
    summaryByIndex: Map<number, string>;
    currentSummaryIndex: number;
    hasContentPartAdded: boolean;
    isTextInProgress: boolean;
    callId?: string;
    name?: string;
    arguments?: string;
    role?: string;
    encryptedContent?: string;
    startTime: number;
    lastEventTime: number;
}
export declare const DEFAULT_RESPONSE_BUILDER_CONFIG: ResponseBuilderConfig;
/**
 * Responses响应构建器
 */
export declare class ResponsesResponseBuilder {
    private state;
    private response;
    private outputItemBuilders;
    private lastSequenceNumber;
    private config;
    private error?;
    constructor(config?: Partial<ResponseBuilderConfig>);
    /**
     * 处理SSE事件
     */
    processEvent(event: ResponsesSseEvent): boolean;
    /**
     * 验证序列号
     */
    private validateSequenceNumber;
    /**
     * 处理response.start事件
     */
    private handleResponseStart;
    private handleResponseCreated;
    private handleResponseInProgress;
    /**
     * 处理output_item.start事件
     */
    private handleOutputItemStart;
    private mapOutputItemAdded;
    private mapOutputItemDone;
    /**
     * 处理content_part.start事件
     */
    private handleContentPartStart;
    private mapContentPartAdded;
    /**
     * 处理content_part.delta事件
     */
    private handleContentPartDelta;
    private mapOutputTextDelta;
    /**
     * 处理content_part.done事件
     */
    private handleContentPartDone;
    private mapContentPartDone;
    /**
     * 处理function_call.start事件
     */
    private handleFunctionCallStart;
    private coerceArgumentsChunk;
    private shouldOverrideArguments;
    /**
     * 处理function_call.delta事件
     */
    private handleFunctionCallDelta;
    private mapFunctionCallDelta;
    /**
     * 处理function_call.done事件
     */
    private handleFunctionCallDone;
    private mapFunctionCallDone;
    /**
     * 处理reasoning.start事件
     */
    private handleReasoningStart;
    /**
     * 处理reasoning.delta事件
     */
    private handleReasoningDelta;
    private handleReasoningSummaryDelta;
    private handleReasoningSummaryDone;
    private handleReasoningSummaryPartAdded;
    private handleReasoningSummaryPartDone;
    private mapReasoningDelta;
    private mapReasoningDone;
    /**
     * 处理reasoning.done事件
     */
    private handleReasoningDone;
    /**
     * 处理output_item.done事件
     */
    private handleOutputItemDone;
    /**
     * 处理required_action事件
     */
    private handleRequiredAction;
    /**
     * 处理response.done事件
     */
    private handleResponseDone;
    /**
     * 处理错误事件
     */
    private handleError;
    private handleResponseCompleted;
    /**
     * 构建输出项列表
     */
    private buildOutputItems;
    /**
     * 构建消息项并根据需要拆分reasoning
     */
    private buildMessageItem;
    /**
     * 构建函数调用项
     */
    private buildFunctionCallItem;
    /**
     * 构建推理项
     */
    private buildReasoningItem;
    /**
     * 获取构建结果
     */
    getResult(): {
        success: boolean;
        response?: ResponsesResponse;
        error?: Error;
    };
    /**
     * 获取当前状态
     */
    getState(): ResponseBuilderState;
    /**
     * 重置构建器
     */
    reset(): void;
    /**
     * 获取输出项构建器
     */
    getOutputItemBuilders(): Map<string, OutputItemState>;
    /**
     * 获取最后序列号
     */
    getLastSequenceNumber(): number;
}
/**
 * 创建响应构建器工厂
 */
export declare function createResponseBuilder(config?: Partial<ResponseBuilderConfig>): ResponsesResponseBuilder;
