parallel-web 0.4.1 → 0.5.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 (160) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/client.d.mts +29 -8
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +29 -8
  5. package/client.d.ts.map +1 -1
  6. package/client.js +34 -4
  7. package/client.js.map +1 -1
  8. package/client.mjs +34 -4
  9. package/client.mjs.map +1 -1
  10. package/internal/qs/formats.d.mts +7 -0
  11. package/internal/qs/formats.d.mts.map +1 -0
  12. package/internal/qs/formats.d.ts +7 -0
  13. package/internal/qs/formats.d.ts.map +1 -0
  14. package/internal/qs/formats.js +13 -0
  15. package/internal/qs/formats.js.map +1 -0
  16. package/internal/qs/formats.mjs +9 -0
  17. package/internal/qs/formats.mjs.map +1 -0
  18. package/internal/qs/index.d.mts +10 -0
  19. package/internal/qs/index.d.mts.map +1 -0
  20. package/internal/qs/index.d.ts +10 -0
  21. package/internal/qs/index.d.ts.map +1 -0
  22. package/internal/qs/index.js +14 -0
  23. package/internal/qs/index.js.map +1 -0
  24. package/internal/qs/index.mjs +10 -0
  25. package/internal/qs/index.mjs.map +1 -0
  26. package/internal/qs/stringify.d.mts +3 -0
  27. package/internal/qs/stringify.d.mts.map +1 -0
  28. package/internal/qs/stringify.d.ts +3 -0
  29. package/internal/qs/stringify.d.ts.map +1 -0
  30. package/internal/qs/stringify.js +277 -0
  31. package/internal/qs/stringify.js.map +1 -0
  32. package/internal/qs/stringify.mjs +274 -0
  33. package/internal/qs/stringify.mjs.map +1 -0
  34. package/internal/qs/types.d.mts +57 -0
  35. package/internal/qs/types.d.mts.map +1 -0
  36. package/internal/qs/types.d.ts +57 -0
  37. package/internal/qs/types.d.ts.map +1 -0
  38. package/internal/qs/types.js +3 -0
  39. package/internal/qs/types.js.map +1 -0
  40. package/internal/qs/types.mjs +2 -0
  41. package/internal/qs/types.mjs.map +1 -0
  42. package/internal/qs/utils.d.mts +15 -0
  43. package/internal/qs/utils.d.mts.map +1 -0
  44. package/internal/qs/utils.d.ts +15 -0
  45. package/internal/qs/utils.d.ts.map +1 -0
  46. package/internal/qs/utils.js +230 -0
  47. package/internal/qs/utils.js.map +1 -0
  48. package/internal/qs/utils.mjs +217 -0
  49. package/internal/qs/utils.mjs.map +1 -0
  50. package/internal/types.d.mts +6 -6
  51. package/internal/types.d.mts.map +1 -1
  52. package/internal/types.d.ts +6 -6
  53. package/internal/types.d.ts.map +1 -1
  54. package/internal/utils/query.d.mts +0 -3
  55. package/internal/utils/query.d.mts.map +1 -1
  56. package/internal/utils/query.d.ts +0 -3
  57. package/internal/utils/query.d.ts.map +1 -1
  58. package/internal/utils/query.js +3 -16
  59. package/internal/utils/query.js.map +1 -1
  60. package/internal/utils/query.mjs +2 -16
  61. package/internal/utils/query.mjs.map +1 -1
  62. package/package.json +1 -1
  63. package/resources/beta/beta.d.mts +11 -19
  64. package/resources/beta/beta.d.mts.map +1 -1
  65. package/resources/beta/beta.d.ts +11 -19
  66. package/resources/beta/beta.d.ts.map +1 -1
  67. package/resources/beta/beta.js +2 -0
  68. package/resources/beta/beta.js.map +1 -1
  69. package/resources/beta/beta.mjs +2 -0
  70. package/resources/beta/beta.mjs.map +1 -1
  71. package/resources/beta/findall.d.mts +127 -177
  72. package/resources/beta/findall.d.mts.map +1 -1
  73. package/resources/beta/findall.d.ts +127 -177
  74. package/resources/beta/findall.d.ts.map +1 -1
  75. package/resources/beta/findall.js +2 -4
  76. package/resources/beta/findall.js.map +1 -1
  77. package/resources/beta/findall.mjs +2 -4
  78. package/resources/beta/findall.mjs.map +1 -1
  79. package/resources/beta/index.d.mts +2 -2
  80. package/resources/beta/index.d.mts.map +1 -1
  81. package/resources/beta/index.d.ts +2 -2
  82. package/resources/beta/index.d.ts.map +1 -1
  83. package/resources/beta/index.js.map +1 -1
  84. package/resources/beta/index.mjs.map +1 -1
  85. package/resources/beta/task-group.d.mts +22 -143
  86. package/resources/beta/task-group.d.mts.map +1 -1
  87. package/resources/beta/task-group.d.ts +22 -143
  88. package/resources/beta/task-group.d.ts.map +1 -1
  89. package/resources/beta/task-group.js +7 -42
  90. package/resources/beta/task-group.js.map +1 -1
  91. package/resources/beta/task-group.mjs +7 -42
  92. package/resources/beta/task-group.mjs.map +1 -1
  93. package/resources/beta/task-run.d.mts +22 -70
  94. package/resources/beta/task-run.d.mts.map +1 -1
  95. package/resources/beta/task-run.d.ts +22 -70
  96. package/resources/beta/task-run.d.ts.map +1 -1
  97. package/resources/beta/task-run.js +1 -1
  98. package/resources/beta/task-run.mjs +1 -1
  99. package/resources/index.d.mts +4 -2
  100. package/resources/index.d.mts.map +1 -1
  101. package/resources/index.d.ts +4 -2
  102. package/resources/index.d.ts.map +1 -1
  103. package/resources/index.js +5 -1
  104. package/resources/index.js.map +1 -1
  105. package/resources/index.mjs +2 -0
  106. package/resources/index.mjs.map +1 -1
  107. package/resources/monitor.d.mts +625 -0
  108. package/resources/monitor.d.mts.map +1 -0
  109. package/resources/monitor.d.ts +625 -0
  110. package/resources/monitor.d.ts.map +1 -0
  111. package/resources/monitor.js +140 -0
  112. package/resources/monitor.js.map +1 -0
  113. package/resources/monitor.mjs +136 -0
  114. package/resources/monitor.mjs.map +1 -0
  115. package/resources/task-group.d.mts +213 -0
  116. package/resources/task-group.d.mts.map +1 -0
  117. package/resources/task-group.d.ts +213 -0
  118. package/resources/task-group.d.ts.map +1 -0
  119. package/resources/task-group.js +95 -0
  120. package/resources/task-group.js.map +1 -0
  121. package/resources/task-group.mjs +91 -0
  122. package/resources/task-group.mjs.map +1 -0
  123. package/resources/task-run.d.mts +97 -80
  124. package/resources/task-run.d.mts.map +1 -1
  125. package/resources/task-run.d.ts +97 -80
  126. package/resources/task-run.d.ts.map +1 -1
  127. package/resources/task-run.js +14 -1
  128. package/resources/task-run.js.map +1 -1
  129. package/resources/task-run.mjs +14 -1
  130. package/resources/task-run.mjs.map +1 -1
  131. package/resources/top-level.d.mts +19 -15
  132. package/resources/top-level.d.mts.map +1 -1
  133. package/resources/top-level.d.ts +19 -15
  134. package/resources/top-level.d.ts.map +1 -1
  135. package/src/client.ts +120 -4
  136. package/src/internal/qs/LICENSE.md +13 -0
  137. package/src/internal/qs/README.md +3 -0
  138. package/src/internal/qs/formats.ts +10 -0
  139. package/src/internal/qs/index.ts +13 -0
  140. package/src/internal/qs/stringify.ts +385 -0
  141. package/src/internal/qs/types.ts +71 -0
  142. package/src/internal/qs/utils.ts +265 -0
  143. package/src/internal/types.ts +6 -8
  144. package/src/internal/utils/query.ts +2 -18
  145. package/src/resources/beta/api.md +9 -5
  146. package/src/resources/beta/beta.ts +26 -20
  147. package/src/resources/beta/findall.ts +153 -202
  148. package/src/resources/beta/index.ts +7 -4
  149. package/src/resources/beta/task-group.ts +30 -157
  150. package/src/resources/beta/task-run.ts +26 -86
  151. package/src/resources/index.ts +42 -0
  152. package/src/resources/monitor.ts +752 -0
  153. package/src/resources/task-group.ts +315 -0
  154. package/src/resources/task-run.ts +122 -95
  155. package/src/resources/top-level.ts +23 -15
  156. package/src/version.ts +1 -1
  157. package/version.d.mts +1 -1
  158. package/version.d.ts +1 -1
  159. package/version.js +1 -1
  160. package/version.mjs +1 -1
