Skip to main content

Module protocol

Module protocol 

Source
Expand description

Wire protocol — server→client event envelopes built to match spec/.

Every constructor here produces a serde_json::Value whose field names and nesting match the JSON Schemas in smooth-operator/spec/events/*.json exactly, so the generated TS/Go/.NET/Python clients deserialize them unmodified.

All events are serialized as a flat envelope with a type discriminator plus the per-event fields documented in envelope.schema.json’s EventEnvelope (requestId, status, data, node, token, error, timestamp).

Functions§

error
error — an unrecoverable error. The { code, message } descriptor is duplicated at the envelope level and nested under data.error for wire backward-compatibility (per error.schema.json).
eventual_response
eventual_response — the terminal event of a streaming turn. The payload is double-nested (data.data) per eventual-response.schema.json.
immediate_response
immediate_response — synchronous ack. For non-streaming actions this also carries the full response payload in data.
now_ms
Current Unix epoch milliseconds (for the timestamp field).
pong
pong — reply to a ping. Carries the server timestamp both at the top level and inside data (per pong.schema.json).
stream_chunk
stream_chunk — a per-node state snapshot. node is mirrored at the envelope level and inside data (per stream-chunk.schema.json). state only carries safe-to-expose fields.
stream_token
stream_token — a single streamed LLM token. The token is mirrored both at the envelope level (token) and inside data (per stream-token.schema.json).