Raxol.AgentClientProtocol.Connection.Ctx (Raxol Agent Client Protocol v0.1.0)

Copy Markdown View Source

Per-dispatch handler context.

One Ctx is built by Raxol.AgentClientProtocol.Connection for every inbound request/notification and handed to the handler task that runs the matching callback OUTSIDE the Connection process. handler_state is read-only per dispatch: handlers are concurrent tasks, so there is no safe way to thread mutable state through them — stateful per-session logic lives in the Session layer, not here.

reply_ref is present (reference()) for requests and nil for notifications. rx_seq is the inbound frame's monotone sequence stamp — begin_prompt forwards it to the Session so cancel-vs-prompt commutes by wire order. delivery_stamp is the receiver-assigned ordering key (Raxol.AgentClientProtocol.Delivery.t()) for a session/update dispatch — nil for every other dispatch.

Summary

Types

t()

@type t() :: %Raxol.AgentClientProtocol.Connection.Ctx{
  caps: term() | nil,
  conn: pid(),
  delivery_stamp: Raxol.AgentClientProtocol.Delivery.t() | nil,
  handler_state: term(),
  reply_ref: reference() | nil,
  role: :agent | :client,
  rx_seq: non_neg_integer(),
  session_sup: pid() | nil,
  task_sup: pid() | nil
}