@trigger.dev/core 4.3.1 → 4.3.3

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 (113) hide show
  1. package/dist/commonjs/v3/apiClient/index.js +32 -8
  2. package/dist/commonjs/v3/apiClient/index.js.map +1 -1
  3. package/dist/commonjs/v3/apiClient/streamBatchItems.test.js +39 -0
  4. package/dist/commonjs/v3/apiClient/streamBatchItems.test.js.map +1 -1
  5. package/dist/commonjs/v3/idempotency-key-catalog/catalog.d.ts +9 -0
  6. package/dist/commonjs/v3/idempotency-key-catalog/catalog.js +3 -0
  7. package/dist/commonjs/v3/idempotency-key-catalog/catalog.js.map +1 -0
  8. package/dist/commonjs/v3/idempotency-key-catalog/index.d.ts +9 -0
  9. package/dist/commonjs/v3/idempotency-key-catalog/index.js +33 -0
  10. package/dist/commonjs/v3/idempotency-key-catalog/index.js.map +1 -0
  11. package/dist/commonjs/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.d.ts +8 -0
  12. package/dist/commonjs/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.js +35 -0
  13. package/dist/commonjs/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.js.map +1 -0
  14. package/dist/commonjs/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.test.d.ts +1 -0
  15. package/dist/commonjs/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.test.js +161 -0
  16. package/dist/commonjs/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.test.js.map +1 -0
  17. package/dist/commonjs/v3/idempotency-key-catalog-api.d.ts +3 -0
  18. package/dist/commonjs/v3/idempotency-key-catalog-api.js +9 -0
  19. package/dist/commonjs/v3/idempotency-key-catalog-api.js.map +1 -0
  20. package/dist/commonjs/v3/idempotencyKeys.d.ts +51 -4
  21. package/dist/commonjs/v3/idempotencyKeys.js +97 -5
  22. package/dist/commonjs/v3/idempotencyKeys.js.map +1 -1
  23. package/dist/commonjs/v3/imports/superjson-cjs.cjs.map +1 -0
  24. package/dist/commonjs/v3/imports/superjson.d.ts +1 -0
  25. package/dist/commonjs/v3/imports/superjson.js +13 -0
  26. package/dist/commonjs/v3/runEngineWorker/supervisor/http.d.ts +61 -60
  27. package/dist/commonjs/v3/runEngineWorker/supervisor/schemas.d.ts +191 -184
  28. package/dist/commonjs/v3/runEngineWorker/workload/http.d.ts +46 -45
  29. package/dist/commonjs/v3/runEngineWorker/workload/schemas.d.ts +163 -156
  30. package/dist/commonjs/v3/schemas/api.d.ts +246 -56
  31. package/dist/commonjs/v3/schemas/api.js +14 -3
  32. package/dist/commonjs/v3/schemas/api.js.map +1 -1
  33. package/dist/commonjs/v3/schemas/checkpoints.d.ts +66 -66
  34. package/dist/commonjs/v3/schemas/common.d.ts +215 -177
  35. package/dist/commonjs/v3/schemas/common.js +6 -0
  36. package/dist/commonjs/v3/schemas/common.js.map +1 -1
  37. package/dist/commonjs/v3/schemas/messages.d.ts +2149 -2032
  38. package/dist/commonjs/v3/schemas/runEngine.d.ts +157 -150
  39. package/dist/commonjs/v3/schemas/schemas.d.ts +281 -262
  40. package/dist/commonjs/v3/schemas/webhooks.d.ts +68 -68
  41. package/dist/commonjs/v3/serverOnly/idempotencyKeys.d.ts +36 -0
  42. package/dist/commonjs/v3/serverOnly/idempotencyKeys.js +58 -0
  43. package/dist/commonjs/v3/serverOnly/idempotencyKeys.js.map +1 -0
  44. package/dist/commonjs/v3/serverOnly/index.d.ts +1 -0
  45. package/dist/commonjs/v3/serverOnly/index.js +1 -0
  46. package/dist/commonjs/v3/serverOnly/index.js.map +1 -1
  47. package/dist/commonjs/v3/types/tools.js +2 -2
  48. package/dist/commonjs/v3/types/tools.js.map +1 -1
  49. package/dist/commonjs/v3/utils/flattenAttributes.d.ts +2 -2
  50. package/dist/commonjs/v3/utils/flattenAttributes.js +24 -13
  51. package/dist/commonjs/v3/utils/flattenAttributes.js.map +1 -1
  52. package/dist/commonjs/v3/utils/globals.d.ts +2 -0
  53. package/dist/commonjs/v3/utils/globals.js.map +1 -1
  54. package/dist/commonjs/v3/utils/ioSerialization.js +15 -27
  55. package/dist/commonjs/v3/utils/ioSerialization.js.map +1 -1
  56. package/dist/commonjs/version.js +1 -1
  57. package/dist/esm/v3/apiClient/index.js +32 -8
  58. package/dist/esm/v3/apiClient/index.js.map +1 -1
  59. package/dist/esm/v3/apiClient/streamBatchItems.test.js +39 -0
  60. package/dist/esm/v3/apiClient/streamBatchItems.test.js.map +1 -1
  61. package/dist/esm/v3/idempotency-key-catalog/catalog.d.ts +9 -0
  62. package/dist/esm/v3/idempotency-key-catalog/catalog.js +2 -0
  63. package/dist/esm/v3/idempotency-key-catalog/catalog.js.map +1 -0
  64. package/dist/esm/v3/idempotency-key-catalog/index.d.ts +9 -0
  65. package/dist/esm/v3/idempotency-key-catalog/index.js +29 -0
  66. package/dist/esm/v3/idempotency-key-catalog/index.js.map +1 -0
  67. package/dist/esm/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.d.ts +8 -0
  68. package/dist/esm/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.js +31 -0
  69. package/dist/esm/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.js.map +1 -0
  70. package/dist/esm/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.test.d.ts +1 -0
  71. package/dist/esm/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.test.js +159 -0
  72. package/dist/esm/v3/idempotency-key-catalog/lruIdempotencyKeyCatalog.test.js.map +1 -0
  73. package/dist/esm/v3/idempotency-key-catalog-api.d.ts +3 -0
  74. package/dist/esm/v3/idempotency-key-catalog-api.js +6 -0
  75. package/dist/esm/v3/idempotency-key-catalog-api.js.map +1 -0
  76. package/dist/esm/v3/idempotencyKeys.d.ts +51 -4
  77. package/dist/esm/v3/idempotencyKeys.js +96 -5
  78. package/dist/esm/v3/idempotencyKeys.js.map +1 -1
  79. package/dist/esm/v3/imports/superjson.d.ts +2 -0
  80. package/dist/esm/v3/imports/superjson.js +10 -0
  81. package/dist/esm/v3/imports/superjson.js.map +1 -0
  82. package/dist/esm/v3/runEngineWorker/supervisor/http.d.ts +61 -60
  83. package/dist/esm/v3/runEngineWorker/supervisor/schemas.d.ts +191 -184
  84. package/dist/esm/v3/runEngineWorker/workload/http.d.ts +46 -45
  85. package/dist/esm/v3/runEngineWorker/workload/schemas.d.ts +163 -156
  86. package/dist/esm/v3/schemas/api.d.ts +246 -56
  87. package/dist/esm/v3/schemas/api.js +11 -0
  88. package/dist/esm/v3/schemas/api.js.map +1 -1
  89. package/dist/esm/v3/schemas/checkpoints.d.ts +66 -66
  90. package/dist/esm/v3/schemas/common.d.ts +215 -177
  91. package/dist/esm/v3/schemas/common.js +6 -0
  92. package/dist/esm/v3/schemas/common.js.map +1 -1
  93. package/dist/esm/v3/schemas/messages.d.ts +2149 -2032
  94. package/dist/esm/v3/schemas/runEngine.d.ts +157 -150
  95. package/dist/esm/v3/schemas/schemas.d.ts +281 -262
  96. package/dist/esm/v3/schemas/webhooks.d.ts +68 -68
  97. package/dist/esm/v3/serverOnly/idempotencyKeys.d.ts +36 -0
  98. package/dist/esm/v3/serverOnly/idempotencyKeys.js +51 -0
  99. package/dist/esm/v3/serverOnly/idempotencyKeys.js.map +1 -0
  100. package/dist/esm/v3/serverOnly/index.d.ts +1 -0
  101. package/dist/esm/v3/serverOnly/index.js +1 -0
  102. package/dist/esm/v3/serverOnly/index.js.map +1 -1
  103. package/dist/esm/v3/types/tools.js +2 -2
  104. package/dist/esm/v3/types/tools.js.map +1 -1
  105. package/dist/esm/v3/utils/flattenAttributes.d.ts +2 -2
  106. package/dist/esm/v3/utils/flattenAttributes.js +24 -13
  107. package/dist/esm/v3/utils/flattenAttributes.js.map +1 -1
  108. package/dist/esm/v3/utils/globals.d.ts +2 -0
  109. package/dist/esm/v3/utils/globals.js.map +1 -1
  110. package/dist/esm/v3/utils/ioSerialization.js +9 -24
  111. package/dist/esm/v3/utils/ioSerialization.js.map +1 -1
  112. package/dist/esm/version.js +1 -1
  113. package/package.json +2 -2
