riffer-rig 0.20.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ddd9f4aec73d93bd159ccb7f885586be4f7e7cc9b1932ad3405e154b6ecc847
4
- data.tar.gz: cb5de3619244ce91a29deb0dcc4ddfd6e0295f28c9bbe7962ff93c34d921f540
3
+ metadata.gz: 0c33a1c7b977a6975d83323dc823941ec5b95cddb9c1c4a9c27378a93cffbb5c
4
+ data.tar.gz: f540e84e8f27c31d065652f73746c17c34ed91df738c8f11d2fe0464313e8cd9
5
5
  SHA512:
6
- metadata.gz: b1024a680476463d28752f3e67b74636bee19d2ae031491b4a42f11166744a19ddced7055cad212689b54dc43020e839a3d1942c5b0a3b2c55dbf7f6c4246b86
7
- data.tar.gz: 206f04cf4ae9c2e8d35ea04ecd3b6f6af534119eeb85e9b59878d3116271cfb28a1a33f65aa334112d59311d7c229592e7bddbae3ba177936e2ca64b86847c39
6
+ metadata.gz: bca74265a010a5d78b5305b3f24fdf9332112ccf80246ff678068f9968daa131d7cafe3cac8a673a5ed6e907732f884e5e206003d8efd8521f018075876bfeaf
7
+ data.tar.gz: ba178bf4dc46e6719f66e08ac6a67d1760ce207f428a97964af26321badee73cbf1c60ec8b1ac4f0a27a720c55d377cbdb522127c8f09a44b23fc9d046685042
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.21.0](https://github.com/bottrall/riffer-rig/compare/v0.20.1...v0.21.0) (2026-11-29)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * `Runtime.new` takes `mcp_client:` in place of `mcp_registry:`. Pass any object answering `tools(name:, url:, headers:)` with an Array of `Riffer::Tool` classes, or drop the keyword to use the default, `Riffer::Rig::Mcp::Client`.
9
+
10
+ ### Features
11
+
12
+ * list MCP server tools in rig now that riffer 0.59 dropped its client ([9db6b6e](https://github.com/bottrall/riffer-rig/commit/9db6b6e1fe3d2a83c339f655ab20eeda79216593))
13
+
3
14
  ## [0.20.1](https://github.com/bottrall/riffer-rig/compare/v0.20.0...v0.20.1) (2026-11-29)
4
15
 
5
16
 
data/docs/PUBLIC_API.md CHANGED
@@ -447,6 +447,24 @@ class Riffer::Rig::Loader::Options
447
447
  end
448
448
  ```
449
449
 
450
+ ## `Riffer::Rig::Mcp::Client`
451
+
452
+ ```rbs
453
+ module Riffer::Rig::Mcp::Client
454
+ extend ::Riffer::Rig::Mcp::Client
455
+
456
+ def tools: (name: String, url: String, headers: Hash[String, String]) -> Array[singleton(Riffer::Tool)]
457
+ end
458
+ ```
459
+
460
+ ## `Riffer::Rig::Mcp::_Client`
461
+
462
+ ```rbs
463
+ interface Riffer::Rig::Mcp::_Client
464
+ def tools: (name: String, url: String, headers: Hash[String, String]) -> Array[singleton(Riffer::Tool)]
465
+ end
466
+ ```
467
+
450
468
  ## `Riffer::Rig::Registrar`
451
469
 
452
470
  ```rbs
@@ -481,7 +499,7 @@ class Riffer::Rig::Runtime
481
499
 
482
500
  attr_reader id: String
483
501
 
484
- def initialize: (String model, ?extensions: Array[::Riffer::Rig::Extension], ?tools: Array[String]?, ?settings: Hash[Symbol, untyped], ?host: ::Riffer::Rig::Hosts::_Host, ?cwd: String?, ?name: String, ?instructions: String?, ?credentials: Hash[Symbol, Hash[Symbol, String]], ?env: ::Riffer::Rig::Env, ?auth_path: String, ?settings_path: String, ?reasoning: String?, ?riffer_config: Riffer::Config, ?mcp_registry: ::Riffer::Rig::Mcp::_Registry, ?max_steps: Integer?, ?model_options: Hash[Symbol, untyped], ?native_tools: Hash[Symbol, untyped], ?max_tokens: Integer?, ?clock: ^() -> Float, ?snapshot: (::Riffer::Rig::Runtime::Snapshot | Hash[Symbol, untyped])?) -> void
502
+ def initialize: (String model, ?extensions: Array[::Riffer::Rig::Extension], ?tools: Array[String]?, ?settings: Hash[Symbol, untyped], ?host: ::Riffer::Rig::Hosts::_Host, ?cwd: String?, ?name: String, ?instructions: String?, ?credentials: Hash[Symbol, Hash[Symbol, String]], ?env: ::Riffer::Rig::Env, ?auth_path: String, ?settings_path: String, ?reasoning: String?, ?riffer_config: Riffer::Config, ?mcp_client: ::Riffer::Rig::Mcp::_Client, ?max_steps: Integer?, ?model_options: Hash[Symbol, untyped], ?native_tools: Hash[Symbol, untyped], ?max_tokens: Integer?, ?clock: ^() -> Float, ?snapshot: (::Riffer::Rig::Runtime::Snapshot | Hash[Symbol, untyped])?) -> void
485
503
 
486
504
  def prompt: (String text) ?{ (::Riffer::StreamEvents::Base | ::Riffer::Rig::Events::_Event) -> void } -> (nil | Enumerator[::Riffer::StreamEvents::Base | ::Riffer::Rig::Events::_Event, Riffer::Agent::Response])
487
505
 
@@ -74,7 +74,7 @@ module Riffer::Rig::ACP::Mapper
74
74
 
75
75
  case message[:role]
76
76
  when 'user' then ::ACP::Types::SessionUpdate::UserMessageChunk.new(content: text_block(message[:content].to_s))
77
- when 'assistant' then message_chunk(message[:content].to_s) unless message[:content].to_s.strip.empty?
77
+ when 'assistant' then replayed_reply(message)
78
78
  when 'tool' then replayed_tool_call(message)
79
79
  end
80
80
  end
@@ -231,6 +231,14 @@ module Riffer::Rig::ACP::Mapper
231
231
  exit_status ? "exited with status #{exit_status}" : "was killed by SIG#{completion.signal}"
232
232
  end
233
233
 
234
+ # riffer stores an assistant turn's text in its parts, not under content.
235
+ # @rbs message: Hash[Symbol, untyped]
236
+ # @rbs return: ::ACP::Types::SessionUpdate::AgentMessageChunk?
237
+ def replayed_reply(message)
238
+ text = Riffer::Messages::Assistant.from_hash(message).content
239
+ message_chunk(text) unless text.strip.empty?
240
+ end
241
+
234
242
  # The stored result is all a replayed call has: the arguments live in the
235
243
  # assistant message's tool_calls, so the title is the name alone.
236
244
  # @rbs message: Hash[Symbol, untyped]
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mcp'
4
+
5
+ module Riffer::Rig::Mcp::Client
6
+ extend self
7
+
8
+ # @rbs name: String
9
+ # @rbs url: String
10
+ # @rbs headers: Hash[String, String]
11
+ # @rbs return: Array[singleton(Riffer::Tool)]
12
+ def tools(name:, url:, headers:)
13
+ client = MCP::Client.new(transport: MCP::Client::HTTP.new(url: url, headers: headers))
14
+ Riffer::Rig::Mcp::Tools.build(name, client, client.tools)
15
+ end
16
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Riffer::Rig::Mcp::Tools
4
+ extend self
5
+
6
+ # @rbs server: String
7
+ # @rbs client: MCP::Client
8
+ # @rbs definitions: Array[MCP::Client::Tool]
9
+ # @rbs return: Array[singleton(Riffer::Tool)]
10
+ def build(server, client, definitions)
11
+ definitions.map { |definition| tool_class(server, client, definition) }
12
+ end
13
+
14
+ private
15
+
16
+ # @rbs component: String
17
+ # @rbs return: String
18
+ def sanitize(component)
19
+ component.gsub(/[^a-zA-Z0-9_-]/, '_')
20
+ end
21
+
22
+ # @rbs server: String
23
+ # @rbs client: MCP::Client
24
+ # @rbs definition: MCP::Client::Tool
25
+ # @rbs return: singleton(Riffer::Tool)
26
+ def tool_class(server, client, definition)
27
+ tool = Class.new(Riffer::Tool) #: singleton(Riffer::Tool)
28
+ tool.identifier("#{sanitize(server)}__#{sanitize(definition.name)}")
29
+ tool.description(definition.description.to_s.empty? ? definition.name : definition.description)
30
+ tool.define_singleton_method(:parameters_schema) { |strict: false| definition.input_schema } # rubocop:disable Lint/UnusedBlockArgument -- riffer calls parameters_schema(strict:), so the keyword keeps its name
31
+ tool.define_method(:call) do |context:, **arguments| # rubocop:disable Lint/UnusedBlockArgument -- riffer passes context: to every call
32
+ # @type var arguments: Hash[Symbol, untyped]
33
+ result = client.call_tool(name: definition.name, arguments: arguments).fetch('result')
34
+ content = result['content'].to_a.filter_map { |item| item['text'] }.join
35
+ result['isError'] ? Riffer::Tools::Response.error(content) : Riffer::Tools::Response.text(content)
36
+ end
37
+ tool
38
+ end
39
+ end
@@ -3,6 +3,6 @@
3
3
  module Riffer::Rig::Mcp
4
4
  Server = Data.define(
5
5
  :declaration, #: Riffer::Rig::Mcp::Declaration
6
- :registration #: Riffer::Mcp::Registration
6
+ :tools #: Array[singleton(Riffer::Tool)]
7
7
  )
8
8
  end
@@ -1,27 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'uri'
4
+
3
5
  class Riffer::Rig::Runtime::McpRegistrar
4
- # @rbs @registry: Riffer::Rig::Mcp::_Registry
6
+ # @rbs @client: Riffer::Rig::Mcp::_Client
5
7
  # @rbs @host: Riffer::Rig::Hosts::_Host
6
8
  # @rbs @env: Riffer::Rig::Env
7
9
  # @rbs @auth_path: String
8
10
  # @rbs @servers: Hash[String, Riffer::Rig::Mcp::Server]
9
11
 
10
- # @dynamic tag
11
- attr_reader :tag #: Symbol
12
-
13
- # @rbs runtime_id: String
14
- # @rbs registry: Riffer::Rig::Mcp::_Registry
12
+ # @rbs client: Riffer::Rig::Mcp::_Client
15
13
  # @rbs host: Riffer::Rig::Hosts::_Host
16
14
  # @rbs env: Riffer::Rig::Env
17
15
  # @rbs auth_path: String
18
16
  # @rbs return: void
19
- def initialize(runtime_id, registry:, host:, env:, auth_path:)
20
- # Upstream candidate: riffer's MCP registry is process-wide and keyed by
21
- # server name alone, so each Runtime tags its registrations, and two
22
- # Runtimes declaring the same name replace each other's.
23
- @tag = :"riffer_rig_#{runtime_id}"
24
- @registry = registry
17
+ def initialize(client:, host:, env:, auth_path:)
18
+ @client = client
25
19
  @host = host
26
20
  @env = env
27
21
  @auth_path = auth_path
@@ -31,7 +25,7 @@ class Riffer::Rig::Runtime::McpRegistrar
31
25
  # @rbs declarations: Hash[String, Riffer::Rig::Mcp::Declaration]
32
26
  # @rbs return: Hash[String, Riffer::Rig::Mcp::Server]
33
27
  def register(declarations)
34
- declarations.filter_map do |name, declaration|
28
+ @servers = declarations.filter_map do |name, declaration|
35
29
  resolved = resolve(name, declaration)
36
30
  next nil unless resolved
37
31
 
@@ -41,16 +35,6 @@ class Riffer::Rig::Runtime::McpRegistrar
41
35
  end.to_h
42
36
  end
43
37
 
44
- # @rbs servers: Hash[String, Riffer::Rig::Mcp::Server]
45
- # @rbs return: void
46
- def retain(servers)
47
- dropped = @servers.except(*servers.keys)
48
- @servers = servers
49
- # A retired registration was replaced under the same name, by another
50
- # Runtime or a later declaration, and is no longer this Runtime's to remove.
51
- dropped.each { |name, server| @registry.unregister(name) unless server.registration.retired? }
52
- end
53
-
54
38
  private
55
39
 
56
40
  # The stored declaration is the resolved one, so a later register compares
@@ -73,20 +57,31 @@ class Riffer::Rig::Runtime::McpRegistrar
73
57
  # @rbs declaration: Riffer::Rig::Mcp::Declaration
74
58
  # @rbs return: Riffer::Rig::Mcp::Server?
75
59
  def register_server(name, declaration)
76
- unless declaration.url
77
- # Upstream candidate: riffer's MCP registry speaks HTTPS only, so a
78
- # stdio declaration reaches the Runtime but cannot be registered until
79
- # riffer grows a stdio client.
80
- @host.notify("MCP server #{name} runs over stdio, which riffer cannot register yet", level: :error)
60
+ url = declaration.url
61
+ unless url
62
+ @host.notify("MCP server #{name} runs over stdio, which riffer-rig cannot connect to", level: :error)
63
+ return nil
64
+ end
65
+ unless https?(url)
66
+ @host.notify("MCP server #{name} failed to register: its url is not a valid https:// URL", level: :error)
81
67
  return nil
82
68
  end
83
69
 
84
- registration = @registry.register(
85
- name: name, endpoint: declaration.url, tags: [@tag], discovery_headers: declaration.headers
70
+ Riffer::Rig::Mcp::Server.new(
71
+ declaration: declaration,
72
+ tools: @client.tools(name:, url:, headers: declaration.headers)
86
73
  )
87
- Riffer::Rig::Mcp::Server.new(declaration: declaration, registration: registration)
88
74
  rescue StandardError => e
89
75
  @host.notify("MCP server #{name} failed to register: #{e.message}", level: :error)
90
76
  nil
91
77
  end
78
+
79
+ # @rbs url: String
80
+ # @rbs return: bool
81
+ def https?(url)
82
+ uri = URI.parse(url)
83
+ uri.is_a?(URI::HTTPS) && !uri.host.nil?
84
+ rescue URI::InvalidURIError
85
+ false
86
+ end
92
87
  end
@@ -28,13 +28,22 @@ class Riffer::Rig::Runtime::Snapshot
28
28
  # Upstream candidate: riffer's Serializer carries an agent's config, never
29
29
  # its history, so this and to_h round-trip the session message by message;
30
30
  # a Session.from_h could also heal orphaned tool calls on load.
31
- messages: saved.map { |stored| message(signed ? stored : stored.except(:reasoning)) },
31
+ messages: saved.map { |stored| message(signed ? stored : drop_reasoning(stored)) },
32
32
  model: hash.fetch(:model),
33
33
  reasoning: hash[:reasoning].is_a?(String) ? hash[:reasoning] : nil,
34
34
  skills: hash.fetch(:skills)
35
35
  )
36
36
  end
37
37
 
38
+ # @rbs hash: Hash[Symbol, untyped]
39
+ # @rbs return: Hash[Symbol, untyped]
40
+ def self.drop_reasoning(hash)
41
+ stripped = hash.except(:reasoning)
42
+ return stripped unless stripped[:parts].is_a?(Array)
43
+
44
+ stripped.merge(parts: stripped[:parts].reject { |part| part[:part].to_s == 'reasoning' })
45
+ end
46
+
38
47
  # @rbs hash: Hash[Symbol, untyped]
39
48
  # @rbs return: Riffer::Messages::Base
40
49
  def self.message(hash)
@@ -98,7 +98,7 @@ class Riffer::Rig::Runtime
98
98
  # @rbs settings_path: String
99
99
  # @rbs reasoning: String?
100
100
  # @rbs riffer_config: Riffer::Config
101
- # @rbs mcp_registry: Riffer::Rig::Mcp::_Registry
101
+ # @rbs mcp_client: Riffer::Rig::Mcp::_Client
102
102
  # @rbs max_steps: Integer?
103
103
  # @rbs model_options: Hash[Symbol, untyped]
104
104
  # @rbs native_tools: Hash[Symbol, untyped]
@@ -121,7 +121,7 @@ class Riffer::Rig::Runtime
121
121
  settings_path: Riffer::Rig::Settings::File::PATH,
122
122
  reasoning: nil,
123
123
  riffer_config: Riffer.config,
124
- mcp_registry: Riffer::Mcp,
124
+ mcp_client: Riffer::Rig::Mcp::Client,
125
125
  max_steps: DEFAULT_MAX_STEPS,
126
126
  model_options: {},
127
127
  native_tools: {},
@@ -166,21 +166,18 @@ class Riffer::Rig::Runtime
166
166
  @system_prompt = Riffer::Rig::Runtime::SystemPrompt.new(
167
167
  instructions || format(BASE_PROMPT_TEMPLATE, name: name), @cwd
168
168
  )
169
- @mcp = Riffer::Rig::Runtime::McpRegistrar.new(
170
- @id, registry: mcp_registry, host: @host, env: env, auth_path: auth_path
171
- )
169
+ @mcp = Riffer::Rig::Runtime::McpRegistrar.new(client: mcp_client, host: @host, env: env, auth_path: auth_path)
172
170
  assembly = Riffer::Rig::Runtime::Assembly.new(extensions, settings, tools)
173
171
  assembly.failures.each do |failure|
174
172
  @host.notify("Extension #{failure.extension.name} failed to load: #{failure.error.message}", level: :error)
175
173
  end
176
174
  mcp_servers = @mcp.register(assembly.mcp_declarations)
177
175
  hooks = Riffer::Rig::Runtime::Hooks.new(assembly.hooks, @host)
178
- config = agent_config(assembly, hooks, max_steps)
176
+ config = agent_config(assembly, hooks, max_steps, mcp_servers)
179
177
  agent = saved ? restore(saved, model, config) : build_agent(model, config)
180
178
  install(assembly, hooks, agent)
181
179
  restored = @model_override
182
180
  rederive_options(restored) if restored && options.provider_for(restored) != options.provider_for(model)
183
- @mcp.retain(mcp_servers)
184
181
  @agent.session.on_message do |message|
185
182
  Thread.handle_interrupt(Riffer::Rig::Runtime::Abort::SHIELD) { observe_message(message) }
186
183
  end
@@ -310,10 +307,9 @@ class Riffer::Rig::Runtime
310
307
  assembly = Riffer::Rig::Runtime::Assembly.new(extensions, settings, @tool_allowlist, strict: true)
311
308
  mcp_servers = @mcp.register(assembly.mcp_declarations)
312
309
  hooks = Riffer::Rig::Runtime::Hooks.new(assembly.hooks, @host)
313
- agent = successor(model, agent_config(assembly, hooks, @agent.config.max_steps))
310
+ agent = successor(model, agent_config(assembly, hooks, @agent.config.max_steps, mcp_servers))
314
311
  lifecycle(:session_end, Riffer::Rig::Events::SessionEnd.new(:reload))
315
312
  install(assembly, hooks, agent)
316
- @mcp.retain(mcp_servers)
317
313
  lifecycle(:session_start, Riffer::Rig::Events::SessionStart.new(@id, :reload))
318
314
  ensure
319
315
  @concurrency.release
@@ -405,7 +401,6 @@ class Riffer::Rig::Runtime
405
401
  @concurrency.close
406
402
  @job_inbox.close
407
403
  @jobs.shutdown
408
- @mcp.retain({})
409
404
  @hooks.observe(:session_end, Riffer::Rig::Events::SessionEnd.new(:close)) unless @session_start_pending
410
405
  end
411
406
 
@@ -459,21 +454,19 @@ class Riffer::Rig::Runtime
459
454
  # @rbs assembly: Riffer::Rig::Runtime::Assembly
460
455
  # @rbs hooks: Riffer::Rig::Runtime::Hooks
461
456
  # @rbs max_steps: Numeric?
457
+ # @rbs mcp_servers: Hash[String, Riffer::Rig::Mcp::Server]
462
458
  # @rbs return: Riffer::Agent::Config
463
- def agent_config(assembly, hooks, max_steps)
459
+ def agent_config(assembly, hooks, max_steps, mcp_servers)
464
460
  config = Riffer::Agent::Config.new(
465
461
  model: ->(context) { context[:model] },
466
462
  model_options: @model_options,
467
463
  reasoning: reasoning_over(assembly.settings),
468
- tools_config: assembly.tools,
464
+ tools_config: assembly.tools + mcp_servers.values.flat_map(&:tools),
469
465
  max_steps: max_steps,
470
466
  tool_runtime: Riffer::Rig::Runtime::ToolRuntime.new(hooks, emit: ->(event) { emit(event) }, clock: @clock),
471
467
  skills_config: assembly.skills_config(self)
472
468
  )
473
469
  config.add_guardrail(:before, klass: Riffer::Rig::Runtime::RequestGuardrail, options: { hooks: hooks })
474
- # Upstream candidate: riffer resolves MCP tools inside the agent, after
475
- # tools_config, so the tools: allowlist never sees them.
476
- config.add_mcp(@mcp.tag, progressive: false)
477
470
  config
478
471
  end
479
472
 
@@ -36,7 +36,9 @@ module Riffer::Rig::Stores::Entries
36
36
  opened_at = recorded.index { |entry| entry.message[:role].to_s == 'system' }
37
37
  messages = recorded.each_with_index.map do |entry, index|
38
38
  signed = opened_at && index > opened_at
39
- Riffer::Rig::Runtime::Snapshot.message(signed ? entry.message : entry.message.except(:reasoning))
39
+ Riffer::Rig::Runtime::Snapshot.message(
40
+ signed ? entry.message : Riffer::Rig::Runtime::Snapshot.drop_reasoning(entry.message)
41
+ )
40
42
  end
41
43
  system, conversation = messages.partition { |message| message.is_a?(Riffer::Messages::System) }
42
44
  [*system, *conversation]
@@ -81,7 +81,8 @@ module Riffer::Rig::Terminal::Replay
81
81
  # @rbs return: Riffer::Messages::Base?
82
82
  def message(entry)
83
83
  hash = entry.message
84
- Riffer::Rig::Runtime::Snapshot.message(hash) if hash[:content].is_a?(String)
84
+ # riffer stores an assistant turn's text in its parts, not under content.
85
+ Riffer::Rig::Runtime::Snapshot.message(hash) if hash[:content].is_a?(String) || hash[:parts].is_a?(Array)
85
86
  # riffer checks a message hash only by rebuilding it, and a damaged one
86
87
  # fails wherever the damage sits, not with one error.
87
88
  rescue StandardError
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Riffer
4
4
  module Rig
5
- VERSION = '0.20.1'
5
+ VERSION = '0.21.0'
6
6
  end
7
7
  end
@@ -0,0 +1,20 @@
1
+ # The mcp gem ships no signatures and gem_rbs_collection has none for it, so
2
+ # this stubs the client surface the rig uses.
3
+
4
+ module MCP
5
+ class Client
6
+ class Tool
7
+ attr_reader name: String
8
+ attr_reader description: String?
9
+ attr_reader input_schema: Hash[String, untyped]
10
+ end
11
+
12
+ class HTTP
13
+ def initialize: (url: String, ?headers: Hash[String, String]) -> void
14
+ end
15
+
16
+ def initialize: (transport: HTTP) -> void
17
+ def tools: () -> Array[Tool]
18
+ def call_tool: (?name: String?, ?arguments: Hash[Symbol, untyped]?) -> Hash[String, untyped]
19
+ end
20
+ end
@@ -100,6 +100,11 @@ module Riffer::Rig::ACP::Mapper
100
100
  # @rbs return: String
101
101
  def ending: (Riffer::Rig::Runtime::JobCompletion completion) -> String
102
102
 
103
+ # riffer stores an assistant turn's text in its parts, not under content.
104
+ # @rbs message: Hash[Symbol, untyped]
105
+ # @rbs return: ::ACP::Types::SessionUpdate::AgentMessageChunk?
106
+ def replayed_reply: (Hash[Symbol, untyped] message) -> ::ACP::Types::SessionUpdate::AgentMessageChunk?
107
+
103
108
  # The stored result is all a replayed call has: the arguments live in the
104
109
  # assistant message's tool_calls, so the title is the name alone.
105
110
  # @rbs message: Hash[Symbol, untyped]
@@ -0,0 +1,9 @@
1
+ # Generated from lib/riffer/rig/mcp/client.rb with RBS::Inline
2
+
3
+ module Riffer::Rig::Mcp::Client
4
+ # @rbs name: String
5
+ # @rbs url: String
6
+ # @rbs headers: Hash[String, String]
7
+ # @rbs return: Array[singleton(Riffer::Tool)]
8
+ def tools: (name: String, url: String, headers: Hash[String, String]) -> Array[singleton(Riffer::Tool)]
9
+ end
@@ -0,0 +1,21 @@
1
+ # Generated from lib/riffer/rig/mcp/tools.rb with RBS::Inline
2
+
3
+ module Riffer::Rig::Mcp::Tools
4
+ # @rbs server: String
5
+ # @rbs client: MCP::Client
6
+ # @rbs definitions: Array[MCP::Client::Tool]
7
+ # @rbs return: Array[singleton(Riffer::Tool)]
8
+ def build: (String server, MCP::Client client, Array[MCP::Client::Tool] definitions) -> Array[singleton(Riffer::Tool)]
9
+
10
+ private
11
+
12
+ # @rbs component: String
13
+ # @rbs return: String
14
+ def sanitize: (String component) -> String
15
+
16
+ # @rbs server: String
17
+ # @rbs client: MCP::Client
18
+ # @rbs definition: MCP::Client::Tool
19
+ # @rbs return: singleton(Riffer::Tool)
20
+ def tool_class: (String server, MCP::Client client, MCP::Client::Tool definition) -> singleton(Riffer::Tool)
21
+ end
@@ -4,13 +4,13 @@ module Riffer::Rig::Mcp
4
4
  class Server < Data
5
5
  attr_reader declaration(): Riffer::Rig::Mcp::Declaration
6
6
 
7
- attr_reader registration(): Riffer::Mcp::Registration
7
+ attr_reader tools(): Array[singleton(Riffer::Tool)]
8
8
 
9
- def self.new: (Riffer::Rig::Mcp::Declaration declaration, Riffer::Mcp::Registration registration) -> instance
10
- | (declaration: Riffer::Rig::Mcp::Declaration, registration: Riffer::Mcp::Registration) -> instance
9
+ def self.new: (Riffer::Rig::Mcp::Declaration declaration, Array[singleton(Riffer::Tool)] tools) -> instance
10
+ | (declaration: Riffer::Rig::Mcp::Declaration, tools: Array[singleton(Riffer::Tool)]) -> instance
11
11
 
12
- def self.members: () -> [ :declaration, :registration ]
12
+ def self.members: () -> [ :declaration, :tools ]
13
13
 
14
- def members: () -> [ :declaration, :registration ]
14
+ def members: () -> [ :declaration, :tools ]
15
15
  end
16
16
  end
@@ -1,7 +1,7 @@
1
1
  # Generated from lib/riffer/rig/runtime/mcp_registrar.rb with RBS::Inline
2
2
 
3
3
  class Riffer::Rig::Runtime::McpRegistrar
4
- @registry: Riffer::Rig::Mcp::_Registry
4
+ @client: Riffer::Rig::Mcp::_Client
5
5
 
6
6
  @host: Riffer::Rig::Hosts::_Host
7
7
 
@@ -11,25 +11,17 @@ class Riffer::Rig::Runtime::McpRegistrar
11
11
 
12
12
  @servers: Hash[String, Riffer::Rig::Mcp::Server]
13
13
 
14
- # @dynamic tag
15
- attr_reader tag: Symbol
16
-
17
- # @rbs runtime_id: String
18
- # @rbs registry: Riffer::Rig::Mcp::_Registry
14
+ # @rbs client: Riffer::Rig::Mcp::_Client
19
15
  # @rbs host: Riffer::Rig::Hosts::_Host
20
16
  # @rbs env: Riffer::Rig::Env
21
17
  # @rbs auth_path: String
22
18
  # @rbs return: void
23
- def initialize: (String runtime_id, registry: Riffer::Rig::Mcp::_Registry, host: Riffer::Rig::Hosts::_Host, env: Riffer::Rig::Env, auth_path: String) -> void
19
+ def initialize: (client: Riffer::Rig::Mcp::_Client, host: Riffer::Rig::Hosts::_Host, env: Riffer::Rig::Env, auth_path: String) -> void
24
20
 
25
21
  # @rbs declarations: Hash[String, Riffer::Rig::Mcp::Declaration]
26
22
  # @rbs return: Hash[String, Riffer::Rig::Mcp::Server]
27
23
  def register: (Hash[String, Riffer::Rig::Mcp::Declaration] declarations) -> Hash[String, Riffer::Rig::Mcp::Server]
28
24
 
29
- # @rbs servers: Hash[String, Riffer::Rig::Mcp::Server]
30
- # @rbs return: void
31
- def retain: (Hash[String, Riffer::Rig::Mcp::Server] servers) -> void
32
-
33
25
  private
34
26
 
35
27
  # The stored declaration is the resolved one, so a later register compares
@@ -43,4 +35,8 @@ class Riffer::Rig::Runtime::McpRegistrar
43
35
  # @rbs declaration: Riffer::Rig::Mcp::Declaration
44
36
  # @rbs return: Riffer::Rig::Mcp::Server?
45
37
  def register_server: (String name, Riffer::Rig::Mcp::Declaration declaration) -> Riffer::Rig::Mcp::Server?
38
+
39
+ # @rbs url: String
40
+ # @rbs return: bool
41
+ def https?: (String url) -> bool
46
42
  end
@@ -22,6 +22,10 @@ class Riffer::Rig::Runtime::Snapshot
22
22
  # @rbs return: Riffer::Rig::Runtime::Snapshot
23
23
  def self.from_h: (Hash[Symbol, untyped] hash) -> Riffer::Rig::Runtime::Snapshot
24
24
 
25
+ # @rbs hash: Hash[Symbol, untyped]
26
+ # @rbs return: Hash[Symbol, untyped]
27
+ def self.drop_reasoning: (Hash[Symbol, untyped] hash) -> Hash[Symbol, untyped]
28
+
25
29
  # @rbs hash: Hash[Symbol, untyped]
26
30
  # @rbs return: Riffer::Messages::Base
27
31
  def self.message: (Hash[Symbol, untyped] hash) -> Riffer::Messages::Base
@@ -146,7 +146,7 @@ class Riffer::Rig::Runtime
146
146
  # @rbs settings_path: String
147
147
  # @rbs reasoning: String?
148
148
  # @rbs riffer_config: Riffer::Config
149
- # @rbs mcp_registry: Riffer::Rig::Mcp::_Registry
149
+ # @rbs mcp_client: Riffer::Rig::Mcp::_Client
150
150
  # @rbs max_steps: Integer?
151
151
  # @rbs model_options: Hash[Symbol, untyped]
152
152
  # @rbs native_tools: Hash[Symbol, untyped]
@@ -154,7 +154,7 @@ class Riffer::Rig::Runtime
154
154
  # @rbs clock: ^() -> Float
155
155
  # @rbs snapshot: (Riffer::Rig::Runtime::Snapshot | Hash[Symbol, untyped])?
156
156
  # @rbs return: void
157
- def initialize: (String model, ?extensions: Array[Riffer::Rig::Extension], ?tools: Array[String]?, ?settings: Hash[Symbol, untyped], ?host: Riffer::Rig::Hosts::_Host, ?cwd: String?, ?name: String, ?instructions: String?, ?credentials: Hash[Symbol, Hash[Symbol, String]], ?env: Riffer::Rig::Env, ?auth_path: String, ?settings_path: String, ?reasoning: String?, ?riffer_config: Riffer::Config, ?mcp_registry: Riffer::Rig::Mcp::_Registry, ?max_steps: Integer?, ?model_options: Hash[Symbol, untyped], ?native_tools: Hash[Symbol, untyped], ?max_tokens: Integer?, ?clock: ^() -> Float, ?snapshot: (Riffer::Rig::Runtime::Snapshot | Hash[Symbol, untyped])?) -> void
157
+ def initialize: (String model, ?extensions: Array[Riffer::Rig::Extension], ?tools: Array[String]?, ?settings: Hash[Symbol, untyped], ?host: Riffer::Rig::Hosts::_Host, ?cwd: String?, ?name: String, ?instructions: String?, ?credentials: Hash[Symbol, Hash[Symbol, String]], ?env: Riffer::Rig::Env, ?auth_path: String, ?settings_path: String, ?reasoning: String?, ?riffer_config: Riffer::Config, ?mcp_client: Riffer::Rig::Mcp::_Client, ?max_steps: Integer?, ?model_options: Hash[Symbol, untyped], ?native_tools: Hash[Symbol, untyped], ?max_tokens: Integer?, ?clock: ^() -> Float, ?snapshot: (Riffer::Rig::Runtime::Snapshot | Hash[Symbol, untyped])?) -> void
158
158
 
159
159
  # @rbs text: String
160
160
  # @rbs &: ?(::Riffer::StreamEvents::Base | Riffer::Rig::Events::_Event) -> void
@@ -294,8 +294,9 @@ class Riffer::Rig::Runtime
294
294
  # @rbs assembly: Riffer::Rig::Runtime::Assembly
295
295
  # @rbs hooks: Riffer::Rig::Runtime::Hooks
296
296
  # @rbs max_steps: Numeric?
297
+ # @rbs mcp_servers: Hash[String, Riffer::Rig::Mcp::Server]
297
298
  # @rbs return: Riffer::Agent::Config
298
- def agent_config: (Riffer::Rig::Runtime::Assembly assembly, Riffer::Rig::Runtime::Hooks hooks, Numeric? max_steps) -> Riffer::Agent::Config
299
+ def agent_config: (Riffer::Rig::Runtime::Assembly assembly, Riffer::Rig::Runtime::Hooks hooks, Numeric? max_steps, Hash[String, Riffer::Rig::Mcp::Server] mcp_servers) -> Riffer::Agent::Config
299
300
 
300
301
  # @rbs assembly: Riffer::Rig::Runtime::Assembly
301
302
  # @rbs hooks: Riffer::Rig::Runtime::Hooks
@@ -0,0 +1,6 @@
1
+ # rbs-inline does not emit `extend self`, so without this reopen the module's
2
+ # methods aren't visible as singleton methods.
3
+
4
+ module Riffer::Rig::Mcp::Client
5
+ extend ::Riffer::Rig::Mcp::Client
6
+ end
@@ -0,0 +1,6 @@
1
+ # rbs-inline does not emit `extend self`, so without this reopen the module's
2
+ # methods aren't visible as singleton methods.
3
+
4
+ module Riffer::Rig::Mcp::Tools
5
+ extend ::Riffer::Rig::Mcp::Tools
6
+ end
@@ -1,6 +1,5 @@
1
1
  module Riffer::Rig::Mcp
2
- interface _Registry
3
- def register: (Hash[Symbol, untyped]) -> Riffer::Mcp::Registration
4
- def unregister: (String) -> void
2
+ interface _Client
3
+ def tools: (name: String, url: String, headers: Hash[String, String]) -> Array[singleton(Riffer::Tool)]
5
4
  end
6
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riffer-rig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Bottrall
@@ -85,14 +85,14 @@ dependencies:
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 0.55.0
88
+ version: 0.59.0
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 0.55.0
95
+ version: 0.59.0
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: zeitwerk
98
98
  requirement: !ruby/object:Gem::Requirement
@@ -180,7 +180,9 @@ files:
180
180
  - lib/riffer/rig/loader/reloader.rb
181
181
  - lib/riffer/rig/mcp.rb
182
182
  - lib/riffer/rig/mcp/auth.rb
183
+ - lib/riffer/rig/mcp/client.rb
183
184
  - lib/riffer/rig/mcp/declaration.rb
185
+ - lib/riffer/rig/mcp/tools.rb
184
186
  - lib/riffer/rig/prompts.rb
185
187
  - lib/riffer/rig/prompts/agents_md.rb
186
188
  - lib/riffer/rig/provider_setup.rb
@@ -286,6 +288,7 @@ files:
286
288
  - lib/riffer/rig/tools/write.rb
287
289
  - lib/riffer/rig/trust.rb
288
290
  - lib/riffer/rig/version.rb
291
+ - sig/_private/mcp.rbs
289
292
  - sig/_private/open3.rbs
290
293
  - sig/_private/process.rbs
291
294
  - sig/_private/rubygems.rbs
@@ -349,7 +352,9 @@ files:
349
352
  - sig/generated/riffer/rig/loader/reloader.rbs
350
353
  - sig/generated/riffer/rig/mcp.rbs
351
354
  - sig/generated/riffer/rig/mcp/auth.rbs
355
+ - sig/generated/riffer/rig/mcp/client.rbs
352
356
  - sig/generated/riffer/rig/mcp/declaration.rbs
357
+ - sig/generated/riffer/rig/mcp/tools.rbs
353
358
  - sig/generated/riffer/rig/prompts.rbs
354
359
  - sig/generated/riffer/rig/prompts/agents_md.rbs
355
360
  - sig/generated/riffer/rig/provider_setup.rbs
@@ -477,6 +482,8 @@ files:
477
482
  - sig/manual/riffer/rig/loader/reasoning.rbs
478
483
  - sig/manual/riffer/rig/mcp.rbs
479
484
  - sig/manual/riffer/rig/mcp/auth.rbs
485
+ - sig/manual/riffer/rig/mcp/client.rbs
486
+ - sig/manual/riffer/rig/mcp/tools.rbs
480
487
  - sig/manual/riffer/rig/prompts/agents_md.rbs
481
488
  - sig/manual/riffer/rig/providers.rbs
482
489
  - sig/manual/riffer/rig/runtime/error_message.rbs