@hatchet-dev/typescript-sdk 1.21.2 → 1.22.0

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 (48) hide show
  1. package/clients/hatchet-client/client-config.d.ts +27 -133
  2. package/clients/hatchet-client/client-config.js +24 -24
  3. package/legacy/legacy-client.js +2 -2
  4. package/legacy/step.d.ts +22 -121
  5. package/legacy/step.js +7 -4
  6. package/legacy/workflow.d.ts +46 -420
  7. package/legacy/workflow.js +5 -5
  8. package/package.json +12 -6
  9. package/util/config-loader/config-loader.js +2 -2
  10. package/util/uuid.js +2 -2
  11. package/v1/agent/claude.d.ts +17 -0
  12. package/v1/agent/claude.js +83 -0
  13. package/v1/agent/openai.d.ts +4 -0
  14. package/v1/agent/openai.js +83 -0
  15. package/v1/client/client.js +2 -2
  16. package/v1/client/features/crons.d.ts +3 -15
  17. package/v1/client/features/crons.js +8 -8
  18. package/v1/client/features/schedules.d.ts +6 -20
  19. package/v1/client/features/schedules.js +10 -10
  20. package/v1/client/worker/context.d.ts +1 -1
  21. package/v1/client/worker/worker-internal.js +2 -2
  22. package/v1/declaration.d.ts +18 -1
  23. package/v1/declaration.js +10 -0
  24. package/v1/examples/agent/agent-claude.d.ts +1 -0
  25. package/v1/examples/agent/agent-claude.js +68 -0
  26. package/v1/examples/agent/agent-openai.d.ts +1 -0
  27. package/v1/examples/agent/agent-openai.js +72 -0
  28. package/v1/examples/agent/worker.d.ts +1 -0
  29. package/v1/examples/agent/worker.js +24 -0
  30. package/v1/examples/agent/workflow.d.ts +26 -0
  31. package/v1/examples/agent/workflow.js +48 -0
  32. package/v1/examples/durable/workflow.d.ts +6 -2
  33. package/v1/examples/durable/workflow.js +9 -6
  34. package/v1/examples/durable_eviction/workflow.js +6 -0
  35. package/v1/examples/e2e-worker.js +7 -0
  36. package/v1/examples/simple/run.js +5 -0
  37. package/v1/examples/simple/zod.d.ts +2 -6
  38. package/v1/examples/simple/zod.js +1 -1
  39. package/v1/examples/support_agent/run.d.ts +1 -0
  40. package/v1/examples/support_agent/run.js +42 -0
  41. package/v1/examples/support_agent/workflow.d.ts +43 -0
  42. package/v1/examples/support_agent/workflow.js +140 -0
  43. package/v1/examples/welcome_email/run.d.ts +1 -0
  44. package/v1/examples/welcome_email/run.js +40 -0
  45. package/v1/examples/welcome_email/workflow.d.ts +11 -0
  46. package/v1/examples/welcome_email/workflow.js +52 -0
  47. package/version.d.ts +1 -1
  48. package/version.js +1 -1
@@ -1,480 +1,106 @@
1
- import * as z from 'zod';
1
+ import * as z from 'zod/v4';
2
2
  import { CreateStep } from '../step';
3
3
  import { ConcurrencyLimitStrategy as PbConcurrencyLimitStrategy, StickyStrategy as PbStickyStrategy } from '../protoc/workflows';
