@trigger.dev/core 0.0.0-prerelease-20240603154820 → 0.0.0-prerelease-20240723165848

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 (187) hide show
  1. package/dist/api-Pl9fxB8v.d.mts +13879 -0
  2. package/dist/api-sNoooMbT.d.ts +13879 -0
  3. package/dist/{catalog-dRKTgwQ7.d.ts → catalog-H7yFiZ60.d.mts} +52 -52
  4. package/dist/{catalog-XTlJQaMn.d.mts → catalog-h79CG5Wy.d.ts} +52 -52
  5. package/dist/{manager-JkbddlcO.d.mts → common-CLW82lkt.d.mts} +280 -16
  6. package/dist/{manager-JkbddlcO.d.ts → common-CLW82lkt.d.ts} +280 -16
  7. package/dist/{eventFilterMatches-2kHImluE.d.mts → eventFilter-66NaBAMi.d.mts} +1 -3
  8. package/dist/{eventFilterMatches-2kHImluE.d.ts → eventFilter-66NaBAMi.d.ts} +1 -3
  9. package/dist/eventFilterMatches.d.mts +6 -0
  10. package/dist/eventFilterMatches.d.ts +6 -0
  11. package/dist/eventFilterMatches.js +165 -0
  12. package/dist/eventFilterMatches.js.map +1 -0
  13. package/dist/eventFilterMatches.mjs +163 -0
  14. package/dist/eventFilterMatches.mjs.map +1 -0
  15. package/dist/index.d.mts +14 -16716
  16. package/dist/index.d.ts +14 -16716
  17. package/dist/index.js +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +1 -1
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/json-DBPEJQRe.d.mts +16 -0
  22. package/dist/json-DBPEJQRe.d.ts +16 -0
  23. package/dist/manager-KvCabW1a.d.mts +18 -0
  24. package/dist/manager-OBA35PzR.d.ts +18 -0
  25. package/dist/{messages-6_-q72KG.d.mts → messages-JvHJ83wv.d.mts} +2978 -291
  26. package/dist/{messages-6_-q72KG.d.ts → messages-JvHJ83wv.d.ts} +2978 -291
  27. package/dist/replacements.d.mts +22 -0
  28. package/dist/replacements.d.ts +22 -0
  29. package/dist/replacements.js +33 -0
  30. package/dist/replacements.js.map +1 -0
  31. package/dist/replacements.mjs +28 -0
  32. package/dist/replacements.mjs.map +1 -0
  33. package/dist/requestFilter-HNZQEpQb.d.ts +180 -0
  34. package/dist/requestFilter-b5W2_1oP.d.mts +180 -0
  35. package/dist/requestFilterMatches.d.mts +13 -0
  36. package/dist/requestFilterMatches.d.ts +13 -0
  37. package/dist/requestFilterMatches.js +238 -0
  38. package/dist/requestFilterMatches.js.map +1 -0
  39. package/dist/requestFilterMatches.mjs +235 -0
  40. package/dist/requestFilterMatches.mjs.map +1 -0
  41. package/dist/retry.d.mts +10 -0
  42. package/dist/retry.d.ts +10 -0
  43. package/dist/retry.js +100 -0
  44. package/dist/retry.js.map +1 -0
  45. package/dist/retry.mjs +97 -0
  46. package/dist/retry.mjs.map +1 -0
  47. package/dist/schemas/index.d.mts +2611 -0
  48. package/dist/schemas/index.d.ts +2611 -0
  49. package/dist/schemas/index.js +1630 -0
  50. package/dist/schemas/index.js.map +1 -0
  51. package/dist/schemas/index.mjs +1463 -0
  52. package/dist/schemas/index.mjs.map +1 -0
  53. package/dist/{schemas-r4ZP9S-F.d.mts → schemas-C9ssfehv.d.mts} +270 -33
  54. package/dist/{schemas-r4ZP9S-F.d.ts → schemas-C9ssfehv.d.ts} +270 -33
  55. package/dist/taskLogger-CzADe4je.d.ts +33 -0
  56. package/dist/taskLogger-r_AFTX45.d.mts +33 -0
  57. package/dist/tracer-N0p2Fuuv.d.mts +23 -0
  58. package/dist/tracer-N0p2Fuuv.d.ts +23 -0
  59. package/dist/types.d.mts +11 -0
  60. package/dist/types.d.ts +11 -0
  61. package/dist/types.js +4 -0
  62. package/dist/types.js.map +1 -0
  63. package/dist/types.mjs +3 -0
  64. package/dist/types.mjs.map +1 -0
  65. package/dist/utils.d.mts +7 -0
  66. package/dist/utils.d.ts +7 -0
  67. package/dist/utils.js +33 -0
  68. package/dist/utils.js.map +1 -0
  69. package/dist/utils.mjs +30 -0
  70. package/dist/utils.mjs.map +1 -0
  71. package/dist/v3/dev/index.d.mts +2 -1
  72. package/dist/v3/dev/index.d.ts +2 -1
  73. package/dist/v3/dev/index.js.map +1 -1
  74. package/dist/v3/dev/index.mjs.map +1 -1
  75. package/dist/v3/errors.d.mts +39 -0
  76. package/dist/v3/errors.d.ts +39 -0
  77. package/dist/v3/errors.js +204 -0
  78. package/dist/v3/errors.js.map +1 -0
  79. package/dist/v3/errors.mjs +195 -0
  80. package/dist/v3/errors.mjs.map +1 -0
  81. package/dist/v3/index.d.mts +172 -4737
  82. package/dist/v3/index.d.ts +172 -4737
  83. package/dist/v3/index.js +871 -620
  84. package/dist/v3/index.js.map +1 -1
  85. package/dist/v3/index.mjs +856 -620
  86. package/dist/v3/index.mjs.map +1 -1
  87. package/dist/v3/logger-api.d.mts +24 -0
  88. package/dist/v3/logger-api.d.ts +24 -0
  89. package/dist/v3/logger-api.js +118 -0
  90. package/dist/v3/logger-api.js.map +1 -0
  91. package/dist/v3/logger-api.mjs +116 -0
  92. package/dist/v3/logger-api.mjs.map +1 -0
  93. package/dist/v3/otel/index.js +36 -12
  94. package/dist/v3/otel/index.js.map +1 -1
  95. package/dist/v3/otel/index.mjs +36 -12
  96. package/dist/v3/otel/index.mjs.map +1 -1
  97. package/dist/v3/prod/index.d.mts +4 -3
  98. package/dist/v3/prod/index.d.ts +4 -3
  99. package/dist/v3/prod/index.js +7 -131
  100. package/dist/v3/prod/index.js.map +1 -1
  101. package/dist/v3/prod/index.mjs +7 -131
  102. package/dist/v3/prod/index.mjs.map +1 -1
  103. package/dist/v3/schemas/index.d.mts +4807 -0
  104. package/dist/v3/schemas/index.d.ts +4807 -0
  105. package/dist/v3/schemas/index.js +2065 -0
  106. package/dist/v3/schemas/index.js.map +1 -0
  107. package/dist/v3/schemas/index.mjs +1924 -0
  108. package/dist/v3/schemas/index.mjs.map +1 -0
  109. package/dist/v3/semanticInternalAttributes.d.mts +56 -0
  110. package/dist/v3/semanticInternalAttributes.d.ts +56 -0
  111. package/dist/v3/semanticInternalAttributes.js +61 -0
  112. package/dist/v3/semanticInternalAttributes.js.map +1 -0
  113. package/dist/v3/semanticInternalAttributes.mjs +59 -0
  114. package/dist/v3/semanticInternalAttributes.mjs.map +1 -0
  115. package/dist/v3/utils/durations.d.mts +15 -0
  116. package/dist/v3/utils/durations.d.ts +15 -0
  117. package/dist/v3/utils/durations.js +93 -0
  118. package/dist/v3/utils/durations.js.map +1 -0
  119. package/dist/v3/utils/durations.mjs +82 -0
  120. package/dist/v3/utils/durations.mjs.map +1 -0
  121. package/dist/v3/utils/flattenAttributes.d.mts +8 -0
  122. package/dist/v3/utils/flattenAttributes.d.ts +8 -0
  123. package/dist/v3/utils/flattenAttributes.js +131 -0
  124. package/dist/v3/utils/flattenAttributes.js.map +1 -0
  125. package/dist/v3/utils/flattenAttributes.mjs +126 -0
  126. package/dist/v3/utils/flattenAttributes.mjs.map +1 -0
  127. package/dist/v3/utils/ioSerialization.d.mts +21 -0
  128. package/dist/v3/utils/ioSerialization.d.ts +21 -0
  129. package/dist/v3/utils/ioSerialization.js +2403 -0
  130. package/dist/v3/utils/ioSerialization.js.map +1 -0
  131. package/dist/v3/utils/ioSerialization.mjs +2394 -0
  132. package/dist/v3/utils/ioSerialization.mjs.map +1 -0
  133. package/dist/v3/utils/omit.d.mts +3 -0
  134. package/dist/v3/utils/omit.d.ts +3 -0
  135. package/dist/v3/utils/omit.js +20 -0
  136. package/dist/v3/utils/omit.js.map +1 -0
  137. package/dist/v3/utils/omit.mjs +18 -0
  138. package/dist/v3/utils/omit.mjs.map +1 -0
  139. package/dist/v3/utils/retries.d.mts +46 -0
  140. package/dist/v3/utils/retries.d.ts +46 -0
  141. package/dist/v3/utils/retries.js +118 -0
  142. package/dist/v3/utils/retries.js.map +1 -0
  143. package/dist/v3/utils/retries.mjs +113 -0
  144. package/dist/v3/utils/retries.mjs.map +1 -0
  145. package/dist/v3/utils/timers.d.mts +6 -0
  146. package/dist/v3/utils/timers.d.ts +6 -0
  147. package/dist/v3/utils/timers.js +31 -0
  148. package/dist/v3/utils/timers.js.map +1 -0
  149. package/dist/v3/utils/timers.mjs +28 -0
  150. package/dist/v3/utils/timers.mjs.map +1 -0
  151. package/dist/v3/workers/index.d.mts +56 -8
  152. package/dist/v3/workers/index.d.ts +56 -8
  153. package/dist/v3/workers/index.js +755 -279
  154. package/dist/v3/workers/index.js.map +1 -1
  155. package/dist/v3/workers/index.mjs +753 -280
  156. package/dist/v3/workers/index.mjs.map +1 -1
  157. package/dist/v3/zodIpc.js.map +1 -1
  158. package/dist/v3/zodIpc.mjs.map +1 -1
  159. package/dist/v3/zodMessageHandler.d.mts +16 -3
  160. package/dist/v3/zodMessageHandler.d.ts +16 -3
  161. package/dist/v3/zodMessageHandler.js +77 -23
  162. package/dist/v3/zodMessageHandler.js.map +1 -1
  163. package/dist/v3/zodMessageHandler.mjs +77 -23
  164. package/dist/v3/zodMessageHandler.mjs.map +1 -1
  165. package/dist/v3/zodNamespace.js +59 -28
  166. package/dist/v3/zodNamespace.js.map +1 -1
  167. package/dist/v3/zodNamespace.mjs +60 -29
  168. package/dist/v3/zodNamespace.mjs.map +1 -1
  169. package/dist/v3/zodSocket.d.mts +8 -3
  170. package/dist/v3/zodSocket.d.ts +8 -3
  171. package/dist/v3/zodSocket.js +56 -25
  172. package/dist/v3/zodSocket.js.map +1 -1
  173. package/dist/v3/zodSocket.mjs +57 -26
  174. package/dist/v3/zodSocket.mjs.map +1 -1
  175. package/dist/v3/zodfetch.d.mts +15 -58
  176. package/dist/v3/zodfetch.d.ts +15 -58
  177. package/dist/v3/zodfetch.js +246 -156
  178. package/dist/v3/zodfetch.js.map +1 -1
  179. package/dist/v3/zodfetch.mjs +244 -149
  180. package/dist/v3/zodfetch.mjs.map +1 -1
  181. package/dist/versions.d.mts +11 -0
  182. package/dist/versions.d.ts +11 -0
  183. package/dist/versions.js +31 -0
  184. package/dist/versions.js.map +1 -0
  185. package/dist/versions.mjs +27 -0
  186. package/dist/versions.mjs.map +1 -0
  187. package/package.json +154 -10
package/dist/v3/index.js CHANGED
@@ -3,8 +3,6 @@
3
3
  var api = require('@opentelemetry/api');
4
4
  var zod = require('zod');
5
5
  var zodValidationError = require('zod-validation-error');
6
- var formDataEncoder = require('form-data-encoder');
7
- var stream = require('stream');
8
6
  var preciseDate = require('@google-cloud/precise-date');
9
7
  var apiLogs = require('@opentelemetry/api-logs');
10
8
  var humanizeDuration = require('humanize-duration');
@@ -35,7 +33,7 @@ var __privateMethod = (obj, member, method) => {
35
33
  };
36
34
 
37
35
  // package.json
38
- var version = "0.0.0-prerelease-20240603154820";
36
+ var version = "0.0.0-prerelease-20240723165848";
39
37
  var dependencies = {
40
38
  "@google-cloud/precise-date": "^4.0.0",
41
39
  "@opentelemetry/api": "^1.8.0",
@@ -49,9 +47,8 @@ var dependencies = {
49
47
  "@opentelemetry/sdk-trace-base": "^1.22.0",
50
48
  "@opentelemetry/sdk-trace-node": "^1.22.0",
51
49
  "@opentelemetry/semantic-conventions": "^1.22.0",
52
- "form-data-encoder": "^4.0.2",
53
50
  "humanize-duration": "^3.27.3",
54
- "socket.io-client": "4.7.4",
51
+ "socket.io-client": "4.7.5",
55
52
  superjson: "^2.2.1",
56
53
  ulidx: "^2.2.1",
57
54
  zod: "3.22.3",
@@ -71,6 +68,41 @@ var GetPersonalAccessTokenResponseSchema = zod.z.object({
71
68
  obfuscatedToken: zod.z.string()
72
69
  }).nullable()
73
70
  });
71
+ var MachineCpu = zod.z.union([
72
+ zod.z.literal(0.25),
73
+ zod.z.literal(0.5),
74
+ zod.z.literal(1),
75
+ zod.z.literal(2),
76
+ zod.z.literal(4)
77
+ ]);
78
+ var MachineMemory = zod.z.union([
79
+ zod.z.literal(0.25),
80
+ zod.z.literal(0.5),
81
+ zod.z.literal(1),
82
+ zod.z.literal(2),
83
+ zod.z.literal(4),
84
+ zod.z.literal(8)
85
+ ]);
86
+ var MachinePresetName = zod.z.enum([
87
+ "micro",
88
+ "small-1x",
89
+ "small-2x",
90
+ "medium-1x",
91
+ "medium-2x",
92
+ "large-1x",
93
+ "large-2x"
94
+ ]);
95
+ var MachineConfig = zod.z.object({
96
+ cpu: MachineCpu.optional(),
97
+ memory: MachineMemory.optional(),
98
+ preset: MachinePresetName.optional()
99
+ });
100
+ var MachinePreset = zod.z.object({
101
+ name: MachinePresetName,
102
+ cpu: zod.z.number(),
103
+ memory: zod.z.number(),
104
+ centsPerMs: zod.z.number()
105
+ });
74
106
  var TaskRunBuiltInError = zod.z.object({
75
107
  type: zod.z.literal("BUILT_IN_ERROR"),
76
108
  name: zod.z.string(),
@@ -116,7 +148,8 @@ var TaskRunInternalError = zod.z.object({
116
148
  "GRACEFUL_EXIT_TIMEOUT",
117
149
  "TASK_RUN_HEARTBEAT_TIMEOUT"
118
150
  ]),
119
- message: zod.z.string().optional()
151
+ message: zod.z.string().optional(),
152
+ stackTrace: zod.z.string().optional()
120
153
  });
