parallel-web 0.4.1 → 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 (241) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/api-promise.d.mts +1 -0
  3. package/api-promise.d.mts.map +1 -1
  4. package/api-promise.d.ts +1 -0
  5. package/api-promise.d.ts.map +1 -1
  6. package/api-promise.mjs +1 -0
  7. package/api-promise.mjs.map +1 -1
  8. package/client.d.mts +29 -8
  9. package/client.d.mts.map +1 -1
  10. package/client.d.ts +29 -8
  11. package/client.d.ts.map +1 -1
  12. package/client.js +34 -4
  13. package/client.js.map +1 -1
  14. package/client.mjs +34 -4
  15. package/client.mjs.map +1 -1
  16. package/core/api-promise.d.mts.map +1 -1
  17. package/core/api-promise.d.ts.map +1 -1
  18. package/core/api-promise.mjs.map +1 -1
  19. package/core/error.mjs.map +1 -1
  20. package/core/resource.d.mts.map +1 -1
  21. package/core/resource.d.ts.map +1 -1
  22. package/core/streaming.d.mts.map +1 -1
  23. package/core/streaming.d.ts.map +1 -1
  24. package/core/streaming.mjs.map +1 -1
  25. package/core/uploads.d.mts.map +1 -1
  26. package/core/uploads.d.ts.map +1 -1
  27. package/core/uploads.mjs.map +1 -1
  28. package/error.d.mts +1 -0
  29. package/error.d.mts.map +1 -1
  30. package/error.d.ts +1 -0
  31. package/error.d.ts.map +1 -1
  32. package/error.mjs +1 -0
  33. package/error.mjs.map +1 -1
  34. package/index.d.mts.map +1 -1
  35. package/index.d.ts.map +1 -1
  36. package/index.mjs.map +1 -1
  37. package/internal/decoders/line.mjs.map +1 -1
  38. package/internal/detect-platform.mjs.map +1 -1
  39. package/internal/headers.mjs.map +1 -1
  40. package/internal/parse.d.mts.map +1 -1
  41. package/internal/parse.d.ts.map +1 -1
  42. package/internal/parse.mjs.map +1 -1
  43. package/internal/qs/formats.d.mts +7 -0
  44. package/internal/qs/formats.d.mts.map +1 -0
  45. package/internal/qs/formats.d.ts +7 -0
  46. package/internal/qs/formats.d.ts.map +1 -0
  47. package/internal/qs/formats.js +13 -0
  48. package/internal/qs/formats.js.map +1 -0
  49. package/internal/qs/formats.mjs +9 -0
  50. package/internal/qs/formats.mjs.map +1 -0
  51. package/internal/qs/index.d.mts +10 -0
  52. package/internal/qs/index.d.mts.map +1 -0
  53. package/internal/qs/index.d.ts +10 -0
  54. package/internal/qs/index.d.ts.map +1 -0
  55. package/internal/qs/index.js +14 -0
  56. package/internal/qs/index.js.map +1 -0
  57. package/internal/qs/index.mjs +10 -0
  58. package/internal/qs/index.mjs.map +1 -0
  59. package/internal/qs/stringify.d.mts +3 -0
  60. package/internal/qs/stringify.d.mts.map +1 -0
  61. package/internal/qs/stringify.d.ts +3 -0
  62. package/internal/qs/stringify.d.ts.map +1 -0
  63. package/internal/qs/stringify.js +277 -0
  64. package/internal/qs/stringify.js.map +1 -0
  65. package/internal/qs/stringify.mjs +274 -0
  66. package/internal/qs/stringify.mjs.map +1 -0
  67. package/internal/qs/types.d.mts +57 -0
  68. package/internal/qs/types.d.mts.map +1 -0
  69. package/internal/qs/types.d.ts +57 -0
  70. package/internal/qs/types.d.ts.map +1 -0
  71. package/internal/qs/types.js +3 -0
  72. package/internal/qs/types.js.map +1 -0
  73. package/internal/qs/types.mjs +2 -0
  74. package/internal/qs/types.mjs.map +1 -0
  75. package/internal/qs/utils.d.mts +15 -0
  76. package/internal/qs/utils.d.mts.map +1 -0
  77. package/internal/qs/utils.d.ts +15 -0
  78. package/internal/qs/utils.d.ts.map +1 -0
  79. package/internal/qs/utils.js +230 -0
  80. package/internal/qs/utils.js.map +1 -0
  81. package/internal/qs/utils.mjs +217 -0
  82. package/internal/qs/utils.mjs.map +1 -0
  83. package/internal/request-options.d.mts.map +1 -1
  84. package/internal/request-options.d.ts.map +1 -1
  85. package/internal/shims.d.mts +6 -0
  86. package/internal/shims.d.mts.map +1 -1
  87. package/internal/shims.d.ts +6 -0
  88. package/internal/shims.d.ts.map +1 -1
  89. package/internal/to-file.d.mts.map +1 -1
  90. package/internal/to-file.d.ts.map +1 -1
  91. package/internal/to-file.mjs.map +1 -1
  92. package/internal/types.d.mts +10 -10
  93. package/internal/types.d.mts.map +1 -1
  94. package/internal/types.d.ts +10 -10
  95. package/internal/types.d.ts.map +1 -1
  96. package/internal/uploads.d.mts.map +1 -1
  97. package/internal/uploads.d.ts.map +1 -1
  98. package/internal/uploads.mjs.map +1 -1
  99. package/internal/utils/base64.mjs.map +1 -1
  100. package/internal/utils/log.d.mts.map +1 -1
  101. package/internal/utils/log.d.ts.map +1 -1
  102. package/internal/utils/log.js +3 -2
  103. package/internal/utils/log.js.map +1 -1
  104. package/internal/utils/log.mjs +3 -2
  105. package/internal/utils/log.mjs.map +1 -1
  106. package/internal/utils/path.mjs.map +1 -1
  107. package/internal/utils/query.d.mts +0 -3
  108. package/internal/utils/query.d.mts.map +1 -1
  109. package/internal/utils/query.d.ts +0 -3
  110. package/internal/utils/query.d.ts.map +1 -1
  111. package/internal/utils/query.js +3 -16
  112. package/internal/utils/query.js.map +1 -1
  113. package/internal/utils/query.mjs +2 -16
  114. package/internal/utils/query.mjs.map +1 -1
  115. package/internal/utils/values.mjs.map +1 -1
  116. package/internal/utils.d.mts.map +1 -1
  117. package/internal/utils.d.ts.map +1 -1
  118. package/internal/utils.mjs.map +1 -1
  119. package/package.json +1 -1
  120. package/resource.d.mts +1 -0
  121. package/resource.d.mts.map +1 -1
  122. package/resource.d.ts +1 -0
  123. package/resource.d.ts.map +1 -1
  124. package/resource.mjs +1 -0
  125. package/resource.mjs.map +1 -1
  126. package/resources/beta/beta.d.mts +2 -270
  127. package/resources/beta/beta.d.mts.map +1 -1
  128. package/resources/beta/beta.d.ts +2 -270
  129. package/resources/beta/beta.d.ts.map +1 -1
  130. package/resources/beta/beta.js +0 -39
  131. package/resources/beta/beta.js.map +1 -1
  132. package/resources/beta/beta.mjs +0 -39
  133. package/resources/beta/beta.mjs.map +1 -1
  134. package/resources/beta/findall.d.mts +202 -247
  135. package/resources/beta/findall.d.mts.map +1 -1
  136. package/resources/beta/findall.d.ts +202 -247
  137. package/resources/beta/findall.d.ts.map +1 -1
  138. package/resources/beta/findall.js +28 -27
  139. package/resources/beta/findall.js.map +1 -1
  140. package/resources/beta/findall.mjs +28 -27
  141. package/resources/beta/findall.mjs.map +1 -1
  142. package/resources/beta/index.d.mts +1 -3
  143. package/resources/beta/index.d.mts.map +1 -1
  144. package/resources/beta/index.d.ts +1 -3
  145. package/resources/beta/index.d.ts.map +1 -1
  146. package/resources/beta/index.js +1 -5
  147. package/resources/beta/index.js.map +1 -1
  148. package/resources/beta/index.mjs +0 -2
  149. package/resources/beta/index.mjs.map +1 -1
  150. package/resources/beta.d.mts.map +1 -1
  151. package/resources/beta.d.ts.map +1 -1
  152. package/resources/beta.mjs.map +1 -1
  153. package/resources/index.d.mts +4 -2
  154. package/resources/index.d.mts.map +1 -1
  155. package/resources/index.d.ts +4 -2
  156. package/resources/index.d.ts.map +1 -1
  157. package/resources/index.js +5 -1
  158. package/resources/index.js.map +1 -1
  159. package/resources/index.mjs +2 -0
  160. package/resources/index.mjs.map +1 -1
  161. package/resources/monitor.d.mts +625 -0
  162. package/resources/monitor.d.mts.map +1 -0
  163. package/resources/monitor.d.ts +625 -0
  164. package/resources/monitor.d.ts.map +1 -0
  165. package/resources/monitor.js +140 -0
  166. package/resources/monitor.js.map +1 -0
  167. package/resources/monitor.mjs +136 -0
  168. package/resources/monitor.mjs.map +1 -0
  169. package/resources/{beta/task-group.d.mts → task-group.d.mts} +38 -68
  170. package/resources/task-group.d.mts.map +1 -0
  171. package/resources/{beta/task-group.d.ts → task-group.d.ts} +38 -68
  172. package/resources/task-group.d.ts.map +1 -0
  173. package/resources/{beta/task-group.js → task-group.js} +24 -64
  174. package/resources/task-group.js.map +1 -0
  175. package/resources/{beta/task-group.mjs → task-group.mjs} +24 -64
  176. package/resources/task-group.mjs.map +1 -0
  177. package/resources/task-run.d.mts +100 -83
  178. package/resources/task-run.d.mts.map +1 -1
  179. package/resources/task-run.d.ts +100 -83
  180. package/resources/task-run.d.ts.map +1 -1
  181. package/resources/task-run.js +14 -1
  182. package/resources/task-run.js.map +1 -1
  183. package/resources/task-run.mjs +14 -1
  184. package/resources/task-run.mjs.map +1 -1
  185. package/resources/top-level.d.mts +20 -16
  186. package/resources/top-level.d.mts.map +1 -1
  187. package/resources/top-level.d.ts +20 -16
  188. package/resources/top-level.d.ts.map +1 -1
  189. package/resources.d.mts.map +1 -1
  190. package/resources.d.ts.map +1 -1
  191. package/resources.mjs.map +1 -1
  192. package/src/client.ts +120 -4
  193. package/src/internal/qs/LICENSE.md +13 -0
  194. package/src/internal/qs/README.md +3 -0
  195. package/src/internal/qs/formats.ts +10 -0
  196. package/src/internal/qs/index.ts +13 -0
  197. package/src/internal/qs/stringify.ts +385 -0
  198. package/src/internal/qs/types.ts +71 -0
  199. package/src/internal/qs/utils.ts +265 -0
  200. package/src/internal/types.ts +6 -8
  201. package/src/internal/utils/log.ts +2 -1
  202. package/src/internal/utils/query.ts +2 -18
  203. package/src/resources/beta/api.md +9 -59
  204. package/src/resources/beta/beta.ts +16 -406
  205. package/src/resources/beta/findall.ts +252 -284
  206. package/src/resources/beta/index.ts +8 -30
  207. package/src/resources/index.ts +42 -0
  208. package/src/resources/monitor.ts +752 -0
  209. package/src/resources/{beta/task-group.ts → task-group.ts} +58 -93
  210. package/src/resources/task-run.ts +125 -98
  211. package/src/resources/top-level.ts +24 -16
  212. package/src/version.ts +1 -1
  213. package/streaming.d.mts +1 -0
  214. package/streaming.d.mts.map +1 -1
  215. package/streaming.d.ts +1 -0
  216. package/streaming.d.ts.map +1 -1
  217. package/streaming.mjs +1 -0
  218. package/streaming.mjs.map +1 -1
  219. package/uploads.d.mts +1 -0
  220. package/uploads.d.mts.map +1 -1
  221. package/uploads.d.ts +1 -0
  222. package/uploads.d.ts.map +1 -1
  223. package/uploads.mjs +1 -0
  224. package/uploads.mjs.map +1 -1
  225. package/version.d.mts +1 -1
  226. package/version.d.ts +1 -1
  227. package/version.js +1 -1
  228. package/version.mjs +1 -1
  229. package/resources/beta/task-group.d.mts.map +0 -1
  230. package/resources/beta/task-group.d.ts.map +0 -1
  231. package/resources/beta/task-group.js.map +0 -1
  232. package/resources/beta/task-group.mjs.map +0 -1
  233. package/resources/beta/task-run.d.mts +0 -239
  234. package/resources/beta/task-run.d.mts.map +0 -1
  235. package/resources/beta/task-run.d.ts +0 -239
  236. package/resources/beta/task-run.d.ts.map +0 -1
  237. package/resources/beta/task-run.js +0 -81
  238. package/resources/beta/task-run.js.map +0 -1
  239. package/resources/beta/task-run.mjs +0 -77
  240. package/resources/beta/task-run.mjs.map +0 -1
  241. package/src/resources/beta/task-run.ts +0 -336
