@nimble-way/nimble-js 0.19.0 → 1.0.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 (255) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +10 -10
  3. package/client.d.mts +10 -39
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +10 -39
  6. package/client.d.ts.map +1 -1
  7. package/client.js +8 -43
  8. package/client.js.map +1 -1
  9. package/client.mjs +8 -43
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/agents/agents.d.mts +811 -0
  13. package/resources/agents/agents.d.mts.map +1 -0
  14. package/resources/agents/agents.d.ts +811 -0
  15. package/resources/agents/agents.d.ts.map +1 -0
  16. package/resources/agents/agents.js +67 -0
  17. package/resources/agents/agents.js.map +1 -0
  18. package/resources/agents/agents.mjs +62 -0
  19. package/resources/agents/agents.mjs.map +1 -0
  20. package/resources/agents/index.d.mts +4 -0
  21. package/resources/agents/index.d.mts.map +1 -0
  22. package/resources/agents/index.d.ts +4 -0
  23. package/resources/agents/index.d.ts.map +1 -0
  24. package/resources/{task-agent → agents}/index.js +3 -3
  25. package/resources/agents/index.js.map +1 -0
  26. package/resources/{task-agent → agents}/index.mjs +1 -1
  27. package/resources/agents/index.mjs.map +1 -0
  28. package/resources/{task-agent → agents}/runs.d.mts +413 -128
  29. package/resources/agents/runs.d.mts.map +1 -0
  30. package/resources/{task-agent → agents}/runs.d.ts +413 -128
  31. package/resources/agents/runs.d.ts.map +1 -0
  32. package/resources/agents/runs.js +63 -0
  33. package/resources/agents/runs.js.map +1 -0
  34. package/resources/agents/runs.mjs +59 -0
  35. package/resources/agents/runs.mjs.map +1 -0
  36. package/resources/agents/templates.d.mts +258 -0
  37. package/resources/agents/templates.d.mts.map +1 -0
  38. package/resources/agents/templates.d.ts +258 -0
  39. package/resources/agents/templates.d.ts.map +1 -0
  40. package/resources/{task-agent → agents}/templates.js +5 -4
  41. package/resources/agents/templates.js.map +1 -0
  42. package/resources/agents/templates.mjs +19 -0
  43. package/resources/agents/templates.mjs.map +1 -0
  44. package/resources/agents.d.mts +2 -0
  45. package/resources/agents.d.mts.map +1 -0
  46. package/resources/agents.d.ts +2 -0
  47. package/resources/agents.d.ts.map +1 -0
  48. package/resources/{task-agent.js → agents.js} +2 -2
  49. package/resources/agents.js.map +1 -0
  50. package/resources/{task-agent.mjs → agents.mjs} +2 -2
  51. package/resources/agents.mjs.map +1 -0
  52. package/resources/batches.js +3 -3
  53. package/resources/batches.mjs +3 -3
  54. package/resources/crawl.js +4 -4
  55. package/resources/crawl.mjs +4 -4
  56. package/resources/domain-knowledge.js +1 -1
  57. package/resources/domain-knowledge.mjs +1 -1
  58. package/resources/extract/extract.d.mts +1243 -0
  59. package/resources/extract/extract.d.mts.map +1 -0
  60. package/resources/extract/extract.d.ts +1243 -0
  61. package/resources/extract/extract.d.ts.map +1 -0
  62. package/resources/extract/extract.js +52 -0
  63. package/resources/extract/extract.js.map +1 -0
  64. package/resources/extract/extract.mjs +47 -0
  65. package/resources/extract/extract.mjs.map +1 -0
  66. package/resources/extract/index.d.mts +3 -0
  67. package/resources/extract/index.d.mts.map +1 -0
  68. package/resources/extract/index.d.ts +3 -0
  69. package/resources/extract/index.d.ts.map +1 -0
  70. package/resources/extract/index.js +9 -0
  71. package/resources/extract/index.js.map +1 -0
  72. package/resources/extract/index.mjs +4 -0
  73. package/resources/extract/index.mjs.map +1 -0
  74. package/resources/extract/templates/generations.d.mts +364 -0
  75. package/resources/extract/templates/generations.d.mts.map +1 -0
  76. package/resources/extract/templates/generations.d.ts +364 -0
  77. package/resources/extract/templates/generations.d.ts.map +1 -0
  78. package/resources/extract/templates/generations.js +39 -0
  79. package/resources/extract/templates/generations.js.map +1 -0
  80. package/resources/extract/templates/generations.mjs +35 -0
  81. package/resources/extract/templates/generations.mjs.map +1 -0
  82. package/resources/extract/templates/index.d.mts +4 -0
  83. package/resources/extract/templates/index.d.mts.map +1 -0
  84. package/resources/extract/templates/index.d.ts +4 -0
  85. package/resources/extract/templates/index.d.ts.map +1 -0
  86. package/resources/extract/templates/index.js +11 -0
  87. package/resources/extract/templates/index.js.map +1 -0
  88. package/resources/extract/templates/index.mjs +5 -0
  89. package/resources/extract/templates/index.mjs.map +1 -0
  90. package/resources/{agent.d.ts → extract/templates/templates.d.mts} +475 -263
  91. package/resources/extract/templates/templates.d.mts.map +1 -0
  92. package/resources/{agent.d.mts → extract/templates/templates.d.ts} +475 -263
  93. package/resources/extract/templates/templates.d.ts.map +1 -0
  94. package/resources/extract/templates/templates.js +120 -0
  95. package/resources/extract/templates/templates.js.map +1 -0
  96. package/resources/extract/templates/templates.mjs +115 -0
  97. package/resources/extract/templates/templates.mjs.map +1 -0
  98. package/resources/extract/templates/versions.d.mts +226 -0
  99. package/resources/extract/templates/versions.d.mts.map +1 -0
  100. package/resources/extract/templates/versions.d.ts +226 -0
  101. package/resources/extract/templates/versions.d.ts.map +1 -0
  102. package/resources/extract/templates/versions.js +42 -0
  103. package/resources/extract/templates/versions.js.map +1 -0
  104. package/resources/extract/templates/versions.mjs +38 -0
  105. package/resources/extract/templates/versions.mjs.map +1 -0
  106. package/resources/extract/templates.d.mts +2 -0
  107. package/resources/extract/templates.d.mts.map +1 -0
  108. package/resources/extract/templates.d.ts +2 -0
  109. package/resources/extract/templates.d.ts.map +1 -0
  110. package/resources/extract/templates.js +6 -0
  111. package/resources/extract/templates.js.map +1 -0
  112. package/resources/extract/templates.mjs +3 -0
  113. package/resources/extract/templates.mjs.map +1 -0
  114. package/resources/extract.d.mts +2 -0
  115. package/resources/extract.d.mts.map +1 -0
  116. package/resources/extract.d.ts +2 -0
  117. package/resources/extract.d.ts.map +1 -0
  118. package/resources/extract.js +6 -0
  119. package/resources/extract.js.map +1 -0
  120. package/resources/extract.mjs +3 -0
  121. package/resources/extract.mjs.map +1 -0
  122. package/resources/fast-serp.js +1 -1
  123. package/resources/fast-serp.mjs +1 -1
  124. package/resources/index.d.mts +4 -4
  125. package/resources/index.d.mts.map +1 -1
  126. package/resources/index.d.ts +4 -4
  127. package/resources/index.d.ts.map +1 -1
  128. package/resources/index.js +5 -5
  129. package/resources/index.js.map +1 -1
  130. package/resources/index.mjs +2 -2
  131. package/resources/index.mjs.map +1 -1
  132. package/resources/jobs/index.d.mts +2 -2
  133. package/resources/jobs/index.d.mts.map +1 -1
  134. package/resources/jobs/index.d.ts +2 -2
  135. package/resources/jobs/index.d.ts.map +1 -1
  136. package/resources/jobs/index.js.map +1 -1
  137. package/resources/jobs/index.mjs.map +1 -1
  138. package/resources/jobs/jobs.d.mts +34 -90
  139. package/resources/jobs/jobs.d.mts.map +1 -1
  140. package/resources/jobs/jobs.d.ts +34 -90
  141. package/resources/jobs/jobs.d.ts.map +1 -1
  142. package/resources/jobs/jobs.js +10 -16
  143. package/resources/jobs/jobs.js.map +1 -1
  144. package/resources/jobs/jobs.mjs +11 -17
  145. package/resources/jobs/jobs.mjs.map +1 -1
  146. package/resources/jobs/runs/artifacts.d.mts +7 -17
  147. package/resources/jobs/runs/artifacts.d.mts.map +1 -1
  148. package/resources/jobs/runs/artifacts.d.ts +7 -17
  149. package/resources/jobs/runs/artifacts.d.ts.map +1 -1
  150. package/resources/jobs/runs/artifacts.js +8 -8
  151. package/resources/jobs/runs/artifacts.mjs +8 -8
  152. package/resources/jobs/runs/index.d.mts +1 -1
  153. package/resources/jobs/runs/index.d.mts.map +1 -1
  154. package/resources/jobs/runs/index.d.ts +1 -1
  155. package/resources/jobs/runs/index.d.ts.map +1 -1
  156. package/resources/jobs/runs/index.js.map +1 -1
  157. package/resources/jobs/runs/index.mjs.map +1 -1
  158. package/resources/jobs/runs/runs.d.mts +59 -21
  159. package/resources/jobs/runs/runs.d.mts.map +1 -1
  160. package/resources/jobs/runs/runs.d.ts +59 -21
  161. package/resources/jobs/runs/runs.d.ts.map +1 -1
  162. package/resources/jobs/runs/runs.js +12 -6
  163. package/resources/jobs/runs/runs.js.map +1 -1
  164. package/resources/jobs/runs/runs.mjs +12 -6
  165. package/resources/jobs/runs/runs.mjs.map +1 -1
  166. package/resources/media.js +2 -2
  167. package/resources/media.mjs +2 -2
  168. package/resources/serp.js +3 -3
  169. package/resources/serp.mjs +3 -3
  170. package/resources/tasks.js +3 -3
  171. package/resources/tasks.mjs +3 -3
  172. package/resources/top-level.d.mts +1 -1208
  173. package/resources/top-level.d.mts.map +1 -1
  174. package/resources/top-level.d.ts +1 -1208
  175. package/resources/top-level.d.ts.map +1 -1
  176. package/src/client.ts +41 -123
  177. package/src/resources/agents/agents.ts +1039 -0
  178. package/src/resources/agents/index.ts +30 -0
  179. package/src/resources/{task-agent → agents}/runs.ts +450 -154
  180. package/src/resources/agents/templates.ts +324 -0
  181. package/src/resources/{task-agent.ts → agents.ts} +1 -1
  182. package/src/resources/batches.ts +3 -3
  183. package/src/resources/crawl.ts +4 -4
  184. package/src/resources/domain-knowledge.ts +1 -1
  185. package/src/resources/extract/extract.ts +5182 -0
  186. package/src/resources/extract/index.ts +25 -0
  187. package/src/resources/extract/templates/generations.ts +435 -0
  188. package/src/resources/extract/templates/index.ts +29 -0
  189. package/src/resources/extract/templates/templates.ts +1176 -0
  190. package/src/resources/extract/templates/versions.ts +284 -0
  191. package/src/resources/extract/templates.ts +3 -0
  192. package/src/resources/extract.ts +3 -0
  193. package/src/resources/fast-serp.ts +1 -1
  194. package/src/resources/index.ts +16 -36
  195. package/src/resources/jobs/index.ts +1 -1
  196. package/src/resources/jobs/jobs.ts +49 -112
  197. package/src/resources/jobs/runs/artifacts.ts +11 -21
  198. package/src/resources/jobs/runs/index.ts +1 -0
  199. package/src/resources/jobs/runs/runs.ts +74 -24
  200. package/src/resources/media.ts +2 -2
  201. package/src/resources/serp.ts +3 -3
  202. package/src/resources/tasks.ts +3 -3
  203. package/src/resources/top-level.ts +88 -5192
  204. package/src/version.ts +1 -1
  205. package/version.d.mts +1 -1
  206. package/version.d.mts.map +1 -1
  207. package/version.d.ts +1 -1
  208. package/version.d.ts.map +1 -1
  209. package/version.js +1 -1
  210. package/version.js.map +1 -1
  211. package/version.mjs +1 -1
  212. package/version.mjs.map +1 -1
  213. package/resources/agent.d.mts.map +0 -1
  214. package/resources/agent.d.ts.map +0 -1
  215. package/resources/agent.js +0 -101
  216. package/resources/agent.js.map +0 -1
  217. package/resources/agent.mjs +0 -97
  218. package/resources/agent.mjs.map +0 -1
  219. package/resources/task-agent/index.d.mts +0 -4
  220. package/resources/task-agent/index.d.mts.map +0 -1
  221. package/resources/task-agent/index.d.ts +0 -4
  222. package/resources/task-agent/index.d.ts.map +0 -1
  223. package/resources/task-agent/index.js.map +0 -1
  224. package/resources/task-agent/index.mjs.map +0 -1
  225. package/resources/task-agent/runs.d.mts.map +0 -1
  226. package/resources/task-agent/runs.d.ts.map +0 -1
  227. package/resources/task-agent/runs.js +0 -65
  228. package/resources/task-agent/runs.js.map +0 -1
  229. package/resources/task-agent/runs.mjs +0 -61
  230. package/resources/task-agent/runs.mjs.map +0 -1
  231. package/resources/task-agent/task-agent.d.mts +0 -481
  232. package/resources/task-agent/task-agent.d.mts.map +0 -1
  233. package/resources/task-agent/task-agent.d.ts +0 -481
  234. package/resources/task-agent/task-agent.d.ts.map +0 -1
  235. package/resources/task-agent/task-agent.js +0 -68
  236. package/resources/task-agent/task-agent.js.map +0 -1
  237. package/resources/task-agent/task-agent.mjs +0 -63
  238. package/resources/task-agent/task-agent.mjs.map +0 -1
  239. package/resources/task-agent/templates.d.mts +0 -107
  240. package/resources/task-agent/templates.d.mts.map +0 -1
  241. package/resources/task-agent/templates.d.ts +0 -107
  242. package/resources/task-agent/templates.d.ts.map +0 -1
  243. package/resources/task-agent/templates.js.map +0 -1
  244. package/resources/task-agent/templates.mjs +0 -18
  245. package/resources/task-agent/templates.mjs.map +0 -1
  246. package/resources/task-agent.d.mts +0 -2
  247. package/resources/task-agent.d.mts.map +0 -1
  248. package/resources/task-agent.d.ts +0 -2
  249. package/resources/task-agent.d.ts.map +0 -1
  250. package/resources/task-agent.js.map +0 -1
  251. package/resources/task-agent.mjs.map +0 -1
  252. package/src/resources/agent.ts +0 -952
  253. package/src/resources/task-agent/index.ts +0 -32
  254. package/src/resources/task-agent/task-agent.ts +0 -746
  255. package/src/resources/task-agent/templates.ts +0 -172
