/** * The emit stage: take reconstructed turns, build the OTLP pipeline, ship the * span tree to Weave, and flush. Kept separate from the plugin so a test can * drive the whole pipeline with an in-memory exporter (via `makeTracer`). * * A fresh tracer is built and torn down per emit — matching weave-codex, so a * transport failure surfaces immediately and spans are never left un-flushed in * a long-lived opencode process. */ import type { ResolvedConfig } from '../config.js'; import { type EmitSource } from '../collect/state.js'; import type { ReconstructedTurn } from '../model.js'; import { type EmittedTurn } from '../spans/emit.js'; import { type TracerHandle } from '../spans/tracer.js'; export interface SkippedTurn { turn_id: string; conversation_id: string; trace_id?: string; reason: 'already_emitted' | 'incomplete' | 'locked'; } export interface EmitUnseenTurnsOptions { dbPath: string; source: EmitSource; makeTracer?: (config: ResolvedConfig) => TracerHandle; } export interface EmitUnseenTurnsResult { emitted: EmittedTurn[]; skipped: SkippedTurn[]; } export declare function emitUnseenTurns(turns: ReconstructedTurn[], config: ResolvedConfig, options: EmitUnseenTurnsOptions): Promise; export declare function emitTurns(turns: ReconstructedTurn[], config: ResolvedConfig, makeTracer?: (config: ResolvedConfig) => TracerHandle): Promise;