waygraph 0.15.46 → 0.15.49

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 (353) hide show
  1. package/dist/analysis/graph.js +2 -2
  2. package/dist/auto-session/session.js +2 -2
  3. package/dist/cli/discover.d.ts +1 -1
  4. package/dist/cli/discover.js +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/{agent-dive.js → commands/agent-dive-scaffold.js} +2 -2
  7. package/dist/commands/agent-dive.js +1 -1
  8. package/dist/{engine/core.js → core/block.js} +6 -6
  9. package/dist/core/blocks/api.d.ts +54 -0
  10. package/dist/core/blocks/api.js +75 -0
  11. package/dist/{engine → core}/blocks/effect.d.ts +1 -1
  12. package/dist/{engine → core}/blocks/effect.js +1 -1
  13. package/dist/{engine → core}/blocks/method.d.ts +1 -1
  14. package/dist/{engine → core}/blocks/method.js +1 -1
  15. package/dist/{engine → core}/blocks/nav.js +1 -1
  16. package/dist/{engine → core}/blocks/page.js +1 -1
  17. package/dist/{engine → core}/branch-regression.js +2 -3
  18. package/dist/{engine → core}/compose.js +4 -4
  19. package/dist/{engine/engine-class.d.ts → core/engine.d.ts} +2 -133
  20. package/dist/core/engine.js +50 -0
  21. package/dist/{engine → core}/flow.js +5 -5
  22. package/dist/core/map-builder.d.ts +171 -0
  23. package/dist/{engine/engine-class.js → core/map-builder.js} +82 -98
  24. package/dist/{engine → core}/run-graph.js +4 -6
  25. package/dist/core.d.ts +14 -0
  26. package/dist/core.js +15 -0
  27. package/dist/errors.d.ts +54 -20
  28. package/dist/errors.js +67 -20
  29. package/dist/highlights/run-phase.js +15 -2
  30. package/dist/highlights/stub-ctx.js +16 -0
  31. package/dist/highlights/types.d.ts +38 -0
  32. package/dist/index.d.ts +5 -3
  33. package/dist/index.js +1 -1
  34. package/dist/mem-page.js +2 -2
  35. package/dist/mem-stub.d.ts +1 -1
  36. package/dist/pilot-overlay/fixtures.js +55 -43
  37. package/dist/pilot-overlay/shell.js +23 -10
  38. package/dist/runner/banner-log.js +1 -0
  39. package/dist/runner/device-stage.js +35 -15
  40. package/dist/runner/inpage/banner.d.ts +21 -0
  41. package/dist/runner/inpage/banner.js +29 -4
  42. package/dist/runner/inpage/caption.d.ts +3 -0
  43. package/dist/runner/inpage/caption.js +23 -0
  44. package/dist/runner/inpage/core.js +32 -9
  45. package/dist/runner/inpage/network.d.ts +15 -0
  46. package/dist/runner/inpage/network.js +217 -0
  47. package/dist/runner/inpage/panel-chrome.js +41 -1
  48. package/dist/runner/inpage/swipe-zoom.js +1 -1
  49. package/dist/runner/inpage/todos.js +6 -1
  50. package/dist/runner/main.js +9 -2
  51. package/dist/runner/network-capture.d.ts +9 -0
  52. package/dist/runner/network-capture.js +126 -0
  53. package/dist/runner/overlay-css.js +71 -7
  54. package/dist/runner/overlay-install.js +39 -2
  55. package/dist/runner/overlay-stage.js +5 -0
  56. package/dist/runner/rings.js +69 -45
  57. package/dist/runner/slides.js +14 -8
  58. package/dist/runner/step-mode.js +12 -0
  59. package/dist/runner/step-panels.js +9 -3
  60. package/dist/runner/teardown.js +16 -9
  61. package/dist/session/auto-explore-run.d.ts +1 -1
  62. package/dist/session/auto-explore-run.js +47 -10
  63. package/dist/{step-overlay.d.ts → session/step-overlay.d.ts} +1 -1
  64. package/dist/{step-overlay.js → session/step-overlay.js} +1 -1
  65. package/dist/trait.d.ts +1 -0
  66. package/dist/trait.js +15 -0
  67. package/dist/traverse/run.js +1 -1
  68. package/dist/ui/components/ring.js +4 -2
  69. package/dist/ui/overlay.css +36 -3
  70. package/examples/saucedemo/.waygraph-auto/00d147d1.log +21 -0
  71. package/examples/saucedemo/.waygraph-auto/02f7dd22.log +20 -0
  72. package/examples/saucedemo/.waygraph-auto/0402cfcf.log +6 -0
  73. package/examples/saucedemo/.waygraph-auto/062b581f.log +20 -0
  74. package/examples/saucedemo/.waygraph-auto/0681582b.log +6 -0
  75. package/examples/saucedemo/.waygraph-auto/07f3e964.log +6 -0
  76. package/examples/saucedemo/.waygraph-auto/0868ae4d.log +0 -0
  77. package/examples/saucedemo/.waygraph-auto/0924ddaa.log +22 -0
  78. package/examples/saucedemo/.waygraph-auto/092d6173.log +5 -0
  79. package/examples/saucedemo/.waygraph-auto/09924510.log +0 -0
  80. package/examples/saucedemo/.waygraph-auto/0998c941.log +21 -0
  81. package/examples/saucedemo/.waygraph-auto/0bf74300.log +21 -0
  82. package/examples/saucedemo/.waygraph-auto/0c01fd29.log +4 -0
  83. package/examples/saucedemo/.waygraph-auto/0c302590.log +0 -0
  84. package/examples/saucedemo/.waygraph-auto/0dee62d6.log +5 -0
  85. package/examples/saucedemo/.waygraph-auto/0eb4c081.log +5 -0
  86. package/examples/saucedemo/.waygraph-auto/10fd431c.log +0 -0
  87. package/examples/saucedemo/.waygraph-auto/13c6fe3c.log +0 -0
  88. package/examples/saucedemo/.waygraph-auto/1581b677.log +0 -0
  89. package/examples/saucedemo/.waygraph-auto/164761a5.log +6 -0
  90. package/examples/saucedemo/.waygraph-auto/1905ceb2.log +0 -0
  91. package/examples/saucedemo/.waygraph-auto/1b1d55c6.log +0 -0
  92. package/examples/saucedemo/.waygraph-auto/1b80fd24.log +6 -0
  93. package/examples/saucedemo/.waygraph-auto/1c30a3c2.log +0 -0
  94. package/examples/saucedemo/.waygraph-auto/1c58a174.log +0 -0
  95. package/examples/saucedemo/.waygraph-auto/1d90aa9a.log +0 -0
  96. package/examples/saucedemo/.waygraph-auto/1de7d889.log +0 -0
  97. package/examples/saucedemo/.waygraph-auto/1f233a4c.log +6 -0
  98. package/examples/saucedemo/.waygraph-auto/20e66801.log +0 -0
  99. package/examples/saucedemo/.waygraph-auto/20ffdb77.log +0 -0
  100. package/examples/saucedemo/.waygraph-auto/22f1a704.log +5 -0
  101. package/examples/saucedemo/.waygraph-auto/239cced3.log +20 -0
  102. package/examples/saucedemo/.waygraph-auto/25204b46.log +4 -0
  103. package/examples/saucedemo/.waygraph-auto/25e2e90f.log +0 -0
  104. package/examples/saucedemo/.waygraph-auto/2708455e.log +22 -0
  105. package/examples/saucedemo/.waygraph-auto/272a96fd.log +20 -0
  106. package/examples/saucedemo/.waygraph-auto/28d7be5d.log +0 -0
  107. package/examples/saucedemo/.waygraph-auto/2a6a8266.log +6 -0
  108. package/examples/saucedemo/.waygraph-auto/2b3401cf.log +20 -0
  109. package/examples/saucedemo/.waygraph-auto/2ceccd6d.log +0 -0
  110. package/examples/saucedemo/.waygraph-auto/2f1b0c13.log +6 -0
  111. package/examples/saucedemo/.waygraph-auto/2f8d4073.log +6 -0
  112. package/examples/saucedemo/.waygraph-auto/30739278.log +6 -0
  113. package/examples/saucedemo/.waygraph-auto/31cb2e80.log +0 -0
  114. package/examples/saucedemo/.waygraph-auto/322d63cd.log +0 -0
  115. package/examples/saucedemo/.waygraph-auto/3239aa8a.log +6 -0
  116. package/examples/saucedemo/.waygraph-auto/326d87b7.log +6 -0
  117. package/examples/saucedemo/.waygraph-auto/3351c0b6.log +0 -0
  118. package/examples/saucedemo/.waygraph-auto/33df0770.log +0 -0
  119. package/examples/saucedemo/.waygraph-auto/340d624d.log +0 -0
  120. package/examples/saucedemo/.waygraph-auto/36367ccf.log +0 -0
  121. package/examples/saucedemo/.waygraph-auto/372536a5.log +6 -0
  122. package/examples/saucedemo/.waygraph-auto/3a412f3c.log +0 -0
  123. package/examples/saucedemo/.waygraph-auto/3a859bd7.log +0 -0
  124. package/examples/saucedemo/.waygraph-auto/3cb0add7.log +0 -0
  125. package/examples/saucedemo/.waygraph-auto/3e42f0d8.log +0 -0
  126. package/examples/saucedemo/.waygraph-auto/4144071d.log +0 -0
  127. package/examples/saucedemo/.waygraph-auto/4176a3c6.log +0 -0
  128. package/examples/saucedemo/.waygraph-auto/41d0793d.log +4 -0
  129. package/examples/saucedemo/.waygraph-auto/41e6feae.log +0 -0
  130. package/examples/saucedemo/.waygraph-auto/424b4d5d.log +0 -0
  131. package/examples/saucedemo/.waygraph-auto/43253aba.log +0 -0
  132. package/examples/saucedemo/.waygraph-auto/438c6c53.log +22 -0
  133. package/examples/saucedemo/.waygraph-auto/4477db12.log +0 -0
  134. package/examples/saucedemo/.waygraph-auto/4a1258b7.log +0 -0
  135. package/examples/saucedemo/.waygraph-auto/4adcd179.log +20 -0
  136. package/examples/saucedemo/.waygraph-auto/4c9d9b16.log +21 -0
  137. package/examples/saucedemo/.waygraph-auto/4da39c36.log +6 -0
  138. package/examples/saucedemo/.waygraph-auto/4dbefa7e.log +5 -0
  139. package/examples/saucedemo/.waygraph-auto/4efa7035.log +6 -0
  140. package/examples/saucedemo/.waygraph-auto/505affdc.log +4 -0
  141. package/examples/saucedemo/.waygraph-auto/51bcb60a.log +0 -0
  142. package/examples/saucedemo/.waygraph-auto/5291bc78.log +22 -0
  143. package/examples/saucedemo/.waygraph-auto/54274c39.log +5 -0
  144. package/examples/saucedemo/.waygraph-auto/5440ce7e.log +0 -0
  145. package/examples/saucedemo/.waygraph-auto/5738175f.log +22 -0
  146. package/examples/saucedemo/.waygraph-auto/57ce5643.log +22 -0
  147. package/examples/saucedemo/.waygraph-auto/5984426b.log +6 -0
  148. package/examples/saucedemo/.waygraph-auto/5a682e7c.log +22 -0
  149. package/examples/saucedemo/.waygraph-auto/5b79320c.log +21 -0
  150. package/examples/saucedemo/.waygraph-auto/5c55aaac.log +21 -0
  151. package/examples/saucedemo/.waygraph-auto/5ed00b16.log +4 -0
  152. package/examples/saucedemo/.waygraph-auto/60b9c066.log +6 -0
  153. package/examples/saucedemo/.waygraph-auto/610dd127.log +0 -0
  154. package/examples/saucedemo/.waygraph-auto/61105500.log +5 -0
  155. package/examples/saucedemo/.waygraph-auto/61333142.log +5 -0
  156. package/examples/saucedemo/.waygraph-auto/6134afe8.log +20 -0
  157. package/examples/saucedemo/.waygraph-auto/61937e83.log +22 -0
  158. package/examples/saucedemo/.waygraph-auto/62a0bdc9.log +22 -0
  159. package/examples/saucedemo/.waygraph-auto/6376fc15.log +0 -0
  160. package/examples/saucedemo/.waygraph-auto/6599cbca.log +22 -0
  161. package/examples/saucedemo/.waygraph-auto/67aaca30.log +0 -0
  162. package/examples/saucedemo/.waygraph-auto/68b10298.log +0 -0
  163. package/examples/saucedemo/.waygraph-auto/68be5e12.log +0 -0
  164. package/examples/saucedemo/.waygraph-auto/68df05a6.log +22 -0
  165. package/examples/saucedemo/.waygraph-auto/693f67c4.log +20 -0
  166. package/examples/saucedemo/.waygraph-auto/69ae030a.log +6 -0
  167. package/examples/saucedemo/.waygraph-auto/69e73f35.log +6 -0
  168. package/examples/saucedemo/.waygraph-auto/6b2333b0.log +5 -0
  169. package/examples/saucedemo/.waygraph-auto/6c4c3817.log +0 -0
  170. package/examples/saucedemo/.waygraph-auto/6c954911.log +0 -0
  171. package/examples/saucedemo/.waygraph-auto/6d65a439.log +5 -0
  172. package/examples/saucedemo/.waygraph-auto/6d700055.log +0 -0
  173. package/examples/saucedemo/.waygraph-auto/6ead848f.log +0 -0
  174. package/examples/saucedemo/.waygraph-auto/72675b2d.log +6 -0
  175. package/examples/saucedemo/.waygraph-auto/733dd260.log +5 -0
  176. package/examples/saucedemo/.waygraph-auto/75016486.log +0 -0
  177. package/examples/saucedemo/.waygraph-auto/752b01c6.log +22 -0
  178. package/examples/saucedemo/.waygraph-auto/75675227.log +6 -0
  179. package/examples/saucedemo/.waygraph-auto/75e2e658.log +0 -0
  180. package/examples/saucedemo/.waygraph-auto/76ac1a86.log +0 -0
  181. package/examples/saucedemo/.waygraph-auto/77605295.log +0 -0
  182. package/examples/saucedemo/.waygraph-auto/792671f4.log +22 -0
  183. package/examples/saucedemo/.waygraph-auto/79915adb.log +20 -0
  184. package/examples/saucedemo/.waygraph-auto/7a398774.log +6 -0
  185. package/examples/saucedemo/.waygraph-auto/7a72f66e.log +6 -0
  186. package/examples/saucedemo/.waygraph-auto/7a984334.log +4 -0
  187. package/examples/saucedemo/.waygraph-auto/7c6ee793.log +20 -0
  188. package/examples/saucedemo/.waygraph-auto/7c726dc4.log +22 -0
  189. package/examples/saucedemo/.waygraph-auto/7c72e8a5.log +4 -0
  190. package/examples/saucedemo/.waygraph-auto/7dbee625.log +22 -0
  191. package/examples/saucedemo/.waygraph-auto/7df66956.log +0 -0
  192. package/examples/saucedemo/.waygraph-auto/7e053160.log +0 -0
  193. package/examples/saucedemo/.waygraph-auto/802a0b5b.log +0 -0
  194. package/examples/saucedemo/.waygraph-auto/80322e0b.log +0 -0
  195. package/examples/saucedemo/.waygraph-auto/80a4978e.log +6 -0
  196. package/examples/saucedemo/.waygraph-auto/81cfe480.log +22 -0
  197. package/examples/saucedemo/.waygraph-auto/832f5add.log +0 -0
  198. package/examples/saucedemo/.waygraph-auto/8337b6ad.log +0 -0
  199. package/examples/saucedemo/.waygraph-auto/8493928e.log +0 -0
  200. package/examples/saucedemo/.waygraph-auto/853bde43.log +0 -0
  201. package/examples/saucedemo/.waygraph-auto/86350ea6.log +22 -0
  202. package/examples/saucedemo/.waygraph-auto/86bb598a.log +0 -0
  203. package/examples/saucedemo/.waygraph-auto/86d09876.log +22 -0
  204. package/examples/saucedemo/.waygraph-auto/878ad01b.log +4 -0
  205. package/examples/saucedemo/.waygraph-auto/87c88ba5.log +0 -0
  206. package/examples/saucedemo/.waygraph-auto/87cb80ff.log +0 -0
  207. package/examples/saucedemo/.waygraph-auto/880b2e78.log +6 -0
  208. package/examples/saucedemo/.waygraph-auto/88527936.log +5 -0
  209. package/examples/saucedemo/.waygraph-auto/893023ea.log +5 -0
  210. package/examples/saucedemo/.waygraph-auto/89416718.log +0 -0
  211. package/examples/saucedemo/.waygraph-auto/8996a857.log +6 -0
  212. package/examples/saucedemo/.waygraph-auto/8a64ba0f.log +6 -0
  213. package/examples/saucedemo/.waygraph-auto/8b1cc2aa.log +6 -0
  214. package/examples/saucedemo/.waygraph-auto/8b73d13e.log +6 -0
  215. package/examples/saucedemo/.waygraph-auto/8d960d31.log +1 -0
  216. package/examples/saucedemo/.waygraph-auto/8d9e5cd2.log +21 -0
  217. package/examples/saucedemo/.waygraph-auto/8ec7d260.log +0 -0
  218. package/examples/saucedemo/.waygraph-auto/8ed43279.log +0 -0
  219. package/examples/saucedemo/.waygraph-auto/93acae32.log +5 -0
  220. package/examples/saucedemo/.waygraph-auto/96321a08.log +0 -0
  221. package/examples/saucedemo/.waygraph-auto/9742b6c2.log +6 -0
  222. package/examples/saucedemo/.waygraph-auto/99cc93eb.log +6 -0
  223. package/examples/saucedemo/.waygraph-auto/9cbfbedc.log +0 -0
  224. package/examples/saucedemo/.waygraph-auto/9dc147d2.log +22 -0
  225. package/examples/saucedemo/.waygraph-auto/a215a395.log +22 -0
  226. package/examples/saucedemo/.waygraph-auto/a23b7086.log +4 -0
  227. package/examples/saucedemo/.waygraph-auto/a35bd5ec.log +0 -0
  228. package/examples/saucedemo/.waygraph-auto/a68995e9.log +22 -0
  229. package/examples/saucedemo/.waygraph-auto/a6e4f936.log +22 -0
  230. package/examples/saucedemo/.waygraph-auto/a7da862b.log +0 -0
  231. package/examples/saucedemo/.waygraph-auto/a82e2a48.log +0 -0
  232. package/examples/saucedemo/.waygraph-auto/a952eb91.log +0 -0
  233. package/examples/saucedemo/.waygraph-auto/a9559653.log +5 -0
  234. package/examples/saucedemo/.waygraph-auto/aa478de2.log +0 -0
  235. package/examples/saucedemo/.waygraph-auto/ac350fc7.log +20 -0
  236. package/examples/saucedemo/.waygraph-auto/acc1b63a.log +0 -0
  237. package/examples/saucedemo/.waygraph-auto/ad12d191.log +0 -0
  238. package/examples/saucedemo/.waygraph-auto/ae3a9b06.log +0 -0
  239. package/examples/saucedemo/.waygraph-auto/b04638f4.log +6 -0
  240. package/examples/saucedemo/.waygraph-auto/b48863e5.log +22 -0
  241. package/examples/saucedemo/.waygraph-auto/b56968e1.log +6 -0
  242. package/examples/saucedemo/.waygraph-auto/b64e0620.log +20 -0
  243. package/examples/saucedemo/.waygraph-auto/b86a6218.log +6 -0
  244. package/examples/saucedemo/.waygraph-auto/b8e9e956.log +22 -0
  245. package/examples/saucedemo/.waygraph-auto/b9b310ff.log +21 -0
  246. package/examples/saucedemo/.waygraph-auto/bc111745.log +22 -0
  247. package/examples/saucedemo/.waygraph-auto/bf7a77a2.log +0 -0
  248. package/examples/saucedemo/.waygraph-auto/c0d6f353.log +21 -0
  249. package/examples/saucedemo/.waygraph-auto/c0febcf2.log +20 -0
  250. package/examples/saucedemo/.waygraph-auto/c4c52998.log +6 -0
  251. package/examples/saucedemo/.waygraph-auto/c809ceb4.log +22 -0
  252. package/examples/saucedemo/.waygraph-auto/ca6de7e7.log +0 -0
  253. package/examples/saucedemo/.waygraph-auto/ca8561bc.log +0 -0
  254. package/examples/saucedemo/.waygraph-auto/cb86d45b.log +0 -0
  255. package/examples/saucedemo/.waygraph-auto/cb9a1978.log +6 -0
  256. package/examples/saucedemo/.waygraph-auto/cbbc689c.log +6 -0
  257. package/examples/saucedemo/.waygraph-auto/cd88364b.log +0 -0
  258. package/examples/saucedemo/.waygraph-auto/cd919e1d.log +0 -0
  259. package/examples/saucedemo/.waygraph-auto/cfff9eef.log +20 -0
  260. package/examples/saucedemo/.waygraph-auto/d0f59b21.log +4 -0
  261. package/examples/saucedemo/.waygraph-auto/d1195079.log +20 -0
  262. package/examples/saucedemo/.waygraph-auto/d2ef067a.log +5 -0
  263. package/examples/saucedemo/.waygraph-auto/d425471f.log +6 -0
  264. package/examples/saucedemo/.waygraph-auto/d5293921.log +0 -0
  265. package/examples/saucedemo/.waygraph-auto/d62a22c2.log +21 -0
  266. package/examples/saucedemo/.waygraph-auto/d6d1761f.log +22 -0
  267. package/examples/saucedemo/.waygraph-auto/d6d5f411.log +22 -0
  268. package/examples/saucedemo/.waygraph-auto/d6df2771.log +6 -0
  269. package/examples/saucedemo/.waygraph-auto/d7075012.log +21 -0
  270. package/examples/saucedemo/.waygraph-auto/d9ddc297.log +0 -0
  271. package/examples/saucedemo/.waygraph-auto/db4ac845.log +0 -0
  272. package/examples/saucedemo/.waygraph-auto/db6d7774.log +0 -0
  273. package/examples/saucedemo/.waygraph-auto/db839827.log +5 -0
  274. package/examples/saucedemo/.waygraph-auto/dde5e859.log +22 -0
  275. package/examples/saucedemo/.waygraph-auto/de8cac58.log +0 -0
  276. package/examples/saucedemo/.waygraph-auto/ded5511a.log +6 -0
  277. package/examples/saucedemo/.waygraph-auto/dedfcb18.log +0 -0
  278. package/examples/saucedemo/.waygraph-auto/def4d9b1.log +0 -0
  279. package/examples/saucedemo/.waygraph-auto/e1549e40.log +0 -0
  280. package/examples/saucedemo/.waygraph-auto/e1b0676d.log +21 -0
  281. package/examples/saucedemo/.waygraph-auto/e5111463.log +0 -0
  282. package/examples/saucedemo/.waygraph-auto/e5fc1d7c.log +5 -0
  283. package/examples/saucedemo/.waygraph-auto/e6fd2202.log +0 -0
  284. package/examples/saucedemo/.waygraph-auto/edaa806d.log +0 -0
  285. package/examples/saucedemo/.waygraph-auto/edaf33de.log +0 -0
  286. package/examples/saucedemo/.waygraph-auto/edd40cbb.log +20 -0
  287. package/examples/saucedemo/.waygraph-auto/eddfbffc.log +6 -0
  288. package/examples/saucedemo/.waygraph-auto/ee9fa1ad.log +5 -0
  289. package/examples/saucedemo/.waygraph-auto/ef319474.log +22 -0
  290. package/examples/saucedemo/.waygraph-auto/f28eee8d.log +0 -0
  291. package/examples/saucedemo/.waygraph-auto/f33bde90.log +0 -0
  292. package/examples/saucedemo/.waygraph-auto/f6ba7cb4.log +6 -0
  293. package/examples/saucedemo/.waygraph-auto/f7ac4d62.log +20 -0
  294. package/examples/saucedemo/.waygraph-auto/f929bb79.log +0 -0
  295. package/examples/saucedemo/.waygraph-auto/f92d4c6c.log +22 -0
  296. package/examples/saucedemo/.waygraph-auto/f92faf40.log +5 -0
  297. package/examples/saucedemo/.waygraph-auto/fa784369.log +21 -0
  298. package/examples/saucedemo/.waygraph-auto/fb55f723.log +20 -0
  299. package/examples/saucedemo/.waygraph-auto/fba3b738.log +0 -0
  300. package/examples/saucedemo/.waygraph-auto/ffdf2854.log +6 -0
  301. package/examples/saucedemo/README.md +13 -2
  302. package/examples/saucedemo/package.json +4 -0
  303. package/examples/saucedemo/src/flows/api-demo.flow.ts +37 -0
  304. package/examples/saucedemo/src/flows/checkout.flow.ts +34 -11
  305. package/package.json +5 -3
  306. package/dist/auto-explore-run.d.ts +0 -37
  307. package/dist/auto-explore-run.js +0 -670
  308. package/dist/auto-explore.d.ts +0 -57
  309. package/dist/auto-explore.js +0 -376
  310. package/dist/auto-session-ipc.d.ts +0 -150
  311. package/dist/auto-session-ipc.js +0 -497
  312. package/dist/block-inject.d.ts +0 -15
  313. package/dist/block-inject.js +0 -91
  314. package/dist/browser.d.ts +0 -15
  315. package/dist/browser.js +0 -29
  316. package/dist/coverage-gap.d.ts +0 -11
  317. package/dist/coverage-gap.js +0 -119
  318. package/dist/engine.d.ts +0 -12
  319. package/dist/engine.js +0 -13
  320. package/dist/graph.d.ts +0 -92
  321. package/dist/graph.js +0 -467
  322. package/dist/highlight-shorthand.d.ts +0 -24
  323. package/dist/highlight-shorthand.js +0 -30
  324. package/dist/map-check.d.ts +0 -18
  325. package/dist/map-check.js +0 -140
  326. package/dist/overlay-beacon.d.ts +0 -44
  327. package/dist/overlay-beacon.js +0 -85
  328. package/dist/pilot.d.ts +0 -54
  329. package/dist/pilot.js +0 -80
  330. package/dist/practices-check.d.ts +0 -14
  331. package/dist/practices-check.js +0 -195
  332. package/dist/traverse-coverage.d.ts +0 -59
  333. package/dist/traverse-coverage.js +0 -127
  334. package/dist/traverse-lease.d.ts +0 -18
  335. package/dist/traverse-lease.js +0 -62
  336. package/dist/traverse-run.d.ts +0 -47
  337. package/dist/traverse-run.js +0 -439
  338. package/dist/ui/compose.d.ts +0 -4
  339. package/dist/ui/compose.js +0 -7
  340. /package/dist/{verbose-log.d.ts → auto-session/verbose-log.d.ts} +0 -0
  341. /package/dist/{verbose-log.js → auto-session/verbose-log.js} +0 -0
  342. /package/dist/{agent-dive.d.ts → commands/agent-dive-scaffold.d.ts} +0 -0
  343. /package/dist/{engine/core.d.ts → core/block.d.ts} +0 -0
  344. /package/dist/{engine → core}/blocks/nav.d.ts +0 -0
  345. /package/dist/{engine → core}/blocks/page.d.ts +0 -0
  346. /package/dist/{engine → core}/branch-regression.d.ts +0 -0
  347. /package/dist/{engine → core}/compose.d.ts +0 -0
  348. /package/dist/{engine → core}/config.d.ts +0 -0
  349. /package/dist/{engine → core}/config.js +0 -0
  350. /package/dist/{engine → core}/flow.d.ts +0 -0
  351. /package/dist/{engine → core}/locate.d.ts +0 -0
  352. /package/dist/{engine → core}/locate.js +0 -0
  353. /package/dist/{engine → core}/run-graph.d.ts +0 -0