@@ -0,0 +1,315 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as TaskRunAPI from './task-run';
5
+ import * as BetaTaskRunAPI from './beta/task-run';
6
+ import { APIPromise } from '../core/api-promise';
7
+ import { Stream } from '../core/streaming';
8
+ import { buildHeaders } from '../internal/headers';
9
+ import { RequestOptions } from '../internal/request-options';
10
+ import { path } from '../internal/utils/path';
11
+
12
+ /**
13
+ * The Task API executes web research and extraction tasks. Clients submit a natural-language objective with an optional input schema; the service plans retrieval, fetches relevant URLs, and returns outputs that conform to a provided or inferred JSON schema. Supports deep research style queries and can return rich structured JSON outputs. Processors trade-off between cost, latency, and quality. Each processor supports calibrated confidences.
14
+ * - Output metadata: citations, excerpts, reasoning, and confidence per field
15
+ *
16
+ * Task Groups enable batch execution of many independent Task runs with group-level monitoring and failure handling.
17
+ * - Submit hundreds or thousands of Tasks as a single group
18
+ * - Observe group progress and receive results as they complete
19
+ * - Real-time updates via Server-Sent Events (SSE)
20
+ * - Add tasks to an existing group while it is running
21
+ * - Group-level retry and error aggregation
22
+ */
23
+ export class TaskGroup extends APIResource {
24
+ /**
25
+ * Initiates a TaskGroup to group and track multiple runs.
26
+ */
27
+ create(body: TaskGroupCreateParams, options?: RequestOptions): APIPromise<TaskGroup> {
28
+ return this._client.post('/v1/tasks/groups', { body, ...options });
29
+ }
30
+
31
+ /**
32
+ * Retrieves aggregated status across runs in a TaskGroup.
33
+ */
34
+ retrieve(taskGroupID: string, options?: RequestOptions): APIPromise<TaskGroup> {
35
+ return this._client.get(path`/v1/tasks/groups/${taskGroupID}`, options);
36
+ }
37
+
38
+ /**
39
+ * Initiates multiple task runs within a TaskGroup.
40
+ */
41
+ addRuns(
42
+ taskGroupID: string,
43
+ params: TaskGroupAddRunsParams,
44
+ options?: RequestOptions,
45
+ ): APIPromise<TaskGroupRunResponse> {
46
+ const { refresh_status, betas, ...body } = params;
47
+ return this._client.post(path`/v1/tasks/groups/${taskGroupID}/runs`, {
48
+ query: { refresh_status },
49
+ body,
50
+ ...options,
51
+ headers: buildHeaders([
52
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
53
+ options?.headers,
54
+ ]),
55
+ });
56
+ }
57
+
58
+ /**
59
+ * Streams events from a TaskGroup: status updates and run completions.
60
+ *
61
+ * The connection will remain open for up to an hour as long as at least one run in
62
+ * the group is still active.
63
+ */
64
+ events(
65
+ taskGroupID: string,
66
+ query: TaskGroupEventsParams | undefined = {},
67
+ options?: RequestOptions,
68
+ ): APIPromise<Stream<TaskGroupEventsResponse>> {
69
+ return this._client.get(path`/v1/tasks/groups/${taskGroupID}/events`, {
70
+ query,
71
+ ...options,
72
+ headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
73
+ stream: true,
74
+ }) as APIPromise<Stream<TaskGroupEventsResponse>>;
75
+ }
76
+
77
+ /**
78
+ * Retrieves task runs in a TaskGroup and optionally their inputs and outputs.
79
+ *
80
+ * All runs within a TaskGroup are returned as a stream. To get the inputs and/or
81
+ * outputs back in the stream, set the corresponding `include_input` and
82
+ * `include_output` parameters to `true`.
83
+ *
84
+ * The stream is resumable using the `event_id` as the cursor. To resume a stream,
85
+ * specify the `last_event_id` parameter with the `event_id` of the last event in
86
+ * the stream. The stream will resume from the next event after the
87
+ * `last_event_id`.
88
+ */
89
+ getRuns(
90
+ taskGroupID: string,
91
+ query: TaskGroupGetRunsParams | undefined = {},
92
+ options?: RequestOptions,
93
+ ): APIPromise<Stream<TaskGroupGetRunsResponse>> {
94
+ return this._client.get(path`/v1/tasks/groups/${taskGroupID}/runs`, {
95
+ query,
96
+ ...options,
97
+ headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
98
+ stream: true,
99
+ }) as APIPromise<Stream<TaskGroupGetRunsResponse>>;
100
+ }
101
+
102
+ /**
103
+ * Retrieves run status by run_id.
104
+ *
105
+ * This endpoint is equivalent to fetching run status directly using the
106
+ * `retrieve()` method or the `tasks/runs` GET endpoint.
107
+ *
108
+ * The run result is available from the `/result` endpoint.
109
+ */
110
+ retrieveRun(
111
+ runID: string,
112
+ params: TaskGroupRetrieveRunParams,
113
+ options?: RequestOptions,
114
+ ): APIPromise<TaskRunAPI.TaskRun> {
115
+ const { taskgroup_id } = params;
116
+ return this._client.get(path`/v1/tasks/groups/${taskgroup_id}/runs/${runID}`, options);
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Response object for a task group, including its status and metadata.
122
+ */
123
+ export interface TaskGroup {
124
+ /**
125
+ * Timestamp of the creation of the group, as an RFC 3339 string.
126
+ */
127
+ created_at: string | null;
128
+
129
+ /**
130
+ * Status of the group.
131
+ */
132
+ status: TaskGroupStatus;
133
+
134
+ /**
135
+ * ID of the group.
136
+ */
137
+ taskgroup_id: string;
138
+
139
+ /**
140
+ * User-provided metadata stored with the group.
141
+ */
142
+ metadata?: { [key: string]: string | number | boolean } | null;
143
+ }
144
+
145
+ /**
146
+ * Response from adding new task runs to a task group.
147
+ */
148
+ export interface TaskGroupRunResponse {
149
+ /**
150
+ * Cursor for these runs in the event stream at
151
+ * taskgroup/events?last_event_id=<event_cursor>. Empty for the first runs in the
152
+ * group.
153
+ */
154
+ event_cursor: string | null;
155
+
156
+ /**
157
+ * Cursor for these runs in the run stream at
158
+ * taskgroup/runs?last_event_id=<run_cursor>. Empty for the first runs in the
159
+ * group.
160
+ */
161
+ run_cursor: string | null;
162
+
163
+ /**
164
+ * IDs of the newly created runs.
165
+ */
166
+ run_ids: Array<string>;
167
+
168
+ /**
169
+ * Status of the group.
170
+ */
171
+ status: TaskGroupStatus;
172
+ }
173
+
174
+ /**
175
+ * Status of a task group.
176
+ */
177
+ export interface TaskGroupStatus {
178
+ /**
179
+ * True if at least one run in the group is currently active, i.e. status is one of
180
+ * {'cancelling', 'queued', 'running'}.
181
+ */
182
+ is_active: boolean;
183
+
184
+ /**
185
+ * Timestamp of the last status update to the group, as an RFC 3339 string.
186
+ */
187
+ modified_at: string | null;
188
+
189
+ /**
190
+ * Number of task runs in the group.
191
+ */
192
+ num_task_runs: number;
193
+
194
+ /**
195
+ * Human-readable status message for the group.
196
+ */
197
+ status_message: string | null;
198
+
199
+ /**
200
+ * Number of task runs with each status.
201
+ */
202
+ task_run_status_counts: { [key: string]: number };
203
+ }
204
+
205
+ /**
206
+ * Event indicating an update to group status.
207
+ */
208
+ export interface TaskGroupStatusEvent {
209
+ /**
210
+ * Cursor to resume the event stream.
211
+ */
212
+ event_id: string;
213
+
214
+ /**
215
+ * Task group status object.
216
+ */
217
+ status: TaskGroupStatus;
218
+
219
+ /**
220
+ * Event type; always 'task_group_status'.
221
+ */
222
+ type: 'task_group_status';
223
+ }
224
+
225
+ /**
226
+ * Event indicating an update to group status.
227
+ */
228
+ export type TaskGroupEventsResponse = TaskGroupStatusEvent | TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
229
+
230
+ /**
231
+ * Event when a task run transitions to a non-active status.
232
+ *
233
+ * May indicate completion, cancellation, or failure.
234
+ */
235
+ export type TaskGroupGetRunsResponse = TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
236
+
237
+ export interface TaskGroupCreateParams {
238
+ /**
239
+ * User-provided metadata stored with the task group.
240
+ */
241
+ metadata?: { [key: string]: string | number | boolean } | null;
242
+ }
243
+
244
+ export interface TaskGroupAddRunsParams {
245
+ /**
246
+ * Body param: List of task runs to execute. Up to 1,000 runs can be specified per
247
+ * request. If you'd like to add more runs, split them across multiple TaskGroup
248
+ * POST requests.
249
+ */
250
+ inputs: Array<TaskRunAPI.RunInput>;
251
+
252
+ /**
253
+ * Query param
254
+ */
255
+ refresh_status?: boolean;
256
+
257
+ /**
258
+ * Body param: Specification for a task.
259
+ *
260
+ * Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
261
+ * Not specifying a TaskSpec is the same as setting an auto output schema.
262
+ *
263
+ * For convenience bare strings are also accepted as input or output schemas.
264
+ */
265
+ default_task_spec?: TaskRunAPI.TaskSpec | null;
266
+
267
+ /**
268
+ * Header param: Optional header to specify the beta version(s) to enable.
269
+ */
270
+ betas?: Array<BetaTaskRunAPI.ParallelBeta>;
271
+ }
272
+
273
+ export interface TaskGroupEventsParams {
274
+ last_event_id?: string | null;
275
+
276
+ timeout?: number | null;
277
+ }
278
+
279
+ export interface TaskGroupGetRunsParams {
280
+ include_input?: boolean;
281
+
282
+ include_output?: boolean;
283
+
284
+ last_event_id?: string | null;
285
+
286
+ status?:
287
+ | 'queued'
288
+ | 'action_required'
289
+ | 'running'
290
+ | 'completed'
291
+ | 'failed'
292
+ | 'cancelling'
293
+ | 'cancelled'
294
+ | null;
295
+ }
296
+
297
+ export interface TaskGroupRetrieveRunParams {
298
+ taskgroup_id: string;
299
+ }
300
+
301
+ export declare namespace TaskGroup {
302
+ export {
303
+ type TaskGroup as TaskGroup,
304
+ type TaskGroupRunResponse as TaskGroupRunResponse,
305
+ type TaskGroupStatus as TaskGroupStatus,
306
+ type TaskGroupStatusEvent as TaskGroupStatusEvent,
307
+ type TaskGroupEventsResponse as TaskGroupEventsResponse,
308
+ type TaskGroupGetRunsResponse as TaskGroupGetRunsResponse,
309
+ type TaskGroupCreateParams as TaskGroupCreateParams,
310
+ type TaskGroupAddRunsParams as TaskGroupAddRunsParams,
311
+ type TaskGroupEventsParams as TaskGroupEventsParams,
312
+ type TaskGroupGetRunsParams as TaskGroupGetRunsParams,
313
+ type TaskGroupRetrieveRunParams as TaskGroupRetrieveRunParams,
314
+ };
315
+ }
@@ -14,7 +14,7 @@ import { path } from '../internal/utils/path';
14
14
  * - Output metadata: citations, excerpts, reasoning, and confidence per field
15
15
  *
16
16
  * Task Groups enable batch execution of many independent Task runs with group-level monitoring and failure handling.
17
- * - Submit hundreds or thousands of Tasks as a single group
17
+ * - Submit hundreds or thousands of Tasks as a single group
18
18
  * - Observe group progress and receive results as they complete
19
19
  * - Real-time updates via Server-Sent Events (SSE)
20
20
  * - Add tasks to an existing group while it is running
@@ -107,6 +107,20 @@ export class TaskRun extends APIResource {
107
107
  ]),
108
108
  });
