/**
 * TraceCollector — extracts structured trace data from provider responses.
 *
 * Parses tool calls, token usage, and timing data from Promptfoo result
 * objects and normalizes them into the canonical `EvalTrace` shape.
 *
 * Works via inline extraction — parsing provider response metadata
 * directly, without requiring additional infrastructure.
 *
 * @see docs/design-docs/architecture-overhaul/observability-telemetry.md
 * @see packages/core/src/types/trace.ts — EvalTrace types
 */
import type { EvalTrace, ToolCallCategory } from "../../../_vendor/ailf-core/index.d.ts";
/** Raw provider response shape (subset of Promptfoo's result object) */
export interface ProviderResponse {
    /** Raw text output */
    output?: string;
    /** Token usage (varies by provider) */
    tokenUsage?: {
        completion?: number;
        prompt?: number;
        total?: number;
        cached?: number;
    };
    /** Provider-specific metadata (e.g., Claude's toolCalls) */
    metadata?: {
        toolCalls?: RawToolCall[];
        [key: string]: unknown;
    };
    /** Response latency in milliseconds */
    latencyMs?: number;
}
/** Raw tool call from a provider (pre-normalization) */
export interface RawToolCall {
    name?: string;
    input?: Record<string, unknown>;
    output?: unknown;
    error?: string;
    durationMs?: number;
    /** Alternative field names used by some providers */
    function?: {
        name?: string;
        arguments?: string;
    };
    type?: string;
}
/** Options for trace collection */
export interface TraceCollectorOptions {
    /** Run ID to associate with this trace */
    runId: string;
    /** Task ID that produced this test case */
    taskId: string;
    /** Test case index within the task */
    testCaseIndex: number;
    /** Model under evaluation */
    modelId: string;
    /** Custom tool → category mappings */
    toolCategories?: Record<string, ToolCallCategory>;
    /** Maximum output size per tool call (bytes) */
    maxOutputBytes?: number;
}
/**
 * Collect a trace from a single provider response.
 *
 * Extracts tool calls, token usage, timing, and builds the
 * chronological event log.
 */
export declare function collectTrace(response: ProviderResponse, options: TraceCollectorOptions): EvalTrace;
/**
 * Merge multiple per-turn traces into a single test case trace.
 *
 * Each turn produces its own trace. This function combines them into
 * a parent trace with per-turn spans.
 */
export declare function mergeTraces(turns: EvalTrace[], parentOptions: TraceCollectorOptions): EvalTrace;
