riffer 0.55.0 → 0.57.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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.release-please-manifest.json +1 -1
  3. data/CHANGELOG.md +37 -0
  4. data/README.md +3 -2
  5. data/UPGRADING.md +3 -0
  6. data/docs/AGENTS.md +105 -50
  7. data/docs/AGENT_LIFECYCLE.md +2 -2
  8. data/docs/CONFIGURATION.md +54 -3
  9. data/docs/EVALS.md +2 -0
  10. data/docs/GUARDRAILS.md +2 -0
  11. data/docs/MCP.md +36 -0
  12. data/docs/MESSAGES.md +125 -15
  13. data/docs/OVERVIEW.md +7 -7
  14. data/docs/SERIALIZATION.md +12 -2
  15. data/docs/SKILLS.md +1 -1
  16. data/docs/STABILITY.md +32 -0
  17. data/docs/STREAM_EVENTS.md +16 -0
  18. data/docs/TESTING.md +22 -1
  19. data/docs/TOOLS.md +93 -37
  20. data/docs/TOOL_ADVANCED.md +7 -0
  21. data/docs/providers/AMAZON_BEDROCK.md +7 -3
  22. data/docs/providers/ANTHROPIC.md +53 -16
  23. data/docs/providers/AZURE_OPENAI.md +9 -3
  24. data/docs/providers/CUSTOM_PROVIDERS.md +43 -0
  25. data/docs/providers/GEMINI.md +9 -5
  26. data/docs/providers/GOOGLE_CLOUD.md +10 -5
  27. data/docs/providers/MOCK_PROVIDER.md +4 -0
  28. data/docs/providers/OPENAI.md +28 -4
  29. data/docs/providers/OPENROUTER.md +11 -3
  30. data/docs/providers/PROVIDERS.md +1 -1
  31. data/docs-site/index.html.erb +1 -1
  32. data/docs-site/manifest.yml +3 -0
  33. data/lib/riffer/agent/config.rb +21 -0
  34. data/lib/riffer/agent/context.rb +36 -18
  35. data/lib/riffer/agent/run.rb +82 -21
  36. data/lib/riffer/agent/serializer.rb +5 -0
  37. data/lib/riffer/agent/session.rb +34 -10
  38. data/lib/riffer/agent.rb +43 -0
  39. data/lib/riffer/config/future.rb +53 -0
  40. data/lib/riffer/config/mcp.rb +17 -0
  41. data/lib/riffer/config/pricing.rb +5 -15
  42. data/lib/riffer/config.rb +28 -1
  43. data/lib/riffer/deprecation/event.rb +25 -0
  44. data/lib/riffer/deprecation.rb +60 -0
  45. data/lib/riffer/evals/evaluator.rb +8 -1
  46. data/lib/riffer/evals/evaluator_runner.rb +1 -0
  47. data/lib/riffer/evals/judge.rb +2 -2
  48. data/lib/riffer/evals.rb +2 -0
  49. data/lib/riffer/mcp/search_tool.rb +1 -1
  50. data/lib/riffer/mcp.rb +7 -0
  51. data/lib/riffer/messages/assistant/server_tool_part.rb +73 -0
  52. data/lib/riffer/messages/assistant/text_part.rb +52 -0
  53. data/lib/riffer/messages/assistant.rb +64 -17
  54. data/lib/riffer/messages/tool.rb +6 -2
  55. data/lib/riffer/params/any_of.rb +5 -8
  56. data/lib/riffer/params/boolean.rb +1 -1
  57. data/lib/riffer/params/param.rb +96 -67
  58. data/lib/riffer/params.rb +50 -71
  59. data/lib/riffer/providers/anthropic_compatible/messages_api/stream.rb +28 -11
  60. data/lib/riffer/providers/anthropic_compatible/messages_api.rb +136 -38
  61. data/lib/riffer/providers/base.rb +57 -12
  62. data/lib/riffer/providers/deferred_tool_gateway/sink.rb +54 -0
  63. data/lib/riffer/providers/deferred_tool_gateway/tool.rb +17 -0
  64. data/lib/riffer/providers/deferred_tool_gateway.rb +150 -0
  65. data/lib/riffer/providers/gemini.rb +5 -5
  66. data/lib/riffer/providers/mock.rb +6 -0
  67. data/lib/riffer/providers/open_ai.rb +59 -26
  68. data/lib/riffer/skills/activate_tool.rb +1 -1
  69. data/lib/riffer/stream_events/server_tool_done.rb +21 -0
  70. data/lib/riffer/testing.rb +6 -0
  71. data/lib/riffer/tool.rb +92 -2
  72. data/lib/riffer/tools/response.rb +11 -2
  73. data/lib/riffer/version.rb +1 -1
  74. data/lib/riffer.rb +2 -0
  75. data/sig/generated/riffer/agent/config.rbs +13 -1
  76. data/sig/generated/riffer/agent/context.rbs +16 -0
  77. data/sig/generated/riffer/agent/run.rbs +19 -2
  78. data/sig/generated/riffer/agent/session.rbs +6 -0
  79. data/sig/generated/riffer/agent.rbs +13 -0
  80. data/sig/generated/riffer/config/future.rbs +29 -0
  81. data/sig/generated/riffer/config/mcp.rbs +7 -0
  82. data/sig/generated/riffer/config/pricing.rbs +0 -9
  83. data/sig/generated/riffer/config.rbs +13 -1
  84. data/sig/generated/riffer/deprecation/event.rbs +17 -0
  85. data/sig/generated/riffer/deprecation.rbs +27 -0
  86. data/sig/generated/riffer/evals/evaluator.rbs +4 -0
  87. data/sig/generated/riffer/evals.rbs +1 -0
  88. data/sig/generated/riffer/mcp.rbs +1 -0
  89. data/sig/generated/riffer/messages/assistant/server_tool_part.rbs +44 -0
  90. data/sig/generated/riffer/messages/assistant/text_part.rbs +35 -0
  91. data/sig/generated/riffer/messages/assistant.rbs +24 -11
  92. data/sig/generated/riffer/messages/tool.rbs +4 -2
  93. data/sig/generated/riffer/params/any_of.rbs +4 -4
  94. data/sig/generated/riffer/params/boolean.rbs +1 -1
  95. data/sig/generated/riffer/params/param.rbs +28 -14
  96. data/sig/generated/riffer/params.rbs +20 -20
  97. data/sig/generated/riffer/providers/anthropic_compatible/messages_api/stream.rbs +12 -5
  98. data/sig/generated/riffer/providers/anthropic_compatible/messages_api.rbs +50 -9
  99. data/sig/generated/riffer/providers/base.rbs +18 -0
  100. data/sig/generated/riffer/providers/deferred_tool_gateway/sink.rbs +23 -0
  101. data/sig/generated/riffer/providers/deferred_tool_gateway/tool.rbs +4 -0
  102. data/sig/generated/riffer/providers/deferred_tool_gateway.rbs +58 -0
  103. data/sig/generated/riffer/providers/mock.rbs +4 -0
  104. data/sig/generated/riffer/providers/open_ai.rbs +23 -6
  105. data/sig/generated/riffer/stream_events/server_tool_done.rbs +15 -0
  106. data/sig/generated/riffer/testing.rbs +4 -0
  107. data/sig/generated/riffer/tool.rbs +48 -2
  108. data/sig/generated/riffer/tools/response.rbs +9 -2
  109. data/sig/generated/riffer.rbs +3 -0
  110. data/sig/manual/riffer/deprecation.rbs +5 -0
  111. data/sig/manual/riffer/providers/deferred_tool_gateway.rbs +5 -0
  112. metadata +23 -3
  113. data/lib/riffer/tools/toolable.rb +0 -113
  114. data/sig/generated/riffer/tools/toolable.rbs +0 -66
