@runloop/api-client - v1.22.0
    Preparing search index...

    Class Pty

    Hierarchy

    • APIResource
      • Pty
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    _client: Runloop

    Methods

    • Looks up the PTY session identified by the path sessionname and either reconnects to the existing session or creates it if it does not yet exist. The session_name is a client-chosen session identifier, not an opaque server-issued ID. It must be non-empty (1..=256 chars) and use only ASCII letters, digits, '-' and ''. A newly created PTY session starts an interactive bash shell on the Devbox. Optional cols and rows query parameters apply an initial terminal size before any I/O; they must both be present and in the range 1..=1000 to take effect. The response returns a PtyConnectView containing connect_url (a server-relative path to the WebSocket data plane), idle_ttl_seconds (how long this session is retained after the last client disconnects), and the resulting cols/rows. The interactive terminal byte stream is exchanged over the WebSocket data plane and is not modeled in this OpenAPI contract; clients should connect to connect_url and exchange raw binary frames for terminal I/O. The single-attach contract is enforced when a client opens the WebSocket data plane, not on this bootstrap call: bootstrap always succeeds for a valid session_name, even if another client is currently attached. Rejection of a second concurrent attach happens at WebSocket upgrade time. If the active client disconnects, the session is preserved for the idle TTL so a later connect using the same session_name resumes the same shell. After the TTL expires, after an explicit close control action, or after the underlying Devbox lifecycle replaces the PTY process (such as through suspend/resume), a later request with the same session_name creates a fresh PTY session without the previous shell state.

      Parameters

      Returns APIPromise<Runloop.PtyConnectView>

    • Looks up the PTY session identified by the path sessionname and either reconnects to the existing session or creates it if it does not yet exist. The session_name is a client-chosen session identifier, not an opaque server-issued ID. It must be non-empty (1..=256 chars) and use only ASCII letters, digits, '-' and ''. A newly created PTY session starts an interactive bash shell on the Devbox. Optional cols and rows query parameters apply an initial terminal size before any I/O; they must both be present and in the range 1..=1000 to take effect. The response returns a PtyConnectView containing connect_url (a server-relative path to the WebSocket data plane), idle_ttl_seconds (how long this session is retained after the last client disconnects), and the resulting cols/rows. The interactive terminal byte stream is exchanged over the WebSocket data plane and is not modeled in this OpenAPI contract; clients should connect to connect_url and exchange raw binary frames for terminal I/O. The single-attach contract is enforced when a client opens the WebSocket data plane, not on this bootstrap call: bootstrap always succeeds for a valid session_name, even if another client is currently attached. Rejection of a second concurrent attach happens at WebSocket upgrade time. If the active client disconnects, the session is preserved for the idle TTL so a later connect using the same session_name resumes the same shell. After the TTL expires, after an explicit close control action, or after the underlying Devbox lifecycle replaces the PTY process (such as through suspend/resume), a later request with the same session_name creates a fresh PTY session without the previous shell state.

      Parameters

      • sessionName: string
      • Optionaloptions: RequestOptions<unknown>

      Returns APIPromise<Runloop.PtyConnectView>

    • Applies a PTY control operation to an existing session. The action field selects the operation; the other fields in PtyControlParams are interpreted only when they are relevant to the chosen action.

      resize: cols and rows are required and must each be in 1..=1000. A 0 or out-of-range value returns 400. The new winsize is applied to the PTY master and the kernel delivers SIGWINCH to the foreground process group.

      signal: signal is the POSIX signal name (for example 'SIGTERM', 'SIGHUP', 'SIGINT', 'SIGUSR1'). Unknown signal names return 400. The signal is delivered to the slave's foreground process group via killpg(2). If the shell has already exited and there is no foreground process group, returns 400.

      close: terminates the session. Sends SIGHUP to the foreground process group (best-effort; ignored if the shell has already exited) and drops the session from the server's session cache. A subsequent connect with the same session_name will create a fresh PTY session.

      Parameters

      Returns APIPromise<Runloop.PtyControlResultView>

    • Applies a PTY control operation to an existing session. The action field selects the operation; the other fields in PtyControlParams are interpreted only when they are relevant to the chosen action.

      resize: cols and rows are required and must each be in 1..=1000. A 0 or out-of-range value returns 400. The new winsize is applied to the PTY master and the kernel delivers SIGWINCH to the foreground process group.

      signal: signal is the POSIX signal name (for example 'SIGTERM', 'SIGHUP', 'SIGINT', 'SIGUSR1'). Unknown signal names return 400. The signal is delivered to the slave's foreground process group via killpg(2). If the shell has already exited and there is no foreground process group, returns 400.

      close: terminates the session. Sends SIGHUP to the foreground process group (best-effort; ignored if the shell has already exited) and drops the session from the server's session cache. A subsequent connect with the same session_name will create a fresh PTY session.

      Parameters

      • sessionName: string
      • Optionaloptions: RequestOptions<unknown>

      Returns APIPromise<Runloop.PtyControlResultView>