adk_run_registry (erlang_adk v0.7.0)

View Source

Process registry and bounded terminal-run retention for adk_run.

Active invocations are retained for as long as they execute. Completed invocations are retained for replay, subject to both their own retention timer and this registry's global count limit. The registry monitors every invocation so stale process identifiers are never returned deliberately.

Summary

Functions

child_spec(Opts)

-spec child_spec(map()) -> supervisor:child_spec().

code_change(OldVsn, State, Extra)

handle_call(Request, From, State)

handle_cast(Message, State0)

handle_info(Message, State)

init(Opts)

lookup(RunId)

-spec lookup(binary()) -> {ok, pid()} | {error, not_found}.

lookup_authorized(RunId, OwnerScope)

-spec lookup_authorized(binary(), binary()) -> {ok, pid()} | {error, not_found}.

Resolve only when the caller presents the exact immutable owner scope. Unknown and cross-owner runs intentionally have the same result.

register(RunId, Pid)

-spec register(binary(), pid()) -> ok | {error, already_exists}.

register(RunId, Pid, Metadata)

-spec register(binary(), pid(), map()) -> ok | {error, already_exists | invalid_metadata}.

Register a run with immutable boundary metadata.

owner_scope is an opaque SHA-256 digest minted by a trusted boundary. It is intentionally not exposed through lookup/1 or status responses. Runs started through local Erlang APIs may omit it; production network/UI boundaries should always set it and use lookup_authorized/2.

start_link()

-spec start_link() -> gen_server:start_ret().

start_link(Opts)

-spec start_link(map()) -> gen_server:start_ret().

stats()

-spec stats() -> map().

terminal(RunId, Pid)

-spec terminal(binary(), pid()) -> ok.

terminate(Reason, State)