Raxol. AgentClientProtocol. Rpc. Response
(Raxol Agent Client Protocol v0.1.0)
Copy Markdown
View Source
JSON-RPC 2.0 Response object: either a result or an error, represented as
a tagged tuple {:result, id, result} | {:error, id, error} rather than
a struct (a Response is a discriminated union at the wire level, and the
two shapes are mutually exclusive per spec).
id may legitimately be nil — a server-side parse error or
invalid-request error detected before any request id could be read is
answered with a null-id error response; this is not an absent id, it is
the spec-mandated value for an uncorrelatable error.
Ported from the MIT f1729/agent_client_protocol (c) 2025 f1729; see NOTICE.md.
Summary
Functions
Decode a Response object. Total: a missing/wrong-typed id, or an
unparseable error payload, returns {:error, :invalid_request} rather
than raising or crashing on a hard match.
Types
@type t() :: {:result, Raxol.AgentClientProtocol.Rpc.RequestId.t(), any()} | {:error, Raxol.AgentClientProtocol.Rpc.RequestId.t(), Raxol.AgentClientProtocol.Error.t()}
Functions
@spec error( Raxol.AgentClientProtocol.Rpc.RequestId.t(), Raxol.AgentClientProtocol.Error.t() ) :: t()
Decode a Response object. Total: a missing/wrong-typed id, or an
unparseable error payload, returns {:error, :invalid_request} rather
than raising or crashing on a hard match.
@spec new( Raxol.AgentClientProtocol.Rpc.RequestId.t(), {:ok, any()} | {:error, Raxol.AgentClientProtocol.Error.t()} ) :: t()
@spec result(Raxol.AgentClientProtocol.Rpc.RequestId.t(), any()) :: t()