effect-browser 0.2.0-beta.6 → 0.2.0-beta.7

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.
@@ -1,5 +1,5 @@
1
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-DPh3Oaof.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-KHk4o__c.mjs";
3
3
  import { BrowserSession, OpenOptions } from "./Browser.mjs";
4
4
  import { Crypto, Effect, Option, Redacted, Schema, Scope } from "effect";
5
5
  //#region src/internal/browser/ConnectionCleanup.d.ts
@@ -140,4 +140,4 @@ declare const make: (options: RuntimeOptions) => Effect.Effect<Runtime, BrowserE
140
140
  //#endregion
141
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
142
  export {};
143
- //# sourceMappingURL=BrowserRuntime-BBAjpVFa.d.mts.map
143
+ //# sourceMappingURL=BrowserRuntime-hxkTNlRa.d.mts.map
@@ -1,3 +1,3 @@
1
- import { _ as ConnectionCleanup, a as DownloadEvent, b as noConnection, c as Lifetime, d as Runtime, f as RuntimeOptions, g as CleanupStep, h as playwright, i as Connection, l as PlaywrightOptions, m as make, n as Acquisition, o as FileRequest, p as Source, r as BrowserBinding, s as Integration, t as AcquireOptions, u as ResolvedFileSelection, v as ConnectionState, x as reported, y as cleanupStep } from "./BrowserRuntime-BBAjpVFa.mjs";
1
+ import { _ as ConnectionCleanup, a as DownloadEvent, b as noConnection, c as Lifetime, d as Runtime, f as RuntimeOptions, g as CleanupStep, h as playwright, i as Connection, l as PlaywrightOptions, m as make, n as Acquisition, o as FileRequest, p as Source, r as BrowserBinding, s as Integration, t as AcquireOptions, u as ResolvedFileSelection, v as ConnectionState, x as reported, y as cleanupStep } from "./BrowserRuntime-hxkTNlRa.mjs";
2
2
  export { AcquireOptions, Acquisition, BrowserBinding, type CleanupStep, Connection, type ConnectionCleanup, type ConnectionState, DownloadEvent, FileRequest, Integration, Lifetime, PlaywrightOptions, ResolvedFileSelection, Runtime, RuntimeOptions, Source, cleanupStep, make, noConnection, playwright, reported };
3
3
  export {};
@@ -1,2 +1,2 @@
1
- import { a as cleanupStep, n as make, o as noConnection, r as playwright, s as reported, t as DownloadEvent } from "./BrowserRuntime-DImn_Oe_.mjs";
1
+ import { a as cleanupStep, n as make, o as noConnection, r as playwright, s as reported, t as DownloadEvent } from "./BrowserRuntime-Cr76CN4I.mjs";
2
2
  export { DownloadEvent, cleanupStep, make, noConnection, playwright, reported };
package/dist/Capture.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BrowserError, Reasons } from "./Errors.mjs";
2
2
  import { PageInfo } from "./BrowserData.mjs";
3
- import { n as captureParent, r as jpegGeometry } from "./Association-BsSfBYVx.mjs";
3
+ import { n as captureParent, r as jpegGeometry } from "./Association-CH3kPHXE.mjs";
4
4
  import { a as CapturedFrame, c as CaptureMaxima, i as CaptureSummary, n as CaptureSize, o as CaptureDefaults, r as CaptureSnapshot, s as CaptureLimits, t as CaptureOptions } from "./CaptureData-Dys0Ko9d.mjs";
5
5
  import { Cause, Clock, Crypto, Deferred, Effect, Exit, Option, Queue, Schema, Stream } from "effect";
6
6
  //#region src/internal/capture/FrameBuffer.ts
@@ -1,5 +1,5 @@
1
1
  import { BrowserError } from "./Errors.mjs";
2
- import { N as PageInfo, X as Target } from "./BrowserData-DPh3Oaof.mjs";
2
+ import { N as PageInfo, X as Target } from "./BrowserData-KHk4o__c.mjs";
3
3
  import { Schema } from "effect";
4
4
  //#region src/CaptureData.d.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { BrowserError, InitializationError } from "./Errors.mjs";
2
- import { a as BrowserPolicy, et as Viewport, n as AutomationOptions } from "./BrowserData-DPh3Oaof.mjs";
2
+ import { a as BrowserPolicy, et as Viewport, n as AutomationOptions } from "./BrowserData-KHk4o__c.mjs";
3
3
  import { BrowserSession, OpenOptions } from "./Browser.mjs";
4
4
  import { Context, Crypto, Effect, Layer, Option, Redacted, Schema, Scope } from "effect";
5
5
  //#region src/internal/chromium/Data.d.ts
package/dist/Chromium.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BrowserError, Reasons } from "./Errors.mjs";
2
2
  import { Identifier } from "./BrowserData.mjs";
