@effect-agent/platform-cloudflare 0.1.0-beta.39 → 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.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { a as ThreadObjectRpc, i as ThreadObjectNamespace, n as DurableObjectContext, o as threadNamespaceFromEnv, r as ThreadObjectIdentity, s as threadNamespaceLayer, t as CloudflareBindingError } from "./bindings-C00ZfjsX.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";
2
3
  import { CloudflareSchedulingClient, ScheduleAlarmProtocolError, ScheduleOwnerIdentity, ScheduleOwnerNamespace, ScheduleOwnerObjectClass, ScheduleOwnerObjectInstance, ScheduleOwnerObjectRpc, ScheduleOwnerProtocolError, makeScheduleOwnerObjectClass } from "./scheduling.mjs";
3
4
  import { CloudflareSubscriptionConfigError, CloudflareSubscriptionsClient, SubscriptionAlarmProtocolError, SubscriptionPartitionIdentity, SubscriptionPartitionNamespace, SubscriptionPartitionObjectClass, SubscriptionPartitionObjectInstance, SubscriptionPartitionObjectRpc, SubscriptionPartitionProtocolError, makeSubscriptionPartitionObjectClass, sourcePartitionName, validateCloudflareSubscriptionLimits } from "./subscriptions.mjs";
4
5
  import { Context, Crypto, Effect, Layer, Option, Schema, Scope } from "effect";
@@ -502,13 +503,13 @@ declare const encodeUnknownResolutionCommand: (input: UnknownResolutionCommand,
502
503
  readonly author: string;
503
504
  readonly reason: string;
504
505
  readonly resolution: {
505
- readonly _tag: "SafeToRetry";
506
- } | {
507
506
  readonly _tag: "CompletedWithResult";
508
507
  readonly result: Schema.Json;
509
508
  readonly isFailure: boolean;
510
509
  } | {
511
510
  readonly _tag: "NeverHappened";
511
+ } | {
512
+ readonly _tag: "SafeToRetry";
512
513
  } | {
513
514
  readonly _tag: "AbortSubmission";
514
515
  };
@@ -583,6 +584,14 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
583
584
  readonly createdAt: string;
584
585
  readonly deploymentId: string;
585
586
  readonly payload: {
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
+ } | {
586
595
  readonly _tag: "AbortRequested";
587
596
  readonly submissionId: string;
588
597
  readonly author: string;
@@ -792,14 +801,6 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
792
801
  readonly childPrincipal: string;
793
802
  readonly childIdempotencyKey: string;
794
803
  readonly toolCallAllowance?: number | undefined;
795
- } | {
796
- readonly _tag: "SubagentStarted";
797
- readonly runId: string;
798
- readonly toolCallId: string;
799
- readonly childThreadId: string;
800
- readonly childSubmissionId: string;
801
- readonly childReceiptId: string;
802
- readonly childRunId: string;
803
804
  } | {
804
805
  readonly _tag: "SubagentJoined";
805
806
  readonly runId: string;
@@ -870,13 +871,13 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
870
871
  readonly author: string;
871
872
  readonly reason: string;
872
873
  readonly resolution: {
873
- readonly _tag: "SafeToRetry";
874
- } | {
875
874
  readonly _tag: "CompletedWithResult";
876
875
  readonly result: Schema.Json;
877
876
  readonly isFailure: boolean;
878
877
  } | {
879
878
  readonly _tag: "NeverHappened";
879
+ } | {
880
+ readonly _tag: "SafeToRetry";
880
881
  } | {
881
882
  readonly _tag: "AbortSubmission";
882
883
  };
@@ -926,11 +927,8 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
926
927
  readonly actualEpoch: number;
927
928
  readonly attemptedEpoch: number;
928
929
  } | {
929
- readonly _tag: "OperationDenied";
930
- readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
931
- readonly reason: string;
932
- readonly threadId?: string | undefined;
933
- readonly submissionId?: string | undefined;
930
+ readonly _tag: "HostProtocolError";
931
+ readonly message: string;
934
932
  } | {
935
933
  readonly _tag: "AgentInputError";
936
934
  readonly message: string;
@@ -938,6 +936,15 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
938
936
  readonly _tag: "DigestError";
939
937
  readonly message: string;
940
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;
941
948
  } | {
942
949
  readonly _tag: "DurableRuntimeFailpointError";
943
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";
@@ -952,17 +959,11 @@ declare const encodeHostResponse: (input: AbortRecorded | ApprovalRecorded | Hos
952
959
  readonly message: string;
953
960
  readonly cause?: Schema.Json | undefined;
954
961
  } | {
955
- readonly _tag: "HostProtocolError";
956
- readonly message: string;
957
- } | {
958
- readonly _tag: "ApprovalConflict";
959
- readonly submissionId: string;
960
- readonly toolCallId: string;
961
- readonly existingDecision: "approved" | "denied";
962
- } | {
963
- readonly _tag: "UnknownResolutionConflict";
964
- readonly submissionId: string;
965
- readonly toolCallId: string;
962
+ readonly _tag: "OperationDenied";
963
+ readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
964
+ readonly reason: string;
965
+ readonly threadId?: string | undefined;
966
+ readonly submissionId?: string | undefined;
966
967
  };
967
968
  }, Schema.SchemaError, never>;
968
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>;
@@ -1012,6 +1013,15 @@ declare const CloudflareThreadClient_base: Context.ServiceClass<CloudflareThread
1012
1013
  }>;
