import type { Provider, OperationType, RecordOptions } from '../core/types.js'; import { LedgerEngine } from '../core/engine.js'; /** * Options for the SDK wrapper middleware. */ export interface WrapperOptions { /** The ledger engine to record to */ ledger: LedgerEngine; /** Provider name */ provider: Provider; /** Default agent name */ agent?: string; /** Default session ID */ sessionId?: string; /** Default tags */ tags?: string[]; } /** * Generic result type from wrapped calls. */ export interface WrappedResult { /** The original SDK response */ response: T; /** The ledger entry ID */ entryId: string; /** The entry hash */ entryHash: string; } export interface AnthropicRequest { model: string; messages: Array<{ role: string; content: string; }>; system?: string; max_tokens?: number; [key: string]: unknown; } export interface AnthropicResponse { id: string; content: Array<{ type: string; text?: string; }>; model: string; usage?: { input_tokens: number; output_tokens: number; }; [key: string]: unknown; } /** * Wrap an Anthropic SDK `messages.create` call with ledger recording. * * Usage: * ```typescript * const ledger = new LedgerEngine(); * const wrap = createAnthropicWrapper({ ledger, provider: 'anthropic' }); * * const { response, entryId } = await wrap( * () => client.messages.create({ model: 'claude-sonnet-4-6', messages: [...], max_tokens: 1024 }), * { model: 'claude-sonnet-4-6', messages: [...] } * ); * ``` */ export declare function createAnthropicWrapper(options: WrapperOptions): (call: () => Promise, request: AnthropicRequest, extra?: { operation?: OperationType; tags?: string[]; metadata?: Record; }) => Promise>; export interface OpenAIRequest { model: string; messages: Array<{ role: string; content: string; }>; [key: string]: unknown; } export interface OpenAIResponse { id: string; choices: Array<{ message: { role: string; content: string | null; }; }>; model: string; usage?: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; [key: string]: unknown; } /** * Wrap an OpenAI SDK `chat.completions.create` call with ledger recording. */ export declare function createOpenAIWrapper(options: WrapperOptions): (call: () => Promise, request: OpenAIRequest, extra?: { operation?: OperationType; tags?: string[]; metadata?: Record; }) => Promise>; /** * Record any LLM call manually. For providers without SDK wrappers. */ export declare function createGenericRecorder(options: WrapperOptions): (params: RecordOptions) => import("../core/types.js").LedgerEntry; //# sourceMappingURL=wrapper.d.ts.map