effect-browser 0.3.0-beta.23 → 0.3.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +437 -142
- package/dist/Action.d.mts +1 -1
- package/dist/Action.mjs +61 -9
- package/dist/Action.mjs.map +1 -1
- package/dist/Browser.d.mts +2 -2
- package/dist/Browser.mjs +2 -2
- package/dist/BrowserError.d.mts +2 -2
- package/dist/BrowserError.mjs +194 -41
- package/dist/BrowserError.mjs.map +1 -1
- package/dist/BrowserEvent.d.mts +2 -2
- package/dist/BrowserEvent.mjs +185 -35
- package/dist/BrowserEvent.mjs.map +1 -1
- package/dist/Cdp.d.mts +15 -0
- package/dist/Cdp.mjs +22 -0
- package/dist/Cdp.mjs.map +1 -0
- package/dist/Change.d.mts +2 -2
- package/dist/Change.mjs +40 -7
- package/dist/Change.mjs.map +1 -1
- package/dist/Frame.d.mts +2 -2
- package/dist/Frame.mjs +132 -14
- package/dist/Frame.mjs.map +1 -1
- package/dist/InputStyle.d.mts +153 -0
- package/dist/InputStyle.mjs +2 -0
- package/dist/Layout.d.mts +2 -0
- package/dist/Layout.mjs +123 -0
- package/dist/Layout.mjs.map +1 -0
- package/dist/Overlay.d.mts +2 -0
- package/dist/Overlay.mjs +58 -0
- package/dist/Overlay.mjs.map +1 -0
- package/dist/Page.d.mts +2 -2
- package/dist/Page.mjs +2 -2
- package/dist/PageTime.d.mts +2 -0
- package/dist/PageTime.mjs +17 -0
- package/dist/PageTime.mjs.map +1 -0
- package/dist/Pose.d.mts +2 -0
- package/dist/Pose.mjs +65 -0
- package/dist/Pose.mjs.map +1 -0
- package/dist/Site.d.mts +984 -0
- package/dist/Site.mjs +110 -0
- package/dist/Site.mjs.map +1 -0
- package/dist/Snapshot.d.mts +2 -2
- package/dist/Snapshot.mjs +87 -6
- package/dist/Snapshot.mjs.map +1 -1
- package/dist/Text.d.mts +2 -0
- package/dist/Text.mjs +45 -0
- package/dist/Text.mjs.map +1 -0
- package/dist/Window.d.mts +2 -2
- package/dist/Window.mjs +31 -6
- package/dist/Window.mjs.map +1 -1
- package/dist/ai/BrowserTools.d.mts +4987 -0
- package/dist/ai/BrowserTools.mjs +3 -0
- package/dist/ai/PageControl.d.mts +286 -0
- package/dist/ai/PageControl.mjs +426 -0
- package/dist/ai/PageControl.mjs.map +1 -0
- package/dist/ai/PromptCache.d.mts +16 -0
- package/dist/ai/PromptCache.mjs +72 -0
- package/dist/ai/PromptCache.mjs.map +1 -0
- package/dist/ai/Tabs.d.mts +2 -0
- package/dist/ai/Tabs.mjs +72 -0
- package/dist/ai/Tabs.mjs.map +1 -0
- package/dist/ai/ToolError.d.mts +34 -0
- package/dist/ai/ToolError.mjs +2 -0
- package/dist/ai/index.d.mts +6 -0
- package/dist/ai/index.mjs +6 -0
- package/dist/index.d.mts +7 -15
- package/dist/index.mjs +9 -8
- package/dist/{Action-24sLOubi.d.mts → internal/Action-CkanNTUw.d.mts} +64 -4
- package/dist/{Browser-wZhwZSlG.d.mts → internal/Browser-DD9Vm1c-.d.mts} +80 -10
- package/dist/{Browser-BKPAbyys.mjs → internal/Browser-vzD7i2oj.mjs} +658 -495
- package/dist/internal/Browser-vzD7i2oj.mjs.map +1 -0
- package/dist/{BrowserError-BlcmLVzn.d.mts → internal/BrowserError-CsuRYcDX.d.mts} +187 -28
- package/dist/{BrowserEvent-lLqJ3GJS.d.mts → internal/BrowserEvent-tGPYYf6R.d.mts} +197 -18
- package/dist/internal/BrowserTools-Yi3lOX4h.mjs +497 -0
- package/dist/internal/BrowserTools-Yi3lOX4h.mjs.map +1 -0
- package/dist/{Style-AO4V7Czt.mjs → internal/InputStyle-CPzxoN4g.mjs} +94 -16
- package/dist/internal/InputStyle-CPzxoN4g.mjs.map +1 -0
- package/dist/{moment/Moment.mjs → internal/Moment-CstaX1mR.mjs} +49 -16
- package/dist/internal/Moment-CstaX1mR.mjs.map +1 -0
- package/dist/{moment/Moment.d.mts → internal/Moment-DOcldBdf.d.mts} +54 -21
- package/dist/internal/Page-BfGxn7oN.d.mts +1553 -0
- package/dist/{Page-BF5izr8R.mjs → internal/Page-DqF-tuTx.mjs} +62 -72
- package/dist/internal/Page-DqF-tuTx.mjs.map +1 -0
- package/dist/internal/Release-CFONkPDP.d.mts +39 -0
- package/dist/internal/Stage-D5ymSXDT.mjs +298 -0
- package/dist/internal/Stage-D5ymSXDT.mjs.map +1 -0
- package/dist/internal/Stillness-DCPeAN1a.mjs +1124 -0
- package/dist/internal/Stillness-DCPeAN1a.mjs.map +1 -0
- package/dist/internal/Supervisor-BcY_QNIY.d.mts +108 -0
- package/dist/internal/Supervisor-BcglY23c.mjs +531 -0
- package/dist/internal/Supervisor-BcglY23c.mjs.map +1 -0
- package/dist/internal/Tabs-dXMscIUQ.d.mts +52 -0
- package/dist/internal/TestPage-CYiYbh63.d.mts +159 -0
- package/dist/internal/ToolError-DArsRS2m.mjs +117 -0
- package/dist/internal/ToolError-DArsRS2m.mjs.map +1 -0
- package/dist/{plan/index.d.mts → internal/Walk-BNXcfZ2z.d.mts} +59 -35
- package/dist/{plan/index.mjs → internal/Walk-C5ky7uSf.mjs} +83 -51
- package/dist/internal/Walk-C5ky7uSf.mjs.map +1 -0
- package/dist/{ActionPort.mjs → internal/action-port-B5EkeGOR.mjs} +6 -12
- package/dist/internal/action-port-B5EkeGOR.mjs.map +1 -0
- package/dist/internal/cdp/workerd.d.mts +13 -0
- package/dist/internal/cdp/workerd.mjs +19 -0
- package/dist/internal/cdp/workerd.mjs.map +1 -0
- package/dist/{Clock.mjs → internal/clock-BKSAEf00.mjs} +13 -13
- package/dist/internal/clock-BKSAEf00.mjs.map +1 -0
- package/dist/{connection-2KHI4_KN.d.mts → internal/connection-BaB0vp1o.d.mts} +6 -6
- package/dist/{connection-CK83pvqP.mjs → internal/connection-C2X4GmXM.mjs} +19 -15
- package/dist/internal/connection-C2X4GmXM.mjs.map +1 -0
- package/dist/internal/events-DzCrww-y.mjs +72 -0
- package/dist/internal/events-DzCrww-y.mjs.map +1 -0
- package/dist/internal/fold.inpage-CyVZQHZL.d.mts +49 -0
- package/dist/internal/fold.inpage-uhrT-dOB.mjs +49 -0
- package/dist/internal/fold.inpage-uhrT-dOB.mjs.map +1 -0
- package/dist/internal/functions-jBOs6GKv.mjs +27 -0
- package/dist/internal/functions-jBOs6GKv.mjs.map +1 -0
- package/dist/{Geometry-DJx9qrYy.d.mts → internal/geometry-Dhj_ztJs.d.mts} +3 -3
- package/dist/{Geometry.mjs → internal/geometry-Lxyflb9J.mjs} +3 -12
- package/dist/internal/geometry-Lxyflb9J.mjs.map +1 -0
- package/dist/{Matching.mjs → internal/matching-Cs-UeOY0.mjs} +24 -19
- package/dist/internal/matching-Cs-UeOY0.mjs.map +1 -0
- package/dist/internal/page-DFQb-YOK.mjs +436 -0
- package/dist/internal/page-DFQb-YOK.mjs.map +1 -0
- package/dist/internal/pose.inpage-CBFeWcVa.mjs +1996 -0
- package/dist/internal/pose.inpage-CBFeWcVa.mjs.map +1 -0
- package/dist/{Url.mjs → internal/url-DB0pQYk6.mjs} +3 -12
- package/dist/internal/url-DB0pQYk6.mjs.map +1 -0
- package/dist/policy/Policy.d.mts +60 -6
- package/dist/policy/Policy.mjs +52 -9
- package/dist/policy/Policy.mjs.map +1 -1
- package/dist/policy/index.d.mts +2 -0
- package/dist/policy/index.mjs +2 -0
- package/dist/presentation/Film.d.mts +332 -0
- package/dist/presentation/Film.mjs +298 -0
- package/dist/presentation/Film.mjs.map +1 -0
- package/dist/presentation/Motion.d.mts +5 -1
- package/dist/presentation/Motion.mjs +16 -2
- package/dist/presentation/Motion.mjs.map +1 -1
- package/dist/presentation/Presentation.d.mts +48 -6
- package/dist/presentation/Presentation.mjs +28 -9
- package/dist/presentation/Presentation.mjs.map +1 -1
- package/dist/presentation/Stage.d.mts +40 -6
- package/dist/presentation/Stage.mjs +1 -262
- package/dist/presentation/index.d.mts +5 -0
- package/dist/presentation/index.mjs +5 -0
- package/dist/supervisor/Release.d.mts +2 -0
- package/dist/supervisor/Release.mjs +40 -0
- package/dist/supervisor/Release.mjs.map +1 -0
- package/dist/supervisor/Supervisor.d.mts +2 -104
- package/dist/supervisor/Supervisor.mjs +2 -515
- package/dist/supervisor/index.d.mts +3 -0
- package/dist/supervisor/index.mjs +3 -0
- package/dist/testing/HttpCassette.d.mts +98 -0
- package/dist/testing/HttpCassette.mjs +146 -0
- package/dist/testing/HttpCassette.mjs.map +1 -0
- package/dist/testing/Story.d.mts +31 -0
- package/dist/testing/Story.mjs +76 -0
- package/dist/testing/Story.mjs.map +1 -0
- package/dist/testing/TestBrowser.d.mts +191 -0
- package/dist/testing/TestBrowser.mjs +105 -0
- package/dist/testing/TestBrowser.mjs.map +1 -0
- package/dist/testing/TestModel.d.mts +133 -0
- package/dist/testing/TestModel.mjs +209 -0
- package/dist/testing/TestModel.mjs.map +1 -0
- package/dist/testing/TestPage.d.mts +2 -0
- package/dist/testing/TestPage.mjs +47 -0
- package/dist/testing/TestPage.mjs.map +1 -0
- package/dist/testing/index.d.mts +6 -337
- package/dist/testing/index.mjs +6 -515
- package/dist/timeline/Moment.d.mts +3 -0
- package/dist/timeline/Moment.mjs +3 -0
- package/dist/timeline/Stillness.d.mts +34 -0
- package/dist/timeline/Stillness.mjs +2 -0
- package/dist/timeline/index.d.mts +3 -0
- package/dist/timeline/index.mjs +3 -0
- package/dist/walk/Walk.d.mts +2 -0
- package/dist/walk/Walk.mjs +2 -0
- package/dist/walk/index.d.mts +2 -0
- package/dist/walk/index.mjs +2 -0
- package/package.json +54 -133
- package/src/Action.ts +73 -8
- package/src/Browser.ts +85 -14
- package/src/BrowserError.ts +258 -63
- package/src/BrowserEvent.ts +264 -48
- package/src/Cdp.ts +42 -0
- package/src/Change.ts +75 -4
- package/src/Frame.ts +247 -14
- package/src/{Style.ts → InputStyle.ts} +130 -18
- package/src/Layout.ts +187 -0
- package/src/Overlay.ts +76 -0
- package/src/Page.ts +144 -275
- package/src/PageTime.ts +72 -0
- package/src/Pose.ts +81 -0
- package/src/Site.ts +136 -0
- package/src/Snapshot.ts +179 -3
- package/src/Text.ts +60 -0
- package/src/Window.ts +53 -3
- package/src/ai/BrowserTools.ts +778 -0
- package/src/ai/PageControl.ts +702 -0
- package/src/ai/PromptCache.ts +87 -0
- package/src/ai/Tabs.ts +84 -0
- package/src/ai/ToolError.ts +50 -0
- package/src/ai/index.ts +36 -0
- package/src/ai/internal/crops.ts +38 -0
- package/src/ai/internal/points.ts +57 -0
- package/src/ai/internal/receipts.ts +107 -0
- package/src/index.ts +87 -6
- package/src/{ActionPort.ts → internal/action-port.ts} +3 -3
- package/src/{providers → internal/cdp}/connection.ts +19 -12
- package/src/internal/cdp/workerd.ts +36 -0
- package/src/{Clock.ts → internal/clock.ts} +20 -0
- package/src/internal/input/actions.ts +1 -1
- package/src/internal/input/dispatch.ts +2 -2
- package/src/internal/input/guard.inpage.ts +1 -1
- package/src/internal/input/guard.ts +1 -1
- package/src/internal/input/perform.ts +35 -7
- package/src/internal/input/pointer.ts +9 -6
- package/src/internal/input/targets.inpage.ts +3 -3
- package/src/internal/input/targets.ts +1 -1
- package/src/{Matching.ts → internal/matching.ts} +28 -19
- package/src/internal/page/bridge.ts +67 -35
- package/src/internal/page/clock.inpage.ts +306 -0
- package/src/internal/page/compose.inpage.ts +101 -0
- package/src/internal/page/context.ts +4 -2
- package/src/internal/page/functions.ts +84 -0
- package/src/internal/page/navigation.ts +1 -1
- package/src/internal/page/openings.ts +2 -2
- package/src/internal/page/overlay.inpage.ts +96 -0
- package/src/internal/page/overlay.ts +89 -0
- package/src/internal/page/page.ts +39 -29
- package/src/internal/page/port.ts +14 -8
- package/src/internal/page/pose.inpage.ts +200 -0
- package/src/internal/page/pose.ts +80 -0
- package/src/internal/page/replies.ts +1 -1
- package/src/internal/page/requests.ts +1 -1
- package/src/internal/page/scripts.ts +1 -1
- package/src/internal/page/time.inpage.ts +49 -0
- package/src/internal/page/time.ts +122 -0
- package/src/internal/page/viewport.ts +3 -2
- package/src/internal/pictures/capture.ts +1 -4
- package/src/internal/pictures/dimensions.ts +1 -1
- package/src/internal/pictures/frame.ts +1 -1
- package/src/internal/pictures/pictures.ts +144 -91
- package/src/internal/reading/context.inpage.ts +2 -2
- package/src/internal/reading/expect.inpage.ts +1 -1
- package/src/internal/reading/layout.inpage.ts +193 -0
- package/src/internal/reading/layout.ts +101 -0
- package/src/internal/reading/names.inpage.ts +15 -0
- package/src/internal/reading/outline.inpage.ts +5 -21
- package/src/internal/reading/reading.ts +33 -21
- package/src/internal/reading/ready.inpage.ts +21 -26
- package/src/internal/reading/ready.ts +26 -5
- package/src/internal/reading/subjects.inpage.ts +3 -3
- package/src/internal/reading/text.inpage.ts +3 -16
- package/src/internal/reading/walk.inpage.ts +1 -1
- package/src/internal/timeline/changes.inpage.ts +7 -15
- package/src/internal/timeline/changes.ts +17 -5
- package/src/internal/timeline/record.inpage.ts +15 -6
- package/src/internal/timeline/sight.inpage.ts +2 -2
- package/src/internal/timeline/window.ts +3 -4
- package/src/policy/Policy.ts +70 -16
- package/src/policy/index.ts +12 -0
- package/src/presentation/Film.ts +451 -0
- package/src/presentation/Motion.ts +45 -3
- package/src/presentation/Presentation.ts +60 -14
- package/src/presentation/Stage.ts +73 -35
- package/src/presentation/index.ts +30 -0
- package/src/presentation/{feed.ts → internal/feed.ts} +1 -1
- package/src/supervisor/Release.ts +45 -0
- package/src/supervisor/Supervisor.ts +80 -5
- package/src/supervisor/index.ts +18 -0
- package/src/supervisor/{contract.ts → internal/contract.ts} +14 -10
- package/src/supervisor/{lifecycle.ts → internal/lifecycle.ts} +7 -7
- package/src/supervisor/{runtime.ts → internal/runtime.ts} +7 -7
- package/src/testing/HttpCassette.ts +260 -0
- package/src/testing/Story.ts +103 -0
- package/src/testing/TestBrowser.ts +14 -4
- package/src/testing/TestModel.ts +297 -0
- package/src/testing/TestPage.ts +92 -4
- package/src/testing/index.ts +35 -1
- package/src/testing/{evidence.ts → internal/evidence.ts} +19 -11
- package/src/testing/{model.ts → internal/model.ts} +14 -8
- package/src/testing/{page.ts → internal/page.ts} +55 -51
- package/src/{moment → timeline}/Moment.ts +79 -29
- package/src/{stillness → timeline}/Stillness.ts +89 -46
- package/src/timeline/index.ts +18 -0
- package/src/{stillness/Pixels.ts → timeline/internal/pixels.ts} +27 -1
- package/src/{moment → timeline/internal}/words.ts +2 -2
- package/src/walk/Walk.ts +165 -0
- package/src/walk/index.ts +12 -0
- package/src/{plan → walk/internal}/choose.ts +23 -14
- package/src/{plan → walk/internal}/data.ts +37 -14
- package/src/{plan → walk/internal}/execute.ts +79 -36
- package/src/{plan → walk/internal}/record.ts +6 -6
- package/src/{plan → walk/internal}/targets.ts +35 -25
- package/dist/ActionPort.d.mts +0 -15
- package/dist/ActionPort.mjs.map +0 -1
- package/dist/Browser-BKPAbyys.mjs.map +0 -1
- package/dist/Change-Ba7INmay.d.mts +0 -69
- package/dist/Clock.d.mts +0 -57
- package/dist/Clock.mjs.map +0 -1
- package/dist/Frame-UEH2hO5T.d.mts +0 -124
- package/dist/Geometry.d.mts +0 -2
- package/dist/Geometry.mjs.map +0 -1
- package/dist/Matching.d.mts +0 -37
- package/dist/Matching.mjs.map +0 -1
- package/dist/Page-BF5izr8R.mjs.map +0 -1
- package/dist/Page-CvsOEorc.d.mts +0 -566
- package/dist/Released-tURbFmal.d.mts +0 -15
- package/dist/Snapshot-CtBVOtuu.d.mts +0 -73
- package/dist/Stillness-CNlvayIo.mjs +0 -136
- package/dist/Stillness-CNlvayIo.mjs.map +0 -1
- package/dist/Style-AO4V7Czt.mjs.map +0 -1
- package/dist/Style.d.mts +0 -72
- package/dist/Style.mjs +0 -2
- package/dist/Url.d.mts +0 -26
- package/dist/Url.mjs.map +0 -1
- package/dist/Window-CMddGMt1.d.mts +0 -34
- package/dist/connection-CK83pvqP.mjs.map +0 -1
- package/dist/moment/Moment.mjs.map +0 -1
- package/dist/plan/index.mjs.map +0 -1
- package/dist/presentation/Stage.mjs.map +0 -1
- package/dist/presentation/feed.d.mts +0 -20
- package/dist/presentation/feed.mjs +0 -18
- package/dist/presentation/feed.mjs.map +0 -1
- package/dist/providers/Cdp.d.mts +0 -9
- package/dist/providers/Cdp.mjs +0 -15
- package/dist/providers/Cdp.mjs.map +0 -1
- package/dist/providers/Chromium.d.mts +0 -32
- package/dist/providers/Chromium.mjs +0 -55
- package/dist/providers/Chromium.mjs.map +0 -1
- package/dist/providers/Released.d.mts +0 -2
- package/dist/providers/Released.mjs +0 -12
- package/dist/providers/Released.mjs.map +0 -1
- package/dist/stillness/Stillness.d.mts +0 -12
- package/dist/stillness/Stillness.mjs +0 -2
- package/dist/supervisor/Supervisor.mjs.map +0 -1
- package/dist/testing/index.mjs.map +0 -1
- package/dist/workerd/Cdp.d.mts +0 -8
- package/dist/workerd/Cdp.mjs +0 -13
- package/dist/workerd/Cdp.mjs.map +0 -1
- package/src/plan/index.ts +0 -36
- package/src/providers/Cdp.ts +0 -16
- package/src/providers/Chromium.ts +0 -99
- package/src/providers/Released.ts +0 -13
- package/src/workerd/Cdp.ts +0 -11
- /package/dist/{rolldown-runtime-D7D4PA-g.mjs → internal/rolldown-runtime-D7D4PA-g.mjs} +0 -0
- /package/src/{Geometry.ts → internal/geometry.ts} +0 -0
- /package/src/{Url.ts → internal/url.ts} +0 -0
- /package/src/{stillness → timeline/internal}/utilsBundle.d.ts +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { normal } from "./
|
|
3
|
-
import { InvalidRequest, refuse, undispatched } from "
|
|
4
|
-
import {
|
|
2
|
+
import { o as normal } from "./geometry-Lxyflb9J.mjs";
|
|
3
|
+
import { InvalidRequest, refuse, undispatched } from "../BrowserError.mjs";
|
|
4
|
+
import { r as millisOf } from "./clock-BKSAEf00.mjs";
|
|
5
|
+
import { Context, Effect, Function, Random, Schema } from "effect";
|
|
5
6
|
//#region src/internal/input/keys.ts
|
|
6
7
|
/**
|
|
7
8
|
* Key aliases for Playwright and printable US key descriptions for pipelined Chromium typing.
|
|
@@ -166,15 +167,19 @@ const description = (character) => {
|
|
|
166
167
|
};
|
|
167
168
|
};
|
|
168
169
|
//#endregion
|
|
169
|
-
//#region src/
|
|
170
|
+
//#region src/InputStyle.ts
|
|
170
171
|
/**
|
|
171
172
|
* How input is sent: plainly, as fast as the page takes it, or performed for viewers, with a
|
|
172
173
|
* pointer that glides, keys typed at a person's pace, held buttons and wheels in bursts. A page's
|
|
173
174
|
* actions take one, and the input reaches the same controls either way; only its timing, and
|
|
174
175
|
* what viewers see of it, differ. A presenter builds the performed one.
|
|
176
|
+
*
|
|
177
|
+
* @stability stable
|
|
178
|
+
* @since 0.3.0
|
|
175
179
|
*/
|
|
176
|
-
var
|
|
180
|
+
var InputStyle_exports = /* @__PURE__ */ __exportAll({
|
|
177
181
|
Current: () => Current,
|
|
182
|
+
eased: () => eased,
|
|
178
183
|
keyGap: () => keyGap,
|
|
179
184
|
maximumDurationMillis: () => maximumDurationMillis,
|
|
180
185
|
pause: () => pause,
|
|
@@ -183,7 +188,13 @@ var Style_exports = /* @__PURE__ */ __exportAll({
|
|
|
183
188
|
provide: () => provide,
|
|
184
189
|
validated: () => validated
|
|
185
190
|
});
|
|
186
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* Each key as it comes, with no pause; a drag moves in eight short steps so its target sees it.
|
|
193
|
+
*
|
|
194
|
+
* @stability stable
|
|
195
|
+
* @category constants
|
|
196
|
+
* @since 0.3.0
|
|
197
|
+
*/
|
|
187
198
|
const plain = {
|
|
188
199
|
shown: false,
|
|
189
200
|
pointer: void 0,
|
|
@@ -223,7 +234,13 @@ const plain = {
|
|
|
223
234
|
const lognormal = Effect.fnUntraced(function* (median, sigma, minimum, maximum) {
|
|
224
235
|
return Math.max(minimum, Math.min(maximum, median * Math.exp(sigma * (yield* normal))));
|
|
225
236
|
});
|
|
226
|
-
/**
|
|
237
|
+
/**
|
|
238
|
+
* A pause around `median`, as the research measured reactions: at most four times it.
|
|
239
|
+
*
|
|
240
|
+
* @stability stable
|
|
241
|
+
* @category constructors
|
|
242
|
+
* @since 0.3.0
|
|
243
|
+
*/
|
|
227
244
|
const pause = (median, sigma) => median <= 0 ? Effect.succeed(0) : lognormal(median, sigma, 0, median * 4);
|
|
228
245
|
const pressHold = lognormal(75.2, .35, 35, 200);
|
|
229
246
|
const keyHold = lognormal(107.8, .2, 60, 220);
|
|
@@ -237,6 +254,10 @@ const eventOrder = {
|
|
|
237
254
|
* physical key is never held twice, as with A and a, or ! and 1. The first key waits for the hand
|
|
238
255
|
* to reach the keys, each later one follows the last by a gap drawn around `gap`, and a word's
|
|
239
256
|
* first key comes 60 ms later.
|
|
257
|
+
*
|
|
258
|
+
* @stability stable
|
|
259
|
+
* @category constants
|
|
260
|
+
* @since 0.3.0
|
|
240
261
|
*/
|
|
241
262
|
const maximumDurationMillis = 1e4;
|
|
242
263
|
const Delay = Schema.Finite.check(Schema.isBetween({
|
|
@@ -269,7 +290,13 @@ const Wheel = ordered(Schema.Struct({
|
|
|
269
290
|
dy: Schema.Finite
|
|
270
291
|
}));
|
|
271
292
|
const decode = (schema, operation) => (value) => Schema.decodeUnknownEffect(schema)(value).pipe(Effect.catch(() => refuse(operation, "style must provide a finite bounded ordered input schedule")));
|
|
272
|
-
/**
|
|
293
|
+
/**
|
|
294
|
+
* Copy and validate custom schedules before their first input; planning uses the action bound.
|
|
295
|
+
*
|
|
296
|
+
* @stability stable
|
|
297
|
+
* @category combinators
|
|
298
|
+
* @since 0.3.0
|
|
299
|
+
*/
|
|
273
300
|
const validated = (style) => ({
|
|
274
301
|
...style,
|
|
275
302
|
hold: style.hold.pipe(Effect.flatMap(decode(Delay, "click"))),
|
|
@@ -312,7 +339,13 @@ const typing = Effect.fnUntraced(function* (text, gap) {
|
|
|
312
339
|
if (events.some((event) => event.afterMillis > 1e4)) return yield* overBudget("type");
|
|
313
340
|
return events.toSorted((left, right) => left.afterMillis - right.afterMillis || eventOrder[left.phase] - eventOrder[right.phase]);
|
|
314
341
|
});
|
|
315
|
-
/**
|
|
342
|
+
/**
|
|
343
|
+
* A word is five characters; the gap leaves room for each word's later start.
|
|
344
|
+
*
|
|
345
|
+
* @stability stable
|
|
346
|
+
* @category constructors
|
|
347
|
+
* @since 0.3.0
|
|
348
|
+
*/
|
|
316
349
|
const keyGap = (wordsPerMinute) => 12e3 / wordsPerMinute - 10;
|
|
317
350
|
/**
|
|
318
351
|
* The wheel in 100 px notches, 30 to 140 ms apart, in bursts of at most nine, with 0.6 to 2.6 s
|
|
@@ -334,7 +367,40 @@ const bursts = Effect.fnUntraced(function* (dx, dy) {
|
|
|
334
367
|
}
|
|
335
368
|
return steps;
|
|
336
369
|
});
|
|
337
|
-
/**
|
|
370
|
+
/**
|
|
371
|
+
* A wheel that eases over `duration`: a step each frame, sixty a second, slow at first and last,
|
|
372
|
+
* so a scroll that viewers watch glides to where it goes. A style takes it as its `wheel`; a film
|
|
373
|
+
* scrolls on its own time instead.
|
|
374
|
+
*
|
|
375
|
+
* @stability stable
|
|
376
|
+
* @category constructors
|
|
377
|
+
* @since 0.3.0
|
|
378
|
+
*/
|
|
379
|
+
const eased = (duration) => (dx, dy) => {
|
|
380
|
+
const durationMillis = millisOf(duration);
|
|
381
|
+
if (!Number.isFinite(durationMillis) || durationMillis < 0) return refuse("scroll", "an eased scroll lasts a finite, nonnegative time");
|
|
382
|
+
if (durationMillis > 1e4) return Effect.fail(overBudget("scroll"));
|
|
383
|
+
const count = Math.max(1, Math.round(durationMillis * 60 / 1e3));
|
|
384
|
+
const along = (index) => {
|
|
385
|
+
const x = index / count;
|
|
386
|
+
return x * x * (3 - 2 * x);
|
|
387
|
+
};
|
|
388
|
+
return Effect.succeed(Array.from({ length: count }, (_, index) => {
|
|
389
|
+
const share = along(index + 1) - along(index);
|
|
390
|
+
return {
|
|
391
|
+
dx: dx * share,
|
|
392
|
+
dy: dy * share,
|
|
393
|
+
afterMillis: index * durationMillis / count
|
|
394
|
+
};
|
|
395
|
+
}));
|
|
396
|
+
};
|
|
397
|
+
/**
|
|
398
|
+
* Input performed for viewers, with this pointer and pace.
|
|
399
|
+
*
|
|
400
|
+
* @stability stable
|
|
401
|
+
* @category constructors
|
|
402
|
+
* @since 0.3.0
|
|
403
|
+
*/
|
|
338
404
|
const performed = (options) => {
|
|
339
405
|
const gap = keyGap(options.wordsPerMinute);
|
|
340
406
|
return {
|
|
@@ -347,11 +413,23 @@ const performed = (options) => {
|
|
|
347
413
|
wheel: bursts
|
|
348
414
|
};
|
|
349
415
|
};
|
|
350
|
-
/**
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
416
|
+
/**
|
|
417
|
+
* Input style in this fiber; plain input is the default.
|
|
418
|
+
*
|
|
419
|
+
* @stability stable
|
|
420
|
+
* @category services
|
|
421
|
+
* @since 0.3.0
|
|
422
|
+
*/
|
|
423
|
+
const Current = Context.Reference("effect-browser/InputStyle", { defaultValue: () => plain });
|
|
424
|
+
/**
|
|
425
|
+
* Apply a style through page input, including pages selected later by a browser adapter.
|
|
426
|
+
*
|
|
427
|
+
* @stability stable
|
|
428
|
+
* @category combinators
|
|
429
|
+
* @since 0.3.0
|
|
430
|
+
*/
|
|
431
|
+
const provide = Function.dual(2, (effect, style) => Effect.provideService(effect, Current, style));
|
|
354
432
|
//#endregion
|
|
355
|
-
export {
|
|
433
|
+
export { maximumDurationMillis as a, plain as c, description as d, parts as f, keyGap as i, provide as l, InputStyle_exports as n, pause as o, eased as r, performed as s, Current as t, validated as u };
|
|
356
434
|
|
|
357
|
-
//# sourceMappingURL=
|
|
435
|
+
//# sourceMappingURL=InputStyle-CPzxoN4g.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputStyle-CPzxoN4g.mjs","names":["Keys.description","description"],"sources":["../../src/internal/input/keys.ts","../../src/InputStyle.ts"],"sourcesContent":["/**\n * Key aliases for Playwright and printable US key descriptions for pipelined Chromium typing.\n */\n\nconst aliases: Record<string, string> = {\n ctrl: \"Control\",\n control: \"Control\",\n cmd: \"Meta\",\n command: \"Meta\",\n meta: \"Meta\",\n win: \"Meta\",\n super: \"Meta\",\n mod: \"ControlOrMeta\",\n alt: \"Alt\",\n option: \"Alt\",\n shift: \"Shift\",\n enter: \"Enter\",\n return: \"Enter\",\n esc: \"Escape\",\n escape: \"Escape\",\n tab: \"Tab\",\n space: \"Space\",\n spacebar: \"Space\",\n \" \": \"Space\",\n backspace: \"Backspace\",\n delete: \"Delete\",\n del: \"Delete\",\n insert: \"Insert\",\n home: \"Home\",\n end: \"End\",\n pageup: \"PageUp\",\n pagedown: \"PageDown\",\n up: \"ArrowUp\",\n down: \"ArrowDown\",\n left: \"ArrowLeft\",\n right: \"ArrowRight\",\n arrowup: \"ArrowUp\",\n arrowdown: \"ArrowDown\",\n arrowleft: \"ArrowLeft\",\n arrowright: \"ArrowRight\",\n};\n\nconst named = new Set(Object.values(aliases));\n\n/** Parse and validate the whole chord before sending any down events. */\nexport const parts = (keys: string): ReadonlyArray<string> | undefined => {\n const tokens: Array<string> = [];\n let building = \"\";\n\n // Like Playwright, a plus without a preceding token is the literal plus key: Control++.\n for (const character of keys) {\n if (character === \"+\" && building.trim() !== \"\") {\n tokens.push(building);\n building = \"\";\n } else building += character;\n }\n tokens.push(building);\n if (tokens.length > 4) return undefined;\n const out: Array<string> = [];\n\n for (const token of tokens) {\n const part = token === \" \" ? \"Space\" : token.trim();\n const lower = part.toLowerCase();\n const alias = Object.hasOwn(aliases, lower) ? aliases[lower] : undefined;\n\n if (alias !== undefined) out.push(alias);\n else if (\n named.has(part) ||\n /^F([1-9]|1[0-2])$/.test(part) ||\n /^(Key[A-Z]|Digit[0-9]|Numpad[0-9])$/.test(part) ||\n description(part) !== undefined\n )\n out.push(part);\n else return undefined;\n }\n\n return out;\n};\n\ninterface Description {\n readonly code: string;\n readonly keyCode: number;\n readonly key: string;\n readonly text: string;\n}\n\nconst punctuation: ReadonlyArray<readonly [string, string, number]> = [\n [\"`~\", \"Backquote\", 192],\n [\"-_\", \"Minus\", 189],\n [\"=+\", \"Equal\", 187],\n [\"\\\\|\", \"Backslash\", 220],\n [\"[{\", \"BracketLeft\", 219],\n [\"]}\", \"BracketRight\", 221],\n [\";:\", \"Semicolon\", 186],\n [\"'\\\"\", \"Quote\", 222],\n [\",<\", \"Comma\", 188],\n [\".>\", \"Period\", 190],\n [\"/?\", \"Slash\", 191],\n [\" \", \"Space\", 32],\n];\n\n/**\n * Match Playwright's pinned US layout for literal typing. Uppercase and shifted punctuation\n * carry their literal text without synthesizing Shift. Newlines also use insertText so a text\n * payload cannot submit a form; only an explicit Enter or submit option may do that.\n */\nexport const description = (character: string): Description | undefined => {\n // Prose correction uses the same raw key path so its deletion has a matched release.\n if (character === \"Backspace\")\n return { code: \"Backspace\", keyCode: 8, key: \"Backspace\", text: \"\" };\n if (character.length !== 1) return undefined;\n if (/^[A-Za-z]$/.test(character)) {\n const upper = character.toUpperCase();\n\n return { code: `Key${upper}`, keyCode: upper.charCodeAt(0), key: character, text: character };\n }\n const digit = \"0123456789\".indexOf(character);\n const number = digit === -1 ? \")!@#$%^&*(\".indexOf(character) : digit;\n\n if (number !== -1)\n return { code: `Digit${number}`, keyCode: 48 + number, key: character, text: character };\n const symbol = punctuation.find(([characters]) => characters.includes(character));\n\n return symbol === undefined\n ? undefined\n : { code: symbol[1], keyCode: symbol[2], key: character, text: character };\n};\n","/**\n * How input is sent: plainly, as fast as the page takes it, or performed for viewers, with a\n * pointer that glides, keys typed at a person's pace, held buttons and wheels in bursts. A page's\n * actions take one, and the input reaches the same controls either way; only its timing, and\n * what viewers see of it, differ. A presenter builds the performed one.\n *\n * @stability stable\n * @since 0.3.0\n */\nimport {\n Context,\n type Duration,\n Effect,\n Function,\n type MutableRef,\n type Option,\n Random,\n Schema,\n} from \"effect\";\n\nimport { undispatched, type BrowserError, InvalidRequest, refuse } from \"./BrowserError.ts\";\nimport type { ActionAnnounced } from \"./BrowserEvent.ts\";\nimport { millisOf } from \"./internal/clock.ts\";\nimport type * as Motion from \"./internal/geometry.ts\";\nimport { normal } from \"./internal/geometry.ts\";\nimport * as Keys from \"./internal/input/keys.ts\";\nimport type { Point } from \"./Page.ts\";\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface TypingEvent {\n /** From the start of the typing. */\n readonly afterMillis: number;\n readonly phase: \"down\" | \"up\" | \"insert\";\n readonly key: string;\n}\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface WheelStep {\n readonly dx: number;\n readonly dy: number;\n /** From the first step. */\n readonly afterMillis: number;\n}\n\n/**\n * @stability stable\n * @category models\n * @since 0.3.0\n */\nexport interface InputStyle {\n /** Own presentation only after policy allows input; wait options belong to the page. */\n readonly withInput?:\n | ((options: {\n readonly operation: string;\n readonly wait: Duration.Duration;\n readonly failFast: boolean;\n }) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | BrowserError, R>)\n | undefined;\n /**\n * Wait for this once an action has announced its target, before its pointer travels there. It\n * holds the page's turn and spends the action's deadline, which bounds it; the target is not\n * found again after it.\n */\n readonly lead?: ((announced: ActionAnnounced) => Effect.Effect<void>) | undefined;\n /**\n * Whether viewers watch the input: then the pointer clicks into a field before typing, finds\n * what lies under it as it scrolls, and scrolls to a target out of view with the wheel.\n */\n readonly shown: boolean;\n /** Where viewers last saw the pointer, which the next glide starts from; else the page's own. */\n readonly pointer: MutableRef.MutableRef<Option.Option<Point>> | undefined;\n /** The pointer's path to `to`, ending exactly there. */\n readonly glide: (\n from: Point,\n to: Point,\n dragging: boolean,\n ) => Effect.Effect<ReadonlyArray<Motion.Sample>>;\n /** How long a button stays down when a click does not say. */\n readonly hold: Effect.Effect<number, BrowserError>;\n /** The key events that type `text`, or one insertion of it under a guard, timed from the start. */\n readonly typing: (\n text: string,\n guarded: boolean,\n ) => Effect.Effect<ReadonlyArray<TypingEvent>, BrowserError>;\n /** The pause between repeated presses of the same keys. */\n readonly keyGap: Effect.Effect<number, BrowserError>;\n /** A wheel scroll as the wheel turns: in one step, or in notches and bursts. */\n readonly wheel: (dx: number, dy: number) => Effect.Effect<ReadonlyArray<WheelStep>, BrowserError>;\n}\n\n/**\n * Each key as it comes, with no pause; a drag moves in eight short steps so its target sees it.\n *\n * @stability stable\n * @category constants\n * @since 0.3.0\n */\nexport const plain: InputStyle = {\n shown: false,\n pointer: undefined,\n glide: (from, to, dragging) =>\n Effect.succeed(\n dragging\n ? Array.from({ length: 8 }, (_, index) => ({\n x: index === 7 ? to.x : from.x + ((to.x - from.x) * (index + 1)) / 8,\n y: index === 7 ? to.y : from.y + ((to.y - from.y) * (index + 1)) / 8,\n afterMillis: (index + 1) * 8,\n }))\n : [{ ...to, afterMillis: 0 }],\n ),\n hold: Effect.succeed(0),\n typing: (text, guarded) =>\n Effect.succeed(\n guarded && text !== \"\"\n ? [{ afterMillis: 0, phase: \"insert\", key: text }]\n : [...text].flatMap((key): ReadonlyArray<TypingEvent> =>\n Keys.description(key) === undefined\n ? [{ afterMillis: 0, phase: \"insert\", key }]\n : [\n { afterMillis: 0, phase: \"down\", key },\n { afterMillis: 0, phase: \"up\", key },\n ],\n ),\n ),\n keyGap: Effect.succeed(0),\n wheel: (dx, dy) => Effect.succeed([{ dx, dy, afterMillis: 0 }]),\n};\n\n// A right-skewed draw, clamped so that cleanup and deadlines stay predictable; 1 - U keeps the\n// logarithm defined when Random returns zero.\nconst lognormal = Effect.fnUntraced(function* (\n median: number,\n sigma: number,\n minimum: number,\n maximum: number,\n) {\n return Math.max(minimum, Math.min(maximum, median * Math.exp(sigma * (yield* normal))));\n});\n\n/**\n * A pause around `median`, as the research measured reactions: at most four times it.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const pause = (median: number, sigma: number) =>\n median <= 0 ? Effect.succeed(0) : lognormal(median, sigma, 0, median * 4);\n\n// A mouse press about 80 ms long on average, a key about 110 ms, each now and then longer: their\n// medians are the means times exp(-sigma^2 / 2).\nconst pressHold = lognormal(75.2, 0.35, 35, 200);\nconst keyHold = lognormal(107.8, 0.2, 60, 220);\nconst eventOrder = { up: 0, insert: 1, down: 2 };\n\n/**\n * Plan the whole text before any key goes, so holds overlap without waiting on the network. A\n * physical key is never held twice, as with A and a, or ! and 1. The first key waits for the hand\n * to reach the keys, each later one follows the last by a gap drawn around `gap`, and a word's\n * first key comes 60 ms later.\n *\n * @stability stable\n * @category constants\n * @since 0.3.0\n */\nexport const maximumDurationMillis = 10_000;\n\nconst Delay = Schema.Finite.check(Schema.isBetween({ minimum: 0, maximum: maximumDurationMillis }));\n\nconst ordered = <A extends { readonly afterMillis: number }>(sample: Schema.Codec<A>) =>\n Schema.Array(sample).check(\n Schema.makeFilter(\n (samples) =>\n samples.every(\n (event, index) => event.afterMillis >= (samples[index - 1]?.afterMillis ?? 0),\n ),\n { expected: \"nondecreasing input offsets\" },\n ),\n );\n\nconst Typing = ordered(\n Schema.Struct({\n afterMillis: Delay,\n phase: Schema.Literals([\"down\", \"up\", \"insert\"]),\n key: Schema.String,\n }),\n).check(\n Schema.makeFilter(\n (events) => {\n const held = new Set<string>();\n\n for (const event of events) {\n if (event.phase === \"insert\") continue;\n const code = Keys.description(event.key)?.code;\n\n if (code === undefined || (event.phase === \"down\") === held.has(code)) return false;\n if (event.phase === \"down\") held.add(code);\n else held.delete(code);\n }\n\n return held.size === 0;\n },\n { expected: \"matched key holds\" },\n ),\n);\n\nconst Wheel = ordered(Schema.Struct({ afterMillis: Delay, dx: Schema.Finite, dy: Schema.Finite }));\n\nconst decode =\n <A>(schema: Schema.Codec<A>, operation: string) =>\n (value: unknown) =>\n Schema.decodeUnknownEffect(schema)(value).pipe(\n Effect.catch(() =>\n refuse(operation, \"style must provide a finite bounded ordered input schedule\"),\n ),\n );\n\n/**\n * Copy and validate custom schedules before their first input; planning uses the action bound.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const validated = (style: InputStyle): InputStyle => ({\n ...style,\n hold: style.hold.pipe(Effect.flatMap(decode(Delay, \"click\"))),\n keyGap: style.keyGap.pipe(Effect.flatMap(decode(Delay, \"press\"))),\n typing: (text, guarded) =>\n style.typing(text, guarded).pipe(Effect.flatMap(decode(Typing, \"type\"))),\n wheel: (dx, dy) => style.wheel(dx, dy).pipe(Effect.flatMap(decode(Wheel, \"scroll\"))),\n});\n\nconst overBudget = (operation: string) =>\n undispatched(\n operation,\n new InvalidRequest({\n detail: `presentation must take at most ${maximumDurationMillis} milliseconds`,\n }),\n );\n\nconst typing = Effect.fnUntraced(function* (\n text: string,\n gap: number,\n): Effect.fn.Return<ReadonlyArray<TypingEvent>, BrowserError> {\n const events: Array<TypingEvent> = [];\n const releases = new Map<string, number>();\n let due = text === \"\" ? 0 : yield* Random.nextBetween(150, 400);\n let previous = \"\";\n\n for (const character of text) {\n if (due > maximumDurationMillis) return yield* overBudget(\"type\");\n if (/\\s/u.test(previous) && /[\\p{L}\\p{N}]/u.test(character)) due += 60;\n const description = Keys.description(character);\n\n if (description === undefined)\n events.push({ afterMillis: due, phase: \"insert\", key: character });\n else {\n due = Math.max(due, (releases.get(description.code) ?? -1) + 1);\n const released = due + (yield* keyHold);\n\n events.push(\n { afterMillis: due, phase: \"down\", key: character },\n { afterMillis: released, phase: \"up\", key: character },\n );\n releases.set(description.code, released);\n }\n due += yield* Random.nextBetween(gap / 2, (gap * 3) / 2);\n previous = character;\n }\n\n if (events.some((event) => event.afterMillis > maximumDurationMillis))\n return yield* overBudget(\"type\");\n\n return events.toSorted(\n (left, right) =>\n left.afterMillis - right.afterMillis || eventOrder[left.phase] - eventOrder[right.phase],\n );\n});\n\n/**\n * A word is five characters; the gap leaves room for each word's later start.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const keyGap = (wordsPerMinute: number) => 12_000 / wordsPerMinute - 10;\n\n/**\n * The wheel in 100 px notches, 30 to 140 ms apart, in bursts of at most nine, with 0.6 to 2.6 s\n * between bursts, as people scroll.\n */\nconst bursts = Effect.fnUntraced(function* (dx: number, dy: number) {\n const notches = Math.max(1, Math.ceil(Math.hypot(dx, dy) / 100));\n\n // Even the shortest possible schedule exceeds the cap; refuse before allocating it.\n if (notches > 1 + maximumDurationMillis / 30) return yield* overBudget(\"scroll\");\n const steps: Array<WheelStep> = [];\n let due = 0;\n\n for (let index = 0; index < notches; index++) {\n if (index > 0)\n due += yield* index % 9 === 0 ? Random.nextBetween(600, 2600) : Random.nextBetween(30, 140);\n if (due > maximumDurationMillis) return yield* overBudget(\"scroll\");\n steps.push({ dx: dx / notches, dy: dy / notches, afterMillis: due });\n }\n\n return steps;\n});\n\n/**\n * A wheel that eases over `duration`: a step each frame, sixty a second, slow at first and last,\n * so a scroll that viewers watch glides to where it goes. A style takes it as its `wheel`; a film\n * scrolls on its own time instead.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const eased =\n (duration: Duration.Input): InputStyle[\"wheel\"] =>\n (dx, dy) => {\n const durationMillis = millisOf(duration);\n\n if (!Number.isFinite(durationMillis) || durationMillis < 0)\n return refuse(\"scroll\", \"an eased scroll lasts a finite, nonnegative time\");\n if (durationMillis > maximumDurationMillis) return Effect.fail(overBudget(\"scroll\"));\n const count = Math.max(1, Math.round((durationMillis * 60) / 1000));\n\n // How far along the scroll is at the end of `index` steps, smoothly in and out.\n const along = (index: number) => {\n const x = index / count;\n\n return x * x * (3 - 2 * x);\n };\n\n return Effect.succeed(\n Array.from({ length: count }, (_, index) => {\n const share = along(index + 1) - along(index);\n\n return { dx: dx * share, dy: dy * share, afterMillis: (index * durationMillis) / count };\n }),\n );\n };\n\n/**\n * Input performed for viewers, with this pointer and pace.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const performed = (options: {\n readonly pointer: MutableRef.MutableRef<Option.Option<Point>>;\n readonly motion: Motion.Planner;\n readonly wordsPerMinute: number;\n}): InputStyle => {\n const gap = keyGap(options.wordsPerMinute);\n\n return {\n shown: true,\n pointer: options.pointer,\n glide: (from, to) => options.motion.plan(from, to),\n hold: pressHold,\n typing: (text) => typing(text, gap),\n keyGap: Random.nextBetween(gap / 2, (gap * 3) / 2),\n wheel: bursts,\n };\n};\n\n/**\n * Input style in this fiber; plain input is the default.\n *\n * @stability stable\n * @category services\n * @since 0.3.0\n */\nexport const Current = Context.Reference<InputStyle>(\"effect-browser/InputStyle\", {\n defaultValue: () => plain,\n});\n\n/**\n * Apply a style through page input, including pages selected later by a browser adapter.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const provide: {\n (style: InputStyle): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;\n <A, E, R>(effect: Effect.Effect<A, E, R>, style: InputStyle): Effect.Effect<A, E, R>;\n} = Function.dual(\n 2,\n <A, E, R>(effect: Effect.Effect<A, E, R>, style: InputStyle): Effect.Effect<A, E, R> =>\n Effect.provideService(effect, Current, style),\n);\n"],"mappings":";;;;;;;;;AAIA,MAAM,UAAkC;CACtC,MAAM;CACN,SAAS;CACT,KAAK;CACL,SAAS;CACT,MAAM;CACN,KAAK;CACL,OAAO;CACP,KAAK;CACL,KAAK;CACL,QAAQ;CACR,OAAO;CACP,OAAO;CACP,QAAQ;CACR,KAAK;CACL,QAAQ;CACR,KAAK;CACL,OAAO;CACP,UAAU;CACV,KAAK;CACL,WAAW;CACX,QAAQ;CACR,KAAK;CACL,QAAQ;CACR,MAAM;CACN,KAAK;CACL,QAAQ;CACR,UAAU;CACV,IAAI;CACJ,MAAM;CACN,MAAM;CACN,OAAO;CACP,SAAS;CACT,WAAW;CACX,WAAW;CACX,YAAY;AACd;AAEA,MAAM,QAAQ,IAAI,IAAI,OAAO,OAAO,OAAO,CAAC;;AAG5C,MAAa,SAAS,SAAoD;CACxE,MAAM,SAAwB,CAAC;CAC/B,IAAI,WAAW;CAGf,KAAK,MAAM,aAAa,MACtB,IAAI,cAAc,OAAO,SAAS,KAAK,MAAM,IAAI;EAC/C,OAAO,KAAK,QAAQ;EACpB,WAAW;CACb,OAAO,Y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
import { refuse } from "../BrowserError.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { c as isPage } from "./Page-DqF-tuTx.mjs";
|
|
4
|
+
import { read as read$1 } from "../Frame.mjs";
|
|
5
|
+
import { Snapshot, read as read$2 } from "../Snapshot.mjs";
|
|
6
|
+
import { Window, read as read$3 } from "../Window.mjs";
|
|
7
|
+
import { Duration, Effect, Function, Option, Result, Schema } from "effect";
|
|
5
8
|
import { Prompt } from "effect/ai";
|
|
6
|
-
//#region src/
|
|
9
|
+
//#region src/timeline/internal/words.ts
|
|
7
10
|
const quoted = (value) => JSON.stringify(value ?? "");
|
|
8
11
|
/** A subject in words, such as `button "Play"`; one without a name says where it was. */
|
|
9
12
|
const named = (subject, point) => {
|
|
@@ -42,18 +45,18 @@ const describe = (change, grouped = false) => {
|
|
|
42
45
|
}
|
|
43
46
|
};
|
|
44
47
|
//#endregion
|
|
45
|
-
//#region src/
|
|
48
|
+
//#region src/timeline/Moment.ts
|
|
46
49
|
/**
|
|
47
50
|
* What a page showed, and what changed on it, over a window of time.
|
|
48
51
|
*
|
|
49
52
|
* A page's timeline has three tracks on its browser's host clock: its events, what visibly changed
|
|
50
53
|
* on it (`Change`), and its screencast frames. A `Window` holds the three from `since` to `until`,
|
|
51
|
-
* and says why a part it could not read is missing rather than fail. `
|
|
54
|
+
* and says why a part it could not read is missing rather than fail. `Window.read` takes one, which
|
|
52
55
|
* can end in the past, at a frame a delayed consumer airs late, so that a line written now tells
|
|
53
56
|
* what its viewers will see. Its `account` says what was so at its end: how long the page had been
|
|
54
57
|
* still, which of its changes were still under way, and which had settled.
|
|
55
58
|
*
|
|
56
|
-
* A `Moment` is a window that ends at a picture of the page now: `
|
|
59
|
+
* A `Moment` is a window that ends at a picture of the page now: `read` takes the picture, then
|
|
57
60
|
* the window up to it, and on request the page's outline. `toPrompt` turns a moment into one user
|
|
58
61
|
* message for any `effect/ai` call: a structured answer from `LanguageModel.generateObject`, a
|
|
59
62
|
* caption from `generateText`, or one turn of a `Chat` that follows moment after moment. It leads
|
|
@@ -67,14 +70,27 @@ const describe = (change, grouped = false) => {
|
|
|
67
70
|
* A moment's picture is the newest frame if it was painted after the page's latest input and
|
|
68
71
|
* completed action, at most 250 ms ago, else a new screenshot timed by its capture.
|
|
69
72
|
*
|
|
73
|
+
* @stability stable
|
|
70
74
|
* @since 0.3.0
|
|
71
75
|
*/
|
|
76
|
+
var Moment_exports = /* @__PURE__ */ __exportAll({
|
|
77
|
+
Moment: () => Moment,
|
|
78
|
+
Window: () => Window,
|
|
79
|
+
account: () => account,
|
|
80
|
+
describeChange: () => describe,
|
|
81
|
+
read: () => read,
|
|
82
|
+
toPrompt: () => toPrompt
|
|
83
|
+
});
|
|
72
84
|
/**
|
|
73
85
|
* A window that ends at a picture of the page, its last frame, unless `missing` says why it has
|
|
74
86
|
* none. Its frames are a few, spread over the window, so that it still begins where it starts.
|
|
87
|
+
*
|
|
88
|
+
* @stability stable
|
|
89
|
+
* @category schemas
|
|
90
|
+
* @since 0.3.0
|
|
75
91
|
*/
|
|
76
|
-
var Moment = class extends Window.extend("effect-browser/Moment")({
|
|
77
|
-
/** The page's outline at the end of the window, when the
|
|
92
|
+
var Moment = class extends Window.extend("effect-browser/timeline/Moment")({
|
|
93
|
+
/** The page's outline at the end of the window, when the read asked for it. */
|
|
78
94
|
snapshot: Schema.optional(Snapshot) }) {};
|
|
79
95
|
/** Pick `count` frames spread evenly over `frames`, always including the last. */
|
|
80
96
|
const spread = (frames, count) => {
|
|
@@ -84,15 +100,15 @@ const spread = (frames, count) => {
|
|
|
84
100
|
return Array.from({ length: count }, (_, index) => frames[Math.round(index * step)]).filter((frame) => frame !== void 0);
|
|
85
101
|
};
|
|
86
102
|
const pictureOf = Effect.fnUntraced(function* (page) {
|
|
87
|
-
const frame = yield* page
|
|
88
|
-
return (yield* page.recentEvents).some((event) => event._tag === "Action" && event.at > frame.hostTime) ? yield* page
|
|
103
|
+
const frame = yield* read$1(page, { after: "input" });
|
|
104
|
+
return (yield* page.recentEvents).some((event) => event._tag === "Action" && event.at > frame.hostTime) ? yield* read$1(page, { maxAge: 0 }) : frame;
|
|
89
105
|
});
|
|
90
|
-
const
|
|
106
|
+
const readMoment = Effect.fn("Moment.read")(function* (page, options = {}) {
|
|
91
107
|
const count = options.frames ?? 2;
|
|
92
108
|
if (!Number.isSafeInteger(count) || count < 1) return yield* refuse("moment", "frames must be a positive safe integer");
|
|
93
109
|
const outline = options.snapshot ?? false;
|
|
94
110
|
const { pictured, outlined } = yield* Effect.all({
|
|
95
|
-
pictured: Effect.result(pictureOf(page)).pipe(Effect.flatMap((picture) => Effect.map(page
|
|
111
|
+
pictured: Effect.result(pictureOf(page)).pipe(Effect.flatMap((picture) => Effect.map(read$3(page, {
|
|
96
112
|
since: options.since ?? Duration.seconds(5),
|
|
97
113
|
until: Result.getOrUndefined(picture),
|
|
98
114
|
unmask: options.unmask
|
|
@@ -100,7 +116,7 @@ const capture = Effect.fn("Moment.capture")(function* (page, options = {}) {
|
|
|
100
116
|
window,
|
|
101
117
|
picture
|
|
102
118
|
})))),
|
|
103
|
-
outlined: Effect.result(outline === false ? Effect.void : page
|
|
119
|
+
outlined: Effect.result(outline === false ? Effect.void : read$2(page, {
|
|
104
120
|
maxChars: 4e3,
|
|
105
121
|
...outline === true ? {} : outline
|
|
106
122
|
}))
|
|
@@ -118,6 +134,15 @@ const capture = Effect.fn("Moment.capture")(function* (page, options = {}) {
|
|
|
118
134
|
]
|
|
119
135
|
});
|
|
120
136
|
});
|
|
137
|
+
/**
|
|
138
|
+
* A moment of the page now: its picture, the window up to it, and the outline if asked. What
|
|
139
|
+
* cannot be read is missing from the moment, with why, rather than failing it.
|
|
140
|
+
*
|
|
141
|
+
* @stability stable
|
|
142
|
+
* @category constructors
|
|
143
|
+
* @since 0.3.0
|
|
144
|
+
*/
|
|
145
|
+
const read = Function.dual((args) => isPage(args[0]), readMoment);
|
|
121
146
|
/** A window's record of changes, if it saw any of the window: a page's first has none. */
|
|
122
147
|
const recordOf = ({ changes }) => changes !== void 0 && changes.from < changes.until ? changes : void 0;
|
|
123
148
|
/** Whether a change was still under way at `until`, by its own pace. */
|
|
@@ -129,6 +154,10 @@ const underWay = (change, until) => {
|
|
|
129
154
|
* An account of the window's page at its end: how long it had been still, and which of its
|
|
130
155
|
* changes were still under way and which had settled. A window whose record saw none of it has
|
|
131
156
|
* neither.
|
|
157
|
+
*
|
|
158
|
+
* @stability stable
|
|
159
|
+
* @category combinators
|
|
160
|
+
* @since 0.3.0
|
|
132
161
|
*/
|
|
133
162
|
const account = (window) => {
|
|
134
163
|
const record = recordOf(window);
|
|
@@ -274,6 +303,10 @@ const happened = (moment) => {
|
|
|
274
303
|
* frames captioned with their times, the last one "the moment" where it is the picture at its end.
|
|
275
304
|
* Give a model its task with `Prompt.setSystem`, and add what the caller knows about the page as
|
|
276
305
|
* more text.
|
|
306
|
+
*
|
|
307
|
+
* @stability stable
|
|
308
|
+
* @category combinators
|
|
309
|
+
* @since 0.3.0
|
|
277
310
|
*/
|
|
278
311
|
const toPrompt = (moment) => {
|
|
279
312
|
const count = moment.frames.length;
|
|
@@ -293,6 +326,6 @@ const toPrompt = (moment) => {
|
|
|
293
326
|
})])] })]);
|
|
294
327
|
};
|
|
295
328
|
//#endregion
|
|
296
|
-
export {
|
|
329
|
+
export { toPrompt as a, read as i, Moment_exports as n, describe as o, account as r, Moment as t };
|
|
297
330
|
|
|
298
|
-
//# sourceMappingURL=Moment.mjs.map
|
|
331
|
+
//# sourceMappingURL=Moment-CstaX1mR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Moment-CstaX1mR.mjs","names":["Snapshot.Snapshot","Frame.read","Window.read","Snapshot.read","Page.isPage"],"sources":["../../src/timeline/internal/words.ts","../../src/timeline/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. `Window.read` 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: `read` 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 * @stability stable\n * @since 0.3.0\n */\nimport { Duration, Effect, Function, Option, Result, Schema } from \"effect\";\nimport { Prompt } from \"effect/ai\";\n\nimport { type BrowserError, refuse } from \"../BrowserError.ts\";\nimport { type Action } from \"../BrowserEvent.ts\";\nimport { type Change, type Changes } from \"../Change.ts\";\nimport * as Frame from \"../Frame.ts\";\nimport * as Page from \"../Page.ts\";\nimport * as Snapshot from \"../Snapshot.ts\";\nimport { describe, named, quoted, where } from \"./internal/words.ts\";\n\n/**\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport { Window } from \"../Window.ts\";\nimport * as 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 *\n * @stability stable\n * @category schemas\n * @since 0.3.0\n */\nexport class Moment extends Window.Window.extend<Moment>(\"effect-browser/timeline/Moment\")({\n /** The page's outline at the end of the window, when the read asked for it. */\n snapshot: Schema.optional(Snapshot.Snapshot),\n}) {}\n\n/**\n * What `read` reads: where its window starts, how many frames it keeps, and the outline.\n *\n * @stability stable\n * @category options\n * @since 0.3.0\n */\nexport interface MomentOptions {\n /**\n * Where the window starts, as for `Window.read`: 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?: Window.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?: 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.Frame>, count: number): ReadonlyArray<Frame.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 => 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* Frame.read(page, { after: \"input\" });\n const events = yield* page.recentEvents;\n\n return events.some((event) => event._tag === \"Action\" && event.at > frame.hostTime)\n ? yield* Frame.read(page, { maxAge: 0 })\n : frame;\n});\n\nconst readMoment = Effect.fn(\"Moment.read\")(function* (\n page: Page.Page,\n options: MomentOptions = {},\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 Window.read(page, {\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 : Snapshot.read(page, { 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/**\n * A moment of the page now: its picture, the window up to it, and the outline if asked. What\n * cannot be read is missing from the moment, with why, rather than failing it.\n *\n * @stability stable\n * @category constructors\n * @since 0.3.0\n */\nexport const read: {\n (options?: MomentOptions): (page: Page.Page) => Effect.Effect<Moment, BrowserError>;\n (page: Page.Page, options?: MomentOptions): Effect.Effect<Moment, BrowserError>;\n} = Function.dual((args) => Page.isPage(args[0]), readMoment);\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.Window) =>\n changes !== undefined && changes.from < changes.until ? changes : undefined;\n\n/**\n * What a window says of its page at its end: what was still in flux, and what had settled.\n *\n * @stability stable\n * @category models\n * @since 0.3.0\n */\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 *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport const account = (window: 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 *\n * @stability stable\n * @category combinators\n * @since 0.3.0\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/**\n * Describe one change using the same prose as moment prompts.\n *\n * @stability stable\n * @category combinators\n * @since 0.3.0\n */\nexport { describe as describeChange } from \"./internal/words.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, r as SnapshotOptions } from "../Snapshot-CtBVOtuu.mjs";
|
|
6
|
-
import { t as Window } from "../Window-CMddGMt1.mjs";
|
|
7
|
-
import { f as Page, k as WindowOptions, p as Page_d_exports } from "../Page-CvsOEorc.mjs";
|
|
1
|
+
import { t as BrowserError } from "./BrowserError-CsuRYcDX.mjs";
|
|
2
|
+
import { C as TextInserted, D as WheelScrolled, E as TrackPlanned, T as TrackPerformed, _ as PointerReleased, b as SessionEnding, d as Navigated, f as PageClosed, g as PointerPressed, h as PageUntracked, l as Disconnected, m as PageOpened, n as ActionAnnounced, o as CursorChanged, p as PageLoaded, s as DialogShown, t as Action, u as KeyChanged, y as RequestRefused } from "./BrowserEvent-tGPYYf6R.mjs";
|
|
3
|
+
import { C as Window_d_exports, S as WindowOptions, ft as Changes, it as Snapshot_d_exports, nt as Snapshot, o as Page, rt as SnapshotOptions, s as Page_d_exports, ut as Change, x as Window, xt as Frame_d_exports, yt as Frame } from "./Page-BfGxn7oN.mjs";
|
|
8
4
|
import { Effect, Schema } from "effect";
|
|
9
5
|
import { Prompt } from "effect/ai";
|
|
10
|
-
//#region src/
|
|
6
|
+
//#region src/timeline/internal/words.d.ts
|
|
11
7
|
/** A change in words, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
|
|
12
8
|
declare const describe: (change: Change, grouped?: boolean) => string;
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
declare namespace Moment_d_exports {
|
|
10
|
+
export { Account, Moment, MomentOptions, Window, account, describe as describeChange, read, toPrompt };
|
|
11
|
+
}
|
|
15
12
|
declare const Moment_base: Schema.Class<Moment, Schema.Struct<{
|
|
16
13
|
readonly page: Schema.String;
|
|
17
14
|
readonly since: Schema.Finite;
|
|
18
15
|
readonly until: Schema.Finite;
|
|
19
|
-
readonly events: Schema.$Array<Schema.Union<readonly [typeof RequestRefused, typeof PageOpened, typeof PageClosed, typeof PageUntracked, typeof Navigated, typeof PageLoaded, typeof Action, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged, typeof DialogShown, typeof Disconnected, typeof SessionEnding]>>;
|
|
16
|
+
readonly events: Schema.$Array<Schema.Union<readonly [typeof RequestRefused, typeof PageOpened, typeof PageClosed, typeof PageUntracked, typeof Navigated, typeof PageLoaded, typeof Action, typeof ActionAnnounced, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged, typeof DialogShown, typeof Disconnected, typeof SessionEnding]>>;
|
|
20
17
|
readonly changes: Schema.optional<typeof Changes>;
|
|
21
18
|
readonly frames: Schema.$Array<typeof Frame>;
|
|
22
19
|
readonly missing: Schema.$Array<typeof BrowserError>;
|
|
@@ -25,11 +22,22 @@ declare const Moment_base: Schema.Class<Moment, Schema.Struct<{
|
|
|
25
22
|
/**
|
|
26
23
|
* A window that ends at a picture of the page, its last frame, unless `missing` says why it has
|
|
27
24
|
* none. Its frames are a few, spread over the window, so that it still begins where it starts.
|
|
25
|
+
*
|
|
26
|
+
* @stability stable
|
|
27
|
+
* @category schemas
|
|
28
|
+
* @since 0.3.0
|
|
29
|
+
*/
|
|
30
|
+
declare class Moment extends Moment_base {}
|
|
31
|
+
/**
|
|
32
|
+
* What `read` reads: where its window starts, how many frames it keeps, and the outline.
|
|
33
|
+
*
|
|
34
|
+
* @stability stable
|
|
35
|
+
* @category options
|
|
36
|
+
* @since 0.3.0
|
|
28
37
|
*/
|
|
29
|
-
|
|
30
|
-
export interface CaptureOptions {
|
|
38
|
+
interface MomentOptions {
|
|
31
39
|
/**
|
|
32
|
-
* Where the window starts, as for `
|
|
40
|
+
* Where the window starts, as for `Window.read`: a previous window or moment, so that consecutive
|
|
33
41
|
* ones neither repeat nor miss an event or a change, or a `Duration` back from the picture.
|
|
34
42
|
* Defaults to 5 seconds.
|
|
35
43
|
*/
|
|
@@ -45,9 +53,26 @@ export interface CaptureOptions {
|
|
|
45
53
|
/** Show what fields hold in the moment's changes; a secret field still reads `••••`. */
|
|
46
54
|
readonly unmask?: boolean | undefined;
|
|
47
55
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
/**
|
|
57
|
+
* A moment of the page now: its picture, the window up to it, and the outline if asked. What
|
|
58
|
+
* cannot be read is missing from the moment, with why, rather than failing it.
|
|
59
|
+
*
|
|
60
|
+
* @stability stable
|
|
61
|
+
* @category constructors
|
|
62
|
+
* @since 0.3.0
|
|
63
|
+
*/
|
|
64
|
+
declare const read: {
|
|
65
|
+
(options?: MomentOptions): (page: Page) => Effect.Effect<Moment, BrowserError>;
|
|
66
|
+
(page: Page, options?: MomentOptions): Effect.Effect<Moment, BrowserError>;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* What a window says of its page at its end: what was still in flux, and what had settled.
|
|
70
|
+
*
|
|
71
|
+
* @stability stable
|
|
72
|
+
* @category models
|
|
73
|
+
* @since 0.3.0
|
|
74
|
+
*/
|
|
75
|
+
interface Account {
|
|
51
76
|
/**
|
|
52
77
|
* How long, in milliseconds, the page had been still at the end: since the last change in view
|
|
53
78
|
* its record shows, or the last paint its screencast frames show, or else since the window, or
|
|
@@ -69,8 +94,12 @@ export interface Account {
|
|
|
69
94
|
* An account of the window's page at its end: how long it had been still, and which of its
|
|
70
95
|
* changes were still under way and which had settled. A window whose record saw none of it has
|
|
71
96
|
* neither.
|
|
97
|
+
*
|
|
98
|
+
* @stability stable
|
|
99
|
+
* @category combinators
|
|
100
|
+
* @since 0.3.0
|
|
72
101
|
*/
|
|
73
|
-
|
|
102
|
+
declare const account: (window: Window) => Account;
|
|
74
103
|
/**
|
|
75
104
|
* The moment as one user message: the page's outline when the moment has one, what changed, most
|
|
76
105
|
* notable first, what kept changing told as still changing at the moment or settled since when, by
|
|
@@ -79,8 +108,12 @@ export declare const account: (window: Window) => Account;
|
|
|
79
108
|
* frames captioned with their times, the last one "the moment" where it is the picture at its end.
|
|
80
109
|
* Give a model its task with `Prompt.setSystem`, and add what the caller knows about the page as
|
|
81
110
|
* more text.
|
|
111
|
+
*
|
|
112
|
+
* @stability stable
|
|
113
|
+
* @category combinators
|
|
114
|
+
* @since 0.3.0
|
|
82
115
|
*/
|
|
83
|
-
|
|
116
|
+
declare const toPrompt: (moment: Moment) => Prompt.Prompt;
|
|
84
117
|
//#endregion
|
|
85
|
-
export {
|
|
86
|
-
//# sourceMappingURL=Moment.d.mts.map
|
|
118
|
+
export { account as a, describe as c, Moment_d_exports as i, Moment as n, read as o, MomentOptions as r, toPrompt as s, Account as t };
|
|
119
|
+
//# sourceMappingURL=Moment-DOcldBdf.d.mts.map
|