/** * GraphSearch - Search and neighborhood expansion for the knowledge graph * * Provides in-memory search across entities, observations, and relations. * Supports substring matching with future extensibility for full-text/embeddings. */ import type { Entity, EntityId, GraphSearchOptions, GraphSearchResult, GraphSnapshot, NeighborhoodResult, Observation, Relation } from '../../types/graph.js'; export interface EntityMatch { entity: Entity; score: number; matchedIn: ('name' | 'type' | 'attrs')[]; } export interface ObservationMatch { observation: Observation; score: number; } /** * Performs a search across the graph * * @param snapshot Graph snapshot to search * @param options Search options * @returns Search results */ export declare function searchGraph(snapshot: GraphSnapshot, options: GraphSearchOptions): GraphSearchResult; /** * Expands the neighborhood around given entity IDs * * @param snapshot Graph snapshot * @param entityIds Center entity IDs * @param depth How many hops to expand (1 or 2) * @returns Entities and relations in the neighborhood */ export declare function expandNeighborhood(snapshot: GraphSnapshot, entityIds: EntityId[], depth: 1 | 2): { entities: Entity[]; relations: Relation[]; }; /** * Gets full neighborhood result for a single entity */ export declare function getEntityNeighborhood(snapshot: GraphSnapshot, entityId: EntityId, depth: 1 | 2): NeighborhoodResult | null; /** * Finds an entity by name or ID */ export declare function findEntity(snapshot: GraphSnapshot, nameOrId: string): Entity | null; /** * Gets all observations for an entity */ export declare function getEntityObservations(snapshot: GraphSnapshot, entityId: EntityId): Observation[]; /** * Gets all relations where an entity is the source or target */ export declare function getEntityRelations(snapshot: GraphSnapshot, entityId: EntityId): { outgoing: Relation[]; incoming: Relation[]; }; /** * Builds a name-to-ID lookup map from a snapshot */ export declare function buildNameToIdMap(snapshot: GraphSnapshot): Map; export interface DetailedSearchResult { entityMatches: EntityMatch[]; observationMatches: ObservationMatch[]; } /** * Like `searchGraph` but returns raw scored matches instead of flattened * entity/observation arrays. Used by `get_targeted_context` to rank * pointers and build budgeted payloads. * * Does NOT modify `searchGraph`'s existing output. */ export declare function searchGraphDetailed(snapshot: GraphSnapshot, options: { query: string; limit?: number; }): DetailedSearchResult; //# sourceMappingURL=GraphSearch.d.ts.map