effect-durable-agent 0.1.0-alpha.22 → 0.1.0-alpha.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/domain/command-queues.d.ts +1 -1
  2. package/dist/domain/message-transcript.d.ts +1 -1
  3. package/dist/domain/reduced-state.d.ts +1 -1
  4. package/dist/domain/run-scheduling.d.ts +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/records-DWKEjuqb.js +675 -0
  7. package/dist/records-DWKEjuqb.js.map +1 -0
  8. package/dist/{reduced-state-PJdig48e.d.ts → reduced-state-B5WxKSM5.d.ts} +4206 -4206
  9. package/dist/{reducer-registry-BAbhZs6d.d.ts → reducer-registry-CPObI3cs.d.ts} +2 -2
  10. package/dist/{run-scheduling-wakeup-QLK87OqG.d.ts → run-scheduling-wakeup-B19JTeyq.d.ts} +2 -2
  11. package/dist/services/compaction.d.ts +1 -1
  12. package/dist/services/model-call.d.ts +1 -1
  13. package/dist/services/prompt-projector.d.ts +1 -1
  14. package/dist/services/reducer-registry.d.ts +1 -1
  15. package/dist/services/reducer-registry.js +1 -1
  16. package/dist/services/run-scheduler.d.ts +1 -1
  17. package/dist/services/run-scheduling-wakeup.d.ts +1 -1
  18. package/dist/services/runtime-layer.d.ts +6 -6
  19. package/dist/services/runtime-layer.js +3 -3
  20. package/dist/services/runtime.d.ts +1 -1
  21. package/dist/services/runtime.js +1 -1
  22. package/dist/services/session-query.d.ts +1 -1
  23. package/dist/services/session-query.js +2 -2
  24. package/dist/services/session-state.d.ts +1 -1
  25. package/dist/services/session-state.js +1 -1
  26. package/dist/services/session-store.d.ts +1 -1
  27. package/dist/services/session-store.js +1 -1
  28. package/dist/services/sink-checkpoint-store.d.ts +1 -1
  29. package/dist/services/sink-registry.d.ts +1 -1
  30. package/dist/services/sink-registry.js +1 -1
  31. package/dist/services/tool-registry.d.ts +1 -1
  32. package/dist/{session-state-StlO5B2N.js → session-state-C6SyphC0.js} +3 -3
  33. package/dist/{session-state-StlO5B2N.js.map → session-state-C6SyphC0.js.map} +1 -1
  34. package/dist/{session-store-ByDjS03N.d.ts → session-store-CWYZ29CV.d.ts} +163 -45
  35. package/dist/{session-store-DcJjs4Fd.js → session-store-DuEhcqIC.js} +3 -2
  36. package/dist/{session-store-DcJjs4Fd.js.map → session-store-DuEhcqIC.js.map} +1 -1
  37. package/dist/{sink-checkpoint-store-BHb8YRTw.d.ts → sink-checkpoint-store-B8Ky5nfW.d.ts} +2 -2
  38. package/dist/{sink-registry-DEneTH8u.js → sink-registry-DtrssBxF.js} +2 -2
  39. package/dist/{sink-registry-DEneTH8u.js.map → sink-registry-DtrssBxF.js.map} +1 -1
  40. package/dist/subscription-DelB8L87.d.ts +958 -0
  41. package/dist/subscription-g5W0Ggqx.js +498 -0
  42. package/dist/subscription-g5W0Ggqx.js.map +1 -0
  43. package/dist/testkit/layers.d.ts +9 -6
  44. package/dist/testkit/layers.js +4 -4
  45. package/dist/testkit/layers.js.map +1 -1
  46. package/dist/{tool-registry-CxZ0iuYb.d.ts → tool-registry-B_WE2ZwK.d.ts} +2 -2
  47. package/dist/transcript.d.ts +44 -4
  48. package/dist/transcript.js +98 -170
  49. package/dist/transcript.js.map +1 -1
  50. package/dist/websocket.d.ts +2209 -2
  51. package/dist/websocket.js +704 -18
  52. package/dist/websocket.js.map +1 -1
  53. package/dist/{window-read-B8aF_hDq.js → window-read-BDayZf7O.js} +74 -683
  54. package/dist/window-read-BDayZf7O.js.map +1 -0
  55. package/package.json +1 -1
  56. package/dist/window-read-B8aF_hDq.js.map +0 -1
