@effect-agent/platform-cloudflare 0.1.0-beta.44 → 0.1.0-beta.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/Alarm.d.mts +119 -0
  2. package/dist/Alarm.mjs +317 -0
  3. package/dist/Alarm.mjs.map +1 -0
  4. package/dist/{browser-rest-capture.d.mts → BrowserRestCapture.d.mts} +5 -4
  5. package/dist/{browser-rest-capture.mjs → BrowserRestCapture.mjs} +5 -4
  6. package/dist/BrowserRestCapture.mjs.map +1 -0
  7. package/dist/{browser-rest-crawl.d.mts → BrowserRestCrawl.d.mts} +4 -3
  8. package/dist/{browser-rest-crawl.mjs → BrowserRestCrawl.mjs} +4 -3
  9. package/dist/BrowserRestCrawl.mjs.map +1 -0
  10. package/dist/{bindings-BrVEOkfe.d.mts → CloudflareBindings.d.mts} +7 -5
  11. package/dist/CloudflareBindings.mjs +98 -0
  12. package/dist/CloudflareBindings.mjs.map +1 -0
  13. package/dist/{browser-quick-action.mjs → CloudflareBrowser-1jeZx3_g.mjs} +19 -4
  14. package/dist/CloudflareBrowser-1jeZx3_g.mjs.map +1 -0
  15. package/dist/{browser-quick-action.d.mts → CloudflareBrowser-DJq53niJ.d.mts} +9 -18
  16. package/dist/CloudflareBrowser.d.mts +2 -0
  17. package/dist/CloudflareBrowser.mjs +2 -0
  18. package/dist/CloudflareCodeMode.d.mts +44 -0
  19. package/dist/CloudflareCodeMode.mjs +618 -0
  20. package/dist/CloudflareCodeMode.mjs.map +1 -0
  21. package/dist/CloudflareConfig-f3CqTel1.d.mts +101 -0
  22. package/dist/CloudflareConfig.d.mts +2 -0
  23. package/dist/CloudflareConfig.mjs +122 -0
  24. package/dist/CloudflareConfig.mjs.map +1 -0
  25. package/dist/CloudflareMemory.d.mts +140 -0
  26. package/dist/CloudflareMemory.mjs +168 -0
  27. package/dist/CloudflareMemory.mjs.map +1 -0
  28. package/dist/{scheduling.d.mts → CloudflareScheduling.d.mts} +9 -6
  29. package/dist/{scheduling.mjs → CloudflareScheduling.mjs} +22 -8
  30. package/dist/CloudflareScheduling.mjs.map +1 -0
  31. package/dist/{subscriptions.d.mts → CloudflareSubscriptions.d.mts} +11 -6
  32. package/dist/{subscriptions.mjs → CloudflareSubscriptions.mjs} +26 -7
  33. package/dist/CloudflareSubscriptions.mjs.map +1 -0
  34. package/dist/CloudflareThreadClient.d.mts +715 -0
  35. package/dist/CloudflareThreadClient.mjs +364 -0
  36. package/dist/CloudflareThreadClient.mjs.map +1 -0
  37. package/dist/{interactive-browser.d.mts → InteractiveBrowser.d.mts} +5 -4
  38. package/dist/{interactive-browser.mjs → InteractiveBrowser.mjs} +6 -4
  39. package/dist/InteractiveBrowser.mjs.map +1 -0
  40. package/dist/{protected-browser.d.mts → ProtectedBrowser.d.mts} +4 -3
  41. package/dist/{protected-browser.mjs → ProtectedBrowser.mjs} +4 -3
  42. package/dist/ProtectedBrowser.mjs.map +1 -0
  43. package/dist/ThreadObject-Ia94R_B1.d.mts +735 -0
  44. package/dist/ThreadObject-IrGuIO4a.mjs +575 -0
  45. package/dist/ThreadObject-IrGuIO4a.mjs.map +1 -0
  46. package/dist/ThreadObject.d.mts +2 -0
  47. package/dist/ThreadObject.mjs +3 -0
  48. package/dist/WakeScheduler.d.mts +23 -0
  49. package/dist/WakeScheduler.mjs +60 -0
  50. package/dist/WakeScheduler.mjs.map +1 -0
  51. package/dist/boundary-BguazVkh.mjs +42 -0
  52. package/dist/boundary-BguazVkh.mjs.map +1 -0
  53. package/dist/{browser-session-lifecycle-ZGgb3pnK.mjs → browser-session-lifecycle-CUbVfEgP.mjs} +2 -2
  54. package/dist/browser-session-lifecycle-CUbVfEgP.mjs.map +1 -0
  55. package/dist/{browser-session-lifecycle-DqntvG-Y.d.mts → browser-session-lifecycle-DJpqLXy_.d.mts} +2 -2
  56. package/dist/index.d.mts +12 -1833
  57. package/dist/index.mjs +12 -1357
  58. package/dist/prepared-admission-DRBhl2Sp.mjs +63 -0
  59. package/dist/prepared-admission-DRBhl2Sp.mjs.map +1 -0
  60. package/package.json +1 -1
  61. package/src/{alarm.ts → Alarm.ts} +265 -272
  62. package/src/{browser-rest-capture.ts → BrowserRestCapture.ts} +3 -3
  63. package/src/{browser-rest-crawl.ts → BrowserRestCrawl.ts} +2 -2
  64. package/src/{bindings.ts → CloudflareBindings.ts} +2 -2
  65. package/src/CloudflareBrowser.ts +15 -0
  66. package/src/{code-mode-executor.ts → CloudflareCodeMode.ts} +3 -3
  67. package/src/{config.ts → CloudflareConfig.ts} +3 -2
  68. package/src/{memory.ts → CloudflareMemory.ts} +15 -12
  69. package/src/{scheduling.ts → CloudflareScheduling.ts} +12 -11
  70. package/src/{subscriptions.ts → CloudflareSubscriptions.ts} +14 -12
  71. package/src/{client.ts → CloudflareThreadClient.ts} +27 -20
  72. package/src/{interactive-browser.ts → InteractiveBrowser.ts} +9 -5
  73. package/src/{thread-object.ts → ThreadObject.ts} +37 -29
  74. package/src/{wake-scheduler.ts → WakeScheduler.ts} +5 -5
  75. package/src/index.ts +11 -30
  76. package/src/{browser-quick-action.ts → internal/browser-quick-action.ts} +10 -8
  77. package/src/{layers.ts → internal/layers.ts} +42 -33
  78. package/src/{prepared-admission.ts → internal/prepared-admission.ts} +7 -7
  79. package/src/{transport.ts → internal/transport.ts} +5 -2
  80. package/src/protected-browser/binding.ts +3 -2
  81. package/src/protected-browser/native.ts +2 -2
  82. package/src/protected-browser/policy.ts +2 -2
  83. package/dist/browser-quick-action.mjs.map +0 -1
  84. package/dist/browser-rest-capture.mjs.map +0 -1
  85. package/dist/browser-rest-crawl.mjs.map +0 -1
  86. package/dist/browser-session-lifecycle-ZGgb3pnK.mjs.map +0 -1
  87. package/dist/index.mjs.map +0 -1
  88. package/dist/interactive-browser.mjs.map +0 -1
  89. package/dist/prepared-admission-BKp_Upw2.mjs +0 -890
  90. package/dist/prepared-admission-BKp_Upw2.mjs.map +0 -1
  91. package/dist/protected-browser.mjs.map +0 -1
  92. package/dist/scheduling.mjs.map +0 -1
  93. package/dist/subscriptions.mjs.map +0 -1
  94. /package/src/{protected-browser.ts → ProtectedBrowser.ts} +0 -0
  95. /package/src/{boundary.ts → internal/boundary.ts} +0 -0
  96. /package/src/{browser-session-lifecycle.ts → internal/browser-session-lifecycle.ts} +0 -0
  97. /package/src/{progress-wait.ts → internal/progress-wait.ts} +0 -0
