/** * Zoe Core — Config Utilities * * Config loading, merging, and environment overrides. * Chalk-free — suitable for all adapters (CLI, SDK, Server). */ import { ProviderType } from '../providers/types.js'; export interface AppConfig { provider?: ProviderType; apiKey?: string; baseUrl?: string; model?: string; models?: { 'openai-compatible'?: { apiKey: string; baseUrl: string; model: string; }; openai?: { apiKey: string; model: string; }; anthropic?: { apiKey: string; model: string; }; glm?: { apiKey: string; model: string; }; }; imageApiKey?: string; imageBaseUrl?: string; imageModel?: string; imageSize?: string; imageQuality?: string; imageStyle?: string; imageN?: number; smtpHost?: string; smtpPort?: string; smtpUser?: string; smtpPass?: string; smtpFrom?: string; tavilyApiKey?: string; autoConfirm?: boolean; permissionLevel?: "strict" | "moderate" | "permissive"; feishuWebhook?: string; feishuKeyword?: string; dingtalkWebhook?: string; dingtalkKeyword?: string; wecomWebhook?: string; wecomKeyword?: string; } /** * Returns the config file path for the given scope. */ export declare function getConfigPath(global?: boolean): string; /** * Returns the config directory path for the given scope. */ export declare function getConfigDir(global?: boolean): string; /** * Returns both global and local config paths. */ export declare function getConfigPaths(): { global: string; local: string; globalDir: string; }; /** * Load and parse a JSON config file. * Returns `{ config, warning }` — warning is set if parsing failed. */ export declare function loadJsonConfig(filePath: string): { config: AppConfig; warning?: string; }; /** * Load global and local configs and merge them. * Priority: local > global. */ export declare function loadMergedConfig(): AppConfig; /** * Apply environment variable overrides to the merged config. * Env vars take priority over JSON config for tool settings. * Also injects provider API keys from env vars into the models map. */ export declare function applyEnvOverrides(config: AppConfig): AppConfig; /** * Auto-migrate legacy config format (top-level apiKey/baseUrl/model) to the * models map format used by the current architecture. */ export declare function migrateLegacyFormat(config: AppConfig, options?: { model?: string; }): AppConfig; /** * Resolve the active provider type from CLI flags, env vars, and config. * Checks LLM_PROVIDER env var as a standard alias for ZOE_PROVIDER. */ export declare function resolveActiveProviderType(config: AppConfig, options?: { provider?: string; }): ProviderType; /** * Save config to disk. If a local config exists, saves there; otherwise global. */ export declare function saveConfig(config: AppConfig): void; /** * Save config to a specific path. * Throws on failure — callers handle error display. */ export declare function writeConfigToPath(config: AppConfig, targetFile: string): void; /** * Mask a secret string for display, showing only first 3 and last 4 chars. */ export declare function maskSecret(secret?: string): string;