adk_tool_confirmation (erlang_adk v0.7.0)

View Source

Internal contracts for human confirmation of tool side effects.

Confirmation metadata is evaluated only after a model call has passed its JSON schema and Runner runtime-policy checks. It is never part of the provider-visible tool declaration and this module never executes a tool.

Summary

Functions

Stable opaque identity for one exact model call. The digest includes the invocation, correlation ID, name, and canonical arguments, but none of those raw values are embedded in the public identifier.

Evaluate the optional module callbacks. The argument-aware callback takes precedence over the static callback when both are exported.

Read already validated, internal metadata from a resolved toolset call.

Resolve confirmation for a dynamic call. Opaque execute closures own their internal confirmation metadata. A resolved local module must also honour the module's declaration, so a toolset alias cannot weaken a module which requires approval. Either declaration requiring confirmation wins; either declaration failing validation fails closed.

Types

requirement/0

-type requirement() :: none | #{required := true, hint => binary()}.

Functions

action_id(Name, Args, InvocationId, CallId)

-spec action_id(binary(), map(), binary(), term()) -> binary().

Stable opaque identity for one exact model call. The digest includes the invocation, correlation ID, name, and canonical arguments, but none of those raw values are embedded in the public identifier.

is_required(_)

-spec is_required(requirement() | map() | term()) -> boolean().

matches_action(Details, Name, Args, InvocationId, CallId)

-spec matches_action(map(), binary(), map(), binary(), term()) -> boolean().

module_requirement(Module, Args, Context)

-spec module_requirement(module(), map(), map()) -> {ok, requirement()} | {error, term()}.

Evaluate the optional module callbacks. The argument-aware callback takes precedence over the static callback when both are exported.

rejection_response(ActionId)

-spec rejection_response(binary()) -> map().

resolved_requirement(ResolvedCall)

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

Read already validated, internal metadata from a resolved toolset call.

resolved_requirement(ResolvedCall, Args, Context)

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

Resolve confirmation for a dynamic call. Opaque execute closures own their internal confirmation metadata. A resolved local module must also honour the module's declaration, so a toolset alias cannot weaken a module which requires approval. Either declaration requiring confirmation wins; either declaration failing validation fails closed.

summary(Name, Requirement)

-spec summary(binary(), requirement()) -> binary().

valid_details(Details)

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