import type { DiffReport, WatchConfig } from "../models.js"; export type AiProviderType = "anthropic" | "openai" | "gemini" | "custom"; export interface AiProvider { type: AiProviderType; /** API key - not required for "custom". */ apiKey?: string; /** Model override. Uses provider default when omitted. */ model?: string; /** * Base URL for OpenAI-compatible endpoints. * Examples: * Ollama → "http://localhost:11434/v1" * Mistral → "https://api.mistral.ai/v1" * Groq → "https://api.groq.com/openai/v1" * Together→ "https://api.together.xyz/v1" * Defaults to "https://api.openai.com/v1" when omitted. */ baseUrl?: string; /** Custom completion function - use any AI library or local model. */ callAi?: (prompt: string) => string | null | Promise; } export type AiErrorKind = "invalid_key" | "quota_exceeded" | "model_error" | "network_error" | "empty_response" | "unknown"; export declare class AiError extends Error { readonly kind: AiErrorKind; readonly statusCode?: number | undefined; constructor(message: string, kind: AiErrorKind, statusCode?: number | undefined); /** True when retrying on the next check interval makes sense. */ get isRetryable(): boolean; /** True when AI should be silently disabled for the rest of the session. */ get isPermanent(): boolean; } /** * Detect an AI provider from environment variables. * Priority: ANTHROPIC_API_KEY → OPENAI_API_KEY → GEMINI_API_KEY / GOOGLE_AI_API_KEY * * Set OPENAI_BASE_URL to point any OpenAI-compatible provider * (Ollama, Mistral, Groq, Together AI, LM Studio …). */ export declare function resolveProvider(): AiProvider | null; /** * Generate a natural-language summary for a DiffReport. * * If `provider` is omitted, falls back to auto-discovery via env vars. * Returns null when there are no meaningful changes to summarise. * Throws AiError on provider errors - callers should handle by kind. */ export declare function generateAiSummary(report: DiffReport, provider?: AiProvider, promptOverride?: string | ((report: DiffReport) => string | Promise)): Promise; /** Returns true when AI summaries are enabled and a provider is available. */ export declare function aiSummaryEnabled(config: WatchConfig): boolean; /** Returns the resolved provider for a config (explicit or from env). */ export declare function getProvider(config: WatchConfig): AiProvider | null; /** * Low-level: send a prompt to a provider and return the text response. * Use this to build custom summaries (e.g. for DbDiffReport). */ export declare function callProvider(prompt: string, provider?: AiProvider): Promise; //# sourceMappingURL=index.d.ts.map