import { A as AgentEvent } from '../agent-CW9XbmG_.js';
import { b as ChatId, c as ChatMessage } from '../types-ajANVzf7.js';
import 'zod';
import '../errors-C-so0M4t.js';
import '../types-BxggH0Yh.js';
import '../errors-CmVvczxZ.js';

/**
 * @witqq/agent-sdk/chat/accumulator
 *
 * MessageAccumulator converts a stream of AgentEvent objects into a ChatMessage
 * with correct MessagePart array. Handles text, reasoning, and tool call
 * accumulation with proper status transitions.
 */

/**
 * Converts a stream of AgentEvent objects into a complete ChatMessage.
 * Tracks text, reasoning, and tool call parts with proper status transitions.
 *
 * @example
 * ```typescript
 * const acc = new MessageAccumulator();
 * for await (const event of agentEvents) {
 *   acc.apply(event);
 *   renderMessage(acc.snapshot()); // in-progress UI update
 * }
 * const message = acc.finalize();
 * ```
 */
declare class MessageAccumulator {
    private readonly messageId;
    private readonly parts;
    private status;
    private currentTextPart;
    private currentReasoningPart;
    private toolCallParts;
    private _finalized;
    constructor(messageId?: ChatId);
    /** Get current message ID */
    get id(): ChatId;
    /**
     * Apply an AgentEvent to accumulate into the message
     * @param event - AgentEvent to process
     * @throws Error if accumulator is already finalized
     */
    apply(event: AgentEvent): void;
    private handleTextDelta;
    private finalizeCurrentText;
    /**
     * Get a snapshot of the current accumulated message (for streaming UI)
     * @returns ChatMessage with current parts and "streaming" status
     */
    snapshot(): ChatMessage;
    /**
     * Finalize the accumulator and return the complete ChatMessage
     * @returns Completed ChatMessage with all parts finalized
     * @throws Error if accumulator is already finalized
     */
    finalize(): ChatMessage;
    /** Check if the accumulator has been finalized */
    get finalized(): boolean;
}

export { MessageAccumulator };
