Altar.LATER.Registry (Altar v0.1.2)
View SourceRegistry of tool implementations for the Local Agent & Tool Execution Runtime (LATER).
This module manages an in-process registry of tool functions keyed by their
validated Altar.ADM.FunctionDeclaration.name
. It is implemented as a
GenServer
for safe, serialized updates and queries.
State is a map of function_name :: String.t()
to implementation
functions of arity 1 that accept the tool arguments map.
Summary
Types
The internal state of the registry process.
A tool implementation function. Must be arity-1 and accept a map of arguments.
Functions
Returns a specification to start this module under a supervisor.
Look up a tool implementation by its function name.
Register a tool implementation under the provided declaration's name.
Start the registry process.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec lookup_tool(GenServer.server(), String.t()) :: {:ok, tool_fun()} | {:error, :not_found}
Look up a tool implementation by its function name.
Returns {:ok, fun}
when found or {:error, :not_found}
otherwise.
@spec register_tool(GenServer.server(), Altar.ADM.FunctionDeclaration.t(), tool_fun()) :: :ok | {:error, term()}
Register a tool implementation under the provided declaration's name.
registry
is the pid or name of the registry processdeclaration
is a validated%Altar.ADM.FunctionDeclaration{}
fun
is an arity-1 function that accepts a map of arguments
Returns :ok
on success or {:error, reason}
if registration fails
(e.g., name already registered or invalid function arity).
@spec start_link(Keyword.t()) :: GenServer.on_start()
Start the registry process.
Standard GenServer.start_link/3
options are accepted.