@fluidgrids/workflows 2026.1027.0 → 2026.1028.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 (168) hide show
  1. package/README.md +170 -18
  2. package/dist/activation-BBh1p82z.d.cts +57 -0
  3. package/dist/activation-DnhG7SmF.d.ts +57 -0
  4. package/dist/assemble-BLqQ8lSu.d.cts +39 -0
  5. package/dist/assemble-DWgaXHd-.d.ts +39 -0
  6. package/dist/chunk-2DP2Y6EU.cjs +832 -0
  7. package/dist/chunk-2J6TF7YI.cjs +86 -0
  8. package/dist/chunk-3FOTFQ3J.js +1622 -0
  9. package/dist/chunk-4LYSEANA.js +199 -0
  10. package/dist/{chunk-KUTMY2IO.cjs → chunk-57MSZ24T.cjs} +162 -98
  11. package/dist/{chunk-BWSLWF2E.js → chunk-5HDSBTBX.js} +99 -32
  12. package/dist/chunk-623FVQSN.cjs +251 -0
  13. package/dist/{chunk-4DPEGDPW.js → chunk-6FSHT5IL.js} +4 -4
  14. package/dist/{chunk-REV7ZOA4.js → chunk-7AAZGVKD.js} +1 -35
  15. package/dist/chunk-7NQ37GZU.js +73 -0
  16. package/dist/chunk-ABFZWYHT.js +612 -0
  17. package/dist/{chunk-SS4LT2IP.js → chunk-BD7ZPG53.js} +5 -10
  18. package/dist/chunk-BO6OVILK.js +79 -0
  19. package/dist/chunk-C5OLWZ42.js +245 -0
  20. package/dist/chunk-CBL5JSCC.cjs +75 -0
  21. package/dist/{chunk-LSKSBVL4.cjs → chunk-CPDK3K5N.cjs} +6 -6
  22. package/dist/chunk-CSNWNFKU.cjs +1635 -0
  23. package/dist/chunk-DJYMDLV5.js +227 -0
  24. package/dist/{chunk-X4HKU3MX.js → chunk-E2VK7J2C.js} +3 -1
  25. package/dist/chunk-FMSW2HDF.cjs +267 -0
  26. package/dist/chunk-FQIHX7YI.cjs +80 -0
  27. package/dist/chunk-FR7KYWRO.cjs +41 -0
  28. package/dist/{chunk-AU3YW7FZ.cjs → chunk-GBQ33SIZ.cjs} +46 -51
  29. package/dist/{chunk-RRQ5HOBF.cjs → chunk-GVTZMA5C.cjs} +4 -4
  30. package/dist/chunk-H7KEVW2M.js +816 -0
  31. package/dist/chunk-HR3BN4C4.cjs +27 -0
  32. package/dist/chunk-IISBRUWJ.js +13 -0
  33. package/dist/chunk-JD2VQIDZ.cjs +15 -0
  34. package/dist/{chunk-PL73GJR4.js → chunk-JZ4TOOLN.js} +1 -1
  35. package/dist/chunk-L24YIZY7.cjs +207 -0
  36. package/dist/chunk-LNUQE6D6.js +39 -0
  37. package/dist/{chunk-BYJ7QTLY.cjs → chunk-NEIUQASE.cjs} +13 -13
  38. package/dist/chunk-P6TA5EZT.cjs +634 -0
  39. package/dist/chunk-PDHLTDZB.js +72 -0
  40. package/dist/chunk-PMCM2OH4.js +46 -0
  41. package/dist/chunk-PZCVF76Q.cjs +868 -0
  42. package/dist/{chunk-GO34UHSY.js → chunk-QAN5MZEM.js} +3 -3
  43. package/dist/{chunk-27HASETB.cjs → chunk-QKZL3ONM.cjs} +3 -1
  44. package/dist/chunk-SAENRNBJ.cjs +52 -0
  45. package/dist/{chunk-LMX35GNQ.js → chunk-SMCANK3F.js} +5 -4
  46. package/dist/{chunk-IZQNUNSU.cjs → chunk-SX2PNKKT.cjs} +18 -17
  47. package/dist/{chunk-LRM6JXJA.cjs → chunk-TBDXTV22.cjs} +0 -37
  48. package/dist/chunk-VOKMAAJP.js +848 -0
  49. package/dist/chunk-XB53G2DK.js +25 -0
  50. package/dist/chunk-Z2Y65YOY.cjs +7 -0
  51. package/dist/codegen/index.cjs +9 -7
  52. package/dist/codegen/index.d.cts +2 -2
  53. package/dist/codegen/index.d.ts +2 -2
  54. package/dist/codegen/index.js +6 -5
  55. package/dist/file-BOoHZgoQ.d.cts +1557 -0
  56. package/dist/file-yuPCFU5b.d.ts +1557 -0
  57. package/dist/history/index.cjs +287 -0
  58. package/dist/history/index.d.cts +157 -0
  59. package/dist/history/index.d.ts +157 -0
  60. package/dist/history/index.js +5 -0
  61. package/dist/index.cjs +134 -36
  62. package/dist/index.d.cts +137 -9
  63. package/dist/index.d.ts +137 -9
  64. package/dist/index.js +8 -3
  65. package/dist/ir/index.cjs +161 -165
  66. package/dist/ir/index.d.cts +32 -12
  67. package/dist/ir/index.d.ts +32 -12
  68. package/dist/ir/index.js +54 -61
  69. package/dist/lower-BuSvAFqi.d.cts +129 -0
  70. package/dist/lower-C_Qv_34S.d.ts +129 -0
  71. package/dist/lower-types-nofRXw9c.d.cts +15 -0
  72. package/dist/lower-types-nofRXw9c.d.ts +15 -0
  73. package/dist/{manifest-Duf-gHdO.d.cts → manifest-0OLw0i7k.d.cts} +1 -1
  74. package/dist/{manifest-Bp9ZJlav.d.ts → manifest-C8N6HDYl.d.ts} +1 -1
  75. package/dist/node-evaluator-CJNP4GHX.js +12 -0
  76. package/dist/node-evaluator-DMKPKUWA.cjs +22 -0
  77. package/dist/quickjs/index.cjs +256 -78
  78. package/dist/quickjs/index.d.cts +48 -7
  79. package/dist/quickjs/index.d.ts +48 -7
  80. package/dist/quickjs/index.js +254 -79
  81. package/dist/roundtrip/index.cjs +404 -129
  82. package/dist/roundtrip/index.d.cts +43 -8
  83. package/dist/roundtrip/index.d.ts +43 -8
  84. package/dist/roundtrip/index.js +260 -19
  85. package/dist/runtime/index.cjs +90 -0
  86. package/dist/runtime/index.d.cts +297 -0
  87. package/dist/runtime/index.d.ts +297 -0
  88. package/dist/runtime/index.js +8 -0
  89. package/dist/testing/index.cjs +1057 -0
  90. package/dist/testing/index.d.cts +305 -0
  91. package/dist/testing/index.d.ts +305 -0
  92. package/dist/testing/index.js +1037 -0
  93. package/dist/{types-Dr2Fn1Ax.d.ts → types-BGoPzgcl.d.cts} +1 -1
  94. package/dist/{types-Dr2Fn1Ax.d.cts → types-BGoPzgcl.d.ts} +1 -1
  95. package/dist/types-CpBBjaGX.d.cts +380 -0
  96. package/dist/types-DV-HX_Gt.d.ts +380 -0
  97. package/dist/{assemble-DMOuaxRI.d.ts → workflow-Bpr3vnA_.d.ts} +60 -162
  98. package/dist/workflow-C2a05WUJ.d.ts +444 -0
  99. package/dist/{assemble-BJo9TECS.d.cts → workflow-FXUkpIBc.d.cts} +60 -162
  100. package/dist/workflow-J-yYixny.d.cts +444 -0
  101. package/fixtures/README.md +128 -0
  102. package/fixtures/histories/activity-failure-fails-run.history.json +163 -0
  103. package/fixtures/histories/activity-retry-then-success.history.json +147 -0
  104. package/fixtures/histories/cancel-activity-abandon.history.json +126 -0
  105. package/fixtures/histories/cancel-activity-compensate.history.json +307 -0
  106. package/fixtures/histories/cancel-concurrent-non-cancellable.history.json +234 -0
  107. package/fixtures/histories/cancel-concurrent-scope-timeout.history.json +184 -0
  108. package/fixtures/histories/cancel-condition-after-cancel.history.json +200 -0
  109. package/fixtures/histories/cancel-during-timer.history.json +123 -0
  110. package/fixtures/histories/cancel-saga-compensations.history.json +325 -0
  111. package/fixtures/histories/cancel-scope-timeout.history.json +148 -0
  112. package/fixtures/histories/child-abandon-outlives-parent.history.json +191 -0
  113. package/fixtures/histories/child-cancel-default.history.json +234 -0
  114. package/fixtures/histories/child-cancel-request.history.json +206 -0
  115. package/fixtures/histories/child-durable-child-side.history.json +124 -0
  116. package/fixtures/histories/child-durable-result.history.json +163 -0
  117. package/fixtures/histories/child-failure-caught.history.json +166 -0
  118. package/fixtures/histories/child-graph-by-key.history.json +138 -0
  119. package/fixtures/histories/child-terminated-by-parent-close.history.json +85 -0
  120. package/fixtures/histories/continue-as-new-first-run.history.json +146 -0
  121. package/fixtures/histories/continue-as-new-history-limit.history.json +489 -0
  122. package/fixtures/histories/continue-as-new-last-run.history.json +147 -0
  123. package/fixtures/histories/continue-as-new-suggested.history.json +352 -0
  124. package/fixtures/histories/details-and-context.history.json +176 -0
  125. package/fixtures/histories/deterministic-values.history.json +128 -0
  126. package/fixtures/histories/engine-builtins.history.json +172 -0
  127. package/fixtures/histories/gather-activities.history.json +291 -0
  128. package/fixtures/histories/gather-all-settled.history.json +219 -0
  129. package/fixtures/histories/gather-mixed.history.json +281 -0
  130. package/fixtures/histories/input-during-running-task.history.json +111 -0
  131. package/fixtures/histories/nondeterminism-reordered.history.json +218 -0
  132. package/fixtures/histories/patched-deprecated.history.json +271 -0
  133. package/fixtures/histories/patched-new-run.history.json +270 -0
  134. package/fixtures/histories/patched-old-history.history.json +190 -0
  135. package/fixtures/histories/race-activity-wins.history.json +152 -0
  136. package/fixtures/histories/race-signal-beats-child.history.json +161 -0
  137. package/fixtures/histories/race-timeout-wins.history.json +118 -0
  138. package/fixtures/histories/side-effect-recorded.history.json +153 -0
  139. package/fixtures/histories/signal-buffered-at-start.history.json +157 -0
  140. package/fixtures/histories/signal-default-handler.history.json +187 -0
  141. package/fixtures/histories/signal-handler.history.json +191 -0
  142. package/fixtures/histories/signal-parent-child-side.history.json +132 -0
  143. package/fixtures/histories/signal-parent.history.json +202 -0
  144. package/fixtures/histories/signal-run-delivered.history.json +128 -0
  145. package/fixtures/histories/signal-run-undelivered.history.json +134 -0
  146. package/fixtures/histories/signal-wait.history.json +111 -0
  147. package/fixtures/histories/task-failure-code-error.history.json +137 -0
  148. package/fixtures/histories/task-failure-then-transient-attempt.history.json +140 -0
  149. package/fixtures/histories/timer-condition-met.history.json +201 -0
  150. package/fixtures/histories/timer-condition-timeout.history.json +118 -0
  151. package/fixtures/histories/timer-sleep-once.history.json +118 -0
  152. package/fixtures/histories/timer-sleep-sequence.history.json +210 -0
  153. package/fixtures/histories/update-accepted-completed.history.json +149 -0
  154. package/fixtures/histories/update-with-start-rejected-validation.history.json +91 -0
  155. package/package.json +85 -20
  156. package/schema/history-file.schema.json +2544 -0
  157. package/schema/ir-v2.schema.json +16 -0
  158. package/schema/run-event.schema.json +2374 -0
  159. package/schema/workflow-command.schema.json +1095 -0
  160. package/schema/workflow-task.schema.json +3560 -0
  161. package/dist/chunk-265J2FCH.cjs +0 -33
  162. package/dist/chunk-LUXCXFOE.cjs +0 -269
  163. package/dist/chunk-S34NJE3A.js +0 -262
  164. package/dist/chunk-SRQRLWOS.js +0 -31
  165. package/dist/lower-DcOY8ux0.d.cts +0 -49
  166. package/dist/lower-Dw5grNrI.d.ts +0 -49
  167. package/dist/node-evaluator-2GTUZVPK.cjs +0 -17
  168. package/dist/node-evaluator-RMYEWCXZ.js +0 -8