data/lib/riffer/tool.rb CHANGED
@@ -4,10 +4,94 @@
4
4
  require "timeout"
5
5
 
6
6
  class Riffer::Tool
7
- extend Riffer::Tools::Toolable
8
7
  extend Riffer::Registrable
9
8
 
10
- kind :tool
9
+ # @rbs self.@description: String?
10
+ # @rbs self.@identifier: String?
11
+ # @rbs self.@timeout: (Integer | Float)?
12
+ # @rbs self.@params_builder: Riffer::Params?
13
+
14
+ DEFAULT_TIMEOUT = 10 #: Integer
15
+
16
+ class << self
17
+ #--
18
+ #: (?String?) -> String?
19
+ def description(value = nil)
20
+ return @description if value.nil?
21
+
22
+ @description = value.to_s
23
+ end
24
+
25
+ #--
26
+ #: (?String?) -> String
27
+ def identifier(value = nil)
28
+ return @identifier || Riffer::Helpers::Identifier.for(self) if value.nil?
29
+
30
+ @identifier = value.to_s
31
+ end
32
+
33
+ #--
34
+ #: (?String?) -> String
35
+ def name(value = nil)
36
+ return identifier(value) if value
37
+
38
+ identifier
39
+ end
40
+
41
+ #--
42
+ #: (?(Integer | Float)?) -> (Integer | Float)
43
+ def timeout(value = nil)
44
+ return @timeout || DEFAULT_TIMEOUT if value.nil?
45
+
46
+ @timeout = value.to_f
47
+ end
48
+
49
+ #--
50
+ #: () ?{ (Riffer::Params) [self: Riffer::Params] -> void } -> Riffer::Params?
51
+ def params(&block)
52
+ return @params_builder if block.nil?
53
+
54
+ builder = Riffer::Params.new
55
+ builder.instance_eval(&block)
56
+ @params_builder = builder
57
+ end
58
+
59
+ #--
60
+ #: (?strict: bool) -> Hash[Symbol, untyped]
61
+ def parameters_schema(strict: false)
62
+ @params_builder&.to_json_schema(strict: strict) || empty_schema
63
+ end
64
+
65
+ #--
66
+ #: (?strict: bool) -> Hash[Symbol, untyped]
67
+ def to_tool_schema(strict: false)
68
+ {
69
+ name: name,
70
+ description: description,
71
+ parameters_schema: parameters_schema(strict: strict),
72
+ }
73
+ end
74
+
75
+ #--
76
+ #: () -> true
77
+ def validate_as_tool!
78
+ if description.nil? || description.to_s.strip.empty?
79
+ raise Riffer::ArgumentError,
80
+ "#{self} must define a description"
81
+ end
82
+ raise Riffer::ArgumentError, "#{self} must have an identifier" if identifier.nil? || identifier.to_s.strip.empty?
83
+
84
+ true
85
+ end
86
+
87
+ private
88
+
89
+ def empty_schema # :nodoc:
90
+ properties = {} #: Hash[Symbol, untyped]
91
+ required = [] #: Array[untyped]
92
+ { type: "object", properties: properties, required: required, additionalProperties: false }
93
+ end
94
+ end
11
95
 
