@nimble-way/nimble-js 0.18.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 (102) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/agent.d.mts +10 -10
  10. package/resources/agent.d.mts.map +1 -1
  11. package/resources/agent.d.ts +10 -10
  12. package/resources/agent.d.ts.map +1 -1
  13. package/resources/batches.d.mts +5 -5
  14. package/resources/batches.d.mts.map +1 -1
  15. package/resources/batches.d.ts +5 -5
  16. package/resources/batches.d.ts.map +1 -1
  17. package/resources/crawl.d.mts +1 -0
  18. package/resources/crawl.d.mts.map +1 -1
  19. package/resources/crawl.d.ts +1 -0
  20. package/resources/crawl.d.ts.map +1 -1
  21. package/resources/fast-serp.d.mts +305 -0
  22. package/resources/fast-serp.d.mts.map +1 -1
  23. package/resources/fast-serp.d.ts +305 -0
  24. package/resources/fast-serp.d.ts.map +1 -1
  25. package/resources/fast-serp.js +13 -0
  26. package/resources/fast-serp.js.map +1 -1
  27. package/resources/fast-serp.mjs +13 -0
  28. package/resources/fast-serp.mjs.map +1 -1
  29. package/resources/index.d.mts +1 -1
  30. package/resources/index.d.mts.map +1 -1
  31. package/resources/index.d.ts +1 -1
  32. package/resources/index.d.ts.map +1 -1
  33. package/resources/index.js.map +1 -1
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/jobs/jobs.d.mts +18 -0
  36. package/resources/jobs/jobs.d.mts.map +1 -1
  37. package/resources/jobs/jobs.d.ts +18 -0
  38. package/resources/jobs/jobs.d.ts.map +1 -1
  39. package/resources/jobs/jobs.js.map +1 -1
  40. package/resources/jobs/jobs.mjs.map +1 -1
  41. package/resources/jobs/runs/artifacts.d.mts +6 -0
  42. package/resources/jobs/runs/artifacts.d.mts.map +1 -1
  43. package/resources/jobs/runs/artifacts.d.ts +6 -0
  44. package/resources/jobs/runs/artifacts.d.ts.map +1 -1
  45. package/resources/media.d.mts +5 -5
  46. package/resources/media.d.mts.map +1 -1
  47. package/resources/media.d.ts +5 -5
  48. package/resources/media.d.ts.map +1 -1
  49. package/resources/serp.d.mts +10 -10
  50. package/resources/serp.d.mts.map +1 -1
  51. package/resources/serp.d.ts +10 -10
  52. package/resources/serp.d.ts.map +1 -1
  53. package/resources/task-agent/runs.d.mts +286 -63
  54. package/resources/task-agent/runs.d.mts.map +1 -1
  55. package/resources/task-agent/runs.d.ts +286 -63
  56. package/resources/task-agent/runs.d.ts.map +1 -1
  57. package/resources/task-agent/runs.js +21 -6
  58. package/resources/task-agent/runs.js.map +1 -1
  59. package/resources/task-agent/runs.mjs +21 -6
  60. package/resources/task-agent/runs.mjs.map +1 -1
  61. package/resources/task-agent/task-agent.d.mts +131 -33
  62. package/resources/task-agent/task-agent.d.mts.map +1 -1
  63. package/resources/task-agent/task-agent.d.ts +131 -33
  64. package/resources/task-agent/task-agent.d.ts.map +1 -1
  65. package/resources/task-agent/task-agent.js +12 -14
  66. package/resources/task-agent/task-agent.js.map +1 -1
  67. package/resources/task-agent/task-agent.mjs +12 -14
  68. package/resources/task-agent/task-agent.mjs.map +1 -1
  69. package/resources/task-agent/templates.d.mts +15 -6
  70. package/resources/task-agent/templates.d.mts.map +1 -1
  71. package/resources/task-agent/templates.d.ts +15 -6
  72. package/resources/task-agent/templates.d.ts.map +1 -1
  73. package/resources/task-agent/templates.js +2 -2
  74. package/resources/task-agent/templates.mjs +2 -2
  75. package/resources/tasks.d.mts +10 -10
  76. package/resources/tasks.d.mts.map +1 -1
  77. package/resources/tasks.d.ts +10 -10
  78. package/resources/tasks.d.ts.map +1 -1
  79. package/resources/top-level.d.mts +14 -10
  80. package/resources/top-level.d.mts.map +1 -1
  81. package/resources/top-level.d.ts +14 -10
  82. package/resources/top-level.d.ts.map +1 -1
  83. package/src/client.ts +6 -2
  84. package/src/resources/agent.ts +11 -11
  85. package/src/resources/batches.ts +5 -5
  86. package/src/resources/crawl.ts +2 -0
  87. package/src/resources/fast-serp.ts +461 -1
  88. package/src/resources/index.ts +1 -1
  89. package/src/resources/jobs/jobs.ts +18 -0
  90. package/src/resources/jobs/runs/artifacts.ts +6 -0
  91. package/src/resources/media.ts +5 -5
  92. package/src/resources/serp.ts +10 -10
  93. package/src/resources/task-agent/runs.ts +304 -76
  94. package/src/resources/task-agent/task-agent.ts +141 -47
  95. package/src/resources/task-agent/templates.ts +16 -7
  96. package/src/resources/tasks.ts +10 -10
  97. package/src/resources/top-level.ts +18 -10
  98. package/src/version.ts +1 -1
  99. package/version.d.mts +1 -1
  100. package/version.d.ts +1 -1
  101. package/version.js +1 -1
  102. 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,30 +236,45 @@ 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
