@cascade-flow/runner 0.2.17 → 0.2.19

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.
package/dist/index.js CHANGED
@@ -10,7 +10,6 @@ var __export = (target, all) => {
10
10
  };
11
11
 
12
12
  // src/subprocess-executor.ts
13
- import { spawn } from "node:child_process";
14
13
  import { resolve, dirname, join as join2 } from "node:path";
15
14
  import { fileURLToPath } from "node:url";
16
15
  import { mkdir, readFile, unlink, access, writeFile, readdir, rm } from "node:fs/promises";
@@ -30,6 +29,16 @@ function getFailurePath(dir, requestId) {
30
29
  }
31
30
 
32
31
  // src/subprocess-executor.ts
32
+ class StepExecutionError extends Error {
33
+ resourceUsage;
34
+ isCrash;
35
+ constructor(message, opts) {
36
+ super(message, { cause: opts?.cause });
37
+ this.name = "StepExecutionError";
38
+ this.resourceUsage = opts?.resourceUsage;
39
+ this.isCrash = opts?.isCrash;
40
+ }
41
+ }
33
42
  var EMBEDDED_STEP_EXECUTOR = `
34
43
  import { pathToFileURL } from "node:url";
35
44
  import { join } from "node:path";
@@ -275,21 +284,51 @@ function startCheckpointWatcher(dir, existing, onCheckpoint, onCheckpointFailed)
275
284
  }
276
285
  };
277
286
  }
287
+ async function consumeStream(stream, handler) {
288
+ const reader = stream.getReader();
289
+ try {
290
+ while (true) {
291
+ const { done, value } = await reader.read();
292
+ if (done)
293
+ break;
294
+ handler(Buffer.from(value));
295
+ }
296
+ } finally {
297
+ reader.releaseLock();
298
+ }
299
+ }
300
+ function toBunResourceUsage(proc) {
301
+ try {
302
+ const usage = proc.resourceUsage();
303
+ if (!usage)
304
+ return;
305
+ return {
306
+ peakMemoryBytes: usage.maxRSS,
307
+ cpuTimeUserUs: Number(usage.cpuTime.user),
308
+ cpuTimeSystemUs: Number(usage.cpuTime.system),
309
+ cpuTimeTotalUs: Number(usage.cpuTime.total),
310
+ voluntaryContextSwitches: usage.contextSwitches.voluntary,
311
+ involuntaryContextSwitches: usage.contextSwitches.involuntary
312
+ };
313
+ } catch {
314
+ return;
315
+ }
316
+ }
278
317
  async function executeStepInSubprocess(stepFile, stepId, dependencies, ctx, attemptNumber, outputPath, onLog, onCheckpoint, onCheckpointFailed, existingCheckpoints, options) {
279
318
  await mkdir(dirname(outputPath), { recursive: true });
280
319
  const executorPath = resolve(dirname(fileURLToPath(import.meta.url)), "step-executor.ts");
281
- let spawnArgs;
320
+ let spawnCmd;
282
321
  let tempExecutorPath = null;
283
322
  const stepInput = JSON.stringify({ stepPath: stepFile, dependencies, ctx });
284
323
  const inputFilePath = join2(tmpdir(), `cf-step-input-${Date.now()}-${Math.random().toString(36).slice(2)}.json`);
285
324
  await writeFile(inputFilePath, stepInput);
286
325
  try {
287
326
  await access(executorPath);
288
- spawnArgs = ["bun", [executorPath]];
327
+ spawnCmd = ["bun", executorPath];
289
328
  } catch {
290
329
  tempExecutorPath = join2(tmpdir(), `cf-step-executor-${Date.now()}-${Math.random().toString(36).slice(2)}.ts`);
291
330
  await writeFile(tempExecutorPath, EMBEDDED_STEP_EXECUTOR);
292
- spawnArgs = ["bun", [tempExecutorPath]];
331
+ spawnCmd = ["bun", tempExecutorPath];
293
332
  }
294
333
  let checkpointDir;
295
334
  let checkpointWatcher;
@@ -299,8 +338,8 @@ async function executeStepInSubprocess(stepFile, stepId, dependencies, ctx, atte
299
338
  await mkdir(checkpointDir, { recursive: true });
300
339
  checkpointWatcher = startCheckpointWatcher(checkpointDir, checkpointCache, onCheckpoint, onCheckpointFailed);
301
340
  }
302
- return new Promise((resolve2, reject) => {
303
- const child = spawn(spawnArgs[0], spawnArgs[1], {
341
+ try {
342
+ const proc = Bun.spawn(spawnCmd, {
304
343
  stdio: ["pipe", "pipe", "pipe"],
305
344
  env: {
306
345
  ...process.env,
@@ -309,6 +348,8 @@ async function executeStepInSubprocess(stepFile, stepId, dependencies, ctx, atte
309
348
  ...checkpointDir ? { CF_CHECKPOINT_DIR: checkpointDir } : {}
310
349
  }
311
350
  });
351
+ const pid = proc.pid;
352
+ options?.onPid?.(pid);
312
353
  const logs = [];
313
354
  const logWritePromises = [];
314
355
  let logError = null;
@@ -332,10 +373,10 @@ async function executeStepInSubprocess(stepFile, stepId, dependencies, ctx, atte
332
373
  aborted = true;
333
374
  abortReason = signal?.reason ?? new Error("Step execution aborted");
334
375
  try {
335
- child.kill("SIGKILL");
376
+ proc.kill("SIGKILL");
336
377
  } catch {}
337
378
  } : null;
338
- const cleanup = () => {
379
+ const cleanupSignal = () => {
339
380
  if (signal && abortHandler) {
340
381
  signal.removeEventListener("abort", abortHandler);
341
382
  }
@@ -349,81 +390,79 @@ async function executeStepInSubprocess(stepFile, stepId, dependencies, ctx, atte
349
390
  }
350
391
  const stdoutHandler = createStreamHandler("stdout", attemptNumber, emitLog);
351
392
  const stderrHandler = createStreamHandler("stderr", attemptNumber, emitLog);
352
- child.stdout.on("data", stdoutHandler.handler);
353
- child.stderr.on("data", stderrHandler.handler);
354
- child.on("error", (err) => {
355
- cleanup();
356
- reject(err);
357
- });
358
- child.on("close", async (code, signal2) => {
359
- cleanup();
360
- if (checkpointWatcher) {
361
- checkpointWatcher.stop();
362
- }
363
- if (tempExecutorPath) {
364
- try {
365
- await unlink(tempExecutorPath);
366
- } catch {}
367
- }
393
+ const stdoutDone = consumeStream(proc.stdout, stdoutHandler.handler);
394
+ const stderrDone = consumeStream(proc.stderr, stderrHandler.handler);
395
+ proc.stdin.end();
396
+ const exitCode = await proc.exited;
397
+ await Promise.allSettled([stdoutDone, stderrDone]);
398
+ const resourceUsage = toBunResourceUsage(proc);
399
+ cleanupSignal();
400
+ stdoutHandler.flushBuffer();
401
+ stderrHandler.flushBuffer();
402
+ try {
403
+ await Promise.all(logWritePromises);
404
+ } catch {}
405
+ if (logError) {
406
+ throw logError;
407
+ }
408
+ if (aborted) {
409
+ throw new StepExecutionError(String(abortReason instanceof Error ? abortReason.message : abortReason ?? "Step execution aborted"), { cause: abortReason, resourceUsage });
410
+ }
411
+ const signalCode = proc.signalCode;
412
+ if (exitCode === 0) {
368
413
  try {
369
- await unlink(inputFilePath);
370
- } catch {}
371
- if (checkpointDir) {
414
+ const outputContent = await readFile(outputPath, "utf-8");
415
+ const result = JSON.parse(outputContent);
372
416
  try {
373
- await rm(checkpointDir, { recursive: true, force: true });
417
+ await unlink(outputPath);
374
418
  } catch {}
419
+ return { result, logs, resourceUsage, pid };
420
+ } catch (err) {
421
+ throw new StepExecutionError(`Failed to read/parse output file ${outputPath}: ${err}`, { cause: err, resourceUsage });
375
422
  }
376
- stdoutHandler.flushBuffer();
377
- stderrHandler.flushBuffer();
378
- try {
379
- await Promise.all(logWritePromises);
380
- } catch {}
381
- if (logError) {
382
- reject(logError);
383
- return;
384
- }
385
- if (aborted) {
386
- const reason = abortReason instanceof Error ? abortReason : new Error(String(abortReason ?? "Step execution aborted"));
387
- reject(reason);
388
- return;
389
- }
390
- if (code === 0) {
423
+ } else if (signalCode) {
424
+ throw new StepExecutionError(`Step process killed by signal: ${signalCode}`, { isCrash: true, resourceUsage });
425
+ } else {
426
+ const lastStderrLog = logs.filter((l) => l.stream === "stderr").pop();
427
+ if (lastStderrLog) {
391
428
  try {
392
- const outputContent = await readFile(outputPath, "utf-8");
393
- const result = JSON.parse(outputContent);
394
- try {
395
- await unlink(outputPath);
396
- } catch {}
397
- resolve2({ result, logs });
398
- } catch (err) {
399
- reject(new Error(`Failed to read/parse output file ${outputPath}: ${err}`));
400
- }
401
- } else if (signal2) {
402
- const error = new Error(`Step process killed by signal: ${signal2}`);
403
- error.isCrash = true;
404
- reject(error);
405
- } else {
406
- const lastStderrLog = logs.filter((l) => l.stream === "stderr").pop();
407
- if (lastStderrLog) {
408
- try {
409
- const errorObj = JSON.parse(lastStderrLog.message);
410
- const errorMessage = ensureErrorMessage(errorObj.message);
411
- const error = new Error(errorMessage);
412
- error.stack = errorObj.stack;
413
- error.name = errorObj.name || "Error";
414
- reject(error);
415
- } catch {
416
- const errorMessage = logs.filter((l) => l.stream === "stderr").map((l) => l.message).join(`
429
+ const errorObj = JSON.parse(lastStderrLog.message);
430
+ const errorMessage = ensureErrorMessage(errorObj.message);
431
+ const wrappedError = new StepExecutionError(errorMessage, { resourceUsage });
432
+ if (errorObj.stack)
433
+ wrappedError.stack = errorObj.stack;
434
+ if (errorObj.name)
435
+ wrappedError.name = errorObj.name;
436
+ throw wrappedError;
437
+ } catch (parseErr) {
438
+ if (parseErr instanceof StepExecutionError)
439
+ throw parseErr;
440
+ const errorMessage = logs.filter((l) => l.stream === "stderr").map((l) => l.message).join(`
417
441
  `);
418
- reject(new Error(errorMessage || `Step process exited with code ${code}`));
419
- }
420
- } else {
421
- reject(new Error(`Step process exited with code ${code}`));
442
+ throw new StepExecutionError(errorMessage || `Step process exited with code ${exitCode}`, { resourceUsage });
422
443
  }
