Builders for the messages a renderer sends to the agent
(renderer_to_agent.json):
action/2— a user action on a component;error/3— a renderer-side error, about a surface or a function call;call_agent_function/4— the renderer asks the agent to run a function (v1.0);function_response/3— the result of an agent'scallRendererFunction(v1.0).
Every builder returns the wire map, version included (:version,
"v1.0" unless given), ready to be encoded by a transport.
iex> A2UICore.Message.RendererToAgent.function_response("call-1", {:ok, 42})
%{
"version" => "v1.0",
"rendererFunctionResponse" => %{"functionCallId" => "call-1", "value" => 42}
}
Summary
Functions
An action message carrying event, the map
A2UICore.State.Surface.dispatch_action/4 returns.
A callAgentFunction message: the renderer asks the agent to run
call (a function call object, "@call"/"catalogId"/"args").
An error message. Options: :surface_id, :function_call_id and
:path, each included when present, and :version.
A rendererFunctionResponse message: {:ok, value} for a result
(value is always present, nil for a void function) or
{:error, code, message}.
Functions
An action message carrying event, the map
A2UICore.State.Surface.dispatch_action/4 returns.
A callAgentFunction message: the renderer asks the agent to run
call (a function call object, "@call"/"catalogId"/"args").
An error message. Options: :surface_id, :function_call_id and
:path, each included when present, and :version.
The schema requires a validation error (VALIDATION_FAILED,
UNALLOWED_PARENT, UNALLOWED_CHILD) to carry surfaceId and path,
and any other error to carry exactly one of surfaceId and
functionCallId.
@spec function_response( String.t(), {:ok, term()} | {:error, String.t(), String.t()}, keyword() ) :: map()
A rendererFunctionResponse message: {:ok, value} for a result
(value is always present, nil for a void function) or
{:error, code, message}.