/** Which provider a set of settings selects. */ export type LLMProviderName = 'anthropic' | 'openai'; /** Non-secret settings, safe to keep in the project. */ export interface LlmProjectSettings { provider?: LLMProviderName; model?: string; baseUrl?: string; } /** Per-provider secrets, stored outside the project. */ export interface LlmCredentials { anthropic?: { apiKey?: string; }; openai?: { apiKey?: string; }; } /** Where a resolved value came from — surfaced in the UI so the key's origin is never a mystery. */ export type LlmSettingsOrigin = 'env' | 'env-file' | 'project-settings' | 'user-credentials' | 'default'; /** Default model per provider. Both are the current flagship at time of writing. */ export declare const DEFAULT_MODELS: Record; /** * Parse a `.env` file body into key/value pairs. * * Deliberately small: `KEY=value` per line, `#` comments, optional `export` * prefix, and single- or double-quoted values (escapes are only expanded * inside double quotes, matching the common dotenv behaviour). Anything more * elaborate belongs in a real shell, not a settings file. */ export declare function parseEnvFile(contents: string): Record; /** Read `/.env`, or an empty map when there is none. */ export declare function loadEnvFile(projectRoot: string): Record; export declare function projectSettingsPath(projectRoot: string): string; export declare function loadLlmProjectSettings(projectRoot: string): LlmProjectSettings; export declare function saveLlmProjectSettings(projectRoot: string, settings: LlmProjectSettings): void; /** * Where user credentials live. * * `MEMO_CREDENTIALS_PATH` overrides the default so CI, containers, and tests * can point somewhere other than the real home directory — without it, a key a * developer saved through the workbench would leak into their test runs. */ export declare function credentialsPath(): string; export declare function loadLlmCredentials(): LlmCredentials; /** * Store an API key for one provider, merging with any key already held for the * other. Written 0600 — this file is the one place MEMO persists a secret. */ export declare function saveLlmCredential(provider: LLMProviderName, apiKey: string): void; /** Forget the stored key for one provider. */ export declare function clearLlmCredential(provider: LLMProviderName): void; /** A resolved setting plus where it was found. */ export interface ResolvedLlmSettings { provider?: LLMProviderName; apiKey?: string; model: string; baseUrl?: string; /** Where the API key came from. `undefined` when there is no key. */ keyOrigin?: LlmSettingsOrigin; /** True when a key is available from any source. */ configured: boolean; } /** * Resolve provider settings across every layer. * * The chosen provider is whichever the project explicitly selects, or — absent * that — whichever has a usable key, Anthropic first. */ export declare function resolveLlmSettings(projectRoot?: string): ResolvedLlmSettings; /** * Settings safe to send to a browser client: everything except the key itself. * The workbench needs to know a key exists and where it came from — never its value. */ export interface LlmSettingsStatus { configured: boolean; provider?: LLMProviderName; model: string; baseUrl?: string; keyOrigin?: LlmSettingsOrigin; /** True when the key came from a file MEMO can overwrite. */ keyEditable: boolean; } export declare function llmSettingsStatus(projectRoot?: string): LlmSettingsStatus; //# sourceMappingURL=llm-settings.d.ts.map