@@ -0,0 +1,15 @@
1
+ /** Public CloudflareBrowser API. Implementation helpers remain private. */
2
+ export {
3
+ BrowserQuickActionBrowserBinding,
4
+ BrowserQuickActionRpcError,
5
+ BrowserQuickActionWorkersAi,
6
+ BrowserQuickActionWorkersAiPolicyError,
7
+ browserQuickActionCaptureLayer,
8
+ browserQuickActionWorkersAiCaptureLayer,
9
+ browserQuickActionScreenshotLayer,
10
+ CloudflareBrowser,
11
+ type BrowserQuickActionCaptureOptions,
12
+ type BrowserQuickActionClient,
13
+ type BrowserQuickActionWorkersAiPolicy,
14
+ type CloudflareBrowserOptions,
15
+ } from "./internal/browser-quick-action.ts";
@@ -14,14 +14,14 @@ import {
14
14
  CodeOutputLimitError,
15
15
  CodeProgramFailedError,
16
16
  CodeSourceError,
17
- SandboxImplementation,
18
17
  type CodeExecutorExecute,
19
18
  type CodeExecutionRequest,
20
- } from "@effect-agent/sandbox";
19
+ } from "@effect-agent/sandbox/CodeExecutor";
20
+ import { SandboxImplementation } from "@effect-agent/sandbox/Sandbox";
21
21
  import { RpcTarget } from "cloudflare:workers";
22
22
  import { Clock, Duration, Effect, Exit, Fiber, Layer, Option, Queue, Schema } from "effect";
23
23
 
24
- import { safeCauseDiagnostic, safeCauseMessage } from "./boundary.ts";
24
+ import { safeCauseDiagnostic, safeCauseMessage } from "./internal/boundary.ts";
25
25
 
