The wire
The interface contract on the wire: one operation union over two projections. The encoding, the framing and the shape of a refusal are the ones every Yoke surface shares; field numbers and syntax are in the protocol definitions, which are authoritative on the bytes.
One union, two projections
One Request and one Response, each a union with one alternative per operation and its answer. An
operation is a member of the union and never of a projection.
The browser projection carries the same messages in protocol buffers' canonical JSON mapping, so the two share one schema.
local — the typed projection
| Service | Method |
|---|---|
| Interface | Attach(stream Frame) returns (stream Frame) — bidirectional |
Attaching is opening the stream. The class of the address decides what must be established, cardinality is checked, and the Core's first frame is the opening picture.
| Direction | The frame carries |
|---|---|
| client → Core | the call identity, chosen by the caller and unique within this attachment; and either a Request or a cancellation naming a call in flight |
| Core → client | the call identity, and one of: an answer, an event, a stream delivery, a refusal, or a completion |
- Every call completes explicitly. A call answered by one message completes with it; a subscription or a delivery completes when the caller cancels it or the Core ends it, and the completion says which.
- A refusal is a frame and does not end the attachment.
- A stream delivery on the connection is used only where the client cannot reach a path in the instance's tree; it carries the delivery's identity, the sequence and the sender's clock unchanged.
http+ws — the browser projection
The operation's name is the path.
| Path | Method | Carries |
|---|---|---|
/v1/<operation> | POST | one Request as JSON, one Response as JSON |
/v1/events | GET, upgraded | the live shape: events and channel state, the same frames, in JSON |
/v1/streams/<unit>/<stream>/<n> | GET, upgraded | binary: the 16-byte header and the payload, exactly as the framed transport carries them |
| anything else | any | 404, including a path outside /v1 |
- Attaching is opening
/v1/events. A control request with no live attachment is refused withchannel.not_attached. - The credential is a cookie the page cannot read,
yoke-sessionon the path/v1, where the channel's class requires one:HttpOnly,SameSite=Strict, andSecurewherever the transport is encrypted. - A refusal carries the structured error in the body, with the HTTP status as a coarse hint:
400for a malformed request,403for a scope refusal,409for a channel refusal,503while the instance is stopping. The code in the body is authoritative.
Ordering
| Preserved | Not promised |
|---|---|
| the frames of one call, in the order the Core sent them | any order between two calls |
| events about one subject, in the order they happened | any order between an event and an answer |
| a delivery's sequence, within one stream | any order between two streams, or between a stream and the control shape |
In the browser projection the control shape is a series of independent requests, so nothing orders two of them beyond what the client itself does.
How the contract states its version
| Statement | Where | Checked |
|---|---|---|
| the package version of the protocol definitions | in the definitions themselves | by the build of every party |
| a version integer | a field of every Request, and of the first frame of an attachment | at every request, and once per attachment |
A version is refused rather than negotiated, with compat.unsupported, at the earliest point that
can say so.
Error codes
| Code | Refused when |
|---|---|
operation.malformed | the request does not decode, or a required field is absent |
operation.unknown | it names an operation this Core does not implement |
compat.unsupported | the contract version is absent, or this Core does not support it |
auth.required | the channel's class requires a credential and none was presented |
auth.invalid | the credential was not accepted |
channel.in_use | a single channel is already held; the first client is untouched |
channel.not_attached | a control request arrived with no live attachment — the browser projection only |
channel.suspended | the operation is withdrawn by this channel's grade; the detail names the grade and the channel that prevails |
channel.not_local | reclaim on a channel not bound as a local socket |
subject.unknown | nothing this channel may address bears that identity; the detail names the kind and the identity |
scope.undeclared | the object was never declared by the unit's Plugin |
scope.withheld | it is declared and not granted to that plugin; the detail names it |
unit.not_running | the operation needs a running unit and this one is not |
unit.no_session | the unit holds no Session, so nothing can be issued on one |
unit.unanswered | the wait elapsed with no acknowledgement or answer |
unit.failed | the unit answered the Core's message with an error; the detail carries the unit's own code |
instance.stopping | an orderly stop is in progress and the operation would act |
The codes are one namespace across the surfaces: several are the administrative surface's with the same meaning.