@nimble-way/nimble-js 0.17.0 → 0.19.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 (86) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.json +1 -1
  3. package/resources/agent.d.mts +17 -13
  4. package/resources/agent.d.mts.map +1 -1
  5. package/resources/agent.d.ts +17 -13
  6. package/resources/agent.d.ts.map +1 -1
  7. package/resources/batches.d.mts +11 -7
  8. package/resources/batches.d.mts.map +1 -1
  9. package/resources/batches.d.ts +11 -7
  10. package/resources/batches.d.ts.map +1 -1
  11. package/resources/crawl.d.mts +11 -1
  12. package/resources/crawl.d.mts.map +1 -1
  13. package/resources/crawl.d.ts +11 -1
  14. package/resources/crawl.d.ts.map +1 -1
  15. package/resources/jobs/jobs.d.mts +447 -0
  16. package/resources/jobs/jobs.d.mts.map +1 -1
  17. package/resources/jobs/jobs.d.ts +447 -0
  18. package/resources/jobs/jobs.d.ts.map +1 -1
  19. package/resources/jobs/jobs.js.map +1 -1
  20. package/resources/jobs/jobs.mjs.map +1 -1
  21. package/resources/jobs/runs/artifacts.d.mts +67 -0
  22. package/resources/jobs/runs/artifacts.d.mts.map +1 -1
  23. package/resources/jobs/runs/artifacts.d.ts +67 -0
  24. package/resources/jobs/runs/artifacts.d.ts.map +1 -1
  25. package/resources/jobs/runs/runs.d.mts +139 -0
  26. package/resources/jobs/runs/runs.d.mts.map +1 -1
  27. package/resources/jobs/runs/runs.d.ts +139 -0
  28. package/resources/jobs/runs/runs.d.ts.map +1 -1
  29. package/resources/jobs/runs/runs.js.map +1 -1
  30. package/resources/jobs/runs/runs.mjs.map +1 -1
  31. package/resources/media.d.mts +11 -7
  32. package/resources/media.d.mts.map +1 -1
  33. package/resources/media.d.ts +11 -7
  34. package/resources/media.d.ts.map +1 -1
  35. package/resources/serp.d.mts +22 -14
  36. package/resources/serp.d.mts.map +1 -1
  37. package/resources/serp.d.ts +22 -14
  38. package/resources/serp.d.ts.map +1 -1
  39. package/resources/task-agent/runs.d.mts +332 -69
  40. package/resources/task-agent/runs.d.mts.map +1 -1
  41. package/resources/task-agent/runs.d.ts +332 -69
  42. package/resources/task-agent/runs.d.ts.map +1 -1
  43. package/resources/task-agent/runs.js +21 -6
  44. package/resources/task-agent/runs.js.map +1 -1
  45. package/resources/task-agent/runs.mjs +21 -6
  46. package/resources/task-agent/runs.mjs.map +1 -1
  47. package/resources/task-agent/task-agent.d.mts +131 -33
  48. package/resources/task-agent/task-agent.d.mts.map +1 -1
  49. package/resources/task-agent/task-agent.d.ts +131 -33
  50. package/resources/task-agent/task-agent.d.ts.map +1 -1
  51. package/resources/task-agent/task-agent.js +12 -14
  52. package/resources/task-agent/task-agent.js.map +1 -1
  53. package/resources/task-agent/task-agent.mjs +12 -14
  54. package/resources/task-agent/task-agent.mjs.map +1 -1
  55. package/resources/task-agent/templates.d.mts +15 -6
  56. package/resources/task-agent/templates.d.mts.map +1 -1
  57. package/resources/task-agent/templates.d.ts +15 -6
  58. package/resources/task-agent/templates.d.ts.map +1 -1
  59. package/resources/task-agent/templates.js +2 -2
  60. package/resources/task-agent/templates.mjs +2 -2
  61. package/resources/tasks.d.mts +22 -14
  62. package/resources/tasks.d.mts.map +1 -1
  63. package/resources/tasks.d.ts +22 -14
  64. package/resources/tasks.d.ts.map +1 -1
  65. package/resources/top-level.d.mts +77 -20
  66. package/resources/top-level.d.mts.map +1 -1
  67. package/resources/top-level.d.ts +77 -20
  68. package/resources/top-level.d.ts.map +1 -1
  69. package/src/resources/agent.ts +20 -15
  70. package/src/resources/batches.ts +12 -7
  71. package/src/resources/crawl.ts +21 -1
  72. package/src/resources/jobs/jobs.ts +447 -0
  73. package/src/resources/jobs/runs/artifacts.ts +67 -0
  74. package/src/resources/jobs/runs/runs.ts +139 -0
  75. package/src/resources/media.ts +12 -7
  76. package/src/resources/serp.ts +24 -14
  77. package/src/resources/task-agent/runs.ts +370 -78
  78. package/src/resources/task-agent/task-agent.ts +141 -47
  79. package/src/resources/task-agent/templates.ts +16 -7
  80. package/src/resources/tasks.ts +24 -14
  81. package/src/resources/top-level.ts +118 -20
  82. package/src/version.ts +1 -1
  83. package/version.d.mts +1 -1
  84. package/version.d.ts +1 -1
  85. package/version.js +1 -1
  86. package/version.mjs +1 -1