@@ -0,0 +1,171 @@
1
+ import type { Block, Checkpoint } from "../types.js";
2
+ import type { EndMarker, StartMarker } from "./run-graph.js";
3
+ import type { Flow } from "./flow.js";
4
+ import type { NavBlock } from "./blocks/nav.js";
5
+ import type { PageBlock } from "./blocks/page.js";
6
+ import type { AssertBlock, MethodBlock } from "./blocks/method.js";
7
+ import type { EffectBlock } from "./blocks/effect.js";
8
+ type S = Checkpoint<"__start__">;
9
+ /**
10
+ * The one capability MapBuilder needs from Engine - a plain defineFlow-shaped function, not the
11
+ * whole Engine class. Depending on Engine-the-type here would make engine.ts and map-builder.ts
12
+ * import each other (Engine.map() builds a MapBuilder; MapBuilder.end() calls back into
13
+ * defineFlow) - a real cycle check:structure forbids. This type is how that's avoided.
14
+ */
15
+ export type DefineFlowFn = (blocks: readonly [StartMarker, ...Block<any, any>[], EndMarker]) => Flow<any>;
16
+ /** Per-step options every `MapBuilder` step method (`.gotoPage()`/`.method()`/`.assert()`) takes. */
17
+ export interface MapStepOpts {
18
+ /**
19
+ * Fast-forward just this step, inline - no `.ffStart()/.ffEnd()` bracket needed. Consecutive
20
+ * `{ ff: true }` steps merge into ONE fast-forward block, same result as the explicit bracket
21
+ * form; a step without the flag closes an auto-opened window first.
22
+ * @example map().gotoPage(NavLoginBlock, { ff: true }).method(FillUsernameBlock, { ff: true })
23
+ */
24
+ ff?: boolean;
25
+ }
26
+ export interface MapBuilderOptions {
27
+ /**
28
+ * This project's own origin (e.g. `"https://app.example.com"`) - enables
29
+ * `.gotoPage()`/`.gotoExternal()`'s origin check against a Block's static
30
+ * `url`. Omit to skip that check entirely (still fully kind-checked either
31
+ * way; only the internal/external origin distinction is opt-in).
32
+ */
33
+ homeOrigin?: string;
34
+ }
35
+ /**
36
+ * Fluent builder over {@link Engine.defineFlow} - see `map()`'s own doc
37
+ * comment for why this exists. Each step method is scoped to exactly the
38
+ * Block kind its name promises, checked at RUNTIME against the
39
+ * `__waygraphKind`/`__waygraphSalt` markers `defineNavBlock`/`definePageBlock`/
40
+ * `defineAssertBlock`/`defineMethodBlock`/`defineEffectBlock` already set
41
+ * (the same markers `graph.ts` and `map-check.ts` trust) - not just a type
42
+ * hint, since a hand-rolled object can satisfy the TypeScript `Block<In,Out>`
43
+ * shape without ever going through a real factory. Each call also
44
+ * typechecks the accumulated Checkpoint chain exactly like `defineFlow`'s
45
+ * own tuple overloads do (a step's `In` must equal the previous step's
46
+ * `Out`) - this is what "no teleporting" means: there is no method on this
47
+ * builder that can skip from one Checkpoint to an unrelated one without a
48
+ * real, kind-correct Block in between.
49
+ */
50
+ export declare class MapBuilder<Out extends Checkpoint<string>> {
51
+ private readonly defineFlow;
52
+ private readonly steps;
53
+ private readonly homeOrigin;
54
+ private readonly ff;
55
+ private constructor();
56
+ /** @internal - use `engine.map()` or the standalone `map()` export. */
57
+ static begin(defineFlow: DefineFlowFn, homeOrigin: string | undefined): MapBuilder<S>;
58
+ /** Readable chain-opener - mirrors `defineFlow`'s leading `start` sentinel. Returns `this` unchanged; entirely optional. */
59
+ start(): MapBuilder<Out>;
60
+ /**
61
+ * Open a fast-forward window - steps until {@link ffEnd} collapse into one
62
+ * opaque `fastForwardComposeBlock` (blitz theater). Kind/salt checks still
63
+ * run on each inner step as it is added.
64
+ */
65
+ ffStart(name?: string): MapBuilder<Out>;
66
+ /**
67
+ * Close the current fast-forward window and append one FFCompose step.
68
+ * Throws if empty or if {@link ffStart} was never opened.
69
+ */
70
+ ffEnd(): MapBuilder<Out>;
71
+ /** Shared by the explicit {@link ffEnd} and the implicit close a `{ ff: true }` step flag triggers. */
72
+ private closeFf;
73
+ /**
74
+ * `ff`: inline fast-forward, no `.ffStart()/.ffEnd()` bracket needed - `.method(X, { ff: true })`
75
+ * marks just that step; consecutive `{ ff: true }` steps merge into ONE fast-forward block (same
76
+ * runtime result as the explicit bracket form), same as if they'd been wrapped in
77
+ * `.ffStart()/.ffEnd()`. A step WITHOUT the flag closes an auto-opened window first, so a plain
78
+ * step is never silently swept into one; an EXPLICIT `.ffStart()` window still behaves as before
79
+ * (stays open until its own `.ffEnd()`, regardless of whether a step passed `{ ff: true }`).
80
+ */
81
+ private appendStep;
82
+ /**
83
+ * Appends an internal navigation/page-arrival step - requires a Block from
84
+ * `defineNavBlock`/`defineMemNavBlock`/`definePageBlock`. Throws if given
85
+ * anything else, including a `homeOrigin`-mismatched static `url`.
86
+ * Compile-time: {@link NavBlock} or {@link PageBlock} only (not Assert/Method).
87
+ * `{ ff: true }`: fast-forward this one step inline - see {@link appendStep}'s own comment.
88
+ */
89
+ gotoPage<NextOut extends Checkpoint<string>>(block: (NavBlock<NextOut> | PageBlock<NextOut>) & {
90
+ name: string;
91
+ }, opts?: MapStepOpts): MapBuilder<NextOut>;
92
+ /**
93
+ * Appends a genuinely cross-origin navigation step (e.g. `(external)/`
94
+ * Blocks in the Waygraph Map convention: mailpit, maildrop.cc) - same
95
+ * kind requirement as {@link gotoPage}, plus the inverse `homeOrigin` check.
96
+ * Compile-time: {@link NavBlock} or {@link PageBlock} only.
97
+ * `{ ff: true }`: fast-forward this one step inline - see {@link appendStep}'s own comment.
98
+ */
99
+ gotoExternal<NextOut extends Checkpoint<string>>(block: (NavBlock<NextOut> | PageBlock<NextOut>) & {
100
+ name: string;
101
+ }, opts?: MapStepOpts): MapBuilder<NextOut>;
102
+ /**
103
+ * Appends a self-loop verification step - requires a Block from
104
+ * `defineAssertBlock`. Compile-time: {@link AssertBlock} only (not `.method()`).
105
+ * `{ ff: true }`: fast-forward this one step inline - see {@link appendStep}'s own comment.
106
+ */
107
+ assert(block: AssertBlock<Out> & {
108
+ name: string;
109
+ }, opts?: MapStepOpts): MapBuilder<Out>;
110
+ /**
111
+ * Appends a non-navigating page action (submit, upload, add/remove an
112
+ * instance) - requires a Block from `defineMethodBlock`/`defineActionBlock`/
113
+ * `defineEffectBlock`/`defineMemEffectBlock`.
114
+ * Compile-time: {@link MethodBlock} or {@link EffectBlock} only - Assert
115
+ * Blocks must use `.assert()`. Runtime also rejects `__waygraphKind =
116
+ * "assert"` (those still carry method salt from the factory internals).
117
+ * `{ ff: true }`: fast-forward this one step inline - see {@link appendStep}'s own comment.
118
+ */
119
+ method<NextOut extends Checkpoint<string>>(block: (MethodBlock<Out, NextOut> | EffectBlock<Out, NextOut>) & {
120
+ name: string;
121
+ }, opts?: MapStepOpts): MapBuilder<NextOut>;
122
+ /**
123
+ * Branch: run everything added so far, then continue into whichever `routes[tag]` matches the
124
+ * resolved Checkpoint's tag - same page, same context, same mem. `routes` must cover every tag
125
+ * of `Out` (a missing one is a compile error, matching {@link branch}'s own exhaustiveness);
126
+ * `null` means that tag is terminal (the branched Flow just returns that Checkpoint).
127
+ *
128
+ * Each non-null route is a function, not a ready-made `Flow` - a fresh Flow always starts at the
129
+ * special `S` (start) Checkpoint, but a branch's blocks start from the TAG it routes on (e.g.
130
+ * `LoggedIn`), so the function is handed a brand-new `MapBuilder` already seeded at that exact
131
+ * Checkpoint to chain `.method()/.gotoPage()/.assert()/.end()` (or another `.branch()`) off of.
132
+ *
133
+ * Real gap this fixes: the plain `branch()` helper's `.next` routing is only ever consulted by
134
+ * `runGraph`'s own graph walk - `defineFlow`/`.end()` compose steps pairwise via `connect()`,
135
+ * which never looks at `.next` at all, so a Map-built Flow had no way to branch. This method
136
+ * branches at the Flow level instead: it finalizes the prefix, runs it, and picks the next Flow
137
+ * itself once the real tag is known - no engine-level routing involved.
138
+ *
139
+ * Only the `run(context, mem[, options])` signature is supported - the page must survive across
140
+ * the branch, and the bare `run(mem, config)` convenience form always closes its own browser
141
+ * before a tag is even known, so it throws instead of silently reopening a fresh (state-losing) page.
142
+ *
143
+ * The route's first Block still sees `input.__state === "__start__"` in `act()`, not the tag that
144
+ * routed there - `runGraph` seeds every Flow's entry Block that way unconditionally, the same as
145
+ * any standalone `defineFlow([start, block, end])` already does. Read `page`/`mem`, not `input`,
146
+ * in `act()` - every real Block in this codebase already follows that convention.
147
+ *
148
+ * @example
149
+ * map({ homeOrigin }).gotoPage(NavCartBlock).branch({
150
+ * ItemInCart: (m) => m.method(RemoveFromCartBlock).end(),
151
+ * LoggedIn: (m) => m.method(AddToCartBlock).end(),
152
+ * });
153
+ */
154
+ branch<Routes extends {
155
+ [K in Out["__state"]]: ((m: MapBuilder<Extract<Out, Checkpoint<K>>>) => Flow<any>) | null;
156
+ }>(routes: Routes): Flow<{
157
+ [K in keyof Routes & string]: Routes[K] extends (m: any) => Flow<infer R> ? R : Extract<Out, Checkpoint<K>>;
158
+ }[keyof Routes & string]>;
159
+ /**
160
+ * Finalizes this chain into a real, runnable {@link Flow} - same object
161
+ * `defineFlow` returns, so `withBlockVerify`/`modBlockVerify` and every
162
+ * `withTitle`/`withHighlightFixtures`/etc. decorator still apply exactly
163
+ * as they do today; this builder only changes how the chain is assembled,
164
+ * never what it produces. Throws if no step was ever added - an empty map
165
+ * isn't a flow. An auto-opened `{ ff: true }` window (see {@link MapStepOpts})
166
+ * left open at `.end()` closes silently; an EXPLICIT `.ffStart()` left open
167
+ * still throws - the author opened that one and needs to close it themselves.
168
+ */
169
+ end(): Flow<Out>;
170
+ }
171
+ export {};
@@ -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";