effect-durable-agent 0.1.0-alpha.3 → 0.1.0-alpha.30

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 (221) hide show
  1. package/README.md +43 -41
  2. package/dist/assert-never-CoyUpoRB.js +18 -0
  3. package/dist/assert-never-CoyUpoRB.js.map +1 -0
  4. package/dist/{commands-Ce1ec6kH.d.ts → commands-3OD-p8dD.d.ts} +16 -9
  5. package/dist/compaction-63iEDHHl.js +523 -0
  6. package/dist/compaction-63iEDHHl.js.map +1 -0
  7. package/dist/context-projection-D_uRtK3r.d.ts +139 -0
  8. package/dist/{core-Hv3cFydL.d.ts → core-BcimKMIv.d.ts} +6 -4
  9. package/dist/delivery-2ZILvoRD.js +507 -0
  10. package/dist/delivery-2ZILvoRD.js.map +1 -0
  11. package/dist/{websocket-wire-D3tLrhe2.d.ts → delivery-RjM1_NAE.d.ts} +1019 -200
  12. package/dist/domain/command-queues.d.ts +81 -2
  13. package/dist/domain/command-queues.js +1 -1
  14. package/dist/domain/command-queues.js.map +1 -1
  15. package/dist/domain/context-projection.d.ts +2 -0
  16. package/dist/domain/context-projection.js +32 -0
  17. package/dist/domain/context-projection.js.map +1 -0
  18. package/dist/domain/message-transcript.d.ts +36 -2
  19. package/dist/domain/message-transcript.js +10 -2
  20. package/dist/domain/message-transcript.js.map +1 -1
  21. package/dist/domain/model-usage.d.ts +2 -0
  22. package/dist/domain/model-usage.js +59 -0
  23. package/dist/domain/model-usage.js.map +1 -0
  24. package/dist/domain/reduced-state-schema.d.ts +3 -996
  25. package/dist/domain/reduced-state-schema.js +121 -12
  26. package/dist/domain/reduced-state-schema.js.map +1 -1
  27. package/dist/domain/reduced-state.d.ts +3 -2
  28. package/dist/domain/reduced-state.js +937 -2
  29. package/dist/domain/reduced-state.js.map +1 -0
  30. package/dist/domain/run-scheduling.d.ts +2 -0
  31. package/dist/domain/run-scheduling.js +127 -0
  32. package/dist/domain/run-scheduling.js.map +1 -0
  33. package/dist/{durable-DlScwmCy.d.ts → durable-Cqv5ZRFA.d.ts} +8505 -2497
  34. package/dist/{durable-C3Rz7kg3.js → durable-D13w1Qr3.js} +253 -91
  35. package/dist/durable-D13w1Qr3.js.map +1 -0
  36. package/dist/envelope-BCzKUq_z.js +91 -0
  37. package/dist/envelope-BCzKUq_z.js.map +1 -0
  38. package/dist/envelope-Che6KatU.d.ts +254 -0
  39. package/dist/{keep-alive-p8dIcSVy.js → event-factory-_vF1bIJ7.js} +8 -10
  40. package/dist/event-factory-_vF1bIJ7.js.map +1 -0
  41. package/dist/{events-Bb9-Cu-7.d.ts → events-Dg0o5wWs.d.ts} +140 -324
  42. package/dist/{id-generator-C2Q15uZM.d.ts → id-generator-BKGoKjt-.d.ts} +3 -3
  43. package/dist/in-memory-CeODnZhE.js +150 -0
  44. package/dist/in-memory-CeODnZhE.js.map +1 -0
  45. package/dist/index.d.ts +8 -7
  46. package/dist/index.js +6 -5
  47. package/dist/interpreter-DKGJ1sSx.js +1452 -0
  48. package/dist/interpreter-DKGJ1sSx.js.map +1 -0
  49. package/dist/keep-alive-_zFCUvt3.d.ts +28 -0
  50. package/dist/model-resolver-D0vcDZsU.d.ts +24 -0
  51. package/dist/model-usage-0GeHwaaU.d.ts +54 -0
  52. package/dist/records--54mZEBx.js +675 -0
  53. package/dist/records--54mZEBx.js.map +1 -0
  54. package/dist/reduced-state-DU2ECOUp.d.ts +47821 -0
  55. package/dist/reduced-state-schema-B2t3cobf.d.ts +2187 -0
  56. package/dist/{reducer-registry-C0svUa63.d.ts → reducer-registry-JLU1yptN.d.ts} +24 -8
  57. package/dist/run-scheduling-wakeup-D_bGdicf.d.ts +24 -0
  58. package/dist/services/compaction.d.ts +2 -2
  59. package/dist/services/compaction.js +2 -426
  60. package/dist/services/id-generator.d.ts +1 -1
  61. package/dist/services/id-generator.js +4 -2
  62. package/dist/services/id-generator.js.map +1 -1
  63. package/dist/services/keep-alive.d.ts +2 -0
  64. package/dist/services/keep-alive.js +13 -0
  65. package/dist/services/keep-alive.js.map +1 -0
  66. package/dist/services/model-call.d.ts +15 -0
  67. package/dist/services/model-call.js +15 -0
  68. package/dist/services/model-call.js.map +1 -0
  69. package/dist/services/model-resolver.d.ts +2 -0
  70. package/dist/services/model-resolver.js +17 -0
  71. package/dist/services/model-resolver.js.map +1 -0
  72. package/dist/services/prompt-projector.d.ts +2 -2
  73. package/dist/services/prompt-projector.js +49 -5
  74. package/dist/services/prompt-projector.js.map +1 -1
  75. package/dist/services/reducer-registry.d.ts +2 -2
  76. package/dist/services/reducer-registry.js +21 -4
  77. package/dist/services/reducer-registry.js.map +1 -1
  78. package/dist/services/run-scheduler.d.ts +2 -0
  79. package/dist/services/run-scheduler.js +25 -0
  80. package/dist/services/run-scheduler.js.map +1 -0
  81. package/dist/services/run-scheduling-wakeup.d.ts +2 -0
  82. package/dist/services/run-scheduling-wakeup.js +13 -0
  83. package/dist/services/run-scheduling-wakeup.js.map +1 -0
  84. package/dist/services/runtime-layer.d.ts +48 -0
  85. package/dist/services/runtime-layer.js +51 -0
  86. package/dist/services/runtime-layer.js.map +1 -0
  87. package/dist/services/runtime.d.ts +1 -1
  88. package/dist/services/runtime.js +34 -20
  89. package/dist/services/runtime.js.map +1 -1
  90. package/dist/services/session-event-observer.d.ts +2 -0
  91. package/dist/services/session-event-observer.js +13 -0
  92. package/dist/services/session-event-observer.js.map +1 -0
  93. package/dist/services/session-query.d.ts +2 -2
  94. package/dist/services/session-query.js +141 -2
  95. package/dist/services/session-query.js.map +1 -0
  96. package/dist/services/session-state.d.ts +2 -0
  97. package/dist/services/session-state.js +2 -0
  98. package/dist/services/session-store.d.ts +2 -2
  99. package/dist/services/session-store.js +272 -2
  100. package/dist/services/session-store.js.map +1 -0
  101. package/dist/services/sink-checkpoint-store.d.ts +2 -0
  102. package/dist/services/sink-checkpoint-store.js +50 -0
  103. package/dist/services/sink-checkpoint-store.js.map +1 -0
  104. package/dist/services/sink-registry.d.ts +2 -2
  105. package/dist/services/sink-registry.js +1 -1
  106. package/dist/services/span-names.d.ts +1 -1
  107. package/dist/services/span-names.js +7 -1
  108. package/dist/services/span-names.js.map +1 -1
  109. package/dist/services/tool-registry.d.ts +2 -2
  110. package/dist/services/tool-registry.js +12 -3
  111. package/dist/services/tool-registry.js.map +1 -1
  112. package/dist/services/tracing.d.ts +3 -3
  113. package/dist/services/tracing.js +25 -4
  114. package/dist/services/tracing.js.map +1 -1
  115. package/dist/session-event-observer-HvrRckbC.d.ts +24 -0
  116. package/dist/{session-query-Cbf-e0rG.js → session-state-BQYsuBqi.js} +693 -251
  117. package/dist/session-state-BQYsuBqi.js.map +1 -0
  118. package/dist/session-store-CQxg9U82.d.ts +3302 -0
  119. package/dist/sink-checkpoint-store-DWGifxp0.d.ts +39 -0
  120. package/dist/sink-registry-DskRcyOS.js +345 -0
  121. package/dist/sink-registry-DskRcyOS.js.map +1 -0
  122. package/dist/subscription-DmO3BcdT.js +505 -0
  123. package/dist/subscription-DmO3BcdT.js.map +1 -0
  124. package/dist/subscription-rC35dAWn.d.ts +958 -0
  125. package/dist/testkit/layers.d.ts +34 -19
  126. package/dist/testkit/layers.js +30 -16
  127. package/dist/testkit/layers.js.map +1 -1
  128. package/dist/testkit/transcript.d.ts +226 -0
  129. package/dist/testkit/transcript.js +1475 -0
  130. package/dist/testkit/transcript.js.map +1 -0
  131. package/dist/{tool-registry-CcnkAAQK.d.ts → tool-registry-BzlMhwzj.d.ts} +44 -8
  132. package/dist/{tracing-BXHAkxkx.d.ts → tracing-BwjbF285.d.ts} +1 -2
  133. package/dist/transcript.d.ts +101 -0
  134. package/dist/transcript.js +107 -0
  135. package/dist/transcript.js.map +1 -0
  136. package/dist/types/commands.d.ts +2 -2
  137. package/dist/types/commands.js +8 -3
  138. package/dist/types/commands.js.map +1 -1
  139. package/dist/types/core.d.ts +2 -2
  140. package/dist/types/core.js +4 -2
  141. package/dist/types/core.js.map +1 -1
  142. package/dist/types/events/durable.d.ts +2 -2
  143. package/dist/types/events/durable.js +2 -2
  144. package/dist/types/events.d.ts +5 -4
  145. package/dist/types/events.js +3 -2
  146. package/dist/types/events.js.map +1 -1
  147. package/dist/types/tracing.d.ts +1 -1
  148. package/dist/types/tracing.js.map +1 -1
  149. package/dist/websocket/events.d.ts +2 -0
  150. package/dist/websocket/events.js +2 -0
  151. package/dist/websocket.d.ts +2201 -0
  152. package/dist/websocket.js +684 -0
  153. package/dist/websocket.js.map +1 -0
  154. package/dist/window-read-CBZEJ84M.d.ts +113 -0
  155. package/dist/window-read-DPFAA1hM.js +264 -0
  156. package/dist/window-read-DPFAA1hM.js.map +1 -0
  157. package/package.json +87 -46
  158. package/testing/offline-trace/README.md +2 -1
  159. package/CHANGELOG.md +0 -25
  160. package/CONTRIBUTING.md +0 -26
  161. package/SECURITY.md +0 -7
  162. package/dist/command-queues-CQ9cwRP7.d.ts +0 -468
  163. package/dist/compaction-1LSZR944.d.ts +0 -144
  164. package/dist/durable-C3Rz7kg3.js.map +0 -1
  165. package/dist/durable-object-runtime-CiMKxGs6.d.ts +0 -257
  166. package/dist/durable-object-runtime-wKiqaAt2.js +0 -1494
  167. package/dist/durable-object-runtime-wKiqaAt2.js.map +0 -1
  168. package/dist/durable-object-storage-Czy7IPrh.d.ts +0 -41
  169. package/dist/host/durable-object-runtime.d.ts +0 -2
  170. package/dist/host/durable-object-runtime.js +0 -2
  171. package/dist/host/durable-object-storage.d.ts +0 -2
  172. package/dist/host/durable-object-storage.js +0 -0
  173. package/dist/host/durable-object.d.ts +0 -83
  174. package/dist/host/durable-object.js +0 -191
  175. package/dist/host/durable-object.js.map +0 -1
  176. package/dist/host/websocket-wire.d.ts +0 -2
  177. package/dist/host/websocket-wire.js +0 -105
  178. package/dist/host/websocket-wire.js.map +0 -1
  179. package/dist/index-BVVgDSdq.d.ts +0 -1
  180. package/dist/keep-alive-DYDsH6qN.d.ts +0 -111
  181. package/dist/keep-alive-p8dIcSVy.js.map +0 -1
  182. package/dist/message-transcript-BCHdHAe2.d.ts +0 -32
  183. package/dist/prompt-projector-DimXJPOJ.d.ts +0 -39
  184. package/dist/reduced-state-C4nVVzz9.js +0 -910
  185. package/dist/reduced-state-C4nVVzz9.js.map +0 -1
  186. package/dist/runtime-DcdPOEuE.d.ts +0 -60
  187. package/dist/services/compaction.js.map +0 -1
  188. package/dist/session-query-Cbf-e0rG.js.map +0 -1
  189. package/dist/session-query-hxfujxUH.d.ts +0 -769
  190. package/dist/session-store-D2Ore1QC.d.ts +0 -295
  191. package/dist/session-store-pYxQW9qh.js +0 -214
  192. package/dist/session-store-pYxQW9qh.js.map +0 -1
  193. package/dist/sink-registry-BziFpxoE.d.ts +0 -158
  194. package/dist/sink-registry-CFC6xjsN.js +0 -312
  195. package/dist/sink-registry-CFC6xjsN.js.map +0 -1
  196. package/docs/assets/architecture.svg +0 -216
  197. package/docs/assets/event-sequence.svg +0 -133
  198. package/docs/assets/gcp-trace.png +0 -0
  199. package/docs/assets/hero.svg +0 -33
  200. package/docs/message-steering.md +0 -831
  201. package/docs/releasing.md +0 -96
  202. package/docs/spec.md +0 -777
  203. package/docs/subagents.md +0 -725
  204. package/docs/testing.md +0 -64
  205. package/docs/ui-projection.md +0 -742
  206. package/docs/websocket-protocol.md +0 -639
  207. package/examples/001-no-tools/README.md +0 -65
  208. package/examples/001-no-tools/worker.ts +0 -79
  209. package/examples/002-slack-bridge/README.md +0 -134
  210. package/examples/002-slack-bridge/events.ts +0 -115
  211. package/examples/002-slack-bridge/reducer.ts +0 -216
  212. package/examples/002-slack-bridge/scenario.test.ts +0 -223
  213. package/examples/002-slack-bridge/sinks.ts +0 -109
  214. package/examples/002-slack-bridge/worker.ts +0 -140
  215. package/examples/003-sandbox-lifecycle/README.md +0 -78
  216. package/examples/003-sandbox-lifecycle/events.ts +0 -203
  217. package/examples/003-sandbox-lifecycle/reducer.ts +0 -305
  218. package/examples/003-sandbox-lifecycle/scenario.test.ts +0 -202
  219. package/examples/_shared/event-id.ts +0 -12
  220. package/examples/_shared/http.ts +0 -27
  221. package/examples/_shared/openai.ts +0 -33
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # effect-durable-agent
2
2
 
