adk_a2a_v1_codec (erlang_adk v0.7.0)

View Source

Validation and JSON boundary helpers for the A2A 1.0 data model.

A2A 1.0 uses ProtoJSON oneof members. In particular, Parts contain one of text, raw, url, or data; stream responses contain one of task, message, statusUpdate, or artifactUpdate. The pre-1.0 kind discriminator is deliberately rejected at this boundary.

Summary

Functions

error_response(Id, Code, Message)

-spec error_response(term(), integer(), binary()) -> map().

error_response(Id, Code, Message, Data)

-spec error_response(term(), integer(), binary(), undefined | [map()]) -> map().

interrupted_state(_)

-spec interrupted_state(term()) -> boolean().

json_safe(Value)

-spec json_safe(term()) -> {ok, term()} | {error, term()}.

result(Id, Value)

-spec result(term(), term()) -> map().

terminal_state(_)

-spec terminal_state(term()) -> boolean().

validate_agent_card(Card0)

-spec validate_agent_card(term()) -> {ok, map()} | {error, term()}.

validate_artifact(Artifact0)

-spec validate_artifact(term()) -> {ok, map()} | {error, term()}.

validate_jsonrpc_request(Request)

-spec validate_jsonrpc_request(term()) ->
                                  {ok, term(), binary(), map()} | {error, term(), integer(), binary()}.

validate_message(Message0)

-spec validate_message(term()) -> {ok, map()} | {error, term()}.

validate_part(Part0)

-spec validate_part(term()) -> {ok, map()} | {error, term()}.

validate_stream_response(Response0)

-spec validate_stream_response(term()) -> {ok, map()} | {error, term()}.

validate_task(Task0)

-spec validate_task(term()) -> {ok, map()} | {error, term()}.