Class: Cline::SessionMessages
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/cline/session_messages.rb
Overview
Session messages
Instance Attribute Summary
Attributes inherited from Schema
Public API collapse
-
#agent ⇒ String
Agent identifier (lead or agent).
-
#messages ⇒ Array<SessionMessage>
Messages of this session.
-
#session_id ⇒ String
Session ID.
-
#system_prompt ⇒ String
System prompt used for this session.
-
#updated_at ⇒ String
Last update timestamp of this messages file.
-
#version ⇒ Integer
Schema version.
Internal collapse
-
.of_hash(hash, *args, cline_models:, **kwargs) ⇒ Schema
Parse a Hash object and instantiate the proper instance from it.
-
#wrapped_messages ⇒ Array
Return the messages as an array, even if there are no message.
Methods inherited from Schema
#==, as_hash, cast, cline_snake_attributes, #to_cline_json, #to_hash
Class Method Details
.of_hash(hash, *args, cline_models:, **kwargs) ⇒ Schema
Parse a Hash object and instantiate the proper instance from it.
46 47 48 49 50 51 52 |
# File 'lib/cline/session_messages.rb', line 46 def self.of_hash(hash, *args, cline_models:, **kwargs) instance = super(hash, *args, **kwargs) # Shale doesn't pass extra kwargs to nested collection items, # so we set cline_models on each message after deserialization instance.&.each { || .cline_models = cline_models } instance end |
Instance Method Details
#agent ⇒ String
Returns Agent identifier (lead or agent).
19 |
# File 'lib/cline/session_messages.rb', line 19 attribute :agent, :string |
#messages ⇒ Array<SessionMessage>
Returns Messages of this session.
25 |
# File 'lib/cline/session_messages.rb', line 25 attribute :messages, Utils::Schema.collection(SessionMessage) |
#session_id ⇒ String
Returns Session ID.
22 |
# File 'lib/cline/session_messages.rb', line 22 attribute :session_id, :string |
#system_prompt ⇒ String
Returns System prompt used for this session.
28 |
# File 'lib/cline/session_messages.rb', line 28 attribute :system_prompt, :string |
#updated_at ⇒ String
Returns Last update timestamp of this messages file.
16 |
# File 'lib/cline/session_messages.rb', line 16 attribute :updated_at, :string |
#version ⇒ Integer
Returns Schema version.
13 |
# File 'lib/cline/session_messages.rb', line 13 attribute :version, :integer |
#wrapped_messages ⇒ Array
Return the messages as an array, even if there are no message.
57 58 59 |
# File 'lib/cline/session_messages.rb', line 57 def || [] end |