@yielded/agent-platform-cloudflare 0.1.0-beta.167 → 0.1.0-beta.168

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.
Files changed (97) hide show
  1. package/dist/{Alarm-B0ODr1NE.mjs → Alarm-DxODgAZZ.mjs} +259 -159
  2. package/dist/Alarm-DxODgAZZ.mjs.map +1 -0
  3. package/dist/Alarm.d.mts +27 -36
  4. package/dist/Alarm.mjs +2 -2
  5. package/dist/BrowserCredentials-C5IWfi7f.d.mts +91 -0
  6. package/dist/BrowserCredentials.d.mts +2 -91
  7. package/dist/BrowserRestCapture.mjs +3 -3
  8. package/dist/BrowserRestCapture.mjs.map +1 -1
  9. package/dist/BrowserRestCrawl.mjs +6 -6
  10. package/dist/BrowserRestCrawl.mjs.map +1 -1
  11. package/dist/{BrowserSession-RfIzxGCH.mjs → BrowserSession-BfNmyayH.mjs} +5 -5
  12. package/dist/BrowserSession-BfNmyayH.mjs.map +1 -0
  13. package/dist/{BrowserSession-B969Xg-2.d.mts → BrowserSession-Bx0V1-6_.d.mts} +6 -3
  14. package/dist/BrowserSession.d.mts +1 -1
  15. package/dist/BrowserSession.mjs +2 -2
  16. package/dist/BrowserUse-AstK0jKX.mjs +1467 -0
  17. package/dist/BrowserUse-AstK0jKX.mjs.map +1 -0
  18. package/dist/BrowserUse.d.mts +83 -0
  19. package/dist/BrowserUse.mjs +2 -0
  20. package/dist/CloudflareBindings.d.mts +8 -1
  21. package/dist/CloudflareBindings.mjs +2 -2
  22. package/dist/CloudflareBindings.mjs.map +1 -1
  23. package/dist/{CloudflareBrowser-5an6m-Qb.mjs → CloudflareBrowser-Vt8qTdYW.mjs} +11 -13
  24. package/dist/CloudflareBrowser-Vt8qTdYW.mjs.map +1 -0
  25. package/dist/CloudflareBrowser.mjs +1 -1
  26. package/dist/CloudflareCodeMode.mjs +1 -1
  27. package/dist/CloudflareCodeMode.mjs.map +1 -1
  28. package/dist/{CloudflareConfig-qDrRLofL.d.mts → CloudflareConfig-C9MvPbX8.d.mts} +9 -11
  29. package/dist/CloudflareConfig.d.mts +1 -1
  30. package/dist/CloudflareConfig.mjs +9 -12
  31. package/dist/CloudflareConfig.mjs.map +1 -1
  32. package/dist/CloudflareMemory.d.mts +3 -25
  33. package/dist/CloudflareMemory.mjs +33 -31
  34. package/dist/CloudflareMemory.mjs.map +1 -1
  35. package/dist/CloudflareScheduling.mjs +8 -15
  36. package/dist/CloudflareScheduling.mjs.map +1 -1
  37. package/dist/CloudflareSubscriptions.mjs +9 -16
  38. package/dist/CloudflareSubscriptions.mjs.map +1 -1
  39. package/dist/CloudflareThreadClient-CZm0TvUe.mjs +588 -0
  40. package/dist/CloudflareThreadClient-CZm0TvUe.mjs.map +1 -0
  41. package/dist/CloudflareThreadClient-QsVzLGGZ.d.mts +2033 -0
  42. package/dist/CloudflareThreadClient.d.mts +2 -1796
  43. package/dist/CloudflareThreadClient.mjs +2 -382
  44. package/dist/{InteractiveBrowser-BbG3kGA9.mjs → InteractiveBrowser-LdKzQeLR.mjs} +18 -19
  45. package/dist/InteractiveBrowser-LdKzQeLR.mjs.map +1 -0
  46. package/dist/InteractiveBrowser.mjs +1 -1
  47. package/dist/{ThreadObject-BcfXbzSO.d.mts → ThreadObject-7s5XnlH-.d.mts} +103 -79
  48. package/dist/{ThreadObject-DHjrnlX4.mjs → ThreadObject-C0vrcDrw.mjs} +265 -66
  49. package/dist/ThreadObject-C0vrcDrw.mjs.map +1 -0
  50. package/dist/ThreadObject.d.mts +2 -2
  51. package/dist/ThreadObject.mjs +2 -3
  52. package/dist/WakeScheduler.d.mts +6 -5
  53. package/dist/WakeScheduler.mjs +15 -11
  54. package/dist/WakeScheduler.mjs.map +1 -1
  55. package/dist/index.d.mts +7 -6
  56. package/dist/index.mjs +7 -6
  57. package/dist/page-function-CmUCcyNP.mjs +11 -0
  58. package/dist/page-function-CmUCcyNP.mjs.map +1 -0
  59. package/dist/{prepared-admission-DMX5p9dC.mjs → prepared-admission-3UUq0zth.mjs} +3 -3
  60. package/dist/{prepared-admission-DMX5p9dC.mjs.map → prepared-admission-3UUq0zth.mjs.map} +1 -1
  61. package/package.json +1 -1
  62. package/src/Alarm.ts +510 -279
  63. package/src/BrowserRestCapture.ts +2 -2
  64. package/src/BrowserRestCrawl.ts +10 -14
  65. package/src/BrowserSession.ts +10 -2
  66. package/src/BrowserUse.ts +1541 -0
  67. package/src/CloudflareBindings.ts +13 -4
  68. package/src/CloudflareCodeMode.ts +1 -1
  69. package/src/CloudflareConfig.ts +9 -12
  70. package/src/CloudflareMemory.ts +21 -28
  71. package/src/CloudflareScheduling.ts +7 -15
  72. package/src/CloudflareSubscriptions.ts +11 -20
  73. package/src/CloudflareThreadClient.ts +289 -9
  74. package/src/InteractiveBrowser.ts +325 -323
  75. package/src/ThreadObject.ts +172 -52
  76. package/src/WakeScheduler.ts +29 -18
  77. package/src/index.ts +1 -0
  78. package/src/internal/browser-dom.ts +845 -0
  79. package/src/internal/browser-file-selection.ts +8 -1
  80. package/src/internal/browser-jev-dom.ts +344 -0
  81. package/src/internal/browser-quick-action.ts +7 -8
  82. package/src/internal/browser-session-lifecycle.ts +2 -5
  83. package/src/internal/crypto.ts +41 -0
  84. package/src/internal/due-queue.ts +5 -69
  85. package/src/internal/layers.ts +100 -17
  86. package/src/internal/live-text-protocol.ts +51 -0
  87. package/src/internal/live-text.ts +256 -0
  88. package/src/internal/page-function.ts +12 -0
  89. package/src/internal/prepared-admission.ts +1 -1
  90. package/src/internal/progress-wait.ts +19 -24
  91. package/src/internal/transport.ts +1 -1
  92. package/dist/Alarm-B0ODr1NE.mjs.map +0 -1
  93. package/dist/BrowserSession-RfIzxGCH.mjs.map +0 -1
  94. package/dist/CloudflareBrowser-5an6m-Qb.mjs.map +0 -1
  95. package/dist/CloudflareThreadClient.mjs.map +0 -1
  96. package/dist/InteractiveBrowser-BbG3kGA9.mjs.map +0 -1
  97. package/dist/ThreadObject-DHjrnlX4.mjs.map +0 -1
