feat(mcp): add close_session tool to close terminals and reclaim slots#335
Open
roba-adnew wants to merge 2 commits into
Open
feat(mcp): add close_session tool to close terminals and reclaim slots#335roba-adnew wants to merge 2 commits into
roba-adnew wants to merge 2 commits into
Conversation
Symmetric to spawn_session: close_session terminates a session's shell and removes its pane via the same close/relayout path as the close-pane keybinding (despawnSessionAtIndex), so the slot is reclaimed instead of left as a dead pane. - control.zig: CloseRequest/Response/Queue/Completion, not_found error code, op:"close" wire discrimination, connectAndSendCloseRequest, failPendingClose - runtime.zig: extract DespawnSession body into shared despawnSessionAtIndex, add handleExternalCloseRequest, drain a parallel close queue in the main loop - mcp/main.zig: register close_session in tools/list + tools/call - docs: README, ARCHITECTURE, ai-integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
close_sessionMCP tool — the symmetric counterpart to the existingspawn_session. Wherespawn_sessioncreates a terminal in a requested directory,close_sessionterminates a session's shell and removes its pane via the same close/relayout path as the close-pane keybinding (despawnSessionAtIndex), so the grid slot is reclaimed rather than left as a dead pane.API
Pass exactly one identifier — the
session_idreturned byspawn_session, or aslot_index:{ "session_id": 12 }On success it returns structured content with
status: "closed"and thesession_id. An unknown identifier returns an MCP tool error with codenot_found.Changes
src/app/control.zig—CloseRequest/Response/Queue/Completion,not_founderror code,op:"close"wire discrimination,connectAndSendCloseRequest,failPendingClose.src/app/runtime.zig— extract theDespawnSessionbody into a shareddespawnSessionAtIndex, addhandleExternalCloseRequest, drain a parallel close queue in the main loop.src/mcp/main.zig— registerclose_sessionintools/list+tools/call.Based directly on current
main— a single commit, no conflicts.