@effect-agent/platform-cloudflare 0.1.0-beta.116 → 0.1.0-beta.118
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 +1 -0
- package/dist/Alarm.mjs +8 -1
- package/dist/Alarm.mjs.map +1 -1
- package/dist/CloudflareThreadClient.d.mts +42 -42
- package/dist/ProtectedBrowser.d.mts +4 -1
- package/dist/ProtectedBrowser.mjs +1 -2
- package/dist/ProtectedBrowser.mjs.map +1 -1
- package/dist/{ThreadObject-e1os-shp.d.mts → ThreadObject-CmlCCxd8.d.mts} +16 -16
- package/dist/ThreadObject.d.mts +1 -1
- package/dist/index.d.mts +1 -1
- package/package.json +1 -1
- package/src/Alarm.ts +10 -2
- package/src/protected-browser/host.ts +4 -1
- package/src/protected-browser/policy.ts +2 -2
|
@@ -705,21 +705,6 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
705
705
|
} | {
|
|
706
706
|
readonly _tag: "AdminFailed";
|
|
707
707
|
readonly failure: {
|
|
708
|
-
readonly _tag: "ThreadNotMaterialized";
|
|
709
|
-
readonly threadId: string;
|
|
710
|
-
} | {
|
|
711
|
-
readonly _tag: "ThreadStoreError";
|
|
712
|
-
readonly operation: string;
|
|
713
|
-
readonly message: string;
|
|
714
|
-
readonly cause?: Schema.Json | undefined;
|
|
715
|
-
readonly diagnostic?: {
|
|
716
|
-
readonly causeTag: string;
|
|
717
|
-
readonly operation: string;
|
|
718
|
-
readonly decoder?: string | undefined;
|
|
719
|
-
readonly issueTag?: string | undefined;
|
|
720
|
-
readonly sequence?: number | undefined;
|
|
721
|
-
} | undefined;
|
|
722
|
-
} | {
|
|
723
708
|
readonly _tag: "AdmissionPolicyError";
|
|
724
709
|
readonly reason: "occupied" | "refused" | "unavailable";
|
|
725
710
|
readonly code: string;
|
|
@@ -734,6 +719,21 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
734
719
|
readonly operation: string;
|
|
735
720
|
readonly message: string;
|
|
736
721
|
readonly cause?: import("effect-agent/failure-diagnostic").Diagnostic | undefined;
|
|
722
|
+
} | {
|
|
723
|
+
readonly _tag: "ThreadStoreError";
|
|
724
|
+
readonly operation: string;
|
|
725
|
+
readonly message: string;
|
|
726
|
+
readonly cause?: Schema.Json | undefined;
|
|
727
|
+
readonly diagnostic?: {
|
|
728
|
+
readonly causeTag: string;
|
|
729
|
+
readonly operation: string;
|
|
730
|
+
readonly decoder?: string | undefined;
|
|
731
|
+
readonly issueTag?: string | undefined;
|
|
732
|
+
readonly sequence?: number | undefined;
|
|
733
|
+
} | undefined;
|
|
734
|
+
} | {
|
|
735
|
+
readonly _tag: "ThreadNotMaterialized";
|
|
736
|
+
readonly threadId: string;
|
|
737
737
|
} | {
|
|
738
738
|
readonly _tag: "AppendConflict";
|
|
739
739
|
readonly threadId: string;
|
|
@@ -833,4 +833,4 @@ interface Class<EventServices = never> {
|
|
|
833
833
|
declare const make: <ApplicationServices, ApplicationError, EventServices = never, EventLayerError = never>(applicationLayer: Layer.Layer<CloudflareDurableRuntimeServices | ApplicationServices, ApplicationError, CloudflareBootstrapServices | DurableObjectState$1.DurableObjectState | WorkerEnvironment | DurableObjectContext | ThreadObjectNamespace>, options: Options<ApplicationServices, EventServices, EventLayerError>) => Class<ApplicationServices | EventServices>;
|
|
834
834
|
//#endregion
|
|
835
835
|
export { ThreadPublicationOptions as A, portCall as C, CloudflareDurableRuntimeOptions as D, CloudflareDurableRuntimeInitializationError as E, layerConfig as M, layerHostConfig as N, CloudflareDurableRuntimeServices as O, layerInHost as P, make as S, CloudflareBootstrapServices as T, decodeAdminVerifyRequest as _, AdminVerifyRequest as a, encodeAdminResponse as b, Instance as c, RetryExecuted as d, ThreadObject_d_exports as f, decodeAdminResponse as g, decodeAdminExplainRequest as h, AdminResponse as i, layer as j, ThreadObjectPorts as k, ObligationsScanned as l, VerifiedIntegrity as m, AdminFailed as n, Class as o, ThreadRpcOperation as p, AdminFailure as r, ExplainedRecovery as s, AdminExplainRequest as t, Options as u, decodeObligationThresholds as v, submit as w, handleRpc as x, decodeRetryCommand as y };
|
|
836
|
-
//# sourceMappingURL=ThreadObject-
|
|
836
|
+
//# sourceMappingURL=ThreadObject-CmlCCxd8.d.mts.map
|
package/dist/ThreadObject.d.mts
CHANGED
|
@@ -1,2 +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-
|
|
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-CmlCCxd8.mjs";
|
|
2
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 };
|
package/dist/index.d.mts
CHANGED
|
@@ -8,6 +8,6 @@ import { t as CloudflareMemory_d_exports } from "./CloudflareMemory.mjs";
|
|
|
8
8
|
import { t as CloudflareScheduling_d_exports } from "./CloudflareScheduling.mjs";
|
|
9
9
|
import { t as CloudflareSubscriptions_d_exports } from "./CloudflareSubscriptions.mjs";
|
|
10
10
|
import { t as CloudflareThreadClient_d_exports } from "./CloudflareThreadClient.mjs";
|
|
11
|
-
import { f as ThreadObject_d_exports } from "./ThreadObject-
|
|
11
|
+
import { f as ThreadObject_d_exports } from "./ThreadObject-CmlCCxd8.mjs";
|
|
12
12
|
import { t as WakeScheduler_d_exports } from "./WakeScheduler.mjs";
|
|
13
13
|
export { Alarm_d_exports as Alarm, CloudflareAiGateway_d_exports as CloudflareAiGateway, CloudflareBindings_d_exports as CloudflareBindings, CloudflareBrowser_d_exports as CloudflareBrowser, CloudflareCodeMode_d_exports as CloudflareCodeMode, CloudflareConfig_d_exports as CloudflareConfig, CloudflareMemory_d_exports as CloudflareMemory, CloudflareScheduling_d_exports as CloudflareScheduling, CloudflareSubscriptions_d_exports as CloudflareSubscriptions, CloudflareThreadClient_d_exports as CloudflareThreadClient, ThreadObject_d_exports as ThreadObject, WakeScheduler_d_exports as WakeScheduler };
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@effect-agent/platform-cloudflare","version":"0.1.0-beta.
|
|
1
|
+
{"name":"@effect-agent/platform-cloudflare","version":"0.1.0-beta.118","dependencies":{"@effect-agent/storage-cloudflare":"0.1.0-beta.118","@effect/platform-browser":"4.0.0-rc.116","@effect/sql-sqlite-do":"4.0.0-rc.116","effect-agent":"0.1.0-beta.118"},"devDependencies":{"@cloudflare/puppeteer":"1.1.0","@cloudflare/vitest-pool-workers":"0.21.3","@cloudflare/workers-types":"5.20260825.1","@effect-agent/testing":"0.1.0-beta.118","@effect/platform-node":"4.0.0-rc.116","@effect/sql-d1":"4.0.0-rc.116","@effect/vitest":"4.0.0-rc.116","effect":"4.0.0-rc.116","effect-cf":"0.44.1","esbuild":"0.28.1","miniflare":"5.20260811.1-alpha","typescript":"7.0.2","vite-plus":"0.3.2","vitest":"4.1.11"},"peerDependencies":{"@cloudflare/puppeteer":"^1.1.0","effect":"^4.0.0-rc.116","effect-cf":"^0.44.1 || ^0.45.0"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./alarm":{"types":"./dist/Alarm.d.mts","default":"./dist/Alarm.mjs"},"./browser-rest-capture":{"types":"./dist/BrowserRestCapture.d.mts","default":"./dist/BrowserRestCapture.mjs"},"./browser-rest-crawl":{"types":"./dist/BrowserRestCrawl.d.mts","default":"./dist/BrowserRestCrawl.mjs"},"./cloudflare-bindings":{"types":"./dist/CloudflareBindings.d.mts","default":"./dist/CloudflareBindings.mjs"},"./cloudflare-browser":{"types":"./dist/CloudflareBrowser.d.mts","default":"./dist/CloudflareBrowser.mjs"},"./cloudflare-code-mode":{"types":"./dist/CloudflareCodeMode.d.mts","default":"./dist/CloudflareCodeMode.mjs"},"./cloudflare-config":{"types":"./dist/CloudflareConfig.d.mts","default":"./dist/CloudflareConfig.mjs"},"./cloudflare-memory":{"types":"./dist/CloudflareMemory.d.mts","default":"./dist/CloudflareMemory.mjs"},"./cloudflare-scheduling":{"types":"./dist/CloudflareScheduling.d.mts","default":"./dist/CloudflareScheduling.mjs"},"./cloudflare-subscriptions":{"types":"./dist/CloudflareSubscriptions.d.mts","default":"./dist/CloudflareSubscriptions.mjs"},"./cloudflare-thread-client":{"types":"./dist/CloudflareThreadClient.d.mts","default":"./dist/CloudflareThreadClient.mjs"},"./interactive-browser":{"types":"./dist/InteractiveBrowser.d.mts","default":"./dist/InteractiveBrowser.mjs"},"./protected-browser":{"types":"./dist/ProtectedBrowser.d.mts","default":"./dist/ProtectedBrowser.mjs"},"./thread-object":{"types":"./dist/ThreadObject.d.mts","default":"./dist/ThreadObject.mjs"},"./wake-scheduler":{"types":"./dist/WakeScheduler.d.mts","default":"./dist/WakeScheduler.mjs"},"./cloudflare-ai-gateway":{"types":"./dist/CloudflareAiGateway.d.mts","default":"./dist/CloudflareAiGateway.mjs"}},"description":"Cloudflare Layer assembly for Effect Agent: Durable Objects and Browser Run adapters.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/danieljvdm/effect-agent.git","directory":"packages/platform-cloudflare"},"files":["dist","src"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json"},"peerDependenciesMeta":{"@cloudflare/puppeteer":{"optional":true}}}
|
package/src/Alarm.ts
CHANGED
|
@@ -647,6 +647,7 @@ export class ThreadMaintenance extends Context.Service<
|
|
|
647
647
|
* Authorize `explain`, then read one bounded local record without reading execution history.
|
|
648
648
|
* None means no recorded fault, not proof of health or settlement. The host authenticates
|
|
649
649
|
* callers and verifies local Thread membership before exposing this service across RPC.
|
|
650
|
+
* Created, updated and cleared faults notify WakeScheduler after their durable commit.
|
|
650
651
|
* Provide OperationAuthorizer when constructing this Layer, as for DurableAgentRuntime.
|
|
651
652
|
*/
|
|
652
653
|
readonly recoveryStatus: (
|
|
@@ -754,6 +755,7 @@ export class ThreadMaintenance extends Context.Service<
|
|
|
754
755
|
|
|
755
756
|
const retained = yield* runTransaction("record Thread recovery status", () =>
|
|
756
757
|
ctx.storage.transaction(async (transaction) => {
|
|
758
|
+
const changed: Array<ThreadId> = [];
|
|
757
759
|
const newlyBlocked: Array<ThreadRecoveryFault> = [];
|
|
758
760
|
const faults = new Map<ThreadId, ThreadRecoveryFault>();
|
|
759
761
|
|
|
@@ -765,7 +767,10 @@ export class ThreadMaintenance extends Context.Service<
|
|
|
765
767
|
encoded === undefined ? undefined : decodeRecoveryFault(threadId, encoded);
|
|
766
768
|
|
|
767
769
|
if (failure === undefined) {
|
|
768
|
-
if (previous !== undefined)
|
|
770
|
+
if (previous !== undefined) {
|
|
771
|
+
await transaction.delete(key);
|
|
772
|
+
changed.push(threadId);
|
|
773
|
+
}
|
|
769
774
|
continue;
|
|
770
775
|
}
|
|
771
776
|
|
|
@@ -780,15 +785,18 @@ export class ThreadMaintenance extends Context.Service<
|
|
|
780
785
|
});
|
|
781
786
|
|
|
782
787
|
await transaction.put(key, encodeRecoveryFault(fault));
|
|
788
|
+
changed.push(threadId);
|
|
783
789
|
faults.set(threadId, fault);
|
|
784
790
|
if (previous === undefined) newlyBlocked.push(fault);
|
|
785
791
|
}
|
|
786
792
|
|
|
787
|
-
return { newlyBlocked, faults };
|
|
793
|
+
return { changed, newlyBlocked, faults };
|
|
788
794
|
}),
|
|
789
795
|
);
|
|
790
796
|
|
|
791
797
|
yield* failpoint.hit("maintenance:recovery-status:after");
|
|
798
|
+
// A healthy unchanged head must not wake its own maintenance loop.
|
|
799
|
+
for (const threadId of retained.changed) yield* wakes.notify(threadId);
|
|
792
800
|
for (const fault of retained.newlyBlocked)
|
|
793
801
|
yield* Effect.logError(
|
|
794
802
|
"Native Thread recovery blocked; accepted work remains pending",
|
|
@@ -62,7 +62,10 @@ export interface BrowserRunProtectedSession {
|
|
|
62
62
|
readonly getHandoffState: Effect.Effect<BrowserRunHandoffState, ProtectedBrowserError>;
|
|
63
63
|
/** Read only the exact page’s current origin after its recorded handoff completes; tools remain paused. */
|
|
64
64
|
readonly getReturnOrigin: Effect.Effect<typeof CredentialOrigin.Type, ProtectedBrowserError>;
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Resume a committed pause; human handoffs also require provider completion. Returns no page data.
|
|
67
|
+
* A fresh authorized observation must succeed before page actions or credential operations.
|
|
68
|
+
*/
|
|
66
69
|
readonly returnControl: Effect.Effect<void, ProtectedBrowserError>;
|
|
67
70
|
/** Release this attachment only after committing its suspended checkpoint; preserve the remote browser. */
|
|
68
71
|
readonly detach: Effect.Effect<void, ProtectedBrowserError>;
|
|
@@ -404,7 +404,8 @@ export const makeProtectedBrowserPolicy = Effect.fn("ProtectedBrowser.open")(fun
|
|
|
404
404
|
const interrupt = cause.reasons.some((reason) => reason._tag === "Interrupt");
|
|
405
405
|
|
|
406
406
|
if (
|
|
407
|
-
dispatch
|
|
407
|
+
dispatch === "possibly-dispatched" ||
|
|
408
|
+
(dispatch === "dispatched" && reason !== "busy") ||
|
|
408
409
|
interrupt ||
|
|
409
410
|
reason === "provider" ||
|
|
410
411
|
reason === "timeout"
|
|
@@ -815,7 +816,6 @@ export const makeProtectedBrowserPolicy = Effect.fn("ProtectedBrowser.open")(fun
|
|
|
815
816
|
Effect.gen(function* () {
|
|
816
817
|
if (detached || observation === "closed") return yield* fail("closed");
|
|
817
818
|
if (!suspended) return yield* fail("denied");
|
|
818
|
-
yield* permitObservation;
|
|
819
819
|
offers.clear();
|
|
820
820
|
driver.resetReferences();
|
|
821
821
|
needsObservation = true;
|