@@ -25,7 +25,8 @@ export class CloudflareBindingError extends Schema.TaggedError<CloudflareBinding
25
25
  * and the cross-Object transport call it through `DurableObjectNamespace` stubs. Every
26
26
  * `encoded` value is a Schema-encoded envelope (`client.ts` wire schemas for host entry
27
27
  * points, `@yielded/agent-storage-cloudflare` port envelopes for `portCall`), so the RPC
28
- * boundary carries only structured-cloneable JSON. The optional trailing trace context is
28
+ * boundary carries structured-cloneable JSON, except `watchTextEncoded`, which can return
29
+ * a bounded, disposable byte stream. The optional trailing trace context is
29
30
  * transient native RPC metadata, stripped by an opted-in effect-cf receiver before decoding
30
31
  * the host or port envelope. It never enters durable state.
31
32
  */
@@ -35,10 +36,14 @@ export interface ThreadObjectRpc extends Rpc.DurableObjectBranded {
35
36
  /** Wake-hinted, poll-guaranteed settlement wait; answers an `AwaitSettlementResponse`. */
36
37
  submissionStatusEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
37
38
  awaitSettlementEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
39
+ /** Finalized canonical settlement record; requires settlement and observation authority. */
40
+ awaitSettlementRecordEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
38
41
  /** Event-driven durable progress wait; answers a `ProgressObserved` host response. */
39
42
  awaitProgressEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
40
43
  /** Best-effort cancellation for one in-flight progress wait. */
41
44
  cancelProgressEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
45
+ /** Authorized prospective provisional text; byte stream or encoded HostFailed. */
46
+ watchTextEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
42
47
  /** One bounded page of canonical records; answers an `ObservePageResponse`. */
43
48
  observePage(encoded: unknown, traceContext?: unknown): Promise<unknown>;
44
49
  /** Durable abort intent; answers an `AbortResponse`. */
@@ -82,7 +87,7 @@ export class ThreadObjectNamespace extends Context.Service<
82
87
  }
