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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/README.md +43 -41
  2. package/dist/assert-never-CoyUpoRB.js +18 -0
  3. package/dist/assert-never-CoyUpoRB.js.map +1 -0
  4. package/dist/{commands-Ce1ec6kH.d.ts → commands-3OD-p8dD.d.ts} +16 -9
  5. package/dist/compaction-63iEDHHl.js +523 -0
  6. package/dist/compaction-63iEDHHl.js.map +1 -0
  7. package/dist/context-projection-D_uRtK3r.d.ts +139 -0
  8. package/dist/{core-Hv3cFydL.d.ts → core-BcimKMIv.d.ts} +6 -4
  9. package/dist/delivery-2ZILvoRD.js +507 -0
  10. package/dist/delivery-2ZILvoRD.js.map +1 -0
  11. package/dist/{websocket-wire-D3tLrhe2.d.ts → delivery-RjM1_NAE.d.ts} +1019 -200
  12. package/dist/domain/command-queues.d.ts +81 -2
  13. package/dist/domain/command-queues.js +1 -1
  14. package/dist/domain/command-queues.js.map +1 -1
  15. package/dist/domain/context-projection.d.ts +2 -0
  16. package/dist/domain/context-projection.js +32 -0
  17. package/dist/domain/context-projection.js.map +1 -0
  18. package/dist/domain/message-transcript.d.ts +36 -2
  19. package/dist/domain/message-transcript.js +10 -2
  20. package/dist/domain/message-transcript.js.map +1 -1
  21. package/dist/domain/model-usage.d.ts +2 -0
  22. package/dist/domain/model-usage.js +59 -0
  23. package/dist/domain/model-usage.js.map +1 -0
  24. package/dist/domain/reduced-state-schema.d.ts +3 -996
  25. package/dist/domain/reduced-state-schema.js +121 -12
  26. package/dist/domain/reduced-state-schema.js.map +1 -1
  27. package/dist/domain/reduced-state.d.ts +3 -2
  28. package/dist/domain/reduced-state.js +937 -2
  29. package/dist/domain/reduced-state.js.map +1 -0
  30. package/dist/domain/run-scheduling.d.ts +2 -0
  31. package/dist/domain/run-scheduling.js +127 -0
  32. package/dist/domain/run-scheduling.js.map +1 -0
  33. package/dist/{durable-DlScwmCy.d.ts → durable-Cqv5ZRFA.d.ts} +8505 -2497
  34. package/dist/{durable-C3Rz7kg3.js → durable-D13w1Qr3.js} +253 -91
  35. package/dist/durable-D13w1Qr3.js.map +1 -0
  36. package/dist/envelope-BCzKUq_z.js +91 -0
  37. package/dist/envelope-BCzKUq_z.js.map +1 -0
  38. package/dist/envelope-Che6KatU.d.ts +254 -0
  39. package/dist/{keep-alive-p8dIcSVy.js → event-factory-_vF1bIJ7.js} +8 -10
  40. package/dist/event-factory-_vF1bIJ7.js.map +1 -0
  41. package/dist/{events-Bb9-Cu-7.d.ts → events-Dg0o5wWs.d.ts} +140 -324
  42. package/dist/{id-generator-C2Q15uZM.d.ts → id-generator-BKGoKjt-.d.ts} +3 -3
  43. package/dist/in-memory-CeODnZhE.js +150 -0
  44. package/dist/in-memory-CeODnZhE.js.map +1 -0
  45. package/dist/index.d.ts +8 -7
  46. package/dist/index.js +6 -5
  47. package/dist/interpreter-DKGJ1sSx.js +1452 -0
  48. package/dist/interpreter-DKGJ1sSx.js.map +1 -0
  49. package/dist/keep-alive-_zFCUvt3.d.ts +28 -0
  50. package/dist/model-resolver-D0vcDZsU.d.ts +24 -0
  51. package/dist/model-usage-0GeHwaaU.d.ts +54 -0
  52. package/dist/records--54mZEBx.js +675 -0
  53. package/dist/records--54mZEBx.js.map +1 -0
  54. package/dist/reduced-state-DU2ECOUp.d.ts +47821 -0
  55. package/dist/reduced-state-schema-B2t3cobf.d.ts +2187 -0
  56. package/dist/{reducer-registry-C0svUa63.d.ts → reducer-registry-JLU1yptN.d.ts} +24 -8
  57. package/dist/run-scheduling-wakeup-D_bGdicf.d.ts +24 -0
  58. package/dist/services/compaction.d.ts +2 -2
  59. package/dist/services/compaction.js +2 -426
  60. package/dist/services/id-generator.d.ts +1 -1
  61. package/dist/services/id-generator.js +4 -2
  62. package/dist/services/id-generator.js.map +1 -1
  63. package/dist/services/keep-alive.d.ts +2 -0
  64. package/dist/services/keep-alive.js +13 -0
  65. package/dist/services/keep-alive.js.map +1 -0
  66. package/dist/services/model-call.d.ts +15 -0
  67. package/dist/services/model-call.js +15 -0
  68. package/dist/services/model-call.js.map +1 -0
  69. package/dist/services/model-resolver.d.ts +2 -0
  70. package/dist/services/model-resolver.js +17 -0
  71. package/dist/services/model-resolver.js.map +1 -0
  72. package/dist/services/prompt-projector.d.ts +2 -2
  73. package/dist/services/prompt-projector.js +49 -5
  74. package/dist/services/prompt-projector.js.map +1 -1
  75. package/dist/services/reducer-registry.d.ts +2 -2
  76. package/dist/services/reducer-registry.js +21 -4
  77. package/dist/services/reducer-registry.js.map +1 -1
  78. package/dist/services/run-scheduler.d.ts +2 -0
  79. package/dist/services/run-scheduler.js +25 -0
  80. package/dist/services/run-scheduler.js.map +1 -0
  81. package/dist/services/run-scheduling-wakeup.d.ts +2 -0
  82. package/dist/services/run-scheduling-wakeup.js +13 -0
  83. package/dist/services/run-scheduling-wakeup.js.map +1 -0
  84. package/dist/services/runtime-layer.d.ts +48 -0
  85. package/dist/services/runtime-layer.js +51 -0
  86. package/dist/services/runtime-layer.js.map +1 -0
  87. package/dist/services/runtime.d.ts +1 -1
  88. package/dist/services/runtime.js +34 -20
  89. package/dist/services/runtime.js.map +1 -1
  90. package/dist/services/session-event-observer.d.ts +2 -0
  91. package/dist/services/session-event-observer.js +13 -0
  92. package/dist/services/session-event-observer.js.map +1 -0
  93. package/dist/services/session-query.d.ts +2 -2
  94. package/dist/services/session-query.js +141 -2
  95. package/dist/services/session-query.js.map +1 -0
  96. package/dist/services/session-state.d.ts +2 -0
  97. package/dist/services/session-state.js +2 -0
  98. package/dist/services/session-store.d.ts +2 -2
  99. package/dist/services/session-store.js +272 -2
  100. package/dist/services/session-store.js.map +1 -0
  101. package/dist/services/sink-checkpoint-store.d.ts +2 -0
  102. package/dist/services/sink-checkpoint-store.js +50 -0
  103. package/dist/services/sink-checkpoint-store.js.map +1 -0
  104. package/dist/services/sink-registry.d.ts +2 -2
  105. package/dist/services/sink-registry.js +1 -1
  106. package/dist/services/span-names.d.ts +1 -1
  107. package/dist/services/span-names.js +7 -1
  108. package/dist/services/span-names.js.map +1 -1
  109. package/dist/services/tool-registry.d.ts +2 -2
  110. package/dist/services/tool-registry.js +12 -3
  111. package/dist/services/tool-registry.js.map +1 -1
  112. package/dist/services/tracing.d.ts +3 -3
  113. package/dist/services/tracing.js +25 -4
  114. package/dist/services/tracing.js.map +1 -1
  115. package/dist/session-event-observer-HvrRckbC.d.ts +24 -0
  116. package/dist/{session-query-Cbf-e0rG.js → session-state-BQYsuBqi.js} +693 -251
  117. package/dist/session-state-BQYsuBqi.js.map +1 -0
  118. package/dist/session-store-CQxg9U82.d.ts +3302 -0
  119. package/dist/sink-checkpoint-store-DWGifxp0.d.ts +39 -0
  120. package/dist/sink-registry-DskRcyOS.js +345 -0
  121. package/dist/sink-registry-DskRcyOS.js.map +1 -0
  122. package/dist/subscription-DmO3BcdT.js +505 -0
  123. package/dist/subscription-DmO3BcdT.js.map +1 -0
  124. package/dist/subscription-rC35dAWn.d.ts +958 -0
  125. package/dist/testkit/layers.d.ts +34 -19
  126. package/dist/testkit/layers.js +30 -16
  127. package/dist/testkit/layers.js.map +1 -1
  128. package/dist/testkit/transcript.d.ts +226 -0
  129. package/dist/testkit/transcript.js +1475 -0
  130. package/dist/testkit/transcript.js.map +1 -0
  131. package/dist/{tool-registry-CcnkAAQK.d.ts → tool-registry-BzlMhwzj.d.ts} +44 -8
  132. package/dist/{tracing-BXHAkxkx.d.ts → tracing-BwjbF285.d.ts} +1 -2
  133. package/dist/transcript.d.ts +101 -0
  134. package/dist/transcript.js +107 -0
  135. package/dist/transcript.js.map +1 -0
  136. package/dist/types/commands.d.ts +2 -2
  137. package/dist/types/commands.js +8 -3
  138. package/dist/types/commands.js.map +1 -1
  139. package/dist/types/core.d.ts +2 -2
  140. package/dist/types/core.js +4 -2
  141. package/dist/types/core.js.map +1 -1
  142. package/dist/types/events/durable.d.ts +2 -2
  143. package/dist/types/events/durable.js +2 -2
  144. package/dist/types/events.d.ts +5 -4
  145. package/dist/types/events.js +3 -2
  146. package/dist/types/events.js.map +1 -1
  147. package/dist/types/tracing.d.ts +1 -1
  148. package/dist/types/tracing.js.map +1 -1
  149. package/dist/websocket/events.d.ts +2 -0
  150. package/dist/websocket/events.js +2 -0
  151. package/dist/websocket.d.ts +2201 -0
  152. package/dist/websocket.js +684 -0
  153. package/dist/websocket.js.map +1 -0
  154. package/dist/window-read-CBZEJ84M.d.ts +113 -0
  155. package/dist/window-read-DPFAA1hM.js +264 -0
  156. package/dist/window-read-DPFAA1hM.js.map +1 -0
  157. package/package.json +87 -46
  158. package/testing/offline-trace/README.md +2 -1
  159. package/CHANGELOG.md +0 -25
  160. package/CONTRIBUTING.md +0 -26
  161. package/SECURITY.md +0 -7
  162. package/dist/command-queues-CQ9cwRP7.d.ts +0 -468
  163. package/dist/compaction-1LSZR944.d.ts +0 -144
  164. package/dist/durable-C3Rz7kg3.js.map +0 -1
  165. package/dist/durable-object-runtime-CiMKxGs6.d.ts +0 -257
  166. package/dist/durable-object-runtime-wKiqaAt2.js +0 -1494
  167. package/dist/durable-object-runtime-wKiqaAt2.js.map +0 -1
  168. package/dist/durable-object-storage-Czy7IPrh.d.ts +0 -41
  169. package/dist/host/durable-object-runtime.d.ts +0 -2
  170. package/dist/host/durable-object-runtime.js +0 -2
  171. package/dist/host/durable-object-storage.d.ts +0 -2
  172. package/dist/host/durable-object-storage.js +0 -0
  173. package/dist/host/durable-object.d.ts +0 -83
  174. package/dist/host/durable-object.js +0 -191
  175. package/dist/host/durable-object.js.map +0 -1
  176. package/dist/host/websocket-wire.d.ts +0 -2
  177. package/dist/host/websocket-wire.js +0 -105
  178. package/dist/host/websocket-wire.js.map +0 -1
  179. package/dist/index-BVVgDSdq.d.ts +0 -1
  180. package/dist/keep-alive-DYDsH6qN.d.ts +0 -111
  181. package/dist/keep-alive-p8dIcSVy.js.map +0 -1
  182. package/dist/message-transcript-BCHdHAe2.d.ts +0 -32
  183. package/dist/prompt-projector-DimXJPOJ.d.ts +0 -39
  184. package/dist/reduced-state-C4nVVzz9.js +0 -910
  185. package/dist/reduced-state-C4nVVzz9.js.map +0 -1
  186. package/dist/runtime-DcdPOEuE.d.ts +0 -60
  187. package/dist/services/compaction.js.map +0 -1
  188. package/dist/session-query-Cbf-e0rG.js.map +0 -1
  189. package/dist/session-query-hxfujxUH.d.ts +0 -769
  190. package/dist/session-store-D2Ore1QC.d.ts +0 -295
  191. package/dist/session-store-pYxQW9qh.js +0 -214
  192. package/dist/session-store-pYxQW9qh.js.map +0 -1
  193. package/dist/sink-registry-BziFpxoE.d.ts +0 -158
  194. package/dist/sink-registry-CFC6xjsN.js +0 -312
  195. package/dist/sink-registry-CFC6xjsN.js.map +0 -1
  196. package/docs/assets/architecture.svg +0 -216
  197. package/docs/assets/event-sequence.svg +0 -133
  198. package/docs/assets/gcp-trace.png +0 -0
  199. package/docs/assets/hero.svg +0 -33
  200. package/docs/message-steering.md +0 -831
  201. package/docs/releasing.md +0 -96
  202. package/docs/spec.md +0 -777
  203. package/docs/subagents.md +0 -725
  204. package/docs/testing.md +0 -64
  205. package/docs/ui-projection.md +0 -742
  206. package/docs/websocket-protocol.md +0 -639
  207. package/examples/001-no-tools/README.md +0 -65
  208. package/examples/001-no-tools/worker.ts +0 -79
  209. package/examples/002-slack-bridge/README.md +0 -134
  210. package/examples/002-slack-bridge/events.ts +0 -115
  211. package/examples/002-slack-bridge/reducer.ts +0 -216
  212. package/examples/002-slack-bridge/scenario.test.ts +0 -223
  213. package/examples/002-slack-bridge/sinks.ts +0 -109
  214. package/examples/002-slack-bridge/worker.ts +0 -140
  215. package/examples/003-sandbox-lifecycle/README.md +0 -78
  216. package/examples/003-sandbox-lifecycle/events.ts +0 -203
  217. package/examples/003-sandbox-lifecycle/reducer.ts +0 -305
  218. package/examples/003-sandbox-lifecycle/scenario.test.ts +0 -202
  219. package/examples/_shared/event-id.ts +0 -12
  220. package/examples/_shared/http.ts +0 -27
  221. package/examples/_shared/openai.ts +0 -33
