import { SqliteConnection } from "./connection.js"; //#region src/embedding-meta-repo.d.ts /** * Registry row in the `embedding_meta` table. Captures every embedder * the database has ever indexed against - both the default and any * legacy / migrated peers - together with the names of the per-embedder * vec0 tables that store the actual vectors per memory tier. * * @stable */ interface EmbeddingMetaRow { /** Canonical id, `':@'`. */ readonly id: string; /** Adapter family - `'transformersjs'`, `'ollama'`, `'openai'`, `'custom'`, …. */ readonly embedderKind: string; readonly model: string; readonly dim: number; readonly distanceMetric: 'cosine' | 'dot' | 'euclidean'; readonly configHash: string; /** * Write-path contextualization recipe the index was built with - * e.g. `'late-chunk'`, `'off'`, `'late-chunk+llm'`. * Part of the index version key: a different mode means the stored * vectors were computed from differently contextualized text, which * is as incompatible as a different model. `null` marks a legacy row * registered before the column existed; it adopts the caller's mode * on the next `registerOrReturn`. */ readonly indexMode: string | null; /** Lazy-created vec0 table for facts. */ readonly vecTableFacts: string; /** Lazy-created vec0 table for episodes. */ readonly vecTableEpisodes: string; /** Lazy-created vec0 table for session messages. */ readonly vecTableMessages: string; readonly createdAt: number; readonly retiredAt: number | null; readonly notes: string | null; } /** * Lock-on-first conflict - registering a second active embedder for an * already-locked database fails fast with this error pointing at * `graphorin memory migrate` (Phase 15). * * @stable */ declare class EmbedderLockOnFirstError extends Error { readonly name = "EmbedderLockOnFirstError"; } /** * Read access for unknown `embedder_id` - the runtime fails fast on * any record write that references an unregistered embedder. * * @stable */ declare class UnknownEmbedderIdError extends Error { readonly id: string; readonly name = "UnknownEmbedderIdError"; constructor(id: string); } /** * Multi-embedder coexistence policy. `'lock-on-first'` is the default - * the first registered embedder is the only writer; subsequent * different embedders must run a migration. `'multi-active'` allows * coexistence (read both, write to default). `'auto-migrate'` is a * Phase 16 hook (off in v0.1). * * @stable */ type EmbedderPolicy = 'lock-on-first' | 'multi-active' | 'auto-migrate'; /** * Registry repository: one instance per `SqliteConnection`. * * @stable */ declare class EmbeddingMetaRepository { #private; constructor(conn: SqliteConnection, policy?: EmbedderPolicy); /** Read-through cache lookup. */ get(id: string): EmbeddingMetaRow | null; /** Snapshot of every registered embedder. */ listAll(): readonly EmbeddingMetaRow[]; /** Snapshot of every active (non-retired) embedder. */ listActive(): readonly EmbeddingMetaRow[]; /** * Idempotent registration. Returns the existing row if one already * matches `(id, configHash)`; rejects the call if `lock-on-first` is * in effect and a different active embedder is already registered. */ registerOrReturn(input: RegisterEmbedderInput): EmbeddingMetaRow; /** Mark an embedder retired. Read-only after retirement. */ retire(id: string, retiredAt?: number): void; /** * Verify that the given `embedder_id` is registered. Used at every * write boundary so unknown ids fail fast. */ assertKnown(id: string): void; } /** * Input for {@link EmbeddingMetaRepository.registerOrReturn}. The * `embedder_id` is the canonical lookup key; `configHash` is a * deterministic hash over the embedder's full configuration. * * @stable */ interface RegisterEmbedderInput { readonly id: string; readonly embedderKind: string; readonly model: string; readonly dim: number; readonly distanceMetric?: 'cosine' | 'dot' | 'euclidean'; readonly configHash: string; /** * Write-path contextualization recipe. When * supplied, it joins the index version key: a legacy `null` row * adopts it once, after which a different mode fails registration * exactly like a configHash change. Omitted = legacy caller, no * mode check. */ readonly indexMode?: string | null; readonly notes?: string | null; } /** * Translates an `embedder_id` like `'transformersjs:Xenova/multilingual-e5-base@768'` * into a SQL-safe slug used in vec0 table names. Letters / digits stay, * everything else becomes `_`. * * @stable */ declare function slugifyEmbedderId(id: string): string; //#endregion export { EmbedderLockOnFirstError, EmbedderPolicy, EmbeddingMetaRepository, EmbeddingMetaRow, RegisterEmbedderInput, UnknownEmbedderIdError, slugifyEmbedderId }; //# sourceMappingURL=embedding-meta-repo.d.ts.map