@@ -1,16 +1,24 @@
1
1
  'use strict';
2
2
 
3
- var chunkBYJ7QTLY_cjs = require('../chunk-BYJ7QTLY.cjs');
4
- var chunkIZQNUNSU_cjs = require('../chunk-IZQNUNSU.cjs');
5
- var chunkLSKSBVL4_cjs = require('../chunk-LSKSBVL4.cjs');
6
- var chunk265J2FCH_cjs = require('../chunk-265J2FCH.cjs');
7
- var chunkLUXCXFOE_cjs = require('../chunk-LUXCXFOE.cjs');
8
- var chunkKUTMY2IO_cjs = require('../chunk-KUTMY2IO.cjs');
9
- var chunkAU3YW7FZ_cjs = require('../chunk-AU3YW7FZ.cjs');
3
+ var chunkHR3BN4C4_cjs = require('../chunk-HR3BN4C4.cjs');
4
+ var chunkNEIUQASE_cjs = require('../chunk-NEIUQASE.cjs');
5
+ var chunkSX2PNKKT_cjs = require('../chunk-SX2PNKKT.cjs');
6
+ var chunkCPDK3K5N_cjs = require('../chunk-CPDK3K5N.cjs');
7
+ var chunk2DP2Y6EU_cjs = require('../chunk-2DP2Y6EU.cjs');
8
+ require('../chunk-CBL5JSCC.cjs');
9
+ var chunk57MSZ24T_cjs = require('../chunk-57MSZ24T.cjs');
10
+ var chunkGBQ33SIZ_cjs = require('../chunk-GBQ33SIZ.cjs');
10
11
  require('../chunk-G4UEPUGO.cjs');
11
- var chunkRRQ5HOBF_cjs = require('../chunk-RRQ5HOBF.cjs');
12
- var chunk27HASETB_cjs = require('../chunk-27HASETB.cjs');
13
- var chunkLRM6JXJA_cjs = require('../chunk-LRM6JXJA.cjs');
12
+ var chunkGVTZMA5C_cjs = require('../chunk-GVTZMA5C.cjs');
13
+ var chunkQKZL3ONM_cjs = require('../chunk-QKZL3ONM.cjs');
14
+ var chunkTBDXTV22_cjs = require('../chunk-TBDXTV22.cjs');
15
+ var chunkSAENRNBJ_cjs = require('../chunk-SAENRNBJ.cjs');
16
+ require('../chunk-FQIHX7YI.cjs');
17
+ require('../chunk-2J6TF7YI.cjs');
18
+ require('../chunk-Z2Y65YOY.cjs');
19
+ var fs = require('fs');
20
+ var path = require('path');
21
+ var zlib = require('zlib');
14
22
 
15
23
  // src/roundtrip/plan.ts
16
24
  var TYPED_HANDLES = {
@@ -79,14 +87,14 @@ var LiftError = class extends Error {
79
87
  }
80
88
  };
