Class: Riffer::StreamEvents::Interrupt
- Defined in:
- lib/riffer/stream_events/interrupt.rb
Overview
Represents an interrupt event during streaming.
Emitted when a callback interrupts the agent loop via throw :riffer_interrupt.
Instance Attribute Summary collapse
-
#healed_tool_call_ids ⇒ Object
readonly
Call ids of tool_use blocks that riffer filled with placeholder results when the interrupt fired.
-
#reason ⇒ Object
readonly
The reason provided with the interrupt, if any.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(reason: nil, healed_tool_call_ids: []) ⇒ Interrupt
constructor
– : (?reason: (String | Symbol)?, ?healed_tool_call_ids: Array) -> void.
-
#to_h ⇒ Object
Converts the event to a hash.
Constructor Details
#initialize(reason: nil, healed_tool_call_ids: []) ⇒ Interrupt
– : (?reason: (String | Symbol)?, ?healed_tool_call_ids: Array) -> void
18 19 20 21 22 |
# File 'lib/riffer/stream_events/interrupt.rb', line 18 def initialize(reason: nil, healed_tool_call_ids: []) super(role: :system) @reason = reason @healed_tool_call_ids = healed_tool_call_ids end |
Instance Attribute Details
#healed_tool_call_ids ⇒ Object (readonly)
Call ids of tool_use blocks that riffer filled with placeholder results when the interrupt fired. Populated only when Riffer.config.experimental_history_healing is on.
14 15 16 |
# File 'lib/riffer/stream_events/interrupt.rb', line 14 def healed_tool_call_ids @healed_tool_call_ids end |
#reason ⇒ Object (readonly)
The reason provided with the interrupt, if any.
9 10 11 |
# File 'lib/riffer/stream_events/interrupt.rb', line 9 def reason @reason end |
Instance Method Details
#to_h ⇒ Object
Converts the event to a hash.
– : () -> Hash[Symbol, untyped]
28 29 30 31 32 33 |
# File 'lib/riffer/stream_events/interrupt.rb', line 28 def to_h h = {role: @role, interrupt: true} h[:reason] = @reason if @reason h[:healed_tool_call_ids] = @healed_tool_call_ids unless @healed_tool_call_ids.empty? h end |