import { type ParserDepth, type RepositoryGraphEdge, type RepositoryGraphFreshness, type RepositoryGraphLimits, type RepositoryGraphNode, type RepositoryGraphSnapshot, type RepositoryGraphStore, type RepositoryIndexRequest, type RepositoryIndexResult, type RepositoryIndexer, type RepositoryLanguage, type SourceFreeCallFact, type SourceFreeExportFact, type SourceFreeImportFact, type SourceFreeReferenceFact, type SourceFreeStructuralRelationship, type SourceFreeSymbolFact } from '@neurcode-ai/contracts'; import { RepositoryGraphLockedError, SqliteRepositoryGraphStore, exportRepositoryGraphJson, legacyRepositoryGraphBackupPath, legacyRepositoryGraphPath, repositoryGraphBackupPath, repositoryGraphLockPath, repositoryGraphPath, type StoredGraphEdgeQuery, type StoredGraphNodeQuery } from './repository-graph-sqlite'; export interface IndexingAuthorityContext { readonly graphCoverageComplete: boolean; readonly pathInCoverage: (path: string) => boolean; readonly nodesOverflowed: boolean; readonly edgesOverflowed: boolean; readonly filesTruncated: boolean; } interface GraphQueryOptions { path?: string; symbol?: string; relationship?: RepositoryGraphEdge['type']; direction?: 'in' | 'out' | 'both'; limit?: number; } export interface RepositoryGraphQueryResult { seeds: RepositoryGraphNode[]; nodes: RepositoryGraphNode[]; edges: RepositoryGraphEdge[]; totalMatches: number; returnedMatches: number; limit: number; truncated: boolean; matchCounts: { total: { seeds: number; nodes: number; edges: number; }; returned: { seeds: number; nodes: number; edges: number; }; }; queryAuthority?: { authoritative: boolean; impactAuthority: string; reasonCodes: string[]; coverageAuthority?: RepositoryGraphSnapshot['coverageAuthority']; }; } export interface RepositorySourceAnalysis { supported: boolean; language: RepositoryLanguage; parserId: string | null; parserVersion: string | null; parserDepth: ParserDepth; symbols: SourceFreeSymbolFact[]; imports: SourceFreeImportFact[]; exports: SourceFreeExportFact[]; relationships: SourceFreeStructuralRelationship[]; references: SourceFreeReferenceFact[]; calls: SourceFreeCallFact[]; errors: string[]; limitations: string[]; } export declare function analyzeRepositorySource(input: { filePath: string; sourceText: string; contentHash?: string; limits?: Partial; includeSemanticCandidates?: boolean; }): RepositorySourceAnalysis; export declare class AtomicJsonRepositoryGraphStore implements RepositoryGraphStore { read(repoRoot: string): RepositoryGraphSnapshot | null; queryNodes(repoRoot: string, query?: StoredGraphNodeQuery): RepositoryGraphNode[]; queryEdges(repoRoot: string, query?: StoredGraphEdgeQuery): RepositoryGraphEdge[]; write(repoRoot: string, graph: RepositoryGraphSnapshot): void; withLock(repoRoot: string, operation: () => T): T; recover(repoRoot: string): RepositoryGraphSnapshot | null; } export type RepositoryGraphBackend = 'portable' | 'sqlite'; export type RepositoryGraphStoreMode = 'portable' | 'sqlite' | 'auto'; export interface QueryableRepositoryGraphStore extends RepositoryGraphStore { queryNodes(repoRoot: string, query?: StoredGraphNodeQuery): RepositoryGraphNode[]; queryEdges(repoRoot: string, query?: StoredGraphEdgeQuery): RepositoryGraphEdge[]; } export interface RepositoryGraphStoreSelection { store: QueryableRepositoryGraphStore; backend: RepositoryGraphBackend; mode: RepositoryGraphStoreMode; reasonCode: string; } /** * Tracked-file count above which an unset NEURCODE_GRAPH_STORE resolves to * `auto` (probe-guarded SQLite) instead of portable JSON, so large repositories * transparently get the bounded-incremental fast path when native SQLite is * available (Scale V4 / D1c). At or below it, an unset store stays portable. */ export declare const AUTO_STORE_TRACKED_FILE_THRESHOLD = 1500; /** * Pure store-mode resolution. Explicit env always wins; an unset/unknown value * resolves to threshold-gated `auto` for large repos and `portable` otherwise. * Exposed separately so the threshold can be unit-tested without a working tree. */ export declare function resolveStoreModeForTrackedFiles(trackedFileCount: number, rawEnv?: string | undefined): RepositoryGraphStoreMode; export declare function resolveRepositoryGraphStoreMode(repoRoot?: string): RepositoryGraphStoreMode; export declare function selectRepositoryGraphStore(mode?: RepositoryGraphStoreMode): RepositoryGraphStoreSelection; export declare function createRepositoryGraphStore(mode?: RepositoryGraphStoreMode): RepositoryGraphStore; export declare function createQueryableRepositoryGraphStore(mode?: RepositoryGraphStoreMode): QueryableRepositoryGraphStore; /** * Read-path store selection. The size-based default (D1c) must never orphan a * graph that already exists in the other backend, so prefer the backend whose * artifact is actually on disk and only fall back to the resolved * (threshold-aware) mode when no graph has been written yet. */ export declare function resolveReadStoreSelection(repoRoot: string): RepositoryGraphStoreSelection; export declare class RepositoryGraphV2Indexer implements RepositoryIndexer { private readonly store; constructor(store?: RepositoryGraphStore); private tryBoundedSqliteIncremental; private streamColdSqlite; index(request: RepositoryIndexRequest): Promise; private indexLocked; status(repoRootInput: string): Promise; recover(repoRootInput: string): Promise; } export declare function readRepositoryGraph(repoRoot: string): RepositoryGraphSnapshot | null; export { readRepositoryGraphMetadata } from './repository-graph-metadata'; export declare function indexRepositoryGraph(request: RepositoryIndexRequest): Promise; export declare function repositoryGraphStatus(repoRoot: string): Promise; export declare function recoverRepositoryGraph(repoRoot: string): Promise; export declare function queryStoredRepositoryGraphNodes(repoRoot: string, query?: StoredGraphNodeQuery): RepositoryGraphNode[]; export declare function queryStoredRepositoryGraphEdges(repoRoot: string, query?: StoredGraphEdgeQuery): RepositoryGraphEdge[]; export { RepositoryGraphLockedError, SqliteRepositoryGraphStore, exportRepositoryGraphJson, legacyRepositoryGraphBackupPath, legacyRepositoryGraphPath, repositoryGraphBackupPath, repositoryGraphLockPath, repositoryGraphPath, }; export type { StoredGraphEdgeQuery, StoredGraphNodeQuery }; export declare function explainRepositoryGraph(graph: RepositoryGraphSnapshot, query: string, limit?: number): RepositoryGraphNode[]; export declare function queryRepositoryGraph(graph: RepositoryGraphSnapshot, options: GraphQueryOptions): RepositoryGraphQueryResult; export declare const repositoryGraphV2Defaults: { limits: RepositoryGraphLimits; schemaVersion: "neurcode.repository-graph.v2.1"; analyzers: { language: RepositoryLanguage; parserId: string; parserVersion: string; depth: ParserDepth; }[]; }; //# sourceMappingURL=repository-graph-v2.d.ts.map