Skip to main content

Module shell

Module shell 

Source
Expand description

Network (fetch) and Shell / terminal methods + supporting types.

Ported from packages/core/src/agent-os.ts (fetch + shell methods) and runtime-compat.ts (ShellHandle, OpenShellOptions, ConnectTerminalOptions).

Id-vs-PID is load-bearing: open_shell returns a synthetic shell-N id; connect_terminal returns a PID and is NOT tracked in the shells map.

The native wire protocol has no PTY/winsize request, so a shell is modeled as a guest process spawned via [ExecuteRequest]: its process_id is what write_shell/close_shell address on the wire, while the public boundary keeps the synthetic shell-N id.

Stream routing mirrors the TS PTY path: the public data stream (on_shell_data) carries stdout and stderr in the order received from the sidecar. stderr is also delivered on an optional channel-specific diagnostic tap (on_shell_stderr + [OpenShellOptions::on_stderr]); terminal renderers consume only data so prompts and control sequences are neither reordered nor doubled.

Structsยง

ConnectTerminalOptions
Options for connect_terminal (extends OpenShellOptions).
OpenShellOptions
Callback-free options for portable open_shell.
ShellData
ShellExit
ShellHandle
The synthetic shell id returned by open_shell (shell-N, NOT a pid).