121
154
  var TaskRunError = zod.z.discriminatedUnion("type", [
122
155
  TaskRunBuiltInError,
@@ -132,7 +165,12 @@ var TaskRun = zod.z.object({
132
165
  tags: zod.z.array(zod.z.string()),
133
166
  isTest: zod.z.boolean().default(false),
134
167
  createdAt: zod.z.coerce.date(),
135
- idempotencyKey: zod.z.string().optional()
168
+ startedAt: zod.z.coerce.date().default(() => /* @__PURE__ */ new Date()),
169
+ idempotencyKey: zod.z.string().optional(),
170
+ maxAttempts: zod.z.number().optional(),
171
+ durationMs: zod.z.number().default(0),
172
+ costInCents: zod.z.number().default(0),
173
+ baseCostInCents: zod.z.number().default(0)
136
174
  });
137
175
  var TaskRunExecutionTask = zod.z.object({
138
176
  id: zod.z.string(),
@@ -183,7 +221,8 @@ var TaskRunExecution = zod.z.object({
183
221
  environment: TaskRunExecutionEnvironment,
184
222
  organization: TaskRunExecutionOrganization,
185
223
  project: TaskRunExecutionProject,
186
- batch: TaskRunExecutionBatch.optional()
224
+ batch: TaskRunExecutionBatch.optional(),
225
+ machine: MachinePreset.optional()
187
226
  });
188
227
  var TaskRunContext = zod.z.object({
189
228
  task: TaskRunExecutionTask,
@@ -199,25 +238,31 @@ var TaskRunContext = zod.z.object({
199
238
  environment: TaskRunExecutionEnvironment,
200
239
  organization: TaskRunExecutionOrganization,
201
240
  project: TaskRunExecutionProject,
202
- batch: TaskRunExecutionBatch.optional()
241
+ batch: TaskRunExecutionBatch.optional(),
242
+ machine: MachinePreset.optional()
203
243
  });
204
244
  var TaskRunExecutionRetry = zod.z.object({
205
245
  timestamp: zod.z.number(),
206
246
  delay: zod.z.number(),
207
247
  error: zod.z.unknown().optional()
208
248
  });
249
+ var TaskRunExecutionUsage = zod.z.object({
250
+ durationMs: zod.z.number()
251
+ });
209
252
  var TaskRunFailedExecutionResult = zod.z.object({
210
253
  ok: zod.z.literal(false),
211
254
  id: zod.z.string(),
212
255
  error: TaskRunError,
213
256
  retry: TaskRunExecutionRetry.optional(),
214
- skippedRetrying: zod.z.boolean().optional()
257
+ skippedRetrying: zod.z.boolean().optional(),
258
+ usage: TaskRunExecutionUsage.optional()
215
259
  });
216
260
  var TaskRunSuccessfulExecutionResult = zod.z.object({
217
261
  ok: zod.z.literal(true),
218
262
  id: zod.z.string(),
219
263
  output: zod.z.string().optional(),
220
- outputType: zod.z.string()
264
+ outputType: zod.z.string(),
265
+ usage: TaskRunExecutionUsage.optional()
221
266
  });
222
267
  var TaskRunExecutionResult = zod.z.discriminatedUnion("ok", [
223
268
  TaskRunSuccessfulExecutionResult,
@@ -235,26 +280,6 @@ var EnvironmentType = zod.z.enum([
235
280
  "DEVELOPMENT",
236
281
  "PREVIEW"
237
282
  ]);
238
- var MachineCpu = zod.z.union([
239
- zod.z.literal(0.25),
240
- zod.z.literal(0.5),
241
- zod.z.literal(1),
242
- zod.z.literal(2),
243
- zod.z.literal(4)
244
- ]).default(0.5);
245
- var MachineMemory = zod.z.union([
246
- zod.z.literal(0.25),
247
- zod.z.literal(0.5),
248
- zod.z.literal(1),
249
- zod.z.literal(2),
250
- zod.z.literal(4),
251
- zod.z.literal(8)
252
- ]).default(1);
253
- var Machine = zod.z.object({
254
- version: zod.z.literal("v1").default("v1"),
255
- cpu: MachineCpu,
256
- memory: MachineMemory
257
- });
258
283
  var TaskRunExecutionPayload = zod.z.object({
259
284
  execution: TaskRunExecution,
260
285
  traceContext: zod.z.record(zod.z.unknown()),
@@ -265,6 +290,12 @@ var ProdTaskRunExecution = TaskRunExecution.extend({
265
290
  id: zod.z.string(),
266
291
  contentHash: zod.z.string(),
267
292
  version: zod.z.string()
293
+ }),
294
+ machine: MachinePreset.default({
295
+ name: "small-1x",
296
+ cpu: 1,
297
+ memory: 1,
298
+ centsPerMs: 0
268
299
  })
269
300
  });
270
301
  var ProdTaskRunExecutionPayload = zod.z.object({
@@ -364,13 +395,18 @@ var QueueOptions = zod.z.object({
364
395
  /** @deprecated This feature is coming soon */
365
396
  rateLimit: RateLimitOptions.optional()
366
397
  });
398
+ var ScheduleMetadata = zod.z.object({
399
+ cron: zod.z.string(),
400
+ timezone: zod.z.string()
401
+ });
367
402
  var TaskMetadata = zod.z.object({
368
403
  id: zod.z.string(),
369
404
  packageVersion: zod.z.string(),
370
405
  queue: QueueOptions.optional(),
371
406
  retry: RetryOptions.optional(),
372
- machine: Machine.partial().optional(),
373
- triggerSource: zod.z.string().optional()
407
+ machine: MachineConfig.optional(),
408
+ triggerSource: zod.z.string().optional(),
409
+ schedule: ScheduleMetadata.optional()
374
410
  });
375
411
  var TaskFileMetadata = zod.z.object({
376
412
  filePath: zod.z.string(),
@@ -381,8 +417,9 @@ var TaskMetadataWithFilePath = zod.z.object({
381
417
  packageVersion: zod.z.string(),
382
418
  queue: QueueOptions.optional(),
383
419
  retry: RetryOptions.optional(),
384
- machine: Machine.partial().optional(),
420
+ machine: MachineConfig.optional(),
385
421
  triggerSource: zod.z.string().optional(),
422
+ schedule: ScheduleMetadata.optional(),
386
423
  filePath: zod.z.string(),
387
424
  exportName: zod.z.string()
388
425
  });
@@ -419,7 +456,8 @@ var Config = zod.z.object({
419
456
  ])).optional(),
420
457
  logLevel: zod.z.string().optional(),
421
458
  enableConsoleLogging: zod.z.boolean().optional(),
422
- postInstall: zod.z.string().optional()
459
+ postInstall: zod.z.string().optional(),
460
+ extraCACerts: zod.z.string().optional()
423
461
  });
424
462
  var WaitReason = zod.z.enum([
425
463
  "WAIT_FOR_DURATION",
@@ -428,6 +466,7 @@ var WaitReason = zod.z.enum([
428
466
  ]);
429
467
  var TaskRunExecutionLazyAttemptPayload = zod.z.object({
430
468
  runId: zod.z.string(),
469
+ attemptCount: zod.z.number().optional(),
431
470
  messageId: zod.z.string(),
432
471
  isTest: zod.z.boolean(),
433
472
  traceContext: zod.z.record(zod.z.unknown()),
@@ -441,8 +480,9 @@ var TaskResource = zod.z.object({
441
480
  exportName: zod.z.string(),
442
481
  queue: QueueOptions.optional(),
443
482
  retry: RetryOptions.optional(),
444
- machine: Machine.partial().optional(),
445
- triggerSource: zod.z.string().optional()
483
+ machine: MachineConfig.optional(),
484
+ triggerSource: zod.z.string().optional(),
485
+ schedule: ScheduleMetadata.optional()
446
486
  });
447
487
  var BackgroundWorkerMetadata = zod.z.object({
448
488
  packageVersion: zod.z.string(),
@@ -454,6 +494,14 @@ var ImageDetailsMetadata = zod.z.object({
454
494
  contentHash: zod.z.string(),
455
495
  imageTag: zod.z.string()
456
496
  });
497
+ var _AbortTaskRunError = class _AbortTaskRunError extends Error {
498
+ constructor(message) {
499
+ super(message);
500
+ this.name = "AbortTaskRunError";
501
+ }
502
+ };
503
+ __name(_AbortTaskRunError, "AbortTaskRunError");
504
+ var AbortTaskRunError = _AbortTaskRunError;
457
505
  function parseError(error) {
458
506
  if (error instanceof Error) {
459
507
  return {
@@ -534,6 +582,39 @@ function createJsonErrorObject(error) {
534
582
  }
535
583
  }
536
584
  __name(createJsonErrorObject, "createJsonErrorObject");
585
+ function sanitizeError(error) {
586
+ switch (error.type) {
587
+ case "BUILT_IN_ERROR": {
588
+ return {
589
+ type: "BUILT_IN_ERROR",
590
+ message: error.message?.replace(/\0/g, ""),
591
+ name: error.name?.replace(/\0/g, ""),
592
+ stackTrace: error.stackTrace?.replace(/\0/g, "")
593
+ };
594
+ }
595
+ case "STRING_ERROR": {
596
+ return {
597
+ type: "STRING_ERROR",
598
+ raw: error.raw.replace(/\0/g, "")
599
+ };
600
+ }
601
+ case "CUSTOM_ERROR": {
602
+ return {
603
+ type: "CUSTOM_ERROR",
604
+ raw: error.raw.replace(/\0/g, "")
605
+ };
606
+ }
607
+ case "INTERNAL_ERROR": {
608
+ return {
609
+ type: "INTERNAL_ERROR",
610
+ code: error.code,
611
+ message: error.message?.replace(/\0/g, ""),
612
+ stackTrace: error.stackTrace?.replace(/\0/g, "")
613
+ };
614
+ }
615
+ }
616
+ }
617
+ __name(sanitizeError, "sanitizeError");
537
618
  function correctErrorStackTrace(stackTrace, projectDir, options) {
538
619
  const [errorLine, ...traceLines] = stackTrace.split("\n");
539
620
  return [
@@ -636,6 +717,22 @@ var CreateBackgroundWorkerResponse = zod.z.object({
636
717
  version: zod.z.string(),
637
718
  contentHash: zod.z.string()
638
719
  });
720
+ var RunTag = zod.z.string().max(64, "Tags must be less than 64 characters");
721
+ var RunTags = zod.z.union([
722
+ RunTag,
723
+ zod.z.tuple([
724
+ RunTag
725
+ ]),
726
+ zod.z.tuple([
727
+ RunTag,
728
+ RunTag
729
+ ]),
730
+ zod.z.tuple([
731
+ RunTag,
732
+ RunTag,
733
+ RunTag
734
+ ])
735
+ ]);
639
736
  var TriggerTaskRequestBody = zod.z.object({
640
737
  payload: zod.z.any(),
641
738
  context: zod.z.any(),
@@ -647,7 +744,11 @@ var TriggerTaskRequestBody = zod.z.object({
647
744
  concurrencyKey: zod.z.string().optional(),
648
745
  idempotencyKey: zod.z.string().optional(),
649
746
  test: zod.z.boolean().optional(),
650
- payloadType: zod.z.string().optional()
747
+ payloadType: zod.z.string().optional(),
748
+ delay: zod.z.string().or(zod.z.coerce.date()).optional(),
749
+ ttl: zod.z.string().or(zod.z.number().nonnegative().int()).optional(),
750
+ tags: RunTags.optional(),
751
+ maxAttempts: zod.z.number().int().optional()
651
752
  }).optional()
652
753
  });
653
754
  var TriggerTaskResponse = zod.z.object({
@@ -674,6 +775,12 @@ var GetBatchResponseBody = zod.z.object({
674
775
  ])
675
776
  }))
676
777
  });
778
+ var AddTagsRequestBody = zod.z.object({
779
+ tags: RunTags
780
+ });
781
+ var RescheduleRunRequestBody = zod.z.object({
782
+ delay: zod.z.string().or(zod.z.coerce.date())
783
+ });
677
784
  var GetEnvironmentVariablesResponseBody = zod.z.object({
678
785
  variables: zod.z.record(zod.z.string())
679
786
  });
@@ -706,7 +813,8 @@ var InitializeDeploymentRequestBody = zod.z.object({
706
813
  var DeploymentErrorData = zod.z.object({
707
814
  name: zod.z.string(),
708
815
  message: zod.z.string(),
709
- stack: zod.z.string().optional()
816
+ stack: zod.z.string().optional(),
817
+ stderr: zod.z.string().optional()
710
818
  });
711
819
  var GetDeploymentResponseBody = zod.z.object({
712
820
  id: zod.z.string(),
@@ -744,20 +852,42 @@ var ReplayRunResponse = zod.z.object({
744
852
  var CanceledRunResponse = zod.z.object({
745
853
  id: zod.z.string()
746
854
  });
855
+ var ScheduleType = zod.z.union([
856
+ zod.z.literal("DECLARATIVE"),
857
+ zod.z.literal("IMPERATIVE")
858
+ ]);
747
859
  var ScheduledTaskPayload = zod.z.object({
748
860
  /** The schedule id associated with this run (you can have many schedules for the same task).
749
861
  You can use this to remove the schedule, update it, etc */
750
862
  scheduleId: zod.z.string(),
863
+ /** The type of schedule – `"DECLARATIVE"` or `"IMPERATIVE"`.
864
+ *
865
+ * **DECLARATIVE** – defined inline on your `schedules.task` using the `cron` property. They can only be created, updated or deleted by modifying the `cron` property on your task.
866
+ *
867
+ * **IMPERATIVE** – created using the `schedules.create` functions or in the dashboard.
868
+ */
869
+ type: ScheduleType,
751
870
  /** When the task was scheduled to run.
752
- * Note this will be slightly different from `new Date()` because it takes a few ms to run the task. */
871
+ * Note this will be slightly different from `new Date()` because it takes a few ms to run the task.
872
+ *
873
+ * This date is UTC. To output it as a string with a timezone you would do this:
874
+ * ```ts
875
+ * const formatted = payload.timestamp.toLocaleString("en-US", {
876
+ timeZone: payload.timezone,
877
+ });
878
+ ``` */
753
879
  timestamp: zod.z.date(),
754
880
  /** When the task was last run (it has been).
755
- This can be undefined if it's never been run */
881
+ This can be undefined if it's never been run. This date is UTC. */
756
882
  lastTimestamp: zod.z.date().optional(),
757
883
  /** You can optionally provide an external id when creating the schedule.
758
884
  Usually you would use a userId or some other unique identifier.
759
885
  This defaults to undefined if you didn't provide one. */
760
886
  externalId: zod.z.string().optional(),
887
+ /** The IANA timezone the schedule is set to. The default is UTC.
888
+ * You can see the full list of supported timezones here: https://cloud.trigger.dev/timezones
889
+ */
890
+ timezone: zod.z.string(),
761
891
  /** The next 5 dates this task is scheduled to run */
762
892
  upcoming: zod.z.array(zod.z.date())
763
893
  });
@@ -781,17 +911,30 @@ var CreateScheduleOptions = zod.z.object({
781
911
 
782
912
  */
783
913
  cron: zod.z.string(),
784
- /** (Optional) You can only create one schedule with this key. If you use it twice, the second call will update the schedule.
914
+ /** You can only create one schedule with this key. If you use it twice, the second call will update the schedule.
785
915
  *
786
- * This is useful if you don't want to create duplicate schedules for a user. */
787
- deduplicationKey: zod.z.string().optional(),
916
+ * This is required to prevent you from creating duplicate schedules. */
917
+ deduplicationKey: zod.z.string(),
788
918
  /** Optionally, you can specify your own IDs (like a user ID) and then use it inside the run function of your task.
789
919
  *
790
920
  * This allows you to have per-user CRON tasks.
791
921
  */
792
- externalId: zod.z.string().optional()
922
+ externalId: zod.z.string().optional(),
923
+ /** Optionally, you can specify a timezone in the IANA format. If unset it will use UTC.
924
+ * If specified then the CRON will be evaluated in that timezone and will respect daylight savings.
925
+ *
926
+ * If you set the CRON to `0 0 * * *` and the timezone to `America/New_York` then the task will run at midnight in New York time, no matter whether it's daylight savings or not.
927
+ *
928
+ * You can see the full list of supported timezones here: https://cloud.trigger.dev/timezones
929
+ *
930
+ * @example "America/New_York", "Europe/London", "Asia/Tokyo", "Africa/Cairo"
931
+ *
932
+ */
933
+ timezone: zod.z.string().optional()
934
+ });
935
+ var UpdateScheduleOptions = CreateScheduleOptions.omit({
936
+ deduplicationKey: true
793
937
  });
794
- var UpdateScheduleOptions = CreateScheduleOptions;
795
938
  var ScheduleGenerator = zod.z.object({
796
939
  type: zod.z.literal("CRON"),
797
940
  expression: zod.z.string(),
@@ -799,11 +942,13 @@ var ScheduleGenerator = zod.z.object({
799
942
  });
800
943
  var ScheduleObject = zod.z.object({
801
944
  id: zod.z.string(),
945
+ type: ScheduleType,
802
946
  task: zod.z.string(),
803
947
  active: zod.z.boolean(),
804
948
  deduplicationKey: zod.z.string().nullish(),
805
949
  externalId: zod.z.string().nullish(),
806
950
  generator: ScheduleGenerator,
951
+ timezone: zod.z.string(),
807
952
  nextRun: zod.z.coerce.date().nullish(),
808
953
  environments: zod.z.array(zod.z.object({
809
954
  id: zod.z.string(),
@@ -826,6 +971,9 @@ var ListScheduleOptions = zod.z.object({
826
971
  page: zod.z.number().optional(),
827
972
  perPage: zod.z.number().optional()
828
973
  });
974
+ var TimezonesResult = zod.z.object({
975
+ timezones: zod.z.array(zod.z.string())
976
+ });
829
977
  var RunStatus = zod.z.enum([
830
978
  /// Task hasn't been deployed yet but is waiting to be executed
831
979
  "WAITING_FOR_DEPLOY",
@@ -848,7 +996,11 @@ var RunStatus = zod.z.enum([
848
996
  /// Task was interrupted during execution, mostly this happens in development environments
849
997
  "INTERRUPTED",
850
998
  /// Task has failed to complete, due to an error in the system
851
- "SYSTEM_FAILURE"
999
+ "SYSTEM_FAILURE",
1000
+ /// Task has been scheduled to run at a specific time
1001
+ "DELAYED",
1002
+ /// Task has expired and won't be executed
1003
+ "EXPIRED"
852
1004
  ]);
853
1005
  var AttemptStatus = zod.z.enum([
854
1006
  "PENDING",
@@ -885,12 +1037,21 @@ var CommonRunFields = {
885
1037
  createdAt: zod.z.coerce.date(),
886
1038
  updatedAt: zod.z.coerce.date(),
887
1039
  startedAt: zod.z.coerce.date().optional(),
888
- finishedAt: zod.z.coerce.date().optional()
1040
+ finishedAt: zod.z.coerce.date().optional(),
1041
+ delayedUntil: zod.z.coerce.date().optional(),
1042
+ ttl: zod.z.string().optional(),
1043
+ expiredAt: zod.z.coerce.date().optional(),
1044
+ tags: zod.z.string().array(),
1045
+ costInCents: zod.z.number(),
1046
+ baseCostInCents: zod.z.number(),
1047
+ durationMs: zod.z.number()
889
1048
  };
890
1049
  var RetrieveRunResponse = zod.z.object({
891
1050
  ...CommonRunFields,
892
1051
  payload: zod.z.any().optional(),
1052
+ payloadPresignedUrl: zod.z.string().optional(),
893
1053
  output: zod.z.any().optional(),
1054
+ outputPresignedUrl: zod.z.string().optional(),
894
1055
  schedule: RunScheduleDetails.optional(),
895
1056
  attempts: zod.z.array(zod.z.object({
896
1057
  id: zod.z.string(),
@@ -949,7 +1110,7 @@ var BackgroundWorkerServerMessages = zod.z.discriminatedUnion("type", [
949
1110
  type: zod.z.literal("SCHEDULE_ATTEMPT"),
950
1111
  image: zod.z.string(),
951
1112
  version: zod.z.string(),
952
- machine: Machine,
1113
+ machine: MachinePreset,
953
1114
  // identifiers
954
1115
  id: zod.z.string().optional(),
955
1116
  envId: zod.z.string(),
@@ -1119,47 +1280,15 @@ var ProdChildToWorkerMessages = {
1119
1280
  id: zod.z.string()
1120
1281
  })
1121
1282
  },
1122
- TASK_RUN_HEARTBEAT: {
1123
- message: zod.z.object({
1124
- version: zod.z.literal("v1").default("v1"),
1125
- id: zod.z.string()
1126
- })
1127
- },
1128
1283
  READY_TO_DISPOSE: {
1129
1284
  message: zod.z.undefined()
1130
1285
  },
1131
- READY_FOR_CHECKPOINT: {
1132
- message: zod.z.object({
1133
- version: zod.z.literal("v1").default("v1")
1134
- })
1135
- },
1136
- CANCEL_CHECKPOINT: {
1137
- message: zod.z.discriminatedUnion("version", [
1138
- zod.z.object({
1139
- version: zod.z.literal("v1")
1140
- }),
1141
- zod.z.object({
1142
- version: zod.z.literal("v2"),
1143
- reason: WaitReason.optional()
1144
- })
1145
- ]).default({
1146
- version: "v1"
1147
- }),
1148
- callback: zod.z.object({
1149
- // TODO: Figure out how best to handle callback schema parsing in zod IPC
1150
- version: zod.z.literal("v2"),
1151
- checkpointCanceled: zod.z.boolean(),
1152
- reason: WaitReason.optional()
1153
- })
1154
- },
1155
1286
  WAIT_FOR_DURATION: {
1156
1287
  message: zod.z.object({
1157
1288
  version: zod.z.literal("v1").default("v1"),
1158
1289
  ms: zod.z.number(),
1159
- now: zod.z.number()
1160
- }),
1161
- callback: zod.z.object({
1162
- willCheckpointAndRestore: zod.z.boolean()
1290
+ now: zod.z.number(),
1291
+ waitThresholdInMs: zod.z.number()
1163
1292
  })
1164
1293
  },
1165
1294
  WAIT_FOR_TASK: {
@@ -1238,7 +1367,8 @@ var ProviderToPlatformMessages = {
1238
1367
  reason: zod.z.string().optional(),
1239
1368
  exitCode: zod.z.number().optional(),
1240
1369
  message: zod.z.string().optional(),
1241
- logs: zod.z.string().optional()
1370
+ logs: zod.z.string().optional(),
1371
+ overrideCompletion: zod.z.boolean().optional()
1242
1372
  })
1243
1373
  },
1244
1374
  INDEXING_FAILED: {
@@ -1248,20 +1378,14 @@ var ProviderToPlatformMessages = {
1248
1378
  error: zod.z.object({
1249
1379
  name: zod.z.string(),
1250
1380
  message: zod.z.string(),
1251
- stack: zod.z.string().optional()
1252
- })
1381
+ stack: zod.z.string().optional(),
1382
+ stderr: zod.z.string().optional()
1383
+ }),
1384
+ overrideCompletion: zod.z.boolean().optional()
1253
1385
  })
1254
1386
  }
1255
1387
  };
1256
1388
  var PlatformToProviderMessages = {
1257
- HEALTH: {
1258
- message: zod.z.object({
1259
- version: zod.z.literal("v1").default("v1")
1260
- }),
1261
- callback: zod.z.object({
1262
- status: zod.z.literal("ok")
1263
- })
1264
- },
1265
1389
  INDEX: {
1266
1390
  message: zod.z.object({
1267
1391
  version: zod.z.literal("v1").default("v1"),
@@ -1282,7 +1406,8 @@ var PlatformToProviderMessages = {
1282
1406
  error: zod.z.object({
1283
1407
  name: zod.z.string(),
1284
1408
  message: zod.z.string(),
1285
- stack: zod.z.string().optional()
1409
+ stack: zod.z.string().optional(),
1410
+ stderr: zod.z.string().optional()
1286
1411
  })
1287
1412
  }),
1288
1413
  zod.z.object({
@@ -1290,7 +1415,6 @@ var PlatformToProviderMessages = {
1290
1415
  })
1291
1416
  ])
1292
1417
  },
1293
- // TODO: this should be a shared queue message instead
1294
1418
  RESTORE: {
1295
1419
  message: zod.z.object({
1296
1420
  version: zod.z.literal("v1").default("v1"),
@@ -1301,7 +1425,7 @@ var PlatformToProviderMessages = {
1301
1425
  location: zod.z.string(),
1302
1426
  reason: zod.z.string().optional(),
1303
1427
  imageRef: zod.z.string(),
1304
- machine: Machine,
1428
+ machine: MachinePreset,
1305
1429
  // identifiers
1306
1430
  checkpointId: zod.z.string(),
1307
1431
  envId: zod.z.string(),
@@ -1310,21 +1434,6 @@ var PlatformToProviderMessages = {
1310
1434
  projectId: zod.z.string(),
1311
1435
  runId: zod.z.string()
1312
1436
  })
1313
- },
1314
- DELETE: {
1315
- message: zod.z.object({
1316
- version: zod.z.literal("v1").default("v1"),
1317
- name: zod.z.string()
1318
- }),
1319
- callback: zod.z.object({
1320
- message: zod.z.string()
1321
- })
1322
- },
1323
- GET: {
1324
- message: zod.z.object({
1325
- version: zod.z.literal("v1").default("v1"),
1326
- name: zod.z.string()
1327
- })
1328
1437
  }
1329
1438
  };
1330
1439
  var CreateWorkerMessage = zod.z.object({
@@ -1382,6 +1491,7 @@ var CoordinatorToPlatformMessages = {
1382
1491
  })
1383
1492
  ])
1384
1493
  },
1494
+ // Deprecated: Only workers without lazy attempt support will use this
1385
1495
  READY_FOR_EXECUTION: {
1386
1496
  message: zod.z.object({
1387
1497
  version: zod.z.literal("v1").default("v1"),
@@ -1478,6 +1588,10 @@ var CoordinatorToPlatformMessages = {
1478
1588
  attemptNumber: zod.z.number()
1479
1589
  })
1480
1590
  ])
1591
+ }),
1592
+ callback: zod.z.object({
1593
+ version: zod.z.literal("v1").default("v1"),
1594
+ keepRunAlive: zod.z.boolean()
1481
1595
  })
1482
1596
  },
1483
1597
  INDEXING_FAILED: {
@@ -1487,7 +1601,8 @@ var CoordinatorToPlatformMessages = {
1487
1601
  error: zod.z.object({
1488
1602
  name: zod.z.string(),
1489
1603
  message: zod.z.string(),
1490
- stack: zod.z.string().optional()
1604
+ stack: zod.z.string().optional(),
1605
+ stderr: zod.z.string().optional()
1491
1606
  })
1492
1607
  })
1493
1608
  },
@@ -1540,6 +1655,12 @@ var PlatformToCoordinatorMessages = {
1540
1655
  version: zod.z.literal("v1").default("v1"),
1541
1656
  runId: zod.z.string()
1542
1657
  })
1658
+ },
1659
+ DYNAMIC_CONFIG: {
1660
+ message: zod.z.object({
1661
+ version: zod.z.literal("v1").default("v1"),
1662
+ checkpointThresholdInMs: zod.z.number()
1663
+ })
1543
1664
  }
1544
1665
  };
1545
1666
  var ClientToSharedQueueMessages = {
@@ -1585,10 +1706,9 @@ var IndexTasksMessage = zod.z.object({
1585
1706
  packageVersion: zod.z.string()
1586
1707
  });
1587
1708
  var ProdWorkerToCoordinatorMessages = {
1588
- LOG: {
1709
+ TEST: {
1589
1710
  message: zod.z.object({
1590
- version: zod.z.literal("v1").default("v1"),
1591
- text: zod.z.string()
1711
+ version: zod.z.literal("v1").default("v1")
1592
1712
  }),
1593
1713
  callback: zod.z.void()
1594
1714
  },
@@ -1611,6 +1731,7 @@ var ProdWorkerToCoordinatorMessages = {
1611
1731
  })
1612
1732
  ])
1613
1733
  },
1734
+ // Deprecated: Only workers without lazy attempt support will use this
1614
1735
  READY_FOR_EXECUTION: {
1615
1736
  message: zod.z.object({
1616
1737
  version: zod.z.literal("v1").default("v1"),
@@ -1697,7 +1818,10 @@ var ProdWorkerToCoordinatorMessages = {
1697
1818
  },
1698
1819
  WAIT_FOR_TASK: {
1699
1820
  message: zod.z.object({
1700
- version: zod.z.literal("v1").default("v1"),
1821
+ version: zod.z.enum([
1822
+ "v1",
1823
+ "v2"
1824
+ ]).default("v1"),
1701
1825
  friendlyId: zod.z.string(),
1702
1826
  // This is the attempt that is waiting
1703
1827
  attemptFriendlyId: zod.z.string()
@@ -1708,7 +1832,10 @@ var ProdWorkerToCoordinatorMessages = {
1708
1832
  },
1709
1833
  WAIT_FOR_BATCH: {
1710
1834
  message: zod.z.object({
1711
- version: zod.z.literal("v1").default("v1"),
1835
+ version: zod.z.enum([
1836
+ "v1",
1837
+ "v2"
1838
+ ]).default("v1"),
1712
1839
  batchFriendlyId: zod.z.string(),
1713
1840
  runFriendlyIds: zod.z.string().array(),
1714
1841
  // This is the attempt that is waiting
@@ -1725,7 +1852,8 @@ var ProdWorkerToCoordinatorMessages = {
1725
1852
  error: zod.z.object({
1726
1853
  name: zod.z.string(),
1727
1854
  message: zod.z.string(),
1728
- stack: zod.z.string().optional()
1855
+ stack: zod.z.string().optional(),
1856
+ stderr: zod.z.string().optional()
1729
1857
  })
1730
1858
  })
1731
1859
  },
@@ -1754,6 +1882,12 @@ var ProdWorkerToCoordinatorMessages = {
1754
1882
  stack: zod.z.string().optional()
1755
1883
  })
1756
1884
  })
1885
+ },
1886
+ SET_STATE: {
1887
+ message: zod.z.object({
1888
+ version: zod.z.literal("v1").default("v1"),
1889
+ attemptFriendlyId: zod.z.string().optional()
1890
+ })
1757
1891
  }
1758
1892
  };
1759
1893
  var CoordinatorToProdWorkerMessages = {
@@ -1771,6 +1905,7 @@ var CoordinatorToProdWorkerMessages = {
1771
1905
  attemptId: zod.z.string()
1772
1906
  })
1773
1907
  },
1908
+ // Deprecated: Only workers without lazy attempt support will use this
1774
1909
  EXECUTE_TASK_RUN: {
1775
1910
  message: zod.z.object({
1776
1911
  version: zod.z.literal("v1").default("v1"),
@@ -1817,6 +1952,9 @@ var ProdWorkerSocketData = zod.z.object({
1817
1952
  deploymentId: zod.z.string(),
1818
1953
  deploymentVersion: zod.z.string()
1819
1954
  });
1955
+ var CoordinatorSocketData = zod.z.object({
1956
+ supportsDynamicConfig: zod.z.string().optional()
1957
+ });
1820
1958
  var PRIMARY_VARIANT = "primary";
1821
1959
  var Variant = zod.z.enum([
1822
1960
  PRIMARY_VARIANT
@@ -2064,6 +2202,10 @@ var SemanticInternalAttributes = {
2064
2202
  TASK_EXPORT_NAME: "ctx.task.exportName",
2065
2203
  QUEUE_NAME: "ctx.queue.name",
2066
2204
  QUEUE_ID: "ctx.queue.id",
2205
+ MACHINE_PRESET_NAME: "ctx.machine.name",
2206
+ MACHINE_PRESET_CPU: "ctx.machine.cpu",
2207
+ MACHINE_PRESET_MEMORY: "ctx.machine.memory",
2208
+ MACHINE_PRESET_CENTS_PER_MS: "ctx.machine.centsPerMs",
2067
2209
  SPAN_PARTIAL: "$span.partial",
2068
2210
  SPAN_ID: "$span.span_id",
2069
2211
  OUTPUT: "$output",
@@ -2087,7 +2229,12 @@ var SemanticInternalAttributes = {
2087
2229
  RETRY_DELAY: "retry.delay",
2088
2230
  RETRY_COUNT: "retry.count",
2089
2231
  LINK_TITLE: "$link.title",
2090
- IDEMPOTENCY_KEY: "ctx.run.idempotencyKey"
2232
+ IDEMPOTENCY_KEY: "ctx.run.idempotencyKey",
2233
+ USAGE_DURATION_MS: "$usage.durationMs",
2234
+ USAGE_COST_IN_CENTS: "$usage.costInCents",
2235
+ RATE_LIMIT_LIMIT: "response.rateLimit.limit",
2236
+ RATE_LIMIT_REMAINING: "response.rateLimit.remaining",
2237
+ RATE_LIMIT_RESET: "response.rateLimit.reset"
2091
2238
  };
2092
2239
 
2093
2240
  // src/v3/taskContext/index.ts
@@ -2151,7 +2298,11 @@ var _TaskContextAPI = class _TaskContextAPI {
2151
2298
  [SemanticInternalAttributes.ORGANIZATION_SLUG]: this.ctx.organization.slug,
2152
2299
  [SemanticInternalAttributes.ORGANIZATION_NAME]: this.ctx.organization.name,
2153
2300
  [SemanticInternalAttributes.BATCH_ID]: this.ctx.batch?.id,
2154
- [SemanticInternalAttributes.IDEMPOTENCY_KEY]: this.ctx.run.idempotencyKey
2301
+ [SemanticInternalAttributes.IDEMPOTENCY_KEY]: this.ctx.run.idempotencyKey,
2302
+ [SemanticInternalAttributes.MACHINE_PRESET_NAME]: this.ctx.machine?.name,
2303
+ [SemanticInternalAttributes.MACHINE_PRESET_CPU]: this.ctx.machine?.cpu,
2304
+ [SemanticInternalAttributes.MACHINE_PRESET_MEMORY]: this.ctx.machine?.memory,
2305
+ [SemanticInternalAttributes.MACHINE_PRESET_CENTS_PER_MS]: this.ctx.machine?.centsPerMs
2155
2306
  };
2156
2307
  }
2157
2308
  return {};
@@ -2173,160 +2324,22 @@ var TaskContextAPI = _TaskContextAPI;
2173
2324
  // src/v3/task-context-api.ts
2174
2325
  var taskContext = TaskContextAPI.getInstance();
2175
2326
 
2176
- // src/v3/apiClient/errors.ts
2177
- var _ApiError = class _ApiError extends Error {
2178
- constructor(status, error, message, headers) {
2179
- super(`${_ApiError.makeMessage(status, error, message)}`);
2180
- this.status = status;
2181
- this.headers = headers;
2182
- const data = error;
2183
- this.error = data;
2184
- this.code = data?.["code"];
2185
- this.param = data?.["param"];
2186
- this.type = data?.["type"];
2187
- }
2188
- static makeMessage(status, error, message) {
2189
- const msg = error?.message ? typeof error.message === "string" ? error.message : JSON.stringify(error.message) : error ? JSON.stringify(error) : message;
2190
- if (status && msg) {
2191
- return `${status} ${msg}`;
2192
- }
2193
- if (status) {
2194
- return `${status} status code (no body)`;
2195
- }
2196
- if (msg) {
2197
- return msg;
2198
- }
2199
- return "(no status code or body)";
2200
- }
2201
- static generate(status, errorResponse, message, headers) {
2202
- if (!status) {
2203
- return new ApiConnectionError({
2204
- cause: castToError(errorResponse)
2205
- });
2206
- }
2207
- const error = errorResponse?.["error"];
2208
- if (status === 400) {
2209
- return new BadRequestError(status, error, message, headers);
2210
- }
2211
- if (status === 401) {
2212
- return new AuthenticationError(status, error, message, headers);
2213
- }
2214
- if (status === 403) {
2215
- return new PermissionDeniedError(status, error, message, headers);
2216
- }
2217
- if (status === 404) {
2218
- return new NotFoundError(status, error, message, headers);
2219
- }
2220
- if (status === 409) {
2221
- return new ConflictError(status, error, message, headers);
2327
+ // src/retry.ts
2328
+ function calculateResetAt(resets, format, now = /* @__PURE__ */ new Date()) {
2329
+ if (!resets)
2330
+ return;
2331
+ switch (format) {
2332
+ case "iso_8601_duration_openai_variant": {
2333
+ return calculateISO8601DurationOpenAIVariantResetAt(resets, now);
2222
2334
  }
2223
- if (status === 422) {
2224
- return new UnprocessableEntityError(status, error, message, headers);
2335
+ case "iso_8601": {
2336
+ return calculateISO8601ResetAt(resets, now);
2225
2337
  }
2226
- if (status === 429) {
2227
- return new RateLimitError(status, error, message, headers);
2338
+ case "unix_timestamp": {
2339
+ return calculateUnixTimestampResetAt(resets, now);
2228
2340
  }
2229
- if (status >= 500) {
2230
- return new InternalServerError(status, error, message, headers);
2231
- }
2232
- return new _ApiError(status, error, message, headers);
2233
- }
2234
- };
2235
- __name(_ApiError, "ApiError");
2236
- var ApiError = _ApiError;
2237
- var _ApiConnectionError = class _ApiConnectionError extends ApiError {
2238
- constructor({ message, cause }) {
2239
- super(void 0, void 0, message || "Connection error.", void 0);
2240
- __publicField(this, "status");
2241
- if (cause)
2242
- this.cause = cause;
2243
- }
2244
- };
2245
- __name(_ApiConnectionError, "ApiConnectionError");
2246
- var ApiConnectionError = _ApiConnectionError;
2247
- var _BadRequestError = class _BadRequestError extends ApiError {
2248
- constructor() {
2249
- super(...arguments);
2250
- __publicField(this, "status", 400);
2251
- }
2252
- };
2253
- __name(_BadRequestError, "BadRequestError");
2254
- var BadRequestError = _BadRequestError;
2255
- var _AuthenticationError = class _AuthenticationError extends ApiError {
2256
- constructor() {
2257
- super(...arguments);
2258
- __publicField(this, "status", 401);
2259
- }
2260
- };
2261
- __name(_AuthenticationError, "AuthenticationError");
2262
- var AuthenticationError = _AuthenticationError;
2263
- var _PermissionDeniedError = class _PermissionDeniedError extends ApiError {
2264
- constructor() {
2265
- super(...arguments);
2266
- __publicField(this, "status", 403);
2267
- }
2268
- };
2269
- __name(_PermissionDeniedError, "PermissionDeniedError");
2270
- var PermissionDeniedError = _PermissionDeniedError;
2271
- var _NotFoundError = class _NotFoundError extends ApiError {
2272
- constructor() {
2273
- super(...arguments);
2274
- __publicField(this, "status", 404);
2275
- }
2276
- };
2277
- __name(_NotFoundError, "NotFoundError");
2278
- var NotFoundError = _NotFoundError;
2279
- var _ConflictError = class _ConflictError extends ApiError {
2280
- constructor() {
2281
- super(...arguments);
2282
- __publicField(this, "status", 409);
2283
- }
2284
- };
2285
- __name(_ConflictError, "ConflictError");
2286
- var ConflictError = _ConflictError;
2287
- var _UnprocessableEntityError = class _UnprocessableEntityError extends ApiError {
2288
- constructor() {
2289
- super(...arguments);
2290
- __publicField(this, "status", 422);
2291
- }
2292
- };
2293
- __name(_UnprocessableEntityError, "UnprocessableEntityError");
2294
- var UnprocessableEntityError = _UnprocessableEntityError;
2295
- var _RateLimitError = class _RateLimitError extends ApiError {
2296
- constructor() {
2297
- super(...arguments);
2298
- __publicField(this, "status", 429);
2299
- }
2300
- };
2301
- __name(_RateLimitError, "RateLimitError");
2302
- var RateLimitError = _RateLimitError;
2303
- var _InternalServerError = class _InternalServerError extends ApiError {
2304
- };
2305
- __name(_InternalServerError, "InternalServerError");
2306
- var InternalServerError = _InternalServerError;
2307
- function castToError(err) {
2308
- if (err instanceof Error)
2309
- return err;
2310
- return new Error(err);
2311
- }
2312
- __name(castToError, "castToError");
2313
-
2314
- // src/retry.ts
2315
- function calculateResetAt(resets, format, now = /* @__PURE__ */ new Date()) {
2316
- if (!resets)
2317
- return;
2318
- switch (format) {
2319
- case "iso_8601_duration_openai_variant": {
2320
- return calculateISO8601DurationOpenAIVariantResetAt(resets, now);
2321
- }
2322
- case "iso_8601": {
2323
- return calculateISO8601ResetAt(resets, now);
2324
- }
2325
- case "unix_timestamp": {
2326
- return calculateUnixTimestampResetAt(resets, now);
2327
- }
2328
- case "unix_timestamp_in_ms": {
2329
- return calculateUnixTimestampInMsResetAt(resets, now);
2341
+ case "unix_timestamp_in_ms": {
2342
+ return calculateUnixTimestampInMsResetAt(resets, now);
2330
2343
  }
2331
2344
  }
2332
2345
  }
@@ -2411,12 +2424,287 @@ function calculateNextRetryDelay(options, attempt) {
2411
2424
  const timeout = Math.min(maxTimeoutInMs, random * minTimeoutInMs * Math.pow(factor, attempt - 1));
2412
2425
  return Math.round(timeout);
2413
2426
  }
2414
- __name(calculateNextRetryDelay, "calculateNextRetryDelay");
2415
- function calculateResetAt2(resets, format, now = Date.now()) {
2416
- const resetAt = calculateResetAt(resets, format, new Date(now));
2417
- return resetAt?.getTime();
2427
+ __name(calculateNextRetryDelay, "calculateNextRetryDelay");
2428
+ function calculateResetAt2(resets, format, now = Date.now()) {
2429
+ const resetAt = calculateResetAt(resets, format, new Date(now));
2430
+ return resetAt?.getTime();
2431
+ }
2432
+ __name(calculateResetAt2, "calculateResetAt");
2433
+
2434
+ // src/v3/apiClient/errors.ts
2435
+ var _ApiError = class _ApiError extends Error {
2436
+ constructor(status, error, message, headers) {
2437
+ super(`${_ApiError.makeMessage(status, error, message)}`);
2438
+ this.name = "TriggerApiError";
2439
+ this.status = status;
2440
+ this.headers = headers;
2441
+ const data = error;
2442
+ this.error = data;
2443
+ this.code = data?.["code"];
2444
+ this.param = data?.["param"];
2445
+ this.type = data?.["type"];
2446
+ }
2447
+ static makeMessage(status, error, message) {
2448
+ const msg = error?.message ? typeof error.message === "string" ? error.message : JSON.stringify(error.message) : error ? JSON.stringify(error) : message;
2449
+ if (status && msg) {
2450
+ return `${status} ${msg}`;
2451
+ }
2452
+ if (status) {
2453
+ return `${status} status code (no body)`;
2454
+ }
2455
+ if (msg) {
2456
+ return msg;
2457
+ }
2458
+ return "(no status code or body)";
2459
+ }
2460
+ static generate(status, errorResponse, message, headers) {
2461
+ if (!status) {
2462
+ return new ApiConnectionError({
2463
+ cause: castToError(errorResponse)
2464
+ });
2465
+ }
2466
+ const error = errorResponse?.["error"];
2467
+ if (status === 400) {
2468
+ return new BadRequestError(status, error, message, headers);
2469
+ }
2470
+ if (status === 401) {
2471
+ return new AuthenticationError(status, error, message, headers);
2472
+ }
2473
+ if (status === 403) {
2474
+ return new PermissionDeniedError(status, error, message, headers);
2475
+ }
2476
+ if (status === 404) {
2477
+ return new NotFoundError(status, error, message, headers);
2478
+ }
2479
+ if (status === 409) {
2480
+ return new ConflictError(status, error, message, headers);
2481
+ }
2482
+ if (status === 422) {
2483
+ return new UnprocessableEntityError(status, error, message, headers);
2484
+ }
2485
+ if (status === 429) {
2486
+ return new RateLimitError(status, error, message, headers);
2487
+ }
2488
+ if (status >= 500) {
2489
+ return new InternalServerError(status, error, message, headers);
2490
+ }
2491
+ return new _ApiError(status, error, message, headers);
2492
+ }
2493
+ };
2494
+ __name(_ApiError, "ApiError");
2495
+ var ApiError = _ApiError;
2496
+ var _ApiConnectionError = class _ApiConnectionError extends ApiError {
2497
+ constructor({ message, cause }) {
2498
+ super(void 0, void 0, message || "Connection error.", void 0);
2499
+ __publicField(this, "status");
2500
+ if (cause)
2501
+ this.cause = cause;
2502
+ }
2503
+ };
2504
+ __name(_ApiConnectionError, "ApiConnectionError");
2505
+ var ApiConnectionError = _ApiConnectionError;
2506
+ var _BadRequestError = class _BadRequestError extends ApiError {
2507
+ constructor() {
2508
+ super(...arguments);
2509
+ __publicField(this, "status", 400);
2510
+ }
2511
+ };
2512
+ __name(_BadRequestError, "BadRequestError");
2513
+ var BadRequestError = _BadRequestError;
2514
+ var _AuthenticationError = class _AuthenticationError extends ApiError {
2515
+ constructor() {
2516
+ super(...arguments);
2517
+ __publicField(this, "status", 401);
2518
+ }
2519
+ };
2520
+ __name(_AuthenticationError, "AuthenticationError");
2521
+ var AuthenticationError = _AuthenticationError;
2522
+ var _PermissionDeniedError = class _PermissionDeniedError extends ApiError {
2523
+ constructor() {
2524
+ super(...arguments);
2525
+ __publicField(this, "status", 403);
2526
+ }
2527
+ };
2528
+ __name(_PermissionDeniedError, "PermissionDeniedError");
2529
+ var PermissionDeniedError = _PermissionDeniedError;
2530
+ var _NotFoundError = class _NotFoundError extends ApiError {
2531
+ constructor() {
2532
+ super(...arguments);
2533
+ __publicField(this, "status", 404);
2534
+ }
2535
+ };
2536
+ __name(_NotFoundError, "NotFoundError");
2537
+ var NotFoundError = _NotFoundError;
2538
+ var _ConflictError = class _ConflictError extends ApiError {
2539
+ constructor() {
2540
+ super(...arguments);
2541
+ __publicField(this, "status", 409);
2542
+ }
2543
+ };
2544
+ __name(_ConflictError, "ConflictError");
2545
+ var ConflictError = _ConflictError;
2546
+ var _UnprocessableEntityError = class _UnprocessableEntityError extends ApiError {
2547
+ constructor() {
2548
+ super(...arguments);
2549
+ __publicField(this, "status", 422);
2550
+ }
2551
+ };
2552
+ __name(_UnprocessableEntityError, "UnprocessableEntityError");
2553
+ var UnprocessableEntityError = _UnprocessableEntityError;
2554
+ var _RateLimitError = class _RateLimitError extends ApiError {
2555
+ constructor() {
2556
+ super(...arguments);
2557
+ __publicField(this, "status", 429);
2558
+ }
2559
+ get millisecondsUntilReset() {
2560
+ const resetAtUnixEpochMs = (this.headers ?? {})["x-ratelimit-reset"];
2561
+ if (typeof resetAtUnixEpochMs === "string") {
2562
+ const resetAtUnixEpoch = parseInt(resetAtUnixEpochMs, 10);
2563
+ if (isNaN(resetAtUnixEpoch)) {
2564
+ return;
2565
+ }
2566
+ return Math.max(resetAtUnixEpoch - Date.now() + Math.floor(Math.random() * 2e3), 0);
2567
+ }
2568
+ }
2569
+ };
2570
+ __name(_RateLimitError, "RateLimitError");
2571
+ var RateLimitError = _RateLimitError;
2572
+ var _InternalServerError = class _InternalServerError extends ApiError {
2573
+ };
2574
+ __name(_InternalServerError, "InternalServerError");
2575
+ var InternalServerError = _InternalServerError;
2576
+ function castToError(err) {
2577
+ if (err instanceof Error)
2578
+ return err;
2579
+ return new Error(err);
2580
+ }
2581
+ __name(castToError, "castToError");
2582
+
2583
+ // src/v3/utils/flattenAttributes.ts
2584
+ var NULL_SENTINEL = "$@null((";
2585
+ function flattenAttributes(obj, prefix) {
2586
+ const result = {};
2587
+ if (obj === void 0) {
2588
+ return result;
2589
+ }
2590
+ if (obj === null) {
2591
+ result[prefix || ""] = NULL_SENTINEL;
2592
+ return result;
2593
+ }
2594
+ if (typeof obj === "string") {
2595
+ result[prefix || ""] = obj;
2596
+ return result;
2597
+ }
2598
+ if (typeof obj === "number") {
2599
+ result[prefix || ""] = obj;
2600
+ return result;
2601
+ }
2602
+ if (typeof obj === "boolean") {
2603
+ result[prefix || ""] = obj;
2604
+ return result;
2605
+ }
2606
+ for (const [key, value] of Object.entries(obj)) {
2607
+ const newPrefix = `${prefix ? `${prefix}.` : ""}${Array.isArray(obj) ? `[${key}]` : key}`;
2608
+ if (Array.isArray(value)) {
2609
+ for (let i = 0; i < value.length; i++) {
2610
+ if (typeof value[i] === "object" && value[i] !== null) {
2611
+ Object.assign(result, flattenAttributes(value[i], `${newPrefix}.[${i}]`));
2612
+ } else {
2613
+ if (value[i] === null) {
2614
+ result[`${newPrefix}.[${i}]`] = NULL_SENTINEL;
2615
+ } else {
2616
+ result[`${newPrefix}.[${i}]`] = value[i];
2617
+ }
2618
+ }
2619
+ }
2620
+ } else if (isRecord(value)) {
2621
+ Object.assign(result, flattenAttributes(value, newPrefix));
2622
+ } else {
2623
+ if (typeof value === "number" || typeof value === "string" || typeof value === "boolean") {
2624
+ result[newPrefix] = value;
2625
+ } else if (value === null) {
2626
+ result[newPrefix] = NULL_SENTINEL;
2627
+ }
2628
+ }
2629
+ }
2630
+ return result;
2631
+ }
2632
+ __name(flattenAttributes, "flattenAttributes");
2633
+ function isRecord(value) {
2634
+ return value !== null && typeof value === "object" && !Array.isArray(value);
2635
+ }
2636
+ __name(isRecord, "isRecord");
2637
+ function unflattenAttributes(obj) {
2638
+ if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
2639
+ return obj;
2640
+ }
2641
+ if (typeof obj === "object" && obj !== null && Object.keys(obj).length === 1 && Object.keys(obj)[0] === "") {
2642
+ return rehydrateNull(obj[""]);
2643
+ }
2644
+ if (Object.keys(obj).length === 0) {
2645
+ return;
2646
+ }
2647
+ const result = {};
2648
+ for (const [key, value] of Object.entries(obj)) {
2649
+ const parts = key.split(".").reduce((acc, part) => {
2650
+ if (part.includes("[")) {
2651
+ const subparts = part.split(/\[|\]/).filter((p) => p !== "");
2652
+ acc.push(...subparts);
2653
+ } else {
2654
+ acc.push(part);
2655
+ }
2656
+ return acc;
2657
+ }, []);
2658
+ let current = result;
2659
+ for (let i = 0; i < parts.length - 1; i++) {
2660
+ const part = parts[i];
2661
+ const nextPart = parts[i + 1];
2662
+ const isArray = /^\d+$/.test(nextPart);
2663
+ if (isArray && !Array.isArray(current[part])) {
2664
+ current[part] = [];
2665
+ } else if (!isArray && current[part] === void 0) {
2666
+ current[part] = {};
2667
+ }
2668
+ current = current[part];
2669
+ }
2670
+ const lastPart = parts[parts.length - 1];
2671
+ current[lastPart] = rehydrateNull(value);
2672
+ }
2673
+ if (Object.keys(result).every((k) => /^\d+$/.test(k))) {
2674
+ const maxIndex = Math.max(...Object.keys(result).map((k) => parseInt(k)));
2675
+ const arrayResult = Array(maxIndex + 1);
2676
+ for (const key in result) {
2677
+ arrayResult[parseInt(key)] = result[key];
2678
+ }
2679
+ return arrayResult;
2680
+ }
2681
+ return result;
2682
+ }
2683
+ __name(unflattenAttributes, "unflattenAttributes");
2684
+ function primitiveValueOrflattenedAttributes(obj, prefix) {
2685
+ if (typeof obj === "string" || typeof obj === "number" || typeof obj === "boolean" || obj === null || obj === void 0) {
2686
+ return obj;
2687
+ }
2688
+ const attributes = flattenAttributes(obj, prefix);
2689
+ if (prefix !== void 0 && typeof attributes[prefix] !== "undefined" && attributes[prefix] !== null) {
2690
+ return attributes[prefix];
2691
+ }
2692
+ return attributes;
2693
+ }
2694
+ __name(primitiveValueOrflattenedAttributes, "primitiveValueOrflattenedAttributes");
2695
+ function rehydrateNull(value) {
2696
+ if (value === NULL_SENTINEL) {
2697
+ return null;
2698
+ }
2699
+ return value;
2700
+ }
2701
+ __name(rehydrateNull, "rehydrateNull");
2702
+
2703
+ // src/v3/utils/styleAttributes.ts
2704
+ function accessoryAttributes(accessory) {
2705
+ return flattenAttributes(accessory, SemanticInternalAttributes.STYLE_ACCESSORY);
2418
2706
  }
2419
- __name(calculateResetAt2, "calculateResetAt");
2707
+ __name(accessoryAttributes, "accessoryAttributes");
2420
2708
 
2421
2709
  // src/v3/apiClient/pagination.ts
2422
2710
  var _CursorPage = class _CursorPage {
@@ -2526,6 +2814,12 @@ var defaultRetryOptions2 = {
2526
2814
  maxTimeoutInMs: 6e4,
2527
2815
  randomize: false
2528
2816
  };
2817
+ var requestOptionsKeys = {
2818
+ retry: true
2819
+ };
2820
+ var isRequestOptions = /* @__PURE__ */ __name((obj) => {
2821
+ return typeof obj === "object" && obj !== null && !isEmptyObj(obj) && Object.keys(obj).every((k) => hasOwn(requestOptionsKeys, k));
2822
+ }, "isRequestOptions");
2529
2823
  function zodfetch(schema, url, requestInit, options) {
2530
2824
  return new ApiPromise(_doZodFetch(schema, url, requestInit, options));
2531
2825
  }
@@ -2576,47 +2870,47 @@ function zodfetchOffsetLimitPage(schema, url, params, requestInit, options) {
2576
2870
  return new OffsetLimitPagePromise(fetchResult, schema, url, params, requestInit, options);
2577
2871
  }
2578
2872
  __name(zodfetchOffsetLimitPage, "zodfetchOffsetLimitPage");
2579
- function zodupload(schema, url, body, requestInit, options) {
2580
- const finalRequestInit = createMultipartFormRequestInit(body, requestInit);
2581
- return new ApiPromise(_doZodFetch(schema, url, finalRequestInit, options));
2873
+ async function traceZodFetch(params, callback) {
2874
+ if (!params.options?.tracer) {
2875
+ return callback();
2876
+ }
2877
+ const url = new URL(params.url);
2878
+ const method = params.requestInit?.method ?? "GET";
2879
+ const name = params.options.name ?? `${method} ${url.pathname}`;
2880
+ return await params.options.tracer.startActiveSpan(name, async (span) => {
2881
+ return await callback(span);
2882
+ }, {
2883
+ attributes: {
2884
+ [SemanticInternalAttributes.STYLE_ICON]: params.options?.icon ?? "api",
2885
+ ...params.options.attributes
2886
+ }
2887
+ });
2582
2888
  }
2583
- __name(zodupload, "zodupload");
2584
- async function createMultipartFormRequestInit(body, requestInit) {
2585
- const form = await createForm(body);
2586
- const encoder = new formDataEncoder.FormDataEncoder(form);
2587
- const finalHeaders = {};
2588
- for (const [key, value] of Object.entries(requestInit?.headers || {})) {
2589
- finalHeaders[key] = value;
2590
- }
2591
- for (const [key, value] of Object.entries(encoder.headers)) {
2592
- finalHeaders[key] = value;
2593
- }
2594
- finalHeaders["Content-Length"] = String(encoder.contentLength);
2595
- const finalRequestInit = {
2596
- ...requestInit,
2597
- headers: finalHeaders,
2598
- body: stream.Readable.from(encoder),
2599
- // @ts-expect-error
2600
- duplex: "half"
2601
- };
2602
- return finalRequestInit;
2889
+ __name(traceZodFetch, "traceZodFetch");
2890
+ async function _doZodFetch(schema, url, requestInit, options) {
2891
+ const $requestInit = await requestInit;
2892
+ return traceZodFetch({
2893
+ url,
2894
+ requestInit: $requestInit,
2895
+ options
2896
+ }, async (span) => {
2897
+ const result = await _doZodFetchWithRetries(schema, url, $requestInit, options);
2898
+ if (options?.onResponseBody && span) {
2899
+ options.onResponseBody(result.data, span);
2900
+ }
2901
+ return result;
2902
+ });
2603
2903
  }
2604
- __name(createMultipartFormRequestInit, "createMultipartFormRequestInit");
2605
- var createForm = /* @__PURE__ */ __name(async (body) => {
2606
- const form = new FormData();
2607
- await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
2608
- return form;
2609
- }, "createForm");
2610
- async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
2904
+ __name(_doZodFetch, "_doZodFetch");
2905
+ async function _doZodFetchWithRetries(schema, url, requestInit, options, attempt = 1) {
2611
2906
  try {
2612
- const $requestInit = await requestInit;
2613
- const response = await fetch(url, requestInitWithCache($requestInit));
2907
+ const response = await fetch(url, requestInitWithCache(requestInit));
2614
2908
  const responseHeaders = createResponseHeaders(response.headers);
2615
2909
  if (!response.ok) {
2616
2910
  const retryResult = shouldRetry(response, attempt, options?.retry);
2617
2911
  if (retryResult.retry) {
2618
- await new Promise((resolve) => setTimeout(resolve, retryResult.delay));
2619
- return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
2912
+ await waitForRetry(url, attempt + 1, retryResult.delay, options, requestInit, response);
2913
+ return await _doZodFetchWithRetries(schema, url, requestInit, options, attempt + 1);
2620
2914
  } else {
2621
2915
  const errText = await response.text().catch((e) => castToError2(e).message);
2622
2916
  const errJSON = safeJsonParse(errText);
@@ -2644,8 +2938,8 @@ async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
2644
2938
  };
2645
2939
  const delay = calculateNextRetryDelay(retry, attempt);
2646
2940
  if (delay) {
2647
- await new Promise((resolve) => setTimeout(resolve, delay));
2648
- return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
2941
+ await waitForRetry(url, attempt + 1, delay, options, requestInit);
2942
+ return await _doZodFetchWithRetries(schema, url, requestInit, options, attempt + 1);
2649
2943
  }
2650
2944
  }
2651
2945
  throw new ApiConnectionError({
@@ -2653,7 +2947,7 @@ async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
2653
2947
  });
2654
2948
  }
2655
2949
  }
2656
- __name(_doZodFetch, "_doZodFetch");
2950
+ __name(_doZodFetchWithRetries, "_doZodFetchWithRetries");
2657
2951
  function castToError2(err) {
2658
2952
  if (err instanceof Error)
2659
2953
  return err;
@@ -2690,8 +2984,25 @@ function shouldRetry(response, attempt, retryOptions) {
2690
2984
  return shouldRetryForOptions();
2691
2985
  if (response.status === 409)
2692
2986
  return shouldRetryForOptions();
2693
- if (response.status === 429)
2987
+ if (response.status === 429) {
2988
+ if (attempt >= (typeof retryOptions?.maxAttempts === "number" ? retryOptions?.maxAttempts : 3)) {
2989
+ return {
2990
+ retry: false
2991
+ };
2992
+ }
2993
+ const resetAtUnixEpochMs = response.headers.get("x-ratelimit-reset");
2994
+ if (resetAtUnixEpochMs) {
2995
+ const resetAtUnixEpoch = parseInt(resetAtUnixEpochMs, 10);
2996
+ const delay = resetAtUnixEpoch - Date.now() + Math.floor(Math.random() * 1e3);
2997
+ if (delay > 0) {
2998
+ return {
2999
+ retry: true,
3000
+ delay
3001
+ };
3002
+ }
3003
+ }
2694
3004
  return shouldRetryForOptions();
3005
+ }
2695
3006
  if (response.status >= 500)
2696
3007
  return shouldRetryForOptions();
2697
3008
  return {
@@ -2732,95 +3043,6 @@ function requestInitWithCache(requestInit) {
2732
3043
  }
2733
3044
  }
2734
3045
  __name(requestInitWithCache, "requestInitWithCache");
2735
- var addFormValue = /* @__PURE__ */ __name(async (form, key, value) => {
2736
- if (value === void 0)
2737
- return;
2738
- if (value == null) {
2739
- throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
2740
- }
2741
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
2742
- form.append(key, String(value));
2743
- } else if (isUploadable(value) || isBlobLike(value) || value instanceof Buffer || value instanceof ArrayBuffer) {
2744
- const file = await toFile(value);
2745
- form.append(key, file);
2746
- } else if (Array.isArray(value)) {
2747
- await Promise.all(value.map((entry) => addFormValue(form, key + "[]", entry)));
2748
- } else if (typeof value === "object") {
2749
- await Promise.all(Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)));
2750
- } else {
2751
- throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
2752
- }
2753
- }, "addFormValue");
2754
- async function toFile(value, name, options) {
2755
- value = await value;
2756
- options ??= isFileLike(value) ? {
2757
- lastModified: value.lastModified,
2758
- type: value.type
2759
- } : {};
2760
- if (isResponseLike(value)) {
2761
- const blob = await value.blob();
2762
- name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file";
2763
- return new File([
2764
- blob
2765
- ], name, options);
2766
- }
2767
- const bits = await getBytes(value);
2768
- name ||= getName(value) ?? "unknown_file";
2769
- if (!options.type) {
2770
- const type = bits[0]?.type;
2771
- if (typeof type === "string") {
2772
- options = {
2773
- ...options,
2774
- type
2775
- };
2776
- }
2777
- }
2778
- return new File(bits, name, options);
2779
- }
2780
- __name(toFile, "toFile");
2781
- function getName(value) {
2782
- return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || // For fs.ReadStream
2783
- getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop();
2784
- }
2785
- __name(getName, "getName");
2786
- var getStringFromMaybeBuffer = /* @__PURE__ */ __name((x) => {
2787
- if (typeof x === "string")
2788
- return x;
2789
- if (typeof Buffer !== "undefined" && x instanceof Buffer)
2790
- return String(x);
2791
- return void 0;
2792
- }, "getStringFromMaybeBuffer");
2793
- async function getBytes(value) {
2794
- let parts = [];
2795
- if (typeof value === "string" || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
2796
- value instanceof ArrayBuffer) {
2797
- parts.push(value);
2798
- } else if (isBlobLike(value)) {
2799
- parts.push(await value.arrayBuffer());
2800
- } else if (isAsyncIterableIterator(value)) {
2801
- for await (const chunk of value) {
2802
- parts.push(chunk);
2803
- }
2804
- } else {
2805
- throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
2806
- }
2807
- return parts;
2808
- }
2809
- __name(getBytes, "getBytes");
2810
- function propsForError(value) {
2811
- const props = Object.getOwnPropertyNames(value);
2812
- return `[${props.map((p) => `"${p}"`).join(", ")}]`;
2813
- }
2814
- __name(propsForError, "propsForError");
2815
- var isAsyncIterableIterator = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function", "isAsyncIterableIterator");
2816
- var isResponseLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function", "isResponseLike");
2817
- var isFileLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value), "isFileLike");
2818
- var isBlobLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.size === "number" && typeof value.type === "string" && typeof value.text === "function" && typeof value.slice === "function" && typeof value.arrayBuffer === "function", "isBlobLike");
2819
- var isFsReadStream = /* @__PURE__ */ __name((value) => value instanceof stream.Readable, "isFsReadStream");
2820
- var isUploadable = /* @__PURE__ */ __name((value) => {
2821
- return isFileLike(value) || isResponseLike(value) || isFsReadStream(value);
2822
- }, "isUploadable");
2823
- var isRecordLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0 && Object.keys(value).every((key) => typeof key === "string" && typeof value[key] === "string"), "isRecordLike");
2824
3046
  var _ApiPromise = class _ApiPromise extends Promise {
2825
3047
  constructor(responsePromise) {
2826
3048
  super((resolve) => {
@@ -2943,9 +3165,44 @@ fetchPage_fn2 = /* @__PURE__ */ __name(function(params1) {
2943
3165
  }, "#fetchPage");
2944
3166
  __name(_OffsetLimitPagePromise, "OffsetLimitPagePromise");
2945
3167
  var OffsetLimitPagePromise = _OffsetLimitPagePromise;
3168
+ async function waitForRetry(url, attempt, delay, options, requestInit, response) {
3169
+ if (options?.tracer) {
3170
+ const method = requestInit?.method ?? "GET";
3171
+ return options.tracer.startActiveSpan(response ? `wait after ${response.status}` : `wait after error`, async (span) => {
3172
+ await new Promise((resolve) => setTimeout(resolve, delay));
3173
+ }, {
3174
+ attributes: {
3175
+ [SemanticInternalAttributes.STYLE_ICON]: "wait",
3176
+ ...accessoryAttributes({
3177
+ items: [
3178
+ {
3179
+ text: `retrying ${options?.name ?? method.toUpperCase()} in ${delay}ms`,
3180
+ variant: "normal"
3181
+ }
3182
+ ],
3183
+ style: "codepath"
3184
+ })
3185
+ }
3186
+ });
3187
+ }
3188
+ await new Promise((resolve) => setTimeout(resolve, delay));
3189
+ }
3190
+ __name(waitForRetry, "waitForRetry");
3191
+ function isEmptyObj(obj) {
3192
+ if (!obj)
3193
+ return true;
3194
+ for (const _k in obj)
3195
+ return false;
3196
+ return true;
3197
+ }
3198
+ __name(isEmptyObj, "isEmptyObj");
3199
+ function hasOwn(obj, key) {
3200
+ return Object.prototype.hasOwnProperty.call(obj, key);
3201
+ }
3202
+ __name(hasOwn, "hasOwn");
2946
3203
 
2947
3204
  // src/v3/apiClient/index.ts
2948
- var zodFetchOptions = {
3205
+ var DEFAULT_ZOD_FETCH_OPTIONS = {
2949
3206
  retry: {
2950
3207
  maxAttempts: 3,
2951
3208
  minTimeoutInMs: 1e3,
@@ -2956,17 +3213,18 @@ var zodFetchOptions = {
2956
3213
  };
2957
3214
  var _getHeaders, getHeaders_fn;
2958
3215
  var _ApiClient = class _ApiClient {
2959
- constructor(baseUrl, accessToken) {
3216
+ constructor(baseUrl, accessToken, requestOptions = {}) {
2960
3217
  __privateAdd(this, _getHeaders);
2961
3218
  this.accessToken = accessToken;
2962
3219
  this.baseUrl = baseUrl.replace(/\/$/, "");
3220
+ this.defaultRequestOptions = mergeRequestOptions(DEFAULT_ZOD_FETCH_OPTIONS, requestOptions);
2963
3221
  }
2964
- async getRunResult(runId) {
3222
+ async getRunResult(runId, requestOptions) {
2965
3223
  try {
2966
3224
  return await zodfetch(TaskRunExecutionResult, `${this.baseUrl}/api/v1/runs/${runId}/result`, {
2967
3225
  method: "GET",
2968
3226
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2969
- }, zodFetchOptions);
3227
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2970
3228
  } catch (error) {
2971
3229
  if (error instanceof ApiError) {
2972
3230
  if (error.status === 404) {
@@ -2976,47 +3234,47 @@ var _ApiClient = class _ApiClient {
2976
3234
  throw error;
2977
3235
  }
2978
3236
  }
2979
- async getBatchResults(batchId) {
3237
+ async getBatchResults(batchId, requestOptions) {
2980
3238
  return await zodfetch(BatchTaskRunExecutionResult, `${this.baseUrl}/api/v1/batches/${batchId}/results`, {
2981
3239
  method: "GET",
2982
3240
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2983
- }, zodFetchOptions);
3241
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2984
3242
  }
2985
- triggerTask(taskId, body, options) {
3243
+ triggerTask(taskId, body, options, requestOptions) {
2986
3244
  const encodedTaskId = encodeURIComponent(taskId);
2987
3245
  return zodfetch(TriggerTaskResponse, `${this.baseUrl}/api/v1/tasks/${encodedTaskId}/trigger`, {
2988
3246
  method: "POST",
2989
3247
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, options?.spanParentAsLink ?? false),
2990
3248
  body: JSON.stringify(body)
2991
- }, zodFetchOptions);
3249
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
2992
3250
  }
2993
- batchTriggerTask(taskId, body, options) {
3251
+ batchTriggerTask(taskId, body, options, requestOptions) {
2994
3252
  const encodedTaskId = encodeURIComponent(taskId);
2995
3253
  return zodfetch(BatchTriggerTaskResponse, `${this.baseUrl}/api/v1/tasks/${encodedTaskId}/batch`, {
2996
3254
  method: "POST",
2997
3255
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, options?.spanParentAsLink ?? false),
2998
3256
  body: JSON.stringify(body)
2999
- }, zodFetchOptions);
3257
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3000
3258
  }
3001
- createUploadPayloadUrl(filename) {
3259
+ createUploadPayloadUrl(filename, requestOptions) {
3002
3260
  return zodfetch(CreateUploadPayloadUrlResponseBody, `${this.baseUrl}/api/v1/packets/${filename}`, {
3003
3261
  method: "PUT",
3004
3262
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3005
- }, zodFetchOptions);
3263
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3006
3264
  }
3007
- getPayloadUrl(filename) {
3265
+ getPayloadUrl(filename, requestOptions) {
3008
3266
  return zodfetch(CreateUploadPayloadUrlResponseBody, `${this.baseUrl}/api/v1/packets/${filename}`, {
3009
3267
  method: "GET",
3010
3268
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3011
- }, zodFetchOptions);
3269
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3012
3270
  }
3013
- retrieveRun(runId) {
3271
+ retrieveRun(runId, requestOptions) {
3014
3272
  return zodfetch(RetrieveRunResponse, `${this.baseUrl}/api/v3/runs/${runId}`, {
3015
3273
  method: "GET",
3016
3274
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3017
- }, zodFetchOptions);
3275
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3018
3276
  }
3019
- listRuns(query) {
3277
+ listRuns(query, requestOptions) {
3020
3278
  const searchParams = createSearchQueryForListRuns(query);
3021
3279
  return zodfetchCursorPage(ListRunResponseItem, `${this.baseUrl}/api/v1/runs`, {
3022
3280
  query: searchParams,
@@ -3026,9 +3284,9 @@ var _ApiClient = class _ApiClient {
3026
3284
  }, {
3027
3285
  method: "GET",
3028
3286
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3029
- }, zodFetchOptions);
3287
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3030
3288
  }
3031
- listProjectRuns(projectRef, query) {
3289
+ listProjectRuns(projectRef, query, requestOptions) {
3032
3290
  const searchParams = createSearchQueryForListRuns(query);
3033
3291
  if (query?.env) {
3034
3292
  searchParams.append("filter[env]", Array.isArray(query.env) ? query.env.join(",") : query.env);
@@ -3041,28 +3299,44 @@ var _ApiClient = class _ApiClient {
3041
3299
  }, {
3042
3300
  method: "GET",
3043
3301
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3044
- }, zodFetchOptions);
3302
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3045
3303
  }
3046
- replayRun(runId) {
3304
+ replayRun(runId, requestOptions) {
3047
3305
  return zodfetch(ReplayRunResponse, `${this.baseUrl}/api/v1/runs/${runId}/replay`, {
3048
3306
  method: "POST",
3049
3307
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3050
- }, zodFetchOptions);
3308
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3051
3309
  }
3052
- cancelRun(runId) {
3310
+ cancelRun(runId, requestOptions) {
3053
3311
  return zodfetch(CanceledRunResponse, `${this.baseUrl}/api/v2/runs/${runId}/cancel`, {
3054
3312
  method: "POST",
3055
3313
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3056
- }, zodFetchOptions);
3314
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3315
+ }
3316
+ rescheduleRun(runId, body, requestOptions) {
3317
+ return zodfetch(RetrieveRunResponse, `${this.baseUrl}/api/v1/runs/${runId}/reschedule`, {
3318
+ method: "POST",
3319
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
3320
+ body: JSON.stringify(body)
3321
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3322
+ }
3323
+ addTags(runId, body, requestOptions) {
3324
+ return zodfetch(zod.z.object({
3325
+ message: zod.z.string()
3326
+ }), `${this.baseUrl}/api/v1/runs/${runId}/tags`, {
3327
+ method: "POST",
3328
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
3329
+ body: JSON.stringify(body)
3330
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3057
3331
  }
3058
- createSchedule(options) {
3332
+ createSchedule(options, requestOptions) {
3059
3333
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules`, {
3060
3334
  method: "POST",
3061
3335
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
3062
3336
  body: JSON.stringify(options)
3063
- });
3337
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3064
3338
  }
3065
- listSchedules(options) {
3339
+ listSchedules(options, requestOptions) {
3066
3340
  const searchParams = new URLSearchParams();
3067
3341
  if (options?.page) {
3068
3342
  searchParams.append("page", options.page.toString());
@@ -3076,84 +3350,77 @@ var _ApiClient = class _ApiClient {
3076
3350
  }, {
3077
3351
  method: "GET",
3078
3352
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3079
- });
3353
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3080
3354
  }
3081
- retrieveSchedule(scheduleId) {
3355
+ retrieveSchedule(scheduleId, requestOptions) {
3082
3356
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules/${scheduleId}`, {
3083
3357
  method: "GET",
3084
3358
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3085
- });
3359
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3086
3360
  }
3087
- updateSchedule(scheduleId, options) {
3361
+ updateSchedule(scheduleId, options, requestOptions) {
3088
3362
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules/${scheduleId}`, {
3089
3363
  method: "PUT",
3090
3364
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
3091
3365
  body: JSON.stringify(options)
3092
- });
3366
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3093
3367
  }
3094
- deactivateSchedule(scheduleId) {
3368
+ deactivateSchedule(scheduleId, requestOptions) {
3095
3369
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules/${scheduleId}/deactivate`, {
3096
3370
  method: "POST",
3097
3371
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3098
- });
3372
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3099
3373
  }
3100
- activateSchedule(scheduleId) {
3374
+ activateSchedule(scheduleId, requestOptions) {
3101
3375
  return zodfetch(ScheduleObject, `${this.baseUrl}/api/v1/schedules/${scheduleId}/activate`, {
3102
3376
  method: "POST",
3103
3377
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3104
- });
3378
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3105
3379
  }
3106
- deleteSchedule(scheduleId) {
3380
+ deleteSchedule(scheduleId, requestOptions) {
3107
3381
  return zodfetch(DeletedScheduleObject, `${this.baseUrl}/api/v1/schedules/${scheduleId}`, {
3108
3382
  method: "DELETE",
3109
3383
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3110
- });
3384
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3111
3385
  }
3112
- listEnvVars(projectRef, slug) {
3386
+ listEnvVars(projectRef, slug, requestOptions) {
3113
3387
  return zodfetch(EnvironmentVariables, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}`, {
3114
3388
  method: "GET",
3115
3389
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3116
- });
3390
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3117
3391
  }
3118
- importEnvVars(projectRef, slug, body) {
3119
- if (isRecordLike(body.variables)) {
3120
- return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, {
3121
- method: "POST",
3122
- headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
3123
- body: JSON.stringify(body)
3124
- });
3125
- } else {
3126
- return zodupload(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, body, {
3127
- method: "POST",
3128
- headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3129
- });
3130
- }
3392
+ importEnvVars(projectRef, slug, body, requestOptions) {
3393
+ return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, {
3394
+ method: "POST",
3395
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
3396
+ body: JSON.stringify(body)
3397
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3131
3398
  }
3132
- retrieveEnvVar(projectRef, slug, key) {
3399
+ retrieveEnvVar(projectRef, slug, key, requestOptions) {
3133
3400
  return zodfetch(EnvironmentVariableValue, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
3134
3401
  method: "GET",
3135
3402
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3136
- });
3403
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3137
3404
  }
3138
- createEnvVar(projectRef, slug, body) {
3405
+ createEnvVar(projectRef, slug, body, requestOptions) {
3139
3406
  return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}`, {
3140
3407
  method: "POST",
3141
3408
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
3142
3409
  body: JSON.stringify(body)
3143
- });
3410
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3144
3411
  }
3145
- updateEnvVar(projectRef, slug, key, body) {
3412
+ updateEnvVar(projectRef, slug, key, body, requestOptions) {
3146
3413
  return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
3147
3414
  method: "PUT",
3148
3415
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
3149
3416
  body: JSON.stringify(body)
3150
- });
3417
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3151
3418
  }
3152
- deleteEnvVar(projectRef, slug, key) {
3419
+ deleteEnvVar(projectRef, slug, key, requestOptions) {
3153
3420
  return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
3154
3421
  method: "DELETE",
3155
3422
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
3156
- });
3423
+ }, mergeRequestOptions(this.defaultRequestOptions, requestOptions));
3157
3424
  }
3158
3425
  };
3159
3426
  _getHeaders = new WeakSet();
@@ -3189,6 +3456,9 @@ function createSearchQueryForListRuns(query) {
3189
3456
  if (query.bulkAction) {
3190
3457
  searchParams.append("filter[bulkAction]", query.bulkAction);
3191
3458
  }
3459
+ if (query.tag) {
3460
+ searchParams.append("filter[tag]", Array.isArray(query.tag) ? query.tag.join(",") : query.tag);
3461
+ }
3192
3462
  if (query.schedule) {
3193
3463
  searchParams.append("filter[schedule]", query.schedule);
3194
3464
  }
@@ -3208,6 +3478,20 @@ function createSearchQueryForListRuns(query) {
3208
3478
  return searchParams;
3209
3479
  }
3210
3480
  __name(createSearchQueryForListRuns, "createSearchQueryForListRuns");
3481
+ function mergeRequestOptions(defaultOptions, options) {
3482
+ if (!options) {
3483
+ return defaultOptions;
3484
+ }
3485
+ return {
3486
+ ...defaultOptions,
3487
+ ...options,
3488
+ retry: {
3489
+ ...defaultOptions.retry,
3490
+ ...options.retry
3491
+ }
3492
+ };
3493
+ }
3494
+ __name(mergeRequestOptions, "mergeRequestOptions");
3211
3495
  var _SimpleClock = class _SimpleClock {
3212
3496
  preciseNow() {
3213
3497
  const now = new preciseDate.PreciseDate();
@@ -3300,128 +3584,6 @@ function calculateAttributeValueLength(value) {
3300
3584
  return 0;
3301
3585
  }
3302
3586
  __name(calculateAttributeValueLength, "calculateAttributeValueLength");
3303
-
3304
- // src/v3/utils/flattenAttributes.ts
3305
- var NULL_SENTINEL = "$@null((";
3306
- function flattenAttributes(obj, prefix) {
3307
- const result = {};
3308
- if (obj === void 0) {
3309
- return result;
3310
- }
3311
- if (obj === null) {
3312
- result[prefix || ""] = NULL_SENTINEL;
3313
- return result;
3314
- }
3315
- if (typeof obj === "string") {
3316
- result[prefix || ""] = obj;
3317
- return result;
3318
- }
3319
- if (typeof obj === "number") {
3320
- result[prefix || ""] = obj;
3321
- return result;
3322
- }
3323
- if (typeof obj === "boolean") {
3324
- result[prefix || ""] = obj;
3325
- return result;
3326
- }
3327
- for (const [key, value] of Object.entries(obj)) {
3328
- const newPrefix = `${prefix ? `${prefix}.` : ""}${Array.isArray(obj) ? `[${key}]` : key}`;
3329
- if (Array.isArray(value)) {
3330
- for (let i = 0; i < value.length; i++) {
3331
- if (typeof value[i] === "object" && value[i] !== null) {
3332
- Object.assign(result, flattenAttributes(value[i], `${newPrefix}.[${i}]`));
3333
- } else {
3334
- if (value[i] === null) {
3335
- result[`${newPrefix}.[${i}]`] = NULL_SENTINEL;
3336
- } else {
3337
- result[`${newPrefix}.[${i}]`] = value[i];
3338
- }
3339
- }
3340
- }
3341
- } else if (isRecord(value)) {
3342
- Object.assign(result, flattenAttributes(value, newPrefix));
3343
- } else {
3344
- if (typeof value === "number" || typeof value === "string" || typeof value === "boolean") {
3345
- result[newPrefix] = value;
3346
- } else if (value === null) {
3347
- result[newPrefix] = NULL_SENTINEL;
3348
- }
3349
- }
3350
- }
3351
- return result;
3352
- }
3353
- __name(flattenAttributes, "flattenAttributes");
3354
- function isRecord(value) {
3355
- return value !== null && typeof value === "object" && !Array.isArray(value);
3356
- }
3357
- __name(isRecord, "isRecord");
3358
- function unflattenAttributes(obj) {
3359
- if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
3360
- return obj;
3361
- }
3362
- if (typeof obj === "object" && obj !== null && Object.keys(obj).length === 1 && Object.keys(obj)[0] === "") {
3363
- return rehydrateNull(obj[""]);
3364
- }
3365
- if (Object.keys(obj).length === 0) {
3366
- return;
3367
- }
3368
- const result = {};
3369
- for (const [key, value] of Object.entries(obj)) {
3370
- const parts = key.split(".").reduce((acc, part) => {
3371
- if (part.includes("[")) {
3372
- const subparts = part.split(/\[|\]/).filter((p) => p !== "");
3373
- acc.push(...subparts);
3374
- } else {
3375
- acc.push(part);
3376
- }
3377
- return acc;
3378
- }, []);
3379
- let current = result;
3380
- for (let i = 0; i < parts.length - 1; i++) {
3381
- const part = parts[i];
3382
- const nextPart = parts[i + 1];
3383
- const isArray = /^\d+$/.test(nextPart);
3384
- if (isArray && !Array.isArray(current[part])) {
3385
- current[part] = [];
3386
- } else if (!isArray && current[part] === void 0) {
3387
- current[part] = {};
3388
- }
3389
- current = current[part];
3390
- }
3391
- const lastPart = parts[parts.length - 1];
3392
- current[lastPart] = rehydrateNull(value);
3393
- }
3394
- if (Object.keys(result).every((k) => /^\d+$/.test(k))) {
3395
- const maxIndex = Math.max(...Object.keys(result).map((k) => parseInt(k)));
3396
- const arrayResult = Array(maxIndex + 1);
3397
- for (const key in result) {
3398
- arrayResult[parseInt(key)] = result[key];
3399
- }
3400
- return arrayResult;
3401
- }
3402
- return result;
3403
- }
3404
- __name(unflattenAttributes, "unflattenAttributes");
3405
- function primitiveValueOrflattenedAttributes(obj, prefix) {
3406
- if (typeof obj === "string" || typeof obj === "number" || typeof obj === "boolean" || obj === null || obj === void 0) {
3407
- return obj;
3408
- }
3409
- const attributes = flattenAttributes(obj, prefix);
3410
- if (prefix !== void 0 && typeof attributes[prefix] !== "undefined" && attributes[prefix] !== null) {
3411
- return attributes[prefix];
3412
- }
3413
- return attributes;
3414
- }
3415
- __name(primitiveValueOrflattenedAttributes, "primitiveValueOrflattenedAttributes");
3416
- function rehydrateNull(value) {
3417
- if (value === NULL_SENTINEL) {
3418
- return null;
3419
- }
3420
- return value;
3421
- }
3422
- __name(rehydrateNull, "rehydrateNull");
3423
-
3424
- // src/v3/logger/taskLogger.ts
3425
3587
  var _NoopTaskLogger = class _NoopTaskLogger {
3426
3588
  debug() {
3427
3589
  }
@@ -3519,8 +3681,77 @@ var _NoopRuntimeManager = class _NoopRuntimeManager {
3519
3681
  __name(_NoopRuntimeManager, "NoopRuntimeManager");
3520
3682
  var NoopRuntimeManager = _NoopRuntimeManager;
3521
3683
 
3684
+ // src/v3/usage/noopUsageManager.ts
3685
+ var _NoopUsageManager = class _NoopUsageManager {
3686
+ disable() {
3687
+ }
3688
+ start() {
3689
+ return {
3690
+ sample: () => ({
3691
+ cpuTime: 0,
3692
+ wallTime: 0
3693
+ })
3694
+ };
3695
+ }
3696
+ stop(measurement) {
3697
+ return measurement.sample();
3698
+ }
3699
+ pauseAsync(cb) {
3700
+ return cb();
3701
+ }
3702
+ sample() {
3703
+ return void 0;
3704
+ }
3705
+ };
3706
+ __name(_NoopUsageManager, "NoopUsageManager");
3707
+ var NoopUsageManager = _NoopUsageManager;
3708
+
3709
+ // src/v3/usage/api.ts
3710
+ var API_NAME4 = "usage";
3711
+ var NOOP_USAGE_MANAGER = new NoopUsageManager();
3712
+ var _getUsageManager, getUsageManager_fn;
3713
+ var _UsageAPI = class _UsageAPI {
3714
+ constructor() {
3715
+ __privateAdd(this, _getUsageManager);
3716
+ }
3717
+ static getInstance() {
3718
+ if (!this._instance) {
3719
+ this._instance = new _UsageAPI();
3720
+ }
3721
+ return this._instance;
3722
+ }
3723
+ setGlobalUsageManager(manager) {
3724
+ return registerGlobal(API_NAME4, manager);
3725
+ }
3726
+ disable() {
3727
+ __privateMethod(this, _getUsageManager, getUsageManager_fn).call(this).disable();
3728
+ unregisterGlobal(API_NAME4);
3729
+ }
3730
+ start() {
3731
+ return __privateMethod(this, _getUsageManager, getUsageManager_fn).call(this).start();
3732
+ }
3733
+ stop(measurement) {
3734
+ return __privateMethod(this, _getUsageManager, getUsageManager_fn).call(this).stop(measurement);
3735
+ }
3736
+ pauseAsync(cb) {
3737
+ return __privateMethod(this, _getUsageManager, getUsageManager_fn).call(this).pauseAsync(cb);
3738
+ }
3739
+ sample() {
3740
+ return __privateMethod(this, _getUsageManager, getUsageManager_fn).call(this).sample();
3741
+ }
3742
+ };
3743
+ _getUsageManager = new WeakSet();
3744
+ getUsageManager_fn = /* @__PURE__ */ __name(function() {
3745
+ return getGlobal(API_NAME4) ?? NOOP_USAGE_MANAGER;
3746
+ }, "#getUsageManager");
3747
+ __name(_UsageAPI, "UsageAPI");
3748
+ var UsageAPI = _UsageAPI;
3749
+
3750
+ // src/v3/usage-api.ts
3751
+ var usage = UsageAPI.getInstance();
3752
+
3522
3753
  // src/v3/runtime/index.ts
3523
- var API_NAME4 = "runtime";
3754
+ var API_NAME5 = "runtime";
3524
3755
  var NOOP_RUNTIME_MANAGER = new NoopRuntimeManager();
3525
3756
  var _getRuntimeManager, getRuntimeManager_fn;
3526
3757
  var _RuntimeAPI = class _RuntimeAPI {
@@ -3534,28 +3765,28 @@ var _RuntimeAPI = class _RuntimeAPI {
3534
3765
  return this._instance;
3535
3766
  }
3536
3767
  waitForDuration(ms) {
3537
- return __privateMethod(this, _getRuntimeManager, getRuntimeManager_fn).call(this).waitForDuration(ms);
3768
+ return usage.pauseAsync(() => __privateMethod(this, _getRuntimeManager, getRuntimeManager_fn).call(this).waitForDuration(ms));
3538
3769
  }
3539
3770
  waitUntil(date) {
3540
- return __privateMethod(this, _getRuntimeManager, getRuntimeManager_fn).call(this).waitUntil(date);
3771
+ return usage.pauseAsync(() => __privateMethod(this, _getRuntimeManager, getRuntimeManager_fn).call(this).waitUntil(date));
3541
3772
  }
3542
3773
  waitForTask(params) {
3543
- return __privateMethod(this, _getRuntimeManager, getRuntimeManager_fn).call(this).waitForTask(params);
3774
+ return usage.pauseAsync(() => __privateMethod(this, _getRuntimeManager, getRuntimeManager_fn).call(this).waitForTask(params));
3544
3775
  }
3545
3776
  waitForBatch(params) {
3546
- return __privateMethod(this, _getRuntimeManager, getRuntimeManager_fn).call(this).waitForBatch(params);
3777
+ return usage.pauseAsync(() => __privateMethod(this, _getRuntimeManager, getRuntimeManager_fn).call(this).waitForBatch(params));
3547
3778
  }
3548
3779
  setGlobalRuntimeManager(runtimeManager) {
3549
- return registerGlobal(API_NAME4, runtimeManager);
3780
+ return registerGlobal(API_NAME5, runtimeManager);
3550
3781
  }
3551
3782
  disable() {
3552
3783
  __privateMethod(this, _getRuntimeManager, getRuntimeManager_fn).call(this).disable();
3553
- unregisterGlobal(API_NAME4);
3784
+ unregisterGlobal(API_NAME5);
3554
3785
  }
3555
3786
  };
3556
3787
  _getRuntimeManager = new WeakSet();
3557
3788
  getRuntimeManager_fn = /* @__PURE__ */ __name(function() {
3558
- return getGlobal(API_NAME4) ?? NOOP_RUNTIME_MANAGER;
3789
+ return getGlobal(API_NAME5) ?? NOOP_RUNTIME_MANAGER;
3559
3790
  }, "#getRuntimeManager");
3560
3791
  __name(_RuntimeAPI, "RuntimeAPI");
3561
3792
  var RuntimeAPI = _RuntimeAPI;
@@ -3572,7 +3803,7 @@ function getEnvVar(name) {
3572
3803
  __name(getEnvVar, "getEnvVar");
3573
3804
 
3574
3805
  // src/v3/apiClientManager/index.ts
3575
- var API_NAME5 = "api-client";
3806
+ var API_NAME6 = "api-client";
3576
3807
  var _getConfig, getConfig_fn;
3577
3808
  var _APIClientManagerAPI = class _APIClientManagerAPI {
3578
3809
  constructor() {
@@ -3585,10 +3816,10 @@ var _APIClientManagerAPI = class _APIClientManagerAPI {
3585
3816
  return this._instance;
3586
3817
  }
3587
3818
  disable() {
3588
- unregisterGlobal(API_NAME5);
3819
+ unregisterGlobal(API_NAME6);
3589
3820
  }
3590
3821
  setGlobalAPIClientConfiguration(config) {
3591
- return registerGlobal(API_NAME5, config);
3822
+ return registerGlobal(API_NAME6, config);
3592
3823
  }
3593
3824
  get baseURL() {
3594
3825
  const store = __privateMethod(this, _getConfig, getConfig_fn).call(this);
@@ -3607,7 +3838,7 @@ var _APIClientManagerAPI = class _APIClientManagerAPI {
3607
3838
  };
3608
3839
  _getConfig = new WeakSet();
3609
3840
  getConfig_fn = /* @__PURE__ */ __name(function() {
3610
- return getGlobal(API_NAME5);
3841
+ return getGlobal(API_NAME6);
3611
3842
  }, "#getConfig");
3612
3843
  __name(_APIClientManagerAPI, "APIClientManagerAPI");
3613
3844
  var APIClientManagerAPI = _APIClientManagerAPI;
@@ -3642,7 +3873,7 @@ __name(_NoopTaskCatalog, "NoopTaskCatalog");
3642
3873
  var NoopTaskCatalog = _NoopTaskCatalog;
3643
3874
 
3644
3875
  // src/v3/task-catalog/index.ts
3645
- var API_NAME6 = "task-catalog";
3876
+ var API_NAME7 = "task-catalog";
3646
3877
  var NOOP_TASK_CATALOG = new NoopTaskCatalog();
3647
3878
  var _getCatalog, getCatalog_fn;
3648
3879
  var _TaskCatalogAPI = class _TaskCatalogAPI {
@@ -3656,10 +3887,10 @@ var _TaskCatalogAPI = class _TaskCatalogAPI {
3656
3887
  return this._instance;
3657
3888
  }
3658
3889
  setGlobalTaskCatalog(taskCatalog2) {
3659
- return registerGlobal(API_NAME6, taskCatalog2);
3890
+ return registerGlobal(API_NAME7, taskCatalog2);
3660
3891
  }
3661
3892
  disable() {
3662
- unregisterGlobal(API_NAME6);
3893
+ unregisterGlobal(API_NAME7);
3663
3894
  }
3664
3895
  registerTaskMetadata(task) {
3665
3896
  __privateMethod(this, _getCatalog, getCatalog_fn).call(this).registerTaskMetadata(task);
@@ -3685,7 +3916,7 @@ var _TaskCatalogAPI = class _TaskCatalogAPI {
3685
3916
  };
3686
3917
  _getCatalog = new WeakSet();
3687
3918
  getCatalog_fn = /* @__PURE__ */ __name(function() {
3688
- return getGlobal(API_NAME6) ?? NOOP_TASK_CATALOG;
3919
+ return getGlobal(API_NAME7) ?? NOOP_TASK_CATALOG;
3689
3920
  }, "#getCatalog");
3690
3921
  __name(_TaskCatalogAPI, "TaskCatalogAPI");
3691
3922
  var TaskCatalogAPI = _TaskCatalogAPI;
@@ -3797,14 +4028,17 @@ var _TriggerTracer = class _TriggerTracer {
3797
4028
  attributes,
3798
4029
  startTime: clock.preciseNow()
3799
4030
  }, parentContext, async (span) => {
3800
- this.tracer.startSpan(name, {
3801
- ...options,
3802
- attributes: {
3803
- ...attributes,
3804
- [SemanticInternalAttributes.SPAN_PARTIAL]: true,
3805
- [SemanticInternalAttributes.SPAN_ID]: span.spanContext().spanId
3806
- }
3807
- }, parentContext).end();
4031
+ if (taskContext.ctx) {
4032
+ this.tracer.startSpan(name, {
4033
+ ...options,
4034
+ attributes: {
4035
+ ...attributes,
4036
+ [SemanticInternalAttributes.SPAN_PARTIAL]: true,
4037
+ [SemanticInternalAttributes.SPAN_ID]: span.spanContext().spanId
4038
+ }
4039
+ }, parentContext).end();
4040
+ }
4041
+ const usageMeasurement = usage.start();
3808
4042
  try {
3809
4043
  return await fn(span);
3810
4044
  } catch (e) {
@@ -3816,6 +4050,14 @@ var _TriggerTracer = class _TriggerTracer {
3816
4050
  });
3817
4051
  throw e;
3818
4052
  } finally {
4053
+ if (taskContext.ctx) {
4054
+ const usageSample = usage.stop(usageMeasurement);
4055
+ const machine = taskContext.ctx.machine;
4056
+ span.setAttributes({
4057
+ [SemanticInternalAttributes.USAGE_DURATION_MS]: usageSample.cpuTime,
4058
+ [SemanticInternalAttributes.USAGE_COST_IN_CENTS]: machine?.centsPerMs ? usageSample.cpuTime * machine.centsPerMs : 0
4059
+ });
4060
+ }
3819
4061
  span.end(clock.preciseNow());
3820
4062
  }
3821
4063
  });
@@ -4007,12 +4249,6 @@ function omit(obj, ...keys) {
4007
4249
  }
4008
4250
  __name(omit, "omit");
4009
4251
 
4010
- // src/v3/utils/styleAttributes.ts
4011
- function accessoryAttributes(accessory) {
4012
- return flattenAttributes(accessory, SemanticInternalAttributes.STYLE_ACCESSORY);
4013
- }
4014
- __name(accessoryAttributes, "accessoryAttributes");
4015
-
4016
4252
  // src/v3/utils/detectDependencyVersion.ts
4017
4253
  function detectDependencyVersion(dependency) {
4018
4254
  return dependencies[dependency];
@@ -4088,7 +4324,7 @@ async function conditionallyExportPacket(packet, pathPrefix, tracer) {
4088
4324
  return packet;
4089
4325
  }
4090
4326
  __name(conditionallyExportPacket, "conditionallyExportPacket");
4091
- function packetRequiresOffloading(packet) {
4327
+ function packetRequiresOffloading(packet, lengthLimit) {
4092
4328
  if (!packet.data) {
4093
4329
  return {
4094
4330
  needsOffloading: false,
@@ -4097,7 +4333,7 @@ function packetRequiresOffloading(packet) {
4097
4333
  }
4098
4334
  const byteSize = Buffer.byteLength(packet.data, "utf8");
4099
4335
  return {
4100
- needsOffloading: byteSize >= OFFLOAD_IO_PACKET_LENGTH_LIMIT,
4336
+ needsOffloading: byteSize >= (lengthLimit ?? OFFLOAD_IO_PACKET_LENGTH_LIMIT),
4101
4337
  size: byteSize
4102
4338
  };
4103
4339
  }
@@ -4288,6 +4524,8 @@ function safeJsonParse2(value) {
4288
4524
  }
4289
4525
  __name(safeJsonParse2, "safeJsonParse");
4290
4526
 
4527
+ exports.AbortTaskRunError = AbortTaskRunError;
4528
+ exports.AddTagsRequestBody = AddTagsRequestBody;
4291
4529
  exports.ApiClient = ApiClient;
4292
4530
  exports.ApiConnectionError = ApiConnectionError;
4293
4531
  exports.ApiError = ApiError;
@@ -4306,6 +4544,7 @@ exports.CancellationSpanEvent = CancellationSpanEvent;
4306
4544
  exports.ClientToSharedQueueMessages = ClientToSharedQueueMessages;
4307
4545
  exports.Config = Config;
4308
4546
  exports.ConflictError = ConflictError;
4547
+ exports.CoordinatorSocketData = CoordinatorSocketData;
4309
4548
  exports.CoordinatorToPlatformMessages = CoordinatorToPlatformMessages;
4310
4549
  exports.CoordinatorToProdWorkerMessages = CoordinatorToProdWorkerMessages;
4311
4550
  exports.CreateAuthorizationCodeResponseSchema = CreateAuthorizationCodeResponseSchema;
@@ -4350,9 +4589,11 @@ exports.ListRunResponse = ListRunResponse;
4350
4589
  exports.ListRunResponseItem = ListRunResponseItem;
4351
4590
  exports.ListScheduleOptions = ListScheduleOptions;
4352
4591
  exports.ListSchedulesResult = ListSchedulesResult;
4353
- exports.Machine = Machine;
4592
+ exports.MachineConfig = MachineConfig;
4354
4593
  exports.MachineCpu = MachineCpu;
4355
4594
  exports.MachineMemory = MachineMemory;
4595
+ exports.MachinePreset = MachinePreset;
4596
+ exports.MachinePresetName = MachinePresetName;
4356
4597
  exports.NULL_SENTINEL = NULL_SENTINEL;
4357
4598
  exports.NotFoundError = NotFoundError;
4358
4599
  exports.OFFLOAD_IO_PACKET_LENGTH_LIMIT = OFFLOAD_IO_PACKET_LENGTH_LIMIT;
@@ -4383,13 +4624,17 @@ exports.QueueOptions = QueueOptions;
4383
4624
  exports.RateLimitError = RateLimitError;
4384
4625
  exports.RateLimitOptions = RateLimitOptions;
4385
4626
  exports.ReplayRunResponse = ReplayRunResponse;
4627
+ exports.RescheduleRunRequestBody = RescheduleRunRequestBody;
4386
4628
  exports.RetrieveRunResponse = RetrieveRunResponse;
4387
4629
  exports.RetryOptions = RetryOptions;
4388
4630
  exports.RunEnvironmentDetails = RunEnvironmentDetails;
4389
4631
  exports.RunScheduleDetails = RunScheduleDetails;
4390
4632
  exports.RunStatus = RunStatus;
4633
+ exports.RunTags = RunTags;
4391
4634
  exports.ScheduleGenerator = ScheduleGenerator;
4635
+ exports.ScheduleMetadata = ScheduleMetadata;
4392
4636
  exports.ScheduleObject = ScheduleObject;
4637
+ exports.ScheduleType = ScheduleType;
4393
4638
  exports.ScheduledTaskPayload = ScheduledTaskPayload;
4394
4639
  exports.SemanticInternalAttributes = SemanticInternalAttributes;
4395
4640
  exports.SerializedError = SerializedError;
@@ -4424,10 +4669,12 @@ exports.TaskRunExecutionQueue = TaskRunExecutionQueue;
4424
4669
  exports.TaskRunExecutionResult = TaskRunExecutionResult;
4425
4670
  exports.TaskRunExecutionRetry = TaskRunExecutionRetry;
4426
4671
  exports.TaskRunExecutionTask = TaskRunExecutionTask;
4672
+ exports.TaskRunExecutionUsage = TaskRunExecutionUsage;
4427
4673
  exports.TaskRunFailedExecutionResult = TaskRunFailedExecutionResult;
4428
4674
  exports.TaskRunInternalError = TaskRunInternalError;
4429
4675
  exports.TaskRunStringError = TaskRunStringError;
4430
4676
  exports.TaskRunSuccessfulExecutionResult = TaskRunSuccessfulExecutionResult;
4677
+ exports.TimezonesResult = TimezonesResult;
4431
4678
  exports.TriggerTaskRequestBody = TriggerTaskRequestBody;
4432
4679
  exports.TriggerTaskResponse = TriggerTaskResponse;
4433
4680
  exports.TriggerTracer = TriggerTracer;
@@ -4464,7 +4711,9 @@ exports.groupTaskMetadataIssuesByTask = groupTaskMetadataIssuesByTask;
4464
4711
  exports.imposeAttributeLimits = imposeAttributeLimits;
4465
4712
  exports.isCancellationSpanEvent = isCancellationSpanEvent;
4466
4713
  exports.isExceptionSpanEvent = isExceptionSpanEvent;
4714
+ exports.isRequestOptions = isRequestOptions;
4467
4715
  exports.logger = logger;
4716
+ exports.mergeRequestOptions = mergeRequestOptions;
4468
4717
  exports.millisecondsToNanoseconds = millisecondsToNanoseconds;
4469
4718
  exports.nanosecondsToMilliseconds = nanosecondsToMilliseconds;
4470
4719
  exports.omit = omit;
@@ -4474,12 +4723,14 @@ exports.parsePacket = parsePacket;
4474
4723
  exports.prettyPrintPacket = prettyPrintPacket;
4475
4724
  exports.primitiveValueOrflattenedAttributes = primitiveValueOrflattenedAttributes;
4476
4725
  exports.runtime = runtime;
4726
+ exports.sanitizeError = sanitizeError;
4477
4727
  exports.serverWebsocketMessages = serverWebsocketMessages;
4478
4728
  exports.stringPatternMatchers = stringPatternMatchers;
4479
4729
  exports.stringifyIO = stringifyIO;
4480
4730
  exports.taskCatalog = taskCatalog;
4481
4731
  exports.taskContext = taskContext;
4482
4732
  exports.unflattenAttributes = unflattenAttributes;
4733
+ exports.usage = usage;
4483
4734
  exports.workerToChildMessages = workerToChildMessages;
4484
4735
  //# sourceMappingURL=out.js.map
4485
4736
  //# sourceMappingURL=index.js.map