effect-browser 0.3.0-beta.24 → 0.3.0-beta.25

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 (345) hide show
  1. package/README.md +333 -157
  2. package/dist/Action.d.mts +1 -1
  3. package/dist/Action.mjs +61 -9
  4. package/dist/Action.mjs.map +1 -1
  5. package/dist/Browser.d.mts +2 -2
  6. package/dist/Browser.mjs +2 -2
  7. package/dist/BrowserError.d.mts +2 -2
  8. package/dist/BrowserError.mjs +194 -41
  9. package/dist/BrowserError.mjs.map +1 -1
  10. package/dist/BrowserEvent.d.mts +1 -1
  11. package/dist/BrowserEvent.mjs +166 -35
  12. package/dist/BrowserEvent.mjs.map +1 -1
  13. package/dist/Cdp.d.mts +15 -0
  14. package/dist/Cdp.mjs +22 -0
  15. package/dist/Cdp.mjs.map +1 -0
  16. package/dist/Change.d.mts +2 -2
  17. package/dist/Change.mjs +33 -6
  18. package/dist/Change.mjs.map +1 -1
  19. package/dist/Frame.d.mts +2 -2
  20. package/dist/Frame.mjs +132 -14
  21. package/dist/Frame.mjs.map +1 -1
  22. package/dist/{Style.d.mts → InputStyle.d.mts} +93 -25
  23. package/dist/{Style.mjs → InputStyle.mjs} +1 -1
  24. package/dist/Layout.d.mts +2 -2
  25. package/dist/Layout.mjs +58 -16
  26. package/dist/Layout.mjs.map +1 -1
  27. package/dist/Overlay.d.mts +2 -2
  28. package/dist/Overlay.mjs +33 -5
  29. package/dist/Overlay.mjs.map +1 -1
  30. package/dist/Page.d.mts +2 -2
  31. package/dist/Page.mjs +2 -2
  32. package/dist/PageTime.d.mts +2 -2
  33. package/dist/PageTime.mjs +13 -3
  34. package/dist/PageTime.mjs.map +1 -1
  35. package/dist/Pose.d.mts +2 -2
  36. package/dist/Pose.mjs +30 -9
  37. package/dist/Pose.mjs.map +1 -1
  38. package/dist/Site.d.mts +288 -18
  39. package/dist/Site.mjs +11 -3
  40. package/dist/Site.mjs.map +1 -1
  41. package/dist/Snapshot.d.mts +2 -2
  42. package/dist/Snapshot.mjs +87 -6
  43. package/dist/Snapshot.mjs.map +1 -1
  44. package/dist/Text.d.mts +2 -0
  45. package/dist/Text.mjs +45 -0
  46. package/dist/Text.mjs.map +1 -0
  47. package/dist/Window.d.mts +2 -2
  48. package/dist/Window.mjs +31 -6
  49. package/dist/Window.mjs.map +1 -1
  50. package/dist/ai/BrowserTools.d.mts +4987 -0
  51. package/dist/ai/BrowserTools.mjs +3 -0
  52. package/dist/ai/PageControl.d.mts +286 -0
  53. package/dist/ai/PageControl.mjs +426 -0
  54. package/dist/ai/PageControl.mjs.map +1 -0
  55. package/dist/ai/PromptCache.d.mts +16 -0
  56. package/dist/ai/PromptCache.mjs +72 -0
  57. package/dist/ai/PromptCache.mjs.map +1 -0
  58. package/dist/ai/Tabs.d.mts +2 -0
  59. package/dist/ai/Tabs.mjs +72 -0
  60. package/dist/ai/Tabs.mjs.map +1 -0
  61. package/dist/ai/ToolError.d.mts +34 -0
  62. package/dist/ai/ToolError.mjs +2 -0
  63. package/dist/ai/index.d.mts +6 -0
  64. package/dist/ai/index.mjs +6 -0
  65. package/dist/index.d.mts +7 -18
  66. package/dist/index.mjs +6 -9
  67. package/dist/{Action-24sLOubi.d.mts → internal/Action-CkanNTUw.d.mts} +64 -4
  68. package/dist/{Browser-DGR6ZEYo.d.mts → internal/Browser-DD9Vm1c-.d.mts} +75 -11
  69. package/dist/{Browser-CAQFhTkM.mjs → internal/Browser-vzD7i2oj.mjs} +174 -237
  70. package/dist/internal/Browser-vzD7i2oj.mjs.map +1 -0
  71. package/dist/{BrowserError-BlcmLVzn.d.mts → internal/BrowserError-CsuRYcDX.d.mts} +187 -28
  72. package/dist/{BrowserEvent-C2p-NwuU.d.mts → internal/BrowserEvent-tGPYYf6R.d.mts} +168 -13
  73. package/dist/internal/BrowserTools-Yi3lOX4h.mjs +497 -0
  74. package/dist/internal/BrowserTools-Yi3lOX4h.mjs.map +1 -0
  75. package/dist/{Style-T3ezDYLI.mjs → internal/InputStyle-CPzxoN4g.mjs} +75 -20
  76. package/dist/internal/InputStyle-CPzxoN4g.mjs.map +1 -0
  77. package/dist/{moment/Moment.mjs → internal/Moment-CstaX1mR.mjs} +49 -16
  78. package/dist/internal/Moment-CstaX1mR.mjs.map +1 -0
  79. package/dist/{moment/Moment.d.mts → internal/Moment-DOcldBdf.d.mts} +53 -20
  80. package/dist/internal/Page-BfGxn7oN.d.mts +1553 -0
  81. package/dist/{Page-BaAOshxo.mjs → internal/Page-DqF-tuTx.mjs} +62 -74
  82. package/dist/internal/Page-DqF-tuTx.mjs.map +1 -0
  83. package/dist/internal/Release-CFONkPDP.d.mts +39 -0
  84. package/dist/internal/Stage-D5ymSXDT.mjs +298 -0
  85. package/dist/internal/Stage-D5ymSXDT.mjs.map +1 -0
  86. package/dist/internal/Stillness-DCPeAN1a.mjs +1124 -0
  87. package/dist/internal/Stillness-DCPeAN1a.mjs.map +1 -0
  88. package/dist/internal/Supervisor-BcY_QNIY.d.mts +108 -0
  89. package/dist/internal/Supervisor-BcglY23c.mjs +531 -0
  90. package/dist/internal/Supervisor-BcglY23c.mjs.map +1 -0
  91. package/dist/internal/Tabs-dXMscIUQ.d.mts +52 -0
  92. package/dist/internal/TestPage-CYiYbh63.d.mts +159 -0
  93. package/dist/internal/ToolError-DArsRS2m.mjs +117 -0
  94. package/dist/internal/ToolError-DArsRS2m.mjs.map +1 -0
  95. package/dist/{plan/index.d.mts → internal/Walk-BNXcfZ2z.d.mts} +59 -35
  96. package/dist/{plan/index.mjs → internal/Walk-C5ky7uSf.mjs} +83 -51
  97. package/dist/internal/Walk-C5ky7uSf.mjs.map +1 -0
  98. package/dist/{ActionPort.mjs → internal/action-port-B5EkeGOR.mjs} +6 -12
  99. package/dist/internal/action-port-B5EkeGOR.mjs.map +1 -0
  100. package/dist/internal/cdp/workerd.d.mts +13 -0
  101. package/dist/internal/cdp/workerd.mjs +19 -0
  102. package/dist/internal/cdp/workerd.mjs.map +1 -0
  103. package/dist/{Clock.mjs → internal/clock-BKSAEf00.mjs} +13 -13
  104. package/dist/internal/clock-BKSAEf00.mjs.map +1 -0
  105. package/dist/{connection-Db-YtlbE.d.mts → internal/connection-BaB0vp1o.d.mts} +6 -6
  106. package/dist/{connection-C_jWYIwe.mjs → internal/connection-C2X4GmXM.mjs} +19 -15
  107. package/dist/internal/connection-C2X4GmXM.mjs.map +1 -0
  108. package/dist/internal/events-DzCrww-y.mjs +72 -0
  109. package/dist/internal/events-DzCrww-y.mjs.map +1 -0
  110. package/dist/internal/fold.inpage-uhrT-dOB.mjs +49 -0
  111. package/dist/internal/fold.inpage-uhrT-dOB.mjs.map +1 -0
  112. package/dist/internal/functions-jBOs6GKv.mjs +27 -0
  113. package/dist/internal/functions-jBOs6GKv.mjs.map +1 -0
  114. package/dist/{Geometry-DJx9qrYy.d.mts → internal/geometry-Dhj_ztJs.d.mts} +3 -3
  115. package/dist/{Geometry.mjs → internal/geometry-Lxyflb9J.mjs} +3 -12
  116. package/dist/internal/geometry-Lxyflb9J.mjs.map +1 -0
  117. package/dist/{Matching.mjs → internal/matching-Cs-UeOY0.mjs} +3 -3
  118. package/dist/internal/matching-Cs-UeOY0.mjs.map +1 -0
  119. package/dist/internal/page-DFQb-YOK.mjs +436 -0
  120. package/dist/internal/page-DFQb-YOK.mjs.map +1 -0
  121. package/dist/{pose.inpage-CLq7Mfdr.mjs → internal/pose.inpage-CBFeWcVa.mjs} +2 -48
  122. package/dist/internal/pose.inpage-CBFeWcVa.mjs.map +1 -0
  123. package/dist/{Url.mjs → internal/url-DB0pQYk6.mjs} +3 -12
  124. package/dist/internal/url-DB0pQYk6.mjs.map +1 -0
  125. package/dist/policy/Policy.d.mts +60 -6
  126. package/dist/policy/Policy.mjs +52 -9
  127. package/dist/policy/Policy.mjs.map +1 -1
  128. package/dist/policy/index.d.mts +2 -0
  129. package/dist/policy/index.mjs +2 -0
  130. package/dist/{film → presentation}/Film.d.mts +83 -16
  131. package/dist/{film → presentation}/Film.mjs +82 -30
  132. package/dist/presentation/Film.mjs.map +1 -0
  133. package/dist/presentation/Motion.d.mts +5 -1
  134. package/dist/presentation/Motion.mjs +16 -2
  135. package/dist/presentation/Motion.mjs.map +1 -1
  136. package/dist/presentation/Presentation.d.mts +42 -7
  137. package/dist/presentation/Presentation.mjs +26 -9
  138. package/dist/presentation/Presentation.mjs.map +1 -1
  139. package/dist/presentation/Stage.d.mts +40 -6
  140. package/dist/presentation/Stage.mjs +1 -262
  141. package/dist/presentation/index.d.mts +5 -0
  142. package/dist/presentation/index.mjs +5 -0
  143. package/dist/supervisor/Release.d.mts +2 -0
  144. package/dist/supervisor/Release.mjs +40 -0
  145. package/dist/supervisor/Release.mjs.map +1 -0
  146. package/dist/supervisor/Supervisor.d.mts +2 -104
  147. package/dist/supervisor/Supervisor.mjs +2 -515
  148. package/dist/supervisor/index.d.mts +3 -0
  149. package/dist/supervisor/index.mjs +3 -0
  150. package/dist/testing/HttpCassette.d.mts +98 -0
  151. package/dist/testing/HttpCassette.mjs +146 -0
  152. package/dist/testing/HttpCassette.mjs.map +1 -0
  153. package/dist/testing/Story.d.mts +31 -0
  154. package/dist/testing/Story.mjs +76 -0
  155. package/dist/testing/Story.mjs.map +1 -0
  156. package/dist/testing/TestBrowser.d.mts +191 -0
  157. package/dist/testing/TestBrowser.mjs +105 -0
  158. package/dist/testing/TestBrowser.mjs.map +1 -0
  159. package/dist/testing/TestModel.d.mts +133 -0
  160. package/dist/testing/TestModel.mjs +209 -0
  161. package/dist/testing/TestModel.mjs.map +1 -0
  162. package/dist/testing/TestPage.d.mts +2 -0
  163. package/dist/testing/TestPage.mjs +47 -0
  164. package/dist/testing/TestPage.mjs.map +1 -0
  165. package/dist/testing/index.d.mts +6 -311
  166. package/dist/testing/index.mjs +6 -521
  167. package/dist/timeline/Moment.d.mts +3 -0
  168. package/dist/timeline/Moment.mjs +3 -0
  169. package/dist/timeline/Stillness.d.mts +34 -0
  170. package/dist/timeline/Stillness.mjs +2 -0
  171. package/dist/timeline/index.d.mts +3 -0
  172. package/dist/timeline/index.mjs +3 -0
  173. package/dist/walk/Walk.d.mts +2 -0
  174. package/dist/walk/Walk.mjs +2 -0
  175. package/dist/walk/index.d.mts +2 -0
  176. package/dist/walk/index.mjs +2 -0
  177. package/package.json +54 -163
  178. package/src/Action.ts +73 -8
  179. package/src/Browser.ts +75 -9
  180. package/src/BrowserError.ts +258 -63
  181. package/src/BrowserEvent.ts +252 -55
  182. package/src/Cdp.ts +42 -0
  183. package/src/Change.ts +68 -3
  184. package/src/Frame.ts +247 -14
  185. package/src/{Style.ts → InputStyle.ts} +98 -22
  186. package/src/Layout.ts +95 -24
  187. package/src/Overlay.ts +42 -3
  188. package/src/Page.ts +144 -320
  189. package/src/PageTime.ts +29 -4
  190. package/src/Pose.ts +38 -7
  191. package/src/Site.ts +15 -3
  192. package/src/Snapshot.ts +179 -3
  193. package/src/Text.ts +60 -0
  194. package/src/Window.ts +53 -3
  195. package/src/ai/BrowserTools.ts +778 -0
  196. package/src/ai/PageControl.ts +702 -0
  197. package/src/ai/PromptCache.ts +87 -0
  198. package/src/ai/Tabs.ts +84 -0
  199. package/src/ai/ToolError.ts +50 -0
  200. package/src/ai/index.ts +36 -0
  201. package/src/ai/internal/crops.ts +38 -0
  202. package/src/ai/internal/points.ts +57 -0
  203. package/src/ai/internal/receipts.ts +107 -0
  204. package/src/index.ts +83 -6
  205. package/src/{ActionPort.ts → internal/action-port.ts} +3 -3
  206. package/src/{providers → internal/cdp}/connection.ts +19 -12
  207. package/src/internal/cdp/workerd.ts +36 -0
  208. package/src/{Clock.ts → internal/clock.ts} +20 -0
  209. package/src/internal/input/actions.ts +1 -1
  210. package/src/internal/input/dispatch.ts +2 -2
  211. package/src/internal/input/guard.inpage.ts +1 -1
  212. package/src/internal/input/guard.ts +1 -1
  213. package/src/internal/input/perform.ts +5 -5
  214. package/src/internal/input/pointer.ts +2 -2
  215. package/src/internal/input/targets.inpage.ts +3 -3
  216. package/src/{Matching.ts → internal/matching.ts} +6 -6
  217. package/src/internal/page/bridge.ts +2 -2
  218. package/src/internal/page/clock.inpage.ts +1 -1
  219. package/src/internal/page/compose.inpage.ts +2 -2
  220. package/src/internal/page/context.ts +2 -2
  221. package/src/internal/page/functions.ts +84 -0
  222. package/src/internal/page/navigation.ts +1 -1
  223. package/src/internal/page/openings.ts +2 -2
  224. package/src/internal/page/page.ts +33 -35
  225. package/src/internal/page/port.ts +14 -8
  226. package/src/internal/page/replies.ts +1 -1
  227. package/src/internal/page/requests.ts +1 -1
  228. package/src/internal/page/scripts.ts +1 -1
  229. package/src/internal/page/time.ts +1 -1
  230. package/src/internal/pictures/capture.ts +1 -4
  231. package/src/internal/pictures/dimensions.ts +1 -1
  232. package/src/internal/pictures/frame.ts +1 -1
  233. package/src/internal/pictures/pictures.ts +53 -61
  234. package/src/internal/reading/context.inpage.ts +2 -2
  235. package/src/internal/reading/expect.inpage.ts +1 -1
  236. package/src/internal/reading/layout.inpage.ts +3 -3
  237. package/src/internal/reading/layout.ts +5 -5
  238. package/src/internal/reading/outline.inpage.ts +3 -3
  239. package/src/internal/reading/reading.ts +11 -19
  240. package/src/internal/reading/ready.inpage.ts +2 -2
  241. package/src/internal/reading/ready.ts +3 -2
  242. package/src/internal/reading/subjects.inpage.ts +3 -3
  243. package/src/internal/reading/text.inpage.ts +2 -2
  244. package/src/internal/reading/walk.inpage.ts +1 -1
  245. package/src/internal/timeline/changes.inpage.ts +2 -2
  246. package/src/internal/timeline/changes.ts +3 -4
  247. package/src/internal/timeline/sight.inpage.ts +2 -2
  248. package/src/internal/timeline/window.ts +3 -4
  249. package/src/policy/Policy.ts +70 -16
  250. package/src/policy/index.ts +12 -0
  251. package/src/{film → presentation}/Film.ts +104 -37
  252. package/src/presentation/Motion.ts +45 -3
  253. package/src/presentation/Presentation.ts +47 -14
  254. package/src/presentation/Stage.ts +73 -35
  255. package/src/presentation/index.ts +30 -0
  256. package/src/presentation/{feed.ts → internal/feed.ts} +1 -1
  257. package/src/supervisor/Release.ts +45 -0
  258. package/src/supervisor/Supervisor.ts +80 -5
  259. package/src/supervisor/index.ts +18 -0
  260. package/src/supervisor/{contract.ts → internal/contract.ts} +14 -10
  261. package/src/supervisor/{lifecycle.ts → internal/lifecycle.ts} +7 -7
  262. package/src/supervisor/{runtime.ts → internal/runtime.ts} +7 -7
  263. package/src/testing/HttpCassette.ts +260 -0
  264. package/src/testing/Story.ts +103 -0
  265. package/src/testing/TestBrowser.ts +14 -4
  266. package/src/testing/TestModel.ts +297 -0
  267. package/src/testing/TestPage.ts +92 -4
  268. package/src/testing/index.ts +35 -1
  269. package/src/testing/{evidence.ts → internal/evidence.ts} +19 -11
  270. package/src/testing/{model.ts → internal/model.ts} +14 -8
  271. package/src/testing/{page.ts → internal/page.ts} +55 -56
  272. package/src/{moment → timeline}/Moment.ts +79 -29
  273. package/src/{stillness → timeline}/Stillness.ts +61 -43
  274. package/src/timeline/index.ts +18 -0
  275. package/src/{stillness/Pixels.ts → timeline/internal/pixels.ts} +2 -2
  276. package/src/{moment → timeline/internal}/words.ts +2 -2
  277. package/src/walk/Walk.ts +165 -0
  278. package/src/walk/index.ts +12 -0
  279. package/src/{plan → walk/internal}/choose.ts +23 -14
  280. package/src/{plan → walk/internal}/data.ts +37 -14
  281. package/src/{plan → walk/internal}/execute.ts +79 -36
  282. package/src/{plan → walk/internal}/record.ts +6 -6
  283. package/src/{plan → walk/internal}/targets.ts +35 -25
  284. package/dist/ActionPort.d.mts +0 -15
  285. package/dist/ActionPort.mjs.map +0 -1
  286. package/dist/Browser-CAQFhTkM.mjs.map +0 -1
  287. package/dist/Change-CxT1mp2e.d.mts +0 -80
  288. package/dist/Clock-Du5nP-nK.d.mts +0 -57
  289. package/dist/Clock.d.mts +0 -2
  290. package/dist/Clock.mjs.map +0 -1
  291. package/dist/Frame-UEH2hO5T.d.mts +0 -124
  292. package/dist/Geometry.d.mts +0 -2
  293. package/dist/Geometry.mjs.map +0 -1
  294. package/dist/Matching-MtcWZ_hA.d.mts +0 -266
  295. package/dist/Matching.d.mts +0 -2
  296. package/dist/Matching.mjs.map +0 -1
  297. package/dist/Overlay-CoGw5tL_.d.mts +0 -27
  298. package/dist/Page-BaAOshxo.mjs.map +0 -1
  299. package/dist/Page-CLzh5E9w.d.mts +0 -718
  300. package/dist/PageTime-68UPUZpZ.d.mts +0 -29
  301. package/dist/Pose-2qqGzPvb.d.mts +0 -32
  302. package/dist/Released-tURbFmal.d.mts +0 -15
  303. package/dist/Snapshot-CtBVOtuu.d.mts +0 -73
  304. package/dist/Stillness-BwP0RdI4.mjs +0 -157
  305. package/dist/Stillness-BwP0RdI4.mjs.map +0 -1
  306. package/dist/Style-T3ezDYLI.mjs.map +0 -1
  307. package/dist/Url-B7P-TWwL.d.mts +0 -26
  308. package/dist/Url.d.mts +0 -2
  309. package/dist/Url.mjs.map +0 -1
  310. package/dist/Window-BDa8MtNP.d.mts +0 -34
  311. package/dist/connection-C_jWYIwe.mjs.map +0 -1
  312. package/dist/film/Film.mjs.map +0 -1
  313. package/dist/moment/Moment.mjs.map +0 -1
  314. package/dist/plan/index.mjs.map +0 -1
  315. package/dist/pose.inpage-CLq7Mfdr.mjs.map +0 -1
  316. package/dist/presentation/Stage.mjs.map +0 -1
  317. package/dist/presentation/feed.d.mts +0 -20
  318. package/dist/presentation/feed.mjs +0 -18
  319. package/dist/presentation/feed.mjs.map +0 -1
  320. package/dist/providers/Cdp.d.mts +0 -9
  321. package/dist/providers/Cdp.mjs +0 -15
  322. package/dist/providers/Cdp.mjs.map +0 -1
  323. package/dist/providers/Chromium.d.mts +0 -32
  324. package/dist/providers/Chromium.mjs +0 -55
  325. package/dist/providers/Chromium.mjs.map +0 -1
  326. package/dist/providers/Released.d.mts +0 -2
  327. package/dist/providers/Released.mjs +0 -12
  328. package/dist/providers/Released.mjs.map +0 -1
  329. package/dist/stillness/Stillness.d.mts +0 -12
  330. package/dist/stillness/Stillness.mjs +0 -2
  331. package/dist/supervisor/Supervisor.mjs.map +0 -1
  332. package/dist/testing/index.mjs.map +0 -1
  333. package/dist/workerd/Cdp.d.mts +0 -8
  334. package/dist/workerd/Cdp.mjs +0 -13
  335. package/dist/workerd/Cdp.mjs.map +0 -1
  336. package/src/plan/index.ts +0 -36
  337. package/src/providers/Cdp.ts +0 -16
  338. package/src/providers/Chromium.ts +0 -99
  339. package/src/providers/Released.ts +0 -13
  340. package/src/workerd/Cdp.ts +0 -11
  341. /package/dist/{fold.inpage-CyVZQHZL.d.mts → internal/fold.inpage-CyVZQHZL.d.mts} +0 -0
  342. /package/dist/{rolldown-runtime-D7D4PA-g.mjs → internal/rolldown-runtime-D7D4PA-g.mjs} +0 -0
  343. /package/src/{Geometry.ts → internal/geometry.ts} +0 -0
  344. /package/src/{Url.ts → internal/url.ts} +0 -0
  345. /package/src/{stillness → timeline/internal}/utilsBundle.d.ts +0 -0
