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

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 (249) 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-BKPAbyys.mjs +4076 -0
  10. package/dist/Browser-BKPAbyys.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-CK83pvqP.mjs} +5 -6
  64. package/dist/connection-CK83pvqP.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 +515 -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 +89 -39
  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/identity.ts +6 -5
  139. package/src/internal/page/lane.ts +14 -15
  140. package/src/internal/page/navigation.ts +50 -42
  141. package/src/internal/page/openings.ts +11 -5
  142. package/src/internal/page/page.ts +44 -81
  143. package/src/internal/page/port.ts +125 -0
  144. package/src/internal/{input → page}/replies.ts +1 -1
  145. package/src/internal/page/request-owner.ts +269 -0
  146. package/src/internal/page/requests.ts +357 -0
  147. package/src/internal/page/scripts.ts +124 -0
  148. package/src/internal/pictures/capture.ts +255 -332
  149. package/src/internal/pictures/dimensions.ts +162 -0
  150. package/src/internal/pictures/frame.ts +68 -0
  151. package/src/internal/pictures/pictures.ts +57 -23
  152. package/src/internal/pictures/quiescence.ts +1 -1
  153. package/src/internal/pictures/state.ts +26 -0
  154. package/src/internal/pictures/transport.ts +21 -4
  155. package/src/internal/reading/controls.inpage.ts +5 -70
  156. package/src/internal/reading/expect.inpage.ts +13 -17
  157. package/src/internal/reading/names.inpage.ts +89 -45
  158. package/src/internal/reading/outline.inpage.ts +6 -7
  159. package/src/internal/reading/reading.ts +144 -176
  160. package/src/internal/reading/ready.inpage.ts +6 -17
  161. package/src/internal/reading/ready.ts +13 -135
  162. package/src/internal/reading/subjects.inpage.ts +83 -43
  163. package/src/internal/reading/walk.inpage.ts +33 -13
  164. package/src/internal/timeline/changes.ts +55 -6
  165. package/src/internal/timeline/events.ts +15 -5
  166. package/src/internal/timeline/history.inpage.ts +1 -1
  167. package/src/internal/timeline/record.inpage.ts +4 -1
  168. package/src/internal/timeline/window.ts +2 -1
  169. package/src/{Moment.ts → moment/Moment.ts} +13 -31
  170. package/src/{internal/timeline → moment}/words.ts +2 -2
  171. package/src/{internal/reading → plan}/choose.ts +3 -3
  172. package/src/plan/data.ts +117 -0
  173. package/src/plan/execute.ts +411 -0
  174. package/src/plan/index.ts +36 -0
  175. package/src/plan/record.ts +71 -0
  176. package/src/plan/targets.ts +71 -0
  177. package/src/{Policy.ts → policy/Policy.ts} +13 -10
  178. package/src/{Motion.ts → presentation/Motion.ts} +12 -46
  179. package/src/presentation/Presentation.ts +176 -0
  180. package/src/{Stage.ts → presentation/Stage.ts} +147 -112
  181. package/src/presentation/feed.ts +21 -0
  182. package/src/{Cdp.ts → providers/Cdp.ts} +2 -2
  183. package/src/{Chromium.ts → providers/Chromium.ts} +7 -10
  184. package/src/providers/Released.ts +13 -0
  185. package/src/{internal/cdp.ts → providers/connection.ts} +2 -2
  186. package/src/{internal/pictures/motion.ts → stillness/Pixels.ts} +1 -1
  187. package/src/stillness/Stillness.ts +166 -0
  188. package/src/supervisor/Supervisor.ts +170 -0
  189. package/src/supervisor/contract.ts +105 -0
  190. package/src/supervisor/lifecycle.ts +272 -0
  191. package/src/supervisor/runtime.ts +238 -0
  192. package/src/testing/TestBrowser.ts +115 -0
  193. package/src/testing/TestPage.ts +10 -0
  194. package/src/testing/evidence.ts +154 -0
  195. package/src/testing/index.ts +3 -0
  196. package/src/testing/model.ts +222 -0
  197. package/src/testing/page.ts +360 -0
  198. package/src/workerd/Cdp.ts +2 -2
  199. package/dist/Browser-CxXUjxOp.mjs +0 -619
  200. package/dist/Browser-CxXUjxOp.mjs.map +0 -1
  201. package/dist/Cdp-CzCRnMlM.d.mts +0 -10
  202. package/dist/Cdp.d.mts +0 -11
  203. package/dist/Cdp.mjs.map +0 -1
  204. package/dist/Change-DNvztNLu.mjs +0 -138
  205. package/dist/Change-DNvztNLu.mjs.map +0 -1
  206. package/dist/Chromium.mjs.map +0 -1
  207. package/dist/Expect-u3P_ENLX.d.mts +0 -62
  208. package/dist/Expect.d.mts +0 -2
  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-BP02bmNv.mjs +0 -264
  216. package/dist/Page-BP02bmNv.mjs.map +0 -1
  217. package/dist/Plan-BG1WifW2.mjs.map +0 -1
  218. package/dist/Plan.d.mts +0 -2
  219. package/dist/Plan.mjs +0 -2
  220. package/dist/Policy.d.mts +0 -2
  221. package/dist/Policy.mjs.map +0 -1
  222. package/dist/Presentation-DxVikn9_.d.mts +0 -48
  223. package/dist/Presentation.d.mts +0 -2
  224. package/dist/Presentation.mjs +0 -118
  225. package/dist/Presentation.mjs.map +0 -1
  226. package/dist/Stage.d.mts +0 -2
  227. package/dist/Stage.mjs.map +0 -1
  228. package/dist/Supervisor-2mPjIYYs.mjs +0 -676
  229. package/dist/Supervisor-2mPjIYYs.mjs.map +0 -1
  230. package/dist/Supervisor-CfRxbaso.d.mts +0 -317
  231. package/dist/Supervisor.d.mts +0 -2
  232. package/dist/Supervisor.mjs +0 -2
  233. package/dist/cdp-BMpYMWYe.mjs.map +0 -1
  234. package/dist/context-EGhOqjNN.mjs +0 -335
  235. package/dist/context-EGhOqjNN.mjs.map +0 -1
  236. package/dist/page-PTM8m5wC.mjs +0 -4057
  237. package/dist/page-PTM8m5wC.mjs.map +0 -1
  238. package/dist/url-Bsp2y55M.mjs +0 -264
  239. package/dist/url-Bsp2y55M.mjs.map +0 -1
  240. package/dist/workerd/index.d.mts +0 -16
  241. package/dist/workerd/index.mjs +0 -17
  242. package/src/Expect.ts +0 -180
  243. package/src/Plan.ts +0 -674
  244. package/src/Presentation.ts +0 -196
  245. package/src/Supervisor.ts +0 -632
  246. package/src/internal/supervisor/lifecycle.ts +0 -484
  247. package/src/workerd/index.ts +0 -17
  248. /package/src/{internal/page/url.ts → Url.ts} +0 -0
  249. /package/src/{internal/pictures → stillness}/utilsBundle.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Moment.mjs","names":[],"sources":["../../src/moment/words.ts","../../src/moment/Moment.ts"],"sourcesContent":["/**\n * What changed on a page, in words for a model: a change with where it is, and what it is. A moment\n * tells its changes this way, and a tool's receipt the changes its action caused.\n */\nimport type { Subject, SubjectContext } from \"../BrowserEvent.ts\";\nimport type { Change } from \"../Change.ts\";\n\nexport const quoted = (value: string | undefined) => JSON.stringify(value ?? \"\");\n\n/** A subject in words, such as `button \"Play\"`; one without a name says where it was. */\nexport const named = (subject: Subject, point: string | undefined) => {\n const kind = subject.role ?? subject.tag;\n\n if (subject.name !== \"\") return `${kind} ${JSON.stringify(subject.name)}`;\n\n return point === undefined ? kind : `${kind} at ${point}`;\n};\n\n/** A change's context in words: `row \"Ether\", column \"1h\"` or `beside \"Price\", under \"Bitcoin\"`. */\nexport const where = ({ row, column, label, heading }: SubjectContext, grouped = false) => {\n const parts = [\n row === undefined ? \"\" : `row ${quoted(row)}`,\n column === undefined || grouped ? \"\" : `column ${quoted(column)}`,\n label === undefined ? \"\" : `beside ${quoted(label)}`,\n heading === undefined || grouped ? \"\" : `under ${quoted(heading)}`,\n ].filter((part) => part !== \"\");\n\n return parts.length === 0 ? \"\" : ` (${parts.join(\", \")})`;\n};\n\n/** A change in words, such as `\"$61,240\" became \"$62,010\" (row \"Bitcoin\", column \"Price\")`. */\nexport const describe = (change: Change, grouped = false): string => {\n const { subject, before, after, count, lowest, highest } = change;\n const context = where(subject.context, grouped);\n\n const range =\n lowest === undefined || highest === undefined ? \"\" : `, from ${lowest} to ${highest}`;\n\n const times = count > 1 ? ` (it changed ${count} times${range})` : \"\";\n\n switch (change.kind) {\n case \"title\":\n return `the title ${before === undefined ? \"now reads\" : `${quoted(before)} became`} ${quoted(after)}`;\n case \"value\": {\n const field = named(subject, undefined);\n\n if (after === \"checked\" || after === \"not checked\") return `${field} is now ${after}`;\n if (after === undefined || after === \"\") return `${field} was cleared`;\n\n return after === \"••••\" || before === undefined || before === \"\"\n ? `${field} was ${after === \"••••\" ? \"edited\" : `set to ${quoted(after)}`}`\n : `${field} changed from ${quoted(before)} to ${quoted(after)}`;\n }\n case \"appeared\":\n return `${quoted(after)} appeared${context}`;\n case \"disappeared\":\n return `${quoted(before)} disappeared${context}`;\n case \"brief\":\n return `${quoted(after)} appeared and went away again${context}`;\n case \"text\":\n return before === undefined\n ? `now reads ${quoted(after)}${context}${times}`\n : `${quoted(before)} became ${quoted(after)}${context}${times}`;\n }\n};\n","/**\n * What a page showed, and what changed on it, over a window of time.\n *\n * A page's timeline has three tracks on its browser's host clock: its events, what visibly changed\n * on it (`Change`), and its screencast frames. A `Window` holds the three from `since` to `until`,\n * and says why a part it could not read is missing rather than fail. `Page.window` takes one, which\n * can end in the past, at a frame a delayed consumer airs late, so that a line written now tells\n * what its viewers will see. Its `account` says what was so at its end: how long the page had been\n * still, which of its changes were still under way, and which had settled.\n *\n * A `Moment` is a window that ends at a picture of the page now: `capture` takes the picture, then\n * the window up to it, and on request the page's outline. `toPrompt` turns a moment into one user\n * message for any `effect/ai` call: a structured answer from `LanguageModel.generateObject`, a\n * caption from `generateText`, or one turn of a `Chat` that follows moment after moment. It leads\n * with what changed, news and what settled before what was still changing, as its account tells\n * them apart, and names an action as what a change followed; as a step where changes followed it\n * but none names it, or where its effect is drawn rather than written, as on a canvas, which only\n * the screenshots show; and claims nothing of what changed where the record did not see, or of a\n * part it could not read, which it names with why.\n *\n * Frames come from a running screencast, as far back as the browser's `frameHistory` keeps them.\n * A moment's picture is the newest frame if it was painted after the page's latest input and\n * completed action, at most 250 ms ago, else a new screenshot timed by its capture.\n *\n * @since 0.3.0\n */\nimport { Duration, Effect, Option, Result, Schema } from \"effect\";\nimport { Prompt } from \"effect/ai\";\n\nimport { refuse } from \"../BrowserError.ts\";\nimport { type Action } from \"../BrowserEvent.ts\";\nimport { type Change, type Changes } from \"../Change.ts\";\nimport { type Frame } from \"../Frame.ts\";\nimport type * as Page from \"../Page.ts\";\nimport { Snapshot, type SnapshotOptions } from \"../Snapshot.ts\";\nimport { describe, named, quoted, where } from \"./words.ts\";\n\nexport { Window } from \"../Window.ts\";\nimport { Window } from \"../Window.ts\";\n\n/**\n * A window that ends at a picture of the page, its last frame, unless `missing` says why it has\n * none. Its frames are a few, spread over the window, so that it still begins where it starts.\n */\nexport class Moment extends Window.extend<Moment>(\"effect-browser/Moment\")({\n /** The page's outline at the end of the window, when the capture asked for it. */\n snapshot: Schema.optional(Snapshot),\n}) {}\n\nexport interface CaptureOptions {\n /**\n * Where the window starts, as for `Page.window`: a previous window or moment, so that consecutive\n * ones neither repeat nor miss an event or a change, or a `Duration` back from the picture.\n * Defaults to 5 seconds.\n */\n readonly since?: Page.WindowOptions[\"since\"] | undefined;\n /** Frames to keep, at least 1, spread over the window and ending with the picture. Defaults to 2. */\n readonly frames?: number | undefined;\n /**\n * Whether to take the page's outline at the end, or its options; `true` means 4,000 characters.\n * Defaults to `false`: the frames and the timeline carry most moments, while an outline costs a\n * round trip to the page and can double a moment's tokens.\n */\n readonly snapshot?: SnapshotOptions | boolean | undefined;\n /** Show what fields hold in the moment's changes; a secret field still reads `••••`. */\n readonly unmask?: boolean | undefined;\n}\n\n/** Pick `count` frames spread evenly over `frames`, always including the last. */\nconst spread = (frames: ReadonlyArray<Frame>, count: number): ReadonlyArray<Frame> => {\n if (frames.length <= count) return frames;\n if (count <= 1) return frames.slice(-1);\n const step = (frames.length - 1) / (count - 1);\n\n return Array.from({ length: count }, (_, index) => frames[Math.round(index * step)]).filter(\n (frame): frame is Frame => frame !== undefined,\n );\n};\n\n// An action ends after its navigation settles, which can follow the last paint. A fresh picture\n// keeps that completed action inside the moment without moving events between adjacent windows.\nconst pictureOf = Effect.fnUntraced(function* (page: Page.Page) {\n const frame = yield* page.frame({ after: \"input\" });\n const events = yield* page.recentEvents;\n\n return events.some((event) => event._tag === \"Action\" && event.at > frame.hostTime)\n ? yield* page.frame({ maxAge: 0 })\n : frame;\n});\n\nexport const capture = Effect.fn(\"Moment.capture\")(function* (\n page: Page.Page,\n options: CaptureOptions = {},\n) {\n const count = options.frames ?? 2;\n\n if (!Number.isSafeInteger(count) || count < 1)\n return yield* refuse(\"moment\", \"frames must be a positive safe integer\");\n const outline = options.snapshot ?? false;\n\n // The picture comes first, at no call with a running screencast, and the window ends at its\n // paint, so its changes hold nothing it does not show; without one, the window ends now. The\n // outline is taken alongside. What cannot be read is missing from the moment, not its end.\n const { pictured, outlined } = yield* Effect.all(\n {\n pictured: Effect.result(pictureOf(page)).pipe(\n Effect.flatMap((picture) =>\n Effect.map(\n page.window({\n since: options.since ?? Duration.seconds(5),\n until: Result.getOrUndefined(picture),\n unmask: options.unmask,\n }),\n (window) => ({ window, picture }),\n ),\n ),\n ),\n outlined: Effect.result(\n outline === false\n ? Effect.void\n : page.snapshot({ maxChars: 4000, ...(outline === true ? {} : outline) }),\n ),\n },\n { concurrency: 2 },\n );\n\n const { window, picture } = pictured;\n const shown = Result.getOrUndefined(picture);\n\n return new Moment({\n ...window,\n frames: spread(\n shown === undefined\n ? window.frames\n : [...window.frames.filter((frame) => frame !== shown), shown],\n count,\n ),\n snapshot: Result.getOrUndefined(outlined) ?? undefined,\n missing: [\n ...window.missing,\n ...Option.toArray(Result.getFailure(picture)),\n ...Option.toArray(Result.getFailure(outlined)),\n ],\n });\n});\n\n/** A window's record of changes, if it saw any of the window: a page's first has none. */\nconst recordOf = ({ changes }: Window) =>\n changes !== undefined && changes.from < changes.until ? changes : undefined;\n\n/** What a window says of its page at its end: what was still in flux, and what had settled. */\nexport interface Account {\n /**\n * How long, in milliseconds, the page had been still at the end: since the last change in view\n * its record shows, or the last paint its screencast frames show, or else since the window, or\n * its record, began. Undefined where neither could tell, with no record of the window and no\n * painted frame: a screenshot shows the page, not when it last changed. Frames show paint only\n * while a capture runs, and the record does not see a canvas, so a canvas that keeps drawing\n * with no capture running reads as still.\n */\n readonly stillFor: number | undefined;\n /**\n * The changes still under way at the end: what kept changing, more than once in the window or\n * already before it, and changed again within twice its own pace before the end.\n */\n readonly changing: ReadonlyArray<Change>;\n /** Every other change, which shows what it settled at. */\n readonly settled: ReadonlyArray<Change>;\n}\n\n/** Whether a change was still under way at `until`, by its own pace. */\nconst underWay = (change: Change, until: number) => {\n const pace =\n change.count > 1\n ? (change.at - change.startedAt) / (change.count - 1)\n : change.earlier === undefined\n ? undefined\n : change.startedAt - change.earlier;\n\n return pace !== undefined && until - change.at < 2 * pace;\n};\n\n/**\n * An account of the window's page at its end: how long it had been still, and which of its\n * changes were still under way and which had settled. A window whose record saw none of it has\n * neither.\n */\nexport const account = (window: Window): Account => {\n const record = recordOf(window);\n const changes = record?.changes ?? [];\n\n const stirred = [\n ...changes.flatMap((change) => (change.kind === \"title\" ? [] : [change.at])),\n ...window.frames.flatMap((frame) =>\n frame.timing._tag === \"BrowserPaint\" ? [frame.hostTime] : [],\n ),\n ];\n\n return {\n stillFor:\n record === undefined && stirred.length === 0\n ? undefined\n : window.until - Math.max(window.since, record?.from ?? window.since, ...stirred),\n changing: changes.filter((change) => underWay(change, window.until)),\n settled: changes.filter((change) => !underWay(change, window.until)),\n };\n};\n\nconst seconds = (moment: Moment, at: number) => `${((at - moment.until) / 1000).toFixed(1)}s`;\n\nconst pointOf = (x: number | undefined, y: number | undefined) =>\n x === undefined || y === undefined ? undefined : `(${Math.round(x)}, ${Math.round(y)})`;\n\n/**\n * What an action acted on. Without a subject the action failed before finding it, and a ref it was\n * given is left out: refs are reused, so the page's outline may give it to something else by now.\n */\nconst acted = (event: Action): string => {\n const point = pointOf(event.x, event.y);\n\n if (event.subject === undefined)\n return event.target === undefined || /^e\\d+$|\"e\\d+\"/.test(event.target)\n ? (point ?? \"\")\n : event.target;\n // A drag's point is where it ended.\n if (event.to !== undefined)\n return `${named(event.subject, undefined)} to ${named(event.to, point)}`;\n\n return named(event.subject, point);\n};\n\n/**\n * An action as a step: `click button \"Pay\"`. A failed one says only that: its error is advice for\n * the caller that acted, which may name a ref, not a fact about the page.\n */\nconst step = (event: Action): string => {\n const target = acted(event);\n const text = event.text === undefined ? \"\" : JSON.stringify(event.text);\n\n const what =\n event.name === \"type\" && target !== \"\"\n ? `${text} into ${target}`\n : event.name === \"select\" && target !== \"\"\n ? `${text} in ${target}`\n : `${target} ${text}`;\n\n return `${event.name} ${what}${event.ok ? \"\" : \" (failed)\"}`.replace(/\\s+/g, \" \").trim();\n};\n\n/** What is drawn rather than written, whose changes only the screenshots show. */\nconst drawn = new Set([\"canvas\", \"iframe\", \"video\", \"embed\", \"object\", \"svg\"]);\n\nconst onDrawn = (event: Action) =>\n event.ok && event.subject !== undefined && drawn.has(event.subject.role ?? event.subject.tag);\n\ninterface Line {\n readonly at: number;\n readonly rank: number;\n readonly text: string;\n}\n\n/** At most this many lines of what happened; the least notable are counted, not listed. */\nconst maxLines = 24;\n\n/**\n * The changes as lines, news first, and the actions they name; cells of one column that changed\n * together as one line. What kept changing says whether it still was at the moment, by its account.\n */\nconst changed = (moment: Moment, record: Changes) => {\n const actions = moment.events.filter((event): event is Action => event._tag === \"Action\");\n const named = new Set<Action>();\n const changing = new Set(account(moment).changing);\n\n const state = (change: Change) =>\n changing.has(change)\n ? \", still changing at the moment\"\n : change.count > 1 || change.earlier !== undefined\n ? `, settled since ${seconds(moment, change.at)}`\n : \"\";\n\n // The action whose input a change followed: one that ran while the input arrived, give or take\n // the clock's mapping, so input the library did not send names no action.\n const cause = (change: Change) => {\n const input = change.cause;\n\n const action =\n input === undefined\n ? undefined\n : actions.findLast((event) => event.startedAt <= input + 100 && event.at >= input - 100);\n\n if (action === undefined) return \"\";\n named.add(action);\n\n return `, after ${step(action)}`;\n };\n\n const columns = Map.groupBy(\n record.changes.filter(\n (change) => change.kind === \"text\" && change.subject.context.column !== undefined,\n ),\n ({ subject: { context } }) => JSON.stringify([context.heading, context.column]),\n );\n\n const lines: Array<Line> = [];\n const collapsed = new Set<Change>();\n\n for (const [first, ...cells] of columns.values())\n if (first !== undefined && cells.length >= 2) {\n const still = [first, ...cells].filter((cell) => changing.has(cell)).length;\n\n for (const cell of [first, ...cells]) collapsed.add(cell);\n lines.push({\n at: first.startedAt,\n rank: still > 0 ? 3 : 2,\n text: `${cells.length + 1} cells in column ${quoted(first.subject.context.column)}${where({ heading: first.subject.context.heading })} changed, such as ${describe(first, true)}${still > 0 ? `, ${still} still changing at the moment` : \"\"}`,\n });\n }\n for (const change of record.changes)\n if (!collapsed.has(change))\n lines.push({\n at: change.startedAt,\n rank: changing.has(change) ? 3 : 2,\n text: describe(change) + cause(change) + state(change),\n });\n\n return { lines, named };\n};\n\n/** What a part a moment could not read was, by the operation that failed: a window's one read is its changes. */\nconst parts = new Map([\n [\"frame\", \"A picture of the moment\"],\n [\"snapshot\", \"The page's outline\"],\n]);\n\n/** The moment's changes and events as lines, most notable first when its changes are recorded. */\nconst happened = (moment: Moment): ReadonlyArray<string> => {\n const record = recordOf(moment);\n\n const { lines, named } =\n record === undefined\n ? { lines: new Array<Line>(), named: new Set<Action>() }\n : changed(moment, record);\n\n // Whether anything but a field's own edit changed after an action began.\n const followed = (event: Action) =>\n record?.changes.some((change) => change.kind !== \"value\" && change.at > event.startedAt) ===\n true;\n\n // With a record, an action is told as a step where changes followed it and none names it, so a\n // click whose effect a busy page leaves uncredited is not lost; where its effect is drawn; or\n // where it started before the record began, as on the document a click opened. An attempt that\n // nothing followed, a failed one, a hover and a scroll are left out.\n const told = (event: Action) =>\n !(event.ok && [\"navigate\", \"back\", \"reload\"].includes(event.name)) &&\n (record === undefined ||\n event.startedAt <= record.from ||\n (event.ok &&\n event.name !== \"scroll\" &&\n (onDrawn(event) || (event.name !== \"hover\" && !named.has(event) && followed(event)))));\n\n for (const event of moment.events)\n if (event._tag === \"Action\" && event.page === moment.page && told(event))\n lines.push({ at: event.at, rank: 4, text: step(event) });\n else if (event._tag === \"Navigated\")\n lines.push({\n at: event.at,\n rank: 0,\n text: `${event.sameDocument ? \"moved within the page\" : \"navigated\"} to ${event.url}`,\n });\n else if (event._tag === \"PageOpened\")\n lines.push({ at: event.at, rank: 0, text: `a tab opened at ${event.url}` });\n else if (event._tag === \"PageClosed\")\n lines.push({\n at: event.at,\n rank: 0,\n text: `the tab ${event.cause === \"crashed\" ? \"crashed\" : \"closed\"}`,\n });\n else if (event._tag === \"DialogShown\")\n lines.push({\n at: event.at,\n rank: 1,\n text: `a dialog (${event.kind}) said ${JSON.stringify(event.message)}`,\n });\n\n const ordered = lines.toSorted((left, right) =>\n record === undefined ? left.at - right.at : left.rank - right.rank || left.at - right.at,\n );\n\n const kept = ordered.slice(0, maxLines);\n const drawing = moment.events.some((event) => event._tag === \"Action\" && onDrawn(event));\n const begins = record === undefined ? moment.since : Math.max(moment.since, record.from);\n const unread = moment.missing.some((error) => !parts.has(error.operation));\n\n return [\n ...kept.map((line) => `${seconds(moment, line.at)} ${line.text}`),\n ...(ordered.length > maxLines ? [`…and ${ordered.length - maxLines} less notable`] : []),\n ...(record === undefined\n ? unread\n ? []\n : [\"What changed on the page was not recorded.\"]\n : record.changes.length > 0\n ? []\n : [\n `No text in view changed${begins > moment.since ? ` after ${seconds(moment, begins)}` : \"\"}${drawing ? \"; what is drawn, such as a canvas, shows only in the screenshots\" : \"\"}.`,\n ]),\n ...(record !== undefined && record.dropped > 0\n ? [\n `The page changed too much to tell it all: at least ${record.dropped} changes are not told.`,\n ]\n : []),\n ...(begins > moment.since\n ? [`Changes before ${seconds(moment, begins)} are not all known.`]\n : []),\n ...moment.missing.map(\n (error) =>\n `${parts.get(error.operation) ?? \"What changed on the page\"} could not be read: ${error.reason.message}.`,\n ),\n ];\n};\n\n/**\n * The moment as one user message: the page's outline when the moment has one, what changed, most\n * notable first, what kept changing told as still changing at the moment or settled since when, by\n * its account, with the actions that the changes followed, that changes followed though none\n * names them, or that drew what only the screenshots show, what could not be read and why, and its\n * frames captioned with their times, the last one \"the moment\" where it is the picture at its end.\n * Give a model its task with `Prompt.setSystem`, and add what the caller knows about the page as\n * more text.\n */\nexport const toPrompt = (moment: Moment): Prompt.Prompt => {\n const count = moment.frames.length;\n const last = count - 1;\n const pictured = moment.frames.at(-1)?.hostTime === moment.until;\n\n const following =\n count === 1 ? \"One screenshot follows\" : `${count} screenshots follow, oldest first`;\n\n return Prompt.fromMessages([\n Prompt.makeMessage(\"user\", {\n content: [\n Prompt.makePart(\"text\", {\n text: [\n \"One moment of a browser session. Rely only on what this material shows, and prefer concrete details: numbers, names, colours, positions and motion.\",\n \"\",\n ...(moment.snapshot === undefined ? [] : [moment.snapshot.rendered, \"\"]),\n `${recordOf(moment) === undefined ? \"What happened\" : \"What changed, most notable first\"} (seconds before the moment, over ${((moment.until - moment.since) / 1000).toFixed(1)}s):`,\n ...happened(moment),\n ...(count === 0\n ? []\n : [\n \"\",\n `${following}${pictured ? (count === 1 ? \": the moment itself.\" : \"; the last one is the moment itself.\") : \".\"}`,\n ]),\n ].join(\"\\n\"),\n }),\n ...moment.frames.flatMap((frame, index) => [\n Prompt.makePart(\"text\", {\n text:\n index === last && pictured ? \"The moment:\" : `${seconds(moment, frame.hostTime)}:`,\n }),\n Prompt.makePart(\"file\", { mediaType: \"image/jpeg\", data: frame.data }),\n ]),\n ],\n }),\n ]);\n};\n\n/** Describe one change using the same prose as moment prompts. */\nexport { describe as describeChange } from \"./words.ts\";\n"],"mappings":";;;;;;AAOA,MAAa,UAAU,UAA8B,KAAK,UAAU,SAAS,EAAE;;AAG/E,MAAa,SAAS,SAAkB,UAA8B;CACpE,MAAM,OAAO,QAAQ,QAAQ,QAAQ;CAErC,IAAI,QAAQ,SAAS,IAAI,OAAO,GAAG,KAAK,GAAG,KAAK,UAAU,QAAQ,IAAI;CAEtE,OAAO,UAAU,KAAA,IAAY,OAAO,GAAG,KAAK,MAAM;AACpD;;AAGA,MAAa,SAAS,EAAE,KAAK,QAAQ,OAAO,WAA2B,UAAU,UAAU;CACzF,MAAM,QAAQ;EACZ,QAAQ,KAAA,IAAY,KAAK,OAAO,OAAO,GAAG;EAC1C,WAAW,KAAA,KAAa,UAAU,KAAK,UAAU,OAAO,MAAM;EAC9D,UAAU,KAAA,IAAY,KAAK,UAAU,OAAO,KAAK;EACjD,YAAY,KAAA,KAAa,UAAU,KAAK,SAAS,OAAO,OAAO;CACjE,CAAC,CAAC,QAAQ,SAAS,SAAS,EAAE;CAE9B,OAAO,MAAM,WAAW,IAAI,KAAK,KAAK,MAAM,KAAK,IAAI,EAAE;AACzD;;AAGA,MAAa,YAAY,QAAgB,UAAU,UAAkB;CACnE,MAAM,EAAE,SAAS,QAAQ,OAAO,OAAO,QAAQ,YAAY;CAC3D,MAAM,UAAU,MAAM,QAAQ,SAAS,OAAO;CAE9C,MAAM,QACJ,WAAW,KAAA,KAAa,YAAY,KAAA,IAAY,KAAK,UAAU,OAAO,MAAM;CAE9E,MAAM,QAAQ,QAAQ,IAAI,gBAAgB,MAAM,QAAQ,MAAM,KAAK;CAEnE,QAAQ,OAAO,MAAf;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serError-Coy7EW1N.mjs";