109
109
  }
110
+
111
+ /**
112
+ * Retrieves the input of a run by run_id.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const runInput = await client.taskRun.retrieveInput(
117
+ * 'run_id',
118
+ * );
119
+ * ```
120
+ */
121
+ retrieveInput(runID: string, options?: RequestOptions): APIPromise<RunInput> {
122
+ return this._client.get(path`/v1/tasks/runs/${runID}/input`, options);
123
+ }
110
124
  }
111
125
 
112
126
  /**
@@ -278,7 +292,7 @@ export interface RunInput {
278
292
  /**
279
293
  * Advanced search configuration for a task run.
280
294
  */
281
- advanced_settings?: RunInput.AdvancedSettings | null;
295
+ advanced_settings?: TaskAdvancedSettings | null;
282
296
 
283
297
  /**
284
298
  * Controls tracking of task run execution progress. When set to true, progress
@@ -329,16 +343,14 @@ export interface RunInput {
329
343
  webhook?: Webhook | null;
330
344
  }
331
345
 
332
- export namespace RunInput {
346
+ /**
347
+ * Advanced search configuration for a task run.
348
+ */
349
+ export interface TaskAdvancedSettings {
333
350
  /**
334
- * Advanced search configuration for a task run.
351
+ * ISO 3166-1 alpha-2 country code for geo-targeted search results.
335
352
  */
336
- export interface AdvancedSettings {
337
- /**
338
- * ISO 3166-1 alpha-2 country code for geo-targeted search results.
339
- */
340
- location?: string | null;
341
- }
353
+ location?: string | null;
342
354
  }