3
- ![EDA is a redux-inspired durable state management layer for agentic applications](./docs/assets/hero.svg)
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
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/effect-durable-agent)](https://www.npmjs.com/package/effect-durable-agent)
6
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)
@@ -21,7 +21,7 @@ the same event sequence.
21
21
  EDA models the agent and the surrounding product as one application state machine. For example, a
22
22
  coding-agent session might record:
23
23
 
24
- ![An ordered EDA session history where framework and application events share one sequence.](./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)
25
25
 
26
26
  Framework events and product events are not separate channels. They form the same history and
27
27
  transition the same application state.
@@ -38,7 +38,7 @@ external conversations, delivery state, or anything else the product needs to re
38
38
 
39
39
  Those events flow through the rest of the system as follows:
40
40
 
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.](./docs/assets/architecture.svg)
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)
42
42
 
43
43
  ### 1. Session runtime: one state machine for the entire application
44
44
 
@@ -78,8 +78,8 @@ makes every state transition explicit, replayable, and testable.
78
78
  ### 5. State: a cached view of durable history
79
79
 
80
80
  The reducers produce a complete snapshot of framework and application state through a known
81
- sequence number. EDA caches that snapshot in Durable Object SQLite so reads and restarts do not
82
- need to replay the entire history from the beginning.
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.
83
83
 
