effect-browser 0.3.0-beta.20 → 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 (243) hide show
  1. package/README.md +221 -158
  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-wZhwZSlG.d.mts +167 -0
  12. package/dist/Browser.d.mts +2 -129
  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/LICENSE-jpeg-js +28 -0
  38. package/dist/Matching.d.mts +37 -0
  39. package/dist/{match.inpage-xOe9LNO0.mjs → Matching.mjs} +28 -4
  40. package/dist/Matching.mjs.map +1 -0
  41. package/dist/{Page-CfB6Zn1p.mjs → Page-BF5izr8R.mjs} +216 -31
  42. package/dist/Page-BF5izr8R.mjs.map +1 -0
  43. package/dist/{Page-ku6j5t-v.d.mts → Page-CvsOEorc.d.mts} +158 -185
  44. package/dist/Page.d.mts +2 -2
  45. package/dist/Page.mjs +1 -1
  46. package/dist/Released-tURbFmal.d.mts +15 -0
  47. package/dist/{Snapshot-B34hZ4Jl.d.mts → Snapshot-CtBVOtuu.d.mts} +6 -1
  48. package/dist/Snapshot.d.mts +1 -1
  49. package/dist/Snapshot.mjs.map +1 -1
  50. package/dist/Stillness-CNlvayIo.mjs +136 -0
  51. package/dist/Stillness-CNlvayIo.mjs.map +1 -0
  52. package/dist/Style-AO4V7Czt.mjs +357 -0
  53. package/dist/Style-AO4V7Czt.mjs.map +1 -0
  54. package/dist/Style.d.mts +72 -0
  55. package/dist/Style.mjs +2 -0
  56. package/dist/Url.d.mts +26 -0
  57. package/dist/Url.mjs +74 -0
  58. package/dist/Url.mjs.map +1 -0
  59. package/dist/Window-CMddGMt1.d.mts +34 -0
  60. package/dist/Window.d.mts +2 -0
  61. package/dist/Window.mjs +35 -0
  62. package/dist/Window.mjs.map +1 -0
  63. package/dist/connection-2KHI4_KN.d.mts +41 -0
  64. package/dist/connection-BTeO0Hiz.mjs +68 -0
  65. package/dist/connection-BTeO0Hiz.mjs.map +1 -0
  66. package/dist/index.d.mts +15 -17
  67. package/dist/index.mjs +11 -14
  68. package/dist/moment/Moment.d.mts +86 -0
  69. package/dist/{Moment.mjs → moment/Moment.mjs} +44 -38
  70. package/dist/moment/Moment.mjs.map +1 -0
  71. package/dist/{Plan-DJ4hEEna.d.mts → plan/index.d.mts} +169 -64
  72. package/dist/{Plan-C-d5QYS8.mjs → plan/index.mjs} +122 -155
  73. package/dist/plan/index.mjs.map +1 -0
  74. package/dist/{Policy.d.mts → policy/Policy.d.mts} +5 -9
  75. package/dist/{Policy.mjs → policy/Policy.mjs} +11 -21
  76. package/dist/policy/Policy.mjs.map +1 -0
  77. package/dist/presentation/Motion.d.mts +12 -0
  78. package/dist/{Motion.mjs → presentation/Motion.mjs} +4 -27
  79. package/dist/presentation/Motion.mjs.map +1 -0
  80. package/dist/presentation/Presentation.d.mts +30 -0
  81. package/dist/presentation/Presentation.mjs +105 -0
  82. package/dist/presentation/Presentation.mjs.map +1 -0
  83. package/dist/{Stage.d.mts → presentation/Stage.d.mts} +5 -8
  84. package/dist/{Stage.mjs → presentation/Stage.mjs} +68 -76
  85. package/dist/presentation/Stage.mjs.map +1 -0
  86. package/dist/presentation/feed.d.mts +20 -0
  87. package/dist/presentation/feed.mjs +18 -0
  88. package/dist/presentation/feed.mjs.map +1 -0
  89. package/dist/providers/Cdp.d.mts +9 -0
  90. package/dist/providers/Cdp.mjs +15 -0
  91. package/dist/providers/Cdp.mjs.map +1 -0
  92. package/dist/{Chromium.d.mts → providers/Chromium.d.mts} +6 -7
  93. package/dist/{Chromium.mjs → providers/Chromium.mjs} +7 -16
  94. package/dist/providers/Chromium.mjs.map +1 -0
  95. package/dist/providers/Released.d.mts +2 -0
  96. package/dist/providers/Released.mjs +12 -0
  97. package/dist/providers/Released.mjs.map +1 -0
  98. package/dist/stillness/Stillness.d.mts +12 -0
  99. package/dist/stillness/Stillness.mjs +2 -0
  100. package/dist/supervisor/Supervisor.d.mts +104 -0
  101. package/dist/supervisor/Supervisor.mjs +513 -0
  102. package/dist/supervisor/Supervisor.mjs.map +1 -0
  103. package/dist/testing/index.d.mts +337 -0
  104. package/dist/testing/index.mjs +515 -0
  105. package/dist/testing/index.mjs.map +1 -0
  106. package/dist/workerd/Cdp.d.mts +8 -0
  107. package/dist/workerd/Cdp.mjs +13 -0
  108. package/dist/workerd/Cdp.mjs.map +1 -0
  109. package/package.json +94 -33
  110. package/src/Action.ts +127 -0
  111. package/src/ActionPort.ts +128 -0
  112. package/src/Browser.ts +366 -225
  113. package/src/BrowserError.ts +63 -6
  114. package/src/BrowserEvent.ts +26 -25
  115. package/src/Change.ts +0 -2
  116. package/src/{internal/pictures/clock.ts → Clock.ts} +17 -6
  117. package/src/Frame.ts +14 -0
  118. package/src/Geometry.ts +48 -0
  119. package/src/{internal/reading/match.inpage.ts → Matching.ts} +34 -4
  120. package/src/Page.ts +111 -92
  121. package/src/Snapshot.ts +5 -0
  122. package/src/{internal/input/style.ts → Style.ts} +121 -14
  123. package/src/Window.ts +30 -0
  124. package/src/index.ts +8 -13
  125. package/src/internal/input/actions.ts +61 -119
  126. package/src/internal/input/dispatch.ts +3 -3
  127. package/src/internal/input/gate.ts +21 -18
  128. package/src/internal/input/guard.inpage.ts +25 -58
  129. package/src/internal/input/guard.ts +11 -20
  130. package/src/internal/input/keyboard.ts +12 -3
  131. package/src/internal/input/perform.ts +78 -60
  132. package/src/internal/input/pointer.ts +4 -2
  133. package/src/internal/input/settle.ts +7 -5
  134. package/src/internal/input/targets.inpage.ts +1 -1
  135. package/src/internal/input/targets.ts +4 -9
  136. package/src/internal/page/bridge.ts +210 -114
  137. package/src/internal/page/context.ts +23 -73
  138. package/src/internal/page/dialogs.ts +58 -0
  139. package/src/internal/page/identity.ts +6 -23
  140. package/src/internal/page/lane.ts +14 -15
  141. package/src/internal/page/navigation.ts +50 -42
  142. package/src/internal/page/openings.ts +11 -5
  143. package/src/internal/page/page.ts +44 -81
  144. package/src/internal/page/port.ts +125 -0
  145. package/src/internal/{input → page}/replies.ts +1 -1
  146. package/src/internal/page/request-owner.ts +269 -0
  147. package/src/internal/page/requests.ts +357 -0
  148. package/src/internal/page/scripts.ts +124 -0
  149. package/src/internal/pictures/capture.ts +255 -332
  150. package/src/internal/pictures/dimensions.ts +162 -0
  151. package/src/internal/pictures/frame.ts +68 -0
  152. package/src/internal/pictures/pictures.ts +57 -23
  153. package/src/internal/pictures/quiescence.ts +1 -1
  154. package/src/internal/pictures/state.ts +26 -0
  155. package/src/internal/pictures/transport.ts +21 -4
  156. package/src/internal/reading/controls.inpage.ts +5 -70
  157. package/src/internal/reading/expect.inpage.ts +13 -17
  158. package/src/internal/reading/names.inpage.ts +89 -45
  159. package/src/internal/reading/outline.inpage.ts +6 -7
  160. package/src/internal/reading/reading.ts +144 -176
  161. package/src/internal/reading/ready.inpage.ts +6 -17
  162. package/src/internal/reading/ready.ts +13 -135
  163. package/src/internal/reading/subjects.inpage.ts +83 -43
  164. package/src/internal/reading/walk.inpage.ts +33 -13
  165. package/src/internal/timeline/changes.ts +55 -6
  166. package/src/internal/timeline/events.ts +15 -5
  167. package/src/internal/timeline/history.inpage.ts +1 -1
  168. package/src/internal/timeline/record.inpage.ts +4 -1
  169. package/src/internal/timeline/window.ts +2 -1
  170. package/src/{Moment.ts → moment/Moment.ts} +13 -31
  171. package/src/{internal/timeline → moment}/words.ts +2 -2
  172. package/src/{internal/reading → plan}/choose.ts +3 -3
  173. package/src/plan/data.ts +117 -0
  174. package/src/plan/execute.ts +411 -0
  175. package/src/plan/index.ts +36 -0
  176. package/src/plan/record.ts +71 -0
  177. package/src/plan/targets.ts +71 -0
  178. package/src/{Policy.ts → policy/Policy.ts} +13 -10
  179. package/src/{Motion.ts → presentation/Motion.ts} +12 -46
  180. package/src/presentation/Presentation.ts +176 -0
  181. package/src/{Stage.ts → presentation/Stage.ts} +147 -112
  182. package/src/presentation/feed.ts +21 -0
  183. package/src/providers/Cdp.ts +16 -0
  184. package/src/{Chromium.ts → providers/Chromium.ts} +7 -10
  185. package/src/providers/Released.ts +13 -0
  186. package/src/providers/connection.ts +134 -0
  187. package/src/{internal/pictures/motion.ts → stillness/Pixels.ts} +4 -4
  188. package/src/stillness/Stillness.ts +166 -0
  189. package/src/supervisor/Supervisor.ts +170 -0
  190. package/src/supervisor/contract.ts +105 -0
  191. package/src/supervisor/lifecycle.ts +272 -0
  192. package/src/supervisor/runtime.ts +234 -0
  193. package/src/testing/TestBrowser.ts +115 -0
  194. package/src/testing/TestPage.ts +10 -0
  195. package/src/testing/evidence.ts +154 -0
  196. package/src/testing/index.ts +3 -0
  197. package/src/testing/model.ts +222 -0
  198. package/src/testing/page.ts +360 -0
  199. package/src/workerd/Cdp.ts +11 -0
  200. package/dist/Browser-BwCldIff.mjs +0 -629
  201. package/dist/Browser-BwCldIff.mjs.map +0 -1
  202. package/dist/Cdp.d.mts +0 -32
  203. package/dist/Cdp.mjs +0 -61
  204. package/dist/Cdp.mjs.map +0 -1
  205. package/dist/Change-DNvztNLu.mjs +0 -138
  206. package/dist/Change-DNvztNLu.mjs.map +0 -1
  207. package/dist/Chromium.mjs.map +0 -1
  208. package/dist/Expect.d.mts +0 -62
  209. package/dist/Expect.mjs +0 -114
  210. package/dist/Expect.mjs.map +0 -1
  211. package/dist/Moment.d.mts +0 -2
  212. package/dist/Moment.mjs.map +0 -1
  213. package/dist/Motion.d.mts +0 -2
  214. package/dist/Motion.mjs.map +0 -1
  215. package/dist/Page-CfB6Zn1p.mjs.map +0 -1
  216. package/dist/Plan-C-d5QYS8.mjs.map +0 -1
  217. package/dist/Plan.d.mts +0 -2
  218. package/dist/Plan.mjs +0 -2
  219. package/dist/Policy.mjs.map +0 -1
  220. package/dist/Presentation.d.mts +0 -48
  221. package/dist/Presentation.mjs +0 -118
  222. package/dist/Presentation.mjs.map +0 -1
  223. package/dist/Stage.mjs.map +0 -1
  224. package/dist/Supervisor-2mPjIYYs.mjs +0 -676
  225. package/dist/Supervisor-2mPjIYYs.mjs.map +0 -1
  226. package/dist/Supervisor-mVPeEUp8.d.mts +0 -317
  227. package/dist/Supervisor.d.mts +0 -2
  228. package/dist/Supervisor.mjs +0 -2
  229. package/dist/context-w3NJPRLo.mjs +0 -335
  230. package/dist/context-w3NJPRLo.mjs.map +0 -1
  231. package/dist/match.inpage-xOe9LNO0.mjs.map +0 -1
  232. package/dist/page-BKwfF6z-.mjs +0 -5099
  233. package/dist/page-BKwfF6z-.mjs.map +0 -1
  234. package/dist/url-Cd04Okid.mjs +0 -264
  235. package/dist/url-Cd04Okid.mjs.map +0 -1
  236. package/src/Cdp.ts +0 -101
  237. package/src/Expect.ts +0 -180
  238. package/src/Plan.ts +0 -674
  239. package/src/Presentation.ts +0 -196
  240. package/src/Supervisor.ts +0 -632
  241. package/src/internal/supervisor/lifecycle.ts +0 -484
  242. /package/src/{internal/page/url.ts → Url.ts} +0 -0
  243. /package/src/{internal/pictures → stillness}/utilsBundle.d.ts +0 -0
