@trigger.dev/core 0.0.0-prerelease-20250916133650 → 0.0.0-prerelease-20251007140052

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 (61) hide show
  1. package/dist/commonjs/v3/runEngineWorker/supervisor/http.d.ts +5 -0
  2. package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.d.ts +31 -0
  3. package/dist/commonjs/v3/runEngineWorker/workload/http.d.ts +88 -61
  4. package/dist/commonjs/v3/runEngineWorker/workload/http.js +36 -6
  5. package/dist/commonjs/v3/runEngineWorker/workload/http.js.map +1 -1
  6. package/dist/commonjs/v3/runEngineWorker/workload/schemas.d.ts +31 -0
  7. package/dist/commonjs/v3/schemas/api.d.ts +101 -6
  8. package/dist/commonjs/v3/schemas/api.js +13 -3
  9. package/dist/commonjs/v3/schemas/api.js.map +1 -1
  10. package/dist/commonjs/v3/schemas/openTelemetry.d.ts +183 -0
  11. package/dist/commonjs/v3/schemas/openTelemetry.js +20 -2
  12. package/dist/commonjs/v3/schemas/openTelemetry.js.map +1 -1
  13. package/dist/commonjs/v3/schemas/runEngine.d.ts +25 -0
  14. package/dist/commonjs/v3/schemas/runEngine.js +1 -0
  15. package/dist/commonjs/v3/schemas/runEngine.js.map +1 -1
  16. package/dist/commonjs/v3/semanticInternalAttributes.d.ts +3 -0
  17. package/dist/commonjs/v3/semanticInternalAttributes.js +3 -0
  18. package/dist/commonjs/v3/semanticInternalAttributes.js.map +1 -1
  19. package/dist/commonjs/v3/serverOnly/index.d.ts +1 -0
  20. package/dist/commonjs/v3/serverOnly/index.js +1 -0
  21. package/dist/commonjs/v3/serverOnly/index.js.map +1 -1
  22. package/dist/commonjs/v3/serverOnly/resourceMonitor.d.ts +190 -0
  23. package/dist/commonjs/v3/serverOnly/resourceMonitor.js +596 -0
  24. package/dist/commonjs/v3/serverOnly/resourceMonitor.js.map +1 -0
  25. package/dist/commonjs/v3/utils/flattenAttributes.d.ts +1 -1
  26. package/dist/commonjs/v3/utils/flattenAttributes.js +4 -1
  27. package/dist/commonjs/v3/utils/flattenAttributes.js.map +1 -1
  28. package/dist/commonjs/v3/workers/taskExecutor.js +1 -1
  29. package/dist/commonjs/v3/workers/taskExecutor.js.map +1 -1
  30. package/dist/commonjs/version.js +1 -1
  31. package/dist/esm/v3/runEngineWorker/supervisor/http.d.ts +5 -0
  32. package/dist/esm/v3/runEngineWorker/supervisor/schemas.d.ts +31 -0
  33. package/dist/esm/v3/runEngineWorker/workload/http.d.ts +88 -61
  34. package/dist/esm/v3/runEngineWorker/workload/http.js +36 -6
  35. package/dist/esm/v3/runEngineWorker/workload/http.js.map +1 -1
  36. package/dist/esm/v3/runEngineWorker/workload/schemas.d.ts +31 -0
  37. package/dist/esm/v3/schemas/api.d.ts +101 -6
  38. package/dist/esm/v3/schemas/api.js +10 -0
  39. package/dist/esm/v3/schemas/api.js.map +1 -1
  40. package/dist/esm/v3/schemas/openTelemetry.d.ts +183 -0
  41. package/dist/esm/v3/schemas/openTelemetry.js +18 -1
  42. package/dist/esm/v3/schemas/openTelemetry.js.map +1 -1
  43. package/dist/esm/v3/schemas/runEngine.d.ts +25 -0
  44. package/dist/esm/v3/schemas/runEngine.js +1 -0
  45. package/dist/esm/v3/schemas/runEngine.js.map +1 -1
  46. package/dist/esm/v3/semanticInternalAttributes.d.ts +3 -0
  47. package/dist/esm/v3/semanticInternalAttributes.js +3 -0
  48. package/dist/esm/v3/semanticInternalAttributes.js.map +1 -1
  49. package/dist/esm/v3/serverOnly/index.d.ts +1 -0
  50. package/dist/esm/v3/serverOnly/index.js +1 -0
  51. package/dist/esm/v3/serverOnly/index.js.map +1 -1
  52. package/dist/esm/v3/serverOnly/resourceMonitor.d.ts +190 -0
  53. package/dist/esm/v3/serverOnly/resourceMonitor.js +589 -0
  54. package/dist/esm/v3/serverOnly/resourceMonitor.js.map +1 -0
  55. package/dist/esm/v3/utils/flattenAttributes.d.ts +1 -1
  56. package/dist/esm/v3/utils/flattenAttributes.js +4 -1
  57. package/dist/esm/v3/utils/flattenAttributes.js.map +1 -1
  58. package/dist/esm/v3/workers/taskExecutor.js +1 -1
  59. package/dist/esm/v3/workers/taskExecutor.js.map +1 -1
  60. package/dist/esm/version.js +1 -1
  61. package/package.json +2 -2
