cerca 0.1.0 → 0.2.1

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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/cerca/internal/thread_messages_cursor_page.rb +92 -0
  5. data/lib/cerca/internal/transport/base_client.rb +2 -0
  6. data/lib/cerca/models/activity_detail.rb +24 -0
  7. data/lib/cerca/models/activity_summary.rb +112 -0
  8. data/lib/cerca/models/message.rb +1 -0
  9. data/lib/cerca/models/message_page.rb +27 -0
  10. data/lib/cerca/models/thread.rb +15 -1
  11. data/lib/cerca/models/thread_activity_params.rb +36 -0
  12. data/lib/cerca/models/thread_list_messages_params.rb +52 -0
  13. data/lib/cerca/models/thread_retrieve_params.rb +10 -3
  14. data/lib/cerca/models/thread_turn_summary.rb +56 -0
  15. data/lib/cerca/models.rb +12 -0
  16. data/lib/cerca/resources/threads.rb +65 -1
  17. data/lib/cerca/version.rb +1 -1
  18. data/lib/cerca.rb +7 -0
  19. data/rbi/cerca/internal/thread_messages_cursor_page.rbi +25 -0
  20. data/rbi/cerca/models/activity_detail.rbi +36 -0
  21. data/rbi/cerca/models/activity_summary.rbi +117 -0
  22. data/rbi/cerca/models/message_page.rbi +41 -0
  23. data/rbi/cerca/models/thread.rbi +12 -0
  24. data/rbi/cerca/models/thread_activity_params.rbi +58 -0
  25. data/rbi/cerca/models/thread_list_messages_params.rbi +80 -0
  26. data/rbi/cerca/models/thread_retrieve_params.rbi +9 -3
  27. data/rbi/cerca/models/thread_turn_summary.rbi +85 -0
  28. data/rbi/cerca/models.rbi +12 -0
  29. data/rbi/cerca/resources/threads.rbi +47 -1
  30. data/sig/cerca/internal/thread_messages_cursor_page.rbs +15 -0
  31. data/sig/cerca/models/activity_detail.rbs +28 -0
  32. data/sig/cerca/models/activity_summary.rbs +85 -0
  33. data/sig/cerca/models/message_page.rbs +26 -0
  34. data/sig/cerca/models/thread.rbs +10 -0
  35. data/sig/cerca/models/thread_activity_params.rbs +34 -0
  36. data/sig/cerca/models/thread_list_messages_params.rbs +52 -0
  37. data/sig/cerca/models/thread_turn_summary.rbs +56 -0
  38. data/sig/cerca/models.rbs +12 -0
  39. data/sig/cerca/resources/threads.rbs +16 -0
  40. metadata +28 -3
data/rbi/cerca/models.rbi CHANGED
@@ -1,6 +1,10 @@
1
1
  # typed: strong
2
2
 
3
3
  module Cerca
4
+ ActivityDetail = Cerca::Models::ActivityDetail
5
+
6
+ ActivitySummary = Cerca::Models::ActivitySummary
7
+
4
8
  Agent = Cerca::Models::Agent
5
9
 
6
10
  AgentCreateParams = Cerca::Models::AgentCreateParams
@@ -143,6 +147,8 @@ module Cerca
143
147
 
144
148
  Message = Cerca::Models::Message
145
149
 
150
+ MessagePage = Cerca::Models::MessagePage
151
+
146
152
  Metadata = T.let(Cerca::Models::Metadata, Cerca::Internal::Type::Converter)
147
153
 
148
154
  ModelDescriptor = Cerca::Models::ModelDescriptor
@@ -199,6 +205,8 @@ module Cerca
199
205
 
200
206
  Thread = Cerca::Models::Thread
201
207
 
208
+ ThreadActivityParams = Cerca::Models::ThreadActivityParams
209
+
202
210
  ThreadCancelParams = Cerca::Models::ThreadCancelParams
203
211
 
204
212
  ThreadCloseParams = Cerca::Models::ThreadCloseParams
@@ -207,6 +215,8 @@ module Cerca
207
215
 
208
216
  ThreadCreateParams = Cerca::Models::ThreadCreateParams
209
217
 
218
+ ThreadListMessagesParams = Cerca::Models::ThreadListMessagesParams
219
+
210
220
  ThreadListParams = Cerca::Models::ThreadListParams
