Source-owned registry for agent provider declarations.
The registry resolves provider ids to implementation modules while core session code keeps ownership of sessions, credentials, retries, costs, events, and cleanup. Sources may replace their own provider ids during reload, but cross-source duplicate ids fail deterministically.
Summary
Types
Registration failure reason.
Provider registry server.
Source that owns provider declarations.
Functions
Lists all registered provider entries.
Returns a specification to start this module under a supervisor.
Disables a provider for new sessions.
Enables a provider for new sessions.
Looks up a provider regardless of enabled state.
Looks up an enabled provider by id.
Registers or replaces a provider spec.
Starts the provider registry.
Removes every provider contributed by a source.
Types
@type register_error() :: {:duplicate_provider_id, String.t(), existing_source :: source(), attempted_source :: source()} | {:invalid_spec, term()}
Registration failure reason.
@type server() :: GenServer.server()
Provider registry server.
@type source() :: MingaAgent.Provider.Spec.source()
Source that owns provider declarations.
@type state() :: %{required(String.t()) => MingaAgent.ProviderRegistry.Entry.t()}
Functions
@spec all() :: [MingaAgent.ProviderRegistry.Entry.t()]
Lists all registered provider entries.
@spec all(server()) :: [MingaAgent.ProviderRegistry.Entry.t()]
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec disable(String.t()) :: :ok | {:error, :not_found}
Disables a provider for new sessions.
@spec enable(String.t()) :: :ok | {:error, :not_found}
Enables a provider for new sessions.
@spec get(String.t()) :: {:ok, MingaAgent.ProviderRegistry.Entry.t()} | {:error, :not_found}
Looks up a provider regardless of enabled state.
@spec get(server(), String.t()) :: {:ok, MingaAgent.ProviderRegistry.Entry.t()} | {:error, :not_found}
@spec lookup(String.t()) :: {:ok, MingaAgent.ProviderRegistry.Entry.t()} | {:error, :not_found | :disabled}
Looks up an enabled provider by id.
@spec lookup(server(), String.t()) :: {:ok, MingaAgent.ProviderRegistry.Entry.t()} | {:error, :not_found | :disabled}
@spec register(MingaAgent.Provider.Spec.t() | keyword() | map()) :: :ok | {:error, register_error()}
Registers or replaces a provider spec.
@spec register(server(), MingaAgent.Provider.Spec.t() | keyword() | map()) :: :ok | {:error, register_error()}
@spec start_link(keyword()) :: GenServer.on_start()
Starts the provider registry.
@spec unregister_source(source()) :: :ok
Removes every provider contributed by a source.