Class: AgUiProtocol::Core::Events::RunFinishedInterruptOutcome

Inherits:
Types::Model
  • Object
show all
Defined in:
lib/ag_ui_protocol/core/events.rb

Overview

Represents an interrupt outcome for a run.

“‘ruby outcome = AgUiProtocol::Core::Events::RunFinishedInterruptOutcome.new(

interrupts: [
  AgUiProtocol::Core::Types::Interrupt.new(id: "int_1", reason: "input_required")
]

) “‘

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Types::Model

#as_json, #to_json

Constructor Details

#initialize(interrupts:, type: nil) ⇒ RunFinishedInterruptOutcome

Returns a new instance of RunFinishedInterruptOutcome.



976
977
978
979
980
981
982
983
984
985
986
987
# File 'lib/ag_ui_protocol/core/events.rb', line 976

def initialize(interrupts:, type: nil)
  unless interrupts.is_a?(Array) && interrupts.all? { |i| i.is_a?(AgUiProtocol::Core::Types::Interrupt) }
    raise ArgumentError, "interrupts must be an Array of Interrupt"
  end

  if !type.nil? && type != "interrupt"
    raise ArgumentError, "RunFinishedInterruptOutcome.type must be \"interrupt\""
  end

  @type = "interrupt"
  @interrupts = interrupts
end

Instance Attribute Details

#interruptsObject (readonly)

Returns the value of attribute interrupts.



971
972
973
# File 'lib/ag_ui_protocol/core/events.rb', line 971

def interrupts
  @interrupts
end

#typeObject (readonly)

Returns the value of attribute type.



968
969
970
# File 'lib/ag_ui_protocol/core/events.rb', line 968

def type
  @type
end

Instance Method Details

#to_hObject



990
991
992
# File 'lib/ag_ui_protocol/core/events.rb', line 990

def to_h
  { type: @type, interrupts: @interrupts }
end