import type { Logger } from "../../../../util/logger.js";
import type { Tool } from "../../../agent/tools2/types.js";
import type { LLMObsTracer } from "../../../llmobs/index.js";
import type { ErrorCategory } from "../../error.js";
import type { StreamConfig } from "../config.js";
import type { StreamEventBus } from "../event-bus.js";
import type { StreamObserver } from "../observer.js";
export interface ClassifiedError {
    category: ErrorCategory;
    code?: string | number;
    isRetryable: boolean;
    message: string;
}
export declare function classifyError(error: unknown): ClassifiedError;
export interface LLMObsObserverOptions {
    tracer: LLMObsTracer;
    logger: Logger;
}
/**
 * Observer that manages LLM Observability tracing spans.
 *
 * Creates and manages:
 * - A full workflow span (`ai.streamText`) for the entire session
 * - Step spans (`ai.streamText.step`) for each LLM step
 * - Segment spans (`ai.streamText.{type}`) for thinking/reasoning/text/tool-input
 * - Annotations with usage metrics, model info, and input/output data
 *
 * @example
 * ```typescript
 * const observer = new LLMObsObserver({
 *   tracer: LLMObsTracer.instance,
 *   logger: getLogger(),
 * });
 * ```
 */
export declare class LLMObsObserver implements StreamObserver {
    private readonly tracer;
    private readonly logger;
    private fullSpan?;
    private stepSpan?;
    private currentSegment?;
    private stepNumber;
    private tools?;
    private session?;
    private messages?;
    constructor(options: LLMObsObserverOptions);
    attach(events: StreamEventBus, _config: StreamConfig): void;
    private onSessionStart;
    private onChunk;
    private onStepComplete;
    private onStreamFinish;
    private onRetry;
    private onFallback;
    private onSessionComplete;
    private onSessionError;
    private onSessionAbort;
    private startSegment;
    private finishSegment;
    private ensureSegment;
    private appendTextToCurrentSegment;
    private appendToolInputDelta;
    private markSegmentChunk;
    private isTextualSegment;
    private getSegmentTypeFromChunk;
    private startStepSpan;
    private finishStepSpan;
    private finishFullSpan;
    private compileMetrics;
}
/**
 * Wraps tools with LLMObs tracing for real-time tool execution observability.
 *
 * This utility intercepts each tool's `execute` function and wraps it with
 * a traced span, capturing:
 * - Tool name (`tool.{name}`)
 * - Input arguments
 * - Output result
 * - Execution duration
 * - Error status
 */
export declare function wrapToolsForObservability<TOOLS extends Record<string, Tool>>(tools: TOOLS, tracer: LLMObsTracer): TOOLS;
//# sourceMappingURL=llmobs.d.ts.map