@synergenius/flow-weaver 0.33.1 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (922) hide show
  1. package/LICENSE +201 -226
  2. package/NOTICE +13 -0
  3. package/README.md +152 -244
  4. package/dist/agent/agent-loop.d.ts +4 -2
  5. package/dist/agent/cli-session.d.ts +3 -3
  6. package/dist/agent/cli-session.js +511 -438
  7. package/dist/agent/cli-spawn-config.d.ts +4 -4
  8. package/dist/agent/gate.d.ts +164 -0
  9. package/dist/agent/index.d.ts +4 -4
  10. package/dist/agent/index.js +174 -28
  11. package/dist/agent/mcp-bridge.d.ts +1 -1
  12. package/dist/agent/mcp-bridge.js +114 -128
  13. package/dist/agent/mcp-tool-server.d.ts +2 -2
  14. package/dist/agent/mcp-tool-server.js +147 -189
  15. package/dist/agent/profiles.d.ts +69 -0
  16. package/dist/agent/providers/anthropic.d.ts +2 -4
  17. package/dist/agent/providers/claude-cli.d.ts +4 -5
  18. package/dist/agent/providers/openai-compat.d.ts +8 -1
  19. package/dist/agent/streaming.d.ts +2 -2
  20. package/dist/agent/types.d.ts +16 -10
  21. package/dist/api/builder.d.ts +3 -3
  22. package/dist/api/compile.d.ts +9 -4
  23. package/dist/api/durable-validation.d.ts +15 -0
  24. package/dist/api/generate-in-place.d.ts +21 -19
  25. package/dist/api/generate.d.ts +21 -16
  26. package/dist/api/generated-module/local-node-functions.d.ts +24 -0
  27. package/dist/api/generated-module/module-format.d.ts +23 -0
  28. package/dist/api/generated-module/module-writer.d.ts +34 -0
  29. package/dist/api/generated-module/node-type-imports.d.ts +39 -0
  30. package/dist/api/generated-module/preamble.d.ts +16 -0
  31. package/dist/api/generated-module/workflow-functions.d.ts +29 -0
  32. package/dist/api/graph-identity.d.ts +39 -0
  33. package/dist/api/helpers.d.ts +4 -60
  34. package/dist/api/in-place/built-in-nodes.d.ts +18 -0
  35. package/dist/api/in-place/function-body.d.ts +21 -0
  36. package/dist/api/in-place/fw-imports.d.ts +30 -0
  37. package/dist/api/in-place/macro-coverage.d.ts +14 -0
  38. package/dist/api/in-place/node-type-functions.d.ts +18 -0
  39. package/dist/api/in-place/node-type-jsdoc.d.ts +20 -0
  40. package/dist/api/in-place/orphaned-node-types.d.ts +16 -0
  41. package/dist/api/in-place/runtime-section.d.ts +16 -0
  42. package/dist/api/in-place/signature.d.ts +47 -0
  43. package/dist/api/in-place/source-file.d.ts +19 -0
  44. package/dist/api/in-place/workflow-jsdoc.d.ts +19 -0
  45. package/dist/api/index.d.ts +18 -21
  46. package/dist/api/index.js +259 -53
  47. package/dist/api/inline-engine.generated.d.ts +3 -0
  48. package/dist/api/inline-runtime.d.ts +10 -2
  49. package/dist/api/manipulation/connections.d.ts +1 -1
  50. package/dist/api/manipulation/index.d.ts +8 -8
  51. package/dist/api/manipulation/node-types.d.ts +1 -1
  52. package/dist/api/manipulation/nodes.d.ts +3 -13
  53. package/dist/api/manipulation/ports.d.ts +1 -1
  54. package/dist/api/manipulation/scopes.d.ts +1 -1
  55. package/dist/api/manipulation/workflow.d.ts +1 -1
  56. package/dist/api/modify-operation.d.ts +0 -2
  57. package/dist/api/parse.d.ts +22 -1
  58. package/dist/api/port-references.d.ts +66 -0
  59. package/dist/api/query.d.ts +18 -2
  60. package/dist/api/templates.d.ts +1 -1
  61. package/dist/api/transform.d.ts +1 -1
  62. package/dist/api/validate.d.ts +1 -1
  63. package/dist/api/validation-registry.d.ts +2 -2
  64. package/dist/artifacts/brief.d.ts +43 -0
  65. package/dist/artifacts/index.d.ts +31 -0
  66. package/dist/artifacts/pdf.d.ts +19 -0
  67. package/dist/ast/builder.d.ts +3 -3
  68. package/dist/ast/index.d.ts +4 -4
  69. package/dist/ast/index.js +60 -5
  70. package/dist/ast/serialization-node.d.ts +1 -1
  71. package/dist/ast/serialization.d.ts +1 -1
  72. package/dist/ast/types.d.ts +82 -291
  73. package/dist/ast/workflow-utils.d.ts +4 -4
  74. package/dist/built-in-nodes/coercion-types.d.ts +1 -1
  75. package/dist/built-in-nodes/delay.d.ts +3 -1
  76. package/dist/built-in-nodes/generated-registry.d.ts +1 -1
  77. package/dist/built-in-nodes/index.d.ts +6 -5
  78. package/dist/built-in-nodes/index.js +79 -5
  79. package/dist/built-in-nodes/invoke-workflow.d.ts +2 -1
  80. package/dist/built-in-nodes/mock-types.d.ts +45 -14
  81. package/dist/built-in-nodes/sleep.d.ts +12 -0
  82. package/dist/built-in-nodes/wait-for-agent.d.ts +2 -1
  83. package/dist/built-in-nodes/wait-for-event.d.ts +2 -1
  84. package/dist/chevrotain-parser/coerce-parser.d.ts +1 -1
  85. package/dist/chevrotain-parser/connect-parser.d.ts +1 -1
  86. package/dist/chevrotain-parser/grammar-diagrams.d.ts +1 -1
  87. package/dist/chevrotain-parser/index.d.ts +20 -23
  88. package/dist/chevrotain-parser/node-parser.d.ts +7 -8
  89. package/dist/chevrotain-parser/parse-line.d.ts +54 -0
  90. package/dist/chevrotain-parser/tokens.d.ts +0 -17
  91. package/dist/chevrotain-parser/trigger-cancel-parser.d.ts +6 -1
  92. package/dist/chunks/chunk-4EUSHAY6.js +298 -0
  93. package/dist/chunks/chunk-4KDUEOFD.js +197 -0
  94. package/dist/chunks/chunk-5Y3AIUWY.js +911 -0
  95. package/dist/chunks/chunk-6KMVP6AU.js +20 -0
  96. package/dist/chunks/chunk-6PNJORFL.js +128 -0
  97. package/dist/chunks/chunk-7AAQNGRH.js +2001 -0
  98. package/dist/chunks/chunk-7YYKTPJ5.js +22705 -0
  99. package/dist/chunks/chunk-A5MBOFVY.js +33 -0
  100. package/dist/chunks/chunk-AXNQRVJB.js +18 -0
  101. package/dist/chunks/chunk-B6HQ6YS5.js +572 -0
  102. package/dist/chunks/chunk-CY3RNVML.js +296 -0
  103. package/dist/chunks/chunk-CYHYDLV4.js +653 -0
  104. package/dist/chunks/chunk-CZBCCK4Y.js +82 -0
  105. package/dist/chunks/chunk-DCMGQP5V.js +505 -0
  106. package/dist/chunks/chunk-DIAA66GL.js +72 -0
  107. package/dist/chunks/chunk-DUO6H5PR.js +20 -0
  108. package/dist/chunks/chunk-E5WN7IGO.js +125 -0
  109. package/dist/chunks/chunk-EFGFXXQF.js +184 -0
  110. package/dist/chunks/chunk-F3RTZV2A.js +2811 -0
  111. package/dist/chunks/chunk-FMTLP5ZX.js +1397 -0
  112. package/dist/chunks/chunk-HKZLQJDV.js +79 -0
  113. package/dist/chunks/chunk-INDEVYEC.js +146 -0
  114. package/dist/chunks/chunk-JQTF4R5L.js +390 -0
  115. package/dist/chunks/chunk-KMCAYNUM.js +331 -0
  116. package/dist/chunks/chunk-KMWCCOUJ.js +1444 -0
  117. package/dist/chunks/chunk-KU3CLJI2.js +338 -0
  118. package/dist/chunks/chunk-NDSTGMKR.js +3300 -0
  119. package/dist/chunks/chunk-NQNLUAPO.js +505 -0
  120. package/dist/chunks/chunk-O2U2LO57.js +466 -0
  121. package/dist/chunks/chunk-OOQG7UPP.js +457 -0
  122. package/dist/chunks/chunk-OZQAW5ZG.js +112 -0
  123. package/dist/chunks/chunk-P2CVDGHR.js +487 -0
  124. package/dist/chunks/chunk-P44RIZ7C.js +592 -0
  125. package/dist/chunks/chunk-PEZCT37T.js +1475 -0
  126. package/dist/chunks/chunk-PKWSAW6O.js +152 -0
  127. package/dist/chunks/chunk-Q6MDDZMT.js +4373 -0
  128. package/dist/chunks/chunk-QDE4Z7KW.js +6 -0
  129. package/dist/chunks/chunk-QJDAVSNY.js +8 -0
  130. package/dist/chunks/chunk-QYPORSLO.js +7552 -0
  131. package/dist/chunks/chunk-R4QGNK34.js +183 -0
  132. package/dist/chunks/chunk-REEYC73I.js +3002 -0
  133. package/dist/chunks/chunk-SEWDMQ6Q.js +46 -0
  134. package/dist/chunks/chunk-TAIUWKZB.js +3057 -0
  135. package/dist/chunks/chunk-TN4YZ3O7.js +196 -0
  136. package/dist/chunks/chunk-TRMFB43C.js +143 -0
  137. package/dist/chunks/chunk-VO4QXG2X.js +1016 -0
  138. package/dist/chunks/chunk-VP2P3BPA.js +1002 -0
  139. package/dist/chunks/chunk-VQ7H33J4.js +2176 -0
  140. package/dist/chunks/chunk-VWA7MCV2.js +105 -0
  141. package/dist/chunks/chunk-XAV22WD7.js +253 -0
  142. package/dist/chunks/chunk-YSPBPZDV.js +148 -0
  143. package/dist/chunks/chunk-ZKEGXO73.js +282 -0
  144. package/dist/chunks/chunk-ZMGN6F3S.js +4256 -0
  145. package/dist/chunks/grammar-diagrams-AI7VDXOM.js +14 -0
  146. package/dist/chunks/index.min-ECJD6GZC.js +37 -0
  147. package/dist/chunks/manifest-EPTR5MYH.js +21 -0
  148. package/dist/chunks/openapi-document-6TCGVDUW.js +69 -0
  149. package/dist/chunks/registry-K2U5KUTY.js +23 -0
  150. package/dist/chunks/serialization-node-UGY6CFH6.js +38 -0
  151. package/dist/chunks/validate-GEKSZPIN.js +24 -0
  152. package/dist/chunks/validation-registry-IQZX3UE3.js +7 -0
  153. package/dist/chunks/validator-VXFHLPDW.js +26 -0
  154. package/dist/chunks/workflow-executor-KBGFKHNR.js +36 -0
  155. package/dist/cli/commands/agents.d.ts +16 -0
  156. package/dist/cli/commands/artifact.d.ts +10 -0
  157. package/dist/cli/commands/compile.d.ts +0 -30
  158. package/dist/cli/commands/console.d.ts +32 -0
  159. package/dist/cli/commands/context.d.ts +0 -3
  160. package/dist/cli/commands/describe.js +386 -352
  161. package/dist/cli/commands/dev.d.ts +9 -4
  162. package/dist/cli/commands/diagram.d.ts +3 -5
  163. package/dist/cli/commands/doctor.d.ts +27 -4
  164. package/dist/cli/commands/doctor.js +3307 -633
  165. package/dist/cli/commands/export.d.ts +6 -4
  166. package/dist/cli/commands/grammar.d.ts +0 -3
  167. package/dist/cli/commands/implement.d.ts +1 -1
  168. package/dist/cli/commands/init/agent-handoff.d.ts +28 -0
  169. package/dist/cli/commands/init/config.d.ts +3 -0
  170. package/dist/cli/commands/init/files.d.ts +12 -0
  171. package/dist/cli/commands/init/naming.d.ts +13 -0
  172. package/dist/cli/commands/init/output.d.ts +12 -0
  173. package/dist/cli/commands/init/setup.d.ts +21 -0
  174. package/dist/cli/commands/init/types.d.ts +53 -0
  175. package/dist/cli/commands/init-personas.d.ts +9 -1
  176. package/dist/cli/commands/init.d.ts +24 -88
  177. package/dist/cli/commands/market.d.ts +1 -1
  178. package/dist/cli/commands/mcp-setup.d.ts +1 -4
  179. package/dist/cli/commands/modify.d.ts +0 -5
  180. package/dist/cli/commands/openapi.d.ts +9 -11
  181. package/dist/cli/commands/run.d.ts +0 -4
  182. package/dist/cli/commands/serve.d.ts +24 -26
  183. package/dist/cli/commands/status.d.ts +1 -1
  184. package/dist/cli/exports.d.ts +3 -4
  185. package/dist/cli/exports.js +124 -23
  186. package/dist/cli/flow-weaver-agents-H653446S.mjs +81 -0
  187. package/dist/cli/flow-weaver-artifact-WBFYTW76.mjs +58 -0
  188. package/dist/cli/flow-weaver-chunk-265CEK74.mjs +2 -0
  189. package/dist/cli/flow-weaver-chunk-2C7PZCV5.mjs +186 -0
  190. package/dist/cli/flow-weaver-chunk-3BSYCWPL.mjs +3109 -0
  191. package/dist/cli/flow-weaver-chunk-3MKUQP3D.mjs +547 -0
  192. package/dist/cli/flow-weaver-chunk-3ZLMPQTH.mjs +27 -0
  193. package/dist/cli/flow-weaver-chunk-4DVY73ML.mjs +280 -0
  194. package/dist/cli/flow-weaver-chunk-54M4KNEL.mjs +200 -0
  195. package/dist/cli/flow-weaver-chunk-55QMUZIA.mjs +256 -0
  196. package/dist/cli/flow-weaver-chunk-6ZUJ7LMX.mjs +2003 -0
  197. package/dist/cli/flow-weaver-chunk-7ET6N32V.mjs +419 -0
  198. package/dist/cli/flow-weaver-chunk-7G63RR4K.mjs +8880 -0
  199. package/dist/cli/flow-weaver-chunk-A6M5K3W7.mjs +4418 -0
  200. package/dist/cli/flow-weaver-chunk-AA3NATMX.mjs +154 -0
  201. package/dist/cli/flow-weaver-chunk-APX6MQ5A.mjs +5652 -0
  202. package/dist/cli/flow-weaver-chunk-BHCC5FE5.mjs +17 -0
  203. package/dist/cli/flow-weaver-chunk-DM4BBRRU.mjs +35 -0
  204. package/dist/cli/flow-weaver-chunk-DRN7KPWY.mjs +168 -0
  205. package/dist/cli/flow-weaver-chunk-EKWF27G6.mjs +23 -0
  206. package/dist/cli/flow-weaver-chunk-EM5HWQ4R.mjs +338 -0
  207. package/dist/cli/flow-weaver-chunk-FPPPU2DG.mjs +226 -0
  208. package/dist/cli/flow-weaver-chunk-GAQXZHNO.mjs +3005 -0
  209. package/dist/cli/flow-weaver-chunk-GBUNNP33.mjs +1329 -0
  210. package/dist/cli/flow-weaver-chunk-HMAKDE55.mjs +636 -0
  211. package/dist/cli/flow-weaver-chunk-HQ3ZAN44.mjs +367 -0
  212. package/dist/cli/flow-weaver-chunk-I4APCXYN.mjs +21442 -0
  213. package/dist/cli/flow-weaver-chunk-IJJ4JXTL.mjs +2297 -0
  214. package/dist/cli/flow-weaver-chunk-J7EPZW2I.mjs +33 -0
  215. package/dist/cli/flow-weaver-chunk-KOEMJHLG.mjs +83 -0
  216. package/dist/cli/flow-weaver-chunk-M6CBWQKJ.mjs +271 -0
  217. package/dist/cli/flow-weaver-chunk-MHJ4N652.mjs +1580 -0
  218. package/dist/cli/flow-weaver-chunk-MKAFQWLP.mjs +202 -0
  219. package/dist/cli/flow-weaver-chunk-MMV2XGD3.mjs +3291 -0
  220. package/dist/cli/flow-weaver-chunk-MSI2UJES.mjs +125 -0
  221. package/dist/cli/flow-weaver-chunk-N767YRAI.mjs +48 -0
  222. package/dist/cli/flow-weaver-chunk-NQKKWDGF.mjs +56 -0
  223. package/dist/cli/flow-weaver-chunk-NYZDQYFU.mjs +45 -0
  224. package/dist/cli/flow-weaver-chunk-OMVWSNHJ.mjs +14 -0
  225. package/dist/cli/flow-weaver-chunk-PUWZ47H5.mjs +2188 -0
  226. package/dist/cli/flow-weaver-chunk-QOPRVDES.mjs +46 -0
  227. package/dist/cli/flow-weaver-chunk-RIWE7YTR.mjs +216 -0
  228. package/dist/cli/flow-weaver-chunk-S63Q3JIU.mjs +789 -0
  229. package/dist/cli/flow-weaver-chunk-T7X5A23H.mjs +558 -0
  230. package/dist/cli/flow-weaver-chunk-TLV3VZUN.mjs +2 -0
  231. package/dist/cli/flow-weaver-chunk-TS5P3PIN.mjs +194 -0
  232. package/dist/cli/flow-weaver-chunk-U3EO3X4B.mjs +649 -0
  233. package/dist/cli/flow-weaver-chunk-UNFS3NQP.mjs +34 -0
  234. package/dist/cli/flow-weaver-chunk-V6DHWFQG.mjs +2811 -0
  235. package/dist/cli/flow-weaver-chunk-VXWNLYQU.mjs +9 -0
  236. package/dist/cli/flow-weaver-chunk-W3YNK26P.mjs +149 -0
  237. package/dist/cli/flow-weaver-chunk-XG2WKXYZ.mjs +324 -0
  238. package/dist/cli/flow-weaver-chunk-YLSRZWFK.mjs +2219 -0
  239. package/dist/cli/flow-weaver-chunk-YVPURWS6.mjs +40 -0
  240. package/dist/cli/flow-weaver-chunk-Z44JK332.mjs +582 -0
  241. package/dist/cli/flow-weaver-chunk-Z5ZJPNSY.mjs +517 -0
  242. package/dist/cli/flow-weaver-chunk-ZQALO25T.mjs +594 -0
  243. package/dist/cli/flow-weaver-compile-A2CABDSB.mjs +37 -0
  244. package/dist/cli/flow-weaver-console-6EBHDBTN.mjs +71 -0
  245. package/dist/cli/flow-weaver-context-ECLYANFF.mjs +17 -0
  246. package/dist/cli/flow-weaver-context-ZRUMW2KE.mjs +69 -0
  247. package/dist/cli/flow-weaver-create-WIP4EFNP.mjs +124 -0
  248. package/dist/cli/flow-weaver-deployment-WJJRK7NO.mjs +14 -0
  249. package/dist/cli/flow-weaver-describe-XDIFF5LI.mjs +41 -0
  250. package/dist/cli/flow-weaver-dev-LG2NSQAU.mjs +196 -0
  251. package/dist/cli/flow-weaver-diagram-3EVQARQE.mjs +52 -0
  252. package/dist/cli/flow-weaver-diagram-7LR7O4M2.mjs +44 -0
  253. package/dist/cli/flow-weaver-diff-USF7DJLU.mjs +85 -0
  254. package/dist/cli/flow-weaver-docs-QU2ZOXKH.mjs +96 -0
  255. package/dist/cli/flow-weaver-doctor-K447YWHR.mjs +43 -0
  256. package/dist/cli/flow-weaver-export-LAS6N56Y.mjs +140 -0
  257. package/dist/cli/flow-weaver-grammar-RIRUS3Q6.mjs +49 -0
  258. package/dist/cli/flow-weaver-grammar-diagrams-WXRTW5SK.mjs +15 -0
  259. package/dist/cli/flow-weaver-implement-5JG6BCFZ.mjs +114 -0
  260. package/dist/cli/flow-weaver-index.min-OR5SIHXD.mjs +39 -0
  261. package/dist/cli/flow-weaver-init-34YZNPQX.mjs +972 -0
  262. package/dist/cli/flow-weaver-init-personas-NOGZTQQ2.mjs +48 -0
  263. package/dist/cli/flow-weaver-manifest-4JNUSEB3.mjs +18 -0
  264. package/dist/cli/flow-weaver-market-WA4CKHKV.mjs +444 -0
  265. package/dist/cli/flow-weaver-mcp-setup-O26MGXSD.mjs +22 -0
  266. package/dist/cli/flow-weaver-migrate-VFVEUTPH.mjs +119 -0
  267. package/dist/cli/flow-weaver-modify-VM3JP5K6.mjs +97 -0
  268. package/dist/cli/flow-weaver-openapi-IRBWI3HM.mjs +71 -0
  269. package/dist/cli/flow-weaver-openapi-document-7N6YMPG3.mjs +30 -0
  270. package/dist/cli/flow-weaver-pack-commands-OS2QRXAK.mjs +146 -0
  271. package/dist/cli/flow-weaver-registry-5MLFRPPT.mjs +25 -0
  272. package/dist/cli/flow-weaver-run-DSTLSTHR.mjs +555 -0
  273. package/dist/cli/flow-weaver-serialization-node-LE6PCG4M.mjs +50 -0
  274. package/dist/cli/flow-weaver-serve-NVLCLSOW.mjs +192 -0
  275. package/dist/cli/flow-weaver-server-7IERLVXE.mjs +2925 -0
  276. package/dist/cli/flow-weaver-server-KWF4PXYC.mjs +19112 -0
  277. package/dist/cli/flow-weaver-status-75W2S3YB.mjs +138 -0
  278. package/dist/cli/flow-weaver-strip-AZPXUYVA.mjs +79 -0
  279. package/dist/cli/flow-weaver-templates-DSNMB6K7.mjs +72 -0
  280. package/dist/cli/flow-weaver-validate-A4UWDQN6.mjs +19 -0
  281. package/dist/cli/flow-weaver-validate-GRBZ5W4C.mjs +296 -0
  282. package/dist/cli/flow-weaver-validation-registry-BINGUNXX.mjs +9 -0
  283. package/dist/cli/flow-weaver-validator-TY56CI42.mjs +21 -0
  284. package/dist/cli/flow-weaver-watch-OPPERXL6.mjs +114 -0
  285. package/dist/cli/flow-weaver-workflow-executor-6AHYPXAN.mjs +26 -0
  286. package/dist/cli/flow-weaver.mjs +3557 -89498
  287. package/dist/cli/index.d.ts +5 -2
  288. package/dist/cli/pack-commands-needed.d.ts +12 -0
  289. package/dist/cli/program.d.ts +14 -0
  290. package/dist/cli/templates/ai/mock-provider.d.ts +1 -1
  291. package/dist/cli/templates/index.d.ts +1 -8
  292. package/dist/cli/templates/nodes/agent-router.d.ts +1 -1
  293. package/dist/cli/templates/nodes/aggregator.d.ts +1 -1
  294. package/dist/cli/templates/nodes/conversation-memory.d.ts +1 -1
  295. package/dist/cli/templates/nodes/http.d.ts +1 -1
  296. package/dist/cli/templates/nodes/human-approval.d.ts +1 -1
  297. package/dist/cli/templates/nodes/json-extractor.d.ts +1 -1
  298. package/dist/cli/templates/nodes/llm-call.d.ts +1 -1
  299. package/dist/cli/templates/nodes/prompt-template.d.ts +1 -1
  300. package/dist/cli/templates/nodes/rag-retriever.d.ts +1 -1
  301. package/dist/cli/templates/nodes/tool-executor.d.ts +1 -1
  302. package/dist/cli/templates/nodes/transformer.d.ts +1 -1
  303. package/dist/cli/templates/nodes/validator.d.ts +1 -1
  304. package/dist/cli/templates/shared/approval-types.d.ts +1 -1
  305. package/dist/cli/templates/shared/case.d.ts +14 -0
  306. package/dist/cli/templates/shared/llm-types.d.ts +4 -4
  307. package/dist/cli/templates/workflows/aggregator.d.ts +1 -1
  308. package/dist/cli/templates/workflows/ai-agent.d.ts +1 -1
  309. package/dist/cli/templates/workflows/ai-chat.d.ts +1 -1
  310. package/dist/cli/templates/workflows/ai-rag.d.ts +1 -1
  311. package/dist/cli/templates/workflows/ai-react.d.ts +1 -1
  312. package/dist/cli/templates/workflows/approval.d.ts +10 -0
  313. package/dist/cli/templates/workflows/conditional.d.ts +2 -2
  314. package/dist/cli/templates/workflows/error-handler.d.ts +2 -2
  315. package/dist/cli/templates/workflows/foreach.d.ts +1 -1
  316. package/dist/cli/templates/workflows/sequential.d.ts +1 -1
  317. package/dist/cli/templates/workflows/webhook.d.ts +1 -1
  318. package/dist/cli/utils/interactive.d.ts +6 -0
  319. package/dist/cli/utils/json-option.d.ts +8 -0
  320. package/dist/cli/utils/logger.d.ts +2 -0
  321. package/dist/compiler/durable-source-proof.d.ts +23 -0
  322. package/dist/compiler/executable-artifact.d.ts +29 -0
  323. package/dist/compiler/index.d.ts +4 -0
  324. package/dist/compiler/index.js +36 -0
  325. package/dist/console/app.js +106 -0
  326. package/dist/console/assets/synergenius.svg +18 -0
  327. package/dist/console/author.d.ts +32 -0
  328. package/dist/console/cli-catalog.d.ts +21 -0
  329. package/dist/console/cli-run.d.ts +35 -0
  330. package/dist/console/cli-run.js +46 -0
  331. package/dist/console/debug.d.ts +67 -0
  332. package/dist/console/diff-view.d.ts +96 -0
  333. package/dist/console/export.d.ts +36 -0
  334. package/dist/console/git.d.ts +27 -0
  335. package/dist/console/index.d.ts +4 -0
  336. package/dist/console/index.html +16 -0
  337. package/dist/console/index.js +203 -0
  338. package/dist/console/packs.d.ts +100 -0
  339. package/dist/console/request-guard.d.ts +10 -0
  340. package/dist/console/respond.d.ts +16 -0
  341. package/dist/console/router.d.ts +64 -0
  342. package/dist/console/routes-agents.d.ts +14 -0
  343. package/dist/console/routes-project.d.ts +3 -0
  344. package/dist/console/routes-runs.d.ts +3 -0
  345. package/dist/console/routes-services.d.ts +7 -0
  346. package/dist/console/routes-tools.d.ts +3 -0
  347. package/dist/console/runs.d.ts +69 -0
  348. package/dist/console/scan.d.ts +49 -0
  349. package/dist/console/schema.d.ts +74 -0
  350. package/dist/console/server.d.ts +34 -0
  351. package/dist/console/server.js +43264 -0
  352. package/dist/console/services.d.ts +119 -0
  353. package/dist/console/source.d.ts +23 -0
  354. package/dist/console/status.d.ts +68 -0
  355. package/dist/console/styles.css +1023 -0
  356. package/dist/console/terminals.d.ts +22 -0
  357. package/dist/console/workflow-view.d.ts +153 -0
  358. package/dist/constants.d.ts +5 -1
  359. package/dist/constants.js +56 -167
  360. package/dist/context/index.d.ts +10 -0
  361. package/dist/context/index.js +14 -191
  362. package/dist/coordinator/agent-gate.d.ts +107 -0
  363. package/dist/coordinator/bundle-digest.d.ts +20 -0
  364. package/dist/coordinator/clock-tick.d.ts +4 -0
  365. package/dist/coordinator/effect-receipts.d.ts +10 -0
  366. package/dist/coordinator/errors.d.ts +31 -0
  367. package/dist/coordinator/file-store.d.ts +3 -0
  368. package/dist/coordinator/gate-labeling.d.ts +33 -0
  369. package/dist/coordinator/gate-resolution.d.ts +28 -0
  370. package/dist/coordinator/index.d.ts +12 -0
  371. package/dist/coordinator/index.js +107 -0
  372. package/dist/coordinator/memory-store.d.ts +3 -0
  373. package/dist/coordinator/params.d.ts +18 -0
  374. package/dist/coordinator/run-annotations.d.ts +6 -0
  375. package/dist/coordinator/run-context.d.ts +11 -0
  376. package/dist/coordinator/run-ending.d.ts +5 -0
  377. package/dist/coordinator/run-outcome.d.ts +31 -0
  378. package/dist/coordinator/run-resume.d.ts +6 -0
  379. package/dist/coordinator/run-start.d.ts +4 -0
  380. package/dist/coordinator/run-store.d.ts +275 -0
  381. package/dist/coordinator/run-trace.d.ts +41 -0
  382. package/dist/coordinator/run-views.d.ts +12 -0
  383. package/dist/coordinator/runs-dir.d.ts +26 -0
  384. package/dist/coordinator/store.d.ts +67 -0
  385. package/dist/coordinator/time.d.ts +39 -0
  386. package/dist/coordinator/workflow-selection.d.ts +6 -0
  387. package/dist/deployment/index.d.ts +11 -16
  388. package/dist/deployment/index.js +541 -50
  389. package/dist/deployment/targets/base.d.ts +11 -13
  390. package/dist/deployment/targets/openapi-parts.d.ts +92 -0
  391. package/dist/diagram/arms.d.ts +70 -0
  392. package/dist/diagram/ascii-renderer.d.ts +1 -1
  393. package/dist/diagram/geometry.d.ts +22 -29
  394. package/dist/diagram/graph/bounds.d.ts +30 -0
  395. package/dist/diagram/graph/metrics.d.ts +21 -0
  396. package/dist/diagram/graph/nodes.d.ts +33 -0
  397. package/dist/diagram/graph/placement.d.ts +22 -0
  398. package/dist/diagram/graph/ports.d.ts +23 -0
  399. package/dist/diagram/graph/routing.d.ts +40 -0
  400. package/dist/diagram/graph/scopes.d.ts +30 -0
  401. package/dist/diagram/index.d.ts +15 -23
  402. package/dist/diagram/index.js +632 -111
  403. package/dist/diagram/labels.d.ts +12 -0
  404. package/dist/diagram/lanes.d.ts +93 -0
  405. package/dist/diagram/layout.d.ts +1 -1
  406. package/dist/diagram/material-symbols.d.ts +7 -0
  407. package/dist/diagram/orthogonal-router.d.ts +15 -51
  408. package/dist/diagram/process-view.d.ts +79 -0
  409. package/dist/diagram/spine.d.ts +25 -0
  410. package/dist/diagram/theme.d.ts +3 -5
  411. package/dist/diagram/types.d.ts +6 -20
  412. package/dist/diff/index.js +53 -9
  413. package/dist/diff/types.d.ts +1 -5
  414. package/dist/doc-metadata/extractors/annotations.d.ts +0 -4
  415. package/dist/doc-metadata/extractors/cli-commands.d.ts +2 -1
  416. package/dist/doc-metadata/extractors/core-metadata.d.ts +19 -4
  417. package/dist/doc-metadata/extractors/error-codes.d.ts +1 -1
  418. package/dist/doc-metadata/extractors/mcp-tools.d.ts +7 -3
  419. package/dist/doc-metadata/index.d.ts +1 -2
  420. package/dist/doc-metadata/index.js +2368 -9
  421. package/dist/doc-metadata/types.d.ts +7 -24
  422. package/dist/docs/guide.d.ts +33 -0
  423. package/dist/docs/index.d.ts +7 -4
  424. package/dist/docs/index.js +298 -298
  425. package/dist/docs/pack-topics.d.ts +18 -0
  426. package/dist/editor-completions/annotationValues.d.ts +1 -1
  427. package/dist/editor-completions/contextParser.d.ts +3 -2
  428. package/dist/editor-completions/dataTypes.d.ts +1 -1
  429. package/dist/editor-completions/goToDefinition.d.ts +1 -1
  430. package/dist/editor-completions/index.d.ts +8 -8
  431. package/dist/editor-completions/index.js +1244 -175
  432. package/dist/editor-completions/jsDocAnnotations.d.ts +1 -1
  433. package/dist/editor-completions/modifierCompletions.d.ts +1 -1
  434. package/dist/export/index.d.ts +7 -1
  435. package/dist/generated-branding.js +8 -21
  436. package/dist/generated-version.d.ts +1 -1
  437. package/dist/generated-version.js +7 -3
  438. package/dist/generator/annotation-generator.d.ts +84 -0
  439. package/dist/generator/async-detection.d.ts +1 -1
  440. package/dist/{body-generator.d.ts → generator/body-generator.d.ts} +7 -3
  441. package/dist/generator/code-utils.d.ts +15 -60
  442. package/dist/generator/connection-reads.d.ts +94 -0
  443. package/dist/generator/control-flow-plan.d.ts +74 -0
  444. package/dist/generator/control-flow.d.ts +1 -1
  445. package/dist/generator/exit-assembly.d.ts +11 -0
  446. package/dist/generator/index.d.ts +4 -5
  447. package/dist/generator/index.js +34 -11
  448. package/dist/generator/input-port-values.d.ts +22 -0
  449. package/dist/generator/{scope-function-generator.d.ts → node-arguments.d.ts} +76 -1
  450. package/dist/generator/node-invocation.d.ts +74 -0
  451. package/dist/{node-types-generator.d.ts → generator/node-types-generator.d.ts} +3 -2
  452. package/dist/generator/scope-closure.d.ts +23 -0
  453. package/dist/generator/scoped-child.d.ts +49 -0
  454. package/dist/{sugar-optimizer.d.ts → generator/sugar-optimizer.d.ts} +1 -1
  455. package/dist/generator/unified.d.ts +14 -2
  456. package/dist/generator/workflow-generator.d.ts +37 -0
  457. package/dist/index.d.ts +29 -26
  458. package/dist/index.js +1322 -92
  459. package/dist/jsdoc-port-sync/apply-diff.d.ts +15 -0
  460. package/dist/jsdoc-port-sync/callback-signature.d.ts +17 -0
  461. package/dist/jsdoc-port-sync/diff.d.ts +5 -7
  462. package/dist/jsdoc-port-sync/incomplete-lines.d.ts +41 -0
  463. package/dist/jsdoc-port-sync/index.d.ts +11 -11
  464. package/dist/jsdoc-port-sync/index.js +88 -45
  465. package/dist/jsdoc-port-sync/jsdoc-to-signature.d.ts +66 -0
  466. package/dist/jsdoc-port-sync/port-parser.d.ts +6 -24
  467. package/dist/jsdoc-port-sync/port-tag-placement.d.ts +55 -0
  468. package/dist/jsdoc-port-sync/scoped-ports.d.ts +21 -0
  469. package/dist/jsdoc-port-sync/signature-parser.d.ts +8 -1
  470. package/dist/jsdoc-port-sync/signature-to-jsdoc.d.ts +77 -0
  471. package/dist/jsdoc-port-sync/sync.d.ts +4 -1
  472. package/dist/marketplace/index.d.ts +5 -3
  473. package/dist/marketplace/index.js +62 -10
  474. package/dist/marketplace/install.d.ts +24 -0
  475. package/dist/marketplace/manifest.d.ts +1 -1
  476. package/dist/marketplace/npmrc.d.ts +24 -0
  477. package/dist/marketplace/registry.d.ts +46 -11
  478. package/dist/marketplace/types.d.ts +41 -24
  479. package/dist/marketplace/validator.d.ts +1 -1
  480. package/dist/mcp/debug-session.d.ts +2 -4
  481. package/dist/mcp/dist-imports.d.ts +12 -0
  482. package/dist/mcp/response-utils.d.ts +11 -9
  483. package/dist/mcp/server.d.ts +0 -1
  484. package/dist/mcp/tools-context.d.ts +11 -0
  485. package/dist/mcp/tools-diagram.d.ts +1 -2
  486. package/dist/mcp/tools-export.d.ts +2 -2
  487. package/dist/mcp/tools-marketplace.d.ts +1 -1
  488. package/dist/mcp/tools-run.d.ts +17 -0
  489. package/dist/mcp/tools-workflow.d.ts +3 -0
  490. package/dist/mcp/types.d.ts +4 -14
  491. package/dist/mcp/workflow-executor.d.ts +57 -19
  492. package/dist/npm-packages.d.ts +1 -1
  493. package/dist/npm-packages.js +10 -473
  494. package/dist/parser/annotation-parser.d.ts +88 -0
  495. package/dist/parser/annotation-suggestion.d.ts +23 -0
  496. package/dist/parser/durable-effect-contract.d.ts +10 -0
  497. package/dist/parser/expression-references.d.ts +101 -0
  498. package/dist/parser/external-node-types.d.ts +69 -0
  499. package/dist/{function-like.d.ts → parser/function-like.d.ts} +10 -3
  500. package/dist/parser/generated-sections.d.ts +25 -0
  501. package/dist/parser/import-resolution.d.ts +67 -0
  502. package/dist/parser/import-stub.d.ts +29 -0
  503. package/dist/parser/jsdoc/config-types.d.ts +209 -0
  504. package/dist/parser/jsdoc/graph-tags.d.ts +54 -0
  505. package/dist/parser/jsdoc/node-type-block.d.ts +23 -0
  506. package/dist/parser/jsdoc/parse-line-once.d.ts +11 -0
  507. package/dist/parser/jsdoc/port-tags.d.ts +42 -0
  508. package/dist/parser/jsdoc/runtime-tags.d.ts +65 -0
  509. package/dist/parser/jsdoc/signature-types.d.ts +52 -0
  510. package/dist/parser/jsdoc/workflow-block.d.ts +22 -0
  511. package/dist/parser/jsdoc-parser.d.ts +23 -0
  512. package/dist/parser/macro-expansion.d.ts +80 -0
  513. package/dist/parser/module-resolution.d.ts +38 -0
  514. package/dist/parser/node-inference.d.ts +39 -0
  515. package/dist/parser/npm-node-types.d.ts +24 -0
  516. package/dist/parser/pack-handlers.d.ts +12 -0
  517. package/dist/parser/path-data-resolution.d.ts +75 -0
  518. package/dist/parser/port-inference.d.ts +15 -0
  519. package/dist/{resolve-package-types.d.ts → parser/resolve-package-types.d.ts} +4 -0
  520. package/dist/parser/serialize-deploy-annotations.d.ts +19 -0
  521. package/dist/parser/tag-registry.d.ts +22 -0
  522. package/dist/parser/workflow-extraction.d.ts +39 -0
  523. package/dist/runtime/ExecutionContext.d.ts +87 -99
  524. package/dist/runtime/continuation-core.d.ts +147 -0
  525. package/dist/runtime/continuation.d.ts +48 -0
  526. package/dist/runtime/debug-controller.d.ts +7 -22
  527. package/dist/runtime/durable-execution.d.ts +176 -0
  528. package/dist/runtime/events.d.ts +16 -1
  529. package/dist/runtime/executable-module-contract.d.ts +16 -0
  530. package/dist/runtime/index.d.ts +13 -10
  531. package/dist/runtime/index.js +947 -9
  532. package/dist/runtime/strict-json.d.ts +15 -0
  533. package/dist/server/access.d.ts +12 -0
  534. package/dist/server/api.d.ts +126 -0
  535. package/dist/server/callback-delivery.d.ts +62 -0
  536. package/dist/server/callback-url.d.ts +44 -0
  537. package/dist/server/context.d.ts +35 -0
  538. package/dist/server/http-error.d.ts +10 -0
  539. package/dist/server/index.d.ts +7 -1
  540. package/dist/server/index.js +125 -6
  541. package/dist/server/openapi-document.d.ts +33 -0
  542. package/dist/server/openapi.d.ts +32 -0
  543. package/dist/server/respond.d.ts +35 -0
  544. package/dist/server/route-params.d.ts +17 -0
  545. package/dist/server/route-plan.d.ts +41 -0
  546. package/dist/server/routes-catalog.d.ts +5 -0
  547. package/dist/server/routes-declared.d.ts +12 -0
  548. package/dist/server/routes-runs.d.ts +8 -0
  549. package/dist/server/run-driver.d.ts +58 -0
  550. package/dist/server/run-view.d.ts +26 -0
  551. package/dist/server/transport.d.ts +35 -0
  552. package/dist/server/types.d.ts +143 -52
  553. package/dist/server/webhook-server.d.ts +12 -38
  554. package/dist/server/workflow-registry.d.ts +7 -4
  555. package/dist/service-registry.d.ts +49 -0
  556. package/dist/service-registry.js +123 -0
  557. package/dist/testing/assertions.d.ts +2 -2
  558. package/dist/testing/index.d.ts +14 -13
  559. package/dist/testing/index.js +582 -24
  560. package/dist/testing/mock-approval.d.ts +3 -5
  561. package/dist/testing/mock-llm.d.ts +2 -3
  562. package/dist/testing/recorder.d.ts +5 -6
  563. package/dist/testing/replayer.d.ts +6 -7
  564. package/dist/testing/run-store-check.d.ts +3 -0
  565. package/dist/testing/token-tracker.d.ts +2 -2
  566. package/dist/{type-mappings.d.ts → types/type-mappings.d.ts} +13 -1
  567. package/dist/utils/error-utils.d.ts +4 -2
  568. package/dist/utils/port-ordering.d.ts +2 -2
  569. package/dist/utils/port-tag-utils.d.ts +1 -1
  570. package/dist/validation/agent-detection.d.ts +17 -5
  571. package/dist/validation/agent-rules.d.ts +6 -7
  572. package/dist/validation/core-rules.d.ts +49 -0
  573. package/dist/validation/design-rules.d.ts +9 -3
  574. package/dist/validation/rule-registry.d.ts +3 -3
  575. package/dist/validation/rules/connections.d.ts +27 -0
  576. package/dist/validation/rules/context.d.ts +11 -0
  577. package/dist/validation/rules/cycles.d.ts +17 -0
  578. package/dist/validation/rules/data-flow.d.ts +19 -0
  579. package/dist/validation/rules/scope-topology.d.ts +35 -0
  580. package/dist/validation/rules/type-compatibility.d.ts +30 -0
  581. package/dist/validation/type-checker.d.ts +39 -0
  582. package/dist/validation/validator-helpers.d.ts +31 -0
  583. package/dist/validation/validator.d.ts +30 -0
  584. package/docs/reference/advanced-annotations.md +277 -60
  585. package/docs/reference/built-in-nodes.md +164 -94
  586. package/docs/reference/cancellation.md +44 -0
  587. package/docs/reference/cli-reference.md +252 -234
  588. package/docs/reference/compilation.md +36 -109
  589. package/docs/reference/concepts.md +80 -63
  590. package/docs/reference/console.md +169 -0
  591. package/docs/reference/debugging.md +26 -57
  592. package/docs/reference/deployment.md +217 -143
  593. package/docs/reference/durable-gates.md +445 -0
  594. package/docs/reference/error-codes.md +90 -43
  595. package/docs/reference/export-interface.md +91 -26
  596. package/docs/reference/iterative-development.md +50 -28
  597. package/docs/reference/jsdoc-grammar.md +66 -311
  598. package/docs/reference/library.md +250 -0
  599. package/docs/reference/marketplace.md +301 -152
  600. package/docs/reference/mcp-tools.md +102 -0
  601. package/docs/reference/node-conversion.md +84 -59
  602. package/docs/reference/orientation.md +68 -0
  603. package/docs/reference/scaffold.md +5 -4
  604. package/docs/reference/tutorial.md +106 -166
  605. package/docs/reference/visual-reference.md +1 -1
  606. package/package.json +85 -50
  607. package/dist/agent/agent-loop.js +0 -156
  608. package/dist/agent/cli-spawn-config.js +0 -65
  609. package/dist/agent/device-connection.d.ts +0 -79
  610. package/dist/agent/device-connection.js +0 -184
  611. package/dist/agent/env-allowlist.js +0 -60
  612. package/dist/agent/providers/anthropic.js +0 -198
  613. package/dist/agent/providers/claude-cli.js +0 -161
  614. package/dist/agent/providers/openai-compat.js +0 -205
  615. package/dist/agent/providers/platform.d.ts +0 -23
  616. package/dist/agent/providers/platform.js +0 -132
  617. package/dist/agent/streaming.js +0 -186
  618. package/dist/agent/types.js +0 -20
  619. package/dist/annotation-generator.d.ts +0 -50
  620. package/dist/annotation-generator.js +0 -743
  621. package/dist/api/builder.js +0 -345
  622. package/dist/api/command-runner.js +0 -787
  623. package/dist/api/compile.js +0 -148
  624. package/dist/api/extract-types.js +0 -57
  625. package/dist/api/generate-in-place.js +0 -1477
  626. package/dist/api/generate.js +0 -514
  627. package/dist/api/helpers.js +0 -285
  628. package/dist/api/inline-runtime.js +0 -526
  629. package/dist/api/manipulation/connections.js +0 -151
  630. package/dist/api/manipulation/index.js +0 -41
  631. package/dist/api/manipulation/node-types.js +0 -200
  632. package/dist/api/manipulation/nodes.js +0 -355
  633. package/dist/api/manipulation/ports.js +0 -228
  634. package/dist/api/manipulation/scopes.js +0 -156
  635. package/dist/api/manipulation/workflow.js +0 -116
  636. package/dist/api/modify-operation.js +0 -177
  637. package/dist/api/parse.js +0 -115
  638. package/dist/api/patterns.d.ts +0 -112
  639. package/dist/api/patterns.js +0 -303
  640. package/dist/api/query.js +0 -840
  641. package/dist/api/templates.js +0 -117
  642. package/dist/api/transform.js +0 -40
  643. package/dist/api/validate.js +0 -64
  644. package/dist/api/validation-registry.js +0 -10
  645. package/dist/api/workflow-file-operations.js +0 -180
  646. package/dist/ast/builder.js +0 -395
  647. package/dist/ast/serialization-node.js +0 -30
  648. package/dist/ast/serialization.js +0 -134
  649. package/dist/ast/types.js +0 -2
  650. package/dist/ast/workflow-utils.js +0 -114
  651. package/dist/body-generator.js +0 -35
  652. package/dist/built-in-nodes/coercion-types.js +0 -61
  653. package/dist/built-in-nodes/delay.js +0 -29
  654. package/dist/built-in-nodes/generated-registry.js +0 -299
  655. package/dist/built-in-nodes/invoke-workflow.js +0 -36
  656. package/dist/built-in-nodes/mock-types.js +0 -42
  657. package/dist/built-in-nodes/wait-for-agent.js +0 -31
  658. package/dist/built-in-nodes/wait-for-event.js +0 -25
  659. package/dist/chevrotain-parser/coerce-parser.js +0 -103
  660. package/dist/chevrotain-parser/connect-parser.js +0 -136
  661. package/dist/chevrotain-parser/fan-parser.js +0 -149
  662. package/dist/chevrotain-parser/grammar-diagrams.js +0 -273
  663. package/dist/chevrotain-parser/index.js +0 -31
  664. package/dist/chevrotain-parser/map-parser.js +0 -130
  665. package/dist/chevrotain-parser/node-parser.js +0 -558
  666. package/dist/chevrotain-parser/path-parser.js +0 -140
  667. package/dist/chevrotain-parser/port-parser.js +0 -519
  668. package/dist/chevrotain-parser/position-parser.d.ts +0 -20
  669. package/dist/chevrotain-parser/position-parser.js +0 -83
  670. package/dist/chevrotain-parser/scope-parser.js +0 -104
  671. package/dist/chevrotain-parser/tokens.js +0 -429
  672. package/dist/chevrotain-parser/trigger-cancel-parser.js +0 -291
  673. package/dist/cli/commands/account.d.ts +0 -4
  674. package/dist/cli/commands/account.js +0 -50
  675. package/dist/cli/commands/ai-credentials.d.ts +0 -12
  676. package/dist/cli/commands/ai-credentials.js +0 -95
  677. package/dist/cli/commands/apikey.d.ts +0 -4
  678. package/dist/cli/commands/apikey.js +0 -64
  679. package/dist/cli/commands/auth.d.ts +0 -9
  680. package/dist/cli/commands/auth.js +0 -255
  681. package/dist/cli/commands/compile.js +0 -331
  682. package/dist/cli/commands/connect.d.ts +0 -4
  683. package/dist/cli/commands/connect.js +0 -163
  684. package/dist/cli/commands/context.js +0 -51
  685. package/dist/cli/commands/create.js +0 -139
  686. package/dist/cli/commands/deploy.d.ts +0 -6
  687. package/dist/cli/commands/deploy.js +0 -74
  688. package/dist/cli/commands/dev.js +0 -227
  689. package/dist/cli/commands/diagram.js +0 -39
  690. package/dist/cli/commands/diff.js +0 -57
  691. package/dist/cli/commands/docs.js +0 -74
  692. package/dist/cli/commands/export.js +0 -153
  693. package/dist/cli/commands/grammar.js +0 -40
  694. package/dist/cli/commands/implement.js +0 -91
  695. package/dist/cli/commands/init-personas.js +0 -541
  696. package/dist/cli/commands/init.js +0 -797
  697. package/dist/cli/commands/market.js +0 -440
  698. package/dist/cli/commands/mcp-setup.js +0 -433
  699. package/dist/cli/commands/migrate.js +0 -91
  700. package/dist/cli/commands/modify.js +0 -58
  701. package/dist/cli/commands/openapi.js +0 -71
  702. package/dist/cli/commands/org.d.ts +0 -8
  703. package/dist/cli/commands/org.js +0 -136
  704. package/dist/cli/commands/pattern.d.ts +0 -34
  705. package/dist/cli/commands/pattern.js +0 -186
  706. package/dist/cli/commands/plugin.d.ts +0 -16
  707. package/dist/cli/commands/plugin.js +0 -176
  708. package/dist/cli/commands/run.js +0 -742
  709. package/dist/cli/commands/serve.js +0 -93
  710. package/dist/cli/commands/status.js +0 -123
  711. package/dist/cli/commands/strip.js +0 -61
  712. package/dist/cli/commands/templates.js +0 -58
  713. package/dist/cli/commands/validate.js +0 -267
  714. package/dist/cli/commands/watch.js +0 -71
  715. package/dist/cli/config/credentials.d.ts +0 -15
  716. package/dist/cli/config/credentials.js +0 -43
  717. package/dist/cli/config/platform-client.d.ts +0 -123
  718. package/dist/cli/config/platform-client.js +0 -248
  719. package/dist/cli/env-setup.js +0 -12
  720. package/dist/cli/index.js +0 -850
  721. package/dist/cli/pack-commands.js +0 -122
  722. package/dist/cli/postinstall.d.ts +0 -16
  723. package/dist/cli/postinstall.js +0 -119
  724. package/dist/cli/templates/ai/mock-provider.js +0 -64
  725. package/dist/cli/templates/ai/types.js +0 -5
  726. package/dist/cli/templates/approvals/index.d.ts +0 -15
  727. package/dist/cli/templates/approvals/index.js +0 -241
  728. package/dist/cli/templates/index.js +0 -123
  729. package/dist/cli/templates/nodes/agent-router.js +0 -114
  730. package/dist/cli/templates/nodes/aggregator.js +0 -63
  731. package/dist/cli/templates/nodes/conversation-memory.js +0 -85
  732. package/dist/cli/templates/nodes/http.js +0 -80
  733. package/dist/cli/templates/nodes/human-approval.js +0 -109
  734. package/dist/cli/templates/nodes/json-extractor.js +0 -119
  735. package/dist/cli/templates/nodes/llm-call.js +0 -106
  736. package/dist/cli/templates/nodes/prompt-template.js +0 -52
  737. package/dist/cli/templates/nodes/rag-retriever.js +0 -128
  738. package/dist/cli/templates/nodes/tool-executor.js +0 -108
  739. package/dist/cli/templates/nodes/transformer.js +0 -68
  740. package/dist/cli/templates/nodes/validator.js +0 -62
  741. package/dist/cli/templates/pack-loader.js +0 -58
  742. package/dist/cli/templates/providers/index.js +0 -239
  743. package/dist/cli/templates/shared/approval-types.js +0 -31
  744. package/dist/cli/templates/shared/llm-types.js +0 -109
  745. package/dist/cli/templates/workflows/aggregator.js +0 -101
  746. package/dist/cli/templates/workflows/ai-agent.js +0 -326
  747. package/dist/cli/templates/workflows/ai-chat.js +0 -167
  748. package/dist/cli/templates/workflows/ai-rag.js +0 -184
  749. package/dist/cli/templates/workflows/ai-react.js +0 -293
  750. package/dist/cli/templates/workflows/conditional.js +0 -139
  751. package/dist/cli/templates/workflows/error-handler.js +0 -145
  752. package/dist/cli/templates/workflows/foreach.js +0 -140
  753. package/dist/cli/templates/workflows/sequential.js +0 -200
  754. package/dist/cli/templates/workflows/webhook.js +0 -158
  755. package/dist/cli/utils/cli-helpers.d.ts +0 -44
  756. package/dist/cli/utils/cli-helpers.js +0 -99
  757. package/dist/cli/utils/logger.js +0 -126
  758. package/dist/cli/utils/parse-int-strict.js +0 -17
  759. package/dist/cli/utils/safe-write.js +0 -54
  760. package/dist/deployment/config/defaults.d.ts +0 -29
  761. package/dist/deployment/config/defaults.js +0 -98
  762. package/dist/deployment/config/loader.d.ts +0 -24
  763. package/dist/deployment/config/loader.js +0 -237
  764. package/dist/deployment/config/types.d.ts +0 -117
  765. package/dist/deployment/config/types.js +0 -5
  766. package/dist/deployment/core/adapters.d.ts +0 -66
  767. package/dist/deployment/core/adapters.js +0 -156
  768. package/dist/deployment/core/executor.d.ts +0 -62
  769. package/dist/deployment/core/executor.js +0 -197
  770. package/dist/deployment/core/formatters.d.ts +0 -42
  771. package/dist/deployment/core/formatters.js +0 -146
  772. package/dist/deployment/openapi/generator.d.ts +0 -146
  773. package/dist/deployment/openapi/generator.js +0 -347
  774. package/dist/deployment/openapi/schema-converter.d.ts +0 -49
  775. package/dist/deployment/openapi/schema-converter.js +0 -192
  776. package/dist/deployment/targets/base.js +0 -855
  777. package/dist/deployment/types.d.ts +0 -140
  778. package/dist/deployment/types.js +0 -8
  779. package/dist/diagram/ascii-renderer.js +0 -528
  780. package/dist/diagram/geometry.js +0 -1267
  781. package/dist/diagram/html-viewer.d.ts +0 -21
  782. package/dist/diagram/html-viewer.js +0 -1689
  783. package/dist/diagram/layout.js +0 -143
  784. package/dist/diagram/orthogonal-router.js +0 -568
  785. package/dist/diagram/renderer.d.ts +0 -3
  786. package/dist/diagram/renderer.js +0 -266
  787. package/dist/diagram/theme.js +0 -282
  788. package/dist/diagram/types.js +0 -2
  789. package/dist/diff/WorkflowDiffer.js +0 -429
  790. package/dist/diff/formatDiff.js +0 -239
  791. package/dist/diff/impact.js +0 -119
  792. package/dist/diff/types.js +0 -35
  793. package/dist/doc-metadata/extractors/annotations.js +0 -638
  794. package/dist/doc-metadata/extractors/cli-commands.js +0 -326
  795. package/dist/doc-metadata/extractors/core-metadata.js +0 -61
  796. package/dist/doc-metadata/extractors/error-codes.js +0 -372
  797. package/dist/doc-metadata/extractors/grammar-rules.js +0 -51
  798. package/dist/doc-metadata/extractors/mcp-tools.js +0 -705
  799. package/dist/doc-metadata/extractors/plugin-api.d.ts +0 -19
  800. package/dist/doc-metadata/extractors/plugin-api.js +0 -279
  801. package/dist/doc-metadata/types.js +0 -5
  802. package/dist/editor-completions/annotationValues.js +0 -146
  803. package/dist/editor-completions/contextParser.js +0 -410
  804. package/dist/editor-completions/dataTypes.js +0 -95
  805. package/dist/editor-completions/goToDefinition.js +0 -112
  806. package/dist/editor-completions/jsDocAnnotations.js +0 -359
  807. package/dist/editor-completions/modifierCompletions.js +0 -197
  808. package/dist/editor-completions/types.js +0 -8
  809. package/dist/export/index.js +0 -212
  810. package/dist/extensions/index.d.ts +0 -16
  811. package/dist/extensions/index.js +0 -17
  812. package/dist/friendly-errors.js +0 -761
  813. package/dist/function-like.js +0 -84
  814. package/dist/generator/async-detection.js +0 -56
  815. package/dist/generator/code-utils.js +0 -551
  816. package/dist/generator/compile-target-registry.d.ts +0 -20
  817. package/dist/generator/compile-target-registry.js +0 -20
  818. package/dist/generator/control-flow.js +0 -358
  819. package/dist/generator/dev-mode-registry.d.ts +0 -27
  820. package/dist/generator/dev-mode-registry.js +0 -20
  821. package/dist/generator/scope-function-generator.js +0 -397
  822. package/dist/generator/unified.js +0 -1831
  823. package/dist/generator.d.ts +0 -54
  824. package/dist/generator.js +0 -101
  825. package/dist/jsdoc-parser.d.ts +0 -377
  826. package/dist/jsdoc-parser.js +0 -1189
  827. package/dist/jsdoc-port-sync/constants.js +0 -103
  828. package/dist/jsdoc-port-sync/diff.js +0 -319
  829. package/dist/jsdoc-port-sync/port-parser.js +0 -579
  830. package/dist/jsdoc-port-sync/rename.js +0 -256
  831. package/dist/jsdoc-port-sync/signature-parser.js +0 -559
  832. package/dist/jsdoc-port-sync/sync.js +0 -653
  833. package/dist/marketplace/manifest.js +0 -194
  834. package/dist/marketplace/registry.js +0 -198
  835. package/dist/marketplace/types.js +0 -9
  836. package/dist/marketplace/validator.js +0 -150
  837. package/dist/mcp/agent-channel.d.ts +0 -35
  838. package/dist/mcp/agent-channel.js +0 -61
  839. package/dist/mcp/auto-registration.d.ts +0 -3
  840. package/dist/mcp/auto-registration.js +0 -62
  841. package/dist/mcp/debug-session.js +0 -25
  842. package/dist/mcp/index.d.ts +0 -11
  843. package/dist/mcp/index.js +0 -10
  844. package/dist/mcp/pack-tools.js +0 -59
  845. package/dist/mcp/prompts.js +0 -68
  846. package/dist/mcp/response-utils.js +0 -97
  847. package/dist/mcp/run-registry.d.ts +0 -29
  848. package/dist/mcp/run-registry.js +0 -24
  849. package/dist/mcp/server.js +0 -63
  850. package/dist/mcp/tools-context.js +0 -51
  851. package/dist/mcp/tools-debug.js +0 -451
  852. package/dist/mcp/tools-diagram.js +0 -97
  853. package/dist/mcp/tools-docs.js +0 -62
  854. package/dist/mcp/tools-export.js +0 -222
  855. package/dist/mcp/tools-marketplace.js +0 -132
  856. package/dist/mcp/tools-model.d.ts +0 -3
  857. package/dist/mcp/tools-model.js +0 -279
  858. package/dist/mcp/tools-pattern.d.ts +0 -3
  859. package/dist/mcp/tools-pattern.js +0 -604
  860. package/dist/mcp/tools-query.js +0 -377
  861. package/dist/mcp/tools-resources.js +0 -41
  862. package/dist/mcp/tools-template.js +0 -119
  863. package/dist/mcp/tools-workflow-run.d.ts +0 -40
  864. package/dist/mcp/tools-workflow-run.js +0 -150
  865. package/dist/mcp/types.js +0 -2
  866. package/dist/mcp/workflow-executor.js +0 -242
  867. package/dist/migration/registry.js +0 -29
  868. package/dist/node-types-generator.js +0 -139
  869. package/dist/parser/tag-registry.js +0 -57
  870. package/dist/parser.d.ts +0 -232
  871. package/dist/parser.js +0 -2500
  872. package/dist/plugin/PluginPanel.d.ts +0 -12
  873. package/dist/plugin/PluginPanel.js +0 -5
  874. package/dist/plugin/index.d.ts +0 -13
  875. package/dist/plugin/index.js +0 -14
  876. package/dist/plugin/types.d.ts +0 -75
  877. package/dist/plugin/types.js +0 -8
  878. package/dist/resolve-package-types.js +0 -123
  879. package/dist/runtime/CancellationError.js +0 -20
  880. package/dist/runtime/ExecutionContext.js +0 -280
  881. package/dist/runtime/builtin-functions.js +0 -549
  882. package/dist/runtime/checkpoint.d.ts +0 -84
  883. package/dist/runtime/checkpoint.js +0 -225
  884. package/dist/runtime/debug-controller.js +0 -247
  885. package/dist/runtime/events.js +0 -2
  886. package/dist/runtime/function-registry.js +0 -66
  887. package/dist/runtime/parameter-resolver.js +0 -113
  888. package/dist/server/types.js +0 -5
  889. package/dist/server/webhook-server.js +0 -269
  890. package/dist/server/workflow-registry.js +0 -202
  891. package/dist/shared-project.js +0 -28
  892. package/dist/sugar-optimizer.js +0 -498
  893. package/dist/testing/assertions.js +0 -127
  894. package/dist/testing/mock-approval.js +0 -98
  895. package/dist/testing/mock-llm.js +0 -119
  896. package/dist/testing/recorder.js +0 -70
  897. package/dist/testing/replayer.js +0 -143
  898. package/dist/testing/token-tracker.js +0 -94
  899. package/dist/type-checker.d.ts +0 -42
  900. package/dist/type-checker.js +0 -190
  901. package/dist/type-mappings.js +0 -131
  902. package/dist/types/branded-ports.d.ts +0 -151
  903. package/dist/types/branded-ports.js +0 -121
  904. package/dist/types/index.d.ts +0 -5
  905. package/dist/types/index.js +0 -5
  906. package/dist/types.d.ts +0 -139
  907. package/dist/types.js +0 -15
  908. package/dist/utils/error-utils.js +0 -27
  909. package/dist/utils/lru-cache.js +0 -40
  910. package/dist/utils/port-ordering.js +0 -81
  911. package/dist/utils/port-tag-utils.js +0 -41
  912. package/dist/utils/string-distance.js +0 -56
  913. package/dist/validation/agent-detection.js +0 -115
  914. package/dist/validation/agent-rules.js +0 -262
  915. package/dist/validation/design-rules.js +0 -377
  916. package/dist/validation/rule-registry.js +0 -37
  917. package/dist/validator.d.ts +0 -113
  918. package/dist/validator.js +0 -1631
  919. package/docs/reference/patterns.md +0 -159
  920. package/scripts/postinstall.cjs +0 -86
  921. /package/dist/{shared-project.d.ts → parser/shared-project.d.ts} +0 -0
  922. /package/dist/{friendly-errors.d.ts → validation/friendly-errors.d.ts} +0 -0
