@trigger.dev/core 3.0.0-beta.37 → 3.0.0-beta.38

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 (37) hide show
  1. package/dist/{catalog-dRKTgwQ7.d.ts → catalog-Tdea4K0I.d.mts} +43 -3
  2. package/dist/{catalog-XTlJQaMn.d.mts → catalog-yeAHwmSe.d.ts} +43 -3
  3. package/dist/{manager-JkbddlcO.d.mts → manager-S98VaLUy.d.mts} +244 -1
  4. package/dist/{manager-JkbddlcO.d.ts → manager-S98VaLUy.d.ts} +244 -1
  5. package/dist/{messages-9lty-Du5.d.mts → messages-BD0yXLtn.d.mts} +2370 -141
  6. package/dist/{messages-9lty-Du5.d.ts → messages-BD0yXLtn.d.ts} +2370 -141
  7. package/dist/{schemas-r4ZP9S-F.d.mts → schemas-XNxZYXOy.d.mts} +199 -33
  8. package/dist/{schemas-r4ZP9S-F.d.ts → schemas-XNxZYXOy.d.ts} +199 -33
  9. package/dist/v3/dev/index.d.mts +1 -1
  10. package/dist/v3/dev/index.d.ts +1 -1
  11. package/dist/v3/index.d.mts +117 -52
  12. package/dist/v3/index.d.ts +117 -52
  13. package/dist/v3/index.js +204 -58
  14. package/dist/v3/index.js.map +1 -1
  15. package/dist/v3/index.mjs +199 -58
  16. package/dist/v3/index.mjs.map +1 -1
  17. package/dist/v3/otel/index.js +15 -5
  18. package/dist/v3/otel/index.js.map +1 -1
  19. package/dist/v3/otel/index.mjs +15 -5
  20. package/dist/v3/otel/index.mjs.map +1 -1
  21. package/dist/v3/prod/index.d.mts +2 -2
  22. package/dist/v3/prod/index.d.ts +2 -2
  23. package/dist/v3/prod/index.js.map +1 -1
  24. package/dist/v3/prod/index.mjs.map +1 -1
  25. package/dist/v3/workers/index.d.mts +54 -8
  26. package/dist/v3/workers/index.d.ts +54 -8
  27. package/dist/v3/workers/index.js +404 -43
  28. package/dist/v3/workers/index.js.map +1 -1
  29. package/dist/v3/workers/index.mjs +402 -44
  30. package/dist/v3/workers/index.mjs.map +1 -1
  31. package/dist/v3/zodIpc.js.map +1 -1
  32. package/dist/v3/zodIpc.mjs.map +1 -1
  33. package/dist/v3/zodMessageHandler.d.mts +1 -1
  34. package/dist/v3/zodMessageHandler.d.ts +1 -1
  35. package/dist/v3/zodfetch.d.mts +1 -1
  36. package/dist/v3/zodfetch.d.ts +1 -1
  37. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { Context as Context$1, Span, SpanOptions, Tracer } from '@opentelemetry/api';
2
2
  import { Logger } from '@opentelemetry/api-logs';
3
- import { R as RetryOptions, P as Prettify, b as TaskMetadata, T as TaskFileMetadata, a as TaskMetadataWithFilePath } from './schemas-r4ZP9S-F.js';
3
+ import { M as MachinePresetName, a as TaskRunContext } from './manager-S98VaLUy.mjs';
4
+ import { R as RetryOptions, P as Prettify, b as TaskMetadata, T as TaskFileMetadata, a as TaskMetadataWithFilePath } from './schemas-XNxZYXOy.mjs';
4
5
  import { InstrumentationOption } from '@opentelemetry/instrumentation';
5
- import { a as TaskRunContext } from './manager-JkbddlcO.js';
6
6
 