12
96
  #--
13
97
  #: (context: Riffer::Agent::Context?, **untyped) -> Riffer::Tools::Response
@@ -27,6 +111,12 @@ class Riffer::Tool
27
111
  Riffer::Tools::Response.json(result)
28
112
  end
29
113
 
114
+ #--
115
+ #: (Array[singleton(Riffer::Tool)]) -> Riffer::Tools::Response
116
+ def load_tools(tools)
117
+ Riffer::Tools::Response.load_tools(tools)
118
+ end
119
+
30
120
  #--
31
121
  #: (String, ?type: Symbol) -> Riffer::Tools::Response
32
122
  def error(message, type: :execution_error)
@@ -12,6 +12,7 @@ class Riffer::Tools::Response
12
12
  attr_reader :content #: String # @dynamic content
13
13
  attr_reader :error_message #: String? # @dynamic error_message
14
14
  attr_reader :error_type #: Symbol? # @dynamic error_type
15
+ attr_reader :loaded_tools #: Array[singleton(Riffer::Tool)] # @dynamic loaded_tools
15
16
 
16
17
  # Kept out of every serialized form so it never reaches an LLM or a message
17
18
  # payload.
@@ -40,6 +41,13 @@ class Riffer::Tools::Response
40
41
  success(result, format: :json)
41
42
  end
42
43
 
44
+ # No text alongside: Anthropic rejects a tool result that mixes +tool_reference+ blocks with text.
45
+ #--
46
+ #: (Array[singleton(Riffer::Tool)]) -> Riffer::Tools::Response
47
+ def self.load_tools(tools)
48
+ new(content: "", success: true, loaded_tools: tools)
49
+ end
50
+
43
51
  #--
44
52
  #: (String, ?type: Symbol, ?exception: Exception?) -> Riffer::Tools::Response
45
53
  def self.error(message, type: :execution_error, exception: nil)
@@ -63,12 +71,13 @@ class Riffer::Tools::Response
63
71
  private
64
72
 
65
73
  #--
66
- #: (content: String, success: bool, ?error_message: String?, ?error_type: Symbol?, ?exception: Exception?) -> void
67
- def initialize(content:, success:, error_message: nil, error_type: nil, exception: nil)
74
+ #: (content: String, success: bool, ?error_message: String?, ?error_type: Symbol?, ?exception: Exception?, ?loaded_tools: Array[singleton(Riffer::Tool)]) -> void
75
+ def initialize(content:, success:, error_message: nil, error_type: nil, exception: nil, loaded_tools: [])
68
76
  @content = content
69
77
  @success = success
70
78
  @error_message = error_message
71
79
  @error_type = error_type
72
80
  @exception = exception
81
+ @loaded_tools = loaded_tools
73
82
  end
74
83
  end
@@ -2,5 +2,5 @@
2
2
  # rbs_inline: enabled
3
3
 
4
4
  module Riffer
5
- VERSION = "0.55.0" #: String
5
+ VERSION = "0.57.0" #: String
6
6
  end
data/lib/riffer.rb CHANGED
@@ -74,6 +74,8 @@ module Riffer
74
74
 
75
75
  class DuplicateIdentifierError < Error; end
76
76
 
77
+ class DeprecationError < Error; end
78
+
77
79
  #--
78
80
  #: () -> Riffer::Config
79
81
  def config
@@ -5,6 +5,8 @@ class Riffer::Agent::Config
5
5
 
6
6
  STRUCTURED_OUTPUT_STRATEGIES: Array[Symbol]
7
7
 
8
+ DEFERRED_TOOLS_STRATEGIES: Array[Symbol]
9
+
8
10
  REASONING_LEVELS: Array[Symbol]
9
11
 
10
12
  @tool_runtime: (singleton(Riffer::Tools::Runtime) | Riffer::Tools::Runtime | Proc)?
@@ -27,6 +29,10 @@ class Riffer::Agent::Config
27
29
 
28
30
  attr_accessor tools_config: (Array[singleton(Riffer::Tool)] | Proc)?
29
31
 
32
+ attr_accessor deferred_tools_config: (Array[singleton(Riffer::Tool)] | Proc)?
33
+
34
+ attr_reader deferred_tools_strategy: Symbol
35
+
30
36
  attr_reader mcp_configs: Array[Hash[Symbol, untyped]]
31
37
 
32
38
  attr_accessor skills_config: Riffer::Skills::Config?
@@ -44,12 +50,14 @@ class Riffer::Agent::Config
44
50
  # ?max_steps: Numeric?,
45
51
  # ?reasoning: (Symbol | String)?,
46
52
  # ?tools_config: (Array[singleton(Riffer::Tool)] | Proc)?,
53
+ # ?deferred_tools_config: (Array[singleton(Riffer::Tool)] | Proc)?,
54
+ # ?deferred_tools_strategy: Symbol,
47
55
  # ?mcp_configs: Array[Hash[Symbol, untyped]],
