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

34 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "graphd"
type: entity
tags: [project, lsp, code-intelligence]
last_updated: 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
```typescript
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