waygraph 0.15.47 → 0.15.50

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 (364) hide show
  1. package/dist/analysis/graph.js +2 -2
  2. package/dist/auto-session/session.js +3 -3
  3. package/dist/cli/discover.d.ts +1 -1
  4. package/dist/cli/discover.js +1 -1
  5. package/dist/cli/flags.d.ts +7 -5
  6. package/dist/cli/flags.js +9 -32
  7. package/dist/cli/run-chain.js +1 -1
  8. package/dist/cli.js +1 -1
  9. package/dist/{agent-dive.js → commands/agent-dive-scaffold.js} +2 -2
  10. package/dist/commands/agent-dive.js +1 -1
  11. package/dist/commands/check.js +1 -1
  12. package/dist/commands/run.js +4 -4
  13. package/dist/commands/session.js +7 -7
  14. package/dist/config.d.ts +34 -0
  15. package/dist/config.js +94 -0
  16. package/dist/{engine/core.js → core/block.js} +6 -6
  17. package/dist/core/blocks/api.d.ts +54 -0
  18. package/dist/core/blocks/api.js +75 -0
  19. package/dist/{engine → core}/blocks/effect.d.ts +1 -1
  20. package/dist/{engine → core}/blocks/effect.js +1 -1
  21. package/dist/{engine → core}/blocks/method.d.ts +1 -1
  22. package/dist/{engine → core}/blocks/method.js +1 -1
  23. package/dist/{engine → core}/blocks/nav.js +1 -1
  24. package/dist/{engine → core}/blocks/page.js +1 -1
  25. package/dist/{engine → core}/branch-regression.js +2 -3
  26. package/dist/{engine → core}/compose.js +4 -4
  27. package/dist/{engine/engine-class.d.ts → core/engine.d.ts} +2 -133
  28. package/dist/core/engine.js +50 -0
  29. package/dist/{engine → core}/flow.js +5 -5
  30. package/dist/core/map-builder.d.ts +171 -0
  31. package/dist/{engine/engine-class.js → core/map-builder.js} +82 -98
  32. package/dist/{engine → core}/run-graph.js +4 -6
  33. package/dist/core.d.ts +14 -0
  34. package/dist/core.js +15 -0
  35. package/dist/env-file.d.ts +10 -0
  36. package/dist/env-file.js +58 -0
  37. package/dist/errors.d.ts +54 -20
  38. package/dist/errors.js +67 -20
  39. package/dist/highlights/run-phase.js +15 -2
  40. package/dist/highlights/stub-ctx.js +16 -0
  41. package/dist/highlights/types.d.ts +38 -0
  42. package/dist/index.d.ts +7 -3
  43. package/dist/index.js +2 -1
  44. package/dist/mem-page.js +2 -2
  45. package/dist/mem-stub.d.ts +1 -1
  46. package/dist/pilot-overlay/fixtures.js +42 -10
  47. package/dist/pilot-overlay/shell.js +23 -10
  48. package/dist/runner/banner-log.js +1 -0
  49. package/dist/runner/device-stage.js +35 -15
  50. package/dist/runner/inpage/banner.d.ts +9 -1
  51. package/dist/runner/inpage/banner.js +27 -2
  52. package/dist/runner/inpage/caption.d.ts +3 -0
  53. package/dist/runner/inpage/caption.js +23 -0
  54. package/dist/runner/inpage/core.js +32 -9
  55. package/dist/runner/inpage/network.d.ts +15 -0
  56. package/dist/runner/inpage/network.js +217 -0
  57. package/dist/runner/inpage/panel-chrome.js +41 -1
  58. package/dist/runner/inpage/swipe-zoom.js +1 -1
  59. package/dist/runner/inpage/todos.js +6 -1
  60. package/dist/runner/main.js +9 -2
  61. package/dist/runner/network-capture.d.ts +9 -0
  62. package/dist/runner/network-capture.js +126 -0
  63. package/dist/runner/overlay-css.js +71 -7
  64. package/dist/runner/overlay-install.js +39 -2
  65. package/dist/runner/overlay-stage.js +5 -0
  66. package/dist/runner/rings.js +69 -45
  67. package/dist/runner/slides.js +14 -8
  68. package/dist/runner/step-mode.js +12 -0
  69. package/dist/runner/step-panels.js +9 -3
  70. package/dist/runner/teardown.js +16 -9
  71. package/dist/session/auto-explore-run.d.ts +5 -2
  72. package/dist/session/auto-explore-run.js +52 -36
  73. package/dist/{step-overlay.d.ts → session/step-overlay.d.ts} +1 -1
  74. package/dist/{step-overlay.js → session/step-overlay.js} +1 -1
  75. package/dist/trait.d.ts +1 -0
  76. package/dist/trait.js +15 -0
  77. package/dist/traverse/run.js +3 -22
  78. package/dist/ui/components/ring.js +4 -2
  79. package/dist/ui/overlay.css +36 -3
  80. package/examples/saucedemo/.waygraph-auto/00d147d1.log +21 -0
  81. package/examples/saucedemo/.waygraph-auto/0402cfcf.log +6 -0
  82. package/examples/saucedemo/.waygraph-auto/062b581f.log +20 -0
  83. package/examples/saucedemo/.waygraph-auto/0681582b.log +6 -0
  84. package/examples/saucedemo/.waygraph-auto/07f3e964.log +6 -0
  85. package/examples/saucedemo/.waygraph-auto/0868ae4d.log +0 -0
  86. package/examples/saucedemo/.waygraph-auto/0924ddaa.log +22 -0
  87. package/examples/saucedemo/.waygraph-auto/092d6173.log +5 -0
  88. package/examples/saucedemo/.waygraph-auto/09924510.log +0 -0
  89. package/examples/saucedemo/.waygraph-auto/0998c941.log +21 -0
  90. package/examples/saucedemo/.waygraph-auto/0bf74300.log +21 -0
  91. package/examples/saucedemo/.waygraph-auto/0c01fd29.log +4 -0
  92. package/examples/saucedemo/.waygraph-auto/0c302590.log +0 -0
  93. package/examples/saucedemo/.waygraph-auto/0dee62d6.log +5 -0
  94. package/examples/saucedemo/.waygraph-auto/0eb4c081.log +5 -0
  95. package/examples/saucedemo/.waygraph-auto/10fd431c.log +0 -0
  96. package/examples/saucedemo/.waygraph-auto/13c6fe3c.log +0 -0
  97. package/examples/saucedemo/.waygraph-auto/1581b677.log +0 -0
  98. package/examples/saucedemo/.waygraph-auto/161cc8dd.log +22 -0
  99. package/examples/saucedemo/.waygraph-auto/164761a5.log +6 -0
  100. package/examples/saucedemo/.waygraph-auto/1905ceb2.log +0 -0
  101. package/examples/saucedemo/.waygraph-auto/1b1d55c6.log +0 -0
  102. package/examples/saucedemo/.waygraph-auto/1b80fd24.log +6 -0
  103. package/examples/saucedemo/.waygraph-auto/1c30a3c2.log +0 -0
  104. package/examples/saucedemo/.waygraph-auto/1d90aa9a.log +0 -0
  105. package/examples/saucedemo/.waygraph-auto/1de7d889.log +0 -0
  106. package/examples/saucedemo/.waygraph-auto/1f233a4c.log +6 -0
  107. package/examples/saucedemo/.waygraph-auto/20e66801.log +0 -0
  108. package/examples/saucedemo/.waygraph-auto/20ffdb77.log +0 -0
  109. package/examples/saucedemo/.waygraph-auto/22048fff.log +4 -0
  110. package/examples/saucedemo/.waygraph-auto/22f1a704.log +5 -0
  111. package/examples/saucedemo/.waygraph-auto/239cced3.log +20 -0
  112. package/examples/saucedemo/.waygraph-auto/25204b46.log +4 -0
  113. package/examples/saucedemo/.waygraph-auto/25e2e90f.log +0 -0
  114. package/examples/saucedemo/.waygraph-auto/2708455e.log +22 -0
  115. package/examples/saucedemo/.waygraph-auto/272a96fd.log +20 -0
  116. package/examples/saucedemo/.waygraph-auto/28d7be5d.log +0 -0
  117. package/examples/saucedemo/.waygraph-auto/2a6a8266.log +6 -0
  118. package/examples/saucedemo/.waygraph-auto/2b3401cf.log +20 -0
  119. package/examples/saucedemo/.waygraph-auto/2ceccd6d.log +0 -0
  120. package/examples/saucedemo/.waygraph-auto/2f1b0c13.log +6 -0
  121. package/examples/saucedemo/.waygraph-auto/2f8d4073.log +6 -0
  122. package/examples/saucedemo/.waygraph-auto/30739278.log +6 -0
  123. package/examples/saucedemo/.waygraph-auto/31cb2e80.log +0 -0
  124. package/examples/saucedemo/.waygraph-auto/322d63cd.log +0 -0
  125. package/examples/saucedemo/.waygraph-auto/3239aa8a.log +6 -0
  126. package/examples/saucedemo/.waygraph-auto/326d87b7.log +6 -0
  127. package/examples/saucedemo/.waygraph-auto/3351c0b6.log +0 -0
  128. package/examples/saucedemo/.waygraph-auto/33df0770.log +0 -0
  129. package/examples/saucedemo/.waygraph-auto/340d624d.log +0 -0
  130. package/examples/saucedemo/.waygraph-auto/36367ccf.log +0 -0
  131. package/examples/saucedemo/.waygraph-auto/372536a5.log +6 -0
  132. package/examples/saucedemo/.waygraph-auto/3a412f3c.log +0 -0
  133. package/examples/saucedemo/.waygraph-auto/3a859bd7.log +0 -0
  134. package/examples/saucedemo/.waygraph-auto/3cb0add7.log +0 -0
  135. package/examples/saucedemo/.waygraph-auto/3e42f0d8.log +0 -0
  136. package/examples/saucedemo/.waygraph-auto/4144071d.log +0 -0
  137. package/examples/saucedemo/.waygraph-auto/4176a3c6.log +0 -0
  138. package/examples/saucedemo/.waygraph-auto/41d0793d.log +4 -0
  139. package/examples/saucedemo/.waygraph-auto/424b4d5d.log +0 -0
  140. package/examples/saucedemo/.waygraph-auto/43253aba.log +0 -0
  141. package/examples/saucedemo/.waygraph-auto/438c6c53.log +22 -0
  142. package/examples/saucedemo/.waygraph-auto/4477db12.log +0 -0
  143. package/examples/saucedemo/.waygraph-auto/4a1258b7.log +0 -0
  144. package/examples/saucedemo/.waygraph-auto/4adcd179.log +20 -0
  145. package/examples/saucedemo/.waygraph-auto/4c9d9b16.log +21 -0
  146. package/examples/saucedemo/.waygraph-auto/4da39c36.log +6 -0
  147. package/examples/saucedemo/.waygraph-auto/4dbefa7e.log +5 -0
  148. package/examples/saucedemo/.waygraph-auto/4efa7035.log +6 -0
  149. package/examples/saucedemo/.waygraph-auto/505affdc.log +4 -0
  150. package/examples/saucedemo/.waygraph-auto/51bcb60a.log +0 -0
  151. package/examples/saucedemo/.waygraph-auto/5291bc78.log +22 -0
  152. package/examples/saucedemo/.waygraph-auto/54274c39.log +5 -0
  153. package/examples/saucedemo/.waygraph-auto/5440ce7e.log +0 -0
  154. package/examples/saucedemo/.waygraph-auto/5738175f.log +22 -0
  155. package/examples/saucedemo/.waygraph-auto/57ce5643.log +22 -0
  156. package/examples/saucedemo/.waygraph-auto/5984426b.log +6 -0
  157. package/examples/saucedemo/.waygraph-auto/5a682e7c.log +22 -0
  158. package/examples/saucedemo/.waygraph-auto/5b79320c.log +21 -0
  159. package/examples/saucedemo/.waygraph-auto/5c55aaac.log +21 -0
  160. package/examples/saucedemo/.waygraph-auto/5d285cd3.log +0 -0
  161. package/examples/saucedemo/.waygraph-auto/5ed00b16.log +4 -0
  162. package/examples/saucedemo/.waygraph-auto/60b9c066.log +6 -0
  163. package/examples/saucedemo/.waygraph-auto/610dd127.log +0 -0
  164. package/examples/saucedemo/.waygraph-auto/61105500.log +5 -0
  165. package/examples/saucedemo/.waygraph-auto/6134afe8.log +20 -0
  166. package/examples/saucedemo/.waygraph-auto/62a0bdc9.log +22 -0
  167. package/examples/saucedemo/.waygraph-auto/6376fc15.log +0 -0
  168. package/examples/saucedemo/.waygraph-auto/6599cbca.log +22 -0
  169. package/examples/saucedemo/.waygraph-auto/67aaca30.log +0 -0
  170. package/examples/saucedemo/.waygraph-auto/68b10298.log +0 -0
  171. package/examples/saucedemo/.waygraph-auto/68be5e12.log +0 -0
  172. package/examples/saucedemo/.waygraph-auto/68df05a6.log +22 -0
  173. package/examples/saucedemo/.waygraph-auto/693f67c4.log +20 -0
  174. package/examples/saucedemo/.waygraph-auto/69ae030a.log +6 -0
  175. package/examples/saucedemo/.waygraph-auto/69e73f35.log +6 -0
  176. package/examples/saucedemo/.waygraph-auto/6b2333b0.log +5 -0
  177. package/examples/saucedemo/.waygraph-auto/6c4c3817.log +0 -0
  178. package/examples/saucedemo/.waygraph-auto/6c954911.log +0 -0
  179. package/examples/saucedemo/.waygraph-auto/6d65a439.log +5 -0
  180. package/examples/saucedemo/.waygraph-auto/6d700055.log +0 -0
  181. package/examples/saucedemo/.waygraph-auto/6ead848f.log +0 -0
  182. package/examples/saucedemo/.waygraph-auto/72675b2d.log +6 -0
  183. package/examples/saucedemo/.waygraph-auto/733dd260.log +5 -0
  184. package/examples/saucedemo/.waygraph-auto/75016486.log +0 -0
  185. package/examples/saucedemo/.waygraph-auto/752b01c6.log +22 -0
  186. package/examples/saucedemo/.waygraph-auto/75675227.log +6 -0
  187. package/examples/saucedemo/.waygraph-auto/75e2e658.log +0 -0
  188. package/examples/saucedemo/.waygraph-auto/76ac1a86.log +0 -0
  189. package/examples/saucedemo/.waygraph-auto/77605295.log +0 -0
  190. package/examples/saucedemo/.waygraph-auto/792671f4.log +22 -0
  191. package/examples/saucedemo/.waygraph-auto/79915adb.log +20 -0
  192. package/examples/saucedemo/.waygraph-auto/7a398774.log +6 -0
  193. package/examples/saucedemo/.waygraph-auto/7a72f66e.log +6 -0
  194. package/examples/saucedemo/.waygraph-auto/7a984334.log +4 -0
  195. package/examples/saucedemo/.waygraph-auto/7c6ee793.log +20 -0
  196. package/examples/saucedemo/.waygraph-auto/7c726dc4.log +22 -0
  197. package/examples/saucedemo/.waygraph-auto/7c72e8a5.log +4 -0
  198. package/examples/saucedemo/.waygraph-auto/7dbee625.log +22 -0
  199. package/examples/saucedemo/.waygraph-auto/7df66956.log +0 -0
  200. package/examples/saucedemo/.waygraph-auto/7e053160.log +0 -0
  201. package/examples/saucedemo/.waygraph-auto/7fcb512f.log +22 -0
  202. package/examples/saucedemo/.waygraph-auto/802a0b5b.log +0 -0
  203. package/examples/saucedemo/.waygraph-auto/80322e0b.log +0 -0
  204. package/examples/saucedemo/.waygraph-auto/80a4978e.log +6 -0
  205. package/examples/saucedemo/.waygraph-auto/81cfe480.log +22 -0
  206. package/examples/saucedemo/.waygraph-auto/832f5add.log +0 -0
  207. package/examples/saucedemo/.waygraph-auto/8337b6ad.log +0 -0
  208. package/examples/saucedemo/.waygraph-auto/8493928e.log +0 -0
  209. package/examples/saucedemo/.waygraph-auto/84dc6480.log +6 -0
  210. package/examples/saucedemo/.waygraph-auto/853bde43.log +0 -0
  211. package/examples/saucedemo/.waygraph-auto/86350ea6.log +22 -0
  212. package/examples/saucedemo/.waygraph-auto/86bb598a.log +0 -0
  213. package/examples/saucedemo/.waygraph-auto/86d09876.log +22 -0
  214. package/examples/saucedemo/.waygraph-auto/878ad01b.log +4 -0
  215. package/examples/saucedemo/.waygraph-auto/87c88ba5.log +0 -0
  216. package/examples/saucedemo/.waygraph-auto/87cb80ff.log +0 -0
  217. package/examples/saucedemo/.waygraph-auto/880b2e78.log +6 -0
  218. package/examples/saucedemo/.waygraph-auto/88527936.log +5 -0
  219. package/examples/saucedemo/.waygraph-auto/88eda676.log +0 -0
  220. package/examples/saucedemo/.waygraph-auto/893023ea.log +5 -0
  221. package/examples/saucedemo/.waygraph-auto/89416718.log +0 -0
  222. package/examples/saucedemo/.waygraph-auto/8996a857.log +6 -0
  223. package/examples/saucedemo/.waygraph-auto/8a08b68d.log +6 -0
  224. package/examples/saucedemo/.waygraph-auto/8a64ba0f.log +6 -0
  225. package/examples/saucedemo/.waygraph-auto/8b1cc2aa.log +6 -0
  226. package/examples/saucedemo/.waygraph-auto/8b73d13e.log +6 -0
  227. package/examples/saucedemo/.waygraph-auto/8d9e5cd2.log +21 -0
  228. package/examples/saucedemo/.waygraph-auto/8ec7d260.log +0 -0
  229. package/examples/saucedemo/.waygraph-auto/8ed43279.log +0 -0
  230. package/examples/saucedemo/.waygraph-auto/93acae32.log +5 -0
  231. package/examples/saucedemo/.waygraph-auto/96321a08.log +0 -0
  232. package/examples/saucedemo/.waygraph-auto/9742b6c2.log +6 -0
  233. package/examples/saucedemo/.waygraph-auto/99cc93eb.log +6 -0
  234. package/examples/saucedemo/.waygraph-auto/9cbfbedc.log +0 -0
  235. package/examples/saucedemo/.waygraph-auto/9dc147d2.log +22 -0
  236. package/examples/saucedemo/.waygraph-auto/a215a395.log +22 -0
  237. package/examples/saucedemo/.waygraph-auto/a23b7086.log +4 -0
  238. package/examples/saucedemo/.waygraph-auto/a35bd5ec.log +0 -0
  239. package/examples/saucedemo/.waygraph-auto/a68995e9.log +22 -0
  240. package/examples/saucedemo/.waygraph-auto/a6e4f936.log +22 -0
  241. package/examples/saucedemo/.waygraph-auto/a7da862b.log +0 -0
  242. package/examples/saucedemo/.waygraph-auto/a82e2a48.log +0 -0
  243. package/examples/saucedemo/.waygraph-auto/a952eb91.log +0 -0
  244. package/examples/saucedemo/.waygraph-auto/a9559653.log +5 -0
  245. package/examples/saucedemo/.waygraph-auto/aa478de2.log +0 -0
  246. package/examples/saucedemo/.waygraph-auto/ac350fc7.log +20 -0
  247. package/examples/saucedemo/.waygraph-auto/acc1b63a.log +0 -0
  248. package/examples/saucedemo/.waygraph-auto/ad12d191.log +0 -0
  249. package/examples/saucedemo/.waygraph-auto/b04638f4.log +6 -0
  250. package/examples/saucedemo/.waygraph-auto/b48863e5.log +22 -0
  251. package/examples/saucedemo/.waygraph-auto/b56968e1.log +6 -0
  252. package/examples/saucedemo/.waygraph-auto/b64e0620.log +20 -0
  253. package/examples/saucedemo/.waygraph-auto/b86a6218.log +6 -0
  254. package/examples/saucedemo/.waygraph-auto/b8e9e956.log +22 -0
  255. package/examples/saucedemo/.waygraph-auto/b9b310ff.log +21 -0
  256. package/examples/saucedemo/.waygraph-auto/bc111745.log +22 -0
  257. package/examples/saucedemo/.waygraph-auto/bf7a77a2.log +0 -0
  258. package/examples/saucedemo/.waygraph-auto/c0d6f353.log +21 -0
  259. package/examples/saucedemo/.waygraph-auto/c0febcf2.log +20 -0
  260. package/examples/saucedemo/.waygraph-auto/c4c52998.log +6 -0
  261. package/examples/saucedemo/.waygraph-auto/c809ceb4.log +22 -0
  262. package/examples/saucedemo/.waygraph-auto/ca6de7e7.log +0 -0
  263. package/examples/saucedemo/.waygraph-auto/ca8561bc.log +0 -0
  264. package/examples/saucedemo/.waygraph-auto/cb86d45b.log +0 -0
  265. package/examples/saucedemo/.waygraph-auto/cb9a1978.log +6 -0
  266. package/examples/saucedemo/.waygraph-auto/cbbc689c.log +6 -0
  267. package/examples/saucedemo/.waygraph-auto/cd88364b.log +0 -0
  268. package/examples/saucedemo/.waygraph-auto/cd919e1d.log +0 -0
  269. package/examples/saucedemo/.waygraph-auto/cfff9eef.log +20 -0
  270. package/examples/saucedemo/.waygraph-auto/d0f59b21.log +4 -0
  271. package/examples/saucedemo/.waygraph-auto/d1195079.log +20 -0
  272. package/examples/saucedemo/.waygraph-auto/d2ef067a.log +5 -0
  273. package/examples/saucedemo/.waygraph-auto/d425471f.log +6 -0
  274. package/examples/saucedemo/.waygraph-auto/d5293921.log +0 -0
  275. package/examples/saucedemo/.waygraph-auto/d62a22c2.log +21 -0
  276. package/examples/saucedemo/.waygraph-auto/d6d1761f.log +22 -0
  277. package/examples/saucedemo/.waygraph-auto/d6d5f411.log +22 -0
  278. package/examples/saucedemo/.waygraph-auto/d6df2771.log +6 -0
  279. package/examples/saucedemo/.waygraph-auto/d7075012.log +21 -0
  280. package/examples/saucedemo/.waygraph-auto/d9ddc297.log +0 -0
  281. package/examples/saucedemo/.waygraph-auto/db4ac845.log +0 -0
  282. package/examples/saucedemo/.waygraph-auto/db6d7774.log +0 -0
  283. package/examples/saucedemo/.waygraph-auto/db839827.log +5 -0
  284. package/examples/saucedemo/.waygraph-auto/dde5e859.log +22 -0
  285. package/examples/saucedemo/.waygraph-auto/de8cac58.log +0 -0
  286. package/examples/saucedemo/.waygraph-auto/dedfcb18.log +0 -0
  287. package/examples/saucedemo/.waygraph-auto/def4d9b1.log +0 -0
  288. package/examples/saucedemo/.waygraph-auto/e1549e40.log +0 -0
  289. package/examples/saucedemo/.waygraph-auto/e1b0676d.log +21 -0
  290. package/examples/saucedemo/.waygraph-auto/e5111463.log +0 -0
  291. package/examples/saucedemo/.waygraph-auto/e5fc1d7c.log +5 -0
  292. package/examples/saucedemo/.waygraph-auto/e6fd2202.log +0 -0
  293. package/examples/saucedemo/.waygraph-auto/edaa806d.log +0 -0
  294. package/examples/saucedemo/.waygraph-auto/edaf33de.log +0 -0
  295. package/examples/saucedemo/.waygraph-auto/edd40cbb.log +20 -0
  296. package/examples/saucedemo/.waygraph-auto/eddfbffc.log +6 -0
  297. package/examples/saucedemo/.waygraph-auto/ee9fa1ad.log +5 -0
  298. package/examples/saucedemo/.waygraph-auto/ef319474.log +22 -0
  299. package/examples/saucedemo/.waygraph-auto/f28eee8d.log +0 -0
  300. package/examples/saucedemo/.waygraph-auto/f33bde90.log +0 -0
  301. package/examples/saucedemo/.waygraph-auto/f6ba7cb4.log +6 -0
  302. package/examples/saucedemo/.waygraph-auto/f7ac4d62.log +20 -0
  303. package/examples/saucedemo/.waygraph-auto/f929bb79.log +0 -0
  304. package/examples/saucedemo/.waygraph-auto/f92d4c6c.log +22 -0
  305. package/examples/saucedemo/.waygraph-auto/f92faf40.log +5 -0
  306. package/examples/saucedemo/.waygraph-auto/fa784369.log +21 -0
  307. package/examples/saucedemo/.waygraph-auto/fb55f723.log +20 -0
  308. package/examples/saucedemo/.waygraph-auto/fba3b738.log +0 -0
  309. package/examples/saucedemo/.waygraph-auto/fdf66b74.log +0 -0
  310. package/examples/saucedemo/.waygraph-auto/ffdf2854.log +6 -0
  311. package/examples/saucedemo/README.md +13 -2
  312. package/examples/saucedemo/package.json +4 -0
  313. package/examples/saucedemo/src/flows/api-demo.flow.ts +37 -0
  314. package/examples/saucedemo/src/flows/checkout.flow.ts +34 -11
  315. package/package.json +5 -3
  316. package/templates/scaffold/src/flows/shop.flow.ts +42 -27
  317. package/dist/auto-explore-run.d.ts +0 -37
  318. package/dist/auto-explore-run.js +0 -670
  319. package/dist/auto-explore.d.ts +0 -57
  320. package/dist/auto-explore.js +0 -376
  321. package/dist/auto-session-ipc.d.ts +0 -150
  322. package/dist/auto-session-ipc.js +0 -497
  323. package/dist/block-inject.d.ts +0 -15
  324. package/dist/block-inject.js +0 -91
  325. package/dist/browser.d.ts +0 -15
  326. package/dist/browser.js +0 -29
  327. package/dist/coverage-gap.d.ts +0 -11
  328. package/dist/coverage-gap.js +0 -119
  329. package/dist/engine.d.ts +0 -12
  330. package/dist/engine.js +0 -13
  331. package/dist/graph.d.ts +0 -92
  332. package/dist/graph.js +0 -467
  333. package/dist/highlight-shorthand.d.ts +0 -24
  334. package/dist/highlight-shorthand.js +0 -30
  335. package/dist/map-check.d.ts +0 -18
  336. package/dist/map-check.js +0 -140
  337. package/dist/overlay-beacon.d.ts +0 -44
  338. package/dist/overlay-beacon.js +0 -85
  339. package/dist/pilot.d.ts +0 -54
  340. package/dist/pilot.js +0 -80
  341. package/dist/practices-check.d.ts +0 -14
  342. package/dist/practices-check.js +0 -195
  343. package/dist/traverse-coverage.d.ts +0 -59
  344. package/dist/traverse-coverage.js +0 -127
  345. package/dist/traverse-lease.d.ts +0 -18
  346. package/dist/traverse-lease.js +0 -62
  347. package/dist/traverse-run.d.ts +0 -47
  348. package/dist/traverse-run.js +0 -439
  349. package/dist/ui/compose.d.ts +0 -4
  350. package/dist/ui/compose.js +0 -7
  351. /package/dist/{verbose-log.d.ts → auto-session/verbose-log.d.ts} +0 -0
  352. /package/dist/{verbose-log.js → auto-session/verbose-log.js} +0 -0
  353. /package/dist/{agent-dive.d.ts → commands/agent-dive-scaffold.d.ts} +0 -0
  354. /package/dist/{engine/core.d.ts → core/block.d.ts} +0 -0
  355. /package/dist/{engine → core}/blocks/nav.d.ts +0 -0
  356. /package/dist/{engine → core}/blocks/page.d.ts +0 -0
  357. /package/dist/{engine → core}/branch-regression.d.ts +0 -0
  358. /package/dist/{engine → core}/compose.d.ts +0 -0
  359. /package/dist/{engine → core}/config.d.ts +0 -0
  360. /package/dist/{engine → core}/config.js +0 -0
  361. /package/dist/{engine → core}/flow.d.ts +0 -0
  362. /package/dist/{engine → core}/locate.d.ts +0 -0
  363. /package/dist/{engine → core}/locate.js +0 -0
  364. /package/dist/{engine → core}/run-graph.d.ts +0 -0
