/** * Settings service — single entry point for the viewer's Settings tab and * the aidex_settings MCP tool. * * Reads and writes the user-facing configuration: * - Embeddings on/off + model + status (per project) * - LLM provider + API key + model (global, in ~/.aidex/llm.json) * - llm_send_code privacy switch (per project) * * Wraps the lower-level pieces from config.ts, store.ts, and the providers. */ import { type LlmBackend } from './config.js'; export interface ProviderOption { backend: LlmBackend; label: string; /** Common endpoint URL prefix the user is most likely to want. */ defaultEndpoint: string; /** Suggested models for this provider. */ suggestedModels: string[]; /** Does this provider need an API key? Ollama doesn't. */ needsKey: boolean; /** Conventional env-var name for this provider's key (used as placeholder hint). */ envVarName?: string; } export declare const PROVIDER_OPTIONS: ProviderOption[]; export interface EmbeddingsSettings { enabled: boolean; modelId: string | null; /** Cached vec count for this project. */ totalEmbeddings: number; /** Whether the embedding model is already on disk. */ modelCached: boolean; /** Available models from the registry. */ availableModels: Array<{ id: string; description: string; dim: number; license: string; }>; } export interface LlmSettings { /** Master switch — when false, LLM layer is off regardless of keys. */ enabled: boolean; /** Currently active resolved config (or null if disabled / none works). */ active: { backend: LlmBackend; endpoint: string; model: string; source: string; hasKey: boolean; /** When source==='env', the name of the env var. */ envVarName?: string; } | null; /** What's stored in ~/.aidex/llm.json (user-controlled). */ file: { endpoint: string | null; model: string | null; hasKey: boolean; /** Last 4 chars of a literal stored key, for masked display ("sk-...abc4"). */ keyTail: string | null; /** If the file points at an env var instead of a literal key. */ keyEnvName: string | null; }; /** Per-project privacy switch. */ sendCode: boolean; providers: ProviderOption[]; } export interface ProjectSettings { projectPath: string; embeddings: EmbeddingsSettings; llm: LlmSettings; /** Latest schema version this project has acknowledged. */ lastSeenVersion: string | null; currentVersion: string; } export declare function getSettings(projectPath: string): Promise; export interface SetSettingsPayload { enableEmbeddings?: boolean; embeddingModel?: string; /** Master switch for the LLM layer. When false, no provider is resolved. */ llmEnabled?: boolean; llmEndpoint?: string | null; llmModel?: string | null; llmApiKey?: string | null; llmSendCode?: boolean; } /** * Coerce an untrusted payload (e.g. from a WebSocket client) into a * SetSettingsPayload. Unknown keys are dropped, oversized strings rejected. * Throws Error with a user-readable message on invalid input. */ export declare function validateSetSettingsPayload(raw: unknown): SetSettingsPayload; export interface SetSettingsResult { success: boolean; indexed?: { embedded: number; durationMs: number; }; error?: string; } export declare function setSettings(projectPath: string, payload: SetSettingsPayload): Promise; export interface TestConnectionResult { ok: boolean; backend: LlmBackend | null; model: string | null; latencyMs: number | null; error?: string; } export declare function testLlmConnection(projectPath: string): Promise; export declare function markVersionSeen(): void; export declare function shouldShowUpdateNotification(): boolean; //# sourceMappingURL=settings.d.ts.map