Class: SimpleAcp::Models::AwaitRequest Abstract

Inherits:
Base
  • Object
show all
Defined in:
lib/simple_acp/models/await.rb

Overview

This class is abstract.

Subclass for specific await types

Base class for await requests.

When an agent needs client input during execution, it creates an await request describing what input is needed.

Direct Known Subclasses

MessageAwaitRequest

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

#==, attribute, attributes, #hash, #initialize, own_attributes, #to_h, #to_json

Constructor Details

This class inherits a constructor from SimpleAcp::Models::Base

Instance Attribute Details

#type ⇒ String (readonly)

Returns await request type.

Returns:

  • (String) —

    await request type



14
# File 'lib/simple_acp/models/await.rb', line 14

attribute :type, required: true

Class Method Details

.from_hash(hash) ⇒ AwaitRequest?

Parse from hash, creating the appropriate subclass.

Parameters:

  • hash (Hash, nil) —

    await request data

Returns:



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/simple_acp/models/await.rb', line 20

def self.from_hash(hash)
  return nil if hash.nil?

  type = hash["type"] || hash[:type]

  case type
  when "message"
    MessageAwaitRequest.from_hash(hash)
  else
    super
  end
end