effect-durable-agent 0.1.0-alpha.4 → 0.1.0-alpha.6
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.
- package/README.md +19 -18
- package/dist/{command-queues-CV7O-51r.d.ts → command-queues-C8muEqeQ.d.ts} +2 -2
- package/dist/{compaction-zbvLREI8.d.ts → compaction-F4HEWzuI.d.ts} +5 -5
- package/dist/{context-projection-n6Rdup0N.d.ts → context-projection-C43pyxn2.d.ts} +2 -2
- package/dist/domain/command-queues.d.ts +1 -1
- package/dist/domain/context-projection.d.ts +1 -1
- package/dist/domain/message-transcript.d.ts +1 -1
- package/dist/domain/reduced-state.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{message-transcript-DiOPBY3l.d.ts → message-transcript-DsKTT47f.d.ts} +3 -3
- package/dist/{prompt-projector-C1IbkHr0.d.ts → prompt-projector-hqPh5-NI.d.ts} +4 -4
- package/dist/{reducer-registry-CjSJBPKo.d.ts → reducer-registry--vQFATXb.d.ts} +16 -6
- package/dist/{runtime-DOgmAKsO.d.ts → runtime-BO9KJq_Y.d.ts} +7 -5
- package/dist/services/compaction.d.ts +1 -1
- package/dist/services/prompt-projector.d.ts +1 -1
- package/dist/services/reducer-registry.d.ts +2 -2
- package/dist/services/reducer-registry.js +7 -3
- package/dist/services/reducer-registry.js.map +1 -1
- package/dist/services/runtime-layer.d.ts +12 -9
- package/dist/services/runtime-layer.js +6 -4
- package/dist/services/runtime-layer.js.map +1 -1
- package/dist/services/runtime.d.ts +1 -1
- package/dist/services/runtime.js +3 -2
- package/dist/services/runtime.js.map +1 -1
- package/dist/services/session-event-observer.d.ts +2 -0
- package/dist/services/session-event-observer.js +13 -0
- package/dist/services/session-event-observer.js.map +1 -0
- package/dist/services/session-query.d.ts +2 -2
- package/dist/services/session-query.js +20 -3
- package/dist/services/session-query.js.map +1 -1
- package/dist/services/session-state.d.ts +1 -1
- package/dist/services/session-state.js +1 -1
- package/dist/services/session-store.d.ts +1 -1
- package/dist/services/sink-checkpoint-store.d.ts +1 -1
- package/dist/services/sink-registry.d.ts +1 -1
- package/dist/services/sink-registry.js +1 -1
- package/dist/services/span-names.d.ts +1 -1
- package/dist/services/span-names.js +1 -0
- package/dist/services/span-names.js.map +1 -1
- package/dist/services/tool-registry.d.ts +1 -1
- package/dist/services/tracing.js +23 -2
- package/dist/services/tracing.js.map +1 -1
- package/dist/session-event-observer-D_aoFnQs.d.ts +24 -0
- package/dist/{session-query-C-C4m1eq.d.ts → session-query-_Z3Kw6jj.d.ts} +15 -8
- package/dist/{session-state-CjOSvWbe.d.ts → session-state-BfoXKafd.d.ts} +11 -11
- package/dist/{session-state-SStf0KUo.js → session-state-C4m0j6CJ.js} +2 -2
- package/dist/{session-state-SStf0KUo.js.map → session-state-C4m0j6CJ.js.map} +1 -1
- package/dist/{session-store-DZZUffUy.d.ts → session-store-ofm8FFxs.d.ts} +2 -2
- package/dist/{sink-checkpoint-store-BZmQFTRE.d.ts → sink-checkpoint-store-BQVbI9DQ.d.ts} +2 -2
- package/dist/{sink-registry-D13eUO_c.js → sink-registry-DH6uiEgP.js} +19 -21
- package/dist/sink-registry-DH6uiEgP.js.map +1 -0
- package/dist/{sink-registry-Cf79ICdW.d.ts → sink-registry-PRYbj6dp.d.ts} +18 -14
- package/dist/testkit/layers.d.ts +10 -10
- package/dist/testkit/layers.js +3 -3
- package/dist/testkit/layers.js.map +1 -1
- package/dist/{tool-registry-B7Wona6N.d.ts → tool-registry-ClHdr_G5.d.ts} +2 -2
- package/dist/{websocket-wire-QD2SquQE.d.ts → websocket.d.ts} +335 -12
- package/dist/websocket.js +428 -0
- package/dist/websocket.js.map +1 -0
- package/package.json +15 -31
- package/testing/offline-trace/README.md +2 -1
- package/CHANGELOG.md +0 -34
- package/CONTRIBUTING.md +0 -26
- package/SECURITY.md +0 -7
- package/dist/host/websocket-protocol.d.ts +0 -229
- package/dist/host/websocket-protocol.js +0 -99
- package/dist/host/websocket-protocol.js.map +0 -1
- package/dist/host/websocket-wire.d.ts +0 -2
- package/dist/host/websocket-wire.js +0 -105
- package/dist/host/websocket-wire.js.map +0 -1
- package/dist/services/websocket-subscriber.d.ts +0 -54
- package/dist/services/websocket-subscriber.js +0 -190
- package/dist/services/websocket-subscriber.js.map +0 -1
- package/dist/sink-registry-D13eUO_c.js.map +0 -1
- package/docs/assets/architecture.svg +0 -216
- package/docs/assets/event-sequence.svg +0 -133
- package/docs/assets/gcp-trace.png +0 -0
- package/docs/assets/hero.svg +0 -33
- package/docs/message-steering.md +0 -831
- package/docs/releasing.md +0 -114
- package/docs/spec.md +0 -777
- package/docs/subagents.md +0 -725
- package/docs/testing.md +0 -64
- package/docs/ui-projection.md +0 -742
- package/docs/websocket-protocol.md +0 -639
|
@@ -1,31 +1,54 @@
|
|
|
1
|
+
import { m as SequenceNumber } from "./core-CYT6DBaS.js";
|
|
1
2
|
import { a as PromotePendingMessageCommand, c as SubmitMessageCommand, o as ResumePendingMessagesCommand, s as StopTurnCommand, t as CancelPendingMessageCommand } from "./commands-Ce1ec6kH.js";
|
|
2
|
-
import { A as EventEnvelope } from "./events-Bb9-Cu-7.js";
|
|
3
|
+
import { A as EventEnvelope, L as PositionedEvent } from "./events-Bb9-Cu-7.js";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
3
5
|
import * as Schema from "effect/Schema";
|
|
4
6
|
|
|
5
|
-
//#region src/
|
|
7
|
+
//#region src/websocket/protocol.d.ts
|
|
6
8
|
/** Current EDA live-event WebSocket wire protocol version. */
|
|
7
9
|
declare const EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION: 1;
|
|
8
10
|
/** Flow-control policy announced by the server in the hello frame. */
|
|
9
11
|
declare const EDAWebSocketWireFlowControl: Schema.Struct<{
|
|
10
|
-
readonly ackTimeoutMs: Schema.Int;
|
|
12
|
+
readonly ackTimeoutMs: Schema.Int; /** Deprecated: servers no longer send heartbeat frames. Kept so deployed clients can decode hello. */
|
|
11
13
|
readonly heartbeatIntervalMs: Schema.Int;
|
|
12
14
|
readonly maxFrameBytes: Schema.Int;
|
|
13
15
|
readonly maxFrameEvents: Schema.Int;
|
|
14
|
-
readonly maxInFlightFrames: Schema.Int;
|
|
16
|
+
readonly maxInFlightFrames: Schema.Int; /** Suggested client-originated ping cadence; absent on servers that still send heartbeats. */
|
|
17
|
+
readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
|
|
15
18
|
readonly subscriberBufferCapacityEvents: Schema.Int;
|
|
16
19
|
}>;
|
|
17
20
|
type EDAWebSocketWireFlowControl = typeof EDAWebSocketWireFlowControl.Type;
|
|
21
|
+
/**
|
|
22
|
+
* Canonical client liveness ping message.
|
|
23
|
+
*
|
|
24
|
+
* The exact string matters: hibernation-capable hosts register it with
|
|
25
|
+
* WebSocket auto-response so the runtime answers without waking the object.
|
|
26
|
+
*/
|
|
27
|
+
declare const EDA_WEB_SOCKET_PING_MESSAGE = "{\"_tag\":\"ping\"}";
|
|
28
|
+
/** Canonical server pong message paired with {@link EDA_WEB_SOCKET_PING_MESSAGE}. */
|
|
29
|
+
declare const EDA_WEB_SOCKET_PONG_MESSAGE = "{\"_tag\":\"pong\"}";
|
|
30
|
+
/** Client liveness ping; hosts answer with a pong and never ACK-track it. */
|
|
31
|
+
declare const EDAWebSocketWirePingFrame: Schema.Struct<{
|
|
32
|
+
readonly _tag: Schema.Literal<"ping">;
|
|
33
|
+
}>;
|
|
34
|
+
type EDAWebSocketWirePingFrame = typeof EDAWebSocketWirePingFrame.Type;
|
|
35
|
+
/** Server liveness pong; clients may ignore it and must not ACK it. */
|
|
36
|
+
declare const EDAWebSocketWirePongFrame: Schema.Struct<{
|
|
37
|
+
readonly _tag: Schema.Literal<"pong">;
|
|
38
|
+
}>;
|
|
39
|
+
type EDAWebSocketWirePongFrame = typeof EDAWebSocketWirePongFrame.Type;
|
|
18
40
|
declare const EDAWebSocketWireHelloFrame: Schema.Struct<{
|
|
19
41
|
readonly _tag: Schema.Literal<"hello">;
|
|
20
42
|
readonly protocolVersion: Schema.Literal<1>;
|
|
21
43
|
readonly subscriberId: Schema.NonEmptyString;
|
|
22
44
|
readonly resumeSeq: Schema.Int;
|
|
23
45
|
readonly flowControl: Schema.Struct<{
|
|
24
|
-
readonly ackTimeoutMs: Schema.Int;
|
|
46
|
+
readonly ackTimeoutMs: Schema.Int; /** Deprecated: servers no longer send heartbeat frames. Kept so deployed clients can decode hello. */
|
|
25
47
|
readonly heartbeatIntervalMs: Schema.Int;
|
|
26
48
|
readonly maxFrameBytes: Schema.Int;
|
|
27
49
|
readonly maxFrameEvents: Schema.Int;
|
|
28
|
-
readonly maxInFlightFrames: Schema.Int;
|
|
50
|
+
readonly maxInFlightFrames: Schema.Int; /** Suggested client-originated ping cadence; absent on servers that still send heartbeats. */
|
|
51
|
+
readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
|
|
29
52
|
readonly subscriberBufferCapacityEvents: Schema.Int;
|
|
30
53
|
}>;
|
|
31
54
|
}>;
|
|
@@ -57,6 +80,8 @@ declare const EDAWebSocketWireClientFrame: Schema.Union<readonly [Schema.Struct<
|
|
|
57
80
|
readonly _tag: Schema.Literal<"ack">;
|
|
58
81
|
readonly frameId: Schema.Int;
|
|
59
82
|
readonly durableThroughSeq: Schema.Int;
|
|
83
|
+
}>, Schema.Struct<{
|
|
84
|
+
readonly _tag: Schema.Literal<"ping">;
|
|
60
85
|
}>]>;
|
|
61
86
|
type EDAWebSocketWireClientFrame = typeof EDAWebSocketWireClientFrame.Type;
|
|
62
87
|
/** Exhaustive decision table for a concrete WebSocket event union. */
|
|
@@ -2005,11 +2030,12 @@ declare const makeEDAWebSocketDomainSchemas: <EventSchema extends Schema.Codec<E
|
|
|
2005
2030
|
readonly subscriberId: Schema.NonEmptyString;
|
|
2006
2031
|
readonly resumeSeq: Schema.Int;
|
|
2007
2032
|
readonly flowControl: Schema.Struct<{
|
|
2008
|
-
readonly ackTimeoutMs: Schema.Int;
|
|
2033
|
+
readonly ackTimeoutMs: Schema.Int; /** Deprecated: servers no longer send heartbeat frames. Kept so deployed clients can decode hello. */
|
|
2009
2034
|
readonly heartbeatIntervalMs: Schema.Int;
|
|
2010
2035
|
readonly maxFrameBytes: Schema.Int;
|
|
2011
2036
|
readonly maxFrameEvents: Schema.Int;
|
|
2012
|
-
readonly maxInFlightFrames: Schema.Int;
|
|
2037
|
+
readonly maxInFlightFrames: Schema.Int; /** Suggested client-originated ping cadence; absent on servers that still send heartbeats. */
|
|
2038
|
+
readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
|
|
2013
2039
|
readonly subscriberBufferCapacityEvents: Schema.Int;
|
|
2014
2040
|
}>;
|
|
2015
2041
|
}>, Schema.Struct<{
|
|
@@ -2027,6 +2053,8 @@ declare const makeEDAWebSocketDomainSchemas: <EventSchema extends Schema.Codec<E
|
|
|
2027
2053
|
readonly _tag: Schema.Literal<"heartbeat">;
|
|
2028
2054
|
readonly serverTimeMs: Schema.Int;
|
|
2029
2055
|
readonly durableThroughSeq: Schema.Int;
|
|
2056
|
+
}>, Schema.Struct<{
|
|
2057
|
+
readonly _tag: Schema.Literal<"pong">;
|
|
2030
2058
|
}>, Schema.Struct<{
|
|
2031
2059
|
readonly _tag: Schema.Literal<"lagged">;
|
|
2032
2060
|
readonly resumeSeq: Schema.Int;
|
|
@@ -2145,11 +2173,12 @@ declare const EDAWebSocketHostDomain: {
|
|
|
2145
2173
|
readonly subscriberId: Schema.NonEmptyString;
|
|
2146
2174
|
readonly resumeSeq: Schema.Int;
|
|
2147
2175
|
readonly flowControl: Schema.Struct<{
|
|
2148
|
-
readonly ackTimeoutMs: Schema.Int;
|
|
2176
|
+
readonly ackTimeoutMs: Schema.Int; /** Deprecated: servers no longer send heartbeat frames. Kept so deployed clients can decode hello. */
|
|
2149
2177
|
readonly heartbeatIntervalMs: Schema.Int;
|
|
2150
2178
|
readonly maxFrameBytes: Schema.Int;
|
|
2151
2179
|
readonly maxFrameEvents: Schema.Int;
|
|
2152
|
-
readonly maxInFlightFrames: Schema.Int;
|
|
2180
|
+
readonly maxInFlightFrames: Schema.Int; /** Suggested client-originated ping cadence; absent on servers that still send heartbeats. */
|
|
2181
|
+
readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
|
|
2153
2182
|
readonly subscriberBufferCapacityEvents: Schema.Int;
|
|
2154
2183
|
}>;
|
|
2155
2184
|
}>, Schema.Struct<{
|
|
@@ -2194,6 +2223,8 @@ declare const EDAWebSocketHostDomain: {
|
|
|
2194
2223
|
readonly _tag: Schema.Literal<"heartbeat">;
|
|
2195
2224
|
readonly serverTimeMs: Schema.Int;
|
|
2196
2225
|
readonly durableThroughSeq: Schema.Int;
|
|
2226
|
+
}>, Schema.Struct<{
|
|
2227
|
+
readonly _tag: Schema.Literal<"pong">;
|
|
2197
2228
|
}>, Schema.Struct<{
|
|
2198
2229
|
readonly _tag: Schema.Literal<"lagged">;
|
|
2199
2230
|
readonly resumeSeq: Schema.Int;
|
|
@@ -2240,5 +2271,297 @@ declare const makeEDAWebSocketWireProtocol: <AppEventSchema extends Schema.Codec
|
|
|
2240
2271
|
readonly appEvents: AppEventSchema;
|
|
2241
2272
|
}) => EDAWebSocketWireProtocol<Schema.Union<readonly [typeof EDAFrameworkWebSocketEvent, AppEventSchema]>>;
|
|
2242
2273
|
//#endregion
|
|
2243
|
-
|
|
2244
|
-
|
|
2274
|
+
//#region src/websocket/messages.d.ts
|
|
2275
|
+
/** Current EDA live-event WebSocket protocol version. */
|
|
2276
|
+
declare const EDA_WEB_SOCKET_PROTOCOL_VERSION: 1;
|
|
2277
|
+
/** WebSocket close code used when a subscriber cannot keep up with live delivery. */
|
|
2278
|
+
declare const EDA_WS_CLOSE_LAGGED = 4008;
|
|
2279
|
+
/** WebSocket close code used for normal host-driven shutdown. */
|
|
2280
|
+
declare const EDA_WS_CLOSE_GOING_AWAY = 1001;
|
|
2281
|
+
/** WebSocket close code used for malformed client protocol messages. */
|
|
2282
|
+
declare const EDA_WS_CLOSE_PROTOCOL_ERROR = 1002;
|
|
2283
|
+
/** WebSocket close code used when the host cannot send a frame. */
|
|
2284
|
+
declare const EDA_WS_CLOSE_SEND_FAILED = 1011;
|
|
2285
|
+
/** WebSocket close code used for unsupported binary messages. */
|
|
2286
|
+
declare const EDA_WS_CLOSE_UNSUPPORTED_DATA = 1003;
|
|
2287
|
+
/** Live subscriber identity persisted in WebSocket attachments. */
|
|
2288
|
+
declare const SubscriberId: Schema.brand<Schema.NonEmptyString, "SubscriberId">;
|
|
2289
|
+
type SubscriberId = typeof SubscriberId.Type;
|
|
2290
|
+
/** Per-connection monotonically increasing server frame id. */
|
|
2291
|
+
declare const FrameId: Schema.brand<Schema.Int, "FrameId">;
|
|
2292
|
+
type FrameId = typeof FrameId.Type;
|
|
2293
|
+
/** Flow-control policy announced by the server in the hello frame. */
|
|
2294
|
+
declare const EDAWebSocketFlowControl: Schema.Struct<{
|
|
2295
|
+
readonly ackTimeoutMs: Schema.Int;
|
|
2296
|
+
readonly heartbeatIntervalMs: Schema.Int;
|
|
2297
|
+
readonly maxFrameBytes: Schema.Int;
|
|
2298
|
+
readonly maxFrameEvents: Schema.Int;
|
|
2299
|
+
readonly maxInFlightFrames: Schema.Int;
|
|
2300
|
+
readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
|
|
2301
|
+
readonly subscriberBufferCapacityEvents: Schema.Int;
|
|
2302
|
+
}>;
|
|
2303
|
+
type EDAWebSocketFlowControl = typeof EDAWebSocketFlowControl.Type;
|
|
2304
|
+
/** Default bounded policy sized for fast model deltas and large durable tool/message events. */
|
|
2305
|
+
declare const defaultEDAWebSocketFlowControl: EDAWebSocketFlowControl;
|
|
2306
|
+
/** First server frame; announces protocol and flow-control policy. */
|
|
2307
|
+
declare const EDAWebSocketHelloFrame: Schema.Struct<{
|
|
2308
|
+
readonly subscriberId: Schema.brand<Schema.NonEmptyString, "SubscriberId">;
|
|
2309
|
+
readonly resumeSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2310
|
+
readonly _tag: Schema.Literal<"hello">;
|
|
2311
|
+
readonly protocolVersion: Schema.Literal<1>;
|
|
2312
|
+
readonly flowControl: Schema.Struct<{
|
|
2313
|
+
readonly ackTimeoutMs: Schema.Int;
|
|
2314
|
+
readonly heartbeatIntervalMs: Schema.Int;
|
|
2315
|
+
readonly maxFrameBytes: Schema.Int;
|
|
2316
|
+
readonly maxFrameEvents: Schema.Int;
|
|
2317
|
+
readonly maxInFlightFrames: Schema.Int;
|
|
2318
|
+
readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
|
|
2319
|
+
readonly subscriberBufferCapacityEvents: Schema.Int;
|
|
2320
|
+
}>;
|
|
2321
|
+
}>;
|
|
2322
|
+
type EDAWebSocketHelloFrame = typeof EDAWebSocketHelloFrame.Type;
|
|
2323
|
+
/** Ordered positioned events delivered to the client. */
|
|
2324
|
+
declare const EDAWebSocketEventsFrame: Schema.Struct<{
|
|
2325
|
+
readonly _tag: Schema.Literal<"events">;
|
|
2326
|
+
readonly frameId: Schema.brand<Schema.Int, "FrameId">;
|
|
2327
|
+
readonly events: Schema.NonEmptyArray<Schema.Struct<{
|
|
2328
|
+
readonly position: Schema.Struct<{
|
|
2329
|
+
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2330
|
+
readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
|
|
2331
|
+
}>;
|
|
2332
|
+
readonly event: Schema.Struct<{
|
|
2333
|
+
readonly namespace: Schema.NonEmptyString;
|
|
2334
|
+
readonly type: Schema.NonEmptyString;
|
|
2335
|
+
readonly schemaVersion: Schema.Int;
|
|
2336
|
+
readonly durability: Schema.Literals<readonly ["durable", "ephemeral"]>;
|
|
2337
|
+
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
2338
|
+
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
2339
|
+
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
2340
|
+
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
2341
|
+
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
2342
|
+
readonly span: Schema.Struct<{
|
|
2343
|
+
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
2344
|
+
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
2345
|
+
readonly sampled: Schema.Boolean;
|
|
2346
|
+
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
2347
|
+
}>;
|
|
2348
|
+
readonly links: Schema.$Array<Schema.Struct<{
|
|
2349
|
+
readonly context: Schema.Struct<{
|
|
2350
|
+
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
2351
|
+
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
2352
|
+
readonly sampled: Schema.Boolean;
|
|
2353
|
+
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
2354
|
+
}>;
|
|
2355
|
+
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
2356
|
+
}>>;
|
|
2357
|
+
}>>;
|
|
2358
|
+
readonly payload: Schema.Unknown;
|
|
2359
|
+
}>;
|
|
2360
|
+
}>>;
|
|
2361
|
+
readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2362
|
+
}>;
|
|
2363
|
+
type EDAWebSocketEventsFrame = typeof EDAWebSocketEventsFrame.Type;
|
|
2364
|
+
/**
|
|
2365
|
+
* Deprecated idle server keepalive frame.
|
|
2366
|
+
*
|
|
2367
|
+
* Servers no longer send heartbeats; the schema remains so deployed clients
|
|
2368
|
+
* keep decoding the server frame union. Liveness is client-originated via
|
|
2369
|
+
* {@link EDAWebSocketPingFrame} and the host-level auto-response pong.
|
|
2370
|
+
*/
|
|
2371
|
+
declare const EDAWebSocketHeartbeatFrame: Schema.Struct<{
|
|
2372
|
+
readonly serverTimeMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
2373
|
+
readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2374
|
+
readonly _tag: Schema.Literal<"heartbeat">;
|
|
2375
|
+
}>;
|
|
2376
|
+
type EDAWebSocketHeartbeatFrame = typeof EDAWebSocketHeartbeatFrame.Type;
|
|
2377
|
+
/** Client liveness ping; hosts answer with a pong and never ACK-track it. */
|
|
2378
|
+
declare const EDAWebSocketPingFrame: Schema.Struct<{
|
|
2379
|
+
readonly _tag: Schema.Literal<"ping">;
|
|
2380
|
+
}>;
|
|
2381
|
+
type EDAWebSocketPingFrame = typeof EDAWebSocketPingFrame.Type;
|
|
2382
|
+
/** Server liveness pong; clients may ignore it and must not ACK it. */
|
|
2383
|
+
declare const EDAWebSocketPongFrame: Schema.Struct<{
|
|
2384
|
+
readonly _tag: Schema.Literal<"pong">;
|
|
2385
|
+
}>;
|
|
2386
|
+
type EDAWebSocketPongFrame = typeof EDAWebSocketPongFrame.Type;
|
|
2387
|
+
/** Optional final frame sent before a lag-close. */
|
|
2388
|
+
declare const EDAWebSocketLaggedFrame: Schema.Struct<{
|
|
2389
|
+
readonly resumeSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2390
|
+
readonly _tag: Schema.Literal<"lagged">;
|
|
2391
|
+
readonly reason: Schema.Literals<readonly ["buffer-overflow", "ack-timeout"]>;
|
|
2392
|
+
}>;
|
|
2393
|
+
type EDAWebSocketLaggedFrame = typeof EDAWebSocketLaggedFrame.Type;
|
|
2394
|
+
/** Optional final frame sent before a protocol/internal close. */
|
|
2395
|
+
declare const EDAWebSocketErrorFrame: Schema.Struct<{
|
|
2396
|
+
readonly _tag: Schema.Literal<"error">;
|
|
2397
|
+
readonly message: Schema.String;
|
|
2398
|
+
}>;
|
|
2399
|
+
type EDAWebSocketErrorFrame = typeof EDAWebSocketErrorFrame.Type;
|
|
2400
|
+
/** Server-to-client application frame union. */
|
|
2401
|
+
declare const EDAWebSocketServerFrame: Schema.Union<readonly [Schema.Struct<{
|
|
2402
|
+
readonly subscriberId: Schema.brand<Schema.NonEmptyString, "SubscriberId">;
|
|
2403
|
+
readonly resumeSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2404
|
+
readonly _tag: Schema.Literal<"hello">;
|
|
2405
|
+
readonly protocolVersion: Schema.Literal<1>;
|
|
2406
|
+
readonly flowControl: Schema.Struct<{
|
|
2407
|
+
readonly ackTimeoutMs: Schema.Int;
|
|
2408
|
+
readonly heartbeatIntervalMs: Schema.Int;
|
|
2409
|
+
readonly maxFrameBytes: Schema.Int;
|
|
2410
|
+
readonly maxFrameEvents: Schema.Int;
|
|
2411
|
+
readonly maxInFlightFrames: Schema.Int;
|
|
2412
|
+
readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
|
|
2413
|
+
readonly subscriberBufferCapacityEvents: Schema.Int;
|
|
2414
|
+
}>;
|
|
2415
|
+
}>, Schema.Struct<{
|
|
2416
|
+
readonly _tag: Schema.Literal<"events">;
|
|
2417
|
+
readonly frameId: Schema.brand<Schema.Int, "FrameId">;
|
|
2418
|
+
readonly events: Schema.NonEmptyArray<Schema.Struct<{
|
|
2419
|
+
readonly position: Schema.Struct<{
|
|
2420
|
+
readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2421
|
+
readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
|
|
2422
|
+
}>;
|
|
2423
|
+
readonly event: Schema.Struct<{
|
|
2424
|
+
readonly namespace: Schema.NonEmptyString;
|
|
2425
|
+
readonly type: Schema.NonEmptyString;
|
|
2426
|
+
readonly schemaVersion: Schema.Int;
|
|
2427
|
+
readonly durability: Schema.Literals<readonly ["durable", "ephemeral"]>;
|
|
2428
|
+
readonly eventId: Schema.brand<Schema.String, "EventId">;
|
|
2429
|
+
readonly sessionId: Schema.brand<Schema.String, "SessionId">;
|
|
2430
|
+
readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
|
|
2431
|
+
readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
2432
|
+
readonly trace: Schema.withConstructorDefault<Schema.Struct<{
|
|
2433
|
+
readonly span: Schema.Struct<{
|
|
2434
|
+
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
2435
|
+
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
2436
|
+
readonly sampled: Schema.Boolean;
|
|
2437
|
+
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
2438
|
+
}>;
|
|
2439
|
+
readonly links: Schema.$Array<Schema.Struct<{
|
|
2440
|
+
readonly context: Schema.Struct<{
|
|
2441
|
+
readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
|
|
2442
|
+
readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
|
|
2443
|
+
readonly sampled: Schema.Boolean;
|
|
2444
|
+
readonly tracestate: Schema.NullOr<Schema.String>;
|
|
2445
|
+
}>;
|
|
2446
|
+
readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
|
|
2447
|
+
}>>;
|
|
2448
|
+
}>>;
|
|
2449
|
+
readonly payload: Schema.Unknown;
|
|
2450
|
+
}>;
|
|
2451
|
+
}>>;
|
|
2452
|
+
readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2453
|
+
}>, Schema.Struct<{
|
|
2454
|
+
readonly serverTimeMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
|
|
2455
|
+
readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2456
|
+
readonly _tag: Schema.Literal<"heartbeat">;
|
|
2457
|
+
}>, Schema.Struct<{
|
|
2458
|
+
readonly _tag: Schema.Literal<"pong">;
|
|
2459
|
+
}>, Schema.Struct<{
|
|
2460
|
+
readonly resumeSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2461
|
+
readonly _tag: Schema.Literal<"lagged">;
|
|
2462
|
+
readonly reason: Schema.Literals<readonly ["buffer-overflow", "ack-timeout"]>;
|
|
2463
|
+
}>, Schema.Struct<{
|
|
2464
|
+
readonly _tag: Schema.Literal<"error">;
|
|
2465
|
+
readonly message: Schema.String;
|
|
2466
|
+
}>]>;
|
|
2467
|
+
type EDAWebSocketServerFrame = typeof EDAWebSocketServerFrame.Type;
|
|
2468
|
+
/** Client acknowledgement after applying a server frame. */
|
|
2469
|
+
declare const EDAWebSocketAckFrame: Schema.Struct<{
|
|
2470
|
+
readonly frameId: Schema.brand<Schema.Int, "FrameId">;
|
|
2471
|
+
readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2472
|
+
readonly _tag: Schema.Literal<"ack">;
|
|
2473
|
+
}>;
|
|
2474
|
+
type EDAWebSocketAckFrame = typeof EDAWebSocketAckFrame.Type;
|
|
2475
|
+
/** Client-to-server application frame union. */
|
|
2476
|
+
declare const EDAWebSocketClientFrame: Schema.Union<readonly [Schema.Struct<{
|
|
2477
|
+
readonly frameId: Schema.brand<Schema.Int, "FrameId">;
|
|
2478
|
+
readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2479
|
+
readonly _tag: Schema.Literal<"ack">;
|
|
2480
|
+
}>, Schema.Struct<{
|
|
2481
|
+
readonly _tag: Schema.Literal<"ping">;
|
|
2482
|
+
}>]>;
|
|
2483
|
+
type EDAWebSocketClientFrame = typeof EDAWebSocketClientFrame.Type;
|
|
2484
|
+
/** Serialize a server frame for a text WebSocket message. */
|
|
2485
|
+
declare const encodeEDAWebSocketServerFrame: (frame: EDAWebSocketServerFrame, protocol?: EDAWebSocketServerFrameEncoder) => string;
|
|
2486
|
+
/** Decode an inbound text WebSocket message at the host boundary. */
|
|
2487
|
+
declare const decodeEDAWebSocketClientMessage: (input: string) => Effect.Effect<EDAWebSocketClientFrame, unknown>;
|
|
2488
|
+
/** Short close reason that fits the WebSocket protocol reason limit. */
|
|
2489
|
+
declare const laggedCloseReason: (seq: SequenceNumber) => string;
|
|
2490
|
+
//#endregion
|
|
2491
|
+
//#region src/websocket/delivery.d.ts
|
|
2492
|
+
/** Slow subscriber reasons that intentionally close only the lagging socket. */
|
|
2493
|
+
declare const SubscriberLagReason: Schema.Literals<readonly ["buffer-overflow", "ack-timeout"]>;
|
|
2494
|
+
type SubscriberLagReason = typeof SubscriberLagReason.Type;
|
|
2495
|
+
/** One sent-but-unacknowledged events frame. */
|
|
2496
|
+
declare const EDAWebSocketInFlightFrame: Schema.Struct<{
|
|
2497
|
+
readonly frameId: Schema.brand<Schema.Int, "FrameId">;
|
|
2498
|
+
readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2499
|
+
readonly sentAtMs: Schema.Number;
|
|
2500
|
+
}>;
|
|
2501
|
+
type EDAWebSocketInFlightFrame = typeof EDAWebSocketInFlightFrame.Type;
|
|
2502
|
+
/** Complete delivery bookkeeping persisted in the WebSocket attachment. */
|
|
2503
|
+
declare const EDAWebSocketDeliveryCheckpoint: Schema.Struct<{
|
|
2504
|
+
readonly lastAckedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2505
|
+
readonly lastAckedFrameId: Schema.Int;
|
|
2506
|
+
readonly lastSentFrameId: Schema.Int;
|
|
2507
|
+
readonly nextFrameId: Schema.Int;
|
|
2508
|
+
readonly sentDurableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2509
|
+
readonly inFlight: Schema.$Array<Schema.Struct<{
|
|
2510
|
+
readonly frameId: Schema.brand<Schema.Int, "FrameId">;
|
|
2511
|
+
readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
|
|
2512
|
+
readonly sentAtMs: Schema.Number;
|
|
2513
|
+
}>>;
|
|
2514
|
+
}>;
|
|
2515
|
+
type EDAWebSocketDeliveryCheckpoint = typeof EDAWebSocketDeliveryCheckpoint.Type;
|
|
2516
|
+
/** In-memory delivery state for one accepted event WebSocket. */
|
|
2517
|
+
interface EDAWebSocketDeliveryState extends EDAWebSocketDeliveryCheckpoint {
|
|
2518
|
+
readonly subscriberId: SubscriberId;
|
|
2519
|
+
readonly policy: EDAWebSocketFlowControl;
|
|
2520
|
+
/** Ephemeral events are live-only and intentionally absent from the attachment. */
|
|
2521
|
+
readonly pendingEphemeral: ReadonlyArray<PositionedEvent>;
|
|
2522
|
+
}
|
|
2523
|
+
/** Explicit instructions emitted by the pure delivery state machine. */
|
|
2524
|
+
type EDAWebSocketDeliveryAction = {
|
|
2525
|
+
readonly _tag: "Persist";
|
|
2526
|
+
} | {
|
|
2527
|
+
readonly _tag: "Send";
|
|
2528
|
+
readonly frames: ReadonlyArray<EDAWebSocketServerFrame>;
|
|
2529
|
+
} | {
|
|
2530
|
+
readonly _tag: "ReadEventPage";
|
|
2531
|
+
readonly afterSeq: SequenceNumber;
|
|
2532
|
+
} | {
|
|
2533
|
+
readonly _tag: "Close";
|
|
2534
|
+
readonly code: number;
|
|
2535
|
+
readonly reason: string;
|
|
2536
|
+
};
|
|
2537
|
+
/** Result of one pure delivery transition. */
|
|
2538
|
+
interface EDAWebSocketDeliveryResult {
|
|
2539
|
+
readonly state: EDAWebSocketDeliveryState;
|
|
2540
|
+
readonly actions: ReadonlyArray<EDAWebSocketDeliveryAction>;
|
|
2541
|
+
}
|
|
2542
|
+
interface MakeDeliveryStateInput {
|
|
2543
|
+
readonly subscriberId: SubscriberId;
|
|
2544
|
+
readonly resumeSeq: SequenceNumber;
|
|
2545
|
+
readonly policy: EDAWebSocketFlowControl;
|
|
2546
|
+
}
|
|
2547
|
+
/** Build delivery state for a newly accepted connection. */
|
|
2548
|
+
declare const makeWebSocketDeliveryState: (input: MakeDeliveryStateInput) => EDAWebSocketDeliveryState;
|
|
2549
|
+
/** Rebuild exact ACK bookkeeping from a hibernating WebSocket attachment. */
|
|
2550
|
+
declare const restoreWebSocketDeliveryState: (input: {
|
|
2551
|
+
readonly subscriberId: SubscriberId;
|
|
2552
|
+
readonly policy: EDAWebSocketFlowControl;
|
|
2553
|
+
readonly checkpoint: EDAWebSocketDeliveryCheckpoint;
|
|
2554
|
+
}) => EDAWebSocketDeliveryState;
|
|
2555
|
+
/** Project in-memory delivery state into the attachment-safe checkpoint. */
|
|
2556
|
+
declare const checkpointWebSocketDeliveryState: (state: EDAWebSocketDeliveryState) => EDAWebSocketDeliveryCheckpoint;
|
|
2557
|
+
/** First frame for a freshly accepted connection. Restores never re-send hello. */
|
|
2558
|
+
declare const deliveryHelloFrame: (state: EDAWebSocketDeliveryState) => EDAWebSocketHelloFrame;
|
|
2559
|
+
/** Deliver committed durable events read from the store. */
|
|
2560
|
+
declare const onDurableEvents: (state: EDAWebSocketDeliveryState, events: ReadonlyArray<PositionedEvent>, head: SequenceNumber, nowMs: number) => EDAWebSocketDeliveryResult;
|
|
2561
|
+
/** Deliver one live ephemeral event, buffering only while this isolate is active. */
|
|
2562
|
+
declare const onEphemeralEvent: (state: EDAWebSocketDeliveryState, event: PositionedEvent, nowMs: number) => EDAWebSocketDeliveryResult;
|
|
2563
|
+
/** Apply one client ACK, reopen the window, and drain buffered ephemeral events. */
|
|
2564
|
+
declare const onClientAck: (state: EDAWebSocketDeliveryState, ack: EDAWebSocketAckFrame, nowMs: number) => EDAWebSocketDeliveryResult;
|
|
2565
|
+
//#endregion
|
|
2566
|
+
export { EDAFrameworkWebSocketEvent, EDAWebSocketAckFrame, EDAWebSocketClientFrame, EDAWebSocketDeliveryAction, EDAWebSocketDeliveryCheckpoint, EDAWebSocketDeliveryResult, EDAWebSocketDeliveryState, EDAWebSocketErrorFrame, EDAWebSocketEventConsumerPolicy, EDAWebSocketEventsFrame, EDAWebSocketFlowControl, EDAWebSocketHeartbeatFrame, EDAWebSocketHelloFrame, EDAWebSocketInFlightFrame, EDAWebSocketLaggedFrame, EDAWebSocketPingFrame, EDAWebSocketPongFrame, EDAWebSocketServerFrame, 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_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_UNSUPPORTED_DATA, FrameId, MakeDeliveryStateInput, SubscriberId, SubscriberLagReason, checkpointWebSocketDeliveryState, decodeEDAWebSocketClientMessage, defaultEDAWebSocketFlowControl, deliveryHelloFrame, edaFrameworkWebSocketWireProtocol, encodeEDAWebSocketServerFrame, laggedCloseReason, makeEDAWebSocketWireProtocol, makeWebSocketDeliveryState, onClientAck, onDurableEvents, onEphemeralEvent, restoreWebSocketDeliveryState };
|
|
2567
|
+
//# sourceMappingURL=websocket.d.ts.map
|