Holds ingested artifacts and per-API config in ETS. No persistence: hosts re-register at boot from wherever they keep specs.
Reads pay one GenServer.call to fetch the table ref — deliberate: lookups happen a handful of times per LLM tool call, so the hop is noise next to the LLM turn and the upstream HTTP request, and it keeps unnamed per-test registries isolated (a :named_table would not).
Summary
Functions
Returns a specification to start this module under a supervisor.
Register an ingested artifact under api_name.
Projected read for the per-call hot paths (I3): each API's spec
pre-encoded to JSON at registration — a refc binary, so reads share it
rather than copy it — plus its model-visible sandbox_globals. Sorted by
API name. Unlike list/1, this never copies full artifacts out of ETS,
which costs tens of ms per call on multi-MB specs.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec list(GenServer.server()) :: [ {String.t(), %OapiCodemode.Registry.Entry{artifact: term(), config: term()}} ]
@spec lookup(GenServer.server(), String.t()) :: {:ok, %OapiCodemode.Registry.Entry{artifact: term(), config: term()}} | {:error, :unknown_api}
@spec register( GenServer.server(), String.t(), OapiCodemode.Artifact.t(), OapiCodemode.ApiConfig.t() ) :: :ok | {:error, {:invalid_api_name, term()} | :no_base_url}
Register an ingested artifact under api_name.
api_name must be a valid JS identifier — it becomes a property name on
the sandbox globals. Returns {:error, {:invalid_api_name, name}}
otherwise, or {:error, :no_base_url} when neither the config nor the
spec supplies a server URL.
@spec sandbox_meta(GenServer.server()) :: [ {String.t(), %{spec_json: String.t(), sandbox_globals: map()}} ]
Projected read for the per-call hot paths (I3): each API's spec
pre-encoded to JSON at registration — a refc binary, so reads share it
rather than copy it — plus its model-visible sandbox_globals. Sorted by
API name. Unlike list/1, this never copies full artifacts out of ETS,
which costs tens of ms per call on multi-MB specs.