cerca 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/cerca/internal/thread_messages_cursor_page.rb +92 -0
- data/lib/cerca/models/activity_detail.rb +24 -0
- data/lib/cerca/models/activity_summary.rb +112 -0
- data/lib/cerca/models/message.rb +1 -0
- data/lib/cerca/models/message_page.rb +27 -0
- data/lib/cerca/models/thread.rb +15 -1
- data/lib/cerca/models/thread_activity_params.rb +36 -0
- data/lib/cerca/models/thread_list_messages_params.rb +52 -0
- data/lib/cerca/models/thread_retrieve_params.rb +10 -3
- data/lib/cerca/models/thread_turn_summary.rb +56 -0
- data/lib/cerca/models.rb +12 -0
- data/lib/cerca/resources/threads.rb +65 -1
- data/lib/cerca/version.rb +1 -1
- data/lib/cerca.rb +7 -0
- data/rbi/cerca/internal/thread_messages_cursor_page.rbi +25 -0
- data/rbi/cerca/models/activity_detail.rbi +36 -0
- data/rbi/cerca/models/activity_summary.rbi +117 -0
- data/rbi/cerca/models/message_page.rbi +41 -0
- data/rbi/cerca/models/thread.rbi +12 -0
- data/rbi/cerca/models/thread_activity_params.rbi +58 -0
- data/rbi/cerca/models/thread_list_messages_params.rbi +80 -0
- data/rbi/cerca/models/thread_retrieve_params.rbi +9 -3
- data/rbi/cerca/models/thread_turn_summary.rbi +85 -0
- data/rbi/cerca/models.rbi +12 -0
- data/rbi/cerca/resources/threads.rbi +47 -1
- data/sig/cerca/internal/thread_messages_cursor_page.rbs +15 -0
- data/sig/cerca/models/activity_detail.rbs +28 -0
- data/sig/cerca/models/activity_summary.rbs +85 -0
- data/sig/cerca/models/message_page.rbs +26 -0
- data/sig/cerca/models/thread.rbs +10 -0
- data/sig/cerca/models/thread_activity_params.rbs +34 -0
- data/sig/cerca/models/thread_list_messages_params.rbs +52 -0
- data/sig/cerca/models/thread_turn_summary.rbs +56 -0
- data/sig/cerca/models.rbs +12 -0
- data/sig/cerca/resources/threads.rbs +16 -0
- metadata +28 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae67561fdcf585399edfd6d08ffa7fe50da0397ace860d689127c2c011dcedde
|
|
4
|
+
data.tar.gz: 2841db8fd1be916786257f520cf1bc29463612b6e77b3994bab6130203c2caa9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad22af0e4917d74a3be488dcbc666b25225b43318bf9ce45233b90ae21f5ba3a09b45114e95742ab305d14175db6d7eecedbd385a4d99ff3d135da47d9b916f9
|
|
7
|
+
data.tar.gz: 8a82636af422680b0a5c5c422cf7fe57a52c8304b542ddbc6f86195d697d993583e7735ae0fdebbaba69459c6e1af898fa83d547daa29d901c7ee90673601e7f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 (2026-05-07)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.1.0...v0.2.0](https://github.com/matrices/cerca-ruby/compare/v0.1.0...v0.2.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([c593d9c](https://github.com/matrices/cerca-ruby/commit/c593d9c928b6ca0e614cd7c241b3b7bc555fcb12))
|
|
10
|
+
|
|
3
11
|
## 0.1.0 (2026-05-01)
|
|
4
12
|
|
|
5
13
|
Full Changelog: [v0.0.1...v0.1.0](https://github.com/matrices/cerca-ruby/compare/v0.0.1...v0.1.0)
|
data/README.md
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cerca
|
|
4
|
+
module Internal
|
|
5
|
+
# @generic Elem
|
|
6
|
+
#
|
|
7
|
+
# @example
|
|
8
|
+
# if thread_messages_cursor_page.has_next?
|
|
9
|
+
# thread_messages_cursor_page = thread_messages_cursor_page.next_page
|
|
10
|
+
# end
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# thread_messages_cursor_page.auto_paging_each do |thread|
|
|
14
|
+
# puts(thread)
|
|
15
|
+
# end
|
|
16
|
+
class ThreadMessagesCursorPage
|
|
17
|
+
include Cerca::Internal::Type::BasePage
|
|
18
|
+
|
|
19
|
+
# @return [Array<generic<Elem>>, nil]
|
|
20
|
+
attr_accessor :messages
|
|
21
|
+
|
|
22
|
+
# @return [String, nil]
|
|
23
|
+
attr_accessor :cursor
|
|
24
|
+
|
|
25
|
+
# @return [Boolean]
|
|
26
|
+
attr_accessor :has_more
|
|
27
|
+
|
|
28
|
+
# @return [Boolean]
|
|
29
|
+
def next_page?
|
|
30
|
+
has_more
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# @raise [Cerca::HTTP::Error]
|
|
34
|
+
# @return [self]
|
|
35
|
+
def next_page
|
|
36
|
+
unless next_page?
|
|
37
|
+
message = "No more pages available. Please check #next_page? before calling ##{__method__}"
|
|
38
|
+
raise RuntimeError.new(message)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
req = Cerca::Internal::Util.deep_merge(@req, {query: {cursor: cursor}})
|
|
42
|
+
@client.request(req)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @param blk [Proc]
|
|
46
|
+
#
|
|
47
|
+
# @yieldparam [generic<Elem>]
|
|
48
|
+
def auto_paging_each(&blk)
|
|
49
|
+
unless block_given?
|
|
50
|
+
raise ArgumentError.new("A block must be given to ##{__method__}")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
page = self
|
|
54
|
+
loop do
|
|
55
|
+
page.messages&.each(&blk)
|
|
56
|
+
|
|
57
|
+
break unless page.next_page?
|
|
58
|
+
page = page.next_page
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# @api private
|
|
63
|
+
#
|
|
64
|
+
# @param client [Cerca::Internal::Transport::BaseClient]
|
|
65
|
+
# @param req [Hash{Symbol=>Object}]
|
|
66
|
+
# @param headers [Hash{String=>String}]
|
|
67
|
+
# @param page_data [Hash{Symbol=>Object}]
|
|
68
|
+
def initialize(client:, req:, headers:, page_data:)
|
|
69
|
+
super
|
|
70
|
+
|
|
71
|
+
case page_data
|
|
72
|
+
in {messages: Array => messages}
|
|
73
|
+
@messages = messages.map { Cerca::Internal::Type::Converter.coerce(@model, _1) }
|
|
74
|
+
else
|
|
75
|
+
end
|
|
76
|
+
@cursor = page_data[:cursor]
|
|
77
|
+
@has_more = page_data[:hasMore]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# @api private
|
|
81
|
+
#
|
|
82
|
+
# @return [String]
|
|
83
|
+
def inspect
|
|
84
|
+
# rubocop:disable Layout/LineLength
|
|
85
|
+
model = Cerca::Internal::Type::Converter.inspect(@model, depth: 1)
|
|
86
|
+
|
|
87
|
+
"#<#{self.class}[#{model}]:0x#{object_id.to_s(16)} cursor=#{cursor.inspect} has_more=#{has_more.inspect}>"
|
|
88
|
+
# rubocop:enable Layout/LineLength
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cerca
|
|
4
|
+
module Models
|
|
5
|
+
# @see Cerca::Resources::Threads#activity
|
|
6
|
+
class ActivityDetail < Cerca::Models::ActivitySummary
|
|
7
|
+
# @!attribute error
|
|
8
|
+
#
|
|
9
|
+
# @return [String, nil]
|
|
10
|
+
required :error, String, nil?: true
|
|
11
|
+
|
|
12
|
+
# @!attribute recent_turns
|
|
13
|
+
#
|
|
14
|
+
# @return [Array<Cerca::Models::ThreadTurnSummary>]
|
|
15
|
+
required :recent_turns,
|
|
16
|
+
-> { Cerca::Internal::Type::ArrayOf[Cerca::ThreadTurnSummary] },
|
|
17
|
+
api_name: :recentTurns
|
|
18
|
+
|
|
19
|
+
# @!method initialize(error:, recent_turns:)
|
|
20
|
+
# @param error [String, nil]
|
|
21
|
+
# @param recent_turns [Array<Cerca::Models::ThreadTurnSummary>]
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cerca
|
|
4
|
+
module Models
|
|
5
|
+
class ActivitySummary < Cerca::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute id
|
|
7
|
+
#
|
|
8
|
+
# @return [String]
|
|
9
|
+
required :id, String
|
|
10
|
+
|
|
11
|
+
# @!attribute completed_at
|
|
12
|
+
#
|
|
13
|
+
# @return [String, nil]
|
|
14
|
+
required :completed_at, String, api_name: :completedAt, nil?: true
|
|
15
|
+
|
|
16
|
+
# @!attribute created_at
|
|
17
|
+
#
|
|
18
|
+
# @return [String]
|
|
19
|
+
required :created_at, String, api_name: :createdAt
|
|
20
|
+
|
|
21
|
+
# @!attribute goal
|
|
22
|
+
#
|
|
23
|
+
# @return [String]
|
|
24
|
+
required :goal, String
|
|
25
|
+
|
|
26
|
+
# @!attribute latest_activity
|
|
27
|
+
#
|
|
28
|
+
# @return [String, nil]
|
|
29
|
+
required :latest_activity, String, api_name: :latestActivity, nil?: true
|
|
30
|
+
|
|
31
|
+
# @!attribute message_count
|
|
32
|
+
#
|
|
33
|
+
# @return [Float]
|
|
34
|
+
required :message_count, Float, api_name: :messageCount
|
|
35
|
+
|
|
36
|
+
# @!attribute model
|
|
37
|
+
#
|
|
38
|
+
# @return [String]
|
|
39
|
+
required :model, String
|
|
40
|
+
|
|
41
|
+
# @!attribute next_step
|
|
42
|
+
#
|
|
43
|
+
# @return [String, nil]
|
|
44
|
+
required :next_step, String, api_name: :nextStep, nil?: true
|
|
45
|
+
|
|
46
|
+
# @!attribute parent_thread_id
|
|
47
|
+
#
|
|
48
|
+
# @return [String, nil]
|
|
49
|
+
required :parent_thread_id, String, api_name: :parentThreadId, nil?: true
|
|
50
|
+
|
|
51
|
+
# @!attribute result
|
|
52
|
+
#
|
|
53
|
+
# @return [String, nil]
|
|
54
|
+
required :result, String, nil?: true
|
|
55
|
+
|
|
56
|
+
# @!attribute schedule_id
|
|
57
|
+
#
|
|
58
|
+
# @return [String, nil]
|
|
59
|
+
required :schedule_id, String, api_name: :scheduleId, nil?: true
|
|
60
|
+
|
|
61
|
+
# @!attribute status
|
|
62
|
+
# `idle` threads can accept a new turn or be closed. `running` threads have an
|
|
63
|
+
# active turn. `awaiting` threads are paused on external input such as approvals.
|
|
64
|
+
# `closed` threads are terminal.
|
|
65
|
+
#
|
|
66
|
+
# @return [Symbol, Cerca::Models::Status]
|
|
67
|
+
required :status, enum: -> { Cerca::Status }
|
|
68
|
+
|
|
69
|
+
# @!attribute step_count
|
|
70
|
+
#
|
|
71
|
+
# @return [Float]
|
|
72
|
+
required :step_count, Float, api_name: :stepCount
|
|
73
|
+
|
|
74
|
+
# @!attribute updated_at
|
|
75
|
+
#
|
|
76
|
+
# @return [String]
|
|
77
|
+
required :updated_at, String, api_name: :updatedAt
|
|
78
|
+
|
|
79
|
+
# @!method initialize(id:, completed_at:, created_at:, goal:, latest_activity:, message_count:, model:, next_step:, parent_thread_id:, result:, schedule_id:, status:, step_count:, updated_at:)
|
|
80
|
+
# Some parameter documentations has been truncated, see
|
|
81
|
+
# {Cerca::Models::ActivitySummary} for more details.
|
|
82
|
+
#
|
|
83
|
+
# @param id [String]
|
|
84
|
+
#
|
|
85
|
+
# @param completed_at [String, nil]
|
|
86
|
+
#
|
|
87
|
+
# @param created_at [String]
|
|
88
|
+
#
|
|
89
|
+
# @param goal [String]
|
|
90
|
+
#
|
|
91
|
+
# @param latest_activity [String, nil]
|
|
92
|
+
#
|
|
93
|
+
# @param message_count [Float]
|
|
94
|
+
#
|
|
95
|
+
# @param model [String]
|
|
96
|
+
#
|
|
97
|
+
# @param next_step [String, nil]
|
|
98
|
+
#
|
|
99
|
+
# @param parent_thread_id [String, nil]
|
|
100
|
+
#
|
|
101
|
+
# @param result [String, nil]
|
|
102
|
+
#
|
|
103
|
+
# @param schedule_id [String, nil]
|
|
104
|
+
#
|
|
105
|
+
# @param status [Symbol, Cerca::Models::Status] `idle` threads can accept a new turn or be closed. `running` threads have an act
|
|
106
|
+
#
|
|
107
|
+
# @param step_count [Float]
|
|
108
|
+
#
|
|
109
|
+
# @param updated_at [String]
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
data/lib/cerca/models/message.rb
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cerca
|
|
4
|
+
module Models
|
|
5
|
+
class MessagePage < Cerca::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute cursor
|
|
7
|
+
#
|
|
8
|
+
# @return [String, nil]
|
|
9
|
+
required :cursor, String, nil?: true
|
|
10
|
+
|
|
11
|
+
# @!attribute has_more
|
|
12
|
+
#
|
|
13
|
+
# @return [Boolean]
|
|
14
|
+
required :has_more, Cerca::Internal::Type::Boolean, api_name: :hasMore
|
|
15
|
+
|
|
16
|
+
# @!attribute messages
|
|
17
|
+
#
|
|
18
|
+
# @return [Array<Cerca::Models::Message>]
|
|
19
|
+
required :messages, -> { Cerca::Internal::Type::ArrayOf[Cerca::Message] }
|
|
20
|
+
|
|
21
|
+
# @!method initialize(cursor:, has_more:, messages:)
|
|
22
|
+
# @param cursor [String, nil]
|
|
23
|
+
# @param has_more [Boolean]
|
|
24
|
+
# @param messages [Array<Cerca::Models::Message>]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
data/lib/cerca/models/thread.rb
CHANGED
|
@@ -39,6 +39,11 @@ module Cerca
|
|
|
39
39
|
# @return [String, nil]
|
|
40
40
|
required :error, String, nil?: true
|
|
41
41
|
|
|
42
|
+
# @!attribute has_more_messages
|
|
43
|
+
#
|
|
44
|
+
# @return [Boolean]
|
|
45
|
+
required :has_more_messages, Cerca::Internal::Type::Boolean, api_name: :hasMoreMessages
|
|
46
|
+
|
|
42
47
|
# @!attribute instructions
|
|
43
48
|
#
|
|
44
49
|
# @return [String, nil]
|
|
@@ -57,6 +62,11 @@ module Cerca
|
|
|
57
62
|
# @return [String]
|
|
58
63
|
required :message, String
|
|
59
64
|
|
|
65
|
+
# @!attribute message_cursor
|
|
66
|
+
#
|
|
67
|
+
# @return [Float, nil]
|
|
68
|
+
required :message_cursor, Float, api_name: :messageCursor, nil?: true
|
|
69
|
+
|
|
60
70
|
# @!attribute messages
|
|
61
71
|
#
|
|
62
72
|
# @return [Array<Cerca::Models::Message>]
|
|
@@ -124,7 +134,7 @@ module Cerca
|
|
|
124
134
|
union: -> { Cerca::Thread::ExternalToolNamespaces },
|
|
125
135
|
api_name: :externalToolNamespaces
|
|
126
136
|
|
|
127
|
-
# @!method initialize(id:, agent_id:, compiled_context:, completed_at:, created_at:, depth:, error:, instructions:, last_turn_status:, message:, messages:, model:, parent_thread_id:, result:, schedule_id:, schedule_seq:, status:, sub_threads:, tools:, turns:, updated_at:, external_tool_namespaces: nil)
|
|
137
|
+
# @!method initialize(id:, agent_id:, compiled_context:, completed_at:, created_at:, depth:, error:, has_more_messages:, instructions:, last_turn_status:, message:, message_cursor:, messages:, model:, parent_thread_id:, result:, schedule_id:, schedule_seq:, status:, sub_threads:, tools:, turns:, updated_at:, external_tool_namespaces: nil)
|
|
128
138
|
# Some parameter documentations has been truncated, see {Cerca::Models::Thread}
|
|
129
139
|
# for more details.
|
|
130
140
|
#
|
|
@@ -142,12 +152,16 @@ module Cerca
|
|
|
142
152
|
#
|
|
143
153
|
# @param error [String, nil]
|
|
144
154
|
#
|
|
155
|
+
# @param has_more_messages [Boolean]
|
|
156
|
+
#
|
|
145
157
|
# @param instructions [String, nil]
|
|
146
158
|
#
|
|
147
159
|
# @param last_turn_status [Symbol, Cerca::Models::Thread::LastTurnStatus, nil]
|
|
148
160
|
#
|
|
149
161
|
# @param message [String]
|
|
150
162
|
#
|
|
163
|
+
# @param message_cursor [Float, nil]
|
|
164
|
+
#
|
|
151
165
|
# @param messages [Array<Cerca::Models::Message>]
|
|
152
166
|
#
|
|
153
167
|
# @param model [String]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cerca
|
|
4
|
+
module Models
|
|
5
|
+
# @see Cerca::Resources::Threads#activity
|
|
6
|
+
class ThreadActivityParams < Cerca::Internal::Type::BaseModel
|
|
7
|
+
extend Cerca::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Cerca::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute agent_id
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :agent_id, String
|
|
14
|
+
|
|
15
|
+
# @!attribute thread_id
|
|
16
|
+
#
|
|
17
|
+
# @return [String]
|
|
18
|
+
required :thread_id, String
|
|
19
|
+
|
|
20
|
+
# @!attribute fleet_id
|
|
21
|
+
# Optional fleet id for index-backed authorization.
|
|
22
|
+
#
|
|
23
|
+
# @return [String, nil]
|
|
24
|
+
optional :fleet_id, String
|
|
25
|
+
|
|
26
|
+
# @!method initialize(agent_id:, thread_id:, fleet_id: nil, request_options: {})
|
|
27
|
+
# @param agent_id [String]
|
|
28
|
+
#
|
|
29
|
+
# @param thread_id [String]
|
|
30
|
+
#
|
|
31
|
+
# @param fleet_id [String] Optional fleet id for index-backed authorization.
|
|
32
|
+
#
|
|
33
|
+
# @param request_options [Cerca::RequestOptions, Hash{Symbol=>Object}]
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cerca
|
|
4
|
+
module Models
|
|
5
|
+
# @see Cerca::Resources::Threads#list_messages
|
|
6
|
+
class ThreadListMessagesParams < Cerca::Internal::Type::BaseModel
|
|
7
|
+
extend Cerca::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Cerca::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute agent_id
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :agent_id, String
|
|
14
|
+
|
|
15
|
+
# @!attribute thread_id
|
|
16
|
+
#
|
|
17
|
+
# @return [String]
|
|
18
|
+
required :thread_id, String
|
|
19
|
+
|
|
20
|
+
# @!attribute cursor
|
|
21
|
+
# Cursor returned by a previous thread messages response.
|
|
22
|
+
#
|
|
23
|
+
# @return [String, nil]
|
|
24
|
+
optional :cursor, String
|
|
25
|
+
|
|
26
|
+
# @!attribute fleet_id
|
|
27
|
+
# Optional fleet id for index-backed authorization.
|
|
28
|
+
#
|
|
29
|
+
# @return [String, nil]
|
|
30
|
+
optional :fleet_id, String
|
|
31
|
+
|
|
32
|
+
# @!attribute limit
|
|
33
|
+
# Maximum number of messages to include, capped at 500.
|
|
34
|
+
#
|
|
35
|
+
# @return [String, nil]
|
|
36
|
+
optional :limit, String
|
|
37
|
+
|
|
38
|
+
# @!method initialize(agent_id:, thread_id:, cursor: nil, fleet_id: nil, limit: nil, request_options: {})
|
|
39
|
+
# @param agent_id [String]
|
|
40
|
+
#
|
|
41
|
+
# @param thread_id [String]
|
|
42
|
+
#
|
|
43
|
+
# @param cursor [String] Cursor returned by a previous thread messages response.
|
|
44
|
+
#
|
|
45
|
+
# @param fleet_id [String] Optional fleet id for index-backed authorization.
|
|
46
|
+
#
|
|
47
|
+
# @param limit [String] Maximum number of messages to include, capped at 500.
|
|
48
|
+
#
|
|
49
|
+
# @param request_options [Cerca::RequestOptions, Hash{Symbol=>Object}]
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -24,19 +24,24 @@ module Cerca
|
|
|
24
24
|
optional :debug, enum: -> { Cerca::ThreadRetrieveParams::Debug }
|
|
25
25
|
|
|
26
26
|
# @!attribute include_messages
|
|
27
|
-
#
|
|
27
|
+
# Deprecated compatibility flag. Thread detail includes a bounded recent message
|
|
28
|
+
# page by default; pass `false` only to opt out when no message pagination params
|
|
29
|
+
# are present.
|
|
28
30
|
#
|
|
29
31
|
# @return [Symbol, Cerca::Models::ThreadRetrieveParams::IncludeMessages, nil]
|
|
30
32
|
optional :include_messages, enum: -> { Cerca::ThreadRetrieveParams::IncludeMessages }
|
|
31
33
|
|
|
32
34
|
# @!method initialize(agent_id:, thread_id:, debug: nil, include_messages: nil, request_options: {})
|
|
35
|
+
# Some parameter documentations has been truncated, see
|
|
36
|
+
# {Cerca::Models::ThreadRetrieveParams} for more details.
|
|
37
|
+
#
|
|
33
38
|
# @param agent_id [String]
|
|
34
39
|
#
|
|
35
40
|
# @param thread_id [String]
|
|
36
41
|
#
|
|
37
42
|
# @param debug [Symbol, Cerca::Models::ThreadRetrieveParams::Debug] When true, includes debug-only compiled context fields.
|
|
38
43
|
#
|
|
39
|
-
# @param include_messages [Symbol, Cerca::Models::ThreadRetrieveParams::IncludeMessages]
|
|
44
|
+
# @param include_messages [Symbol, Cerca::Models::ThreadRetrieveParams::IncludeMessages] Deprecated compatibility flag. Thread detail includes a bounded recent message p
|
|
40
45
|
#
|
|
41
46
|
# @param request_options [Cerca::RequestOptions, Hash{Symbol=>Object}]
|
|
42
47
|
|
|
@@ -51,7 +56,9 @@ module Cerca
|
|
|
51
56
|
# @return [Array<Symbol>]
|
|
52
57
|
end
|
|
53
58
|
|
|
54
|
-
#
|
|
59
|
+
# Deprecated compatibility flag. Thread detail includes a bounded recent message
|
|
60
|
+
# page by default; pass `false` only to opt out when no message pagination params
|
|
61
|
+
# are present.
|
|
55
62
|
module IncludeMessages
|
|
56
63
|
extend Cerca::Internal::Type::Enum
|
|
57
64
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Cerca
|
|
4
|
+
module Models
|
|
5
|
+
class ThreadTurnSummary < Cerca::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute activity
|
|
7
|
+
#
|
|
8
|
+
# @return [String, nil]
|
|
9
|
+
required :activity, String, nil?: true
|
|
10
|
+
|
|
11
|
+
# @!attribute completed_at
|
|
12
|
+
#
|
|
13
|
+
# @return [String]
|
|
14
|
+
required :completed_at, String, api_name: :completedAt
|
|
15
|
+
|
|
16
|
+
# @!attribute message_count
|
|
17
|
+
#
|
|
18
|
+
# @return [Float]
|
|
19
|
+
required :message_count, Float, api_name: :messageCount
|
|
20
|
+
|
|
21
|
+
# @!attribute next_step
|
|
22
|
+
#
|
|
23
|
+
# @return [String, nil]
|
|
24
|
+
required :next_step, String, api_name: :nextStep, nil?: true
|
|
25
|
+
|
|
26
|
+
# @!attribute status
|
|
27
|
+
#
|
|
28
|
+
# @return [Symbol, Cerca::Models::ThreadTurnSummary::Status]
|
|
29
|
+
required :status, enum: -> { Cerca::ThreadTurnSummary::Status }
|
|
30
|
+
|
|
31
|
+
# @!attribute turn_seq
|
|
32
|
+
#
|
|
33
|
+
# @return [Float]
|
|
34
|
+
required :turn_seq, Float, api_name: :turnSeq
|
|
35
|
+
|
|
36
|
+
# @!method initialize(activity:, completed_at:, message_count:, next_step:, status:, turn_seq:)
|
|
37
|
+
# @param activity [String, nil]
|
|
38
|
+
# @param completed_at [String]
|
|
39
|
+
# @param message_count [Float]
|
|
40
|
+
# @param next_step [String, nil]
|
|
41
|
+
# @param status [Symbol, Cerca::Models::ThreadTurnSummary::Status]
|
|
42
|
+
# @param turn_seq [Float]
|
|
43
|
+
|
|
44
|
+
# @see Cerca::Models::ThreadTurnSummary#status
|
|
45
|
+
module Status
|
|
46
|
+
extend Cerca::Internal::Type::Enum
|
|
47
|
+
|
|
48
|
+
COMPLETED = :completed
|
|
49
|
+
FAILED = :failed
|
|
50
|
+
|
|
51
|
+
# @!method self.values
|
|
52
|
+
# @return [Array<Symbol>]
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
data/lib/cerca/models.rb
CHANGED
|
@@ -39,6 +39,10 @@ module Cerca
|
|
|
39
39
|
mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
ActivityDetail = Cerca::Models::ActivityDetail
|
|
43
|
+
|
|
44
|
+
ActivitySummary = Cerca::Models::ActivitySummary
|
|
45
|
+
|
|
42
46
|
Agent = Cerca::Models::Agent
|
|
43
47
|
|
|
44
48
|
AgentCreateParams = Cerca::Models::AgentCreateParams
|
|
@@ -178,6 +182,8 @@ module Cerca
|
|
|
178
182
|
|
|
179
183
|
Message = Cerca::Models::Message
|
|
180
184
|
|
|
185
|
+
MessagePage = Cerca::Models::MessagePage
|
|
186
|
+
|
|
181
187
|
# @type [Cerca::Internal::Type::Converter]
|
|
182
188
|
Metadata = Cerca::Models::Metadata
|
|
183
189
|
|
|
@@ -235,6 +241,8 @@ module Cerca
|
|
|
235
241
|
|
|
236
242
|
Thread = Cerca::Models::Thread
|
|
237
243
|
|
|
244
|
+
ThreadActivityParams = Cerca::Models::ThreadActivityParams
|
|
245
|
+
|
|
238
246
|
ThreadCancelParams = Cerca::Models::ThreadCancelParams
|
|
239
247
|
|
|
240
248
|
ThreadCloseParams = Cerca::Models::ThreadCloseParams
|
|
@@ -243,6 +251,8 @@ module Cerca
|
|
|
243
251
|
|
|
244
252
|
ThreadCreateParams = Cerca::Models::ThreadCreateParams
|
|
245
253
|
|
|
254
|
+
ThreadListMessagesParams = Cerca::Models::ThreadListMessagesParams
|
|
255
|
+
|
|
246
256
|
ThreadListParams = Cerca::Models::ThreadListParams
|
|
247
257
|
|
|
248
258
|
ThreadRetrieveParams = Cerca::Models::ThreadRetrieveParams
|
|
@@ -255,6 +265,8 @@ module Cerca
|
|
|
255
265
|
|
|
256
266
|
ThreadSummary = Cerca::Models::ThreadSummary
|
|
257
267
|
|
|
268
|
+
ThreadTurnSummary = Cerca::Models::ThreadTurnSummary
|
|
269
|
+
|
|
258
270
|
TokenUsage = Cerca::Models::TokenUsage
|
|
259
271
|
|
|
260
272
|
Tool = Cerca::Models::Tool
|
|
@@ -38,6 +38,9 @@ module Cerca
|
|
|
38
38
|
)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
# Some parameter documentations has been truncated, see
|
|
42
|
+
# {Cerca::Models::ThreadRetrieveParams} for more details.
|
|
43
|
+
#
|
|
41
44
|
# Retrieve thread
|
|
42
45
|
#
|
|
43
46
|
# @overload retrieve(agent_id, thread_id, debug: nil, include_messages: nil, request_options: {})
|
|
@@ -48,7 +51,7 @@ module Cerca
|
|
|
48
51
|
#
|
|
49
52
|
# @param debug [Symbol, Cerca::Models::ThreadRetrieveParams::Debug] When true, includes debug-only compiled context fields.
|
|
50
53
|
#
|
|
51
|
-
# @param include_messages [Symbol, Cerca::Models::ThreadRetrieveParams::IncludeMessages]
|
|
54
|
+
# @param include_messages [Symbol, Cerca::Models::ThreadRetrieveParams::IncludeMessages] Deprecated compatibility flag. Thread detail includes a bounded recent message p
|
|
52
55
|
#
|
|
53
56
|
# @param request_options [Cerca::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
54
57
|
#
|
|
@@ -102,6 +105,34 @@ module Cerca
|
|
|
102
105
|
)
|
|
103
106
|
end
|
|
104
107
|
|
|
108
|
+
# Fetch compact current and recent activity for a thread without returning
|
|
109
|
+
# transcript content or runtime debug state.
|
|
110
|
+
#
|
|
111
|
+
# @overload activity(agent_id, thread_id, fleet_id: nil, request_options: {})
|
|
112
|
+
#
|
|
113
|
+
# @param agent_id [String]
|
|
114
|
+
#
|
|
115
|
+
# @param thread_id [String]
|
|
116
|
+
#
|
|
117
|
+
# @param fleet_id [String] Optional fleet id for index-backed authorization.
|
|
118
|
+
#
|
|
119
|
+
# @param request_options [Cerca::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
120
|
+
#
|
|
121
|
+
# @return [Cerca::Models::ActivityDetail]
|
|
122
|
+
#
|
|
123
|
+
# @see Cerca::Models::ThreadActivityParams
|
|
124
|
+
def activity(agent_id, thread_id, params = {})
|
|
125
|
+
parsed, options = Cerca::ThreadActivityParams.dump_request(params)
|
|
126
|
+
query = Cerca::Internal::Util.encode_query_params(parsed)
|
|
127
|
+
@client.request(
|
|
128
|
+
method: :get,
|
|
129
|
+
path: ["agents/%1$s/threads/%2$s/activity", agent_id, thread_id],
|
|
130
|
+
query: query.transform_keys(fleet_id: "fleetId"),
|
|
131
|
+
model: Cerca::ActivityDetail,
|
|
132
|
+
options: options
|
|
133
|
+
)
|
|
134
|
+
end
|
|
135
|
+
|
|
105
136
|
# Cancel a running or awaiting thread. The underlying runtime treats repeat
|
|
106
137
|
# cancellation as an idempotent lifecycle operation when possible.
|
|
107
138
|
#
|
|
@@ -165,6 +196,39 @@ module Cerca
|
|
|
165
196
|
)
|
|
166
197
|
end
|
|
167
198
|
|
|
199
|
+
# List a bounded page of transcript messages for a thread, newest first. Use the
|
|
200
|
+
# returned `cursor` to page older messages.
|
|
201
|
+
#
|
|
202
|
+
# @overload list_messages(agent_id, thread_id, cursor: nil, fleet_id: nil, limit: nil, request_options: {})
|
|
203
|
+
#
|
|
204
|
+
# @param agent_id [String]
|
|
205
|
+
#
|
|
206
|
+
# @param thread_id [String]
|
|
207
|
+
#
|
|
208
|
+
# @param cursor [String] Cursor returned by a previous thread messages response.
|
|
209
|
+
#
|
|
210
|
+
# @param fleet_id [String] Optional fleet id for index-backed authorization.
|
|
211
|
+
#
|
|
212
|
+
# @param limit [String] Maximum number of messages to include, capped at 500.
|
|
213
|
+
#
|
|
214
|
+
# @param request_options [Cerca::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
215
|
+
#
|
|
216
|
+
# @return [Cerca::Internal::ThreadMessagesCursorPage<Cerca::Models::Message>]
|
|
217
|
+
#
|
|
218
|
+
# @see Cerca::Models::ThreadListMessagesParams
|
|
219
|
+
def list_messages(agent_id, thread_id, params = {})
|
|
220
|
+
parsed, options = Cerca::ThreadListMessagesParams.dump_request(params)
|
|
221
|
+
query = Cerca::Internal::Util.encode_query_params(parsed)
|
|
222
|
+
@client.request(
|
|
223
|
+
method: :get,
|
|
224
|
+
path: ["agents/%1$s/threads/%2$s/messages", agent_id, thread_id],
|
|
225
|
+
query: query.transform_keys(fleet_id: "fleetId"),
|
|
226
|
+
page: Cerca::Internal::ThreadMessagesCursorPage,
|
|
227
|
+
model: Cerca::Message,
|
|
228
|
+
options: options
|
|
229
|
+
)
|
|
230
|
+
end
|
|
231
|
+
|
|
168
232
|
# Some parameter documentations has been truncated, see
|
|
169
233
|
# {Cerca::Models::ThreadStartTurnParams} for more details.
|
|
170
234
|
#
|
data/lib/cerca/version.rb
CHANGED