Overview
Theterminal channel provides multiplexed PTY terminal sessions. Multiple concurrent sessions can run over a single WebSocket connection.
Default terminal settings:
| Setting | Value |
|---|---|
| Shell | bash |
| TERM | xterm-256color |
| Columns | 80 |
| Rows | 24 |
Client to Server Messages
create
Create a new terminal session.
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | Yes | Unique identifier for this terminal session |
cols | integer | No | Terminal width in columns (default: 80) |
rows | integer | No | Terminal height in rows (default: 24) |
input
Send keyboard input to a terminal session.
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | Yes | Target terminal session |
data | string | Yes | Raw input data (include \n for Enter, \t for Tab, etc.) |
resize
Resize a terminal session. Send this when the user resizes their terminal UI.
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | Yes | Target terminal session |
cols | integer | Yes | New width in columns |
rows | integer | Yes | New height in rows |
close
Close a terminal session and terminate its process.
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | Yes | Terminal session to close |
Server to Client Messages
output
Terminal output data from the PTY.
| Field | Type | Description |
|---|---|---|
sessionId | string | Source terminal session |
data | string | Raw terminal output including ANSI escape codes |
close
Terminal session has ended (process exited).
| Field | Type | Description |
|---|---|---|
sessionId | string | Terminal session that closed |
exitCode | integer or null | Process exit code, or null if terminated by signal |