4
4
  declare const StepsSchema: z.ZodArray<z.ZodObject<{
5
5
  name: z.ZodString;
6
- parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6
+ parents: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
7
  timeout: z.ZodOptional<z.ZodString>;
8
8
  retries: z.ZodOptional<z.ZodNumber>;
9
9
  rate_limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
10
10
  key: z.ZodOptional<z.ZodString>;
11
11
  staticKey: z.ZodOptional<z.ZodString>;
12
12
  dynamicKey: z.ZodOptional<z.ZodString>;
13
- units: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
14
- limit: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
15
- duration: z.ZodOptional<z.ZodNativeEnum<typeof import("../protoc/workflows").RateLimitDuration>>;
16
- }, "strip", z.ZodTypeAny, {
17
- units: string | number;
18
- key?: string | undefined;
19
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
20
- limit?: string | number | undefined;
21
- staticKey?: string | undefined;
22
- dynamicKey?: string | undefined;
23
- }, {
24
- units: string | number;
25
- key?: string | undefined;
26
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
27
- limit?: string | number | undefined;
28
- staticKey?: string | undefined;
29
- dynamicKey?: string | undefined;
30
- }>, "many">>;
31
- worker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodObject<{
32
- value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
13
+ units: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
14
+ limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
15
+ duration: z.ZodOptional<z.ZodEnum<typeof import("../protoc/workflows").RateLimitDuration>>;
16
+ }, z.core.$strip>>>;
17
+ worker_labels: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodLazy<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodObject<{
18
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
33
19
  required: z.ZodOptional<z.ZodBoolean>;
34
20
  weight: z.ZodOptional<z.ZodNumber>;
35
- comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("..").WorkerLabelComparator>>;
36
- }, "strip", z.ZodTypeAny, {
37
- value: string | number;
38
- required?: boolean | undefined;
39
- comparator?: import("..").WorkerLabelComparator | undefined;
40
- weight?: number | undefined;
41
- }, {
42
- value: string | number;
43
- required?: boolean | undefined;
44
- comparator?: import("..").WorkerLabelComparator | undefined;
45
- weight?: number | undefined;
46
- }>]>>>>>;
21
+ comparator: z.ZodOptional<z.ZodEnum<typeof import("..").WorkerLabelComparator>>;
22
+ }, z.core.$strip>]>>>>>;
47
23
  backoff: z.ZodOptional<z.ZodObject<{
48
24
  factor: z.ZodOptional<z.ZodNumber>;
49
25
  maxSeconds: z.ZodOptional<z.ZodNumber>;
50
- }, "strip", z.ZodTypeAny, {
51
- factor?: number | undefined;
52
- maxSeconds?: number | undefined;
53
- }, {
54
- factor?: number | undefined;
55
- maxSeconds?: number | undefined;
56
- }>>;
57
- }, "strip", z.ZodTypeAny, {
58
- name: string;
59
- timeout?: string | undefined;
60
- parents?: string[] | undefined;
61
- retries?: number | undefined;
62
- backoff?: {
63
- factor?: number | undefined;
64
- maxSeconds?: number | undefined;
65
- } | undefined;
66
- rate_limits?: {
67
- units: string | number;
68
- key?: string | undefined;
69
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
70
- limit?: string | number | undefined;
71
- staticKey?: string | undefined;
72
- dynamicKey?: string | undefined;
73
- }[] | undefined;
74
- worker_labels?: Record<string, string | number | {
75
- value: string | number;
76
- required?: boolean | undefined;
77
- comparator?: import("..").WorkerLabelComparator | undefined;
78
- weight?: number | undefined;
79
- } | undefined> | undefined;
80
- }, {
81
- name: string;
82
- timeout?: string | undefined;
83
- parents?: string[] | undefined;
84
- retries?: number | undefined;
85
- backoff?: {
86
- factor?: number | undefined;
87
- maxSeconds?: number | undefined;
88
- } | undefined;
89
- rate_limits?: {
90
- units: string | number;
91
- key?: string | undefined;
92
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
93
- limit?: string | number | undefined;
94
- staticKey?: string | undefined;
95
- dynamicKey?: string | undefined;
96
- }[] | undefined;
97
- worker_labels?: Record<string, string | number | {
98
- value: string | number;
99
- required?: boolean | undefined;
100
- comparator?: import("..").WorkerLabelComparator | undefined;
101
- weight?: number | undefined;
102
- } | undefined> | undefined;
103
- }>, "many">;
26
+ }, z.core.$strip>>;
27
+ }, z.core.$strip>>;
104
28
  export type Steps = z.infer<typeof StepsSchema>;