7
7
  type TriggerTracerConfig = {
8
8
  name: string;
@@ -60,6 +60,11 @@ interface ProjectConfig {
60
60
  default?: RetryOptions;
61
61
  };
62
62
  additionalPackages?: string[];
63
+ /**
64
+ * The default machine preset to use for your deployed trigger.dev tasks. You can override this on a per-task basis.
65
+ * @default "small-1x"
66
+ */
67
+ machine?: MachinePresetName;
63
68
  /**
64
69
  * List of additional files to include in your trigger.dev bundle. e.g. ["./prisma/schema.prisma"]
65
70
  *
@@ -183,12 +188,47 @@ type TaskMetadataWithFunctions = TaskMetadata & {
183
188
  };
184
189
  };
185
190
 
191
+ /**
192
+ * Contains two parts: the first part is the seconds, the second part is the nanoseconds.
193
+ *
194
+ */
186
195
  type ClockTime = [number, number];
187
196
  interface Clock {
188
197
  preciseNow(): ClockTime;
189
198
  reset(): void;
190
199
  }
191
200
 
201
+ type UsageSample = {
202
+ cpuTime: number;
203
+ wallTime: number;
204
+ };
205
+ interface UsageMeasurement {
206
+ sample(): UsageSample;
207
+ }
208
+ interface UsageManager {
209
+ disable(): void;
210
+ start(): UsageMeasurement;
211
+ stop(measurement: UsageMeasurement): UsageSample;
212
+ sample(): UsageSample | undefined;
213
+ pauseAsync<T>(cb: () => Promise<T>): Promise<T>;
214
+ }
215
+
216
+ declare class UsageAPI implements UsageManager {
217
+ #private;
218
+ private static _instance?;
219
+ private constructor();
220
+ static getInstance(): UsageAPI;
221
+ setGlobalUsageManager(manager: UsageManager): boolean;
222
+ disable(): void;
223
+ start(): UsageMeasurement;
224
+ stop(measurement: UsageMeasurement): UsageSample;
225
+ pauseAsync<T>(cb: () => Promise<T>): Promise<T>;
226
+ sample(): UsageSample | undefined;
227
+ }
228
+
229
+ /** Entrypoint for usage API */
230
+ declare const usage: UsageAPI;
231
+
192
232
  interface TaskCatalog {
193
233
  registerTaskMetadata(task: TaskMetadataWithFunctions): void;
194
234
  updateTaskMetadata(id: string, task: Partial<TaskMetadataWithFunctions>): void;
@@ -199,4 +239,4 @@ interface TaskCatalog {
199
239
  taskExists(id: string): boolean;
200
240
  }
201
241
 
202
- export { type Clock as C, type FailureFnParams as F, type HandleErrorFunction as H, type InitOutput as I, type LogLevel as L, type MiddlewareFnParams as M, OtelTaskLogger as O, type ProjectConfig as P, type RunFnParams as R, type StartFnParams as S, TriggerTracer as T, type TaskMetadataWithFunctions as a, type ClockTime as b, type TaskCatalog as c, type TaskLogger as d, type InitFnParams as e, type Context as f, type SuccessFnParams as g, type HandleErrorFnParams as h, type HandleErrorModificationOptions as i, type HandleErrorResult as j, type HandleErrorArgs as k, logLevels as l, type ResolveEnvironmentVariablesResult as m, type ResolveEnvironmentVariablesParams as n, type ResolveEnvironmentVariablesFunction as o };
242
+ export { type Clock as C, type FailureFnParams as F, type HandleErrorFunction as H, type InitOutput as I, type LogLevel as L, type MiddlewareFnParams as M, OtelTaskLogger as O, type ProjectConfig as P, type RunFnParams as R, type StartFnParams as S, TriggerTracer as T, type UsageMeasurement as U, type TaskMetadataWithFunctions as a, type ClockTime as b, type TaskCatalog as c, type UsageManager as d, type UsageSample as e, type TaskLogger as f, type InitFnParams as g, type Context as h, type SuccessFnParams as i, type HandleErrorFnParams as j, type HandleErrorModificationOptions as k, logLevels as l, type HandleErrorResult as m, type HandleErrorArgs as n, type ResolveEnvironmentVariablesResult as o, type ResolveEnvironmentVariablesParams as p, type ResolveEnvironmentVariablesFunction as q, usage as u };
@@ -1,8 +1,8 @@
1
1
  import { Context as Context$1, Span, SpanOptions, Tracer } from '@opentelemetry/api';
2
2
  import { Logger } from '@opentelemetry/api-logs';
3
- import { R as RetryOptions, P as Prettify, b as TaskMetadata, T as TaskFileMetadata, a as TaskMetadataWithFilePath } from './schemas-r4ZP9S-F.mjs';
3
+ import { M as MachinePresetName, a as TaskRunContext } from './manager-S98VaLUy.js';
4
+ import { R as RetryOptions, P as Prettify, b as TaskMetadata, T as TaskFileMetadata, a as TaskMetadataWithFilePath } from './schemas-XNxZYXOy.js';
4
5
  import { InstrumentationOption } from '@opentelemetry/instrumentation';
5
- import { a as TaskRunContext } from './manager-JkbddlcO.mjs';
6
6
 
7
7
  type TriggerTracerConfig = {
8
8
  name: string;
@@ -60,6 +60,11 @@ interface ProjectConfig {
60
60
  default?: RetryOptions;
61
61
  };
62
62
  additionalPackages?: string[];
63
+ /**
64
+ * The default machine preset to use for your deployed trigger.dev tasks. You can override this on a per-task basis.
65
+ * @default "small-1x"
66
+ */
67
+ machine?: MachinePresetName;
63
68
  /**
64
69
  * List of additional files to include in your trigger.dev bundle. e.g. ["./prisma/schema.prisma"]
65
70
  *
@@ -183,12 +188,47 @@ type TaskMetadataWithFunctions = TaskMetadata & {
183
188
  };
184
189
  };
185
190
 
191
+ /**
192
+ * Contains two parts: the first part is the seconds, the second part is the nanoseconds.
193
+ *
194
+ */
186
195
  type ClockTime = [number, number];
187
196
  interface Clock {
188
197
  preciseNow(): ClockTime;
189
198
  reset(): void;
190
199
  }
191
200
 
201
+ type UsageSample = {
202
+ cpuTime: number;
203
+ wallTime: number;
204
+ };
205
+ interface UsageMeasurement {
206
+ sample(): UsageSample;
207
+ }
208
+ interface UsageManager {
209
+ disable(): void;
210
+ start(): UsageMeasurement;
211
+ stop(measurement: UsageMeasurement): UsageSample;
212
+ sample(): UsageSample | undefined;
213
+ pauseAsync<T>(cb: () => Promise<T>): Promise<T>;
214
+ }
215
+
216
+ declare class UsageAPI implements UsageManager {
217
+ #private;
218
+ private static _instance?;
219
+ private constructor();
220
+ static getInstance(): UsageAPI;
221
+ setGlobalUsageManager(manager: UsageManager): boolean;
222
+ disable(): void;
223
+ start(): UsageMeasurement;
224
+ stop(measurement: UsageMeasurement): UsageSample;
225
+ pauseAsync<T>(cb: () => Promise<T>): Promise<T>;
226
+ sample(): UsageSample | undefined;
227
+ }
228
+
229
+ /** Entrypoint for usage API */
230
+ declare const usage: UsageAPI;
231
+
192
232
  interface TaskCatalog {
193
233
  registerTaskMetadata(task: TaskMetadataWithFunctions): void;
194
234
  updateTaskMetadata(id: string, task: Partial<TaskMetadataWithFunctions>): void;
@@ -199,4 +239,4 @@ interface TaskCatalog {
199
239
  taskExists(id: string): boolean;
200
240
  }
201
241
 
202
- export { type Clock as C, type FailureFnParams as F, type HandleErrorFunction as H, type InitOutput as I, type LogLevel as L, type MiddlewareFnParams as M, OtelTaskLogger as O, type ProjectConfig as P, type RunFnParams as R, type StartFnParams as S, TriggerTracer as T, type TaskMetadataWithFunctions as a, type ClockTime as b, type TaskCatalog as c, type TaskLogger as d, type InitFnParams as e, type Context as f, type SuccessFnParams as g, type HandleErrorFnParams as h, type HandleErrorModificationOptions as i, type HandleErrorResult as j, type HandleErrorArgs as k, logLevels as l, type ResolveEnvironmentVariablesResult as m, type ResolveEnvironmentVariablesParams as n, type ResolveEnvironmentVariablesFunction as o };
242
+ export { type Clock as C, type FailureFnParams as F, type HandleErrorFunction as H, type InitOutput as I, type LogLevel as L, type MiddlewareFnParams as M, OtelTaskLogger as O, type ProjectConfig as P, type RunFnParams as R, type StartFnParams as S, TriggerTracer as T, type UsageMeasurement as U, type TaskMetadataWithFunctions as a, type ClockTime as b, type TaskCatalog as c, type UsageManager as d, type UsageSample as e, type TaskLogger as f, type InitFnParams as g, type Context as h, type SuccessFnParams as i, type HandleErrorFnParams as j, type HandleErrorModificationOptions as k, logLevels as l, type HandleErrorResult as m, type HandleErrorArgs as n, type ResolveEnvironmentVariablesResult as o, type ResolveEnvironmentVariablesParams as p, type ResolveEnvironmentVariablesFunction as q, usage as u };
@@ -1,5 +1,42 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ declare const MachineCpu: z.ZodUnion<[z.ZodLiteral<0.25>, z.ZodLiteral<0.5>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>]>;
4
+ type MachineCpu = z.infer<typeof MachineCpu>;
5
+ declare const MachineMemory: z.ZodUnion<[z.ZodLiteral<0.25>, z.ZodLiteral<0.5>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>]>;
6
+ type MachineMemory = z.infer<typeof MachineMemory>;
7
+ declare const MachinePresetName: z.ZodEnum<["micro", "small-1x", "small-2x", "medium-1x", "medium-2x", "large-1x", "large-2x"]>;
8
+ type MachinePresetName = z.infer<typeof MachinePresetName>;
9
+ declare const MachineConfig: z.ZodObject<{
10
+ cpu: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0.25>, z.ZodLiteral<0.5>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>]>>;
11
+ memory: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0.25>, z.ZodLiteral<0.5>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>]>>;
12
+ preset: z.ZodOptional<z.ZodEnum<["micro", "small-1x", "small-2x", "medium-1x", "medium-2x", "large-1x", "large-2x"]>>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ cpu?: 2 | 1 | 4 | 0.25 | 0.5 | undefined;
15
+ memory?: 2 | 1 | 4 | 0.25 | 0.5 | 8 | undefined;
16
+ preset?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
17
+ }, {
18
+ cpu?: 2 | 1 | 4 | 0.25 | 0.5 | undefined;
19
+ memory?: 2 | 1 | 4 | 0.25 | 0.5 | 8 | undefined;
20
+ preset?: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x" | undefined;
21
+ }>;
22
+ type MachineConfig = z.infer<typeof MachineConfig>;
23
+ declare const MachinePreset: z.ZodObject<{
24
+ name: z.ZodEnum<["micro", "small-1x", "small-2x", "medium-1x", "medium-2x", "large-1x", "large-2x"]>;
25
+ cpu: z.ZodNumber;
26
+ memory: z.ZodNumber;
27
+ centsPerMs: z.ZodNumber;
28
+ }, "strip", z.ZodTypeAny, {
29
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
30
+ cpu: number;
31
+ memory: number;
32
+ centsPerMs: number;
33
+ }, {
34
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
35
+ cpu: number;
36
+ memory: number;
37
+ centsPerMs: number;
38
+ }>;
39
+ type MachinePreset = z.infer<typeof MachinePreset>;
3
40
  declare const TaskRunBuiltInError: z.ZodObject<{
4
41
  type: z.ZodLiteral<"BUILT_IN_ERROR">;
5
42
  name: z.ZodString;
@@ -122,14 +159,22 @@ declare const TaskRun: z.ZodObject<{
122
159
  tags: z.ZodArray<z.ZodString, "many">;
123
160
  isTest: z.ZodDefault<z.ZodBoolean>;
124
161
  createdAt: z.ZodDate;
162
+ startedAt: z.ZodDefault<z.ZodDate>;
125
163
  idempotencyKey: z.ZodOptional<z.ZodString>;
164
+ durationMs: z.ZodDefault<z.ZodNumber>;
165
+ costInCents: z.ZodDefault<z.ZodNumber>;
166
+ baseCostInCents: z.ZodDefault<z.ZodNumber>;
126
167
  }, "strip", z.ZodTypeAny, {
127
168
  id: string;
169
+ startedAt: Date;
128
170
  payload: string;
129
171
  payloadType: string;
130
172
  tags: string[];
131
173
  isTest: boolean;
132
174
  createdAt: Date;
175
+ durationMs: number;
176
+ costInCents: number;
177
+ baseCostInCents: number;
133
178
  context?: any;
134
179
  idempotencyKey?: string | undefined;
135
180
  }, {
@@ -140,7 +185,11 @@ declare const TaskRun: z.ZodObject<{
140
185
  createdAt: Date;
141
186
  context?: any;
142
187
  isTest?: boolean | undefined;
188
+ startedAt?: Date | undefined;
143
189
  idempotencyKey?: string | undefined;
190
+ durationMs?: number | undefined;
191
+ costInCents?: number | undefined;
192
+ baseCostInCents?: number | undefined;
144
193
  }>;
145
194
  type TaskRun = z.infer<typeof TaskRun>;
146
195
  declare const TaskRunExecutionTask: z.ZodObject<{
@@ -287,14 +336,22 @@ declare const TaskRunExecution: z.ZodObject<{
287
336
  tags: z.ZodArray<z.ZodString, "many">;
288
337
  isTest: z.ZodDefault<z.ZodBoolean>;
289
338
  createdAt: z.ZodDate;
339
+ startedAt: z.ZodDefault<z.ZodDate>;
290
340
  idempotencyKey: z.ZodOptional<z.ZodString>;
341
+ durationMs: z.ZodDefault<z.ZodNumber>;
342
+ costInCents: z.ZodDefault<z.ZodNumber>;
343
+ baseCostInCents: z.ZodDefault<z.ZodNumber>;
291
344
  }, "strip", z.ZodTypeAny, {
292
345
  id: string;
346
+ startedAt: Date;
293
347
  payload: string;
294
348
  payloadType: string;
295
349
  tags: string[];
296
350
  isTest: boolean;
297
351
  createdAt: Date;
352
+ durationMs: number;
353
+ costInCents: number;
354
+ baseCostInCents: number;
298
355
  context?: any;
299
356
  idempotencyKey?: string | undefined;
300
357
  }, {
@@ -305,7 +362,11 @@ declare const TaskRunExecution: z.ZodObject<{
305
362
  createdAt: Date;
306
363
  context?: any;
307
364
  isTest?: boolean | undefined;
365
+ startedAt?: Date | undefined;
308
366
  idempotencyKey?: string | undefined;
367
+ durationMs?: number | undefined;
368
+ costInCents?: number | undefined;
369
+ baseCostInCents?: number | undefined;
309
370
  }>;
310
371
  queue: z.ZodObject<{
311
372
  id: z.ZodString;
@@ -366,6 +427,22 @@ declare const TaskRunExecution: z.ZodObject<{
366
427
  }, {
367
428
  id: string;
368
429
  }>>;
430
+ machine: z.ZodOptional<z.ZodObject<{
431
+ name: z.ZodEnum<["micro", "small-1x", "small-2x", "medium-1x", "medium-2x", "large-1x", "large-2x"]>;
432
+ cpu: z.ZodNumber;
433
+ memory: z.ZodNumber;
434
+ centsPerMs: z.ZodNumber;
435
+ }, "strip", z.ZodTypeAny, {
436
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
437
+ cpu: number;
438
+ memory: number;
439
+ centsPerMs: number;
440
+ }, {
441
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
442
+ cpu: number;
443
+ memory: number;
444
+ centsPerMs: number;
445
+ }>>;
369
446
  }, "strip", z.ZodTypeAny, {
370
447
  task: {
371
448
  id: string;
@@ -382,11 +459,15 @@ declare const TaskRunExecution: z.ZodObject<{
382
459
  };
383
460
  run: {
384
461
  id: string;
462
+ startedAt: Date;
385
463
  payload: string;
386
464
  payloadType: string;
387
465
  tags: string[];
388
466
  isTest: boolean;
389
467
  createdAt: Date;
468
+ durationMs: number;
469
+ costInCents: number;
470
+ baseCostInCents: number;
390
471
  context?: any;
391
472
  idempotencyKey?: string | undefined;
392
473
  };
@@ -413,6 +494,12 @@ declare const TaskRunExecution: z.ZodObject<{
413
494
  batch?: {
414
495
  id: string;
415
496
  } | undefined;
497
+ machine?: {
498
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
499
+ cpu: number;
500
+ memory: number;
501
+ centsPerMs: number;
502
+ } | undefined;
416
503
  }, {
417
504
  task: {
418
505
  id: string;
@@ -435,7 +522,11 @@ declare const TaskRunExecution: z.ZodObject<{
435
522
  createdAt: Date;
436
523
  context?: any;
437
524
  isTest?: boolean | undefined;
525
+ startedAt?: Date | undefined;
438
526
  idempotencyKey?: string | undefined;
527
+ durationMs?: number | undefined;
528
+ costInCents?: number | undefined;
529
+ baseCostInCents?: number | undefined;
439
530
  };
440
531
  queue: {
441
532
  id: string;
@@ -460,6 +551,12 @@ declare const TaskRunExecution: z.ZodObject<{
460
551
  batch?: {
461
552
  id: string;
462
553
  } | undefined;
554
+ machine?: {
555
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
556
+ cpu: number;
557
+ memory: number;
558
+ centsPerMs: number;
559
+ } | undefined;
463
560
  }>;
464
561
  type TaskRunExecution = z.infer<typeof TaskRunExecution>;
465
562
  declare const TaskRunContext: z.ZodObject<{
@@ -502,21 +599,33 @@ declare const TaskRunContext: z.ZodObject<{
502
599
  tags: z.ZodArray<z.ZodString, "many">;
503
600
  isTest: z.ZodDefault<z.ZodBoolean>;
504
601
  createdAt: z.ZodDate;
602
+ startedAt: z.ZodDefault<z.ZodDate>;
505
603
  idempotencyKey: z.ZodOptional<z.ZodString>;
604
+ durationMs: z.ZodDefault<z.ZodNumber>;
605
+ costInCents: z.ZodDefault<z.ZodNumber>;
606
+ baseCostInCents: z.ZodDefault<z.ZodNumber>;
506
607
  }, "payload" | "payloadType">, "strip", z.ZodTypeAny, {
507
608
  id: string;
609
+ startedAt: Date;
508
610
  tags: string[];
509
611
  isTest: boolean;
510
612
  createdAt: Date;
613
+ durationMs: number;
614
+ costInCents: number;
615
+ baseCostInCents: number;
511
616
  context?: any;
512
617
  idempotencyKey?: string | undefined;
513
618
  }, {
514
619
  id: string;
515
620
  tags: string[];
516
621
  createdAt: Date;
622
+ startedAt?: Date | undefined;
517
623
  context?: any;
518
624
  isTest?: boolean | undefined;
519
625
  idempotencyKey?: string | undefined;
626
+ durationMs?: number | undefined;
627
+ costInCents?: number | undefined;
628
+ baseCostInCents?: number | undefined;
520
629
  }>;
521
630
  queue: z.ZodObject<{
522
631
  id: z.ZodString;
@@ -577,6 +686,22 @@ declare const TaskRunContext: z.ZodObject<{
577
686
  }, {
578
687
  id: string;
579
688
  }>>;
689
+ machine: z.ZodOptional<z.ZodObject<{
690
+ name: z.ZodEnum<["micro", "small-1x", "small-2x", "medium-1x", "medium-2x", "large-1x", "large-2x"]>;
691
+ cpu: z.ZodNumber;
692
+ memory: z.ZodNumber;
693
+ centsPerMs: z.ZodNumber;
694
+ }, "strip", z.ZodTypeAny, {
695
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
696
+ cpu: number;
697
+ memory: number;
698
+ centsPerMs: number;
699
+ }, {
700
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
701
+ cpu: number;
702
+ memory: number;
703
+ centsPerMs: number;
704
+ }>>;
580
705
  }, "strip", z.ZodTypeAny, {
581
706
  task: {
582
707
  id: string;
@@ -591,9 +716,13 @@ declare const TaskRunContext: z.ZodObject<{
591
716
  };
592
717
  run: {
593
718
  id: string;
719
+ startedAt: Date;
594
720
  tags: string[];
595
721
  isTest: boolean;
596
722
  createdAt: Date;
723
+ durationMs: number;
724
+ costInCents: number;
725
+ baseCostInCents: number;
597
726
  context?: any;
598
727
  idempotencyKey?: string | undefined;
599
728
  };
@@ -620,6 +749,12 @@ declare const TaskRunContext: z.ZodObject<{
620
749
  batch?: {
621
750
  id: string;
622
751
  } | undefined;
752
+ machine?: {
753
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
754
+ cpu: number;
755
+ memory: number;
756
+ centsPerMs: number;
757
+ } | undefined;
623
758
  }, {
624
759
  task: {
625
760
  id: string;
@@ -636,9 +771,13 @@ declare const TaskRunContext: z.ZodObject<{
636
771
  id: string;
637
772
  tags: string[];
638
773
  createdAt: Date;
774
+ startedAt?: Date | undefined;
639
775
  context?: any;
640
776
  isTest?: boolean | undefined;
641
777
  idempotencyKey?: string | undefined;
778
+ durationMs?: number | undefined;
779
+ costInCents?: number | undefined;
780
+ baseCostInCents?: number | undefined;
642
781
  };
643
782
  queue: {
644
783
  id: string;
@@ -663,6 +802,12 @@ declare const TaskRunContext: z.ZodObject<{
663
802
  batch?: {
664
803
  id: string;
665
804
  } | undefined;
805
+ machine?: {
806
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
807
+ cpu: number;
808
+ memory: number;
809
+ centsPerMs: number;
810
+ } | undefined;
666
811
  }>;
667
812
  type TaskRunContext = z.infer<typeof TaskRunContext>;
668
813
  declare const TaskRunExecutionRetry: z.ZodObject<{
@@ -679,6 +824,14 @@ declare const TaskRunExecutionRetry: z.ZodObject<{
679
824
  error?: unknown;
680
825
  }>;
681
826
  type TaskRunExecutionRetry = z.infer<typeof TaskRunExecutionRetry>;
827
+ declare const TaskRunExecutionUsage: z.ZodObject<{
828
+ durationMs: z.ZodNumber;
829
+ }, "strip", z.ZodTypeAny, {
830
+ durationMs: number;
831
+ }, {
832
+ durationMs: number;
833
+ }>;
834
+ type TaskRunExecutionUsage = z.infer<typeof TaskRunExecutionUsage>;
682
835
  declare const TaskRunFailedExecutionResult: z.ZodObject<{
683
836
  ok: z.ZodLiteral<false>;
684
837
  id: z.ZodString;
@@ -742,6 +895,13 @@ declare const TaskRunFailedExecutionResult: z.ZodObject<{
742
895
  error?: unknown;
743
896
  }>>;
744
897
  skippedRetrying: z.ZodOptional<z.ZodBoolean>;
898
+ usage: z.ZodOptional<z.ZodObject<{
899
+ durationMs: z.ZodNumber;
900
+ }, "strip", z.ZodTypeAny, {
901
+ durationMs: number;
902
+ }, {
903
+ durationMs: number;
904
+ }>>;
745
905
  }, "strip", z.ZodTypeAny, {
746
906
  error: {
747
907
  message: string;
@@ -767,6 +927,9 @@ declare const TaskRunFailedExecutionResult: z.ZodObject<{
767
927
  error?: unknown;
768
928
  } | undefined;
769
929
  skippedRetrying?: boolean | undefined;
930
+ usage?: {
931
+ durationMs: number;
932
+ } | undefined;
770
933
  }, {
771
934
  error: {
772
935
  message: string;
@@ -792,6 +955,9 @@ declare const TaskRunFailedExecutionResult: z.ZodObject<{
792
955
  error?: unknown;
793
956
  } | undefined;
794
957
  skippedRetrying?: boolean | undefined;
958
+ usage?: {
959
+ durationMs: number;
960
+ } | undefined;
795
961
  }>;
796
962
  type TaskRunFailedExecutionResult = z.infer<typeof TaskRunFailedExecutionResult>;
797
963
  declare const TaskRunSuccessfulExecutionResult: z.ZodObject<{
@@ -799,16 +965,29 @@ declare const TaskRunSuccessfulExecutionResult: z.ZodObject<{
799
965
  id: z.ZodString;
800
966
  output: z.ZodOptional<z.ZodString>;
801
967
  outputType: z.ZodString;
968
+ usage: z.ZodOptional<z.ZodObject<{
969
+ durationMs: z.ZodNumber;
970
+ }, "strip", z.ZodTypeAny, {
971
+ durationMs: number;
972
+ }, {
973
+ durationMs: number;
974
+ }>>;
802
975
  }, "strip", z.ZodTypeAny, {
803
976
  id: string;
804
977
  ok: true;
805
978
  outputType: string;
806
979
  output?: string | undefined;
980
+ usage?: {
981
+ durationMs: number;
982
+ } | undefined;
807
983
  }, {
808
984
  id: string;
809
985
  ok: true;
810
986
  outputType: string;
811
987
  output?: string | undefined;
988
+ usage?: {
989
+ durationMs: number;
990
+ } | undefined;
812
991
  }>;
813
992
  type TaskRunSuccessfulExecutionResult = z.infer<typeof TaskRunSuccessfulExecutionResult>;
814
993
  declare const TaskRunExecutionResult: z.ZodDiscriminatedUnion<"ok", [z.ZodObject<{
@@ -816,16 +995,29 @@ declare const TaskRunExecutionResult: z.ZodDiscriminatedUnion<"ok", [z.ZodObject
816
995
  id: z.ZodString;
817
996
  output: z.ZodOptional<z.ZodString>;
818
997
  outputType: z.ZodString;
998
+ usage: z.ZodOptional<z.ZodObject<{
999
+ durationMs: z.ZodNumber;
1000
+ }, "strip", z.ZodTypeAny, {
1001
+ durationMs: number;
1002
+ }, {
1003
+ durationMs: number;
1004
+ }>>;
819
1005
  }, "strip", z.ZodTypeAny, {
820
1006
  id: string;
821
1007
  ok: true;
822
1008
  outputType: string;
823
1009
  output?: string | undefined;
1010
+ usage?: {
1011
+ durationMs: number;
1012
+ } | undefined;
824
1013
  }, {
825
1014
  id: string;
826
1015
  ok: true;
827
1016
  outputType: string;
828
1017
  output?: string | undefined;
1018
+ usage?: {
1019
+ durationMs: number;
1020
+ } | undefined;
829
1021
  }>, z.ZodObject<{
830
1022
  ok: z.ZodLiteral<false>;
831
1023
  id: z.ZodString;
@@ -889,6 +1081,13 @@ declare const TaskRunExecutionResult: z.ZodDiscriminatedUnion<"ok", [z.ZodObject
889
1081
  error?: unknown;
890
1082
  }>>;
891
1083
  skippedRetrying: z.ZodOptional<z.ZodBoolean>;
1084
+ usage: z.ZodOptional<z.ZodObject<{
1085
+ durationMs: z.ZodNumber;
1086
+ }, "strip", z.ZodTypeAny, {
1087
+ durationMs: number;
1088
+ }, {
1089
+ durationMs: number;
1090
+ }>>;
892
1091
  }, "strip", z.ZodTypeAny, {
893
1092
  error: {
894
1093
  message: string;
@@ -914,6 +1113,9 @@ declare const TaskRunExecutionResult: z.ZodDiscriminatedUnion<"ok", [z.ZodObject
914
1113
  error?: unknown;
915
1114
  } | undefined;
916
1115
  skippedRetrying?: boolean | undefined;
1116
+ usage?: {
1117
+ durationMs: number;
1118
+ } | undefined;
917
1119
  }, {
918
1120
  error: {
919
1121
  message: string;
@@ -939,6 +1141,9 @@ declare const TaskRunExecutionResult: z.ZodDiscriminatedUnion<"ok", [z.ZodObject
939
1141
  error?: unknown;
940
1142
  } | undefined;
941
1143
  skippedRetrying?: boolean | undefined;
1144
+ usage?: {
1145
+ durationMs: number;
1146
+ } | undefined;
942
1147
  }>]>;
943
1148
  type TaskRunExecutionResult = z.infer<typeof TaskRunExecutionResult>;
944
1149
  declare const BatchTaskRunExecutionResult: z.ZodObject<{
@@ -948,16 +1153,29 @@ declare const BatchTaskRunExecutionResult: z.ZodObject<{
948
1153
  id: z.ZodString;
949
1154
  output: z.ZodOptional<z.ZodString>;
950
1155
  outputType: z.ZodString;
1156
+ usage: z.ZodOptional<z.ZodObject<{
1157
+ durationMs: z.ZodNumber;
1158
+ }, "strip", z.ZodTypeAny, {
1159
+ durationMs: number;
1160
+ }, {
1161
+ durationMs: number;
1162
+ }>>;
951
1163
  }, "strip", z.ZodTypeAny, {
952
1164
  id: string;
953
1165
  ok: true;
954
1166
  outputType: string;
955
1167
  output?: string | undefined;
1168
+ usage?: {
1169
+ durationMs: number;
1170
+ } | undefined;
956
1171
  }, {
957
1172
  id: string;
958
1173
  ok: true;
959
1174
  outputType: string;
960
1175
  output?: string | undefined;
1176
+ usage?: {
1177
+ durationMs: number;
1178
+ } | undefined;
961
1179
  }>, z.ZodObject<{
962
1180
  ok: z.ZodLiteral<false>;
963
1181
  id: z.ZodString;
@@ -1021,6 +1239,13 @@ declare const BatchTaskRunExecutionResult: z.ZodObject<{
1021
1239
  error?: unknown;
1022
1240
  }>>;
1023
1241
  skippedRetrying: z.ZodOptional<z.ZodBoolean>;
1242
+ usage: z.ZodOptional<z.ZodObject<{
1243
+ durationMs: z.ZodNumber;
1244
+ }, "strip", z.ZodTypeAny, {
1245
+ durationMs: number;
1246
+ }, {
1247
+ durationMs: number;
1248
+ }>>;
1024
1249
  }, "strip", z.ZodTypeAny, {
1025
1250
  error: {
1026
1251
  message: string;
@@ -1046,6 +1271,9 @@ declare const BatchTaskRunExecutionResult: z.ZodObject<{
1046
1271
  error?: unknown;
1047
1272
  } | undefined;
1048
1273
  skippedRetrying?: boolean | undefined;
1274
+ usage?: {
1275
+ durationMs: number;
1276
+ } | undefined;
1049
1277
  }, {
1050
1278
  error: {
1051
1279
  message: string;
@@ -1071,6 +1299,9 @@ declare const BatchTaskRunExecutionResult: z.ZodObject<{
1071
1299
  error?: unknown;
1072
1300
  } | undefined;
1073
1301
  skippedRetrying?: boolean | undefined;
1302
+ usage?: {
1303
+ durationMs: number;
1304
+ } | undefined;
1074
1305
  }>]>, "many">;
1075
1306
  }, "strip", z.ZodTypeAny, {
1076
1307
  id: string;
@@ -1079,6 +1310,9 @@ declare const BatchTaskRunExecutionResult: z.ZodObject<{
1079
1310
  ok: true;
1080
1311
  outputType: string;
1081
1312
  output?: string | undefined;
1313
+ usage?: {
1314
+ durationMs: number;
1315
+ } | undefined;
1082
1316
  } | {
1083
1317
  error: {
1084
1318
  message: string;
@@ -1104,6 +1338,9 @@ declare const BatchTaskRunExecutionResult: z.ZodObject<{
1104
1338
  error?: unknown;
1105
1339
  } | undefined;
1106
1340
  skippedRetrying?: boolean | undefined;
1341
+ usage?: {
1342
+ durationMs: number;
1343
+ } | undefined;
1107
1344
  })[];
1108
1345
  }, {
1109
1346
  id: string;
@@ -1112,6 +1349,9 @@ declare const BatchTaskRunExecutionResult: z.ZodObject<{
1112
1349
  ok: true;
1113
1350
  outputType: string;
1114
1351
  output?: string | undefined;
1352
+ usage?: {
1353
+ durationMs: number;
1354
+ } | undefined;
1115
1355
  } | {
1116
1356
  error: {
1117
1357
  message: string;
@@ -1137,6 +1377,9 @@ declare const BatchTaskRunExecutionResult: z.ZodObject<{
1137
1377
  error?: unknown;
1138
1378
  } | undefined;
1139
1379
  skippedRetrying?: boolean | undefined;
1380
+ usage?: {
1381
+ durationMs: number;
1382
+ } | undefined;
1140
1383
  })[];
1141
1384
  }>;
1142
1385
  type BatchTaskRunExecutionResult = z.infer<typeof BatchTaskRunExecutionResult>;
@@ -1156,4 +1399,4 @@ interface RuntimeManager {
1156
1399
  }): Promise<BatchTaskRunExecutionResult>;
1157
1400
  }
1158
1401
 
1159
- export { BatchTaskRunExecutionResult as B, type RuntimeManager as R, TaskRunExecutionResult as T, TaskRunContext as a, TaskRunExecution as b, TaskRunError as c, TaskRunBuiltInError as d, TaskRunCustomErrorObject as e, TaskRunStringError as f, TaskRunErrorCodes as g, TaskRunInternalError as h, TaskRun as i, TaskRunExecutionTask as j, TaskRunExecutionAttempt as k, TaskRunExecutionEnvironment as l, TaskRunExecutionOrganization as m, TaskRunExecutionProject as n, TaskRunExecutionQueue as o, TaskRunExecutionBatch as p, TaskRunExecutionRetry as q, TaskRunFailedExecutionResult as r, TaskRunSuccessfulExecutionResult as s };
1402
+ export { BatchTaskRunExecutionResult as B, MachinePresetName as M, type RuntimeManager as R, TaskRunExecutionResult as T, TaskRunContext as a, TaskRunExecution as b, TaskRunError as c, MachineCpu as d, MachineMemory as e, MachineConfig as f, MachinePreset as g, TaskRunBuiltInError as h, TaskRunCustomErrorObject as i, TaskRunStringError as j, TaskRunErrorCodes as k, TaskRunInternalError as l, TaskRun as m, TaskRunExecutionTask as n, TaskRunExecutionAttempt as o, TaskRunExecutionEnvironment as p, TaskRunExecutionOrganization as q, TaskRunExecutionProject as r, TaskRunExecutionQueue as s, TaskRunExecutionBatch as t, TaskRunExecutionRetry as u, TaskRunExecutionUsage as v, TaskRunFailedExecutionResult as w, TaskRunSuccessfulExecutionResult as x };