Skip to main content

Module pty

Module pty 

Source
Expand description

/pty/* — terminal session routes (web-UI integrated terminal, VS Code, SDK clients). Freeze parity: shapes captured live against opencode 1.18.31 (2026-10-08, bench/pty/PTY-PLAN.md).

Routes: GET /pty/shells → Shell[] (no process spawned) GET /pty → Info[] (running only — legacy surface) POST /pty → Info (spawns; login shells get -l) GET /pty/{id} → Info | 404 tag | 400 Params envelope PUT /pty/{id} → Info (title/size; PATCH not a route) DELETE /pty/{id} → true POST /pty/{id}/connect-token → {ticket,expires_in} (header + origin gated) GET /pty/{id}/connect → websocket: replay → meta([0x00]JSON) → live; close 4404 on not-found/exited

Structs§

ConnectQuery

Functions§

connect
GET /pty/{id}/connect — websocket. Upstream: if a ticket is presented it must consume; if not, allowed origins only. Then attach, replay (64 KiB chunks), meta frame [0x00 + {“cursor”:N}], live streaming; close code 4404 when the session is not-found/exited.
connect_token
POST /pty/{id}/connect-token — upstream requires the marker header (x-opencode-ticket: 1) AND a permitted Origin, then the session must exist. Wrong header/origin → 403 tag; unknown id (after the gate) → 404.
create
get
get_shells
list
remove
update