nemo_gym.sandbox.providers.opensandbox.pty
nemo_gym.sandbox.providers.opensandbox.pty
execd PTY sessions over the OpenSandbox server proxy.
Speaks execd’s documented PTY wire protocol directly: the
released OpenSandbox SDKs expose no PTY API. Sessions live at
{base}/pty[/{session_id}[/ws]] where base is the sandbox’s execd
endpoint as resolved by the SDK (through the server proxy when
use_server_proxy is set).
execd sends the exit frame and closes the socket concurrently with its output pumps, so a clean EOF means the socket drained, not that every byte the process wrote was delivered. Callers that need the tail should have the command emit a sentinel and read until it appears.
Module Contents
Classes
Functions
Data
API
One live PTY WebSocket. Created via :func:open_pty_session.
True once the session can no longer run commands: after close(),
or once the connection pump has ended (process exit, takeover eviction,
or connection loss). Resources are released by close().
Sole reader of the session’s sockets; fans frames out to queue/future.
A socket that dies while the process still runs (proxy shed, connection
loss) is re-dialed with since=<bytes received>, so pending reads and
execs continue across the gap. A deliberate takeover, a protocol error,
an exit, or close() ends the session instead.
Drain one WebSocket until it closes, fanning frames out.
Re-dial the session’s WebSocket, resuming from the last received byte.
Rewrite env/user into the command: execd’s PTY create accepts only
cwd and command.
Attach to an existing execd PTY session. Owns client as above.
Create an execd PTY session and attach its WebSocket.
Owns client: it is closed on failure and by session.close().