Class: AgUiProtocol::Core::Events::ActivitySnapshotEvent

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

Overview

Delivers a complete snapshot of an activity message.

“‘ruby event = AgUiProtocol::Core::Events::ActivitySnapshotEvent.new(message_id: “m1”, activity_type: “PLAN”, content: { “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(message_id:, activity_type:, content:, replace: true, timestamp: nil, raw_event: nil) ⇒ ActivitySnapshotEvent

Returns a new instance of ActivitySnapshotEvent.



706
707
708
709
710
711
712
# File 'lib/ag_ui_protocol/core/events.rb', line 706

def initialize(message_id:, activity_type:, content:, replace: true, timestamp: nil, raw_event: nil)
  super(type: EventType::ACTIVITY_SNAPSHOT, timestamp: timestamp, raw_event: raw_event)
  @message_id = message_id
  @activity_type = activity_type
  @content = content
  @replace = replace
end

Instance Attribute Details

#activity_typeObject (readonly)

Returns the value of attribute activity_type.



682
683
684
# File 'lib/ag_ui_protocol/core/events.rb', line 682

def activity_type
  @activity_type
end

#contentObject (readonly)

Returns the value of attribute content.



685
686
687
# File 'lib/ag_ui_protocol/core/events.rb', line 685

def content
  @content
end

#message_idObject (readonly)

Returns the value of attribute message_id.



679
680
681
# File 'lib/ag_ui_protocol/core/events.rb', line 679

def message_id
  @message_id
end

#replaceObject (readonly)

Returns the value of attribute replace.



688
689
690
# File 'lib/ag_ui_protocol/core/events.rb', line 688

def replace
  @replace
end

Instance Method Details

#to_hObject



715
716
717
718
719
720
721
722
# File 'lib/ag_ui_protocol/core/events.rb', line 715

def to_h
  super.merge(
    message_id: @message_id,
    activity_type: @activity_type,
    content: @content,
    replace: @replace
  )
end