@fluidgrids/workflows 2026.1028.2 → 2026.1029.1

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 (118) hide show
  1. package/README.md +72 -10
  2. package/dist/{activation-DnhG7SmF.d.ts → activation-BnVQMv9y.d.ts} +1 -1
  3. package/dist/{activation-BBh1p82z.d.cts → activation-CESehfYi.d.cts} +1 -1
  4. package/dist/{chunk-XHXIDVEC.js → chunk-25BKWR2O.js} +1 -1
  5. package/dist/{chunk-UK3WM7YZ.cjs → chunk-2B37XAFQ.cjs} +44 -8
  6. package/dist/{chunk-DJYMDLV5.js → chunk-2DDULZFM.js} +93 -1
  7. package/dist/{chunk-623FVQSN.cjs → chunk-3FIDHONL.cjs} +104 -0
  8. package/dist/chunk-6QPOJZT6.cjs +1180 -0
  9. package/dist/chunk-7ILGCUI6.js +154 -0
  10. package/dist/chunk-A2OHX3UQ.js +1156 -0
  11. package/dist/{chunk-VOKMAAJP.js → chunk-A36CCOWS.js} +188 -19
  12. package/dist/{chunk-FMSW2HDF.cjs → chunk-ELL2RBML.cjs} +0 -14
  13. package/dist/{chunk-JD2VQIDZ.cjs → chunk-EWYADREB.cjs} +2 -2
  14. package/dist/{chunk-HWJZVOG7.js → chunk-FQSJI5NV.js} +1 -1
  15. package/dist/{chunk-ABFZWYHT.js → chunk-FWBRQWRX.js} +156 -48
  16. package/dist/{chunk-PZCVF76Q.cjs → chunk-I47EENR4.cjs} +209 -40
  17. package/dist/chunk-J3PYFGKA.cjs +166 -0
  18. package/dist/{chunk-C5OLWZ42.js → chunk-KXJDRQ6G.js} +1 -13
  19. package/dist/chunk-M272AHEX.js +25 -0
  20. package/dist/{chunk-VRHHBPT6.js → chunk-MJ5TGYVG.js} +333 -65
  21. package/dist/{chunk-SAOBPYYJ.cjs → chunk-NXFBVDOI.cjs} +3 -3
  22. package/dist/{chunk-XKJA7KX3.js → chunk-OIX4O6UR.js} +38 -2
  23. package/dist/{chunk-FEW3JBYA.cjs → chunk-OKX3FYIM.cjs} +3 -3
  24. package/dist/{chunk-M4BBAERY.cjs → chunk-OMY3CKUZ.cjs} +404 -136
  25. package/dist/chunk-PWIUEWC3.js +81 -0
  26. package/dist/chunk-Q4MWQNJK.cjs +28 -0
  27. package/dist/{chunk-P6TA5EZT.cjs → chunk-RUQIMTN5.cjs} +171 -57
  28. package/dist/{chunk-IISBRUWJ.js → chunk-WXXNCHUY.js} +1 -1
  29. package/dist/chunk-YHBVMOMK.cjs +87 -0
  30. package/dist/codegen/index.d.cts +2 -2
  31. package/dist/codegen/index.d.ts +2 -2
  32. package/dist/collect-BTHjQaSp.d.ts +86 -0
  33. package/dist/collect-CSyOg5XC.d.cts +86 -0
  34. package/dist/{file-BOoHZgoQ.d.cts → file-cgL9l9l8.d.cts} +765 -14
  35. package/dist/{file-yuPCFU5b.d.ts → file-olQudcx5.d.ts} +765 -14
  36. package/dist/history/index.cjs +198 -86
  37. package/dist/history/index.d.cts +49 -10
  38. package/dist/history/index.d.ts +49 -10
  39. package/dist/history/index.js +49 -4
  40. package/dist/index.cjs +64 -51
  41. package/dist/index.d.cts +9 -53
  42. package/dist/index.d.ts +9 -53
  43. package/dist/index.js +5 -4
  44. package/dist/ir/index.cjs +24 -3
  45. package/dist/ir/index.d.cts +43 -4
  46. package/dist/ir/index.d.ts +43 -4
  47. package/dist/ir/index.js +24 -3
  48. package/dist/{lower-BzmUz0sq.d.cts → lower-3S6PsqjJ.d.cts} +40 -6
  49. package/dist/{lower-_-iT4HYs.d.ts → lower-DmZpQ8hJ.d.ts} +40 -6
  50. package/dist/{manifest-C8N6HDYl.d.ts → manifest-BJjrQt77.d.ts} +1 -1
  51. package/dist/{manifest-0OLw0i7k.d.cts → manifest-gRI2Q5Fj.d.cts} +1 -1
  52. package/dist/node-evaluator-SOADN23V.js +14 -0
  53. package/dist/node-evaluator-YGDEXK4U.cjs +24 -0
  54. package/dist/quickjs/index.cjs +25 -24
  55. package/dist/quickjs/index.d.cts +6 -6
  56. package/dist/quickjs/index.d.ts +6 -6
  57. package/dist/quickjs/index.js +8 -7
  58. package/dist/roundtrip/index.cjs +245 -43
  59. package/dist/roundtrip/index.d.cts +86 -9
  60. package/dist/roundtrip/index.d.ts +86 -9
  61. package/dist/roundtrip/index.js +172 -8
  62. package/dist/runtime/index.cjs +21 -20
  63. package/dist/runtime/index.d.cts +49 -7
  64. package/dist/runtime/index.d.ts +49 -7
  65. package/dist/runtime/index.js +8 -7
  66. package/dist/testing/index.cjs +514 -74
  67. package/dist/testing/index.d.cts +127 -10
  68. package/dist/testing/index.d.ts +127 -10
  69. package/dist/testing/index.js +480 -42
  70. package/dist/{types-BGoPzgcl.d.ts → types-Bb2wRnJ5.d.cts} +20 -1
  71. package/dist/{types-BGoPzgcl.d.cts → types-Bb2wRnJ5.d.ts} +20 -1
  72. package/dist/{types-DV-HX_Gt.d.ts → types-CQKOhPTa.d.cts} +122 -14
  73. package/dist/{types-CpBBjaGX.d.cts → types-CnIOinoz.d.ts} +122 -14
  74. package/dist/{workflow-Bpr3vnA_.d.ts → workflow-8uRU9rhL.d.ts} +2 -2
  75. package/dist/{workflow-FXUkpIBc.d.cts → workflow-CZOXUlQ5.d.cts} +2 -2
  76. package/dist/{workflow-C2a05WUJ.d.ts → workflow-DWTPHFbt.d.ts} +124 -12
  77. package/dist/{workflow-J-yYixny.d.cts → workflow-O6e64ZcG.d.cts} +124 -12
  78. package/fixtures/histories/auto-upgrade-patched.history.json +276 -0
  79. package/fixtures/histories/benign-failure.history.json +146 -0
  80. package/fixtures/histories/cancel-activity-try-cancel.history.json +150 -0
  81. package/fixtures/histories/child-cancel-wait-requested.history.json +217 -0
  82. package/fixtures/histories/child-options-roundtrip.history.json +192 -0
  83. package/fixtures/histories/continue-as-new-last-result.history.json +86 -0
  84. package/fixtures/histories/continue-as-new-options.history.json +99 -0
  85. package/fixtures/histories/continue-as-new-r1-long-task-queue.history.json +78 -0
  86. package/fixtures/histories/continue-as-new-r1-retry-options.history.json +83 -0
  87. package/fixtures/histories/execution-timeout-chain.history.json +98 -0
  88. package/fixtures/histories/external-cancel-resolved.history.json +123 -0
  89. package/fixtures/histories/external-cancel-unknown-target.history.json +127 -0
  90. package/fixtures/histories/failure-error-types-fails-run.history.json +144 -0
  91. package/fixtures/histories/handler-drain-warn.history.json +222 -0
  92. package/fixtures/histories/heartbeat-details-on-retry.history.json +145 -0
  93. package/fixtures/histories/local-activity-abandoned-at-completion.history.json +73 -0
  94. package/fixtures/histories/local-activity-cancelled-in-scope.history.json +118 -0
  95. package/fixtures/histories/local-activity-completed.history.json +157 -0
  96. package/fixtures/histories/local-activity-failed.history.json +93 -0
  97. package/fixtures/histories/local-activity-retry-in-task.history.json +88 -0
  98. package/fixtures/histories/run-retry-last-failure.history.json +90 -0
  99. package/fixtures/histories/run-timeout.history.json +159 -0
  100. package/fixtures/histories/schedule-to-start-timeout.history.json +132 -0
  101. package/fixtures/histories/start-delay-signal-ends-delay.history.json +155 -0
  102. package/fixtures/histories/typeerror-task-retry-100.history.json +137 -0
  103. package/package.json +1 -1
  104. package/schema/history-file.schema.json +283 -2
  105. package/schema/ir-v2.schema.json +45 -0
  106. package/schema/run-event.schema.json +264 -2
  107. package/schema/workflow-command.schema.json +178 -1
  108. package/schema/workflow-task.schema.json +392 -4
  109. package/dist/assemble-BLqQ8lSu.d.cts +0 -39
  110. package/dist/assemble-DWgaXHd-.d.ts +0 -39
  111. package/dist/chunk-2J6TF7YI.cjs +0 -86
  112. package/dist/chunk-BO6OVILK.js +0 -79
  113. package/dist/chunk-DHTLALBL.cjs +0 -80
  114. package/dist/chunk-I5LR3D2K.js +0 -869
  115. package/dist/chunk-N23SKIG4.js +0 -73
  116. package/dist/chunk-QQ6ULXHI.cjs +0 -885
  117. package/dist/node-evaluator-4MSDKWOG.cjs +0 -22
  118. package/dist/node-evaluator-SX4LEYQC.js +0 -12