@@ -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
+ {"version":3,"file":"monitor.js","sourceRoot":"","sources":["../src/resources/monitor.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,oDAAmD;AAEnD,oDAA8C;AAE9C;;;;;;GAMG;AACH,MAAa,eAAgB,SAAQ,sBAAW;IAC9C;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,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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;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAI/C,OAAO,EAAE,YAAY,EAAE,gCAA4B;AAEnD,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C;;;;;;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;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAiB,EAAE,OAAwB;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gBAAgB,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,SAAiB,EAAE,IAAyB,EAAE,OAAwB;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,gBAAgB,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,CACF,QAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,SAAiB,EAAE,OAAwB;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,gBAAgB,SAAS,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CACJ,SAAiB,EACjB,QAAgD,EAAE,EAClD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,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,IAAI,CAAA,gBAAgB,SAAS,UAAU,EAAE;YAChE,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,16 +1,15 @@
1
- import { APIResource } from "../../core/resource.mjs";
2
- import * as TaskGroupAPI from "./task-group.mjs";
3
- import * as TaskRunAPI from "../task-run.mjs";
4
- import * as BetaTaskRunAPI from "./task-run.mjs";
5
- import { APIPromise } from "../../core/api-promise.mjs";
6
- import { Stream } from "../../core/streaming.mjs";
7
- import { RequestOptions } from "../../internal/request-options.mjs";
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import * as TaskRunAPI from "./task-run.mjs";
3
+ import * as FindAllAPI from "./beta/findall.mjs";
4
+ import { APIPromise } from "../core/api-promise.mjs";
5
+ import { Stream } from "../core/streaming.mjs";
6
+ import { RequestOptions } from "../internal/request-options.mjs";
8
7
  /**
9
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.
10
9
  * - Output metadata: citations, excerpts, reasoning, and confidence per field
11
10
  *
12
11
  * Task Groups enable batch execution of many independent Task runs with group-level monitoring and failure handling.
13
- * - Submit hundreds or thousands of Tasks as a single group
12
+ * - Submit hundreds or thousands of Tasks as a single group
14
13
  * - Observe group progress and receive results as they complete
15
14
  * - Real-time updates via Server-Sent Events (SSE)
16
15
  * - Add tasks to an existing group while it is running
@@ -19,39 +18,14 @@ import { RequestOptions } from "../../internal/request-options.mjs";
19
18
  export declare class TaskGroup extends APIResource {
20
19
  /**
21
20
  * Initiates a TaskGroup to group and track multiple runs.
22
- *
23
- * @example
24
- * ```ts
25
- * const taskGroup = await client.beta.taskGroup.create();
26
- * ```
27
21
  */
28
22
  create(body: TaskGroupCreateParams, options?: RequestOptions): APIPromise<TaskGroup>;
29
23
  /**
30
24
  * Retrieves aggregated status across runs in a TaskGroup.
31
- *
32
- * @example
33
- * ```ts
34
- * const taskGroup = await client.beta.taskGroup.retrieve(
35
- * 'taskgroup_id',
36
- * );
37
- * ```
38
25
  */
39
26
  retrieve(taskGroupID: string, options?: RequestOptions): APIPromise<TaskGroup>;
40
27
  /**
41
28
  * Initiates multiple task runs within a TaskGroup.
42
- *
43
- * @example
44
- * ```ts
45
- * const taskGroupRunResponse =
46
- * await client.beta.taskGroup.addRuns('taskgroup_id', {
47
- * inputs: [
48
- * {
49
- * input: 'What was the GDP of France in 2023?',
50
- * processor: 'base',
51
- * },
52
- * ],
53
- * });
54
- * ```
55
29
  */
56
30
  addRuns(taskGroupID: string, params: TaskGroupAddRunsParams, options?: RequestOptions): APIPromise<TaskGroupRunResponse>;
57
31
  /**
@@ -59,13 +33,6 @@ export declare class TaskGroup extends APIResource {
59
33
  *
60
34
  * The connection will remain open for up to an hour as long as at least one run in
61
35
  * the group is still active.
62
- *
63
- * @example
64
- * ```ts
65
- * const response = await client.beta.taskGroup.events(
66
- * 'taskgroup_id',
67
- * );
68
- * ```
69
36
  */
70
37
  events(taskGroupID: string, query?: TaskGroupEventsParams | undefined, options?: RequestOptions): APIPromise<Stream<TaskGroupEventsResponse>>;
71
38
  /**
@@ -79,15 +46,17 @@ export declare class TaskGroup extends APIResource {
79
46
  * specify the `last_event_id` parameter with the `event_id` of the last event in
80
47
  * the stream. The stream will resume from the next event after the
81
48
  * `last_event_id`.
82
- *
83
- * @example
84
- * ```ts
85
- * const response = await client.beta.taskGroup.getRuns(
86
- * 'taskgroup_id',
87
- * );
88
- * ```
89
49
  */
90
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>;
91
60
  }
92
61
  /**
93
62
  * Response object for a task group, including its status and metadata.
@@ -168,26 +137,24 @@ export interface TaskGroupStatus {
168
137
  /**
169
138
  * Event indicating an update to group status.
170
139
  */
171
- export type TaskGroupEventsResponse = TaskGroupEventsResponse.TaskGroupStatusEvent | TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
172
- export declare namespace TaskGroupEventsResponse {
173
- /**
174
- * Event indicating an update to group status.
175
- */
176
- interface TaskGroupStatusEvent {
177
- /**
178
- * Cursor to resume the event stream.
179
- */
180
- event_id: string;
181
- /**
182
- * Task group status object.
183
- */
184
- status: TaskGroupAPI.TaskGroupStatus;
185
- /**
186
- * Event type; always 'task_group_status'.
187
- */
188
- type: 'task_group_status';
189
- }
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';
190
153
  }
154
+ /**
155
+ * Event indicating an update to group status.
156
+ */
157
+ export type TaskGroupEventsResponse = TaskGroupStatusEvent | TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
191
158
  /**
192
159
  * Event when a task run transitions to a non-active status.
193
160
  *
@@ -225,7 +192,7 @@ export interface TaskGroupAddRunsParams {
225
192
  /**
226
193
  * Header param: Optional header to specify the beta version(s) to enable.
227
194
  */
228
- betas?: Array<BetaTaskRunAPI.ParallelBeta>;
195
+ betas?: Array<FindAllAPI.ParallelBeta>;
229
196
  }
