@blokjs/helper 0.2.1 → 0.4.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.
@@ -2,34 +2,61 @@ import { z } from "zod";
2
2
  import type { ConditionElseOpts } from "../components/AddElse";
3
3
  import type { ConditionOpts } from "../components/AddIf";
4
4
  /**
5
- * RuntimeKind represents all supported runtime environments
6
- * Synced with @blokjs/runner RuntimeKind type
5
+ * RuntimeKind represents all supported runtime environments.
6
+ *
7
+ * Synced with `@blokjs/runner` `RuntimeKind` type.
7
8
  */
8
9
  export declare const RuntimeKindSchema: z.ZodEnum<["nodejs", "bun", "python3", "go", "java", "rust", "php", "csharp", "ruby", "docker", "wasm"]>;
9
10
  export type RuntimeKind = z.infer<typeof RuntimeKindSchema>;
10
11
  /**
11
- * Node type enum - includes both legacy types and new runtime types
12
+ * Node type enum includes both legacy types and new runtime types.
12
13
  */
13
14
  export declare const NodeTypeSchema: z.ZodEnum<["local", "module", "runtime.python3", "runtime.nodejs", "runtime.bun", "runtime.go", "runtime.java", "runtime.rust", "runtime.php", "runtime.csharp", "runtime.ruby", "runtime.docker", "runtime.wasm"]>;
14
15
  export type NodeType = z.infer<typeof NodeTypeSchema>;
16
+ /**
17
+ * Validation schema for a single workflow step (v1 — legacy).
18
+ *
19
+ * Mirrors the JSON workflow step shape so the TypeScript DSL produces
20
+ * structurally-identical output to JSON workflows.
21
+ *
22
+ * @deprecated Prefer {@link StepV2Schema}. v1 shapes are still accepted and
23
+ * normalized at workflow load time.
24
+ */
15
25
  export declare const StepOptsSchema: z.ZodObject<{
16
26
  name: z.ZodString;
17
27
  node: z.ZodString;
18
28
  type: z.ZodEnum<["local", "module", "runtime.python3", "runtime.nodejs", "runtime.bun", "runtime.go", "runtime.java", "runtime.rust", "runtime.php", "runtime.csharp", "runtime.ruby", "runtime.docker", "runtime.wasm"]>;
19
29
  inputs: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
20
30
  runtime: z.ZodOptional<z.ZodEnum<["nodejs", "bun", "python3", "go", "java", "rust", "php", "csharp", "ruby", "docker", "wasm"]>>;
31
+ /**
32
+ * @deprecated v2 default-stores every step's output. Set `ephemeral: true`
33
+ * to opt out. `set_var: true` is now a no-op (default behaviour);
34
+ * `set_var: false` is normalized to `ephemeral: true` at load time.
35
+ */
36
+ set_var: z.ZodOptional<z.ZodBoolean>;
37
+ active: z.ZodOptional<z.ZodBoolean>;
38
+ stop: z.ZodOptional<z.ZodBoolean>;
39
+ stream_logs: z.ZodOptional<z.ZodBoolean>;
21
40
  }, "strip", z.ZodTypeAny, {
22
41
  name: string;
23
42
  node: string;
24
43
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
25
44
  inputs?: {} | undefined;
26
45
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
46
+ set_var?: boolean | undefined;
47
+ active?: boolean | undefined;
48
+ stop?: boolean | undefined;
49
+ stream_logs?: boolean | undefined;
27
50
  }, {
28
51
  name: string;
29
52
  node: string;
30
53
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
31
54
  inputs?: {} | undefined;
32
55
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
56
+ set_var?: boolean | undefined;
57
+ active?: boolean | undefined;
58
+ stop?: boolean | undefined;
59
+ stream_logs?: boolean | undefined;
33
60
  }>;
34
61
  export type StepOpts = z.infer<typeof StepOptsSchema>;
35
62
  export declare const StepInputsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