1013
1014
  /** Worker-side client over the Thread Object namespace (DEPLOY-010). */
1014
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>;
1015
1025
  static readonly layer: Layer.Layer<CloudflareThreadClient, never, ThreadObjectNamespace | Crypto.Crypto>;
1016
1026
  }
1017
1027
  declare namespace thread_object_d_exports {
@@ -1152,13 +1162,13 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1152
1162
  readonly author: string;
1153
1163
  readonly reason: string;
1154
1164
  readonly resolution: {
1165
+ readonly _tag: "SafeToRetry";
1166
+ } | {
1155
1167
  readonly _tag: "CompletedWithResult";
1156
1168
  readonly result: Schema.Json;
1157
1169
  readonly isFailure: boolean;
1158
1170
  } | {
1159
1171
  readonly _tag: "NeverHappened";
1160
- } | {
1161
- readonly _tag: "SafeToRetry";
1162
1172
  } | {
1163
1173
  readonly _tag: "AbortSubmission";
1164
1174
  };
@@ -1498,38 +1508,14 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1498
1508
  } | {
1499
1509
  readonly _tag: "AdminFailed";
1500
1510
  readonly failure: {
1501
- readonly _tag: "OperationDenied";
1502
- readonly operation: "abort" | "awaitSettlement" | "explain" | "observe" | "resolveApproval" | "resolveUnknown" | "retry" | "scanObligations" | "verify" | "wake";
1503
- readonly reason: string;
1504
- readonly threadId?: string | undefined;
1505
- readonly submissionId?: string | undefined;
1506
- } | {
1507
- readonly _tag: "RetryRefused";
1511
+ readonly _tag: "SettlementConflict";
1508
1512
  readonly submissionId: string;
1509
- readonly refusal: "await-approval-decision" | "await-unknown-resolution" | "settled";
1510
- readonly decisionTag: string;
1511
- readonly message: string;
1513
+ readonly existingOutcome: "aborted" | "completed" | "failed";
1512
1514
  } | {
1513
1515
  readonly _tag: "LedgerError";
1514
1516
  readonly operation: string;
1515
1517
  readonly message: string;
1516
1518
  readonly cause?: Schema.Json | undefined;
1517
- } | {
1518
- readonly _tag: "RunJournalError";
1519
- readonly message: string;
1520
- readonly cause?: Schema.Json | undefined;
1521
- } | {
1522
- readonly _tag: "DigestError";
1523
- readonly message: string;
1524
- readonly cause?: Schema.Json | undefined;
1525
- } | {
1526
- readonly _tag: "OwnershipLost";
1527
- readonly submissionId: string;
1528
- readonly actualEpoch: number;
1529
- } | {
1530
- readonly _tag: "SettlementConflict";
1531
- readonly submissionId: string;
1532
- readonly existingOutcome: "aborted" | "completed" | "failed";
1533
1519
  } | {
1534
1520
  readonly _tag: "ThreadStoreError";
1535
1521
  readonly operation: string;
@@ -1550,6 +1536,30 @@ declare const encodeAdminResponse: (input: AdminFailed | ExplainedRecovery | Obl
1550
1536
  readonly threadId: string;
1551
1537
  readonly actualEpoch: number;
1552
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;
1553
1563
  } | {
1554
1564
  readonly _tag: "DurableRuntimeFailpointError";
1555
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";
@@ -1626,6 +1636,19 @@ interface DynamicWorkerCodeExecutorOptions {
1626
1636
  }
1627
1637
  /** Layer building the Dynamic Worker `CodeExecutor` from resolved bindings. */
1628
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
+ };
1629
1652
  //#endregion
1630
- export { AbortRecorded, AdmissionLimitExceeded, ApprovalRecorded, AwaitProgressRequest, CLOUDFLARE_DATABASE_CAP_BYTES, CLOUDFLARE_RUNTIME_DEFAULTS, CancelProgressRequest, ClientAbortFailure, ClientApprovalFailure, ClientAwaitFailure, ClientObserveFailure, ClientProgressFailure, ClientSubmitFailure, ClientUnknownFailure, CloudflareAdmissionLimitsValue, CloudflareBindingError, 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 };
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 };
1631
1654
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { $ as CloudflarePlatformConfigError, A as decodeUnknownResolutionCommand, B as DurableAlarmError, C as decodeApprovalDecisionCommand, D as decodeObservePageRequest, E as decodeHostResponse, F as encodeHostResponse, G as safeCauseDiagnostic, H as MaintenancePassReport, I as encodeObservePageRequest, J as CLOUDFLARE_DATABASE_CAP_BYTES, K as safeCauseMessage, L as encodeReceipt, M as encodeApprovalDecisionCommand, N as encodeAwaitProgressRequest, O as decodeReceipt, P as encodeCancelProgressRequest, Q as CloudflareDurableRuntimeConfigValue, R as encodeSubmitRequest, S as decodeAbortCommand, T as decodeCancelProgressRequest, U as ThreadMaintenance, V as DurableAlarmService, W as ThreadMaintenanceFailpoint, X as CloudflareAdmissionLimitsValue, Y as CLOUDFLARE_RUNTIME_DEFAULTS, Z as CloudflareDurableRuntimeConfig, _ as SubmitRequest, a as AwaitProgressRequest, at as threadNamespaceFromEnv, b as UnknownResolutionRecorded, c as HostFailed, d as HostResponse, et as DEFAULT_MAX_DATABASE_BYTES, f as ObservePageRequest, g as SettlementReached, h as ProgressObserved, i as ApprovalRecorded, it as ThreadObjectNamespace, j as encodeAbortCommand, k as decodeSubmitRequest, l as HostFailure, m as ProgressCancelled, n as cloudflareScheduledInputAdmissionLayer, nt as DurableObjectContext, o as CancelProgressRequest, ot as threadNamespaceLayer, p as ObservedPage, q as AdmissionLimitExceeded, r as AbortRecorded, rt as ThreadObjectIdentity, s as CloudflareThreadClient, t as cloudflarePreparedInputAdmissionLayer, tt as CloudflareBindingError, u as HostProtocolError, v as SubmitSucceeded, w as decodeAwaitProgressRequest, x as boundHostDiagnostic, y as ThreadClientError, z as encodeUnknownResolutionCommand } from "./prepared-admission-D5hQ-ofV.mjs";
2
+ import { $ as CloudflarePlatformConfigError, A as decodeUnknownResolutionCommand, B as DurableAlarmError, C as decodeApprovalDecisionCommand, D as decodeObservePageRequest, E as decodeHostResponse, F as encodeHostResponse, G as safeCauseDiagnostic, H as MaintenancePassReport, I as encodeObservePageRequest, J as CLOUDFLARE_DATABASE_CAP_BYTES, K as safeCauseMessage, L as encodeReceipt, M as encodeApprovalDecisionCommand, N as encodeAwaitProgressRequest, O as decodeReceipt, P as encodeCancelProgressRequest, Q as CloudflareDurableRuntimeConfigValue, R as encodeSubmitRequest, S as decodeAbortCommand, T as decodeCancelProgressRequest, U as ThreadMaintenance, V as DurableAlarmService, W as ThreadMaintenanceFailpoint, X as CloudflareAdmissionLimitsValue, Y as CLOUDFLARE_RUNTIME_DEFAULTS, Z as CloudflareDurableRuntimeConfig, _ as SubmitRequest, a as AwaitProgressRequest, at as threadNamespaceFromEnv, b as UnknownResolutionRecorded, c as HostFailed, d as HostResponse, et as DEFAULT_MAX_DATABASE_BYTES, f as ObservePageRequest, g as SettlementReached, h as ProgressObserved, i as ApprovalRecorded, it as ThreadObjectNamespace, j as encodeAbortCommand, k as decodeSubmitRequest, l as HostFailure, m as ProgressCancelled, n as cloudflareScheduledInputAdmissionLayer, nt as DurableObjectContext, o as CancelProgressRequest, ot as threadNamespaceLayer, p as ObservedPage, q as AdmissionLimitExceeded, r as AbortRecorded, rt as ThreadObjectIdentity, s as CloudflareThreadClient, t as cloudflarePreparedInputAdmissionLayer, tt as CloudflareBindingError, u as HostProtocolError, v as SubmitSucceeded, w as decodeAwaitProgressRequest, x as boundHostDiagnostic, y as ThreadClientError, z as encodeUnknownResolutionCommand } from "./prepared-admission-BKp_Upw2.mjs";
3
3
  import { CloudflareSchedulingClient, ScheduleAlarmProtocolError, ScheduleOwnerIdentity, ScheduleOwnerNamespace, ScheduleOwnerProtocolError, makeScheduleOwnerObjectClass } from "./scheduling.mjs";
4
4
  import { CloudflareSubscriptionConfigError, CloudflareSubscriptionsClient, SubscriptionAlarmProtocolError, SubscriptionPartitionIdentity, SubscriptionPartitionNamespace, SubscriptionPartitionProtocolError, makeSubscriptionPartitionObjectClass, sourcePartitionName, validateCloudflareSubscriptionLimits } from "./subscriptions.mjs";
5
+ import { CloudflareBrowser } from "./browser-quick-action.mjs";
5
6
  import { Clock, Context, Deferred, Duration, Effect, Exit, Fiber, Layer, Option, PubSub, Queue, Ref, Schema, Stream } from "effect";
6
7
  import { ThreadPortTransport, decodePortRequest, encodePortResponse, executePortRequest, portTransportFailure, routedSubmissionLedgerLayer, routedThreadStoreLayer, storageConfigLayer, storageFailpointLayer, submissionLedgerLayer, threadStoreLayer } from "@effect-agent/storage-cloudflare";
7
8
  import { AppendConflict, DigestError, DurableAgentRuntime, DurableRuntimeConfig, DurableRuntimeFailpoint, DurableRuntimeFailpointError, FenceRejected, IntegrityReport, LedgerError, ObligationReport, ObligationThresholds, OperationAuthorizationRequest, OperationAuthorizer, OperationDenied, OwnershipLost, PersistedJson, ProducerId, RecoveryExplanation, RecoveryReport, RetryCommand, RetryRefused, RunJournalError, SettlementConflict, SubmissionLedger, SubmissionLookupByKey, ThreadNotMaterialized, ThreadRead, ThreadStore, ThreadStoreError, ToolReconciler, WakeScheduler, compileRegistrations, makeWakeSubscriptionHub, operationAuthorizerLayer } from "@effect-agent/thread";
@@ -539,7 +540,8 @@ const effectCfPlatformLayer = (namespaceBinding, rpcTracing = false) => {
539
540
  });