- trust: AgentRunTextOutput.Trust;
272
+ trust: TaskRunTextOutput.Trust;
190
273
 
191
274
  type?: 'text';
192
275
  }
193
276
 
194
- export namespace AgentRunTextOutput {
277
+ export namespace TaskRunTextOutput {
195
278
  export interface Trust {
196
279
  claims: Array<Trust.Claim>;
197
280
 
@@ -211,8 +294,6 @@ export namespace RunGetResultResponse {
211
294
  confidence: 'high' | 'medium' | 'low';
212
295
 
213
296
  reasoning: string;
214
-
215
- source?: Claim.Source | null;
216
297
  }
217
298
 
218
299
  export namespace Claim {
@@ -223,15 +304,31 @@ export namespace RunGetResultResponse {
223
304
 
224
305
  extract_template_name?: string | null;
225
306
 
226
- title?: string | null;
227
- }
228
-
229
- export interface Source {
230
- type: 'primary' | 'secondary';
231
-
232
- url: string;
233
-
234
- extract_template_name?: string | null;
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;
235
332
 
236
333
  title?: string | null;
237
334
  }
@@ -244,20 +341,52 @@ export namespace RunGetResultResponse {
244
341
 
245
342
  extract_template_name?: string | null;
246
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
+
247
368
  title?: string | null;
248
369
  }
249
370
  }
250
371
  }
251
372
 
252
- 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
+ */
253
382
  content: { [key: string]: unknown } | Array<unknown>;
254
383
 
255
- trust: AgentRunJsonOutput.Trust;
384
+ trust: TaskRunJsonOutput.Trust;
256
385
 
257
386
  type?: 'json';
258
387
  }
259
388
 
260
- export namespace AgentRunJsonOutput {
389
+ export namespace TaskRunJsonOutput {
261
390
  export interface Trust {
262
391
  claims: Array<Trust.Claim>;
263
392
 
@@ -277,8 +406,6 @@ export namespace RunGetResultResponse {
277
406
  path: string;
278
407
 
279
408
  reasoning: string;
280
-
281
- source?: Claim.Source | null;
282
409
  }
283
410
 
284
411
  export namespace Claim {
@@ -289,15 +416,31 @@ export namespace RunGetResultResponse {
289
416
 
290
417
  extract_template_name?: string | null;
291
418
 
292
- title?: string | null;
293
- }
294
-
295
- export interface Source {
296
- type: 'primary' | 'secondary';
297
-
298
- url: string;
299
-
300
- extract_template_name?: string | null;
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;
301
444
 
302
445
  title?: string | null;
303
446
  }
@@ -310,20 +453,50 @@ export namespace RunGetResultResponse {
310
453
 
311
454
  extract_template_name?: string | null;
312
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
+
313
480
  title?: string | null;
314
481
  }
315
482
  }
316
483
  }
317
484
 
485
+ /**
486
+ * Task run object with status 'completed'.
487
+ */
318
488
  export interface Run {
319
489
  /**
320
- * Run identifier.
490
+ * Run identifier, format "task*run*{uuid}".
321
491
  */
322
492
  id: string;
323
493
 
324
494
  created_at: string;
325
495
 
326
- 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';
327
500
 
328
501
  /**
329
502
  * Interaction ID — pass as previous_interaction_id to reuse context.
@@ -335,25 +508,40 @@ export namespace RunGetResultResponse {
335
508
  */
336
509
  is_active: boolean;
337
510
 
511
+ /**
512
+ * Lowercase status values used in API responses (distinct from the DB-level
513
+ * TaskRunStatus enum).
514
+ */
338
515
  status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
339
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
+
340
524
  completed_at?: string | null;
341
525
 
526
+ /**
527
+ * Error detail for a failed run.
528
+ */
342
529
  error?: Run.Error | null;
343
530
 
531
+ /**
532
+ * Original user prompt before enrichment. Populated for Web Search Agent runs.
533
+ */
344
534
  prompt?: string | null;
345
535
 
346
536
  started_at?: string | null;
347
537
 
348
- /**
349
- * Web Search Agent instance this run belongs to.
350
- */
351
- web_search_agent_id?: string | null;
352
-
353
538
  workspace_id?: string | null;
354
539
  }
355
540
 
356
541
  export namespace Run {
542
+ /**
543
+ * Error detail for a failed run.
544
+ */
357
545
  export interface Error {
358
546
  /**
359
547
  * Human-readable error description.
@@ -368,13 +556,28 @@ export namespace RunGetResultResponse {
368
556
  }
369
557
  }
370
558
 
371
- export interface AgentRunFailedResult {
372
- 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;
373
570
 
374
- run: AgentRunFailedResult.Run;
571
+ /**
572
+ * Task run object with status 'failed'.
573
+ */
574
+ run: TaskRunFailedResult.Run;
375
575
  }
376
576
 
377
- export namespace AgentRunFailedResult {
577
+ export namespace TaskRunFailedResult {
578
+ /**
579
+ * Structured error detail.
580
+ */
378
581
  export interface Error {
379
582
  /**
380
583
  * Human-readable error description.
@@ -387,15 +590,21 @@ export namespace RunGetResultResponse {
387
590
  ref_id: string;
388
591
  }
389
592
 
593
+ /**
594
+ * Task run object with status 'failed'.
595
+ */
390
596
  export interface Run {
391
597
  /**
392
- * Run identifier.
598
+ * Run identifier, format "task*run*{uuid}".
393
599
  */
394
600
  id: string;
395
601
 
396
602
  created_at: string;
397
603
 
398
- 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';
399
608
 
400
609
  /**
401
610
  * Interaction ID — pass as previous_interaction_id to reuse context.
@@ -407,25 +616,40 @@ export namespace RunGetResultResponse {
407
616
  */
408
617
  is_active: boolean;
409
618
 
619
+ /**
620
+ * Lowercase status values used in API responses (distinct from the DB-level
621
+ * TaskRunStatus enum).
622
+ */
410
623
  status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
411
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
+
412
632
  completed_at?: string | null;
413
633
 
634
+ /**
635
+ * Error detail for a failed run.
636
+ */
414
637
  error?: Run.Error | null;
415
638
 
639
+ /**
640
+ * Original user prompt before enrichment. Populated for Web Search Agent runs.
641
+ */
416
642
  prompt?: string | null;
417
643
 
418
644
  started_at?: string | null;
419
645
 
420
- /**
421
- * Web Search Agent instance this run belongs to.
422
- */
423
- web_search_agent_id?: string | null;
424
-
425
646
  workspace_id?: string | null;
426
647
  }
427
648
 
428
649
  export namespace Run {
650
+ /**
651
+ * Error detail for a failed run.
652
+ */
429
653
  export interface Error {
430
654
  /**
431
655
  * Human-readable error description.
@@ -447,6 +671,10 @@ export interface RunListParams {
447
671
  limit?: number;
448
672
 
449
673
  offset?: number;
674
+
675
+ q?: string | null;
676
+
677
+ status?: string | null;
450
678
  }
451
679
 
452
680
  export interface RunCancelParams {