@@ -41,18 +68,35 @@ export declare const StepConditionSchema: z.ZodObject<{
41
68
  type: z.ZodEnum<["local", "module", "runtime.python3", "runtime.nodejs", "runtime.bun", "runtime.go", "runtime.java", "runtime.rust", "runtime.php", "runtime.csharp", "runtime.ruby", "runtime.docker", "runtime.wasm"]>;
42
69
  inputs: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
43
70
  runtime: z.ZodOptional<z.ZodEnum<["nodejs", "bun", "python3", "go", "java", "rust", "php", "csharp", "ruby", "docker", "wasm"]>>;
71
+ /**
72
+ * @deprecated v2 default-stores every step's output. Set `ephemeral: true`
73
+ * to opt out. `set_var: true` is now a no-op (default behaviour);
74
+ * `set_var: false` is normalized to `ephemeral: true` at load time.
75
+ */
76
+ set_var: z.ZodOptional<z.ZodBoolean>;
77
+ active: z.ZodOptional<z.ZodBoolean>;
78
+ stop: z.ZodOptional<z.ZodBoolean>;
79
+ stream_logs: z.ZodOptional<z.ZodBoolean>;
44
80
  }, "strip", z.ZodTypeAny, {
45
81
  name: string;
46
82
  node: string;
47
83
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
48
84
  inputs?: {} | undefined;
49
85
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
86
+ set_var?: boolean | undefined;
87
+ active?: boolean | undefined;
88
+ stop?: boolean | undefined;
89
+ stream_logs?: boolean | undefined;
50
90
  }, {
51
91
  name: string;
52
92
  node: string;
53
93
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
54
94
  inputs?: {} | undefined;
55
95
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
96
+ set_var?: boolean | undefined;
97
+ active?: boolean | undefined;
98
+ stop?: boolean | undefined;
99
+ stream_logs?: boolean | undefined;
56
100
  }>;
57
101
  conditions: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>>;
58
102
  }, "strip", z.ZodTypeAny, {
@@ -62,6 +106,10 @@ export declare const StepConditionSchema: z.ZodObject<{
62
106
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
63
107
  inputs?: {} | undefined;
64
108
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
109
+ set_var?: boolean | undefined;
110
+ active?: boolean | undefined;
111
+ stop?: boolean | undefined;
112
+ stream_logs?: boolean | undefined;
65
113
  };
66
114
  conditions?: ((...args: unknown[]) => unknown) | undefined;
67
115
  }, {
@@ -71,6 +119,10 @@ export declare const StepConditionSchema: z.ZodObject<{
71
119
  type: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm";
72
120
  inputs?: {} | undefined;
73
121
  runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
122
+ set_var?: boolean | undefined;
123
+ active?: boolean | undefined;
124
+ stop?: boolean | undefined;
125
+ stream_logs?: boolean | undefined;
74
126
  };
75
127
  conditions?: ((...args: unknown[]) => unknown) | undefined;
76
128
  }>;
@@ -78,3 +130,404 @@ export interface IConditions {
78
130
  conditions: () => ConditionOpts[] | ConditionElseOpts[];
79
131
  }
80
132
  export type StepConditionOpts = z.infer<typeof StepConditionSchema>;
