import type { IVectorStore } from '../memory/VectorStore.ts'; export interface SimilarPattern { pattern: string; score: number; } /** Marker row id recording the index format version. */ export declare const INDEX_VERSION_KEY = "__index_version__"; export declare const INDEX_CURRENT_VERSION = 2; /** * Persistent nearest-neighbor index over learned patterns. Rows live in the * LanceDB vectors table under `pattern:` keys derived from the pattern text, * so a repeated pattern upserts instead of accumulating duplicates. */ export declare class EmbeddingIndex { private readonly vectorStore; private readonly threshold; constructor(vectorStore: IVectorStore, threshold?: number); private patternKey; /** * Upserts a pattern embedding by its derived key and returns the stored key. */ storePattern(pattern: string, embedding: number[]): Promise; /** * Nearest neighbors above the similarity threshold, highest score first. * Empty when nothing clears the threshold. */ findSimilar(embedding: number[], threshold?: number, limit?: number): Promise; } /** * Re-embeds legacy LongTermMemory rows (written with zero vectors before the * index existed) as queryable `pattern:` rows, then writes the version marker. * Idempotent: pattern upserts make re-runs harmless, and the marker is only * written after every row was attempted. Throws when embedding fails, so the * caller can retry on the next process without a false-complete marker. */ export declare function reindexLegacyPatterns(index: EmbeddingIndex, store: IVectorStore, embed: (text: string) => Promise): Promise; //# sourceMappingURL=EmbeddingIndex.d.ts.map