import type { Database as DatabaseType } from 'better-sqlite3'; import { type RepositoryGraphEdge, type RepositoryGraphFileState, type RepositoryGraphNode, type RepositoryGraphSnapshot, type RepositoryGraphStore } from '@neurcode-ai/contracts'; type SqliteConstructorOptions = { timeout?: number; readonly?: boolean; fileMustExist?: boolean; }; type SqliteConstructor = new (path: string, options?: SqliteConstructorOptions) => DatabaseType; export declare class NativeGraphStoreUnavailableError extends Error { readonly reasonCode: string; constructor(reasonCode: string); } /** * Real create → write → read → close → delete round trip on a throwaway database. * Cached per process. Never throws. Returns a source-free reason code on failure so the * caller can transparently fall back to the portable store and record why. */ export declare function probeNativeGraphStore(): { ok: boolean; reasonCode?: string; }; /** Reset the cached probe (tests only). */ export declare function resetNativeGraphProbeCacheForTests(): void; /** * Override the native constructor (tests only) to deterministically simulate an * absent, ABI-incompatible, or throwing native binary. Pass `null` to simulate the * module being unavailable; pass a constructor that throws to simulate an ABI mismatch. */ export declare function setSqliteConstructorForTests(ctor: SqliteConstructor | null): void; export declare function repositoryGraphPath(repoRoot: string): string; export declare function legacyRepositoryGraphPath(repoRoot: string): string; export declare function repositoryGraphBackupPath(repoRoot: string): string; export declare function legacyRepositoryGraphBackupPath(repoRoot: string): string; export declare function repositoryGraphLockPath(repoRoot: string): string; export declare class RepositoryGraphLockedError extends Error { readonly lockPath: string; constructor(lockPath: string); } export interface StoredGraphNodeQuery { path?: string; name?: string; kind?: string; packageKey?: string; serviceKey?: string; owner?: string; indexedBefore?: string; limit?: number; } export interface StoredGraphEdgeQuery { relationship?: string; fromId?: string; toId?: string; sourcePath?: string; packageKey?: string; serviceKey?: string; limit?: number; } /** Lightweight indexing head — metadata and file index without loading nodes/edges. */ export interface RepositoryGraphIndexingHead { generation: number; metadata: Omit; fileStates: Record; fileHashes: Record; nodeCount: number; edgeCount: number; storageSchemaVersion: number; } export interface BoundedIncrementalPatchInput { graph: RepositoryGraphSnapshot; nodes: RepositoryGraphNode[]; edges: RepositoryGraphEdge[]; fileStates: Record; deletedPaths: string[]; } export interface StoredStructuralPathRelationship { relationship: string; sourcePath: string; targetPath: string; } export declare class SqliteRepositoryGraphStore implements RepositoryGraphStore { private readonly streamingDatabases; beginStreamingWrite(repoRootInput: string): void; finishStreamingWrite(repoRootInput: string): void; read(repoRootInput: string): RepositoryGraphSnapshot | null; write(repoRootInput: string, inputGraph: RepositoryGraphSnapshot, unchanged?: { nodeIds: ReadonlySet; edgeIds: ReadonlySet; }): void; withLock(repoRootInput: string, operation: () => T): T; recover(repoRootInput: string): RepositoryGraphSnapshot | null; queryNodes(repoRootInput: string, query?: StoredGraphNodeQuery): RepositoryGraphNode[]; queryEdges(repoRootInput: string, query?: StoredGraphEdgeQuery): RepositoryGraphEdge[]; readIndexingHead(repoRootInput: string): RepositoryGraphIndexingHead | null; listIndexedFilePaths(repoRootInput: string): Set; readStructuralPathRelationships(repoRootInput: string): StoredStructuralPathRelationship[]; queryFileNodeAttributes(repoRootInput: string, filePath: string): RepositoryGraphNode['attributes'] | null; querySymbolsByNames(repoRootInput: string, names: string[]): RepositoryGraphNode[]; queryUnresolvedImportNodes(repoRootInput: string, limit?: number): RepositoryGraphNode[]; queryImportEdgesForResolvedPaths(repoRootInput: string, resolvedPaths: string[]): RepositoryGraphEdge[]; deleteFactsForPaths(repoRootInput: string, paths: string[]): void; pruneOrphanStructuralFingerprints(repoRootInput: string): void; writeBoundedIncrementalPatch(repoRootInput: string, patch: BoundedIncrementalPatchInput): void; /** * Atomically publish a fully-built staging database. Cold streaming builds use * a repository-local temporary root so a crash cannot expose partial rows. */ publishStaged(stagingRepoRootInput: string, targetRepoRootInput: string, graph: RepositoryGraphSnapshot): { nodeCount: number; edgeCount: number; graphBytes: number; }; databaseBytes(repoRootInput: string): number; integrityOk(repoRootInput: string): boolean; private migrateLegacyJson; } export declare function exportRepositoryGraphJson(repoRootInput: string, outputPath?: string): string | null; export declare function fingerprintStoredRepositoryGraph(repoRootInput: string): { fingerprint: string; nodeCount: number; edgeCount: number; fileCount: number; } | null; export {}; //# sourceMappingURL=repository-graph-sqlite.d.ts.map