540
541
  }));
541
542
  const namespace = Layer.effect(ThreadObjectNamespace)(Effect.gen(function* () {
542
- const binding = yield* threadNamespaceFromEnv(yield* WorkerEnvironment, namespaceBinding);
543
+ const env = yield* WorkerEnvironment;
544
+ const binding = yield* threadNamespaceFromEnv(env, namespaceBinding);
543
545
  return ThreadObjectNamespace.of({
544
546
  namespace: binding,
545
547
  ...rpcTracing === true ? { rpcTracing: namespaceBinding } : {}
@@ -781,7 +783,7 @@ export default class CodeModeHarness extends WorkerEntrypoint {
781
783
  }
782
784
  }
783
785
  `;
784
- const BoundedLogs = Schema.Array(Schema.String.check(Schema.isMaxLength(16 * 1024))).check(Schema.isMaxLength(4096));
786
+ const BoundedLogs = Schema.Array(Schema.String.check(Schema.isMaxLength(16384))).check(Schema.isMaxLength(4096));
785
787
  const HarnessCompleted = Schema.TaggedStruct("completed", {
786
788
  value: Schema.Json,
787
789
  logs: BoundedLogs,
@@ -1192,7 +1194,15 @@ const dynamicWorkerCodeExecutorLayer = (options) => Layer.effect(CodeExecutor, E
1192
1194
  const clock = yield* Clock.Clock;
1193
1195
  return CodeExecutor.of({ execute: makeExecute(options, clock) });
1194
1196
  }));
1197
+ /** Assemble Code Mode handlers with the isolated Dynamic Worker executor. */
1198
+ const CloudflareCodeMode = {
1199
+ /**
1200
+ * Provide the selected tool handlers at construction, where Code Mode captures them.
1201
+ * Their errors and remaining dependencies stay visible. The definition still owns the
1202
+ * allowlist and limits; the runtime supplies the live Tool broker for each scoped pass.
1203
+ */
1204
+ layer: (definition, options) => definition.handlers.pipe(Layer.provide(options.handlers), Layer.provide(dynamicWorkerCodeExecutorLayer(options))) };
1195
1205
  //#endregion
1196
- export { AbortRecorded, AdmissionLimitExceeded, ApprovalRecorded, AwaitProgressRequest, CLOUDFLARE_DATABASE_CAP_BYTES, CLOUDFLARE_RUNTIME_DEFAULTS, CancelProgressRequest, CloudflareAdmissionLimitsValue, CloudflareBindingError, CloudflareDurableRuntimeConfig, CloudflareDurableRuntimeConfigValue, CloudflarePlatformConfigError, CloudflareSchedulingClient, CloudflareSubscriptionConfigError, CloudflareSubscriptionsClient, CloudflareThreadClient, DEFAULT_MAX_DATABASE_BYTES, DurableAlarmError, DurableAlarmService, DurableObjectContext, HostFailed, HostFailure, HostProtocolError, HostResponse, MaintenancePassReport, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, ProgressWaitRegistry, ScheduleAlarmProtocolError, ScheduleOwnerIdentity, ScheduleOwnerNamespace, ScheduleOwnerProtocolError, SettlementReached, SubmitRequest, SubmitSucceeded, SubscriptionAlarmProtocolError, SubscriptionPartitionIdentity, SubscriptionPartitionNamespace, SubscriptionPartitionProtocolError, ThreadClientError, ThreadMaintenance, ThreadMaintenanceFailpoint, thread_object_exports as ThreadObject, ThreadObjectIdentity, ThreadObjectNamespace, ThreadObjectPorts, 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 };
1206
+ export { AbortRecorded, AdmissionLimitExceeded, ApprovalRecorded, AwaitProgressRequest, CLOUDFLARE_DATABASE_CAP_BYTES, CLOUDFLARE_RUNTIME_DEFAULTS, CancelProgressRequest, CloudflareAdmissionLimitsValue, CloudflareBindingError, CloudflareBrowser, CloudflareCodeMode, CloudflareDurableRuntimeConfig, CloudflareDurableRuntimeConfigValue, CloudflarePlatformConfigError, CloudflareSchedulingClient, CloudflareSubscriptionConfigError, CloudflareSubscriptionsClient, CloudflareThreadClient, DEFAULT_MAX_DATABASE_BYTES, DurableAlarmError, DurableAlarmService, DurableObjectContext, HostFailed, HostFailure, HostProtocolError, HostResponse, MaintenancePassReport, ObservePageRequest, ObservedPage, ProgressCancelled, ProgressObserved, ProgressWaitRegistry, ScheduleAlarmProtocolError, ScheduleOwnerIdentity, ScheduleOwnerNamespace, ScheduleOwnerProtocolError, SettlementReached, SubmitRequest, SubmitSucceeded, SubscriptionAlarmProtocolError, SubscriptionPartitionIdentity, SubscriptionPartitionNamespace, SubscriptionPartitionProtocolError, ThreadClientError, ThreadMaintenance, ThreadMaintenanceFailpoint, thread_object_exports as ThreadObject, ThreadObjectIdentity, ThreadObjectNamespace, ThreadObjectPorts, 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 };
1197
1207
 
1198
1208
  //# sourceMappingURL=index.mjs.map