26
26
  /**
27
27
  * The Cloudflare Dynamic Worker `CodeExecutor` adapter (C4 of ADR-0017;
@@ -1,5 +1,6 @@
1
- import { DEFAULT_MAX_STORED_VALUE_BYTES } from "@effect-agent/storage-cloudflare";
2
- import { DEFAULT_OWNERSHIP_LEASE_DURATION, DeploymentId } from "@effect-agent/thread";
1
+ import { DEFAULT_MAX_STORED_VALUE_BYTES } from "@effect-agent/storage-cloudflare/DoStorageConfig";
2
+ import { DeploymentId } from "@effect-agent/thread/Records";
3
+ import { DEFAULT_OWNERSHIP_LEASE_DURATION } from "@effect-agent/thread/SubmissionLedger";
3
4
  import { Context, Duration, Schema } from "effect";
4
5
 
5
6
  /**
@@ -1,27 +1,30 @@
1
+ import * as Memory from "@effect-agent/core/Memory";
2
+ import * as MemoryNamespace from "@effect-agent/core/MemoryNamespace";
3
+ import { MemoryNamespaceAddress } from "@effect-agent/core/MemoryNamespace";
4
+ import { type MemoryLookup, MemoryRecallLimits } from "@effect-agent/core/MemoryReference";
5
+ import { MemoryAccess } from "@effect-agent/core/MemoryRevalidation";
1
6
  import {
2
- type MemoryLookup,
3
7
  type MemoryReader,
4
8
  type MemoryWrite,
5
- Memory,
6
- MemoryAccess,
7
9
  MemoryDocument,
8
10
  MemoryMutationFailpoint,
9
- MemoryNamespace,
10
- MemoryNamespaceAddress,
11
- MemoryRecallLimits,
12
11
  MemoryStorageError,
13
12
  MemoryWriter,
13
+ } from "@effect-agent/core/MemoryStore";
14
+ import {
14
15
  type MemoryIndexSearch,
15
- type SemanticCandidateLimits,
16
16
  type SemanticMemoryProfile,
17
- } from "@effect-agent/core";
17
+ } from "@effect-agent/core/SemanticMemoryIndex";
18
+ import { type SemanticCandidateLimits } from "@effect-agent/core/SemanticMemoryRevalidation";
18
19
  import {
19
20
  type DoMemoryStorageLimits,
21
+ defaultDoMemoryStorageLimits,
22
+ doMemoryStoreLayerWithFailpoints,
23
+ } from "@effect-agent/storage-cloudflare/DoMemoryStore";
24
+ import {
20
25
  type MemoryOwnerAuthorizer,
21
26
  decodeMemoryWire,
22
- defaultDoMemoryStorageLimits,
23
27
  defaultMemoryRpcLimits,
24
- doMemoryStoreLayerWithFailpoints,
25
28
  encodeMemoryWire,
26
29
  handleMemoryOwnerRequest,
27
30
  MemoryOwnerIdentity,
@@ -30,8 +33,8 @@ import {
30
33
  MemoryRpcError,
31
34
  MemoryRpcLimits,
32
35
  type MemoryOwnerFailure,
33
- } from "@effect-agent/storage-cloudflare";
34
- import { Principal } from "@effect-agent/thread";
36
+ } from "@effect-agent/storage-cloudflare/MemoryProtocol";
37
+ import { Principal } from "@effect-agent/thread/SubmissionLedger";
35
38
  import { Clock, Context, Effect, Layer, Schema } from "effect";
36
39
  import {
37
40
  DurableObject as EffectCfDurableObject,
@@ -1,13 +1,12 @@
1
- import { AgentId } from "@effect-agent/core";
1
+ import { AgentId } from "@effect-agent/core/Identifiers";
2
2
  import {
3
3
  DoScheduleAlarmControl,
4
4
  DoScheduleTransaction,
5
5
  scheduleStoreLayer,
6
- } from "@effect-agent/storage-cloudflare";
6
+ } from "@effect-agent/storage-cloudflare/DoScheduleStore";
7
+ import { type DurableSubmitAgent } from "@effect-agent/thread/DurableAgentRuntime";
8
+ import { DefinitionDigests, PersistedJson } from "@effect-agent/thread/Records";
7
9
  import {
8
- DefinitionDigests,
9
- PersistedJson,
10
- type DurableSubmitAgent,
11
10
  ScheduleAuthorizationError,
12
11
  type ScheduleAuthorizer,
13
12
  ScheduleCapacityError,
@@ -25,13 +24,15 @@ import {
25
24
  ScheduleStorageError,
26
25
  ScheduleTimingRequest,
27
26
  ScheduleValidationError,
27
+ defaultSchedulingLimits,
28
+ } from "@effect-agent/thread/Schedule";
29
+ import { scheduleOwnerKey } from "@effect-agent/thread/ScheduleTransition";
30
+ import {
28
31
  Scheduling,
29
32
  ScheduleDriver,
30
33
  type ScheduleManagementFailure,
31
- defaultSchedulingLimits,
32
- scheduleOwnerKey,
33
34
  ScheduleWakeNoop,
34
- } from "@effect-agent/thread";
35
+ } from "@effect-agent/thread/Scheduling";
35
36
  import { BrowserCrypto } from "@effect/platform-browser";
36
37
  import { SqliteClient } from "@effect/sql-sqlite-do";
37
38
  import { Clock, Context, DateTime, Effect, Layer, Schema } from "effect";
@@ -42,12 +43,12 @@ import {
42
43
  type WorkerEnvironment,
43
44
  } from "effect-cf";
44
45
 
45
- import type { ThreadObjectNamespace } from "./bindings.ts";
46
- import { CloudflareThreadClient } from "./client.ts";
46
+ import type { ThreadObjectNamespace } from "./CloudflareBindings.ts";
47
+ import { CloudflareThreadClient } from "./CloudflareThreadClient.ts";
47
48
  import {
48
49
  cloudflarePreparedInputAdmissionLayer,
49
50
  cloudflareScheduledInputAdmissionLayer,
50
- } from "./prepared-admission.ts";
51
+ } from "./internal/prepared-admission.ts";
51
52
 
52
53
  const SCHEDULE_ALARM_TAG = "effect-agent/ScheduleOwnerWake";
53
54
  const SCHEDULE_ALARM_ID = "driver";
@@ -2,30 +2,32 @@ import {
2
2
  DoSubscriptionAlarmControl,
3
3
  DoSubscriptionTransaction,
4
4
  doSubscriptionStoreLayer,
5
- } from "@effect-agent/storage-cloudflare";
5
+ } from "@effect-agent/storage-cloudflare/DoSubscriptionStore";
6
+ import { type EventSources } from "@effect-agent/thread/EventSource";
7
+ import { PersistedJson } from "@effect-agent/thread/Records";
8
+ import { Principal } from "@effect-agent/thread/SubmissionLedger";
6
9
  import {
7
10
  EventAcknowledgement,
8
11
  EventSourceVersion,
9
- type EventSources,
10
- type SubscriptionInputBindings,
11
- PersistedJson,
12
- Principal,
13
12
  SourcePartition,
14
13
  type SubscriptionAuthorizer,
15
14
  SubscriptionConfiguration,
16
- SubscriptionDriver,
17
15
  SubscriptionDeliverySnapshot,
18
16
  SubscriptionError,
19
17
  SubscriptionFailpointError,
20
- SubscriptionIntake,
21
18
  SubscriptionKey,
22
19
  SubscriptionScope,
23
20
  type SubscriptionLimits,
24
21
  SubscriptionSnapshot,
25
22
  SubscriptionSourceError,
26
- Subscriptions,
27
23
  defaultSubscriptionLimits,
28
- } from "@effect-agent/thread";
24
+ } from "@effect-agent/thread/Subscription";
25
+ import { type SubscriptionInputBindings } from "@effect-agent/thread/SubscriptionInput";
26
+ import {
27
+ SubscriptionDriver,
28
+ SubscriptionIntake,
29
+ Subscriptions,
30
+ } from "@effect-agent/thread/Subscriptions";
29
31
  import { BrowserCrypto } from "@effect/platform-browser";
30
32
  import { SqliteClient } from "@effect/sql-sqlite-do";
31
33
  import { Cause, Clock, Context, DateTime, Effect, Layer, Schema } from "effect";
@@ -36,9 +38,9 @@ import {
36
38
  type WorkerEnvironment,
37
39
  } from "effect-cf";
38
40
 
39
- import { type ThreadObjectNamespace } from "./bindings.ts";
40
- import { CloudflareThreadClient } from "./client.ts";
41
- import { cloudflarePreparedInputAdmissionLayer } from "./prepared-admission.ts";
41
+ import { type ThreadObjectNamespace } from "./CloudflareBindings.ts";
42
+ import { CloudflareThreadClient } from "./CloudflareThreadClient.ts";
43
+ import { cloudflarePreparedInputAdmissionLayer } from "./internal/prepared-admission.ts";
42
44
 
43
45
  const SUBSCRIPTION_ALARM_TAG = "effect-agent/SubscriptionPartitionWake";
44
46
  const SUBSCRIPTION_ALARM_ID = "driver";
@@ -1,43 +1,50 @@
1
- import { AgentId, AgentInputError, type ThreadId } from "@effect-agent/core";
1
+ import { AgentInputError } from "@effect-agent/core/AgentError";
2
+ import { AgentId, type ThreadId } from "@effect-agent/core/Identifiers";
3
+ import { DigestError } from "@effect-agent/thread/Digest";
4
+ import {
5
+ Receipt,
6
+ type DurableSubmitAgent,
7
+ type DurableSubmitOptions,
8
+ } from "@effect-agent/thread/DurableAgentRuntime";
9
+ import { DurableRuntimeFailpointError } from "@effect-agent/thread/DurableFailpoint";
10
+ import { OperationDenied } from "@effect-agent/thread/OperationAuthorizer";
11
+ import {
12
+ CanonicalRecordEnvelope,
13
+ CanonicalSequence,
14
+ DefinitionDigests,
15
+ PersistedJson,
16
+ } from "@effect-agent/thread/Records";
2
17
  import {
3
18
  AbortCommand,
4
19
  AbortIntent,
5
20
  AdmissionConflict,
6
- AppendConflict,
7
21
  ApprovalConflict,
8
22
  ApprovalDecisionCommand,
9
23
  ApprovalDecisionIntent,
10
- CanonicalRecordEnvelope,
11
- CanonicalSequence,
12
- ThreadNotMaterialized,
13
- ThreadStoreError,
14
- DefinitionDigests,
15
- DigestError,
16
- DurableRuntimeFailpointError,
17
- FenceRejected,
18
24
  IdempotencyKey,
19
25
  JoinedToHost,
20
26
  LedgerError,
21
- OperationDenied,
22
- PersistedJson,
23
27
  Principal,
24
- Receipt,
25
28
  Settlement,
26
29
  SettlementConflict,
27
30
  UnknownResolutionCommand,
28
31
  UnknownResolutionConflict,
29
32
  UnknownResolutionIntent,
30
- type DurableSubmitAgent,
31
- type DurableSubmitOptions,
32
- } from "@effect-agent/thread";
33
+ } from "@effect-agent/thread/SubmissionLedger";
34
+ import {
35
+ AppendConflict,
36
+ ThreadNotMaterialized,
37
+ ThreadStoreError,
38
+ FenceRejected,
39
+ } from "@effect-agent/thread/ThreadStore";
33
40
  import { BrowserCrypto } from "@effect/platform-browser";
34
41
  import { Context, Crypto, Duration, Effect, Layer, Schema } from "effect";
35
42
  import { RpcTracing } from "effect-cf";
36
43
 
37
- import { DurableAlarmError } from "./alarm.ts";
38
- import { ThreadObjectNamespace, type ThreadObjectRpc } from "./bindings.ts";
39
- import { cloudflareFailureSignals, safeCauseMessage } from "./boundary.ts";
40
- import { AdmissionLimitExceeded } from "./config.ts";
44
+ import { DurableAlarmError } from "./Alarm.ts";
45
+ import { ThreadObjectNamespace, type ThreadObjectRpc } from "./CloudflareBindings.ts";
46
+ import { AdmissionLimitExceeded } from "./CloudflareConfig.ts";
47
+ import { cloudflareFailureSignals, safeCauseMessage } from "./internal/boundary.ts";
41
48
 
42
49
  /**
43
50
  * The Worker↔Thread-Object host protocol (plan §1.4): Schema envelopes for the host
@@ -24,12 +24,12 @@ import {
24
24
  InteractiveBrowserProtocolError,
25
25
  InteractiveBrowserTargetUrl,
26
26
  InteractiveBrowserUnsupportedError,
27
- PageScreenshotResult,
28
- SandboxImplementation,
29
27
  type BrowserHandle,
30
28
  type InteractiveBrowserError,
31
29
  type InteractiveBrowserNetworkPolicy,
32
- } from "@effect-agent/sandbox";
30
+ } from "@effect-agent/sandbox/InteractiveBrowser";
31
+ import { PageScreenshotResult } from "@effect-agent/sandbox/PageScreenshot";
32
+ import { SandboxImplementation } from "@effect-agent/sandbox/Sandbox";
33
33
  import {
34
34
  Context,
35
35
  Clock,
@@ -47,8 +47,12 @@ import {
47
47
  import {
48
48
  BrowserRunSessionLifecycle,
49
49
  type BrowserRunLifecycleOptions,
50
- } from "./browser-session-lifecycle.ts";
51
- export { BrowserRunCleanupError, BrowserRunSessionLifecycle } from "./browser-session-lifecycle.ts";
50
+ } from "./internal/browser-session-lifecycle.ts";
51
+
52
+ export {
53
+ BrowserRunCleanupError,
54
+ BrowserRunSessionLifecycle,
55
+ } from "./internal/browser-session-lifecycle.ts";
52
56
 
53
57
  export const browserRunInteractiveImplementation = SandboxImplementation.make({
54
58
  isolation: "isolated",
@@ -1,40 +1,48 @@
1
- import type { AgentId } from "@effect-agent/core";
2
- import { SubmissionId } from "@effect-agent/core";
1
+ import { type AgentId } from "@effect-agent/core/Identifiers";
2
+ import { SubmissionId } from "@effect-agent/core/Identifiers";
3
3
  import {
4
4
  decodePortRequest,
5
5
  encodePortResponse,
6
6
  type PortRequest,
7
- } from "@effect-agent/storage-cloudflare";
7
+ } from "@effect-agent/storage-cloudflare/PortProtocol";
8
8
  import {
9
- AppendConflict,
10
- ThreadNotMaterialized,
11
- ThreadRead,
12
- ThreadStore,
13
- ThreadStoreError,
14
- DigestError,
15
- DurableAgentRuntime,
16
- DurableRuntimeFailpointError,
17
- FenceRejected,
18
9
  IntegrityReport,
19
- LedgerError,
20
10
  ObligationReport,
21
11
  ObligationThresholds,
12
+ RecoveryExplanation,
13
+ RetryCommand,
14
+ RetryRefused,
15
+ } from "@effect-agent/thread/Admin";
16
+ import { DigestError } from "@effect-agent/thread/Digest";
17
+ import {
18
+ DurableAgentRuntime,
19
+ RecoveryReport,
20
+ type DurableSubmitAgent,
21
+ } from "@effect-agent/thread/DurableAgentRuntime";
22
+ import { DurableRuntimeFailpointError } from "@effect-agent/thread/DurableFailpoint";
23
+ import {
22
24
  OperationAuthorizationRequest,
23
25
  OperationAuthorizer,
24
26
  OperationDenied,
27
+ } from "@effect-agent/thread/OperationAuthorizer";
28
+ import { PersistedJson } from "@effect-agent/thread/Records";
29
+ import { RunJournalError } from "@effect-agent/thread/RunJournal";
30
+ import {
31
+ LedgerError,
25
32
  OwnershipLost,
26
- PersistedJson,
27
- RecoveryExplanation,
28
- RecoveryReport,
29
- RetryCommand,
30
- RetryRefused,
31
- RunJournalError,
32
33
  SettlementConflict,
33
34
  SubmissionLedger,
34
35
  SubmissionLookupByKey,
35
- WakeScheduler,
36
- type DurableSubmitAgent,
37
- } from "@effect-agent/thread";
36
+ } from "@effect-agent/thread/SubmissionLedger";
37
+ import {
38
+ AppendConflict,
39
+ ThreadNotMaterialized,
40
+ ThreadRead,
41
+ ThreadStore,
42
+ ThreadStoreError,
43
+ FenceRejected,
44
+ } from "@effect-agent/thread/ThreadStore";
45
+ import { WakeScheduler } from "@effect-agent/thread/WakeScheduler";
38
46
  import { Effect, Layer, Option, Schema, Stream } from "effect";
39
47
  import {
40
48
  DurableObject as EffectCfDurableObject,
@@ -47,14 +55,15 @@ import {
47
55
  DurableAlarmError,
48
56
  DurableAlarmService,
49
57
  type MaintenancePassFailure,
50
- } from "./alarm.ts";
58
+ } from "./Alarm.ts";
51
59
  import {
52
60
  ThreadObjectIdentity,
53
61
  DurableObjectContext,
54
62
  ThreadObjectNamespace,
55
63
  threadNamespaceFromEnv,
56
64
  type CloudflareBindingError,
57
- } from "./bindings.ts";
65
+ } from "./CloudflareBindings.ts";
66
+ import { AdmissionLimitExceeded, CloudflareDurableRuntimeConfig } from "./CloudflareConfig.ts";
58
67
  import {
59
68
  AbortRecorded,
60
69
  ApprovalRecorded,
@@ -78,8 +87,7 @@ import {
78
87
  encodeHostResponse,
79
88
  type HostFailure,
80
89
  type HostResponse,
81
- } from "./client.ts";
82
- import { AdmissionLimitExceeded, CloudflareDurableRuntimeConfig } from "./config.ts";
90
+ } from "./CloudflareThreadClient.ts";
83
91
  import {
84
92
  layerConfig,
85
93
  ThreadObjectPorts,
@@ -87,8 +95,8 @@ import {
87
95
  type CloudflareDurableRuntimeOptions,
88
96
  type CloudflareDurableRuntimeServices,
89
97
  type CloudflareBootstrapServices,
90
- } from "./layers.ts";
91
- import { ProgressWaitRegistry } from "./progress-wait.ts";
98
+ } from "./internal/layers.ts";
99
+ import { ProgressWaitRegistry } from "./internal/progress-wait.ts";
92
100
 
93
101
  export {
94
102
  layer,
@@ -97,7 +105,7 @@ export {
97
105
  type CloudflareDurableRuntimeServices as Services,
98
106
  type CloudflareDurableRuntimeInitializationError as InitializationError,
99
107
  type CloudflareBootstrapServices as BootstrapServices,
100
- } from "./layers.ts";
108
+ } from "./internal/layers.ts";
101
109
 
102
110
  /**
103
111
  * `ThreadObject.make(application, options)` — the Thread Durable Object
@@ -1,10 +1,10 @@
1
- import type { ThreadId } from "@effect-agent/core";
2
- import { makeWakeSubscriptionHub, WakeScheduler } from "@effect-agent/thread";
1
+ import { type ThreadId } from "@effect-agent/core/Identifiers";
2
+ import { makeWakeSubscriptionHub, WakeScheduler } from "@effect-agent/thread/WakeScheduler";
3
3
  import { Effect, Layer, PubSub, Schema, Stream } from "effect";
4
4
 
5
- import { DurableAlarmService } from "./alarm.ts";
6
- import { ThreadObjectIdentity, ThreadObjectNamespace } from "./bindings.ts";
7
- import { safeCauseMessage } from "./boundary.ts";
5
+ import { DurableAlarmService } from "./Alarm.ts";
6
+ import { ThreadObjectIdentity, ThreadObjectNamespace } from "./CloudflareBindings.ts";
7
+ import { safeCauseMessage } from "./internal/boundary.ts";
8
8
 
9
9
  /**
10
10
  * Bounded in-memory wake buffer for same-incarnation `awaitSettlement` subscribers. Wake
package/src/index.ts CHANGED
@@ -1,30 +1,11 @@
1
- /**
2
- * `@effect-agent/platform-cloudflare` the Cloudflare Layer-assembly library for deployment
3
- * class DC (deployment spec §12: a Layer-assembly library, not an application entrypoint).
4
- *
5
- * One SQLite-backed Durable Object per Thread is the serialized owner (durability §6):
6
- * `ThreadObject.make` builds the class applications export from their Worker,
7
- * `ThreadObject.layer` assembles the coordinator over the storage-cloudflare
8
- * adapters and the WP2 cross-Object routing, `DurableAlarmService`/`ThreadMaintenance`
9
- * multiplex every cadence into the Object's single alarm slot (dirty or autonomously
10
- * actionable work retains a committed alarm; stable external waits quiesce until their next
11
- * durably pre-armed mutation), and
12
- * `CloudflareThreadClient` is the Worker-side ingress. Platform bindings enter ONLY
13
- * through the `bindings.ts` Layers (DEPLOY-010). This is the only workspace package allowed
14
- * to import the `cloudflare:workers` runtime module.
15
- */
16
- export * from "./bindings.ts";
17
- export * from "./config.ts";
18
- export * from "./alarm.ts";
19
- export * from "./wake-scheduler.ts";
20
- export * from "./progress-wait.ts";
21
- export * from "./transport.ts";
22
- export { layerFromBindings, ThreadObjectPorts } from "./layers.ts";
23
- export * as ThreadObject from "./thread-object.ts";
24
- export * from "./client.ts";
25
- export * from "./prepared-admission.ts";
26
- export * from "./scheduling.ts";
27
- export * from "./subscriptions.ts";
28
- export * from "./code-mode-executor.ts";
29
- export { CloudflareBrowser, type CloudflareBrowserOptions } from "./browser-quick-action.ts";
30
- export * from "./memory.ts";
1
+ export * as Alarm from "./Alarm.ts";
2
+ export * as CloudflareBindings from "./CloudflareBindings.ts";
3
+ export * as CloudflareBrowser from "./CloudflareBrowser.ts";
4
+ export * as CloudflareCodeMode from "./CloudflareCodeMode.ts";
5
+ export * as CloudflareConfig from "./CloudflareConfig.ts";
6
+ export * as CloudflareMemory from "./CloudflareMemory.ts";
7
+ export * as CloudflareScheduling from "./CloudflareScheduling.ts";
8
+ export * as CloudflareSubscriptions from "./CloudflareSubscriptions.ts";
9
+ export * as CloudflareThreadClient from "./CloudflareThreadClient.ts";
10
+ export * as ThreadObject from "./ThreadObject.ts";
11
+ export * as WakeScheduler from "./WakeScheduler.ts";
@@ -11,24 +11,26 @@ import {
11
11
  PageCaptureResourceUse,
12
12
  PageCaptureResult,
13
13
  PageCaptureUnsupportedError,
14
- PageScreenshot,
15
- PageScreenshotOutputLimitError,
16
- PageScreenshotResult,
17
- type PageScreenshotCapture,
18
- type PageScreenshotError,
19
- type PageScreenshotRequest,
20
14
  PageContentCaptured,
21
15
  PageLinksCaptured,
22
16
  PageMarkdownCaptured,
23
17
  PageScrapeCaptured,
24
18
  PageStructuredCaptured,
25
- SandboxImplementation,
26
19
  type PageCaptureAction,
27
20
  type PageCaptureCapture,
28
21
  type PageCaptureError,
29
22
  type PageCaptureOutput,
30
23
  type PageCaptureRequest,
31
- } from "@effect-agent/sandbox";
24
+ } from "@effect-agent/sandbox/PageCapture";
25
+ import {
26
+ PageScreenshot,
27
+ PageScreenshotOutputLimitError,
28
+ PageScreenshotResult,
29
+ type PageScreenshotCapture,
30
+ type PageScreenshotError,
31
+ type PageScreenshotRequest,
32
+ } from "@effect-agent/sandbox/PageScreenshot";
33
+ import { SandboxImplementation } from "@effect-agent/sandbox/Sandbox";
32
34
  import { Context, Effect, Layer, Option, Schema } from "effect";
