/**
 * Internal types used by the streaming implementation
 * These are not exported to consumers of the library
 */
import { ContextManagementAction } from "./agent.js";
type ToolCallStreamData = {
    id: string;
    name: string;
    arguments?: string;
    startedAt?: string | null;
    completedAt?: string | null;
    durationMs?: number | null;
    failedAt?: string | null;
    firstStatusAt?: string | null;
};
/**
 * Low-level streaming events used internally by providers
 * These get transformed into AgentStreamEvent by UIEventAdapter
 */
export type StreamEvent = {
    type: "start";
    conversationId: string;
} | {
    type: "token";
    token: string;
} | {
    type: "message";
    message: string;
} | {
    type: "tool_call_start";
    toolCall: ToolCallStreamData;
} | {
    type: "tool_call_delta";
    toolCallId: string;
    argumentDelta: string;
} | {
    type: "tool_call_parsed";
    toolCall: ToolCallStreamData & {
        arguments: string;
    };
} | {
    type: "tool_call_executing";
    toolCall: ToolCallStreamData & {
        arguments: string;
    };
} | {
    type: "tool_call_complete";
    toolCall: ToolCallStreamData & {
        arguments: string;
    };
    result?: unknown;
    error?: string;
} | {
    type: "complete";
    messageId?: string;
    conversationId?: string;
    tokens?: number;
    usage?: {
        promptTokens: number;
        completionTokens: number;
        totalTokens: number;
        model?: string;
        provider?: string;
    };
} | {
    type: "error";
    error: string;
} | {
    type: "context_window";
    usage: {
        usedTokens: number;
        maxTokens: number;
        percentage: number;
        remainingTokens: number;
    };
} | {
    type: "context_management";
    action: ContextManagementAction;
    usage: {
        usedTokens: number;
        maxTokens: number;
        percentage: number;
        remainingTokens: number;
    };
    timestamp: Date;
} | {
    type: "reasoning_start";
    format: "thinking_tag" | "markdown" | "custom";
} | {
    type: "reasoning_delta";
    content: string;
    format: "thinking_tag" | "markdown" | "custom";
} | {
    type: "reasoning_end";
    fullContent: string;
    signature?: string;
};
/**
 * Normalized error from an LLM provider. Carries structured metadata
 * so the retry layer can make decisions without parsing error messages.
 */
export declare class ProviderError extends Error {
    readonly provider: string;
    readonly statusCode: number;
    readonly retryable: boolean;
    readonly requestId?: string;
    constructor(message: string, opts: {
        provider: string;
        statusCode: number;
        retryable: boolean;
        requestId?: string;
        cause?: Error;
    });
}
/**
 * Detect common retryable server errors across providers.
 * Used as a catch-all after provider-specific error classification.
 */
export declare function isRetryableServerError(error: any): boolean;
/**
 * Detect rate-limit / overloaded errors across providers.
 */
export declare function isRateLimitError(error: any): boolean;
/**
 * Detect transient network errors.
 *
 * Node's undici (built-in fetch) wraps TCP resets as:
 *   TypeError: terminated
 *     [cause]: Error: read ECONNRESET { code: 'ECONNRESET' }
 *
 * The ECONNRESET code lives on the nested `cause`, not the top-level error,
 * so we check both levels.
 */
export declare function isNetworkError(error: any): boolean;
/** Extract a request ID from a provider error, if present. */
export declare function extractRequestId(error: any): string | undefined;
export {};
