import { AgentStreamEvent } from "../types/ui-events.js";
import { StreamEvent } from "../types/internal.js";
import { ChunkingStrategy } from "./chunk-buffer.js";
/**
 * Adapter that transforms low-level streaming events into high-level UI events
 * using GraphQL types for type safety
 */
export declare class UIEventAdapter {
    private onEvent;
    private conversationId;
    private model?;
    private modelName?;
    private modelService?;
    private tokenCount;
    private currentMessage;
    private isStreaming;
    private conversationStartTime;
    private streamStartTime;
    private firstTokenTime;
    private lastTokenTime;
    private tokenDelays;
    private activeToolCalls;
    private lastUpdateTime;
    private updateTimer?;
    private chunkBuffer?;
    private smoothingDelay;
    private chunkQueue;
    private contextWindowUsage?;
    private finalMetrics?;
    private reasoningContent;
    private reasoningFormat?;
    private reasoningSignature?;
    private isInReasoning;
    private reasoningBuffer?;
    private reasoningEmitTimer?;
    private lastReasoningEmitTime;
    private hasEmittedFirstReasoning;
    private static readonly REASONING_THROTTLE_MS;
    private usageData?;
    private hasToolCallsInProgress;
    private hadToolCallsBeforeResume;
    private getCachedInputTokens;
    constructor(onEvent: (event: AgentStreamEvent) => void, conversationId: string, options?: {
        smoothingEnabled?: boolean;
        chunkingStrategy?: ChunkingStrategy;
        smoothingDelay?: number;
        model?: string;
        modelName?: string;
        modelService?: string;
    });
    setModelInfo(options: {
        model?: string;
        modelName?: string;
        modelService?: string;
    }): void;
    /**
     * Process a raw streaming event and emit appropriate UI events
     */
    handleEvent(event: StreamEvent): void;
    private handleStart;
    private handleToken;
    private handleMessage;
    private handleToolCallStart;
    private handleToolCallDelta;
    private handleToolCallParsed;
    private handleToolCallExecuting;
    private handleToolCallComplete;
    private handleComplete;
    private handleError;
    /**
     * Emit a structured error event. Public so the client can pass through
     * the `recoverable` flag from ProviderError after retries are exhausted.
     */
    emitError(message: string, recoverable: boolean): void;
    private scheduleMessageUpdate;
    private scheduleChunkEmission;
    private emitNextChunk;
    private emitMessageUpdate;
    private emitUIEvent;
    private emitToolUpdate;
    private handleContextWindow;
    private handleContextManagement;
    private handleReasoningStart;
    private handleReasoningDelta;
    private scheduleReasoningEmission;
    private emitReasoningUpdate;
    private handleReasoningEnd;
    /**
     * Build a ReasoningMetadata object from accumulated reasoning state.
     * Returns undefined when no reasoning content has been captured.
     */
    private buildReasoningMetadata;
    /**
     * Clean up any pending timers
     */
    /**
     * Snapshot the current accumulated message so it can be restored on retry.
     * Call this before each provider round begins.
     */
    snapshotMessage(): string;
    /**
     * Reset streaming state to prepare for a provider retry.
     * Restores the message to the given snapshot and clears partial buffers.
     */
    resetForRetry(messageSnapshot: string): void;
    dispose(): void;
    /**
     * Get the total completion time in milliseconds
     */
    getCompletionTime(): number | undefined;
    /**
     * Get the time to first token in milliseconds
     */
    getTTFT(): number | undefined;
    /**
     * Get the throughput in tokens per second
     */
    getThroughput(): number | undefined;
    /**
     * Set usage data from native provider
     */
    setUsageData(usage: any): void;
}