84
84
  The cache is an optimization, not a second source of truth. If it is missing or incompatible, EDA
85
85
  can rebuild it from the event log; the application is ultimately defined by its ordered events.
@@ -92,7 +92,7 @@ projection of state, and the LLM context is a separate pure projection of that s
92
92
  The UI can preserve tool progress, approvals, sandbox status, and rich product history while the
93
93
  LLM context selects and compacts only what the model should see. Applications can model each
94
94
  consumer honestly instead of collapsing both into one constrained representation. See the
95
- [UI projection guide](./docs/ui-projection.md) for the projection contract.
95
+ [transcript history proposal](https://github.com/advait/effect-durable-agent/blob/master/docs/transcript-history.md) for the planned user-visible projection.
96
96
 
97
97
  ### 7. Durable sinks: callbacks that survive failure
98
98
 
@@ -127,8 +127,8 @@ keeps moving. When Slack recovers, it receives the committed events and converge
127
127
  history. External availability stays off the application's critical path without sacrificing
128
128
  reliable delivery.
129
129
 
130
- See the [Slack bridge example](./examples/002-slack-bridge) for idempotent ingress, a custom reducer,
131
- and durable outbound delivery.
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.
132
132
 
133
133
  **Durable state. Durable side effects.**
134
134
 
@@ -161,39 +161,40 @@ turns, model inference, tools, event streaming, durable sinks, and recovery. Tra
161
161
  the durable boundaries that separate ingress, execution, and side effects, and Effect telemetry can
162
162
  be exported through OpenTelemetry to Google Cloud Trace or another existing backend.
163
163
 
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.](./docs/assets/gcp-trace.png)
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
165
 
