effect-browser 0.3.0-beta.21 → 0.3.0-beta.22

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 (248) hide show
  1. package/README.md +130 -159
  2. package/dist/Action-24sLOubi.d.mts +110 -0
  3. package/dist/Action.d.mts +2 -0
  4. package/dist/Action.mjs +141 -0
  5. package/dist/Action.mjs.map +1 -0
  6. package/dist/ActionPort.d.mts +15 -0
  7. package/dist/ActionPort.mjs +101 -0
  8. package/dist/ActionPort.mjs.map +1 -0
  9. package/dist/Browser-Cq2K1FEA.mjs +4075 -0
  10. package/dist/Browser-Cq2K1FEA.mjs.map +1 -0
  11. package/dist/{Browser-CiXHT1yO.d.mts → Browser-wZhwZSlG.d.mts} +51 -13
  12. package/dist/Browser.d.mts +2 -2
  13. package/dist/Browser.mjs +1 -1
  14. package/dist/{BrowserError-Coy7EW1N.d.mts → BrowserError-BlcmLVzn.d.mts} +22 -7
  15. package/dist/BrowserError.d.mts +2 -2
  16. package/dist/BrowserError.mjs +46 -9
  17. package/dist/BrowserError.mjs.map +1 -1
  18. package/dist/{BrowserEvent-dq6FRT8w.d.mts → BrowserEvent-lLqJ3GJS.d.mts} +93 -37
  19. package/dist/BrowserEvent.d.mts +2 -2
  20. package/dist/BrowserEvent.mjs +29 -24
  21. package/dist/BrowserEvent.mjs.map +1 -1
  22. package/dist/{Change-DqING3tr.d.mts → Change-Ba7INmay.d.mts} +4 -6
  23. package/dist/Change.d.mts +2 -2
  24. package/dist/Change.mjs +97 -2
  25. package/dist/Change.mjs.map +1 -0
  26. package/dist/Clock.d.mts +57 -0
  27. package/dist/Clock.mjs +80 -0
  28. package/dist/Clock.mjs.map +1 -0
  29. package/dist/{Frame-DkNdjjjr.d.mts → Frame-UEH2hO5T.d.mts} +10 -3
  30. package/dist/Frame.d.mts +2 -2
  31. package/dist/Frame.mjs +10 -2
  32. package/dist/Frame.mjs.map +1 -1
  33. package/dist/{Motion-DND6I-64.d.mts → Geometry-DJx9qrYy.d.mts} +7 -10
  34. package/dist/Geometry.d.mts +2 -0
  35. package/dist/Geometry.mjs +32 -0
  36. package/dist/Geometry.mjs.map +1 -0
  37. package/dist/Matching.d.mts +37 -0
  38. package/dist/Matching.mjs +72 -0
  39. package/dist/Matching.mjs.map +1 -0
  40. package/dist/Page-BF5izr8R.mjs +795 -0
  41. package/dist/Page-BF5izr8R.mjs.map +1 -0
  42. package/dist/{Page-ku6j5t-v.d.mts → Page-CvsOEorc.d.mts} +158 -185
  43. package/dist/Page.d.mts +2 -2
  44. package/dist/Page.mjs +1 -1
  45. package/dist/Released-tURbFmal.d.mts +15 -0
  46. package/dist/{Snapshot-B34hZ4Jl.d.mts → Snapshot-CtBVOtuu.d.mts} +6 -1
  47. package/dist/Snapshot.d.mts +1 -1
  48. package/dist/Snapshot.mjs.map +1 -1
  49. package/dist/Stillness-CNlvayIo.mjs +136 -0
  50. package/dist/Stillness-CNlvayIo.mjs.map +1 -0
  51. package/dist/Style-AO4V7Czt.mjs +357 -0
  52. package/dist/Style-AO4V7Czt.mjs.map +1 -0
  53. package/dist/Style.d.mts +72 -0
  54. package/dist/Style.mjs +2 -0
  55. package/dist/Url.d.mts +26 -0
  56. package/dist/Url.mjs +74 -0
  57. package/dist/Url.mjs.map +1 -0
  58. package/dist/Window-CMddGMt1.d.mts +34 -0
  59. package/dist/Window.d.mts +2 -0
  60. package/dist/Window.mjs +35 -0
  61. package/dist/Window.mjs.map +1 -0
  62. package/dist/{cdp-DL7XfEj5.d.mts → connection-2KHI4_KN.d.mts} +4 -4
  63. package/dist/{cdp-BMpYMWYe.mjs → connection-BTeO0Hiz.mjs} +5 -6
  64. package/dist/connection-BTeO0Hiz.mjs.map +1 -0
  65. package/dist/index.d.mts +15 -18
  66. package/dist/index.mjs +11 -15
  67. package/dist/moment/Moment.d.mts +86 -0
  68. package/dist/{Moment.mjs → moment/Moment.mjs} +44 -38
  69. package/dist/moment/Moment.mjs.map +1 -0
  70. package/dist/{Plan-DJ4hEEna.d.mts → plan/index.d.mts} +169 -64
  71. package/dist/{Plan-BG1WifW2.mjs → plan/index.mjs} +122 -199
  72. package/dist/plan/index.mjs.map +1 -0
  73. package/dist/{Policy-BGWjbqCl.d.mts → policy/Policy.d.mts} +16 -20
  74. package/dist/{Policy.mjs → policy/Policy.mjs} +11 -21
  75. package/dist/policy/Policy.mjs.map +1 -0
  76. package/dist/presentation/Motion.d.mts +12 -0
  77. package/dist/{Motion.mjs → presentation/Motion.mjs} +4 -27
  78. package/dist/presentation/Motion.mjs.map +1 -0
  79. package/dist/presentation/Presentation.d.mts +30 -0
  80. package/dist/presentation/Presentation.mjs +105 -0
  81. package/dist/presentation/Presentation.mjs.map +1 -0
  82. package/dist/{Stage-NHp8N81k.d.mts → presentation/Stage.d.mts} +12 -15
  83. package/dist/{Stage.mjs → presentation/Stage.mjs} +68 -76
  84. package/dist/presentation/Stage.mjs.map +1 -0
  85. package/dist/presentation/feed.d.mts +20 -0
  86. package/dist/presentation/feed.mjs +18 -0
  87. package/dist/presentation/feed.mjs.map +1 -0
  88. package/dist/providers/Cdp.d.mts +9 -0
  89. package/dist/{Cdp.mjs → providers/Cdp.mjs} +3 -8
  90. package/dist/providers/Cdp.mjs.map +1 -0
  91. package/dist/{Chromium.d.mts → providers/Chromium.d.mts} +6 -7
  92. package/dist/{Chromium.mjs → providers/Chromium.mjs} +6 -15
  93. package/dist/providers/Chromium.mjs.map +1 -0
  94. package/dist/providers/Released.d.mts +2 -0
  95. package/dist/providers/Released.mjs +12 -0
  96. package/dist/providers/Released.mjs.map +1 -0
  97. package/dist/stillness/Stillness.d.mts +12 -0
  98. package/dist/stillness/Stillness.mjs +2 -0
  99. package/dist/supervisor/Supervisor.d.mts +104 -0
  100. package/dist/supervisor/Supervisor.mjs +513 -0
  101. package/dist/supervisor/Supervisor.mjs.map +1 -0
  102. package/dist/testing/index.d.mts +337 -0
  103. package/dist/testing/index.mjs +515 -0
  104. package/dist/testing/index.mjs.map +1 -0
  105. package/dist/workerd/Cdp.d.mts +8 -3
  106. package/dist/workerd/Cdp.mjs +2 -7
  107. package/dist/workerd/Cdp.mjs.map +1 -1
  108. package/package.json +86 -36
  109. package/src/Action.ts +127 -0
  110. package/src/ActionPort.ts +128 -0
  111. package/src/Browser.ts +352 -201
  112. package/src/BrowserError.ts +63 -6
  113. package/src/BrowserEvent.ts +26 -25
  114. package/src/Change.ts +0 -2
  115. package/src/{internal/pictures/clock.ts → Clock.ts} +17 -6
  116. package/src/Frame.ts +14 -0
  117. package/src/Geometry.ts +48 -0
  118. package/src/{internal/reading/match.inpage.ts → Matching.ts} +34 -4
  119. package/src/Page.ts +111 -92
  120. package/src/Snapshot.ts +5 -0
  121. package/src/{internal/input/style.ts → Style.ts} +121 -14
  122. package/src/Window.ts +30 -0
  123. package/src/index.ts +15 -6
  124. package/src/internal/input/actions.ts +61 -119
  125. package/src/internal/input/dispatch.ts +3 -3
  126. package/src/internal/input/gate.ts +21 -18
  127. package/src/internal/input/guard.inpage.ts +25 -58
  128. package/src/internal/input/guard.ts +11 -20
  129. package/src/internal/input/keyboard.ts +12 -3
  130. package/src/internal/input/perform.ts +78 -60
  131. package/src/internal/input/pointer.ts +4 -2
  132. package/src/internal/input/settle.ts +7 -5
  133. package/src/internal/input/targets.inpage.ts +1 -1
  134. package/src/internal/input/targets.ts +4 -9
  135. package/src/internal/page/bridge.ts +209 -113
  136. package/src/internal/page/context.ts +12 -59
  137. package/src/internal/page/dialogs.ts +58 -0
  138. package/src/internal/page/lane.ts +14 -15
  139. package/src/internal/page/navigation.ts +50 -42
  140. package/src/internal/page/openings.ts +11 -5
  141. package/src/internal/page/page.ts +44 -81
  142. package/src/internal/page/port.ts +125 -0
  143. package/src/internal/{input → page}/replies.ts +1 -1
  144. package/src/internal/page/request-owner.ts +269 -0
  145. package/src/internal/page/requests.ts +357 -0
  146. package/src/internal/page/scripts.ts +124 -0
  147. package/src/internal/pictures/capture.ts +255 -332
  148. package/src/internal/pictures/dimensions.ts +162 -0
  149. package/src/internal/pictures/frame.ts +68 -0
  150. package/src/internal/pictures/pictures.ts +57 -23
  151. package/src/internal/pictures/quiescence.ts +1 -1
  152. package/src/internal/pictures/state.ts +26 -0
  153. package/src/internal/pictures/transport.ts +21 -4
  154. package/src/internal/reading/controls.inpage.ts +5 -70
  155. package/src/internal/reading/expect.inpage.ts +13 -17
  156. package/src/internal/reading/names.inpage.ts +89 -45
  157. package/src/internal/reading/outline.inpage.ts +6 -7
  158. package/src/internal/reading/reading.ts +144 -176
  159. package/src/internal/reading/ready.inpage.ts +6 -17
  160. package/src/internal/reading/ready.ts +13 -135
  161. package/src/internal/reading/subjects.inpage.ts +83 -43
  162. package/src/internal/reading/walk.inpage.ts +33 -13
  163. package/src/internal/timeline/changes.ts +55 -6
  164. package/src/internal/timeline/events.ts +15 -5
  165. package/src/internal/timeline/history.inpage.ts +1 -1
  166. package/src/internal/timeline/record.inpage.ts +4 -1
  167. package/src/internal/timeline/window.ts +2 -1
  168. package/src/{Moment.ts → moment/Moment.ts} +13 -31
  169. package/src/{internal/timeline → moment}/words.ts +2 -2
  170. package/src/{internal/reading → plan}/choose.ts +3 -3
  171. package/src/plan/data.ts +117 -0
  172. package/src/plan/execute.ts +411 -0
  173. package/src/plan/index.ts +36 -0
  174. package/src/plan/record.ts +71 -0
  175. package/src/plan/targets.ts +71 -0
  176. package/src/{Policy.ts → policy/Policy.ts} +13 -10
  177. package/src/{Motion.ts → presentation/Motion.ts} +12 -46
  178. package/src/presentation/Presentation.ts +176 -0
  179. package/src/{Stage.ts → presentation/Stage.ts} +147 -112
  180. package/src/presentation/feed.ts +21 -0
  181. package/src/{Cdp.ts → providers/Cdp.ts} +2 -2
  182. package/src/{Chromium.ts → providers/Chromium.ts} +7 -10
  183. package/src/providers/Released.ts +13 -0
  184. package/src/{internal/cdp.ts → providers/connection.ts} +2 -2
  185. package/src/{internal/pictures/motion.ts → stillness/Pixels.ts} +1 -1
  186. package/src/stillness/Stillness.ts +166 -0
  187. package/src/supervisor/Supervisor.ts +170 -0
  188. package/src/supervisor/contract.ts +105 -0
  189. package/src/supervisor/lifecycle.ts +272 -0
  190. package/src/supervisor/runtime.ts +234 -0
  191. package/src/testing/TestBrowser.ts +115 -0
  192. package/src/testing/TestPage.ts +10 -0
  193. package/src/testing/evidence.ts +154 -0
  194. package/src/testing/index.ts +3 -0
  195. package/src/testing/model.ts +222 -0
  196. package/src/testing/page.ts +360 -0
  197. package/src/workerd/Cdp.ts +2 -2
  198. package/dist/Browser-CxXUjxOp.mjs +0 -619
  199. package/dist/Browser-CxXUjxOp.mjs.map +0 -1
  200. package/dist/Cdp-CzCRnMlM.d.mts +0 -10
  201. package/dist/Cdp.d.mts +0 -11
  202. package/dist/Cdp.mjs.map +0 -1
  203. package/dist/Change-DNvztNLu.mjs +0 -138
  204. package/dist/Change-DNvztNLu.mjs.map +0 -1
  205. package/dist/Chromium.mjs.map +0 -1
  206. package/dist/Expect-u3P_ENLX.d.mts +0 -62
  207. package/dist/Expect.d.mts +0 -2
  208. package/dist/Expect.mjs +0 -114
  209. package/dist/Expect.mjs.map +0 -1
  210. package/dist/Moment.d.mts +0 -2
  211. package/dist/Moment.mjs.map +0 -1
  212. package/dist/Motion.d.mts +0 -2
  213. package/dist/Motion.mjs.map +0 -1
  214. package/dist/Page-BP02bmNv.mjs +0 -264
  215. package/dist/Page-BP02bmNv.mjs.map +0 -1
  216. package/dist/Plan-BG1WifW2.mjs.map +0 -1
  217. package/dist/Plan.d.mts +0 -2
  218. package/dist/Plan.mjs +0 -2
  219. package/dist/Policy.d.mts +0 -2
  220. package/dist/Policy.mjs.map +0 -1
  221. package/dist/Presentation-DxVikn9_.d.mts +0 -48
  222. package/dist/Presentation.d.mts +0 -2
  223. package/dist/Presentation.mjs +0 -118
  224. package/dist/Presentation.mjs.map +0 -1
  225. package/dist/Stage.d.mts +0 -2
  226. package/dist/Stage.mjs.map +0 -1
  227. package/dist/Supervisor-2mPjIYYs.mjs +0 -676
  228. package/dist/Supervisor-2mPjIYYs.mjs.map +0 -1
  229. package/dist/Supervisor-CfRxbaso.d.mts +0 -317
  230. package/dist/Supervisor.d.mts +0 -2
  231. package/dist/Supervisor.mjs +0 -2
  232. package/dist/cdp-BMpYMWYe.mjs.map +0 -1
  233. package/dist/context-EGhOqjNN.mjs +0 -335
  234. package/dist/context-EGhOqjNN.mjs.map +0 -1
  235. package/dist/page-PTM8m5wC.mjs +0 -4057
  236. package/dist/page-PTM8m5wC.mjs.map +0 -1
  237. package/dist/url-Bsp2y55M.mjs +0 -264
  238. package/dist/url-Bsp2y55M.mjs.map +0 -1
  239. package/dist/workerd/index.d.mts +0 -16
  240. package/dist/workerd/index.mjs +0 -17
  241. package/src/Expect.ts +0 -180
  242. package/src/Plan.ts +0 -674
  243. package/src/Presentation.ts +0 -196
  244. package/src/Supervisor.ts +0 -632
  245. package/src/internal/supervisor/lifecycle.ts +0 -484
  246. package/src/workerd/index.ts +0 -17
  247. /package/src/{internal/page/url.ts → Url.ts} +0 -0
  248. /package/src/{internal/pictures → stillness}/utilsBundle.d.ts +0 -0