133
+ /**
134
+ * Retry configuration for a v2 step.
135
+ *
136
+ * Wraps `step.process(ctx, step)` in a retry loop with capped exponential
137
+ * backoff. Per-attempt failures emit `NODE_ATTEMPT_FAILED` trace events.
138
+ *
139
+ * Defaults applied by the runner when fields are omitted:
140
+ * - `minTimeoutInMs`: 1000
141
+ * - `maxTimeoutInMs`: 30000
142
+ * - `factor`: 2
143
+ *
144
+ * Shape mirrors Trigger.dev's `retry` config so authors moving between
145
+ * platforms read familiar semantics. No jitter is added — matches
146
+ * Trigger.dev's default.
147
+ */
148
+ export declare const RetryConfigSchema: z.ZodEffects<z.ZodObject<{
149
+ maxAttempts: z.ZodNumber;
150
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
151
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
152
+ factor: z.ZodOptional<z.ZodNumber>;
153
+ }, "strip", z.ZodTypeAny, {
154
+ maxAttempts: number;
155
+ factor?: number | undefined;
156
+ minTimeoutInMs?: number | undefined;
157
+ maxTimeoutInMs?: number | undefined;
158
+ }, {
159
+ maxAttempts: number;
160
+ factor?: number | undefined;
161
+ minTimeoutInMs?: number | undefined;
162
+ maxTimeoutInMs?: number | undefined;
163
+ }>, {
164
+ maxAttempts: number;
165
+ factor?: number | undefined;
166
+ minTimeoutInMs?: number | undefined;
167
+ maxTimeoutInMs?: number | undefined;
168
+ }, {
169
+ maxAttempts: number;
170
+ factor?: number | undefined;
171
+ minTimeoutInMs?: number | undefined;
172
+ maxTimeoutInMs?: number | undefined;
173
+ }>;
174
+ export type RetryConfig = z.infer<typeof RetryConfigSchema>;
175
+ /**
176
+ * V2 regular step — invokes a node with inputs.
177
+ *
178
+ * **Identity**
179
+ * - `id` is the step's stable identifier. Other steps reference this step's
180
+ * output as `$.state[id]`.
181
+ * - `use` is the node reference (e.g. `@blokjs/api-call`).
182
+ *
183
+ * **Persistence (default-store rule)**
184
+ * Every step's `result.data` is automatically stored in `ctx.state[id]`
185
+ * after execution. This is the 95% case. The four declarative knobs:
186
+ * - `as: "<name>"` — store at `state[name]` instead of `state[id]`.
187
+ * - `spread: true` — shallow-merge keys of `result.data` into `state`
188
+ * (data-pipeline pattern). Mutually exclusive with `as`.
189
+ * - `ephemeral: true` — skip storage; only `ctx.prev` carries the result
190
+ * to the next step.
191
+ *
192
+ * @example
193
+ * { id: "fetch-users", use: "postgres-query", inputs: { sql: "..." } }
194
+ * // state["fetch-users"] = result.data
195
+ *
196
+ * @example
197
+ * { id: "step-1", use: "...", as: "users" }
198
+ * // state.users = result.data
199
+ *
200
+ * @example
201
+ * { id: "load", use: "fetch-user-and-profile", spread: true }
202
+ * // result.data = { user, profile } -> state.user + state.profile
203
+ */
204
+ export declare const V2RegularStepSchema: z.ZodEffects<z.ZodObject<{
205
+ id: z.ZodString;
206
+ use: z.ZodString;
207
+ type: z.ZodOptional<z.ZodEnum<["local", "module", "runtime.python3", "runtime.nodejs", "runtime.bun", "runtime.go", "runtime.java", "runtime.rust", "runtime.php", "runtime.csharp", "runtime.ruby", "runtime.docker", "runtime.wasm"]>>;
208
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
209
+ as: z.ZodOptional<z.ZodString>;
210
+ spread: z.ZodOptional<z.ZodBoolean>;
211
+ ephemeral: z.ZodOptional<z.ZodBoolean>;
212
+ runtime: z.ZodOptional<z.ZodEnum<["nodejs", "bun", "python3", "go", "java", "rust", "php", "csharp", "ruby", "docker", "wasm"]>>;
213
+ active: z.ZodOptional<z.ZodBoolean>;
214
+ stop: z.ZodOptional<z.ZodBoolean>;
215
+ stream_logs: z.ZodOptional<z.ZodBoolean>;
216
+ idempotencyKey: z.ZodOptional<z.ZodString>;
217
+ idempotencyKeyTTL: z.ZodOptional<z.ZodNumber>;
218
+ retry: z.ZodOptional<z.ZodEffects<z.ZodObject<{
219
+ maxAttempts: z.ZodNumber;
220
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
221
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
222
+ factor: z.ZodOptional<z.ZodNumber>;
223
+ }, "strip", z.ZodTypeAny, {
224
+ maxAttempts: number;
225
+ factor?: number | undefined;
226
+ minTimeoutInMs?: number | undefined;
227
+ maxTimeoutInMs?: number | undefined;
228
+ }, {
229
+ maxAttempts: number;
230
+ factor?: number | undefined;
231
+ minTimeoutInMs?: number | undefined;
232
+ maxTimeoutInMs?: number | undefined;
233
+ }>, {
234
+ maxAttempts: number;
235
+ factor?: number | undefined;
236
+ minTimeoutInMs?: number | undefined;
237
+ maxTimeoutInMs?: number | undefined;
238
+ }, {
239
+ maxAttempts: number;
240
+ factor?: number | undefined;
241
+ minTimeoutInMs?: number | undefined;
242
+ maxTimeoutInMs?: number | undefined;
243
+ }>>;
244
+ maxDuration: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
245
+ set_var: z.ZodOptional<z.ZodBoolean>;
246
+ }, "strip", z.ZodTypeAny, {
247
+ id: string;
248
+ use: string;
249
+ type?: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm" | undefined;
250
+ inputs?: Record<string, unknown> | undefined;
251
+ runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
252
+ set_var?: boolean | undefined;
253
+ active?: boolean | undefined;
254
+ stop?: boolean | undefined;
255
+ stream_logs?: boolean | undefined;
256
+ as?: string | undefined;
257
+ spread?: boolean | undefined;
258
+ ephemeral?: boolean | undefined;
259
+ idempotencyKey?: string | undefined;
260
+ idempotencyKeyTTL?: number | undefined;
261
+ retry?: {
262
+ maxAttempts: number;
263
+ factor?: number | undefined;
264
+ minTimeoutInMs?: number | undefined;
265
+ maxTimeoutInMs?: number | undefined;
266
+ } | undefined;
267
+ maxDuration?: string | number | undefined;
268
+ }, {
269
+ id: string;
270
+ use: string;
271
+ type?: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm" | undefined;
272
+ inputs?: Record<string, unknown> | undefined;
273
+ runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
274
+ set_var?: boolean | undefined;
275
+ active?: boolean | undefined;
276
+ stop?: boolean | undefined;
277
+ stream_logs?: boolean | undefined;
278
+ as?: string | undefined;
279
+ spread?: boolean | undefined;
280
+ ephemeral?: boolean | undefined;
281
+ idempotencyKey?: string | undefined;
282
+ idempotencyKeyTTL?: number | undefined;
283
+ retry?: {
284
+ maxAttempts: number;
285
+ factor?: number | undefined;
286
+ minTimeoutInMs?: number | undefined;
287
+ maxTimeoutInMs?: number | undefined;
288
+ } | undefined;
289
+ maxDuration?: string | number | undefined;
290
+ }>, {
291
+ id: string;
292
+ use: string;
293
+ type?: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm" | undefined;
294
+ inputs?: Record<string, unknown> | undefined;
295
+ runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
296
+ set_var?: boolean | undefined;
297
+ active?: boolean | undefined;
298
+ stop?: boolean | undefined;
299
+ stream_logs?: boolean | undefined;
300
+ as?: string | undefined;
301
+ spread?: boolean | undefined;
302
+ ephemeral?: boolean | undefined;
303
+ idempotencyKey?: string | undefined;
304
+ idempotencyKeyTTL?: number | undefined;
305
+ retry?: {
306
+ maxAttempts: number;
307
+ factor?: number | undefined;
308
+ minTimeoutInMs?: number | undefined;
309
+ maxTimeoutInMs?: number | undefined;
310
+ } | undefined;
311
+ maxDuration?: string | number | undefined;
312
+ }, {
313
+ id: string;
314
+ use: string;
315
+ type?: "local" | "module" | "runtime.python3" | "runtime.nodejs" | "runtime.bun" | "runtime.go" | "runtime.java" | "runtime.rust" | "runtime.php" | "runtime.csharp" | "runtime.ruby" | "runtime.docker" | "runtime.wasm" | undefined;
316
+ inputs?: Record<string, unknown> | undefined;
317
+ runtime?: "nodejs" | "bun" | "python3" | "go" | "java" | "rust" | "php" | "csharp" | "ruby" | "docker" | "wasm" | undefined;
318
+ set_var?: boolean | undefined;
319
+ active?: boolean | undefined;
320
+ stop?: boolean | undefined;
321
+ stream_logs?: boolean | undefined;
322
+ as?: string | undefined;
323
+ spread?: boolean | undefined;
324
+ ephemeral?: boolean | undefined;
325
+ idempotencyKey?: string | undefined;
326
+ idempotencyKeyTTL?: number | undefined;
327
+ retry?: {
328
+ maxAttempts: number;
329
+ factor?: number | undefined;
330
+ minTimeoutInMs?: number | undefined;
331
+ maxTimeoutInMs?: number | undefined;
332
+ } | undefined;
333
+ maxDuration?: string | number | undefined;
334
+ }>;
335
+ export type V2RegularStep = z.infer<typeof V2RegularStepSchema>;
336
+ /**
337
+ * V2 branch step — `branch({when, then, else})`.
338
+ *
339
+ * Replaces the legacy `addCondition + new AddIf().addStep().build()` pattern.
340
+ * Compiles down to the existing `@blokjs/if-else` flow node at workflow
341
+ * load time, so the runner core needs no change.
342
+ *
343
+ * @example
344
+ * {
345
+ * id: "route-by-method",
346
+ * branch: {
347
+ * when: '$.req.method === "POST"',
348
+ * then: [{ id: "create", use: "...", inputs: {...} }],
349
+ * else: [{ id: "read", use: "...", inputs: {...} }]
350
+ * }
351
+ * }
352
+ */
353
+ export declare const V2BranchStepSchema: z.ZodType<{
354
+ id: string;
355
+ branch: {
356
+ when: string;
357
+ then: unknown[];
358
+ else?: unknown[];
359
+ };
360
+ active?: boolean;
361
+ stop?: boolean;
362
+ }>;
363
+ export type V2BranchStep = z.infer<typeof V2BranchStepSchema>;
364
+ /**
365
+ * V2 sub-workflow step — invoke another named workflow inline.
366
+ *
367
+ * The parent step blocks until the child workflow completes (`wait: true`,
368
+ * the default). The child gets its own `ctx`, its own trace run record,
369
+ * and runs through the same `RunnerSteps` machinery as a top-level run.
370
+ * The child's `ctx.response` becomes the parent step's output, so it
371
+ * lands on `state[<id>]` like any other step (mirrors HTTP semantics:
372
+ * sub-workflow looks like a function call).
373
+ *
374
+ * Inputs flow from parent → child as `ctx.request.body` — the child
375
+ * reads them via `$.req.body.<key>` exactly as if it had been
376
+ * HTTP-triggered.
377
+ *
378
+ * **Composition with Tier 1**:
379
+ * - `idempotencyKey` on this step caches the entire sub-workflow's
380
+ * result. Cache hit = child workflow is NEVER invoked (no side
381
+ * effects fire on rerun). Documented footgun + headline pattern.
382
+ * - `retry` retries the whole sub-workflow on failure.
383
+ * - Replay re-creates fresh sub-run lineage automatically.
384
+ *
385
+ * @example
386
+ * {
387
+ * id: "send-receipt",
388
+ * subworkflow: "send-receipt-email",
389
+ * inputs: { user: $.state.user, order: $.state.order },
390
+ * wait: true, // default; `wait: false` deferred to a follow-up
391
+ * idempotencyKey: $.req.body.requestId,
392
+ * }
393
+ */
394
+ export declare const V2SubworkflowStepSchema: z.ZodType<{
395
+ id: string;
396
+ subworkflow: string;
397
+ inputs?: Record<string, unknown>;
398
+ wait?: boolean;
399
+ as?: string;
400
+ spread?: boolean;
401
+ ephemeral?: boolean;
402
+ active?: boolean;
403
+ stop?: boolean;
404
+ idempotencyKey?: string;
405
+ idempotencyKeyTTL?: number;
406
+ retry?: RetryConfig;
407
+ }>;
408
+ export type V2SubworkflowStep = z.infer<typeof V2SubworkflowStepSchema>;
409
+ /**
410
+ * V2 wait step (PR 4 · `wait.for(duration)` / `wait.until(date)`).
411
+ *
412
+ * Pauses workflow execution mid-run for the specified duration (or until
413
+ * the absolute deadline). Composes with the durable scheduler — long
414
+ * waits survive process restart via the existing
415
+ * `scheduled_dispatches` infrastructure (PR 4 P3 adds
416
+ * `last_completed_step_index` so the runner skips past completed
417
+ * pre-wait steps on resume).
418
+ *
419
+ * Author surface:
420
+ * ```ts
421
+ * { id: "wait-3d", wait: { for: "3d" } }
422
+ * { id: "wait-deadline", wait: { until: $.req.body.scheduledAt } }
423
+ * ```
424
+ *
425
+ * Cannot combine with `idempotencyKey` (the wait IS the checkpoint) or
426
+ * `retry` (waits don't fail in a retryable way).
427
+ */
428
+ export declare const V2WaitStepSchema: z.ZodEffects<z.ZodObject<{
429
+ id: z.ZodString;
430
+ wait: z.ZodObject<{
431
+ for: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
432
+ until: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
433
+ }, "strict", z.ZodTypeAny, {
434
+ for?: string | number | undefined;
435
+ until?: string | number | undefined;
436
+ }, {
437
+ for?: string | number | undefined;
438
+ until?: string | number | undefined;
439
+ }>;
440
+ as: z.ZodOptional<z.ZodString>;
441
+ ephemeral: z.ZodOptional<z.ZodBoolean>;
442
+ active: z.ZodOptional<z.ZodBoolean>;
443
+ stop: z.ZodOptional<z.ZodBoolean>;
444
+ idempotencyKey: z.ZodOptional<z.ZodNever>;
445
+ retry: z.ZodOptional<z.ZodNever>;
446
+ maxDuration: z.ZodOptional<z.ZodNever>;
447
+ concurrencyKey: z.ZodOptional<z.ZodNever>;
448
+ spread: z.ZodOptional<z.ZodNever>;
449
+ }, "strict", z.ZodTypeAny, {
450
+ id: string;
451
+ wait: {
452
+ for?: string | number | undefined;
453
+ until?: string | number | undefined;
454
+ };
455
+ active?: boolean | undefined;
456
+ stop?: boolean | undefined;
457
+ concurrencyKey?: undefined;
458
+ as?: string | undefined;
459
+ spread?: undefined;
460
+ ephemeral?: boolean | undefined;
461
+ idempotencyKey?: undefined;
462
+ retry?: undefined;
463
+ maxDuration?: undefined;
464
+ }, {
465
+ id: string;
466
+ wait: {
467
+ for?: string | number | undefined;
468
+ until?: string | number | undefined;
469
+ };
470
+ active?: boolean | undefined;
471
+ stop?: boolean | undefined;
472
+ concurrencyKey?: undefined;
473
+ as?: string | undefined;
474
+ spread?: undefined;
475
+ ephemeral?: boolean | undefined;
476
+ idempotencyKey?: undefined;
477
+ retry?: undefined;
478
+ maxDuration?: undefined;
479
+ }>, {
480
+ id: string;
481
+ wait: {
482
+ for?: string | number | undefined;
483
+ until?: string | number | undefined;
484
+ };
485
+ active?: boolean | undefined;
486
+ stop?: boolean | undefined;
487
+ concurrencyKey?: undefined;
488
+ as?: string | undefined;
489
+ spread?: undefined;
490
+ ephemeral?: boolean | undefined;
491
+ idempotencyKey?: undefined;
492
+ retry?: undefined;
493
+ maxDuration?: undefined;
494
+ }, {
495
+ id: string;
496
+ wait: {
497
+ for?: string | number | undefined;
498
+ until?: string | number | undefined;
499
+ };
500
+ active?: boolean | undefined;
501
+ stop?: boolean | undefined;
502
+ concurrencyKey?: undefined;
503
+ as?: string | undefined;
504
+ spread?: undefined;
505
+ ephemeral?: boolean | undefined;
506
+ idempotencyKey?: undefined;
507
+ retry?: undefined;
508
+ maxDuration?: undefined;
509
+ }>;
510
+ export type V2WaitStep = z.infer<typeof V2WaitStepSchema>;
511
+ /**
512
+ * Discriminated v2 step — regular, branch, sub-workflow, or wait.
513
+ *
514
+ * Discriminators (no `kind` field needed):
515
+ * - presence of `branch` → branch step
516
+ * - presence of `subworkflow` → sub-workflow step
517
+ * - presence of `wait` (object) → wait step
518
+ * - otherwise → regular step
519
+ */
520
+ export declare const V2StepSchema: z.ZodType<V2RegularStep | V2BranchStep | V2SubworkflowStep | V2WaitStep>;
521
+ export type V2Step = V2RegularStep | V2BranchStep | V2SubworkflowStep | V2WaitStep;
522
+ /**
523
+ * Type guard — true when the step is a branch.
524
+ */
525
+ export declare function isBranchStep(step: V2Step): step is V2BranchStep;
526
+ /**
527
+ * Type guard — true when the step is a wait (PR 4 `wait.for` / `wait.until`).
528
+ */
529
+ export declare function isWaitStep(step: V2Step): step is V2WaitStep;
530
+ /**
531
+ * Type guard — true when the step is a sub-workflow invocation.
532
+ */
533
+ export declare function isSubworkflowStep(step: V2Step): step is V2SubworkflowStep;