effect-durable-agent 0.1.0-alpha.21 → 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 (64) hide show
  1. package/README.md +2 -2
  2. package/dist/assert-never-CoyUpoRB.js +18 -0
  3. package/dist/assert-never-CoyUpoRB.js.map +1 -0
  4. package/dist/domain/command-queues.d.ts +1 -1
  5. package/dist/domain/message-transcript.d.ts +1 -1
  6. package/dist/domain/reduced-state.d.ts +1 -1
  7. package/dist/domain/reduced-state.js +927 -2
  8. package/dist/domain/reduced-state.js.map +1 -0
  9. package/dist/domain/run-scheduling.d.ts +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/records-DWKEjuqb.js +675 -0
  12. package/dist/records-DWKEjuqb.js.map +1 -0
  13. package/dist/{reduced-state-BGd_yCBT.d.ts → reduced-state-B5WxKSM5.d.ts} +6 -6
  14. package/dist/{reducer-registry-BIhncOHH.d.ts → reducer-registry-CPObI3cs.d.ts} +2 -2
  15. package/dist/{run-scheduling-wakeup-BH2pHE0U.d.ts → run-scheduling-wakeup-B19JTeyq.d.ts} +2 -2
  16. package/dist/services/compaction.d.ts +1 -1
  17. package/dist/services/model-call.d.ts +1 -1
  18. package/dist/services/prompt-projector.d.ts +1 -1
  19. package/dist/services/reducer-registry.d.ts +1 -1
  20. package/dist/services/reducer-registry.js +1 -1
  21. package/dist/services/run-scheduler.d.ts +1 -1
  22. package/dist/services/run-scheduling-wakeup.d.ts +1 -1
  23. package/dist/services/runtime-layer.d.ts +6 -6
  24. package/dist/services/runtime-layer.js +3 -3
  25. package/dist/services/runtime.d.ts +1 -1
  26. package/dist/services/runtime.js +1 -1
  27. package/dist/services/session-query.d.ts +1 -1
  28. package/dist/services/session-query.js +2 -2
  29. package/dist/services/session-state.d.ts +1 -1
  30. package/dist/services/session-state.js +1 -1
  31. package/dist/services/session-store.d.ts +2 -2
  32. package/dist/services/session-store.js +1 -251
  33. package/dist/services/sink-checkpoint-store.d.ts +1 -1
  34. package/dist/services/sink-registry.d.ts +1 -1
  35. package/dist/services/sink-registry.js +1 -1
  36. package/dist/services/tool-registry.d.ts +1 -1
  37. package/dist/{session-state-C_1XxhvE.js → session-state-C6SyphC0.js} +5 -4
  38. package/dist/{session-state-C_1XxhvE.js.map → session-state-C6SyphC0.js.map} +1 -1
  39. package/dist/session-store-CWYZ29CV.d.ts +3302 -0
  40. package/dist/session-store-DuEhcqIC.js +414 -0
  41. package/dist/session-store-DuEhcqIC.js.map +1 -0
  42. package/dist/{sink-checkpoint-store-C-SY0cG2.d.ts → sink-checkpoint-store-B8Ky5nfW.d.ts} +2 -2
  43. package/dist/{sink-registry-CjK5MC90.js → sink-registry-DtrssBxF.js} +3 -3
  44. package/dist/{sink-registry-CjK5MC90.js.map → sink-registry-DtrssBxF.js.map} +1 -1
  45. package/dist/subscription-DelB8L87.d.ts +958 -0
  46. package/dist/subscription-g5W0Ggqx.js +498 -0
  47. package/dist/subscription-g5W0Ggqx.js.map +1 -0
  48. package/dist/testkit/layers.d.ts +9 -6
  49. package/dist/testkit/layers.js +4 -4
  50. package/dist/testkit/layers.js.map +1 -1
  51. package/dist/{tool-registry-wPsHagF_.d.ts → tool-registry-B_WE2ZwK.d.ts} +2 -2
  52. package/dist/transcript.d.ts +177 -0
  53. package/dist/transcript.js +106 -0
  54. package/dist/transcript.js.map +1 -0
  55. package/dist/websocket.d.ts +2209 -2
  56. package/dist/websocket.js +704 -18
  57. package/dist/websocket.js.map +1 -1
  58. package/dist/window-read-BDayZf7O.js +1564 -0
  59. package/dist/window-read-BDayZf7O.js.map +1 -0
  60. package/package.json +5 -1
  61. package/dist/reduced-state-Vuud6LCM.js +0 -942
  62. package/dist/reduced-state-Vuud6LCM.js.map +0 -1
  63. package/dist/services/session-store.js.map +0 -1
  64. package/dist/session-store-BpitF4Wg.d.ts +0 -191
