Class: AgUiProtocol::Core::Events::StateSnapshotEvent

Inherits:
BaseEvent show all
Defined in:
lib/ag_ui_protocol/core/events.rb

Overview

Provides a complete snapshot of an agent’s state.

“‘ruby event = AgUiProtocol::Core::Events::StateSnapshotEvent.new(snapshot: { “a” => 1 }) “`

Instance Attribute Summary collapse

Attributes inherited from BaseEvent

#raw_event, #timestamp, #type

Instance Method Summary collapse

Methods inherited from Types::Model

#as_json, #to_json

Constructor Details

#initialize(snapshot:, timestamp: nil, raw_event: nil) ⇒ StateSnapshotEvent

Returns a new instance of StateSnapshotEvent.



603
604
605
606
# File 'lib/ag_ui_protocol/core/events.rb', line 603

def initialize(snapshot:, timestamp: nil, raw_event: nil)
  super(type: EventType::STATE_SNAPSHOT, timestamp: timestamp, raw_event: raw_event)
  @snapshot = snapshot
end

Instance Attribute Details

#snapshotObject (readonly)

Returns the value of attribute snapshot.



597
598
599
# File 'lib/ag_ui_protocol/core/events.rb', line 597

def snapshot
  @snapshot
end

Instance Method Details

#to_hObject



609
610
611
# File 'lib/ag_ui_protocol/core/events.rb', line 609

def to_h
  super.merge(snapshot: @snapshot)
end