230
197
  export interface TaskGroupEventsParams {
231
198
  last_event_id?: string | null;
@@ -237,7 +204,10 @@ export interface TaskGroupGetRunsParams {
237
204
  last_event_id?: string | null;
238
205
  status?: 'queued' | 'action_required' | 'running' | 'completed' | 'failed' | 'cancelling' | 'cancelled' | null;
239
206
  }
207
+ export interface TaskGroupRetrieveRunParams {
208
+ taskgroup_id: string;
209
+ }
240
210
  export declare namespace TaskGroup {
241
- export { type TaskGroup as TaskGroup, type TaskGroupRunResponse as TaskGroupRunResponse, type TaskGroupStatus as TaskGroupStatus, type TaskGroupEventsResponse as TaskGroupEventsResponse, type TaskGroupGetRunsResponse as TaskGroupGetRunsResponse, type TaskGroupCreateParams as TaskGroupCreateParams, type TaskGroupAddRunsParams as TaskGroupAddRunsParams, type TaskGroupEventsParams as TaskGroupEventsParams, type TaskGroupGetRunsParams as TaskGroupGetRunsParams, };
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, };
242
212
  }
243
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":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,KAAK,UAAU,uBAAmB;AACzC,OAAO,KAAK,UAAU,2BAAuB;AAC7C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,MAAM,EAAE,8BAA0B;AAE3C,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAG7D;;;;;;;;;;GAUG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC;IAIpF;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC;IAI9E;;OAEG;IACH,OAAO,CACL,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IAanC;;;;;OAK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,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,MAAM,CAAC,EACH,QAAQ,GACR,iBAAiB,GACjB,SAAS,GACT,WAAW,GACX,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,IAAI,CAAC;CACV;AAED,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,SAAS,IAAI,SAAS,EAC3B,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
@@ -1,16 +1,15 @@
1
- import { APIResource } from "../../core/resource.js";
2
- import * as TaskGroupAPI from "./task-group.js";
3
- import * as TaskRunAPI from "../task-run.js";
4
- import * as BetaTaskRunAPI from "./task-run.js";
5
- import { APIPromise } from "../../core/api-promise.js";
6
- import { Stream } from "../../core/streaming.js";
7
- import { RequestOptions } from "../../internal/request-options.js";
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as TaskRunAPI from "./task-run.js";
3
+ import * as FindAllAPI from "./beta/findall.js";
4
+ import { APIPromise } from "../core/api-promise.js";
5
+ import { Stream } from "../core/streaming.js";
6
+ import { RequestOptions } from "../internal/request-options.js";
8
7
  /**
9
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.
10
9
  * - Output metadata: citations, excerpts, reasoning, and confidence per field
11
10
  *
12
11
  * Task Groups enable batch execution of many independent Task runs with group-level monitoring and failure handling.
13
- * - Submit hundreds or thousands of Tasks as a single group
12
+ * - Submit hundreds or thousands of Tasks as a single group
14
13
  * - Observe group progress and receive results as they complete
15
14
  * - Real-time updates via Server-Sent Events (SSE)
16
15
  * - Add tasks to an existing group while it is running
@@ -19,39 +18,14 @@ import { RequestOptions } from "../../internal/request-options.js";
19
18
  export declare class TaskGroup extends APIResource {
20
19
  /**
21
20
  * Initiates a TaskGroup to group and track multiple runs.
22
- *
23
- * @example
24
- * ```ts
25
- * const taskGroup = await client.beta.taskGroup.create();
26
- * ```
27
21
  */