48
56
  # ?tool_runtime: (singleton(Riffer::Tools::Runtime) | Riffer::Tools::Runtime | Proc)?,
49
57
  # ?skills_config: Riffer::Skills::Config?,
50
58
  # ?guardrails: Hash[Symbol, Array[Hash[Symbol, untyped]]]
51
59
  # ) -> void
52
- def initialize: (?identifier: String?, ?model: (String | Proc)?, ?instructions: (String | Proc)?, ?model_options: Hash[Symbol, untyped], ?structured_output: Riffer::Params?, ?structured_output_strategy: Symbol, ?max_steps: Numeric?, ?reasoning: (Symbol | String)?, ?tools_config: (Array[singleton(Riffer::Tool)] | Proc)?, ?mcp_configs: Array[Hash[Symbol, untyped]], ?tool_runtime: (singleton(Riffer::Tools::Runtime) | Riffer::Tools::Runtime | Proc)?, ?skills_config: Riffer::Skills::Config?, ?guardrails: Hash[Symbol, Array[Hash[Symbol, untyped]]]) -> void
60
+ def initialize: (?identifier: String?, ?model: (String | Proc)?, ?instructions: (String | Proc)?, ?model_options: Hash[Symbol, untyped], ?structured_output: Riffer::Params?, ?structured_output_strategy: Symbol, ?max_steps: Numeric?, ?reasoning: (Symbol | String)?, ?tools_config: (Array[singleton(Riffer::Tool)] | Proc)?, ?deferred_tools_config: (Array[singleton(Riffer::Tool)] | Proc)?, ?deferred_tools_strategy: Symbol, ?mcp_configs: Array[Hash[Symbol, untyped]], ?tool_runtime: (singleton(Riffer::Tools::Runtime) | Riffer::Tools::Runtime | Proc)?, ?skills_config: Riffer::Skills::Config?, ?guardrails: Hash[Symbol, Array[Hash[Symbol, untyped]]]) -> void
53
61
 
54
62
  # --
55
63
  # : (untyped) -> String?
@@ -63,6 +71,10 @@ class Riffer::Agent::Config
63
71
  # : (Symbol) -> Symbol
64
72
  def structured_output_strategy=: (Symbol) -> Symbol
65
73
 
74
+ # --
75
+ # : (Symbol) -> Symbol
76
+ def deferred_tools_strategy=: (Symbol) -> Symbol
77
+
66
78
  # --
67
79
  # : ((Symbol | String)?) -> Symbol?
68
80
  def reasoning=: ((Symbol | String)?) -> Symbol?
@@ -47,6 +47,12 @@ class Riffer::Agent::Context
47
47
  # : (Array[singleton(Riffer::Tool)]?) -> Array[singleton(Riffer::Tool)]?
48
48
  def discovered_tools=: (Array[singleton(Riffer::Tool)]?) -> Array[singleton(Riffer::Tool)]?
49
49
 
50
+ attr_reader deferred_tools: Array[singleton(Riffer::Tool)]?
51
+
52
+ # --
53
+ # : (Array[singleton(Riffer::Tool)]?) -> Array[singleton(Riffer::Tool)]?
54
+ def deferred_tools=: (Array[singleton(Riffer::Tool)]?) -> Array[singleton(Riffer::Tool)]?
55
+
50
56
  # --
51
57
  # : (Array[singleton(Riffer::Tool)]) -> Array[singleton(Riffer::Tool)]
52
58
  def discover_tools: (Array[singleton(Riffer::Tool)]) -> Array[singleton(Riffer::Tool)]
@@ -58,4 +64,14 @@ class Riffer::Agent::Context
58
64
  # --
59
65
  # : () -> Hash[Symbol, untyped]
60
66
  def to_h: () -> Hash[Symbol, untyped]
67
+
68
+ private
69
+
70
+ # --
71
+ # : (Symbol, Array[singleton(Riffer::Tool)]?) -> Array[singleton(Riffer::Tool)]?
72
+ def validate_tool_classes: (Symbol, Array[singleton(Riffer::Tool)]?) -> Array[singleton(Riffer::Tool)]?
73
+
74
+ # --
75
+ # : () -> void
76
+ def warn_deferred_tools_key: () -> void
61
77
  end
@@ -23,6 +23,11 @@ module Riffer::Agent::Run
23
23
  # : (Riffer::Agent, Enumerator::Yielder, ?Hash[String, String]) -> Riffer::Messages::Assistant
24
24
  def accumulate_streamed_response: (Riffer::Agent, Enumerator::Yielder, ?Hash[String, String]) -> Riffer::Messages::Assistant
25
25
 
26
+ # TextDone is the adapter's authoritative full text, so it wins over the deltas.
27
+ # --
28
+ # : (Array[String | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart], String?) -> Array[Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart]
29
+ def streamed_parts: (Array[String | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart], String?) -> Array[Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart]
30
+
26
31
  # --
27
32
  # : (Enumerator::Yielder?, Array[Riffer::Guardrails::Modification], Array[Riffer::Guardrails::Modification]) -> void
28
33
  def record_modifications!: (Enumerator::Yielder?, Array[Riffer::Guardrails::Modification], Array[Riffer::Guardrails::Modification]) -> void
