effect-durable-agent 0.1.0-alpha.1 → 0.1.0-alpha.10

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 (183) hide show
  1. package/README.md +140 -136
  2. package/dist/{command-queues-CQ9cwRP7.d.ts → command-queues-CQi4Xc7u.d.ts} +109 -21
  3. package/dist/{commands-Ce1ec6kH.d.ts → commands-p8venTWs.d.ts} +10 -2
  4. package/dist/compaction-0k8zCJgB.js +473 -0
  5. package/dist/compaction-0k8zCJgB.js.map +1 -0
  6. package/dist/{compaction-YayFKo_1.d.ts → compaction-BhLSSXJ-.d.ts} +28 -7
  7. package/dist/context-projection-mCuvcO2W.d.ts +140 -0
  8. package/dist/{core-Hv3cFydL.d.ts → core-C-6xHzRx.d.ts} +6 -3
  9. package/dist/domain/command-queues.d.ts +1 -1
  10. package/dist/domain/command-queues.js +1 -1
  11. package/dist/domain/command-queues.js.map +1 -1
  12. package/dist/domain/context-projection.d.ts +2 -0
  13. package/dist/domain/context-projection.js +32 -0
  14. package/dist/domain/context-projection.js.map +1 -0
  15. package/dist/domain/message-transcript.d.ts +1 -1
  16. package/dist/domain/model-usage.d.ts +2 -0
  17. package/dist/domain/model-usage.js +59 -0
  18. package/dist/domain/model-usage.js.map +1 -0
  19. package/dist/domain/reduced-state-schema.d.ts +14 -18
  20. package/dist/domain/reduced-state-schema.js +7 -11
  21. package/dist/domain/reduced-state-schema.js.map +1 -1
  22. package/dist/domain/reduced-state.d.ts +3 -2
  23. package/dist/domain/reduced-state.js +3 -2
  24. package/dist/domain/run-scheduling.d.ts +2 -0
  25. package/dist/domain/run-scheduling.js +127 -0
  26. package/dist/domain/run-scheduling.js.map +1 -0
  27. package/dist/{durable-C3Rz7kg3.js → durable-BPHVFVvV.js} +74 -83
  28. package/dist/durable-BPHVFVvV.js.map +1 -0
  29. package/dist/{durable-DlScwmCy.d.ts → durable-DeLCAvbw.d.ts} +1256 -104
  30. package/dist/envelope-DkZyMIgp.d.ts +191 -0
  31. package/dist/envelope-DxQzo5rN.js +82 -0
  32. package/dist/envelope-DxQzo5rN.js.map +1 -0
  33. package/dist/{keep-alive-DYDsH6qN.d.ts → event-factory-KaeDSfeP.d.ts} +11 -31
  34. package/dist/{keep-alive-p8dIcSVy.js → event-factory-QuC_UvyP.js} +8 -10
  35. package/dist/event-factory-QuC_UvyP.js.map +1 -0
  36. package/dist/{events-Bb9-Cu-7.d.ts → events-LZFNoESe.d.ts} +2 -188
  37. package/dist/{id-generator-C2Q15uZM.d.ts → id-generator--x6itQZ2.d.ts} +3 -2
  38. package/dist/index.d.ts +7 -6
  39. package/dist/index.js +5 -4
  40. package/dist/keep-alive-Chl5SJxy.d.ts +29 -0
  41. package/dist/{message-transcript-BCHdHAe2.d.ts → message-transcript-6PEzaEGn.d.ts} +4 -4
  42. package/dist/model-resolver-BPPJAsuh.d.ts +18 -0
  43. package/dist/model-usage-CdBEkTwU.d.ts +55 -0
  44. package/dist/{prompt-projector-9_02lk5-.d.ts → prompt-projector-CNhqUsEr.d.ts} +15 -16
  45. package/dist/{reduced-state-C4nVVzz9.js → reduced-state-Bz68V2H8.js} +65 -32
  46. package/dist/reduced-state-Bz68V2H8.js.map +1 -0
  47. package/dist/{reducer-registry-C0svUa63.d.ts → reducer-registry-CCSzc4h8.d.ts} +16 -6
  48. package/dist/run-scheduler-DcS_okUH.d.ts +43 -0
  49. package/dist/run-scheduling-wakeup-CeHrvXie.d.ts +25 -0
  50. package/dist/{runtime-C56FQxiL.d.ts → runtime-WL_gKqxn.d.ts} +16 -7
  51. package/dist/services/compaction.d.ts +1 -1
  52. package/dist/services/compaction.js +1 -425
  53. package/dist/services/id-generator.d.ts +1 -1
  54. package/dist/services/id-generator.js +2 -1
  55. package/dist/services/id-generator.js.map +1 -1
  56. package/dist/services/keep-alive.d.ts +2 -0
  57. package/dist/services/keep-alive.js +13 -0
  58. package/dist/services/keep-alive.js.map +1 -0
  59. package/dist/services/model-resolver.d.ts +2 -0
  60. package/dist/services/model-resolver.js +17 -0
  61. package/dist/services/model-resolver.js.map +1 -0
  62. package/dist/services/prompt-projector.d.ts +2 -2
  63. package/dist/services/prompt-projector.js +20 -10
  64. package/dist/services/prompt-projector.js.map +1 -1
  65. package/dist/services/reducer-registry.d.ts +2 -2
  66. package/dist/services/reducer-registry.js +7 -3
  67. package/dist/services/reducer-registry.js.map +1 -1
  68. package/dist/services/run-scheduler.d.ts +3 -0
  69. package/dist/services/run-scheduler.js +25 -0
  70. package/dist/services/run-scheduler.js.map +1 -0
  71. package/dist/services/run-scheduling-wakeup.d.ts +2 -0
  72. package/dist/services/run-scheduling-wakeup.js +13 -0
  73. package/dist/services/run-scheduling-wakeup.js.map +1 -0
  74. package/dist/services/runtime-layer.d.ts +67 -0
  75. package/dist/services/runtime-layer.js +47 -0
  76. package/dist/services/runtime-layer.js.map +1 -0
  77. package/dist/services/runtime.d.ts +1 -1
  78. package/dist/services/runtime.js +21 -14
  79. package/dist/services/runtime.js.map +1 -1
  80. package/dist/services/session-event-observer.d.ts +2 -0
  81. package/dist/services/session-event-observer.js +13 -0
  82. package/dist/services/session-event-observer.js.map +1 -0
  83. package/dist/services/session-query.d.ts +2 -2
  84. package/dist/services/session-query.js +140 -1
  85. package/dist/services/session-query.js.map +1 -0
  86. package/dist/services/session-state.d.ts +2 -0
  87. package/dist/services/session-state.js +2 -0
  88. package/dist/services/session-store.d.ts +2 -2
  89. package/dist/services/session-store.js +182 -2
  90. package/dist/services/session-store.js.map +1 -0
  91. package/dist/services/sink-checkpoint-store.d.ts +2 -0
  92. package/dist/services/sink-checkpoint-store.js +49 -0
  93. package/dist/services/sink-checkpoint-store.js.map +1 -0
  94. package/dist/services/sink-registry.d.ts +1 -1
  95. package/dist/services/sink-registry.js +1 -1
  96. package/dist/services/span-names.d.ts +1 -1
  97. package/dist/services/span-names.js +3 -0
  98. package/dist/services/span-names.js.map +1 -1
  99. package/dist/services/tool-registry.d.ts +1 -1
  100. package/dist/services/tracing.d.ts +1 -1
  101. package/dist/services/tracing.js +23 -2
  102. package/dist/services/tracing.js.map +1 -1
  103. package/dist/session-event-observer-DaFMKKNc.d.ts +24 -0
  104. package/dist/session-query-DfW_4KC0.d.ts +47 -0
  105. package/dist/{session-query-DOc1KanA.js → session-state-BIZ2SYaP.js} +350 -183
  106. package/dist/session-state-BIZ2SYaP.js.map +1 -0
  107. package/dist/{session-query-DlRo5Ufc.d.ts → session-state-BeR2rZRR.d.ts} +144 -46
  108. package/dist/{session-store-D2Ore1QC.d.ts → session-store-J_Un45kW.d.ts} +7 -96
  109. package/dist/sink-checkpoint-store-C9hUxfH0.d.ts +40 -0
  110. package/dist/{sink-registry-CFC6xjsN.js → sink-registry-Bbqhtdnx.js} +27 -67
  111. package/dist/sink-registry-Bbqhtdnx.js.map +1 -0
  112. package/dist/{sink-registry-CIU0LD3m.d.ts → sink-registry-DuDkNXjZ.d.ts} +24 -49
  113. package/dist/testkit/layers.d.ts +24 -14
  114. package/dist/testkit/layers.js +18 -11
  115. package/dist/testkit/layers.js.map +1 -1
  116. package/dist/{tool-registry-CcnkAAQK.d.ts → tool-registry-BDmJe_Wr.d.ts} +4 -4
  117. package/dist/types/commands.d.ts +2 -2
  118. package/dist/types/commands.js +7 -2
  119. package/dist/types/commands.js.map +1 -1
  120. package/dist/types/core.d.ts +2 -2
  121. package/dist/types/core.js +4 -2
  122. package/dist/types/core.js.map +1 -1
  123. package/dist/types/events/durable.d.ts +2 -2
  124. package/dist/types/events/durable.js +2 -2
  125. package/dist/types/events.d.ts +4 -3
  126. package/dist/types/events.js +3 -2
  127. package/dist/types/events.js.map +1 -1
  128. package/dist/websocket.d.ts +2776 -0
  129. package/dist/websocket.js +498 -0
  130. package/dist/websocket.js.map +1 -0
  131. package/package.json +68 -43
  132. package/testing/offline-trace/README.md +2 -1
  133. package/CHANGELOG.md +0 -10
  134. package/CONTRIBUTING.md +0 -26
  135. package/SECURITY.md +0 -8
  136. package/dist/durable-C3Rz7kg3.js.map +0 -1
  137. package/dist/durable-object-runtime-B7jwBY2R.js +0 -1494
  138. package/dist/durable-object-runtime-B7jwBY2R.js.map +0 -1
  139. package/dist/durable-object-runtime-pWv0ohlz.d.ts +0 -257
  140. package/dist/durable-object-storage-Czy7IPrh.d.ts +0 -41
  141. package/dist/host/durable-object-runtime.d.ts +0 -2
  142. package/dist/host/durable-object-runtime.js +0 -2
  143. package/dist/host/durable-object-storage.d.ts +0 -2
  144. package/dist/host/durable-object-storage.js +0 -0
  145. package/dist/host/durable-object.d.ts +0 -83
  146. package/dist/host/durable-object.js +0 -191
  147. package/dist/host/durable-object.js.map +0 -1
  148. package/dist/host/websocket-wire.d.ts +0 -2
  149. package/dist/host/websocket-wire.js +0 -88
  150. package/dist/host/websocket-wire.js.map +0 -1
  151. package/dist/keep-alive-p8dIcSVy.js.map +0 -1
  152. package/dist/reduced-state-C4nVVzz9.js.map +0 -1
  153. package/dist/services/compaction.js.map +0 -1
  154. package/dist/session-query-DOc1KanA.js.map +0 -1
  155. package/dist/session-store-pYxQW9qh.js +0 -214
  156. package/dist/session-store-pYxQW9qh.js.map +0 -1
  157. package/dist/sink-registry-CFC6xjsN.js.map +0 -1
  158. package/dist/websocket-wire-DvOu_6BJ.d.ts +0 -16773
  159. package/docs/assets/architecture.svg +0 -106
  160. package/docs/assets/event-sequence.svg +0 -143
  161. package/docs/assets/gcp-trace.png +0 -0
  162. package/docs/message-steering.md +0 -831
  163. package/docs/releasing.md +0 -57
  164. package/docs/spec.md +0 -774
  165. package/docs/subagents.md +0 -725
  166. package/docs/testing.md +0 -64
  167. package/docs/ui-projection.md +0 -742
  168. package/docs/websocket-protocol.md +0 -613
  169. package/examples/001-no-tools/README.md +0 -65
  170. package/examples/001-no-tools/worker.ts +0 -79
  171. package/examples/002-slack-bridge/README.md +0 -134
  172. package/examples/002-slack-bridge/events.ts +0 -115
  173. package/examples/002-slack-bridge/reducer.ts +0 -216
  174. package/examples/002-slack-bridge/scenario.test.ts +0 -223
  175. package/examples/002-slack-bridge/sinks.ts +0 -109
  176. package/examples/002-slack-bridge/worker.ts +0 -140
  177. package/examples/003-sandbox-lifecycle/README.md +0 -78
  178. package/examples/003-sandbox-lifecycle/events.ts +0 -203
  179. package/examples/003-sandbox-lifecycle/reducer.ts +0 -305
  180. package/examples/003-sandbox-lifecycle/scenario.test.ts +0 -202
  181. package/examples/_shared/event-id.ts +0 -12
  182. package/examples/_shared/http.ts +0 -27
  183. package/examples/_shared/openai.ts +0 -33
