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

Functions

error(id, error)

from_json(arg1)

@spec from_json(term()) :: {:ok, t()} | {:error, :invalid_request}

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.

new(id, arg)

result(id, result)

to_json(arg)

@spec to_json(t()) :: map()