/v2/agents/sessions/{session_id}/eventsStreamSessionEvents opens the session's Server-Sent Events feed.
Opens a text/event-stream of the session's canonical events, served by the MARS data plane (OHP).
Each frame is event: <type> plus a data: line holding a JSON event envelope; comment lines
(: keepalive) arrive about every 15s and must be ignored. Decode every data: with one envelope
parser and dispatch on the envelope's type. Every stream opens with a stream.state control frame
(its data is a stream_state).
Delivery is at-least-once: clients MUST de-duplicate and order by event_id (a ULID), never by
seq. The same path serves two modes:
- live attach (default): recent context, then an open stream that stays live until the client
disconnects. Pass
Last-Event-ID(orcursor) to resume strictly after the last event the client already rendered, suppressing the last-N context floor. - finite replay (
replay_only=true): writes a bounded slice of the stored transcript and closes. This is whatdoctl agents logsuses; paginate it withreplay_from.
OHP serves recent history only (bounded by Kafka retention and an event window); it is not an
archive. OHP's own errors (404/429/500/503) use the DO-standard JSON {id, message, request_id}
envelope (cthulhu#179797 / MARSOHS-2065); the 401 comes from the edge.
A 401 is returned: Authentication failed due to invalid credentials. A 404 is returned: Unknown session, or a session belonging to another team. The two are deliberately indistinguishable so a caller cannot enumerate other tenants' session ids. A 429 is returned: Attach admission limit reached. Retry after the Retry-After hint. A 500 is returned: Internal error. A 503 is returned: OHP cannot currently establish the caller's authorization or the session's location. Transient; retry after the Retry-After hint. Any other status is an error: There was an unexpected error.