2
- import { b as Subject, i as BrowserEvent } from "./BrowserEvent-dq6FRT8w.mjs";
3
- import { m as ReadyOptions, o as Found, u as Page } from "./Page-ku6j5t-v.mjs";
1
+ import { t as BrowserError } from "../BrowserError-BlcmLVzn.mjs";
2
+ import { b as Subject, r as BrowserEvent } from "../BrowserEvent-lLqJ3GJS.mjs";
3
+ import { c as Found, f as Page, g as ReadyOptions } from "../Page-CvsOEorc.mjs";
4
4
  import { Duration, Effect, Schema } from "effect";
5
- //#region src/internal/reading/choose.d.ts
5
+ //#region src/plan/choose.d.ts
6
6
  declare const Missing_base: Schema.Class<Missing, Schema.TaggedStruct<"Missing", {}>, import("effect/Cause").YieldableError>;
7
7
  /** Nothing on the page has the step's role and name. */
8
- declare class Missing extends Missing_base {
8
+ export declare class Missing extends Missing_base {
9
9
  get message(): string;
10
10
  }
11
11
  declare const Ambiguous_base: Schema.Class<Ambiguous, Schema.TaggedStruct<"Ambiguous", {
12
12
  readonly count: Schema.Int;
13
13
  }>, import("effect/Cause").YieldableError>;
14
14
  /** Several elements match the step's subject equally well, and nothing tells them apart. */
15
- declare class Ambiguous extends Ambiguous_base {
15
+ export declare class Ambiguous extends Ambiguous_base {
16
16
  get message(): string;
17
17
  }
18
18
  declare const Drifted_base: Schema.Class<Drifted, Schema.TaggedStruct<"Drifted", {
19
19
  readonly detail: Schema.String;
20
20
  }>, import("effect/Cause").YieldableError>;
21
21
  /** The page is not where the recording was: another site, or no element with its context. */
22
- declare class Drifted extends Drifted_base {
22
+ export declare class Drifted extends Drifted_base {
23
23
  get message(): string;
24
24
  }
25
- declare namespace Plan_d_exports {
26
- export { Ambiguous, Drifted, Expected, Missing, Plan, Receipt, ReplayError, ReplayOptions, Step, StepAction, Stopped, TakeOptions, Uncertain, fromEvents, locate, repeatable, replay, restore, take };
27
- }
28
- declare const StepAction: Schema.Literals<readonly ["navigate", "back", "reload", "click", "hover", "drag", "type", "press", "scroll", "select"]>;
29
- type StepAction = typeof StepAction.Type;
25
+ //#endregion
26
+ //#region src/plan/data.d.ts
30
27
  /**
31
28
  * What a step leaves. `durable` asserts an author-chosen, lasting read-back of this operation,
32
29
  * such as its uniquely named saved receipt or exact operation URL. Only Appeared and an exact
33
30
  * Navigated URL allow it; a toast, absence or relative navigation cannot establish recovery.
34
31
  * Relative navigation measures observed change from dispatch, without asserting causality.
35
32
  */
36
- declare const Expected: Schema.Union<readonly [Schema.TaggedStruct<"Checked", {
33
+ export declare const Expected: Schema.Union<readonly [Schema.TaggedStruct<"Checked", {
37
34
  readonly checked: Schema.Boolean;
38
35
  }>, Schema.TaggedStruct<"Appeared", {
39
36
  readonly query: Schema.Struct<{
@@ -56,53 +53,155 @@ declare const Expected: Schema.Union<readonly [Schema.TaggedStruct<"Checked", {
56
53
  readonly url: Schema.optional<Schema.Never>;
57
54
  readonly durable: Schema.optional<Schema.Never>;
58
55
  }>]>;
59
- type Expected = typeof Expected.Type;
56
+ export type Expected = typeof Expected.Type;
60
57
  declare const Step_base: Schema.Class<Step, Schema.Struct<{
61
- readonly action: Schema.Literals<readonly ["navigate", "back", "reload", "click", "hover", "drag", "type", "press", "scroll", "select"]>;
62
- /**
63
- * The ending address, or a later recorded navigation before the next action began. Empty when
64
- * unknown; a delayed navigation can be stronger arrival evidence than the action's ending URL.
65
- */
58
+ readonly action: Schema.refine<{
59
+ readonly _tag: "Back";
60
+ } | {
61
+ readonly _tag: "Click";
62
+ readonly target: string | {
63
+ readonly x: number;
64
+ readonly y: number;
65
+ };
66
+ readonly options?: {
67
+ readonly button?: "left" | "middle" | "right" | undefined;
68
+ readonly clickCount?: number | undefined;
69
+ readonly holdMillis?: number | undefined;
70
+ } | undefined;
71
+ } | {
72
+ readonly _tag: "Drag";
73
+ readonly from: string | {
74
+ readonly x: number;
75
+ readonly y: number;
76
+ };
77
+ readonly to: string | {
78
+ readonly x: number;
79
+ readonly y: number;
80
+ };
81
+ } | {
82
+ readonly _tag: "Goto";
83
+ readonly url: string;
84
+ } | {
85
+ readonly _tag: "Hover";
86
+ readonly target: string | {
87
+ readonly x: number;
88
+ readonly y: number;
89
+ };
90
+ } | {
91
+ readonly _tag: "Press";
92
+ readonly keys: string;
93
+ readonly options?: {
94
+ readonly on?: string | undefined;
95
+ readonly times?: number | undefined;
96
+ readonly holdMillis?: number | undefined;
97
+ } | undefined;
98
+ } | {
99
+ readonly _tag: "Reload";
100
+ } | {
101
+ readonly _tag: "Scroll";
102
+ readonly options?: {
103
+ readonly at?: string | {
104
+ readonly x: number;
105
+ readonly y: number;
106
+ } | undefined;
107
+ readonly dx?: number | undefined;
108
+ readonly dy?: number | undefined;
109
+ } | undefined;
110
+ } | {
111
+ readonly _tag: "Select";
112
+ readonly ref: string;
113
+ readonly values: readonly string[];
114
+ } | {
115
+ readonly _tag: "Type";
116
+ readonly text: string;
117
+ readonly options?: {
118
+ readonly into?: string | undefined;
119
+ readonly replace?: boolean | undefined;
120
+ readonly submit?: boolean | undefined;
121
+ readonly secret?: boolean | undefined;
122
+ } | undefined;
123
+ }, Schema.TaggedUnion<{
124
+ readonly Act: Schema.TaggedStruct<"Act", {
125
+ readonly document: Schema.Int;
126
+ }>;
127
+ readonly Back: Schema.TaggedStruct<"Back", {}>;
128
+ readonly Click: Schema.TaggedStruct<"Click", {
129
+ readonly target: Schema.Union<readonly [Schema.String, Schema.Struct<{
130
+ readonly x: Schema.Finite;
131
+ readonly y: Schema.Finite;
132
+ }>]>;
133
+ readonly options: Schema.optional<Schema.Struct<{
134
+ readonly button: Schema.optional<Schema.Literals<readonly ["left", "right", "middle"]>>;
135
+ readonly clickCount: Schema.optional<Schema.Finite>;
136
+ readonly holdMillis: Schema.optional<Schema.Finite>;
137
+ }>>;
138
+ }>;
139
+ readonly Drag: Schema.TaggedStruct<"Drag", {
140
+ readonly from: Schema.Union<readonly [Schema.String, Schema.Struct<{
141
+ readonly x: Schema.Finite;
142
+ readonly y: Schema.Finite;
143
+ }>]>;
144
+ readonly to: Schema.Union<readonly [Schema.String, Schema.Struct<{
145
+ readonly x: Schema.Finite;
146
+ readonly y: Schema.Finite;
147
+ }>]>;
148
+ }>;
149
+ readonly Goto: Schema.TaggedStruct<"Goto", {
150
+ readonly url: Schema.String;
151
+ }>;
152
+ readonly Hover: Schema.TaggedStruct<"Hover", {
153
+ readonly target: Schema.Union<readonly [Schema.String, Schema.Struct<{
154
+ readonly x: Schema.Finite;
155
+ readonly y: Schema.Finite;
156
+ }>]>;
157
+ }>;
158
+ readonly Press: Schema.TaggedStruct<"Press", {
159
+ readonly keys: Schema.String;
160
+ readonly options: Schema.optional<Schema.Struct<{
161
+ readonly on: Schema.optional<Schema.String>;
162
+ readonly times: Schema.optional<Schema.Finite>;
163
+ readonly holdMillis: Schema.optional<Schema.Finite>;
164
+ }>>;
165
+ }>;
166
+ readonly Reload: Schema.TaggedStruct<"Reload", {}>;
167
+ readonly Scroll: Schema.TaggedStruct<"Scroll", {
168
+ readonly options: Schema.optional<Schema.Struct<{
169
+ readonly at: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
170
+ readonly x: Schema.Finite;
171
+ readonly y: Schema.Finite;
172
+ }>]>>;
173
+ readonly dx: Schema.optional<Schema.Finite>;
174
+ readonly dy: Schema.optional<Schema.Finite>;
175
+ }>>;
176
+ }>;
177
+ readonly Select: Schema.TaggedStruct<"Select", {
178
+ readonly ref: Schema.String;
179
+ readonly values: Schema.$Array<Schema.String>;
180
+ }>;
181
+ readonly Type: Schema.TaggedStruct<"Type", {
182
+ readonly text: Schema.String;
183
+ readonly options: Schema.optional<Schema.Struct<{
184
+ readonly into: Schema.optional<Schema.String>;
185
+ readonly replace: Schema.optional<Schema.Boolean>;
186
+ readonly submit: Schema.optional<Schema.Boolean>;
187
+ readonly secret: Schema.optional<Schema.Boolean>;
188
+ }>>;
189
+ }>;
190
+ }>>;
191
+ /** The address reached, including a delayed navigation before the next action began. */
66
192
  readonly url: Schema.String;
67
- /** A navigation's requested address, or the keys a press pressed. */
68
- readonly target: Schema.optional<Schema.String>;
69
193
  readonly subject: Schema.optional<typeof Subject>;
70
194
  /** Where a drag ended. */
71
195
  readonly to: Schema.optional<typeof Subject>;
72
- /** The viewport point a step aimed at, when it aimed at a point, and a drag's end point. */
73
- readonly point: Schema.optional<Schema.Struct<{
74
- readonly x: Schema.Finite;
75
- readonly y: Schema.Finite;
76
- }>>;
77
- readonly toPoint: Schema.optional<Schema.Struct<{
78
- readonly x: Schema.Finite;
79
- readonly y: Schema.Finite;
80
- }>>;
81
- /** The box of what a step aimed at by point found there, so replay aims at the same place in it. */
196
+ /** The recorded box keeps a point at the same relative position within its subject. */
82
197
  readonly box: Schema.optional<Schema.Struct<{
83
198
  readonly x: Schema.Finite;
84
199
  readonly y: Schema.Finite;
85
200
  readonly width: Schema.Finite;
86
201
  readonly height: Schema.Finite;
87
202
  }>>;
88
- /**
89
- * The input slot whose text a `type` step types, or whose address a `navigate` step goes to, as
90
- * its recorded address had a credential withheld.
91
- */
203
+ /** A slot replaces recorded typing text or a navigation address with withheld credentials. */
92
204
  readonly input: Schema.optional<Schema.String>;
93
- /** The slot's text went into a secret field, so replay types it into nothing else. */
94
- readonly secret: Schema.optional<Schema.Literal<true>>;
95
- readonly options: Schema.optional<Schema.Struct<{
96
- readonly button: Schema.optional<Schema.Literals<readonly ["left", "right", "middle"]>>;
97
- readonly clickCount: Schema.optional<Schema.Finite>;
98
- readonly holdMillis: Schema.optional<Schema.Finite>;
99
- readonly replace: Schema.optional<Schema.Boolean>;
100
- readonly submit: Schema.optional<Schema.Boolean>;
101
- readonly times: Schema.optional<Schema.Finite>;
102
- readonly dx: Schema.optional<Schema.Finite>;
103
- readonly dy: Schema.optional<Schema.Finite>;
104
- readonly values: Schema.optional<Schema.$Array<Schema.String>>;
105
- }>>;
106
205
  readonly expect: Schema.optional<Schema.Union<readonly [Schema.TaggedStruct<"Checked", {
107
206
  readonly checked: Schema.Boolean;
108
207
  }>, Schema.TaggedStruct<"Appeared", {
@@ -128,13 +227,13 @@ declare const Step_base: Schema.Class<Step, Schema.Struct<{
128
227
  }>]>>;
129
228
  }>, {}>;
130
229
  /** One recorded step: the action, what it acted on, and what else it was asked. */
131
- declare class Step extends Step_base {}
230
+ export declare class Step extends Step_base {}
132
231
  declare const Plan_base: Schema.Class<Plan, Schema.Struct<{
133
- readonly version: Schema.Literals<readonly [1, 2]>;
232
+ readonly version: Schema.Literal<3>;
134
233
  readonly steps: Schema.$Array<typeof Step>;
135
234
  }>, {}>;
136
- declare class Plan extends Plan_base {
137
- /** Choose the encoding version from the steps; simple recordings remain version 1. */
235
+ export declare class Plan extends Plan_base {
236
+ /** Version 3 carries canonical typed Actions; prior string-action encodings are rejected. */
138
237
  static new(steps: ReadonlyArray<Step>): Plan;
139
238
  /** The input slots its steps type, in order; replay needs text for each. */
140
239
  get inputs(): ReadonlyArray<string>;
@@ -146,18 +245,18 @@ declare const Receipt_base: Schema.Class<Receipt, Schema.Struct<{
146
245
  readonly at: Schema.Finite;
147
246
  }>, {}>;
148
247
  /** One completed step, on the page's host clock. `verified` means its expected effect was seen. */
149
- declare class Receipt extends Receipt_base {}
248
+ export declare class Receipt extends Receipt_base {}
150
249
  declare const Stopped_base: Schema.Class<Stopped, Schema.Struct<{
151
250
  readonly step: Schema.Int;
152
251
  readonly input: Schema.Literals<readonly ["unsent", "unknown"]>;
153
252
  }>, {}>;
154
253
  /** Durable stopping data. A begun step without a receipt must be restored as `unknown`. */
155
- declare class Stopped extends Stopped_base {}
254
+ export declare class Stopped extends Stopped_base {}
156
255
  declare const Uncertain_base: Schema.Class<Uncertain, Schema.TaggedStruct<"Uncertain", {
157
256
  readonly detail: Schema.String;
158
257
  }>, import("effect/Cause").YieldableError>;
159
258
  /** Repeating this step could repeat an unresolved effect; the consumer must reconcile it. */
160
- declare class Uncertain extends Uncertain_base {
259
+ export declare class Uncertain extends Uncertain_base {
161
260
  get message(): string;
162
261
  }
163
262
  declare const ReplayError_base: Schema.Class<ReplayError, Schema.TaggedStruct<"ReplayError", {
@@ -167,20 +266,26 @@ declare const ReplayError_base: Schema.Class<ReplayError, Schema.TaggedStruct<"R
167
266
  readonly receipts: Schema.$Array<typeof Receipt>;
168
267
  }>, import("effect/Cause").YieldableError>;
169
268
  /** Where replay stopped, counting steps from 0, why, and the steps that completed before it. */
170
- declare class ReplayError extends ReplayError_base {
269
+ export declare class ReplayError extends ReplayError_base {
171
270
  get stopped(): Stopped;
172
271
  get message(): string;
173
272
  }
273
+ //#endregion
274
+ //#region src/plan/record.d.ts
174
275
  /**
175
276
  * The walk one page's events record: the completed actions of the page that acted first, in
176
277
  * order. `page.recentEvents` gives them, or `browser.events()` read until the walk ends.
177
278
  */
178
- declare const fromEvents: (events: Iterable<BrowserEvent>) => Plan;
279
+ export declare const fromEvents: (events: Iterable<BrowserEvent>) => Plan;
280
+ //#endregion
281
+ //#region src/plan/targets.d.ts
179
282
  /**
180
283
  * The one element on the page that a subject names, by role, name and context (see `Plan`),
181
284
  * looking again for two seconds while the page may still be drawing it.
182
285
  */
183
- declare const locate: (page: Page, subject: Subject) => Effect.Effect<Found, Ambiguous | BrowserError | Drifted | Missing, never>;
286
+ export declare const locate: (page: Page, subject: Subject) => Effect.Effect<Found, Ambiguous | BrowserError | Drifted | Missing, never>;
287
+ //#endregion
288
+ //#region src/plan/execute.d.ts
184
289
  interface TakeOptions {
185
290
  /** How each step waits first, except an opening navigation, or false. No final-step wait. */
186
291
  readonly settle?: ReadyOptions | false | undefined;
@@ -198,19 +303,19 @@ interface ReplayOptions extends TakeOptions {
198
303
  * Input that can be repeated without repeating a commitment. `take` also validates a Checked
199
304
  * target's boolean state before input. Back/reload can resubmit a form.
200
305
  */
201
- declare const repeatable: (step: Step) => boolean;
306
+ export declare const repeatable: (step: Step) => boolean;
202
307
  /**
203
308
  * Take one step. Unknown non-repeatable input is never resent: only positive durable read-back
204
309
  * can skip it. An interrupted call remains interrupted; persist begun-before-call in the consumer
205
310
  * and treat a missing receipt as Stopped{input: "unknown"}, including after process restart.
206
311
  */
207
- declare const take: (page: Page, plan: Plan, at: number | Stopped, options?: TakeOptions | undefined) => Effect.Effect<Receipt, ReplayError, never>;
312
+ export declare const take: (page: Page, plan: Plan, at: number | Stopped, options?: TakeOptions | undefined) => Effect.Effect<Receipt, ReplayError, never>;
208
313
  /** Take a plan's steps from a fresh index or durable stopping point, returning completed receipts. */
209
- declare const replay: (page: Page, plan: Plan, options?: ReplayOptions) => Effect.Effect<Receipt[], ReplayError, never>;
314
+ export declare const replay: (page: Page, plan: Plan, options?: ReplayOptions) => Effect.Effect<Receipt[], ReplayError, never>;
210
315
  /** Restore prior steps on a fresh page; unresolved commitments require positive durable evidence. */
211
- declare const restore: (page: Page, plan: Plan, options?: TakeOptions & {
316
+ export declare const restore: (page: Page, plan: Plan, options?: TakeOptions & {
212
317
  readonly upTo?: number | undefined;
213
318
  }) => Effect.Effect<Receipt[], ReplayError, never>;
214
319
  //#endregion
215
- export { take as _, ReplayError as a, Missing as b, StepAction as c, Uncertain as d, fromEvents as f, restore as g, replay as h, Receipt as i, Stopped as l, repeatable as m, Plan as n, ReplayOptions as o, locate as p, Plan_d_exports as r, Step as s, Expected as t, TakeOptions as u, Ambiguous as v, Drifted as y };
216
- //# sourceMappingURL=Plan-DJ4hEEna.d.mts.map
320
+ export type { ReplayOptions, TakeOptions };
321
+ //# sourceMappingURL=index.d.mts.map