3
- import { a as cleanupStep, c as checked, i as randomUuid, n as make, s as reported } from "./BrowserRuntime-DImn_Oe_.mjs";
3
+ import { a as cleanupStep, c as checked, i as randomUuid, n as make, s as reported } from "./BrowserRuntime-Cr76CN4I.mjs";
4
4
  import { Clock, Context, Crypto, Duration, Effect, Exit, Layer, Option, Path, Redacted, Schema } from "effect";
5
5
  import { spawn } from "node:child_process";
6
6
  import { mkdtemp, readFile, rm } from "node:fs/promises";
package/dist/Errors.d.mts CHANGED
@@ -5,7 +5,7 @@ import { Schema } from "effect";
5
5
  * when it admits an operation, so a native step's own name can never become API, and a new
6
6
  * spelling is a deliberate edit here rather than a string that merely compiles.
7
7
  */
8
- export declare const BrowserOperation: Schema.Literals<readonly ["configure", "launch", "connect", "reconnect", "detach", "disconnect", "close", "handoff", "resume", "live-view", "target", "handle", "list-pages", "list-frames", "select-page", "select-frame", "new-page", "close-page", "resize", "ready", "observe", "checkpoint", "control-facts", "revalidate", "read-text", "screenshot", "wait", "navigate", "navigate-stop", "click", "fill", "fill-form", "select-option", "scroll", "click-and-wait", "download-action", "select-files", "file-chooser", "action-result", "pointer-move", "hover", "wheel", "press", "type", "page-control", "page-state", "page-suspend", "page-resume", "capture", "capture-start", "capture-stop", "capture-consume"]>;
8
+ export declare const BrowserOperation: Schema.Literals<readonly ["configure", "launch", "connect", "reconnect", "detach", "disconnect", "close", "handoff", "resume", "live-view", "target", "handle", "list-pages", "describe-page", "list-frames", "select-page", "select-frame", "new-page", "close-page", "resize", "ready", "observe", "checkpoint", "control-facts", "revalidate", "read-text", "screenshot", "wait", "navigate", "navigate-stop", "click", "fill", "fill-form", "select-option", "scroll", "click-and-wait", "download-action", "select-files", "file-chooser", "action-result", "pointer-move", "hover", "wheel", "press", "type", "page-control", "page-state", "page-suspend", "page-resume", "capture", "capture-start", "capture-stop", "capture-consume"]>;
9
9
  export type BrowserOperation = typeof BrowserOperation.Type;
10
10
  /** Dispatch evidence belongs to the operation, independently of its failure reason. */
11
11
  export declare const BrowserOutcome: Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>;
@@ -38,6 +38,7 @@ export declare const Reasons: {
38
38
  }>;
39
39
  readonly Provider: Schema.TaggedStruct<"Provider", {
40
40
  readonly status: Schema.optionalKey<Schema.Int>;
41
+ readonly detail: Schema.optionalKey<Schema.String>;
41
42
  }>;
42
43
  readonly Authorization: Schema.TaggedStruct<"Authorization", {}>;