package/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # effect-durable-agent
2
2
 
3
- > EDA is a Redux-inspired durable state-management layer for agentic applications, hosted on
4
- [Cloudflare Durable Objects](https://developers.cloudflare.com/durable-objects/).
3
+ > ## EDA is a redux-inspired durable agent framework hosted on [Durable Objects](https://developers.cloudflare.com/durable-objects/) and [celld](https://celld.dev/)
4
+
5
+ [![npm version](https://img.shields.io/npm/v/effect-durable-agent)](https://www.npmjs.com/package/effect-durable-agent)
6
+ [![CI](https://github.com/advait/effect-durable-agent/actions/workflows/ci.yml/badge.svg)](https://github.com/advait/effect-durable-agent/actions/workflows/ci.yml)
5
7
 
6
8
  ## Why?
7
9
 
@@ -14,16 +16,12 @@ Tool execution constantly changes what that application needs to represent: `San
14
16
  event that transitions the application's state machine**. Product state and agent state coexist in
15
17
  the same event sequence.
16
18
 
17
- Your application describes how events like `SandboxStarted` and `ApprovalRequested` change its
18
- state. EDA records them in one durable history, giving agent state and product state a shared source
19
- of truth. It streams those same events to clients. Each client uses them to update its local state,
20
- so every view converges on the durable session state—even across tabs and reconnects.
21
-
22
- ## One state machine for the whole application
19
+ ## How EDA works
23
20
 
24
- For example, a coding-agent session might record:
21
+ EDA models the agent and the surrounding product as one application state machine. For example, a
22
+ coding-agent session might record:
25
23
 
26
- ![An ordered EDA session history. Blue events belong to the EDA framework; orange events belong to the application.](./docs/assets/event-sequence.svg)
24
+ ![An ordered EDA session history where framework and application events share one sequence.](https://raw.githubusercontent.com/advait/effect-durable-agent/master/docs/assets/event-sequence.svg)
27
25
 
28
26
  Framework events and product events are not separate channels. They form the same history and
29
27
  transition the same application state.
@@ -38,161 +36,165 @@ EDA supplies the framework events and reducers for commands, runs, turns, messag
38
36
  tool calls. Applications add their own typed events and reducers for sandboxes, approvals, billing,
39
37
  external conversations, delivery state, or anything else the product needs to represent.
40
38
 
41
- ## What this unlocks
39
+ Those events flow through the rest of the system as follows:
42
40
 
43
- ### Live state on every client
41
+ ![A numbered guide to EDA architecture: 1, commands enter the session runtime; 2, durable transitions form an ordered event log; 3, clients follow the live event stream; 4, pure reducers derive state; 5, state captures agent and product lifecycles; 6, pure UI and LLM context projections shape state for different consumers; 7, durable sinks deliver events to external systems.](https://raw.githubusercontent.com/advait/effect-durable-agent/master/docs/assets/architecture.svg)
44
42
 
45
- EDA exposes serialized reducer snapshots and streams the ordered session history over a
46
- reconnect-safe WebSocket protocol. In a server-side rendering (SSR) flow, the server renders state
47
- through sequence `N`; the browser hydrates from that snapshot, follows events after `N`, and applies
48
- its application projection as they arrive.
49
-
50
- ```text
51
- server snapshot through N
52
- +
53
- streamed events after N
54
- =
55
- current client state
56
- ```
43
+ ### 1. Session runtime: one state machine for the entire application
57
44
 
58
- Every tab, embedded surface, or admin view follows the same durable session. Slow and disconnected
59
- clients catch up from their last acknowledged sequence instead of guessing which updates they
60
- missed.
45
+ User commands and application events enter one centralized session runtime. It manages the entire
46
+ application state machine: agent lifecycles such as runs, inference, and tool calls coexist with
47
+ product lifecycles such as sandboxes, approvals, and external delivery.
61
48
 
62
- ### Durable side effects
49
+ Every transition therefore has one owner and one place to be recorded, rather than leaving session
50
+ state scattered across callbacks, workers, and unrelated stores.
63
51
 
64
- EDA makes side effects durable.
52
+ ### 2. Ordered event log: the definitive history of the state machine
65
53
 
66
- If `AssistantMessageCommitted` should post a result to Slack and Slack is temporarily unavailable,
67
- EDA retains the event and retries the delivery instead of losing it inside a failed callback.
68
- Durable sinks run independently of the main agent loop, preserve event order, and converge
69
- eventually. Each sink tracks its own persisted cursor, advances only after successful processing,
70
- and retries failures with backoff.
54
+ When the state machine transitions, EDA records an event durably and assigns it the next sequence
55
+ number for that session. Read in order, those events definitively describe how the application
56
+ evolved.
71
57
 
72
- Delivery is at-least-once, so external operations still need stable idempotency keys. The important
73
- guarantee is that a transient process or network failure does not silently erase the work.
58
+ The event log—not an in-memory object or cached snapshot—is the source of truth. Current state,
59
+ client updates, recovery, tests, and external delivery are all derived from that ordered history.
74
60
 
75
- See the [Slack bridge example](./examples/002-slack-bridge) for idempotent ingress, a custom reducer,
76
- and durable outbound delivery.
61
+ ### 3. Live event stream: reconnect without losing the session
77
62
 
78
- **Durable state. Durable side effects.**
63
+ Live clients subscribe to the event stream over a reconnect-safe WebSocket protocol. Each client
64
+ tracks the last durable sequence it has applied.
79
65
 
80
- ### Agents survive deploys and failures
66
+ When a slow or disconnected client returns, it provides that sequence, receives every committed
67
+ event after it, and then continues live.
81
68
 
82
- Deploys and failures restart the application—not the session.
69
+ ### 4. Pure reducers: events become state
83
70
 
84
- EDA rebuilds framework and product state from durable history, repairs incomplete lifecycle
85
- boundaries, and transparently continues eligible in-progress work in a replacement run. Completed
86
- tool calls are not blindly repeated, queued commands remain durable, and reconnecting clients see
87
- the recovery transitions before new live activity.
71
+ Framework and application reducers fold the ordered event history to produce current state.
72
+ Framework events update agent lifecycles; application events update product lifecycles; both
73
+ contribute to the same state model.
88
74
 
89
- ### Production sessions become UI fixtures
75
+ Reducers are pure: given the same starting state and event, they produce the same next state. That
76
+ makes every state transition explicit, replayable, and testable.
90
77
 
91
- Because application state is a pure projection of durable events, a production event sequence can
92
- become a test fixture.
78
+ ### 5. State: a cached view of durable history
93
79
 
94
- Replay it one event at a time through the same reducers, stop at any sequence, and assert exactly
95
- what the UI should show: the running tool card, the active sandbox, the pending approval, the
96
- completed delivery, or the recovered run. A difficult production session becomes a reproducible UI
97
- test instead of a story in a bug report.
80
+ The reducers produce a complete snapshot of framework and application state through a known
81
+ sequence number. EDA caches that snapshot in host-provided durable storage so reads and restarts do
82
+ not need to replay the entire history from the beginning.
98
83
 
99
- The package includes pure reducer tests, generated state-machine properties, canned-model journeys,
100
- crash-prefix simulations, and an [offline trace harness](./testing/offline-trace) that writes
101
- durable and live event artifacts.
84
+ The cache is an optimization, not a second source of truth. If it is missing or incompatible, EDA
85
+ can rebuild it from the event log; the application is ultimately defined by its ordered events.
102
86
 
103
- ### Tracing for every agent run
87
+ ### 6. Pure projections: UI state is not model context
104
88
 
105
- See what happened, in what order, and where the time went.
89
+ State is not the final representation consumed by either people or models. The UI is a pure
90
+ projection of state, and the LLM context is a separate pure projection of that same state.
106
91
 
107
- EDA uses Effect spans across meaningful runtime boundaries, including command admission, runs,
108
- turns, model inference, tools, event streaming, durable sinks, and recovery. Trace context survives
109
- the durable boundaries that separate ingress, execution, and side effects, and Effect telemetry can
110
- be exported through OpenTelemetry to Google Cloud Trace or another existing backend.
92
+ The UI can preserve tool progress, approvals, sandbox status, and rich product history while the
93
+ LLM context selects and compacts only what the model should see. Applications can model each
94
+ consumer honestly instead of collapsing both into one constrained representation. See the
95
+ [UI projection guide](https://github.com/advait/effect-durable-agent/blob/master/docs/ui-projection.md) for the projection contract.
111
96
 
112
- ![Google Cloud Trace view of an EDA session, showing agent turns, model inference, tool calls, sandbox execution, and an external integration in one timeline.](./docs/assets/gcp-trace.png)
97
+ ### 7. Durable sinks: callbacks that survive failure
113
98
 
114
- ### Built for Cloudflare Durable Objects
99
+ Framework and application events often need to trigger side effects in external systems: post to
100
+ Slack, write to a database, or notify another service. Handling them in ordinary callbacks makes
101
+ delivery depend on the health of the current process.
115
102
 
116
- EDA's first host maps one session to one
117
- [Cloudflare Durable Object](https://developers.cloudflare.com/durable-objects/). The object is the
118
- durable coordinator for that session's state, execution, SQLite event log, live WebSockets, alarms,
119
- and sink cursors.
103
+ EDA handles this with durable sinks, which behave like durable callbacks over committed session
104
+ history. EDA delivers events to each sink in sequence order, persists its progress, retries
105
+ failures, and resumes after application restarts. Sinks run independently of the application loop,
106
+ so external delivery does not block application progress. Durable retries let external systems
107
+ converge on committed session history with eventual-consistency guarantees.
120
108
 
121
- This is an unusually natural fit:
109
+ Delivery is at-least-once, so external operations must be idempotent. Each durable event carries a
110
+ stable event ID that, together with its session ID, provides the operation's idempotency key.
122
111
 
123
- - Deterministic routing sends every request for a session to the same logical object
124
- - Per-object SQLite stores the ordered history beside the runtime that owns it
125
- - WebSockets terminate at the same boundary that owns the state
126
- - Alarms wake evicted sessions for recovery, keep-alive, and sink draining
112
+ ## What this unlocks
127
113
 
128
- Durable Objects are the first host, not the whole architecture. EDA's runtime depends on small
129
- storage, scheduling, identity, and live-delivery boundaries that another platform can implement
130
- with equivalent semantics.
114
+ ### Live state on every client
131
115
 
132
- ## Core concepts
116
+ Every tab, embedded surface, and admin view follows the same durable session. If one client loses
117
+ its connection or falls behind, it returns to the current state instead of resetting the session or
118
+ guessing which updates it missed.
133
119
 
134
- ![EDA architecture. Commands and application events enter a session runtime and durable event log, which feed reducers, reconnecting clients, durable sinks, recovery, replay, tests, and model context.](./docs/assets/architecture.svg)
120
+ Server-side rendering does not require a second state model. The server can render a durable
121
+ snapshot, and the browser can continue from that exact point as new events arrive.
135
122
 
136
- Effect owns the execution around this state machine: structured concurrency, streams, interruption,
137
- scoped resources, typed failures, retries, services, and tracing. The event history owns durable
138
- truth.
123
+ ### Durable side effects
139
124
 
140
- ### Durable and ephemeral events
125
+ If `AssistantMessageCommitted` should post a result to Slack and Slack is unavailable, the agent
126
+ keeps moving. When Slack recovers, it receives the committed events and converges with the session
127
+ history. External availability stays off the application's critical path without sacrificing
128
+ reliable delivery.
141
129
 
142
- EDA's ordered event stream carries two types of events:
130
+ See the [Slack bridge example](https://github.com/advait/effect-durable-agent/tree/master/examples/002-slack-bridge) for idempotent
131
+ ingress, a custom reducer, and durable outbound delivery.
143
132
 
144
- - **Durable events** are persisted facts with a monotonically increasing per-session `seq`. They
145
- drive reducers, recovery, reconnect, tests, and durable sinks
146
- - **Ephemeral events** carry live-only details such as text deltas, reasoning deltas, and speculative
147
- tool parameters. They are positioned against the current durable head but are not durable truth
133
+ **Durable state. Durable side effects.**
148
134
 
149
- A durable event is published live only after storage commits it.
135
+ ### Agents survive deploys and failures
150
136
 
151
- ### Pure reducers
137
+ Deploys and failures restart the application—not the session.
152
138
 
153
- Reducers turn durable events into current state. EDA's framework reducer derives commands, runs,
154
- turns, messages, inference, and tool state. Applications register their own reducers for product
155
- state such as sandboxes, approvals, billing, or external delivery.
139
+ EDA rebuilds framework and product state from durable history, repairs incomplete lifecycle
140
+ boundaries, and transparently continues eligible in-progress work in a replacement run. Completed
141
+ tool calls are not blindly repeated, queued commands remain durable, and reconnecting clients see
142
+ the recovery transitions before new live activity.
156
143
 
157
- Framework and application reducers fold the same ordered history. Their checkpoints accelerate
158
- startup and snapshots; the event log remains the source of truth.
144
+ ### Production sessions become UI fixtures
159
145
 
160
- ### Live event stream
146
+ A production event sequence can become a test fixture. Replay it one event at a time, stop at any
147
+ sequence, and assert exactly what the UI should show: the running tool card, the active sandbox, the
148
+ pending approval, the completed delivery, or the recovered run.
161
149
 
162
- Clients begin with a reducer snapshot through sequence `N`, replay durable events after `N`, and
163
- then follow new durable and ephemeral events live. Sequence-based catch-up lets every connected
164
- view converge without coupling a slow client to agent execution.
150
+ A difficult production session becomes a reproducible UI test instead of a story in a bug report.
151
+ The package includes pure reducer tests, generated state-machine properties, canned-model journeys,
152
+ crash-prefix simulations, and an [offline trace harness](./testing/offline-trace) that writes durable
153
+ and live event artifacts.
165
154
 
166
- ### Durable sinks
155
+ ### Tracing for every agent run
167
156
 
168
- Durable sinks process committed events outside the main agent loop. Each sink preserves event
169
- ordering, tracks an independent durable cursor, and advances only after successful processing.
170
- Failures retry with backoff, so external systems converge eventually without blocking the agent.
157
+ See what happened, in what order, and where the time went.
171
158
 
172
- ### Session runtime
159
+ EDA uses Effect spans across meaningful runtime boundaries, including command admission, runs,
160
+ turns, model inference, tools, event streaming, durable sinks, and recovery. Trace context survives
161
+ the durable boundaries that separate ingress, execution, and side effects, and Effect telemetry can
162
+ be exported through OpenTelemetry to Google Cloud Trace or another existing backend.
173
163
 
174
- One session has at most one active run and turn. The runtime:
164
+ ![Google Cloud Trace view of an EDA session, showing agent turns, model inference, tool calls, sandbox execution, and an external integration in one timeline.](https://raw.githubusercontent.com/advait/effect-durable-agent/master/docs/assets/gcp-trace.png)
165
+
166
+ ## Host-neutral core, pluggable deployment
167
+
168
+ EDA separates its state machine and Effect service graph from the platform that provides durable
169
+ storage, scheduling, identity, and live WebSockets. Applications select one host package:
170
+
171
+ | Package | Responsibility |
172
+ | --- | --- |
173
+ | `effect-durable-agent` | Host-independent commands, events, reducers, runtime, and adapter contracts. |
174
+ | `effect-durable-agent-cloudflare` | Cloudflare Durable Objects, SQLite, alarms, RPC, and hibernatable WebSockets. |
175
+ | `effect-durable-agent-celld` | [celld](https://celld.dev/) deployment of the Durable Objects contract on your infrastructure. |
175
176
 
176
- 1. Durably admits a command
177
- 2. Starts and traces the run, turn, and inference
178
- 3. Commits message and tool lifecycle facts
179
- 4. Folds framework and application reducers
180
- 5. Publishes positioned events to live clients
181
- 6. Drains durable sinks
182
- 7. Recovers from the durable history after a restart
177
+ All three packages are released together with the same version. A host and core from different
178
+ versions are not a supported combination; keep the versions identical when upgrading.
183
179
 
184
180
  ## Get started
185
181
 
186
- Install EDA from npm:
182
+ Install the core and one host from the public alpha channel:
187
183
 
188
184
  ```bash
189
- pnpm add effect-durable-agent@alpha
185
+ pnpm add effect-durable-agent@alpha effect-durable-agent-cloudflare@alpha
190
186
  ```
191
187
 
192
- The smallest host is a concrete Durable Object subclass:
188
+ For celld, select its host package at the same version instead:
189
+
190
+ ```bash
191
+ pnpm add effect-durable-agent@alpha effect-durable-agent-celld@alpha
192
+ ```
193
+
194
+ The smallest Cloudflare host is a concrete Durable Object subclass:
193
195
 
194
196
  ```ts
195
- import { EDASessionDurableObject } from "effect-durable-agent/host/durable-object"
197
+ import { EDASessionDurableObject } from "effect-durable-agent-cloudflare"
196
198
 
197
199
  export class MyAgentSession extends EDASessionDurableObject<MyEnv> {
198
200
  constructor(ctx: DurableObjectState, env: MyEnv) {
@@ -208,19 +210,10 @@ Start with the executable examples:
208
210
 
209
211
  | Example | What it demonstrates |
210
212
  | --- | --- |
211
- | [`001-no-tools`](./examples/001-no-tools) | Minimal Durable Object session and durable command admission. |
212
- | [`002-slack-bridge`](./examples/002-slack-bridge) | Idempotent ingress, application events and reducers, and a retrying durable sink. |
213
- | [`003-sandbox-lifecycle`](./examples/003-sandbox-lifecycle) | Tool and product events reduced into one UI model, including snapshot-to-stream handoff. |
214
-
215
- ## Why Effect?
216
-
217
- Agent sessions combine long-running model streams, concurrent tools, interruption, cleanup, retries,
218
- external services, and observability. EDA uses [Effect](https://effect.website/) so those concerns
219
- share one structured execution model rather than a collection of detached promises and callbacks.
220
-
221
- Effect is the implementation foundation, not the product pitch. The reason to use EDA is the
222
- durable application model; Effect is what lets the runtime execute that model with scoped resources,
223
- typed boundaries, structured concurrency, and first-class tracing.
213
+ | [`001-no-tools`](https://github.com/advait/effect-durable-agent/tree/master/examples/001-no-tools) | Minimal Durable Object session and durable command admission. |
214
+ | [`002-slack-bridge`](https://github.com/advait/effect-durable-agent/tree/master/examples/002-slack-bridge) | Idempotent ingress, application events and reducers, and a retrying durable sink. |
215
+ | [`003-sandbox-lifecycle`](https://github.com/advait/effect-durable-agent/tree/master/examples/003-sandbox-lifecycle) | Tool and product events reduced into one UI model, including snapshot-to-stream handoff. |
216
+ | [`004-celld-no-tools`](https://github.com/advait/effect-durable-agent/tree/master/examples/004-celld-no-tools) | Deployable celld cell with durable command admission. |
224
217
 
225
218
  ## Why EDA instead of another agent SDK or framework?
226
219
 
@@ -276,7 +269,7 @@ client catch-up, restart recovery, production-derived UI fixtures, and durable s
276
269
  ## Capabilities
277
270
 
278
271
  - Effect-native agent runtime with command, run, turn, inference, message, and tool lifecycles
279
- - Cloudflare Durable Object host with one session per object and SQLite event storage
272
+ - Pluggable Cloudflare Durable Objects and celld hosts with one session per object and SQLite event storage
280
273
  - Typed custom durable application events and pure application reducers
281
274
  - Reducer checkpoints and serialized snapshots
282
275
  - Reconnect-safe event streaming with sequence resume and WebSocket ACK flow control
@@ -289,17 +282,28 @@ client catch-up, restart recovery, production-derived UI fixtures, and durable s
289
282
  - Trace propagation and Effect span instrumentation across runtime boundaries
290
283
  - Queue, steer, interrupt, stop, and idempotent command admission
291
284
 
285
+ ## Why Effect?
286
+
287
+ Agent sessions combine long-running model streams, concurrent tools, interruption, cleanup, retries,
288
+ external services, and observability. EDA uses [Effect](https://effect.website/) so those concerns
289
+ share one structured execution model rather than a collection of detached promises and callbacks.
290
+
291
+ Effect is the implementation foundation, not the product pitch. The reason to use EDA is the
292
+ durable application model; Effect is what lets the runtime execute that model with scoped resources,
293
+ typed boundaries, structured concurrency, and first-class tracing.
294
+
292
295
  ## Documentation
293
296
 
294
- - [Current implementation](./docs/spec.md)
295
- - [Testing strategy](./docs/testing.md)
296
- - [WebSocket live-event protocol](./docs/websocket-protocol.md)
297
- - [Message steering](./docs/message-steering.md)
298
- - [UI projection proposal](./docs/ui-projection.md)
299
- - [Subagents proposal](./docs/subagents.md)
297
+ - [Current implementation](https://github.com/advait/effect-durable-agent/blob/master/docs/spec.md)
298
+ - [Testing strategy](https://github.com/advait/effect-durable-agent/blob/master/docs/testing.md)
299
+ - [WebSocket live-event protocol](https://github.com/advait/effect-durable-agent/blob/master/docs/websocket-protocol.md)
300
+ - [Message steering](https://github.com/advait/effect-durable-agent/blob/master/docs/message-steering.md)
301
+ - [UI projection proposal](https://github.com/advait/effect-durable-agent/blob/master/docs/ui-projection.md)
302
+ - [Subagents proposal](https://github.com/advait/effect-durable-agent/blob/master/docs/subagents.md)
303
+ - [Maintainer release guide](https://github.com/advait/effect-durable-agent/blob/master/docs/releasing.md)
300
304
 
301
305
  ## Contributing and license
302
306
 
303
- See [CONTRIBUTING.md](./CONTRIBUTING.md) to run the project and validate the npm package. Effect
307
+ See [CONTRIBUTING.md](https://github.com/advait/effect-durable-agent/blob/master/CONTRIBUTING.md) to run the project and validate the npm package. Effect
304
308
  Durable Agent is available under the [MIT License](./LICENSE). Please report vulnerabilities
305
- through the process in [SECURITY.md](./SECURITY.md).
309
+ through the process in [SECURITY.md](https://github.com/advait/effect-durable-agent/blob/master/SECURITY.md).
@@ -1,11 +1,103 @@
1
- import { _ as SummaryId, i as ContextVersion, l as InferenceId, m as SequenceNumber, n as CommandId, p as RunId, r as CompactionId, u as MessageId, v as ToolCallId, y as TurnId } from "./core-Hv3cFydL.js";
2
- import { r as EDACommand, u as UserMessageContent } from "./commands-Ce1ec6kH.js";
1
+ import { b as TurnId, g as SessionId, h as SequenceNumber, i as ContextVersion, l as InferenceId, m as RunRequestId, n as CommandId, p as RunId, r as CompactionId, u as MessageId, v as SummaryId, y as ToolCallId } from "./core-C-6xHzRx.js";
2
+ import { _ as UsagePayload, c as FailurePayload, f as ProviderPartId, h as ToolName, l as ModelSelectionPayload, m as SystemPromptText } from "./envelope-DkZyMIgp.js";
3
+ import { n as TokenConsumptionState } from "./model-usage-CdBEkTwU.js";
4
+ import { d as UserMessageContent, r as EDACommand } from "./commands-p8venTWs.js";
3
5
  import { n as EDARunTrace, t as EDAEventTrace } from "./tracing-BXHAkxkx.js";
4
- import { B as SystemPromptText, P as FailurePayload, R as ProviderPartId, U as UsagePayload, V as ToolName } from "./events-Bb9-Cu-7.js";
5
- import { r as AssistantMessageContent, tt as RecoveryContinuation } from "./durable-DlScwmCy.js";
6
- import { t as CommittedDurableEvent } from "./session-store-D2Ore1QC.js";
6
+ import { r as AssistantMessageContent, rt as RecoveryContinuation } from "./durable-DeLCAvbw.js";
7
+ import { t as CommittedDurableEvent } from "./session-store-J_Un45kW.js";
8
+ import * as Schema from "effect/Schema";
7
9
  import * as Prompt from "effect/unstable/ai/Prompt";
8
10
 
11
+ //#region src/domain/run-scheduling.d.ts
12
+ /**
13
+ * Identity of the admitted work selected by dispatch or recovery for a new run.
14
+ * This is not a durable request identity: recovery can resolve the same command again.
15
+ */
16
+ interface RunSchedulingInput {
17
+ readonly sessionId: SessionId;
18
+ readonly commandId: CommandId;
19
+ }
20
+ /**
21
+ * Permission to start the selected run in this session's current runtime.
22
+ * This value is never persisted and allocates no scheduling identity.
23
+ */
24
+ declare const LocalRunResolution: Schema.TaggedStruct<"Local", {}>;
25
+ type LocalRunResolution = typeof LocalRunResolution.Type;
26
+ /** Intent to request external permission; resolution itself must perform no delivery. */
27
+ declare const DeferredRunResolution: Schema.TaggedStruct<"Deferred", {}>;
28
+ type DeferredRunResolution = typeof DeferredRunResolution.Type;
29
+ /** Prompt selection result interpreted by SessionState before any run is started. */
30
+ declare const RunResolution: Schema.Union<readonly [Schema.TaggedStruct<"Local", {}>, Schema.TaggedStruct<"Deferred", {}>]>;
31
+ type RunResolution = typeof RunResolution.Type;
32
+ /** Selected work and the durable predecessor needed to authorize a recovery replacement. */
33
+ declare const RunSchedulingWork: Schema.Union<readonly [Schema.TaggedStruct<"Command", {
34
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
35
+ }>, Schema.TaggedStruct<"Recovery", {
36
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
37
+ readonly interruptedRunId: Schema.brand<Schema.String, "RunId">;
38
+ readonly inputMessageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
39
+ }>]>;
40
+ type RunSchedulingWork = typeof RunSchedulingWork.Type;
41
+ /** One run-slot reservation. External schedulers must deduplicate delivery by requestId. */
42
+ declare const RunSchedulingRequest: Schema.Struct<{
43
+ readonly requestId: Schema.brand<Schema.String, "RunRequestId">;
44
+ readonly work: Schema.Union<readonly [Schema.TaggedStruct<"Command", {
45
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
46
+ }>, Schema.TaggedStruct<"Recovery", {
47
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
48
+ readonly interruptedRunId: Schema.brand<Schema.String, "RunId">;
49
+ readonly inputMessageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
50
+ }>]>;
51
+ }>;
52
+ type RunSchedulingRequest = typeof RunSchedulingRequest.Type;
53
+ /** Current reservation, folded solely from request and successful delivery facts. */
54
+ declare const RunSchedulingRequestRecord: Schema.Struct<{
55
+ readonly requestedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
56
+ readonly deliveredSeq: Schema.optionalKey<Schema.brand<Schema.Int, "SequenceNumber">>;
57
+ readonly requestId: Schema.brand<Schema.String, "RunRequestId">;
58
+ readonly work: Schema.Union<readonly [Schema.TaggedStruct<"Command", {
59
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
60
+ }>, Schema.TaggedStruct<"Recovery", {
61
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
62
+ readonly interruptedRunId: Schema.brand<Schema.String, "RunId">;
63
+ readonly inputMessageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
64
+ }>]>;
65
+ }>;
66
+ type RunSchedulingRequestRecord = typeof RunSchedulingRequestRecord.Type;
67
+ /** A stale/duplicate permission is harmless and cannot allocate another run. */
68
+ declare const RunGrantResult: Schema.Union<readonly [Schema.TaggedStruct<"Granted", {
69
+ readonly runId: Schema.brand<Schema.String, "RunId">;
70
+ }>, Schema.TaggedStruct<"Stale", {}>]>;
71
+ type RunGrantResult = typeof RunGrantResult.Type;
72
+ /** Durable answer for reconciling an ambiguous grant delivery. Unknown never authorizes replacement work. */
73
+ declare const RunRequestOutcome: Schema.Union<readonly [Schema.TaggedStruct<"Unknown", {}>, Schema.TaggedStruct<"Waiting", {}>, Schema.TaggedStruct<"Invalidated", {}>, Schema.TaggedStruct<"Granted", {
74
+ readonly runId: Schema.brand<Schema.String, "RunId">;
75
+ readonly status: Schema.Literals<readonly ["Running", "Completed", "Failed", "Interrupted"]>;
76
+ }>]>;
77
+ type RunRequestOutcome = typeof RunRequestOutcome.Type;
78
+ /** Canonical records consulted by authorization policy, without an Effect-layer snapshot. */
79
+ type SchedulingState = Pick<ReducedState, "commands" | "runs" | "messages" | "commandQueues" | "runSchedulingRequest">;
80
+ /** Still-unconsumed inputs owned by a reservation, derived from the existing message records. */
81
+ declare const runSchedulingInputMessageIds: (state: SchedulingState, work: RunSchedulingWork) => ReadonlyArray<MessageId>;
82
+ /** Revalidate durable ownership and pending controls immediately before granting permission. */
83
+ declare const canGrantRun: (state: SchedulingState, requestId: RunRequestId) => boolean;
84
+ /** Controls may change waiting work; later messages cannot take its reserved slot. */
85
+ declare const waitingRunControl: (state: SchedulingState) => PendingCommand | undefined;
86
+ /** Atomic request changes required when one of its selected messages is cancelled. */
87
+ interface RunSchedulingCancellationPlan {
88
+ readonly requestId: RunRequestId;
89
+ readonly cancelCommandId?: CommandId;
90
+ readonly replacementWork?: RunSchedulingWork;
91
+ }
92
+ /** Preserve a recovery predecessor when cancellation leaves other selected inputs eligible. */
93
+ declare const planRunSchedulingCancellation: (state: SchedulingState, messageId: MessageId) => RunSchedulingCancellationPlan | undefined;
94
+ /** Stop/interrupt facts that invalidate authorization and pause pending work before any run. */
95
+ declare const planWaitingRunInterruption: (state: SchedulingState, controlCommandId: CommandId) => {
96
+ requestId: string & import("effect/Brand").Brand<"RunRequestId">;
97
+ messageIds: (string & import("effect/Brand").Brand<"MessageId">)[];
98
+ cancelCommandId: string & import("effect/Brand").Brand<"CommandId">;
99
+ } | undefined;
100
+ //#endregion
9
101
  //#region src/domain/reduced-state.d.ts
10
102
  /** Failure payload paired with the durable sequence that recorded it. */
11
103
  type LifecycleFailure = {
@@ -55,6 +147,7 @@ interface LifecycleTiming {
55
147
  }
56
148
  /** Durable run lifecycle projection tying one run to its owning command ids. */
57
149
  interface RunRecord extends LifecycleTiming {
150
+ readonly modelSelection?: ModelSelectionPayload;
58
151
  readonly runId: RunId;
59
152
  readonly commandIds: ReadonlyArray<CommandId>;
60
153
  readonly startedSeq: SequenceNumber;
@@ -188,7 +281,8 @@ type MessageRecord = {
188
281
  readonly messageId: MessageId;
189
282
  readonly runId: RunId;
190
283
  readonly turnId: TurnId;
191
- readonly inferenceId: InferenceId;
284
+ readonly inferenceId: InferenceId; /** True when the assistant message originated outside this EDA session. */
285
+ readonly imported?: true;
192
286
  readonly content: AssistantMessageContent;
193
287
  readonly createdAtMs?: number;
194
288
  readonly promptParts?: ReadonlyArray<Prompt.AssistantMessagePart>;
@@ -243,18 +337,6 @@ interface StopRequestRecord {
243
337
  readonly appliedTurnId?: TurnId;
244
338
  readonly appliedInferenceId?: InferenceId;
245
339
  }
246
- /** Rolling session totals for provider-reported model token usage. */
247
- interface TokenUsageTotals {
248
- readonly inputTokens: number;
249
- readonly cachedInputTokens: number;
250
- readonly outputTokens: number;
251
- readonly textTokens: number;
252
- readonly reasoningTokens: number;
253
- }
254
- /** First-party token consumption metadata folded by the framework reducer. */
255
- interface TokenConsumptionState {
256
- readonly total: TokenUsageTotals;
257
- }
258
340
  /** Admitted command that has not yet crossed the `CommandStarted` boundary. */
259
341
  interface PendingCommand {
260
342
  /** Lifecycle ID for the admitted command. */
@@ -279,6 +361,10 @@ type ActiveTurnIdentity = {
279
361
  };
280
362
  /** Canonical durable replay product used by queries, recovery, and scheduling. */
281
363
  interface ReducedState {
364
+ /** Single current authorization reservation; absent after grant or invalidation. */
365
+ readonly runSchedulingRequest?: RunSchedulingRequestRecord;
366
+ /** Session execution policy established by configuration or the first historical run. */
367
+ readonly modelSelection?: ModelSelectionPayload;
282
368
  readonly lastSeq: SequenceNumber;
283
369
  readonly commands: ReadonlyMap<CommandId, CommandRecord>;
284
370
  readonly runs: ReadonlyMap<RunId, RunRecord>;
@@ -316,7 +402,7 @@ declare const initialReducedState: ReducedState;
316
402
  /** Reserved reducer checkpoint name for the framework-owned `ReducedState`. */
317
403
  declare const frameworkReducedStateReducerName = "_eda.framework.reduced-state";
318
404
  /** Schema version for the framework-owned `ReducedState` checkpoint payload. */
319
- declare const frameworkReducedStateReducerSchemaVersion = 4;
405
+ declare const frameworkReducedStateReducerSchemaVersion = 7;
320
406
  /** JSON payload stored for the framework-owned reduced-state reducer checkpoint. */
321
407
  type ReducedStateCheckpointCommandRecord = Omit<CommandRecord, "command">;
322
408
  type SystemMessageRecord = Extract<MessageRecord, {
@@ -354,6 +440,8 @@ interface ReducedStateCheckpointToolCallRecord extends Omit<ToolCallRecord, "dec
354
440
  readonly terminal?: ReducedStateCheckpointToolTerminal;
355
441
  }
356
442
  interface ReducedStateCheckpointPayload {
443
+ readonly runSchedulingRequest?: RunSchedulingRequestRecord;
444
+ readonly modelSelection?: ModelSelectionPayload;
357
445
  readonly lastSeq: SequenceNumber;
358
446
  readonly commands: ReadonlyArray<readonly [CommandId, ReducedStateCheckpointCommandRecord]>;
359
447
  readonly runs: ReadonlyArray<readonly [RunId, RunRecord]>;
@@ -464,5 +552,5 @@ declare const emptyCommandQueues: CommandQueues;
464
552
  */
465
553
  declare const deriveCommandQueues: (state: CommandQueueSource) => CommandQueues;
466
554
  //#endregion
467
- export { RunTerminal as A, activeTurnIdentityForCommand as B, ReducedStateCheckpointCommandRecord as C, ReducedStateCheckpointToolDecision as D, ReducedStateCheckpointToolCallRecord as E, ToolDecision as F, frameworkReducedStateReducerName as G, decodeReducedStateCheckpoint as H, ToolTerminal as I, pendingCommands as J, frameworkReducedStateReducerSchemaVersion as K, TurnRecord as L, TokenConsumptionState as M, TokenUsageTotals as N, ReducedStateCheckpointToolTerminal as O, ToolCallRecord as P, TurnTerminal as R, ReducedState as S, ReducedStateCheckpointPayload as T, encodeReducedStateCheckpoint as U, classifyRecoverableWork as V, foldReducedState as W, reduceCommittedEvents as X, pendingStopCommand as Y, reducedStateCheckpointEventSeqs as Z, LifecycleTiming as _, deriveCommandQueues as a, RecoverableWork as b, ActiveTurnIdentity as c, CompactionRecord as d, CompactionTerminal as f, LifecycleFailure as g, InferenceTerminal as h, PendingUserMessage as i, StopRequestRecord as j, RunRecord as k, CommandRecord as l, InferenceRecord as m, CommandQueues as n, emptyCommandQueues as o, ContextRecord as p, initialReducedState as q, PendingSteeringMessage as r, ActiveCommandEvidence as s, CommandQueueSource as t, CommandTerminal as u, MessageRecord as v, ReducedStateCheckpointMessageRecord as w, RecoveryContinuationRecord as x, PendingCommand as y, activeCommand as z };
468
- //# sourceMappingURL=command-queues-CQ9cwRP7.d.ts.map
555
+ export { RunRequestOutcome as $, RunTerminal as A, decodeReducedStateCheckpoint as B, ReducedStateCheckpointCommandRecord as C, ReducedStateCheckpointToolDecision as D, ReducedStateCheckpointToolCallRecord as E, TurnRecord as F, initialReducedState as G, foldReducedState as H, TurnTerminal as I, reduceCommittedEvents as J, pendingCommands as K, activeCommand as L, ToolCallRecord as M, ToolDecision as N, ReducedStateCheckpointToolTerminal as O, ToolTerminal as P, RunGrantResult as Q, activeTurnIdentityForCommand as R, ReducedState as S, ReducedStateCheckpointPayload as T, frameworkReducedStateReducerName as U, encodeReducedStateCheckpoint as V, frameworkReducedStateReducerSchemaVersion as W, DeferredRunResolution as X, reducedStateCheckpointEventSeqs as Y, LocalRunResolution as Z, LifecycleTiming as _, deriveCommandQueues as a, RunSchedulingWork as at, RecoverableWork as b, ActiveTurnIdentity as c, planWaitingRunInterruption as ct, CompactionRecord as d, RunResolution as et, CompactionTerminal as f, LifecycleFailure as g, InferenceTerminal as h, PendingUserMessage as i, RunSchedulingRequestRecord as it, StopRequestRecord as j, RunRecord as k, CommandRecord as l, runSchedulingInputMessageIds as lt, InferenceRecord as m, CommandQueues as n, RunSchedulingInput as nt, emptyCommandQueues as o, canGrantRun as ot, ContextRecord as p, pendingStopCommand as q, PendingSteeringMessage as r, RunSchedulingRequest as rt, ActiveCommandEvidence as s, planRunSchedulingCancellation as st, CommandQueueSource as t, RunSchedulingCancellationPlan as tt, CommandTerminal as u, waitingRunControl as ut, MessageRecord as v, ReducedStateCheckpointMessageRecord as w, RecoveryContinuationRecord as x, PendingCommand as y, classifyRecoverableWork as z };
556
+ //# sourceMappingURL=command-queues-CQi4Xc7u.d.ts.map
@@ -99,6 +99,14 @@ declare class StopTurnCommand extends StopTurnCommand_base {}
99
99
  /** Mutating input accepted by effect-durable-agent before runtime processing. */
100
100
  declare const EDACommand: Schema.Union<readonly [typeof SubmitMessageCommand, typeof StopTurnCommand, typeof CancelPendingMessageCommand, typeof PromotePendingMessageCommand, typeof ResumePendingMessagesCommand]>;
101
101
  type EDACommand = typeof EDACommand.Type;
102
+ declare const GrantRunCommand_base: Schema.Class<GrantRunCommand, Schema.TaggedStruct<"GrantRun", {
103
+ readonly requestId: Schema.brand<Schema.String, "RunRequestId">;
104
+ }>, {}>;
105
+ /**
106
+ * Trusted scheduler permission, accepted only through the separate grantRun API.
107
+ * Excluded from EDACommand so ordinary session ingress cannot authorize itself.
108
+ */
109
+ declare class GrantRunCommand extends GrantRunCommand_base {}
102
110
  //#endregion
103
- export { PromotePendingMessageCommand as a, SubmitMessageCommand as c, UserMessagePart as d, PendingMessageCancellationReason as i, SubmitMessageDisposition as l, CommandIdempotencyKey as n, ResumePendingMessagesCommand as o, EDACommand as r, StopTurnCommand as s, CancelPendingMessageCommand as t, UserMessageContent as u };
104
- //# sourceMappingURL=commands-Ce1ec6kH.d.ts.map
111
+ export { PendingMessageCancellationReason as a, StopTurnCommand as c, UserMessageContent as d, UserMessagePart as f, GrantRunCommand as i, SubmitMessageCommand as l, CommandIdempotencyKey as n, PromotePendingMessageCommand as o, EDACommand as r, ResumePendingMessagesCommand as s, CancelPendingMessageCommand as t, SubmitMessageDisposition as u };
112
+ //# sourceMappingURL=commands-p8venTWs.d.ts.map