effect-durable-agent 0.1.0-alpha.24 → 0.1.0-alpha.25

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.
@@ -0,0 +1,2990 @@
1
+ import { c as StopTurnCommand, l as SubmitMessageCommand, o as PromotePendingMessageCommand, s as ResumePendingMessagesCommand, t as CancelPendingMessageCommand } from "./commands-3OD-p8dD.js";
2
+ import { h as SequenceNumber } from "./core-BcimKMIv.js";
3
+ import { f as PositionedEvent, i as EventEnvelope } from "./envelope-Che6KatU.js";
4
+ import "./events-BWuvzVml.js";
5
+ import "./reduced-state-B5WxKSM5.js";
6
+ import * as Effect from "effect/Effect";
7
+ import * as Schema from "effect/Schema";
8
+ //#region src/websocket/protocol.d.ts
9
+ /** Current EDA live-event WebSocket wire protocol version. */
10
+ declare const EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION: 1;
11
+ /** Flow-control policy announced by the server in the hello frame. */
12
+ declare const EDAWebSocketWireFlowControl: Schema.Struct<{
13
+ readonly ackTimeoutMs: Schema.Int;
14
+ /** Deprecated: servers no longer send heartbeat frames. Kept so deployed clients can decode hello. */
15
+ readonly heartbeatIntervalMs: Schema.Int;
16
+ readonly maxFrameBytes: Schema.Int;
17
+ readonly maxFrameEvents: Schema.Int;
18
+ readonly maxInFlightFrames: Schema.Int;
19
+ /** Suggested client-originated ping cadence; absent on servers that still send heartbeats. */
20
+ readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
21
+ readonly subscriberBufferCapacityEvents: Schema.Int;
22
+ }>;
23
+ type EDAWebSocketWireFlowControl = typeof EDAWebSocketWireFlowControl.Type;
24
+ /**
25
+ * Canonical client liveness ping message.
26
+ *
27
+ * The exact string matters: hibernation-capable hosts register it with
28
+ * WebSocket auto-response so the runtime answers without waking the object.
29
+ */
30
+ declare const EDA_WEB_SOCKET_PING_MESSAGE = "{\"_tag\":\"ping\"}";
31
+ /** Canonical server pong message paired with {@link EDA_WEB_SOCKET_PING_MESSAGE}. */
32
+ declare const EDA_WEB_SOCKET_PONG_MESSAGE = "{\"_tag\":\"pong\"}";
33
+ /** Client liveness ping; hosts answer with a pong and never ACK-track it. */
34
+ declare const EDAWebSocketWirePingFrame: Schema.Struct<{
35
+ readonly _tag: Schema.Literal<"ping">;
36
+ }>;
37
+ type EDAWebSocketWirePingFrame = typeof EDAWebSocketWirePingFrame.Type;
38
+ /** Server liveness pong; clients may ignore it and must not ACK it. */
39
+ declare const EDAWebSocketWirePongFrame: Schema.Struct<{
40
+ readonly _tag: Schema.Literal<"pong">;
41
+ }>;
42
+ type EDAWebSocketWirePongFrame = typeof EDAWebSocketWirePongFrame.Type;
43
+ declare const EDAWebSocketWireHelloFrame: Schema.Struct<{
44
+ readonly _tag: Schema.Literal<"hello">;
45
+ readonly protocolVersion: Schema.Literal<1>;
46
+ readonly subscriberId: Schema.NonEmptyString;
47
+ readonly resumeSeq: Schema.Int;
48
+ readonly flowControl: Schema.Struct<{
49
+ readonly ackTimeoutMs: Schema.Int;
50
+ /** Deprecated: servers no longer send heartbeat frames. Kept so deployed clients can decode hello. */
51
+ readonly heartbeatIntervalMs: Schema.Int;
52
+ readonly maxFrameBytes: Schema.Int;
53
+ readonly maxFrameEvents: Schema.Int;
54
+ readonly maxInFlightFrames: Schema.Int;
55
+ /** Suggested client-originated ping cadence; absent on servers that still send heartbeats. */
56
+ readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
57
+ readonly subscriberBufferCapacityEvents: Schema.Int;
58
+ }>;
59
+ }>;
60
+ type EDAWebSocketWireHelloFrame = typeof EDAWebSocketWireHelloFrame.Type;
61
+ declare const EDAWebSocketWireHeartbeatFrame: Schema.Struct<{
62
+ readonly _tag: Schema.Literal<"heartbeat">;
63
+ readonly serverTimeMs: Schema.Int;
64
+ readonly durableThroughSeq: Schema.Int;
65
+ }>;
66
+ type EDAWebSocketWireHeartbeatFrame = typeof EDAWebSocketWireHeartbeatFrame.Type;
67
+ declare const EDAWebSocketWireLaggedFrame: Schema.Struct<{
68
+ readonly _tag: Schema.Literal<"lagged">;
69
+ readonly resumeSeq: Schema.Int;
70
+ readonly reason: Schema.Literals<readonly ["buffer-overflow", "ack-timeout"]>;
71
+ }>;
72
+ type EDAWebSocketWireLaggedFrame = typeof EDAWebSocketWireLaggedFrame.Type;
73
+ declare const EDAWebSocketWireErrorFrame: Schema.Struct<{
74
+ readonly _tag: Schema.Literal<"error">;
75
+ readonly message: Schema.String;
76
+ }>;
77
+ type EDAWebSocketWireErrorFrame = typeof EDAWebSocketWireErrorFrame.Type;
78
+ /**
79
+ * Client acknowledgement. `frameId` is the transport receipt: it cumulatively frees flow-control
80
+ * capacity. On a transcript socket `appliedUpdateSeq` is the client's applied cut, the last
81
+ * transcript update it applied completely, and `durableThroughSeq` is that update's
82
+ * `throughSeq`; both advance only on complete updates, never on a partial chunked transfer.
83
+ * Raw event sockets ignore `appliedUpdateSeq`.
84
+ */
85
+ declare const EDAWebSocketWireAckFrame: Schema.Struct<{
86
+ readonly _tag: Schema.Literal<"ack">;
87
+ readonly frameId: Schema.Int;
88
+ readonly durableThroughSeq: Schema.Int;
89
+ readonly appliedUpdateSeq: Schema.optionalKey<Schema.Int>;
90
+ }>;
91
+ type EDAWebSocketWireAckFrame = typeof EDAWebSocketWireAckFrame.Type;
92
+ declare const EDAWebSocketWireClientFrame: Schema.Union<readonly [Schema.Struct<{
93
+ readonly _tag: Schema.Literal<"ack">;
94
+ readonly frameId: Schema.Int;
95
+ readonly durableThroughSeq: Schema.Int;
96
+ readonly appliedUpdateSeq: Schema.optionalKey<Schema.Int>;
97
+ }>, Schema.Struct<{
98
+ readonly _tag: Schema.Literal<"ping">;
99
+ }>]>;
100
+ type EDAWebSocketWireClientFrame = typeof EDAWebSocketWireClientFrame.Type;
101
+ /** Exhaustive decision table for a concrete WebSocket event union. */
102
+ type EDAWebSocketEventConsumerPolicy<Event extends {
103
+ readonly type: string;
104
+ }, Disposition> = Readonly<Record<Event["type"], Disposition>>;
105
+ /** Complete framework-owned event union present on every EDA WebSocket. */
106
+ declare const EDAFrameworkWebSocketEvent: Schema.Union<readonly [Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
107
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
108
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
109
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
110
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
111
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
112
+ readonly span: Schema.Struct<{
113
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
114
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
115
+ readonly sampled: Schema.Boolean;
116
+ readonly tracestate: Schema.NullOr<Schema.String>;
117
+ }>;
118
+ readonly links: Schema.$Array<Schema.Struct<{
119
+ readonly context: Schema.Struct<{
120
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
121
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
122
+ readonly sampled: Schema.Boolean;
123
+ readonly tracestate: Schema.NullOr<Schema.String>;
124
+ }>;
125
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
126
+ }>>;
127
+ }>>;
128
+ readonly durability: Schema.Literal<"durable">;
129
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
130
+ readonly type: Schema.Literal<"TurnAttemptStarted">;
131
+ readonly schemaVersion: Schema.Literal<number>;
132
+ readonly payload: Schema.Struct<{
133
+ readonly runId: Schema.brand<Schema.String, "RunId">;
134
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
135
+ readonly attemptId: Schema.brand<Schema.String, "InferenceId">;
136
+ }>;
137
+ }>, Schema.Struct<{
138
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
139
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
140
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
141
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
142
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
143
+ readonly span: Schema.Struct<{
144
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
145
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
146
+ readonly sampled: Schema.Boolean;
147
+ readonly tracestate: Schema.NullOr<Schema.String>;
148
+ }>;
149
+ readonly links: Schema.$Array<Schema.Struct<{
150
+ readonly context: Schema.Struct<{
151
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
152
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
153
+ readonly sampled: Schema.Boolean;
154
+ readonly tracestate: Schema.NullOr<Schema.String>;
155
+ }>;
156
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
157
+ }>>;
158
+ }>>;
159
+ readonly durability: Schema.Literal<"durable">;
160
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
161
+ readonly type: Schema.Literal<"TurnAttemptCompleted">;
162
+ readonly schemaVersion: Schema.Literal<number>;
163
+ readonly payload: Schema.Struct<{
164
+ readonly runId: Schema.brand<Schema.String, "RunId">;
165
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
166
+ readonly attemptId: Schema.brand<Schema.String, "InferenceId">;
167
+ readonly finishReason: Schema.optionalKey<Schema.String>;
168
+ readonly usage: Schema.optionalKey<Schema.Struct<{
169
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
170
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
171
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
172
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
173
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
174
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
175
+ }>>;
176
+ readonly responseMetadata: Schema.optionalKey<Schema.Unknown>;
177
+ readonly finishMetadata: Schema.optionalKey<Schema.Unknown>;
178
+ }>;
179
+ }>, Schema.Struct<{
180
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
181
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
182
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
183
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
184
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
185
+ readonly span: Schema.Struct<{
186
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
187
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
188
+ readonly sampled: Schema.Boolean;
189
+ readonly tracestate: Schema.NullOr<Schema.String>;
190
+ }>;
191
+ readonly links: Schema.$Array<Schema.Struct<{
192
+ readonly context: Schema.Struct<{
193
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
194
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
195
+ readonly sampled: Schema.Boolean;
196
+ readonly tracestate: Schema.NullOr<Schema.String>;
197
+ }>;
198
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
199
+ }>>;
200
+ }>>;
201
+ readonly durability: Schema.Literal<"durable">;
202
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
203
+ readonly type: Schema.Literal<"AssistantMessageCommitted">;
204
+ readonly schemaVersion: Schema.Literal<number>;
205
+ readonly payload: Schema.Struct<{
206
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
207
+ readonly runId: Schema.brand<Schema.String, "RunId">;
208
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
209
+ readonly attemptId: Schema.brand<Schema.String, "InferenceId">;
210
+ readonly promptParts: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
211
+ readonly type: Schema.Literal<"text">;
212
+ readonly text: Schema.String;
213
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
214
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
215
+ }>, Schema.Struct<{
216
+ readonly type: Schema.Literal<"file">;
217
+ readonly mediaType: Schema.String;
218
+ readonly fileName: Schema.optional<Schema.String>;
219
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
220
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
221
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
222
+ }>, Schema.Struct<{
223
+ readonly type: Schema.Literal<"reasoning">;
224
+ readonly text: Schema.String;
225
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
226
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
227
+ }>, Schema.Struct<{
228
+ readonly type: Schema.Literal<"tool-call">;
229
+ readonly id: Schema.String;
230
+ readonly name: Schema.String;
231
+ readonly params: Schema.Unknown;
232
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
233
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
234
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
235
+ }>, Schema.Struct<{
236
+ readonly type: Schema.Literal<"tool-result">;
237
+ readonly id: Schema.String;
238
+ readonly name: Schema.String;
239
+ readonly isFailure: Schema.Boolean;
240
+ readonly result: Schema.Unknown;
241
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
242
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
243
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
244
+ }>, Schema.Struct<{
245
+ readonly type: Schema.Literal<"tool-approval-request">;
246
+ readonly approvalId: Schema.String;
247
+ readonly toolCallId: Schema.String;
248
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
249
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
250
+ }>]>>;
251
+ }>;
252
+ }>, Schema.Struct<{
253
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
254
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
255
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
256
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
257
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
258
+ readonly span: Schema.Struct<{
259
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
260
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
261
+ readonly sampled: Schema.Boolean;
262
+ readonly tracestate: Schema.NullOr<Schema.String>;
263
+ }>;
264
+ readonly links: Schema.$Array<Schema.Struct<{
265
+ readonly context: Schema.Struct<{
266
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
267
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
268
+ readonly sampled: Schema.Boolean;
269
+ readonly tracestate: Schema.NullOr<Schema.String>;
270
+ }>;
271
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
272
+ }>>;
273
+ }>>;
274
+ readonly durability: Schema.Literal<"durable">;
275
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
276
+ readonly type: Schema.Literal<"ToolCallCreated">;
277
+ readonly schemaVersion: Schema.Literal<number>;
278
+ readonly payload: Schema.Struct<{
279
+ readonly runId: Schema.brand<Schema.String, "RunId">;
280
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
281
+ readonly attemptId: Schema.brand<Schema.String, "InferenceId">;
282
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
283
+ readonly promptPart: Schema.Struct<{
284
+ readonly type: Schema.Literal<"tool-call">;
285
+ readonly params: Schema.Unknown;
286
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
287
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
288
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
289
+ readonly id: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
290
+ readonly name: Schema.NonEmptyString;
291
+ }>;
292
+ }>;
293
+ }>]>, Schema.Union<readonly [Schema.Struct<{
294
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
295
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
296
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
297
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
298
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
299
+ readonly span: Schema.Struct<{
300
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
301
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
302
+ readonly sampled: Schema.Boolean;
303
+ readonly tracestate: Schema.NullOr<Schema.String>;
304
+ }>;
305
+ readonly links: Schema.$Array<Schema.Struct<{
306
+ readonly context: Schema.Struct<{
307
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
308
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
309
+ readonly sampled: Schema.Boolean;
310
+ readonly tracestate: Schema.NullOr<Schema.String>;
311
+ }>;
312
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
313
+ }>>;
314
+ }>>;
315
+ readonly durability: Schema.Literal<"durable">;
316
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
317
+ readonly type: Schema.Literal<"SessionConfigured">;
318
+ readonly schemaVersion: Schema.Literal<number>;
319
+ readonly payload: Schema.Struct<{
320
+ readonly modelSelection: Schema.Struct<{
321
+ readonly provider: Schema.NonEmptyString;
322
+ readonly modelId: Schema.NonEmptyString;
323
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
324
+ }>;
325
+ }>;
326
+ }>, Schema.Union<readonly [Schema.Struct<{
327
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
328
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
329
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
330
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
331
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
332
+ readonly span: Schema.Struct<{
333
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
334
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
335
+ readonly sampled: Schema.Boolean;
336
+ readonly tracestate: Schema.NullOr<Schema.String>;
337
+ }>;
338
+ readonly links: Schema.$Array<Schema.Struct<{
339
+ readonly context: Schema.Struct<{
340
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
341
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
342
+ readonly sampled: Schema.Boolean;
343
+ readonly tracestate: Schema.NullOr<Schema.String>;
344
+ }>;
345
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
346
+ }>>;
347
+ }>>;
348
+ readonly durability: Schema.Literal<"durable">;
349
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
350
+ readonly type: Schema.Literal<"RunSchedulingRequested">;
351
+ readonly schemaVersion: Schema.Literal<number>;
352
+ readonly payload: Schema.Struct<{
353
+ readonly requestId: Schema.brand<Schema.String, "RunRequestId">;
354
+ readonly work: Schema.Union<readonly [Schema.TaggedStruct<"Command", {
355
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
356
+ }>, Schema.TaggedStruct<"Recovery", {
357
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
358
+ readonly interruptedRunId: Schema.brand<Schema.String, "RunId">;
359
+ readonly inputMessageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
360
+ }>]>;
361
+ }>;
362
+ }>, Schema.Struct<{
363
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
364
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
365
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
366
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
367
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
368
+ readonly span: Schema.Struct<{
369
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
370
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
371
+ readonly sampled: Schema.Boolean;
372
+ readonly tracestate: Schema.NullOr<Schema.String>;
373
+ }>;
374
+ readonly links: Schema.$Array<Schema.Struct<{
375
+ readonly context: Schema.Struct<{
376
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
377
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
378
+ readonly sampled: Schema.Boolean;
379
+ readonly tracestate: Schema.NullOr<Schema.String>;
380
+ }>;
381
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
382
+ }>>;
383
+ }>>;
384
+ readonly durability: Schema.Literal<"durable">;
385
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
386
+ readonly type: Schema.Literal<"RunSchedulingDelivered">;
387
+ readonly schemaVersion: Schema.Literal<number>;
388
+ readonly payload: Schema.Struct<{
389
+ readonly requestId: Schema.brand<Schema.String, "RunRequestId">;
390
+ }>;
391
+ }>, Schema.Struct<{
392
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
393
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
394
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
395
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
396
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
397
+ readonly span: Schema.Struct<{
398
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
399
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
400
+ readonly sampled: Schema.Boolean;
401
+ readonly tracestate: Schema.NullOr<Schema.String>;
402
+ }>;
403
+ readonly links: Schema.$Array<Schema.Struct<{
404
+ readonly context: Schema.Struct<{
405
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
406
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
407
+ readonly sampled: Schema.Boolean;
408
+ readonly tracestate: Schema.NullOr<Schema.String>;
409
+ }>;
410
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
411
+ }>>;
412
+ }>>;
413
+ readonly durability: Schema.Literal<"durable">;
414
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
415
+ readonly type: Schema.Literal<"RunSchedulingInvalidated">;
416
+ readonly schemaVersion: Schema.Literal<number>;
417
+ readonly payload: Schema.Struct<{
418
+ readonly requestId: Schema.brand<Schema.String, "RunRequestId">;
419
+ readonly reason: Schema.Literals<readonly ["stopped", "interrupted", "message-cancelled", "ineligible"]>;
420
+ }>;
421
+ }>, Schema.Struct<{
422
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
423
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
424
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
425
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
426
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
427
+ readonly span: Schema.Struct<{
428
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
429
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
430
+ readonly sampled: Schema.Boolean;
431
+ readonly tracestate: Schema.NullOr<Schema.String>;
432
+ }>;
433
+ readonly links: Schema.$Array<Schema.Struct<{
434
+ readonly context: Schema.Struct<{
435
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
436
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
437
+ readonly sampled: Schema.Boolean;
438
+ readonly tracestate: Schema.NullOr<Schema.String>;
439
+ }>;
440
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
441
+ }>>;
442
+ }>>;
443
+ readonly durability: Schema.Literal<"durable">;
444
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
445
+ readonly type: Schema.Literal<"RunSchedulingGranted">;
446
+ readonly schemaVersion: Schema.Literal<number>;
447
+ readonly payload: Schema.Struct<{
448
+ readonly requestId: Schema.brand<Schema.String, "RunRequestId">;
449
+ readonly runId: Schema.brand<Schema.String, "RunId">;
450
+ }>;
451
+ }>]>, Schema.Union<readonly [Schema.Struct<{
452
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
453
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
454
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
455
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
456
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
457
+ readonly span: Schema.Struct<{
458
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
459
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
460
+ readonly sampled: Schema.Boolean;
461
+ readonly tracestate: Schema.NullOr<Schema.String>;
462
+ }>;
463
+ readonly links: Schema.$Array<Schema.Struct<{
464
+ readonly context: Schema.Struct<{
465
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
466
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
467
+ readonly sampled: Schema.Boolean;
468
+ readonly tracestate: Schema.NullOr<Schema.String>;
469
+ }>;
470
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
471
+ }>>;
472
+ }>>;
473
+ readonly durability: Schema.Literal<"durable">;
474
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
475
+ readonly type: Schema.Literal<"CommandAdmitted">;
476
+ readonly schemaVersion: Schema.Literal<number>;
477
+ readonly payload: Schema.Struct<{
478
+ readonly command: Schema.Union<readonly [typeof SubmitMessageCommand, typeof StopTurnCommand, typeof CancelPendingMessageCommand, typeof PromotePendingMessageCommand, typeof ResumePendingMessagesCommand]>;
479
+ }>;
480
+ }>, Schema.Struct<{
481
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
482
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
483
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
484
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
485
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
486
+ readonly span: Schema.Struct<{
487
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
488
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
489
+ readonly sampled: Schema.Boolean;
490
+ readonly tracestate: Schema.NullOr<Schema.String>;
491
+ }>;
492
+ readonly links: Schema.$Array<Schema.Struct<{
493
+ readonly context: Schema.Struct<{
494
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
495
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
496
+ readonly sampled: Schema.Boolean;
497
+ readonly tracestate: Schema.NullOr<Schema.String>;
498
+ }>;
499
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
500
+ }>>;
501
+ }>>;
502
+ readonly durability: Schema.Literal<"durable">;
503
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
504
+ readonly type: Schema.Literal<"CommandStarted">;
505
+ readonly schemaVersion: Schema.Literal<number>;
506
+ readonly payload: Schema.Struct<{
507
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
508
+ }>;
509
+ }>, Schema.Struct<{
510
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
511
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
512
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
513
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
514
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
515
+ readonly span: Schema.Struct<{
516
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
517
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
518
+ readonly sampled: Schema.Boolean;
519
+ readonly tracestate: Schema.NullOr<Schema.String>;
520
+ }>;
521
+ readonly links: Schema.$Array<Schema.Struct<{
522
+ readonly context: Schema.Struct<{
523
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
524
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
525
+ readonly sampled: Schema.Boolean;
526
+ readonly tracestate: Schema.NullOr<Schema.String>;
527
+ }>;
528
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
529
+ }>>;
530
+ }>>;
531
+ readonly durability: Schema.Literal<"durable">;
532
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
533
+ readonly type: Schema.Literal<"CommandCompleted">;
534
+ readonly schemaVersion: Schema.Literal<number>;
535
+ readonly payload: Schema.Struct<{
536
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
537
+ }>;
538
+ }>, Schema.Struct<{
539
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
540
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
541
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
542
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
543
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
544
+ readonly span: Schema.Struct<{
545
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
546
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
547
+ readonly sampled: Schema.Boolean;
548
+ readonly tracestate: Schema.NullOr<Schema.String>;
549
+ }>;
550
+ readonly links: Schema.$Array<Schema.Struct<{
551
+ readonly context: Schema.Struct<{
552
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
553
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
554
+ readonly sampled: Schema.Boolean;
555
+ readonly tracestate: Schema.NullOr<Schema.String>;
556
+ }>;
557
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
558
+ }>>;
559
+ }>>;
560
+ readonly durability: Schema.Literal<"durable">;
561
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
562
+ readonly type: Schema.Literal<"CommandFailed">;
563
+ readonly schemaVersion: Schema.Literal<number>;
564
+ readonly payload: Schema.Struct<{
565
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
566
+ readonly error: Schema.Struct<{
567
+ readonly message: Schema.String;
568
+ readonly code: Schema.optionalKey<Schema.String>;
569
+ readonly details: Schema.optionalKey<Schema.Unknown>;
570
+ }>;
571
+ }>;
572
+ }>, Schema.Struct<{
573
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
574
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
575
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
576
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
577
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
578
+ readonly span: Schema.Struct<{
579
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
580
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
581
+ readonly sampled: Schema.Boolean;
582
+ readonly tracestate: Schema.NullOr<Schema.String>;
583
+ }>;
584
+ readonly links: Schema.$Array<Schema.Struct<{
585
+ readonly context: Schema.Struct<{
586
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
587
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
588
+ readonly sampled: Schema.Boolean;
589
+ readonly tracestate: Schema.NullOr<Schema.String>;
590
+ }>;
591
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
592
+ }>>;
593
+ }>>;
594
+ readonly durability: Schema.Literal<"durable">;
595
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
596
+ readonly type: Schema.Literal<"CommandCancelled">;
597
+ readonly schemaVersion: Schema.Literal<number>;
598
+ readonly payload: Schema.Struct<{
599
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
600
+ readonly reason: Schema.String;
601
+ }>;
602
+ }>]>, Schema.Union<readonly [Schema.Struct<{
603
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
604
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
605
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
606
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
607
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
608
+ readonly span: Schema.Struct<{
609
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
610
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
611
+ readonly sampled: Schema.Boolean;
612
+ readonly tracestate: Schema.NullOr<Schema.String>;
613
+ }>;
614
+ readonly links: Schema.$Array<Schema.Struct<{
615
+ readonly context: Schema.Struct<{
616
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
617
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
618
+ readonly sampled: Schema.Boolean;
619
+ readonly tracestate: Schema.NullOr<Schema.String>;
620
+ }>;
621
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
622
+ }>>;
623
+ }>>;
624
+ readonly durability: Schema.Literal<"durable">;
625
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
626
+ readonly type: Schema.Literal<"SystemMessageCommitted">;
627
+ readonly schemaVersion: Schema.Literal<number>;
628
+ readonly payload: Schema.Struct<{
629
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
630
+ readonly content: Schema.NonEmptyString;
631
+ }>;
632
+ }>, Schema.Struct<{
633
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
634
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
635
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
636
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
637
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
638
+ readonly span: Schema.Struct<{
639
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
640
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
641
+ readonly sampled: Schema.Boolean;
642
+ readonly tracestate: Schema.NullOr<Schema.String>;
643
+ }>;
644
+ readonly links: Schema.$Array<Schema.Struct<{
645
+ readonly context: Schema.Struct<{
646
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
647
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
648
+ readonly sampled: Schema.Boolean;
649
+ readonly tracestate: Schema.NullOr<Schema.String>;
650
+ }>;
651
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
652
+ }>>;
653
+ }>>;
654
+ readonly durability: Schema.Literal<"durable">;
655
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
656
+ readonly type: Schema.Literal<"UserMessageCommitted">;
657
+ readonly schemaVersion: Schema.Literal<number>;
658
+ readonly payload: Schema.Struct<{
659
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
660
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
661
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
662
+ readonly type: Schema.Literal<"text">;
663
+ readonly text: Schema.String;
664
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
665
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
666
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
667
+ readonly type: Schema.Literal<"text">;
668
+ readonly text: Schema.String;
669
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
670
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
671
+ }>, Schema.Struct<{
672
+ readonly type: Schema.Literal<"file">;
673
+ readonly mediaType: Schema.String;
674
+ readonly fileName: Schema.optional<Schema.String>;
675
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
676
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
677
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
678
+ }>]>>]>;
679
+ }>;
680
+ }>, Schema.Struct<{
681
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
682
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
683
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
684
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
685
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
686
+ readonly span: Schema.Struct<{
687
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
688
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
689
+ readonly sampled: Schema.Boolean;
690
+ readonly tracestate: Schema.NullOr<Schema.String>;
691
+ }>;
692
+ readonly links: Schema.$Array<Schema.Struct<{
693
+ readonly context: Schema.Struct<{
694
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
695
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
696
+ readonly sampled: Schema.Boolean;
697
+ readonly tracestate: Schema.NullOr<Schema.String>;
698
+ }>;
699
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
700
+ }>>;
701
+ }>>;
702
+ readonly durability: Schema.Literal<"durable">;
703
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
704
+ readonly type: Schema.Literal<"SteeringMessageQueued">;
705
+ readonly schemaVersion: Schema.Literal<number>;
706
+ readonly payload: Schema.Struct<{
707
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
708
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
709
+ readonly runId: Schema.brand<Schema.String, "RunId">;
710
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
711
+ readonly type: Schema.Literal<"text">;
712
+ readonly text: Schema.String;
713
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
714
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
715
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
716
+ readonly type: Schema.Literal<"text">;
717
+ readonly text: Schema.String;
718
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
719
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
720
+ }>, Schema.Struct<{
721
+ readonly type: Schema.Literal<"file">;
722
+ readonly mediaType: Schema.String;
723
+ readonly fileName: Schema.optional<Schema.String>;
724
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
725
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
726
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
727
+ }>]>>]>;
728
+ }>;
729
+ }>, Schema.Struct<{
730
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
731
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
732
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
733
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
734
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
735
+ readonly span: Schema.Struct<{
736
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
737
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
738
+ readonly sampled: Schema.Boolean;
739
+ readonly tracestate: Schema.NullOr<Schema.String>;
740
+ }>;
741
+ readonly links: Schema.$Array<Schema.Struct<{
742
+ readonly context: Schema.Struct<{
743
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
744
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
745
+ readonly sampled: Schema.Boolean;
746
+ readonly tracestate: Schema.NullOr<Schema.String>;
747
+ }>;
748
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
749
+ }>>;
750
+ }>>;
751
+ readonly durability: Schema.Literal<"durable">;
752
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
753
+ readonly type: Schema.Literal<"SteeringMessageCancelled">;
754
+ readonly schemaVersion: Schema.Literal<number>;
755
+ readonly payload: Schema.Struct<{
756
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
757
+ readonly runId: Schema.brand<Schema.String, "RunId">;
758
+ readonly reason: Schema.String;
759
+ }>;
760
+ }>, Schema.Struct<{
761
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
762
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
763
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
764
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
765
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
766
+ readonly span: Schema.Struct<{
767
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
768
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
769
+ readonly sampled: Schema.Boolean;
770
+ readonly tracestate: Schema.NullOr<Schema.String>;
771
+ }>;
772
+ readonly links: Schema.$Array<Schema.Struct<{
773
+ readonly context: Schema.Struct<{
774
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
775
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
776
+ readonly sampled: Schema.Boolean;
777
+ readonly tracestate: Schema.NullOr<Schema.String>;
778
+ }>;
779
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
780
+ }>>;
781
+ }>>;
782
+ readonly durability: Schema.Literal<"durable">;
783
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
784
+ readonly type: Schema.Literal<"UserMessageSubmitted">;
785
+ readonly schemaVersion: Schema.Literal<number>;
786
+ readonly payload: Schema.Struct<{
787
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
788
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
789
+ readonly disposition: Schema.Literals<readonly ["queue", "steer"]>;
790
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
791
+ readonly type: Schema.Literal<"text">;
792
+ readonly text: Schema.String;
793
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
794
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
795
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
796
+ readonly type: Schema.Literal<"text">;
797
+ readonly text: Schema.String;
798
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
799
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
800
+ }>, Schema.Struct<{
801
+ readonly type: Schema.Literal<"file">;
802
+ readonly mediaType: Schema.String;
803
+ readonly fileName: Schema.optional<Schema.String>;
804
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
805
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
806
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
807
+ }>]>>]>;
808
+ }>;
809
+ }>, Schema.Struct<{
810
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
811
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
812
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
813
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
814
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
815
+ readonly span: Schema.Struct<{
816
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
817
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
818
+ readonly sampled: Schema.Boolean;
819
+ readonly tracestate: Schema.NullOr<Schema.String>;
820
+ }>;
821
+ readonly links: Schema.$Array<Schema.Struct<{
822
+ readonly context: Schema.Struct<{
823
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
824
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
825
+ readonly sampled: Schema.Boolean;
826
+ readonly tracestate: Schema.NullOr<Schema.String>;
827
+ }>;
828
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
829
+ }>>;
830
+ }>>;
831
+ readonly durability: Schema.Literal<"durable">;
832
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
833
+ readonly type: Schema.Literal<"UserMessagePromoted">;
834
+ readonly schemaVersion: Schema.Literal<number>;
835
+ readonly payload: Schema.Struct<{
836
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
837
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
838
+ readonly from: Schema.Literal<"queue">;
839
+ readonly to: Schema.Literal<"steer">;
840
+ }>;
841
+ }>, Schema.Struct<{
842
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
843
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
844
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
845
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
846
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
847
+ readonly span: Schema.Struct<{
848
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
849
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
850
+ readonly sampled: Schema.Boolean;
851
+ readonly tracestate: Schema.NullOr<Schema.String>;
852
+ }>;
853
+ readonly links: Schema.$Array<Schema.Struct<{
854
+ readonly context: Schema.Struct<{
855
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
856
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
857
+ readonly sampled: Schema.Boolean;
858
+ readonly tracestate: Schema.NullOr<Schema.String>;
859
+ }>;
860
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
861
+ }>>;
862
+ }>>;
863
+ readonly durability: Schema.Literal<"durable">;
864
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
865
+ readonly type: Schema.Literal<"UserMessageCancelled">;
866
+ readonly schemaVersion: Schema.Literal<number>;
867
+ readonly payload: Schema.Struct<{
868
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
869
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
870
+ readonly reason: Schema.Literals<readonly ["edit", "user-cancel", "clear-paused-queue"]>;
871
+ }>;
872
+ }>, Schema.Struct<{
873
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
874
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
875
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
876
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
877
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
878
+ readonly span: Schema.Struct<{
879
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
880
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
881
+ readonly sampled: Schema.Boolean;
882
+ readonly tracestate: Schema.NullOr<Schema.String>;
883
+ }>;
884
+ readonly links: Schema.$Array<Schema.Struct<{
885
+ readonly context: Schema.Struct<{
886
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
887
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
888
+ readonly sampled: Schema.Boolean;
889
+ readonly tracestate: Schema.NullOr<Schema.String>;
890
+ }>;
891
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
892
+ }>>;
893
+ }>>;
894
+ readonly durability: Schema.Literal<"durable">;
895
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
896
+ readonly type: Schema.Literal<"MessageQueuePaused">;
897
+ readonly schemaVersion: Schema.Literal<number>;
898
+ readonly payload: Schema.Struct<{
899
+ readonly stopCommandId: Schema.brand<Schema.String, "CommandId">;
900
+ readonly runId: Schema.brand<Schema.String, "RunId">;
901
+ readonly messageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
902
+ readonly reason: Schema.Literal<"user-interrupted">;
903
+ }>;
904
+ }>, Schema.Struct<{
905
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
906
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
907
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
908
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
909
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
910
+ readonly span: Schema.Struct<{
911
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
912
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
913
+ readonly sampled: Schema.Boolean;
914
+ readonly tracestate: Schema.NullOr<Schema.String>;
915
+ }>;
916
+ readonly links: Schema.$Array<Schema.Struct<{
917
+ readonly context: Schema.Struct<{
918
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
919
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
920
+ readonly sampled: Schema.Boolean;
921
+ readonly tracestate: Schema.NullOr<Schema.String>;
922
+ }>;
923
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
924
+ }>>;
925
+ }>>;
926
+ readonly durability: Schema.Literal<"durable">;
927
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
928
+ readonly type: Schema.Literal<"PendingMessagesPaused">;
929
+ readonly schemaVersion: Schema.Literal<number>;
930
+ readonly payload: Schema.Union<readonly [Schema.Struct<{
931
+ readonly interruptionCommandId: Schema.brand<Schema.String, "CommandId">;
932
+ readonly messageIds: Schema.NonEmptyArray<Schema.brand<Schema.String, "MessageId">>;
933
+ readonly reason: Schema.Literal<"user-interrupted">;
934
+ readonly runId: Schema.brand<Schema.String, "RunId">;
935
+ }>, Schema.Struct<{
936
+ readonly interruptionCommandId: Schema.brand<Schema.String, "CommandId">;
937
+ readonly messageIds: Schema.NonEmptyArray<Schema.brand<Schema.String, "MessageId">>;
938
+ readonly reason: Schema.Literal<"user-interrupted">;
939
+ readonly runRequestId: Schema.brand<Schema.String, "RunRequestId">;
940
+ }>]>;
941
+ }>, Schema.Struct<{
942
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
943
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
944
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
945
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
946
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
947
+ readonly span: Schema.Struct<{
948
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
949
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
950
+ readonly sampled: Schema.Boolean;
951
+ readonly tracestate: Schema.NullOr<Schema.String>;
952
+ }>;
953
+ readonly links: Schema.$Array<Schema.Struct<{
954
+ readonly context: Schema.Struct<{
955
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
956
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
957
+ readonly sampled: Schema.Boolean;
958
+ readonly tracestate: Schema.NullOr<Schema.String>;
959
+ }>;
960
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
961
+ }>>;
962
+ }>>;
963
+ readonly durability: Schema.Literal<"durable">;
964
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
965
+ readonly type: Schema.Literal<"AssistantMessageCommitted">;
966
+ readonly schemaVersion: Schema.Literal<number>;
967
+ readonly payload: Schema.Struct<{
968
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
969
+ readonly runId: Schema.brand<Schema.String, "RunId">;
970
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
971
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
972
+ readonly promptParts: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
973
+ readonly type: Schema.Literal<"text">;
974
+ readonly text: Schema.String;
975
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
976
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
977
+ }>, Schema.Struct<{
978
+ readonly type: Schema.Literal<"file">;
979
+ readonly mediaType: Schema.String;
980
+ readonly fileName: Schema.optional<Schema.String>;
981
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
982
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
983
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
984
+ }>, Schema.Struct<{
985
+ readonly type: Schema.Literal<"reasoning">;
986
+ readonly text: Schema.String;
987
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
988
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
989
+ }>, Schema.Struct<{
990
+ readonly type: Schema.Literal<"tool-call">;
991
+ readonly id: Schema.String;
992
+ readonly name: Schema.String;
993
+ readonly params: Schema.Unknown;
994
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
995
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
996
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
997
+ }>, Schema.Struct<{
998
+ readonly type: Schema.Literal<"tool-result">;
999
+ readonly id: Schema.String;
1000
+ readonly name: Schema.String;
1001
+ readonly isFailure: Schema.Boolean;
1002
+ readonly result: Schema.Unknown;
1003
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
1004
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1005
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1006
+ }>, Schema.Struct<{
1007
+ readonly type: Schema.Literal<"tool-approval-request">;
1008
+ readonly approvalId: Schema.String;
1009
+ readonly toolCallId: Schema.String;
1010
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1011
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1012
+ }>]>>;
1013
+ }>;
1014
+ }>, Schema.Struct<{
1015
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1016
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1017
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1018
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1019
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1020
+ readonly span: Schema.Struct<{
1021
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1022
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1023
+ readonly sampled: Schema.Boolean;
1024
+ readonly tracestate: Schema.NullOr<Schema.String>;
1025
+ }>;
1026
+ readonly links: Schema.$Array<Schema.Struct<{
1027
+ readonly context: Schema.Struct<{
1028
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1029
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1030
+ readonly sampled: Schema.Boolean;
1031
+ readonly tracestate: Schema.NullOr<Schema.String>;
1032
+ }>;
1033
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1034
+ }>>;
1035
+ }>>;
1036
+ readonly durability: Schema.Literal<"durable">;
1037
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1038
+ readonly type: Schema.Literal<"AssistantMessageImported">;
1039
+ readonly schemaVersion: Schema.Literal<number>;
1040
+ readonly payload: Schema.Struct<{
1041
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
1042
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1043
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1044
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
1045
+ readonly promptParts: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
1046
+ readonly type: Schema.Literal<"text">;
1047
+ readonly text: Schema.String;
1048
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1049
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1050
+ }>, Schema.Struct<{
1051
+ readonly type: Schema.Literal<"file">;
1052
+ readonly mediaType: Schema.String;
1053
+ readonly fileName: Schema.optional<Schema.String>;
1054
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
1055
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1056
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1057
+ }>, Schema.Struct<{
1058
+ readonly type: Schema.Literal<"reasoning">;
1059
+ readonly text: Schema.String;
1060
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1061
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1062
+ }>, Schema.Struct<{
1063
+ readonly type: Schema.Literal<"tool-call">;
1064
+ readonly id: Schema.String;
1065
+ readonly name: Schema.String;
1066
+ readonly params: Schema.Unknown;
1067
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
1068
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1069
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1070
+ }>, Schema.Struct<{
1071
+ readonly type: Schema.Literal<"tool-result">;
1072
+ readonly id: Schema.String;
1073
+ readonly name: Schema.String;
1074
+ readonly isFailure: Schema.Boolean;
1075
+ readonly result: Schema.Unknown;
1076
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
1077
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1078
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1079
+ }>, Schema.Struct<{
1080
+ readonly type: Schema.Literal<"tool-approval-request">;
1081
+ readonly approvalId: Schema.String;
1082
+ readonly toolCallId: Schema.String;
1083
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1084
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1085
+ }>]>>;
1086
+ }>;
1087
+ }>, Schema.Struct<{
1088
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1089
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1090
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1091
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1092
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1093
+ readonly span: Schema.Struct<{
1094
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1095
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1096
+ readonly sampled: Schema.Boolean;
1097
+ readonly tracestate: Schema.NullOr<Schema.String>;
1098
+ }>;
1099
+ readonly links: Schema.$Array<Schema.Struct<{
1100
+ readonly context: Schema.Struct<{
1101
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1102
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1103
+ readonly sampled: Schema.Boolean;
1104
+ readonly tracestate: Schema.NullOr<Schema.String>;
1105
+ }>;
1106
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1107
+ }>>;
1108
+ }>>;
1109
+ readonly durability: Schema.Literal<"durable">;
1110
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1111
+ readonly type: Schema.Literal<"AssistantPartialCommitted">;
1112
+ readonly schemaVersion: Schema.Literal<number>;
1113
+ readonly payload: Schema.Struct<{
1114
+ readonly messageId: Schema.brand<Schema.String, "MessageId">;
1115
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1116
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1117
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
1118
+ readonly promptParts: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
1119
+ readonly type: Schema.Literal<"text">;
1120
+ readonly text: Schema.String;
1121
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1122
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1123
+ }>, Schema.Struct<{
1124
+ readonly type: Schema.Literal<"file">;
1125
+ readonly mediaType: Schema.String;
1126
+ readonly fileName: Schema.optional<Schema.String>;
1127
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
1128
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1129
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1130
+ }>, Schema.Struct<{
1131
+ readonly type: Schema.Literal<"reasoning">;
1132
+ readonly text: Schema.String;
1133
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1134
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1135
+ }>, Schema.Struct<{
1136
+ readonly type: Schema.Literal<"tool-call">;
1137
+ readonly id: Schema.String;
1138
+ readonly name: Schema.String;
1139
+ readonly params: Schema.Unknown;
1140
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
1141
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1142
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1143
+ }>, Schema.Struct<{
1144
+ readonly type: Schema.Literal<"tool-result">;
1145
+ readonly id: Schema.String;
1146
+ readonly name: Schema.String;
1147
+ readonly isFailure: Schema.Boolean;
1148
+ readonly result: Schema.Unknown;
1149
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
1150
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1151
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1152
+ }>, Schema.Struct<{
1153
+ readonly type: Schema.Literal<"tool-approval-request">;
1154
+ readonly approvalId: Schema.String;
1155
+ readonly toolCallId: Schema.String;
1156
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1157
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1158
+ }>]>>;
1159
+ readonly reason: Schema.String;
1160
+ }>;
1161
+ }>]>, Schema.Union<readonly [Schema.Struct<{
1162
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1163
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1164
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1165
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1166
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1167
+ readonly span: Schema.Struct<{
1168
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1169
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1170
+ readonly sampled: Schema.Boolean;
1171
+ readonly tracestate: Schema.NullOr<Schema.String>;
1172
+ }>;
1173
+ readonly links: Schema.$Array<Schema.Struct<{
1174
+ readonly context: Schema.Struct<{
1175
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1176
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1177
+ readonly sampled: Schema.Boolean;
1178
+ readonly tracestate: Schema.NullOr<Schema.String>;
1179
+ }>;
1180
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1181
+ }>>;
1182
+ }>>;
1183
+ readonly durability: Schema.Literal<"durable">;
1184
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1185
+ readonly type: Schema.Literal<"RunStarted">;
1186
+ readonly schemaVersion: Schema.Literal<number>;
1187
+ readonly payload: Schema.Struct<{
1188
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1189
+ readonly commandIds: Schema.$Array<Schema.brand<Schema.String, "CommandId">>;
1190
+ readonly modelSelection: Schema.Struct<{
1191
+ readonly provider: Schema.NonEmptyString;
1192
+ readonly modelId: Schema.NonEmptyString;
1193
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
1194
+ }>;
1195
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1196
+ readonly root: Schema.Struct<{
1197
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1198
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1199
+ readonly sampled: Schema.Boolean;
1200
+ readonly tracestate: Schema.NullOr<Schema.String>;
1201
+ }>;
1202
+ readonly links: Schema.$Array<Schema.Struct<{
1203
+ readonly context: Schema.Struct<{
1204
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1205
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1206
+ readonly sampled: Schema.Boolean;
1207
+ readonly tracestate: Schema.NullOr<Schema.String>;
1208
+ }>;
1209
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1210
+ }>>;
1211
+ }>>;
1212
+ }>;
1213
+ }>, Schema.Struct<{
1214
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1215
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1216
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1217
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1218
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1219
+ readonly span: Schema.Struct<{
1220
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1221
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1222
+ readonly sampled: Schema.Boolean;
1223
+ readonly tracestate: Schema.NullOr<Schema.String>;
1224
+ }>;
1225
+ readonly links: Schema.$Array<Schema.Struct<{
1226
+ readonly context: Schema.Struct<{
1227
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1228
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1229
+ readonly sampled: Schema.Boolean;
1230
+ readonly tracestate: Schema.NullOr<Schema.String>;
1231
+ }>;
1232
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1233
+ }>>;
1234
+ }>>;
1235
+ readonly durability: Schema.Literal<"durable">;
1236
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1237
+ readonly type: Schema.Literal<"RunCompleted">;
1238
+ readonly schemaVersion: Schema.Literal<number>;
1239
+ readonly payload: Schema.Struct<{
1240
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1241
+ }>;
1242
+ }>, Schema.Struct<{
1243
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1244
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1245
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1246
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1247
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1248
+ readonly span: Schema.Struct<{
1249
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1250
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1251
+ readonly sampled: Schema.Boolean;
1252
+ readonly tracestate: Schema.NullOr<Schema.String>;
1253
+ }>;
1254
+ readonly links: Schema.$Array<Schema.Struct<{
1255
+ readonly context: Schema.Struct<{
1256
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1257
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1258
+ readonly sampled: Schema.Boolean;
1259
+ readonly tracestate: Schema.NullOr<Schema.String>;
1260
+ }>;
1261
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1262
+ }>>;
1263
+ }>>;
1264
+ readonly durability: Schema.Literal<"durable">;
1265
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1266
+ readonly type: Schema.Literal<"RunFailed">;
1267
+ readonly schemaVersion: Schema.Literal<number>;
1268
+ readonly payload: Schema.Struct<{
1269
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1270
+ readonly error: Schema.Struct<{
1271
+ readonly message: Schema.String;
1272
+ readonly code: Schema.optionalKey<Schema.String>;
1273
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1274
+ }>;
1275
+ }>;
1276
+ }>, Schema.Struct<{
1277
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1278
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1279
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1280
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1281
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1282
+ readonly span: Schema.Struct<{
1283
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1284
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1285
+ readonly sampled: Schema.Boolean;
1286
+ readonly tracestate: Schema.NullOr<Schema.String>;
1287
+ }>;
1288
+ readonly links: Schema.$Array<Schema.Struct<{
1289
+ readonly context: Schema.Struct<{
1290
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1291
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1292
+ readonly sampled: Schema.Boolean;
1293
+ readonly tracestate: Schema.NullOr<Schema.String>;
1294
+ }>;
1295
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1296
+ }>>;
1297
+ }>>;
1298
+ readonly durability: Schema.Literal<"durable">;
1299
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1300
+ readonly type: Schema.Literal<"RunInterrupted">;
1301
+ readonly schemaVersion: Schema.Literal<number>;
1302
+ readonly payload: Schema.Struct<{
1303
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1304
+ readonly reason: Schema.String;
1305
+ }>;
1306
+ }>]>, Schema.Struct<{
1307
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1308
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1309
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1310
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1311
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1312
+ readonly span: Schema.Struct<{
1313
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1314
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1315
+ readonly sampled: Schema.Boolean;
1316
+ readonly tracestate: Schema.NullOr<Schema.String>;
1317
+ }>;
1318
+ readonly links: Schema.$Array<Schema.Struct<{
1319
+ readonly context: Schema.Struct<{
1320
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1321
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1322
+ readonly sampled: Schema.Boolean;
1323
+ readonly tracestate: Schema.NullOr<Schema.String>;
1324
+ }>;
1325
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1326
+ }>>;
1327
+ }>>;
1328
+ readonly durability: Schema.Literal<"durable">;
1329
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1330
+ readonly type: Schema.Literal<"RecoveryCompleted">;
1331
+ readonly schemaVersion: Schema.Literal<number>;
1332
+ readonly payload: Schema.Struct<{
1333
+ readonly trigger: Schema.Literal<"runtime-restart">;
1334
+ readonly continuation: Schema.optionalKey<Schema.Struct<{
1335
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
1336
+ readonly interruptedRunId: Schema.brand<Schema.String, "RunId">;
1337
+ readonly replacementRunId: Schema.brand<Schema.String, "RunId">;
1338
+ }>>;
1339
+ }>;
1340
+ }>, Schema.Union<readonly [Schema.Struct<{
1341
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1342
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1343
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1344
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1345
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1346
+ readonly span: Schema.Struct<{
1347
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1348
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1349
+ readonly sampled: Schema.Boolean;
1350
+ readonly tracestate: Schema.NullOr<Schema.String>;
1351
+ }>;
1352
+ readonly links: Schema.$Array<Schema.Struct<{
1353
+ readonly context: Schema.Struct<{
1354
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1355
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1356
+ readonly sampled: Schema.Boolean;
1357
+ readonly tracestate: Schema.NullOr<Schema.String>;
1358
+ }>;
1359
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1360
+ }>>;
1361
+ }>>;
1362
+ readonly durability: Schema.Literal<"durable">;
1363
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1364
+ readonly type: Schema.Literal<"TurnStarted">;
1365
+ readonly schemaVersion: Schema.Literal<number>;
1366
+ readonly payload: Schema.Struct<{
1367
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1368
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1369
+ readonly inputMessageIds: Schema.optionalKey<Schema.$Array<Schema.brand<Schema.String, "MessageId">>>;
1370
+ }>;
1371
+ }>, Schema.Struct<{
1372
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1373
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1374
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1375
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1376
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1377
+ readonly span: Schema.Struct<{
1378
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1379
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1380
+ readonly sampled: Schema.Boolean;
1381
+ readonly tracestate: Schema.NullOr<Schema.String>;
1382
+ }>;
1383
+ readonly links: Schema.$Array<Schema.Struct<{
1384
+ readonly context: Schema.Struct<{
1385
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1386
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1387
+ readonly sampled: Schema.Boolean;
1388
+ readonly tracestate: Schema.NullOr<Schema.String>;
1389
+ }>;
1390
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1391
+ }>>;
1392
+ }>>;
1393
+ readonly durability: Schema.Literal<"durable">;
1394
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1395
+ readonly type: Schema.Literal<"TurnCompleted">;
1396
+ readonly schemaVersion: Schema.Literal<number>;
1397
+ readonly payload: Schema.Struct<{
1398
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1399
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1400
+ readonly usage: Schema.optionalKey<Schema.Struct<{
1401
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
1402
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
1403
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
1404
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
1405
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
1406
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
1407
+ }>>;
1408
+ }>;
1409
+ }>, Schema.Struct<{
1410
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1411
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1412
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1413
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1414
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1415
+ readonly span: Schema.Struct<{
1416
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1417
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1418
+ readonly sampled: Schema.Boolean;
1419
+ readonly tracestate: Schema.NullOr<Schema.String>;
1420
+ }>;
1421
+ readonly links: Schema.$Array<Schema.Struct<{
1422
+ readonly context: Schema.Struct<{
1423
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1424
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1425
+ readonly sampled: Schema.Boolean;
1426
+ readonly tracestate: Schema.NullOr<Schema.String>;
1427
+ }>;
1428
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1429
+ }>>;
1430
+ }>>;
1431
+ readonly durability: Schema.Literal<"durable">;
1432
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1433
+ readonly type: Schema.Literal<"TurnFailed">;
1434
+ readonly schemaVersion: Schema.Literal<number>;
1435
+ readonly payload: Schema.Struct<{
1436
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1437
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1438
+ readonly error: Schema.Struct<{
1439
+ readonly message: Schema.String;
1440
+ readonly code: Schema.optionalKey<Schema.String>;
1441
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1442
+ }>;
1443
+ }>;
1444
+ }>, Schema.Struct<{
1445
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1446
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1447
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1448
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1449
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1450
+ readonly span: Schema.Struct<{
1451
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1452
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1453
+ readonly sampled: Schema.Boolean;
1454
+ readonly tracestate: Schema.NullOr<Schema.String>;
1455
+ }>;
1456
+ readonly links: Schema.$Array<Schema.Struct<{
1457
+ readonly context: Schema.Struct<{
1458
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1459
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1460
+ readonly sampled: Schema.Boolean;
1461
+ readonly tracestate: Schema.NullOr<Schema.String>;
1462
+ }>;
1463
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1464
+ }>>;
1465
+ }>>;
1466
+ readonly durability: Schema.Literal<"durable">;
1467
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1468
+ readonly type: Schema.Literal<"TurnStopped">;
1469
+ readonly schemaVersion: Schema.Literal<number>;
1470
+ readonly payload: Schema.Struct<{
1471
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1472
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1473
+ readonly reason: Schema.String;
1474
+ }>;
1475
+ }>]>, Schema.Union<readonly [Schema.Struct<{
1476
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1477
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1478
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1479
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1480
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1481
+ readonly span: Schema.Struct<{
1482
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1483
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1484
+ readonly sampled: Schema.Boolean;
1485
+ readonly tracestate: Schema.NullOr<Schema.String>;
1486
+ }>;
1487
+ readonly links: Schema.$Array<Schema.Struct<{
1488
+ readonly context: Schema.Struct<{
1489
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1490
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1491
+ readonly sampled: Schema.Boolean;
1492
+ readonly tracestate: Schema.NullOr<Schema.String>;
1493
+ }>;
1494
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1495
+ }>>;
1496
+ }>>;
1497
+ readonly durability: Schema.Literal<"durable">;
1498
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1499
+ readonly type: Schema.Literal<"InferenceStarted">;
1500
+ readonly schemaVersion: Schema.Literal<number>;
1501
+ readonly payload: Schema.Struct<{
1502
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1503
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1504
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
1505
+ }>;
1506
+ }>, Schema.Struct<{
1507
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1508
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1509
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1510
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1511
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1512
+ readonly span: Schema.Struct<{
1513
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1514
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1515
+ readonly sampled: Schema.Boolean;
1516
+ readonly tracestate: Schema.NullOr<Schema.String>;
1517
+ }>;
1518
+ readonly links: Schema.$Array<Schema.Struct<{
1519
+ readonly context: Schema.Struct<{
1520
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1521
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1522
+ readonly sampled: Schema.Boolean;
1523
+ readonly tracestate: Schema.NullOr<Schema.String>;
1524
+ }>;
1525
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1526
+ }>>;
1527
+ }>>;
1528
+ readonly durability: Schema.Literal<"durable">;
1529
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1530
+ readonly type: Schema.Literal<"InferenceCompleted">;
1531
+ readonly schemaVersion: Schema.Literal<number>;
1532
+ readonly payload: Schema.Struct<{
1533
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1534
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1535
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
1536
+ readonly finishReason: Schema.optionalKey<Schema.String>;
1537
+ readonly usage: Schema.optionalKey<Schema.Struct<{
1538
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
1539
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
1540
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
1541
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
1542
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
1543
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
1544
+ }>>;
1545
+ readonly responseMetadata: Schema.optionalKey<Schema.Unknown>;
1546
+ readonly finishMetadata: Schema.optionalKey<Schema.Unknown>;
1547
+ }>;
1548
+ }>, Schema.Struct<{
1549
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1550
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1551
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1552
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1553
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1554
+ readonly span: Schema.Struct<{
1555
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1556
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1557
+ readonly sampled: Schema.Boolean;
1558
+ readonly tracestate: Schema.NullOr<Schema.String>;
1559
+ }>;
1560
+ readonly links: Schema.$Array<Schema.Struct<{
1561
+ readonly context: Schema.Struct<{
1562
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1563
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1564
+ readonly sampled: Schema.Boolean;
1565
+ readonly tracestate: Schema.NullOr<Schema.String>;
1566
+ }>;
1567
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1568
+ }>>;
1569
+ }>>;
1570
+ readonly durability: Schema.Literal<"durable">;
1571
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1572
+ readonly type: Schema.Literal<"InferenceFailed">;
1573
+ readonly schemaVersion: Schema.Literal<number>;
1574
+ readonly payload: Schema.Struct<{
1575
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1576
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1577
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
1578
+ readonly error: Schema.Struct<{
1579
+ readonly message: Schema.String;
1580
+ readonly code: Schema.optionalKey<Schema.String>;
1581
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1582
+ }>;
1583
+ }>;
1584
+ }>]>, Schema.Union<readonly [Schema.Struct<{
1585
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1586
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1587
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1588
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1589
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1590
+ readonly span: Schema.Struct<{
1591
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1592
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1593
+ readonly sampled: Schema.Boolean;
1594
+ readonly tracestate: Schema.NullOr<Schema.String>;
1595
+ }>;
1596
+ readonly links: Schema.$Array<Schema.Struct<{
1597
+ readonly context: Schema.Struct<{
1598
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1599
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1600
+ readonly sampled: Schema.Boolean;
1601
+ readonly tracestate: Schema.NullOr<Schema.String>;
1602
+ }>;
1603
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1604
+ }>>;
1605
+ }>>;
1606
+ readonly durability: Schema.Literal<"durable">;
1607
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1608
+ readonly type: Schema.Literal<"ToolCallCreated">;
1609
+ readonly schemaVersion: Schema.Literal<number>;
1610
+ readonly payload: Schema.Struct<{
1611
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1612
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1613
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
1614
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
1615
+ readonly promptPart: Schema.Struct<{
1616
+ readonly type: Schema.Literal<"tool-call">;
1617
+ readonly params: Schema.Unknown;
1618
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
1619
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1620
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1621
+ readonly id: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
1622
+ readonly name: Schema.NonEmptyString;
1623
+ }>;
1624
+ }>;
1625
+ }>, Schema.Struct<{
1626
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1627
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1628
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1629
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1630
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1631
+ readonly span: Schema.Struct<{
1632
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1633
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1634
+ readonly sampled: Schema.Boolean;
1635
+ readonly tracestate: Schema.NullOr<Schema.String>;
1636
+ }>;
1637
+ readonly links: Schema.$Array<Schema.Struct<{
1638
+ readonly context: Schema.Struct<{
1639
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1640
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1641
+ readonly sampled: Schema.Boolean;
1642
+ readonly tracestate: Schema.NullOr<Schema.String>;
1643
+ }>;
1644
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1645
+ }>>;
1646
+ }>>;
1647
+ readonly durability: Schema.Literal<"durable">;
1648
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1649
+ readonly type: Schema.Literal<"ToolCallRejected">;
1650
+ readonly schemaVersion: Schema.Literal<number>;
1651
+ readonly payload: Schema.Struct<{
1652
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1653
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1654
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
1655
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
1656
+ readonly promptPart: Schema.Struct<{
1657
+ readonly type: Schema.Literal<"tool-result">;
1658
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
1659
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1660
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1661
+ readonly id: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
1662
+ readonly name: Schema.NonEmptyString;
1663
+ readonly isFailure: Schema.Literal<true>;
1664
+ readonly result: Schema.Struct<{
1665
+ readonly message: Schema.String;
1666
+ readonly reason: Schema.Literals<readonly ["unknown-tool", "invalid-params"]>;
1667
+ readonly modelFeedback: Schema.NonEmptyString;
1668
+ }>;
1669
+ }>;
1670
+ }>;
1671
+ }>, Schema.Struct<{
1672
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1673
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1674
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1675
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1676
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1677
+ readonly span: Schema.Struct<{
1678
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1679
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1680
+ readonly sampled: Schema.Boolean;
1681
+ readonly tracestate: Schema.NullOr<Schema.String>;
1682
+ }>;
1683
+ readonly links: Schema.$Array<Schema.Struct<{
1684
+ readonly context: Schema.Struct<{
1685
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1686
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1687
+ readonly sampled: Schema.Boolean;
1688
+ readonly tracestate: Schema.NullOr<Schema.String>;
1689
+ }>;
1690
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1691
+ }>>;
1692
+ }>>;
1693
+ readonly durability: Schema.Literal<"durable">;
1694
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1695
+ readonly type: Schema.Literal<"ToolCallStarted">;
1696
+ readonly schemaVersion: Schema.Literal<number>;
1697
+ readonly payload: Schema.Struct<{
1698
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
1699
+ }>;
1700
+ }>, Schema.Struct<{
1701
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1702
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1703
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1704
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1705
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1706
+ readonly span: Schema.Struct<{
1707
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1708
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1709
+ readonly sampled: Schema.Boolean;
1710
+ readonly tracestate: Schema.NullOr<Schema.String>;
1711
+ }>;
1712
+ readonly links: Schema.$Array<Schema.Struct<{
1713
+ readonly context: Schema.Struct<{
1714
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1715
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1716
+ readonly sampled: Schema.Boolean;
1717
+ readonly tracestate: Schema.NullOr<Schema.String>;
1718
+ }>;
1719
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1720
+ }>>;
1721
+ }>>;
1722
+ readonly durability: Schema.Literal<"durable">;
1723
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1724
+ readonly type: Schema.Literal<"ToolCallCompleted">;
1725
+ readonly schemaVersion: Schema.Literal<number>;
1726
+ readonly payload: Schema.Struct<{
1727
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
1728
+ readonly promptPart: Schema.Struct<{
1729
+ readonly type: Schema.Literal<"tool-result">;
1730
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
1731
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1732
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1733
+ readonly id: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
1734
+ readonly name: Schema.NonEmptyString;
1735
+ readonly isFailure: Schema.Literal<false>;
1736
+ readonly result: Schema.Unknown;
1737
+ }>;
1738
+ }>;
1739
+ }>, Schema.Struct<{
1740
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1741
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1742
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1743
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1744
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1745
+ readonly span: Schema.Struct<{
1746
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1747
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1748
+ readonly sampled: Schema.Boolean;
1749
+ readonly tracestate: Schema.NullOr<Schema.String>;
1750
+ }>;
1751
+ readonly links: Schema.$Array<Schema.Struct<{
1752
+ readonly context: Schema.Struct<{
1753
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1754
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1755
+ readonly sampled: Schema.Boolean;
1756
+ readonly tracestate: Schema.NullOr<Schema.String>;
1757
+ }>;
1758
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1759
+ }>>;
1760
+ }>>;
1761
+ readonly durability: Schema.Literal<"durable">;
1762
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1763
+ readonly type: Schema.Literal<"ToolCallFailed">;
1764
+ readonly schemaVersion: Schema.Literal<number>;
1765
+ readonly payload: Schema.Struct<{
1766
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
1767
+ readonly error: Schema.optionalKey<Schema.Struct<{
1768
+ readonly message: Schema.String;
1769
+ readonly code: Schema.optionalKey<Schema.String>;
1770
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1771
+ }>>;
1772
+ readonly promptPart: Schema.Struct<{
1773
+ readonly type: Schema.Literal<"tool-result">;
1774
+ readonly providerExecuted: Schema.withDecodingDefault<Schema.Boolean>;
1775
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1776
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1777
+ readonly id: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
1778
+ readonly name: Schema.NonEmptyString;
1779
+ readonly isFailure: Schema.Literal<true>;
1780
+ readonly result: Schema.Struct<{
1781
+ readonly message: Schema.String;
1782
+ readonly code: Schema.optionalKey<Schema.String>;
1783
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1784
+ }>;
1785
+ }>;
1786
+ }>;
1787
+ }>]>, Schema.Union<readonly [Schema.Struct<{
1788
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1789
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1790
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1791
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1792
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1793
+ readonly span: Schema.Struct<{
1794
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1795
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1796
+ readonly sampled: Schema.Boolean;
1797
+ readonly tracestate: Schema.NullOr<Schema.String>;
1798
+ }>;
1799
+ readonly links: Schema.$Array<Schema.Struct<{
1800
+ readonly context: Schema.Struct<{
1801
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1802
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1803
+ readonly sampled: Schema.Boolean;
1804
+ readonly tracestate: Schema.NullOr<Schema.String>;
1805
+ }>;
1806
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1807
+ }>>;
1808
+ }>>;
1809
+ readonly durability: Schema.Literal<"durable">;
1810
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1811
+ readonly type: Schema.Literal<"StopTurnRequested">;
1812
+ readonly schemaVersion: Schema.Literal<number>;
1813
+ readonly payload: Schema.Struct<{
1814
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
1815
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
1816
+ readonly turnId: Schema.optionalKey<Schema.brand<Schema.String, "TurnId">>;
1817
+ }>;
1818
+ }>, Schema.Struct<{
1819
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1820
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1821
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1822
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1823
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1824
+ readonly span: Schema.Struct<{
1825
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1826
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1827
+ readonly sampled: Schema.Boolean;
1828
+ readonly tracestate: Schema.NullOr<Schema.String>;
1829
+ }>;
1830
+ readonly links: Schema.$Array<Schema.Struct<{
1831
+ readonly context: Schema.Struct<{
1832
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1833
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1834
+ readonly sampled: Schema.Boolean;
1835
+ readonly tracestate: Schema.NullOr<Schema.String>;
1836
+ }>;
1837
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1838
+ }>>;
1839
+ }>>;
1840
+ readonly durability: Schema.Literal<"durable">;
1841
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1842
+ readonly type: Schema.Literal<"StopTurnApplied">;
1843
+ readonly schemaVersion: Schema.Literal<number>;
1844
+ readonly payload: Schema.Struct<{
1845
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
1846
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1847
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1848
+ readonly inferenceId: Schema.optionalKey<Schema.brand<Schema.String, "InferenceId">>;
1849
+ }>;
1850
+ }>]>, Schema.Union<readonly [Schema.Struct<{
1851
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1852
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1853
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1854
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1855
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1856
+ readonly span: Schema.Struct<{
1857
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1858
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1859
+ readonly sampled: Schema.Boolean;
1860
+ readonly tracestate: Schema.NullOr<Schema.String>;
1861
+ }>;
1862
+ readonly links: Schema.$Array<Schema.Struct<{
1863
+ readonly context: Schema.Struct<{
1864
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1865
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1866
+ readonly sampled: Schema.Boolean;
1867
+ readonly tracestate: Schema.NullOr<Schema.String>;
1868
+ }>;
1869
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1870
+ }>>;
1871
+ }>>;
1872
+ readonly durability: Schema.Literal<"durable">;
1873
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1874
+ readonly type: Schema.Literal<"ContextProjected">;
1875
+ readonly schemaVersion: Schema.Literal<number>;
1876
+ readonly payload: Schema.Struct<{
1877
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
1878
+ readonly throughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1879
+ }>;
1880
+ }>, Schema.Struct<{
1881
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1882
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1883
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1884
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1885
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1886
+ readonly span: Schema.Struct<{
1887
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1888
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1889
+ readonly sampled: Schema.Boolean;
1890
+ readonly tracestate: Schema.NullOr<Schema.String>;
1891
+ }>;
1892
+ readonly links: Schema.$Array<Schema.Struct<{
1893
+ readonly context: Schema.Struct<{
1894
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1895
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1896
+ readonly sampled: Schema.Boolean;
1897
+ readonly tracestate: Schema.NullOr<Schema.String>;
1898
+ }>;
1899
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1900
+ }>>;
1901
+ }>>;
1902
+ readonly durability: Schema.Literal<"durable">;
1903
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1904
+ readonly type: Schema.Literal<"CompactionRequested">;
1905
+ readonly schemaVersion: Schema.Literal<number>;
1906
+ readonly payload: Schema.Struct<{
1907
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
1908
+ readonly sourceFromSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1909
+ readonly sourceToSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1910
+ }>;
1911
+ }>, Schema.Struct<{
1912
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1913
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1914
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1915
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1916
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1917
+ readonly span: Schema.Struct<{
1918
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1919
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1920
+ readonly sampled: Schema.Boolean;
1921
+ readonly tracestate: Schema.NullOr<Schema.String>;
1922
+ }>;
1923
+ readonly links: Schema.$Array<Schema.Struct<{
1924
+ readonly context: Schema.Struct<{
1925
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1926
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1927
+ readonly sampled: Schema.Boolean;
1928
+ readonly tracestate: Schema.NullOr<Schema.String>;
1929
+ }>;
1930
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1931
+ }>>;
1932
+ }>>;
1933
+ readonly durability: Schema.Literal<"durable">;
1934
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1935
+ readonly type: Schema.Literal<"CompactionStarted">;
1936
+ readonly schemaVersion: Schema.Literal<number>;
1937
+ readonly payload: Schema.Struct<{
1938
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
1939
+ }>;
1940
+ }>, Schema.Struct<{
1941
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1942
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1943
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1944
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1945
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1946
+ readonly span: Schema.Struct<{
1947
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1948
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1949
+ readonly sampled: Schema.Boolean;
1950
+ readonly tracestate: Schema.NullOr<Schema.String>;
1951
+ }>;
1952
+ readonly links: Schema.$Array<Schema.Struct<{
1953
+ readonly context: Schema.Struct<{
1954
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1955
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1956
+ readonly sampled: Schema.Boolean;
1957
+ readonly tracestate: Schema.NullOr<Schema.String>;
1958
+ }>;
1959
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1960
+ }>>;
1961
+ }>>;
1962
+ readonly durability: Schema.Literal<"durable">;
1963
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1964
+ readonly type: Schema.Literal<"SummaryCreated">;
1965
+ readonly schemaVersion: Schema.Literal<number>;
1966
+ readonly payload: Schema.Struct<{
1967
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
1968
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
1969
+ readonly sourceFromSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1970
+ readonly sourceToSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1971
+ readonly summary: Schema.Unknown;
1972
+ }>;
1973
+ }>, Schema.Struct<{
1974
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
1975
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
1976
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
1977
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1978
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
1979
+ readonly span: Schema.Struct<{
1980
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1981
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1982
+ readonly sampled: Schema.Boolean;
1983
+ readonly tracestate: Schema.NullOr<Schema.String>;
1984
+ }>;
1985
+ readonly links: Schema.$Array<Schema.Struct<{
1986
+ readonly context: Schema.Struct<{
1987
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
1988
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
1989
+ readonly sampled: Schema.Boolean;
1990
+ readonly tracestate: Schema.NullOr<Schema.String>;
1991
+ }>;
1992
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
1993
+ }>>;
1994
+ }>>;
1995
+ readonly durability: Schema.Literal<"durable">;
1996
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
1997
+ readonly type: Schema.Literal<"CompactionCompleted">;
1998
+ readonly schemaVersion: Schema.Literal<number>;
1999
+ readonly payload: Schema.Struct<{
2000
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
2001
+ readonly modelSelection: Schema.optionalKey<Schema.Struct<{
2002
+ readonly provider: Schema.NonEmptyString;
2003
+ readonly modelId: Schema.NonEmptyString;
2004
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
2005
+ }>>;
2006
+ readonly usage: Schema.optionalKey<Schema.Struct<{
2007
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
2008
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
2009
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
2010
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
2011
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
2012
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
2013
+ }>>;
2014
+ }>;
2015
+ }>, Schema.Struct<{
2016
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2017
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2018
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2019
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2020
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2021
+ readonly span: Schema.Struct<{
2022
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2023
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2024
+ readonly sampled: Schema.Boolean;
2025
+ readonly tracestate: Schema.NullOr<Schema.String>;
2026
+ }>;
2027
+ readonly links: Schema.$Array<Schema.Struct<{
2028
+ readonly context: Schema.Struct<{
2029
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2030
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2031
+ readonly sampled: Schema.Boolean;
2032
+ readonly tracestate: Schema.NullOr<Schema.String>;
2033
+ }>;
2034
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2035
+ }>>;
2036
+ }>>;
2037
+ readonly durability: Schema.Literal<"durable">;
2038
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2039
+ readonly type: Schema.Literal<"ContextRebased">;
2040
+ readonly schemaVersion: Schema.Literal<number>;
2041
+ readonly payload: Schema.Struct<{
2042
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
2043
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
2044
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
2045
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2046
+ }>;
2047
+ }>, Schema.Struct<{
2048
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2049
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2050
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2051
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2052
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2053
+ readonly span: Schema.Struct<{
2054
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2055
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2056
+ readonly sampled: Schema.Boolean;
2057
+ readonly tracestate: Schema.NullOr<Schema.String>;
2058
+ }>;
2059
+ readonly links: Schema.$Array<Schema.Struct<{
2060
+ readonly context: Schema.Struct<{
2061
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2062
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2063
+ readonly sampled: Schema.Boolean;
2064
+ readonly tracestate: Schema.NullOr<Schema.String>;
2065
+ }>;
2066
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2067
+ }>>;
2068
+ }>>;
2069
+ readonly durability: Schema.Literal<"durable">;
2070
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2071
+ readonly type: Schema.Literal<"CompactionFailed">;
2072
+ readonly schemaVersion: Schema.Literal<number>;
2073
+ readonly payload: Schema.Struct<{
2074
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
2075
+ readonly error: Schema.Struct<{
2076
+ readonly message: Schema.String;
2077
+ readonly code: Schema.optionalKey<Schema.String>;
2078
+ readonly details: Schema.optionalKey<Schema.Unknown>;
2079
+ }>;
2080
+ readonly modelSelection: Schema.optionalKey<Schema.Struct<{
2081
+ readonly provider: Schema.NonEmptyString;
2082
+ readonly modelId: Schema.NonEmptyString;
2083
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
2084
+ }>>;
2085
+ readonly usage: Schema.optionalKey<Schema.Struct<{
2086
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
2087
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
2088
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
2089
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
2090
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
2091
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
2092
+ }>>;
2093
+ }>;
2094
+ }>]>, Schema.Union<readonly [Schema.Struct<{
2095
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2096
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2097
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2098
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2099
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2100
+ readonly span: Schema.Struct<{
2101
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2102
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2103
+ readonly sampled: Schema.Boolean;
2104
+ readonly tracestate: Schema.NullOr<Schema.String>;
2105
+ }>;
2106
+ readonly links: Schema.$Array<Schema.Struct<{
2107
+ readonly context: Schema.Struct<{
2108
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2109
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2110
+ readonly sampled: Schema.Boolean;
2111
+ readonly tracestate: Schema.NullOr<Schema.String>;
2112
+ }>;
2113
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2114
+ }>>;
2115
+ }>>;
2116
+ readonly durability: Schema.Literal<"durable">;
2117
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2118
+ readonly type: Schema.Literal<"BaseStateRequested">;
2119
+ readonly schemaVersion: Schema.Literal<number>;
2120
+ readonly payload: Schema.Struct<{
2121
+ readonly baseStateId: Schema.brand<Schema.String, "BaseStateId">;
2122
+ readonly requestedThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2123
+ }>;
2124
+ }>, Schema.Struct<{
2125
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2126
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2127
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2128
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2129
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2130
+ readonly span: Schema.Struct<{
2131
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2132
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2133
+ readonly sampled: Schema.Boolean;
2134
+ readonly tracestate: Schema.NullOr<Schema.String>;
2135
+ }>;
2136
+ readonly links: Schema.$Array<Schema.Struct<{
2137
+ readonly context: Schema.Struct<{
2138
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2139
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2140
+ readonly sampled: Schema.Boolean;
2141
+ readonly tracestate: Schema.NullOr<Schema.String>;
2142
+ }>;
2143
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2144
+ }>>;
2145
+ }>>;
2146
+ readonly durability: Schema.Literal<"durable">;
2147
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2148
+ readonly type: Schema.Literal<"BaseStateCreated">;
2149
+ readonly schemaVersion: Schema.Literal<number>;
2150
+ readonly payload: Schema.Struct<{
2151
+ readonly baseStateId: Schema.brand<Schema.String, "BaseStateId">;
2152
+ readonly coversThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2153
+ }>;
2154
+ }>, Schema.Struct<{
2155
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2156
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2157
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2158
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2159
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2160
+ readonly span: Schema.Struct<{
2161
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2162
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2163
+ readonly sampled: Schema.Boolean;
2164
+ readonly tracestate: Schema.NullOr<Schema.String>;
2165
+ }>;
2166
+ readonly links: Schema.$Array<Schema.Struct<{
2167
+ readonly context: Schema.Struct<{
2168
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2169
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2170
+ readonly sampled: Schema.Boolean;
2171
+ readonly tracestate: Schema.NullOr<Schema.String>;
2172
+ }>;
2173
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2174
+ }>>;
2175
+ }>>;
2176
+ readonly durability: Schema.Literal<"durable">;
2177
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2178
+ readonly type: Schema.Literal<"BaseStateFailed">;
2179
+ readonly schemaVersion: Schema.Literal<number>;
2180
+ readonly payload: Schema.Struct<{
2181
+ readonly baseStateId: Schema.brand<Schema.String, "BaseStateId">;
2182
+ readonly error: Schema.Struct<{
2183
+ readonly message: Schema.String;
2184
+ readonly code: Schema.optionalKey<Schema.String>;
2185
+ readonly details: Schema.optionalKey<Schema.Unknown>;
2186
+ }>;
2187
+ }>;
2188
+ }>]>]>]>, Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
2189
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2190
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2191
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2192
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2193
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2194
+ readonly span: Schema.Struct<{
2195
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2196
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2197
+ readonly sampled: Schema.Boolean;
2198
+ readonly tracestate: Schema.NullOr<Schema.String>;
2199
+ }>;
2200
+ readonly links: Schema.$Array<Schema.Struct<{
2201
+ readonly context: Schema.Struct<{
2202
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2203
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2204
+ readonly sampled: Schema.Boolean;
2205
+ readonly tracestate: Schema.NullOr<Schema.String>;
2206
+ }>;
2207
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2208
+ }>>;
2209
+ }>>;
2210
+ readonly durability: Schema.Literal<"ephemeral">;
2211
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2212
+ readonly type: Schema.Literal<"TextDelta">;
2213
+ readonly schemaVersion: Schema.Literal<number>;
2214
+ readonly payload: Schema.Struct<{
2215
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2216
+ readonly delta: Schema.String;
2217
+ }>;
2218
+ }>, Schema.Struct<{
2219
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2220
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2221
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2222
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2223
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2224
+ readonly span: Schema.Struct<{
2225
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2226
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2227
+ readonly sampled: Schema.Boolean;
2228
+ readonly tracestate: Schema.NullOr<Schema.String>;
2229
+ }>;
2230
+ readonly links: Schema.$Array<Schema.Struct<{
2231
+ readonly context: Schema.Struct<{
2232
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2233
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2234
+ readonly sampled: Schema.Boolean;
2235
+ readonly tracestate: Schema.NullOr<Schema.String>;
2236
+ }>;
2237
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2238
+ }>>;
2239
+ }>>;
2240
+ readonly durability: Schema.Literal<"ephemeral">;
2241
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2242
+ readonly type: Schema.Literal<"ReasoningDelta">;
2243
+ readonly schemaVersion: Schema.Literal<number>;
2244
+ readonly payload: Schema.Struct<{
2245
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2246
+ readonly delta: Schema.String;
2247
+ }>;
2248
+ }>, Schema.Struct<{
2249
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2250
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2251
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2252
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2253
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2254
+ readonly span: Schema.Struct<{
2255
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2256
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2257
+ readonly sampled: Schema.Boolean;
2258
+ readonly tracestate: Schema.NullOr<Schema.String>;
2259
+ }>;
2260
+ readonly links: Schema.$Array<Schema.Struct<{
2261
+ readonly context: Schema.Struct<{
2262
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2263
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2264
+ readonly sampled: Schema.Boolean;
2265
+ readonly tracestate: Schema.NullOr<Schema.String>;
2266
+ }>;
2267
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2268
+ }>>;
2269
+ }>>;
2270
+ readonly durability: Schema.Literal<"ephemeral">;
2271
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2272
+ readonly type: Schema.Literal<"ToolParamsStart">;
2273
+ readonly schemaVersion: Schema.Literal<number>;
2274
+ readonly payload: Schema.Struct<{
2275
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2276
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
2277
+ readonly toolName: Schema.NonEmptyString;
2278
+ readonly providerExecuted: Schema.Boolean;
2279
+ }>;
2280
+ }>, Schema.Struct<{
2281
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2282
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2283
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2284
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2285
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2286
+ readonly span: Schema.Struct<{
2287
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2288
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2289
+ readonly sampled: Schema.Boolean;
2290
+ readonly tracestate: Schema.NullOr<Schema.String>;
2291
+ }>;
2292
+ readonly links: Schema.$Array<Schema.Struct<{
2293
+ readonly context: Schema.Struct<{
2294
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2295
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2296
+ readonly sampled: Schema.Boolean;
2297
+ readonly tracestate: Schema.NullOr<Schema.String>;
2298
+ }>;
2299
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2300
+ }>>;
2301
+ }>>;
2302
+ readonly durability: Schema.Literal<"ephemeral">;
2303
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2304
+ readonly type: Schema.Literal<"ToolParamsDelta">;
2305
+ readonly schemaVersion: Schema.Literal<number>;
2306
+ readonly payload: Schema.Struct<{
2307
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2308
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
2309
+ readonly delta: Schema.String;
2310
+ }>;
2311
+ }>, Schema.Struct<{
2312
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2313
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2314
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2315
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2316
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2317
+ readonly span: Schema.Struct<{
2318
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2319
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2320
+ readonly sampled: Schema.Boolean;
2321
+ readonly tracestate: Schema.NullOr<Schema.String>;
2322
+ }>;
2323
+ readonly links: Schema.$Array<Schema.Struct<{
2324
+ readonly context: Schema.Struct<{
2325
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2326
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2327
+ readonly sampled: Schema.Boolean;
2328
+ readonly tracestate: Schema.NullOr<Schema.String>;
2329
+ }>;
2330
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2331
+ }>>;
2332
+ }>>;
2333
+ readonly durability: Schema.Literal<"ephemeral">;
2334
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2335
+ readonly type: Schema.Literal<"ToolParamsEnd">;
2336
+ readonly schemaVersion: Schema.Literal<number>;
2337
+ readonly payload: Schema.Struct<{
2338
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2339
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
2340
+ }>;
2341
+ }>]>, Schema.Union<readonly [Schema.Struct<{
2342
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2343
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2344
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2345
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2346
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2347
+ readonly span: Schema.Struct<{
2348
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2349
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2350
+ readonly sampled: Schema.Boolean;
2351
+ readonly tracestate: Schema.NullOr<Schema.String>;
2352
+ }>;
2353
+ readonly links: Schema.$Array<Schema.Struct<{
2354
+ readonly context: Schema.Struct<{
2355
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2356
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2357
+ readonly sampled: Schema.Boolean;
2358
+ readonly tracestate: Schema.NullOr<Schema.String>;
2359
+ }>;
2360
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2361
+ }>>;
2362
+ }>>;
2363
+ readonly durability: Schema.Literal<"ephemeral">;
2364
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2365
+ readonly type: Schema.Literal<"SubscriberStatus">;
2366
+ readonly schemaVersion: Schema.Literal<number>;
2367
+ readonly payload: Schema.Struct<{
2368
+ readonly status: Schema.Literals<readonly ["connected", "catching-up", "live", "lagging", "closed"]>;
2369
+ readonly reason: Schema.optionalKey<Schema.String>;
2370
+ }>;
2371
+ }>, Schema.Struct<{
2372
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2373
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2374
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2375
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2376
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2377
+ readonly span: Schema.Struct<{
2378
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2379
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2380
+ readonly sampled: Schema.Boolean;
2381
+ readonly tracestate: Schema.NullOr<Schema.String>;
2382
+ }>;
2383
+ readonly links: Schema.$Array<Schema.Struct<{
2384
+ readonly context: Schema.Struct<{
2385
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2386
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2387
+ readonly sampled: Schema.Boolean;
2388
+ readonly tracestate: Schema.NullOr<Schema.String>;
2389
+ }>;
2390
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2391
+ }>>;
2392
+ }>>;
2393
+ readonly durability: Schema.Literal<"ephemeral">;
2394
+ readonly namespace: Schema.Literal<"effect-durable-agent">;
2395
+ readonly type: Schema.Literal<"TraceStatus">;
2396
+ readonly schemaVersion: Schema.Literal<number>;
2397
+ readonly payload: Schema.Struct<{
2398
+ readonly status: Schema.Literals<readonly ["span-started", "span-ended", "span-failed"]>;
2399
+ readonly spanName: Schema.NonEmptyString;
2400
+ readonly details: Schema.optionalKey<Schema.Unknown>;
2401
+ }>;
2402
+ }>]>]>]>;
2403
+ type EDAFrameworkWebSocketEvent = typeof EDAFrameworkWebSocketEvent.Type;
2404
+ declare const makeEDAWebSocketDomainSchemas: <EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>>(event: EventSchema) => {
2405
+ event: EventSchema;
2406
+ positionedEvent: Schema.Struct<{
2407
+ readonly position: Schema.Struct<{
2408
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2409
+ readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
2410
+ }>;
2411
+ readonly event: EventSchema;
2412
+ }>;
2413
+ eventsFrame: Schema.Struct<{
2414
+ readonly _tag: Schema.Literal<"events">;
2415
+ readonly frameId: Schema.Int;
2416
+ readonly events: Schema.NonEmptyArray<Schema.Struct<{
2417
+ readonly position: Schema.Struct<{
2418
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2419
+ readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
2420
+ }>;
2421
+ readonly event: EventSchema;
2422
+ }>>;
2423
+ readonly durableThroughSeq: Schema.Int;
2424
+ }>;
2425
+ serverFrame: Schema.Union<readonly [Schema.Struct<{
2426
+ readonly _tag: Schema.Literal<"hello">;
2427
+ readonly protocolVersion: Schema.Literal<1>;
2428
+ readonly subscriberId: Schema.NonEmptyString;
2429
+ readonly resumeSeq: Schema.Int;
2430
+ readonly flowControl: Schema.Struct<{
2431
+ readonly ackTimeoutMs: Schema.Int;
2432
+ /** Deprecated: servers no longer send heartbeat frames. Kept so deployed clients can decode hello. */
2433
+ readonly heartbeatIntervalMs: Schema.Int;
2434
+ readonly maxFrameBytes: Schema.Int;
2435
+ readonly maxFrameEvents: Schema.Int;
2436
+ readonly maxInFlightFrames: Schema.Int;
2437
+ /** Suggested client-originated ping cadence; absent on servers that still send heartbeats. */
2438
+ readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
2439
+ readonly subscriberBufferCapacityEvents: Schema.Int;
2440
+ }>;
2441
+ }>, Schema.Struct<{
2442
+ readonly _tag: Schema.Literal<"events">;
2443
+ readonly frameId: Schema.Int;
2444
+ readonly events: Schema.NonEmptyArray<Schema.Struct<{
2445
+ readonly position: Schema.Struct<{
2446
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2447
+ readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
2448
+ }>;
2449
+ readonly event: EventSchema;
2450
+ }>>;
2451
+ readonly durableThroughSeq: Schema.Int;
2452
+ }>, Schema.Struct<{
2453
+ readonly _tag: Schema.Literal<"heartbeat">;
2454
+ readonly serverTimeMs: Schema.Int;
2455
+ readonly durableThroughSeq: Schema.Int;
2456
+ }>, Schema.Struct<{
2457
+ readonly _tag: Schema.Literal<"pong">;
2458
+ }>, Schema.Struct<{
2459
+ readonly _tag: Schema.Literal<"lagged">;
2460
+ readonly resumeSeq: Schema.Int;
2461
+ readonly reason: Schema.Literals<readonly ["buffer-overflow", "ack-timeout"]>;
2462
+ }>, Schema.Struct<{
2463
+ readonly _tag: Schema.Literal<"error">;
2464
+ readonly message: Schema.String;
2465
+ }>]>;
2466
+ };
2467
+ type EDAWebSocketDomainSchemas<EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>> = ReturnType<typeof makeEDAWebSocketDomainSchemas<EventSchema>>;
2468
+ declare const EDAWebSocketHostDomain: {
2469
+ event: Schema.Struct<{
2470
+ readonly namespace: Schema.NonEmptyString;
2471
+ readonly type: Schema.NonEmptyString;
2472
+ readonly schemaVersion: Schema.Int;
2473
+ readonly durability: Schema.Literals<readonly ["durable", "ephemeral"]>;
2474
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2475
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2476
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2477
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2478
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2479
+ readonly span: Schema.Struct<{
2480
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2481
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2482
+ readonly sampled: Schema.Boolean;
2483
+ readonly tracestate: Schema.NullOr<Schema.String>;
2484
+ }>;
2485
+ readonly links: Schema.$Array<Schema.Struct<{
2486
+ readonly context: Schema.Struct<{
2487
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2488
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2489
+ readonly sampled: Schema.Boolean;
2490
+ readonly tracestate: Schema.NullOr<Schema.String>;
2491
+ }>;
2492
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2493
+ }>>;
2494
+ }>>;
2495
+ readonly payload: Schema.Unknown;
2496
+ }>;
2497
+ positionedEvent: Schema.Struct<{
2498
+ readonly position: Schema.Struct<{
2499
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2500
+ readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
2501
+ }>;
2502
+ readonly event: Schema.Struct<{
2503
+ readonly namespace: Schema.NonEmptyString;
2504
+ readonly type: Schema.NonEmptyString;
2505
+ readonly schemaVersion: Schema.Int;
2506
+ readonly durability: Schema.Literals<readonly ["durable", "ephemeral"]>;
2507
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2508
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2509
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2510
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2511
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2512
+ readonly span: Schema.Struct<{
2513
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2514
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2515
+ readonly sampled: Schema.Boolean;
2516
+ readonly tracestate: Schema.NullOr<Schema.String>;
2517
+ }>;
2518
+ readonly links: Schema.$Array<Schema.Struct<{
2519
+ readonly context: Schema.Struct<{
2520
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2521
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2522
+ readonly sampled: Schema.Boolean;
2523
+ readonly tracestate: Schema.NullOr<Schema.String>;
2524
+ }>;
2525
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2526
+ }>>;
2527
+ }>>;
2528
+ readonly payload: Schema.Unknown;
2529
+ }>;
2530
+ }>;
2531
+ eventsFrame: Schema.Struct<{
2532
+ readonly _tag: Schema.Literal<"events">;
2533
+ readonly frameId: Schema.Int;
2534
+ readonly events: Schema.NonEmptyArray<Schema.Struct<{
2535
+ readonly position: Schema.Struct<{
2536
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2537
+ readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
2538
+ }>;
2539
+ readonly event: Schema.Struct<{
2540
+ readonly namespace: Schema.NonEmptyString;
2541
+ readonly type: Schema.NonEmptyString;
2542
+ readonly schemaVersion: Schema.Int;
2543
+ readonly durability: Schema.Literals<readonly ["durable", "ephemeral"]>;
2544
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2545
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2546
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2547
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2548
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2549
+ readonly span: Schema.Struct<{
2550
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2551
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2552
+ readonly sampled: Schema.Boolean;
2553
+ readonly tracestate: Schema.NullOr<Schema.String>;
2554
+ }>;
2555
+ readonly links: Schema.$Array<Schema.Struct<{
2556
+ readonly context: Schema.Struct<{
2557
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2558
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2559
+ readonly sampled: Schema.Boolean;
2560
+ readonly tracestate: Schema.NullOr<Schema.String>;
2561
+ }>;
2562
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2563
+ }>>;
2564
+ }>>;
2565
+ readonly payload: Schema.Unknown;
2566
+ }>;
2567
+ }>>;
2568
+ readonly durableThroughSeq: Schema.Int;
2569
+ }>;
2570
+ serverFrame: Schema.Union<readonly [Schema.Struct<{
2571
+ readonly _tag: Schema.Literal<"hello">;
2572
+ readonly protocolVersion: Schema.Literal<1>;
2573
+ readonly subscriberId: Schema.NonEmptyString;
2574
+ readonly resumeSeq: Schema.Int;
2575
+ readonly flowControl: Schema.Struct<{
2576
+ readonly ackTimeoutMs: Schema.Int;
2577
+ /** Deprecated: servers no longer send heartbeat frames. Kept so deployed clients can decode hello. */
2578
+ readonly heartbeatIntervalMs: Schema.Int;
2579
+ readonly maxFrameBytes: Schema.Int;
2580
+ readonly maxFrameEvents: Schema.Int;
2581
+ readonly maxInFlightFrames: Schema.Int;
2582
+ /** Suggested client-originated ping cadence; absent on servers that still send heartbeats. */
2583
+ readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
2584
+ readonly subscriberBufferCapacityEvents: Schema.Int;
2585
+ }>;
2586
+ }>, Schema.Struct<{
2587
+ readonly _tag: Schema.Literal<"events">;
2588
+ readonly frameId: Schema.Int;
2589
+ readonly events: Schema.NonEmptyArray<Schema.Struct<{
2590
+ readonly position: Schema.Struct<{
2591
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2592
+ readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
2593
+ }>;
2594
+ readonly event: Schema.Struct<{
2595
+ readonly namespace: Schema.NonEmptyString;
2596
+ readonly type: Schema.NonEmptyString;
2597
+ readonly schemaVersion: Schema.Int;
2598
+ readonly durability: Schema.Literals<readonly ["durable", "ephemeral"]>;
2599
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2600
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2601
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2602
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2603
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2604
+ readonly span: Schema.Struct<{
2605
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2606
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2607
+ readonly sampled: Schema.Boolean;
2608
+ readonly tracestate: Schema.NullOr<Schema.String>;
2609
+ }>;
2610
+ readonly links: Schema.$Array<Schema.Struct<{
2611
+ readonly context: Schema.Struct<{
2612
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2613
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2614
+ readonly sampled: Schema.Boolean;
2615
+ readonly tracestate: Schema.NullOr<Schema.String>;
2616
+ }>;
2617
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2618
+ }>>;
2619
+ }>>;
2620
+ readonly payload: Schema.Unknown;
2621
+ }>;
2622
+ }>>;
2623
+ readonly durableThroughSeq: Schema.Int;
2624
+ }>, Schema.Struct<{
2625
+ readonly _tag: Schema.Literal<"heartbeat">;
2626
+ readonly serverTimeMs: Schema.Int;
2627
+ readonly durableThroughSeq: Schema.Int;
2628
+ }>, Schema.Struct<{
2629
+ readonly _tag: Schema.Literal<"pong">;
2630
+ }>, Schema.Struct<{
2631
+ readonly _tag: Schema.Literal<"lagged">;
2632
+ readonly resumeSeq: Schema.Int;
2633
+ readonly reason: Schema.Literals<readonly ["buffer-overflow", "ack-timeout"]>;
2634
+ }>, Schema.Struct<{
2635
+ readonly _tag: Schema.Literal<"error">;
2636
+ readonly message: Schema.String;
2637
+ }>]>;
2638
+ };
2639
+ /** Domain frame shape accepted by an app-bound encoder at the EDA host boundary. */
2640
+ type EDAWebSocketServerFrameInput = typeof EDAWebSocketHostDomain.serverFrame.Type;
2641
+ /** Minimal typed encoder surface consumed by an EDA host. */
2642
+ interface EDAWebSocketServerFrameEncoder {
2643
+ readonly encodeServerFrame: (frame: EDAWebSocketServerFrameInput) => string;
2644
+ }
2645
+ /** App-bound domain schemas, wire schemas, and encoders for protocol version 1. */
2646
+ interface EDAWebSocketWireProtocol<EventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>> {
2647
+ /** Exact app-bound schemas whose `Type` values are used inside the server. */
2648
+ readonly domain: EDAWebSocketDomainSchemas<EventSchema>;
2649
+ /** Exact app-bound schemas whose `Type` values are the serialized JSON representation. */
2650
+ readonly wire: {
2651
+ readonly event: Schema.toEncoded<EventSchema>;
2652
+ readonly positionedEvent: Schema.toEncoded<EDAWebSocketDomainSchemas<EventSchema>["positionedEvent"]>;
2653
+ readonly eventsFrame: Schema.toEncoded<EDAWebSocketDomainSchemas<EventSchema>["eventsFrame"]>;
2654
+ readonly serverFrame: Schema.toEncoded<EDAWebSocketDomainSchemas<EventSchema>["serverFrame"]>;
2655
+ readonly clientFrame: typeof EDAWebSocketWireClientFrame;
2656
+ };
2657
+ /** Serialize one exact app-bound domain frame to a JSON text message. */
2658
+ readonly encodeServerFrame: (frame: Schema.Schema.Type<EDAWebSocketDomainSchemas<EventSchema>["serverFrame"]>) => string;
2659
+ /** Validate broad host frames against the app event union before serialization. */
2660
+ readonly host: EDAWebSocketServerFrameEncoder;
2661
+ }
2662
+ /** Strict framework-only protocol used when an app registers no custom events. */
2663
+ declare const edaFrameworkWebSocketWireProtocol: EDAWebSocketWireProtocol<typeof EDAFrameworkWebSocketEvent>;
2664
+ /**
2665
+ * Bind the generic EDA WebSocket transport to one app's custom event schema.
2666
+ *
2667
+ * Framework durable and ephemeral events are included automatically. Future EDA
2668
+ * apps register only their custom events. Servers use the returned domain schemas
2669
+ * and typed encoder; external consumers decode with the wire schemas. Pass the
2670
+ * returned `host` adapter to the selected host package.
2671
+ */
2672
+ declare const makeEDAWebSocketWireProtocol: <AppEventSchema extends Schema.Codec<EventEnvelope, unknown, never, never>>(options: {
2673
+ readonly appEvents: AppEventSchema;
2674
+ }) => EDAWebSocketWireProtocol<Schema.Union<readonly [typeof EDAFrameworkWebSocketEvent, AppEventSchema]>>;
2675
+ //#endregion
2676
+ //#region src/websocket/messages.d.ts
2677
+ /** Current EDA live-event WebSocket protocol version. */
2678
+ declare const EDA_WEB_SOCKET_PROTOCOL_VERSION: 1;
2679
+ /** WebSocket close code used when a subscriber cannot keep up with live delivery. */
2680
+ declare const EDA_WS_CLOSE_LAGGED = 4008;
2681
+ /** WebSocket close code used for normal host-driven shutdown. */
2682
+ declare const EDA_WS_CLOSE_GOING_AWAY = 1001;
2683
+ /** WebSocket close code used for malformed client protocol messages. */
2684
+ declare const EDA_WS_CLOSE_PROTOCOL_ERROR = 1002;
2685
+ /** WebSocket close code used when the host cannot send a frame. */
2686
+ declare const EDA_WS_CLOSE_SEND_FAILED = 1011;
2687
+ /** WebSocket close code used for unsupported binary messages. */
2688
+ declare const EDA_WS_CLOSE_UNSUPPORTED_DATA = 1003;
2689
+ /** Live subscriber identity persisted in WebSocket attachments. */
2690
+ declare const SubscriberId: Schema.brand<Schema.NonEmptyString, "SubscriberId">;
2691
+ type SubscriberId = typeof SubscriberId.Type;
2692
+ /** Per-connection monotonically increasing server frame id. */
2693
+ declare const FrameId: Schema.brand<Schema.Int, "FrameId">;
2694
+ type FrameId = typeof FrameId.Type;
2695
+ /** Flow-control policy announced by the server in the hello frame. */
2696
+ declare const EDAWebSocketFlowControl: Schema.Struct<{
2697
+ readonly ackTimeoutMs: Schema.Int;
2698
+ readonly heartbeatIntervalMs: Schema.Int;
2699
+ readonly maxFrameBytes: Schema.Int;
2700
+ readonly maxFrameEvents: Schema.Int;
2701
+ readonly maxInFlightFrames: Schema.Int;
2702
+ readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
2703
+ readonly subscriberBufferCapacityEvents: Schema.Int;
2704
+ }>;
2705
+ type EDAWebSocketFlowControl = typeof EDAWebSocketFlowControl.Type;
2706
+ /** Default bounded policy sized for fast model deltas and large durable tool/message events. */
2707
+ declare const defaultEDAWebSocketFlowControl: EDAWebSocketFlowControl;
2708
+ /** First server frame; announces protocol and flow-control policy. */
2709
+ declare const EDAWebSocketHelloFrame: Schema.Struct<{
2710
+ readonly _tag: Schema.Literal<"hello">;
2711
+ readonly protocolVersion: Schema.Literal<1>;
2712
+ readonly flowControl: Schema.Struct<{
2713
+ readonly ackTimeoutMs: Schema.Int;
2714
+ readonly heartbeatIntervalMs: Schema.Int;
2715
+ readonly maxFrameBytes: Schema.Int;
2716
+ readonly maxFrameEvents: Schema.Int;
2717
+ readonly maxInFlightFrames: Schema.Int;
2718
+ readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
2719
+ readonly subscriberBufferCapacityEvents: Schema.Int;
2720
+ }>;
2721
+ readonly subscriberId: Schema.brand<Schema.NonEmptyString, "SubscriberId">;
2722
+ readonly resumeSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2723
+ }>;
2724
+ type EDAWebSocketHelloFrame = typeof EDAWebSocketHelloFrame.Type;
2725
+ /** Ordered positioned events delivered to the client. */
2726
+ declare const EDAWebSocketEventsFrame: Schema.Struct<{
2727
+ readonly _tag: Schema.Literal<"events">;
2728
+ readonly frameId: Schema.brand<Schema.Int, "FrameId">;
2729
+ readonly events: Schema.NonEmptyArray<Schema.Struct<{
2730
+ readonly position: Schema.Struct<{
2731
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2732
+ readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
2733
+ }>;
2734
+ readonly event: Schema.Struct<{
2735
+ readonly namespace: Schema.NonEmptyString;
2736
+ readonly type: Schema.NonEmptyString;
2737
+ readonly schemaVersion: Schema.Int;
2738
+ readonly durability: Schema.Literals<readonly ["durable", "ephemeral"]>;
2739
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2740
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2741
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2742
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2743
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2744
+ readonly span: Schema.Struct<{
2745
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2746
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2747
+ readonly sampled: Schema.Boolean;
2748
+ readonly tracestate: Schema.NullOr<Schema.String>;
2749
+ }>;
2750
+ readonly links: Schema.$Array<Schema.Struct<{
2751
+ readonly context: Schema.Struct<{
2752
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2753
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2754
+ readonly sampled: Schema.Boolean;
2755
+ readonly tracestate: Schema.NullOr<Schema.String>;
2756
+ }>;
2757
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2758
+ }>>;
2759
+ }>>;
2760
+ readonly payload: Schema.Unknown;
2761
+ }>;
2762
+ }>>;
2763
+ readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2764
+ }>;
2765
+ type EDAWebSocketEventsFrame = typeof EDAWebSocketEventsFrame.Type;
2766
+ /**
2767
+ * Deprecated idle server keepalive frame.
2768
+ *
2769
+ * Servers no longer send heartbeats; the schema remains so deployed clients
2770
+ * keep decoding the server frame union. Liveness is client-originated via
2771
+ * {@link EDAWebSocketPingFrame} and the host-level auto-response pong.
2772
+ */
2773
+ declare const EDAWebSocketHeartbeatFrame: Schema.Struct<{
2774
+ readonly _tag: Schema.Literal<"heartbeat">;
2775
+ readonly serverTimeMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2776
+ readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2777
+ }>;
2778
+ type EDAWebSocketHeartbeatFrame = typeof EDAWebSocketHeartbeatFrame.Type;
2779
+ /** Client liveness ping; hosts answer with a pong and never ACK-track it. */
2780
+ declare const EDAWebSocketPingFrame: Schema.Struct<{
2781
+ readonly _tag: Schema.Literal<"ping">;
2782
+ }>;
2783
+ type EDAWebSocketPingFrame = typeof EDAWebSocketPingFrame.Type;
2784
+ /** Server liveness pong; clients may ignore it and must not ACK it. */
2785
+ declare const EDAWebSocketPongFrame: Schema.Struct<{
2786
+ readonly _tag: Schema.Literal<"pong">;
2787
+ }>;
2788
+ type EDAWebSocketPongFrame = typeof EDAWebSocketPongFrame.Type;
2789
+ /** Optional final frame sent before a lag-close. */
2790
+ declare const EDAWebSocketLaggedFrame: Schema.Struct<{
2791
+ readonly _tag: Schema.Literal<"lagged">;
2792
+ readonly reason: Schema.Literals<readonly ["buffer-overflow", "ack-timeout"]>;
2793
+ readonly resumeSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2794
+ }>;
2795
+ type EDAWebSocketLaggedFrame = typeof EDAWebSocketLaggedFrame.Type;
2796
+ /** Optional final frame sent before a protocol/internal close. */
2797
+ declare const EDAWebSocketErrorFrame: Schema.Struct<{
2798
+ readonly _tag: Schema.Literal<"error">;
2799
+ readonly message: Schema.String;
2800
+ }>;
2801
+ type EDAWebSocketErrorFrame = typeof EDAWebSocketErrorFrame.Type;
2802
+ /** Server-to-client application frame union. */
2803
+ declare const EDAWebSocketServerFrame: Schema.Union<readonly [Schema.Struct<{
2804
+ readonly _tag: Schema.Literal<"hello">;
2805
+ readonly protocolVersion: Schema.Literal<1>;
2806
+ readonly flowControl: Schema.Struct<{
2807
+ readonly ackTimeoutMs: Schema.Int;
2808
+ readonly heartbeatIntervalMs: Schema.Int;
2809
+ readonly maxFrameBytes: Schema.Int;
2810
+ readonly maxFrameEvents: Schema.Int;
2811
+ readonly maxInFlightFrames: Schema.Int;
2812
+ readonly pingIntervalMs: Schema.optionalKey<Schema.Int>;
2813
+ readonly subscriberBufferCapacityEvents: Schema.Int;
2814
+ }>;
2815
+ readonly subscriberId: Schema.brand<Schema.NonEmptyString, "SubscriberId">;
2816
+ readonly resumeSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2817
+ }>, Schema.Struct<{
2818
+ readonly _tag: Schema.Literal<"events">;
2819
+ readonly frameId: Schema.brand<Schema.Int, "FrameId">;
2820
+ readonly events: Schema.NonEmptyArray<Schema.Struct<{
2821
+ readonly position: Schema.Struct<{
2822
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2823
+ readonly subSeq: Schema.brand<Schema.Int, "SubSequenceNumber">;
2824
+ }>;
2825
+ readonly event: Schema.Struct<{
2826
+ readonly namespace: Schema.NonEmptyString;
2827
+ readonly type: Schema.NonEmptyString;
2828
+ readonly schemaVersion: Schema.Int;
2829
+ readonly durability: Schema.Literals<readonly ["durable", "ephemeral"]>;
2830
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
2831
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
2832
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
2833
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2834
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
2835
+ readonly span: Schema.Struct<{
2836
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2837
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2838
+ readonly sampled: Schema.Boolean;
2839
+ readonly tracestate: Schema.NullOr<Schema.String>;
2840
+ }>;
2841
+ readonly links: Schema.$Array<Schema.Struct<{
2842
+ readonly context: Schema.Struct<{
2843
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
2844
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
2845
+ readonly sampled: Schema.Boolean;
2846
+ readonly tracestate: Schema.NullOr<Schema.String>;
2847
+ }>;
2848
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
2849
+ }>>;
2850
+ }>>;
2851
+ readonly payload: Schema.Unknown;
2852
+ }>;
2853
+ }>>;
2854
+ readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2855
+ }>, Schema.Struct<{
2856
+ readonly _tag: Schema.Literal<"heartbeat">;
2857
+ readonly serverTimeMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2858
+ readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2859
+ }>, Schema.Struct<{
2860
+ readonly _tag: Schema.Literal<"pong">;
2861
+ }>, Schema.Struct<{
2862
+ readonly _tag: Schema.Literal<"lagged">;
2863
+ readonly reason: Schema.Literals<readonly ["buffer-overflow", "ack-timeout"]>;
2864
+ readonly resumeSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2865
+ }>, Schema.Struct<{
2866
+ readonly _tag: Schema.Literal<"error">;
2867
+ readonly message: Schema.String;
2868
+ }>]>;
2869
+ type EDAWebSocketServerFrame = typeof EDAWebSocketServerFrame.Type;
2870
+ /** Client acknowledgement after applying a server frame. */
2871
+ declare const EDAWebSocketAckFrame: Schema.Struct<{
2872
+ readonly _tag: Schema.Literal<"ack">;
2873
+ readonly appliedUpdateSeq: Schema.optionalKey<Schema.Int>;
2874
+ readonly frameId: Schema.brand<Schema.Int, "FrameId">;
2875
+ readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2876
+ }>;
2877
+ type EDAWebSocketAckFrame = typeof EDAWebSocketAckFrame.Type;
2878
+ /** Client-to-server application frame union. */
2879
+ declare const EDAWebSocketClientFrame: Schema.Union<readonly [Schema.Struct<{
2880
+ readonly _tag: Schema.Literal<"ack">;
2881
+ readonly appliedUpdateSeq: Schema.optionalKey<Schema.Int>;
2882
+ readonly frameId: Schema.brand<Schema.Int, "FrameId">;
2883
+ readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2884
+ }>, Schema.Struct<{
2885
+ readonly _tag: Schema.Literal<"ping">;
2886
+ }>]>;
2887
+ type EDAWebSocketClientFrame = typeof EDAWebSocketClientFrame.Type;
2888
+ /** Serialize a server frame for a text WebSocket message. */
2889
+ declare const encodeEDAWebSocketServerFrame: (frame: EDAWebSocketServerFrame, protocol?: EDAWebSocketServerFrameEncoder) => string;
2890
+ /** Decode an inbound text WebSocket message at the host boundary. */
2891
+ declare const decodeEDAWebSocketClientMessage: (input: string) => Effect.Effect<EDAWebSocketClientFrame, unknown>;
2892
+ /** Short close reason that fits the WebSocket protocol reason limit. */
2893
+ declare const laggedCloseReason: (seq: SequenceNumber) => string;
2894
+ //#endregion
2895
+ //#region src/websocket/delivery.d.ts
2896
+ /** Slow subscriber reasons that intentionally close only the lagging socket. */
2897
+ declare const SubscriberLagReason: Schema.Literals<readonly ["buffer-overflow", "ack-timeout"]>;
2898
+ type SubscriberLagReason = typeof SubscriberLagReason.Type;
2899
+ /** One sent-but-unacknowledged events frame. */
2900
+ declare const EDAWebSocketInFlightFrame: Schema.Struct<{
2901
+ readonly frameId: Schema.brand<Schema.Int, "FrameId">;
2902
+ readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2903
+ readonly sentAtMs: Schema.Number;
2904
+ }>;
2905
+ type EDAWebSocketInFlightFrame = typeof EDAWebSocketInFlightFrame.Type;
2906
+ /** Compact consecutive host-suppressed receipts blocked by a visible ACK. */
2907
+ declare const EDAWebSocketSuppressedRange: Schema.Struct<{
2908
+ readonly fromFrameId: Schema.brand<Schema.Int, "FrameId">;
2909
+ readonly throughFrameId: Schema.brand<Schema.Int, "FrameId">;
2910
+ readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2911
+ }>;
2912
+ type EDAWebSocketSuppressedRange = typeof EDAWebSocketSuppressedRange.Type;
2913
+ /** Complete delivery bookkeeping persisted in the WebSocket attachment. */
2914
+ declare const EDAWebSocketDeliveryCheckpoint: Schema.Struct<{
2915
+ readonly lastAckedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2916
+ readonly lastAckedFrameId: Schema.Int;
2917
+ readonly lastSentFrameId: Schema.Int;
2918
+ readonly nextFrameId: Schema.Int;
2919
+ readonly sentDurableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2920
+ readonly inFlight: Schema.$Array<Schema.Struct<{
2921
+ readonly frameId: Schema.brand<Schema.Int, "FrameId">;
2922
+ readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2923
+ readonly sentAtMs: Schema.Number;
2924
+ }>>;
2925
+ /** Host-projected receipts waiting behind an earlier client-visible ACK. */
2926
+ readonly suppressed: Schema.optionalKey<Schema.$Array<Schema.Struct<{
2927
+ readonly fromFrameId: Schema.brand<Schema.Int, "FrameId">;
2928
+ readonly throughFrameId: Schema.brand<Schema.Int, "FrameId">;
2929
+ readonly durableThroughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2930
+ }>>>;
2931
+ }>;
2932
+ type EDAWebSocketDeliveryCheckpoint = typeof EDAWebSocketDeliveryCheckpoint.Type;
2933
+ /** In-memory delivery state for one accepted event WebSocket. */
2934
+ interface EDAWebSocketDeliveryState extends EDAWebSocketDeliveryCheckpoint {
2935
+ readonly subscriberId: SubscriberId;
2936
+ readonly policy: EDAWebSocketFlowControl;
2937
+ /** Ephemeral events are live-only and intentionally absent from the attachment. */
2938
+ readonly pendingEphemeral: ReadonlyArray<PositionedEvent>;
2939
+ readonly suppressed: ReadonlyArray<EDAWebSocketSuppressedRange>;
2940
+ }
2941
+ /** Explicit instructions emitted by the pure delivery state machine. */
2942
+ type EDAWebSocketDeliveryAction = {
2943
+ readonly _tag: "Persist";
2944
+ } | {
2945
+ readonly _tag: "Send";
2946
+ readonly frames: ReadonlyArray<EDAWebSocketServerFrame>;
2947
+ } | {
2948
+ readonly _tag: "ReadEventPage";
2949
+ readonly afterSeq: SequenceNumber;
2950
+ } | {
2951
+ readonly _tag: "Close";
2952
+ readonly code: number;
2953
+ readonly reason: string;
2954
+ };
2955
+ /** Result of one pure delivery transition. */
2956
+ interface EDAWebSocketDeliveryResult {
2957
+ readonly state: EDAWebSocketDeliveryState;
2958
+ readonly actions: ReadonlyArray<EDAWebSocketDeliveryAction>;
2959
+ }
2960
+ interface MakeDeliveryStateInput {
2961
+ readonly subscriberId: SubscriberId;
2962
+ readonly resumeSeq: SequenceNumber;
2963
+ readonly policy: EDAWebSocketFlowControl;
2964
+ }
2965
+ /** Build delivery state for a newly accepted connection. */
2966
+ declare const makeWebSocketDeliveryState: (input: MakeDeliveryStateInput) => EDAWebSocketDeliveryState;
2967
+ /** Rebuild exact ACK bookkeeping from a hibernating WebSocket attachment. */
2968
+ declare const restoreWebSocketDeliveryState: (input: {
2969
+ readonly subscriberId: SubscriberId;
2970
+ readonly policy: EDAWebSocketFlowControl;
2971
+ readonly checkpoint: EDAWebSocketDeliveryCheckpoint;
2972
+ }) => EDAWebSocketDeliveryState;
2973
+ /** Project in-memory delivery state into the attachment-safe checkpoint. */
2974
+ declare const checkpointWebSocketDeliveryState: (state: EDAWebSocketDeliveryState) => EDAWebSocketDeliveryCheckpoint;
2975
+ /** First frame for a freshly accepted connection. Restores never re-send hello. */
2976
+ declare const deliveryHelloFrame: (state: EDAWebSocketDeliveryState) => EDAWebSocketHelloFrame;
2977
+ /** Deliver committed durable events read from the store. */
2978
+ declare const onDurableEvents: (state: EDAWebSocketDeliveryState, events: ReadonlyArray<PositionedEvent>, head: SequenceNumber, nowMs: number) => EDAWebSocketDeliveryResult;
2979
+ /** Deliver one live ephemeral event, buffering only while this isolate is active. */
2980
+ declare const onEphemeralEvent: (state: EDAWebSocketDeliveryState, event: PositionedEvent, nowMs: number) => EDAWebSocketDeliveryResult;
2981
+ /** Apply one client ACK, reopen the window, and drain buffered ephemeral events. */
2982
+ declare const onClientAck: (state: EDAWebSocketDeliveryState, ack: EDAWebSocketAckFrame, nowMs: number) => EDAWebSocketDeliveryResult;
2983
+ /**
2984
+ * Apply one exact host-suppressed receipt without cumulatively ACKing any
2985
+ * earlier client-visible frame.
2986
+ */
2987
+ declare const onHostSuppressedFrame: (state: EDAWebSocketDeliveryState, frame: Pick<EDAWebSocketEventsFrame, "durableThroughSeq" | "frameId">, nowMs: number) => EDAWebSocketDeliveryResult;
2988
+ //#endregion
2989
+ export { EDAWebSocketWireProtocol as $, EDA_WS_CLOSE_LAGGED as A, EDAFrameworkWebSocketEvent as B, EDAWebSocketHelloFrame as C, EDAWebSocketServerFrame as D, EDAWebSocketPongFrame as E, SubscriberId as F, EDAWebSocketWireClientFrame as G, EDAWebSocketServerFrameEncoder as H, decodeEDAWebSocketClientMessage as I, EDAWebSocketWireHeartbeatFrame as J, EDAWebSocketWireErrorFrame as K, defaultEDAWebSocketFlowControl as L, EDA_WS_CLOSE_SEND_FAILED as M, EDA_WS_CLOSE_UNSUPPORTED_DATA as N, EDA_WEB_SOCKET_PROTOCOL_VERSION as O, FrameId as P, EDAWebSocketWirePongFrame as Q, encodeEDAWebSocketServerFrame as R, EDAWebSocketHeartbeatFrame as S, EDAWebSocketPingFrame as T, EDAWebSocketServerFrameInput as U, EDAWebSocketEventConsumerPolicy as V, EDAWebSocketWireAckFrame as W, EDAWebSocketWireLaggedFrame as X, EDAWebSocketWireHelloFrame as Y, EDAWebSocketWirePingFrame as Z, EDAWebSocketAckFrame as _, EDAWebSocketInFlightFrame as a, EDAWebSocketEventsFrame as b, SubscriberLagReason as c, makeWebSocketDeliveryState as d, EDA_WEB_SOCKET_PING_MESSAGE as et, onClientAck as f, restoreWebSocketDeliveryState as g, onHostSuppressedFrame as h, EDAWebSocketDeliveryState as i, makeEDAWebSocketWireProtocol as it, EDA_WS_CLOSE_PROTOCOL_ERROR as j, EDA_WS_CLOSE_GOING_AWAY as k, checkpointWebSocketDeliveryState as l, onEphemeralEvent as m, EDAWebSocketDeliveryCheckpoint as n, EDA_WEB_SOCKET_WIRE_PROTOCOL_VERSION as nt, EDAWebSocketSuppressedRange as o, onDurableEvents as p, EDAWebSocketWireFlowControl as q, EDAWebSocketDeliveryResult as r, edaFrameworkWebSocketWireProtocol as rt, MakeDeliveryStateInput as s, EDAWebSocketDeliveryAction as t, EDA_WEB_SOCKET_PONG_MESSAGE as tt, deliveryHelloFrame as u, EDAWebSocketClientFrame as v, EDAWebSocketLaggedFrame as w, EDAWebSocketFlowControl as x, EDAWebSocketErrorFrame as y, laggedCloseReason as z };
2990
+ //# sourceMappingURL=delivery-o6sDIiwO.d.ts.map