@@ -193,6 +193,7 @@ export declare class SupervisorHttpClient {
193
193
  id: string;
194
194
  friendlyId: string;
195
195
  attemptNumber?: number | null | undefined;
196
+ taskEventStore?: string | undefined;
196
197
  };
197
198
  snapshot: {
198
199
  id: string;
@@ -318,6 +319,7 @@ export declare class SupervisorHttpClient {
318
319
  id: string;
319
320
  friendlyId: string;
320
321
  attemptNumber?: number | null | undefined;
322
+ taskEventStore?: string | undefined;
321
323
  };
322
324
  snapshot: {
323
325
  id: string;
@@ -336,6 +338,7 @@ export declare class SupervisorHttpClient {
336
338
  id: string;
337
339
  friendlyId: string;
338
340
  attemptNumber?: number | null | undefined;
341
+ taskEventStore?: string | undefined;
339
342
  };
340
343
  snapshot: {
341
344
  id: string;
@@ -390,6 +393,7 @@ export declare class SupervisorHttpClient {
390
393
  id: string;
391
394
  friendlyId: string;
392
395
  attemptNumber?: number | null | undefined;
396
+ taskEventStore?: string | undefined;
393
397
  };
394
398
  snapshot: {
395
399
  id: string;
@@ -443,6 +447,7 @@ export declare class SupervisorHttpClient {
443
447
  id: string;
444
448
  friendlyId: string;
445
449
  attemptNumber?: number | null | undefined;
450
+ taskEventStore?: string | undefined;
446
451
  };
447
452
  snapshot: {
448
453
  id: string;
@@ -129,16 +129,19 @@ export declare const WorkerApiContinueRunExecutionRequestBody: z.ZodObject<{
129
129
  friendlyId: z.ZodString;
130
130
  status: z.ZodEnum<[import("../../schemas/runEngine.js").TaskRunStatus]>;
131
131
  attemptNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
132
+ taskEventStore: z.ZodOptional<z.ZodString>;
132
133
  }, "strip", z.ZodTypeAny, {
133
134
  status: import("../../schemas/runEngine.js").TaskRunStatus;
134
135
  id: string;
135
136
  friendlyId: string;
136
137
  attemptNumber?: number | null | undefined;
138
+ taskEventStore?: string | undefined;
137
139
  }, {
138
140
  status: import("../../schemas/runEngine.js").TaskRunStatus;
139
141
  id: string;
140
142
  friendlyId: string;
141
143
  attemptNumber?: number | null | undefined;
144
+ taskEventStore?: string | undefined;
142
145
  }>;
143
146
  }, "strip", z.ZodTypeAny, {
144
147
  run: {
@@ -146,6 +149,7 @@ export declare const WorkerApiContinueRunExecutionRequestBody: z.ZodObject<{
146
149
  id: string;
147
150
  friendlyId: string;
148
151
  attemptNumber?: number | null | undefined;
152
+ taskEventStore?: string | undefined;
149
153
  };
150
154
  snapshot: {
151
155
  id: string;
@@ -160,6 +164,7 @@ export declare const WorkerApiContinueRunExecutionRequestBody: z.ZodObject<{
160
164
  id: string;
161
165
  friendlyId: string;
162
166
  attemptNumber?: number | null | undefined;
167
+ taskEventStore?: string | undefined;
163
168
  };
164
169
  snapshot: {
165
170
  id: string;
@@ -695,16 +700,19 @@ export declare const WorkerApiRunAttemptStartResponseBody: z.ZodIntersection<z.Z
695
700
  friendlyId: z.ZodString;
696
701
  status: z.ZodEnum<[import("../../schemas/runEngine.js").TaskRunStatus]>;
697
702
  attemptNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
703
+ taskEventStore: z.ZodOptional<z.ZodString>;
698
704
  }, "strip", z.ZodTypeAny, {
699
705
  status: import("../../schemas/runEngine.js").TaskRunStatus;
700
706
  id: string;
701
707
  friendlyId: string;
702
708
  attemptNumber?: number | null | undefined;
709
+ taskEventStore?: string | undefined;
703
710
  }, {
704
711
  status: import("../../schemas/runEngine.js").TaskRunStatus;
705
712
  id: string;
706
713
  friendlyId: string;
707
714
  attemptNumber?: number | null | undefined;
715
+ taskEventStore?: string | undefined;
708
716
  }>;
709
717
  }, "strip", z.ZodTypeAny, {
710
718
  run: {
@@ -712,6 +720,7 @@ export declare const WorkerApiRunAttemptStartResponseBody: z.ZodIntersection<z.Z
712
720
  id: string;
713
721
  friendlyId: string;
714
722
  attemptNumber?: number | null | undefined;
723
+ taskEventStore?: string | undefined;
715
724
  };
716
725
  snapshot: {
717
726
  id: string;
@@ -726,6 +735,7 @@ export declare const WorkerApiRunAttemptStartResponseBody: z.ZodIntersection<z.Z
726
735
  id: string;
727
736
  friendlyId: string;
728
737
  attemptNumber?: number | null | undefined;
738
+ taskEventStore?: string | undefined;
729
739
  };
730
740
  snapshot: {
731
741
  id: string;
@@ -3094,16 +3104,19 @@ export declare const WorkerApiRunAttemptCompleteResponseBody: z.ZodObject<{
3094
3104
  friendlyId: z.ZodString;
3095
3105
  status: z.ZodEnum<[import("../../schemas/runEngine.js").TaskRunStatus]>;
3096
3106
  attemptNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
3107
+ taskEventStore: z.ZodOptional<z.ZodString>;
3097
3108
  }, "strip", z.ZodTypeAny, {
3098
3109
  status: import("../../schemas/runEngine.js").TaskRunStatus;
3099
3110
  id: string;
3100
3111
  friendlyId: string;
3101
3112
  attemptNumber?: number | null | undefined;
3113
+ taskEventStore?: string | undefined;
3102
3114
  }, {
3103
3115
  status: import("../../schemas/runEngine.js").TaskRunStatus;
3104
3116
  id: string;
3105
3117
  friendlyId: string;
3106
3118
  attemptNumber?: number | null | undefined;
3119
+ taskEventStore?: string | undefined;
3107
3120
  }>;
3108
3121
  }, "strip", z.ZodTypeAny, {
3109
3122
  run: {
@@ -3111,6 +3124,7 @@ export declare const WorkerApiRunAttemptCompleteResponseBody: z.ZodObject<{
3111
3124
  id: string;
3112
3125
  friendlyId: string;
3113
3126
  attemptNumber?: number | null | undefined;
3127
+ taskEventStore?: string | undefined;
3114
3128
  };
3115
3129
  snapshot: {
3116
3130
  id: string;
@@ -3125,6 +3139,7 @@ export declare const WorkerApiRunAttemptCompleteResponseBody: z.ZodObject<{
3125
3139
  id: string;
3126
3140
  friendlyId: string;
3127
3141
  attemptNumber?: number | null | undefined;
3142
+ taskEventStore?: string | undefined;
3128
3143
  };
3129
3144
  snapshot: {
3130
3145
  id: string;
@@ -3143,6 +3158,7 @@ export declare const WorkerApiRunAttemptCompleteResponseBody: z.ZodObject<{
3143
3158
  id: string;
3144
3159
  friendlyId: string;
3145
3160
  attemptNumber?: number | null | undefined;
3161
+ taskEventStore?: string | undefined;
3146
3162
  };
3147
3163
  snapshot: {
3148
3164
  id: string;
@@ -3161,6 +3177,7 @@ export declare const WorkerApiRunAttemptCompleteResponseBody: z.ZodObject<{
3161
3177
  id: string;
3162
3178
  friendlyId: string;
3163
3179
  attemptNumber?: number | null | undefined;
3180
+ taskEventStore?: string | undefined;
3164
3181
  };
3165
3182
  snapshot: {
3166
3183
  id: string;
@@ -3199,16 +3216,19 @@ export declare const WorkerApiRunLatestSnapshotResponseBody: z.ZodObject<{
3199
3216
  friendlyId: z.ZodString;
3200
3217
  status: z.ZodEnum<[import("../../schemas/runEngine.js").TaskRunStatus]>;
3201
3218
  attemptNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
3219
+ taskEventStore: z.ZodOptional<z.ZodString>;
3202
3220
  }, "strip", z.ZodTypeAny, {
3203
3221
  status: import("../../schemas/runEngine.js").TaskRunStatus;
3204
3222
  id: string;
3205
3223
  friendlyId: string;
3206
3224
  attemptNumber?: number | null | undefined;
3225
+ taskEventStore?: string | undefined;
3207
3226
  }, {
3208
3227
  status: import("../../schemas/runEngine.js").TaskRunStatus;
3209
3228
  id: string;
3210
3229
  friendlyId: string;
3211
3230
  attemptNumber?: number | null | undefined;
3231
+ taskEventStore?: string | undefined;
3212
3232
  }>;
3213
3233
  batch: z.ZodOptional<z.ZodObject<{
3214
3234
  id: z.ZodString;
@@ -3346,6 +3366,7 @@ export declare const WorkerApiRunLatestSnapshotResponseBody: z.ZodObject<{
3346
3366
  id: string;
3347
3367
  friendlyId: string;
3348
3368
  attemptNumber?: number | null | undefined;
3369
+ taskEventStore?: string | undefined;
3349
3370
  };
3350
3371
  snapshot: {
3351
3372
  id: string;
@@ -3397,6 +3418,7 @@ export declare const WorkerApiRunLatestSnapshotResponseBody: z.ZodObject<{
3397
3418
  id: string;
3398
3419
  friendlyId: string;
3399
3420
  attemptNumber?: number | null | undefined;
3421
+ taskEventStore?: string | undefined;
3400
3422
  };
3401
3423
  snapshot: {
3402
3424
  id: string;
@@ -3450,6 +3472,7 @@ export declare const WorkerApiRunLatestSnapshotResponseBody: z.ZodObject<{
3450
3472
  id: string;
3451
3473
  friendlyId: string;
3452
3474
  attemptNumber?: number | null | undefined;
3475
+ taskEventStore?: string | undefined;
3453
3476
  };
3454
3477
  snapshot: {
3455
3478
  id: string;
@@ -3503,6 +3526,7 @@ export declare const WorkerApiRunLatestSnapshotResponseBody: z.ZodObject<{
3503
3526
  id: string;
3504
3527
  friendlyId: string;
3505
3528
  attemptNumber?: number | null | undefined;
3529
+ taskEventStore?: string | undefined;
3506
3530
  };
3507
3531
  snapshot: {
3508
3532
  id: string;
@@ -4034,16 +4058,19 @@ export declare const WorkerApiRunSnapshotsSinceResponseBody: z.ZodObject<{
4034
4058
  friendlyId: z.ZodString;
4035
4059
  status: z.ZodEnum<[import("../../schemas/runEngine.js").TaskRunStatus]>;
4036
4060
  attemptNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
4061
+ taskEventStore: z.ZodOptional<z.ZodString>;
4037
4062
  }, "strip", z.ZodTypeAny, {
4038
4063
  status: import("../../schemas/runEngine.js").TaskRunStatus;
4039
4064
  id: string;
4040
4065
  friendlyId: string;
4041
4066
  attemptNumber?: number | null | undefined;
4067
+ taskEventStore?: string | undefined;
4042
4068
  }, {
4043
4069
  status: import("../../schemas/runEngine.js").TaskRunStatus;
4044
4070
  id: string;
4045
4071
  friendlyId: string;
4046
4072
  attemptNumber?: number | null | undefined;
4073
+ taskEventStore?: string | undefined;
4047
4074
  }>;
4048
4075
  batch: z.ZodOptional<z.ZodObject<{
4049
4076
  id: z.ZodString;
@@ -4181,6 +4208,7 @@ export declare const WorkerApiRunSnapshotsSinceResponseBody: z.ZodObject<{
4181
4208
  id: string;
4182
4209
  friendlyId: string;
4183
4210
  attemptNumber?: number | null | undefined;
4211
+ taskEventStore?: string | undefined;
4184
4212
  };
4185
4213
  snapshot: {
4186
4214
  id: string;
@@ -4232,6 +4260,7 @@ export declare const WorkerApiRunSnapshotsSinceResponseBody: z.ZodObject<{
4232
4260
  id: string;
4233
4261
  friendlyId: string;
4234
4262
  attemptNumber?: number | null | undefined;
4263
+ taskEventStore?: string | undefined;
4235
4264
  };
4236
4265
  snapshot: {
4237
4266
  id: string;
@@ -4285,6 +4314,7 @@ export declare const WorkerApiRunSnapshotsSinceResponseBody: z.ZodObject<{
4285
4314
  id: string;
4286
4315
  friendlyId: string;
4287
4316
  attemptNumber?: number | null | undefined;
4317
+ taskEventStore?: string | undefined;
4288
4318
  };
4289
4319
  snapshot: {
4290
4320
  id: string;
@@ -4338,6 +4368,7 @@ export declare const WorkerApiRunSnapshotsSinceResponseBody: z.ZodObject<{
4338
4368
  id: string;
4339
4369
  friendlyId: string;
4340
4370
  attemptNumber?: number | null | undefined;
4371
+ taskEventStore?: string | undefined;
4341
4372
  };
4342
4373
  snapshot: {
4343
4374
  id: string;
@@ -10,36 +10,54 @@ export declare class WorkloadHttpClient {
10
10
  updateApiUrl(apiUrl: string): void;
11
11
  updateRunnerId(runnerId: string): void;
12
12
  defaultHeaders(): Record<string, string>;
13
- heartbeatRun(runId: string, snapshotId: string, body?: WorkloadHeartbeatRequestBody): Promise<import("../../zodfetch.js").ApiResult<{
14
- ok: true;
15
- }>>;
13
+ private isConnectionError;
14
+ private withConnectionErrorDetection;
15
+ heartbeatRun(runId: string, snapshotId: string, body?: WorkloadHeartbeatRequestBody): Promise<{
16
+ success: false;
17
+ error: string;
18
+ isConnectionError?: boolean;
19
+ } | {
20
+ success: true;
21
+ data: {
22
+ ok: true;
23
+ };
24
+ }>;
16
25
  suspendRun(runId: string, snapshotId: string): Promise<import("../../zodfetch.js").ApiResult<{
17
26
  ok: true;
18
27
  } | {
19
28
  error: string;
20
29
  ok: false;
21
30
  }>>;
22
- continueRunExecution(runId: string, snapshotId: string): Promise<import("../../zodfetch.js").ApiResult<{
23
- run: {
24
- status: import("../../index.js").TaskRunStatus;
25
- id: string;
26
- friendlyId: string;
27
- attemptNumber?: number | null | undefined;
28
- };
29
- snapshot: {
30
- id: string;
31
- createdAt: Date;
32
- description: string;
33
- friendlyId: string;
34
- executionStatus: import("../../index.js").TaskRunExecutionStatus;
31
+ continueRunExecution(runId: string, snapshotId: string): Promise<{
32
+ success: false;
33
+ error: string;
34
+ isConnectionError?: boolean;
35
+ } | {
36
+ success: true;
37
+ data: {
38
+ run: {
39
+ status: import("../../index.js").TaskRunStatus;
40
+ id: string;
41
+ friendlyId: string;
42
+ attemptNumber?: number | null | undefined;
43
+ taskEventStore?: string | undefined;
44
+ };
45
+ snapshot: {
46
+ id: string;
47
+ createdAt: Date;
48
+ description: string;
49
+ friendlyId: string;
50
+ executionStatus: import("../../index.js").TaskRunExecutionStatus;
51
+ };
35
52
  };
36
- }>>;
53
+ }>;
37
54
  startRunAttempt(runId: string, snapshotId: string, body: WorkloadRunAttemptStartRequestBody): Promise<import("../../zodfetch.js").ApiResult<{
38
55
  run: {
39
56
  status: import("../../index.js").TaskRunStatus;
40
57
  id: string;
41
58
  friendlyId: string;
42
59
  attemptNumber?: number | null | undefined;
60
+ taskEventStore?: string | undefined;
43
61
  };
44
62
  snapshot: {
45
63
  id: string;
@@ -165,6 +183,7 @@ export declare class WorkloadHttpClient {
165
183
  id: string;
166
184
  friendlyId: string;
167
185
  attemptNumber?: number | null | undefined;
186
+ taskEventStore?: string | undefined;
168
187
  };
169
188
  snapshot: {
170
189
  id: string;
@@ -175,60 +194,68 @@ export declare class WorkloadHttpClient {
175
194
  };
176
195
  };
177
196
  }>>;
178
- getSnapshotsSince(runId: string, snapshotId: string): Promise<import("../../zodfetch.js").ApiResult<{
179
- snapshots: {
180
- version: "1";
181
- run: {
182
- status: import("../../index.js").TaskRunStatus;
183
- id: string;
184
- friendlyId: string;
185
- attemptNumber?: number | null | undefined;
186
- };
187
- snapshot: {
188
- id: string;
189
- createdAt: Date;
190
- description: string;
191
- friendlyId: string;
192
- executionStatus: import("../../index.js").TaskRunExecutionStatus;
193
- };
194
- completedWaitpoints: {
195
- type: import("../../index.js").WaitpointType;
196
- id: string;
197
- friendlyId: string;
198
- completedAt: Date;
199
- outputIsError: boolean;
200
- idempotencyKey?: string | undefined;
201
- output?: string | undefined;
202
- outputType?: string | undefined;
203
- index?: number | undefined;
204
- completedByTaskRun?: {
197
+ getSnapshotsSince(runId: string, snapshotId: string): Promise<{
198
+ success: false;
199
+ error: string;
200
+ isConnectionError?: boolean;
201
+ } | {
202
+ success: true;
203
+ data: {
204
+ snapshots: {
205
+ version: "1";
206
+ run: {
207
+ status: import("../../index.js").TaskRunStatus;
208
+ id: string;
209
+ friendlyId: string;
210
+ attemptNumber?: number | null | undefined;
211
+ taskEventStore?: string | undefined;
212
+ };
213
+ snapshot: {
205
214
  id: string;
215
+ createdAt: Date;
216
+ description: string;
206
217
  friendlyId: string;
207
- batch?: {
218
+ executionStatus: import("../../index.js").TaskRunExecutionStatus;
219
+ };
220
+ completedWaitpoints: {
221
+ type: import("../../index.js").WaitpointType;
222
+ id: string;
223
+ friendlyId: string;
224
+ completedAt: Date;
225
+ outputIsError: boolean;
226
+ idempotencyKey?: string | undefined;
227
+ output?: string | undefined;
228
+ outputType?: string | undefined;
229
+ index?: number | undefined;
230
+ completedByTaskRun?: {
208
231
  id: string;
209
232
  friendlyId: string;
233
+ batch?: {
234
+ id: string;
235
+ friendlyId: string;
236
+ } | undefined;
210
237
  } | undefined;
238
+ completedAfter?: Date | undefined;
239
+ completedByBatch?: {
240
+ id: string;
241
+ friendlyId: string;
242
+ } | undefined;
243
+ }[];
244
+ batch?: {
245
+ id: string;
246
+ friendlyId: string;
211
247
  } | undefined;
212
- completedAfter?: Date | undefined;
213
- completedByBatch?: {
248
+ checkpoint?: {
249
+ type: import("../../index.js").CheckpointTypeEnum;
214
250
  id: string;
215
251
  friendlyId: string;
252
+ location: string;
253
+ imageRef?: string | null | undefined;
254
+ reason?: string | null | undefined;
216
255
  } | undefined;
217
256
  }[];
218
- batch?: {
219
- id: string;
220
- friendlyId: string;
221
- } | undefined;
222
- checkpoint?: {
223
- type: import("../../index.js").CheckpointTypeEnum;
224
- id: string;
225
- friendlyId: string;
226
- location: string;
227
- imageRef?: string | null | undefined;
228
- reason?: string | null | undefined;
229
- } | undefined;
230
- }[];
231
- }>>;
257
+ };
258
+ }>;
232
259
  sendDebugLog(runId: string, body: WorkloadDebugLogRequestBody): Promise<void>;
233
260
  /** @deprecated Not currently used */
234
261
  dequeue(): Promise<import("../../zodfetch.js").ApiResult<{
@@ -34,15 +34,44 @@ class WorkloadHttpClient {
34
34
  runnerId: this.runnerId,
35
35
  });
36
36
  }
37
+ isConnectionError(error) {
38
+ const connectionErrors = [
39
+ "Connection error",
40
+ "ECONNREFUSED",
41
+ "ETIMEDOUT",
42
+ "ENOTFOUND",
43
+ "ECONNRESET",
44
+ "EHOSTUNREACH",
45
+ "ENETUNREACH",
46
+ "EPIPE",
47
+ "ECONNABORTED",
48
+ ];
49
+ return connectionErrors.some((errType) => error.includes(errType));
50
+ }
51
+ async withConnectionErrorDetection(operation) {
52
+ const result = await operation();
53
+ if (result.success) {
54
+ return result;
55
+ }
56
+ // Check if this is a connection error
57
+ if (this.isConnectionError(result.error)) {
58
+ return {
59
+ ...result,
60
+ isConnectionError: true,
61
+ };
62
+ }
63
+ return result;
64
+ }
37
65
  async heartbeatRun(runId, snapshotId, body) {
38
- return (0, zodfetch_js_1.wrapZodFetch)(schemas_js_1.WorkloadHeartbeatResponseBody, `${this.apiUrl}/api/v1/workload-actions/runs/${runId}/snapshots/${snapshotId}/heartbeat`, {
66
+ return this.withConnectionErrorDetection(() => (0, zodfetch_js_1.wrapZodFetch)(schemas_js_1.WorkloadHeartbeatResponseBody, `${this.apiUrl}/api/v1/workload-actions/runs/${runId}/snapshots/${snapshotId}/heartbeat`, {
39
67
  method: "POST",
40
68
  headers: {
41
69
  ...this.defaultHeaders(),
42
70
  "Content-Type": "application/json",
43
71
  },
44
72
  body: JSON.stringify(body ?? {}),
45
- });
73
+ signal: AbortSignal.timeout(10_000), // 10 second timeout
74
+ }));
46
75
  }
47
76
  async suspendRun(runId, snapshotId) {
48
77
  return (0, zodfetch_js_1.wrapZodFetch)(schemas_js_1.WorkloadSuspendRunResponseBody, `${this.apiUrl}/api/v1/workload-actions/runs/${runId}/snapshots/${snapshotId}/suspend`, {
@@ -53,12 +82,12 @@ class WorkloadHttpClient {
53
82
  });
54
83
  }
55
84
  async continueRunExecution(runId, snapshotId) {
56
- return (0, zodfetch_js_1.wrapZodFetch)(schemas_js_1.WorkloadContinueRunExecutionResponseBody, `${this.apiUrl}/api/v1/workload-actions/runs/${runId}/snapshots/${snapshotId}/continue`, {
85
+ return this.withConnectionErrorDetection(() => (0, zodfetch_js_1.wrapZodFetch)(schemas_js_1.WorkloadContinueRunExecutionResponseBody, `${this.apiUrl}/api/v1/workload-actions/runs/${runId}/snapshots/${snapshotId}/continue`, {
57
86
  method: "GET",
58
87
  headers: {
59
88
  ...this.defaultHeaders(),
60
89
  },
61
- });
90
+ }));
62
91
  }
63
92
  async startRunAttempt(runId, snapshotId, body) {
64
93
  return (0, zodfetch_js_1.wrapZodFetch)(schemas_js_1.WorkloadRunAttemptStartResponseBody, `${this.apiUrl}/api/v1/workload-actions/runs/${runId}/snapshots/${snapshotId}/attempts/start`, {
@@ -79,12 +108,13 @@ class WorkloadHttpClient {
79
108
  });
80
109
  }
81
110
  async getSnapshotsSince(runId, snapshotId) {
82
- return (0, zodfetch_js_1.wrapZodFetch)(schemas_js_1.WorkloadRunSnapshotsSinceResponseBody, `${this.apiUrl}/api/v1/workload-actions/runs/${runId}/snapshots/since/${snapshotId}`, {
111
+ return this.withConnectionErrorDetection(() => (0, zodfetch_js_1.wrapZodFetch)(schemas_js_1.WorkloadRunSnapshotsSinceResponseBody, `${this.apiUrl}/api/v1/workload-actions/runs/${runId}/snapshots/since/${snapshotId}`, {
83
112
  method: "GET",
84
113
  headers: {
85
114
  ...this.defaultHeaders(),
86
115
  },
87
- });
116
+ signal: AbortSignal.timeout(10_000), // 10 second timeout
117
+ }));
88
118
  }
89
119
  async sendDebugLog(runId, body) {
90
120
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../../../../src/v3/runEngineWorker/workload/http.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,6CAYsB;AAEtB,uCAAsD;AACtD,mDAAiD;AAIjD,MAAa,kBAAkB;IAKT;IAJZ,MAAM,CAAS;IACf,QAAQ,CAAS;IACR,YAAY,CAAS;IAEtC,YAAoB,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;QACjD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE9B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC3E,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAED,YAAY,CAAC,MAAc;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,cAAc,CAAC,QAAgB;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,cAAc;QACZ,OAAO,IAAA,mCAAyB,EAAC;YAC/B,GAAG,IAAI,CAAC,IAAI;YACZ,QAAQ,EAAE,I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