211
221
 
212
222
  ThreadRetrieveParams = Cerca::Models::ThreadRetrieveParams
@@ -219,6 +229,8 @@ module Cerca
219
229
 
220
230
  ThreadSummary = Cerca::Models::ThreadSummary
221
231
 
232
+ ThreadTurnSummary = Cerca::Models::ThreadTurnSummary
233
+
222
234
  TokenUsage = Cerca::Models::TokenUsage
223
235
 
224
236
  Tool = Cerca::Models::Tool
@@ -46,7 +46,9 @@ module Cerca
46
46
  thread_id,
47
47
  # When true, includes debug-only compiled context fields.
48
48
  debug: nil,
49
- # When true, includes message content in the thread detail.
49
+ # Deprecated compatibility flag. Thread detail includes a bounded recent message
50
+ # page by default; pass `false` only to opt out when no message pagination params
51
+ # are present.
50
52
  include_messages: nil,
51
53
  request_options: {}
52
54
  )
@@ -78,6 +80,25 @@ module Cerca
78
80
  )
79
81
  end
80
82
 
83
+ # Fetch compact current and recent activity for a thread without returning
84
+ # transcript content or runtime debug state.
85
+ sig do
86
+ params(
87
+ agent_id: String,
88
+ thread_id: String,
89
+ fleet_id: String,
90
+ request_options: Cerca::RequestOptions::OrHash
91
+ ).returns(Cerca::ActivityDetail)
92
+ end
93
+ def activity(
94
+ agent_id,
95
+ thread_id,
96
+ # Optional fleet id for index-backed authorization.
97
+ fleet_id: nil,
98
+ request_options: {}
99
+ )
100
+ end
101
+
81
102
  # Cancel a running or awaiting thread. The underlying runtime treats repeat
82
103
  # cancellation as an idempotent lifecycle operation when possible.
83
104
  sig do
@@ -114,6 +135,31 @@ module Cerca
114
135
  def compact(agent_id, thread_id, request_options: {})
115
136
  end
116
137
 
138
+ # List a bounded page of transcript messages for a thread, newest first. Use the
139
+ # returned `cursor` to page older messages.
140
+ sig do
141
+ params(
142
+ agent_id: String,
143
+ thread_id: String,
144
+ cursor: String,
145
+ fleet_id: String,
146
+ limit: String,
147
+ request_options: Cerca::RequestOptions::OrHash
148
+ ).returns(Cerca::Internal::ThreadMessagesCursorPage[Cerca::Message])
149
+ end
150
+ def list_messages(
151
+ agent_id,
152
+ thread_id,
153
+ # Cursor returned by a previous thread messages response.
154
+ cursor: nil,
155
+ # Optional fleet id for index-backed authorization.
156
+ fleet_id: nil,
157
+ # Maximum number of messages to include, capped at 500.
158
+ limit: nil,
159
+ request_options: {}
160
+ )
161
+ end
162
+
117
163
  # Create turn
118
164
  sig do
