@effect-agent/platform-cloudflare 0.1.0-beta.8 → 0.1.0-beta.81
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 +184 -0
- package/dist/Alarm.mjs +451 -0
- package/dist/Alarm.mjs.map +1 -0
- package/dist/BrowserRestCapture.d.mts +35 -0
- package/dist/BrowserRestCapture.mjs +238 -0
- package/dist/BrowserRestCapture.mjs.map +1 -0
- package/dist/BrowserRestCrawl.d.mts +17 -0
- package/dist/BrowserRestCrawl.mjs +244 -0
- package/dist/BrowserRestCrawl.mjs.map +1 -0
- package/dist/CloudflareAiGateway.d.mts +64 -0
- package/dist/CloudflareAiGateway.mjs +70 -0
- package/dist/CloudflareAiGateway.mjs.map +1 -0
- package/dist/CloudflareBindings.d.mts +112 -0
- package/dist/CloudflareBindings.mjs +101 -0
- package/dist/CloudflareBindings.mjs.map +1 -0
- package/dist/CloudflareBrowser-D4YqaTAl.mjs +495 -0
- package/dist/CloudflareBrowser-D4YqaTAl.mjs.map +1 -0
- package/dist/CloudflareBrowser-DJq53niJ.d.mts +80 -0
- package/dist/CloudflareBrowser.d.mts +2 -0
- package/dist/CloudflareBrowser.mjs +2 -0
- package/dist/CloudflareCodeMode.d.mts +44 -0
- package/dist/CloudflareCodeMode.mjs +616 -0
- package/dist/CloudflareCodeMode.mjs.map +1 -0
- package/dist/CloudflareConfig-f3CqTel1.d.mts +101 -0
- package/dist/CloudflareConfig.d.mts +2 -0
- package/dist/CloudflareConfig.mjs +122 -0
- package/dist/CloudflareConfig.mjs.map +1 -0
- package/dist/CloudflareMemory.d.mts +142 -0
- package/dist/CloudflareMemory.mjs +195 -0
- package/dist/CloudflareMemory.mjs.map +1 -0
- package/dist/CloudflareScheduling.d.mts +52 -0
- package/dist/CloudflareScheduling.mjs +389 -0
- package/dist/CloudflareScheduling.mjs.map +1 -0
- package/dist/CloudflareSubscriptions.d.mts +87 -0
- package/dist/CloudflareSubscriptions.mjs +524 -0
- package/dist/CloudflareSubscriptions.mjs.map +1 -0
- package/dist/CloudflareThreadClient.d.mts +1286 -0
- package/dist/CloudflareThreadClient.mjs +386 -0
- package/dist/CloudflareThreadClient.mjs.map +1 -0
- package/dist/InteractiveBrowser.d.mts +144 -0
- package/dist/InteractiveBrowser.mjs +1090 -0
- package/dist/InteractiveBrowser.mjs.map +1 -0
- package/dist/ProtectedBrowser.d.mts +65 -0
- package/dist/ProtectedBrowser.mjs +859 -0
- package/dist/ProtectedBrowser.mjs.map +1 -0
- package/dist/ThreadObject-BpwkEc5E.mjs +836 -0
- package/dist/ThreadObject-BpwkEc5E.mjs.map +1 -0
- package/dist/ThreadObject-NbFOWK1I.d.mts +816 -0
- package/dist/ThreadObject.d.mts +2 -0
- package/dist/ThreadObject.mjs +3 -0
- package/dist/WakeScheduler.d.mts +23 -0
- package/dist/WakeScheduler.mjs +60 -0
- package/dist/WakeScheduler.mjs.map +1 -0
- package/dist/boundary-BguazVkh.mjs +42 -0
- package/dist/boundary-BguazVkh.mjs.map +1 -0
- package/dist/browser-session-lifecycle-CUbVfEgP.mjs +84 -0
- package/dist/browser-session-lifecycle-CUbVfEgP.mjs.map +1 -0
- package/dist/browser-session-lifecycle-DJpqLXy_.d.mts +21 -0
- package/dist/index.d.mts +13 -1547
- package/dist/index.mjs +13 -1636
- package/dist/prepared-admission-DSi55W-7.mjs +73 -0
- package/dist/prepared-admission-DSi55W-7.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/package.json +1 -53
- package/src/Alarm.ts +967 -0
- package/src/BrowserRestCapture.ts +477 -0
- package/src/BrowserRestCrawl.ts +540 -0
- package/src/CloudflareAiGateway.ts +170 -0
- package/src/CloudflareBindings.ts +180 -0
- package/src/CloudflareBrowser.ts +15 -0
- package/src/{code-mode-executor.ts → CloudflareCodeMode.ts} +372 -204
- package/src/{config.ts → CloudflareConfig.ts} +9 -8
- package/src/CloudflareMemory.ts +406 -0
- package/src/CloudflareScheduling.ts +733 -0
- package/src/CloudflareSubscriptions.ts +1045 -0
- package/src/CloudflareThreadClient.ts +807 -0
- package/src/InteractiveBrowser.ts +2357 -0
- package/src/ProtectedBrowser.ts +2 -0
- package/src/ThreadObject.ts +1179 -0
- package/src/{wake-scheduler.ts → WakeScheduler.ts} +23 -23
- package/src/index.ts +12 -23
- package/src/internal/boundary.ts +55 -0
- package/src/internal/browser-quick-action.ts +857 -0
- package/src/internal/browser-session-lifecycle.ts +160 -0
- package/src/internal/layers.ts +751 -0
- package/src/internal/message-delivery.ts +148 -0
- package/src/internal/prepared-admission.ts +116 -0
- package/src/internal/progress-wait.ts +121 -0
- package/src/internal/transport.ts +42 -0
- package/src/protected-browser/binding.ts +187 -0
- package/src/protected-browser/inspect-frame.ts +125 -0
- package/src/protected-browser/native.ts +429 -0
- package/src/protected-browser/policy.ts +719 -0
- package/dist/index.mjs.map +0 -1
- package/src/alarm.ts +0 -334
- package/src/bindings.ts +0 -145
- package/src/client.ts +0 -646
- package/src/conversation-object.ts +0 -768
- package/src/layers.ts +0 -376
- package/src/transport.ts +0 -38
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as ThreadPublicationOptions, C as portCall, D as CloudflareDurableRuntimeOptions, E as CloudflareDurableRuntimeInitializationError, M as layerConfig, N as layerHostConfig, O as CloudflareDurableRuntimeServices, P as layerInHost, S as make, T as CloudflareBootstrapServices, _ as decodeAdminVerifyRequest, a as AdminVerifyRequest, b as encodeAdminResponse, c as Instance, d as RetryExecuted, g as decodeAdminResponse, h as decodeAdminExplainRequest, i as AdminResponse, j as layer, k as ThreadObjectPorts, l as ObligationsScanned, m as VerifiedIntegrity, n as AdminFailed, o as Class, p as ThreadRpcOperation, r as AdminFailure, s as ExplainedRecovery, t as AdminExplainRequest, u as Options, v as decodeObligationThresholds, w as submit, x as handleRpc, y as decodeRetryCommand } from "./ThreadObject-NbFOWK1I.mjs";
|
|
2
|
+
export { AdminExplainRequest, AdminFailed, AdminFailure, AdminResponse, AdminVerifyRequest, type CloudflareBootstrapServices as BootstrapServices, Class, ExplainedRecovery, type CloudflareDurableRuntimeInitializationError as InitializationError, Instance, ObligationsScanned, Options, type ThreadPublicationOptions as PublicationOptions, RetryExecuted, type CloudflareDurableRuntimeOptions as RuntimeOptions, type CloudflareDurableRuntimeServices as Services, ThreadObjectPorts, ThreadRpcOperation, VerifiedIntegrity, decodeAdminExplainRequest, decodeAdminResponse, decodeAdminVerifyRequest, decodeObligationThresholds, decodeRetryCommand, encodeAdminResponse, handleRpc, layer, layerConfig, layerHostConfig, layerInHost, make, portCall, submit };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "./CloudflareThreadClient.mjs";
|
|
2
|
+
import { C as layer, E as layerInHost, S as ThreadObjectPorts, T as layerHostConfig, _ as encodeAdminResponse, a as AdminVerifyRequest, b as portCall, c as RetryExecuted, d as VerifiedIntegrity, f as decodeAdminExplainRequest, g as decodeRetryCommand, h as decodeObligationThresholds, i as AdminResponse, m as decodeAdminVerifyRequest, n as AdminFailed, o as ExplainedRecovery, p as decodeAdminResponse, r as AdminFailure, s as ObligationsScanned, t as AdminExplainRequest, u as ThreadRpcOperation, v as handleRpc, w as layerConfig, x as submit, y as make } from "./ThreadObject-BpwkEc5E.mjs";
|
|
3
|
+
export { AdminExplainRequest, AdminFailed, AdminFailure, AdminResponse, AdminVerifyRequest, ExplainedRecovery, ObligationsScanned, RetryExecuted, ThreadObjectPorts, ThreadRpcOperation, VerifiedIntegrity, decodeAdminExplainRequest, decodeAdminResponse, decodeAdminVerifyRequest, decodeObligationThresholds, decodeRetryCommand, encodeAdminResponse, handleRpc, layer, layerConfig, layerHostConfig, layerInHost, make, portCall, submit };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ThreadObjectNamespace, ThreadObjectPlacement } from "./CloudflareBindings.mjs";
|
|
2
|
+
import { DurableAlarmService } from "./Alarm.mjs";
|
|
3
|
+
import { Layer } from "effect";
|
|
4
|
+
import { WakeScheduler } from "@effect-agent/thread/WakeScheduler";
|
|
5
|
+
declare namespace WakeScheduler_d_exports {
|
|
6
|
+
export { cloudflareWakeSchedulerLayer };
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The DC `WakeScheduler` (plan §1.4):
|
|
10
|
+
*
|
|
11
|
+
* - `notify(local)` → `setAlarm(now)` — durable, cheap, coalescing (the alarm slot keeps the
|
|
12
|
+
* earliest deadline) — plus a same-incarnation PubSub hint for `awaitSettlement` waiters.
|
|
13
|
+
* - `notify(remote)` → fire-and-forget `wake()` on the owning Object's stub with every error
|
|
14
|
+
* swallowed and logged: hints are droppable, and the target's own alarm/scan pairing (the
|
|
15
|
+
* maintenance pass re-polls unsettled children) guarantees liveness without this call.
|
|
16
|
+
* - `wakes` → the bounded sliding PubSub only. No important state lives in memory: the
|
|
17
|
+
* subscription accelerates waiters within one incarnation and the settlement poll interval
|
|
18
|
+
* is the correctness path.
|
|
19
|
+
*/
|
|
20
|
+
declare const cloudflareWakeSchedulerLayer: Layer.Layer<WakeScheduler, never, DurableAlarmService | ThreadObjectPlacement | ThreadObjectNamespace>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { cloudflareWakeSchedulerLayer, WakeScheduler_d_exports as t };
|
|
23
|
+
//# sourceMappingURL=WakeScheduler.d.mts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
+
import { ThreadObjectNamespace, ThreadObjectPlacement } from "./CloudflareBindings.mjs";
|
|
3
|
+
import { r as safeCauseMessage } from "./boundary-BguazVkh.mjs";
|
|
4
|
+
import { DurableAlarmService } from "./Alarm.mjs";
|
|
5
|
+
import "@effect-agent/core/Identifiers";
|
|
6
|
+
import { Effect, Layer, PubSub, Schema, Stream } from "effect";
|
|
7
|
+
import { WakeScheduler, makeWakeSubscriptionHub } from "@effect-agent/thread/WakeScheduler";
|
|
8
|
+
//#region src/WakeScheduler.ts
|
|
9
|
+
var WakeScheduler_exports = /* @__PURE__ */ __exportAll({ cloudflareWakeSchedulerLayer: () => cloudflareWakeSchedulerLayer });
|
|
10
|
+
/**
|
|
11
|
+
* Bounded in-memory wake buffer for same-incarnation `awaitSettlement` subscribers. Wake
|
|
12
|
+
* hints are droppable by contract (consumers pair every subscription with ledger polls), so
|
|
13
|
+
* a full buffer slides out the oldest hint and an eviction simply loses the buffer — the
|
|
14
|
+
* poll interval and the persisted alarm keep liveness (persistence §14).
|
|
15
|
+
*/
|
|
16
|
+
const WAKE_BUFFER_CAPACITY = 1024;
|
|
17
|
+
/** A remote wake stub call failed; always swallowed and logged (hints are droppable). */
|
|
18
|
+
var RemoteWakeDropped = class extends Schema.TaggedError()("RemoteWakeDropped", {
|
|
19
|
+
threadId: Schema.String,
|
|
20
|
+
message: Schema.String,
|
|
21
|
+
cause: Schema.optionalKey(Schema.Defect())
|
|
22
|
+
}) {};
|
|
23
|
+
/**
|
|
24
|
+
* The DC `WakeScheduler` (plan §1.4):
|
|
25
|
+
*
|
|
26
|
+
* - `notify(local)` → `setAlarm(now)` — durable, cheap, coalescing (the alarm slot keeps the
|
|
27
|
+
* earliest deadline) — plus a same-incarnation PubSub hint for `awaitSettlement` waiters.
|
|
28
|
+
* - `notify(remote)` → fire-and-forget `wake()` on the owning Object's stub with every error
|
|
29
|
+
* swallowed and logged: hints are droppable, and the target's own alarm/scan pairing (the
|
|
30
|
+
* maintenance pass re-polls unsettled children) guarantees liveness without this call.
|
|
31
|
+
* - `wakes` → the bounded sliding PubSub only. No important state lives in memory: the
|
|
32
|
+
* subscription accelerates waiters within one incarnation and the settlement poll interval
|
|
33
|
+
* is the correctness path.
|
|
34
|
+
*/
|
|
35
|
+
const cloudflareWakeSchedulerLayer = Layer.effect(WakeScheduler)(Effect.gen(function* () {
|
|
36
|
+
const alarm = yield* DurableAlarmService;
|
|
37
|
+
const placement = yield* ThreadObjectPlacement;
|
|
38
|
+
const { get } = yield* ThreadObjectNamespace;
|
|
39
|
+
const hints = yield* PubSub.sliding(WAKE_BUFFER_CAPACITY);
|
|
40
|
+
const progress = yield* makeWakeSubscriptionHub;
|
|
41
|
+
yield* Effect.addFinalizer(() => PubSub.shutdown(hints));
|
|
42
|
+
const notifyLocal = (threadId) => progress.notify(threadId).pipe(Effect.andThen(PubSub.publish(hints, threadId)), Effect.andThen(alarm.scheduleNow), Effect.catch((error) => Effect.logWarning("CloudflareWakeScheduler: local alarm wake failed", error)), Effect.asVoid);
|
|
43
|
+
const notifyRemote = (threadId) => Effect.tryPromise({
|
|
44
|
+
try: () => get(threadId).wake(),
|
|
45
|
+
catch: (cause) => RemoteWakeDropped.make({
|
|
46
|
+
threadId,
|
|
47
|
+
message: safeCauseMessage(cause, "The remote wake failed without a diagnostic"),
|
|
48
|
+
cause
|
|
49
|
+
})
|
|
50
|
+
}).pipe(Effect.catch((error) => Effect.logWarning(`CloudflareWakeScheduler: remote wake of ${threadId} dropped`, error)), Effect.asVoid);
|
|
51
|
+
return WakeScheduler.of({
|
|
52
|
+
notify: (threadId) => placement.ownsThread(threadId) ? notifyLocal(threadId) : notifyRemote(threadId),
|
|
53
|
+
subscribe: progress.subscribe,
|
|
54
|
+
wakes: Stream.fromPubSub(hints)
|
|
55
|
+
});
|
|
56
|
+
}));
|
|
57
|
+
//#endregion
|
|
58
|
+
export { cloudflareWakeSchedulerLayer, WakeScheduler_exports as t };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=WakeScheduler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WakeScheduler.mjs","names":[],"sources":["../src/WakeScheduler.ts"],"sourcesContent":["import { type ThreadId } from \"@effect-agent/core/Identifiers\";\nimport { makeWakeSubscriptionHub, WakeScheduler } from \"@effect-agent/thread/WakeScheduler\";\nimport { Effect, Layer, PubSub, Schema, Stream } from \"effect\";\n\nimport { DurableAlarmService } from \"./Alarm.ts\";\nimport { ThreadObjectPlacement, ThreadObjectNamespace } from \"./CloudflareBindings.ts\";\nimport { safeCauseMessage } from \"./internal/boundary.ts\";\n\n/**\n * Bounded in-memory wake buffer for same-incarnation `awaitSettlement` subscribers. Wake\n * hints are droppable by contract (consumers pair every subscription with ledger polls), so\n * a full buffer slides out the oldest hint and an eviction simply loses the buffer — the\n * poll interval and the persisted alarm keep liveness (persistence §14).\n */\nconst WAKE_BUFFER_CAPACITY = 1_024;\n\n/** A remote wake stub call failed; always swallowed and logged (hints are droppable). */\nclass RemoteWakeDropped extends Schema.TaggedError<RemoteWakeDropped>()(\"RemoteWakeDropped\", {\n threadId: Schema.String,\n message: Schema.String,\n cause: Schema.optionalKey(Schema.Defect()),\n}) {}\n\n/**\n * The DC `WakeScheduler` (plan §1.4):\n *\n * - `notify(local)` → `setAlarm(now)` — durable, cheap, coalescing (the alarm slot keeps the\n * earliest deadline) — plus a same-incarnation PubSub hint for `awaitSettlement` waiters.\n * - `notify(remote)` → fire-and-forget `wake()` on the owning Object's stub with every error\n * swallowed and logged: hints are droppable, and the target's own alarm/scan pairing (the\n * maintenance pass re-polls unsettled children) guarantees liveness without this call.\n * - `wakes` → the bounded sliding PubSub only. No important state lives in memory: the\n * subscription accelerates waiters within one incarnation and the settlement poll interval\n * is the correctness path.\n */\nexport const cloudflareWakeSchedulerLayer: Layer.Layer<\n WakeScheduler,\n never,\n DurableAlarmService | ThreadObjectPlacement | ThreadObjectNamespace\n> = Layer.effect(WakeScheduler)(\n Effect.gen(function* () {\n const alarm = yield* DurableAlarmService;\n const placement = yield* ThreadObjectPlacement;\n const { get } = yield* ThreadObjectNamespace;\n const hints = yield* PubSub.sliding<ThreadId>(WAKE_BUFFER_CAPACITY);\n const progress = yield* makeWakeSubscriptionHub;\n\n yield* Effect.addFinalizer(() => PubSub.shutdown(hints));\n\n const notifyLocal = (threadId: ThreadId) =>\n progress.notify(threadId).pipe(\n Effect.andThen(PubSub.publish(hints, threadId)),\n Effect.andThen(alarm.scheduleNow),\n Effect.catch((error) =>\n // `notify` never fails by contract; a failed alarm write degrades to \"hint lost\"\n // and the pass re-arm (or the next entry point's pre-arm) restores the invariant.\n Effect.logWarning(\"CloudflareWakeScheduler: local alarm wake failed\", error),\n ),\n Effect.asVoid,\n );\n\n const notifyRemote = (threadId: ThreadId) =>\n Effect.tryPromise({\n try: () => get(threadId).wake(),\n catch: (cause) =>\n RemoteWakeDropped.make({\n threadId,\n message: safeCauseMessage(cause, \"The remote wake failed without a diagnostic\"),\n cause,\n }),\n }).pipe(\n Effect.catch((error) =>\n Effect.logWarning(`CloudflareWakeScheduler: remote wake of ${threadId} dropped`, error),\n ),\n Effect.asVoid,\n );\n\n return WakeScheduler.of({\n notify: (threadId) =>\n placement.ownsThread(threadId) ? notifyLocal(threadId) : notifyRemote(threadId),\n subscribe: progress.subscribe,\n wakes: Stream.fromPubSub(hints),\n });\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,uBAAuB;;AAG7B,IAAM,oBAAN,cAAgC,OAAO,YAA+B,CAAC,CAAC,qBAAqB;CAC3F,UAAU,OAAO;CACjB,SAAS,OAAO;CAChB,OAAO,OAAO,YAAY,OAAO,OAAO,CAAC;AAC3C,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;AAcJ,MAAa,+BAIT,MAAM,OAAO,aAAa,CAAC,CAC7B,OAAO,IAAI,aAAa;CACtB,MAAM,QAAQ,OAAO;CACrB,MAAM,YAAY,OAAO;CACzB,MAAM,EAAE,QAAQ,OAAO;CACvB,MAAM,QAAQ,OAAO,OAAO,QAAkB,oBAAoB;CAClE,MAAM,WAAW,OAAO;CAExB,OAAO,OAAO,mBAAmB,OAAO,SAAS,KAAK,CAAC;CAEvD,MAAM,eAAe,aACnB,SAAS,OAAO,QAAQ,CAAC,CAAC,KACxB,OAAO,QAAQ,OAAO,QAAQ,OAAO,QAAQ,CAAC,GAC9C,OAAO,QAAQ,MAAM,WAAW,GAChC,OAAO,OAAO,UAGZ,OAAO,WAAW,oDAAoD,KAAK,CAC7E,GACA,OAAO,MACT;CAEF,MAAM,gBAAgB,aACpB,OAAO,WAAW;EAChB,WAAW,IAAI,QAAQ,CAAC,CAAC,KAAK;EAC9B,QAAQ,UACN,kBAAkB,KAAK;GACrB;GACA,SAAS,iBAAiB,OAAO,6CAA6C;GAC9E;EACF,CAAC;CACL,CAAC,CAAC,CAAC,KACD,OAAO,OAAO,UACZ,OAAO,WAAW,2CAA2C,SAAS,WAAW,KAAK,CACxF,GACA,OAAO,MACT;CAEF,OAAO,cAAc,GAAG;EACtB,SAAS,aACP,UAAU,WAAW,QAAQ,IAAI,YAAY,QAAQ,IAAI,aAAa,QAAQ;EAChF,WAAW,SAAS;EACpB,OAAO,OAAO,WAAW,KAAK;CAChC,CAAC;AACH,CAAC,CACH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Predicate } from "effect";
|
|
2
|
+
//#region src/internal/boundary.ts
|
|
3
|
+
const MAX_FOREIGN_DIAGNOSTIC_LENGTH = 8192;
|
|
4
|
+
const boundForeignDiagnostic = (message) => message.slice(0, MAX_FOREIGN_DIAGNOSTIC_LENGTH);
|
|
5
|
+
/** Render a foreign failure without trusting accessors or coercion hooks on the value. */
|
|
6
|
+
const safeCauseMessage = (cause, fallback) => {
|
|
7
|
+
try {
|
|
8
|
+
const message = cause instanceof Error ? cause.message : cause;
|
|
9
|
+
return boundForeignDiagnostic(typeof message === "string" ? message : String(message));
|
|
10
|
+
} catch {
|
|
11
|
+
return boundForeignDiagnostic(fallback);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/** Include an Error name when worker-failure classification needs it. */
|
|
15
|
+
const safeCauseDiagnostic = (cause, fallback) => {
|
|
16
|
+
try {
|
|
17
|
+
return cause instanceof Error ? boundForeignDiagnostic(`${cause.name}: ${cause.message}`) : safeCauseMessage(cause, fallback);
|
|
18
|
+
} catch {
|
|
19
|
+
return boundForeignDiagnostic(fallback);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/** Read Cloudflare RPC classifications without letting a hostile proxy defect the client. */
|
|
23
|
+
const cloudflareFailureSignals = (cause) => {
|
|
24
|
+
if (!Predicate.isObjectKeyword(cause)) return {};
|
|
25
|
+
try {
|
|
26
|
+
const retryableValue = Reflect.get(cause, "retryable");
|
|
27
|
+
const overloadedValue = Reflect.get(cause, "overloaded");
|
|
28
|
+
const resetValue = Reflect.get(cause, "durableObjectReset");
|
|
29
|
+
const retryable = typeof retryableValue === "boolean" ? retryableValue : resetValue === true ? true : void 0;
|
|
30
|
+
const overloaded = typeof overloadedValue === "boolean" ? overloadedValue : void 0;
|
|
31
|
+
return {
|
|
32
|
+
...retryable === void 0 ? {} : { retryable },
|
|
33
|
+
...overloaded === void 0 ? {} : { overloaded }
|
|
34
|
+
};
|
|
35
|
+
} catch {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { safeCauseDiagnostic as n, safeCauseMessage as r, cloudflareFailureSignals as t };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=boundary-BguazVkh.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundary-BguazVkh.mjs","names":[],"sources":["../src/internal/boundary.ts"],"sourcesContent":["import { Predicate } from \"effect\";\n\nconst MAX_FOREIGN_DIAGNOSTIC_LENGTH = 8_192;\n\nconst boundForeignDiagnostic = (message: string): string =>\n message.slice(0, MAX_FOREIGN_DIAGNOSTIC_LENGTH);\n\n/** Render a foreign failure without trusting accessors or coercion hooks on the value. */\nexport const safeCauseMessage = (cause: unknown, fallback: string): string => {\n try {\n const message = cause instanceof Error ? cause.message : cause;\n\n return boundForeignDiagnostic(typeof message === \"string\" ? message : String(message));\n } catch {\n return boundForeignDiagnostic(fallback);\n }\n};\n\n/** Include an Error name when worker-failure classification needs it. */\nexport const safeCauseDiagnostic = (cause: unknown, fallback: string): string => {\n try {\n return cause instanceof Error\n ? boundForeignDiagnostic(`${cause.name}: ${cause.message}`)\n : safeCauseMessage(cause, fallback);\n } catch {\n return boundForeignDiagnostic(fallback);\n }\n};\n\nexport interface CloudflareFailureSignals {\n readonly retryable?: boolean | undefined;\n readonly overloaded?: boolean | undefined;\n}\n\n/** Read Cloudflare RPC classifications without letting a hostile proxy defect the client. */\nexport const cloudflareFailureSignals = (cause: unknown): CloudflareFailureSignals => {\n if (!Predicate.isObjectKeyword(cause)) return {};\n try {\n const retryableValue = Reflect.get(cause, \"retryable\");\n const overloadedValue = Reflect.get(cause, \"overloaded\");\n const resetValue = Reflect.get(cause, \"durableObjectReset\");\n\n const retryable =\n typeof retryableValue === \"boolean\" ? retryableValue : resetValue === true ? true : undefined;\n\n const overloaded = typeof overloadedValue === \"boolean\" ? overloadedValue : undefined;\n\n return {\n ...(retryable === undefined ? {} : { retryable }),\n ...(overloaded === undefined ? {} : { overloaded }),\n };\n } catch {\n return {};\n }\n};\n"],"mappings":";;AAEA,MAAM,gCAAgC;AAEtC,MAAM,0BAA0B,YAC9B,QAAQ,MAAM,GAAG,6BAA6B;;AAGhD,MAAa,oBAAoB,OAAgB,aAA6B;CAC5E,IAAI;EACF,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;EAEzD,OAAO,uBAAuB,OAAO,YAAY,WAAW,UAAU,OAAO,OAAO,CAAC;CACvF,QAAQ;EACN,OAAO,uBAAuB,QAAQ;CACxC;AACF;;AAGA,MAAa,uBAAuB,OAAgB,aAA6B;CAC/E,IAAI;EACF,OAAO,iBAAiB,QACpB,uBAAuB,GAAG,MAAM,KAAK,IAAI,MAAM,SAAS,IACxD,iBAAiB,OAAO,QAAQ;CACtC,QAAQ;EACN,OAAO,uBAAuB,QAAQ;CACxC;AACF;;AAQA,MAAa,4BAA4B,UAA6C;CACpF,IAAI,CAAC,UAAU,gBAAgB,KAAK,GAAG,OAAO,CAAC;CAC/C,IAAI;EACF,MAAM,iBAAiB,QAAQ,IAAI,OAAO,WAAW;EACrD,MAAM,kBAAkB,QAAQ,IAAI,OAAO,YAAY;EACvD,MAAM,aAAa,QAAQ,IAAI,OAAO,oBAAoB;EAE1D,MAAM,YACJ,OAAO,mBAAmB,YAAY,iBAAiB,eAAe,OAAO,OAAO,KAAA;EAEtF,MAAM,aAAa,OAAO,oBAAoB,YAAY,kBAAkB,KAAA;EAE5E,OAAO;GACL,GAAI,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU;GAC/C,GAAI,eAAe,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW;EACnD;CACF,QAAQ;EACN,OAAO,CAAC;CACV;AACF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Option, Redacted, Schema, Stream } from "effect";
|
|
2
|
+
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http";
|
|
3
|
+
//#region src/internal/browser-session-lifecycle.ts
|
|
4
|
+
var BrowserRunCleanupError = class extends Schema.TaggedError()("BrowserRunCleanupError", {
|
|
5
|
+
reason: Schema.Literals([
|
|
6
|
+
"configuration",
|
|
7
|
+
"authorization",
|
|
8
|
+
"rate-limited",
|
|
9
|
+
"provider",
|
|
10
|
+
"malformed",
|
|
11
|
+
"timeout",
|
|
12
|
+
"pending"
|
|
13
|
+
]),
|
|
14
|
+
status: Schema.optionalKey(Schema.Int)
|
|
15
|
+
}) {};
|
|
16
|
+
const Identity = Schema.String.check(Schema.isUUID());
|
|
17
|
+
const Account = Schema.String.check(Schema.isPattern(/^[a-f0-9]{32}$/));
|
|
18
|
+
const Closed = Schema.Struct({ status: Schema.Literals(["closing", "closed"]) });
|
|
19
|
+
const Metadata = Schema.Struct({
|
|
20
|
+
sessionId: Identity,
|
|
21
|
+
endTime: Schema.optionalKey(Schema.Finite)
|
|
22
|
+
});
|
|
23
|
+
const Absent = Schema.Struct({ error: Schema.Literal("Session not found") });
|
|
24
|
+
var BrowserRunSessionLifecycle = class extends Context.Service()("@effect-agent/platform-cloudflare/BrowserRunSessionLifecycle") {
|
|
25
|
+
static layer(options) {
|
|
26
|
+
return Layer.effect(this, Effect.gen(function* () {
|
|
27
|
+
if (!Schema.is(Account)(options.accountId) || Redacted.value(options.apiToken).length === 0) return yield* new BrowserRunCleanupError({ reason: "configuration" });
|
|
28
|
+
const client = yield* HttpClient.HttpClient;
|
|
29
|
+
const request = Effect.fn("BrowserRunSessionLifecycle.request")(function* (method, sessionId) {
|
|
30
|
+
const path = method === "DELETE" ? "browser" : "session";
|
|
31
|
+
const response = yield* client.execute(HttpClientRequest.make(method)(`https://api.cloudflare.com/client/v4/accounts/${options.accountId}/browser-rendering/devtools/${path}/${sessionId}`).pipe(HttpClientRequest.bearerToken(options.apiToken))).pipe(Effect.provideService(FetchHttpClient.RequestInit, { redirect: "manual" }), Effect.mapError(() => new BrowserRunCleanupError({ reason: "provider" })));
|
|
32
|
+
if (response.status === 401 || response.status === 403) return yield* new BrowserRunCleanupError({
|
|
33
|
+
reason: "authorization",
|
|
34
|
+
status: response.status
|
|
35
|
+
});
|
|
36
|
+
if (response.status === 429) return yield* new BrowserRunCleanupError({
|
|
37
|
+
reason: "rate-limited",
|
|
38
|
+
status: response.status
|
|
39
|
+
});
|
|
40
|
+
if (response.status !== 200 && response.status !== 404) return yield* new BrowserRunCleanupError({
|
|
41
|
+
reason: "provider",
|
|
42
|
+
status: response.status
|
|
43
|
+
});
|
|
44
|
+
if (response.headers["content-type"]?.split(";", 1)[0]?.trim() !== "application/json") return yield* new BrowserRunCleanupError({ reason: "malformed" });
|
|
45
|
+
const bytes = yield* Stream.runFoldEffect(response.stream, () => /* @__PURE__ */ new Uint8Array(), (body, chunk) => {
|
|
46
|
+
if (body.byteLength + chunk.byteLength > 16384) return Effect.fail(new BrowserRunCleanupError({ reason: "malformed" }));
|
|
47
|
+
const combined = new Uint8Array(body.byteLength + chunk.byteLength);
|
|
48
|
+
combined.set(body);
|
|
49
|
+
combined.set(chunk, body.byteLength);
|
|
50
|
+
return Effect.succeed(combined);
|
|
51
|
+
}).pipe(Effect.mapError(() => new BrowserRunCleanupError({ reason: "malformed" })));
|
|
52
|
+
const body = yield* Effect.try({
|
|
53
|
+
try: () => new TextDecoder("utf-8", {
|
|
54
|
+
fatal: true,
|
|
55
|
+
ignoreBOM: false
|
|
56
|
+
}).decode(bytes),
|
|
57
|
+
catch: () => new BrowserRunCleanupError({ reason: "malformed" })
|
|
58
|
+
});
|
|
59
|
+
if (response.status === 404) {
|
|
60
|
+
const absent = Schema.decodeUnknownOption(Schema.fromJsonString(Absent))(body, { onExcessProperty: "error" });
|
|
61
|
+
if (Option.isSome(absent)) return true;
|
|
62
|
+
return yield* new BrowserRunCleanupError({ reason: "malformed" });
|
|
63
|
+
}
|
|
64
|
+
if (method === "DELETE") return (yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Closed))(body).pipe(Effect.mapError(() => new BrowserRunCleanupError({ reason: "malformed" })))).status === "closed";
|
|
65
|
+
const result = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Metadata))(body).pipe(Effect.mapError(() => new BrowserRunCleanupError({ reason: "malformed" })));
|
|
66
|
+
if (result.sessionId !== sessionId) return yield* new BrowserRunCleanupError({ reason: "malformed" });
|
|
67
|
+
return result.endTime !== void 0 && result.endTime > 0;
|
|
68
|
+
});
|
|
69
|
+
return { close: Effect.fn("BrowserRunSessionLifecycle.close")(function* (sessionId) {
|
|
70
|
+
const id = yield* Schema.decodeUnknownEffect(Identity)(Redacted.value(sessionId)).pipe(Effect.mapError(() => new BrowserRunCleanupError({ reason: "configuration" })));
|
|
71
|
+
if (yield* request("DELETE", id)) return;
|
|
72
|
+
for (let read = 0; read < 2; read++) if (yield* request("GET", id)) return;
|
|
73
|
+
return yield* new BrowserRunCleanupError({ reason: "pending" });
|
|
74
|
+
}, Effect.timeoutOrElse({
|
|
75
|
+
duration: "10 seconds",
|
|
76
|
+
orElse: () => Effect.fail(new BrowserRunCleanupError({ reason: "timeout" }))
|
|
77
|
+
}), Effect.withTracerEnabled(false)) };
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { BrowserRunSessionLifecycle as n, BrowserRunCleanupError as t };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=browser-session-lifecycle-CUbVfEgP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-session-lifecycle-CUbVfEgP.mjs","names":[],"sources":["../src/internal/browser-session-lifecycle.ts"],"sourcesContent":["import { Context, Effect, Layer, Option, Redacted, Schema, Stream } from \"effect\";\nimport { FetchHttpClient, HttpClient, HttpClientRequest } from \"effect/unstable/http\";\n\nexport class BrowserRunCleanupError extends Schema.TaggedError<BrowserRunCleanupError>()(\n \"BrowserRunCleanupError\",\n {\n reason: Schema.Literals([\n \"configuration\",\n \"authorization\",\n \"rate-limited\",\n \"provider\",\n \"malformed\",\n \"timeout\",\n \"pending\",\n ]),\n status: Schema.optionalKey(Schema.Int),\n },\n) {}\n\nexport interface BrowserRunLifecycleOptions {\n readonly accountId: string;\n readonly apiToken: Redacted.Redacted<string>;\n}\n\nconst Identity = Schema.String.check(Schema.isUUID());\nconst Account = Schema.String.check(Schema.isPattern(/^[a-f0-9]{32}$/));\nconst Closed = Schema.Struct({ status: Schema.Literals([\"closing\", \"closed\"]) });\nconst Metadata = Schema.Struct({ sessionId: Identity, endTime: Schema.optionalKey(Schema.Finite) });\n// This exact provider response is accepted only on a fixed-origin, authenticated,\n// exact-session request. An arbitrary 404 or a listing omission is never absence.\nconst Absent = Schema.Struct({ error: Schema.Literal(\"Session not found\") });\n\nexport class BrowserRunSessionLifecycle extends Context.Service<\n BrowserRunSessionLifecycle,\n {\n readonly close: (\n sessionId: Redacted.Redacted<string>,\n ) => Effect.Effect<void, BrowserRunCleanupError>;\n }\n>()(\"@effect-agent/platform-cloudflare/BrowserRunSessionLifecycle\") {\n static layer(options: BrowserRunLifecycleOptions) {\n return Layer.effect(\n this,\n Effect.gen(function* () {\n if (\n !Schema.is(Account)(options.accountId) ||\n Redacted.value(options.apiToken).length === 0\n ) {\n return yield* new BrowserRunCleanupError({ reason: \"configuration\" });\n }\n const client = yield* HttpClient.HttpClient;\n\n const request = Effect.fn(\"BrowserRunSessionLifecycle.request\")(function* (\n method: \"GET\" | \"DELETE\",\n sessionId: string,\n ) {\n const path = method === \"DELETE\" ? \"browser\" : \"session\";\n\n const response = yield* client\n .execute(\n HttpClientRequest.make(method)(\n `https://api.cloudflare.com/client/v4/accounts/${options.accountId}/browser-rendering/devtools/${path}/${sessionId}`,\n ).pipe(HttpClientRequest.bearerToken(options.apiToken)),\n )\n .pipe(\n // workerd supports manual/follow, not error. Reject every redirect below.\n Effect.provideService(FetchHttpClient.RequestInit, { redirect: \"manual\" }),\n Effect.mapError(() => new BrowserRunCleanupError({ reason: \"provider\" })),\n );\n\n if (response.status === 401 || response.status === 403)\n return yield* new BrowserRunCleanupError({\n reason: \"authorization\",\n status: response.status,\n });\n if (response.status === 429)\n return yield* new BrowserRunCleanupError({\n reason: \"rate-limited\",\n status: response.status,\n });\n if (response.status !== 200 && response.status !== 404)\n return yield* new BrowserRunCleanupError({\n reason: \"provider\",\n status: response.status,\n });\n if (response.headers[\"content-type\"]?.split(\";\", 1)[0]?.trim() !== \"application/json\")\n return yield* new BrowserRunCleanupError({ reason: \"malformed\" });\n\n const bytes = yield* Stream.runFoldEffect(\n response.stream,\n () => new Uint8Array(),\n (body, chunk) => {\n if (body.byteLength + chunk.byteLength > 16_384)\n return Effect.fail(new BrowserRunCleanupError({ reason: \"malformed\" }));\n const combined = new Uint8Array(body.byteLength + chunk.byteLength);\n\n combined.set(body);\n combined.set(chunk, body.byteLength);\n\n return Effect.succeed(combined);\n },\n ).pipe(Effect.mapError(() => new BrowserRunCleanupError({ reason: \"malformed\" })));\n\n const body = yield* Effect.try({\n try: () => new TextDecoder(\"utf-8\", { fatal: true, ignoreBOM: false }).decode(bytes),\n catch: () => new BrowserRunCleanupError({ reason: \"malformed\" }),\n });\n\n if (response.status === 404) {\n const absent = Schema.decodeUnknownOption(Schema.fromJsonString(Absent))(body, {\n onExcessProperty: \"error\",\n });\n\n if (Option.isSome(absent)) return true;\n\n return yield* new BrowserRunCleanupError({ reason: \"malformed\" });\n }\n if (method === \"DELETE\") {\n const result = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Closed))(\n body,\n ).pipe(Effect.mapError(() => new BrowserRunCleanupError({ reason: \"malformed\" })));\n\n return result.status === \"closed\";\n }\n\n const result = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Metadata))(\n body,\n ).pipe(Effect.mapError(() => new BrowserRunCleanupError({ reason: \"malformed\" })));\n\n if (result.sessionId !== sessionId)\n return yield* new BrowserRunCleanupError({ reason: \"malformed\" });\n\n return result.endTime !== undefined && result.endTime > 0;\n });\n\n const close = Effect.fn(\"BrowserRunSessionLifecycle.close\")(\n function* (sessionId: Redacted.Redacted<string>) {\n const id = yield* Schema.decodeUnknownEffect(Identity)(Redacted.value(sessionId)).pipe(\n Effect.mapError(() => new BrowserRunCleanupError({ reason: \"configuration\" })),\n );\n\n if (yield* request(\"DELETE\", id)) return;\n for (let read = 0; read < 2; read++) {\n if (yield* request(\"GET\", id)) return;\n }\n\n return yield* new BrowserRunCleanupError({ reason: \"pending\" });\n },\n Effect.timeoutOrElse({\n duration: \"10 seconds\",\n orElse: () => Effect.fail(new BrowserRunCleanupError({ reason: \"timeout\" })),\n }),\n Effect.withTracerEnabled(false),\n );\n\n return { close };\n }),\n );\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Redacted, Schema } from "effect";
|
|
2
|
+
import { HttpClient } from "effect/unstable/http";
|
|
3
|
+
//#region src/internal/browser-session-lifecycle.d.ts
|
|
4
|
+
declare const BrowserRunCleanupError_base: Schema.Class<BrowserRunCleanupError, Schema.TaggedStruct<"BrowserRunCleanupError", {
|
|
5
|
+
readonly reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "provider", "malformed", "timeout", "pending"]>;
|
|
6
|
+
readonly status: Schema.optionalKey<Schema.Int>;
|
|
7
|
+
}>, import("effect/Cause").YieldableError>;
|
|
8
|
+
declare class BrowserRunCleanupError extends BrowserRunCleanupError_base {}
|
|
9
|
+
interface BrowserRunLifecycleOptions {
|
|
10
|
+
readonly accountId: string;
|
|
11
|
+
readonly apiToken: Redacted.Redacted<string>;
|
|
12
|
+
}
|
|
13
|
+
declare const BrowserRunSessionLifecycle_base: Context.ServiceClass<BrowserRunSessionLifecycle, "@effect-agent/platform-cloudflare/BrowserRunSessionLifecycle", {
|
|
14
|
+
readonly close: (sessionId: Redacted.Redacted<string>) => Effect.Effect<void, BrowserRunCleanupError>;
|
|
15
|
+
}>;
|
|
16
|
+
declare class BrowserRunSessionLifecycle extends BrowserRunSessionLifecycle_base {
|
|
17
|
+
static layer(options: BrowserRunLifecycleOptions): Layer.Layer<BrowserRunSessionLifecycle, BrowserRunCleanupError, HttpClient.HttpClient>;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { BrowserRunLifecycleOptions as n, BrowserRunSessionLifecycle as r, BrowserRunCleanupError as t };
|
|
21
|
+
//# sourceMappingURL=browser-session-lifecycle-DJpqLXy_.d.mts.map
|