/** * Config / credential discovery for the LLM layer. * * Resolution order (first match wins): * 1. Per-project endpoint+model in projects.llm_endpoint / llm_model * 2. Env vars: ANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY * 3. aidex_global_guideline keys: llm.api_key, llm.endpoint, llm.model * 4. ~/.aidex/llm.json * 5. Local Ollama at http://localhost:11434 (probed) * * If nothing matches, the module stays in stub mode. */ export type LlmBackend = 'anthropic' | 'openai' | 'openrouter' | 'ollama' | 'custom' | 'huggingface'; export interface LlmCreds { backend: LlmBackend; apiKey: string | null; endpoint: string; model: string; /** Diagnostic: where this config came from. */ source: 'env' | 'guideline' | 'config-file' | 'ollama-default' | 'project'; /** Diagnostic: name of the env var when source==='env' or when file uses api_key_env. */ envVarName?: string; } export interface ResolveOptions { /** If supplied, project-level overrides take precedence over global settings. */ projectPath?: string; } export declare function resolveLlmCreds(opts?: ResolveOptions): Promise; /** Read the global LLM config file (~/.aidex/llm.json). */ export interface LlmConfigFile { /** Master switch. If false: LLM layer is disabled, no provider is resolved. */ enabled?: boolean; /** A literal API key (e.g. "sk-proj-..."). Mutually exclusive with api_key_env. */ api_key?: string; /** Name of an environment variable to read the key from (e.g. "OPENAI_API_KEY"). */ api_key_env?: string; endpoint?: string; model?: string; } /** * The "is LLM layer on?" decision. * * Backwards compatibility: existing users have no `enabled` field in their * file. If a key is resolvable (literal, api_key_env, or auto-detected ENV), * we treat them as "on" — so an update doesn't silently turn off LLM for * users who were already using it. New installs without any config end up * "off" by default. */ export declare function isLlmEnabled(): boolean; /** Pattern for valid env-var names: uppercase letter start, then [A-Z0-9_]. */ export declare const ENV_VAR_NAME_RE: RegExp; /** Detect whether a user-typed string looks like an env-var name vs. a real key. */ export declare function isEnvVarName(input: string): boolean; export declare function llmConfigPath(): string; export declare function readLlmConfigFile(): LlmConfigFile | null; export declare function writeLlmConfigFile(cfg: LlmConfigFile): void; /** Per-project lookup of the privacy switch llm_send_code. */ export declare function readLlmSendCode(projectPath: string): boolean; //# sourceMappingURL=config.d.ts.map