119
165
  params(
@@ -0,0 +1,15 @@
1
+ module Cerca
2
+ module Internal
3
+ class ThreadMessagesCursorPage[Elem]
4
+ include Cerca::Internal::Type::BasePage[Elem]
5
+
6
+ attr_accessor messages: ::Array[Elem]?
7
+
8
+ attr_accessor cursor: String?
9
+
10
+ attr_accessor has_more: bool
11
+
12
+ def inspect: -> String
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,28 @@
1
+ module Cerca
2
+ module Models
3
+ type activity_detail =
4
+ { error: String?, recent_turns: ::Array[Cerca::ThreadTurnSummary] }
5
+
6
+ class ActivityDetail < Cerca::Models::ActivitySummary
7
+ def error: -> String?
8
+
9
+ def error=: (String? _) -> String?
10
+
11
+ def recent_turns: -> ::Array[Cerca::ThreadTurnSummary]
12
+
13
+ def recent_turns=: (
14
+ ::Array[Cerca::ThreadTurnSummary] _
15
+ ) -> ::Array[Cerca::ThreadTurnSummary]
16
+
17
+ def initialize: (
18
+ error: String?,
19
+ recent_turns: ::Array[Cerca::ThreadTurnSummary]
20
+ ) -> void
21
+
22
+ def to_hash: -> {
23
+ error: String?,
24
+ recent_turns: ::Array[Cerca::ThreadTurnSummary]
25
+ }
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,85 @@
1
+ module Cerca
2
+ module Models
3
+ type activity_summary =
4
+ {
5
+ id: String,
6
+ completed_at: String?,
7
+ created_at: String,
8
+ goal: String,
9
+ latest_activity: String?,
10
+ message_count: Float,
11
+ model: String,
12
+ next_step: String?,
13
+ parent_thread_id: String?,
14
+ result: String?,
15
+ schedule_id: String?,
16
+ status: Cerca::Models::status,
17
+ step_count: Float,
18
+ updated_at: String
19
+ }
20
+
21
+ class ActivitySummary < Cerca::Internal::Type::BaseModel
22
+ attr_accessor id: String
23
+
24
+ attr_accessor completed_at: String?
25
+
26
+ attr_accessor created_at: String
27
+
28
+ attr_accessor goal: String
29
+
30
+ attr_accessor latest_activity: String?
31
+
32
+ attr_accessor message_count: Float
33
+
34
+ attr_accessor model: String
35
+
36
+ attr_accessor next_step: String?
37
+
38
+ attr_accessor parent_thread_id: String?
39
+
40
+ attr_accessor result: String?
41
+
42
+ attr_accessor schedule_id: String?
43
+
44
+ attr_accessor status: Cerca::Models::status
45
+
46
+ attr_accessor step_count: Float
47
+
48
+ attr_accessor updated_at: String
49
+
50
+ def initialize: (
51
+ id: String,
52
+ completed_at: String?,
53
+ created_at: String,
54
+ goal: String,
55
+ latest_activity: String?,
56
+ message_count: Float,
57
+ model: String,
58
+ next_step: String?,
59
+ parent_thread_id: String?,
60
+ result: String?,
61
+ schedule_id: String?,
62
+ status: Cerca::Models::status,
63
+ step_count: Float,
64
+ updated_at: String
65
+ ) -> void
66
+
67
+ def to_hash: -> {
68
+ id: String,
69
+ completed_at: String?,
70
+ created_at: String,
71
+ goal: String,
72
+ latest_activity: String?,
73
+ message_count: Float,
74
+ model: String,
75
+ next_step: String?,
76
+ parent_thread_id: String?,
77
+ result: String?,
78
+ schedule_id: String?,
79
+ status: Cerca::Models::status,
80
+ step_count: Float,
81
+ updated_at: String
82
+ }
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,26 @@
1
+ module Cerca
2
+ module Models
3
+ type message_page =
4
+ { cursor: String?, has_more: bool, messages: ::Array[Cerca::Message] }
5
+
6
+ class MessagePage < Cerca::Internal::Type::BaseModel
7
+ attr_accessor cursor: String?
8
+
9
+ attr_accessor has_more: bool
10
+
11
+ attr_accessor messages: ::Array[Cerca::Message]
12
+
13
+ def initialize: (
14
+ cursor: String?,
15
+ has_more: bool,
16
+ messages: ::Array[Cerca::Message]
17
+ ) -> void
18
+
19
+ def to_hash: -> {
20
+ cursor: String?,
21
+ has_more: bool,
22
+ messages: ::Array[Cerca::Message]
23
+ }
24
+ end
25
+ end
26
+ end
@@ -9,9 +9,11 @@ module Cerca
9
9
  created_at: String,
10
10
  depth: Float,
11
11
  error: String?,
12
+ has_more_messages: bool,
12
13
  instructions: String?,
13
14
  last_turn_status: Cerca::Models::Thread::last_turn_status?,
14
15
  message: String,
16
+ message_cursor: Float?,
15
17
  messages: ::Array[Cerca::Message],
16
18
  model: String,
17
19
  parent_thread_id: String?,
@@ -41,12 +43,16 @@ module Cerca
41
43
 
42
44
  attr_accessor error: String?
43
45
 
46
+ attr_accessor has_more_messages: bool
47
+
44
48
  attr_accessor instructions: String?
45
49
 
46
50
  attr_accessor last_turn_status: Cerca::Models::Thread::last_turn_status?
47
51
 
48
52
  attr_accessor message: String
49
53
 
54
+ attr_accessor message_cursor: Float?
55
+
50
56
  attr_accessor messages: ::Array[Cerca::Message]
51
57
 
52
58
  attr_accessor model: String
@@ -83,9 +89,11 @@ module Cerca
83
89
  created_at: String,
84
90
  depth: Float,
85
91
  error: String?,
92
+ has_more_messages: bool,
86
93
  instructions: String?,
87
94
  last_turn_status: Cerca::Models::Thread::last_turn_status?,
88
95
  message: String,
96
+ message_cursor: Float?,
89
97
  messages: ::Array[Cerca::Message],
90
98
  model: String,
91
99
  parent_thread_id: String?,
@@ -108,9 +116,11 @@ module Cerca
108
116
  created_at: String,
109
117
  depth: Float,
110
118
  error: String?,
119
+ has_more_messages: bool,
111
120
  instructions: String?,
112
121
  last_turn_status: Cerca::Models::Thread::last_turn_status?,
113
122
  message: String,
123
+ message_cursor: Float?,
114
124
  messages: ::Array[Cerca::Message],
115
125
  model: String,
116
126
  parent_thread_id: String?,
@@ -0,0 +1,34 @@
1
+ module Cerca
2
+ module Models
3
+ type thread_activity_params =
4
+ { agent_id: String, thread_id: String, fleet_id: String }
5
+ & Cerca::Internal::Type::request_parameters
6
+
7
+ class ThreadActivityParams < Cerca::Internal::Type::BaseModel
8
+ extend Cerca::Internal::Type::RequestParameters::Converter
9
+ include Cerca::Internal::Type::RequestParameters
10
+
11
+ attr_accessor agent_id: String
12
+
13
+ attr_accessor thread_id: String
14
+
15
+ attr_reader fleet_id: String?
16
+
17
+ def fleet_id=: (String) -> String
18
+
19
+ def initialize: (
20
+ agent_id: String,
21
+ thread_id: String,
22
+ ?fleet_id: String,
23
+ ?request_options: Cerca::request_opts
24
+ ) -> void
25
+
26
+ def to_hash: -> {
27
+ agent_id: String,
28
+ thread_id: String,
29
+ fleet_id: String,
30
+ request_options: Cerca::RequestOptions
31
+ }
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,52 @@
1
+ module Cerca
2
+ module Models
3
+ type thread_list_messages_params =
4
+ {
5
+ agent_id: String,
6
+ thread_id: String,
7
+ cursor: String,
8
+ fleet_id: String,
9
+ limit: String
10
+ }
11
+ & Cerca::Internal::Type::request_parameters
12
+
13
+ class ThreadListMessagesParams < Cerca::Internal::Type::BaseModel
14
+ extend Cerca::Internal::Type::RequestParameters::Converter
15
+ include Cerca::Internal::Type::RequestParameters
16
+
17
+ attr_accessor agent_id: String
18
+
19
+ attr_accessor thread_id: String
20
+
21
+ attr_reader cursor: String?
22
+
23
+ def cursor=: (String) -> String
24
+
25
+ attr_reader fleet_id: String?
26
+
27
+ def fleet_id=: (String) -> String
28
+
29
+ attr_reader limit: String?
30
+
31
+ def limit=: (String) -> String
32
+
33
+ def initialize: (
34
+ agent_id: String,
35
+ thread_id: String,
36
+ ?cursor: String,
37
+ ?fleet_id: String,
38
+ ?limit: String,
39
+ ?request_options: Cerca::request_opts
40
+ ) -> void
41
+
42
+ def to_hash: -> {
43
+ agent_id: String,
44
+ thread_id: String,
45
+ cursor: String,
46
+ fleet_id: String,
47
+ limit: String,
48
+ request_options: Cerca::RequestOptions
49
+ }
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,56 @@
1
+ module Cerca
2
+ module Models
3
+ type thread_turn_summary =
4
+ {
5
+ activity: String?,
6
+ completed_at: String,
7
+ message_count: Float,
8
+ next_step: String?,
9
+ status: Cerca::Models::ThreadTurnSummary::status,
10
+ turn_seq: Float
11
+ }
12
+
13
+ class ThreadTurnSummary < Cerca::Internal::Type::BaseModel
14
+ attr_accessor activity: String?
15
+
16
+ attr_accessor completed_at: String
17
+
18
+ attr_accessor message_count: Float
19
+
20
+ attr_accessor next_step: String?
21
+
22
+ attr_accessor status: Cerca::Models::ThreadTurnSummary::status
23
+
24
+ attr_accessor turn_seq: Float
25
+
26
+ def initialize: (
27
+ activity: String?,
28
+ completed_at: String,
29
+ message_count: Float,
30
+ next_step: String?,
31
+ status: Cerca::Models::ThreadTurnSummary::status,
32
+ turn_seq: Float
33
+ ) -> void
34
+
35
+ def to_hash: -> {
36
+ activity: String?,
37
+ completed_at: String,
38
+ message_count: Float,
39
+ next_step: String?,
40
+ status: Cerca::Models::ThreadTurnSummary::status,
41
+ turn_seq: Float
42
+ }
43
+
44
+ type status = :completed | :failed
45
+
46
+ module Status
47
+ extend Cerca::Internal::Type::Enum
48
+
49
+ COMPLETED: :completed
50
+ FAILED: :failed
51
+
52
+ def self?.values: -> ::Array[Cerca::Models::ThreadTurnSummary::status]
53
+ end
54
+ end
55
+ end
56
+ end
data/sig/cerca/models.rbs CHANGED
@@ -1,4 +1,8 @@
1
1
  module Cerca
2
+ class ActivityDetail = Cerca::Models::ActivityDetail
3
+
4
+ class ActivitySummary = Cerca::Models::ActivitySummary
5
+
2
6
  class Agent = Cerca::Models::Agent
3
7
 
4
8
  class AgentCreateParams = Cerca::Models::AgentCreateParams
@@ -137,6 +141,8 @@ module Cerca
137
141
 
138
142
  class Message = Cerca::Models::Message
139
143
 
144
+ class MessagePage = Cerca::Models::MessagePage
145
+
140
146
  Metadata: Cerca::Internal::Type::Converter
141
147
 
142
148
  class ModelDescriptor = Cerca::Models::ModelDescriptor
@@ -193,6 +199,8 @@ module Cerca
193
199
 
194
200
  class Thread = Cerca::Models::Thread
195
201
 
202
+ class ThreadActivityParams = Cerca::Models::ThreadActivityParams
203
+
196
204
  class ThreadCancelParams = Cerca::Models::ThreadCancelParams
197
205
 
198
206
  class ThreadCloseParams = Cerca::Models::ThreadCloseParams
@@ -201,6 +209,8 @@ module Cerca
201
209
 
202
210
  class ThreadCreateParams = Cerca::Models::ThreadCreateParams
203
211
 
212
+ class ThreadListMessagesParams = Cerca::Models::ThreadListMessagesParams
213
+
204
214
  class ThreadListParams = Cerca::Models::ThreadListParams
205
215
 
206
216
  class ThreadRetrieveParams = Cerca::Models::ThreadRetrieveParams
@@ -213,6 +223,8 @@ module Cerca
213
223
 
214
224
  class ThreadSummary = Cerca::Models::ThreadSummary
215
225
 
226
+ class ThreadTurnSummary = Cerca::Models::ThreadTurnSummary
227
+
216
228
  class TokenUsage = Cerca::Models::TokenUsage
217
229
 
218
230
  module Tool = Cerca::Models::Tool
@@ -28,6 +28,13 @@ module Cerca
28
28
  ?request_options: Cerca::request_opts
29
29
  ) -> Cerca::Internal::ThreadsCursorPage[Cerca::ThreadSummary]
30
30
 
31
+ def activity: (
32
+ String agent_id,
33
+ String thread_id,
34
+ ?fleet_id: String,
35
+ ?request_options: Cerca::request_opts
36
+ ) -> Cerca::ActivityDetail
37
+
31
38
  def cancel: (
32
39
  String agent_id,
33
40
  String thread_id,
@@ -46,6 +53,15 @@ module Cerca
46
53
  ?request_options: Cerca::request_opts
47
54
  ) -> Cerca::Thread
48
55
 
56
+ def list_messages: (
57
+ String agent_id,
58
+ String thread_id,
59
+ ?cursor: String,
60
+ ?fleet_id: String,
61
+ ?limit: String,
62
+ ?request_options: Cerca::request_opts
63
+ ) -> Cerca::Internal::ThreadMessagesCursorPage[Cerca::Message]
64
+
49
65
  def start_turn: (
50
66
  String agent_id,
51
67
  String thread_id,