83
88
 
84
89
  /** Invoke a placed Thread using the current invocation's native RPC channel. */
85
- export const callThreadObject = Effect.fn("callThreadObject")(function* <A, E>(
90
+ export const callThreadObject = Effect.fnUntraced(function* <A, E>(
86
91
  threadId: ThreadId,
87
92
  invoke: (target: ThreadObjectClient) => Promise<A>,
88
93
  onError: (cause: unknown) => E,
@@ -104,7 +109,7 @@ export const callThreadObject = Effect.fn("callThreadObject")(function* <A, E>(
104
109
  * narrowest-boundary check (structural probe for the namespace surface the transport uses);
105
110
  * a missing or misshaped binding fails typed before any Layer is built.
106
111
  */
107
- export const threadNamespaceFromEnv = Effect.fn("threadNamespaceFromEnv")(function* (
112
+ export const threadNamespaceFromEnv = Effect.fnUntraced(function* (
108
113
  env: unknown,
109
114
  binding: string,
110
115
  ): Effect.fn.Return<DurableObjectNamespace<ThreadObjectRpc>, CloudflareBindingError> {
@@ -195,5 +200,9 @@ export class ThreadObjectIdentity extends Context.Service<
195
200
  /** Logical Threads whose canonical stores and admission ledger live in this physical Object. */
196
201
  export class ThreadObjectPlacement extends Context.Service<
197
202
  ThreadObjectPlacement,
198
- { readonly ownsThread: (threadId: ThreadId) => boolean }
203
+ {
204
+ readonly ownsThread: (threadId: ThreadId) => boolean;
205
+ /** Present only when this physical Object owns exactly this one Thread. */
206
+ readonly threadId?: ThreadId;
207
+ }
199
208
  >()("@effect-agent/platform-cloudflare/ThreadObjectPlacement") {}
@@ -410,7 +410,7 @@ const makeExecute = (
410
410
  options: DynamicWorkerCodeExecutorOptions,
411
411
  clock: Clock.Clock,
412
412
  ): CodeExecutorExecute =>
413
- Effect.fn("DynamicWorkerCodeExecutor.execute")(function* (request: CodeExecutionRequest) {
413
+ Effect.fnUntraced(function* (request: CodeExecutionRequest) {
414
414
  if (request.network._tag !== "NetworkDisabled") {
415
415
  return yield* CodeExecutorUnsupportedError.make({
416
416
  implementation: dynamicWorkerImplementation,
@@ -1,7 +1,6 @@
1
1
  import { DEFAULT_MAX_STORED_VALUE_BYTES } from "@yielded/agent-storage-cloudflare/do-storage-config";
2
2
  import { DeploymentId } from "@yielded/agent/records";
3
- import { DEFAULT_OWNERSHIP_LEASE_DURATION } from "@yielded/agent/submission-ledger";
4
- import { Context, Duration, Schema } from "effect";
3
+ import { Context, Schema } from "effect";
5
4
 
6
5
  /**
7
6
  * Schema-validated configuration for the Cloudflare durable runtime (deployment spec §4:
@@ -79,8 +78,8 @@ export class CloudflareAdmissionLimitsValue extends Schema.Class<CloudflareAdmis
79
78
  /**
80
79
  * Validated Cloudflare durable runtime configuration. The producer identity of one
81
80
  * Thread Object is `{producerPrefix}:{threadId}` — stable across incarnations of
82
- * the same deployment, distinct across deployments — and producer-epoch fencing (not the
83
- * producer name) remains the correctness authority (DUR-006).
81
+ * the same deployment, distinct across deployments. The Object owns its Thread exclusively;
82
+ * scoped local generations reject callbacks from an earlier Run owner.
84
83
  */
85
84
  export class CloudflareDurableRuntimeConfigValue extends Schema.Class<CloudflareDurableRuntimeConfigValue>(
86
85
  "@effect-agent/platform-cloudflare/CloudflareDurableRuntimeConfigValue",
@@ -88,16 +87,16 @@ export class CloudflareDurableRuntimeConfigValue extends Schema.Class<Cloudflare
88
87
  deploymentId: DeploymentId,
89
88
  /** Head of the minted producer identity `{producerPrefix}:{threadId}`. */
90
89
  producerPrefix: Schema.NonEmptyString.check(Schema.isMaxLength(256)),
91
- /** Submission ownership lease duration (D5); fences work across Object incarnations. */
92
- ownershipLeaseDuration: PositiveMillis,
93
- /** Base delay of exponential backoff when a pass fails or makes no progress. */
90
+ /**
91
+ * Base delay of exponential backoff when a pass fails or makes no progress.
92
+ * Half this delay (rounded up, at least 1ms) also pre-arms mutations, including
93
+ * healthy admissions. `alarmBackoffCap` does not cap that pre-arm delay.
94
+ */
94
95
  alarmBackoffBase: PositiveMillis,
95
96
  /** Ceiling of exponential backoff after failed or no-progress maintenance passes. */
96
97
  alarmBackoffCap: PositiveMillis,
97
98
  /** `awaitSettlement` ledger re-check cadence when no wake arrives. */
98
99
  settlementPollInterval: PositiveMillis,
99
- /** Worker ownership-lease renewal cadence during an active Attempt. */
100
- leaseRenewalInterval: PositiveMillis,
101
100
  /** Active-Run abort-intent poll cadence. */
102
101
  abortPollInterval: PositiveMillis,
103
102
  /** Canonical observation poll cadence of the Durable Object store. */
@@ -109,7 +108,7 @@ export class CloudflareDurableRuntimeConfigValue extends Schema.Class<Cloudflare
109
108
  Schema.isGreaterThan(0),
110
109
  Schema.isLessThanOrEqualTo(2_000_000),
111
110
  ),
112
- /** Opt-in full payload/digest-chain audit while opening the store. */
111
+ /** Opt-in full history and active-state validation while opening the store. */
113
112
  verifyOnOpen: Schema.Boolean,
114
113
  limits: CloudflareAdmissionLimitsValue,
115
114
  }) {}
@@ -122,11 +121,9 @@ export class CloudflareDurableRuntimeConfig extends Context.Service<
122
121
 
123
122
  /** Documented production defaults applied by `ThreadObject.layer`. */
124
123
  export const CLOUDFLARE_RUNTIME_DEFAULTS = {
125
- ownershipLeaseDuration: Duration.toMillis(DEFAULT_OWNERSHIP_LEASE_DURATION),
126
124
  alarmBackoffBase: 100,
127
125
  alarmBackoffCap: 5_000,
128
126
  settlementPollInterval: 500,
129
- leaseRenewalInterval: 10_000,
130
127
  abortPollInterval: 500,
131
128
  observationPollInterval: 25,
132
129
  projectionDispatchTimeoutMillis: 30_000,
@@ -64,9 +64,7 @@ export const memoryObjectName = (namespace: MemoryNamespace.Any): string => name
64
64
  * Interrupted callers stop waiting; the owner has its own deadline. A timed-out write
65
65
  * may have committed: reconcile by sending the identical operation ID and command.
66
66
  */
67
- const makeMemoryClient = Effect.fn("CloudflareMemoryClient.make")(function* <
68
- Namespace extends MemoryNamespace.Any,
69
- >(
67
+ const makeMemoryClient = Effect.fnUntraced(function* <Namespace extends MemoryNamespace.Any>(
70
68
  access: MemoryAccess<Namespace>,
71
69
  principal: Principal,
72
70
  rpcLimits: MemoryRpcLimits = defaultMemoryRpcLimits,
@@ -84,7 +82,7 @@ const makeMemoryClient = Effect.fn("CloudflareMemoryClient.make")(function* <
84
82
  );
85
83
  const { namespace } = yield* MemoryObjectNamespace;
86
84
 
87
- const call = Effect.fn("CloudflareMemoryClient.call")(function* (request: MemoryOwnerRequest) {
85
+ const call = Effect.fnUntraced(function* (request: MemoryOwnerRequest) {
88
86
  const decoded = yield* Schema.decodeEffect(MemoryOwnerRequest)(request).pipe(
89
87
  Effect.mapError(() => MemoryRpcError.make({ reason: "protocol" })),
90
88
  );
@@ -130,7 +128,7 @@ const makeMemoryClient = Effect.fn("CloudflareMemoryClient.make")(function* <
130
128
  }),
131
129
  );
132
130
 
133
- const revalidate = Effect.fn("CloudflareMemoryClient.revalidate")(function* (
131
+ const revalidate = Effect.fnUntraced(function* (
134
132
  lookup: MemoryLookup,
135
133
  limits: MemoryRecallLimits,
136
134
  ) {
@@ -156,9 +154,7 @@ const makeMemoryClient = Effect.fn("CloudflareMemoryClient.make")(function* <
156
154
  }).pipe((effect) => withinDeadline(effect, timeoutMillis));
157
155
  });
158
156
 
159
- const change = Effect.fn("CloudflareMemoryClient.change")(function* (
160
- write: MemoryWrite<Namespace>,
161
- ) {
157
+ const change = Effect.fnUntraced(function* (write: MemoryWrite<Namespace>) {
162
158
  if (!MemoryNamespace.equals(write.key.namespace, bound.namespace))
163
159
  return yield* MemoryRpcError.make({ reason: "denied" });
164
160
 
@@ -186,7 +182,7 @@ const makeMemoryClient = Effect.fn("CloudflareMemoryClient.make")(function* <
186
182
  * exact-key authority and active document scopes; source-dependent provenance policy remains
187
183
  * application-owned. No extraction, job draining, embedding, discovery or rendering occurs.
188
184
  */
189
- const get = Effect.fn("CloudflareMemoryClient.get")(function* (key: MemoryKey<Namespace>) {
185
+ const get = Effect.fnUntraced(function* (key: MemoryKey<Namespace>) {
190
186
  const decodedKey = yield* Schema.decodeUnknownEffect(MemoryKey.Wire)(key).pipe(
191
187
  Effect.mapError(() => MemoryRpcError.make({ reason: "protocol" })),
192
188
  );
@@ -225,12 +221,12 @@ const makeMemoryClient = Effect.fn("CloudflareMemoryClient.make")(function* <
225
221
  }).pipe((effect) => withinDeadline(effect, validated.timeoutMillis));
226
222
  });
227
223
 
228
- const revalidateSemantic = Effect.fn("CloudflareMemoryClient.revalidateSemantic")(function* (
229
- found: MemoryIndexSearch<Namespace>,
230
- profile: SemanticMemoryProfile,
231
- limits: SemanticCandidateLimits,
232
- ) {
233
- return yield* Effect.gen(function* () {
224
+ const revalidateSemantic = Effect.fnUntraced(
225
+ function* (
226
+ found: MemoryIndexSearch<Namespace>,
227
+ profile: SemanticMemoryProfile,
228
+ limits: SemanticCandidateLimits,
229
+ ) {
234
230
  const response = yield* call({
235
231
  _tag: "RevalidateSemantic",
236
232
  version: 1,
@@ -245,8 +241,9 @@ const makeMemoryClient = Effect.fn("CloudflareMemoryClient.make")(function* <
245
241
  if (response._tag !== "Semantic") return yield* MemoryRpcError.make({ reason: "protocol" });
246
242
 
247
243
  return response.result;
248
- }).pipe((effect) => withinDeadline(effect, validated.timeoutMillis));
249
- });
244
+ },
245
+ (effect) => withinDeadline(effect, validated.timeoutMillis),
246
+ );
250
247
 
251
248
  /**
252
249
  * Revalidate in one owner RPC, then render whole passages within the caller's budget.
@@ -255,17 +252,16 @@ const makeMemoryClient = Effect.fn("CloudflareMemoryClient.make")(function* <
255
252
  * The single outcome has sourceId "memory". No embedding or candidate search is performed.
256
253
  * Use revalidate with Memory.recall for multiple readers sharing one output budget.
257
254
  */
258
- const recall = Effect.fn("CloudflareMemoryClient.recall")(function* (
255
+ const recall = (
259
256
  lookup: MemoryLookup,
260
257
  limits: MemoryRecallLimits,
261
258
  estimateTokens?: (text: string) => number,
262
- ) {
263
- return yield* Memory.recall(
259
+ ) =>
260
+ Memory.recall(
264
261
  [{ id: "memory", essential: true, read: revalidate(lookup, limits) }],
265
262
  limits,
266
263
  estimateTokens,
267
264
  );
268
- });
269
265
 
270
266
  return { get, recall, revalidate, revalidateSemantic, change };
271
267
  });
@@ -274,20 +270,17 @@ export const CloudflareMemoryClient = {
274
270
  /** Bind access and principal using the MemoryObjectNamespace supplied by the application. */
275
271
  make: makeMemoryClient,
276
272
  /** Use a resolved Worker or Durable Object binding without manual service provisioning. */
277
- fromBinding: Effect.fn("CloudflareMemoryClient.fromBinding")(function* <
278
- Namespace extends MemoryNamespace.Any,
279
- >(
273
+ fromBinding: <Namespace extends MemoryNamespace.Any>(
280
274
  binding: DurableObjectNamespace<MemoryObjectRpc>,
281
275
  options: {
282
276
  readonly access: MemoryAccess<Namespace>;
283
277
  readonly principal: Principal;
284
278
  readonly rpcLimits?: MemoryRpcLimits;
285
279
  },
286
- ) {
287
- return yield* makeMemoryClient(options.access, options.principal, options.rpcLimits).pipe(
280
+ ) =>
281
+ makeMemoryClient(options.access, options.principal, options.rpcLimits).pipe(
288
282
  Effect.provideService(MemoryObjectNamespace, { namespace: binding }),
289
- );
290
- }),
283
+ ),
291
284
  };
292
285
 
293
286
  /**
@@ -1,4 +1,3 @@
1
- import { BrowserCrypto } from "@effect/platform-browser";
2
1
  import { SqliteClient } from "@effect/sql-sqlite-do";
3
2
  import {
4
3
  DoScheduleAlarmControl,
@@ -47,6 +46,7 @@ import {
47
46
 
48
47
  import type { ThreadObjectNamespace } from "./CloudflareBindings.ts";
49
48
  import { CloudflareThreadClient } from "./CloudflareThreadClient.ts";
49
+ import { cloudflareCryptoLayer } from "./internal/crypto.ts";
50
50
  import {
51
51
  cloudflarePreparedInputAdmissionLayer,
52
52
  cloudflareScheduledInputAdmissionLayer,
@@ -189,7 +189,7 @@ export class CloudflareSchedulingClient {
189
189
  Effect.gen(function* () {
190
190
  const { namespace } = yield* ScheduleOwnerNamespace;
191
191
 
192
- const call = Effect.fn("CloudflareSchedulingClient.call")(function* (
192
+ const call = Effect.fnUntraced(function* (
193
193
  owner: ScheduleOwner,
194
194
  request: ScheduleOwnerRequest,
195
195
  ): Effect.fn.Return<ScheduleOwnerResponse, ScheduleManagementFailure> {
@@ -234,9 +234,7 @@ export class CloudflareSchedulingClient {
234
234
  : response.failure;
235
235
  });
236
236
 
237
- const encodeInput = Effect.fn("CloudflareSchedulingClient.encodeInput")(function* <
238
- InputSchema extends Schema.Top,
239
- >(
237
+ const encodeInput = Effect.fnUntraced(function* <InputSchema extends Schema.Top>(
240
238
  agent: DurableSubmitAgent<InputSchema>,
241
239
  input: InputSchema["Type"],
242
240
  ): Effect.fn.Return<PersistedJson, ScheduleValidationError, InputSchema["EncodingServices"]> {
@@ -392,7 +390,7 @@ export class ScheduleOwnerIdentity extends Context.Service<
392
390
  { readonly owner: ScheduleOwner }
393
391
  >()("@effect-agent/platform-cloudflare/ScheduleOwnerIdentity") {}
394
392
 
395
- const decodeOwnerName = Effect.fn("decodeScheduleOwnerName")(function* (
393
+ const decodeOwnerName = Effect.fnUntraced(function* (
396
394
  name: string | null | undefined,
397
395
  ): Effect.fn.Return<ScheduleOwner, ScheduleOwnerProtocolError> {
398
396
  if (name === null || name === undefined) {
@@ -508,7 +506,7 @@ const ensureOwner = (
508
506
  );
509
507
  };
510
508
 
511
- const handleScheduleRequest = Effect.fn("ScheduleOwner.handleRequest")(function* (
509
+ const handleScheduleRequest = Effect.fnUntraced(function* (
512
510
  encoded: unknown,
513
511
  ): Effect.fn.Return<unknown, never, Scheduling | ScheduleOwnerIdentity> {
514
512
  const decoded = yield* decodeScheduleOwnerRequest(encoded).pipe(Effect.result);
@@ -706,7 +704,7 @@ export const makeScheduleOwnerObjectClass = <E>(
706
704
  ),
707
705
  ),
708
706
  Layer.provide(ScheduleWakeNoop),
709
- Layer.provide(BrowserCrypto.layer),
707
+ Layer.provide(cloudflareCryptoLayer),
710
708
  Layer.provideMerge(DurableObjectAlarm.DurableObjectAlarm.layer),
711
709
  Layer.provide(host),
712
710
  Layer.provideMerge(ownerLayer),
@@ -729,17 +727,11 @@ export const makeScheduleOwnerObjectClass = <E>(
729
727
  schedule: (encoded: unknown) => handleScheduleRequest(encoded),
730
728
  } satisfies EffectCfDurableObject.DurableObjectRpc<ScheduleRuntimeServices>;
731
729
 
732
- const Base = EffectCfDurableObject.make(runtime, {
730
+ const ScheduleOwnerObject = EffectCfDurableObject.make(runtime, {
733
731
  initialize: Effect.void,
734
732
  rpc,
735
733
  alarms: scheduleAlarmHandler(limits),
736
734
  });
737
735
 
738
- class ScheduleOwnerObject extends Base {
739
- override alarm(alarmInfo?: AlarmInvocationInfo): Promise<void> | void {
740
- return super.alarm?.(alarmInfo);
741
- }
742
- }
743
-
744
736
  return ScheduleOwnerObject;
745
737
  };
@@ -1,4 +1,3 @@
1
- import { BrowserCrypto } from "@effect/platform-browser";
2
1
  import { SqliteClient } from "@effect/sql-sqlite-do";
3
2
  import {
4
3
  DoSubscriptionAlarmControl,
@@ -41,6 +40,7 @@ import {
41
40
 
42
41
  import { type ThreadObjectNamespace } from "./CloudflareBindings.ts";
43
42
  import { CloudflareThreadClient } from "./CloudflareThreadClient.ts";
43
+ import { cloudflareCryptoLayer } from "./internal/crypto.ts";
44
44
  import { cloudflarePreparedInputAdmissionLayer } from "./internal/prepared-admission.ts";
45
45
 
46
46
  const SUBSCRIPTION_ALARM_TAG = "effect-agent/SubscriptionPartitionWake";
@@ -90,9 +90,10 @@ export const SubscriptionPartitionAlarmExtension = Context.Reference<{
90
90
  * Callback failures stay typed. Defects and interruption reach the native alarm multiplexer.
91
91
  * The host owns durable idempotency, prearming and external-effect uncertainty.
92
92
  */
93
- export const makeSubscriptionPartitionAlarmHandler = Effect.fn(
94
- "makeSubscriptionPartitionAlarmHandler",
95
- )(function* <Payload extends Schema.Top, R>(options: {
93
+ export const makeSubscriptionPartitionAlarmHandler = Effect.fnUntraced(function* <
94
+ Payload extends Schema.Top,
95
+ R,
96
+ >(options: {
96
97
  readonly tag: string;
97
98
  readonly payload: Payload;
98
99
  readonly timeoutMillis: number;
@@ -367,7 +368,7 @@ export class CloudflareSubscriptionsClient {
367
368
  Effect.gen(function* () {
368
369
  const { namespace } = yield* SubscriptionPartitionNamespace;
369
370
 
370
- const call = Effect.fn("CloudflareSubscriptionsClient.call")(function* (
371
+ const call = Effect.fnUntraced(function* (
371
372
  addressedPartition: SourcePartition,
372
373
  request: SubscriptionPartitionRequest,
373
374
  ) {
@@ -402,7 +403,7 @@ export class CloudflareSubscriptionsClient {
402
403
  const asProtocolError = (): SubscriptionError =>
403
404
  corruptFailure("subscription-partition-protocol");
404
405
 
405
- const changeState = Effect.fn("CloudflareSubscriptions.changeState")(function* (
406
+ const changeState = Effect.fnUntraced(function* (
406
407
  scope: typeof SubscriptionScope.Type,
407
408
  key: typeof SubscriptionKey.Type,
408
409
  expectedRevision: number,
@@ -620,9 +621,7 @@ export class SubscriptionPartitionIdentity extends Context.Service<
620
621
  { readonly partition: SourcePartition }
621
622
  >()("@effect-agent/platform-cloudflare/SubscriptionPartitionIdentity") {}
622
623
 
623
- const decodePartitionName = Effect.fn("decodeSubscriptionPartitionName")(function* (
624
- name: string | null | undefined,
625
- ) {
624
+ const decodePartitionName = Effect.fnUntraced(function* (name: string | null | undefined) {
626
625
  if (name === null || name === undefined) {
627
626
  return yield* SubscriptionPartitionProtocolError.make({
628
627
  message: "Subscription Partition objects require an idFromName identity",
@@ -658,9 +657,7 @@ const requestPartition = (request: SubscriptionPartitionRequest): SourcePartitio
658
657
  ? request.partition
659
658
  : request.scope.partition;
660
659
 
661
- const handleRequest = Effect.fn("SubscriptionPartition.handleRequest")(function* (
662
- encoded: unknown,
663
- ) {
660
+ const handleRequest = Effect.fnUntraced(function* (encoded: unknown) {
664
661
  const decoded = yield* decodeRequest(encoded).pipe(Effect.result);
665
662
 
666
663
  if (decoded._tag === "Failure") {
@@ -1001,7 +998,7 @@ export const makeSubscriptionPartitionObjectClass = <E>(
1001
998
  Layer.provide(
1002
999
  cloudflarePreparedInputAdmissionLayer.pipe(Layer.provide(CloudflareThreadClient.layer)),
1003
1000
  ),
1004
- Layer.provide(BrowserCrypto.layer),
1001
+ Layer.provide(cloudflareCryptoLayer),
1005
1002
  Layer.provideMerge(DurableObjectAlarm.DurableObjectAlarm.layer),
1006
1003
  Layer.provide(host),
1007
1004
  Layer.provideMerge(identityLayer),
@@ -1028,17 +1025,11 @@ export const makeSubscriptionPartitionObjectClass = <E>(
1028
1025
  subscription: (encoded: unknown) => handleRequest(encoded),
1029
1026
  } satisfies EffectCfDurableObject.DurableObjectRpc<SubscriptionRuntimeServices>;
1030
1027
 
1031
- const Base = EffectCfDurableObject.make(runtime, {
1028
+ const SubscriptionPartitionObject = EffectCfDurableObject.make(runtime, {
1032
1029
  initialize: Effect.void,
1033
1030
  rpc,
1034
1031
  alarms: alarmHandler(limits),
1035
1032
  });
1036
1033
 
1037
- class SubscriptionPartitionObject extends Base {
1038
- override alarm(alarmInfo?: AlarmInvocationInfo): Promise<void> | void {
1039
- return super.alarm?.(alarmInfo);
1040
- }
1041
- }
1042
-
1043
1034
  return SubscriptionPartitionObject;
1044
1035
  };