105
29
  export declare const ConcurrencyLimitStrategy: typeof PbConcurrencyLimitStrategy;
106
30
  export declare const WorkflowConcurrency: z.ZodObject<{
107
31
  name: z.ZodString;
108
32
  maxRuns: z.ZodOptional<z.ZodNumber>;
109
- limitStrategy: z.ZodOptional<z.ZodNativeEnum<typeof PbConcurrencyLimitStrategy>>;
33
+ limitStrategy: z.ZodOptional<z.ZodEnum<typeof PbConcurrencyLimitStrategy>>;
110
34
  expression: z.ZodOptional<z.ZodString>;
111
- }, "strip", z.ZodTypeAny, {
112
- name: string;
113
- maxRuns?: number | undefined;
114
- limitStrategy?: PbConcurrencyLimitStrategy | undefined;
115
- expression?: string | undefined;
116
- }, {
117
- name: string;
118
- maxRuns?: number | undefined;
119
- limitStrategy?: PbConcurrencyLimitStrategy | undefined;
120
- expression?: string | undefined;
121
- }>;
35
+ }, z.core.$strip>;
122
36
  export declare const HatchetTimeoutSchema: z.ZodString;
123
37
  export declare const StickyStrategy: typeof PbStickyStrategy;
124
38
  export declare const CreateWorkflowSchema: z.ZodObject<{
125
39
  id: z.ZodString;
126
40
  description: z.ZodString;
127
41
  version: z.ZodOptional<z.ZodString>;
128
- sticky: z.ZodOptional<z.ZodUnion<[z.ZodNativeEnum<typeof PbStickyStrategy>, z.ZodEnum<["soft", "hard"]>]>>;
42
+ sticky: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<typeof PbStickyStrategy>, z.ZodEnum<{
43
+ soft: "soft";
44
+ hard: "hard";
45
+ }>]>>;
129
46
  scheduleTimeout: z.ZodOptional<z.ZodString>;
130
- /**
131
- * @deprecated Workflow timeout is deprecated. Use step timeouts instead.
132
- */
133
47
  timeout: z.ZodOptional<z.ZodString>;
134
- on: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
48
+ on: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
135
49
  cron: z.ZodString;
