import { ClsService } from "nestjs-cls"; import { LLMCallMetadata } from "../interfaces/llm-call-metadata.interface"; import { WebSocketService } from "../../websocket/services/websocket.service"; export declare const LLM_DUMP_EVENT = "llm:dump"; export interface LlmDumpEvent { callId: string; nodeName: string; agentName: string; model: string; provider: string; finalStatus: "success" | "error" | "partial"; errorMessage?: string; durationMs: number; totalTokens: { input: number; output: number; cached?: number; }; /** Monetary cost of the call from the per-tier config rates (0 when not computable). */ cost: number; finishReason?: string; reply: { content: string; toolCalls: Array<{ name: string; args: unknown; }>; }; } export interface DumpSessionStartParams { metadata?: LLMCallMetadata & Record; model: string; provider: string; temperature?: number; /** * Computes the call's monetary cost from its final token counts. Supplied by the * caller (which knows the model tier + config rates) so the dumper stays free of * cost/config concerns. Omitted ⇒ cost reported as 0. */ costFn?: (tokens: { input: number; output: number; cached?: number; }) => number; } export interface DumpInputs { systemPrompts: string[]; instructions: string; inputParams: Record; history: Array<{ role: string; content: string; }>; tools: Array<{ name: string; description: string; schema: unknown; }>; outputSchemaName: string; metadata?: Record; } export interface DumpResponse { content?: string; toolCalls?: Array<{ id: string; name: string; args: unknown; }>; tokenUsage?: { input: number; output: number; }; finishReason?: string; } export interface DumpCloseParams { finalStatus: "success" | "error" | "partial"; errorMessage?: string; errorStack?: string; totalTokens: { input: number; output: number; cached?: number; }; /** Monetary cost of the call (computed from the per-tier config rates by the caller). */ cost?: number; warnings?: string[]; parseFallbacks?: Array<"tool_calls" | "lenient" | "raw">; } export interface DumpSession { readonly isEnabled: boolean; recordInputs(inputs: DumpInputs): void; startIteration(kind: "tool-loop" | "final-structured", sentMessages: ReadonlyArray): void; recordResponse(response: DumpResponse): void; recordToolResult(toolCallId: string, tool: string, content: string): void; close(params: DumpCloseParams): void; } export declare class LLMCallDumper { private readonly cls?; private readonly webSocket?; private readonly logger; private readonly enabled; private readonly outputDir; constructor(cls?: ClsService, webSocket?: WebSocketService); startSession(params: DumpSessionStartParams): DumpSession; } //# sourceMappingURL=llm-call-dumper.service.d.ts.map