28
22
  create(body: TaskGroupCreateParams, options?: RequestOptions): APIPromise<TaskGroup>;
29
23
  /**
30
24
  * Retrieves aggregated status across runs in a TaskGroup.
31
- *
32
- * @example
33
- * ```ts
34
- * const taskGroup = await client.beta.taskGroup.retrieve(
35
- * 'taskgroup_id',
36
- * );
37
- * ```
38
25
  */
39
26
  retrieve(taskGroupID: string, options?: RequestOptions): APIPromise<TaskGroup>;
40
27
  /**
41
28
  * Initiates multiple task runs within a TaskGroup.
42
- *
43
- * @example
44
- * ```ts
45
- * const taskGroupRunResponse =
46
- * await client.beta.taskGroup.addRuns('taskgroup_id', {
47
- * inputs: [
48
- * {
49
- * input: 'What was the GDP of France in 2023?',
50
- * processor: 'base',
51
- * },
52
- * ],
53
- * });
54
- * ```
55
29
  */
56
30
  addRuns(taskGroupID: string, params: TaskGroupAddRunsParams, options?: RequestOptions): APIPromise<TaskGroupRunResponse>;
57
31
  /**
@@ -59,13 +33,6 @@ export declare class TaskGroup extends APIResource {
59
33
  *
60
34
  * The connection will remain open for up to an hour as long as at least one run in
61
35
  * the group is still active.
62
- *
63
- * @example
64
- * ```ts
65
- * const response = await client.beta.taskGroup.events(
66
- * 'taskgroup_id',
67
- * );
68
- * ```
69
36
  */
