JSON-RPC 2.0 envelope codec with A2A method registry.
Keeps the envelope layer thin: params and result are passed through
as plain maps. Callers handle A2A type encoding/decoding (via the
A2aEngine.Types.* modules) before/after.
A2A methods
The known method strings are registered in @methods. Use method/1 to
resolve an atom key to a string, and atom_for_method/1 to parse a string
back to an atom.
Summary
Functions
Look up the atom for a wire method string. Returns :unknown if the
method isn't in the A2A registry (still valid JSON-RPC, just not A2A).
Decode a JSON-RPC 2.0 request envelope.
Decode a JSON-RPC 2.0 response envelope.
Build a JSON-RPC 2.0 error response envelope.
Build a JSON-RPC 2.0 request envelope.
Build a JSON-RPC 2.0 success response envelope.
Whether a wire method string is one of the known A2A methods.
Look up the wire string for a known A2A method atom.
All known A2A method atoms → wire strings.
Types
Functions
Look up the atom for a wire method string. Returns :unknown if the
method isn't in the A2A registry (still valid JSON-RPC, just not A2A).
@spec decode_request(map()) :: {:ok, decoded_request()} | {:error, term()}
Decode a JSON-RPC 2.0 request envelope.
Returns {:ok, %{id, method, params}} or {:error, reason}.
@spec decode_response(map()) :: {:ok, decoded_response()} | {:error, term()}
Decode a JSON-RPC 2.0 response envelope.
Returns {:ok, {:success, id, result}}, {:ok, {:error, id, error_map}},
or {:error, reason}.
Build a JSON-RPC 2.0 error response envelope.
Accepts either an %{code, message, data} map or a code integer (in which
case the default message for that code is used).
Build a JSON-RPC 2.0 request envelope.
Build a JSON-RPC 2.0 success response envelope.
Whether a wire method string is one of the known A2A methods.
Look up the wire string for a known A2A method atom.
All known A2A method atoms → wire strings.