Files
nexus/wiki/sources/lsp-index-engineer.md
2026-05-03 05:42:12 +08:00

58 lines
4.6 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: "LSP/Index Engineer Agent Personality"
type: source
tags: []
date: 2026-04-29
---
## Source File
- [[Agent/agency-agents/specialized/lsp-index-engineer.md]]
## Summary用中文描述
- 核心主题LSP/Index Engineer Agent 是一款专注于语言服务器协议LSP客户端编排和语义索引构建的专业智能体通过协调多种语言的 LSP 服务器构建统一代码语义图谱。
- 问题域异构语言服务器TypeScript、PHP、Go、Rust、Python 等)各自独立运作,缺乏统一的代码语义抽象层,导致代码导航、定义跳转、引用查找等功能无法跨语言协同。
- 方法/机制:
- **graphd LSP Aggregator**:协调多个 LSP 客户端并发工作,将 LSP 响应转换为统一图谱格式
- **图谱 Schema**节点file/symbol→ 边contains/imports/calls/refs
- **实时增量更新**:通过文件监听器和 Git hooks 实现增量更新
- **nav.index.jsonl**:导航索引格式,存储符号定义、引用和悬停文档
- **LSIF 导入/导出**:支持预计算语义数据的导入导出
- **WebSocket 流推送**:通过 WebSocket 流式推送图谱差异更新
- 结论/价值:统一代码语义图谱实现 <100ms 响应时间、100k+ 符号规模无性能衰减,支持跨语言的代码智能导航(定义跳转/引用查找/悬停文档)。
## Key Claims用中文描述
- **graphd 统一语义图谱**:协调多个 LSP 客户端并发运行,将异构语言服务器响应转换为统一图谱 schema节点代表文件和符号边代表 contains/imports/calls/refs 关系。
- **nav.index.jsonl 导航索引**:通过 `nav.index.jsonl` 流式索引格式存储每个符号的 `symId`、定义位置uri/l/c和引用列表实现快速符号查找。
- **LSP 3.17 严格合规**:严格遵循 LSP 3.17 规范进行客户端通信正确处理能力协商和生命周期管理initialize → initialized → shutdown → exit
- **性能约束量化**:图谱端点 <100ms<10k 节点)、符号导航 <20ms缓存/ <60ms未缓存、WebSocket 延迟 <50ms、内存 <500MB。
- **原子图谱更新**:图谱更新必须是原子性的,确保图谱状态永远不会处于不一致状态。
## Key Quotes
> "Build the graphd LSP Aggregator — Orchestrate multiple LSP clients (TypeScript, PHP, Go, Rust, Python) concurrently, transform LSP responses into unified graph schema." — 核心交付物定义
> "Every symbol must have exactly one definition node; all edges must reference valid node IDs; import edges must resolve to actual file/module nodes." — 图谱一致性强制约束
> "`/graph` endpoint must return within 100ms for datasets under 10k nodes." — 性能合约
## Key Concepts
- [[LanguageServerProtocol]]LSP 3.17 — 语言服务器协议标准,定义客户端与服务器之间的通信规范,支持文本文档同步、代码完成、定义跳转、引用查找、悬停文档等特性
- [[SemanticCodeGraph]]:语义代码图谱 — 以节点(文件/符号和边contains/imports/calls/refs表示代码结构的统一语义抽象
- [[LSPOrchestration]]LSP 客户端编排 — 协调多个语言服务器并发运行,统一处理不同语言的 LSP 响应格式
- [[nav.index.jsonl]]:导航索引格式 — JSONL 流式索引文件,每行包含 `symId`(符号 ID`def`(定义位置)、`refs`(引用列表)、`hover`(悬停文档)
- [[LSIF]]Language Server Index Format — 预计算语义数据的标准化格式,支持导入导出
- [[IncrementalGraphUpdate]]:增量图谱更新 — 通过文件监听器和 Git hooks 实现增量更新,而非全量重建
## Key Entities
- [[GraphDaemon]]graphd — 核心图谱守护进程HTTP 服务器提供 `/graph``/nav/:symId``/stats` 端点WebSocket 服务器推送实时图谱更新
- [[TypeScriptLanguageServer]]TypeScript 语言服务器 — graphd 默认要求生产就绪的语言服务器之一
- [[Intelephense]]PHP Intelephense — PHP 语言服务器graphd 默认要求生产就绪的语言服务器之一
## Connections
- [[GraphDaemon]] ← builds ← [[SemanticCodeGraph]]
- [[GraphDaemon]] ← orchestrates ← [[LSPOrchestration]]
- [[GraphDaemon]] ← streams via ← [[WebSocket]]
- [[SemanticCodeGraph]] ← format ← [[nav.index.jsonl]]
- [[SemanticCodeGraph]] ← import/export ← [[LSIF]]
- [[IncrementalGraphUpdate]] ← triggers ← [[FileWatcher]]
## Contradictions
- 无已知冲突页面。该页面为独立的专业 Agent 规范文档,未涉及其他 Wiki 页面中相矛盾的观点。