166
- ## Built for Cloudflare Durable Objects
166
+ ## Host-neutral core, pluggable deployment
167
167
 
168
- EDA's first host maps one session to one
169
- [Cloudflare Durable Object](https://developers.cloudflare.com/durable-objects/). The object is the
170
- durable coordinator for that session's state, execution, SQLite event log, live WebSockets, alarms,
171
- and sink cursors.
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:
172
170
 
173
- This is an unusually natural fit:
174
-
175
- - Deterministic routing sends every request for a session to the same logical object
176
- - Per-object SQLite stores the ordered history beside the runtime that owns it
177
- - WebSockets terminate at the same boundary that owns the state
178
- - Alarms wake evicted sessions for recovery, keep-alive, and sink draining
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. |
179
176
 
180
- Durable Objects are the first host, not the whole architecture. EDA's runtime depends on small
181
- storage, scheduling, identity, and live-delivery boundaries that another platform can implement
182
- with equivalent semantics.
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 the public alpha from npm. Using the `alpha` tag keeps prerelease consumers on the current
187
- alpha channel:
182
+ Install the core and one host from the public alpha channel:
183
+
184
+ ```bash
185
+ pnpm add effect-durable-agent@alpha effect-durable-agent-cloudflare@alpha
186
+ ```
187
+
188
+ For celld, select its host package at the same version instead:
188
189
 
189
190
  ```bash
190
- pnpm add effect-durable-agent@alpha
191
+ pnpm add effect-durable-agent@alpha effect-durable-agent-celld@alpha
191
192
  ```
192
193
 
193
- The smallest host is a concrete Durable Object subclass:
194
+ The smallest Cloudflare host is a concrete Durable Object subclass:
194
195
 
195
196
  ```ts
196
- import { EDASessionDurableObject } from "effect-durable-agent/host/durable-object"
197
+ import { EDASessionDurableObject } from "effect-durable-agent-cloudflare"
197
198
 
198
199
  export class MyAgentSession extends EDASessionDurableObject<MyEnv> {
199
200
  constructor(ctx: DurableObjectState, env: MyEnv) {
@@ -209,9 +210,10 @@ Start with the executable examples:
209
210
 
210
211
  | Example | What it demonstrates |
211
212
  | --- | --- |
212
- | [`001-no-tools`](./examples/001-no-tools) | Minimal Durable Object session and durable command admission. |
213
- | [`002-slack-bridge`](./examples/002-slack-bridge) | Idempotent ingress, application events and reducers, and a retrying durable sink. |
214
- | [`003-sandbox-lifecycle`](./examples/003-sandbox-lifecycle) | Tool and product events reduced into one UI model, including snapshot-to-stream handoff. |
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. |
215
217
 
216
218
  ## Why EDA instead of another agent SDK or framework?
217
219
 
@@ -267,7 +269,7 @@ client catch-up, restart recovery, production-derived UI fixtures, and durable s
267
269
  ## Capabilities
268
270
 
269
271
  - Effect-native agent runtime with command, run, turn, inference, message, and tool lifecycles
270
- - 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
271
273
  - Typed custom durable application events and pure application reducers
272
274
  - Reducer checkpoints and serialized snapshots
273
275
  - Reconnect-safe event streaming with sequence resume and WebSocket ACK flow control
@@ -292,16 +294,16 @@ typed boundaries, structured concurrency, and first-class tracing.
292
294
 
293
295
  ## Documentation
294
296
 
295
- - [Current implementation](./docs/spec.md)
296
- - [Testing strategy](./docs/testing.md)
297
- - [WebSocket live-event protocol](./docs/websocket-protocol.md)
298
- - [Message steering](./docs/message-steering.md)
299
- - [UI projection proposal](./docs/ui-projection.md)
300
- - [Subagents proposal](./docs/subagents.md)
301
- - [Maintainer release guide](./docs/releasing.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
+ - [Transcript history proposal](https://github.com/advait/effect-durable-agent/blob/master/docs/transcript-history.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)
302
304
 
303
305
  ## Contributing and license
304
306
 
305
- 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
306
308
  Durable Agent is available under the [MIT License](./LICENSE). Please report vulnerabilities
307
- 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).
@@ -0,0 +1,18 @@
1
+ //#region src/domain/assert-never.ts
2
+ const formatNeverValue = (value) => {
3
+ try {
4
+ return JSON.stringify(value);
5
+ } catch {
6
+ return String(value);
7
+ }
8
+ };
9
+ /** Build the defect used when an exhaustive switch receives an impossible value. */
10
+ const assertNeverError = (value, context) => /* @__PURE__ */ new Error(`Unhandled ${context}: ${formatNeverValue(value)}`);
11
+ /** Throw for impossible branches in pure code after TypeScript exhaustiveness checking. */
12
+ const assertNever = (value, context) => {
13
+ throw assertNeverError(value, context);
14
+ };
15
+ //#endregion
16
+ export { assertNeverError as n, assertNever as t };
17
+
18
+ //# sourceMappingURL=assert-never-CoyUpoRB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-never-CoyUpoRB.js","names":[],"sources":["../src/domain/assert-never.ts"],"sourcesContent":["const formatNeverValue = (value: never): string => {\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n};\n\n/** Build the defect used when an exhaustive switch receives an impossible value. */\nexport const assertNeverError = (value: never, context: string) =>\n new Error(`Unhandled ${context}: ${formatNeverValue(value)}`);\n\n/** Throw for impossible branches in pure code after TypeScript exhaustiveness checking. */\nexport const assertNever = (value: never, context: string): never => {\n throw assertNeverError(value, context);\n};\n"],"mappings":";AAAA,MAAM,oBAAoB,UAAyB;CACjD,IAAI;EACF,OAAO,KAAK,UAAU,KAAK;CAC7B,QAAQ;EACN,OAAO,OAAO,KAAK;CACrB;AACF;;AAGA,MAAa,oBAAoB,OAAc,4BAC7C,IAAI,MAAM,aAAa,QAAQ,IAAI,iBAAiB,KAAK,GAAG;;AAG9D,MAAa,eAAe,OAAc,YAA2B;CACnE,MAAM,iBAAiB,OAAO,OAAO;AACvC"}
@@ -1,5 +1,4 @@
1
1
  import * as Schema from "effect/Schema";
2
-
3
2
  //#region src/types/commands.d.ts
4
3
  /** Caller-owned stable retry/correlation key for a submitted command. */
5
4
  declare const CommandIdempotencyKey: Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">;
@@ -43,6 +42,8 @@ declare const UserMessageContent: Schema.Union<readonly [Schema.decodeTo<Schema.
43
42
  }>]>>]>;
44
43
  type UserMessageContent = typeof UserMessageContent.Type;
45
44
  declare const SubmitMessageCommand_base: Schema.Class<SubmitMessageCommand, Schema.TaggedStruct<"SubmitMessage", {
45
+ readonly commandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
46
+ readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
46
47
  readonly disposition: Schema.Literals<readonly ["queue", "steer", "interrupt"]>;
47
48
  readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
48
49
  readonly type: Schema.Literal<"text">;
@@ -63,30 +64,28 @@ declare const SubmitMessageCommand_base: Schema.Class<SubmitMessageCommand, Sche
63
64
  readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
64
65
  }>]>>]>;
65
66
  readonly expectedPausedMessageIdsToCancel: Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "MessageId">>>;
66
- readonly commandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
67
- readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
68
67
  }>, {}>;
69
68
  /** Submit a user message to the session command stream. */
70
69
  declare class SubmitMessageCommand extends SubmitMessageCommand_base {}
71
70
  declare const PendingMessageCancellationReason: Schema.Literals<readonly ["edit", "user-cancel"]>;
72
71
  type PendingMessageCancellationReason = typeof PendingMessageCancellationReason.Type;
73
72
  declare const CancelPendingMessageCommand_base: Schema.Class<CancelPendingMessageCommand, Schema.TaggedStruct<"CancelPendingMessage", {
74
- readonly messageId: Schema.brand<Schema.String, "MessageId">;
75
- readonly reason: Schema.Literals<readonly ["edit", "user-cancel"]>;
76
73
  readonly commandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
77
74
  readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
75
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
76
+ readonly reason: Schema.Literals<readonly ["edit", "user-cancel"]>;
78
77
  }>, {}>;
79
78
  declare class CancelPendingMessageCommand extends CancelPendingMessageCommand_base {}
80
79
  declare const PromotePendingMessageCommand_base: Schema.Class<PromotePendingMessageCommand, Schema.TaggedStruct<"PromotePendingMessage", {
81
- readonly messageId: Schema.brand<Schema.String, "MessageId">;
82
80
  readonly commandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
83
81
  readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
82
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
84
83
  }>, {}>;
85
84
  declare class PromotePendingMessageCommand extends PromotePendingMessageCommand_base {}
86
85
  declare const ResumePendingMessagesCommand_base: Schema.Class<ResumePendingMessagesCommand, Schema.TaggedStruct<"ResumePendingMessages", {
87
- readonly messageIds: Schema.NonEmptyArray<Schema.brand<Schema.String, "MessageId">>;
88
86
  readonly commandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
89
87
  readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
88
+ readonly messageIds: Schema.NonEmptyArray<Schema.brand<Schema.String, "MessageId">>;
90
89
  }>, {}>;
91
90
  /** Framework-internal owner for restarting unconsumed messages after unexpected failure. */
92
91
  declare class ResumePendingMessagesCommand extends ResumePendingMessagesCommand_base {}
@@ -99,6 +98,14 @@ declare class StopTurnCommand extends StopTurnCommand_base {}
99
98
  /** Mutating input accepted by effect-durable-agent before runtime processing. */
100
99
  declare const EDACommand: Schema.Union<readonly [typeof SubmitMessageCommand, typeof StopTurnCommand, typeof CancelPendingMessageCommand, typeof PromotePendingMessageCommand, typeof ResumePendingMessagesCommand]>;
101
100
  type EDACommand = typeof EDACommand.Type;
101
+ declare const GrantRunCommand_base: Schema.Class<GrantRunCommand, Schema.TaggedStruct<"GrantRun", {
102
+ readonly requestId: Schema.brand<Schema.String, "RunRequestId">;
103
+ }>, {}>;
104
+ /**
105
+ * Trusted scheduler permission, accepted only through the separate grantRun API.
106
+ * Excluded from EDACommand so ordinary session ingress cannot authorize itself.
107
+ */
108
+ declare class GrantRunCommand extends GrantRunCommand_base {}
102
109
  //#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
110
+ 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 };
111
+ //# sourceMappingURL=commands-3OD-p8dD.d.ts.map