@@ -651,7 +651,10 @@ export declare const TaskRun: z.ZodObject<{
651
651
  isTest: z.ZodDefault<z.ZodBoolean>;
652
652
  createdAt: z.ZodDate;
653
653
  startedAt: z.ZodDefault<z.ZodDate>;
654
+ /** The user-provided idempotency key (not the hash) */
654
655
  idempotencyKey: z.ZodOptional<z.ZodString>;
656
+ /** The scope of the idempotency key */
657
+ idempotencyKeyScope: z.ZodOptional<z.ZodEnum<["run", "attempt", "global"]>>;
655
658
  maxAttempts: z.ZodOptional<z.ZodNumber>;
656
659
  version: z.ZodOptional<z.ZodString>;
657
660
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../schemas/json.js").DeserializedJson, z.ZodTypeDef, import("../../schemas/json.js").DeserializedJson>>>;
@@ -674,6 +677,7 @@ export declare const TaskRun: z.ZodObject<{
674
677
  startedAt: Date;
675
678
  metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
676
679
  idempotencyKey?: string | undefined;
680
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
677
681
  maxAttempts?: number | undefined;
678
682
  version?: string | undefined;
679
683
  maxDuration?: number | undefined;
@@ -694,6 +698,7 @@ export declare const TaskRun: z.ZodObject<{
694
698
  isTest?: boolean | undefined;
695
699
  startedAt?: Date | undefined;
696
700
  idempotencyKey?: string | undefined;
701
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
697
702
  maxAttempts?: number | undefined;
698
703
  version?: string | undefined;
699
704
  maxDuration?: number | undefined;
@@ -1684,7 +1689,10 @@ export declare const TaskRunExecution: z.ZodObject<{
1684
1689
  isTest: z.ZodDefault<z.ZodBoolean>;
1685
1690
  createdAt: z.ZodDate;
1686
1691
  startedAt: z.ZodDefault<z.ZodDate>;
1692
+ /** The user-provided idempotency key (not the hash) */
1687
1693
  idempotencyKey: z.ZodOptional<z.ZodString>;
1694
+ /** The scope of the idempotency key */
1695
+ idempotencyKeyScope: z.ZodOptional<z.ZodEnum<["run", "attempt", "global"]>>;
1688
1696
  maxAttempts: z.ZodOptional<z.ZodNumber>;
1689
1697
  version: z.ZodOptional<z.ZodString>;
1690
1698
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../schemas/json.js").DeserializedJson, z.ZodTypeDef, import("../../schemas/json.js").DeserializedJson>>>;
@@ -1707,6 +1715,7 @@ export declare const TaskRunExecution: z.ZodObject<{
1707
1715
  startedAt: Date;
1708
1716
  metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
1709
1717
  idempotencyKey?: string | undefined;
1718
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
1710
1719
  maxAttempts?: number | undefined;
1711
1720
  version?: string | undefined;
1712
1721
  maxDuration?: number | undefined;
@@ -1727,6 +1736,7 @@ export declare const TaskRunExecution: z.ZodObject<{
1727
1736
  isTest?: boolean | undefined;
1728
1737
  startedAt?: Date | undefined;
1729
1738
  idempotencyKey?: string | undefined;
1739
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
1730
1740
  maxAttempts?: number | undefined;
1731
1741
  version?: string | undefined;
1732
1742
  maxDuration?: number | undefined;
@@ -1748,6 +1758,37 @@ export declare const TaskRunExecution: z.ZodObject<{
1748
1758
  realtimeStreamsVersion?: string | undefined;
1749
1759
  }>>;
1750
1760
  }, "strip", z.ZodTypeAny, {
1761
+ run: {
1762
+ payload: string;
1763
+ id: string;
1764
+ payloadType: string;
1765
+ tags: string[];
1766
+ isTest: boolean;
1767
+ createdAt: Date;
1768
+ startedAt: Date;
1769
+ metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
1770
+ idempotencyKey?: string | undefined;
1771
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
1772
+ maxAttempts?: number | undefined;
1773
+ version?: string | undefined;
1774
+ maxDuration?: number | undefined;
1775
+ priority?: number | undefined;
1776
+ baseCostInCents?: number | undefined;
1777
+ parentTaskRunId?: string | undefined;
1778
+ rootTaskRunId?: string | undefined;
1779
+ durationMs?: number | undefined;
1780
+ costInCents?: number | undefined;
1781
+ region?: string | undefined;
1782
+ } & {
1783
+ traceContext?: Record<string, unknown> | undefined;
1784
+ realtimeStreamsVersion?: string | undefined;
1785
+ };
1786
+ attempt: {
1787
+ number: number;
1788
+ startedAt: Date;
1789
+ } & {
1790
+ [k: string]: unknown;
1791
+ };
1751
1792
  task: {
1752
1793
  id: string;
1753
1794
  filePath: string;
@@ -1796,36 +1837,6 @@ export declare const TaskRunExecution: z.ZodObject<{
1796
1837
  name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
1797
1838
  centsPerMs: number;
1798
1839
  };
1799
- attempt: {
1800
- number: number;
1801
- startedAt: Date;
1802
- } & {
1803
- [k: string]: unknown;
1804
- };
1805
- run: {
1806
- payload: string;
1807
- id: string;
1808
- payloadType: string;
1809
- tags: string[];
1810
- isTest: boolean;
1811
- createdAt: Date;
1812
- startedAt: Date;
1813
- metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
1814
- idempotencyKey?: string | undefined;
1815
- maxAttempts?: number | undefined;
1816
- version?: string | undefined;
1817
- maxDuration?: number | undefined;
1818
- priority?: number | undefined;
1819
- baseCostInCents?: number | undefined;
1820
- parentTaskRunId?: string | undefined;
1821
- rootTaskRunId?: string | undefined;
1822
- durationMs?: number | undefined;
1823
- costInCents?: number | undefined;
1824
- region?: string | undefined;
1825
- } & {
1826
- traceContext?: Record<string, unknown> | undefined;
1827
- realtimeStreamsVersion?: string | undefined;
1828
- };
1829
1840
  batch?: {
1830
1841
  id: string;
1831
1842
  } | undefined;
@@ -1852,6 +1863,37 @@ export declare const TaskRunExecution: z.ZodObject<{
1852
1863
  } | undefined;
1853
1864
  } | undefined;
1854
1865
  }, {
1866
+ run: {
1867
+ payload: string;
1868
+ id: string;
1869
+ payloadType: string;
1870
+ tags: string[];
1871
+ createdAt: Date;
1872
+ metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
1873
+ isTest?: boolean | undefined;
1874
+ startedAt?: Date | undefined;
1875
+ idempotencyKey?: string | undefined;
1876
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
1877
+ maxAttempts?: number | undefined;
1878
+ version?: string | undefined;
1879
+ maxDuration?: number | undefined;
1880
+ priority?: number | undefined;
1881
+ baseCostInCents?: number | undefined;
1882
+ parentTaskRunId?: string | undefined;
1883
+ rootTaskRunId?: string | undefined;
1884
+ durationMs?: number | undefined;
1885
+ costInCents?: number | undefined;
1886
+ region?: string | undefined;
1887
+ } & {
1888
+ traceContext?: Record<string, unknown> | undefined;
1889
+ realtimeStreamsVersion?: string | undefined;
1890
+ };
1891
+ attempt: {
1892
+ number: number;
1893
+ startedAt: Date;
1894
+ } & {
1895
+ [k: string]: unknown;
1896
+ };
1855
1897
  task: {
1856
1898
  id: string;
1857
1899
  filePath: string;
@@ -1900,36 +1942,6 @@ export declare const TaskRunExecution: z.ZodObject<{
1900
1942
  name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
1901
1943
  centsPerMs: number;
1902
1944
  };
1903
- attempt: {
1904
- number: number;
1905
- startedAt: Date;
1906
- } & {
1907
- [k: string]: unknown;
1908
- };
1909
- run: {
1910
- payload: string;
1911
- id: string;
1912
- payloadType: string;
1913
- tags: string[];
1914
- createdAt: Date;
1915
- metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
1916
- isTest?: boolean | undefined;
1917
- startedAt?: Date | undefined;
1918
- idempotencyKey?: string | undefined;
1919
- maxAttempts?: number | undefined;
1920
- version?: string | undefined;
1921
- maxDuration?: number | undefined;
1922
- priority?: number | undefined;
1923
- baseCostInCents?: number | undefined;
1924
- parentTaskRunId?: string | undefined;
1925
- rootTaskRunId?: string | undefined;
1926
- durationMs?: number | undefined;
1927
- costInCents?: number | undefined;
1928
- region?: string | undefined;
1929
- } & {
1930
- traceContext?: Record<string, unknown> | undefined;
1931
- realtimeStreamsVersion?: string | undefined;
1932
- };
1933
1945
  batch?: {
1934
1946
  id: string;
1935
1947
  } | undefined;
@@ -2002,7 +2014,10 @@ export declare const V3TaskRun: z.ZodObject<{
2002
2014
  isTest: z.ZodDefault<z.ZodBoolean>;
2003
2015
  createdAt: z.ZodDate;
2004
2016
  startedAt: z.ZodDefault<z.ZodDate>;
2017
+ /** The user-provided idempotency key (not the hash) */
2005
2018
  idempotencyKey: z.ZodOptional<z.ZodString>;
2019
+ /** The scope of the idempotency key */
2020
+ idempotencyKeyScope: z.ZodOptional<z.ZodEnum<["run", "attempt", "global"]>>;
2006
2021
  maxAttempts: z.ZodOptional<z.ZodNumber>;
2007
2022
  version: z.ZodOptional<z.ZodString>;
2008
2023
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../schemas/json.js").DeserializedJson, z.ZodTypeDef, import("../../schemas/json.js").DeserializedJson>>>;
@@ -2025,6 +2040,7 @@ export declare const V3TaskRun: z.ZodObject<{
2025
2040
  context?: unknown;
2026
2041
  metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
2027
2042
  idempotencyKey?: string | undefined;
2043
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
2028
2044
  maxAttempts?: number | undefined;
2029
2045
  version?: string | undefined;
2030
2046
  maxDuration?: number | undefined;
@@ -2042,6 +2058,7 @@ export declare const V3TaskRun: z.ZodObject<{
2042
2058
  isTest?: boolean | undefined;
2043
2059
  startedAt?: Date | undefined;
2044
2060
  idempotencyKey?: string | undefined;
2061
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
2045
2062
  maxAttempts?: number | undefined;
2046
2063
  version?: string | undefined;
2047
2064
  maxDuration?: number | undefined;
@@ -2091,7 +2108,10 @@ export declare const V3TaskRunExecution: z.ZodObject<{
2091
2108
  isTest: z.ZodDefault<z.ZodBoolean>;
2092
2109
  createdAt: z.ZodDate;
2093
2110
  startedAt: z.ZodDefault<z.ZodDate>;
2111
+ /** The user-provided idempotency key (not the hash) */
2094
2112
  idempotencyKey: z.ZodOptional<z.ZodString>;
2113
+ /** The scope of the idempotency key */
2114
+ idempotencyKeyScope: z.ZodOptional<z.ZodEnum<["run", "attempt", "global"]>>;
2095
2115
  maxAttempts: z.ZodOptional<z.ZodNumber>;
2096
2116
  version: z.ZodOptional<z.ZodString>;
2097
2117
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../schemas/json.js").DeserializedJson, z.ZodTypeDef, import("../../schemas/json.js").DeserializedJson>>>;
@@ -2114,6 +2134,7 @@ export declare const V3TaskRunExecution: z.ZodObject<{
2114
2134
  context?: unknown;
2115
2135
  metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
2116
2136
  idempotencyKey?: string | undefined;
2137
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
2117
2138
  maxAttempts?: number | undefined;
2118
2139
  version?: string | undefined;
2119
2140
  maxDuration?: number | undefined;
@@ -2131,6 +2152,7 @@ export declare const V3TaskRunExecution: z.ZodObject<{
2131
2152
  isTest?: boolean | undefined;
2132
2153
  startedAt?: Date | undefined;
2133
2154
  idempotencyKey?: string | undefined;
2155
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
2134
2156
  maxAttempts?: number | undefined;
2135
2157
  version?: string | undefined;
2136
2158
  maxDuration?: number | undefined;
@@ -2295,6 +2317,35 @@ export declare const V3TaskRunExecution: z.ZodObject<{
2295
2317
  id: string;
2296
2318
  }>>;
2297
2319
  }, "strip", z.ZodTypeAny, {
2320
+ run: {
2321
+ payload: string;
2322
+ id: string;
2323
+ payloadType: string;
2324
+ tags: string[];
2325
+ isTest: boolean;
2326
+ createdAt: Date;
2327
+ startedAt: Date;
2328
+ baseCostInCents: number;
2329
+ durationMs: number;
2330
+ costInCents: number;
2331
+ context?: unknown;
2332
+ metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
2333
+ idempotencyKey?: string | undefined;
2334
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
2335
+ maxAttempts?: number | undefined;
2336
+ version?: string | undefined;
2337
+ maxDuration?: number | undefined;
2338
+ } & {
2339
+ traceContext?: Record<string, unknown> | undefined;
2340
+ };
2341
+ attempt: {
2342
+ number: number;
2343
+ status: string;
2344
+ id: string;
2345
+ startedAt: Date;
2346
+ backgroundWorkerId: string;
2347
+ backgroundWorkerTaskId: string;
2348
+ };
2298
2349
  task: {
2299
2350
  id: string;
2300
2351
  filePath: string;
@@ -2342,38 +2393,39 @@ export declare const V3TaskRunExecution: z.ZodObject<{
2342
2393
  name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
2343
2394
  centsPerMs: number;
2344
2395
  };
2345
- attempt: {
2346
- number: number;
2347
- status: string;
2396
+ batch?: {
2348
2397
  id: string;
2349
- startedAt: Date;
2350
- backgroundWorkerId: string;
2351
- backgroundWorkerTaskId: string;
2352
- };
2398
+ } | undefined;
2399
+ }, {
2353
2400
  run: {
2354
2401
  payload: string;
2355
2402
  id: string;
2356
2403
  payloadType: string;
2357
2404
  tags: string[];
2358
- isTest: boolean;
2359
2405
  createdAt: Date;
2360
- startedAt: Date;
2361
2406
  baseCostInCents: number;
2362
2407
  durationMs: number;
2363
2408
  costInCents: number;
2364
2409
  context?: unknown;
2365
2410
  metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
2411
+ isTest?: boolean | undefined;
2412
+ startedAt?: Date | undefined;
2366
2413
  idempotencyKey?: string | undefined;
2414
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
2367
2415
  maxAttempts?: number | undefined;
2368
2416
  version?: string | undefined;
2369
2417
  maxDuration?: number | undefined;
2370
2418
  } & {
2371
2419
  traceContext?: Record<string, unknown> | undefined;
2372
2420
  };
2373
- batch?: {
2421
+ attempt: {
2422
+ number: number;
2423
+ status: string;
2374
2424
  id: string;
2375
- } | undefined;
2376
- }, {
2425
+ startedAt: Date;
2426
+ backgroundWorkerId: string;
2427
+ backgroundWorkerTaskId: string;
2428
+ };
2377
2429
  task: {
2378
2430
  id: string;
2379
2431
  filePath: string;
@@ -2421,34 +2473,6 @@ export declare const V3TaskRunExecution: z.ZodObject<{
2421
2473
  name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
2422
2474
  centsPerMs: number;
2423
2475
  };
2424
- attempt: {
2425
- number: number;
2426
- status: string;
2427
- id: string;
2428
- startedAt: Date;
2429
- backgroundWorkerId: string;
2430
- backgroundWorkerTaskId: string;
2431
- };
2432
- run: {
2433
- payload: string;
2434
- id: string;
2435
- payloadType: string;
2436
- tags: string[];
2437
- createdAt: Date;
2438
- baseCostInCents: number;
2439
- durationMs: number;
2440
- costInCents: number;
2441
- context?: unknown;
2442
- metadata?: Record<string, import("../../schemas/json.js").DeserializedJson> | undefined;
2443
- isTest?: boolean | undefined;
2444
- startedAt?: Date | undefined;
2445
- idempotencyKey?: string | undefined;
2446
- maxAttempts?: number | undefined;
2447
- version?: string | undefined;
2448
- maxDuration?: number | undefined;
2449
- } & {
2450
- traceContext?: Record<string, unknown> | undefined;
2451
- };
2452
2476
  batch?: {
2453
2477
  id: string;
2454
2478
  } | undefined;
@@ -2728,7 +2752,10 @@ export declare const TaskRunContext: z.ZodObject<{
2728
2752
  isTest: z.ZodDefault<z.ZodBoolean>;
2729
2753
  createdAt: z.ZodDate;
2730
2754
  startedAt: z.ZodDefault<z.ZodDate>;
2755
+ /** The user-provided idempotency key (not the hash) */
2731
2756
  idempotencyKey: z.ZodOptional<z.ZodString>;
2757
+ /** The scope of the idempotency key */
2758
+ idempotencyKeyScope: z.ZodOptional<z.ZodEnum<["run", "attempt", "global"]>>;
2732
2759
  maxAttempts: z.ZodOptional<z.ZodNumber>;
2733
2760
  version: z.ZodOptional<z.ZodString>;
2734
2761
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../schemas/json.js").DeserializedJson, z.ZodTypeDef, import("../../schemas/json.js").DeserializedJson>>>;
@@ -2748,6 +2775,7 @@ export declare const TaskRunContext: z.ZodObject<{
2748
2775
  createdAt: Date;
2749
2776
  startedAt: Date;
2750
2777
  idempotencyKey?: string | undefined;
2778
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
2751
2779
  maxAttempts?: number | undefined;
2752
2780
  version?: string | undefined;
2753
2781
  maxDuration?: number | undefined;
@@ -2763,6 +2791,7 @@ export declare const TaskRunContext: z.ZodObject<{
2763
2791
  isTest?: boolean | undefined;
2764
2792
  startedAt?: Date | undefined;
2765
2793
  idempotencyKey?: string | undefined;
2794
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
2766
2795
  maxAttempts?: number | undefined;
2767
2796
  version?: string | undefined;
2768
2797
  maxDuration?: number | undefined;
@@ -2773,6 +2802,27 @@ export declare const TaskRunContext: z.ZodObject<{
2773
2802
  region?: string | undefined;
2774
2803
  }>;
2775
2804
  }, "strip", z.ZodTypeAny, {
2805
+ run: {
2806
+ id: string;
2807
+ tags: string[];
2808
+ isTest: boolean;
2809
+ createdAt: Date;
2810
+ startedAt: Date;
2811
+ idempotencyKey?: string | undefined;
2812
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
2813
+ maxAttempts?: number | undefined;
2814
+ version?: string | undefined;
2815
+ maxDuration?: number | undefined;
2816
+ priority?: number | undefined;
2817
+ baseCostInCents?: number | undefined;
2818
+ parentTaskRunId?: string | undefined;
2819
+ rootTaskRunId?: string | undefined;
2820
+ region?: string | undefined;
2821
+ };
2822
+ attempt: {
2823
+ number: number;
2824
+ startedAt: Date;
2825
+ };
2776
2826
  task: {
2777
2827
  id: string;
2778
2828
  filePath: string;
@@ -2821,26 +2871,6 @@ export declare const TaskRunContext: z.ZodObject<{
2821
2871
  name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
2822
2872
  centsPerMs: number;
2823
2873
  };
2824
- attempt: {
2825
- number: number;
2826
- startedAt: Date;
2827
- };
2828
- run: {
2829
- id: string;
2830
- tags: string[];
2831
- isTest: boolean;
2832
- createdAt: Date;
2833
- startedAt: Date;
2834
- idempotencyKey?: string | undefined;
2835
- maxAttempts?: number | undefined;
2836
- version?: string | undefined;
2837
- maxDuration?: number | undefined;
2838
- priority?: number | undefined;
2839
- baseCostInCents?: number | undefined;
2840
- parentTaskRunId?: string | undefined;
2841
- rootTaskRunId?: string | undefined;
2842
- region?: string | undefined;
2843
- };
2844
2874
  batch?: {
2845
2875
  id: string;
2846
2876
  } | undefined;
@@ -2867,6 +2897,27 @@ export declare const TaskRunContext: z.ZodObject<{
2867
2897
  } | undefined;
2868
2898
  } | undefined;
2869
2899
  }, {
2900
+ run: {
2901
+ id: string;
2902
+ tags: string[];
2903
+ createdAt: Date;
2904
+ isTest?: boolean | undefined;
2905
+ startedAt?: Date | undefined;
2906
+ idempotencyKey?: string | undefined;
2907
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
2908
+ maxAttempts?: number | undefined;
2909
+ version?: string | undefined;
2910
+ maxDuration?: number | undefined;
2911
+ priority?: number | undefined;
2912
+ baseCostInCents?: number | undefined;
2913
+ parentTaskRunId?: string | undefined;
2914
+ rootTaskRunId?: string | undefined;
2915
+ region?: string | undefined;
2916
+ };
2917
+ attempt: {
2918
+ number: number;
2919
+ startedAt: Date;
2920
+ };
2870
2921
  task: {
2871
2922
  id: string;
2872
2923
  filePath: string;
@@ -2915,26 +2966,6 @@ export declare const TaskRunContext: z.ZodObject<{
2915
2966
  name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
2916
2967
  centsPerMs: number;
2917
2968
  };
2918
- attempt: {
2919
- number: number;
2920
- startedAt: Date;
2921
- };
2922
- run: {
2923
- id: string;
2924
- tags: string[];
2925
- createdAt: Date;
2926
- isTest?: boolean | undefined;
2927
- startedAt?: Date | undefined;
2928
- idempotencyKey?: string | undefined;
2929
- maxAttempts?: number | undefined;
2930
- version?: string | undefined;
2931
- maxDuration?: number | undefined;
2932
- priority?: number | undefined;
2933
- baseCostInCents?: number | undefined;
2934
- parentTaskRunId?: string | undefined;
2935
- rootTaskRunId?: string | undefined;
2936
- region?: string | undefined;
2937
- };
2938
2969
  batch?: {
2939
2970
  id: string;
2940
2971
  } | undefined;
@@ -3003,7 +3034,10 @@ export declare const V3TaskRunContext: z.ZodObject<{
3003
3034
  isTest: z.ZodDefault<z.ZodBoolean>;
3004
3035
  createdAt: z.ZodDate;
3005
3036
  startedAt: z.ZodDefault<z.ZodDate>;
3037
+ /** The user-provided idempotency key (not the hash) */
3006
3038
  idempotencyKey: z.ZodOptional<z.ZodString>;
3039
+ /** The scope of the idempotency key */
3040
+ idempotencyKeyScope: z.ZodOptional<z.ZodEnum<["run", "attempt", "global"]>>;
3007
3041
  maxAttempts: z.ZodOptional<z.ZodNumber>;
3008
3042
  version: z.ZodOptional<z.ZodString>;
3009
3043
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../schemas/json.js").DeserializedJson, z.ZodTypeDef, import("../../schemas/json.js").DeserializedJson>>>;
@@ -3023,6 +3057,7 @@ export declare const V3TaskRunContext: z.ZodObject<{
3023
3057
  costInCents: number;
3024
3058
  context?: unknown;
3025
3059
  idempotencyKey?: string | undefined;
3060
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
3026
3061
  maxAttempts?: number | undefined;
3027
3062
  version?: string | undefined;
3028
3063
  maxDuration?: number | undefined;
@@ -3037,6 +3072,7 @@ export declare const V3TaskRunContext: z.ZodObject<{
3037
3072
  isTest?: boolean | undefined;
3038
3073
  startedAt?: Date | undefined;
3039
3074
  idempotencyKey?: string | undefined;
3075
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
3040
3076
  maxAttempts?: number | undefined;
3041
3077
  version?: string | undefined;
3042
3078
  maxDuration?: number | undefined;
@@ -3132,6 +3168,28 @@ export declare const V3TaskRunContext: z.ZodObject<{
3132
3168
  centsPerMs: number;
3133
3169
  }>>;
3134
3170
  }, "strip", z.ZodTypeAny, {
3171
+ run: {
3172
+ id: string;
3173
+ tags: string[];
3174
+ isTest: boolean;
3175
+ createdAt: Date;
3176
+ startedAt: Date;
3177
+ baseCostInCents: number;
3178
+ durationMs: number;
3179
+ costInCents: number;
3180
+ context?: unknown;
3181
+ idempotencyKey?: string | undefined;
3182
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
3183
+ maxAttempts?: number | undefined;
3184
+ version?: string | undefined;
3185
+ maxDuration?: number | undefined;
3186
+ };
3187
+ attempt: {
3188
+ number: number;
3189
+ status: string;
3190
+ id: string;
3191
+ startedAt: Date;
3192
+ };
3135
3193
  task: {
3136
3194
  id: string;
3137
3195
  filePath: string;
@@ -3157,37 +3215,38 @@ export declare const V3TaskRunContext: z.ZodObject<{
3157
3215
  slug: string;
3158
3216
  ref: string;
3159
3217
  };
3160
- attempt: {
3161
- number: number;
3162
- status: string;
3218
+ machine?: {
3219
+ cpu: number;
3220
+ memory: number;
3221
+ name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
3222
+ centsPerMs: number;
3223
+ } | undefined;
3224
+ batch?: {
3163
3225
  id: string;
3164
- startedAt: Date;
3165
- };
3226
+ } | undefined;
3227
+ }, {
3166
3228
  run: {
3167
3229
  id: string;
3168
3230
  tags: string[];
3169
- isTest: boolean;
3170
3231
  createdAt: Date;
3171
- startedAt: Date;
3172
3232
  baseCostInCents: number;
3173
3233
  durationMs: number;
3174
3234
  costInCents: number;
3175
3235
  context?: unknown;
3236
+ isTest?: boolean | undefined;
3237
+ startedAt?: Date | undefined;
3176
3238
  idempotencyKey?: string | undefined;
3239
+ idempotencyKeyScope?: "run" | "attempt" | "global" | undefined;
3177
3240
  maxAttempts?: number | undefined;
3178
3241
  version?: string | undefined;
3179
3242
  maxDuration?: number | undefined;
3180
3243
  };
3181
- machine?: {
3182
- cpu: number;
3183
- memory: number;
3184
- name: "micro" | "small-1x" | "small-2x" | "medium-1x" | "medium-2x" | "large-1x" | "large-2x";
3185
- centsPerMs: number;
3186
- } | undefined;
3187
- batch?: {
3244
+ attempt: {
3245
+ number: number;
3246
+ status: string;
3188
3247
  id: string;
3189
- } | undefined;
3190
- }, {
3248
+ startedAt: Date;
3249
+ };
3191
3250
  task: {
3192
3251
  id: string;
3193
3252
  filePath: string;
@@ -3213,27 +3272,6 @@ export declare const V3TaskRunContext: z.ZodObject<{
3213
3272
  slug: string;
3214
3273
  ref: string;
3215
3274
  };
3216
- attempt: {
3217
- number: number;
3218
- status: string;
3219
- id: string;
3220
- startedAt: Date;
3221
- };
3222
- run: {
3223
- id: string;
3224
- tags: string[];
3225
- createdAt: Date;
3226
- baseCostInCents: number;
3227
- durationMs: number;
3228
- costInCents: number;
3229
- context?: unknown;
3230
- isTest?: boolean | undefined;
3231
- startedAt?: Date | undefined;
3232
- idempotencyKey?: string | undefined;
3233
- maxAttempts?: number | undefined;
3234
- version?: string | undefined;
3235
- maxDuration?: number | undefined;
3236
- };
3237
3275
  machine?: {
3238
3276
  cpu: number;
3239
3277
  memory: number;
@@ -152,7 +152,10 @@ export const TaskRun = z.object({
152
152
  isTest: z.boolean().default(false),
153
153
  createdAt: z.coerce.date(),
154
154
  startedAt: z.coerce.date().default(() => new Date()),
155
+ /** The user-provided idempotency key (not the hash) */
155
156
  idempotencyKey: z.string().optional(),
157
+ /** The scope of the idempotency key */
158
+ idempotencyKeyScope: z.enum(["run", "attempt", "global"]).optional(),
156
159
  maxAttempts: z.number().optional(),
157
160
  version: z.string().optional(),
158
161
  metadata: z.record(DeserializedJsonSchema).optional(),
@@ -266,7 +269,10 @@ export const V3TaskRun = z.object({
266
269
  isTest: z.boolean().default(false),
267
270
  createdAt: z.coerce.date(),
268
271
  startedAt: z.coerce.date().default(() => new Date()),
272
+ /** The user-provided idempotency key (not the hash) */
269
273
  idempotencyKey: z.string().optional(),
274
+ /** The scope of the idempotency key */
275
+ idempotencyKeyScope: z.enum(["run", "attempt", "global"]).optional(),
270
276
  maxAttempts: z.number().optional(),
271
277
  version: z.string().optional(),
272
278
  metadata: z.record(DeserializedJsonSchema).optional(),