/** * Turn a ReconstructedTurn into a backdated OTEL span tree: * * invoke_agent opencode (root; start/end = turn bounds) * ├─ chat (one per model call; per-call usage + output) * └─ execute_tool (one per tool; arguments + result) * * chat and execute_tool are siblings under the turn (the GenAI-spec convention). * Every span carries gen_ai.conversation.id so Weave stitches turns server-side. * Start/end times come from the opencode event timestamps, which is the whole * point of building spans through the raw OTel API rather than the Weave SDK. */ import { type Tracer } from '@opentelemetry/api'; import type { ReconstructedTurn } from '../model.js'; /** Identifiers for one emitted turn, returned so callers can report deep links. */ export interface EmittedTurn { turnId: string; /** == sessionId; the key Weave stitches turns into a conversation by. */ conversationId: string; /** OTEL trace id (32 hex) of the turn's span tree. */ traceId: string; } export declare function emitTurn(tracer: Tracer, turn: ReconstructedTurn, captureContent: boolean): EmittedTurn;