Class: AgUiProtocol::Core::Events::ActivityDeltaEvent

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

Overview

Provides incremental updates to an activity snapshot using JSON Patch.

“‘ruby event = AgUiProtocol::Core::Events::ActivityDeltaEvent.new(message_id: “m1”, activity_type: “PLAN”, patch: [{ “op” => “replace”, “path” => “/a”, “value” => 2 }]) “`

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:, patch:, timestamp: nil, raw_event: nil) ⇒ ActivityDeltaEvent

Returns a new instance of ActivityDeltaEvent.



748
749
750
751
752
753
# File 'lib/ag_ui_protocol/core/events.rb', line 748

def initialize(message_id:, activity_type:, patch:, timestamp: nil, raw_event: nil)
  super(type: EventType::ACTIVITY_DELTA, timestamp: timestamp, raw_event: raw_event)
  @message_id = message_id
  @activity_type = activity_type
  @patch = patch
end

Instance Attribute Details

#activity_typeObject (readonly)

Returns the value of attribute activity_type.



737
738
739
# File 'lib/ag_ui_protocol/core/events.rb', line 737

def activity_type
  @activity_type
end

#message_idObject (readonly)

Returns the value of attribute message_id.



734
735
736
# File 'lib/ag_ui_protocol/core/events.rb', line 734

def message_id
  @message_id
end

#patchObject (readonly)

Returns the value of attribute patch.



740
741
742
# File 'lib/ag_ui_protocol/core/events.rb', line 740

def patch
  @patch
end

Instance Method Details

#to_hObject



756
757
758
759
760
761
762
# File 'lib/ag_ui_protocol/core/events.rb', line 756

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