import { SqliteConnection } from "./connection.js"; import { EmbeddingMetaRepository } from "./embedding-meta-repo.js"; import { VectorTableManager } from "./vector-table-mgr.js"; //#region src/embedder-migration-support.d.ts /** One persisted migration-state row (schema 001). */ interface EmbedderMigrationStateRow { readonly id: string; readonly sourceEmbedder: string; readonly targetEmbedder: string; readonly strategy: string; readonly status: 'running' | 'committed' | 'aborted' | 'failed'; readonly totalRecords: number; readonly processed: number; /** Composite resumable cursor: `:` (kind ∈ fact|episode|message). */ readonly lastRecordId: string | null; readonly startedAt: number; readonly finishedAt: number | null; readonly errorMessage: string | null; } /** * Persisted cursor store over `migration_state`. Structurally matches * the runner's `MigrationStateStoreLike` contract in * `@graphorin/memory` (the memory package never imports this class). * * @stable */ declare class EmbedderMigrationStateRepository { #private; constructor(conn: SqliteConnection); /** The most recent RESUMABLE row (running/aborted) for the pair, or null. */ findResumable(sourceEmbedder: string, targetEmbedder: string): Promise; /** Insert a fresh `running` row. */ create(state: { readonly id: string; readonly sourceEmbedder: string; readonly targetEmbedder: string; readonly strategy: string; readonly totalRecords: number; }): Promise; /** Advance / settle the row. */ update(id: string, patch: { readonly processed?: number; readonly lastRecordId?: string | null; readonly status?: EmbedderMigrationStateRow['status']; readonly errorMessage?: string | null; }): Promise; } /** Row shape handed to the runner (structural `MigrationRow`). */ /** * One row handed to the embedder-migration batcher by * `GraphorinSqliteStore.embedderMigration.nextBatch`. * * @stable */ interface BatcherRow { readonly id: string; readonly text: string; readonly write: (vector: Float32Array) => Promise; } /** * Build the store-side `nextBatch` hook for the migration runner * (structural `NextBatchHook`). Semantics: * * - `fact` pages live `facts` rows (id order), `episode` live * `episodes` rows; `message` returns end-of-stream immediately - * session-message vector search is not implemented, so there is * nothing to migrate. * - Every paged row re-embeds into the TARGET sidecar (created on * demand, mode-aware) and deletes any SOURCE sidecar row, then * flips the base row's `embedder_id` - so a fully-drained source * can be retired and its tables dropped. * * @stable */ declare function createMigrationBatcher(conn: SqliteConnection, embeddings: EmbeddingMetaRepository, vectorMgr: VectorTableManager): (args: { readonly kind: 'fact' | 'episode' | 'message'; readonly source: string; readonly target: string; readonly batchSize: number; readonly cursor: string | null; }) => Promise<{ readonly rows: ReadonlyArray; readonly nextCursor: string | null; }>; //#endregion export { BatcherRow, EmbedderMigrationStateRepository, EmbedderMigrationStateRow, createMigrationBatcher }; //# sourceMappingURL=embedder-migration-support.d.ts.map