/** * Knowledge Graph Module - Phase 1 Implementation * 知识图谱模块 - 实体关系管理 * * Based on design: memory/knowledge-graph-design-p1-2026-04-23.md */ export type EntityType = "person" | "project" | "concept" | "technology" | "company" | "location" | "event" | "document"; export type RelationType = "created_by" | "related_to" | "depends_on" | "mentions" | "part_of" | "derived_from" | "collaborates" | "implements"; export interface Entity { id: string; name: string; type: EntityType; aliases: string[]; description?: string; sourceIds: string[]; created: string; updated: string; } export interface Relation { id: string; sourceId: string; targetId: string; type: RelationType; weight: number; evidence: string[]; created: string; } export interface KnowledgeGraphIndex { entities: Entity[]; relations: Relation[]; entityNameIndex: Record; lastUpdate: number; } export declare function detectEntities(text: string): { name: string; type: EntityType; }[]; export declare function generateEntityId(type: EntityType): string; export declare function generateRelationId(): string; export declare function loadGraph(): Promise; export declare function saveGraph(graph: KnowledgeGraphIndex): Promise; export declare function addEntity(entity: Omit): Promise; export declare function addRelation(relation: Omit): Promise; export declare function queryEntity(idOrName: string): Promise; export declare function queryRelations(entityId: string): Promise; export declare function getNeighbors(entityId: string): Promise; export declare function exportMermaid(entityIds?: string[], maxDepth?: number): Promise; export declare function getGraphStats(): Promise<{ entityCount: number; relationCount: number; entityTypeCounts: Record; coverage: number; }>; declare const _default: { detectEntities: typeof detectEntities; addEntity: typeof addEntity; addRelation: typeof addRelation; queryEntity: typeof queryEntity; queryRelations: typeof queryRelations; getNeighbors: typeof getNeighbors; exportMermaid: typeof exportMermaid; getGraphStats: typeof getGraphStats; loadGraph: typeof loadGraph; saveGraph: typeof saveGraph; }; export default _default;