343
355
 
344
356
  /**
@@ -476,6 +488,52 @@ export interface TaskRunJsonOutput {
476
488
  output_schema?: { [key: string]: unknown } | null;
477
489
  }
478
490
 
491
+ /**
492
+ * A message for a task run progress update.
493
+ */
494
+ export interface TaskRunProgressMessageEvent {
495
+ /**
496
+ * Progress update message.
497
+ */
498
+ message: string;
499
+
500
+ /**
501
+ * Timestamp of the message.
502
+ */
503
+ timestamp: string | null;
504
+
505
+ /**
506
+ * Event type; always starts with 'task_run.progress_msg'.
507
+ */
508
+ type:
509
+ | 'task_run.progress_msg.plan'
510
+ | 'task_run.progress_msg.search'
511
+ | 'task_run.progress_msg.result'
512
+ | 'task_run.progress_msg.tool_call'
513
+ | 'task_run.progress_msg.exec_status';
514
+ }
515
+
516
+ /**
517
+ * A progress update for a task run.
518
+ */
519
+ export interface TaskRunProgressStatsEvent {
520
+ /**
521
+ * Completion percentage of the task run. Ranges from 0 to 100 where 0 indicates no
522
+ * progress and 100 indicates completion.
523
+ */
524
+ progress_meter: number;
525
+
526
+ /**
527
+ * Source stats describing progress so far.
528
+ */
529
+ source_stats: TaskRunSourceStats;
530
+
531
+ /**
532
+ * Event type; always 'task_run.progress_stats'.
533
+ */
534
+ type: 'task_run.progress_stats';
535
+ }
536
+
479
537
  /**
480
538
  * Result of a task run.
481
539
  */