@@ -52,8 +57,20 @@ module Riffer::Agent::Run
52
57
  def execute_tool_calls: (Riffer::Agent, Riffer::Messages::Assistant, ?tool_calls: Array[Riffer::Messages::Assistant::ToolCall], ?tags: Hash[String, String]) -> void
53
58
 
54
59
  # --
55
- # : (Riffer::Agent, Array[[Riffer::Messages::Assistant::ToolCall, Riffer::Tools::Response]]) -> void
56
- def inject_discovered_tools: (Riffer::Agent, Array[[ Riffer::Messages::Assistant::ToolCall, Riffer::Tools::Response ]]) -> void
60
+ # : (Array[Riffer::Messages::Base], Array[singleton(Riffer::Tool)]) -> Array[singleton(Riffer::Tool)]
61
+ def loaded_tools: (Array[Riffer::Messages::Base], Array[singleton(Riffer::Tool)]) -> Array[singleton(Riffer::Tool)]
62
+
63
+ # --
64
+ # : (Riffer::Agent, Riffer::Tools::Response) -> Riffer::Tools::Response
65
+ def reject_invalid_load: (Riffer::Agent, Riffer::Tools::Response) -> Riffer::Tools::Response
66
+
67
+ # --
68
+ # : (Riffer::Messages::Assistant::ToolCall) -> Riffer::Tools::Response
69
+ def tool_not_loaded: (Riffer::Messages::Assistant::ToolCall) -> Riffer::Tools::Response
70
+
71
+ # --
72
+ # : (Riffer::Agent, Hash[Riffer::Messages::Assistant::ToolCall, Riffer::Tools::Response]) -> void
73
+ def inject_discovered_tools: (Riffer::Agent, Hash[Riffer::Messages::Assistant::ToolCall, Riffer::Tools::Response]) -> void
57
74
 
58
75
  # --
59
76
  # : (Riffer::Agent, ?Hash[String, String]) -> void
@@ -80,4 +80,10 @@ class Riffer::Agent::Session
80
80
  # --
81
81
  # : (Riffer::Messages::Base, Hash[Symbol, untyped]) -> Riffer::Messages::Base
82
82
  def rebuild_message: (Riffer::Messages::Base, Hash[Symbol, untyped]) -> Riffer::Messages::Base
83
+
84
+ # A +content+, +tool_calls+ or +reasoning+ edit rebuilds the parts in the default order, which
85
+ # drops server tool parts; +parts:+ replaces them as given.
86
+ # --
87
+ # : (Riffer::Messages::Assistant, Hash[Symbol, untyped]) -> Riffer::Messages::Assistant
88
+ def rebuild_assistant: (Riffer::Messages::Assistant, Hash[Symbol, untyped]) -> Riffer::Messages::Assistant
83
89
  end
@@ -47,6 +47,11 @@ class Riffer::Agent
47
47
  # : (?(Array[singleton(Riffer::Tool)] | Proc)?) -> (Array[singleton(Riffer::Tool)] | Proc)?
48
48
  def self.uses_tools: (?(Array[singleton(Riffer::Tool)] | Proc)?) -> (Array[singleton(Riffer::Tool)] | Proc)?
49
49
 
50
+ # --
51
+ # : (?(Array[singleton(Riffer::Tool)] | Proc)?, ?strategy: Symbol?) -> (Array[singleton(Riffer::Tool)] | Proc)?
52
+ def self.deferred_tools: (?(Array[singleton(Riffer::Tool)] | Proc)?, ?strategy: Symbol?) -> (Array[singleton(Riffer::Tool)] | Proc)?
53
+
54
+ # @deprecated MCP client support will be removed; wrap the +mcp+ gem in your own Riffer::Tool (see docs/MCP.md).
50
55
  # +progressive+ exposes +mcp_search+ instead of every tool schema up front.
51
56
  # --
52
57
  # : (String | Symbol, ?progressive: bool) -> void
@@ -118,6 +123,10 @@ class Riffer::Agent
118
123
  # : () -> String
119
124
  def identifier: () -> String
120
125
 
126
+ # --
127
+ # : () -> Array[singleton(Riffer::Tool)]
128
+ def deferred_tools: () -> Array[singleton(Riffer::Tool)]
129
+
121
130
  # --
122
131
  # : (?String?, ?files: Array[Hash[Symbol, untyped] | Riffer::Messages::User::FilePart]?, ?tags: Hash[(String | Symbol), untyped]) -> Riffer::Agent::Response
123
132
  def generate: (?String?, ?files: Array[Hash[Symbol, untyped] | Riffer::Messages::User::FilePart]?, ?tags: Hash[String | Symbol, untyped]) -> Riffer::Agent::Response
@@ -170,6 +179,10 @@ class Riffer::Agent
170
179
  # : () -> Array[singleton(Riffer::Tool)]
171
180
  def resolve_tools: () -> Array[singleton(Riffer::Tool)]
172
181
 
182
+ # --
183
+ # : () -> Array[singleton(Riffer::Tool)]
184
+ def resolve_deferred_tools: () -> Array[singleton(Riffer::Tool)]
185
+
173
186
  # --
174
187
  # : () -> Riffer::Tools::Runtime
175
188
  def resolve_tool_runtime: () -> Riffer::Tools::Runtime
