effect-browser 0.2.0-beta.9 → 0.3.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +707 -1184
- package/dist/Browser-B5AV7zPS.mjs +437 -0
- package/dist/Browser-B5AV7zPS.mjs.map +1 -0
- package/dist/Browser.d.mts +115 -3
- package/dist/Browser.mjs +2 -22
- package/dist/BrowserError-DXXIA6Rk.d.mts +135 -0
- package/dist/BrowserError.d.mts +2 -0
- package/dist/BrowserError.mjs +202 -0
- package/dist/BrowserError.mjs.map +1 -0
- package/dist/BrowserEvent-DzdNdvoh.d.mts +277 -0
- package/dist/BrowserEvent.d.mts +2 -0
- package/dist/BrowserEvent.mjs +295 -0
- package/dist/BrowserEvent.mjs.map +1 -0
- package/dist/Cdp.d.mts +32 -0
- package/dist/Cdp.mjs +61 -0
- package/dist/Cdp.mjs.map +1 -0
- package/dist/Change-DNvztNLu.mjs +138 -0
- package/dist/Change-DNvztNLu.mjs.map +1 -0
- package/dist/Change-DVP2IJWm.d.mts +71 -0
- package/dist/Change.d.mts +2 -0
- package/dist/Change.mjs +2 -0
- package/dist/Chromium.d.mts +29 -81
- package/dist/Chromium.mjs +57 -392
- package/dist/Chromium.mjs.map +1 -1
- package/dist/Expect.d.mts +62 -0
- package/dist/Expect.mjs +114 -0
- package/dist/Expect.mjs.map +1 -0
- package/dist/Frame-BERmf_gM.d.mts +117 -0
- package/dist/Frame.d.mts +2 -0
- package/dist/Frame.mjs +123 -0
- package/dist/Frame.mjs.map +1 -0
- package/dist/Moment.d.mts +2 -0
- package/dist/Moment.mjs +288 -0
- package/dist/Moment.mjs.map +1 -0
- package/dist/Motion.d.mts +40 -0
- package/dist/Motion.mjs +122 -0
- package/dist/Motion.mjs.map +1 -0
- package/dist/Page-D4281dIi.mjs +618 -0
- package/dist/Page-D4281dIi.mjs.map +1 -0
- package/dist/Page-DYTdVhYa.d.mts +593 -0
- package/dist/Page.d.mts +2 -0
- package/dist/Page.mjs +2 -0
- package/dist/Plan-5MdsRzE5.mjs +314 -0
- package/dist/Plan-5MdsRzE5.mjs.map +1 -0
- package/dist/Plan-CNNOU1Tx.d.mts +112 -0
- package/dist/Plan.d.mts +2 -3
- package/dist/Plan.mjs +2 -2
- package/dist/Policy.d.mts +76 -0
- package/dist/Policy.mjs +237 -0
- package/dist/Policy.mjs.map +1 -0
- package/dist/Presentation.d.mts +48 -0
- package/dist/Presentation.mjs +117 -0
- package/dist/Presentation.mjs.map +1 -0
- package/dist/Snapshot-B34hZ4Jl.d.mts +68 -0
- package/dist/Snapshot.d.mts +2 -0
- package/dist/Snapshot.mjs +79 -0
- package/dist/Snapshot.mjs.map +1 -0
- package/dist/Stage.d.mts +54 -0
- package/dist/Stage.mjs +133 -0
- package/dist/Stage.mjs.map +1 -0
- package/dist/Supervisor-BtEG93gR.mjs +420 -0
- package/dist/Supervisor-BtEG93gR.mjs.map +1 -0
- package/dist/Supervisor-Im6-wbg5.d.mts +230 -0
- package/dist/Supervisor.d.mts +2 -0
- package/dist/Supervisor.mjs +2 -0
- package/dist/context-DAYjATgC.mjs +137 -0
- package/dist/context-DAYjATgC.mjs.map +1 -0
- package/dist/index.d.mts +17 -14
- package/dist/index.mjs +18 -13
- package/dist/match.inpage-xOe9LNO0.mjs +48 -0
- package/dist/match.inpage-xOe9LNO0.mjs.map +1 -0
- package/dist/page-BkRcLCWZ.mjs +5097 -0
- package/dist/page-BkRcLCWZ.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/url-CcL0K7S0.mjs +262 -0
- package/dist/url-CcL0K7S0.mjs.map +1 -0
- package/package.json +96 -61
- package/src/Browser.ts +625 -0
- package/src/BrowserError.ts +225 -0
- package/src/BrowserEvent.ts +294 -0
- package/src/Cdp.ts +101 -0
- package/src/Change.ts +88 -0
- package/src/Chromium.ts +102 -0
- package/src/Expect.ts +180 -0
- package/src/Frame.ts +130 -0
- package/src/Moment.ts +479 -0
- package/src/Motion.ts +166 -0
- package/src/Page.ts +520 -0
- package/src/Plan.ts +354 -0
- package/src/Policy.ts +325 -0
- package/src/Presentation.ts +195 -0
- package/src/Snapshot.ts +89 -0
- package/src/Stage.ts +223 -0
- package/src/Supervisor.ts +353 -0
- package/src/index.ts +20 -0
- package/src/internal/input/actions.ts +610 -0
- package/src/internal/input/dispatch.ts +161 -0
- package/src/internal/input/edit.inpage.ts +162 -0
- package/src/internal/input/evidence.inpage.ts +164 -0
- package/src/internal/input/guard.inpage.ts +605 -0
- package/src/internal/input/guard.ts +183 -0
- package/src/internal/input/keyboard.ts +112 -0
- package/src/internal/input/keys.ts +127 -0
- package/src/internal/input/perform.ts +322 -0
- package/src/internal/input/pointer.ts +153 -0
- package/src/internal/input/replies.ts +159 -0
- package/src/internal/input/settle.ts +50 -0
- package/src/internal/input/style.ts +186 -0
- package/src/internal/input/targets.inpage.ts +293 -0
- package/src/internal/input/targets.ts +148 -0
- package/src/internal/page/bridge.ts +386 -0
- package/src/internal/page/context.ts +302 -0
- package/src/internal/page/lane.ts +301 -0
- package/src/internal/page/navigation.ts +183 -0
- package/src/internal/page/openings.ts +87 -0
- package/src/internal/page/page.ts +137 -0
- package/src/internal/page/url.ts +100 -0
- package/src/internal/page/viewport.ts +43 -0
- package/src/internal/pictures/capture.ts +778 -0
- package/src/internal/pictures/clock.ts +141 -0
- package/src/internal/pictures/pictures.ts +520 -0
- package/src/internal/pictures/transport.ts +242 -0
- package/src/internal/reading/choose.ts +100 -0
- package/src/internal/reading/context.inpage.ts +201 -0
- package/src/internal/reading/controls.inpage.ts +158 -0
- package/src/internal/reading/expect.inpage.ts +70 -0
- package/src/internal/reading/match.inpage.ts +92 -0
- package/src/internal/reading/names.inpage.ts +306 -0
- package/src/internal/reading/outline.inpage.ts +260 -0
- package/src/internal/reading/reading.ts +223 -0
- package/src/internal/reading/ready.inpage.ts +154 -0
- package/src/internal/reading/ready.ts +105 -0
- package/src/internal/reading/subjects.inpage.ts +188 -0
- package/src/internal/reading/text.inpage.ts +135 -0
- package/src/internal/reading/walk.inpage.ts +220 -0
- package/src/internal/supervisor/lifecycle.ts +265 -0
- package/src/internal/timeline/changes.inpage.ts +216 -0
- package/src/internal/timeline/changes.ts +100 -0
- package/src/internal/timeline/events.ts +93 -0
- package/src/internal/timeline/fold.inpage.ts +123 -0
- package/src/internal/timeline/history.inpage.ts +229 -0
- package/src/internal/timeline/marks.inpage.ts +207 -0
- package/src/internal/timeline/record.inpage.ts +133 -0
- package/src/internal/timeline/sight.inpage.ts +122 -0
- package/src/internal/timeline/window.ts +96 -0
- package/src/internal/timeline/words.ts +65 -0
- package/dist/Bootstrap-B9UUXsvF.d.mts +0 -183
- package/dist/Bootstrap-CeQOWBy6.mjs +0 -189
- package/dist/Bootstrap-CeQOWBy6.mjs.map +0 -1
- package/dist/Bootstrap.d.mts +0 -3
- package/dist/Bootstrap.mjs +0 -2
- package/dist/Browser-BF9_sORP.d.mts +0 -388
- package/dist/Browser.mjs.map +0 -1
- package/dist/BrowserData-CPIIIHol.d.mts +0 -585
- package/dist/BrowserData.d.mts +0 -3
- package/dist/BrowserData.mjs +0 -695
- package/dist/BrowserData.mjs.map +0 -1
- package/dist/BrowserRuntime-B6nT1G4X.d.mts +0 -148
- package/dist/BrowserRuntime-C1r2aSRK.mjs +0 -6820
- package/dist/BrowserRuntime-C1r2aSRK.mjs.map +0 -1
- package/dist/BrowserRuntime.d.mts +0 -3
- package/dist/BrowserRuntime.mjs +0 -3
- package/dist/Capture.d.mts +0 -56
- package/dist/Capture.mjs +0 -678
- package/dist/Capture.mjs.map +0 -1
- package/dist/CaptureData-CYriZHX1.mjs +0 -201
- package/dist/CaptureData-CYriZHX1.mjs.map +0 -1
- package/dist/CaptureData.d.mts +0 -219
- package/dist/CaptureData.mjs +0 -2
- package/dist/Errors.d.mts +0 -158
- package/dist/Errors.mjs +0 -207
- package/dist/Errors.mjs.map +0 -1
- package/dist/Images-yCG9BmRU.mjs +0 -76
- package/dist/Images-yCG9BmRU.mjs.map +0 -1
- package/dist/OperationOptions-DAeRS6O9.mjs +0 -55
- package/dist/OperationOptions-DAeRS6O9.mjs.map +0 -1
- package/dist/PageControl.d.mts +0 -15
- package/dist/PageControl.mjs +0 -34
- package/dist/PageControl.mjs.map +0 -1
- package/dist/PageRegistry-B3q9DS3g.mjs +0 -164
- package/dist/PageRegistry-B3q9DS3g.mjs.map +0 -1
- package/dist/Plan-Dyxu2q8C.mjs +0 -543
- package/dist/Plan-Dyxu2q8C.mjs.map +0 -1
- package/dist/PlanData-B668RxbQ.d.mts +0 -4831
- package/dist/PlanData.d.mts +0 -3
- package/dist/PlanData.mjs +0 -268
- package/dist/PlanData.mjs.map +0 -1
- package/dist/PlanInput-BJcPPncs.mjs +0 -75
- package/dist/PlanInput-BJcPPncs.mjs.map +0 -1
- package/dist/PublicSession-DCSMMqOj.mjs +0 -5602
- package/dist/PublicSession-DCSMMqOj.mjs.map +0 -1
- package/dist/Testing.d.mts +0 -479
- package/dist/Testing.mjs +0 -2147
- package/dist/Testing.mjs.map +0 -1
- package/dist/Timeline-fV22Xk-S.d.mts +0 -29
- package/dist/Timeline.d.mts +0 -4
- package/dist/Timeline.mjs +0 -20
- package/dist/Timeline.mjs.map +0 -1
- package/dist/TimelineData-BsOn-YGZ.d.mts +0 -3818
- package/dist/TimelineData.d.mts +0 -3
- package/dist/TimelineData.mjs +0 -482
- package/dist/TimelineData.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Bootstrap-CeQOWBy6.mjs","names":["Origin","Registration.Origin","Registration.FailureMode","Registration.schema","Registration.make"],"sources":["../src/internal/browser/BindingRegistration.ts","../src/Bootstrap.ts"],"sourcesContent":["import { Effect, Result, Schema } from \"effect\";\n\nimport type * as Bootstrap from \"../../Bootstrap.ts\";\nimport { Identifier } from \"../../BrowserData.ts\";\nimport { BrowserError, InitializationError, Reasons } from \"../../Errors.ts\";\n\nconst Invoke = Symbol(\"BrowserBindingRegistration\");\nconst issued = new WeakSet<object>();\n\nexport const Origin = Schema.NonEmptyString.check(\n Schema.isMaxLength(2048),\n Schema.makeFilter(\n (value) => {\n try {\n const url = new URL(value);\n\n return (\n [\"http:\", \"https:\"].includes(url.protocol) &&\n url.origin === value &&\n !url.username &&\n !url.password\n );\n } catch {\n return false;\n }\n },\n { title: \"an exact http(s) origin\" },\n ),\n);\n\nexport const FailureMode = Schema.Literals([\"reject-call\", \"fail-session\"]);\n\nconst metadataSchema = Schema.Struct({\n name: Identifier,\n origins: Schema.Array(Origin).check(\n Schema.isMaxLength(16),\n Schema.isUnique(),\n Schema.makeFilter((origins) => origins.length > 0, { title: \"at least one allowed origin\" }),\n ),\n maxConcurrent: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 64 })),\n maxInputBytes: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 1024 * 1024 })),\n maxOutputBytes: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 4 * 1024 * 1024 })),\n timeoutMillis: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 120_000 })),\n failureMode: FailureMode,\n});\n\ntype Metadata = typeof metadataSchema.Type;\n\nexport interface Registration<E, R> extends Metadata {\n readonly [Invoke]: (\n text: string,\n check: Effect.Effect<void, InitializationError>,\n ) => Effect.Effect<string, E | InitializationError, R>;\n}\n\n/** Retain an issued live capability at schema boundaries; a copied shape is not authority. */\nexport const schema = Schema.declare<Registration<unknown, unknown>>(\n (value): value is Registration<unknown, unknown> =>\n typeof value === \"object\" && value !== null && issued.has(value),\n { title: \"an issued browser binding registration\" },\n);\n\nconst issue = <E, R>(\n metadata: Metadata,\n invoke: Registration<E, R>[typeof Invoke],\n): Registration<E, R> => {\n const registration = Object.freeze({\n ...metadata,\n origins: Object.freeze([...metadata.origins]),\n [Invoke]: invoke,\n });\n\n issued.add(registration);\n\n return registration;\n};\n\n/** Pack heterogeneous codecs and handlers while their concrete input/output types are known. */\nexport const make = <I, IEncoded, O, OEncoded, E, R>(\n options: Bootstrap.BindingOptions<I, IEncoded, O, OEncoded, E, R>,\n): Registration<E, R> => {\n const {\n maxConcurrent = 1,\n maxInputBytes = 65536,\n maxOutputBytes = 65536,\n timeoutMillis = 10000,\n failureMode = \"reject-call\",\n } = options;\n\n const decoded = Schema.decodeResult(metadataSchema)({\n ...options,\n maxConcurrent,\n maxInputBytes,\n maxOutputBytes,\n timeoutMillis,\n failureMode,\n });\n\n if (Result.isFailure(decoded)) throw decoded.failure;\n const metadata = decoded.success;\n\n const { input, output, handle } = options;\n\n if (!Schema.isSchema(input) || !Schema.isSchema(output) || typeof handle !== \"function\") {\n throw new TypeError(\"Invalid binding registration\");\n }\n\n const fail = (reason: \"input\" | \"output\") =>\n InitializationError.make({ operation: \"callback\", step: metadata.name, reason });\n\n return issue(\n metadata,\n Effect.fnUntraced(function* (text, check) {\n if (new TextEncoder().encode(text).length > metadata.maxInputBytes)\n return yield* fail(\"input\");\n\n const decoded = yield* Schema.decodeEffect(Schema.fromJsonString(input))(text).pipe(\n Effect.catchCause(() => Effect.fail(fail(\"input\"))),\n );\n\n yield* check;\n const value = yield* Effect.suspend(() => handle(decoded));\n\n const encoded = yield* Schema.encodeEffect(output)(value).pipe(\n Effect.catchCause(() => Effect.fail(fail(\"output\"))),\n );\n\n const json = yield* Schema.decodeUnknownEffect(Schema.Json)(encoded).pipe(\n Effect.catchCause(() => Effect.fail(fail(\"output\"))),\n );\n\n const result = yield* Schema.encodeEffect(Schema.fromJsonString(Schema.Json))(json).pipe(\n Effect.catchCause(() => Effect.fail(fail(\"output\"))),\n );\n\n if (new TextEncoder().encode(result).length > metadata.maxOutputBytes)\n return yield* fail(\"output\");\n\n return result;\n }),\n );\n};\n\n/** Authentication is identity-based even when a caller copies every enumerable field/symbol. */\nexport const snapshot = Effect.fnUntraced(function* <E, R>(\n registration: Registration<E, R>,\n): Effect.fn.Return<Registration<E, R>, BrowserError> {\n const invalid = () =>\n BrowserError.make({\n operation: \"configure\",\n reason: Reasons.Configuration.make({}),\n outcome: \"undispatched\",\n });\n\n if (!issued.has(registration)) return yield* invalid();\n\n const metadata = yield* Schema.decodeEffect(metadataSchema)(registration).pipe(\n Effect.mapError(invalid),\n );\n\n return issue(metadata, registration[Invoke]);\n});\n\nexport const invoke = <E, R>(\n registration: Registration<E, R>,\n text: string,\n check: Effect.Effect<void, InitializationError>,\n): Effect.Effect<string, E | InitializationError, R> => registration[Invoke](text, check);\n","import { type Cause, type Effect, Schema } from \"effect\";\n\nimport { Identifier } from \"./BrowserData.ts\";\nimport type { InitializationError } from \"./Errors.ts\";\nimport * as Registration from \"./internal/browser/BindingRegistration.ts\";\n\n/**\n * Exact scheme-and-host origin, as a document reports it. Patterns are deliberately absent:\n * a registration that cannot say exactly where it applies does not belong in a plan.\n */\nexport const Origin = Registration.Origin;\n\nexport type Origin = typeof Origin.Type;\n\n/**\n * The reviewed subset of native permission capabilities. Each name is checked against a real\n * browser in native acceptance; an unsupported capability is refused before it is exposed.\n */\nexport const Permission = Schema.Literals([\n \"accelerometer\",\n \"background-sync\",\n \"camera\",\n \"clipboard-read\",\n \"clipboard-write\",\n \"geolocation\",\n \"gyroscope\",\n \"magnetometer\",\n \"microphone\",\n \"midi\",\n \"notifications\",\n \"payment-handler\",\n \"storage-access\",\n]);\n\nexport type Permission = typeof Permission.Type;\n\nexport const PermissionGrant = Schema.Struct({\n origin: Origin,\n permissions: Schema.Array(Permission).check(Schema.isMaxLength(16), Schema.isUnique()),\n});\n\nexport type PermissionGrant = typeof PermissionGrant.Type;\n\n/**\n * Registration is not readiness. A script may start asynchronous work, but it cannot pause the\n * website's own scripts, so a document is ready only when its expression resolves to exactly\n * `true`. A document that was already running when the bundle was registered never ran it:\n * `RequireFreshNavigation` reports that instead of pretending otherwise, and an explicit\n * reload of possibly uncertain work stays a caller's decision.\n */\nexport const Readiness = Schema.Struct({\n expression: Schema.NonEmptyString.check(Schema.isMaxLength(4096)),\n timeoutMillis: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 120_000 })),\n existingDocuments: Schema.Literals([\"RequireFreshNavigation\", \"AcceptAlreadyRunning\"]),\n});\n\nexport type Readiness = typeof Readiness.Type;\n\n/** Trusted host configuration. Script content is never model output or page input. */\nexport const InitScript = Schema.Struct({\n id: Identifier,\n content: Schema.NonEmptyString.check(Schema.isMaxLength(64 * 1024)),\n /** When present, the step runs only on these documents and readiness skips the rest. */\n origins: Schema.optionalKey(\n Schema.Array(Origin).check(Schema.isMaxLength(16), Schema.isUnique()),\n ),\n readiness: Schema.optionalKey(Readiness),\n});\n\nexport type InitScript = typeof InitScript.Type;\n\n/** A callback failure can reject one page invocation or permanently fence the session. */\nexport const BindingFailureMode = Registration.FailureMode;\n\nexport type BindingFailureMode = typeof BindingFailureMode.Type;\n\n/**\n * A registration issued by `binding`. Its private executable closure carries the real consumer\n * E/R; copying the metadata or fabricating an object does not grant callback authority.\n */\nexport type BindingRegistration<E = never, R = never> = Registration.Registration<E, R>;\n\n/**\n * Environment-free boundary codecs keep page data validation separate from consumer services.\n * The handler's E/R remain visible on the Plan and are supplied only by the trusted host.\n */\nexport interface BindingOptions<I, IEncoded, O, OEncoded, E, R> {\n readonly name: string;\n readonly origins: ReadonlyArray<Origin>;\n readonly input: Schema.ConstraintCodec<I, IEncoded, never, never>;\n readonly output: Schema.ConstraintCodec<O, OEncoded, never, never>;\n /** Defaults to one concurrent invocation. Explicit values still pass the bounded schema. */\n readonly maxConcurrent?: number;\n /** Defaults to 64 KiB. */\n readonly maxInputBytes?: number;\n /** Defaults to 64 KiB. */\n readonly maxOutputBytes?: number;\n /** Defaults to 10 seconds for the complete invocation. */\n readonly timeoutMillis?: number;\n /** Defaults to rejecting this invocation without terminating the session. */\n readonly failureMode?: BindingFailureMode;\n readonly handle: (input: I) => Effect.Effect<O, E, R>;\n}\n\n/**\n * One ordered bundle plus its host capabilities. Callback registrations preserve E/R through\n * their executable closures; static script/permission plans remain serializable values.\n */\nexport interface Plan<E = unknown, R = unknown> {\n readonly scripts: ReadonlyArray<InitScript>;\n readonly permissions: ReadonlyArray<PermissionGrant>;\n readonly bindings?: ReadonlyArray<BindingRegistration<E, R>>;\n}\n\n/** Host-only typed evidence. Causes are never logged or returned to page callers. */\nexport interface BindingFailure<E> {\n readonly name: string;\n readonly mode: BindingFailureMode;\n readonly cause: Cause.Cause<E | InitializationError>;\n}\n\nexport interface BindingStatistics {\n readonly name: string;\n readonly inFlight: number;\n readonly pendingNative: number;\n /** Finished/interrupted invocations whose native work or disposal has not settled. */\n readonly retired: number;\n readonly accepted: number;\n readonly succeeded: number;\n readonly rejected: number;\n}\n\n/** Copied snapshot: at most sixteen bindings and the latest thirty-two failure records. */\nexport interface BindingDiagnostics<E> {\n readonly faulted: boolean;\n readonly bindings: ReadonlyArray<BindingStatistics>;\n readonly failures: ReadonlyArray<BindingFailure<E>>;\n readonly droppedFailures: number;\n}\n\n/**\n * Static plans remain serializable. Live binding plans retain issued registrations by identity;\n * this schema neither executes their callbacks nor turns copied metadata into authority. Typed\n * acquisition validates a separate snapshot so consumer E/R is not erased by a generic decoder.\n */\nexport const Plan = Schema.Struct({\n scripts: Schema.Array(InitScript).check(Schema.isMaxLength(16)),\n permissions: Schema.Array(PermissionGrant).check(Schema.isMaxLength(16)),\n bindings: Schema.optionalKey(Schema.Array(Registration.schema).check(Schema.isMaxLength(16))),\n});\n\ntype AnyPlan = Plan<unknown, unknown>;\n\nexport type PlanError<P extends AnyPlan> = P extends Plan<infer E, infer _R> ? E : never;\nexport type PlanRequirements<P extends AnyPlan> = P extends Plan<infer _E, infer R> ? R : never;\n\nexport const empty: Plan<never, never> = { scripts: [], permissions: [] };\n\nexport const init = (script: InitScript): Plan<never, never> => ({\n scripts: [script],\n permissions: [],\n});\n\nexport const permissions = (grant: PermissionGrant): Plan<never, never> => ({\n scripts: [],\n permissions: [grant],\n});\n\n/**\n * Register a page-callable host callback without running it or capturing an ambient runtime.\n * Native installation later owns origin/document checks, bounded admission and disposal.\n */\nexport const binding = <I, IEncoded, O, OEncoded, E, R>(\n options: BindingOptions<I, IEncoded, O, OEncoded, E, R>,\n): Plan<E, R> => ({\n scripts: [],\n permissions: [],\n bindings: [Registration.make(options)],\n});\n\n/** Combination is ordered and preserves every callback's consumer E/R union. */\nexport function combine<const Plans extends ReadonlyArray<AnyPlan>>(\n ...plans: Plans\n): Plan<PlanError<Plans[number]>, PlanRequirements<Plans[number]>>;\n\nexport function combine(...plans: ReadonlyArray<AnyPlan>): AnyPlan {\n const bindings = plans.flatMap((plan) => (plan.bindings === undefined ? [] : [...plan.bindings]));\n\n return {\n scripts: plans.flatMap((plan) => [...plan.scripts]),\n permissions: plans.flatMap((plan) => [...plan.permissions]),\n ...(bindings.length === 0 ? {} : { bindings }),\n };\n}\n\n/** What the current document is, not a promise about any other document. */\nexport type ReadinessOutcome =\n | { readonly _tag: \"Ready\" }\n | { readonly _tag: \"NotApplicable\" }\n | { readonly _tag: \"RequiresNavigation\" };\n"],"mappings":"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"}
|
package/dist/Bootstrap.d.mts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { _ as binding, a as BindingRegistration, b as init, c as InitScript, d as PermissionGrant, f as Plan, g as ReadinessOutcome, h as Readiness, i as BindingOptions, l as Origin, m as PlanRequirements, n as BindingFailure, o as BindingStatistics, p as PlanError, r as BindingFailureMode, t as BindingDiagnostics, u as Permission, v as combine, x as permissions, y as empty } from "./Bootstrap-B9UUXsvF.mjs";
|
|
2
|
-
export { BindingDiagnostics, BindingFailure, BindingFailureMode, BindingOptions, BindingRegistration, BindingStatistics, InitScript, Origin, Permission, PermissionGrant, Plan, PlanError, PlanRequirements, Readiness, ReadinessOutcome, binding, combine, empty, init, permissions };
|
|
3
|
-
export {};
|
package/dist/Bootstrap.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as PermissionGrant, c as binding, d as init, f as permissions, i as Permission, l as combine, n as InitScript, o as Plan, r as Origin, s as Readiness, t as BindingFailureMode, u as empty } from "./Bootstrap-CeQOWBy6.mjs";
|
|
2
|
-
export { BindingFailureMode, InitScript, Origin, Permission, PermissionGrant, Plan, Readiness, binding, combine, empty, init, permissions };
|
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
import { f as Plan, g as ReadinessOutcome, s as Bootstrap_d_exports, t as BindingDiagnostics } from "./Bootstrap-B9UUXsvF.mjs";
|
|
2
|
-
import { BrowserError, BrowserOperation, Containment, InitializationError } from "./Errors.mjs";
|
|
3
|
-
import { $ as Target, A as NavigationResult, B as PressRequest, D as KeyStroke, G as ScreenshotResult, I as PageInfo, K as ScrollRequest, M as ObservationOptions, P as ObservedElement, Q as StartNavigationRequest, R as PointerMoveRequest, V as ReadTextRequest, W as ScreenshotRequest, Z as SessionStatus, a as BrowserDiagnostics, b as HoverRequest, c as CheckpointOptions, ct as WaitForElementRequest, f as FillFormOptions, h as FillRequest, it as Viewport, j as Observation, k as NavigateRequest, l as ClickRequest, lt as WheelRequest, m as FillFormResult, p as FillFormRequest, q as SelectOptions, rt as TypeRequest, s as Checkpoint, t as ActionResult, tt as TextResult, u as ControlFacts, w as InputReceipt, y as FrameInfo } from "./BrowserData-CPIIIHol.mjs";
|
|
4
|
-
import { A as PlanEncoded, D as PerformedEncoded, K as StepAttempt, N as Ran, P as RanStep, U as SettledEvidence, a as AttemptSnapshot, b as LivePlanEncoded, f as DescriptorEncoded, h as InputBindings, k as Plan$1, y as LivePlan, z as ResolveGuard } from "./PlanData-B668RxbQ.mjs";
|
|
5
|
-
import { R as TimelineError, y as PageEvent } from "./TimelineData-BsOn-YGZ.mjs";
|
|
6
|
-
import { t as Timeline } from "./Timeline-fV22Xk-S.mjs";
|
|
7
|
-
import { Duration, Effect, Schema, Scope, Stream } from "effect";
|
|
8
|
-
//#region src/Plan.d.ts
|
|
9
|
-
/** All execution stays on the issued Page/Frame and its original scoped owner. */
|
|
10
|
-
interface RunOptions extends OperationOptions {
|
|
11
|
-
readonly style?: "plain" | PerformedEncoded;
|
|
12
|
-
/** Intended boundary in this owner's original monotonic runtime, measured when executed. */
|
|
13
|
-
readonly startAt?: bigint;
|
|
14
|
-
readonly within?: Duration.Input;
|
|
15
|
-
readonly through?: string;
|
|
16
|
-
readonly inputs?: InputBindings;
|
|
17
|
-
readonly policy?: ElementAdmission;
|
|
18
|
-
readonly checkpoint?: CheckpointOptions;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Check and normalize host run options exactly as `page.start` and `page.run` will, without
|
|
22
|
-
* exposing private deadline/queue accounting fields. A caller that builds options from untrusted
|
|
23
|
-
* configuration can fail early with the same `Configuration` refusal.
|
|
24
|
-
*/
|
|
25
|
-
declare const checkRunOptions: (value: unknown) => Effect.Effect<RunOptions, BrowserError>;
|
|
26
|
-
interface StepFailure {
|
|
27
|
-
readonly stage: "PreparationFailed" | "AttemptFailed";
|
|
28
|
-
readonly stepId?: string;
|
|
29
|
-
readonly completed: ReadonlyArray<RanStep>;
|
|
30
|
-
readonly attempt?: StepAttempt;
|
|
31
|
-
readonly error: BrowserError;
|
|
32
|
-
}
|
|
33
|
-
declare const StepFailed_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
34
|
-
readonly _tag: "StepFailed";
|
|
35
|
-
} & Readonly<A>;
|
|
36
|
-
/**
|
|
37
|
-
* Live host failure evidence is not a durable plan or a serialization schema. Its message names
|
|
38
|
-
* only the stage, step and reason; the evidence fields can retain authored literal values, so
|
|
39
|
-
* log the message rather than the whole value.
|
|
40
|
-
*/
|
|
41
|
-
declare class StepFailed extends StepFailed_base<StepFailure & {
|
|
42
|
-
readonly message: string;
|
|
43
|
-
}> {
|
|
44
|
-
constructor(failure: StepFailure);
|
|
45
|
-
}
|
|
46
|
-
declare const RecordingIncomplete_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
47
|
-
readonly _tag: "RecordingIncomplete";
|
|
48
|
-
} & Readonly<A>;
|
|
49
|
-
declare class RecordingIncomplete extends RecordingIncomplete_base<{
|
|
50
|
-
readonly stepId?: string;
|
|
51
|
-
readonly reason: "InvalidThrough" | "NoCompletedSteps" | "IncompleteCapture" | "Unacknowledged";
|
|
52
|
-
}> {}
|
|
53
|
-
/** A retained value keeps its evidence after interruption; joining never submits another walk. */
|
|
54
|
-
interface RunOperation {
|
|
55
|
-
readonly id: string;
|
|
56
|
-
readonly attempts: Effect.Effect<AttemptSnapshot>;
|
|
57
|
-
readonly completed: Effect.Effect<Ran, StepFailed>;
|
|
58
|
-
readonly cancel: Effect.Effect<void>;
|
|
59
|
-
}
|
|
60
|
-
interface PlanOperations {
|
|
61
|
-
readonly start: (plan: LivePlanEncoded | PlanEncoded, options?: RunOptions) => Effect.Effect<RunOperation, StepFailed, Scope.Scope>;
|
|
62
|
-
readonly run: (plan: LivePlanEncoded | PlanEncoded, options?: RunOptions) => Effect.Effect<Ran, StepFailed>;
|
|
63
|
-
}
|
|
64
|
-
/** Validate and normalize authored data, including explicit document/Strict defaults. */
|
|
65
|
-
declare const make: (value: LivePlanEncoded) => Effect.Effect<LivePlan, Schema.SchemaError>;
|
|
66
|
-
/** Descriptor-only ingress for stored intent; it never decodes a live Ref. */
|
|
67
|
-
declare const decode: (value: unknown) => Effect.Effect<Plan$1, Schema.SchemaError>;
|
|
68
|
-
/** The normalized scope and guards are always included in encoded durable intent. */
|
|
69
|
-
declare const encode: (value: Plan$1) => Effect.Effect<PlanEncoded, Schema.SchemaError>;
|
|
70
|
-
/** A named input a plan reads: the step and action path that read it, and how it is used. */
|
|
71
|
-
interface InputSlot {
|
|
72
|
-
readonly name: string;
|
|
73
|
-
readonly stepId: string;
|
|
74
|
-
readonly path: ReadonlyArray<string>;
|
|
75
|
-
/** `text` is typed key by key into focus; `value` replaces a field's whole contents. */
|
|
76
|
-
readonly kind: "text" | "value";
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* The named inputs a stored or live plan reads, in step order. A recorded plan's literal fill and
|
|
80
|
-
* type values are such slots; bind each `name` in `inputs` to replay it.
|
|
81
|
-
*/
|
|
82
|
-
declare const inputSlots: (plan: Plan$1 | LivePlan) => ReadonlyArray<InputSlot>;
|
|
83
|
-
/**
|
|
84
|
-
* Project only acknowledged, faithfully captured intent. An explicitly chosen completed prefix
|
|
85
|
-
* can be retained after a later failure by passing the operation's host snapshot and `through`.
|
|
86
|
-
* Literal input values are replaced during capture with deterministic named input slots.
|
|
87
|
-
*/
|
|
88
|
-
declare const recorded: (value: Ran | AttemptSnapshot, options?: {
|
|
89
|
-
readonly through?: string;
|
|
90
|
-
}) => Effect.Effect<Plan$1, RecordingIncomplete>;
|
|
91
|
-
/**
|
|
92
|
-
* Project one `startNavigation` operation, such as an agent-browser `Navigation` receipt's, as a
|
|
93
|
-
* plan of one `Navigate` step named `id` ("navigate" by default). It joins `completed`, which
|
|
94
|
-
* stops nothing: only a navigation that reached DOMContentLoaded is acknowledged, and one that
|
|
95
|
-
* failed, was stopped or interrupted, or whose outcome is unknown is refused `Unacknowledged`.
|
|
96
|
-
* The step repeats the request, not the address a redirect reached, as a recorded run's
|
|
97
|
-
* Navigate step does. An `id` that is not a step identifier fails `IncompleteCapture`.
|
|
98
|
-
*/
|
|
99
|
-
declare const recordedNavigation: (operation: NavigationOperation, options?: {
|
|
100
|
-
readonly id?: string;
|
|
101
|
-
}) => Effect.Effect<Plan$1, RecordingIncomplete>;
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region src/Browser.d.ts
|
|
104
|
-
/**
|
|
105
|
-
* Host-only ordinary admission. Omission or zero fails immediately; positive finite duration
|
|
106
|
-
* queues FIFO. Page closure uses reserved fail-fast admission and a deadline-bounded shared close.
|
|
107
|
-
*/
|
|
108
|
-
interface AdmissionOptions {
|
|
109
|
-
readonly queue?: Duration.Input;
|
|
110
|
-
}
|
|
111
|
-
/** Explicit host options, separate from request data and exact-element admission callbacks. */
|
|
112
|
-
interface OperationOptions {
|
|
113
|
-
readonly timeoutMillis?: number;
|
|
114
|
-
readonly admission?: AdmissionOptions;
|
|
115
|
-
}
|
|
116
|
-
/** Explicit descriptor guard and ordinary host admission; no selector or geometry fallback. */
|
|
117
|
-
interface ResolveOptions extends OperationOptions {
|
|
118
|
-
readonly guard?: typeof ResolveGuard.Encoded;
|
|
119
|
-
}
|
|
120
|
-
/** Named native quiet signals within the original positive finite deadline. */
|
|
121
|
-
interface SettledRequest {
|
|
122
|
-
readonly quiet: Duration.Input;
|
|
123
|
-
readonly within: Duration.Input;
|
|
124
|
-
}
|
|
125
|
-
/** A bounded host-memory snapshot; it grants no priority or native authority. */
|
|
126
|
-
interface AdmissionStatus {
|
|
127
|
-
readonly active: BrowserOperation | null;
|
|
128
|
-
readonly waiting: number;
|
|
129
|
-
readonly maximum: number;
|
|
130
|
-
readonly oldestWaitMillis: number | null;
|
|
131
|
-
readonly nativePending: number;
|
|
132
|
-
readonly nativeWaitPending: boolean;
|
|
133
|
-
readonly stopSetupPending: boolean;
|
|
134
|
-
}
|
|
135
|
-
interface SessionAdmissionStatus {
|
|
136
|
-
readonly waiting: number;
|
|
137
|
-
readonly maximum: number;
|
|
138
|
-
readonly nativePending: number;
|
|
139
|
-
readonly nativeMaximum: number;
|
|
140
|
-
readonly nativeWaits: number;
|
|
141
|
-
readonly stopSetups: number;
|
|
142
|
-
readonly registry: AdmissionStatus;
|
|
143
|
-
}
|
|
144
|
-
/** Terminal facts remain readable after this page loses live authority. */
|
|
145
|
-
interface PageStatus {
|
|
146
|
-
readonly identity: Target;
|
|
147
|
-
readonly phase: "open" | "paused" | "closing" | "closed" | "stale";
|
|
148
|
-
readonly containment: Containment;
|
|
149
|
-
readonly admission: AdmissionStatus;
|
|
150
|
-
}
|
|
151
|
-
interface PageOperations {
|
|
152
|
-
readonly navigate: (request: NavigateRequest, options?: OperationOptions) => Effect.Effect<NavigationResult, BrowserError>;
|
|
153
|
-
/** `navigate`, left in flight: the same single dispatch, completed by the caller. */
|
|
154
|
-
readonly startNavigation: (request: StartNavigationRequest, options?: OperationOptions) => Effect.Effect<NavigationOperation, BrowserError, Scope.Scope>;
|
|
155
|
-
readonly readText: (request: ReadTextRequest, options?: OperationOptions) => Effect.Effect<TextResult, BrowserError>;
|
|
156
|
-
readonly click: (request: ClickRequest, options?: OperationOptions) => Effect.Effect<ActionResult, BrowserError>;
|
|
157
|
-
readonly fill: (request: FillRequest, options?: OperationOptions) => Effect.Effect<ActionResult, BrowserError>;
|
|
158
|
-
/** Script in the page: instantaneous, and it raises no wheel event. */
|
|
159
|
-
readonly scroll: (request: ScrollRequest, options?: OperationOptions) => Effect.Effect<ActionResult, BrowserError>;
|
|
160
|
-
/** One real pointer move, in main-frame viewport pixels. */
|
|
161
|
-
readonly pointerMove: (request: PointerMoveRequest, options?: OperationOptions) => Effect.Effect<InputReceipt, BrowserError>;
|
|
162
|
-
/** Places the pointer on one exact element where it is, or fails `not-visible` unsent. */
|
|
163
|
-
readonly hover: (request: HoverRequest, options?: OperationOptions) => Effect.Effect<InputReceipt, BrowserError>;
|
|
164
|
-
/** One real wheel event; the browser decides what under the pointer scrolls. */
|
|
165
|
-
readonly wheel: (request: WheelRequest, options?: OperationOptions) => Effect.Effect<InputReceipt, BrowserError>;
|
|
166
|
-
/** One real key stroke to whatever has focus, or fails `not-focused` unsent if `into` lacks it. */
|
|
167
|
-
readonly press: (request: PressRequest, options?: OperationOptions) => Effect.Effect<InputReceipt, BrowserError>;
|
|
168
|
-
/** Text as the real key strokes that produce it, under the same focus rule as `press`. */
|
|
169
|
-
readonly type: (request: TypeRequest, options?: OperationOptions) => Effect.Effect<InputReceipt, BrowserError>;
|
|
170
|
-
readonly screenshot: (request: ScreenshotRequest, options?: OperationOptions) => Effect.Effect<ScreenshotResult, BrowserError>;
|
|
171
|
-
/**
|
|
172
|
-
* The one observation whose nodes later actions may name. `scope: "viewport"` keeps only text
|
|
173
|
-
* and controls that are on screen and reachable, plus bounded choices of visible native
|
|
174
|
-
* selects; the default reads the whole document. It carries no destination, form or field value.
|
|
175
|
-
*/
|
|
176
|
-
readonly observe: (options?: ObservationOptions, operationOptions?: OperationOptions) => Effect.Effect<Observation, BrowserError>;
|
|
177
|
-
/**
|
|
178
|
-
* Passive evidence for a recorder, with a picture when asked. It issues no references and
|
|
179
|
-
* leaves the observation above exactly as it was. Host-only: it carries control facts.
|
|
180
|
-
*/
|
|
181
|
-
readonly checkpoint: (options?: CheckpointOptions, operationOptions?: OperationOptions) => Effect.Effect<Checkpoint, BrowserError>;
|
|
182
|
-
/** Host-only facts about one observed control, read from that exact node just now. */
|
|
183
|
-
readonly controlFacts: (reference: ObservedElement, options?: OperationOptions) => Effect.Effect<ControlFacts, BrowserError>;
|
|
184
|
-
/**
|
|
185
|
-
* After a page hold, nothing observed on that page may be acted on unchecked. This checks one
|
|
186
|
-
* reference: still attached, and still the control that was inspected. It never searches by
|
|
187
|
-
* selector or label for a substitute, and it sends nothing.
|
|
188
|
-
*/
|
|
189
|
-
readonly revalidateElement: (reference: ObservedElement, options?: OperationOptions) => Effect.Effect<ObservedElement, BrowserError>;
|
|
190
|
-
readonly clickElement: (reference: ObservedElement, admission?: ElementAdmission, options?: OperationOptions) => Effect.Effect<ActionResult, BrowserError>;
|
|
191
|
-
readonly fillElement: (reference: ObservedElement, value: string, admission?: ElementAdmission, options?: OperationOptions) => Effect.Effect<ActionResult, BrowserError>;
|
|
192
|
-
/** One selection using this exact select and its issued option element IDs, with fresh checks. */
|
|
193
|
-
readonly selectOption: (reference: ObservedElement, options: SelectOptions, admission?: ElementAdmission, operationOptions?: OperationOptions) => Effect.Effect<ActionResult, BrowserError>;
|
|
194
|
-
readonly hoverElement: (reference: ObservedElement, admission?: ElementAdmission, options?: OperationOptions) => Effect.Effect<InputReceipt, BrowserError>;
|
|
195
|
-
/** A key stroke sent only if the exact node an observation named already has focus. */
|
|
196
|
-
readonly pressElement: (reference: ObservedElement, stroke: KeyStroke, admission?: ElementAdmission, options?: OperationOptions) => Effect.Effect<InputReceipt, BrowserError>;
|
|
197
|
-
/** Real typing with `fillElement`'s exactness: that node must already have focus. */
|
|
198
|
-
readonly typeElement: (reference: ObservedElement, text: string, admission?: ElementAdmission, options?: OperationOptions) => Effect.Effect<InputReceipt, BrowserError>;
|
|
199
|
-
/**
|
|
200
|
-
* Set several controls of one observation in order, then optionally click one submit control.
|
|
201
|
-
* Every step acts on the exact observed node after the same fresh checks as `fillElement`,
|
|
202
|
-
* except that a control may have become enabled since it was observed, and each is admitted
|
|
203
|
-
* and charged as its own action. The observation stays usable for this form's own steps only;
|
|
204
|
-
* anything else that changes the page still retires it, and the form retires it when it ends.
|
|
205
|
-
* The first refused or uncertain step ends the form. Submit is sent only after every field
|
|
206
|
-
* succeeded and, unless `verify` is false, still holds what its step left there. Fields set
|
|
207
|
-
* before a stop stay set. It fails only when its first step does; otherwise `stopped` says
|
|
208
|
-
* where it ended and why.
|
|
209
|
-
*/
|
|
210
|
-
readonly fillForm: (request: FillFormRequest, admission?: ElementAdmission, options?: FillFormOptions, operationOptions?: OperationOptions) => Effect.Effect<FillFormResult, BrowserError>;
|
|
211
|
-
/**
|
|
212
|
-
* Wait on the original observed node within the host deadline. Hidden includes its detachment;
|
|
213
|
-
* document replacement is stale. Success observes a condition, without authorizing later input.
|
|
214
|
-
*/
|
|
215
|
-
readonly waitForElement: (request: WaitForElementRequest, options?: OperationOptions) => Effect.Effect<void, BrowserError>;
|
|
216
|
-
readonly waitFor: (request: {
|
|
217
|
-
readonly selector: string;
|
|
218
|
-
readonly state: "visible" | "hidden" | "attached" | "detached";
|
|
219
|
-
}, options?: OperationOptions) => Effect.Effect<void, BrowserError>;
|
|
220
|
-
/** Navigation observation is registered before the single click dispatch. */
|
|
221
|
-
readonly clickAndWait: (request: ClickRequest, options?: OperationOptions) => Effect.Effect<ActionResult, BrowserError>;
|
|
222
|
-
/**
|
|
223
|
-
* Readiness of the current document only. Dependent operations wait for it themselves;
|
|
224
|
-
* this reports it without charging an action, so a caller can decide what to do about a
|
|
225
|
-
* document that predates the registrations.
|
|
226
|
-
*/
|
|
227
|
-
readonly ready: (options?: OperationOptions) => Effect.Effect<ReadinessOutcome, InitializationError>;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Issued live authority for one native frame; navigation keeps the frame and retires its references.
|
|
231
|
-
*
|
|
232
|
-
* Pass the issued object itself. Capture, page control, provider transfers, agent tools and
|
|
233
|
-
* `checkPage` authenticate it by identity, so a spread copy, wrapper or Proxy is refused
|
|
234
|
-
* `UnregisteredSession` even though its copied methods still run. Observe work through the
|
|
235
|
-
* timeline and run receipts rather than by wrapping methods.
|
|
236
|
-
*/
|
|
237
|
-
interface Frame extends PageOperations, PlanOperations {
|
|
238
|
-
readonly identity: Target;
|
|
239
|
-
readonly status: Effect.Effect<PageStatus>;
|
|
240
|
-
/**
|
|
241
|
-
* The original owner's host monotonic clock, the same one `session.monotonicTimeNanos` reads,
|
|
242
|
-
* so a host bound to this Page or Frame can compute a plan's `startAt` without the session.
|
|
243
|
-
*/
|
|
244
|
-
readonly monotonicTimeNanos: Effect.Effect<bigint>;
|
|
245
|
-
/** Resolve full descriptor intent against the complete current native candidate inventory. */
|
|
246
|
-
readonly resolve: (descriptor: DescriptorEncoded, options?: ResolveOptions) => Effect.Effect<ObservedElement, BrowserError>;
|
|
247
|
-
/**
|
|
248
|
-
* Quiet DOM mutation, scroll, root geometry and viewport signals in one pinned document.
|
|
249
|
-
* This does not establish network, animation or business completion.
|
|
250
|
-
*/
|
|
251
|
-
readonly settled: (request: SettledRequest, options?: OperationOptions) => Effect.Effect<SettledEvidence, BrowserError>;
|
|
252
|
-
}
|
|
253
|
-
/** Issued live authority for one native page on its original connection; pass it as issued, see `Frame`. */
|
|
254
|
-
interface Page extends Frame {
|
|
255
|
-
/** Evidence for this issued Page's original domain; navigation does not change its journal. */
|
|
256
|
-
readonly timeline: Timeline;
|
|
257
|
-
/**
|
|
258
|
-
* Read this page's address and title. Like `listFrames`, it is a read of the page and shares
|
|
259
|
-
* its permit; pass `admission.queue` to wait behind work already running there.
|
|
260
|
-
*/
|
|
261
|
-
readonly describe: (options?: OperationOptions) => Effect.Effect<PageInfo, BrowserError>;
|
|
262
|
-
readonly listFrames: (options?: OperationOptions) => Effect.Effect<ReadonlyArray<FrameInfo>, BrowserError>;
|
|
263
|
-
/** Issue a child Frame. Like `session.page`, issuing takes the registry permit, not this page's. */
|
|
264
|
-
readonly frame: (info: FrameInfo, options?: OperationOptions) => Effect.Effect<Frame, BrowserError>;
|
|
265
|
-
readonly resizeViewport: (viewport: Viewport, options?: OperationOptions) => Effect.Effect<void, BrowserError>;
|
|
266
|
-
/** Reserved fail-fast admission; timeoutMillis bounds joining a close, not admission.queue. */
|
|
267
|
-
readonly close: (options?: OperationOptions) => Effect.Effect<void, BrowserError>;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* A host's decision about one control, made on facts read from the exact node immediately
|
|
271
|
-
* before input. Returning anything but `true`, or throwing, sends nothing and fails `denied`.
|
|
272
|
-
* It is a plain synchronous function on purpose: it runs while the owner's permit is held, where
|
|
273
|
-
* waiting on a model or a network call would stall other ordinary operations on that Page. It is not an atomic
|
|
274
|
-
* check-and-input transaction, because page script can still run before the native input lands.
|
|
275
|
-
*/
|
|
276
|
-
interface ElementAdmission {
|
|
277
|
-
readonly admit: (facts: ControlFacts) => boolean;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* A navigation the browser is still performing. The owner's permit was released when it was
|
|
281
|
-
* dispatched, so while it loads a host may read, `checkpoint`, hold and resume this page, and
|
|
282
|
-
* use any other page. Anything that would change this page fails `busy` until it settles.
|
|
283
|
-
*
|
|
284
|
-
* Leaving its scope unsettled revokes and attempts to close its exact page. Positive closure
|
|
285
|
-
* preserves healthy peers; unconfirmed closure fences the session. Its outcome remains unknown
|
|
286
|
-
* because nothing then knows what the browser did. It is never replayed.
|
|
287
|
-
*/
|
|
288
|
-
interface NavigationOperation {
|
|
289
|
-
/** What was navigated, read before dispatch. */
|
|
290
|
-
readonly target: Target;
|
|
291
|
-
/**
|
|
292
|
-
* What was asked for, as checked before dispatch. `Plan.recordedNavigation` records this
|
|
293
|
-
* request, not the address `completed` reports after any redirect.
|
|
294
|
-
*/
|
|
295
|
-
readonly request: StartNavigationRequest;
|
|
296
|
-
/**
|
|
297
|
-
* The document reached DOMContentLoaded. It belongs to this one navigation: a successor that
|
|
298
|
-
* reaches the same URL fails it instead. Interrupting a waiter stops nothing in the browser.
|
|
299
|
-
*/
|
|
300
|
-
readonly completed: Effect.Effect<NavigationResult, BrowserError>;
|
|
301
|
-
/**
|
|
302
|
-
* Asks the browser to stop loading and waits for this navigation to settle, after which
|
|
303
|
-
* `completed` fails `interrupted`. Success is a known outcome and the session stays usable:
|
|
304
|
-
* the page holds whatever had loaded. It does not undo anything the page already did.
|
|
305
|
-
* An already-completed navigation cannot stop a successor. Concurrent callers share their
|
|
306
|
-
* active attempt. Before dispatch, cancellation or a busy refusal permits a later request
|
|
307
|
-
* once native setup has retired. A dispatched attempt's outcome, including failure or
|
|
308
|
-
* interruption, is retained permanently; an uncertain stop is never replayed.
|
|
309
|
-
*/
|
|
310
|
-
readonly stop: Effect.Effect<void, BrowserError>;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Host control over one owned browser. This is not a serializable model value: copying a
|
|
314
|
-
* session object cannot copy its capture, page-control or connection authority.
|
|
315
|
-
*
|
|
316
|
-
* Browser operations belong to issued Page and Frame objects. Display selection and owner
|
|
317
|
-
* lifecycle are separate from those exact capabilities.
|
|
318
|
-
*/
|
|
319
|
-
interface BrowserSession<E = never> {
|
|
320
|
-
/** The original owner's host clock, for same-runtime absolute cue scheduling. */
|
|
321
|
-
readonly monotonicTimeNanos: Effect.Effect<bigint>;
|
|
322
|
-
/** Stable facade: each snapshot/stream captures the current journal when it executes. */
|
|
323
|
-
readonly timeline: Timeline;
|
|
324
|
-
/** Atomic cached Inventory baseline followed by lifecycle evidence on its pinned journal. */
|
|
325
|
-
readonly pages: Stream.Stream<PageEvent, TimelineError>;
|
|
326
|
-
/** The page acquired on the initial connection, independent of later display selection. */
|
|
327
|
-
readonly initialPage: Page;
|
|
328
|
-
/**
|
|
329
|
-
* Authenticate `info` against the live native page and return its canonical issued Page. This
|
|
330
|
-
* takes the registry permit, not the page's own: it never waits for, or fails `busy` on, work
|
|
331
|
-
* already running on that page.
|
|
332
|
-
*/
|
|
333
|
-
readonly page: (info: PageInfo, options?: OperationOptions) => Effect.Effect<Page, BrowserError>;
|
|
334
|
-
readonly listPages: (options?: OperationOptions) => Effect.Effect<ReadonlyArray<PageInfo>, BrowserError>;
|
|
335
|
-
/** The implementation which owns this live connection. */
|
|
336
|
-
readonly implementation: string;
|
|
337
|
-
/** Copied host-only state, readable without admission in every lifecycle phase. */
|
|
338
|
-
readonly status: Effect.Effect<SessionStatus>;
|
|
339
|
-
/** Bounded native/policy diagnostics. Typed callback causes remain in bindingDiagnostics. */
|
|
340
|
-
readonly diagnostics: Effect.Effect<BrowserDiagnostics>;
|
|
341
|
-
readonly admission: Effect.Effect<SessionAdmissionStatus>;
|
|
342
|
-
/** Close this scope and require its own ownership-specific cleanup evidence. */
|
|
343
|
-
readonly closeChecked: Effect.Effect<void, BrowserError>;
|
|
344
|
-
/** First fail-session callback cause, preserving the consumer's error type on the host. */
|
|
345
|
-
readonly failure: Effect.Effect<never, E | InitializationError>;
|
|
346
|
-
/** Bounded host-only evidence; consumer causes are never projected into a page reply. */
|
|
347
|
-
readonly bindingDiagnostics: Effect.Effect<BindingDiagnostics<E>>;
|
|
348
|
-
/**
|
|
349
|
-
* Choose the displayed page, which is also the page `detach` records and `reconnect` resumes on.
|
|
350
|
-
* Nothing else: it never retargets a Page or Frame operation, which keep their own exact
|
|
351
|
-
* authority. Pass a Page this session issued; a closed or stale one is refused unsent.
|
|
352
|
-
*/
|
|
353
|
-
readonly selectPage: (page: Page, options?: OperationOptions) => Effect.Effect<void, BrowserError>;
|
|
354
|
-
/**
|
|
355
|
-
* Open a page in its own window, sized like the others, without selecting it, and return the
|
|
356
|
-
* Page issued for it. Chromium paints every window, so any page can be pictured and read at
|
|
357
|
-
* speed, not only the one in front. Registry admission fails immediately by default; pass a
|
|
358
|
-
* positive finite admission.queue to wait FIFO within the operation deadline.
|
|
359
|
-
*/
|
|
360
|
-
readonly createPage: (options?: OperationOptions) => Effect.Effect<Page, BrowserError>;
|
|
361
|
-
}
|
|
362
|
-
/** Helpers that do not supervise callback failures accept any live browser session. */
|
|
363
|
-
type AnySession = BrowserSession<unknown>;
|
|
364
|
-
/**
|
|
365
|
-
* Check that `page` is a Page or Frame this session issued, by identity, and that its authority
|
|
366
|
-
* is still current: a foreign or copied object fails `UnregisteredSession`, a closed, stale or
|
|
367
|
-
* detached one fails with the same refusal its own operations would report. Adapters such as
|
|
368
|
-
* agent-browser hosts call it once when they bind, so a wrong target fails before any work.
|
|
369
|
-
*/
|
|
370
|
-
declare const checkPage: (session: AnySession, page: Page | Frame) => Effect.Effect<void, BrowserError>;
|
|
371
|
-
/** Dependencies are captured at acquisition, not erased into an environment-free service Layer. */
|
|
372
|
-
interface OpenOptions<E = never, R = never> {
|
|
373
|
-
readonly bootstrap?: Plan<E, R>;
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Acquire, supervise and close one browser in a fresh scope. The callback keeps the concrete
|
|
377
|
-
* Chromium or provider session type. Its scoped work is joined before checked browser cleanup,
|
|
378
|
-
* and cleanup failures remain typed even when the callback has already failed or was cancelled.
|
|
379
|
-
* Acquisition is evaluated once; an uncertain result is never retried.
|
|
380
|
-
*/
|
|
381
|
-
declare const scoped: {
|
|
382
|
-
<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>>;
|
|
383
|
-
<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>>;
|
|
384
|
-
};
|
|
385
|
-
//#endregion
|
|
386
|
-
export { recordedNavigation as A, StepFailed as C, inputSlots as D, encode as E, make as O, RunOptions as S, decode as T, scoped as _, ElementAdmission as a, RecordingIncomplete as b, OpenOptions as c, PageOperations as d, PageStatus as f, checkPage as g, SettledRequest as h, BrowserSession as i, recorded as k, OperationOptions as l, SessionAdmissionStatus as m, AdmissionStatus as n, Frame as o, ResolveOptions as p, AnySession as r, NavigationOperation as s, AdmissionOptions as t, Page as u, InputSlot as v, checkRunOptions as w, RunOperation as x, PlanOperations as y };
|
|
387
|
-
export {};
|
|
388
|
-
//# sourceMappingURL=Browser-BF9_sORP.d.mts.map
|
package/dist/Browser.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Browser.mjs","names":[],"sources":["../src/Browser.ts"],"sourcesContent":["import { type Duration, Effect, type Scope, type Stream } 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, BrowserOperation, Containment, InitializationError } from \"./Errors.ts\";\nimport { resolveTargetControlsForSession } from \"./internal/browser/PageRegistry.ts\";\nimport type { PlanOperations } from \"./Plan.ts\";\nimport type { DescriptorEncoded, ResolveGuard, SettledEvidence } from \"./PlanData.ts\";\nimport type { Timeline } from \"./Timeline.ts\";\nimport type { PageEvent, TimelineError } from \"./TimelineData.ts\";\n\n/**\n * Host-only ordinary admission. Omission or zero fails immediately; positive finite duration\n * queues FIFO. Page closure uses reserved fail-fast admission and a deadline-bounded shared close.\n */\nexport interface AdmissionOptions {\n readonly queue?: Duration.Input;\n}\n\n/** Explicit host options, separate from request data and exact-element admission callbacks. */\nexport interface OperationOptions {\n readonly timeoutMillis?: number;\n readonly admission?: AdmissionOptions;\n}\n\n/** Explicit descriptor guard and ordinary host admission; no selector or geometry fallback. */\nexport interface ResolveOptions extends OperationOptions {\n readonly guard?: typeof ResolveGuard.Encoded;\n}\n\n/** Named native quiet signals within the original positive finite deadline. */\nexport interface SettledRequest {\n readonly quiet: Duration.Input;\n readonly within: Duration.Input;\n}\n\n/** A bounded host-memory snapshot; it grants no priority or native authority. */\nexport interface AdmissionStatus {\n readonly active: BrowserOperation | null;\n readonly waiting: number;\n readonly maximum: number;\n readonly oldestWaitMillis: number | null;\n readonly nativePending: number;\n readonly nativeWaitPending: boolean;\n readonly stopSetupPending: boolean;\n}\n\nexport interface SessionAdmissionStatus {\n readonly waiting: number;\n readonly maximum: number;\n readonly nativePending: number;\n readonly nativeMaximum: number;\n readonly nativeWaits: number;\n readonly stopSetups: number;\n readonly registry: AdmissionStatus;\n}\n\n/** Terminal facts remain readable after this page loses live authority. */\nexport interface PageStatus {\n readonly identity: Target;\n readonly phase: \"open\" | \"paused\" | \"closing\" | \"closed\" | \"stale\";\n readonly containment: Containment;\n readonly admission: AdmissionStatus;\n}\n\nexport interface PageOperations {\n readonly navigate: (\n request: NavigateRequest,\n options?: OperationOptions,\n ) => Effect.Effect<NavigationResult, BrowserError>;\n /** `navigate`, left in flight: the same single dispatch, completed by the caller. */\n readonly startNavigation: (\n request: StartNavigationRequest,\n options?: OperationOptions,\n ) => Effect.Effect<NavigationOperation, BrowserError, Scope.Scope>;\n readonly readText: (\n request: ReadTextRequest,\n options?: OperationOptions,\n ) => Effect.Effect<TextResult, BrowserError>;\n readonly click: (\n request: ClickRequest,\n options?: OperationOptions,\n ) => Effect.Effect<ActionResult, BrowserError>;\n readonly fill: (\n request: FillRequest,\n options?: OperationOptions,\n ) => Effect.Effect<ActionResult, BrowserError>;\n /** Script in the page: instantaneous, and it raises no wheel event. */\n readonly scroll: (\n request: ScrollRequest,\n options?: OperationOptions,\n ) => Effect.Effect<ActionResult, BrowserError>;\n /** One real pointer move, in main-frame viewport pixels. */\n readonly pointerMove: (\n request: PointerMoveRequest,\n options?: OperationOptions,\n ) => Effect.Effect<InputReceipt, BrowserError>;\n /** Places the pointer on one exact element where it is, or fails `not-visible` unsent. */\n readonly hover: (\n request: HoverRequest,\n options?: OperationOptions,\n ) => Effect.Effect<InputReceipt, BrowserError>;\n /** One real wheel event; the browser decides what under the pointer scrolls. */\n readonly wheel: (\n request: WheelRequest,\n options?: OperationOptions,\n ) => 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: (\n request: PressRequest,\n options?: OperationOptions,\n ) => Effect.Effect<InputReceipt, BrowserError>;\n /** Text as the real key strokes that produce it, under the same focus rule as `press`. */\n readonly type: (\n request: TypeRequest,\n options?: OperationOptions,\n ) => Effect.Effect<InputReceipt, BrowserError>;\n readonly screenshot: (\n request: ScreenshotRequest,\n options?: OperationOptions,\n ) => Effect.Effect<ScreenshotResult, 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: (\n options?: ObservationOptions,\n operationOptions?: OperationOptions,\n ) => 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: (\n options?: CheckpointOptions,\n operationOptions?: OperationOptions,\n ) => Effect.Effect<Checkpoint, BrowserError>;\n /** Host-only facts about one observed control, read from that exact node just now. */\n readonly controlFacts: (\n reference: ObservedElement,\n options?: OperationOptions,\n ) => 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 options?: OperationOptions,\n ) => Effect.Effect<ObservedElement, BrowserError>;\n readonly clickElement: (\n reference: ObservedElement,\n admission?: ElementAdmission,\n options?: OperationOptions,\n ) => Effect.Effect<ActionResult, BrowserError>;\n readonly fillElement: (\n reference: ObservedElement,\n value: string,\n admission?: ElementAdmission,\n options?: OperationOptions,\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 operationOptions?: OperationOptions,\n ) => Effect.Effect<ActionResult, BrowserError>;\n readonly hoverElement: (\n reference: ObservedElement,\n admission?: ElementAdmission,\n options?: OperationOptions,\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 options?: OperationOptions,\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 options?: OperationOptions,\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 operationOptions?: OperationOptions,\n ) => Effect.Effect<FillFormResult, 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: (\n request: WaitForElementRequest,\n options?: OperationOptions,\n ) => Effect.Effect<void, BrowserError>;\n readonly waitFor: (\n request: {\n readonly selector: string;\n readonly state: \"visible\" | \"hidden\" | \"attached\" | \"detached\";\n },\n options?: OperationOptions,\n ) => Effect.Effect<void, BrowserError>;\n /** Navigation observation is registered before the single click dispatch. */\n readonly clickAndWait: (\n request: ClickRequest,\n options?: OperationOptions,\n ) => 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: (\n options?: OperationOptions,\n ) => Effect.Effect<Bootstrap.ReadinessOutcome, InitializationError>;\n}\n\n/**\n * Issued live authority for one native frame; navigation keeps the frame and retires its references.\n *\n * Pass the issued object itself. Capture, page control, provider transfers, agent tools and\n * `checkPage` authenticate it by identity, so a spread copy, wrapper or Proxy is refused\n * `UnregisteredSession` even though its copied methods still run. Observe work through the\n * timeline and run receipts rather than by wrapping methods.\n */\nexport interface Frame extends PageOperations, PlanOperations {\n readonly identity: Target;\n readonly status: Effect.Effect<PageStatus>;\n /**\n * The original owner's host monotonic clock, the same one `session.monotonicTimeNanos` reads,\n * so a host bound to this Page or Frame can compute a plan's `startAt` without the session.\n */\n readonly monotonicTimeNanos: Effect.Effect<bigint>;\n /** Resolve full descriptor intent against the complete current native candidate inventory. */\n readonly resolve: (\n descriptor: DescriptorEncoded,\n options?: ResolveOptions,\n ) => Effect.Effect<ObservedElement, BrowserError>;\n /**\n * Quiet DOM mutation, scroll, root geometry and viewport signals in one pinned document.\n * This does not establish network, animation or business completion.\n */\n readonly settled: (\n request: SettledRequest,\n options?: OperationOptions,\n ) => Effect.Effect<SettledEvidence, BrowserError>;\n}\n\n/** Issued live authority for one native page on its original connection; pass it as issued, see `Frame`. */\nexport interface Page extends Frame {\n /** Evidence for this issued Page's original domain; navigation does not change its journal. */\n readonly timeline: Timeline;\n /**\n * Read this page's address and title. Like `listFrames`, it is a read of the page and shares\n * its permit; pass `admission.queue` to wait behind work already running there.\n */\n readonly describe: (options?: OperationOptions) => Effect.Effect<PageInfo, BrowserError>;\n readonly listFrames: (\n options?: OperationOptions,\n ) => Effect.Effect<ReadonlyArray<FrameInfo>, BrowserError>;\n /** Issue a child Frame. Like `session.page`, issuing takes the registry permit, not this page's. */\n readonly frame: (\n info: FrameInfo,\n options?: OperationOptions,\n ) => Effect.Effect<Frame, BrowserError>;\n readonly resizeViewport: (\n viewport: Viewport,\n options?: OperationOptions,\n ) => Effect.Effect<void, BrowserError>;\n /** Reserved fail-fast admission; timeoutMillis bounds joining a close, not admission.queue. */\n readonly close: (options?: OperationOptions) => Effect.Effect<void, BrowserError>;\n}\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 other ordinary operations on that Page. 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 revokes and attempts to close its exact page. Positive closure\n * preserves healthy peers; unconfirmed closure fences the session. Its outcome remains unknown\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 * What was asked for, as checked before dispatch. `Plan.recordedNavigation` records this\n * request, not the address `completed` reports after any redirect.\n */\n readonly request: StartNavigationRequest;\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/**\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 * Browser operations belong to issued Page and Frame objects. Display selection and owner\n * lifecycle are separate from those exact capabilities.\n */\nexport interface BrowserSession<E = never> {\n /** The original owner's host clock, for same-runtime absolute cue scheduling. */\n readonly monotonicTimeNanos: Effect.Effect<bigint>;\n /** Stable facade: each snapshot/stream captures the current journal when it executes. */\n readonly timeline: Timeline;\n /** Atomic cached Inventory baseline followed by lifecycle evidence on its pinned journal. */\n readonly pages: Stream.Stream<PageEvent, TimelineError>;\n /** The page acquired on the initial connection, independent of later display selection. */\n readonly initialPage: Page;\n /**\n * Authenticate `info` against the live native page and return its canonical issued Page. This\n * takes the registry permit, not the page's own: it never waits for, or fails `busy` on, work\n * already running on that page.\n */\n readonly page: (info: PageInfo, options?: OperationOptions) => Effect.Effect<Page, BrowserError>;\n readonly listPages: (\n options?: OperationOptions,\n ) => Effect.Effect<ReadonlyArray<PageInfo>, BrowserError>;\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 readonly admission: Effect.Effect<SessionAdmissionStatus>;\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 /**\n * Choose the displayed page, which is also the page `detach` records and `reconnect` resumes on.\n * Nothing else: it never retargets a Page or Frame operation, which keep their own exact\n * authority. Pass a Page this session issued; a closed or stale one is refused unsent.\n */\n readonly selectPage: (\n page: Page,\n options?: OperationOptions,\n ) => Effect.Effect<void, BrowserError>;\n /**\n * Open a page in its own window, sized like the others, without selecting it, and return the\n * Page issued for it. Chromium paints every window, so any page can be pictured and read at\n * speed, not only the one in front. Registry admission fails immediately by default; pass a\n * positive finite admission.queue to wait FIFO within the operation deadline.\n */\n readonly createPage: (options?: OperationOptions) => Effect.Effect<Page, BrowserError>;\n}\n\n/** Helpers that do not supervise callback failures accept any live browser session. */\nexport type AnySession = BrowserSession<unknown>;\n\n/**\n * Check that `page` is a Page or Frame this session issued, by identity, and that its authority\n * is still current: a foreign or copied object fails `UnregisteredSession`, a closed, stale or\n * detached one fails with the same refusal its own operations would report. Adapters such as\n * agent-browser hosts call it once when they bind, so a wrong target fails before any work.\n */\nexport const checkPage = (\n session: AnySession,\n page: Page | Frame,\n): Effect.Effect<void, BrowserError> =>\n resolveTargetControlsForSession(session, page).pipe(Effect.asVoid);\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":";;;;;;;;;;AAubA,MAAa,aACX,SACA,SAEA,gCAAgC,SAAS,IAAI,CAAC,CAAC,KAAK,OAAO,MAAM;;;;;;;AAanE,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"}
|