effect-durable-agent 0.1.0-alpha.4 → 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 (77) hide show
  1. package/README.md +19 -18
  2. package/dist/{command-queues-CV7O-51r.d.ts → command-queues-Dwdf41mq.d.ts} +2 -2
  3. package/dist/{compaction-zbvLREI8.d.ts → compaction-DpHOf-g7.d.ts} +5 -5
  4. package/dist/{context-projection-n6Rdup0N.d.ts → context-projection-B4DWOZgi.d.ts} +3 -3
  5. package/dist/domain/command-queues.d.ts +1 -1
  6. package/dist/domain/context-projection.d.ts +1 -1
  7. package/dist/domain/message-transcript.d.ts +1 -1
  8. package/dist/domain/reduced-state.d.ts +1 -1
  9. package/dist/host/websocket-protocol.d.ts +26 -3
  10. package/dist/host/websocket-protocol.js +16 -4
  11. package/dist/host/websocket-protocol.js.map +1 -1
  12. package/dist/host/websocket-wire.d.ts +2 -2
  13. package/dist/host/websocket-wire.js +19 -2
  14. package/dist/host/websocket-wire.js.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/{message-transcript-DiOPBY3l.d.ts → message-transcript-CFn_D3MH.d.ts} +3 -3
  17. package/dist/{prompt-projector-C1IbkHr0.d.ts → prompt-projector-C2meuNrV.d.ts} +4 -4
  18. package/dist/{reducer-registry-CjSJBPKo.d.ts → reducer-registry-K9FqZq5-.d.ts} +2 -2
  19. package/dist/{runtime-DOgmAKsO.d.ts → runtime-5NEJngu3.d.ts} +10 -5
  20. package/dist/services/compaction.d.ts +1 -1
  21. package/dist/services/prompt-projector.d.ts +1 -1
  22. package/dist/services/reducer-registry.d.ts +1 -1
  23. package/dist/services/runtime-layer.d.ts +9 -9
  24. package/dist/services/runtime-layer.js +2 -2
  25. package/dist/services/runtime.d.ts +1 -1
  26. package/dist/services/runtime.js +6 -2
  27. package/dist/services/runtime.js.map +1 -1
  28. package/dist/services/session-query.d.ts +2 -2
  29. package/dist/services/session-query.js +20 -3
  30. package/dist/services/session-query.js.map +1 -1
  31. package/dist/services/session-state.d.ts +1 -1
  32. package/dist/services/session-state.js +1 -1
  33. package/dist/services/session-store.d.ts +1 -1
  34. package/dist/services/session-store.js +1 -1
  35. package/dist/services/sink-checkpoint-store.d.ts +1 -1
  36. package/dist/services/sink-registry.d.ts +1 -1
  37. package/dist/services/sink-registry.js +1 -1
  38. package/dist/services/span-names.d.ts +1 -1
  39. package/dist/services/span-names.js +1 -0
  40. package/dist/services/span-names.js.map +1 -1
  41. package/dist/services/tool-registry.d.ts +1 -1
  42. package/dist/services/websocket-delivery.d.ts +90 -0
  43. package/dist/services/websocket-delivery.js +221 -0
  44. package/dist/services/websocket-delivery.js.map +1 -0
  45. package/dist/{session-query-C-C4m1eq.d.ts → session-query-5oyZRaQL.d.ts} +16 -9
  46. package/dist/{session-state-CjOSvWbe.d.ts → session-state-CI1xeT6f.d.ts} +11 -11
  47. package/dist/{session-state-SStf0KUo.js → session-state-D7dqko7r.js} +3 -3
  48. package/dist/{session-state-SStf0KUo.js.map → session-state-D7dqko7r.js.map} +1 -1
  49. package/dist/{session-store-DZZUffUy.d.ts → session-store-BLg6UvZa.d.ts} +2 -2
  50. package/dist/{sink-checkpoint-store-BZmQFTRE.d.ts → sink-checkpoint-store-B9WNvDtY.d.ts} +2 -2
  51. package/dist/{sink-registry-D13eUO_c.js → sink-registry-BbmoI9uv.js} +17 -24
  52. package/dist/sink-registry-BbmoI9uv.js.map +1 -0
  53. package/dist/{sink-registry-Cf79ICdW.d.ts → sink-registry-CO3YPS1p.d.ts} +26 -14
  54. package/dist/testkit/layers.d.ts +10 -10
  55. package/dist/testkit/layers.js +3 -3
  56. package/dist/{tool-registry-B7Wona6N.d.ts → tool-registry-B8H1P6Pu.d.ts} +2 -2
  57. package/dist/{websocket-wire-QD2SquQE.d.ts → websocket-wire-DPxwY4G5.d.ts} +39 -10
  58. package/package.json +11 -23
  59. package/testing/offline-trace/README.md +2 -1
  60. package/CHANGELOG.md +0 -34
  61. package/CONTRIBUTING.md +0 -26
  62. package/SECURITY.md +0 -7
  63. package/dist/services/websocket-subscriber.d.ts +0 -54
  64. package/dist/services/websocket-subscriber.js +0 -190
  65. package/dist/services/websocket-subscriber.js.map +0 -1
  66. package/dist/sink-registry-D13eUO_c.js.map +0 -1
  67. package/docs/assets/architecture.svg +0 -216
  68. package/docs/assets/event-sequence.svg +0 -133
  69. package/docs/assets/gcp-trace.png +0 -0
  70. package/docs/assets/hero.svg +0 -33
  71. package/docs/message-steering.md +0 -831
  72. package/docs/releasing.md +0 -114
  73. package/docs/spec.md +0 -777
  74. package/docs/subagents.md +0 -725
  75. package/docs/testing.md +0 -64
  76. package/docs/ui-projection.md +0 -742
  77. package/docs/websocket-protocol.md +0 -639
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
 
@@ -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,7 +127,7 @@ 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](./packages/cloudflare/examples/002-slack-bridge) for idempotent
130
+ See the [Slack bridge example](https://github.com/advait/effect-durable-agent/tree/master/examples/002-slack-bridge) for idempotent
131
131
  ingress, a custom reducer, and durable outbound delivery.
132
132
 
133
133
  **Durable state. Durable side effects.**
@@ -161,7 +161,7 @@ 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
166
  ## Host-neutral core, pluggable deployment
167
167
 
@@ -210,9 +210,10 @@ Start with the executable examples:
210
210
 
211
211
  | Example | What it demonstrates |
212
212
  | --- | --- |
213
- | [`001-no-tools`](./packages/cloudflare/examples/001-no-tools) | Minimal Durable Object session and durable command admission. |
214
- | [`002-slack-bridge`](./packages/cloudflare/examples/002-slack-bridge) | Idempotent ingress, application events and reducers, and a retrying durable sink. |
215
- | [`003-sandbox-lifecycle`](./packages/cloudflare/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. |
216
217
 
217
218
  ## Why EDA instead of another agent SDK or framework?
218
219
 
@@ -293,16 +294,16 @@ typed boundaries, structured concurrency, and first-class tracing.
293
294
 
294
295
  ## Documentation
295
296
 
296
- - [Current implementation](./docs/spec.md)
297
- - [Testing strategy](./docs/testing.md)
298
- - [WebSocket live-event protocol](./docs/websocket-protocol.md)
299
- - [Message steering](./docs/message-steering.md)
300
- - [UI projection proposal](./docs/ui-projection.md)
301
- - [Subagents proposal](./docs/subagents.md)
302
- - [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)
303
304
 
304
305
  ## Contributing and license
305
306
 
306
- 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
307
308
  Durable Agent is available under the [MIT License](./LICENSE). Please report vulnerabilities
308
- 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).
@@ -3,7 +3,7 @@ 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
5
  import { r as AssistantMessageContent, rt as RecoveryContinuation } from "./durable-B7M6TD_0.js";
6
- import { t as CommittedDurableEvent } from "./session-store-DZZUffUy.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
@@ -466,4 +466,4 @@ declare const emptyCommandQueues: CommandQueues;
466
466
  declare const deriveCommandQueues: (state: CommandQueueSource) => CommandQueues;
467
467
  //#endregion
468
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 };
469
- //# sourceMappingURL=command-queues-CV7O-51r.d.ts.map
469
+ //# sourceMappingURL=command-queues-Dwdf41mq.d.ts.map
@@ -1,6 +1,6 @@
1
- import { i as ContextProjection, n as CompactionPolicyId, t as CompactionExecutorId } from "./context-projection-n6Rdup0N.js";
2
- import { o as EDASessionStoreError, r as DurableAppendEntry, t as CommittedDurableEvent } from "./session-store-DZZUffUy.js";
3
- import { S as ReducedState } from "./command-queues-CV7O-51r.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
4
  import { t as IdGenerator } from "./id-generator-Ckl8_XWW.js";
5
5
  import { t as EventFactory } from "./event-factory-CLJcyymV.js";
6
6
  import { t as EDAKeepAlive } from "./keep-alive-Chl5SJxy.js";