@@ -1,12 +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-w3NJPRLo.mjs";
6
- import { p as redacted } from "./Page-CfB6Zn1p.mjs";
7
- import { t as match } from "./match.inpage-xOe9LNO0.mjs";
8
- import { Duration, Effect, Exit, Option, Schedule, Schema } from "effect";
9
- //#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
10
9
  /**
11
10
  * Choosing the one element a recorded subject names, among those `find` gives for its role and
12
11
  * name. Context tells them apart, and an element that does not repeat every part of the recorded
@@ -79,60 +78,10 @@ const choose = (subject, found) => {
79
78
  return top.length === 1 && only !== void 0 ? Effect.succeed(only.one) : Effect.fail(new Ambiguous({ count: top.length }));
80
79
  };
81
80
  //#endregion
82
- //#region src/Plan.ts
83
- /**
84
- * A walk recorded once from a page's events and replayed later, on a fresh page, with no model
85
- * call.
86
- *
87
- * `fromEvents` keeps one page's completed actions with their subjects and the options they were
88
- * given, its navigations with both the address asked for and the one reached, and what was typed
89
- * as a named input slot, never the text itself. A navigation to an address whose credentials the
90
- * events withheld is an input slot too, so replay goes where the caller says, or nowhere, and
91
- * never to the address without them. `replay` takes the steps in turn. Before a step
92
- * except an opening navigate, back or reload, it waits for `Page.ready`; then it finds the element its
93
- * subject names, by role and name among those that repeat all its recorded context, and acts on
94
- * it. Text typed into focus was typed into the focused field, which replay finds the same way, and
95
- * text typed into a secret field goes into nothing else. An element step never falls back to
96
- * coordinates, and a step recorded at a point acts there only while the element found for it still
97
- * covers that point. `take` and `replay` return receipts; failure preserves a stopping point and
98
- * earlier receipts. Unknown consequential input is never resent. Only a positive durable read-back
99
- * can reconcile it; restoration follows the same rule. The consumer journals begun steps before
100
- * calling, treating interruption or a missing receipt as unknown. Plain recordings use version 1;
101
- * authored expected effects use version 2. Old 0.2 plans and unknown versions do not decode.
102
- *
103
- * @since 0.3.0
104
- */
105
- var Plan_exports = /* @__PURE__ */ __exportAll({
106
- Ambiguous: () => Ambiguous,
107
- Drifted: () => Drifted,
108
- Expected: () => Expected,
109
- Missing: () => Missing,
110
- Plan: () => Plan,
111
- Receipt: () => Receipt,
112
- ReplayError: () => ReplayError,
113
- Step: () => Step,
114
- StepAction: () => StepAction,
115
- Stopped: () => Stopped,
116
- Uncertain: () => Uncertain,
117
- fromEvents: () => fromEvents,
118
- locate: () => locate,
119
- repeatable: () => repeatable,
120
- replay: () => replay,
121
- restore: () => restore,
122
- take: () => take
123
- });
124
- const StepAction = Schema.Literals([
125
- "navigate",
126
- "back",
127
- "reload",
128
- "click",
129
- "hover",
130
- "drag",
131
- "type",
132
- "press",
133
- "scroll",
134
- "select"
135
- ]);
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"));
136
85
  const Query = Schema.Struct({
137
86
  role: Schema.optional(Schema.String),
138
87
  name: Schema.optional(Schema.String),
@@ -165,41 +114,26 @@ const Expected = Schema.Union([
165
114
  ]);
166
115
  /** One recorded step: the action, what it acted on, and what else it was asked. */
167
116
  var Step = class extends Schema.Class("effect-browser/Plan/Step")({
168
- action: StepAction,
169
- /**
170
- * The ending address, or a later recorded navigation before the next action began. Empty when
171
- * unknown; a delayed navigation can be stronger arrival evidence than the action's ending URL.
172
- */
117
+ action: ReplayAction,
118
+ /** The address reached, including a delayed navigation before the next action began. */
173
119
  url: Schema.String,
174
- /** A navigation's requested address, or the keys a press pressed. */
175
- target: Schema.optional(Schema.String),
176
120
  subject: Schema.optional(Subject),
177
121
  /** Where a drag ended. */
178
122
  to: Schema.optional(Subject),
179
- /** The viewport point a step aimed at, when it aimed at a point, and a drag's end point. */
180
- point: Schema.optional(Point),
181
- toPoint: Schema.optional(Point),
182
- /** 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. */
183
124
  box: Schema.optional(Box),
184
- /**
185
- * The input slot whose text a `type` step types, or whose address a `navigate` step goes to, as
186
- * its recorded address had a credential withheld.
187
- */
125
+ /** A slot replaces recorded typing text or a navigation address with withheld credentials. */
188
126
  input: Schema.optional(Schema.String),
189
- /** The slot's text went into a secret field, so replay types it into nothing else. */
190
- secret: Schema.optional(Schema.Literal(true)),
191
- options: Schema.optional(ActionOptions),
192
127
  expect: Schema.optional(Expected)
193
128
  }) {};
194
- const PlanData = Schema.Struct({
195
- version: Schema.Literals([1, 2]),
129
+ var Plan = class Plan extends Schema.Class("effect-browser/Plan")({
130
+ version: Schema.Literal(3),
196
131
  steps: Schema.Array(Step)
197
- }).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"));
198
- var Plan = class Plan extends Schema.Class("effect-browser/Plan")(PlanData) {
199
- /** 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. */
200
134
  static new(steps) {
201
135
  return new Plan({
202
- version: steps.some((step) => step.expect !== void 0) ? 2 : 1,
136
+ version: 3,
203
137
  steps
204
138
  });
205
139
  }
@@ -253,14 +187,10 @@ var ReplayError = class extends Schema.TaggedError()("ReplayError", {
253
187
  return `step ${this.step} failed: ${this.reason.message}`;
254
188
  }
255
189
  };
256
- const isStep = (event) => event._tag === "Action" && event.ok && StepAction.literals.includes(event.name);
257
- const pointIn = (target) => {
258
- const parsed = /^\{?(?:"x":)?(-?[\d.]+),(?:"y":)?(-?[\d.]+)\}?$/.exec(target ?? "");
259
- return parsed === null ? void 0 : {
260
- x: Number(parsed[1]),
261
- y: Number(parsed[2])
262
- };
263
- };
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";
264
194
  /** A slot named for the field it fills, such as `email`, unique within the plan. */
265
195
  const slotFor = (taken, field) => {
266
196
  const base = field?.toLowerCase().match(/[\p{L}\p{N}]+/gu)?.join("-") ?? "input";
@@ -283,28 +213,31 @@ const fromEvents = (events) => {
283
213
  const taken = /* @__PURE__ */ new Set();
284
214
  const before = (time) => moves.findLast((move) => move.at <= time)?.url ?? opened;
285
215
  return new Plan({
286
- version: 1,
216
+ version: 3,
287
217
  steps: steps.map((action, index) => {
288
- const drag = action.name === "drag" ? (action.target ?? "").split(" -> ") : void 0;
289
- 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;
290
221
  const until = steps[index + 1]?.startedAt ?? Number.POSITIVE_INFINITY;
291
222
  const arrival = moves.findLast((move) => move.at > action.at && move.at <= until);
292
223
  return new Step({
293
- action: action.name,
224
+ action: value._tag === "Type" ? {
225
+ ...value,
226
+ text: ""
227
+ } : value,
294
228
  url: arrival?.url ?? action.url ?? before(until),
295
- target: action.name === "navigate" || action.name === "press" ? action.target : void 0,
296
229
  subject: action.subject,
297
230
  to: action.to,
298
- point,
299
- toPoint: pointIn(drag?.[1]),
300
231
  box: point === void 0 ? void 0 : action.box,
301
- input: action.name === "type" ? slotFor(taken, action.subject?.name) : action.name === "navigate" && action.target?.includes(redacted) === true ? slotFor(taken, "address") : void 0,
302
- secret: action.name === "type" && action.text === redacted ? true : void 0,
303
- 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
304
233
  });
305
234
  })
306
235
  });
307
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 }));
308
241
  /**
309
242
  * The one element on the page that a subject names, by role, name and context (see `Plan`),
310
243
  * looking again for two seconds while the page may still be drawing it.
@@ -317,15 +250,14 @@ const locate = (page, subject) => page.find({
317
250
  schedule: Schedule.spaced(Duration.millis(250)),
318
251
  times: 8,
319
252
  while: (error) => error._tag !== "BrowserError"
320
- }), Effect.withSpan("Plan.locate", { attributes: { role: subject.role ?? "" } }));
321
- const invalid = (detail) => undispatched("replay", new InvalidRequest({ detail }));
253
+ }), Effect.provideService(Clock.Clock, page.clock), Effect.withSpan("Plan.locate", { attributes: { role: subject.role ?? "" } }));
322
254
  /**
323
255
  * Where the step acts: the element its subject names, or, for a step recorded at a point, the same
324
256
  * place within that element, as long as a press there reaches that element and not one over it.
325
257
  * An element out of view is first brought into it, by hovering it, as a press by ref would be.
326
258
  */
327
259
  const aim = (page, subject, point, recorded) => {
328
- 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"));
329
261
  if (point === void 0) return Effect.map(locate(page, subject), ({ ref }) => ref);
330
262
  const reach = ({ ref, box }) => {
331
263
  const at = recorded === void 0 || recorded.width <= 0 || recorded.height <= 0 ? point : {
@@ -337,44 +269,70 @@ const aim = (page, subject, point, recorded) => {
337
269
  const missed = new Drifted({ detail: "a press at the subject's point reaches another element" });
338
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))))));
339
271
  };
340
- const dispatch = (page, step, text) => {
341
- const options = step.options ?? {};
342
- switch (step.action) {
343
- case "navigate": return page.goto(step.input === void 0 ? step.target ?? step.url : text);
344
- case "back": return page.back;
345
- case "reload": return page.reload;
346
- case "press": return step.subject === void 0 ? page.press(step.target ?? "", options) : Effect.flatMap(locate(page, step.subject), ({ ref }) => page.press(step.target ?? "", {
347
- ...options,
348
- on: ref
349
- }));
350
- case "click": return aim(page, step.subject, step.point, step.box).pipe(Effect.flatMap((at) => page.click(at, options)), Effect.asVoid);
351
- case "hover": return Effect.flatMap(aim(page, step.subject, step.point, step.box), page.hover);
352
- 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)));
353
- case "select": return aim(page, step.subject).pipe(Effect.flatMap((at) => page.select(typeof at === "string" ? at : "", options.values ?? [])), Effect.asVoid);
354
- case "scroll": return step.subject === void 0 ? page.scroll(options) : Effect.flatMap(aim(page, step.subject, step.point, step.box), (at) => page.scroll({
355
- ...options,
356
- at
357
- }));
358
- case "type": return step.subject === void 0 ? page.type(text, {
359
- ...options,
360
- secret: step.secret
361
- }) : Effect.flatMap(aim(page, step.subject), (into) => page.type(text, {
362
- ...options,
363
- into: typeof into === "string" ? into : void 0,
364
- secret: step.secret
365
- }));
366
- }
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);
367
325
  };