136
- event: z.ZodUndefined;
137
- }, "strip", z.ZodTypeAny, {
138
- cron: string;
139
- event?: undefined;
140
- }, {
141
- cron: string;
142
- event?: undefined;
143
- }>, z.ZodObject<{
144
- cron: z.ZodUndefined;
50
+ event: z.ZodOptional<z.ZodUndefined>;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ cron: z.ZodOptional<z.ZodUndefined>;
145
53
  event: z.ZodString;
146
- }, "strip", z.ZodTypeAny, {
147
- event: string;
148
- cron?: undefined;
149
- }, {
150
- event: string;
151
- cron?: undefined;
152
- }>]>>;
54
+ }, z.core.$strip>]>>;
153
55
  steps: z.ZodArray<z.ZodObject<{
154
56
  name: z.ZodString;
155
- parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
57
+ parents: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
58
  timeout: z.ZodOptional<z.ZodString>;
157
59
  retries: z.ZodOptional<z.ZodNumber>;
158
60
  rate_limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
159
61
  key: z.ZodOptional<z.ZodString>;
160
62
  staticKey: z.ZodOptional<z.ZodString>;
161
63
  dynamicKey: z.ZodOptional<z.ZodString>;
162
- units: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
163
- limit: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
164
- duration: z.ZodOptional<z.ZodNativeEnum<typeof import("../protoc/workflows").RateLimitDuration>>;
165
- }, "strip", z.ZodTypeAny, {
166
- units: string | number;
167
- key?: string | undefined;
168
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
169
- limit?: string | number | undefined;
170
- staticKey?: string | undefined;
171
- dynamicKey?: string | undefined;
172
- }, {
173
- units: string | number;
174
- key?: string | undefined;
175
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
176
- limit?: string | number | undefined;
177
- staticKey?: string | undefined;
178
- dynamicKey?: string | undefined;
179
- }>, "many">>;
180
- worker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodObject<{
181
- value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
64
+ units: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
65
+ limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
66
+ duration: z.ZodOptional<z.ZodEnum<typeof import("../protoc/workflows").RateLimitDuration>>;
67
+ }, z.core.$strip>>>;
68
+ worker_labels: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodLazy<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodObject<{
69
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
182
70
  required: z.ZodOptional<z.ZodBoolean>;
183
71
  weight: z.ZodOptional<z.ZodNumber>;
184
- comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("..").WorkerLabelComparator>>;
185
- }, "strip", z.ZodTypeAny, {
186
- value: string | number;
187
- required?: boolean | undefined;
188
- comparator?: import("..").WorkerLabelComparator | undefined;
189
- weight?: number | undefined;
190
- }, {
191
- value: string | number;
192
- required?: boolean | undefined;
193
- comparator?: import("..").WorkerLabelComparator | undefined;
194
- weight?: number | undefined;
195
- }>]>>>>>;
72
+ comparator: z.ZodOptional<z.ZodEnum<typeof import("..").WorkerLabelComparator>>;
73
+ }, z.core.$strip>]>>>>>;
196
74
  backoff: z.ZodOptional<z.ZodObject<{
197
75
  factor: z.ZodOptional<z.ZodNumber>;
198
76
  maxSeconds: z.ZodOptional<z.ZodNumber>;
199
- }, "strip", z.ZodTypeAny, {
200
- factor?: number | undefined;
201
- maxSeconds?: number | undefined;
202
- }, {
203
- factor?: number | undefined;
204
- maxSeconds?: number | undefined;
205
- }>>;
206
- }, "strip", z.ZodTypeAny, {
207
- name: string;
208
- timeout?: string | undefined;
209
- parents?: string[] | undefined;
210
- retries?: number | undefined;
211
- backoff?: {
212
- factor?: number | undefined;
213
- maxSeconds?: number | undefined;
214
- } | undefined;
215
- rate_limits?: {
216
- units: string | number;
217
- key?: string | undefined;
218
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
219
- limit?: string | number | undefined;
220
- staticKey?: string | undefined;
221
- dynamicKey?: string | undefined;
222
- }[] | undefined;
223
- worker_labels?: Record<string, string | number | {
224
- value: string | number;
225
- required?: boolean | undefined;
226
- comparator?: import("..").WorkerLabelComparator | undefined;
227
- weight?: number | undefined;
228
- } | undefined> | undefined;
229
- }, {
230
- name: string;
231
- timeout?: string | undefined;
232
- parents?: string[] | undefined;
233
- retries?: number | undefined;
234
- backoff?: {
235
- factor?: number | undefined;
236
- maxSeconds?: number | undefined;
237
- } | undefined;
238
- rate_limits?: {
239
- units: string | number;
240
- key?: string | undefined;
241
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
242
- limit?: string | number | undefined;
243
- staticKey?: string | undefined;
244
- dynamicKey?: string | undefined;
245
- }[] | undefined;
246
- worker_labels?: Record<string, string | number | {
247
- value: string | number;
248
- required?: boolean | undefined;
249
- comparator?: import("..").WorkerLabelComparator | undefined;
250
- weight?: number | undefined;
251
- } | undefined> | undefined;
252
- }>, "many">;
77
+ }, z.core.$strip>>;
78
+ }, z.core.$strip>>;
253
79
  onFailure: z.ZodOptional<z.ZodObject<{
254
80
  name: z.ZodString;
255
- parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
81
+ parents: z.ZodOptional<z.ZodArray<z.ZodString>>;
256
82
  timeout: z.ZodOptional<z.ZodString>;
257
83
  retries: z.ZodOptional<z.ZodNumber>;
258
84
  rate_limits: z.ZodOptional<z.ZodArray<z.ZodObject<{
259
85
  key: z.ZodOptional<z.ZodString>;
260
86
  staticKey: z.ZodOptional<z.ZodString>;
261
87
  dynamicKey: z.ZodOptional<z.ZodString>;
262
- units: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
263
- limit: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
264
- duration: z.ZodOptional<z.ZodNativeEnum<typeof import("../protoc/workflows").RateLimitDuration>>;
265
- }, "strip", z.ZodTypeAny, {
266
- units: string | number;
267
- key?: string | undefined;
268
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
269
- limit?: string | number | undefined;
270
- staticKey?: string | undefined;
271
- dynamicKey?: string | undefined;
272
- }, {
273
- units: string | number;
274
- key?: string | undefined;
275
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
276
- limit?: string | number | undefined;
277
- staticKey?: string | undefined;
278
- dynamicKey?: string | undefined;
279
- }>, "many">>;
280
- worker_labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodObject<{
281
- value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
88
+ units: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
89
+ limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
90
+ duration: z.ZodOptional<z.ZodEnum<typeof import("../protoc/workflows").RateLimitDuration>>;
91
+ }, z.core.$strip>>>;
92
+ worker_labels: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodLazy<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodObject<{
93
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
282
94
  required: z.ZodOptional<z.ZodBoolean>;
283
95
  weight: z.ZodOptional<z.ZodNumber>;
284
- comparator: z.ZodOptional<z.ZodNativeEnum<typeof import("..").WorkerLabelComparator>>;
285
- }, "strip", z.ZodTypeAny, {
286
- value: string | number;
287
- required?: boolean | undefined;
288
- comparator?: import("..").WorkerLabelComparator | undefined;
289
- weight?: number | undefined;
290
- }, {
291
- value: string | number;
292
- required?: boolean | undefined;
293
- comparator?: import("..").WorkerLabelComparator | undefined;
294
- weight?: number | undefined;
295
- }>]>>>>>;
96
+ comparator: z.ZodOptional<z.ZodEnum<typeof import("..").WorkerLabelComparator>>;
97
+ }, z.core.$strip>]>>>>>;
296
98
  backoff: z.ZodOptional<z.ZodObject<{
297
99
  factor: z.ZodOptional<z.ZodNumber>;
298
100
  maxSeconds: z.ZodOptional<z.ZodNumber>;
299
- }, "strip", z.ZodTypeAny, {
300
- factor?: number | undefined;
301
- maxSeconds?: number | undefined;
302
- }, {
303
- factor?: number | undefined;
304
- maxSeconds?: number | undefined;
305
- }>>;
306
- }, "strip", z.ZodTypeAny, {
307
- name: string;
308
- timeout?: string | undefined;
309
- parents?: string[] | undefined;
310
- retries?: number | undefined;
311
- backoff?: {
312
- factor?: number | undefined;
313
- maxSeconds?: number | undefined;
314
- } | undefined;
315
- rate_limits?: {
316
- units: string | number;
317
- key?: string | undefined;
318
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
319
- limit?: string | number | undefined;
320
- staticKey?: string | undefined;
321
- dynamicKey?: string | undefined;
322
- }[] | undefined;
323
- worker_labels?: Record<string, string | number | {
324
- value: string | number;
325
- required?: boolean | undefined;
326
- comparator?: import("..").WorkerLabelComparator | undefined;
327
- weight?: number | undefined;
328
- } | undefined> | undefined;
329
- }, {
330
- name: string;
331
- timeout?: string | undefined;
332
- parents?: string[] | undefined;
333
- retries?: number | undefined;
334
- backoff?: {
335
- factor?: number | undefined;
336
- maxSeconds?: number | undefined;
337
- } | undefined;
338
- rate_limits?: {
339
- units: string | number;
340
- key?: string | undefined;
341
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
342
- limit?: string | number | undefined;
343
- staticKey?: string | undefined;
344
- dynamicKey?: string | undefined;
345
- }[] | undefined;
346
- worker_labels?: Record<string, string | number | {
347
- value: string | number;
348
- required?: boolean | undefined;
349
- comparator?: import("..").WorkerLabelComparator | undefined;
350
- weight?: number | undefined;
351
- } | undefined> | undefined;
352
- }>>;
353
- }, "strip", z.ZodTypeAny, {
354
- description: string;
355
- steps: {
356
- name: string;
357
- timeout?: string | undefined;
358
- parents?: string[] | undefined;
359
- retries?: number | undefined;
360
- backoff?: {
361
- factor?: number | undefined;
362
- maxSeconds?: number | undefined;
363
- } | undefined;
364
- rate_limits?: {
365
- units: string | number;
366
- key?: string | undefined;
367
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
368
- limit?: string | number | undefined;
369
- staticKey?: string | undefined;
370
- dynamicKey?: string | undefined;
371
- }[] | undefined;
372
- worker_labels?: Record<string, string | number | {
373
- value: string | number;
374
- required?: boolean | undefined;
375
- comparator?: import("..").WorkerLabelComparator | undefined;
376
- weight?: number | undefined;
377
- } | undefined> | undefined;
378
- }[];
379
- id: string;
380
- version?: string | undefined;
381
- timeout?: string | undefined;
382
- scheduleTimeout?: string | undefined;
383
- sticky?: PbStickyStrategy | "soft" | "hard" | undefined;
384
- on?: {
385
- cron: string;
386
- event?: undefined;
387
- } | {
388
- event: string;
389
- cron?: undefined;
390
- } | undefined;
391
- onFailure?: {
392
- name: string;
393
- timeout?: string | undefined;
394
- parents?: string[] | undefined;
395
- retries?: number | undefined;
396
- backoff?: {
397
- factor?: number | undefined;
398
- maxSeconds?: number | undefined;
399
- } | undefined;
400
- rate_limits?: {
401
- units: string | number;
402
- key?: string | undefined;
403
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
404
- limit?: string | number | undefined;
405
- staticKey?: string | undefined;
406
- dynamicKey?: string | undefined;
407
- }[] | undefined;
408
- worker_labels?: Record<string, string | number | {
409
- value: string | number;
410
- required?: boolean | undefined;
411
- comparator?: import("..").WorkerLabelComparator | undefined;
412
- weight?: number | undefined;
413
- } | undefined> | undefined;
414
- } | undefined;
415
- }, {
416
- description: string;
417
- steps: {
418
- name: string;
419
- timeout?: string | undefined;
420
- parents?: string[] | undefined;
421
- retries?: number | undefined;
422
- backoff?: {
423
- factor?: number | undefined;
424
- maxSeconds?: number | undefined;
425
- } | undefined;
426
- rate_limits?: {
427
- units: string | number;
428
- key?: string | undefined;
429
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
430
- limit?: string | number | undefined;
431
- staticKey?: string | undefined;
432
- dynamicKey?: string | undefined;
433
- }[] | undefined;
434
- worker_labels?: Record<string, string | number | {
435
- value: string | number;
436
- required?: boolean | undefined;
437
- comparator?: import("..").WorkerLabelComparator | undefined;
438
- weight?: number | undefined;
439
- } | undefined> | undefined;
440
- }[];
441
- id: string;
442
- version?: string | undefined;
443
- timeout?: string | undefined;
444
- scheduleTimeout?: string | undefined;
445
- sticky?: PbStickyStrategy | "soft" | "hard" | undefined;
446
- on?: {
447
- cron: string;
448
- event?: undefined;
449
- } | {
450
- event: string;
451
- cron?: undefined;
452
- } | undefined;
453
- onFailure?: {
454
- name: string;
455
- timeout?: string | undefined;
456
- parents?: string[] | undefined;
457
- retries?: number | undefined;
458
- backoff?: {
459
- factor?: number | undefined;
460
- maxSeconds?: number | undefined;
461
- } | undefined;
462
- rate_limits?: {
463
- units: string | number;
464
- key?: string | undefined;
465
- duration?: import("../protoc/workflows").RateLimitDuration | undefined;
466
- limit?: string | number | undefined;
467
- staticKey?: string | undefined;
468
- dynamicKey?: string | undefined;
469
- }[] | undefined;
470
- worker_labels?: Record<string, string | number | {
471
- value: string | number;
472
- required?: boolean | undefined;
473
- comparator?: import("..").WorkerLabelComparator | undefined;
474
- weight?: number | undefined;
475
- } | undefined> | undefined;
476
- } | undefined;
477
- }>;
101
+ }, z.core.$strip>>;
102
+ }, z.core.$strip>>;
103
+ }, z.core.$strip>;
478
104
  /**
479
105
  * @deprecated Use client.workflow instead (TODO link to migration doc)
480
106
  */