70
37
  events(taskGroupID: string, query?: TaskGroupEventsParams | undefined, options?: RequestOptions): APIPromise<Stream<TaskGroupEventsResponse>>;
71
38
  /**
@@ -79,15 +46,17 @@ export declare class TaskGroup extends APIResource {
79
46
  * specify the `last_event_id` parameter with the `event_id` of the last event in
80
47
  * the stream. The stream will resume from the next event after the
81
48
  * `last_event_id`.
82
- *
83
- * @example
84
- * ```ts
85
- * const response = await client.beta.taskGroup.getRuns(
86
- * 'taskgroup_id',
87
- * );
88
- * ```
89
49
  */
90
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>;
91
60
  }
92
61
  /**
93
62
  * Response object for a task group, including its status and metadata.
@@ -168,26 +137,24 @@ export interface TaskGroupStatus {
168
137
  /**
169
138
  * Event indicating an update to group status.
170
139
  */
171
- export type TaskGroupEventsResponse = TaskGroupEventsResponse.TaskGroupStatusEvent | TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
172
- export declare namespace TaskGroupEventsResponse {
173
- /**
174
- * Event indicating an update to group status.
175
- */
176
- interface TaskGroupStatusEvent {
177
- /**
178
- * Cursor to resume the event stream.
179
- */
180
- event_id: string;
181
- /**
182
- * Task group status object.
183
- */
184
- status: TaskGroupAPI.TaskGroupStatus;
185
- /**
186
- * Event type; always 'task_group_status'.
187
- */
188
- type: 'task_group_status';
189
- }
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';
190
153
  }
