The TypeScript SDK wraps these WebSocket endpoints in higher-level abstractions.
Use
process.attach() to stream process I/O and sandbox.files.watch() to
watch the filesystem, rather than managing WebSocket connections directly. The
SDK handles reconnection, token refresh, and message parsing for you.Subprotocol and authentication
Every WebSocket upgrade request must offer thefissionplane.v1 subprotocol and a credential subprotocol. The server selects fissionplane.v1; credentials never appear in the URL.
Pass your capability token as a subprotocol in the upgrade request:
401 status.
All messages are JSON text frames. The client ignores unknown message types, so the protocol can gain new types without breaking older clients.
/processes//stream
Upgrades to a WebSocket for bidirectional process I/O. After connection, the server replays retained output since the requested sequence and then follows live output. Sending a disconnect does not stop the supervised process — reconnect later to resume. Connection URLinteger
required
The process ID returned by
POST /processes.integer
Replay output after this sequence number. Pass
0 (or omit) to receive all
retained output from the beginning. Pass the last sequence you observed to
resume from where you left off after a reconnect.Server → client messages
The server sends these JSON frames:string
required
Message type. One of
stdout, stderr, exit, or gap.integer
Monotonically increasing output sequence number. Store the highest value you
have seen for use as
after on reconnect.string
Output text. Present on
stdout and stderr messages.integer
Process exit code. Present on
exit messages. Negative values indicate the
process was killed by a signal.integer
Present on
gap messages only. The requested output starting from
from_sequence up to to_sequence is no longer retained. Treat the missing
range as lost and rescan or re-run as appropriate.exit message is delivered. For PTY processes, all output travels over stdout; there is no separate stderr stream.
Client → server messages
Send these JSON frames to interact with the process:string
required
Message type. One of
input, close_stdin, resize, or signal.string
Bytes to write to the process’s stdin. Present on
input messages. For PTY
processes this includes control sequences such as arrow keys and Ctrl-C.integer
New terminal dimensions for a
resize message. Valid only for PTY processes.
Send this whenever the user’s terminal window size changes.string
Signal name for a
signal message. For example "SIGINT", "SIGTERM", or
"SIGHUP".Example: connect and read output
/files/watch
Upgrades to a WebSocket that delivers inotify-based filesystem change events for a path inside the sandbox. Passrecursive=true to watch an entire directory tree. Connect with after=<sequence> to replay recently retained events after a reconnect.
Connection URL
string
required
The absolute path or home-relative path to watch.
boolean
Watch the path and all subdirectories. Defaults to
false.integer
Replay events after this sequence number. Pass the last sequence you observed
to resume from a reconnect without missing events.
Server → client messages
string
required
Event type. One of
created, modified, moved, removed, or overflow.integer
required
Monotonically increasing event sequence number. Store this for reconnect.
string
The affected path. Present on all events except
overflow.string
The kind of the affected path:
file, directory, symlink, or other.string
The previous path before a rename or move. Present only on
moved events.overflow event means the kernel inotify queue overflowed and some events were lost. When you receive one, rescan the entire watched path before relying on subsequent events — the watch continues but the in-between state is unknown.
The watch ends when the WebSocket closes. A disconnect does not cancel the underlying watch kernel-side; reconnect with after=<last-sequence> to resume while events remain retained.