@effect-agent/platform-cloudflare 0.1.0-beta.38 → 0.1.0-beta.39

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.
@@ -0,0 +1,100 @@
1
+ import { Context, Effect, Layer, Schema } from "effect";
2
+ import { ProducerId } from "@effect-agent/thread";
3
+ import { ThreadId } from "@effect-agent/core";
4
+ //#region src/bindings.d.ts
5
+ declare const CloudflareBindingError_base: Schema.Class<CloudflareBindingError, Schema.TaggedStruct<"CloudflareBindingError", {
6
+ readonly binding: Schema.String;
7
+ readonly message: Schema.String;
8
+ }>, import("effect/Cause").YieldableError>;
9
+ /**
10
+ * Cloudflare platform bindings as Effect services (DEPLOY-010: "Cloudflare platform bindings
11
+ * are supplied as Effect services/Layers"). Application code never reads `env` or touches a
12
+ * `DurableObjectState` directly — the Thread Object class constructs these Layers once
13
+ * per incarnation and everything downstream consumes the services.
14
+ */
15
+ /** A Cloudflare platform binding was missing or carried the wrong shape (DEPLOY-003/010). */
16
+ declare class CloudflareBindingError extends CloudflareBindingError_base {}
17
+ /**
18
+ * The RPC surface one Thread Durable Object exposes to Workers and to sibling
19
+ * Thread Objects. `ThreadObject.make` implements it; the Worker-side client
20
+ * and the cross-Object transport call it through `DurableObjectNamespace` stubs. Every
21
+ * `encoded` value is a Schema-encoded envelope (`client.ts` wire schemas for host entry
22
+ * points, `@effect-agent/storage-cloudflare` port envelopes for `portCall`), so the RPC
23
+ * boundary carries only structured-cloneable JSON. The optional trailing trace context is
24
+ * transient native RPC metadata, stripped by an opted-in effect-cf receiver before decoding
25
+ * the host envelope. It never enters durable state.
26
+ */
27
+ interface ThreadObjectRpc extends Rpc.DurableObjectBranded {
28
+ /** Admission-limits gate + `DurableAgentRuntime.submit`; answers a `SubmitResponse`. */
29
+ submitEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
30
+ /** Wake-hinted, poll-guaranteed settlement wait; answers an `AwaitSettlementResponse`. */
31
+ awaitSettlementEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
32
+ /** Event-driven durable progress wait; answers a `ProgressObserved` host response. */
33
+ awaitProgressEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
34
+ /** Best-effort cancellation for one in-flight progress wait. */
35
+ cancelProgressEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
36
+ /** One bounded page of canonical records; answers an `ObservePageResponse`. */
37
+ observePage(encoded: unknown, traceContext?: unknown): Promise<unknown>;
38
+ /** Durable abort intent; answers an `AbortResponse`. */
39
+ abortEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
40
+ /** Durable approval decision (plan §2.6); answers a `ResolveApprovalResponse`. */
41
+ resolveApprovalEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
42
+ /** Authorized DUR-017 Unknown-Outcome resolution; answers a `ResolveUnknownResponse`. */
43
+ resolveUnknownEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
44
+ /** Owner-side cross-Object port endpoint (WP2 envelopes, executed on LOCAL facets). */
45
+ portCall(encoded: unknown): Promise<unknown>;
46
+ /** Droppable liveness hint from another Object: arms an immediate alarm. */
47
+ wake(): Promise<void>;
48
+ }
49
+ declare const ThreadObjectNamespace_base: Context.ServiceClass<ThreadObjectNamespace, "@effect-agent/platform-cloudflare/ThreadObjectNamespace", {
50
+ readonly namespace: DurableObjectNamespace<ThreadObjectRpc>;
51
+ /** Stable binding name for opted-in native RPC tracing; absent by default. */
52
+ readonly rpcTracing?: string;
53
+ }>;
54
+ /**
55
+ * The `DurableObjectNamespace` binding that addresses Thread Objects. The Object
56
+ * identity rule is `namespace.idFromName(threadId)` (plan §1.2): Thread IDs are
57
+ * globally unique, so the mapping is total and deterministic and no directory service exists.
58
+ */
59
+ declare class ThreadObjectNamespace extends ThreadObjectNamespace_base {
60
+ static layer(namespace: DurableObjectNamespace<ThreadObjectRpc>): Layer.Layer<ThreadObjectNamespace>;
61
+ }
62
+ /**
63
+ * Narrow one `env` member to a `DurableObjectNamespace`. `env` is an untyped platform value,
64
+ * and a namespace binding is a host object no Schema can decode, so this is the documented
65
+ * narrowest-boundary check (structural probe for the namespace surface the transport uses);
66
+ * a missing or misshaped binding fails typed before any Layer is built.
67
+ */
68
+ declare const threadNamespaceFromEnv: (env: unknown, binding: string) => Effect.Effect<DurableObjectNamespace<ThreadObjectRpc>, CloudflareBindingError, never>;
69
+ /**
70
+ * Build the namespace from Worker `env` (fails typed). Enable `rpcTracing` only when the
71
+ * receiver also opts into the effect-cf native RPC trace-context contract.
72
+ */
73
+ declare const threadNamespaceLayer: (env: unknown, binding: string, options?: {
74
+ readonly rpcTracing?: boolean;
75
+ }) => Layer.Layer<ThreadObjectNamespace, CloudflareBindingError>;
76
+ declare const DurableObjectContext_base: Context.ServiceClass<DurableObjectContext, "@effect-agent/platform-cloudflare/DurableObjectContext", {
77
+ readonly ctx: DurableObjectState;
78
+ readonly env: unknown;
79
+ }>;
80
+ /**
81
+ * The live Durable Object execution context of THIS incarnation. Only Layer construction and
82
+ * the alarm service consume it; important state never lives on it (`ctx.storage` is truth,
83
+ * everything in memory is a cache — deployment spec §11).
84
+ */
85
+ declare class DurableObjectContext extends DurableObjectContext_base {
86
+ static layer(ctx: DurableObjectState, env: unknown): Layer.Layer<DurableObjectContext>;
87
+ }
88
+ declare const ThreadObjectIdentity_base: Context.ServiceClass<ThreadObjectIdentity, "@effect-agent/platform-cloudflare/ThreadObjectIdentity", {
89
+ readonly threadId: ThreadId;
90
+ readonly producerId: ProducerId;
91
+ }>;
92
+ /**
93
+ * The Thread identity this Object serializes and the producer identity its Attempts
94
+ * write with (`{producerPrefix}:{threadId}`, plan §1.4). Derived once per incarnation
95
+ * from `ctx.id.name` — the Object identity rule guarantees the name IS the Thread ID.
96
+ */
97
+ declare class ThreadObjectIdentity extends ThreadObjectIdentity_base {}
98
+ //#endregion
99
+ export { ThreadObjectRpc as a, ThreadObjectNamespace as i, DurableObjectContext as n, threadNamespaceFromEnv as o, ThreadObjectIdentity as r, threadNamespaceLayer as s, CloudflareBindingError as t };
100
+ //# sourceMappingURL=bindings-C00ZfjsX.d.mts.map