Skip to main content

handle_pty_shell_read

Function handle_pty_shell_read 

Source
pub(super) async fn handle_pty_shell_read(
    __arg0: State<AppState>,
    __arg1: Json<PtyShellReadRequest>,
) -> impl IntoResponse
Expand description

POST /api/v1/ptyshell/read — read back the shell’s raw output tail.

Reads the block’s term file straight from FileStore — the same file blockcontroller::shell::lifecycle’s real PTY read loop write-throughs to (handle_append_block_file(..., "term", ..., filestore, ...), SPEC_TERMINAL_SCROLLBACK_PERSISTENCE_2026_07_23.md §2.1). Deliberately NOT the optimized blockfile:read_range path (byte-offset index, cross-channel global-transcript fallback, and a different filename — “output” — used for agent CLI transcripts, a different content stream entirely), which solves problems this endpoint doesn’t have: a PTY shell created through this API is always local and short-lived, so a plain whole-file read + in-memory tail is simpler and correct. This is a raw line log, not a rendered-screen snapshot — see the type’s own doc comment in api_types.rs.