@@ -0,0 +1,29 @@
1
+ # Generated from lib/riffer/config/future.rb with RBS::Inline
2
+
3
+ class Riffer::Config::Future
4
+ # Steep can't type an empty literal; drop the ignore once FLAGS has an entry.
5
+ # steep:ignore:start
6
+ FLAGS: Hash[Symbol, { default: bool }]
7
+
8
+ @flags: Hash[Symbol, { default: bool }]
9
+
10
+ @enabled: Hash[Symbol, bool]
11
+
12
+ # --
13
+ # : (?flags: Hash[Symbol, { default: bool }]) -> void
14
+ def initialize: (?flags: Hash[Symbol, { default: bool }]) -> void
15
+
16
+ # --
17
+ # : (Symbol) -> bool
18
+ def enabled?: (Symbol) -> bool
19
+
20
+ private
21
+
22
+ # --
23
+ # : (Symbol, untyped) -> void
24
+ def set: (Symbol, untyped) -> void
25
+
26
+ # --
27
+ # : (Symbol) -> { default: bool }
28
+ def flag: (Symbol) -> { default: bool }
29
+ end
@@ -1,5 +1,6 @@
1
1
  # Generated from lib/riffer/config/mcp.rb with RBS::Inline
2
2
 
3
+ # @deprecated MCP client support will be removed; wrap the +mcp+ gem in your own Riffer::Tool (see docs/MCP.md).
3
4
  class Riffer::Config::Mcp
4
5
  attr_reader credentials: untyped
5
6
 
@@ -16,4 +17,10 @@ class Riffer::Config::Mcp
16
17
  # --
17
18
  # : (untyped) -> void
18
19
  def discovery_runner=: (untyped) -> void
20
+
21
+ private
22
+
23
+ # --
24
+ # : () -> void
25
+ def warn_deprecated: () -> void
19
26
  end
@@ -3,12 +3,8 @@
3
3
  # @deprecated Set pricing in a catalog file instead (see docs/CATALOG.md).
4
4
  # A catalog entry's pricing wins over rates registered here.
5
5
  class Riffer::Config::Pricing
6
- DEPRECATION_MESSAGE: String
7
-
8
6
  @rates: Hash[String, Riffer::Catalog::Rates]
9
7
 
10
- self.@warned: bool
11
-
12
8
  # --
13
9
  # : () -> void
14
10
  def initialize: () -> void
@@ -24,9 +20,4 @@ class Riffer::Config::Pricing
24
20
  # --
25
21
  # : () -> bool
26
22
  def empty?: () -> bool
27
-
28
- # Once per process, so a boot that sets many models logs one line.
29
- # --
30
- # : () -> void
31
- def self.warn_deprecated: () -> void
32
23
  end
@@ -19,7 +19,11 @@ class Riffer::Config
19
19
 
20
20
  attr_reader openrouter: Riffer::Config::OpenRouter
21
21
 
22
- attr_reader evals: Riffer::Config::Evals
22
+ @evals: Riffer::Config::Evals
23
+
24
+ # --
25
+ # : () -> Riffer::Config::Evals
26
+ def evals: () -> Riffer::Config::Evals
23
27
 
24
28
  attr_reader mcp: Riffer::Config::Mcp
25
29
 
@@ -35,6 +39,8 @@ class Riffer::Config
35
39
 
36
40
  attr_reader files: Riffer::Config::Files
37
41
 
42
+ attr_reader future: Riffer::Config::Future
43
+
38
44
  # @deprecated Use +catalog_files+.
39
45
  attr_reader pricing: Riffer::Config::Pricing
40
46
 
@@ -60,6 +66,12 @@ class Riffer::Config
60
66
  # : (Symbol) -> void
61
67
  def message_id_strategy=: (Symbol) -> void
62
68
 
69
+ attr_reader deprecations: Symbol | ^(Riffer::Deprecation::Event) -> void
70
+
71
+ # --
72
+ # : ((Symbol | ^(Riffer::Deprecation::Event) -> void)) -> void
73
+ def deprecations=: (Symbol | ^(Riffer::Deprecation::Event) -> void) -> void
74
+
63
75
  # --
64
76
  # : () -> void
65
77
  def initialize: () -> void
@@ -0,0 +1,17 @@
1
+ # Generated from lib/riffer/deprecation/event.rb with RBS::Inline
2
+
3
+ class Riffer::Deprecation::Event
4
+ attr_reader id: Symbol
5
+
6
+ attr_reader message: String
7
+
8
+ attr_reader location: String?
9
+
10
+ # --
11
+ # : (id: Symbol, message: String, location: String?) -> void
12
+ def initialize: (id: Symbol, message: String, location: String?) -> void
13
+
14
+ # --
15
+ # : () -> String
16
+ def to_s: () -> String
17
+ end
@@ -0,0 +1,27 @@
1
+ # Generated from lib/riffer/deprecation.rb with RBS::Inline
2
+
3
+ module Riffer::Deprecation
4
+ @mutex: Thread::Mutex
5
+
6
+ @reported: Set[[ Symbol, String? ]]
7
+
8
+ MODES: Array[Symbol]
9
+
10
+ LIB_DIR: String
11
+
12
+ ALLOWED_KEY: Symbol
13
+
14
+ # --
15
+ # : (id: Symbol, message: String) -> void
16
+ def warn: (id: Symbol, message: String) -> void
17
+
18
+ # --
19
+ # : [T] () { () -> T } -> T
20
+ def allow: [T] () { () -> T } -> T
21
+
22
+ private
23
+
24
+ # --
25
+ # : (Event) -> bool
26
+ def first_report?: (Event) -> bool
27
+ end
@@ -29,6 +29,10 @@ class Riffer::Evals::Evaluator
29
29
  # : (?String?) -> String
