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,180 @@
1
+ import { BrowserError } from "./Errors.mjs";
2
+ import { PageInfo, Target } from "./BrowserData.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/internal/capture/Options.ts
5
+ const Dimension = Schema.Int.check(Schema.isBetween({
6
+ minimum: 1,
7
+ maximum: 16384
8
+ }));
9
+ const BufferedBytes = Schema.Int.check(Schema.isBetween({
10
+ minimum: 1,
11
+ maximum: 67108864
12
+ }));
13
+ /**
14
+ * Upper bounds of one interval. Frames can be held for as long as a consumer delays them, so the
15
+ * frame bound is set by memory (the byte bound), not by a short hand-off; an interval can last
16
+ * as long as a session may.
17
+ */
18
+ const CaptureMaxima = Object.freeze({
19
+ frames: 1024,
20
+ durationMillis: 216e5
21
+ });
22
+ /** Defaults shared by runtime admission and the optional public data schema. */
23
+ const CaptureDefaults = Object.freeze({
24
+ maxFrames: 4,
25
+ maxBufferedBytes: 16777216,
26
+ maxFrameBytes: 4194304,
27
+ maxDurationMillis: 6e4,
28
+ quality: 80
29
+ });
30
+ const LimitFields = {
31
+ maxFrames: Schema.Int.check(Schema.isBetween({
32
+ minimum: 1,
33
+ maximum: CaptureMaxima.frames
34
+ })),
35
+ maxBufferedBytes: BufferedBytes,
36
+ maxFrameBytes: BufferedBytes,
37
+ maxDurationMillis: Schema.Int.check(Schema.isBetween({
38
+ minimum: 1,
39
+ maximum: CaptureMaxima.durationMillis
40
+ })),
41
+ quality: Schema.Int.check(Schema.isBetween({
42
+ minimum: 1,
43
+ maximum: 100
44
+ }))
45
+ };
46
+ const FrameBudget = Schema.makeFilter((value) => (value.maxFrameBytes ?? CaptureDefaults.maxFrameBytes) <= (value.maxBufferedBytes ?? CaptureDefaults.maxBufferedBytes), { message: "A frame must fit within the resolved buffer budget" });
47
+ /** Fully resolved admission values; callers supply the optional public CaptureOptions instead. */
48
+ const CaptureLimits = Schema.Struct(LimitFields).check(FrameBudget);
49
+ //#endregion
50
+ //#region src/CaptureData.ts
51
+ /**
52
+ * Binary frame data, not a live capability or a JSON/thread/Tool value. Decoding validates
53
+ * fields; it does not copy bytes, decode JPEG pixels, prove target authority, or repair clocks.
54
+ * Capture itself owns the byte copy, freezes its shared target identity, and verifies JPEG framing.
55
+ */
56
+ const CapturedFrame = Schema.Struct({
57
+ bytes: Schema.Uint8Array.check(Schema.isMinLength(4), Schema.isMaxLength(67108864)),
58
+ mediaType: Schema.Literal("image/jpeg"),
59
+ target: Target,
60
+ sequence: Schema.Natural,
61
+ /**
62
+ * Which document of its page this frame was received during: 0 at the start, one more for each
63
+ * main-frame navigation the interval observed. It is attribution by receipt order, not proof
64
+ * of whose pixels these are: a frame received just after a navigation can still show the
65
+ * document before it. Always 0 for an interval that lasts one document.
66
+ */
67
+ document: Schema.Natural,
68
+ sourceTimeMillis: Schema.Finite.check(Schema.isGreaterThan(0)),
69
+ sourceClock: Schema.Literal("presentation-unix-millis"),
70
+ receivedMonotonicNanos: Schema.BigInt,
71
+ width: Dimension,
72
+ height: Dimension,
73
+ viewportWidth: Dimension,
74
+ viewportHeight: Dimension
75
+ }).check(Schema.makeFilter((frame) => frame.width * frame.height <= 33554432, { message: "Frame geometry exceeds the capture pixel bound" }));
76
+ /** Source-fit request in pixels. Actual JPEG bounds are checked before any frame is delivered. */
77
+ const CaptureSize = Schema.Struct({
78
+ width: Dimension,
79
+ height: Dimension
80
+ });
81
+ /** Optional capture data. Defaults are applied at admission, not during schema decoding. */
82
+ const CaptureOptions = Schema.Struct({
83
+ /** Pin to a page from `session.pages`; omission preserves selected-page behavior. */
84
+ target: Schema.optionalKey(PageInfo),
85
+ /**
86
+ * Frames held until the consumer takes them (4 by default, at most 1024), oldest dropped first
87
+ * and counted as `overflow`. A consumer that delays its output leaves frames here, so this and
88
+ * `maxBufferedBytes` are the delay's memory bound.
89
+ */
90
+ maxFrames: Schema.optionalKey(LimitFields.maxFrames),
91
+ maxBufferedBytes: Schema.optionalKey(LimitFields.maxBufferedBytes),
92
+ maxFrameBytes: Schema.optionalKey(LimitFields.maxFrameBytes),
93
+ /** 60 seconds by default, at most six hours: as long as a session may last. */
94
+ maxDurationMillis: Schema.optionalKey(LimitFields.maxDurationMillis),
95
+ quality: Schema.optionalKey(LimitFields.quality),
96
+ /** Source fit only. Does not resize the viewport or impose an FPS cap. */
97
+ size: Schema.optionalKey(CaptureSize),
98
+ /**
99
+ * `document`, the default, ends the interval when its page navigates. `page` follows the page
100
+ * across documents, so a capture started before a navigation covers the loading in between.
101
+ * It applies to a page's main frame; a capture bound to a child frame still ends with it.
102
+ */
103
+ lifetime: Schema.optionalKey(Schema.Literals(["document", "page"]))
104
+ }).check(FrameBudget);
105
+ /** An address as the browser reported it. One longer than this is recorded as null, not cut. */
106
+ const DocumentUrl = Schema.NullOr(Schema.String.check(Schema.isMaxLength(8192)));
107
+ var CaptureSummary = class extends Schema.Class("BrowserCaptureSummary")({
108
+ target: Target,
109
+ reason: Schema.String.check(Schema.isMaxLength(64)),
110
+ received: Schema.Natural,
111
+ delivered: Schema.Natural,
112
+ /** All frames this package omitted; the sum of the four disjoint components below. */
113
+ discarded: Schema.Natural,
114
+ /** Evicted by the frame-count or buffered-byte bound. */
115
+ overflow: Schema.Natural,
116
+ duplicates: Schema.Natural,
117
+ /** Arrived after a newer frame was accepted; never reordered in. */
118
+ late: Schema.Natural,
119
+ /** Other refused frames, including malformed data, bounds and undelivered scope cleanup. */
120
+ rejected: Schema.Natural,
121
+ peakBufferedFrames: Schema.Natural,
122
+ peakBufferedBytes: Schema.Natural,
123
+ bufferedFrames: Schema.Natural,
124
+ bufferedBytes: Schema.Natural,
125
+ sourceFirstMillis: Schema.NullOr(Schema.Finite),
126
+ sourceLastMillis: Schema.NullOr(Schema.Finite),
127
+ /**
128
+ * The captured frame's address when this interval began watching it: the URL of document 0.
129
+ * It is read in the same turn the watch is installed, so no navigation can fall between them.
130
+ */
131
+ initialUrl: DocumentUrl,
132
+ /**
133
+ * Each main-frame navigation a `page` interval observed, in order, with the last frame
134
+ * received before it and the address the new document committed. The native screencast is
135
+ * never restarted for one, so a boundary is not a gap this package introduced; what Chromium
136
+ * omitted while loading stays `upstreamDrops`. A boundary is the commit. When that navigation
137
+ * started and when its document finished loading are the caller's to stamp, on this same
138
+ * clock, around the operation that caused it. A title is page state, not part of a transition.
139
+ */
140
+ documentBoundaries: Schema.Array(Schema.Struct({
141
+ document: Schema.Natural,
142
+ observedMonotonicNanos: Schema.BigInt,
143
+ afterSequence: Schema.NullOr(Schema.Natural),
144
+ url: DocumentUrl
145
+ })).check(Schema.isMaxLength(64)),
146
+ /**
147
+ * More navigations were observed than are recorded above, so the earliest were let go: the
148
+ * record keeps the latest 64. Frames still count them all.
149
+ */
150
+ documentBoundariesTruncated: Schema.Boolean,
151
+ nativeStop: Schema.Literals(["confirmed", "unconfirmed"]),
152
+ /** Package accounting cannot measure frames omitted by Chromium, transport, or the provider. */
153
+ upstreamDrops: Schema.Literal("unknown"),
154
+ error: Schema.optionalKey(BrowserError)
155
+ }) {};
156
+ const { reason: StopReason, nativeStop: NativeStop, ...SnapshotFields } = CaptureSummary.fields;
157
+ /**
158
+ * Host-side metadata at one instant, without reading or waking the page. The boundary prefix
159
+ * and loss counters are the same facts as the final summary, independent of frame consumption.
160
+ * `stopped` means native cleanup settled; buffered frames may still be drained afterwards.
161
+ */
162
+ var CaptureSnapshot = class extends Schema.Class("BrowserCaptureSnapshot")({
163
+ ...SnapshotFields,
164
+ phase: Schema.Literals([
165
+ "capturing",
166
+ "stopping",
167
+ "stopped"
168
+ ]),
169
+ observedMonotonicNanos: Schema.BigInt,
170
+ /** Keeps counting when the bounded boundary prefix is truncated. */
171
+ currentDocument: Schema.Natural,
172
+ /** No reason is reported while the capture still accepts frames. */
173
+ reason: Schema.NullOr(StopReason),
174
+ /** Null until the native cleanup attempt settles; unconfirmed never means stopped remotely. */
175
+ nativeStop: Schema.NullOr(NativeStop)
176
+ }) {};
177
+ //#endregion
178
+ export { CapturedFrame as a, CaptureMaxima as c, CaptureSummary as i, CaptureSize as n, CaptureDefaults as o, CaptureSnapshot as r, CaptureLimits as s, CaptureOptions as t };
179
+
180
+ //# sourceMappingURL=CaptureData-B5-mXlyq.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaptureData-B5-mXlyq.mjs","names":[],"sources":["../src/internal/capture/Options.ts","../src/CaptureData.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nexport const Dimension = Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 16384 }));\nconst BufferedBytes = Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 64 * 1024 * 1024 }));\n\n/**\n * Upper bounds of one interval. Frames can be held for as long as a consumer delays them, so the\n * frame bound is set by memory (the byte bound), not by a short hand-off; an interval can last\n * as long as a session may.\n */\nexport const CaptureMaxima = Object.freeze({ frames: 1024, durationMillis: 21_600_000 });\n\n/** Defaults shared by runtime admission and the optional public data schema. */\nexport const CaptureDefaults = Object.freeze({\n maxFrames: 4,\n maxBufferedBytes: 16 * 1024 * 1024,\n maxFrameBytes: 4 * 1024 * 1024,\n maxDurationMillis: 60000,\n quality: 80,\n});\n\nexport const LimitFields = {\n maxFrames: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: CaptureMaxima.frames })),\n maxBufferedBytes: BufferedBytes,\n maxFrameBytes: BufferedBytes,\n maxDurationMillis: Schema.Int.check(\n Schema.isBetween({ minimum: 1, maximum: CaptureMaxima.durationMillis }),\n ),\n quality: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })),\n};\n\nexport const FrameBudget = Schema.makeFilter(\n (value: { readonly maxFrameBytes?: number; readonly maxBufferedBytes?: number }) =>\n (value.maxFrameBytes ?? CaptureDefaults.maxFrameBytes) <=\n (value.maxBufferedBytes ?? CaptureDefaults.maxBufferedBytes),\n { message: \"A frame must fit within the resolved buffer budget\" },\n);\n\n/** Fully resolved admission values; callers supply the optional public CaptureOptions instead. */\nexport const CaptureLimits = Schema.Struct(LimitFields).check(FrameBudget);\n","import { Schema } from \"effect\";\n\nimport { PageInfo, Target } from \"./BrowserData.ts\";\nimport { BrowserError } from \"./Errors.ts\";\nimport { Dimension, FrameBudget, LimitFields } from \"./internal/capture/Options.ts\";\n\n/**\n * Binary frame data, not a live capability or a JSON/thread/Tool value. Decoding validates\n * fields; it does not copy bytes, decode JPEG pixels, prove target authority, or repair clocks.\n * Capture itself owns the byte copy, freezes its shared target identity, and verifies JPEG framing.\n */\nexport const CapturedFrame = Schema.Struct({\n bytes: Schema.Uint8Array.check(Schema.isMinLength(4), Schema.isMaxLength(64 * 1024 * 1024)),\n mediaType: Schema.Literal(\"image/jpeg\"),\n target: Target,\n sequence: Schema.Natural,\n /**\n * Which document of its page this frame was received during: 0 at the start, one more for each\n * main-frame navigation the interval observed. It is attribution by receipt order, not proof\n * of whose pixels these are: a frame received just after a navigation can still show the\n * document before it. Always 0 for an interval that lasts one document.\n */\n document: Schema.Natural,\n sourceTimeMillis: Schema.Finite.check(Schema.isGreaterThan(0)),\n sourceClock: Schema.Literal(\"presentation-unix-millis\"),\n receivedMonotonicNanos: Schema.BigInt,\n width: Dimension,\n height: Dimension,\n viewportWidth: Dimension,\n viewportHeight: Dimension,\n}).check(\n Schema.makeFilter((frame) => frame.width * frame.height <= 33_554_432, {\n message: \"Frame geometry exceeds the capture pixel bound\",\n }),\n);\n\nexport type CapturedFrame = typeof CapturedFrame.Type;\n\n/** Source-fit request in pixels. Actual JPEG bounds are checked before any frame is delivered. */\nexport const CaptureSize = Schema.Struct({ width: Dimension, height: Dimension });\n\nexport type CaptureSize = typeof CaptureSize.Type;\n\n/** Optional capture data. Defaults are applied at admission, not during schema decoding. */\nexport const CaptureOptions = Schema.Struct({\n /** Pin to a page from `session.pages`; omission preserves selected-page behavior. */\n target: Schema.optionalKey(PageInfo),\n /**\n * Frames held until the consumer takes them (4 by default, at most 1024), oldest dropped first\n * and counted as `overflow`. A consumer that delays its output leaves frames here, so this and\n * `maxBufferedBytes` are the delay's memory bound.\n */\n maxFrames: Schema.optionalKey(LimitFields.maxFrames),\n maxBufferedBytes: Schema.optionalKey(LimitFields.maxBufferedBytes),\n maxFrameBytes: Schema.optionalKey(LimitFields.maxFrameBytes),\n /** 60 seconds by default, at most six hours: as long as a session may last. */\n maxDurationMillis: Schema.optionalKey(LimitFields.maxDurationMillis),\n quality: Schema.optionalKey(LimitFields.quality),\n /** Source fit only. Does not resize the viewport or impose an FPS cap. */\n size: Schema.optionalKey(CaptureSize),\n /**\n * `document`, the default, ends the interval when its page navigates. `page` follows the page\n * across documents, so a capture started before a navigation covers the loading in between.\n * It applies to a page's main frame; a capture bound to a child frame still ends with it.\n */\n lifetime: Schema.optionalKey(Schema.Literals([\"document\", \"page\"])),\n}).check(FrameBudget);\n\nexport type CaptureOptions = typeof CaptureOptions.Type;\n\n/** An address as the browser reported it. One longer than this is recorded as null, not cut. */\nconst DocumentUrl = Schema.NullOr(Schema.String.check(Schema.isMaxLength(8192)));\n\nexport class CaptureSummary extends Schema.Class<CaptureSummary>(\"BrowserCaptureSummary\")({\n target: Target,\n reason: Schema.String.check(Schema.isMaxLength(64)),\n received: Schema.Natural,\n delivered: Schema.Natural,\n /** All frames this package omitted; the sum of the four disjoint components below. */\n discarded: Schema.Natural,\n /** Evicted by the frame-count or buffered-byte bound. */\n overflow: Schema.Natural,\n duplicates: Schema.Natural,\n /** Arrived after a newer frame was accepted; never reordered in. */\n late: Schema.Natural,\n /** Other refused frames, including malformed data, bounds and undelivered scope cleanup. */\n rejected: Schema.Natural,\n peakBufferedFrames: Schema.Natural,\n peakBufferedBytes: Schema.Natural,\n bufferedFrames: Schema.Natural,\n bufferedBytes: Schema.Natural,\n sourceFirstMillis: Schema.NullOr(Schema.Finite),\n sourceLastMillis: Schema.NullOr(Schema.Finite),\n /**\n * The captured frame's address when this interval began watching it: the URL of document 0.\n * It is read in the same turn the watch is installed, so no navigation can fall between them.\n */\n initialUrl: DocumentUrl,\n /**\n * Each main-frame navigation a `page` interval observed, in order, with the last frame\n * received before it and the address the new document committed. The native screencast is\n * never restarted for one, so a boundary is not a gap this package introduced; what Chromium\n * omitted while loading stays `upstreamDrops`. A boundary is the commit. When that navigation\n * started and when its document finished loading are the caller's to stamp, on this same\n * clock, around the operation that caused it. A title is page state, not part of a transition.\n */\n documentBoundaries: Schema.Array(\n Schema.Struct({\n document: Schema.Natural,\n observedMonotonicNanos: Schema.BigInt,\n afterSequence: Schema.NullOr(Schema.Natural),\n url: DocumentUrl,\n }),\n ).check(Schema.isMaxLength(64)),\n /**\n * More navigations were observed than are recorded above, so the earliest were let go: the\n * record keeps the latest 64. Frames still count them all.\n */\n documentBoundariesTruncated: Schema.Boolean,\n nativeStop: Schema.Literals([\"confirmed\", \"unconfirmed\"]),\n /** Package accounting cannot measure frames omitted by Chromium, transport, or the provider. */\n upstreamDrops: Schema.Literal(\"unknown\"),\n error: Schema.optionalKey(BrowserError),\n}) {}\n\nconst { reason: StopReason, nativeStop: NativeStop, ...SnapshotFields } = CaptureSummary.fields;\n\n/**\n * Host-side metadata at one instant, without reading or waking the page. The boundary prefix\n * and loss counters are the same facts as the final summary, independent of frame consumption.\n * `stopped` means native cleanup settled; buffered frames may still be drained afterwards.\n */\nexport class CaptureSnapshot extends Schema.Class<CaptureSnapshot>(\"BrowserCaptureSnapshot\")({\n ...SnapshotFields,\n phase: Schema.Literals([\"capturing\", \"stopping\", \"stopped\"]),\n observedMonotonicNanos: Schema.BigInt,\n /** Keeps counting when the bounded boundary prefix is truncated. */\n currentDocument: Schema.Natural,\n /** No reason is reported while the capture still accepts frames. */\n reason: Schema.NullOr(StopReason),\n /** Null until the native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,OAAO,MACzB,OAAO,OAAO;EACZ,UAAU,OAAO;EACjB,wBAAwB,OAAO;EAC/B,eAAe,OAAO,OAAO,OAAO,OAAO;EAC3C,KAAK;CACP,CAAC,CACH,CAAC,CAAC,MAAM,OAAO,YAAY,EAAE,CAAC;;;;;CAK9B,6BAA6B,OAAO;CACpC,YAAY,OAAO,SAAS,CAAC,aAAa,aAAa,CAAC;;CAExD,eAAe,OAAO,QAAQ,SAAS;CACvC,OAAO,OAAO,YAAY,YAAY;AACxC,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,EAAE,QAAQ,YAAY,YAAY,YAAY,GAAG,mBAAmB,eAAe;;;;;;AAOzF,IAAa,kBAAb,cAAqC,OAAO,MAAuB,wBAAwB,CAAC,CAAC;CAC3F,GAAG;CACH,OAAO,OAAO,SAAS;EAAC;EAAa;EAAY;CAAS,CAAC;CAC3D,wBAAwB,OAAO;;CAE/B,iBAAiB,OAAO;;CAExB,QAAQ,OAAO,OAAO,UAAU;;CAEhC,YAAY,OAAO,OAAO,UAAU;AACtC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,157 @@
1
+ import { BrowserError } from "./Errors.mjs";
2
+ import { N as PageInfo, X as Target } from "./BrowserData-CRuxEZcn.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/CaptureData.d.ts
5
+ /**
6
+ * Binary frame data, not a live capability or a JSON/thread/Tool value. Decoding validates
7
+ * fields; it does not copy bytes, decode JPEG pixels, prove target authority, or repair clocks.
8
+ * Capture itself owns the byte copy, freezes its shared target identity, and verifies JPEG framing.
9
+ */
10
+ export declare const CapturedFrame: Schema.Struct<{
11
+ readonly bytes: Schema.Uint8Array;
12
+ readonly mediaType: Schema.Literal<"image/jpeg">;
13
+ readonly target: typeof Target;
14
+ readonly sequence: Schema.Natural;
15
+ /**
16
+ * Which document of its page this frame was received during: 0 at the start, one more for each
17
+ * main-frame navigation the interval observed. It is attribution by receipt order, not proof
18
+ * of whose pixels these are: a frame received just after a navigation can still show the
19
+ * document before it. Always 0 for an interval that lasts one document.
20
+ */
21
+ readonly document: Schema.Natural;
22
+ readonly sourceTimeMillis: Schema.Finite;
23
+ readonly sourceClock: Schema.Literal<"presentation-unix-millis">;
24
+ readonly receivedMonotonicNanos: Schema.BigInt;
25
+ readonly width: Schema.Int;
26
+ readonly height: Schema.Int;
27
+ readonly viewportWidth: Schema.Int;
28
+ readonly viewportHeight: Schema.Int;
29
+ }>;
30
+ export type CapturedFrame = typeof CapturedFrame.Type;
31
+ /** Source-fit request in pixels. Actual JPEG bounds are checked before any frame is delivered. */
32
+ export declare const CaptureSize: Schema.Struct<{
33
+ readonly width: Schema.Int;
34
+ readonly height: Schema.Int;
35
+ }>;
36
+ export type CaptureSize = typeof CaptureSize.Type;
37
+ /** Optional capture data. Defaults are applied at admission, not during schema decoding. */
38
+ export declare const CaptureOptions: Schema.Struct<{
39
+ /** Pin to a page from `session.pages`; omission preserves selected-page behavior. */
40
+ readonly target: Schema.optionalKey<typeof PageInfo>;
41
+ /**
42
+ * Frames held until the consumer takes them (4 by default, at most 1024), oldest dropped first
43
+ * and counted as `overflow`. A consumer that delays its output leaves frames here, so this and
44
+ * `maxBufferedBytes` are the delay's memory bound.
45
+ */
46
+ readonly maxFrames: Schema.optionalKey<Schema.Int>;
47
+ readonly maxBufferedBytes: Schema.optionalKey<Schema.Int>;
48
+ readonly maxFrameBytes: Schema.optionalKey<Schema.Int>;
49
+ /** 60 seconds by default, at most six hours: as long as a session may last. */
50
+ readonly maxDurationMillis: Schema.optionalKey<Schema.Int>;
51
+ readonly quality: Schema.optionalKey<Schema.Int>;
52
+ /** Source fit only. Does not resize the viewport or impose an FPS cap. */
53
+ readonly size: Schema.optionalKey<Schema.Struct<{
54
+ readonly width: Schema.Int;
55
+ readonly height: Schema.Int;
56
+ }>>;
57
+ /**
58
+ * `document`, the default, ends the interval when its page navigates. `page` follows the page
59
+ * across documents, so a capture started before a navigation covers the loading in between.
60
+ * It applies to a page's main frame; a capture bound to a child frame still ends with it.
61
+ */
62
+ readonly lifetime: Schema.optionalKey<Schema.Literals<readonly ["document", "page"]>>;
63
+ }>;
64
+ export type CaptureOptions = typeof CaptureOptions.Type;
65
+ declare const CaptureSummary_base: Schema.Class<CaptureSummary, Schema.Struct<{
66
+ readonly target: typeof Target;
67
+ readonly reason: Schema.String;
68
+ readonly received: Schema.Natural;
69
+ readonly delivered: Schema.Natural;
70
+ /** All frames this package omitted; the sum of the four disjoint components below. */
71
+ readonly discarded: Schema.Natural;
72
+ /** Evicted by the frame-count or buffered-byte bound. */
73
+ readonly overflow: Schema.Natural;
74
+ readonly duplicates: Schema.Natural;
75
+ /** Arrived after a newer frame was accepted; never reordered in. */
76
+ readonly late: Schema.Natural;
77
+ /** Other refused frames, including malformed data, bounds and undelivered scope cleanup. */
78
+ readonly rejected: Schema.Natural;
79
+ readonly peakBufferedFrames: Schema.Natural;
80
+ readonly peakBufferedBytes: Schema.Natural;
81
+ readonly bufferedFrames: Schema.Natural;
82
+ readonly bufferedBytes: Schema.Natural;
83
+ readonly sourceFirstMillis: Schema.NullOr<Schema.Finite>;
84
+ readonly sourceLastMillis: Schema.NullOr<Schema.Finite>;
85
+ /**
86
+ * The captured frame's address when this interval began watching it: the URL of document 0.
87
+ * It is read in the same turn the watch is installed, so no navigation can fall between them.
88
+ */
89
+ readonly initialUrl: Schema.NullOr<Schema.String>;
90
+ /**
91
+ * Each main-frame navigation a `page` interval observed, in order, with the last frame
92
+ * received before it and the address the new document committed. The native screencast is
93
+ * never restarted for one, so a boundary is not a gap this package introduced; what Chromium
94
+ * omitted while loading stays `upstreamDrops`. A boundary is the commit. When that navigation
95
+ * started and when its document finished loading are the caller's to stamp, on this same
96
+ * clock, around the operation that caused it. A title is page state, not part of a transition.
97
+ */
98
+ readonly documentBoundaries: Schema.$Array<Schema.Struct<{
99
+ readonly document: Schema.Natural;
100
+ readonly observedMonotonicNanos: Schema.BigInt;
101
+ readonly afterSequence: Schema.NullOr<Schema.Natural>;
102
+ readonly url: Schema.NullOr<Schema.String>;
103
+ }>>;
104
+ /**
105
+ * More navigations were observed than are recorded above, so the earliest were let go: the
106
+ * record keeps the latest 64. Frames still count them all.
107
+ */
108
+ readonly documentBoundariesTruncated: Schema.Boolean;
109
+ readonly nativeStop: Schema.Literals<readonly ["confirmed", "unconfirmed"]>;
110
+ /** Package accounting cannot measure frames omitted by Chromium, transport, or the provider. */
111
+ readonly upstreamDrops: Schema.Literal<"unknown">;
112
+ readonly error: Schema.optionalKey<typeof BrowserError>;
113
+ }>, {}>;
114
+ export declare class CaptureSummary extends CaptureSummary_base {}
115
+ declare const CaptureSnapshot_base: Schema.Class<CaptureSnapshot, Schema.Struct<{
116
+ readonly target: typeof Target;
117
+ readonly received: Schema.Natural;
118
+ readonly delivered: Schema.Natural;
119
+ readonly discarded: Schema.Natural;
120
+ readonly overflow: Schema.Natural;
121
+ readonly duplicates: Schema.Natural;
122
+ readonly late: Schema.Natural;
123
+ readonly rejected: Schema.Natural;
124
+ readonly peakBufferedFrames: Schema.Natural;
125
+ readonly peakBufferedBytes: Schema.Natural;
126
+ readonly bufferedFrames: Schema.Natural;
127
+ readonly bufferedBytes: Schema.Natural;
128
+ readonly sourceFirstMillis: Schema.NullOr<Schema.Finite>;
129
+ readonly sourceLastMillis: Schema.NullOr<Schema.Finite>;
130
+ readonly initialUrl: Schema.NullOr<Schema.String>;
131
+ readonly documentBoundaries: Schema.$Array<Schema.Struct<{
132
+ readonly document: Schema.Natural;
133
+ readonly observedMonotonicNanos: Schema.BigInt;
134
+ readonly afterSequence: Schema.NullOr<Schema.Natural>;
135
+ readonly url: Schema.NullOr<Schema.String>;
136
+ }>>;
137
+ readonly documentBoundariesTruncated: Schema.Boolean;
138
+ readonly upstreamDrops: Schema.Literal<"unknown">;
139
+ readonly error: Schema.optionalKey<typeof BrowserError>;
140
+ readonly phase: Schema.Literals<readonly ["capturing", "stopping", "stopped"]>;
141
+ readonly observedMonotonicNanos: Schema.BigInt;
142
+ /** Keeps counting when the bounded boundary prefix is truncated. */
143
+ readonly currentDocument: Schema.Natural;
144
+ /** No reason is reported while the capture still accepts frames. */
145
+ readonly reason: Schema.NullOr<Schema.String>;
146
+ /** Null until the native cleanup attempt settles; unconfirmed never means stopped remotely. */
147
+ readonly nativeStop: Schema.NullOr<Schema.Literals<readonly ["confirmed", "unconfirmed"]>>;
148
+ }>, {}>;
149
+ /**
150
+ * Host-side metadata at one instant, without reading or waking the page. The boundary prefix
151
+ * and loss counters are the same facts as the final summary, independent of frame consumption.
152
+ * `stopped` means native cleanup settled; buffered frames may still be drained afterwards.
153
+ */
154
+ export declare class CaptureSnapshot extends CaptureSnapshot_base {}
155
+ //#endregion
156
+ export {};
157
+ //# sourceMappingURL=CaptureData.d.mts.map
@@ -0,0 +1,2 @@
1
+ import { a as CapturedFrame, i as CaptureSummary, n as CaptureSize, r as CaptureSnapshot, t as CaptureOptions } from "./CaptureData-B5-mXlyq.mjs";
2
+ export { CaptureOptions, CaptureSize, CaptureSnapshot, CaptureSummary, CapturedFrame };
@@ -0,0 +1,85 @@
1
+ import { BrowserError, InitializationError } from "./Errors.mjs";
2
+ import { a as BrowserPolicy, et as Viewport, n as AutomationOptions } from "./BrowserData-CRuxEZcn.mjs";
3
+ import { BrowserSession, OpenOptions } from "./Browser.mjs";
4
+ import { Context, Crypto, Effect, Layer, Option, Redacted, Schema, Scope } from "effect";
5
+ //#region src/internal/chromium/Data.d.ts
6
+ declare const ChromiumReference_base: Schema.Class<ChromiumReference, Schema.Struct<{
7
+ readonly provider: Schema.Literal<"chromium">;
8
+ readonly id: Schema.NonEmptyString;
9
+ }>, {}>;
10
+ /** Identifies this Chromium ownership lifetime, not a reusable endpoint. */
11
+ export declare class ChromiumReference extends ChromiumReference_base {}
12
+ declare const ChromiumCleanupIssue_base: Schema.Class<ChromiumCleanupIssue, Schema.Struct<{
13
+ readonly step: Schema.Literals<readonly ["fence", "capture", "initialization", "disconnect", "terminate", "profile"]>;
14
+ readonly reason: Schema.Literals<readonly ["timeout", "failed", "interrupted"]>;
15
+ }>, {}>;
16
+ export declare class ChromiumCleanupIssue extends ChromiumCleanupIssue_base {}
17
+ declare const ChromiumCleanupResult_base: Schema.Class<ChromiumCleanupResult, Schema.Struct<{
18
+ readonly reference: typeof ChromiumReference;
19
+ readonly ownership: Schema.Literals<readonly ["owned", "borrowed"]>;
20
+ readonly connection: Schema.Literals<readonly ["closed", "failed", "not-connected", "pending"]>;
21
+ readonly process: Schema.Literals<readonly ["terminated", "unknown", "not-owned"]>;
22
+ readonly issues: Schema.$Array<typeof ChromiumCleanupIssue>;
23
+ }>, {}>;
24
+ /** Connection teardown and observed process exit are separate facts; no provider status exists. */
25
+ export declare class ChromiumCleanupResult extends ChromiumCleanupResult_base {}
26
+ export declare const ChromiumLaunch: Schema.Struct<{
27
+ readonly executablePath: Schema.optionalKey<Schema.NonEmptyString>;
28
+ readonly headless: Schema.optionalKey<Schema.Boolean>;
29
+ /** Enabled by default; a trusted host must explicitly choose a sandbox exception. */
30
+ readonly chromiumSandbox: Schema.optionalKey<Schema.Boolean>;
31
+ readonly args: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
32
+ readonly proxy: Schema.optionalKey<Schema.Struct<{
33
+ readonly server: Schema.NonEmptyString;
34
+ readonly bypass: Schema.optionalKey<Schema.NonEmptyString>;
35
+ }>>;
36
+ readonly startupTimeoutMillis: Schema.optionalKey<Schema.Int>;
37
+ }>;
38
+ export type ChromiumLaunch = typeof ChromiumLaunch.Type;
39
+ //#endregion
40
+ //#region src/Chromium.d.ts
41
+ /** Host-only process configuration. Building this layer neither loads Playwright nor starts Chromium. */
42
+ export interface ChromiumOptions extends AutomationOptions {
43
+ readonly launch?: ChromiumLaunch;
44
+ readonly viewport?: Viewport;
45
+ readonly onCleanup?: (result: ChromiumCleanupResult) => Effect.Effect<void>;
46
+ }
47
+ /** An owned or borrowed Chromium lifetime with one modeled browser connection. */
48
+ export interface ChromiumSession<E = never> extends BrowserSession<E> {
49
+ readonly reference: ChromiumReference;
50
+ readonly closeChecked: Effect.Effect<ChromiumCleanupResult, BrowserError>;
51
+ readonly close: Effect.Effect<ChromiumCleanupResult>;
52
+ readonly cleanupResult: Effect.Effect<Option.Option<ChromiumCleanupResult>>;
53
+ }
54
+ export interface ChromiumAcquisition<E = never> {
55
+ readonly reference: ChromiumReference;
56
+ readonly failure: Effect.Effect<never, E | InitializationError>;
57
+ readonly connect: Effect.Effect<ChromiumSession<E>, BrowserError | InitializationError | E>;
58
+ readonly close: Effect.Effect<ChromiumCleanupResult>;
59
+ }
60
+ export interface ChromiumAttachRequest<E = never, R = never> extends OpenOptions<E, R> {
61
+ readonly policy: BrowserPolicy;
62
+ /** Resolve this exact target; without it, multiple open pages are an ambiguity error. */
63
+ readonly target?: {
64
+ readonly targetId: string;
65
+ };
66
+ }
67
+ declare const Chromium_base: Context.ServiceClass<Chromium, "effect-browser/Chromium", {
68
+ readonly acquire: <E = never, R = never>(policy: BrowserPolicy, request?: OpenOptions<E, R>) => Effect.Effect<ChromiumAcquisition<E>, BrowserError, Scope.Scope | Exclude<R, Scope.Scope>>;
69
+ readonly launch: <E = never, R = never>(policy: BrowserPolicy, request?: OpenOptions<E, R>) => Effect.Effect<ChromiumSession<E>, BrowserError | InitializationError | E, Scope.Scope | Exclude<R, Scope.Scope>>;
70
+ /** A concrete loopback ws://.../devtools/browser/... endpoint; this scope owns only its connection. */
71
+ readonly attach: <E = never, R = never>(endpoint: Redacted.Redacted<string>, request: ChromiumAttachRequest<E, R>) => Effect.Effect<ChromiumSession<E>, BrowserError | InitializationError | E, Scope.Scope | Exclude<R, Scope.Scope>>;
72
+ }>;
73
+ export declare class Chromium extends Chromium_base {
74
+ /** Launch through the configured service; compose with Browser.scoped for supervised ownership. */
75
+ static launch<E = never, R = never>(policy: BrowserPolicy, request?: OpenOptions<E, R>): Effect.Effect<ChromiumSession<E>, E | BrowserError | InitializationError, Chromium | Scope.Scope | Exclude<R, Scope.Scope>>;
76
+ /** Acquire the process lifetime before connecting, using the caller's scope. */
77
+ static acquire<E = never, R = never>(policy: BrowserPolicy, request?: OpenOptions<E, R>): Effect.Effect<ChromiumAcquisition<E>, BrowserError, Chromium | Scope.Scope | Exclude<R, Scope.Scope>>;
78
+ /** Borrow a concrete loopback endpoint; cleanup never terminates its external process. */
79
+ static attach<E = never, R = never>(endpoint: Redacted.Redacted<string>, request: ChromiumAttachRequest<E, R>): Effect.Effect<ChromiumSession<E>, E | BrowserError | InitializationError, Chromium | Scope.Scope | Exclude<R, Scope.Scope>>;
80
+ /** Chromium references, connection ids and handoff tokens come from the required `Crypto`. */
81
+ static layer(options?: ChromiumOptions): Layer.Layer<Chromium, BrowserError, Crypto.Crypto>;
82
+ }
83
+ //#endregion
84
+ export {};
85
+ //# sourceMappingURL=Chromium.d.mts.map