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

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 (142) hide show
  1. package/README.md +43 -41
  2. package/dist/{command-queues-CQ9cwRP7.d.ts → command-queues-Dwdf41mq.d.ts} +7 -6
  3. package/dist/{compaction-1LSZR944.d.ts → compaction-DpHOf-g7.d.ts} +8 -6
  4. package/dist/context-projection-B4DWOZgi.d.ts +140 -0
  5. package/dist/{core-Hv3cFydL.d.ts → core-CYT6DBaS.d.ts} +2 -2
  6. package/dist/domain/command-queues.d.ts +1 -1
  7. package/dist/domain/context-projection.d.ts +2 -0
  8. package/dist/domain/context-projection.js +32 -0
  9. package/dist/domain/context-projection.js.map +1 -0
  10. package/dist/domain/message-transcript.d.ts +1 -1
  11. package/dist/domain/reduced-state-schema.d.ts +2 -0
  12. package/dist/domain/reduced-state-schema.js +2 -1
  13. package/dist/domain/reduced-state-schema.js.map +1 -1
  14. package/dist/domain/reduced-state.d.ts +1 -1
  15. package/dist/domain/reduced-state.js +1 -1
  16. package/dist/{durable-DlScwmCy.d.ts → durable-B7M6TD_0.d.ts} +341 -2
  17. package/dist/{durable-C3Rz7kg3.js → durable-DsV9PxZC.js} +13 -2
  18. package/dist/durable-DsV9PxZC.js.map +1 -0
  19. package/dist/{keep-alive-DYDsH6qN.d.ts → event-factory-CLJcyymV.d.ts} +5 -29
  20. package/dist/{keep-alive-p8dIcSVy.js → event-factory-tcpLgdMN.js} +3 -10
  21. package/dist/event-factory-tcpLgdMN.js.map +1 -0
  22. package/dist/host/websocket-protocol.d.ts +252 -0
  23. package/dist/host/websocket-protocol.js +111 -0
  24. package/dist/host/websocket-protocol.js.map +1 -0
  25. package/dist/host/websocket-wire.d.ts +2 -2
  26. package/dist/host/websocket-wire.js +21 -4
  27. package/dist/host/websocket-wire.js.map +1 -1
  28. package/dist/{id-generator-C2Q15uZM.d.ts → id-generator-Ckl8_XWW.d.ts} +2 -2
  29. package/dist/index.d.ts +4 -4
  30. package/dist/index.js +2 -2
  31. package/dist/keep-alive-Chl5SJxy.d.ts +29 -0
  32. package/dist/{message-transcript-BCHdHAe2.d.ts → message-transcript-CFn_D3MH.d.ts} +3 -3
  33. package/dist/{prompt-projector-DimXJPOJ.d.ts → prompt-projector-C2meuNrV.d.ts} +5 -5
  34. package/dist/{reduced-state-C4nVVzz9.js → reduced-state-TMi7ISla.js} +20 -4
  35. package/dist/reduced-state-TMi7ISla.js.map +1 -0
  36. package/dist/{reducer-registry-C0svUa63.d.ts → reducer-registry-K9FqZq5-.d.ts} +2 -2
  37. package/dist/{runtime-DcdPOEuE.d.ts → runtime-5NEJngu3.d.ts} +12 -6
  38. package/dist/services/compaction.d.ts +1 -1
  39. package/dist/services/compaction.js +4 -3
  40. package/dist/services/compaction.js.map +1 -1
  41. package/dist/services/id-generator.d.ts +1 -1
  42. package/dist/services/keep-alive.d.ts +2 -0
  43. package/dist/services/keep-alive.js +13 -0
  44. package/dist/services/keep-alive.js.map +1 -0
  45. package/dist/services/prompt-projector.d.ts +1 -1
  46. package/dist/services/reducer-registry.d.ts +1 -1
  47. package/dist/services/runtime-layer.d.ts +58 -0
  48. package/dist/services/runtime-layer.js +42 -0
  49. package/dist/services/runtime-layer.js.map +1 -0
  50. package/dist/services/runtime.d.ts +1 -1
  51. package/dist/services/runtime.js +9 -4
  52. package/dist/services/runtime.js.map +1 -1
  53. package/dist/services/session-query.d.ts +2 -2
  54. package/dist/services/session-query.js +93 -1
  55. package/dist/services/session-query.js.map +1 -0
  56. package/dist/services/session-state.d.ts +2 -0
  57. package/dist/services/session-state.js +2 -0
  58. package/dist/services/session-store.d.ts +2 -2
  59. package/dist/services/session-store.js +181 -2
  60. package/dist/services/session-store.js.map +1 -0
  61. package/dist/services/sink-checkpoint-store.d.ts +2 -0
  62. package/dist/services/sink-checkpoint-store.js +49 -0
  63. package/dist/services/sink-checkpoint-store.js.map +1 -0
  64. package/dist/services/sink-registry.d.ts +1 -1
  65. package/dist/services/sink-registry.js +1 -1
  66. package/dist/services/span-names.d.ts +1 -1
  67. package/dist/services/span-names.js +1 -0
  68. package/dist/services/span-names.js.map +1 -1
  69. package/dist/services/tool-registry.d.ts +1 -1
  70. package/dist/services/websocket-delivery.d.ts +90 -0
  71. package/dist/services/websocket-delivery.js +221 -0
  72. package/dist/services/websocket-delivery.js.map +1 -0
  73. package/dist/session-query-5oyZRaQL.d.ts +45 -0
  74. package/dist/{session-query-hxfujxUH.d.ts → session-state-CI1xeT6f.d.ts} +134 -42
  75. package/dist/{session-query-Cbf-e0rG.js → session-state-D7dqko7r.js} +19 -78
  76. package/dist/session-state-D7dqko7r.js.map +1 -0
  77. package/dist/{session-store-D2Ore1QC.d.ts → session-store-BLg6UvZa.d.ts} +5 -94
  78. package/dist/sink-checkpoint-store-B9WNvDtY.d.ts +40 -0
  79. package/dist/{sink-registry-CFC6xjsN.js → sink-registry-BbmoI9uv.js} +25 -70
  80. package/dist/sink-registry-BbmoI9uv.js.map +1 -0
  81. package/dist/{sink-registry-BziFpxoE.d.ts → sink-registry-CO3YPS1p.d.ts} +31 -48
  82. package/dist/testkit/layers.d.ts +14 -11
  83. package/dist/testkit/layers.js +9 -6
  84. package/dist/testkit/layers.js.map +1 -1
  85. package/dist/{tool-registry-CcnkAAQK.d.ts → tool-registry-B8H1P6Pu.d.ts} +3 -3
  86. package/dist/types/core.d.ts +1 -1
  87. package/dist/types/core.js +1 -1
  88. package/dist/types/core.js.map +1 -1
  89. package/dist/types/events/durable.d.ts +2 -2
  90. package/dist/types/events/durable.js +2 -2
  91. package/dist/types/events.d.ts +2 -2
  92. package/dist/types/events.js +2 -2
  93. package/dist/{websocket-wire-D3tLrhe2.d.ts → websocket-wire-DPxwY4G5.d.ts} +112 -11
  94. package/package.json +48 -40
  95. package/testing/offline-trace/README.md +2 -1
  96. package/CHANGELOG.md +0 -25
  97. package/CONTRIBUTING.md +0 -26
  98. package/SECURITY.md +0 -7
  99. package/dist/durable-C3Rz7kg3.js.map +0 -1
  100. package/dist/durable-object-runtime-CiMKxGs6.d.ts +0 -257
  101. package/dist/durable-object-runtime-wKiqaAt2.js +0 -1494
  102. package/dist/durable-object-runtime-wKiqaAt2.js.map +0 -1
  103. package/dist/durable-object-storage-Czy7IPrh.d.ts +0 -41
  104. package/dist/host/durable-object-runtime.d.ts +0 -2
  105. package/dist/host/durable-object-runtime.js +0 -2
  106. package/dist/host/durable-object-storage.d.ts +0 -2
  107. package/dist/host/durable-object-storage.js +0 -0
  108. package/dist/host/durable-object.d.ts +0 -83
  109. package/dist/host/durable-object.js +0 -191
  110. package/dist/host/durable-object.js.map +0 -1
  111. package/dist/keep-alive-p8dIcSVy.js.map +0 -1
  112. package/dist/reduced-state-C4nVVzz9.js.map +0 -1
  113. package/dist/session-query-Cbf-e0rG.js.map +0 -1
  114. package/dist/session-store-pYxQW9qh.js +0 -214
  115. package/dist/session-store-pYxQW9qh.js.map +0 -1
  116. package/dist/sink-registry-CFC6xjsN.js.map +0 -1
  117. package/docs/assets/architecture.svg +0 -216
  118. package/docs/assets/event-sequence.svg +0 -133
  119. package/docs/assets/gcp-trace.png +0 -0
  120. package/docs/assets/hero.svg +0 -33
  121. package/docs/message-steering.md +0 -831
  122. package/docs/releasing.md +0 -96
  123. package/docs/spec.md +0 -777
  124. package/docs/subagents.md +0 -725
  125. package/docs/testing.md +0 -64
  126. package/docs/ui-projection.md +0 -742
  127. package/docs/websocket-protocol.md +0 -639
  128. package/examples/001-no-tools/README.md +0 -65
  129. package/examples/001-no-tools/worker.ts +0 -79
  130. package/examples/002-slack-bridge/README.md +0 -134
  131. package/examples/002-slack-bridge/events.ts +0 -115
  132. package/examples/002-slack-bridge/reducer.ts +0 -216
  133. package/examples/002-slack-bridge/scenario.test.ts +0 -223
  134. package/examples/002-slack-bridge/sinks.ts +0 -109
  135. package/examples/002-slack-bridge/worker.ts +0 -140
  136. package/examples/003-sandbox-lifecycle/README.md +0 -78
  137. package/examples/003-sandbox-lifecycle/events.ts +0 -203
  138. package/examples/003-sandbox-lifecycle/reducer.ts +0 -305
  139. package/examples/003-sandbox-lifecycle/scenario.test.ts +0 -202
  140. package/examples/_shared/event-id.ts +0 -12
  141. package/examples/_shared/http.ts +0 -27
  142. 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
