@effect-agent/platform-cloudflare 0.1.0-beta.132 → 0.1.0-beta.133
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.mjs +1 -0
- package/dist/Alarm.mjs.map +1 -1
- package/dist/CloudflareBindings.d.mts +2 -2
- package/dist/CloudflareBindings.mjs.map +1 -1
- package/dist/CloudflareThreadClient.d.mts +47 -47
- package/dist/{ThreadObject-CVhZC-7l.mjs → ThreadObject-BkLV7hMd.mjs} +15 -7
- package/dist/ThreadObject-BkLV7hMd.mjs.map +1 -0
- package/dist/{ThreadObject-D8GzJxJB.d.mts → ThreadObject-D1CWZ8j3.d.mts} +27 -24
- package/dist/ThreadObject.d.mts +1 -1
- package/dist/ThreadObject.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/Alarm.ts +3 -0
- package/src/CloudflareBindings.ts +2 -2
- package/src/ThreadObject.ts +3 -1
- package/src/internal/layers.ts +7 -4
- package/src/internal/transport.ts +23 -11
- package/dist/ThreadObject-CVhZC-7l.mjs.map +0 -1
|
@@ -114,7 +114,10 @@ type CloudflareDurableRuntimeInitializationError = CloudflarePlatformConfigError
|
|
|
114
114
|
type CloudflareDurableRuntimeServices = DurableAgentRuntime | SubmissionLedger | ThreadStore | MessageDeliveryStore | WakeScheduler | DurableAlarmService | ThreadMaintenance | ThreadMutationGate | ThreadPublication | ThreadProjectionMaintenance | ThreadObjectPorts | ProgressWaitRegistry | SqlClient;
|
|
115
115
|
declare const ThreadObjectPorts_base: Context.ServiceClass<ThreadObjectPorts, "@effect-agent/platform-cloudflare/ThreadObjectPorts", {
|
|
116
116
|
readonly handle: (request: PortRequest) => Effect.Effect<PortResponse>;
|
|
117
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Local-only lookup: encoded identities and returned rows must belong to this physical
|
|
119
|
+
* owner. Addressed RPCs additionally validate the exact logical Thread.
|
|
120
|
+
*/
|
|
118
121
|
readonly lookupSubmission: (submissionId: SubmissionId) => Effect.Effect<Option.Option<SubmissionSnapshot>, LedgerError>;
|
|
119
122
|
}>;
|
|
120
123
|
/**
|
|
@@ -359,13 +362,13 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
359
362
|
readonly author: string;
|
|
360
363
|
readonly reason: string;
|
|
361
364
|
readonly resolution: {
|
|
365
|
+
readonly _tag: "SafeToRetry";
|
|
366
|
+
} | {
|
|
362
367
|
readonly _tag: "CompletedWithResult";
|
|
363
368
|
readonly result: Schema.Json;
|
|
364
369
|
readonly isFailure: boolean;
|
|
365
370
|
} | {
|
|
366
371
|
readonly _tag: "NeverHappened";
|
|
367
|
-
} | {
|
|
368
|
-
readonly _tag: "SafeToRetry";
|
|
369
372
|
} | {
|
|
370
373
|
readonly _tag: "AbortSubmission";
|
|
371
374
|
};
|
|
@@ -705,13 +708,20 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
705
708
|
} | {
|
|
706
709
|
readonly _tag: "AdminFailed";
|
|
707
710
|
readonly failure: {
|
|
708
|
-
readonly _tag: "
|
|
711
|
+
readonly _tag: "AdmissionPolicyError";
|
|
712
|
+
readonly reason: "occupied" | "refused" | "unavailable";
|
|
713
|
+
readonly code: string;
|
|
714
|
+
readonly cause?: import("effect-agent/failure-diagnostic").Diagnostic | undefined;
|
|
715
|
+
readonly stack?: string | undefined;
|
|
716
|
+
} | {
|
|
717
|
+
readonly _tag: "SettlementConflict";
|
|
718
|
+
readonly submissionId: string;
|
|
719
|
+
readonly existingOutcome: "aborted" | "completed" | "failed";
|
|
720
|
+
} | {
|
|
721
|
+
readonly _tag: "LedgerError";
|
|
709
722
|
readonly operation: string;
|
|
710
723
|
readonly message: string;
|
|
711
|
-
readonly cause?:
|
|
712
|
-
} | {
|
|
713
|
-
readonly _tag: "ThreadNotMaterialized";
|
|
714
|
-
readonly threadId: string;
|
|
724
|
+
readonly cause?: import("effect-agent/failure-diagnostic").Diagnostic | undefined;
|
|
715
725
|
} | {
|
|
716
726
|
readonly _tag: "ThreadStoreError";
|
|
717
727
|
readonly operation: string;
|
|
@@ -725,10 +735,8 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
725
735
|
readonly sequence?: number | undefined;
|
|
726
736
|
} | undefined;
|
|
727
737
|
} | {
|
|
728
|
-
readonly _tag: "
|
|
729
|
-
readonly
|
|
730
|
-
readonly message: string;
|
|
731
|
-
readonly cause?: import("effect-agent/failure-diagnostic").Diagnostic | undefined;
|
|
738
|
+
readonly _tag: "ThreadNotMaterialized";
|
|
739
|
+
readonly threadId: string;
|
|
732
740
|
} | {
|
|
733
741
|
readonly _tag: "AppendConflict";
|
|
734
742
|
readonly threadId: string;
|
|
@@ -741,18 +749,17 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
741
749
|
readonly threadId: string;
|
|
742
750
|
readonly actualEpoch: number;
|
|
743
751
|
readonly attemptedEpoch: number;
|
|
752
|
+
} | {
|
|
753
|
+
readonly _tag: "DurableAlarmError";
|
|
754
|
+
readonly operation: string;
|
|
755
|
+
readonly message: string;
|
|
756
|
+
readonly cause?: Schema.Json | undefined;
|
|
744
757
|
} | {
|
|
745
758
|
readonly _tag: "OperationDenied";
|
|
746
759
|
readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
|
|
747
760
|
readonly reason: string;
|
|
748
761
|
readonly threadId?: string | undefined;
|
|
749
762
|
readonly submissionId?: string | undefined;
|
|
750
|
-
} | {
|
|
751
|
-
readonly _tag: "AdmissionPolicyError";
|
|
752
|
-
readonly reason: "occupied" | "refused" | "unavailable";
|
|
753
|
-
readonly code: string;
|
|
754
|
-
readonly cause?: import("effect-agent/failure-diagnostic").Diagnostic | undefined;
|
|
755
|
-
readonly stack?: string | undefined;
|
|
756
763
|
} | {
|
|
757
764
|
readonly _tag: "DigestError";
|
|
758
765
|
readonly message: string;
|
|
@@ -760,10 +767,6 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
|
|
|
760
767
|
} | {
|
|
761
768
|
readonly _tag: "DurableRuntimeFailpointError";
|
|
762
769
|
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-duration-append" | "run:after-start-append" | "run:before-duration-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:after-unavailable-append" | "tools:before-prepared-append" | "tools:before-unavailable-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-stop-append" | "worker:after-stop-seal" | "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-stop-append" | "worker:before-stop-seal" | "worker:before-subtree-append";
|
|
763
|
-
} | {
|
|
764
|
-
readonly _tag: "SettlementConflict";
|
|
765
|
-
readonly submissionId: string;
|
|
766
|
-
readonly existingOutcome: "aborted" | "completed" | "failed";
|
|
767
770
|
} | {
|
|
768
771
|
readonly _tag: "ApprovalSuspensionError";
|
|
769
772
|
readonly cause: Schema.Json;
|
|
@@ -814,7 +817,7 @@ interface Instance<EventServices = never> extends InstanceType<DurableObject.Dur
|
|
|
814
817
|
verifyEncoded(encoded: unknown): Promise<unknown>;
|
|
815
818
|
retryEncoded(encoded: unknown): Promise<unknown>;
|
|
816
819
|
obligationsEncoded(encoded: unknown): Promise<unknown>;
|
|
817
|
-
portCall(encoded: unknown): Promise<unknown>;
|
|
820
|
+
portCall(encoded: unknown, traceContext?: unknown): Promise<unknown>;
|
|
818
821
|
wake(): Promise<void>;
|
|
819
822
|
alarm(alarmInfo?: AlarmInvocationInfo): Promise<void> | void;
|
|
820
823
|
}
|
|
@@ -836,4 +839,4 @@ interface Class<EventServices = never> {
|
|
|
836
839
|
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>;
|
|
837
840
|
//#endregion
|
|
838
841
|
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 };
|
|
839
|
-
//# sourceMappingURL=ThreadObject-
|
|
842
|
+
//# sourceMappingURL=ThreadObject-D1CWZ8j3.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-D1CWZ8j3.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/ThreadObject.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
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-
|
|
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-BkLV7hMd.mjs";
|
|
3
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 };
|
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,6 @@ import { t as CloudflareMemory_d_exports } from "./CloudflareMemory.mjs";
|
|
|
10
10
|
import { t as CloudflareScheduling_d_exports } from "./CloudflareScheduling.mjs";
|
|
11
11
|
import { t as CloudflareSubscriptions_d_exports } from "./CloudflareSubscriptions.mjs";
|
|
12
12
|
import { t as CloudflareThreadClient_d_exports } from "./CloudflareThreadClient.mjs";
|
|
13
|
-
import { f as ThreadObject_d_exports } from "./ThreadObject-
|
|
13
|
+
import { f as ThreadObject_d_exports } from "./ThreadObject-D1CWZ8j3.mjs";
|
|
14
14
|
import { t as WakeScheduler_d_exports } from "./WakeScheduler.mjs";
|
|
15
15
|
export { Alarm_d_exports as Alarm, BrowserCredentials_d_exports as BrowserCredentials, BrowserSession_d_exports as BrowserSession, 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/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { t as CloudflareThreadClient_exports } from "./CloudflareThreadClient.mj
|
|
|
8
8
|
import { t as CloudflareScheduling_exports } from "./CloudflareScheduling.mjs";
|
|
9
9
|
import { t as CloudflareSubscriptions_exports } from "./CloudflareSubscriptions.mjs";
|
|
10
10
|
import { t as WakeScheduler_exports } from "./WakeScheduler.mjs";
|
|
11
|
-
import { l as ThreadObject_exports } from "./ThreadObject-
|
|
11
|
+
import { l as ThreadObject_exports } from "./ThreadObject-BkLV7hMd.mjs";
|
|
12
12
|
import { t as CloudflareAiGateway_exports } from "./CloudflareAiGateway.mjs";
|
|
13
13
|
import { t as BrowserCredentials_exports } from "./BrowserCredentials.mjs";
|
|
14
14
|
import { i as BrowserSession_exports } from "./BrowserSession-DWoRC_iM.mjs";
|
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.133","dependencies":{"@effect-agent/storage-cloudflare":"0.1.0-beta.133","@effect/platform-browser":"4.0.0-rc.116","@effect/sql-sqlite-do":"4.0.0-rc.116","effect-agent":"0.1.0-beta.133","puppeteer-core":"24.29.0"},"devDependencies":{"@cloudflare/vitest-pool-workers":"0.21.3","@cloudflare/workers-types":"5.20260825.1","@effect-agent/testing":"0.1.0-beta.133","@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":{"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"},"./browser-session":{"types":"./dist/BrowserSession.d.mts","default":"./dist/BrowserSession.mjs"},"./browser-credentials":{"types":"./dist/BrowserCredentials.d.mts","default":"./dist/BrowserCredentials.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"}}
|
package/src/Alarm.ts
CHANGED
|
@@ -1483,6 +1483,9 @@ export class ThreadMaintenance extends Context.Service<
|
|
|
1483
1483
|
);
|
|
1484
1484
|
|
|
1485
1485
|
yield* failpoint.hit("maintenance:checkpoint:after");
|
|
1486
|
+
// Once this empty recovery wave is checkpointed, its producer overlap must not
|
|
1487
|
+
// prevent a later fresh snapshot from acknowledging native quiescence.
|
|
1488
|
+
if (remaining.length === 0 && recovery.pending.size === 0) delete recovery.observation;
|
|
1486
1489
|
native.deferred.clear();
|
|
1487
1490
|
native.progressed = false;
|
|
1488
1491
|
native.needsCheckpoint = false;
|
|
@@ -27,7 +27,7 @@ export class CloudflareBindingError extends Schema.TaggedError<CloudflareBinding
|
|
|
27
27
|
* points, `@effect-agent/storage-cloudflare` port envelopes for `portCall`), so the RPC
|
|
28
28
|
* boundary carries only structured-cloneable JSON. The optional trailing trace context is
|
|
29
29
|
* transient native RPC metadata, stripped by an opted-in effect-cf receiver before decoding
|
|
30
|
-
* the host envelope. It never enters durable state.
|
|
30
|
+
* the host or port envelope. It never enters durable state.
|
|
31
31
|
*/
|
|
32
32
|
export interface ThreadObjectRpc extends Rpc.DurableObjectBranded {
|
|
33
33
|
/** Admission-limits gate + `DurableAgentRuntime.submit`; answers a `SubmitResponse`. */
|
|
@@ -48,7 +48,7 @@ export interface ThreadObjectRpc extends Rpc.DurableObjectBranded {
|
|
|
48
48
|
/** Authorized DUR-017 Unknown-Outcome resolution; answers a `ResolveUnknownResponse`. */
|
|
49
49
|
resolveUnknownEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
|
|
50
50
|
/** Owner-side cross-Object port endpoint (WP2 envelopes, executed on LOCAL facets). */
|
|
51
|
-
portCall(encoded: unknown): Promise<unknown>;
|
|
51
|
+
portCall(encoded: unknown, traceContext?: unknown): Promise<unknown>;
|
|
52
52
|
/** Droppable liveness hint from another Object: arms an immediate alarm. */
|
|
53
53
|
wake(): Promise<void>;
|
|
54
54
|
}
|
package/src/ThreadObject.ts
CHANGED
|
@@ -196,6 +196,7 @@ const isMutatingPortRequest = (request: PortRequest): boolean => {
|
|
|
196
196
|
case "LedgerResolveAdmission":
|
|
197
197
|
case "StoreReadPage":
|
|
198
198
|
case "StoreInspectTail":
|
|
199
|
+
case "StoreReadIdentity":
|
|
199
200
|
case "StoreCountPeerMessages":
|
|
200
201
|
case "StoreExport":
|
|
201
202
|
case "MessageDeliveryList":
|
|
@@ -374,6 +375,7 @@ const requirePortThread = (request: PortRequest) => {
|
|
|
374
375
|
case "StoreAppend":
|
|
375
376
|
case "StoreReadPage":
|
|
376
377
|
case "StoreInspectTail":
|
|
378
|
+
case "StoreReadIdentity":
|
|
377
379
|
case "StoreCountPeerMessages":
|
|
378
380
|
case "StoreExport":
|
|
379
381
|
return requireReceiptThread(request.request.threadId);
|
|
@@ -1074,7 +1076,7 @@ export interface Instance<EventServices = never> extends InstanceType<
|
|
|
1074
1076
|
verifyEncoded(encoded: unknown): Promise<unknown>;
|
|
1075
1077
|
retryEncoded(encoded: unknown): Promise<unknown>;
|
|
1076
1078
|
obligationsEncoded(encoded: unknown): Promise<unknown>;
|
|
1077
|
-
portCall(encoded: unknown): Promise<unknown>;
|
|
1079
|
+
portCall(encoded: unknown, traceContext?: unknown): Promise<unknown>;
|
|
1078
1080
|
wake(): Promise<void>;
|
|
1079
1081
|
alarm(alarmInfo?: AlarmInvocationInfo): Promise<void> | void;
|
|
1080
1082
|
}
|
package/src/internal/layers.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from "@effect-agent/storage-cloudflare/port-protocol";
|
|
18
18
|
import {
|
|
19
19
|
executePortRequest,
|
|
20
|
+
makeLocalSubmissionLookup,
|
|
20
21
|
routedMessageDeliveryStoreLayer,
|
|
21
22
|
routedThreadStoreLayer,
|
|
22
23
|
routedSubmissionLedgerLayer,
|
|
@@ -71,7 +72,6 @@ import {
|
|
|
71
72
|
import {
|
|
72
73
|
LedgerError,
|
|
73
74
|
SubmissionLedger,
|
|
74
|
-
SubmissionLookupById,
|
|
75
75
|
type SubmissionSnapshot,
|
|
76
76
|
} from "effect-agent/submission-ledger";
|
|
77
77
|
import { ThreadProjectionMaintenance } from "effect-agent/thread-projection-maintenance";
|
|
@@ -228,7 +228,10 @@ export class ThreadObjectPorts extends Context.Service<
|
|
|
228
228
|
ThreadObjectPorts,
|
|
229
229
|
{
|
|
230
230
|
readonly handle: (request: PortRequest) => Effect.Effect<PortResponse>;
|
|
231
|
-
/**
|
|
231
|
+
/**
|
|
232
|
+
* Local-only lookup: encoded identities and returned rows must belong to this physical
|
|
233
|
+
* owner. Addressed RPCs additionally validate the exact logical Thread.
|
|
234
|
+
*/
|
|
232
235
|
readonly lookupSubmission: (
|
|
233
236
|
submissionId: SubmissionId,
|
|
234
237
|
) => Effect.Effect<Option.Option<SubmissionSnapshot>, LedgerError>;
|
|
@@ -726,12 +729,12 @@ const sharedLayer = <A, E, R, PE = never, PR = never>(
|
|
|
726
729
|
SubmissionLedger | ThreadStore | MessageDeliveryStore
|
|
727
730
|
>();
|
|
728
731
|
|
|
729
|
-
const
|
|
732
|
+
const lookupSubmission = makeLocalSubmissionLookup({ ownsThread });
|
|
730
733
|
|
|
731
734
|
return ThreadObjectPorts.of({
|
|
732
735
|
handle: (request) => executePortRequest(request).pipe(Effect.provide(local)),
|
|
733
736
|
lookupSubmission: (submissionId) =>
|
|
734
|
-
|
|
737
|
+
lookupSubmission(submissionId).pipe(Effect.provide(local)),
|
|
735
738
|
});
|
|
736
739
|
}),
|
|
737
740
|
).pipe(Layer.provide(localPorts), Layer.provide(messageStore));
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
portTransportFailure,
|
|
4
4
|
} from "@effect-agent/storage-cloudflare/port-routing";
|
|
5
5
|
import { Effect, Layer } from "effect";
|
|
6
|
+
import type { ThreadId } from "effect-agent/identifiers";
|
|
7
|
+
import { RpcTracing } from "effect-cf";
|
|
6
8
|
|
|
7
9
|
import { callThreadObject, ThreadObjectNamespace } from "../CloudflareBindings.ts";
|
|
8
10
|
|
|
@@ -13,6 +15,8 @@ import { callThreadObject, ThreadObjectNamespace } from "../CloudflareBindings.t
|
|
|
13
15
|
* already Schema-encoded JSON, so the RPC boundary carries only structured-cloneable values;
|
|
14
16
|
* the protocol module stays transport-agnostic and fetch-with-JSON remains the documented
|
|
15
17
|
* fallback carrier.
|
|
18
|
+
* The namespace's optional `rpcTracing` setting uses the same transient trailing context
|
|
19
|
+
* as host calls; it never changes the encoded port envelope.
|
|
16
20
|
*
|
|
17
21
|
* Every delivery problem — stub construction, RPC rejection, overload, deploy-in-progress —
|
|
18
22
|
* surfaces as `PortTransportError` (preserving the platform stub's own `retryable` signal
|
|
@@ -26,19 +30,27 @@ export const threadPortTransportLayer: Layer.Layer<
|
|
|
26
30
|
> = Layer.effect(ThreadPortTransport)(
|
|
27
31
|
Effect.gen(function* () {
|
|
28
32
|
const namespace = yield* ThreadObjectNamespace;
|
|
33
|
+
const { rpcTracing } = namespace;
|
|
29
34
|
|
|
30
35
|
return ThreadPortTransport.of({
|
|
31
|
-
call: (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
call: Effect.fn(
|
|
37
|
+
function* (threadId: ThreadId, request: unknown) {
|
|
38
|
+
const traceArgs =
|
|
39
|
+
rpcTracing === undefined ? [] : yield* RpcTracing.withRpcTraceContext([]);
|
|
40
|
+
|
|
41
|
+
return yield* callThreadObject(
|
|
42
|
+
threadId,
|
|
43
|
+
(target) => target.portCall(request, ...traceArgs),
|
|
44
|
+
(cause) => portTransportFailure(threadId, cause),
|
|
45
|
+
).pipe(Effect.provideService(ThreadObjectNamespace, namespace));
|
|
46
|
+
},
|
|
47
|
+
(effect, threadId) =>
|
|
48
|
+
rpcTracing === undefined
|
|
49
|
+
? Effect.withSpan(effect, "CloudflarePortTransport.call", {
|
|
50
|
+
attributes: { threadId },
|
|
51
|
+
})
|
|
52
|
+
: RpcTracing.withRpcClientSpan(effect, rpcTracing, "portCall"),
|
|
53
|
+
),
|
|
42
54
|
});
|
|
43
55
|
}),
|
|
44
56
|
);
|