@@ -8,105 +8,182 @@ import { path } from '../../internal/utils/path';
8
8
 
9
9
  export class Runs extends APIResource {
10
10
  /**
11
- * List runs for this instance.
11
+ * Start an agent run. The run executes asynchronously: the response returns
12
+ * immediately with status `queued`, then poll `GET .../runs/{run_id}` until
13
+ * `completed` and fetch the output from `GET .../runs/{run_id}/result` — or set
14
+ * `enable_events: true` and follow `GET .../runs/{run_id}/events` for live
15
+ * progress.
12
16
  *
13
- * `status` accepts a lowercase `TaskRunStatusValue` (e.g. "completed") or a
14
- * comma-separated list of them (e.g. "queued,running").
17
+ * To enrich existing records instead of researching from scratch, pass them in
18
+ * `input_data`; this requires an `output_schema` (on the request or the agent).
19
+ */
20
+ create(agentID: string, body: RunCreateParams, options?: RequestOptions): APIPromise<RunCreateResponse> {
21
+ return this._client.post(path`/v2/agents/${agentID}/runs`, { body, ...options });
22
+ }
23
+
24
+ /**
25
+ * List the runs of an agent, newest first, paginated with `offset`/`limit`.
15
26
  */
16
27
  list(
17
28
  agentID: string,
18
29
  query: RunListParams | null | undefined = {},
19
30
  options?: RequestOptions,
20
31
  ): APIPromise<RunListResponse> {
21
- return this._client.get(path`/v1/task-agents/${agentID}/runs`, { query, ...options });
32
+ return this._client.get(path`/v2/agents/${agentID}/runs`, { query, ...options });
22
33
  }
23
34
 
24
35
  /**
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}`).
36
+ * Retrieve a run's current state. Poll this endpoint after creating a run: the run
37
+ * is finished once `status` is `completed`, `failed`, or `cancelled`.
29
38
  */
30
- cancel(runID: string, params: RunCancelParams, options?: RequestOptions): APIPromise<void> {
39
+ get(runID: string, params: RunGetParams, options?: RequestOptions): APIPromise<RunGetResponse> {
31
40
  const { agent_id } = params;
32
- return this._client.post(path`/v1/task-agents/${agent_id}/runs/${runID}/cancel`, {
33
- ...options,
34
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
35
- });
41
+ return this._client.get(path`/v2/agents/${agent_id}/runs/${runID}`, options);
36
42
  }
37
43
 
38
44
  /**
39
- * Fetch a run by id, scoped to the instance.
45
+ * Fetch the output of a completed run. The `output` is `type: "text"` (a prose
46
+ * answer) or `type: "json"` (structured data matching the output schema), plus
47
+ * `trust` metadata with per-claim citations for the answer.
40
48
  *
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.
49
+ * While the run is still `queued` or `running` this endpoint returns `409`; if the
50
+ * run `failed` or was `cancelled` it returns `422` with the run and error details.
44
51
  */
45
- get(runID: string, params: RunGetParams, options?: RequestOptions): APIPromise<RunGetResponse> {
52
+ result(runID: string, params: RunResultParams, options?: RequestOptions): APIPromise<RunResultResponse> {
46
53
  const { agent_id } = params;
47
- return this._client.get(path`/v1/task-agents/${agent_id}/runs/${runID}`, options);
54
+ return this._client.get(path`/v2/agents/${agent_id}/runs/${runID}/result`, options);
48
55
  }
49
56
 
50
57
  /**
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.
59
- */
60
- getResult(
61
- runID: string,
62
- params: RunGetResultParams,
63
- options?: RequestOptions,
64
- ): APIPromise<RunGetResultResponse> {
58
+ * Stream a run's progress as
59
+ * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events)
60
+ * (`text/event-stream`). Create the run with `enable_events: true` to have events
61
+ * published. A keep-alive comment is sent every 15 seconds.
62
+ */
63
+ streamEvents(runID: string, params: RunStreamEventsParams, options?: RequestOptions): APIPromise<void> {
65
64
  const { agent_id } = params;
66
- return this._client.get(path`/v1/task-agents/${agent_id}/runs/${runID}/result`, options);
65
+ return this._client.get(path`/v2/agents/${agent_id}/runs/${runID}/events`, {
66
+ ...options,
67
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
68
+ });
67
69
  }
70
+ }
68
71
 
72
+ export interface RunCreateResponse {
69
73
  /**
70
- * SSE stream of real-time progress events for a run on this instance.
74
+ * Run identifier, format "task*run*{uuid}".
71
75
  */
72
- streamEvents(runID: string, params: RunStreamEventsParams, options?: RequestOptions): APIPromise<unknown> {
73
- const { agent_id } = params;
74
- return this._client.get(path`/v1/task-agents/${agent_id}/runs/${runID}/events`, options);
76
+ id: string;
77
+
78
+ /**
79
+ * When the run was created.
80
+ */
81
+ created_at: string;
82
+
83
+ /**
84
+ * Effort level used for the run.
85
+ */
86
+ effort: 'low' | 'medium' | 'high' | 'x-high' | 'max';
87
+
88
+ /**
89
+ * Interaction ID.
90
+ */
91
+ interaction_id: string;
92
+
93
+ /**
94
+ * True while status is 'queued' or 'running'.
95
+ */
96
+ is_active: boolean;
97
+
98
+ /**
99
+ * Current run status.
100
+ */
101
+ status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
102
+
103
+ /**
104
+ * Web Search Agent instance this run belongs to.
105
+ */
106
+ web_search_agent_id: string;
107
+
108
+ /**
109
+ * When the run completed.
110
+ */
111
+ completed_at?: string | null;
112
+
113
+ /**
114
+ * Error details when the run failed.
115
+ */
116
+ error?: RunCreateResponse.Error | null;
117
+
118
+ /**
119
+ * Prompt submitted for the run.
120
+ */
121
+ prompt?: string | null;
122
+
123
+ /**
124
+ * When the run started executing.
125
+ */
126
+ started_at?: string | null;
127
+ }
128
+
129
+ export namespace RunCreateResponse {
130
+ /**
131
+ * Error details when the run failed.
132
+ */
133
+ export interface Error {
134
+ /**
135
+ * Human-readable error description.
136
+ */
137
+ message: string;
138
+
139
+ /**
140
+ * Reference ID (equals the run id).
141
+ */
142
+ ref_id: string;
75
143
  }
76
144
  }
77
145
 
78
- /**
79
- * Paginated list of task runs for GET /tasks/runs.
80
- */
81
146
  export interface RunListResponse {
147
+ /**
148
+ * Items returned in this page.
149
+ */
82
150
  items: Array<RunListResponse.Item>;
83
151
 
84
- total: number;
152
+ /**
153
+ * Maximum number of items returned.
154
+ */
155
+ limit: number;
85
156
 
86
- limit?: number;
157
+ /**
158
+ * Number of items skipped before this page.
159
+ */
160
+ offset: number;
87
161
 
88
- offset?: number;
162
+ /**
163
+ * Total number of items matching the query.
164
+ */
165
+ total: number;
89
166
  }
90
167
 
91
168
  export namespace RunListResponse {
92
- /**
93
- * Task run status returned by list/create/get endpoints.
94
- */
95
169
  export interface Item {
96
170
  /**
97
171
  * Run identifier, format "task*run*{uuid}".
98
172
  */
99
173
  id: string;
100
174
 
175
+ /**
176
+ * When the run was created.
177
+ */
101
178
  created_at: string;
102
179
 
103
180
  /**
104
- * Canonical effort tier names for the research graph.
181
+ * Effort level used for the run.
105
182
  */
106
183
  effort: 'low' | 'medium' | 'high' | 'x-high' | 'max';
107
184
 
108
185
  /**
109
- * Interaction ID — pass as previous_interaction_id to reuse context.
186
+ * Interaction ID.
110
187
  */
111
188
  interaction_id: string;
112
189
 
@@ -116,38 +193,39 @@ export namespace RunListResponse {
116
193
  is_active: boolean;
117
194
 
118
195
  /**
119
- * Lowercase status values used in API responses (distinct from the DB-level
120
- * TaskRunStatus enum).
196
+ * Current run status.
121
197
  */
122
198
  status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
123
199
 
124
200
  /**
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}.
201
+ * Web Search Agent instance this run belongs to.
128
202
  */
129
203
  web_search_agent_id: string;
130
204
 
205
+ /**
206
+ * When the run completed.
207
+ */
131
208
  completed_at?: string | null;
132
209
 
133
210
  /**
134
- * Error detail for a failed run.
211
+ * Error details when the run failed.
135
212
  */
136
213
  error?: Item.Error | null;
137
214
 
138
215
  /**
139
- * Original user prompt before enrichment. Populated for Web Search Agent runs.
216
+ * Prompt submitted for the run.
140
217
  */
141
218
  prompt?: string | null;
142
219
 
220
+ /**
221
+ * When the run started executing.
222
+ */
143
223
  started_at?: string | null;
144
-
145
- workspace_id?: string | null;
146
224
  }
147
225
 
148
226
  export namespace Item {
149
227
  /**
150
- * Error detail for a failed run.
228
+ * Error details when the run failed.
151
229
  */
152
230
  export interface Error {
153
231
  /**
@@ -163,24 +241,24 @@ export namespace RunListResponse {
163
241
  }
164
242
  }
165
243
 
166
- /**
167
- * Task run status returned by list/create/get endpoints.
168
- */
169
244
  export interface RunGetResponse {
170
245
  /**
171
246
  * Run identifier, format "task*run*{uuid}".
172
247
  */
173
248
  id: string;
174
249
 
250
+ /**
251
+ * When the run was created.
252
+ */
175
253
  created_at: string;
176
254
 
177
255
  /**
178
- * Canonical effort tier names for the research graph.
256
+ * Effort level used for the run.
179
257
  */
180
258
  effort: 'low' | 'medium' | 'high' | 'x-high' | 'max';
181
259
 
182
260
  /**
183
- * Interaction ID — pass as previous_interaction_id to reuse context.
261
+ * Interaction ID.
184
262
  */
185
263
  interaction_id: string;
186
264
 
@@ -190,38 +268,39 @@ export interface RunGetResponse {
190
268
  is_active: boolean;
191
269
 
192
270
  /**
193
- * Lowercase status values used in API responses (distinct from the DB-level
194
- * TaskRunStatus enum).
271
+ * Current run status.
195
272
  */
196
273
  status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
197
274
 
198
275
  /**
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}.
276
+ * Web Search Agent instance this run belongs to.
202
277
  */
203
278
  web_search_agent_id: string;
204
279
 
280
+ /**
281
+ * When the run completed.
282
+ */
205
283
  completed_at?: string | null;
206
284
 
207
285
  /**
208
- * Error detail for a failed run.
286
+ * Error details when the run failed.
209
287
  */
210
288
  error?: RunGetResponse.Error | null;
211
289
 
212
290
  /**
213
- * Original user prompt before enrichment. Populated for Web Search Agent runs.
291
+ * Prompt submitted for the run.
214
292
  */
215
293
  prompt?: string | null;
216
294
 
295
+ /**
296
+ * When the run started executing.
297
+ */
217
298
  started_at?: string | null;
218
-
219
- workspace_id?: string | null;
220
299
  }
221
300
 
222
301
  export namespace RunGetResponse {
223
302
  /**
224
- * Error detail for a failed run.
303
+ * Error details when the run failed.
225
304
  */
226
305
  export interface Error {
227
306
  /**
@@ -236,72 +315,111 @@ export namespace RunGetResponse {
236
315
  }
237
316
  }
238
317
 
239
- /**
240
- * Response for GET /tasks/runs/{run_id}/result — status 'completed'.
241
- */
242
- export type RunGetResultResponse =
243
- | RunGetResultResponse.TaskRunResult
244
- | RunGetResultResponse.TaskRunFailedResult;
318
+ export type RunResultResponse =
319
+ | RunResultResponse.TaskRunResultPublicV2
320
+ | RunResultResponse.TaskRunFailedResultPublicV2;
245
321
 
246
- export namespace RunGetResultResponse {
247
- /**
248
- * Response for GET /tasks/runs/{run_id}/result — status 'completed'.
249
- */
250
- export interface TaskRunResult {
322
+ export namespace RunResultResponse {
323
+ export interface TaskRunResultPublicV2 {
251
324
  /**
252
325
  * Output from the completed task.
253
326
  */
254
- output: TaskRunResult.TaskRunTextOutput | TaskRunResult.TaskRunJsonOutput;
327
+ output: TaskRunResultPublicV2.TaskRunTextOutputPublicV2 | TaskRunResultPublicV2.TaskRunJsonOutputPublicV2;
255
328
 
256
329
  /**
257
330
  * Task run object with status 'completed'.
258
331
  */
259
- run: TaskRunResult.Run;
332
+ run: TaskRunResultPublicV2.Run;
260
333
  }
261
334
 
262
- export namespace TaskRunResult {
263
- /**
264
- * Text output from a completed task.
265
- */
266
- export interface TaskRunTextOutput {
335
+ export namespace TaskRunResultPublicV2 {
336
+ export interface TaskRunTextOutputPublicV2 {
267
337
  /**
268
338
  * The final prose answer.
269
339
  */
270
340
  content: string;
271
341
 
272
- trust: TaskRunTextOutput.Trust;
342
+ /**
343
+ * Trust and citation metadata for the output.
344
+ */
345
+ trust: TaskRunTextOutputPublicV2.Trust;
273
346
 
347
+ /**
348
+ * Output content type.
349
+ */
274
350
  type?: 'text';
275
351
  }
276
352
 
277
- export namespace TaskRunTextOutput {
353
+ export namespace TaskRunTextOutputPublicV2 {
354
+ /**
355
+ * Trust and citation metadata for the output.
356
+ */
278
357
  export interface Trust {
358
+ /**
359
+ * Per-claim trust, keyed by callout markers in the answer text.
360
+ */
279
361
  claims: Array<Trust.Claim>;
280
362
 
281
- confidence: 'high' | 'medium' | 'low';
363
+ /**
364
+ * Overall confidence in the answer.
365
+ */
366
+ confidence: 'high' | 'medium' | 'low' | 'pre_existing';
282
367
 
368
+ /**
369
+ * Why this confidence level was assigned.
370
+ */
283
371
  reasoning: string;
284
372
 
373
+ /**
374
+ * Sources consulted while producing the answer.
375
+ */
285
376
  sources: Array<Trust.Source>;
286
377
  }
287
378
 
288
379
  export namespace Trust {
380
+ /**
381
+ * Trust metadata for one claim in a prose answer, keyed by callout marker.
382
+ */
289
383
  export interface Claim {
384
+ /**
385
+ * Callout marker number referencing this claim in the answer text.
386
+ */
290
387
  callout: number;
291
388
 
389
+ /**
390
+ * Citations backing this claim.
391
+ */
292
392
  citations: Array<Claim.Citation>;
293
393
 
294
- confidence: 'high' | 'medium' | 'low';
394
+ /**
395
+ * Confidence in this claim.
396
+ */
397
+ confidence: 'high' | 'medium' | 'low' | 'pre_existing';
295
398
 
399
+ /**
400
+ * Why this confidence level was assigned.
401
+ */
296
402
  reasoning: string;
297
403
  }
298
404
 
299
405
  export namespace Claim {
406
+ /**
407
+ * A citation backing a specific claim in the answer.
408
+ */
300
409
  export interface Citation {
410
+ /**
411
+ * URL of the cited page.
412
+ */
301
413
  url: string;
302
414
 
415
+ /**
416
+ * Verbatim excerpts supporting the claim.
417
+ */
303
418
  excerpts?: Array<string> | null;
304
419
 
420
+ /**
421
+ * Extract template used to read the source, when one was used.
422
+ */
305
423
  extract_template_name?: string | null;
306
424
 
307
425
  /**
@@ -328,17 +446,35 @@ export namespace RunGetResultResponse {
328
446
  */
329
447
  source_intent?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
330
448
 
449
+ /**
450
+ * How authoritative the source is: 'primary' or 'secondary'.
451
+ */
331
452
  source_type?: 'primary' | 'secondary' | null;
332
453
 
454
+ /**
455
+ * Title of the cited page.
456
+ */
333
457
  title?: string | null;
334
458
  }
335
459
  }
336
460
 
461
+ /**
462
+ * A source consulted while producing the answer.
463
+ */
337
464
  export interface Source {
465
+ /**
466
+ * How authoritative the source is: 'primary' or 'secondary'.
467
+ */
338
468
  type: 'primary' | 'secondary';
339
469
 
470
+ /**
471
+ * URL of the source page.
472
+ */
340
473
  url: string;
341
474
 
475
+ /**
476
+ * Extract template used to read the source, when one was used.
477
+ */
342
478
  extract_template_name?: string | null;
343
479
 
344
480
  /**
@@ -365,55 +501,101 @@ export namespace RunGetResultResponse {
365
501
  */
366
502
  source_intent?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
367
503
 
504
+ /**
505
+ * Title of the source page.
506
+ */
368
507
  title?: string | null;
369
508
  }
370
509
  }
371
510
  }
372
511
 
373
- /**
374
- * Structured JSON output from a completed task, produced when
375
- * task_spec.output_schema.type is 'json'.
376
- */
377
- export interface TaskRunJsonOutput {
512
+ export interface TaskRunJsonOutputPublicV2 {
378
513
  /**
379
- * Data conforming to the caller-supplied JSON schema. A dict for object schemas; a
380
- * list for array schemas.
514
+ * The final structured output.
381
515
  */
382
516
  content: { [key: string]: unknown } | Array<unknown>;
383
517
 
384
- trust: TaskRunJsonOutput.Trust;
518
+ /**
519
+ * Trust and citation metadata for the output.
520
+ */
521
+ trust: TaskRunJsonOutputPublicV2.Trust;
385
522
 
523
+ /**
524
+ * Output content type.
525
+ */
386
526
  type?: 'json';
387
527
  }
388
528
 
389
- export namespace TaskRunJsonOutput {
529
+ export namespace TaskRunJsonOutputPublicV2 {
530
+ /**
531
+ * Trust and citation metadata for the output.
532
+ */
390
533
  export interface Trust {
534
+ /**
535
+ * Per-value trust, keyed by JSON path in the structured output.
536
+ */
391
537
  claims: Array<Trust.Claim>;
392
538
 
393
- confidence: 'high' | 'medium' | 'low';
539
+ /**
540
+ * Overall confidence in the answer.
541
+ */
542
+ confidence: 'high' | 'medium' | 'low' | 'pre_existing';
394
543
 
544
+ /**
545
+ * Why this confidence level was assigned.
546
+ */
395
547
  reasoning: string;
396
548
 
549
+ /**
550
+ * Sources consulted while producing the answer.
551
+ */
397
552
  sources: Array<Trust.Source>;
398
553
  }
399
554
 
400
555
  export namespace Trust {
556
+ /**
557
+ * Trust metadata for one value in a structured (JSON) answer, keyed by JSON path.
558
+ */
401
559
  export interface Claim {
560
+ /**
561
+ * Citations backing this value.
562
+ */
402
563
  citations: Array<Claim.Citation>;
403
564
 
404
- confidence: 'high' | 'medium' | 'low';
565
+ /**
566
+ * Confidence in this value.
567
+ */
568
+ confidence: 'high' | 'medium' | 'low' | 'pre_existing';
405
569
 
570
+ /**
571
+ * JSON path of the value in the structured output this claim refers to.
572
+ */
406
573
  path: string;
407
574
 
575
+ /**
576
+ * Why this confidence level was assigned.
577
+ */
408
578
  reasoning: string;
409
579
  }
410
580
 
411
581
  export namespace Claim {
582
+ /**
583
+ * A citation backing a specific claim in the answer.
584
+ */
412
585
  export interface Citation {
586
+ /**
587
+ * URL of the cited page.
588
+ */
413
589
  url: string;
414
590
 
591
+ /**
592
+ * Verbatim excerpts supporting the claim.
593
+ */
415
594
  excerpts?: Array<string> | null;
416
595
 
596
+ /**
597
+ * Extract template used to read the source, when one was used.
598
+ */
417
599
  extract_template_name?: string | null;
418
600
 
419
601
  /**
@@ -440,17 +622,35 @@ export namespace RunGetResultResponse {
440
622
  */
441
623
  source_intent?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
442
624
 
625
+ /**
626
+ * How authoritative the source is: 'primary' or 'secondary'.
627
+ */
443
628
  source_type?: 'primary' | 'secondary' | null;
444
629
 
630
+ /**
631
+ * Title of the cited page.
632
+ */
445
633
  title?: string | null;
446
634
  }
447
635
  }
448
636
 
637
+ /**
638
+ * A source consulted while producing the answer.
639
+ */
449
640
  export interface Source {
641
+ /**
642
+ * How authoritative the source is: 'primary' or 'secondary'.
643
+ */
450
644
  type: 'primary' | 'secondary';
451
645
 
646
+ /**
647
+ * URL of the source page.
648
+ */
452
649
  url: string;
453
650
 
651
+ /**
652
+ * Extract template used to read the source, when one was used.
653
+ */
454
654
  extract_template_name?: string | null;
455
655
 
456
656
  /**
@@ -477,6 +677,9 @@ export namespace RunGetResultResponse {
477
677
  */
478
678
  source_intent?: 'official' | 'news' | 'social' | 'academic' | 'aggregator' | 'other' | null;
479
679
 
680
+ /**
681
+ * Title of the source page.
682
+ */
480
683
  title?: string | null;
481
684
  }
482
685
  }
@@ -491,15 +694,18 @@ export namespace RunGetResultResponse {
491
694
  */
492
695
  id: string;
493
696
 
697
+ /**
698
+ * When the run was created.
699
+ */
494
700
  created_at: string;
495
701
 
496
702
  /**
497
- * Canonical effort tier names for the research graph.
703
+ * Effort level used for the run.
498
704
  */
499
705
  effort: 'low' | 'medium' | 'high' | 'x-high' | 'max';
500
706
 
501
707
  /**
502
- * Interaction ID — pass as previous_interaction_id to reuse context.
708
+ * Interaction ID.
503
709
  */
504
710
  interaction_id: string;
505
711
 
@@ -509,38 +715,39 @@ export namespace RunGetResultResponse {
509
715
  is_active: boolean;
510
716
 
511
717
  /**
512
- * Lowercase status values used in API responses (distinct from the DB-level
513
- * TaskRunStatus enum).
718
+ * Current run status.
514
719
  */
515
720
  status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
516
721
 
517
722
  /**
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}.
723
+ * Web Search Agent instance this run belongs to.
521
724
  */
522
725
  web_search_agent_id: string;
523
726
 
727
+ /**
728
+ * When the run completed.
729
+ */
524
730
  completed_at?: string | null;
525
731
 
526
732
  /**
527
- * Error detail for a failed run.
733
+ * Error details when the run failed.
528
734
  */
529
735
  error?: Run.Error | null;
530
736
 
531
737
  /**
532
- * Original user prompt before enrichment. Populated for Web Search Agent runs.
738
+ * Prompt submitted for the run.
533
739
  */
534
740
  prompt?: string | null;
535
741
 
742
+ /**
743
+ * When the run started executing.
744
+ */
536
745
  started_at?: string | null;
537
-
538
- workspace_id?: string | null;
539
746
  }
540
747
 
541
748
  export namespace Run {
542
749
  /**
543
- * Error detail for a failed run.
750
+ * Error details when the run failed.
544
751
  */
545
752
  export interface Error {
546
753
  /**
@@ -556,25 +763,19 @@ export namespace RunGetResultResponse {
556
763
  }
557
764
  }
558
765
 
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 {
766
+ export interface TaskRunFailedResultPublicV2 {
566
767
  /**
567
768
  * Structured error detail.
568
769
  */
569
- error: TaskRunFailedResult.Error;
770
+ error: TaskRunFailedResultPublicV2.Error;
570
771
 
571
772
  /**
572
773
  * Task run object with status 'failed'.
573
774
  */
574
- run: TaskRunFailedResult.Run;
775
+ run: TaskRunFailedResultPublicV2.Run;
575
776
  }
576
777
 
577
- export namespace TaskRunFailedResult {
778
+ export namespace TaskRunFailedResultPublicV2 {
578
779
  /**
579
780
  * Structured error detail.
580
781
  */
@@ -599,15 +800,18 @@ export namespace RunGetResultResponse {
599
800
  */
600
801
  id: string;
601
802
 
803
+ /**
804
+ * When the run was created.
805
+ */
602
806
  created_at: string;
603
807
 
604
808
  /**
605
- * Canonical effort tier names for the research graph.
809
+ * Effort level used for the run.
606
810
  */
607
811
  effort: 'low' | 'medium' | 'high' | 'x-high' | 'max';
608
812
 
609
813
  /**
610
- * Interaction ID — pass as previous_interaction_id to reuse context.
814
+ * Interaction ID.
611
815
  */
612
816
  interaction_id: string;
613
817
 
@@ -617,38 +821,39 @@ export namespace RunGetResultResponse {
617
821
  is_active: boolean;
618
822
 
619
823
  /**
620
- * Lowercase status values used in API responses (distinct from the DB-level
621
- * TaskRunStatus enum).
824
+ * Current run status.
622
825
  */
623
826
  status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
624
827
 
625
828
  /**
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}.
829
+ * Web Search Agent instance this run belongs to.
629
830
  */
630
831
  web_search_agent_id: string;
631
832
 
833
+ /**
834
+ * When the run completed.
835
+ */
632
836
  completed_at?: string | null;
633
837
 
634
838
  /**
635
- * Error detail for a failed run.
839
+ * Error details when the run failed.
636
840
  */
637
841
  error?: Run.Error | null;
638
842
 
639
843
  /**
640
- * Original user prompt before enrichment. Populated for Web Search Agent runs.
844
+ * Prompt submitted for the run.
641
845
  */
642
846
  prompt?: string | null;
643
847
 
848
+ /**
849
+ * When the run started executing.
850
+ */
644
851
  started_at?: string | null;
645
-
646
- workspace_id?: string | null;
647
852
  }
648
853
 
649
854
  export namespace Run {
650
855
  /**
651
- * Error detail for a failed run.
856
+ * Error details when the run failed.
652
857
  */
653
858
  export interface Error {
654
859
  /**
@@ -665,27 +870,118 @@ export namespace RunGetResultResponse {
665
870
  }
666
871
  }
667
872
 
668
- export type RunStreamEventsResponse = unknown;
873
+ export interface RunCreateParams {
874
+ /**
875
+ * User prompt or task instructions for the run.
876
+ */
877
+ input: string;
669
878
 
670
- export interface RunListParams {
671
- limit?: number;
879
+ /**
880
+ * Canonical effort tier names for the research graph.
881
+ */
882
+ effort?: 'low' | 'medium' | 'high' | 'x-high' | 'max' | null;
672
883
 
673
- offset?: number;
884
+ /**
885
+ * Whether to stream run events when supported.
886
+ */
887
+ enable_events?: boolean;
674
888
 
675
- q?: string | null;
889
+ /**
890
+ * Existing records to ENRICH: a list of partial rows, or a single object,
891
+ * mirroring output_schema's shape.
892
+ */
893
+ input_data?: Array<{ [key: string]: unknown }> | { [key: string]: unknown } | null;
894
+
895
+ /**
896
+ * JSON schema overriding the agent's default structured output for this run.
897
+ */
898
+ output_schema?: { [key: string]: unknown } | null;
676
899
 
677
- status?: string | null;
900
+ /**
901
+ * Previous interaction identifier used to continue a conversation.
902
+ */
903
+ previous_interaction_id?: string | null;
904
+
905
+ /**
906
+ * Source guidance overriding the agent default.
907
+ */
908
+ sources?: RunCreateParams.Sources | null;
678
909
  }
679
910
 
680
- export interface RunCancelParams {
681
- agent_id: string;
911
+ export namespace RunCreateParams {
912
+ /**
913
+ * Source guidance overriding the agent default.
914
+ */
915
+ export interface Sources {
916
+ /**
917
+ * Source groups the agent is allowed to use.
918
+ */
919
+ allow?: Array<Sources.Allow>;
920
+
921
+ /**
922
+ * Free-text guidance describing sources or domains to avoid.
923
+ */
924
+ avoid?: string | null;
925
+
926
+ /**
927
+ * Source groups the agent should not use.
928
+ */
929
+ block?: Array<Sources.Block>;
930
+
931
+ /**
932
+ * Free-text guidance describing sources or domains to prioritize.
933
+ */
934
+ prioritize?: string | null;
935
+ }
936
+
937
+ export namespace Sources {
938
+ export interface Allow {
939
+ /**
940
+ * Domains included in this source group.
941
+ */
942
+ domains: Array<string>;
943
+
944
+ /**
945
+ * Source group title.
946
+ */
947
+ title: string;
948
+
949
+ /**
950
+ * Zero-based source group position.
951
+ */
952
+ order?: number;
953
+ }
954
+
955
+ export interface Block {
956
+ /**
957
+ * Domains included in this source group.
958
+ */
959
+ domains: Array<string>;
960
+
961
+ /**
962
+ * Source group title.
963
+ */
964
+ title: string;
965
+
966
+ /**
967
+ * Zero-based source group position.
968
+ */
969
+ order?: number;
970
+ }
971
+ }
972
+ }
973
+
974
+ export interface RunListParams {
975
+ limit?: number;
976
+
977
+ offset?: number;
682
978
  }
683
979
 
684
980
  export interface RunGetParams {
685
981
  agent_id: string;
686
982
  }
687
983
 
688
- export interface RunGetResultParams {
984
+ export interface RunResultParams {
689
985
  agent_id: string;
690
986
  }
691
987
 
@@ -695,14 +991,14 @@ export interface RunStreamEventsParams {
695
991
 
696
992
  export declare namespace Runs {
697
993
  export {
994
+ type RunCreateResponse as RunCreateResponse,
698
995
  type RunListResponse as RunListResponse,
699
996
  type RunGetResponse as RunGetResponse,
700
- type RunGetResultResponse as RunGetResultResponse,
701
- type RunStreamEventsResponse as RunStreamEventsResponse,
997
+ type RunResultResponse as RunResultResponse,
998
+ type RunCreateParams as RunCreateParams,
702
999
  type RunListParams as RunListParams,
703
- type RunCancelParams as RunCancelParams,
704
1000
  type RunGetParams as RunGetParams,
705
- type RunGetResultParams as RunGetResultParams,
1001
+ type RunResultParams as RunResultParams,
706
1002
  type RunStreamEventsParams as RunStreamEventsParams,
707
1003
  };
708
1004
  }