@@ -0,0 +1,684 @@
1
+ import { SequenceNumber } from "./types/core.js";
2
+ import { E as TranscriptOrder, _ as TranscriptCursor } from "./records--54mZEBx.js";
3
+ import { c as transcriptCoverageOf, i as TranscriptUpdate, n as TranscriptRequestId, r as TranscriptSubscriptionBase, t as TranscriptCoverage } from "./subscription-DmO3BcdT.js";
4
+ import { A as FrameId, B as EDAWebSocketWireFlowControl, C as EDAWebSocketServerFrame, D as EDA_WS_CLOSE_PROTOCOL_ERROR, E as EDA_WS_CLOSE_LAGGED, F as laggedCloseReason, G as EDAWebSocketWirePongFrame, H as EDAWebSocketWireHelloFrame, I as EDAFrameworkWebSocketEvent, J as EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, K as EDA_WEB_SOCKET_PING_MESSAGE, L as EDAWebSocketWireAckFrame, M as decodeEDAWebSocketClientMessage, N as defaultEDAWebSocketFlowControl, O as EDA_WS_CLOSE_SEND_FAILED, P as encodeEDAWebSocketServerFrame, R as EDAWebSocketWireClientFrame, S as EDAWebSocketPongFrame, T as EDA_WS_CLOSE_GOING_AWAY, U as EDAWebSocketWireLaggedFrame, V as EDAWebSocketWireHeartbeatFrame, W as EDAWebSocketWirePingFrame, X as makeEDAWebSocketWireProtocol, Y as edaFrameworkWebSocketWireProtocol, _ as EDAWebSocketFlowControl, a as checkpointWebSocketDeliveryState, b as EDAWebSocketLaggedFrame, c as onClientAck, d as onHostSuppressedFrame, f as restoreWebSocketDeliveryState, g as EDAWebSocketEventsFrame, h as EDAWebSocketErrorFrame, i as SubscriberLagReason, j as SubscriberId, k as EDA_WS_CLOSE_UNSUPPORTED_DATA, l as onDurableEvents, m as EDAWebSocketClientFrame, n as EDAWebSocketInFlightFrame, o as deliveryHelloFrame, p as EDAWebSocketAckFrame, q as EDA_WEB_SOCKET_PONG_MESSAGE, r as EDAWebSocketSuppressedRange, s as makeWebSocketDeliveryState, t as EDAWebSocketDeliveryCheckpoint, u as onEphemeralEvent, v as EDAWebSocketHeartbeatFrame, w as EDA_WEB_SOCKET_PROTOCOL_VERSION, x as EDAWebSocketPingFrame, y as EDAWebSocketHelloFrame, z as EDAWebSocketWireErrorFrame } from "./delivery-2ZILvoRD.js";
5
+ import * as Schema from "effect/Schema";
6
+ import * as Exit from "effect/Exit";
7
+ //#region src/websocket/transcript.ts
8
+ const PositiveInt$1 = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));
9
+ const NonNegativeInt$1 = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
10
+ /**
11
+ * Transcript protocol major. A change of meaning that an older client would misread bumps it;
12
+ * a client that sees another major performs one bounded reload.
13
+ */
14
+ const EDA_TRANSCRIPT_PROTOCOL_MAJOR = 1;
15
+ /** Additive wire revision within a major; older clients drop fields they do not know. */
16
+ const EDA_TRANSCRIPT_WIRE_VERSION = 1;
17
+ /**
18
+ * The small, stable envelope a client decodes before any version-specific schema, from the
19
+ * socket hello and from the host's SSR data. Its shape never changes; everything else may.
20
+ */
21
+ const EDATranscriptNegotiation = Schema.Struct({
22
+ protocolMajor: PositiveInt$1,
23
+ wireVersion: PositiveInt$1,
24
+ /** Optional features this server speaks; clients ignore names they do not know. */
25
+ capabilities: Schema.Array(Schema.String)
26
+ });
27
+ /** What this EDA release speaks. Hosts embed it in SSR data next to the transcript window. */
28
+ const edaTranscriptNegotiation = {
29
+ protocolMajor: 1,
30
+ wireVersion: 1,
31
+ capabilities: [
32
+ "window",
33
+ "page",
34
+ "retain",
35
+ "chunked-updates",
36
+ "active-content"
37
+ ]
38
+ };
39
+ /** Any value carrying the envelope under `negotiation`: a hello frame or SSR data. */
40
+ const NegotiationCarrier = Schema.Struct({ negotiation: EDATranscriptNegotiation });
41
+ const decodeNegotiationCarrier = Schema.decodeUnknownOption(NegotiationCarrier);
42
+ /**
43
+ * Decode only the negotiation envelope from an untrusted hello frame or SSR payload and compare
44
+ * it with this client's major. Run before decoding anything version-specific.
45
+ */
46
+ const negotiateEDATranscript = (carrier, localMajor = 1) => {
47
+ const decoded = decodeNegotiationCarrier(carrier);
48
+ if (decoded._tag === "None") return { _tag: "Undecodable" };
49
+ const remote = decoded.value.negotiation;
50
+ return remote.protocolMajor === localMajor ? {
51
+ _tag: "Compatible",
52
+ remote
53
+ } : {
54
+ _tag: "MajorMismatch",
55
+ remote
56
+ };
57
+ };
58
+ /** WebSocket close code: the server lost volatile transfer state; reconnect and resubscribe. */
59
+ const EDA_WS_CLOSE_TRANSCRIPT_RESUBSCRIBE = 4009;
60
+ /** First frame on a transcript socket: the event-socket hello plus the negotiation envelope. */
61
+ const EDATranscriptHelloFrame = Schema.Struct({
62
+ ...EDAWebSocketWireHelloFrame.fields,
63
+ negotiation: EDATranscriptNegotiation
64
+ });
65
+ /** A transcript update that fits one frame. */
66
+ const EDATranscriptUpdateFrame = Schema.Struct({
67
+ _tag: Schema.Literal("transcript"),
68
+ frameId: PositiveInt$1,
69
+ update: TranscriptUpdate
70
+ });
71
+ /**
72
+ * One slice of an update too large for a frame. `data` slices concatenated in `index` order are
73
+ * the JSON of one `TranscriptUpdate`; the client applies it only after slice `count - 1` (the
74
+ * completion marker) and discards a transfer that is interrupted.
75
+ */
76
+ const EDATranscriptChunkFrame = Schema.Struct({
77
+ _tag: Schema.Literal("transcript-chunk"),
78
+ frameId: PositiveInt$1,
79
+ updateSeq: PositiveInt$1,
80
+ index: NonNegativeInt$1,
81
+ count: PositiveInt$1,
82
+ data: Schema.String
83
+ }).check(Schema.makeFilter((chunk) => chunk.index < chunk.count || "chunk index out of range"));
84
+ /** Every server frame a transcript socket may carry. */
85
+ const EDATranscriptServerFrame = Schema.Union([
86
+ EDATranscriptHelloFrame,
87
+ EDATranscriptUpdateFrame,
88
+ EDATranscriptChunkFrame,
89
+ EDAWebSocketWirePongFrame,
90
+ EDAWebSocketWireLaggedFrame,
91
+ EDAWebSocketWireErrorFrame
92
+ ]);
93
+ /**
94
+ * Start or restart the subscription. After SSR, `range` is what the page rendered, `tail` its
95
+ * `!hasNewer`, and `since` its `throughSeq`; a reconnecting client sends what it last applied.
96
+ * Without `range` the server replies with the latest `count` records.
97
+ */
98
+ const EDATranscriptSubscribeFrame = Schema.Struct({
99
+ _tag: Schema.Literal("subscribe"),
100
+ requestId: Schema.optionalKey(TranscriptRequestId),
101
+ range: Schema.optionalKey(TranscriptCoverage),
102
+ tail: Schema.optionalKey(Schema.Boolean),
103
+ since: Schema.optionalKey(SequenceNumber),
104
+ count: Schema.optionalKey(PositiveInt$1)
105
+ });
106
+ /** Extend the coverage from its edge: `cursor` is the coverage's `from` (before) or `to` (after). */
107
+ const EDATranscriptPageFrame = Schema.Struct({
108
+ _tag: Schema.Literal("page"),
109
+ requestId: Schema.optionalKey(TranscriptRequestId),
110
+ direction: Schema.Literals(["before", "after"]),
111
+ cursor: TranscriptCursor,
112
+ count: PositiveInt$1
113
+ });
114
+ /** Narrow the coverage to a span inside it, so the server stops sending changes outside it. */
115
+ const EDATranscriptRetainFrame = Schema.Struct({
116
+ _tag: Schema.Literal("retain"),
117
+ requestId: Schema.optionalKey(TranscriptRequestId),
118
+ from: TranscriptCursor,
119
+ to: TranscriptCursor
120
+ });
121
+ /** A client request; each is answered by exactly one update, in arrival order. */
122
+ const EDATranscriptRequestFrame = Schema.Union([
123
+ EDATranscriptSubscribeFrame,
124
+ EDATranscriptPageFrame,
125
+ EDATranscriptRetainFrame
126
+ ]);
127
+ /** Every client frame a transcript socket accepts. */
128
+ const EDATranscriptClientFrame = Schema.Union([
129
+ EDAWebSocketWireAckFrame,
130
+ EDAWebSocketWirePingFrame,
131
+ EDATranscriptSubscribeFrame,
132
+ EDATranscriptPageFrame,
133
+ EDATranscriptRetainFrame
134
+ ]);
135
+ const encodeUpdate = Schema.encodeSync(TranscriptUpdate);
136
+ const encodeServerFrame = Schema.encodeSync(EDATranscriptServerFrame);
137
+ /** Serialize one update once; frames embed this text, chunks slice it. */
138
+ const encodeEDATranscriptUpdate = (update) => JSON.stringify(encodeUpdate(update));
139
+ /** Serialize a non-update server frame. */
140
+ const encodeEDATranscriptServerFrame = (frame) => JSON.stringify(encodeServerFrame(frame));
141
+ /** The single-frame form of an encoded update. */
142
+ const edaTranscriptUpdateFrameText = (frameId, encodedUpdate) => `{"_tag":"transcript","frameId":${frameId},"update":${encodedUpdate}}`;
143
+ /** One chunk frame of an encoded update. */
144
+ const edaTranscriptChunkFrameText = (input) => `{"_tag":"transcript-chunk","frameId":${input.frameId},"updateSeq":${input.updateSeq},"index":${input.index},"count":${input.count},"data":${JSON.stringify(input.data)}}`;
145
+ const textEncoder = new TextEncoder();
146
+ /** UTF-8 byte length of a string. */
147
+ const utf8ByteLength = (text) => textEncoder.encode(text).byteLength;
148
+ /** Bytes a chunk frame spends besides its data, with generous room for large numbers. */
149
+ const chunkFrameOverheadBytes = 160;
150
+ /** Control characters JSON writes as a two-byte escape (`\b`, `\t`, `\n`, `\f`, `\r`). */
151
+ const shortEscapes = /* @__PURE__ */ new Set([
152
+ 8,
153
+ 9,
154
+ 10,
155
+ 12,
156
+ 13
157
+ ]);
158
+ /** UTF-8 bytes one UTF-16 code unit costs inside a JSON string literal. */
159
+ const jsonStringUnitBytes = (code) => {
160
+ if (code === 34 || code === 92) return 2;
161
+ if (code < 32) return shortEscapes.has(code) ? 2 : 6;
162
+ if (code < 128) return 1;
163
+ if (code < 2048) return 2;
164
+ if (code >= 55296 && code <= 57343) return 6;
165
+ return 3;
166
+ };
167
+ /**
168
+ * Split an encoded update into chunk data that each fit a frame of `maxFrameBytes`, never
169
+ * splitting a surrogate pair.
170
+ */
171
+ const splitEDATranscriptUpdate = (encodedUpdate, maxFrameBytes) => {
172
+ const budget = Math.max(16, maxFrameBytes - chunkFrameOverheadBytes);
173
+ const chunks = [];
174
+ let start = 0;
175
+ let bytes = 0;
176
+ for (let index = 0; index < encodedUpdate.length; index += 1) {
177
+ const code = encodedUpdate.charCodeAt(index);
178
+ const pair = code >= 55296 && code <= 56319 && index + 1 < encodedUpdate.length ? encodedUpdate.charCodeAt(index + 1) : void 0;
179
+ const isPair = pair !== void 0 && pair >= 56320 && pair <= 57343;
180
+ const cost = isPair ? 4 : jsonStringUnitBytes(code);
181
+ if (bytes + cost > budget && index > start) {
182
+ chunks.push(encodedUpdate.slice(start, index));
183
+ start = index;
184
+ bytes = 0;
185
+ }
186
+ bytes += cost;
187
+ if (isPair) index += 1;
188
+ }
189
+ if (start < encodedUpdate.length || chunks.length === 0) chunks.push(encodedUpdate.slice(start));
190
+ return chunks;
191
+ };
192
+ //#endregion
193
+ //#region src/websocket/transcript-client.ts
194
+ /** A client that has rendered nothing yet. */
195
+ const emptyEDATranscriptClientState = {
196
+ window: void 0,
197
+ lastFrameId: 0,
198
+ appliedUpdateSeq: 0,
199
+ assembling: void 0
200
+ };
201
+ /** Seed a client from the window its page was server-rendered with. */
202
+ const edaTranscriptClientFromWindow = (window) => ({
203
+ ...emptyEDATranscriptClientState,
204
+ window: {
205
+ incarnation: window.incarnation,
206
+ version: window.version,
207
+ throughSeq: window.throughSeq,
208
+ coverage: transcriptCoverageOf(window),
209
+ hasOlder: window.hasOlder,
210
+ hasNewer: window.hasNewer,
211
+ readiness: window.readiness,
212
+ records: window.records,
213
+ dependencies: window.dependencies,
214
+ activeContent: window.activeContent ?? []
215
+ }
216
+ });
217
+ /**
218
+ * Prepare for a new socket: per-socket counters restart and any partial transfer is discarded.
219
+ * The applied window is kept; the next `subscribe` asks for changes since it.
220
+ */
221
+ const edaTranscriptClientReconnected = (state) => ({
222
+ ...emptyEDATranscriptClientState,
223
+ window: state.window
224
+ });
225
+ const decodeUpdateFrame = Schema.decodeUnknownExit(EDATranscriptUpdateFrame);
226
+ const decodeChunkFrame = Schema.decodeUnknownExit(EDATranscriptChunkFrame);
227
+ const decodeUpdate = Schema.decodeUnknownExit(TranscriptUpdate);
228
+ const peek = (value) => {
229
+ if (typeof value !== "object" || value === null) return {};
230
+ const tag = "_tag" in value && typeof value._tag === "string" ? value._tag : void 0;
231
+ const frameId = "frameId" in value && typeof value.frameId === "number" && Number.isInteger(value.frameId) ? value.frameId : void 0;
232
+ return {
233
+ ...tag === void 0 ? {} : { tag },
234
+ ...frameId === void 0 ? {} : { frameId }
235
+ };
236
+ };
237
+ /** Apply one server text message. Frames must arrive in frame-id order without gaps. */
238
+ const applyEDATranscriptServerMessage = (state, message) => {
239
+ let json;
240
+ try {
241
+ json = JSON.parse(message);
242
+ } catch {
243
+ return resubscribe(state, "malformed server message");
244
+ }
245
+ const { tag, frameId } = peek(json);
246
+ switch (tag) {
247
+ case "hello": return {
248
+ state,
249
+ outcome: {
250
+ _tag: "Hello",
251
+ negotiation: negotiateEDATranscript(json)
252
+ }
253
+ };
254
+ case "pong": return {
255
+ state,
256
+ outcome: { _tag: "Ignored" }
257
+ };
258
+ case "lagged":
259
+ case "error": return resubscribe(state, `server sent ${tag}`);
260
+ }
261
+ if (frameId === void 0) return {
262
+ state,
263
+ outcome: { _tag: "Ignored" }
264
+ };
265
+ if (frameId !== state.lastFrameId + 1) return resubscribe(state, "frame gap");
266
+ const received = {
267
+ ...state,
268
+ lastFrameId: frameId
269
+ };
270
+ if (tag === "transcript") {
271
+ const decoded = decodeUpdateFrame(json);
272
+ if (Exit.isFailure(decoded)) return resubscribe(state, "undecodable update");
273
+ if (received.assembling !== void 0) return resubscribe(state, "update interrupted a transfer");
274
+ return applyUpdate(received, decoded.value.update);
275
+ }
276
+ if (tag === "transcript-chunk") {
277
+ const decoded = decodeChunkFrame(json);
278
+ if (Exit.isFailure(decoded)) return resubscribe(state, "undecodable chunk");
279
+ const chunk = decoded.value;
280
+ const assembling = received.assembling ?? {
281
+ updateSeq: chunk.updateSeq,
282
+ count: chunk.count,
283
+ data: []
284
+ };
285
+ if (assembling.updateSeq !== chunk.updateSeq || assembling.count !== chunk.count || assembling.data.length !== chunk.index) return resubscribe(state, "interrupted chunked transfer");
286
+ const data = [...assembling.data, chunk.data];
287
+ if (data.length < chunk.count) {
288
+ const next = {
289
+ ...received,
290
+ assembling: {
291
+ ...assembling,
292
+ data
293
+ }
294
+ };
295
+ return {
296
+ state: next,
297
+ outcome: { _tag: "Partial" },
298
+ ack: ackOf(next)
299
+ };
300
+ }
301
+ let updateJson;
302
+ try {
303
+ updateJson = JSON.parse(data.join(""));
304
+ } catch {
305
+ return resubscribe(state, "malformed chunked update");
306
+ }
307
+ const update = decodeUpdate(updateJson);
308
+ if (Exit.isFailure(update) || update.value.updateSeq !== chunk.updateSeq) return resubscribe(state, "undecodable chunked update");
309
+ return applyUpdate({
310
+ ...received,
311
+ assembling: void 0
312
+ }, update.value);
313
+ }
314
+ return {
315
+ state: received,
316
+ outcome: { _tag: "Ignored" },
317
+ ack: ackOf(received)
318
+ };
319
+ };
320
+ const resubscribe = (state, reason) => ({
321
+ state: {
322
+ ...state,
323
+ assembling: void 0
324
+ },
325
+ outcome: {
326
+ _tag: "Resubscribe",
327
+ reason
328
+ }
329
+ });
330
+ const ackOf = (state) => ({
331
+ _tag: "ack",
332
+ frameId: state.lastFrameId,
333
+ durableThroughSeq: state.appliedUpdateSeq === 0 ? 0 : state.window?.throughSeq ?? 0,
334
+ appliedUpdateSeq: state.appliedUpdateSeq
335
+ });
336
+ const orderKeyOf = (record) => "position" in record && record.position !== void 0 ? {
337
+ ...record.position,
338
+ recordId: record.id
339
+ } : void 0;
340
+ const covered = (coverage, record) => {
341
+ const key = orderKeyOf(record);
342
+ return coverage !== void 0 && key !== void 0 && TranscriptOrder(coverage.from, key) <= 0 && TranscriptOrder(key, coverage.to) <= 0;
343
+ };
344
+ const applyUpdate = (state, update) => {
345
+ if (update.updateSeq !== state.appliedUpdateSeq + 1) return resubscribe(state, "update gap");
346
+ const previous = state.window;
347
+ if (update.mode === "patch" && (previous === void 0 || previous.incarnation !== update.incarnation || previous.version !== update.version)) return resubscribe(state, "patch without its base");
348
+ const base = update.mode === "patch" ? previous : void 0;
349
+ const topLevel = new Map((base?.records ?? []).map((record) => [record.id, record]));
350
+ for (const record of update.records) topLevel.set(record.id, record);
351
+ const records = [...topLevel.values()].filter((record) => covered(update.coverage, record)).sort((left, right) => {
352
+ const leftKey = orderKeyOf(left);
353
+ const rightKey = orderKeyOf(right);
354
+ return leftKey === void 0 || rightKey === void 0 ? 0 : TranscriptOrder(leftKey, rightKey);
355
+ });
356
+ const dependencyMap = new Map((base?.dependencies ?? []).map((record) => [record.id, record]));
357
+ for (const record of update.dependencies) dependencyMap.set(record.id, record);
358
+ const dependencies = update.dependencyIds.flatMap((id) => {
359
+ const record = dependencyMap.get(id);
360
+ return record === void 0 ? [] : [record];
361
+ });
362
+ if (dependencies.length !== update.dependencyIds.length) return resubscribe(state, "patch referenced a dependency the client does not hold");
363
+ const window = {
364
+ incarnation: update.incarnation,
365
+ version: update.version,
366
+ throughSeq: update.throughSeq,
367
+ coverage: update.coverage,
368
+ hasOlder: update.hasOlder,
369
+ hasNewer: update.hasNewer,
370
+ readiness: update.readiness,
371
+ records,
372
+ dependencies,
373
+ activeContent: update.readiness._tag !== "Ready" ? [] : update.activeContent ?? base?.activeContent ?? []
374
+ };
375
+ const next = {
376
+ ...state,
377
+ window,
378
+ appliedUpdateSeq: update.updateSeq,
379
+ assembling: void 0
380
+ };
381
+ return {
382
+ state: next,
383
+ outcome: {
384
+ _tag: "Applied",
385
+ updateSeq: update.updateSeq,
386
+ ...update.requestId === void 0 ? {} : { requestId: update.requestId }
387
+ },
388
+ ack: ackOf(next)
389
+ };
390
+ };
391
+ /**
392
+ * The request a client sends first on every socket: changes since the window it holds over the
393
+ * span it holds, or the latest `count` records when it holds none.
394
+ */
395
+ const edaTranscriptSubscribeRequest = (state, options) => {
396
+ const window = state.window;
397
+ const extra = {
398
+ ...options?.count === void 0 ? {} : { count: options.count },
399
+ ...options?.requestId === void 0 ? {} : { requestId: options.requestId }
400
+ };
401
+ return window?.coverage === void 0 ? {
402
+ _tag: "subscribe",
403
+ ...extra
404
+ } : {
405
+ _tag: "subscribe",
406
+ range: window.coverage,
407
+ tail: !window.hasNewer,
408
+ since: window.throughSeq,
409
+ ...extra
410
+ };
411
+ };
412
+ /** Page from the held coverage's edge, or `undefined` when there is nothing to page from. */
413
+ const edaTranscriptPageRequest = (state, direction, count, requestId) => {
414
+ const coverage = state.window?.coverage;
415
+ if (coverage === void 0) return void 0;
416
+ return {
417
+ _tag: "page",
418
+ direction,
419
+ cursor: direction === "before" ? coverage.from : coverage.to,
420
+ count,
421
+ ...requestId === void 0 ? {} : { requestId }
422
+ };
423
+ };
424
+ /**
425
+ * Keep only the top-level records from `fromIndex` to `toIndex` (inclusive) of the held window;
426
+ * the server confirms with an update whose coverage is the narrowed span.
427
+ */
428
+ const edaTranscriptRetainRequest = (state, fromIndex, toIndex, requestId) => {
429
+ const window = state.window;
430
+ const from = window?.records[fromIndex];
431
+ const to = window?.records[toIndex];
432
+ const fromKey = from === void 0 ? void 0 : orderKeyOf(from);
433
+ const toKey = to === void 0 ? void 0 : orderKeyOf(to);
434
+ if (window === void 0 || fromKey === void 0 || toKey === void 0) return void 0;
435
+ const scope = {
436
+ incarnation: window.incarnation,
437
+ version: window.version
438
+ };
439
+ return {
440
+ _tag: "retain",
441
+ from: {
442
+ ...scope,
443
+ ...fromKey,
444
+ anchorSeq: SequenceNumber.make(fromKey.anchorSeq)
445
+ },
446
+ to: {
447
+ ...scope,
448
+ ...toKey,
449
+ anchorSeq: SequenceNumber.make(toKey.anchorSeq)
450
+ },
451
+ ...requestId === void 0 ? {} : { requestId }
452
+ };
453
+ };
454
+ //#endregion
455
+ //#region src/websocket/transcript-delivery.ts
456
+ const PositiveInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));
457
+ const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
458
+ /** A chunked update whose frames are not all sent yet; its chunk data is volatile. */
459
+ const EDATranscriptTransfer = Schema.Struct({
460
+ updateSeq: PositiveInt,
461
+ throughSeq: SequenceNumber,
462
+ count: PositiveInt,
463
+ nextIndex: NonNegativeInt
464
+ });
465
+ /**
466
+ * Everything a transcript socket needs to resume after hibernation, persisted in its attachment
467
+ * before every send and after every applied ACK.
468
+ *
469
+ * Transport receipts (`inFlight`, `lastAckedFrameId`) bound frames in flight exactly as on an
470
+ * event socket. The applied cut (`appliedUpdateSeq`, `appliedThroughSeq`) is the last update the
471
+ * client applied completely. `subscription` is the base the next update is planned against, and
472
+ * `requests` are client requests not yet answered. A persisted `transfer` means chunk data was
473
+ * staged in memory; a socket restored with one cannot finish it and is closed.
474
+ */
475
+ const EDATranscriptDeliveryCheckpoint = Schema.Struct({
476
+ lastAckedFrameId: NonNegativeInt,
477
+ nextFrameId: PositiveInt,
478
+ inFlight: Schema.Array(Schema.Struct({
479
+ frameId: PositiveInt,
480
+ sentAtMs: Schema.Number
481
+ })),
482
+ nextUpdateSeq: PositiveInt,
483
+ completedUpdateSeq: NonNegativeInt,
484
+ completedThroughSeq: SequenceNumber,
485
+ appliedUpdateSeq: NonNegativeInt,
486
+ appliedThroughSeq: SequenceNumber,
487
+ transfer: Schema.optionalKey(EDATranscriptTransfer),
488
+ subscription: Schema.optionalKey(TranscriptSubscriptionBase),
489
+ requests: Schema.Array(EDATranscriptRequestFrame)
490
+ });
491
+ const defaultEDATranscriptDeliveryLimits = {
492
+ maxStagedBytes: 8388608,
493
+ maxPendingRequests: 4
494
+ };
495
+ /** Delivery state for a newly accepted transcript socket. */
496
+ const makeTranscriptDeliveryState = (policy) => ({
497
+ policy,
498
+ lastAckedFrameId: 0,
499
+ nextFrameId: 1,
500
+ inFlight: [],
501
+ nextUpdateSeq: 1,
502
+ completedUpdateSeq: 0,
503
+ completedThroughSeq: SequenceNumber.make(0),
504
+ appliedUpdateSeq: 0,
505
+ appliedThroughSeq: SequenceNumber.make(0),
506
+ requests: [],
507
+ staged: []
508
+ });
509
+ /**
510
+ * Restore a hibernated transcript socket. A socket that was mid-transfer lost its staged chunks
511
+ * with the isolate and cannot resume: the caller closes it and the client resubscribes.
512
+ */
513
+ const restoreTranscriptDeliveryState = (policy, checkpoint) => checkpoint.transfer === void 0 ? {
514
+ _tag: "Restored",
515
+ state: {
516
+ ...checkpoint,
517
+ policy,
518
+ staged: []
519
+ }
520
+ } : { _tag: "TransferLost" };
521
+ /** The attachment-safe part of the state. */
522
+ const checkpointTranscriptDelivery = (state) => ({
523
+ lastAckedFrameId: state.lastAckedFrameId,
524
+ nextFrameId: state.nextFrameId,
525
+ inFlight: state.inFlight,
526
+ nextUpdateSeq: state.nextUpdateSeq,
527
+ completedUpdateSeq: state.completedUpdateSeq,
528
+ completedThroughSeq: state.completedThroughSeq,
529
+ appliedUpdateSeq: state.appliedUpdateSeq,
530
+ appliedThroughSeq: state.appliedThroughSeq,
531
+ ...state.transfer === void 0 ? {} : { transfer: state.transfer },
532
+ ...state.subscription === void 0 ? {} : { subscription: state.subscription },
533
+ requests: state.requests
534
+ });
535
+ /** Frames that may be sent before the client's next receipt. */
536
+ const transcriptDeliveryCapacity = (state) => state.policy.maxInFlightFrames - state.inFlight.length;
537
+ /** Lazily enforced ACK deadline: no resident timer, checked on each transition. */
538
+ const transcriptAckTimedOut = (state, nowMs) => state.inFlight.some((frame) => frame.sentAtMs + state.policy.ackTimeoutMs <= nowMs);
539
+ /**
540
+ * Start sending one planned update, captured from its own snapshot.
541
+ *
542
+ * `subscription` becomes the base for the next update immediately: nothing else is sent until
543
+ * this update's last frame is, so the client can only apply later updates on top of it. An
544
+ * update within the frame limit is one frame; a larger one is chunked and as many chunks as
545
+ * flow control allows are sent now, the rest staged.
546
+ */
547
+ const startTranscriptUpdate = (state, input, limits, nowMs) => {
548
+ if (state.transfer !== void 0) throw new Error("A transcript update cannot start while another is being transferred");
549
+ if (input.update.updateSeq !== state.nextUpdateSeq) throw new Error("A transcript update must carry the socket's next update seq");
550
+ const updateSeq = input.update.updateSeq;
551
+ const advanced = {
552
+ ...state,
553
+ nextUpdateSeq: updateSeq + 1,
554
+ subscription: input.subscription
555
+ };
556
+ const single = edaTranscriptUpdateFrameText(state.nextFrameId, input.encodedUpdate);
557
+ if (utf8ByteLength(single) <= state.policy.maxFrameBytes) return {
558
+ _tag: "Sending",
559
+ ...sendFrames({
560
+ ...advanced,
561
+ completedUpdateSeq: updateSeq,
562
+ completedThroughSeq: input.update.throughSeq
563
+ }, [single], nowMs)
564
+ };
565
+ const bytes = utf8ByteLength(input.encodedUpdate);
566
+ if (bytes > limits.maxStagedBytes) return {
567
+ _tag: "TooLarge",
568
+ bytes
569
+ };
570
+ const chunks = splitEDATranscriptUpdate(input.encodedUpdate, state.policy.maxFrameBytes);
571
+ return {
572
+ _tag: "Sending",
573
+ ...pumpTranscriptTransfer({
574
+ ...advanced,
575
+ transfer: {
576
+ updateSeq,
577
+ throughSeq: input.update.throughSeq,
578
+ count: chunks.length,
579
+ nextIndex: 0
580
+ },
581
+ staged: chunks
582
+ }, nowMs)
583
+ };
584
+ };
585
+ /** Send staged chunks of the transfer in progress while flow control allows. */
586
+ const pumpTranscriptTransfer = (state, nowMs) => {
587
+ let next = state;
588
+ const frames = [];
589
+ while (next.transfer !== void 0 && transcriptDeliveryCapacity(next) > 0) {
590
+ const transfer = next.transfer;
591
+ const [data, ...rest] = next.staged;
592
+ if (data === void 0) break;
593
+ const text = edaTranscriptChunkFrameText({
594
+ frameId: next.nextFrameId,
595
+ updateSeq: transfer.updateSeq,
596
+ index: transfer.nextIndex,
597
+ count: transfer.count,
598
+ data
599
+ });
600
+ const nextIndex = transfer.nextIndex + 1;
601
+ const done = nextIndex === transfer.count;
602
+ const { transfer: _sent, ...withoutTransfer } = next;
603
+ const sent = sendFrames(done ? {
604
+ ...withoutTransfer,
605
+ staged: [],
606
+ completedUpdateSeq: transfer.updateSeq,
607
+ completedThroughSeq: transfer.throughSeq
608
+ } : {
609
+ ...next,
610
+ staged: rest,
611
+ transfer: {
612
+ ...transfer,
613
+ nextIndex
614
+ }
615
+ }, [text], nowMs);
616
+ next = sent.state;
617
+ frames.push(...sent.frames);
618
+ }
619
+ return {
620
+ state: next,
621
+ frames
622
+ };
623
+ };
624
+ const sendFrames = (state, texts, nowMs) => {
625
+ const inFlight = texts.map((_, index) => ({
626
+ frameId: state.nextFrameId + index,
627
+ sentAtMs: nowMs
628
+ }));
629
+ return {
630
+ state: {
631
+ ...state,
632
+ inFlight: [...state.inFlight, ...inFlight],
633
+ nextFrameId: state.nextFrameId + texts.length
634
+ },
635
+ frames: texts
636
+ };
637
+ };
638
+ /**
639
+ * Apply one ACK. The receipt frees flow-control capacity cumulatively; the applied cut may only
640
+ * name an update whose frames were all sent, and never moves backwards.
641
+ */
642
+ const onTranscriptAck = (state, ack) => {
643
+ const appliedUpdateSeq = ack.appliedUpdateSeq ?? state.appliedUpdateSeq;
644
+ const advancesApplied = appliedUpdateSeq > state.appliedUpdateSeq;
645
+ if (ack.frameId <= state.lastAckedFrameId) return advancesApplied ? {
646
+ _tag: "ProtocolError",
647
+ message: "Duplicate ACK attempted to advance the applied cut"
648
+ } : { _tag: "Ignored" };
649
+ if (ack.frameId >= state.nextFrameId) return {
650
+ _tag: "ProtocolError",
651
+ message: "ACK referenced an unsent frame"
652
+ };
653
+ if (appliedUpdateSeq < state.appliedUpdateSeq) return {
654
+ _tag: "ProtocolError",
655
+ message: "ACK applied cut moved backwards"
656
+ };
657
+ if (appliedUpdateSeq > state.completedUpdateSeq) return {
658
+ _tag: "ProtocolError",
659
+ message: "ACK applied an incomplete update"
660
+ };
661
+ if (advancesApplied && appliedUpdateSeq === state.completedUpdateSeq && ack.durableThroughSeq !== state.completedThroughSeq) return {
662
+ _tag: "ProtocolError",
663
+ message: "ACK applied cut names another update's seq"
664
+ };
665
+ return {
666
+ _tag: "Applied",
667
+ state: {
668
+ ...state,
669
+ lastAckedFrameId: ack.frameId,
670
+ inFlight: state.inFlight.filter((frame) => frame.frameId > ack.frameId),
671
+ appliedUpdateSeq,
672
+ appliedThroughSeq: advancesApplied ? SequenceNumber.make(ack.durableThroughSeq) : state.appliedThroughSeq
673
+ }
674
+ };
675
+ };
676
+ /** Queue one client request, or report that the client exceeded its request bound. */
677
+ const enqueueTranscriptRequest = (state, request, limits) => state.requests.length >= limits.maxPendingRequests ? void 0 : {
678
+ ...state,
679
+ requests: [...state.requests, request]
680
+ };
681
+ //#endregion
682
+ export { EDAFrameworkWebSocketEvent, EDATranscriptChunkFrame, EDATranscriptClientFrame, EDATranscriptDeliveryCheckpoint, EDATranscriptHelloFrame, EDATranscriptNegotiation, EDATranscriptPageFrame, EDATranscriptRequestFrame, EDATranscriptRetainFrame, EDATranscriptServerFrame, EDATranscriptSubscribeFrame, EDATranscriptTransfer, EDATranscriptUpdateFrame, EDAWebSocketAckFrame, EDAWebSocketClientFrame, EDAWebSocketDeliveryCheckpoint, EDAWebSocketErrorFrame, EDAWebSocketEventsFrame, EDAWebSocketFlowControl, EDAWebSocketHeartbeatFrame, EDAWebSocketHelloFrame, EDAWebSocketInFlightFrame, EDAWebSocketLaggedFrame, EDAWebSocketPingFrame, EDAWebSocketPongFrame, EDAWebSocketServerFrame, EDAWebSocketSuppressedRange, EDAWebSocketWireAckFrame, EDAWebSocketWireClientFrame, EDAWebSocketWireErrorFrame, EDAWebSocketWireFlowControl, EDAWebSocketWireHeartbeatFrame, EDAWebSocketWireHelloFrame, EDAWebSocketWireLaggedFrame, EDAWebSocketWirePingFrame, EDAWebSocketWirePongFrame, EDA_TRANSCRIPT_PROTOCOL_MAJOR, EDA_TRANSCRIPT_WIRE_VERSION, EDA_WEB_SOCKET_PING_MESSAGE, EDA_WEB_SOCKET_PONG_MESSAGE, EDA_WEB_SOCKET_PROTOCOL_VERSION, EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION, EDA_WS_CLOSE_GOING_AWAY, EDA_WS_CLOSE_LAGGED, EDA_WS_CLOSE_PROTOCOL_ERROR, EDA_WS_CLOSE_SEND_FAILED, EDA_WS_CLOSE_TRANSCRIPT_RESUBSCRIBE, EDA_WS_CLOSE_UNSUPPORTED_DATA, FrameId, SubscriberId, SubscriberLagReason, applyEDATranscriptServerMessage, checkpointTranscriptDelivery, checkpointWebSocketDeliveryState, decodeEDAWebSocketClientMessage, defaultEDATranscriptDeliveryLimits, defaultEDAWebSocketFlowControl, deliveryHelloFrame, edaFrameworkWebSocketWireProtocol, edaTranscriptChunkFrameText, edaTranscriptClientFromWindow, edaTranscriptClientReconnected, edaTranscriptNegotiation, edaTranscriptPageRequest, edaTranscriptRetainRequest, edaTranscriptSubscribeRequest, edaTranscriptUpdateFrameText, emptyEDATranscriptClientState, encodeEDATranscriptServerFrame, encodeEDATranscriptUpdate, encodeEDAWebSocketServerFrame, enqueueTranscriptRequest, laggedCloseReason, makeEDAWebSocketWireProtocol, makeTranscriptDeliveryState, makeWebSocketDeliveryState, negotiateEDATranscript, onClientAck, onDurableEvents, onEphemeralEvent, onHostSuppressedFrame, onTranscriptAck, pumpTranscriptTransfer, restoreTranscriptDeliveryState, restoreWebSocketDeliveryState, splitEDATranscriptUpdate, startTranscriptUpdate, transcriptAckTimedOut, transcriptDeliveryCapacity, utf8ByteLength };
683
+
684
+ //# sourceMappingURL=websocket.js.map