pub(super) async fn handle_pty_shell_create(
__arg0: State<AppState>,
__arg1: Json<PtyShellCreateRequest>,
) -> impl IntoResponseExpand description
POST /api/v1/ptyshell/create — attach to (creating if needed) “this
pane’s one shell.”
Reuses the same sub-block a human’s composer-drawer shell already uses
or will use (META_KEY_SHELL_SUBBLOCK_ID), in either direction: if the
human already opened the drawer, the agent joins that exact PTY — same
scrollback, same live output. If nothing exists yet, this creates it
(the same view: "term", controller: "shell" headless-sub-block shape
createsubblock’s WS handler builds for AgentShellSubblock.tsx) and
persists the pointer, so a drawer opened afterward attaches to what
the agent already started instead of spawning a second, independent
shell. Either way, resync_controller runs before returning — unlike
the WS path (which waits for a frontend to mount a term view and call
ControllerResyncCommand), the PTY is live the moment this call
returns; a UI viewer for it is optional, not a prerequisite.