@@ -1,47 +1,7 @@
1
- import { WaygraphError } from "../errors.js";
1
+ import { WaygraphError, MSG_MAP_WRONG_KIND, MSG_MAP_WRONG_SALT, MSG_MAP_WRONG_ORIGIN_INTERNAL, MSG_MAP_WRONG_ORIGIN_EXTERNAL, MSG_MAP_BRANCH_SHARED_SESSION_UNSUPPORTED, MSG_MAP_FF_ALREADY_OPEN, MSG_MAP_FF_NOT_OPEN, MSG_MAP_FF_EMPTY, MSG_MAP_METHOD_GOT_ASSERT, MSG_MAP_BRANCH_NO_PRIOR_STEP, MSG_MAP_FF_NOT_CLOSED, MSG_MAP_EMPTY, } from "../errors.js";
2
2
  import { end, start } from "./run-graph.js";
3
- import { buildFlow } from "./flow.js";
4
3
  import { MemPage } from "../mem-page.js";
5
4
  import { fastForwardComposeBlock } from "./compose.js";
6
- /**
7
- * Holds engine-level configuration shared across every flow defined from it -
8
- * for now, just how to launch a browser when a Flow owns its own
9
- * (`headless`/`browserName`/`slowMo`); traits/interstitials/watchers land here
10
- * in a later change.
11
- * @example const engine = new Engine({ headless: false, slowMo: 250 });
12
- */
13
- export class Engine {
14
- config;
15
- constructor(config = {}) {
16
- this.config = config;
17
- }
18
- defineFlow(blocks) {
19
- return buildFlow(blocks.slice(1, -1), this.config);
20
- }
21
- /**
22
- * Fluent, kind-checked alternative to `defineFlow([start, ...blocks, end])` -
23
- * see {@link MapBuilder}. Real, direct request this responds to: pia/zsign's
24
- * own agents kept hand-editing/hand-composing Blocks into ad hoc shapes
25
- * ("locks" convention tried, still got broken) - `map()` forces every step
26
- * through this Engine's own `define*Block` factories (checked by the same
27
- * `__waygraphKind`/`__waygraphSalt` runtime markers `graph.ts`/`map-check.ts`
28
- * already trust), so a hand-rolled plain-object Block can never silently
29
- * pass as a real navigation/assertion/method step. `homeOrigin`, if given,
30
- * also gates `.gotoPage()`/`.gotoExternal()` against each Nav/Page Block's
31
- * own static `url` (skipped, honestly, for click-based/dynamic nav - not
32
- * statically checkable, same limitation `map-check.ts` already documents).
33
- * @example
34
- * const flow = engine.map({ homeOrigin: "https://app.example.com" })
35
- * .start()
36
- * .gotoPage(NavHomeBlock)
37
- * .assert(AssertHelloBlock)
38
- * .gotoExternal(NavMailpitBlock)
39
- * .end();
40
- */
41
- map(options) {
42
- return MapBuilder.begin(this, options?.homeOrigin);
43
- }
44
- }
45
5
  function mapKindOf(block) {
46
6
  return block?.__waygraphKind;
47
7
  }
