Skip to main content

Module shell_node

Module shell_node 

Source
Expand description

ShellNodeRunner — spawns a shell command and streams output to the frontend as shell_chunk MPS events scoped to the agent’s block.

Launched by handle_shell_create (server/mod.rs) via tokio::spawn. The runner is fire-and-forget; the HTTP handler returns the shell_id to the MCP caller immediately while output streams asynchronously.

Phase 2 of SPEC_PERSISTENT_SHELL_NODE_2026_06_11.md. Uses tokio::process::Command with captured pipes (no PTY in this phase; PTY support is a Phase 3 follow-up that requires portable-pty wiring similar to the existing ShellController).

Structs§

ShellEntry 🔒
ShellNodeCreateEvent
shell_node_create: a Shell command started, so the agent pane adds its row before the first chunk. Scoped block:<agent block>.
ShellNodeRunner
ShellSessionRegistry
ShellStatusInfo
Live status of a running (or recently exited) shell. Updated by ShellNodeRunner as output arrives and on exit.
ShellSummary
Snapshot of one currently-running shell for the Swarm pane’s per-agent long-running-process rows. See ShellSessionRegistry::list_active. Carries block_id (unfiltered list — same shape as subagent.ListActive/ ActiveSubagent.parent_block_id) so the Swarm pane’s buildTree() groups by block client-side in one pass, instead of one RPC call per tracked agent block.

Enums§

ShellChunkEvent
shell_chunk: one line a Shell command wrote, or its exit. Scoped shell:<shell_id>.

Constants§

MAX_EXITED_STATUS 🔒
Per-shell stop handles + status. ShellStop fires the oneshot; ShellInput sends to the stdin relay; ShellStatus reads the live status arc. Lives in AppState.shell_sessions. Max number of EXITED shell statuses retained for post-exit ShellStatus queries. Running shells are always kept regardless of this cap; only exited entries beyond it are evicted oldest-first. Bounds memory for long-lived sidecars that spawn many short shells.

Functions§

kill_tree 🔒
Kill the entire process tree rooted at pid. Child::kill / kill_on_drop only reap the wrapper shell (cmd /C / sh -c); a task dev spawns task.exe → cargo/node grandchildren that survive otherwise.
publish_chunk 🔒
publish_exit 🔒
shell_scopes 🔒