@@ -1,36 +1,36 @@
1
- import { t as BrowserError } from "../BrowserError-BlcmLVzn.mjs";
2
- import { i as BrowserEvent, x as Subject } from "../BrowserEvent-C2p-NwuU.mjs";
3
- import { _ as ReadyOptions, c as Found, f as Page } from "../Page-CLzh5E9w.mjs";
1
+ import { t as BrowserError } from "./BrowserError-CsuRYcDX.mjs";
2
+ import { i as BrowserEvent, x as Subject } from "./BrowserEvent-tGPYYf6R.mjs";
3
+ import { it as Snapshot_d_exports, o as Page, tt as Found, u as ReadyOptions } from "./Page-BfGxn7oN.mjs";
4
4
  import { Duration, Effect, Schema } from "effect";
5
- //#region src/plan/choose.d.ts
5
+ //#region src/walk/internal/choose.d.ts
6
6
  declare const Missing_base: Schema.Class<Missing, Schema.TaggedStruct<"Missing", {}>, import("effect/Cause").YieldableError>;
7
7
  /** Nothing on the page has the step's role and name. */
8
- export declare class Missing extends Missing_base {
8
+ declare class Missing extends Missing_base {
9
9
  get message(): string;
10
10
  }
11
11
  declare const Ambiguous_base: Schema.Class<Ambiguous, Schema.TaggedStruct<"Ambiguous", {
12
12
  readonly count: Schema.Int;
13
13
  }>, import("effect/Cause").YieldableError>;
14
14
  /** Several elements match the step's subject equally well, and nothing tells them apart. */
15
- export declare class Ambiguous extends Ambiguous_base {
15
+ declare class Ambiguous extends Ambiguous_base {
16
16
  get message(): string;
17
17
  }
18
18
  declare const Drifted_base: Schema.Class<Drifted, Schema.TaggedStruct<"Drifted", {
19
19
  readonly detail: Schema.String;
20
20
  }>, import("effect/Cause").YieldableError>;
21
21
  /** The page is not where the recording was: another site, or no element with its context. */
22
- export declare class Drifted extends Drifted_base {
22
+ declare class Drifted extends Drifted_base {
23
23
  get message(): string;
24
24
  }
25
25
  //#endregion
26
- //#region src/plan/data.d.ts
26
+ //#region src/walk/internal/data.d.ts
27
27
  /**
28
28
  * What a step leaves. `durable` asserts an author-chosen, lasting read-back of this operation,
29
29
  * such as its uniquely named saved receipt or exact operation URL. Only Appeared and an exact
30
30
  * Navigated URL allow it; a toast, absence or relative navigation cannot establish recovery.
31
31
  * Relative navigation measures observed change from dispatch, without asserting causality.
32
32
  */
33
- export declare const Expected: Schema.Union<readonly [Schema.TaggedStruct<"Checked", {
33
+ declare const Expected: Schema.Union<readonly [Schema.TaggedStruct<"Checked", {
34
34
  readonly checked: Schema.Boolean;
35
35
  }>, Schema.TaggedStruct<"Appeared", {
36
36
  readonly query: Schema.Struct<{
@@ -53,7 +53,7 @@ export declare const Expected: Schema.Union<readonly [Schema.TaggedStruct<"Check
53
53
  readonly url: Schema.optional<Schema.Never>;
54
54
  readonly durable: Schema.optional<Schema.Never>;
55
55
  }>]>;
56
- export type Expected = typeof Expected.Type;
56
+ type Expected = typeof Expected.Type;
57
57
  declare const Step_base: Schema.Class<Step, Schema.Struct<{
58
58
  readonly action: Schema.refine<{
59
59
  readonly _tag: "Back";
@@ -227,14 +227,14 @@ declare const Step_base: Schema.Class<Step, Schema.Struct<{
227
227
  }>]>>;
228
228
  }>, {}>;
229
229
  /** One recorded step: the action, what it acted on, and what else it was asked. */
230
- export declare class Step extends Step_base {}
231
- declare const Plan_base: Schema.Class<Plan, Schema.Struct<{
230
+ declare class Step extends Step_base {}
231
+ declare const Walk_base: Schema.Class<Walk, Schema.Struct<{
232
232
  readonly version: Schema.Literal<3>;
233
233
  readonly steps: Schema.$Array<typeof Step>;
234
234
  }>, {}>;
235
- export declare class Plan extends Plan_base {
235
+ declare class Walk extends Walk_base {
236
236
  /** Version 3 carries canonical typed Actions; prior string-action encodings are rejected. */
237
- static new(steps: ReadonlyArray<Step>): Plan;
237
+ static new(steps: ReadonlyArray<Step>): Walk;
238
238
  /** The input slots its steps type, in order; replay needs text for each. */
239
239
  get inputs(): ReadonlyArray<string>;
240
240
  }
@@ -245,20 +245,23 @@ declare const Receipt_base: Schema.Class<Receipt, Schema.Struct<{
245
245
  readonly at: Schema.Finite;
246
246
  }>, {}>;
247
247
  /** One completed step, on the page's host clock. `verified` means its expected effect was seen. */
248
- export declare class Receipt extends Receipt_base {}
248
+ declare class Receipt extends Receipt_base {}
249
249
  declare const Stopped_base: Schema.Class<Stopped, Schema.Struct<{
250
250
  readonly step: Schema.Int;
251
251
  readonly input: Schema.Literals<readonly ["unsent", "unknown"]>;
252
252
  }>, {}>;
253
253
  /** Durable stopping data. A begun step without a receipt must be restored as `unknown`. */
254
- export declare class Stopped extends Stopped_base {}
254
+ declare class Stopped extends Stopped_base {}
255
255
  declare const Uncertain_base: Schema.Class<Uncertain, Schema.TaggedStruct<"Uncertain", {
256
256
  readonly detail: Schema.String;
257
257
  }>, import("effect/Cause").YieldableError>;
258
258
  /** Repeating this step could repeat an unresolved effect; the consumer must reconcile it. */
259
- export declare class Uncertain extends Uncertain_base {
259
+ declare class Uncertain extends Uncertain_base {
260
260
  get message(): string;
261
261
  }
262
+ /** Why replay stopped, as `ReplayError`'s `reason`. */
263
+ declare const ReplayErrorReason: Schema.Union<readonly [typeof Missing, typeof Ambiguous, typeof Drifted, typeof BrowserError, typeof Uncertain]>;
264
+ type ReplayErrorReason = typeof ReplayErrorReason.Type;
262
265
  declare const ReplayError_base: Schema.Class<ReplayError, Schema.TaggedStruct<"ReplayError", {
263
266
  readonly step: Schema.Int;
264
267
  readonly reason: Schema.Union<readonly [typeof Missing, typeof Ambiguous, typeof Drifted, typeof BrowserError, typeof Uncertain]>;
@@ -266,27 +269,34 @@ declare const ReplayError_base: Schema.Class<ReplayError, Schema.TaggedStruct<"R
266
269
  readonly receipts: Schema.$Array<typeof Receipt>;
267
270
  }>, import("effect/Cause").YieldableError>;
268
271
  /** Where replay stopped, counting steps from 0, why, and the steps that completed before it. */
269
- export declare class ReplayError extends ReplayError_base {
272
+ declare class ReplayError extends ReplayError_base {
270
273
  get stopped(): Stopped;
271
274
  get message(): string;
272
275
  }
276
+ /** Whether a value is a `ReplayError`. */
277
+ declare const isReplayError: (u: unknown) => u is ReplayError;
278
+ /** Whether a value is one of `ReplayError`'s reasons. */
279
+ declare const isReplayErrorReason: (u: unknown) => u is ReplayErrorReason;
273
280
  //#endregion
274
- //#region src/plan/record.d.ts
281
+ //#region src/walk/internal/record.d.ts
275
282
  /**
276
283
  * The walk one page's events record: the completed actions of the page that acted first, in
277
284
  * order. `page.recentEvents` gives them, or `browser.events()` read until the walk ends.
278
285
  */
279
- export declare const fromEvents: (events: Iterable<BrowserEvent>) => Plan;
286
+ declare const fromEvents: (events: Iterable<BrowserEvent>) => Walk;
280
287
  //#endregion
281
- //#region src/plan/targets.d.ts
288
+ //#region src/walk/internal/targets.d.ts
282
289
  /**
283
- * The one element on the page that a subject names, by role, name and context (see `Plan`),
290
+ * The one element on the page that a subject names, by role, name and context (see `Walk`),
284
291
  * looking again for two seconds while the page may still be drawing it.
285
292
  */
286
- export declare const locate: (page: Page, subject: Subject) => Effect.Effect<Found, Ambiguous | BrowserError | Drifted | Missing, never>;
293
+ declare const locate: {
294
+ (subject: Subject): (page: Page) => Effect.Effect<Found, Missing | Ambiguous | Drifted | BrowserError>;
295
+ (page: Page, subject: Subject): Effect.Effect<Found, Missing | Ambiguous | Drifted | BrowserError>;
296
+ };
287
297
  //#endregion
288
- //#region src/plan/execute.d.ts
289
- interface TakeOptions {
298
+ //#region src/walk/internal/execute.d.ts
299
+ interface StepOptions {
290
300
  /** How each step waits first, except an opening navigation, or false. No final-step wait. */
291
301
  readonly settle?: ReadyOptions | false | undefined;
292
302
  readonly inputs?: Readonly<Record<string, string>> | undefined;
@@ -296,26 +306,40 @@ interface TakeOptions {
296
306
  */
297
307
  readonly arrival?: Duration.Input | undefined;
298
308
  }
299
- interface ReplayOptions extends TakeOptions {
309
+ interface ReplayOptions extends StepOptions {
300
310
  readonly from?: number | Stopped | undefined;
301
311
  }
302
312
  /**
303
- * Input that can be repeated without repeating a commitment. `take` also validates a Checked
313
+ * Input that can be repeated without repeating a commitment. `step` also validates a Checked
304
314
  * target's boolean state before input. Back/reload can resubmit a form.
305
315
  */
306
- export declare const repeatable: (step: Step) => boolean;
316
+ declare const repeatable: (step: Step) => boolean;
307
317
  /**
308
318
  * Take one step. Unknown non-repeatable input is never resent: only positive durable read-back
309
319
  * can skip it. An interrupted call remains interrupted; persist begun-before-call in the consumer
310
320
  * and treat a missing receipt as Stopped{input: "unknown"}, including after process restart.
311
321
  */
312
- export declare const take: (page: Page, plan: Plan, at: number | Stopped, options?: TakeOptions | undefined) => Effect.Effect<Receipt, ReplayError, never>;
322
+ declare const step: {
323
+ (plan: Walk, at: number | Stopped, options?: StepOptions): (page: Page) => Effect.Effect<Receipt, ReplayError>;
324
+ (page: Page, plan: Walk, at: number | Stopped, options?: StepOptions): Effect.Effect<Receipt, ReplayError>;
325
+ };
313
326
  /** Take a plan's steps from a fresh index or durable stopping point, returning completed receipts. */
314
- export declare const replay: (page: Page, plan: Plan, options?: ReplayOptions) => Effect.Effect<Receipt[], ReplayError, never>;
315
- /** Restore prior steps on a fresh page; unresolved commitments require positive durable evidence. */
316
- export declare const restore: (page: Page, plan: Plan, options?: TakeOptions & {
327
+ declare const replay: {
328
+ (plan: Walk, options?: ReplayOptions): (page: Page) => Effect.Effect<ReadonlyArray<Receipt>, ReplayError>;
329
+ (page: Page, plan: Walk, options?: ReplayOptions): Effect.Effect<ReadonlyArray<Receipt>, ReplayError>;
330
+ };
331
+ /** What `restore` takes: how each step waits, its inputs, and how many steps it restores. */
332
+ interface RestoreOptions extends StepOptions {
317
333
  readonly upTo?: number | undefined;
318
- }) => Effect.Effect<Receipt[], ReplayError, never>;
334
+ }
335
+ /** Restore prior steps on a fresh page; unresolved commitments require positive durable evidence. */
336
+ declare const restore: {
337
+ (plan: Walk, options?: RestoreOptions): (page: Page) => Effect.Effect<ReadonlyArray<Receipt>, ReplayError>;
338
+ (page: Page, plan: Walk, options?: RestoreOptions): Effect.Effect<ReadonlyArray<Receipt>, ReplayError>;
339
+ };
340
+ declare namespace Walk_d_exports {
341
+ export { Ambiguous, Drifted, Expected, Missing, Receipt, ReplayError, ReplayErrorReason, ReplayOptions, RestoreOptions, Step, StepOptions, Stopped, Uncertain, Walk, fromEvents, isReplayError, isReplayErrorReason, locate, repeatable, replay, restore, step };
342
+ }
319
343
  //#endregion
320
- export type { ReplayOptions, TakeOptions };
321
- //# sourceMappingURL=index.d.mts.map
344
+ export { Missing as C, Drifted as S, Uncertain as _, repeatable as a, isReplayErrorReason as b, step as c, Expected as d, Receipt as f, Stopped as g, Step as h, StepOptions as i, locate as l, ReplayErrorReason as m, ReplayOptions as n, replay as o, ReplayError as p, RestoreOptions as r, restore as s, Walk_d_exports as t, fromEvents as u, Walk as v, Ambiguous as x, isReplayError as y };
345
+ //# sourceMappingURL=Walk-BNXcfZ2z.d.mts.map
@@ -1,16 +1,18 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
1
2
  import { Action, targetOf } from "../Action.mjs";
2
3
  import { Box, Subject } from "../BrowserEvent.mjs";
3
4
  import { BrowserError, InvalidRequest, undispatched } from "../BrowserError.mjs";
4
- import { p as redacted } from "../Page-BaAOshxo.mjs";
5
- import { match } from "../Matching.mjs";
6
- import { t as wait } from "../Stillness-BwP0RdI4.mjs";
7
- import { Clock, Duration, Effect, Exit, Option, Schedule, Schema } from "effect";
8
- //#region src/plan/choose.ts
5
+ import { c as isPage, l as redacted } from "./Page-DqF-tuTx.mjs";
6
+ import { t as match } from "./matching-Cs-UeOY0.mjs";
7
+ import { find, until } from "../Snapshot.mjs";
8
+ import { n as wait } from "./Stillness-DCPeAN1a.mjs";
9
+ import { Clock, Duration, Effect, Exit, Function, Option, Schedule, Schema } from "effect";
10
+ //#region src/walk/internal/choose.ts
9
11
  /**
10
- * Choosing the one element a recorded subject names, among those `find` gives for its role and
11
- * name. Context tells them apart, and an element that does not repeat every part of the recorded
12
- * context is another subject, so a sole element left once its own has gone, such as Alice's
13
- * "Remove" after Bob has left, drifts rather than stands in:
12
+ * Choosing the one element a recorded subject names, among those `Snapshot.find` gives for its
13
+ * role and name. Context tells them apart, and an element that does not repeat every part of the
14
+ * recorded context is another subject, so a sole element left once its own has gone, such as
15
+ * Alice's "Remove" after Bob has left, drifts rather than stands in:
14
16
  *
15
17
  * - a row is read whole: a row named "Wrapped BTC" is not the row "BTC". Laid out again without
16
18
  * rows, as cards, one of the element's fields must start with the row's words;
@@ -22,19 +24,19 @@ import { Clock, Duration, Effect, Exit, Option, Schedule, Schema } from "effect"
22
24
  * ordinal, so a tie stays a tie.
23
25
  */
24
26
  /** Nothing on the page has the step's role and name. */
25
- var Missing = class extends Schema.TaggedError()("Missing", {}) {
27
+ var Missing = class extends Schema.TaggedError("effect-browser/walk/Walk/Missing")("Missing", {}) {
26
28
  get message() {
27
29
  return "nothing on the page has the recorded role and name";
28
30
  }
29
31
  };
30
32
  /** Several elements match the step's subject equally well, and nothing tells them apart. */
31
- var Ambiguous = class extends Schema.TaggedError()("Ambiguous", { count: Schema.Int }) {
33
+ var Ambiguous = class extends Schema.TaggedError("effect-browser/walk/Walk/Ambiguous")("Ambiguous", { count: Schema.Int }) {
32
34
  get message() {
33
35
  return `${this.count} elements match the recorded subject equally well`;
34
36
  }
35
37
  };
36
38
  /** The page is not where the recording was: another site, or no element with its context. */
37
- var Drifted = class extends Schema.TaggedError()("Drifted", { detail: Schema.String }) {
39
+ var Drifted = class extends Schema.TaggedError("effect-browser/walk/Walk/Drifted")("Drifted", { detail: Schema.String }) {
38
40
  get message() {
39
41
  return this.detail;
40
42
  }
@@ -78,7 +80,7 @@ const choose = (subject, found) => {
78
80
  return top.length === 1 && only !== void 0 ? Effect.succeed(only.one) : Effect.fail(new Ambiguous({ count: top.length }));
79
81
  };
80
82
  //#endregion
81
- //#region src/plan/data.ts
83
+ //#region src/walk/internal/data.ts
82
84
  /** Serializable plan steps, expected effects, receipts and durable stopping evidence. */
83
85
  /** Reuse the execution variants; recorded code has no serializable replay capability. */
84
86
  const ReplayAction = Action.pipe(Schema.refine((value) => value._tag !== "Act"));
@@ -113,7 +115,7 @@ const Expected = Schema.Union([
113
115
  })
114
116
  ]);
115
117
  /** One recorded step: the action, what it acted on, and what else it was asked. */
116
- var Step = class extends Schema.Class("effect-browser/Plan/Step")({
118
+ var Step = class extends Schema.Class("effect-browser/walk/Walk/Step")({
117
119
  action: ReplayAction,
118
120
  /** The address reached, including a delayed navigation before the next action began. */
119
121
  url: Schema.String,
@@ -126,13 +128,13 @@ var Step = class extends Schema.Class("effect-browser/Plan/Step")({
126
128
  input: Schema.optional(Schema.String),
127
129
  expect: Schema.optional(Expected)
128
130
  }) {};
129
- var Plan = class Plan extends Schema.Class("effect-browser/Plan")({
131
+ var Walk = class Walk extends Schema.Class("effect-browser/walk/Walk")({
130
132
  version: Schema.Literal(3),
131
133
  steps: Schema.Array(Step)
132
134
  }) {
133
135
  /** Version 3 carries canonical typed Actions; prior string-action encodings are rejected. */
134
136
  static new(steps) {
135
- return new Plan({
137
+ return new Walk({
136
138
  version: 3,
137
139
  steps
138
140
  });
@@ -143,7 +145,7 @@ var Plan = class Plan extends Schema.Class("effect-browser/Plan")({
143
145
  }
144
146
  };
145
147
  /** One completed step, on the page's host clock. `verified` means its expected effect was seen. */
146
- var Receipt = class extends Schema.Class("effect-browser/Plan/Receipt")({
148
+ var Receipt = class extends Schema.Class("effect-browser/walk/Walk/Receipt")({
147
149
  step: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
148
150
  outcome: Schema.Literals([
149
151
  "taken",
@@ -154,26 +156,28 @@ var Receipt = class extends Schema.Class("effect-browser/Plan/Receipt")({
154
156
  at: Schema.Finite
155
157
  }) {};
156
158
  /** Durable stopping data. A begun step without a receipt must be restored as `unknown`. */
157
- var Stopped = class extends Schema.Class("effect-browser/Plan/Stopped")({
159
+ var Stopped = class extends Schema.Class("effect-browser/walk/Walk/Stopped")({
158
160
  step: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
159
161
  input: Schema.Literals(["unsent", "unknown"])
160
162
  }) {};
161
163
  /** Repeating this step could repeat an unresolved effect; the consumer must reconcile it. */
162
- var Uncertain = class extends Schema.TaggedError()("Uncertain", { detail: Schema.String }) {
164
+ var Uncertain = class extends Schema.TaggedError("effect-browser/walk/Walk/Uncertain")("Uncertain", { detail: Schema.String }) {
163
165
  get message() {
164
166
  return this.detail;
165
167
  }
166
168
  };
169
+ /** Why replay stopped, as `ReplayError`'s `reason`. */
170
+ const ReplayErrorReason = Schema.Union([
171
+ Missing,
172
+ Ambiguous,
173
+ Drifted,
174
+ BrowserError,
175
+ Uncertain
176
+ ]);
167
177
  /** Where replay stopped, counting steps from 0, why, and the steps that completed before it. */
168
- var ReplayError = class extends Schema.TaggedError()("ReplayError", {
178
+ var ReplayError = class extends Schema.TaggedError("effect-browser/walk/Walk/ReplayError")("ReplayError", {
169
179
  step: Schema.Int,
170
- reason: Schema.Union([
171
- Missing,
172
- Ambiguous,
173
- Drifted,
174
- BrowserError,
175
- Uncertain
176
- ]),
180
+ reason: ReplayErrorReason,
177
181
  input: Schema.Literals(["unsent", "unknown"]),
178
182
  receipts: Schema.Array(Receipt)
179
183
  }) {
@@ -187,8 +191,12 @@ var ReplayError = class extends Schema.TaggedError()("ReplayError", {
187
191
  return `step ${this.step} failed: ${this.reason.message}`;
188
192
  }
189
193
  };
194
+ /** Whether a value is a `ReplayError`. */
195
+ const isReplayError = Schema.is(ReplayError);
196
+ /** Whether a value is one of `ReplayError`'s reasons. */
197
+ const isReplayErrorReason = Schema.is(ReplayErrorReason);
190
198
  //#endregion
191
- //#region src/plan/record.ts
199
+ //#region src/walk/internal/record.ts
192
200
  /** Derive replay steps from typed action events without parsing rendered descriptions. */
193
201
  const isStep = (event) => event._tag === "Action" && event.ok && event.value._tag !== "Act";
194
202
  /** A slot named for the field it fills, such as `email`, unique within the plan. */
@@ -212,7 +220,7 @@ const fromEvents = (events) => {
212
220
  const moves = mine.filter((event) => event._tag === "Navigated");
213
221
  const taken = /* @__PURE__ */ new Set();
214
222
  const before = (time) => moves.findLast((move) => move.at <= time)?.url ?? opened;
215
- return new Plan({
223
+ return new Walk({
216
224
  version: 3,
217
225
  steps: steps.map((action, index) => {
218
226
  const value = action.value;
@@ -235,14 +243,14 @@ const fromEvents = (events) => {
235
243
  });
236
244
  };
237
245
  //#endregion
238
- //#region src/plan/targets.ts
246
+ //#region src/walk/internal/targets.ts
239
247
  /** Find a recorded subject and verify where its point still lands before replay input. */
240
248
  const invalid$1 = (detail) => undispatched("replay", new InvalidRequest({ detail }));
241
249
  /**
242
- * The one element on the page that a subject names, by role, name and context (see `Plan`),
250
+ * The one element on the page that a subject names, by role, name and context (see `Walk`),
243
251
  * looking again for two seconds while the page may still be drawing it.
244
252
  */
245
- const locate = (page, subject) => page.find({
253
+ const locate = Function.dual(2, (page, subject) => find(page, {
246
254
  name: subject.name,
247
255
  scope: "document",
248
256
  ...subject.role === null ? {} : { role: subject.role }
@@ -250,7 +258,7 @@ const locate = (page, subject) => page.find({
250
258
  schedule: Schedule.spaced(Duration.millis(250)),
251
259
  times: 8,
252
260
  while: (error) => error._tag !== "BrowserError"
253
- }), Effect.provideService(Clock.Clock, page.clock), Effect.withSpan("Plan.locate", { attributes: { role: subject.role ?? "" } }));
261
+ }), Effect.provideService(Clock.Clock, page.hostClock), Effect.withSpan("Walk.locate", { attributes: { role: subject.role ?? "" } })));
254
262
  /**
255
263
  * Where the step acts: the element its subject names, or, for a step recorded at a point, the same
256
264
  * place within that element, as long as a press there reaches that element and not one over it.
@@ -264,13 +272,13 @@ const aim = (page, subject, point, recorded) => {
264
272
  x: box.x + (point.x - recorded.x) / recorded.width * box.width,
265
273
  y: box.y + (point.y - recorded.y) / recorded.height * box.height
266
274
  };
267
- return Effect.map(page.find({ at }), ([reached]) => reached?.ref === ref ? at : void 0);
275
+ return Effect.map(find(page, { at }), ([reached]) => reached?.ref === ref ? at : void 0);
268
276
  };
269
277
  const missed = new Drifted({ detail: "a press at the subject's point reaches another element" });
270
278
  return locate(page, subject).pipe(Effect.flatMap((found) => Effect.flatMap(reach(found), (at) => at !== void 0 ? Effect.succeed(at) : page.hover(found.ref).pipe(Effect.andThen(locate(page, subject)), Effect.flatMap(reach), Effect.flatMap((again) => again === void 0 ? Effect.fail(missed) : Effect.succeed(again))))));
271
279
  };
272
280
  //#endregion
273
- //#region src/plan/execute.ts
281
+ //#region src/walk/internal/execute.ts
274
282
  /** Replay and restore with durable read-back before repeating uncertain consequential input. */
275
283
  const invalid = (detail) => undispatched("replay", new InvalidRequest({ detail }));
276
284
  const dispatch = (page, step, text, before) => {
@@ -324,7 +332,7 @@ const dispatch = (page, step, text, before) => {
324
332
  }).pipe(Effect.tap(() => before), Effect.flatMap(page.perform), Effect.asVoid);
325
333
  };
326
334
  /**
327
- * Input that can be repeated without repeating a commitment. `take` also validates a Checked
335
+ * Input that can be repeated without repeating a commitment. `step` also validates a Checked
328
336
  * target's boolean state before input. Back/reload can resubmit a form.
329
337
  */
330
338
  const repeatable = (step) => [
@@ -354,18 +362,13 @@ const checkEffect = (page, step, first, millis = 0) => {
354
362
  if (expected.url === void 0 && first === void 0) return Effect.succeed(false);
355
363
  return Effect.map(page.state, (now) => expected.url === void 0 ? now.url !== first?.url || now.connection === first?.connection && now.document !== first?.document : now.url === expected.url);
356
364
  case "Appeared":
357
- case "Gone": return Effect.map(page.until({
365
+ case "Gone": return Effect.map(until(page, {
358
366
  ...expected.query,
359
367
  scope: "document"
360
368
  }, expected._tag === "Appeared" ? "some" : "none", millis), ({ met }) => met);
361
369
  }
362
370
  };
363
- /**
364
- * Take one step. Unknown non-repeatable input is never resent: only positive durable read-back
365
- * can skip it. An interrupted call remains interrupted; persist begun-before-call in the consumer
366
- * and treat a missing receipt as Stopped{input: "unknown"}, including after process restart.
367
- */
368
- const take = Effect.fn("Plan.take")(function* (page, plan, at, options = {}) {
371
+ const stepOn = Effect.fn("Walk.step")(function* (page, plan, at, options = {}) {
369
372
  const index = typeof at === "number" ? at : at.step;
370
373
  let input = typeof at === "number" ? "unsent" : at.input;
371
374
  return yield* Effect.gen(function* () {
@@ -385,10 +388,10 @@ const take = Effect.fn("Plan.take")(function* (page, plan, at, options = {}) {
385
388
  "Goto",
386
389
  "Back",
387
390
  "Reload"
388
- ].includes(step.action._tag))) yield* options.settle?.quietMillis === void 0 ? page.ready(options.settle) : wait(page, {
391
+ ].includes(step.action._tag))) yield* options.settle?.quiet === void 0 ? page.ready(options.settle) : wait(page, {
389
392
  ...options.settle,
390
393
  still: "content",
391
- quietMillis: options.settle.quietMillis
394
+ quiet: options.settle.quiet
392
395
  });
393
396
  const before = plan.steps[index - 1]?.url;
394
397
  if (before !== void 0) yield* arrived(page, unresolved ? [before, step.url] : [before], millis);
@@ -431,7 +434,7 @@ const take = Effect.fn("Plan.take")(function* (page, plan, at, options = {}) {
431
434
  input = "unknown";
432
435
  if (expected !== void 0 && !(yield* verify)) return yield* new Drifted({ detail: "the step's expected effect did not arrive" });
433
436
  return yield* receipt(expected === void 0 ? "taken" : "verified");
434
- }).pipe(Effect.provideService(Clock.Clock, page.clock), Effect.mapError((reason) => new ReplayError({
437
+ }).pipe(Effect.provideService(Clock.Clock, page.hostClock), Effect.mapError((reason) => new ReplayError({
435
438
  step: index,
436
439
  reason,
437
440
  input,
@@ -461,7 +464,7 @@ const run = Effect.fnUntraced(function* (page, plan, options, from, until, resto
461
464
  step: index,
462
465
  input: "unknown"
463
466
  }) : index === start ? from : index;
464
- const receipt = yield* take(page, plan, at, options).pipe(Effect.mapError((error) => new ReplayError({
467
+ const receipt = yield* stepOn(page, plan, at, options).pipe(Effect.mapError((error) => new ReplayError({
465
468
  ...error,
466
469
  receipts: [...receipts]
467
470
  })));
@@ -469,11 +472,40 @@ const run = Effect.fnUntraced(function* (page, plan, options, from, until, resto
469
472
  }
470
473
  return receipts;
471
474
  });
475
+ /**
476
+ * Take one step. Unknown non-repeatable input is never resent: only positive durable read-back
477
+ * can skip it. An interrupted call remains interrupted; persist begun-before-call in the consumer
478
+ * and treat a missing receipt as Stopped{input: "unknown"}, including after process restart.
479
+ */
480
+ const step = Function.dual((args) => isPage(args[0]), stepOn);
472
481
  /** Take a plan's steps from a fresh index or durable stopping point, returning completed receipts. */
473
- const replay = (page, plan, options = {}) => run(page, plan, options, options.from ?? 0, plan.steps.length, false).pipe(Effect.withSpan("Plan.replay"));
482
+ const replay = Function.dual((args) => isPage(args[0]), (page, plan, options = {}) => run(page, plan, options, options.from ?? 0, plan.steps.length, false).pipe(Effect.withSpan("Walk.replay")));
474
483
  /** Restore prior steps on a fresh page; unresolved commitments require positive durable evidence. */
475
- const restore = (page, plan, options = {}) => run(page, plan, options, 0, options.upTo ?? plan.steps.length, true).pipe(Effect.withSpan("Plan.restore"));
484
+ const restore = Function.dual((args) => isPage(args[0]), (page, plan, options = {}) => run(page, plan, options, 0, options.upTo ?? plan.steps.length, true).pipe(Effect.withSpan("Walk.restore")));
485
+ //#endregion
486
+ //#region src/walk/Walk.ts
487
+ var Walk_exports = /* @__PURE__ */ __exportAll({
488
+ Ambiguous: () => Ambiguous,
489
+ Drifted: () => Drifted,
490
+ Expected: () => Expected,
491
+ Missing: () => Missing,
492
+ Receipt: () => Receipt,
493
+ ReplayError: () => ReplayError,
494
+ ReplayErrorReason: () => ReplayErrorReason,
495
+ Step: () => Step,
496
+ Stopped: () => Stopped,
497
+ Uncertain: () => Uncertain,
498
+ Walk: () => Walk,
499
+ fromEvents: () => fromEvents,
500
+ isReplayError: () => isReplayError,
501
+ isReplayErrorReason: () => isReplayErrorReason,
502
+ locate: () => locate,
503
+ repeatable: () => repeatable,
504
+ replay: () => replay,
505
+ restore: () => restore,
506
+ step: () => step
507
+ });
476
508
  //#endregion
477
- export { Ambiguous, Drifted, Expected, Missing, Plan, Receipt, ReplayError, Step, Stopped, Uncertain, fromEvents, locate, repeatable, replay, restore, take };
509
+ export { isReplayErrorReason as _, step as a, Missing as b, Expected as c, ReplayErrorReason as d, Step as f, isReplayError as g, Walk as h, restore as i, Receipt as l, Uncertain as m, repeatable as n, locate as o, Stopped as p, replay as r, fromEvents as s, Walk_exports as t, ReplayError as u, Ambiguous as v, Drifted as y };
478
510
 
479
- //# sourceMappingURL=index.mjs.map
511
+ //# sourceMappingURL=Walk-C5ky7uSf.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Walk-C5ky7uSf.mjs","names":["invalid","Snapshot.find","Snapshot.until","Stillness.wait"],"sources":["../../src/walk/internal/choose.ts","../../src/walk/internal/data.ts","../../src/walk/internal/record.ts","../../src/walk/internal/targets.ts","../../src/walk/internal/execute.ts","../../src/walk/Walk.ts"],"sourcesContent":["/**\n * Choosing the one element a recorded subject names, among those `Snapshot.find` gives for its\n * role and name. Context tells them apart, and an element that does not repeat every part of the\n * recorded context is another subject, so a sole element left once its own has gone, such as\n * Alice's \"Remove\" after Bob has left, drifts rather than stands in:\n *\n * - a row is read whole: a row named \"Wrapped BTC\" is not the row \"BTC\". Laid out again without\n * rows, as cards, one of the element's fields must start with the row's words;\n * - a column counts where the element is under one;\n * - a label or heading must read the same, or its words appear, whole and in order, in one of the\n * element's fields, as `near` reads them.\n *\n * The rest are ranked by how much of the recorded context they read the same. There is no\n * ordinal, so a tie stays a tie.\n */\nimport { Effect, Schema } from \"effect\";\n\nimport type { Subject, SubjectContext } from \"../../BrowserEvent.ts\";\nimport { match } from \"../../internal/matching.ts\";\nimport type { Found } from \"../../Snapshot.ts\";\n\n/** Nothing on the page has the step's role and name. */\nexport class Missing extends Schema.TaggedError<Missing>(\"effect-browser/walk/Walk/Missing\")(\n \"Missing\",\n {},\n) {\n override get message() {\n return \"nothing on the page has the recorded role and name\";\n }\n}\n\n/** Several elements match the step's subject equally well, and nothing tells them apart. */\nexport class Ambiguous extends Schema.TaggedError<Ambiguous>(\"effect-browser/walk/Walk/Ambiguous\")(\n \"Ambiguous\",\n {\n count: Schema.Int,\n },\n) {\n override get message() {\n return `${this.count} elements match the recorded subject equally well`;\n }\n}\n\n/** The page is not where the recording was: another site, or no element with its context. */\nexport class Drifted extends Schema.TaggedError<Drifted>(\"effect-browser/walk/Walk/Drifted\")(\n \"Drifted\",\n {\n detail: Schema.String,\n },\n) {\n override get message() {\n return this.detail;\n }\n}\n\nconst { holds, normalize } = match();\nconst fields = [\"row\", \"column\", \"label\", \"heading\"] as const;\n\nconst said = (context: SubjectContext) =>\n Object.values(context).filter((value) => typeof value === \"string\");\n\n/** How an element repeats one recorded field: 2 read the same, 1 found as words, 0 not at all. */\nconst repeats = (field: (typeof fields)[number], value: string, context: SubjectContext) => {\n const own = context[field];\n\n if (own !== undefined && normalize(own) === normalize(value)) return 2;\n if (field === \"column\") return own === undefined ? 1 : 0;\n if (field === \"row\")\n return own === undefined &&\n said(context).some((other) => `${normalize(other)} `.startsWith(`${normalize(value)} `))\n ? 1\n : 0;\n\n return said(context).some((other) => holds(other, value)) ? 1 : 0;\n};\n\nexport const choose = (\n subject: Subject,\n found: ReadonlyArray<Found>,\n): Effect.Effect<Found, Missing | Ambiguous | Drifted> => {\n // `find` matched the role; a subject without one only matches elements without one.\n const named = found.filter((one) => subject.role !== null || one.subject.role === null);\n\n const kept = named.flatMap((one) => {\n let score = 0;\n\n for (const field of fields) {\n const value = subject.context[field];\n const repeated = value === undefined ? 0 : repeats(field, value, one.subject.context);\n\n if (value !== undefined && repeated === 0) return [];\n score += repeated;\n }\n\n return [{ one, score }];\n });\n\n const best = Math.max(...kept.map(({ score }) => score));\n const top = kept.filter(({ score }) => score === best);\n const [only] = top;\n\n if (named.length === 0) return Effect.fail(new Missing());\n if (kept.length === 0)\n return Effect.fail(new Drifted({ detail: \"no element named so repeats the recorded context\" }));\n\n return top.length === 1 && only !== undefined\n ? Effect.succeed(only.one)\n : Effect.fail(new Ambiguous({ count: top.length }));\n};\n","/** Serializable plan steps, expected effects, receipts and durable stopping evidence. */\nimport { Schema } from \"effect\";\n\nimport { Action } from \"../../Action.ts\";\nimport { BrowserError } from \"../../BrowserError.ts\";\nimport { Box, Subject } from \"../../BrowserEvent.ts\";\nimport { Ambiguous, Drifted, Missing } from \"./choose.ts\";\n\n/** Reuse the execution variants; recorded code has no serializable replay capability. */\nconst ReplayAction = Action.pipe(\n Schema.refine(\n (value): value is Exclude<Action, { readonly _tag: \"Act\" }> => value._tag !== \"Act\",\n ),\n);\n\nconst Query = Schema.Struct({\n role: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n text: Schema.optional(Schema.String),\n});\n\n/**\n * What a step leaves. `durable` asserts an author-chosen, lasting read-back of this operation,\n * such as its uniquely named saved receipt or exact operation URL. Only Appeared and an exact\n * Navigated URL allow it; a toast, absence or relative navigation cannot establish recovery.\n * Relative navigation measures observed change from dispatch, without asserting causality.\n */\nexport const Expected = Schema.Union([\n Schema.TaggedStruct(\"Checked\", { checked: Schema.Boolean }),\n Schema.TaggedStruct(\"Appeared\", {\n query: Query,\n durable: Schema.optional(Schema.Literal(true)),\n }),\n Schema.TaggedStruct(\"Gone\", {\n query: Query,\n durable: Schema.optional(Schema.Never),\n }),\n Schema.TaggedStruct(\"Navigated\", {\n url: Schema.String,\n durable: Schema.optional(Schema.Literal(true)),\n }),\n Schema.TaggedStruct(\"Navigated\", {\n url: Schema.optional(Schema.Never),\n durable: Schema.optional(Schema.Never),\n }),\n]);\n\nexport type Expected = typeof Expected.Type;\n\n/** One recorded step: the action, what it acted on, and what else it was asked. */\nexport class Step extends Schema.Class<Step>(\"effect-browser/walk/Walk/Step\")({\n action: ReplayAction,\n /** The address reached, including a delayed navigation before the next action began. */\n url: Schema.String,\n subject: Schema.optional(Subject),\n /** Where a drag ended. */\n to: Schema.optional(Subject),\n /** The recorded box keeps a point at the same relative position within its subject. */\n box: Schema.optional(Box),\n /** A slot replaces recorded typing text or a navigation address with withheld credentials. */\n input: Schema.optional(Schema.String),\n expect: Schema.optional(Expected),\n}) {}\n\nexport class Walk extends Schema.Class<Walk>(\"effect-browser/walk/Walk\")({\n version: Schema.Literal(3),\n steps: Schema.Array(Step),\n}) {\n /** Version 3 carries canonical typed Actions; prior string-action encodings are rejected. */\n static new(steps: ReadonlyArray<Step>): Walk {\n return new Walk({ version: 3, steps });\n }\n\n /** The input slots its steps type, in order; replay needs text for each. */\n get inputs(): ReadonlyArray<string> {\n return this.steps.flatMap((step) => (step.input === undefined ? [] : [step.input]));\n }\n}\n\n/** One completed step, on the page's host clock. `verified` means its expected effect was seen. */\nexport class Receipt extends Schema.Class<Receipt>(\"effect-browser/walk/Walk/Receipt\")({\n step: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n outcome: Schema.Literals([\"taken\", \"verified\", \"skipped\"]),\n startedAt: Schema.Finite,\n at: Schema.Finite,\n}) {}\n\n/** Durable stopping data. A begun step without a receipt must be restored as `unknown`. */\nexport class Stopped extends Schema.Class<Stopped>(\"effect-browser/walk/Walk/Stopped\")({\n step: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n input: Schema.Literals([\"unsent\", \"unknown\"]),\n}) {}\n\n/** Repeating this step could repeat an unresolved effect; the consumer must reconcile it. */\nexport class Uncertain extends Schema.TaggedError<Uncertain>(\"effect-browser/walk/Walk/Uncertain\")(\n \"Uncertain\",\n {\n detail: Schema.String,\n },\n) {\n override get message() {\n return this.detail;\n }\n}\n\n/** Why replay stopped, as `ReplayError`'s `reason`. */\nexport const ReplayErrorReason = Schema.Union([\n Missing,\n Ambiguous,\n Drifted,\n BrowserError,\n Uncertain,\n]);\n\nexport type ReplayErrorReason = typeof ReplayErrorReason.Type;\n\n/** Where replay stopped, counting steps from 0, why, and the steps that completed before it. */\nexport class ReplayError extends Schema.TaggedError<ReplayError>(\n \"effect-browser/walk/Walk/ReplayError\",\n)(\"ReplayError\", {\n step: Schema.Int,\n reason: ReplayErrorReason,\n input: Schema.Literals([\"unsent\", \"unknown\"]),\n receipts: Schema.Array(Receipt),\n}) {\n get stopped(): Stopped {\n return new Stopped({ step: this.step, input: this.input });\n }\n\n override get message() {\n return `step ${this.step} failed: ${this.reason.message}`;\n }\n}\n\n/** Whether a value is a `ReplayError`. */\nexport const isReplayError: (u: unknown) => u is ReplayError = Schema.is(ReplayError);\n\n/** Whether a value is one of `ReplayError`'s reasons. */\nexport const isReplayErrorReason: (u: unknown) => u is ReplayErrorReason =\n Schema.is(ReplayErrorReason);\n","/** Derive replay steps from typed action events without parsing rendered descriptions. */\nimport { targetOf } from \"../../Action.ts\";\nimport { type Action, type BrowserEvent, type Navigated } from \"../../BrowserEvent.ts\";\nimport { redacted } from \"../../Page.ts\";\nimport { Walk, Step } from \"./data.ts\";\n\nconst isStep = (\n event: BrowserEvent,\n): event is Action & {\n readonly value: Exclude<Action[\"value\"], { readonly _tag: \"Act\" }>;\n} => event._tag === \"Action\" && event.ok && event.value._tag !== \"Act\";\n\n/** A slot named for the field it fills, such as `email`, unique within the plan. */\nconst slotFor = (taken: Set<string>, field: string | undefined) => {\n const base =\n field\n ?.toLowerCase()\n .match(/[\\p{L}\\p{N}]+/gu)\n ?.join(\"-\") ?? \"input\";\n\n let slot = base;\n\n for (let count = 2; taken.has(slot); count++) slot = `${base}-${count}`;\n taken.add(slot);\n\n return slot;\n};\n\n/**\n * The walk one page's events record: the completed actions of the page that acted first, in\n * order. `page.recentEvents` gives them, or `browser.events()` read until the walk ends.\n */\nexport const fromEvents = (events: Iterable<BrowserEvent>): Walk => {\n const all = Array.from(events);\n const page = all.find((event) => event._tag === \"Action\")?.page;\n const mine = all.filter((event) => \"page\" in event && event.page === page);\n const steps = mine.filter(isStep);\n const opened = mine.find((event) => event._tag === \"PageOpened\")?.url ?? \"\";\n const moves = mine.filter((event): event is Navigated => event._tag === \"Navigated\");\n const taken = new Set<string>();\n\n // Where the page was just before a time: the last address it reached by then.\n const before = (time: number) => moves.findLast((move) => move.at <= time)?.url ?? opened;\n\n return new Walk({\n version: 3,\n steps: steps.map((action, index) => {\n const value = action.value;\n\n const target = targetOf(value);\n const point = typeof target === \"object\" ? target : undefined;\n const until = steps[index + 1]?.startedAt ?? Number.POSITIVE_INFINITY;\n const arrival = moves.findLast((move) => move.at > action.at && move.at <= until);\n\n // Refs are rebound from subjects at replay; typed text is replaced by a caller input slot.\n return new Step({\n action: value._tag === \"Type\" ? { ...value, text: \"\" } : value,\n url: arrival?.url ?? action.url ?? before(until),\n subject: action.subject,\n to: action.to,\n box: point === undefined ? undefined : action.box,\n input:\n value._tag === \"Type\"\n ? slotFor(taken, action.subject?.name)\n : value._tag === \"Goto\" && value.url.includes(redacted)\n ? slotFor(taken, \"address\")\n : undefined,\n });\n }),\n });\n};\n","/** Find a recorded subject and verify where its point still lands before replay input. */\nimport { Clock, Duration, Effect, Function, Schedule } from \"effect\";\n\nimport { type BrowserError, InvalidRequest, undispatched } from \"../../BrowserError.ts\";\nimport { type Box, type Subject } from \"../../BrowserEvent.ts\";\nimport type { Page, Point, Target } from \"../../Page.ts\";\nimport * as Snapshot from \"../../Snapshot.ts\";\nimport { type Ambiguous, choose, Drifted, type Missing } from \"./choose.ts\";\n\nconst invalid = (detail: string) => undispatched(\"replay\", new InvalidRequest({ detail }));\n\n/**\n * The one element on the page that a subject names, by role, name and context (see `Walk`),\n * looking again for two seconds while the page may still be drawing it.\n */\nexport const locate: {\n (\n subject: Subject,\n ): (page: Page) => Effect.Effect<Snapshot.Found, Missing | Ambiguous | Drifted | BrowserError>;\n (\n page: Page,\n subject: Subject,\n ): Effect.Effect<Snapshot.Found, Missing | Ambiguous | Drifted | BrowserError>;\n} = Function.dual(2, (page: Page, subject: Subject) =>\n Snapshot.find(page, {\n name: subject.name,\n scope: \"document\",\n ...(subject.role === null ? {} : { role: subject.role }),\n }).pipe(\n Effect.flatMap((found) => choose(subject, found)),\n Effect.retry({\n schedule: Schedule.spaced(Duration.millis(250)),\n times: 8,\n while: (error) => error._tag !== \"BrowserError\",\n }),\n Effect.provideService(Clock.Clock, page.hostClock),\n Effect.withSpan(\"Walk.locate\", { attributes: { role: subject.role ?? \"\" } }),\n ),\n);\n\n/**\n * Where the step acts: the element its subject names, or, for a step recorded at a point, the same\n * place within that element, as long as a press there reaches that element and not one over it.\n * An element out of view is first brought into it, by hovering it, as a press by ref would be.\n */\nexport const aim = (page: Page, subject: Subject | undefined, point?: Point, recorded?: Box) => {\n if (subject === undefined) return Effect.fail(invalid(\"the step names no element\"));\n if (point === undefined) return Effect.map(locate(page, subject), ({ ref }): Target => ref);\n\n const reach = ({ ref, box }: Snapshot.Found) => {\n const at =\n recorded === undefined || recorded.width <= 0 || recorded.height <= 0\n ? point\n : {\n x: box.x + ((point.x - recorded.x) / recorded.width) * box.width,\n y: box.y + ((point.y - recorded.y) / recorded.height) * box.height,\n };\n\n return Effect.map(Snapshot.find(page, { at }), ([reached]) =>\n reached?.ref === ref ? at : undefined,\n );\n };\n\n const missed = new Drifted({ detail: \"a press at the subject's point reaches another element\" });\n\n return locate(page, subject).pipe(\n Effect.flatMap((found) =>\n Effect.flatMap(reach(found), (at) =>\n at !== undefined\n ? Effect.succeed<Target>(at)\n : page.hover(found.ref).pipe(\n Effect.andThen(locate(page, subject)),\n Effect.flatMap(reach),\n Effect.flatMap((again) =>\n again === undefined ? Effect.fail(missed) : Effect.succeed<Target>(again),\n ),\n ),\n ),\n ),\n );\n};\n","/** Replay and restore with durable read-back before repeating uncertain consequential input. */\nimport { Clock, Duration, Effect, Exit, Function, Option, Schedule, Schema } from \"effect\";\n\nimport { type Action } from \"../../Action.ts\";\nimport { type BrowserError, InvalidRequest, undispatched } from \"../../BrowserError.ts\";\nimport { isPage, type Page, type ReadyOptions, type Target } from \"../../Page.ts\";\nimport * as Snapshot from \"../../Snapshot.ts\";\nimport * as Stillness from \"../../timeline/Stillness.ts\";\nimport { type Ambiguous, Drifted, type Missing } from \"./choose.ts\";\nimport { type Walk, Step, Receipt, Stopped, Uncertain, ReplayError } from \"./data.ts\";\nimport { aim, locate } from \"./targets.ts\";\n\nconst invalid = (detail: string) => undispatched(\"replay\", new InvalidRequest({ detail }));\n\nconst dispatch = (\n page: Page,\n step: Step,\n text: string,\n before: Effect.Effect<void, BrowserError>,\n): Effect.Effect<void, Missing | Ambiguous | Drifted | BrowserError> => {\n const action = step.action;\n const point = (target: Target) => (typeof target === \"object\" ? target : undefined);\n\n const resolved: Effect.Effect<Action, Missing | Ambiguous | Drifted | BrowserError> = Effect.gen(\n function* () {\n switch (action._tag) {\n case \"Goto\":\n return { ...action, url: step.input === undefined ? action.url : text };\n case \"Back\":\n case \"Reload\":\n return action;\n case \"Press\":\n return {\n ...action,\n options: {\n ...action.options,\n on: step.subject === undefined ? undefined : (yield* locate(page, step.subject)).ref,\n },\n };\n case \"Click\":\n case \"Hover\":\n return {\n ...action,\n target: yield* aim(page, step.subject, point(action.target), step.box),\n };\n case \"Drag\":\n return {\n ...action,\n from: yield* aim(page, step.subject, point(action.from)),\n to: yield* aim(page, step.to, point(action.to)),\n };\n case \"Select\":\n return {\n ...action,\n ref: (yield* locate(\n page,\n step.subject ?? (yield* invalid(\"a selection needs a subject\")),\n )).ref,\n };\n case \"Scroll\":\n return step.subject === undefined\n ? action\n : {\n ...action,\n options: {\n ...action.options,\n at: yield* aim(\n page,\n step.subject,\n action.options?.at === undefined ? undefined : point(action.options.at),\n step.box,\n ),\n },\n };\n case \"Type\":\n return {\n ...action,\n text: step.input === undefined ? action.text : text,\n options: {\n ...action.options,\n into:\n step.subject === undefined ? undefined : (yield* locate(page, step.subject)).ref,\n },\n };\n }\n },\n );\n\n return resolved.pipe(\n Effect.tap(() => before),\n Effect.flatMap(page.perform),\n Effect.asVoid,\n );\n};\n\nexport interface StepOptions {\n /** How each step waits first, except an opening navigation, or false. No final-step wait. */\n readonly settle?: ReadyOptions | false | undefined;\n readonly inputs?: Readonly<Record<string, string>> | undefined;\n /**\n * Bound for recorded arrival and expected effect, each. Defaults to 5 seconds. Zero makes one\n * read without polling; that read retains the page operation's timeout.\n */\n readonly arrival?: Duration.Input | undefined;\n}\n\nexport interface ReplayOptions extends StepOptions {\n readonly from?: number | Stopped | undefined;\n}\n\n/**\n * Input that can be repeated without repeating a commitment. `step` also validates a Checked\n * target's boolean state before input. Back/reload can resubmit a form.\n */\nexport const repeatable = (step: Step): boolean =>\n [\"Goto\", \"Hover\", \"Scroll\", \"Select\"].includes(step.action._tag) ||\n (step.action._tag === \"Type\" &&\n step.subject !== undefined &&\n step.action.options?.replace !== false &&\n step.action.options?.submit !== true) ||\n (step.action._tag === \"Click\" && step.expect?._tag === \"Checked\");\n\ntype StepError = Missing | Ambiguous | Drifted | BrowserError | Uncertain;\n\n// Zero waits make one read; positive waits bound all reads and never repeat input.\nconst within = (check: Effect.Effect<boolean, StepError>, millis: number) =>\n millis === 0\n ? check\n : check.pipe(\n Effect.repeat({ until: (held) => held, schedule: Schedule.spaced(Duration.millis(25)) }),\n Effect.timeoutOrElse({\n duration: Duration.millis(millis),\n orElse: () => Effect.succeed(false),\n }),\n );\n\nconst sameSite = (url: string, recorded: string) => {\n const origin = URL.parse(recorded)?.origin;\n\n return (\n recorded === \"\" ||\n (origin === undefined || origin === \"null\"\n ? url === recorded\n : URL.parse(url)?.origin === origin)\n );\n};\n\nconst arrived = (page: Page, urls: ReadonlyArray<string>, millis: number) =>\n within(\n Effect.map(page.url, (url) => urls.some((recorded) => sameSite(url, recorded))),\n millis,\n ).pipe(\n Effect.filterOrFail(\n (held) => held,\n () =>\n new Drifted({ detail: \"the page did not reach the recorded site within the arrival wait\" }),\n ),\n Effect.asVoid,\n );\n\nconst checkEffect = (\n page: Page,\n step: Step,\n first?: { readonly url: string; readonly document: number; readonly connection: string },\n millis = 0,\n) => {\n const expected = step.expect;\n\n if (expected === undefined) return Effect.succeed(false);\n switch (expected._tag) {\n case \"Checked\":\n return step.subject === undefined\n ? Effect.fail(invalid(\"a checked effect needs a subject\"))\n : Effect.flatMap(locate(page, step.subject), (found) =>\n found.state.checked === undefined\n ? Effect.fail(invalid(\"a checked effect needs a checkable subject\"))\n : Effect.succeed(found.state.checked === expected.checked),\n );\n case \"Navigated\":\n if (expected.url === undefined && first === undefined) return Effect.succeed(false);\n\n return Effect.map(page.state, (now) =>\n expected.url === undefined\n ? now.url !== first?.url ||\n (now.connection === first?.connection && now.document !== first?.document)\n : now.url === expected.url,\n );\n case \"Appeared\":\n case \"Gone\":\n return Effect.map(\n Snapshot.until(\n page,\n { ...expected.query, scope: \"document\" },\n expected._tag === \"Appeared\" ? \"some\" : \"none\",\n millis,\n ),\n ({ met }) => met,\n );\n }\n};\n\nconst stepOn = Effect.fn(\"Walk.step\")(function* (\n page: Page,\n plan: Walk,\n at: number | Stopped,\n options: StepOptions = {},\n): Effect.fn.Return<Receipt, ReplayError> {\n const index = typeof at === \"number\" ? at : at.step;\n let input: Stopped[\"input\"] = typeof at === \"number\" ? \"unsent\" : at.input;\n\n const work = Effect.gen(function* (): Effect.fn.Return<Receipt, StepError> {\n const step = plan.steps[index];\n\n if (!Number.isInteger(index) || index < 0 || step === undefined)\n return yield* invalid(\"the step index is outside the plan\");\n if (!Schema.is(Step.fields.action)(step.action))\n return yield* invalid(\"the step action cannot be replayed\");\n const duration = Duration.fromInput(options.arrival ?? Duration.seconds(5));\n\n if (\n Option.isNone(duration) ||\n Duration.isNegative(duration.value) ||\n !Duration.isFinite(duration.value)\n )\n return yield* invalid(\"arrival must be a finite nonnegative duration\");\n const millis = Duration.toMillis(duration.value);\n const first = yield* page.state;\n\n const uncertain = new Uncertain({\n detail: \"the step may have been sent; reconcile its durable effect before continuing\",\n });\n\n const unresolved = input === \"unknown\" && !repeatable(step);\n const expected = step.expect;\n\n const durable =\n expected !== undefined &&\n (expected._tag === \"Appeared\" ||\n (expected._tag === \"Navigated\" && typeof expected.url === \"string\")) &&\n expected.durable === true;\n\n if (\n !durable &&\n (unresolved || (expected !== undefined && \"durable\" in expected && expected.durable === true))\n )\n return yield* uncertain;\n if (\n options.settle !== false &&\n (index > 0 || ![\"Goto\", \"Back\", \"Reload\"].includes(step.action._tag))\n )\n yield* options.settle?.quiet === undefined\n ? page.ready(options.settle)\n : Stillness.wait(page, {\n ...options.settle,\n still: \"content\",\n quiet: options.settle.quiet,\n });\n const before = plan.steps[index - 1]?.url;\n\n if (before !== undefined)\n yield* arrived(page, unresolved ? [before, step.url] : [before], millis);\n const check = checkEffect(page, step);\n\n const read =\n millis === 0\n ? check\n : check.pipe(\n Effect.timeoutOrElse({\n duration: Duration.millis(millis),\n orElse: () =>\n Effect.fail(new Drifted({ detail: \"the expected-effect read timed out\" })),\n }),\n );\n\n const held = yield* read.pipe(Effect.mapError((error) => (unresolved ? uncertain : error)));\n\n const receipt = (outcome: Receipt[\"outcome\"]) =>\n Effect.gen(function* () {\n yield* arrived(page, [step.url], millis);\n const now = yield* page.state;\n\n return new Receipt({ step: index, outcome, startedAt: first.at, at: now.at });\n });\n\n if (held) return yield* receipt(\"skipped\");\n if (unresolved) return yield* uncertain;\n const text = step.input === undefined ? \"\" : options.inputs?.[step.input];\n\n if (text === undefined) return yield* invalid(`no text for the input \"${step.input ?? \"\"}\"`);\n let baseline: Effect.Success<Page[\"state\"]> | undefined;\n\n const beforeDispatch = Effect.tap(page.state, (state) =>\n Effect.sync(() => {\n baseline = state;\n }),\n ).pipe(Effect.asVoid);\n\n const verify = Effect.suspend(() => within(checkEffect(page, step, baseline, millis), millis));\n\n const acted = yield* Effect.exit(dispatch(page, step, text, beforeDispatch));\n\n if (Exit.isFailure(acted)) {\n const error = Exit.findErrorOption(acted);\n\n if (Option.isSome(error) && error.value._tag === \"BrowserError\" && error.value.dispatched) {\n input = \"unknown\";\n if (expected !== undefined && (repeatable(step) || durable)) {\n const observed = yield* Effect.exit(verify);\n\n if (Exit.isSuccess(observed) && observed.value) return yield* receipt(\"verified\");\n }\n }\n\n return yield* Effect.failCause(acted.cause);\n }\n input = \"unknown\";\n if (expected !== undefined && !(yield* verify))\n return yield* new Drifted({ detail: \"the step's expected effect did not arrive\" });\n\n return yield* receipt(expected === undefined ? \"taken\" : \"verified\");\n });\n\n return yield* work.pipe(\n Effect.provideService(Clock.Clock, page.hostClock),\n Effect.mapError(\n (reason) =>\n new ReplayError({\n step: index,\n reason,\n input,\n receipts: [],\n }),\n ),\n );\n});\n\nconst run = Effect.fnUntraced(function* (\n page: Page,\n plan: Walk,\n options: StepOptions,\n from: number | Stopped,\n until: number,\n restoring: boolean,\n) {\n const receipts: Array<Receipt> = [];\n const start = typeof from === \"number\" ? from : from.step;\n\n if (\n !Number.isInteger(start) ||\n start < 0 ||\n start > plan.steps.length ||\n !Number.isInteger(until) ||\n until < start ||\n until > plan.steps.length\n )\n return yield* new ReplayError({\n step: start,\n input: \"unsent\",\n receipts,\n reason: invalid(\"the run bounds are outside the plan\"),\n });\n // Fresh runs still ask for all input slots before changing the page. Restoration checks first.\n if (!restoring && typeof from === \"number\") {\n const unfilled = plan.steps.findIndex(\n (step, index) =>\n index >= start && step.input !== undefined && options.inputs?.[step.input] === undefined,\n );\n\n if (unfilled !== -1)\n return yield* new ReplayError({\n step: start,\n input: \"unsent\",\n receipts,\n reason: invalid(`no text for the input \"${plan.steps[unfilled]?.input ?? \"\"}\"`),\n });\n }\n for (let index = start; index < until; index++) {\n const at = restoring\n ? new Stopped({ step: index, input: \"unknown\" })\n : index === start\n ? from\n : index;\n\n const receipt = yield* stepOn(page, plan, at, options).pipe(\n Effect.mapError((error) => new ReplayError({ ...error, receipts: [...receipts] })),\n );\n\n receipts.push(receipt);\n }\n\n return receipts;\n});\n\n/**\n * Take one step. Unknown non-repeatable input is never resent: only positive durable read-back\n * can skip it. An interrupted call remains interrupted; persist begun-before-call in the consumer\n * and treat a missing receipt as Stopped{input: \"unknown\"}, including after process restart.\n */\nexport const step: {\n (\n plan: Walk,\n at: number | Stopped,\n options?: StepOptions,\n ): (page: Page) => Effect.Effect<Receipt, ReplayError>;\n (\n page: Page,\n plan: Walk,\n at: number | Stopped,\n options?: StepOptions,\n ): Effect.Effect<Receipt, ReplayError>;\n} = Function.dual((args) => isPage(args[0]), stepOn);\n\n/** Take a plan's steps from a fresh index or durable stopping point, returning completed receipts. */\nexport const replay: {\n (\n plan: Walk,\n options?: ReplayOptions,\n ): (page: Page) => Effect.Effect<ReadonlyArray<Receipt>, ReplayError>;\n (\n page: Page,\n plan: Walk,\n options?: ReplayOptions,\n ): Effect.Effect<ReadonlyArray<Receipt>, ReplayError>;\n} = Function.dual(\n (args) => isPage(args[0]),\n (page: Page, plan: Walk, options: ReplayOptions = {}) =>\n run(page, plan, options, options.from ?? 0, plan.steps.length, false).pipe(\n Effect.withSpan(\"Walk.replay\"),\n ),\n);\n\n/** What `restore` takes: how each step waits, its inputs, and how many steps it restores. */\nexport interface RestoreOptions extends StepOptions {\n readonly upTo?: number | undefined;\n}\n\n/** Restore prior steps on a fresh page; unresolved commitments require positive durable evidence. */\nexport const restore: {\n (\n plan: Walk,\n options?: RestoreOptions,\n ): (page: Page) => Effect.Effect<ReadonlyArray<Receipt>, ReplayError>;\n (\n page: Page,\n plan: Walk,\n options?: RestoreOptions,\n ): Effect.Effect<ReadonlyArray<Receipt>, ReplayError>;\n} = Function.dual(\n (args) => isPage(args[0]),\n (page: Page, plan: Walk, options: RestoreOptions = {}) =>\n run(page, plan, options, 0, options.upTo ?? plan.steps.length, true).pipe(\n Effect.withSpan(\"Walk.restore\"),\n ),\n);\n","/**\n * A walk recorded once from a page's events and replayed later, on a fresh page, with no model\n * call.\n *\n * `fromEvents` keeps one page's completed actions with their subjects and the options they were\n * given, its navigations with both the address asked for and the one reached, and what was typed\n * as a named input slot, never the text itself. A navigation to an address whose credentials the\n * events withheld is an input slot too, so replay goes where the caller says, or nowhere, and\n * never to the address without them. `replay` takes the steps in turn. Before a step\n * except an opening navigate, back or reload, it waits for `Page.ready`; then it finds the element its\n * subject names, by role and name among those that repeat all its recorded context, and acts on\n * it. Text typed into focus was typed into the focused field, which replay finds the same way, and\n * text typed into a secret field goes into nothing else. An element step never falls back to\n * coordinates, and a step recorded at a point acts there only while the element found for it still\n * covers that point. `step` and `replay` return receipts; failure preserves a stopping point and\n * earlier receipts. Unknown consequential input is never resent. Only a positive durable read-back\n * can reconcile it; restoration follows the same rule. The consumer journals begun steps before\n * calling, treating interruption or a missing receipt as unknown. Version 3 carries canonical typed\n * Actions. Prior string-action plans and unknown versions do not decode.\n *\n * @stability stable\n * @since 0.3.0\n */\nexport {\n /**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\n Expected,\n /**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\n Step,\n /**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\n Walk,\n /**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\n Receipt,\n /**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\n Stopped,\n /**\n * @stability stable\n * @category errors\n * @since 0.3.0\n */\n Uncertain,\n /**\n * @stability stable\n * @category errors\n * @since 0.3.0\n */\n ReplayError,\n /**\n * @stability stable\n * @category errors\n * @since 0.3.0\n */\n ReplayErrorReason,\n /**\n * @stability stable\n * @category guards\n * @since 0.3.0\n */\n isReplayError,\n /**\n * @stability stable\n * @category guards\n * @since 0.3.0\n */\n isReplayErrorReason,\n} from \"./internal/data.ts\";\n\n/**\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport { fromEvents } from \"./internal/record.ts\";\n\n/**\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport { locate } from \"./internal/targets.ts\";\n\nexport {\n /**\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\n replay,\n /**\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\n restore,\n /**\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\n step,\n /**\n * @stability stable\n * @category predicates\n * @since 0.3.0\n */\n repeatable,\n /**\n * @stability stable\n * @category options\n * @since 0.3.0\n */\n type StepOptions,\n /**\n * @stability stable\n * @category options\n * @since 0.3.0\n */\n type ReplayOptions,\n /**\n * @stability stable\n * @category options\n * @since 0.3.0\n */\n type RestoreOptions,\n} from \"./internal/execute.ts\";\n\nexport {\n /**\n * @stability stable\n * @category errors\n * @since 0.3.0\n */\n Ambiguous,\n /**\n * @stability stable\n * @category errors\n * @since 0.3.0\n */\n Drifted,\n /**\n * @stability stable\n * @category errors\n * @since 0.3.0\n */\n Missing,\n} from \"./internal/choose.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,UAAb,cAA6B,OAAO,YAAqB,kCAAkC,CAAC,CAC1F,WACA,CAAC,CACH,CAAC,CAAC;CACA,IAAa,UAAU;EACrB,OAAO;CACT;AACF;;AAGA,IAAa,YAAb,cAA+B,OAAO,YAAuB,oCAAoC,CAAC,CAChG,aACA,EACE,OAAO,OAAO,IAChB,CACF,CAAC,CAAC;CACA,IAAa,UAAU;EACrB,OAAO,GAAG,KAAK,MAAM;CACvB;AACF;;AAGA,IAAa,UAAb,cAA6B,OAAO,YAAqB,kCAAkC,CAAC,CAC1F,WACA,EACE,QAAQ,OAAO,OACjB,CACF,CAAC,CAAC;CACA,IAAa,UAAU;EACrB,OAAO,KAAK;CACd;AACF;AAEA,MAAM,EAAE,OAAO,cAAc,MAAM;AACnC,MAAM,SAAS;CAAC;CAAO;CAAU;CAAS;AAAS;AAEnD,MAAM,QAAQ,YACZ,OAAO,OAAO,OAAO,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,QAAQ;;AAGpE,MAAM,WAAW,OAAgC,OAAe,YAA4B;CAC1F,MAAM,MAAM,QAAQ;CAEpB,IAAI,QAAQ,KAAA,KAAa,UAAU,GAAG,MAAM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