Files
nexus/wiki/entities/GraphDaemon.md
2026-05-03 05:42:12 +08:00

70 lines
2.2 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: "GraphDaemon"
type: entity
entity_type: tool
tags:
- LSP
- code-intelligence
- semantic-graph
- TypeScript
sources:
- lsp-index-engineer.md
last_updated: 2026-04-29
---
## Overview
GraphDaemongraphd是 LSP/Index Engineer Agent 的核心图谱守护进程,负责协调多个 LSP 客户端并发运行,将异构语言服务器的响应转换为统一的语义图谱,为沉浸式代码可视化提供基础设施。默认要求 TypeScript 和 PHP 语言服务器生产就绪。
## Core Components
### LSP Client Management
- **LSPClients**`Map<string, LanguageClient>` — 管理 TypeScript、PHP、Go、Rust、Python 等多语言 LSP 客户端
- **Capabilities**`Map<string, ServerCapabilities>` — 存储各语言服务器的能力协商结果
### Graph State
- **Nodes**`Map<NodeId, GraphNode>` — 文件节点和符号节点
- **Edges**`Map<EdgeId, GraphEdge>` — contains/imports/calls/refs 关系边
- **Index**SymbolIndex — 符号索引,支持快速查询
### API Endpoints
- `/graph` — 返回完整图谱(< 100ms< 10k 节点)
- `/nav/:symId` — 符号导航(< 20ms 缓存 / < 60ms 未缓存)
- `/stats` — 系统统计信息
### WebSocket Server
- 实时推送图谱差异更新,延迟 < 50ms
### File Watching
- 文件变化监听和 Git hooks 触发增量更新
## Graph Schema
### Node Types
- `file` — 文件节点
- `module` — 模块节点
- `class` — 类符号
- `function` — 函数符号
- `variable` — 变量符号
- `type` — 类型符号
### Edge Types
- `contains` — 文件包含符号
- `imports` — 模块导入关系
- `extends` — 继承关系
- `implements` — 实现关系
- `calls` — 函数调用关系
- `references` — 符号引用关系
## Performance Targets
- /graph 端点:< 100ms< 10k 节点)
- /nav/:symId< 20ms缓存/ < 60ms未缓存
- WebSocket 延迟:< 50ms
- 内存使用:< 500MB
- 规模能力100k+ 符号无性能降级
## Connections
- [[GraphDaemon]] ← builds ← [[SemanticCodeGraph]]
- [[GraphDaemon]] ← orchestrates ← [[LSPOrchestrator]]
- [[GraphDaemon]] ← streams via ← [[WebSocket]]
- [[GraphDaemon]] ← indexes via ← [[nav.index.jsonl]]