368
326
  /**
369
327
  * Input that can be repeated without repeating a commitment. `take` also validates a Checked
370
328
  * target's boolean state before input. Back/reload can resubmit a form.
371
329
  */
372
330
  const repeatable = (step) => [
373
- "navigate",
374
- "hover",
375
- "scroll",
376
- "select"
377
- ].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";
378
336
  const within = (check, millis) => millis === 0 ? check : check.pipe(Effect.repeat({
379
337
  until: (held) => held,
380
338
  schedule: Schedule.spaced(Duration.millis(25))
@@ -387,19 +345,19 @@ const sameSite = (url, recorded) => {
387
345
  return recorded === "" || (origin === void 0 || origin === "null" ? url === recorded : URL.parse(url)?.origin === origin);
388
346
  };
389
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);
390
- const checkEffect = (page, step, first) => {
348
+ const checkEffect = (page, step, first, millis = 0) => {
391
349
  const expected = step.expect;
392
350
  if (expected === void 0) return Effect.succeed(false);
393
351
  switch (expected._tag) {
394
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));
395
353
  case "Navigated":
396
354
  if (expected.url === void 0 && first === void 0) return Effect.succeed(false);
397
- 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);
398
356
  case "Appeared":
399
- case "Gone": return Effect.map(page.find({
357
+ case "Gone": return Effect.map(page.until({
400
358
  ...expected.query,
401
359
  scope: "document"
402
- }), (found) => expected._tag === "Appeared" ? found.length > 0 : found.length === 0);
360
+ }, expected._tag === "Appeared" ? "some" : "none", millis), ({ met }) => met);
403
361
  }
404
362
  };
