import { BetterSqlite3Constructor } from "./driver-types.js"; import { CipherPeerMissingError, EncryptionCipher, EncryptionConfig, PassphraseResolver, cipherSelectionPragmas, loadCipherDriver, resolvePassphrase } from "./encryption/index.js"; import { SqliteBusyError, SqliteConnection, SqliteVecMissingError, WAL_HARDENING_PRAGMAS, WalCheckpointManager, openConnection, readPragma, readWalSize } from "./connection.js"; import { AuditDatabase, OpenAuditDatabaseOptions, openAuditDatabase } from "./audit-db.js"; import { SqliteAuthTokenStore } from "./auth-token-store.js"; import { SqliteCheckpointStore } from "./checkpoint-store.js"; import { ConflictAuditInput, ConflictAuditRow, ConflictPipelineDecision, ConflictPipelineStage, PendingConflictInput, PendingConflictRow, SqliteConflictStore } from "./conflict-store.js"; import { ConsolidatorRunFinish, ConsolidatorRunInput, ConsolidatorStatePatch, ConsolidatorStateRow, DlqBatchInput, DlqBatchRow, SqliteConsolidatorStateStore } from "./consolidator-store.js"; import { EmbedderLockOnFirstError, EmbedderPolicy, EmbeddingMetaRepository, EmbeddingMetaRow, RegisterEmbedderInput, UnknownEmbedderIdError, slugifyEmbedderId } from "./embedding-meta-repo.js"; import { VectorTableManager } from "./vector-table-mgr.js"; import { BatcherRow, EmbedderMigrationStateRepository, EmbedderMigrationStateRow, createMigrationBatcher } from "./embedder-migration-support.js"; import { FtsIntegrityReport, checkFtsIntegrity, formatFtsIntegrityWarning, listCheckedFtsTables } from "./fts-integrity.js"; import { IdempotencyRecord, IdempotencyStore, SqliteIdempotencyStore } from "./idempotency-store.js"; import { EmbeddingPayload, SqliteEntityMergeRecord, SqliteEntityUpsertInput, SqliteEntityWithEmbedding, SqliteGraphStore, SqliteInsightStore, SqliteMemoryStore, SqliteMemoryWriteOptions } from "./memory-store.js"; import { Migration, listMigrations, registerMigration } from "./migrations/registry.js"; import { AppliedMigration, RunMigrationsOptions, pendingMigrations, runMigrations } from "./migrations/runner.js"; import { SqliteOAuthServerStore } from "./oauth-server-store.js"; import { SqlitePairingStore } from "./pairing-store.js"; import { SESSION_SCOPED_PURGES, SESSION_TABLE_EXEMPTIONS, SessionScopedPurge, SqliteSessionStore } from "./session-store.js"; import { SPAN_SESSION_ATTRIBUTE, createSqliteSpanExporter, deleteSpansForSession, pruneSpans, traceSourceForSession } from "./span-store.js"; import { SqliteSuspendedRunStore, SuspendedRunRecord, SuspendedRunStore } from "./suspended-run-store.js"; import { SqliteTriggerStore } from "./trigger-store.js"; import { SqliteNativeBindingError } from "./native-binding-error.js"; import { AuthTokenStore, CheckpointStoreExt, MemoryStoreExt, OAuthServerStore, PairingStore, SessionStoreExt, TriggerStore } from "@graphorin/core/contracts"; //#region src/index.d.ts declare const VERSION: string; /** * Both modes run on a single in-process connection with the mandatory * WAL-hardening pragmas (WAL journal mode, busy-timeout, etc.). * `'server'` additionally starts the periodic `wal_checkpoint(RESTART)` * manager automatically to bound WAL growth on long-running daemons; * `'lib'` starts it only when `walCheckpointIntervalMs` is set. * * @stable */ type SqliteStoreMode = 'lib' | 'server'; /** * Options passed to {@link createSqliteStore}. * * @stable */ interface CreateSqliteStoreOptions { /** SQLite path. Pass `':memory:'` for a transient in-memory database. */ readonly path: string; /** Default `'lib'`. */ readonly mode?: SqliteStoreMode; /** Default `'lock-on-first'` (DEC-116). */ readonly embedderPolicy?: EmbedderPolicy; /** Default `{ enabled: false }`. */ readonly encryption?: EncryptionConfig; /** * Periodic checkpoint cadence. Default `300_000` (5 min) in server * mode; off in library mode unless explicitly set. */ readonly walCheckpointIntervalMs?: number; /** * If `true`, do not load the `sqlite-vec` peer at open time. Useful * for tests that exercise migrations without the native build. */ readonly skipSqliteVec?: boolean; /** * Policy when the `sqlite-vec` peer is missing/broken. * `'fail'` (default) throws {@link SqliteVecMissingError}; * `'linear-fallback'` serves vectors from plain sidecar tables with * an in-process batched cosine scan. See * `OpenConnectionOptions.onMissingSqliteVec`. */ readonly onMissingSqliteVec?: 'fail' | 'linear-fallback'; /** Override constructor - test-only escape hatch. */ readonly driver?: BetterSqlite3Constructor; /** Override the `sqlite-vec` loader - test-only escape hatch. */ readonly loadVecExtension?: (db: unknown) => void; /** If `true`, skip the WAL hardening pragmas (only for `:memory:`). */ readonly disableWalHardening?: boolean; /** * Busy-handler wait for a contended write lock before the * operation fails with `SqliteBusyError`. Default `5000`. */ readonly busyTimeoutMs?: number; /** * Sink for non-fatal startup warnings - currently the FTS↔rowid * integrity check. Defaults to `console.warn`. */ readonly warn?: (message: string) => void; /** * If `true`, skip the open-time FTS integrity check. The check is a * cheap orphan-row scan; disable it only for very large stores where a * per-open scan is undesirable. */ readonly skipFtsIntegrityCheck?: boolean; /** * Optional cipher-driver loader override (test-only seam). See * `OpenConnectionOptions.cipherLoader`. * * @internal */ readonly cipherLoader?: () => Promise; } /** * Composite handle returned by {@link createSqliteStore}. * * @stable */ interface GraphorinSqliteStore { readonly memory: MemoryStoreExt; readonly checkpoints: CheckpointStoreExt; readonly sessions: SessionStoreExt; readonly triggers: TriggerStore; readonly pairing: PairingStore; readonly authTokens: AuthTokenStore; readonly oauthServers: OAuthServerStore; readonly idempotency: IdempotencyStore; /** * Durable suspended agent runs (migration 038): the server's * `RunStateTracker` persists `awaiting_approval` runs here so the * REST resume endpoint survives a process restart. */ readonly suspendedRuns: SuspendedRunStore; readonly embeddings: EmbeddingMetaRepository; readonly connection: SqliteConnection; readonly appliedMigrations: readonly AppliedMigration[]; /** * Store-side embedder-migration support - the * persisted resumable cursor over `migration_state`, the `nextBatch` * pager the `@graphorin/memory` runner consumes (structural match), * and the retired-vec-table space reclaim. */ readonly embedderMigration: { readonly state: EmbedderMigrationStateRepository; readonly nextBatch: ReturnType; dropRetiredVectorTables(): { readonly dropped: ReadonlyArray; }; }; /** Initialize the store: run migrations + start checkpoint manager. */ init(): Promise; /** Close the connection + stop the checkpoint manager. Idempotent. */ close(): Promise; } /** * Open a SQLite-backed Graphorin store. The returned object exposes * every contract implementation; call `init()` once before first use. * * @stable */ declare function createSqliteStore(options: CreateSqliteStoreOptions): Promise; //#endregion export { type AppliedMigration, type AuditDatabase, type BatcherRow, type BetterSqlite3Constructor, CipherPeerMissingError, type ConflictAuditInput, type ConflictAuditRow, type ConflictPipelineDecision, type ConflictPipelineStage, type ConsolidatorRunFinish, type ConsolidatorRunInput, type ConsolidatorStatePatch, type ConsolidatorStateRow, CreateSqliteStoreOptions, type DlqBatchInput, type DlqBatchRow, EmbedderLockOnFirstError, EmbedderMigrationStateRepository, type EmbedderMigrationStateRow, type EmbedderPolicy, EmbeddingMetaRepository, type EmbeddingMetaRow, type EmbeddingPayload, type EncryptionCipher, type EncryptionConfig, type FtsIntegrityReport, GraphorinSqliteStore, type IdempotencyRecord, type IdempotencyStore, type Migration, type OpenAuditDatabaseOptions, type PassphraseResolver, type PendingConflictInput, type PendingConflictRow, type RegisterEmbedderInput, type RunMigrationsOptions, SESSION_SCOPED_PURGES, SESSION_TABLE_EXEMPTIONS, SPAN_SESSION_ATTRIBUTE, type SessionScopedPurge, SqliteAuthTokenStore, SqliteBusyError, SqliteCheckpointStore, SqliteConflictStore, type SqliteConnection, SqliteConsolidatorStateStore, type SqliteEntityMergeRecord, type SqliteEntityUpsertInput, type SqliteEntityWithEmbedding, SqliteGraphStore, SqliteIdempotencyStore, SqliteInsightStore, SqliteMemoryStore, type SqliteMemoryWriteOptions, SqliteNativeBindingError, SqliteOAuthServerStore, SqlitePairingStore, SqliteSessionStore, SqliteStoreMode, SqliteSuspendedRunStore, SqliteTriggerStore, SqliteVecMissingError, type SuspendedRunRecord, type SuspendedRunStore, UnknownEmbedderIdError, VERSION, VectorTableManager, WAL_HARDENING_PRAGMAS, WalCheckpointManager, checkFtsIntegrity, cipherSelectionPragmas, createSqliteSpanExporter, createSqliteStore, deleteSpansForSession, formatFtsIntegrityWarning, listCheckedFtsTables, listMigrations, loadCipherDriver, openAuditDatabase, openConnection, pendingMigrations, pruneSpans, readPragma, readWalSize, registerMigration, resolvePassphrase, runMigrations, slugifyEmbedderId, traceSourceForSession }; //# sourceMappingURL=index.d.ts.map