feat: add server control commands (disable, enable, destroy)

Add /lsp-servers, /lsp-disable, /lsp-enable, and /lsp-destroy TUI commands.
Disabled servers are tracked in-memory per-extension-instance; the shared
daemon is never mutated by disable/enable. When all servers are disabled,
LSP tools are removed from the active tool set so the LLM won't attempt them.

Also adds a destroy_server daemon operation that kills running LspClient
entries by server ID or all entries.
This commit is contained in:
2026-04-30 09:48:01 -04:00
parent 7abe4efa02
commit e131e0e8cd
5 changed files with 237 additions and 3 deletions

View File

@@ -191,6 +191,24 @@ async function handle(req: DaemonRequest): Promise<DaemonResponse> {
};
return { id: req.id, ok: true, result };
}
case "destroy_server": {
// Manual Kill - Evict entries matching the server ID (or all if
// unspecified). This is explicitly destructive; the caller knows
// what it's doing.
const toDestroy = req.serverId
? Array.from(entries.values()).filter(
(e) => e.server.id === req.serverId,
)
: Array.from(entries.values());
for (const entry of toDestroy) {
evict(entry, "manual destroy");
}
return {
id: req.id,
ok: true,
result: { destroyed: toDestroy.map((e) => e.key) },
};
}
case "shutdown": {
// Acknowledge first, then tear down on next tick so the response
// has a chance to flush before we close listeners.