Message format for agent-to-agent and pilot-to-agent communication.
All cockpit messages use a typed struct with correlation tracking.
Messages route through Events.Dispatcher with topic :agent_messages.
Summary
Functions
Decodes a map into a protocol message.
Encodes a message to a JSON-compatible map.
Creates a new protocol message with auto-generated timestamp and correlation id.
Creates a reply to an existing message, preserving the correlation id.
Types
@type message_type() ::
:directive
| :observation
| :query
| :response
| :takeover
| :release
| :status_update
| :alert
@type t() :: %Raxol.Agent.Protocol{ correlation_id: binary(), from: atom(), payload: term(), timestamp: DateTime.t(), to: atom() | :broadcast, type: message_type() }
Functions
Decodes a map into a protocol message.
Encodes a message to a JSON-compatible map.
@spec new(atom(), atom() | :broadcast, message_type(), term()) :: t()
Creates a new protocol message with auto-generated timestamp and correlation id.
@spec reply(t(), atom(), message_type(), term()) :: t()
Creates a reply to an existing message, preserving the correlation id.