import type { ExportedLLMObsSpan, LLMObsAnnotationOptions, LLMObsEvaluationOptions, LLMObsManualSpanOptions, LLMObsNamedSpanOptions, LLMObsNamelessSpanOptions, LLMObsRootPolicy, LLMObsSpan } from "./types.js";
/**
 * Core tracer responsible for LLM observability within the AI service.
 *
 * Provides utilities for executing code within spans, managing span lifecycles,
 * and decorating functions or classes with consistent instrumentation.
 */
export declare class LLMObsTracer {
    private globalState;
    private localStorage;
    private globalTags;
    private defaultRootPolicy;
    private static _instance;
    rootSpan?: LLMObsSpan;
    protected constructor({ defaultRootPolicy, }?: {
        defaultRootPolicy?: LLMObsRootPolicy;
    });
    static get instance(): LLMObsTracer;
    /**
     * Set the default root policy for spans created without an explicit policy.
     * The default is 'allow'.
     * @see LLMObsRootPolicy
     */
    setDefaultRootPolicy(policy: LLMObsRootPolicy): void;
    /**
     * Execute a function within a traced span context and finish the span
     * automatically once the function resolves.
     */
    trace<T>(options: LLMObsNamedSpanOptions, fn: (span: LLMObsSpan) => T): T;
    /**
     * Wrap a function so each invocation runs inside an automatically managed span.
     * When the function lacks a name, the span falls back to the provided kind.
     */
    wrap<T extends (...args: any[]) => any>(options: LLMObsNamelessSpanOptions, fn: T): T;
    startActiveSpan(options: LLMObsManualSpanOptions): LLMObsSpan;
    /**
     * Flush any buffered spans.
     */
    flush(): void;
    /**
     * Export the supplied span (or the currently active span) into the
     * DataDog-specific wire format for manual submission.
     */
    exportSpan(span?: LLMObsSpan): ExportedLLMObsSpan;
    /**
     * Annotate a span with tags, metadata, and optional error details.
     * If only annotations are provided, the active span is annotated.
     */
    annotate(annotations: LLMObsAnnotationOptions): void;
    annotate(span: LLMObsSpan, annotations: LLMObsAnnotationOptions): void;
    /** Submit feedback or evaluation metrics for a completed span. */
    submitEvaluation(spanContext: ExportedLLMObsSpan, option: LLMObsEvaluationOptions): void;
    /**
     * Create a decorator factory that wraps functions inside traced spans using
     * the provided options as defaults.
     */
    decorate<T extends (...args: any[]) => any>(options: LLMObsNamelessSpanOptions): (target: T) => T;
    /** Retrieve the currently active span, falling back to global state. */
    active(): LLMObsSpan | undefined;
    /**
     * Merge globally-applied tags into those sent with every span that this tracer
     * creates. Later tags override earlier ones when keys overlap.
     */
    setGlobalTags(tags: {
        [key: string]: any;
    }): void;
    /**
     * Register the span with local/global state, override its finish behaviour,
     * and apply global tags so nested spans maintain proper hierarchy.
     */
    private register;
    /**
     * Shared tracing implementation used by both auto-finishing and manual spans.
     * Handles stack setup, parent alignment, and execution of the caller callback.
     */
    private _trace;
    private static createNoopSpan;
    /** Activate a span as the current parent context for downstream traces. */
    private activate;
    private get localState();
    private static _llmobs;
    private static _otelExporterInitialized;
    private static _isCloudPremCached;
    private get llmobs();
    /**
     * Check if current deployment is CLOUD_PREM.
     * In CLOUD_PREM, LLMObs spans are converted to OTEL spans instead of
     * being sent directly to Datadog LLMObs API.
     * Result is cached since deployment type is constant for process lifetime.
     */
    private static isCloudPrem;
    private setModel;
    private setTag;
    /**
     * Realign a child span created within a manual parent so it retains the
     * correct trace/parent IDs; mirrors dd-trace's internal behaviour.
     */
    private static alignManualChildTrace;
    /** True when a span was created via {@link startActiveSpan}. */
    private static isManualSpan;
    /** Normalize annotation payloads so tags and metadata are consistently shaped. */
    private static normalizeAnnotationPayload;
}
export declare const tracer: LLMObsTracer;
export default tracer;
//# sourceMappingURL=tracer.d.ts.map