@effect-agent/platform-cloudflare 0.1.0-beta.88 → 0.1.0-beta.89

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.
@@ -454,13 +454,13 @@ declare const encodeUnknownResolutionCommand: (input: UnknownResolutionCommand,
454
454
  readonly author: string;
455
455
  readonly reason: string;
456
456
  readonly resolution: {
457
- readonly _tag: "SafeToRetry";
458
- } | {
459
457
  readonly _tag: "CompletedWithResult";
460
458
  readonly result: Schema.Json;
461
459
  readonly isFailure: boolean;
462
460
  } | {
463
461
  readonly _tag: "NeverHappened";
462
+ } | {
463
+ readonly _tag: "SafeToRetry";
464
464
  } | {
465
465
  readonly _tag: "AbortSubmission";
466
466
  };
@@ -596,19 +596,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
596
596
  readonly createdAt: string;
597
597
  readonly deploymentId: string;
598
598
  readonly payload: {
599
- readonly _tag: "SubagentStarted";
600
- readonly runId: string;
601
- readonly toolCallId: string;
602
- readonly childThreadId: string;
603
- readonly childSubmissionId: string;
604
- readonly childReceiptId: string;
605
- readonly childRunId: string;
606
- } | {
607
- readonly _tag: "AbortRequested";
608
- readonly submissionId: string;
609
- readonly author: string;
610
- readonly reason: string;
611
- } | {
612
599
  readonly _tag: "ThreadCreated";
613
600
  readonly agentId: string;
614
601
  readonly definitions: {
@@ -852,6 +839,11 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
852
839
  readonly runDisposition?: Schema.Json | undefined;
853
840
  readonly finishReason?: "budget-exhausted" | undefined;
854
841
  readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
842
+ } | {
843
+ readonly _tag: "AbortRequested";
844
+ readonly submissionId: string;
845
+ readonly author: string;
846
+ readonly reason: string;
855
847
  } | {
856
848
  readonly _tag: "SubmissionSettled";
857
849
  readonly submissionId: string;
@@ -979,6 +971,14 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
979
971
  readonly childLifetimes?: readonly ("attached" | "background")[] | undefined;
980
972
  } | undefined;
981
973
  readonly depth?: number | undefined;
974
+ } | {
975
+ readonly _tag: "SubagentStarted";
976
+ readonly runId: string;
977
+ readonly toolCallId: string;
978
+ readonly childThreadId: string;
979
+ readonly childSubmissionId: string;
980
+ readonly childReceiptId: string;
981
+ readonly childRunId: string;
982
982
  } | {
983
983
  readonly _tag: "SubagentJoined";
984
984
  readonly runId: string;
@@ -1332,13 +1332,13 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1332
1332
  readonly author: string;
1333
1333
  readonly reason: string;
1334
1334
  readonly resolution: {
1335
- readonly _tag: "SafeToRetry";
1336
- } | {
1337
1335
  readonly _tag: "CompletedWithResult";
1338
1336
  readonly result: Schema.Json;
1339
1337
  readonly isFailure: boolean;
1340
1338
  } | {
1341
1339
  readonly _tag: "NeverHappened";
1340
+ } | {
1341
+ readonly _tag: "SafeToRetry";
1342
1342
  } | {
1343
1343
  readonly _tag: "AbortSubmission";
1344
1344
  };
@@ -1348,37 +1348,10 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1348
1348
  } | {
1349
1349
  readonly _tag: "HostFailed";
1350
1350
  readonly failure: {
1351
- readonly _tag: "AdmissionConflict";
1352
- readonly threadId: string;
1353
- readonly principal: string;
1354
- readonly idempotencyKey: string;
1355
- readonly existingInputDigest: string;
1356
- readonly attemptedInputDigest: string;
1357
- } | {
1358
- readonly _tag: "AdmissionPolicyError";
1359
- readonly reason: "occupied" | "refused" | "unavailable";
1360
- readonly code: string;
1361
- } | {
1362
- readonly _tag: "SettlementConflict";
1363
- readonly submissionId: string;
1364
- readonly existingOutcome: "aborted" | "completed" | "failed";
1365
- } | {
1366
- readonly _tag: "JoinedToHost";
1367
- readonly submissionId: string;
1368
- readonly hostSubmissionId: string;
1369
- } | {
1370
1351
  readonly _tag: "LedgerError";
1371
1352
  readonly operation: string;
1372
1353
  readonly message: string;
1373
1354
  readonly cause?: Schema.Json | undefined;
1374
- } | {
1375
- readonly _tag: "ThreadStoreError";
1376
- readonly operation: string;
1377
- readonly message: string;
1378
- readonly cause?: Schema.Json | undefined;
1379
- } | {
1380
- readonly _tag: "ThreadNotMaterialized";
1381
- readonly threadId: string;
1382
1355
  } | {
1383
1356
  readonly _tag: "AppendConflict";
1384
1357
  readonly threadId: string;
@@ -1392,7 +1365,10 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1392
1365
  readonly actualEpoch: number;
1393
1366
  readonly attemptedEpoch: number;
1394
1367
  } | {
1395
- readonly _tag: "DurableAlarmError";
1368
+ readonly _tag: "ThreadNotMaterialized";
1369
+ readonly threadId: string;
1370
+ } | {
1371
+ readonly _tag: "ThreadStoreError";
1396
1372
  readonly operation: string;
1397
1373
  readonly message: string;
1398
1374
  readonly cause?: Schema.Json | undefined;
@@ -1402,6 +1378,17 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1402
1378
  readonly reason: string;
1403
1379
  readonly threadId?: string | undefined;
1404
1380
  readonly submissionId?: string | undefined;
1381
+ } | {
1382
+ readonly _tag: "AdmissionConflict";
1383
+ readonly threadId: string;
1384
+ readonly principal: string;
1385
+ readonly idempotencyKey: string;
1386
+ readonly existingInputDigest: string;
1387
+ readonly attemptedInputDigest: string;
1388
+ } | {
1389
+ readonly _tag: "AdmissionPolicyError";
1390
+ readonly reason: "occupied" | "refused" | "unavailable";
1391
+ readonly code: string;
1405
1392
  } | {
1406
1393
  readonly _tag: "AgentInputError";
1407
1394
  readonly message: string;
@@ -1412,9 +1399,22 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
1412
1399
  } | {
1413
1400
  readonly _tag: "DurableRuntimeFailpointError";
1414
1401
  readonly location: "abort:after-intent" | "approval:after-request-append" | "approval:after-suspend" | "checkpoint:after-save" | "checkpoint:before-save" | "claim:after-claim" | "compaction:after-canonical-append" | "compaction:before-canonical-append" | "input:after-canonical-append" | "join:after-canonical-append" | "join:after-claim" | "policy:after-reservation-append" | "policy:before-reservation-append" | "resolve:after-intent" | "run:after-start-append" | "run:before-start-append" | "step:after-step-append" | "subagent:after-admit" | "subagent:after-child-abort-intent" | "subagent:after-child-ready" | "subagent:after-join-append" | "subagent:after-release" | "subagent:after-release-pending" | "subagent:after-request-append" | "subagent:after-reserve" | "subagent:after-sibling-settle" | "subagent:after-start-append" | "subagent:after-suspend" | "subagent:before-join-append" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:after-reserve" | "tools:after-prepared-append" | "tools:before-prepared-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append" | "update:after-canonical-append" | "update:after-delivery-insert" | "update:before-canonical-append" | "update:before-delivery-insert" | "worker:after-completion-append" | "worker:after-origin-append" | "worker:after-report-append" | "worker:after-report-delivery" | "worker:after-source-append" | "worker:after-subtree-append" | "worker:before-completion-append" | "worker:before-origin-append" | "worker:before-report-append" | "worker:before-report-delivery" | "worker:before-source-append" | "worker:before-subtree-append";
1402
+ } | {
1403
+ readonly _tag: "SettlementConflict";
1404
+ readonly submissionId: string;
1405
+ readonly existingOutcome: "aborted" | "completed" | "failed";
1406
+ } | {
1407
+ readonly _tag: "JoinedToHost";
1408
+ readonly submissionId: string;
1409
+ readonly hostSubmissionId: string;
1415
1410
  } | {
1416
1411
  readonly _tag: "HostProtocolError";
1417
1412
  readonly message: string;
1413
+ } | {
1414
+ readonly _tag: "DurableAlarmError";
1415
+ readonly operation: string;
1416
+ readonly message: string;
1417
+ readonly cause?: Schema.Json | undefined;
1418
1418
  } | {
1419
1419
  readonly _tag: "ApprovalConflict";
1420
1420
  readonly submissionId: string;
@@ -0,0 +1,161 @@
1
+ import { Context, Effect, Layer, Redacted, Schema, Scope } from "effect";
2
+ import { SandboxImplementation } from "effect-agent/sandbox";
3
+ import { HttpClient } from "effect/unstable/http";
4
+ import { BrowserHandle, InteractiveBrowser, InteractiveBrowserError, InteractiveBrowserPolicy, InteractiveBrowserPolicyDeniedError } from "effect-agent/interactive-browser";
5
+ //#region src/internal/browser-session-lifecycle.d.ts
6
+ declare const BrowserRunCleanupError_base: Schema.Class<BrowserRunCleanupError, Schema.TaggedStruct<"BrowserRunCleanupError", {
7
+ readonly reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "provider", "malformed", "timeout", "pending"]>;
8
+ readonly status: Schema.optionalKey<Schema.Int>;
9
+ }>, import("effect/Cause").YieldableError>;
10
+ declare class BrowserRunCleanupError extends BrowserRunCleanupError_base {}
11
+ interface BrowserRunLifecycleOptions {
12
+ readonly accountId: string;
13
+ readonly apiToken: Redacted.Redacted<string>;
14
+ }
15
+ declare const BrowserRunSessionLifecycle_base: Context.ServiceClass<BrowserRunSessionLifecycle, "@effect-agent/platform-cloudflare/BrowserRunSessionLifecycle", {
16
+ readonly close: (sessionId: Redacted.Redacted<string>) => Effect.Effect<void, BrowserRunCleanupError>;
17
+ }>;
18
+ declare class BrowserRunSessionLifecycle extends BrowserRunSessionLifecycle_base {
19
+ static layer(options: BrowserRunLifecycleOptions): Layer.Layer<BrowserRunSessionLifecycle, BrowserRunCleanupError, HttpClient.HttpClient>;
20
+ }
21
+ //#endregion
22
+ //#region src/InteractiveBrowser.d.ts
23
+ declare const browserRunInteractiveImplementation: SandboxImplementation;
24
+ declare const BrowserRunViewport_base: Schema.Class<BrowserRunViewport, Schema.Struct<{
25
+ readonly width: Schema.Int;
26
+ readonly height: Schema.Int;
27
+ readonly deviceScaleFactor: Schema.optionalKey<Schema.Finite>;
28
+ }>, {}>;
29
+ /**
30
+ * Host presentation state in CSS pixels. Dimensions are integers in 1..2048,
31
+ * density is finite in 1..2 (default 1), and neither scaled dimension may exceed
32
+ * 2048 pixels. Mobile, touch, and orientation emulation are not supported.
33
+ */
34
+ declare class BrowserRunViewport extends BrowserRunViewport_base {}
35
+ declare const BrowserRunLiveViewRequest_base: Schema.Class<BrowserRunLiveViewRequest, Schema.Struct<{
36
+ readonly mode: Schema.Literal<"tab">;
37
+ readonly expiresInMs: Schema.Int;
38
+ }>, {}>;
39
+ /** Host-only request for a redacted Cloudflare Live View URL. */
40
+ declare class BrowserRunLiveViewRequest extends BrowserRunLiveViewRequest_base {}
41
+ declare const BrowserRunLiveViewResult_base: Schema.Class<BrowserRunLiveViewResult, Schema.Struct<{
42
+ readonly devtoolsFrontendUrl: Schema.Redacted<Schema.String>;
43
+ }>, {}>;
44
+ declare class BrowserRunLiveViewResult extends BrowserRunLiveViewResult_base {}
45
+ declare const BrowserRunHandoffRequest_base: Schema.Class<BrowserRunHandoffRequest, Schema.Struct<{
46
+ readonly instructions: Schema.String;
47
+ readonly timeout: Schema.Int;
48
+ }>, {}>;
49
+ /** Start one bounded handoff; controller ownership remains a consumer concern. */
50
+ declare class BrowserRunHandoffRequest extends BrowserRunHandoffRequest_base {}
51
+ declare const BrowserRunHandoffResult_base: Schema.Class<BrowserRunHandoffResult, Schema.Struct<{
52
+ readonly handoffId: Schema.Redacted<Schema.String>;
53
+ }>, {}>;
54
+ declare class BrowserRunHandoffResult extends BrowserRunHandoffResult_base {}
55
+ declare const BrowserRunHandoffState_base: Schema.Class<BrowserRunHandoffState, Schema.Struct<{
56
+ readonly active: Schema.Boolean;
57
+ readonly handoffId: Schema.optionalKey<Schema.Redacted<Schema.String>>;
58
+ readonly durationMs: Schema.optionalKey<Schema.Natural>;
59
+ }>, {}>;
60
+ declare class BrowserRunHandoffState extends BrowserRunHandoffState_base {}
61
+ /** One intercepted Puppeteer request, narrowed to the policy-relevant surface. */
62
+ interface BrowserRunInteractiveRequest {
63
+ readonly url: () => string;
64
+ readonly abort: () => Promise<void>;
65
+ readonly continue: () => Promise<void>;
66
+ }
67
+ type BrowserRunInteractiveRequestListener = (request: BrowserRunInteractiveRequest) => void;
68
+ type BrowserRunCloudflareCommand = "Cloudflare.getLiveView" | "Cloudflare.handoff" | "Cloudflare.getHandoffState";
69
+ /** Narrow CDP boundary for Cloudflare commands absent from the pinned protocol types. */
70
+ interface BrowserRunInteractiveCdpSession {
71
+ readonly send: (command: BrowserRunCloudflareCommand, parameters: unknown) => Promise<unknown>;
72
+ readonly detach: () => Promise<void>;
73
+ }
74
+ /** Narrow page boundary used by deterministic tests; SDK values remain in this package. */
75
+ interface BrowserRunInteractivePage {
76
+ readonly close: () => Promise<void>;
77
+ readonly setBypassServiceWorker: (enabled: boolean) => Promise<void>;
78
+ readonly setRequestInterception: (enabled: boolean) => Promise<void>;
79
+ readonly onRequest: (listener: BrowserRunInteractiveRequestListener) => void;
80
+ readonly offRequest: (listener: BrowserRunInteractiveRequestListener) => void;
81
+ readonly goto: (url: string) => Promise<void>;
82
+ readonly url: () => unknown;
83
+ readonly readText: (selector: string | undefined, maximumBytes: number) => Promise<unknown>;
84
+ readonly fill: (selector: string, value: string, signal: AbortSignal, onDispatch: () => void) => Promise<unknown>;
85
+ readonly click: (selector: string, signal: AbortSignal, onDispatch: () => void) => Promise<unknown>;
86
+ readonly screenshot: (fullPage: boolean) => Promise<unknown>;
87
+ readonly scroll: (deltaX: number, deltaY: number) => Promise<void>;
88
+ readonly setViewport: (viewport: BrowserRunViewport) => Promise<void>;
89
+ readonly createCdpSession: () => Promise<BrowserRunInteractiveCdpSession>;
90
+ }
91
+ interface BrowserRunInteractiveContext {
92
+ readonly newPage: () => Promise<BrowserRunInteractivePage>;
93
+ readonly close: () => Promise<void>;
94
+ }
95
+ interface BrowserRunInteractiveBrowser {
96
+ readonly createContext: () => Promise<BrowserRunInteractiveContext>;
97
+ readonly close: () => Promise<void>;
98
+ readonly sessionId: () => unknown;
99
+ readonly isConnected: () => boolean;
100
+ readonly onDisconnected: (listener: () => void) => void;
101
+ readonly offDisconnected: (listener: () => void) => void;
102
+ }
103
+ declare const BrowserRunInteractiveBinding_base: Context.ServiceClass<BrowserRunInteractiveBinding, "@effect-agent/platform-cloudflare/BrowserRunInteractiveBinding", {
104
+ readonly launch: (keepAliveMillis: number) => Promise<BrowserRunInteractiveBrowser>;
105
+ /** Success proves whole-browser termination or exact-session absence. */
106
+ readonly closeSession: (sessionId: Redacted.Redacted<string>) => Effect.Effect<void, InteractiveBrowserError>;
107
+ }>;
108
+ /** Host-supplied Browser Run binding projected into one fakeable launch operation. */
109
+ declare class BrowserRunInteractiveBinding extends BrowserRunInteractiveBinding_base {
110
+ static layer(options: {
111
+ readonly browser: BrowserRun;
112
+ readonly viewport?: BrowserRunViewport;
113
+ }): Layer.Layer<BrowserRunInteractiveBinding, InteractiveBrowserPolicyDeniedError, BrowserRunSessionLifecycle>;
114
+ }
115
+ interface BrowserRunInteractiveSession {
116
+ readonly handle: BrowserHandle;
117
+ readonly sessionId: Redacted.Redacted<string>;
118
+ /**
119
+ * Resize without charging an agent action or changing emulation modes. Shares
120
+ * the handle's fail-fast lock, page-policy preflight, and elapsed deadline.
121
+ * A timeout or interruption leaves the session unusable; no resize is retried.
122
+ * The host must authorize callers. No viewer ownership or durable state is added.
123
+ */
124
+ readonly resizeViewport: (viewport: BrowserRunViewport) => Effect.Effect<void, InteractiveBrowserError>;
125
+ readonly getLiveView: (request: BrowserRunLiveViewRequest) => Effect.Effect<BrowserRunLiveViewResult, InteractiveBrowserError>;
126
+ readonly handoff: (request: BrowserRunHandoffRequest) => Effect.Effect<BrowserRunHandoffResult, InteractiveBrowserError>;
127
+ readonly getHandoffState: Effect.Effect<BrowserRunHandoffState, InteractiveBrowserError>;
128
+ readonly close: Effect.Effect<void, InteractiveBrowserError>;
129
+ }
130
+ declare const BrowserRunInteractiveHost_base: Context.ServiceClass<BrowserRunInteractiveHost, "@effect-agent/platform-cloudflare/BrowserRunInteractiveHost", {
131
+ readonly cleanupSemantics?: "confirmed-terminal";
132
+ readonly open: (policy: InteractiveBrowserPolicy) => Effect.Effect<BrowserRunInteractiveSession, InteractiveBrowserError, Scope.Scope>;
133
+ readonly closeSession: (sessionId: Redacted.Redacted<string>) => Effect.Effect<void, InteractiveBrowserError>;
134
+ }>;
135
+ /** Cloudflare host authority kept separate from the provider-neutral browser handle. */
136
+ declare class BrowserRunInteractiveHost extends BrowserRunInteractiveHost_base {}
137
+ /** Recognizes a local pre-dispatch refusal without exposing selector or page content. */
138
+ declare const isBrowserRunUndispatchedActionError: (error: unknown) => boolean;
139
+ /** Cloudflare host controls and private session identity for one scoped Browser Run pass. */
140
+ declare const browserRunInteractiveHostLayer: () => Layer.Layer<BrowserRunInteractiveHost, never, BrowserRunInteractiveBinding>;
141
+ /** Worker-only generic adapter; Cloudflare identity and controls remain host-only. */
142
+ declare const browserRunInteractiveLayer: () => Layer.Layer<InteractiveBrowser, never, BrowserRunInteractiveBinding>;
143
+ /** Resolved Worker binding, cleanup credentials, and optional initial viewport. */
144
+ interface CloudflareInteractiveBrowserOptions extends BrowserRunLifecycleOptions {
145
+ readonly browser: BrowserRun;
146
+ readonly viewport?: BrowserRunViewport;
147
+ }
148
+ /** Worker-only assembly; importing ordinary capture never loads Puppeteer. */
149
+ declare const CloudflareInteractiveBrowser: {
150
+ /**
151
+ * Assemble binding, confirmed-session cleanup, and the generic browser service.
152
+ * HttpClient and construction errors remain visible. Opening a pass still requires
153
+ * an explicit policy and Scope; no browser is launched during Layer construction.
154
+ */
155
+ layer: (options: CloudflareInteractiveBrowserOptions) => Layer.Layer<InteractiveBrowser, BrowserRunCleanupError | InteractiveBrowserPolicyDeniedError, import("effect/unstable/http/HttpClient").HttpClient>;
156
+ /** Opt into private host controls instead of exposing them through the generic service. */
157
+ hostLayer: (options: CloudflareInteractiveBrowserOptions) => Layer.Layer<BrowserRunInteractiveHost, BrowserRunCleanupError | InteractiveBrowserPolicyDeniedError, import("effect/unstable/http/HttpClient").HttpClient>;
158
+ };
159
+ //#endregion
160
+ export { BrowserRunCleanupError as C, isBrowserRunUndispatchedActionError as S, CloudflareInteractiveBrowser as _, BrowserRunInteractiveBinding as a, browserRunInteractiveImplementation as b, BrowserRunInteractiveContext as c, BrowserRunInteractiveRequest as d, BrowserRunInteractiveRequestListener as f, BrowserRunViewport as g, BrowserRunLiveViewResult as h, BrowserRunHandoffState as i, BrowserRunInteractiveHost as l, BrowserRunLiveViewRequest as m, BrowserRunHandoffRequest as n, BrowserRunInteractiveBrowser as o, BrowserRunInteractiveSession as p, BrowserRunHandoffResult as r, BrowserRunInteractiveCdpSession as s, BrowserRunCloudflareCommand as t, BrowserRunInteractivePage as u, CloudflareInteractiveBrowserOptions as v, BrowserRunSessionLifecycle as w, browserRunInteractiveLayer as x, browserRunInteractiveHostLayer as y };
161
+ //# sourceMappingURL=InteractiveBrowser-DUE_m12-.d.mts.map