effect-browser 0.3.0-beta.21 → 0.3.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -159
- 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-BKPAbyys.mjs +4076 -0
- package/dist/Browser-BKPAbyys.mjs.map +1 -0
- package/dist/{Browser-CiXHT1yO.d.mts → Browser-wZhwZSlG.d.mts} +51 -13
- package/dist/Browser.d.mts +2 -2
- 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/Matching.d.mts +37 -0
- package/dist/Matching.mjs +72 -0
- package/dist/Matching.mjs.map +1 -0
- package/dist/Page-BF5izr8R.mjs +795 -0
- 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/{cdp-DL7XfEj5.d.mts → connection-2KHI4_KN.d.mts} +4 -4
- package/dist/{cdp-BMpYMWYe.mjs → connection-CK83pvqP.mjs} +5 -6
- package/dist/connection-CK83pvqP.mjs.map +1 -0
- package/dist/index.d.mts +15 -18
- package/dist/index.mjs +11 -15
- 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-BG1WifW2.mjs → plan/index.mjs} +122 -199
- package/dist/plan/index.mjs.map +1 -0
- package/dist/{Policy-BGWjbqCl.d.mts → policy/Policy.d.mts} +16 -20
- 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-NHp8N81k.d.mts → presentation/Stage.d.mts} +12 -15
- 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/{Cdp.mjs → providers/Cdp.mjs} +3 -8
- 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} +6 -15
- 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 +515 -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 -3
- package/dist/workerd/Cdp.mjs +2 -7
- package/dist/workerd/Cdp.mjs.map +1 -1
- package/package.json +89 -39
- package/src/Action.ts +127 -0
- package/src/ActionPort.ts +128 -0
- package/src/Browser.ts +352 -201
- 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 +15 -6
- 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 +209 -113
- package/src/internal/page/context.ts +12 -59
- package/src/internal/page/dialogs.ts +58 -0
- package/src/internal/page/identity.ts +6 -5
- 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/{Cdp.ts → providers/Cdp.ts} +2 -2
- package/src/{Chromium.ts → providers/Chromium.ts} +7 -10
- package/src/providers/Released.ts +13 -0
- package/src/{internal/cdp.ts → providers/connection.ts} +2 -2
- package/src/{internal/pictures/motion.ts → stillness/Pixels.ts} +1 -1
- 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 +238 -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 +2 -2
- package/dist/Browser-CxXUjxOp.mjs +0 -619
- package/dist/Browser-CxXUjxOp.mjs.map +0 -1
- package/dist/Cdp-CzCRnMlM.d.mts +0 -10
- package/dist/Cdp.d.mts +0 -11
- 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-u3P_ENLX.d.mts +0 -62
- package/dist/Expect.d.mts +0 -2
- 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-BP02bmNv.mjs +0 -264
- package/dist/Page-BP02bmNv.mjs.map +0 -1
- package/dist/Plan-BG1WifW2.mjs.map +0 -1
- package/dist/Plan.d.mts +0 -2
- package/dist/Plan.mjs +0 -2
- package/dist/Policy.d.mts +0 -2
- package/dist/Policy.mjs.map +0 -1
- package/dist/Presentation-DxVikn9_.d.mts +0 -48
- package/dist/Presentation.d.mts +0 -2
- package/dist/Presentation.mjs +0 -118
- package/dist/Presentation.mjs.map +0 -1
- package/dist/Stage.d.mts +0 -2
- 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-CfRxbaso.d.mts +0 -317
- package/dist/Supervisor.d.mts +0 -2
- package/dist/Supervisor.mjs +0 -2
- package/dist/cdp-BMpYMWYe.mjs.map +0 -1
- package/dist/context-EGhOqjNN.mjs +0 -335
- package/dist/context-EGhOqjNN.mjs.map +0 -1
- package/dist/page-PTM8m5wC.mjs +0 -4057
- package/dist/page-PTM8m5wC.mjs.map +0 -1
- package/dist/url-Bsp2y55M.mjs +0 -264
- package/dist/url-Bsp2y55M.mjs.map +0 -1
- package/dist/workerd/index.d.mts +0 -16
- package/dist/workerd/index.mjs +0 -17
- 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/workerd/index.ts +0 -17
- /package/src/{internal/page/url.ts → Url.ts} +0 -0
- /package/src/{internal/pictures → stillness}/utilsBundle.d.ts +0 -0
package/dist/Style.d.mts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { t as BrowserError } from "./BrowserError-BlcmLVzn.mjs";
|
|
2
|
+
import { a as Sample, r as Planner, t as Geometry_d_exports } from "./Geometry-DJx9qrYy.mjs";
|
|
3
|
+
import { m as Point } from "./Page-CvsOEorc.mjs";
|
|
4
|
+
import { Context, Duration, Effect, MutableRef, Option } from "effect";
|
|
5
|
+
declare namespace Style_d_exports {
|
|
6
|
+
export { Current, Style, TypingEvent, WheelStep, keyGap, maximumDurationMillis, pause, performed, plain, provide, validated };
|
|
7
|
+
}
|
|
8
|
+
export interface TypingEvent {
|
|
9
|
+
/** From the start of the typing. */
|
|
10
|
+
readonly afterMillis: number;
|
|
11
|
+
readonly phase: "down" | "up" | "insert";
|
|
12
|
+
readonly key: string;
|
|
13
|
+
}
|
|
14
|
+
export interface WheelStep {
|
|
15
|
+
readonly dx: number;
|
|
16
|
+
readonly dy: number;
|
|
17
|
+
/** From the first step. */
|
|
18
|
+
readonly afterMillis: number;
|
|
19
|
+
}
|
|
20
|
+
export interface Style {
|
|
21
|
+
/** Own presentation only after policy allows input; wait options belong to the page. */
|
|
22
|
+
readonly withInput?: ((options: {
|
|
23
|
+
readonly operation: string;
|
|
24
|
+
readonly wait: Duration.Duration;
|
|
25
|
+
readonly failFast: boolean;
|
|
26
|
+
}) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | BrowserError, R>) | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Whether viewers watch the input: then the pointer clicks into a field before typing, finds
|
|
29
|
+
* what lies under it as it scrolls, and scrolls to a target out of view with the wheel.
|
|
30
|
+
*/
|
|
31
|
+
readonly shown: boolean;
|
|
32
|
+
/** Where viewers last saw the pointer, which the next glide starts from; else the page's own. */
|
|
33
|
+
readonly pointer: MutableRef.MutableRef<Option.Option<Point>> | undefined;
|
|
34
|
+
/** The pointer's path to `to`, ending exactly there. */
|
|
35
|
+
readonly glide: (from: Point, to: Point, dragging: boolean) => Effect.Effect<ReadonlyArray<Sample>>;
|
|
36
|
+
/** How long a button stays down when a click does not say. */
|
|
37
|
+
readonly hold: Effect.Effect<number, BrowserError>;
|
|
38
|
+
/** The key events that type `text`, or one insertion of it under a guard, timed from the start. */
|
|
39
|
+
readonly typing: (text: string, guarded: boolean) => Effect.Effect<ReadonlyArray<TypingEvent>, BrowserError>;
|
|
40
|
+
/** The pause between repeated presses of the same keys. */
|
|
41
|
+
readonly keyGap: Effect.Effect<number, BrowserError>;
|
|
42
|
+
/** A wheel scroll as the wheel turns: in one step, or in notches and bursts. */
|
|
43
|
+
readonly wheel: (dx: number, dy: number) => Effect.Effect<ReadonlyArray<WheelStep>, BrowserError>;
|
|
44
|
+
}
|
|
45
|
+
/** Each key as it comes, with no pause; a drag moves in eight short steps so its target sees it. */
|
|
46
|
+
export declare const plain: Style;
|
|
47
|
+
/** A pause around `median`, as the research measured reactions: at most four times it. */
|
|
48
|
+
export declare const pause: (median: number, sigma: number) => Effect.Effect<number, never, never>;
|
|
49
|
+
/**
|
|
50
|
+
* Plan the whole text before any key goes, so holds overlap without waiting on the network. A
|
|
51
|
+
* physical key is never held twice, as with A and a, or ! and 1. The first key waits for the hand
|
|
52
|
+
* to reach the keys, each later one follows the last by a gap drawn around `gap`, and a word's
|
|
53
|
+
* first key comes 60 ms later.
|
|
54
|
+
*/
|
|
55
|
+
export declare const maximumDurationMillis = 10000;
|
|
56
|
+
/** Copy and validate custom schedules before their first input; planning uses the action bound. */
|
|
57
|
+
export declare const validated: (style: Style) => Style;
|
|
58
|
+
/** A word is five characters; the gap leaves room for each word's later start. */
|
|
59
|
+
export declare const keyGap: (wordsPerMinute: number) => number;
|
|
60
|
+
/** Input performed for viewers, with this pointer and pace. */
|
|
61
|
+
export declare const performed: (options: {
|
|
62
|
+
readonly pointer: MutableRef.MutableRef<Option.Option<Point>>;
|
|
63
|
+
readonly motion: Planner;
|
|
64
|
+
readonly wordsPerMinute: number;
|
|
65
|
+
}) => Style;
|
|
66
|
+
/** Input style in this fiber; plain input is the default. */
|
|
67
|
+
export declare const Current: Context.Reference<Style>;
|
|
68
|
+
/** Apply a style through page input, including pages selected later by a browser adapter. */
|
|
69
|
+
export declare const provide: (style: Style) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, never>>;
|
|
70
|
+
//#endregion
|
|
71
|
+
export { Style_d_exports as t };
|
|
72
|
+
//# sourceMappingURL=Style.d.mts.map
|
package/dist/Style.mjs
ADDED
package/dist/Url.d.mts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare namespace Url_d_exports {
|
|
2
|
+
export { addresses, parse, quoted, redact, redactWithin, withheld };
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Addresses: reading one the way a person types it, for `Page.goto` and the browser tools alike,
|
|
6
|
+
* and reporting one without the values that are credentials, by one rule that the page script runs
|
|
7
|
+
* too, for the outline's links.
|
|
8
|
+
*/
|
|
9
|
+
/** The URL `input` names. Without a scheme it is a web address: HTTPS, or HTTP on loopback. */
|
|
10
|
+
export declare const parse: (input: string) => URL | null;
|
|
11
|
+
/**
|
|
12
|
+
* The rule that reports an address without its credentials. The page script runs it too, so it
|
|
13
|
+
* stays self-contained, as `names.inpage.ts` says a page-side part must.
|
|
14
|
+
*/
|
|
15
|
+
export declare const addresses: () => {
|
|
16
|
+
withheld: "••••••••";
|
|
17
|
+
redact: (url: string) => string;
|
|
18
|
+
};
|
|
19
|
+
export declare const withheld: "••••••••", redact: (url: string) => string;
|
|
20
|
+
/** An address inside text, as a failure's message quotes one. */
|
|
21
|
+
export declare const quoted: RegExp;
|
|
22
|
+
/** `text` with each address in it redacted. */
|
|
23
|
+
export declare const redactWithin: (text: string) => string;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { Url_d_exports as t };
|
|
26
|
+
//# sourceMappingURL=Url.d.mts.map
|
package/dist/Url.mjs
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
//#region src/Url.ts
|
|
3
|
+
var Url_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
addresses: () => addresses,
|
|
5
|
+
parse: () => parse,
|
|
6
|
+
quoted: () => quoted,
|
|
7
|
+
redact: () => redact,
|
|
8
|
+
redactWithin: () => redactWithin,
|
|
9
|
+
withheld: () => withheld
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Addresses: reading one the way a person types it, for `Page.goto` and the browser tools alike,
|
|
13
|
+
* and reporting one without the values that are credentials, by one rule that the page script runs
|
|
14
|
+
* too, for the outline's links.
|
|
15
|
+
*/
|
|
16
|
+
const scheme = /^[a-z][a-z0-9+.-]*:/i;
|
|
17
|
+
const hostAndPort = /^[^\s/?#@:]+:\d+(?:[/?#]|$)/;
|
|
18
|
+
const loopback = /^(?:localhost|127(?:\.\d+){3}|\[::1\])(?:[:/?#]|$)/i;
|
|
19
|
+
/** The URL `input` names. Without a scheme it is a web address: HTTPS, or HTTP on loopback. */
|
|
20
|
+
const parse = (input) => {
|
|
21
|
+
const text = input.trim();
|
|
22
|
+
if (scheme.test(text) && !hostAndPort.test(text)) return URL.parse(text);
|
|
23
|
+
return URL.parse(`${loopback.test(text) ? "http" : "https"}://${text}`);
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The rule that reports an address without its credentials. The page script runs it too, so it
|
|
27
|
+
* stays self-contained, as `names.inpage.ts` says a page-side part must.
|
|
28
|
+
*/
|
|
29
|
+
const addresses = () => {
|
|
30
|
+
const withheld = "••••••••";
|
|
31
|
+
const credential = /token|secret|passw|passcode|passphrase|signature|credential|assertion|verifier|bearer|jwt|hmac|apikey|accesskey|privatekey|sess(?:ion)?id|saml(?:response|art)|(?:sig|otp)$|(?:auth|api|access|private|secret|signing|client|encryption|licen[cs]e|session|master|app|device|verification|verify|confirmation|confirm|activation|activate|reset|recovery|login|security|magic|onetime|mfa|2fa|sms|email|otp|oob)(?:code|key)$|^(?:auth|authorization|pwd|pass)$/;
|
|
32
|
+
const ambiguous = /^(?:code|key|session|sid|ticket)$/;
|
|
33
|
+
const secret = (name, value) => {
|
|
34
|
+
const bare = name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
35
|
+
return value !== "" && (credential.test(bare) || ambiguous.test(bare) && value.length >= 16 && /\d/.test(value) && /[a-z]/i.test(value));
|
|
36
|
+
};
|
|
37
|
+
const masked = (parameters, separator) => parameters.split(separator).map((parameter) => {
|
|
38
|
+
const [name = "", value = ""] = [...new URLSearchParams(parameter)][0] ?? [];
|
|
39
|
+
return secret(name, value) ? `${parameter.slice(0, parameter.indexOf("=") + 1)}${withheld}` : parameter;
|
|
40
|
+
}).join(separator);
|
|
41
|
+
/**
|
|
42
|
+
* `url` as the library reports it: without userinfo, and with each credential's value withheld,
|
|
43
|
+
* so the rest keeps its identity, such as a chart's `?ticker=ETH`. An address without a host,
|
|
44
|
+
* such as `data:` or `about:blank`, is content or a fixed name, and stays as it is.
|
|
45
|
+
*/
|
|
46
|
+
const redact = (url) => {
|
|
47
|
+
const parsed = URL.parse(url);
|
|
48
|
+
if (parsed === null || parsed.host === "") return url;
|
|
49
|
+
parsed.username = "";
|
|
50
|
+
parsed.password = "";
|
|
51
|
+
parsed.pathname = masked(parsed.pathname, ";");
|
|
52
|
+
parsed.search = masked(parsed.search.slice(1), "&");
|
|
53
|
+
if (parsed.hash.includes("=")) {
|
|
54
|
+
const fragment = parsed.hash.slice(1);
|
|
55
|
+
const question = fragment.indexOf("?");
|
|
56
|
+
const start = question >= 0 && question < fragment.indexOf("=") ? question + 1 : 0;
|
|
57
|
+
parsed.hash = fragment.slice(0, start) + masked(fragment.slice(start), "&");
|
|
58
|
+
}
|
|
59
|
+
return parsed.href.replaceAll(encodeURIComponent(withheld), withheld);
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
withheld,
|
|
63
|
+
redact
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const { withheld, redact } = addresses();
|
|
67
|
+
/** An address inside text, as a failure's message quotes one. */
|
|
68
|
+
const quoted = /[a-z][a-z\d+.-]*:\/\/[^\s"'<>]+/gi;
|
|
69
|
+
/** `text` with each address in it redacted. */
|
|
70
|
+
const redactWithin = (text) => text.replace(quoted, (url) => redact(url));
|
|
71
|
+
//#endregion
|
|
72
|
+
export { addresses, parse, quoted, redact, redactWithin, Url_exports as t, withheld };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=Url.mjs.map
|
package/dist/Url.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Url.mjs","names":[],"sources":["../src/Url.ts"],"sourcesContent":["/**\n * Addresses: reading one the way a person types it, for `Page.goto` and the browser tools alike,\n * and reporting one without the values that are credentials, by one rule that the page script runs\n * too, for the outline's links.\n */\n\nconst scheme = /^[a-z][a-z0-9+.-]*:/i;\n\n// `localhost:3000` and `example.com:8080/a` look like a scheme to the URL parser; a port decides.\nconst hostAndPort = /^[^\\s/?#@:]+:\\d+(?:[/?#]|$)/;\n\nconst loopback = /^(?:localhost|127(?:\\.\\d+){3}|\\[::1\\])(?:[:/?#]|$)/i;\n\n/** The URL `input` names. Without a scheme it is a web address: HTTPS, or HTTP on loopback. */\nexport const parse = (input: string): URL | null => {\n const text = input.trim();\n\n if (scheme.test(text) && !hostAndPort.test(text)) return URL.parse(text);\n\n return URL.parse(`${loopback.test(text) ? \"http\" : \"https\"}://${text}`);\n};\n\n/**\n * The rule that reports an address without its credentials. The page script runs it too, so it\n * stays self-contained, as `names.inpage.ts` says a page-side part must.\n */\nexport const addresses = () => {\n // What a credential's value reads as, as a secret field's text does (`Page.redacted`).\n const withheld = \"••••••••\" as const;\n\n // A parameter's name, compared in lowercase without separators, says it is a credential: a token,\n // secret, password, signature, assertion, session id or one-time code, or a code or key of a kind\n // that signs someone in or signs a request, such as `verification_code` or `api_key`.\n const credential =\n /token|secret|passw|passcode|passphrase|signature|credential|assertion|verifier|bearer|jwt|hmac|apikey|accesskey|privatekey|sess(?:ion)?id|saml(?:response|art)|(?:sig|otp)$|(?:auth|api|access|private|secret|signing|client|encryption|licen[cs]e|session|master|app|device|verification|verify|confirmation|confirm|activation|activate|reset|recovery|login|security|magic|onetime|mfa|2fa|sms|email|otp|oob)(?:code|key)$|^(?:auth|authorization|pwd|pass)$/;\n\n // These names as often say what an address is about, such as a stock code, a support ticket or a\n // conference session. Under them a value is a credential when it looks generated, at least 16\n // characters with letters and digits, as tokens, session ids and authorization codes do.\n const ambiguous = /^(?:code|key|session|sid|ticket)$/;\n\n const secret = (name: string, value: string) => {\n const bare = name.toLowerCase().replace(/[^a-z0-9]/g, \"\");\n\n return (\n value !== \"\" &&\n (credential.test(bare) ||\n (ambiguous.test(bare) && value.length >= 16 && /\\d/.test(value) && /[a-z]/i.test(value)))\n );\n };\n\n // Parameters as written, each credential's value withheld: a query's, a fragment's written as a\n // query, or a path's segments', as a Java session id is.\n const masked = (parameters: string, separator: string) =>\n parameters\n .split(separator)\n .map((parameter) => {\n const [name = \"\", value = \"\"] = [...new URLSearchParams(parameter)][0] ?? [];\n\n return secret(name, value)\n ? `${parameter.slice(0, parameter.indexOf(\"=\") + 1)}${withheld}`\n : parameter;\n })\n .join(separator);\n\n /**\n * `url` as the library reports it: without userinfo, and with each credential's value withheld,\n * so the rest keeps its identity, such as a chart's `?ticker=ETH`. An address without a host,\n * such as `data:` or `about:blank`, is content or a fixed name, and stays as it is.\n */\n const redact = (url: string): string => {\n const parsed = URL.parse(url);\n\n if (parsed === null || parsed.host === \"\") return url;\n parsed.username = \"\";\n parsed.password = \"\";\n parsed.pathname = masked(parsed.pathname, \";\");\n parsed.search = masked(parsed.search.slice(1), \"&\");\n if (parsed.hash.includes(\"=\")) {\n const fragment = parsed.hash.slice(1);\n const question = fragment.indexOf(\"?\");\n // A route before the parameters, as in `#/inbox?token=…`, stays.\n const start = question >= 0 && question < fragment.indexOf(\"=\") ? question + 1 : 0;\n\n parsed.hash = fragment.slice(0, start) + masked(fragment.slice(start), \"&\");\n }\n\n return parsed.href.replaceAll(encodeURIComponent(withheld), withheld);\n };\n\n return { withheld, redact };\n};\n\nexport const { withheld, redact } = addresses();\n\n/** An address inside text, as a failure's message quotes one. */\nexport const quoted = /[a-z][a-z\\d+.-]*:\\/\\/[^\\s\"'<>]+/gi;\n\n/** `text` with each address in it redacted. */\nexport const redactWithin = (text: string) => text.replace(quoted, (url) => redact(url));\n"],"mappings":";;;;;;;;;;;;;;;AAMA,MAAM,SAAS;AAGf,MAAM,cAAc;AAEpB,MAAM,WAAW;;AAGjB,MAAa,SAAS,UAA8B;CAClD,MAAM,OAAO,MAAM,KAAK;CAExB,IAAI,OAAO,KAAK,IAAI,KAAK,CAAC,YAAY,KAAK,IAAI,GAAG,OAAO,IAAI,MAAM,IAAI;CAEvE,OAAO,IAAI,MAAM,GAAG,SAAS,KAAK,IAAI,IAAI,SAAS,QAAQ,KAAK,MAAM;AACxE;;;;;AAMA,MAAa,kBAAkB;CAE7B,MAAM,WAAW;CAKjB,MAAM,aACJ;CAKF,MAAM,YAAY;CAElB,MAAM,UAAU,MAAc,UAAkB;EAC9C,MAAM,OAAO,KAAK,YAAY,CAAC,CAAC,QAAQ,cAAc,EAAE;EAExD,OACE,UAAU,OACT,WAAW,KAAK,IAAI,KAClB,UAAU,KAAK,IAAI,KAAK,MAAM,UAAU,MAAM,KAAK,KAAK,KAAK,KAAK,SAAS,KAAK,KAAK;CAE5F;CAIA,MAAM,UAAU,YAAoB,cAClC,WACG,MAAM,SAAS,CAAC,CAChB,KAAK,cAAc;EAClB,MAAM,CAAC,OAAO,IAAI,QAAQ,MAAM,CAAC,GAAG,IAAI,gBAAgB,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;EAE3E,OAAO,OAAO,MAAM,KAAK,IACrB,GAAG,UAAU,MAAM,GAAG,UAAU,QAAQ,GAAG,IAAI,CAAC,IAAI,aACpD;CACN,CAAC,CAAC,CACD,KAAK,SAAS;;;;;;CAOnB,MAAM,UAAU,QAAwB;EACtC,MAAM,SAAS,IAAI,MAAM,GAAG;EAE5B,IAAI,WAAW,QAAQ,OAAO,SAAS,IAAI,OAAO;EAClD,OAAO,WAAW;EAClB,OAAO,WAAW;EAClB,OAAO,WAAW,OAAO,OAAO,UAAU,GAAG;EAC7C,OAAO,SAAS,OAAO,OAAO,OAAO,MAAM,CAAC,GAAG,GAAG;EAClD,IAAI,OAAO,KAAK,SAAS,GAAG,GAAG;GAC7B,MAAM,WAAW,OAAO,KAAK,MAAM,CAAC;GACpC,MAAM,WAAW,SAAS,QAAQ,GAAG;GAErC,MAAM,QAAQ,YAAY,KAAK,WAAW,SAAS,QAAQ,GAAG,IAAI,WAAW,IAAI;GAEjF,OAAO,OAAO,SAAS,MAAM,GAAG,KAAK,IAAI,OAAO,SAAS,MAAM,KAAK,GAAG,GAAG;EAC5E;EAEA,OAAO,OAAO,KAAK,WAAW,mBAAmB,QAAQ,GAAG,QAAQ;CACtE;CAEA,OAAO;EAAE;EAAU;CAAO;AAC5B;AAEA,MAAa,EAAE,UAAU,WAAW,UAAU;;AAG9C,MAAa,SAAS;;AAGtB,MAAa,gBAAgB,SAAiB,KAAK,QAAQ,SAAS,QAAQ,OAAO,GAAG,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { t as BrowserError } from "./BrowserError-BlcmLVzn.mjs";
|
|
2
|
+
import { E as WheelScrolled, S as TextInserted, T as TrackPlanned, a as CursorChanged, c as Disconnected, d as PageClosed, f as PageLoaded, g as PointerReleased, h as PointerPressed, l as KeyChanged, m as PageUntracked, o as DialogShown, p as PageOpened, t as Action, u as Navigated, v as RequestRefused, w as TrackPerformed, y as SessionEnding } from "./BrowserEvent-lLqJ3GJS.mjs";
|
|
3
|
+
import { r as Changes } from "./Change-Ba7INmay.mjs";
|
|
4
|
+
import { r as Frame } from "./Frame-UEH2hO5T.mjs";
|
|
5
|
+
import { Schema } from "effect";
|
|
6
|
+
declare namespace Window_d_exports {
|
|
7
|
+
export { Window };
|
|
8
|
+
}
|
|
9
|
+
declare const Window_base: Schema.Class<Window, Schema.Struct<{
|
|
10
|
+
readonly page: Schema.String;
|
|
11
|
+
/** Where the window starts, in host monotonic milliseconds on the owning browser’s clock. */
|
|
12
|
+
readonly since: Schema.Finite;
|
|
13
|
+
/** Where it ends, never after it was taken. */
|
|
14
|
+
readonly until: Schema.Finite;
|
|
15
|
+
/** The page's events after `since`, up to `until`, oldest first, without the input presentation track. */
|
|
16
|
+
readonly events: Schema.$Array<Schema.Union<readonly [typeof RequestRefused, typeof PageOpened, typeof PageClosed, typeof PageUntracked, typeof Navigated, typeof PageLoaded, typeof Action, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged, typeof DialogShown, typeof Disconnected, typeof SessionEnding]>>;
|
|
17
|
+
/**
|
|
18
|
+
* What visibly changed after `since`, up to `until`; absent where `missing` says why. A page's
|
|
19
|
+
* first window starts its record, so the record sees none of it.
|
|
20
|
+
*/
|
|
21
|
+
readonly changes: Schema.optional<typeof Changes>;
|
|
22
|
+
/** Screencast frames painted from `since` to `until`, oldest first, as far back as kept. */
|
|
23
|
+
readonly frames: Schema.$Array<typeof Frame>;
|
|
24
|
+
/**
|
|
25
|
+
* Why each part that could not be read is missing: the read of its changes, by whatever
|
|
26
|
+
* operation failed there, or a moment's picture (`frame`) or outline (`snapshot`).
|
|
27
|
+
*/
|
|
28
|
+
readonly missing: Schema.$Array<typeof BrowserError>;
|
|
29
|
+
}>, {}>;
|
|
30
|
+
/** A page's events, changes and frames over one window of its browser's host clock. */
|
|
31
|
+
declare class Window extends Window_base {}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Window_d_exports as n, Window as t };
|
|
34
|
+
//# sourceMappingURL=Window-CMddGMt1.d.mts.map
|
package/dist/Window.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { BrowserEvent } from "./BrowserEvent.mjs";
|
|
3
|
+
import { BrowserError } from "./BrowserError.mjs";
|
|
4
|
+
import { Frame } from "./Frame.mjs";
|
|
5
|
+
import { Changes } from "./Change.mjs";
|
|
6
|
+
import { Schema } from "effect";
|
|
7
|
+
//#region src/Window.ts
|
|
8
|
+
/** A bounded window of a page's events, visible changes and frames on the owning clock. */
|
|
9
|
+
var Window_exports = /* @__PURE__ */ __exportAll({ Window: () => Window });
|
|
10
|
+
/** A page's events, changes and frames over one window of its browser's host clock. */
|
|
11
|
+
var Window = class extends Schema.Class("effect-browser/Window")({
|
|
12
|
+
page: Schema.String,
|
|
13
|
+
/** Where the window starts, in host monotonic milliseconds on the owning browser’s clock. */
|
|
14
|
+
since: Schema.Finite,
|
|
15
|
+
/** Where it ends, never after it was taken. */
|
|
16
|
+
until: Schema.Finite,
|
|
17
|
+
/** The page's events after `since`, up to `until`, oldest first, without the input presentation track. */
|
|
18
|
+
events: Schema.Array(BrowserEvent),
|
|
19
|
+
/**
|
|
20
|
+
* What visibly changed after `since`, up to `until`; absent where `missing` says why. A page's
|
|
21
|
+
* first window starts its record, so the record sees none of it.
|
|
22
|
+
*/
|
|
23
|
+
changes: Schema.optional(Changes),
|
|
24
|
+
/** Screencast frames painted from `since` to `until`, oldest first, as far back as kept. */
|
|
25
|
+
frames: Schema.Array(Frame),
|
|
26
|
+
/**
|
|
27
|
+
* Why each part that could not be read is missing: the read of its changes, by whatever
|
|
28
|
+
* operation failed there, or a moment's picture (`frame`) or outline (`snapshot`).
|
|
29
|
+
*/
|
|
30
|
+
missing: Schema.Array(BrowserError)
|
|
31
|
+
}) {};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Window, Window_exports as t };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=Window.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Window.mjs","names":[],"sources":["../src/Window.ts"],"sourcesContent":["/** A bounded window of a page's events, visible changes and frames on the owning clock. */\nimport { Schema } from \"effect\";\n\nimport { BrowserError } from \"./BrowserError.ts\";\nimport { BrowserEvent } from \"./BrowserEvent.ts\";\nimport { Changes } from \"./Change.ts\";\nimport { Frame } from \"./Frame.ts\";\n\n/** A page's events, changes and frames over one window of its browser's host clock. */\nexport class Window extends Schema.Class<Window>(\"effect-browser/Window\")({\n page: Schema.String,\n /** Where the window starts, in host monotonic milliseconds on the owning browser’s clock. */\n since: Schema.Finite,\n /** Where it ends, never after it was taken. */\n until: Schema.Finite,\n /** The page's events after `since`, up to `until`, oldest first, without the input presentation track. */\n events: Schema.Array(BrowserEvent),\n /**\n * What visibly changed after `since`, up to `until`; absent where `missing` says why. A page's\n * first window starts its record, so the record sees none of it.\n */\n changes: Schema.optional(Changes),\n /** Screencast frames painted from `since` to `until`, oldest first, as far back as kept. */\n frames: Schema.Array(Frame),\n /**\n * Why each part that could not be read is missing: the read of its changes, by whatever\n * operation failed there, or a moment's picture (`frame`) or outline (`snapshot`).\n */\n missing: Schema.Array(BrowserError),\n}) {}\n"],"mappings":";;;;;;;;;;AASA,IAAa,SAAb,cAA4B,OAAO,MAAc,uBAAuB,CAAC,CAAC;CACxE,MAAM,OAAO;;CAEb,OAAO,OAAO;;CAEd,OAAO,OAAO;;CAEd,QAAQ,OAAO,MAAM,YAAY;;;;;CAKjC,SAAS,OAAO,SAAS,OAAO;;CAEhC,QAAQ,OAAO,MAAM,KAAK;;;;;CAK1B,SAAS,OAAO,MAAM,YAAY;AACpC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./BrowserError-
|
|
2
|
-
import { n as Browser_d_exports, o as Options$1, r as CaptureSource } from "./Browser-
|
|
1
|
+
import "./BrowserError-BlcmLVzn.mjs";
|
|
2
|
+
import { n as Browser_d_exports, o as Options$1, r as CaptureSource } from "./Browser-wZhwZSlG.mjs";
|
|
3
3
|
import { DateTime, Effect, Layer, Redacted } from "effect";
|
|
4
4
|
import { Browser } from "playwright-core";
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/providers/connection.d.ts
|
|
6
6
|
/** The runtime connector receives the bound and cancellation signal owned by the opening scope. */
|
|
7
7
|
interface ConnectOptions {
|
|
8
8
|
readonly timeout: number;
|
|
@@ -38,4 +38,4 @@ interface Options extends Options$1, Pick<ConnectOptions, "headers"> {
|
|
|
38
38
|
}
|
|
39
39
|
//#endregion
|
|
40
40
|
export { Connector as n, Options as r, ConnectOptions as t };
|
|
41
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=connection-2KHI4_KN.d.mts.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as quoted } from "./url-Bsp2y55M.mjs";
|
|
1
|
+
import { quoted } from "./Url.mjs";
|
|
2
|
+
import { InvalidRequest, Timeout, reasonOf, undispatched } from "./BrowserError.mjs";
|
|
3
|
+
import { i as make$1, t as Browser } from "./Browser-BKPAbyys.mjs";
|
|
5
4
|
import { Effect, Layer, Redacted } from "effect";
|
|
6
|
-
//#region src/
|
|
5
|
+
//#region src/providers/connection.ts
|
|
7
6
|
/**
|
|
8
7
|
* A browser reached over the Chrome DevTools Protocol: a Chrome started with
|
|
9
8
|
* `--remote-debugging-port`, or any provider that hands out a CDP WebSocket URL.
|
|
@@ -66,4 +65,4 @@ const make = (defaultConnect) => {
|
|
|
66
65
|
//#endregion
|
|
67
66
|
export { make as t };
|
|
68
67
|
|
|
69
|
-
//# sourceMappingURL=
|
|
68
|
+
//# sourceMappingURL=connection-CK83pvqP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-CK83pvqP.mjs","names":["Errors.InvalidRequest","Url.quoted","Errors.Timeout","Browser.make","Browser.Browser"],"sources":["../src/providers/connection.ts"],"sourcesContent":["/**\n * A browser reached over the Chrome DevTools Protocol: a Chrome started with\n * `--remote-debugging-port`, or any provider that hands out a CDP WebSocket URL.\n *\n * Closing the scope disconnects. It does not close the remote browser; its owner does that.\n *\n * @since 0.3.0\n */\nimport { type DateTime, Effect, Layer, Redacted } from \"effect\";\nimport type { Browser as PlaywrightBrowser } from \"playwright-core\";\n\nimport * as Browser from \"../Browser.ts\";\nimport * as Errors from \"../BrowserError.ts\";\nimport { reasonOf, undispatched } from \"../BrowserError.ts\";\nimport * as Url from \"../Url.ts\";\n\n/** The runtime connector receives the bound and cancellation signal owned by the opening scope. */\nexport interface ConnectOptions {\n readonly timeout: number;\n readonly headers?: Readonly<Record<string, string>> | undefined;\n readonly signal: AbortSignal;\n}\n\n/**\n * Return a real Playwright CDP browser whose `close()` disconnects without ending the remote\n * browser. Honor `signal` to cancel work; a browser returned after cancellation is disconnected.\n * The endpoint and headers may contain credentials and must not be logged.\n */\nexport type Connector = (endpoint: string, options: ConnectOptions) => Promise<PlaywrightBrowser>;\n\nexport interface Options extends Browser.Options, Pick<ConnectOptions, \"headers\"> {\n /**\n * `ws://`, `wss://` or `http://` DevTools endpoint. Often a credential, so it may be redacted;\n * connect failures never include its userinfo, path or query.\n */\n readonly endpoint: string | Redacted.Redacted<string>;\n /** Runtime-supplied Playwright connection. Required by the `workerd` entry. */\n readonly connect?: Connector | undefined;\n /** Identifies the session in `Browser.id`. Defaults to `\"cdp\"`. */\n readonly id?: string | undefined;\n readonly provider?: string | undefined;\n /** Bound on connecting. Defaults to 30 seconds. */\n readonly connectTimeoutMillis?: number | undefined;\n /** When the provider ends the session on its own, as a hosted session's timeout does. */\n readonly expiresAt?: DateTime.Utc | undefined;\n /**\n * A connection apart from this one for the pages' screencasts, as a hosted provider supplies.\n * Without one, each page's capture runs on its own session.\n */\n readonly capture?: Browser.CaptureSource | undefined;\n}\n\n/** Runtime facades supply the default transport; the shared lifetime imports no Node transport. */\nexport const make = (defaultConnect?: Connector) => {\n const open = Effect.fn(\"Cdp.open\")(function* (options: Options) {\n const endpoint = Redacted.isRedacted(options.endpoint)\n ? Redacted.value(options.endpoint)\n : options.endpoint;\n\n const timeout = options.connectTimeoutMillis ?? 30_000;\n const connector = options.connect ?? defaultConnect;\n const headers = options.headers === undefined ? undefined : { ...options.headers };\n\n const invalid = (detail: string) =>\n undispatched(\"connect\", new Errors.InvalidRequest({ detail }));\n\n if (!Number.isFinite(timeout) || timeout <= 0)\n return yield* invalid(\"connectTimeoutMillis must be finite and greater than zero\");\n if (connector === undefined)\n return yield* invalid(\"This runtime requires a CDP connect callback\");\n\n // Inspect before URL normalization or truncation. Withhold an echoed diagnostic entirely so\n // overlapping header values cannot leave fragments; other URLs keep only their scheme and host.\n const redact = (message: string) => {\n if (Object.values(headers ?? {}).some((value) => value !== \"\" && message.includes(value)))\n return \"CDP diagnostic withheld\";\n\n const origins = message.replace(Url.quoted, (url) => {\n const parsed = URL.parse(url);\n\n return parsed?.host ? `${parsed.protocol}//${parsed.host}` : \"<url>\";\n });\n\n return endpoint === \"\" ? origins : origins.replaceAll(endpoint, \"<endpoint>\");\n };\n\n const failed = (cause: unknown, timeoutMillis?: number) =>\n undispatched(\"connect\", reasonOf(cause, timeoutMillis, \"connection\", redact));\n\n // The endpoint is often a credential, so the connect span names no part of it.\n const connected = yield* Effect.acquireRelease(\n Effect.tryPromise({\n try: (signal) =>\n connector(endpoint, {\n timeout,\n signal,\n ...(headers === undefined ? {} : { headers: { ...headers } }),\n }).then(async (browser) => {\n // Cancellation can precede a connector that ignores its signal. Its late browser still\n // belongs to this acquisition, so disconnect it before dropping the promise result.\n if (signal.aborted) await browser.close().catch(() => undefined);\n\n return browser;\n }),\n catch: (cause) => failed(cause, timeout),\n }).pipe(\n Effect.timeoutOrElse({\n duration: timeout,\n orElse: () =>\n Effect.fail(undispatched(\"connect\", new Errors.Timeout({ millis: timeout }))),\n }),\n Effect.withSpan(\"Cdp.connect\", {}, { captureStackTrace: false }),\n ),\n (browser) => Effect.tryPromise(() => browser.close()).pipe(Effect.ignore),\n { interruptible: true },\n );\n\n const context =\n connected.contexts()[0] ??\n (yield* Effect.tryPromise({\n try: () => connected.newContext(),\n catch: (cause) => failed(cause),\n }));\n\n const { id = \"cdp\", provider = \"cdp\", expiresAt, capture } = options;\n\n return yield* Browser.make(context, { id, provider, expiresAt, capture }, options);\n });\n\n const layer = (options: Options): Layer.Layer<Browser.Browser, Errors.BrowserError> =>\n Layer.effect(Browser.Browser, open(options));\n\n return { open, layer };\n};\n"],"mappings":";;;;;;;;;;;;;;AAqDA,MAAa,QAAQ,mBAA+B;CAClD,MAAM,OAAO,OAAO,GAAG,UAAU,CAAC,CAAC,WAAW,SAAkB;EAC9D,MAAM,WAAW,SAAS,WAAW,QAAQ,QAAQ,IACjD,SAAS,MAAM,QAAQ,QAAQ,IAC/B,QAAQ;EAEZ,MAAM,UAAU,QAAQ,wBAAwB;EAChD,MAAM,YAAY,QAAQ,WAAW;EACrC,MAAM,UAAU,QAAQ,YAAY,KAAA,IAAY,KAAA,IAAY,EAAE,GAAG,QAAQ,QAAQ;EAEjF,MAAM,WAAW,WACf,aAAa,WAAW,IAAIA,eAAsB,EAAE,OAAO,CAAC,CAAC;EAE/D,IAAI,CAAC,OAAO,SAAS,OAAO,KAAK,WAAW,GAC1C,OAAO,OAAO,QAAQ,2DAA2D;EACnF,IAAI,cAAc,KAAA,GAChB,OAAO,OAAO,QAAQ,8CAA8C;EAItE,MAAM,UAAU,YAAoB;GAClC,IAAI,OAAO,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,UAAU,UAAU,MAAM,QAAQ,SAAS,KAAK,CAAC,GACtF,OAAO;GAET,MAAM,UAAU,QAAQ,QAAQC,SAAa,QAAQ;IACnD,MAAM,SAAS,IAAI,MAAM,GAAG;IAE5B,OAAO,QAAQ,OAAO,GAAG,OAAO,SAAS,IAAI,OAAO,SAAS;GAC/D,CAAC;GAED,OAAO,aAAa,KAAK,UAAU,QAAQ,WAAW,UAAU,YAAY;EAC9E;EAEA,MAAM,UAAU,OAAgB,kBAC9B,aAAa,WAAW,SAAS,OAAO,eAAe,cAAc,MAAM,CAAC;EAG9E,MAAM,YAAY,OAAO,OAAO,eAC9B,OAAO,WAAW;GAChB,MAAM,WACJ,UAAU,UAAU;IAClB;IACA;IACA,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE;GAC7D,CAAC,CAAC,CAAC,KAAK,OAAO,YAAY;IAGzB,IAAI,OAAO,SAAS,MAAM,QAAQ,MAAM,CAAC,CAAC,YAAY,KAAA,CAAS;IAE/D,OAAO;GACT,CAAC;GACH,QAAQ,UAAU,OAAO,OAAO,OAAO;EACzC,CAAC,CAAC,CAAC,KACD,OAAO,cAAc;GACnB,UAAU;GACV,cACE,OAAO,KAAK,aAAa,WAAW,IAAIC,QAAe,EAAE,QAAQ,QAAQ,CAAC,CAAC,CAAC;EAChF,CAAC,GACD,OAAO,SAAS,eAAe,CAAC,GAAG,EAAE,mBAAmB,MAAM,CAAC,CACjE,IACC,YAAY,OAAO,iBAAiB,QAAQ,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,GACxE,EAAE,eAAe,KAAK,CACxB;EAEA,MAAM,UACJ,UAAU,SAAS,CAAC,CAAC,OACpB,OAAO,OAAO,WAAW;GACxB,WAAW,UAAU,WAAW;GAChC,QAAQ,UAAU,OAAO,KAAK;EAChC,CAAC;EAEH,MAAM,EAAE,KAAK,OAAO,WAAW,OAAO,WAAW,YAAY;EAE7D,OAAO,OAAOC,OAAa,SAAS;GAAE;GAAI;GAAU;GAAW;EAAQ,GAAG,OAAO;CACnF,CAAC;CAED,MAAM,SAAS,YACb,MAAM,OAAOC,SAAiB,KAAK,OAAO,CAAC;CAE7C,OAAO;EAAE;EAAM;CAAM;AACvB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { i as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { n as
|
|
9
|
-
import {
|
|
10
|
-
import { t as
|
|
11
|
-
import { n as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import { l as Supervisor_d_exports } from "./Supervisor-CfRxbaso.mjs";
|
|
17
|
-
import "./workerd/index.mjs";
|
|
18
|
-
export { Browser_d_exports as Browser, BrowserError_d_exports as BrowserError, BrowserEvent_d_exports as BrowserEvent, Cdp_d_exports as Cdp, Change_d_exports as Change, Chromium_d_exports as Chromium, Expect_d_exports as Expect, Frame_d_exports as Frame, Moment_d_exports as Moment, Motion_d_exports as Motion, Page_d_exports as Page, Plan_d_exports as Plan, Policy_d_exports as Policy, Presentation_d_exports as Presentation, Snapshot_d_exports as Snapshot, Stage_d_exports as Stage, Supervisor_d_exports as Supervisor };
|
|
1
|
+
import { n as Action_d_exports } from "./Action-24sLOubi.mjs";
|
|
2
|
+
import { n as BrowserError_d_exports } from "./BrowserError-BlcmLVzn.mjs";
|
|
3
|
+
import { i as BrowserEvent_d_exports } from "./BrowserEvent-lLqJ3GJS.mjs";
|
|
4
|
+
import { n as Change_d_exports } from "./Change-Ba7INmay.mjs";
|
|
5
|
+
import { i as Frame_d_exports } from "./Frame-UEH2hO5T.mjs";
|
|
6
|
+
import { t as Geometry_d_exports } from "./Geometry-DJx9qrYy.mjs";
|
|
7
|
+
import { i as Snapshot_d_exports } from "./Snapshot-CtBVOtuu.mjs";
|
|
8
|
+
import { n as Window_d_exports } from "./Window-CMddGMt1.mjs";
|
|
9
|
+
import { p as Page_d_exports } from "./Page-CvsOEorc.mjs";
|
|
10
|
+
import { t as ActionPort_d_exports } from "./ActionPort.mjs";
|
|
11
|
+
import { n as Browser_d_exports } from "./Browser-wZhwZSlG.mjs";
|
|
12
|
+
import { t as Clock_d_exports } from "./Clock.mjs";
|
|
13
|
+
import { t as Style_d_exports } from "./Style.mjs";
|
|
14
|
+
import { t as Url_d_exports } from "./Url.mjs";
|
|
15
|
+
export { Action_d_exports as Action, ActionPort_d_exports as ActionPort, Browser_d_exports as Browser, BrowserError_d_exports as BrowserError, BrowserEvent_d_exports as BrowserEvent, Change_d_exports as Change, Clock_d_exports as Clock, Frame_d_exports as Frame, Geometry_d_exports as Geometry, Page_d_exports as Page, Snapshot_d_exports as Snapshot, Style_d_exports as Style, Url_d_exports as Url, Window_d_exports as Window };
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as Geometry_exports } from "./Geometry.mjs";
|
|
2
|
+
import { t as Url_exports } from "./Url.mjs";
|
|
3
|
+
import { t as Action_exports } from "./Action.mjs";
|
|
2
4
|
import { t as BrowserEvent_exports } from "./BrowserEvent.mjs";
|
|
3
5
|
import { t as BrowserError_exports } from "./BrowserError.mjs";
|
|
4
|
-
import { n as Browser_exports } from "./Browser-CxXUjxOp.mjs";
|
|
5
6
|
import { t as Frame_exports } from "./Frame.mjs";
|
|
6
|
-
import { a as Page_exports } from "./Page-
|
|
7
|
+
import { a as Page_exports } from "./Page-BF5izr8R.mjs";
|
|
7
8
|
import { t as Snapshot_exports } from "./Snapshot.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
|
|
15
|
-
import { t as Presentation_exports } from "./Presentation.mjs";
|
|
16
|
-
import { t as Stage_exports } from "./Stage.mjs";
|
|
17
|
-
import { i as Supervisor_exports } from "./Supervisor-2mPjIYYs.mjs";
|
|
18
|
-
import "./workerd/index.mjs";
|
|
19
|
-
export { Browser_exports as Browser, BrowserError_exports as BrowserError, BrowserEvent_exports as BrowserEvent, Cdp_exports as Cdp, Change_exports as Change, Chromium_exports as Chromium, Expect_exports as Expect, Frame_exports as Frame, Moment_exports as Moment, Motion_exports as Motion, Page_exports as Page, Plan_exports as Plan, Policy_exports as Policy, Presentation_exports as Presentation, Snapshot_exports as Snapshot, Stage_exports as Stage, Supervisor_exports as Supervisor };
|
|
9
|
+
import { t as ActionPort_exports } from "./ActionPort.mjs";
|
|
10
|
+
import { t as Clock_exports } from "./Clock.mjs";
|
|
11
|
+
import { n as Browser_exports } from "./Browser-BKPAbyys.mjs";
|
|
12
|
+
import { n as Style_exports } from "./Style-AO4V7Czt.mjs";
|
|
13
|
+
import { t as Change_exports } from "./Change.mjs";
|
|
14
|
+
import { t as Window_exports } from "./Window.mjs";
|
|
15
|
+
export { Action_exports as Action, ActionPort_exports as ActionPort, Browser_exports as Browser, BrowserError_exports as BrowserError, BrowserEvent_exports as BrowserEvent, Change_exports as Change, Clock_exports as Clock, Frame_exports as Frame, Geometry_exports as Geometry, Page_exports as Page, Snapshot_exports as Snapshot, Style_exports as Style, Url_exports as Url, Window_exports as Window };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { t as BrowserError } from "../BrowserError-BlcmLVzn.mjs";
|
|
2
|
+
import { E as WheelScrolled, S as TextInserted, T as TrackPlanned, a as CursorChanged, c as Disconnected, d as PageClosed, f as PageLoaded, g as PointerReleased, h as PointerPressed, l as KeyChanged, m as PageUntracked, o as DialogShown, p as PageOpened, t as Action, u as Navigated, v as RequestRefused, w as TrackPerformed, y as SessionEnding } from "../BrowserEvent-lLqJ3GJS.mjs";
|
|
3
|
+
import { r as Changes, t as Change } from "../Change-Ba7INmay.mjs";
|
|
4
|
+
import { r as Frame } from "../Frame-UEH2hO5T.mjs";
|
|
5
|
+
import { n as Snapshot, r as SnapshotOptions } from "../Snapshot-CtBVOtuu.mjs";
|
|
6
|
+
import { t as Window } from "../Window-CMddGMt1.mjs";
|
|
7
|
+
import { f as Page, k as WindowOptions, p as Page_d_exports } from "../Page-CvsOEorc.mjs";
|
|
8
|
+
import { Effect, Schema } from "effect";
|
|
9
|
+
import { Prompt } from "effect/ai";
|
|
10
|
+
//#region src/moment/words.d.ts
|
|
11
|
+
/** A change in words, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
|
|
12
|
+
declare const describe: (change: Change, grouped?: boolean) => string;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/moment/Moment.d.ts
|
|
15
|
+
declare const Moment_base: Schema.Class<Moment, Schema.Struct<{
|
|
16
|
+
readonly page: Schema.String;
|
|
17
|
+
readonly since: Schema.Finite;
|
|
18
|
+
readonly until: Schema.Finite;
|
|
19
|
+
readonly events: Schema.$Array<Schema.Union<readonly [typeof RequestRefused, typeof PageOpened, typeof PageClosed, typeof PageUntracked, typeof Navigated, typeof PageLoaded, typeof Action, typeof TrackPlanned, typeof TrackPerformed, typeof PointerPressed, typeof PointerReleased, typeof WheelScrolled, typeof KeyChanged, typeof TextInserted, typeof CursorChanged, typeof DialogShown, typeof Disconnected, typeof SessionEnding]>>;
|
|
20
|
+
readonly changes: Schema.optional<typeof Changes>;
|
|
21
|
+
readonly frames: Schema.$Array<typeof Frame>;
|
|
22
|
+
readonly missing: Schema.$Array<typeof BrowserError>;
|
|
23
|
+
snapshot: Schema.optional<typeof Snapshot>;
|
|
24
|
+
}>, Window> & Pick<{}, never>;
|
|
25
|
+
/**
|
|
26
|
+
* A window that ends at a picture of the page, its last frame, unless `missing` says why it has
|
|
27
|
+
* none. Its frames are a few, spread over the window, so that it still begins where it starts.
|
|
28
|
+
*/
|
|
29
|
+
export declare class Moment extends Moment_base {}
|
|
30
|
+
export interface CaptureOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Where the window starts, as for `Page.window`: a previous window or moment, so that consecutive
|
|
33
|
+
* ones neither repeat nor miss an event or a change, or a `Duration` back from the picture.
|
|
34
|
+
* Defaults to 5 seconds.
|
|
35
|
+
*/
|
|
36
|
+
readonly since?: WindowOptions["since"] | undefined;
|
|
37
|
+
/** Frames to keep, at least 1, spread over the window and ending with the picture. Defaults to 2. */
|
|
38
|
+
readonly frames?: number | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Whether to take the page's outline at the end, or its options; `true` means 4,000 characters.
|
|
41
|
+
* Defaults to `false`: the frames and the timeline carry most moments, while an outline costs a
|
|
42
|
+
* round trip to the page and can double a moment's tokens.
|
|
43
|
+
*/
|
|
44
|
+
readonly snapshot?: SnapshotOptions | boolean | undefined;
|
|
45
|
+
/** Show what fields hold in the moment's changes; a secret field still reads `••••`. */
|
|
46
|
+
readonly unmask?: boolean | undefined;
|
|
47
|
+
}
|
|
48
|
+
export declare const capture: (page: Page, options?: CaptureOptions | undefined) => Effect.Effect<Moment, BrowserError, never>;
|
|
49
|
+
/** What a window says of its page at its end: what was still in flux, and what had settled. */
|
|
50
|
+
export interface Account {
|
|
51
|
+
/**
|
|
52
|
+
* How long, in milliseconds, the page had been still at the end: since the last change in view
|
|
53
|
+
* its record shows, or the last paint its screencast frames show, or else since the window, or
|
|
54
|
+
* its record, began. Undefined where neither could tell, with no record of the window and no
|
|
55
|
+
* painted frame: a screenshot shows the page, not when it last changed. Frames show paint only
|
|
56
|
+
* while a capture runs, and the record does not see a canvas, so a canvas that keeps drawing
|
|
57
|
+
* with no capture running reads as still.
|
|
58
|
+
*/
|
|
59
|
+
readonly stillFor: number | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The changes still under way at the end: what kept changing, more than once in the window or
|
|
62
|
+
* already before it, and changed again within twice its own pace before the end.
|
|
63
|
+
*/
|
|
64
|
+
readonly changing: ReadonlyArray<Change>;
|
|
65
|
+
/** Every other change, which shows what it settled at. */
|
|
66
|
+
readonly settled: ReadonlyArray<Change>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* An account of the window's page at its end: how long it had been still, and which of its
|
|
70
|
+
* changes were still under way and which had settled. A window whose record saw none of it has
|
|
71
|
+
* neither.
|
|
72
|
+
*/
|
|
73
|
+
export declare const account: (window: Window) => Account;
|
|
74
|
+
/**
|
|
75
|
+
* The moment as one user message: the page's outline when the moment has one, what changed, most
|
|
76
|
+
* notable first, what kept changing told as still changing at the moment or settled since when, by
|
|
77
|
+
* its account, with the actions that the changes followed, that changes followed though none
|
|
78
|
+
* names them, or that drew what only the screenshots show, what could not be read and why, and its
|
|
79
|
+
* frames captioned with their times, the last one "the moment" where it is the picture at its end.
|
|
80
|
+
* Give a model its task with `Prompt.setSystem`, and add what the caller knows about the page as
|
|
81
|
+
* more text.
|
|
82
|
+
*/
|
|
83
|
+
export declare const toPrompt: (moment: Moment) => Prompt.Prompt;
|
|
84
|
+
//#endregion
|
|
85
|
+
export { Window, describe as describeChange };
|
|
86
|
+
//# sourceMappingURL=Moment.d.mts.map
|
|
@@ -1,13 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { s as refuse } from "./context-EGhOqjNN.mjs";
|
|
5
|
-
import { Frame } from "./Frame.mjs";
|
|
6
|
-
import { Snapshot } from "./Snapshot.mjs";
|
|
7
|
-
import { c as quoted, l as where, o as describe, r as Changes, s as named } from "./Change-DNvztNLu.mjs";
|
|
1
|
+
import { refuse } from "../BrowserError.mjs";
|
|
2
|
+
import { Snapshot } from "../Snapshot.mjs";
|
|
3
|
+
import { Window } from "../Window.mjs";
|
|
8
4
|
import { Duration, Effect, Option, Result, Schema } from "effect";
|
|
9
5
|
import { Prompt } from "effect/ai";
|
|
10
|
-
//#region src/
|
|
6
|
+
//#region src/moment/words.ts
|
|
7
|
+
const quoted = (value) => JSON.stringify(value ?? "");
|
|
8
|
+
/** A subject in words, such as `button "Play"`; one without a name says where it was. */
|
|
9
|
+
const named = (subject, point) => {
|
|
10
|
+
const kind = subject.role ?? subject.tag;
|
|
11
|
+
if (subject.name !== "") return `${kind} ${JSON.stringify(subject.name)}`;
|
|
12
|
+
return point === void 0 ? kind : `${kind} at ${point}`;
|
|
13
|
+
};
|
|
14
|
+
/** A change's context in words: `row "Ether", column "1h"` or `beside "Price", under "Bitcoin"`. */
|
|
15
|
+
const where = ({ row, column, label, heading }, grouped = false) => {
|
|
16
|
+
const parts = [
|
|
17
|
+
row === void 0 ? "" : `row ${quoted(row)}`,
|
|
18
|
+
column === void 0 || grouped ? "" : `column ${quoted(column)}`,
|
|
19
|
+
label === void 0 ? "" : `beside ${quoted(label)}`,
|
|
20
|
+
heading === void 0 || grouped ? "" : `under ${quoted(heading)}`
|
|
21
|
+
].filter((part) => part !== "");
|
|
22
|
+
return parts.length === 0 ? "" : ` (${parts.join(", ")})`;
|
|
23
|
+
};
|
|
24
|
+
/** A change in words, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
|
|
25
|
+
const describe = (change, grouped = false) => {
|
|
26
|
+
const { subject, before, after, count, lowest, highest } = change;
|
|
27
|
+
const context = where(subject.context, grouped);
|
|
28
|
+
const range = lowest === void 0 || highest === void 0 ? "" : `, from ${lowest} to ${highest}`;
|
|
29
|
+
const times = count > 1 ? ` (it changed ${count} times${range})` : "";
|
|
30
|
+
switch (change.kind) {
|
|
31
|
+
case "title": return `the title ${before === void 0 ? "now reads" : `${quoted(before)} became`} ${quoted(after)}`;
|
|
32
|
+
case "value": {
|
|
33
|
+
const field = named(subject, void 0);
|
|
34
|
+
if (after === "checked" || after === "not checked") return `${field} is now ${after}`;
|
|
35
|
+
if (after === void 0 || after === "") return `${field} was cleared`;
|
|
36
|
+
return after === "••••" || before === void 0 || before === "" ? `${field} was ${after === "••••" ? "edited" : `set to ${quoted(after)}`}` : `${field} changed from ${quoted(before)} to ${quoted(after)}`;
|
|
37
|
+
}
|
|
38
|
+
case "appeared": return `${quoted(after)} appeared${context}`;
|
|
39
|
+
case "disappeared": return `${quoted(before)} disappeared${context}`;
|
|
40
|
+
case "brief": return `${quoted(after)} appeared and went away again${context}`;
|
|
41
|
+
case "text": return before === void 0 ? `now reads ${quoted(after)}${context}${times}` : `${quoted(before)} became ${quoted(after)}${context}${times}`;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/moment/Moment.ts
|
|
11
46
|
/**
|
|
12
47
|
* What a page showed, and what changed on it, over a window of time.
|
|
13
48
|
*
|
|
@@ -34,35 +69,6 @@ import { Prompt } from "effect/ai";
|
|
|
34
69
|
*
|
|
35
70
|
* @since 0.3.0
|
|
36
71
|
*/
|
|
37
|
-
var Moment_exports = /* @__PURE__ */ __exportAll({
|
|
38
|
-
Moment: () => Moment,
|
|
39
|
-
Window: () => Window,
|
|
40
|
-
account: () => account,
|
|
41
|
-
capture: () => capture,
|
|
42
|
-
toPrompt: () => toPrompt
|
|
43
|
-
});
|
|
44
|
-
/** A page's events, changes and frames over one window of its browser's host clock. */
|
|
45
|
-
var Window = class extends Schema.Class("effect-browser/Window")({
|
|
46
|
-
page: Schema.String,
|
|
47
|
-
/** Where the window starts, in host monotonic milliseconds on the owning browser’s clock. */
|
|
48
|
-
since: Schema.Finite,
|
|
49
|
-
/** Where it ends, never after it was taken. */
|
|
50
|
-
until: Schema.Finite,
|
|
51
|
-
/** The page's events after `since`, up to `until`, oldest first, without the input presentation track. */
|
|
52
|
-
events: Schema.Array(BrowserEvent),
|
|
53
|
-
/**
|
|
54
|
-
* What visibly changed after `since`, up to `until`; absent where `missing` says why. A page's
|
|
55
|
-
* first window starts its record, so the record sees none of it.
|
|
56
|
-
*/
|
|
57
|
-
changes: Schema.optional(Changes),
|
|
58
|
-
/** Screencast frames painted from `since` to `until`, oldest first, as far back as kept. */
|
|
59
|
-
frames: Schema.Array(Frame),
|
|
60
|
-
/**
|
|
61
|
-
* Why each part that could not be read is missing: the read of its changes, by whatever
|
|
62
|
-
* operation failed there, or a moment's picture (`frame`) or outline (`snapshot`).
|
|
63
|
-
*/
|
|
64
|
-
missing: Schema.Array(BrowserError)
|
|
65
|
-
}) {};
|
|
66
72
|
/**
|
|
67
73
|
* A window that ends at a picture of the page, its last frame, unless `missing` says why it has
|
|
68
74
|
* none. Its frames are a few, spread over the window, so that it still begins where it starts.
|
|
@@ -287,6 +293,6 @@ const toPrompt = (moment) => {
|
|
|
287
293
|
})])] })]);
|
|
288
294
|
};
|
|
289
295
|
//#endregion
|
|
290
|
-
export { Moment, Window, account, capture,
|
|
296
|
+
export { Moment, Window, account, capture, describe as describeChange, toPrompt };
|
|
291
297
|
|
|
292
298
|
//# sourceMappingURL=Moment.mjs.map
|