81
89
  var RULE_METHOD_BY_OPERATOR = new Map(
82
- Object.entries(chunkRRQ5HOBF_cjs.PREDICATE_OPERATORS).map(([method, spec]) => [
90
+ Object.entries(chunkGVTZMA5C_cjs.PREDICATE_OPERATORS).map(([method, spec]) => [
83
91
  spec.operator,
84
92
  { method, unary: spec.unary }
85
93
  ])
86
94
  );
87
95
  function literalOrStructure(value2) {
88
96
  if (Array.isArray(value2)) return { k: "array", items: value2.map(literalOrStructure) };
89
- if (chunkLRM6JXJA_cjs.isRecord(value2))
97
+ if (chunkSAENRNBJ_cjs.isRecord(value2))
90
98
  return {
91
99
  k: "object",
92
100
  entries: Object.entries(value2).map(([key, child]) => [key, literalOrStructure(child)])
@@ -98,7 +106,7 @@ function literalOrStructure(value2) {
98
106
  }
99
107
  function expressible(ref) {
100
108
  return ref.path.every(
101
- (segment) => segment.kind === "index" || !chunkRRQ5HOBF_cjs.RESERVED_REF_KEYS.has(segment.key)
109
+ (segment) => segment.kind === "index" || !chunkGVTZMA5C_cjs.RESERVED_REF_KEYS.has(segment.key)
102
110
  );
103
111
  }
104
112
  function toPlanRef(ref) {
@@ -107,7 +115,7 @@ function toPlanRef(ref) {
107
115
  }
108
116
  function liftValue(value2, path, nodeId, items) {
109
117
  if (typeof value2 === "string") {
110
- const parts = chunkLRM6JXJA_cjs.parseTemplate(value2);
118
+ const parts = chunkTBDXTV22_cjs.parseTemplate(value2);
111
119
  if (parts && parts.every((part) => part.kind === "text" || expressible(part.ref))) {
112
120
  const [only] = parts;
113
121
  if (parts.length === 1 && only?.kind === "ref") return { k: "ref", ref: toPlanRef(only.ref) };
@@ -136,7 +144,7 @@ function liftValue(value2, path, nodeId, items) {
136
144
  k: "array",
137
145
  items: value2.map((item, index) => liftValue(item, `${path}[${index}]`, nodeId, items))
138
146
  };
139
- if (chunkLRM6JXJA_cjs.isRecord(value2)) {
147
+ if (chunkSAENRNBJ_cjs.isRecord(value2)) {
140
148
  return {
141
149
  k: "object",
142
150
  entries: Object.entries(value2).map(([key, child]) => [
@@ -185,7 +193,7 @@ function liftRule(rule, nodeIds) {
185
193
  if (typeof rule["field"] !== "string" || typeof rule["operator"] !== "string" || rule["operator"] === "")
186
194
  return void 0;
187
195
  const ref = fieldRef(rule["field"], nodeIds);
188
- if (!ref || !ref.path.every((segment) => segment.kind === "index" || !chunkRRQ5HOBF_cjs.RESERVED_REF_KEYS.has(segment.key))) {
196
+ if (!ref || !ref.path.every((segment) => segment.kind === "index" || !chunkGVTZMA5C_cjs.RESERVED_REF_KEYS.has(segment.key))) {
189
197
  return void 0;
190
198
  }
191
199
  const hasValue = Object.hasOwn(rule, "value");
@@ -204,7 +212,7 @@ function liftRule(rule, nodeIds) {
204
212
  };
205
213
  }
206
214
  function liftCondition(tree, nodeIds, top) {
207
- if (!chunkLRM6JXJA_cjs.isRecord(tree)) return void 0;
215
+ if (!chunkSAENRNBJ_cjs.isRecord(tree)) return void 0;
208
216
  if (tree["type"] === "rule") return top ? void 0 : liftRule(tree, nodeIds);
209
217
  if (tree["type"] !== "group") return void 0;
210
218
  const keys = Object.keys(tree).sort();
@@ -245,7 +253,7 @@ function richEdge(edge2, info, items) {
245
253
  const options2 = [];
246
254
  const extra = [];
247
255
  if (edge2["id"] === void 0) options2.push(["id", { k: "literal", value: false }]);
248
- else if (edge2["id"] !== chunkKUTMY2IO_cjs.defaultEdgeId(source, target, sourceHandle, targetHandle))
256
+ else if (edge2["id"] !== chunk57MSZ24T_cjs.defaultEdgeId(source, target, sourceHandle, targetHandle))
249
257
  options2.push(["id", literalOrStructure(edge2["id"])]);
250
258
  if (edge2["type"] === void 0) options2.push(["type", { k: "literal", value: false }]);
251
259
  else if (edge2["type"] !== "deletable") options2.push(["type", literalOrStructure(edge2["type"])]);
@@ -259,7 +267,7 @@ function richEdge(edge2, info, items) {
259
267
  }
260
268
  if (key === "label" && typeof value2 === "string")
261
269
  options2.push(["label", { k: "literal", value: value2 }]);
262
- else if ((key === "data" || key === "mapping") && chunkLRM6JXJA_cjs.isRecord(value2)) {
270
+ else if ((key === "data" || key === "mapping") && chunkSAENRNBJ_cjs.isRecord(value2)) {
263
271
  options2.push([key, literalOrStructure(value2)]);
264
272
  if (key === "mapping") {
265
273
  items.push({
@@ -312,10 +320,10 @@ function chooseOperation(node, hasIncoming, clients, manifests, items) {
312
320
  const manifest = manifests?.find(
313
321
  (candidate) => candidate.nodeType === type && candidate.nodeVersion === client?.version
314
322
  );
315
- const operation = operationName && manifest ? chunkLSKSBVL4_cjs.operationsOf(manifest).find((candidate) => candidate.name === operationName) : void 0;
323
+ const operation = operationName && manifest ? chunkCPDK3K5N_cjs.operationsOf(manifest).find((candidate) => candidate.name === operationName) : void 0;
316
324
  const operationKey = operationName ? client?.operations.get(operationName) : void 0;
317
325
  if (client && operation && operationKey) {
318
- const isTrigger = chunkLSKSBVL4_cjs.isTriggerOperation(operation);
326
+ const isTrigger = chunkCPDK3K5N_cjs.isTriggerOperation(operation);
319
327
  return {
320
328
  method: isTrigger && !hasIncoming ? "trigger" : "step",
321
329
  operation: {
@@ -352,7 +360,7 @@ function chooseOperation(node, hasIncoming, clients, manifests, items) {
352
360
  }
353
361
  var ERROR_CONFIG_KEYS = /* @__PURE__ */ new Set(["onError", "errorBranchId", "retryConfig", "timeout"]);
354
362
  function errorConfigOptions(errorConfig) {
355
- if (!chunkLRM6JXJA_cjs.isRecord(errorConfig) || Object.keys(errorConfig).length === 0) return void 0;
363
+ if (!chunkSAENRNBJ_cjs.isRecord(errorConfig) || Object.keys(errorConfig).length === 0) return void 0;
356
364
  if (!Object.keys(errorConfig).every((key) => ERROR_CONFIG_KEYS.has(key))) return void 0;
357
365
  const options2 = [];
358
366
  const onError = errorConfig["onError"];
@@ -370,23 +378,46 @@ function errorConfigOptions(errorConfig) {
370
378
  else if (onError !== void 0) return void 0;
371
379
  }
372
380
  if (errorConfig["retryConfig"] !== void 0) {
373
- if (!chunkLRM6JXJA_cjs.isRecord(errorConfig["retryConfig"])) return void 0;
381
+ if (!chunkSAENRNBJ_cjs.isRecord(errorConfig["retryConfig"])) return void 0;
374
382
  options2.push(["retry", literalOrStructure(errorConfig["retryConfig"])]);
375
383
  }
376
384
  if (errorConfig["timeout"] !== void 0) {
377
- if (!chunkLRM6JXJA_cjs.isRecord(errorConfig["timeout"])) return void 0;
385
+ if (!chunkSAENRNBJ_cjs.isRecord(errorConfig["timeout"])) return void 0;
378
386
  options2.push(["timeout", literalOrStructure(errorConfig["timeout"])]);
379
387
  }
380
388
  return options2;
381
389
  }
390
+ function ambiguousConnectionNames(names) {
391
+ const idByName = /* @__PURE__ */ new Map();
392
+ const ambiguous = /* @__PURE__ */ new Set();
393
+ for (const [id, name] of Object.entries(names)) {
394
+ const previous = idByName.get(name);
395
+ if (previous === void 0) idByName.set(name, id);
396
+ else if (previous !== id) ambiguous.add(name);
397
+ }
398
+ return ambiguous;
399
+ }
382
400
  function connectionOptions(value2, names, nodeId, items) {
383
401
  if (Array.isArray(value2) && value2.length > 0 && names) {
402
+ const ambiguous = ambiguousConnectionNames(names);
384
403
  const resolved = value2.map((ref) => {
385
- if (!chunkLRM6JXJA_cjs.isRecord(ref) || Object.keys(ref).sort().join(",") !== "adapter,connectionId")
404
+ if (!chunkSAENRNBJ_cjs.isRecord(ref) || Object.keys(ref).sort().join(",") !== "adapter,connectionId")
386
405
  return void 0;
387
406
  const id = ref["connectionId"];
388
407
  return typeof id === "string" && Object.hasOwn(names, id) ? names[id] : void 0;
389
408
  });
409
+ const shared = resolved.filter(
410
+ (name) => typeof name === "string" && ambiguous.has(name)
411
+ );
412
+ if (shared.length > 0) {
413
+ items.push({
414
+ nodeId,
415
+ path: "args.connections",
416
+ kind: "connection-ambiguous",
417
+ detail: `The connection name ${[...new Set(shared)].map((name) => `"${name}"`).join(", ")} belongs to more than one connection; the connection id is kept`
418
+ });
419
+ return ["connections", literalOrStructure(value2)];
420
+ }
390
421
  if (resolved.every((name) => typeof name === "string")) {
391
422
  return resolved.length === 1 ? ["connection", { k: "literal", value: resolved[0] ?? "" }] : [
392
423
  "connection",
@@ -434,12 +465,12 @@ function richNode(node, choice, incoming, nodeIds, options2, items) {
434
465
  extra.push(["version", literalOrStructure(version)]);
435
466
  }
436
467
  }
437
- const args = chunkLRM6JXJA_cjs.isRecord(node["args"]) ? node["args"] : void 0;
468
+ const args = chunkSAENRNBJ_cjs.isRecord(node["args"]) ? node["args"] : void 0;
438
469
  if (node["args"] !== void 0 && !args) extra.push(["args", literalOrStructure(node["args"])]);
439
470
  if (args) {
440
471
  const argsExtra = [];
441
472
  let state = args["state"];
442
- if (choice.method === "if" && chunkLRM6JXJA_cjs.isRecord(state) && state["conditionTree"] !== void 0) {
473
+ if (choice.method === "if" && chunkSAENRNBJ_cjs.isRecord(state) && state["conditionTree"] !== void 0) {
443
474
  const condition = liftCondition(state["conditionTree"], nodeIds, true);
444
475
  if (condition) {
445
476
  out.push(["condition", condition]);
@@ -449,7 +480,7 @@ function richNode(node, choice, incoming, nodeIds, options2, items) {
449
480
  }
450
481
  }
451
482
  if (state !== void 0) {
452
- if (chunkLRM6JXJA_cjs.isRecord(state)) out.push(["args", liftState(String(node["type"]), state, id, items)]);
483
+ if (chunkSAENRNBJ_cjs.isRecord(state)) out.push(["args", liftState(String(node["type"]), state, id, items)]);
453
484
  else argsExtra.push(["state", literalOrStructure(state)]);
454
485
  }
455
486
  for (const [key, value2] of Object.entries(args)) {
@@ -464,7 +495,7 @@ function richNode(node, choice, incoming, nodeIds, options2, items) {
464
495
  kind: "legacy-syntax",
465
496
  detail: "Legacy credential references kept verbatim"
466
497
  });
467
- } else if (key === "context" && chunkLRM6JXJA_cjs.isRecord(value2))
498
+ } else if (key === "context" && chunkSAENRNBJ_cjs.isRecord(value2))
468
499
  out.push(["context", literalOrStructure(value2)]);
469
500
  else argsExtra.push([key, literalOrStructure(value2)]);
470
501
  }
@@ -477,12 +508,12 @@ function richNode(node, choice, incoming, nodeIds, options2, items) {
477
508
  if (sugar) out.push(...sugar);
478
509
  else out.push(["errorConfig", literalOrStructure(node["errorConfig"])]);
479
510
  }
480
- const data = chunkLRM6JXJA_cjs.isRecord(node["data"]) ? { ...node["data"] } : void 0;
511
+ const data = chunkSAENRNBJ_cjs.isRecord(node["data"]) ? { ...node["data"] } : void 0;
481
512
  if (node["executionSettings"] !== void 0) {
482
513
  const settings = node["executionSettings"];
483
- if (chunkLRM6JXJA_cjs.isRecord(settings)) {
484
- const mirror = chunkLRM6JXJA_cjs.isRecord(data?.["executionSettings"]) ? data["executionSettings"] : void 0;
485
- const mirrored = settings["runOn"] !== void 0 && mirror !== void 0 && Object.keys(mirror).length === 1 && chunkLRM6JXJA_cjs.deepEqual(mirror["runOn"], settings["runOn"]);
514
+ if (chunkSAENRNBJ_cjs.isRecord(settings)) {
515
+ const mirror = chunkSAENRNBJ_cjs.isRecord(data?.["executionSettings"]) ? data["executionSettings"] : void 0;
516
+ const mirrored = settings["runOn"] !== void 0 && mirror !== void 0 && Object.keys(mirror).length === 1 && chunkSAENRNBJ_cjs.deepEqual(mirror["runOn"], settings["runOn"]);
486
517
  if (settings["runOn"] === void 0 || mirrored) {
487
518
  out.push(["executionSettings", literalOrStructure(settings)]);
488
519
  if (mirrored && data) delete data["executionSettings"];
@@ -503,9 +534,9 @@ function richNode(node, choice, incoming, nodeIds, options2, items) {
503
534
  else extra.push(["disabled", literalOrStructure(node["disabled"])]);
504
535
  }
505
536
  if (data && Object.keys(data).length > 0) extra.push(["data", literalOrStructure(data)]);
506
- else if (node["data"] !== void 0 && !chunkLRM6JXJA_cjs.isRecord(node["data"]))
537
+ else if (node["data"] !== void 0 && !chunkSAENRNBJ_cjs.isRecord(node["data"]))
507
538
  extra.push(["data", literalOrStructure(node["data"])]);
508
- else if (chunkLRM6JXJA_cjs.isRecord(node["data"]) && Object.keys(node["data"]).length === 0)
539
+ else if (chunkSAENRNBJ_cjs.isRecord(node["data"]) && Object.keys(node["data"]).length === 0)
509
540
  extra.push(["data", { k: "object", entries: [] }]);
510
541
  for (const [key, value2] of Object.entries(node)) {
511
542
  if ([
@@ -570,17 +601,17 @@ function workflowOptions(definition, key) {
570
601
  for (const option of WORKFLOW_OPTION_KEYS) {
571
602
  const value2 = definition[option];
572
603
  if (value2 === void 0) continue;
573
- if (option === "meta" && chunkLRM6JXJA_cjs.isRecord(value2)) {
604
+ if (option === "meta" && chunkSAENRNBJ_cjs.isRecord(value2)) {
574
605
  const meta = { ...value2 };
575
606
  delete meta["layout"];
576
607
  if (Object.keys(meta).length > 0) out.push(["meta", literalOrStructure(meta)]);
577
608
  continue;
578
609
  }
579
- const typed = (option === "name" || option === "description") && typeof value2 === "string" || option === "tags" && Array.isArray(value2) || ["config", "interface", "code"].includes(option) && chunkLRM6JXJA_cjs.isRecord(value2);
610
+ const typed = (option === "name" || option === "description") && typeof value2 === "string" || option === "tags" && Array.isArray(value2) || ["config", "interface", "code"].includes(option) && chunkSAENRNBJ_cjs.isRecord(value2);
580
611
  if (typed) out.push([option, literalOrStructure(value2)]);
581
612
  else extra.push([option, literalOrStructure(value2)]);
582
613
  }
583
- const data = chunkLRM6JXJA_cjs.isRecord(definition["data"]) ? definition["data"] : {};
614
+ const data = chunkSAENRNBJ_cjs.isRecord(definition["data"]) ? definition["data"] : {};
584
615
  const dataExtra = Object.entries(data).filter(
585
616
  ([dataKey]) => !["nodes", "edges", "stickyNotes"].includes(dataKey)
586
617
  );
@@ -601,14 +632,14 @@ function workflowOptions(definition, key) {
601
632
  }
602
633
  function buildPlan(normalized, options2, rawNodeIds = /* @__PURE__ */ new Set(), rawEdgeIndices = /* @__PURE__ */ new Set()) {
603
634
  const items = [];
604
- const data = chunkLRM6JXJA_cjs.isRecord(normalized["data"]) ? normalized["data"] : {};
635
+ const data = chunkSAENRNBJ_cjs.isRecord(normalized["data"]) ? normalized["data"] : {};
605
636
  const nodes2 = Array.isArray(data["nodes"]) ? data["nodes"] : [];
606
637
  const edges = Array.isArray(data["edges"]) ? data["edges"] : [];
607
638
  const key = typeof normalized["key"] === "string" && normalized["key"] ? normalized["key"] : options2.workflowKey;
608
639
  if (!key) throw new LiftError("The definition has no key; pass workflowKey");
609
640
  const nodeIds = /* @__PURE__ */ new Set();
610
641
  for (const node of nodes2) {
611
- if (!chunkLRM6JXJA_cjs.isRecord(node) || typeof node["id"] !== "string" || node["id"] === "" || typeof node["type"] !== "string") {
642
+ if (!chunkSAENRNBJ_cjs.isRecord(node) || typeof node["id"] !== "string" || node["id"] === "" || typeof node["type"] !== "string") {
612
643
  throw new LiftError("Every node needs a string id and type to be lifted");
613
644
  }
614
645
  if (nodeIds.has(node["id"])) throw new LiftError(`Node id "${node["id"]}" is used twice`);
@@ -616,7 +647,7 @@ function buildPlan(normalized, options2, rawNodeIds = /* @__PURE__ */ new Set(),
616
647
  }
617
648
  const edgeIds = /* @__PURE__ */ new Set();
618
649
  for (const edge2 of edges) {
619
- if (!chunkLRM6JXJA_cjs.isRecord(edge2) || typeof edge2["source"] !== "string" || typeof edge2["target"] !== "string") {
650
+ if (!chunkSAENRNBJ_cjs.isRecord(edge2) || typeof edge2["source"] !== "string" || typeof edge2["target"] !== "string") {
620
651
  throw new LiftError("Every edge needs a string source and target to be lifted");
621
652
  }
622
653
  if (edge2["id"] === void 0) continue;
@@ -624,9 +655,9 @@ function buildPlan(normalized, options2, rawNodeIds = /* @__PURE__ */ new Set(),
624
655
  if (edgeIds.has(edge2["id"])) throw new LiftError(`Edge id "${edge2["id"]}" is used twice`);
625
656
  edgeIds.add(edge2["id"]);
626
657
  }
627
- const nodeRecords = nodes2.filter(chunkLRM6JXJA_cjs.isRecord);
628
- const edgeRecords = edges.filter(chunkLRM6JXJA_cjs.isRecord);
629
- const clients = options2.registry ? chunkIZQNUNSU_cjs.clientNames(options2.registry) : /* @__PURE__ */ new Map();
658
+ const nodeRecords = nodes2.filter(chunkSAENRNBJ_cjs.isRecord);
659
+ const edgeRecords = edges.filter(chunkSAENRNBJ_cjs.isRecord);
660
+ const clients = options2.registry ? chunkSX2PNKKT_cjs.clientNames(options2.registry) : /* @__PURE__ */ new Map();
630
661
  const edgeIndex = /* @__PURE__ */ new Map();
631
662
  edgeRecords.forEach((edge2, index) => edgeIndex.set(edge2, index));
632
663
  const incomingByTarget = /* @__PURE__ */ new Map();
@@ -699,15 +730,21 @@ function buildPlan(normalized, options2, rawNodeIds = /* @__PURE__ */ new Set(),
699
730
  }
700
731
  function connectionsByName(connectionNames, definition) {
701
732
  const out = {};
702
- const data = chunkLRM6JXJA_cjs.isRecord(definition["data"]) ? definition["data"] : {};
733
+ const ambiguous = ambiguousConnectionNames(connectionNames);
734
+ const data = chunkSAENRNBJ_cjs.isRecord(definition["data"]) ? definition["data"] : {};
703
735
  for (const node of Array.isArray(data["nodes"]) ? data["nodes"] : []) {
704
- const args = chunkLRM6JXJA_cjs.isRecord(node) && chunkLRM6JXJA_cjs.isRecord(node["args"]) ? node["args"] : void 0;
736
+ const args = chunkSAENRNBJ_cjs.isRecord(node) && chunkSAENRNBJ_cjs.isRecord(node["args"]) ? node["args"] : void 0;
705
737
  for (const ref of Array.isArray(args?.["connections"]) ? args["connections"] : []) {
706
- if (!chunkLRM6JXJA_cjs.isRecord(ref) || typeof ref["connectionId"] !== "string" || typeof ref["adapter"] !== "string")
738
+ if (!chunkSAENRNBJ_cjs.isRecord(ref) || typeof ref["connectionId"] !== "string" || typeof ref["adapter"] !== "string")
707
739
  continue;
708
- const name = connectionNames[ref["connectionId"]];
709
- if (name !== void 0)
710
- out[name] = { connectionId: ref["connectionId"], adapter: ref["adapter"] };
740
+ const id = ref["connectionId"];
741
+ const name = Object.hasOwn(connectionNames, id) ? connectionNames[id] : void 0;
742
+ if (name === void 0 || ambiguous.has(name)) continue;
743
+ const previous = Object.hasOwn(out, name) ? out[name] : void 0;
744
+ if (previous && previous.adapter !== ref["adapter"]) {
745
+ ambiguous.add(name);
746
+ delete out[name];
747
+ } else chunkSAENRNBJ_cjs.setOwn(out, name, { connectionId: id, adapter: ref["adapter"] });
711
748
  }
712
749
  }
713
750
  return out;
@@ -717,19 +754,19 @@ function connectionsByName(connectionNames, definition) {
717
754
  function descriptor(operation) {
718
755
  switch (operation.kind) {
719
756
  case "trigger": {
720
- const value2 = chunkKUTMY2IO_cjs.triggers[operation.name];
757
+ const value2 = chunk57MSZ24T_cjs.triggers[operation.name];
721
758
  if (!value2) throw new LiftError(`Unknown trigger ${operation.name}`);
722
759
  return value2;
723
760
  }
724
761
  case "internal": {
725
- const value2 = chunkKUTMY2IO_cjs.internalNodes[operation.name];
762
+ const value2 = chunk57MSZ24T_cjs.internalNodes[operation.name];
726
763
  if (!value2) throw new LiftError(`Unknown internal node ${operation.name}`);
727
764
  return value2;
728
765
  }
729
766
  case "client":
730
- return operation.role === "trigger" ? chunkKUTMY2IO_cjs.trigger(operation.nodeType, operation.version, operation.operation) : chunkKUTMY2IO_cjs.op(operation.nodeType, operation.version, operation.operation);
767
+ return operation.role === "trigger" ? chunk57MSZ24T_cjs.trigger(operation.nodeType, operation.version, operation.operation) : chunk57MSZ24T_cjs.op(operation.nodeType, operation.version, operation.operation);
731
768
  case "custom":
732
- return chunkKUTMY2IO_cjs.nodes.custom(operation.nodeType, operation.operation, operation.version);
769
+ return chunk57MSZ24T_cjs.nodes.custom(operation.nodeType, operation.operation, operation.version);
733
770
  }
734
771
  }
735
772
  function refValue(ref, wf, runtime) {
@@ -764,7 +801,7 @@ function value(expression2, wf, runtime) {
764
801
  strings.push("");
765
802
  }
766
803
  }
767
- return chunkRRQ5HOBF_cjs.expr(Object.assign([...strings], { raw: [...strings] }), ...values);
804
+ return chunkGVTZMA5C_cjs.expr(Object.assign([...strings], { raw: [...strings] }), ...values);
768
805
  }
769
806
  case "rule": {
770
807
  const target = refValue(expression2.ref, wf, runtime);
@@ -776,7 +813,7 @@ function value(expression2, wf, runtime) {
776
813
  }
777
814
  case "group": {
778
815
  const children = expression2.children.map((child) => value(child, wf, runtime));
779
- return expression2.combinator === "and" ? chunkRRQ5HOBF_cjs.and(...children) : chunkRRQ5HOBF_cjs.or(...children);
816
+ return expression2.combinator === "and" ? chunkGVTZMA5C_cjs.and(...children) : chunkGVTZMA5C_cjs.or(...children);
780
817
  }
781
818
  case "node":
782
819
  return runtime.get(expression2.nodeId) ?? wf.ref(expression2.nodeId);
@@ -787,7 +824,7 @@ function value(expression2, wf, runtime) {
787
824
  return (declared ?? wf.ref(expression2.nodeId)).handle(expression2.handle);
788
825
  }
789
826
  case "edge":
790
- return chunkKUTMY2IO_cjs.edge(
827
+ return chunk57MSZ24T_cjs.edge(
791
828
  value(expression2.from, wf, runtime),
792
829
  value({ k: "object", entries: expression2.options }, wf, runtime)
793
830
  );
@@ -815,7 +852,7 @@ function interpretPlan(plan) {
815
852
  k: "object",
816
853
  entries: plan.workflowOptions
817
854
  });
818
- const workflow = chunkKUTMY2IO_cjs.defineWorkflow(workflowOptions2, (wf) => {
855
+ const workflow = chunk57MSZ24T_cjs.defineWorkflow(workflowOptions2, (wf) => {
819
856
  const runtime = /* @__PURE__ */ new Map();
820
857
  for (const statement of plan.statements) {
821
858
  if (statement.kind === "node") {
@@ -884,7 +921,7 @@ var BUILDER_METHODS = {
884
921
  };
885
922
  var atom = (text) => ({ t: "atom", text });
886
923
  function isPyIdentifier(name) {
887
- return /^[A-Za-z][A-Za-z0-9_]*$/.test(name) && !chunkIZQNUNSU_cjs.PY_KEYWORDS.has(name);
924
+ return /^[A-Za-z][A-Za-z0-9_]*$/.test(name) && !chunkSX2PNKKT_cjs.PY_KEYWORDS.has(name);
888
925
  }
889
926
  function nodeSource(nodeId, ctx) {
890
927
  const name = ctx.vars.get(nodeId);
@@ -892,7 +929,7 @@ function nodeSource(nodeId, ctx) {
892
929
  return {
893
930
  t: "call",
894
931
  func: atom("wf.ref"),
895
- args: [{ kind: "positional", value: atom(chunkIZQNUNSU_cjs.pyString(nodeId)) }]
932
+ args: [{ kind: "positional", value: atom(chunkSX2PNKKT_cjs.pyString(nodeId)) }]
896
933
  };
897
934
  }
898
935
  function refExpr(ref, ctx) {
@@ -902,21 +939,21 @@ function refExpr(ref, ctx) {
902
939
  current = { t: "subscript", base: current, indices: [atom(String(segment.index))] };
903
940
  else if (isPyIdentifier(segment.key) && !PY_REF_METHODS.has(segment.key))
904
941
  current = { t: "attr", base: current, name: segment.key };
905
- else current = { t: "subscript", base: current, indices: [atom(chunkIZQNUNSU_cjs.pyString(segment.key))] };
942
+ else current = { t: "subscript", base: current, indices: [atom(chunkSX2PNKKT_cjs.pyString(segment.key))] };
906
943
  }
907
944
  return current;
908
945
  }
909
946
  function literal(value2) {
910
947
  if (value2 === null) return atom("None");
911
948
  if (typeof value2 === "boolean") return atom(value2 ? "True" : "False");
912
- if (typeof value2 === "number") return atom(chunkIZQNUNSU_cjs.pyNumber(value2));
913
- return atom(chunkIZQNUNSU_cjs.pyString(value2));
949
+ if (typeof value2 === "number") return atom(chunkSX2PNKKT_cjs.pyNumber(value2));
950
+ return atom(chunkSX2PNKKT_cjs.pyString(value2));
914
951
  }
915
952
  function call(func, args) {
916
953
  return { t: "call", func: atom(func), args };
917
954
  }
918
955
  function keywordName(option) {
919
- return chunkIZQNUNSU_cjs.snakeCase(option);
956
+ return chunkSX2PNKKT_cjs.snakeCase(option);
920
957
  }
921
958
  function expression(planExpr, ctx) {
922
959
  switch (planExpr.k) {
@@ -926,7 +963,7 @@ function expression(planExpr, ctx) {
926
963
  return {
927
964
  t: "dict",
928
965
  entries: planExpr.entries.map(([key, child]) => [
929
- atom(chunkIZQNUNSU_cjs.pyString(key)),
966
+ atom(chunkSX2PNKKT_cjs.pyString(key)),
930
967
  expression(child, ctx)
931
968
  ])
932
969
  };
@@ -940,7 +977,7 @@ function expression(planExpr, ctx) {
940
977
  "expr",
941
978
  planExpr.parts.map((part) => ({
942
979
  kind: "positional",
943
- value: "text" in part ? atom(chunkIZQNUNSU_cjs.pyString(part.text)) : refExpr(part.ref, ctx)
980
+ value: "text" in part ? atom(chunkSX2PNKKT_cjs.pyString(part.text)) : refExpr(part.ref, ctx)
944
981
  }))
945
982
  );
946
983
  case "rule": {
@@ -954,10 +991,10 @@ function expression(planExpr, ctx) {
954
991
  right: literal(planExpr.value ?? null)
955
992
  };
956
993
  }
957
- const method = planExpr.method === "is" ? "is_" : chunkIZQNUNSU_cjs.snakeCase(planExpr.method);
994
+ const method = planExpr.method === "is" ? "is_" : chunkSX2PNKKT_cjs.snakeCase(planExpr.method);
958
995
  const args = [];
959
996
  if (planExpr.method === "is")
960
- args.push({ kind: "positional", value: atom(chunkIZQNUNSU_cjs.pyString(planExpr.operator)) });
997
+ args.push({ kind: "positional", value: atom(chunkSX2PNKKT_cjs.pyString(planExpr.operator)) });
961
998
  if (planExpr.hasValue)
962
999
  args.push({ kind: "positional", value: literal(planExpr.value ?? null) });
963
1000
  return { t: "call", func: { t: "attr", base: target, name: method }, args };
@@ -976,12 +1013,12 @@ function expression(planExpr, ctx) {
976
1013
  const source = nodeSource(planExpr.nodeId, ctx);
977
1014
  const declared = ctx.declared.has(planExpr.nodeId) && ctx.vars.has(planExpr.nodeId);
978
1015
  if (declared && planExpr.accessor.kind === "property")
979
- return { t: "attr", base: source, name: chunkIZQNUNSU_cjs.snakeCase(planExpr.accessor.name) };
1016
+ return { t: "attr", base: source, name: chunkSX2PNKKT_cjs.snakeCase(planExpr.accessor.name) };
980
1017
  const method = declared && planExpr.accessor.kind === "case" ? "case" : "handle";
981
1018
  return {
982
1019
  t: "call",
983
1020
  func: { t: "attr", base: source, name: method },
984
- args: [{ kind: "positional", value: atom(chunkIZQNUNSU_cjs.pyString(planExpr.handle)) }]
1021
+ args: [{ kind: "positional", value: atom(chunkSX2PNKKT_cjs.pyString(planExpr.handle)) }]
985
1022
  };
986
1023
  }
987
1024
  case "edge":
@@ -1003,21 +1040,21 @@ function operationExpr(operation, ctx, clientPy) {
1003
1040
  switch (operation.kind) {
1004
1041
  case "trigger":
1005
1042
  ctx.used.add("triggers");
1006
- return atom(`triggers.${chunkIZQNUNSU_cjs.snakeCase(operation.name)}`);
1043
+ return atom(`triggers.${chunkSX2PNKKT_cjs.snakeCase(operation.name)}`);
1007
1044
  case "internal":
1008
1045
  ctx.used.add("nodes");
1009
- return atom(`nodes.internal.${chunkIZQNUNSU_cjs.snakeCase(operation.name)}`);
1046
+ return atom(`nodes.internal.${chunkSX2PNKKT_cjs.snakeCase(operation.name)}`);
1010
1047
  case "client":
1011
1048
  ctx.used.add("n");
1012
1049
  return atom(clientPy(operation.nodeType, operation.operation));
1013
1050
  case "custom": {
1014
1051
  ctx.used.add("nodes");
1015
- const args = [{ kind: "positional", value: atom(chunkIZQNUNSU_cjs.pyString(operation.nodeType)) }];
1052
+ const args = [{ kind: "positional", value: atom(chunkSX2PNKKT_cjs.pyString(operation.nodeType)) }];
1016
1053
  if (operation.operation !== void 0)
1017
- args.push({ kind: "positional", value: atom(chunkIZQNUNSU_cjs.pyString(operation.operation)) });
1054
+ args.push({ kind: "positional", value: atom(chunkSX2PNKKT_cjs.pyString(operation.operation)) });
1018
1055
  if (operation.version !== void 0) {
1019
1056
  args.push(
1020
- operation.operation !== void 0 ? { kind: "positional", value: atom(chunkIZQNUNSU_cjs.pyString(operation.version)) } : { kind: "keyword", name: "version", value: atom(chunkIZQNUNSU_cjs.pyString(operation.version)) }
1057
+ operation.operation !== void 0 ? { kind: "positional", value: atom(chunkSX2PNKKT_cjs.pyString(operation.version)) } : { kind: "keyword", name: "version", value: atom(chunkSX2PNKKT_cjs.pyString(operation.version)) }
1021
1058
  );
1022
1059
  }
1023
1060
  return call("nodes.custom", args);
@@ -1026,7 +1063,7 @@ function operationExpr(operation, ctx, clientPy) {
1026
1063
  }
1027
1064
  function statementLines(statement, ctx, clientPy) {
1028
1065
  if (statement.kind === "edgeOrder") {
1029
- return chunkIZQNUNSU_cjs.formatLines(
1066
+ return chunkSX2PNKKT_cjs.formatLines(
1030
1067
  "",
1031
1068
  call("wf.edge_order_is", [
1032
1069
  { kind: "positional", value: { t: "list", items: statement.ids.map((id) => literal(id)) } }
@@ -1038,28 +1075,28 @@ function statementLines(statement, ctx, clientPy) {
1038
1075
  if (statement.kind === "connect") {
1039
1076
  const args2 = [
1040
1077
  { kind: "positional", value: expression(statement.from, ctx) },
1041
- { kind: "positional", value: atom(chunkIZQNUNSU_cjs.pyString(statement.to)) },
1078
+ { kind: "positional", value: atom(chunkSX2PNKKT_cjs.pyString(statement.to)) },
1042
1079
  ...keywords(statement.options, ctx)
1043
1080
  ];
1044
- return chunkIZQNUNSU_cjs.formatLines("", call("wf.connect", args2), "", 1);
1081
+ return chunkSX2PNKKT_cjs.formatLines("", call("wf.connect", args2), "", 1);
1045
1082
  }
1046
1083
  const args = [
1047
1084
  ...statement.operation ? [{ kind: "positional", value: operationExpr(statement.operation, ctx, clientPy) }] : [],
1048
1085
  ...keywords(statement.options, ctx)
1049
1086
  ];
1050
- const method = BUILDER_METHODS[statement.method] ?? chunkIZQNUNSU_cjs.snakeCase(statement.method);
1087
+ const method = BUILDER_METHODS[statement.method] ?? chunkSX2PNKKT_cjs.snakeCase(statement.method);
1051
1088
  const callExpr = call(`wf.${method}`, args);
1052
1089
  ctx.declared.add(statement.nodeId);
1053
1090
  const name = ctx.vars.get(statement.nodeId);
1054
- return chunkIZQNUNSU_cjs.formatLines(name !== void 0 ? `${name} = ` : "", callExpr, "", 1);
1091
+ return chunkSX2PNKKT_cjs.formatLines(name !== void 0 ? `${name} = ` : "", callExpr, "", 1);
1055
1092
  }
1056
1093
  function renderPython(plan, clientPy, header = []) {
1057
- const allocator = new chunkIZQNUNSU_cjs.NameAllocator("py");
1094
+ const allocator = new chunkSX2PNKKT_cjs.NameAllocator("py");
1058
1095
  const vars = /* @__PURE__ */ new Map();
1059
- for (const nodeId of chunkIZQNUNSU_cjs.referencedLater(plan)) vars.set(nodeId, allocator.forNode(nodeId));
1096
+ for (const nodeId of chunkSX2PNKKT_cjs.referencedLater(plan)) vars.set(nodeId, allocator.forNode(nodeId));
1060
1097
  const ctx = { vars, declared: /* @__PURE__ */ new Set(), used: /* @__PURE__ */ new Set() };
1061
1098
  const body = plan.statements.flatMap((statement) => statementLines(statement, ctx, clientPy));
1062
- const decorator = chunkIZQNUNSU_cjs.formatLines(
1099
+ const decorator = chunkSX2PNKKT_cjs.formatLines(
1063
1100
  "@",
1064
1101
  call("define_workflow", keywords(plan.workflowOptions, ctx)),
1065
1102
  "",
@@ -1071,12 +1108,12 @@ function renderPython(plan, clientPy, header = []) {
1071
1108
  const lines = [
1072
1109
  ...header.map((line) => `# ${line}`),
1073
1110
  ...header.length > 0 ? [""] : [],
1074
- ...chunkIZQNUNSU_cjs.formatImport(PY_SDK_MODULE, sdkNames),
1075
- ...ctx.used.has("n") ? chunkIZQNUNSU_cjs.formatImport(PY_PROJECT_MODULE, ["nodes as n"]) : [],
1111
+ ...chunkSX2PNKKT_cjs.formatImport(PY_SDK_MODULE, sdkNames),
1112
+ ...ctx.used.has("n") ? chunkSX2PNKKT_cjs.formatImport(PY_PROJECT_MODULE, ["nodes as n"]) : [],
1076
1113
  "",
1077
1114
  "",
1078
1115
  ...decorator,
1079
- `def ${chunkIZQNUNSU_cjs.pyWorkflowName(plan.key)}(wf):`,
1116
+ `def ${chunkSX2PNKKT_cjs.pyWorkflowName(plan.key)}(wf):`,
1080
1117
  ...body.length > 0 ? body : [" pass"],
1081
1118
  ""
1082
1119
  ];
@@ -1085,53 +1122,84 @@ function renderPython(plan, clientPy, header = []) {
1085
1122
 
1086
1123
  // src/roundtrip/lift.ts
1087
1124
  function layoutOf(reference) {
1088
- const data = chunkLRM6JXJA_cjs.isRecord(reference["data"]) ? reference["data"] : {};
1125
+ const data = chunkSAENRNBJ_cjs.isRecord(reference["data"]) ? reference["data"] : {};
1089
1126
  const positions = {};
1090
1127
  for (const node of Array.isArray(data["nodes"]) ? data["nodes"] : []) {
1091
- if (!chunkLRM6JXJA_cjs.isRecord(node) || typeof node["id"] !== "string" || !chunkLRM6JXJA_cjs.isRecord(node["position"])) continue;
1128
+ if (!chunkSAENRNBJ_cjs.isRecord(node) || typeof node["id"] !== "string" || !chunkSAENRNBJ_cjs.isRecord(node["position"])) continue;
1092
1129
  const { x, y } = node["position"];
1093
- if (typeof x === "number" && typeof y === "number") positions[node["id"]] = { x, y };
1130
+ if (typeof x === "number" && typeof y === "number") chunkSAENRNBJ_cjs.setOwn(positions, node["id"], { x, y });
1094
1131
  }
1095
1132
  const sidecar = {
1096
- format: chunkKUTMY2IO_cjs.LAYOUT_FORMAT,
1097
- formatVersion: chunkKUTMY2IO_cjs.LAYOUT_FORMAT_VERSION,
1133
+ format: chunk57MSZ24T_cjs.LAYOUT_FORMAT,
1134
+ formatVersion: chunk57MSZ24T_cjs.LAYOUT_FORMAT_VERSION,
1098
1135
  positions
1099
1136
  };
1100
1137
  if (Array.isArray(data["stickyNotes"])) sidecar.stickyNotes = data["stickyNotes"];
1101
- const meta = chunkLRM6JXJA_cjs.isRecord(reference["meta"]) ? reference["meta"] : void 0;
1102
- if (chunkLRM6JXJA_cjs.isRecord(meta?.["layout"])) sidecar.metaLayout = meta["layout"];
1138
+ const meta = chunkSAENRNBJ_cjs.isRecord(reference["meta"]) ? reference["meta"] : void 0;
1139
+ if (chunkSAENRNBJ_cjs.isRecord(meta?.["layout"])) sidecar.metaLayout = meta["layout"];
1103
1140
  return sidecar;
1104
1141
  }
1105
1142
  function mismatches(reference, candidate) {
1106
- const refData = chunkLRM6JXJA_cjs.isRecord(reference["data"]) ? reference["data"] : {};
1107
- const candData = chunkLRM6JXJA_cjs.isRecord(candidate["data"]) ? candidate["data"] : {};
1143
+ const refData = chunkSAENRNBJ_cjs.isRecord(reference["data"]) ? reference["data"] : {};
1144
+ const candData = chunkSAENRNBJ_cjs.isRecord(candidate["data"]) ? candidate["data"] : {};
1108
1145
  const byId = (items) => new Map(
1109
- (Array.isArray(items) ? items : []).filter(chunkLRM6JXJA_cjs.isRecord).map((item) => [String(item["id"]), item])
1146
+ (Array.isArray(items) ? items : []).filter(chunkSAENRNBJ_cjs.isRecord).map((item) => [String(item["id"]), item])
1110
1147
  );
1111
1148
  const nodes2 = /* @__PURE__ */ new Set();
1112
1149
  const candNodes = byId(candData["nodes"]);
1113
1150
  for (const [id, node] of byId(refData["nodes"]))
1114
- if (!chunkLRM6JXJA_cjs.deepEqual(node, candNodes.get(id))) nodes2.add(id);
1151
+ if (!chunkSAENRNBJ_cjs.deepEqual(node, candNodes.get(id))) nodes2.add(id);
1115
1152
  const edges = /* @__PURE__ */ new Set();
1116
1153
  const refEdges = Array.isArray(refData["edges"]) ? refData["edges"] : [];
1117
1154
  const candEdges = Array.isArray(candData["edges"]) ? candData["edges"] : [];
1118
1155
  refEdges.forEach((edge2, index) => {
1119
- if (!chunkLRM6JXJA_cjs.deepEqual(edge2, candEdges[index])) edges.add(index);
1156
+ if (!chunkSAENRNBJ_cjs.deepEqual(edge2, candEdges[index])) edges.add(index);
1120
1157
  });
1121
1158
  const strip = (doc) => {
1122
1159
  const copy = { ...doc };
1123
1160
  delete copy["authoring"];
1124
- const data = chunkLRM6JXJA_cjs.isRecord(copy["data"]) ? { ...copy["data"] } : {};
1161
+ const data = chunkSAENRNBJ_cjs.isRecord(copy["data"]) ? { ...copy["data"] } : {};
1125
1162
  delete data["nodes"];
1126
1163
  delete data["edges"];
1127
1164
  copy["data"] = data;
1128
1165
  return copy;
1129
1166
  };
1130
- return { nodes: nodes2, edges, document: !chunkLRM6JXJA_cjs.deepEqual(strip(reference), strip(candidate)) };
1167
+ return { nodes: nodes2, edges, document: !chunkSAENRNBJ_cjs.deepEqual(strip(reference), strip(candidate)) };
1168
+ }
1169
+ function tryRun(attempt) {
1170
+ try {
1171
+ return attempt();
1172
+ } catch (error) {
1173
+ if (error instanceof chunkGVTZMA5C_cjs.BuilderError) return void 0;
1174
+ throw error;
1175
+ }
1176
+ }
1177
+ function rejectedByBuilder(reference, run) {
1178
+ const nodes2 = /* @__PURE__ */ new Set();
1179
+ const edges = /* @__PURE__ */ new Set();
1180
+ const data = chunkSAENRNBJ_cjs.isRecord(reference["data"]) ? reference["data"] : {};
1181
+ const nodeIds = (Array.isArray(data["nodes"]) ? data["nodes"] : []).flatMap(
1182
+ (node) => chunkSAENRNBJ_cjs.isRecord(node) && typeof node["id"] === "string" ? [node["id"]] : []
1183
+ );
1184
+ const edgeCount = Array.isArray(data["edges"]) ? data["edges"].length : 0;
1185
+ const edgeIndices = Array.from({ length: edgeCount }, (_, index) => index);
1186
+ const allNodes = new Set(nodeIds);
1187
+ const allEdges = new Set(edgeIndices);
1188
+ for (const id of nodeIds) {
1189
+ const others = new Set(allNodes);
1190
+ others.delete(id);
1191
+ if (tryRun(() => run(others, allEdges)) === void 0) nodes2.add(id);
1192
+ }
1193
+ for (const index of edgeIndices) {
1194
+ const others = new Set(allEdges);
1195
+ others.delete(index);
1196
+ if (tryRun(() => run(allNodes, others)) === void 0) edges.add(index);
1197
+ }
1198
+ return { nodes: nodes2, edges };
1131
1199
  }
1132
1200
  function prepareLift(definition, options2 = {}) {
1133
- const normalized = chunkAU3YW7FZ_cjs.normalizeDefinition(definition);
1134
- if (!chunkLRM6JXJA_cjs.isRecord(normalized) || !chunkLRM6JXJA_cjs.isRecord(normalized["data"]))
1201
+ const normalized = chunkGBQ33SIZ_cjs.normalizeDefinition(definition);
1202
+ if (!chunkSAENRNBJ_cjs.isRecord(normalized) || !chunkSAENRNBJ_cjs.isRecord(normalized["data"]))
1135
1203
  throw new TypeError("A workflow definition must be an object with data");
1136
1204
  const reference = { ...normalized };
1137
1205
  const items = [];
@@ -1151,7 +1219,7 @@ function prepareLift(definition, options2 = {}) {
1151
1219
  kind: "layout-omitted",
1152
1220
  detail: "Node positions, sticky notes and meta.layout are not exported"
1153
1221
  });
1154
- const pinned = chunkLRM6JXJA_cjs.isRecord(reference["pinnedData"]) ? (
1222
+ const pinned = chunkSAENRNBJ_cjs.isRecord(reference["pinnedData"]) ? (
1155
1223
  // Checked to be a record; carried verbatim.
1156
1224
  reference["pinnedData"]
1157
1225
  ) : void 0;
@@ -1161,16 +1229,25 @@ function prepareLift(definition, options2 = {}) {
1161
1229
  const run = (rawNodes, rawEdges) => {
1162
1230
  const build = buildPlan(reference, options2, rawNodes, rawEdges);
1163
1231
  const recording = interpretPlan(build.plan);
1164
- const candidate = chunkKUTMY2IO_cjs.assembleRecording(recording, {
1232
+ const candidate = chunk57MSZ24T_cjs.assembleRecording(recording, {
1165
1233
  layout,
1166
1234
  ...connections ? { connections } : {},
1167
1235
  ...pinned ? { pinnedData: pinned } : {}
1168
1236
  });
1169
- return { build, candidate: chunkAU3YW7FZ_cjs.normalizeDefinition(candidate) };
1237
+ return { build, candidate: chunkGBQ33SIZ_cjs.normalizeDefinition(candidate) };
1170
1238
  };
1171
- let attempt = run(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set());
1239
+ let rejected = { nodes: /* @__PURE__ */ new Set(), edges: /* @__PURE__ */ new Set() };
1240
+ let attempt = tryRun(() => run(rejected.nodes, rejected.edges));
1241
+ if (attempt === void 0) {
1242
+ rejected = rejectedByBuilder(reference, run);
1243
+ attempt = run(rejected.nodes, rejected.edges);
1244
+ }
1172
1245
  const first = mismatches(reference, attempt.candidate);
1173
- if (first.nodes.size > 0 || first.edges.size > 0) attempt = run(first.nodes, first.edges);
1246
+ if (first.nodes.size > 0 || first.edges.size > 0)
1247
+ attempt = run(
1248
+ /* @__PURE__ */ new Set([...rejected.nodes, ...first.nodes]),
1249
+ /* @__PURE__ */ new Set([...rejected.edges, ...first.edges])
1250
+ );
1174
1251
  const residual = mismatches(reference, attempt.candidate);
1175
1252
  for (const id of residual.nodes)
1176
1253
  items.push({
@@ -1228,27 +1305,27 @@ function sidecarFiles(prepared) {
1228
1305
  files.push({
1229
1306
  path: `workflows/${key}.layout.json`,
1230
1307
  contentType: "application/json",
1231
- content: chunk27HASETB_cjs.stableStringify(prepared.layout)
1308
+ content: chunkQKZL3ONM_cjs.stableStringify(prepared.layout)
1232
1309
  });
1233
1310
  }
1234
1311
  if (prepared.pinnedData) {
1235
1312
  files.push({
1236
1313
  path: `workflows/${key}.pinned.json`,
1237
1314
  contentType: "application/json",
1238
- content: chunk27HASETB_cjs.stableStringify(prepared.pinnedData)
1315
+ content: chunkQKZL3ONM_cjs.stableStringify(prepared.pinnedData)
1239
1316
  });
1240
1317
  }
1241
1318
  return files;
1242
1319
  }
1243
1320
  async function liftToTypeScript(definition, options2 = {}) {
1244
1321
  const prepared = prepareLift(definition, options2);
1245
- const source = await chunkIZQNUNSU_cjs.renderTypeScript(prepared.plan, headerLines(options2.header));
1322
+ const source = await chunkSX2PNKKT_cjs.renderTypeScript(prepared.plan, headerLines(options2.header));
1246
1323
  const files = [
1247
1324
  { path: `workflows/${prepared.plan.key}.ts`, contentType: "text/typescript", content: source },
1248
1325
  ...sidecarFiles(prepared)
1249
1326
  ];
1250
1327
  if (prepared.usesClients) {
1251
- const clients = await chunkIZQNUNSU_cjs.generateNodeClients(prepared.registry, "ts");
1328
+ const clients = await chunkSX2PNKKT_cjs.generateNodeClients(prepared.registry, "ts");
1252
1329
  files.push({ path: clients.path, contentType: "text/typescript", content: clients.content });
1253
1330
  }
1254
1331
  return { files, items: prepared.items, reference: prepared.reference };
@@ -1258,18 +1335,183 @@ async function liftToPython(definition, options2 = {}) {
1258
1335
  const source = renderPython(prepared.plan, prepared.clientPy, headerLines(options2.header));
1259
1336
  const files = [
1260
1337
  {
1261
- path: `workflows/${chunkIZQNUNSU_cjs.pyWorkflowName(prepared.plan.key)}.py`,
1338
+ path: `workflows/${chunkSX2PNKKT_cjs.pyWorkflowName(prepared.plan.key)}.py`,
1262
1339
  contentType: "text/x-python",
1263
1340
  content: source
1264
1341
  },
1265
1342
  ...sidecarFiles(prepared)
1266
1343
  ];
1267
1344
  if (prepared.usesClients) {
1268
- const clients = await chunkIZQNUNSU_cjs.generateNodeClients(prepared.registry, "py");
1345
+ const clients = await chunkSX2PNKKT_cjs.generateNodeClients(prepared.registry, "py");
1269
1346
  files.push({ path: clients.path, contentType: "text/x-python", content: clients.content });
1270
1347
  }
1271
1348
  return { files, items: prepared.items, reference: prepared.reference };
1272
1349
  }
1350
+ var SDK_PACKAGE = "@fluidgrids/workflows";
1351
+ var KEPT_EXTENSIONS = [".js", ".mjs", ".json"];
1352
+ var NATIVE_MARKERS = [".node", "binding.gyp"];
1353
+ var SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", ".git", "test", "tests", "__tests__"]);
1354
+ var DEFAULT_MAX_BYTES = 32 * 1024 * 1024;
1355
+ function readJson(path) {
1356
+ let parsed;
1357
+ try {
1358
+ parsed = JSON.parse(fs.readFileSync(path, "utf8"));
1359
+ } catch (error) {
1360
+ throw new chunk2DP2Y6EU_cjs.LowerError(
1361
+ `Cannot read ${path}: ${error instanceof Error ? error.message : String(error)}`
1362
+ );
1363
+ }
1364
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
1365
+ throw new chunk2DP2Y6EU_cjs.LowerError(`${path} is not a JSON object`);
1366
+ return parsed;
1367
+ }
1368
+ function namesOf(value2) {
1369
+ if (typeof value2 !== "object" || value2 === null || Array.isArray(value2)) return [];
1370
+ return Object.keys(value2);
1371
+ }
1372
+ function locate(name, fromDir) {
1373
+ let dir = fromDir;
1374
+ for (; ; ) {
1375
+ const candidate = path.join(dir, "node_modules", ...name.split("/"));
1376
+ if (fs.existsSync(path.join(candidate, "package.json"))) return candidate;
1377
+ const parent = path.dirname(dir);
1378
+ if (parent === dir) return void 0;
1379
+ dir = parent;
1380
+ }
1381
+ }
1382
+ function collectFiles(packageDir, dir, files, budget) {
1383
+ for (const entry of fs.readdirSync(dir).sort()) {
1384
+ const full = path.join(dir, entry);
1385
+ const stats = fs.statSync(full);
1386
+ if (stats.isDirectory()) {
1387
+ if (!SKIPPED_DIRECTORIES.has(entry)) collectFiles(packageDir, full, files, budget);
1388
+ continue;
1389
+ }
1390
+ const path$1 = path.relative(packageDir, full).split(path.sep).join("/");
1391
+ if (NATIVE_MARKERS.some((marker) => entry.endsWith(marker))) {
1392
+ files[path$1] = "";
1393
+ continue;
1394
+ }
1395
+ if (!KEPT_EXTENSIONS.some((ext) => entry.endsWith(ext))) continue;
1396
+ budget.left -= stats.size;
1397
+ if (budget.left < 0)
1398
+ throw new chunk2DP2Y6EU_cjs.LowerError(
1399
+ `The vendored packages are larger than the limit (reached at "${budget.name}")`,
1400
+ "too-large"
1401
+ );
1402
+ files[path$1] = fs.readFileSync(full, "utf8");
1403
+ }
1404
+ }
1405
+ function vendorDependencies(projectDir, options2 = {}) {
1406
+ const rootDir = path.resolve(projectDir);
1407
+ const manifest = readJson(path.join(rootDir, "package.json"));
1408
+ const wanted = options2.packages ?? namesOf(manifest["dependencies"]);
1409
+ const budget = { left: options2.maxBytes ?? DEFAULT_MAX_BYTES, name: "" };
1410
+ const out = {};
1411
+ const queue = wanted.filter((name) => name !== SDK_PACKAGE).map((name) => ({ name, fromDir: rootDir, optional: false }));
1412
+ while (queue.length > 0) {
1413
+ const next = queue.shift();
1414
+ if (!next || Object.hasOwn(out, next.name) || next.name === SDK_PACKAGE) continue;
1415
+ const packageDir = locate(next.name, next.fromDir);
1416
+ if (packageDir === void 0) {
1417
+ if (next.optional) continue;
1418
+ throw new chunk2DP2Y6EU_cjs.LowerError(
1419
+ `"${next.name}" is a dependency but is not installed under ${rootDir}; run your package manager's install first`
1420
+ );
1421
+ }
1422
+ const pkgJson = readJson(path.join(packageDir, "package.json"));
1423
+ const files = {};
1424
+ budget.name = next.name;
1425
+ collectFiles(packageDir, packageDir, files, budget);
1426
+ out[next.name] = {
1427
+ version: typeof pkgJson["version"] === "string" ? pkgJson["version"] : "0.0.0",
1428
+ files
1429
+ };
1430
+ for (const dependency of namesOf(pkgJson["dependencies"]))
1431
+ queue.push({ name: dependency, fromDir: packageDir, optional: false });
1432
+ for (const peer of namesOf(pkgJson["peerDependencies"]))
1433
+ queue.push({ name: peer, fromDir: packageDir, optional: true });
1434
+ }
1435
+ const sorted = {};
1436
+ for (const name of Object.keys(out).sort()) {
1437
+ const pkg = out[name];
1438
+ if (pkg) sorted[name] = pkg;
1439
+ }
1440
+ return sorted;
1441
+ }
1442
+ var SOURCE_ARCHIVE_MAX_BYTES = 64 * 1024 * 1024;
1443
+ var GZIP_OS_BYTE = 9;
1444
+ function packSources(archive) {
1445
+ const value2 = { files: archive.files };
1446
+ if (archive.lock !== void 0) value2["lock"] = archive.lock;
1447
+ if (archive.vendored !== void 0 && Object.keys(archive.vendored).length > 0)
1448
+ value2["vendored"] = archive.vendored;
1449
+ const text = chunkQKZL3ONM_cjs.canonicalJson(value2);
1450
+ const zipped = zlib.gzipSync(Buffer.from(text, "utf8"), { level: 9 });
1451
+ zipped[GZIP_OS_BYTE] = 255;
1452
+ return new Uint8Array(zipped.buffer, zipped.byteOffset, zipped.byteLength);
1453
+ }
1454
+ function stringMap(value2, what) {
1455
+ if (!chunkSAENRNBJ_cjs.isRecord(value2)) throw new chunk2DP2Y6EU_cjs.LowerError(`${what} must be an object`);
1456
+ const out = {};
1457
+ for (const [key, entry] of Object.entries(value2)) {
1458
+ if (typeof entry !== "string") throw new chunk2DP2Y6EU_cjs.LowerError(`${what}["${key}"] must be a string`);
1459
+ Object.defineProperty(out, key, {
1460
+ value: entry,
1461
+ enumerable: true,
1462
+ writable: true,
1463
+ configurable: true
1464
+ });
1465
+ }
1466
+ return out;
1467
+ }
1468
+ function unpackSources(data, options2 = {}) {
1469
+ const maxBytes = options2.maxBytes ?? SOURCE_ARCHIVE_MAX_BYTES;
1470
+ let text;
1471
+ try {
1472
+ text = zlib.gunzipSync(data, { maxOutputLength: maxBytes }).toString("utf8");
1473
+ } catch (error) {
1474
+ const message = error instanceof Error ? error.message : String(error);
1475
+ throw new chunk2DP2Y6EU_cjs.LowerError(
1476
+ /buffer|length|range/i.test(message) ? `The source archive is larger than ${maxBytes} bytes uncompressed` : `The source archive is not gzip: ${message}`,
1477
+ /buffer|length|range/i.test(message) ? "too-large" : void 0
1478
+ );
1479
+ }
1480
+ let parsed;
1481
+ try {
1482
+ parsed = JSON.parse(text);
1483
+ } catch {
1484
+ throw new chunk2DP2Y6EU_cjs.LowerError("The source archive is not JSON");
1485
+ }
1486
+ if (!chunkSAENRNBJ_cjs.isRecord(parsed)) throw new chunk2DP2Y6EU_cjs.LowerError("The source archive is not an object");
1487
+ const archive = { files: stringMap(parsed["files"], "files") };
1488
+ if (parsed["lock"] !== void 0) {
1489
+ if (typeof parsed["lock"] !== "string") throw new chunk2DP2Y6EU_cjs.LowerError("lock must be a string");
1490
+ archive.lock = parsed["lock"];
1491
+ }
1492
+ if (parsed["vendored"] !== void 0) {
1493
+ if (!chunkSAENRNBJ_cjs.isRecord(parsed["vendored"])) throw new chunk2DP2Y6EU_cjs.LowerError("vendored must be an object");
1494
+ const vendored = {};
1495
+ for (const [name, pkg] of Object.entries(parsed["vendored"])) {
1496
+ if (!chunkSAENRNBJ_cjs.isRecord(pkg) || typeof pkg["version"] !== "string")
1497
+ throw new chunk2DP2Y6EU_cjs.LowerError(`vendored["${name}"] needs a version`);
1498
+ Object.defineProperty(vendored, name, {
1499
+ value: {
1500
+ version: pkg["version"],
1501
+ files: stringMap(pkg["files"], `vendored["${name}"].files`)
1502
+ },
1503
+ enumerable: true,
1504
+ writable: true,
1505
+ configurable: true
1506
+ });
1507
+ }
1508
+ archive.vendored = vendored;
1509
+ }
1510
+ return archive;
1511
+ }
1512
+ function archiveDeps(archive) {
1513
+ return archive.vendored ?? {};
1514
+ }
1273
1515
 
1274
1516
  // src/roundtrip/fidelity.ts
1275
1517
  var LOSSY_KINDS = /* @__PURE__ */ new Set([
@@ -1280,9 +1522,9 @@ var LOSSY_KINDS = /* @__PURE__ */ new Set([
1280
1522
  ]);
1281
1523
  async function checkFidelity(files, reference, items, options2 = {}) {
1282
1524
  const all = [...items];
1283
- const connections = options2.connectionNames && chunkLRM6JXJA_cjs.isRecord(reference) ? connectionsByName(options2.connectionNames, reference) : void 0;
1525
+ const connections = options2.connectionNames && chunkSAENRNBJ_cjs.isRecord(reference) ? connectionsByName(options2.connectionNames, reference) : void 0;
1284
1526
  try {
1285
- const result = await chunkLUXCXFOE_cjs.lower(
1527
+ const result = await chunk2DP2Y6EU_cjs.lower(
1286
1528
  files.map((file) => ({ path: file.path, content: file.content })),
1287
1529
  {
1288
1530
  ...options2.esbuild ? { esbuild: options2.esbuild } : {},
@@ -1296,8 +1538,8 @@ async function checkFidelity(files, reference, items, options2 = {}) {
1296
1538
  kind: "lowering-failed",
1297
1539
  detail: `Lowering produced ${result.workflows.length} workflows instead of one`
1298
1540
  });
1299
- } else if (chunkAU3YW7FZ_cjs.irHash(lowered) !== chunkAU3YW7FZ_cjs.irHash(reference)) {
1300
- for (const change of chunkBYJ7QTLY_cjs.diffDefinitions(reference, lowered)) {
1541
+ } else if (chunkGBQ33SIZ_cjs.irHash(lowered) !== chunkGBQ33SIZ_cjs.irHash(reference)) {
1542
+ for (const change of chunkNEIUQASE_cjs.diffDefinitions(reference, lowered)) {
1301
1543
  all.push({
1302
1544
  path: change.path,
1303
1545
  kind: "roundtrip-mismatch",
@@ -1322,54 +1564,87 @@ async function exportWorkflowCode(definition, options2) {
1322
1564
  ...options2.connectionNames ? { connectionNames: options2.connectionNames } : {}
1323
1565
  });
1324
1566
  const files = options2.format === "PYTHON" ? (await liftToPython(definition, options2)).files : ts.files;
1325
- return { format: options2.format, files, fidelity, irHash: chunkAU3YW7FZ_cjs.irHash(definition) };
1567
+ return { format: options2.format, files, fidelity, irHash: chunkGBQ33SIZ_cjs.irHash(definition) };
1326
1568
  }
1327
1569
 
1570
+ Object.defineProperty(exports, "createNodeVmEvaluator", {
1571
+ enumerable: true,
1572
+ get: function () { return chunkHR3BN4C4_cjs.createNodeVmEvaluator; }
1573
+ });
1328
1574
  Object.defineProperty(exports, "PY_LINE_LENGTH", {
1329
1575
  enumerable: true,
1330
- get: function () { return chunkIZQNUNSU_cjs.PY_LINE_LENGTH; }
1576
+ get: function () { return chunkSX2PNKKT_cjs.PY_LINE_LENGTH; }
1331
1577
  });
1332
1578
  Object.defineProperty(exports, "TS_FORMAT_OPTIONS", {
1333
1579
  enumerable: true,
1334
- get: function () { return chunkIZQNUNSU_cjs.TS_FORMAT_OPTIONS; }
1580
+ get: function () { return chunkSX2PNKKT_cjs.TS_FORMAT_OPTIONS; }
1335
1581
  });
1336
1582
  Object.defineProperty(exports, "TS_NODES_IMPORT", {
1337
1583
  enumerable: true,
1338
- get: function () { return chunkIZQNUNSU_cjs.TS_NODES_IMPORT; }
1584
+ get: function () { return chunkSX2PNKKT_cjs.TS_NODES_IMPORT; }
1339
1585
  });
1340
- Object.defineProperty(exports, "createNodeVmEvaluator", {
1586
+ Object.defineProperty(exports, "DeterminismViolationError", {
1341
1587
  enumerable: true,
1342
- get: function () { return chunk265J2FCH_cjs.createNodeVmEvaluator; }
1588
+ get: function () { return chunk2DP2Y6EU_cjs.DeterminismViolationError; }
1343
1589
  });
1344
1590
  Object.defineProperty(exports, "ESBUILD_VERSION", {
1345
1591
  enumerable: true,
1346
- get: function () { return chunkLUXCXFOE_cjs.ESBUILD_VERSION; }
1592
+ get: function () { return chunk2DP2Y6EU_cjs.ESBUILD_VERSION; }
1347
1593
  });
1348
1594
  Object.defineProperty(exports, "EVALUATION_GLOBAL", {
1349
1595
  enumerable: true,
1350
- get: function () { return chunkLUXCXFOE_cjs.EVALUATION_GLOBAL; }
1596
+ get: function () { return chunk2DP2Y6EU_cjs.EVALUATION_GLOBAL; }
1351
1597
  });
1352
1598
  Object.defineProperty(exports, "LowerError", {
1353
1599
  enumerable: true,
1354
- get: function () { return chunkLUXCXFOE_cjs.LowerError; }
1600
+ get: function () { return chunk2DP2Y6EU_cjs.LowerError; }
1601
+ });
1602
+ Object.defineProperty(exports, "NODE_BUILTINS", {
1603
+ enumerable: true,
1604
+ get: function () { return chunk2DP2Y6EU_cjs.NODE_BUILTINS; }
1605
+ });
1606
+ Object.defineProperty(exports, "buildBundle", {
1607
+ enumerable: true,
1608
+ get: function () { return chunk2DP2Y6EU_cjs.buildBundle; }
1355
1609
  });
1356
1610
  Object.defineProperty(exports, "bundleProject", {
1357
1611
  enumerable: true,
1358
- get: function () { return chunkLUXCXFOE_cjs.bundleProject; }
1612
+ get: function () { return chunk2DP2Y6EU_cjs.bundleProject; }
1613
+ });
1614
+ Object.defineProperty(exports, "bundleSourceHash", {
1615
+ enumerable: true,
1616
+ get: function () { return chunk2DP2Y6EU_cjs.bundleSourceHash; }
1359
1617
  });
1360
1618
  Object.defineProperty(exports, "defaultEntries", {
1361
1619
  enumerable: true,
1362
- get: function () { return chunkLUXCXFOE_cjs.defaultEntries; }
1620
+ get: function () { return chunk2DP2Y6EU_cjs.defaultEntries; }
1363
1621
  });
1364
1622
  Object.defineProperty(exports, "lower", {
1365
1623
  enumerable: true,
1366
- get: function () { return chunkLUXCXFOE_cjs.lower; }
1624
+ get: function () { return chunk2DP2Y6EU_cjs.lower; }
1625
+ });
1626
+ Object.defineProperty(exports, "resolvePackageEntry", {
1627
+ enumerable: true,
1628
+ get: function () { return chunk2DP2Y6EU_cjs.resolvePackageEntry; }
1629
+ });
1630
+ Object.defineProperty(exports, "scanDurableSources", {
1631
+ enumerable: true,
1632
+ get: function () { return chunk2DP2Y6EU_cjs.scanDurableSources; }
1633
+ });
1634
+ Object.defineProperty(exports, "splitSpecifier", {
1635
+ enumerable: true,
1636
+ get: function () { return chunk2DP2Y6EU_cjs.splitSpecifier; }
1367
1637
  });
1368
1638
  exports.LiftError = LiftError;
1369
1639
  exports.PY_PROJECT_MODULE = PY_PROJECT_MODULE;
1370
1640
  exports.PY_SDK_MODULE = PY_SDK_MODULE;
1641
+ exports.SOURCE_ARCHIVE_MAX_BYTES = SOURCE_ARCHIVE_MAX_BYTES;
1642
+ exports.archiveDeps = archiveDeps;
1371
1643
  exports.checkFidelity = checkFidelity;
1372
1644
  exports.exportWorkflowCode = exportWorkflowCode;
1373
1645
  exports.liftToPython = liftToPython;
1374
1646
  exports.liftToTypeScript = liftToTypeScript;
1647
+ exports.packSources = packSources;
1375
1648
  exports.prepareLift = prepareLift;
1649
+ exports.unpackSources = unpackSources;
1650
+ exports.vendorDependencies = vendorDependencies;