Protocol specification
Messages
The envelope — a single tagged union carrying requests, responses, notes, progress, cancellation and stream control.
Every CONTROL frame carries one envelope: a tagged union whose tag field is t. It is shown as
JSON here; on the wire it is msgpack unless JSON was negotiated.
{ "t": "req", "id": 17, "method": "terminal.exec", "params": { }, "stream": { "id": 42 } }
{ "t": "res", "id": 17, "result": { } }
{ "t": "err", "id": 17, "error": { "code": "invalid_params", "message": "…", "retriable": false, "data": null } }
{ "t": "note", "method": "webrtc.signal", "params": { } }
{ "t": "prog", "id": 17, "payload": { } }
{ "t": "cancel", "id": 17 }
{ "t": "s_credit", "stream": 42, "bytes": 262144 }
{ "t": "s_end", "stream": 42, "trailer": { "sha256": "…" } }
{ "t": "s_err", "stream": 42, "error": { "code": "io_error", "message": "…", "retriable": true } }
{ "t": "s_cancel", "stream": 42 }| Tag | Direction | Purpose |
|---|---|---|
req | caller → callee | Call a method. |
res | callee → caller | The successful result of a req. |
err | callee → caller | The failure of a req. See Errors. |
note | either | A one-way message with no response. |
prog | callee → caller | Optional progress for a req, before its final answer. |
cancel | caller → callee | Ask the callee to stop a req. |
s_credit | stream receiver → sender | Grant more flow-control credit. |
s_end | stream sender | End a stream cleanly, optionally with a trailer. |
s_err | stream sender | Fail a stream. |
s_cancel | stream receiver | Abort a stream. |
Methods
method is {capability}.{tool} for a capability's tools — terminal.exec — or a protocol method
in the zyris.* or webrtc.* namespace, such as zyris.announce or webrtc.signal.
Request ids
idis a monotonically increasingu64allocated by the sender of thereq.- The two directions are independent id spaces.
- A
res,err,progorcancelalways refers to the receiver's view of the originatingreq.
The rules
req.streamis present if and only if the tool's declared transfer mechanism involves a stream. The request sender allocates the stream id. See Streams.progframes are optional and shaped by the tool's schema. Zero or more precede the finalresorerr.cancelis best-effort and idempotent. A cancelled request MUST still end with exactly oneresorerr— normallyerrwith codecanceled. Acancelfor an unknown or finished id is silently ignored.- Exceeding
max_inflight_reqsyieldserr overloaded, which is retriable.