Module: AgentSettings::Registry Private

Defined in:
lib/agent_settings/registry.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Registry mapping agent symbols to their adapter classes.

The Registry is responsible for knowing which adapters exist and providing the correct adapter instance for a given agent symbol. It also defines the list of supported agents.

Constant Summary collapse

AGENTS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

List of supported agent symbols.

%i[claude opencode codex].freeze

Class Method Summary collapse

Class Method Details

.adapter(agent) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get the adapter instance for an agent.

Returns a new instance of the appropriate adapter class for the given agent symbol. Uses pattern matching to select the adapter.

Examples:

adapter = Registry.adapter(:claude)  #=> AgentSettings::Adapters::Claude instance
adapter.layers(dir: Dir.pwd, env: {}, trusted: true)

Parameters:

  • agent (Symbol)

    the agent identifier (:claude, :opencode, :codex)

Returns:

  • (Object)

    an instance of the appropriate adapter class

Raises:



29
30
31
32
33
34
35
36
37
# File 'lib/agent_settings/registry.rb', line 29

def adapter(agent)
  case agent
  in :claude then Adapters::Claude.new
  in :opencode then Adapters::Opencode.new
  in :codex then Adapters::Codex.new
  else
    raise UnknownAgentError, "Unknown agent: #{agent}. Supported: #{AGENTS.join(", ")}"
  end
end