@@ -34,15 +34,15 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.CreateWorkflowSchema = exports.StickyStrategy = exports.HatchetTimeoutSchema = exports.WorkflowConcurrency = exports.ConcurrencyLimitStrategy = void 0;
37
- const z = __importStar(require("zod"));
37
+ const z = __importStar(require("zod/v4"));
38
38
  const step_1 = require("../step");
39
39
  const workflows_1 = require("../protoc/workflows");
40
40
  const CronConfigSchema = z.object({
41
41
  cron: z.string(),
42
- event: z.undefined(),
42
+ event: z.undefined().optional(),
43
43
  });
44
44
  const EventConfigSchema = z.object({
45
- cron: z.undefined(),
45
+ cron: z.undefined().optional(),
46
46
  event: z.string(),
47
47
  });
48
48
  const OnConfigSchema = z.union([CronConfigSchema, EventConfigSchema]).optional();
@@ -51,7 +51,7 @@ exports.ConcurrencyLimitStrategy = workflows_1.ConcurrencyLimitStrategy;
51
51
  exports.WorkflowConcurrency = z.object({
52
52
  name: z.string(),
53
53
  maxRuns: z.number().optional(),
54
- limitStrategy: z.nativeEnum(exports.ConcurrencyLimitStrategy).optional(),
54
+ limitStrategy: z.enum(exports.ConcurrencyLimitStrategy).optional(),
55
55
  expression: z.string().optional(),
56
56
  });
