effect-browser 0.2.0-beta.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 (40) hide show
  1. package/README.md +150 -10
  2. package/dist/{Association-zlgInoaj.mjs → Association-BsSfBYVx.mjs} +14 -10
  3. package/dist/Association-BsSfBYVx.mjs.map +1 -0
  4. package/dist/{Bootstrap-Be-2Ddmh.mjs → Bootstrap-CeQOWBy6.mjs} +6 -4
  5. package/dist/Bootstrap-CeQOWBy6.mjs.map +1 -0
  6. package/dist/Bootstrap.mjs +1 -1
  7. package/dist/Browser.d.mts +13 -1
  8. package/dist/Browser.mjs.map +1 -1
  9. package/dist/{BrowserData-DJAnUHoZ.d.mts → BrowserData-CRuxEZcn.d.mts} +90 -10
  10. package/dist/BrowserData.d.mts +2 -2
  11. package/dist/BrowserData.mjs +85 -7
  12. package/dist/BrowserData.mjs.map +1 -1
  13. package/dist/BrowserRuntime-Coz-5DYb.d.mts +143 -0
  14. package/dist/{BrowserRuntime-fZz1b0VI.mjs → BrowserRuntime-DViKNUdD.mjs} +2819 -2206
  15. package/dist/BrowserRuntime-DViKNUdD.mjs.map +1 -0
  16. package/dist/BrowserRuntime.d.mts +3 -139
  17. package/dist/BrowserRuntime.mjs +1 -1
  18. package/dist/Capture.d.mts +15 -1
  19. package/dist/Capture.mjs +58 -22
  20. package/dist/Capture.mjs.map +1 -1
  21. package/dist/{CaptureData-AmqVP_Ba.mjs → CaptureData-B5-mXlyq.mjs} +24 -6
  22. package/dist/CaptureData-B5-mXlyq.mjs.map +1 -0
  23. package/dist/CaptureData.d.mts +11 -2
  24. package/dist/CaptureData.mjs +1 -1
  25. package/dist/Chromium.d.mts +4 -3
  26. package/dist/Chromium.mjs +22 -16
  27. package/dist/Chromium.mjs.map +1 -1
  28. package/dist/Errors.d.mts +2 -2
  29. package/dist/Errors.mjs +1 -0
  30. package/dist/Errors.mjs.map +1 -1
  31. package/dist/PageControl.d.mts +1 -1
  32. package/dist/PageControl.mjs +1 -1
  33. package/dist/Testing.d.mts +437 -0
  34. package/dist/Testing.mjs +1561 -0
  35. package/dist/Testing.mjs.map +1 -0
  36. package/package.json +5 -1
  37. package/dist/Association-zlgInoaj.mjs.map +0 -1
  38. package/dist/Bootstrap-Be-2Ddmh.mjs.map +0 -1
  39. package/dist/BrowserRuntime-fZz1b0VI.mjs.map +0 -1
  40. package/dist/CaptureData-AmqVP_Ba.mjs.map +0 -1