@@ -1,10 +1,10 @@
1
- import { E as Evaluator } from '../lower-BzmUz0sq.cjs';
2
- import { a7 as WorkflowTaskRequest, a8 as WorkflowTaskResult } from '../types-CpBBjaGX.cjs';
1
+ import { E as Evaluator } from '../lower-3S6PsqjJ.cjs';
2
+ import { aj as WorkflowTaskRequest, ak as WorkflowTaskResult } from '../types-CQKOhPTa.cjs';
3
3
  import '../hash-CZkTXPCX.cjs';
4
- import '../types-BGoPzgcl.cjs';
5
- import '../assemble-BLqQ8lSu.cjs';
6
- import '../workflow-FXUkpIBc.cjs';
7
- import '../workflow-J-yYixny.cjs';
4
+ import '../types-Bb2wRnJ5.cjs';
5
+ import '../collect-CSyOg5XC.cjs';
6
+ import '../workflow-CZOXUlQ5.cjs';
7
+ import '../workflow-O6e64ZcG.cjs';
8
8
  import '../lower-types-DQNBfWQn.cjs';
9
9
  import 'esbuild';
10
10
 
@@ -1,10 +1,10 @@
1
- import { E as Evaluator } from '../lower-_-iT4HYs.js';
2
- import { a7 as WorkflowTaskRequest, a8 as WorkflowTaskResult } from '../types-DV-HX_Gt.js';
1
+ import { E as Evaluator } from '../lower-DmZpQ8hJ.js';
2
+ import { aj as WorkflowTaskRequest, ak as WorkflowTaskResult } from '../types-CnIOinoz.js';
3
3
  import '../hash-CZkTXPCX.js';