57
57
  exports.HatchetTimeoutSchema = z.string();
@@ -60,7 +60,7 @@ exports.CreateWorkflowSchema = z.object({
60
60
  id: z.string(),
61
61
  description: z.string(),
62
62
  version: z.string().optional(),
63
- sticky: z.union([z.nativeEnum(workflows_1.StickyStrategy), z.enum(['soft', 'hard'])]).optional(),
63
+ sticky: z.union([z.enum(workflows_1.StickyStrategy), z.enum(['soft', 'hard'])]).optional(),
64
64
  scheduleTimeout: z.string().optional(),
65
65
  /**
66
66
  * @deprecated Workflow timeout is deprecated. Use step timeouts instead.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatchet-dev/typescript-sdk",
3
- "version": "1.21.2",
3
+ "version": "1.22.0",
4
4
  "description": "Background task orchestration & visibility for developers",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -20,7 +20,6 @@
20
20
  "license": "MIT",
21
21
  "devDependencies": {
22
22
  "@eslint/js": "^10.0.1",
23
- "@tsd/typescript": "^5.9.3",
24
23
  "@types/jest": "^29.5.14",
25
24
  "@types/node": "^22.13.14",
26
25
  "autoprefixer": "^10.4.27",
@@ -39,6 +38,8 @@
39
38
  "ts-jest": "^29.4.6",
40
39
  "ts-node": "^10.9.2",
41
40
  "ts-proto": "^2.11.4",
41
+ "tsconfig-paths": "^4.2.0",
42
+ "tsx": "^4.21.0",
42
43
  "typedoc": "^0.28.17",
43
44
  "typedoc-plugin-markdown": "^4.10.0",
44
45
  "typedoc-plugin-no-inherit": "^1.6.1",
@@ -57,15 +58,20 @@
57
58
  "qs": "^6.14.2",
58
59
  "semver": "^7.7.4",
59
60
  "yaml": "^2.8.2",
60
- "zod": "^3.24.2",
61
- "zod-to-json-schema": "^3.24.1"
61
+ "zod-to-json-schema": "^3.24.2"
62
+ },
63
+ "peerDependencies": {
64
+ "zod": "^3.25.0 || ^4.0.0"
62
65
  },
63
66
  "optionalDependencies": {
67
+ "@anthropic-ai/claude-agent-sdk": "^0.2.87",
64
68
  "@grpc/grpc-js": "^1.14.3",
69
+ "@modelcontextprotocol/sdk": "^1.29.0",
70
+ "@openai/agents": "0.8.3",
65
71
  "@opentelemetry/api": "^1.9.0",
66
72
  "@opentelemetry/core": "^2.0.0",
67
- "@opentelemetry/exporter-trace-otlp-grpc": "^0.214.0",
68
- "@opentelemetry/instrumentation": "^0.214.0",
73
+ "@opentelemetry/exporter-trace-otlp-grpc": "^0.215.0",
74
+ "@opentelemetry/instrumentation": "^0.215.0",
69
75
  "@opentelemetry/sdk-trace-base": "^2.0.0",
70
76
  "prom-client": "^15.1.3"
71
77
  },
@@ -37,7 +37,7 @@ exports.ConfigLoader = void 0;
37
37
  const yaml_1 = require("yaml");
38
38
  const fs_1 = require("fs");
39
39
  const p = __importStar(require("path"));
40
- const zod_1 = require("zod");
40
+ const v4_1 = require("zod/v4");
41
41
  const hatchet_client_1 = require("../../clients/hatchet-client");
42
42
  const nice_grpc_1 = require("nice-grpc");
43
43
  const token_1 = require("./token");
@@ -136,7 +136,7 @@ class ConfigLoader {
136
136
  if (!path) {
137
137
  return undefined;
138
138
  }
139
- if (e instanceof zod_1.z.ZodError) {
139
+ if (e instanceof v4_1.z.ZodError) {
140
140
  throw new Error(`Invalid yaml config: ${e.message}`, { cause: e });
141
141
  }
142
142
  throw e;
package/util/uuid.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isValidUUID = isValidUUID;
4
- const zod_1 = require("zod");
4
+ const v4_1 = require("zod/v4");
5
5
  function isValidUUID(uuid) {
6
- return zod_1.z.string().uuid().safeParse(uuid).success;
6
+ return v4_1.z.uuid().safeParse(uuid).success;
7
7
  }
@@ -0,0 +1,17 @@
1
+ import { BaseWorkflowDeclaration, InputType, OutputType } from './..';
2
+ import type { SdkMcpToolDefinition } from '@anthropic-ai/claude-agent-sdk';
3
+ import type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';
4
+ export type ClaudeToolFuncT = <I extends InputType, O extends OutputType>(runnable: BaseWorkflowDeclaration<I, O>, annotations?: ToolAnnotations) => SdkMcpToolDefinition;
5
+ export declare const ClaudeToolFunc: <I extends InputType, O extends OutputType>(runnable: BaseWorkflowDeclaration<I, O>, annotations?: ToolAnnotations) => {
6
+ annotations: {
7
+ title?: string | undefined;
8
+ readOnlyHint?: boolean | undefined;
9
+ destructiveHint?: boolean | undefined;
10
+ idempotentHint?: boolean | undefined;
11
+ openWorldHint?: boolean | undefined;
12
+ } | undefined;
13
+ description: string;
14
+ handler: (args: any, _: unknown) => Promise<CallToolResult>;
15
+ name: string;
16
+ inputSchema: any;
17
+ };