405
363
  /**
@@ -413,6 +371,7 @@ const take = Effect.fn("Plan.take")(function* (page, plan, at, options = {}) {
413
371
  return yield* Effect.gen(function* () {
414
372
  const step = plan.steps[index];
415
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");
416
375
  const duration = Duration.fromInput(options.arrival ?? Duration.seconds(5));
417
376
  if (Option.isNone(duration) || Duration.isNegative(duration.value) || !Duration.isFinite(duration.value)) return yield* invalid("arrival must be a finite nonnegative duration");
418
377
  const millis = Duration.toMillis(duration.value);
@@ -423,10 +382,14 @@ const take = Effect.fn("Plan.take")(function* (page, plan, at, options = {}) {
423
382
  const durable = expected !== void 0 && (expected._tag === "Appeared" || expected._tag === "Navigated" && typeof expected.url === "string") && expected.durable === true;
424
383
  if (!durable && (unresolved || expected !== void 0 && "durable" in expected && expected.durable === true)) return yield* uncertain;
425
384
  if (options.settle !== false && (index > 0 || ![
426
- "navigate",
427
- "back",
428
- "reload"
429
- ].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
+ });
430
393
  const before = plan.steps[index - 1]?.url;
431
394
  if (before !== void 0) yield* arrived(page, unresolved ? [before, step.url] : [before], millis);
432
395
  const check = checkEffect(page, step);
@@ -448,23 +411,27 @@ const take = Effect.fn("Plan.take")(function* (page, plan, at, options = {}) {
448
411
  if (unresolved) return yield* uncertain;
449
412
  const text = step.input === void 0 ? "" : options.inputs?.[step.input];
450
413
  if (text === void 0) return yield* invalid(`no text for the input "${step.input ?? ""}"`);
451
- const verify = checkEffect(page, step, yield* page.state);
452
- 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));
453
420
  if (Exit.isFailure(acted)) {
454
421
  const error = Exit.findErrorOption(acted);
455
422
  if (Option.isSome(error) && error.value._tag === "BrowserError" && error.value.dispatched) {
456
423
  input = "unknown";
457
424
  if (expected !== void 0 && (repeatable(step) || durable)) {
458
- const observed = yield* Effect.exit(within(verify, millis));
425
+ const observed = yield* Effect.exit(verify);
459
426
  if (Exit.isSuccess(observed) && observed.value) return yield* receipt("verified");
460
427
  }
461
428
  }
462
429
  return yield* Effect.failCause(acted.cause);
463
430
  }
464
431
  input = "unknown";
465
- 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" });
466
433
  return yield* receipt(expected === void 0 ? "taken" : "verified");
467
- }).pipe(Effect.mapError((reason) => new ReplayError({
434
+ }).pipe(Effect.provideService(Clock.Clock, page.clock), Effect.mapError((reason) => new ReplayError({
468
435
  step: index,
469
436
  reason,
470
437
  input,
@@ -507,6 +474,6 @@ const replay = (page, plan, options = {}) => run(page, plan, options, options.fr
507
474
  /** Restore prior steps on a fresh page; unresolved commitments require positive durable evidence. */
