@effect-agent/platform-cloudflare 0.1.0-beta.85 → 0.1.0-beta.86
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/dist/Alarm.d.mts +4 -4
- package/dist/Alarm.mjs +5 -5
- package/dist/Alarm.mjs.map +1 -1
- package/dist/BrowserRestCapture.d.mts +3 -3
- package/dist/BrowserRestCapture.mjs +3 -3
- package/dist/BrowserRestCapture.mjs.map +1 -1
- package/dist/BrowserRestCrawl.d.mts +2 -2
- package/dist/BrowserRestCrawl.mjs +2 -2
- package/dist/BrowserRestCrawl.mjs.map +1 -1
- package/dist/CloudflareBindings.d.mts +2 -2
- package/dist/CloudflareBindings.mjs +2 -2
- package/dist/CloudflareBindings.mjs.map +1 -1
- package/dist/{CloudflareBrowser-D4YqaTAl.mjs → CloudflareBrowser-DV6kya1H.mjs} +4 -4
- package/dist/CloudflareBrowser-DV6kya1H.mjs.map +1 -0
- package/dist/{CloudflareBrowser-DJq53niJ.d.mts → CloudflareBrowser-Doe1M7R5.d.mts} +4 -4
- package/dist/CloudflareBrowser.d.mts +1 -1
- package/dist/CloudflareBrowser.mjs +1 -1
- package/dist/CloudflareCodeMode.d.mts +2 -2
- package/dist/CloudflareCodeMode.mjs +2 -2
- package/dist/CloudflareCodeMode.mjs.map +1 -1
- package/dist/CloudflareConfig.mjs +3 -3
- package/dist/CloudflareConfig.mjs.map +1 -1
- package/dist/CloudflareMemory.d.mts +26 -26
- package/dist/CloudflareMemory.mjs +11 -11
- package/dist/CloudflareMemory.mjs.map +1 -1
- package/dist/CloudflareScheduling.d.mts +3 -3
- package/dist/CloudflareScheduling.mjs +9 -9
- package/dist/CloudflareScheduling.mjs.map +1 -1
- package/dist/CloudflareSubscriptions.d.mts +5 -5
- package/dist/CloudflareSubscriptions.mjs +8 -8
- package/dist/CloudflareSubscriptions.mjs.map +1 -1
- package/dist/CloudflareThreadClient.d.mts +20 -20
- package/dist/CloudflareThreadClient.mjs +11 -11
- package/dist/CloudflareThreadClient.mjs.map +1 -1
- package/dist/InteractiveBrowser.d.mts +2 -2
- package/dist/InteractiveBrowser.mjs +3 -3
- package/dist/InteractiveBrowser.mjs.map +1 -1
- package/dist/ProtectedBrowser.d.mts +2 -2
- package/dist/ProtectedBrowser.mjs +2 -2
- package/dist/ProtectedBrowser.mjs.map +1 -1
- package/dist/{ThreadObject-gyx8Qq03.mjs → ThreadObject-B4gJ7t0d.mjs} +25 -25
- package/dist/ThreadObject-B4gJ7t0d.mjs.map +1 -0
- package/dist/{ThreadObject-DZMkwIBh.d.mts → ThreadObject-BT0c-_vx.d.mts} +60 -60
- package/dist/ThreadObject.d.mts +1 -1
- package/dist/ThreadObject.mjs +1 -1
- package/dist/WakeScheduler.d.mts +1 -1
- package/dist/WakeScheduler.mjs +2 -2
- package/dist/WakeScheduler.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{prepared-admission-DSi55W-7.mjs → prepared-admission-DU0_T-ev.mjs} +7 -7
- package/dist/prepared-admission-DU0_T-ev.mjs.map +1 -0
- package/package.json +1 -1
- package/src/Alarm.ts +13 -13
- package/src/BrowserRestCapture.ts +3 -3
- package/src/BrowserRestCrawl.ts +12 -12
- package/src/CloudflareBindings.ts +2 -2
- package/src/CloudflareCodeMode.ts +4 -4
- package/src/CloudflareConfig.ts +3 -3
- package/src/CloudflareMemory.ts +22 -22
- package/src/CloudflareScheduling.ts +11 -11
- package/src/CloudflareSubscriptions.ts +10 -14
- package/src/CloudflareThreadClient.ts +13 -13
- package/src/InteractiveBrowser.ts +15 -15
- package/src/ThreadObject.ts +14 -14
- package/src/WakeScheduler.ts +2 -2
- package/src/internal/browser-quick-action.ts +4 -4
- package/src/internal/layers.ts +47 -47
- package/src/internal/message-delivery.ts +4 -4
- package/src/internal/prepared-admission.ts +7 -7
- package/src/internal/transport.ts +1 -1
- package/src/protected-browser/binding.ts +2 -2
- package/src/protected-browser/native.ts +3 -3
- package/src/protected-browser/policy.ts +13 -13
- package/dist/CloudflareBrowser-D4YqaTAl.mjs.map +0 -1
- package/dist/ThreadObject-gyx8Qq03.mjs.map +0 -1
- package/dist/prepared-admission-DSi55W-7.mjs.map +0 -1
package/src/internal/layers.ts
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type RunContextPreparation,
|
|
4
|
-
type RunCostEstimator,
|
|
5
|
-
type RunToolFailureObserver,
|
|
6
|
-
} from "@effect-agent/engine/RunOptions";
|
|
7
|
-
import {
|
|
8
|
-
CurrentToolFailureObserver,
|
|
9
|
-
RunContextPreparationPassthrough,
|
|
10
|
-
RunToolAuthorization,
|
|
11
|
-
toolFailureObserverLayer,
|
|
12
|
-
} from "@effect-agent/engine/RunOptions";
|
|
13
|
-
import { doMessageDeliveryStoreLayer } from "@effect-agent/storage-cloudflare/DoMessageDeliveryStore";
|
|
1
|
+
import { doMessageDeliveryStoreLayer } from "@effect-agent/storage-cloudflare/do-message-delivery-store";
|
|
14
2
|
import {
|
|
15
3
|
type DoStorageFailpointHandler,
|
|
16
4
|
type DoStorageFailpoint,
|
|
17
|
-
} from "@effect-agent/storage-cloudflare/
|
|
18
|
-
import { submissionLedgerLayer } from "@effect-agent/storage-cloudflare/
|
|
5
|
+
} from "@effect-agent/storage-cloudflare/do-storage-failpoint";
|
|
6
|
+
import { submissionLedgerLayer } from "@effect-agent/storage-cloudflare/do-submission-ledger";
|
|
19
7
|
import {
|
|
20
8
|
threadStoreLayer,
|
|
21
9
|
storageConfigLayer,
|
|
22
10
|
storageFailpointLayer,
|
|
23
11
|
type DoStorageInitializationError,
|
|
24
12
|
type DoStorageOptions,
|
|
25
|
-
} from "@effect-agent/storage-cloudflare/
|
|
26
|
-
import {
|
|
13
|
+
} from "@effect-agent/storage-cloudflare/do-thread-store";
|
|
14
|
+
import {
|
|
15
|
+
type PortRequest,
|
|
16
|
+
type PortResponse,
|
|
17
|
+
} from "@effect-agent/storage-cloudflare/port-protocol";
|
|
27
18
|
import {
|
|
28
19
|
executePortRequest,
|
|
29
20
|
routedThreadStoreLayer,
|
|
30
21
|
routedSubmissionLedgerLayer,
|
|
31
|
-
} from "@effect-agent/storage-cloudflare/
|
|
22
|
+
} from "@effect-agent/storage-cloudflare/port-routing";
|
|
23
|
+
import { BrowserCrypto } from "@effect/platform-browser";
|
|
24
|
+
import { SqliteClient } from "@effect/sql-sqlite-do";
|
|
25
|
+
import {
|
|
26
|
+
type Crypto,
|
|
27
|
+
Cause,
|
|
28
|
+
Context,
|
|
29
|
+
Duration,
|
|
30
|
+
Effect,
|
|
31
|
+
Layer,
|
|
32
|
+
Schema,
|
|
33
|
+
Semaphore,
|
|
34
|
+
type Option,
|
|
35
|
+
} from "effect";
|
|
32
36
|
import {
|
|
33
37
|
compileRegistrations,
|
|
34
38
|
type AgentRegistration,
|
|
35
39
|
type ResolvedBinding,
|
|
36
|
-
} from "
|
|
37
|
-
import { type DigestError } from "
|
|
38
|
-
import {
|
|
39
|
-
DurableAgentRuntime,
|
|
40
|
-
DurableRuntimeConfig,
|
|
41
|
-
} from "@effect-agent/thread/DurableAgentRuntime";
|
|
40
|
+
} from "effect-agent/agent-registration";
|
|
41
|
+
import { type DigestError } from "effect-agent/digest";
|
|
42
|
+
import { DurableAgentRuntime, DurableRuntimeConfig } from "effect-agent/durable-agent-runtime";
|
|
42
43
|
import {
|
|
43
44
|
DurableRuntimeFailpoint,
|
|
44
45
|
type DurableRuntimeFailpointHandler,
|
|
45
|
-
} from "
|
|
46
|
+
} from "effect-agent/durable-failpoint";
|
|
47
|
+
import { ThreadId, type SubmissionId } from "effect-agent/identifiers";
|
|
46
48
|
import {
|
|
47
49
|
type MessageDeliveryStore,
|
|
48
50
|
MessageDeliveryDriver,
|
|
49
51
|
type MessageDeliveryError,
|
|
50
|
-
} from "
|
|
52
|
+
} from "effect-agent/message-delivery";
|
|
51
53
|
import {
|
|
52
54
|
operationAuthorizerLayer,
|
|
53
55
|
type OperationAuthorizerService,
|
|
54
|
-
} from "
|
|
55
|
-
import { type PreparedInputAdmission } from "
|
|
56
|
-
import { ProducerId } from "
|
|
56
|
+
} from "effect-agent/operation-authorizer";
|
|
57
|
+
import { type PreparedInputAdmission } from "effect-agent/prepared-input-admission";
|
|
58
|
+
import { ProducerId } from "effect-agent/records";
|
|
59
|
+
import {
|
|
60
|
+
type RunContextPreparation,
|
|
61
|
+
type RunCostEstimator,
|
|
62
|
+
type RunToolFailureObserver,
|
|
63
|
+
} from "effect-agent/run-options";
|
|
64
|
+
import {
|
|
65
|
+
CurrentToolFailureObserver,
|
|
66
|
+
RunContextPreparationPassthrough,
|
|
67
|
+
RunToolAuthorization,
|
|
68
|
+
toolFailureObserverLayer,
|
|
69
|
+
} from "effect-agent/run-options";
|
|
57
70
|
import {
|
|
58
71
|
LedgerError,
|
|
59
72
|
SubmissionLedger,
|
|
60
73
|
SubmissionLookupById,
|
|
61
74
|
type SubmissionSnapshot,
|
|
62
|
-
} from "
|
|
63
|
-
import { ThreadProjectionMaintenance } from "
|
|
64
|
-
import { ThreadStoreError, ThreadStore } from "
|
|
65
|
-
import { ToolReconciler } from "
|
|
66
|
-
import { type WakeScheduler } from "
|
|
67
|
-
import { BrowserCrypto } from "@effect/platform-browser";
|
|
68
|
-
import { SqliteClient } from "@effect/sql-sqlite-do";
|
|
69
|
-
import {
|
|
70
|
-
type Crypto,
|
|
71
|
-
Cause,
|
|
72
|
-
Context,
|
|
73
|
-
Duration,
|
|
74
|
-
Effect,
|
|
75
|
-
Layer,
|
|
76
|
-
Schema,
|
|
77
|
-
Semaphore,
|
|
78
|
-
type Option,
|
|
79
|
-
} from "effect";
|
|
75
|
+
} from "effect-agent/submission-ledger";
|
|
76
|
+
import { ThreadProjectionMaintenance } from "effect-agent/thread-projection-maintenance";
|
|
77
|
+
import { ThreadStoreError, ThreadStore } from "effect-agent/thread-store";
|
|
78
|
+
import { ToolReconciler } from "effect-agent/tool-reconciler";
|
|
79
|
+
import { type WakeScheduler } from "effect-agent/wake-scheduler";
|
|
80
80
|
import { SqlClient } from "effect/unstable/sql/SqlClient";
|
|
81
81
|
|
|
82
82
|
import {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Clock, Context, Deferred, Effect, Layer, Option, Ref, Semaphore, Stream } from "effect";
|
|
2
|
+
import { type ThreadId } from "effect-agent/identifiers";
|
|
2
3
|
import {
|
|
3
4
|
MessageDeliveryDriver,
|
|
4
5
|
MessageDeliveryError,
|
|
5
6
|
MessageDeliveryStore,
|
|
6
|
-
} from "
|
|
7
|
-
import { WakeScheduler } from "
|
|
8
|
-
import { Clock, Context, Deferred, Effect, Layer, Option, Ref, Semaphore, Stream } from "effect";
|
|
7
|
+
} from "effect-agent/message-delivery";
|
|
8
|
+
import { WakeScheduler } from "effect-agent/wake-scheduler";
|
|
9
9
|
|
|
10
10
|
import { DurableAlarmError, ThreadMessageDelivery, ThreadMutationGate } from "../Alarm.ts";
|
|
11
11
|
import { ThreadObjectPlacement } from "../CloudflareBindings.ts";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type DurableSubmitAgent } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
2
|
+
import { type DurableSubmitAgent } from "effect-agent/durable-agent-runtime";
|
|
3
|
+
import { type AgentId } from "effect-agent/identifiers";
|
|
4
|
+
import { PreparedInputAdmission } from "effect-agent/prepared-input-admission";
|
|
5
|
+
import { PersistedJson } from "effect-agent/records";
|
|
5
6
|
import {
|
|
6
7
|
type ScheduledEnvelope,
|
|
7
8
|
ScheduledInputAdmission,
|
|
8
9
|
ScheduledInputRetryable,
|
|
9
10
|
ScheduledInputRefused,
|
|
10
11
|
ScheduleStorageError,
|
|
11
|
-
} from "
|
|
12
|
-
import { type PreparedInput } from "
|
|
13
|
-
import { Effect, Layer } from "effect";
|
|
12
|
+
} from "effect-agent/schedule";
|
|
13
|
+
import { type PreparedInput } from "effect-agent/subscription";
|
|
14
14
|
|
|
15
15
|
import { CloudflareThreadClient, type ThreadClientError } from "../CloudflareThreadClient.ts";
|
|
16
16
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ThreadPortTransport,
|
|
3
3
|
portTransportFailure,
|
|
4
|
-
} from "@effect-agent/storage-cloudflare/
|
|
4
|
+
} from "@effect-agent/storage-cloudflare/port-routing";
|
|
5
5
|
import { Effect, Layer } from "effect";
|
|
6
6
|
|
|
7
7
|
import { callThreadObject, ThreadObjectNamespace } from "../CloudflareBindings.ts";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
2
|
import puppeteer, { type Browser } from "@cloudflare/puppeteer";
|
|
3
|
-
import { type InteractiveBrowserPolicy } from "@effect-agent/sandbox/InteractiveBrowser";
|
|
4
|
-
import { ProtectedBrowserError } from "@effect-agent/sandbox/ProtectedBrowser";
|
|
5
3
|
import { Clock, Context, Crypto, Effect, Layer, Redacted, Schema, type Scope } from "effect";
|
|
4
|
+
import { type InteractiveBrowserPolicy } from "effect-agent/interactive-browser";
|
|
5
|
+
import { ProtectedBrowserError } from "effect-agent/protected-browser";
|
|
6
6
|
|
|
7
7
|
import { BrowserRunSessionLifecycle } from "../internal/browser-session-lifecycle.ts";
|
|
8
8
|
import { makeProtectedNativeTransport, ProtectedNativeSession } from "./native.ts";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
2
|
import type { Browser, Frame, JSHandle, Page } from "@cloudflare/puppeteer";
|
|
3
|
-
import { type
|
|
3
|
+
import { Clock, Context, Crypto, Effect, Redacted, Schema, type Scope } from "effect";
|
|
4
|
+
import { type InteractiveBrowserPolicy } from "effect-agent/interactive-browser";
|
|
4
5
|
import {
|
|
5
6
|
CredentialOrigin,
|
|
6
7
|
CredentialTarget,
|
|
7
8
|
ProtectedBrowserControl,
|
|
8
|
-
} from "
|
|
9
|
-
import { Clock, Context, Crypto, Effect, Redacted, Schema, type Scope } from "effect";
|
|
9
|
+
} from "effect-agent/protected-browser";
|
|
10
10
|
|
|
11
11
|
import { inspectFrame, maxAttributeLength } from "./inspect-frame.ts";
|
|
12
12
|
import {
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Clock,
|
|
3
|
+
Context,
|
|
4
|
+
Crypto,
|
|
5
|
+
Effect,
|
|
6
|
+
Layer,
|
|
7
|
+
Redacted,
|
|
8
|
+
Schema,
|
|
9
|
+
Semaphore,
|
|
10
|
+
type Scope,
|
|
11
|
+
} from "effect";
|
|
12
|
+
import { InteractiveBrowserPolicy } from "effect-agent/interactive-browser";
|
|
2
13
|
/// <reference types="@cloudflare/workers-types" />
|
|
3
14
|
import {
|
|
4
15
|
BrowserCredentialAccess,
|
|
@@ -27,18 +38,7 @@ import {
|
|
|
27
38
|
type ProtectedBrowserAction,
|
|
28
39
|
type ProtectedCleanup,
|
|
29
40
|
type ProtectedObservationState,
|
|
30
|
-
} from "
|
|
31
|
-
import {
|
|
32
|
-
Clock,
|
|
33
|
-
Context,
|
|
34
|
-
Crypto,
|
|
35
|
-
Effect,
|
|
36
|
-
Layer,
|
|
37
|
-
Redacted,
|
|
38
|
-
Schema,
|
|
39
|
-
Semaphore,
|
|
40
|
-
type Scope,
|
|
41
|
-
} from "effect";
|
|
41
|
+
} from "effect-agent/protected-browser";
|
|
42
42
|
|
|
43
43
|
export class ProtectedTransportError extends Schema.TaggedError<ProtectedTransportError>()(
|
|
44
44
|
"ProtectedTransportError",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CloudflareBrowser-D4YqaTAl.mjs","names":[],"sources":["../src/internal/browser-quick-action.ts","../src/CloudflareBrowser.ts"],"sourcesContent":["/// <reference types=\"@cloudflare/workers-types\" />\n\nimport {\n PageCapture,\n PageCaptureInferenceUse,\n PageCaptureInferencePolicyError,\n PageCaptureNavigationError,\n PageCaptureOutputLimitError,\n PageCaptureProtocolError,\n PageCaptureRateLimitedError,\n PageCaptureResourceUse,\n PageCaptureResult,\n PageCaptureUnsupportedError,\n PageContentCaptured,\n PageLinksCaptured,\n PageMarkdownCaptured,\n PageScrapeCaptured,\n PageStructuredCaptured,\n type PageCaptureAction,\n type PageCaptureCapture,\n type PageCaptureError,\n type PageCaptureOutput,\n type PageCaptureRequest,\n} from \"@effect-agent/sandbox/PageCapture\";\nimport {\n PageScreenshot,\n PageScreenshotOutputLimitError,\n PageScreenshotResult,\n type PageScreenshotCapture,\n type PageScreenshotError,\n type PageScreenshotRequest,\n} from \"@effect-agent/sandbox/PageScreenshot\";\nimport { SandboxImplementation } from \"@effect-agent/sandbox/Sandbox\";\nimport { Context, Effect, Layer, Option, Schema } from \"effect\";\n\n/**\n * The Cloudflare Browser Run Quick Action `PageCapture` adapter (capability\n * spec §9.2). Each capture is one stateless `quickAction()` RPC on the\n * Wrangler `browser` binding: the platform renders the target in a managed\n * headless browser and returns one bounded output; the adapter holds no\n * session and no state between passes. The binding requires a Worker\n * compatibility date of `2026-03-24` or later, and local `wrangler dev` needs\n * remote mode (`\"remote\": true` on the binding) because `quickAction` has no\n * local implementation.\n *\n * Rendered output is untrusted, attacker-influenced content; this adapter\n * only bounds and types it. Deployment class `E` only: no durability claim.\n */\nexport const browserQuickActionImplementation = SandboxImplementation.make({\n isolation: \"isolated\",\n identity: \"cloudflare-browser-quick-action\",\n});\n\n/**\n * Effect-native client captured by the binding service. Its option types come\n * directly from the pinned Workers declarations rather than a local copy.\n */\nexport interface BrowserQuickActionClient {\n readonly screenshot: (\n options: BrowserRunScreenshotOptions,\n ) => Effect.Effect<Response, BrowserQuickActionRpcError>;\n readonly content: (\n options: BrowserRunContentOptions,\n ) => Effect.Effect<Response, BrowserQuickActionRpcError>;\n readonly markdown: (\n options: BrowserRunMarkdownOptions,\n ) => Effect.Effect<Response, BrowserQuickActionRpcError>;\n readonly links: (\n options: BrowserRunLinksOptions,\n ) => Effect.Effect<Response, BrowserQuickActionRpcError>;\n readonly scrape: (\n options: BrowserRunScrapeOptions,\n ) => Effect.Effect<Response, BrowserQuickActionRpcError>;\n readonly json: (\n options: BrowserRunJsonOptions,\n ) => Effect.Effect<Response, BrowserQuickActionRpcError>;\n}\n\n/** A native binding RPC rejected before it returned an HTTP response. */\nexport class BrowserQuickActionRpcError extends Schema.TaggedError<BrowserQuickActionRpcError>()(\n \"BrowserQuickActionRpcError\",\n {\n action: Schema.Literals([\"screenshot\", \"content\", \"markdown\", \"links\", \"scrape\", \"json\"]),\n cause: Schema.Defect(),\n },\n) {}\n\nexport interface BrowserQuickActionCaptureOptions {\n /** The resolved Wrangler `browser` binding (DEPLOY-014: supplied, never ambient). */\n readonly browser: BrowserRun;\n}\n\n/** Host-owned browser binding authority, supplied explicitly at the composition root. */\nexport class BrowserQuickActionBrowserBinding extends Context.Service<\n BrowserQuickActionBrowserBinding,\n BrowserQuickActionClient\n>()(\"@effect-agent/platform-cloudflare/BrowserQuickActionBrowserBinding\") {\n static layer(\n options: BrowserQuickActionCaptureOptions,\n ): Layer.Layer<BrowserQuickActionBrowserBinding> {\n const browser = options.browser;\n\n const invoke = Effect.fn(\"BrowserQuickActionBrowserBinding.invoke\")(function* (\n action: \"screenshot\" | \"content\" | \"markdown\" | \"links\" | \"scrape\" | \"json\",\n evaluate: () => Promise<Response>,\n ): Effect.fn.Return<Response, BrowserQuickActionRpcError> {\n return yield* Effect.tryPromise({\n try: evaluate,\n catch: (cause) => BrowserQuickActionRpcError.make({ action, cause }),\n });\n });\n\n return Layer.succeed(BrowserQuickActionBrowserBinding)({\n screenshot: (request) =>\n invoke(\"screenshot\", () => browser.quickAction(\"screenshot\", request)),\n content: (request) => invoke(\"content\", () => browser.quickAction(\"content\", request)),\n markdown: (request) => invoke(\"markdown\", () => browser.quickAction(\"markdown\", request)),\n links: (request) => invoke(\"links\", () => browser.quickAction(\"links\", request)),\n scrape: (request) => invoke(\"scrape\", () => browser.quickAction(\"scrape\", request)),\n json: (request) => invoke(\"json\", () => browser.quickAction(\"json\", request)),\n });\n }\n}\n\n/** Host-owned authorization and accounting for one Workers AI extraction. */\nexport interface BrowserQuickActionWorkersAiPolicy {\n readonly authorizeAndAccount: (\n request: PageCaptureRequest,\n ) => Effect.Effect<void, BrowserQuickActionWorkersAiPolicyError>;\n}\n\n/** Host-only diagnostic for a denied or unaccounted Workers AI extraction. */\nexport class BrowserQuickActionWorkersAiPolicyError extends Schema.TaggedError<BrowserQuickActionWorkersAiPolicyError>()(\n \"BrowserQuickActionWorkersAiPolicyError\",\n {\n reason: Schema.Literals([\"authorization\", \"accounting\"]),\n message: Schema.String.check(Schema.isMaxLength(8_000)),\n cause: Schema.optionalKey(Schema.Defect()),\n },\n) {}\n\n/** Explicit host-owned authority and accounting for separately billed Workers AI extraction. */\nexport class BrowserQuickActionWorkersAi extends Context.Service<\n BrowserQuickActionWorkersAi,\n BrowserQuickActionWorkersAiPolicy\n>()(\"@effect-agent/platform-cloudflare/BrowserQuickActionWorkersAi\") {\n static layer(\n policy: BrowserQuickActionWorkersAiPolicy,\n ): Layer.Layer<BrowserQuickActionWorkersAi> {\n return Layer.succeed(BrowserQuickActionWorkersAi)(policy);\n }\n}\n\nconst MAX_DIAGNOSTIC_LENGTH = 8_000;\nconst boundedDiagnostic = (message: string): string => message.slice(0, MAX_DIAGNOSTIC_LENGTH);\n\nconst QuickActionSuccessEnvelope = Schema.Struct({\n success: Schema.Literal(true),\n result: Schema.Json,\n});\n\nconst QuickActionErrorEnvelope = Schema.Struct({\n success: Schema.Literal(false),\n errors: Schema.Array(\n Schema.Struct({\n message: Schema.String,\n code: Schema.optionalKey(Schema.Number),\n detail: Schema.optionalKey(Schema.String),\n path: Schema.optionalKey(Schema.String),\n }),\n ),\n rawAiResponse: Schema.optionalKey(Schema.String),\n});\n\nconst QuickActionEnvelope = Schema.Union([QuickActionSuccessEnvelope, QuickActionErrorEnvelope]);\nconst decodeEnvelope = Schema.decodeUnknownOption(Schema.fromJsonString(QuickActionEnvelope));\n\n/** Recognize only the provider's exact timeout grammar; never forward arbitrary error text. */\nconst navigationFailureMessage = (bodyText: string, response: Response): string => {\n const fallback = `The Browser Run Quick Action API answered HTTP ${response.status}; the destination status is unknown`;\n\n if (!isJsonResponse(response)) return fallback;\n const envelope = decodeEnvelope(bodyText);\n\n if (Option.isNone(envelope) || envelope.value.success) return fallback;\n for (const error of envelope.value.errors) {\n if (error.code !== 6002) continue;\n\n const timeout = /^Navigation timeout of ([1-9][0-9]{0,5}) ms exceeded$/.exec(\n error.detail ?? \"\",\n );\n\n if (timeout !== null)\n return `Browser Run navigation timed out after ${timeout[1]} ms (Quick Action API HTTP ${response.status}); the destination status is unknown`;\n }\n\n return fallback;\n};\n\n/** Project the schema-validated request onto Cloudflare's native common options. */\nconst quickActionCommonOptions = (request: PageCaptureRequest): BrowserRunCommonOptions => {\n const options: BrowserRunBaseOptions = {};\n const navigation = request.navigation;\n\n if (navigation !== undefined) {\n const goto: NonNullable<BrowserRunBaseOptions[\"gotoOptions\"]> = {};\n\n if (navigation.waitUntil !== undefined) goto.waitUntil = navigation.waitUntil;\n if (navigation.timeoutMillis !== undefined) goto.timeout = navigation.timeoutMillis;\n if (Object.keys(goto).length > 0) options.gotoOptions = goto;\n if (navigation.waitForSelector !== undefined) {\n options.waitForSelector = {\n selector: navigation.waitForSelector.selector,\n ...(navigation.waitForSelector.timeoutMillis === undefined\n ? {}\n : { timeout: navigation.waitForSelector.timeoutMillis }),\n };\n }\n }\n if (request.viewport !== undefined) {\n options.viewport = { width: request.viewport.width, height: request.viewport.height };\n }\n if (request.resourcePolicy !== undefined) {\n if (request.resourcePolicy.rejectResourceTypes !== undefined) {\n options.rejectResourceTypes = [...request.resourcePolicy.rejectResourceTypes];\n }\n if (request.resourcePolicy.allowRequestPatterns !== undefined) {\n options.allowRequestPattern = [...request.resourcePolicy.allowRequestPatterns];\n }\n }\n\n return request.target._tag === \"PageUrlTarget\"\n ? { ...options, url: request.target.url }\n : { ...options, html: request.target.html };\n};\n\n/** Dispatch through Cloudflare's native action-specific overloads. */\nconst executeQuickAction = (\n browser: BrowserQuickActionClient,\n request: PageCaptureRequest,\n): Effect.Effect<Response, BrowserQuickActionRpcError> => {\n const options = quickActionCommonOptions(request);\n\n switch (request.action._tag) {\n case \"CapturePageContent\": {\n return browser.content(options);\n }\n case \"CapturePageMarkdown\": {\n return browser.markdown(options);\n }\n case \"CapturePageLinks\": {\n return browser.links({\n ...options,\n ...(request.action.visibleLinksOnly === undefined\n ? {}\n : { visibleLinksOnly: request.action.visibleLinksOnly }),\n });\n }\n case \"CapturePageScrape\": {\n return browser.scrape({\n ...options,\n elements: request.action.selectors.map((selector) => ({ selector })),\n });\n }\n case \"CapturePageStructured\": {\n return browser.json({\n ...options,\n response_format: {\n type: \"json_schema\",\n json_schema: request.action.responseFormat,\n },\n ...(request.action.prompt === undefined ? {} : { prompt: request.action.prompt }),\n });\n }\n }\n};\n\nconst protocolError = (message: string, cause?: unknown): PageCaptureProtocolError =>\n PageCaptureProtocolError.make({\n implementation: browserQuickActionImplementation,\n message: boundedDiagnostic(message),\n ...(cause === undefined ? {} : { cause }),\n });\n\nconst navigationError = (message: string, cause?: unknown): PageCaptureNavigationError =>\n PageCaptureNavigationError.make({\n implementation: browserQuickActionImplementation,\n message: boundedDiagnostic(message),\n ...(cause === undefined ? {} : { cause }),\n });\n\n/** Preserve bounded remote diagnostics for the host without exposing their text to a model. */\nconst privateResponseCause = (bodyText: string, response: Response): Error =>\n new Error(boundedDiagnostic(bodyText), {\n cause: {\n provider: \"cloudflare-browser-run\",\n httpStatus: response.status,\n httpStatusSource: \"browser-api\",\n headers: Object.fromEntries(\n [\"content-type\", \"cf-ray\", \"x-request-id\", \"retry-after\", \"x-browser-ms-used\"].flatMap(\n (name) => {\n const value = response.headers.get(name);\n\n return value === null ? [] : [[name, boundedDiagnostic(value)]];\n },\n ),\n ),\n bodyCharacters: bodyText.length,\n bodyTruncated: bodyText.length > MAX_DIAGNOSTIC_LENGTH,\n },\n });\n\n/** Foreign cancellation must not keep a response Scope open indefinitely. */\nconst cancelResponse = (cancel: () => Promise<void>, warning: string): Effect.Effect<void> =>\n Effect.tryPromise({ try: cancel, catch: () => undefined }).pipe(\n Effect.interruptible,\n Effect.timeoutOrElse({\n duration: \"1 second\",\n orElse: () => Effect.fail(undefined),\n }),\n Effect.catch(() => Effect.logWarning(warning)),\n );\n\nconst releaseResponseReader = (\n reader: ReadableStreamDefaultReader<Uint8Array>,\n): Effect.Effect<void> =>\n cancelResponse(() => reader.cancel(), \"Canceling the Quick Action response failed\").pipe(\n Effect.ensuring(\n Effect.try({\n try: () => reader.releaseLock(),\n catch: (cause) => protocolError(\"Releasing the Quick Action response failed\", cause),\n }).pipe(Effect.catch((error) => Effect.logWarning(error.message))),\n ),\n );\n\nconst readBoundedResponse = Effect.fn(\"BrowserQuickActionCapture.readResponse\")(function* (\n response: Response,\n request: PageCaptureRequest,\n) {\n const body = response.body;\n\n if (body === null) return \"\";\n\n const reader = yield* Effect.acquireRelease(\n Effect.try({\n try: () => body.getReader(),\n catch: (cause) => protocolError(\"Opening the Quick Action response failed\", cause),\n }),\n releaseResponseReader,\n );\n\n const decoder = new TextDecoder(\"utf-8\", { fatal: true, ignoreBOM: false });\n let observedBytes = 0;\n let bodyText = \"\";\n\n while (true) {\n const chunk = yield* Effect.tryPromise({\n try: () => reader.read(),\n catch: (cause) => protocolError(\"Reading the Quick Action response failed\", cause),\n });\n\n if (chunk.done) break;\n\n observedBytes += chunk.value.byteLength;\n if (observedBytes > request.limits.maxOutputBytes) {\n return yield* PageCaptureOutputLimitError.make({\n implementation: browserQuickActionImplementation,\n limit: request.limits.maxOutputBytes,\n observed: observedBytes,\n });\n }\n\n bodyText += yield* Effect.try({\n try: () => decoder.decode(chunk.value, { stream: true }),\n catch: (cause) => protocolError(\"Decoding the Quick Action response failed\", cause),\n });\n }\n\n return (\n bodyText +\n (yield* Effect.try({\n try: () => decoder.decode(),\n catch: (cause) => protocolError(\"Decoding the Quick Action response failed\", cause),\n }))\n );\n}, Effect.scoped);\n\n/**\n * Retry-After arrives in whole seconds; a non-integer form (an HTTP date) is\n * dropped rather than guessed at.\n */\nconst retryAfterMillis = (response: Response): number | undefined => {\n const header = response.headers.get(\"Retry-After\");\n\n if (header === null) return undefined;\n const seconds = Number(header);\n\n if (!Number.isSafeInteger(seconds) || seconds < 0) return undefined;\n const millis = seconds * 1_000;\n\n return Number.isSafeInteger(millis) ? millis : undefined;\n};\n\nconst browserMillis = (response: Response): number | undefined => {\n const header = response.headers.get(\"X-Browser-Ms-Used\");\n\n if (header === null) return undefined;\n const millis = Number(header);\n\n return Number.isSafeInteger(millis) && millis >= 0 ? millis : undefined;\n};\n\n/** Only trusted response metadata chooses transport framing; page text never does. */\nconst isJsonResponse = (response: Response): boolean => {\n const contentType = response.headers.get(\"Content-Type\");\n\n if (contentType === null) return false;\n const mediaType = contentType.split(\";\", 1)[0]?.trim().toLowerCase();\n\n return mediaType === \"application/json\" || mediaType?.endsWith(\"+json\") === true;\n};\n\nconst parseOutput = (\n action: PageCaptureAction,\n bodyText: string,\n response: Response,\n): PageCaptureOutput | PageCaptureNavigationError | PageCaptureProtocolError => {\n if (!isJsonResponse(response)) {\n return protocolError(\n \"The Quick Action success response was not a JSON response envelope\",\n privateResponseCause(bodyText, response),\n );\n }\n const envelope = decodeEnvelope(bodyText);\n\n if (Option.isNone(envelope)) {\n return protocolError(\n \"The JSON Quick Action response did not carry a valid response envelope\",\n privateResponseCause(bodyText, response),\n );\n }\n if (!envelope.value.success) {\n return navigationError(\n navigationFailureMessage(bodyText, response),\n privateResponseCause(bodyText, response),\n );\n }\n switch (action._tag) {\n case \"CapturePageContent\":\n case \"CapturePageMarkdown\": {\n if (typeof envelope.value.result !== \"string\") {\n return protocolError(\"The Quick Action envelope carried a non-text result\");\n }\n\n return action._tag === \"CapturePageContent\"\n ? PageContentCaptured.make({ html: envelope.value.result })\n : PageMarkdownCaptured.make({ markdown: envelope.value.result });\n }\n case \"CapturePageLinks\": {\n const decoded = Schema.decodeUnknownOption(PageLinksCaptured)({\n _tag: \"PageLinksCaptured\",\n links: envelope.value.result,\n });\n\n if (Option.isNone(decoded)) {\n return protocolError(\"The links Quick Action did not return a bounded array of valid URLs\");\n }\n\n return decoded.value;\n }\n case \"CapturePageScrape\": {\n const decoded = Schema.decodeUnknownOption(PageScrapeCaptured)({\n _tag: \"PageScrapeCaptured\",\n groups: envelope.value.result,\n });\n\n if (Option.isNone(decoded)) {\n return protocolError(\n \"The scrape Quick Action did not return bounded grouped element records\",\n );\n }\n\n return decoded.value;\n }\n case \"CapturePageStructured\": {\n return PageStructuredCaptured.make({ value: envelope.value.result });\n }\n }\n};\n\nconst isQuotaMessage = (text: string): boolean => /time limit|daily|quota/i.test(text);\n\nconst makeCapture = (\n browser: BrowserQuickActionClient,\n workersAi?: BrowserQuickActionWorkersAiPolicy,\n): PageCaptureCapture =>\n Effect.fn(\"BrowserQuickActionCapture.capture\")(function* (\n request: PageCaptureRequest,\n ): Effect.fn.Return<PageCaptureResult, PageCaptureError> {\n if (request.engine !== \"chromium\") {\n return yield* PageCaptureUnsupportedError.make({\n implementation: browserQuickActionImplementation,\n feature: \"engine\",\n message:\n \"The browser binding's quickAction() exposes no engine selector; kitesurf requires the REST or CDP surface\",\n });\n }\n\n const usesWorkersAi = request.action._tag === \"CapturePageStructured\";\n\n if (usesWorkersAi) {\n if (workersAi === undefined) {\n return yield* PageCaptureUnsupportedError.make({\n implementation: browserQuickActionImplementation,\n feature: \"action\",\n message:\n \"Structured capture invokes separately billed Workers AI and requires an explicit authorization and accounting policy\",\n });\n }\n yield* workersAi.authorizeAndAccount(request).pipe(\n Effect.mapError((cause) =>\n PageCaptureInferencePolicyError.make({\n implementation: browserQuickActionImplementation,\n provider: \"cloudflare-workers-ai\",\n reason: cause.reason,\n message:\n cause.reason === \"authorization\"\n ? \"Workers AI extraction was not authorized\"\n : \"Workers AI extraction could not be accounted for\",\n cause,\n }),\n ),\n );\n }\n\n const response = yield* executeQuickAction(browser, request).pipe(\n Effect.mapError((error) =>\n protocolError(\"The browser binding rejected the Quick Action\", error.cause),\n ),\n );\n\n const bodyText = yield* readBoundedResponse(response, request);\n\n if (response.status === 429) {\n const retryAfter = retryAfterMillis(response);\n const reason = isQuotaMessage(bodyText) ? \"quota\" : \"rate\";\n const cause = privateResponseCause(bodyText, response);\n\n return yield* PageCaptureRateLimitedError.make({\n implementation: browserQuickActionImplementation,\n reason,\n ...(retryAfter === undefined ? {} : { retryAfterMillis: retryAfter }),\n ...(cause === undefined ? {} : { cause }),\n message:\n reason === \"quota\"\n ? \"The Quick Action exceeded its browser quota\"\n : \"The Quick Action was rate limited\",\n });\n }\n if (!response.ok) {\n const message = navigationFailureMessage(bodyText, response);\n const cause = privateResponseCause(bodyText, response);\n\n if (response.status >= 500) {\n return yield* protocolError(message, cause);\n }\n\n return yield* navigationError(message, cause);\n }\n const output = parseOutput(request.action, bodyText, response);\n\n if (\n output._tag === \"PageCaptureNavigationError\" ||\n output._tag === \"PageCaptureProtocolError\"\n ) {\n return yield* output;\n }\n const millis = browserMillis(response);\n\n return PageCaptureResult.make({\n implementation: browserQuickActionImplementation,\n output,\n resourceUse: PageCaptureResourceUse.make({\n ...(millis === undefined ? {} : { browserMillis: millis }),\n ...(usesWorkersAi\n ? {\n inference: PageCaptureInferenceUse.make({\n provider: \"cloudflare-workers-ai\",\n modelCalls: 1,\n }),\n }\n : {}),\n }),\n });\n });\n\n/**\n * Ordinary Quick Actions require host-owned browser binding authority. Workers\n * AI stays unavailable unless the host deliberately selects its separate Layer.\n */\nexport const browserQuickActionCaptureLayer = (): Layer.Layer<\n PageCapture,\n never,\n BrowserQuickActionBrowserBinding\n> =>\n Layer.effect(\n PageCapture,\n Effect.map(BrowserQuickActionBrowserBinding, (browser) =>\n PageCapture.of({ capture: makeCapture(browser) }),\n ),\n );\n\n/** Structured Quick Actions require host-owned browser and Workers AI authority. */\nexport const browserQuickActionWorkersAiCaptureLayer = (): Layer.Layer<\n PageCapture,\n never,\n BrowserQuickActionBrowserBinding | BrowserQuickActionWorkersAi\n> =>\n Layer.effect(\n PageCapture,\n Effect.gen(function* () {\n const browser = yield* BrowserQuickActionBrowserBinding;\n const workersAi = yield* BrowserQuickActionWorkersAi;\n\n return PageCapture.of({ capture: makeCapture(browser, workersAi) });\n }),\n );\n\n/** Host-owned Quick Action binding and optional, separately billed extraction authority. */\nexport interface CloudflareBrowserOptions extends BrowserQuickActionCaptureOptions {\n readonly workersAi?: BrowserQuickActionWorkersAiPolicy;\n}\n\n/** Compose WebCapture handlers with the Cloudflare Quick Action adapter. */\nexport const CloudflareBrowser = {\n /**\n * Supply a WebCapture definition and the resolved Worker browser binding.\n * Supports capture, scrape, and extraction definitions without importing capabilities.\n * Only PageCapture is provided; other handler requirements and errors stay visible.\n * Extraction fails closed unless workersAi explicitly authorizes and accounts for it.\n * Capture limits, typed failures, tracing, and scoped response cleanup are unchanged.\n */\n layer: <A, E, R>(\n definition: { readonly handlers: Layer.Layer<A, E, R> },\n options: CloudflareBrowserOptions,\n ): Layer.Layer<A, E, Exclude<R, PageCapture>> => {\n const capture =\n options.workersAi === undefined\n ? browserQuickActionCaptureLayer()\n : browserQuickActionWorkersAiCaptureLayer().pipe(\n Layer.provide(BrowserQuickActionWorkersAi.layer(options.workersAi)),\n );\n\n return definition.handlers.pipe(\n Layer.provide(capture.pipe(Layer.provide(BrowserQuickActionBrowserBinding.layer(options)))),\n );\n },\n};\n\nconst screenshotOptions = (request: PageScreenshotRequest): BrowserRunScreenshotOptions => {\n const options: BrowserRunBaseOptions = {};\n\n if (\n request.navigation?.waitUntil !== undefined ||\n request.navigation?.timeoutMillis !== undefined\n ) {\n options.gotoOptions = {\n ...(request.navigation.waitUntil === undefined\n ? {}\n : { waitUntil: request.navigation.waitUntil }),\n ...(request.navigation.timeoutMillis === undefined\n ? {}\n : { timeout: request.navigation.timeoutMillis }),\n };\n }\n if (request.navigation?.waitForSelector !== undefined) {\n options.waitForSelector = {\n selector: request.navigation.waitForSelector.selector,\n ...(request.navigation.waitForSelector.timeoutMillis === undefined\n ? {}\n : { timeout: request.navigation.waitForSelector.timeoutMillis }),\n };\n }\n if (request.viewport !== undefined) {\n options.viewport = { width: request.viewport.width, height: request.viewport.height };\n }\n if (request.resourcePolicy?.rejectResourceTypes !== undefined) {\n options.rejectResourceTypes = [...request.resourcePolicy.rejectResourceTypes];\n }\n if (request.resourcePolicy?.allowRequestPatterns !== undefined) {\n options.allowRequestPattern = [...request.resourcePolicy.allowRequestPatterns];\n }\n\n return {\n ...options,\n ...(request.target._tag === \"PageUrlTarget\"\n ? { url: request.target.url }\n : { html: request.target.html }),\n screenshotOptions: { type: \"png\", encoding: \"binary\", fullPage: request.fullPage },\n };\n};\n\nconst cancelBody = (body: ReadableStream<Uint8Array>): Effect.Effect<void> =>\n cancelResponse(() => body.cancel(), \"Canceling the screenshot response failed\");\n\nconst releaseScreenshotReader = (\n reader: ReadableStreamDefaultReader<Uint8Array>,\n): Effect.Effect<void> =>\n cancelResponse(() => reader.cancel(), \"Canceling the screenshot response failed\").pipe(\n Effect.ensuring(\n Effect.try({\n try: () => reader.releaseLock(),\n catch: () => undefined,\n }).pipe(Effect.catch(() => Effect.logWarning(\"Releasing the screenshot response failed\"))),\n ),\n );\n\nconst pngResponse = (response: Response): boolean =>\n response.headers.get(\"Content-Type\")?.split(\";\", 1)[0]?.trim().toLowerCase() === \"image/png\";\n\nconst declaredLength = (response: Response): number | undefined => {\n const raw = response.headers.get(\"Content-Length\");\n\n if (raw === null || !/^(0|[1-9][0-9]*)$/.test(raw)) return undefined;\n const length = Number(raw);\n\n return Number.isSafeInteger(length) ? length : undefined;\n};\n\nconst readScreenshot = Effect.fn(\"BrowserQuickActionScreenshot.read\")(function* (\n response: Response,\n request: PageScreenshotRequest,\n) {\n const body = response.body;\n\n if (body === null) {\n return yield* protocolError(\"The screenshot response had no body\");\n }\n if (!pngResponse(response)) {\n yield* cancelBody(body);\n\n return yield* protocolError(\"The screenshot response was not image/png\");\n }\n const length = declaredLength(response);\n\n if (length !== undefined && length > request.limits.maxOutputBytes) {\n yield* cancelBody(body);\n\n return yield* PageScreenshotOutputLimitError.make({\n implementation: browserQuickActionImplementation,\n limit: request.limits.maxOutputBytes,\n observed: length,\n });\n }\n\n const reader = yield* Effect.acquireRelease(\n Effect.try({\n try: () => body.getReader(),\n catch: (cause) => protocolError(\"Opening the screenshot response failed\", cause),\n }),\n releaseScreenshotReader,\n );\n\n const chunks: Array<Uint8Array> = [];\n let observed = 0;\n\n while (true) {\n const next = yield* Effect.tryPromise({\n try: () => reader.read(),\n catch: (cause) => protocolError(\"Reading the screenshot response failed\", cause),\n });\n\n if (next.done) break;\n observed += next.value.byteLength;\n if (observed > request.limits.maxOutputBytes) {\n return yield* PageScreenshotOutputLimitError.make({\n implementation: browserQuickActionImplementation,\n limit: request.limits.maxOutputBytes,\n observed,\n });\n }\n chunks.push(next.value);\n }\n const bytes = new Uint8Array(observed);\n let offset = 0;\n\n for (const chunk of chunks) {\n bytes.set(chunk, offset);\n offset += chunk.byteLength;\n }\n\n return bytes;\n}, Effect.scoped);\n\nconst makeScreenshot = (browser: BrowserQuickActionClient): PageScreenshotCapture =>\n Effect.fn(\"BrowserQuickActionScreenshot.capture\")(function* (\n request: PageScreenshotRequest,\n ): Effect.fn.Return<PageScreenshotResult, PageScreenshotError> {\n if (request.engine !== \"chromium\") {\n return yield* PageCaptureUnsupportedError.make({\n implementation: browserQuickActionImplementation,\n feature: \"engine\",\n message: \"The browser binding's screenshot action exposes no engine selector\",\n });\n }\n\n const response = yield* browser\n .screenshot(screenshotOptions(request))\n .pipe(\n Effect.mapError((error) =>\n protocolError(\"The browser binding rejected the screenshot\", error.cause),\n ),\n );\n\n if (response.status === 429) {\n const body = response.body;\n\n if (body !== null) yield* cancelBody(body);\n\n return yield* PageCaptureRateLimitedError.make({\n implementation: browserQuickActionImplementation,\n reason: \"rate\",\n ...(retryAfterMillis(response) === undefined\n ? {}\n : { retryAfterMillis: retryAfterMillis(response) }),\n message: \"The screenshot Quick Action was rate limited\",\n });\n }\n if (!response.ok) {\n const body = response.body;\n\n if (body !== null) yield* cancelBody(body);\n const message = `The screenshot Quick Action answered HTTP ${response.status}`;\n\n return yield* response.status >= 500 ? protocolError(message) : navigationError(message);\n }\n const bytes = yield* readScreenshot(response, request);\n\n return PageScreenshotResult.make({\n implementation: browserQuickActionImplementation,\n mediaType: \"image/png\",\n bytes,\n });\n });\n\n/** Native Browser Run screenshot adapter. It retains PNG bytes only for the caller's result. */\nexport const browserQuickActionScreenshotLayer = (): Layer.Layer<\n PageScreenshot,\n never,\n BrowserQuickActionBrowserBinding\n> =>\n Layer.effect(\n PageScreenshot,\n Effect.map(BrowserQuickActionBrowserBinding, (browser) =>\n PageScreenshot.of({ capture: makeScreenshot(browser) }),\n ),\n );\n","/** Public CloudflareBrowser API. Implementation helpers remain private. */\nexport {\n BrowserQuickActionBrowserBinding,\n BrowserQuickActionRpcError,\n BrowserQuickActionWorkersAi,\n BrowserQuickActionWorkersAiPolicyError,\n browserQuickActionCaptureLayer,\n browserQuickActionWorkersAiCaptureLayer,\n browserQuickActionScreenshotLayer,\n CloudflareBrowser,\n type BrowserQuickActionCaptureOptions,\n type BrowserQuickActionClient,\n type BrowserQuickActionWorkersAiPolicy,\n type CloudflareBrowserOptions,\n} from \"./internal/browser-quick-action.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgDA,MAAa,mCAAmC,sBAAsB,KAAK;CACzE,WAAW;CACX,UAAU;AACZ,CAAC;;AA4BD,IAAa,6BAAb,cAAgD,OAAO,YAAwC,CAAC,CAC9F,8BACA;CACE,QAAQ,OAAO,SAAS;EAAC;EAAc;EAAW;EAAY;EAAS;EAAU;CAAM,CAAC;CACxF,OAAO,OAAO,OAAO;AACvB,CACF,CAAC,CAAC,CAAC;;AAQH,IAAa,mCAAb,MAAa,yCAAyC,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