@@ -0,0 +1,143 @@
1
+ import { BrowserError, InitializationError } from "./Errors.mjs";
2
+ import { O as Observation, a as BrowserPolicy, b as InlineFile, c as ClickRequest, et as Viewport, n as AutomationOptions, t as ActionResult } from "./BrowserData-CRuxEZcn.mjs";
3
+ import { BrowserSession, OpenOptions } from "./Browser.mjs";
4
+ import { Crypto, Effect, Option, Redacted, Schema, Scope } from "effect";
5
+ //#region src/internal/browser/ConnectionCleanup.d.ts
6
+ /** Evidence about this connection, independent of the lifetime of its browser process. */
7
+ type ConnectionState = "closed" | "failed" | "not-connected" | "pending";
8
+ /** Captured teardown operations supplied to the lifetime which owns this connection. */
9
+ interface ConnectionCleanup {
10
+ readonly fence: Effect.Effect<void>;
11
+ readonly capture: Effect.Effect<void, BrowserError>;
12
+ readonly initialization: Effect.Effect<void, BrowserError | InitializationError>;
13
+ readonly disconnect: Effect.Effect<ConnectionState, BrowserError>;
14
+ }
15
+ declare const noConnection: ConnectionCleanup;
16
+ type CleanupStep<A> = {
17
+ readonly _tag: "Success";
18
+ readonly value: A;
19
+ } | {
20
+ readonly _tag: "Failure";
21
+ readonly reason: "timeout" | "interrupted" | "failed";
22
+ };
23
+ /** Every step settles independently, so one failure never suppresses subsequent teardown. */
24
+ declare const cleanupStep: <A, E, R>(action: Effect.Effect<A, E, R>, timeoutMillis: number) => Effect.Effect<CleanupStep<A>, never, R>;
25
+ /** Bounded host notification; reporting cannot change the cleanup evidence it describes. */
26
+ declare const reported: <A, E>(effect: Effect.Effect<A, E>) => Effect.Effect<void>;
27
+ //#endregion
28
+ //#region src/BrowserRuntime.d.ts
29
+ /** Opaque engine configuration. Only this constructor's issued values can acquire a runtime. */
30
+ interface BrowserBinding {
31
+ readonly _tag: "BrowserBinding";
32
+ }
33
+ interface PlaywrightOptions {
34
+ /** A trusted integration validates its own endpoint authority before routing the connection. */
35
+ readonly resolveEndpoint?: (connection: {
36
+ readonly url: Redacted.Redacted<string>;
37
+ }) => Effect.Effect<string, BrowserError>;
38
+ /** Trusted instrumentation of the existing native connection, before the owner starts using it. */
39
+ readonly onConnected?: (connection: {
40
+ readonly native: unknown;
41
+ readonly endpoint: string;
42
+ }) => void;
43
+ }
44
+ /** A maintained Playwright connection, loaded lazily. No driver or protocol capability is returned. */
45
+ declare const playwright: (options?: PlaywrightOptions) => BrowserBinding;
46
+ /**
47
+ * An integration owns endpoint authority and the meaning of release. Its source must register
48
+ * release in the supplied Scope before returning; the runtime owns only the connection below it.
49
+ */
50
+ interface Lifetime {
51
+ readonly reference: unknown;
52
+ readonly connection: (remainingMillis: number) => Effect.Effect<Redacted.Redacted<string>, BrowserError>;
53
+ readonly release: Effect.Effect<unknown>;
54
+ readonly cleanupResult: Effect.Effect<Option.Option<unknown>>;
55
+ readonly closeChecked: Effect.Effect<void, BrowserError>;
56
+ /**
57
+ * Memory-only evidence that canonical owned cleanup terminated native browser control.
58
+ * Omission is unknown. Borrowed disconnection alone never establishes this fact.
59
+ */
60
+ readonly controlRetired?: Effect.Effect<boolean>;
61
+ readonly verifyReconnect?: Effect.Effect<void, BrowserError>;
62
+ }
63
+ type Source<L extends Lifetime, E, R = never> = (cleanup: ConnectionCleanup, lifetimeDeadline: number) => Effect.Effect<L, E, R | Scope.Scope>;
64
+ interface RuntimeOptions {
65
+ readonly implementation: string;
66
+ readonly binding?: BrowserBinding;
67
+ readonly automation?: AutomationOptions;
68
+ readonly viewport?: Viewport;
69
+ readonly preserveViewport?: boolean;
70
+ readonly keepAlive?: boolean;
71
+ }
72
+ interface AcquireOptions<E = never, R = never> extends OpenOptions<E, R> {
73
+ /** Attach to an existing page without creating a tab or changing its viewport. */
74
+ readonly existingTarget?: {
75
+ readonly targetId?: string;
76
+ };
77
+ }
78
+ /**
79
+ * Resolved host input for an integration constructing its own runtime. Stored paths must already
80
+ * have been authorized by that integration; a session cannot recover these operations afterwards.
81
+ */
82
+ type ResolvedFileSelection = {
83
+ readonly _tag: "Inline";
84
+ readonly files: ReadonlyArray<InlineFile>;
85
+ } | {
86
+ readonly _tag: "Stored";
87
+ readonly paths: ReadonlyArray<string>;
88
+ };
89
+ interface FileRequest {
90
+ readonly selector: string;
91
+ readonly selection: ResolvedFileSelection;
92
+ }
93
+ declare const DownloadEvent_base: Schema.Class<DownloadEvent, Schema.Struct<{
94
+ readonly downloadId: Schema.NonEmptyString;
95
+ readonly filename: Schema.NonEmptyString;
96
+ readonly state: Schema.Literals<readonly ["completed", "failed"]>;
97
+ }>, {}>;
98
+ declare class DownloadEvent extends DownloadEvent_base {}
99
+ /**
100
+ * Modeled host operations for the integration creating this connection. Native authority stays
101
+ * inside the owner; the integration adds only the capabilities its public session supports.
102
+ */
103
+ interface Integration<Reference> {
104
+ readonly clickForDownload: (request: ClickRequest) => Effect.Effect<DownloadEvent, BrowserError>;
105
+ readonly selectFiles: (request: FileRequest) => Effect.Effect<ActionResult, BrowserError>;
106
+ readonly clickForFileSelection: (request: FileRequest) => Effect.Effect<ActionResult, BrowserError>;
107
+ readonly liveView: <A>(issue: Effect.Effect<A, BrowserError>) => Effect.Effect<A, BrowserError>;
108
+ readonly beginHandoff: <A>(issue: Effect.Effect<A, BrowserError>) => Effect.Effect<{
109
+ readonly token: Redacted.Redacted<string>;
110
+ readonly view: A;
111
+ }, BrowserError>;
112
+ readonly resume: (token: Redacted.Redacted<string>, operatorReleasedControl: boolean) => Effect.Effect<Observation, BrowserError>;
113
+ readonly detach: Effect.Effect<{
114
+ readonly reference: Reference;
115
+ readonly targetId: string;
116
+ }, BrowserError>;
117
+ readonly reconnect: (operatorReleasedControl: boolean) => Effect.Effect<Observation, BrowserError | InitializationError>;
118
+ }
119
+ interface Connection<Reference, E = never> {
120
+ /** Preserve this object's identity when adding an integration's public capabilities. */
121
+ readonly session: BrowserSession<E>;
122
+ readonly operations: Integration<Reference>;
123
+ }
124
+ interface Acquisition<L extends Lifetime, E = never> {
125
+ readonly reference: L["reference"];
126
+ readonly lifetime: L;
127
+ readonly failure: Effect.Effect<never, E | InitializationError>;
128
+ readonly close: L["release"];
129
+ readonly connect: Effect.Effect<Connection<L["reference"], E>, BrowserError | InitializationError | E>;
130
+ }
131
+ interface Runtime {
132
+ readonly acquire: <L extends Lifetime, AE, AR, E = never, R = never>(policy: BrowserPolicy, source: Source<L, AE, AR>, request?: AcquireOptions<E, R>) => Effect.Effect<Acquisition<L, E>, AE | BrowserError, Scope.Scope | AR | Exclude<R, Scope.Scope>>;
133
+ }
134
+ /**
135
+ * Validate immutable connection configuration without loading a peer or acquiring a lifetime.
136
+ * Connection ids and handoff tokens come from the `Crypto` service captured here, so a Layer
137
+ * built on this runtime requires `Crypto` once and its operations never do.
138
+ */
139
+ declare const make: (options: RuntimeOptions) => Effect.Effect<Runtime, BrowserError, Crypto.Crypto>;
140
+ //#endregion
141
+ export { ConnectionCleanup as _, DownloadEvent as a, noConnection as b, Lifetime as c, Runtime as d, RuntimeOptions as f, CleanupStep as g, playwright as h, Connection as i, PlaywrightOptions as l, make as m, Acquisition as n, FileRequest as o, Source as p, BrowserBinding as r, Integration as s, AcquireOptions as t, ResolvedFileSelection as u, ConnectionState as v, reported as x, cleanupStep as y };
142
+ export {};
143
+ //# sourceMappingURL=BrowserRuntime-Coz-5DYb.d.mts.map