effect-browser 0.0.0-reserved.0 → 0.2.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +804 -3
  3. package/dist/Association-BsSfBYVx.mjs +138 -0
  4. package/dist/Association-BsSfBYVx.mjs.map +1 -0
  5. package/dist/Bootstrap-B9UUXsvF.d.mts +183 -0
  6. package/dist/Bootstrap-CeQOWBy6.mjs +189 -0
  7. package/dist/Bootstrap-CeQOWBy6.mjs.map +1 -0
  8. package/dist/Bootstrap.d.mts +3 -0
  9. package/dist/Bootstrap.mjs +2 -0
  10. package/dist/Browser.d.mts +189 -0
  11. package/dist/Browser.mjs +14 -0
  12. package/dist/Browser.mjs.map +1 -0
  13. package/dist/BrowserData-CRuxEZcn.d.mts +492 -0
  14. package/dist/BrowserData.d.mts +3 -0
  15. package/dist/BrowserData.mjs +572 -0
  16. package/dist/BrowserData.mjs.map +1 -0
  17. package/dist/BrowserRuntime-Coz-5DYb.d.mts +143 -0
  18. package/dist/BrowserRuntime-DViKNUdD.mjs +5782 -0
  19. package/dist/BrowserRuntime-DViKNUdD.mjs.map +1 -0
  20. package/dist/BrowserRuntime.d.mts +3 -0
  21. package/dist/BrowserRuntime.mjs +2 -0
  22. package/dist/Capture.d.mts +54 -0
  23. package/dist/Capture.mjs +512 -0
  24. package/dist/Capture.mjs.map +1 -0
  25. package/dist/CaptureData-B5-mXlyq.mjs +180 -0
  26. package/dist/CaptureData-B5-mXlyq.mjs.map +1 -0
  27. package/dist/CaptureData.d.mts +157 -0
  28. package/dist/CaptureData.mjs +2 -0
  29. package/dist/Chromium.d.mts +85 -0
  30. package/dist/Chromium.mjs +387 -0
  31. package/dist/Chromium.mjs.map +1 -0
  32. package/dist/Errors.d.mts +106 -0
  33. package/dist/Errors.mjs +156 -0
  34. package/dist/Errors.mjs.map +1 -0
  35. package/dist/PageControl.d.mts +15 -0
  36. package/dist/PageControl.mjs +28 -0
  37. package/dist/PageControl.mjs.map +1 -0
  38. package/dist/PageControlAssociation-DabEg5AR.mjs +10 -0
  39. package/dist/PageControlAssociation-DabEg5AR.mjs.map +1 -0
  40. package/dist/Testing.d.mts +437 -0
  41. package/dist/Testing.mjs +1561 -0
  42. package/dist/Testing.mjs.map +1 -0
  43. package/dist/index.d.mts +10 -0
  44. package/dist/index.mjs +9 -0
  45. package/package.json +71 -5
