/** * Thread view reconstruction for Braintrust. * * Reconstructs LLM output in OpenAI Chat Completion format by examining * child MODEL_STEP and TOOL_CALL spans. This enables Braintrust's Thread * view to properly display the full conversation flow including tool calls. * * See THREAD_VIEW_RECONSTRUCTION.md for details. */ import type { OpenAIMessage } from './formatter.js'; /** * Tool call data accumulated from MODEL_STEP and TOOL_CALL spans */ export interface ThreadToolCall { toolCallId: string; toolName: string; args: unknown; result?: unknown; startTime?: Date; } /** * Step data accumulated from MODEL_STEP spans for Thread view reconstruction */ export interface ThreadStepData { stepSpanId: string; stepIndex: number; text?: string; toolCalls?: ThreadToolCall[]; } /** * Accumulated data for reconstructing Braintrust Thread view. * Populated for MODEL_GENERATION spans as child MODEL_STEP and TOOL_CALL spans complete. */ export type ThreadData = ThreadStepData[]; /** * Tool result data stored when TOOL_CALL spans end (before MODEL_STEP ends) */ export interface PendingToolResult { result: unknown; startTime: Date; } /** * Reconstruct the Thread view output from accumulated threadData. * Converts to OpenAI Chat Completion message format. */ export declare function reconstructThreadOutput(threadData: ThreadData, originalOutput: unknown): OpenAIMessage[]; //# sourceMappingURL=thread-reconstruction.d.ts.map