@@ -0,0 +1,2811 @@
1
+ import { createRequire as __createRequire } from "module";
2
+ const require = __createRequire(import.meta.url);
3
+ import {
4
+ INLINE_ENGINE_EXPORTS,
5
+ bodyGenerator,
6
+ extractExitPorts,
7
+ generateInPlace,
8
+ generateInlineRuntime,
9
+ graphIdentity,
10
+ hasBranching,
11
+ stripTypeScript,
12
+ validateWorkflowAsync
13
+ } from "./flow-weaver-chunk-A6M5K3W7.mjs";
14
+ import {
15
+ parseWorkflow
16
+ } from "./flow-weaver-chunk-W3YNK26P.mjs";
17
+ import {
18
+ VERSION
19
+ } from "./flow-weaver-chunk-VXWNLYQU.mjs";
20
+ import {
21
+ validateDurableClosure
22
+ } from "./flow-weaver-chunk-EM5HWQ4R.mjs";
23
+ import {
24
+ mapToTypeScript
25
+ } from "./flow-weaver-chunk-APX6MQ5A.mjs";
26
+ import {
27
+ __commonJS,
28
+ __require,
29
+ __toESM
30
+ } from "./flow-weaver-chunk-N767YRAI.mjs";
31
+
32
+ // node_modules/source-map/lib/base64.js
33
+ var require_base64 = __commonJS({
34
+ "node_modules/source-map/lib/base64.js"(exports) {
35
+ var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
36
+ exports.encode = function(number) {
37
+ if (0 <= number && number < intToCharMap.length) {
38
+ return intToCharMap[number];
39
+ }
40
+ throw new TypeError("Must be between 0 and 63: " + number);
41
+ };
42
+ }
43
+ });
44
+
45
+ // node_modules/source-map/lib/base64-vlq.js
46
+ var require_base64_vlq = __commonJS({
47
+ "node_modules/source-map/lib/base64-vlq.js"(exports) {
48
+ var base64 = require_base64();
49
+ var VLQ_BASE_SHIFT = 5;
50
+ var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
51
+ var VLQ_BASE_MASK = VLQ_BASE - 1;
52
+ var VLQ_CONTINUATION_BIT = VLQ_BASE;
53
+ function toVLQSigned(aValue) {
54
+ return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
55
+ }
56
+ exports.encode = function base64VLQ_encode(aValue) {
57
+ let encoded = "";
58
+ let digit;
59
+ let vlq = toVLQSigned(aValue);
60
+ do {
61
+ digit = vlq & VLQ_BASE_MASK;
62
+ vlq >>>= VLQ_BASE_SHIFT;
63
+ if (vlq > 0) {
64
+ digit |= VLQ_CONTINUATION_BIT;
65
+ }
66
+ encoded += base64.encode(digit);
67
+ } while (vlq > 0);
68
+ return encoded;
69
+ };
70
+ }
71
+ });
72
+
73
+ // node_modules/source-map/lib/url.js
74
+ var require_url = __commonJS({
75
+ "node_modules/source-map/lib/url.js"(exports, module) {
76
+ "use strict";
77
+ module.exports = typeof URL === "function" ? URL : __require("url").URL;
78
+ }
79
+ });
80
+
81
+ // node_modules/source-map/lib/util.js
82
+ var require_util = __commonJS({
83
+ "node_modules/source-map/lib/util.js"(exports) {
84
+ var URL2 = require_url();
85
+ function getArg(aArgs, aName, aDefaultValue) {
86
+ if (aName in aArgs) {
87
+ return aArgs[aName];
88
+ } else if (arguments.length === 3) {
89
+ return aDefaultValue;
90
+ }
91
+ throw new Error('"' + aName + '" is a required argument.');
92
+ }
93
+ exports.getArg = getArg;
94
+ var supportsNullProto = (function() {
95
+ const obj = /* @__PURE__ */ Object.create(null);
96
+ return !("__proto__" in obj);
97
+ })();
98
+ function identity(s) {
99
+ return s;
100
+ }
101
+ function toSetString(aStr) {
102
+ if (isProtoString(aStr)) {
103
+ return "$" + aStr;
104
+ }
105
+ return aStr;
106
+ }
107
+ exports.toSetString = supportsNullProto ? identity : toSetString;
108
+ function fromSetString(aStr) {
109
+ if (isProtoString(aStr)) {
110
+ return aStr.slice(1);
111
+ }
112
+ return aStr;
113
+ }
114
+ exports.fromSetString = supportsNullProto ? identity : fromSetString;
115
+ function isProtoString(s) {
116
+ if (!s) {
117
+ return false;
118
+ }
119
+ const length = s.length;
120
+ if (length < 9) {
121
+ return false;
122
+ }
123
+ if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) {
124
+ return false;
125
+ }
126
+ for (let i = length - 10; i >= 0; i--) {
127
+ if (s.charCodeAt(i) !== 36) {
128
+ return false;
129
+ }
130
+ }
131
+ return true;
132
+ }
133
+ function strcmp(aStr1, aStr2) {
134
+ if (aStr1 === aStr2) {
135
+ return 0;
136
+ }
137
+ if (aStr1 === null) {
138
+ return 1;
139
+ }
140
+ if (aStr2 === null) {
141
+ return -1;
142
+ }
143
+ if (aStr1 > aStr2) {
144
+ return 1;
145
+ }
146
+ return -1;
147
+ }
148
+ function compareByGeneratedPositionsInflated(mappingA, mappingB) {
149
+ let cmp = mappingA.generatedLine - mappingB.generatedLine;
150
+ if (cmp !== 0) {
151
+ return cmp;
152
+ }
153
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
154
+ if (cmp !== 0) {
155
+ return cmp;
156
+ }
157
+ cmp = strcmp(mappingA.source, mappingB.source);
158
+ if (cmp !== 0) {
159
+ return cmp;
160
+ }
161
+ cmp = mappingA.originalLine - mappingB.originalLine;
162
+ if (cmp !== 0) {
163
+ return cmp;
164
+ }
165
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
166
+ if (cmp !== 0) {
167
+ return cmp;
168
+ }
169
+ return strcmp(mappingA.name, mappingB.name);
170
+ }
171
+ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
172
+ function parseSourceMapInput(str) {
173
+ return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
174
+ }
175
+ exports.parseSourceMapInput = parseSourceMapInput;
176
+ var PROTOCOL = "http:";
177
+ var PROTOCOL_AND_HOST = `${PROTOCOL}//host`;
178
+ function createSafeHandler(cb) {
179
+ return (input) => {
180
+ const type = getURLType(input);
181
+ const base = buildSafeBase(input);
182
+ const url = new URL2(input, base);
183
+ cb(url);
184
+ const result = url.toString();
185
+ if (type === "absolute") {
186
+ return result;
187
+ } else if (type === "scheme-relative") {
188
+ return result.slice(PROTOCOL.length);
189
+ } else if (type === "path-absolute") {
190
+ return result.slice(PROTOCOL_AND_HOST.length);
191
+ }
192
+ return computeRelativeURL(base, result);
193
+ };
194
+ }
195
+ function withBase(url, base) {
196
+ return new URL2(url, base).toString();
197
+ }
198
+ function buildUniqueSegment(prefix, str) {
199
+ let id = 0;
200
+ do {
201
+ const ident = prefix + id++;
202
+ if (str.indexOf(ident) === -1) return ident;
203
+ } while (true);
204
+ }
205
+ function buildSafeBase(str) {
206
+ const maxDotParts = str.split("..").length - 1;
207
+ const segment = buildUniqueSegment("p", str);
208
+ let base = `${PROTOCOL_AND_HOST}/`;
209
+ for (let i = 0; i < maxDotParts; i++) {
210
+ base += `${segment}/`;
211
+ }
212
+ return base;
213
+ }
214
+ var ABSOLUTE_SCHEME = /^[A-Za-z0-9\+\-\.]+:/;
215
+ function getURLType(url) {
216
+ if (url[0] === "/") {
217
+ if (url[1] === "/") return "scheme-relative";
218
+ return "path-absolute";
219
+ }
220
+ return ABSOLUTE_SCHEME.test(url) ? "absolute" : "path-relative";
221
+ }
222
+ function computeRelativeURL(rootURL, targetURL) {
223
+ if (typeof rootURL === "string") rootURL = new URL2(rootURL);
224
+ if (typeof targetURL === "string") targetURL = new URL2(targetURL);
225
+ const targetParts = targetURL.pathname.split("/");
226
+ const rootParts = rootURL.pathname.split("/");
227
+ if (rootParts.length > 0 && !rootParts[rootParts.length - 1]) {
228
+ rootParts.pop();
229
+ }
230
+ while (targetParts.length > 0 && rootParts.length > 0 && targetParts[0] === rootParts[0]) {
231
+ targetParts.shift();
232
+ rootParts.shift();
233
+ }
234
+ const relativePath = rootParts.map(() => "..").concat(targetParts).join("/");
235
+ return relativePath + targetURL.search + targetURL.hash;
236
+ }
237
+ var ensureDirectory = createSafeHandler((url) => {
238
+ url.pathname = url.pathname.replace(/\/?$/, "/");
239
+ });
240
+ var trimFilename = createSafeHandler((url) => {
241
+ url.href = new URL2(".", url.toString()).toString();
242
+ });
243
+ var normalize = createSafeHandler((url) => {
244
+ });
245
+ exports.normalize = normalize;
246
+ function join2(aRoot, aPath) {
247
+ const pathType = getURLType(aPath);
248
+ const rootType = getURLType(aRoot);
249
+ aRoot = ensureDirectory(aRoot);
250
+ if (pathType === "absolute") {
251
+ return withBase(aPath, void 0);
252
+ }
253
+ if (rootType === "absolute") {
254
+ return withBase(aPath, aRoot);
255
+ }
256
+ if (pathType === "scheme-relative") {
257
+ return normalize(aPath);
258
+ }
259
+ if (rootType === "scheme-relative") {
260
+ return withBase(aPath, withBase(aRoot, PROTOCOL_AND_HOST)).slice(
261
+ PROTOCOL.length
262
+ );
263
+ }
264
+ if (pathType === "path-absolute") {
265
+ return normalize(aPath);
266
+ }
267
+ if (rootType === "path-absolute") {
268
+ return withBase(aPath, withBase(aRoot, PROTOCOL_AND_HOST)).slice(
269
+ PROTOCOL_AND_HOST.length
270
+ );
271
+ }
272
+ const base = buildSafeBase(aPath + aRoot);
273
+ const newPath = withBase(aPath, withBase(aRoot, base));
274
+ return computeRelativeURL(base, newPath);
275
+ }
276
+ exports.join = join2;
277
+ function relative(rootURL, targetURL) {
278
+ const result = relativeIfPossible(rootURL, targetURL);
279
+ return typeof result === "string" ? result : normalize(targetURL);
280
+ }
281
+ exports.relative = relative;
282
+ function relativeIfPossible(rootURL, targetURL) {
283
+ const urlType = getURLType(rootURL);
284
+ if (urlType !== getURLType(targetURL)) {
285
+ return null;
286
+ }
287
+ const base = buildSafeBase(rootURL + targetURL);
288
+ const root = new URL2(rootURL, base);
289
+ const target = new URL2(targetURL, base);
290
+ try {
291
+ new URL2("", target.toString());
292
+ } catch (err) {
293
+ return null;
294
+ }
295
+ if (target.protocol !== root.protocol || target.user !== root.user || target.password !== root.password || target.hostname !== root.hostname || target.port !== root.port) {
296
+ return null;
297
+ }
298
+ return computeRelativeURL(root, target);
299
+ }
300
+ function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
301
+ if (sourceRoot && getURLType(sourceURL) === "path-absolute") {
302
+ sourceURL = sourceURL.replace(/^\//, "");
303
+ }
304
+ let url = normalize(sourceURL || "");
305
+ if (sourceRoot) url = join2(sourceRoot, url);
306
+ if (sourceMapURL) url = join2(trimFilename(sourceMapURL), url);
307
+ return url;
308
+ }
309
+ exports.computeSourceURL = computeSourceURL;
310
+ }
311
+ });
312
+
313
+ // node_modules/source-map/lib/array-set.js
314
+ var require_array_set = __commonJS({
315
+ "node_modules/source-map/lib/array-set.js"(exports) {
316
+ var ArraySet = class _ArraySet {
317
+ constructor() {
318
+ this._array = [];
319
+ this._set = /* @__PURE__ */ new Map();
320
+ }
321
+ /**
322
+ * Static method for creating ArraySet instances from an existing array.
323
+ */
324
+ static fromArray(aArray, aAllowDuplicates) {
325
+ const set = new _ArraySet();
326
+ for (let i = 0, len = aArray.length; i < len; i++) {
327
+ set.add(aArray[i], aAllowDuplicates);
328
+ }
329
+ return set;
330
+ }
331
+ /**
332
+ * Return how many unique items are in this ArraySet. If duplicates have been
333
+ * added, than those do not count towards the size.
334
+ *
335
+ * @returns Number
336
+ */
337
+ size() {
338
+ return this._set.size;
339
+ }
340
+ /**
341
+ * Add the given string to this set.
342
+ *
343
+ * @param String aStr
344
+ */
345
+ add(aStr, aAllowDuplicates) {
346
+ const isDuplicate = this.has(aStr);
347
+ const idx = this._array.length;
348
+ if (!isDuplicate || aAllowDuplicates) {
349
+ this._array.push(aStr);
350
+ }
351
+ if (!isDuplicate) {
352
+ this._set.set(aStr, idx);
353
+ }
354
+ }
355
+ /**
356
+ * Is the given string a member of this set?
357
+ *
358
+ * @param String aStr
359
+ */
360
+ has(aStr) {
361
+ return this._set.has(aStr);
362
+ }
363
+ /**
364
+ * What is the index of the given string in the array?
365
+ *
366
+ * @param String aStr
367
+ */
368
+ indexOf(aStr) {
369
+ const idx = this._set.get(aStr);
370
+ if (idx >= 0) {
371
+ return idx;
372
+ }
373
+ throw new Error('"' + aStr + '" is not in the set.');
374
+ }
375
+ /**
376
+ * What is the element at the given index?
377
+ *
378
+ * @param Number aIdx
379
+ */
380
+ at(aIdx) {
381
+ if (aIdx >= 0 && aIdx < this._array.length) {
382
+ return this._array[aIdx];
383
+ }
384
+ throw new Error("No element indexed by " + aIdx);
385
+ }
386
+ /**
387
+ * Returns the array representation of this set (which has the proper indices
388
+ * indicated by indexOf). Note that this is a copy of the internal array used
389
+ * for storing the members so that no one can mess with internal state.
390
+ */
391
+ toArray() {
392
+ return this._array.slice();
393
+ }
394
+ };
395
+ exports.ArraySet = ArraySet;
396
+ }
397
+ });
398
+
399
+ // node_modules/source-map/lib/mapping-list.js
400
+ var require_mapping_list = __commonJS({
401
+ "node_modules/source-map/lib/mapping-list.js"(exports) {
402
+ var util = require_util();
403
+ function generatedPositionAfter(mappingA, mappingB) {
404
+ const lineA = mappingA.generatedLine;
405
+ const lineB = mappingB.generatedLine;
406
+ const columnA = mappingA.generatedColumn;
407
+ const columnB = mappingB.generatedColumn;
408
+ return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
409
+ }
410
+ var MappingList = class {
411
+ constructor() {
412
+ this._array = [];
413
+ this._sorted = true;
414
+ this._last = { generatedLine: -1, generatedColumn: 0 };
415
+ }
416
+ /**
417
+ * Iterate through internal items. This method takes the same arguments that
418
+ * `Array.prototype.forEach` takes.
419
+ *
420
+ * NOTE: The order of the mappings is NOT guaranteed.
421
+ */
422
+ unsortedForEach(aCallback, aThisArg) {
423
+ this._array.forEach(aCallback, aThisArg);
424
+ }
425
+ /**
426
+ * Add the given source mapping.
427
+ *
428
+ * @param Object aMapping
429
+ */
430
+ add(aMapping) {
431
+ if (generatedPositionAfter(this._last, aMapping)) {
432
+ this._last = aMapping;
433
+ this._array.push(aMapping);
434
+ } else {
435
+ this._sorted = false;
436
+ this._array.push(aMapping);
437
+ }
438
+ }
439
+ /**
440
+ * Returns the flat, sorted array of mappings. The mappings are sorted by
441
+ * generated position.
442
+ *
443
+ * WARNING: This method returns internal data without copying, for
444
+ * performance. The return value must NOT be mutated, and should be treated as
445
+ * an immutable borrow. If you want to take ownership, you must make your own
446
+ * copy.
447
+ */
448
+ toArray() {
449
+ if (!this._sorted) {
450
+ this._array.sort(util.compareByGeneratedPositionsInflated);
451
+ this._sorted = true;
452
+ }
453
+ return this._array;
454
+ }
455
+ };
456
+ exports.MappingList = MappingList;
457
+ }
458
+ });
459
+
460
+ // node_modules/source-map/lib/source-map-generator.js
461
+ var require_source_map_generator = __commonJS({
462
+ "node_modules/source-map/lib/source-map-generator.js"(exports) {
463
+ var base64VLQ = require_base64_vlq();
464
+ var util = require_util();
465
+ var ArraySet = require_array_set().ArraySet;
466
+ var MappingList = require_mapping_list().MappingList;
467
+ var SourceMapGenerator2 = class _SourceMapGenerator {
468
+ constructor(aArgs) {
469
+ if (!aArgs) {
470
+ aArgs = {};
471
+ }
472
+ this._file = util.getArg(aArgs, "file", null);
473
+ this._sourceRoot = util.getArg(aArgs, "sourceRoot", null);
474
+ this._skipValidation = util.getArg(aArgs, "skipValidation", false);
475
+ this._sources = new ArraySet();
476
+ this._names = new ArraySet();
477
+ this._mappings = new MappingList();
478
+ this._sourcesContents = null;
479
+ }
480
+ /**
481
+ * Creates a new SourceMapGenerator based on a SourceMapConsumer
482
+ *
483
+ * @param aSourceMapConsumer The SourceMap.
484
+ */
485
+ static fromSourceMap(aSourceMapConsumer) {
486
+ const sourceRoot = aSourceMapConsumer.sourceRoot;
487
+ const generator = new _SourceMapGenerator({
488
+ file: aSourceMapConsumer.file,
489
+ sourceRoot
490
+ });
491
+ aSourceMapConsumer.eachMapping(function(mapping) {
492
+ const newMapping = {
493
+ generated: {
494
+ line: mapping.generatedLine,
495
+ column: mapping.generatedColumn
496
+ }
497
+ };
498
+ if (mapping.source != null) {
499
+ newMapping.source = mapping.source;
500
+ if (sourceRoot != null) {
501
+ newMapping.source = util.relative(sourceRoot, newMapping.source);
502
+ }
503
+ newMapping.original = {
504
+ line: mapping.originalLine,
505
+ column: mapping.originalColumn
506
+ };
507
+ if (mapping.name != null) {
508
+ newMapping.name = mapping.name;
509
+ }
510
+ }
511
+ generator.addMapping(newMapping);
512
+ });
513
+ aSourceMapConsumer.sources.forEach(function(sourceFile) {
514
+ let sourceRelative = sourceFile;
515
+ if (sourceRoot != null) {
516
+ sourceRelative = util.relative(sourceRoot, sourceFile);
517
+ }
518
+ if (!generator._sources.has(sourceRelative)) {
519
+ generator._sources.add(sourceRelative);
520
+ }
521
+ const content = aSourceMapConsumer.sourceContentFor(sourceFile);
522
+ if (content != null) {
523
+ generator.setSourceContent(sourceFile, content);
524
+ }
525
+ });
526
+ return generator;
527
+ }
528
+ /**
529
+ * Add a single mapping from original source line and column to the generated
530
+ * source's line and column for this source map being created. The mapping
531
+ * object should have the following properties:
532
+ *
533
+ * - generated: An object with the generated line and column positions.
534
+ * - original: An object with the original line and column positions.
535
+ * - source: The original source file (relative to the sourceRoot).
536
+ * - name: An optional original token name for this mapping.
537
+ */
538
+ addMapping(aArgs) {
539
+ const generated = util.getArg(aArgs, "generated");
540
+ const original = util.getArg(aArgs, "original", null);
541
+ let source = util.getArg(aArgs, "source", null);
542
+ let name = util.getArg(aArgs, "name", null);
543
+ if (!this._skipValidation) {
544
+ this._validateMapping(generated, original, source, name);
545
+ }
546
+ if (source != null) {
547
+ source = String(source);
548
+ if (!this._sources.has(source)) {
549
+ this._sources.add(source);
550
+ }
551
+ }
552
+ if (name != null) {
553
+ name = String(name);
554
+ if (!this._names.has(name)) {
555
+ this._names.add(name);
556
+ }
557
+ }
558
+ this._mappings.add({
559
+ generatedLine: generated.line,
560
+ generatedColumn: generated.column,
561
+ originalLine: original && original.line,
562
+ originalColumn: original && original.column,
563
+ source,
564
+ name
565
+ });
566
+ }
567
+ /**
568
+ * Set the source content for a source file.
569
+ */
570
+ setSourceContent(aSourceFile, aSourceContent) {
571
+ let source = aSourceFile;
572
+ if (this._sourceRoot != null) {
573
+ source = util.relative(this._sourceRoot, source);
574
+ }
575
+ if (aSourceContent != null) {
576
+ if (!this._sourcesContents) {
577
+ this._sourcesContents = /* @__PURE__ */ Object.create(null);
578
+ }
579
+ this._sourcesContents[util.toSetString(source)] = aSourceContent;
580
+ } else if (this._sourcesContents) {
581
+ delete this._sourcesContents[util.toSetString(source)];
582
+ if (Object.keys(this._sourcesContents).length === 0) {
583
+ this._sourcesContents = null;
584
+ }
585
+ }
586
+ }
587
+ /**
588
+ * Applies the mappings of a sub-source-map for a specific source file to the
589
+ * source map being generated. Each mapping to the supplied source file is
590
+ * rewritten using the supplied source map. Note: The resolution for the
591
+ * resulting mappings is the minimium of this map and the supplied map.
592
+ *
593
+ * @param aSourceMapConsumer The source map to be applied.
594
+ * @param aSourceFile Optional. The filename of the source file.
595
+ * If omitted, SourceMapConsumer's file property will be used.
596
+ * @param aSourceMapPath Optional. The dirname of the path to the source map
597
+ * to be applied. If relative, it is relative to the SourceMapConsumer.
598
+ * This parameter is needed when the two source maps aren't in the same
599
+ * directory, and the source map to be applied contains relative source
600
+ * paths. If so, those relative source paths need to be rewritten
601
+ * relative to the SourceMapGenerator.
602
+ */
603
+ applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
604
+ let sourceFile = aSourceFile;
605
+ if (aSourceFile == null) {
606
+ if (aSourceMapConsumer.file == null) {
607
+ throw new Error(
608
+ `SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`
609
+ );
610
+ }
611
+ sourceFile = aSourceMapConsumer.file;
612
+ }
613
+ const sourceRoot = this._sourceRoot;
614
+ if (sourceRoot != null) {
615
+ sourceFile = util.relative(sourceRoot, sourceFile);
616
+ }
617
+ const newSources = this._mappings.toArray().length > 0 ? new ArraySet() : this._sources;
618
+ const newNames = new ArraySet();
619
+ this._mappings.unsortedForEach(function(mapping) {
620
+ if (mapping.source === sourceFile && mapping.originalLine != null) {
621
+ const original = aSourceMapConsumer.originalPositionFor({
622
+ line: mapping.originalLine,
623
+ column: mapping.originalColumn
624
+ });
625
+ if (original.source != null) {
626
+ mapping.source = original.source;
627
+ if (aSourceMapPath != null) {
628
+ mapping.source = util.join(aSourceMapPath, mapping.source);
629
+ }
630
+ if (sourceRoot != null) {
631
+ mapping.source = util.relative(sourceRoot, mapping.source);
632
+ }
633
+ mapping.originalLine = original.line;
634
+ mapping.originalColumn = original.column;
635
+ if (original.name != null) {
636
+ mapping.name = original.name;
637
+ }
638
+ }
639
+ }
640
+ const source = mapping.source;
641
+ if (source != null && !newSources.has(source)) {
642
+ newSources.add(source);
643
+ }
644
+ const name = mapping.name;
645
+ if (name != null && !newNames.has(name)) {
646
+ newNames.add(name);
647
+ }
648
+ }, this);
649
+ this._sources = newSources;
650
+ this._names = newNames;
651
+ aSourceMapConsumer.sources.forEach(function(srcFile) {
652
+ const content = aSourceMapConsumer.sourceContentFor(srcFile);
653
+ if (content != null) {
654
+ if (aSourceMapPath != null) {
655
+ srcFile = util.join(aSourceMapPath, srcFile);
656
+ }
657
+ if (sourceRoot != null) {
658
+ srcFile = util.relative(sourceRoot, srcFile);
659
+ }
660
+ this.setSourceContent(srcFile, content);
661
+ }
662
+ }, this);
663
+ }
664
+ /**
665
+ * A mapping can have one of the three levels of data:
666
+ *
667
+ * 1. Just the generated position.
668
+ * 2. The Generated position, original position, and original source.
669
+ * 3. Generated and original position, original source, as well as a name
670
+ * token.
671
+ *
672
+ * To maintain consistency, we validate that any new mapping being added falls
673
+ * in to one of these categories.
674
+ */
675
+ _validateMapping(aGenerated, aOriginal, aSource, aName) {
676
+ if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
677
+ throw new Error(
678
+ "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values."
679
+ );
680
+ }
681
+ if (aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
682
+ } else if (aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
683
+ } else {
684
+ throw new Error(
685
+ "Invalid mapping: " + JSON.stringify({
686
+ generated: aGenerated,
687
+ source: aSource,
688
+ original: aOriginal,
689
+ name: aName
690
+ })
691
+ );
692
+ }
693
+ }
694
+ /**
695
+ * Serialize the accumulated mappings in to the stream of base 64 VLQs
696
+ * specified by the source map format.
697
+ */
698
+ _serializeMappings() {
699
+ let previousGeneratedColumn = 0;
700
+ let previousGeneratedLine = 1;
701
+ let previousOriginalColumn = 0;
702
+ let previousOriginalLine = 0;
703
+ let previousName = 0;
704
+ let previousSource = 0;
705
+ let result = "";
706
+ let next;
707
+ let mapping;
708
+ let nameIdx;
709
+ let sourceIdx;
710
+ const mappings = this._mappings.toArray();
711
+ for (let i = 0, len = mappings.length; i < len; i++) {
712
+ mapping = mappings[i];
713
+ next = "";
714
+ if (mapping.generatedLine !== previousGeneratedLine) {
715
+ previousGeneratedColumn = 0;
716
+ while (mapping.generatedLine !== previousGeneratedLine) {
717
+ next += ";";
718
+ previousGeneratedLine++;
719
+ }
720
+ } else if (i > 0) {
721
+ if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
722
+ continue;
723
+ }
724
+ next += ",";
725
+ }
726
+ next += base64VLQ.encode(
727
+ mapping.generatedColumn - previousGeneratedColumn
728
+ );
729
+ previousGeneratedColumn = mapping.generatedColumn;
730
+ if (mapping.source != null) {
731
+ sourceIdx = this._sources.indexOf(mapping.source);
732
+ next += base64VLQ.encode(sourceIdx - previousSource);
733
+ previousSource = sourceIdx;
734
+ next += base64VLQ.encode(
735
+ mapping.originalLine - 1 - previousOriginalLine
736
+ );
737
+ previousOriginalLine = mapping.originalLine - 1;
738
+ next += base64VLQ.encode(
739
+ mapping.originalColumn - previousOriginalColumn
740
+ );
741
+ previousOriginalColumn = mapping.originalColumn;
742
+ if (mapping.name != null) {
743
+ nameIdx = this._names.indexOf(mapping.name);
744
+ next += base64VLQ.encode(nameIdx - previousName);
745
+ previousName = nameIdx;
746
+ }
747
+ }
748
+ result += next;
749
+ }
750
+ return result;
751
+ }
752
+ _generateSourcesContent(aSources, aSourceRoot) {
753
+ return aSources.map(function(source) {
754
+ if (!this._sourcesContents) {
755
+ return null;
756
+ }
757
+ if (aSourceRoot != null) {
758
+ source = util.relative(aSourceRoot, source);
759
+ }
760
+ const key = util.toSetString(source);
761
+ return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
762
+ }, this);
763
+ }
764
+ /**
765
+ * Externalize the source map.
766
+ */
767
+ toJSON() {
768
+ const map = {
769
+ version: this._version,
770
+ sources: this._sources.toArray(),
771
+ names: this._names.toArray(),
772
+ mappings: this._serializeMappings()
773
+ };
774
+ if (this._file != null) {
775
+ map.file = this._file;
776
+ }
777
+ if (this._sourceRoot != null) {
778
+ map.sourceRoot = this._sourceRoot;
779
+ }
780
+ if (this._sourcesContents) {
781
+ map.sourcesContent = this._generateSourcesContent(
782
+ map.sources,
783
+ map.sourceRoot
784
+ );
785
+ }
786
+ return map;
787
+ }
788
+ /**
789
+ * Render the source map being generated to a string.
790
+ */
791
+ toString() {
792
+ return JSON.stringify(this.toJSON());
793
+ }
794
+ };
795
+ SourceMapGenerator2.prototype._version = 3;
796
+ exports.SourceMapGenerator = SourceMapGenerator2;
797
+ }
798
+ });
799
+
800
+ // node_modules/source-map/lib/binary-search.js
801
+ var require_binary_search = __commonJS({
802
+ "node_modules/source-map/lib/binary-search.js"(exports) {
803
+ exports.GREATEST_LOWER_BOUND = 1;
804
+ exports.LEAST_UPPER_BOUND = 2;
805
+ function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
806
+ const mid = Math.floor((aHigh - aLow) / 2) + aLow;
807
+ const cmp = aCompare(aNeedle, aHaystack[mid], true);
808
+ if (cmp === 0) {
809
+ return mid;
810
+ } else if (cmp > 0) {
811
+ if (aHigh - mid > 1) {
812
+ return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
813
+ }
814
+ if (aBias === exports.LEAST_UPPER_BOUND) {
815
+ return aHigh < aHaystack.length ? aHigh : -1;
816
+ }
817
+ return mid;
818
+ }
819
+ if (mid - aLow > 1) {
820
+ return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
821
+ }
822
+ if (aBias == exports.LEAST_UPPER_BOUND) {
823
+ return mid;
824
+ }
825
+ return aLow < 0 ? -1 : aLow;
826
+ }
827
+ exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
828
+ if (aHaystack.length === 0) {
829
+ return -1;
830
+ }
831
+ let index = recursiveSearch(
832
+ -1,
833
+ aHaystack.length,
834
+ aNeedle,
835
+ aHaystack,
836
+ aCompare,
837
+ aBias || exports.GREATEST_LOWER_BOUND
838
+ );
839
+ if (index < 0) {
840
+ return -1;
841
+ }
842
+ while (index - 1 >= 0) {
843
+ if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
844
+ break;
845
+ }
846
+ --index;
847
+ }
848
+ return index;
849
+ };
850
+ }
851
+ });
852
+
853
+ // node_modules/source-map/lib/read-wasm.js
854
+ var require_read_wasm = __commonJS({
855
+ "node_modules/source-map/lib/read-wasm.js"(exports, module) {
856
+ "use strict";
857
+ var fs5 = __require("fs");
858
+ var path3 = __require("path");
859
+ module.exports = function readWasm() {
860
+ return new Promise((resolve2, reject) => {
861
+ const wasmPath = path3.join(__dirname, "mappings.wasm");
862
+ fs5.readFile(wasmPath, null, (error, data) => {
863
+ if (error) {
864
+ reject(error);
865
+ return;
866
+ }
867
+ resolve2(data.buffer);
868
+ });
869
+ });
870
+ };
871
+ module.exports.initialize = (_) => {
872
+ console.debug(
873
+ "SourceMapConsumer.initialize is a no-op when running in node.js"
874
+ );
875
+ };
876
+ }
877
+ });
878
+
879
+ // node_modules/source-map/lib/wasm.js
880
+ var require_wasm = __commonJS({
881
+ "node_modules/source-map/lib/wasm.js"(exports, module) {
882
+ var readWasm = require_read_wasm();
883
+ function Mapping() {
884
+ this.generatedLine = 0;
885
+ this.generatedColumn = 0;
886
+ this.lastGeneratedColumn = null;
887
+ this.source = null;
888
+ this.originalLine = null;
889
+ this.originalColumn = null;
890
+ this.name = null;
891
+ }
892
+ var cachedWasm = null;
893
+ module.exports = function wasm() {
894
+ if (cachedWasm) {
895
+ return cachedWasm;
896
+ }
897
+ const callbackStack = [];
898
+ cachedWasm = readWasm().then((buffer) => {
899
+ return WebAssembly.instantiate(buffer, {
900
+ env: {
901
+ mapping_callback(generatedLine, generatedColumn, hasLastGeneratedColumn, lastGeneratedColumn, hasOriginal, source, originalLine, originalColumn, hasName, name) {
902
+ const mapping = new Mapping();
903
+ mapping.generatedLine = generatedLine + 1;
904
+ mapping.generatedColumn = generatedColumn;
905
+ if (hasLastGeneratedColumn) {
906
+ mapping.lastGeneratedColumn = lastGeneratedColumn - 1;
907
+ }
908
+ if (hasOriginal) {
909
+ mapping.source = source;
910
+ mapping.originalLine = originalLine + 1;
911
+ mapping.originalColumn = originalColumn;
912
+ if (hasName) {
913
+ mapping.name = name;
914
+ }
915
+ }
916
+ callbackStack[callbackStack.length - 1](mapping);
917
+ },
918
+ start_all_generated_locations_for() {
919
+ console.time("all_generated_locations_for");
920
+ },
921
+ end_all_generated_locations_for() {
922
+ console.timeEnd("all_generated_locations_for");
923
+ },
924
+ start_compute_column_spans() {
925
+ console.time("compute_column_spans");
926
+ },
927
+ end_compute_column_spans() {
928
+ console.timeEnd("compute_column_spans");
929
+ },
930
+ start_generated_location_for() {
931
+ console.time("generated_location_for");
932
+ },
933
+ end_generated_location_for() {
934
+ console.timeEnd("generated_location_for");
935
+ },
936
+ start_original_location_for() {
937
+ console.time("original_location_for");
938
+ },
939
+ end_original_location_for() {
940
+ console.timeEnd("original_location_for");
941
+ },
942
+ start_parse_mappings() {
943
+ console.time("parse_mappings");
944
+ },
945
+ end_parse_mappings() {
946
+ console.timeEnd("parse_mappings");
947
+ },
948
+ start_sort_by_generated_location() {
949
+ console.time("sort_by_generated_location");
950
+ },
951
+ end_sort_by_generated_location() {
952
+ console.timeEnd("sort_by_generated_location");
953
+ },
954
+ start_sort_by_original_location() {
955
+ console.time("sort_by_original_location");
956
+ },
957
+ end_sort_by_original_location() {
958
+ console.timeEnd("sort_by_original_location");
959
+ }
960
+ }
961
+ });
962
+ }).then((Wasm) => {
963
+ return {
964
+ exports: Wasm.instance.exports,
965
+ withMappingCallback: (mappingCallback, f) => {
966
+ callbackStack.push(mappingCallback);
967
+ try {
968
+ f();
969
+ } finally {
970
+ callbackStack.pop();
971
+ }
972
+ }
973
+ };
974
+ }).then(null, (e) => {
975
+ cachedWasm = null;
976
+ throw e;
977
+ });
978
+ return cachedWasm;
979
+ };
980
+ }
981
+ });
982
+
983
+ // node_modules/source-map/lib/source-map-consumer.js
984
+ var require_source_map_consumer = __commonJS({
985
+ "node_modules/source-map/lib/source-map-consumer.js"(exports) {
986
+ var util = require_util();
987
+ var binarySearch = require_binary_search();
988
+ var ArraySet = require_array_set().ArraySet;
989
+ var base64VLQ = require_base64_vlq();
990
+ var readWasm = require_read_wasm();
991
+ var wasm = require_wasm();
992
+ var INTERNAL = /* @__PURE__ */ Symbol("smcInternal");
993
+ var SourceMapConsumer = class _SourceMapConsumer {
994
+ constructor(aSourceMap, aSourceMapURL) {
995
+ if (aSourceMap == INTERNAL) {
996
+ return Promise.resolve(this);
997
+ }
998
+ return _factory(aSourceMap, aSourceMapURL);
999
+ }
1000
+ static initialize(opts) {
1001
+ readWasm.initialize(opts["lib/mappings.wasm"]);
1002
+ }
1003
+ static fromSourceMap(aSourceMap, aSourceMapURL) {
1004
+ return _factoryBSM(aSourceMap, aSourceMapURL);
1005
+ }
1006
+ /**
1007
+ * Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl`
1008
+ * (see the `SourceMapConsumer` constructor for details. Then, invoke the `async
1009
+ * function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait
1010
+ * for `f` to complete, call `destroy` on the consumer, and return `f`'s return
1011
+ * value.
1012
+ *
1013
+ * You must not use the consumer after `f` completes!
1014
+ *
1015
+ * By using `with`, you do not have to remember to manually call `destroy` on
1016
+ * the consumer, since it will be called automatically once `f` completes.
1017
+ *
1018
+ * ```js
1019
+ * const xSquared = await SourceMapConsumer.with(
1020
+ * myRawSourceMap,
1021
+ * null,
1022
+ * async function (consumer) {
1023
+ * // Use `consumer` inside here and don't worry about remembering
1024
+ * // to call `destroy`.
1025
+ *
1026
+ * const x = await whatever(consumer);
1027
+ * return x * x;
1028
+ * }
1029
+ * );
1030
+ *
1031
+ * // You may not use that `consumer` anymore out here; it has
1032
+ * // been destroyed. But you can use `xSquared`.
1033
+ * console.log(xSquared);
1034
+ * ```
1035
+ */
1036
+ static async with(rawSourceMap, sourceMapUrl, f) {
1037
+ const consumer = await new _SourceMapConsumer(rawSourceMap, sourceMapUrl);
1038
+ try {
1039
+ return await f(consumer);
1040
+ } finally {
1041
+ consumer.destroy();
1042
+ }
1043
+ }
1044
+ /**
1045
+ * Iterate over each mapping between an original source/line/column and a
1046
+ * generated line/column in this source map.
1047
+ *
1048
+ * @param Function aCallback
1049
+ * The function that is called with each mapping.
1050
+ * @param Object aContext
1051
+ * Optional. If specified, this object will be the value of `this` every
1052
+ * time that `aCallback` is called.
1053
+ * @param aOrder
1054
+ * Either `SourceMapConsumer.GENERATED_ORDER` or
1055
+ * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
1056
+ * iterate over the mappings sorted by the generated file's line/column
1057
+ * order or the original's source/line/column order, respectively. Defaults to
1058
+ * `SourceMapConsumer.GENERATED_ORDER`.
1059
+ */
1060
+ eachMapping(aCallback, aContext, aOrder) {
1061
+ throw new Error("Subclasses must implement eachMapping");
1062
+ }
1063
+ /**
1064
+ * Returns all generated line and column information for the original source,
1065
+ * line, and column provided. If no column is provided, returns all mappings
1066
+ * corresponding to a either the line we are searching for or the next
1067
+ * closest line that has any mappings. Otherwise, returns all mappings
1068
+ * corresponding to the given line and either the column we are searching for
1069
+ * or the next closest column that has any offsets.
1070
+ *
1071
+ * The only argument is an object with the following properties:
1072
+ *
1073
+ * - source: The filename of the original source.
1074
+ * - line: The line number in the original source. The line number is 1-based.
1075
+ * - column: Optional. the column number in the original source.
1076
+ * The column number is 0-based.
1077
+ *
1078
+ * and an array of objects is returned, each with the following properties:
1079
+ *
1080
+ * - line: The line number in the generated source, or null. The
1081
+ * line number is 1-based.
1082
+ * - column: The column number in the generated source, or null.
1083
+ * The column number is 0-based.
1084
+ */
1085
+ allGeneratedPositionsFor(aArgs) {
1086
+ throw new Error("Subclasses must implement allGeneratedPositionsFor");
1087
+ }
1088
+ destroy() {
1089
+ throw new Error("Subclasses must implement destroy");
1090
+ }
1091
+ };
1092
+ SourceMapConsumer.prototype._version = 3;
1093
+ SourceMapConsumer.GENERATED_ORDER = 1;
1094
+ SourceMapConsumer.ORIGINAL_ORDER = 2;
1095
+ SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
1096
+ SourceMapConsumer.LEAST_UPPER_BOUND = 2;
1097
+ exports.SourceMapConsumer = SourceMapConsumer;
1098
+ var BasicSourceMapConsumer = class _BasicSourceMapConsumer extends SourceMapConsumer {
1099
+ constructor(aSourceMap, aSourceMapURL) {
1100
+ return super(INTERNAL).then((that) => {
1101
+ let sourceMap = aSourceMap;
1102
+ if (typeof aSourceMap === "string") {
1103
+ sourceMap = util.parseSourceMapInput(aSourceMap);
1104
+ }
1105
+ const version = util.getArg(sourceMap, "version");
1106
+ const sources = util.getArg(sourceMap, "sources").map(String);
1107
+ const names = util.getArg(sourceMap, "names", []);
1108
+ const sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
1109
+ const sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
1110
+ const mappings = util.getArg(sourceMap, "mappings");
1111
+ const file = util.getArg(sourceMap, "file", null);
1112
+ const x_google_ignoreList = util.getArg(
1113
+ sourceMap,
1114
+ "x_google_ignoreList",
1115
+ null
1116
+ );
1117
+ if (version != that._version) {
1118
+ throw new Error("Unsupported version: " + version);
1119
+ }
1120
+ that._sourceLookupCache = /* @__PURE__ */ new Map();
1121
+ that._names = ArraySet.fromArray(names.map(String), true);
1122
+ that._sources = ArraySet.fromArray(sources, true);
1123
+ that._absoluteSources = ArraySet.fromArray(
1124
+ that._sources.toArray().map(function(s) {
1125
+ return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
1126
+ }),
1127
+ true
1128
+ );
1129
+ that.sourceRoot = sourceRoot;
1130
+ that.sourcesContent = sourcesContent;
1131
+ that._mappings = mappings;
1132
+ that._sourceMapURL = aSourceMapURL;
1133
+ that.file = file;
1134
+ that.x_google_ignoreList = x_google_ignoreList;
1135
+ that._computedColumnSpans = false;
1136
+ that._mappingsPtr = 0;
1137
+ that._wasm = null;
1138
+ return wasm().then((w) => {
1139
+ that._wasm = w;
1140
+ return that;
1141
+ });
1142
+ });
1143
+ }
1144
+ /**
1145
+ * Utility function to find the index of a source. Returns -1 if not
1146
+ * found.
1147
+ */
1148
+ _findSourceIndex(aSource) {
1149
+ const cachedIndex = this._sourceLookupCache.get(aSource);
1150
+ if (typeof cachedIndex === "number") {
1151
+ return cachedIndex;
1152
+ }
1153
+ const sourceAsMapRelative = util.computeSourceURL(
1154
+ null,
1155
+ aSource,
1156
+ this._sourceMapURL
1157
+ );
1158
+ if (this._absoluteSources.has(sourceAsMapRelative)) {
1159
+ const index = this._absoluteSources.indexOf(sourceAsMapRelative);
1160
+ this._sourceLookupCache.set(aSource, index);
1161
+ return index;
1162
+ }
1163
+ const sourceAsSourceRootRelative = util.computeSourceURL(
1164
+ this.sourceRoot,
1165
+ aSource,
1166
+ this._sourceMapURL
1167
+ );
1168
+ if (this._absoluteSources.has(sourceAsSourceRootRelative)) {
1169
+ const index = this._absoluteSources.indexOf(sourceAsSourceRootRelative);
1170
+ this._sourceLookupCache.set(aSource, index);
1171
+ return index;
1172
+ }
1173
+ return -1;
1174
+ }
1175
+ /**
1176
+ * Create a BasicSourceMapConsumer from a SourceMapGenerator.
1177
+ *
1178
+ * @param SourceMapGenerator aSourceMap
1179
+ * The source map that will be consumed.
1180
+ * @param String aSourceMapURL
1181
+ * The URL at which the source map can be found (optional)
1182
+ * @returns BasicSourceMapConsumer
1183
+ */
1184
+ static fromSourceMap(aSourceMap, aSourceMapURL) {
1185
+ return new _BasicSourceMapConsumer(aSourceMap.toString());
1186
+ }
1187
+ get sources() {
1188
+ return this._absoluteSources.toArray();
1189
+ }
1190
+ _getMappingsPtr() {
1191
+ if (this._mappingsPtr === 0) {
1192
+ this._parseMappings();
1193
+ }
1194
+ return this._mappingsPtr;
1195
+ }
1196
+ /**
1197
+ * Parse the mappings in a string in to a data structure which we can easily
1198
+ * query (the ordered arrays in the `this.__generatedMappings` and
1199
+ * `this.__originalMappings` properties).
1200
+ */
1201
+ _parseMappings() {
1202
+ const aStr = this._mappings;
1203
+ const size = aStr.length;
1204
+ const mappingsBufPtr = this._wasm.exports.allocate_mappings(size) >>> 0;
1205
+ const mappingsBuf = new Uint8Array(
1206
+ this._wasm.exports.memory.buffer,
1207
+ mappingsBufPtr,
1208
+ size
1209
+ );
1210
+ for (let i = 0; i < size; i++) {
1211
+ mappingsBuf[i] = aStr.charCodeAt(i);
1212
+ }
1213
+ const mappingsPtr = this._wasm.exports.parse_mappings(mappingsBufPtr);
1214
+ if (!mappingsPtr) {
1215
+ const error = this._wasm.exports.get_last_error();
1216
+ let msg = `Error parsing mappings (code ${error}): `;
1217
+ switch (error) {
1218
+ case 1:
1219
+ msg += "the mappings contained a negative line, column, source index, or name index";
1220
+ break;
1221
+ case 2:
1222
+ msg += "the mappings contained a number larger than 2**32";
1223
+ break;
1224
+ case 3:
1225
+ msg += "reached EOF while in the middle of parsing a VLQ";
1226
+ break;
1227
+ case 4:
1228
+ msg += "invalid base 64 character while parsing a VLQ";
1229
+ break;
1230
+ default:
1231
+ msg += "unknown error code";
1232
+ break;
1233
+ }
1234
+ throw new Error(msg);
1235
+ }
1236
+ this._mappingsPtr = mappingsPtr;
1237
+ }
1238
+ eachMapping(aCallback, aContext, aOrder) {
1239
+ const context = aContext || null;
1240
+ const order = aOrder || SourceMapConsumer.GENERATED_ORDER;
1241
+ this._wasm.withMappingCallback(
1242
+ (mapping) => {
1243
+ if (mapping.source !== null) {
1244
+ mapping.source = this._absoluteSources.at(mapping.source);
1245
+ if (mapping.name !== null) {
1246
+ mapping.name = this._names.at(mapping.name);
1247
+ }
1248
+ }
1249
+ if (this._computedColumnSpans && mapping.lastGeneratedColumn === null) {
1250
+ mapping.lastGeneratedColumn = Infinity;
1251
+ }
1252
+ aCallback.call(context, mapping);
1253
+ },
1254
+ () => {
1255
+ switch (order) {
1256
+ case SourceMapConsumer.GENERATED_ORDER:
1257
+ this._wasm.exports.by_generated_location(this._getMappingsPtr());
1258
+ break;
1259
+ case SourceMapConsumer.ORIGINAL_ORDER:
1260
+ this._wasm.exports.by_original_location(this._getMappingsPtr());
1261
+ break;
1262
+ default:
1263
+ throw new Error("Unknown order of iteration.");
1264
+ }
1265
+ }
1266
+ );
1267
+ }
1268
+ allGeneratedPositionsFor(aArgs) {
1269
+ let source = util.getArg(aArgs, "source");
1270
+ const originalLine = util.getArg(aArgs, "line");
1271
+ const originalColumn = aArgs.column || 0;
1272
+ source = this._findSourceIndex(source);
1273
+ if (source < 0) {
1274
+ return [];
1275
+ }
1276
+ if (originalLine < 1) {
1277
+ throw new Error("Line numbers must be >= 1");
1278
+ }
1279
+ if (originalColumn < 0) {
1280
+ throw new Error("Column numbers must be >= 0");
1281
+ }
1282
+ const mappings = [];
1283
+ this._wasm.withMappingCallback(
1284
+ (m) => {
1285
+ let lastColumn = m.lastGeneratedColumn;
1286
+ if (this._computedColumnSpans && lastColumn === null) {
1287
+ lastColumn = Infinity;
1288
+ }
1289
+ mappings.push({
1290
+ line: m.generatedLine,
1291
+ column: m.generatedColumn,
1292
+ lastColumn
1293
+ });
1294
+ },
1295
+ () => {
1296
+ this._wasm.exports.all_generated_locations_for(
1297
+ this._getMappingsPtr(),
1298
+ source,
1299
+ originalLine - 1,
1300
+ "column" in aArgs,
1301
+ originalColumn
1302
+ );
1303
+ }
1304
+ );
1305
+ return mappings;
1306
+ }
1307
+ destroy() {
1308
+ if (this._mappingsPtr !== 0) {
1309
+ this._wasm.exports.free_mappings(this._mappingsPtr);
1310
+ this._mappingsPtr = 0;
1311
+ }
1312
+ }
1313
+ /**
1314
+ * Compute the last column for each generated mapping. The last column is
1315
+ * inclusive.
1316
+ */
1317
+ computeColumnSpans() {
1318
+ if (this._computedColumnSpans) {
1319
+ return;
1320
+ }
1321
+ this._wasm.exports.compute_column_spans(this._getMappingsPtr());
1322
+ this._computedColumnSpans = true;
1323
+ }
1324
+ /**
1325
+ * Returns the original source, line, and column information for the generated
1326
+ * source's line and column positions provided. The only argument is an object
1327
+ * with the following properties:
1328
+ *
1329
+ * - line: The line number in the generated source. The line number
1330
+ * is 1-based.
1331
+ * - column: The column number in the generated source. The column
1332
+ * number is 0-based.
1333
+ * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
1334
+ * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
1335
+ * closest element that is smaller than or greater than the one we are
1336
+ * searching for, respectively, if the exact element cannot be found.
1337
+ * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
1338
+ *
1339
+ * and an object is returned with the following properties:
1340
+ *
1341
+ * - source: The original source file, or null.
1342
+ * - line: The line number in the original source, or null. The
1343
+ * line number is 1-based.
1344
+ * - column: The column number in the original source, or null. The
1345
+ * column number is 0-based.
1346
+ * - name: The original identifier, or null.
1347
+ */
1348
+ originalPositionFor(aArgs) {
1349
+ const needle = {
1350
+ generatedLine: util.getArg(aArgs, "line"),
1351
+ generatedColumn: util.getArg(aArgs, "column")
1352
+ };
1353
+ if (needle.generatedLine < 1) {
1354
+ throw new Error("Line numbers must be >= 1");
1355
+ }
1356
+ if (needle.generatedColumn < 0) {
1357
+ throw new Error("Column numbers must be >= 0");
1358
+ }
1359
+ let bias = util.getArg(
1360
+ aArgs,
1361
+ "bias",
1362
+ SourceMapConsumer.GREATEST_LOWER_BOUND
1363
+ );
1364
+ if (bias == null) {
1365
+ bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
1366
+ }
1367
+ let mapping;
1368
+ this._wasm.withMappingCallback(
1369
+ (m) => mapping = m,
1370
+ () => {
1371
+ this._wasm.exports.original_location_for(
1372
+ this._getMappingsPtr(),
1373
+ needle.generatedLine - 1,
1374
+ needle.generatedColumn,
1375
+ bias
1376
+ );
1377
+ }
1378
+ );
1379
+ if (mapping) {
1380
+ if (mapping.generatedLine === needle.generatedLine) {
1381
+ let source = util.getArg(mapping, "source", null);
1382
+ if (source !== null) {
1383
+ source = this._absoluteSources.at(source);
1384
+ }
1385
+ let name = util.getArg(mapping, "name", null);
1386
+ if (name !== null) {
1387
+ name = this._names.at(name);
1388
+ }
1389
+ return {
1390
+ source,
1391
+ line: util.getArg(mapping, "originalLine", null),
1392
+ column: util.getArg(mapping, "originalColumn", null),
1393
+ name
1394
+ };
1395
+ }
1396
+ }
1397
+ return {
1398
+ source: null,
1399
+ line: null,
1400
+ column: null,
1401
+ name: null
1402
+ };
1403
+ }
1404
+ /**
1405
+ * Return true if we have the source content for every source in the source
1406
+ * map, false otherwise.
1407
+ */
1408
+ hasContentsOfAllSources() {
1409
+ if (!this.sourcesContent) {
1410
+ return false;
1411
+ }
1412
+ return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
1413
+ return sc == null;
1414
+ });
1415
+ }
1416
+ /**
1417
+ * Returns the original source content. The only argument is the url of the
1418
+ * original source file. Returns null if no original source content is
1419
+ * available.
1420
+ */
1421
+ sourceContentFor(aSource, nullOnMissing) {
1422
+ if (!this.sourcesContent) {
1423
+ return null;
1424
+ }
1425
+ const index = this._findSourceIndex(aSource);
1426
+ if (index >= 0) {
1427
+ return this.sourcesContent[index];
1428
+ }
1429
+ if (nullOnMissing) {
1430
+ return null;
1431
+ }
1432
+ throw new Error('"' + aSource + '" is not in the SourceMap.');
1433
+ }
1434
+ /**
1435
+ * Returns the generated line and column information for the original source,
1436
+ * line, and column positions provided. The only argument is an object with
1437
+ * the following properties:
1438
+ *
1439
+ * - source: The filename of the original source.
1440
+ * - line: The line number in the original source. The line number
1441
+ * is 1-based.
1442
+ * - column: The column number in the original source. The column
1443
+ * number is 0-based.
1444
+ * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
1445
+ * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
1446
+ * closest element that is smaller than or greater than the one we are
1447
+ * searching for, respectively, if the exact element cannot be found.
1448
+ * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
1449
+ *
1450
+ * and an object is returned with the following properties:
1451
+ *
1452
+ * - line: The line number in the generated source, or null. The
1453
+ * line number is 1-based.
1454
+ * - column: The column number in the generated source, or null.
1455
+ * The column number is 0-based.
1456
+ */
1457
+ generatedPositionFor(aArgs) {
1458
+ let source = util.getArg(aArgs, "source");
1459
+ source = this._findSourceIndex(source);
1460
+ if (source < 0) {
1461
+ return {
1462
+ line: null,
1463
+ column: null,
1464
+ lastColumn: null
1465
+ };
1466
+ }
1467
+ const needle = {
1468
+ source,
1469
+ originalLine: util.getArg(aArgs, "line"),
1470
+ originalColumn: util.getArg(aArgs, "column")
1471
+ };
1472
+ if (needle.originalLine < 1) {
1473
+ throw new Error("Line numbers must be >= 1");
1474
+ }
1475
+ if (needle.originalColumn < 0) {
1476
+ throw new Error("Column numbers must be >= 0");
1477
+ }
1478
+ let bias = util.getArg(
1479
+ aArgs,
1480
+ "bias",
1481
+ SourceMapConsumer.GREATEST_LOWER_BOUND
1482
+ );
1483
+ if (bias == null) {
1484
+ bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
1485
+ }
1486
+ let mapping;
1487
+ this._wasm.withMappingCallback(
1488
+ (m) => mapping = m,
1489
+ () => {
1490
+ this._wasm.exports.generated_location_for(
1491
+ this._getMappingsPtr(),
1492
+ needle.source,
1493
+ needle.originalLine - 1,
1494
+ needle.originalColumn,
1495
+ bias
1496
+ );
1497
+ }
1498
+ );
1499
+ if (mapping) {
1500
+ if (mapping.source === needle.source) {
1501
+ let lastColumn = mapping.lastGeneratedColumn;
1502
+ if (this._computedColumnSpans && lastColumn === null) {
1503
+ lastColumn = Infinity;
1504
+ }
1505
+ return {
1506
+ line: util.getArg(mapping, "generatedLine", null),
1507
+ column: util.getArg(mapping, "generatedColumn", null),
1508
+ lastColumn
1509
+ };
1510
+ }
1511
+ }
1512
+ return {
1513
+ line: null,
1514
+ column: null,
1515
+ lastColumn: null
1516
+ };
1517
+ }
1518
+ };
1519
+ BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
1520
+ exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
1521
+ var IndexedSourceMapConsumer = class extends SourceMapConsumer {
1522
+ constructor(aSourceMap, aSourceMapURL) {
1523
+ return super(INTERNAL).then((that) => {
1524
+ let sourceMap = aSourceMap;
1525
+ if (typeof aSourceMap === "string") {
1526
+ sourceMap = util.parseSourceMapInput(aSourceMap);
1527
+ }
1528
+ const version = util.getArg(sourceMap, "version");
1529
+ const sections = util.getArg(sourceMap, "sections");
1530
+ if (version != that._version) {
1531
+ throw new Error("Unsupported version: " + version);
1532
+ }
1533
+ let lastOffset = {
1534
+ line: -1,
1535
+ column: 0
1536
+ };
1537
+ return Promise.all(
1538
+ sections.map((s) => {
1539
+ if (s.url) {
1540
+ throw new Error(
1541
+ "Support for url field in sections not implemented."
1542
+ );
1543
+ }
1544
+ const offset = util.getArg(s, "offset");
1545
+ const offsetLine = util.getArg(offset, "line");
1546
+ const offsetColumn = util.getArg(offset, "column");
1547
+ if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
1548
+ throw new Error(
1549
+ "Section offsets must be ordered and non-overlapping."
1550
+ );
1551
+ }
1552
+ lastOffset = offset;
1553
+ const cons = new SourceMapConsumer(
1554
+ util.getArg(s, "map"),
1555
+ aSourceMapURL
1556
+ );
1557
+ return cons.then((consumer) => {
1558
+ return {
1559
+ generatedOffset: {
1560
+ // The offset fields are 0-based, but we use 1-based indices when
1561
+ // encoding/decoding from VLQ.
1562
+ generatedLine: offsetLine + 1,
1563
+ generatedColumn: offsetColumn + 1
1564
+ },
1565
+ consumer
1566
+ };
1567
+ });
1568
+ })
1569
+ ).then((s) => {
1570
+ that._sections = s;
1571
+ return that;
1572
+ });
1573
+ });
1574
+ }
1575
+ /**
1576
+ * The list of original sources.
1577
+ */
1578
+ get sources() {
1579
+ const sources = [];
1580
+ for (let i = 0; i < this._sections.length; i++) {
1581
+ for (let j = 0; j < this._sections[i].consumer.sources.length; j++) {
1582
+ sources.push(this._sections[i].consumer.sources[j]);
1583
+ }
1584
+ }
1585
+ return sources;
1586
+ }
1587
+ /**
1588
+ * Returns the original source, line, and column information for the generated
1589
+ * source's line and column positions provided. The only argument is an object
1590
+ * with the following properties:
1591
+ *
1592
+ * - line: The line number in the generated source. The line number
1593
+ * is 1-based.
1594
+ * - column: The column number in the generated source. The column
1595
+ * number is 0-based.
1596
+ *
1597
+ * and an object is returned with the following properties:
1598
+ *
1599
+ * - source: The original source file, or null.
1600
+ * - line: The line number in the original source, or null. The
1601
+ * line number is 1-based.
1602
+ * - column: The column number in the original source, or null. The
1603
+ * column number is 0-based.
1604
+ * - name: The original identifier, or null.
1605
+ */
1606
+ originalPositionFor(aArgs) {
1607
+ const needle = {
1608
+ generatedLine: util.getArg(aArgs, "line"),
1609
+ generatedColumn: util.getArg(aArgs, "column")
1610
+ };
1611
+ const sectionIndex = binarySearch.search(
1612
+ needle,
1613
+ this._sections,
1614
+ function(aNeedle, section2) {
1615
+ const cmp = aNeedle.generatedLine - section2.generatedOffset.generatedLine;
1616
+ if (cmp) {
1617
+ return cmp;
1618
+ }
1619
+ return aNeedle.generatedColumn - (section2.generatedOffset.generatedColumn - 1);
1620
+ }
1621
+ );
1622
+ const section = this._sections[sectionIndex];
1623
+ if (!section) {
1624
+ return {
1625
+ source: null,
1626
+ line: null,
1627
+ column: null,
1628
+ name: null
1629
+ };
1630
+ }
1631
+ return section.consumer.originalPositionFor({
1632
+ line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
1633
+ column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
1634
+ bias: aArgs.bias
1635
+ });
1636
+ }
1637
+ /**
1638
+ * Return true if we have the source content for every source in the source
1639
+ * map, false otherwise.
1640
+ */
1641
+ hasContentsOfAllSources() {
1642
+ return this._sections.every(function(s) {
1643
+ return s.consumer.hasContentsOfAllSources();
1644
+ });
1645
+ }
1646
+ /**
1647
+ * Returns the original source content. The only argument is the url of the
1648
+ * original source file. Returns null if no original source content is
1649
+ * available.
1650
+ */
1651
+ sourceContentFor(aSource, nullOnMissing) {
1652
+ for (let i = 0; i < this._sections.length; i++) {
1653
+ const section = this._sections[i];
1654
+ const content = section.consumer.sourceContentFor(aSource, true);
1655
+ if (content) {
1656
+ return content;
1657
+ }
1658
+ }
1659
+ if (nullOnMissing) {
1660
+ return null;
1661
+ }
1662
+ throw new Error('"' + aSource + '" is not in the SourceMap.');
1663
+ }
1664
+ _findSectionIndex(source) {
1665
+ for (let i = 0; i < this._sections.length; i++) {
1666
+ const { consumer } = this._sections[i];
1667
+ if (consumer._findSourceIndex(source) !== -1) {
1668
+ return i;
1669
+ }
1670
+ }
1671
+ return -1;
1672
+ }
1673
+ /**
1674
+ * Returns the generated line and column information for the original source,
1675
+ * line, and column positions provided. The only argument is an object with
1676
+ * the following properties:
1677
+ *
1678
+ * - source: The filename of the original source.
1679
+ * - line: The line number in the original source. The line number
1680
+ * is 1-based.
1681
+ * - column: The column number in the original source. The column
1682
+ * number is 0-based.
1683
+ *
1684
+ * and an object is returned with the following properties:
1685
+ *
1686
+ * - line: The line number in the generated source, or null. The
1687
+ * line number is 1-based.
1688
+ * - column: The column number in the generated source, or null.
1689
+ * The column number is 0-based.
1690
+ */
1691
+ generatedPositionFor(aArgs) {
1692
+ const index = this._findSectionIndex(util.getArg(aArgs, "source"));
1693
+ const section = index >= 0 ? this._sections[index] : null;
1694
+ const nextSection = index >= 0 && index + 1 < this._sections.length ? this._sections[index + 1] : null;
1695
+ const generatedPosition = section && section.consumer.generatedPositionFor(aArgs);
1696
+ if (generatedPosition && generatedPosition.line !== null) {
1697
+ const lineShift = section.generatedOffset.generatedLine - 1;
1698
+ const columnShift = section.generatedOffset.generatedColumn - 1;
1699
+ if (generatedPosition.line === 1) {
1700
+ generatedPosition.column += columnShift;
1701
+ if (typeof generatedPosition.lastColumn === "number") {
1702
+ generatedPosition.lastColumn += columnShift;
1703
+ }
1704
+ }
1705
+ if (generatedPosition.lastColumn === Infinity && nextSection && generatedPosition.line === nextSection.generatedOffset.generatedLine) {
1706
+ generatedPosition.lastColumn = nextSection.generatedOffset.generatedColumn - 2;
1707
+ }
1708
+ generatedPosition.line += lineShift;
1709
+ return generatedPosition;
1710
+ }
1711
+ return {
1712
+ line: null,
1713
+ column: null,
1714
+ lastColumn: null
1715
+ };
1716
+ }
1717
+ allGeneratedPositionsFor(aArgs) {
1718
+ const index = this._findSectionIndex(util.getArg(aArgs, "source"));
1719
+ const section = index >= 0 ? this._sections[index] : null;
1720
+ const nextSection = index >= 0 && index + 1 < this._sections.length ? this._sections[index + 1] : null;
1721
+ if (!section) return [];
1722
+ return section.consumer.allGeneratedPositionsFor(aArgs).map((generatedPosition) => {
1723
+ const lineShift = section.generatedOffset.generatedLine - 1;
1724
+ const columnShift = section.generatedOffset.generatedColumn - 1;
1725
+ if (generatedPosition.line === 1) {
1726
+ generatedPosition.column += columnShift;
1727
+ if (typeof generatedPosition.lastColumn === "number") {
1728
+ generatedPosition.lastColumn += columnShift;
1729
+ }
1730
+ }
1731
+ if (generatedPosition.lastColumn === Infinity && nextSection && generatedPosition.line === nextSection.generatedOffset.generatedLine) {
1732
+ generatedPosition.lastColumn = nextSection.generatedOffset.generatedColumn - 2;
1733
+ }
1734
+ generatedPosition.line += lineShift;
1735
+ return generatedPosition;
1736
+ });
1737
+ }
1738
+ eachMapping(aCallback, aContext, aOrder) {
1739
+ this._sections.forEach((section, index) => {
1740
+ const nextSection = index + 1 < this._sections.length ? this._sections[index + 1] : null;
1741
+ const { generatedOffset } = section;
1742
+ const lineShift = generatedOffset.generatedLine - 1;
1743
+ const columnShift = generatedOffset.generatedColumn - 1;
1744
+ section.consumer.eachMapping(
1745
+ function(mapping) {
1746
+ if (mapping.generatedLine === 1) {
1747
+ mapping.generatedColumn += columnShift;
1748
+ if (typeof mapping.lastGeneratedColumn === "number") {
1749
+ mapping.lastGeneratedColumn += columnShift;
1750
+ }
1751
+ }
1752
+ if (mapping.lastGeneratedColumn === Infinity && nextSection && mapping.generatedLine === nextSection.generatedOffset.generatedLine) {
1753
+ mapping.lastGeneratedColumn = nextSection.generatedOffset.generatedColumn - 2;
1754
+ }
1755
+ mapping.generatedLine += lineShift;
1756
+ aCallback.call(this, mapping);
1757
+ },
1758
+ aContext,
1759
+ aOrder
1760
+ );
1761
+ });
1762
+ }
1763
+ computeColumnSpans() {
1764
+ for (let i = 0; i < this._sections.length; i++) {
1765
+ this._sections[i].consumer.computeColumnSpans();
1766
+ }
1767
+ }
1768
+ destroy() {
1769
+ for (let i = 0; i < this._sections.length; i++) {
1770
+ this._sections[i].consumer.destroy();
1771
+ }
1772
+ }
1773
+ };
1774
+ exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
1775
+ function _factory(aSourceMap, aSourceMapURL) {
1776
+ let sourceMap = aSourceMap;
1777
+ if (typeof aSourceMap === "string") {
1778
+ sourceMap = util.parseSourceMapInput(aSourceMap);
1779
+ }
1780
+ const consumer = sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
1781
+ return Promise.resolve(consumer);
1782
+ }
1783
+ function _factoryBSM(aSourceMap, aSourceMapURL) {
1784
+ return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
1785
+ }
1786
+ }
1787
+ });
1788
+
1789
+ // node_modules/source-map/lib/source-node.js
1790
+ var require_source_node = __commonJS({
1791
+ "node_modules/source-map/lib/source-node.js"(exports) {
1792
+ var SourceMapGenerator2 = require_source_map_generator().SourceMapGenerator;
1793
+ var util = require_util();
1794
+ var REGEX_NEWLINE = /(\r?\n)/;
1795
+ var NEWLINE_CODE = 10;
1796
+ var isSourceNode = "$$$isSourceNode$$$";
1797
+ var SourceNode = class _SourceNode {
1798
+ constructor(aLine, aColumn, aSource, aChunks, aName) {
1799
+ this.children = [];
1800
+ this.sourceContents = /* @__PURE__ */ Object.create(null);
1801
+ this.line = aLine == null ? null : aLine;
1802
+ this.column = aColumn == null ? null : aColumn;
1803
+ this.source = aSource == null ? null : aSource;
1804
+ this.name = aName == null ? null : aName;
1805
+ this[isSourceNode] = true;
1806
+ if (aChunks != null) this.add(aChunks);
1807
+ }
1808
+ /**
1809
+ * Creates a SourceNode from generated code and a SourceMapConsumer.
1810
+ *
1811
+ * @param aGeneratedCode The generated code
1812
+ * @param aSourceMapConsumer The SourceMap for the generated code
1813
+ * @param aRelativePath Optional. The path that relative sources in the
1814
+ * SourceMapConsumer should be relative to.
1815
+ */
1816
+ static fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
1817
+ const node = new _SourceNode();
1818
+ const remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
1819
+ let remainingLinesIndex = 0;
1820
+ const shiftNextLine = function() {
1821
+ const lineContents = getNextLine();
1822
+ const newLine = getNextLine() || "";
1823
+ return lineContents + newLine;
1824
+ function getNextLine() {
1825
+ return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
1826
+ }
1827
+ };
1828
+ let lastGeneratedLine = 1, lastGeneratedColumn = 0;
1829
+ let lastMapping = null;
1830
+ let nextLine;
1831
+ aSourceMapConsumer.eachMapping(function(mapping) {
1832
+ if (lastMapping !== null) {
1833
+ if (lastGeneratedLine < mapping.generatedLine) {
1834
+ addMappingWithCode(lastMapping, shiftNextLine());
1835
+ lastGeneratedLine++;
1836
+ lastGeneratedColumn = 0;
1837
+ } else {
1838
+ nextLine = remainingLines[remainingLinesIndex] || "";
1839
+ const code = nextLine.substr(
1840
+ 0,
1841
+ mapping.generatedColumn - lastGeneratedColumn
1842
+ );
1843
+ remainingLines[remainingLinesIndex] = nextLine.substr(
1844
+ mapping.generatedColumn - lastGeneratedColumn
1845
+ );
1846
+ lastGeneratedColumn = mapping.generatedColumn;
1847
+ addMappingWithCode(lastMapping, code);
1848
+ lastMapping = mapping;
1849
+ return;
1850
+ }
1851
+ }
1852
+ while (lastGeneratedLine < mapping.generatedLine) {
1853
+ node.add(shiftNextLine());
1854
+ lastGeneratedLine++;
1855
+ }
1856
+ if (lastGeneratedColumn < mapping.generatedColumn) {
1857
+ nextLine = remainingLines[remainingLinesIndex] || "";
1858
+ node.add(nextLine.substr(0, mapping.generatedColumn));
1859
+ remainingLines[remainingLinesIndex] = nextLine.substr(
1860
+ mapping.generatedColumn
1861
+ );
1862
+ lastGeneratedColumn = mapping.generatedColumn;
1863
+ }
1864
+ lastMapping = mapping;
1865
+ }, this);
1866
+ if (remainingLinesIndex < remainingLines.length) {
1867
+ if (lastMapping) {
1868
+ addMappingWithCode(lastMapping, shiftNextLine());
1869
+ }
1870
+ node.add(remainingLines.splice(remainingLinesIndex).join(""));
1871
+ }
1872
+ aSourceMapConsumer.sources.forEach(function(sourceFile) {
1873
+ const content = aSourceMapConsumer.sourceContentFor(sourceFile);
1874
+ if (content != null) {
1875
+ if (aRelativePath != null) {
1876
+ sourceFile = util.join(aRelativePath, sourceFile);
1877
+ }
1878
+ node.setSourceContent(sourceFile, content);
1879
+ }
1880
+ });
1881
+ return node;
1882
+ function addMappingWithCode(mapping, code) {
1883
+ if (mapping === null || mapping.source === void 0) {
1884
+ node.add(code);
1885
+ } else {
1886
+ const source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
1887
+ node.add(
1888
+ new _SourceNode(
1889
+ mapping.originalLine,
1890
+ mapping.originalColumn,
1891
+ source,
1892
+ code,
1893
+ mapping.name
1894
+ )
1895
+ );
1896
+ }
1897
+ }
1898
+ }
1899
+ /**
1900
+ * Add a chunk of generated JS to this source node.
1901
+ *
1902
+ * @param aChunk A string snippet of generated JS code, another instance of
1903
+ * SourceNode, or an array where each member is one of those things.
1904
+ */
1905
+ add(aChunk) {
1906
+ if (Array.isArray(aChunk)) {
1907
+ aChunk.forEach(function(chunk) {
1908
+ this.add(chunk);
1909
+ }, this);
1910
+ } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
1911
+ if (aChunk) {
1912
+ this.children.push(aChunk);
1913
+ }
1914
+ } else {
1915
+ throw new TypeError(
1916
+ "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
1917
+ );
1918
+ }
1919
+ return this;
1920
+ }
1921
+ /**
1922
+ * Add a chunk of generated JS to the beginning of this source node.
1923
+ *
1924
+ * @param aChunk A string snippet of generated JS code, another instance of
1925
+ * SourceNode, or an array where each member is one of those things.
1926
+ */
1927
+ prepend(aChunk) {
1928
+ if (Array.isArray(aChunk)) {
1929
+ for (let i = aChunk.length - 1; i >= 0; i--) {
1930
+ this.prepend(aChunk[i]);
1931
+ }
1932
+ } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
1933
+ this.children.unshift(aChunk);
1934
+ } else {
1935
+ throw new TypeError(
1936
+ "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
1937
+ );
1938
+ }
1939
+ return this;
1940
+ }
1941
+ /**
1942
+ * Walk over the tree of JS snippets in this node and its children. The
1943
+ * walking function is called once for each snippet of JS and is passed that
1944
+ * snippet and the its original associated source's line/column location.
1945
+ *
1946
+ * @param aFn The traversal function.
1947
+ */
1948
+ walk(aFn) {
1949
+ let chunk;
1950
+ for (let i = 0, len = this.children.length; i < len; i++) {
1951
+ chunk = this.children[i];
1952
+ if (chunk[isSourceNode]) {
1953
+ chunk.walk(aFn);
1954
+ } else if (chunk !== "") {
1955
+ aFn(chunk, {
1956
+ source: this.source,
1957
+ line: this.line,
1958
+ column: this.column,
1959
+ name: this.name
1960
+ });
1961
+ }
1962
+ }
1963
+ }
1964
+ /**
1965
+ * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
1966
+ * each of `this.children`.
1967
+ *
1968
+ * @param aSep The separator.
1969
+ */
1970
+ join(aSep) {
1971
+ let newChildren;
1972
+ let i;
1973
+ const len = this.children.length;
1974
+ if (len > 0) {
1975
+ newChildren = [];
1976
+ for (i = 0; i < len - 1; i++) {
1977
+ newChildren.push(this.children[i]);
1978
+ newChildren.push(aSep);
1979
+ }
1980
+ newChildren.push(this.children[i]);
1981
+ this.children = newChildren;
1982
+ }
1983
+ return this;
1984
+ }
1985
+ /**
1986
+ * Call String.prototype.replace on the very right-most source snippet. Useful
1987
+ * for trimming whitespace from the end of a source node, etc.
1988
+ *
1989
+ * @param aPattern The pattern to replace.
1990
+ * @param aReplacement The thing to replace the pattern with.
1991
+ */
1992
+ replaceRight(aPattern, aReplacement) {
1993
+ const lastChild = this.children[this.children.length - 1];
1994
+ if (lastChild[isSourceNode]) {
1995
+ lastChild.replaceRight(aPattern, aReplacement);
1996
+ } else if (typeof lastChild === "string") {
1997
+ this.children[this.children.length - 1] = lastChild.replace(
1998
+ aPattern,
1999
+ aReplacement
2000
+ );
2001
+ } else {
2002
+ this.children.push("".replace(aPattern, aReplacement));
2003
+ }
2004
+ return this;
2005
+ }
2006
+ /**
2007
+ * Set the source content for a source file. This will be added to the SourceMapGenerator
2008
+ * in the sourcesContent field.
2009
+ *
2010
+ * @param aSourceFile The filename of the source file
2011
+ * @param aSourceContent The content of the source file
2012
+ */
2013
+ setSourceContent(aSourceFile, aSourceContent) {
2014
+ this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
2015
+ }
2016
+ /**
2017
+ * Walk over the tree of SourceNodes. The walking function is called for each
2018
+ * source file content and is passed the filename and source content.
2019
+ *
2020
+ * @param aFn The traversal function.
2021
+ */
2022
+ walkSourceContents(aFn) {
2023
+ for (let i = 0, len = this.children.length; i < len; i++) {
2024
+ if (this.children[i][isSourceNode]) {
2025
+ this.children[i].walkSourceContents(aFn);
2026
+ }
2027
+ }
2028
+ const sources = Object.keys(this.sourceContents);
2029
+ for (let i = 0, len = sources.length; i < len; i++) {
2030
+ aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
2031
+ }
2032
+ }
2033
+ /**
2034
+ * Return the string representation of this source node. Walks over the tree
2035
+ * and concatenates all the various snippets together to one string.
2036
+ */
2037
+ toString() {
2038
+ let str = "";
2039
+ this.walk(function(chunk) {
2040
+ str += chunk;
2041
+ });
2042
+ return str;
2043
+ }
2044
+ /**
2045
+ * Returns the string representation of this source node along with a source
2046
+ * map.
2047
+ */
2048
+ toStringWithSourceMap(aArgs) {
2049
+ const generated = {
2050
+ code: "",
2051
+ line: 1,
2052
+ column: 0
2053
+ };
2054
+ const map = new SourceMapGenerator2(aArgs);
2055
+ let sourceMappingActive = false;
2056
+ let lastOriginalSource = null;
2057
+ let lastOriginalLine = null;
2058
+ let lastOriginalColumn = null;
2059
+ let lastOriginalName = null;
2060
+ this.walk(function(chunk, original) {
2061
+ generated.code += chunk;
2062
+ if (original.source !== null && original.line !== null && original.column !== null) {
2063
+ if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
2064
+ map.addMapping({
2065
+ source: original.source,
2066
+ original: {
2067
+ line: original.line,
2068
+ column: original.column
2069
+ },
2070
+ generated: {
2071
+ line: generated.line,
2072
+ column: generated.column
2073
+ },
2074
+ name: original.name
2075
+ });
2076
+ }
2077
+ lastOriginalSource = original.source;
2078
+ lastOriginalLine = original.line;
2079
+ lastOriginalColumn = original.column;
2080
+ lastOriginalName = original.name;
2081
+ sourceMappingActive = true;
2082
+ } else if (sourceMappingActive) {
2083
+ map.addMapping({
2084
+ generated: {
2085
+ line: generated.line,
2086
+ column: generated.column
2087
+ }
2088
+ });
2089
+ lastOriginalSource = null;
2090
+ sourceMappingActive = false;
2091
+ }
2092
+ for (let idx = 0, length = chunk.length; idx < length; idx++) {
2093
+ if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
2094
+ generated.line++;
2095
+ generated.column = 0;
2096
+ if (idx + 1 === length) {
2097
+ lastOriginalSource = null;
2098
+ sourceMappingActive = false;
2099
+ } else if (sourceMappingActive) {
2100
+ map.addMapping({
2101
+ source: original.source,
2102
+ original: {
2103
+ line: original.line,
2104
+ column: original.column
2105
+ },
2106
+ generated: {
2107
+ line: generated.line,
2108
+ column: generated.column
2109
+ },
2110
+ name: original.name
2111
+ });
2112
+ }
2113
+ } else {
2114
+ generated.column++;
2115
+ }
2116
+ }
2117
+ });
2118
+ this.walkSourceContents(function(sourceFile, sourceContent) {
2119
+ map.setSourceContent(sourceFile, sourceContent);
2120
+ });
2121
+ return { code: generated.code, map };
2122
+ }
2123
+ };
2124
+ exports.SourceNode = SourceNode;
2125
+ }
2126
+ });
2127
+
2128
+ // node_modules/source-map/source-map.js
2129
+ var require_source_map = __commonJS({
2130
+ "node_modules/source-map/source-map.js"(exports) {
2131
+ exports.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
2132
+ exports.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
2133
+ exports.SourceNode = require_source_node().SourceNode;
2134
+ }
2135
+ });
2136
+
2137
+ // src/api/generated-module/module-format.ts
2138
+ function generateImportStatement(names, source, moduleFormat) {
2139
+ if (moduleFormat === "cjs") {
2140
+ return `const { ${names.join(", ")} } = require('${source}');`;
2141
+ }
2142
+ return `import { ${names.join(", ")} } from '${source}';`;
2143
+ }
2144
+ function generateFunctionExportKeyword(moduleFormat) {
2145
+ return moduleFormat === "cjs" ? "" : "export ";
2146
+ }
2147
+ function generateModuleExports(functionNames) {
2148
+ if (functionNames.length === 1) {
2149
+ return `module.exports = { ${functionNames[0]} };`;
2150
+ }
2151
+ return `module.exports = { ${functionNames.join(", ")} };`;
2152
+ }
2153
+
2154
+ // src/api/generated-module/module-writer.ts
2155
+ var import_source_map = __toESM(require_source_map(), 1);
2156
+ var ModuleWriter = class {
2157
+ constructor(workflowFunctionName, sourceFile, withSourceMap) {
2158
+ this.sourceFile = sourceFile;
2159
+ this.sourceMap = withSourceMap ? new import_source_map.SourceMapGenerator({ file: `${workflowFunctionName}.generated.ts` }) : void 0;
2160
+ }
2161
+ sourceFile;
2162
+ lines = [];
2163
+ /** The 1-based generated line the next appended text starts on. */
2164
+ currentLine = 1;
2165
+ sourceMap;
2166
+ /** Whether mappings are being recorded (a source map was asked for and there is a source file). */
2167
+ get mapsSource() {
2168
+ return this.sourceMap !== void 0 && Boolean(this.sourceFile);
2169
+ }
2170
+ /**
2171
+ * Appends a chunk of generated text, which may span several lines. Only
2172
+ * `\n` ends a line: the chunk is joined with `\n`, so that is what the
2173
+ * generated line numbers count.
2174
+ */
2175
+ push(chunk) {
2176
+ this.lines.push(chunk);
2177
+ this.currentLine += chunk.split("\n").length;
2178
+ }
2179
+ /** Maps the line the next appended text starts on to a line of the workflow source. */
2180
+ map(sourceLine, sourceColumn = 0) {
2181
+ if (this.sourceMap && this.sourceFile) {
2182
+ this.sourceMap.addMapping({
2183
+ generated: {
2184
+ line: this.currentLine,
2185
+ column: 0
2186
+ },
2187
+ source: this.sourceFile,
2188
+ original: {
2189
+ line: sourceLine,
2190
+ column: sourceColumn
2191
+ }
2192
+ });
2193
+ }
2194
+ }
2195
+ /** The module text. */
2196
+ text() {
2197
+ return this.lines.join("\n");
2198
+ }
2199
+ /**
2200
+ * The finished source map, with the workflow source's content embedded, or
2201
+ * undefined when none was asked for.
2202
+ */
2203
+ finishSourceMap(readSource) {
2204
+ if (!this.sourceMap) return void 0;
2205
+ if (this.sourceFile) {
2206
+ this.sourceMap.setSourceContent(this.sourceFile, readSource(this.sourceFile));
2207
+ }
2208
+ return this.sourceMap.toString();
2209
+ }
2210
+ };
2211
+
2212
+ // src/api/extract-types.ts
2213
+ import * as ts from "typescript";
2214
+ import * as fs from "fs";
2215
+ function extractTypeDeclarations(sourceCode) {
2216
+ const sourceFile = ts.createSourceFile(
2217
+ "temp.ts",
2218
+ sourceCode,
2219
+ ts.ScriptTarget.Latest,
2220
+ true
2221
+ );
2222
+ const interfaces = [];
2223
+ const typeAliases = [];
2224
+ const all = [];
2225
+ ts.forEachChild(sourceFile, (node) => {
2226
+ if (ts.isInterfaceDeclaration(node)) {
2227
+ const text = sourceCode.slice(node.getFullStart(), node.getEnd()).trim();
2228
+ interfaces.push(text);
2229
+ all.push({ text, pos: node.getFullStart(), kind: "interface" });
2230
+ }
2231
+ if (ts.isTypeAliasDeclaration(node)) {
2232
+ const text = sourceCode.slice(node.getFullStart(), node.getEnd()).trim();
2233
+ typeAliases.push(text);
2234
+ all.push({ text, pos: node.getFullStart(), kind: "type" });
2235
+ }
2236
+ });
2237
+ all.sort((a, b) => a.pos - b.pos);
2238
+ return {
2239
+ interfaces,
2240
+ typeAliases,
2241
+ all: all.map((item) => item.text)
2242
+ };
2243
+ }
2244
+ function extractTypeDeclarationsFromFile(filePath) {
2245
+ try {
2246
+ const sourceCode = fs.readFileSync(filePath, "utf-8");
2247
+ return extractTypeDeclarations(sourceCode);
2248
+ } catch {
2249
+ return { interfaces: [], typeAliases: [], all: [] };
2250
+ }
2251
+ }
2252
+
2253
+ // src/api/generated-module/preamble.ts
2254
+ function emitInlineRuntime(writer, production, moduleFormat) {
2255
+ writer.push(generateInlineRuntime(production, false, "typescript", moduleFormat));
2256
+ writer.push("");
2257
+ }
2258
+ function emitPreservedTypeDeclarations(writer, sourceFile) {
2259
+ if (!sourceFile) return;
2260
+ const extractedTypes = extractTypeDeclarationsFromFile(sourceFile);
2261
+ if (extractedTypes.all.length === 0) return;
2262
+ writer.push("");
2263
+ writer.push("// ============================================================================");
2264
+ writer.push("// Type Declarations (preserved from source)");
2265
+ writer.push("// ============================================================================");
2266
+ writer.push("");
2267
+ extractedTypes.all.forEach((typeDecl) => {
2268
+ writer.push(typeDecl);
2269
+ writer.push("");
2270
+ });
2271
+ }
2272
+
2273
+ // src/api/generated-module/node-type-imports.ts
2274
+ import * as path from "node:path";
2275
+ function classifyNodeTypes(ast) {
2276
+ const npmPackageNodes = ast.nodeTypes.filter((n) => n.importSource);
2277
+ const referencedNodeTypes = new Set(ast.instances.map((i) => i.nodeType));
2278
+ const localNodes = ast.nodeTypes.filter(
2279
+ (n) => !n.importSource && (n.sourceLocation?.file === ast.sourceFile || !n.sourceLocation && n.functionText && n.helperText != null && referencedNodeTypes.has(n.name))
2280
+ );
2281
+ const importedNodes = ast.nodeTypes.filter(
2282
+ (n) => !n.importSource && n.sourceLocation?.file !== ast.sourceFile
2283
+ );
2284
+ return {
2285
+ npmPackageNodes,
2286
+ importedNodes,
2287
+ localFunctions: localNodes.filter((n) => n.variant !== "IMPORTED_WORKFLOW"),
2288
+ localWorkflowNodes: localNodes.filter(
2289
+ (n) => n.variant === "IMPORTED_WORKFLOW" && referencedNodeTypes.has(n.name)
2290
+ )
2291
+ };
2292
+ }
2293
+ function emitNodeTypeImports(writer, origins, bundleMode, moduleFormat) {
2294
+ const { importedNodes, npmPackageNodes } = origins;
2295
+ if (importedNodes.length === 0 && npmPackageNodes.length === 0) return;
2296
+ const functionImportsByFile = /* @__PURE__ */ new Map();
2297
+ const workflowImportsByFile = /* @__PURE__ */ new Map();
2298
+ importedNodes.forEach((node) => {
2299
+ const sourceFile = node.sourceLocation?.file;
2300
+ if (!sourceFile) return;
2301
+ if (node.variant === "IMPORTED_WORKFLOW") {
2302
+ if (!workflowImportsByFile.has(sourceFile)) {
2303
+ workflowImportsByFile.set(sourceFile, []);
2304
+ }
2305
+ workflowImportsByFile.get(sourceFile)?.push(node.functionName);
2306
+ } else {
2307
+ if (!functionImportsByFile.has(sourceFile)) {
2308
+ functionImportsByFile.set(sourceFile, []);
2309
+ }
2310
+ functionImportsByFile.get(sourceFile)?.push(node);
2311
+ }
2312
+ });
2313
+ writer.push("");
2314
+ functionImportsByFile.forEach((nodes, sourceFile) => {
2315
+ if (bundleMode) {
2316
+ nodes.forEach((node) => {
2317
+ const lowerName = node.functionName.toLowerCase();
2318
+ const importName = `${lowerName}_impl as ${node.functionName}`;
2319
+ writer.push(generateImportStatement([importName], `../node-types/${lowerName}.js`, moduleFormat));
2320
+ });
2321
+ } else {
2322
+ const generatedFileName = path.basename(sourceFile, ".ts") + ".generated";
2323
+ const names = nodes.map((n) => n.functionName);
2324
+ writer.push(generateImportStatement(names, `./${generatedFileName}`, moduleFormat));
2325
+ }
2326
+ });
2327
+ workflowImportsByFile.forEach((names, sourceFile) => {
2328
+ if (bundleMode) {
2329
+ names.forEach((name) => {
2330
+ writer.push(generateImportStatement([name], `./${name}.js`, moduleFormat));
2331
+ });
2332
+ } else {
2333
+ const sourceFileName = path.basename(sourceFile, ".ts");
2334
+ const generatedFileName = sourceFileName.includes(".generated") ? sourceFileName : sourceFileName + ".generated";
2335
+ writer.push(generateImportStatement(names, `./${generatedFileName}`, moduleFormat));
2336
+ }
2337
+ });
2338
+ const npmImportsByPackage = /* @__PURE__ */ new Map();
2339
+ npmPackageNodes.forEach((node) => {
2340
+ const pkg = node.importSource;
2341
+ if (!npmImportsByPackage.has(pkg)) npmImportsByPackage.set(pkg, []);
2342
+ npmImportsByPackage.get(pkg).push(node.functionName);
2343
+ });
2344
+ npmImportsByPackage.forEach((names, pkg) => {
2345
+ writer.push(generateImportStatement(names, pkg, moduleFormat));
2346
+ });
2347
+ writer.push("");
2348
+ }
2349
+
2350
+ // src/api/generated-module/local-node-functions.ts
2351
+ function emitSourceConstants(writer, constants, localFunctions) {
2352
+ if (constants.length === 0 || localFunctions.length === 0) return;
2353
+ writer.push("");
2354
+ writer.push("// Constants from source file");
2355
+ constants.forEach((constant) => writer.push(constant));
2356
+ }
2357
+ function emitLocalNodeFunctions(writer, localFunctions, externalNodeTypes, moduleFormat, production) {
2358
+ const externalFunctions = localFunctions.filter((n) => externalNodeTypes[n.name]);
2359
+ const inlineFunctions = localFunctions.filter((n) => !externalNodeTypes[n.name]);
2360
+ if (externalFunctions.length > 0) {
2361
+ writer.push("");
2362
+ externalFunctions.forEach((node) => {
2363
+ const importName = `${node.functionName.toLowerCase()}_impl as ${node.functionName}`;
2364
+ writer.push(generateImportStatement([importName], externalNodeTypes[node.name], moduleFormat));
2365
+ });
2366
+ }
2367
+ if (inlineFunctions.length > 0) {
2368
+ writer.push("");
2369
+ emitSharedHelpers(writer, inlineFunctions, production);
2370
+ inlineFunctions.forEach((node) => {
2371
+ if (node.importSource) return;
2372
+ const functionText = production && node.functionTextProduction != null ? node.functionTextProduction : node.functionText;
2373
+ if (!functionText) return;
2374
+ if (node.sourceLocation) {
2375
+ writer.map(node.sourceLocation.line, node.sourceLocation.column);
2376
+ }
2377
+ writer.push(removeDecorators(functionText));
2378
+ writer.push("");
2379
+ });
2380
+ }
2381
+ }
2382
+ function emitSharedHelpers(writer, inlineFunctions, production) {
2383
+ const emittedHelpers = /* @__PURE__ */ new Set();
2384
+ inlineFunctions.forEach((node) => {
2385
+ if (node.importSource) return;
2386
+ const helperText = production ? node.helperTextProduction ?? null : node.helperText ?? null;
2387
+ if (helperText && !emittedHelpers.has(helperText)) {
2388
+ emittedHelpers.add(helperText);
2389
+ writer.push(helperText);
2390
+ writer.push("");
2391
+ }
2392
+ });
2393
+ }
2394
+ function removeDecorators(functionText) {
2395
+ return functionText.replace(/@\w+\({[\s\S]*?}\)\s*/g, "");
2396
+ }
2397
+
2398
+ // src/api/generated-module/workflow-functions.ts
2399
+ import * as fs2 from "fs";
2400
+ function workflowSignature(workflow, keywords, shouldBeAsync) {
2401
+ const exitPorts = extractExitPorts(workflow);
2402
+ const workflowHasBranching = hasBranching(workflow);
2403
+ const returnTypes = [];
2404
+ Object.entries(exitPorts).forEach(([portName, portDef]) => {
2405
+ const optional = workflowHasBranching ? "?" : "";
2406
+ const tsType = mapToTypeScript(portDef.dataType, portDef.tsType);
2407
+ returnTypes.push(`${portName}${optional}: ${tsType}`);
2408
+ });
2409
+ const returnTypeInner = `{ ${returnTypes.join("; ")} }`;
2410
+ const returnType = shouldBeAsync ? `Promise<${returnTypeInner}>` : returnTypeInner;
2411
+ return [
2412
+ `${keywords}function ${workflow.functionName}(`,
2413
+ // STEP Port Architecture: execute is first parameter
2414
+ ` execute: boolean = true,`,
2415
+ // Record<string, unknown> keeps the function compatible with HTTP handlers
2416
+ ` params: Record<string, unknown> = {},`,
2417
+ // One execution-scoped runtime carries cancellation, tracing, services and
2418
+ // continuation state. It is deliberately required in the v2 generated ABI.
2419
+ ` __runtime__: WorkflowRuntime`,
2420
+ `): ${returnType} {`
2421
+ ];
2422
+ }
2423
+ function asyncKeyword(shouldBeAsync, production) {
2424
+ return shouldBeAsync || !production ? "async " : "";
2425
+ }
2426
+ function emitWorkflowFunction(writer, ast, functionBody, shouldBeAsync, production, moduleFormat) {
2427
+ writer.push("");
2428
+ if (writer.mapsSource && ast.sourceFile) {
2429
+ try {
2430
+ const sourceLines = fs2.readFileSync(ast.sourceFile, "utf-8").split(/\r?\n/);
2431
+ const exportLineIndex = sourceLines.findIndex(
2432
+ (line) => line.includes(`export`) && line.includes(`function ${ast.functionName}`)
2433
+ );
2434
+ if (exportLineIndex >= 0) {
2435
+ writer.map(exportLineIndex + 1, 0);
2436
+ }
2437
+ } catch {
2438
+ }
2439
+ }
2440
+ const keywords = generateFunctionExportKeyword(moduleFormat) + asyncKeyword(shouldBeAsync, production);
2441
+ workflowSignature(ast, keywords, shouldBeAsync).forEach((line) => writer.push(line));
2442
+ writer.push(functionBody);
2443
+ writer.push("}");
2444
+ }
2445
+ function emitLocalWorkflowDependencies(writer, ast, localWorkflowNodes, allWorkflows, production, durableSequential) {
2446
+ if (localWorkflowNodes.length === 0 || allWorkflows.length === 0) return;
2447
+ const generatedWorkflows = /* @__PURE__ */ new Set([ast.functionName]);
2448
+ writer.push("");
2449
+ writer.push("// ============================================================================");
2450
+ writer.push("// Local Workflow Dependencies");
2451
+ writer.push("// ============================================================================");
2452
+ for (const node of localWorkflowNodes) {
2453
+ if (generatedWorkflows.has(node.functionName)) {
2454
+ continue;
2455
+ }
2456
+ const depWorkflow = allWorkflows.find((w) => w.functionName === node.functionName);
2457
+ if (!depWorkflow) {
2458
+ writer.push(`// WARNING: Could not find workflow AST for ${node.functionName}`);
2459
+ continue;
2460
+ }
2461
+ writer.push(generateWorkflowFunction(depWorkflow, production, allWorkflows, generatedWorkflows, durableSequential));
2462
+ writer.push("");
2463
+ generatedWorkflows.add(node.functionName);
2464
+ }
2465
+ }
2466
+ function generateWorkflowFunction(workflow, production, allWorkflows, generatedWorkflows, durableSequential) {
2467
+ const lines = [];
2468
+ generatedWorkflows.add(workflow.functionName);
2469
+ const usedNodeTypeNames = new Set(workflow.instances.map((i) => i.nodeType));
2470
+ const localWorkflowDeps = workflow.nodeTypes.filter(
2471
+ (n) => n.variant === "IMPORTED_WORKFLOW" && n.sourceLocation?.file === workflow.sourceFile && usedNodeTypeNames.has(n.name) && !generatedWorkflows.has(n.functionName)
2472
+ );
2473
+ for (const dep of localWorkflowDeps) {
2474
+ const depWorkflow = allWorkflows.find((w) => w.functionName === dep.functionName);
2475
+ if (depWorkflow) {
2476
+ lines.push(generateWorkflowFunction(depWorkflow, production, allWorkflows, generatedWorkflows, durableSequential));
2477
+ lines.push("");
2478
+ }
2479
+ }
2480
+ const { shouldBeAsync } = validateWorkflowAsync(workflow, workflow.nodeTypes);
2481
+ const functionBody = bodyGenerator.generateWithExecutionContext(
2482
+ workflow,
2483
+ workflow.nodeTypes,
2484
+ shouldBeAsync,
2485
+ production,
2486
+ false,
2487
+ durableSequential,
2488
+ durableSequential ? { graphFingerprint: graphIdentity(workflow, allWorkflows).graphFingerprint } : void 0
2489
+ );
2490
+ lines.push(...workflowSignature(workflow, asyncKeyword(shouldBeAsync, production), shouldBeAsync));
2491
+ lines.push(functionBody);
2492
+ lines.push("}");
2493
+ return lines.join("\n");
2494
+ }
2495
+
2496
+ // src/api/generate.ts
2497
+ import * as fs3 from "fs";
2498
+ function generateCode(ast, options) {
2499
+ const {
2500
+ production = false,
2501
+ sourceMap = false,
2502
+ allWorkflows = [],
2503
+ moduleFormat = "esm",
2504
+ bundleMode = false,
2505
+ constants = [],
2506
+ externalNodeTypes = {},
2507
+ generateStubs = false,
2508
+ outputFormat = "typescript"
2509
+ } = options || {};
2510
+ const durableSequential = validateDurableClosure(
2511
+ ast,
2512
+ allWorkflows
2513
+ ).hasDurableGate;
2514
+ const identity = durableSequential ? { graphFingerprint: graphIdentity(ast, allWorkflows).graphFingerprint } : void 0;
2515
+ assertNoStubNodes(ast, generateStubs);
2516
+ const { shouldBeAsync, warning } = validateWorkflowAsync(ast, ast.nodeTypes);
2517
+ if (warning && !production) {
2518
+ console.warn(warning);
2519
+ }
2520
+ const functionBody = bodyGenerator.generateWithExecutionContext(
2521
+ ast,
2522
+ ast.nodeTypes,
2523
+ shouldBeAsync,
2524
+ production,
2525
+ bundleMode,
2526
+ durableSequential,
2527
+ identity
2528
+ );
2529
+ const writer = new ModuleWriter(ast.functionName, ast.sourceFile, sourceMap);
2530
+ writer.push("");
2531
+ writer.push("");
2532
+ emitInlineRuntime(writer, production, moduleFormat);
2533
+ emitPreservedTypeDeclarations(writer, ast.sourceFile);
2534
+ const origins = classifyNodeTypes(ast);
2535
+ emitNodeTypeImports(writer, origins, bundleMode, moduleFormat);
2536
+ emitSourceConstants(writer, constants, origins.localFunctions);
2537
+ emitLocalNodeFunctions(writer, origins.localFunctions, externalNodeTypes, moduleFormat, production);
2538
+ emitLocalWorkflowDependencies(writer, ast, origins.localWorkflowNodes, allWorkflows, production, durableSequential);
2539
+ emitWorkflowFunction(writer, ast, functionBody, shouldBeAsync, production, moduleFormat);
2540
+ if (moduleFormat === "cjs") {
2541
+ writer.push("");
2542
+ writer.push(generateModuleExports([ast.functionName, ...INLINE_ENGINE_EXPORTS]));
2543
+ }
2544
+ let code = writer.text();
2545
+ if (outputFormat === "javascript") {
2546
+ code = stripTypeScript(code);
2547
+ }
2548
+ const map = writer.finishSourceMap((file) => fs3.readFileSync(file, "utf8"));
2549
+ if (sourceMap && map !== void 0) {
2550
+ return { code, sourceMap: map };
2551
+ }
2552
+ return code;
2553
+ }
2554
+ function assertNoStubNodes(ast, generateStubs) {
2555
+ const stubNodeTypes = ast.nodeTypes.filter((nt) => nt.variant === "STUB");
2556
+ if (stubNodeTypes.length > 0 && !generateStubs) {
2557
+ const stubNames = stubNodeTypes.map((nt) => nt.functionName).join(", ");
2558
+ throw new Error(
2559
+ `Cannot generate code: workflow has ${stubNodeTypes.length} stub node(s) without implementation: ${stubNames}. Implement them or pass { generateStubs: true } to emit placeholder throws.`
2560
+ );
2561
+ }
2562
+ }
2563
+
2564
+ // src/api/compile.ts
2565
+ import * as fs4 from "node:fs/promises";
2566
+ import * as path2 from "node:path";
2567
+
2568
+ // src/compiler/durable-source-proof.ts
2569
+ import ts2 from "typescript";
2570
+ var authenticProofs = /* @__PURE__ */ new WeakSet();
2571
+ var DurableSourceProof = class _DurableSourceProof {
2572
+ effects;
2573
+ constructor(effects) {
2574
+ this.effects = Object.freeze(effects.map((effect) => Object.freeze(effect)));
2575
+ authenticProofs.add(this);
2576
+ Object.freeze(this);
2577
+ }
2578
+ static create(parsed, source) {
2579
+ validateDurableClosure(parsed.ast, parsed.allWorkflows);
2580
+ const effects = durableEffects(parsed).map((effect) => ({
2581
+ functionName: effect.functionName,
2582
+ inputs: Object.freeze(Object.keys(effect.inputs).sort()),
2583
+ outputs: Object.freeze(Object.keys(effect.outputs).sort()),
2584
+ binding: effectReturnBinding(source, effect.functionName, Object.keys(effect.outputs))
2585
+ }));
2586
+ return new _DurableSourceProof(effects);
2587
+ }
2588
+ };
2589
+ function applyDurableSourceProof(proof, parsed, flattenedSource) {
2590
+ if (!authenticProofs.has(proof)) throw new Error("durable source proof was not issued by this compiler");
2591
+ const actual = durableEffects(parsed);
2592
+ const actualNames = actual.map((effect) => effect.functionName).sort();
2593
+ const expectedNames = proof.effects.map((effect) => effect.functionName).sort();
2594
+ if (actualNames.join(",") !== expectedNames.join(",")) {
2595
+ throw new Error(`flattened durable effect set differs from typed source: expected ${expectedNames.join(", ")}, got ${actualNames.join(", ")}`);
2596
+ }
2597
+ for (const expected of proof.effects) {
2598
+ const effect = actual.find((candidate) => candidate.functionName === expected.functionName);
2599
+ if (!effect) throw new Error(`flattened source lost durable effect ${expected.functionName}`);
2600
+ const inputs = Object.keys(effect.inputs).sort();
2601
+ const outputs = Object.keys(effect.outputs).sort();
2602
+ if (inputs.join(",") !== expected.inputs.join(",") || outputs.join(",") !== expected.outputs.join(",")) {
2603
+ throw new Error(`flattened durable effect ${expected.functionName} ports differ from typed source`);
2604
+ }
2605
+ const binding = effectReturnBinding(flattenedSource, effect.functionName, outputs);
2606
+ if (JSON.stringify(binding) !== JSON.stringify(expected.binding)) {
2607
+ throw new Error(`flattened durable effect ${expected.functionName} return binding differs from typed source`);
2608
+ }
2609
+ effect.durableEffectContract = { valid: true, diagnostics: [] };
2610
+ }
2611
+ }
2612
+ function durableEffects(parsed) {
2613
+ const byName = /* @__PURE__ */ new Map();
2614
+ for (const workflow of parsed.allWorkflows) {
2615
+ for (const nodeType of workflow.nodeTypes) {
2616
+ if (nodeType.durableEffect === true) byName.set(nodeType.functionName, nodeType);
2617
+ }
2618
+ }
2619
+ for (const nodeType of parsed.ast.nodeTypes) {
2620
+ if (nodeType.durableEffect === true) byName.set(nodeType.functionName, nodeType);
2621
+ }
2622
+ return [...byName.values()].sort((left, right) => left.functionName.localeCompare(right.functionName));
2623
+ }
2624
+ function effectReturnBinding(source, functionName, outputNames) {
2625
+ const file = ts2.createSourceFile("durable-source.ts", source, ts2.ScriptTarget.Latest, true, ts2.ScriptKind.TS);
2626
+ const fn = file.statements.find((statement) => ts2.isFunctionDeclaration(statement) && statement.name?.text === functionName);
2627
+ if (!fn?.body) throw new Error(`durable effect ${functionName} has no concrete function body`);
2628
+ const operationKey = fn.parameters.at(-1)?.name;
2629
+ if (!operationKey || !ts2.isIdentifier(operationKey)) {
2630
+ throw new Error(`durable effect ${functionName} has no identifier operation key parameter`);
2631
+ }
2632
+ const returns = [];
2633
+ const visit = (node) => {
2634
+ if (node !== fn && ts2.isFunctionLike(node)) return;
2635
+ if (ts2.isReturnStatement(node)) returns.push(node);
2636
+ ts2.forEachChild(node, visit);
2637
+ };
2638
+ visit(fn.body);
2639
+ if (returns.length === 0) throw new Error(`durable effect ${functionName} has no return path`);
2640
+ const bindings = returns.map((statement) => bindingForExpression(
2641
+ statement.expression,
2642
+ operationKey.text,
2643
+ outputNames,
2644
+ functionName
2645
+ ));
2646
+ const first = bindings[0];
2647
+ if (bindings.some((binding) => JSON.stringify(binding) !== JSON.stringify(first))) {
2648
+ throw new Error(`durable effect ${functionName} has inconsistent return bindings`);
2649
+ }
2650
+ return first;
2651
+ }
2652
+ function bindingForExpression(expression, operationKey, outputNames, functionName) {
2653
+ if (expression && ts2.isObjectLiteralExpression(expression)) {
2654
+ const envelope = objectProperties(expression, `${functionName} return envelope`);
2655
+ if ([...envelope.keys()].sort().join(",") !== "receipt,result") {
2656
+ throw new Error(`durable effect ${functionName} must return exactly receipt and result`);
2657
+ }
2658
+ const receipt = envelope.get("receipt");
2659
+ const result = envelope.get("result");
2660
+ if (!receipt || !ts2.isObjectLiteralExpression(receipt) || !result || !ts2.isObjectLiteralExpression(result)) {
2661
+ throw new Error(`durable effect ${functionName} direct return must contain receipt/result object literals`);
2662
+ }
2663
+ const receiptProperties = objectProperties(receipt, `${functionName} receipt`);
2664
+ const key = receiptProperties.get("operationKey");
2665
+ if (!key || !ts2.isIdentifier(key) || key.text !== operationKey) {
2666
+ throw new Error(`durable effect ${functionName} receipt is not bound to operationKey`);
2667
+ }
2668
+ const resultKeys = [...objectProperties(result, `${functionName} result`).keys()].sort();
2669
+ assertResultKeys(functionName, resultKeys, outputNames);
2670
+ return Object.freeze({ kind: "object", resultKeys: Object.freeze(resultKeys) });
2671
+ }
2672
+ if (expression && ts2.isCallExpression(expression) && ts2.isIdentifier(expression.expression)) {
2673
+ const operationKeyIndex = expression.arguments.findIndex(
2674
+ (argument) => ts2.isIdentifier(argument) && argument.text === operationKey
2675
+ );
2676
+ const resultIndex = expression.arguments.findIndex((argument) => {
2677
+ if (!ts2.isObjectLiteralExpression(argument)) return false;
2678
+ const keys = [...objectProperties(argument, `${functionName} result argument`).keys()].sort();
2679
+ return keys.join(",") === [...outputNames].sort().join(",");
2680
+ });
2681
+ if (operationKeyIndex < 0 || resultIndex < 0) {
2682
+ throw new Error(`durable effect ${functionName} helper call is not bound to operationKey and exact result fields`);
2683
+ }
2684
+ const result = expression.arguments[resultIndex];
2685
+ const resultKeys = [...objectProperties(result, `${functionName} result argument`).keys()].sort();
2686
+ return Object.freeze({
2687
+ kind: "call",
2688
+ callee: expression.expression.text,
2689
+ operationKeyIndex,
2690
+ resultIndex,
2691
+ resultKeys: Object.freeze(resultKeys)
2692
+ });
2693
+ }
2694
+ throw new Error(`durable effect ${functionName} return path is not a canonical envelope`);
2695
+ }
2696
+ function objectProperties(object, label) {
2697
+ const properties = /* @__PURE__ */ new Map();
2698
+ for (const property of object.properties) {
2699
+ if (ts2.isShorthandPropertyAssignment(property)) {
2700
+ properties.set(property.name.text, property.name);
2701
+ continue;
2702
+ }
2703
+ if (!ts2.isPropertyAssignment(property) || !ts2.isIdentifier(property.name)) {
2704
+ throw new Error(`${label} must use explicit identifier properties without spreads`);
2705
+ }
2706
+ properties.set(property.name.text, property.initializer);
2707
+ }
2708
+ return properties;
2709
+ }
2710
+ function assertResultKeys(functionName, actual, expected) {
2711
+ if ([...actual].sort().join(",") !== [...expected].sort().join(",")) {
2712
+ throw new Error(`durable effect ${functionName} result fields differ from declared outputs`);
2713
+ }
2714
+ }
2715
+
2716
+ // src/api/compile.ts
2717
+ async function compileWorkflow(filePath, options = {}) {
2718
+ const startTime = Date.now();
2719
+ const { inPlace = true } = options;
2720
+ const parseResult = await parseWorkflow(filePath, options.parse);
2721
+ if (parseResult.errors.length > 0) {
2722
+ throw new Error(`Parse errors:
2723
+ ${parseResult.errors.join("\n")}`);
2724
+ }
2725
+ if (options.durableSourceProof !== void 0) {
2726
+ if (options.durableFlattenedSource === void 0) {
2727
+ throw new Error("durableFlattenedSource is required with durableSourceProof");
2728
+ }
2729
+ applyDurableSourceProof(
2730
+ options.durableSourceProof,
2731
+ parseResult,
2732
+ options.durableFlattenedSource
2733
+ );
2734
+ }
2735
+ validateDurableClosure(parseResult.ast, parseResult.allWorkflows);
2736
+ const { validateWorkflow } = await import("./flow-weaver-validate-A4UWDQN6.mjs");
2737
+ const validationMode = options.validationMode;
2738
+ const validationResult = validateWorkflow(parseResult.ast, validationMode ? { mode: validationMode } : void 0);
2739
+ if (validationResult.errors.length > 0) {
2740
+ const errorMessages = validationResult.errors.map(
2741
+ (e) => typeof e === "string" ? e : e.message
2742
+ );
2743
+ throw new Error(`Validation errors:
2744
+ ${errorMessages.join("\n")}`);
2745
+ }
2746
+ let code;
2747
+ let outputFile;
2748
+ if (inPlace) {
2749
+ const sourceCode = await fs4.readFile(filePath, "utf-8");
2750
+ const result2 = generateInPlace(sourceCode, parseResult.ast, {
2751
+ ...options.generate,
2752
+ allWorkflows: parseResult.allWorkflows,
2753
+ sourceFile: options.generate?.sourceFile || path2.resolve(filePath)
2754
+ });
2755
+ code = result2.code;
2756
+ outputFile = filePath;
2757
+ if (options.write !== false) {
2758
+ await fs4.writeFile(filePath, code, "utf-8");
2759
+ }
2760
+ } else {
2761
+ code = generateCode(parseResult.ast, {
2762
+ ...options.generate,
2763
+ allWorkflows: parseResult.allWorkflows
2764
+ });
2765
+ outputFile = options.outputFile || getDefaultOutputFile(filePath);
2766
+ if (options.write !== false) {
2767
+ await fs4.writeFile(outputFile, code, "utf-8");
2768
+ }
2769
+ }
2770
+ if (options.saveAST) {
2771
+ const { saveASTAlongside } = await import("./flow-weaver-serialization-node-LE6PCG4M.mjs");
2772
+ await saveASTAlongside(parseResult.ast);
2773
+ }
2774
+ const result = {
2775
+ code,
2776
+ ast: parseResult.ast,
2777
+ analysis: {
2778
+ controlFlowGraph: { nodes: [], edges: [], inDegree: {}, outDegree: {} },
2779
+ executionOrder: [],
2780
+ branchingNodes: [],
2781
+ branchRegions: [],
2782
+ mergeNodes: [],
2783
+ // What validation said about the workflow it just compiled: the
2784
+ // warnings a caller (fw_compile, the console) shows next to the code.
2785
+ errors: validationResult.errors,
2786
+ warnings: validationResult.warnings,
2787
+ unusedNodes: [],
2788
+ inlineCandidates: []
2789
+ },
2790
+ metadata: {
2791
+ sourceFile: filePath,
2792
+ outputFile,
2793
+ compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
2794
+ compilerVersion: VERSION,
2795
+ generationTime: Date.now() - startTime
2796
+ }
2797
+ };
2798
+ return result;
2799
+ }
2800
+ function getDefaultOutputFile(sourceFile) {
2801
+ const dir = path2.dirname(sourceFile);
2802
+ const basename3 = path2.basename(sourceFile, ".ts");
2803
+ return path2.join(dir, `${basename3}.generated.ts`);
2804
+ }
2805
+
2806
+ export {
2807
+ generateCode,
2808
+ DurableSourceProof,
2809
+ applyDurableSourceProof,
2810
+ compileWorkflow
2811
+ };