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
|
@@ -5,6 +5,26 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type Clock, Duration, Effect, Option, Semaphore } from "effect";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A duration in milliseconds: NaN for an input that is no duration, or that holds a NaN, which
|
|
10
|
+
* `Duration.fromInput` would read as zero. An infinite one stays infinite, for the caller's bounds.
|
|
11
|
+
*/
|
|
12
|
+
export const millisOf = (input: Duration.Input): number => {
|
|
13
|
+
const parts =
|
|
14
|
+
typeof input === "number"
|
|
15
|
+
? [input]
|
|
16
|
+
: typeof input === "object" && !Duration.isDuration(input)
|
|
17
|
+
? Object.values(input)
|
|
18
|
+
: [];
|
|
19
|
+
|
|
20
|
+
return parts.some((part) => typeof part === "number" && Number.isNaN(part))
|
|
21
|
+
? Number.NaN
|
|
22
|
+
: Option.match(Duration.fromInput(input), {
|
|
23
|
+
onNone: () => Number.NaN,
|
|
24
|
+
onSome: Duration.toMillis,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
8
28
|
/** Read the captured owner's clock, including from native callbacks, without changing its origin. */
|
|
9
29
|
export const monotonicMillis = (clock: Clock.Clock): number =>
|
|
10
30
|
Number(clock.monotonicTimeNanosUnsafe()) / 1e6;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import { Duration, Effect } from "effect";
|
|
8
8
|
|
|
9
9
|
import { NotActionable, StaleRef } from "../../BrowserError.ts";
|
|
10
|
+
import { maximumDurationMillis } from "../../InputStyle.ts";
|
|
10
11
|
import type { ClickOptions, PressOptions, ScrollOptions, Target, TypeOptions } from "../../Page.ts";
|
|
11
|
-
import { maximumDurationMillis } from "../../Style.ts";
|
|
12
12
|
import { type Bridge, scriptCall } from "../page/bridge.ts";
|
|
13
13
|
import { decodeWith, failWith, type PageContext, refuse } from "../page/context.ts";
|
|
14
14
|
import type { Viewport } from "../page/viewport.ts";
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
TextInserted,
|
|
13
13
|
WheelScrolled,
|
|
14
14
|
} from "../../BrowserEvent.ts";
|
|
15
|
-
import * as BrowserClock from "
|
|
16
|
-
import type { Point } from "
|
|
15
|
+
import * as BrowserClock from "../clock.ts";
|
|
16
|
+
import type { Point } from "../geometry.ts";
|
|
17
17
|
import { type PageContext, reasonOf, undispatched } from "../page/context.ts";
|
|
18
18
|
import type * as Replies from "../page/replies.ts";
|
|
19
19
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Schema } from "effect";
|
|
7
7
|
|
|
8
|
-
import type { Point } from "
|
|
8
|
+
import type { Point } from "../geometry.ts";
|
|
9
9
|
import type { Names } from "../reading/names.inpage.ts";
|
|
10
10
|
import { type Evidence, type EvidenceReader, EvidenceSchema } from "./evidence.inpage.ts";
|
|
11
11
|
import type { Targets } from "./targets.inpage.ts";
|
|
@@ -8,9 +8,9 @@ import { Effect } from "effect";
|
|
|
8
8
|
import { recorded, nameOf, type Action } from "../../Action.ts";
|
|
9
9
|
import { type BrowserError, InvalidRequest, NotActionable, StaleRef } from "../../BrowserError.ts";
|
|
10
10
|
import { InputRequest } from "../../Page.ts";
|
|
11
|
-
import * as Url from "../../Url.ts";
|
|
12
11
|
import { type Bridge, scriptCall } from "../page/bridge.ts";
|
|
13
12
|
import { contextGone, decodeWith, failWith, type PageContext } from "../page/context.ts";
|
|
13
|
+
import * as Url from "../url.ts";
|
|
14
14
|
import * as Script from "./guard.inpage.ts";
|
|
15
15
|
|
|
16
16
|
export interface Approval {
|
|
@@ -6,20 +6,20 @@ import { Deferred, Duration, Effect, Exit, Option, Ref } from "effect";
|
|
|
6
6
|
|
|
7
7
|
import { recorded, nameOf, type Action as ActionValue } from "../../Action.ts";
|
|
8
8
|
import { BrowserError, PolicyTimeout, Timeout } from "../../BrowserError.ts";
|
|
9
|
-
import { Action, Subject } from "../../BrowserEvent.ts";
|
|
10
|
-
import type
|
|
9
|
+
import { Action, ActionAnnounced, Subject } from "../../BrowserEvent.ts";
|
|
10
|
+
import { Current, type InputStyle, validated } from "../../InputStyle.ts";
|
|
11
11
|
import { type Point, redacted, type ResolvedTarget } from "../../Page.ts";
|
|
12
|
-
import
|
|
13
|
-
import { redact } from "../../Url.ts";
|
|
12
|
+
import type * as BrowserClock from "../clock.ts";
|
|
14
13
|
import { failWith, type PageContext, undispatched } from "../page/context.ts";
|
|
15
14
|
import { Correlation, FailFast } from "../page/lane.ts";
|
|
16
15
|
import * as Replies from "../page/replies.ts";
|
|
16
|
+
import { redact } from "../url.ts";
|
|
17
17
|
import type { Dispatch } from "./dispatch.ts";
|
|
18
18
|
import type { Approval, PolicyPlan } from "./guard.ts";
|
|
19
19
|
|
|
20
20
|
export interface InputMarks {
|
|
21
21
|
/** How the action's input is sent: plainly, or performed for viewers. */
|
|
22
|
-
readonly style:
|
|
22
|
+
readonly style: InputStyle;
|
|
23
23
|
/**
|
|
24
24
|
* Time the style spends showing the input, such as a glide or typing at a person's pace, planned
|
|
25
25
|
* from now: the deadline moves back by as much, so presentation has a budget of its own.
|
|
@@ -32,6 +32,11 @@ export interface InputMarks {
|
|
|
32
32
|
readonly at: (point: Point) => Effect.Effect<void>;
|
|
33
33
|
/** What the input acts on, and for a drag where it ends, as the page names them now. */
|
|
34
34
|
readonly on: (subject: Named, to?: Named) => Effect.Effect<void>;
|
|
35
|
+
/**
|
|
36
|
+
* The pointer is about to travel to the action's target at `to`: announce what the action acts
|
|
37
|
+
* on, and wait for the style's lead.
|
|
38
|
+
*/
|
|
39
|
+
readonly announce: (to: Point) => Effect.Effect<void>;
|
|
35
40
|
/** The action's text is not bound for a secret field, so its record may keep it. */
|
|
36
41
|
readonly reveal: Effect.Effect<void>;
|
|
37
42
|
readonly input: Replies.Run;
|
|
@@ -145,6 +150,29 @@ const admission = (page: PageContext, pending: Set<Deferred.Deferred<void>>, nam
|
|
|
145
150
|
};
|
|
146
151
|
};
|
|
147
152
|
|
|
153
|
+
/** Announce an action from what it has found, then wait for its style's lead. */
|
|
154
|
+
const announcing =
|
|
155
|
+
(
|
|
156
|
+
page: PageContext,
|
|
157
|
+
name: Action["name"],
|
|
158
|
+
style: InputStyle,
|
|
159
|
+
acted: Ref.Ref<Pick<Action, "subject" | "to" | "box">>,
|
|
160
|
+
) =>
|
|
161
|
+
(to: Point) =>
|
|
162
|
+
Effect.gen(function* () {
|
|
163
|
+
const event = new ActionAnnounced({
|
|
164
|
+
at: page.now(),
|
|
165
|
+
page: page.id,
|
|
166
|
+
name,
|
|
167
|
+
correlation: yield* Correlation,
|
|
168
|
+
...(yield* Ref.get(acted)),
|
|
169
|
+
...to,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
page.publish(event);
|
|
173
|
+
if (style.lead !== undefined) yield* style.lead(event);
|
|
174
|
+
});
|
|
175
|
+
|
|
148
176
|
/** Close a run on every exit while preserving its native replies for the page's next input. */
|
|
149
177
|
const useRun = <A>(
|
|
150
178
|
page: PageContext,
|
|
@@ -219,6 +247,7 @@ export const make = (page: PageContext, sender: Dispatch) => {
|
|
|
219
247
|
touched: touch,
|
|
220
248
|
at: (point: Point) => Ref.set(at, Option.some(point)),
|
|
221
249
|
on: (subject: Named, to?: Named) => Ref.set(acted, actedOn(subject, to)),
|
|
250
|
+
announce: announcing(page, name, style, acted),
|
|
222
251
|
reveal: Effect.sync(() => {
|
|
223
252
|
revealed = true;
|
|
224
253
|
}),
|
|
@@ -362,8 +391,7 @@ export const make = (page: PageContext, sender: Dispatch) => {
|
|
|
362
391
|
box,
|
|
363
392
|
text:
|
|
364
393
|
info.text === undefined ? undefined : revealed ? info.text.slice(0, 200) : redacted,
|
|
365
|
-
|
|
366
|
-
y: Option.getOrUndefined(Option.map(point, (p) => p.y)),
|
|
394
|
+
...Option.match(point, { onNone: () => ({}), onSome: ({ x, y }) => ({ x, y }) }),
|
|
367
395
|
ok: Exit.isSuccess(exit),
|
|
368
396
|
dispatched,
|
|
369
397
|
error: Option.match(failure, {
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
import { Duration, Effect, MutableRef, Option, Schema } from "effect";
|
|
7
7
|
|
|
8
8
|
import { CursorChanged, TrackPerformed, TrackPlanned } from "../../BrowserEvent.ts";
|
|
9
|
-
import
|
|
9
|
+
import type { WheelStep } from "../../InputStyle.ts";
|
|
10
10
|
import type { Point } from "../../Page.ts";
|
|
11
|
-
import
|
|
11
|
+
import * as Motion from "../geometry.ts";
|
|
12
12
|
import { type PageContext, refuse } from "../page/context.ts";
|
|
13
13
|
import type { Viewport } from "../page/viewport.ts";
|
|
14
14
|
import type { Dispatch } from "./dispatch.ts";
|
|
@@ -18,18 +18,21 @@ export const make = (page: PageContext, dispatch: Dispatch, viewport: Viewport)
|
|
|
18
18
|
const { id, pointer, publish, now, span } = page;
|
|
19
19
|
const { inputClocks, inputCall, dispatchMouse, sendMouse } = dispatch;
|
|
20
20
|
|
|
21
|
-
// Travel toward a press only prepares the action
|
|
22
|
-
// button it has already
|
|
21
|
+
// Travel toward a press only prepares the action, as does travel that reveals a target out of
|
|
22
|
+
// view before it is found; a hover is its travel, and a drag holds the button it has already
|
|
23
|
+
// pressed. Travel to the action's own target announces it first.
|
|
23
24
|
const moveTo = (
|
|
24
25
|
operation: string,
|
|
25
26
|
marks: InputMarks,
|
|
26
27
|
to: Point,
|
|
27
28
|
cursor?: string,
|
|
28
|
-
travel: "approach" | "hover" | "drag" = "approach",
|
|
29
|
+
travel: "approach" | "reveal" | "hover" | "drag" = "approach",
|
|
29
30
|
) =>
|
|
30
31
|
Effect.gen(function* () {
|
|
31
32
|
const dragging = travel === "drag";
|
|
32
33
|
const { style } = marks;
|
|
34
|
+
|
|
35
|
+
if (travel === "approach" || travel === "hover") yield* marks.announce(to);
|
|
33
36
|
const drawn = style.pointer ?? pointer;
|
|
34
37
|
const size = yield* viewport.viewportFor(operation);
|
|
35
38
|
|
|
@@ -80,7 +83,7 @@ export const make = (page: PageContext, dispatch: Dispatch, viewport: Viewport)
|
|
|
80
83
|
const remaining = at + sample.afterMillis - now();
|
|
81
84
|
|
|
82
85
|
if (remaining > 0) yield* Effect.sleep(Duration.millis(remaining));
|
|
83
|
-
yield* travel === "approach" ? marks.touched : marks.sent;
|
|
86
|
+
yield* travel === "approach" || travel === "reveal" ? marks.touched : marks.sent;
|
|
84
87
|
yield* inputCall(
|
|
85
88
|
operation,
|
|
86
89
|
run.send(() =>
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
import { Schema } from "effect";
|
|
7
7
|
|
|
8
8
|
import { Box, Subject } from "../../BrowserEvent.ts";
|
|
9
|
-
import { Point } from "
|
|
9
|
+
import { Point } from "../geometry.ts";
|
|
10
10
|
import type { ContextReader } from "../reading/context.inpage.ts";
|
|
11
11
|
import type { Names } from "../reading/names.inpage.ts";
|
|
12
|
-
import type {
|
|
12
|
+
import type { Walked } from "../reading/walk.inpage.ts";
|
|
13
13
|
|
|
14
14
|
export type ResolvedPoint = typeof ResolvedPointSchema.Type;
|
|
15
15
|
export type PointResult = typeof PointResultSchema.Type;
|
|
16
16
|
|
|
17
|
-
export const targets = (names: Names, walked:
|
|
17
|
+
export const targets = (names: Names, walked: Walked, placing: ContextReader) => {
|
|
18
18
|
const { describe, isDisabled, lookup, nameOf, parentOf, roleOf } = names;
|
|
19
19
|
const { boxOf, controlOf, hitAt } = walked;
|
|
20
20
|
const { contextOf } = placing;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* In the page: the rules `find` matches by. It touches no DOM, so it also runs outside a page.
|
|
2
|
+
* In the page: the rules `Snapshot.find` matches by. It touches no DOM, so it also runs outside a page.
|
|
3
3
|
*
|
|
4
4
|
* - A role matches when it is the same token, ignoring case and the space around it.
|
|
5
5
|
* - A name given as a string matches when the two read the same once their spaces are collapsed,
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
* - `near` matches when its words appear, whole and in order, in any of the element's context:
|
|
10
10
|
* its row, column, label or heading. Replay chooses among candidates by the same rule.
|
|
11
11
|
*/
|
|
12
|
-
import type { SubjectContext } from "
|
|
13
|
-
import type {
|
|
14
|
-
import type { FindQuery } from "
|
|
12
|
+
import type { SubjectContext } from "../BrowserEvent.ts";
|
|
13
|
+
import type { Picks } from "../Layout.ts";
|
|
14
|
+
import type { FindQuery } from "../Snapshot.ts";
|
|
15
|
+
import type { Point } from "./geometry.ts";
|
|
16
|
+
import type { PickRequest } from "./reading/layout.inpage.ts";
|
|
15
17
|
|
|
16
18
|
/** A string, or a pattern sent to the page as its source and flags. */
|
|
17
19
|
export type Wanted = string | { readonly source: string; readonly flags: string };
|
|
@@ -27,22 +29,29 @@ export interface FindRequest {
|
|
|
27
29
|
readonly scope: "viewport" | "document";
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
const wanted = (value: string | RegExp | undefined): Wanted | null =>
|
|
33
|
+
value instanceof RegExp ? { source: value.source, flags: value.flags } : (value ?? null);
|
|
34
|
+
|
|
30
35
|
/** A public query in its serializable, fully specified form. */
|
|
31
|
-
export const request = (query: FindQuery, scope: FindRequest["scope"]): FindRequest => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
export const request = (query: FindQuery, scope: FindRequest["scope"]): FindRequest => ({
|
|
37
|
+
selector: query.selector ?? null,
|
|
38
|
+
state: query.state ?? "visible",
|
|
39
|
+
role: query.role ?? null,
|
|
40
|
+
name: wanted(query.name),
|
|
41
|
+
text: wanted(query.text),
|
|
42
|
+
near: query.near ?? null,
|
|
43
|
+
at: query.at ?? null,
|
|
44
|
+
scope: query.scope ?? scope,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/** Layout picks in their serializable form. */
|
|
48
|
+
export const pickRequests = (picks: Picks): ReadonlyArray<PickRequest> =>
|
|
49
|
+
Object.entries(picks).map(([id, pick]) => ({
|
|
50
|
+
...request(pick, "document"),
|
|
51
|
+
id,
|
|
52
|
+
choose: pick.choose ?? "first",
|
|
53
|
+
words: wanted(pick.words),
|
|
54
|
+
}));
|
|
46
55
|
|
|
47
56
|
/** What a query is matched against, read only when a rule needs it. */
|
|
48
57
|
export interface Candidate {
|
|
@@ -9,17 +9,18 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { Deferred, Effect, Schema, SynchronizedRef } from "effect";
|
|
11
11
|
|
|
12
|
+
import type { InitScript } from "../../Browser.ts";
|
|
12
13
|
import { type BrowserError, Failed } from "../../BrowserError.ts";
|
|
13
14
|
import { Navigated, PageLoaded } from "../../BrowserEvent.ts";
|
|
14
|
-
import { match } from "../../Matching.ts";
|
|
15
|
-
import * as Url from "../../Url.ts";
|
|
16
15
|
import { edit, type Edit } from "../input/edit.inpage.ts";
|
|
17
16
|
import { evidence } from "../input/evidence.inpage.ts";
|
|
18
17
|
import { guard, type Guard } from "../input/guard.inpage.ts";
|
|
19
18
|
import { targets, type Targets } from "../input/targets.inpage.ts";
|
|
19
|
+
import { match } from "../matching.ts";
|
|
20
20
|
import { context } from "../reading/context.inpage.ts";
|
|
21
21
|
import { controls } from "../reading/controls.inpage.ts";
|
|
22
22
|
import { expectations, type Expectations } from "../reading/expect.inpage.ts";
|
|
23
|
+
import { layout, type Layouts } from "../reading/layout.inpage.ts";
|
|
23
24
|
import { elements, names } from "../reading/names.inpage.ts";
|
|
24
25
|
import { outline, type Outline } from "../reading/outline.inpage.ts";
|
|
25
26
|
import { ready } from "../reading/ready.inpage.ts";
|
|
@@ -32,8 +33,14 @@ import { history } from "../timeline/history.inpage.ts";
|
|
|
32
33
|
import { marks } from "../timeline/marks.inpage.ts";
|
|
33
34
|
import { record, type Recorder } from "../timeline/record.inpage.ts";
|
|
34
35
|
import { sight } from "../timeline/sight.inpage.ts";
|
|
36
|
+
import * as Url from "../url.ts";
|
|
37
|
+
import { animations, clock, timers } from "./clock.inpage.ts";
|
|
38
|
+
import { compose } from "./compose.inpage.ts";
|
|
35
39
|
import { contextGone, decodeWith, failWith, type PageContext } from "./context.ts";
|
|
40
|
+
import { overlay, type Overlay } from "./overlay.inpage.ts";
|
|
36
41
|
import { Script } from "./port.ts";
|
|
42
|
+
import { pose, type Posing } from "./pose.inpage.ts";
|
|
43
|
+
import { time, type Time } from "./time.inpage.ts";
|
|
37
44
|
|
|
38
45
|
/** What the script installs: a version, and a function of one of its parts for each call. */
|
|
39
46
|
export interface PageApi {
|
|
@@ -42,6 +49,11 @@ export interface PageApi {
|
|
|
42
49
|
dispose: () => void;
|
|
43
50
|
snapshot: Outline["snapshot"];
|
|
44
51
|
find: Subjects["find"];
|
|
52
|
+
layout: Layouts["read"];
|
|
53
|
+
overlay: Overlay["draw"];
|
|
54
|
+
pose: Posing["set"];
|
|
55
|
+
unpose: Posing["clear"];
|
|
56
|
+
step: Time["step"];
|
|
45
57
|
until: Expectations["until"];
|
|
46
58
|
text: Texts["read"];
|
|
47
59
|
record: Recorder["start"];
|
|
@@ -53,7 +65,11 @@ export interface PageApi {
|
|
|
53
65
|
scrollPlan: Targets["scrollPlan"];
|
|
54
66
|
viewport: Outline["viewport"];
|
|
55
67
|
/** The screen as the page reads it, which another session may emulate. */
|
|
56
|
-
screenSize: () => {
|
|
68
|
+
screenSize: () => {
|
|
69
|
+
readonly width: number;
|
|
70
|
+
readonly height: number;
|
|
71
|
+
readonly ratio: number;
|
|
72
|
+
};
|
|
57
73
|
prepareInput: Guard["prepareInput"];
|
|
58
74
|
validateInput: Guard["validateInput"];
|
|
59
75
|
typeable: Edit["typeable"];
|
|
@@ -69,6 +85,7 @@ declare global {
|
|
|
69
85
|
|
|
70
86
|
/** Named factories make the composition contract independent of their declaration order. */
|
|
71
87
|
export const parts = {
|
|
88
|
+
compose,
|
|
72
89
|
elements,
|
|
73
90
|
names,
|
|
74
91
|
walk,
|
|
@@ -78,6 +95,7 @@ export const parts = {
|
|
|
78
95
|
states,
|
|
79
96
|
expectations,
|
|
80
97
|
text,
|
|
98
|
+
layout,
|
|
81
99
|
controls,
|
|
82
100
|
fold,
|
|
83
101
|
history,
|
|
@@ -91,6 +109,9 @@ export const parts = {
|
|
|
91
109
|
evidence,
|
|
92
110
|
guard,
|
|
93
111
|
edit,
|
|
112
|
+
overlay,
|
|
113
|
+
pose,
|
|
114
|
+
time,
|
|
94
115
|
addresses: Url.addresses,
|
|
95
116
|
};
|
|
96
117
|
|
|
@@ -114,42 +135,24 @@ export function install(parts: Parts): PageApi {
|
|
|
114
135
|
|
|
115
136
|
if (installed !== undefined && installed.version === version) return installed;
|
|
116
137
|
installed?.dispose?.();
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const subjected = parts.subjects(named, walked, matching, placing, parts.states(named));
|
|
124
|
-
const texts = parts.text(named, walked);
|
|
125
|
-
const controlled = parts.controls(named, subjected, texts);
|
|
126
|
-
const kept = parts.history(parts.fold());
|
|
127
|
-
const seeing = parts.sight(named, walked, texts, kept);
|
|
128
|
-
const marking = parts.marks(named, kept, seeing);
|
|
129
|
-
const recorder = parts.record(named, texts, kept, seeing, marking);
|
|
130
|
-
const read = parts.outline(named, walked, subjected, texts, controlled, parts.addresses());
|
|
138
|
+
|
|
139
|
+
const { named, walked, placing, overlaid, posing, reads } = parts.compose(
|
|
140
|
+
parts,
|
|
141
|
+
installed?.refs?.next,
|
|
142
|
+
);
|
|
143
|
+
|
|
131
144
|
const located = parts.targets(named, walked, placing);
|
|
132
145
|
const guarded = parts.guard(named, located, parts.evidence(named, placing));
|
|
133
146
|
const edited = parts.edit(named, guarded, placing);
|
|
134
|
-
const readiness = parts.ready(walked, texts, kept);
|
|
135
147
|
|
|
136
148
|
const api: PageApi = {
|
|
149
|
+
...reads,
|
|
137
150
|
version,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
snapshot: read.snapshot,
|
|
141
|
-
find: subjected.find,
|
|
142
|
-
until: parts.expectations(named, subjected, matching).until,
|
|
143
|
-
text: texts.read,
|
|
144
|
-
record: recorder.start,
|
|
145
|
-
stopRecord: recorder.stop,
|
|
146
|
-
changes: parts.changes(named, placing, kept, seeing, marking, recorder).read,
|
|
147
|
-
ready: readiness.wait,
|
|
148
|
-
settle: readiness.settle,
|
|
151
|
+
dispose: reads.stopRecord,
|
|
152
|
+
step: parts.time(overlaid, posing).step,
|
|
149
153
|
point: located.point,
|
|
150
154
|
scrollPlan: located.scrollPlan,
|
|
151
|
-
|
|
152
|
-
screenSize: () => ({ width: screen.width, height: screen.height }),
|
|
155
|
+
screenSize: () => ({ width: screen.width, height: screen.height, ratio: devicePixelRatio }),
|
|
153
156
|
prepareInput: guarded.prepareInput,
|
|
154
157
|
validateInput: guarded.validateInput,
|
|
155
158
|
typeable: edited.typeable,
|
|
@@ -163,10 +166,39 @@ export function install(parts: Parts): PageApi {
|
|
|
163
166
|
return api;
|
|
164
167
|
}
|
|
165
168
|
|
|
169
|
+
const encodeString = Schema.encodeSync(Schema.fromJsonString(Schema.String));
|
|
170
|
+
|
|
171
|
+
export const clockParts = { timers, animations };
|
|
172
|
+
|
|
173
|
+
// A factory applied to its parts, as one expression of their sources.
|
|
174
|
+
const applied = (factory: { toString(): string }, given: Record<string, { toString(): string }>) =>
|
|
175
|
+
`(${factory.toString()})({${Object.entries(given)
|
|
176
|
+
.map(([name, part]) => `${name}: ${part.toString()}`)
|
|
177
|
+
.join(", ")}})`;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The expression of the page clock, a function of its event name, which the page's main world runs
|
|
181
|
+
* before its own scripts; packaging freezes it.
|
|
182
|
+
*/
|
|
183
|
+
export const clockSource = applied(clock, clockParts);
|
|
184
|
+
|
|
166
185
|
/** The expression that installs the script and evaluates to its API; packaging freezes it. */
|
|
167
|
-
export const installSource =
|
|
168
|
-
|
|
169
|
-
|
|
186
|
+
export const installSource = applied(install, parts);
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* What new documents run before their own scripts: the page clock under its event name, first, so
|
|
190
|
+
* a caller's script that keeps a timer keeps the clock's, and then the caller's scripts, each
|
|
191
|
+
* everywhere or as a block where its `match` allows.
|
|
192
|
+
*/
|
|
193
|
+
export const documentScripts = (
|
|
194
|
+
clockName: string | undefined,
|
|
195
|
+
scripts: ReadonlyArray<InitScript>,
|
|
196
|
+
): ReadonlyArray<string> => [
|
|
197
|
+
...(clockName === undefined ? [] : [`${clockSource}(${encodeString(clockName)})`]),
|
|
198
|
+
...scripts.map(({ match, source }) =>
|
|
199
|
+
match === undefined ? source : `if (${String(match)}.test(location.href)) {\n${source}\n}`,
|
|
200
|
+
),
|
|
201
|
+
];
|
|
170
202
|
|
|
171
203
|
const worldName = "effect-browser";
|
|
172
204
|
|
|
@@ -176,7 +208,7 @@ const recorderSource = `if (globalThis === globalThis.top) globalThis.__effectBr
|
|
|
176
208
|
// What a call reads in a world without the script's API. A context id can name another world once
|
|
177
209
|
// the page has moved to a new process, so a cached id that reads this is not the library's world.
|
|
178
210
|
const missing = "effect-browser: no __effectBrowser in this world";
|
|
179
|
-
const missingSource =
|
|
211
|
+
const missingSource = encodeString(missing);
|
|
180
212
|
|
|
181
213
|
const isMissing = (error: BrowserError) =>
|
|
182
214
|
error.reason._tag === "Failed" && error.reason.detail === missing;
|