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.



734
735
736
737
738
739
740
# File 'lib/ag_ui_protocol/core/events.rb', line 734

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.



710
711
712
# File 'lib/ag_ui_protocol/core/events.rb', line 710

def activity_type
  @activity_type
end

#contentObject (readonly)

Returns the value of attribute content.



713
714
715
# File 'lib/ag_ui_protocol/core/events.rb', line 713

def content
  @content
end

#message_idObject (readonly)

Returns the value of attribute message_id.



707
708
709
# File 'lib/ag_ui_protocol/core/events.rb', line 707

def message_id
  @message_id
end

#replaceObject (readonly)

Returns the value of attribute replace.



716
717
718
# File 'lib/ag_ui_protocol/core/events.rb', line 716

def replace
  @replace
end

Instance Method Details

#to_hObject



743
744
745
746
747
748
749
750
# File 'lib/ag_ui_protocol/core/events.rb', line 743

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