444
+ } else {
445
+ throw new StepExecutionError(`Step process exited with code ${exitCode}`, { resourceUsage });
423
446
  }
424
- });
425
- child.stdin.end();
426
- });
447
+ }
448
+ } finally {
449
+ if (tempExecutorPath) {
450
+ try {
451
+ await unlink(tempExecutorPath);
452
+ } catch {}
453
+ }
454
+ try {
455
+ await unlink(inputFilePath);
456
+ } catch {}
457
+ if (checkpointDir) {
458
+ try {
459
+ await rm(checkpointDir, { recursive: true, force: true });
460
+ } catch {}
461
+ }
462
+ if (checkpointWatcher) {
463
+ checkpointWatcher.stop();
464
+ }
465
+ }
427
466
  }
428
467
 
429
468
  // src/discovery.ts
@@ -431,7 +470,7 @@ import fs from "node:fs/promises";
431
470
  import path from "node:path";
432
471
  import { pathToFileURL } from "node:url";
433
472
 
434
- // node_modules/zod/v4/classic/external.js
473
+ // ../../node_modules/zod/v4/classic/external.js
435
474
  var exports_external = {};
436
475
  __export(exports_external, {
437
476
  xid: () => xid2,
@@ -661,7 +700,7 @@ __export(exports_external, {
661
700
  $brand: () => $brand
662
701
  });
663
702
 
664
- // node_modules/zod/v4/core/index.js
703
+ // ../../node_modules/zod/v4/core/index.js
665
704
  var exports_core2 = {};
666
705
  __export(exports_core2, {
667
706
  version: () => version,
@@ -925,7 +964,7 @@ __export(exports_core2, {
925
964
  $ZodAny: () => $ZodAny
926
965
  });
927
966
 
928
- // node_modules/zod/v4/core/core.js
967
+ // ../../node_modules/zod/v4/core/core.js
929
968
  var NEVER = Object.freeze({
930
969
  status: "aborted"
931
970
  });
@@ -992,7 +1031,7 @@ function config(newConfig) {
992
1031
  Object.assign(globalConfig, newConfig);
993
1032
  return globalConfig;
994
1033
  }
995
- // node_modules/zod/v4/core/util.js
1034
+ // ../../node_modules/zod/v4/core/util.js
996
1035
  var exports_util = {};
997
1036
  __export(exports_util, {
998
1037
  unwrapMessage: () => unwrapMessage,
@@ -1621,7 +1660,7 @@ class Class {
1621
1660
  constructor(..._args) {}
1622
1661
  }
1623
1662
 
1624
- // node_modules/zod/v4/core/errors.js
1663
+ // ../../node_modules/zod/v4/core/errors.js
1625
1664
  var initializer = (inst, def) => {
1626
1665
  inst.name = "$ZodError";
1627
1666
  Object.defineProperty(inst, "_zod", {
@@ -1758,7 +1797,7 @@ function prettifyError(error) {
1758
1797
  `);
1759
1798
  }
1760
1799
 
1761
- // node_modules/zod/v4/core/parse.js
1800
+ // ../../node_modules/zod/v4/core/parse.js
1762
1801
  var _parse = (_Err) => (schema, value, _ctx, _params) => {
1763
1802
  const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
1764
1803
  const result = schema._zod.run({ value, issues: [] }, ctx);
@@ -1845,7 +1884,7 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
1845
1884
  return _safeParseAsync(_Err)(schema, value, _ctx);
1846
1885
  };
1847
1886
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
1848
- // node_modules/zod/v4/core/regexes.js
1887
+ // ../../node_modules/zod/v4/core/regexes.js
1849
1888
  var exports_regexes = {};
1850
1889
  __export(exports_regexes, {
1851
1890
  xid: () => xid,
@@ -1997,7 +2036,7 @@ var sha512_hex = /^[0-9a-fA-F]{128}$/;
1997
2036
  var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
1998
2037
  var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
1999
2038
 
2000
- // node_modules/zod/v4/core/checks.js
2039
+ // ../../node_modules/zod/v4/core/checks.js
2001
2040
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
2002
2041
  var _a;
2003
2042
  inst._zod ?? (inst._zod = {});
@@ -2538,7 +2577,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
2538
2577
  };
2539
2578
  });
2540
2579
 
2541
- // node_modules/zod/v4/core/doc.js
2580
+ // ../../node_modules/zod/v4/core/doc.js
2542
2581
  class Doc {
2543
2582
  constructor(args = []) {
2544
2583
  this.content = [];
@@ -2576,14 +2615,14 @@ class Doc {
2576
2615
  }
2577
2616
  }
2578
2617
 
2579
- // node_modules/zod/v4/core/versions.js
2618
+ // ../../node_modules/zod/v4/core/versions.js
2580
2619
  var version = {
2581
2620
  major: 4,
2582
2621
  minor: 1,
2583
2622
  patch: 12
2584
2623
  };
2585
2624
 
2586
- // node_modules/zod/v4/core/schemas.js
2625
+ // ../../node_modules/zod/v4/core/schemas.js
2587
2626
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
2588
2627
  var _a;
2589
2628
  inst ?? (inst = {});
@@ -4419,7 +4458,7 @@ function handleRefineResult(result, payload, input, inst) {
4419
4458
  payload.issues.push(issue(_iss));
4420
4459
  }
4421
4460
  }
4422
- // node_modules/zod/v4/locales/index.js
4461
+ // ../../node_modules/zod/v4/locales/index.js
4423
4462
  var exports_locales = {};
4424
4463
  __export(exports_locales, {
4425
4464
  zhTW: () => zh_TW_default,
@@ -4471,7 +4510,7 @@ __export(exports_locales, {
4471
4510
  ar: () => ar_default
4472
4511
  });
4473
4512
 
4474
- // node_modules/zod/v4/locales/ar.js
4513
+ // ../../node_modules/zod/v4/locales/ar.js
4475
4514
  var error = () => {
4476
4515
  const Sizable = {
4477
4516
  string: { unit: "حرف", verb: "أن يحوي" },
@@ -4587,7 +4626,7 @@ function ar_default() {
4587
4626
  localeError: error()
4588
4627
  };
4589
4628
  }
4590
- // node_modules/zod/v4/locales/az.js
4629
+ // ../../node_modules/zod/v4/locales/az.js
4591
4630
  var error2 = () => {
4592
4631
  const Sizable = {
4593
4632
  string: { unit: "simvol", verb: "olmalıdır" },
@@ -4702,7 +4741,7 @@ function az_default() {
4702
4741
  localeError: error2()
4703
4742
  };
4704
4743
  }
4705
- // node_modules/zod/v4/locales/be.js
4744
+ // ../../node_modules/zod/v4/locales/be.js
4706
4745
  function getBelarusianPlural(count, one, few, many) {
4707
4746
  const absCount = Math.abs(count);
4708
4747
  const lastDigit = absCount % 10;
@@ -4866,7 +4905,7 @@ function be_default() {
4866
4905
  localeError: error3()
4867
4906
  };
4868
4907
  }
4869
- // node_modules/zod/v4/locales/bg.js
4908
+ // ../../node_modules/zod/v4/locales/bg.js
4870
4909
  var parsedType = (data) => {
4871
4910
  const t = typeof data;
4872
4911
  switch (t) {
@@ -4994,7 +5033,7 @@ function bg_default() {
4994
5033
  localeError: error4()
4995
5034
  };
4996
5035
  }
4997
- // node_modules/zod/v4/locales/ca.js
5036
+ // ../../node_modules/zod/v4/locales/ca.js
4998
5037
  var error5 = () => {
4999
5038
  const Sizable = {
5000
5039
  string: { unit: "caràcters", verb: "contenir" },
@@ -5111,7 +5150,7 @@ function ca_default() {
5111
5150
  localeError: error5()
5112
5151
  };
5113
5152
  }
5114
- // node_modules/zod/v4/locales/cs.js
5153
+ // ../../node_modules/zod/v4/locales/cs.js
5115
5154
  var error6 = () => {
5116
5155
  const Sizable = {
5117
5156
  string: { unit: "znaků", verb: "mít" },
@@ -5246,7 +5285,7 @@ function cs_default() {
5246
5285
  localeError: error6()
5247
5286
  };
5248
5287
  }
5249
- // node_modules/zod/v4/locales/da.js
5288
+ // ../../node_modules/zod/v4/locales/da.js
5250
5289
  var error7 = () => {
5251
5290
  const Sizable = {
5252
5291
  string: { unit: "tegn", verb: "havde" },
@@ -5377,7 +5416,7 @@ function da_default() {
5377
5416
  localeError: error7()
5378
5417
  };
5379
5418
  }
5380
- // node_modules/zod/v4/locales/de.js
5419
+ // ../../node_modules/zod/v4/locales/de.js
5381
5420
  var error8 = () => {
5382
5421
  const Sizable = {
5383
5422
  string: { unit: "Zeichen", verb: "zu haben" },
@@ -5493,7 +5532,7 @@ function de_default() {
5493
5532
  localeError: error8()
5494
5533
  };
5495
5534
  }
5496
- // node_modules/zod/v4/locales/en.js
5535
+ // ../../node_modules/zod/v4/locales/en.js
5497
5536
  var parsedType2 = (data) => {
5498
5537
  const t = typeof data;
5499
5538
  switch (t) {
@@ -5610,7 +5649,7 @@ function en_default() {
5610
5649
  localeError: error9()
5611
5650
  };
5612
5651
  }
5613
- // node_modules/zod/v4/locales/eo.js
5652
+ // ../../node_modules/zod/v4/locales/eo.js
5614
5653
  var parsedType3 = (data) => {
5615
5654
  const t = typeof data;
5616
5655
  switch (t) {
@@ -5726,7 +5765,7 @@ function eo_default() {
5726
5765
  localeError: error10()
5727
5766
  };
5728
5767
  }
5729
- // node_modules/zod/v4/locales/es.js
5768
+ // ../../node_modules/zod/v4/locales/es.js
5730
5769
  var error11 = () => {
5731
5770
  const Sizable = {
5732
5771
  string: { unit: "caracteres", verb: "tener" },
@@ -5874,7 +5913,7 @@ function es_default() {
5874
5913
  localeError: error11()
5875
5914
  };
5876
5915
  }
5877
- // node_modules/zod/v4/locales/fa.js
5916
+ // ../../node_modules/zod/v4/locales/fa.js
5878
5917
  var error12 = () => {
5879
5918
  const Sizable = {
5880
5919
  string: { unit: "کاراکتر", verb: "داشته باشد" },
@@ -5996,7 +6035,7 @@ function fa_default() {
5996
6035
  localeError: error12()
5997
6036
  };
5998
6037
  }
5999
- // node_modules/zod/v4/locales/fi.js
6038
+ // ../../node_modules/zod/v4/locales/fi.js
6000
6039
  var error13 = () => {
6001
6040
  const Sizable = {
6002
6041
  string: { unit: "merkkiä", subject: "merkkijonon" },
@@ -6118,7 +6157,7 @@ function fi_default() {
6118
6157
  localeError: error13()
6119
6158
  };
6120
6159
  }
6121
- // node_modules/zod/v4/locales/fr.js
6160
+ // ../../node_modules/zod/v4/locales/fr.js
6122
6161
  var error14 = () => {
6123
6162
  const Sizable = {
6124
6163
  string: { unit: "caractères", verb: "avoir" },
@@ -6234,7 +6273,7 @@ function fr_default() {
6234
6273
  localeError: error14()
6235
6274
  };
6236
6275
  }
6237
- // node_modules/zod/v4/locales/fr-CA.js
6276
+ // ../../node_modules/zod/v4/locales/fr-CA.js
6238
6277
  var error15 = () => {
6239
6278
  const Sizable = {
6240
6279
  string: { unit: "caractères", verb: "avoir" },
@@ -6351,7 +6390,7 @@ function fr_CA_default() {
6351
6390
  localeError: error15()
6352
6391
  };
6353
6392
  }
6354
- // node_modules/zod/v4/locales/he.js
6393
+ // ../../node_modules/zod/v4/locales/he.js
6355
6394
  var error16 = () => {
6356
6395
  const Sizable = {
6357
6396
  string: { unit: "אותיות", verb: "לכלול" },
@@ -6467,7 +6506,7 @@ function he_default() {
6467
6506
  localeError: error16()
6468
6507
  };
6469
6508
  }
6470
- // node_modules/zod/v4/locales/hu.js
6509
+ // ../../node_modules/zod/v4/locales/hu.js
6471
6510
  var error17 = () => {
6472
6511
  const Sizable = {
6473
6512
  string: { unit: "karakter", verb: "legyen" },
@@ -6583,7 +6622,7 @@ function hu_default() {
6583
6622
  localeError: error17()
6584
6623
  };
6585
6624
  }
6586
- // node_modules/zod/v4/locales/id.js
6625
+ // ../../node_modules/zod/v4/locales/id.js
6587
6626
  var error18 = () => {
6588
6627
  const Sizable = {
6589
6628
  string: { unit: "karakter", verb: "memiliki" },
@@ -6699,7 +6738,7 @@ function id_default() {
6699
6738
  localeError: error18()
6700
6739
  };
6701
6740
  }
6702
- // node_modules/zod/v4/locales/is.js
6741
+ // ../../node_modules/zod/v4/locales/is.js
6703
6742
  var parsedType4 = (data) => {
6704
6743
  const t = typeof data;
6705
6744
  switch (t) {
@@ -6816,7 +6855,7 @@ function is_default() {
6816
6855
  localeError: error19()
6817
6856
  };
6818
6857
  }
6819
- // node_modules/zod/v4/locales/it.js
6858
+ // ../../node_modules/zod/v4/locales/it.js
6820
6859
  var error20 = () => {
6821
6860
  const Sizable = {
6822
6861
  string: { unit: "caratteri", verb: "avere" },
@@ -6932,7 +6971,7 @@ function it_default() {
6932
6971
  localeError: error20()
6933
6972
  };
6934
6973
  }
6935
- // node_modules/zod/v4/locales/ja.js
6974
+ // ../../node_modules/zod/v4/locales/ja.js
6936
6975
  var error21 = () => {
6937
6976
  const Sizable = {
6938
6977
  string: { unit: "文字", verb: "である" },
@@ -7047,7 +7086,7 @@ function ja_default() {
7047
7086
  localeError: error21()
7048
7087
  };
7049
7088
  }
7050
- // node_modules/zod/v4/locales/ka.js
7089
+ // ../../node_modules/zod/v4/locales/ka.js
7051
7090
  var parsedType5 = (data) => {
7052
7091
  const t = typeof data;
7053
7092
  switch (t) {
@@ -7172,7 +7211,7 @@ function ka_default() {
7172
7211
  localeError: error22()
7173
7212
  };
7174
7213
  }
7175
- // node_modules/zod/v4/locales/km.js
7214
+ // ../../node_modules/zod/v4/locales/km.js
7176
7215
  var error23 = () => {
7177
7216
  const Sizable = {
7178
7217
  string: { unit: "តួអក្សរ", verb: "គួរមាន" },
@@ -7290,11 +7329,11 @@ function km_default() {
7290
7329
  };
7291
7330
  }
7292
7331
 
7293
- // node_modules/zod/v4/locales/kh.js
7332
+ // ../../node_modules/zod/v4/locales/kh.js
7294
7333
  function kh_default() {
7295
7334
  return km_default();
7296
7335
  }
7297
- // node_modules/zod/v4/locales/ko.js
7336
+ // ../../node_modules/zod/v4/locales/ko.js
7298
7337
  var error24 = () => {
7299
7338
  const Sizable = {
7300
7339
  string: { unit: "문자", verb: "to have" },
@@ -7415,7 +7454,7 @@ function ko_default() {
7415
7454
  localeError: error24()
7416
7455
  };
7417
7456
  }
7418
- // node_modules/zod/v4/locales/lt.js
7457
+ // ../../node_modules/zod/v4/locales/lt.js
7419
7458
  var parsedType6 = (data) => {
7420
7459
  const t = typeof data;
7421
7460
  return parsedTypeFromType(t, data);
@@ -7644,7 +7683,7 @@ function lt_default() {
7644
7683
  localeError: error25()
7645
7684
  };
7646
7685
  }
7647
- // node_modules/zod/v4/locales/mk.js
7686
+ // ../../node_modules/zod/v4/locales/mk.js
7648
7687
  var error26 = () => {
7649
7688
  const Sizable = {
7650
7689
  string: { unit: "знаци", verb: "да имаат" },
@@ -7761,7 +7800,7 @@ function mk_default() {
7761
7800
  localeError: error26()
7762
7801
  };
7763
7802
  }
7764
- // node_modules/zod/v4/locales/ms.js
7803
+ // ../../node_modules/zod/v4/locales/ms.js
7765
7804
  var error27 = () => {
7766
7805
  const Sizable = {
7767
7806
  string: { unit: "aksara", verb: "mempunyai" },
@@ -7877,7 +7916,7 @@ function ms_default() {
7877
7916
  localeError: error27()
7878
7917
  };
7879
7918
  }
7880
- // node_modules/zod/v4/locales/nl.js
7919
+ // ../../node_modules/zod/v4/locales/nl.js
7881
7920
  var error28 = () => {
7882
7921
  const Sizable = {
7883
7922
  string: { unit: "tekens" },
@@ -7994,7 +8033,7 @@ function nl_default() {
7994
8033
  localeError: error28()
7995
8034
  };
7996
8035
  }
7997
- // node_modules/zod/v4/locales/no.js
8036
+ // ../../node_modules/zod/v4/locales/no.js
7998
8037
  var error29 = () => {
7999
8038
  const Sizable = {
8000
8039
  string: { unit: "tegn", verb: "å ha" },
@@ -8110,7 +8149,7 @@ function no_default() {
8110
8149
  localeError: error29()
8111
8150
  };
8112
8151
  }
8113
- // node_modules/zod/v4/locales/ota.js
8152
+ // ../../node_modules/zod/v4/locales/ota.js
8114
8153
  var error30 = () => {
8115
8154
  const Sizable = {
8116
8155
  string: { unit: "harf", verb: "olmalıdır" },
@@ -8226,7 +8265,7 @@ function ota_default() {
8226
8265
  localeError: error30()
8227
8266
  };
8228
8267
  }
8229
- // node_modules/zod/v4/locales/ps.js
8268
+ // ../../node_modules/zod/v4/locales/ps.js
8230
8269
  var error31 = () => {
8231
8270
  const Sizable = {
8232
8271
  string: { unit: "توکي", verb: "ولري" },
@@ -8348,7 +8387,7 @@ function ps_default() {
8348
8387
  localeError: error31()
8349
8388
  };
8350
8389
  }
8351
- // node_modules/zod/v4/locales/pl.js
8390
+ // ../../node_modules/zod/v4/locales/pl.js
8352
8391
  var error32 = () => {
8353
8392
  const Sizable = {
8354
8393
  string: { unit: "znaków", verb: "mieć" },
@@ -8465,7 +8504,7 @@ function pl_default() {
8465
8504
  localeError: error32()
8466
8505
  };
8467
8506
  }
8468
- // node_modules/zod/v4/locales/pt.js
8507
+ // ../../node_modules/zod/v4/locales/pt.js
8469
8508
  var error33 = () => {
8470
8509
  const Sizable = {
8471
8510
  string: { unit: "caracteres", verb: "ter" },
@@ -8581,7 +8620,7 @@ function pt_default() {
8581
8620
  localeError: error33()
8582
8621
  };
8583
8622
  }
8584
- // node_modules/zod/v4/locales/ru.js
8623
+ // ../../node_modules/zod/v4/locales/ru.js
8585
8624
  function getRussianPlural(count, one, few, many) {
8586
8625
  const absCount = Math.abs(count);
8587
8626
  const lastDigit = absCount % 10;
@@ -8745,7 +8784,7 @@ function ru_default() {
8745
8784
  localeError: error34()
8746
8785
  };
8747
8786
  }
8748
- // node_modules/zod/v4/locales/sl.js
8787
+ // ../../node_modules/zod/v4/locales/sl.js
8749
8788
  var error35 = () => {
8750
8789
  const Sizable = {
8751
8790
  string: { unit: "znakov", verb: "imeti" },
@@ -8862,7 +8901,7 @@ function sl_default() {
8862
8901
  localeError: error35()
8863
8902
  };
8864
8903
  }
8865
- // node_modules/zod/v4/locales/sv.js
8904
+ // ../../node_modules/zod/v4/locales/sv.js
8866
8905
  var error36 = () => {
8867
8906
  const Sizable = {
8868
8907
  string: { unit: "tecken", verb: "att ha" },
@@ -8980,7 +9019,7 @@ function sv_default() {
8980
9019
  localeError: error36()
8981
9020
  };
8982
9021
  }
8983
- // node_modules/zod/v4/locales/ta.js
9022
+ // ../../node_modules/zod/v4/locales/ta.js
8984
9023
  var error37 = () => {
8985
9024
  const Sizable = {
8986
9025
  string: { unit: "எழுத்துக்கள்", verb: "கொண்டிருக்க வேண்டும்" },
@@ -9097,7 +9136,7 @@ function ta_default() {
9097
9136
  localeError: error37()
9098
9137
  };
9099
9138
  }
9100
- // node_modules/zod/v4/locales/th.js
9139
+ // ../../node_modules/zod/v4/locales/th.js
9101
9140
  var error38 = () => {
9102
9141
  const Sizable = {
9103
9142
  string: { unit: "ตัวอักษร", verb: "ควรมี" },
@@ -9214,7 +9253,7 @@ function th_default() {
9214
9253
  localeError: error38()
9215
9254
  };
9216
9255
  }
9217
- // node_modules/zod/v4/locales/tr.js
9256
+ // ../../node_modules/zod/v4/locales/tr.js
9218
9257
  var parsedType7 = (data) => {
9219
9258
  const t = typeof data;
9220
9259
  switch (t) {
@@ -9329,7 +9368,7 @@ function tr_default() {
9329
9368
  localeError: error39()
9330
9369
  };
9331
9370
  }
9332
- // node_modules/zod/v4/locales/uk.js
9371
+ // ../../node_modules/zod/v4/locales/uk.js
9333
9372
  var error40 = () => {
9334
9373
  const Sizable = {
9335
9374
  string: { unit: "символів", verb: "матиме" },
@@ -9446,11 +9485,11 @@ function uk_default() {
9446
9485
  };
9447
9486
  }
9448
9487
 
9449
- // node_modules/zod/v4/locales/ua.js
9488
+ // ../../node_modules/zod/v4/locales/ua.js
9450
9489
  function ua_default() {
9451
9490
  return uk_default();
9452
9491
  }
9453
- // node_modules/zod/v4/locales/ur.js
9492
+ // ../../node_modules/zod/v4/locales/ur.js
9454
9493
  var error41 = () => {
9455
9494
  const Sizable = {
9456
9495
  string: { unit: "حروف", verb: "ہونا" },
@@ -9567,7 +9606,7 @@ function ur_default() {
9567
9606
  localeError: error41()
9568
9607
  };
9569
9608
  }
9570
- // node_modules/zod/v4/locales/vi.js
9609
+ // ../../node_modules/zod/v4/locales/vi.js
9571
9610
  var error42 = () => {
9572
9611
  const Sizable = {
9573
9612
  string: { unit: "ký tự", verb: "có" },
@@ -9683,7 +9722,7 @@ function vi_default() {
9683
9722
  localeError: error42()
9684
9723
  };
9685
9724
  }
9686
- // node_modules/zod/v4/locales/zh-CN.js
9725
+ // ../../node_modules/zod/v4/locales/zh-CN.js
9687
9726
  var error43 = () => {
9688
9727
  const Sizable = {
9689
9728
  string: { unit: "字符", verb: "包含" },
@@ -9799,7 +9838,7 @@ function zh_CN_default() {
9799
9838
  localeError: error43()
9800
9839
  };
9801
9840
  }
9802
- // node_modules/zod/v4/locales/zh-TW.js
9841
+ // ../../node_modules/zod/v4/locales/zh-TW.js
9803
9842
  var error44 = () => {
9804
9843
  const Sizable = {
9805
9844
  string: { unit: "字元", verb: "擁有" },
@@ -9916,7 +9955,7 @@ function zh_TW_default() {
9916
9955
  localeError: error44()
9917
9956
  };
9918
9957
  }
9919
- // node_modules/zod/v4/locales/yo.js
9958
+ // ../../node_modules/zod/v4/locales/yo.js
9920
9959
  var error45 = () => {
9921
9960
  const Sizable = {
9922
9961
  string: { unit: "àmi", verb: "ní" },
@@ -10031,7 +10070,7 @@ function yo_default() {
10031
10070
  localeError: error45()
10032
10071
  };
10033
10072
  }
10034
- // node_modules/zod/v4/core/registries.js
10073
+ // ../../node_modules/zod/v4/core/registries.js
10035
10074
  var $output = Symbol("ZodOutput");
10036
10075
  var $input = Symbol("ZodInput");
10037
10076
 
@@ -10082,7 +10121,7 @@ function registry() {
10082
10121
  return new $ZodRegistry;
10083
10122
  }
10084
10123
  var globalRegistry = /* @__PURE__ */ registry();
10085
- // node_modules/zod/v4/core/api.js
10124
+ // ../../node_modules/zod/v4/core/api.js
10086
10125
  function _string(Class2, params) {
10087
10126
  return new Class2({
10088
10127
  type: "string",
@@ -10960,7 +10999,7 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
10960
10999
  const inst = new Class2(def);
10961
11000
  return inst;
10962
11001
  }
10963
- // node_modules/zod/v4/core/to-json-schema.js
11002
+ // ../../node_modules/zod/v4/core/to-json-schema.js
10964
11003
  class JSONSchemaGenerator {
10965
11004
  constructor(params) {
10966
11005
  this.counter = 0;
@@ -11764,9 +11803,9 @@ function isTransforming(_schema, _ctx) {
11764
11803
  }
11765
11804
  throw new Error(`Unknown schema type: ${def.type}`);
11766
11805
  }
11767
- // node_modules/zod/v4/core/json-schema.js
11806
+ // ../../node_modules/zod/v4/core/json-schema.js
11768
11807
  var exports_json_schema = {};
11769
- // node_modules/zod/v4/classic/iso.js
11808
+ // ../../node_modules/zod/v4/classic/iso.js
11770
11809
  var exports_iso = {};
11771
11810
  __export(exports_iso, {
11772
11811
  time: () => time2,
@@ -11807,7 +11846,7 @@ function duration2(params) {
11807
11846
  return _isoDuration(ZodISODuration, params);
11808
11847
  }
11809
11848
 
11810
- // node_modules/zod/v4/classic/errors.js
11849
+ // ../../node_modules/zod/v4/classic/errors.js
11811
11850
  var initializer2 = (inst, issues) => {
11812
11851
  $ZodError.init(inst, issues);
11813
11852
  inst.name = "ZodError";
@@ -11842,7 +11881,7 @@ var ZodRealError = $constructor("ZodError", initializer2, {
11842
11881
  Parent: Error
11843
11882
  });
11844
11883
 
11845
- // node_modules/zod/v4/classic/parse.js
11884
+ // ../../node_modules/zod/v4/classic/parse.js
11846
11885
  var parse3 = /* @__PURE__ */ _parse(ZodRealError);
11847
11886
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
11848
11887
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -11856,7 +11895,7 @@ var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
11856
11895
  var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
11857
11896
  var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
11858
11897
 
11859
- // node_modules/zod/v4/classic/schemas.js
11898
+ // ../../node_modules/zod/v4/classic/schemas.js
11860
11899
  var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
11861
11900
  $ZodType.init(inst, def);
11862
11901
  inst.def = def;
@@ -12823,7 +12862,7 @@ function json(params) {
12823
12862
  function preprocess(fn, schema) {
12824
12863
  return pipe(transform(fn), schema);
12825
12864
  }
12826
- // node_modules/zod/v4/classic/compat.js
12865
+ // ../../node_modules/zod/v4/classic/compat.js
12827
12866
  var ZodIssueCode = {
12828
12867
  invalid_type: "invalid_type",
12829
12868
  too_big: "too_big",
@@ -12847,7 +12886,7 @@ function getErrorMap() {
12847
12886
  }
12848
12887
  var ZodFirstPartyTypeKind;
12849
12888
  (function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
12850
- // node_modules/zod/v4/classic/coerce.js
12889
+ // ../../node_modules/zod/v4/classic/coerce.js
12851
12890
  var exports_coerce = {};
12852
12891
  __export(exports_coerce, {
12853
12892
  string: () => string3,
@@ -12872,7 +12911,7 @@ function date4(params) {
12872
12911
  return _coercedDate(ZodDate, params);
12873
12912
  }
12874
12913
 
12875
- // node_modules/zod/v4/classic/external.js
12914
+ // ../../node_modules/zod/v4/classic/external.js
12876
12915
  config(en_default());
12877
12916
  // src/types.ts
12878
12917
  var workflowConfigSchema = exports_external.object({
@@ -13191,7 +13230,6 @@ async function validateWorkflowVersion(workflowSlug, parentRunId, currentVersion
13191
13230
  }
13192
13231
  return parentVersionId;
13193
13232
  }
13194
-
13195
13233
  // src/index.ts
13196
13234
  async function executeStepInProcess(stepFile, stepId, dependencies, ctx, attemptNumber, backend, onLog, onCheckpoint, onCheckpointFailed, existingCheckpoints, options) {
13197
13235
  const outputPath = backend.getStepOutputPath(ctx.workflow.slug, ctx.runId, stepId, attemptNumber);
@@ -13204,7 +13242,8 @@ export {
13204
13242
  executeStepInProcess,
13205
13243
  discoverWorkflows,
13206
13244
  discoverSteps,
13207
- calculateWorkflowHash
13245
+ calculateWorkflowHash,
13246
+ StepExecutionError
13208
13247
  };
13209
13248
 
13210
- //# debugId=4438863A7AB7D73964756E2164756E21
13249
+ //# debugId=BCAEE47AD8A6D03664756E2164756E21