Class: Axn::Tools::VersionGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/axn/tools/version_group.rb

Overview

The coexisting versions of ONE logical tool (one (adapter, tool_name)), and the single place latest resolves — so members' latest-collapse and a per-name lookup consume the same rules instead of each re-deriving them. Validates the group on construction (the relaxed replacement for the old unique-tool_name assertion).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter:, tool_name:, members:) ⇒ VersionGroup

Returns a new instance of VersionGroup.



12
13
14
15
16
17
# File 'lib/axn/tools/version_group.rb', line 12

def initialize(adapter:, tool_name:, members:)
  @adapter = adapter
  @tool_name = tool_name
  @all = members.sort_by(&:tool_version)
  _validate!
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



10
11
12
# File 'lib/axn/tools/version_group.rb', line 10

def adapter
  @adapter
end

#allObject (readonly)

Returns the value of attribute all.



10
11
12
# File 'lib/axn/tools/version_group.rb', line 10

def all
  @all
end

#tool_nameObject (readonly)

Returns the value of attribute tool_name.



10
11
12
# File 'lib/axn/tools/version_group.rb', line 10

def tool_name
  @tool_name
end

Instance Method Details

#latestObject

Newest contract. What latest-favoring adapters (MCP, ruby_llm) serve. An adapter that instead addresses each version explicitly (a path-routing HTTP surface) reads all.



21
22
23
# File 'lib/axn/tools/version_group.rb', line 21

def latest
  @all.max_by(&:tool_version)
end