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

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 (46) hide show
  1. package/dist/bindings-BrVEOkfe.d.mts +102 -0
  2. package/dist/browser-quick-action.d.mts +18 -1
  3. package/dist/browser-quick-action.mjs +14 -1
  4. package/dist/browser-quick-action.mjs.map +1 -1
  5. package/dist/browser-rest-capture.d.mts +17 -2
  6. package/dist/browser-rest-capture.mjs +12 -1
  7. package/dist/browser-rest-capture.mjs.map +1 -1
  8. package/dist/browser-rest-crawl.mjs +2 -2
  9. package/dist/browser-rest-crawl.mjs.map +1 -1
  10. package/dist/index.d.mts +245 -237
  11. package/dist/index.mjs +168 -164
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/interactive-browser.d.mts +160 -2
  14. package/dist/interactive-browser.mjs +1166 -2
  15. package/dist/interactive-browser.mjs.map +1 -0
  16. package/dist/{scheduling-B-OFqoS9.mjs → prepared-admission-BKp_Upw2.mjs} +134 -433
  17. package/dist/prepared-admission-BKp_Upw2.mjs.map +1 -0
  18. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  19. package/dist/scheduling.d.mts +47 -2
  20. package/dist/scheduling.mjs +339 -1
  21. package/dist/scheduling.mjs.map +1 -0
  22. package/dist/subscriptions.d.mts +52 -0
  23. package/dist/subscriptions.mjs +346 -0
  24. package/dist/subscriptions.mjs.map +1 -0
  25. package/package.json +20 -13
  26. package/src/alarm.ts +264 -265
  27. package/src/bindings.ts +34 -30
  28. package/src/browser-quick-action.ts +31 -0
  29. package/src/browser-rest-capture.ts +27 -0
  30. package/src/client.ts +111 -105
  31. package/src/code-mode-executor.ts +19 -0
  32. package/src/config.ts +7 -7
  33. package/src/index.ts +10 -11
  34. package/src/interactive-browser.ts +29 -1
  35. package/src/layers.ts +178 -257
  36. package/src/prepared-admission.ts +90 -0
  37. package/src/scheduling.ts +19 -55
  38. package/src/subscriptions.ts +661 -0
  39. package/src/{conversation-object.ts → thread-object.ts} +167 -136
  40. package/src/transport.ts +15 -15
  41. package/src/wake-scheduler.ts +17 -22
  42. package/dist/interactive-browser-BRo-Bfvb.d.mts +0 -144
  43. package/dist/interactive-browser-Cy5q-ldl.mjs +0 -1154
  44. package/dist/interactive-browser-Cy5q-ldl.mjs.map +0 -1
  45. package/dist/scheduling-B-OFqoS9.mjs.map +0 -1
  46. package/dist/scheduling-BJs_kHTx.d.mts +0 -142
package/dist/index.d.mts CHANGED
@@ -1,13 +1,12 @@
1
- import { BrowserQuickActionBrowserBinding, BrowserQuickActionCaptureOptions, BrowserQuickActionClient, BrowserQuickActionRpcError, BrowserQuickActionWorkersAi, BrowserQuickActionWorkersAiPolicy, BrowserQuickActionWorkersAiPolicyError, browserQuickActionCaptureLayer, browserQuickActionImplementation, browserQuickActionScreenshotLayer, browserQuickActionWorkersAiCaptureLayer } from "./browser-quick-action.mjs";
2
- import { BrowserRestCaptureOptions, browserRestCaptureImplementation, browserRestCaptureLayer, browserRestWorkersAiCaptureLayer } from "./browser-rest-capture.mjs";
3
- import { BrowserRestCrawlOptions, browserRestCrawlImplementation, browserRestCrawlLayer } from "./browser-rest-crawl.mjs";
4
- import { a as ScheduleOwnerObjectClass, c as ScheduleOwnerProtocolError, d as ConversationObjectIdentity, f as ConversationObjectNamespace, g as conversationNamespaceLayer, h as conversationNamespaceFromEnv, i as ScheduleOwnerNamespace, l as makeScheduleOwnerObjectClass, m as DurableObjectContext, n as ScheduleAlarmProtocolError, o as ScheduleOwnerObjectInstance, p as ConversationObjectRpc, r as ScheduleOwnerIdentity, s as ScheduleOwnerObjectRpc, t as CloudflareSchedulingClient, u as CloudflareBindingError } from "./scheduling-BJs_kHTx.mjs";
5
- import { S as BrowserRunSessionLifecycle, _ as browserRunInteractiveHostLayer, a as BrowserRunInteractiveBinding, b as isBrowserRunUndispatchedActionError, c as BrowserRunInteractiveContext, d as BrowserRunInteractiveRequest, f as BrowserRunInteractiveRequestListener, g as BrowserRunViewport, h as BrowserRunLiveViewResult, i as BrowserRunHandoffState, l as BrowserRunInteractiveHost, m as BrowserRunLiveViewRequest, n as BrowserRunHandoffRequest, o as BrowserRunInteractiveBrowser, p as BrowserRunInteractiveSession, r as BrowserRunHandoffResult, s as BrowserRunInteractiveCdpSession, t as BrowserRunCloudflareCommand, u as BrowserRunInteractivePage, v as browserRunInteractiveImplementation, x as BrowserRunCleanupError, y as browserRunInteractiveLayer } from "./interactive-browser-BRo-Bfvb.mjs";
1
+ import { CloudflareBrowser, CloudflareBrowserOptions } from "./browser-quick-action.mjs";
2
+ import { a as ThreadObjectRpc, i as ThreadObjectNamespace, n as DurableObjectContext, o as threadNamespaceFromEnv, r as ThreadObjectIdentity, s as threadNamespaceLayer, t as CloudflareBindingError } from "./bindings-BrVEOkfe.mjs";
3
+ import { CloudflareSchedulingClient, ScheduleAlarmProtocolError, ScheduleOwnerIdentity, ScheduleOwnerNamespace, ScheduleOwnerObjectClass, ScheduleOwnerObjectInstance, ScheduleOwnerObjectRpc, ScheduleOwnerProtocolError, makeScheduleOwnerObjectClass } from "./scheduling.mjs";
4
+ import { CloudflareSubscriptionConfigError, CloudflareSubscriptionsClient, SubscriptionAlarmProtocolError, SubscriptionPartitionIdentity, SubscriptionPartitionNamespace, SubscriptionPartitionObjectClass, SubscriptionPartitionObjectInstance, SubscriptionPartitionObjectRpc, SubscriptionPartitionProtocolError, makeSubscriptionPartitionObjectClass, sourcePartitionName, validateCloudflareSubscriptionLimits } from "./subscriptions.mjs";
6
5
  import { Context, Crypto, Effect, Layer, Option, Schema, Scope } from "effect";
7
- import { AbortCommand, AbortIntent, AdmissionConflict, AgentBindingResolver, AppendConflict, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, CanonicalRecordEnvelope, CanonicalSequence, ConversationNotMaterialized, ConversationStore, ConversationStoreError, DefinitionDigests, DigestError, DurableAgentRuntime, DurableBindingFailure, DurableRuntimeConfig, DurableRuntimeFailpointError, DurableRuntimeFailpointHandler, DurableSubmitAgent, DurableSubmitOptions, DurableWorkerFailure, FenceRejected, IntegrityReport, JoinedToHost, LedgerError, ObligationReport, ObligationThresholds, OperationAuthorizerService, OperationDenied, OwnershipLost, ProducerId, Receipt, RecoveryExplanation, RecoveryReport, ResolvedBinding, RetryCommand, RetryRefused, RunJournalError, Settlement, SettlementConflict, SubmissionLedger, ToolReconciler, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, WakeScheduler } from "@effect-agent/session";
8
- import { ConversationPortTransport, DoStorageFailpointHandler, DoStorageInitializationError, PortRequest, PortResponse } from "@effect-agent/storage-cloudflare";
9
- import { AgentInputError, ConversationId } from "@effect-agent/core";
10
- import { RunContextPreparation, RunCostEstimator, RunToolFailureObserver } from "@effect-agent/engine";
6
+ import { DoStorageFailpoint, DoStorageFailpointHandler, DoStorageInitializationError, PortRequest, PortResponse, ThreadPortTransport } from "@effect-agent/storage-cloudflare";
7
+ import { AbortCommand, AbortIntent, AdmissionConflict, AgentRegistration, AppendConflict, ApprovalConflict, ApprovalDecisionCommand, ApprovalDecisionIntent, CanonicalRecordEnvelope, CanonicalSequence, DefinitionDigests, DigestError, DurableAgentRuntime, DurableBindingFailure, DurableRuntimeConfig, DurableRuntimeFailpoint, DurableRuntimeFailpointError, DurableRuntimeFailpointHandler, DurableSubmitAgent, DurableSubmitOptions, DurableWorkerFailure, FenceRejected, IntegrityReport, JoinedToHost, LedgerError, ObligationReport, ObligationThresholds, OperationAuthorizerService, OperationDenied, OwnershipLost, PreparedInputAdmission, Receipt, RecoveryExplanation, RecoveryReport, ResolvedBinding, RetryCommand, RetryRefused, RunJournalError, ScheduledInputAdmission, Settlement, SettlementConflict, SubmissionLedger, ThreadNotMaterialized, ThreadStore, ThreadStoreError, ToolReconciler, UnknownResolutionCommand, UnknownResolutionConflict, UnknownResolutionIntent, WakeScheduler } from "@effect-agent/thread";
8
+ import { AgentInputError, ThreadId } from "@effect-agent/core";
9
+ import { RunContextPreparation, RunCostEstimator, RunToolAuthorization, RunToolFailureObserver } from "@effect-agent/engine";
11
10
  import { DurableObject, DurableObjectState as DurableObjectState$1, WorkerEnvironment } from "effect-cf";
12
11
  import { CodeExecutor, SandboxImplementation } from "@effect-agent/sandbox";
13
12
  //#region src/config.d.ts