30
30
  def self.identifier: (?String?) -> String
31
31
 
32
+ # --
33
+ # : (Class) -> void
34
+ private def self.inherited: (Class) -> void
35
+
32
36
  # --
33
37
  # : () -> String
34
38
  private def self.derived_identifier: () -> String
@@ -1,4 +1,5 @@
1
1
  # Generated from lib/riffer/evals.rb with RBS::Inline
2
2
 
3
3
  module Riffer::Evals
4
+ DEPRECATION_MESSAGE: String
4
5
  end
@@ -1,5 +1,6 @@
1
1
  # Generated from lib/riffer/mcp.rb with RBS::Inline
2
2
 
3
+ # @deprecated MCP client support will be removed; wrap the +mcp+ gem in your own Riffer::Tool (see docs/MCP.md).
3
4
  module Riffer::Mcp
4
5
  class Error < Riffer::Error
5
6
  end
@@ -0,0 +1,44 @@
1
+ # Generated from lib/riffer/messages/assistant/server_tool_part.rb with RBS::Inline
2
+
3
+ # A call or result of a tool the provider ran itself (e.g. web search). Stored and replayed
4
+ # verbatim under the same rule as reasoning parts: only the adapter whose +format+ it is sends
5
+ # it back.
6
+ class Riffer::Messages::Assistant::ServerToolPart
7
+ KINDS: Array[Symbol]
8
+
9
+ attr_reader name: String
10
+
11
+ attr_reader kind: Symbol
12
+
13
+ # The provider's block, JSON-encoded and unchanged.
14
+ attr_reader data: String
15
+
16
+ # Shared by a call and its result.
17
+ attr_reader id: String?
18
+
19
+ attr_reader format: String?
20
+
21
+ # --
22
+ # : ((Hash[Symbol, untyped] | Riffer::Messages::Assistant::ServerToolPart)) -> Riffer::Messages::Assistant::ServerToolPart
23
+ def self.from_hash: (Hash[Symbol, untyped] | Riffer::Messages::Assistant::ServerToolPart) -> Riffer::Messages::Assistant::ServerToolPart
24
+
25
+ # --
26
+ # : (name: String, kind: Symbol, data: String, ?id: String?, ?format: String?) -> void
27
+ def initialize: (name: String, kind: Symbol, data: String, ?id: String?, ?format: String?) -> void
28
+
29
+ # --
30
+ # : () -> Hash[Symbol, untyped]
31
+ def to_h: () -> Hash[Symbol, untyped]
32
+
33
+ # --
34
+ # : (untyped) -> bool
35
+ def ==: (untyped) -> bool
36
+
37
+ # --
38
+ # : (untyped) -> bool
39
+ def eql?: (untyped) -> bool
40
+
41
+ # --
42
+ # : () -> Integer
43
+ def hash: () -> Integer
44
+ end
@@ -0,0 +1,35 @@
1
+ # Generated from lib/riffer/messages/assistant/text_part.rb with RBS::Inline
2
+
3
+ class Riffer::Messages::Assistant::TextPart
4
+ attr_reader text: String
5
+
6
+ # The provider's whole block as JSON, kept when it carries more than the text (e.g. Anthropic
7
+ # +citations+), so the adapter that produced it can send it back unchanged.
8
+ attr_reader data: String?
9
+
10
+ attr_reader format: String?
11
+
12
+ # --
13
+ # : ((Hash[Symbol, untyped] | Riffer::Messages::Assistant::TextPart)) -> Riffer::Messages::Assistant::TextPart
14
+ def self.from_hash: (Hash[Symbol, untyped] | Riffer::Messages::Assistant::TextPart) -> Riffer::Messages::Assistant::TextPart
15
+
16
+ # --
17
+ # : (String, ?data: String?, ?format: String?) -> void
18
+ def initialize: (String, ?data: String?, ?format: String?) -> void
19
+
20
+ # --
21
+ # : () -> Hash[Symbol, untyped]
22
+ def to_h: () -> Hash[Symbol, untyped]
23
+
24
+ # --
25
+ # : (untyped) -> bool
26
+ def ==: (untyped) -> bool
27
+
28
+ # --
29
+ # : (untyped) -> bool
30
+ def eql?: (untyped) -> bool
31
+
32
+ # --
33
+ # : () -> Integer
34
+ def hash: () -> Integer
35
+ end
@@ -4,10 +4,20 @@ class Riffer::Messages::Assistant < Riffer::Messages::Base
4
4
  # The other reasoning part types carry no prose.
5
5
  REASONING_TEXT_TYPES: Array[Symbol]
6
6
 
