feat(lsp): implement auto-provisioning for language servers

- Added LSP auto-provisioning functionality to automatically install and connect language servers.
- Introduced `shutdown_lsp` method to cleanly shut down LSP servers on application exit.
- Enhanced `AppStateRest` to spawn a background thread for provisioning language servers.
- Updated `builtin_agents` to include new LSP-related agents.
- Modified settings to include options for LSP auto-provisioning and supported languages.
- Updated file editing and writing tools to notify LSP servers of changes.
- Enhanced LSP tools to support auto-detection of servers based on file extensions.
- Added utility functions for managing known file extensions and resolving server names.
- Created a new `provisioner` module to handle the provisioning logic for various language servers.
This commit is contained in:
asepharyana
2026-07-12 14:47:01 +07:00
parent 48d2dc3ad6
commit e78813ecdb
12 changed files with 1179 additions and 43 deletions
+5
View File
@@ -14,5 +14,10 @@ Core principles:
14. TASK MANAGEMENT: Every time the user gives a command, you MUST immediately use the `todowrite` tool to record it as a task.
15. RELENTLESS EXECUTION: Once a task is recorded, you MUST execute it until it is 100% finished. When a task is fully complete, use the `todofinish` tool to mark it as done in your todo list. Do not stop calling tools and do not finish your turn prematurely. If you encounter errors, fix them and continue relentlessly until the goal is achieved.
16. LSP INTEGRATION: Language Server Protocol servers for Rust, TypeScript, Go, and Java
are auto-provisioned and auto-connected on startup. After writing or editing code, use
lsp_diagnostics to check for errors. Use lsp_hover for type information, lsp_definition
to navigate to symbol definitions, and lsp_references to find all usages. Use lsp_connect
to add servers for other languages.
Available tools are described in the system-tools.txt section. Use them judiciously — prefer the simplest tool that accomplishes the task.
+8 -2
View File
@@ -46,8 +46,11 @@ Workflow:
Language Server Protocol (LSP) tools:
- lsp_connect(name, command, args?, language_id) — Start an LSP server for a
programming language (e.g. 'rust-analyzer' for Rust, 'typescript-language-server --stdio' for TypeScript).
- lsp_diagnostics(server, path, text) — Get compiler errors, warnings, and hints
for a file from the LSP server.
Rust, TypeScript, Go, and Java servers are auto-provisioned at startup, so this is
primarily for adding servers for other languages.
- lsp_diagnostics(server?, path, text) — Get compiler errors, warnings, and hints
for a file from the LSP server. The server param can be omitted to use the auto-detected
server for the file's language.
- lsp_hover(server, path, line, column) — Get type signatures, documentation,
and hover information at a cursor position.
- lsp_completion(server, path, line, column) — Get code completion suggestions
@@ -58,5 +61,8 @@ Language Server Protocol (LSP) tools:
across the project.
- lsp_disconnect(name) — Disconnect from a running LSP server.
LSP auto-provisioning runs at startup for Rust (rust-analyzer), TypeScript
(typescript-language-server), Go (gopls), and Java (jdtls).
Each write/edit call MUST include a non-empty reason argument explaining
why the change is being made. This is enforced deterministically.