@@ -0,0 +1,958 @@
1
+ import { h as SequenceNumber } from "./core-BcimKMIv.js";
2
+ import { E as TranscriptWindowLimits, T as TranscriptWindow, _ as EDATranscriptStoreShape, b as TranscriptActiveContent, ot as TranscriptCursor, s as EDASessionStoreError } from "./session-store-CWYZ29CV.js";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Schema from "effect/Schema";
5
+ //#region src/transcript/subscription.d.ts
6
+ /** Client-chosen correlation id echoed on the update that answers a request. */
7
+ declare const TranscriptRequestId: Schema.NonEmptyString;
8
+ type TranscriptRequestId = typeof TranscriptRequestId.Type;
9
+ /**
10
+ * The contiguous span of top-level records a subscriber holds, both ends inclusive. Absent when
11
+ * the subscriber holds no top-level records (an empty session, or a window still building).
12
+ */
13
+ declare const TranscriptCoverage: Schema.Struct<{
14
+ readonly from: Schema.Struct<{
15
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
16
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
17
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
18
+ readonly ordinal: Schema.Int;
19
+ readonly recordId: Schema.NonEmptyString;
20
+ }>;
21
+ readonly to: Schema.Struct<{
22
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
23
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
24
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
25
+ readonly ordinal: Schema.Int;
26
+ readonly recordId: Schema.NonEmptyString;
27
+ }>;
28
+ }>;
29
+ type TranscriptCoverage = typeof TranscriptCoverage.Type;
30
+ /**
31
+ * What a subscriber holds after its last complete update: the cut it was read at and the span it
32
+ * covers. Every update is planned relative to this base, which is also persisted with the socket
33
+ * so a hibernated subscription resumes without volatile state.
34
+ *
35
+ * `tail` is true when the coverage reaches the newest record of its cut; new history then joins
36
+ * the coverage as it is committed. A subscriber that paged back past the tail sees `hasNewer`
37
+ * instead and pages forward to rejoin it.
38
+ */
39
+ declare const TranscriptSubscriptionBase: Schema.Struct<{
40
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
41
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
42
+ readonly throughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
43
+ readonly coverage: Schema.optionalKey<Schema.Struct<{
44
+ readonly from: Schema.Struct<{
45
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
46
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
47
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
48
+ readonly ordinal: Schema.Int;
49
+ readonly recordId: Schema.NonEmptyString;
50
+ }>;
51
+ readonly to: Schema.Struct<{
52
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
53
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
54
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
55
+ readonly ordinal: Schema.Int;
56
+ readonly recordId: Schema.NonEmptyString;
57
+ }>;
58
+ }>>;
59
+ readonly tail: Schema.Boolean;
60
+ }>;
61
+ type TranscriptSubscriptionBase = typeof TranscriptSubscriptionBase.Type;
62
+ /**
63
+ * One ordered, complete change to a subscriber's window: the only way a live client's window
64
+ * changes.
65
+ *
66
+ * - `replace` discards everything the client holds and installs this window.
67
+ * - `patch` is relative to the client's previous complete update: `records` and `dependencies`
68
+ * carry every record that changed or newly entered the window, `dependencyIds` lists the
69
+ * complete dependency membership of the new cut (the client drops any other dependency), and
70
+ * the client drops top-level records outside `coverage`.
71
+ *
72
+ * Either way the client ends at exactly the window read at `throughSeq`: a complete cut. When
73
+ * present, `activeContent` replaces the client's active content completely (an empty array
74
+ * clears it); when absent, active content is unchanged. A degraded update carries no live
75
+ * content, and a client shows none while readiness is not `Ready`.
76
+ */
77
+ declare const TranscriptUpdate: Schema.Struct<{
78
+ readonly updateSeq: Schema.Int;
79
+ readonly mode: Schema.Literals<readonly ["replace", "patch"]>;
80
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
81
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
82
+ readonly throughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
83
+ readonly coverage: Schema.optionalKey<Schema.Struct<{
84
+ readonly from: Schema.Struct<{
85
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
86
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
87
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
88
+ readonly ordinal: Schema.Int;
89
+ readonly recordId: Schema.NonEmptyString;
90
+ }>;
91
+ readonly to: Schema.Struct<{
92
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
93
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
94
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
95
+ readonly ordinal: Schema.Int;
96
+ readonly recordId: Schema.NonEmptyString;
97
+ }>;
98
+ }>>;
99
+ readonly hasOlder: Schema.Boolean;
100
+ readonly hasNewer: Schema.Boolean;
101
+ readonly readiness: Schema.Union<readonly [Schema.TaggedUnion<{
102
+ readonly Building: Schema.TaggedStruct<"Building", {}>;
103
+ readonly Degraded: Schema.TaggedStruct<"Degraded", {
104
+ readonly failedAtSeq: Schema.brand<Schema.Int, "SequenceNumber">;
105
+ readonly error: Schema.String;
106
+ }>;
107
+ readonly Ready: Schema.TaggedStruct<"Ready", {}>;
108
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
109
+ readonly readinessType: Schema.String;
110
+ }>;
111
+ readonly Unreadable: Schema.TaggedStruct<"Unreadable", {
112
+ readonly error: Schema.String;
113
+ }>;
114
+ readonly UpdatingHistory: Schema.TaggedStruct<"UpdatingHistory", {}>;
115
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
116
+ readonly readinessType: Schema.String;
117
+ }>>, Schema.Struct<{
118
+ readonly _tag: Schema.String;
119
+ }>, never, never>]>;
120
+ readonly records: Schema.$Array<Schema.Union<readonly [Schema.decodeTo<Schema.Union<readonly [Schema.Struct<{
121
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
122
+ readonly messageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
123
+ readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
124
+ readonly disposition: Schema.optionalKey<Schema.Literals<readonly ["queue", "steer", "interrupt"]>>;
125
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
126
+ readonly type: Schema.Literal<"text">;
127
+ readonly text: Schema.String;
128
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
129
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
130
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
131
+ readonly type: Schema.Literal<"text">;
132
+ readonly text: Schema.String;
133
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
134
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
135
+ }>, Schema.decodeTo<Schema.Struct<{
136
+ readonly type: Schema.Literal<"file">;
137
+ readonly mediaType: Schema.String;
138
+ readonly fileName: Schema.optional<Schema.String>;
139
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
140
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
141
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
142
+ }>, Schema.Struct<{
143
+ readonly type: Schema.Literal<"file">;
144
+ readonly mediaType: Schema.String;
145
+ readonly fileName: Schema.optional<Schema.String>;
146
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
147
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
148
+ readonly data: Schema.String;
149
+ }>, never, never>]>>]>;
150
+ readonly state: Schema.TaggedUnion<{
151
+ readonly Cancelled: Schema.TaggedStruct<"Cancelled", {
152
+ readonly reason: Schema.String;
153
+ readonly byCommandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
154
+ }>;
155
+ readonly Consumed: Schema.TaggedStruct<"Consumed", {
156
+ readonly turnId: Schema.optionalKey<Schema.brand<Schema.String, "TurnId">>;
157
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
158
+ }>;
159
+ readonly Paused: Schema.TaggedStruct<"Paused", {
160
+ readonly byCommandId: Schema.brand<Schema.String, "CommandId">;
161
+ }>;
162
+ readonly Pending: Schema.TaggedStruct<"Pending", {}>;
163
+ readonly Promoted: Schema.TaggedStruct<"Promoted", {}>;
164
+ readonly Steering: Schema.TaggedStruct<"Steering", {}>;
165
+ }>;
166
+ readonly steering: Schema.optionalKey<Schema.Struct<{
167
+ readonly runId: Schema.brand<Schema.String, "RunId">;
168
+ }>>;
169
+ readonly classification: Schema.optionalKey<Schema.String>;
170
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
171
+ readonly List: Schema.TaggedStruct<"List", {
172
+ readonly entries: Schema.$Array<Schema.Struct<{
173
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
174
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
175
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
176
+ }>>;
177
+ }>;
178
+ readonly Value: Schema.TaggedStruct<"Value", {
179
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
180
+ }>;
181
+ }>>;
182
+ readonly submittedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
183
+ readonly submittedAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
184
+ readonly consumedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
185
+ readonly kind: Schema.tag<"user">;
186
+ readonly id: Schema.TemplateLiteral<readonly ["user:", Schema.brand<Schema.String, "CommandId">]>;
187
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
188
+ readonly position: Schema.optionalKey<Schema.Struct<{
189
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
190
+ readonly ordinal: Schema.Int;
191
+ }>>;
192
+ }>, Schema.Struct<{
193
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
194
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
195
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
196
+ readonly source: Schema.Literals<readonly ["inference", "import"]>;
197
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
198
+ readonly runId: Schema.brand<Schema.String, "RunId">;
199
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
200
+ readonly runGroupId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>>;
201
+ readonly messageId: Schema.optionalKey<Schema.brand<Schema.String, "MessageId">>;
202
+ readonly lifecycle: Schema.TaggedUnion<{
203
+ readonly Completed: Schema.TaggedStruct<"Completed", {
204
+ readonly finishReason: Schema.optionalKey<Schema.String>;
205
+ readonly usage: Schema.optionalKey<Schema.Struct<{
206
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
207
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
208
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
209
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
210
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
211
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
212
+ }>>;
213
+ }>;
214
+ readonly Failed: Schema.TaggedStruct<"Failed", {
215
+ readonly error: Schema.Struct<{
216
+ readonly message: Schema.String;
217
+ readonly code: Schema.optionalKey<Schema.String>;
218
+ readonly details: Schema.optionalKey<Schema.Unknown>;
219
+ }>;
220
+ }>;
221
+ readonly Streaming: Schema.TaggedStruct<"Streaming", {}>;
222
+ }>;
223
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.TaggedUnion<{
224
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
225
+ readonly text: Schema.String;
226
+ }>;
227
+ readonly Text: Schema.TaggedStruct<"Text", {
228
+ readonly text: Schema.String;
229
+ }>;
230
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
231
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
232
+ readonly toolName: Schema.NonEmptyString;
233
+ readonly providerExecuted: Schema.Boolean;
234
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
235
+ }>;
236
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
237
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
238
+ readonly toolName: Schema.NonEmptyString;
239
+ readonly isFailure: Schema.Boolean;
240
+ readonly result: Schema.TaggedUnion<{
241
+ readonly Inline: Schema.TaggedStruct<"Inline", {
242
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
243
+ readonly source: Schema.Struct<{
244
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
245
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
246
+ }>;
247
+ }>;
248
+ readonly Ref: Schema.TaggedStruct<"Ref", {
249
+ readonly source: Schema.Struct<{
250
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
251
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
252
+ }>;
253
+ readonly byteLength: Schema.Int;
254
+ }>;
255
+ }>;
256
+ }>;
257
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
258
+ readonly partType: Schema.String;
259
+ }>;
260
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
261
+ readonly partType: Schema.String;
262
+ }>>, Schema.Struct<{
263
+ readonly _tag: Schema.String;
264
+ }>, never, never>]>>;
265
+ readonly partial: Schema.optionalKey<Schema.Struct<{
266
+ readonly reason: Schema.String;
267
+ }>>;
268
+ readonly kind: Schema.tag<"assistant">;
269
+ readonly id: Schema.Union<readonly [Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>, Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>]>;
270
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
271
+ readonly position: Schema.Struct<{
272
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
273
+ readonly ordinal: Schema.Int;
274
+ }>;
275
+ }>, Schema.Struct<{
276
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
277
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
278
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
279
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
280
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
281
+ readonly completedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
282
+ readonly kind: Schema.tag<"compaction">;
283
+ readonly id: Schema.TemplateLiteral<readonly ["compaction:", Schema.brand<Schema.String, "CompactionId">]>;
284
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
285
+ readonly position: Schema.Struct<{
286
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
287
+ readonly ordinal: Schema.Int;
288
+ }>;
289
+ }>, Schema.Struct<{
290
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
291
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
292
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
293
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
294
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
295
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
296
+ readonly toolName: Schema.NonEmptyString;
297
+ readonly providerExecuted: Schema.Boolean;
298
+ readonly params: Schema.optionalKey<Schema.TaggedUnion<{
299
+ readonly Inline: Schema.TaggedStruct<"Inline", {
300
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
301
+ readonly source: Schema.Struct<{
302
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
303
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
304
+ }>;
305
+ }>;
306
+ readonly Ref: Schema.TaggedStruct<"Ref", {
307
+ readonly source: Schema.Struct<{
308
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
309
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
310
+ }>;
311
+ readonly byteLength: Schema.Int;
312
+ }>;
313
+ }>>;
314
+ readonly lifecycle: Schema.TaggedUnion<{
315
+ readonly Completed: Schema.TaggedStruct<"Completed", {
316
+ readonly result: Schema.TaggedUnion<{
317
+ readonly Inline: Schema.TaggedStruct<"Inline", {
318
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
319
+ readonly source: Schema.Struct<{
320
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
321
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
322
+ }>;
323
+ }>;
324
+ readonly Ref: Schema.TaggedStruct<"Ref", {
325
+ readonly source: Schema.Struct<{
326
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
327
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
328
+ }>;
329
+ readonly byteLength: Schema.Int;
330
+ }>;
331
+ }>;
332
+ }>;
333
+ readonly Created: Schema.TaggedStruct<"Created", {}>;
334
+ readonly Failed: Schema.TaggedStruct<"Failed", {
335
+ readonly error: Schema.Struct<{
336
+ readonly message: Schema.String;
337
+ readonly code: Schema.optionalKey<Schema.String>;
338
+ readonly details: Schema.optionalKey<Schema.Unknown>;
339
+ }>;
340
+ }>;
341
+ readonly Rejected: Schema.TaggedStruct<"Rejected", {
342
+ readonly reason: Schema.Literals<readonly ["unknown-tool", "invalid-params"]>;
343
+ readonly message: Schema.String;
344
+ readonly modelFeedback: Schema.String;
345
+ }>;
346
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
347
+ }>;
348
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
349
+ readonly kind: Schema.tag<"tool">;
350
+ readonly id: Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>;
351
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
352
+ }>, Schema.Struct<{
353
+ readonly rootRunId: Schema.brand<Schema.String, "RunId">;
354
+ readonly runs: Schema.NonEmptyArray<Schema.Struct<{
355
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
356
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
357
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
358
+ readonly runId: Schema.brand<Schema.String, "RunId">;
359
+ readonly commandIds: Schema.$Array<Schema.brand<Schema.String, "CommandId">>;
360
+ readonly modelSelection: Schema.Struct<{
361
+ readonly provider: Schema.NonEmptyString;
362
+ readonly modelId: Schema.NonEmptyString;
363
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
364
+ }>;
365
+ readonly outcome: Schema.TaggedUnion<{
366
+ readonly Completed: Schema.TaggedStruct<"Completed", {}>;
367
+ readonly Failed: Schema.TaggedStruct<"Failed", {
368
+ readonly error: Schema.Struct<{
369
+ readonly message: Schema.String;
370
+ readonly code: Schema.optionalKey<Schema.String>;
371
+ readonly details: Schema.optionalKey<Schema.Unknown>;
372
+ }>;
373
+ }>;
374
+ readonly Interrupted: Schema.TaggedStruct<"Interrupted", {
375
+ readonly reason: Schema.String;
376
+ }>;
377
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
378
+ }>;
379
+ readonly continuationOf: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
380
+ }>>;
381
+ readonly kind: Schema.tag<"runGroup">;
382
+ readonly id: Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>;
383
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
384
+ }>, Schema.Struct<{
385
+ readonly activeRunId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
386
+ readonly activeCompactionId: Schema.optionalKey<Schema.brand<Schema.String, "CompactionId">>;
387
+ readonly modelSelection: Schema.optionalKey<Schema.Struct<{
388
+ readonly provider: Schema.NonEmptyString;
389
+ readonly modelId: Schema.NonEmptyString;
390
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
391
+ }>>;
392
+ readonly lastRunModelSelection: Schema.optionalKey<Schema.Struct<{
393
+ readonly provider: Schema.NonEmptyString;
394
+ readonly modelId: Schema.NonEmptyString;
395
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
396
+ }>>;
397
+ readonly tokenUsage: Schema.Struct<{
398
+ readonly byModel: Schema.$Array<Schema.Struct<{
399
+ readonly provider: Schema.NonEmptyString;
400
+ readonly modelId: Schema.NonEmptyString;
401
+ readonly usage: Schema.Struct<{
402
+ readonly inputTokens: Schema.Int;
403
+ readonly cachedInputTokens: Schema.Int;
404
+ readonly cacheWriteInputTokens: Schema.Int;
405
+ readonly outputTokens: Schema.Int;
406
+ readonly textTokens: Schema.Int;
407
+ readonly reasoningTokens: Schema.Int;
408
+ }>;
409
+ }>>;
410
+ }>;
411
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
412
+ readonly List: Schema.TaggedStruct<"List", {
413
+ readonly entries: Schema.$Array<Schema.Struct<{
414
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
415
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
416
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
417
+ }>>;
418
+ }>;
419
+ readonly Value: Schema.TaggedStruct<"Value", {
420
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
421
+ }>;
422
+ }>>;
423
+ readonly kind: Schema.tag<"sessionContext">;
424
+ readonly id: Schema.Literal<"session">;
425
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
426
+ }>, Schema.Struct<{
427
+ readonly operations: Schema.$Array<Schema.Struct<{
428
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
429
+ readonly mapping: Schema.String;
430
+ readonly operation: Schema.Int;
431
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
432
+ readonly entryKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Int]>>;
433
+ readonly entryId: Schema.optionalKey<Schema.NonEmptyString>;
434
+ }>>;
435
+ readonly kind: Schema.tag<"decorationBuffer">;
436
+ readonly id: Schema.TemplateLiteral<readonly ["decorations:", Schema.Literals<readonly ["command", "idempotencyKey"]>, ":", Schema.NonEmptyString]>;
437
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
438
+ }>]>, Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.Struct<{
439
+ readonly format: Schema.Int;
440
+ readonly kind: Schema.NonEmptyString;
441
+ readonly id: Schema.NonEmptyString;
442
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
443
+ readonly position: Schema.optionalKey<Schema.Struct<{
444
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
445
+ readonly ordinal: Schema.Int;
446
+ }>>;
447
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
448
+ }>, never, never>, never, never>, Schema.decodeTo<Schema.Struct<{
449
+ readonly kind: Schema.tag<"unknown">;
450
+ readonly originalKind: Schema.NonEmptyString;
451
+ readonly format: Schema.Int;
452
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
453
+ readonly id: Schema.NonEmptyString;
454
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
455
+ readonly position: Schema.optionalKey<Schema.Struct<{
456
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
457
+ readonly ordinal: Schema.Int;
458
+ }>>;
459
+ }>, Schema.Struct<{
460
+ readonly format: Schema.Int;
461
+ readonly kind: Schema.NonEmptyString;
462
+ readonly id: Schema.NonEmptyString;
463
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
464
+ readonly position: Schema.optionalKey<Schema.Struct<{
465
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
466
+ readonly ordinal: Schema.Int;
467
+ }>>;
468
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
469
+ }>, never, never>]>>;
470
+ readonly dependencies: Schema.$Array<Schema.Union<readonly [Schema.decodeTo<Schema.Union<readonly [Schema.Struct<{
471
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
472
+ readonly messageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
473
+ readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
474
+ readonly disposition: Schema.optionalKey<Schema.Literals<readonly ["queue", "steer", "interrupt"]>>;
475
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
476
+ readonly type: Schema.Literal<"text">;
477
+ readonly text: Schema.String;
478
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
479
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
480
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
481
+ readonly type: Schema.Literal<"text">;
482
+ readonly text: Schema.String;
483
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
484
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
485
+ }>, Schema.decodeTo<Schema.Struct<{
486
+ readonly type: Schema.Literal<"file">;
487
+ readonly mediaType: Schema.String;
488
+ readonly fileName: Schema.optional<Schema.String>;
489
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
490
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
491
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
492
+ }>, Schema.Struct<{
493
+ readonly type: Schema.Literal<"file">;
494
+ readonly mediaType: Schema.String;
495
+ readonly fileName: Schema.optional<Schema.String>;
496
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
497
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
498
+ readonly data: Schema.String;
499
+ }>, never, never>]>>]>;
500
+ readonly state: Schema.TaggedUnion<{
501
+ readonly Cancelled: Schema.TaggedStruct<"Cancelled", {
502
+ readonly reason: Schema.String;
503
+ readonly byCommandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
504
+ }>;
505
+ readonly Consumed: Schema.TaggedStruct<"Consumed", {
506
+ readonly turnId: Schema.optionalKey<Schema.brand<Schema.String, "TurnId">>;
507
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
508
+ }>;
509
+ readonly Paused: Schema.TaggedStruct<"Paused", {
510
+ readonly byCommandId: Schema.brand<Schema.String, "CommandId">;
511
+ }>;
512
+ readonly Pending: Schema.TaggedStruct<"Pending", {}>;
513
+ readonly Promoted: Schema.TaggedStruct<"Promoted", {}>;
514
+ readonly Steering: Schema.TaggedStruct<"Steering", {}>;
515
+ }>;
516
+ readonly steering: Schema.optionalKey<Schema.Struct<{
517
+ readonly runId: Schema.brand<Schema.String, "RunId">;
518
+ }>>;
519
+ readonly classification: Schema.optionalKey<Schema.String>;
520
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
521
+ readonly List: Schema.TaggedStruct<"List", {
522
+ readonly entries: Schema.$Array<Schema.Struct<{
523
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
524
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
525
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
526
+ }>>;
527
+ }>;
528
+ readonly Value: Schema.TaggedStruct<"Value", {
529
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
530
+ }>;
531
+ }>>;
532
+ readonly submittedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
533
+ readonly submittedAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
534
+ readonly consumedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
535
+ readonly kind: Schema.tag<"user">;
536
+ readonly id: Schema.TemplateLiteral<readonly ["user:", Schema.brand<Schema.String, "CommandId">]>;
537
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
538
+ readonly position: Schema.optionalKey<Schema.Struct<{
539
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
540
+ readonly ordinal: Schema.Int;
541
+ }>>;
542
+ }>, Schema.Struct<{
543
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
544
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
545
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
546
+ readonly source: Schema.Literals<readonly ["inference", "import"]>;
547
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
548
+ readonly runId: Schema.brand<Schema.String, "RunId">;
549
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
550
+ readonly runGroupId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>>;
551
+ readonly messageId: Schema.optionalKey<Schema.brand<Schema.String, "MessageId">>;
552
+ readonly lifecycle: Schema.TaggedUnion<{
553
+ readonly Completed: Schema.TaggedStruct<"Completed", {
554
+ readonly finishReason: Schema.optionalKey<Schema.String>;
555
+ readonly usage: Schema.optionalKey<Schema.Struct<{
556
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
557
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
558
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
559
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
560
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
561
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
562
+ }>>;
563
+ }>;
564
+ readonly Failed: Schema.TaggedStruct<"Failed", {
565
+ readonly error: Schema.Struct<{
566
+ readonly message: Schema.String;
567
+ readonly code: Schema.optionalKey<Schema.String>;
568
+ readonly details: Schema.optionalKey<Schema.Unknown>;
569
+ }>;
570
+ }>;
571
+ readonly Streaming: Schema.TaggedStruct<"Streaming", {}>;
572
+ }>;
573
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.TaggedUnion<{
574
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
575
+ readonly text: Schema.String;
576
+ }>;
577
+ readonly Text: Schema.TaggedStruct<"Text", {
578
+ readonly text: Schema.String;
579
+ }>;
580
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
581
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
582
+ readonly toolName: Schema.NonEmptyString;
583
+ readonly providerExecuted: Schema.Boolean;
584
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
585
+ }>;
586
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
587
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
588
+ readonly toolName: Schema.NonEmptyString;
589
+ readonly isFailure: Schema.Boolean;
590
+ readonly result: Schema.TaggedUnion<{
591
+ readonly Inline: Schema.TaggedStruct<"Inline", {
592
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
593
+ readonly source: Schema.Struct<{
594
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
595
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
596
+ }>;
597
+ }>;
598
+ readonly Ref: Schema.TaggedStruct<"Ref", {
599
+ readonly source: Schema.Struct<{
600
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
601
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
602
+ }>;
603
+ readonly byteLength: Schema.Int;
604
+ }>;
605
+ }>;
606
+ }>;
607
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
608
+ readonly partType: Schema.String;
609
+ }>;
610
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
611
+ readonly partType: Schema.String;
612
+ }>>, Schema.Struct<{
613
+ readonly _tag: Schema.String;
614
+ }>, never, never>]>>;
615
+ readonly partial: Schema.optionalKey<Schema.Struct<{
616
+ readonly reason: Schema.String;
617
+ }>>;
618
+ readonly kind: Schema.tag<"assistant">;
619
+ readonly id: Schema.Union<readonly [Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>, Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>]>;
620
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
621
+ readonly position: Schema.Struct<{
622
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
623
+ readonly ordinal: Schema.Int;
624
+ }>;
625
+ }>, Schema.Struct<{
626
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
627
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
628
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
629
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
630
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
631
+ readonly completedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
632
+ readonly kind: Schema.tag<"compaction">;
633
+ readonly id: Schema.TemplateLiteral<readonly ["compaction:", Schema.brand<Schema.String, "CompactionId">]>;
634
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
635
+ readonly position: Schema.Struct<{
636
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
637
+ readonly ordinal: Schema.Int;
638
+ }>;
639
+ }>, Schema.Struct<{
640
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
641
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
642
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
643
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
644
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
645
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
646
+ readonly toolName: Schema.NonEmptyString;
647
+ readonly providerExecuted: Schema.Boolean;
648
+ readonly params: Schema.optionalKey<Schema.TaggedUnion<{
649
+ readonly Inline: Schema.TaggedStruct<"Inline", {
650
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
651
+ readonly source: Schema.Struct<{
652
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
653
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
654
+ }>;
655
+ }>;
656
+ readonly Ref: Schema.TaggedStruct<"Ref", {
657
+ readonly source: Schema.Struct<{
658
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
659
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
660
+ }>;
661
+ readonly byteLength: Schema.Int;
662
+ }>;
663
+ }>>;
664
+ readonly lifecycle: Schema.TaggedUnion<{
665
+ readonly Completed: Schema.TaggedStruct<"Completed", {
666
+ readonly result: Schema.TaggedUnion<{
667
+ readonly Inline: Schema.TaggedStruct<"Inline", {
668
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
669
+ readonly source: Schema.Struct<{
670
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
671
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
672
+ }>;
673
+ }>;
674
+ readonly Ref: Schema.TaggedStruct<"Ref", {
675
+ readonly source: Schema.Struct<{
676
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
677
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
678
+ }>;
679
+ readonly byteLength: Schema.Int;
680
+ }>;
681
+ }>;
682
+ }>;
683
+ readonly Created: Schema.TaggedStruct<"Created", {}>;
684
+ readonly Failed: Schema.TaggedStruct<"Failed", {
685
+ readonly error: Schema.Struct<{
686
+ readonly message: Schema.String;
687
+ readonly code: Schema.optionalKey<Schema.String>;
688
+ readonly details: Schema.optionalKey<Schema.Unknown>;
689
+ }>;
690
+ }>;
691
+ readonly Rejected: Schema.TaggedStruct<"Rejected", {
692
+ readonly reason: Schema.Literals<readonly ["unknown-tool", "invalid-params"]>;
693
+ readonly message: Schema.String;
694
+ readonly modelFeedback: Schema.String;
695
+ }>;
696
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
697
+ }>;
698
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
699
+ readonly kind: Schema.tag<"tool">;
700
+ readonly id: Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>;
701
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
702
+ }>, Schema.Struct<{
703
+ readonly rootRunId: Schema.brand<Schema.String, "RunId">;
704
+ readonly runs: Schema.NonEmptyArray<Schema.Struct<{
705
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
706
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
707
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
708
+ readonly runId: Schema.brand<Schema.String, "RunId">;
709
+ readonly commandIds: Schema.$Array<Schema.brand<Schema.String, "CommandId">>;
710
+ readonly modelSelection: Schema.Struct<{
711
+ readonly provider: Schema.NonEmptyString;
712
+ readonly modelId: Schema.NonEmptyString;
713
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
714
+ }>;
715
+ readonly outcome: Schema.TaggedUnion<{
716
+ readonly Completed: Schema.TaggedStruct<"Completed", {}>;
717
+ readonly Failed: Schema.TaggedStruct<"Failed", {
718
+ readonly error: Schema.Struct<{
719
+ readonly message: Schema.String;
720
+ readonly code: Schema.optionalKey<Schema.String>;
721
+ readonly details: Schema.optionalKey<Schema.Unknown>;
722
+ }>;
723
+ }>;
724
+ readonly Interrupted: Schema.TaggedStruct<"Interrupted", {
725
+ readonly reason: Schema.String;
726
+ }>;
727
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
728
+ }>;
729
+ readonly continuationOf: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
730
+ }>>;
731
+ readonly kind: Schema.tag<"runGroup">;
732
+ readonly id: Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>;
733
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
734
+ }>, Schema.Struct<{
735
+ readonly activeRunId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
736
+ readonly activeCompactionId: Schema.optionalKey<Schema.brand<Schema.String, "CompactionId">>;
737
+ readonly modelSelection: Schema.optionalKey<Schema.Struct<{
738
+ readonly provider: Schema.NonEmptyString;
739
+ readonly modelId: Schema.NonEmptyString;
740
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
741
+ }>>;
742
+ readonly lastRunModelSelection: Schema.optionalKey<Schema.Struct<{
743
+ readonly provider: Schema.NonEmptyString;
744
+ readonly modelId: Schema.NonEmptyString;
745
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
746
+ }>>;
747
+ readonly tokenUsage: Schema.Struct<{
748
+ readonly byModel: Schema.$Array<Schema.Struct<{
749
+ readonly provider: Schema.NonEmptyString;
750
+ readonly modelId: Schema.NonEmptyString;
751
+ readonly usage: Schema.Struct<{
752
+ readonly inputTokens: Schema.Int;
753
+ readonly cachedInputTokens: Schema.Int;
754
+ readonly cacheWriteInputTokens: Schema.Int;
755
+ readonly outputTokens: Schema.Int;
756
+ readonly textTokens: Schema.Int;
757
+ readonly reasoningTokens: Schema.Int;
758
+ }>;
759
+ }>>;
760
+ }>;
761
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
762
+ readonly List: Schema.TaggedStruct<"List", {
763
+ readonly entries: Schema.$Array<Schema.Struct<{
764
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
765
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
766
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
767
+ }>>;
768
+ }>;
769
+ readonly Value: Schema.TaggedStruct<"Value", {
770
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
771
+ }>;
772
+ }>>;
773
+ readonly kind: Schema.tag<"sessionContext">;
774
+ readonly id: Schema.Literal<"session">;
775
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
776
+ }>, Schema.Struct<{
777
+ readonly operations: Schema.$Array<Schema.Struct<{
778
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
779
+ readonly mapping: Schema.String;
780
+ readonly operation: Schema.Int;
781
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
782
+ readonly entryKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Int]>>;
783
+ readonly entryId: Schema.optionalKey<Schema.NonEmptyString>;
784
+ }>>;
785
+ readonly kind: Schema.tag<"decorationBuffer">;
786
+ readonly id: Schema.TemplateLiteral<readonly ["decorations:", Schema.Literals<readonly ["command", "idempotencyKey"]>, ":", Schema.NonEmptyString]>;
787
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
788
+ }>]>, Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.Struct<{
789
+ readonly format: Schema.Int;
790
+ readonly kind: Schema.NonEmptyString;
791
+ readonly id: Schema.NonEmptyString;
792
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
793
+ readonly position: Schema.optionalKey<Schema.Struct<{
794
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
795
+ readonly ordinal: Schema.Int;
796
+ }>>;
797
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
798
+ }>, never, never>, never, never>, Schema.decodeTo<Schema.Struct<{
799
+ readonly kind: Schema.tag<"unknown">;
800
+ readonly originalKind: Schema.NonEmptyString;
801
+ readonly format: Schema.Int;
802
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
803
+ readonly id: Schema.NonEmptyString;
804
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
805
+ readonly position: Schema.optionalKey<Schema.Struct<{
806
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
807
+ readonly ordinal: Schema.Int;
808
+ }>>;
809
+ }>, Schema.Struct<{
810
+ readonly format: Schema.Int;
811
+ readonly kind: Schema.NonEmptyString;
812
+ readonly id: Schema.NonEmptyString;
813
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
814
+ readonly position: Schema.optionalKey<Schema.Struct<{
815
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
816
+ readonly ordinal: Schema.Int;
817
+ }>>;
818
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
819
+ }>, never, never>]>>;
820
+ readonly dependencyIds: Schema.$Array<Schema.NonEmptyString>;
821
+ readonly activeContent: Schema.optionalKey<Schema.$Array<Schema.Struct<{
822
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
823
+ readonly parts: Schema.$Array<Schema.Struct<{
824
+ readonly id: Schema.NonEmptyString;
825
+ readonly part: Schema.Union<readonly [Schema.TaggedUnion<{
826
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
827
+ readonly text: Schema.String;
828
+ }>;
829
+ readonly Text: Schema.TaggedStruct<"Text", {
830
+ readonly text: Schema.String;
831
+ }>;
832
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
833
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
834
+ readonly toolName: Schema.NonEmptyString;
835
+ readonly providerExecuted: Schema.Boolean;
836
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
837
+ }>;
838
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
839
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
840
+ readonly toolName: Schema.NonEmptyString;
841
+ readonly isFailure: Schema.Boolean;
842
+ readonly result: Schema.TaggedUnion<{
843
+ readonly Inline: Schema.TaggedStruct<"Inline", {
844
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
845
+ readonly source: Schema.Struct<{
846
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
847
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
848
+ }>;
849
+ }>;
850
+ readonly Ref: Schema.TaggedStruct<"Ref", {
851
+ readonly source: Schema.Struct<{
852
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
853
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
854
+ }>;
855
+ readonly byteLength: Schema.Int;
856
+ }>;
857
+ }>;
858
+ }>;
859
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
860
+ readonly partType: Schema.String;
861
+ }>;
862
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
863
+ readonly partType: Schema.String;
864
+ }>>, Schema.Struct<{
865
+ readonly _tag: Schema.String;
866
+ }>, never, never>]>;
867
+ readonly paramsText: Schema.optionalKey<Schema.String>;
868
+ }>>;
869
+ }>>>;
870
+ readonly requestId: Schema.optionalKey<Schema.NonEmptyString>;
871
+ }>;
872
+ type TranscriptUpdate = typeof TranscriptUpdate.Type;
873
+ /** Bounds of one subscription. Retained coverage never exceeds `limits.maxRecords`. */
874
+ interface TranscriptSubscriptionPolicy {
875
+ /** Top-level records of a fresh subscription (design decision 4). */
876
+ readonly initialCount: number;
877
+ /** Largest page a client may request at once. */
878
+ readonly maxPageCount: number;
879
+ readonly limits: TranscriptWindowLimits;
880
+ }
881
+ declare const defaultTranscriptSubscriptionPolicy: TranscriptSubscriptionPolicy;
882
+ /** A subscriber's request, decoded from its socket and handled strictly in arrival order. */
883
+ type TranscriptSubscriptionRequest =
884
+ /** Re-read the held coverage at a new cut, after committed changes. */
885
+ {
886
+ readonly _tag: "Refresh";
887
+ } |
888
+ /**
889
+ * Start (or restart) a subscription. With `range` and `since` (what SSR rendered, or what a
890
+ * reconnecting client last applied), the first update is a patch over that range; otherwise
891
+ * it is a replacement of the latest `count` records.
892
+ */
893
+ {
894
+ readonly _tag: "Subscribe";
895
+ readonly range?: TranscriptCoverage;
896
+ readonly tail: boolean;
897
+ readonly since?: SequenceNumber;
898
+ readonly count?: number;
899
+ } |
900
+ /** Extend the coverage by `count` records from its `before` or `after` edge. */
901
+ {
902
+ readonly _tag: "Page";
903
+ readonly direction: "before" | "after";
904
+ readonly cursor: TranscriptCursor;
905
+ readonly count: number;
906
+ } |
907
+ /** Narrow the coverage to a span inside it, releasing the rest. */
908
+ {
909
+ readonly _tag: "Retain";
910
+ readonly from: TranscriptCursor;
911
+ readonly to: TranscriptCursor;
912
+ };
913
+ /** One window read at a single cut, and the base the update for it is relative to. */
914
+ interface TranscriptSubscriptionRead {
915
+ readonly window: TranscriptWindow;
916
+ /** What the client holds; `undefined` makes the update a replacement. */
917
+ readonly patchBase: TranscriptSubscriptionBase | undefined;
918
+ }
919
+ /** The span a window's top-level records cover, or `undefined` when it has none. */
920
+ declare const transcriptCoverageOf: (window: TranscriptWindow) => TranscriptCoverage | undefined;
921
+ /** The base a client holds after applying an update for `window`. */
922
+ declare const transcriptSubscriptionBaseOf: (window: TranscriptWindow) => TranscriptSubscriptionBase;
923
+ /**
924
+ * Plan the one update that moves a client from `patchBase` to `window`.
925
+ *
926
+ * A patch sends a top-level record when it changed after the base cut or was outside the base
927
+ * coverage. It sends a tool dependency when the tool changed or its assistant is sent, and any
928
+ * other dependency (run groups, session context, pending users) when it changed or any top-level
929
+ * record is sent. Everything else the client already holds unchanged from the base cut, because
930
+ * the base cut was itself complete. A different incarnation or version, or a base cut ahead of
931
+ * the window, makes the update a replacement.
932
+ */
933
+ declare const planTranscriptUpdate: (input: {
934
+ readonly patchBase: TranscriptSubscriptionBase | undefined;
935
+ readonly window: TranscriptWindow;
936
+ readonly updateSeq: number;
937
+ /** The live content captured at the same publication boundary as `window`. */
938
+ readonly activeContent: ReadonlyArray<TranscriptActiveContent>;
939
+ /**
940
+ * Whether the client's active content must be replaced. A replacement always carries it;
941
+ * otherwise the caller sends it only when it changed since its last send.
942
+ */
943
+ readonly includeActiveContent: boolean;
944
+ readonly requestId?: TranscriptRequestId;
945
+ }) => TranscriptUpdate;
946
+ /**
947
+ * Read the window that answers one request, at one cut.
948
+ *
949
+ * Helper reads (to find a page's far edge) may see other cuts; only the final read is served,
950
+ * so the update is always one synchronous read. Coverage stays within `limits.maxRecords`:
951
+ * paging back evicts the newest records, paging forward evicts the oldest, and a tail that
952
+ * outgrows the bound keeps its newest records. A cursor minted for another incarnation or version
953
+ * falls back to a replacement of the latest records.
954
+ */
955
+ declare const readTranscriptSubscription: (store: EDATranscriptStoreShape, base: TranscriptSubscriptionBase | undefined, request: TranscriptSubscriptionRequest, policy: TranscriptSubscriptionPolicy) => Effect.Effect<TranscriptSubscriptionRead, EDASessionStoreError>;
956
+ //#endregion
957
+ export { TranscriptSubscriptionRead as a, defaultTranscriptSubscriptionPolicy as c, transcriptCoverageOf as d, transcriptSubscriptionBaseOf as f, TranscriptSubscriptionPolicy as i, planTranscriptUpdate as l, TranscriptRequestId as n, TranscriptSubscriptionRequest as o, TranscriptSubscriptionBase as r, TranscriptUpdate as s, TranscriptCoverage as t, readTranscriptSubscription as u };
958
+ //# sourceMappingURL=subscription-DelB8L87.d.ts.map