casedev 0.22.1 → 0.24.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.
Files changed (161) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/resources/agent/v1/agents.d.mts +55 -5
  4. package/resources/agent/v1/agents.d.mts.map +1 -1
  5. package/resources/agent/v1/agents.d.ts +55 -5
  6. package/resources/agent/v1/agents.d.ts.map +1 -1
  7. package/resources/agent/v1/agents.js +5 -2
  8. package/resources/agent/v1/agents.js.map +1 -1
  9. package/resources/agent/v1/agents.mjs +5 -2
  10. package/resources/agent/v1/agents.mjs.map +1 -1
  11. package/resources/agent/v1/chat.d.mts +64 -27
  12. package/resources/agent/v1/chat.d.mts.map +1 -1
  13. package/resources/agent/v1/chat.d.ts +64 -27
  14. package/resources/agent/v1/chat.d.ts.map +1 -1
  15. package/resources/agent/v1/chat.js +31 -23
  16. package/resources/agent/v1/chat.js.map +1 -1
  17. package/resources/agent/v1/chat.mjs +31 -23
  18. package/resources/agent/v1/chat.mjs.map +1 -1
  19. package/resources/agent/v1/execute.d.mts +16 -3
  20. package/resources/agent/v1/execute.d.mts.map +1 -1
  21. package/resources/agent/v1/execute.d.ts +16 -3
  22. package/resources/agent/v1/execute.d.ts.map +1 -1
  23. package/resources/agent/v1/execute.js +10 -0
  24. package/resources/agent/v1/execute.js.map +1 -1
  25. package/resources/agent/v1/execute.mjs +10 -0
  26. package/resources/agent/v1/execute.mjs.map +1 -1
  27. package/resources/agent/v1/index.d.mts +3 -3
  28. package/resources/agent/v1/index.d.mts.map +1 -1
  29. package/resources/agent/v1/index.d.ts +3 -3
  30. package/resources/agent/v1/index.d.ts.map +1 -1
  31. package/resources/agent/v1/index.js.map +1 -1
  32. package/resources/agent/v1/index.mjs.map +1 -1
  33. package/resources/agent/v1/run.d.mts +57 -1
  34. package/resources/agent/v1/run.d.mts.map +1 -1
  35. package/resources/agent/v1/run.d.ts +57 -1
  36. package/resources/agent/v1/run.d.ts.map +1 -1
  37. package/resources/agent/v1/run.js +10 -0
  38. package/resources/agent/v1/run.js.map +1 -1
  39. package/resources/agent/v1/run.mjs +10 -0
  40. package/resources/agent/v1/run.mjs.map +1 -1
  41. package/resources/agent/v1/v1.d.mts +6 -6
  42. package/resources/agent/v1/v1.d.mts.map +1 -1
  43. package/resources/agent/v1/v1.d.ts +6 -6
  44. package/resources/agent/v1/v1.d.ts.map +1 -1
  45. package/resources/agent/v1/v1.js.map +1 -1
  46. package/resources/agent/v1/v1.mjs.map +1 -1
  47. package/resources/applications/v1/deployments.d.mts +26 -16
  48. package/resources/applications/v1/deployments.d.mts.map +1 -1
  49. package/resources/applications/v1/deployments.d.ts +26 -16
  50. package/resources/applications/v1/deployments.d.ts.map +1 -1
  51. package/resources/applications/v1/deployments.js +16 -6
  52. package/resources/applications/v1/deployments.js.map +1 -1
  53. package/resources/applications/v1/deployments.mjs +16 -6
  54. package/resources/applications/v1/deployments.mjs.map +1 -1
  55. package/resources/applications/v1/index.d.mts +1 -1
  56. package/resources/applications/v1/index.d.mts.map +1 -1
  57. package/resources/applications/v1/index.d.ts +1 -1
  58. package/resources/applications/v1/index.d.ts.map +1 -1
  59. package/resources/applications/v1/index.js.map +1 -1
  60. package/resources/applications/v1/index.mjs.map +1 -1
  61. package/resources/applications/v1/projects.d.mts +91 -24
  62. package/resources/applications/v1/projects.d.mts.map +1 -1
  63. package/resources/applications/v1/projects.d.ts +91 -24
  64. package/resources/applications/v1/projects.d.ts.map +1 -1
  65. package/resources/applications/v1/projects.js +20 -8
  66. package/resources/applications/v1/projects.js.map +1 -1
  67. package/resources/applications/v1/projects.mjs +20 -8
  68. package/resources/applications/v1/projects.mjs.map +1 -1
  69. package/resources/applications/v1/v1.d.mts +2 -2
  70. package/resources/applications/v1/v1.d.mts.map +1 -1
  71. package/resources/applications/v1/v1.d.ts +2 -2
  72. package/resources/applications/v1/v1.d.ts.map +1 -1
  73. package/resources/applications/v1/v1.js.map +1 -1
  74. package/resources/applications/v1/v1.mjs.map +1 -1
  75. package/resources/format/v1/v1.d.mts +8 -0
  76. package/resources/format/v1/v1.d.mts.map +1 -1
  77. package/resources/format/v1/v1.d.ts +8 -0
  78. package/resources/format/v1/v1.d.ts.map +1 -1
  79. package/resources/format/v1/v1.js.map +1 -1
  80. package/resources/format/v1/v1.mjs.map +1 -1
  81. package/resources/legal/v1.d.mts +9 -0
  82. package/resources/legal/v1.d.mts.map +1 -1
  83. package/resources/legal/v1.d.ts +9 -0
  84. package/resources/legal/v1.d.ts.map +1 -1
  85. package/resources/vault/events/subscriptions.d.mts +20 -6
  86. package/resources/vault/events/subscriptions.d.mts.map +1 -1
  87. package/resources/vault/events/subscriptions.d.ts +20 -6
  88. package/resources/vault/events/subscriptions.d.ts.map +1 -1
  89. package/resources/vault/groups.d.mts +34 -7
  90. package/resources/vault/groups.d.mts.map +1 -1
  91. package/resources/vault/groups.d.ts +34 -7
  92. package/resources/vault/groups.d.ts.map +1 -1
  93. package/resources/vault/groups.js +13 -7
  94. package/resources/vault/groups.js.map +1 -1
  95. package/resources/vault/groups.mjs +13 -7
  96. package/resources/vault/groups.mjs.map +1 -1
  97. package/resources/vault/index.d.mts +1 -1
  98. package/resources/vault/index.d.mts.map +1 -1
  99. package/resources/vault/index.d.ts +1 -1
  100. package/resources/vault/index.d.ts.map +1 -1
  101. package/resources/vault/index.js.map +1 -1
  102. package/resources/vault/index.mjs.map +1 -1
  103. package/resources/vault/multipart.d.mts +18 -0
  104. package/resources/vault/multipart.d.mts.map +1 -1
  105. package/resources/vault/multipart.d.ts +18 -0
  106. package/resources/vault/multipart.d.ts.map +1 -1
  107. package/resources/vault/vault.d.mts +2 -2
  108. package/resources/vault/vault.d.mts.map +1 -1
  109. package/resources/vault/vault.d.ts +2 -2
  110. package/resources/vault/vault.d.ts.map +1 -1
  111. package/resources/vault/vault.js.map +1 -1
  112. package/resources/vault/vault.mjs.map +1 -1
  113. package/resources/voice/boost-list.d.mts +88 -0
  114. package/resources/voice/boost-list.d.mts.map +1 -0
  115. package/resources/voice/boost-list.d.ts +88 -0
  116. package/resources/voice/boost-list.d.ts.map +1 -0
  117. package/resources/voice/boost-list.js +40 -0
  118. package/resources/voice/boost-list.js.map +1 -0
  119. package/resources/voice/boost-list.mjs +36 -0
  120. package/resources/voice/boost-list.mjs.map +1 -0
  121. package/resources/voice/index.d.mts +1 -0
  122. package/resources/voice/index.d.mts.map +1 -1
  123. package/resources/voice/index.d.ts +1 -0
  124. package/resources/voice/index.d.ts.map +1 -1
  125. package/resources/voice/index.js +3 -1
  126. package/resources/voice/index.js.map +1 -1
  127. package/resources/voice/index.mjs +1 -0
  128. package/resources/voice/index.mjs.map +1 -1
  129. package/resources/voice/voice.d.mts +4 -0
  130. package/resources/voice/voice.d.mts.map +1 -1
  131. package/resources/voice/voice.d.ts +4 -0
  132. package/resources/voice/voice.d.ts.map +1 -1
  133. package/resources/voice/voice.js +4 -0
  134. package/resources/voice/voice.js.map +1 -1
  135. package/resources/voice/voice.mjs +4 -0
  136. package/resources/voice/voice.mjs.map +1 -1
  137. package/src/resources/agent/v1/agents.ts +63 -5
  138. package/src/resources/agent/v1/chat.ts +66 -44
  139. package/src/resources/agent/v1/execute.ts +16 -3
  140. package/src/resources/agent/v1/index.ts +3 -2
  141. package/src/resources/agent/v1/run.ts +77 -0
  142. package/src/resources/agent/v1/v1.ts +6 -4
  143. package/src/resources/applications/v1/deployments.ts +26 -16
  144. package/src/resources/applications/v1/index.ts +1 -0
  145. package/src/resources/applications/v1/projects.ts +97 -24
  146. package/src/resources/applications/v1/v1.ts +2 -0
  147. package/src/resources/format/v1/v1.ts +8 -0
  148. package/src/resources/legal/v1.ts +9 -0
  149. package/src/resources/vault/events/subscriptions.ts +20 -6
  150. package/src/resources/vault/groups.ts +41 -7
  151. package/src/resources/vault/index.ts +1 -1
  152. package/src/resources/vault/multipart.ts +18 -0
  153. package/src/resources/vault/vault.ts +6 -2
  154. package/src/resources/voice/boost-list.ts +119 -0
  155. package/src/resources/voice/index.ts +7 -0
  156. package/src/resources/voice/voice.ts +18 -0
  157. package/src/version.ts +1 -1
  158. package/version.d.mts +1 -1
  159. package/version.d.ts +1 -1
  160. package/version.js +1 -1
  161. package/version.mjs +1 -1