508
475
  const restore = (page, plan, options = {}) => run(page, plan, options, 0, options.upTo ?? plan.steps.length, true).pipe(Effect.withSpan("Plan.restore"));
509
476
  //#endregion
510
- 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 };
511
478
 
512
- //# sourceMappingURL=Plan-C-d5QYS8.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,KAA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,QAAQ,QAAQ,qCAAqC;CACvD,CAAC;CAEH,IAAI,CAAC,aAAa,OAAO,SAAS,UAAU;EAC1C,MAAM,WAAW,KAAK,MAAM,WACzB,MAAM,UACL,SAAS,SAAS,KAAK,UAAU,KAAA,KAAa,QAAQ,SAAS,KAAK,WAAW,KAAA,CACnF;EAEA,IAAI,aAAa,IACf,OAAO,OAAO,IAAI,YAAY;GAC5B,MAAM;GACN,OAAO;GACP;GACA,QAAQ,QAAQ,0BAA0B,KAAK,MAAM,SAAS,EAAE,SAAS,GAAG,EAAE;EAChF,CAAC;CACL;CACA,KAAK,IAAI,QAAQ,OAAO,QAAQ,OAAO,SAAS;EAC9C,MAAM,KAAK,YACP,IAAI,QAAQ;GAAE,MAAM;GAAO,OAAO;EAAU,CAAC,IAC7C,UAAU,QACR,OACA;EAEN,MAAM,UAAU,OAAO,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,CAAC,KACnD,OAAO,UAAU,UAAU,IAAI,YAAY;GAAE,GAAG;GAAO,UAAU,CAAC,GAAG,QAAQ;EAAE,CAAC,CAAC,CACnF;EAEA,SAAS,KAAK,OAAO;CACvB;CAEA,OAAO;AACT,CAAC;;AAGD,MAAa,UAAU,MAAY,MAAY,UAAyB,CAAC,MACvE,IAAI,MAAM,MAAM,SAAS,QAAQ,QAAQ,GAAG,KAAK,MAAM,QAAQ,KAAK,CAAC,CAAC,KACpE,OAAO,SAAS,aAAa,CAC/B;;AAGF,MAAa,WACX,MACA,MACA,UAAgE,CAAC,MAEjE,IAAI,MAAM,MAAM,SAAS,GAAG,QAAQ,QAAQ,KAAK,MAAM,QAAQ,IAAI,CAAC,CAAC,KACnE,OAAO,SAAS,cAAc,CAChC"}
@@ -1,9 +1,7 @@
1
- import { c as InputGuard, i as Fact, l as InputRequest } from "./Page-ku6j5t-v.mjs";
1
+ import { d as InputRequest, o as Fact, u as InputGuard } from "../Page-CvsOEorc.mjs";
2
2
  import { Context, Duration, Effect, Schema } from "effect";