7
+ PART_TAGS: Hash[singleton(Riffer::Messages::Assistant::TextPart) | singleton(Riffer::Messages::Assistant::ReasoningPart) | singleton(Riffer::Messages::Assistant::ToolCall) | singleton(Riffer::Messages::Assistant::ServerToolPart), Symbol]
8
+
7
9
  # --
8
10
  # : ((Hash[Symbol, untyped] | Riffer::Messages::Assistant)) -> Riffer::Messages::Assistant
9
11
  def self.from_hash: (Hash[Symbol, untyped] | Riffer::Messages::Assistant) -> Riffer::Messages::Assistant
10
12
 
13
+ # --
14
+ # : ((Hash[Symbol, untyped] | Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart)) -> (Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart)
15
+ def self.part_from_hash: (Hash[Symbol, untyped] | Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart) -> (Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart)
16
+
17
+ # The turn in the order the provider produced it. +content+, +tool_calls+ and +reasoning+ are
18
+ # views over it.
19
+ attr_reader parts: Array[Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart]
20
+
11
21
  attr_reader tool_calls: Array[Riffer::Messages::Assistant::ToolCall]
12
22
 
13
23
  attr_reader reasoning: Array[Riffer::Messages::Assistant::ReasoningPart]
@@ -20,18 +30,11 @@ class Riffer::Messages::Assistant < Riffer::Messages::Base
20
30
 
21
31
  attr_reader finish_reason_raw: String?
22
32
 
33
+ # Without +parts:+, the parts are built in a fixed order: reasoning, then the content as one
34
+ # text part, then tool calls.
23
35
  # --
24
- # : (
25
- # String,
26
- # ?id: String?,
27
- # ?tool_calls: Array[Riffer::Messages::Assistant::ToolCall],
28
- # ?reasoning: Array[Riffer::Messages::Assistant::ReasoningPart],
29
- # ?token_usage: Riffer::Providers::TokenUsage?,
30
- # ?structured_output: Hash[Symbol, untyped]?,
31
- # ?finish_reason: Symbol?,
32
- # ?finish_reason_raw: String?
33
- # ) -> void
34
- def initialize: (String, ?id: String?, ?tool_calls: Array[Riffer::Messages::Assistant::ToolCall], ?reasoning: Array[Riffer::Messages::Assistant::ReasoningPart], ?token_usage: Riffer::Providers::TokenUsage?, ?structured_output: Hash[Symbol, untyped]?, ?finish_reason: Symbol?, ?finish_reason_raw: String?) -> void
36
+ # : (?String?, ?id: String?, ?parts: Array[Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart]?, ?tool_calls: Array[Riffer::Messages::Assistant::ToolCall], ?reasoning: Array[Riffer::Messages::Assistant::ReasoningPart], ?token_usage: Riffer::Providers::TokenUsage?, ?structured_output: Hash[Symbol, untyped]?, ?finish_reason: Symbol?, ?finish_reason_raw: String?) -> void
37
+ def initialize: (?String?, ?id: String?, ?parts: Array[Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart]?, ?tool_calls: Array[Riffer::Messages::Assistant::ToolCall], ?reasoning: Array[Riffer::Messages::Assistant::ReasoningPart], ?token_usage: Riffer::Providers::TokenUsage?, ?structured_output: Hash[Symbol, untyped]?, ?finish_reason: Symbol?, ?finish_reason_raw: String?) -> void
35
38
 
36
39
  # --
37
40
  # : () -> Symbol
@@ -60,4 +63,14 @@ class Riffer::Messages::Assistant < Riffer::Messages::Base
60
63
  # --
61
64
  # : () -> Hash[Symbol, untyped]
62
65
  def to_h: () -> Hash[Symbol, untyped]
66
+
67
+ private
68
+
69
+ # --
70
+ # : (String?, Array[Riffer::Messages::Assistant::ToolCall], Array[Riffer::Messages::Assistant::ReasoningPart]) -> Array[Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart]
71
+ def default_parts: (String?, Array[Riffer::Messages::Assistant::ToolCall], Array[Riffer::Messages::Assistant::ReasoningPart]) -> Array[Riffer::Messages::Assistant::TextPart | Riffer::Messages::Assistant::ReasoningPart | Riffer::Messages::Assistant::ToolCall | Riffer::Messages::Assistant::ServerToolPart]
72
+
73
+ # --
74
+ # : (Riffer::Messages::Assistant) -> bool
75
+ def described_by_fields?: (Riffer::Messages::Assistant) -> bool
63
76
  end
@@ -13,9 +13,11 @@ class Riffer::Messages::Tool < Riffer::Messages::Base
13
13
 
14
14
  attr_reader error_type: Symbol?
15
15
 
16
+ attr_reader loaded_tools: Array[String]
17
+
16
18
  # --
17
- # : (String, tool_call_id: String, name: String, ?id: String?, ?error: String?, ?error_type: Symbol?) -> void
18
- def initialize: (String, tool_call_id: String, name: String, ?id: String?, ?error: String?, ?error_type: Symbol?) -> void
19
+ # : (String, tool_call_id: String, name: String, ?id: String?, ?error: String?, ?error_type: Symbol?, ?loaded_tools: Array[String]) -> void
20
+ def initialize: (String, tool_call_id: String, name: String, ?id: String?, ?error: String?, ?error_type: Symbol?, ?loaded_tools: Array[String]) -> void
19
21
 
20
22
  # --
21
23
  # : () -> bool