@@ -5,6 +5,9 @@ import { APIPromise } from '../../../core/api-promise';
5
5
  import { RequestOptions } from '../../../internal/request-options';
6
6
  import { path } from '../../../internal/utils/path';
7
7
 
8
+ /**
9
+ * Create, manage, and execute AI agents with tool access, sandbox environments, and async run workflows
10
+ */
8
11
  export class Agents extends APIResource {
9
12
  /**
10
13
  * Creates a new agent definition with a scoped API key. The agent can then be used
@@ -31,8 +34,11 @@ export class Agents extends APIResource {
31
34
  /**
32
35
  * Lists all active agents for the authenticated organization.
33
36
  */
34
- list(options?: RequestOptions): APIPromise<AgentListResponse> {
35
- return this._client.get('/agent/v1/agents', options);
37
+ list(
38
+ query: AgentListParams | null | undefined = {},
39
+ options?: RequestOptions,
40
+ ): APIPromise<AgentListResponse> {
41
+ return this._client.get('/agent/v1/agents', { query, ...options });
36
42
  }
37
43
 
38
44
  /**
@@ -123,6 +129,13 @@ export interface AgentUpdateResponse {
123
129
 
124
130
  export interface AgentListResponse {
125
131
  agents?: Array<AgentListResponse.Agent>;
132
+
133
+ hasMore?: boolean;
134
+
135
+ /**
136
+ * Pass as cursor to fetch the next page
137
+ */
138
+ nextCursor?: string | null;
126
139
  }
127
140
 
128
141
  export namespace AgentListResponse {
@@ -166,12 +179,14 @@ export interface AgentCreateParams {
166
179
  description?: string;
167
180
 
168
181
  /**
169
- * Denylist of tools the agent cannot use
182
+ * Denylist of tools the agent cannot use. Mutually exclusive with enabledTools —
183
+ * set one or the other, not both.
170
184
  */
171
185
  disabledTools?: Array<string> | null;
172
186
 
173
187
  /**
174
- * Allowlist of tools the agent can use
188
+ * Allowlist of tools the agent can use. Mutually exclusive with disabledTools —
189
+ * set one or the other, not both.
175
190
  */
176
191
  enabledTools?: Array<string> | null;
177
192
 
@@ -215,25 +230,67 @@ export namespace AgentCreateParams {
215
230
  }
216
231
 
217
232
  export interface AgentUpdateParams {
218
- description?: string;
233
+ /**
234
+ * Updated agent description. Pass null to clear if supported by the client.
235
+ */
236
+ description?: string | null;
219
237
 
238
+ /**
239
+ * Denylist of tools the agent cannot use. Mutually exclusive with enabledTools —
240
+ * set one or the other, not both. Pass null to clear.
241
+ */
220
242
  disabledTools?: Array<string> | null;
221
243
 
244
+ /**
245
+ * Allowlist of tools the agent can use. Mutually exclusive with disabledTools —
246
+ * set one or the other, not both. Pass null to clear.
247
+ */
222
248
  enabledTools?: Array<string> | null;
223
249
 
250
+ /**
251
+ * Updated system instructions that guide agent behavior
252
+ */
224
253
  instructions?: string;
225
254
 
255
+ /**
256
+ * Model identifier the agent should use for future runs
257
+ */
226
258
  model?: string;
227
259
 
260
+ /**
261
+ * Updated agent display name
262
+ */
228
263
  name?: string;
229
264
 
265
+ /**
266
+ * Sandbox configuration override for future agent runs. Pass null to clear.
267
+ */
230
268
  sandbox?: unknown | null;
231
269
 
270
+ /**
271
+ * Vault group IDs the agent can access. Pass null to clear.
272
+ */
232
273
  vaultGroups?: Array<string> | null;
233
274
 
275
+ /**
276
+ * Vault IDs the agent can access directly. Pass null to clear.
277
+ */
234
278
  vaultIds?: Array<string> | null;
235
279
  }
236
280
 
281
+ export interface AgentListParams {
282
+ /**
283
+ * Pagination cursor (agent ID from previous page). Returns agents created before
284
+ * this agent.
285
+ */
286
+ cursor?: string;
287
+
288
+ /**
289
+ * Maximum number of agents to return (default 50, max 250)
290
+ */
291
+ limit?: number;
292
+ }
293
+
237
294
  export declare namespace Agents {
238
295
  export {
239
296
  type AgentCreateResponse as AgentCreateResponse,
@@ -243,5 +300,6 @@ export declare namespace Agents {
243
300
  type AgentDeleteResponse as AgentDeleteResponse,
244
301
  type AgentCreateParams as AgentCreateParams,
245
302
  type AgentUpdateParams as AgentUpdateParams,
303
+ type AgentListParams as AgentListParams,
246
304
  };
247
305
  }
@@ -7,6 +7,9 @@ import { buildHeaders } from '../../../internal/headers';
7
7
  import { RequestOptions } from '../../../internal/request-options';
8
8
  import { path } from '../../../internal/utils/path';
9
9
 
10
+ /**
11
+ * Create, manage, and execute AI agents with tool access, sandbox environments, and async run workflows
12
+ */
10
13
  export class Chat extends APIResource {
11
14
  /**
12
15
  * Creates a persistent OpenCode chat session in a Modal sandbox. Session state is
@@ -52,18 +55,27 @@ export class Chat extends APIResource {
52
55
  }
53
56
 
54
57
  /**
55
- * Streams a single assistant turn as normalized state events with stable turn,
56
- * message, and part ids. Emits session.usage before turn.completed when token data
57
- * is available.
58
+ * Streams a single assistant turn as normalized SSE events with stable turn,
59
+ * message, and part IDs. Emits events: `turn.started`, `turn.status`,
60
+ * `message.created`, `message.part.updated`, `message.completed`, `session.usage`,
61
+ * `turn.completed`.
62
+ *
63
+ * **When to use this endpoint:** Recommended for building custom chat UIs that
64
+ * need real-time streaming progress. This is the primary streaming endpoint for
65
+ * new integrations.
66
+ *
67
+ * **Alternatives:**
68
+ *
69
+ * - `POST /chat/:id/message` — synchronous, returns complete response as JSON
70
+ * (best for server-to-server)
58
71
  */
59
72
  respond(
60
73
  id: string,
61
- params: ChatRespondParams,
74
+ body: ChatRespondParams,
62
75
  options?: RequestOptions,
63
76
  ): APIPromise<Stream<ChatRespondResponse>> {
64
- const { body } = params;
65
77
  return this._client.post(path`/agent/v1/chat/${id}/respond`, {
66
- body: body,
78
+ body,
67
79
  ...options,
68
80
  headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
69
81
  stream: true,
@@ -71,12 +83,21 @@ export class Chat extends APIResource {
71
83
  }
72
84
 
73
85
  /**
74
- * Proxies a message to the OpenCode session bound to this chat.
86
+ * Sends a message and returns the complete response as a single JSON body. Blocks
87
+ * until the agent turn completes.
88
+ *
89
+ * **When to use this endpoint:** Best for server-to-server integrations,
90
+ * background processing, or any context where you want the full response in one
91
+ * call without managing an SSE stream.
92
+ *
93
+ * **Alternatives:**
94
+ *
95
+ * - `POST /chat/:id/respond` — streaming SSE with normalized events (recommended
96
+ * for custom chat UIs)
75
97
  */
76
- sendMessage(id: string, params: ChatSendMessageParams, options?: RequestOptions): APIPromise<void> {
77
- const { body } = params;
98
+ sendMessage(id: string, body: ChatSendMessageParams, options?: RequestOptions): APIPromise<void> {
78
99
  return this._client.post(path`/agent/v1/chat/${id}/message`, {
79
- body: body,
100
+ body,
80
101
  ...options,
81
102
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
82
103
  });
@@ -98,24 +119,6 @@ export class Chat extends APIResource {
98
119
  stream: true,
99
120
  }) as APIPromise<Stream<ChatStreamResponse>>;
100
121
  }
101
-
102
- /**
103
- * Streams a single assistant turn as AI SDK UIMessageChunk SSE events for direct
104
- * client rendering.
105
- */
106
- uiStream(
107
- id: string,
108
- params: ChatUiStreamParams,
109
- options?: RequestOptions,
110
- ): APIPromise<Stream<ChatUiStreamResponse>> {
111
- const { body } = params;
112
- return this._client.post(path`/agent/v1/chat/${id}/ui-stream`, {
113
- body: body,
114
- ...options,
115
- headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
116
- stream: true,
117
- }) as APIPromise<Stream<ChatUiStreamResponse>>;
118
- }
119
122
  }
120
123
 
121
124
  export interface ChatCreateResponse {
@@ -150,8 +153,6 @@ export type ChatRespondResponse = string;
150
153
 
151
154
  export type ChatStreamResponse = string;
152
155
 
153
- export type ChatUiStreamResponse = string;
154
-
155
156
  export interface ChatCreateParams {
156
157
  /**
157
158
  * Idle timeout before session is eligible for snapshot/termination. Defaults to 15
@@ -182,23 +183,53 @@ export interface ChatReplyToQuestionParams {
182
183
  id: string;
183
184
 
184
185
  /**
185
- * Body param
186
+ * Body param: Answer selections for each prompt element in the pending question
186
187
  */
187
188
  answers: Array<Array<string>>;
188
189
  }
189
190
 
190
191
  export interface ChatRespondParams {
191
192
  /**
192
- * OpenCode message payload. Passed through 1:1.
193
+ * Message content parts. Currently only "text" type is supported. Additional types
194
+ * (e.g. file, image) may be added in future versions.
193
195
  */
194
- body: unknown;
196
+ parts?: Array<ChatRespondParams.Part>;
197
+ }
198
+
199
+ export namespace ChatRespondParams {
200
+ export interface Part {
201
+ /**
202
+ * The message text content
203
+ */
204
+ text: string;
205
+
206
+ /**
207
+ * Part type. Currently only "text" is supported.
208
+ */
209
+ type: 'text';
210
+ }
195
211
  }
196
212
 
197
213
  export interface ChatSendMessageParams {
198
214
  /**
199
- * OpenCode message payload. Passed through 1:1.
215
+ * Message content parts. Currently only "text" type is supported. Additional types
216
+ * (e.g. file, image) may be added in future versions.
200
217
  */
201
- body: unknown;
218
+ parts?: Array<ChatSendMessageParams.Part>;
219
+ }
220
+
221
+ export namespace ChatSendMessageParams {
222
+ export interface Part {
223
+ /**
224
+ * The message text content
225
+ */
226
+ text: string;
227
+
228
+ /**
229
+ * Part type. Currently only "text" is supported.
230
+ */
231
+ type: 'text';
232
+ }
202
233
  }
203
234
 
204
235
  export interface ChatStreamParams {
@@ -208,13 +239,6 @@ export interface ChatStreamParams {
208
239
  lastEventId?: number;
209
240
  }
210
241
 
211
- export interface ChatUiStreamParams {
212
- /**
213
- * OpenCode message payload. Passed through 1:1.
214
- */
215
- body: unknown;
216
- }
217
-
218
242
  export declare namespace Chat {
219
243
  export {
220
244
  type ChatCreateResponse as ChatCreateResponse,
@@ -222,12 +246,10 @@ export declare namespace Chat {
222
246
  type ChatCancelResponse as ChatCancelResponse,
223
247
  type ChatRespondResponse as ChatRespondResponse,
224
248
  type ChatStreamResponse as ChatStreamResponse,
225
- type ChatUiStreamResponse as ChatUiStreamResponse,
226
249
  type ChatCreateParams as ChatCreateParams,
227
250
  type ChatReplyToQuestionParams as ChatReplyToQuestionParams,
228
251
  type ChatRespondParams as ChatRespondParams,
229
252
  type ChatSendMessageParams as ChatSendMessageParams,
230
253
  type ChatStreamParams as ChatStreamParams,
231
- type ChatUiStreamParams as ChatUiStreamParams,
232
254
  };
233
255
  }
@@ -4,11 +4,21 @@ import { APIResource } from '../../../core/resource';
4
4
  import { APIPromise } from '../../../core/api-promise';
5
5
  import { RequestOptions } from '../../../internal/request-options';
6
6
 
7
+ /**
8
+ * Create, manage, and execute AI agents with tool access, sandbox environments, and async run workflows
9
+ */
7
10
  export class Execute extends APIResource {
8
11
  /**
9
12
  * Creates an ephemeral agent and immediately executes a run. Returns the run ID
10
13
  * for polling status and results. This is the fastest way to run an agent without
11
14
  * managing agent lifecycle.
15
+ *
16
+ * **Ephemeral agent lifecycle:** The agent created by this endpoint is
17
+ * automatically soft-deleted and its scoped API key revoked when the run completes
18
+ * (whether it succeeds, fails, or times out). Ephemeral agents do not appear in
19
+ * GET /agent/v1/agents listings. The returned agentId is valid only for the
20
+ * duration of the run — do not store it for reuse. For persistent, reusable
21
+ * agents, use POST /agent/v1/agents instead.
12
22
  */
13
23
  create(body: ExecuteCreateParams, options?: RequestOptions): APIPromise<ExecuteCreateResponse> {
14
24
  return this._client.post('/agent/v1/execute', { body, ...options });
@@ -17,7 +27,8 @@ export class Execute extends APIResource {
17
27
 
18
28
  export interface ExecuteCreateResponse {
19
29
  /**
20
- * Ephemeral agent ID (auto-created)
30
+ * Ephemeral agent ID (auto-created). This agent is soft-deleted when the run
31
+ * completes and should not be stored for reuse.
21
32
  */
22
33
  agentId?: string;
23
34
 
@@ -38,12 +49,14 @@ export interface ExecuteCreateParams {
38
49
  prompt: string;
39
50
 
40
51
  /**
41
- * Denylist of tools the agent cannot use
52
+ * Denylist of tools the agent cannot use. Mutually exclusive with enabledTools —
53
+ * set one or the other, not both.
42
54
  */
43
55
  disabledTools?: Array<string> | null;
44
56
 
45
57
  /**
46
- * Allowlist of tools the agent can use
58
+ * Allowlist of tools the agent can use. Mutually exclusive with disabledTools —
59
+ * set one or the other, not both.
47
60
  */
48
61
  enabledTools?: Array<string> | null;
49
62
 
@@ -9,6 +9,7 @@ export {
9
9
  type AgentDeleteResponse,
10
10
  type AgentCreateParams,
11
11
  type AgentUpdateParams,
12
+ type AgentListParams,
12
13
  } from './agents';
13
14
  export {
14
15
  Chat,
@@ -17,18 +18,17 @@ export {
17
18
  type ChatCancelResponse,
18
19
  type ChatRespondResponse,
19
20
  type ChatStreamResponse,
20
- type ChatUiStreamResponse,
21
21
  type ChatCreateParams,
22
22
  type ChatReplyToQuestionParams,
23
23
  type ChatRespondParams,
24
24
  type ChatSendMessageParams,
25
25
  type ChatStreamParams,
26
- type ChatUiStreamParams,
27
26
  } from './chat';
28
27
  export { Execute, type ExecuteCreateResponse, type ExecuteCreateParams } from './execute';
29
28
  export {
30
29
  Run,
31
30
  type RunCreateResponse,
31
+ type RunListResponse,
32
32
  type RunCancelResponse,
33
33
  type RunEventsResponse,
34
34
  type RunExecResponse,
@@ -36,6 +36,7 @@ export {
36
36
  type RunGetStatusResponse,
37
37
  type RunWatchResponse,
38
38
  type RunCreateParams,
39
+ type RunListParams,
39
40
  type RunEventsParams,
40
41
  type RunWatchParams,
41
42
  } from './run';
@@ -7,6 +7,9 @@ import { buildHeaders } from '../../../internal/headers';
7
7
  import { RequestOptions } from '../../../internal/request-options';
8
8
  import { path } from '../../../internal/utils/path';
9
9
 
10
+ /**
11
+ * Create, manage, and execute AI agents with tool access, sandbox environments, and async run workflows
12
+ */
10
13
  export class Run extends APIResource {
11
14
  /**
12
15
  * Creates a run in queued state. Call POST /agent/v1/run/:id/exec to start
@@ -16,6 +19,14 @@ export class Run extends APIResource {
16
19
  return this._client.post('/agent/v1/run', { body, ...options });
17
20
  }
18
21
 
22
+ /**
23
+ * Lists agent runs for the authenticated organization. Supports filtering by
24
+ * agent, status, and cursor-based pagination.
25
+ */
26
+ list(query: RunListParams | null | undefined = {}, options?: RequestOptions): APIPromise<RunListResponse> {
27
+ return this._client.get('/agent/v1/run', { query, ...options });
28
+ }
29
+
19
30
  /**
20
31
  * Cancels a running or queued run. Idempotent — cancelling a finished run returns
21
32
  * its current status.
@@ -85,6 +96,40 @@ export interface RunCreateResponse {
85
96
  status?: 'queued';
86
97
  }
87
98
 
99
+ export interface RunListResponse {
100
+ hasMore?: boolean;
101
+
102
+ /**
103
+ * Pass as cursor to fetch the next page
104
+ */
105
+ nextCursor?: string | null;
106
+
107
+ runs?: Array<RunListResponse.Run>;
108
+ }
109
+
110
+ export namespace RunListResponse {
111
+ export interface Run {
112
+ id?: string;
113
+
114
+ agentId?: string;
115
+
116
+ completedAt?: string | null;
117
+
118
+ createdAt?: string;
119
+
120
+ model?: string | null;
121
+
122
+ /**
123
+ * Truncated to first 200 characters
124
+ */
125
+ prompt?: string;
126
+
127
+ startedAt?: string | null;
128
+
129
+ status?: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
130
+ }
131
+ }
132
+
88
133
  export interface RunCancelResponse {
89
134
  id?: string;
90
135
 
@@ -311,6 +356,13 @@ export interface RunCreateParams {
311
356
  */
312
357
  prompt: string;
313
358
 
359
+ /**
360
+ * HTTPS callback URL to receive a notification when the run completes. Registered
361
+ * atomically with the run — eliminates the race condition of calling /watch after
362
+ * /exec. Additional watchers can still be added via POST /run/:id/watch.
363
+ */
364
+ callbackUrl?: string | null;
365
+
314
366
  /**
315
367
  * Additional guidance for this run
316
368
  */
@@ -328,6 +380,29 @@ export interface RunCreateParams {
328
380
  objectIds?: Array<string> | null;
329
381
  }
330
382
 
383
+ export interface RunListParams {
384
+ /**
385
+ * Filter by agent ID
386
+ */
387
+ agentId?: string;
388
+
389
+ /**
390
+ * Pagination cursor (run ID from previous page). Returns runs created before this
391
+ * run.
392
+ */
393
+ cursor?: string;
394
+
395
+ /**
396
+ * Maximum number of runs to return (default 50, max 250)
397
+ */
398
+ limit?: number;
399
+
400
+ /**
401
+ * Filter by run status
402
+ */
403
+ status?: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
404
+ }
405
+
331
406
  export interface RunEventsParams {
332
407
  /**
333
408
  * Replay events after this sequence number
@@ -345,6 +420,7 @@ export interface RunWatchParams {
345
420
  export declare namespace Run {
346
421
  export {
347
422
  type RunCreateResponse as RunCreateResponse,
423
+ type RunListResponse as RunListResponse,
348
424
  type RunCancelResponse as RunCancelResponse,
349
425
  type RunEventsResponse as RunEventsResponse,
350
426
  type RunExecResponse as RunExecResponse,
@@ -352,6 +428,7 @@ export declare namespace Run {
352
428
  type RunGetStatusResponse as RunGetStatusResponse,
353
429
  type RunWatchResponse as RunWatchResponse,
354
430
  type RunCreateParams as RunCreateParams,
431
+ type RunListParams as RunListParams,
355
432
  type RunEventsParams as RunEventsParams,
356
433
  type RunWatchParams as RunWatchParams,
357
434
  };
@@ -6,6 +6,7 @@ import {
6
6
  AgentCreateParams,
7
7
  AgentCreateResponse,
8
8
  AgentDeleteResponse,
9
+ AgentListParams,
9
10
  AgentListResponse,
10
11
  AgentRetrieveResponse,
11
12
  AgentUpdateParams,
@@ -25,8 +26,6 @@ import {
25
26
  ChatSendMessageParams,
26
27
  ChatStreamParams,
27
28
  ChatStreamResponse,
28
- ChatUiStreamParams,
29
- ChatUiStreamResponse,
30
29
  } from './chat';
31
30
  import * as ExecuteAPI from './execute';
32
31
  import { Execute, ExecuteCreateParams, ExecuteCreateResponse } from './execute';
@@ -41,6 +40,8 @@ import {
41
40
  RunExecResponse,
42
41
  RunGetDetailsResponse,
43
42
  RunGetStatusResponse,
43
+ RunListParams,
44
+ RunListResponse,
44
45
  RunWatchParams,
45
46
  RunWatchResponse,
46
47
  } from './run';
@@ -67,11 +68,13 @@ export declare namespace V1 {
67
68
  type AgentDeleteResponse as AgentDeleteResponse,
68
69
  type AgentCreateParams as AgentCreateParams,
69
70
  type AgentUpdateParams as AgentUpdateParams,
71
+ type AgentListParams as AgentListParams,
70
72
  };
71
73
 
72
74
  export {
73
75
  Run as Run,
74
76
  type RunCreateResponse as RunCreateResponse,
77
+ type RunListResponse as RunListResponse,
75
78
  type RunCancelResponse as RunCancelResponse,
76
79
  type RunEventsResponse as RunEventsResponse,
77
80
  type RunExecResponse as RunExecResponse,
@@ -79,6 +82,7 @@ export declare namespace V1 {
79
82
  type RunGetStatusResponse as RunGetStatusResponse,
80
83
  type RunWatchResponse as RunWatchResponse,
81
84
  type RunCreateParams as RunCreateParams,
85
+ type RunListParams as RunListParams,
82
86
  type RunEventsParams as RunEventsParams,
83
87
  type RunWatchParams as RunWatchParams,
84
88
  };
@@ -96,12 +100,10 @@ export declare namespace V1 {
96
100
  type ChatCancelResponse as ChatCancelResponse,
97
101
  type ChatRespondResponse as ChatRespondResponse,
98
102
  type ChatStreamResponse as ChatStreamResponse,
99
- type ChatUiStreamResponse as ChatUiStreamResponse,
100
103
  type ChatCreateParams as ChatCreateParams,
101
104
  type ChatReplyToQuestionParams as ChatReplyToQuestionParams,
102
105
  type ChatRespondParams as ChatRespondParams,
103
106
  type ChatSendMessageParams as ChatSendMessageParams,
104
107
  type ChatStreamParams as ChatStreamParams,
105
- type ChatUiStreamParams as ChatUiStreamParams,
106
108
  };
107
109
  }