Files
nexus/wiki/entities/graphd.md
2026-04-21 00:02:55 +08:00

1.3 KiB
Raw Blame History

title, type, tags, last_updated
title type tags last_updated
graphd entity
project
lsp
code-intelligence
2026-04-20

Summary

graphd 是 LSP/Index Engineer 智能体构建的核心 LSP 聚合守护进程,通过并发编排多个语言服务器客户端实现统一代码语义图谱管理。

Core Components

  • LSP Client Pool:并发管理 TypeScript、PHP、Go、Rust、Python 等语言服务器客户端
  • Graph State维护节点files/symbols和边contains/imports/calls/refs的内存图谱
  • HTTP Server:提供 /graph、/nav/:symId、/stats 等 API 端点
  • WebSocket Server:通过流式图谱差异实现实时客户端更新
  • File Watcher:监听文件变化和 git 提交,触发增量图谱更新

Performance Targets

Metric Target
/graph response <100ms (<10k nodes)
/nav/:symId (cached) <20ms
/nav/:symId (uncached) <60ms
WebSocket latency <50ms
Memory usage <500MB

Architecture

interface GraphDaemon {
  lspClients: Map<string, LanguageClient>;
  graph: { nodes: Map<NodeId, GraphNode>; edges: Map<EdgeId, GraphEdge>; index: SymbolIndex };
  httpServer: { '/graph': GraphResponse; '/nav/:symId': NavigationResponse; '/stats': SystemStats };
  wsServer: { onConnection: WSClient; emitDiff: GraphDiff };
  watcher: { onFileChange: path => void; on