@@ -27,7 +26,7 @@ declare const AdmissionLimitExceeded_base: Schema.Class<AdmissionLimitExceeded,
27
26
  * (deployment spec §8, DEPLOY-007: "Admission has explicit bounded quota and overload
28
27
  * behavior... a typed rejection"). This is the DC analogue of `NodeDurableHost`'s
29
28
  * `AdmissionClosed` host gate: the port surface stays untouched, the refusal happens in the
30
- * Conversation Object's submit entry point before `DurableAgentRuntime.submit` runs, and
29
+ * Thread Object's submit entry point before `DurableAgentRuntime.submit` runs, and
31
30
  * nothing was admitted or written.
32
31
  */
33
32
  declare class AdmissionLimitExceeded extends AdmissionLimitExceeded_base {
@@ -38,7 +37,7 @@ declare const CLOUDFLARE_DATABASE_CAP_BYTES = 10000000000;
38
37
  /** Default database-size admission ceiling: a 1 GB safety margin under the platform cap. */
39
38
  declare const DEFAULT_MAX_DATABASE_BYTES = 9000000000;
40
39
  declare const CloudflareAdmissionLimitsValue_base: Schema.Class<CloudflareAdmissionLimitsValue, Schema.Struct<{
41
- /** Maximum nonterminal Submissions per Conversation lane before new admissions refuse. */
40
+ /** Maximum nonterminal Submissions per Thread lane before new admissions refuse. */
42
41
  readonly maxQueueDepthPerLane: Schema.Int;
43
42
  /** Maximum encoded input bytes; never above the storage per-value bound. */
44
43
  readonly maxInputBytes: Schema.Int;
@@ -46,13 +45,13 @@ declare const CloudflareAdmissionLimitsValue_base: Schema.Class<CloudflareAdmiss
46
45
  readonly maxDatabaseBytes: Schema.Int;
47
46
  }>, {}>;
48
47
  /**
49
- * Explicit bounded admission quotas checked by the Conversation Object BEFORE admission
48
+ * Explicit bounded admission quotas checked by the Thread Object BEFORE admission
50
49
  * (exit gate "resource limits are checked before admission").
51
50
  */
52
51
  declare class CloudflareAdmissionLimitsValue extends CloudflareAdmissionLimitsValue_base {}
53
52
  declare const CloudflareDurableRuntimeConfigValue_base: Schema.Class<CloudflareDurableRuntimeConfigValue, Schema.Struct<{
54
- readonly deploymentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/session/DeploymentId">;
55
- /** Head of the minted producer identity `{producerPrefix}:{conversationId}`. */
53
+ readonly deploymentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/DeploymentId">;
54
+ /** Head of the minted producer identity `{producerPrefix}:{threadId}`. */
56
55
  readonly producerPrefix: Schema.NonEmptyString;
57
56
  /** Submission ownership lease duration (D5); fences work across Object incarnations. */
58
57
  readonly ownershipLeaseDuration: Schema.Int;
@@ -81,7 +80,7 @@ declare const CloudflareDurableRuntimeConfigValue_base: Schema.Class<CloudflareD
81
80
  }>, {}>;
82
81
  /**
83
82
  * Validated Cloudflare durable runtime configuration. The producer identity of one
84
- * Conversation Object is `{producerPrefix}:{conversationId}` — stable across incarnations of
83
+ * Thread Object is `{producerPrefix}:{threadId}` — stable across incarnations of
85
84
  * the same deployment, distinct across deployments — and producer-epoch fencing (not the
86
85
  * producer name) remains the correctness authority (DUR-006).
87
86
  */
@@ -89,7 +88,7 @@ declare class CloudflareDurableRuntimeConfigValue extends CloudflareDurableRunti
89
88
  declare const CloudflareDurableRuntimeConfig_base: Context.ServiceClass<CloudflareDurableRuntimeConfig, "@effect-agent/platform-cloudflare/CloudflareDurableRuntimeConfig", CloudflareDurableRuntimeConfigValue>;
90
89
  /** Explicit configuration authority for the assembled Cloudflare durable runtime. */
91
90
  declare class CloudflareDurableRuntimeConfig extends CloudflareDurableRuntimeConfig_base {}
92
- /** Documented production defaults applied by `CloudflareDurableRuntime.layer`. */
91
+ /** Documented production defaults applied by `ThreadObject.layer`. */
93
92
  declare const CLOUDFLARE_RUNTIME_DEFAULTS: {
94
93
  readonly ownershipLeaseDuration: number;
95
94
  readonly alarmBackoffBase: 100;
@@ -173,17 +172,17 @@ declare const MaintenancePassReport_base: Schema.Class<MaintenancePassReport, Sc
173
172
  /** What one maintenance pass did — auditable evidence mirroring `NodeDurableHost`'s report. */
174
173
  declare class MaintenancePassReport extends MaintenancePassReport_base {}
175
174
  /** Fault boundaries around every maintenance-owned durable mutation. */
176
- type ConversationMaintenanceFailpointLocation = "maintenance:dirty:before" | "maintenance:dirty:after" | "maintenance:mutation:armed" | "maintenance:mutation:finished" | "maintenance:ensure:before" | "maintenance:ensure:after" | "maintenance:begin:before" | "maintenance:begin:after" | "maintenance:finish:before" | "maintenance:finish:after";
177
- type ConversationMaintenanceFailpointHandler = (location: ConversationMaintenanceFailpointLocation) => Effect.Effect<void>;
178
- declare const ConversationMaintenanceFailpoint_base: Context.ServiceClass<ConversationMaintenanceFailpoint, "@effect-agent/platform-cloudflare/ConversationMaintenanceFailpoint", {
179
- readonly hit: ConversationMaintenanceFailpointHandler;
175
+ type ThreadMaintenanceFailpointLocation = "maintenance:dirty:before" | "maintenance:dirty:after" | "maintenance:mutation:armed" | "maintenance:mutation:finished" | "maintenance:ensure:before" | "maintenance:ensure:after" | "maintenance:begin:before" | "maintenance:begin:after" | "maintenance:finish:before" | "maintenance:finish:after";
176
+ type ThreadMaintenanceFailpointHandler = (location: ThreadMaintenanceFailpointLocation) => Effect.Effect<void>;
177
+ declare const ThreadMaintenanceFailpoint_base: Context.ServiceClass<ThreadMaintenanceFailpoint, "@effect-agent/platform-cloudflare/ThreadMaintenanceFailpoint", {
178
+ readonly hit: ThreadMaintenanceFailpointHandler;
180
179
  }>;
181
180
  /** Test-only fault authority; production uses the inert layer. */
182
- declare class ConversationMaintenanceFailpoint extends ConversationMaintenanceFailpoint_base {
183
- static readonly layer: Layer.Layer<ConversationMaintenanceFailpoint, never, never>;
181
+ declare class ThreadMaintenanceFailpoint extends ThreadMaintenanceFailpoint_base {
182
+ static readonly layer: Layer.Layer<ThreadMaintenanceFailpoint, never, never>;
184
183
  }
185
184
  type MaintenancePassFailure = DurableWorkerFailure | DurableBindingFailure | DurableAlarmError;
186
- declare const ConversationMaintenance_base: Context.ServiceClass<ConversationMaintenance, "@effect-agent/platform-cloudflare/ConversationMaintenance", {
185
+ declare const ThreadMaintenance_base: Context.ServiceClass<ThreadMaintenance, "@effect-agent/platform-cloudflare/ThreadMaintenance", {
187
186
  /** One idempotent maintenance pass; failures propagate so workerd retries the alarm. */
188
187
  readonly pass: Effect.Effect<MaintenancePassReport, MaintenancePassFailure>;
189
188
  /**
@@ -211,8 +210,8 @@ declare const ConversationMaintenance_base: Context.ServiceClass<ConversationMai
211
210
  * 4. Stable external waits acknowledge and clear. Autonomous retry, indeterminate, and lease
212
211
  * recovery states leave their generation dirty and retain bounded backoff rearming.
213
212
  */
214
- declare class ConversationMaintenance extends ConversationMaintenance_base {
215
- static readonly layer: Layer.Layer<ConversationMaintenance, never, DurableAgentRuntime | AgentBindingResolver | SubmissionLedger | DurableAlarmService | ConversationMaintenanceFailpoint | CloudflareDurableRuntimeConfig | ConversationObjectIdentity | DurableObjectContext>;
213
+ declare class ThreadMaintenance extends ThreadMaintenance_base {
214
+ static readonly layer: (bindings: ReadonlyArray<ResolvedBinding>) => Layer.Layer<ThreadMaintenance, never, DurableAgentRuntime | SubmissionLedger | DurableAlarmService | ThreadMaintenanceFailpoint | CloudflareDurableRuntimeConfig | ThreadObjectIdentity | DurableObjectContext>;
216
215
  }
217
216
  //#endregion
218
217
  //#region src/wake-scheduler.d.ts
@@ -228,7 +227,7 @@ declare class ConversationMaintenance extends ConversationMaintenance_base {
228
227
  * subscription accelerates waiters within one incarnation and the settlement poll interval
229
228
  * is the correctness path.
230
229
  */
231
- declare const cloudflareWakeSchedulerLayer: Layer.Layer<WakeScheduler, never, DurableAlarmService | ConversationObjectIdentity | ConversationObjectNamespace>;
230
+ declare const cloudflareWakeSchedulerLayer: Layer.Layer<WakeScheduler, never, DurableAlarmService | ThreadObjectIdentity | ThreadObjectNamespace>;
232
231
  //#endregion
233
232
  //#region src/progress-wait.d.ts
234
233
  declare const ProgressWaitRegistry_base: Context.ServiceClass<ProgressWaitRegistry, "@effect-agent/platform-cloudflare/ProgressWaitRegistry", {
@@ -248,9 +247,9 @@ declare class ProgressWaitRegistry extends ProgressWaitRegistry_base {
248
247
  //#endregion
249
248
  //#region src/transport.d.ts
250
249
  /**
251
- * `ConversationPortTransport` over native Durable Object JS RPC (decision D-P6-3): one
252
- * `portCall(envelope)` on the stub of the Object that owns the addressed Conversation
253
- * (`namespace.idFromName(conversationId)` — the identity rule, plan §1.2). The envelopes are
250
+ * `ThreadPortTransport` over native Durable Object JS RPC (decision D-P6-3): one
251
+ * `portCall(envelope)` on the stub of the Object that owns the addressed Thread
252
+ * (`namespace.idFromName(threadId)` — the identity rule, plan §1.2). The envelopes are
254
253
  * already Schema-encoded JSON, so the RPC boundary carries only structured-cloneable values;
255
254
  * the protocol module stays transport-agnostic and fetch-with-JSON remains the documented
256
255
  * fallback carrier.
@@ -260,18 +259,18 @@ declare class ProgressWaitRegistry extends ProgressWaitRegistry_base {
260
259
  * when present) and NEVER as a fabricated answer: on `resolveAdmission` the routing layer
261
260
  * turns exactly this error into `AdmissionIndeterminate` (SUB-031).
262
261
  */
263
- declare const conversationPortTransportLayer: Layer.Layer<ConversationPortTransport, never, ConversationObjectNamespace>;
262
+ declare const threadPortTransportLayer: Layer.Layer<ThreadPortTransport, never, ThreadObjectNamespace>;
264
263
  //#endregion
265
264
  //#region src/layers.d.ts
266
265
  /**
267
- * Raw (unvalidated) construction options for `CloudflareDurableRuntime.layer`, mirroring
266
+ * Raw (unvalidated) construction options for `ThreadObject.make`, mirroring
268
267
  * `NodeDurableRuntimeOptions`. Optional fields default to the documented production values
269
268
  * (`CLOUDFLARE_RUNTIME_DEFAULTS`); everything is schema-decoded into
270
269
  * `CloudflareDurableRuntimeConfigValue` before any resource opens (deployment §5 gate 1).
271
270
  */
272
271
  interface CloudflareDurableRuntimeOptions {
273
272
  readonly deploymentId: string;
274
- /** Head of the minted producer identity `{producerPrefix}:{conversationId}`. */
273
+ /** Head of the minted producer identity `{producerPrefix}:{threadId}`. */
275
274
  readonly producerPrefix: string;
276
275
  /** Milliseconds; default 30s (D5). */
277
276
  readonly ownershipLeaseDuration?: number | undefined;
@@ -311,8 +310,8 @@ interface CloudflareDurableRuntimeOptions {
311
310
  readonly storageFailpoint?: ((ctx: DurableObjectState) => DoStorageFailpointHandler) | undefined;
312
311
  /** Coordinator fault injection (`submit:*` / `terminalize:*` locations); default none. */
313
312
  readonly runtimeFailpoint?: ((ctx: DurableObjectState) => DurableRuntimeFailpointHandler) | undefined;
314
- /** Conversation-maintenance generation/alarm fault injection; default none. */
315
- readonly maintenanceFailpoint?: ((ctx: DurableObjectState) => ConversationMaintenanceFailpointHandler) | undefined;
313
+ /** Thread-maintenance generation/alarm fault injection; default none. */
314
+ readonly maintenanceFailpoint?: ((ctx: DurableObjectState) => ThreadMaintenanceFailpointHandler) | undefined;
316
315
  /** Host-supplied fail-closed authorization policy; defaults to service possession. */
317
316
  readonly operationAuthorizer?: OperationAuthorizerService | undefined;
318
317
  /**
@@ -321,42 +320,14 @@ interface CloudflareDurableRuntimeOptions {
321
320
  * `ToolReconciler.uncertain`.
322
321
  */
323
322
  readonly toolReconciler?: Layer.Layer<ToolReconciler> | undefined;
324
- /**
325
- * Registered worker Bindings resolved at durable claim time:
326
- * build each with `DurableWorkerBinding.make(binding, digests)`. The callback receives the live
327
- * Object context and derived identities and is evaluated once per incarnation during Layer
328
- * construction. Defaults to the empty registration (every resolved claim fails closed).
329
- */
330
- readonly bindings?: CloudflareBindingSource | undefined;
331
- /**
332
- * Generic Run context acquired with this Durable Object incarnation. It may prepare model
333
- * context and/or authorize exact model-declared application Tool Calls at action time. The
334
- * Layer may depend
335
- * only on `Crypto.Crypto`, which this platform supplies with `BrowserCrypto`; hosts must close
336
- * every application-specific service before passing it here. Default absent.
337
- */
338
- readonly runContext?: CloudflareRunContextSource | undefined;
339
- }
340
- /** Per-incarnation host values available to Effect-native runtime extension factories. */
341
- interface CloudflareRuntimeSourceContext {
342
- readonly ctx: DurableObjectState;
343
- readonly env: unknown;
344
- readonly conversationId: ConversationId;
345
- readonly producerId: ProducerId;
346
323
  }
347
- /** Per-incarnation host values available while registered worker Bindings are captured. */
348
- interface CloudflareBindingSourceContext extends CloudflareRuntimeSourceContext {}
349
- /** Captures registered worker Bindings once for each Durable Object incarnation. */
350
- type CloudflareBindingSource = (context: CloudflareBindingSourceContext) => Effect.Effect<ReadonlyArray<ResolvedBinding>, never, never>;
351
- /** A closed Run-context service whose only remaining requirement is platform Crypto. */
352
- type CloudflareRunContextLayer = Layer.Layer<RunContextPreparation, never, Crypto.Crypto>;
353
- /** One Layer or a per-incarnation factory over explicit Cloudflare host values. */
354
- type CloudflareRunContextSource = CloudflareRunContextLayer | ((context: CloudflareRuntimeSourceContext) => CloudflareRunContextLayer);
324
+ /** Services supplied before the application graph is built, including its dependencies. */
325
+ type CloudflareBootstrapServices = CloudflareDurableRuntimeConfig | ThreadObjectIdentity | DurableRuntimeConfig | Crypto.Crypto | DoStorageFailpoint | DurableRuntimeFailpoint | ThreadMaintenanceFailpoint | RunContextPreparation | RunToolAuthorization | ToolReconciler;
355
326
  /** Every construction failure of the assembled Cloudflare durable runtime stack. */
356
- type CloudflareDurableRuntimeInitializationError = CloudflarePlatformConfigError | DoStorageInitializationError;
357
- /** The services `CloudflareDurableRuntime.layer` provides. */
358
- type CloudflareDurableRuntimeServices = DurableAgentRuntime | SubmissionLedger | ConversationStore | WakeScheduler | DurableRuntimeConfig | AgentBindingResolver | CloudflareDurableRuntimeConfig | ConversationObjectIdentity | DurableAlarmService | ConversationMaintenance | ConversationObjectPorts | ProgressWaitRegistry;
359
- declare const ConversationObjectPorts_base: Context.ServiceClass<ConversationObjectPorts, "@effect-agent/platform-cloudflare/ConversationObjectPorts", {
327
+ type CloudflareDurableRuntimeInitializationError = CloudflarePlatformConfigError | DigestError | DoStorageInitializationError;
328
+ /** The services `ThreadObject.layer` provides. */
329
+ type CloudflareDurableRuntimeServices = DurableAgentRuntime | SubmissionLedger | ThreadStore | WakeScheduler | DurableAlarmService | ThreadMaintenance | ThreadObjectPorts | ProgressWaitRegistry;
330
+ declare const ThreadObjectPorts_base: Context.ServiceClass<ThreadObjectPorts, "@effect-agent/platform-cloudflare/ThreadObjectPorts", {
360
331
  readonly handle: (request: PortRequest) => Effect.Effect<PortResponse>;
361
332
  }>;
362
333
  /**
@@ -365,27 +336,20 @@ declare const ConversationObjectPorts_base: Context.ServiceClass<ConversationObj
365
336
  * request cannot bounce between Objects — and returns the typed response for the endpoint to
366
337
  * encode.
367
338
  */
368
- declare class ConversationObjectPorts extends ConversationObjectPorts_base {}
339
+ declare class ThreadObjectPorts extends ThreadObjectPorts_base {}
369
340
  /**
370
- * The DC Layer assembly (deployment §12: a Layer-assembly library, not an app entrypoint;
371
- * plan §1.4). `layer(options)` decodes the configuration, derives this Object's Conversation
372
- * and producer identities, opens the Object's private SQLite database through
373
- * `@effect/sql-sqlite-do` for BOTH the Conversation Log and the Submission Ledger (so claims
374
- * fence the same producer epochs — ADR-0011 D7 transposed), wraps the local port facets with
375
- * the WP2 cross-Object routing decorators over the Durable Object RPC transport, wires the
376
- * alarm-backed wake scheduler and the maintenance pass, defaults reconciliation to the
377
- * fail-closed `ToolReconciler.uncertain`, and provides a ready `DurableAgentRuntime` on top.
378
- *
379
- * Storage compatibility is verified during construction: an incompatible database fails the
380
- * Layer typed (`DoStorageCompatibilityError`) before anything is mutated (DEPLOY-008).
381
- *
382
- * Requires only the two binding services (`DurableObjectContext`,
383
- * `ConversationObjectNamespace`) — platform values enter exclusively through Layers
384
- * (DEPLOY-010).
341
+ * Validate deployment settings and derive services before building application dependencies.
342
+ * The native class factory builds this Layer inside its constructor gate. Custom Effect hosts
343
+ * can provide it around the complete application Layer with the native context already supplied.
385
344
  */
386
- declare class CloudflareDurableRuntime {
387
- static layer(options: CloudflareDurableRuntimeOptions): Layer.Layer<CloudflareDurableRuntimeServices, CloudflareDurableRuntimeInitializationError, DurableObjectContext | ConversationObjectNamespace>;
388
- }
345
+ declare const layerConfig: (options: CloudflareDurableRuntimeOptions) => Layer.Layer<CloudflareBootstrapServices, CloudflarePlatformConfigError, DurableObjectContext>;
346
+ /**
347
+ * Register typed Agents and version declarations. Hashing and dependency capture happen in
348
+ * this Layer's Scope, after application Layers have been provided. Every Agent's instruction,
349
+ * Tool, Schema, and model requirements remain visible until satisfied by Layer composition.
350
+ * Use Layer.unwrap for registration values that need effectful application setup.
351
+ */
352
+ declare const layer: <const Entries extends ReadonlyArray<AgentRegistration>>(registrations: Entries) => Layer.Layer<CloudflareDurableRuntimeServices, DigestError | DoStorageInitializationError, DurableObjectContext | ThreadObjectNamespace | Exclude<[Entries[number]] extends [never] ? never : Entries[number] extends (infer T) ? T extends Entries[number] ? T extends AgentRegistration<infer A extends import("@effect-agent/thread").ExecutableAgentBinding> ? import("@effect-agent/thread").DurableWorkerRequirements<A> : never : never : never, import("effect/Scope").Scope> | CloudflareBootstrapServices>;
389
353
  //#endregion
390
354
  //#region src/client.d.ts
391
355
  /** Truncate a diagnostic string to the host protocol's bounded length. */
@@ -398,8 +362,8 @@ declare const HostProtocolError_base: Schema.Class<HostProtocolError, Schema.Tag
398
362
  * response could not be encoded/decoded. Never carries operation semantics.
399
363
  */
400
364
  declare class HostProtocolError extends HostProtocolError_base {}
401
- declare const ConversationClientError_base: Schema.Class<ConversationClientError, Schema.TaggedStruct<"ConversationClientError", {
402
- readonly conversationId: Schema.String;
365
+ declare const ThreadClientError_base: Schema.Class<ThreadClientError, Schema.TaggedStruct<"ThreadClientError", {
366
+ readonly threadId: Schema.String;
403
367
  readonly message: Schema.String;
404
368
  readonly cause: Schema.optionalKey<Schema.Defect>;
405
369
  /** Cloudflare's own classification for a failure safe to retry with a fresh stub. */
@@ -408,11 +372,11 @@ declare const ConversationClientError_base: Schema.Class<ConversationClientError
408
372
  readonly overloaded: Schema.optionalKey<Schema.Boolean>;
409
373
  }>, import("effect/Cause").YieldableError>;
410
374
  /** The Worker-side stub call itself failed (RPC rejection, overload, eviction mid-call). */
411
- declare class ConversationClientError extends ConversationClientError_base {}
375
+ declare class ThreadClientError extends ThreadClientError_base {}
412
376
  declare const SubmitRequest_base: Schema.Class<SubmitRequest, Schema.Struct<{
413
377
  readonly agentId: Schema.brand<Schema.NonEmptyString, "@effect-agent/core/AgentId">;
414
- readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/session/Principal">;
415
- readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/session/IdempotencyKey">;
378
+ readonly principal: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/Principal">;
379
+ readonly idempotencyKey: Schema.brand<Schema.NonEmptyString, "@effect-agent/thread/IdempotencyKey">;
416
380
  readonly definitions: typeof DefinitionDigests;
417
381
  readonly inputPayload: Schema.declare<Schema.Json, Schema.Json>;
418
382
  }>, {}>;
@@ -420,17 +384,17 @@ declare const SubmitRequest_base: Schema.Class<SubmitRequest, Schema.Struct<{
420
384
  * One durable submission, input ALREADY encoded by the caller through the Agent Binding's
421
385
  * input schema (the Worker bundles the same Agent definitions as the Object, so schema
422
386
  * validation happens client-side; the resolved Binding re-validates at claim time). The
423
- * Conversation identity is deliberately absent — the addressed Object IS the lane.
387
+ * Thread identity is deliberately absent — the addressed Object IS the lane.
424
388
  */
425
389
  declare class SubmitRequest extends SubmitRequest_base {}
426
390
  declare const ObservePageRequest_base: Schema.Class<ObservePageRequest, Schema.Struct<{
427
- readonly afterSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/session/CanonicalSequence">>;
391
+ readonly afterSequence: Schema.optionalKey<Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">>;
428
392
  readonly limit: Schema.Int;
429
393
  }>, {}>;
430
394
  /** One bounded page of canonical records after an optional sequence. */
431
395
  declare class ObservePageRequest extends ObservePageRequest_base {}
432
396
  declare const AwaitProgressRequest_base: Schema.Class<AwaitProgressRequest, Schema.Struct<{
433
- readonly afterSequence: Schema.brand<Schema.Natural, "@effect-agent/session/CanonicalSequence">;
397
+ readonly afterSequence: Schema.brand<Schema.Natural, "@effect-agent/thread/CanonicalSequence">;
434
398
  readonly waiterId: Schema.String;
435
399
  }>, {}>;
436
400
  /** One event-driven wait for canonical progress strictly after this sequence. */
@@ -446,7 +410,7 @@ declare class CancelProgressRequest extends CancelProgressRequest_base {}
446
410
  * classes on the Worker side; `cause` chains travel as Schema defects without instance
447
411
  * fidelity (plan §2.8).
448
412
  */
449
- declare const HostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof OperationDenied, typeof HostProtocolError]>;
413
+ declare const HostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof OperationDenied, typeof HostProtocolError]>;
450
414
  type HostFailure = typeof HostFailure.Type;
451
415
  declare const SubmitSucceeded_base: Schema.Class<SubmitSucceeded, Schema.TaggedStruct<"SubmitSucceeded", {
452
416
  readonly receipt: typeof Receipt;
@@ -478,7 +442,7 @@ declare const UnknownResolutionRecorded_base: Schema.Class<UnknownResolutionReco
478
442
  }>, {}>;
479
443
  declare class UnknownResolutionRecorded extends UnknownResolutionRecorded_base {}
480
444
  declare const HostFailed_base: Schema.Class<HostFailed, Schema.TaggedStruct<"HostFailed", {
481
- readonly failure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof OperationDenied, typeof HostProtocolError]>;
445
+ readonly failure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof SettlementConflict, typeof ApprovalConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof OperationDenied, typeof HostProtocolError]>;
482
446
  }>, {}>;
483
447
  /** The entry point failed TYPED on the Object; the failure re-decodes verbatim. */
484
448
  declare class HostFailed extends HostFailed_base {}
@@ -501,7 +465,7 @@ declare const decodeReceipt: (input: unknown, options?: import("effect/SchemaAST
501
465
  declare const encodeReceipt: (input: Receipt, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{
502
466
  readonly receiptId: string;
503
467
  readonly submissionId: string;
504
- readonly conversationId: string;
468
+ readonly threadId: string;
505
469
  readonly queueSequence: number;
506
470
  }, Schema.SchemaError, never>;
507
471
  declare const decodeObservePageRequest: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<ObservePageRequest, Schema.SchemaError, never>;
@@ -555,7 +519,7 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
555
519
  readonly receipt: {
556
520
  readonly receiptId: string;
557
521
  readonly submissionId: string;
558
- readonly conversationId: string;
522
+ readonly threadId: string;
559
523
  readonly queueSequence: number;
560
524
  };
561
525
  } | {
@@ -609,18 +573,31 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
609
573
  } | {
610
574
  readonly _tag: "ObservedPage";
611
575
  readonly records: readonly {
612
- readonly conversationId: string;
576
+ readonly threadId: string;
613
577
  readonly batchId: string;
614
578
  readonly sequence: number;
615
579
  readonly offset: string;
616
580
  readonly record: {
617
581
  readonly recordId: string;
618
- readonly family: "conversation";
582
+ readonly family: "thread";
619
583
  readonly schemaVersion: 1;
620
584
  readonly createdAt: string;
621
585
  readonly deploymentId: string;
622
586
  readonly payload: {
623
- readonly _tag: "ConversationCreated";
587
+ readonly _tag: "SubagentStarted";
588
+ readonly runId: string;
589
+ readonly toolCallId: string;
590
+ readonly childThreadId: string;
591
+ readonly childSubmissionId: string;
592
+ readonly childReceiptId: string;
593
+ readonly childRunId: string;
594
+ } | {
595
+ readonly _tag: "AbortRequested";
596
+ readonly submissionId: string;
597
+ readonly author: string;
598
+ readonly reason: string;
599
+ } | {
600
+ readonly _tag: "ThreadCreated";
624
601
  readonly agentId: string;
625
602
  readonly definitions: {
626
603
  readonly agent: string;
@@ -629,18 +606,25 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
629
606
  };
630
607
  } | {
631
608
  readonly _tag: "UserInputRecorded";
632
- readonly submissionId: string;
609
+ readonly submissionId?: string | undefined;
633
610
  readonly kind: "follow-up" | "steering" | "user";
634
611
  readonly runId?: string | undefined;
635
612
  readonly input: Schema.Json;
636
613
  } | {
637
614
  readonly _tag: "RunStarted";
638
615
  readonly runId: string;
616
+ readonly policyAccountingVersion: 1;
639
617
  readonly maxDurationMillis: number;
618
+ } | {
619
+ readonly _tag: "RunPolicyUsageReserved";
620
+ readonly runId: string;
621
+ readonly programmaticToolCalls: number;
622
+ readonly finalizationUsed: boolean;
640
623
  } | {
641
624
  readonly _tag: "ModelCompleted";
642
625
  readonly runId: string;
643
626
  readonly output: Schema.Json;
627
+ readonly messages?: Schema.Json | undefined;
644
628
  } | {
645
629
  readonly _tag: "ModelResponseRecorded";
646
630
  readonly runId: string;
@@ -679,6 +663,7 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
679
663
  readonly toolName: string;
680
664
  readonly parameters: Schema.Json;
681
665
  readonly parametersDigest: string;
666
+ readonly executionKind?: "delegation" | "ordinary" | undefined;
682
667
  } | {
683
668
  readonly _tag: "ToolCallSettled";
684
669
  readonly runId: string;
@@ -686,6 +671,7 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
686
671
  readonly toolName: string;
687
672
  readonly result: Schema.Json;
688
673
  readonly isFailure: boolean;
674
+ readonly budgetRejected?: true | undefined;
689
675
  } | {
690
676
  readonly _tag: "ToolCallUnknown";
691
677
  readonly runId: string;
@@ -747,11 +733,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
747
733
  readonly runDisposition?: Schema.Json | undefined;
748
734
  readonly finishReason?: "budget-exhausted" | undefined;
749
735
  readonly exhausted?: "tokens" | "tool-calls" | "turns" | undefined;
750
- } | {
751
- readonly _tag: "AbortRequested";
752
- readonly submissionId: string;
753
- readonly author: string;
754
- readonly reason: string;
755
736
  } | {
756
737
  readonly _tag: "SubmissionSettled";
757
738
  readonly submissionId: string;
@@ -816,17 +797,10 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
816
797
  readonly grantDigest: string;
817
798
  readonly reservationId: string;
818
799
  readonly reservationDigest: string;
819
- readonly childConversationId: string;
800
+ readonly childThreadId: string;
820
801
  readonly childPrincipal: string;
821
802
  readonly childIdempotencyKey: string;
822
- } | {
823
- readonly _tag: "SubagentStarted";
824
- readonly runId: string;
825
- readonly toolCallId: string;
826
- readonly childConversationId: string;
827
- readonly childSubmissionId: string;
828
- readonly childReceiptId: string;
829
- readonly childRunId: string;
803
+ readonly toolCallAllowance?: number | undefined;
830
804
  } | {
831
805
  readonly _tag: "SubagentJoined";
832
806
  readonly runId: string;
@@ -844,7 +818,7 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
844
818
  readonly parentLink: {
845
819
  readonly delegationId: string;
846
820
  readonly parentAgentId: string;
847
- readonly parentConversationId: string;
821
+ readonly parentThreadId: string;
848
822
  readonly parentRunId: string;
849
823
  readonly parentToolCallId: string;
850
824
  readonly depth: number;
@@ -857,6 +831,7 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
857
831
  };
858
832
  readonly childInputDigest: string;
859
833
  readonly grantDigest: string;
834
+ readonly toolCallAllowance?: number | undefined;
860
835
  } | {
861
836
  readonly _tag: "RepairAnnotated";
862
837
  readonly reason: string;
@@ -912,23 +887,8 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
912
887
  } | {
913
888
  readonly _tag: "HostFailed";
914
889
  readonly failure: {
915
- readonly _tag: "DurableAlarmError";
916
- readonly operation: string;
917
- readonly message: string;
918
- readonly cause?: Schema.Json | undefined;
919
- } | {
920
- readonly _tag: "HostProtocolError";
921
- readonly message: string;
922
- } | {
923
- readonly _tag: "AgentInputError";
924
- readonly message: string;
925
- } | {
926
- readonly _tag: "DigestError";
927
- readonly message: string;
928
- readonly cause?: Schema.Json | undefined;
929
- } | {
930
890
  readonly _tag: "AdmissionConflict";
931
- readonly conversationId: string;
891
+ readonly threadId: string;
932
892
  readonly principal: string;
933
893
  readonly idempotencyKey: string;
934
894
  readonly existingInputDigest: string;
@@ -937,15 +897,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
937
897
  readonly _tag: "SettlementConflict";
938
898
  readonly submissionId: string;
939
899
  readonly existingOutcome: "aborted" | "completed" | "failed";
940
- } | {
941
- readonly _tag: "ApprovalConflict";
942
- readonly submissionId: string;
943
- readonly toolCallId: string;
944
- readonly existingDecision: "approved" | "denied";
945
- } | {
946
- readonly _tag: "UnknownResolutionConflict";
947
- readonly submissionId: string;
948
- readonly toolCallId: string;
949
900
  } | {
950
901
  readonly _tag: "JoinedToHost";
951
902
  readonly submissionId: string;
@@ -956,57 +907,81 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
956
907
  readonly message: string;
957
908
  readonly cause?: Schema.Json | undefined;
958
909
  } | {
959
- readonly _tag: "ConversationStoreError";
910
+ readonly _tag: "ThreadStoreError";
960
911
  readonly operation: string;
961
912
  readonly message: string;
962
913
  readonly cause?: Schema.Json | undefined;
963
914
  } | {
964
- readonly _tag: "ConversationNotMaterialized";
965
- readonly conversationId: string;
915
+ readonly _tag: "ThreadNotMaterialized";
916
+ readonly threadId: string;
966
917
  } | {
967
918
  readonly _tag: "AppendConflict";
968
- readonly conversationId: string;
919
+ readonly threadId: string;
969
920
  readonly batchId: string;
970
921
  readonly reason: "batch-digest" | "record-identity" | "tail";
971
922
  readonly actualTailSequence?: number | undefined;
972
923
  readonly actualTailDigest?: string | undefined;
973
924
  } | {
974
925
  readonly _tag: "FenceRejected";
975
- readonly conversationId: string;
926
+ readonly threadId: string;
976
927
  readonly actualEpoch: number;
977
928
  readonly attemptedEpoch: number;
929
+ } | {
930
+ readonly _tag: "HostProtocolError";
931
+ readonly message: string;
932
+ } | {
933
+ readonly _tag: "AgentInputError";
934
+ readonly message: string;
935
+ } | {
936
+ readonly _tag: "DigestError";
937
+ readonly message: string;
938
+ readonly cause?: Schema.Json | undefined;
939
+ } | {
940
+ readonly _tag: "ApprovalConflict";
941
+ readonly submissionId: string;
942
+ readonly toolCallId: string;
943
+ readonly existingDecision: "approved" | "denied";
944
+ } | {
945
+ readonly _tag: "UnknownResolutionConflict";
946
+ readonly submissionId: string;
947
+ readonly toolCallId: string;
978
948
  } | {
979
949
  readonly _tag: "DurableRuntimeFailpointError";
980
- readonly location: "abort:after-intent" | "approval:after-request-append" | "approval:after-suspend" | "claim:after-claim" | "compaction:after-canonical-append" | "input:after-canonical-append" | "join:after-canonical-append" | "join:after-claim" | "resolve:after-intent" | "run:after-start-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" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:after-reserve" | "tools:after-prepared-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append";
950
+ readonly location: "abort:after-intent" | "approval:after-request-append" | "approval:after-suspend" | "claim:after-claim" | "compaction:after-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-start-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" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:after-reserve" | "tools:after-prepared-append" | "tools:before-prepared-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append";
981
951
  } | {
982
952
  readonly _tag: "AdmissionLimitExceeded";
983
953
  readonly limit: "database-bytes" | "input-bytes" | "queue-depth";
984
954
  readonly actual: number;
985
955
  readonly maximum: number;
956
+ } | {
957
+ readonly _tag: "DurableAlarmError";
958
+ readonly operation: string;
959
+ readonly message: string;
960
+ readonly cause?: Schema.Json | undefined;
986
961
  } | {
987
962
  readonly _tag: "OperationDenied";
988
- readonly operation: "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
963
+ readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
989
964
  readonly reason: string;
990
- readonly conversationId?: string | undefined;
965
+ readonly threadId?: string | undefined;
991
966
  readonly submissionId?: string | undefined;
992
967
  };
993
968
  }, Schema.SchemaError, never>;
994
969
  declare const decodeHostResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AbortRecorded | ApprovalRecorded | HostFailed | ObservedPage | ProgressCancelled | ProgressObserved | SettlementReached | SubmitSucceeded | UnknownResolutionRecorded, Schema.SchemaError, never>;
995
- /** Failure surface of `CloudflareConversationClient.submit`. */
996
- declare const ClientSubmitHostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof LedgerError, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof HostProtocolError]>;
997
- declare const ClientAwaitHostFailure: Schema.Union<readonly [typeof LedgerError, typeof SettlementConflict, typeof HostProtocolError]>;
998
- declare const ClientObserveHostFailure: Schema.Union<readonly [typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof OperationDenied, typeof HostProtocolError]>;
999
- declare const ClientAbortHostFailure: Schema.Union<readonly [typeof LedgerError, typeof SettlementConflict, typeof JoinedToHost, typeof DurableRuntimeFailpointError, typeof DurableAlarmError, typeof HostProtocolError]>;
970
+ /** Failure surface of `CloudflareThreadClient.submit`. */
971
+ declare const ClientSubmitHostFailure: Schema.Union<readonly [typeof AgentInputError, typeof DigestError, typeof AdmissionConflict, typeof LedgerError, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof AdmissionLimitExceeded, typeof DurableAlarmError, typeof HostProtocolError]>;
972
+ declare const ClientAwaitHostFailure: Schema.Union<readonly [typeof LedgerError, typeof SettlementConflict, typeof OperationDenied, typeof HostProtocolError]>;
973
+ declare const ClientObserveHostFailure: Schema.Union<readonly [typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof OperationDenied, typeof HostProtocolError]>;
974
+ declare const ClientAbortHostFailure: Schema.Union<readonly [typeof OperationDenied, typeof LedgerError, typeof SettlementConflict, typeof JoinedToHost, typeof DurableRuntimeFailpointError, typeof DurableAlarmError, typeof HostProtocolError]>;
1000
975
  declare const ClientApprovalHostFailure: Schema.Union<readonly [typeof LedgerError, typeof SettlementConflict, typeof ApprovalConflict, typeof OperationDenied, typeof DurableAlarmError, typeof HostProtocolError]>;
1001
976
  declare const ClientUnknownHostFailure: Schema.Union<readonly [typeof LedgerError, typeof SettlementConflict, typeof UnknownResolutionConflict, typeof JoinedToHost, typeof DurableRuntimeFailpointError, typeof OperationDenied, typeof DurableAlarmError, typeof HostProtocolError]>;
1002
- type ClientSubmitFailure = typeof ClientSubmitHostFailure.Type | ConversationClientError;
1003
- type ClientAwaitFailure = typeof ClientAwaitHostFailure.Type | ConversationClientError;
1004
- type ClientObserveFailure = typeof ClientObserveHostFailure.Type | ConversationClientError;
977
+ type ClientSubmitFailure = typeof ClientSubmitHostFailure.Type | ThreadClientError;
978
+ type ClientAwaitFailure = typeof ClientAwaitHostFailure.Type | ThreadClientError;
979
+ type ClientObserveFailure = typeof ClientObserveHostFailure.Type | ThreadClientError;
1005
980
  type ClientProgressFailure = ClientObserveFailure;
1006
- type ClientAbortFailure = typeof ClientAbortHostFailure.Type | ConversationClientError;
1007
- type ClientApprovalFailure = typeof ClientApprovalHostFailure.Type | ConversationClientError;
1008
- type ClientUnknownFailure = typeof ClientUnknownHostFailure.Type | ConversationClientError;
1009
- declare const CloudflareConversationClient_base: Context.ServiceClass<CloudflareConversationClient, "@effect-agent/platform-cloudflare/CloudflareConversationClient", {
981
+ type ClientAbortFailure = typeof ClientAbortHostFailure.Type | ThreadClientError;
982
+ type ClientApprovalFailure = typeof ClientApprovalHostFailure.Type | ThreadClientError;
983
+ type ClientUnknownFailure = typeof ClientUnknownHostFailure.Type | ThreadClientError;
984
+ declare const CloudflareThreadClient_base: Context.ServiceClass<CloudflareThreadClient, "@effect-agent/platform-cloudflare/CloudflareThreadClient", {
1010
985
  /** Encode the input client-side, then durably submit to the owning Object. */
1011
986
  readonly submit: <InputSchema extends Schema.Top>(agent: DurableSubmitAgent<InputSchema>, input: InputSchema["Type"], options: DurableSubmitOptions) => Effect.Effect<Receipt, ClientSubmitFailure, InputSchema["EncodingServices"]>;
1012
987
  /** Wake-hinted, poll-guaranteed settlement wait executed inside the owning Object. */
@@ -1015,9 +990,9 @@ declare const CloudflareConversationClient_base: Context.ServiceClass<Cloudflare
1015
990
  * Wait without polling until progress after `afterSequence` is already durable or hinted.
1016
991
  * The result is deliberately void: canonical records remain authoritative and must be read.
1017
992
  */
1018
- readonly awaitProgress: (conversationId: ConversationId, afterSequence: CanonicalSequence) => Effect.Effect<void, ClientProgressFailure>;
993
+ readonly awaitProgress: (threadId: ThreadId, afterSequence: CanonicalSequence) => Effect.Effect<void, ClientProgressFailure>;
1019
994
  /** One bounded page of canonical records. */
1020
- readonly readPage: (conversationId: ConversationId, options?: {
995
+ readonly readPage: (threadId: ThreadId, options?: {
1021
996
  readonly afterSequence?: CanonicalSequence | undefined;
1022
997
  readonly limit?: number | undefined;
1023
998
  }) => Effect.Effect<ReadonlyArray<CanonicalRecordEnvelope>, ClientObserveFailure>;
@@ -1026,29 +1001,39 @@ declare const CloudflareConversationClient_base: Context.ServiceClass<Cloudflare
1026
1001
  * snapshot read, not a live observation — callers wanting liveness re-read after
1027
1002
  * `awaitSettlement`.
1028
1003
  */
1029
- readonly readAll: (conversationId: ConversationId) => Effect.Effect<ReadonlyArray<CanonicalRecordEnvelope>, ClientObserveFailure>;
1004
+ readonly readAll: (threadId: ThreadId) => Effect.Effect<ReadonlyArray<CanonicalRecordEnvelope>, ClientObserveFailure>;
1030
1005
  /**
1031
- * Submission-addressed operations take the owning Conversation explicitly (from the
1006
+ * Submission-addressed operations take the owning Thread explicitly (from the
1032
1007
  * Receipt): minted Submission identities stay OPAQUE outside the storage adapter that
1033
1008
  * minted them (D-P6-5), so the client never parses one to find the lane.
1034
1009
  */
1035
- readonly abort: (conversationId: ConversationId, command: AbortCommand) => Effect.Effect<AbortIntent, ClientAbortFailure>;
1036
- readonly resolveApproval: (conversationId: ConversationId, command: ApprovalDecisionCommand) => Effect.Effect<ApprovalDecisionIntent, ClientApprovalFailure>;
1037
- readonly resolveUnknown: (conversationId: ConversationId, command: UnknownResolutionCommand) => Effect.Effect<UnknownResolutionIntent, ClientUnknownFailure>;
1010
+ readonly abort: (threadId: ThreadId, command: AbortCommand) => Effect.Effect<AbortIntent, ClientAbortFailure>;
1011
+ readonly resolveApproval: (threadId: ThreadId, command: ApprovalDecisionCommand) => Effect.Effect<ApprovalDecisionIntent, ClientApprovalFailure>;
1012
+ readonly resolveUnknown: (threadId: ThreadId, command: UnknownResolutionCommand) => Effect.Effect<UnknownResolutionIntent, ClientUnknownFailure>;
1038
1013
  }>;
1039
- /** Worker-side client over the Conversation Object namespace (DEPLOY-010). */
1040
- declare class CloudflareConversationClient extends CloudflareConversationClient_base {
1041
- static readonly layer: Layer.Layer<CloudflareConversationClient, never, ConversationObjectNamespace | Crypto.Crypto>;
1014
+ /** Worker-side client over the Thread Object namespace (DEPLOY-010). */
1015
+ declare class CloudflareThreadClient extends CloudflareThreadClient_base {
1016
+ /**
1017
+ * Assemble the client from a resolved namespace and the platform Crypto implementation.
1018
+ * rpcTracing is the binding name and remains opt-in. Caller authentication, principals,
1019
+ * idempotency keys, and definition digests are still explicit submission inputs.
1020
+ */
1021
+ static layerFromBinding(options: {
1022
+ readonly namespace: DurableObjectNamespace<ThreadObjectRpc>;
1023
+ readonly rpcTracing?: string;
1024
+ }): Layer.Layer<CloudflareThreadClient>;
1025
+ static readonly layer: Layer.Layer<CloudflareThreadClient, never, ThreadObjectNamespace | Crypto.Crypto>;
1026
+ }
1027
+ declare namespace thread_object_d_exports {
1028
+ export { AdminExplainRequest, AdminFailed, AdminFailure, AdminResponse, AdminVerifyRequest, CloudflareBootstrapServices as BootstrapServices, Class, ExplainedRecovery, CloudflareDurableRuntimeInitializationError as InitializationError, Instance, ObligationsScanned, Options, RetryExecuted, CloudflareDurableRuntimeOptions as RuntimeOptions, CloudflareDurableRuntimeServices as Services, VerifiedIntegrity, decodeAdminExplainRequest, decodeAdminResponse, decodeAdminVerifyRequest, decodeObligationThresholds, decodeRetryCommand, encodeAdminResponse, layer, layerConfig, make };
1042
1029
  }
1043
- //#endregion
1044
- //#region src/conversation-object.d.ts
1045
1030
  /**
1046
- * `makeConversationObjectClass(options, observability?)` — the Conversation Durable Object
1031
+ * `ThreadObject.make(application, options)` — the Thread Durable Object
1047
1032
  * (plan §1.4,
1048
1033
  * D-P6-1): a factory returning a class that applications export from their Worker entry.
1049
- * One SQLite-backed Object per Conversation is the serialized owner (durability §6); the
1034
+ * One SQLite-backed Object per Thread is the serialized owner (durability §6); the
1050
1035
  * Object never runs `runResolvedWorker`'s infinite loop — each ingress event or alarm runs
1051
- * ONE bounded `runRecovery` + `processConversationResolved` pass, and the persisted alarm
1036
+ * ONE bounded `runRecovery` + `processThreadResolved` pass, and the persisted alarm
1052
1037
  * (the single multiplexed slot, D-P6-2) finishes accepted work across evictions WITHOUT any
1053
1038
  * incoming request.
1054
1039
  *
@@ -1059,19 +1044,21 @@ declare class CloudflareConversationClient extends CloudflareConversationClient_
1059
1044
  * awaiting each other's RPC would deadlock (plan §1.4). Instead every pass runs
1060
1045
  * `runRecovery` BEFORE any claim, so reconciliation still strictly precedes new work.
1061
1046
  */
1062
- /** Construction options for one deployed Conversation Object class. */
1063
- interface ConversationObjectOptions extends CloudflareDurableRuntimeOptions {
1047
+ /** Construction options for one deployed Thread Object class. */
1048
+ interface Options<ApplicationServices = never, EventServices = never, EventLayerError = never> extends CloudflareDurableRuntimeOptions {
1064
1049
  /** Accept transient native RPC tracing through effect-cf; disabled by default. */
1065
1050
  readonly rpcTracing?: boolean;
1066
1051
  /**
1067
1052
  * Name of the Worker `env` binding carrying THIS class's `DurableObjectNamespace` — the
1068
- * Object's route back to sibling Conversation Objects for the WP2 cross-Object port calls
1053
+ * Object's route back to sibling Thread Objects for the WP2 cross-Object port calls
1069
1054
  * and remote wakes (DEPLOY-010: the binding enters through a Layer, never ambiently).
1070
1055
  */
1071
1056
  readonly namespaceBinding: string;
1057
+ /** Acquired and finalized per native event, with access to the complete application runtime. */
1058
+ readonly eventLayer?: Layer.Layer<EventServices, EventLayerError, RuntimeServices | ApplicationServices | DurableObjectState$1.DurableObjectState | WorkerEnvironment>;
1072
1059
  }
1073
- type EndpointServices = CloudflareDurableRuntimeServices | DurableObjectContext;
1074
- type RuntimeServices = EndpointServices | ConversationObjectNamespace;
1060
+ type EndpointServices = CloudflareDurableRuntimeServices | CloudflareBootstrapServices | DurableObjectContext;
1061
+ type RuntimeServices = EndpointServices | ThreadObjectNamespace;
1075
1062
  declare const AdminExplainRequest_base: Schema.Class<AdminExplainRequest, Schema.Struct<{
1076
1063
  readonly submissionId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "@effect-agent/core/SubmissionId">>;
1077
1064
  }>, {}>;
@@ -1081,7 +1068,7 @@ declare const AdminVerifyRequest_base: Schema.Class<AdminVerifyRequest, Schema.S
1081
1068
  /** Verify carries no parameters — the addressed Object IS the lane. */
1082
1069
  declare class AdminVerifyRequest extends AdminVerifyRequest_base {}
1083
1070
  /** Every typed failure of the four admin entry points, plus the protocol's own errors. */
1084
- declare const AdminFailure: Schema.Union<readonly [typeof OperationDenied, typeof RetryRefused, typeof LedgerError, typeof RunJournalError, typeof DigestError, typeof OwnershipLost, typeof SettlementConflict, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof DurableAlarmError, typeof HostProtocolError]>;
1071
+ declare const AdminFailure: Schema.Union<readonly [typeof OperationDenied, typeof RetryRefused, typeof LedgerError, typeof RunJournalError, typeof DigestError, typeof OwnershipLost, typeof SettlementConflict, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof DurableAlarmError, typeof HostProtocolError]>;
1085
1072
  type AdminFailure = typeof AdminFailure.Type;
1086
1073
  declare const ExplainedRecovery_base: Schema.Class<ExplainedRecovery, Schema.TaggedStruct<"ExplainedRecovery", {
1087
1074
  readonly explanations: Schema.$Array<typeof RecoveryExplanation>;
@@ -1100,7 +1087,7 @@ declare const ObligationsScanned_base: Schema.Class<ObligationsScanned, Schema.T
1100
1087
  }>, {}>;
1101
1088
  declare class ObligationsScanned extends ObligationsScanned_base {}
1102
1089
  declare const AdminFailed_base: Schema.Class<AdminFailed, Schema.TaggedStruct<"AdminFailed", {
1103
- readonly failure: Schema.Union<readonly [typeof OperationDenied, typeof RetryRefused, typeof LedgerError, typeof RunJournalError, typeof DigestError, typeof OwnershipLost, typeof SettlementConflict, typeof ConversationStoreError, typeof ConversationNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof DurableAlarmError, typeof HostProtocolError]>;
1090
+ readonly failure: Schema.Union<readonly [typeof OperationDenied, typeof RetryRefused, typeof LedgerError, typeof RunJournalError, typeof DigestError, typeof OwnershipLost, typeof SettlementConflict, typeof ThreadStoreError, typeof ThreadNotMaterialized, typeof AppendConflict, typeof FenceRejected, typeof DurableRuntimeFailpointError, typeof DurableAlarmError, typeof HostProtocolError]>;
1104
1091
  }>, {}>;
1105
1092
  /** The admin entry point failed TYPED on the Object; the failure re-decodes verbatim. */
1106
1093
  declare class AdminFailed extends AdminFailed_base {}
@@ -1116,7 +1103,7 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1116
1103
  readonly explanations: readonly {
1117
1104
  readonly submission: {
1118
1105
  readonly submissionId: string;
1119
- readonly conversationId: string;
1106
+ readonly threadId: string;
1120
1107
  readonly state: "admitted" | "input-applied" | "joined" | "joining" | "ready" | "running" | "settled" | "suspended" | "terminalizing" | "unknown";
1121
1108
  readonly queueSequence: number;
1122
1109
  readonly createdAt: string;
@@ -1129,7 +1116,7 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1129
1116
  } | undefined;
1130
1117
  };
1131
1118
  readonly evidence: {
1132
- readonly conversationMaterialized: boolean;
1119
+ readonly threadMaterialized: boolean;
1133
1120
  readonly inputRecorded: boolean;
1134
1121
  readonly abortRecorded: boolean;
1135
1122
  readonly recordedSettlementOutcome?: "aborted" | "completed" | "failed" | undefined;
@@ -1145,7 +1132,7 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1145
1132
  readonly requested: boolean;
1146
1133
  readonly started: boolean;
1147
1134
  readonly joined: boolean;
1148
- readonly childConversationId?: string | undefined;
1135
+ readonly childThreadId?: string | undefined;
1149
1136
  readonly childSubmissionId?: string | undefined;
1150
1137
  readonly admission?: "admitted" | "indeterminate" | "not-admitted" | undefined;
1151
1138
  }[];
@@ -1175,13 +1162,13 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1175
1162
  readonly author: string;
1176
1163
  readonly reason: string;
1177
1164
  readonly resolution: {
1165
+ readonly _tag: "SafeToRetry";
1166
+ } | {
1178
1167
  readonly _tag: "CompletedWithResult";
1179
1168
  readonly result: Schema.Json;
1180
1169
  readonly isFailure: boolean;
1181
1170
  } | {
1182
1171
  readonly _tag: "NeverHappened";
1183
- } | {
1184
- readonly _tag: "SafeToRetry";
1185
1172
  } | {
1186
1173
  readonly _tag: "AbortSubmission";
1187
1174
  };
@@ -1357,7 +1344,7 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1357
1344
  } | {
1358
1345
  readonly _tag: "VerifiedIntegrity";
1359
1346
  readonly report: {
1360
- readonly conversationId: string;
1347
+ readonly threadId: string;
1361
1348
  readonly tailSequence: number;
1362
1349
  readonly recordCount: number;
1363
1350
  readonly submissionCount: number;
@@ -1372,7 +1359,7 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1372
1359
  readonly _tag: "RetryExecuted";
1373
1360
  readonly report: {
1374
1361
  readonly submissionId: string;
1375
- readonly conversationId: string;
1362
+ readonly threadId: string;
1376
1363
  readonly decision: {
1377
1364
  readonly _tag: "CompleteMaterialization";
1378
1365
  readonly submissionId: string;
@@ -1510,7 +1497,7 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1510
1497
  };
1511
1498
  readonly entries: readonly {
1512
1499
  readonly submissionId: string;
1513
- readonly conversationId: string;
1500
+ readonly threadId: string;
1514
1501
  readonly state: "admitted" | "input-applied" | "joined" | "joining" | "ready" | "running" | "settled" | "suspended" | "terminalizing" | "unknown";
1515
1502
  readonly blockedOn: "approval" | "ready-aged" | "running-aged" | "unknown" | "waitingForChild";
1516
1503
  readonly ageSeconds: number;
@@ -1521,61 +1508,61 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1521
1508
  } | {
1522
1509
  readonly _tag: "AdminFailed";
1523
1510
  readonly failure: {
1524
- readonly _tag: "OperationDenied";
1525
- readonly operation: "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
1526
- readonly reason: string;
1527
- readonly conversationId?: string | undefined;
1528
- readonly submissionId?: string | undefined;
1529
- } | {
1530
- readonly _tag: "RetryRefused";
1511
+ readonly _tag: "SettlementConflict";
1531
1512
  readonly submissionId: string;
1532
- readonly refusal: "await-approval-decision" | "await-unknown-resolution" | "settled";
1533
- readonly decisionTag: string;
1534
- readonly message: string;
1513
+ readonly existingOutcome: "aborted" | "completed" | "failed";
1535
1514
  } | {
1536
1515
  readonly _tag: "LedgerError";
1537
1516
  readonly operation: string;
1538
1517
  readonly message: string;
1539
1518
  readonly cause?: Schema.Json | undefined;
1540
1519
  } | {
1541
- readonly _tag: "RunJournalError";
1542
- readonly message: string;
1543
- readonly cause?: Schema.Json | undefined;
1544
- } | {
1545
- readonly _tag: "DigestError";
1546
- readonly message: string;
1547
- readonly cause?: Schema.Json | undefined;
1548
- } | {
1549
- readonly _tag: "OwnershipLost";
1550
- readonly submissionId: string;
1551
- readonly actualEpoch: number;
1552
- } | {
1553
- readonly _tag: "SettlementConflict";
1554
- readonly submissionId: string;
1555
- readonly existingOutcome: "aborted" | "completed" | "failed";
1556
- } | {
1557
- readonly _tag: "ConversationStoreError";
1520
+ readonly _tag: "ThreadStoreError";
1558
1521
  readonly operation: string;
1559
1522
  readonly message: string;
1560
1523
  readonly cause?: Schema.Json | undefined;
1561
1524
  } | {
1562
- readonly _tag: "ConversationNotMaterialized";
1563
- readonly conversationId: string;
1525
+ readonly _tag: "ThreadNotMaterialized";
1526
+ readonly threadId: string;
1564
1527
  } | {
1565
1528
  readonly _tag: "AppendConflict";
1566
- readonly conversationId: string;
1529
+ readonly threadId: string;
1567
1530
  readonly batchId: string;
1568
1531
  readonly reason: "batch-digest" | "record-identity" | "tail";
1569
1532
  readonly actualTailSequence?: number | undefined;
1570
1533
  readonly actualTailDigest?: string | undefined;
1571
1534
  } | {
1572
1535
  readonly _tag: "FenceRejected";
1573
- readonly conversationId: string;
1536
+ readonly threadId: string;
1574
1537
  readonly actualEpoch: number;
1575
1538
  readonly attemptedEpoch: number;
1539
+ } | {
1540
+ readonly _tag: "OperationDenied";
1541
+ readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
1542
+ readonly reason: string;
1543
+ readonly threadId?: string | undefined;
1544
+ readonly submissionId?: string | undefined;
1545
+ } | {
1546
+ readonly _tag: "RetryRefused";
1547
+ readonly submissionId: string;
1548
+ readonly refusal: "await-approval-decision" | "await-unknown-resolution" | "settled";
1549
+ readonly decisionTag: string;
1550
+ readonly message: string;
1551
+ } | {
1552
+ readonly _tag: "RunJournalError";
1553
+ readonly message: string;
1554
+ readonly cause?: Schema.Json | undefined;
1555
+ } | {
1556
+ readonly _tag: "DigestError";
1557
+ readonly message: string;
1558
+ readonly cause?: Schema.Json | undefined;
1559
+ } | {
1560
+ readonly _tag: "OwnershipLost";
1561
+ readonly submissionId: string;
1562
+ readonly actualEpoch: number;
1576
1563
  } | {
1577
1564
  readonly _tag: "DurableRuntimeFailpointError";
1578
- readonly location: "abort:after-intent" | "approval:after-request-append" | "approval:after-suspend" | "claim:after-claim" | "compaction:after-canonical-append" | "input:after-canonical-append" | "join:after-canonical-append" | "join:after-claim" | "resolve:after-intent" | "run:after-start-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" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:after-reserve" | "tools:after-prepared-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append";
1565
+ readonly location: "abort:after-intent" | "approval:after-request-append" | "approval:after-suspend" | "claim:after-claim" | "compaction:after-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-start-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" | "submit:after-admit" | "submit:after-materialize" | "terminalize:after-canonical-append" | "terminalize:after-reserve" | "tools:after-prepared-append" | "tools:before-prepared-append" | "turn:after-canonical-append" | "turn:after-response-append" | "turn:after-results-append";
1579
1566
  } | {
1580
1567
  readonly _tag: "DurableAlarmError";
1581
1568
  readonly operation: string;
@@ -1587,8 +1574,8 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1587
1574
  };
1588
1575
  }, Schema.SchemaError, never>;
1589
1576
  declare const decodeAdminResponse: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<AdminFailed | ExplainedRecovery | ObligationsScanned | RetryExecuted | VerifiedIntegrity, Schema.SchemaError, never>;
1590
- /** The public endpoints and effect-cf invocation hook of one Conversation Object instance. */
1591
- interface ConversationObjectInstance<EventServices = never> extends InstanceType<DurableObject.DurableObjectClass<Record<never, never>, RuntimeServices | EventServices>> {
1577
+ /** The public endpoints and effect-cf invocation hook of one Thread Object instance. */
1578
+ interface Instance<EventServices = never> extends InstanceType<DurableObject.DurableObjectClass<Record<never, never>, RuntimeServices | EventServices>> {
1592
1579
  submitEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
1593
1580
  awaitSettlementEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
1594
1581
  awaitProgressEncoded(encoded: unknown, traceContext?: unknown): Promise<unknown>;
@@ -1605,18 +1592,26 @@ interface ConversationObjectInstance<EventServices = never> extends InstanceType
1605
1592
  wake(): Promise<void>;
1606
1593
  alarm(alarmInfo?: AlarmInvocationInfo): Promise<void> | void;
1607
1594
  }
1608
- /** The constructor shape workerd instantiates for each Conversation Object. */
1609
- interface ConversationObjectClass<EventServices = never> {
1610
- new (ctx: DurableObjectState, env: Cloudflare.Env): ConversationObjectInstance<EventServices>;
1595
+ /** The constructor shape workerd instantiates for each Thread Object. */
1596
+ interface Class<EventServices = never> {
1597
+ new (ctx: DurableObjectState, env: Cloudflare.Env): Instance<EventServices>;
1611
1598
  }
1612
1599
  /**
1613
- * Build the application's Conversation Object class (export it from the Worker entry).
1614
- * effect-cf owns the cached ManagedRuntime, native RPC methods, event scopes, and post-handler
1615
- * OTLP flush scheduling for RPC and alarm events. The optional outer Layer is built per native
1616
- * event, so a host can install Tracer/Logger/Metric services and `OtlpExporter.Flusher` without
1617
- * Effect Agent owning exporter lifecycle machinery.
1600
+ * Export a composed application Layer as a native Durable Object class.
1601
+ * Bootstrap services are provided to the whole graph before it acquires, so application Layers
1602
+ * can yield effect-cf's WorkerEnvironment and DurableObjectState, derived identity, and Crypto.
1603
+ * Application dependencies remain visible until Layer.provide satisfies them. effect-cf owns the
1604
+ * cached ManagedRuntime, native RPC methods, event scopes, and telemetry flushing.
1605
+ * Initialization is local and bounded inside the constructor gate. Cloudflare eviction does not
1606
+ * guarantee finalizers; put resources requiring timely release in scoped operations or eventLayer.
1618
1607
  */
1619
- declare const makeConversationObjectClass: <EventLayerError = never, EventServices = never>(options: ConversationObjectOptions, observability?: Layer.Layer<EventServices, EventLayerError, DurableObjectContext | ConversationObjectNamespace | DurableObjectState$1.DurableObjectState | WorkerEnvironment>) => ConversationObjectClass<EventServices>;
1608
+ 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>;
1609
+ //#endregion
1610
+ //#region src/prepared-admission.d.ts
1611
+ /** Ordinary prepared admission through one freshly addressed Thread Object call. */
1612
+ declare const cloudflarePreparedInputAdmissionLayer: Layer.Layer<PreparedInputAdmission, never, CloudflareThreadClient>;
1613
+ /** Compatibility adapter retaining Scheduling's public admission port. */
1614
+ declare const cloudflareScheduledInputAdmissionLayer: Layer.Layer<ScheduledInputAdmission, never, PreparedInputAdmission>;
1620
1615
  //#endregion
1621
1616
  //#region src/code-mode-executor.d.ts
1622
1617
  /**
@@ -1641,6 +1636,19 @@ interface DynamicWorkerCodeExecutorOptions {
1641
1636
  }
1642
1637
  /** Layer building the Dynamic Worker `CodeExecutor` from resolved bindings. */
1643
1638
  declare const dynamicWorkerCodeExecutorLayer: (options: DynamicWorkerCodeExecutorOptions) => Layer.Layer<CodeExecutor>;
1639
+ /** Assemble Code Mode handlers with the isolated Dynamic Worker executor. */
1640
+ declare const CloudflareCodeMode: {
1641
+ /**
1642
+ * Provide the selected tool handlers at construction, where Code Mode captures them.
1643
+ * Their errors and remaining dependencies stay visible. The definition still owns the
1644
+ * allowlist and limits; the runtime supplies the live Tool broker for each scoped pass.
1645
+ */
1646
+ layer: <A, E, R, Handlers, HandlerError, HandlerRequirements>(definition: {
1647
+ readonly handlers: Layer.Layer<A, E, R>;
1648
+ }, options: DynamicWorkerCodeExecutorOptions & {
1649
+ readonly handlers: Layer.Layer<Handlers, HandlerError, HandlerRequirements>;
1650
+ }) => Layer.Layer<A, E | HandlerError, Exclude<HandlerRequirements, CodeExecutor> | Exclude<Exclude<R, Handlers>, CodeExecutor>>;
1651
+ };
1644
1652
  //#endregion
1645
- export { AbortRecorded, AdminExplainRequest, AdminFailed, AdminFailure, AdminResponse, AdminVerifyRequest, AdmissionLimitExceeded, ApprovalRecorded, AwaitProgressRequest, BrowserQuickActionBrowserBinding, BrowserQuickActionCaptureOptions, BrowserQuickActionClient, BrowserQuickActionRpcError, BrowserQuickActionWorkersAi, BrowserQuickActionWorkersAiPolicy, BrowserQuickActionWorkersAiPolicyError, BrowserRestCaptureOptions, BrowserRestCrawlOptions, BrowserRunCleanupError, BrowserRunCloudflareCommand, BrowserRunHandoffRequest, BrowserRunHandoffResult, BrowserRunHandoffState, BrowserRunInteractiveBinding, BrowserRunInteractiveBrowser, BrowserRunInteractiveCdpSession, BrowserRunInteractiveContext, BrowserRunInteractiveHost, BrowserRunInteractivePage, BrowserRunInteractiveRequest, BrowserRunInteractiveRequestListener, BrowserRunInteractiveSession, BrowserRunLiveViewRequest, BrowserRunLiveViewResult, BrowserRunSessionLifecycle, BrowserRunViewport, CLOUDFLARE_DATABASE_CAP_BYTES, CLOUDFLARE_RUNTIME_DEFAULTS, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareAdmissionLimitsValue, CloudflareBindingError, CloudflareBindingSource, CloudflareBindingSourceContext, CloudflareConversationClient, CloudflareDurableRuntime, CloudflareDurableRuntimeConfig, CloudflareDurableRuntimeConfigValue, CloudflareDurableRuntimeInitializationError, CloudflareDurableRuntimeOptions, CloudflareDurableRuntimeServices, CloudflarePlatformConfigError, CloudflareRunContextLayer, CloudflareRunContextSource, CloudflareRuntimeSourceContext, CloudflareSchedulingClient, ConversationClientError, ConversationMaintenance, ConversationMaintenanceFailpoint, ConversationMaintenanceFailpointHandler, ConversationMaintenanceFailpointLocation, ConversationObjectClass, ConversationObjectIdentity, ConversationObjectInstance, ConversationObjectNamespace, ConversationObjectOptions, ConversationObjectPorts, ConversationObjectRpc, DEFAULT_MAX_DATABASE_BYTES, DurableAlarmError, DurableAlarmService, DurableObjectContext, DynamicWorkerCodeExecutorOptions, ExplainedRecovery, HostFailed, HostFailure, HostProtocolError, HostResponse, MaintenancePassFailure, MaintenancePassReport, ObligationsScanned, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, ProgressWaitRegistry, RetryExecuted, ScheduleAlarmProtocolError, ScheduleOwnerIdentity, ScheduleOwnerNamespace, ScheduleOwnerObjectClass, ScheduleOwnerObjectInstance, ScheduleOwnerObjectRpc, ScheduleOwnerProtocolError, SettlementReached, SubmitRequest, SubmitSucceeded, UnknownResolutionRecorded, VerifiedIntegrity, boundHostDiagnostic, browserQuickActionCaptureLayer, browserQuickActionImplementation, browserQuickActionScreenshotLayer, browserQuickActionWorkersAiCaptureLayer, browserRestCaptureImplementation, browserRestCaptureLayer, browserRestCrawlImplementation, browserRestCrawlLayer, browserRestWorkersAiCaptureLayer, browserRunInteractiveHostLayer, browserRunInteractiveImplementation, browserRunInteractiveLayer, cloudflareWakeSchedulerLayer, conversationNamespaceFromEnv, conversationNamespaceLayer, conversationPortTransportLayer, decodeAbortCommand, decodeAdminExplainRequest, decodeAdminResponse, decodeAdminVerifyRequest, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObligationThresholds, decodeObservePageRequest, decodeReceipt, decodeRetryCommand, decodeSubmitRequest, decodeUnknownResolutionCommand, disposeRpcHandle, dynamicWorkerCodeExecutorLayer, dynamicWorkerImplementation, encodeAbortCommand, encodeAdminResponse, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand, isBrowserRunUndispatchedActionError, makeConversationObjectClass, makeScheduleOwnerObjectClass };
1653
+ export { AbortRecorded, AdmissionLimitExceeded, ApprovalRecorded, AwaitProgressRequest, CLOUDFLARE_DATABASE_CAP_BYTES, CLOUDFLARE_RUNTIME_DEFAULTS, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareAdmissionLimitsValue, CloudflareBindingError, CloudflareBrowser, type CloudflareBrowserOptions, CloudflareCodeMode, CloudflareDurableRuntimeConfig, CloudflareDurableRuntimeConfigValue, CloudflarePlatformConfigError, CloudflareSchedulingClient, CloudflareSubscriptionConfigError, CloudflareSubscriptionsClient, CloudflareThreadClient, DEFAULT_MAX_DATABASE_BYTES, DurableAlarmError, DurableAlarmService, DurableObjectContext, DynamicWorkerCodeExecutorOptions, HostFailed, HostFailure, HostProtocolError, HostResponse, MaintenancePassFailure, MaintenancePassReport, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, ProgressWaitRegistry, ScheduleAlarmProtocolError, ScheduleOwnerIdentity, ScheduleOwnerNamespace, ScheduleOwnerObjectClass, ScheduleOwnerObjectInstance, ScheduleOwnerObjectRpc, ScheduleOwnerProtocolError, SettlementReached, SubmitRequest, SubmitSucceeded, SubscriptionAlarmProtocolError, SubscriptionPartitionIdentity, SubscriptionPartitionNamespace, SubscriptionPartitionObjectClass, SubscriptionPartitionObjectInstance, SubscriptionPartitionObjectRpc, SubscriptionPartitionProtocolError, ThreadClientError, ThreadMaintenance, ThreadMaintenanceFailpoint, ThreadMaintenanceFailpointHandler, ThreadMaintenanceFailpointLocation, thread_object_d_exports as ThreadObject, ThreadObjectIdentity, ThreadObjectNamespace, ThreadObjectPorts, ThreadObjectRpc, UnknownResolutionRecorded, boundHostDiagnostic, cloudflarePreparedInputAdmissionLayer, cloudflareScheduledInputAdmissionLayer, cloudflareWakeSchedulerLayer, decodeAbortCommand, decodeApprovalDecisionCommand, decodeAwaitProgressRequest, decodeCancelProgressRequest, decodeHostResponse, decodeObservePageRequest, decodeReceipt, decodeSubmitRequest, decodeUnknownResolutionCommand, disposeRpcHandle, dynamicWorkerCodeExecutorLayer, dynamicWorkerImplementation, encodeAbortCommand, encodeApprovalDecisionCommand, encodeAwaitProgressRequest, encodeCancelProgressRequest, encodeHostResponse, encodeObservePageRequest, encodeReceipt, encodeSubmitRequest, encodeUnknownResolutionCommand, makeScheduleOwnerObjectClass, makeSubscriptionPartitionObjectClass, sourcePartitionName, threadNamespaceFromEnv, threadNamespaceLayer, threadPortTransportLayer, validateCloudflareSubscriptionLimits };
1646
1654
  //# sourceMappingURL=index.d.mts.map