33
35
 
34
36
  /**
@@ -1,47 +1,56 @@
1
- import { ThreadId } from "@effect-agent/core";
2
- import type {
3
- RunContextPreparation,
4
- RunCostEstimator,
5
- RunToolFailureObserver,
6
- } from "@effect-agent/engine";
1
+ import { ThreadId } from "@effect-agent/core/Identifiers";
2
+ import {
3
+ type RunContextPreparation,
4
+ type RunCostEstimator,
5
+ type RunToolFailureObserver,
6
+ } from "@effect-agent/engine/RunOptions";
7
7
  import {
8
8
  CurrentToolFailureObserver,
9
9
  RunContextPreparationPassthrough,
10
10
  RunToolAuthorization,
11
11
  toolFailureObserverLayer,
12
- } from "@effect-agent/engine";
12
+ } from "@effect-agent/engine/RunOptions";
13
+ import {
14
+ type DoStorageFailpointHandler,
15
+ type DoStorageFailpoint,
16
+ } from "@effect-agent/storage-cloudflare/DoStorageFailpoint";
17
+ import { submissionLedgerLayer } from "@effect-agent/storage-cloudflare/DoSubmissionLedger";
13
18
  import {
14
19
  threadStoreLayer,
15
- executePortRequest,
16
- routedThreadStoreLayer,
17
- routedSubmissionLedgerLayer,
18
20
  storageConfigLayer,
19
21
  storageFailpointLayer,
20
- submissionLedgerLayer,
21
- type DoStorageFailpointHandler,
22
22
  type DoStorageInitializationError,
23
23
  type DoStorageOptions,
24
- type DoStorageFailpoint,
25
- type PortRequest,
26
- type PortResponse,
27
- } from "@effect-agent/storage-cloudflare";
24
+ } from "@effect-agent/storage-cloudflare/DoThreadStore";
25
+ import { type PortRequest, type PortResponse } from "@effect-agent/storage-cloudflare/PortProtocol";
26
+ import {
27
+ executePortRequest,
28
+ routedThreadStoreLayer,
29
+ routedSubmissionLedgerLayer,
30
+ } from "@effect-agent/storage-cloudflare/PortRouting";
28
31
  import {
29
32
  compileRegistrations,
33
+ type AgentRegistration,
34
+ type ResolvedBinding,
35
+ } from "@effect-agent/thread/AgentRegistration";
36
+ import { type DigestError } from "@effect-agent/thread/Digest";
37
+ import {
30
38
  DurableAgentRuntime,
31
39
  DurableRuntimeConfig,
40
+ } from "@effect-agent/thread/DurableAgentRuntime";
41
+ import {
32
42
  DurableRuntimeFailpoint,
33
- ProducerId,
34
- operationAuthorizerLayer,
35
- ToolReconciler,
36
- type AgentRegistration,
37
- type ThreadStore,
38
- type DigestError,
39
43
  type DurableRuntimeFailpointHandler,
44
+ } from "@effect-agent/thread/DurableFailpoint";
45
+ import {
46
+ operationAuthorizerLayer,
40
47
  type OperationAuthorizerService,
41
- type ResolvedBinding,
42
- type SubmissionLedger,
43
- type WakeScheduler,
44
- } from "@effect-agent/thread";
48
+ } from "@effect-agent/thread/OperationAuthorizer";
49
+ import { ProducerId } from "@effect-agent/thread/Records";
50
+ import { type SubmissionLedger } from "@effect-agent/thread/SubmissionLedger";
51
+ import { type ThreadStore } from "@effect-agent/thread/ThreadStore";
52
+ import { ToolReconciler } from "@effect-agent/thread/ToolReconciler";
53
+ import { type WakeScheduler } from "@effect-agent/thread/WakeScheduler";
45
54
  import { BrowserCrypto } from "@effect/platform-browser";
46
55
  import { SqliteClient } from "@effect/sql-sqlite-do";
47
56
  import type { Crypto } from "effect";
@@ -52,25 +61,25 @@ import {
52
61
  ThreadMaintenanceFailpoint,
53
62
  DurableAlarmService,
54
63
  type ThreadMaintenanceFailpointHandler,
55
- } from "./alarm.ts";
64
+ } from "../Alarm.ts";
56
65
  import {
57
66
  ThreadObjectIdentity,
58
67
  DurableObjectContext,
59
68
  type ThreadObjectNamespace,
60
- } from "./bindings.ts";
69
+ } from "../CloudflareBindings.ts";
61
70
  import {
62
71
  CLOUDFLARE_RUNTIME_DEFAULTS,
63
72
  CloudflareDurableRuntimeConfig,
64
73
  CloudflareDurableRuntimeConfigValue,
65
74
  CloudflarePlatformConfigError,
66
- } from "./config.ts";
75
+ } from "../CloudflareConfig.ts";
76
+ import { cloudflareWakeSchedulerLayer } from "../WakeScheduler.ts";
67
77
  import { ProgressWaitRegistry } from "./progress-wait.ts";
68
78
  import { threadPortTransportLayer } from "./transport.ts";
69
- import { cloudflareWakeSchedulerLayer } from "./wake-scheduler.ts";
70
79
 
71
80
  /**
72
81
  * Raw (unvalidated) construction options for `ThreadObject.make`, mirroring
73
- * `NodeDurableRuntimeOptions`. Optional fields default to the documented production values
82
+ * `NodeDurableAgentRuntimeOptions`. Optional fields default to the documented production values
74
83
  * (`CLOUDFLARE_RUNTIME_DEFAULTS`); everything is schema-decoded into
75
84
  * `CloudflareDurableRuntimeConfigValue` before any resource opens (deployment §5 gate 1).
76
85
  */
@@ -367,7 +376,7 @@ export const layerFromBindings = (
367
376
 
368
377
  const base = Layer.mergeAll(DurableAlarmService.layer, ProgressWaitRegistry.layer);
369
378
 
370
- const runtimeStack = DurableAgentRuntime.layerWithServices.pipe(
379
+ const runtimeStack = DurableAgentRuntime.layerWithBindings(bindings).pipe(
371
380
  Layer.provideMerge(routedPorts),
372
381
  Layer.provideMerge(cloudflareWakeSchedulerLayer),
373
382
  Layer.provideMerge(base),
@@ -375,7 +384,7 @@ export const layerFromBindings = (
375
384
 
376
385
  return Layer.mergeAll(
377
386
  runtimeStack,
378
- ThreadMaintenance.layer(bindings).pipe(Layer.provide(runtimeStack)),
387
+ ThreadMaintenance.layer.pipe(Layer.provide(runtimeStack)),
379
388
  portsEndpointLayer,
380
389
  );
381
390
  }),