+ [UI projection guide](https://github.com/advait/effect-durable-agent/blob/master/docs/ui-projection.md) for the projection contract.
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
+ - [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)
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).
@@ -1,9 +1,9 @@
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";
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-CYT6DBaS.js";
2
2
  import { r as EDACommand, u as UserMessageContent } from "./commands-Ce1ec6kH.js";
3
3
  import { n as EDARunTrace, t as EDAEventTrace } from "./tracing-BXHAkxkx.js";
4
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";
5
+ import { r as AssistantMessageContent, rt as RecoveryContinuation } from "./durable-B7M6TD_0.js";
6
+ import { t as CommittedDurableEvent } from "./session-store-BLg6UvZa.js";
7
7
  import * as Prompt from "effect/unstable/ai/Prompt";
8
8
 
9
9
  //#region src/domain/reduced-state.d.ts
@@ -188,7 +188,8 @@ type MessageRecord = {
188
188
  readonly messageId: MessageId;
189
189
  readonly runId: RunId;
190
190
  readonly turnId: TurnId;
191
- readonly inferenceId: InferenceId;
191
+ readonly inferenceId: InferenceId; /** True when the assistant message originated outside this EDA session. */
192
+ readonly imported?: true;
192
193
  readonly content: AssistantMessageContent;
193
194
  readonly createdAtMs?: number;
194
195
  readonly promptParts?: ReadonlyArray<Prompt.AssistantMessagePart>;
@@ -316,7 +317,7 @@ declare const initialReducedState: ReducedState;
316
317
  /** Reserved reducer checkpoint name for the framework-owned `ReducedState`. */
317
318
  declare const frameworkReducedStateReducerName = "_eda.framework.reduced-state";
318
319
  /** Schema version for the framework-owned `ReducedState` checkpoint payload. */
319
- declare const frameworkReducedStateReducerSchemaVersion = 4;
320
+ declare const frameworkReducedStateReducerSchemaVersion = 5;
320
321
  /** JSON payload stored for the framework-owned reduced-state reducer checkpoint. */
321
322
  type ReducedStateCheckpointCommandRecord = Omit<CommandRecord, "command">;
322
323
  type SystemMessageRecord = Extract<MessageRecord, {
@@ -465,4 +466,4 @@ declare const emptyCommandQueues: CommandQueues;
465
466
  declare const deriveCommandQueues: (state: CommandQueueSource) => CommandQueues;
466
467
  //#endregion
467
468
  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
469
+ //# sourceMappingURL=command-queues-Dwdf41mq.d.ts.map
@@ -1,7 +1,9 @@
1
- import { f as CompactionExecutorId, m as ContextProjection, o as EDASessionStoreError, p as CompactionPolicyId, r as DurableAppendEntry, t as CommittedDurableEvent } from "./session-store-D2Ore1QC.js";
2
- import { S as ReducedState } from "./command-queues-CQ9cwRP7.js";
3
- import { t as IdGenerator } from "./id-generator-C2Q15uZM.js";
4
- import { n as EventFactory, t as EDAKeepAlive } from "./keep-alive-DYDsH6qN.js";
1
+ import { i as ContextProjection, n as CompactionPolicyId, t as CompactionExecutorId } from "./context-projection-B4DWOZgi.js";
2
+ import { o as EDASessionStoreError, r as DurableAppendEntry, t as CommittedDurableEvent } from "./session-store-BLg6UvZa.js";
3
+ import { S as ReducedState } from "./command-queues-Dwdf41mq.js";
4
+ import { t as IdGenerator } from "./id-generator-Ckl8_XWW.js";
5
+ import { t as EventFactory } from "./event-factory-CLJcyymV.js";
6
+ import { t as EDAKeepAlive } from "./keep-alive-Chl5SJxy.js";
5
7
  import * as Context from "effect/Context";
6
8
  import * as Effect from "effect/Effect";
7
9
  import * as Layer from "effect/Layer";
@@ -137,8 +139,8 @@ interface CompactionRunnerShape {
137
139
  declare const CompactionRunner_base: Context.ServiceClass<CompactionRunner, "@effect-durable-agent/CompactionRunner", CompactionRunnerShape>;
138
140
  /** Framework-owned compaction lifecycle runner. */
139
141
  declare class CompactionRunner extends CompactionRunner_base {
140
- static readonly Live: Layer.Layer<CompactionRunner, never, CompactionPolicy | CompactionExecutor | EventFactory | IdGenerator | EDAKeepAlive>;
142
+ static readonly Live: Layer.Layer<CompactionRunner, never, EDAKeepAlive | IdGenerator | EventFactory | CompactionPolicy | CompactionExecutor>;
141
143
  }
142
144
  //#endregion
143
145
  export { defaultCompactionRetainTailTokens as _, CompactionExecutorShape as a, CompactionPolicy as c, CompactionRunner as d, CompactionRunnerInput as f, defaultCompactionMinSummarizableTokens as g, defaultCompactionCharsPerToken as h, CompactionExecutorInput as i, CompactionPolicyInput as l, LanguageModelSummaryCompactionExecutorOptions as m, CompactionError as n, CompactionOutput as o, CompactionRunnerShape as p, CompactionExecutor as r, CompactionPlan as s, ApproximateTokenThresholdCompactionPolicyOptions as t, CompactionPolicyShape as u, defaultCompactionThresholdTokens as v };
144
- //# sourceMappingURL=compaction-1LSZR944.d.ts.map
146
+ //# sourceMappingURL=compaction-DpHOf-g7.d.ts.map
@@ -0,0 +1,140 @@
1
+ import * as Schema from "effect/Schema";
2
+
3
+ //#region src/domain/context-projection.d.ts
4
+ /** Stable identifier for the compaction policy that selected a summary plan. */
5
+ declare const CompactionPolicyId: Schema.brand<Schema.NonEmptyString, "CompactionPolicyId">;
6
+ type CompactionPolicyId = typeof CompactionPolicyId.Type;
7
+ /** Stable identifier for the executor that produced a summary artifact. */
8
+ declare const CompactionExecutorId: Schema.brand<Schema.NonEmptyString, "CompactionExecutorId">;
9
+ type CompactionExecutorId = typeof CompactionExecutorId.Type;
10
+ /** Authoritative cumulative model-context summary written with `SummaryCreated`. */
11
+ declare const CompactionSummaryArtifact: Schema.Struct<{
12
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
13
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
14
+ readonly previousSummaryId: Schema.optionalKey<Schema.brand<Schema.String, "SummaryId">>;
15
+ readonly sourceFromSeq: Schema.brand<Schema.Int, "SequenceNumber">;
16
+ readonly sourceToSeq: Schema.brand<Schema.Int, "SequenceNumber">;
17
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
18
+ readonly text: Schema.NonEmptyString;
19
+ readonly promptMessage: Schema.Struct<{
20
+ readonly role: Schema.Literal<"user">;
21
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
22
+ readonly type: Schema.Literal<"text">;
23
+ readonly text: Schema.String;
24
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
25
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
26
+ }>>>, Schema.String, never, never>, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
27
+ readonly type: Schema.Literal<"text">;
28
+ readonly text: Schema.String;
29
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
30
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
31
+ }>, Schema.Struct<{
32
+ readonly type: Schema.Literal<"file">;
33
+ readonly mediaType: Schema.String;
34
+ readonly fileName: Schema.optional<Schema.String>;
35
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
36
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
37
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
38
+ }>]>>]>;
39
+ readonly "~effect/ai/Prompt/Message": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Message">>;
40
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
41
+ }>;
42
+ readonly policyId: Schema.brand<Schema.NonEmptyString, "CompactionPolicyId">;
43
+ readonly executorId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CompactionExecutorId">>;
44
+ }>;
45
+ type CompactionSummaryArtifact = typeof CompactionSummaryArtifact.Type;
46
+ /** Current durable context cursor projected from framework reducer state and summary rows. */
47
+ declare const ContextProjection: Schema.Struct<{
48
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
49
+ readonly currentSummary: Schema.optionalKey<Schema.Struct<{
50
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
51
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
52
+ readonly previousSummaryId: Schema.optionalKey<Schema.brand<Schema.String, "SummaryId">>;
53
+ readonly sourceFromSeq: Schema.brand<Schema.Int, "SequenceNumber">;
54
+ readonly sourceToSeq: Schema.brand<Schema.Int, "SequenceNumber">;
55
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
56
+ readonly text: Schema.NonEmptyString;
57
+ readonly promptMessage: Schema.Struct<{
58
+ readonly role: Schema.Literal<"user">;
59
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
60
+ readonly type: Schema.Literal<"text">;
61
+ readonly text: Schema.String;
62
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
63
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
64
+ }>>>, Schema.String, never, never>, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
65
+ readonly type: Schema.Literal<"text">;
66
+ readonly text: Schema.String;
67
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
68
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
69
+ }>, Schema.Struct<{
70
+ readonly type: Schema.Literal<"file">;
71
+ readonly mediaType: Schema.String;
72
+ readonly fileName: Schema.optional<Schema.String>;
73
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
74
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
75
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
76
+ }>]>>]>;
77
+ readonly "~effect/ai/Prompt/Message": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Message">>;
78
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
79
+ }>;
80
+ readonly policyId: Schema.brand<Schema.NonEmptyString, "CompactionPolicyId">;
81
+ readonly executorId: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CompactionExecutorId">>;
82
+ }>>;
83
+ }>;
84
+ type ContextProjection = typeof ContextProjection.Type;
85
+ /** Genesis context before any compaction has rebased prompt history. */
86
+ declare const emptyContextProjection: {
87
+ readonly contextVersion: number & import("effect/Brand").Brand<"ContextVersion">;
88
+ readonly currentSummary?: {
89
+ readonly compactionId: string & import("effect/Brand").Brand<"CompactionId">;
90
+ readonly sourceFromSeq: number & import("effect/Brand").Brand<"SequenceNumber">;
91
+ readonly sourceToSeq: number & import("effect/Brand").Brand<"SequenceNumber">;
92
+ readonly summaryId: string & import("effect/Brand").Brand<"SummaryId">;
93
+ readonly retainedFromContextSeq: number & import("effect/Brand").Brand<"SequenceNumber">;
94
+ readonly text: string;
95
+ readonly promptMessage: {
96
+ readonly role: "user";
97
+ readonly content: readonly [{
98
+ readonly type: "text";
99
+ readonly text: string;
100
+ readonly "~effect/ai/Prompt/Part": "~effect/ai/Prompt/Part";
101
+ readonly options: {
102
+ readonly [x: string]: Schema.Json;
103
+ };
104
+ }, ...{
105
+ readonly type: "text";
106
+ readonly text: string;
107
+ readonly "~effect/ai/Prompt/Part": "~effect/ai/Prompt/Part";
108
+ readonly options: {
109
+ readonly [x: string]: Schema.Json;
110
+ };
111
+ }[]] | readonly ({
112
+ readonly type: "text";
113
+ readonly text: string;
114
+ readonly "~effect/ai/Prompt/Part": "~effect/ai/Prompt/Part";
115
+ readonly options: {
116
+ readonly [x: string]: Schema.Json;
117
+ };
118
+ } | {
119
+ readonly type: "file";
120
+ readonly "~effect/ai/Prompt/Part": "~effect/ai/Prompt/Part";
121
+ readonly options: {
122
+ readonly [x: string]: Schema.Json;
123
+ };
124
+ readonly mediaType: string;
125
+ readonly data: string | Uint8Array<ArrayBufferLike> | URL;
126
+ readonly fileName?: string | undefined;
127
+ })[];
128
+ readonly "~effect/ai/Prompt/Message": "~effect/ai/Prompt/Message";
129
+ readonly options: {
130
+ readonly [x: string]: Schema.Json;
131
+ };
132
+ };
133
+ readonly policyId: string & import("effect/Brand").Brand<"CompactionPolicyId">;
134
+ readonly previousSummaryId?: (string & import("effect/Brand").Brand<"SummaryId">) | undefined;
135
+ readonly executorId?: (string & import("effect/Brand").Brand<"CompactionExecutorId">) | undefined;
136
+ } | undefined;
137
+ };
138
+ //#endregion
139
+ export { emptyContextProjection as a, ContextProjection as i, CompactionPolicyId as n, CompactionSummaryArtifact as r, CompactionExecutorId as t };
140
+ //# sourceMappingURL=context-projection-B4DWOZgi.d.ts.map
@@ -2,7 +2,7 @@ import * as Schema from "effect/Schema";
2
2
  import * as Order from "effect/Order";