@@ -8,7 +8,10 @@ import { path } from '../../internal/utils/path';
8
8
 
9
9
  export class Runs extends APIResource {
10
10
  /**
11
- * List task runs for the caller's workspace and the given agent, newest first.
11
+ * List runs for this instance.
12
+ *
13
+ * `status` accepts a lowercase `TaskRunStatusValue` (e.g. "completed") or a
14
+ * comma-separated list of them (e.g. "queued,running").
12
15
  */
13
16
  list(
14
17
  agentID: string,
@@ -20,6 +23,9 @@ export class Runs extends APIResource {
20
23
 
21
24
  /**
22
25
  * Cancel an in-progress or queued run.
26
+ *
27
+ * Verb is POST + `/cancel` action segment per the AGENTS-1666 spec (replaces the
28
+ * old `DELETE …/runs/{run_id}`).
23
29
  */
24
30
  cancel(runID: string, params: RunCancelParams, options?: RequestOptions): APIPromise<void> {
25
31
  const { agent_id } = params;
@@ -30,7 +36,11 @@ export class Runs extends APIResource {
30
36
  }
31
37
 
32
38
  /**
33
- * Poll run status. Repeat until status is 'completed', 'failed', or 'cancelled'.
39
+ * Fetch a run by id, scoped to the instance.
40
+ *
41
+ * A run resolves only when (run_id, agent_id) match — otherwise 404. This means a
42
+ * stale URL with a swapped agent_id won't leak runs across instances even if the
43
+ * run_id is real.
34
44
  */
35
45
  get(runID: string, params: RunGetParams, options?: RequestOptions): APIPromise<RunGetResponse> {
36
46
  const { agent_id } = params;
@@ -38,8 +48,14 @@ export class Runs extends APIResource {
38
48
  }
39
49
 
40
50
  /**
41
- * Fetch the result for a terminal run. Returns 408 if still active, 422 with
42
- * `AgentRunFailedResult` if failed.
51
+ * Fetch the result for a terminal run on this instance.
52
+ *
53
+ * Mirrors the previous flat `GET /tasks/runs/:run_id/result` semantics:
54
+ *
55
+ * - 404 when the run doesn't belong to the agent.
56
+ * - 408 when the run is still active.
57
+ * - 422 (with TaskRunFailedResult body) when the run failed or was cancelled.
58
+ * - 200 (with TaskRunResult body) on success.
43
59
  */
44
60
  getResult(
45
61
  runID: string,
@@ -51,8 +67,7 @@ export class Runs extends APIResource {
51
67
  }
52
68
 
53
69
  /**
54
- * Server-Sent Events stream of real-time progress events for a run. The run must
55
- * have been created with `enable_events=true`.
70
+ * SSE stream of real-time progress events for a run on this instance.
56
71
  */
57
72
  streamEvents(runID: string, params: RunStreamEventsParams, options?: RequestOptions): APIPromise<unknown> {
58
73
  const { agent_id } = params;
@@ -60,18 +75,35 @@ export class Runs extends APIResource {
60
75
  }
61
76
  }
62
77
 
63
- export type RunListResponse = Array<RunListResponse.RunListResponseItem>;
78
+ /**
79
+ * Paginated list of task runs for GET /tasks/runs.
80
+ */
81
+ export interface RunListResponse {
82
+ items: Array<RunListResponse.Item>;
83
+
84
+ total: number;
85
+
86
+ limit?: number;
87
+
88
+ offset?: number;
89
+ }
64
90
 
65
91
  export namespace RunListResponse {
66
- export interface RunListResponseItem {
92
+ /**
93
+ * Task run status returned by list/create/get endpoints.
94
+ */
95
+ export interface Item {
67
96
  /**
68
- * Run identifier.
97
+ * Run identifier, format "task*run*{uuid}".
69
98
  */
70
99
  id: string;
71
100
 
72
101
  created_at: string;
73
102
 
74
- effort: 'quickest' | 'quick' | 'research' | 'pro' | 'max';
103
+ /**
104
+ * Canonical effort tier names for the research graph.
105
+ */
106
+ effort: 'low' | 'medium' | 'high' | 'x-high' | 'max';
75
107
 
76
108
  /**
77
109
  * Interaction ID — pass as previous_interaction_id to reuse context.
@@ -83,25 +115,40 @@ export namespace RunListResponse {
83
115
  */
84
116
  is_active: boolean;
85
117
 
118
+ /**
119
+ * Lowercase status values used in API responses (distinct from the DB-level
120
+ * TaskRunStatus enum).
121
+ */
86
122
  status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
87
123
 
124
+ /**
125
+ * Web Search Agent instance this run belongs to. Every task run is agent-bound
126
+ * (see AGENTS-1666). Use this to build the nested URL
127
+ * /api/v2/web-search-agents/{web_search_agent_id}/runs/{id}.
128
+ */
129
+ web_search_agent_id: string;
130
+
88
131
  completed_at?: string | null;
89
132
 
90
- error?: RunListResponseItem.Error | null;
133
+ /**
134
+ * Error detail for a failed run.
135
+ */
136
+ error?: Item.Error | null;
91
137
 
138
+ /**
139
+ * Original user prompt before enrichment. Populated for Web Search Agent runs.
140
+ */
92
141
  prompt?: string | null;
93
142
 
94
143
  started_at?: string | null;
95
144
 
96
- /**
97
- * Web Search Agent instance this run belongs to.
98
- */
99
- web_search_agent_id?: string | null;
100
-
101
145
  workspace_id?: string | null;
102
146
  }
103
147
 
104
- export namespace RunListResponseItem {
148
+ export namespace Item {
149
+ /**
150
+ * Error detail for a failed run.
151
+ */
105
152
  export interface Error {
106
153
  /**
107
154
  * Human-readable error description.
@@ -116,15 +163,21 @@ export namespace RunListResponse {
116
163
  }
117
164
  }
118
165
 
166
+ /**
167
+ * Task run status returned by list/create/get endpoints.
168
+ */
119
169
  export interface RunGetResponse {
120
170
  /**
121
- * Run identifier.
171
+ * Run identifier, format "task*run*{uuid}".
122
172
  */
123
173
  id: string;
124
174
 
125
175
  created_at: string;
126
176
 
127
- effort: 'quickest' | 'quick' | 'research' | 'pro' | 'max';
177
+ /**
178
+ * Canonical effort tier names for the research graph.
179
+ */
180
+ effort: 'low' | 'medium' | 'high' | 'x-high' | 'max';
128
181
 
129
182
  /**
130
183
  * Interaction ID — pass as previous_interaction_id to reuse context.
@@ -136,25 +189,40 @@ export interface RunGetResponse {
136
189
  */
137
190
  is_active: boolean;
138
191
 
192
+ /**
193
+ * Lowercase status values used in API responses (distinct from the DB-level
194
+ * TaskRunStatus enum).
195
+ */
139
196
  status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
140
197
 
198
+ /**
199
+ * Web Search Agent instance this run belongs to. Every task run is agent-bound
200
+ * (see AGENTS-1666). Use this to build the nested URL
201
+ * /api/v2/web-search-agents/{web_search_agent_id}/runs/{id}.
202
+ */
203
+ web_search_agent_id: string;
204
+
141
205
  completed_at?: string | null;
142
206
 
207
+ /**
208
+ * Error detail for a failed run.
209
+ */
143
210
  error?: RunGetResponse.Error | null;
144
211
 
212
+ /**
213
+ * Original user prompt before enrichment. Populated for Web Search Agent runs.
214
+ */
145
215
  prompt?: string | null;
146
216
 
147
217
  started_at?: string | null;
148
218
 
149
- /**
150
- * Web Search Agent instance this run belongs to.
151
- */
152
- web_search_agent_id?: string | null;
153
-
154
219
  workspace_id?: string | null;
155
220
  }
156
221
 
157
222
  export namespace RunGetResponse {
223
+ /**
224
+ * Error detail for a failed run.
225
+ */
158
226
  export interface Error {
159
227
  /**
160
228
  * Human-readable error description.
@@ -168,98 +236,267 @@ export namespace RunGetResponse {
168
236
  }
169
237
  }
170
238
 
239
+ /**
240
+ * Response for GET /tasks/runs/{run_id}/result — status 'completed'.
241
+ */
171
242
  export type RunGetResultResponse =
172
- | RunGetResultResponse.AgentRunResult
173
- | RunGetResultResponse.AgentRunFailedResult;
243
+ | RunGetResultResponse.TaskRunResult
244
+ | RunGetResultResponse.TaskRunFailedResult;
174
245
 
175
246
  export namespace RunGetResultResponse {
176
- export interface AgentRunResult {
177
- output: AgentRunResult.AgentRunTextOutput | AgentRunResult.AgentRunJsonOutput;
247
+ /**
248
+ * Response for GET /tasks/runs/{run_id}/result — status 'completed'.
249
+ */
250
+ export interface TaskRunResult {
251
+ /**
252
+ * Output from the completed task.
253
+ */
254
+ output: TaskRunResult.TaskRunTextOutput | TaskRunResult.TaskRunJsonOutput;
178
255
 
179
- run: AgentRunResult.Run;
256
+ /**
257
+ * Task run object with status 'completed'.
258
+ */
259
+ run: TaskRunResult.Run;
180
260
  }
181
261
 
182
- export namespace AgentRunResult {
183
- export interface AgentRunTextOutput {
262
+ export namespace TaskRunResult {
263
+ /**
264
+ * Text output from a completed task.
265
+ */
266
+ export interface TaskRunTextOutput {
184
267
  /**
185
268
  * The final prose answer.
186
269
  */
187
270
  content: string;
188
271
 
189
- basis?: Array<AgentRunTextOutput.Basi>;
272
+ trust: TaskRunTextOutput.Trust;
190
273
 
191
274
  type?: 'text';
192
275
  }
193
276
 
194
- export namespace AgentRunTextOutput {
195
- export interface Basi {
196
- field: string;
277
+ export namespace TaskRunTextOutput {
278
+ export interface Trust {
279
+ claims: Array<Trust.Claim>;
197
280
 
198
- citations?: Array<Basi.Citation>;
281
+ confidence: 'high' | 'medium' | 'low';
199
282
 
200
- confidence?: 'high' | 'medium' | 'low' | null;
283
+ reasoning: string;
201
284
 
202
- reasoning?: string;
285
+ sources: Array<Trust.Source>;
203
286
  }
204
287
 
205
- export namespace Basi {
206
- export interface Citation {
207
- url: string;
288
+ export namespace Trust {
289
+ export interface Claim {
290
+ callout: number;
208
291
 
209
- excerpts?: Array<string> | null;
292
+ citations: Array<Claim.Citation>;
210
293
 
211
- index?: number | null;
294
+ confidence: 'high' | 'medium' | 'low';
212
295
 
213
- title?: string | null;
296
+ reasoning: string;
297
+ }
298
+
299
+ export namespace Claim {
300
+ export interface Citation {
301
+ url: string;
302
+
303
+ excerpts?: Array<string> | null;
304
+
305
+ extract_template_name?: string | null;
306
+
307
+ /**
308
+ * What _kind_ of source this is (classified by the compress LLM), independent of
309
+ * TrustSourceType (how authoritative it is for a specific claim). Deliberately
310
+ * uses "official" rather than "primary" so the two axes can never collide.
311
+ *
312
+ * Also doubles as the sub-question's `source_intent` (what kind of source a
313
+ * question _needs_) — the two concepts overlap enough that a single enum lets
314
+ * `classify_source_importance` compare "what we got" against "what we asked for"
315
+ * directly.
316
+ */
317
+ source_category?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
318
+
319
+ /**
320
+ * What _kind_ of source this is (classified by the compress LLM), independent of
321
+ * TrustSourceType (how authoritative it is for a specific claim). Deliberately
322
+ * uses "official" rather than "primary" so the two axes can never collide.
323
+ *
324
+ * Also doubles as the sub-question's `source_intent` (what kind of source a
325
+ * question _needs_) — the two concepts overlap enough that a single enum lets
326
+ * `classify_source_importance` compare "what we got" against "what we asked for"
327
+ * directly.
328
+ */
329
+ source_intent?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
330
+
331
+ source_type?: 'primary' | 'secondary' | null;
332
+
333
+ title?: string | null;
334
+ }
335
+ }
336
+
337
+ export interface Source {
338
+ type: 'primary' | 'secondary';
339
+
340
+ url: string;
214
341
 
215
- web_search_agent?: string | null;
342
+ extract_template_name?: string | null;
343
+
344
+ /**
345
+ * What _kind_ of source this is (classified by the compress LLM), independent of
346
+ * TrustSourceType (how authoritative it is for a specific claim). Deliberately
347
+ * uses "official" rather than "primary" so the two axes can never collide.
348
+ *
349
+ * Also doubles as the sub-question's `source_intent` (what kind of source a
350
+ * question _needs_) — the two concepts overlap enough that a single enum lets
351
+ * `classify_source_importance` compare "what we got" against "what we asked for"
352
+ * directly.
353
+ */
354
+ source_category?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
355
+
356
+ /**
357
+ * What _kind_ of source this is (classified by the compress LLM), independent of
358
+ * TrustSourceType (how authoritative it is for a specific claim). Deliberately
359
+ * uses "official" rather than "primary" so the two axes can never collide.
360
+ *
361
+ * Also doubles as the sub-question's `source_intent` (what kind of source a
362
+ * question _needs_) — the two concepts overlap enough that a single enum lets
363
+ * `classify_source_importance` compare "what we got" against "what we asked for"
364
+ * directly.
365
+ */
366
+ source_intent?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
367
+
368
+ title?: string | null;
216
369
  }
217
370
  }
218
371
  }
219
372
 
220
- export interface AgentRunJsonOutput {
373
+ /**
374
+ * Structured JSON output from a completed task, produced when
375
+ * task_spec.output_schema.type is 'json'.
376
+ */
377
+ export interface TaskRunJsonOutput {
378
+ /**
379
+ * Data conforming to the caller-supplied JSON schema. A dict for object schemas; a
380
+ * list for array schemas.
381
+ */
221
382
  content: { [key: string]: unknown } | Array<unknown>;
222
383
 
223
- basis?: Array<AgentRunJsonOutput.Basi>;
384
+ trust: TaskRunJsonOutput.Trust;
224
385
 
225
386
  type?: 'json';
226
387
  }
227
388
 
228
- export namespace AgentRunJsonOutput {
229
- export interface Basi {
230
- field: string;
389
+ export namespace TaskRunJsonOutput {
390
+ export interface Trust {
391
+ claims: Array<Trust.Claim>;
231
392
 
232
- citations?: Array<Basi.Citation>;
393
+ confidence: 'high' | 'medium' | 'low';
233
394
 
234
- confidence?: 'high' | 'medium' | 'low' | null;
395
+ reasoning: string;
235
396
 
236
- reasoning?: string;
397
+ sources: Array<Trust.Source>;
237
398
  }
238
399
 
239
- export namespace Basi {
240
- export interface Citation {
241
- url: string;
400
+ export namespace Trust {
401
+ export interface Claim {
402
+ citations: Array<Claim.Citation>;
242
403
 
243
- excerpts?: Array<string> | null;
404
+ confidence: 'high' | 'medium' | 'low';
244
405
 
245
- index?: number | null;
406
+ path: string;
246
407
 
247
- title?: string | null;
408
+ reasoning: string;
409
+ }
248
410
 
249
- web_search_agent?: string | null;
411
+ export namespace Claim {
412
+ export interface Citation {
413
+ url: string;
414
+
415
+ excerpts?: Array<string> | null;
416
+
417
+ extract_template_name?: string | null;
418
+
419
+ /**
420
+ * What _kind_ of source this is (classified by the compress LLM), independent of
421
+ * TrustSourceType (how authoritative it is for a specific claim). Deliberately
422
+ * uses "official" rather than "primary" so the two axes can never collide.
423
+ *
424
+ * Also doubles as the sub-question's `source_intent` (what kind of source a
425
+ * question _needs_) — the two concepts overlap enough that a single enum lets
426
+ * `classify_source_importance` compare "what we got" against "what we asked for"
427
+ * directly.
428
+ */
429
+ source_category?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
430
+
431
+ /**
432
+ * What _kind_ of source this is (classified by the compress LLM), independent of
433
+ * TrustSourceType (how authoritative it is for a specific claim). Deliberately
434
+ * uses "official" rather than "primary" so the two axes can never collide.
435
+ *
436
+ * Also doubles as the sub-question's `source_intent` (what kind of source a
437
+ * question _needs_) — the two concepts overlap enough that a single enum lets
438
+ * `classify_source_importance` compare "what we got" against "what we asked for"
439
+ * directly.
440
+ */
441
+ source_intent?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
442
+
443
+ source_type?: 'primary' | 'secondary' | null;
444
+
445
+ title?: string | null;
446
+ }
447
+ }
448
+
449
+ export interface Source {
450
+ type: 'primary' | 'secondary';
451
+
452
+ url: string;
453
+
454
+ extract_template_name?: string | null;
455
+
456
+ /**
457
+ * What _kind_ of source this is (classified by the compress LLM), independent of
458
+ * TrustSourceType (how authoritative it is for a specific claim). Deliberately
459
+ * uses "official" rather than "primary" so the two axes can never collide.
460
+ *
461
+ * Also doubles as the sub-question's `source_intent` (what kind of source a
462
+ * question _needs_) — the two concepts overlap enough that a single enum lets
463
+ * `classify_source_importance` compare "what we got" against "what we asked for"
464
+ * directly.
465
+ */
466
+ source_category?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
467
+
468
+ /**
469
+ * What _kind_ of source this is (classified by the compress LLM), independent of
470
+ * TrustSourceType (how authoritative it is for a specific claim). Deliberately
471
+ * uses "official" rather than "primary" so the two axes can never collide.
472
+ *
473
+ * Also doubles as the sub-question's `source_intent` (what kind of source a
474
+ * question _needs_) — the two concepts overlap enough that a single enum lets
475
+ * `classify_source_importance` compare "what we got" against "what we asked for"
476
+ * directly.
477
+ */
478
+ source_intent?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
479
+
480
+ title?: string | null;
250
481
  }
251
482
  }
252
483
  }
253
484
 
485
+ /**
486
+ * Task run object with status 'completed'.
487
+ */
254
488
  export interface Run {
255
489
  /**
256
- * Run identifier.
490
+ * Run identifier, format "task*run*{uuid}".
257
491
  */
258
492
  id: string;
259
493
 
260
494
  created_at: string;
261
495
 
262
- effort: 'quickest' | 'quick' | 'research' | 'pro' | 'max';
496
+ /**
497
+ * Canonical effort tier names for the research graph.
498
+ */
499
+ effort: 'low' | 'medium' | 'high' | 'x-high' | 'max';
263
500
 
264
501
  /**
265
502
  * Interaction ID — pass as previous_interaction_id to reuse context.
@@ -271,25 +508,40 @@ export namespace RunGetResultResponse {
271
508
  */
272
509
  is_active: boolean;
273
510
 
511
+ /**
512
+ * Lowercase status values used in API responses (distinct from the DB-level
513
+ * TaskRunStatus enum).
514
+ */
274
515
  status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
275
516
 
517
+ /**
518
+ * Web Search Agent instance this run belongs to. Every task run is agent-bound
519
+ * (see AGENTS-1666). Use this to build the nested URL
520
+ * /api/v2/web-search-agents/{web_search_agent_id}/runs/{id}.
521
+ */
522
+ web_search_agent_id: string;
523
+
276
524
  completed_at?: string | null;
277
525
 
526
+ /**
527
+ * Error detail for a failed run.
528
+ */
278
529
  error?: Run.Error | null;
279
530
 
531
+ /**
532
+ * Original user prompt before enrichment. Populated for Web Search Agent runs.
533
+ */
280
534
  prompt?: string | null;
281
535
 
282
536
  started_at?: string | null;
283
537
 
284
- /**
285
- * Web Search Agent instance this run belongs to.
286
- */
287
- web_search_agent_id?: string | null;
288
-
289
538
  workspace_id?: string | null;
290
539
  }
291
540
 
292
541
  export namespace Run {
542
+ /**
543
+ * Error detail for a failed run.
544
+ */
293
545
  export interface Error {
294
546
  /**
295
547
  * Human-readable error description.
@@ -304,13 +556,28 @@ export namespace RunGetResultResponse {
304
556
  }
305
557
  }
306
558
 
307
- export interface AgentRunFailedResult {
308
- error: AgentRunFailedResult.Error;
559
+ /**
560
+ * Response for GET /tasks/runs/{run_id}/result when the run failed.
561
+ *
562
+ * Returned with HTTP 422 so callers can distinguish a failed run from a missing
563
+ * one (404) or an active one (408).
564
+ */
565
+ export interface TaskRunFailedResult {
566
+ /**
567
+ * Structured error detail.
568
+ */
569
+ error: TaskRunFailedResult.Error;
309
570
 
310
- run: AgentRunFailedResult.Run;
571
+ /**
572
+ * Task run object with status 'failed'.
573
+ */
574
+ run: TaskRunFailedResult.Run;
311
575
  }
312
576
 
313
- export namespace AgentRunFailedResult {
577
+ export namespace TaskRunFailedResult {
578
+ /**
579
+ * Structured error detail.
580
+ */
314
581
  export interface Error {
315
582
  /**
316
583
  * Human-readable error description.
@@ -323,15 +590,21 @@ export namespace RunGetResultResponse {
323
590
  ref_id: string;
324
591
  }
325
592
 
593
+ /**
594
+ * Task run object with status 'failed'.
595
+ */
326
596
  export interface Run {
327
597
  /**
328
- * Run identifier.
598
+ * Run identifier, format "task*run*{uuid}".
329
599
  */
330
600
  id: string;
331
601
 
332
602
  created_at: string;
333
603
 
334
- effort: 'quickest' | 'quick' | 'research' | 'pro' | 'max';
604
+ /**
605
+ * Canonical effort tier names for the research graph.
606
+ */
607
+ effort: 'low' | 'medium' | 'high' | 'x-high' | 'max';
335
608
 
336
609
  /**
337
610
  * Interaction ID — pass as previous_interaction_id to reuse context.
@@ -343,25 +616,40 @@ export namespace RunGetResultResponse {
343
616
  */
344
617
  is_active: boolean;
345
618
 
619
+ /**
620
+ * Lowercase status values used in API responses (distinct from the DB-level
621
+ * TaskRunStatus enum).
622
+ */
346
623
  status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
347
624
 
625
+ /**
626
+ * Web Search Agent instance this run belongs to. Every task run is agent-bound
627
+ * (see AGENTS-1666). Use this to build the nested URL
628
+ * /api/v2/web-search-agents/{web_search_agent_id}/runs/{id}.
629
+ */
630
+ web_search_agent_id: string;
631
+
348
632
  completed_at?: string | null;
349
633
 
634
+ /**
635
+ * Error detail for a failed run.
636
+ */
350
637
  error?: Run.Error | null;
351
638
 
639
+ /**
640
+ * Original user prompt before enrichment. Populated for Web Search Agent runs.
641
+ */
352
642
  prompt?: string | null;
353
643
 
354
644
  started_at?: string | null;
355
645
 
356
- /**
357
- * Web Search Agent instance this run belongs to.
358
- */
359
- web_search_agent_id?: string | null;
360
-
361
646
  workspace_id?: string | null;
362
647
  }
363
648
 
364
649
  export namespace Run {
650
+ /**
651
+ * Error detail for a failed run.
652
+ */
365
653
  export interface Error {
366
654
  /**
367
655
  * Human-readable error description.
@@ -383,6 +671,10 @@ export interface RunListParams {
383
671
  limit?: number;
384
672
 
385
673
  offset?: number;
674
+
675
+ q?: string | null;
676
+
677
+ status?: string | null;
386
678
  }
387
679
 
388
680
  export interface RunCancelParams {