@@ -139,8 +139,8 @@ interface CompactionRunnerShape {
139
139
  declare const CompactionRunner_base: Context.ServiceClass<CompactionRunner, "@effect-durable-agent/CompactionRunner", CompactionRunnerShape>;
140
140
  /** Framework-owned compaction lifecycle runner. */
141
141
  declare class CompactionRunner extends CompactionRunner_base {
142
- static readonly Live: Layer.Layer<CompactionRunner, never, EDAKeepAlive | IdGenerator | EventFactory | CompactionExecutor | CompactionPolicy>;
142
+ static readonly Live: Layer.Layer<CompactionRunner, never, EDAKeepAlive | IdGenerator | EventFactory | CompactionPolicy | CompactionExecutor>;
143
143
  }
144
144
  //#endregion
145
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 };
146
- //# sourceMappingURL=compaction-zbvLREI8.d.ts.map
146
+ //# sourceMappingURL=compaction-DpHOf-g7.d.ts.map
@@ -87,9 +87,9 @@ declare const emptyContextProjection: {
87
87
  readonly contextVersion: number & import("effect/Brand").Brand<"ContextVersion">;
88
88
  readonly currentSummary?: {
89
89
  readonly compactionId: string & import("effect/Brand").Brand<"CompactionId">;
90
- readonly summaryId: string & import("effect/Brand").Brand<"SummaryId">;
91
90
  readonly sourceFromSeq: number & import("effect/Brand").Brand<"SequenceNumber">;
92
91
  readonly sourceToSeq: number & import("effect/Brand").Brand<"SequenceNumber">;
92
+ readonly summaryId: string & import("effect/Brand").Brand<"SummaryId">;
93
93
  readonly retainedFromContextSeq: number & import("effect/Brand").Brand<"SequenceNumber">;
94
94
  readonly text: string;
95
95
  readonly promptMessage: {
@@ -116,11 +116,11 @@ declare const emptyContextProjection: {
116
116
  readonly [x: string]: Schema.Json;
117
117
  };
118
118
  } | {
119
+ readonly type: "file";
119
120
  readonly "~effect/ai/Prompt/Part": "~effect/ai/Prompt/Part";
120
121
  readonly options: {
121
122
  readonly [x: string]: Schema.Json;
122
123
  };
123
- readonly type: "file";
124
124
  readonly mediaType: string;
125
125
  readonly data: string | Uint8Array<ArrayBufferLike> | URL;
126
126
  readonly fileName?: string | undefined;
@@ -137,4 +137,4 @@ declare const emptyContextProjection: {
137
137
  };
138
138
  //#endregion
139
139
  export { emptyContextProjection as a, ContextProjection as i, CompactionPolicyId as n, CompactionSummaryArtifact as r, CompactionExecutorId as t };
140
- //# sourceMappingURL=context-projection-n6Rdup0N.d.ts.map
140
+ //# sourceMappingURL=context-projection-B4DWOZgi.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-CV7O-51r.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 };
@@ -1,2 +1,2 @@
1
- import { a as emptyContextProjection, i as ContextProjection, n as CompactionPolicyId, r as CompactionSummaryArtifact, t as CompactionExecutorId } from "../context-projection-n6Rdup0N.js";
1
+ import { a as emptyContextProjection, i as ContextProjection, n as CompactionPolicyId, r as CompactionSummaryArtifact, t as CompactionExecutorId } from "../context-projection-B4DWOZgi.js";
2
2
  export { CompactionExecutorId, CompactionPolicyId, CompactionSummaryArtifact, ContextProjection, emptyContextProjection };
@@ -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-DiOPBY3l.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 };
@@ -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-CV7O-51r.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,5 +1,5 @@
1
1
  import { m as SequenceNumber } from "../core-CYT6DBaS.js";
2
- import { r as EDAWebSocketServerFrameEncoder } from "../websocket-wire-QD2SquQE.js";
2
+ import { g as EDA_WEB_SOCKET_PONG_MESSAGE, h as EDA_WEB_SOCKET_PING_MESSAGE, r as EDAWebSocketServerFrameEncoder } from "../websocket-wire-DPxwY4G5.js";
3
3
  import * as Effect from "effect/Effect";
4
4
  import * as Schema from "effect/Schema";
5
5
 
@@ -29,6 +29,7 @@ declare const EDAWebSocketFlowControl: Schema.Struct<{
29
29
  readonly maxFrameBytes: Schema.Int;
30
30
  readonly maxFrameEvents: Schema.Int;
31
31
  readonly maxInFlightFrames: Schema.Int;
32
+ readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
32
33
  readonly subscriberBufferCapacityEvents: Schema.Int;
33
34
  }>;
34
35
  type EDAWebSocketFlowControl = typeof EDAWebSocketFlowControl.Type;
@@ -46,6 +47,7 @@ declare const EDAWebSocketHelloFrame: Schema.Struct<{
46
47
  readonly maxFrameBytes: Schema.Int;
47
48
  readonly maxFrameEvents: Schema.Int;
48
49
  readonly maxInFlightFrames: Schema.Int;
50
+ readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
49
51
  readonly subscriberBufferCapacityEvents: Schema.Int;
50
52
  }>;
51
53
  }>;
@@ -91,13 +93,29 @@ declare const EDAWebSocketEventsFrame: Schema.Struct<{
91
93
  readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
92
94
  }>;
93
95
  type EDAWebSocketEventsFrame = typeof EDAWebSocketEventsFrame.Type;
94
- /** Idle server keepalive frame that clients may ignore and must not ACK. */
96
+ /**
97
+ * Deprecated idle server keepalive frame.
98
+ *
99
+ * Servers no longer send heartbeats; the schema remains so deployed clients
100
+ * keep decoding the server frame union. Liveness is client-originated via
101
+ * {@link EDAWebSocketPingFrame} and the host-level auto-response pong.
102
+ */
95
103
  declare const EDAWebSocketHeartbeatFrame: Schema.Struct<{
96
104
  readonly serverTimeMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
97
105
  readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
98
106
  readonly _tag: Schema.Literal<"heartbeat">;
99
107
  }>;
100
108
  type EDAWebSocketHeartbeatFrame = typeof EDAWebSocketHeartbeatFrame.Type;
109
+ /** Client liveness ping; hosts answer with a pong and never ACK-track it. */
110
+ declare const EDAWebSocketPingFrame: Schema.Struct<{
111
+ readonly _tag: Schema.Literal<"ping">;
112
+ }>;
113
+ type EDAWebSocketPingFrame = typeof EDAWebSocketPingFrame.Type;
114
+ /** Server liveness pong; clients may ignore it and must not ACK it. */
115
+ declare const EDAWebSocketPongFrame: Schema.Struct<{
116
+ readonly _tag: Schema.Literal<"pong">;
117
+ }>;
118
+ type EDAWebSocketPongFrame = typeof EDAWebSocketPongFrame.Type;
101
119
  /** Optional final frame sent before a lag-close. */
102
120
  declare const EDAWebSocketLaggedFrame: Schema.Struct<{
103
121
  readonly resumeSeq: Schema.brand<Schema.Int, "SequenceNumber">;
@@ -123,6 +141,7 @@ declare const EDAWebSocketServerFrame: Schema.Union<readonly [Schema.Struct<{
123
141
  readonly maxFrameBytes: Schema.Int;
124
142
  readonly maxFrameEvents: Schema.Int;
125
143
  readonly maxInFlightFrames: Schema.Int;
144
+ readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
126
145
  readonly subscriberBufferCapacityEvents: Schema.Int;
127
146
  }>;
128
147
  }>, Schema.Struct<{
@@ -167,6 +186,8 @@ declare const EDAWebSocketServerFrame: Schema.Union<readonly [Schema.Struct<{
167
186
  readonly serverTimeMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
168
187
  readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
169
188
  readonly _tag: Schema.Literal<"heartbeat">;
189
+ }>, Schema.Struct<{
190
+ readonly _tag: Schema.Literal<"pong">;
170
191
  }>, Schema.Struct<{
171
192
  readonly resumeSeq: Schema.brand<Schema.Int, "SequenceNumber">;
172
193
  readonly _tag: Schema.Literal<"lagged">;
@@ -188,6 +209,8 @@ declare const EDAWebSocketClientFrame: Schema.Union<readonly [Schema.Struct<{
188
209
  readonly frameId: Schema.brand<Schema.Int, "FrameId">;
189
210
  readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
190
211
  readonly _tag: Schema.Literal<"ack">;
212
+ }>, Schema.Struct<{
213
+ readonly _tag: Schema.Literal<"ping">;
191
214
  }>]>;
192
215
  type EDAWebSocketClientFrame = typeof EDAWebSocketClientFrame.Type;
193
216
  /** Small attachment persisted by hibernation-capable WebSocket hosts. */
@@ -225,5 +248,5 @@ declare const decodeEDAWebSocketClientMessage: (input: string) => Effect.Effect<
225
248
  /** Short close reason that fits the WebSocket protocol reason limit. */
226
249
  declare const laggedCloseReason: (seq: SequenceNumber) => string;
227
250
  //#endregion
228
- export { EDAWebSocketAckFrame, EDAWebSocketAttachment, EDAWebSocketClientFrame, EDAWebSocketErrorFrame, EDAWebSocketEventsFrame, EDAWebSocketFlowControl, EDAWebSocketHeartbeatFrame, EDAWebSocketHelloFrame, EDAWebSocketLaggedFrame, EDAWebSocketServerFrame, EDA_WEB_SOCKET_PROTOCOL_VERSION, EDA_WS_CLOSE_GOING_AWAY, EDA_WS_CLOSE_LAGGED, EDA_WS_CLOSE_PROTOCOL_ERROR, EDA_WS_CLOSE_SEND_FAILED, EDA_WS_CLOSE_UNSUPPORTED_DATA, FrameId, SubscriberId, decodeEDAWebSocketAttachment, decodeEDAWebSocketClientMessage, defaultEDAWebSocketFlowControl, encodeEDAWebSocketServerFrame, laggedCloseReason };
251
+ export { EDAWebSocketAckFrame, EDAWebSocketAttachment, EDAWebSocketClientFrame, EDAWebSocketErrorFrame, EDAWebSocketEventsFrame, EDAWebSocketFlowControl, EDAWebSocketHeartbeatFrame, EDAWebSocketHelloFrame, EDAWebSocketLaggedFrame, EDAWebSocketPingFrame, EDAWebSocketPongFrame, EDAWebSocketServerFrame, EDA_WEB_SOCKET_PING_MESSAGE, EDA_WEB_SOCKET_PONG_MESSAGE, EDA_WEB_SOCKET_PROTOCOL_VERSION, EDA_WS_CLOSE_GOING_AWAY, EDA_WS_CLOSE_LAGGED, EDA_WS_CLOSE_PROTOCOL_ERROR, EDA_WS_CLOSE_SEND_FAILED, EDA_WS_CLOSE_UNSUPPORTED_DATA, FrameId, SubscriberId, decodeEDAWebSocketAttachment, decodeEDAWebSocketClientMessage, defaultEDAWebSocketFlowControl, encodeEDAWebSocketServerFrame, laggedCloseReason };
229
252
  //# sourceMappingURL=websocket-protocol.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { SequenceNumber, SessionId } from "../types/core.js";
2
2
  import { EDATraceMetadata } from "../types/tracing.js";
3
3
  import { mr as PositionedEvent, yr as UnixEpochMillis } from "../durable-DsV9PxZC.js";
4
- import { EDAWebSocketWireAckFrame, EDAWebSocketWireClientFrame, EDAWebSocketWireErrorFrame, EDAWebSocketWireFlowControl, EDAWebSocketWireHeartbeatFrame, EDAWebSocketWireHelloFrame, EDAWebSocketWireLaggedFrame, edaFrameworkWebSocketWireProtocol } from "./websocket-wire.js";
4
+ import { EDAWebSocketWireAckFrame, EDAWebSocketWireClientFrame, EDAWebSocketWireErrorFrame, EDAWebSocketWireFlowControl, EDAWebSocketWireHeartbeatFrame, EDAWebSocketWireHelloFrame, EDAWebSocketWireLaggedFrame, EDAWebSocketWirePingFrame, EDAWebSocketWirePongFrame, EDA_WEB_SOCKET_PING_MESSAGE, EDA_WEB_SOCKET_PONG_MESSAGE, edaFrameworkWebSocketWireProtocol } from "./websocket-wire.js";
5
5
  import * as Effect from "effect/Effect";
6
6
  import * as Schema from "effect/Schema";
7
7
  //#region src/host/websocket-protocol.ts
@@ -30,6 +30,7 @@ const defaultEDAWebSocketFlowControl = {
30
30
  maxFrameBytes: 256 * 1024,
31
31
  maxFrameEvents: 1,
32
32
  maxInFlightFrames: 16,
33
+ pingIntervalMs: 3e4,
33
34
  subscriberBufferCapacityEvents: 2048
34
35
  };
35
36
  /** First server frame; announces protocol and flow-control policy. */
@@ -45,12 +46,22 @@ const EDAWebSocketEventsFrame = Schema.Struct({
45
46
  events: Schema.NonEmptyArray(PositionedEvent),
46
47
  durableThroughSeq: SequenceNumber
47
48
  });
48
- /** Idle server keepalive frame that clients may ignore and must not ACK. */
49
+ /**
50
+ * Deprecated idle server keepalive frame.
51
+ *
52
+ * Servers no longer send heartbeats; the schema remains so deployed clients
53
+ * keep decoding the server frame union. Liveness is client-originated via
54
+ * {@link EDAWebSocketPingFrame} and the host-level auto-response pong.
55
+ */
49
56
  const EDAWebSocketHeartbeatFrame = Schema.Struct({
50
57
  ...EDAWebSocketWireHeartbeatFrame.fields,
51
58
  serverTimeMs: UnixEpochMillis,
52
59
  durableThroughSeq: SequenceNumber
53
60
  });
61
+ /** Client liveness ping; hosts answer with a pong and never ACK-track it. */
62
+ const EDAWebSocketPingFrame = EDAWebSocketWirePingFrame;
63
+ /** Server liveness pong; clients may ignore it and must not ACK it. */
64
+ const EDAWebSocketPongFrame = EDAWebSocketWirePongFrame;
54
65
  /** Optional final frame sent before a lag-close. */
55
66
  const EDAWebSocketLaggedFrame = Schema.Struct({
56
67
  ...EDAWebSocketWireLaggedFrame.fields,
@@ -63,6 +74,7 @@ const EDAWebSocketServerFrame = Schema.Union([
63
74
  EDAWebSocketHelloFrame,
64
75
  EDAWebSocketEventsFrame,
65
76
  EDAWebSocketHeartbeatFrame,
77
+ EDAWebSocketPongFrame,
66
78
  EDAWebSocketLaggedFrame,
67
79
  EDAWebSocketErrorFrame
68
80
  ]);
@@ -73,7 +85,7 @@ const EDAWebSocketAckFrame = Schema.Struct({
73
85
  durableThroughSeq: SequenceNumber
74
86
  });
75
87
  /** Client-to-server application frame union. */
76
- const EDAWebSocketClientFrame = Schema.Union([EDAWebSocketAckFrame]);
88
+ const EDAWebSocketClientFrame = Schema.Union([EDAWebSocketAckFrame, EDAWebSocketPingFrame]);
77
89
  /** Small attachment persisted by hibernation-capable WebSocket hosts. */
78
90
  const EDAWebSocketAttachment = Schema.Struct({
79
91
  kind: Schema.Literal("eda-events-v1"),
@@ -94,6 +106,6 @@ const decodeEDAWebSocketClientMessage = (input) => Effect.try({
94
106
  /** Short close reason that fits the WebSocket protocol reason limit. */
95
107
  const laggedCloseReason = (seq) => `lag;seq=${seq}`;
96
108
  //#endregion
97
- export { EDAWebSocketAckFrame, EDAWebSocketAttachment, EDAWebSocketClientFrame, EDAWebSocketErrorFrame, EDAWebSocketEventsFrame, EDAWebSocketFlowControl, EDAWebSocketHeartbeatFrame, EDAWebSocketHelloFrame, EDAWebSocketLaggedFrame, EDAWebSocketServerFrame, EDA_WEB_SOCKET_PROTOCOL_VERSION, EDA_WS_CLOSE_GOING_AWAY, EDA_WS_CLOSE_LAGGED, EDA_WS_CLOSE_PROTOCOL_ERROR, EDA_WS_CLOSE_SEND_FAILED, EDA_WS_CLOSE_UNSUPPORTED_DATA, FrameId, SubscriberId, decodeEDAWebSocketAttachment, decodeEDAWebSocketClientMessage, defaultEDAWebSocketFlowControl, encodeEDAWebSocketServerFrame, laggedCloseReason };
109
+ export { EDAWebSocketAckFrame, EDAWebSocketAttachment, EDAWebSocketClientFrame, EDAWebSocketErrorFrame, EDAWebSocketEventsFrame, EDAWebSocketFlowControl, EDAWebSocketHeartbeatFrame, EDAWebSocketHelloFrame, EDAWebSocketLaggedFrame, EDAWebSocketPingFrame, EDAWebSocketPongFrame, EDAWebSocketServerFrame, EDA_WEB_SOCKET_PING_MESSAGE, EDA_WEB_SOCKET_PONG_MESSAGE, EDA_WEB_SOCKET_PROTOCOL_VERSION, EDA_WS_CLOSE_GOING_AWAY, EDA_WS_CLOSE_LAGGED, EDA_WS_CLOSE_PROTOCOL_ERROR, EDA_WS_CLOSE_SEND_FAILED, EDA_WS_CLOSE_UNSUPPORTED_DATA, FrameId, SubscriberId, decodeEDAWebSocketAttachment, decodeEDAWebSocketClientMessage, defaultEDAWebSocketFlowControl, encodeEDAWebSocketServerFrame, laggedCloseReason };
98
110
 
99
111
  //# sourceMappingURL=websocket-protocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"websocket-protocol.js","names":[],"sources":["../../src/host/websocket-protocol.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\nimport {\n EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION,\n EDAWebSocketWireAckFrame,\n EDAWebSocketWireClientFrame,\n EDAWebSocketWireErrorFrame,\n EDAWebSocketWireFlowControl,\n EDAWebSocketWireHeartbeatFrame,\n EDAWebSocketWireHelloFrame,\n EDAWebSocketWireLaggedFrame,\n edaFrameworkWebSocketWireProtocol,\n type EDAWebSocketServerFrameEncoder,\n} from \"./websocket-wire\";\n\nimport { SequenceNumber, SessionId } from \"../types/core\";\nimport { PositionedEvent, UnixEpochMillis } from \"../types/events\";\nimport { EDATraceMetadata } from \"../types/tracing\";\n\n/** Current EDA live-event WebSocket protocol version. */\nexport const EDA_WEB_SOCKET_PROTOCOL_VERSION = EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION;\n\n/** WebSocket close code used when a subscriber cannot keep up with live delivery. */\nexport const EDA_WS_CLOSE_LAGGED = 4008;\n\n/** WebSocket close code used for normal host-driven shutdown. */\nexport const EDA_WS_CLOSE_GOING_AWAY = 1001;\n\n/** WebSocket close code used for malformed client protocol messages. */\nexport const EDA_WS_CLOSE_PROTOCOL_ERROR = 1002;\n\n/** WebSocket close code used when the host cannot send a frame. */\nexport const EDA_WS_CLOSE_SEND_FAILED = 1011;\n\n/** WebSocket close code used for unsupported binary messages. */\nexport const EDA_WS_CLOSE_UNSUPPORTED_DATA = 1003;\n\n/** Live subscriber identity persisted in WebSocket attachments. */\nexport const SubscriberId = Schema.NonEmptyString.pipe(Schema.brand(\"SubscriberId\"));\nexport type SubscriberId = typeof SubscriberId.Type;\n\n/** Per-connection monotonically increasing server frame id. */\nexport const FrameId = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).pipe(\n Schema.brand(\"FrameId\"),\n);\nexport type FrameId = typeof FrameId.Type;\n\n/** Flow-control policy announced by the server in the hello frame. */\nexport const EDAWebSocketFlowControl = EDAWebSocketWireFlowControl;\nexport type EDAWebSocketFlowControl = typeof EDAWebSocketFlowControl.Type;\n\n/** Default bounded policy sized for fast model deltas and large durable tool/message events. */\nexport const defaultEDAWebSocketFlowControl: EDAWebSocketFlowControl = {\n ackTimeoutMs: 30_000,\n heartbeatIntervalMs: 10_000,\n maxFrameBytes: 256 * 1024,\n maxFrameEvents: 1,\n maxInFlightFrames: 16,\n subscriberBufferCapacityEvents: 2_048,\n};\n\n/** First server frame; announces protocol and flow-control policy. */\nexport const EDAWebSocketHelloFrame = Schema.Struct({\n ...EDAWebSocketWireHelloFrame.fields,\n subscriberId: SubscriberId,\n resumeSeq: SequenceNumber,\n});\nexport type EDAWebSocketHelloFrame = typeof EDAWebSocketHelloFrame.Type;\n\n/** Ordered positioned events delivered to the client. */\nexport const EDAWebSocketEventsFrame = Schema.Struct({\n _tag: Schema.Literal(\"events\"),\n frameId: FrameId,\n events: Schema.NonEmptyArray(PositionedEvent),\n durableThroughSeq: SequenceNumber,\n});\nexport type EDAWebSocketEventsFrame = typeof EDAWebSocketEventsFrame.Type;\n\n/** Idle server keepalive frame that clients may ignore and must not ACK. */\nexport const EDAWebSocketHeartbeatFrame = Schema.Struct({\n ...EDAWebSocketWireHeartbeatFrame.fields,\n serverTimeMs: UnixEpochMillis,\n durableThroughSeq: SequenceNumber,\n});\nexport type EDAWebSocketHeartbeatFrame = typeof EDAWebSocketHeartbeatFrame.Type;\n\n/** Optional final frame sent before a lag-close. */\nexport const EDAWebSocketLaggedFrame = Schema.Struct({\n ...EDAWebSocketWireLaggedFrame.fields,\n resumeSeq: SequenceNumber,\n});\nexport type EDAWebSocketLaggedFrame = typeof EDAWebSocketLaggedFrame.Type;\n\n/** Optional final frame sent before a protocol/internal close. */\nexport const EDAWebSocketErrorFrame = EDAWebSocketWireErrorFrame;\nexport type EDAWebSocketErrorFrame = typeof EDAWebSocketErrorFrame.Type;\n\n/** Server-to-client application frame union. */\nexport const EDAWebSocketServerFrame = Schema.Union([\n EDAWebSocketHelloFrame,\n EDAWebSocketEventsFrame,\n EDAWebSocketHeartbeatFrame,\n EDAWebSocketLaggedFrame,\n EDAWebSocketErrorFrame,\n]);\nexport type EDAWebSocketServerFrame = typeof EDAWebSocketServerFrame.Type;\n\n/** Client acknowledgement after applying a server frame. */\nexport const EDAWebSocketAckFrame = Schema.Struct({\n ...EDAWebSocketWireAckFrame.fields,\n frameId: FrameId,\n durableThroughSeq: SequenceNumber,\n});\nexport type EDAWebSocketAckFrame = typeof EDAWebSocketAckFrame.Type;\n\n/** Client-to-server application frame union. */\nexport const EDAWebSocketClientFrame = Schema.Union([EDAWebSocketAckFrame]);\nexport type EDAWebSocketClientFrame = typeof EDAWebSocketClientFrame.Type;\n\n/** Small attachment persisted by hibernation-capable WebSocket hosts. */\nexport const EDAWebSocketAttachment = Schema.Struct({\n kind: Schema.Literal(\"eda-events-v1\"),\n sessionId: SessionId,\n subscriberId: SubscriberId,\n lastAckedSeq: SequenceNumber,\n trace: EDATraceMetadata,\n});\nexport type EDAWebSocketAttachment = typeof EDAWebSocketAttachment.Type;\n\n/** Serialize a server frame for a text WebSocket message. */\nexport const encodeEDAWebSocketServerFrame = (\n frame: EDAWebSocketServerFrame,\n protocol?: EDAWebSocketServerFrameEncoder,\n): string => (protocol ?? edaFrameworkWebSocketWireProtocol.host).encodeServerFrame(frame);\n\n/** Decode an unknown attachment value from host WebSocket hibernation storage. */\nexport const decodeEDAWebSocketAttachment = (\n input: unknown,\n): Effect.Effect<EDAWebSocketAttachment, unknown> =>\n Schema.decodeUnknownEffect(EDAWebSocketAttachment)(input);\n\n/** Decode an inbound text WebSocket message at the host boundary. */\nexport const decodeEDAWebSocketClientMessage = (\n input: string,\n): Effect.Effect<EDAWebSocketClientFrame, unknown> =>\n Effect.try({\n try: () => JSON.parse(input) as unknown,\n catch: (error) => error,\n }).pipe(\n Effect.flatMap((json) => Schema.decodeUnknownEffect(EDAWebSocketWireClientFrame)(json)),\n Effect.flatMap((frame) => Schema.decodeUnknownEffect(EDAWebSocketClientFrame)(frame)),\n );\n\n/** Short close reason that fits the WebSocket protocol reason limit. */\nexport const laggedCloseReason = (seq: SequenceNumber): string => `lag;seq=${seq}`;\n"],"mappings":";;;;;;;;AAoBA,MAAa,kCAAA;;AAGb,MAAa,sBAAsB;;AAGnC,MAAa,0BAA0B;;AAGvC,MAAa,8BAA8B;;AAG3C,MAAa,2BAA2B;;AAGxC,MAAa,gCAAgC;;AAG7C,MAAa,eAAe,OAAO,eAAe,KAAK,OAAO,MAAM,cAAc,CAAC;;AAInF,MAAa,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC,EAAE,KACxE,OAAO,MAAM,SAAS,CACxB;;AAIA,MAAa,0BAA0B;;AAIvC,MAAa,iCAA0D;CACrE,cAAc;CACd,qBAAqB;CACrB,eAAe,MAAM;CACrB,gBAAgB;CAChB,mBAAmB;CACnB,gCAAgC;AAClC;;AAGA,MAAa,yBAAyB,OAAO,OAAO;CAClD,GAAG,2BAA2B;CAC9B,cAAc;CACd,WAAW;AACb,CAAC;;AAID,MAAa,0BAA0B,OAAO,OAAO;CACnD,MAAM,OAAO,QAAQ,QAAQ;CAC7B,SAAS;CACT,QAAQ,OAAO,cAAc,eAAe;CAC5C,mBAAmB;AACrB,CAAC;;AAID,MAAa,6BAA6B,OAAO,OAAO;CACtD,GAAG,+BAA+B;CAClC,cAAc;CACd,mBAAmB;AACrB,CAAC;;AAID,MAAa,0BAA0B,OAAO,OAAO;CACnD,GAAG,4BAA4B;CAC/B,WAAW;AACb,CAAC;;AAID,MAAa,yBAAyB;;AAItC,MAAa,0BAA0B,OAAO,MAAM;CAClD;CACA;CACA;CACA;CACA;AACF,CAAC;;AAID,MAAa,uBAAuB,OAAO,OAAO;CAChD,GAAG,yBAAyB;CAC5B,SAAS;CACT,mBAAmB;AACrB,CAAC;;AAID,MAAa,0BAA0B,OAAO,MAAM,CAAC,oBAAoB,CAAC;;AAI1E,MAAa,yBAAyB,OAAO,OAAO;CAClD,MAAM,OAAO,QAAQ,eAAe;CACpC,WAAW;CACX,cAAc;CACd,cAAc;CACd,OAAO;AACT,CAAC;;AAID,MAAa,iCACX,OACA,cACY,YAAY,kCAAkC,MAAM,kBAAkB,KAAK;;AAGzF,MAAa,gCACX,UAEA,OAAO,oBAAoB,sBAAsB,EAAE,KAAK;;AAG1D,MAAa,mCACX,UAEA,OAAO,IAAI;CACT,WAAW,KAAK,MAAM,KAAK;CAC3B,QAAQ,UAAU;AACpB,CAAC,EAAE,KACD,OAAO,SAAS,SAAS,OAAO,oBAAoB,2BAA2B,EAAE,IAAI,CAAC,GACtF,OAAO,SAAS,UAAU,OAAO,oBAAoB,uBAAuB,EAAE,KAAK,CAAC,CACtF;;AAGF,MAAa,qBAAqB,QAAgC,WAAW"}
1
+ {"version":3,"file":"websocket-protocol.js","names":[],"sources":["../../src/host/websocket-protocol.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport * as Schema from \"effect/Schema\";\nimport {\n EDA_WEB_SOCKET_PING_MESSAGE,\n EDA_WEB_SOCKET_PONG_MESSAGE,\n EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION,\n EDAWebSocketWireAckFrame,\n EDAWebSocketWireClientFrame,\n EDAWebSocketWireErrorFrame,\n EDAWebSocketWireFlowControl,\n EDAWebSocketWireHeartbeatFrame,\n EDAWebSocketWireHelloFrame,\n EDAWebSocketWireLaggedFrame,\n EDAWebSocketWirePingFrame,\n EDAWebSocketWirePongFrame,\n edaFrameworkWebSocketWireProtocol,\n type EDAWebSocketServerFrameEncoder,\n} from \"./websocket-wire\";\n\nexport { EDA_WEB_SOCKET_PING_MESSAGE, EDA_WEB_SOCKET_PONG_MESSAGE };\n\nimport { SequenceNumber, SessionId } from \"../types/core\";\nimport { PositionedEvent, UnixEpochMillis } from \"../types/events\";\nimport { EDATraceMetadata } from \"../types/tracing\";\n\n/** Current EDA live-event WebSocket protocol version. */\nexport const EDA_WEB_SOCKET_PROTOCOL_VERSION = EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION;\n\n/** WebSocket close code used when a subscriber cannot keep up with live delivery. */\nexport const EDA_WS_CLOSE_LAGGED = 4008;\n\n/** WebSocket close code used for normal host-driven shutdown. */\nexport const EDA_WS_CLOSE_GOING_AWAY = 1001;\n\n/** WebSocket close code used for malformed client protocol messages. */\nexport const EDA_WS_CLOSE_PROTOCOL_ERROR = 1002;\n\n/** WebSocket close code used when the host cannot send a frame. */\nexport const EDA_WS_CLOSE_SEND_FAILED = 1011;\n\n/** WebSocket close code used for unsupported binary messages. */\nexport const EDA_WS_CLOSE_UNSUPPORTED_DATA = 1003;\n\n/** Live subscriber identity persisted in WebSocket attachments. */\nexport const SubscriberId = Schema.NonEmptyString.pipe(Schema.brand(\"SubscriberId\"));\nexport type SubscriberId = typeof SubscriberId.Type;\n\n/** Per-connection monotonically increasing server frame id. */\nexport const FrameId = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).pipe(\n Schema.brand(\"FrameId\"),\n);\nexport type FrameId = typeof FrameId.Type;\n\n/** Flow-control policy announced by the server in the hello frame. */\nexport const EDAWebSocketFlowControl = EDAWebSocketWireFlowControl;\nexport type EDAWebSocketFlowControl = typeof EDAWebSocketFlowControl.Type;\n\n/** Default bounded policy sized for fast model deltas and large durable tool/message events. */\nexport const defaultEDAWebSocketFlowControl: EDAWebSocketFlowControl = {\n ackTimeoutMs: 30_000,\n // Deprecated wire-compat field: servers no longer schedule or send heartbeats.\n heartbeatIntervalMs: 10_000,\n maxFrameBytes: 256 * 1024,\n maxFrameEvents: 1,\n maxInFlightFrames: 16,\n pingIntervalMs: 30_000,\n subscriberBufferCapacityEvents: 2_048,\n};\n\n/** First server frame; announces protocol and flow-control policy. */\nexport const EDAWebSocketHelloFrame = Schema.Struct({\n ...EDAWebSocketWireHelloFrame.fields,\n subscriberId: SubscriberId,\n resumeSeq: SequenceNumber,\n});\nexport type EDAWebSocketHelloFrame = typeof EDAWebSocketHelloFrame.Type;\n\n/** Ordered positioned events delivered to the client. */\nexport const EDAWebSocketEventsFrame = Schema.Struct({\n _tag: Schema.Literal(\"events\"),\n frameId: FrameId,\n events: Schema.NonEmptyArray(PositionedEvent),\n durableThroughSeq: SequenceNumber,\n});\nexport type EDAWebSocketEventsFrame = typeof EDAWebSocketEventsFrame.Type;\n\n/**\n * Deprecated idle server keepalive frame.\n *\n * Servers no longer send heartbeats; the schema remains so deployed clients\n * keep decoding the server frame union. Liveness is client-originated via\n * {@link EDAWebSocketPingFrame} and the host-level auto-response pong.\n */\nexport const EDAWebSocketHeartbeatFrame = Schema.Struct({\n ...EDAWebSocketWireHeartbeatFrame.fields,\n serverTimeMs: UnixEpochMillis,\n durableThroughSeq: SequenceNumber,\n});\nexport type EDAWebSocketHeartbeatFrame = typeof EDAWebSocketHeartbeatFrame.Type;\n\n/** Client liveness ping; hosts answer with a pong and never ACK-track it. */\nexport const EDAWebSocketPingFrame = EDAWebSocketWirePingFrame;\nexport type EDAWebSocketPingFrame = typeof EDAWebSocketPingFrame.Type;\n\n/** Server liveness pong; clients may ignore it and must not ACK it. */\nexport const EDAWebSocketPongFrame = EDAWebSocketWirePongFrame;\nexport type EDAWebSocketPongFrame = typeof EDAWebSocketPongFrame.Type;\n\n/** Optional final frame sent before a lag-close. */\nexport const EDAWebSocketLaggedFrame = Schema.Struct({\n ...EDAWebSocketWireLaggedFrame.fields,\n resumeSeq: SequenceNumber,\n});\nexport type EDAWebSocketLaggedFrame = typeof EDAWebSocketLaggedFrame.Type;\n\n/** Optional final frame sent before a protocol/internal close. */\nexport const EDAWebSocketErrorFrame = EDAWebSocketWireErrorFrame;\nexport type EDAWebSocketErrorFrame = typeof EDAWebSocketErrorFrame.Type;\n\n/** Server-to-client application frame union. */\nexport const EDAWebSocketServerFrame = Schema.Union([\n EDAWebSocketHelloFrame,\n EDAWebSocketEventsFrame,\n EDAWebSocketHeartbeatFrame,\n EDAWebSocketPongFrame,\n EDAWebSocketLaggedFrame,\n EDAWebSocketErrorFrame,\n]);\nexport type EDAWebSocketServerFrame = typeof EDAWebSocketServerFrame.Type;\n\n/** Client acknowledgement after applying a server frame. */\nexport const EDAWebSocketAckFrame = Schema.Struct({\n ...EDAWebSocketWireAckFrame.fields,\n frameId: FrameId,\n durableThroughSeq: SequenceNumber,\n});\nexport type EDAWebSocketAckFrame = typeof EDAWebSocketAckFrame.Type;\n\n/** Client-to-server application frame union. */\nexport const EDAWebSocketClientFrame = Schema.Union([EDAWebSocketAckFrame, EDAWebSocketPingFrame]);\nexport type EDAWebSocketClientFrame = typeof EDAWebSocketClientFrame.Type;\n\n/** Small attachment persisted by hibernation-capable WebSocket hosts. */\nexport const EDAWebSocketAttachment = Schema.Struct({\n kind: Schema.Literal(\"eda-events-v1\"),\n sessionId: SessionId,\n subscriberId: SubscriberId,\n lastAckedSeq: SequenceNumber,\n trace: EDATraceMetadata,\n});\nexport type EDAWebSocketAttachment = typeof EDAWebSocketAttachment.Type;\n\n/** Serialize a server frame for a text WebSocket message. */\nexport const encodeEDAWebSocketServerFrame = (\n frame: EDAWebSocketServerFrame,\n protocol?: EDAWebSocketServerFrameEncoder,\n): string => (protocol ?? edaFrameworkWebSocketWireProtocol.host).encodeServerFrame(frame);\n\n/** Decode an unknown attachment value from host WebSocket hibernation storage. */\nexport const decodeEDAWebSocketAttachment = (\n input: unknown,\n): Effect.Effect<EDAWebSocketAttachment, unknown> =>\n Schema.decodeUnknownEffect(EDAWebSocketAttachment)(input);\n\n/** Decode an inbound text WebSocket message at the host boundary. */\nexport const decodeEDAWebSocketClientMessage = (\n input: string,\n): Effect.Effect<EDAWebSocketClientFrame, unknown> =>\n Effect.try({\n try: () => JSON.parse(input) as unknown,\n catch: (error) => error,\n }).pipe(\n Effect.flatMap((json) => Schema.decodeUnknownEffect(EDAWebSocketWireClientFrame)(json)),\n Effect.flatMap((frame) => Schema.decodeUnknownEffect(EDAWebSocketClientFrame)(frame)),\n );\n\n/** Short close reason that fits the WebSocket protocol reason limit. */\nexport const laggedCloseReason = (seq: SequenceNumber): string => `lag;seq=${seq}`;\n"],"mappings":";;;;;;;;AA0BA,MAAa,kCAAA;;AAGb,MAAa,sBAAsB;;AAGnC,MAAa,0BAA0B;;AAGvC,MAAa,8BAA8B;;AAG3C,MAAa,2BAA2B;;AAGxC,MAAa,gCAAgC;;AAG7C,MAAa,eAAe,OAAO,eAAe,KAAK,OAAO,MAAM,cAAc,CAAC;;AAInF,MAAa,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC,EAAE,KACxE,OAAO,MAAM,SAAS,CACxB;;AAIA,MAAa,0BAA0B;;AAIvC,MAAa,iCAA0D;CACrE,cAAc;CAEd,qBAAqB;CACrB,eAAe,MAAM;CACrB,gBAAgB;CAChB,mBAAmB;CACnB,gBAAgB;CAChB,gCAAgC;AAClC;;AAGA,MAAa,yBAAyB,OAAO,OAAO;CAClD,GAAG,2BAA2B;CAC9B,cAAc;CACd,WAAW;AACb,CAAC;;AAID,MAAa,0BAA0B,OAAO,OAAO;CACnD,MAAM,OAAO,QAAQ,QAAQ;CAC7B,SAAS;CACT,QAAQ,OAAO,cAAc,eAAe;CAC5C,mBAAmB;AACrB,CAAC;;;;;;;;AAUD,MAAa,6BAA6B,OAAO,OAAO;CACtD,GAAG,+BAA+B;CAClC,cAAc;CACd,mBAAmB;AACrB,CAAC;;AAID,MAAa,wBAAwB;;AAIrC,MAAa,wBAAwB;;AAIrC,MAAa,0BAA0B,OAAO,OAAO;CACnD,GAAG,4BAA4B;CAC/B,WAAW;AACb,CAAC;;AAID,MAAa,yBAAyB;;AAItC,MAAa,0BAA0B,OAAO,MAAM;CAClD;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAID,MAAa,uBAAuB,OAAO,OAAO;CAChD,GAAG,yBAAyB;CAC5B,SAAS;CACT,mBAAmB;AACrB,CAAC;;AAID,MAAa,0BAA0B,OAAO,MAAM,CAAC,sBAAsB,qBAAqB,CAAC;;AAIjG,MAAa,yBAAyB,OAAO,OAAO;CAClD,MAAM,OAAO,QAAQ,eAAe;CACpC,WAAW;CACX,cAAc;CACd,cAAc;CACd,OAAO;AACT,CAAC;;AAID,MAAa,iCACX,OACA,cACY,YAAY,kCAAkC,MAAM,kBAAkB,KAAK;;AAGzF,MAAa,gCACX,UAEA,OAAO,oBAAoB,sBAAsB,EAAE,KAAK;;AAG1D,MAAa,mCACX,UAEA,OAAO,IAAI;CACT,WAAW,KAAK,MAAM,KAAK;CAC3B,QAAQ,UAAU;AACpB,CAAC,EAAE,KACD,OAAO,SAAS,SAAS,OAAO,oBAAoB,2BAA2B,EAAE,IAAI,CAAC,GACtF,OAAO,SAAS,UAAU,OAAO,oBAAoB,uBAAuB,EAAE,KAAK,CAAC,CACtF;;AAGF,MAAa,qBAAqB,QAAgC,WAAW"}
@@ -1,2 +1,2 @@
1
- import { a as EDAWebSocketWireAckFrame, c as EDAWebSocketWireFlowControl, d as EDAWebSocketWireLaggedFrame, f as EDAWebSocketWireProtocol, h as makeEDAWebSocketWireProtocol, i as EDAWebSocketServerFrameInput, l as EDAWebSocketWireHeartbeatFrame, m as edaFrameworkWebSocketWireProtocol, n as EDAWebSocketEventConsumerPolicy, o as EDAWebSocketWireClientFrame, p as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, r as EDAWebSocketServerFrameEncoder, s as EDAWebSocketWireErrorFrame, t as EDAFrameworkWebSocketEvent, u as EDAWebSocketWireHelloFrame } from "../websocket-wire-QD2SquQE.js";
2
- export { EDAFrameworkWebSocketEvent, EDAWebSocketEventConsumerPolicy, EDAWebSocketServerFrameEncoder, EDAWebSocketServerFrameInput, EDAWebSocketWireAckFrame, EDAWebSocketWireClientFrame, EDAWebSocketWireErrorFrame, EDAWebSocketWireFlowControl, EDAWebSocketWireHeartbeatFrame, EDAWebSocketWireHelloFrame, EDAWebSocketWireLaggedFrame, EDAWebSocketWireProtocol, EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, edaFrameworkWebSocketWireProtocol, makeEDAWebSocketWireProtocol };
1
+ import { _ as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, a as EDAWebSocketWireAckFrame, c as EDAWebSocketWireFlowControl, d as EDAWebSocketWireLaggedFrame, f as EDAWebSocketWirePingFrame, g as EDA_WEB_SOCKET_PONG_MESSAGE, h as EDA_WEB_SOCKET_PING_MESSAGE, i as EDAWebSocketServerFrameInput, l as EDAWebSocketWireHeartbeatFrame, m as EDAWebSocketWireProtocol, n as EDAWebSocketEventConsumerPolicy, o as EDAWebSocketWireClientFrame, p as EDAWebSocketWirePongFrame, r as EDAWebSocketServerFrameEncoder, s as EDAWebSocketWireErrorFrame, t as EDAFrameworkWebSocketEvent, u as EDAWebSocketWireHelloFrame, v as edaFrameworkWebSocketWireProtocol, y as makeEDAWebSocketWireProtocol } from "../websocket-wire-DPxwY4G5.js";
2
+ export { EDAFrameworkWebSocketEvent, EDAWebSocketEventConsumerPolicy, EDAWebSocketServerFrameEncoder, EDAWebSocketServerFrameInput, EDAWebSocketWireAckFrame, EDAWebSocketWireClientFrame, EDAWebSocketWireErrorFrame, EDAWebSocketWireFlowControl, EDAWebSocketWireHeartbeatFrame, EDAWebSocketWireHelloFrame, EDAWebSocketWireLaggedFrame, EDAWebSocketWirePingFrame, EDAWebSocketWirePongFrame, EDAWebSocketWireProtocol, EDA_WEB_SOCKET_PING_MESSAGE, EDA_WEB_SOCKET_PONG_MESSAGE, EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, edaFrameworkWebSocketWireProtocol, makeEDAWebSocketWireProtocol };
@@ -10,12 +10,28 @@ const EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION = 1;
10
10
  /** Flow-control policy announced by the server in the hello frame. */
11
11
  const EDAWebSocketWireFlowControl = Schema.Struct({
12
12
  ackTimeoutMs: PositiveInt,
13
+ /** Deprecated: servers no longer send heartbeat frames. Kept so deployed clients can decode hello. */
13
14
  heartbeatIntervalMs: PositiveInt,
14
15
  maxFrameBytes: PositiveInt,
15
16
  maxFrameEvents: PositiveInt,
16
17
  maxInFlightFrames: PositiveInt,
18
+ /** Suggested client-originated ping cadence; absent on servers that still send heartbeats. */
19
+ pingIntervalMs: Schema.optionalKey(PositiveInt),
17
20
  subscriberBufferCapacityEvents: PositiveInt
18
21
  });
22
+ /**
23
+ * Canonical client liveness ping message.
24
+ *
25
+ * The exact string matters: hibernation-capable hosts register it with
26
+ * WebSocket auto-response so the runtime answers without waking the object.
27
+ */
28
+ const EDA_WEB_SOCKET_PING_MESSAGE = "{\"_tag\":\"ping\"}";
29
+ /** Canonical server pong message paired with {@link EDA_WEB_SOCKET_PING_MESSAGE}. */
30
+ const EDA_WEB_SOCKET_PONG_MESSAGE = "{\"_tag\":\"pong\"}";
31
+ /** Client liveness ping; hosts answer with a pong and never ACK-track it. */
32
+ const EDAWebSocketWirePingFrame = Schema.Struct({ _tag: Schema.Literal("ping") });
33
+ /** Server liveness pong; clients may ignore it and must not ACK it. */
34
+ const EDAWebSocketWirePongFrame = Schema.Struct({ _tag: Schema.Literal("pong") });
19
35
  const EDAWebSocketWireHelloFrame = Schema.Struct({
20
36
  _tag: Schema.Literal("hello"),
21
37
  protocolVersion: Schema.Literal(1),
@@ -42,7 +58,7 @@ const EDAWebSocketWireAckFrame = Schema.Struct({
42
58
  frameId: PositiveInt,
43
59
  durableThroughSeq: NonNegativeInt
44
60
  });
45
- const EDAWebSocketWireClientFrame = Schema.Union([EDAWebSocketWireAckFrame]);
61
+ const EDAWebSocketWireClientFrame = Schema.Union([EDAWebSocketWireAckFrame, EDAWebSocketWirePingFrame]);
46
62
  /** Complete framework-owned event union present on every EDA WebSocket. */
47
63
  const EDAFrameworkWebSocketEvent = Schema.Union([EDADurableEvent, EDAEphemeralEvent]);
48
64
  const makeEDAWebSocketDomainSchemas = (event) => {
@@ -64,6 +80,7 @@ const makeEDAWebSocketDomainSchemas = (event) => {
64
80
  EDAWebSocketWireHelloFrame,
65
81
  eventsFrame,
66
82
  EDAWebSocketWireHeartbeatFrame,
83
+ EDAWebSocketWirePongFrame,
67
84
  EDAWebSocketWireLaggedFrame,
68
85
  EDAWebSocketWireErrorFrame
69
86
  ])
@@ -100,6 +117,6 @@ const edaFrameworkWebSocketWireProtocol = makeEDAWebSocketWireProtocolFromEventS
100
117
  */
101
118
  const makeEDAWebSocketWireProtocol = (options) => makeEDAWebSocketWireProtocolFromEventSchema(Schema.Union([EDAFrameworkWebSocketEvent, options.appEvents]));
102
119
  //#endregion
103
- export { EDAFrameworkWebSocketEvent, EDAWebSocketWireAckFrame, EDAWebSocketWireClientFrame, EDAWebSocketWireErrorFrame, EDAWebSocketWireFlowControl, EDAWebSocketWireHeartbeatFrame, EDAWebSocketWireHelloFrame, EDAWebSocketWireLaggedFrame, EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, edaFrameworkWebSocketWireProtocol, makeEDAWebSocketWireProtocol };
120
+ export { EDAFrameworkWebSocketEvent, EDAWebSocketWireAckFrame, EDAWebSocketWireClientFrame, EDAWebSocketWireErrorFrame, EDAWebSocketWireFlowControl, EDAWebSocketWireHeartbeatFrame, EDAWebSocketWireHelloFrame, EDAWebSocketWireLaggedFrame, EDAWebSocketWirePingFrame, EDAWebSocketWirePongFrame, EDA_WEB_SOCKET_PING_MESSAGE, EDA_WEB_SOCKET_PONG_MESSAGE, EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, edaFrameworkWebSocketWireProtocol, makeEDAWebSocketWireProtocol };
104
121
 
105
122
  //# sourceMappingURL=websocket-wire.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"websocket-wire.js","names":[],"sources":["../../src/host/websocket-wire.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nimport { Position } from \"../types/core\";\nimport { EDADurableEvent, EDAEphemeralEvent, EventEnvelope } from \"../types/events\";\n\nconst PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));\nconst NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\n\n/** Current EDA live-event WebSocket wire protocol version. */\nexport const EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION = 1 as const;\n\n/** Flow-control policy announced by the server in the hello frame. */\nexport const EDAWebSocketWireFlowControl = Schema.Struct({\n ackTimeoutMs: PositiveInt,\n heartbeatIntervalMs: PositiveInt,\n maxFrameBytes: PositiveInt,\n maxFrameEvents: PositiveInt,\n maxInFlightFrames: PositiveInt,\n subscriberBufferCapacityEvents: PositiveInt,\n});\nexport type EDAWebSocketWireFlowControl = typeof EDAWebSocketWireFlowControl.Type;\n\nexport const EDAWebSocketWireHelloFrame = Schema.Struct({\n _tag: Schema.Literal(\"hello\"),\n protocolVersion: Schema.Literal(EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION),\n subscriberId: Schema.NonEmptyString,\n resumeSeq: NonNegativeInt,\n flowControl: EDAWebSocketWireFlowControl,\n});\nexport type EDAWebSocketWireHelloFrame = typeof EDAWebSocketWireHelloFrame.Type;\n\nexport const EDAWebSocketWireHeartbeatFrame = Schema.Struct({\n _tag: Schema.Literal(\"heartbeat\"),\n serverTimeMs: NonNegativeInt,\n durableThroughSeq: NonNegativeInt,\n});\nexport type EDAWebSocketWireHeartbeatFrame = typeof EDAWebSocketWireHeartbeatFrame.Type;\n\nexport const EDAWebSocketWireLaggedFrame = Schema.Struct({\n _tag: Schema.Literal(\"lagged\"),\n resumeSeq: NonNegativeInt,\n reason: Schema.Literals([\"buffer-overflow\", \"ack-timeout\"]),\n});\nexport type EDAWebSocketWireLaggedFrame = typeof EDAWebSocketWireLaggedFrame.Type;\n\nexport const EDAWebSocketWireErrorFrame = Schema.Struct({\n _tag: Schema.Literal(\"error\"),\n message: Schema.String,\n});\nexport type EDAWebSocketWireErrorFrame = typeof EDAWebSocketWireErrorFrame.Type;\n\nexport const EDAWebSocketWireAckFrame = Schema.Struct({\n _tag: Schema.Literal(\"ack\"),\n frameId: PositiveInt,\n durableThroughSeq: NonNegativeInt,\n});\nexport type EDAWebSocketWireAckFrame = typeof EDAWebSocketWireAckFrame.Type;\n\nexport const EDAWebSocketWireClientFrame = Schema.Union([EDAWebSocketWireAckFrame]);\nexport type EDAWebSocketWireClientFrame = typeof EDAWebSocketWireClientFrame.Type;\n\n/** Exhaustive decision table for a concrete WebSocket event union. */\nexport type EDAWebSocketEventConsumerPolicy<\n Event extends { readonly type: string },\n Disposition,\n> = Readonly<Record<Event[\"type\"], Disposition>>;\n\n/** Complete framework-owned event union present on every EDA WebSocket. */\nexport const EDAFrameworkWebSocketEvent = Schema.Union([EDADurableEvent, EDAEphemeralEvent]);\nexport type EDAFrameworkWebSocketEvent = typeof EDAFrameworkWebSocketEvent.Type;\n\nconst makeEDAWebSocketDomainSchemas = <\n EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>,\n>(\n event: EventSchema,\n) => {\n const positionedEvent = Schema.Struct({\n position: Position,\n event,\n });\n const eventsFrame = Schema.Struct({\n _tag: Schema.Literal(\"events\"),\n frameId: PositiveInt,\n events: Schema.NonEmptyArray(positionedEvent),\n durableThroughSeq: NonNegativeInt,\n });\n const serverFrame = Schema.Union([\n EDAWebSocketWireHelloFrame,\n eventsFrame,\n EDAWebSocketWireHeartbeatFrame,\n EDAWebSocketWireLaggedFrame,\n EDAWebSocketWireErrorFrame,\n ]);\n return { event, positionedEvent, eventsFrame, serverFrame };\n};\n\ntype EDAWebSocketDomainSchemas<\n EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>,\n> = ReturnType<typeof makeEDAWebSocketDomainSchemas<EventSchema>>;\n\nconst EDAWebSocketHostDomain = makeEDAWebSocketDomainSchemas(EventEnvelope);\n\n/** Domain frame shape accepted by an app-bound encoder at the EDA host boundary. */\nexport type EDAWebSocketServerFrameInput = typeof EDAWebSocketHostDomain.serverFrame.Type;\n\n/** Minimal typed encoder surface consumed by an EDA host. */\nexport interface EDAWebSocketServerFrameEncoder {\n readonly encodeServerFrame: (frame: EDAWebSocketServerFrameInput) => string;\n}\n\n/** App-bound domain schemas, wire schemas, and encoders for protocol version 1. */\nexport interface EDAWebSocketWireProtocol<\n EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>,\n> {\n /** Exact app-bound schemas whose `Type` values are used inside the server. */\n readonly domain: EDAWebSocketDomainSchemas<EventSchema>;\n /** Exact app-bound schemas whose `Type` values are the serialized JSON representation. */\n readonly wire: {\n readonly event: Schema.toEncoded<EventSchema>;\n readonly positionedEvent: Schema.toEncoded<\n EDAWebSocketDomainSchemas<EventSchema>[\"positionedEvent\"]\n >;\n readonly eventsFrame: Schema.toEncoded<EDAWebSocketDomainSchemas<EventSchema>[\"eventsFrame\"]>;\n readonly serverFrame: Schema.toEncoded<EDAWebSocketDomainSchemas<EventSchema>[\"serverFrame\"]>;\n readonly clientFrame: typeof EDAWebSocketWireClientFrame;\n };\n /** Serialize one exact app-bound domain frame to a JSON text message. */\n readonly encodeServerFrame: (\n frame: Schema.Schema.Type<EDAWebSocketDomainSchemas<EventSchema>[\"serverFrame\"]>,\n ) => string;\n /** Validate broad host frames against the app event union before serialization. */\n readonly host: EDAWebSocketServerFrameEncoder;\n}\n\nconst makeEDAWebSocketWireProtocolFromEventSchema = <\n EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>,\n>(\n event: EventSchema,\n): EDAWebSocketWireProtocol<EventSchema> => {\n const domain = makeEDAWebSocketDomainSchemas(event);\n const encodeDomainServerFrame = Schema.encodeSync(domain.serverFrame);\n const encodeUnknownDomainServerFrame = Schema.encodeUnknownSync(domain.serverFrame);\n const encodeServerFrame = (frame: typeof domain.serverFrame.Type): string =>\n JSON.stringify(encodeDomainServerFrame(frame));\n const host: EDAWebSocketServerFrameEncoder = {\n encodeServerFrame: (frame) => JSON.stringify(encodeUnknownDomainServerFrame(frame)),\n };\n\n return {\n domain,\n wire: {\n event: Schema.toEncoded(domain.event),\n positionedEvent: Schema.toEncoded(domain.positionedEvent),\n eventsFrame: Schema.toEncoded(domain.eventsFrame),\n serverFrame: Schema.toEncoded(domain.serverFrame),\n clientFrame: EDAWebSocketWireClientFrame,\n },\n encodeServerFrame,\n host,\n };\n};\n\n/** Strict framework-only protocol used when an app registers no custom events. */\nexport const edaFrameworkWebSocketWireProtocol: EDAWebSocketWireProtocol<\n typeof EDAFrameworkWebSocketEvent\n> = makeEDAWebSocketWireProtocolFromEventSchema(EDAFrameworkWebSocketEvent);\n\n/**\n * Bind the generic EDA WebSocket transport to one app's custom event schema.\n *\n * Framework durable and ephemeral events are included automatically. Future EDA\n * apps register only their custom events. Servers use the returned domain schemas\n * and typed encoder; external consumers decode with the wire schemas. Pass the\n * returned `host` adapter to the selected host package.\n */\nexport const makeEDAWebSocketWireProtocol = <\n AppEventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>,\n>(options: {\n readonly appEvents: AppEventSchema;\n}): EDAWebSocketWireProtocol<\n Schema.Union<readonly [typeof EDAFrameworkWebSocketEvent, AppEventSchema]>\n> =>\n makeEDAWebSocketWireProtocolFromEventSchema(\n Schema.Union([EDAFrameworkWebSocketEvent, options.appEvents]),\n );\n"],"mappings":";;;;;AAKA,MAAM,cAAc,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,iBAAiB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;AAGxE,MAAa,uCAAuC;;AAGpD,MAAa,8BAA8B,OAAO,OAAO;CACvD,cAAc;CACd,qBAAqB;CACrB,eAAe;CACf,gBAAgB;CAChB,mBAAmB;CACnB,gCAAgC;AAClC,CAAC;AAGD,MAAa,6BAA6B,OAAO,OAAO;CACtD,MAAM,OAAO,QAAQ,OAAO;CAC5B,iBAAiB,OAAO,QAAA,CAA4C;CACpE,cAAc,OAAO;CACrB,WAAW;CACX,aAAa;AACf,CAAC;AAGD,MAAa,iCAAiC,OAAO,OAAO;CAC1D,MAAM,OAAO,QAAQ,WAAW;CAChC,cAAc;CACd,mBAAmB;AACrB,CAAC;AAGD,MAAa,8BAA8B,OAAO,OAAO;CACvD,MAAM,OAAO,QAAQ,QAAQ;CAC7B,WAAW;CACX,QAAQ,OAAO,SAAS,CAAC,mBAAmB,aAAa,CAAC;AAC5D,CAAC;AAGD,MAAa,6BAA6B,OAAO,OAAO;CACtD,MAAM,OAAO,QAAQ,OAAO;CAC5B,SAAS,OAAO;AAClB,CAAC;AAGD,MAAa,2BAA2B,OAAO,OAAO;CACpD,MAAM,OAAO,QAAQ,KAAK;CAC1B,SAAS;CACT,mBAAmB;AACrB,CAAC;AAGD,MAAa,8BAA8B,OAAO,MAAM,CAAC,wBAAwB,CAAC;;AAUlF,MAAa,6BAA6B,OAAO,MAAM,CAAC,iBAAiB,iBAAiB,CAAC;AAG3F,MAAM,iCAGJ,UACG;CACH,MAAM,kBAAkB,OAAO,OAAO;EACpC,UAAU;EACV;CACF,CAAC;CACD,MAAM,cAAc,OAAO,OAAO;EAChC,MAAM,OAAO,QAAQ,QAAQ;EAC7B,SAAS;EACT,QAAQ,OAAO,cAAc,eAAe;EAC5C,mBAAmB;CACrB,CAAC;CAQD,OAAO;EAAE;EAAO;EAAiB;EAAa,aAP1B,OAAO,MAAM;GAC/B;GACA;GACA;GACA;GACA;EACF,CACwD;CAAE;AAC5D;AAM+B,8BAA8B,aAAa;AAkC1E,MAAM,+CAGJ,UAC0C;CAC1C,MAAM,SAAS,8BAA8B,KAAK;CAClD,MAAM,0BAA0B,OAAO,WAAW,OAAO,WAAW;CACpE,MAAM,iCAAiC,OAAO,kBAAkB,OAAO,WAAW;CAClF,MAAM,qBAAqB,UACzB,KAAK,UAAU,wBAAwB,KAAK,CAAC;CAK/C,OAAO;EACL;EACA,MAAM;GACJ,OAAO,OAAO,UAAU,OAAO,KAAK;GACpC,iBAAiB,OAAO,UAAU,OAAO,eAAe;GACxD,aAAa,OAAO,UAAU,OAAO,WAAW;GAChD,aAAa,OAAO,UAAU,OAAO,WAAW;GAChD,aAAa;EACf;EACA;EACA,MAAA,EAbA,oBAAoB,UAAU,KAAK,UAAU,+BAA+B,KAAK,CAAC,EAa/E;CACL;AACF;;AAGA,MAAa,oCAET,4CAA4C,0BAA0B;;;;;;;;;AAU1E,MAAa,gCAEX,YAKA,4CACE,OAAO,MAAM,CAAC,4BAA4B,QAAQ,SAAS,CAAC,CAC9D"}
1
+ {"version":3,"file":"websocket-wire.js","names":[],"sources":["../../src/host/websocket-wire.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nimport { Position } from \"../types/core\";\nimport { EDADurableEvent, EDAEphemeralEvent, EventEnvelope } from \"../types/events\";\n\nconst PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));\nconst NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\n\n/** Current EDA live-event WebSocket wire protocol version. */\nexport const EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION = 1 as const;\n\n/** Flow-control policy announced by the server in the hello frame. */\nexport const EDAWebSocketWireFlowControl = Schema.Struct({\n ackTimeoutMs: PositiveInt,\n /** Deprecated: servers no longer send heartbeat frames. Kept so deployed clients can decode hello. */\n heartbeatIntervalMs: PositiveInt,\n maxFrameBytes: PositiveInt,\n maxFrameEvents: PositiveInt,\n maxInFlightFrames: PositiveInt,\n /** Suggested client-originated ping cadence; absent on servers that still send heartbeats. */\n pingIntervalMs: Schema.optionalKey(PositiveInt),\n subscriberBufferCapacityEvents: PositiveInt,\n});\nexport type EDAWebSocketWireFlowControl = typeof EDAWebSocketWireFlowControl.Type;\n\n/**\n * Canonical client liveness ping message.\n *\n * The exact string matters: hibernation-capable hosts register it with\n * WebSocket auto-response so the runtime answers without waking the object.\n */\nexport const EDA_WEB_SOCKET_PING_MESSAGE = '{\"_tag\":\"ping\"}';\n\n/** Canonical server pong message paired with {@link EDA_WEB_SOCKET_PING_MESSAGE}. */\nexport const EDA_WEB_SOCKET_PONG_MESSAGE = '{\"_tag\":\"pong\"}';\n\n/** Client liveness ping; hosts answer with a pong and never ACK-track it. */\nexport const EDAWebSocketWirePingFrame = Schema.Struct({\n _tag: Schema.Literal(\"ping\"),\n});\nexport type EDAWebSocketWirePingFrame = typeof EDAWebSocketWirePingFrame.Type;\n\n/** Server liveness pong; clients may ignore it and must not ACK it. */\nexport const EDAWebSocketWirePongFrame = Schema.Struct({\n _tag: Schema.Literal(\"pong\"),\n});\nexport type EDAWebSocketWirePongFrame = typeof EDAWebSocketWirePongFrame.Type;\n\nexport const EDAWebSocketWireHelloFrame = Schema.Struct({\n _tag: Schema.Literal(\"hello\"),\n protocolVersion: Schema.Literal(EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION),\n subscriberId: Schema.NonEmptyString,\n resumeSeq: NonNegativeInt,\n flowControl: EDAWebSocketWireFlowControl,\n});\nexport type EDAWebSocketWireHelloFrame = typeof EDAWebSocketWireHelloFrame.Type;\n\nexport const EDAWebSocketWireHeartbeatFrame = Schema.Struct({\n _tag: Schema.Literal(\"heartbeat\"),\n serverTimeMs: NonNegativeInt,\n durableThroughSeq: NonNegativeInt,\n});\nexport type EDAWebSocketWireHeartbeatFrame = typeof EDAWebSocketWireHeartbeatFrame.Type;\n\nexport const EDAWebSocketWireLaggedFrame = Schema.Struct({\n _tag: Schema.Literal(\"lagged\"),\n resumeSeq: NonNegativeInt,\n reason: Schema.Literals([\"buffer-overflow\", \"ack-timeout\"]),\n});\nexport type EDAWebSocketWireLaggedFrame = typeof EDAWebSocketWireLaggedFrame.Type;\n\nexport const EDAWebSocketWireErrorFrame = Schema.Struct({\n _tag: Schema.Literal(\"error\"),\n message: Schema.String,\n});\nexport type EDAWebSocketWireErrorFrame = typeof EDAWebSocketWireErrorFrame.Type;\n\nexport const EDAWebSocketWireAckFrame = Schema.Struct({\n _tag: Schema.Literal(\"ack\"),\n frameId: PositiveInt,\n durableThroughSeq: NonNegativeInt,\n});\nexport type EDAWebSocketWireAckFrame = typeof EDAWebSocketWireAckFrame.Type;\n\nexport const EDAWebSocketWireClientFrame = Schema.Union([\n EDAWebSocketWireAckFrame,\n EDAWebSocketWirePingFrame,\n]);\nexport type EDAWebSocketWireClientFrame = typeof EDAWebSocketWireClientFrame.Type;\n\n/** Exhaustive decision table for a concrete WebSocket event union. */\nexport type EDAWebSocketEventConsumerPolicy<\n Event extends { readonly type: string },\n Disposition,\n> = Readonly<Record<Event[\"type\"], Disposition>>;\n\n/** Complete framework-owned event union present on every EDA WebSocket. */\nexport const EDAFrameworkWebSocketEvent = Schema.Union([EDADurableEvent, EDAEphemeralEvent]);\nexport type EDAFrameworkWebSocketEvent = typeof EDAFrameworkWebSocketEvent.Type;\n\nconst makeEDAWebSocketDomainSchemas = <\n EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>,\n>(\n event: EventSchema,\n) => {\n const positionedEvent = Schema.Struct({\n position: Position,\n event,\n });\n const eventsFrame = Schema.Struct({\n _tag: Schema.Literal(\"events\"),\n frameId: PositiveInt,\n events: Schema.NonEmptyArray(positionedEvent),\n durableThroughSeq: NonNegativeInt,\n });\n const serverFrame = Schema.Union([\n EDAWebSocketWireHelloFrame,\n eventsFrame,\n EDAWebSocketWireHeartbeatFrame,\n EDAWebSocketWirePongFrame,\n EDAWebSocketWireLaggedFrame,\n EDAWebSocketWireErrorFrame,\n ]);\n return { event, positionedEvent, eventsFrame, serverFrame };\n};\n\ntype EDAWebSocketDomainSchemas<\n EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>,\n> = ReturnType<typeof makeEDAWebSocketDomainSchemas<EventSchema>>;\n\nconst EDAWebSocketHostDomain = makeEDAWebSocketDomainSchemas(EventEnvelope);\n\n/** Domain frame shape accepted by an app-bound encoder at the EDA host boundary. */\nexport type EDAWebSocketServerFrameInput = typeof EDAWebSocketHostDomain.serverFrame.Type;\n\n/** Minimal typed encoder surface consumed by an EDA host. */\nexport interface EDAWebSocketServerFrameEncoder {\n readonly encodeServerFrame: (frame: EDAWebSocketServerFrameInput) => string;\n}\n\n/** App-bound domain schemas, wire schemas, and encoders for protocol version 1. */\nexport interface EDAWebSocketWireProtocol<\n EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>,\n> {\n /** Exact app-bound schemas whose `Type` values are used inside the server. */\n readonly domain: EDAWebSocketDomainSchemas<EventSchema>;\n /** Exact app-bound schemas whose `Type` values are the serialized JSON representation. */\n readonly wire: {\n readonly event: Schema.toEncoded<EventSchema>;\n readonly positionedEvent: Schema.toEncoded<\n EDAWebSocketDomainSchemas<EventSchema>[\"positionedEvent\"]\n >;\n readonly eventsFrame: Schema.toEncoded<EDAWebSocketDomainSchemas<EventSchema>[\"eventsFrame\"]>;\n readonly serverFrame: Schema.toEncoded<EDAWebSocketDomainSchemas<EventSchema>[\"serverFrame\"]>;\n readonly clientFrame: typeof EDAWebSocketWireClientFrame;\n };\n /** Serialize one exact app-bound domain frame to a JSON text message. */\n readonly encodeServerFrame: (\n frame: Schema.Schema.Type<EDAWebSocketDomainSchemas<EventSchema>[\"serverFrame\"]>,\n ) => string;\n /** Validate broad host frames against the app event union before serialization. */\n readonly host: EDAWebSocketServerFrameEncoder;\n}\n\nconst makeEDAWebSocketWireProtocolFromEventSchema = <\n EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>,\n>(\n event: EventSchema,\n): EDAWebSocketWireProtocol<EventSchema> => {\n const domain = makeEDAWebSocketDomainSchemas(event);\n const encodeDomainServerFrame = Schema.encodeSync(domain.serverFrame);\n const encodeUnknownDomainServerFrame = Schema.encodeUnknownSync(domain.serverFrame);\n const encodeServerFrame = (frame: typeof domain.serverFrame.Type): string =>\n JSON.stringify(encodeDomainServerFrame(frame));\n const host: EDAWebSocketServerFrameEncoder = {\n encodeServerFrame: (frame) => JSON.stringify(encodeUnknownDomainServerFrame(frame)),\n };\n\n return {\n domain,\n wire: {\n event: Schema.toEncoded(domain.event),\n positionedEvent: Schema.toEncoded(domain.positionedEvent),\n eventsFrame: Schema.toEncoded(domain.eventsFrame),\n serverFrame: Schema.toEncoded(domain.serverFrame),\n clientFrame: EDAWebSocketWireClientFrame,\n },\n encodeServerFrame,\n host,\n };\n};\n\n/** Strict framework-only protocol used when an app registers no custom events. */\nexport const edaFrameworkWebSocketWireProtocol: EDAWebSocketWireProtocol<\n typeof EDAFrameworkWebSocketEvent\n> = makeEDAWebSocketWireProtocolFromEventSchema(EDAFrameworkWebSocketEvent);\n\n/**\n * Bind the generic EDA WebSocket transport to one app's custom event schema.\n *\n * Framework durable and ephemeral events are included automatically. Future EDA\n * apps register only their custom events. Servers use the returned domain schemas\n * and typed encoder; external consumers decode with the wire schemas. Pass the\n * returned `host` adapter to the selected host package.\n */\nexport const makeEDAWebSocketWireProtocol = <\n AppEventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>,\n>(options: {\n readonly appEvents: AppEventSchema;\n}): EDAWebSocketWireProtocol<\n Schema.Union<readonly [typeof EDAFrameworkWebSocketEvent, AppEventSchema]>\n> =>\n makeEDAWebSocketWireProtocolFromEventSchema(\n Schema.Union([EDAFrameworkWebSocketEvent, options.appEvents]),\n );\n"],"mappings":";;;;;AAKA,MAAM,cAAc,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,iBAAiB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;AAGxE,MAAa,uCAAuC;;AAGpD,MAAa,8BAA8B,OAAO,OAAO;CACvD,cAAc;;CAEd,qBAAqB;CACrB,eAAe;CACf,gBAAgB;CAChB,mBAAmB;;CAEnB,gBAAgB,OAAO,YAAY,WAAW;CAC9C,gCAAgC;AAClC,CAAC;;;;;;;AASD,MAAa,8BAA8B;;AAG3C,MAAa,8BAA8B;;AAG3C,MAAa,4BAA4B,OAAO,OAAO,EACrD,MAAM,OAAO,QAAQ,MAAM,EAC7B,CAAC;;AAID,MAAa,4BAA4B,OAAO,OAAO,EACrD,MAAM,OAAO,QAAQ,MAAM,EAC7B,CAAC;AAGD,MAAa,6BAA6B,OAAO,OAAO;CACtD,MAAM,OAAO,QAAQ,OAAO;CAC5B,iBAAiB,OAAO,QAAA,CAA4C;CACpE,cAAc,OAAO;CACrB,WAAW;CACX,aAAa;AACf,CAAC;AAGD,MAAa,iCAAiC,OAAO,OAAO;CAC1D,MAAM,OAAO,QAAQ,WAAW;CAChC,cAAc;CACd,mBAAmB;AACrB,CAAC;AAGD,MAAa,8BAA8B,OAAO,OAAO;CACvD,MAAM,OAAO,QAAQ,QAAQ;CAC7B,WAAW;CACX,QAAQ,OAAO,SAAS,CAAC,mBAAmB,aAAa,CAAC;AAC5D,CAAC;AAGD,MAAa,6BAA6B,OAAO,OAAO;CACtD,MAAM,OAAO,QAAQ,OAAO;CAC5B,SAAS,OAAO;AAClB,CAAC;AAGD,MAAa,2BAA2B,OAAO,OAAO;CACpD,MAAM,OAAO,QAAQ,KAAK;CAC1B,SAAS;CACT,mBAAmB;AACrB,CAAC;AAGD,MAAa,8BAA8B,OAAO,MAAM,CACtD,0BACA,yBACF,CAAC;;AAUD,MAAa,6BAA6B,OAAO,MAAM,CAAC,iBAAiB,iBAAiB,CAAC;AAG3F,MAAM,iCAGJ,UACG;CACH,MAAM,kBAAkB,OAAO,OAAO;EACpC,UAAU;EACV;CACF,CAAC;CACD,MAAM,cAAc,OAAO,OAAO;EAChC,MAAM,OAAO,QAAQ,QAAQ;EAC7B,SAAS;EACT,QAAQ,OAAO,cAAc,eAAe;EAC5C,mBAAmB;CACrB,CAAC;CASD,OAAO;EAAE;EAAO;EAAiB;EAAa,aAR1B,OAAO,MAAM;GAC/B;GACA;GACA;GACA;GACA;GACA;EACF,CACwD;CAAE;AAC5D;AAM+B,8BAA8B,aAAa;AAkC1E,MAAM,+CAGJ,UAC0C;CAC1C,MAAM,SAAS,8BAA8B,KAAK;CAClD,MAAM,0BAA0B,OAAO,WAAW,OAAO,WAAW;CACpE,MAAM,iCAAiC,OAAO,kBAAkB,OAAO,WAAW;CAClF,MAAM,qBAAqB,UACzB,KAAK,UAAU,wBAAwB,KAAK,CAAC;CAK/C,OAAO;EACL;EACA,MAAM;GACJ,OAAO,OAAO,UAAU,OAAO,KAAK;GACpC,iBAAiB,OAAO,UAAU,OAAO,eAAe;GACxD,aAAa,OAAO,UAAU,OAAO,WAAW;GAChD,aAAa,OAAO,UAAU,OAAO,WAAW;GAChD,aAAa;EACf;EACA;EACA,MAAA,EAbA,oBAAoB,UAAU,KAAK,UAAU,+BAA+B,KAAK,CAAC,EAa/E;CACL;AACF;;AAGA,MAAa,oCAET,4CAA4C,0BAA0B;;;;;;;;;AAU1E,MAAa,gCAEX,YAKA,4CACE,OAAO,MAAM,CAAC,4BAA4B,QAAQ,SAAS,CAAC,CAC9D"}
package/dist/index.d.ts CHANGED
@@ -3,5 +3,5 @@ import { a as PromotePendingMessageCommand, c as SubmitMessageCommand, d as User
3
3
  import { _ as parseEDATraceparent, a as EDATraceAttributes, c as EDATraceLink, d as makeEDAEventTrace, f as makeEDARunTrace, g as makeRootEDATraceMetadata, h as makeRootEDAEventTrace, i as EDATraceAttributeValue, l as EDATraceMetadata, m as makeEDATraceMetadataFromParent, n as EDARunTrace, o as EDATraceContext, p as makeEDATraceContext, r as EDASpanId, s as EDATraceId, t as EDAEventTrace, u as buildEDATraceparent } from "./tracing-BXHAkxkx.js";
4
4
  import { A as EventEnvelope, B as SystemPromptText, C as toolParamsDeltaEventType, D as DurableEventEnvelope, E as traceStatusEventType, F as ModelSelectionPayload, G as makeEventType, H as UnixEpochMillis, I as NonNegativeInt, K as schemaV1, L as PositionedEvent, M as EventType, N as EventTypeName, O as EphemeralEventEnvelope, P as FailurePayload, R as ProviderPartId, S as textDeltaEventType, T as toolParamsStartEventType, U as UsagePayload, V as ToolName, W as effectDurableAgentNamespace, _ as TraceStatusEvent, a as RuntimeStatusEvent, b as reasoningDeltaEventType, c as SubscriberStatusPayload, d as ToolParamsDeltaEvent, f as ToolParamsDeltaPayload, g as ToolParamsStartPayload, h as ToolParamsStartEvent, i as ReasoningDeltaPayload, j as EventNamespace, k as EventDurability, l as TextDeltaEvent, m as ToolParamsEndPayload, n as ModelStreamEvent, o as SubscriberStatusEvent, p as ToolParamsEndEvent, r as ReasoningDeltaEvent, s as SubscriberStatusKind, t as EDAEphemeralEvent, u as TextDeltaPayload, v as TraceStatusKind, w as toolParamsEndEventType, x as subscriberStatusEventType, y as TraceStatusPayload, z as SchemaVersion } from "./events-Bb9-Cu-7.js";
5
5
  import { $ as PendingMessagesPausedEvent, $n as turnStoppedEventType, $t as TurnStoppedPayload, A as CompactionFailedEvent, An as inferenceFailedEventType, At as ToolCallCreatedPayload, B as ContextRebasedPayload, Bn as steeringMessageQueuedEventType, Bt as ToolCallStartedPayload, C as CommandEvent, Cn as compactionRequestedEventType, Ct as SummaryCreatedEvent, D as CommandStartedPayload, Dn as decodeUnknownEDADurableEvent, Dt as ToolCallCompletedEvent, E as CommandStartedEvent, En as contextRebasedEventType, Et as SystemMessageCommittedPayload, F as CompactionStartedPayload, Fn as runCompletedEventType, Ft as ToolCallRejectedEvent, G as InferenceEvent, Gn as toolCallCompletedEventType, Gt as TurnCompletedEvent, H as EDADurableEventV1, Hn as stopTurnRequestedEventType, Ht as ToolPromptPart, I as ContextAndCompactionEvent, In as runFailedEventType, It as ToolCallRejectedPayload, J as InferenceStartedEvent, Jn as toolCallRejectedEventType, Jt as TurnFailedEvent, K as InferenceFailedEvent, Kn as toolCallCreatedEventType, Kt as TurnCompletedPayload, L as ContextProjectedEvent, Ln as runInterruptedEventType, Lt as ToolCallRejectionFeedback, M as CompactionRequestedEvent, Mn as messageQueuePausedEventType, Mt as ToolCallFailedEvent, N as CompactionRequestedPayload, Nn as pendingMessagesPausedEventType, Nt as ToolCallFailedPayload, O as CompactionCompletedEvent, On as decodeUnknownEDADurableEventSync, Ot as ToolCallCompletedPayload, P as CompactionStartedEvent, Pn as recoveryCompletedEventType, Pt as ToolCallPromptPart, Q as MessageQueuePausedPayload, Qn as turnStartedEventType, Qt as TurnStoppedEvent, R as ContextProjectedPayload, Rn as runStartedEventType, Rt as ToolCallRejectionReason, S as CommandCompletedPayload, Sn as compactionFailedEventType, St as StopTurnRequestedPayload, T as CommandFailedPayload, Tn as contextProjectedEventType, Tt as SystemMessageCommittedEvent, U as InferenceCompletedEvent, Un as summaryCreatedEventType, Ut as ToolRejectionPromptPart, V as EDADurableEvent, Vn as stopTurnAppliedEventType, Vt as ToolFailurePromptPart, W as InferenceCompletedPayload, Wn as systemMessageCommittedEventType, Wt as ToolSuccessPromptPart, X as MessageEvent, Xn as turnCompletedEventType, Xt as TurnStartedEvent, Y as InferenceStartedPayload, Yn as toolCallStartedEventType, Yt as TurnFailedPayload, Z as MessageQueuePausedEvent, Zn as turnFailedEventType, Zt as TurnStartedPayload, _ as CommandAdmittedEvent, _n as commandCancelledEventType, _t as SteeringMessageQueuedPayload, a as AssistantMessageImportedPayload, an as UserMessageDisposition, at as RunCompletedEvent, b as CommandCancelledPayload, bn as commandStartedEventType, bt as StopTurnAppliedPayload, c as AssistantPromptPart, cn as UserMessageSubmittedEvent, ct as RunFailedEvent, d as BaseStateCreatedPayload, dn as assistantMessageImportedEventType, dt as RunInterruptedPayload, en as UserMessageCancellationReason, er as userMessageCancelledEventType, et as PendingMessagesPausedPayload, f as BaseStateEvent, fn as assistantPartialCommittedEventType, ft as RunStartedEvent, g as BaseStateRequestedPayload, gn as commandAdmittedEventType, gt as SteeringMessageQueuedEvent, h as BaseStateRequestedEvent, hn as baseStateRequestedEventType, ht as SteeringMessageCancelledPayload, i as AssistantMessageImportedEvent, in as UserMessageCommittedPayload, it as RecoveryEvent, j as CompactionFailedPayload, jn as inferenceStartedEventType, jt as ToolCallEvent, k as CompactionCompletedPayload, kn as inferenceCompletedEventType, kt as ToolCallCreatedEvent, l as AssistantPromptParts, ln as UserMessageSubmittedPayload, lt as RunFailedPayload, m as BaseStateFailedPayload, mn as baseStateFailedEventType, mt as SteeringMessageCancelledEvent, n as AssistantMessageCommittedPayload, nn as UserMessageCancelledPayload, nr as userMessagePromotedEventType, nt as RecoveryCompletedPayload, o as AssistantPartialCommittedEvent, on as UserMessagePromotedEvent, ot as RunCompletedPayload, p as BaseStateFailedEvent, pn as baseStateCreatedEventType, pt as RunStartedPayload, q as InferenceFailedPayload, qn as toolCallFailedEventType, qt as TurnEvent, r as AssistantMessageContent, rn as UserMessageCommittedEvent, rr as userMessageSubmittedEventType, rt as RecoveryContinuation, s as AssistantPartialCommittedPayload, sn as UserMessagePromotedPayload, st as RunEvent, t as AssistantMessageCommittedEvent, tn as UserMessageCancelledEvent, tr as userMessageCommittedEventType, tt as RecoveryCompletedEvent, u as BaseStateCreatedEvent, un as assistantMessageCommittedEventType, ut as RunInterruptedEvent, v as CommandAdmittedPayload, vn as commandCompletedEventType, vt as StopControlEvent, w as CommandFailedEvent, wn as compactionStartedEventType, wt as SummaryCreatedPayload, x as CommandCompletedEvent, xn as compactionCompletedEventType, xt as StopTurnRequestedEvent, y as CommandCancelledEvent, yn as commandFailedEventType, yt as StopTurnAppliedEvent, z as ContextRebasedEvent, zn as steeringMessageCancelledEventType, zt as ToolCallStartedEvent } from "./durable-B7M6TD_0.js";
6
- import { a as EDARuntimeError, i as EDARuntimeConfig, n as EDACommandTerminalEvent, o as EDARuntimeShape, r as EDARuntime, s as EDARuntimeSubmit, t as CommittedCommandTerminalEvent } from "./runtime-DOgmAKsO.js";
6
+ import { a as EDARuntimeError, i as EDARuntimeConfig, n as EDACommandTerminalEvent, o as EDARuntimeShape, r as EDARuntime, s as EDARuntimeSubmit, t as CommittedCommandTerminalEvent } from "./runtime-5NEJngu3.js";
7
7
  export { AssistantMessageCommittedEvent, AssistantMessageCommittedPayload, AssistantMessageContent, AssistantMessageImportedEvent, AssistantMessageImportedPayload, AssistantPartialCommittedEvent, AssistantPartialCommittedPayload, AssistantPromptPart, AssistantPromptParts, BaseStateCreatedEvent, BaseStateCreatedPayload, BaseStateEvent, BaseStateFailedEvent, BaseStateFailedPayload, BaseStateId, BaseStateRequestedEvent, BaseStateRequestedPayload, CancelPendingMessageCommand, CommandAdmittedEvent, CommandAdmittedPayload, CommandCancelledEvent, CommandCancelledPayload, CommandCompletedEvent, CommandCompletedPayload, CommandEvent, CommandFailedEvent, CommandFailedPayload, CommandId, CommandIdempotencyKey, CommandStartedEvent, CommandStartedPayload, CommittedCommandTerminalEvent, CompactionCompletedEvent, CompactionCompletedPayload, CompactionFailedEvent, CompactionFailedPayload, CompactionId, CompactionRequestedEvent, CompactionRequestedPayload, CompactionStartedEvent, CompactionStartedPayload, ContextAndCompactionEvent, ContextProjectedEvent, ContextProjectedPayload, ContextRebasedEvent, ContextRebasedPayload, ContextVersion, CorrelationId, DurableEventEnvelope, DurablePosition, DurableSubSequenceNumber, EDACommand, EDACommandTerminalEvent, EDADurableEvent, EDADurableEventV1, EDAEphemeralEvent, EDAEventTrace, EDARunTrace, EDARuntime, EDARuntimeConfig, EDARuntimeError, EDARuntimeShape, EDARuntimeSubmit, EDASpanId, EDATraceAttributeValue, EDATraceAttributes, EDATraceContext, EDATraceId, EDATraceLink, EDATraceMetadata, EphemeralEventEnvelope, EventDurability, EventEnvelope, EventId, EventNamespace, EventType, EventTypeName, FailurePayload, InferenceCompletedEvent, InferenceCompletedPayload, InferenceEvent, InferenceFailedEvent, InferenceFailedPayload, InferenceId, InferenceStartedEvent, InferenceStartedPayload, MessageEvent, MessageId, MessageQueuePausedEvent, MessageQueuePausedPayload, ModelSelectionPayload, ModelStreamEvent, NonNegativeInt, PendingMessageCancellationReason, PendingMessagesPausedEvent, PendingMessagesPausedPayload, Position, PositionOrder, PositionedEvent, PromotePendingMessageCommand, ProviderPartId, ReasoningDeltaEvent, ReasoningDeltaPayload, RecoveryCompletedEvent, RecoveryCompletedPayload, RecoveryContinuation, RecoveryEvent, ResumePendingMessagesCommand, RunCompletedEvent, RunCompletedPayload, RunEvent, RunFailedEvent, RunFailedPayload, RunId, RunInterruptedEvent, RunInterruptedPayload, RunStartedEvent, RunStartedPayload, RuntimeStatusEvent, SchemaVersion, SequenceNumber, SessionId, SteeringMessageCancelledEvent, SteeringMessageCancelledPayload, SteeringMessageQueuedEvent, SteeringMessageQueuedPayload, StopControlEvent, StopTurnAppliedEvent, StopTurnAppliedPayload, StopTurnCommand, StopTurnRequestedEvent, StopTurnRequestedPayload, SubSequenceNumber, SubmitMessageCommand, SubmitMessageDisposition, SubscriberStatusEvent, SubscriberStatusKind, SubscriberStatusPayload, SummaryCreatedEvent, SummaryCreatedPayload, SummaryId, SystemMessageCommittedEvent, SystemMessageCommittedPayload, SystemPromptText, TextDeltaEvent, TextDeltaPayload, ToolCallCompletedEvent, ToolCallCompletedPayload, ToolCallCreatedEvent, ToolCallCreatedPayload, ToolCallEvent, ToolCallFailedEvent, ToolCallFailedPayload, ToolCallId, ToolCallPromptPart, ToolCallRejectedEvent, ToolCallRejectedPayload, ToolCallRejectionFeedback, ToolCallRejectionReason, ToolCallStartedEvent, ToolCallStartedPayload, ToolFailurePromptPart, ToolName, ToolParamsDeltaEvent, ToolParamsDeltaPayload, ToolParamsEndEvent, ToolParamsEndPayload, ToolParamsStartEvent, ToolParamsStartPayload, ToolPromptPart, ToolRejectionPromptPart, ToolSuccessPromptPart, TraceStatusEvent, TraceStatusKind, TraceStatusPayload, TurnCompletedEvent, TurnCompletedPayload, TurnEvent, TurnFailedEvent, TurnFailedPayload, TurnId, TurnStartedEvent, TurnStartedPayload, TurnStoppedEvent, TurnStoppedPayload, UnixEpochMillis, UsagePayload, UserMessageCancellationReason, UserMessageCancelledEvent, UserMessageCancelledPayload, UserMessageCommittedEvent, UserMessageCommittedPayload, UserMessageContent, UserMessageDisposition, UserMessagePart, UserMessagePromotedEvent, UserMessagePromotedPayload, UserMessageSubmittedEvent, UserMessageSubmittedPayload, assistantMessageCommittedEventType, assistantMessageImportedEventType, assistantPartialCommittedEventType, baseStateCreatedEventType, baseStateFailedEventType, baseStateRequestedEventType, buildEDATraceparent, commandAdmittedEventType, commandCancelledEventType, commandCompletedEventType, commandFailedEventType, commandStartedEventType, compactionCompletedEventType, compactionFailedEventType, compactionRequestedEventType, compactionStartedEventType, comparePosition, contextProjectedEventType, contextRebasedEventType, decodeUnknownEDADurableEvent, decodeUnknownEDADurableEventSync, durablePosition, effectDurableAgentNamespace, inferenceCompletedEventType, inferenceFailedEventType, inferenceStartedEventType, makeEDAEventTrace, makeEDARunTrace, makeEDATraceContext, makeEDATraceMetadataFromParent, makeEventType, makeRootEDAEventTrace, makeRootEDATraceMetadata, messageQueuePausedEventType, parseEDATraceparent, pendingMessagesPausedEventType, reasoningDeltaEventType, recoveryCompletedEventType, runCompletedEventType, runFailedEventType, runInterruptedEventType, runStartedEventType, schemaV1, steeringMessageCancelledEventType, steeringMessageQueuedEventType, stopTurnAppliedEventType, stopTurnRequestedEventType, subscriberStatusEventType, summaryCreatedEventType, systemMessageCommittedEventType, textDeltaEventType, toolCallCompletedEventType, toolCallCreatedEventType, toolCallFailedEventType, toolCallRejectedEventType, toolCallStartedEventType, toolParamsDeltaEventType, toolParamsEndEventType, toolParamsStartEventType, traceStatusEventType, turnCompletedEventType, turnFailedEventType, turnStartedEventType, turnStoppedEventType, userMessageCancelledEventType, userMessageCommittedEventType, userMessagePromotedEventType, userMessageSubmittedEventType };
@@ -1,6 +1,6 @@
1
1
  import { u as UserMessageContent } from "./commands-Ce1ec6kH.js";
2
- import { i as ContextProjection } from "./context-projection-n6Rdup0N.js";
3
- import { S as ReducedState, v as MessageRecord } from "./command-queues-CV7O-51r.js";
2
+ import { i as ContextProjection } from "./context-projection-B4DWOZgi.js";
3
+ import { S as ReducedState, v as MessageRecord } from "./command-queues-Dwdf41mq.js";
4
4
  import * as Prompt from "effect/unstable/ai/Prompt";
5
5
 
6
6
  //#region src/domain/message-transcript.d.ts
@@ -29,4 +29,4 @@ declare const contextProjectionPromptWithUserContent: (state: PromptProjectionSt
29
29
  declare const contextProjectionPromptWithUserContents: (state: PromptProjectionState, context: ContextProjection | undefined, contents: ReadonlyArray<UserMessageContent>) => Prompt.Prompt;
30
30
  //#endregion
31
31
  export { durableMessageTranscript as a, contextProjectionPromptWithUserContents as i, contextProjectionPrompt as n, durableTranscriptPrompt as o, contextProjectionPromptWithUserContent as r, durableTranscriptPromptWithUserContent as s, DurableTranscriptMessage as t };
32
- //# sourceMappingURL=message-transcript-DiOPBY3l.d.ts.map
32
+ //# sourceMappingURL=message-transcript-CFn_D3MH.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { h as SessionId } from "./core-CYT6DBaS.js";
2
- import { i as ContextProjection } from "./context-projection-n6Rdup0N.js";
3
- import { S as ReducedState } from "./command-queues-CV7O-51r.js";
4
- import { i as EDAReducerStateSnapshot } from "./reducer-registry-CjSJBPKo.js";
2
+ import { i as ContextProjection } from "./context-projection-B4DWOZgi.js";
3
+ import { S as ReducedState } from "./command-queues-Dwdf41mq.js";
4
+ import { i as EDAReducerStateSnapshot } from "./reducer-registry-K9FqZq5-.js";
5
5
  import * as Context from "effect/Context";
6
6
  import * as Effect from "effect/Effect";
7
7
  import * as Layer from "effect/Layer";
@@ -36,4 +36,4 @@ declare class EDAPromptProjector extends EDAPromptProjector_base {
36
36
  }
37
37
  //#endregion
38
38
  export { buildEDAPrompt as a, EDAPromptProjectorShape as i, EDAPromptProjectionInput as n, EDAPromptProjector as r, EDAProjectedPromptContext as t };
39
- //# sourceMappingURL=prompt-projector-C1IbkHr0.d.ts.map
39
+ //# sourceMappingURL=prompt-projector-C2meuNrV.d.ts.map
@@ -1,4 +1,4 @@
1
- import { t as CommittedDurableEvent } from "./session-store-DZZUffUy.js";
1
+ import { t as CommittedDurableEvent } from "./session-store-BLg6UvZa.js";
2
2
  import * as Context from "effect/Context";
3
3
  import * as Layer from "effect/Layer";
4
4
  import * as Schema from "effect/Schema";
@@ -66,4 +66,4 @@ declare class EDAReducerRegistry extends EDAReducerRegistry_base {
66
66
  declare const getEDAReducerState: <State, Name extends string>(snapshot: EDAReducerStateSnapshot, reducer: EDAReducer<State, Name>) => State;
67
67
  //#endregion
68
68
  export { EDAReducersFor as a, defineEDAReducerRegistry as c, getEDAReducerState as d, reducerSchemaVersion as f, EDAReducerStateSnapshot as i, edaReservedReducerNamePrefix as l, EDAReducerRegistry as n, EDATypedReducerRegistry as o, EDAReducerRegistryShape as r, decodeReducerState as s, EDAReducer as t, encodeReducerState as u };
69
- //# sourceMappingURL=reducer-registry-CjSJBPKo.d.ts.map
69
+ //# sourceMappingURL=reducer-registry-K9FqZq5-.d.ts.map