3
3
 
4
4
  //#region src/types/core.d.ts
5
- /** Durable conversation identity; one Durable Object stores one session.
5
+ /** Durable conversation identity; one host isolation unit stores one session.
6
6
  *
7
7
  * New EDA sessions are minted as UUIDv7. Migrated sessions may retain UUIDv4
8
8
  * identities, so runtime identity accepts any RFC UUID without changing app
@@ -78,4 +78,4 @@ declare const comparePosition: Order.Order<{
78
78
  }>;
79
79
  //#endregion
80
80
  export { SummaryId as _, CorrelationId as a, comparePosition as b, EventId as c, Position as d, PositionOrder as f, SubSequenceNumber as g, SessionId as h, ContextVersion as i, InferenceId as l, SequenceNumber as m, CommandId as n, DurablePosition as o, RunId as p, CompactionId as r, DurableSubSequenceNumber as s, BaseStateId as t, MessageId as u, ToolCallId as v, durablePosition as x, TurnId as y };
81
- //# sourceMappingURL=core-Hv3cFydL.d.ts.map
81
+ //# sourceMappingURL=core-CYT6DBaS.d.ts.map
@@ -1,2 +1,2 @@
1
- import { a as deriveCommandQueues, i as PendingUserMessage, n as CommandQueues, o as emptyCommandQueues, r as PendingSteeringMessage, t as CommandQueueSource } from "../command-queues-CQ9cwRP7.js";
1
+ import { a as deriveCommandQueues, i as PendingUserMessage, n as CommandQueues, o as emptyCommandQueues, r as PendingSteeringMessage, t as CommandQueueSource } from "../command-queues-Dwdf41mq.js";
2
2
  export { CommandQueueSource, CommandQueues, PendingSteeringMessage, PendingUserMessage, deriveCommandQueues, emptyCommandQueues };
@@ -0,0 +1,2 @@
1
+ import { a as emptyContextProjection, i as ContextProjection, n as CompactionPolicyId, r as CompactionSummaryArtifact, t as CompactionExecutorId } from "../context-projection-B4DWOZgi.js";
2
+ export { CompactionExecutorId, CompactionPolicyId, CompactionSummaryArtifact, ContextProjection, emptyContextProjection };
@@ -0,0 +1,32 @@
1
+ import { CompactionId, ContextVersion, SequenceNumber, SummaryId } from "../types/core.js";
2
+ import * as Schema from "effect/Schema";
3
+ import * as Prompt from "effect/unstable/ai/Prompt";
4
+ //#region src/domain/context-projection.ts
5
+ /** Stable identifier for the compaction policy that selected a summary plan. */
6
+ const CompactionPolicyId = Schema.NonEmptyString.pipe(Schema.brand("CompactionPolicyId"));
7
+ /** Stable identifier for the executor that produced a summary artifact. */
8
+ const CompactionExecutorId = Schema.NonEmptyString.pipe(Schema.brand("CompactionExecutorId"));
9
+ /** Authoritative cumulative model-context summary written with `SummaryCreated`. */
10
+ const CompactionSummaryArtifact = Schema.Struct({
11
+ compactionId: CompactionId,
12
+ summaryId: SummaryId,
13
+ previousSummaryId: Schema.optionalKey(SummaryId),
14
+ sourceFromSeq: SequenceNumber,
15
+ sourceToSeq: SequenceNumber,
16
+ retainedFromContextSeq: SequenceNumber,
17
+ text: Schema.NonEmptyString,
18
+ promptMessage: Prompt.UserMessage,
19
+ policyId: CompactionPolicyId,
20
+ executorId: Schema.optionalKey(CompactionExecutorId)
21
+ });
22
+ /** Current durable context cursor projected from framework reducer state and summary rows. */
23
+ const ContextProjection = Schema.Struct({
24
+ contextVersion: ContextVersion,
25
+ currentSummary: Schema.optionalKey(CompactionSummaryArtifact)
26
+ });
27
+ /** Genesis context before any compaction has rebased prompt history. */
28
+ const emptyContextProjection = ContextProjection.make({ contextVersion: ContextVersion.make(0) });
29
+ //#endregion
30
+ export { CompactionExecutorId, CompactionPolicyId, CompactionSummaryArtifact, ContextProjection, emptyContextProjection };
31
+
32
+ //# sourceMappingURL=context-projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-projection.js","names":[],"sources":["../../src/domain/context-projection.ts"],"sourcesContent":["import * as Prompt from \"effect/unstable/ai/Prompt\";\nimport * as Schema from \"effect/Schema\";\n\nimport { CompactionId, ContextVersion, SequenceNumber, SummaryId } from \"../types/core\";\n\n/** Stable identifier for the compaction policy that selected a summary plan. */\nexport const CompactionPolicyId = Schema.NonEmptyString.pipe(Schema.brand(\"CompactionPolicyId\"));\nexport type CompactionPolicyId = typeof CompactionPolicyId.Type;\n\n/** Stable identifier for the executor that produced a summary artifact. */\nexport const CompactionExecutorId = Schema.NonEmptyString.pipe(\n Schema.brand(\"CompactionExecutorId\"),\n);\nexport type CompactionExecutorId = typeof CompactionExecutorId.Type;\n\n/** Authoritative cumulative model-context summary written with `SummaryCreated`. */\nexport const CompactionSummaryArtifact = Schema.Struct({\n compactionId: CompactionId,\n summaryId: SummaryId,\n previousSummaryId: Schema.optionalKey(SummaryId),\n sourceFromSeq: SequenceNumber,\n sourceToSeq: SequenceNumber,\n retainedFromContextSeq: SequenceNumber,\n text: Schema.NonEmptyString,\n promptMessage: Prompt.UserMessage,\n policyId: CompactionPolicyId,\n executorId: Schema.optionalKey(CompactionExecutorId),\n});\nexport type CompactionSummaryArtifact = typeof CompactionSummaryArtifact.Type;\n\n/** Current durable context cursor projected from framework reducer state and summary rows. */\nexport const ContextProjection = Schema.Struct({\n contextVersion: ContextVersion,\n currentSummary: Schema.optionalKey(CompactionSummaryArtifact),\n});\nexport type ContextProjection = typeof ContextProjection.Type;\n\n/** Genesis context before any compaction has rebased prompt history. */\nexport const emptyContextProjection = ContextProjection.make({\n contextVersion: ContextVersion.make(0),\n});\n"],"mappings":";;;;;AAMA,MAAa,qBAAqB,OAAO,eAAe,KAAK,OAAO,MAAM,oBAAoB,CAAC;;AAI/F,MAAa,uBAAuB,OAAO,eAAe,KACxD,OAAO,MAAM,sBAAsB,CACrC;;AAIA,MAAa,4BAA4B,OAAO,OAAO;CACrD,cAAc;CACd,WAAW;CACX,mBAAmB,OAAO,YAAY,SAAS;CAC/C,eAAe;CACf,aAAa;CACb,wBAAwB;CACxB,MAAM,OAAO;CACb,eAAe,OAAO;CACtB,UAAU;CACV,YAAY,OAAO,YAAY,oBAAoB;AACrD,CAAC;;AAID,MAAa,oBAAoB,OAAO,OAAO;CAC7C,gBAAgB;CAChB,gBAAgB,OAAO,YAAY,yBAAyB;AAC9D,CAAC;;AAID,MAAa,yBAAyB,kBAAkB,KAAK,EAC3D,gBAAgB,eAAe,KAAK,CAAC,EACvC,CAAC"}
@@ -1,2 +1,2 @@
1
- import { a as durableMessageTranscript, i as contextProjectionPromptWithUserContents, n as contextProjectionPrompt, o as durableTranscriptPrompt, r as contextProjectionPromptWithUserContent, s as durableTranscriptPromptWithUserContent, t as DurableTranscriptMessage } from "../message-transcript-BCHdHAe2.js";
1
+ import { a as durableMessageTranscript, i as contextProjectionPromptWithUserContents, n as contextProjectionPrompt, o as durableTranscriptPrompt, r as contextProjectionPromptWithUserContent, s as durableTranscriptPromptWithUserContent, t as DurableTranscriptMessage } from "../message-transcript-CFn_D3MH.js";
2
2
  export { DurableTranscriptMessage, contextProjectionPrompt, contextProjectionPromptWithUserContent, contextProjectionPromptWithUserContents, durableMessageTranscript, durableTranscriptPrompt, durableTranscriptPromptWithUserContent };
