/** * Knowledge graph engine. * Business logic for BFS neighbor traversal and substring entity queries. * Delegates storage operations to IGraphStore. */ import type { Entity, Relation, TestCoverageResult } from "../utils/types.js"; import type { IGraphStore } from "../storage/interfaces.js"; /** Direction of relation relative to the center entity. */ export type RelationDirection = "outgoing" | "incoming"; /** A neighbor with its connecting relation and direction. */ export interface NeighborEntry { entity: Entity; relation: Relation; direction: RelationDirection; } /** Result from neighbors() traversal. */ export interface NeighborsResult { center: Entity; neighbors: NeighborEntry[]; } /** Result from query() search. */ export interface QueryResult { entities: Entity[]; } export declare class GraphEngine { /** * Readable so maintenance passes (engine/entity-scope-repair.ts) can walk * entities and relations directly without the engine growing a delegate * method per query shape. */ readonly graphStore: IGraphStore; constructor(graphStore: IGraphStore); /** Delegate entity creation/upsert to store. */ addEntity(input: { name: string; type: Entity["type"]; properties?: Record; }): Promise; /** Delegate relation creation to store. */ addRelation(input: { source: string; target: string; type: Relation["type"]; properties?: Record; }): Promise; /** * BFS neighbor traversal from a center entity. * Traverses both outgoing and incoming relations. * Depth is clamped to max 3. */ neighbors(entityIdOrName: string, depth?: number, relationTypes?: string[]): Promise; /** * Substring search across entity names and property values. * Case-insensitive. Optionally filtered by entity types. */ query(queryStr: string, entityTypes?: string[], limit?: number): Promise; /** * Check test coverage for decisions by looking at `tested_by` relations * on their affected files/symbols. */ getTestCoverage(decisions: Array<{ id: string; summary: string; affected_files: string[]; }>): Promise; /** Resolve an entity by ID or name. Returns undefined if not found. */ private resolveEntity; /** * Remove orphaned entities (entities with no relations). * Optionally filter by entity type. */ prune(entityTypes?: string[], dryRun?: boolean): Promise<{ pruned: Array<{ id: string; name: string; type: string; }>; total_orphans_found: number; total_removed: number; removed_relations: number; dry_run: boolean; }>; } //# sourceMappingURL=graph.d.ts.map