Durable session stream (SSE, or WebSocket at the same path)
Always-on Server-Sent Events stream — the single delivery path for session state (spec chat-stream-reconnection, ADR-0264/ADR-0266). NO feature flag or enableCrossClientSync gate. On a COLD connect it emits one snapshot event (a SessionSnapshot: completed messages, in-progress turn, status, non-expired pending interactions, and the resume cursor) then goes live, emitting one SessionEvent per frame. Each LIVE frame is preceded by an id: <sessionId>-<epoch>-<generation>-<seq> line; the client echoes it back as Last-Event-ID on reconnect. The generation names the seq space that stamped it — a session's seq belongs to an in-process projector, and a projector can be replaced behind the same session id, so a cursor whose generation no longer matches is treated as foreign and answered with a fresh snapshot rather than a plausible-looking replay. On a RESUME connect it SKIPS the snapshot and replays only events with seq greater than the cursor, then goes live. A cursor the server cannot serve gap-free falls back to the cold snapshot path instead of resuming. A : keepalive comment is sent every ~15s and X-Accel-Buffering: no defeats proxy buffering. The same path also answers a WebSocket upgrade (ADR 260805-041016), which is what the DorkOS app uses — a browser allows only ~6 connections per origin and an SSE stream holds one open, so a few windows exhaust them. Identical contract; each message is one JSON text frame { event, data, id? }, the resume cursor rides ?resume= (a browser WebSocket cannot set headers), liveness is a __heartbeat frame rather than an SSE comment, and a refusal arrives as WebSocket close code 4000 + status because a browser cannot read the status of a failed handshake. SSE remains the documented integration contract — see docs/integrations/sse-protocol.mdx. Authorized document channels also emit canvas_channel_snapshot and canvas_event frames on this connection, including while the agent is idle. These carry no frame id or session seq; docSeq belongs only to that physical document. Each connection replays current document state and bounded document history independently of the session resume cursor.
The sign-in cookie a browser gets when a person signs in to DorkOS. An installed DorkOS on port 4242 names it __Secure-better-auth.session_token. On any other port the prefix carries a suffix for its data folder (better-auth-<hash>), and a development server leaves off __Secure-. From this computer, an operation that takes the sign-in cookie or a personal API key needs neither while "Ask for a password on this computer too" is off, which is how DorkOS installs (dorkos auth enable turns it on). A request from another device needs one, with one exception for now: a browser reaching a Docker container through its published port, while the container runs with DORKOS_ALLOW_INSECURE_BIND and has no owner account yet.
In: cookie
Path Parameters
uuidQuery Parameters
Project directory (boundary-checked).
Resume cursor; replay events with seq greater than this. A bare integer that names no server process and no event counter, so it is checked only against the replay window. Safe when it is the cursor of a snapshot just taken on the same connection, which is all DorkOS's own HTTP transport uses it for; a cursor PERSISTED across a reconnect must be the whole Last-Event-ID/resume frame id, which carries both.
Resume token <sessionId>-<epoch>-<generation>-<seq>, for WebSocket clients, which cannot set headers. Same meaning as Last-Event-ID; takes precedence over after.
Header Parameters
Resume token <sessionId>-<epoch>-<generation>-<seq>; replays only the gap. A token from a previous server process (epoch mismatch), from a superseded seq space (generation mismatch), in the older generation-less format, or beyond the replay buffer falls back to a cold snapshot.
Response Body
text/event-stream
application/problem+json
application/problem+json
curl -X GET "https://example.com/api/sessions/497f6eca-6276-4993-bfeb-53cbbbba6f08/events"{ "messages": [ { "id": "string", "role": "user", "content": "string", "toolCalls": [ { "toolCallId": "string", "toolName": "string", "input": "string", "result": "string", "progressOutput": "string", "startedAt": 0, "endedAt": 0, "status": "pending", "questions": [ { "header": "", "question": "string", "options": [ { "label": "string", "description": "string" } ], "multiSelect": false } ], "answers": { "property1": "string", "property2": "string" }, "questionOutcome": "answered", "approvalOutcome": "allowed", "approvalResolvedAt": 0, "approvalReasonGiven": true, "approvalStartedAt": 0 } ], "parts": [ { "type": "text", "text": "string" } ], "timestamp": "string", "messageType": "command", "compactMetadata": { "startedAt": 0, "endedAt": 0, "trigger": "manual", "preTokens": 0, "postTokens": 0, "durationMs": 0, "requestedBy": "agent", "contextPercent": 0, "requestedAt": "string" }, "commandName": "string", "commandArgs": "string", "chatMessages": [ { "id": "string", "kind": "message", "from": { "chatId": "string", "chatTitle": "string", "agentId": "string", "agentName": "string" }, "text": "string", "delivery": "queue", "status": "queued", "replyToId": "string", "sentAt": "string" } ], "roomMessage": { "roomId": "string", "entryId": "string", "roomLabel": "string", "author": { "id": "string", "kind": "human", "displayName": "string", "handle": "string", "emoji": "string", "color": "string", "agentId": "string", "you": true }, "via": { "extensionId": "string", "appName": "string", "itemId": "string", "itemTitle": "string" } }, "promptSource": { "kind": "schedule", "label": "string" } } ], "earlierMessages": 0, "inProgressTurn": [ { "seq": 0, "type": "text_delta", "text": "string" } ], "status": { "contextUsage": { "totalTokens": 0, "maxTokens": 0, "outputTokens": 0, "cacheReadTokens": 0, "cacheCreationTokens": 0, "observedAt": "string" }, "cost": 0, "usage": null, "accountUsage": { "signInState": "signed-in", "runtime": "claude-code", "accountId": "string", "path": "string", "label": "string", "color": "string", "subscriptionType": "string", "plan": { "name": "string", "observedAt": "string", "source": "statusline" }, "credits": { "hasCredits": true, "unlimited": true, "balance": null, "observedAt": "string", "source": "statusline" }, "spend": { "periodStart": "string", "costUsd": 0, "limitUsd": null, "observedAt": "string", "source": "statusline" }, "windows": [ { "key": "string", "label": "string", "usedPct": 0, "resetsAt": "string", "status": "allowed", "expired": true, "observedAt": "string", "source": "statusline" } ], "state": "ok", "limit": { "window": "string", "resetsAt": "string" }, "updatedAt": "string", "unknown": [ { "key": "string", "label": "string", "since": "string" } ] }, "cacheStats": { "cacheReadTokens": 0, "cacheCreationTokens": 0 }, "model": "string", "permissionMode": "string", "todoCounts": { "total": 0, "completed": 0, "inProgress": 0 }, "runningSubagentCount": 0, "runningSubagents": [ { "taskId": "string", "taskType": "agent", "description": "string", "command": "string", "startedAt": 0 } ], "lifecycle": "idle", "lastError": null, "limit": { "accountId": "string", "window": "string", "resetsAt": "string", "since": "string", "plan": { "mode": "ask", "carryOver": false }, "scope": "account", "state": "limited", "modelFallback": "string", "allOut": { "accountId": "string", "resetsAt": "string" } }, "activity": { "toolName": "string", "target": "string" }, "steerable": true }, "pendingInteractions": [ { "type": "approval", "id": "string", "startedAt": 0, "remainingMs": 0, "timeoutMs": 0, "parked": true, "toolName": "string", "input": "string", "requestCode": "string", "title": "string", "displayName": "string", "description": "string", "blockedPath": "string", "decisionReason": "string", "hasSuggestions": true, "alwaysAllowScope": "session", "alwaysAllowBreadth": "tool" } ], "queuedMessages": [ { "id": "string", "content": "string", "disposition": "queue", "enqueuedAt": 0, "enqueuedBy": "string", "canRestoreToComposer": true, "waitingOn": { "reason": "background-work", "holding": { "agents": 0, "shells": 0, "other": 0 }, "pins": [ "string" ], "targetFolderName": "string", "because": "string", "since": 0, "releaseAt": 0 }, "fromChats": [ { "id": "string", "kind": "message", "from": { "chatId": "string", "chatTitle": "string", "agentId": "string", "agentName": "string" }, "summary": "string", "text": "string", "legacy": true } ], "restored": true, "packageCommandRestored": true } ], "canvas": [ { "id": "string", "scope": "string", "roomId": "string", "content": { "type": "url", "url": "http://example.com", "title": "string" }, "channel": { "routes": [ { "id": "string", "on": "string", "to": "log", "turn": { "mode": "none" }, "coalescibleTypes": [ "string" ] } ] }, "title": "string", "contentType": "string", "authorId": "string", "pinned": true, "rev": 0, "lastTouchedBy": "string", "lastTouchedAt": "string", "editingBy": "string", "sourceLabel": "string", "treeKind": "room-main", "aheadOfMain": 0, "openedAt": "string", "lastActiveAt": "string", "threadRootEntryId": "string", "openedBy": { "extensionId": "string" } } ], "runs": [ { "id": "string", "chatSeq": 1, "status": "queued", "openedBy": "caller", "attempt": 1, "waitReason": "chat_busy", "queueMessageId": "string", "queuePosition": 1, "waitingOnPerson": true, "ending": "completed", "notice": "restart_stopped", "runtimeTurnRef": 0, "warnings": [ { "code": "NO_DORKOS_TOOLS", "message": "string" } ], "createdAt": "string", "startedAt": "string", "endedAt": "string" } ], "cursor": 0}