@trigger.dev/core 3.0.0-beta.33 → 3.0.0-beta.35

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 (59) hide show
  1. package/dist/catalog-BUwiuDbt.d.mts +202 -0
  2. package/dist/catalog-eKgqBHUA.d.ts +202 -0
  3. package/dist/index.d.mts +60 -1
  4. package/dist/index.d.ts +60 -1
  5. package/dist/index.js +7 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +7 -1
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/{manager-WNMVbgHf.d.mts → manager-uPyMRN8k.d.mts} +24 -23
  10. package/dist/{manager-WNMVbgHf.d.ts → manager-uPyMRN8k.d.ts} +24 -23
  11. package/dist/{messages-vq7Bk4Ap.d.mts → messages-l9PdIyKF.d.mts} +4975 -1072
  12. package/dist/{messages-vq7Bk4Ap.d.ts → messages-l9PdIyKF.d.ts} +4975 -1072
  13. package/dist/{catalog-KbyTBoap.d.ts → schemas-b8tRw8dX.d.mts} +21 -186
  14. package/dist/{catalog-ck7x04PV.d.mts → schemas-b8tRw8dX.d.ts} +21 -186
  15. package/dist/v3/dev/index.d.mts +2 -2
  16. package/dist/v3/dev/index.d.ts +2 -2
  17. package/dist/v3/dev/index.js +4 -4
  18. package/dist/v3/dev/index.js.map +1 -1
  19. package/dist/v3/dev/index.mjs +4 -4
  20. package/dist/v3/dev/index.mjs.map +1 -1
  21. package/dist/v3/index.d.mts +121 -7
  22. package/dist/v3/index.d.ts +121 -7
  23. package/dist/v3/index.js +735 -352
  24. package/dist/v3/index.js.map +1 -1
  25. package/dist/v3/index.mjs +728 -353
  26. package/dist/v3/index.mjs.map +1 -1
  27. package/dist/v3/otel/index.js +5 -1
  28. package/dist/v3/otel/index.js.map +1 -1
  29. package/dist/v3/otel/index.mjs +5 -1
  30. package/dist/v3/otel/index.mjs.map +1 -1
  31. package/dist/v3/prod/index.d.mts +3 -3
  32. package/dist/v3/prod/index.d.ts +3 -3
  33. package/dist/v3/prod/index.js +90 -15
  34. package/dist/v3/prod/index.js.map +1 -1
  35. package/dist/v3/prod/index.mjs +90 -15
  36. package/dist/v3/prod/index.mjs.map +1 -1
  37. package/dist/v3/workers/index.d.mts +6 -5
  38. package/dist/v3/workers/index.d.ts +6 -5
  39. package/dist/v3/workers/index.js +204 -9
  40. package/dist/v3/workers/index.js.map +1 -1
  41. package/dist/v3/workers/index.mjs +204 -9
  42. package/dist/v3/workers/index.mjs.map +1 -1
  43. package/dist/v3/zodMessageHandler.d.mts +1 -1
  44. package/dist/v3/zodMessageHandler.d.ts +1 -1
  45. package/dist/v3/zodNamespace.js +16 -6
  46. package/dist/v3/zodNamespace.js.map +1 -1
  47. package/dist/v3/zodNamespace.mjs +17 -7
  48. package/dist/v3/zodNamespace.mjs.map +1 -1
  49. package/dist/v3/zodSocket.js +16 -6
  50. package/dist/v3/zodSocket.js.map +1 -1
  51. package/dist/v3/zodSocket.mjs +17 -7
  52. package/dist/v3/zodSocket.mjs.map +1 -1
  53. package/dist/v3/zodfetch.d.mts +78 -0
  54. package/dist/v3/zodfetch.d.ts +78 -0
  55. package/dist/v3/zodfetch.js +446 -0
  56. package/dist/v3/zodfetch.js.map +1 -0
  57. package/dist/v3/zodfetch.mjs +433 -0
  58. package/dist/v3/zodfetch.mjs.map +1 -0
  59. package/package.json +13 -4
package/dist/v3/index.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  import { propagation, context, trace, SpanStatusCode } from '@opentelemetry/api';
2
- import { fromZodError } from 'zod-validation-error';
3
2
  import { z } from 'zod';
3
+ import { fromZodError } from 'zod-validation-error';
4
+ import { FormDataEncoder } from 'form-data-encoder';
5
+ import { Readable } from 'node:stream';
4
6
  import { PreciseDate } from '@google-cloud/precise-date';
5
7
  import { logs } from '@opentelemetry/api-logs';
6
8
  import humanizeDuration from 'humanize-duration';
@@ -26,6 +28,31 @@ var __privateMethod = (obj, member, method) => {
26
28
  return method;
27
29
  };
28
30
 
31
+ // package.json
32
+ var version = "3.0.0-beta.35";
33
+ var dependencies = {
34
+ "@google-cloud/precise-date": "^4.0.0",
35
+ "@opentelemetry/api": "^1.8.0",
36
+ "@opentelemetry/api-logs": "^0.48.0",
37
+ "@opentelemetry/exporter-logs-otlp-http": "^0.49.1",
38
+ "@opentelemetry/exporter-trace-otlp-http": "^0.49.1",
39
+ "@opentelemetry/instrumentation": "^0.49.1",
40
+ "@opentelemetry/resources": "^1.22.0",
41
+ "@opentelemetry/sdk-logs": "^0.49.1",
42
+ "@opentelemetry/sdk-node": "^0.49.1",
43
+ "@opentelemetry/sdk-trace-base": "^1.22.0",
44
+ "@opentelemetry/sdk-trace-node": "^1.22.0",
45
+ "@opentelemetry/semantic-conventions": "^1.22.0",
46
+ "form-data-encoder": "^4.0.2",
47
+ "humanize-duration": "^3.27.3",
48
+ "socket.io-client": "4.7.4",
49
+ superjson: "^2.2.1",
50
+ ulidx: "^2.2.1",
51
+ zod: "3.22.3",
52
+ "zod-error": "1.5.0",
53
+ "zod-validation-error": "^1.5.0"
54
+ };
55
+
29
56
  // src/v3/apiErrors.ts
