effect-browser 0.3.0-beta.20 → 0.3.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +221 -158
- package/dist/Action-24sLOubi.d.mts +110 -0
- package/dist/Action.d.mts +2 -0
- package/dist/Action.mjs +141 -0
- package/dist/Action.mjs.map +1 -0
- package/dist/ActionPort.d.mts +15 -0
- package/dist/ActionPort.mjs +101 -0
- package/dist/ActionPort.mjs.map +1 -0
- package/dist/Browser-Cq2K1FEA.mjs +4075 -0
- package/dist/Browser-Cq2K1FEA.mjs.map +1 -0
- package/dist/Browser-wZhwZSlG.d.mts +167 -0
- package/dist/Browser.d.mts +2 -129
- package/dist/Browser.mjs +1 -1
- package/dist/{BrowserError-Coy7EW1N.d.mts → BrowserError-BlcmLVzn.d.mts} +22 -7
- package/dist/BrowserError.d.mts +2 -2
- package/dist/BrowserError.mjs +46 -9
- package/dist/BrowserError.mjs.map +1 -1
- package/dist/{BrowserEvent-dq6FRT8w.d.mts → BrowserEvent-lLqJ3GJS.d.mts} +93 -37
- package/dist/BrowserEvent.d.mts +2 -2
- package/dist/BrowserEvent.mjs +29 -24
- package/dist/BrowserEvent.mjs.map +1 -1
- package/dist/{Change-DqING3tr.d.mts → Change-Ba7INmay.d.mts} +4 -6
- package/dist/Change.d.mts +2 -2
- package/dist/Change.mjs +97 -2
- package/dist/Change.mjs.map +1 -0
- package/dist/Clock.d.mts +57 -0
- package/dist/Clock.mjs +80 -0
- package/dist/Clock.mjs.map +1 -0
- package/dist/{Frame-DkNdjjjr.d.mts → Frame-UEH2hO5T.d.mts} +10 -3
- package/dist/Frame.d.mts +2 -2
- package/dist/Frame.mjs +10 -2
- package/dist/Frame.mjs.map +1 -1
- package/dist/{Motion-DND6I-64.d.mts → Geometry-DJx9qrYy.d.mts} +7 -10
- package/dist/Geometry.d.mts +2 -0
- package/dist/Geometry.mjs +32 -0
- package/dist/Geometry.mjs.map +1 -0
- package/dist/LICENSE-jpeg-js +28 -0
- package/dist/Matching.d.mts +37 -0
- package/dist/{match.inpage-xOe9LNO0.mjs → Matching.mjs} +28 -4
- package/dist/Matching.mjs.map +1 -0
- package/dist/{Page-CfB6Zn1p.mjs → Page-BF5izr8R.mjs} +216 -31
- package/dist/Page-BF5izr8R.mjs.map +1 -0
- package/dist/{Page-ku6j5t-v.d.mts → Page-CvsOEorc.d.mts} +158 -185
- package/dist/Page.d.mts +2 -2
- package/dist/Page.mjs +1 -1
- package/dist/Released-tURbFmal.d.mts +15 -0
- package/dist/{Snapshot-B34hZ4Jl.d.mts → Snapshot-CtBVOtuu.d.mts} +6 -1
- package/dist/Snapshot.d.mts +1 -1
- package/dist/Snapshot.mjs.map +1 -1
- package/dist/Stillness-CNlvayIo.mjs +136 -0
- package/dist/Stillness-CNlvayIo.mjs.map +1 -0
- package/dist/Style-AO4V7Czt.mjs +357 -0
- package/dist/Style-AO4V7Czt.mjs.map +1 -0
- package/dist/Style.d.mts +72 -0
- package/dist/Style.mjs +2 -0
- package/dist/Url.d.mts +26 -0
- package/dist/Url.mjs +74 -0
- package/dist/Url.mjs.map +1 -0
- package/dist/Window-CMddGMt1.d.mts +34 -0
- package/dist/Window.d.mts +2 -0
- package/dist/Window.mjs +35 -0
- package/dist/Window.mjs.map +1 -0
- package/dist/connection-2KHI4_KN.d.mts +41 -0
- package/dist/connection-BTeO0Hiz.mjs +68 -0
- package/dist/connection-BTeO0Hiz.mjs.map +1 -0
- package/dist/index.d.mts +15 -17
- package/dist/index.mjs +11 -14
- package/dist/moment/Moment.d.mts +86 -0
- package/dist/{Moment.mjs → moment/Moment.mjs} +44 -38
- package/dist/moment/Moment.mjs.map +1 -0
- package/dist/{Plan-DJ4hEEna.d.mts → plan/index.d.mts} +169 -64
- package/dist/{Plan-C-d5QYS8.mjs → plan/index.mjs} +122 -155
- package/dist/plan/index.mjs.map +1 -0
- package/dist/{Policy.d.mts → policy/Policy.d.mts} +5 -9
- package/dist/{Policy.mjs → policy/Policy.mjs} +11 -21
- package/dist/policy/Policy.mjs.map +1 -0
- package/dist/presentation/Motion.d.mts +12 -0
- package/dist/{Motion.mjs → presentation/Motion.mjs} +4 -27
- package/dist/presentation/Motion.mjs.map +1 -0
- package/dist/presentation/Presentation.d.mts +30 -0
- package/dist/presentation/Presentation.mjs +105 -0
- package/dist/presentation/Presentation.mjs.map +1 -0
- package/dist/{Stage.d.mts → presentation/Stage.d.mts} +5 -8
- package/dist/{Stage.mjs → presentation/Stage.mjs} +68 -76
- package/dist/presentation/Stage.mjs.map +1 -0
- package/dist/presentation/feed.d.mts +20 -0
- package/dist/presentation/feed.mjs +18 -0
- package/dist/presentation/feed.mjs.map +1 -0
- package/dist/providers/Cdp.d.mts +9 -0
- package/dist/providers/Cdp.mjs +15 -0
- package/dist/providers/Cdp.mjs.map +1 -0
- package/dist/{Chromium.d.mts → providers/Chromium.d.mts} +6 -7
- package/dist/{Chromium.mjs → providers/Chromium.mjs} +7 -16
- package/dist/providers/Chromium.mjs.map +1 -0
- package/dist/providers/Released.d.mts +2 -0
- package/dist/providers/Released.mjs +12 -0
- package/dist/providers/Released.mjs.map +1 -0
- package/dist/stillness/Stillness.d.mts +12 -0
- package/dist/stillness/Stillness.mjs +2 -0
- package/dist/supervisor/Supervisor.d.mts +104 -0
- package/dist/supervisor/Supervisor.mjs +513 -0
- package/dist/supervisor/Supervisor.mjs.map +1 -0
- package/dist/testing/index.d.mts +337 -0
- package/dist/testing/index.mjs +515 -0
- package/dist/testing/index.mjs.map +1 -0
- package/dist/workerd/Cdp.d.mts +8 -0
- package/dist/workerd/Cdp.mjs +13 -0
- package/dist/workerd/Cdp.mjs.map +1 -0
- package/package.json +94 -33
- package/src/Action.ts +127 -0
- package/src/ActionPort.ts +128 -0
- package/src/Browser.ts +366 -225
- package/src/BrowserError.ts +63 -6
- package/src/BrowserEvent.ts +26 -25
- package/src/Change.ts +0 -2
- package/src/{internal/pictures/clock.ts → Clock.ts} +17 -6
- package/src/Frame.ts +14 -0
- package/src/Geometry.ts +48 -0
- package/src/{internal/reading/match.inpage.ts → Matching.ts} +34 -4
- package/src/Page.ts +111 -92
- package/src/Snapshot.ts +5 -0
- package/src/{internal/input/style.ts → Style.ts} +121 -14
- package/src/Window.ts +30 -0
- package/src/index.ts +8 -13
- package/src/internal/input/actions.ts +61 -119
- package/src/internal/input/dispatch.ts +3 -3
- package/src/internal/input/gate.ts +21 -18
- package/src/internal/input/guard.inpage.ts +25 -58
- package/src/internal/input/guard.ts +11 -20
- package/src/internal/input/keyboard.ts +12 -3
- package/src/internal/input/perform.ts +78 -60
- package/src/internal/input/pointer.ts +4 -2
- package/src/internal/input/settle.ts +7 -5
- package/src/internal/input/targets.inpage.ts +1 -1
- package/src/internal/input/targets.ts +4 -9
- package/src/internal/page/bridge.ts +210 -114
- package/src/internal/page/context.ts +23 -73
- package/src/internal/page/dialogs.ts +58 -0
- package/src/internal/page/identity.ts +6 -23
- package/src/internal/page/lane.ts +14 -15
- package/src/internal/page/navigation.ts +50 -42
- package/src/internal/page/openings.ts +11 -5
- package/src/internal/page/page.ts +44 -81
- package/src/internal/page/port.ts +125 -0
- package/src/internal/{input → page}/replies.ts +1 -1
- package/src/internal/page/request-owner.ts +269 -0
- package/src/internal/page/requests.ts +357 -0
- package/src/internal/page/scripts.ts +124 -0
- package/src/internal/pictures/capture.ts +255 -332
- package/src/internal/pictures/dimensions.ts +162 -0
- package/src/internal/pictures/frame.ts +68 -0
- package/src/internal/pictures/pictures.ts +57 -23
- package/src/internal/pictures/quiescence.ts +1 -1
- package/src/internal/pictures/state.ts +26 -0
- package/src/internal/pictures/transport.ts +21 -4
- package/src/internal/reading/controls.inpage.ts +5 -70
- package/src/internal/reading/expect.inpage.ts +13 -17
- package/src/internal/reading/names.inpage.ts +89 -45
- package/src/internal/reading/outline.inpage.ts +6 -7
- package/src/internal/reading/reading.ts +144 -176
- package/src/internal/reading/ready.inpage.ts +6 -17
- package/src/internal/reading/ready.ts +13 -135
- package/src/internal/reading/subjects.inpage.ts +83 -43
- package/src/internal/reading/walk.inpage.ts +33 -13
- package/src/internal/timeline/changes.ts +55 -6
- package/src/internal/timeline/events.ts +15 -5
- package/src/internal/timeline/history.inpage.ts +1 -1
- package/src/internal/timeline/record.inpage.ts +4 -1
- package/src/internal/timeline/window.ts +2 -1
- package/src/{Moment.ts → moment/Moment.ts} +13 -31
- package/src/{internal/timeline → moment}/words.ts +2 -2
- package/src/{internal/reading → plan}/choose.ts +3 -3
- package/src/plan/data.ts +117 -0
- package/src/plan/execute.ts +411 -0
- package/src/plan/index.ts +36 -0
- package/src/plan/record.ts +71 -0
- package/src/plan/targets.ts +71 -0
- package/src/{Policy.ts → policy/Policy.ts} +13 -10
- package/src/{Motion.ts → presentation/Motion.ts} +12 -46
- package/src/presentation/Presentation.ts +176 -0
- package/src/{Stage.ts → presentation/Stage.ts} +147 -112
- package/src/presentation/feed.ts +21 -0
- package/src/providers/Cdp.ts +16 -0
- package/src/{Chromium.ts → providers/Chromium.ts} +7 -10
- package/src/providers/Released.ts +13 -0
- package/src/providers/connection.ts +134 -0
- package/src/{internal/pictures/motion.ts → stillness/Pixels.ts} +4 -4
- package/src/stillness/Stillness.ts +166 -0
- package/src/supervisor/Supervisor.ts +170 -0
- package/src/supervisor/contract.ts +105 -0
- package/src/supervisor/lifecycle.ts +272 -0
- package/src/supervisor/runtime.ts +234 -0
- package/src/testing/TestBrowser.ts +115 -0
- package/src/testing/TestPage.ts +10 -0
- package/src/testing/evidence.ts +154 -0
- package/src/testing/index.ts +3 -0
- package/src/testing/model.ts +222 -0
- package/src/testing/page.ts +360 -0
- package/src/workerd/Cdp.ts +11 -0
- package/dist/Browser-BwCldIff.mjs +0 -629
- package/dist/Browser-BwCldIff.mjs.map +0 -1
- package/dist/Cdp.d.mts +0 -32
- package/dist/Cdp.mjs +0 -61
- package/dist/Cdp.mjs.map +0 -1
- package/dist/Change-DNvztNLu.mjs +0 -138
- package/dist/Change-DNvztNLu.mjs.map +0 -1
- package/dist/Chromium.mjs.map +0 -1
- package/dist/Expect.d.mts +0 -62
- package/dist/Expect.mjs +0 -114
- package/dist/Expect.mjs.map +0 -1
- package/dist/Moment.d.mts +0 -2
- package/dist/Moment.mjs.map +0 -1
- package/dist/Motion.d.mts +0 -2
- package/dist/Motion.mjs.map +0 -1
- package/dist/Page-CfB6Zn1p.mjs.map +0 -1
- package/dist/Plan-C-d5QYS8.mjs.map +0 -1
- package/dist/Plan.d.mts +0 -2
- package/dist/Plan.mjs +0 -2
- package/dist/Policy.mjs.map +0 -1
- package/dist/Presentation.d.mts +0 -48
- package/dist/Presentation.mjs +0 -118
- package/dist/Presentation.mjs.map +0 -1
- package/dist/Stage.mjs.map +0 -1
- package/dist/Supervisor-2mPjIYYs.mjs +0 -676
- package/dist/Supervisor-2mPjIYYs.mjs.map +0 -1
- package/dist/Supervisor-mVPeEUp8.d.mts +0 -317
- package/dist/Supervisor.d.mts +0 -2
- package/dist/Supervisor.mjs +0 -2
- package/dist/context-w3NJPRLo.mjs +0 -335
- package/dist/context-w3NJPRLo.mjs.map +0 -1
- package/dist/match.inpage-xOe9LNO0.mjs.map +0 -1
- package/dist/page-BKwfF6z-.mjs +0 -5099
- package/dist/page-BKwfF6z-.mjs.map +0 -1
- package/dist/url-Cd04Okid.mjs +0 -264
- package/dist/url-Cd04Okid.mjs.map +0 -1
- package/src/Cdp.ts +0 -101
- package/src/Expect.ts +0 -180
- package/src/Plan.ts +0 -674
- package/src/Presentation.ts +0 -196
- package/src/Supervisor.ts +0 -632
- package/src/internal/supervisor/lifecycle.ts +0 -484
- /package/src/{internal/page/url.ts → Url.ts} +0 -0
- /package/src/{internal/pictures → stillness}/utilsBundle.d.ts +0 -0
|
@@ -1,109 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
declare namespace Moment_d_exports {
|
|
11
|
-
export { Account, CaptureOptions, Moment, Window, account, capture, toPrompt };
|
|
12
|
-
}
|
|
13
|
-
declare const Window_base: Schema.Class<Window, Schema.Struct<{
|
|
14
|
-
readonly page: Schema.String;
|
|
15
|
-
/** Where the window starts, in host monotonic milliseconds on the owning browser’s clock. */
|
|
16
|
-
readonly since: Schema.Finite;
|
|
17
|
-
/** Where it ends, never after it was taken. */
|
|
18
|
-
readonly until: Schema.Finite;
|
|
19
|
-
/** The page's events after `since`, up to `until`, oldest first, without the input presentation track. */
|
|
20
|
-
readonly events: Schema.$Array<Schema.Union<readonly [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]>>;
|
|
21
|
-
/**
|
|
22
|
-
* What visibly changed after `since`, up to `until`; absent where `missing` says why. A page's
|
|
23
|
-
* first window starts its record, so the record sees none of it.
|
|
24
|
-
*/
|
|
25
|
-
readonly changes: Schema.optional<typeof Changes>;
|
|
26
|
-
/** Screencast frames painted from `since` to `until`, oldest first, as far back as kept. */
|
|
27
|
-
readonly frames: Schema.$Array<typeof Frame>;
|
|
28
|
-
/**
|
|
29
|
-
* Why each part that could not be read is missing: the read of its changes, by whatever
|
|
30
|
-
* operation failed there, or a moment's picture (`frame`) or outline (`snapshot`).
|
|
31
|
-
*/
|
|
32
|
-
readonly missing: Schema.$Array<typeof BrowserError>;
|
|
33
|
-
}>, {}>;
|
|
34
|
-
/** A page's events, changes and frames over one window of its browser's host clock. */
|
|
35
|
-
declare class Window extends Window_base {}
|
|
36
|
-
declare const Moment_base: Schema.Class<Moment, Schema.Struct<{
|
|
37
|
-
readonly page: Schema.String;
|
|
38
|
-
readonly since: Schema.Finite;
|
|
39
|
-
readonly until: Schema.Finite;
|
|
40
|
-
readonly events: Schema.$Array<Schema.Union<readonly [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]>>;
|
|
41
|
-
readonly changes: Schema.optional<typeof Changes>;
|
|
42
|
-
readonly frames: Schema.$Array<typeof Frame>;
|
|
43
|
-
readonly missing: Schema.$Array<typeof BrowserError>;
|
|
44
|
-
snapshot: Schema.optional<typeof Snapshot>;
|
|
45
|
-
}>, Window> & Pick<{}, never>;
|
|
46
|
-
/**
|
|
47
|
-
* A window that ends at a picture of the page, its last frame, unless `missing` says why it has
|
|
48
|
-
* none. Its frames are a few, spread over the window, so that it still begins where it starts.
|
|
49
|
-
*/
|
|
50
|
-
declare class Moment extends Moment_base {}
|
|
51
|
-
interface CaptureOptions {
|
|
52
|
-
/**
|
|
53
|
-
* Where the window starts, as for `Page.window`: a previous window or moment, so that consecutive
|
|
54
|
-
* ones neither repeat nor miss an event or a change, or a `Duration` back from the picture.
|
|
55
|
-
* Defaults to 5 seconds.
|
|
56
|
-
*/
|
|
57
|
-
readonly since?: WindowOptions["since"] | undefined;
|
|
58
|
-
/** Frames to keep, at least 1, spread over the window and ending with the picture. Defaults to 2. */
|
|
59
|
-
readonly frames?: number | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* Whether to take the page's outline at the end, or its options; `true` means 4,000 characters.
|
|
62
|
-
* Defaults to `false`: the frames and the timeline carry most moments, while an outline costs a
|
|
63
|
-
* round trip to the page and can double a moment's tokens.
|
|
64
|
-
*/
|
|
65
|
-
readonly snapshot?: SnapshotOptions | boolean | undefined;
|
|
66
|
-
/** Show what fields hold in the moment's changes; a secret field still reads `••••`. */
|
|
67
|
-
readonly unmask?: boolean | undefined;
|
|
68
|
-
}
|
|
69
|
-
declare const capture: (page: Page$1, options?: CaptureOptions | undefined) => Effect.Effect<Moment, BrowserError, never>;
|
|
70
|
-
/** What a window says of its page at its end: what was still in flux, and what had settled. */
|
|
71
|
-
interface Account {
|
|
72
|
-
/**
|
|
73
|
-
* How long, in milliseconds, the page had been still at the end: since the last change in view
|
|
74
|
-
* its record shows, or the last paint its screencast frames show, or else since the window, or
|
|
75
|
-
* its record, began. Undefined where neither could tell, with no record of the window and no
|
|
76
|
-
* painted frame: a screenshot shows the page, not when it last changed. Frames show paint only
|
|
77
|
-
* while a capture runs, and the record does not see a canvas, so a canvas that keeps drawing
|
|
78
|
-
* with no capture running reads as still.
|
|
79
|
-
*/
|
|
80
|
-
readonly stillFor: number | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* The changes still under way at the end: what kept changing, more than once in the window or
|
|
83
|
-
* already before it, and changed again within twice its own pace before the end.
|
|
84
|
-
*/
|
|
85
|
-
readonly changing: ReadonlyArray<Change>;
|
|
86
|
-
/** Every other change, which shows what it settled at. */
|
|
87
|
-
readonly settled: ReadonlyArray<Change>;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* An account of the window's page at its end: how long it had been still, and which of its
|
|
91
|
-
* changes were still under way and which had settled. A window whose record saw none of it has
|
|
92
|
-
* neither.
|
|
93
|
-
*/
|
|
94
|
-
declare const account: (window: Window) => Account;
|
|
95
|
-
/**
|
|
96
|
-
* The moment as one user message: the page's outline when the moment has one, what changed, most
|
|
97
|
-
* notable first, what kept changing told as still changing at the moment or settled since when, by
|
|
98
|
-
* its account, with the actions that the changes followed, that changes followed though none
|
|
99
|
-
* names them, or that drew what only the screenshots show, what could not be read and why, and its
|
|
100
|
-
* frames captioned with their times, the last one "the moment" where it is the picture at its end.
|
|
101
|
-
* Give a model its task with `Prompt.setSystem`, and add what the caller knows about the page as
|
|
102
|
-
* more text.
|
|
103
|
-
*/
|
|
104
|
-
declare const toPrompt: (moment: Moment) => Prompt.Prompt;
|
|
1
|
+
import { a as PressOptions$1, o as ScrollOptions$1, r as ClickOptions$1, s as TypeOptions$1, t as Action } from "./Action-24sLOubi.mjs";
|
|
2
|
+
import { p as PolicyDenied, t as BrowserError } from "./BrowserError-BlcmLVzn.mjs";
|
|
3
|
+
import { b as Subject, f as PageLoaded, n as Box, r as BrowserEvent } from "./BrowserEvent-lLqJ3GJS.mjs";
|
|
4
|
+
import { r as Changes } from "./Change-Ba7INmay.mjs";
|
|
5
|
+
import { a as Image, n as CaptureStats, o as ScreencastOptions, r as Frame } from "./Frame-UEH2hO5T.mjs";
|
|
6
|
+
import { i as Point$1, t as Geometry_d_exports } from "./Geometry-DJx9qrYy.mjs";
|
|
7
|
+
import { n as Snapshot, r as SnapshotOptions } from "./Snapshot-CtBVOtuu.mjs";
|
|
8
|
+
import { t as Window } from "./Window-CMddGMt1.mjs";
|
|
9
|
+
import { Clock, Duration, Effect, Schema, Scope, Stream } from "effect";
|
|
105
10
|
declare namespace Page_d_exports {
|
|
106
|
-
export { ChangesOptions, ClickOptions, ElementState, Fact, FindQuery, Found, FrameOptions, InputGuard, InputRequest, Page
|
|
11
|
+
export { ActOptions, Capture, ChangesOptions, ClickOptions, ElementState, Fact, FindQuery, Found, FrameOptions, InputGuard, InputRequest, Page, Point, PressOptions, ReadyOptions, Region, ResolvedTarget, ScreenshotOptions, ScriptOptions, ScrollOptions, State, Target, Text, TextOptions, TypeOptions, UntilResult, UntilWant, WindowOptions, Zoom, correlate, failFast, redacted };
|
|
107
12
|
}
|
|
108
13
|
type Point = Point$1;
|
|
109
14
|
/** A ref from a snapshot, such as `"e12"`, or a viewport point. */
|
|
@@ -150,43 +55,11 @@ declare const ResolvedTarget_base: Schema.Class<ResolvedTarget, Schema.Struct<{
|
|
|
150
55
|
}>, {}>;
|
|
151
56
|
/** The target as it read before input. Point coordinates are never snapped to another position. */
|
|
152
57
|
declare class ResolvedTarget extends ResolvedTarget_base {}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
readonly holdMillis?: number | undefined;
|
|
159
|
-
}
|
|
160
|
-
interface TypeOptions {
|
|
161
|
-
/** Type into this text field: it is focused first, and its content replaced unless `replace` is false. */
|
|
162
|
-
readonly into?: string | undefined;
|
|
163
|
-
readonly replace?: boolean | undefined;
|
|
164
|
-
/** Press Enter afterwards. */
|
|
165
|
-
readonly submit?: boolean | undefined;
|
|
166
|
-
/**
|
|
167
|
-
* The text is a secret: type it only into a field the page marks secret, such as a password,
|
|
168
|
-
* and otherwise refuse with `NotActionable` before any input. A replayed password asks this.
|
|
169
|
-
*/
|
|
170
|
-
readonly secret?: boolean | undefined;
|
|
171
|
-
}
|
|
172
|
-
interface PressOptions {
|
|
173
|
-
/**
|
|
174
|
-
* Focus this element, by ref, before the first press: a link, a button or a field. The keys go to
|
|
175
|
-
* whatever has focus otherwise.
|
|
176
|
-
*/
|
|
177
|
-
readonly on?: string | undefined;
|
|
178
|
-
/** Press the keys this many times. */
|
|
179
|
-
readonly times?: number | undefined;
|
|
180
|
-
/** Hold the keys down this long before releasing them, as a game control might need. */
|
|
181
|
-
readonly holdMillis?: number | undefined;
|
|
182
|
-
}
|
|
183
|
-
interface ScrollOptions {
|
|
184
|
-
readonly dx?: number | undefined;
|
|
185
|
-
/** Pixels to scroll down; negative scrolls up. Defaults to most of a viewport. */
|
|
186
|
-
readonly dy?: number | undefined;
|
|
187
|
-
/** Scroll whatever is under this point or element. Defaults to the middle of the viewport. */
|
|
188
|
-
readonly at?: Target | undefined;
|
|
189
|
-
}
|
|
58
|
+
/** Action options share the execution codec. */
|
|
59
|
+
type ClickOptions = typeof ClickOptions$1.Type;
|
|
60
|
+
type TypeOptions = typeof TypeOptions$1.Type;
|
|
61
|
+
type PressOptions = typeof PressOptions$1.Type;
|
|
62
|
+
type ScrollOptions = typeof ScrollOptions$1.Type;
|
|
190
63
|
/**
|
|
191
64
|
* How current a picture must be. The newest screencast frame serves when it qualifies, at no cost;
|
|
192
65
|
* otherwise a new screenshot is taken.
|
|
@@ -214,12 +87,21 @@ interface ScreenshotOptions {
|
|
|
214
87
|
readonly quality?: number | undefined;
|
|
215
88
|
/** `"jpeg"`, the default, or `"png"`, which is always a new picture. */
|
|
216
89
|
readonly format?: "jpeg" | "png" | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* `"css"`, the default, a picture pixel per CSS pixel; `"device"`, the screen's own pixels, as
|
|
92
|
+
* many to a CSS pixel as its device scale factor, which is always a new picture.
|
|
93
|
+
*/
|
|
94
|
+
readonly scale?: "css" | "device" | undefined;
|
|
217
95
|
}
|
|
218
96
|
/**
|
|
219
97
|
* What `find` looks for. Every rule given must hold; with none, it finds every element in scope
|
|
220
98
|
* that has a role or is a control.
|
|
221
99
|
*/
|
|
222
100
|
interface FindQuery {
|
|
101
|
+
/** Narrow matching to this CSS selector. Invalid CSS fails InvalidRequest. */
|
|
102
|
+
readonly selector?: string | undefined;
|
|
103
|
+
/** Require a visible match, optionally enabled. */
|
|
104
|
+
readonly state?: "visible" | "enabled" | undefined;
|
|
223
105
|
/** An ARIA role, such as `"button"` or `"heading"`, ignoring case. */
|
|
224
106
|
readonly role?: string | undefined;
|
|
225
107
|
/**
|
|
@@ -296,25 +178,8 @@ declare const Text_base: Schema.Class<Text, Schema.Struct<{
|
|
|
296
178
|
}>, {}>;
|
|
297
179
|
/** What a page showed as text: a line per block, with table cells apart by tabs. */
|
|
298
180
|
declare class Text extends Text_base {}
|
|
299
|
-
/** What `waitFor` waits for. */
|
|
300
|
-
interface WaitCondition {
|
|
301
|
-
/** A CSS selector for what to watch; the document's body without one. */
|
|
302
|
-
readonly selector?: string | undefined;
|
|
303
|
-
/**
|
|
304
|
-
* `"visible"` (the default): something it matches shows; `"hidden"`: nothing it matches shows;
|
|
305
|
-
* `"enabled"`: something it matches shows and is not disabled.
|
|
306
|
-
*/
|
|
307
|
-
readonly state?: "visible" | "hidden" | "enabled" | undefined;
|
|
308
|
-
/** Only what shows this text counts, case and all, with runs of spaces read as one. */
|
|
309
|
-
readonly text?: string | undefined;
|
|
310
|
-
}
|
|
311
181
|
interface ReadyOptions {
|
|
312
|
-
/**
|
|
313
|
-
* What must stay still during quietMillis: screen paint (default); recorded content; or the
|
|
314
|
-
* `"foreground"`, the screen but for what was already moving before the page's latest input.
|
|
315
|
-
*/
|
|
316
|
-
readonly still?: "screen" | "content" | "foreground" | undefined;
|
|
317
|
-
/** How long the selected evidence must stay still; screen paint by default. */
|
|
182
|
+
/** How long recorded content must stay unchanged. Screen stillness is a separate feature. */
|
|
318
183
|
readonly quietMillis?: number | undefined;
|
|
319
184
|
readonly timeout?: Duration.Input | undefined;
|
|
320
185
|
}
|
|
@@ -353,6 +218,8 @@ interface WindowOptions {
|
|
|
353
218
|
}
|
|
354
219
|
declare const State_base: Schema.Class<State, Schema.Struct<{
|
|
355
220
|
readonly page: Schema.String;
|
|
221
|
+
/** The tracking connection that owns this document counter. */
|
|
222
|
+
readonly connection: Schema.String;
|
|
356
223
|
/** When this was taken. */
|
|
357
224
|
readonly at: Schema.Finite;
|
|
358
225
|
/** Where the main frame last committed or moved, without userinfo or known secret parameters. */
|
|
@@ -402,7 +269,74 @@ declare const InputRequest_base: Schema.Class<InputRequest, Schema.Struct<{
|
|
|
402
269
|
readonly url: Schema.String;
|
|
403
270
|
/** The page's title, at most 120 characters. */
|
|
404
271
|
readonly title: Schema.String;
|
|
405
|
-
readonly action: Schema.
|
|
272
|
+
readonly action: Schema.TaggedUnion<{
|
|
273
|
+
readonly Act: Schema.TaggedStruct<"Act", {
|
|
274
|
+
readonly document: Schema.Int;
|
|
275
|
+
}>;
|
|
276
|
+
readonly Back: Schema.TaggedStruct<"Back", {}>;
|
|
277
|
+
readonly Click: Schema.TaggedStruct<"Click", {
|
|
278
|
+
readonly target: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
279
|
+
readonly x: Schema.Finite;
|
|
280
|
+
readonly y: Schema.Finite;
|
|
281
|
+
}>]>;
|
|
282
|
+
readonly options: Schema.optional<Schema.Struct<{
|
|
283
|
+
readonly button: Schema.optional<Schema.Literals<readonly ["left", "right", "middle"]>>;
|
|
284
|
+
readonly clickCount: Schema.optional<Schema.Finite>;
|
|
285
|
+
readonly holdMillis: Schema.optional<Schema.Finite>;
|
|
286
|
+
}>>;
|
|
287
|
+
}>;
|
|
288
|
+
readonly Drag: Schema.TaggedStruct<"Drag", {
|
|
289
|
+
readonly from: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
290
|
+
readonly x: Schema.Finite;
|
|
291
|
+
readonly y: Schema.Finite;
|
|
292
|
+
}>]>;
|
|
293
|
+
readonly to: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
294
|
+
readonly x: Schema.Finite;
|
|
295
|
+
readonly y: Schema.Finite;
|
|
296
|
+
}>]>;
|
|
297
|
+
}>;
|
|
298
|
+
readonly Goto: Schema.TaggedStruct<"Goto", {
|
|
299
|
+
readonly url: Schema.String;
|
|
300
|
+
}>;
|
|
301
|
+
readonly Hover: Schema.TaggedStruct<"Hover", {
|
|
302
|
+
readonly target: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
303
|
+
readonly x: Schema.Finite;
|
|
304
|
+
readonly y: Schema.Finite;
|
|
305
|
+
}>]>;
|
|
306
|
+
}>;
|
|
307
|
+
readonly Press: Schema.TaggedStruct<"Press", {
|
|
308
|
+
readonly keys: Schema.String;
|
|
309
|
+
readonly options: Schema.optional<Schema.Struct<{
|
|
310
|
+
readonly on: Schema.optional<Schema.String>;
|
|
311
|
+
readonly times: Schema.optional<Schema.Finite>;
|
|
312
|
+
readonly holdMillis: Schema.optional<Schema.Finite>;
|
|
313
|
+
}>>;
|
|
314
|
+
}>;
|
|
315
|
+
readonly Reload: Schema.TaggedStruct<"Reload", {}>;
|
|
316
|
+
readonly Scroll: Schema.TaggedStruct<"Scroll", {
|
|
317
|
+
readonly options: Schema.optional<Schema.Struct<{
|
|
318
|
+
readonly at: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
319
|
+
readonly x: Schema.Finite;
|
|
320
|
+
readonly y: Schema.Finite;
|
|
321
|
+
}>]>>;
|
|
322
|
+
readonly dx: Schema.optional<Schema.Finite>;
|
|
323
|
+
readonly dy: Schema.optional<Schema.Finite>;
|
|
324
|
+
}>>;
|
|
325
|
+
}>;
|
|
326
|
+
readonly Select: Schema.TaggedStruct<"Select", {
|
|
327
|
+
readonly ref: Schema.String;
|
|
328
|
+
readonly values: Schema.$Array<Schema.String>;
|
|
329
|
+
}>;
|
|
330
|
+
readonly Type: Schema.TaggedStruct<"Type", {
|
|
331
|
+
readonly text: Schema.String;
|
|
332
|
+
readonly options: Schema.optional<Schema.Struct<{
|
|
333
|
+
readonly into: Schema.optional<Schema.String>;
|
|
334
|
+
readonly replace: Schema.optional<Schema.Boolean>;
|
|
335
|
+
readonly submit: Schema.optional<Schema.Boolean>;
|
|
336
|
+
readonly secret: Schema.optional<Schema.Boolean>;
|
|
337
|
+
}>>;
|
|
338
|
+
}>;
|
|
339
|
+
}>;
|
|
406
340
|
readonly target: Schema.optional<Schema.String>;
|
|
407
341
|
readonly element: Schema.optional<Schema.String>;
|
|
408
342
|
/** Literal pixel targets only; ref coordinates are resolved after the policy allows them. */
|
|
@@ -468,11 +402,60 @@ declare const failFast: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effe
|
|
|
468
402
|
declare const correlate: (id: string) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
469
403
|
/** Succeed to allow, fail to deny, or await an external signal to hold the input. */
|
|
470
404
|
type InputGuard = (request: InputRequest) => Effect.Effect<void, PolicyDenied>;
|
|
471
|
-
|
|
405
|
+
/** What a wait requires of the query's matches. */
|
|
406
|
+
type UntilWant = "some" | "none" | {
|
|
407
|
+
readonly other: string;
|
|
408
|
+
};
|
|
409
|
+
interface UntilResult {
|
|
410
|
+
readonly met: boolean;
|
|
411
|
+
readonly mark: string;
|
|
412
|
+
}
|
|
413
|
+
/** Scoped access to one page's shared capture and its current-document evidence. */
|
|
414
|
+
interface Capture {
|
|
415
|
+
readonly stream: Stream.Stream<Frame, BrowserError>;
|
|
416
|
+
readonly current: Frame | undefined;
|
|
417
|
+
readonly isCurrent: (frame: Frame) => boolean;
|
|
418
|
+
readonly confirm: (frame: Frame) => Effect.Effect<boolean, BrowserError>;
|
|
419
|
+
readonly sync: Effect.Effect<void, BrowserError>;
|
|
420
|
+
readonly stats: (options?: {
|
|
421
|
+
readonly window?: Duration.Input | undefined;
|
|
422
|
+
}) => Effect.Effect<CaptureStats, BrowserError>;
|
|
423
|
+
}
|
|
424
|
+
/** Script values cross the page boundary through the caller's Schema. A bundler may rewrite functions. */
|
|
425
|
+
interface ScriptOptions<A, Arg> {
|
|
426
|
+
readonly arg: Arg;
|
|
427
|
+
readonly result: Schema.Codec<A, unknown>;
|
|
428
|
+
}
|
|
429
|
+
interface ActOptions<A, Arg> extends ScriptOptions<A, Arg> {
|
|
430
|
+
readonly document: number;
|
|
431
|
+
/** Supplying the read's connection also refuses a document counter from another connection. */
|
|
432
|
+
readonly connection?: string | undefined;
|
|
433
|
+
}
|
|
434
|
+
interface Page {
|
|
435
|
+
/** Decode and perform a data action through the same policy and lane as the named methods. */
|
|
436
|
+
readonly perform: (action: Action) => Effect.Effect<ResolvedTarget | string | void, BrowserError>;
|
|
437
|
+
/** Read declared side-effect-free code in the main world, retrying one replaced document. */
|
|
438
|
+
readonly read: <A, Arg>(script: (arg: Arg) => unknown, options: ScriptOptions<A, Arg>) => Effect.Effect<{
|
|
439
|
+
readonly value: A;
|
|
440
|
+
readonly document: number;
|
|
441
|
+
readonly connection: string;
|
|
442
|
+
}, BrowserError>;
|
|
443
|
+
/**
|
|
444
|
+
* Run code as a guarded, recorded action bound to the caller's document.
|
|
445
|
+
* A timeout or cancellation cannot stop JavaScript already running: later input waits for its
|
|
446
|
+
* actual reply. Close the page and open a replacement if the script never settles.
|
|
447
|
+
*/
|
|
448
|
+
readonly act: <A, Arg>(script: (arg: Arg) => unknown, options: ActOptions<A, Arg>) => Effect.Effect<A, BrowserError>;
|
|
449
|
+
/** Owning browser clock: deadlines and all frame/event timestamps use this clock. */
|
|
450
|
+
readonly clock: Clock.Clock;
|
|
451
|
+
/** Wait for admitted input and retain a bounded read turn through effect. */
|
|
452
|
+
readonly afterInput: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | BrowserError, R>;
|
|
453
|
+
/** A scoped lease starts capture immediately, independently of its first frame. */
|
|
454
|
+
readonly capture: (options?: ScreencastOptions) => Effect.Effect<Capture, BrowserError, Scope.Scope>;
|
|
455
|
+
/** One page-side wait; replaced documents share one deadline. Unmet is met:false; an empty mark means no stable document could be sampled. */
|
|
456
|
+
readonly until: (query: FindQuery, want: UntilWant, millis: number) => Effect.Effect<UntilResult, BrowserError>;
|
|
472
457
|
/** The page's CDP target id: the same page has it again after a reconnect to its browser. */
|
|
473
458
|
readonly id: string;
|
|
474
|
-
/** The Playwright page, for anything this API does not cover. Never give it to a model. */
|
|
475
|
-
readonly playwright: Page;
|
|
476
459
|
/** The page's address, without its userinfo or known secret parameters. */
|
|
477
460
|
readonly url: Effect.Effect<string>;
|
|
478
461
|
/**
|
|
@@ -499,8 +482,11 @@ interface Page$1 {
|
|
|
499
482
|
* screenshot timed by the host interval in which it was taken.
|
|
500
483
|
*/
|
|
501
484
|
readonly frame: (options?: FrameOptions) => Effect.Effect<Frame, BrowserError>;
|
|
502
|
-
/**
|
|
503
|
-
|
|
485
|
+
/**
|
|
486
|
+
* A crop in CSS pixels, unmagnified, with the origin that keeps later input in viewport pixels.
|
|
487
|
+
* With `scale: "device"` its picture has the screen's own pixels, as a screenshot's would.
|
|
488
|
+
*/
|
|
489
|
+
readonly zoom: (region: Region, options?: Pick<ScreenshotOptions, "scale">) => Effect.Effect<Zoom, BrowserError>;
|
|
504
490
|
/**
|
|
505
491
|
* The viewport's size in CSS pixels, the space of points, crops and page scrolls. Over CDP the
|
|
506
492
|
* page reports it, within the action timeout.
|
|
@@ -552,23 +538,10 @@ interface Page$1 {
|
|
|
552
538
|
*/
|
|
553
539
|
readonly select: (ref: string, values: ReadonlyArray<string>) => Effect.Effect<string, BrowserError>;
|
|
554
540
|
/**
|
|
555
|
-
* Wait
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
|
|
559
|
-
readonly waitFor: (condition: WaitCondition, timeout?: Duration.Input) => Effect.Effect<void, BrowserError>;
|
|
560
|
-
/**
|
|
561
|
-
* Wait until the page is ready to be shown, asking the page every 100 ms: its document is parsed
|
|
562
|
-
* and has painted since, nothing that ends is animating in view, its fonts and the images in
|
|
563
|
-
* view have loaded, and the viewport shows something. With `quietMillis`, the screen must then
|
|
564
|
-
* also stay still that long: nothing in view changed, where the page's changes are recorded, and
|
|
565
|
-
* no frame comes, counted from the first frame of a capture the wait starts itself. A canvas
|
|
566
|
-
* that keeps drawing, such as a live chart, is never still. With `still: "foreground"`, frames
|
|
567
|
-
* may keep coming, but nothing may move in them outside what moved in the frames of the 1.5 s
|
|
568
|
-
* before the page's latest input, such as an idle animation; reels set spinning, or a counter
|
|
569
|
-
* set rolling, by the input keep the wait going. Without those frames, as where they are older
|
|
570
|
-
* than the browser's `frameHistory`, nothing may move at all. A page is never ready without a
|
|
571
|
-
* painted frame, as a hidden tab may be. `Timeout` after `timeout`, 15 seconds by default.
|
|
541
|
+
* Wait for document evidence, polling every 50 ms: parsed, painted, visible, fonts and visible
|
|
542
|
+
* images loaded, and finite animations finished. Optional quietMillis requires recorded content
|
|
543
|
+
* to stay unchanged. Screen or foreground stillness belongs to the Stillness feature.
|
|
544
|
+
* Fails Timeout after timeout, 15 seconds by default.
|
|
572
545
|
*/
|
|
573
546
|
readonly ready: (options?: ReadyOptions) => Effect.Effect<void, BrowserError>;
|
|
574
547
|
/**
|
|
@@ -589,5 +562,5 @@ interface Page$1 {
|
|
|
589
562
|
readonly recentEvents: Effect.Effect<ReadonlyArray<BrowserEvent>>;
|
|
590
563
|
}
|
|
591
564
|
//#endregion
|
|
592
|
-
export {
|
|
593
|
-
//# sourceMappingURL=Page-
|
|
565
|
+
export { Zoom as A, Target as C, UntilResult as D, TypeOptions as E, failFast as M, redacted as N, UntilWant as O, State as S, TextOptions as T, Region as _, ElementState as a, ScriptOptions as b, Found as c, InputRequest as d, Page as f, ReadyOptions as g, PressOptions as h, ClickOptions as i, correlate as j, WindowOptions as k, FrameOptions as l, Point as m, Capture as n, Fact as o, Page_d_exports as p, ChangesOptions as r, FindQuery as s, ActOptions as t, InputGuard as u, ResolvedTarget as v, Text as w, ScrollOptions as x, ScreenshotOptions as y };
|
|
566
|
+
//# sourceMappingURL=Page-CvsOEorc.d.mts.map
|
package/dist/Page.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { ChangesOptions, ClickOptions, ElementState, Fact, FindQuery, Found, FrameOptions, InputGuard, InputRequest, Page, Point, PressOptions, ReadyOptions, Region, ResolvedTarget, ScreenshotOptions, ScrollOptions, State, Target, Text, TextOptions, TypeOptions,
|
|
1
|
+
import { A as Zoom, C as Target, D as UntilResult, E as TypeOptions, M as failFast, N as redacted, O as UntilWant, S as State, T as TextOptions, _ as Region, a as ElementState, b as ScriptOptions, c as Found, d as InputRequest, f as Page, g as ReadyOptions, h as PressOptions, i as ClickOptions, j as correlate, k as WindowOptions, l as FrameOptions, m as Point, n as Capture, o as Fact, r as ChangesOptions, s as FindQuery, t as ActOptions, u as InputGuard, v as ResolvedTarget, w as Text, x as ScrollOptions, y as ScreenshotOptions } from "./Page-CvsOEorc.mjs";
|
|
2
|
+
export { ActOptions, Capture, ChangesOptions, ClickOptions, ElementState, Fact, FindQuery, Found, FrameOptions, InputGuard, InputRequest, Page, Point, PressOptions, ReadyOptions, Region, ResolvedTarget, ScreenshotOptions, ScriptOptions, ScrollOptions, State, Target, Text, TextOptions, TypeOptions, UntilResult, UntilWant, WindowOptions, Zoom, correlate, failFast, redacted };
|
package/dist/Page.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as State, d as correlate, f as failFast, i as InputRequest, l as Text, n as Fact, o as Region, p as redacted, r as Found, s as ResolvedTarget, t as ElementState, u as Zoom } from "./Page-
|
|
1
|
+
import { c as State, d as correlate, f as failFast, i as InputRequest, l as Text, n as Fact, o as Region, p as redacted, r as Found, s as ResolvedTarget, t as ElementState, u as Zoom } from "./Page-BF5izr8R.mjs";
|
|
2
2
|
export { ElementState, Fact, Found, InputRequest, Region, ResolvedTarget, State, Text, Zoom, correlate, failFast, redacted };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
//#region src/providers/Released.d.ts
|
|
3
|
+
declare const Settled_base: Schema.Class<Settled, Schema.TaggedStruct<"Settled", {}>, {}>;
|
|
4
|
+
/** The provider confirmed the resource ended. */
|
|
5
|
+
declare class Settled extends Settled_base {}
|
|
6
|
+
declare const Unconfirmed_base: Schema.Class<Unconfirmed, Schema.TaggedStruct<"Unconfirmed", {
|
|
7
|
+
readonly detail: Schema.String;
|
|
8
|
+
}>, {}>;
|
|
9
|
+
/** The resource may still run, and bill, because its end could not be confirmed. */
|
|
10
|
+
declare class Unconfirmed extends Unconfirmed_base {}
|
|
11
|
+
declare const Released: Schema.Union<readonly [typeof Settled, typeof Unconfirmed]>;
|
|
12
|
+
type Released = typeof Released.Type;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Settled as n, Unconfirmed as r, Released as t };
|
|
15
|
+
//# sourceMappingURL=Released-tURbFmal.d.mts.map
|
|
@@ -62,7 +62,12 @@ interface SnapshotOptions {
|
|
|
62
62
|
readonly within?: string | undefined;
|
|
63
63
|
/** Bound on the outline's length. Defaults to 12,000 characters. */
|
|
64
64
|
readonly maxChars?: number | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Give every control's box, as `WxH at (x,y)` in viewport CSS pixels, as a canvas's or a frame's
|
|
67
|
+
* always has. Defaults to false.
|
|
68
|
+
*/
|
|
69
|
+
readonly boxes?: boolean | undefined;
|
|
65
70
|
}
|
|
66
71
|
//#endregion
|
|
67
72
|
export { Snapshot_d_exports as i, Snapshot as n, SnapshotOptions as r, Control as t };
|
|
68
|
-
//# sourceMappingURL=Snapshot-
|
|
73
|
+
//# sourceMappingURL=Snapshot-CtBVOtuu.d.mts.map
|
package/dist/Snapshot.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Snapshot, r as SnapshotOptions, t as Control } from "./Snapshot-
|
|
1
|
+
import { n as Snapshot, r as SnapshotOptions, t as Control } from "./Snapshot-CtBVOtuu.mjs";
|
|
2
2
|
export { Control, Snapshot, SnapshotOptions };
|
package/dist/Snapshot.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snapshot.mjs","names":[],"sources":["../src/Snapshot.ts"],"sourcesContent":["/**\n * A compact, model-readable outline of what a page shows.\n *\n * Each control gets a ref such as `e12`. A ref stays valid while its element is on the page, and\n * refs are never reused within a page, so a ref from an old snapshot fails as stale rather than\n * naming a different element.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\n/** A control the outline shows, as a value: its ref, what it is and what it holds. */\nexport class Control extends Schema.Class<Control>(\"effect-browser/Control\")({\n ref: Schema.String,\n /** Its role, such as `button` or `textbox`, or `clickable` for an element without one. */\n kind: Schema.String,\n /** Its accessible name. */\n name: Schema.String,\n /** What it holds: a field's text, `••••` for a secret one, or a select's chosen labels. */\n value: Schema.String,\n /** A select's option labels, at most 64. */\n options: Schema.optional(Schema.Array(Schema.String)),\n /** How many options a select has, when it has options. */\n optionCount: Schema.optional(Schema.Int),\n disabled: Schema.optional(Schema.Boolean),\n /** Whether it is checked, for what can be checked. */\n checked: Schema.optional(Schema.Boolean),\n /** True for a field that takes typed text. */\n editable: Schema.optional(Schema.Boolean),\n}) {}\n\nexport class Snapshot extends Schema.Class<Snapshot>(\"effect-browser/Snapshot\")({\n url: Schema.String,\n title: Schema.String,\n /** One line per control, heading or text block, indented by landmark. */\n text: Schema.String,\n /** True when `text` was cut at `maxChars`. */\n truncated: Schema.Boolean,\n /**\n * Parts of the page left out because they lie above or below the viewport, each an element out\n * of view with all it holds (viewport snapshots only).\n */\n above: Schema.Finite,\n below: Schema.Finite,\n viewport: Schema.Struct({ width: Schema.Finite, height: Schema.Finite }),\n scroll: Schema.Struct({ y: Schema.Finite, height: Schema.Finite }),\n /** The controls the outline shows, in its order. */\n controls: Schema.Array(Control),\n}) {\n /** The snapshot as one block of text for a model: header, outline and what was left out. */\n get rendered(): string {\n const position =\n this.scroll.height > this.viewport.height\n ? `, scrolled to ${this.scroll.y} of ${this.scroll.height - this.viewport.height}px`\n : \"\";\n\n const omitted: Array<string> = [];\n\n if (this.above > 0) omitted.push(`${this.above} parts above`);\n if (this.below > 0) omitted.push(`${this.below} parts below`);\n\n const footer = [\n ...(omitted.length > 0 ? [`(${omitted.join(\", \")} the viewport)`] : []),\n ...(this.truncated ? [\"(cut short: narrow it with query)\"] : []),\n ];\n\n return [\n `Page: ${this.title === \"\" ? \"(untitled)\" : this.title}`,\n `URL: ${this.url}`,\n `Viewport: ${this.viewport.width}x${this.viewport.height}${position}`,\n this.text === \"\" ? \"(nothing readable in view)\" : this.text,\n ...footer,\n ].join(\"\\n\");\n }\n}\n\nexport interface SnapshotOptions {\n /** Read the whole page instead of the viewport. Defaults to false. */\n readonly full?: boolean | undefined;\n /** Keep only lines containing this text (case-insensitive). */\n readonly query?: string | undefined;\n /**\n * Read only inside the elements this CSS selector matches, such as `form` or `#results`. A\n * selector that matches nothing reads nothing; one that is not CSS is an `InvalidRequest`.\n */\n readonly within?: string | undefined;\n /** Bound on the outline's length. Defaults to 12,000 characters. */\n readonly maxChars?: number | undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,IAAa,UAAb,cAA6B,OAAO,MAAe,wBAAwB,CAAC,CAAC;CAC3E,KAAK,OAAO;;CAEZ,MAAM,OAAO;;CAEb,MAAM,OAAO;;CAEb,OAAO,OAAO;;CAEd,SAAS,OAAO,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC;;CAEpD,aAAa,OAAO,SAAS,OAAO,GAAG;CACvC,UAAU,OAAO,SAAS,OAAO,OAAO;;CAExC,SAAS,OAAO,SAAS,OAAO,OAAO;;CAEvC,UAAU,OAAO,SAAS,OAAO,OAAO;AAC1C,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,WAAb,cAA8B,OAAO,MAAgB,yBAAyB,CAAC,CAAC;CAC9E,KAAK,OAAO;CACZ,OAAO,OAAO;;CAEd,MAAM,OAAO;;CAEb,WAAW,OAAO;;;;;CAKlB,OAAO,OAAO;CACd,OAAO,OAAO;CACd,UAAU,OAAO,OAAO;EAAE,OAAO,OAAO;EAAQ,QAAQ,OAAO;CAAO,CAAC;CACvE,QAAQ,OAAO,OAAO;EAAE,GAAG,OAAO;EAAQ,QAAQ,OAAO;CAAO,CAAC;;CAEjE,UAAU,OAAO,MAAM,OAAO;AAChC,CAAC,CAAC,CAAC;;CAED,IAAI,WAAmB;EACrB,MAAM,WACJ,KAAK,OAAO,SAAS,KAAK,SAAS,SAC/B,iBAAiB,KAAK,OAAO,EAAE,MAAM,KAAK,OAAO,SAAS,KAAK,SAAS,OAAO,MAC/E;EAEN,MAAM,UAAyB,CAAC;EAEhC,IAAI,KAAK,QAAQ,GAAG,QAAQ,KAAK,GAAG,KAAK,MAAM,aAAa;EAC5D,IAAI,KAAK,QAAQ,GAAG,QAAQ,KAAK,GAAG,KAAK,MAAM,aAAa;EAE5D,MAAM,SAAS,CACb,GAAI,QAAQ,SAAS,IAAI,CAAC,IAAI,QAAQ,KAAK,IAAI,EAAE,eAAe,IAAI,CAAC,GACrE,GAAI,KAAK,YAAY,CAAC,mCAAmC,IAAI,CAAC,CAChE;EAEA,OAAO;GACL,SAAS,KAAK,UAAU,KAAK,eAAe,KAAK;GACjD,QAAQ,KAAK;GACb,aAAa,KAAK,SAAS,MAAM,GAAG,KAAK,SAAS,SAAS;GAC3D,KAAK,SAAS,KAAK,+BAA+B,KAAK;GACvD,GAAG;EACL,CAAC,CAAC,KAAK,IAAI;CACb;AACF"}
|
|
1
|
+
{"version":3,"file":"Snapshot.mjs","names":[],"sources":["../src/Snapshot.ts"],"sourcesContent":["/**\n * A compact, model-readable outline of what a page shows.\n *\n * Each control gets a ref such as `e12`. A ref stays valid while its element is on the page, and\n * refs are never reused within a page, so a ref from an old snapshot fails as stale rather than\n * naming a different element.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\n/** A control the outline shows, as a value: its ref, what it is and what it holds. */\nexport class Control extends Schema.Class<Control>(\"effect-browser/Control\")({\n ref: Schema.String,\n /** Its role, such as `button` or `textbox`, or `clickable` for an element without one. */\n kind: Schema.String,\n /** Its accessible name. */\n name: Schema.String,\n /** What it holds: a field's text, `••••` for a secret one, or a select's chosen labels. */\n value: Schema.String,\n /** A select's option labels, at most 64. */\n options: Schema.optional(Schema.Array(Schema.String)),\n /** How many options a select has, when it has options. */\n optionCount: Schema.optional(Schema.Int),\n disabled: Schema.optional(Schema.Boolean),\n /** Whether it is checked, for what can be checked. */\n checked: Schema.optional(Schema.Boolean),\n /** True for a field that takes typed text. */\n editable: Schema.optional(Schema.Boolean),\n}) {}\n\nexport class Snapshot extends Schema.Class<Snapshot>(\"effect-browser/Snapshot\")({\n url: Schema.String,\n title: Schema.String,\n /** One line per control, heading or text block, indented by landmark. */\n text: Schema.String,\n /** True when `text` was cut at `maxChars`. */\n truncated: Schema.Boolean,\n /**\n * Parts of the page left out because they lie above or below the viewport, each an element out\n * of view with all it holds (viewport snapshots only).\n */\n above: Schema.Finite,\n below: Schema.Finite,\n viewport: Schema.Struct({ width: Schema.Finite, height: Schema.Finite }),\n scroll: Schema.Struct({ y: Schema.Finite, height: Schema.Finite }),\n /** The controls the outline shows, in its order. */\n controls: Schema.Array(Control),\n}) {\n /** The snapshot as one block of text for a model: header, outline and what was left out. */\n get rendered(): string {\n const position =\n this.scroll.height > this.viewport.height\n ? `, scrolled to ${this.scroll.y} of ${this.scroll.height - this.viewport.height}px`\n : \"\";\n\n const omitted: Array<string> = [];\n\n if (this.above > 0) omitted.push(`${this.above} parts above`);\n if (this.below > 0) omitted.push(`${this.below} parts below`);\n\n const footer = [\n ...(omitted.length > 0 ? [`(${omitted.join(\", \")} the viewport)`] : []),\n ...(this.truncated ? [\"(cut short: narrow it with query)\"] : []),\n ];\n\n return [\n `Page: ${this.title === \"\" ? \"(untitled)\" : this.title}`,\n `URL: ${this.url}`,\n `Viewport: ${this.viewport.width}x${this.viewport.height}${position}`,\n this.text === \"\" ? \"(nothing readable in view)\" : this.text,\n ...footer,\n ].join(\"\\n\");\n }\n}\n\nexport interface SnapshotOptions {\n /** Read the whole page instead of the viewport. Defaults to false. */\n readonly full?: boolean | undefined;\n /** Keep only lines containing this text (case-insensitive). */\n readonly query?: string | undefined;\n /**\n * Read only inside the elements this CSS selector matches, such as `form` or `#results`. A\n * selector that matches nothing reads nothing; one that is not CSS is an `InvalidRequest`.\n */\n readonly within?: string | undefined;\n /** Bound on the outline's length. Defaults to 12,000 characters. */\n readonly maxChars?: number | undefined;\n /**\n * Give every control's box, as `WxH at (x,y)` in viewport CSS pixels, as a canvas's or a frame's\n * always has. Defaults to false.\n */\n readonly boxes?: boolean | undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,IAAa,UAAb,cAA6B,OAAO,MAAe,wBAAwB,CAAC,CAAC;CAC3E,KAAK,OAAO;;CAEZ,MAAM,OAAO;;CAEb,MAAM,OAAO;;CAEb,OAAO,OAAO;;CAEd,SAAS,OAAO,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC;;CAEpD,aAAa,OAAO,SAAS,OAAO,GAAG;CACvC,UAAU,OAAO,SAAS,OAAO,OAAO;;CAExC,SAAS,OAAO,SAAS,OAAO,OAAO;;CAEvC,UAAU,OAAO,SAAS,OAAO,OAAO;AAC1C,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,WAAb,cAA8B,OAAO,MAAgB,yBAAyB,CAAC,CAAC;CAC9E,KAAK,OAAO;CACZ,OAAO,OAAO;;CAEd,MAAM,OAAO;;CAEb,WAAW,OAAO;;;;;CAKlB,OAAO,OAAO;CACd,OAAO,OAAO;CACd,UAAU,OAAO,OAAO;EAAE,OAAO,OAAO;EAAQ,QAAQ,OAAO;CAAO,CAAC;CACvE,QAAQ,OAAO,OAAO;EAAE,GAAG,OAAO;EAAQ,QAAQ,OAAO;CAAO,CAAC;;CAEjE,UAAU,OAAO,MAAM,OAAO;AAChC,CAAC,CAAC,CAAC;;CAED,IAAI,WAAmB;EACrB,MAAM,WACJ,KAAK,OAAO,SAAS,KAAK,SAAS,SAC/B,iBAAiB,KAAK,OAAO,EAAE,MAAM,KAAK,OAAO,SAAS,KAAK,SAAS,OAAO,MAC/E;EAEN,MAAM,UAAyB,CAAC;EAEhC,IAAI,KAAK,QAAQ,GAAG,QAAQ,KAAK,GAAG,KAAK,MAAM,aAAa;EAC5D,IAAI,KAAK,QAAQ,GAAG,QAAQ,KAAK,GAAG,KAAK,MAAM,aAAa;EAE5D,MAAM,SAAS,CACb,GAAI,QAAQ,SAAS,IAAI,CAAC,IAAI,QAAQ,KAAK,IAAI,EAAE,eAAe,IAAI,CAAC,GACrE,GAAI,KAAK,YAAY,CAAC,mCAAmC,IAAI,CAAC,CAChE;EAEA,OAAO;GACL,SAAS,KAAK,UAAU,KAAK,eAAe,KAAK;GACjD,QAAQ,KAAK;GACb,aAAa,KAAK,SAAS,MAAM,GAAG,KAAK,SAAS,SAAS;GAC3D,KAAK,SAAS,KAAK,+BAA+B,KAAK;GACvD,GAAG;EACL,CAAC,CAAC,KAAK,IAAI;CACb;AACF"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Failed, Timeout, refuse, undispatched } from "./BrowserError.mjs";
|
|
2
|
+
import { monotonicMillis } from "./Clock.mjs";
|
|
3
|
+
import { Clock, Duration, Effect, Option, Schedule, Stream } from "effect";
|
|
4
|
+
import { jpegjs } from "playwright-core/lib/utilsBundle";
|
|
5
|
+
//#region src/stillness/Pixels.ts
|
|
6
|
+
/**
|
|
7
|
+
* Where a page's screen moves, from its screencast frames: each frame decoded and cut into
|
|
8
|
+
* 16-pixel blocks, a block moving where a few of its pixels, sampled every other one, changed by
|
|
9
|
+
* more than JPEG's noise in any color channel.
|
|
10
|
+
* What moved among the frames before an input is the page's background, such as an idle
|
|
11
|
+
* animation; foreground stillness ignores it.
|
|
12
|
+
*
|
|
13
|
+
* Frames use Playwright's bundled JPEG decoder. The package build ships that exact decoder
|
|
14
|
+
* alone, keeping its Node utility bundle out of Workers. Source runs use its native export,
|
|
15
|
+
* whose untyped entry point is declared by `utilsBundle.d.ts`.
|
|
16
|
+
*/
|
|
17
|
+
const picture = (frame) => jpegjs.decode(frame.data, { useTArray: true });
|
|
18
|
+
/** A sample changed where any color channel moved more than this, beyond JPEG's noise. */
|
|
19
|
+
const noise = 32;
|
|
20
|
+
/** The blocks where two pictures differ, by `row * columns + column`; -1 for different sizes. */
|
|
21
|
+
const moved = (from, to) => {
|
|
22
|
+
if (from.width !== to.width || from.height !== to.height) return [-1];
|
|
23
|
+
const columns = Math.ceil(from.width / 16);
|
|
24
|
+
const counts = /* @__PURE__ */ new Map();
|
|
25
|
+
const differs = (at) => Math.abs((from.data[at] ?? 0) - (to.data[at] ?? 0)) > noise;
|
|
26
|
+
for (let y = 0; y < from.height; y += 2) for (let x = 0; x < from.width; x += 2) {
|
|
27
|
+
const at = (y * from.width + x) * 4;
|
|
28
|
+
const block = Math.floor(y / 16) * columns + Math.floor(x / 16);
|
|
29
|
+
if (differs(at) || differs(at + 1) || differs(at + 2)) counts.set(block, (counts.get(block) ?? 0) + 1);
|
|
30
|
+
}
|
|
31
|
+
return [...counts].flatMap(([block, count]) => count >= 3 ? [block] : []);
|
|
32
|
+
};
|
|
33
|
+
/** The blocks that moved from one picture to the next and their neighbours; none past a resize. */
|
|
34
|
+
const background = (pictures) => {
|
|
35
|
+
const columns = Math.ceil((pictures[0]?.width ?? 0) / 16);
|
|
36
|
+
const around = (block) => [
|
|
37
|
+
-1,
|
|
38
|
+
0,
|
|
39
|
+
1
|
|
40
|
+
].flatMap((row) => [
|
|
41
|
+
-1,
|
|
42
|
+
0,
|
|
43
|
+
1
|
|
44
|
+
].filter((step) => block >= 0 && block % columns + step >= 0).filter((step) => block % columns + step < columns).map((step) => block + row * columns + step));
|
|
45
|
+
return new Set(pictures.flatMap((to, index) => moved(pictures[index - 1] ?? to, to).flatMap(around)));
|
|
46
|
+
};
|
|
47
|
+
/** Whether anything moved from one picture to another outside the background. */
|
|
48
|
+
const stirs = (from, to, mask) => moved(from, to).some((block) => !mask.has(block));
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/stillness/Stillness.ts
|
|
51
|
+
/** Screen and foreground stillness over the public page capture and owning clock. */
|
|
52
|
+
const observe = (page, options, timeout) => Effect.gen(function* () {
|
|
53
|
+
const now = () => monotonicMillis(page.clock);
|
|
54
|
+
const deadline = now() + Duration.toMillis(timeout);
|
|
55
|
+
const settled = () => page.ready({
|
|
56
|
+
quietMillis: options.quietMillis,
|
|
57
|
+
timeout: Duration.millis(Math.max(0, deadline - now()))
|
|
58
|
+
});
|
|
59
|
+
const quiet = (millis) => Effect.gen(function* () {
|
|
60
|
+
const capture = yield* page.capture();
|
|
61
|
+
const foreground = options.still === "foreground";
|
|
62
|
+
let counts = yield* capture.stats();
|
|
63
|
+
let stirred = now();
|
|
64
|
+
let reference;
|
|
65
|
+
const decoded = (frame) => Effect.try({
|
|
66
|
+
try: () => picture(frame),
|
|
67
|
+
catch: (error) => undispatched("ready", new Failed({ detail: `no picture: ${String(error)}` }))
|
|
68
|
+
});
|
|
69
|
+
const inputAt = (yield* page.recentEvents).findLast((event) => event._tag === "Action")?.startedAt ?? Number.NEGATIVE_INFINITY;
|
|
70
|
+
const document = (yield* page.state).document;
|
|
71
|
+
const before = (foreground ? yield* page.recentFrames : []).filter((frame) => frame.hostTime < inputAt && frame.hostTime >= inputAt - 1500 && frame.document === document);
|
|
72
|
+
const sampled = before.filter((_, index) => index % Math.ceil(before.length / 8) === 0);
|
|
73
|
+
const mask = background(yield* Effect.forEach(sampled, decoded));
|
|
74
|
+
const look = Effect.gen(function* () {
|
|
75
|
+
const stats = yield* capture.stats();
|
|
76
|
+
const latest = (yield* page.state).frame;
|
|
77
|
+
const arrived = stats.received !== counts.received;
|
|
78
|
+
const unseen = stats.accepted - counts.accepted;
|
|
79
|
+
counts = stats;
|
|
80
|
+
if (latest === void 0 || !capture.isCurrent(latest)) stirred = now();
|
|
81
|
+
else if (!foreground ? arrived || stats.ackBacklog > 0 : !arrived && stats.ackBacklog > 0) stirred = now();
|
|
82
|
+
else if (foreground && (unseen > 0 || reference === void 0)) {
|
|
83
|
+
const frames = (yield* page.recentFrames).slice(-Math.max(1, Math.min(8, unseen)));
|
|
84
|
+
if (unseen > frames.length) stirred = now();
|
|
85
|
+
for (const frame of frames) {
|
|
86
|
+
const seen = yield* decoded(frame);
|
|
87
|
+
if (reference === void 0 || stirs(reference, seen, mask)) {
|
|
88
|
+
reference = seen;
|
|
89
|
+
stirred = now();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return now() - stirred;
|
|
94
|
+
});
|
|
95
|
+
const spell = Effect.repeat(look, {
|
|
96
|
+
schedule: Schedule.fixed(Duration.millis(foreground ? 100 : 25)),
|
|
97
|
+
until: (still) => still >= millis
|
|
98
|
+
});
|
|
99
|
+
const still = Effect.gen(function* () {
|
|
100
|
+
for (;;) {
|
|
101
|
+
yield* spell;
|
|
102
|
+
const before = counts.received;
|
|
103
|
+
yield* Effect.all([settled(), capture.sync], {
|
|
104
|
+
concurrency: 2,
|
|
105
|
+
discard: true
|
|
106
|
+
});
|
|
107
|
+
if ((yield* look) >= millis && (foreground || counts.received === before)) return;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return yield* Effect.raceFirst(capture.stream.pipe(Stream.runDrain, Effect.andThen(Effect.never)), still);
|
|
111
|
+
});
|
|
112
|
+
yield* page.afterInput(Effect.void);
|
|
113
|
+
if (options.still === "content") {
|
|
114
|
+
yield* page.changes();
|
|
115
|
+
yield* Effect.sleep(Duration.millis(options.quietMillis));
|
|
116
|
+
return yield* settled();
|
|
117
|
+
}
|
|
118
|
+
yield* settled();
|
|
119
|
+
yield* quiet(options.quietMillis);
|
|
120
|
+
});
|
|
121
|
+
const wait = (page, options) => Effect.gen(function* () {
|
|
122
|
+
if (!Number.isFinite(options.quietMillis) || options.quietMillis < 0) return yield* refuse("stillness", "quietMillis must be finite and nonnegative");
|
|
123
|
+
const input = options.timeout ?? Duration.seconds(15);
|
|
124
|
+
const components = typeof input === "number" ? [input] : typeof input === "object" && !Duration.isDuration(input) ? Object.values(input) : [];
|
|
125
|
+
const timeout = Duration.fromInput(input);
|
|
126
|
+
if (components.some((value) => typeof value === "number" && !Number.isFinite(value)) || Option.isNone(timeout) || !Duration.isFinite(timeout.value) || Duration.isNegative(timeout.value)) return yield* refuse("stillness", "timeout must be a finite nonnegative duration");
|
|
127
|
+
const duration = timeout.value;
|
|
128
|
+
return yield* observe(page, options, duration).pipe(Effect.timeoutOrElse({
|
|
129
|
+
duration,
|
|
130
|
+
orElse: () => Effect.fail(undispatched("stillness", new Timeout({ millis: Duration.toMillis(duration) })))
|
|
131
|
+
}));
|
|
132
|
+
}).pipe(Effect.scoped, Effect.provideService(Clock.Clock, page.clock), Effect.withSpan("Stillness.wait"));
|
|
133
|
+
//#endregion
|
|
134
|
+
export { wait as t };
|
|
135
|
+
|
|
136
|
+
//# sourceMappingURL=Stillness-CNlvayIo.mjs.map
|