/** * hmem v2 — database connection, schema bootstrap, and migrations runner. * * Opens a better-sqlite3 handle in WAL mode, instantiates the locked v2 schema * (`schema-v2.sql`) on first open, stamps `schema_version.schema_major = '2'` * (Phase 6 sync gates push/pull on this value), and runs an append-only list of * forward migrations idempotently (mirrors v1's `schema_version`-keyed pattern). */ import Database from 'better-sqlite3'; /** * Thrown by openDb() when asked to open an existing **v1** store * (`memories`/`memory_nodes`). The v2 open path must never v2-stamp such a file — * doing so injects empty v2 tables next to the real v1 data and corrupts it into * an unreadable hybrid (v2 reads query `entries`, see 0 rows; real data sits unread * in `memories`). Symmetric corruption-prevention dual of HmemStore's v2-file guard * (commit 44fd3dc). Callers that can tolerate a v1 file (hooks, the MCP tool boundary) * catch this and no-op / surface a "run `hmem migrate`" hint; others let it propagate * as a clear fatal. */ export declare class V1FileError extends Error { constructor(message: string); } export declare function openDb(path: string): Database.Database; export declare function getSchemaMajor(db: Database.Database): string | null; export declare function runMigrations(db: Database.Database): void;