import type { TracingConfig, WorkflowSpan, SpanKind, SpanStatus, SpanLink, TraceContext } from '@cogitator-ai/types'; export interface SpanScope { span: WorkflowSpan; end: (status?: SpanStatus, message?: string) => void; addEvent: (name: string, attributes?: Record) => void; setAttribute: (key: string, value: unknown) => void; setAttributes: (attributes: Record) => void; recordException: (error: Error) => void; } export declare class WorkflowTracer { private config; private exporter; private completedSpans; private currentTraceContext; private baggage; private sampleRate; private asyncLocalStorage; private rootSpanStack; constructor(config?: Partial); isSampled(): boolean; private getSpanStack; setContextFromHeaders(headers: Record): void; getContextHeaders(): Record; setBaggage(key: string, value: string): void; getBaggage(key: string): string | undefined; getTraceContext(): TraceContext | null; startWorkflowSpan(workflowName: string, workflowId: string, runId: string, attributes?: Record): SpanScope; startNodeSpan(nodeName: string, nodeType: string, attributes?: Record): SpanScope; startToolSpan(toolName: string, attributes?: Record): SpanScope; startSpan(name: string, kind?: SpanKind, attributes?: Record): SpanScope; /** * Run a function within an isolated async span context. * Concurrent branches each get their own span stack, preventing * parent-child corruption in parallel DAG nodes. */ runInContext(fn: () => T): T; private createSpanScope; addLink(span: WorkflowSpan, link: SpanLink): void; getCurrentSpan(): WorkflowSpan | undefined; flush(): Promise; shutdown(): Promise; trace(name: string, fn: (scope: SpanScope) => Promise, options?: { kind?: SpanKind; attributes?: Record; }): Promise; } export declare function createTracer(config?: Partial): WorkflowTracer; export declare function getGlobalTracer(): WorkflowTracer; export declare function setGlobalTracer(tracer: WorkflowTracer): void; //# sourceMappingURL=tracer.d.ts.map