3
3
  import { AiError, DecisionModel, LanguageModel } from "effect/ai";
4
- declare namespace Policy_d_exports {
5
- export { Judge, Judgement, Options, Risk, Task, decider, escalate, make, reviewer };
6
- }
4
+ //#region src/policy/Policy.d.ts
7
5
  /** What an input means. Only a judge reading the evidence can recognise these. */
8
6
  export declare const Risk: Schema.Literals<readonly ["financial", "account", "access", "deletion", "communication", "secret"]>;
9
7
  export type Risk = typeof Risk.Type;
@@ -25,7 +23,7 @@ declare const Judgement_base: Schema.Class<Judgement, Schema.Struct<{
25
23
  /** A judge's reading of one input. */
26
24
  export declare class Judgement extends Judgement_base {}
27
25
  /**
28
- * The user's task: what authorizes a risky input. `Agent.run` provides its task to every input it
26
+ * The user's task: what authorizes a risky input. `PageControl` provides its task to every input it
29
27
  * makes; provide one around other calls with `Effect.provideService`.
30
28
  */
31
29
  export declare const Task: Context.Reference<string | undefined>;
@@ -58,7 +56,7 @@ export interface Options {
58
56
  readonly deny?: ReadonlyArray<Fact> | undefined;
59
57
  /** Origins input may act on and go to, such as `"https://shop.example"`. Defaults to any. */
60
58
  readonly origins?: ReadonlyArray<string> | undefined;
61
- /** The probability from which a judge's reading counts. Defaults to 0.5. */
59
+ /** The probability from which a judge's reading counts: finite, greater than 0, at most 1. Defaults to 0.5. */
62
60
  readonly threshold?: number | undefined;
63
61
  /** How long the judge may take before the input counts as unjudged. Defaults to 30 seconds. */
64
62
  readonly timeout?: Duration.Input | undefined;
@@ -67,10 +65,8 @@ export interface Options {
67
65
  * A guard for a browser with nobody to ask. It allows hovering and scrolling. Otherwise it denies
68
66
  * input on a page or towards a destination outside `origins`, input with a fact in `deny`, and,
69
67
  * when a judge finds a risk, input the task does not ask for. An input the judge could not judge
70
- * in time is denied when it has any fact, with the judge's failure as the denial's cause, and
71
- * allowed when structure shows nothing.
68
+ * in time is denied with the judge's failure as the denial's cause.
72
69
  */
73
70
  export declare const make: (options?: Options) => InputGuard;
74
71
  //#endregion
75
- export { Policy_d_exports as t };
76
72
  //# sourceMappingURL=Policy.d.mts.map