Skip to main content

Module protocol

Module protocol 

Source
Expand description

Protocol-1 wire envelope encode/decode.

Structs§

BaseMessage
Common message base with type and optional request_id.
Envelope
Unified {proto, type, method, params, id} envelope.
ErrorObject
Structured error nested under envelope.error.
EventMessage
Streaming event frame from the daemon (Go EventMessage parity).
LoopAIMessage
Loop-tagged assistant payload forwarded on mode=messages streams (Go LoopAIMessage parity).
StatusResponse
Status acknowledgment (Go StatusResponse parity). Handles the camelCase loopId fallback emitted by some daemon builds.

Enums§

MessageType
Message class values for the envelope type field.
TypedMessage
Typed decoded message (Go interface{} return parity).

Constants§

CLIENT_VERSION
Client version reported in connection_init (crate version).
DEFAULT_CLIENT_CAPABILITIES
Default capabilities declared in the handshake.
PROTO_VERSION
Protocol version string.

Functions§

as_str
Coerce JSON value to string.
decode_message
Decode a WebSocket text frame into a JSON value.
decode_message_typed
Decode a WebSocket text frame into a typed message (Go DecodeMessage parity).
expand_wire_messages
Expand event_batch frames into individual events.
extract_soothe_loop_id
Extract a loop id from a decoded message (Go ExtractSootheLoopID parity).
is_loop_assistant_phase
True when phase tags streamable loop assistant output.
new_connection_init
Build connection_init.
new_disconnect
Build disconnect notification.
new_notification
Build a notification envelope (no id).
new_ping
Build ping.
new_pong
Build pong.
new_request
Build a request envelope with a generated id.
new_request_id
Generate a 32-hex request id (UUID without dashes).
new_request_with_id
Build a request envelope with an explicit id.
new_subscribe
Build a subscribe envelope.
new_unsubscribe
Build an unsubscribe envelope.
next_to_event_message
Project a protocol-1 next envelope’s payload into an EventMessage when the payload carries a wrapped legacy event frame (Go nextToEventMessage parity).
params_map
Map helper: insert string.
split_wire_payload
Split a WebSocket text payload into one or more JSON objects.
unwrap_next
Unwrap a next envelope to its inner frame when possible.