4
- import '../types-BGoPzgcl.js';
5
- import '../assemble-DWgaXHd-.js';
6
- import '../workflow-Bpr3vnA_.js';
7
- import '../workflow-C2a05WUJ.js';
4
+ import '../types-Bb2wRnJ5.js';
5
+ import '../collect-BTHjQaSp.js';
6
+ import '../workflow-8uRU9rhL.js';
7
+ import '../workflow-DWTPHFbt.js';
8
8
  import '../lower-types-DQNBfWQn.js';
9
9
  import 'esbuild';
10
10
 
@@ -1,7 +1,7 @@
1
- import { runIsolateWorker, outcomeToCollection, LowerError } from '../chunk-I5LR3D2K.js';
2
- import '../chunk-XKJA7KX3.js';
3
- import { failedTaskResult } from '../chunk-IISBRUWJ.js';
4
- import '../chunk-HWJZVOG7.js';
1
+ import { runIsolateWorker, outcomeToCollection, LowerError } from '../chunk-A2OHX3UQ.js';
2
+ import '../chunk-OIX4O6UR.js';
3
+ import { failedTaskResult } from '../chunk-WXXNCHUY.js';
4
+ import '../chunk-FQSJI5NV.js';
5
5
  import { buildIdOf } from '../chunk-BD7ZPG53.js';
6
6
  import '../chunk-5LUIDMF4.js';
7
7
  import '../chunk-JZ4TOOLN.js';
@@ -9,9 +9,10 @@ import '../chunk-E2VK7J2C.js';
9
9
  import '../chunk-7AAZGVKD.js';
10
10
  import { isRecord } from '../chunk-PMCM2OH4.js';
11
11
  import '../chunk-4LYSEANA.js';
12
- import '../chunk-N23SKIG4.js';
13
- import '../chunk-DJYMDLV5.js';
14
- import '../chunk-BO6OVILK.js';
12
+ import '../chunk-7ILGCUI6.js';
13
+ import '../chunk-LNUQE6D6.js';
14
+ import '../chunk-2DDULZFM.js';
15
+ import '../chunk-PWIUEWC3.js';
15
16
  import { createRequire } from 'module';
16
17
  import { pathToFileURL } from 'url';
17
18
  import { Worker } from 'worker_threads';
@@ -1,20 +1,23 @@
1
1
  'use strict';
2
2
 
3
- var chunkFEW3JBYA_cjs = require('../chunk-FEW3JBYA.cjs');
3
+ var chunkOKX3FYIM_cjs = require('../chunk-OKX3FYIM.cjs');
4
4
  var chunkNEIUQASE_cjs = require('../chunk-NEIUQASE.cjs');
5
5
  var chunkSX2PNKKT_cjs = require('../chunk-SX2PNKKT.cjs');
6
6
  var chunkCPDK3K5N_cjs = require('../chunk-CPDK3K5N.cjs');
7
- var chunkQQ6ULXHI_cjs = require('../chunk-QQ6ULXHI.cjs');
8
- require('../chunk-UK3WM7YZ.cjs');
9
- var chunkSAOBPYYJ_cjs = require('../chunk-SAOBPYYJ.cjs');
7
+ var chunk6QPOJZT6_cjs = require('../chunk-6QPOJZT6.cjs');
8
+ require('../chunk-2B37XAFQ.cjs');
9
+ var chunkNXFBVDOI_cjs = require('../chunk-NXFBVDOI.cjs');
10
10
  var chunkGBQ33SIZ_cjs = require('../chunk-GBQ33SIZ.cjs');
11
11
  require('../chunk-G4UEPUGO.cjs');
12
12
  var chunkGVTZMA5C_cjs = require('../chunk-GVTZMA5C.cjs');
13
13
  var chunkQKZL3ONM_cjs = require('../chunk-QKZL3ONM.cjs');
14
14
  var chunkTBDXTV22_cjs = require('../chunk-TBDXTV22.cjs');
15
15
  var chunkSAENRNBJ_cjs = require('../chunk-SAENRNBJ.cjs');
16
- require('../chunk-DHTLALBL.cjs');
17
- require('../chunk-2J6TF7YI.cjs');
16
+ var chunkQ4MWQNJK_cjs = require('../chunk-Q4MWQNJK.cjs');
17
+ require('../chunk-J3PYFGKA.cjs');
18
+ require('../chunk-FR7KYWRO.cjs');
19
+ require('../chunk-3FIDHONL.cjs');
20
+ require('../chunk-YHBVMOMK.cjs');
18
21
  require('../chunk-Z2Y65YOY.cjs');
19
22
  var fs = require('fs');
20
23
  var path = require('path');