@@ -1,56 +1,11 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { Point } from "./Motion.mjs";
3
- import { ActionOptions, Box, Subject } from "./BrowserEvent.mjs";
4
- import { BrowserError, InvalidRequest } from "./BrowserError.mjs";
5
- import { c as undispatched } from "./context-EGhOqjNN.mjs";
6
- import { p as redacted } from "./Page-BP02bmNv.mjs";
7
- import { Duration, Effect, Exit, Option, Schedule, Schema } from "effect";
8
- //#region src/internal/reading/match.inpage.ts
9
- const match = () => {
10
- /**
11
- * How names, text and context compare: one Unicode form, without invisible format characters,
12
- * spaces collapsed, and case folded upper first, so that "ß" and "SS" read the same.
13
- */
14
- const normalize = (value) => value.normalize("NFKC").replace(/\p{Cf}/gu, "").replace(/\s+/g, " ").trim().toUpperCase().toLowerCase();
15
- /** A string that reads the same, or, unless `whole`, appears within; or a pattern found within. */
16
- const rule = (wanted, whole) => {
17
- if (typeof wanted !== "string") {
18
- const found = new RegExp(wanted.source, wanted.flags.replace(/[gy]/g, ""));
19
- return (value) => found.test(value.replace(/\s+/g, " ").trim());
20
- }
21
- const target = normalize(wanted);
22
- return whole ? (value) => normalize(value) === target : (value) => normalize(value).includes(target);
23
- };
24
- /** Whether a value's words appear, whole and in order, among a text's: "BTC" not in "WBTC". */
25
- const holds = (text, value) => ` ${normalize(text)} `.includes(` ${normalize(value)} `);
26
- /** Whether a candidate meets every rule a query gives; a rule left out always holds. */
27
- const compile = (request) => {
28
- const role = request.role === null ? null : normalize(request.role);
29
- const name = request.name === null ? null : rule(request.name, true);
30
- const text = request.text === null ? null : rule(request.text, false);
31
- const { near } = request;
32
- return (candidate) => {
33
- if (role !== null && normalize(candidate.role ?? "") !== role) return false;
34
- if (text !== null && !text(candidate.text())) return false;
35
- if (name !== null && !name(candidate.name())) return false;
36
- if (near === null) return true;
37
- const { row, column, label, heading } = candidate.context();
38
- return [
39
- row,
40
- column,
41
- label,
42
- heading
43
- ].some((value) => value !== void 0 && holds(value, near));
44
- };
45
- };
46
- return {
47
- compile,
48
- holds,
49
- normalize
50
- };
51
- };
52
- //#endregion
53
- //#region src/internal/reading/choose.ts
1
+ import { Action, targetOf } from "../Action.mjs";
2
+ import { Box, Subject } from "../BrowserEvent.mjs";
3
+ import { BrowserError, InvalidRequest, undispatched } from "../BrowserError.mjs";
4
+ import { p as redacted } from "../Page-BF5izr8R.mjs";
5
+ import { match } from "../Matching.mjs";
6
+ import { t as wait } from "../Stillness-CNlvayIo.mjs";
7
+ import { Clock, Duration, Effect, Exit, Option, Schedule, Schema } from "effect";
8
+ //#region src/plan/choose.ts
54
9
  /**
55
10
  * Choosing the one element a recorded subject names, among those `find` gives for its role and
56
11
  * name. Context tells them apart, and an element that does not repeat every part of the recorded
@@ -123,60 +78,10 @@ const choose = (subject, found) => {
123
78
  return top.length === 1 && only !== void 0 ? Effect.succeed(only.one) : Effect.fail(new Ambiguous({ count: top.length }));
124
79
  };
125
80
  //#endregion
126
- //#region src/Plan.ts
127
- /**
128
- * A walk recorded once from a page's events and replayed later, on a fresh page, with no model
129
- * call.
130
- *
131
- * `fromEvents` keeps one page's completed actions with their subjects and the options they were
132
- * given, its navigations with both the address asked for and the one reached, and what was typed
133
- * as a named input slot, never the text itself. A navigation to an address whose credentials the
134
- * events withheld is an input slot too, so replay goes where the caller says, or nowhere, and
135
- * never to the address without them. `replay` takes the steps in turn. Before a step
136
- * except an opening navigate, back or reload, it waits for `Page.ready`; then it finds the element its
137
- * subject names, by role and name among those that repeat all its recorded context, and acts on
138
- * it. Text typed into focus was typed into the focused field, which replay finds the same way, and
139
- * text typed into a secret field goes into nothing else. An element step never falls back to
140
- * coordinates, and a step recorded at a point acts there only while the element found for it still
141
- * covers that point. `take` and `replay` return receipts; failure preserves a stopping point and
142
- * earlier receipts. Unknown consequential input is never resent. Only a positive durable read-back
143
- * can reconcile it; restoration follows the same rule. The consumer journals begun steps before
144
- * calling, treating interruption or a missing receipt as unknown. Plain recordings use version 1;
145
- * authored expected effects use version 2. Old 0.2 plans and unknown versions do not decode.
146
- *
147
- * @since 0.3.0
148
- */
149
- var Plan_exports = /* @__PURE__ */ __exportAll({
150
- Ambiguous: () => Ambiguous,
151
- Drifted: () => Drifted,
152
- Expected: () => Expected,
153
- Missing: () => Missing,
154
- Plan: () => Plan,
155
- Receipt: () => Receipt,
156
- ReplayError: () => ReplayError,
157
- Step: () => Step,
158
- StepAction: () => StepAction,
159
- Stopped: () => Stopped,
160
- Uncertain: () => Uncertain,
161
- fromEvents: () => fromEvents,
162
- locate: () => locate,
163
- repeatable: () => repeatable,
164
- replay: () => replay,
165
- restore: () => restore,
166
- take: () => take
167
- });
168
- const StepAction = Schema.Literals([
169
- "navigate",
170
- "back",
171
- "reload",
172
- "click",
173
- "hover",
174
- "drag",
175
- "type",
176
- "press",
177
- "scroll",
178
- "select"
179
- ]);
81
+ //#region src/plan/data.ts
82
+ /** Serializable plan steps, expected effects, receipts and durable stopping evidence. */
83
+ /** Reuse the execution variants; recorded code has no serializable replay capability. */
84
+ const ReplayAction = Action.pipe(Schema.refine((value) => value._tag !== "Act"));
180
85
  const Query = Schema.Struct({
181
86
  role: Schema.optional(Schema.String),
182
87
  name: Schema.optional(Schema.String),
@@ -209,41 +114,26 @@ const Expected = Schema.Union([
209
114
  ]);
210
115
  /** One recorded step: the action, what it acted on, and what else it was asked. */
211
116
  var Step = class extends Schema.Class("effect-browser/Plan/Step")({
212
- action: StepAction,
213
- /**
214
- * The ending address, or a later recorded navigation before the next action began. Empty when
215
- * unknown; a delayed navigation can be stronger arrival evidence than the action's ending URL.
216
- */
117
+ action: ReplayAction,
118
+ /** The address reached, including a delayed navigation before the next action began. */
217
119
  url: Schema.String,
218
- /** A navigation's requested address, or the keys a press pressed. */
219
- target: Schema.optional(Schema.String),
220
120
  subject: Schema.optional(Subject),
221
121
  /** Where a drag ended. */
222
122
  to: Schema.optional(Subject),
223
- /** The viewport point a step aimed at, when it aimed at a point, and a drag's end point. */
224
- point: Schema.optional(Point),
225
- toPoint: Schema.optional(Point),
226
- /** The box of what a step aimed at by point found there, so replay aims at the same place in it. */
123
+ /** The recorded box keeps a point at the same relative position within its subject. */
227
124
  box: Schema.optional(Box),
228
- /**
229
- * The input slot whose text a `type` step types, or whose address a `navigate` step goes to, as
230
- * its recorded address had a credential withheld.
231
- */
125
+ /** A slot replaces recorded typing text or a navigation address with withheld credentials. */
232
126
  input: Schema.optional(Schema.String),
233
- /** The slot's text went into a secret field, so replay types it into nothing else. */
234
- secret: Schema.optional(Schema.Literal(true)),
235
- options: Schema.optional(ActionOptions),
236
127
  expect: Schema.optional(Expected)
237
128
  }) {};
238
- const PlanData = Schema.Struct({
239
- version: Schema.Literals([1, 2]),
129
+ var Plan = class Plan extends Schema.Class("effect-browser/Plan")({
130
+ version: Schema.Literal(3),
240
131
  steps: Schema.Array(Step)
241
- }).check(Schema.makeFilter((plan) => plan.version === (plan.steps.some((step) => step.expect !== void 0) ? 2 : 1) ? void 0 : "only plans with expected effects use version 2"));
242
- var Plan = class Plan extends Schema.Class("effect-browser/Plan")(PlanData) {
243
- /** Choose the encoding version from the steps; simple recordings remain version 1. */
132
+ }) {
133
+ /** Version 3 carries canonical typed Actions; prior string-action encodings are rejected. */
244
134
  static new(steps) {
245
135
  return new Plan({
246
- version: steps.some((step) => step.expect !== void 0) ? 2 : 1,
136
+ version: 3,
247
137
  steps
248
138
  });
249
139
  }
@@ -297,14 +187,10 @@ var ReplayError = class extends Schema.TaggedError()("ReplayError", {
297
187
  return `step ${this.step} failed: ${this.reason.message}`;
298
188
  }
299
189
  };
300
- const isStep = (event) => event._tag === "Action" && event.ok && StepAction.literals.includes(event.name);
301
- const pointIn = (target) => {
302
- const parsed = /^\{?(?:"x":)?(-?[\d.]+),(?:"y":)?(-?[\d.]+)\}?$/.exec(target ?? "");
303
- return parsed === null ? void 0 : {
304
- x: Number(parsed[1]),
305
- y: Number(parsed[2])
306
- };
307
- };
190
+ //#endregion
191
+ //#region src/plan/record.ts
192
+ /** Derive replay steps from typed action events without parsing rendered descriptions. */
193
+ const isStep = (event) => event._tag === "Action" && event.ok && event.value._tag !== "Act";
308
194
  /** A slot named for the field it fills, such as `email`, unique within the plan. */
309
195
  const slotFor = (taken, field) => {
310
196
  const base = field?.toLowerCase().match(/[\p{L}\p{N}]+/gu)?.join("-") ?? "input";
@@ -327,28 +213,31 @@ const fromEvents = (events) => {
327
213
  const taken = /* @__PURE__ */ new Set();
328
214
  const before = (time) => moves.findLast((move) => move.at <= time)?.url ?? opened;
329
215
  return new Plan({
330
- version: 1,
216
+ version: 3,
331
217
  steps: steps.map((action, index) => {
332
- const drag = action.name === "drag" ? (action.target ?? "").split(" -> ") : void 0;
333
- const point = pointIn(drag === void 0 ? action.target : drag[0]);
218
+ const value = action.value;
219
+ const target = targetOf(value);
220
+ const point = typeof target === "object" ? target : void 0;
334
221
  const until = steps[index + 1]?.startedAt ?? Number.POSITIVE_INFINITY;
335
222
  const arrival = moves.findLast((move) => move.at > action.at && move.at <= until);
336
223
  return new Step({
337
- action: action.name,
224
+ action: value._tag === "Type" ? {
225
+ ...value,
226
+ text: ""
227
+ } : value,
338
228
  url: arrival?.url ?? action.url ?? before(until),
339
- target: action.name === "navigate" || action.name === "press" ? action.target : void 0,
340
229
  subject: action.subject,
341
230
  to: action.to,
342
- point,
343
- toPoint: pointIn(drag?.[1]),
344
231
  box: point === void 0 ? void 0 : action.box,
345
- input: action.name === "type" ? slotFor(taken, action.subject?.name) : action.name === "navigate" && action.target?.includes(redacted) === true ? slotFor(taken, "address") : void 0,
346
- secret: action.name === "type" && action.text === redacted ? true : void 0,
347
- options: action.options
232
+ input: value._tag === "Type" ? slotFor(taken, action.subject?.name) : value._tag === "Goto" && value.url.includes(redacted) ? slotFor(taken, "address") : void 0
348
233
  });
349
234
  })
350
235
  });
351
236
  };
237
+ //#endregion
238
+ //#region src/plan/targets.ts
239
+ /** Find a recorded subject and verify where its point still lands before replay input. */
240
+ const invalid$1 = (detail) => undispatched("replay", new InvalidRequest({ detail }));
352
241
  /**
353
242
  * The one element on the page that a subject names, by role, name and context (see `Plan`),
354
243
  * looking again for two seconds while the page may still be drawing it.
@@ -361,15 +250,14 @@ const locate = (page, subject) => page.find({
361
250
  schedule: Schedule.spaced(Duration.millis(250)),
362
251
  times: 8,
363
252
  while: (error) => error._tag !== "BrowserError"
364
- }), Effect.withSpan("Plan.locate", { attributes: { role: subject.role ?? "" } }));
365
- const invalid = (detail) => undispatched("replay", new InvalidRequest({ detail }));
253
+ }), Effect.provideService(Clock.Clock, page.clock), Effect.withSpan("Plan.locate", { attributes: { role: subject.role ?? "" } }));
366
254
  /**
367
255
  * Where the step acts: the element its subject names, or, for a step recorded at a point, the same
368
256
  * place within that element, as long as a press there reaches that element and not one over it.
369
257
  * An element out of view is first brought into it, by hovering it, as a press by ref would be.
370
258
  */
371
259
  const aim = (page, subject, point, recorded) => {
372
- if (subject === void 0) return Effect.fail(invalid("the step names no element"));
260
+ if (subject === void 0) return Effect.fail(invalid$1("the step names no element"));
373
261
  if (point === void 0) return Effect.map(locate(page, subject), ({ ref }) => ref);
374
262
  const reach = ({ ref, box }) => {
375
263
  const at = recorded === void 0 || recorded.width <= 0 || recorded.height <= 0 ? point : {
@@ -381,44 +269,70 @@ const aim = (page, subject, point, recorded) => {
381
269
  const missed = new Drifted({ detail: "a press at the subject's point reaches another element" });
382
270
  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))))));
383
271
  };
384
- const dispatch = (page, step, text) => {
385
- const options = step.options ?? {};
386
- switch (step.action) {
387
- case "navigate": return page.goto(step.input === void 0 ? step.target ?? step.url : text);
388
- case "back": return page.back;
389
- case "reload": return page.reload;
390
- case "press": return step.subject === void 0 ? page.press(step.target ?? "", options) : Effect.flatMap(locate(page, step.subject), ({ ref }) => page.press(step.target ?? "", {
391
- ...options,
392
- on: ref
393
- }));
394
- case "click": return aim(page, step.subject, step.point, step.box).pipe(Effect.flatMap((at) => page.click(at, options)), Effect.asVoid);
395
- case "hover": return Effect.flatMap(aim(page, step.subject, step.point, step.box), page.hover);
396
- case "drag": return Effect.all([aim(page, step.subject, step.point), aim(page, step.to, step.toPoint)]).pipe(Effect.flatMap(([from, to]) => page.drag(from, to)));
397
- case "select": return aim(page, step.subject).pipe(Effect.flatMap((at) => page.select(typeof at === "string" ? at : "", options.values ?? [])), Effect.asVoid);
398
- case "scroll": return step.subject === void 0 ? page.scroll(options) : Effect.flatMap(aim(page, step.subject, step.point, step.box), (at) => page.scroll({
399
- ...options,
400
- at
401
- }));
402
- case "type": return step.subject === void 0 ? page.type(text, {
403
- ...options,
404
- secret: step.secret
405
- }) : Effect.flatMap(aim(page, step.subject), (into) => page.type(text, {
406
- ...options,
407
- into: typeof into === "string" ? into : void 0,
408
- secret: step.secret
409
- }));
410
- }
272
+ //#endregion
273
+ //#region src/plan/execute.ts
274
+ /** Replay and restore with durable read-back before repeating uncertain consequential input. */
275
+ const invalid = (detail) => undispatched("replay", new InvalidRequest({ detail }));
276
+ const dispatch = (page, step, text, before) => {
277
+ const action = step.action;
278
+ const point = (target) => typeof target === "object" ? target : void 0;
279
+ return Effect.gen(function* () {
280
+ switch (action._tag) {
281
+ case "Goto": return {
282
+ ...action,
283
+ url: step.input === void 0 ? action.url : text
284
+ };
285
+ case "Back":
286
+ case "Reload": return action;
287
+ case "Press": return {
288
+ ...action,
289
+ options: {
290
+ ...action.options,
291
+ on: step.subject === void 0 ? void 0 : (yield* locate(page, step.subject)).ref
292
+ }
293
+ };
294
+ case "Click":
295
+ case "Hover": return {
296
+ ...action,
297
+ target: yield* aim(page, step.subject, point(action.target), step.box)
298
+ };
299
+ case "Drag": return {
300
+ ...action,
301
+ from: yield* aim(page, step.subject, point(action.from)),
302
+ to: yield* aim(page, step.to, point(action.to))
303
+ };
304
+ case "Select": return {
305
+ ...action,
306
+ ref: (yield* locate(page, step.subject ?? (yield* invalid("a selection needs a subject")))).ref
307
+ };
308
+ case "Scroll": return step.subject === void 0 ? action : {
309
+ ...action,
310
+ options: {
311
+ ...action.options,
312
+ at: yield* aim(page, step.subject, action.options?.at === void 0 ? void 0 : point(action.options.at), step.box)
313
+ }
314
+ };
315
+ case "Type": return {
316
+ ...action,
317
+ text: step.input === void 0 ? action.text : text,
318
+ options: {
319
+ ...action.options,
320
+ into: step.subject === void 0 ? void 0 : (yield* locate(page, step.subject)).ref
321
+ }
322
+ };
323
+ }
324
+ }).pipe(Effect.tap(() => before), Effect.flatMap(page.perform), Effect.asVoid);
411
325
  };
412
326
  /**
413
327
  * Input that can be repeated without repeating a commitment. `take` also validates a Checked
414
328
  * target's boolean state before input. Back/reload can resubmit a form.
415
329
  */
416
330
  const repeatable = (step) => [
417
- "navigate",
418
- "hover",
419
- "scroll",
420
- "select"
421
- ].includes(step.action) || step.action === "type" && step.subject !== void 0 && step.options?.replace !== false && step.options?.submit !== true || step.action === "click" && step.expect?._tag === "Checked";
331
+ "Goto",
332
+ "Hover",
333
+ "Scroll",
334
+ "Select"
335
+ ].includes(step.action._tag) || step.action._tag === "Type" && step.subject !== void 0 && step.action.options?.replace !== false && step.action.options?.submit !== true || step.action._tag === "Click" && step.expect?._tag === "Checked";
422
336
  const within = (check, millis) => millis === 0 ? check : check.pipe(Effect.repeat({
423
337
  until: (held) => held,
424
338
  schedule: Schedule.spaced(Duration.millis(25))
@@ -431,19 +345,19 @@ const sameSite = (url, recorded) => {
431
345
  return recorded === "" || (origin === void 0 || origin === "null" ? url === recorded : URL.parse(url)?.origin === origin);
432
346
  };
433
347
  const arrived = (page, urls, millis) => within(Effect.map(page.url, (url) => urls.some((recorded) => sameSite(url, recorded))), millis).pipe(Effect.filterOrFail((held) => held, () => new Drifted({ detail: "the page did not reach the recorded site within the arrival wait" })), Effect.asVoid);
434
- const checkEffect = (page, step, first) => {
348
+ const checkEffect = (page, step, first, millis = 0) => {
435
349
  const expected = step.expect;
436
350
  if (expected === void 0) return Effect.succeed(false);
437
351
  switch (expected._tag) {
438
352
  case "Checked": return step.subject === void 0 ? Effect.fail(invalid("a checked effect needs a subject")) : Effect.flatMap(locate(page, step.subject), (found) => found.state.checked === void 0 ? Effect.fail(invalid("a checked effect needs a checkable subject")) : Effect.succeed(found.state.checked === expected.checked));
439
353
  case "Navigated":
440
354
  if (expected.url === void 0 && first === void 0) return Effect.succeed(false);
441
- return Effect.map(page.state, (now) => expected.url === void 0 ? now.url !== first?.url || now.document !== first?.document : now.url === expected.url);
355
+ 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);
442
356
  case "Appeared":
443
- case "Gone": return Effect.map(page.find({
357
+ case "Gone": return Effect.map(page.until({
444
358
  ...expected.query,
445
359
  scope: "document"
446
- }), (found) => expected._tag === "Appeared" ? found.length > 0 : found.length === 0);
360
+ }, expected._tag === "Appeared" ? "some" : "none", millis), ({ met }) => met);
447
361
  }
448
362
  };
449
363
  /**
@@ -457,6 +371,7 @@ const take = Effect.fn("Plan.take")(function* (page, plan, at, options = {}) {
457
371
  return yield* Effect.gen(function* () {
458
372
  const step = plan.steps[index];
459
373
  if (!Number.isInteger(index) || index < 0 || step === void 0) return yield* invalid("the step index is outside the plan");
374
+ if (!Schema.is(Step.fields.action)(step.action)) return yield* invalid("the step action cannot be replayed");
460
375
  const duration = Duration.fromInput(options.arrival ?? Duration.seconds(5));
461
376
  if (Option.isNone(duration) || Duration.isNegative(duration.value) || !Duration.isFinite(duration.value)) return yield* invalid("arrival must be a finite nonnegative duration");
462
377
  const millis = Duration.toMillis(duration.value);
@@ -467,10 +382,14 @@ const take = Effect.fn("Plan.take")(function* (page, plan, at, options = {}) {
467
382
  const durable = expected !== void 0 && (expected._tag === "Appeared" || expected._tag === "Navigated" && typeof expected.url === "string") && expected.durable === true;
468
383
  if (!durable && (unresolved || expected !== void 0 && "durable" in expected && expected.durable === true)) return yield* uncertain;
469
384
  if (options.settle !== false && (index > 0 || ![
470
- "navigate",
471
- "back",
472
- "reload"
473
- ].includes(step.action))) yield* page.ready(options.settle);
385
+ "Goto",
386
+ "Back",
387
+ "Reload"
388
+ ].includes(step.action._tag))) yield* options.settle?.quietMillis === void 0 ? page.ready(options.settle) : wait(page, {
389
+ ...options.settle,
390
+ still: "content",
391
+ quietMillis: options.settle.quietMillis
392
+ });
474
393
  const before = plan.steps[index - 1]?.url;
475
394
  if (before !== void 0) yield* arrived(page, unresolved ? [before, step.url] : [before], millis);
476
395
  const check = checkEffect(page, step);
@@ -492,23 +411,27 @@ const take = Effect.fn("Plan.take")(function* (page, plan, at, options = {}) {
492
411
  if (unresolved) return yield* uncertain;
493
412
  const text = step.input === void 0 ? "" : options.inputs?.[step.input];
494
413
  if (text === void 0) return yield* invalid(`no text for the input "${step.input ?? ""}"`);
495
- const verify = checkEffect(page, step, yield* page.state);
496
- const acted = yield* Effect.exit(dispatch(page, step, text));
414
+ let baseline;
415
+ const beforeDispatch = Effect.tap(page.state, (state) => Effect.sync(() => {
416
+ baseline = state;
417
+ })).pipe(Effect.asVoid);
418
+ const verify = Effect.suspend(() => within(checkEffect(page, step, baseline, millis), millis));
419
+ const acted = yield* Effect.exit(dispatch(page, step, text, beforeDispatch));
497
420
  if (Exit.isFailure(acted)) {
498
421
  const error = Exit.findErrorOption(acted);
499
422
  if (Option.isSome(error) && error.value._tag === "BrowserError" && error.value.dispatched) {
500
423
  input = "unknown";
501
424
  if (expected !== void 0 && (repeatable(step) || durable)) {
502
- const observed = yield* Effect.exit(within(verify, millis));
425
+ const observed = yield* Effect.exit(verify);
503
426
  if (Exit.isSuccess(observed) && observed.value) return yield* receipt("verified");
504
427
  }
505
428
  }
506
429
  return yield* Effect.failCause(acted.cause);
507
430
  }
508
431
  input = "unknown";
509
- if (expected !== void 0 && !(yield* within(verify, millis))) return yield* new Drifted({ detail: "the step's expected effect did not arrive" });
432
+ if (expected !== void 0 && !(yield* verify)) return yield* new Drifted({ detail: "the step's expected effect did not arrive" });
510
433
  return yield* receipt(expected === void 0 ? "taken" : "verified");
511
- }).pipe(Effect.mapError((reason) => new ReplayError({
434
+ }).pipe(Effect.provideService(Clock.Clock, page.clock), Effect.mapError((reason) => new ReplayError({
512
435
  step: index,
513
436
  reason,
514
437
  input,
@@ -551,6 +474,6 @@ const replay = (page, plan, options = {}) => run(page, plan, options, options.fr
551
474
  /** Restore prior steps on a fresh page; unresolved commitments require positive durable evidence. */
552
475
  const restore = (page, plan, options = {}) => run(page, plan, options, 0, options.upTo ?? plan.steps.length, true).pipe(Effect.withSpan("Plan.restore"));
553
476
  //#endregion
554
- export { Drifted as _, ReplayError as a, Stopped as c, locate as d, repeatable as f, Ambiguous as g, take as h, Receipt as i, Uncertain as l, restore as m, Plan as n, Step as o, replay as p, Plan_exports as r, StepAction as s, Expected as t, fromEvents as u, Missing as v };
477
+ export { Ambiguous, Drifted, Expected, Missing, Plan, Receipt, ReplayError, Step, Stopped, Uncertain, fromEvents, locate, repeatable, replay, restore, take };
555
478
 
556
- //# sourceMappingURL=Plan-BG1WifW2.mjs.map
479
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["invalid","Stillness.wait"],"sources":["../../src/plan/choose.ts","../../src/plan/data.ts","../../src/plan/record.ts","../../src/plan/targets.ts","../../src/plan/execute.ts"],"sourcesContent":["/**\n * Choosing the one element a recorded subject names, among those `find` gives for its role and\n * name. Context tells them apart, and an element that does not repeat every part of the recorded\n * context is another subject, so a sole element left once its own has gone, such as Alice's\n * \"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 \"../Matching.ts\";\nimport type { Found } from \"../Page.ts\";\n\n/** Nothing on the page has the step's role and name. */\nexport class Missing extends Schema.TaggedError<Missing>()(\"Missing\", {}) {\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>()(\"Ambiguous\", {\n count: Schema.Int,\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>()(\"Drifted\", {\n detail: Schema.String,\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/Plan/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 Plan extends Schema.Class<Plan>(\"effect-browser/Plan\")({\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>): Plan {\n return new Plan({ 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/Plan/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/Plan/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>()(\"Uncertain\", {\n detail: Schema.String,\n}) {\n override get message() {\n return this.detail;\n }\n}\n\n/** Where replay stopped, counting steps from 0, why, and the steps that completed before it. */\nexport class ReplayError extends Schema.TaggedError<ReplayError>()(\"ReplayError\", {\n step: Schema.Int,\n reason: Schema.Union([Missing, Ambiguous, Drifted, BrowserError, Uncertain]),\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","/** 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 { Plan, 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>): Plan => {\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 Plan({\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, Schedule } from \"effect\";\n\nimport { InvalidRequest, undispatched } from \"../BrowserError.ts\";\nimport { type Box, type Subject } from \"../BrowserEvent.ts\";\nimport type { Page, Found, Point, Target } from \"../Page.ts\";\nimport { choose, Drifted } 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 `Plan`),\n * looking again for two seconds while the page may still be drawing it.\n */\nexport const locate = (page: Page, subject: Subject) =>\n page\n .find({\n name: subject.name,\n scope: \"document\",\n ...(subject.role === null ? {} : { role: subject.role }),\n })\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.clock),\n Effect.withSpan(\"Plan.locate\", { attributes: { role: subject.role ?? \"\" } }),\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 }: 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(page.find({ at }), ([reached]) => (reached?.ref === ref ? at : undefined));\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, Option, Schedule, Schema } from \"effect\";\n\nimport { type Action } from \"../Action.ts\";\nimport { type BrowserError, InvalidRequest, undispatched } from \"../BrowserError.ts\";\nimport type { Page, ReadyOptions, Target } from \"../Page.ts\";\nimport * as Stillness from \"../stillness/Stillness.ts\";\nimport { type Ambiguous, Drifted, type Missing } from \"./choose.ts\";\nimport { type Plan, 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 TakeOptions {\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 TakeOptions {\n readonly from?: number | Stopped | undefined;\n}\n\n/**\n * Input that can be repeated without repeating a commitment. `take` 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 page.until(\n { ...expected.query, scope: \"document\" },\n expected._tag === \"Appeared\" ? \"some\" : \"none\",\n millis,\n ),\n ({ met }) => met,\n );\n }\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 take = Effect.fn(\"Plan.take\")(function* (\n page: Page,\n plan: Plan,\n at: number | Stopped,\n options: TakeOptions = {},\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?.quietMillis === undefined\n ? page.ready(options.settle)\n : Stillness.wait(page, {\n ...options.settle,\n still: \"content\",\n quietMillis: options.settle.quietMillis,\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.clock),\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: Plan,\n options: TakeOptions,\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* take(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/** Take a plan's steps from a fresh index or durable stopping point, returning completed receipts. */\nexport const replay = (page: Page, plan: Plan, options: ReplayOptions = {}) =>\n run(page, plan, options, options.from ?? 0, plan.steps.length, false).pipe(\n Effect.withSpan(\"Plan.replay\"),\n );\n\n/** Restore prior steps on a fresh page; unresolved commitments require positive durable evidence. */\nexport const restore = (\n page: Page,\n plan: Plan,\n options: TakeOptions & { readonly upTo?: number | undefined } = {},\n) =>\n run(page, plan, options, 0, options.upTo ?? plan.steps.length, true).pipe(\n Effect.withSpan(\"Plan.restore\"),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,UAAb,cAA6B,OAAO,YAAqB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CACxE,IAAa,UAAU;EACrB,OAAO;CACT;AACF;;AAGA,IAAa,YAAb,cAA+B,OAAO,YAAuB,CAAC,CAAC,aAAa,EAC1E,OAAO,OAAO,IAChB,CAAC,CAAC,CAAC;CACD,IAAa,UAAU;EACrB,OAAO,GAAG,KAAK,MAAM;CACvB;AACF;;AAGA,IAAa,UAAb,cAA6B,OAAO,YAAqB,CAAC,CAAC,WAAW,EACpE,QAAQ,OAAO,OACjB,CAAC,CAAC,CAAC;CACD,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,UAAU,KAAK,GAAG,OAAO;CACrE,IAAI,UAAU,UAAU,OAAO,QAAQ,KAAA,IAAY,IAA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