@@ -0,0 +1,189 @@
1
+ import { f as Plan, g as ReadinessOutcome, s as Bootstrap_d_exports, t as BindingDiagnostics } from "./Bootstrap-B9UUXsvF.mjs";
2
+ import { BrowserError, InitializationError } from "./Errors.mjs";
3
+ import { $ as TypeRequest, D as NavigationResult, E as NavigateRequest, F as PointerMoveRequest, H as ScreenshotResult, J as SessionStatus, L as PressRequest, N as PageInfo, O as Observation, Q as TextResult, R as ReadTextRequest, S as InputReceipt, U as ScrollRequest, V as ScreenshotRequest, W as SelectOptions, X as Target, Y as StartNavigationRequest, _ as FrameInfo, at as WheelRequest, c as ClickRequest, d as FillFormRequest, et as Viewport, f as FillFormResult, i as BrowserDiagnostics, it as WaitForElementRequest, j as ObservedElement, k as ObservationOptions, l as ControlFacts, o as Checkpoint, p as FillRequest, s as CheckpointOptions, t as ActionResult, u as FillFormOptions, v as HoverRequest, w as KeyStroke } from "./BrowserData-CRuxEZcn.mjs";
4
+ import { Effect, Scope } from "effect";
5
+ //#region src/Browser.d.ts
6
+ /**
7
+ * A host's decision about one control, made on facts read from the exact node immediately
8
+ * before input. Returning anything but `true`, or throwing, sends nothing and fails `denied`.
9
+ * It is a plain synchronous function on purpose: it runs while the owner's permit is held, where
10
+ * waiting on a model or a network call would stall every other operation. It is not an atomic
11
+ * check-and-input transaction, because page script can still run before the native input lands.
12
+ */
13
+ export interface ElementAdmission {
14
+ readonly admit: (facts: ControlFacts) => boolean;
15
+ }
16
+ /**
17
+ * A navigation the browser is still performing. The owner's permit was released when it was
18
+ * dispatched, so while it loads a host may read, `checkpoint`, hold and resume this page, and
19
+ * use any other page. Anything that would change this page fails `busy` until it settles.
20
+ *
21
+ * Leaving its scope unsettled fences the session, exactly as an interrupted mutation does,
22
+ * because nothing then knows what the browser did. It is never replayed.
23
+ */
24
+ export interface NavigationOperation {
25
+ /** What was navigated, read before dispatch. */
26
+ readonly target: Target;
27
+ /**
28
+ * The document reached DOMContentLoaded. It belongs to this one navigation: a successor that
29
+ * reaches the same URL fails it instead. Interrupting a waiter stops nothing in the browser.
30
+ */
31
+ readonly completed: Effect.Effect<NavigationResult, BrowserError>;
32
+ /**
33
+ * Asks the browser to stop loading and waits for this navigation to settle, after which
34
+ * `completed` fails `interrupted`. Success is a known outcome and the session stays usable:
35
+ * the page holds whatever had loaded. It does not undo anything the page already did.
36
+ * An already-completed navigation cannot stop a successor. Concurrent callers share their
37
+ * active attempt. Before dispatch, cancellation or a busy refusal permits a later request
38
+ * once native setup has retired. A dispatched attempt's outcome, including failure or
39
+ * interruption, is retained permanently; an uncertain stop is never replayed.
40
+ */
41
+ readonly stop: Effect.Effect<void, BrowserError>;
42
+ }
43
+ /** Common operations. Direct, retained and pinned views choose their target at different times. */
44
+ export interface TargetOperations {
45
+ readonly navigate: (request: NavigateRequest) => Effect.Effect<NavigationResult, BrowserError>;
46
+ /** `navigate`, left in flight: the same single dispatch, completed by the caller. */
47
+ readonly startNavigation: (request: StartNavigationRequest) => Effect.Effect<NavigationOperation, BrowserError, Scope.Scope>;
48
+ readonly readText: (request: ReadTextRequest) => Effect.Effect<TextResult, BrowserError>;
49
+ readonly click: (request: ClickRequest) => Effect.Effect<ActionResult, BrowserError>;
50
+ readonly fill: (request: FillRequest) => Effect.Effect<ActionResult, BrowserError>;
51
+ /** Script in the page: instantaneous, and it raises no wheel event. */
52
+ readonly scroll: (request: ScrollRequest) => Effect.Effect<ActionResult, BrowserError>;
53
+ /** One real pointer move, in main-frame viewport pixels. */
54
+ readonly pointerMove: (request: PointerMoveRequest) => Effect.Effect<InputReceipt, BrowserError>;
55
+ /** Places the pointer on one exact element where it is, or fails `not-visible` unsent. */
56
+ readonly hover: (request: HoverRequest) => Effect.Effect<InputReceipt, BrowserError>;
57
+ /** One real wheel event; the browser decides what under the pointer scrolls. */
58
+ readonly wheel: (request: WheelRequest) => Effect.Effect<InputReceipt, BrowserError>;
59
+ /** One real key stroke to whatever has focus, or fails `not-focused` unsent if `into` lacks it. */
60
+ readonly press: (request: PressRequest) => Effect.Effect<InputReceipt, BrowserError>;
61
+ /** Text as the real key strokes that produce it, under the same focus rule as `press`. */
62
+ readonly type: (request: TypeRequest) => Effect.Effect<InputReceipt, BrowserError>;
63
+ readonly screenshot: (request: ScreenshotRequest) => Effect.Effect<ScreenshotResult, BrowserError>;
64
+ }
65
+ /**
66
+ * One explicit page/frame target. Selection may move independently; each operation re-resolves
67
+ * this identity inside the same owner and connection. Closing/detaching it or reconnecting makes
68
+ * the handle stale before dispatch.
69
+ */
70
+ export interface PinnedTarget extends TargetOperations {
71
+ readonly target: Target;
72
+ }
73
+ /** A checked selection retained at acquisition; moving selection away and back makes it stale. */
74
+ export interface RetainedTarget extends TargetOperations {}
75
+ /**
76
+ * Host control over one owned browser. This is not a serializable model value: copying a
77
+ * session object cannot copy its capture, page-control or connection authority.
78
+ *
79
+ * The inherited target operations resolve the selected page/frame when their Effect executes.
80
+ * Use `retain` to retain the current selection with stale-on-selection-change semantics, or
81
+ * `pinPage` / `pinFrame` when work must stay on an explicit target while selection moves.
82
+ */
83
+ export interface BrowserSession<E = never> extends TargetOperations {
84
+ /** The implementation which owns this live connection. */
85
+ readonly implementation: string;
86
+ /** Copied host-only state, readable without admission in every lifecycle phase. */
87
+ readonly status: Effect.Effect<SessionStatus>;
88
+ /** Bounded native/policy diagnostics. Typed callback causes remain in bindingDiagnostics. */
89
+ readonly diagnostics: Effect.Effect<BrowserDiagnostics>;
90
+ /** Close this scope and require its own ownership-specific cleanup evidence. */
91
+ readonly closeChecked: Effect.Effect<void, BrowserError>;
92
+ /** First fail-session callback cause, preserving the consumer's error type on the host. */
93
+ readonly failure: Effect.Effect<never, E | InitializationError>;
94
+ /** Bounded host-only evidence; consumer causes are never projected into a page reply. */
95
+ readonly bindingDiagnostics: Effect.Effect<BindingDiagnostics<E>>;
96
+ /** Resolve, validate and retain the selection under owner admission. */
97
+ readonly retain: Effect.Effect<RetainedTarget, BrowserError>;
98
+ readonly target: Effect.Effect<Target, BrowserError>;
99
+ /**
100
+ * The one observation whose nodes later actions may name. `scope: "viewport"` keeps only text
101
+ * and controls that are on screen and reachable, plus bounded choices of visible native
102
+ * selects; the default reads the whole document. It carries no destination, form or field value.
103
+ */
104
+ readonly observe: (options?: ObservationOptions) => Effect.Effect<Observation, BrowserError>;
105
+ /**
106
+ * Passive evidence for a recorder, with a picture when asked. It issues no references and
107
+ * leaves the observation above exactly as it was. Host-only: it carries control facts.
108
+ */
109
+ readonly checkpoint: (options?: CheckpointOptions) => Effect.Effect<Checkpoint, BrowserError>;
110
+ /** Host-only facts about one observed control, read from that exact node just now. */
111
+ readonly controlFacts: (reference: ObservedElement) => Effect.Effect<ControlFacts, BrowserError>;
112
+ /**
113
+ * After a page hold, nothing observed on that page may be acted on unchecked. This checks one
114
+ * reference: still attached, and still the control that was inspected. It never searches by
115
+ * selector or label for a substitute, and it sends nothing.
116
+ */
117
+ readonly revalidateElement: (reference: ObservedElement) => Effect.Effect<ObservedElement, BrowserError>;
118
+ readonly clickElement: (reference: ObservedElement, admission?: ElementAdmission) => Effect.Effect<ActionResult, BrowserError>;
119
+ readonly fillElement: (reference: ObservedElement, value: string, admission?: ElementAdmission) => Effect.Effect<ActionResult, BrowserError>;
120
+ /** One selection using this exact select and its issued option element IDs, with fresh checks. */
121
+ readonly selectOption: (reference: ObservedElement, options: SelectOptions, admission?: ElementAdmission) => Effect.Effect<ActionResult, BrowserError>;
122
+ readonly hoverElement: (reference: ObservedElement, admission?: ElementAdmission) => Effect.Effect<InputReceipt, BrowserError>;
123
+ /** A key stroke sent only if the exact node an observation named already has focus. */
124
+ readonly pressElement: (reference: ObservedElement, stroke: KeyStroke, admission?: ElementAdmission) => Effect.Effect<InputReceipt, BrowserError>;
125
+ /** Real typing with `fillElement`'s exactness: that node must already have focus. */
126
+ readonly typeElement: (reference: ObservedElement, text: string, admission?: ElementAdmission) => Effect.Effect<InputReceipt, BrowserError>;
127
+ /**
128
+ * Set several controls of one observation in order, then optionally click one submit control.
129
+ * Every step acts on the exact observed node after the same fresh checks as `fillElement`,
130
+ * except that a control may have become enabled since it was observed, and each is admitted
131
+ * and charged as its own action. The observation stays usable for this form's own steps only;
132
+ * anything else that changes the page still retires it, and the form retires it when it ends.
133
+ * The first refused or uncertain step ends the form. Submit is sent only after every field
134
+ * succeeded and, unless `verify` is false, still holds what its step left there. Fields set
135
+ * before a stop stay set. It fails only when its first step does; otherwise `stopped` says
136
+ * where it ended and why.
137
+ */
138
+ readonly fillForm: (request: FillFormRequest, admission?: ElementAdmission, options?: FillFormOptions) => Effect.Effect<FillFormResult, BrowserError>;
139
+ readonly pages: Effect.Effect<ReadonlyArray<PageInfo>, BrowserError>;
140
+ readonly frames: Effect.Effect<ReadonlyArray<FrameInfo>, BrowserError>;
141
+ /** List frames on one exact page without selecting it. */
142
+ readonly framesOf: (page: PageInfo) => Effect.Effect<ReadonlyArray<FrameInfo>, BrowserError>;
143
+ /** Pin the page's main frame without changing the session selection. */
144
+ readonly pinPage: (page: PageInfo) => Effect.Effect<PinnedTarget, BrowserError>;
145
+ /** Pin one frame that currently belongs to the exact page, without changing selection. */
146
+ readonly pinFrame: (page: PageInfo, frame: FrameInfo) => Effect.Effect<PinnedTarget, BrowserError>;
147
+ readonly selectPage: (page: PageInfo) => Effect.Effect<void, BrowserError>;
148
+ readonly selectFrame: (frameId: string) => Effect.Effect<void, BrowserError>;
149
+ /** Create a tab without selecting it and return that exact tab's checked identity. */
150
+ readonly createPage: Effect.Effect<PageInfo, BrowserError>;
151
+ readonly closePage: (page: PageInfo) => Effect.Effect<void, BrowserError>;
152
+ readonly resizeViewport: (viewport: Viewport) => Effect.Effect<void, BrowserError>;
153
+ /**
154
+ * Wait on the original observed node within the host deadline. Hidden includes its detachment;
155
+ * document replacement is stale. Success observes a condition, without authorizing later input.
156
+ */
157
+ readonly waitForElement: (request: WaitForElementRequest) => Effect.Effect<void, BrowserError>;
158
+ readonly waitFor: (request: {
159
+ readonly selector: string;
160
+ readonly state: "visible" | "hidden" | "attached" | "detached";
161
+ }) => Effect.Effect<void, BrowserError>;
162
+ /** Navigation observation is registered before the single click dispatch. */
163
+ readonly clickAndWait: (request: ClickRequest) => Effect.Effect<ActionResult, BrowserError>;
164
+ /**
165
+ * Readiness of the current document only. Dependent operations wait for it themselves;
166
+ * this reports it without charging an action, so a caller can decide what to do about a
167
+ * document that predates the registrations.
168
+ */
169
+ readonly ready: Effect.Effect<ReadinessOutcome, InitializationError>;
170
+ }
171
+ /** Helpers that do not supervise callback failures accept any live browser session. */
172
+ export type AnySession = BrowserSession<unknown>;
173
+ /** Dependencies are captured at acquisition, not erased into an environment-free service Layer. */
174
+ export interface OpenOptions<E = never, R = never> {
175
+ readonly bootstrap?: Plan<E, R>;
176
+ }
177
+ /**
178
+ * Acquire, supervise and close one browser in a fresh scope. The callback keeps the concrete
179
+ * Chromium or provider session type. Its scoped work is joined before checked browser cleanup,
180
+ * and cleanup failures remain typed even when the callback has already failed or was cancelled.
181
+ * Acquisition is evaluated once; an uncertain result is never retried.
182
+ */
183
+ export declare const scoped: {
184
+ <S extends BrowserSession<unknown>, A, E2, R2>(f: (session: S) => Effect.Effect<A, E2, R2>): <E, AE, AR>(open: Effect.Effect<S & BrowserSession<E>, AE, AR>) => Effect.Effect<A, AE | E | E2 | InitializationError | BrowserError, Exclude<AR | R2, Scope.Scope>>;
185
+ <S, E, AE, AR, A, E2, R2>(open: Effect.Effect<S & BrowserSession<E>, AE, AR>, f: (session: S & BrowserSession<E>) => Effect.Effect<A, E2, R2>): Effect.Effect<A, AE | E | E2 | InitializationError | BrowserError, Exclude<AR | R2, Scope.Scope>>;
186
+ };
187
+ //#endregion
188
+ export {};
189
+ //# sourceMappingURL=Browser.d.mts.map
@@ -0,0 +1,14 @@
1
+ import { Effect } from "effect";
2
+ import { dual } from "effect/Function";
3
+ //#region src/Browser.ts
4
+ /**
5
+ * Acquire, supervise and close one browser in a fresh scope. The callback keeps the concrete
6
+ * Chromium or provider session type. Its scoped work is joined before checked browser cleanup,
7
+ * and cleanup failures remain typed even when the callback has already failed or was cancelled.
8
+ * Acquisition is evaluated once; an uncertain result is never retried.
9
+ */
10
+ const scoped = dual(2, (open, f) => Effect.scoped(Effect.flatMap(open, (session) => Effect.scoped(Effect.raceFirst(session.failure, Effect.suspend(() => f(session)))).pipe(Effect.onExit(() => session.closeChecked)))));
11
+ //#endregion
12
+ export { scoped };
13
+
14
+ //# sourceMappingURL=Browser.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Browser.mjs","names":[],"sources":["../src/Browser.ts"],"sourcesContent":["import { Effect, type Scope } from \"effect\";\nimport { dual } from \"effect/Function\";\n\nimport type * as Bootstrap from \"./Bootstrap.ts\";\nimport type {\n BrowserDiagnostics,\n Checkpoint,\n CheckpointOptions,\n FillFormOptions,\n FillFormRequest,\n FillFormResult,\n FillRequest,\n HoverRequest,\n InputReceipt,\n KeyStroke,\n NavigateRequest,\n NavigationResult,\n ObservationOptions,\n ObservedElement,\n PointerMoveRequest,\n PressRequest,\n ReadTextRequest,\n ScreenshotRequest,\n ScreenshotResult,\n ScrollRequest,\n SelectOptions,\n SessionStatus,\n StartNavigationRequest,\n TextResult,\n TypeRequest,\n WaitForElementRequest,\n WheelRequest,\n ControlFacts,\n ActionResult,\n ClickRequest,\n FrameInfo,\n Observation,\n PageInfo,\n Target,\n Viewport,\n} from \"./BrowserData.ts\";\nimport type { BrowserError, InitializationError } from \"./Errors.ts\";\n\n/**\n * A host's decision about one control, made on facts read from the exact node immediately\n * before input. Returning anything but `true`, or throwing, sends nothing and fails `denied`.\n * It is a plain synchronous function on purpose: it runs while the owner's permit is held, where\n * waiting on a model or a network call would stall every other operation. It is not an atomic\n * check-and-input transaction, because page script can still run before the native input lands.\n */\nexport interface ElementAdmission {\n readonly admit: (facts: ControlFacts) => boolean;\n}\n\n/**\n * A navigation the browser is still performing. The owner's permit was released when it was\n * dispatched, so while it loads a host may read, `checkpoint`, hold and resume this page, and\n * use any other page. Anything that would change this page fails `busy` until it settles.\n *\n * Leaving its scope unsettled fences the session, exactly as an interrupted mutation does,\n * because nothing then knows what the browser did. It is never replayed.\n */\nexport interface NavigationOperation {\n /** What was navigated, read before dispatch. */\n readonly target: Target;\n /**\n * The document reached DOMContentLoaded. It belongs to this one navigation: a successor that\n * reaches the same URL fails it instead. Interrupting a waiter stops nothing in the browser.\n */\n readonly completed: Effect.Effect<NavigationResult, BrowserError>;\n /**\n * Asks the browser to stop loading and waits for this navigation to settle, after which\n * `completed` fails `interrupted`. Success is a known outcome and the session stays usable:\n * the page holds whatever had loaded. It does not undo anything the page already did.\n * An already-completed navigation cannot stop a successor. Concurrent callers share their\n * active attempt. Before dispatch, cancellation or a busy refusal permits a later request\n * once native setup has retired. A dispatched attempt's outcome, including failure or\n * interruption, is retained permanently; an uncertain stop is never replayed.\n */\n readonly stop: Effect.Effect<void, BrowserError>;\n}\n\n/** Common operations. Direct, retained and pinned views choose their target at different times. */\nexport interface TargetOperations {\n readonly navigate: (request: NavigateRequest) => Effect.Effect<NavigationResult, BrowserError>;\n /** `navigate`, left in flight: the same single dispatch, completed by the caller. */\n readonly startNavigation: (\n request: StartNavigationRequest,\n ) => Effect.Effect<NavigationOperation, BrowserError, Scope.Scope>;\n readonly readText: (request: ReadTextRequest) => Effect.Effect<TextResult, BrowserError>;\n readonly click: (request: ClickRequest) => Effect.Effect<ActionResult, BrowserError>;\n readonly fill: (request: FillRequest) => Effect.Effect<ActionResult, BrowserError>;\n /** Script in the page: instantaneous, and it raises no wheel event. */\n readonly scroll: (request: ScrollRequest) => Effect.Effect<ActionResult, BrowserError>;\n /** One real pointer move, in main-frame viewport pixels. */\n readonly pointerMove: (request: PointerMoveRequest) => Effect.Effect<InputReceipt, BrowserError>;\n /** Places the pointer on one exact element where it is, or fails `not-visible` unsent. */\n readonly hover: (request: HoverRequest) => Effect.Effect<InputReceipt, BrowserError>;\n /** One real wheel event; the browser decides what under the pointer scrolls. */\n readonly wheel: (request: WheelRequest) => Effect.Effect<InputReceipt, BrowserError>;\n /** One real key stroke to whatever has focus, or fails `not-focused` unsent if `into` lacks it. */\n readonly press: (request: PressRequest) => Effect.Effect<InputReceipt, BrowserError>;\n /** Text as the real key strokes that produce it, under the same focus rule as `press`. */\n readonly type: (request: TypeRequest) => Effect.Effect<InputReceipt, BrowserError>;\n readonly screenshot: (\n request: ScreenshotRequest,\n ) => Effect.Effect<ScreenshotResult, BrowserError>;\n}\n\n/**\n * One explicit page/frame target. Selection may move independently; each operation re-resolves\n * this identity inside the same owner and connection. Closing/detaching it or reconnecting makes\n * the handle stale before dispatch.\n */\nexport interface PinnedTarget extends TargetOperations {\n readonly target: Target;\n}\n\n/** A checked selection retained at acquisition; moving selection away and back makes it stale. */\nexport interface RetainedTarget extends TargetOperations {}\n\n/**\n * Host control over one owned browser. This is not a serializable model value: copying a\n * session object cannot copy its capture, page-control or connection authority.\n *\n * The inherited target operations resolve the selected page/frame when their Effect executes.\n * Use `retain` to retain the current selection with stale-on-selection-change semantics, or\n * `pinPage` / `pinFrame` when work must stay on an explicit target while selection moves.\n */\nexport interface BrowserSession<E = never> extends TargetOperations {\n /** The implementation which owns this live connection. */\n readonly implementation: string;\n /** Copied host-only state, readable without admission in every lifecycle phase. */\n readonly status: Effect.Effect<SessionStatus>;\n /** Bounded native/policy diagnostics. Typed callback causes remain in bindingDiagnostics. */\n readonly diagnostics: Effect.Effect<BrowserDiagnostics>;\n /** Close this scope and require its own ownership-specific cleanup evidence. */\n readonly closeChecked: Effect.Effect<void, BrowserError>;\n /** First fail-session callback cause, preserving the consumer's error type on the host. */\n readonly failure: Effect.Effect<never, E | InitializationError>;\n /** Bounded host-only evidence; consumer causes are never projected into a page reply. */\n readonly bindingDiagnostics: Effect.Effect<Bootstrap.BindingDiagnostics<E>>;\n /** Resolve, validate and retain the selection under owner admission. */\n readonly retain: Effect.Effect<RetainedTarget, BrowserError>;\n readonly target: Effect.Effect<Target, BrowserError>;\n /**\n * The one observation whose nodes later actions may name. `scope: \"viewport\"` keeps only text\n * and controls that are on screen and reachable, plus bounded choices of visible native\n * selects; the default reads the whole document. It carries no destination, form or field value.\n */\n readonly observe: (options?: ObservationOptions) => Effect.Effect<Observation, BrowserError>;\n /**\n * Passive evidence for a recorder, with a picture when asked. It issues no references and\n * leaves the observation above exactly as it was. Host-only: it carries control facts.\n */\n readonly checkpoint: (options?: CheckpointOptions) => Effect.Effect<Checkpoint, BrowserError>;\n /** Host-only facts about one observed control, read from that exact node just now. */\n readonly controlFacts: (reference: ObservedElement) => Effect.Effect<ControlFacts, BrowserError>;\n /**\n * After a page hold, nothing observed on that page may be acted on unchecked. This checks one\n * reference: still attached, and still the control that was inspected. It never searches by\n * selector or label for a substitute, and it sends nothing.\n */\n readonly revalidateElement: (\n reference: ObservedElement,\n ) => Effect.Effect<ObservedElement, BrowserError>;\n readonly clickElement: (\n reference: ObservedElement,\n admission?: ElementAdmission,\n ) => Effect.Effect<ActionResult, BrowserError>;\n readonly fillElement: (\n reference: ObservedElement,\n value: string,\n admission?: ElementAdmission,\n ) => Effect.Effect<ActionResult, BrowserError>;\n /** One selection using this exact select and its issued option element IDs, with fresh checks. */\n readonly selectOption: (\n reference: ObservedElement,\n options: SelectOptions,\n admission?: ElementAdmission,\n ) => Effect.Effect<ActionResult, BrowserError>;\n readonly hoverElement: (\n reference: ObservedElement,\n admission?: ElementAdmission,\n ) => Effect.Effect<InputReceipt, BrowserError>;\n /** A key stroke sent only if the exact node an observation named already has focus. */\n readonly pressElement: (\n reference: ObservedElement,\n stroke: KeyStroke,\n admission?: ElementAdmission,\n ) => Effect.Effect<InputReceipt, BrowserError>;\n /** Real typing with `fillElement`'s exactness: that node must already have focus. */\n readonly typeElement: (\n reference: ObservedElement,\n text: string,\n admission?: ElementAdmission,\n ) => Effect.Effect<InputReceipt, BrowserError>;\n /**\n * Set several controls of one observation in order, then optionally click one submit control.\n * Every step acts on the exact observed node after the same fresh checks as `fillElement`,\n * except that a control may have become enabled since it was observed, and each is admitted\n * and charged as its own action. The observation stays usable for this form's own steps only;\n * anything else that changes the page still retires it, and the form retires it when it ends.\n * The first refused or uncertain step ends the form. Submit is sent only after every field\n * succeeded and, unless `verify` is false, still holds what its step left there. Fields set\n * before a stop stay set. It fails only when its first step does; otherwise `stopped` says\n * where it ended and why.\n */\n readonly fillForm: (\n request: FillFormRequest,\n admission?: ElementAdmission,\n options?: FillFormOptions,\n ) => Effect.Effect<FillFormResult, BrowserError>;\n readonly pages: Effect.Effect<ReadonlyArray<PageInfo>, BrowserError>;\n readonly frames: Effect.Effect<ReadonlyArray<FrameInfo>, BrowserError>;\n /** List frames on one exact page without selecting it. */\n readonly framesOf: (page: PageInfo) => Effect.Effect<ReadonlyArray<FrameInfo>, BrowserError>;\n /** Pin the page's main frame without changing the session selection. */\n readonly pinPage: (page: PageInfo) => Effect.Effect<PinnedTarget, BrowserError>;\n /** Pin one frame that currently belongs to the exact page, without changing selection. */\n readonly pinFrame: (\n page: PageInfo,\n frame: FrameInfo,\n ) => Effect.Effect<PinnedTarget, BrowserError>;\n readonly selectPage: (page: PageInfo) => Effect.Effect<void, BrowserError>;\n readonly selectFrame: (frameId: string) => Effect.Effect<void, BrowserError>;\n /** Create a tab without selecting it and return that exact tab's checked identity. */\n readonly createPage: Effect.Effect<PageInfo, BrowserError>;\n readonly closePage: (page: PageInfo) => Effect.Effect<void, BrowserError>;\n readonly resizeViewport: (viewport: Viewport) => Effect.Effect<void, BrowserError>;\n /**\n * Wait on the original observed node within the host deadline. Hidden includes its detachment;\n * document replacement is stale. Success observes a condition, without authorizing later input.\n */\n readonly waitForElement: (request: WaitForElementRequest) => Effect.Effect<void, BrowserError>;\n readonly waitFor: (request: {\n readonly selector: string;\n readonly state: \"visible\" | \"hidden\" | \"attached\" | \"detached\";\n }) => Effect.Effect<void, BrowserError>;\n /** Navigation observation is registered before the single click dispatch. */\n readonly clickAndWait: (request: ClickRequest) => Effect.Effect<ActionResult, BrowserError>;\n /**\n * Readiness of the current document only. Dependent operations wait for it themselves;\n * this reports it without charging an action, so a caller can decide what to do about a\n * document that predates the registrations.\n */\n readonly ready: Effect.Effect<Bootstrap.ReadinessOutcome, InitializationError>;\n}\n\n/** Helpers that do not supervise callback failures accept any live browser session. */\nexport type AnySession = BrowserSession<unknown>;\n\n/** Dependencies are captured at acquisition, not erased into an environment-free service Layer. */\nexport interface OpenOptions<E = never, R = never> {\n readonly bootstrap?: Bootstrap.Plan<E, R>;\n}\n\n/**\n * Acquire, supervise and close one browser in a fresh scope. The callback keeps the concrete\n * Chromium or provider session type. Its scoped work is joined before checked browser cleanup,\n * and cleanup failures remain typed even when the callback has already failed or was cancelled.\n * Acquisition is evaluated once; an uncertain result is never retried.\n */\nexport const scoped: {\n <S extends BrowserSession<unknown>, A, E2, R2>(\n f: (session: S) => Effect.Effect<A, E2, R2>,\n ): <E, AE, AR>(\n open: Effect.Effect<S & BrowserSession<E>, AE, AR>,\n ) => Effect.Effect<\n A,\n AE | E | E2 | InitializationError | BrowserError,\n Exclude<AR | R2, Scope.Scope>\n >;\n <S, E, AE, AR, A, E2, R2>(\n open: Effect.Effect<S & BrowserSession<E>, AE, AR>,\n f: (session: S & BrowserSession<E>) => Effect.Effect<A, E2, R2>,\n ): Effect.Effect<\n A,\n AE | E | E2 | InitializationError | BrowserError,\n Exclude<AR | R2, Scope.Scope>\n >;\n} = dual(\n 2,\n <S, E, AE, AR, A, E2, R2>(\n open: Effect.Effect<S & BrowserSession<E>, AE, AR>,\n f: (session: S & BrowserSession<E>) => Effect.Effect<A, E2, R2>,\n ) =>\n Effect.scoped(\n Effect.flatMap(open, (session) =>\n Effect.scoped(\n Effect.raceFirst(\n session.failure,\n Effect.suspend(() => f(session)),\n ),\n ).pipe(Effect.onExit(() => session.closeChecked)),\n ),\n ),\n);\n"],"mappings":";;;;;;;;;AAuQA,MAAa,SAkBT,KACF,IAEE,MACA,MAEA,OAAO,OACL,OAAO,QAAQ,OAAO,YACpB,OAAO,OACL,OAAO,UACL,QAAQ,SACR,OAAO,cAAc,EAAE,OAAO,CAAC,CACjC,CACF,CAAC,CAAC,KAAK,OAAO,aAAa,QAAQ,YAAY,CAAC,CAClD,CACF,CACJ"}