effect-browser 0.3.0-beta.23 → 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 (348) hide show
  1. package/README.md +437 -142
  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 +2 -2
  11. package/dist/BrowserEvent.mjs +185 -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 +40 -7
  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/InputStyle.d.mts +153 -0
  23. package/dist/InputStyle.mjs +2 -0
  24. package/dist/Layout.d.mts +2 -0
  25. package/dist/Layout.mjs +123 -0
  26. package/dist/Layout.mjs.map +1 -0
  27. package/dist/Overlay.d.mts +2 -0
  28. package/dist/Overlay.mjs +58 -0
  29. package/dist/Overlay.mjs.map +1 -0
  30. package/dist/Page.d.mts +2 -2
  31. package/dist/Page.mjs +2 -2
  32. package/dist/PageTime.d.mts +2 -0
  33. package/dist/PageTime.mjs +17 -0
  34. package/dist/PageTime.mjs.map +1 -0
  35. package/dist/Pose.d.mts +2 -0
  36. package/dist/Pose.mjs +65 -0
  37. package/dist/Pose.mjs.map +1 -0
  38. package/dist/Site.d.mts +984 -0
  39. package/dist/Site.mjs +110 -0
  40. package/dist/Site.mjs.map +1 -0
  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 -15
  66. package/dist/index.mjs +9 -8
  67. package/dist/{Action-24sLOubi.d.mts → internal/Action-CkanNTUw.d.mts} +64 -4
  68. package/dist/{Browser-wZhwZSlG.d.mts → internal/Browser-DD9Vm1c-.d.mts} +80 -10
  69. package/dist/{Browser-BKPAbyys.mjs → internal/Browser-vzD7i2oj.mjs} +658 -495
  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-lLqJ3GJS.d.mts → internal/BrowserEvent-tGPYYf6R.d.mts} +197 -18
  73. package/dist/internal/BrowserTools-Yi3lOX4h.mjs +497 -0
  74. package/dist/internal/BrowserTools-Yi3lOX4h.mjs.map +1 -0
  75. package/dist/{Style-AO4V7Czt.mjs → internal/InputStyle-CPzxoN4g.mjs} +94 -16
  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} +54 -21
  80. package/dist/internal/Page-BfGxn7oN.d.mts +1553 -0
  81. package/dist/{Page-BF5izr8R.mjs → internal/Page-DqF-tuTx.mjs} +62 -72
  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-2KHI4_KN.d.mts → internal/connection-BaB0vp1o.d.mts} +6 -6
  106. package/dist/{connection-CK83pvqP.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-CyVZQHZL.d.mts +49 -0
  111. package/dist/internal/fold.inpage-uhrT-dOB.mjs +49 -0
  112. package/dist/internal/fold.inpage-uhrT-dOB.mjs.map +1 -0
  113. package/dist/internal/functions-jBOs6GKv.mjs +27 -0
  114. package/dist/internal/functions-jBOs6GKv.mjs.map +1 -0
  115. package/dist/{Geometry-DJx9qrYy.d.mts → internal/geometry-Dhj_ztJs.d.mts} +3 -3
  116. package/dist/{Geometry.mjs → internal/geometry-Lxyflb9J.mjs} +3 -12
  117. package/dist/internal/geometry-Lxyflb9J.mjs.map +1 -0
  118. package/dist/{Matching.mjs → internal/matching-Cs-UeOY0.mjs} +24 -19
  119. package/dist/internal/matching-Cs-UeOY0.mjs.map +1 -0
  120. package/dist/internal/page-DFQb-YOK.mjs +436 -0
  121. package/dist/internal/page-DFQb-YOK.mjs.map +1 -0
  122. package/dist/internal/pose.inpage-CBFeWcVa.mjs +1996 -0
  123. package/dist/internal/pose.inpage-CBFeWcVa.mjs.map +1 -0
  124. package/dist/{Url.mjs → internal/url-DB0pQYk6.mjs} +3 -12
  125. package/dist/internal/url-DB0pQYk6.mjs.map +1 -0
  126. package/dist/policy/Policy.d.mts +60 -6
  127. package/dist/policy/Policy.mjs +52 -9
  128. package/dist/policy/Policy.mjs.map +1 -1
  129. package/dist/policy/index.d.mts +2 -0
  130. package/dist/policy/index.mjs +2 -0
  131. package/dist/presentation/Film.d.mts +332 -0
  132. package/dist/presentation/Film.mjs +298 -0
  133. package/dist/presentation/Film.mjs.map +1 -0
  134. package/dist/presentation/Motion.d.mts +5 -1
  135. package/dist/presentation/Motion.mjs +16 -2
  136. package/dist/presentation/Motion.mjs.map +1 -1
  137. package/dist/presentation/Presentation.d.mts +48 -6
  138. package/dist/presentation/Presentation.mjs +28 -9
  139. package/dist/presentation/Presentation.mjs.map +1 -1
  140. package/dist/presentation/Stage.d.mts +40 -6
  141. package/dist/presentation/Stage.mjs +1 -262
  142. package/dist/presentation/index.d.mts +5 -0
  143. package/dist/presentation/index.mjs +5 -0
  144. package/dist/supervisor/Release.d.mts +2 -0
  145. package/dist/supervisor/Release.mjs +40 -0
  146. package/dist/supervisor/Release.mjs.map +1 -0
  147. package/dist/supervisor/Supervisor.d.mts +2 -104
  148. package/dist/supervisor/Supervisor.mjs +2 -515
  149. package/dist/supervisor/index.d.mts +3 -0
  150. package/dist/supervisor/index.mjs +3 -0
  151. package/dist/testing/HttpCassette.d.mts +98 -0
  152. package/dist/testing/HttpCassette.mjs +146 -0
  153. package/dist/testing/HttpCassette.mjs.map +1 -0
  154. package/dist/testing/Story.d.mts +31 -0
  155. package/dist/testing/Story.mjs +76 -0
  156. package/dist/testing/Story.mjs.map +1 -0
  157. package/dist/testing/TestBrowser.d.mts +191 -0
  158. package/dist/testing/TestBrowser.mjs +105 -0
  159. package/dist/testing/TestBrowser.mjs.map +1 -0
  160. package/dist/testing/TestModel.d.mts +133 -0
  161. package/dist/testing/TestModel.mjs +209 -0
  162. package/dist/testing/TestModel.mjs.map +1 -0
  163. package/dist/testing/TestPage.d.mts +2 -0
  164. package/dist/testing/TestPage.mjs +47 -0
  165. package/dist/testing/TestPage.mjs.map +1 -0
  166. package/dist/testing/index.d.mts +6 -337
  167. package/dist/testing/index.mjs +6 -515
  168. package/dist/timeline/Moment.d.mts +3 -0
  169. package/dist/timeline/Moment.mjs +3 -0
  170. package/dist/timeline/Stillness.d.mts +34 -0
  171. package/dist/timeline/Stillness.mjs +2 -0
  172. package/dist/timeline/index.d.mts +3 -0
  173. package/dist/timeline/index.mjs +3 -0
  174. package/dist/walk/Walk.d.mts +2 -0
  175. package/dist/walk/Walk.mjs +2 -0
  176. package/dist/walk/index.d.mts +2 -0
  177. package/dist/walk/index.mjs +2 -0
  178. package/package.json +54 -133
  179. package/src/Action.ts +73 -8
  180. package/src/Browser.ts +85 -14
  181. package/src/BrowserError.ts +258 -63
  182. package/src/BrowserEvent.ts +264 -48
  183. package/src/Cdp.ts +42 -0
  184. package/src/Change.ts +75 -4
  185. package/src/Frame.ts +247 -14
  186. package/src/{Style.ts → InputStyle.ts} +130 -18
  187. package/src/Layout.ts +187 -0
  188. package/src/Overlay.ts +76 -0
  189. package/src/Page.ts +144 -275
  190. package/src/PageTime.ts +72 -0
  191. package/src/Pose.ts +81 -0
  192. package/src/Site.ts +136 -0
  193. package/src/Snapshot.ts +179 -3
  194. package/src/Text.ts +60 -0
  195. package/src/Window.ts +53 -3
  196. package/src/ai/BrowserTools.ts +778 -0
  197. package/src/ai/PageControl.ts +702 -0
  198. package/src/ai/PromptCache.ts +87 -0
  199. package/src/ai/Tabs.ts +84 -0
  200. package/src/ai/ToolError.ts +50 -0
  201. package/src/ai/index.ts +36 -0
  202. package/src/ai/internal/crops.ts +38 -0
  203. package/src/ai/internal/points.ts +57 -0
  204. package/src/ai/internal/receipts.ts +107 -0
  205. package/src/index.ts +87 -6
  206. package/src/{ActionPort.ts → internal/action-port.ts} +3 -3
  207. package/src/{providers → internal/cdp}/connection.ts +19 -12
  208. package/src/internal/cdp/workerd.ts +36 -0
  209. package/src/{Clock.ts → internal/clock.ts} +20 -0
  210. package/src/internal/input/actions.ts +1 -1
  211. package/src/internal/input/dispatch.ts +2 -2
  212. package/src/internal/input/guard.inpage.ts +1 -1
  213. package/src/internal/input/guard.ts +1 -1
  214. package/src/internal/input/perform.ts +35 -7
  215. package/src/internal/input/pointer.ts +9 -6
  216. package/src/internal/input/targets.inpage.ts +3 -3
  217. package/src/internal/input/targets.ts +1 -1
  218. package/src/{Matching.ts → internal/matching.ts} +28 -19
  219. package/src/internal/page/bridge.ts +67 -35
  220. package/src/internal/page/clock.inpage.ts +306 -0
  221. package/src/internal/page/compose.inpage.ts +101 -0
  222. package/src/internal/page/context.ts +4 -2
  223. package/src/internal/page/functions.ts +84 -0
  224. package/src/internal/page/navigation.ts +1 -1
  225. package/src/internal/page/openings.ts +2 -2
  226. package/src/internal/page/overlay.inpage.ts +96 -0
  227. package/src/internal/page/overlay.ts +89 -0
  228. package/src/internal/page/page.ts +39 -29
  229. package/src/internal/page/port.ts +14 -8
  230. package/src/internal/page/pose.inpage.ts +200 -0
  231. package/src/internal/page/pose.ts +80 -0
  232. package/src/internal/page/replies.ts +1 -1
  233. package/src/internal/page/requests.ts +1 -1
  234. package/src/internal/page/scripts.ts +1 -1
  235. package/src/internal/page/time.inpage.ts +49 -0
  236. package/src/internal/page/time.ts +122 -0
  237. package/src/internal/page/viewport.ts +3 -2
  238. package/src/internal/pictures/capture.ts +1 -4
  239. package/src/internal/pictures/dimensions.ts +1 -1
  240. package/src/internal/pictures/frame.ts +1 -1
  241. package/src/internal/pictures/pictures.ts +144 -91
  242. package/src/internal/reading/context.inpage.ts +2 -2
  243. package/src/internal/reading/expect.inpage.ts +1 -1
  244. package/src/internal/reading/layout.inpage.ts +193 -0
  245. package/src/internal/reading/layout.ts +101 -0
  246. package/src/internal/reading/names.inpage.ts +15 -0
  247. package/src/internal/reading/outline.inpage.ts +5 -21
  248. package/src/internal/reading/reading.ts +33 -21
  249. package/src/internal/reading/ready.inpage.ts +21 -26
  250. package/src/internal/reading/ready.ts +26 -5
  251. package/src/internal/reading/subjects.inpage.ts +3 -3
  252. package/src/internal/reading/text.inpage.ts +3 -16
  253. package/src/internal/reading/walk.inpage.ts +1 -1
  254. package/src/internal/timeline/changes.inpage.ts +7 -15
  255. package/src/internal/timeline/changes.ts +17 -5
  256. package/src/internal/timeline/record.inpage.ts +15 -6
  257. package/src/internal/timeline/sight.inpage.ts +2 -2
  258. package/src/internal/timeline/window.ts +3 -4
  259. package/src/policy/Policy.ts +70 -16
  260. package/src/policy/index.ts +12 -0
  261. package/src/presentation/Film.ts +451 -0
  262. package/src/presentation/Motion.ts +45 -3
  263. package/src/presentation/Presentation.ts +60 -14
  264. package/src/presentation/Stage.ts +73 -35
  265. package/src/presentation/index.ts +30 -0
  266. package/src/presentation/{feed.ts → internal/feed.ts} +1 -1
  267. package/src/supervisor/Release.ts +45 -0
  268. package/src/supervisor/Supervisor.ts +80 -5
  269. package/src/supervisor/index.ts +18 -0
  270. package/src/supervisor/{contract.ts → internal/contract.ts} +14 -10
  271. package/src/supervisor/{lifecycle.ts → internal/lifecycle.ts} +7 -7
  272. package/src/supervisor/{runtime.ts → internal/runtime.ts} +7 -7
  273. package/src/testing/HttpCassette.ts +260 -0
  274. package/src/testing/Story.ts +103 -0
  275. package/src/testing/TestBrowser.ts +14 -4
  276. package/src/testing/TestModel.ts +297 -0
  277. package/src/testing/TestPage.ts +92 -4
  278. package/src/testing/index.ts +35 -1
  279. package/src/testing/{evidence.ts → internal/evidence.ts} +19 -11
  280. package/src/testing/{model.ts → internal/model.ts} +14 -8
  281. package/src/testing/{page.ts → internal/page.ts} +55 -51
  282. package/src/{moment → timeline}/Moment.ts +79 -29
  283. package/src/{stillness → timeline}/Stillness.ts +89 -46
  284. package/src/timeline/index.ts +18 -0
  285. package/src/{stillness/Pixels.ts → timeline/internal/pixels.ts} +27 -1
  286. package/src/{moment → timeline/internal}/words.ts +2 -2
  287. package/src/walk/Walk.ts +165 -0
  288. package/src/walk/index.ts +12 -0
  289. package/src/{plan → walk/internal}/choose.ts +23 -14
  290. package/src/{plan → walk/internal}/data.ts +37 -14
  291. package/src/{plan → walk/internal}/execute.ts +79 -36
  292. package/src/{plan → walk/internal}/record.ts +6 -6
  293. package/src/{plan → walk/internal}/targets.ts +35 -25
  294. package/dist/ActionPort.d.mts +0 -15
  295. package/dist/ActionPort.mjs.map +0 -1
  296. package/dist/Browser-BKPAbyys.mjs.map +0 -1
  297. package/dist/Change-Ba7INmay.d.mts +0 -69
  298. package/dist/Clock.d.mts +0 -57
  299. package/dist/Clock.mjs.map +0 -1
  300. package/dist/Frame-UEH2hO5T.d.mts +0 -124
  301. package/dist/Geometry.d.mts +0 -2
  302. package/dist/Geometry.mjs.map +0 -1
  303. package/dist/Matching.d.mts +0 -37
  304. package/dist/Matching.mjs.map +0 -1
  305. package/dist/Page-BF5izr8R.mjs.map +0 -1
  306. package/dist/Page-CvsOEorc.d.mts +0 -566
  307. package/dist/Released-tURbFmal.d.mts +0 -15
  308. package/dist/Snapshot-CtBVOtuu.d.mts +0 -73
  309. package/dist/Stillness-CNlvayIo.mjs +0 -136
  310. package/dist/Stillness-CNlvayIo.mjs.map +0 -1
  311. package/dist/Style-AO4V7Czt.mjs.map +0 -1
  312. package/dist/Style.d.mts +0 -72
  313. package/dist/Style.mjs +0 -2
  314. package/dist/Url.d.mts +0 -26
  315. package/dist/Url.mjs.map +0 -1
  316. package/dist/Window-CMddGMt1.d.mts +0 -34
  317. package/dist/connection-CK83pvqP.mjs.map +0 -1
  318. package/dist/moment/Moment.mjs.map +0 -1
  319. package/dist/plan/index.mjs.map +0 -1
  320. package/dist/presentation/Stage.mjs.map +0 -1
  321. package/dist/presentation/feed.d.mts +0 -20
  322. package/dist/presentation/feed.mjs +0 -18
  323. package/dist/presentation/feed.mjs.map +0 -1
  324. package/dist/providers/Cdp.d.mts +0 -9
  325. package/dist/providers/Cdp.mjs +0 -15
  326. package/dist/providers/Cdp.mjs.map +0 -1
  327. package/dist/providers/Chromium.d.mts +0 -32
  328. package/dist/providers/Chromium.mjs +0 -55
  329. package/dist/providers/Chromium.mjs.map +0 -1
  330. package/dist/providers/Released.d.mts +0 -2
  331. package/dist/providers/Released.mjs +0 -12
  332. package/dist/providers/Released.mjs.map +0 -1
  333. package/dist/stillness/Stillness.d.mts +0 -12
  334. package/dist/stillness/Stillness.mjs +0 -2
  335. package/dist/supervisor/Supervisor.mjs.map +0 -1
  336. package/dist/testing/index.mjs.map +0 -1
  337. package/dist/workerd/Cdp.d.mts +0 -8
  338. package/dist/workerd/Cdp.mjs +0 -13
  339. package/dist/workerd/Cdp.mjs.map +0 -1
  340. package/src/plan/index.ts +0 -36
  341. package/src/providers/Cdp.ts +0 -16
  342. package/src/providers/Chromium.ts +0 -99
  343. package/src/providers/Released.ts +0 -13
  344. package/src/workerd/Cdp.ts +0 -11
  345. /package/dist/{rolldown-runtime-D7D4PA-g.mjs → internal/rolldown-runtime-D7D4PA-g.mjs} +0 -0
  346. /package/src/{Geometry.ts → internal/geometry.ts} +0 -0
  347. /package/src/{Url.ts → internal/url.ts} +0 -0
  348. /package/src/{stillness → timeline/internal}/utilsBundle.d.ts +0 -0
@@ -1,26 +1,41 @@
1
- /** Screen and foreground stillness over the public page capture and owning clock. */
2
- import { Clock, Duration, Effect, Option, Schedule, Stream } from "effect";
3
-
4
- import { Failed, refuse, Timeout, undispatched } from "../BrowserError.ts";
5
- import { monotonicMillis } from "../Clock.ts";
6
- import type { Frame } from "../Frame.ts";
1
+ /**
2
+ * Screen and foreground stillness over the public page capture and owning clock.
3
+ *
4
+ * @stability stable
5
+ * @since 0.3.0
6
+ */
7
+ import { Clock, Duration, Effect, Function, Option, Schedule, Stream } from "effect";
8
+
9
+ import { type BrowserError, Failed, refuse, Timeout, undispatched } from "../BrowserError.ts";
10
+ import type { Box } from "../BrowserEvent.ts";
11
+ import * as Change from "../Change.ts";
12
+ import * as Frame from "../Frame.ts";
13
+ import { millisOf, monotonicMillis } from "../internal/clock.ts";
14
+ import * as Overlay from "../Overlay.ts";
7
15
  import type { Page } from "../Page.ts";
8
- import * as Motion from "./Pixels.ts";
16
+ import * as Motion from "./internal/pixels.ts";
9
17
 
18
+ /**
19
+ * @stability stable
20
+ * @category options
21
+ * @since 0.3.0
22
+ */
10
23
  export interface Options {
11
24
  readonly still?: "screen" | "content" | "foreground" | undefined;
12
- readonly quietMillis: number;
25
+ /** How long the screen, or the content, must stay still. */
26
+ readonly quiet: Duration.Input;
27
+ /** Defaults to 15 seconds. */
13
28
  readonly timeout?: Duration.Input | undefined;
14
29
  }
15
30
 
16
- const observe = (page: Page, options: Options, timeout: Duration.Duration) =>
31
+ const observe = (page: Page, options: Options, quietMillis: number, timeout: Duration.Duration) =>
17
32
  Effect.gen(function* () {
18
- const now = () => monotonicMillis(page.clock);
33
+ const now = () => monotonicMillis(page.hostClock);
19
34
  const deadline = now() + Duration.toMillis(timeout);
20
35
 
21
36
  const settled = () =>
22
37
  page.ready({
23
- quietMillis: options.quietMillis,
38
+ quiet: quietMillis,
24
39
  timeout: Duration.millis(Math.max(0, deadline - now())),
25
40
  });
26
41
 
@@ -29,14 +44,14 @@ const observe = (page: Page, options: Options, timeout: Duration.Duration) =>
29
44
  // even of a still page.
30
45
  const quiet = (millis: number) =>
31
46
  Effect.gen(function* () {
32
- const capture = yield* page.capture();
47
+ const capture = yield* Frame.capture(page);
33
48
 
34
49
  const foreground = options.still === "foreground";
35
50
  let counts = yield* capture.stats();
36
51
  let stirred = now();
37
52
  let reference: Motion.Picture | undefined;
38
53
 
39
- const decoded = (frame: Frame) =>
54
+ const decoded = (frame: Frame.Frame) =>
40
55
  Effect.try({
41
56
  try: () => Motion.picture(frame),
42
57
  catch: (error) =>
@@ -51,7 +66,7 @@ const observe = (page: Page, options: Options, timeout: Duration.Duration) =>
51
66
 
52
67
  const document = (yield* page.state).document;
53
68
 
54
- const before = (foreground ? yield* page.recentFrames : []).filter(
69
+ const before = (foreground ? yield* Frame.recent(page) : []).filter(
55
70
  (frame) =>
56
71
  frame.hostTime < inputAt &&
57
72
  frame.hostTime >= inputAt - 1500 &&
@@ -60,30 +75,50 @@ const observe = (page: Page, options: Options, timeout: Duration.Duration) =>
60
75
 
61
76
  const sampled = before.filter((_, index) => index % Math.ceil(before.length / 8) === 0);
62
77
  const mask = Motion.background(yield* Effect.forEach(sampled, decoded));
78
+ // Where the page's overlay draws is not the page's motion: while it shows, frames are
79
+ // compared, as in the foreground, outside everywhere it has drawn during the wait.
80
+ let width: number | undefined;
81
+ const covered = new Set(mask);
82
+
83
+ const outside = (seen: Motion.Picture, overlay: ReadonlyArray<Box> | undefined) =>
84
+ Effect.gen(function* () {
85
+ if (overlay === undefined) return covered;
86
+ width ??= (yield* page.viewport).width;
87
+ for (const block of Motion.covering(overlay, seen.width / width, seen))
88
+ covered.add(block);
89
+
90
+ return covered;
91
+ });
63
92
 
64
93
  // How long the screen has been still: since a frame, or an unanswered acknowledgement. In
65
94
  // the foreground, since a frame moved outside the background, or acknowledgements went
66
95
  // unanswered with no frame coming.
67
96
  const look = Effect.gen(function* () {
68
97
  const stats = yield* capture.stats();
69
- const latest = (yield* page.state).frame;
98
+ const overlay = Option.getOrUndefined(yield* Overlay.drawn(page));
99
+ const recent = yield* Frame.recent(page);
100
+ const latest = recent.at(-1);
101
+ const comparing = foreground || overlay !== undefined;
70
102
  const arrived = stats.received !== counts.received;
71
103
  const unseen = stats.accepted - counts.accepted;
72
104
 
73
105
  counts = stats;
74
106
  if (latest === undefined || !capture.isCurrent(latest)) stirred = now();
75
- else if (!foreground ? arrived || stats.ackBacklog > 0 : !arrived && stats.ackBacklog > 0)
107
+ else if (!comparing ? arrived || stats.ackBacklog > 0 : !arrived && stats.ackBacklog > 0)
76
108
  stirred = now();
77
- else if (foreground && (unseen > 0 || reference === undefined)) {
109
+ else if (comparing && (unseen > 0 || reference === undefined)) {
78
110
  // A move and its return between looks both count. Bound decoding; any frames lost
79
111
  // from history, or beyond this batch, deny a quiet spell rather than hiding motion.
80
- const frames = (yield* page.recentFrames).slice(-Math.max(1, Math.min(8, unseen)));
112
+ const frames = recent.slice(-Math.max(1, Math.min(8, unseen)));
81
113
 
82
114
  if (unseen > frames.length) stirred = now();
83
115
  for (const frame of frames) {
84
116
  const seen = yield* decoded(frame);
85
117
 
86
- if (reference === undefined || Motion.stirs(reference, seen, mask)) {
118
+ if (
119
+ reference === undefined ||
120
+ Motion.stirs(reference, seen, yield* outside(seen, overlay))
121
+ ) {
87
122
  reference = seen;
88
123
  stirred = now();
89
124
  }
@@ -105,7 +140,13 @@ const observe = (page: Page, options: Options, timeout: Duration.Duration) =>
105
140
  const before = counts.received;
106
141
 
107
142
  yield* Effect.all([settled(), capture.sync], { concurrency: 2, discard: true });
108
- if ((yield* look) >= millis && (foreground || counts.received === before)) return;
143
+ if (
144
+ (yield* look) >= millis &&
145
+ (foreground ||
146
+ Option.isSome(yield* Overlay.drawn(page)) ||
147
+ counts.received === before)
148
+ )
149
+ return;
109
150
  }
110
151
  });
111
152
 
@@ -117,40 +158,28 @@ const observe = (page: Page, options: Options, timeout: Duration.Duration) =>
117
158
 
118
159
  yield* page.afterInput(Effect.void);
119
160
  if (options.still === "content") {
120
- yield* page.changes();
121
- yield* Effect.sleep(Duration.millis(options.quietMillis));
161
+ yield* Change.read(page);
162
+ yield* Effect.sleep(Duration.millis(quietMillis));
122
163
 
123
164
  return yield* settled();
124
165
  }
125
166
  yield* settled();
126
- yield* quiet(options.quietMillis);
167
+ yield* quiet(quietMillis);
127
168
  });
128
169
 
129
- export const wait = (page: Page, options: Options) =>
170
+ const waitStill = (page: Page, options: Options) =>
130
171
  Effect.gen(function* () {
131
- if (!Number.isFinite(options.quietMillis) || options.quietMillis < 0)
132
- return yield* refuse("stillness", "quietMillis must be finite and nonnegative");
133
- const input = options.timeout ?? Duration.seconds(15);
134
-
135
- const components =
136
- typeof input === "number"
137
- ? [input]
138
- : typeof input === "object" && !Duration.isDuration(input)
139
- ? Object.values(input)
140
- : [];
141
-
142
- const timeout = Duration.fromInput(input);
143
-
144
- if (
145
- components.some((value) => typeof value === "number" && !Number.isFinite(value)) ||
146
- Option.isNone(timeout) ||
147
- !Duration.isFinite(timeout.value) ||
148
- Duration.isNegative(timeout.value)
149
- )
172
+ const quietMillis = millisOf(options.quiet);
173
+
174
+ if (!Number.isFinite(quietMillis) || quietMillis < 0)
175
+ return yield* refuse("stillness", "quiet must be a finite nonnegative duration");
176
+ const timeoutMillis = millisOf(options.timeout ?? Duration.seconds(15));
177
+
178
+ if (!Number.isFinite(timeoutMillis) || timeoutMillis < 0)
150
179
  return yield* refuse("stillness", "timeout must be a finite nonnegative duration");
151
- const duration = timeout.value;
180
+ const duration = Duration.millis(timeoutMillis);
152
181
 
153
- return yield* observe(page, options, duration).pipe(
182
+ return yield* observe(page, options, quietMillis, duration).pipe(
154
183
  Effect.timeoutOrElse({
155
184
  duration,
156
185
  orElse: () =>
@@ -161,6 +190,20 @@ export const wait = (page: Page, options: Options) =>
161
190
  );
162
191
  }).pipe(
163
192
  Effect.scoped,
164
- Effect.provideService(Clock.Clock, page.clock),
193
+ Effect.provideService(Clock.Clock, page.hostClock),
165
194
  Effect.withSpan("Stillness.wait"),
166
195
  );
196
+
197
+ /**
198
+ * Wait for a ready page to stay still for `quiet`: its screen, by default, with no screencast frame
199
+ * coming; its `"foreground"`, allowing motion it showed before its latest input; or its
200
+ * `"content"`, with no visible change recorded. Fails `Timeout` after `timeout`.
201
+ *
202
+ * @stability stable
203
+ * @category combinators
204
+ * @since 0.3.0
205
+ */
206
+ export const wait: {
207
+ (options: Options): (page: Page) => Effect.Effect<void, BrowserError>;
208
+ (page: Page, options: Options): Effect.Effect<void, BrowserError>;
209
+ } = Function.dual(2, waitStill);
@@ -0,0 +1,18 @@
1
+ /**
2
+ * A page's timeline: what it showed and what changed on it (`Moment`), and when it is still (`Stillness`).
3
+ *
4
+ * @stability stable
5
+ * @since 0.3.0
6
+ */
7
+
8
+ /**
9
+ * @stability stable
10
+ * @since 0.3.0
11
+ */
12
+ export * as Moment from "./Moment.ts";
13
+
14
+ /**
15
+ * @stability stable
16
+ * @since 0.3.0
17
+ */
18
+ export * as Stillness from "./Stillness.ts";
@@ -13,7 +13,8 @@
13
13
  /// <reference path="./utilsBundle.d.ts" />
14
14
  import { jpegjs } from "playwright-core/lib/utilsBundle";
15
15
 
16
- import type { Frame } from "../Frame.ts";
16
+ import type { Box } from "../../BrowserEvent.ts";
17
+ import type { Frame } from "../../Frame.ts";
17
18
 
18
19
  /** A decoded frame: RGBA, `width` pixels a row. */
19
20
  export type Picture = ReturnType<typeof jpegjs.decode>;
@@ -60,6 +61,31 @@ export const background = (pictures: ReadonlyArray<Picture>): ReadonlySet<number
60
61
  );
61
62
  };
62
63
 
64
+ /**
65
+ * The blocks a picture's boxes cover, and those around them, for boxes in CSS pixels and `scale`
66
+ * picture pixels to a CSS pixel: where an overlay draws, which is not the page's motion.
67
+ */
68
+ export const covering = (boxes: ReadonlyArray<Box>, scale: number, picture: Picture) => {
69
+ const columns = Math.ceil(picture.width / 16);
70
+ const rows = Math.ceil(picture.height / 16);
71
+ const blocks = new Set<number>();
72
+
73
+ const block = (at: number, count: number) =>
74
+ Math.min(count - 1, Math.max(0, Math.floor(at / 16)));
75
+
76
+ for (const { x, y, width, height } of boxes)
77
+ for (let row = block(y * scale, rows) - 1; row <= block((y + height) * scale, rows) + 1; row++)
78
+ for (
79
+ let column = block(x * scale, columns) - 1;
80
+ column <= block((x + width) * scale, columns) + 1;
81
+ column++
82
+ )
83
+ if (row >= 0 && row < rows && column >= 0 && column < columns)
84
+ blocks.add(row * columns + column);
85
+
86
+ return blocks;
87
+ };
88
+
63
89
  /** Whether anything moved from one picture to another outside the background. */
64
90
  export const stirs = (from: Picture, to: Picture, mask: ReadonlySet<number>) =>
65
91
  moved(from, to).some((block) => !mask.has(block));
@@ -2,8 +2,8 @@
2
2
  * What changed on a page, in words for a model: a change with where it is, and what it is. A moment
3
3
  * tells its changes this way, and a tool's receipt the changes its action caused.
4
4
  */
5
- import type { Subject, SubjectContext } from "../BrowserEvent.ts";
6
- import type { Change } from "../Change.ts";
5
+ import type { Subject, SubjectContext } from "../../BrowserEvent.ts";
6
+ import type { Change } from "../../Change.ts";
7
7
 
8
8
  export const quoted = (value: string | undefined) => JSON.stringify(value ?? "");
9
9
 
@@ -0,0 +1,165 @@
1
+ /**
2
+ * A walk recorded once from a page's events and replayed later, on a fresh page, with no model
3
+ * call.
4
+ *
5
+ * `fromEvents` keeps one page's completed actions with their subjects and the options they were
6
+ * given, its navigations with both the address asked for and the one reached, and what was typed
7
+ * as a named input slot, never the text itself. A navigation to an address whose credentials the
8
+ * events withheld is an input slot too, so replay goes where the caller says, or nowhere, and
9
+ * never to the address without them. `replay` takes the steps in turn. Before a step
10
+ * except an opening navigate, back or reload, it waits for `Page.ready`; then it finds the element its
11
+ * subject names, by role and name among those that repeat all its recorded context, and acts on
12
+ * it. Text typed into focus was typed into the focused field, which replay finds the same way, and
13
+ * text typed into a secret field goes into nothing else. An element step never falls back to
14
+ * coordinates, and a step recorded at a point acts there only while the element found for it still
15
+ * covers that point. `step` and `replay` return receipts; failure preserves a stopping point and
16
+ * earlier receipts. Unknown consequential input is never resent. Only a positive durable read-back
17
+ * can reconcile it; restoration follows the same rule. The consumer journals begun steps before
18
+ * calling, treating interruption or a missing receipt as unknown. Version 3 carries canonical typed
19
+ * Actions. Prior string-action plans and unknown versions do not decode.
20
+ *
21
+ * @stability stable
22
+ * @since 0.3.0
23
+ */
24
+ export {
25
+ /**
26
+ * @stability stable
27
+ * @category schemas
28
+ * @since 0.3.0
29
+ */
30
+ Expected,
31
+ /**
32
+ * @stability stable
33
+ * @category schemas
34
+ * @since 0.3.0
35
+ */
36
+ Step,
37
+ /**
38
+ * @stability stable
39
+ * @category schemas
40
+ * @since 0.3.0
41
+ */
42
+ Walk,
43
+ /**
44
+ * @stability stable
45
+ * @category schemas
46
+ * @since 0.3.0
47
+ */
48
+ Receipt,
49
+ /**
50
+ * @stability stable
51
+ * @category schemas
52
+ * @since 0.3.0
53
+ */
54
+ Stopped,
55
+ /**
56
+ * @stability stable
57
+ * @category errors
58
+ * @since 0.3.0
59
+ */
60
+ Uncertain,
61
+ /**
62
+ * @stability stable
63
+ * @category errors
64
+ * @since 0.3.0
65
+ */
66
+ ReplayError,
67
+ /**
68
+ * @stability stable
69
+ * @category errors
70
+ * @since 0.3.0
71
+ */
72
+ ReplayErrorReason,
73
+ /**
74
+ * @stability stable
75
+ * @category guards
76
+ * @since 0.3.0
77
+ */
78
+ isReplayError,
79
+ /**
80
+ * @stability stable
81
+ * @category guards
82
+ * @since 0.3.0
83
+ */
84
+ isReplayErrorReason,
85
+ } from "./internal/data.ts";
86
+
87
+ /**
88
+ * @stability stable
89
+ * @category constructors
90
+ * @since 0.3.0
91
+ */
92
+ export { fromEvents } from "./internal/record.ts";
93
+
94
+ /**
95
+ * @stability stable
96
+ * @category combinators
97
+ * @since 0.3.0
98
+ */
99
+ export { locate } from "./internal/targets.ts";
100
+
101
+ export {
102
+ /**
103
+ * @stability stable
104
+ * @category combinators
105
+ * @since 0.3.0
106
+ */
107
+ replay,
108
+ /**
109
+ * @stability stable
110
+ * @category combinators
111
+ * @since 0.3.0
112
+ */
113
+ restore,
114
+ /**
115
+ * @stability stable
116
+ * @category combinators
117
+ * @since 0.3.0
118
+ */
119
+ step,
120
+ /**
121
+ * @stability stable
122
+ * @category predicates
123
+ * @since 0.3.0
124
+ */
125
+ repeatable,
126
+ /**
127
+ * @stability stable
128
+ * @category options
129
+ * @since 0.3.0
130
+ */
131
+ type StepOptions,
132
+ /**
133
+ * @stability stable
134
+ * @category options
135
+ * @since 0.3.0
136
+ */
137
+ type ReplayOptions,
138
+ /**
139
+ * @stability stable
140
+ * @category options
141
+ * @since 0.3.0
142
+ */
143
+ type RestoreOptions,
144
+ } from "./internal/execute.ts";
145
+
146
+ export {
147
+ /**
148
+ * @stability stable
149
+ * @category errors
150
+ * @since 0.3.0
151
+ */
152
+ Ambiguous,
153
+ /**
154
+ * @stability stable
155
+ * @category errors
156
+ * @since 0.3.0
157
+ */
158
+ Drifted,
159
+ /**
160
+ * @stability stable
161
+ * @category errors
162
+ * @since 0.3.0
163
+ */
164
+ Missing,
165
+ } from "./internal/choose.ts";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A walk recorded once from a page's events and replayed later with no model call.
3
+ *
4
+ * @stability stable
5
+ * @since 0.3.0
6
+ */
7
+
8
+ /**
9
+ * @stability stable
10
+ * @since 0.3.0
11
+ */
12
+ export * as Walk from "./Walk.ts";
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Choosing the one element a recorded subject names, among those `find` gives for its role and
3
- * name. Context tells them apart, and an element that does not repeat every part of the recorded
4
- * context is another subject, so a sole element left once its own has gone, such as Alice's
5
- * "Remove" after Bob has left, drifts rather than stands in:
2
+ * Choosing the one element a recorded subject names, among those `Snapshot.find` gives for its
3
+ * role and name. Context tells them apart, and an element that does not repeat every part of the
4
+ * recorded context is another subject, so a sole element left once its own has gone, such as
5
+ * Alice's "Remove" after Bob has left, drifts rather than stands in:
6
6
  *
7
7
  * - a row is read whole: a row named "Wrapped BTC" is not the row "BTC". Laid out again without
8
8
  * rows, as cards, one of the element's fields must start with the row's words;
@@ -15,30 +15,39 @@
15
15
  */
16
16
  import { Effect, Schema } from "effect";
17
17
 
18
- import type { Subject, SubjectContext } from "../BrowserEvent.ts";
19
- import { match } from "../Matching.ts";
20
- import type { Found } from "../Page.ts";
18
+ import type { Subject, SubjectContext } from "../../BrowserEvent.ts";
19
+ import { match } from "../../internal/matching.ts";
20
+ import type { Found } from "../../Snapshot.ts";
21
21
 
22
22
  /** Nothing on the page has the step's role and name. */
23
- export class Missing extends Schema.TaggedError<Missing>()("Missing", {}) {
23
+ export class Missing extends Schema.TaggedError<Missing>("effect-browser/walk/Walk/Missing")(
24
+ "Missing",
25
+ {},
26
+ ) {
24
27
  override get message() {
25
28
  return "nothing on the page has the recorded role and name";
26
29
  }
27
30
  }
28
31
 
29
32
  /** Several elements match the step's subject equally well, and nothing tells them apart. */
30
- export class Ambiguous extends Schema.TaggedError<Ambiguous>()("Ambiguous", {
31
- count: Schema.Int,
32
- }) {
33
+ export class Ambiguous extends Schema.TaggedError<Ambiguous>("effect-browser/walk/Walk/Ambiguous")(
34
+ "Ambiguous",
35
+ {
36
+ count: Schema.Int,
37
+ },
38
+ ) {
33
39
  override get message() {
34
40
  return `${this.count} elements match the recorded subject equally well`;
35
41
  }
36
42
  }
37
43
 
38
44
  /** The page is not where the recording was: another site, or no element with its context. */
39
- export class Drifted extends Schema.TaggedError<Drifted>()("Drifted", {
40
- detail: Schema.String,
41
- }) {
45
+ export class Drifted extends Schema.TaggedError<Drifted>("effect-browser/walk/Walk/Drifted")(
46
+ "Drifted",
47
+ {
48
+ detail: Schema.String,
49
+ },
50
+ ) {
42
51
  override get message() {
43
52
  return this.detail;
44
53
  }
@@ -1,9 +1,9 @@
1
1
  /** Serializable plan steps, expected effects, receipts and durable stopping evidence. */
2
2
  import { Schema } from "effect";
3
3
 
4
- import { Action } from "../Action.ts";
5
- import { BrowserError } from "../BrowserError.ts";
6
- import { Box, Subject } from "../BrowserEvent.ts";
4
+ import { Action } from "../../Action.ts";
5
+ import { BrowserError } from "../../BrowserError.ts";
6
+ import { Box, Subject } from "../../BrowserEvent.ts";
7
7
  import { Ambiguous, Drifted, Missing } from "./choose.ts";
8
8
 
9
9
  /** Reuse the execution variants; recorded code has no serializable replay capability. */
@@ -48,7 +48,7 @@ export const Expected = Schema.Union([
48
48
  export type Expected = typeof Expected.Type;
49
49
 
50
50
  /** One recorded step: the action, what it acted on, and what else it was asked. */
51
- export class Step extends Schema.Class<Step>("effect-browser/Plan/Step")({
51
+ export class Step extends Schema.Class<Step>("effect-browser/walk/Walk/Step")({
52
52
  action: ReplayAction,
53
53
  /** The address reached, including a delayed navigation before the next action began. */
54
54
  url: Schema.String,
@@ -62,13 +62,13 @@ export class Step extends Schema.Class<Step>("effect-browser/Plan/Step")({
62
62
  expect: Schema.optional(Expected),
63
63
  }) {}
64
64
 
65
- export class Plan extends Schema.Class<Plan>("effect-browser/Plan")({
65
+ export class Walk extends Schema.Class<Walk>("effect-browser/walk/Walk")({
66
66
  version: Schema.Literal(3),
67
67
  steps: Schema.Array(Step),
68
68
  }) {
69
69
  /** Version 3 carries canonical typed Actions; prior string-action encodings are rejected. */
70
- static new(steps: ReadonlyArray<Step>): Plan {
71
- return new Plan({ version: 3, steps });
70
+ static new(steps: ReadonlyArray<Step>): Walk {
71
+ return new Walk({ version: 3, steps });
72
72
  }
73
73
 
74
74
  /** The input slots its steps type, in order; replay needs text for each. */
@@ -78,7 +78,7 @@ export class Plan extends Schema.Class<Plan>("effect-browser/Plan")({
78
78
  }
79
79
 
80
80
  /** One completed step, on the page's host clock. `verified` means its expected effect was seen. */
81
- export class Receipt extends Schema.Class<Receipt>("effect-browser/Plan/Receipt")({
81
+ export class Receipt extends Schema.Class<Receipt>("effect-browser/walk/Walk/Receipt")({
82
82
  step: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
83
83
  outcome: Schema.Literals(["taken", "verified", "skipped"]),
84
84
  startedAt: Schema.Finite,
@@ -86,24 +86,40 @@ export class Receipt extends Schema.Class<Receipt>("effect-browser/Plan/Receipt"
86
86
  }) {}
87
87
 
88
88
  /** Durable stopping data. A begun step without a receipt must be restored as `unknown`. */
89
- export class Stopped extends Schema.Class<Stopped>("effect-browser/Plan/Stopped")({
89
+ export class Stopped extends Schema.Class<Stopped>("effect-browser/walk/Walk/Stopped")({
90
90
  step: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
91
91
  input: Schema.Literals(["unsent", "unknown"]),
92
92
  }) {}
93
93
 
94
94
  /** Repeating this step could repeat an unresolved effect; the consumer must reconcile it. */
95
- export class Uncertain extends Schema.TaggedError<Uncertain>()("Uncertain", {
96
- detail: Schema.String,
97
- }) {
95
+ export class Uncertain extends Schema.TaggedError<Uncertain>("effect-browser/walk/Walk/Uncertain")(
96
+ "Uncertain",
97
+ {
98
+ detail: Schema.String,
99
+ },
100
+ ) {
98
101
  override get message() {
99
102
  return this.detail;
100
103
  }
101
104
  }
102
105
 
106
+ /** Why replay stopped, as `ReplayError`'s `reason`. */
107
+ export const ReplayErrorReason = Schema.Union([
108
+ Missing,
109
+ Ambiguous,
110
+ Drifted,
111
+ BrowserError,
112
+ Uncertain,
113
+ ]);
114
+
115
+ export type ReplayErrorReason = typeof ReplayErrorReason.Type;
116
+
103
117
  /** Where replay stopped, counting steps from 0, why, and the steps that completed before it. */
104
- export class ReplayError extends Schema.TaggedError<ReplayError>()("ReplayError", {
118
+ export class ReplayError extends Schema.TaggedError<ReplayError>(
119
+ "effect-browser/walk/Walk/ReplayError",
120
+ )("ReplayError", {
105
121
  step: Schema.Int,
106
- reason: Schema.Union([Missing, Ambiguous, Drifted, BrowserError, Uncertain]),
122
+ reason: ReplayErrorReason,
107
123
  input: Schema.Literals(["unsent", "unknown"]),
108
124
  receipts: Schema.Array(Receipt),
109
125
  }) {
@@ -115,3 +131,10 @@ export class ReplayError extends Schema.TaggedError<ReplayError>()("ReplayError"
115
131
  return `step ${this.step} failed: ${this.reason.message}`;
116
132
  }
117
133
  }
134
+
135
+ /** Whether a value is a `ReplayError`. */
136
+ export const isReplayError: (u: unknown) => u is ReplayError = Schema.is(ReplayError);
137
+
138
+ /** Whether a value is one of `ReplayError`'s reasons. */
139
+ export const isReplayErrorReason: (u: unknown) => u is ReplayErrorReason =
140
+ Schema.is(ReplayErrorReason);