@@ -0,0 +1,3302 @@
1
+ import { n as CommandIdempotencyKey } from "./commands-3OD-p8dD.js";
2
+ import { c as EventId, g as SessionId, h as SequenceNumber, l as InferenceId, n as CommandId, o as DurablePosition, p as RunId, r as CompactionId, v as SummaryId, y as ToolCallId } from "./core-BcimKMIv.js";
3
+ import { t as DurableEventEnvelope } from "./envelope-Che6KatU.js";
4
+ import { H as DecodedDurableEvent } from "./durable-CKdCCqhw.js";
5
+ import "./events-BWuvzVml.js";
6
+ import { r as CompactionSummaryArtifact } from "./context-projection-D_uRtK3r.js";
7
+ import * as Context from "effect/Context";
8
+ import * as Effect from "effect/Effect";
9
+ import * as Layer from "effect/Layer";
10
+ import * as Schema from "effect/Schema";
11
+ import * as Order from "effect/Order";
12
+ import * as Stream from "effect/Stream";
13
+ import * as Cause from "effect/Cause";
14
+ //#region src/transcript/records.d.ts
15
+ /** One logical user submission across every lifecycle state: `user:<commandId>`. */
16
+ declare const UserRecordId: Schema.TemplateLiteral<readonly ["user:", Schema.brand<Schema.String, "CommandId">]>;
17
+ type UserRecordId = typeof UserRecordId.Type;
18
+ /** One model inference's visible output: `assistant:<inferenceId>`. */
19
+ declare const InferenceAssistantRecordId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
20
+ type InferenceAssistantRecordId = typeof InferenceAssistantRecordId.Type;
21
+ /** Assistant context imported from another transport, keyed by its import event: `import:<eventId>`. */
22
+ declare const ImportAssistantRecordId: Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>;
23
+ type ImportAssistantRecordId = typeof ImportAssistantRecordId.Type;
24
+ /** Either assistant identity; both are top-level assistant records. */
25
+ declare const AssistantRecordId: Schema.Union<readonly [Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>, Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>]>;
26
+ type AssistantRecordId = typeof AssistantRecordId.Type;
27
+ /** The marker a context rebase leaves in history: `compaction:<compactionId>`. */
28
+ declare const CompactionRecordId: Schema.TemplateLiteral<readonly ["compaction:", Schema.brand<Schema.String, "CompactionId">]>;
29
+ type CompactionRecordId = typeof CompactionRecordId.Type;
30
+ /** A framework tool call, a dependency of its assistant: `tool:<toolCallId>`. */
31
+ declare const ToolRecordId: Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>;
32
+ type ToolRecordId = typeof ToolRecordId.Type;
33
+ /**
34
+ * A run plus every startup-recovery continuation of it: `run:<rootRunId>`.
35
+ *
36
+ * The id names the first run of the chain and never changes when a continuation joins.
37
+ */
38
+ declare const RunGroupRecordId: Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>;
39
+ type RunGroupRecordId = typeof RunGroupRecordId.Type;
40
+ /** The session-context singleton. */
41
+ declare const SessionContextRecordId: Schema.Literal<"session">;
42
+ type SessionContextRecordId = typeof SessionContextRecordId.Type;
43
+ /**
44
+ * Internal holding record for decorations whose target user record does not exist yet.
45
+ *
46
+ * Hosts append decoration events before the command they describe (Gia submits
47
+ * `[author, attachments…, SubmitMessage]` in one batch), so the interpreter parks them under the
48
+ * association key and merges them when the user record is created. Never served by a window read.
49
+ */
50
+ declare const DecorationBufferRecordId: Schema.TemplateLiteral<readonly ["decorations:", Schema.Literals<readonly ["command", "idempotencyKey"]>, ":", Schema.NonEmptyString]>;
51
+ type DecorationBufferRecordId = typeof DecorationBufferRecordId.Type;
52
+ /** Every transcript record identity this EDA release writes. */
53
+ declare const TranscriptRecordId: Schema.Union<readonly [Schema.TemplateLiteral<readonly ["user:", Schema.brand<Schema.String, "CommandId">]>, Schema.Union<readonly [Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>, Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>]>, Schema.TemplateLiteral<readonly ["compaction:", Schema.brand<Schema.String, "CompactionId">]>, Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>, Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>, Schema.Literal<"session">, Schema.TemplateLiteral<readonly ["decorations:", Schema.Literals<readonly ["command", "idempotencyKey"]>, ":", Schema.NonEmptyString]>]>;
54
+ type TranscriptRecordId = typeof TranscriptRecordId.Type;
55
+ /** Constructors for record identities; the only place identities are spelled. */
56
+ declare const transcriptRecordId: {
57
+ readonly user: (commandId: CommandId) => UserRecordId;
58
+ readonly assistant: (inferenceId: InferenceId) => InferenceAssistantRecordId;
59
+ readonly import: (eventId: EventId) => ImportAssistantRecordId;
60
+ readonly compaction: (compactionId: CompactionId) => CompactionRecordId;
61
+ readonly tool: (toolCallId: ToolCallId) => ToolRecordId;
62
+ readonly runGroup: (rootRunId: RunId) => RunGroupRecordId;
63
+ readonly session: "session";
64
+ /**
65
+ * Keys longer than 256 characters (caller-owned idempotency keys) are hashed to stay bounded;
66
+ * keys starting with `#` are hashed too, so a literal key never collides with a hashed one.
67
+ */
68
+ readonly decorationBuffer: (association: "command" | "idempotencyKey", key: string) => DecorationBufferRecordId;
69
+ };
70
+ /**
71
+ * History position of a top-level record: the event that placed it and an ordinal among records
72
+ * placed by that same event. Assigned once and never moved.
73
+ */
74
+ declare const TranscriptPosition: Schema.Struct<{
75
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
76
+ readonly ordinal: Schema.Int;
77
+ }>;
78
+ type TranscriptPosition = typeof TranscriptPosition.Type;
79
+ /**
80
+ * Adapter-owned identity of one physical event log. A wiped log gets a new incarnation, which
81
+ * invalidates every cursor, chunk and body reference minted against the old one.
82
+ */
83
+ declare const TranscriptLogIncarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
84
+ type TranscriptLogIncarnation = typeof TranscriptLogIncarnation.Type;
85
+ /**
86
+ * Identity of one transcript interpretation: a hash of the EDA semantic revision and the host's
87
+ * canonical mapping data. Two sessions with equal versions interpret the same log identically.
88
+ */
89
+ declare const TranscriptVersion: Schema.brand<Schema.String, "TranscriptVersion">;
90
+ type TranscriptVersion = typeof TranscriptVersion.Type;
91
+ /**
92
+ * Paging cursor: a point in the total order `(anchorSeq, ordinal, recordId)`.
93
+ *
94
+ * A cursor is meaningful only for the incarnation and version that minted it; readers reject
95
+ * any other pairing rather than guess an equivalent point.
96
+ */
97
+ declare const TranscriptCursor: Schema.Struct<{
98
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
99
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
100
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
101
+ readonly ordinal: Schema.Int;
102
+ readonly recordId: Schema.NonEmptyString;
103
+ }>;
104
+ type TranscriptCursor = typeof TranscriptCursor.Type;
105
+ /** A point in transcript order, without the incarnation and version scope of a cursor. */
106
+ interface TranscriptOrderKey {
107
+ readonly anchorSeq: number;
108
+ readonly ordinal: number;
109
+ readonly recordId: string;
110
+ }
111
+ /** Total transcript order over top-level records. */
112
+ declare const TranscriptOrder: Order.Order<TranscriptOrderKey>;
113
+ /** A JSON path into an event payload; the empty path is the payload itself. */
114
+ declare const TranscriptFieldPath: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
115
+ type TranscriptFieldPath = typeof TranscriptFieldPath.Type;
116
+ /** The immutable log location a body was read from. */
117
+ declare const TranscriptBodySource: Schema.Struct<{
118
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
119
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
120
+ }>;
121
+ type TranscriptBodySource = typeof TranscriptBodySource.Type;
122
+ /**
123
+ * Largest body a stored record holds inline, in canonical JSON bytes. Larger bodies are stored
124
+ * as references, which keeps every stored row far below a Durable Object's 2 MB value limit no
125
+ * matter how large an event payload is.
126
+ */
127
+ declare const transcriptStoredInlineBodyLimit = 65536;
128
+ /**
129
+ * A potentially large body (tool parameters and results).
130
+ *
131
+ * Stored records hold a body inline up to `transcriptStoredInlineBodyLimit` and as a reference
132
+ * above it; a window read may also replace a smaller inline body with a reference. A reference
133
+ * points at the body's immutable source in the append-only log, so it stays resolvable after
134
+ * projection rows are rebuilt or deleted. The host authorizes reference resolution.
135
+ */
136
+ declare const TranscriptBody: Schema.TaggedUnion<{
137
+ readonly Inline: Schema.TaggedStruct<"Inline", {
138
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
139
+ readonly source: Schema.Struct<{
140
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
141
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
142
+ }>;
143
+ }>;
144
+ readonly Ref: Schema.TaggedStruct<"Ref", {
145
+ readonly source: Schema.Struct<{
146
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
147
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
148
+ }>;
149
+ readonly byteLength: Schema.Int;
150
+ }>;
151
+ }>;
152
+ type TranscriptBody = typeof TranscriptBody.Type;
153
+ /** Host-defined decoration name, as written by a mapping operation. */
154
+ declare const TranscriptDecorationKey: Schema.String;
155
+ type TranscriptDecorationKey = typeof TranscriptDecorationKey.Type;
156
+ /** Id of a decoration list entry that is keyed by its ordinal. */
157
+ declare const TranscriptDecorationEntryId: Schema.NonEmptyString;
158
+ type TranscriptDecorationEntryId = typeof TranscriptDecorationEntryId.Type;
159
+ /** Key of one decoration list entry: an entry id or a host-assigned ordinal. */
160
+ declare const TranscriptDecorationEntryKey: Schema.Union<readonly [Schema.String, Schema.Int]>;
161
+ type TranscriptDecorationEntryKey = typeof TranscriptDecorationEntryKey.Type;
162
+ /**
163
+ * A host decoration value: a JSON scalar/object, or a keyed list whose entries are replaced by id
164
+ * or ordinal. EDA treats the JSON as opaque; only the host gives it meaning.
165
+ */
166
+ declare const TranscriptDecoration: Schema.TaggedUnion<{
167
+ readonly List: Schema.TaggedStruct<"List", {
168
+ readonly entries: Schema.$Array<Schema.Struct<{
169
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
170
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
171
+ /** The entry's id when the list is keyed by id or ordinal (the key is then the ordinal). */
172
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
173
+ }>>;
174
+ }>;
175
+ readonly Value: Schema.TaggedStruct<"Value", {
176
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
177
+ }>;
178
+ }>;
179
+ type TranscriptDecoration = typeof TranscriptDecoration.Type;
180
+ /** Decorations of one record, keyed by host decoration name. */
181
+ declare const TranscriptDecorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
182
+ readonly List: Schema.TaggedStruct<"List", {
183
+ readonly entries: Schema.$Array<Schema.Struct<{
184
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
185
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
186
+ /** The entry's id when the list is keyed by id or ordinal (the key is then the ordinal). */
187
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
188
+ }>>;
189
+ }>;
190
+ readonly Value: Schema.TaggedStruct<"Value", {
191
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
192
+ }>;
193
+ }>>;
194
+ type TranscriptDecorations = typeof TranscriptDecorations.Type;
195
+ /** Host classification of a user record, such as an authenticated subagent notice. */
196
+ declare const TranscriptClassification: Schema.String;
197
+ type TranscriptClassification = typeof TranscriptClassification.Type;
198
+ /**
199
+ * Where a user submission is in its lifecycle.
200
+ *
201
+ * Only `Consumed` records are rendered in history. `Pending`, `Paused`, `Promoted` and `Steering`
202
+ * are waiting to be read by the agent and are served as dependencies. `Cancelled` records stay
203
+ * stored so their aliases resolve but are never rendered.
204
+ */
205
+ declare const TranscriptUserState: Schema.TaggedUnion<{
206
+ readonly Cancelled: Schema.TaggedStruct<"Cancelled", {
207
+ readonly reason: Schema.String;
208
+ readonly byCommandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
209
+ }>;
210
+ readonly Consumed: Schema.TaggedStruct<"Consumed", {
211
+ readonly turnId: Schema.optionalKey<Schema.brand<Schema.String, "TurnId">>;
212
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
213
+ }>;
214
+ readonly Paused: Schema.TaggedStruct<"Paused", {
215
+ readonly byCommandId: Schema.brand<Schema.String, "CommandId">;
216
+ }>;
217
+ readonly Pending: Schema.TaggedStruct<"Pending", {}>;
218
+ readonly Promoted: Schema.TaggedStruct<"Promoted", {}>;
219
+ readonly Steering: Schema.TaggedStruct<"Steering", {}>;
220
+ }>;
221
+ type TranscriptUserState = typeof TranscriptUserState.Type;
222
+ /** Lifecycle of one assistant record. Imports are `Completed` from the start. */
223
+ declare const TranscriptAssistantLifecycle: Schema.TaggedUnion<{
224
+ readonly Completed: Schema.TaggedStruct<"Completed", {
225
+ readonly finishReason: Schema.optionalKey<Schema.String>;
226
+ readonly usage: Schema.optionalKey<Schema.Struct<{
227
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
228
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
229
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
230
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
231
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
232
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
233
+ }>>;
234
+ }>;
235
+ readonly Failed: Schema.TaggedStruct<"Failed", {
236
+ readonly error: Schema.Struct<{
237
+ readonly message: Schema.String;
238
+ readonly code: Schema.optionalKey<Schema.String>;
239
+ readonly details: Schema.optionalKey<Schema.Unknown>;
240
+ }>;
241
+ }>;
242
+ readonly Streaming: Schema.TaggedStruct<"Streaming", {}>;
243
+ }>;
244
+ type TranscriptAssistantLifecycle = typeof TranscriptAssistantLifecycle.Type;
245
+ /**
246
+ * One ordered part of assistant output. A part tag this reader does not know decodes as
247
+ * `Unknown`, keeping its place; a malformed part with a known tag is a decode failure.
248
+ */
249
+ declare const TranscriptAssistantPart: Schema.Union<readonly [Schema.TaggedUnion<{
250
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
251
+ readonly text: Schema.String;
252
+ }>;
253
+ readonly Text: Schema.TaggedStruct<"Text", {
254
+ readonly text: Schema.String;
255
+ }>;
256
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
257
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
258
+ readonly toolName: Schema.NonEmptyString;
259
+ readonly providerExecuted: Schema.Boolean;
260
+ /** The framework tool record, once the call has been sealed into one. */
261
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
262
+ }>;
263
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
264
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
265
+ readonly toolName: Schema.NonEmptyString;
266
+ readonly isFailure: Schema.Boolean;
267
+ readonly result: Schema.TaggedUnion<{
268
+ readonly Inline: Schema.TaggedStruct<"Inline", {
269
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
270
+ readonly source: Schema.Struct<{
271
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
272
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
273
+ }>;
274
+ }>;
275
+ readonly Ref: Schema.TaggedStruct<"Ref", {
276
+ readonly source: Schema.Struct<{
277
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
278
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
279
+ }>;
280
+ readonly byteLength: Schema.Int;
281
+ }>;
282
+ }>;
283
+ }>;
284
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
285
+ readonly partType: Schema.String;
286
+ }>;
287
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
288
+ readonly partType: Schema.String;
289
+ }>>, Schema.Struct<{
290
+ readonly _tag: Schema.String;
291
+ }>, never, never>]>;
292
+ type TranscriptAssistantPart = typeof TranscriptAssistantPart.Type;
293
+ /** Lifecycle of one framework tool call. The last terminal event wins. */
294
+ declare const TranscriptToolLifecycle: Schema.TaggedUnion<{
295
+ readonly Completed: Schema.TaggedStruct<"Completed", {
296
+ readonly result: Schema.TaggedUnion<{
297
+ readonly Inline: Schema.TaggedStruct<"Inline", {
298
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
299
+ readonly source: Schema.Struct<{
300
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
301
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
302
+ }>;
303
+ }>;
304
+ readonly Ref: Schema.TaggedStruct<"Ref", {
305
+ readonly source: Schema.Struct<{
306
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
307
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
308
+ }>;
309
+ readonly byteLength: Schema.Int;
310
+ }>;
311
+ }>;
312
+ }>;
313
+ readonly Created: Schema.TaggedStruct<"Created", {}>;
314
+ readonly Failed: Schema.TaggedStruct<"Failed", {
315
+ readonly error: Schema.Struct<{
316
+ readonly message: Schema.String;
317
+ readonly code: Schema.optionalKey<Schema.String>;
318
+ readonly details: Schema.optionalKey<Schema.Unknown>;
319
+ }>;
320
+ }>;
321
+ readonly Rejected: Schema.TaggedStruct<"Rejected", {
322
+ readonly reason: Schema.Literals<readonly ["unknown-tool", "invalid-params"]>;
323
+ readonly message: Schema.String;
324
+ readonly modelFeedback: Schema.String;
325
+ }>;
326
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
327
+ }>;
328
+ type TranscriptToolLifecycle = typeof TranscriptToolLifecycle.Type;
329
+ /** Outcome of one run inside a run group. */
330
+ declare const TranscriptRunOutcome: Schema.TaggedUnion<{
331
+ readonly Completed: Schema.TaggedStruct<"Completed", {}>;
332
+ readonly Failed: Schema.TaggedStruct<"Failed", {
333
+ readonly error: Schema.Struct<{
334
+ readonly message: Schema.String;
335
+ readonly code: Schema.optionalKey<Schema.String>;
336
+ readonly details: Schema.optionalKey<Schema.Unknown>;
337
+ }>;
338
+ }>;
339
+ readonly Interrupted: Schema.TaggedStruct<"Interrupted", {
340
+ readonly reason: Schema.String;
341
+ }>;
342
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
343
+ }>;
344
+ type TranscriptRunOutcome = typeof TranscriptRunOutcome.Type;
345
+ /** One run in a run group, in start order. */
346
+ declare const TranscriptRunMember: Schema.Struct<{
347
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
348
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
349
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
350
+ readonly runId: Schema.brand<Schema.String, "RunId">;
351
+ readonly commandIds: Schema.$Array<Schema.brand<Schema.String, "CommandId">>;
352
+ readonly modelSelection: Schema.Struct<{
353
+ readonly provider: Schema.NonEmptyString;
354
+ readonly modelId: Schema.NonEmptyString;
355
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
356
+ }>;
357
+ readonly outcome: Schema.TaggedUnion<{
358
+ readonly Completed: Schema.TaggedStruct<"Completed", {}>;
359
+ readonly Failed: Schema.TaggedStruct<"Failed", {
360
+ readonly error: Schema.Struct<{
361
+ readonly message: Schema.String;
362
+ readonly code: Schema.optionalKey<Schema.String>;
363
+ readonly details: Schema.optionalKey<Schema.Unknown>;
364
+ }>;
365
+ }>;
366
+ readonly Interrupted: Schema.TaggedStruct<"Interrupted", {
367
+ readonly reason: Schema.String;
368
+ }>;
369
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
370
+ }>;
371
+ /** The interrupted run this one continues, as recorded by startup recovery. */
372
+ readonly continuationOf: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
373
+ }>;
374
+ type TranscriptRunMember = typeof TranscriptRunMember.Type;
375
+ /** One decoration operation parked until its target exists, in arrival order. */
376
+ declare const TranscriptBufferedDecoration: Schema.Struct<{
377
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
378
+ readonly mapping: Schema.String;
379
+ /** Operation index within the mapping. */
380
+ readonly operation: Schema.Int;
381
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
382
+ readonly entryKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Int]>>;
383
+ /** The entry's id, for a list keyed by id or ordinal (`entryKey` then holds the ordinal). */
384
+ readonly entryId: Schema.optionalKey<Schema.NonEmptyString>;
385
+ }>;
386
+ type TranscriptBufferedDecoration = typeof TranscriptBufferedDecoration.Type;
387
+ /**
388
+ * Operations one decoration buffer keeps. Later operations for the same key are dropped, as are
389
+ * operations beyond the mapping bounds' decoration byte budget.
390
+ */
391
+ declare const transcriptDecorationBufferLimit = 32;
392
+ /**
393
+ * User submission, top-level once consumed; waiting states are dependencies.
394
+ *
395
+ * A position is assigned once, when the agent first reads the submission, so a consumed record
396
+ * always has one and a waiting record never does. A cancelled record keeps the position it was
397
+ * consumed at, if any, and is never rendered.
398
+ */
399
+ declare const TranscriptUserRecord: Schema.Struct<{
400
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
401
+ readonly messageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
402
+ readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
403
+ readonly disposition: Schema.optionalKey<Schema.Literals<readonly ["queue", "steer", "interrupt"]>>;
404
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
405
+ readonly type: Schema.Literal<"text">;
406
+ readonly text: Schema.String;
407
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
408
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
409
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
410
+ readonly type: Schema.Literal<"text">;
411
+ readonly text: Schema.String;
412
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
413
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
414
+ }>, Schema.decodeTo<Schema.Struct<{
415
+ readonly type: Schema.Literal<"file">;
416
+ readonly mediaType: Schema.String;
417
+ readonly fileName: Schema.optional<Schema.String>;
418
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
419
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
420
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
421
+ }>, Schema.Struct<{
422
+ readonly type: Schema.Literal<"file">;
423
+ readonly mediaType: Schema.String;
424
+ readonly fileName: Schema.optional<Schema.String>;
425
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
426
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
427
+ readonly data: Schema.String;
428
+ }>, never, never>]>>]>;
429
+ readonly state: Schema.TaggedUnion<{
430
+ readonly Cancelled: Schema.TaggedStruct<"Cancelled", {
431
+ readonly reason: Schema.String;
432
+ readonly byCommandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
433
+ }>;
434
+ readonly Consumed: Schema.TaggedStruct<"Consumed", {
435
+ readonly turnId: Schema.optionalKey<Schema.brand<Schema.String, "TurnId">>;
436
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
437
+ }>;
438
+ readonly Paused: Schema.TaggedStruct<"Paused", {
439
+ readonly byCommandId: Schema.brand<Schema.String, "CommandId">;
440
+ }>;
441
+ readonly Pending: Schema.TaggedStruct<"Pending", {}>;
442
+ readonly Promoted: Schema.TaggedStruct<"Promoted", {}>;
443
+ readonly Steering: Schema.TaggedStruct<"Steering", {}>;
444
+ }>;
445
+ readonly steering: Schema.optionalKey<Schema.Struct<{
446
+ readonly runId: Schema.brand<Schema.String, "RunId">;
447
+ }>>;
448
+ readonly classification: Schema.optionalKey<Schema.String>;
449
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
450
+ readonly List: Schema.TaggedStruct<"List", {
451
+ readonly entries: Schema.$Array<Schema.Struct<{
452
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
453
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
454
+ /** The entry's id when the list is keyed by id or ordinal (the key is then the ordinal). */
455
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
456
+ }>>;
457
+ }>;
458
+ readonly Value: Schema.TaggedStruct<"Value", {
459
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
460
+ }>;
461
+ }>>;
462
+ readonly submittedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
463
+ readonly submittedAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
464
+ readonly consumedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
465
+ readonly kind: Schema.tag<"user">;
466
+ readonly id: Schema.TemplateLiteral<readonly ["user:", Schema.brand<Schema.String, "CommandId">]>;
467
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
468
+ readonly position: Schema.optionalKey<Schema.Struct<{
469
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
470
+ readonly ordinal: Schema.Int;
471
+ }>>;
472
+ }>;
473
+ type TranscriptUserRecord = typeof TranscriptUserRecord.Type;
474
+ /** Assistant output of one inference or one import; top-level. */
475
+ declare const TranscriptAssistantRecord: Schema.Struct<{
476
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
477
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
478
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
479
+ readonly source: Schema.Literals<readonly ["inference", "import"]>;
480
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
481
+ readonly runId: Schema.brand<Schema.String, "RunId">;
482
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
483
+ readonly runGroupId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>>;
484
+ readonly messageId: Schema.optionalKey<Schema.brand<Schema.String, "MessageId">>;
485
+ readonly lifecycle: Schema.TaggedUnion<{
486
+ readonly Completed: Schema.TaggedStruct<"Completed", {
487
+ readonly finishReason: Schema.optionalKey<Schema.String>;
488
+ readonly usage: Schema.optionalKey<Schema.Struct<{
489
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
490
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
491
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
492
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
493
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
494
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
495
+ }>>;
496
+ }>;
497
+ readonly Failed: Schema.TaggedStruct<"Failed", {
498
+ readonly error: Schema.Struct<{
499
+ readonly message: Schema.String;
500
+ readonly code: Schema.optionalKey<Schema.String>;
501
+ readonly details: Schema.optionalKey<Schema.Unknown>;
502
+ }>;
503
+ }>;
504
+ readonly Streaming: Schema.TaggedStruct<"Streaming", {}>;
505
+ }>;
506
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.TaggedUnion<{
507
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
508
+ readonly text: Schema.String;
509
+ }>;
510
+ readonly Text: Schema.TaggedStruct<"Text", {
511
+ readonly text: Schema.String;
512
+ }>;
513
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
514
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
515
+ readonly toolName: Schema.NonEmptyString;
516
+ readonly providerExecuted: Schema.Boolean;
517
+ /** The framework tool record, once the call has been sealed into one. */
518
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
519
+ }>;
520
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
521
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
522
+ readonly toolName: Schema.NonEmptyString;
523
+ readonly isFailure: Schema.Boolean;
524
+ readonly result: Schema.TaggedUnion<{
525
+ readonly Inline: Schema.TaggedStruct<"Inline", {
526
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
527
+ readonly source: Schema.Struct<{
528
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
529
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
530
+ }>;
531
+ }>;
532
+ readonly Ref: Schema.TaggedStruct<"Ref", {
533
+ readonly source: Schema.Struct<{
534
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
535
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
536
+ }>;
537
+ readonly byteLength: Schema.Int;
538
+ }>;
539
+ }>;
540
+ }>;
541
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
542
+ readonly partType: Schema.String;
543
+ }>;
544
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
545
+ readonly partType: Schema.String;
546
+ }>>, Schema.Struct<{
547
+ readonly _tag: Schema.String;
548
+ }>, never, never>]>>;
549
+ readonly partial: Schema.optionalKey<Schema.Struct<{
550
+ readonly reason: Schema.String;
551
+ }>>;
552
+ readonly kind: Schema.tag<"assistant">;
553
+ readonly id: Schema.Union<readonly [Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>, Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>]>;
554
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
555
+ readonly position: Schema.Struct<{
556
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
557
+ readonly ordinal: Schema.Int;
558
+ }>;
559
+ }>;
560
+ type TranscriptAssistantRecord = typeof TranscriptAssistantRecord.Type;
561
+ /** Compaction marker; top-level. */
562
+ declare const TranscriptCompactionRecord: Schema.Struct<{
563
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
564
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
565
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
566
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
567
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
568
+ readonly completedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
569
+ readonly kind: Schema.tag<"compaction">;
570
+ readonly id: Schema.TemplateLiteral<readonly ["compaction:", Schema.brand<Schema.String, "CompactionId">]>;
571
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
572
+ readonly position: Schema.Struct<{
573
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
574
+ readonly ordinal: Schema.Int;
575
+ }>;
576
+ }>;
577
+ type TranscriptCompactionRecord = typeof TranscriptCompactionRecord.Type;
578
+ /** Framework tool call; a dependency of its assistant record. */
579
+ declare const TranscriptToolRecord: Schema.Struct<{
580
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
581
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
582
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
583
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
584
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
585
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
586
+ readonly toolName: Schema.NonEmptyString;
587
+ readonly providerExecuted: Schema.Boolean;
588
+ readonly params: Schema.optionalKey<Schema.TaggedUnion<{
589
+ readonly Inline: Schema.TaggedStruct<"Inline", {
590
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
591
+ readonly source: Schema.Struct<{
592
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
593
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
594
+ }>;
595
+ }>;
596
+ readonly Ref: Schema.TaggedStruct<"Ref", {
597
+ readonly source: Schema.Struct<{
598
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
599
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
600
+ }>;
601
+ readonly byteLength: Schema.Int;
602
+ }>;
603
+ }>>;
604
+ readonly lifecycle: Schema.TaggedUnion<{
605
+ readonly Completed: Schema.TaggedStruct<"Completed", {
606
+ readonly result: Schema.TaggedUnion<{
607
+ readonly Inline: Schema.TaggedStruct<"Inline", {
608
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
609
+ readonly source: Schema.Struct<{
610
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
611
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
612
+ }>;
613
+ }>;
614
+ readonly Ref: Schema.TaggedStruct<"Ref", {
615
+ readonly source: Schema.Struct<{
616
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
617
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
618
+ }>;
619
+ readonly byteLength: Schema.Int;
620
+ }>;
621
+ }>;
622
+ }>;
623
+ readonly Created: Schema.TaggedStruct<"Created", {}>;
624
+ readonly Failed: Schema.TaggedStruct<"Failed", {
625
+ readonly error: Schema.Struct<{
626
+ readonly message: Schema.String;
627
+ readonly code: Schema.optionalKey<Schema.String>;
628
+ readonly details: Schema.optionalKey<Schema.Unknown>;
629
+ }>;
630
+ }>;
631
+ readonly Rejected: Schema.TaggedStruct<"Rejected", {
632
+ readonly reason: Schema.Literals<readonly ["unknown-tool", "invalid-params"]>;
633
+ readonly message: Schema.String;
634
+ readonly modelFeedback: Schema.String;
635
+ }>;
636
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
637
+ }>;
638
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
639
+ readonly kind: Schema.tag<"tool">;
640
+ readonly id: Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>;
641
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
642
+ }>;
643
+ type TranscriptToolRecord = typeof TranscriptToolRecord.Type;
644
+ /** Run and its recovery continuations; a dependency of the records it produced. */
645
+ declare const TranscriptRunGroupRecord: Schema.Struct<{
646
+ readonly rootRunId: Schema.brand<Schema.String, "RunId">;
647
+ readonly runs: Schema.NonEmptyArray<Schema.Struct<{
648
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
649
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
650
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
651
+ readonly runId: Schema.brand<Schema.String, "RunId">;
652
+ readonly commandIds: Schema.$Array<Schema.brand<Schema.String, "CommandId">>;
653
+ readonly modelSelection: Schema.Struct<{
654
+ readonly provider: Schema.NonEmptyString;
655
+ readonly modelId: Schema.NonEmptyString;
656
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
657
+ }>;
658
+ readonly outcome: Schema.TaggedUnion<{
659
+ readonly Completed: Schema.TaggedStruct<"Completed", {}>;
660
+ readonly Failed: Schema.TaggedStruct<"Failed", {
661
+ readonly error: Schema.Struct<{
662
+ readonly message: Schema.String;
663
+ readonly code: Schema.optionalKey<Schema.String>;
664
+ readonly details: Schema.optionalKey<Schema.Unknown>;
665
+ }>;
666
+ }>;
667
+ readonly Interrupted: Schema.TaggedStruct<"Interrupted", {
668
+ readonly reason: Schema.String;
669
+ }>;
670
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
671
+ }>;
672
+ /** The interrupted run this one continues, as recorded by startup recovery. */
673
+ readonly continuationOf: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
674
+ }>>;
675
+ readonly kind: Schema.tag<"runGroup">;
676
+ readonly id: Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>;
677
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
678
+ }>;
679
+ type TranscriptRunGroupRecord = typeof TranscriptRunGroupRecord.Type;
680
+ /** A run group's status: the outcome of its latest run. */
681
+ declare const runGroupStatus: (group: TranscriptRunGroupRecord) => TranscriptRunOutcome;
682
+ /** Session activity, model selection and token totals; a singleton dependency. */
683
+ declare const TranscriptSessionContextRecord: Schema.Struct<{
684
+ readonly activeRunId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
685
+ readonly activeCompactionId: Schema.optionalKey<Schema.brand<Schema.String, "CompactionId">>;
686
+ readonly modelSelection: Schema.optionalKey<Schema.Struct<{
687
+ readonly provider: Schema.NonEmptyString;
688
+ readonly modelId: Schema.NonEmptyString;
689
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
690
+ }>>;
691
+ readonly lastRunModelSelection: Schema.optionalKey<Schema.Struct<{
692
+ readonly provider: Schema.NonEmptyString;
693
+ readonly modelId: Schema.NonEmptyString;
694
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
695
+ }>>;
696
+ readonly tokenUsage: Schema.Struct<{
697
+ readonly byModel: Schema.$Array<Schema.Struct<{
698
+ readonly provider: Schema.NonEmptyString;
699
+ readonly modelId: Schema.NonEmptyString;
700
+ readonly usage: Schema.Struct<{
701
+ readonly inputTokens: Schema.Int;
702
+ readonly cachedInputTokens: Schema.Int;
703
+ readonly cacheWriteInputTokens: Schema.Int;
704
+ readonly outputTokens: Schema.Int;
705
+ readonly textTokens: Schema.Int;
706
+ readonly reasoningTokens: Schema.Int;
707
+ }>;
708
+ }>>;
709
+ }>;
710
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
711
+ readonly List: Schema.TaggedStruct<"List", {
712
+ readonly entries: Schema.$Array<Schema.Struct<{
713
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
714
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
715
+ /** The entry's id when the list is keyed by id or ordinal (the key is then the ordinal). */
716
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
717
+ }>>;
718
+ }>;
719
+ readonly Value: Schema.TaggedStruct<"Value", {
720
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
721
+ }>;
722
+ }>>;
723
+ readonly kind: Schema.tag<"sessionContext">;
724
+ readonly id: Schema.Literal<"session">;
725
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
726
+ }>;
727
+ type TranscriptSessionContextRecord = typeof TranscriptSessionContextRecord.Type;
728
+ /** Internal decoration holding record; stored, never served. */
729
+ declare const TranscriptDecorationBufferRecord: Schema.Struct<{
730
+ readonly operations: Schema.$Array<Schema.Struct<{
731
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
732
+ readonly mapping: Schema.String;
733
+ /** Operation index within the mapping. */
734
+ readonly operation: Schema.Int;
735
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
736
+ readonly entryKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Int]>>;
737
+ /** The entry's id, for a list keyed by id or ordinal (`entryKey` then holds the ordinal). */
738
+ readonly entryId: Schema.optionalKey<Schema.NonEmptyString>;
739
+ }>>;
740
+ readonly kind: Schema.tag<"decorationBuffer">;
741
+ readonly id: Schema.TemplateLiteral<readonly ["decorations:", Schema.Literals<readonly ["command", "idempotencyKey"]>, ":", Schema.NonEmptyString]>;
742
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
743
+ }>;
744
+ type TranscriptDecorationBufferRecord = typeof TranscriptDecorationBufferRecord.Type;
745
+ /** Every record kind this EDA release stores. */
746
+ declare const TranscriptRecord: Schema.Union<readonly [Schema.Struct<{
747
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
748
+ readonly messageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
749
+ readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
750
+ readonly disposition: Schema.optionalKey<Schema.Literals<readonly ["queue", "steer", "interrupt"]>>;
751
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
752
+ readonly type: Schema.Literal<"text">;
753
+ readonly text: Schema.String;
754
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
755
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
756
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
757
+ readonly type: Schema.Literal<"text">;
758
+ readonly text: Schema.String;
759
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
760
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
761
+ }>, Schema.decodeTo<Schema.Struct<{
762
+ readonly type: Schema.Literal<"file">;
763
+ readonly mediaType: Schema.String;
764
+ readonly fileName: Schema.optional<Schema.String>;
765
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
766
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
767
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
768
+ }>, Schema.Struct<{
769
+ readonly type: Schema.Literal<"file">;
770
+ readonly mediaType: Schema.String;
771
+ readonly fileName: Schema.optional<Schema.String>;
772
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
773
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
774
+ readonly data: Schema.String;
775
+ }>, never, never>]>>]>;
776
+ readonly state: Schema.TaggedUnion<{
777
+ readonly Cancelled: Schema.TaggedStruct<"Cancelled", {
778
+ readonly reason: Schema.String;
779
+ readonly byCommandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
780
+ }>;
781
+ readonly Consumed: Schema.TaggedStruct<"Consumed", {
782
+ readonly turnId: Schema.optionalKey<Schema.brand<Schema.String, "TurnId">>;
783
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
784
+ }>;
785
+ readonly Paused: Schema.TaggedStruct<"Paused", {
786
+ readonly byCommandId: Schema.brand<Schema.String, "CommandId">;
787
+ }>;
788
+ readonly Pending: Schema.TaggedStruct<"Pending", {}>;
789
+ readonly Promoted: Schema.TaggedStruct<"Promoted", {}>;
790
+ readonly Steering: Schema.TaggedStruct<"Steering", {}>;
791
+ }>;
792
+ readonly steering: Schema.optionalKey<Schema.Struct<{
793
+ readonly runId: Schema.brand<Schema.String, "RunId">;
794
+ }>>;
795
+ readonly classification: Schema.optionalKey<Schema.String>;
796
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
797
+ readonly List: Schema.TaggedStruct<"List", {
798
+ readonly entries: Schema.$Array<Schema.Struct<{
799
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
800
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
801
+ /** The entry's id when the list is keyed by id or ordinal (the key is then the ordinal). */
802
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
803
+ }>>;
804
+ }>;
805
+ readonly Value: Schema.TaggedStruct<"Value", {
806
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
807
+ }>;
808
+ }>>;
809
+ readonly submittedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
810
+ readonly submittedAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
811
+ readonly consumedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
812
+ readonly kind: Schema.tag<"user">;
813
+ readonly id: Schema.TemplateLiteral<readonly ["user:", Schema.brand<Schema.String, "CommandId">]>;
814
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
815
+ readonly position: Schema.optionalKey<Schema.Struct<{
816
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
817
+ readonly ordinal: Schema.Int;
818
+ }>>;
819
+ }>, Schema.Struct<{
820
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
821
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
822
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
823
+ readonly source: Schema.Literals<readonly ["inference", "import"]>;
824
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
825
+ readonly runId: Schema.brand<Schema.String, "RunId">;
826
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
827
+ readonly runGroupId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>>;
828
+ readonly messageId: Schema.optionalKey<Schema.brand<Schema.String, "MessageId">>;
829
+ readonly lifecycle: Schema.TaggedUnion<{
830
+ readonly Completed: Schema.TaggedStruct<"Completed", {
831
+ readonly finishReason: Schema.optionalKey<Schema.String>;
832
+ readonly usage: Schema.optionalKey<Schema.Struct<{
833
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
834
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
835
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
836
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
837
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
838
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
839
+ }>>;
840
+ }>;
841
+ readonly Failed: Schema.TaggedStruct<"Failed", {
842
+ readonly error: Schema.Struct<{
843
+ readonly message: Schema.String;
844
+ readonly code: Schema.optionalKey<Schema.String>;
845
+ readonly details: Schema.optionalKey<Schema.Unknown>;
846
+ }>;
847
+ }>;
848
+ readonly Streaming: Schema.TaggedStruct<"Streaming", {}>;
849
+ }>;
850
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.TaggedUnion<{
851
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
852
+ readonly text: Schema.String;
853
+ }>;
854
+ readonly Text: Schema.TaggedStruct<"Text", {
855
+ readonly text: Schema.String;
856
+ }>;
857
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
858
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
859
+ readonly toolName: Schema.NonEmptyString;
860
+ readonly providerExecuted: Schema.Boolean;
861
+ /** The framework tool record, once the call has been sealed into one. */
862
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
863
+ }>;
864
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
865
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
866
+ readonly toolName: Schema.NonEmptyString;
867
+ readonly isFailure: Schema.Boolean;
868
+ readonly result: Schema.TaggedUnion<{
869
+ readonly Inline: Schema.TaggedStruct<"Inline", {
870
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
871
+ readonly source: Schema.Struct<{
872
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
873
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
874
+ }>;
875
+ }>;
876
+ readonly Ref: Schema.TaggedStruct<"Ref", {
877
+ readonly source: Schema.Struct<{
878
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
879
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
880
+ }>;
881
+ readonly byteLength: Schema.Int;
882
+ }>;
883
+ }>;
884
+ }>;
885
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
886
+ readonly partType: Schema.String;
887
+ }>;
888
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
889
+ readonly partType: Schema.String;
890
+ }>>, Schema.Struct<{
891
+ readonly _tag: Schema.String;
892
+ }>, never, never>]>>;
893
+ readonly partial: Schema.optionalKey<Schema.Struct<{
894
+ readonly reason: Schema.String;
895
+ }>>;
896
+ readonly kind: Schema.tag<"assistant">;
897
+ readonly id: Schema.Union<readonly [Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>, Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>]>;
898
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
899
+ readonly position: Schema.Struct<{
900
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
901
+ readonly ordinal: Schema.Int;
902
+ }>;
903
+ }>, Schema.Struct<{
904
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
905
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
906
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
907
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
908
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
909
+ readonly completedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
910
+ readonly kind: Schema.tag<"compaction">;
911
+ readonly id: Schema.TemplateLiteral<readonly ["compaction:", Schema.brand<Schema.String, "CompactionId">]>;
912
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
913
+ readonly position: Schema.Struct<{
914
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
915
+ readonly ordinal: Schema.Int;
916
+ }>;
917
+ }>, Schema.Struct<{
918
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
919
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
920
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
921
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
922
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
923
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
924
+ readonly toolName: Schema.NonEmptyString;
925
+ readonly providerExecuted: Schema.Boolean;
926
+ readonly params: Schema.optionalKey<Schema.TaggedUnion<{
927
+ readonly Inline: Schema.TaggedStruct<"Inline", {
928
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
929
+ readonly source: Schema.Struct<{
930
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
931
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
932
+ }>;
933
+ }>;
934
+ readonly Ref: Schema.TaggedStruct<"Ref", {
935
+ readonly source: Schema.Struct<{
936
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
937
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
938
+ }>;
939
+ readonly byteLength: Schema.Int;
940
+ }>;
941
+ }>>;
942
+ readonly lifecycle: Schema.TaggedUnion<{
943
+ readonly Completed: Schema.TaggedStruct<"Completed", {
944
+ readonly result: Schema.TaggedUnion<{
945
+ readonly Inline: Schema.TaggedStruct<"Inline", {
946
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
947
+ readonly source: Schema.Struct<{
948
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
949
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
950
+ }>;
951
+ }>;
952
+ readonly Ref: Schema.TaggedStruct<"Ref", {
953
+ readonly source: Schema.Struct<{
954
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
955
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
956
+ }>;
957
+ readonly byteLength: Schema.Int;
958
+ }>;
959
+ }>;
960
+ }>;
961
+ readonly Created: Schema.TaggedStruct<"Created", {}>;
962
+ readonly Failed: Schema.TaggedStruct<"Failed", {
963
+ readonly error: Schema.Struct<{
964
+ readonly message: Schema.String;
965
+ readonly code: Schema.optionalKey<Schema.String>;
966
+ readonly details: Schema.optionalKey<Schema.Unknown>;
967
+ }>;
968
+ }>;
969
+ readonly Rejected: Schema.TaggedStruct<"Rejected", {
970
+ readonly reason: Schema.Literals<readonly ["unknown-tool", "invalid-params"]>;
971
+ readonly message: Schema.String;
972
+ readonly modelFeedback: Schema.String;
973
+ }>;
974
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
975
+ }>;
976
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
977
+ readonly kind: Schema.tag<"tool">;
978
+ readonly id: Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>;
979
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
980
+ }>, Schema.Struct<{
981
+ readonly rootRunId: Schema.brand<Schema.String, "RunId">;
982
+ readonly runs: Schema.NonEmptyArray<Schema.Struct<{
983
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
984
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
985
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
986
+ readonly runId: Schema.brand<Schema.String, "RunId">;
987
+ readonly commandIds: Schema.$Array<Schema.brand<Schema.String, "CommandId">>;
988
+ readonly modelSelection: Schema.Struct<{
989
+ readonly provider: Schema.NonEmptyString;
990
+ readonly modelId: Schema.NonEmptyString;
991
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
992
+ }>;
993
+ readonly outcome: Schema.TaggedUnion<{
994
+ readonly Completed: Schema.TaggedStruct<"Completed", {}>;
995
+ readonly Failed: Schema.TaggedStruct<"Failed", {
996
+ readonly error: Schema.Struct<{
997
+ readonly message: Schema.String;
998
+ readonly code: Schema.optionalKey<Schema.String>;
999
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1000
+ }>;
1001
+ }>;
1002
+ readonly Interrupted: Schema.TaggedStruct<"Interrupted", {
1003
+ readonly reason: Schema.String;
1004
+ }>;
1005
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
1006
+ }>;
1007
+ /** The interrupted run this one continues, as recorded by startup recovery. */
1008
+ readonly continuationOf: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
1009
+ }>>;
1010
+ readonly kind: Schema.tag<"runGroup">;
1011
+ readonly id: Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>;
1012
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1013
+ }>, Schema.Struct<{
1014
+ readonly activeRunId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
1015
+ readonly activeCompactionId: Schema.optionalKey<Schema.brand<Schema.String, "CompactionId">>;
1016
+ readonly modelSelection: Schema.optionalKey<Schema.Struct<{
1017
+ readonly provider: Schema.NonEmptyString;
1018
+ readonly modelId: Schema.NonEmptyString;
1019
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
1020
+ }>>;
1021
+ readonly lastRunModelSelection: Schema.optionalKey<Schema.Struct<{
1022
+ readonly provider: Schema.NonEmptyString;
1023
+ readonly modelId: Schema.NonEmptyString;
1024
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
1025
+ }>>;
1026
+ readonly tokenUsage: Schema.Struct<{
1027
+ readonly byModel: Schema.$Array<Schema.Struct<{
1028
+ readonly provider: Schema.NonEmptyString;
1029
+ readonly modelId: Schema.NonEmptyString;
1030
+ readonly usage: Schema.Struct<{
1031
+ readonly inputTokens: Schema.Int;
1032
+ readonly cachedInputTokens: Schema.Int;
1033
+ readonly cacheWriteInputTokens: Schema.Int;
1034
+ readonly outputTokens: Schema.Int;
1035
+ readonly textTokens: Schema.Int;
1036
+ readonly reasoningTokens: Schema.Int;
1037
+ }>;
1038
+ }>>;
1039
+ }>;
1040
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
1041
+ readonly List: Schema.TaggedStruct<"List", {
1042
+ readonly entries: Schema.$Array<Schema.Struct<{
1043
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
1044
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1045
+ /** The entry's id when the list is keyed by id or ordinal (the key is then the ordinal). */
1046
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
1047
+ }>>;
1048
+ }>;
1049
+ readonly Value: Schema.TaggedStruct<"Value", {
1050
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1051
+ }>;
1052
+ }>>;
1053
+ readonly kind: Schema.tag<"sessionContext">;
1054
+ readonly id: Schema.Literal<"session">;
1055
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1056
+ }>, Schema.Struct<{
1057
+ readonly operations: Schema.$Array<Schema.Struct<{
1058
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1059
+ readonly mapping: Schema.String;
1060
+ /** Operation index within the mapping. */
1061
+ readonly operation: Schema.Int;
1062
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1063
+ readonly entryKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1064
+ /** The entry's id, for a list keyed by id or ordinal (`entryKey` then holds the ordinal). */
1065
+ readonly entryId: Schema.optionalKey<Schema.NonEmptyString>;
1066
+ }>>;
1067
+ readonly kind: Schema.tag<"decorationBuffer">;
1068
+ readonly id: Schema.TemplateLiteral<readonly ["decorations:", Schema.Literals<readonly ["command", "idempotencyKey"]>, ":", Schema.NonEmptyString]>;
1069
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1070
+ }>]>;
1071
+ type TranscriptRecord = typeof TranscriptRecord.Type;
1072
+ type TranscriptRecordKind = TranscriptRecord["kind"];
1073
+ /**
1074
+ * A record this reader cannot interpret: a newer kind, or a body written by a newer EDA.
1075
+ *
1076
+ * It keeps the identity, position and revision so a client can hold its place and render a safe
1077
+ * placeholder. Storage readers do not produce it: an undecodable stored row makes a read
1078
+ * unavailable instead of wrong.
1079
+ */
1080
+ declare const TranscriptUnknownRecord: Schema.Struct<{
1081
+ readonly kind: Schema.tag<"unknown">;
1082
+ readonly originalKind: Schema.NonEmptyString;
1083
+ /** The envelope format it arrived in, kept so it re-encodes exactly as it was read. */
1084
+ readonly format: Schema.Int;
1085
+ /** The uninterpreted body, kept so a relaying reader forwards it unchanged. */
1086
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
1087
+ readonly id: Schema.NonEmptyString;
1088
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1089
+ readonly position: Schema.optionalKey<Schema.Struct<{
1090
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1091
+ readonly ordinal: Schema.Int;
1092
+ }>>;
1093
+ }>;
1094
+ type TranscriptUnknownRecord = typeof TranscriptUnknownRecord.Type;
1095
+ /** What a wire reader sees for one record. */
1096
+ type TranscriptRecordView = TranscriptRecord | TranscriptUnknownRecord;
1097
+ /** A user record the agent has read: positioned history. */
1098
+ type ConsumedTranscriptUserRecord = TranscriptUserRecord & {
1099
+ readonly state: Extract<TranscriptUserState, {
1100
+ readonly _tag: "Consumed";
1101
+ }>;
1102
+ readonly position: TranscriptPosition;
1103
+ };
1104
+ /** A user record still waiting for the agent. */
1105
+ type PendingTranscriptUserRecord = TranscriptUserRecord & {
1106
+ readonly state: Extract<TranscriptUserState, {
1107
+ readonly _tag: "Pending" | "Paused" | "Promoted" | "Steering";
1108
+ }>;
1109
+ };
1110
+ /** A positioned record that counts toward a window's record limit. */
1111
+ type TranscriptTopLevelRecord = ConsumedTranscriptUserRecord | TranscriptAssistantRecord | TranscriptCompactionRecord;
1112
+ /** Top-level kinds count toward a window's record limit and carry a position. */
1113
+ declare const isTopLevelTranscriptRecord: (record: TranscriptRecord) => record is TranscriptTopLevelRecord;
1114
+ /** A user record still waiting for the agent; served as a dependency, never twice. */
1115
+ declare const isPendingTranscriptUserRecord: (record: TranscriptRecord) => record is PendingTranscriptUserRecord;
1116
+ /**
1117
+ * Current stored-row envelope format. Readers accept every format up to this one.
1118
+ *
1119
+ * Bump it whenever a known kind gains a value an older reader of this format could not decode
1120
+ * (a new lifecycle or state tag, a new required field). Older readers then show such rows as
1121
+ * `unknown` records; without a bump, a strict older reader would reject the whole window.
1122
+ */
1123
+ declare const transcriptRecordEnvelopeFormat = 1;
1124
+ /**
1125
+ * Backward-readable row and wire shape for one record.
1126
+ *
1127
+ * Identity, kind, revision and position sit outside the kind-specific `body` so any reader can
1128
+ * place a record it cannot interpret.
1129
+ */
1130
+ declare const TranscriptRecordEnvelope: Schema.Struct<{
1131
+ readonly format: Schema.Int;
1132
+ readonly kind: Schema.NonEmptyString;
1133
+ readonly id: Schema.NonEmptyString;
1134
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1135
+ readonly position: Schema.optionalKey<Schema.Struct<{
1136
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1137
+ readonly ordinal: Schema.Int;
1138
+ }>>;
1139
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
1140
+ }>;
1141
+ type TranscriptRecordEnvelope = typeof TranscriptRecordEnvelope.Type;
1142
+ /** A known record stored or sent as its envelope. Decoding fails for anything this reader cannot interpret. */
1143
+ declare const TranscriptRecordFromEnvelope: Schema.decodeTo<Schema.Union<readonly [Schema.Struct<{
1144
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
1145
+ readonly messageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
1146
+ readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
1147
+ readonly disposition: Schema.optionalKey<Schema.Literals<readonly ["queue", "steer", "interrupt"]>>;
1148
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
1149
+ readonly type: Schema.Literal<"text">;
1150
+ readonly text: Schema.String;
1151
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1152
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1153
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
1154
+ readonly type: Schema.Literal<"text">;
1155
+ readonly text: 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
+ }>, Schema.decodeTo<Schema.Struct<{
1159
+ readonly type: Schema.Literal<"file">;
1160
+ readonly mediaType: Schema.String;
1161
+ readonly fileName: Schema.optional<Schema.String>;
1162
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
1163
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1164
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1165
+ }>, Schema.Struct<{
1166
+ readonly type: Schema.Literal<"file">;
1167
+ readonly mediaType: Schema.String;
1168
+ readonly fileName: Schema.optional<Schema.String>;
1169
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1170
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1171
+ readonly data: Schema.String;
1172
+ }>, never, never>]>>]>;
1173
+ readonly state: Schema.TaggedUnion<{
1174
+ readonly Cancelled: Schema.TaggedStruct<"Cancelled", {
1175
+ readonly reason: Schema.String;
1176
+ readonly byCommandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
1177
+ }>;
1178
+ readonly Consumed: Schema.TaggedStruct<"Consumed", {
1179
+ readonly turnId: Schema.optionalKey<Schema.brand<Schema.String, "TurnId">>;
1180
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
1181
+ }>;
1182
+ readonly Paused: Schema.TaggedStruct<"Paused", {
1183
+ readonly byCommandId: Schema.brand<Schema.String, "CommandId">;
1184
+ }>;
1185
+ readonly Pending: Schema.TaggedStruct<"Pending", {}>;
1186
+ readonly Promoted: Schema.TaggedStruct<"Promoted", {}>;
1187
+ readonly Steering: Schema.TaggedStruct<"Steering", {}>;
1188
+ }>;
1189
+ readonly steering: Schema.optionalKey<Schema.Struct<{
1190
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1191
+ }>>;
1192
+ readonly classification: Schema.optionalKey<Schema.String>;
1193
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
1194
+ readonly List: Schema.TaggedStruct<"List", {
1195
+ readonly entries: Schema.$Array<Schema.Struct<{
1196
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
1197
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1198
+ /** The entry's id when the list is keyed by id or ordinal (the key is then the ordinal). */
1199
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
1200
+ }>>;
1201
+ }>;
1202
+ readonly Value: Schema.TaggedStruct<"Value", {
1203
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1204
+ }>;
1205
+ }>>;
1206
+ readonly submittedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1207
+ readonly submittedAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1208
+ readonly consumedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1209
+ readonly kind: Schema.tag<"user">;
1210
+ readonly id: Schema.TemplateLiteral<readonly ["user:", Schema.brand<Schema.String, "CommandId">]>;
1211
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1212
+ readonly position: Schema.optionalKey<Schema.Struct<{
1213
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1214
+ readonly ordinal: Schema.Int;
1215
+ }>>;
1216
+ }>, Schema.Struct<{
1217
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1218
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1219
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
1220
+ readonly source: Schema.Literals<readonly ["inference", "import"]>;
1221
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
1222
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1223
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1224
+ readonly runGroupId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>>;
1225
+ readonly messageId: Schema.optionalKey<Schema.brand<Schema.String, "MessageId">>;
1226
+ readonly lifecycle: Schema.TaggedUnion<{
1227
+ readonly Completed: Schema.TaggedStruct<"Completed", {
1228
+ readonly finishReason: Schema.optionalKey<Schema.String>;
1229
+ readonly usage: Schema.optionalKey<Schema.Struct<{
1230
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
1231
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
1232
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
1233
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
1234
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
1235
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
1236
+ }>>;
1237
+ }>;
1238
+ readonly Failed: Schema.TaggedStruct<"Failed", {
1239
+ readonly error: Schema.Struct<{
1240
+ readonly message: Schema.String;
1241
+ readonly code: Schema.optionalKey<Schema.String>;
1242
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1243
+ }>;
1244
+ }>;
1245
+ readonly Streaming: Schema.TaggedStruct<"Streaming", {}>;
1246
+ }>;
1247
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.TaggedUnion<{
1248
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
1249
+ readonly text: Schema.String;
1250
+ }>;
1251
+ readonly Text: Schema.TaggedStruct<"Text", {
1252
+ readonly text: Schema.String;
1253
+ }>;
1254
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
1255
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
1256
+ readonly toolName: Schema.NonEmptyString;
1257
+ readonly providerExecuted: Schema.Boolean;
1258
+ /** The framework tool record, once the call has been sealed into one. */
1259
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
1260
+ }>;
1261
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
1262
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
1263
+ readonly toolName: Schema.NonEmptyString;
1264
+ readonly isFailure: Schema.Boolean;
1265
+ readonly result: Schema.TaggedUnion<{
1266
+ readonly Inline: Schema.TaggedStruct<"Inline", {
1267
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1268
+ readonly source: Schema.Struct<{
1269
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1270
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1271
+ }>;
1272
+ }>;
1273
+ readonly Ref: Schema.TaggedStruct<"Ref", {
1274
+ readonly source: Schema.Struct<{
1275
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1276
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1277
+ }>;
1278
+ readonly byteLength: Schema.Int;
1279
+ }>;
1280
+ }>;
1281
+ }>;
1282
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
1283
+ readonly partType: Schema.String;
1284
+ }>;
1285
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
1286
+ readonly partType: Schema.String;
1287
+ }>>, Schema.Struct<{
1288
+ readonly _tag: Schema.String;
1289
+ }>, never, never>]>>;
1290
+ readonly partial: Schema.optionalKey<Schema.Struct<{
1291
+ readonly reason: Schema.String;
1292
+ }>>;
1293
+ readonly kind: Schema.tag<"assistant">;
1294
+ readonly id: Schema.Union<readonly [Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>, Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>]>;
1295
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1296
+ readonly position: Schema.Struct<{
1297
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1298
+ readonly ordinal: Schema.Int;
1299
+ }>;
1300
+ }>, Schema.Struct<{
1301
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
1302
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
1303
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
1304
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1305
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1306
+ readonly completedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1307
+ readonly kind: Schema.tag<"compaction">;
1308
+ readonly id: Schema.TemplateLiteral<readonly ["compaction:", Schema.brand<Schema.String, "CompactionId">]>;
1309
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1310
+ readonly position: Schema.Struct<{
1311
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1312
+ readonly ordinal: Schema.Int;
1313
+ }>;
1314
+ }>, Schema.Struct<{
1315
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1316
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1317
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
1318
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
1319
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
1320
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
1321
+ readonly toolName: Schema.NonEmptyString;
1322
+ readonly providerExecuted: Schema.Boolean;
1323
+ readonly params: Schema.optionalKey<Schema.TaggedUnion<{
1324
+ readonly Inline: Schema.TaggedStruct<"Inline", {
1325
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1326
+ readonly source: Schema.Struct<{
1327
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1328
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1329
+ }>;
1330
+ }>;
1331
+ readonly Ref: Schema.TaggedStruct<"Ref", {
1332
+ readonly source: Schema.Struct<{
1333
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1334
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1335
+ }>;
1336
+ readonly byteLength: Schema.Int;
1337
+ }>;
1338
+ }>>;
1339
+ readonly lifecycle: Schema.TaggedUnion<{
1340
+ readonly Completed: Schema.TaggedStruct<"Completed", {
1341
+ readonly result: Schema.TaggedUnion<{
1342
+ readonly Inline: Schema.TaggedStruct<"Inline", {
1343
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1344
+ readonly source: Schema.Struct<{
1345
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1346
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1347
+ }>;
1348
+ }>;
1349
+ readonly Ref: Schema.TaggedStruct<"Ref", {
1350
+ readonly source: Schema.Struct<{
1351
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1352
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1353
+ }>;
1354
+ readonly byteLength: Schema.Int;
1355
+ }>;
1356
+ }>;
1357
+ }>;
1358
+ readonly Created: Schema.TaggedStruct<"Created", {}>;
1359
+ readonly Failed: Schema.TaggedStruct<"Failed", {
1360
+ readonly error: Schema.Struct<{
1361
+ readonly message: Schema.String;
1362
+ readonly code: Schema.optionalKey<Schema.String>;
1363
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1364
+ }>;
1365
+ }>;
1366
+ readonly Rejected: Schema.TaggedStruct<"Rejected", {
1367
+ readonly reason: Schema.Literals<readonly ["unknown-tool", "invalid-params"]>;
1368
+ readonly message: Schema.String;
1369
+ readonly modelFeedback: Schema.String;
1370
+ }>;
1371
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
1372
+ }>;
1373
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1374
+ readonly kind: Schema.tag<"tool">;
1375
+ readonly id: Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>;
1376
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1377
+ }>, Schema.Struct<{
1378
+ readonly rootRunId: Schema.brand<Schema.String, "RunId">;
1379
+ readonly runs: Schema.NonEmptyArray<Schema.Struct<{
1380
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1381
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1382
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
1383
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1384
+ readonly commandIds: Schema.$Array<Schema.brand<Schema.String, "CommandId">>;
1385
+ readonly modelSelection: Schema.Struct<{
1386
+ readonly provider: Schema.NonEmptyString;
1387
+ readonly modelId: Schema.NonEmptyString;
1388
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
1389
+ }>;
1390
+ readonly outcome: Schema.TaggedUnion<{
1391
+ readonly Completed: Schema.TaggedStruct<"Completed", {}>;
1392
+ readonly Failed: Schema.TaggedStruct<"Failed", {
1393
+ readonly error: Schema.Struct<{
1394
+ readonly message: Schema.String;
1395
+ readonly code: Schema.optionalKey<Schema.String>;
1396
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1397
+ }>;
1398
+ }>;
1399
+ readonly Interrupted: Schema.TaggedStruct<"Interrupted", {
1400
+ readonly reason: Schema.String;
1401
+ }>;
1402
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
1403
+ }>;
1404
+ /** The interrupted run this one continues, as recorded by startup recovery. */
1405
+ readonly continuationOf: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
1406
+ }>>;
1407
+ readonly kind: Schema.tag<"runGroup">;
1408
+ readonly id: Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>;
1409
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1410
+ }>, Schema.Struct<{
1411
+ readonly activeRunId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
1412
+ readonly activeCompactionId: Schema.optionalKey<Schema.brand<Schema.String, "CompactionId">>;
1413
+ readonly modelSelection: Schema.optionalKey<Schema.Struct<{
1414
+ readonly provider: Schema.NonEmptyString;
1415
+ readonly modelId: Schema.NonEmptyString;
1416
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
1417
+ }>>;
1418
+ readonly lastRunModelSelection: Schema.optionalKey<Schema.Struct<{
1419
+ readonly provider: Schema.NonEmptyString;
1420
+ readonly modelId: Schema.NonEmptyString;
1421
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
1422
+ }>>;
1423
+ readonly tokenUsage: Schema.Struct<{
1424
+ readonly byModel: Schema.$Array<Schema.Struct<{
1425
+ readonly provider: Schema.NonEmptyString;
1426
+ readonly modelId: Schema.NonEmptyString;
1427
+ readonly usage: Schema.Struct<{
1428
+ readonly inputTokens: Schema.Int;
1429
+ readonly cachedInputTokens: Schema.Int;
1430
+ readonly cacheWriteInputTokens: Schema.Int;
1431
+ readonly outputTokens: Schema.Int;
1432
+ readonly textTokens: Schema.Int;
1433
+ readonly reasoningTokens: Schema.Int;
1434
+ }>;
1435
+ }>>;
1436
+ }>;
1437
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
1438
+ readonly List: Schema.TaggedStruct<"List", {
1439
+ readonly entries: Schema.$Array<Schema.Struct<{
1440
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
1441
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1442
+ /** The entry's id when the list is keyed by id or ordinal (the key is then the ordinal). */
1443
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
1444
+ }>>;
1445
+ }>;
1446
+ readonly Value: Schema.TaggedStruct<"Value", {
1447
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1448
+ }>;
1449
+ }>>;
1450
+ readonly kind: Schema.tag<"sessionContext">;
1451
+ readonly id: Schema.Literal<"session">;
1452
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1453
+ }>, Schema.Struct<{
1454
+ readonly operations: Schema.$Array<Schema.Struct<{
1455
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1456
+ readonly mapping: Schema.String;
1457
+ /** Operation index within the mapping. */
1458
+ readonly operation: Schema.Int;
1459
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1460
+ readonly entryKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1461
+ /** The entry's id, for a list keyed by id or ordinal (`entryKey` then holds the ordinal). */
1462
+ readonly entryId: Schema.optionalKey<Schema.NonEmptyString>;
1463
+ }>>;
1464
+ readonly kind: Schema.tag<"decorationBuffer">;
1465
+ readonly id: Schema.TemplateLiteral<readonly ["decorations:", Schema.Literals<readonly ["command", "idempotencyKey"]>, ":", Schema.NonEmptyString]>;
1466
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1467
+ }>]>, Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.Struct<{
1468
+ readonly format: Schema.Int;
1469
+ readonly kind: Schema.NonEmptyString;
1470
+ readonly id: Schema.NonEmptyString;
1471
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1472
+ readonly position: Schema.optionalKey<Schema.Struct<{
1473
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1474
+ readonly ordinal: Schema.Int;
1475
+ }>>;
1476
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
1477
+ }>, never, never>, never, never>;
1478
+ /**
1479
+ * Wire codec for one record: a known record when this reader can interpret it, otherwise an
1480
+ * explicit unknown record that keeps its id and position.
1481
+ */
1482
+ declare const TranscriptRecordViewFromEnvelope: Schema.Union<readonly [Schema.decodeTo<Schema.Union<readonly [Schema.Struct<{
1483
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
1484
+ readonly messageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
1485
+ readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
1486
+ readonly disposition: Schema.optionalKey<Schema.Literals<readonly ["queue", "steer", "interrupt"]>>;
1487
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
1488
+ readonly type: Schema.Literal<"text">;
1489
+ readonly text: Schema.String;
1490
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1491
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1492
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
1493
+ readonly type: Schema.Literal<"text">;
1494
+ readonly text: Schema.String;
1495
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1496
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1497
+ }>, Schema.decodeTo<Schema.Struct<{
1498
+ readonly type: Schema.Literal<"file">;
1499
+ readonly mediaType: Schema.String;
1500
+ readonly fileName: Schema.optional<Schema.String>;
1501
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
1502
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1503
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1504
+ }>, Schema.Struct<{
1505
+ readonly type: Schema.Literal<"file">;
1506
+ readonly mediaType: Schema.String;
1507
+ readonly fileName: Schema.optional<Schema.String>;
1508
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
1509
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
1510
+ readonly data: Schema.String;
1511
+ }>, never, never>]>>]>;
1512
+ readonly state: Schema.TaggedUnion<{
1513
+ readonly Cancelled: Schema.TaggedStruct<"Cancelled", {
1514
+ readonly reason: Schema.String;
1515
+ readonly byCommandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
1516
+ }>;
1517
+ readonly Consumed: Schema.TaggedStruct<"Consumed", {
1518
+ readonly turnId: Schema.optionalKey<Schema.brand<Schema.String, "TurnId">>;
1519
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
1520
+ }>;
1521
+ readonly Paused: Schema.TaggedStruct<"Paused", {
1522
+ readonly byCommandId: Schema.brand<Schema.String, "CommandId">;
1523
+ }>;
1524
+ readonly Pending: Schema.TaggedStruct<"Pending", {}>;
1525
+ readonly Promoted: Schema.TaggedStruct<"Promoted", {}>;
1526
+ readonly Steering: Schema.TaggedStruct<"Steering", {}>;
1527
+ }>;
1528
+ readonly steering: Schema.optionalKey<Schema.Struct<{
1529
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1530
+ }>>;
1531
+ readonly classification: Schema.optionalKey<Schema.String>;
1532
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
1533
+ readonly List: Schema.TaggedStruct<"List", {
1534
+ readonly entries: Schema.$Array<Schema.Struct<{
1535
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
1536
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1537
+ /** The entry's id when the list is keyed by id or ordinal (the key is then the ordinal). */
1538
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
1539
+ }>>;
1540
+ }>;
1541
+ readonly Value: Schema.TaggedStruct<"Value", {
1542
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1543
+ }>;
1544
+ }>>;
1545
+ readonly submittedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1546
+ readonly submittedAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1547
+ readonly consumedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1548
+ readonly kind: Schema.tag<"user">;
1549
+ readonly id: Schema.TemplateLiteral<readonly ["user:", Schema.brand<Schema.String, "CommandId">]>;
1550
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1551
+ readonly position: Schema.optionalKey<Schema.Struct<{
1552
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1553
+ readonly ordinal: Schema.Int;
1554
+ }>>;
1555
+ }>, Schema.Struct<{
1556
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1557
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1558
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
1559
+ readonly source: Schema.Literals<readonly ["inference", "import"]>;
1560
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
1561
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1562
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
1563
+ readonly runGroupId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>>;
1564
+ readonly messageId: Schema.optionalKey<Schema.brand<Schema.String, "MessageId">>;
1565
+ readonly lifecycle: Schema.TaggedUnion<{
1566
+ readonly Completed: Schema.TaggedStruct<"Completed", {
1567
+ readonly finishReason: Schema.optionalKey<Schema.String>;
1568
+ readonly usage: Schema.optionalKey<Schema.Struct<{
1569
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
1570
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
1571
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
1572
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
1573
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
1574
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
1575
+ }>>;
1576
+ }>;
1577
+ readonly Failed: Schema.TaggedStruct<"Failed", {
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
+ readonly Streaming: Schema.TaggedStruct<"Streaming", {}>;
1585
+ }>;
1586
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.TaggedUnion<{
1587
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
1588
+ readonly text: Schema.String;
1589
+ }>;
1590
+ readonly Text: Schema.TaggedStruct<"Text", {
1591
+ readonly text: Schema.String;
1592
+ }>;
1593
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
1594
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
1595
+ readonly toolName: Schema.NonEmptyString;
1596
+ readonly providerExecuted: Schema.Boolean;
1597
+ /** The framework tool record, once the call has been sealed into one. */
1598
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
1599
+ }>;
1600
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
1601
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
1602
+ readonly toolName: Schema.NonEmptyString;
1603
+ readonly isFailure: Schema.Boolean;
1604
+ readonly result: Schema.TaggedUnion<{
1605
+ readonly Inline: Schema.TaggedStruct<"Inline", {
1606
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1607
+ readonly source: Schema.Struct<{
1608
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1609
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1610
+ }>;
1611
+ }>;
1612
+ readonly Ref: Schema.TaggedStruct<"Ref", {
1613
+ readonly source: Schema.Struct<{
1614
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1615
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1616
+ }>;
1617
+ readonly byteLength: Schema.Int;
1618
+ }>;
1619
+ }>;
1620
+ }>;
1621
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
1622
+ readonly partType: Schema.String;
1623
+ }>;
1624
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
1625
+ readonly partType: Schema.String;
1626
+ }>>, Schema.Struct<{
1627
+ readonly _tag: Schema.String;
1628
+ }>, never, never>]>>;
1629
+ readonly partial: Schema.optionalKey<Schema.Struct<{
1630
+ readonly reason: Schema.String;
1631
+ }>>;
1632
+ readonly kind: Schema.tag<"assistant">;
1633
+ readonly id: Schema.Union<readonly [Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>, Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>]>;
1634
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1635
+ readonly position: Schema.Struct<{
1636
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1637
+ readonly ordinal: Schema.Int;
1638
+ }>;
1639
+ }>, Schema.Struct<{
1640
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
1641
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
1642
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
1643
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1644
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1645
+ readonly completedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1646
+ readonly kind: Schema.tag<"compaction">;
1647
+ readonly id: Schema.TemplateLiteral<readonly ["compaction:", Schema.brand<Schema.String, "CompactionId">]>;
1648
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1649
+ readonly position: Schema.Struct<{
1650
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1651
+ readonly ordinal: Schema.Int;
1652
+ }>;
1653
+ }>, Schema.Struct<{
1654
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1655
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1656
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
1657
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
1658
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
1659
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
1660
+ readonly toolName: Schema.NonEmptyString;
1661
+ readonly providerExecuted: Schema.Boolean;
1662
+ readonly params: Schema.optionalKey<Schema.TaggedUnion<{
1663
+ readonly Inline: Schema.TaggedStruct<"Inline", {
1664
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1665
+ readonly source: Schema.Struct<{
1666
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1667
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1668
+ }>;
1669
+ }>;
1670
+ readonly Ref: Schema.TaggedStruct<"Ref", {
1671
+ readonly source: Schema.Struct<{
1672
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1673
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1674
+ }>;
1675
+ readonly byteLength: Schema.Int;
1676
+ }>;
1677
+ }>>;
1678
+ readonly lifecycle: Schema.TaggedUnion<{
1679
+ readonly Completed: Schema.TaggedStruct<"Completed", {
1680
+ readonly result: Schema.TaggedUnion<{
1681
+ readonly Inline: Schema.TaggedStruct<"Inline", {
1682
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1683
+ readonly source: Schema.Struct<{
1684
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1685
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1686
+ }>;
1687
+ }>;
1688
+ readonly Ref: Schema.TaggedStruct<"Ref", {
1689
+ readonly source: Schema.Struct<{
1690
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1691
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1692
+ }>;
1693
+ readonly byteLength: Schema.Int;
1694
+ }>;
1695
+ }>;
1696
+ }>;
1697
+ readonly Created: Schema.TaggedStruct<"Created", {}>;
1698
+ readonly Failed: Schema.TaggedStruct<"Failed", {
1699
+ readonly error: Schema.Struct<{
1700
+ readonly message: Schema.String;
1701
+ readonly code: Schema.optionalKey<Schema.String>;
1702
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1703
+ }>;
1704
+ }>;
1705
+ readonly Rejected: Schema.TaggedStruct<"Rejected", {
1706
+ readonly reason: Schema.Literals<readonly ["unknown-tool", "invalid-params"]>;
1707
+ readonly message: Schema.String;
1708
+ readonly modelFeedback: Schema.String;
1709
+ }>;
1710
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
1711
+ }>;
1712
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
1713
+ readonly kind: Schema.tag<"tool">;
1714
+ readonly id: Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>;
1715
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1716
+ }>, Schema.Struct<{
1717
+ readonly rootRunId: Schema.brand<Schema.String, "RunId">;
1718
+ readonly runs: Schema.NonEmptyArray<Schema.Struct<{
1719
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1720
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
1721
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
1722
+ readonly runId: Schema.brand<Schema.String, "RunId">;
1723
+ readonly commandIds: Schema.$Array<Schema.brand<Schema.String, "CommandId">>;
1724
+ readonly modelSelection: Schema.Struct<{
1725
+ readonly provider: Schema.NonEmptyString;
1726
+ readonly modelId: Schema.NonEmptyString;
1727
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
1728
+ }>;
1729
+ readonly outcome: Schema.TaggedUnion<{
1730
+ readonly Completed: Schema.TaggedStruct<"Completed", {}>;
1731
+ readonly Failed: Schema.TaggedStruct<"Failed", {
1732
+ readonly error: Schema.Struct<{
1733
+ readonly message: Schema.String;
1734
+ readonly code: Schema.optionalKey<Schema.String>;
1735
+ readonly details: Schema.optionalKey<Schema.Unknown>;
1736
+ }>;
1737
+ }>;
1738
+ readonly Interrupted: Schema.TaggedStruct<"Interrupted", {
1739
+ readonly reason: Schema.String;
1740
+ }>;
1741
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
1742
+ }>;
1743
+ /** The interrupted run this one continues, as recorded by startup recovery. */
1744
+ readonly continuationOf: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
1745
+ }>>;
1746
+ readonly kind: Schema.tag<"runGroup">;
1747
+ readonly id: Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>;
1748
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1749
+ }>, Schema.Struct<{
1750
+ readonly activeRunId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
1751
+ readonly activeCompactionId: Schema.optionalKey<Schema.brand<Schema.String, "CompactionId">>;
1752
+ readonly modelSelection: Schema.optionalKey<Schema.Struct<{
1753
+ readonly provider: Schema.NonEmptyString;
1754
+ readonly modelId: Schema.NonEmptyString;
1755
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
1756
+ }>>;
1757
+ readonly lastRunModelSelection: Schema.optionalKey<Schema.Struct<{
1758
+ readonly provider: Schema.NonEmptyString;
1759
+ readonly modelId: Schema.NonEmptyString;
1760
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
1761
+ }>>;
1762
+ readonly tokenUsage: Schema.Struct<{
1763
+ readonly byModel: Schema.$Array<Schema.Struct<{
1764
+ readonly provider: Schema.NonEmptyString;
1765
+ readonly modelId: Schema.NonEmptyString;
1766
+ readonly usage: Schema.Struct<{
1767
+ readonly inputTokens: Schema.Int;
1768
+ readonly cachedInputTokens: Schema.Int;
1769
+ readonly cacheWriteInputTokens: Schema.Int;
1770
+ readonly outputTokens: Schema.Int;
1771
+ readonly textTokens: Schema.Int;
1772
+ readonly reasoningTokens: Schema.Int;
1773
+ }>;
1774
+ }>>;
1775
+ }>;
1776
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
1777
+ readonly List: Schema.TaggedStruct<"List", {
1778
+ readonly entries: Schema.$Array<Schema.Struct<{
1779
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
1780
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1781
+ /** The entry's id when the list is keyed by id or ordinal (the key is then the ordinal). */
1782
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
1783
+ }>>;
1784
+ }>;
1785
+ readonly Value: Schema.TaggedStruct<"Value", {
1786
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1787
+ }>;
1788
+ }>>;
1789
+ readonly kind: Schema.tag<"sessionContext">;
1790
+ readonly id: Schema.Literal<"session">;
1791
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1792
+ }>, Schema.Struct<{
1793
+ readonly operations: Schema.$Array<Schema.Struct<{
1794
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
1795
+ readonly mapping: Schema.String;
1796
+ /** Operation index within the mapping. */
1797
+ readonly operation: Schema.Int;
1798
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
1799
+ readonly entryKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1800
+ /** The entry's id, for a list keyed by id or ordinal (`entryKey` then holds the ordinal). */
1801
+ readonly entryId: Schema.optionalKey<Schema.NonEmptyString>;
1802
+ }>>;
1803
+ readonly kind: Schema.tag<"decorationBuffer">;
1804
+ readonly id: Schema.TemplateLiteral<readonly ["decorations:", Schema.Literals<readonly ["command", "idempotencyKey"]>, ":", Schema.NonEmptyString]>;
1805
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1806
+ }>]>, Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.Struct<{
1807
+ readonly format: Schema.Int;
1808
+ readonly kind: Schema.NonEmptyString;
1809
+ readonly id: Schema.NonEmptyString;
1810
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1811
+ readonly position: Schema.optionalKey<Schema.Struct<{
1812
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1813
+ readonly ordinal: Schema.Int;
1814
+ }>>;
1815
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
1816
+ }>, never, never>, never, never>, Schema.decodeTo<Schema.Struct<{
1817
+ readonly kind: Schema.tag<"unknown">;
1818
+ readonly originalKind: Schema.NonEmptyString;
1819
+ /** The envelope format it arrived in, kept so it re-encodes exactly as it was read. */
1820
+ readonly format: Schema.Int;
1821
+ /** The uninterpreted body, kept so a relaying reader forwards it unchanged. */
1822
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
1823
+ readonly id: Schema.NonEmptyString;
1824
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1825
+ readonly position: Schema.optionalKey<Schema.Struct<{
1826
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1827
+ readonly ordinal: Schema.Int;
1828
+ }>>;
1829
+ }>, Schema.Struct<{
1830
+ readonly format: Schema.Int;
1831
+ readonly kind: Schema.NonEmptyString;
1832
+ readonly id: Schema.NonEmptyString;
1833
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1834
+ readonly position: Schema.optionalKey<Schema.Struct<{
1835
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
1836
+ readonly ordinal: Schema.Int;
1837
+ }>>;
1838
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
1839
+ }>, never, never>]>;
1840
+ //#endregion
1841
+ //#region src/transcript/mapping.d.ts
1842
+ /**
1843
+ * Host decorations are data, not code. A host registers mappings from its own durable app events
1844
+ * to decorations on transcript records; EDA validates them at registration and executes them
1845
+ * with fixed bounds inside the projection.
1846
+ */
1847
+ /** Bounds EDA enforces on every definition and every decoration it executes. */
1848
+ declare const transcriptMappingBounds: {
1849
+ readonly maxMappings: 64;
1850
+ readonly maxOperationsPerMapping: 16;
1851
+ readonly maxPathLength: 16;
1852
+ /** Canonical JSON bytes of one decoration value or list entry. */
1853
+ readonly maxValueBytes: 8192;
1854
+ /**
1855
+ * Canonical JSON bytes of all decorations of one record, and of one decoration buffer. An
1856
+ * operation that would exceed it is skipped, so no record's row can approach storage value
1857
+ * limits whatever a host appends.
1858
+ */
1859
+ readonly maxDecorationBytes: 262144;
1860
+ /** Entries kept in one decoration list; further distinct entries are dropped. */
1861
+ readonly maxListEntries: 64;
1862
+ readonly maxUserFallbacks: 16;
1863
+ };
1864
+ /** The app event a mapping reads: one host namespace, type and schema version. */
1865
+ declare const TranscriptMappedEvent: Schema.Struct<{
1866
+ readonly namespace: Schema.NonEmptyString;
1867
+ readonly type: Schema.NonEmptyString;
1868
+ readonly schemaVersion: Schema.Int;
1869
+ }>;
1870
+ type TranscriptMappedEvent = typeof TranscriptMappedEvent.Type;
1871
+ /**
1872
+ * Which record a mapping decorates.
1873
+ *
1874
+ * User targets associate through a payload field: the submitting command's id, or the
1875
+ * command's idempotency key. A decoration that arrives before its target user record is held
1876
+ * and applied, in arrival order, when the record is created. `Session` decorates the
1877
+ * session-context singleton.
1878
+ */
1879
+ declare const TranscriptMappingTarget: Schema.TaggedUnion<{
1880
+ readonly Session: Schema.TaggedStruct<"Session", {}>;
1881
+ readonly UserByCommandId: Schema.TaggedStruct<"UserByCommandId", {
1882
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1883
+ }>;
1884
+ readonly UserByIdempotencyKey: Schema.TaggedStruct<"UserByIdempotencyKey", {
1885
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1886
+ }>;
1887
+ }>;
1888
+ type TranscriptMappingTarget = typeof TranscriptMappingTarget.Type;
1889
+ /** How a list entry is identified when it is replaced. */
1890
+ declare const TranscriptListEntryKey: Schema.TaggedUnion<{
1891
+ readonly Id: Schema.TaggedStruct<"Id", {
1892
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1893
+ }>;
1894
+ readonly IdOrOrdinal: Schema.TaggedStruct<"IdOrOrdinal", {
1895
+ readonly id: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1896
+ readonly ordinal: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1897
+ }>;
1898
+ readonly Ordinal: Schema.TaggedStruct<"Ordinal", {
1899
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1900
+ }>;
1901
+ }>;
1902
+ type TranscriptListEntryKey = typeof TranscriptListEntryKey.Type;
1903
+ /** One declarative decoration operation. Every `from` path reads the authenticated event payload. */
1904
+ declare const TranscriptMappingOperation: Schema.TaggedUnion<{
1905
+ readonly Classify: Schema.TaggedStruct<"Classify", {
1906
+ readonly classification: Schema.String;
1907
+ }>;
1908
+ readonly Copy: Schema.TaggedStruct<"Copy", {
1909
+ readonly from: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1910
+ readonly to: Schema.String;
1911
+ }>;
1912
+ readonly FirstWins: Schema.TaggedStruct<"FirstWins", {
1913
+ readonly from: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1914
+ readonly to: Schema.String;
1915
+ }>;
1916
+ readonly ReplaceListEntry: Schema.TaggedStruct<"ReplaceListEntry", {
1917
+ readonly from: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1918
+ readonly to: Schema.String;
1919
+ readonly key: Schema.TaggedUnion<{
1920
+ readonly Id: Schema.TaggedStruct<"Id", {
1921
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1922
+ }>;
1923
+ readonly IdOrOrdinal: Schema.TaggedStruct<"IdOrOrdinal", {
1924
+ readonly id: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1925
+ readonly ordinal: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1926
+ }>;
1927
+ readonly Ordinal: Schema.TaggedStruct<"Ordinal", {
1928
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1929
+ }>;
1930
+ }>;
1931
+ }>;
1932
+ }>;
1933
+ type TranscriptMappingOperation = typeof TranscriptMappingOperation.Type;
1934
+ /** One host mapping: an app event, the record it decorates, and the operations to apply. */
1935
+ declare const TranscriptMapping: Schema.Struct<{
1936
+ /** Unique name; buffered decorations refer to it. */
1937
+ readonly name: Schema.String;
1938
+ readonly event: Schema.Struct<{
1939
+ readonly namespace: Schema.NonEmptyString;
1940
+ readonly type: Schema.NonEmptyString;
1941
+ readonly schemaVersion: Schema.Int;
1942
+ }>;
1943
+ readonly target: Schema.TaggedUnion<{
1944
+ readonly Session: Schema.TaggedStruct<"Session", {}>;
1945
+ readonly UserByCommandId: Schema.TaggedStruct<"UserByCommandId", {
1946
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1947
+ }>;
1948
+ readonly UserByIdempotencyKey: Schema.TaggedStruct<"UserByIdempotencyKey", {
1949
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1950
+ }>;
1951
+ }>;
1952
+ readonly operations: Schema.NonEmptyArray<Schema.TaggedUnion<{
1953
+ readonly Classify: Schema.TaggedStruct<"Classify", {
1954
+ readonly classification: Schema.String;
1955
+ }>;
1956
+ readonly Copy: Schema.TaggedStruct<"Copy", {
1957
+ readonly from: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1958
+ readonly to: Schema.String;
1959
+ }>;
1960
+ readonly FirstWins: Schema.TaggedStruct<"FirstWins", {
1961
+ readonly from: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1962
+ readonly to: Schema.String;
1963
+ }>;
1964
+ readonly ReplaceListEntry: Schema.TaggedStruct<"ReplaceListEntry", {
1965
+ readonly from: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1966
+ readonly to: Schema.String;
1967
+ readonly key: Schema.TaggedUnion<{
1968
+ readonly Id: Schema.TaggedStruct<"Id", {
1969
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1970
+ }>;
1971
+ readonly IdOrOrdinal: Schema.TaggedStruct<"IdOrOrdinal", {
1972
+ readonly id: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1973
+ readonly ordinal: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1974
+ }>;
1975
+ readonly Ordinal: Schema.TaggedStruct<"Ordinal", {
1976
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
1977
+ }>;
1978
+ }>;
1979
+ }>;
1980
+ }>>;
1981
+ }>;
1982
+ type TranscriptMapping = typeof TranscriptMapping.Type;
1983
+ /**
1984
+ * A user decoration copied from a session decoration when the user record is created without
1985
+ * it, for example "the most recent author" for a message whose command carried no author event.
1986
+ *
1987
+ * Fallbacks apply in declaration order, after any parked decorations, and each one applies only
1988
+ * if the user decoration is still absent; so `[author ← lastAuthor, author ← owner]` means "the
1989
+ * latest author, else the session owner".
1990
+ */
1991
+ declare const TranscriptUserFallback: Schema.Struct<{
1992
+ readonly to: Schema.String;
1993
+ readonly fromSession: Schema.String;
1994
+ }>;
1995
+ type TranscriptUserFallback = typeof TranscriptUserFallback.Type;
1996
+ /** The host's complete declarative transcript mapping data. */
1997
+ declare const TranscriptMappings: Schema.Struct<{
1998
+ readonly mappings: Schema.$Array<Schema.Struct<{
1999
+ /** Unique name; buffered decorations refer to it. */
2000
+ readonly name: Schema.String;
2001
+ readonly event: Schema.Struct<{
2002
+ readonly namespace: Schema.NonEmptyString;
2003
+ readonly type: Schema.NonEmptyString;
2004
+ readonly schemaVersion: Schema.Int;
2005
+ }>;
2006
+ readonly target: Schema.TaggedUnion<{
2007
+ readonly Session: Schema.TaggedStruct<"Session", {}>;
2008
+ readonly UserByCommandId: Schema.TaggedStruct<"UserByCommandId", {
2009
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2010
+ }>;
2011
+ readonly UserByIdempotencyKey: Schema.TaggedStruct<"UserByIdempotencyKey", {
2012
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2013
+ }>;
2014
+ }>;
2015
+ readonly operations: Schema.NonEmptyArray<Schema.TaggedUnion<{
2016
+ readonly Classify: Schema.TaggedStruct<"Classify", {
2017
+ readonly classification: Schema.String;
2018
+ }>;
2019
+ readonly Copy: Schema.TaggedStruct<"Copy", {
2020
+ readonly from: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2021
+ readonly to: Schema.String;
2022
+ }>;
2023
+ readonly FirstWins: Schema.TaggedStruct<"FirstWins", {
2024
+ readonly from: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2025
+ readonly to: Schema.String;
2026
+ }>;
2027
+ readonly ReplaceListEntry: Schema.TaggedStruct<"ReplaceListEntry", {
2028
+ readonly from: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2029
+ readonly to: Schema.String;
2030
+ readonly key: Schema.TaggedUnion<{
2031
+ readonly Id: Schema.TaggedStruct<"Id", {
2032
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2033
+ }>;
2034
+ readonly IdOrOrdinal: Schema.TaggedStruct<"IdOrOrdinal", {
2035
+ readonly id: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2036
+ readonly ordinal: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2037
+ }>;
2038
+ readonly Ordinal: Schema.TaggedStruct<"Ordinal", {
2039
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2040
+ }>;
2041
+ }>;
2042
+ }>;
2043
+ }>>;
2044
+ }>>;
2045
+ readonly userFallbacks: Schema.$Array<Schema.Struct<{
2046
+ readonly to: Schema.String;
2047
+ readonly fromSession: Schema.String;
2048
+ }>>;
2049
+ }>;
2050
+ type TranscriptMappings = typeof TranscriptMappings.Type;
2051
+ /** Mappings for a host that registers no decorations. */
2052
+ declare const emptyTranscriptMappings: TranscriptMappings;
2053
+ declare const TranscriptDefinitionError_base: Schema.Class<TranscriptDefinitionError, Schema.TaggedStruct<"TranscriptDefinitionError", {
2054
+ readonly message: Schema.String;
2055
+ }>, import("effect/Cause").YieldableError>;
2056
+ /** Host mapping data rejected at registration. */
2057
+ declare class TranscriptDefinitionError extends TranscriptDefinitionError_base {}
2058
+ /**
2059
+ * A validated transcript interpretation: EDA's semantic revision plus host mappings, identified
2060
+ * by `version`. Only `makeTranscriptDefinition` constructs one.
2061
+ */
2062
+ declare class TranscriptDefinition {
2063
+ readonly version: TranscriptVersion;
2064
+ readonly semanticRevision: number;
2065
+ readonly mappings: TranscriptMappings;
2066
+ private constructor();
2067
+ /**
2068
+ * Validate host mapping data and derive its transcript version.
2069
+ *
2070
+ * Validation happens here, at registration, never during append: an accepted definition can
2071
+ * only degrade individual decorations at runtime (a missing field, an oversize value), never
2072
+ * event admission or other records.
2073
+ */
2074
+ static readonly make: (input: unknown) => Effect.Effect<TranscriptDefinition, TranscriptDefinitionError, never>;
2075
+ }
2076
+ /** Validate host mapping data and derive its transcript version; see `TranscriptDefinition.make`. */
2077
+ declare const makeTranscriptDefinition: (input: unknown) => Effect.Effect<TranscriptDefinition, TranscriptDefinitionError, never>;
2078
+ //#endregion
2079
+ //#region src/transcript/window.d.ts
2080
+ /**
2081
+ * Which slice of history to read.
2082
+ *
2083
+ * `Latest` serves first paint (SSR, CLIs); `Page` walks either direction from a cursor;
2084
+ * `Range` re-reads exactly the span a client retains, inclusive of both ends, at one new cut.
2085
+ */
2086
+ declare const TranscriptWindowSelector: Schema.Union<readonly [Schema.TaggedStruct<"Latest", {
2087
+ readonly count: Schema.Int;
2088
+ }>, Schema.TaggedStruct<"Page", {
2089
+ readonly direction: Schema.Literals<readonly ["before", "after"]>;
2090
+ readonly cursor: Schema.Struct<{
2091
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
2092
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
2093
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2094
+ readonly ordinal: Schema.Int;
2095
+ readonly recordId: Schema.NonEmptyString;
2096
+ }>;
2097
+ readonly count: Schema.Int;
2098
+ }>, Schema.Struct<{
2099
+ readonly _tag: Schema.tag<"Range">;
2100
+ readonly from: Schema.Struct<{
2101
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
2102
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
2103
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2104
+ readonly ordinal: Schema.Int;
2105
+ readonly recordId: Schema.NonEmptyString;
2106
+ }>;
2107
+ readonly to: Schema.Struct<{
2108
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
2109
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
2110
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2111
+ readonly ordinal: Schema.Int;
2112
+ readonly recordId: Schema.NonEmptyString;
2113
+ }>;
2114
+ }>]>;
2115
+ type TranscriptWindowSelector = typeof TranscriptWindowSelector.Type;
2116
+ /**
2117
+ * Bounds on one window. `maxRecords` caps top-level records (a selector's `count` is further
2118
+ * capped by it); `maxBytes` caps the whole response, dependencies included; bodies above
2119
+ * `maxInlineBodyBytes` are sent as references.
2120
+ */
2121
+ declare const TranscriptWindowLimits: Schema.Struct<{
2122
+ readonly maxRecords: Schema.Int;
2123
+ readonly maxBytes: Schema.Int;
2124
+ readonly maxInlineBodyBytes: Schema.Int;
2125
+ }>;
2126
+ type TranscriptWindowLimits = typeof TranscriptWindowLimits.Type;
2127
+ /** Default bounds: the first window holds 100 top-level records (design decision 4). */
2128
+ declare const defaultTranscriptWindowLimits: TranscriptWindowLimits;
2129
+ /**
2130
+ * Whether the window is the current interpretation of the log. A readiness this reader does not
2131
+ * know decodes as `Unknown` and is treated as degraded: it carries no live content. A malformed
2132
+ * readiness with a known tag is a decode failure.
2133
+ */
2134
+ declare const TranscriptReadiness: Schema.Union<readonly [Schema.TaggedUnion<{
2135
+ readonly Building: Schema.TaggedStruct<"Building", {}>;
2136
+ readonly Degraded: Schema.TaggedStruct<"Degraded", {
2137
+ readonly failedAtSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2138
+ readonly error: Schema.String;
2139
+ }>;
2140
+ readonly Ready: Schema.TaggedStruct<"Ready", {}>;
2141
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
2142
+ readonly readinessType: Schema.String;
2143
+ }>;
2144
+ readonly Unreadable: Schema.TaggedStruct<"Unreadable", {
2145
+ readonly error: Schema.String;
2146
+ }>;
2147
+ readonly UpdatingHistory: Schema.TaggedStruct<"UpdatingHistory", {}>;
2148
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
2149
+ readonly readinessType: Schema.String;
2150
+ }>>, Schema.Struct<{
2151
+ readonly _tag: Schema.String;
2152
+ }>, never, never>]>;
2153
+ type TranscriptReadiness = typeof TranscriptReadiness.Type;
2154
+ /**
2155
+ * One live part of the inference streaming now.
2156
+ *
2157
+ * `id` is stable for the life of the part (`text:<providerPartId>`, `reasoning:<providerPartId>`,
2158
+ * `tool:<toolCallId>`), so a client keys a streaming part by it and replaces it in place as it
2159
+ * grows. `paramsText` is the tool-call parameter text streamed so far; it is speculative until
2160
+ * the call is sealed into a tool record.
2161
+ */
2162
+ declare const TranscriptActivePart: Schema.Struct<{
2163
+ readonly id: Schema.NonEmptyString;
2164
+ readonly part: Schema.Union<readonly [Schema.TaggedUnion<{
2165
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
2166
+ readonly text: Schema.String;
2167
+ }>;
2168
+ readonly Text: Schema.TaggedStruct<"Text", {
2169
+ readonly text: Schema.String;
2170
+ }>;
2171
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
2172
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2173
+ readonly toolName: Schema.NonEmptyString;
2174
+ readonly providerExecuted: Schema.Boolean;
2175
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
2176
+ }>;
2177
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
2178
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2179
+ readonly toolName: Schema.NonEmptyString;
2180
+ readonly isFailure: Schema.Boolean;
2181
+ readonly result: Schema.TaggedUnion<{
2182
+ readonly Inline: Schema.TaggedStruct<"Inline", {
2183
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2184
+ readonly source: Schema.Struct<{
2185
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2186
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2187
+ }>;
2188
+ }>;
2189
+ readonly Ref: Schema.TaggedStruct<"Ref", {
2190
+ readonly source: Schema.Struct<{
2191
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2192
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2193
+ }>;
2194
+ readonly byteLength: Schema.Int;
2195
+ }>;
2196
+ }>;
2197
+ }>;
2198
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
2199
+ readonly partType: Schema.String;
2200
+ }>;
2201
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
2202
+ readonly partType: Schema.String;
2203
+ }>>, Schema.Struct<{
2204
+ readonly _tag: Schema.String;
2205
+ }>, never, never>]>;
2206
+ readonly paramsText: Schema.optionalKey<Schema.String>;
2207
+ }>;
2208
+ type TranscriptActivePart = typeof TranscriptActivePart.Type;
2209
+ /**
2210
+ * Accumulated parts of the inference streaming now, captured at the same publication boundary as
2211
+ * the window. Owned by the live runtime; storage-level reads never include it.
2212
+ */
2213
+ declare const TranscriptActiveContent: Schema.Struct<{
2214
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
2215
+ readonly parts: Schema.$Array<Schema.Struct<{
2216
+ readonly id: Schema.NonEmptyString;
2217
+ readonly part: Schema.Union<readonly [Schema.TaggedUnion<{
2218
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
2219
+ readonly text: Schema.String;
2220
+ }>;
2221
+ readonly Text: Schema.TaggedStruct<"Text", {
2222
+ readonly text: Schema.String;
2223
+ }>;
2224
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
2225
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2226
+ readonly toolName: Schema.NonEmptyString;
2227
+ readonly providerExecuted: Schema.Boolean;
2228
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
2229
+ }>;
2230
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
2231
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2232
+ readonly toolName: Schema.NonEmptyString;
2233
+ readonly isFailure: Schema.Boolean;
2234
+ readonly result: Schema.TaggedUnion<{
2235
+ readonly Inline: Schema.TaggedStruct<"Inline", {
2236
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2237
+ readonly source: Schema.Struct<{
2238
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2239
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2240
+ }>;
2241
+ }>;
2242
+ readonly Ref: Schema.TaggedStruct<"Ref", {
2243
+ readonly source: Schema.Struct<{
2244
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2245
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2246
+ }>;
2247
+ readonly byteLength: Schema.Int;
2248
+ }>;
2249
+ }>;
2250
+ }>;
2251
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
2252
+ readonly partType: Schema.String;
2253
+ }>;
2254
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
2255
+ readonly partType: Schema.String;
2256
+ }>>, Schema.Struct<{
2257
+ readonly _tag: Schema.String;
2258
+ }>, never, never>]>;
2259
+ readonly paramsText: Schema.optionalKey<Schema.String>;
2260
+ }>>;
2261
+ }>;
2262
+ type TranscriptActiveContent = typeof TranscriptActiveContent.Type;
2263
+ /**
2264
+ * One complete, consistent read of a transcript version.
2265
+ *
2266
+ * `records` are top-level records in transcript order; `dependencies` are the tools and run
2267
+ * groups they reference, the session context, and every pending user record. Every record is
2268
+ * projected through `throughSeq` and none is newer, which is what makes a cut complete. A client
2269
+ * replaces, never merges, what a window covers.
2270
+ */
2271
+ declare const TranscriptWindow: Schema.Struct<{
2272
+ readonly incarnation: Schema.brand<Schema.NonEmptyString, "TranscriptLogIncarnation">;
2273
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
2274
+ readonly throughSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2275
+ readonly records: Schema.$Array<Schema.Union<readonly [Schema.decodeTo<Schema.Union<readonly [Schema.Struct<{
2276
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
2277
+ readonly messageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
2278
+ readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
2279
+ readonly disposition: Schema.optionalKey<Schema.Literals<readonly ["queue", "steer", "interrupt"]>>;
2280
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
2281
+ readonly type: Schema.Literal<"text">;
2282
+ readonly text: Schema.String;
2283
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
2284
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
2285
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
2286
+ readonly type: Schema.Literal<"text">;
2287
+ readonly text: Schema.String;
2288
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
2289
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
2290
+ }>, Schema.decodeTo<Schema.Struct<{
2291
+ readonly type: Schema.Literal<"file">;
2292
+ readonly mediaType: Schema.String;
2293
+ readonly fileName: Schema.optional<Schema.String>;
2294
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
2295
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
2296
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
2297
+ }>, Schema.Struct<{
2298
+ readonly type: Schema.Literal<"file">;
2299
+ readonly mediaType: Schema.String;
2300
+ readonly fileName: Schema.optional<Schema.String>;
2301
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
2302
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
2303
+ readonly data: Schema.String;
2304
+ }>, never, never>]>>]>;
2305
+ readonly state: Schema.TaggedUnion<{
2306
+ readonly Cancelled: Schema.TaggedStruct<"Cancelled", {
2307
+ readonly reason: Schema.String;
2308
+ readonly byCommandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
2309
+ }>;
2310
+ readonly Consumed: Schema.TaggedStruct<"Consumed", {
2311
+ readonly turnId: Schema.optionalKey<Schema.brand<Schema.String, "TurnId">>;
2312
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
2313
+ }>;
2314
+ readonly Paused: Schema.TaggedStruct<"Paused", {
2315
+ readonly byCommandId: Schema.brand<Schema.String, "CommandId">;
2316
+ }>;
2317
+ readonly Pending: Schema.TaggedStruct<"Pending", {}>;
2318
+ readonly Promoted: Schema.TaggedStruct<"Promoted", {}>;
2319
+ readonly Steering: Schema.TaggedStruct<"Steering", {}>;
2320
+ }>;
2321
+ readonly steering: Schema.optionalKey<Schema.Struct<{
2322
+ readonly runId: Schema.brand<Schema.String, "RunId">;
2323
+ }>>;
2324
+ readonly classification: Schema.optionalKey<Schema.String>;
2325
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
2326
+ readonly List: Schema.TaggedStruct<"List", {
2327
+ readonly entries: Schema.$Array<Schema.Struct<{
2328
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
2329
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2330
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
2331
+ }>>;
2332
+ }>;
2333
+ readonly Value: Schema.TaggedStruct<"Value", {
2334
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2335
+ }>;
2336
+ }>>;
2337
+ readonly submittedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2338
+ readonly submittedAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2339
+ readonly consumedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2340
+ readonly kind: Schema.tag<"user">;
2341
+ readonly id: Schema.TemplateLiteral<readonly ["user:", Schema.brand<Schema.String, "CommandId">]>;
2342
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2343
+ readonly position: Schema.optionalKey<Schema.Struct<{
2344
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2345
+ readonly ordinal: Schema.Int;
2346
+ }>>;
2347
+ }>, Schema.Struct<{
2348
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2349
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2350
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
2351
+ readonly source: Schema.Literals<readonly ["inference", "import"]>;
2352
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
2353
+ readonly runId: Schema.brand<Schema.String, "RunId">;
2354
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
2355
+ readonly runGroupId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>>;
2356
+ readonly messageId: Schema.optionalKey<Schema.brand<Schema.String, "MessageId">>;
2357
+ readonly lifecycle: Schema.TaggedUnion<{
2358
+ readonly Completed: Schema.TaggedStruct<"Completed", {
2359
+ readonly finishReason: Schema.optionalKey<Schema.String>;
2360
+ readonly usage: Schema.optionalKey<Schema.Struct<{
2361
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
2362
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
2363
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
2364
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
2365
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
2366
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
2367
+ }>>;
2368
+ }>;
2369
+ readonly Failed: Schema.TaggedStruct<"Failed", {
2370
+ readonly error: Schema.Struct<{
2371
+ readonly message: Schema.String;
2372
+ readonly code: Schema.optionalKey<Schema.String>;
2373
+ readonly details: Schema.optionalKey<Schema.Unknown>;
2374
+ }>;
2375
+ }>;
2376
+ readonly Streaming: Schema.TaggedStruct<"Streaming", {}>;
2377
+ }>;
2378
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.TaggedUnion<{
2379
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
2380
+ readonly text: Schema.String;
2381
+ }>;
2382
+ readonly Text: Schema.TaggedStruct<"Text", {
2383
+ readonly text: Schema.String;
2384
+ }>;
2385
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
2386
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2387
+ readonly toolName: Schema.NonEmptyString;
2388
+ readonly providerExecuted: Schema.Boolean;
2389
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
2390
+ }>;
2391
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
2392
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2393
+ readonly toolName: Schema.NonEmptyString;
2394
+ readonly isFailure: Schema.Boolean;
2395
+ readonly result: Schema.TaggedUnion<{
2396
+ readonly Inline: Schema.TaggedStruct<"Inline", {
2397
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2398
+ readonly source: Schema.Struct<{
2399
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2400
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2401
+ }>;
2402
+ }>;
2403
+ readonly Ref: Schema.TaggedStruct<"Ref", {
2404
+ readonly source: Schema.Struct<{
2405
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2406
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2407
+ }>;
2408
+ readonly byteLength: Schema.Int;
2409
+ }>;
2410
+ }>;
2411
+ }>;
2412
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
2413
+ readonly partType: Schema.String;
2414
+ }>;
2415
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
2416
+ readonly partType: Schema.String;
2417
+ }>>, Schema.Struct<{
2418
+ readonly _tag: Schema.String;
2419
+ }>, never, never>]>>;
2420
+ readonly partial: Schema.optionalKey<Schema.Struct<{
2421
+ readonly reason: Schema.String;
2422
+ }>>;
2423
+ readonly kind: Schema.tag<"assistant">;
2424
+ readonly id: Schema.Union<readonly [Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>, Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>]>;
2425
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2426
+ readonly position: Schema.Struct<{
2427
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2428
+ readonly ordinal: Schema.Int;
2429
+ }>;
2430
+ }>, Schema.Struct<{
2431
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
2432
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
2433
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
2434
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2435
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2436
+ readonly completedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2437
+ readonly kind: Schema.tag<"compaction">;
2438
+ readonly id: Schema.TemplateLiteral<readonly ["compaction:", Schema.brand<Schema.String, "CompactionId">]>;
2439
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2440
+ readonly position: Schema.Struct<{
2441
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2442
+ readonly ordinal: Schema.Int;
2443
+ }>;
2444
+ }>, Schema.Struct<{
2445
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2446
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2447
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
2448
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
2449
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
2450
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2451
+ readonly toolName: Schema.NonEmptyString;
2452
+ readonly providerExecuted: Schema.Boolean;
2453
+ readonly params: Schema.optionalKey<Schema.TaggedUnion<{
2454
+ readonly Inline: Schema.TaggedStruct<"Inline", {
2455
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2456
+ readonly source: Schema.Struct<{
2457
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2458
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2459
+ }>;
2460
+ }>;
2461
+ readonly Ref: Schema.TaggedStruct<"Ref", {
2462
+ readonly source: Schema.Struct<{
2463
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2464
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2465
+ }>;
2466
+ readonly byteLength: Schema.Int;
2467
+ }>;
2468
+ }>>;
2469
+ readonly lifecycle: Schema.TaggedUnion<{
2470
+ readonly Completed: Schema.TaggedStruct<"Completed", {
2471
+ readonly result: Schema.TaggedUnion<{
2472
+ readonly Inline: Schema.TaggedStruct<"Inline", {
2473
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2474
+ readonly source: Schema.Struct<{
2475
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2476
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2477
+ }>;
2478
+ }>;
2479
+ readonly Ref: Schema.TaggedStruct<"Ref", {
2480
+ readonly source: Schema.Struct<{
2481
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2482
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2483
+ }>;
2484
+ readonly byteLength: Schema.Int;
2485
+ }>;
2486
+ }>;
2487
+ }>;
2488
+ readonly Created: Schema.TaggedStruct<"Created", {}>;
2489
+ readonly Failed: Schema.TaggedStruct<"Failed", {
2490
+ readonly error: Schema.Struct<{
2491
+ readonly message: Schema.String;
2492
+ readonly code: Schema.optionalKey<Schema.String>;
2493
+ readonly details: Schema.optionalKey<Schema.Unknown>;
2494
+ }>;
2495
+ }>;
2496
+ readonly Rejected: Schema.TaggedStruct<"Rejected", {
2497
+ readonly reason: Schema.Literals<readonly ["unknown-tool", "invalid-params"]>;
2498
+ readonly message: Schema.String;
2499
+ readonly modelFeedback: Schema.String;
2500
+ }>;
2501
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
2502
+ }>;
2503
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2504
+ readonly kind: Schema.tag<"tool">;
2505
+ readonly id: Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>;
2506
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2507
+ }>, Schema.Struct<{
2508
+ readonly rootRunId: Schema.brand<Schema.String, "RunId">;
2509
+ readonly runs: Schema.NonEmptyArray<Schema.Struct<{
2510
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2511
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2512
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
2513
+ readonly runId: Schema.brand<Schema.String, "RunId">;
2514
+ readonly commandIds: Schema.$Array<Schema.brand<Schema.String, "CommandId">>;
2515
+ readonly modelSelection: Schema.Struct<{
2516
+ readonly provider: Schema.NonEmptyString;
2517
+ readonly modelId: Schema.NonEmptyString;
2518
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
2519
+ }>;
2520
+ readonly outcome: Schema.TaggedUnion<{
2521
+ readonly Completed: Schema.TaggedStruct<"Completed", {}>;
2522
+ readonly Failed: Schema.TaggedStruct<"Failed", {
2523
+ readonly error: Schema.Struct<{
2524
+ readonly message: Schema.String;
2525
+ readonly code: Schema.optionalKey<Schema.String>;
2526
+ readonly details: Schema.optionalKey<Schema.Unknown>;
2527
+ }>;
2528
+ }>;
2529
+ readonly Interrupted: Schema.TaggedStruct<"Interrupted", {
2530
+ readonly reason: Schema.String;
2531
+ }>;
2532
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
2533
+ }>;
2534
+ readonly continuationOf: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
2535
+ }>>;
2536
+ readonly kind: Schema.tag<"runGroup">;
2537
+ readonly id: Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>;
2538
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2539
+ }>, Schema.Struct<{
2540
+ readonly activeRunId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
2541
+ readonly activeCompactionId: Schema.optionalKey<Schema.brand<Schema.String, "CompactionId">>;
2542
+ readonly modelSelection: Schema.optionalKey<Schema.Struct<{
2543
+ readonly provider: Schema.NonEmptyString;
2544
+ readonly modelId: Schema.NonEmptyString;
2545
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
2546
+ }>>;
2547
+ readonly lastRunModelSelection: Schema.optionalKey<Schema.Struct<{
2548
+ readonly provider: Schema.NonEmptyString;
2549
+ readonly modelId: Schema.NonEmptyString;
2550
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
2551
+ }>>;
2552
+ readonly tokenUsage: Schema.Struct<{
2553
+ readonly byModel: Schema.$Array<Schema.Struct<{
2554
+ readonly provider: Schema.NonEmptyString;
2555
+ readonly modelId: Schema.NonEmptyString;
2556
+ readonly usage: Schema.Struct<{
2557
+ readonly inputTokens: Schema.Int;
2558
+ readonly cachedInputTokens: Schema.Int;
2559
+ readonly cacheWriteInputTokens: Schema.Int;
2560
+ readonly outputTokens: Schema.Int;
2561
+ readonly textTokens: Schema.Int;
2562
+ readonly reasoningTokens: Schema.Int;
2563
+ }>;
2564
+ }>>;
2565
+ }>;
2566
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
2567
+ readonly List: Schema.TaggedStruct<"List", {
2568
+ readonly entries: Schema.$Array<Schema.Struct<{
2569
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
2570
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2571
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
2572
+ }>>;
2573
+ }>;
2574
+ readonly Value: Schema.TaggedStruct<"Value", {
2575
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2576
+ }>;
2577
+ }>>;
2578
+ readonly kind: Schema.tag<"sessionContext">;
2579
+ readonly id: Schema.Literal<"session">;
2580
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2581
+ }>, Schema.Struct<{
2582
+ readonly operations: Schema.$Array<Schema.Struct<{
2583
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2584
+ readonly mapping: Schema.String;
2585
+ readonly operation: Schema.Int;
2586
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2587
+ readonly entryKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2588
+ readonly entryId: Schema.optionalKey<Schema.NonEmptyString>;
2589
+ }>>;
2590
+ readonly kind: Schema.tag<"decorationBuffer">;
2591
+ readonly id: Schema.TemplateLiteral<readonly ["decorations:", Schema.Literals<readonly ["command", "idempotencyKey"]>, ":", Schema.NonEmptyString]>;
2592
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2593
+ }>]>, Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.Struct<{
2594
+ readonly format: Schema.Int;
2595
+ readonly kind: Schema.NonEmptyString;
2596
+ readonly id: Schema.NonEmptyString;
2597
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2598
+ readonly position: Schema.optionalKey<Schema.Struct<{
2599
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2600
+ readonly ordinal: Schema.Int;
2601
+ }>>;
2602
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
2603
+ }>, never, never>, never, never>, Schema.decodeTo<Schema.Struct<{
2604
+ readonly kind: Schema.tag<"unknown">;
2605
+ readonly originalKind: Schema.NonEmptyString;
2606
+ readonly format: Schema.Int;
2607
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
2608
+ readonly id: Schema.NonEmptyString;
2609
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2610
+ readonly position: Schema.optionalKey<Schema.Struct<{
2611
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2612
+ readonly ordinal: Schema.Int;
2613
+ }>>;
2614
+ }>, Schema.Struct<{
2615
+ readonly format: Schema.Int;
2616
+ readonly kind: Schema.NonEmptyString;
2617
+ readonly id: Schema.NonEmptyString;
2618
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2619
+ readonly position: Schema.optionalKey<Schema.Struct<{
2620
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2621
+ readonly ordinal: Schema.Int;
2622
+ }>>;
2623
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
2624
+ }>, never, never>]>>;
2625
+ readonly dependencies: Schema.$Array<Schema.Union<readonly [Schema.decodeTo<Schema.Union<readonly [Schema.Struct<{
2626
+ readonly commandId: Schema.brand<Schema.String, "CommandId">;
2627
+ readonly messageIds: Schema.$Array<Schema.brand<Schema.String, "MessageId">>;
2628
+ readonly idempotencyKey: Schema.optionalKey<Schema.brand<Schema.NonEmptyString, "CommandIdempotencyKey">>;
2629
+ readonly disposition: Schema.optionalKey<Schema.Literals<readonly ["queue", "steer", "interrupt"]>>;
2630
+ readonly content: Schema.Union<readonly [Schema.decodeTo<Schema.NonEmptyArray<Schema.toType<Schema.Struct<{
2631
+ readonly type: Schema.Literal<"text">;
2632
+ readonly text: Schema.String;
2633
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
2634
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
2635
+ }>>>, Schema.String, never, never>, Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
2636
+ readonly type: Schema.Literal<"text">;
2637
+ readonly text: Schema.String;
2638
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
2639
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
2640
+ }>, Schema.decodeTo<Schema.Struct<{
2641
+ readonly type: Schema.Literal<"file">;
2642
+ readonly mediaType: Schema.String;
2643
+ readonly fileName: Schema.optional<Schema.String>;
2644
+ readonly data: Schema.Union<readonly [Schema.String, Schema.Uint8Array, Schema.URL]>;
2645
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
2646
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
2647
+ }>, Schema.Struct<{
2648
+ readonly type: Schema.Literal<"file">;
2649
+ readonly mediaType: Schema.String;
2650
+ readonly fileName: Schema.optional<Schema.String>;
2651
+ readonly "~effect/ai/Prompt/Part": Schema.withDecodingDefaultKey<Schema.Literal<"~effect/ai/Prompt/Part">>;
2652
+ readonly options: Schema.withDecodingDefault<Schema.$Record<Schema.String, Schema.NullOr<Schema.Codec<Schema.Json>>>>;
2653
+ readonly data: Schema.String;
2654
+ }>, never, never>]>>]>;
2655
+ readonly state: Schema.TaggedUnion<{
2656
+ readonly Cancelled: Schema.TaggedStruct<"Cancelled", {
2657
+ readonly reason: Schema.String;
2658
+ readonly byCommandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
2659
+ }>;
2660
+ readonly Consumed: Schema.TaggedStruct<"Consumed", {
2661
+ readonly turnId: Schema.optionalKey<Schema.brand<Schema.String, "TurnId">>;
2662
+ readonly runId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
2663
+ }>;
2664
+ readonly Paused: Schema.TaggedStruct<"Paused", {
2665
+ readonly byCommandId: Schema.brand<Schema.String, "CommandId">;
2666
+ }>;
2667
+ readonly Pending: Schema.TaggedStruct<"Pending", {}>;
2668
+ readonly Promoted: Schema.TaggedStruct<"Promoted", {}>;
2669
+ readonly Steering: Schema.TaggedStruct<"Steering", {}>;
2670
+ }>;
2671
+ readonly steering: Schema.optionalKey<Schema.Struct<{
2672
+ readonly runId: Schema.brand<Schema.String, "RunId">;
2673
+ }>>;
2674
+ readonly classification: Schema.optionalKey<Schema.String>;
2675
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
2676
+ readonly List: Schema.TaggedStruct<"List", {
2677
+ readonly entries: Schema.$Array<Schema.Struct<{
2678
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
2679
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2680
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
2681
+ }>>;
2682
+ }>;
2683
+ readonly Value: Schema.TaggedStruct<"Value", {
2684
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2685
+ }>;
2686
+ }>>;
2687
+ readonly submittedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2688
+ readonly submittedAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2689
+ readonly consumedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2690
+ readonly kind: Schema.tag<"user">;
2691
+ readonly id: Schema.TemplateLiteral<readonly ["user:", Schema.brand<Schema.String, "CommandId">]>;
2692
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2693
+ readonly position: Schema.optionalKey<Schema.Struct<{
2694
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2695
+ readonly ordinal: Schema.Int;
2696
+ }>>;
2697
+ }>, Schema.Struct<{
2698
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2699
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2700
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
2701
+ readonly source: Schema.Literals<readonly ["inference", "import"]>;
2702
+ readonly inferenceId: Schema.brand<Schema.String, "InferenceId">;
2703
+ readonly runId: Schema.brand<Schema.String, "RunId">;
2704
+ readonly turnId: Schema.brand<Schema.String, "TurnId">;
2705
+ readonly runGroupId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>>;
2706
+ readonly messageId: Schema.optionalKey<Schema.brand<Schema.String, "MessageId">>;
2707
+ readonly lifecycle: Schema.TaggedUnion<{
2708
+ readonly Completed: Schema.TaggedStruct<"Completed", {
2709
+ readonly finishReason: Schema.optionalKey<Schema.String>;
2710
+ readonly usage: Schema.optionalKey<Schema.Struct<{
2711
+ readonly inputTokens: Schema.optionalKey<Schema.Int>;
2712
+ readonly cachedInputTokens: Schema.optionalKey<Schema.Int>;
2713
+ readonly cacheWriteInputTokens: Schema.optionalKey<Schema.Int>;
2714
+ readonly outputTokens: Schema.optionalKey<Schema.Int>;
2715
+ readonly textTokens: Schema.optionalKey<Schema.Int>;
2716
+ readonly reasoningTokens: Schema.optionalKey<Schema.Int>;
2717
+ }>>;
2718
+ }>;
2719
+ readonly Failed: Schema.TaggedStruct<"Failed", {
2720
+ readonly error: Schema.Struct<{
2721
+ readonly message: Schema.String;
2722
+ readonly code: Schema.optionalKey<Schema.String>;
2723
+ readonly details: Schema.optionalKey<Schema.Unknown>;
2724
+ }>;
2725
+ }>;
2726
+ readonly Streaming: Schema.TaggedStruct<"Streaming", {}>;
2727
+ }>;
2728
+ readonly parts: Schema.$Array<Schema.Union<readonly [Schema.TaggedUnion<{
2729
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
2730
+ readonly text: Schema.String;
2731
+ }>;
2732
+ readonly Text: Schema.TaggedStruct<"Text", {
2733
+ readonly text: Schema.String;
2734
+ }>;
2735
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
2736
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2737
+ readonly toolName: Schema.NonEmptyString;
2738
+ readonly providerExecuted: Schema.Boolean;
2739
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
2740
+ }>;
2741
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
2742
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2743
+ readonly toolName: Schema.NonEmptyString;
2744
+ readonly isFailure: Schema.Boolean;
2745
+ readonly result: Schema.TaggedUnion<{
2746
+ readonly Inline: Schema.TaggedStruct<"Inline", {
2747
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2748
+ readonly source: Schema.Struct<{
2749
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2750
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2751
+ }>;
2752
+ }>;
2753
+ readonly Ref: Schema.TaggedStruct<"Ref", {
2754
+ readonly source: Schema.Struct<{
2755
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2756
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2757
+ }>;
2758
+ readonly byteLength: Schema.Int;
2759
+ }>;
2760
+ }>;
2761
+ }>;
2762
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
2763
+ readonly partType: Schema.String;
2764
+ }>;
2765
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
2766
+ readonly partType: Schema.String;
2767
+ }>>, Schema.Struct<{
2768
+ readonly _tag: Schema.String;
2769
+ }>, never, never>]>>;
2770
+ readonly partial: Schema.optionalKey<Schema.Struct<{
2771
+ readonly reason: Schema.String;
2772
+ }>>;
2773
+ readonly kind: Schema.tag<"assistant">;
2774
+ readonly id: Schema.Union<readonly [Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>, Schema.TemplateLiteral<readonly ["import:", Schema.brand<Schema.String, "EventId">]>]>;
2775
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2776
+ readonly position: Schema.Struct<{
2777
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2778
+ readonly ordinal: Schema.Int;
2779
+ }>;
2780
+ }>, Schema.Struct<{
2781
+ readonly compactionId: Schema.brand<Schema.String, "CompactionId">;
2782
+ readonly summaryId: Schema.brand<Schema.String, "SummaryId">;
2783
+ readonly contextVersion: Schema.brand<Schema.Int, "ContextVersion">;
2784
+ readonly retainedFromContextSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2785
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2786
+ readonly completedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2787
+ readonly kind: Schema.tag<"compaction">;
2788
+ readonly id: Schema.TemplateLiteral<readonly ["compaction:", Schema.brand<Schema.String, "CompactionId">]>;
2789
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2790
+ readonly position: Schema.Struct<{
2791
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2792
+ readonly ordinal: Schema.Int;
2793
+ }>;
2794
+ }>, Schema.Struct<{
2795
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2796
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2797
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
2798
+ readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
2799
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
2800
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2801
+ readonly toolName: Schema.NonEmptyString;
2802
+ readonly providerExecuted: Schema.Boolean;
2803
+ readonly params: Schema.optionalKey<Schema.TaggedUnion<{
2804
+ readonly Inline: Schema.TaggedStruct<"Inline", {
2805
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2806
+ readonly source: Schema.Struct<{
2807
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2808
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2809
+ }>;
2810
+ }>;
2811
+ readonly Ref: Schema.TaggedStruct<"Ref", {
2812
+ readonly source: Schema.Struct<{
2813
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2814
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2815
+ }>;
2816
+ readonly byteLength: Schema.Int;
2817
+ }>;
2818
+ }>>;
2819
+ readonly lifecycle: Schema.TaggedUnion<{
2820
+ readonly Completed: Schema.TaggedStruct<"Completed", {
2821
+ readonly result: Schema.TaggedUnion<{
2822
+ readonly Inline: Schema.TaggedStruct<"Inline", {
2823
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2824
+ readonly source: Schema.Struct<{
2825
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2826
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2827
+ }>;
2828
+ }>;
2829
+ readonly Ref: Schema.TaggedStruct<"Ref", {
2830
+ readonly source: Schema.Struct<{
2831
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2832
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2833
+ }>;
2834
+ readonly byteLength: Schema.Int;
2835
+ }>;
2836
+ }>;
2837
+ }>;
2838
+ readonly Created: Schema.TaggedStruct<"Created", {}>;
2839
+ readonly Failed: Schema.TaggedStruct<"Failed", {
2840
+ readonly error: Schema.Struct<{
2841
+ readonly message: Schema.String;
2842
+ readonly code: Schema.optionalKey<Schema.String>;
2843
+ readonly details: Schema.optionalKey<Schema.Unknown>;
2844
+ }>;
2845
+ }>;
2846
+ readonly Rejected: Schema.TaggedStruct<"Rejected", {
2847
+ readonly reason: Schema.Literals<readonly ["unknown-tool", "invalid-params"]>;
2848
+ readonly message: Schema.String;
2849
+ readonly modelFeedback: Schema.String;
2850
+ }>;
2851
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
2852
+ }>;
2853
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
2854
+ readonly kind: Schema.tag<"tool">;
2855
+ readonly id: Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>;
2856
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2857
+ }>, Schema.Struct<{
2858
+ readonly rootRunId: Schema.brand<Schema.String, "RunId">;
2859
+ readonly runs: Schema.NonEmptyArray<Schema.Struct<{
2860
+ readonly startedAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2861
+ readonly terminalAtMs: Schema.optionalKey<Schema.brand<Schema.Int, "UnixEpochMillis">>;
2862
+ readonly durationMs: Schema.optionalKey<Schema.Int>;
2863
+ readonly runId: Schema.brand<Schema.String, "RunId">;
2864
+ readonly commandIds: Schema.$Array<Schema.brand<Schema.String, "CommandId">>;
2865
+ readonly modelSelection: Schema.Struct<{
2866
+ readonly provider: Schema.NonEmptyString;
2867
+ readonly modelId: Schema.NonEmptyString;
2868
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
2869
+ }>;
2870
+ readonly outcome: Schema.TaggedUnion<{
2871
+ readonly Completed: Schema.TaggedStruct<"Completed", {}>;
2872
+ readonly Failed: Schema.TaggedStruct<"Failed", {
2873
+ readonly error: Schema.Struct<{
2874
+ readonly message: Schema.String;
2875
+ readonly code: Schema.optionalKey<Schema.String>;
2876
+ readonly details: Schema.optionalKey<Schema.Unknown>;
2877
+ }>;
2878
+ }>;
2879
+ readonly Interrupted: Schema.TaggedStruct<"Interrupted", {
2880
+ readonly reason: Schema.String;
2881
+ }>;
2882
+ readonly Running: Schema.TaggedStruct<"Running", {}>;
2883
+ }>;
2884
+ readonly continuationOf: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
2885
+ }>>;
2886
+ readonly kind: Schema.tag<"runGroup">;
2887
+ readonly id: Schema.TemplateLiteral<readonly ["run:", Schema.brand<Schema.String, "RunId">]>;
2888
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2889
+ }>, Schema.Struct<{
2890
+ readonly activeRunId: Schema.optionalKey<Schema.brand<Schema.String, "RunId">>;
2891
+ readonly activeCompactionId: Schema.optionalKey<Schema.brand<Schema.String, "CompactionId">>;
2892
+ readonly modelSelection: Schema.optionalKey<Schema.Struct<{
2893
+ readonly provider: Schema.NonEmptyString;
2894
+ readonly modelId: Schema.NonEmptyString;
2895
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
2896
+ }>>;
2897
+ readonly lastRunModelSelection: Schema.optionalKey<Schema.Struct<{
2898
+ readonly provider: Schema.NonEmptyString;
2899
+ readonly modelId: Schema.NonEmptyString;
2900
+ readonly settings: Schema.optionalKey<Schema.Unknown>;
2901
+ }>>;
2902
+ readonly tokenUsage: Schema.Struct<{
2903
+ readonly byModel: Schema.$Array<Schema.Struct<{
2904
+ readonly provider: Schema.NonEmptyString;
2905
+ readonly modelId: Schema.NonEmptyString;
2906
+ readonly usage: Schema.Struct<{
2907
+ readonly inputTokens: Schema.Int;
2908
+ readonly cachedInputTokens: Schema.Int;
2909
+ readonly cacheWriteInputTokens: Schema.Int;
2910
+ readonly outputTokens: Schema.Int;
2911
+ readonly textTokens: Schema.Int;
2912
+ readonly reasoningTokens: Schema.Int;
2913
+ }>;
2914
+ }>>;
2915
+ }>;
2916
+ readonly decorations: Schema.$Record<Schema.String, Schema.TaggedUnion<{
2917
+ readonly List: Schema.TaggedStruct<"List", {
2918
+ readonly entries: Schema.$Array<Schema.Struct<{
2919
+ readonly key: Schema.Union<readonly [Schema.String, Schema.Int]>;
2920
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2921
+ readonly id: Schema.optionalKey<Schema.NonEmptyString>;
2922
+ }>>;
2923
+ }>;
2924
+ readonly Value: Schema.TaggedStruct<"Value", {
2925
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2926
+ }>;
2927
+ }>>;
2928
+ readonly kind: Schema.tag<"sessionContext">;
2929
+ readonly id: Schema.Literal<"session">;
2930
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2931
+ }>, Schema.Struct<{
2932
+ readonly operations: Schema.$Array<Schema.Struct<{
2933
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
2934
+ readonly mapping: Schema.String;
2935
+ readonly operation: Schema.Int;
2936
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2937
+ readonly entryKey: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Int]>>;
2938
+ readonly entryId: Schema.optionalKey<Schema.NonEmptyString>;
2939
+ }>>;
2940
+ readonly kind: Schema.tag<"decorationBuffer">;
2941
+ readonly id: Schema.TemplateLiteral<readonly ["decorations:", Schema.Literals<readonly ["command", "idempotencyKey"]>, ":", Schema.NonEmptyString]>;
2942
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2943
+ }>]>, Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.Struct<{
2944
+ readonly format: Schema.Int;
2945
+ readonly kind: Schema.NonEmptyString;
2946
+ readonly id: Schema.NonEmptyString;
2947
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2948
+ readonly position: Schema.optionalKey<Schema.Struct<{
2949
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2950
+ readonly ordinal: Schema.Int;
2951
+ }>>;
2952
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
2953
+ }>, never, never>, never, never>, Schema.decodeTo<Schema.Struct<{
2954
+ readonly kind: Schema.tag<"unknown">;
2955
+ readonly originalKind: Schema.NonEmptyString;
2956
+ readonly format: Schema.Int;
2957
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
2958
+ readonly id: Schema.NonEmptyString;
2959
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2960
+ readonly position: Schema.optionalKey<Schema.Struct<{
2961
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2962
+ readonly ordinal: Schema.Int;
2963
+ }>>;
2964
+ }>, Schema.Struct<{
2965
+ readonly format: Schema.Int;
2966
+ readonly kind: Schema.NonEmptyString;
2967
+ readonly id: Schema.NonEmptyString;
2968
+ readonly updatedSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2969
+ readonly position: Schema.optionalKey<Schema.Struct<{
2970
+ readonly anchorSeq: Schema.brand<Schema.Int, "SequenceNumber">;
2971
+ readonly ordinal: Schema.Int;
2972
+ }>>;
2973
+ readonly body: Schema.$Record<Schema.String, Schema.Unknown>;
2974
+ }>, never, never>]>>;
2975
+ readonly activeContent: Schema.optionalKey<Schema.$Array<Schema.Struct<{
2976
+ readonly assistantId: Schema.TemplateLiteral<readonly ["assistant:", Schema.brand<Schema.String, "InferenceId">]>;
2977
+ readonly parts: Schema.$Array<Schema.Struct<{
2978
+ readonly id: Schema.NonEmptyString;
2979
+ readonly part: Schema.Union<readonly [Schema.TaggedUnion<{
2980
+ readonly Reasoning: Schema.TaggedStruct<"Reasoning", {
2981
+ readonly text: Schema.String;
2982
+ }>;
2983
+ readonly Text: Schema.TaggedStruct<"Text", {
2984
+ readonly text: Schema.String;
2985
+ }>;
2986
+ readonly ToolCall: Schema.TaggedStruct<"ToolCall", {
2987
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2988
+ readonly toolName: Schema.NonEmptyString;
2989
+ readonly providerExecuted: Schema.Boolean;
2990
+ readonly toolId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["tool:", Schema.brand<Schema.String, "ToolCallId">]>>;
2991
+ }>;
2992
+ readonly ToolResult: Schema.TaggedStruct<"ToolResult", {
2993
+ readonly providerPartId: Schema.brand<Schema.NonEmptyString, "ProviderPartId">;
2994
+ readonly toolName: Schema.NonEmptyString;
2995
+ readonly isFailure: Schema.Boolean;
2996
+ readonly result: Schema.TaggedUnion<{
2997
+ readonly Inline: Schema.TaggedStruct<"Inline", {
2998
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
2999
+ readonly source: Schema.Struct<{
3000
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
3001
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
3002
+ }>;
3003
+ }>;
3004
+ readonly Ref: Schema.TaggedStruct<"Ref", {
3005
+ readonly source: Schema.Struct<{
3006
+ readonly seq: Schema.brand<Schema.Int, "SequenceNumber">;
3007
+ readonly path: Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Int]>>;
3008
+ }>;
3009
+ readonly byteLength: Schema.Int;
3010
+ }>;
3011
+ }>;
3012
+ }>;
3013
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
3014
+ readonly partType: Schema.String;
3015
+ }>;
3016
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
3017
+ readonly partType: Schema.String;
3018
+ }>>, Schema.Struct<{
3019
+ readonly _tag: Schema.String;
3020
+ }>, never, never>]>;
3021
+ readonly paramsText: Schema.optionalKey<Schema.String>;
3022
+ }>>;
3023
+ }>>>;
3024
+ readonly hasOlder: Schema.Boolean;
3025
+ readonly hasNewer: Schema.Boolean;
3026
+ readonly readiness: Schema.Union<readonly [Schema.TaggedUnion<{
3027
+ readonly Building: Schema.TaggedStruct<"Building", {}>;
3028
+ readonly Degraded: Schema.TaggedStruct<"Degraded", {
3029
+ readonly failedAtSeq: Schema.brand<Schema.Int, "SequenceNumber">;
3030
+ readonly error: Schema.String;
3031
+ }>;
3032
+ readonly Ready: Schema.TaggedStruct<"Ready", {}>;
3033
+ readonly Unknown: Schema.TaggedStruct<"Unknown", {
3034
+ readonly readinessType: Schema.String;
3035
+ }>;
3036
+ readonly Unreadable: Schema.TaggedStruct<"Unreadable", {
3037
+ readonly error: Schema.String;
3038
+ }>;
3039
+ readonly UpdatingHistory: Schema.TaggedStruct<"UpdatingHistory", {}>;
3040
+ }>, Schema.decodeTo<Schema.toType<Schema.TaggedStruct<"Unknown", {
3041
+ readonly readinessType: Schema.String;
3042
+ }>>, Schema.Struct<{
3043
+ readonly _tag: Schema.String;
3044
+ }>, never, never>]>;
3045
+ }>;
3046
+ type TranscriptWindow = typeof TranscriptWindow.Type;
3047
+ /** Paging cursor for one top-level record of a window. */
3048
+ declare const transcriptCursorOf: (window: Pick<TranscriptWindow, "incarnation" | "version">, record: TranscriptRecordView) => TranscriptCursor | undefined;
3049
+ /** Health of one stored transcript version. A failed version is frozen at its last good cursor. */
3050
+ declare const TranscriptVersionStatus: Schema.TaggedUnion<{
3051
+ readonly Failed: Schema.TaggedStruct<"Failed", {
3052
+ readonly failedAtSeq: Schema.brand<Schema.Int, "SequenceNumber">;
3053
+ readonly error: Schema.String;
3054
+ }>;
3055
+ readonly Ok: Schema.TaggedStruct<"Ok", {}>;
3056
+ }>;
3057
+ type TranscriptVersionStatus = typeof TranscriptVersionStatus.Type;
3058
+ /**
3059
+ * Per-version maintenance state, one per version present in a session's storage.
3060
+ *
3061
+ * `cursor` is the last fully projected seq, committed together with that version's rows. At most
3062
+ * one version is `active` (served) and at most one is `building` (catching up from the log).
3063
+ */
3064
+ declare const TranscriptVersionMeta: Schema.Struct<{
3065
+ readonly version: Schema.brand<Schema.String, "TranscriptVersion">;
3066
+ readonly role: Schema.Literals<readonly ["active", "building"]>;
3067
+ readonly cursor: Schema.brand<Schema.Int, "SequenceNumber">;
3068
+ readonly status: Schema.TaggedUnion<{
3069
+ readonly Failed: Schema.TaggedStruct<"Failed", {
3070
+ readonly failedAtSeq: Schema.brand<Schema.Int, "SequenceNumber">;
3071
+ readonly error: Schema.String;
3072
+ }>;
3073
+ readonly Ok: Schema.TaggedStruct<"Ok", {}>;
3074
+ }>;
3075
+ }>;
3076
+ type TranscriptVersionMeta = typeof TranscriptVersionMeta.Type;
3077
+ //#endregion
3078
+ //#region src/transcript/store.d.ts
3079
+ /**
3080
+ * The transcript definitions a store maintains, fixed when the store is constructed.
3081
+ *
3082
+ * `current` is what new sessions start with and every session converges to. `previous` is
3083
+ * carried for one release only, so a session not yet rebuilt keeps its active rows maintained.
3084
+ * A stored version that matches neither is frozen.
3085
+ */
3086
+ interface TranscriptMaintenanceConfig {
3087
+ readonly current: TranscriptDefinition;
3088
+ readonly previous?: TranscriptDefinition;
3089
+ }
3090
+ declare const TranscriptCursorMismatch_base: Schema.Class<TranscriptCursorMismatch, Schema.TaggedStruct<"TranscriptCursorMismatch", {
3091
+ readonly message: Schema.String;
3092
+ }>, import("effect/Cause").YieldableError>;
3093
+ /** A cursor minted for another log incarnation or transcript version. The client takes `Latest`. */
3094
+ declare class TranscriptCursorMismatch extends TranscriptCursorMismatch_base {}
3095
+ /**
3096
+ * Storage-level transcript reads for one session.
3097
+ *
3098
+ * Maintenance has no method here: the store runs it inside its own append transaction for every
3099
+ * carried, healthy version, so `EDASessionStore.append` semantics are unchanged. These reads never
3100
+ * construct the model runtime and never include live active content, which only the delivery
3101
+ * layer can capture.
3102
+ */
3103
+ interface EDATranscriptStoreShape {
3104
+ /** Read one complete window of the served version at a single cut. */
3105
+ readonly readTranscriptWindow: (selector: TranscriptWindowSelector, limits: TranscriptWindowLimits) => Effect.Effect<TranscriptWindow, EDASessionStoreError | TranscriptCursorMismatch>;
3106
+ /** Maintenance state of every version present, for builders, backfill proofs and alerts. */
3107
+ readonly readTranscriptMeta: Effect.Effect<ReadonlyArray<TranscriptVersionMeta>, EDASessionStoreError>;
3108
+ }
3109
+ declare const EDATranscriptStore_base: Context.ServiceClass<EDATranscriptStore, "@effect-durable-agent/EDATranscriptStore", EDATranscriptStoreShape>;
3110
+ /** Transcript read port, provided alongside `EDASessionStore` by stores that maintain transcripts. */
3111
+ declare class EDATranscriptStore extends EDATranscriptStore_base {}
3112
+ //#endregion
3113
+ //#region src/services/session-store.d.ts
3114
+ type CommittedDurableEvent<E = DecodedDurableEvent> = {
3115
+ readonly position: typeof DurablePosition.Type;
3116
+ readonly event: E;
3117
+ };
3118
+ /** A durable event after the store has assigned its replay position. */
3119
+ declare const CommittedDurableEvent: Schema.Codec<CommittedDurableEvent, {
3120
+ readonly position: typeof DurablePosition.Encoded;
3121
+ readonly event: typeof DurableEventEnvelope.Encoded;
3122
+ }, never, never>;
3123
+ declare const EDASessionStoreError_base: Schema.Class<EDASessionStoreError, Schema.TaggedStruct<"EDASessionStoreError", {
3124
+ readonly message: Schema.String;
3125
+ }>, Cause.YieldableError>;
3126
+ /**
3127
+ * Store-level failure surfaced by durable append, replay, and hydration APIs.
3128
+ *
3129
+ * The error intentionally stays storage-semantic rather than SQL-specific so
3130
+ * framework services can treat SQL-backed hosts, in-memory tests, and future adapters
3131
+ * as the same durability boundary.
3132
+ */
3133
+ declare class EDASessionStoreError extends EDASessionStoreError_base {}
3134
+ /** True when a Cause contains an escaped durable-store failure. */
3135
+ declare const hasEDASessionStoreError: (cause: Cause.Cause<unknown>) => boolean;
3136
+ /**
3137
+ * One logical event to persist in the durable session log.
3138
+ *
3139
+ * Store adapters may split large logical payload fields into sidecar rows after
3140
+ * the event insert assigns `seq`, but callers still provide one fat event.
3141
+ */
3142
+ declare const DurableAppendEntry: Schema.Struct<{
3143
+ readonly event: Schema.Struct<{
3144
+ readonly namespace: Schema.NonEmptyString;
3145
+ readonly type: Schema.NonEmptyString;
3146
+ readonly schemaVersion: Schema.Int;
3147
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
3148
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
3149
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
3150
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
3151
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
3152
+ readonly span: Schema.Struct<{
3153
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
3154
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
3155
+ readonly sampled: Schema.Boolean;
3156
+ readonly tracestate: Schema.NullOr<Schema.String>;
3157
+ }>;
3158
+ readonly links: Schema.$Array<Schema.Struct<{
3159
+ readonly context: Schema.Struct<{
3160
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
3161
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
3162
+ readonly sampled: Schema.Boolean;
3163
+ readonly tracestate: Schema.NullOr<Schema.String>;
3164
+ }>;
3165
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
3166
+ }>>;
3167
+ }>>;
3168
+ readonly payload: Schema.Unknown;
3169
+ readonly durability: Schema.Literal<"durable">;
3170
+ }>;
3171
+ }>;
3172
+ type DurableAppendEntry = typeof DurableAppendEntry.Type;
3173
+ /**
3174
+ * Ordered durable append intent. Adapters assign positions in entry order.
3175
+ *
3176
+ * This is the single write shape exposed to framework services. It avoids raw
3177
+ * SQL and public transaction callbacks while still expressing the full atomic
3178
+ * transition EDA needs for events, normalized bodies, and metadata.
3179
+ */
3180
+ declare const DurableAppendBatch: Schema.Struct<{
3181
+ readonly entries: Schema.$Array<Schema.Struct<{
3182
+ readonly event: Schema.Struct<{
3183
+ readonly namespace: Schema.NonEmptyString;
3184
+ readonly type: Schema.NonEmptyString;
3185
+ readonly schemaVersion: Schema.Int;
3186
+ readonly eventId: Schema.brand<Schema.String, "EventId">;
3187
+ readonly sessionId: Schema.brand<Schema.String, "SessionId">;
3188
+ readonly correlationId: Schema.optionalKey<Schema.brand<Schema.String, "CorrelationId">>;
3189
+ readonly createdAtMs: Schema.brand<Schema.Int, "UnixEpochMillis">;
3190
+ readonly trace: Schema.withConstructorDefault<Schema.Struct<{
3191
+ readonly span: Schema.Struct<{
3192
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
3193
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
3194
+ readonly sampled: Schema.Boolean;
3195
+ readonly tracestate: Schema.NullOr<Schema.String>;
3196
+ }>;
3197
+ readonly links: Schema.$Array<Schema.Struct<{
3198
+ readonly context: Schema.Struct<{
3199
+ readonly traceId: Schema.brand<Schema.String, "EDATraceId">;
3200
+ readonly spanId: Schema.brand<Schema.String, "EDASpanId">;
3201
+ readonly sampled: Schema.Boolean;
3202
+ readonly tracestate: Schema.NullOr<Schema.String>;
3203
+ }>;
3204
+ readonly attributes: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean]>>;
3205
+ }>>;
3206
+ }>>;
3207
+ readonly payload: Schema.Unknown;
3208
+ readonly durability: Schema.Literal<"durable">;
3209
+ }>;
3210
+ }>>;
3211
+ }>;
3212
+ type DurableAppendBatch = typeof DurableAppendBatch.Type;
3213
+ /** Durable reducer checkpoint row used to hydrate framework and app projections cheaply. */
3214
+ interface EDAReducerCheckpoint {
3215
+ readonly name: string;
3216
+ readonly schemaVersion: number;
3217
+ readonly throughSeq: SequenceNumber;
3218
+ readonly payload: unknown;
3219
+ readonly updatedAtMs: number;
3220
+ }
3221
+ /** Input for writing one durable reducer checkpoint. */
3222
+ interface SaveReducerCheckpointInput {
3223
+ readonly name: string;
3224
+ readonly schemaVersion: number;
3225
+ readonly throughSeq: SequenceNumber;
3226
+ readonly payload: unknown;
3227
+ readonly updatedAtMs: number;
3228
+ }
3229
+ /** Indexed command-admission lookup used for idempotent ingress. */
3230
+ declare const FindCommandAdmissionInput: Schema.Struct<{
3231
+ readonly commandId: Schema.optionalKey<Schema.brand<Schema.String, "CommandId">>;
3232
+ readonly idempotencyKey: Schema.optionalKey<Schema.String>;
3233
+ }>;
3234
+ /** Typed command-admission lookup accepted by the semantic store port. */
3235
+ interface FindCommandAdmissionInput {
3236
+ readonly commandId?: CommandId;
3237
+ readonly idempotencyKey?: CommandIdempotencyKey;
3238
+ }
3239
+ /** Semantic durable store contract for one EDA session. */
3240
+ interface EDASessionStoreShape {
3241
+ /**
3242
+ * Append durable logical events atomically, preserving input order.
3243
+ *
3244
+ * Implementations must be idempotent by `eventId`: duplicates return the
3245
+ * original committed position and do not advance the durable head. Live publish
3246
+ * remains outside the store and is owned by `SessionState` after this succeeds.
3247
+ */
3248
+ readonly append: (batch: DurableAppendBatch) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;
3249
+ /** Replay committed durable events with `seq > afterSeq`. */
3250
+ readonly eventsAfter: (afterSeq: SequenceNumber) => Stream.Stream<CommittedDurableEvent, EDASessionStoreError>;
3251
+ /** Load committed durable events by exact sequence number for checkpoint pointer hydration. */
3252
+ readonly loadCommittedEventsBySeq: (seqs: ReadonlyArray<SequenceNumber>) => Effect.Effect<ReadonlyArray<CommittedDurableEvent>, EDASessionStoreError>;
3253
+ /** Lookup an admitted command without replaying the full journal. */
3254
+ readonly findCommandAdmission: (input: FindCommandAdmissionInput) => Effect.Effect<CommittedDurableEvent | undefined, EDASessionStoreError>;
3255
+ /** Load one compacted summary artifact body by id, if it has been saved. */
3256
+ readonly loadSummaryArtifact: (summaryId: SummaryId) => Effect.Effect<CompactionSummaryArtifact | undefined, EDASessionStoreError>;
3257
+ /** Load one framework or app reducer checkpoint, if it has been saved. */
3258
+ readonly loadReducerCheckpoint: (name: string) => Effect.Effect<EDAReducerCheckpoint | undefined, EDASessionStoreError>;
3259
+ /** Persist one framework or app reducer checkpoint as a derived cache. */
3260
+ readonly saveReducerCheckpoint: (checkpoint: SaveReducerCheckpointInput) => Effect.Effect<void, EDASessionStoreError>;
3261
+ /** Persist a reducer checkpoint snapshot atomically across framework and app reducers. */
3262
+ readonly saveReducerCheckpoints: (checkpoints: ReadonlyArray<SaveReducerCheckpointInput>) => Effect.Effect<void, EDASessionStoreError>;
3263
+ }
3264
+ declare const EDASessionStore_base: Context.ServiceClass<EDASessionStore, "@effect-durable-agent/EDASessionStore", EDASessionStoreShape>;
3265
+ /**
3266
+ * SQL-agnostic durable storage port for one EDA session.
3267
+ *
3268
+ * Framework services depend on this semantic port rather than raw SQL. Host
3269
+ * adapters own physical tables and synchronous transaction mechanics; callers
3270
+ * only express durable append/replay/lookup intent.
3271
+ */
3272
+ declare class EDASessionStore extends EDASessionStore_base {
3273
+ /**
3274
+ * Deterministic in-memory implementation used by runtime and recovery tests.
3275
+ *
3276
+ * It also provides `EDATranscriptStore`, maintaining the transcript inside the same append
3277
+ * critical section. Without `options.transcript` it maintains the definition with no host
3278
+ * mappings.
3279
+ */
3280
+ static readonly InMemory: (sessionId: SessionId, options?: InMemoryStoreOptions) => Layer.Layer<EDASessionStore | EDATranscriptStore, never, never>;
3281
+ /** In-memory store seeded with a durable prefix; its transcript is built from that prefix. */
3282
+ static readonly InMemorySeeded: (sessionId: SessionId, events: ReadonlyArray<DurableEventEnvelope>, options?: InMemoryStoreOptions) => Layer.Layer<EDASessionStore | EDATranscriptStore, never, never>;
3283
+ }
3284
+ /** Construction options for the in-memory store. */
3285
+ interface InMemoryStoreOptions {
3286
+ /** Transcript definitions to maintain; defaults to the definition with no host mappings. */
3287
+ readonly transcript?: TranscriptMaintenanceConfig;
3288
+ }
3289
+ /** App schemas are registered once; known namespaces fail at the store boundary when malformed. */
3290
+ type EDAAppEvents = Schema.Codec<DurableEventEnvelope, unknown, never, never>;
3291
+ /** Attach the app decoder to every event-returning store operation without changing storage bytes. */
3292
+ declare const registerAppEvents: (store: EDASessionStoreShape, schema: EDAAppEvents) => EDASessionStoreShape;
3293
+ /** Narrow an already decoded fact from one schema, without decoding its payload again. */
3294
+ declare const selectCommittedEvent: <E extends DurableEventEnvelope>(schema: Schema.Codec<E, unknown, never, never>, entry: CommittedDurableEvent) => CommittedDurableEvent<E> | undefined;
3295
+ /** Typed journal read available to tools and application services without private SQL access. */
3296
+ declare const queryCommittedEvents: <E extends DurableEventEnvelope>(store: EDASessionStoreShape, schema: Schema.Codec<E, unknown, never, never>, options?: {
3297
+ readonly afterSeq?: SequenceNumber;
3298
+ readonly limit?: number;
3299
+ }) => Effect.Effect<ReadonlyArray<CommittedDurableEvent<E>>, EDASessionStoreError>;
3300
+ //#endregion
3301
+ export { TranscriptAssistantPart as $, TranscriptDefinition as A, TranscriptToolRecord as At, makeTranscriptDefinition as B, transcriptDecorationBufferLimit as Bt, TranscriptVersionMeta as C, TranscriptRecordView as Ct, TranscriptWindowSelector as D, TranscriptRunOutcome as Dt, TranscriptWindowLimits as E, TranscriptRunMember as Et, TranscriptMappingOperation as F, TranscriptVersion as Ft, DecorationBufferRecordId as G, AssistantRecordId as H, transcriptRecordId as Ht, TranscriptMappingTarget as I, UserRecordId as It, PendingTranscriptUserRecord as J, ImportAssistantRecordId as K, TranscriptMappings as L, isPendingTranscriptUserRecord as Lt, TranscriptListEntryKey as M, TranscriptUnknownRecord as Mt, TranscriptMappedEvent as N, TranscriptUserRecord as Nt, defaultTranscriptWindowLimits as O, TranscriptSessionContextRecord as Ot, TranscriptMapping as P, TranscriptUserState as Pt, TranscriptAssistantLifecycle as Q, TranscriptUserFallback as R, isTopLevelTranscriptRecord as Rt, TranscriptReadiness as S, TranscriptRecordKind as St, TranscriptWindow as T, TranscriptRunGroupRecord as Tt, CompactionRecordId as U, transcriptStoredInlineBodyLimit as Ut, transcriptMappingBounds as V, transcriptRecordEnvelopeFormat as Vt, ConsumedTranscriptUserRecord as W, SessionContextRecordId as X, RunGroupRecordId as Y, ToolRecordId as Z, EDATranscriptStoreShape as _, TranscriptPosition as _t, EDAReducerCheckpoint as a, TranscriptCompactionRecord as at, TranscriptActiveContent as b, TranscriptRecordFromEnvelope as bt, EDASessionStoreShape as c, TranscriptDecorationBufferRecord as ct, SaveReducerCheckpointInput as d, TranscriptDecorationKey as dt, TranscriptAssistantRecord as et, hasEDASessionStoreError as f, TranscriptDecorations as ft, EDATranscriptStore as g, TranscriptOrderKey as gt, selectCommittedEvent as h, TranscriptOrder as ht, EDAAppEvents as i, TranscriptClassification as it, TranscriptDefinitionError as j, TranscriptTopLevelRecord as jt, transcriptCursorOf as k, TranscriptToolLifecycle as kt, FindCommandAdmissionInput as l, TranscriptDecorationEntryId as lt, registerAppEvents as m, TranscriptLogIncarnation as mt, DurableAppendBatch as n, TranscriptBodySource as nt, EDASessionStore as o, TranscriptCursor as ot, queryCommittedEvents as p, TranscriptFieldPath as pt, InferenceAssistantRecordId as q, DurableAppendEntry as r, TranscriptBufferedDecoration as rt, EDASessionStoreError as s, TranscriptDecoration as st, CommittedDurableEvent as t, TranscriptBody as tt, InMemoryStoreOptions as u, TranscriptDecorationEntryKey as ut, TranscriptCursorMismatch as v, TranscriptRecord as vt, TranscriptVersionStatus as w, TranscriptRecordViewFromEnvelope as wt, TranscriptActivePart as x, TranscriptRecordId as xt, TranscriptMaintenanceConfig as y, TranscriptRecordEnvelope as yt, emptyTranscriptMappings as z, runGroupStatus as zt };
3302
+ //# sourceMappingURL=session-store-CWYZ29CV.d.ts.map