Events & Notifications

Streaming tokens, deploy progress and realtime events are not delivered on the JSON-RPC WebSocket socket. Each streaming RPC creates a session id and pushes notifications to the SSE endpoint as server-sent events:

text
1
GET /api/rpc/events?session=<session_id>

Subscribe-before-send recipe

Notifications emitted between the RPC call returning a session id and the SSE subscription being established are dropped (the pre-subscription window). The reliable pattern is:

  1. 1
    Open the SSE stream first (it blocks until a session id is attached).
  2. 2
    Fire the RPC that returns the session id (e.g. chat.send, `agents.deploy`, `realtime.start`, `video.create`).
  3. 3
    Read notifications off the SSE stream as they arrive.

Every notification is a JSON-RPC 2.0 style message with "jsonrpc": "2.0", a method and a params object.

Notification catalog

chat.stream

One notification per token, produced by chat.send (and any streaming chat path that uses a session channel):

json
1
2
3
4
5
{
  "jsonrpc": "2.0",
  "method": "chat.stream",
  "params": { "stream_id": "...", "token": "...", "is_complete": false }
}

models.progress

Model download progress for agents.deploy, forwarded from the agent. The stream_id comes from the agents.deploy response.

realtime.event

Server events for an open full-duplex realtime session, pushed to the session channel (packages/core/src/gateway/realtime.rs). Client events sent via realtime.event RPC are forwarded upstream; server events arrive here.

Video job notifications

video.create jobs push progress over the session channel (packages/core/src/gateway/video.rs):

MethodPayload (params)Meaning
video.progressjob_id, stream_id, status: "running", progress (0–90)Job is running.
video.donejob_id, stream_id, result, costJob finished; result carries the artifact URL.
video.failedjob_id, stream_id, errorJob failed or was cancelled.

Ordering notes