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,140 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MonitorResource = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const headers_1 = require("../internal/headers.js");
7
+ const path_1 = require("../internal/utils/path.js");
8
+ /**
9
+ * The Monitor API watches the web for material changes on a fixed frequency. Each monitor runs once on creation and then on its configured schedule, emitting events when meaningful changes are detected.
10
+ * - `event_stream` monitors track a search query and emit an event for each new material change.
11
+ * - `snapshot` monitors track a specific task run's output and emit an event when the output changes.
12
+ *
13
+ * Results can be polled via the events endpoint or delivered via webhooks.
14
+ */
15
+ class MonitorResource extends resource_1.APIResource {
16
+ /**
17
+ * Create a monitor.
18
+ *
19
+ * Monitors run on a fixed frequency to detect material changes in web content. Set
20
+ * `type=event_stream` to monitor a search query, or `type=snapshot` to monitor a
21
+ * specific task run's output. The monitor runs once immediately at creation, then
22
+ * continues on the configured schedule.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const monitor = await client.monitor.create({
27
+ * frequency: '1h',
28
+ * settings: { query: 'Extract recent news about AI' },
29
+ * type: 'event_stream',
30
+ * });
31
+ * ```
32
+ */
33
+ create(body, options) {
34
+ return this._client.post('/v1/monitors', { body, ...options });
35
+ }
36
+ /**
37
+ * Retrieve a monitor.
38
+ *
39
+ * Retrieves a specific monitor by `monitor_id`. Returns the monitor configuration
40
+ * including status, frequency, query, and webhook settings.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const monitor = await client.monitor.retrieve('monitor_id');
45
+ * ```
46
+ */
47
+ retrieve(monitorID, options) {
48
+ return this._client.get((0, path_1.path) `/v1/monitors/${monitorID}`, options);
49
+ }
50
+ /**
51
+ * Update a monitor.
52
+ *
53
+ * Only fields explicitly included in the request body are changed. Pass `null` for
54
+ * `webhook` or `metadata` to clear those fields. Pass `type` and `settings` to
55
+ * update type-specific settings on an `event_stream` monitor. At least one field
56
+ * must be provided. Cancelled monitors cannot be updated.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const monitor = await client.monitor.update('monitor_id');
61
+ * ```
62
+ */
63
+ update(monitorID, body, options) {
64
+ return this._client.post((0, path_1.path) `/v1/monitors/${monitorID}/update`, { body, ...options });
65
+ }
66
+ /**
67
+ * List monitors ordered by creation time, newest first.
68
+ *
69
+ * Monitors are sorted by `created_at` descending. `limit` defaults to 100. Use
70
+ * `next_cursor` from the response and pass it as `cursor` to fetch the next page.
71
+ * Pagination ends when `next_cursor` is absent.
72
+ *
73
+ * By default only `active` monitors are returned. Pass `status=cancelled` or both
74
+ * values to include cancelled monitors.
75
+ *
76
+ * The legacy Monitor API (`/v1alpha/monitors` endpoints) is documented under the
77
+ * `Monitor (Alpha)` tag.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const paginatedMonitorResponse =
82
+ * await client.monitor.list();
83
+ * ```
84
+ */
85
+ list(query = {}, options) {
86
+ return this._client.get('/v1/monitors', { query, ...options });
87
+ }
88
+ /**
89
+ * Cancel a monitor.
90
+ *
91
+ * Permanently stops the monitor from running. Cancellation is irreversible —
92
+ * create a new monitor to resume monitoring. Cancelling an already-cancelled
93
+ * monitor is a no-op.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const monitor = await client.monitor.cancel('monitor_id');
98
+ * ```
99
+ */
100
+ cancel(monitorID, options) {
101
+ return this._client.post((0, path_1.path) `/v1/monitors/${monitorID}/cancel`, options);
102
+ }
103
+ /**
104
+ * List events for a monitor, newest first.
105
+ *
106
+ * Pass `event_group_id` to narrow results to a single execution. Otherwise returns
107
+ * all executions newest-first; use `next_cursor` to paginate. Set
108
+ * `include_completions=true` to also include no-change executions.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const paginatedMonitorEvents = await client.monitor.events(
113
+ * 'monitor_id',
114
+ * );
115
+ * ```
116
+ */
117
+ events(monitorID, query = {}, options) {
118
+ return this._client.get((0, path_1.path) `/v1/monitors/${monitorID}/events`, { query, ...options });
119
+ }
120
+ /**
121
+ * Trigger an immediate monitor run.
122
+ *
123
+ * Enqueues a one-off execution of the monitor outside its normal schedule. The
124
+ * monitor's regular schedule is not affected. An event is only emitted if the
125
+ * execution detects a material change. Cancelled monitors cannot be triggered.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * await client.monitor.trigger('monitor_id');
130
+ * ```
131
+ */
132
+ trigger(monitorID, options) {
133
+ return this._client.post((0, path_1.path) `/v1/monitors/${monitorID}/trigger`, {
134
+ ...options,
135
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
136
+ });
137
+ }
138
+ }
139
+ exports.MonitorResource = MonitorResource;
140
+ //# sourceMappingURL=monitor.js.map
@@ -0,0 +1 @@
1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,EAClD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,SAAiB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,UAAU,EAAE;YAChE,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAxID,0CAwIC"}
@@ -0,0 +1,136 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { buildHeaders } from "../internal/headers.mjs";
4
+ import { path } from "../internal/utils/path.mjs";
5
+ /**
6
+ * The Monitor API watches the web for material changes on a fixed frequency. Each monitor runs once on creation and then on its configured schedule, emitting events when meaningful changes are detected.
7
+ * - `event_stream` monitors track a search query and emit an event for each new material change.
8
+ * - `snapshot` monitors track a specific task run's output and emit an event when the output changes.
9
+ *
10
+ * Results can be polled via the events endpoint or delivered via webhooks.
11
+ */
12
+ export class MonitorResource extends APIResource {
13
+ /**
14
+ * Create a monitor.
15
+ *
16
+ * Monitors run on a fixed frequency to detect material changes in web content. Set
17
+ * `type=event_stream` to monitor a search query, or `type=snapshot` to monitor a
18
+ * specific task run's output. The monitor runs once immediately at creation, then
19
+ * continues on the configured schedule.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const monitor = await client.monitor.create({
24
+ * frequency: '1h',
25
+ * settings: { query: 'Extract recent news about AI' },
26
+ * type: 'event_stream',
27
+ * });
28
+ * ```
29
+ */
30
+ create(body, options) {
31
+ return this._client.post('/v1/monitors', { body, ...options });
32
+ }
33
+ /**
34
+ * Retrieve a monitor.
35
+ *
36
+ * Retrieves a specific monitor by `monitor_id`. Returns the monitor configuration
37
+ * including status, frequency, query, and webhook settings.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const monitor = await client.monitor.retrieve('monitor_id');
42
+ * ```
43
+ */
44
+ retrieve(monitorID, options) {
45
+ return this._client.get(path `/v1/monitors/${monitorID}`, options);
46
+ }
47
+ /**
48
+ * Update a monitor.
49
+ *
50
+ * Only fields explicitly included in the request body are changed. Pass `null` for
51
+ * `webhook` or `metadata` to clear those fields. Pass `type` and `settings` to
52
+ * update type-specific settings on an `event_stream` monitor. At least one field
53
+ * must be provided. Cancelled monitors cannot be updated.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const monitor = await client.monitor.update('monitor_id');
58
+ * ```
59
+ */
60
+ update(monitorID, body, options) {
61
+ return this._client.post(path `/v1/monitors/${monitorID}/update`, { body, ...options });
62
+ }
63
+ /**
64
+ * List monitors ordered by creation time, newest first.
65
+ *
66
+ * Monitors are sorted by `created_at` descending. `limit` defaults to 100. Use
67
+ * `next_cursor` from the response and pass it as `cursor` to fetch the next page.
68
+ * Pagination ends when `next_cursor` is absent.
69
+ *
70
+ * By default only `active` monitors are returned. Pass `status=cancelled` or both
71
+ * values to include cancelled monitors.
72
+ *
73
+ * The legacy Monitor API (`/v1alpha/monitors` endpoints) is documented under the
74
+ * `Monitor (Alpha)` tag.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const paginatedMonitorResponse =
79
+ * await client.monitor.list();
80
+ * ```
81
+ */
82
+ list(query = {}, options) {
83
+ return this._client.get('/v1/monitors', { query, ...options });
84
+ }
85
+ /**
86
+ * Cancel a monitor.
87
+ *
88
+ * Permanently stops the monitor from running. Cancellation is irreversible —
89
+ * create a new monitor to resume monitoring. Cancelling an already-cancelled
90
+ * monitor is a no-op.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * const monitor = await client.monitor.cancel('monitor_id');
95
+ * ```
96
+ */
97
+ cancel(monitorID, options) {
98
+ return this._client.post(path `/v1/monitors/${monitorID}/cancel`, options);
99
+ }
100
+ /**
101
+ * List events for a monitor, newest first.
102
+ *
103
+ * Pass `event_group_id` to narrow results to a single execution. Otherwise returns
104
+ * all executions newest-first; use `next_cursor` to paginate. Set
105
+ * `include_completions=true` to also include no-change executions.
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * const paginatedMonitorEvents = await client.monitor.events(
110
+ * 'monitor_id',
111
+ * );
112
+ * ```
113
+ */
114
+ events(monitorID, query = {}, options) {
115
+ return this._client.get(path `/v1/monitors/${monitorID}/events`, { query, ...options });
116
+ }
117
+ /**
118
+ * Trigger an immediate monitor run.
119
+ *
120
+ * Enqueues a one-off execution of the monitor outside its normal schedule. The
121
+ * monitor's regular schedule is not affected. An event is only emitted if the
122
+ * execution detects a material change. Cancelled monitors cannot be triggered.
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * await client.monitor.trigger('monitor_id');
127
+ * ```
128
+ */
129
+ trigger(monitorID, options) {
130
+ return this._client.post(path `/v1/monitors/${monitorID}/trigger`, {
131
+ ...options,
132
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
133
+ });
134
+ }
135
+ }
136
+ //# sourceMappingURL=monitor.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitor.mjs","sourceRoot":"","sources":["../src/resources/monitor.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf;;;;;;GAMG;AACH,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;I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AE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,213 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import * as TaskRunAPI from "./task-run.mjs";
3
+ import * as BetaTaskRunAPI from "./beta/task-run.mjs";
4
+ import { APIPromise } from "../core/api-promise.mjs";
5
+ import { Stream } from "../core/streaming.mjs";
6
+ import { RequestOptions } from "../internal/request-options.mjs";
7
+ /**
8
+ * 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.
9
+ * - Output metadata: citations, excerpts, reasoning, and confidence per field
10
+ *
11
+ * Task Groups enable batch execution of many independent Task runs with group-level monitoring and failure handling.
12
+ * - Submit hundreds or thousands of Tasks as a single group
13
+ * - Observe group progress and receive results as they complete
14
+ * - Real-time updates via Server-Sent Events (SSE)
15
+ * - Add tasks to an existing group while it is running
16
+ * - Group-level retry and error aggregation
17
+ */
18
+ export declare class TaskGroup extends APIResource {
19
+ /**
20
+ * Initiates a TaskGroup to group and track multiple runs.
21
+ */
22
+ create(body: TaskGroupCreateParams, options?: RequestOptions): APIPromise<TaskGroup>;
23
+ /**
24
+ * Retrieves aggregated status across runs in a TaskGroup.
25
+ */
26
+ retrieve(taskGroupID: string, options?: RequestOptions): APIPromise<TaskGroup>;
27
+ /**
28
+ * Initiates multiple task runs within a TaskGroup.
29
+ */
30
+ addRuns(taskGroupID: string, params: TaskGroupAddRunsParams, options?: RequestOptions): APIPromise<TaskGroupRunResponse>;
31
+ /**
32
+ * Streams events from a TaskGroup: status updates and run completions.
33
+ *
34
+ * The connection will remain open for up to an hour as long as at least one run in
35
+ * the group is still active.
36
+ */
37
+ events(taskGroupID: string, query?: TaskGroupEventsParams | undefined, options?: RequestOptions): APIPromise<Stream<TaskGroupEventsResponse>>;
38
+ /**
39
+ * Retrieves task runs in a TaskGroup and optionally their inputs and outputs.
40
+ *
41
+ * All runs within a TaskGroup are returned as a stream. To get the inputs and/or
42
+ * outputs back in the stream, set the corresponding `include_input` and
43
+ * `include_output` parameters to `true`.
44
+ *
45
+ * The stream is resumable using the `event_id` as the cursor. To resume a stream,
46
+ * specify the `last_event_id` parameter with the `event_id` of the last event in
47
+ * the stream. The stream will resume from the next event after the
48
+ * `last_event_id`.
49
+ */
50
+ getRuns(taskGroupID: string, query?: TaskGroupGetRunsParams | undefined, options?: RequestOptions): APIPromise<Stream<TaskGroupGetRunsResponse>>;
51
+ /**
52
+ * Retrieves run status by run_id.
53
+ *
54
+ * This endpoint is equivalent to fetching run status directly using the
55
+ * `retrieve()` method or the `tasks/runs` GET endpoint.
56
+ *
57
+ * The run result is available from the `/result` endpoint.
58
+ */
59
+ retrieveRun(runID: string, params: TaskGroupRetrieveRunParams, options?: RequestOptions): APIPromise<TaskRunAPI.TaskRun>;
60
+ }
61
+ /**
62
+ * Response object for a task group, including its status and metadata.
63
+ */
64
+ export interface TaskGroup {
65
+ /**
66
+ * Timestamp of the creation of the group, as an RFC 3339 string.
67
+ */
68
+ created_at: string | null;
69
+ /**
70
+ * Status of the group.
71
+ */
72
+ status: TaskGroupStatus;
73
+ /**
74
+ * ID of the group.
75
+ */
76
+ taskgroup_id: string;
77
+ /**
78
+ * User-provided metadata stored with the group.
79
+ */
80
+ metadata?: {
81
+ [key: string]: string | number | boolean;
82
+ } | null;
83
+ }
84
+ /**
85
+ * Response from adding new task runs to a task group.
86
+ */
87
+ export interface TaskGroupRunResponse {
88
+ /**
89
+ * Cursor for these runs in the event stream at
90
+ * taskgroup/events?last_event_id=<event_cursor>. Empty for the first runs in the
91
+ * group.
92
+ */
93
+ event_cursor: string | null;
94
+ /**
95
+ * Cursor for these runs in the run stream at
96
+ * taskgroup/runs?last_event_id=<run_cursor>. Empty for the first runs in the
97
+ * group.
98
+ */
99
+ run_cursor: string | null;
100
+ /**
101
+ * IDs of the newly created runs.
102
+ */
103
+ run_ids: Array<string>;
104
+ /**
105
+ * Status of the group.
106
+ */
107
+ status: TaskGroupStatus;
108
+ }
109
+ /**
110
+ * Status of a task group.
111
+ */
112
+ export interface TaskGroupStatus {
113
+ /**
114
+ * True if at least one run in the group is currently active, i.e. status is one of
115
+ * {'cancelling', 'queued', 'running'}.
116
+ */
117
+ is_active: boolean;
118
+ /**
119
+ * Timestamp of the last status update to the group, as an RFC 3339 string.
120
+ */
121
+ modified_at: string | null;
122
+ /**
123
+ * Number of task runs in the group.
124
+ */
125
+ num_task_runs: number;
126
+ /**
127
+ * Human-readable status message for the group.
128
+ */
129
+ status_message: string | null;
130
+ /**
131
+ * Number of task runs with each status.
132
+ */
133
+ task_run_status_counts: {
134
+ [key: string]: number;
135
+ };
136
+ }
137
+ /**
138
+ * Event indicating an update to group status.
139
+ */
140
+ export interface TaskGroupStatusEvent {
141
+ /**
142
+ * Cursor to resume the event stream.
143
+ */
144
+ event_id: string;
145
+ /**
146
+ * Task group status object.
147
+ */
148
+ status: TaskGroupStatus;
149
+ /**
150
+ * Event type; always 'task_group_status'.
151
+ */
152
+ type: 'task_group_status';
153
+ }
154
+ /**
155
+ * Event indicating an update to group status.
156
+ */
157
+ export type TaskGroupEventsResponse = TaskGroupStatusEvent | TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
158
+ /**
159
+ * Event when a task run transitions to a non-active status.
160
+ *
161
+ * May indicate completion, cancellation, or failure.
162
+ */
163
+ export type TaskGroupGetRunsResponse = TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
164
+ export interface TaskGroupCreateParams {
165
+ /**
166
+ * User-provided metadata stored with the task group.
167
+ */
168
+ metadata?: {
169
+ [key: string]: string | number | boolean;
170
+ } | null;
171
+ }
172
+ export interface TaskGroupAddRunsParams {
173
+ /**
174
+ * Body param: List of task runs to execute. Up to 1,000 runs can be specified per
175
+ * request. If you'd like to add more runs, split them across multiple TaskGroup
176
+ * POST requests.
177
+ */
178
+ inputs: Array<TaskRunAPI.RunInput>;
179
+ /**
180
+ * Query param
181
+ */
182
+ refresh_status?: boolean;
183
+ /**
184
+ * Body param: Specification for a task.
185
+ *
186
+ * Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
187
+ * Not specifying a TaskSpec is the same as setting an auto output schema.
188
+ *
189
+ * For convenience bare strings are also accepted as input or output schemas.
190
+ */
191
+ default_task_spec?: TaskRunAPI.TaskSpec | null;
192
+ /**
193
+ * Header param: Optional header to specify the beta version(s) to enable.
194
+ */
195
+ betas?: Array<BetaTaskRunAPI.ParallelBeta>;
196
+ }
197
+ export interface TaskGroupEventsParams {
198
+ last_event_id?: string | null;
199
+ timeout?: number | null;
200
+ }
201
+ export interface TaskGroupGetRunsParams {
202
+ include_input?: boolean;
203
+ include_output?: boolean;
204
+ last_event_id?: string | null;
205
+ status?: 'queued' | 'action_required' | 'running' | 'completed' | 'failed' | 'cancelling' | 'cancelled' | null;
206
+ }
207
+ export interface TaskGroupRetrieveRunParams {
208
+ taskgroup_id: string;
209
+ }
210
+ export declare namespace TaskGroup {
211
+ export { type TaskGroup as TaskGroup, type TaskGroupRunResponse as TaskGroupRunResponse, type TaskGroupStatus as TaskGroupStatus, type TaskGroupStatusEvent as TaskGroupStatusEvent, type TaskGroupEventsResponse as TaskGroupEventsResponse, type TaskGroupGetRunsResponse as TaskGroupGetRunsResponse, type TaskGroupCreateParams as TaskGroupCreateParams, type TaskGroupAddRunsParams as TaskGroupAddRunsParams, type TaskGroupEventsParams as TaskGroupEventsParams, type TaskGroupGetRunsParams as TaskGroupGetRunsParams, type TaskGroupRetrieveRunParams as TaskGroupRetrieveRunParams, };
212
+ }
213
+ //# sourceMappingURL=task-group.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-group.d.mts","sourceRoot":"","sources":["../src/resources/task-group.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,KAA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