Desktop
A desktop task's screen, its notices and stored screenshots, and signing its browser out.
| Operation | Method and path |
|---|---|
| Watch a desktop task's screen (WebSocket) | GET /api/v1/conversations/{id}/screen |
| Sign the desktop's browser out everywhere | POST /api/v1/conversations/{id}/screen/sign-out |
| Read a task's screen notices | GET /api/v1/conversations/{id}/screen/notices |
| Read one stored screenshot | GET /api/v1/conversations/{id}/screenshots/{screenshot} |
Watch a desktop task's screen (WebSocket)
GET /api/v1/conversations/{id}/screen
The owner's live view of a desktop sandbox (ADR-0039 section 5): a WebSocket upgrade carrying the screen relay, view-only until this socket holds Take over. The page sends {"type": "take_over"} and {"type": "hand_back"} as text frames; the gateway's first text frame, and one on every change, is {"type": "control", "holder": "none" | "you" | "other"}. Take over belongs to the socket and ends when it closes. A request without a session or with a wrong Origin is refused before the upgrade (401, 403). Every other refusal upgrades and closes at once, before any screen data, with an application close code and the error code as the reason: 4403 forbidden, 4404 not_found, 4409 no_desktop, screen_viewers or sandbox_not_running (the task has no sandbox starting or live, also when it stops while open); a bridge that drops or doesn't come within 35 s while the sandbox lives (its runtime's link up, or redialling after a restart) closes 4409 screen_unavailable, which the page retries. A second tab's take_over while another holds the screen is refused without closing: it gets control{holder: other} again. Any other close code is a dropped connection.
Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string (uuid) | The task. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 101 | Switching to the WebSocket screen relay | |
| 401 | Authentication required | Error |
| 403 | A wrong or missing Origin | Error |
| 503 | Database unavailable or gateway restarting | Error |
Sign the desktop's browser out everywhere
POST /api/v1/conversations/{id}/screen/sign-out
Sign out everywhere (ADR-0039 section 6): empties the desktop's browser profile, never a desktop application's own sign-ins. Refused while a run is active, so the screen never changes under the agent; during Take over there is no run, so it works then. Answers 202 with no body: the outcome arrives as a screen notice, screen.signed_out, or screen.sign_out_failed with reason not_cleared (the runtime couldn't empty the profile) or unconfirmed (no answer within 10 s, or its link dropped).
Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string (uuid) | The task. |
Idempotency-Key | header | yes | string | A retried write with the same key answers the same. |
Request body
application/json: object
Responses
| Status | Meaning | Body |
|---|---|---|
| 202 | Accepted; the outcome follows as a screen notice | |
| 401 | Authentication required | Error |
| 403 | forbidden: conversation ownership is required (another person's task) | Error |
| 404 | not_found: no such task | Error |
| 409 | no_desktop: the task's environment has no desktop; run_active: a run is active | Error |
| 503 | Database unavailable or gateway restarting | Error |
Read a task's screen notices
GET /api/v1/conversations/{id}/screen/notices
The gateway's own transcript notices of the task's screen (ADR-0039's contract): the newest 100, oldest first. Each names the event seq it came after (after_seq), so a page places it in the transcript; the same notice arrives live as a screen.notice stream frame.
Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string (uuid) | The task. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The notices | ScreenNotices |
| 401 | Authentication required | Error |
| 403 | forbidden: conversation ownership is required (another person's task) | Error |
| 404 | not_found: no such task | Error |
| 503 | Database unavailable or gateway restarting | Error |
Read one stored screenshot
GET /api/v1/conversations/{id}/screenshots/{screenshot}
One screenshot from the task's store (ADR-0039 section 9), by the id its screen.capture event names. The owner only, as the transcript. Never cached: Cache-Control no-store, as every response.
Sign-in: A signed-in browser session only; an API token is refused with 403 session_required.
Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
id | path | yes | string (uuid) | The task. |
screenshot | path | yes | string | The store id from screen.capture. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The screenshot | string (binary) (image/png) |
| 401 | Authentication required | Error |
| 403 | forbidden: conversation ownership is required (another person's task) | Error |
| 404 | not_found: no such task, or a screenshot this task never stored | Error |
| 410 | screenshot_expired: the retention purge removed it; its event remains | Error |
| 503 | Database unavailable or gateway restarting | Error |