/** * Shared LLM client for classification, summarization, and generation tasks. * * Generalizes the pattern from activity-headline.ts into a reusable client * with in-memory caching, timeout, and heuristic fallback. */ export type LlmSource = "llm" | "heuristic"; export interface LlmRequest { /** Namespace for cache keys (e.g. "retro", "turn_summary", "classify_status") */ taskId: string; systemPrompt: string; userPrompt: string; /** Override default model. Use DEFAULT_GENERATION_MODEL for longer outputs. */ model?: string; /** Default 0.1 */ temperature?: number; /** Default 128 */ maxTokens?: number; /** Default 4000ms */ timeoutMs?: number; /** Default 12h. Set 0 to disable caching. */ cacheTtlMs?: number; } export interface LlmResponse { result: T; source: LlmSource; model: string | null; } export declare function resolveApiKey(): string | null; /** Reset cached key (for testing or key rotation). */ export declare function resetApiKeyCache(): void; /** * Call LLM for a text completion with automatic caching and heuristic fallback. * * @param request - The LLM request configuration * @param fallback - Heuristic fallback that produces a result when LLM is unavailable * @param parse - Optional transform on the raw LLM text (default: identity) */ export declare function callLlm(request: LlmRequest, fallback: () => string, parse?: (raw: string) => string | null): Promise>; /** * Call LLM expecting a JSON response. Parses and validates via the provided parser. * * @param request - The LLM request (systemPrompt should instruct JSON output) * @param parse - Parse raw JSON string into typed result, return null on failure * @param fallback - Heuristic fallback */ export declare function callLlmJson(request: LlmRequest, parse: (raw: string) => T | null, fallback: () => T): Promise>;