@@ -67,9 +27,7 @@ function assertMapKind(block, allowed, method) {
67
27
  return;
68
28
  const wanted = allowed.map((k) => MAP_KIND_FACTORY_HINT[k] ?? k).join(" or ");
69
29
  const found = kind ? `a Block of kind "${kind}"` : "an object with no waygraph kind marker at all";
70
- throw new WaygraphError("WG_MAP_WRONG_KIND", `Waygraph map: .${method}("${block?.name ?? "?"}") requires a Block built with ${wanted} ` +
71
- `(found ${found} - a hand-built plain object doesn't count). This check is the whole point ` +
72
- "of the map() builder: only real Blocks from waygraph's own factories can enter a chain.");
30
+ throw new WaygraphError("WG_MAP_WRONG_KIND", MSG_MAP_WRONG_KIND(method, block?.name ?? "?", wanted, found));
73
31
  }
74
32
  function assertMapSalt(block, allowed, method) {
75
33
  const salt = mapSaltOf(block);
@@ -77,9 +35,7 @@ function assertMapSalt(block, allowed, method) {
77
35
  return;
78
36
  const wanted = allowed.map((s) => MAP_SALT_FACTORY_HINT[s] ?? s).join(" or ");
79
37
  const found = salt ? `a Block salted "${salt}"` : "an object with no waygraph salt marker at all";
80
- throw new WaygraphError("WG_MAP_WRONG_SALT", `Waygraph map: .${method}("${block?.name ?? "?"}") requires a Block built with ${wanted} ` +
81
- `(found ${found} - a hand-built plain object doesn't count). This check is the whole point ` +
82
- "of the map() builder: only real Blocks from waygraph's own factories can enter a chain.");
38
+ throw new WaygraphError("WG_MAP_WRONG_SALT", MSG_MAP_WRONG_SALT(method, block?.name ?? "?", wanted, found));
83
39
  }
84
40
  function assertMapOrigin(block, homeOrigin, expect, method) {
85
41
  if (!homeOrigin)
@@ -98,12 +54,10 @@ function assertMapOrigin(block, homeOrigin, expect, method) {
98
54
  }
99
55
  const isExternal = targetOrigin !== wantOrigin;
100
56
  if (expect === "internal" && isExternal) {
101
- throw new WaygraphError("WG_MAP_WRONG_ORIGIN", `Waygraph map: .gotoPage("${block.name}") targets ${targetOrigin}, which is NOT this map's ` +
102
- `home origin (${wantOrigin}) - use .gotoExternal() for a genuinely cross-origin destination.`);
57
+ throw new WaygraphError("WG_MAP_WRONG_ORIGIN", MSG_MAP_WRONG_ORIGIN_INTERNAL(block.name, targetOrigin, wantOrigin));
103
58
  }
104
59
  if (expect === "external" && !isExternal) {
105
- throw new WaygraphError("WG_MAP_WRONG_ORIGIN", `Waygraph map: .gotoExternal("${block.name}") targets ${targetOrigin}, which IS this map's ` +
106
- `home origin (${wantOrigin}) - use .gotoPage() for an internal destination.`);
60
+ throw new WaygraphError("WG_MAP_WRONG_ORIGIN", MSG_MAP_WRONG_ORIGIN_EXTERNAL(block.name, targetOrigin, wantOrigin));
107
61
  }
108
62
  }
109
63
  /**
@@ -115,9 +69,7 @@ function assertMapOrigin(block, homeOrigin, expect, method) {
115
69
  function buildBranchedFlow(before, routes) {
116
70
  const run = (async (contextOrMem, memOrConfig, options) => {
117
71
  if (contextOrMem instanceof MemPage) {
118
- throw new WaygraphError("WG_MAP_BRANCH_SHARED_SESSION_UNSUPPORTED", "Waygraph map: a .branch()-ed Flow can't run via run(mem, config) - that convenience form " +
119
- "always closes its own browser/page before a branch's tag is even known. Call " +
120
- "run(context, mem[, options]) instead, keeping the same page across the branch.");
72
+ throw new WaygraphError("WG_MAP_BRANCH_SHARED_SESSION_UNSUPPORTED", MSG_MAP_BRANCH_SHARED_SESSION_UNSUPPORTED);
121
73
  }
122
74
  const context = contextOrMem;
123
75
  const mem = memOrConfig;
@@ -180,19 +132,25 @@ function buildBranchedFlow(before, routes) {
180
132
  * real, kind-correct Block in between.
181
133
  */
182
134
  export class MapBuilder {
183
- engine;
135
+ defineFlow;
184
136
  steps;
185
137
  homeOrigin;
186
138
  ff;
187
- constructor(engine, steps, homeOrigin, ff = null) {
188
- this.engine = engine;
139
+ constructor(
140
+ // A plain defineFlow-shaped function, not the whole Engine - see DefineFlowFn's own comment.
141
+ defineFlow, steps, homeOrigin,
142
+ // `auto: true` = opened implicitly by a `{ ff: true }` step flag, not an explicit .ffStart() -
143
+ // closes silently at the next non-flagged step (or at .end()/.branch()) instead of demanding a
144
+ // matching .ffEnd(), since the author never opened anything they'd need to remember to close.
145
+ ff = null) {
146
+ this.defineFlow = defineFlow;
189
147
  this.steps = steps;
190
148
  this.homeOrigin = homeOrigin;
191
149
  this.ff = ff;
192
150
  }
193
151
  /** @internal - use `engine.map()` or the standalone `map()` export. */
194
- static begin(engine, homeOrigin) {
195
- return new MapBuilder(engine, [], homeOrigin, null);
152
+ static begin(defineFlow, homeOrigin) {
153
+ return new MapBuilder(defineFlow, [], homeOrigin, null);
196
154
  }
197
155
  /** Readable chain-opener - mirrors `defineFlow`'s leading `start` sentinel. Returns `this` unchanged; entirely optional. */
198
156
  start() {
@@ -205,14 +163,15 @@ export class MapBuilder {
205
163
  */
206
164
  ffStart(name) {
207
165
  if (this.ff) {
208
- throw new WaygraphError("WG_MAP_FF_ALREADY_OPEN", `Waygraph map: .ffStart() while already inside "${this.ff.name}" - call .ffEnd() first`);
166
+ throw new WaygraphError("WG_MAP_FF_ALREADY_OPEN", MSG_MAP_FF_ALREADY_OPEN(this.ff.name));
209
167
  }
210
168
  const ffName = typeof name === "string" && name.trim()
211
169
  ? name.trim()
212
170
  : `ff-${this.steps.length + 1}`;
213
- return new MapBuilder(this.engine, this.steps, this.homeOrigin, {
171
+ return new MapBuilder(this.defineFlow, this.steps, this.homeOrigin, {
214
172
  name: ffName,
215
173
  buffer: [],
174
+ auto: false,
216
175
  });
217
176
  }
218
177
  /**
@@ -221,54 +180,85 @@ export class MapBuilder {
221
180
  */
222
181
  ffEnd() {
223
182
  if (!this.ff) {
224
- throw new WaygraphError("WG_MAP_FF_NOT_OPEN", "Waygraph map: .ffEnd() with no open .ffStart()");
183
+ throw new WaygraphError("WG_MAP_FF_NOT_OPEN", MSG_MAP_FF_NOT_OPEN);
225
184
  }
226
- if (this.ff.buffer.length === 0) {
227
- throw new WaygraphError("WG_MAP_FF_EMPTY", `Waygraph map: .ffEnd() for "${this.ff.name}" has no steps - add .gotoPage/.method/… inside the window`);
185
+ return this.closeFf();
186
+ }
187
+ /** Shared by the explicit {@link ffEnd} and the implicit close a `{ ff: true }` step flag triggers. */
188
+ closeFf() {
189
+ const ff = this.ff;
190
+ if (!ff)
191
+ return this;
192
+ if (ff.buffer.length === 0) {
193
+ throw new WaygraphError("WG_MAP_FF_EMPTY", MSG_MAP_FF_EMPTY(ff.name));
228
194
  }
229
- const composed = fastForwardComposeBlock(this.ff.name,
195
+ const composed = fastForwardComposeBlock(ff.name,
230
196
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
231
- this.ff.buffer);
232
- return new MapBuilder(this.engine, [...this.steps, composed], this.homeOrigin, null);
197
+ ff.buffer);
198
+ return new MapBuilder(this.defineFlow, [...this.steps, composed], this.homeOrigin, null);
233
199
  }
234
- appendStep(block) {
200
+ /**
201
+ * `ff`: inline fast-forward, no `.ffStart()/.ffEnd()` bracket needed - `.method(X, { ff: true })`
202
+ * marks just that step; consecutive `{ ff: true }` steps merge into ONE fast-forward block (same
203
+ * runtime result as the explicit bracket form), same as if they'd been wrapped in
204
+ * `.ffStart()/.ffEnd()`. A step WITHOUT the flag closes an auto-opened window first, so a plain
205
+ * step is never silently swept into one; an EXPLICIT `.ffStart()` window still behaves as before
206
+ * (stays open until its own `.ffEnd()`, regardless of whether a step passed `{ ff: true }`).
207
+ */
208
+ appendStep(block, ff) {
209
+ if (ff) {
210
+ const win = this.ff ?? { name: `ff-${this.steps.length + 1}`, buffer: [], auto: true };
211
+ return new MapBuilder(this.defineFlow, this.steps, this.homeOrigin, {
212
+ name: win.name,
213
+ buffer: [...win.buffer, block],
214
+ auto: win.auto,
215
+ });
216
+ }
217
+ if (this.ff && this.ff.auto) {
218
+ return this.closeFf().appendStep(block);
219
+ }
235
220
  if (this.ff) {
236
- return new MapBuilder(this.engine, this.steps, this.homeOrigin, {
221
+ // Explicit .ffStart() window still open - absorbs a plain step too, same as always.
222
+ return new MapBuilder(this.defineFlow, this.steps, this.homeOrigin, {
237
223
  name: this.ff.name,
238
224
  buffer: [...this.ff.buffer, block],
225
+ auto: false,
239
226
  });
240
227
  }
241
- return new MapBuilder(this.engine, [...this.steps, block], this.homeOrigin, null);
228
+ return new MapBuilder(this.defineFlow, [...this.steps, block], this.homeOrigin, null);
242
229
  }
243
230
  /**
244
231
  * Appends an internal navigation/page-arrival step - requires a Block from
245
232
  * `defineNavBlock`/`defineMemNavBlock`/`definePageBlock`. Throws if given
246
233
  * anything else, including a `homeOrigin`-mismatched static `url`.
247
234
  * Compile-time: {@link NavBlock} or {@link PageBlock} only (not Assert/Method).
235
+ * `{ ff: true }`: fast-forward this one step inline - see {@link appendStep}'s own comment.
248
236
  */
249
- gotoPage(block) {
237
+ gotoPage(block, opts) {
250
238
  assertMapKind(block, ["nav", "page"], "gotoPage");
251
239
  assertMapOrigin(block, this.homeOrigin, "internal", "gotoPage");
252
- return this.appendStep(block);
240
+ return this.appendStep(block, opts?.ff);
253
241
  }
254
242
  /**
255
243
  * Appends a genuinely cross-origin navigation step (e.g. `(external)/`
256
244
  * Blocks in the Waygraph Map convention: mailpit, maildrop.cc) - same
257
245
  * kind requirement as {@link gotoPage}, plus the inverse `homeOrigin` check.
258
246
  * Compile-time: {@link NavBlock} or {@link PageBlock} only.
247
+ * `{ ff: true }`: fast-forward this one step inline - see {@link appendStep}'s own comment.
259
248
  */
260
- gotoExternal(block) {
249
+ gotoExternal(block, opts) {
261
250
  assertMapKind(block, ["nav", "page"], "gotoExternal");
262
251
  assertMapOrigin(block, this.homeOrigin, "external", "gotoExternal");
263
- return this.appendStep(block);
252
+ return this.appendStep(block, opts?.ff);
264
253
  }
265
254
  /**
266
255
  * Appends a self-loop verification step - requires a Block from
267
256
  * `defineAssertBlock`. Compile-time: {@link AssertBlock} only (not `.method()`).
257
+ * `{ ff: true }`: fast-forward this one step inline - see {@link appendStep}'s own comment.
268
258
  */
269
- assert(block) {
259
+ assert(block, opts) {
270
260
  assertMapKind(block, ["assert"], "assert");
271
- return this.appendStep(block);
261
+ return this.appendStep(block, opts?.ff);
272
262
  }
273
263
  /**
274
264
  * Appends a non-navigating page action (submit, upload, add/remove an
@@ -277,14 +267,14 @@ export class MapBuilder {
277
267
  * Compile-time: {@link MethodBlock} or {@link EffectBlock} only - Assert
278
268
  * Blocks must use `.assert()`. Runtime also rejects `__waygraphKind =
279
269
  * "assert"` (those still carry method salt from the factory internals).
270
+ * `{ ff: true }`: fast-forward this one step inline - see {@link appendStep}'s own comment.
280
271
  */
281
- method(block) {
272
+ method(block, opts) {
282
273
  if (mapKindOf(block) === "assert") {
283
- throw new WaygraphError("WG_MAP_WRONG_KIND", `Waygraph map: .method("${block.name}") got a defineAssertBlock - use .assert() for ` +
284
- "self-loop verify steps (Assert Blocks share method salt internally but are not methods).");
274
+ throw new WaygraphError("WG_MAP_WRONG_KIND", MSG_MAP_METHOD_GOT_ASSERT(block.name));
285
275
  }
286
276
  assertMapSalt(block, ["method", "effect"], "method");
287
- return this.appendStep(block);
277
+ return this.appendStep(block, opts?.ff);
288
278
  }
289
279
  /**
290
280
  * Branch: run everything added so far, then continue into whichever `routes[tag]` matches the
@@ -320,13 +310,12 @@ export class MapBuilder {
320
310
  */
321
311
  branch(routes) {
322
312
  if (this.steps.length === 0) {
323
- throw new WaygraphError("WG_MAP_BRANCH_NO_PRIOR_STEP", "Waygraph map: .branch() needs at least one prior step - nothing to branch from. " +
324
- "Add .gotoPage()/.gotoExternal()/.method()/.assert() first.");
313
+ throw new WaygraphError("WG_MAP_BRANCH_NO_PRIOR_STEP", MSG_MAP_BRANCH_NO_PRIOR_STEP);
325
314
  }
326
315
  const before = this.end();
327
316
  const resolvedRoutes = {};
328
317
  for (const [tag, fn] of Object.entries(routes)) {
329
- resolvedRoutes[tag] = fn ? fn(new MapBuilder(this.engine, [], this.homeOrigin, null)) : null;
318
+ resolvedRoutes[tag] = fn ? fn(new MapBuilder(this.defineFlow, [], this.homeOrigin, null)) : null;
330
319
  }
331
320
  return buildBranchedFlow(before, resolvedRoutes);
332
321
  }
@@ -336,26 +325,21 @@ export class MapBuilder {
336
325
  * `withTitle`/`withHighlightFixtures`/etc. decorator still apply exactly
337
326
  * as they do today; this builder only changes how the chain is assembled,
338
327
  * never what it produces. Throws if no step was ever added - an empty map
339
- * isn't a flow.
328
+ * isn't a flow. An auto-opened `{ ff: true }` window (see {@link MapStepOpts})
329
+ * left open at `.end()` closes silently; an EXPLICIT `.ffStart()` left open
330
+ * still throws - the author opened that one and needs to close it themselves.
340
331
  */
341
332
  end() {
342
- if (this.ff) {
343
- throw new WaygraphError("WG_MAP_FF_NOT_CLOSED", `Waygraph map: .end() while .ffStart("${this.ff.name}") is still open - call .ffEnd() first`);
333
+ if (this.ff && !this.ff.auto) {
334
+ throw new WaygraphError("WG_MAP_FF_NOT_CLOSED", MSG_MAP_FF_NOT_CLOSED(this.ff.name));
335
+ }
336
+ if (this.ff && this.ff.auto) {
337
+ return this.closeFf().end();
344
338
  }
345
339
  if (this.steps.length === 0) {
346
- throw new WaygraphError("WG_MAP_EMPTY", "Waygraph map: .end() called with zero steps - add at least one .gotoPage()/.gotoExternal()/" +
347
- ".assert()/.method() before .end()");
340
+ throw new WaygraphError("WG_MAP_EMPTY", MSG_MAP_EMPTY);
348
341
  }
349
342
  const chain = [start, ...this.steps, end];
350
- return this.engine.defineFlow(chain);
343
+ return this.defineFlow(chain);
351
344
  }
352
345
  }
353
- /**
354
- * Standalone convenience for `new Engine(config).map(options)` - use this
355
- * when a call site doesn't otherwise need its own `Engine` instance (no
356
- * shared `headless`/`slowMo`/`layouts` across several flows).
357
- * @example const flow = map({ homeOrigin: "https://app.example.com" }).gotoPage(NavHomeBlock).end();
358
- */
359
- export function map(options) {
360
- return new Engine(options).map(options);
361
- }
@@ -1,4 +1,4 @@
1
- import { WaygraphError } from "../errors.js";
1
+ import { WaygraphError, MSG_PREFLIGHT_MISSING_KEY, MSG_RUNGRAPH_MAX_STEPS, MSG_RUNGRAPH_NOT_TERMINAL } from "../errors.js";
2
2
  import { checkpoint } from "../types.js";
3
3
  import { runPrecondition, runVerify } from "../trait.js";
4
4
  /**
@@ -12,9 +12,7 @@ import { runPrecondition, runVerify } from "../trait.js";
12
12
  export function preflight(mem, block) {
13
13
  const missing = (block.requires ?? []).filter((k) => !mem.has(k));
14
14
  if (missing.length > 0) {
15
- throw new WaygraphError("WG_PREFLIGHT_MISSING_KEY", `preflight: MemPage is missing required key(s) before "${block.name}" can run: ${missing
16
- .map((k) => `"${k.name}"`)
17
- .join(", ")}`);
15
+ throw new WaygraphError("WG_PREFLIGHT_MISSING_KEY", MSG_PREFLIGHT_MISSING_KEY(block.name, missing.map((k) => `"${k.name}"`).join(", ")));
18
16
  }
19
17
  }
20
18
  /**
@@ -86,7 +84,7 @@ export async function runGraph(entry, terminals, context, mem, maxSteps = 5000,
86
84
  let steps = 0;
87
85
  for (;;) {
88
86
  if (++steps > maxSteps) {
89
- throw new WaygraphError("WG_RUNGRAPH_MAX_STEPS", `runGraph: exceeded ${maxSteps} steps - check for an unintended self-loop`);
87
+ throw new WaygraphError("WG_RUNGRAPH_MAX_STEPS", MSG_RUNGRAPH_MAX_STEPS(maxSteps));
90
88
  }
91
89
  await runPrecondition(current.instruction.precondition, input, page, mem, current.name);
92
90
  await current.instruction.act(page, input, mem);
@@ -99,7 +97,7 @@ export async function runGraph(entry, terminals, context, mem, maxSteps = 5000,
99
97
  const next = current.next?.(checkpoint);
100
98
  if (!next) {
101
99
  if (terminals && !terminals.has(checkpoint.__state)) {
102
- throw new WaygraphError("WG_RUNGRAPH_NOT_TERMINAL", `runGraph: "${current.name}" resolved to "${checkpoint.__state}", which is not a registered terminal (expected one of: ${[...terminals].join(", ")})`);
100
+ throw new WaygraphError("WG_RUNGRAPH_NOT_TERMINAL", MSG_RUNGRAPH_NOT_TERMINAL(current.name, checkpoint.__state, [...terminals].join(", ")));
103
101
  }
104
102
  return checkpoint;
105
103
  }
package/dist/core.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export * from "./core/config.js";
2
+ export * from "./core/run-graph.js";
3
+ export * from "./core/flow.js";
4
+ export * from "./core/block.js";
5
+ export * from "./core/compose.js";
6
+ export * from "./core/engine.js";
7
+ export * from "./core/map-builder.js";
8
+ export * from "./core/blocks/nav.js";
9
+ export * from "./core/blocks/method.js";
10
+ export * from "./core/blocks/page.js";
11
+ export * from "./core/blocks/effect.js";
12
+ export * from "./core/blocks/api.js";
13
+ export * from "./core/locate.js";
14
+ export * from "./core/branch-regression.js";
package/dist/core.js ADDED
@@ -0,0 +1,15 @@
1
+ // Barrel: the engine lives in src/core/ (see src/ARCHITECTURE.md). Kept so existing imports of "./core.js" don't change.
2
+ export * from "./core/config.js";
3
+ export * from "./core/run-graph.js";
4
+ export * from "./core/flow.js";
5
+ export * from "./core/block.js";
6
+ export * from "./core/compose.js";
7
+ export * from "./core/engine.js";
8
+ export * from "./core/map-builder.js";
9
+ export * from "./core/blocks/nav.js";
10
+ export * from "./core/blocks/method.js";
11
+ export * from "./core/blocks/page.js";
12
+ export * from "./core/blocks/effect.js";
13
+ export * from "./core/blocks/api.js";
14
+ export * from "./core/locate.js";
15
+ export * from "./core/branch-regression.js";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Auto-loads `.env` / `.env.local` / `.env.<mode>` / `.env.<mode>.local` from a project's root,
3
+ * same layering Vite/Next use (`mode` defaults to `NODE_ENV`, falling back to "development"),
4
+ * merged into `process.env` in increasing priority. A real, already-set `process.env` value -
5
+ * whatever the shell actually exported - always wins over every file; a `.env` file only fills
6
+ * a gap, it never silently overrides something the caller explicitly set. Safe to call more
7
+ * than once (e.g. once eagerly at `cwd`, again once the real project dir is known) - loading
8
+ * twice is a no-op the second time for any key already filled.
9
+ */
10
+ export declare function loadEnvFiles(projectDir: string, mode?: string): void;
@@ -0,0 +1,58 @@
1
+ // Native .env support - no `dotenv` dependency (same "bring nothing, read what's already there"
2
+ // philosophy as mem-stub.ts's own Faker note: this is a ~20-line parser, not a new runtime dep).
3
+ // Real, direct user ask: FE consumers keep their own .env and had to hack around waygraph not
4
+ // reading it (manually re-exporting values, duplicating them into package.json's "waygraph"
5
+ // field) to get waygraph to see the same config their actual app already uses.
6
+ import { existsSync, readFileSync } from "node:fs";
7
+ import { join } from "node:path";
8
+ /** `KEY=value` lines only - no `${VAR}` expansion, no multiline values. Matches the common
9
+ * Vite/Next `.env` shape, not full dotenv-expand parity. */
10
+ function parseEnvFile(content) {
11
+ const out = {};
12
+ for (const rawLine of content.split(/\r?\n/)) {
13
+ const line = rawLine.trim();
14
+ if (!line || line.startsWith("#"))
15
+ continue;
16
+ const withoutExport = line.startsWith("export ") ? line.slice("export ".length) : line;
17
+ const eq = withoutExport.indexOf("=");
18
+ if (eq === -1)
19
+ continue;
20
+ const key = withoutExport.slice(0, eq).trim();
21
+ if (!key)
22
+ continue;
23
+ let value = withoutExport.slice(eq + 1).trim();
24
+ const quoted = (value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"));
25
+ if (quoted)
26
+ value = value.slice(1, -1);
27
+ out[key] = value;
28
+ }
29
+ return out;
30
+ }
31
+ /**
32
+ * Auto-loads `.env` / `.env.local` / `.env.<mode>` / `.env.<mode>.local` from a project's root,
33
+ * same layering Vite/Next use (`mode` defaults to `NODE_ENV`, falling back to "development"),
34
+ * merged into `process.env` in increasing priority. A real, already-set `process.env` value -
35
+ * whatever the shell actually exported - always wins over every file; a `.env` file only fills
36
+ * a gap, it never silently overrides something the caller explicitly set. Safe to call more
37
+ * than once (e.g. once eagerly at `cwd`, again once the real project dir is known) - loading
38
+ * twice is a no-op the second time for any key already filled.
39
+ */
40
+ export function loadEnvFiles(projectDir, mode = process.env.NODE_ENV || "development") {
41
+ const files = [".env", ".env.local", `.env.${mode}`, `.env.${mode}.local`];
42
+ for (const name of files) {
43
+ const p = join(projectDir, name);
44
+ if (!existsSync(p))
45
+ continue;
46
+ let parsed;
47
+ try {
48
+ parsed = parseEnvFile(readFileSync(p, "utf-8"));
49
+ }
50
+ catch {
51
+ continue; // unreadable file - never fail a run over an optional .env
52
+ }
53
+ for (const [key, value] of Object.entries(parsed)) {
54
+ if (process.env[key] === undefined)
55
+ process.env[key] = value;
56
+ }
57
+ }
58
+ }
package/dist/errors.d.ts CHANGED
@@ -9,102 +9,102 @@
9
9
  */
10
10
  export declare const WAYGRAPH_ERRORS: {
11
11
  readonly WG_PREFLIGHT_MISSING_KEY: {
12
- readonly where: "engine/run-graph.ts - preflight()";
12
+ readonly where: "core/run-graph.ts - preflight()";
13
13
  readonly means: "A Flow/chain needs a MemKey that mem.set() never received before run() started.";
14
14
  readonly fix: "Pass --data / a mem.set() call for that key, or registerMemStub + --mem-stub for a fake value.";
15
15
  };
16
16
  readonly WG_RUNGRAPH_MAX_STEPS: {
17
- readonly where: "engine/run-graph.ts - runGraph()";
17
+ readonly where: "core/run-graph.ts - runGraph()";
18
18
  readonly means: "A chain took more steps than maxSteps without reaching a Block with no .next() - almost always an unintended self-loop in branch()/next routing.";
19
19
  readonly fix: "Check the Block(s) involved in the loop; raise maxSteps only if the loop is genuinely intended.";
20
20
  };
21
21
  readonly WG_RUNGRAPH_NOT_TERMINAL: {
22
- readonly where: "engine/run-graph.ts - runGraph()";
22
+ readonly where: "core/run-graph.ts - runGraph()";
23
23
  readonly means: "A Block with no .next() resolved to a Checkpoint that wasn't in the caller's declared `terminals` set.";
24
24
  readonly fix: "Add that Checkpoint to `terminals`, or fix the Block's resolve() - it landed somewhere the caller didn't expect.";
25
25
  };
26
26
  readonly WG_MAP_WRONG_KIND: {
27
- readonly where: "engine/engine-class.ts - MapBuilder.gotoPage/gotoExternal/assert/method()";
27
+ readonly where: "core/map-builder.ts - MapBuilder.gotoPage/gotoExternal/assert/method()";
28
28
  readonly means: "A Block passed to a MapBuilder step method doesn't carry the __waygraphKind a real defineNavBlock/definePageBlock/defineAssertBlock/defineMethodBlock/defineEffectBlock stamps - either the wrong factory was used, or the object was hand-rolled instead of going through one.";
29
29
  readonly fix: "Use the factory the error names, or move this Block to the matching .gotoPage()/.assert()/.method() call.";
30
30
  };
31
31
  readonly WG_MAP_WRONG_SALT: {
32
- readonly where: "engine/engine-class.ts - MapBuilder.method()";
32
+ readonly where: "core/map-builder.ts - MapBuilder.method()";
33
33
  readonly means: "A Block passed to .method() isn't a real Method/Effect Block (missing __waygraphSalt).";
34
34
  readonly fix: "Build it with defineMethodBlock/defineEffectBlock, or use .assert() if it's actually a defineAssertBlock.";
35
35
  };
36
36
  readonly WG_MAP_WRONG_ORIGIN: {
37
- readonly where: "engine/engine-class.ts - MapBuilder.gotoPage/gotoExternal()";
37
+ readonly where: "core/map-builder.ts - MapBuilder.gotoPage/gotoExternal()";
38
38
  readonly means: "A Block's static `url` origin doesn't match what .gotoPage() (same-origin) or .gotoExternal() (cross-origin) expects, given this map()'s homeOrigin.";
39
39
  readonly fix: "Use .gotoExternal() for a genuinely different origin, .gotoPage() for the app's own homeOrigin, or fix the Block's url.";
40
40
  };
41
41
  readonly WG_MAP_FF_ALREADY_OPEN: {
42
- readonly where: "engine/engine-class.ts - MapBuilder.ffStart()";
42
+ readonly where: "core/map-builder.ts - MapBuilder.ffStart()";
43
43
  readonly means: ".ffStart() was called while a previous .ffStart() window is still open.";
44
44
  readonly fix: "Call .ffEnd() before opening another fast-forward window.";
45
45
  };
46
46
  readonly WG_MAP_FF_EMPTY: {
47
- readonly where: "engine/engine-class.ts - MapBuilder.ffEnd()";
47
+ readonly where: "core/map-builder.ts - MapBuilder.ffEnd()";
48
48
  readonly means: ".ffEnd() closed a window with zero steps inside it.";
49
49
  readonly fix: "Add at least one .gotoPage()/.method()/.assert() inside the .ffStart()/.ffEnd() window.";
50
50
  };
51
51
  readonly WG_MAP_FF_NOT_CLOSED: {
52
- readonly where: "engine/engine-class.ts - MapBuilder.end()";
52
+ readonly where: "core/map-builder.ts - MapBuilder.end()";
53
53
  readonly means: ".end() was called while a .ffStart() window was still open.";
54
54
  readonly fix: "Call .ffEnd() before .end().";
55
55
  };
56
56
  readonly WG_MAP_FF_NOT_OPEN: {
57
- readonly where: "engine/engine-class.ts - MapBuilder.ffEnd()";
57
+ readonly where: "core/map-builder.ts - MapBuilder.ffEnd()";
58
58
  readonly means: ".ffEnd() was called with no matching .ffStart().";
59
59
  readonly fix: "Remove the stray .ffEnd(), or add the .ffStart() it's meant to close.";
60
60
  };
61
61
  readonly WG_MAP_EMPTY: {
62
- readonly where: "engine/engine-class.ts - MapBuilder.end()";
62
+ readonly where: "core/map-builder.ts - MapBuilder.end()";
63
63
  readonly means: ".end() was called with zero steps added.";
64
64
  readonly fix: "Add at least one .gotoPage()/.gotoExternal()/.assert()/.method() before .end().";
65
65
  };
66
66
  readonly WG_MAP_BRANCH_NO_PRIOR_STEP: {
67
- readonly where: "engine/engine-class.ts - MapBuilder.branch()";
67
+ readonly where: "core/map-builder.ts - MapBuilder.branch()";
68
68
  readonly means: ".branch() was called before any step existed to branch FROM.";
69
69
  readonly fix: "Add a .gotoPage()/.gotoExternal()/.method()/.assert() before .branch().";
70
70
  };
71
71
  readonly WG_MAP_BRANCH_SHARED_SESSION_UNSUPPORTED: {
72
- readonly where: "engine/engine-class.ts - a .branch()-built Flow's run()";
72
+ readonly where: "core/map-builder.ts - a .branch()-built Flow's run()";
73
73
  readonly means: "run(mem, config) was called on a branched Flow - that convenience form always closes its own browser/page before the branch's tag is known, so the branch can never be reached.";
74
74
  readonly fix: "Call run(context, mem[, options]) instead, keeping the same page across the branch.";
75
75
  };
76
76
  readonly WG_BRANCH_REGRESSION_NO_BROWSER: {
77
- readonly where: "engine/branch-regression.ts - runBranchRegression()";
77
+ readonly where: "core/branch-regression.ts - runBranchRegression()";
78
78
  readonly means: "cloneSession is on (the default) but context.browser() returned null - a persistent context has no Browser to clone a new context from.";
79
79
  readonly fix: "Pass { cloneSession: false } to run the single live path in this context instead.";
80
80
  };
81
81
  readonly WG_COMPOSE_EMPTY: {
82
- readonly where: "engine/compose.ts - composeBlock()";
82
+ readonly where: "core/compose.ts - composeBlock()";
83
83
  readonly means: "composeBlock() was called with zero steps.";
84
84
  readonly fix: "Pass at least one Block.";
85
85
  };
86
86
  readonly WG_FASTFORWARD_EMPTY: {
87
- readonly where: "engine/compose.ts - fastForwardComposeBlock()";
87
+ readonly where: "core/compose.ts - fastForwardComposeBlock()";
88
88
  readonly means: "A fast-forward window was closed with zero steps inside it.";
89
89
  readonly fix: "Add at least one Block between ffStart()/ffEnd() (or the equivalent Map builder call).";
90
90
  };
91
91
  readonly WG_FLOW_BLOCK_NOT_FOUND: {
92
- readonly where: "engine/core.ts - findBlockIndex() (used by withBlockVerify/modBlockVerify/chainFlow)";
92
+ readonly where: "core/block.ts - findBlockIndex() (used by withBlockVerify/modBlockVerify/chainFlow)";
93
93
  readonly means: "The Block name/index/reference given doesn't exist in this Flow (or chained Flows).";
94
94
  readonly fix: "Check the name/index against flow.blocks() - it lists every Block this Flow actually has, tag-prefixed for branches.";
95
95
  };
96
96
  readonly WG_CHAINFLOW_EMPTY: {
97
- readonly where: "engine/flow.ts - chainFlow()";
97
+ readonly where: "core/flow.ts - chainFlow()";
98
98
  readonly means: "chainFlow() was called with zero Flows.";
99
99
  readonly fix: "Pass at least one Flow.";
100
100
  };
101
101
  readonly WG_MODVERIFY_FUNCTION_FORM: {
102
- readonly where: "engine/core.ts - modVerify()";
102
+ readonly where: "core/block.ts - modVerify()";
103
103
  readonly means: "modVerify() was called on a Block whose verify is a function (tag-driven), which has no fixed list to address an item into.";
104
104
  readonly fix: "Use withVerify() to replace the whole verify instead.";
105
105
  };
106
106
  readonly WG_MODVERIFY_NOT_FOUND: {
107
- readonly where: "engine/core.ts - modVerify()";
107
+ readonly where: "core/block.ts - modVerify()";
108
108
  readonly means: "The Trait name/index given doesn't exist in this Block's verify list.";
109
109
  readonly fix: "Check the Block's actual verify list for the right name/index.";
110
110
  };
@@ -114,6 +114,40 @@ export declare const WAYGRAPH_ERRORS: {
114
114
  readonly fix: "Set it first, or use mem.has(key) to check before an optional read.";
115
115
  };
116
116
  };
117
+ /**
118
+ * The actual text every `throw new WaygraphError(...)` site uses - one named export per throw
119
+ * site (several throw sites can share a `WAYGRAPH_ERRORS` code but always have their own distinct
120
+ * message here, since the same code can legitimately fire from more than one spot with different
121
+ * detail). Plain strings for a message with no runtime values; a function for one that needs them.
122
+ * `grep MSG_ src/errors.ts` finds every fixed string the engine can throw, in one place.
123
+ */
124
+ export declare const MSG_PREFLIGHT_MISSING_KEY: (blockName: string, missingKeys: string) => string;
125
+ export declare const MSG_RUNGRAPH_MAX_STEPS: (maxSteps: number) => string;
126
+ export declare const MSG_RUNGRAPH_NOT_TERMINAL: (blockName: string, state: string, terminals: string) => string;
127
+ export declare const MSG_FLOW_BLOCK_NOT_FOUND_BY_INDEX: (index: number, length: number) => string;
128
+ export declare const MSG_FLOW_BLOCK_NOT_FOUND_BY_NAME: (blockName: string, names: string) => string;
129
+ export declare const MSG_MODVERIFY_FUNCTION_FORM: (blockName: string) => string;
130
+ export declare const MSG_MODVERIFY_NOT_FOUND_BY_INDEX: (blockName: string, index: number, length: number) => string;
131
+ export declare const MSG_MODVERIFY_NOT_FOUND_BY_NAME: (blockName: string, name: string, names: string) => string;
132
+ export declare const MSG_MAP_WRONG_KIND: (method: string, blockName: string, wanted: string, found: string) => string;
133
+ export declare const MSG_MAP_WRONG_SALT: (method: string, blockName: string, wanted: string, found: string) => string;
134
+ export declare const MSG_MAP_WRONG_ORIGIN_INTERNAL: (blockName: string, targetOrigin: string, wantOrigin: string) => string;
135
+ export declare const MSG_MAP_WRONG_ORIGIN_EXTERNAL: (blockName: string, targetOrigin: string, wantOrigin: string) => string;
136
+ export declare const MSG_MAP_BRANCH_SHARED_SESSION_UNSUPPORTED: string;
137
+ export declare const MSG_MAP_FF_ALREADY_OPEN: (ffName: string) => string;
138
+ export declare const MSG_MAP_FF_NOT_OPEN = "Waygraph map: .ffEnd() with no open .ffStart()";
139
+ export declare const MSG_MAP_FF_EMPTY: (ffName: string) => string;
140
+ export declare const MSG_MAP_METHOD_GOT_ASSERT: (blockName: string) => string;
141
+ export declare const MSG_MAP_BRANCH_NO_PRIOR_STEP: string;
142
+ export declare const MSG_MAP_FF_NOT_CLOSED: (ffName: string) => string;
143
+ export declare const MSG_MAP_EMPTY: string;
144
+ export declare const MSG_BRANCH_REGRESSION_NO_BROWSER: string;
145
+ export declare const MSG_MEM_READ_BEFORE_SET: (keyName: string) => string;
146
+ export declare const MSG_COMPOSE_EMPTY: (name: string) => string;
147
+ export declare const MSG_FASTFORWARD_EMPTY: (name: string) => string;
148
+ export declare const MSG_CHAINFLOW_BLOCK_NOT_FOUND_BY_INDEX: (index: number, count: number) => string;
149
+ export declare const MSG_CHAINFLOW_BLOCK_NOT_FOUND_BY_NAME: (blockName: string) => string;
150
+ export declare const MSG_CHAINFLOW_EMPTY = "chainFlow: give at least one Flow";
117
151
  export type WaygraphErrorCode = keyof typeof WAYGRAPH_ERRORS;
118
152
  /** A thrown engine error with a stable, greppable `.code` - see WAYGRAPH_ERRORS for the full list. */
119
153
  export declare class WaygraphError extends Error {