/** * Embedder resolution — the single provider-selection path shared by every * consumer (analyze, watch, orient, search_code, search_specs, generate, view). * * Kept in its own module (separate from `embedding-service.ts`) so the remote * `EmbeddingService` can be unit-mocked without also having to stub this shared * logic: `resolveEmbedder` calls the real (or mocked) `EmbeddingService` * internally, so a mock of `fromEnv`/`fromConfig` continues to drive it. */ import type { Embedder } from './embedding-service.js'; import type { OpenLoreConfig } from '../../types/index.js'; /** Honest, served retrieval mode — first-class keyword default or a semantic upgrade. */ export type RetrievalMode = 'keyword' | 'local-semantic' | 'remote-semantic'; /** * Resolve the active embedder from environment and config, in priority order: * 1. config `embedding.provider: 'local'` → on-device {@link LocalEmbeddingService} * (an explicit, just-written intent — e.g. `openlore embed --local` — wins over * ambient `EMBED_*` env so the command is never silently overridden) * 2. `EMBED_*` environment variables (remote OpenAI-compatible endpoint) * 3. config remote endpoint (`embedding.baseUrl` + `embedding.model`) * Returns null when nothing is configured — the first-class keyword (BM25) * default, never an error. Sharing one resolver means the configured provider is * honoured identically at build time and query time. * * Dependencies are imported dynamically (matching the rest of the codebase) so * the remote `EmbeddingService` stays unit-mockable via `vi.doMock`. */ export declare function resolveEmbedder(cfg?: OpenLoreConfig | null): Promise; /** * The retrieval mode implied by the active embedder: `keyword` when there is no * embedder, otherwise `local-semantic` / `remote-semantic` per its origin * (local-provider model names are prefixed `local:`). Used for honest, low-noise * mode reporting in query handlers and CLI summaries. */ export declare function embedderMode(embedSvc: Embedder | null | undefined): RetrievalMode; /** * The retrieval mode actually SERVED for a query — honest about what the index can * do, not just what is configured. Returns `keyword` whenever no embedder is * resolved OR the on-disk index has no vectors (e.g. it was built keyword-only, or * a local build fell back after a missing optional dependency), even if config * still names a semantic provider. `kind` selects which index sidecar to consult. */ export declare function servedRetrievalMode(embedSvc: Embedder | null | undefined, outputDir: string, kind?: 'code' | 'spec'): RetrievalMode; //# sourceMappingURL=embedder.d.ts.map