/** Langfuse keys, or null when this run is not traced. */ export declare function langfuseConfig(env?: NodeJS.ProcessEnv): LangfuseConfig | null; /** * Spans held in memory, shipped as one OTLP request. Langfuse reads OTLP over * plain JSON, so a trace costs no dependency: an install of this CLI carries no * OpenTelemetry SDK for a feature most runs never turn on. */ export declare function createTracer(config: LangfuseConfig): Tracer; export declare function otlpPayload(spans: OtlpSpan[]): OtlpPayload; export declare function spanAttributes(name: string, fields: SpanFields, root: boolean): OtlpAttribute[]; export interface LangfuseConfig { publicKey: string; secretKey: string; baseUrl: string; } export interface Tracer { /** Opens a trace of its own. Everything below it hangs off this span. */ trace(name: string, fields: SpanFields): Span; flush(): Promise; } export interface Span { child(name: string, fields: SpanFields): Span; update(fields: SpanFields): void; end(fields?: SpanFields): void; } export interface SpanFields { type?: "agent" | "generation" | "tool" | "span"; input?: unknown; output?: unknown; model?: string; usage?: Record; cost?: Record; metadata?: Record; level?: "DEFAULT" | "WARNING" | "ERROR"; tags?: string[]; sessionId?: string; } export interface OtlpSpan { traceId: string; spanId: string; parentSpanId?: string; name: string; kind: number; startTimeUnixNano: string; endTimeUnixNano: string; attributes: OtlpAttribute[]; status: Record; } export interface OtlpAttribute { key: string; value: { stringValue: string; }; } export interface OtlpPayload { resourceSpans: Array<{ resource: { attributes: OtlpAttribute[]; }; scopeSpans: Array<{ scope: { name: string; }; spans: OtlpSpan[]; }>; }>; }