/** * OTelBridge — Zero-dependency OpenTelemetry bridge (BYOC pattern). * * Users inject their own OTel `Tracer` instance; the bridge wraps agent * executions, blackboard operations, and permission checks in proper OTel * spans with semantic attributes. If no tracer is provided, all calls are * no-ops (zero overhead). * * @module OTelBridge */ /** Minimal subset of OTel SpanStatusCode */ export declare enum SpanStatus { UNSET = 0, OK = 1, ERROR = 2 } /** Minimal span interface matching @opentelemetry/api Span */ export interface OTelSpan { setAttribute(key: string, value: string | number | boolean): this; setStatus(status: { code: SpanStatus; message?: string; }): this; recordException(error: Error | string): this; end(): void; } /** Minimal span options */ export interface OTelSpanOptions { attributes?: Record; } /** Minimal tracer interface matching @opentelemetry/api Tracer */ export interface OTelTracer { startSpan(name: string, options?: OTelSpanOptions): OTelSpan; } /** * Wraps orchestrator operations in OTel spans. * * @example * ```ts * import { trace } from '@opentelemetry/api'; * const bridge = new OTelBridge(trace.getTracer('network-ai')); * * // Or zero-config (no-op): * const bridge = new OTelBridge(); * ``` */ export declare class OTelBridge { private tracer; constructor(tracer?: OTelTracer); /** Replace the tracer at runtime (e.g. after late initialization). */ setTracer(tracer: OTelTracer): void; /** Whether a real tracer (not no-op) is configured. */ get isEnabled(): boolean; /** * Wrap an async function in a span. Automatically sets status and records * exceptions on failure. */ trace(spanName: string, attributes: Record, fn: (span: OTelSpan) => Promise): Promise; /** * Wrap a synchronous function in a span. */ traceSync(spanName: string, attributes: Record, fn: (span: OTelSpan) => T): T; /** Start a span for an agent delegation. Returns the span for manual end(). */ startDelegation(sourceAgent: string, targetAgent: string, taskId: string): OTelSpan; /** Start a span for adapter execution. */ startAdapterExecution(adapterId: string, agentId: string): OTelSpan; /** Start a span for a blackboard operation. */ startBlackboardOp(operation: string, key: string, agentId: string): OTelSpan; /** Start a span for a permission check. */ startPermissionCheck(agentId: string, resourceType: string): OTelSpan; /** Start a span for quality gate validation. */ startQualityGate(agentId: string, key: string): OTelSpan; } //# sourceMappingURL=otel-bridge.d.ts.map