@@ -491,6 +549,26 @@ export interface TaskRunResult {
491
549
  run: TaskRun;
492
550
  }
493
551
 
552
+ /**
553
+ * Source stats for a task run.
554
+ */
555
+ export interface TaskRunSourceStats {
556
+ /**
557
+ * Number of sources considered in processing the task.
558
+ */
559
+ num_sources_considered: number | null;
560
+
561
+ /**
562
+ * Number of sources read in processing the task.
563
+ */
564
+ num_sources_read: number | null;
565
+
566
+ /**
567
+ * A sample of URLs of sources read in processing the task.
568
+ */
569
+ sources_read_sample: Array<string> | null;
570
+ }
571
+
494
572
  /**
495
573
  * Output from a task that returns text.
496
574
  */
@@ -581,81 +659,11 @@ export interface Webhook {
581
659
  * A progress update for a task run.
582
660
  */
583
661
  export type TaskRunEventsResponse =
584
- | TaskRunEventsResponse.TaskRunProgressStatsEvent
585
- | TaskRunEventsResponse.TaskRunProgressMessageEvent
662
+ | TaskRunProgressStatsEvent
663
+ | TaskRunProgressMessageEvent
586
664
  | TaskRunEvent
587
665
  | ErrorEvent;
588
666
 
589
- export namespace TaskRunEventsResponse {
590
- /**
591
- * A progress update for a task run.
592
- */
593
- export interface TaskRunProgressStatsEvent {
594
- /**
595
- * Completion percentage of the task run. Ranges from 0 to 100 where 0 indicates no
596
- * progress and 100 indicates completion.
597
- */
598
- progress_meter: number;
599
-
600
- /**
601
- * Source stats describing progress so far.
602
- */
603
- source_stats: TaskRunProgressStatsEvent.SourceStats;
604
-
605
- /**
606
- * Event type; always 'task_run.progress_stats'.
607
- */
608
- type: 'task_run.progress_stats';
609
- }
610
-
611
- export namespace TaskRunProgressStatsEvent {
612
- /**
613
- * Source stats describing progress so far.
614
- */
615
- export interface SourceStats {
616
- /**
617
- * Number of sources considered in processing the task.
618
- */
619
- num_sources_considered: number | null;
620
-
621
- /**
622
- * Number of sources read in processing the task.
623
- */
624
- num_sources_read: number | null;
625
-
626
- /**
627
- * A sample of URLs of sources read in processing the task.
628
- */
629
- sources_read_sample: Array<string> | null;
630
- }
631
- }
632
-
633
- /**
634
- * A message for a task run progress update.
635
- */
636
- export interface TaskRunProgressMessageEvent {
637
- /**
638
- * Progress update message.
639
- */
640
- message: string;
641
-
642
- /**
643
- * Timestamp of the message.
644
- */
645
- timestamp: string | null;
646
-
647
- /**
648
- * Event type; always starts with 'task_run.progress_msg'.
649
- */
650
- type:
651
- | 'task_run.progress_msg.plan'
652
- | 'task_run.progress_msg.search'
653
- | 'task_run.progress_msg.result'
654
- | 'task_run.progress_msg.tool_call'
655
- | 'task_run.progress_msg.exec_status';
656
- }
657
- }
658
-
659
667
  export interface TaskRunCreateParams {
660
668
  /**
661
669
  * Body param: Input to the task, either text or a JSON object.
@@ -670,7 +678,7 @@ export interface TaskRunCreateParams {
670
678
  /**
671
679
  * Body param: Advanced search configuration for a task run.
672
680
  */
673
- advanced_settings?: TaskRunCreateParams.AdvancedSettings | null;
681
+ advanced_settings?: TaskAdvancedSettings | null;
674
682
 
675
683
  /**
676
684
  * Body param: Controls tracking of task run execution progress. When set to true,
@@ -726,18 +734,6 @@ export interface TaskRunCreateParams {
726
734
  betas?: Array<BetaTaskRunAPI.ParallelBeta>;
727
735
  }
728
736
 
729
- export namespace TaskRunCreateParams {
730
- /**
731
- * Advanced search configuration for a task run.
732
- */
733
- export interface AdvancedSettings {
734
- /**
735
- * ISO 3166-1 alpha-2 country code for geo-targeted search results.
736
- */
737
- location?: string | null;
738
- }
739
- }
740
-
741
737
  export interface TaskRunResultParams {
742
738
  /**
743
739
  * Query param
@@ -760,10 +756,14 @@ export declare namespace TaskRun {
760
756
  type McpServer as McpServer,
761
757
  type McpToolCall as McpToolCall,
762
758
  type RunInput as RunInput,
759
+ type TaskAdvancedSettings as TaskAdvancedSettings,
763
760
  type TaskRun as TaskRun,
764
761
  type TaskRunEvent as TaskRunEvent,
765
762
  type TaskRunJsonOutput as TaskRunJsonOutput,
763
+ type TaskRunProgressMessageEvent as TaskRunProgressMessageEvent,
764
+ type TaskRunProgressStatsEvent as TaskRunProgressStatsEvent,
766
765
  type TaskRunResult as TaskRunResult,
766
+ type TaskRunSourceStats as TaskRunSourceStats,
767
767
  type TaskRunTextOutput as TaskRunTextOutput,
768
768
  type TaskSpec as TaskSpec,
769
769
  type TextSchema as TextSchema,
@@ -773,3 +773,30 @@ export declare namespace TaskRun {
773
773
  type TaskRunResultParams as TaskRunResultParams,
774
774
  };
775
775
  }
776
+
777
+ // Backwards-compat namespace members (deprecated). Previously these types
778
+ // existed as nested interfaces under the parent type's namespace; they've
779
+ // since moved to top-level model types. Declaration merging here preserves
780
+ // the old `Parent.Member` import paths.
781
+ type _TaskAdvancedSettings = TaskAdvancedSettings;
782
+ type _TaskRunProgressMessageEvent = TaskRunProgressMessageEvent;
783
+ type _TaskRunProgressStatsEvent = TaskRunProgressStatsEvent;
784
+ type _TaskRunSourceStats = TaskRunSourceStats;
785
+ export namespace RunInput {
786
+ /** @deprecated Use the top-level `TaskAdvancedSettings` instead. */
787
+ export type AdvancedSettings = _TaskAdvancedSettings;
788
+ }
789
+ export namespace TaskRunCreateParams {
790
+ /** @deprecated Use the top-level `TaskAdvancedSettings` instead. */
791
+ export type AdvancedSettings = _TaskAdvancedSettings;
792
+ }
793
+ export namespace TaskRunEventsResponse {
794
+ /** @deprecated Use the top-level `TaskRunProgressMessageEvent` instead. */
795
+ export type TaskRunProgressMessageEvent = _TaskRunProgressMessageEvent;
796
+ /** @deprecated Use the top-level `TaskRunProgressStatsEvent` instead. */
797
+ export type TaskRunProgressStatsEvent = _TaskRunProgressStatsEvent;
798
+ export namespace TaskRunProgressStatsEvent {
799
+ /** @deprecated Use the top-level `TaskRunSourceStats` instead. */
800
+ export type SourceStats = _TaskRunSourceStats;
801
+ }
802
+ }
@@ -23,21 +23,7 @@ export interface AdvancedExtractSettings {
23
23
  * Controls full content extraction. Set to true to enable with defaults, false to
24
24
  * disable, or provide FullContentSettings for fine-grained control.
25
25
  */
26
- full_content?: AdvancedExtractSettings.FullContentSettings | boolean;
27
- }
28
-
29
- export namespace AdvancedExtractSettings {
30
- /**
31
- * Optional settings for returning full content.
32
- */
33
- export interface FullContentSettings {
34
- /**
35
- * Optional limit on the number of characters to include in the full content for
36
- * each url. Full content always starts at the beginning of the page and is
37
- * truncated at the limit if necessary.
38
- */
39
- max_chars_per_result?: number | null;
40
- }
26
+ full_content?: FullContentSettings | boolean;
41
27
  }
42
28
 
43
29
  /**
@@ -198,6 +184,18 @@ export interface FetchPolicy {
198
184
  timeout_seconds?: number | null;
199
185
  }
200
186
 
187
+ /**
188
+ * Optional settings for returning full content.
189
+ */
190
+ export interface FullContentSettings {
191
+ /**
192
+ * Optional limit on the number of characters to include in the full content for
193
+ * each url. Full content always starts at the beginning of the page and is
194
+ * truncated at the limit if necessary.
195
+ */
196
+ max_chars_per_result?: number | null;
197
+ }
198
+
201
199
  /**
202
200
  * Search response.
203
201
  */
@@ -376,6 +374,7 @@ export declare namespace TopLevel {
376
374
  type ExtractResponse as ExtractResponse,
377
375
  type ExtractResult as ExtractResult,
378
376
  type FetchPolicy as FetchPolicy,
377
+ type FullContentSettings as FullContentSettings,
379
378
  type SearchResult as SearchResult,
380
379
  type UsageItem as UsageItem,
381
380
  type WebSearchResult as WebSearchResult,
@@ -383,3 +382,12 @@ export declare namespace TopLevel {
383
382
  type SearchParams as SearchParams,
384
383
  };
385
384
  }
385
+
386
+ // Backwards-compat namespace member (deprecated). `AdvancedExtractSettings.FullContentSettings`
387
+ // was previously a nested interface; the shape now lives as the top-level
388
+ // `FullContentSettings` model. Declaration merging here preserves the old path.
389
+ export namespace AdvancedExtractSettings {
390
+ /** @deprecated Use the top-level `FullContentSettings` instead. */
391
+ export type FullContentSettings = TopLevelFullContentSettings;
392
+ }
393
+ type TopLevelFullContentSettings = FullContentSettings;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.4.1'; // x-release-please-version
1
+ export const VERSION = '0.5.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.4.1";
1
+ export declare const VERSION = "0.5.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.4.1";
1
+ export declare const VERSION = "0.5.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.4.1'; // x-release-please-version
4
+ exports.VERSION = '0.5.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.4.1'; // x-release-please-version
1
+ export const VERSION = '0.5.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map