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
@@ -229,12 +229,12 @@ function isBlockLike(val) {
229
229
  const instruction = obj.instruction;
230
230
  return instruction !== null && typeof instruction === "object" && typeof instruction?.act === "function";
231
231
  }
232
- /** Set by `defineNavBlock` (non-enumerable) - see src/engine.ts. */
232
+ /** Set by `defineNavBlock` (non-enumerable) - see src/core.ts. */
233
233
  function isNavBlockMarked(val) {
234
234
  const kind = val.__waygraphKind;
235
235
  return kind === "nav" || kind === "page";
236
236
  }
237
- /** Set by `defineAssertBlock` (non-enumerable) - see src/engine.ts. */
237
+ /** Set by `defineAssertBlock` (non-enumerable) - see src/core.ts. */
238
238
  function isAssertBlockMarked(val) {
239
239
  return val.__waygraphKind === "assert";
240
240
  }
@@ -3,11 +3,11 @@ import { CONSOLE_LOG_MAX_ENTRIES, FULL_MODE_DEFAULT_DEPTH, FULL_MODE_MAX_NODES,
3
3
  import { instrumentPilotActions, installPersistentPilotOverlay, showPilotActivity, showPilotFixtures, showPilotVision, phaseToOverlayFixtures, describeOverlayFixtures, updatePilotOverlay } from "../pilot-overlay.js";
4
4
  import { buildExploreContext, buildExploreMenu } from "../session/auto-explore.js";
5
5
  import { MemPage } from "../mem-page.js";
6
- import { Engine } from "../engine.js";
6
+ import { Engine } from "../core.js";
7
7
  import { detectHere, ensureLivePage, ensureMem, resolveBaseUrl, runOneBlock, seedDefaultMem } from "../session/auto-explore-run.js";
8
8
  import { collectKnownInteractionSelectors, unmappedInteractionsPageScript } from "../analysis/coverage-gap.js";
9
9
  import { runStubPhase } from "../highlights.js";
10
- import { verboseLog } from "../verbose-log.js";
10
+ import { verboseLog } from "./verbose-log.js";
11
11
  import { findBlockPathDetailed } from "../analysis/graph.js";
12
12
  /**
13
13
  * Non-interactive explore session: same graph/library/mem/browser setup
@@ -54,7 +54,7 @@ export class AutoSession {
54
54
  this.headless = headless;
55
55
  }
56
56
  static async start(init) {
57
- const baseURL = init.baseURL ?? resolveBaseUrl(init.projectDir);
57
+ const baseURL = init.baseURL ?? (await resolveBaseUrl(init.projectDir));
58
58
  const skipNav = init.skipInitialNavigation === true;
59
59
  const startUrl = skipNav ? undefined : (init.startUrl ?? baseURL);
60
60
  const exploreOpts = {
@@ -22,7 +22,7 @@ export declare function isBlockLike(val: unknown): val is {
22
22
  act: unknown;
23
23
  };
24
24
  };
25
- /** Set by `defineNavBlock` (non-enumerable) - see src/engine.ts. */
25
+ /** Set by `defineNavBlock` (non-enumerable) - see src/core.ts. */
26
26
  export declare function isNavBlockMarked(val: Record<string, unknown>): boolean;
27
27
  export declare const NAV_METHOD_CALLS: readonly ["page.goto(", "page.reload(", "page.goBack(", "page.goForward("];
28
28
  /**
@@ -128,7 +128,7 @@ export function isBlockLike(val) {
128
128
  const instruction = obj.instruction;
129
129
  return instruction !== null && typeof instruction === "object" && typeof instruction?.act === "function";
130
130
  }
131
- /** Set by `defineNavBlock` (non-enumerable) - see src/engine.ts. */
131
+ /** Set by `defineNavBlock` (non-enumerable) - see src/core.ts. */
132
132
  export function isNavBlockMarked(val) {
133
133
  return val.__waygraphKind === "nav";
134
134
  }
@@ -1,3 +1,4 @@
1
+ import { resolveBaseUrl } from "../config.js";
1
2
  interface RunFlags {
2
3
  step?: boolean;
3
4
  autoplay?: boolean;
@@ -73,16 +74,18 @@ export declare function applyRunFlags(flags: RunFlags, opts?: {
73
74
  allowDemoUi?: boolean;
74
75
  }): void;
75
76
  /**
76
- * BASE_URL when neither --base-url nor WAYGRAPH_BASE_URL is set:
77
- * package.json `waygraph.baseUrl` (or `baseURL`), then playwright.config `baseURL`.
77
+ * BASE_URL when neither --base-url nor WAYGRAPH_BASE_URL is set - see `../config.js`'s own
78
+ * `resolveBaseUrl` for the full resolution order (env / `.env` / `waygraph.config.*` /
79
+ * package.json / playwright.config). Re-exported here so existing importers of this module
80
+ * don't need to change their import path.
78
81
  */
79
- export declare function resolveBaseUrl(projectDir: string): string | undefined;
82
+ export { resolveBaseUrl };
80
83
  /**
81
84
  * Friendly demo defaults: STEP on; headed only for live watch (no --video).
82
85
  * --video / --auto-play-video => headless unless --non-headless.
83
86
  * Call after applyRunFlags so explicit flags already won.
84
87
  */
85
- export declare function applyDemoDefaults(projectDir: string): void;
88
+ export declare function applyDemoDefaults(projectDir: string): Promise<void>;
86
89
  export declare function resolveProjectDir(flags: RunFlags, fallbackIndex?: number): string;
87
90
  export declare function resolveSpec(flags: RunFlags): string | undefined;
88
91
  /** `shop.flow.ts` / `src/flows/cart-bulk.flow.ts` / absolute path — not a Checkpoint or export id. */
@@ -92,4 +95,3 @@ export declare function looksLikeFlowFileRef(ref: string): boolean;
92
95
  * `src/flows/shop.flow.ts` → `shopFlow`; leaves `loginFlow then nav-cart` alone.
93
96
  */
94
97
  export declare function expandSpecFlowFiles(projectDir: string, spec: string): Promise<string>;
95
- export {};
package/dist/cli/flags.js CHANGED
@@ -1,7 +1,8 @@
1
1
  // Split out of the former 8,700-line cli.ts (see src/ARCHITECTURE.md). Behavior unchanged.
2
- import { basename, join, relative, resolve } from "node:path";
2
+ import { basename, relative, resolve } from "node:path";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { walkDir } from "./discover.js";
5
+ import { resolveBaseUrl } from "../config.js";
5
6
  function takeFlagValue(argv, i, a, flag) {
6
7
  if (a.startsWith(flag + "=")) {
7
8
  return { value: a.slice(flag.length + 1), nextI: i };
@@ -310,42 +311,18 @@ export function applyRunFlags(flags, opts) {
310
311
  }
311
312
  }
312
313
  /**
313
- * BASE_URL when neither --base-url nor WAYGRAPH_BASE_URL is set:
314
- * package.json `waygraph.baseUrl` (or `baseURL`), then playwright.config `baseURL`.
314
+ * BASE_URL when neither --base-url nor WAYGRAPH_BASE_URL is set - see `../config.js`'s own
315
+ * `resolveBaseUrl` for the full resolution order (env / `.env` / `waygraph.config.*` /
316
+ * package.json / playwright.config). Re-exported here so existing importers of this module
317
+ * don't need to change their import path.
315
318
  */
316
- export function resolveBaseUrl(projectDir) {
317
- const pkgPath = join(projectDir, "package.json");
318
- if (existsSync(pkgPath)) {
319
- try {
320
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
321
- const fromPkg = pkg.waygraph?.baseUrl ??
322
- pkg.waygraph?.baseURL ??
323
- pkg.config?.waygraph?.baseUrl ??
324
- pkg.config?.waygraph?.baseURL;
325
- if (typeof fromPkg === "string" && fromPkg.trim())
326
- return fromPkg.trim();
327
- }
328
- catch {
329
- // ignore malformed package.json - fall through to playwright
330
- }
331
- }
332
- for (const name of ["playwright.config.ts", "playwright.config.mts", "playwright.config.js", "playwright.config.mjs"]) {
333
- const p = join(projectDir, name);
334
- if (!existsSync(p))
335
- continue;
336
- const src = readFileSync(p, "utf-8");
337
- const m = src.match(/baseURL\s*:\s*["']([^"']+)["']/);
338
- if (m?.[1])
339
- return m[1];
340
- }
341
- return undefined;
342
- }
319
+ export { resolveBaseUrl };
343
320
  /**
344
321
  * Friendly demo defaults: STEP on; headed only for live watch (no --video).
345
322
  * --video / --auto-play-video => headless unless --non-headless.
346
323
  * Call after applyRunFlags so explicit flags already won.
347
324
  */
348
- export function applyDemoDefaults(projectDir) {
325
+ export async function applyDemoDefaults(projectDir) {
349
326
  if (process.env.WAYGRAPH_STEP === undefined)
350
327
  process.env.WAYGRAPH_STEP = "1";
351
328
  if (process.env.WAYGRAPH_STEP === "1" && process.env.WAYGRAPH_HEADED === undefined) {
@@ -363,7 +340,7 @@ export function applyDemoDefaults(projectDir) {
363
340
  }
364
341
  }
365
342
  if (!process.env.WAYGRAPH_BASE_URL) {
366
- const resolved = resolveBaseUrl(projectDir);
343
+ const resolved = await resolveBaseUrl(projectDir);
367
344
  if (resolved)
368
345
  process.env.WAYGRAPH_BASE_URL = resolved;
369
346
  }
@@ -41,7 +41,7 @@ mod.startRunner();
41
41
  export async function runChain(projectDir, spec) {
42
42
  const expanded = await expandSpecFlowFiles(projectDir, spec);
43
43
  if (process.env.WAYGRAPH_VIDEO && !process.env.WAYGRAPH_BASE_URL) {
44
- const resolved = resolveBaseUrl(projectDir);
44
+ const resolved = await resolveBaseUrl(projectDir);
45
45
  if (resolved)
46
46
  process.env.WAYGRAPH_BASE_URL = resolved;
47
47
  }
package/dist/cli.js CHANGED
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * "project" defaults to cwd. Flags beat WAYGRAPH_* env.
16
16
  */
17
- import { SKILL_FLAG_MAP, printSkillIndex, readSkillMarkdown } from "./agent-dive.js";
17
+ import { SKILL_FLAG_MAP, printSkillIndex, readSkillMarkdown } from "./commands/agent-dive-scaffold.js";
18
18
  import { usage } from "./cli/usage.js";
19
19
  import { listCase, navCase } from "./commands/list.js";
20
20
  import { checkCase, typecheckCase, validateCase } from "./commands/check.js";
@@ -6,8 +6,8 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, } from
6
6
  import { basename, dirname, join, resolve } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  function packageRoot() {
9
- // dist/agent-dive.js -> ..
10
- return resolve(dirname(fileURLToPath(import.meta.url)), "..");
9
+ // dist/commands/agent-dive-scaffold.js -> ../..
10
+ return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..");
11
11
  }
12
12
  function agentsTemplateDir() {
13
13
  return join(packageRoot(), "templates", "agents");
@@ -1,5 +1,5 @@
1
1
  // Split out of the former 8,700-line cli.ts (see src/ARCHITECTURE.md). Behavior unchanged.
2
- import { runAgentDive } from "../agent-dive.js";
2
+ import { runAgentDive } from "./agent-dive-scaffold.js";
3
3
  import { resolve } from "node:path";
4
4
  import { existsSync, statSync } from "node:fs";
5
5
  export async function agentDiveCase(args) {
@@ -67,7 +67,7 @@ export async function runChainAuto(projectDir, fromTag, toTag) {
67
67
  const spec = path.join(" then ");
68
68
  console.error(`waygraph chain auto: ${fromTag} -> ${toTag} via ${spec}`);
69
69
  if (!process.env.WAYGRAPH_BASE_URL) {
70
- const resolved = resolveBaseUrl(projectDir);
70
+ const resolved = await resolveBaseUrl(projectDir);
71
71
  if (resolved)
72
72
  process.env.WAYGRAPH_BASE_URL = resolved;
73
73
  }
@@ -24,7 +24,7 @@ export async function runCase(args) {
24
24
  process.exit(1);
25
25
  }
26
26
  if (!process.env.WAYGRAPH_BASE_URL) {
27
- const resolved = resolveBaseUrl(proj);
27
+ const resolved = await resolveBaseUrl(proj);
28
28
  if (resolved)
29
29
  process.env.WAYGRAPH_BASE_URL = resolved;
30
30
  }
@@ -60,13 +60,13 @@ export async function chainCase(args) {
60
60
  }
61
61
  const proj = resolve(flags.blocks ? (flags.positionals[0] ?? process.cwd()) : (flags.positionals[1] ?? process.cwd()));
62
62
  if (!process.env.WAYGRAPH_BASE_URL) {
63
- const resolved = resolveBaseUrl(proj);
63
+ const resolved = await resolveBaseUrl(proj);
64
64
  if (resolved)
65
65
  process.env.WAYGRAPH_BASE_URL = resolved;
66
66
  }
67
67
  // If caller asked for step overlay, behave like demo; else like run.
68
68
  if (flags.step === true || process.env.WAYGRAPH_STEP === "1") {
69
- applyDemoDefaults(proj);
69
+ await applyDemoDefaults(proj);
70
70
  }
71
71
  await runChain(proj, spec);
72
72
  return;
@@ -92,7 +92,7 @@ export async function demoCase(args) {
92
92
  if (flags.step === undefined && process.env.WAYGRAPH_STEP === undefined) {
93
93
  process.env.WAYGRAPH_STEP = "1";
94
94
  }
95
- applyDemoDefaults(proj);
95
+ await applyDemoDefaults(proj);
96
96
  console.error(`waygraph demo: STEP=${process.env.WAYGRAPH_STEP === "1" ? "on" : "off"}` +
97
97
  ` AUTO_NEXT=${process.env.WAYGRAPH_AUTOPLAY === "1" ? "on" : "off"}` +
98
98
  ` HEADED=${process.env.WAYGRAPH_HEADED === "0" ? "off" : "on"}` +
@@ -62,7 +62,7 @@ export async function sessionCase(args, command) {
62
62
  console.error(`waygraph browser: no such directory: ${proj}`);
63
63
  process.exit(1);
64
64
  }
65
- const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? resolveBaseUrl(proj);
65
+ const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? (await resolveBaseUrl(proj));
66
66
  try {
67
67
  const inject = flags.inject?.length ? resolveInjectRoots(flags.inject, proj) : undefined;
68
68
  const result = await browserStart({
@@ -148,7 +148,7 @@ export async function sessionCase(args, command) {
148
148
  const flags = parseRunFlags(flagArgs);
149
149
  applyRunFlags(flags);
150
150
  const proj = resolve(flags.positionals[0] ?? process.cwd());
151
- const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? resolveBaseUrl(proj);
151
+ const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? (await resolveBaseUrl(proj));
152
152
  try {
153
153
  const result = await pilotStart({
154
154
  projectDir: proj,
@@ -483,7 +483,7 @@ export async function sessionCase(args, command) {
483
483
  process.exit(1);
484
484
  }
485
485
  if (!process.env.WAYGRAPH_BASE_URL) {
486
- const resolved = resolveBaseUrl(proj);
486
+ const resolved = await resolveBaseUrl(proj);
487
487
  if (resolved)
488
488
  process.env.WAYGRAPH_BASE_URL = resolved;
489
489
  }
@@ -510,7 +510,7 @@ export async function sessionCase(args, command) {
510
510
  console.error("waygraph auto --detach requires --cli (headful has no session control)");
511
511
  process.exit(1);
512
512
  }
513
- const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? resolveBaseUrl(proj);
513
+ const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? (await resolveBaseUrl(proj));
514
514
  try {
515
515
  const meta = await spawnDetachedSession({
516
516
  projectDir: proj,
@@ -535,7 +535,7 @@ export async function sessionCase(args, command) {
535
535
  }
536
536
  if (flags.blocks && isFileSelectToken(flags.blocks)) {
537
537
  const blocksSelect = parseBlocksSelect(flags.blocks);
538
- const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? resolveBaseUrl(proj);
538
+ const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? (await resolveBaseUrl(proj));
539
539
  await runAutoExplore(proj, baseURL
540
540
  ? { cli: cliPicker, baseURL, blocksSelect }
541
541
  : { cli: cliPicker, blocksSelect });
@@ -565,7 +565,7 @@ export async function sessionCase(args, command) {
565
565
  }
566
566
  return;
567
567
  }
568
- const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? resolveBaseUrl(proj);
568
+ const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? (await resolveBaseUrl(proj));
569
569
  await runAutoExplore(proj, baseURL ? { cli: cliPicker, baseURL } : { cli: cliPicker });
570
570
  return;
571
571
  }
@@ -578,7 +578,7 @@ export async function autoServeCase(args) {
578
578
  console.error("waygraph __auto-serve: missing --session-id");
579
579
  process.exit(1);
580
580
  }
581
- const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? resolveBaseUrl(proj);
581
+ const baseURL = flags.baseUrl ?? process.env.WAYGRAPH_BASE_URL ?? (await resolveBaseUrl(proj));
582
582
  const inject = flags.inject?.length ? resolveInjectRoots(flags.inject, proj) : undefined;
583
583
  let headless;
584
584
  if (flags.headlessBrowser)
@@ -0,0 +1,34 @@
1
+ export interface WaygraphConfig {
2
+ /** Same value `resolveBaseUrl` would otherwise read from package.json's `waygraph.baseUrl`. */
3
+ baseUrl?: string;
4
+ }
5
+ /** Identity helper, purely for editor type-checking/autocomplete - same role `defineConfig` plays
6
+ * in a `playwright.config.ts` or `vite.config.ts`. `export default defineConfig({ ... })`. */
7
+ export declare function defineConfig(config: WaygraphConfig): WaygraphConfig;
8
+ /**
9
+ * Looks for the first `waygraph.config.*` in `projectDir` and imports it - `.ts` works
10
+ * unmodified because `bin/waygraph` already registers `tsx/esm` before `dist/cli.js` ever runs
11
+ * (the same mechanism that already lets a consumer's `.block.ts`/`.flow.ts` import directly), so
12
+ * no separate loader/transpile step is needed here. A broken config file throws loud, naming the
13
+ * file - silently swallowing it would make a missing `baseUrl` look like "nobody configured
14
+ * anything" instead of "your config file has a bug."
15
+ */
16
+ export declare function loadWaygraphConfig(projectDir: string): Promise<WaygraphConfig | undefined>;
17
+ /**
18
+ * Single source of truth for a project's base URL. Was three independently drifted copies
19
+ * (`src/cli/flags.ts`, `src/traverse/run.ts`, `src/session/auto-explore-run.ts`), each checking
20
+ * a slightly different subset of sources in a different order - real duplication, not just
21
+ * stylistic, since one copy skipped `config.waygraph.*` nesting and another checked
22
+ * `WAYGRAPH_BASE_URL` first instead of last. Checked in this order:
23
+ *
24
+ * 1. `WAYGRAPH_BASE_URL` - a real shell export, or one loaded from a `.env` file (see
25
+ * `loadEnvFiles`, called here so every caller gets native `.env` support for free, not just
26
+ * whichever command remembered to call it).
27
+ * 2. A `waygraph.config.*` file's `baseUrl`.
28
+ * 3. `package.json`'s `waygraph.baseUrl`/`baseURL` (`config.waygraph.*` also checked - a common
29
+ * nested-config convention some tooling uses).
30
+ * 4. `playwright.config.*`'s own `baseURL` (regex-read as text, never imported - importing a
31
+ * consumer's real playwright.config risks pulling in `@playwright/test`'s own global setup
32
+ * as a side effect, which resolving a URL string has no business doing).
33
+ */
34
+ export declare function resolveBaseUrl(projectDir: string): Promise<string | undefined>;
package/dist/config.js ADDED
@@ -0,0 +1,94 @@
1
+ // waygraph.config.* - new, additive, optional. package.json's own "waygraph" field (baseUrl)
2
+ // keeps working untouched; this is a second, richer place to put the same kind of project-level
3
+ // setting, for consumers who'd rather have a real typed file than a JSON field. Real ask: "I
4
+ // think its time to add waygraph config now."
5
+ import { existsSync, readFileSync } from "node:fs";
6
+ import { join } from "node:path";
7
+ import { pathToFileURL } from "node:url";
8
+ import { loadEnvFiles } from "./env-file.js";
9
+ /** Identity helper, purely for editor type-checking/autocomplete - same role `defineConfig` plays
10
+ * in a `playwright.config.ts` or `vite.config.ts`. `export default defineConfig({ ... })`. */
11
+ export function defineConfig(config) {
12
+ return config;
13
+ }
14
+ const CONFIG_FILENAMES = [
15
+ "waygraph.config.ts",
16
+ "waygraph.config.mts",
17
+ "waygraph.config.mjs",
18
+ "waygraph.config.js",
19
+ "waygraph.config.cjs",
20
+ ];
21
+ /**
22
+ * Looks for the first `waygraph.config.*` in `projectDir` and imports it - `.ts` works
23
+ * unmodified because `bin/waygraph` already registers `tsx/esm` before `dist/cli.js` ever runs
24
+ * (the same mechanism that already lets a consumer's `.block.ts`/`.flow.ts` import directly), so
25
+ * no separate loader/transpile step is needed here. A broken config file throws loud, naming the
26
+ * file - silently swallowing it would make a missing `baseUrl` look like "nobody configured
27
+ * anything" instead of "your config file has a bug."
28
+ */
29
+ export async function loadWaygraphConfig(projectDir) {
30
+ for (const name of CONFIG_FILENAMES) {
31
+ const p = join(projectDir, name);
32
+ if (!existsSync(p))
33
+ continue;
34
+ let mod;
35
+ try {
36
+ mod = (await import(pathToFileURL(p).href));
37
+ }
38
+ catch (err) {
39
+ throw new Error(`waygraph: failed to load ${name}: ${err instanceof Error ? err.message : String(err)}`);
40
+ }
41
+ return mod.default ?? mod;
42
+ }
43
+ return undefined;
44
+ }
45
+ /**
46
+ * Single source of truth for a project's base URL. Was three independently drifted copies
47
+ * (`src/cli/flags.ts`, `src/traverse/run.ts`, `src/session/auto-explore-run.ts`), each checking
48
+ * a slightly different subset of sources in a different order - real duplication, not just
49
+ * stylistic, since one copy skipped `config.waygraph.*` nesting and another checked
50
+ * `WAYGRAPH_BASE_URL` first instead of last. Checked in this order:
51
+ *
52
+ * 1. `WAYGRAPH_BASE_URL` - a real shell export, or one loaded from a `.env` file (see
53
+ * `loadEnvFiles`, called here so every caller gets native `.env` support for free, not just
54
+ * whichever command remembered to call it).
55
+ * 2. A `waygraph.config.*` file's `baseUrl`.
56
+ * 3. `package.json`'s `waygraph.baseUrl`/`baseURL` (`config.waygraph.*` also checked - a common
57
+ * nested-config convention some tooling uses).
58
+ * 4. `playwright.config.*`'s own `baseURL` (regex-read as text, never imported - importing a
59
+ * consumer's real playwright.config risks pulling in `@playwright/test`'s own global setup
60
+ * as a side effect, which resolving a URL string has no business doing).
61
+ */
62
+ export async function resolveBaseUrl(projectDir) {
63
+ loadEnvFiles(projectDir);
64
+ if (process.env.WAYGRAPH_BASE_URL)
65
+ return process.env.WAYGRAPH_BASE_URL;
66
+ const config = await loadWaygraphConfig(projectDir);
67
+ if (config?.baseUrl && config.baseUrl.trim())
68
+ return config.baseUrl.trim();
69
+ const pkgPath = join(projectDir, "package.json");
70
+ if (existsSync(pkgPath)) {
71
+ try {
72
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
73
+ const fromPkg = pkg.waygraph?.baseUrl ??
74
+ pkg.waygraph?.baseURL ??
75
+ pkg.config?.waygraph?.baseUrl ??
76
+ pkg.config?.waygraph?.baseURL;
77
+ if (typeof fromPkg === "string" && fromPkg.trim())
78
+ return fromPkg.trim();
79
+ }
80
+ catch {
81
+ // ignore malformed package.json - fall through to playwright.config
82
+ }
83
+ }
84
+ for (const name of ["playwright.config.ts", "playwright.config.mts", "playwright.config.js", "playwright.config.mjs"]) {
85
+ const p = join(projectDir, name);
86
+ if (!existsSync(p))
87
+ continue;
88
+ const src = readFileSync(p, "utf-8");
89
+ const m = src.match(/baseURL\s*:\s*["']([^"']+)["']/);
90
+ if (m?.[1])
91
+ return m[1];
92
+ }
93
+ return undefined;
94
+ }
@@ -1,15 +1,15 @@
1
- import { WaygraphError } from "../errors.js";
1
+ import { WaygraphError, MSG_FLOW_BLOCK_NOT_FOUND_BY_INDEX, MSG_FLOW_BLOCK_NOT_FOUND_BY_NAME, MSG_MODVERIFY_FUNCTION_FORM, MSG_MODVERIFY_NOT_FOUND_BY_INDEX, MSG_MODVERIFY_NOT_FOUND_BY_NAME, } from "../errors.js";
2
2
  export function findBlockIndex(middle, block) {
3
3
  if (typeof block === "number") {
4
4
  if (block < 0 || block >= middle.length) {
5
- throw new WaygraphError("WG_FLOW_BLOCK_NOT_FOUND", `Flow: no Block at index ${block} in this flow (has ${middle.length})`);
5
+ throw new WaygraphError("WG_FLOW_BLOCK_NOT_FOUND", MSG_FLOW_BLOCK_NOT_FOUND_BY_INDEX(block, middle.length));
6
6
  }
7
7
  return block;
8
8
  }
9
9
  const blockName = typeof block === "string" ? block : block.name;
10
10
  const index = middle.findIndex((b) => b.name === blockName);
11
11
  if (index === -1) {
12
- throw new WaygraphError("WG_FLOW_BLOCK_NOT_FOUND", `Flow: no Block named "${blockName}" in this flow (has: ${middle.map((b) => b.name).join(", ")})`);
12
+ throw new WaygraphError("WG_FLOW_BLOCK_NOT_FOUND", MSG_FLOW_BLOCK_NOT_FOUND_BY_NAME(blockName, middle.map((b) => b.name).join(", ")));
13
13
  }
14
14
  return index;
15
15
  }
@@ -229,15 +229,15 @@ export function withStubOnError(block, stub) {
229
229
  export function modVerify(block, nameOrIndex, newCheck) {
230
230
  const verify = block.instruction.verify;
231
231
  if (typeof verify === "function") {
232
- throw new WaygraphError("WG_MODVERIFY_FUNCTION_FORM", `modVerify: "${block.name}" has a function-form verify, which has no fixed list to address into - use withVerify to replace it wholesale instead`);
232
+ throw new WaygraphError("WG_MODVERIFY_FUNCTION_FORM", MSG_MODVERIFY_FUNCTION_FORM(block.name));
233
233
  }
234
234
  const traits = verify ?? [];
235
235
  const index = typeof nameOrIndex === "number" ? nameOrIndex : traits.findIndex((t) => t.name === nameOrIndex);
236
236
  const existing = traits[index];
237
237
  if (!existing) {
238
238
  throw new WaygraphError("WG_MODVERIFY_NOT_FOUND", typeof nameOrIndex === "number"
239
- ? `modVerify: "${block.name}" has no verify trait at index ${nameOrIndex} (has ${traits.length})`
240
- : `modVerify: "${block.name}" has no verify trait named "${nameOrIndex}" (has: ${traits.map((t) => t.name).join(", ") || "none"})`);
239
+ ? MSG_MODVERIFY_NOT_FOUND_BY_INDEX(block.name, nameOrIndex, traits.length)
240
+ : MSG_MODVERIFY_NOT_FOUND_BY_NAME(block.name, nameOrIndex, traits.map((t) => t.name).join(", ")));
241
241
  }
242
242
  const replacement = typeof newCheck === "function"
243
243
  ? { name: typeof nameOrIndex === "string" ? nameOrIndex : existing.name, check: newCheck }
@@ -0,0 +1,54 @@
1
+ import type { Checkpoint, DefinedBlock } from "../../types.js";
2
+ import type { Trait } from "../../trait.js";
3
+ import { MemPage } from "../../mem-page.js";
4
+ import type { MemKey } from "../../mem-page.js";
5
+ import type { APIRequestContext, APIResponse } from "@playwright/test";
6
+ /** What `resolve`/`verify` see: the response's status and parsed body, nothing Playwright-specific. */
7
+ export interface ApiCallResult {
8
+ status: number;
9
+ ok: boolean;
10
+ /** `response.json()` if the body parses as JSON, else the raw text (or `undefined` if neither). */
11
+ body: unknown;
12
+ }
13
+ export interface ApiBlockOptions<In extends Checkpoint<string>, Out extends Checkpoint<string>> {
14
+ name: string;
15
+ description?: string;
16
+ /**
17
+ * Make the request - `request` is Playwright's own `page.request` (same cookies/origin as the
18
+ * browser context, so an authenticated UI session carries over to the API call for free).
19
+ * @example call: ({ request }) => request.get("/api/orders/1")
20
+ */
21
+ call: (ctx: {
22
+ request: APIRequestContext;
23
+ mem: MemPage;
24
+ }) => Promise<APIResponse>;
25
+ /**
26
+ * HTTP method shown in the network-tab overlay (GET/POST/PATCH/...) - `APIResponse` (unlike a
27
+ * page's own `Response`) carries no back-reference to the request that produced it, so this
28
+ * can't be read back automatically; defaults to "GET" if omitted. Purely cosmetic - never
29
+ * affects the actual request `call` makes.
30
+ * @example method: "POST"
31
+ */
32
+ method?: string;
33
+ /** Pure, like every other Block's resolve - classifies the response into a Checkpoint tag. */
34
+ resolve: (result: ApiCallResult) => Out;
35
+ verify?: Trait[] | ((out: Out) => Trait[]);
36
+ requires?: readonly MemKey<any>[];
37
+ stubBefore?: import("../../highlights.js").HighlightStubPhaseOrFn<Out>;
38
+ stubAfter?: import("../../highlights.js").HighlightStubPhaseOrFn<Out>;
39
+ stubOnError?: import("../../highlights.js").HighlightStubPhaseOrFn<Out>;
40
+ }
41
+ /**
42
+ * A Block whose `act()` is a real HTTP request, not a page interaction - lets one Flow narrate a
43
+ * UI step (`.gotoPage()`) and a backend check (`.method(checkOrderCreated)`) as the same state
44
+ * machine, checked by the same Trait/verify system. Runs through `page.request`, so it shares the
45
+ * browser context's cookies/origin - no separate auth dance for an already-logged-in session.
46
+ * @example
47
+ * const CheckOrderCreated = defineApiBlock<LoggedIn, OrderConfirmed | OrderFailed>({
48
+ * name: "check-order-created",
49
+ * call: ({ request }) => request.get("/api/orders/latest"),
50
+ * resolve: (r) => (r.ok ? checkpoint("OrderConfirmed") : checkpoint("OrderFailed")),
51
+ * verify: [Trait.disabled],
52
+ * });
53
+ */
54
+ export declare function defineApiBlock<In extends Checkpoint<string>, Out extends Checkpoint<string>>(options: ApiBlockOptions<In, Out>): DefinedBlock<In, Out>;
@@ -0,0 +1,75 @@
1
+ import { defineBlock } from "../block.js";
2
+ import { key } from "../../mem-page.js";
3
+ // Internal scratch key threading act()'s result to observe()/resolve() - Instruction has no other
4
+ // channel for this (resolve is pure, given only what observe returns). Identity-keyed, so this can
5
+ // never collide with a real author's own MemKey even if names happened to match; safe to share one
6
+ // instance across every ApiBlock since runGraph runs act->observe->resolve fully serially per Block.
7
+ const API_RESULT_SCRATCH = key("__wgApiBlockResult");
8
+ /**
9
+ * A Block whose `act()` is a real HTTP request, not a page interaction - lets one Flow narrate a
10
+ * UI step (`.gotoPage()`) and a backend check (`.method(checkOrderCreated)`) as the same state
11
+ * machine, checked by the same Trait/verify system. Runs through `page.request`, so it shares the
12
+ * browser context's cookies/origin - no separate auth dance for an already-logged-in session.
13
+ * @example
14
+ * const CheckOrderCreated = defineApiBlock<LoggedIn, OrderConfirmed | OrderFailed>({
15
+ * name: "check-order-created",
16
+ * call: ({ request }) => request.get("/api/orders/latest"),
17
+ * resolve: (r) => (r.ok ? checkpoint("OrderConfirmed") : checkpoint("OrderFailed")),
18
+ * verify: [Trait.disabled],
19
+ * });
20
+ */
21
+ export function defineApiBlock(options) {
22
+ const built = defineBlock({
23
+ name: options.name,
24
+ ...(options.description ? { description: options.description } : {}),
25
+ ...(options.requires ? { requires: options.requires } : {}),
26
+ instruction: {
27
+ async act(page, _input, mem) {
28
+ const startedAt = Date.now();
29
+ const response = await options.call({ request: page.request, mem });
30
+ const ms = Date.now() - startedAt;
31
+ let body;
32
+ try {
33
+ body = await response.json();
34
+ }
35
+ catch {
36
+ body = await response.text().catch(() => undefined);
37
+ }
38
+ mem.set(API_RESULT_SCRATCH, { status: response.status(), ok: response.ok(), body });
39
+ // Best-effort, demo-only visibility - an API step has no DOM change and no ring of its own,
40
+ // so without this it's a silent title flash. No-ops outside a demo/pilot/auto run (see
41
+ // addNetworkEntry's own guard) and never fails the Block if painting the panel throws.
42
+ // Same network-tab panel real page traffic feeds too (network-capture.js) - this is the
43
+ // page.request side of it (a separate APIRequestContext, never seen by page.on('request')).
44
+ try {
45
+ // recordNetworkEntry, not a bare addNetworkEntry evaluate - it also persists this entry
46
+ // to page.__wgNetworkHistory (Node-side, survives navigation), so it isn't lost the
47
+ // moment a later step in the same Flow navigates and wipes the panel's DOM.
48
+ const { recordNetworkEntry } = await import("../../runner/network-capture.js");
49
+ await recordNetworkEntry(page, {
50
+ method: options.method || "GET",
51
+ url: response.url(),
52
+ status: response.status(),
53
+ ok: response.ok(),
54
+ ms,
55
+ resHeaders: response.headers(),
56
+ resBody: typeof body === "string" ? body : body !== undefined ? JSON.stringify(body) : undefined,
57
+ });
58
+ }
59
+ catch {
60
+ /* overlay not installed / page already closed - not this Block's job to report that */
61
+ }
62
+ },
63
+ async observe(_page, mem) {
64
+ return mem.get(API_RESULT_SCRATCH);
65
+ },
66
+ resolve: (observed) => options.resolve(observed),
67
+ ...(options.verify !== undefined ? { verify: options.verify } : {}),
68
+ ...(options.stubBefore !== undefined ? { stubBefore: options.stubBefore } : {}),
69
+ ...(options.stubAfter !== undefined ? { stubAfter: options.stubAfter } : {}),
70
+ ...(options.stubOnError !== undefined ? { stubOnError: options.stubOnError } : {}),
71
+ },
72
+ });
73
+ Object.defineProperty(built, "__waygraphKind", { value: "api", enumerable: false, configurable: false });
74
+ return built;
75
+ }
@@ -1,7 +1,7 @@
1
1
  import type { Block, Checkpoint, DefinedBlock } from "../../types.js";
2
2
  import type { MemKey } from "../../mem-page.js";
3
3
  import type { Trait } from "../../trait.js";
4
- import { defineBlock } from "../core.js";
4
+ import { defineBlock } from "../block.js";
5
5
  /**
6
6
  * TypeScript salt over {@link defineBlock}: same runtime Block, but the type
7
7
  * forces `requires` + `instanceOptions` so `waygraph auto` can list one menu
@@ -1,4 +1,4 @@
1
- import { defineBlock } from "../core.js";
1
+ import { defineBlock } from "../block.js";
2
2
  /**
3
3
  * {@link defineBlock} constrained for effect-style instance menus: `requires` +
4
4
  * `instanceOptions` are mandatory. Prefer this when the Block adds / removes /
@@ -1,6 +1,6 @@
1
1
  import type { Checkpoint, DefinedBlock } from "../../types.js";
2
2
  import type { Trait } from "../../trait.js";
3
- import { defineBlock } from "../core.js";
3
+ import { defineBlock } from "../block.js";
4
4
  import type { MemKey } from "../../mem-page.js";
5
5
  /**
6
6
  * TypeScript salt over {@link defineBlock} for one-shot non-nav app steps