@@ -662,6 +662,7 @@ declare const MessageRecordSchema: Schema.Union<readonly [Schema.Struct<{
662
662
  readonly text: Schema.String;
663
663
  readonly reasoning: Schema.optionalKey<Schema.String>;
664
664
  }>;
665
+ readonly imported: Schema.optionalKey<Schema.Literal<true>>;
665
666
  readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
666
667
  readonly promptParts: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
667
668
  readonly type: Schema.Literal<"text">;
@@ -855,6 +856,7 @@ declare const JsonMessageRecordSchema: Schema.Union<readonly [Schema.Struct<{
855
856
  readonly text: Schema.String;
856
857
  readonly reasoning: Schema.optionalKey<Schema.String>;
857
858
  }>;
859
+ readonly imported: Schema.optionalKey<Schema.Literal<true>>;
858
860
  readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
859
861
  readonly promptParts: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
860
862
  readonly type: Schema.Literal<"text">;
@@ -1,7 +1,7 @@
1
1
  import { CommandId, InferenceId, MessageId, RunId, SequenceNumber, ToolCallId, TurnId } from "../types/core.js";
2
2
  import { CancelPendingMessageCommand, EDACommand, PromotePendingMessageCommand, ResumePendingMessagesCommand, StopTurnCommand, SubmitMessageCommand, UserMessageContent } from "../types/commands.js";
3
3
  import { EDAEventTrace, EDARunTrace } from "../types/tracing.js";
4
- import { _r as UsagePayload, cr as FailurePayload, fr as ProviderPartId, hr as ToolName, mr as SystemPromptText, r as AssistantMessageContent, tt as RecoveryContinuation } from "../durable-C3Rz7kg3.js";
4
+ import { _r as SystemPromptText, br as UsagePayload, dr as FailurePayload, hr as ProviderPartId, r as AssistantMessageContent, rt as RecoveryContinuation, vr as ToolName } from "../durable-DsV9PxZC.js";
5
5
  import * as Schema from "effect/Schema";
6
6
  import * as Prompt from "effect/unstable/ai/Prompt";
7
7
  import * as SchemaTransformation from "effect/SchemaTransformation";
@@ -243,6 +243,7 @@ const messageRecordSchema = (userContent, assistantPart) => Schema.Union([
243
243
  ...MessageIdentityFields,
244
244
  _tag: Schema.Literal("Assistant"),
245
245
  content: AssistantMessageContent,
246
+ imported: Schema.optionalKey(Schema.Literal(true)),
246
247
  inferenceId: InferenceId,
247
248
  promptParts: Schema.optionalKey(Schema.Array(assistantPart)),
248
249
  runId: RunId,
@@ -1 +1 @@
1
- {"version":3,"file":"reduced-state-schema.js","names":[],"sources":["../../src/domain/reduced-state-schema.ts"],"sourcesContent":["import * as Prompt from \"effect/unstable/ai/Prompt\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaTransformation from \"effect/SchemaTransformation\";\n\nimport {\n CancelPendingMessageCommand,\n EDACommand,\n PromotePendingMessageCommand,\n ResumePendingMessagesCommand,\n StopTurnCommand,\n SubmitMessageCommand,\n UserMessageContent,\n} from \"../types/commands\";\nimport {\n CommandId,\n InferenceId,\n MessageId,\n RunId,\n SequenceNumber,\n ToolCallId,\n TurnId,\n} from \"../types/core\";\nimport {\n AssistantMessageContent,\n EDAEventTrace,\n EDARunTrace,\n FailurePayload,\n ProviderPartId,\n RecoveryContinuation,\n SystemPromptText,\n ToolName,\n UsagePayload,\n} from \"../types/events\";\n\nconst PromptFilePart = Schema.Struct(Prompt.FilePart.fields);\nconst PromptReasoningPart = Schema.Struct(Prompt.ReasoningPart.fields);\nconst PromptTextPart = Schema.Struct(Prompt.TextPart.fields);\nconst PromptToolApprovalRequestPart = Schema.Struct(Prompt.ToolApprovalRequestPart.fields);\nconst PromptToolCallPart = Schema.Struct(Prompt.ToolCallPart.fields);\nconst PromptToolResultPart = Schema.Struct(Prompt.ToolResultPart.fields);\n\nconst JsonPromptFilePartEncoded = Schema.Struct({\n ...PromptFilePart.fields,\n data: Schema.String,\n});\n\nconst byteArrayDataUrl = (data: Uint8Array, mediaType: string): string => {\n let binary = \"\";\n for (const byte of data) {\n binary += String.fromCharCode(byte);\n }\n return `data:${mediaType};base64,${btoa(binary)}`;\n};\n\n/**\n * Canonical Effect Prompt file part with an explicit JSON string encoding.\n *\n * Strings pass through unchanged, URLs use their href, and bytes become a data\n * URL. Decoding produces the normal Prompt.FilePart type.\n */\nexport const JsonPromptFilePart = JsonPromptFilePartEncoded.pipe(\n Schema.decodeTo(\n Prompt.FilePart,\n SchemaTransformation.transform<Prompt.FilePartEncoded, typeof JsonPromptFilePartEncoded.Type>({\n decode: (part) => part,\n encode: (part) => ({\n ...part,\n \"~effect/ai/Prompt/Part\": \"~effect/ai/Prompt/Part\",\n data:\n typeof part.data === \"string\"\n ? part.data\n : part.data instanceof URL\n ? part.data.href\n : byteArrayDataUrl(part.data, part.mediaType),\n options: part.options ?? {},\n }),\n }),\n ),\n);\n\nexport const JsonUserMessagePart = Schema.Union([PromptTextPart, JsonPromptFilePart]);\nexport const JsonUserMessageContent = Schema.Union([\n Prompt.ContentFromString,\n Schema.NonEmptyArray(JsonUserMessagePart),\n]);\n\nexport const JsonAssistantMessagePart = Schema.Union([\n PromptTextPart,\n JsonPromptFilePart,\n PromptReasoningPart,\n PromptToolCallPart,\n PromptToolResultPart,\n PromptToolApprovalRequestPart,\n]);\n\n/**\n * Command schema for JSON snapshots.\n *\n * Every command except SubmitMessage is reused directly. SubmitMessage only\n * replaces canonical Prompt file data with its explicit JSON string projection.\n */\nexport const JsonEDACommand = Schema.Union([\n Schema.Struct({\n ...SubmitMessageCommand.fields,\n content: JsonUserMessageContent,\n }),\n StopTurnCommand,\n CancelPendingMessageCommand,\n PromotePendingMessageCommand,\n ResumePendingMessagesCommand,\n]);\n\nexport const CommandTerminalSchema = Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"Completed\"), seq: SequenceNumber }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Cancelled\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const RunTerminalSchema = Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"Completed\"), seq: SequenceNumber }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Interrupted\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const TurnTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n seq: SequenceNumber,\n usage: Schema.optionalKey(UsagePayload),\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Stopped\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const InferenceTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n seq: SequenceNumber,\n usage: Schema.optionalKey(UsagePayload),\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n]);\n\nconst LifecycleTimingFields = {\n durationMs: Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0))),\n startedAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n terminalAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n};\n\nexport const CommandRecordSchema = Schema.Struct({\n admittedSeq: Schema.optionalKey(SequenceNumber),\n admissionTrace: Schema.optionalKey(EDAEventTrace),\n command: Schema.optionalKey(EDACommand),\n commandId: CommandId,\n startedSeq: Schema.optionalKey(SequenceNumber),\n terminal: Schema.optionalKey(CommandTerminalSchema),\n});\n\nexport const JsonCommandRecordSchema = Schema.Struct({\n ...CommandRecordSchema.fields,\n command: Schema.optionalKey(JsonEDACommand),\n});\n\nexport const RunRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n commandIds: Schema.Array(CommandId),\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(RunTerminalSchema),\n trace: EDARunTrace,\n});\n\nexport const TurnRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(TurnTerminalSchema),\n turnId: TurnId,\n});\n\nexport const InferenceRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n inferenceId: InferenceId,\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(InferenceTerminalSchema),\n turnId: TurnId,\n});\n\nexport const ToolDecisionSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Created\"),\n inferenceId: InferenceId,\n params: Schema.Unknown,\n promptPart: Schema.optionalKey(PromptToolCallPart),\n providerExecuted: Schema.Boolean,\n providerPartId: ProviderPartId,\n runId: RunId,\n seq: SequenceNumber,\n toolName: ToolName,\n turnId: TurnId,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Rejected\"),\n inferenceId: InferenceId,\n modelFeedback: Schema.String,\n promptPart: Schema.optionalKey(PromptToolResultPart),\n providerPartId: ProviderPartId,\n reason: Schema.Literals([\"unknown-tool\", \"invalid-params\"]),\n runId: RunId,\n seq: SequenceNumber,\n toolName: ToolName,\n turnId: TurnId,\n }),\n]);\n\nexport const ToolTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n promptPart: Schema.optionalKey(PromptToolResultPart),\n result: Schema.Unknown,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n promptPart: Schema.optionalKey(PromptToolResultPart),\n seq: SequenceNumber,\n }),\n]);\n\nexport const ToolCallRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n decision: Schema.optionalKey(ToolDecisionSchema),\n startedSeq: Schema.optionalKey(SequenceNumber),\n terminal: Schema.optionalKey(ToolTerminalSchema),\n toolCallId: ToolCallId,\n});\n\nconst MessageIdentityFields = {\n createdAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n messageId: MessageId,\n seq: SequenceNumber,\n};\n\nconst PendingMessageStateFields = {\n cancellationReason: Schema.optionalKey(Schema.String),\n cancelledByCommandId: Schema.optionalKey(CommandId),\n cancelledSeq: Schema.optionalKey(SequenceNumber),\n consumedSeq: Schema.optionalKey(SequenceNumber),\n consumedTurnId: Schema.optionalKey(TurnId),\n pausedByCommandId: Schema.optionalKey(CommandId),\n pausedSeq: Schema.optionalKey(SequenceNumber),\n promotedSeq: Schema.optionalKey(SequenceNumber),\n};\n\nconst messageRecordSchema = <UserContent extends Schema.Top, AssistantPart extends Schema.Top>(\n userContent: UserContent,\n assistantPart: AssistantPart,\n) =>\n Schema.Union([\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"System\"),\n content: SystemPromptText,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n ...PendingMessageStateFields,\n _tag: Schema.Literal(\"User\"),\n commandId: CommandId,\n content: userContent,\n disposition: Schema.optionalKey(Schema.Literals([\"queue\", \"steer\"])),\n requestedDisposition: Schema.optionalKey(Schema.Literals([\"queue\", \"steer\"])),\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n ...PendingMessageStateFields,\n _tag: Schema.Literal(\"Steering\"),\n commandId: CommandId,\n content: userContent,\n runId: RunId,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"Assistant\"),\n content: AssistantMessageContent,\n inferenceId: InferenceId,\n promptParts: Schema.optionalKey(Schema.Array(assistantPart)),\n runId: RunId,\n turnId: TurnId,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"AssistantPartial\"),\n content: AssistantMessageContent,\n inferenceId: InferenceId,\n promptParts: Schema.optionalKey(Schema.Array(assistantPart)),\n reason: Schema.String,\n runId: RunId,\n turnId: TurnId,\n }),\n ]);\n\nexport const MessageRecordSchema = messageRecordSchema(\n UserMessageContent,\n Schema.Union([\n PromptTextPart,\n PromptFilePart,\n PromptReasoningPart,\n PromptToolCallPart,\n PromptToolResultPart,\n PromptToolApprovalRequestPart,\n ]),\n);\n\nexport const JsonMessageRecordSchema = messageRecordSchema(\n JsonUserMessageContent,\n JsonAssistantMessagePart,\n);\n\nexport const RecoveryContinuationRecordSchema = Schema.Struct({\n ...RecoveryContinuation.fields,\n seq: SequenceNumber,\n});\n\nexport const TokenUsageTotalsSchema = Schema.Struct({\n cachedInputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n inputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n outputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n reasoningTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n textTokens: Schema.Int.check(Schema.isGreater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AO,OAAO,EACvD,OAAO,uBACT,CAAC"}
1
+ {"version":3,"file":"reduced-state-schema.js","names":[],"sources":["../../src/domain/reduced-state-schema.ts"],"sourcesContent":["import * as Prompt from \"effect/unstable/ai/Prompt\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaTransformation from \"effect/SchemaTransformation\";\n\nimport {\n CancelPendingMessageCommand,\n EDACommand,\n PromotePendingMessageCommand,\n ResumePendingMessagesCommand,\n StopTurnCommand,\n SubmitMessageCommand,\n UserMessageContent,\n} from \"../types/commands\";\nimport {\n CommandId,\n InferenceId,\n MessageId,\n RunId,\n SequenceNumber,\n ToolCallId,\n TurnId,\n} from \"../types/core\";\nimport {\n AssistantMessageContent,\n EDAEventTrace,\n EDARunTrace,\n FailurePayload,\n ProviderPartId,\n RecoveryContinuation,\n SystemPromptText,\n ToolName,\n UsagePayload,\n} from \"../types/events\";\n\nconst PromptFilePart = Schema.Struct(Prompt.FilePart.fields);\nconst PromptReasoningPart = Schema.Struct(Prompt.ReasoningPart.fields);\nconst PromptTextPart = Schema.Struct(Prompt.TextPart.fields);\nconst PromptToolApprovalRequestPart = Schema.Struct(Prompt.ToolApprovalRequestPart.fields);\nconst PromptToolCallPart = Schema.Struct(Prompt.ToolCallPart.fields);\nconst PromptToolResultPart = Schema.Struct(Prompt.ToolResultPart.fields);\n\nconst JsonPromptFilePartEncoded = Schema.Struct({\n ...PromptFilePart.fields,\n data: Schema.String,\n});\n\nconst byteArrayDataUrl = (data: Uint8Array, mediaType: string): string => {\n let binary = \"\";\n for (const byte of data) {\n binary += String.fromCharCode(byte);\n }\n return `data:${mediaType};base64,${btoa(binary)}`;\n};\n\n/**\n * Canonical Effect Prompt file part with an explicit JSON string encoding.\n *\n * Strings pass through unchanged, URLs use their href, and bytes become a data\n * URL. Decoding produces the normal Prompt.FilePart type.\n */\nexport const JsonPromptFilePart = JsonPromptFilePartEncoded.pipe(\n Schema.decodeTo(\n Prompt.FilePart,\n SchemaTransformation.transform<Prompt.FilePartEncoded, typeof JsonPromptFilePartEncoded.Type>({\n decode: (part) => part,\n encode: (part) => ({\n ...part,\n \"~effect/ai/Prompt/Part\": \"~effect/ai/Prompt/Part\",\n data:\n typeof part.data === \"string\"\n ? part.data\n : part.data instanceof URL\n ? part.data.href\n : byteArrayDataUrl(part.data, part.mediaType),\n options: part.options ?? {},\n }),\n }),\n ),\n);\n\nexport const JsonUserMessagePart = Schema.Union([PromptTextPart, JsonPromptFilePart]);\nexport const JsonUserMessageContent = Schema.Union([\n Prompt.ContentFromString,\n Schema.NonEmptyArray(JsonUserMessagePart),\n]);\n\nexport const JsonAssistantMessagePart = Schema.Union([\n PromptTextPart,\n JsonPromptFilePart,\n PromptReasoningPart,\n PromptToolCallPart,\n PromptToolResultPart,\n PromptToolApprovalRequestPart,\n]);\n\n/**\n * Command schema for JSON snapshots.\n *\n * Every command except SubmitMessage is reused directly. SubmitMessage only\n * replaces canonical Prompt file data with its explicit JSON string projection.\n */\nexport const JsonEDACommand = Schema.Union([\n Schema.Struct({\n ...SubmitMessageCommand.fields,\n content: JsonUserMessageContent,\n }),\n StopTurnCommand,\n CancelPendingMessageCommand,\n PromotePendingMessageCommand,\n ResumePendingMessagesCommand,\n]);\n\nexport const CommandTerminalSchema = Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"Completed\"), seq: SequenceNumber }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Cancelled\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const RunTerminalSchema = Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"Completed\"), seq: SequenceNumber }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Interrupted\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const TurnTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n seq: SequenceNumber,\n usage: Schema.optionalKey(UsagePayload),\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Stopped\"),\n reason: Schema.String,\n seq: SequenceNumber,\n }),\n]);\n\nexport const InferenceTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n seq: SequenceNumber,\n usage: Schema.optionalKey(UsagePayload),\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n seq: SequenceNumber,\n }),\n]);\n\nconst LifecycleTimingFields = {\n durationMs: Schema.optionalKey(Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0))),\n startedAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n terminalAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n};\n\nexport const CommandRecordSchema = Schema.Struct({\n admittedSeq: Schema.optionalKey(SequenceNumber),\n admissionTrace: Schema.optionalKey(EDAEventTrace),\n command: Schema.optionalKey(EDACommand),\n commandId: CommandId,\n startedSeq: Schema.optionalKey(SequenceNumber),\n terminal: Schema.optionalKey(CommandTerminalSchema),\n});\n\nexport const JsonCommandRecordSchema = Schema.Struct({\n ...CommandRecordSchema.fields,\n command: Schema.optionalKey(JsonEDACommand),\n});\n\nexport const RunRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n commandIds: Schema.Array(CommandId),\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(RunTerminalSchema),\n trace: EDARunTrace,\n});\n\nexport const TurnRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(TurnTerminalSchema),\n turnId: TurnId,\n});\n\nexport const InferenceRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n inferenceId: InferenceId,\n runId: RunId,\n startedSeq: SequenceNumber,\n terminal: Schema.optionalKey(InferenceTerminalSchema),\n turnId: TurnId,\n});\n\nexport const ToolDecisionSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Created\"),\n inferenceId: InferenceId,\n params: Schema.Unknown,\n promptPart: Schema.optionalKey(PromptToolCallPart),\n providerExecuted: Schema.Boolean,\n providerPartId: ProviderPartId,\n runId: RunId,\n seq: SequenceNumber,\n toolName: ToolName,\n turnId: TurnId,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Rejected\"),\n inferenceId: InferenceId,\n modelFeedback: Schema.String,\n promptPart: Schema.optionalKey(PromptToolResultPart),\n providerPartId: ProviderPartId,\n reason: Schema.Literals([\"unknown-tool\", \"invalid-params\"]),\n runId: RunId,\n seq: SequenceNumber,\n toolName: ToolName,\n turnId: TurnId,\n }),\n]);\n\nexport const ToolTerminalSchema = Schema.Union([\n Schema.Struct({\n _tag: Schema.Literal(\"Completed\"),\n promptPart: Schema.optionalKey(PromptToolResultPart),\n result: Schema.Unknown,\n seq: SequenceNumber,\n }),\n Schema.Struct({\n _tag: Schema.Literal(\"Failed\"),\n error: FailurePayload,\n promptPart: Schema.optionalKey(PromptToolResultPart),\n seq: SequenceNumber,\n }),\n]);\n\nexport const ToolCallRecordSchema = Schema.Struct({\n ...LifecycleTimingFields,\n decision: Schema.optionalKey(ToolDecisionSchema),\n startedSeq: Schema.optionalKey(SequenceNumber),\n terminal: Schema.optionalKey(ToolTerminalSchema),\n toolCallId: ToolCallId,\n});\n\nconst MessageIdentityFields = {\n createdAtMs: Schema.optionalKey(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),\n messageId: MessageId,\n seq: SequenceNumber,\n};\n\nconst PendingMessageStateFields = {\n cancellationReason: Schema.optionalKey(Schema.String),\n cancelledByCommandId: Schema.optionalKey(CommandId),\n cancelledSeq: Schema.optionalKey(SequenceNumber),\n consumedSeq: Schema.optionalKey(SequenceNumber),\n consumedTurnId: Schema.optionalKey(TurnId),\n pausedByCommandId: Schema.optionalKey(CommandId),\n pausedSeq: Schema.optionalKey(SequenceNumber),\n promotedSeq: Schema.optionalKey(SequenceNumber),\n};\n\nconst messageRecordSchema = <UserContent extends Schema.Top, AssistantPart extends Schema.Top>(\n userContent: UserContent,\n assistantPart: AssistantPart,\n) =>\n Schema.Union([\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"System\"),\n content: SystemPromptText,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n ...PendingMessageStateFields,\n _tag: Schema.Literal(\"User\"),\n commandId: CommandId,\n content: userContent,\n disposition: Schema.optionalKey(Schema.Literals([\"queue\", \"steer\"])),\n requestedDisposition: Schema.optionalKey(Schema.Literals([\"queue\", \"steer\"])),\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n ...PendingMessageStateFields,\n _tag: Schema.Literal(\"Steering\"),\n commandId: CommandId,\n content: userContent,\n runId: RunId,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"Assistant\"),\n content: AssistantMessageContent,\n imported: Schema.optionalKey(Schema.Literal(true)),\n inferenceId: InferenceId,\n promptParts: Schema.optionalKey(Schema.Array(assistantPart)),\n runId: RunId,\n turnId: TurnId,\n }),\n Schema.Struct({\n ...MessageIdentityFields,\n _tag: Schema.Literal(\"AssistantPartial\"),\n content: AssistantMessageContent,\n inferenceId: InferenceId,\n promptParts: Schema.optionalKey(Schema.Array(assistantPart)),\n reason: Schema.String,\n runId: RunId,\n turnId: TurnId,\n }),\n ]);\n\nexport const MessageRecordSchema = messageRecordSchema(\n UserMessageContent,\n Schema.Union([\n PromptTextPart,\n PromptFilePart,\n PromptReasoningPart,\n PromptToolCallPart,\n PromptToolResultPart,\n PromptToolApprovalRequestPart,\n ]),\n);\n\nexport const JsonMessageRecordSchema = messageRecordSchema(\n JsonUserMessageContent,\n JsonAssistantMessagePart,\n);\n\nexport const RecoveryContinuationRecordSchema = Schema.Struct({\n ...RecoveryContinuation.fields,\n seq: SequenceNumber,\n});\n\nexport const TokenUsageTotalsSchema = Schema.Struct({\n cachedInputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n inputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n outputTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n reasoningTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n textTokens: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n});\n\nexport const TokenConsumptionStateSchema = Schema.Struct({\n total: TokenUsageTotalsSchema,\n});\n"],"mappings":";;;;;;;;AAkCA,MAAM,iBAAiB,OAAO,OAAO,OAAO,SAAS,MAAM;AAC3D,MAAM,sBAAsB,OAAO,OAAO,OAAO,cAAc,MAAM;AACrE,MAAM,iBAAiB,OAAO,OAAO,OAAO,SAAS,MAAM;AAC3D,MAAM,gCAAgC,OAAO,OAAO,OAAO,wBAAwB,MAAM;AACzF,MAAM,qBAAqB,OAAO,OAAO,OAAO,aAAa,MAAM;AACnE,MAAM,uBAAuB,OAAO,OAAO,OAAO,eAAe,MAAM;AAEvE,MAAM,4BAA4B,OAAO,OAAO;CAC9C,GAAG,eAAe;CAClB,MAAM,OAAO;AACf,CAAC;AAED,MAAM,oBAAoB,MAAkB,cAA8B;CACxE,IAAI,SAAS;CACb,KAAK,MAAM,QAAQ,MACjB,UAAU,OAAO,aAAa,IAAI;CAEpC,OAAO,QAAQ,UAAU,UAAU,KAAK,MAAM;AAChD;;;;;;;AAQA,MAAa,qBAAqB,0BAA0B,KAC1D,OAAO,SACL,OAAO,UACP,qBAAqB,UAAyE;CAC5F,SAAS,SAAS;CAClB,SAAS,UAAU;EACjB,GAAG;EACH,0BAA0B;EAC1B,MACE,OAAO,KAAK,SAAS,WACjB,KAAK,OACL,KAAK,gBAAgB,MACnB,KAAK,KAAK,OACV,iBAAiB,KAAK,MA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G,qBAAqB;CACxB,KAAK;AACP,CAAC;AAED,MAAa,yBAAyB,OAAO,OAAO;CAClD,mBAAmB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CACpE,aAAa,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CAC9D,cAAc,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CAC/D,iBAAiB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;CAClE,YAAY,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;AAC/D,CAAC;AAED,MAAa,8BAA8B,OAAO,OAAO,EACvD,OAAO,uBACT,CAAC"}
@@ -1,2 +1,2 @@
1
- import { A as RunTerminal, B as activeTurnIdentityForCommand, C as ReducedStateCheckpointCommandRecord, D as ReducedStateCheckpointToolDecision, E as ReducedStateCheckpointToolCallRecord, F as ToolDecision, G as frameworkReducedStateReducerName, H as decodeReducedStateCheckpoint, I as ToolTerminal, J as pendingCommands, K as frameworkReducedStateReducerSchemaVersion, L as TurnRecord, M as TokenConsumptionState, N as TokenUsageTotals, O as ReducedStateCheckpointToolTerminal, P as ToolCallRecord, R as TurnTerminal, S as ReducedState, T as ReducedStateCheckpointPayload, U as encodeReducedStateCheckpoint, V as classifyRecoverableWork, W as foldReducedState, X as reduceCommittedEvents, Y as pendingStopCommand, Z as reducedStateCheckpointEventSeqs, _ as LifecycleTiming, b as RecoverableWork, c as ActiveTurnIdentity, d as CompactionRecord, f as CompactionTerminal, g as LifecycleFailure, h as InferenceTerminal, j as StopRequestRecord, k as RunRecord, l as CommandRecord, m as InferenceRecord, p as ContextRecord, q as initialReducedState, s as ActiveCommandEvidence, u as CommandTerminal, v as MessageRecord, w as ReducedStateCheckpointMessageRecord, x as RecoveryContinuationRecord, y as PendingCommand, z as activeCommand } from "../command-queues-CQ9cwRP7.js";
1
+ import { A as RunTerminal, B as activeTurnIdentityForCommand, C as ReducedStateCheckpointCommandRecord, D as ReducedStateCheckpointToolDecision, E as ReducedStateCheckpointToolCallRecord, F as ToolDecision, G as frameworkReducedStateReducerName, H as decodeReducedStateCheckpoint, I as ToolTerminal, J as pendingCommands, K as frameworkReducedStateReducerSchemaVersion, L as TurnRecord, M as TokenConsumptionState, N as TokenUsageTotals, O as ReducedStateCheckpointToolTerminal, P as ToolCallRecord, R as TurnTerminal, S as ReducedState, T as ReducedStateCheckpointPayload, U as encodeReducedStateCheckpoint, V as classifyRecoverableWork, W as foldReducedState, X as reduceCommittedEvents, Y as pendingStopCommand, Z as reducedStateCheckpointEventSeqs, _ as LifecycleTiming, b as RecoverableWork, c as ActiveTurnIdentity, d as CompactionRecord, f as CompactionTerminal, g as LifecycleFailure, h as InferenceTerminal, j as StopRequestRecord, k as RunRecord, l as CommandRecord, m as InferenceRecord, p as ContextRecord, q as initialReducedState, s as ActiveCommandEvidence, u as CommandTerminal, v as MessageRecord, w as ReducedStateCheckpointMessageRecord, x as RecoveryContinuationRecord, y as PendingCommand, z as activeCommand } from "../command-queues-Dwdf41mq.js";
2
2
  export { ActiveCommandEvidence, ActiveTurnIdentity, CommandRecord, CommandTerminal, CompactionRecord, CompactionTerminal, ContextRecord, InferenceRecord, InferenceTerminal, LifecycleFailure, LifecycleTiming, MessageRecord, PendingCommand, RecoverableWork, RecoveryContinuationRecord, ReducedState, ReducedStateCheckpointCommandRecord, ReducedStateCheckpointMessageRecord, ReducedStateCheckpointPayload, ReducedStateCheckpointToolCallRecord, ReducedStateCheckpointToolDecision, ReducedStateCheckpointToolTerminal, RunRecord, RunTerminal, StopRequestRecord, TokenConsumptionState, TokenUsageTotals, ToolCallRecord, ToolDecision, ToolTerminal, TurnRecord, TurnTerminal, activeCommand, activeTurnIdentityForCommand, classifyRecoverableWork, decodeReducedStateCheckpoint, encodeReducedStateCheckpoint, foldReducedState, frameworkReducedStateReducerName, frameworkReducedStateReducerSchemaVersion, initialReducedState, pendingCommands, pendingStopCommand, reduceCommittedEvents, reducedStateCheckpointEventSeqs };
@@ -1,2 +1,2 @@
1
- import { a as encodeReducedStateCheckpoint, c as frameworkReducedStateReducerSchemaVersion, d as pendingStopCommand, f as reduceCommittedEvents, i as decodeReducedStateCheckpoint, l as initialReducedState, n as activeTurnIdentityForCommand, o as foldReducedState, p as reducedStateCheckpointEventSeqs, r as classifyRecoverableWork, s as frameworkReducedStateReducerName, t as activeCommand, u as pendingCommands } from "../reduced-state-C4nVVzz9.js";
1
+ import { a as encodeReducedStateCheckpoint, c as frameworkReducedStateReducerSchemaVersion, d as pendingStopCommand, f as reduceCommittedEvents, i as decodeReducedStateCheckpoint, l as initialReducedState, n as activeTurnIdentityForCommand, o as foldReducedState, p as reducedStateCheckpointEventSeqs, r as classifyRecoverableWork, s as frameworkReducedStateReducerName, t as activeCommand, u as pendingCommands } from "../reduced-state-TMi7ISla.js";
2
2
  export { activeCommand, activeTurnIdentityForCommand, classifyRecoverableWork, decodeReducedStateCheckpoint, encodeReducedStateCheckpoint, foldReducedState, frameworkReducedStateReducerName, frameworkReducedStateReducerSchemaVersion, initialReducedState, pendingCommands, pendingStopCommand, reduceCommittedEvents, reducedStateCheckpointEventSeqs };