@@ -253,7 +256,7 @@ function richEdge(edge2, info, items) {
253
256
  const options2 = [];
254
257
  const extra = [];
255
258
  if (edge2["id"] === void 0) options2.push(["id", { k: "literal", value: false }]);
256
- else if (edge2["id"] !== chunkSAOBPYYJ_cjs.defaultEdgeId(source, target, sourceHandle, targetHandle))
259
+ else if (edge2["id"] !== chunkNXFBVDOI_cjs.defaultEdgeId(source, target, sourceHandle, targetHandle))
257
260
  options2.push(["id", literalOrStructure(edge2["id"])]);
258
261
  if (edge2["type"] === void 0) options2.push(["type", { k: "literal", value: false }]);
259
262
  else if (edge2["type"] !== "deletable") options2.push(["type", literalOrStructure(edge2["type"])]);
@@ -754,19 +757,19 @@ function connectionsByName(connectionNames, definition) {
754
757
  function descriptor(operation) {
755
758
  switch (operation.kind) {
756
759
  case "trigger": {
757
- const value2 = chunkSAOBPYYJ_cjs.triggers[operation.name];
760
+ const value2 = chunkNXFBVDOI_cjs.triggers[operation.name];
758
761
  if (!value2) throw new LiftError(`Unknown trigger ${operation.name}`);
759
762
  return value2;
760
763
  }
761
764
  case "internal": {
762
- const value2 = chunkSAOBPYYJ_cjs.internalNodes[operation.name];
765
+ const value2 = chunkNXFBVDOI_cjs.internalNodes[operation.name];
763
766
  if (!value2) throw new LiftError(`Unknown internal node ${operation.name}`);
764
767
  return value2;
765
768
  }
766
769
  case "client":
767
- return operation.role === "trigger" ? chunkSAOBPYYJ_cjs.trigger(operation.nodeType, operation.version, operation.operation) : chunkSAOBPYYJ_cjs.op(operation.nodeType, operation.version, operation.operation);
770
+ return operation.role === "trigger" ? chunkNXFBVDOI_cjs.trigger(operation.nodeType, operation.version, operation.operation) : chunkNXFBVDOI_cjs.op(operation.nodeType, operation.version, operation.operation);
768
771
  case "custom":
769
- return chunkSAOBPYYJ_cjs.nodes.custom(operation.nodeType, operation.operation, operation.version);
772
+ return chunkNXFBVDOI_cjs.nodes.custom(operation.nodeType, operation.operation, operation.version);
770
773
  }
771
774
  }
772
775
  function refValue(ref, wf, runtime) {
@@ -824,7 +827,7 @@ function value(expression2, wf, runtime) {
824
827
  return (declared ?? wf.ref(expression2.nodeId)).handle(expression2.handle);
825
828
  }
826
829
  case "edge":
827
- return chunkSAOBPYYJ_cjs.edge(
830
+ return chunkNXFBVDOI_cjs.edge(
828
831
  value(expression2.from, wf, runtime),
829
832
  value({ k: "object", entries: expression2.options }, wf, runtime)
830
833
  );
@@ -852,7 +855,7 @@ function interpretPlan(plan) {
852
855
  k: "object",
853
856
  entries: plan.workflowOptions
854
857
  });
855
- const workflow = chunkSAOBPYYJ_cjs.defineWorkflow(workflowOptions2, (wf) => {
858
+ const workflow = chunkNXFBVDOI_cjs.defineWorkflow(workflowOptions2, (wf) => {
856
859
  const runtime = /* @__PURE__ */ new Map();
857
860
  for (const statement of plan.statements) {
858
861
  if (statement.kind === "node") {
@@ -1130,8 +1133,8 @@ function layoutOf(reference) {
1130
1133
  if (typeof x === "number" && typeof y === "number") chunkSAENRNBJ_cjs.setOwn(positions, node["id"], { x, y });
1131
1134
  }
1132
1135
  const sidecar = {
1133
- format: chunkSAOBPYYJ_cjs.LAYOUT_FORMAT,
1134
- formatVersion: chunkSAOBPYYJ_cjs.LAYOUT_FORMAT_VERSION,
1136
+ format: chunkNXFBVDOI_cjs.LAYOUT_FORMAT,
1137
+ formatVersion: chunkNXFBVDOI_cjs.LAYOUT_FORMAT_VERSION,
1135
1138
  positions
1136
1139
  };
1137
1140
  if (Array.isArray(data["stickyNotes"])) sidecar.stickyNotes = data["stickyNotes"];
@@ -1229,7 +1232,7 @@ function prepareLift(definition, options2 = {}) {
1229
1232
  const run = (rawNodes, rawEdges) => {
1230
1233
  const build = buildPlan(reference, options2, rawNodes, rawEdges);
1231
1234
  const recording = interpretPlan(build.plan);
1232
- const candidate = chunkSAOBPYYJ_cjs.assembleRecording(recording, {
1235
+ const candidate = chunkNXFBVDOI_cjs.assembleRecording(recording, {
1233
1236
  layout,
1234
1237
  ...connections ? { connections } : {},
1235
1238
  ...pinned ? { pinnedData: pinned } : {}
@@ -1357,12 +1360,12 @@ function readJson(path) {
1357
1360
  try {
1358
1361
  parsed = JSON.parse(fs.readFileSync(path, "utf8"));
1359
1362
  } catch (error) {
1360
- throw new chunkQQ6ULXHI_cjs.LowerError(
1363
+ throw new chunk6QPOJZT6_cjs.LowerError(
1361
1364
  `Cannot read ${path}: ${error instanceof Error ? error.message : String(error)}`
1362
1365
  );
1363
1366
  }
1364
1367
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
1365
- throw new chunkQQ6ULXHI_cjs.LowerError(`${path} is not a JSON object`);
1368
+ throw new chunk6QPOJZT6_cjs.LowerError(`${path} is not a JSON object`);
1366
1369
  return parsed;
1367
1370
  }
1368
1371
  function namesOf(value2) {
@@ -1395,7 +1398,7 @@ function collectFiles(packageDir, dir, files, budget) {
1395
1398
  if (!KEPT_EXTENSIONS.some((ext) => entry.endsWith(ext))) continue;
1396
1399
  budget.left -= stats.size;
1397
1400
  if (budget.left < 0)
1398
- throw new chunkQQ6ULXHI_cjs.LowerError(
1401
+ throw new chunk6QPOJZT6_cjs.LowerError(
1399
1402
  `The vendored packages are larger than the limit (reached at "${budget.name}")`,
1400
1403
  "too-large"
1401
1404
  );
@@ -1415,7 +1418,7 @@ function vendorDependencies(projectDir, options2 = {}) {
1415
1418
  const packageDir = locate(next.name, next.fromDir);
1416
1419
  if (packageDir === void 0) {
1417
1420
  if (next.optional) continue;
1418
- throw new chunkQQ6ULXHI_cjs.LowerError(
1421
+ throw new chunk6QPOJZT6_cjs.LowerError(
1419
1422
  `"${next.name}" is a dependency but is not installed under ${rootDir}; run your package manager's install first`
1420
1423
  );
1421
1424
  }
@@ -1446,16 +1449,17 @@ function packSources(archive) {
1446
1449
  if (archive.lock !== void 0) value2["lock"] = archive.lock;
1447
1450
  if (archive.vendored !== void 0 && Object.keys(archive.vendored).length > 0)
1448
1451
  value2["vendored"] = archive.vendored;
1452
+ if (archive.map !== void 0) value2["map"] = archive.map;
1449
1453
  const text = chunkQKZL3ONM_cjs.canonicalJson(value2);
1450
1454
  const zipped = zlib.gzipSync(Buffer.from(text, "utf8"), { level: 9 });
1451
1455
  zipped[GZIP_OS_BYTE] = 255;
1452
1456
  return new Uint8Array(zipped.buffer, zipped.byteOffset, zipped.byteLength);
1453
1457
  }
1454
1458
  function stringMap(value2, what) {
1455
- if (!chunkSAENRNBJ_cjs.isRecord(value2)) throw new chunkQQ6ULXHI_cjs.LowerError(`${what} must be an object`);
1459
+ if (!chunkSAENRNBJ_cjs.isRecord(value2)) throw new chunk6QPOJZT6_cjs.LowerError(`${what} must be an object`);
1456
1460
  const out = {};
1457
1461
  for (const [key, entry] of Object.entries(value2)) {
1458
- if (typeof entry !== "string") throw new chunkQQ6ULXHI_cjs.LowerError(`${what}["${key}"] must be a string`);
1462
+ if (typeof entry !== "string") throw new chunk6QPOJZT6_cjs.LowerError(`${what}["${key}"] must be a string`);
1459
1463
  Object.defineProperty(out, key, {
1460
1464
  value: entry,
1461
1465
  enumerable: true,
@@ -1472,7 +1476,7 @@ function unpackSources(data, options2 = {}) {
1472
1476
  text = zlib.gunzipSync(data, { maxOutputLength: maxBytes }).toString("utf8");
1473
1477
  } catch (error) {
1474
1478
  const message = error instanceof Error ? error.message : String(error);
1475
- throw new chunkQQ6ULXHI_cjs.LowerError(
1479
+ throw new chunk6QPOJZT6_cjs.LowerError(
1476
1480
  /buffer|length|range/i.test(message) ? `The source archive is larger than ${maxBytes} bytes uncompressed` : `The source archive is not gzip: ${message}`,
1477
1481
  /buffer|length|range/i.test(message) ? "too-large" : void 0
1478
1482
  );
@@ -1481,20 +1485,24 @@ function unpackSources(data, options2 = {}) {
1481
1485
  try {
1482
1486
  parsed = JSON.parse(text);
1483
1487
  } catch {
1484
- throw new chunkQQ6ULXHI_cjs.LowerError("The source archive is not JSON");
1488
+ throw new chunk6QPOJZT6_cjs.LowerError("The source archive is not JSON");
1485
1489
  }
1486
- if (!chunkSAENRNBJ_cjs.isRecord(parsed)) throw new chunkQQ6ULXHI_cjs.LowerError("The source archive is not an object");
1490
+ if (!chunkSAENRNBJ_cjs.isRecord(parsed)) throw new chunk6QPOJZT6_cjs.LowerError("The source archive is not an object");
1487
1491
  const archive = { files: stringMap(parsed["files"], "files") };
1488
1492
  if (parsed["lock"] !== void 0) {
1489
- if (typeof parsed["lock"] !== "string") throw new chunkQQ6ULXHI_cjs.LowerError("lock must be a string");
1493
+ if (typeof parsed["lock"] !== "string") throw new chunk6QPOJZT6_cjs.LowerError("lock must be a string");
1490
1494
  archive.lock = parsed["lock"];
1491
1495
  }
1496
+ if (parsed["map"] !== void 0) {
1497
+ if (typeof parsed["map"] !== "string") throw new chunk6QPOJZT6_cjs.LowerError("map must be a string");
1498
+ archive.map = parsed["map"];
1499
+ }
1492
1500
  if (parsed["vendored"] !== void 0) {
1493
- if (!chunkSAENRNBJ_cjs.isRecord(parsed["vendored"])) throw new chunkQQ6ULXHI_cjs.LowerError("vendored must be an object");
1501
+ if (!chunkSAENRNBJ_cjs.isRecord(parsed["vendored"])) throw new chunk6QPOJZT6_cjs.LowerError("vendored must be an object");
1494
1502
  const vendored = {};
1495
1503
  for (const [name, pkg] of Object.entries(parsed["vendored"])) {
1496
1504
  if (!chunkSAENRNBJ_cjs.isRecord(pkg) || typeof pkg["version"] !== "string")
1497
- throw new chunkQQ6ULXHI_cjs.LowerError(`vendored["${name}"] needs a version`);
1505
+ throw new chunk6QPOJZT6_cjs.LowerError(`vendored["${name}"] needs a version`);
1498
1506
  Object.defineProperty(vendored, name, {
1499
1507
  value: {
1500
1508
  version: pkg["version"],
@@ -1513,6 +1521,162 @@ function archiveDeps(archive) {
1513
1521
  return archive.vendored ?? {};
1514
1522
  }
1515
1523
 
1524
+ // src/roundtrip/source-map.ts
1525
+ var BUNDLE_FILE_NAME = "workflow-bundle.mjs";
1526
+ var BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1527
+ var BASE64_VALUE = new Map([...BASE64].map((char, index) => [char, index]));
1528
+ function decodeVlq(segment) {
1529
+ const values = [];
1530
+ let value2 = 0;
1531
+ let shift = 0;
1532
+ for (const char of segment) {
1533
+ const digit = BASE64_VALUE.get(char);
1534
+ if (digit === void 0) throw new chunk6QPOJZT6_cjs.LowerError(`Invalid source map character "${char}"`);
1535
+ value2 += (digit & 31) * 2 ** shift;
1536
+ if (digit & 32) {
1537
+ shift += 5;
1538
+ continue;
1539
+ }
1540
+ values.push(value2 % 2 === 1 ? -Math.floor(value2 / 2) : Math.floor(value2 / 2));
1541
+ value2 = 0;
1542
+ shift = 0;
1543
+ }
1544
+ if (shift !== 0) throw new chunk6QPOJZT6_cjs.LowerError("A source map segment ends in the middle of a number");
1545
+ return values;
1546
+ }
1547
+ function createSourceMapper(mapText) {
1548
+ let parsed;
1549
+ try {
1550
+ parsed = JSON.parse(mapText);
1551
+ } catch {
1552
+ throw new chunk6QPOJZT6_cjs.LowerError("The source map is not JSON");
1553
+ }
1554
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
1555
+ throw new chunk6QPOJZT6_cjs.LowerError("The source map is not an object");
1556
+ const record = parsed;
1557
+ const sources = record["sources"];
1558
+ const names = Array.isArray(record["names"]) ? record["names"].map(String) : [];
1559
+ const mappings = record["mappings"];
1560
+ if (record["version"] !== 3 || !Array.isArray(sources) || typeof mappings !== "string")
1561
+ throw new chunk6QPOJZT6_cjs.LowerError("Only version 3 source maps with mappings are supported");
1562
+ const sourceNames = sources.map(String);
1563
+ const lines = [];
1564
+ let source = 0;
1565
+ let line = 0;
1566
+ let sourceColumn = 0;
1567
+ let name = 0;
1568
+ for (const lineText of mappings.split(";")) {
1569
+ const segments = [];
1570
+ let column = 0;
1571
+ for (const text of lineText.split(",")) {
1572
+ if (text === "") continue;
1573
+ const values = decodeVlq(text);
1574
+ column += values[0] ?? 0;
1575
+ if (values.length < 4) continue;
1576
+ source += values[1] ?? 0;
1577
+ line += values[2] ?? 0;
1578
+ sourceColumn += values[3] ?? 0;
1579
+ const segment = { column, source, line, sourceColumn };
1580
+ if (values.length >= 5) {
1581
+ name += values[4] ?? 0;
1582
+ segment.name = name;
1583
+ }
1584
+ segments.push(segment);
1585
+ }
1586
+ segments.sort((a, b) => a.column - b.column);
1587
+ lines.push(segments);
1588
+ }
1589
+ return {
1590
+ lookup(atLine, atColumn) {
1591
+ const segments = lines[atLine - 1];
1592
+ if (!segments || segments.length === 0) return void 0;
1593
+ let found = segments[0];
1594
+ if (atColumn !== void 0) {
1595
+ found = void 0;
1596
+ for (const segment of segments) {
1597
+ if (segment.column > atColumn) break;
1598
+ found = segment;
1599
+ }
1600
+ found ??= segments[0];
1601
+ }
1602
+ if (!found) return void 0;
1603
+ const sourceName = sourceNames[found.source];
1604
+ if (sourceName === void 0) return void 0;
1605
+ const position = {
1606
+ source: sourceName,
1607
+ line: found.line + 1,
1608
+ column: found.sourceColumn
1609
+ };
1610
+ const mappedName = found.name !== void 0 ? names[found.name] : void 0;
1611
+ if (mappedName !== void 0) position.name = mappedName;
1612
+ return position;
1613
+ }
1614
+ };
1615
+ }
1616
+ function isBundleFile(path, bundleFile) {
1617
+ return path !== void 0 && (path === bundleFile || path.endsWith(`/${bundleFile}`));
1618
+ }
1619
+ function mapStackTrace(stack, mapper, bundleFile = BUNDLE_FILE_NAME) {
1620
+ const frame = new RegExp(
1621
+ `${bundleFile.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}:(\\d+)(?::(\\d+))?`,
1622
+ "g"
1623
+ );
1624
+ return stack.split("\n").map(
1625
+ (line) => line.replace(frame, (whole, lineText, columnText) => {
1626
+ const position = mapper.lookup(
1627
+ Number(lineText),
1628
+ columnText !== void 0 ? Number(columnText) - 1 : void 0
1629
+ );
1630
+ return position ? `${position.source}:${position.line}:${position.column + 1}` : whole;
1631
+ })
1632
+ ).join("\n");
1633
+ }
1634
+ function mapEnhancedStackTrace(value2, mapper, bundleFile = BUNDLE_FILE_NAME) {
1635
+ if (typeof value2 !== "object" || value2 === null || Array.isArray(value2)) return value2;
1636
+ const stacks = value2["stacks"];
1637
+ if (!Array.isArray(stacks)) return value2;
1638
+ const mappedStacks = stacks.map((stack) => {
1639
+ if (typeof stack !== "object" || stack === null || Array.isArray(stack)) return stack;
1640
+ const locations = stack["locations"];
1641
+ if (!Array.isArray(locations)) return stack;
1642
+ return {
1643
+ ...stack,
1644
+ locations: locations.map((location) => {
1645
+ if (typeof location !== "object" || location === null || Array.isArray(location))
1646
+ return location;
1647
+ const filePath = typeof location["filePath"] === "string" ? location["filePath"] : void 0;
1648
+ const line = typeof location["line"] === "number" ? location["line"] : void 0;
1649
+ const column = typeof location["column"] === "number" ? location["column"] : void 0;
1650
+ if (!isBundleFile(filePath, bundleFile) || line === void 0) return location;
1651
+ const position = mapper.lookup(line, column !== void 0 ? column - 1 : void 0);
1652
+ if (!position) return location;
1653
+ const out = {
1654
+ ...location,
1655
+ filePath: position.source,
1656
+ line: position.line,
1657
+ column: position.column + 1,
1658
+ bundleLine: line
1659
+ };
1660
+ if (column !== void 0) out["bundleColumn"] = column;
1661
+ return out;
1662
+ })
1663
+ };
1664
+ });
1665
+ return { ...value2, stacks: mappedStacks };
1666
+ }
1667
+ function sourceLocations(stack, mapper, bundleFile = BUNDLE_FILE_NAME) {
1668
+ const out = [];
1669
+ for (const location of chunkQ4MWQNJK_cjs.parseStack(stack)) {
1670
+ if (!isBundleFile(location.filePath, bundleFile) || location.line === void 0) continue;
1671
+ const position = mapper.lookup(
1672
+ location.line,
1673
+ location.column !== void 0 ? location.column - 1 : void 0
1674
+ );
1675
+ if (position) out.push(position);
1676
+ }
1677
+ return out;
1678
+ }
1679
+
1516
1680
  // src/roundtrip/fidelity.ts
1517
1681
  var LOSSY_KINDS = /* @__PURE__ */ new Set([
1518
1682
  "layout-omitted",
@@ -1524,7 +1688,7 @@ async function checkFidelity(files, reference, items, options2 = {}) {
1524
1688
  const all = [...items];
1525
1689
  const connections = options2.connectionNames && chunkSAENRNBJ_cjs.isRecord(reference) ? connectionsByName(options2.connectionNames, reference) : void 0;
1526
1690
  try {
1527
- const result = await chunkQQ6ULXHI_cjs.lower(
1691
+ const result = await chunk6QPOJZT6_cjs.lower(
1528
1692
  files.map((file) => ({ path: file.path, content: file.content })),
1529
1693
  {
1530
1694
  ...options2.esbuild ? { esbuild: options2.esbuild } : {},
@@ -1569,7 +1733,7 @@ async function exportWorkflowCode(definition, options2) {
1569
1733
 
1570
1734
  Object.defineProperty(exports, "createNodeVmEvaluator", {
1571
1735
  enumerable: true,
1572
- get: function () { return chunkFEW3JBYA_cjs.createNodeVmEvaluator; }
1736
+ get: function () { return chunkOKX3FYIM_cjs.createNodeVmEvaluator; }
1573
1737
  });
1574
1738
  Object.defineProperty(exports, "PY_LINE_LENGTH", {
1575
1739
  enumerable: true,
@@ -1585,66 +1749,104 @@ Object.defineProperty(exports, "TS_NODES_IMPORT", {
1585
1749
  });
1586
1750
  Object.defineProperty(exports, "DeterminismViolationError", {
1587
1751
  enumerable: true,
1588
- get: function () { return chunkQQ6ULXHI_cjs.DeterminismViolationError; }
1752
+ get: function () { return chunk6QPOJZT6_cjs.DeterminismViolationError; }
1589
1753
  });
1590
1754
  Object.defineProperty(exports, "ESBUILD_VERSION", {
1591
1755
  enumerable: true,
1592
- get: function () { return chunkQQ6ULXHI_cjs.ESBUILD_VERSION; }
1756
+ get: function () { return chunk6QPOJZT6_cjs.ESBUILD_VERSION; }
1593
1757
  });
1594
1758
  Object.defineProperty(exports, "EVALUATION_GLOBAL", {
1595
1759
  enumerable: true,
1596
- get: function () { return chunkQQ6ULXHI_cjs.EVALUATION_GLOBAL; }
1760
+ get: function () { return chunk6QPOJZT6_cjs.EVALUATION_GLOBAL; }
1597
1761
  });
1598
1762
  Object.defineProperty(exports, "LowerError", {
1599
1763
  enumerable: true,
1600
- get: function () { return chunkQQ6ULXHI_cjs.LowerError; }
1764
+ get: function () { return chunk6QPOJZT6_cjs.LowerError; }
1601
1765
  });
1602
1766
  Object.defineProperty(exports, "NODE_BUILTINS", {
1603
1767
  enumerable: true,
1604
- get: function () { return chunkQQ6ULXHI_cjs.NODE_BUILTINS; }
1768
+ get: function () { return chunk6QPOJZT6_cjs.NODE_BUILTINS; }
1605
1769
  });
1606
1770
  Object.defineProperty(exports, "buildBundle", {
1607
1771
  enumerable: true,
1608
- get: function () { return chunkQQ6ULXHI_cjs.buildBundle; }
1772
+ get: function () { return chunk6QPOJZT6_cjs.buildBundle; }
1609
1773
  });
1610
1774
  Object.defineProperty(exports, "bundleProject", {
1611
1775
  enumerable: true,
1612
- get: function () { return chunkQQ6ULXHI_cjs.bundleProject; }
1776
+ get: function () { return chunk6QPOJZT6_cjs.bundleProject; }
1613
1777
  });
1614
1778
  Object.defineProperty(exports, "bundleSourceHash", {
1615
1779
  enumerable: true,
1616
- get: function () { return chunkQQ6ULXHI_cjs.bundleSourceHash; }
1780
+ get: function () { return chunk6QPOJZT6_cjs.bundleSourceHash; }
1781
+ });
1782
+ Object.defineProperty(exports, "callArguments", {
1783
+ enumerable: true,
1784
+ get: function () { return chunk6QPOJZT6_cjs.callArguments; }
1617
1785
  });
1618
1786
  Object.defineProperty(exports, "defaultEntries", {
1619
1787
  enumerable: true,
1620
- get: function () { return chunkQQ6ULXHI_cjs.defaultEntries; }
1788
+ get: function () { return chunk6QPOJZT6_cjs.defaultEntries; }
1789
+ });
1790
+ Object.defineProperty(exports, "durableFeatures", {
1791
+ enumerable: true,
1792
+ get: function () { return chunk6QPOJZT6_cjs.durableFeatures; }
1793
+ });
1794
+ Object.defineProperty(exports, "durableScanModules", {
1795
+ enumerable: true,
1796
+ get: function () { return chunk6QPOJZT6_cjs.durableScanModules; }
1797
+ });
1798
+ Object.defineProperty(exports, "literalDurationMs", {
1799
+ enumerable: true,
1800
+ get: function () { return chunk6QPOJZT6_cjs.literalDurationMs; }
1621
1801
  });
1622
1802
  Object.defineProperty(exports, "lower", {
1623
1803
  enumerable: true,
1624
- get: function () { return chunkQQ6ULXHI_cjs.lower; }
1804
+ get: function () { return chunk6QPOJZT6_cjs.lower; }
1805
+ });
1806
+ Object.defineProperty(exports, "objectEntries", {
1807
+ enumerable: true,
1808
+ get: function () { return chunk6QPOJZT6_cjs.objectEntries; }
1625
1809
  });
1626
1810
  Object.defineProperty(exports, "resolvePackageEntry", {
1627
1811
  enumerable: true,
1628
- get: function () { return chunkQQ6ULXHI_cjs.resolvePackageEntry; }
1812
+ get: function () { return chunk6QPOJZT6_cjs.resolvePackageEntry; }
1813
+ });
1814
+ Object.defineProperty(exports, "scanDurableSource", {
1815
+ enumerable: true,
1816
+ get: function () { return chunk6QPOJZT6_cjs.scanDurableSource; }
1629
1817
  });
1630
1818
  Object.defineProperty(exports, "scanDurableSources", {
1631
1819
  enumerable: true,
1632
- get: function () { return chunkQQ6ULXHI_cjs.scanDurableSources; }
1820
+ get: function () { return chunk6QPOJZT6_cjs.scanDurableSources; }
1633
1821
  });
1634
1822
  Object.defineProperty(exports, "splitSpecifier", {
1635
1823
  enumerable: true,
1636
- get: function () { return chunkQQ6ULXHI_cjs.splitSpecifier; }
1824
+ get: function () { return chunk6QPOJZT6_cjs.splitSpecifier; }
1825
+ });
1826
+ Object.defineProperty(exports, "splitTopLevel", {
1827
+ enumerable: true,
1828
+ get: function () { return chunk6QPOJZT6_cjs.splitTopLevel; }
1829
+ });
1830
+ Object.defineProperty(exports, "withoutAllComments", {
1831
+ enumerable: true,
1832
+ get: function () { return chunk6QPOJZT6_cjs.withoutAllComments; }
1637
1833
  });
1834
+ exports.BUNDLE_FILE_NAME = BUNDLE_FILE_NAME;
1638
1835
  exports.LiftError = LiftError;
1639
1836
  exports.PY_PROJECT_MODULE = PY_PROJECT_MODULE;
1640
1837
  exports.PY_SDK_MODULE = PY_SDK_MODULE;
1641
1838
  exports.SOURCE_ARCHIVE_MAX_BYTES = SOURCE_ARCHIVE_MAX_BYTES;
1642
1839
  exports.archiveDeps = archiveDeps;
1643
1840
  exports.checkFidelity = checkFidelity;
1841
+ exports.createSourceMapper = createSourceMapper;
1842
+ exports.decodeVlq = decodeVlq;
1644
1843
  exports.exportWorkflowCode = exportWorkflowCode;
1645
1844
  exports.liftToPython = liftToPython;
1646
1845
  exports.liftToTypeScript = liftToTypeScript;
1846
+ exports.mapEnhancedStackTrace = mapEnhancedStackTrace;
1847
+ exports.mapStackTrace = mapStackTrace;
1647
1848
  exports.packSources = packSources;
1648
1849
  exports.prepareLift = prepareLift;
1850
+ exports.sourceLocations = sourceLocations;
1649
1851
  exports.unpackSources = unpackSources;
1650
1852
  exports.vendorDependencies = vendorDependencies;