Skip to main content

Desktop

A desktop task's screen, its notices and stored screenshots, and signing its browser out.

OperationMethod and path
Watch a desktop task's screen (WebSocket)GET /api/v1/conversations/{id}/screen
Sign the desktop's browser out everywherePOST /api/v1/conversations/{id}/screen/sign-out
Read a task's screen noticesGET /api/v1/conversations/{id}/screen/notices
Read one stored screenshotGET /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

NameInRequiredTypeDescription
idpathyesstring (uuid)The task.

Responses

StatusMeaningBody
101Switching to the WebSocket screen relay
401Authentication requiredError
403A wrong or missing OriginError
503Database unavailable or gateway restartingError

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

NameInRequiredTypeDescription
idpathyesstring (uuid)The task.
Idempotency-KeyheaderyesstringA retried write with the same key answers the same.

Request body

application/json: object

Responses

StatusMeaningBody
202Accepted; the outcome follows as a screen notice
401Authentication requiredError
403forbidden: conversation ownership is required (another person's task)Error
404not_found: no such taskError
409no_desktop: the task's environment has no desktop; run_active: a run is activeError
503Database unavailable or gateway restartingError

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

NameInRequiredTypeDescription
idpathyesstring (uuid)The task.

Responses

StatusMeaningBody
200The noticesScreenNotices
401Authentication requiredError
403forbidden: conversation ownership is required (another person's task)Error
404not_found: no such taskError
503Database unavailable or gateway restartingError

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

NameInRequiredTypeDescription
idpathyesstring (uuid)The task.
screenshotpathyesstringThe store id from screen.capture.

Responses

StatusMeaningBody
200The screenshotstring (binary) (image/png)
401Authentication requiredError
403forbidden: conversation ownership is required (another person's task)Error
404not_found: no such task, or a screenshot this task never storedError
410screenshot_expired: the retention purge removed it; its event remainsError
503Database unavailable or gateway restartingError