30
57
  var _APIError = class _APIError extends Error {
31
58
  constructor(status, error, message, headers) {
@@ -163,286 +190,46 @@ function castToError(err) {
163
190
  return new Error(err);
164
191
  }
165
192
  __name(castToError, "castToError");
166
-
167
- // src/retry.ts
168
- function calculateResetAt(resets, format, now = /* @__PURE__ */ new Date()) {
169
- if (!resets)
170
- return;
171
- switch (format) {
172
- case "iso_8601_duration_openai_variant": {
173
- return calculateISO8601DurationOpenAIVariantResetAt(resets, now);
174
- }
175
- case "iso_8601": {
176
- return calculateISO8601ResetAt(resets, now);
177
- }
178
- case "unix_timestamp": {
179
- return calculateUnixTimestampResetAt(resets, now);
180
- }
181
- case "unix_timestamp_in_ms": {
182
- return calculateUnixTimestampInMsResetAt(resets, now);
183
- }
184
- }
185
- }
186
- __name(calculateResetAt, "calculateResetAt");
187
- function calculateUnixTimestampResetAt(resets, now = /* @__PURE__ */ new Date()) {
188
- if (!resets)
189
- return void 0;
190
- const resetAt = parseInt(resets, 10);
191
- if (isNaN(resetAt))
192
- return void 0;
193
- return new Date(resetAt * 1e3);
194
- }
195
- __name(calculateUnixTimestampResetAt, "calculateUnixTimestampResetAt");
196
- function calculateUnixTimestampInMsResetAt(resets, now = /* @__PURE__ */ new Date()) {
197
- if (!resets)
198
- return void 0;
199
- const resetAt = parseInt(resets, 10);
200
- if (isNaN(resetAt))
201
- return void 0;
202
- return new Date(resetAt);
203
- }
204
- __name(calculateUnixTimestampInMsResetAt, "calculateUnixTimestampInMsResetAt");
205
- function calculateISO8601ResetAt(resets, now = /* @__PURE__ */ new Date()) {
206
- if (!resets)
207
- return void 0;
208
- const resetAt = new Date(resets);
209
- if (isNaN(resetAt.getTime()))
210
- return void 0;
211
- return resetAt;
212
- }
213
- __name(calculateISO8601ResetAt, "calculateISO8601ResetAt");
214
- function calculateISO8601DurationOpenAIVariantResetAt(resets, now = /* @__PURE__ */ new Date()) {
215
- if (!resets)
216
- return void 0;
217
- const pattern = /^(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+(?:\.\d+)?)s)?(?:(\d+)ms)?$/;
218
- const match = resets.match(pattern);
219
- if (!match)
220
- return void 0;
221
- const days = parseInt(match[1], 10) || 0;
222
- const hours = parseInt(match[2], 10) || 0;
223
- const minutes = parseInt(match[3], 10) || 0;
224
- const seconds = parseFloat(match[4]) || 0;
225
- const milliseconds = parseInt(match[5], 10) || 0;
226
- const resetAt = new Date(now);
227
- resetAt.setDate(resetAt.getDate() + days);
228
- resetAt.setHours(resetAt.getHours() + hours);
229
- resetAt.setMinutes(resetAt.getMinutes() + minutes);
230
- resetAt.setSeconds(resetAt.getSeconds() + Math.floor(seconds));
231
- resetAt.setMilliseconds(resetAt.getMilliseconds() + (seconds - Math.floor(seconds)) * 1e3 + milliseconds);
232
- return resetAt;
233
- }
234
- __name(calculateISO8601DurationOpenAIVariantResetAt, "calculateISO8601DurationOpenAIVariantResetAt");
235
-
236
- // src/v3/utils/retries.ts
237
- var defaultRetryOptions = {
238
- maxAttempts: 3,
239
- factor: 2,
240
- minTimeoutInMs: 1e3,
241
- maxTimeoutInMs: 6e4,
242
- randomize: true
243
- };
244
- var defaultFetchRetryOptions = {
245
- byStatus: {
246
- "429,408,409,5xx": {
247
- strategy: "backoff",
248
- ...defaultRetryOptions
249
- }
250
- },
251
- connectionError: defaultRetryOptions,
252
- timeout: defaultRetryOptions
253
- };
254
- function calculateNextRetryDelay(options, attempt) {
255
- const opts = {
256
- ...defaultRetryOptions,
257
- ...options
258
- };
259
- if (attempt >= opts.maxAttempts) {
260
- return;
261
- }
262
- const { factor, minTimeoutInMs, maxTimeoutInMs, randomize } = opts;
263
- const random = randomize ? Math.random() + 1 : 1;
264
- const timeout = Math.min(maxTimeoutInMs, random * minTimeoutInMs * Math.pow(factor, attempt - 1));
265
- return Math.round(timeout);
266
- }
267
- __name(calculateNextRetryDelay, "calculateNextRetryDelay");
268
- function calculateResetAt2(resets, format, now = Date.now()) {
269
- const resetAt = calculateResetAt(resets, format, new Date(now));
270
- return resetAt?.getTime();
271
- }
272
- __name(calculateResetAt2, "calculateResetAt");
273
-
274
- // src/v3/zodfetch.ts
275
- var defaultRetryOptions2 = {
276
- maxAttempts: 3,
277
- factor: 2,
278
- minTimeoutInMs: 1e3,
279
- maxTimeoutInMs: 6e4,
280
- randomize: false
281
- };
282
- async function zodfetch(schema, url, requestInit, options) {
283
- return await _doZodFetch(schema, url, requestInit, options);
284
- }
285
- __name(zodfetch, "zodfetch");
286
- async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
287
- try {
288
- const response = await fetch(url, requestInitWithCache(requestInit));
289
- const responseHeaders = createResponseHeaders(response.headers);
290
- if (!response.ok) {
291
- const retryResult = shouldRetry(response, attempt, options?.retry);
292
- if (retryResult.retry) {
293
- await new Promise((resolve) => setTimeout(resolve, retryResult.delay));
294
- return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
295
- } else {
296
- const errText = await response.text().catch((e) => castToError2(e).message);
297
- const errJSON = safeJsonParse(errText);
298
- const errMessage = errJSON ? void 0 : errText;
299
- throw APIError.generate(response.status, errJSON, errMessage, responseHeaders);
300
- }
301
- }
302
- const jsonBody = await response.json();
303
- const parsedResult = schema.safeParse(jsonBody);
304
- if (parsedResult.success) {
305
- return parsedResult.data;
306
- }
307
- throw fromZodError(parsedResult.error);
308
- } catch (error) {
309
- if (error instanceof APIError) {
310
- throw error;
311
- }
312
- if (options?.retry) {
313
- const retry = {
314
- ...defaultRetryOptions2,
315
- ...options.retry
316
- };
317
- const delay = calculateNextRetryDelay(retry, attempt);
318
- if (delay) {
319
- await new Promise((resolve) => setTimeout(resolve, delay));
320
- return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
321
- }
322
- }
323
- throw new APIConnectionError({
324
- cause: castToError2(error)
325
- });
326
- }
327
- }
328
- __name(_doZodFetch, "_doZodFetch");
329
- function castToError2(err) {
330
- if (err instanceof Error)
331
- return err;
332
- return new Error(err);
333
- }
334
- __name(castToError2, "castToError");
335
- function shouldRetry(response, attempt, retryOptions) {
336
- function shouldRetryForOptions() {
337
- const retry = {
338
- ...defaultRetryOptions2,
339
- ...retryOptions
340
- };
341
- const delay = calculateNextRetryDelay(retry, attempt);
342
- if (delay) {
343
- return {
344
- retry: true,
345
- delay
346
- };
347
- } else {
348
- return {
349
- retry: false
350
- };
351
- }
352
- }
353
- __name(shouldRetryForOptions, "shouldRetryForOptions");
354
- const shouldRetryHeader = response.headers.get("x-should-retry");
355
- if (shouldRetryHeader === "true")
356
- return shouldRetryForOptions();
357
- if (shouldRetryHeader === "false")
358
- return {
359
- retry: false
360
- };
361
- if (response.status === 408)
362
- return shouldRetryForOptions();
363
- if (response.status === 409)
364
- return shouldRetryForOptions();
365
- if (response.status === 429)
366
- return shouldRetryForOptions();
367
- if (response.status >= 500)
368
- return shouldRetryForOptions();
369
- return {
370
- retry: false
371
- };
372
- }
373
- __name(shouldRetry, "shouldRetry");
374
- function safeJsonParse(text) {
375
- try {
376
- return JSON.parse(text);
377
- } catch (e) {
378
- return void 0;
379
- }
380
- }
381
- __name(safeJsonParse, "safeJsonParse");
382
- function createResponseHeaders(headers) {
383
- return new Proxy(Object.fromEntries(
384
- // @ts-ignore
385
- headers.entries()
386
- ), {
387
- get(target, name) {
388
- const key = name.toString();
389
- return target[key.toLowerCase()] || target[key];
390
- }
391
- });
392
- }
393
- __name(createResponseHeaders, "createResponseHeaders");
394
- function requestInitWithCache(requestInit) {
395
- try {
396
- const withCache = {
397
- ...requestInit,
398
- cache: "no-cache"
399
- };
400
- const _ = new Request("http://localhost", withCache);
401
- return withCache;
402
- } catch (error) {
403
- return requestInit ?? {};
404
- }
405
- }
406
- __name(requestInitWithCache, "requestInitWithCache");
407
- var CreateAuthorizationCodeResponseSchema = z.object({
408
- url: z.string().url(),
409
- authorizationCode: z.string()
410
- });
411
- var GetPersonalAccessTokenRequestSchema = z.object({
412
- authorizationCode: z.string()
413
- });
414
- var GetPersonalAccessTokenResponseSchema = z.object({
415
- token: z.object({
416
- token: z.string(),
417
- obfuscatedToken: z.string()
418
- }).nullable()
419
- });
420
- var TaskRunBuiltInError = z.object({
421
- type: z.literal("BUILT_IN_ERROR"),
422
- name: z.string(),
423
- message: z.string(),
424
- stackTrace: z.string()
425
- });
426
- var TaskRunCustomErrorObject = z.object({
427
- type: z.literal("CUSTOM_ERROR"),
428
- raw: z.string()
429
- });
430
- var TaskRunStringError = z.object({
431
- type: z.literal("STRING_ERROR"),
432
- raw: z.string()
433
- });
434
- var TaskRunErrorCodes = {
435
- COULD_NOT_FIND_EXECUTOR: "COULD_NOT_FIND_EXECUTOR",
436
- COULD_NOT_FIND_TASK: "COULD_NOT_FIND_TASK",
437
- CONFIGURED_INCORRECTLY: "CONFIGURED_INCORRECTLY",
438
- TASK_ALREADY_RUNNING: "TASK_ALREADY_RUNNING",
439
- TASK_EXECUTION_FAILED: "TASK_EXECUTION_FAILED",
440
- TASK_EXECUTION_ABORTED: "TASK_EXECUTION_ABORTED",
441
- TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE: "TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE",
442
- TASK_RUN_CANCELLED: "TASK_RUN_CANCELLED",
443
- TASK_OUTPUT_ERROR: "TASK_OUTPUT_ERROR",
444
- HANDLE_ERROR_ERROR: "HANDLE_ERROR_ERROR",
445
- GRACEFUL_EXIT_TIMEOUT: "GRACEFUL_EXIT_TIMEOUT"
193
+ var CreateAuthorizationCodeResponseSchema = z.object({
194
+ url: z.string().url(),
195
+ authorizationCode: z.string()
196
+ });
197
+ var GetPersonalAccessTokenRequestSchema = z.object({
198
+ authorizationCode: z.string()
199
+ });
200
+ var GetPersonalAccessTokenResponseSchema = z.object({
201
+ token: z.object({
202
+ token: z.string(),
203
+ obfuscatedToken: z.string()
204
+ }).nullable()
205
+ });
206
+ var TaskRunBuiltInError = z.object({
207
+ type: z.literal("BUILT_IN_ERROR"),
208
+ name: z.string(),
209
+ message: z.string(),
210
+ stackTrace: z.string()
211
+ });
212
+ var TaskRunCustomErrorObject = z.object({
213
+ type: z.literal("CUSTOM_ERROR"),
214
+ raw: z.string()
215
+ });
216
+ var TaskRunStringError = z.object({
217
+ type: z.literal("STRING_ERROR"),
218
+ raw: z.string()
219
+ });
220
+ var TaskRunErrorCodes = {
221
+ COULD_NOT_FIND_EXECUTOR: "COULD_NOT_FIND_EXECUTOR",
222
+ COULD_NOT_FIND_TASK: "COULD_NOT_FIND_TASK",
223
+ CONFIGURED_INCORRECTLY: "CONFIGURED_INCORRECTLY",
224
+ TASK_ALREADY_RUNNING: "TASK_ALREADY_RUNNING",
225
+ TASK_EXECUTION_FAILED: "TASK_EXECUTION_FAILED",
226
+ TASK_EXECUTION_ABORTED: "TASK_EXECUTION_ABORTED",
227
+ TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE: "TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE",
228
+ TASK_PROCESS_SIGKILL_TIMEOUT: "TASK_PROCESS_SIGKILL_TIMEOUT",
229
+ TASK_RUN_CANCELLED: "TASK_RUN_CANCELLED",
230
+ TASK_OUTPUT_ERROR: "TASK_OUTPUT_ERROR",
231
+ HANDLE_ERROR_ERROR: "HANDLE_ERROR_ERROR",
232
+ GRACEFUL_EXIT_TIMEOUT: "GRACEFUL_EXIT_TIMEOUT"
446
233
  };
447
234
  var TaskRunInternalError = z.object({
448
235
  type: z.literal("INTERNAL_ERROR"),
@@ -454,10 +241,12 @@ var TaskRunInternalError = z.object({
454
241
  "TASK_EXECUTION_FAILED",
455
242
  "TASK_EXECUTION_ABORTED",
456
243
  "TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE",
244
+ "TASK_PROCESS_SIGKILL_TIMEOUT",
457
245
  "TASK_RUN_CANCELLED",
458
246
  "TASK_OUTPUT_ERROR",
459
247
  "HANDLE_ERROR_ERROR",
460
- "GRACEFUL_EXIT_TIMEOUT"
248
+ "GRACEFUL_EXIT_TIMEOUT",
249
+ "TASK_RUN_HEARTBEAT_TIMEOUT"
461
250
  ]),
462
251
  message: z.string().optional()
463
252
  });
@@ -760,6 +549,13 @@ var WaitReason = z.enum([
760
549
  "WAIT_FOR_TASK",
761
550
  "WAIT_FOR_BATCH"
762
551
  ]);
552
+ var TaskRunExecutionLazyAttemptPayload = z.object({
553
+ runId: z.string(),
554
+ messageId: z.string(),
555
+ isTest: z.boolean(),
556
+ traceContext: z.record(z.unknown()),
557
+ environment: z.record(z.string()).optional()
558
+ });
763
559
 
764
560
  // src/v3/schemas/resources.ts
765
561
  var TaskResource = z.object({
@@ -809,7 +605,8 @@ var GetProjectEnvResponse = z.object({
809
605
  });
810
606
  var CreateBackgroundWorkerRequestBody = z.object({
811
607
  localOnly: z.boolean(),
812
- metadata: BackgroundWorkerMetadata
608
+ metadata: BackgroundWorkerMetadata,
609
+ supportsLazyAttempts: z.boolean().optional()
813
610
  });
814
611
  var CreateBackgroundWorkerResponse = z.object({
815
612
  id: z.string(),
@@ -1038,6 +835,28 @@ var RetrieveRunResponse = z.object({
1038
835
  completedAt: z.coerce.date().optional()
1039
836
  }).optional())
1040
837
  });
838
+ var CreateEnvironmentVariableRequestBody = z.object({
839
+ name: z.string(),
840
+ value: z.string()
841
+ });
842
+ var UpdateEnvironmentVariableRequestBody = z.object({
843
+ value: z.string()
844
+ });
845
+ var ImportEnvironmentVariablesRequestBody = z.object({
846
+ variables: z.record(z.string()),
847
+ override: z.boolean().optional()
848
+ });
849
+ var EnvironmentVariableResponseBody = z.object({
850
+ success: z.boolean()
851
+ });
852
+ var EnvironmentVariableValue = z.object({
853
+ value: z.string()
854
+ });
855
+ var EnvironmentVariable = z.object({
856
+ name: z.string(),
857
+ value: z.string()
858
+ });
859
+ var EnvironmentVariables = z.array(EnvironmentVariable);
1041
860
  var BackgroundWorkerServerMessages = z.discriminatedUnion("type", [
1042
861
  z.object({
1043
862
  type: z.literal("EXECUTE_RUNS"),
@@ -1054,12 +873,16 @@ var BackgroundWorkerServerMessages = z.discriminatedUnion("type", [
1054
873
  version: z.string(),
1055
874
  machine: Machine,
1056
875
  // identifiers
1057
- id: z.string(),
876
+ id: z.string().optional(),
1058
877
  envId: z.string(),
1059
878
  envType: EnvironmentType,
1060
879
  orgId: z.string(),
1061
880
  projectId: z.string(),
1062
881
  runId: z.string()
882
+ }),
883
+ z.object({
884
+ type: z.literal("EXECUTE_RUN_LAZY_ATTEMPT"),
885
+ payload: TaskRunExecutionLazyAttemptPayload
1063
886
  })
1064
887
  ]);
1065
888
  var serverWebsocketMessages = {
@@ -1080,10 +903,20 @@ var BackgroundWorkerClientMessages = z.discriminatedUnion("type", [
1080
903
  completion: TaskRunExecutionResult,
1081
904
  execution: TaskRunExecution
1082
905
  }),
906
+ z.object({
907
+ version: z.literal("v1").default("v1"),
908
+ type: z.literal("TASK_RUN_FAILED_TO_RUN"),
909
+ completion: TaskRunFailedExecutionResult
910
+ }),
1083
911
  z.object({
1084
912
  version: z.literal("v1").default("v1"),
1085
913
  type: z.literal("TASK_HEARTBEAT"),
1086
914
  id: z.string()
915
+ }),
916
+ z.object({
917
+ version: z.literal("v1").default("v1"),
918
+ type: z.literal("TASK_RUN_HEARTBEAT"),
919
+ id: z.string()
1087
920
  })
1088
921
  ]);
1089
922
  var BackgroundWorkerProperties = z.object({
@@ -1094,7 +927,8 @@ var BackgroundWorkerProperties = z.object({
1094
927
  var clientWebsocketMessages = {
1095
928
  READY_FOR_TASKS: z.object({
1096
929
  version: z.literal("v1").default("v1"),
1097
- backgroundWorkerId: z.string()
930
+ backgroundWorkerId: z.string(),
931
+ inProgressRuns: z.string().array().optional()
1098
932
  }),
1099
933
  BACKGROUND_WORKER_DEPRECATED: z.object({
1100
934
  version: z.literal("v1").default("v1"),
@@ -1113,11 +947,17 @@ var workerToChildMessages = {
1113
947
  traceContext: z.record(z.unknown()),
1114
948
  metadata: BackgroundWorkerProperties
1115
949
  }),
1116
- TASK_RUN_COMPLETED_NOTIFICATION: z.object({
1117
- version: z.literal("v1").default("v1"),
1118
- completion: TaskRunExecutionResult,
1119
- execution: TaskRunExecution
1120
- }),
950
+ TASK_RUN_COMPLETED_NOTIFICATION: z.discriminatedUnion("version", [
951
+ z.object({
952
+ version: z.literal("v1"),
953
+ completion: TaskRunExecutionResult,
954
+ execution: TaskRunExecution
955
+ }),
956
+ z.object({
957
+ version: z.literal("v2"),
958
+ completion: TaskRunExecutionResult
959
+ })
960
+ ]),
1121
961
  CLEANUP: z.object({
1122
962
  version: z.literal("v1").default("v1"),
1123
963
  flush: z.boolean().default(false),
@@ -1158,6 +998,10 @@ var childToWorkerMessages = {
1158
998
  version: z.literal("v1").default("v1"),
1159
999
  id: z.string()
1160
1000
  }),
1001
+ TASK_RUN_HEARTBEAT: z.object({
1002
+ version: z.literal("v1").default("v1"),
1003
+ id: z.string()
1004
+ }),
1161
1005
  READY_TO_DISPOSE: z.undefined(),
1162
1006
  WAIT_FOR_DURATION: z.object({
1163
1007
  version: z.literal("v1").default("v1"),
@@ -1197,6 +1041,12 @@ var ProdChildToWorkerMessages = {
1197
1041
  id: z.string()
1198
1042
  })
1199
1043
  },
1044
+ TASK_RUN_HEARTBEAT: {
1045
+ message: z.object({
1046
+ version: z.literal("v1").default("v1"),
1047
+ id: z.string()
1048
+ })
1049
+ },
1200
1050
  READY_TO_DISPOSE: {
1201
1051
  message: z.undefined()
1202
1052
  },
@@ -1261,11 +1111,17 @@ var ProdWorkerToChildMessages = {
1261
1111
  })
1262
1112
  },
1263
1113
  TASK_RUN_COMPLETED_NOTIFICATION: {
1264
- message: z.object({
1265
- version: z.literal("v1").default("v1"),
1266
- completion: TaskRunExecutionResult,
1267
- execution: TaskRunExecution
1268
- })
1114
+ message: z.discriminatedUnion("version", [
1115
+ z.object({
1116
+ version: z.literal("v1"),
1117
+ completion: TaskRunExecutionResult,
1118
+ execution: TaskRunExecution
1119
+ }),
1120
+ z.object({
1121
+ version: z.literal("v2"),
1122
+ completion: TaskRunExecutionResult
1123
+ })
1124
+ ])
1269
1125
  },
1270
1126
  CLEANUP: {
1271
1127
  message: z.object({
@@ -1393,6 +1249,17 @@ var PlatformToProviderMessages = {
1393
1249
  })
1394
1250
  }
1395
1251
  };
1252
+ var CreateWorkerMessage = z.object({
1253
+ projectRef: z.string(),
1254
+ envId: z.string(),
1255
+ deploymentId: z.string(),
1256
+ metadata: z.object({
1257
+ cliPackageVersion: z.string().optional(),
1258
+ contentHash: z.string(),
1259
+ packageVersion: z.string(),
1260
+ tasks: TaskResource.array()
1261
+ })
1262
+ });
1396
1263
  var CoordinatorToPlatformMessages = {
1397
1264
  LOG: {
1398
1265
  message: z.object({
@@ -1402,18 +1269,15 @@ var CoordinatorToPlatformMessages = {
1402
1269
  })
1403
1270
  },
1404
1271
  CREATE_WORKER: {
1405
- message: z.object({
1406
- version: z.literal("v1").default("v1"),
1407
- projectRef: z.string(),
1408
- envId: z.string(),
1409
- deploymentId: z.string(),
1410
- metadata: z.object({
1411
- cliPackageVersion: z.string().optional(),
1412
- contentHash: z.string(),
1413
- packageVersion: z.string(),
1414
- tasks: TaskResource.array()
1272
+ message: z.discriminatedUnion("version", [
1273
+ CreateWorkerMessage.extend({
1274
+ version: z.literal("v1")
1275
+ }),
1276
+ CreateWorkerMessage.extend({
1277
+ version: z.literal("v2"),
1278
+ supportsLazyAttempts: z.boolean()
1415
1279
  })
1416
- }),
1280
+ ]),
1417
1281
  callback: z.discriminatedUnion("success", [
1418
1282
  z.object({
1419
1283
  success: z.literal(false)
@@ -1423,6 +1287,23 @@ var CoordinatorToPlatformMessages = {
1423
1287
  })
1424
1288
  ])
1425
1289
  },
1290
+ CREATE_TASK_RUN_ATTEMPT: {
1291
+ message: z.object({
1292
+ version: z.literal("v1").default("v1"),
1293
+ runId: z.string(),
1294
+ envId: z.string()
1295
+ }),
1296
+ callback: z.discriminatedUnion("success", [
1297
+ z.object({
1298
+ success: z.literal(false),
1299
+ reason: z.string().optional()
1300
+ }),
1301
+ z.object({
1302
+ success: z.literal(true),
1303
+ executionPayload: ProdTaskRunExecutionPayload
1304
+ })
1305
+ ])
1306
+ },
1426
1307
  READY_FOR_EXECUTION: {
1427
1308
  message: z.object({
1428
1309
  version: z.literal("v1").default("v1"),
@@ -1439,6 +1320,24 @@ var CoordinatorToPlatformMessages = {
1439
1320
  })
1440
1321
  ])
1441
1322
  },
1323
+ READY_FOR_LAZY_ATTEMPT: {
1324
+ message: z.object({
1325
+ version: z.literal("v1").default("v1"),
1326
+ runId: z.string(),
1327
+ envId: z.string(),
1328
+ totalCompletions: z.number()
1329
+ }),
1330
+ callback: z.discriminatedUnion("success", [
1331
+ z.object({
1332
+ success: z.literal(false),
1333
+ reason: z.string().optional()
1334
+ }),
1335
+ z.object({
1336
+ success: z.literal(true),
1337
+ lazyPayload: TaskRunExecutionLazyAttemptPayload
1338
+ })
1339
+ ])
1340
+ },
1442
1341
  READY_FOR_RESUME: {
1443
1342
  message: z.object({
1444
1343
  version: z.literal("v1").default("v1"),
@@ -1457,12 +1356,24 @@ var CoordinatorToPlatformMessages = {
1457
1356
  }).optional()
1458
1357
  })
1459
1358
  },
1359
+ TASK_RUN_FAILED_TO_RUN: {
1360
+ message: z.object({
1361
+ version: z.literal("v1").default("v1"),
1362
+ completion: TaskRunFailedExecutionResult
1363
+ })
1364
+ },
1460
1365
  TASK_HEARTBEAT: {
1461
1366
  message: z.object({
1462
1367
  version: z.literal("v1").default("v1"),
1463
1368
  attemptFriendlyId: z.string()
1464
1369
  })
1465
1370
  },
1371
+ TASK_RUN_HEARTBEAT: {
1372
+ message: z.object({
1373
+ version: z.literal("v1").default("v1"),
1374
+ runId: z.string()
1375
+ })
1376
+ },
1466
1377
  CHECKPOINT_CREATED: {
1467
1378
  message: z.object({
1468
1379
  version: z.literal("v1").default("v1"),
@@ -1501,6 +1412,17 @@ var CoordinatorToPlatformMessages = {
1501
1412
  stack: z.string().optional()
1502
1413
  })
1503
1414
  })
1415
+ },
1416
+ RUN_CRASHED: {
1417
+ message: z.object({
1418
+ version: z.literal("v1").default("v1"),
1419
+ runId: z.string(),
1420
+ error: z.object({
1421
+ name: z.string(),
1422
+ message: z.string(),
1423
+ stack: z.string().optional()
1424
+ })
1425
+ })
1504
1426
  }
1505
1427
  };
1506
1428
  var PlatformToCoordinatorMessages = {
@@ -1528,6 +1450,13 @@ var PlatformToCoordinatorMessages = {
1528
1450
  attemptFriendlyId: z.string()
1529
1451
  })
1530
1452
  },
1453
+ REQUEST_RUN_CANCELLATION: {
1454
+ message: z.object({
1455
+ version: z.literal("v1").default("v1"),
1456
+ runId: z.string(),
1457
+ delayInMs: z.number().optional()
1458
+ })
1459
+ },
1531
1460
  READY_FOR_RETRY: {
1532
1461
  message: z.object({
1533
1462
  version: z.literal("v1").default("v1"),
@@ -1571,6 +1500,12 @@ var SharedQueueToClientMessages = {
1571
1500
  })
1572
1501
  }
1573
1502
  };
1503
+ var IndexTasksMessage = z.object({
1504
+ version: z.literal("v1"),
1505
+ deploymentId: z.string(),
1506
+ tasks: TaskResource.array(),
1507
+ packageVersion: z.string()
1508
+ });
1574
1509
  var ProdWorkerToCoordinatorMessages = {
1575
1510
  LOG: {
1576
1511
  message: z.object({
@@ -1580,12 +1515,15 @@ var ProdWorkerToCoordinatorMessages = {
1580
1515
  callback: z.void()
1581
1516
  },
1582
1517
  INDEX_TASKS: {
1583
- message: z.object({
1584
- version: z.literal("v1").default("v1"),
1585
- deploymentId: z.string(),
1586
- tasks: TaskResource.array(),
1587
- packageVersion: z.string()
1588
- }),
1518
+ message: z.discriminatedUnion("version", [
1519
+ IndexTasksMessage.extend({
1520
+ version: z.literal("v1")
1521
+ }),
1522
+ IndexTasksMessage.extend({
1523
+ version: z.literal("v2"),
1524
+ supportsLazyAttempts: z.boolean()
1525
+ })
1526
+ ]),
1589
1527
  callback: z.discriminatedUnion("success", [
1590
1528
  z.object({
1591
1529
  success: z.literal(false)
@@ -1602,6 +1540,13 @@ var ProdWorkerToCoordinatorMessages = {
1602
1540
  totalCompletions: z.number()
1603
1541
  })
1604
1542
  },
1543
+ READY_FOR_LAZY_ATTEMPT: {
1544
+ message: z.object({
1545
+ version: z.literal("v1").default("v1"),
1546
+ runId: z.string(),
1547
+ totalCompletions: z.number()
1548
+ })
1549
+ },
1605
1550
  READY_FOR_RESUME: {
1606
1551
  message: z.object({
1607
1552
  version: z.literal("v1").default("v1"),
@@ -1638,6 +1583,12 @@ var ProdWorkerToCoordinatorMessages = {
1638
1583
  attemptFriendlyId: z.string()
1639
1584
  })
1640
1585
  },
1586
+ TASK_RUN_HEARTBEAT: {
1587
+ message: z.object({
1588
+ version: z.literal("v1").default("v1"),
1589
+ runId: z.string()
1590
+ })
1591
+ },
1641
1592
  TASK_RUN_COMPLETED: {
1642
1593
  message: z.object({
1643
1594
  version: z.literal("v1").default("v1"),
@@ -1649,6 +1600,12 @@ var ProdWorkerToCoordinatorMessages = {
1649
1600
  shouldExit: z.boolean()
1650
1601
  })
1651
1602
  },
1603
+ TASK_RUN_FAILED_TO_RUN: {
1604
+ message: z.object({
1605
+ version: z.literal("v1").default("v1"),
1606
+ completion: TaskRunFailedExecutionResult
1607
+ })
1608
+ },
1652
1609
  WAIT_FOR_DURATION: {
1653
1610
  message: z.object({
1654
1611
  version: z.literal("v1").default("v1"),
@@ -1693,21 +1650,47 @@ var ProdWorkerToCoordinatorMessages = {
1693
1650
  stack: z.string().optional()
1694
1651
  })
1695
1652
  })
1696
- }
1697
- };
1698
- var CoordinatorToProdWorkerMessages = {
1699
- RESUME_AFTER_DEPENDENCY: {
1653
+ },
1654
+ CREATE_TASK_RUN_ATTEMPT: {
1700
1655
  message: z.object({
1701
1656
  version: z.literal("v1").default("v1"),
1702
- attemptId: z.string(),
1703
- completions: TaskRunExecutionResult.array(),
1704
- executions: TaskRunExecution.array()
1705
- })
1657
+ runId: z.string()
1658
+ }),
1659
+ callback: z.discriminatedUnion("success", [
1660
+ z.object({
1661
+ success: z.literal(false),
1662
+ reason: z.string().optional()
1663
+ }),
1664
+ z.object({
1665
+ success: z.literal(true),
1666
+ executionPayload: ProdTaskRunExecutionPayload
1667
+ })
1668
+ ])
1706
1669
  },
1707
- RESUME_AFTER_DURATION: {
1670
+ UNRECOVERABLE_ERROR: {
1708
1671
  message: z.object({
1709
1672
  version: z.literal("v1").default("v1"),
1710
- attemptId: z.string()
1673
+ error: z.object({
1674
+ name: z.string(),
1675
+ message: z.string(),
1676
+ stack: z.string().optional()
1677
+ })
1678
+ })
1679
+ }
1680
+ };
1681
+ var CoordinatorToProdWorkerMessages = {
1682
+ RESUME_AFTER_DEPENDENCY: {
1683
+ message: z.object({
1684
+ version: z.literal("v1").default("v1"),
1685
+ attemptId: z.string(),
1686
+ completions: TaskRunExecutionResult.array(),
1687
+ executions: TaskRunExecution.array()
1688
+ })
1689
+ },
1690
+ RESUME_AFTER_DURATION: {
1691
+ message: z.object({
1692
+ version: z.literal("v1").default("v1"),
1693
+ attemptId: z.string()
1711
1694
  })
1712
1695
  },
1713
1696
  EXECUTE_TASK_RUN: {
@@ -1716,6 +1699,12 @@ var CoordinatorToProdWorkerMessages = {
1716
1699
  executionPayload: ProdTaskRunExecutionPayload
1717
1700
  })
1718
1701
  },
1702
+ EXECUTE_TASK_RUN_LAZY_ATTEMPT: {
1703
+ message: z.object({
1704
+ version: z.literal("v1").default("v1"),
1705
+ lazyPayload: TaskRunExecutionLazyAttemptPayload
1706
+ })
1707
+ },
1719
1708
  REQUEST_ATTEMPT_CANCELLATION: {
1720
1709
  message: z.object({
1721
1710
  version: z.literal("v1").default("v1"),
@@ -1723,9 +1712,15 @@ var CoordinatorToProdWorkerMessages = {
1723
1712
  })
1724
1713
  },
1725
1714
  REQUEST_EXIT: {
1726
- message: z.object({
1727
- version: z.literal("v1").default("v1")
1728
- })
1715
+ message: z.discriminatedUnion("version", [
1716
+ z.object({
1717
+ version: z.literal("v1")
1718
+ }),
1719
+ z.object({
1720
+ version: z.literal("v2"),
1721
+ delayInMs: z.number().optional()
1722
+ })
1723
+ ])
1729
1724
  },
1730
1725
  READY_FOR_RETRY: {
1731
1726
  message: z.object({
@@ -2100,29 +2095,359 @@ var TaskContextAPI = _TaskContextAPI;
2100
2095
  // src/v3/task-context-api.ts
2101
2096
  var taskContext = TaskContextAPI.getInstance();
2102
2097
 
2103
- // package.json
2104
- var version = "3.0.0-beta.33";
2105
- var dependencies = {
2106
- "@google-cloud/precise-date": "^4.0.0",
2107
- "@opentelemetry/api": "^1.8.0",
2108
- "@opentelemetry/api-logs": "^0.48.0",
2109
- "@opentelemetry/exporter-logs-otlp-http": "^0.49.1",
2110
- "@opentelemetry/exporter-trace-otlp-http": "^0.49.1",
2111
- "@opentelemetry/instrumentation": "^0.49.1",
2112
- "@opentelemetry/resources": "^1.22.0",
2113
- "@opentelemetry/sdk-logs": "^0.49.1",
2114
- "@opentelemetry/sdk-node": "^0.49.1",
2115
- "@opentelemetry/sdk-trace-base": "^1.22.0",
2116
- "@opentelemetry/sdk-trace-node": "^1.22.0",
2117
- "@opentelemetry/semantic-conventions": "^1.22.0",
2118
- "humanize-duration": "^3.27.3",
2119
- superjson: "^2.2.1",
2120
- ulidx: "^2.2.1",
2121
- zod: "3.22.3",
2122
- "zod-error": "1.5.0",
2123
- "zod-validation-error": "^1.5.0",
2124
- "socket.io-client": "4.7.4"
2098
+ // src/retry.ts
2099
+ function calculateResetAt(resets, format, now = /* @__PURE__ */ new Date()) {
2100
+ if (!resets)
2101
+ return;
2102
+ switch (format) {
2103
+ case "iso_8601_duration_openai_variant": {
2104
+ return calculateISO8601DurationOpenAIVariantResetAt(resets, now);
2105
+ }
2106
+ case "iso_8601": {
2107
+ return calculateISO8601ResetAt(resets, now);
2108
+ }
2109
+ case "unix_timestamp": {
2110
+ return calculateUnixTimestampResetAt(resets, now);
2111
+ }
2112
+ case "unix_timestamp_in_ms": {
2113
+ return calculateUnixTimestampInMsResetAt(resets, now);
2114
+ }
2115
+ }
2116
+ }
2117
+ __name(calculateResetAt, "calculateResetAt");
2118
+ function calculateUnixTimestampResetAt(resets, now = /* @__PURE__ */ new Date()) {
2119
+ if (!resets)
2120
+ return void 0;
2121
+ const resetAt = parseInt(resets, 10);
2122
+ if (isNaN(resetAt))
2123
+ return void 0;
2124
+ return new Date(resetAt * 1e3);
2125
+ }
2126
+ __name(calculateUnixTimestampResetAt, "calculateUnixTimestampResetAt");
2127
+ function calculateUnixTimestampInMsResetAt(resets, now = /* @__PURE__ */ new Date()) {
2128
+ if (!resets)
2129
+ return void 0;
2130
+ const resetAt = parseInt(resets, 10);
2131
+ if (isNaN(resetAt))
2132
+ return void 0;
2133
+ return new Date(resetAt);
2134
+ }
2135
+ __name(calculateUnixTimestampInMsResetAt, "calculateUnixTimestampInMsResetAt");
2136
+ function calculateISO8601ResetAt(resets, now = /* @__PURE__ */ new Date()) {
2137
+ if (!resets)
2138
+ return void 0;
2139
+ const resetAt = new Date(resets);
2140
+ if (isNaN(resetAt.getTime()))
2141
+ return void 0;
2142
+ return resetAt;
2143
+ }
2144
+ __name(calculateISO8601ResetAt, "calculateISO8601ResetAt");
2145
+ function calculateISO8601DurationOpenAIVariantResetAt(resets, now = /* @__PURE__ */ new Date()) {
2146
+ if (!resets)
2147
+ return void 0;
2148
+ const pattern = /^(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+(?:\.\d+)?)s)?(?:(\d+)ms)?$/;
2149
+ const match = resets.match(pattern);
2150
+ if (!match)
2151
+ return void 0;
2152
+ const days = parseInt(match[1], 10) || 0;
2153
+ const hours = parseInt(match[2], 10) || 0;
2154
+ const minutes = parseInt(match[3], 10) || 0;
2155
+ const seconds = parseFloat(match[4]) || 0;
2156
+ const milliseconds = parseInt(match[5], 10) || 0;
2157
+ const resetAt = new Date(now);
2158
+ resetAt.setDate(resetAt.getDate() + days);
2159
+ resetAt.setHours(resetAt.getHours() + hours);
2160
+ resetAt.setMinutes(resetAt.getMinutes() + minutes);
2161
+ resetAt.setSeconds(resetAt.getSeconds() + Math.floor(seconds));
2162
+ resetAt.setMilliseconds(resetAt.getMilliseconds() + (seconds - Math.floor(seconds)) * 1e3 + milliseconds);
2163
+ return resetAt;
2164
+ }
2165
+ __name(calculateISO8601DurationOpenAIVariantResetAt, "calculateISO8601DurationOpenAIVariantResetAt");
2166
+
2167
+ // src/v3/utils/retries.ts
2168
+ var defaultRetryOptions = {
2169
+ maxAttempts: 3,
2170
+ factor: 2,
2171
+ minTimeoutInMs: 1e3,
2172
+ maxTimeoutInMs: 6e4,
2173
+ randomize: true
2174
+ };
2175
+ var defaultFetchRetryOptions = {
2176
+ byStatus: {
2177
+ "429,408,409,5xx": {
2178
+ strategy: "backoff",
2179
+ ...defaultRetryOptions
2180
+ }
2181
+ },
2182
+ connectionError: defaultRetryOptions,
2183
+ timeout: defaultRetryOptions
2184
+ };
2185
+ function calculateNextRetryDelay(options, attempt) {
2186
+ const opts = {
2187
+ ...defaultRetryOptions,
2188
+ ...options
2189
+ };
2190
+ if (attempt >= opts.maxAttempts) {
2191
+ return;
2192
+ }
2193
+ const { factor, minTimeoutInMs, maxTimeoutInMs, randomize } = opts;
2194
+ const random = randomize ? Math.random() + 1 : 1;
2195
+ const timeout = Math.min(maxTimeoutInMs, random * minTimeoutInMs * Math.pow(factor, attempt - 1));
2196
+ return Math.round(timeout);
2197
+ }
2198
+ __name(calculateNextRetryDelay, "calculateNextRetryDelay");
2199
+ function calculateResetAt2(resets, format, now = Date.now()) {
2200
+ const resetAt = calculateResetAt(resets, format, new Date(now));
2201
+ return resetAt?.getTime();
2202
+ }
2203
+ __name(calculateResetAt2, "calculateResetAt");
2204
+ var defaultRetryOptions2 = {
2205
+ maxAttempts: 3,
2206
+ factor: 2,
2207
+ minTimeoutInMs: 1e3,
2208
+ maxTimeoutInMs: 6e4,
2209
+ randomize: false
2125
2210
  };
2211
+ async function zodfetch(schema, url, requestInit, options) {
2212
+ return await _doZodFetch(schema, url, requestInit, options);
2213
+ }
2214
+ __name(zodfetch, "zodfetch");
2215
+ async function zodupload(schema, url, body, requestInit, options) {
2216
+ const form = await createForm(body);
2217
+ const encoder = new FormDataEncoder(form);
2218
+ const finalHeaders = {};
2219
+ for (const [key, value] of Object.entries(requestInit?.headers || {})) {
2220
+ finalHeaders[key] = value;
2221
+ }
2222
+ for (const [key, value] of Object.entries(encoder.headers)) {
2223
+ finalHeaders[key] = value;
2224
+ }
2225
+ finalHeaders["Content-Length"] = String(encoder.contentLength);
2226
+ const finalRequestInit = {
2227
+ ...requestInit,
2228
+ headers: finalHeaders,
2229
+ body: Readable.from(encoder),
2230
+ // @ts-expect-error
2231
+ duplex: "half"
2232
+ };
2233
+ return await _doZodFetch(schema, url, finalRequestInit, options);
2234
+ }
2235
+ __name(zodupload, "zodupload");
2236
+ var createForm = /* @__PURE__ */ __name(async (body) => {
2237
+ const form = new FormData();
2238
+ await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value)));
2239
+ return form;
2240
+ }, "createForm");
2241
+ async function _doZodFetch(schema, url, requestInit, options, attempt = 1) {
2242
+ try {
2243
+ const response = await fetch(url, requestInitWithCache(requestInit));
2244
+ const responseHeaders = createResponseHeaders(response.headers);
2245
+ if (!response.ok) {
2246
+ const retryResult = shouldRetry(response, attempt, options?.retry);
2247
+ if (retryResult.retry) {
2248
+ await new Promise((resolve) => setTimeout(resolve, retryResult.delay));
2249
+ return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
2250
+ } else {
2251
+ const errText = await response.text().catch((e) => castToError2(e).message);
2252
+ const errJSON = safeJsonParse(errText);
2253
+ const errMessage = errJSON ? void 0 : errText;
2254
+ throw APIError.generate(response.status, errJSON, errMessage, responseHeaders);
2255
+ }
2256
+ }
2257
+ const jsonBody = await response.json();
2258
+ const parsedResult = schema.safeParse(jsonBody);
2259
+ if (parsedResult.success) {
2260
+ return parsedResult.data;
2261
+ }
2262
+ throw fromZodError(parsedResult.error);
2263
+ } catch (error) {
2264
+ if (error instanceof APIError) {
2265
+ throw error;
2266
+ }
2267
+ if (options?.retry) {
2268
+ const retry = {
2269
+ ...defaultRetryOptions2,
2270
+ ...options.retry
2271
+ };
2272
+ const delay = calculateNextRetryDelay(retry, attempt);
2273
+ if (delay) {
2274
+ await new Promise((resolve) => setTimeout(resolve, delay));
2275
+ return await _doZodFetch(schema, url, requestInit, options, attempt + 1);
2276
+ }
2277
+ }
2278
+ throw new APIConnectionError({
2279
+ cause: castToError2(error)
2280
+ });
2281
+ }
2282
+ }
2283
+ __name(_doZodFetch, "_doZodFetch");
2284
+ function castToError2(err) {
2285
+ if (err instanceof Error)
2286
+ return err;
2287
+ return new Error(err);
2288
+ }
2289
+ __name(castToError2, "castToError");
2290
+ function shouldRetry(response, attempt, retryOptions) {
2291
+ function shouldRetryForOptions() {
2292
+ const retry = {
2293
+ ...defaultRetryOptions2,
2294
+ ...retryOptions
2295
+ };
2296
+ const delay = calculateNextRetryDelay(retry, attempt);
2297
+ if (delay) {
2298
+ return {
2299
+ retry: true,
2300
+ delay
2301
+ };
2302
+ } else {
2303
+ return {
2304
+ retry: false
2305
+ };
2306
+ }
2307
+ }
2308
+ __name(shouldRetryForOptions, "shouldRetryForOptions");
2309
+ const shouldRetryHeader = response.headers.get("x-should-retry");
2310
+ if (shouldRetryHeader === "true")
2311
+ return shouldRetryForOptions();
2312
+ if (shouldRetryHeader === "false")
2313
+ return {
2314
+ retry: false
2315
+ };
2316
+ if (response.status === 408)
2317
+ return shouldRetryForOptions();
2318
+ if (response.status === 409)
2319
+ return shouldRetryForOptions();
2320
+ if (response.status === 429)
2321
+ return shouldRetryForOptions();
2322
+ if (response.status >= 500)
2323
+ return shouldRetryForOptions();
2324
+ return {
2325
+ retry: false
2326
+ };
2327
+ }
2328
+ __name(shouldRetry, "shouldRetry");
2329
+ function safeJsonParse(text) {
2330
+ try {
2331
+ return JSON.parse(text);
2332
+ } catch (e) {
2333
+ return void 0;
2334
+ }
2335
+ }
2336
+ __name(safeJsonParse, "safeJsonParse");
2337
+ function createResponseHeaders(headers) {
2338
+ return new Proxy(Object.fromEntries(
2339
+ // @ts-ignore
2340
+ headers.entries()
2341
+ ), {
2342
+ get(target, name) {
2343
+ const key = name.toString();
2344
+ return target[key.toLowerCase()] || target[key];
2345
+ }
2346
+ });
2347
+ }
2348
+ __name(createResponseHeaders, "createResponseHeaders");
2349
+ function requestInitWithCache(requestInit) {
2350
+ try {
2351
+ const withCache = {
2352
+ ...requestInit,
2353
+ cache: "no-cache"
2354
+ };
2355
+ const _ = new Request("http://localhost", withCache);
2356
+ return withCache;
2357
+ } catch (error) {
2358
+ return requestInit ?? {};
2359
+ }
2360
+ }
2361
+ __name(requestInitWithCache, "requestInitWithCache");
2362
+ var addFormValue = /* @__PURE__ */ __name(async (form, key, value) => {
2363
+ if (value === void 0)
2364
+ return;
2365
+ if (value == null) {
2366
+ throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
2367
+ }
2368
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
2369
+ form.append(key, String(value));
2370
+ } else if (isUploadable(value) || isBlobLike(value) || value instanceof Buffer || value instanceof ArrayBuffer) {
2371
+ const file = await toFile(value);
2372
+ form.append(key, file);
2373
+ } else if (Array.isArray(value)) {
2374
+ await Promise.all(value.map((entry) => addFormValue(form, key + "[]", entry)));
2375
+ } else if (typeof value === "object") {
2376
+ await Promise.all(Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)));
2377
+ } else {
2378
+ throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
2379
+ }
2380
+ }, "addFormValue");
2381
+ async function toFile(value, name, options) {
2382
+ value = await value;
2383
+ options ??= isFileLike(value) ? {
2384
+ lastModified: value.lastModified,
2385
+ type: value.type
2386
+ } : {};
2387
+ if (isResponseLike(value)) {
2388
+ const blob = await value.blob();
2389
+ name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? "unknown_file";
2390
+ return new File([
2391
+ blob
2392
+ ], name, options);
2393
+ }
2394
+ const bits = await getBytes(value);
2395
+ name ||= getName(value) ?? "unknown_file";
2396
+ if (!options.type) {
2397
+ const type = bits[0]?.type;
2398
+ if (typeof type === "string") {
2399
+ options = {
2400
+ ...options,
2401
+ type
2402
+ };
2403
+ }
2404
+ }
2405
+ return new File(bits, name, options);
2406
+ }
2407
+ __name(toFile, "toFile");
2408
+ function getName(value) {
2409
+ return getStringFromMaybeBuffer(value.name) || getStringFromMaybeBuffer(value.filename) || // For fs.ReadStream
2410
+ getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop();
2411
+ }
2412
+ __name(getName, "getName");
2413
+ var getStringFromMaybeBuffer = /* @__PURE__ */ __name((x) => {
2414
+ if (typeof x === "string")
2415
+ return x;
2416
+ if (typeof Buffer !== "undefined" && x instanceof Buffer)
2417
+ return String(x);
2418
+ return void 0;
2419
+ }, "getStringFromMaybeBuffer");
2420
+ async function getBytes(value) {
2421
+ let parts = [];
2422
+ if (typeof value === "string" || ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc.
2423
+ value instanceof ArrayBuffer) {
2424
+ parts.push(value);
2425
+ } else if (isBlobLike(value)) {
2426
+ parts.push(await value.arrayBuffer());
2427
+ } else if (isAsyncIterableIterator(value)) {
2428
+ for await (const chunk of value) {
2429
+ parts.push(chunk);
2430
+ }
2431
+ } else {
2432
+ throw new Error(`Unexpected data type: ${typeof value}; constructor: ${value?.constructor?.name}; props: ${propsForError(value)}`);
2433
+ }
2434
+ return parts;
2435
+ }
2436
+ __name(getBytes, "getBytes");
2437
+ function propsForError(value) {
2438
+ const props = Object.getOwnPropertyNames(value);
2439
+ return `[${props.map((p) => `"${p}"`).join(", ")}]`;
2440
+ }
2441
+ __name(propsForError, "propsForError");
2442
+ var isAsyncIterableIterator = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function", "isAsyncIterableIterator");
2443
+ var isResponseLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function", "isResponseLike");
2444
+ var isFileLike = /* @__PURE__ */ __name((value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike(value), "isFileLike");
2445
+ 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");
2446
+ var isFsReadStream = /* @__PURE__ */ __name((value) => value instanceof Readable, "isFsReadStream");
2447
+ var isUploadable = /* @__PURE__ */ __name((value) => {
2448
+ return isFileLike(value) || isResponseLike(value) || isFsReadStream(value);
2449
+ }, "isUploadable");
2450
+ 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");
2126
2451
 
2127
2452
  // src/v3/apiClient/index.ts
2128
2453
  var zodFetchOptions = {
@@ -2257,6 +2582,52 @@ var _ApiClient = class _ApiClient {
2257
2582
  headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2258
2583
  });
2259
2584
  }
2585
+ listEnvVars(projectRef, slug) {
2586
+ return zodfetch(EnvironmentVariables, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}`, {
2587
+ method: "GET",
2588
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2589
+ });
2590
+ }
2591
+ importEnvVars(projectRef, slug, body) {
2592
+ if (isRecordLike(body.variables)) {
2593
+ return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, {
2594
+ method: "POST",
2595
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
2596
+ body: JSON.stringify(body)
2597
+ });
2598
+ } else {
2599
+ return zodupload(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/import`, body, {
2600
+ method: "POST",
2601
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2602
+ });
2603
+ }
2604
+ }
2605
+ retrieveEnvVar(projectRef, slug, key) {
2606
+ return zodfetch(EnvironmentVariableValue, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
2607
+ method: "GET",
2608
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2609
+ });
2610
+ }
2611
+ createEnvVar(projectRef, slug, body) {
2612
+ return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}`, {
2613
+ method: "POST",
2614
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
2615
+ body: JSON.stringify(body)
2616
+ });
2617
+ }
2618
+ updateEnvVar(projectRef, slug, key, body) {
2619
+ return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
2620
+ method: "PUT",
2621
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false),
2622
+ body: JSON.stringify(body)
2623
+ });
2624
+ }
2625
+ deleteEnvVar(projectRef, slug, key) {
2626
+ return zodfetch(EnvironmentVariableResponseBody, `${this.baseUrl}/api/v1/projects/${projectRef}/envvars/${slug}/${key}`, {
2627
+ method: "DELETE",
2628
+ headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
2629
+ });
2630
+ }
2260
2631
  };
2261
2632
  _getHeaders = new WeakSet();
2262
2633
  getHeaders_fn = /* @__PURE__ */ __name(function(spanParentAsLink) {
@@ -2405,7 +2776,7 @@ function correctErrorStackTrace(stackTrace, projectDir, options) {
2405
2776
  const [errorLine, ...traceLines] = stackTrace.split("\n");
2406
2777
  return [
2407
2778
  options?.removeFirstLine ? void 0 : errorLine,
2408
- ...traceLines.map((line) => correctStackTraceLine(line, projectDir))
2779
+ ...traceLines.map((line) => correctStackTraceLine(line, projectDir, options?.isDev))
2409
2780
  ].filter(Boolean).join("\n");
2410
2781
  }
2411
2782
  __name(correctErrorStackTrace, "correctErrorStackTrace");
@@ -2415,14 +2786,18 @@ var LINES_TO_IGNORE = [
2415
2786
  /TaskExecutor/,
2416
2787
  /EXECUTE_TASK_RUN/,
2417
2788
  /@trigger.dev\/core/,
2789
+ /packages\/core\/src\/v3/,
2418
2790
  /safeJsonProcess/,
2419
- /__entryPoint.ts/
2791
+ /__entryPoint.ts/,
2792
+ /ZodIpc/,
2793
+ /startActiveSpan/,
2794
+ /processTicksAndRejections/
2420
2795
  ];
2421
- function correctStackTraceLine(line, projectDir) {
2796
+ function correctStackTraceLine(line, projectDir, isDev) {
2422
2797
  if (LINES_TO_IGNORE.some((regex) => regex.test(line))) {
2423
2798
  return;
2424
2799
  }
2425
- if (projectDir && !line.includes(projectDir)) {
2800
+ if (isDev && projectDir && !line.includes(projectDir)) {
2426
2801
  return;
2427
2802
  }
2428
2803
  return line.trim();
@@ -2803,7 +3178,7 @@ var _APIClientManagerAPI = class _APIClientManagerAPI {
2803
3178
  }
2804
3179
  get accessToken() {
2805
3180
  const store = __privateMethod(this, _getConfig, getConfig_fn).call(this);
2806
- return store?.secretKey ?? getEnvVar("TRIGGER_SECRET_KEY");
3181
+ return store?.secretKey ?? getEnvVar("TRIGGER_SECRET_KEY") ?? getEnvVar("TRIGGER_ACCESS_TOKEN");
2807
3182
  }
2808
3183
  get client() {
2809
3184
  if (!this.baseURL || !this.accessToken) {
@@ -3495,6 +3870,6 @@ function safeJsonParse2(value) {
3495
3870
  }
3496
3871
  __name(safeJsonParse2, "safeJsonParse");
3497
3872
 
3498
- export { APIConnectionError, APIError, ApiClient, AttemptStatus, AuthenticationError, BackgroundWorkerClientMessages, BackgroundWorkerMetadata, BackgroundWorkerProperties, BackgroundWorkerServerMessages, BadRequestError, BatchTaskRunExecutionResult, BatchTriggerTaskRequestBody, BatchTriggerTaskResponse, CanceledRunResponse, CancellationSpanEvent, ClientToSharedQueueMessages, Config, ConflictError, CoordinatorToPlatformMessages, CoordinatorToProdWorkerMessages, CreateAuthorizationCodeResponseSchema, CreateBackgroundWorkerRequestBody, CreateBackgroundWorkerResponse, CreateScheduleOptions, CreateUploadPayloadUrlResponseBody, DeletedScheduleObject, DeploymentErrorData, EnvironmentType, EventFilter, ExceptionEventProperties, ExceptionSpanEvent, ExternalBuildData, FetchRetryBackoffStrategy, FetchRetryByStatusOptions, FetchRetryHeadersStrategy, FetchRetryOptions, FetchRetryStrategy, FetchTimeoutOptions, FixedWindowRateLimit, GetBatchResponseBody, GetDeploymentResponseBody, GetEnvironmentVariablesResponseBody, GetPersonalAccessTokenRequestSchema, GetPersonalAccessTokenResponseSchema, GetProjectEnvResponse, GetProjectResponseBody, GetProjectsResponseBody, ImageDetailsMetadata, InitializeDeploymentRequestBody, InitializeDeploymentResponseBody, InternalServerError, ListScheduleOptions, ListSchedulesResult, Machine, MachineCpu, MachineMemory, NULL_SENTINEL, NotFoundError, OFFLOAD_IO_PACKET_LENGTH_LIMIT, OTEL_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, OTEL_ATTRIBUTE_PER_LINK_COUNT_LIMIT, OTEL_LINK_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_EVENT_COUNT_LIMIT, OtherSpanEvent, PRIMARY_VARIANT, PermissionDeniedError, PlatformToCoordinatorMessages, PlatformToProviderMessages, PostStartCauses, PreStopCauses, ProdChildToWorkerMessages, ProdTaskRunExecution, ProdTaskRunExecutionPayload, ProdWorkerSocketData, ProdWorkerToChildMessages, ProdWorkerToCoordinatorMessages, ProviderToPlatformMessages, QueueOptions, RateLimitError, RateLimitOptions, ReplayRunResponse, RetrieveRunResponse, RetryOptions, RunStatus, ScheduleObject, ScheduledTaskPayload, SemanticInternalAttributes, SharedQueueToClientMessages, SlidingWindowRateLimit, SpanEvent, SpanEvents, SpanMessagingEvent, StartDeploymentIndexingRequestBody, StartDeploymentIndexingResponseBody, TaskEventStyle, TaskFileMetadata, TaskMetadata, TaskMetadataFailedToParseData, TaskMetadataWithFilePath, TaskResource, TaskRun, TaskRunBuiltInError, TaskRunContext, TaskRunCustomErrorObject, TaskRunError, TaskRunErrorCodes, TaskRunExecution, TaskRunExecutionAttempt, TaskRunExecutionBatch, TaskRunExecutionEnvironment, TaskRunExecutionOrganization, TaskRunExecutionPayload, TaskRunExecutionProject, TaskRunExecutionQueue, TaskRunExecutionResult, TaskRunExecutionRetry, TaskRunExecutionTask, TaskRunFailedExecutionResult, TaskRunInternalError, TaskRunStringError, TaskRunSuccessfulExecutionResult, TriggerTaskRequestBody, TriggerTaskResponse, TriggerTracer, UncaughtExceptionMessage, UnprocessableEntityError, UpdateScheduleOptions, WaitReason, WhoAmIResponseSchema, accessoryAttributes, apiClientManager, calculateNextRetryDelay, calculateResetAt2 as calculateResetAt, childToWorkerMessages, clientWebsocketMessages, clock, conditionallyExportPacket, conditionallyImportPacket, correctErrorStackTrace, createErrorTaskError, createJsonErrorObject, createPacketAttributes, createPacketAttributesAsJson, defaultFetchRetryOptions, defaultRetryOptions, detectDependencyVersion, eventFilterMatches, flattenAttributes, formatDuration, formatDurationInDays, formatDurationMilliseconds, formatDurationNanoseconds, groupTaskMetadataIssuesByTask, imposeAttributeLimits, isCancellationSpanEvent, isExceptionSpanEvent, logger, millisecondsToNanoseconds, nanosecondsToMilliseconds, omit, packetRequiresOffloading, parseError, parsePacket, prettyPrintPacket, primitiveValueOrflattenedAttributes, runtime, serverWebsocketMessages, stringPatternMatchers, stringifyIO, taskCatalog, taskContext, unflattenAttributes, workerToChildMessages };
3873
+ export { APIConnectionError, APIError, ApiClient, AttemptStatus, AuthenticationError, BackgroundWorkerClientMessages, BackgroundWorkerMetadata, BackgroundWorkerProperties, BackgroundWorkerServerMessages, BadRequestError, BatchTaskRunExecutionResult, BatchTriggerTaskRequestBody, BatchTriggerTaskResponse, CanceledRunResponse, CancellationSpanEvent, ClientToSharedQueueMessages, Config, ConflictError, CoordinatorToPlatformMessages, CoordinatorToProdWorkerMessages, CreateAuthorizationCodeResponseSchema, CreateBackgroundWorkerRequestBody, CreateBackgroundWorkerResponse, CreateEnvironmentVariableRequestBody, CreateScheduleOptions, CreateUploadPayloadUrlResponseBody, DeletedScheduleObject, DeploymentErrorData, EnvironmentType, EnvironmentVariable, EnvironmentVariableResponseBody, EnvironmentVariableValue, EnvironmentVariables, EventFilter, ExceptionEventProperties, ExceptionSpanEvent, ExternalBuildData, FetchRetryBackoffStrategy, FetchRetryByStatusOptions, FetchRetryHeadersStrategy, FetchRetryOptions, FetchRetryStrategy, FetchTimeoutOptions, FixedWindowRateLimit, GetBatchResponseBody, GetDeploymentResponseBody, GetEnvironmentVariablesResponseBody, GetPersonalAccessTokenRequestSchema, GetPersonalAccessTokenResponseSchema, GetProjectEnvResponse, GetProjectResponseBody, GetProjectsResponseBody, ImageDetailsMetadata, ImportEnvironmentVariablesRequestBody, InitializeDeploymentRequestBody, InitializeDeploymentResponseBody, InternalServerError, ListScheduleOptions, ListSchedulesResult, Machine, MachineCpu, MachineMemory, NULL_SENTINEL, NotFoundError, OFFLOAD_IO_PACKET_LENGTH_LIMIT, OTEL_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, OTEL_ATTRIBUTE_PER_LINK_COUNT_LIMIT, OTEL_LINK_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_COUNT_LIMIT, OTEL_LOG_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_EVENT_COUNT_LIMIT, OtherSpanEvent, PRIMARY_VARIANT, PermissionDeniedError, PlatformToCoordinatorMessages, PlatformToProviderMessages, PostStartCauses, PreStopCauses, ProdChildToWorkerMessages, ProdTaskRunExecution, ProdTaskRunExecutionPayload, ProdWorkerSocketData, ProdWorkerToChildMessages, ProdWorkerToCoordinatorMessages, ProviderToPlatformMessages, QueueOptions, RateLimitError, RateLimitOptions, ReplayRunResponse, RetrieveRunResponse, RetryOptions, RunStatus, ScheduleObject, ScheduledTaskPayload, SemanticInternalAttributes, SharedQueueToClientMessages, SlidingWindowRateLimit, SpanEvent, SpanEvents, SpanMessagingEvent, StartDeploymentIndexingRequestBody, StartDeploymentIndexingResponseBody, TaskEventStyle, TaskFileMetadata, TaskMetadata, TaskMetadataFailedToParseData, TaskMetadataWithFilePath, TaskResource, TaskRun, TaskRunBuiltInError, TaskRunContext, TaskRunCustomErrorObject, TaskRunError, TaskRunErrorCodes, TaskRunExecution, TaskRunExecutionAttempt, TaskRunExecutionBatch, TaskRunExecutionEnvironment, TaskRunExecutionLazyAttemptPayload, TaskRunExecutionOrganization, TaskRunExecutionPayload, TaskRunExecutionProject, TaskRunExecutionQueue, TaskRunExecutionResult, TaskRunExecutionRetry, TaskRunExecutionTask, TaskRunFailedExecutionResult, TaskRunInternalError, TaskRunStringError, TaskRunSuccessfulExecutionResult, TriggerTaskRequestBody, TriggerTaskResponse, TriggerTracer, UncaughtExceptionMessage, UnprocessableEntityError, UpdateEnvironmentVariableRequestBody, UpdateScheduleOptions, WaitReason, WhoAmIResponseSchema, accessoryAttributes, apiClientManager, calculateNextRetryDelay, calculateResetAt2 as calculateResetAt, childToWorkerMessages, clientWebsocketMessages, clock, conditionallyExportPacket, conditionallyImportPacket, correctErrorStackTrace, createErrorTaskError, createJsonErrorObject, createPacketAttributes, createPacketAttributesAsJson, defaultFetchRetryOptions, defaultRetryOptions, detectDependencyVersion, eventFilterMatches, flattenAttributes, formatDuration, formatDurationInDays, formatDurationMilliseconds, formatDurationNanoseconds, groupTaskMetadataIssuesByTask, imposeAttributeLimits, isCancellationSpanEvent, isExceptionSpanEvent, logger, millisecondsToNanoseconds, nanosecondsToMilliseconds, omit, packetRequiresOffloading, parseError, parsePacket, prettyPrintPacket, primitiveValueOrflattenedAttributes, runtime, serverWebsocketMessages, stringPatternMatchers, stringifyIO, taskCatalog, taskContext, unflattenAttributes, workerToChildMessages };
3499
3874
  //# sourceMappingURL=out.js.map
3500
3875
  //# sourceMappingURL=index.mjs.map