43
44
  readonly RateLimited: Schema.TaggedStruct<"RateLimited", {
@@ -69,6 +70,7 @@ export declare const BrowserReason: Schema.Union<(Schema.TaggedStruct<"Active",
69
70
  readonly path: Schema.optionalKey<Schema.String>;
70
71
  }> | Schema.TaggedStruct<"NotFocused", {}> | Schema.TaggedStruct<"NotFound", {}> | Schema.TaggedStruct<"NotVisible", {}> | Schema.TaggedStruct<"Provider", {
71
72
  readonly status: Schema.optionalKey<Schema.Int>;
73
+ readonly detail: Schema.optionalKey<Schema.String>;
72
74
  }> | Schema.TaggedStruct<"RateLimited", {
73
75
  readonly retryAfterMillis: Schema.optionalKey<Schema.Natural>;
74
76
  }> | Schema.TaggedStruct<"Resized", {}> | Schema.TaggedStruct<"Stale", {}> | Schema.TaggedStruct<"TargetChanged", {}> | Schema.TaggedStruct<"Timeout", {}> | Schema.TaggedStruct<"Timestamp", {}> | Schema.TaggedStruct<"Transport", {
@@ -76,7 +78,7 @@ export declare const BrowserReason: Schema.Union<(Schema.TaggedStruct<"Active",
76
78
  }> | Schema.TaggedStruct<"UnregisteredSession", {}> | Schema.TaggedStruct<"UnsafeUrl", {}> | Schema.TaggedStruct<"Unsupported", {}>)[]>;
77
79
  export type BrowserReason = typeof BrowserReason.Type;
78
80
  declare const BrowserError_base: Schema.Class<BrowserError, Schema.TaggedStruct<"BrowserError", {
79
- readonly operation: Schema.Literals<readonly ["configure", "launch", "connect", "reconnect", "detach", "disconnect", "close", "handoff", "resume", "live-view", "target", "handle", "list-pages", "list-frames", "select-page", "select-frame", "new-page", "close-page", "resize", "ready", "observe", "checkpoint", "control-facts", "revalidate", "read-text", "screenshot", "wait", "navigate", "navigate-stop", "click", "fill", "fill-form", "select-option", "scroll", "click-and-wait", "download-action", "select-files", "file-chooser", "action-result", "pointer-move", "hover", "wheel", "press", "type", "page-control", "page-state", "page-suspend", "page-resume", "capture", "capture-start", "capture-stop", "capture-consume"]>;
81
+ readonly operation: Schema.Literals<readonly ["configure", "launch", "connect", "reconnect", "detach", "disconnect", "close", "handoff", "resume", "live-view", "target", "handle", "list-pages", "describe-page", "list-frames", "select-page", "select-frame", "new-page", "close-page", "resize", "ready", "observe", "checkpoint", "control-facts", "revalidate", "read-text", "screenshot", "wait", "navigate", "navigate-stop", "click", "fill", "fill-form", "select-option", "scroll", "click-and-wait", "download-action", "select-files", "file-chooser", "action-result", "pointer-move", "hover", "wheel", "press", "type", "page-control", "page-state", "page-suspend", "page-resume", "capture", "capture-start", "capture-stop", "capture-consume"]>;
80
82
  readonly reason: Schema.Union<(Schema.TaggedStruct<"Active", {}> | Schema.TaggedStruct<"Ambiguous", {}> | Schema.TaggedStruct<"Authorization", {}> | Schema.TaggedStruct<"Busy", {}> | Schema.TaggedStruct<"Closed", {}> | Schema.TaggedStruct<"Configuration", {
81
83
  readonly path: Schema.optionalKey<Schema.String>;
82
84
  }> | Schema.TaggedStruct<"ContentType", {}> | Schema.TaggedStruct<"ContextLease", {}> | Schema.TaggedStruct<"Denied", {}> | Schema.TaggedStruct<"Disabled", {}> | Schema.TaggedStruct<"Disconnected", {}> | Schema.TaggedStruct<"Expired", {}> | Schema.TaggedStruct<"Failed", {}> | Schema.TaggedStruct<"Interrupted", {}> | Schema.TaggedStruct<"Limit", {
@@ -87,6 +89,7 @@ declare const BrowserError_base: Schema.Class<BrowserError, Schema.TaggedStruct<
87
89
  readonly path: Schema.optionalKey<Schema.String>;
88
90
  }> | Schema.TaggedStruct<"NotFocused", {}> | Schema.TaggedStruct<"NotFound", {}> | Schema.TaggedStruct<"NotVisible", {}> | Schema.TaggedStruct<"Provider", {
89
91
  readonly status: Schema.optionalKey<Schema.Int>;
92
+ readonly detail: Schema.optionalKey<Schema.String>;
90
93
  }> | Schema.TaggedStruct<"RateLimited", {
91
94
  readonly retryAfterMillis: Schema.optionalKey<Schema.Natural>;
92
95
  }> | Schema.TaggedStruct<"Resized", {}> | Schema.TaggedStruct<"Stale", {}> | Schema.TaggedStruct<"TargetChanged", {}> | Schema.TaggedStruct<"Timeout", {}> | Schema.TaggedStruct<"Timestamp", {}> | Schema.TaggedStruct<"Transport", {
package/dist/Errors.mjs CHANGED
@@ -19,6 +19,7 @@ const BrowserOperation = Schema.Literals([
19
19
  "target",
20
20
  "handle",
21
21
  "list-pages",
22
+ "describe-page",
22
23
  "list-frames",
23
24
  "select-page",
24
25
  "select-frame",
@@ -85,6 +86,11 @@ const LimitDimension = Schema.Literals([
85
86
  "pixels"
86
87
  ]);
87
88
  const SchemaPath = Schema.String.check(Schema.isMaxLength(512));
89
+ /**
90
+ * What the native engine said about a failure it raised: its first line, without escape codes,
91
+ * with every address cut to its origin. A host diagnostic, never part of the model projection.
92
+ */
93
+ const NativeDetail = Schema.String.check(Schema.isMaxLength(512));
88
94
  /** Validated constructors for host reasons. The model receives a separate bounded projection. */
89
95
  const Reasons = {
90
96
  Configuration: Schema.TaggedStruct("Configuration", { path: Schema.optionalKey(SchemaPath) }),
@@ -103,7 +109,10 @@ const Reasons = {
103
109
  }),
104
110
  Timeout: Schema.TaggedStruct("Timeout", {}),
105
111
  Transport: Schema.TaggedStruct("Transport", { status: Schema.optionalKey(Schema.Int) }),
106
- Provider: Schema.TaggedStruct("Provider", { status: Schema.optionalKey(Schema.Int) }),
112
+ Provider: Schema.TaggedStruct("Provider", {
113
+ status: Schema.optionalKey(Schema.Int),
114
+ detail: Schema.optionalKey(NativeDetail)
115
+ }),
107
116
  Authorization: Schema.TaggedStruct("Authorization", {}),
108
117
  RateLimited: Schema.TaggedStruct("RateLimited", { retryAfterMillis: Schema.optionalKey(Schema.Natural) }),
109
118
  Disconnected: Schema.TaggedStruct("Disconnected", {}),
@@ -1 +1 @@
1
- {"version":3,"file":"Errors.mjs","names":[],"sources":["../src/Errors.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\n/**\n * What a caller asked the owned browser to do. The vocabulary is closed: the owner stamps it\n * when it admits an operation, so a native step's own name can never become API, and a new\n * spelling is a deliberate edit here rather than a string that merely compiles.\n */\nexport const BrowserOperation = Schema.Literals([\n // configuration and lifetime\n \"configure\",\n \"launch\",\n \"connect\",\n \"reconnect\",\n \"detach\",\n \"disconnect\",\n \"close\",\n \"handoff\",\n \"resume\",\n \"live-view\",\n // targets\n \"target\",\n \"handle\",\n \"list-pages\",\n \"list-frames\",\n \"select-page\",\n \"select-frame\",\n \"new-page\",\n \"close-page\",\n \"resize\",\n // reading\n \"ready\",\n \"observe\",\n \"checkpoint\",\n \"control-facts\",\n \"revalidate\",\n \"read-text\",\n \"screenshot\",\n \"wait\",\n // input\n \"navigate\",\n \"navigate-stop\",\n \"click\",\n \"fill\",\n \"fill-form\",\n \"select-option\",\n \"scroll\",\n \"click-and-wait\",\n \"download-action\",\n \"select-files\",\n \"file-chooser\",\n \"action-result\",\n // native pointer input\n \"pointer-move\",\n \"hover\",\n \"wheel\",\n // native key input\n \"press\",\n \"type\",\n // page control\n \"page-control\",\n \"page-state\",\n \"page-suspend\",\n \"page-resume\",\n // capture\n \"capture\",\n \"capture-start\",\n \"capture-stop\",\n \"capture-consume\",\n]);\n\nexport type BrowserOperation = typeof BrowserOperation.Type;\n\n/** Dispatch evidence belongs to the operation, independently of its failure reason. */\nexport const BrowserOutcome = Schema.Literals([\"undispatched\", \"rejected\", \"unknown\"]);\n\nexport type BrowserOutcome = typeof BrowserOutcome.Type;\n\n/** Limits report measured producer facts; an unavailable measurement is never invented. */\nexport const LimitDimension = Schema.Literals([\n \"actions\",\n \"elapsed\",\n \"returned-bytes\",\n \"pages\",\n \"frames\",\n \"frame-depth\",\n \"buffered-frames\",\n \"buffered-bytes\",\n \"host-reads\",\n \"controls\",\n \"text\",\n \"captures\",\n \"frame-bytes\",\n \"width\",\n \"height\",\n \"pixels\",\n]);\n\nconst SchemaPath = Schema.String.check(Schema.isMaxLength(512));\n\n/** Validated constructors for host reasons. The model receives a separate bounded projection. */\nexport const Reasons = {\n Configuration: Schema.TaggedStruct(\"Configuration\", { path: Schema.optionalKey(SchemaPath) }),\n UnregisteredSession: Schema.TaggedStruct(\"UnregisteredSession\", {}),\n Unsupported: Schema.TaggedStruct(\"Unsupported\", {}),\n Busy: Schema.TaggedStruct(\"Busy\", {}),\n Closed: Schema.TaggedStruct(\"Closed\", {}),\n Stale: Schema.TaggedStruct(\"Stale\", {}),\n NotFound: Schema.TaggedStruct(\"NotFound\", {}),\n Ambiguous: Schema.TaggedStruct(\"Ambiguous\", {}),\n Malformed: Schema.TaggedStruct(\"Malformed\", { path: Schema.optionalKey(SchemaPath) }),\n Limit: Schema.TaggedStruct(\"Limit\", {\n dimension: LimitDimension,\n maximum: Schema.Natural,\n observed: Schema.Natural,\n }),\n Timeout: Schema.TaggedStruct(\"Timeout\", {}),\n Transport: Schema.TaggedStruct(\"Transport\", { status: Schema.optionalKey(Schema.Int) }),\n Provider: Schema.TaggedStruct(\"Provider\", { status: Schema.optionalKey(Schema.Int) }),\n Authorization: Schema.TaggedStruct(\"Authorization\", {}),\n RateLimited: Schema.TaggedStruct(\"RateLimited\", {\n retryAfterMillis: Schema.optionalKey(Schema.Natural),\n }),\n Disconnected: Schema.TaggedStruct(\"Disconnected\", {}),\n Active: Schema.TaggedStruct(\"Active\", {}),\n Disabled: Schema.TaggedStruct(\"Disabled\", {}),\n Expired: Schema.TaggedStruct(\"Expired\", {}),\n Failed: Schema.TaggedStruct(\"Failed\", {}),\n UnsafeUrl: Schema.TaggedStruct(\"UnsafeUrl\", {}),\n ContentType: Schema.TaggedStruct(\"ContentType\", {}),\n Timestamp: Schema.TaggedStruct(\"Timestamp\", {}),\n Resized: Schema.TaggedStruct(\"Resized\", {}),\n TargetChanged: Schema.TaggedStruct(\"TargetChanged\", {}),\n Interrupted: Schema.TaggedStruct(\"Interrupted\", {}),\n ContextLease: Schema.TaggedStruct(\"ContextLease\", {}),\n NotVisible: Schema.TaggedStruct(\"NotVisible\", {}),\n Denied: Schema.TaggedStruct(\"Denied\", {}),\n NotFocused: Schema.TaggedStruct(\"NotFocused\", {}),\n} as const;\n\nexport const BrowserReason = Schema.Union(Object.values(Reasons));\n\nexport type BrowserReason = typeof BrowserReason.Type;\n\nexport class BrowserError extends Schema.TaggedError<BrowserError>()(\"BrowserError\", {\n operation: BrowserOperation,\n reason: BrowserReason,\n outcome: BrowserOutcome,\n}) {}\n\nexport class InitializationError extends Schema.TaggedError<InitializationError>()(\n \"InitializationError\",\n {\n operation: Schema.Literals([\"configure\", \"register\", \"ready\", \"callback\", \"dispose\"]),\n step: Schema.String.check(Schema.isMaxLength(128)),\n reason: Schema.Literals([\n \"configuration\",\n \"unsupported\",\n \"origin\",\n \"stale\",\n \"busy\",\n \"closed\",\n \"timeout\",\n \"input\",\n \"output\",\n \"native\",\n ]),\n },\n) {}\n"],"mappings":";;;;;;;AAOA,MAAa,mBAAmB,OAAO,SAAS;CAE9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA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AAC,CAAC"}
1
+ {"version":3,"file":"Errors.mjs","names":[],"sources":["../src/Errors.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\n/**\n * What a caller asked the owned browser to do. The vocabulary is closed: the owner stamps it\n * when it admits an operation, so a native step's own name can never become API, and a new\n * spelling is a deliberate edit here rather than a string that merely compiles.\n */\nexport const BrowserOperation = Schema.Literals([\n // configuration and lifetime\n \"configure\",\n \"launch\",\n \"connect\",\n \"reconnect\",\n \"detach\",\n \"disconnect\",\n \"close\",\n \"handoff\",\n \"resume\",\n \"live-view\",\n // targets\n \"target\",\n \"handle\",\n \"list-pages\",\n \"describe-page\",\n \"list-frames\",\n \"select-page\",\n \"select-frame\",\n \"new-page\",\n \"close-page\",\n \"resize\",\n // reading\n \"ready\",\n \"observe\",\n \"checkpoint\",\n \"control-facts\",\n \"revalidate\",\n \"read-text\",\n \"screenshot\",\n \"wait\",\n // input\n \"navigate\",\n \"navigate-stop\",\n \"click\",\n \"fill\",\n \"fill-form\",\n \"select-option\",\n \"scroll\",\n \"click-and-wait\",\n \"download-action\",\n \"select-files\",\n \"file-chooser\",\n \"action-result\",\n // native pointer input\n \"pointer-move\",\n \"hover\",\n \"wheel\",\n // native key input\n \"press\",\n \"type\",\n // page control\n \"page-control\",\n \"page-state\",\n \"page-suspend\",\n \"page-resume\",\n // capture\n \"capture\",\n \"capture-start\",\n \"capture-stop\",\n \"capture-consume\",\n]);\n\nexport type BrowserOperation = typeof BrowserOperation.Type;\n\n/** Dispatch evidence belongs to the operation, independently of its failure reason. */\nexport const BrowserOutcome = Schema.Literals([\"undispatched\", \"rejected\", \"unknown\"]);\n\nexport type BrowserOutcome = typeof BrowserOutcome.Type;\n\n/** Limits report measured producer facts; an unavailable measurement is never invented. */\nexport const LimitDimension = Schema.Literals([\n \"actions\",\n \"elapsed\",\n \"returned-bytes\",\n \"pages\",\n \"frames\",\n \"frame-depth\",\n \"buffered-frames\",\n \"buffered-bytes\",\n \"host-reads\",\n \"controls\",\n \"text\",\n \"captures\",\n \"frame-bytes\",\n \"width\",\n \"height\",\n \"pixels\",\n]);\n\nconst SchemaPath = Schema.String.check(Schema.isMaxLength(512));\n\n/**\n * What the native engine said about a failure it raised: its first line, without escape codes,\n * with every address cut to its origin. A host diagnostic, never part of the model projection.\n */\nconst NativeDetail = Schema.String.check(Schema.isMaxLength(512));\n\n/** Validated constructors for host reasons. The model receives a separate bounded projection. */\nexport const Reasons = {\n Configuration: Schema.TaggedStruct(\"Configuration\", { path: Schema.optionalKey(SchemaPath) }),\n UnregisteredSession: Schema.TaggedStruct(\"UnregisteredSession\", {}),\n Unsupported: Schema.TaggedStruct(\"Unsupported\", {}),\n Busy: Schema.TaggedStruct(\"Busy\", {}),\n Closed: Schema.TaggedStruct(\"Closed\", {}),\n Stale: Schema.TaggedStruct(\"Stale\", {}),\n NotFound: Schema.TaggedStruct(\"NotFound\", {}),\n Ambiguous: Schema.TaggedStruct(\"Ambiguous\", {}),\n Malformed: Schema.TaggedStruct(\"Malformed\", { path: Schema.optionalKey(SchemaPath) }),\n Limit: Schema.TaggedStruct(\"Limit\", {\n dimension: LimitDimension,\n maximum: Schema.Natural,\n observed: Schema.Natural,\n }),\n Timeout: Schema.TaggedStruct(\"Timeout\", {}),\n Transport: Schema.TaggedStruct(\"Transport\", { status: Schema.optionalKey(Schema.Int) }),\n Provider: Schema.TaggedStruct(\"Provider\", {\n status: Schema.optionalKey(Schema.Int),\n detail: Schema.optionalKey(NativeDetail),\n }),\n Authorization: Schema.TaggedStruct(\"Authorization\", {}),\n RateLimited: Schema.TaggedStruct(\"RateLimited\", {\n retryAfterMillis: Schema.optionalKey(Schema.Natural),\n }),\n Disconnected: Schema.TaggedStruct(\"Disconnected\", {}),\n Active: Schema.TaggedStruct(\"Active\", {}),\n Disabled: Schema.TaggedStruct(\"Disabled\", {}),\n Expired: Schema.TaggedStruct(\"Expired\", {}),\n Failed: Schema.TaggedStruct(\"Failed\", {}),\n UnsafeUrl: Schema.TaggedStruct(\"UnsafeUrl\", {}),\n ContentType: Schema.TaggedStruct(\"ContentType\", {}),\n Timestamp: Schema.TaggedStruct(\"Timestamp\", {}),\n Resized: Schema.TaggedStruct(\"Resized\", {}),\n TargetChanged: Schema.TaggedStruct(\"TargetChanged\", {}),\n Interrupted: Schema.TaggedStruct(\"Interrupted\", {}),\n ContextLease: Schema.TaggedStruct(\"ContextLease\", {}),\n NotVisible: Schema.TaggedStruct(\"NotVisible\", {}),\n Denied: Schema.TaggedStruct(\"Denied\", {}),\n NotFocused: Schema.TaggedStruct(\"NotFocused\", {}),\n} as const;\n\nexport const BrowserReason = Schema.Union(Object.values(Reasons));\n\nexport type BrowserReason = typeof BrowserReason.Type;\n\nexport class BrowserError extends Schema.TaggedError<BrowserError>()(\"BrowserError\", {\n operation: BrowserOperation,\n reason: BrowserReason,\n outcome: BrowserOutcome,\n}) {}\n\nexport class InitializationError extends Schema.TaggedError<InitializationError>()(\n \"InitializationError\",\n {\n operation: Schema.Literals([\"configure\", \"register\", \"ready\", \"callback\", \"dispose\"]),\n step: Schema.String.check(Schema.isMaxLength(128)),\n reason: Schema.Literals([\n \"configuration\",\n \"unsupported\",\n \"origin\",\n \"stale\",\n \"busy\",\n \"closed\",\n \"timeout\",\n \"input\",\n \"output\",\n \"native\",\n ]),\n },\n) {}\n"],"mappings":";;;;;;;AAOA,MAAa,mBAAmB,OAAO,SAAS;CAE9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;AACF,CAAC;;AAKD,MAAa,iBAAiB,OAAO,SAAS;CAAC;CAAgB;CAAY;AAAS,CAAC;;AAKrF,MAAa,iBAAiB,OAAO,SAAS;CAC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AO,aAAa,YAAY,CAAC,CAAC;CAC5C,SAAS,OAAO,aAAa,WAAW,CAAC,CAAC;CAC1C,QAAQ,OAAO,aAAa,UAAU,CAAC,CAAC;CACxC,WAAW,OAAO,aAAa,aAAa,CAAC,CAAC;CAC9C,aAAa,OAAO,aAAa,eAAe,CAAC,CAAC;CAClD,WAAW,OAAO,aAAa,aAAa,CAAC,CAAC;CAC9C,SAAS,OAAO,aAAa,WAAW,CAAC,CAAC;CAC1C,eAAe,OAAO,aAAa,iBAAiB,CAAC,CAAC;CACtD,aAAa,OAAO,aAAa,eAAe,CAAC,CAAC;CAClD,cAAc,OAAO,aAAa,gBAAgB,CAAC,CAAC;CACpD,YAAY,OAAO,aAAa,cAAc,CAAC,CAAC;CAChD,QAAQ,OAAO,aAAa,UAAU,CAAC,CAAC;CACxC,YAAY,OAAO,aAAa,cAAc,CAAC,CAAC;AAClD;AAEA,MAAa,gBAAgB,OAAO,MAAM,OAAO,OAAO,OAAO,CAAC;AAIhE,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,gBAAgB;CACnF,WAAW;CACX,QAAQ;CACR,SAAS;AACX,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAChF,uBACA;CACE,WAAW,OAAO,SAAS;EAAC;EAAa;EAAY;EAAS;EAAY;CAAS,CAAC;CACpF,MAAM,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG,CAAC;CACjD,QAAQ,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;AACH,CACF,CAAC,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { BrowserError } from "./Errors.mjs";
2
- import { M as PageExecutionState, N as PageInfo, P as PageSuspension } from "./BrowserData-DPh3Oaof.mjs";
2
+ import { M as PageExecutionState, N as PageInfo, P as PageSuspension } from "./BrowserData-KHk4o__c.mjs";
3
3
  import { BrowserSession } from "./Browser.mjs";
4
4
  import { Effect } from "effect";
5
5
  //#region src/PageControl.d.ts
@@ -1,7 +1,7 @@
1
1
  import { BrowserError, BrowserOperation, BrowserOutcome, BrowserReason, InitializationError } from "./Errors.mjs";
2
- import { a as BrowserPolicy, et as Viewport, n as AutomationOptions, nt as ViewportPoint } from "./BrowserData-DPh3Oaof.mjs";
2
+ import { a as BrowserPolicy, et as Viewport, n as AutomationOptions, nt as ViewportPoint } from "./BrowserData-KHk4o__c.mjs";
3
3
  import { BrowserSession, OpenOptions } from "./Browser.mjs";
4
- import { r as BrowserBinding } from "./BrowserRuntime-BBAjpVFa.mjs";
4
+ import { r as BrowserBinding } from "./BrowserRuntime-hxkTNlRa.mjs";
5
5
  import { Crypto, Effect, Layer, Option, Schema, Scope } from "effect";
6
6
  //#region src/internal/testing/Frame.d.ts
7
7
  /** A valid 64×48 baseline JPEG, the bytes a scripted capture frame carries by default. */
@@ -196,7 +196,7 @@ export declare class ScriptedCleanupResult extends ScriptedCleanupResult_base {}
196
196
  * The operations whose next call a test may script. `disconnect` is the owner's native teardown
197
197
  * of a connection: a `Fail` makes it fail and a `Hold` parks it, however long cleanup waits.
198
198
  */
199
- export declare const ScriptableOperation: Schema.Literals<("capture-stop" | "checkpoint" | "click" | "click-and-wait" | "close-page" | "control-facts" | "disconnect" | "download-action" | "file-chooser" | "fill" | "fill-form" | "hover" | "list-frames" | "list-pages" | "navigate" | "navigate-stop" | "new-page" | "observe" | "page-resume" | "page-suspend" | "pointer-move" | "press" | "read-text" | "resize" | "revalidate" | "screenshot" | "scroll" | "select-files" | "select-frame" | "select-option" | "select-page" | "type" | "wait" | "wheel")[]>;
199
+ export declare const ScriptableOperation: Schema.Literals<("capture-stop" | "checkpoint" | "click" | "click-and-wait" | "close-page" | "control-facts" | "describe-page" | "disconnect" | "download-action" | "file-chooser" | "fill" | "fill-form" | "hover" | "list-frames" | "list-pages" | "navigate" | "navigate-stop" | "new-page" | "observe" | "page-resume" | "page-suspend" | "pointer-move" | "press" | "read-text" | "resize" | "revalidate" | "screenshot" | "scroll" | "select-files" | "select-frame" | "select-option" | "select-page" | "type" | "wait" | "wheel")[]>;
200
200
  export type ScriptableOperation = typeof ScriptableOperation.Type;
201
201
  /** A held native call: the test learns that it arrived, then decides when it may finish. */
202
202
  interface Gate {
package/dist/Testing.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BrowserError, InitializationError, Reasons } from "./Errors.mjs";
2
2
  import { BrowserPolicy, ControlFacts, FrameInfo, Identifier, ObservedControl, PageExecutionState, PageInfo, PageSuspension, SafeFilename, TargetUrl, ViewportEvidence, ViewportRect } from "./BrowserData.mjs";
3
- import { a as cleanupStep, c as checked, l as fromNativeAttempt, n as make, s as reported, u as issueBinding } from "./BrowserRuntime-DImn_Oe_.mjs";
3
+ import { a as cleanupStep, c as checked, l as fromNativeAttempt, n as make, s as reported, u as issueBinding } from "./BrowserRuntime-Cr76CN4I.mjs";
4
4
  import { Crypto, Effect, Layer, Option, PlatformError, Redacted, Schema } from "effect";
5
5
  //#region src/internal/testing/Crypto.ts
6
6
  /**
@@ -170,6 +170,7 @@ const ScriptableOperation = Schema.Literals([
170
170
  "press",
171
171
  "type",
172
172
  "list-pages",
173
+ "describe-page",
173
174
  "list-frames",
174
175
  "select-page",
175
176
  "select-frame",
@@ -447,6 +448,22 @@ const makeScriptedBrowser = (script, timers) => {
447
448
  const invalidateSnapshot = (scope = "all") => {
448
449
  if (snapshot !== void 0 && scope !== "none" && (scope === "all" || scope.pageId === snapshot.pageId)) snapshot.validity = "invalid";
449
450
  };
451
+ /** The page closes as a browser closes it: every connection learns, and nothing on it lasts. */
452
+ const close = (target) => {
453
+ target.closed = true;
454
+ target.navigation?.drop();
455
+ target.capture?.start.invalidate("target-changed");
456
+ target.capture = void 0;
457
+ notify(target);
458
+ if (selectedId === target.pageId) select(void 0);
459
+ invalidateSnapshot({ pageId: target.pageId });
460
+ events.invalidate("target-changed", { pageId: target.pageId });
461
+ for (const other of live) {
462
+ if (other === connection) continue;
463
+ other.retire(target.pageId);
464
+ other.announce(target.pageId);
465
+ }
466
+ };
450
467
  /** This connection ends: what it held on the browser's pages ends with it. */
451
468
  const dropConnection = (announce, ended = "dropped") => {
452
469
  if (disconnected) return;
@@ -904,6 +921,7 @@ const makeScriptedBrowser = (script, timers) => {
904
921
  },
905
922
  selectedTargetId: async () => selectedPage().targetId,
906
923
  listPages: (ticket) => attempt("list-pages", ticket, {}, async () => openPages().map(info)),
924
+ describePage: (page, ticket) => attempt("describe-page", ticket, { pageId: page.pageId }, async () => info(pageOf(page, "describe-page"))),
907
925
  resolvePage: async (page, ticket) => {
908
926
  ticket.check();
909
927
  const target = pageOf(page, "target");
@@ -932,19 +950,15 @@ const makeScriptedBrowser = (script, timers) => {
932
950
  closePage: (page, ticket) => attempt("close-page", ticket, { pageId: page.pageId }, async (record) => {
933
951
  const target = pageOf(page, "close-page");
934
952
  dispatch(ticket, record);
935
- target.closed = true;
936
- target.navigation?.drop();
937
- target.capture?.start.invalidate("target-changed");
938
- target.capture = void 0;
939
- notify(target);
940
- if (selectedId === target.pageId) select(void 0);
941
- invalidateSnapshot({ pageId: target.pageId });
942
- events.invalidate("target-changed", { pageId: target.pageId });
943
- for (const other of live) {
944
- if (other === connection) continue;
945
- other.retire(target.pageId);
946
- other.announce(target.pageId);
947
- }
953
+ close(target);
954
+ }),
955
+ containPage: (pageId) => attempt("close-page", void 0, { pageId }, async (record) => {
956
+ const target = pages.get(pageId);
957
+ if (target === void 0 || target.closed) return;
958
+ const outcome = take("close-page");
959
+ record.dispatched = true;
960
+ if (outcome?._tag === "Fail") throw fail("close-page", outcome.reason, outcome.outcome);
961
+ close(target);
948
962
  }),
949
963
  listFrames: (ticket, page) => attempt("list-frames", ticket, {}, async () => [frameInfo(page === void 0 ? selectedPage("list-frames") : pageOf(page, "list-frames"))]),
950
964
  resolveFrame: async (page, frame, ticket) => {