/** * EmbeddingProvider interface and NoopEmbeddingProvider. * * The Noop provider returns null embeddings and enables FTS5-only mode * when no embedding backend is configured. */ export interface EmbeddingVector { values: Float32Array; dimensions: number; model: string; } export interface EmbeddingProvider { readonly name: string; readonly dimensions: number; readonly model: string; embed(texts: string[]): Promise; isAvailable(): Promise; } export class EmbeddingError extends Error { constructor(message: string) { super(message); this.name = 'EmbeddingError'; } } /** * NoopEmbeddingProvider — always returns empty results. * Used as the default when no provider is configured; the system * falls back gracefully to FTS5-only search. */ export class NoopEmbeddingProvider implements EmbeddingProvider { readonly name = 'noop'; readonly dimensions = 0; readonly model = 'none'; async embed(_texts: string[]): Promise { return []; } async isAvailable(): Promise { return false; } }