/** * LLM Provider abstraction. * * Normalizes the interface across different LLM APIs so the agentic loop * doesn't care who generates the response. */ import Anthropic from '@anthropic-ai/sdk'; export interface ToolDefinition { name: string; description: string; input_schema: Record; } export interface ToolCall { id: string; name: string; input: Record; } export interface ToolResult { tool_use_id: string; content: string; is_error?: boolean; } export interface SystemBlock { type: 'text'; text: string; cache_control?: { type: 'ephemeral'; }; /** * Optional slot name so a caller can find and replace one block without knowing * its index (task 160 — mid-loop retrieval refresh). Providers read only `.text`, * so this never reaches the wire. */ id?: string; } export interface StreamEvent { type: 'text' | 'tool_use_start' | 'tool_use_complete' | 'done' | 'error'; text?: string; toolCall?: ToolCall; stopReason?: string; error?: string; usage?: { input_tokens: number; output_tokens: number; cache_read_input_tokens?: number; cache_creation_input_tokens?: number; }; } export interface LLMResponse { content: Anthropic.ContentBlock[]; stopReason: string; usage: { input_tokens: number; output_tokens: number; cache_read_input_tokens?: number; cache_creation_input_tokens?: number; }; } export interface ChatOptions { model: string; system: SystemBlock[]; messages: Anthropic.MessageParam[]; tools: ToolDefinition[]; maxTokens?: number; /** * How hard the model should think before answering, on the 3-level scale the * OpenAI-format endpoints understand. Already folded from cumulus's 5-level * `effort` setting by `resolveReasoningEffort` — providers put it on the wire, * they do not interpret it. */ reasoningEffort?: ReasoningEffort; onEvent?: (event: StreamEvent) => void; signal?: AbortSignal; } /** What the OpenAI-format endpoints accept. cumulus's own scale has five levels. */ export type ReasoningEffort = 'low' | 'medium' | 'high'; /** * Default for a thread that has never had an effort level chosen. * * Task 155 measured the alternative: sending nothing at all let the model think * without a ceiling, and on a hard prompt it spent the entire output allowance * thinking and produced no answer — 5 replies out of 10 attempts. At `medium`, * 6 of 6. `low` was 10 of 10 and 40% faster, but that is a thinking-quality * reduction applied to threads whose owner never asked for one. */ export declare const DEFAULT_REASONING_EFFORT: ReasoningEffort; /** * Fold cumulus's 5-level `effort` setting onto the 3 an OpenAI-format endpoint * understands. `xhigh`/`max` mean "more than high" and there is no more than * high on this wire, so they clamp rather than being dropped — dropping would * silently downgrade the most deliberate threads to the default. * * Pure and exported because the Claude CLI path spends the same setting on a * different flag, and the two must not drift. */ export declare function resolveReasoningEffort(effort?: string): ReasoningEffort; export interface LLMProvider { chat(options: ChatOptions): Promise; } export declare class AnthropicProvider implements LLMProvider { private client; constructor(apiKey?: string); chat(options: ChatOptions): Promise; private _streamChat; } //# sourceMappingURL=provider.d.ts.map