154
+ /**
155
+ * Event indicating an update to group status.
156
+ */
157
+ export type TaskGroupEventsResponse = TaskGroupStatusEvent | TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
191
158
  /**
192
159
  * Event when a task run transitions to a non-active status.
193
160
  *
@@ -225,7 +192,7 @@ export interface TaskGroupAddRunsParams {
225
192
  /**
226
193
  * Header param: Optional header to specify the beta version(s) to enable.
227
194
  */
228
- betas?: Array<BetaTaskRunAPI.ParallelBeta>;
195
+ betas?: Array<FindAllAPI.ParallelBeta>;
229
196
  }
230
197
  export interface TaskGroupEventsParams {
231
198
  last_event_id?: string | null;
@@ -237,7 +204,10 @@ export interface TaskGroupGetRunsParams {
237
204
  last_event_id?: string | null;
238
205
  status?: 'queued' | 'action_required' | 'running' | 'completed' | 'failed' | 'cancelling' | 'cancelled' | null;
239
206
  }
207
+ export interface TaskGroupRetrieveRunParams {
208
+ taskgroup_id: string;
209
+ }
240
210
  export declare namespace TaskGroup {
241
- export { type TaskGroup as TaskGroup, type TaskGroupRunResponse as TaskGroupRunResponse, type TaskGroupStatus as TaskGroupStatus, type TaskGroupEventsResponse as TaskGroupEventsResponse, type TaskGroupGetRunsResponse as TaskGroupGetRunsResponse, type TaskGroupCreateParams as TaskGroupCreateParams, type TaskGroupAddRunsParams as TaskGroupAddRunsParams, type TaskGroupEventsParams as TaskGroupEventsParams, type TaskGroupGetRunsParams as TaskGroupGetRunsParams, };
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, };
242
212
  }
243
213
  //# sourceMappingURL=task-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-group.d.ts","sourceRoot":"","sources":["../src/resources/task-group.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,KAAK,UAAU,sBAAmB;AACzC,OAAO,KAAK,UAAU,0BAAuB;AAC7C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,MAAM,EAAE,6BAA0B;AAE3C,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D;;;;;;;;;;GAUG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC;IAIpF;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC;IAI9E;;OAEG;IACH,OAAO,CACL,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IAanC;;;;;OAKG;IACH,MAAM,CACJ,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,qBAAqB,GAAG,SAAc,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAS9C;;;;;;;;;;;OAWG;IACH,OAAO,CACL,WAAW,EAAE,MAAM,EACnB,KAAK,GAAE,sBAAsB,GAAG,SAAc,EAC9C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAS/C;;;;;;;OAO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