stitchkit 0.68.4 → 0.68.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +4 -1
  2. package/dist/agent-runtime/coordinator.d.ts +5 -2
  3. package/dist/agent-runtime/coordinator.d.ts.map +1 -1
  4. package/dist/agent-runtime/event-schema.d.ts +1349 -0
  5. package/dist/agent-runtime/event-schema.d.ts.map +1 -0
  6. package/dist/agent-runtime/events.d.ts +2 -1347
  7. package/dist/agent-runtime/events.d.ts.map +1 -1
  8. package/dist/agent-runtime/run-execution.d.ts +2 -0
  9. package/dist/agent-runtime/run-execution.d.ts.map +1 -1
  10. package/dist/agent-runtime/runtime.d.ts +2 -0
  11. package/dist/agent-runtime/runtime.d.ts.map +1 -1
  12. package/dist/agent-runtime/schemas.d.ts +12 -0
  13. package/dist/agent-runtime/schemas.d.ts.map +1 -1
  14. package/dist/agent-runtime/store-driver.d.ts +12 -0
  15. package/dist/agent-runtime/store-driver.d.ts.map +1 -1
  16. package/dist/agent-runtime/store.d.ts +37 -6
  17. package/dist/agent-runtime/store.d.ts.map +1 -1
  18. package/dist/agent-runtime/terminal-commit.d.ts +2 -0
  19. package/dist/agent-runtime/terminal-commit.d.ts.map +1 -1
  20. package/dist/agent-runtime-browser.d.ts +4 -0
  21. package/dist/agent-runtime-browser.d.ts.map +1 -0
  22. package/dist/agent-runtime-browser.js +424 -0
  23. package/dist/agent-runtime.js +169 -93
  24. package/dist/browser/cancellation.d.ts.map +1 -1
  25. package/dist/{index-thcy3w8c.js → index-n34x0q5e.js} +6 -6
  26. package/dist/{index-fhsmrzj7.js → index-ysphyxax.js} +4 -1
  27. package/dist/index.js +6 -6
  28. package/dist/remote.js +1 -1
  29. package/dist/testing/agent-store-conformance.d.ts.map +1 -1
  30. package/dist/testing.js +117 -6
  31. package/llms-full.txt +71 -10
  32. package/package.json +6 -2
@@ -1,1349 +1,6 @@
1
- import { z } from 'zod';
2
1
  import type { ObservabilitySinkStatus } from '../observability/status.js';
3
- export declare const AgentAdmissionEventSchema: z.ZodObject<{
4
- type: z.ZodLiteral<"admission">;
5
- eventId: z.ZodString;
6
- conversationId: z.ZodString;
7
- runId: z.ZodString;
8
- snapshotVersion: z.ZodInt;
9
- input: z.ZodObject<{
10
- schemaVersion: z.ZodLiteral<1>;
11
- id: z.ZodString;
12
- conversationId: z.ZodString;
13
- runId: z.ZodOptional<z.ZodString>;
14
- role: z.ZodEnum<{
15
- assistant: "assistant";
16
- summary: "summary";
17
- system: "system";
18
- user: "user";
19
- }>;
20
- status: z.ZodEnum<{
21
- committed: "committed";
22
- completed: "completed";
23
- failed: "failed";
24
- interrupted: "interrupted";
25
- streaming: "streaming";
26
- superseded: "superseded";
27
- }>;
28
- parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
29
- type: z.ZodLiteral<"text">;
30
- text: z.ZodString;
31
- }, z.core.$strip>, z.ZodObject<{
32
- type: z.ZodLiteral<"reasoning">;
33
- text: z.ZodString;
34
- provider: z.ZodOptional<z.ZodObject<{
35
- schemaVersion: z.ZodInt;
36
- provider: z.ZodString;
37
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
38
- }, z.core.$strip>>;
39
- }, z.core.$strip>, z.ZodObject<{
40
- type: z.ZodLiteral<"file">;
41
- mediaType: z.ZodString;
42
- reference: z.ZodString;
43
- filename: z.ZodOptional<z.ZodString>;
44
- }, z.core.$strip>, z.ZodObject<{
45
- type: z.ZodLiteral<"source">;
46
- sourceId: z.ZodString;
47
- url: z.ZodOptional<z.ZodURL>;
48
- title: z.ZodOptional<z.ZodString>;
49
- }, z.core.$strip>, z.ZodObject<{
50
- type: z.ZodLiteral<"tool-call">;
51
- callId: z.ZodString;
52
- toolName: z.ZodString;
53
- input: z.ZodJSONSchema;
54
- provider: z.ZodOptional<z.ZodObject<{
55
- schemaVersion: z.ZodInt;
56
- provider: z.ZodString;
57
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
58
- }, z.core.$strip>>;
59
- }, z.core.$strip>, z.ZodObject<{
60
- type: z.ZodLiteral<"tool-result">;
61
- callId: z.ZodString;
62
- toolName: z.ZodString;
63
- outcome: z.ZodEnum<{
64
- error: "error";
65
- interrupted: "interrupted";
66
- success: "success";
67
- }>;
68
- output: z.ZodOptional<z.ZodJSONSchema>;
69
- }, z.core.$strip>, z.ZodObject<{
70
- type: z.ZodLiteral<"provider">;
71
- envelope: z.ZodObject<{
72
- schemaVersion: z.ZodInt;
73
- provider: z.ZodString;
74
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
75
- }, z.core.$strip>;
76
- }, z.core.$strip>, z.ZodObject<{
77
- type: z.ZodLiteral<"control">;
78
- reason: z.ZodEnum<{
79
- "run-interrupted": "run-interrupted";
80
- "stale-run": "stale-run";
81
- }>;
82
- }, z.core.$strip>], "type">>;
83
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
84
- createdAt: z.ZodISODateTime;
85
- updatedAt: z.ZodISODateTime;
86
- }, z.core.$strip>;
87
- run: z.ZodObject<{
88
- schemaVersion: z.ZodLiteral<1>;
89
- id: z.ZodString;
90
- conversationId: z.ZodString;
91
- inputMessageIds: z.ZodArray<z.ZodString>;
92
- assistantMessageId: z.ZodString;
93
- state: z.ZodEnum<{
94
- abandoned: "abandoned";
95
- cancelled: "cancelled";
96
- completed: "completed";
97
- failed: "failed";
98
- interrupt_requested: "interrupt_requested";
99
- interrupted: "interrupted";
100
- queued: "queued";
101
- running: "running";
102
- superseded: "superseded";
103
- }>;
104
- revision: z.ZodInt;
105
- ownerId: z.ZodOptional<z.ZodString>;
106
- fencingToken: z.ZodOptional<z.ZodInt>;
107
- terminalReason: z.ZodOptional<z.ZodEnum<{
108
- abandoned: "abandoned";
109
- absorbed: "absorbed";
110
- cancelled: "cancelled";
111
- context_overflow: "context_overflow";
112
- interrupted: "interrupted";
113
- policy_stop: "policy_stop";
114
- provider_failure: "provider_failure";
115
- provider_stop: "provider_stop";
116
- shutdown: "shutdown";
117
- success: "success";
118
- superseded: "superseded";
119
- timeout: "timeout";
120
- }>>;
121
- terminalPolicyName: z.ZodOptional<z.ZodString>;
122
- absorbedIntoRunId: z.ZodOptional<z.ZodString>;
123
- usage: z.ZodOptional<z.ZodObject<{
124
- inputTokens: z.ZodObject<{
125
- value: z.ZodOptional<z.ZodInt>;
126
- provenance: z.ZodEnum<{
127
- computed: "computed";
128
- estimated: "estimated";
129
- "provider-reported": "provider-reported";
130
- unavailable: "unavailable";
131
- }>;
132
- }, z.core.$strip>;
133
- outputTokens: z.ZodObject<{
134
- value: z.ZodOptional<z.ZodInt>;
135
- provenance: z.ZodEnum<{
136
- computed: "computed";
137
- estimated: "estimated";
138
- "provider-reported": "provider-reported";
139
- unavailable: "unavailable";
140
- }>;
141
- }, z.core.$strip>;
142
- reasoningTokens: z.ZodOptional<z.ZodObject<{
143
- value: z.ZodOptional<z.ZodInt>;
144
- provenance: z.ZodEnum<{
145
- computed: "computed";
146
- estimated: "estimated";
147
- "provider-reported": "provider-reported";
148
- unavailable: "unavailable";
149
- }>;
150
- }, z.core.$strip>>;
151
- cacheReadTokens: z.ZodOptional<z.ZodObject<{
152
- value: z.ZodOptional<z.ZodInt>;
153
- provenance: z.ZodEnum<{
154
- computed: "computed";
155
- estimated: "estimated";
156
- "provider-reported": "provider-reported";
157
- unavailable: "unavailable";
158
- }>;
159
- }, z.core.$strip>>;
160
- cacheWriteTokens: z.ZodOptional<z.ZodObject<{
161
- value: z.ZodOptional<z.ZodInt>;
162
- provenance: z.ZodEnum<{
163
- computed: "computed";
164
- estimated: "estimated";
165
- "provider-reported": "provider-reported";
166
- unavailable: "unavailable";
167
- }>;
168
- }, z.core.$strip>>;
169
- cost: z.ZodOptional<z.ZodObject<{
170
- value: z.ZodOptional<z.ZodNumber>;
171
- currency: z.ZodOptional<z.ZodString>;
172
- provenance: z.ZodEnum<{
173
- computed: "computed";
174
- estimated: "estimated";
175
- "provider-reported": "provider-reported";
176
- unavailable: "unavailable";
177
- }>;
178
- }, z.core.$strip>>;
179
- }, z.core.$strip>>;
180
- createdAt: z.ZodISODateTime;
181
- updatedAt: z.ZodISODateTime;
182
- }, z.core.$strip>;
183
- assistant: z.ZodUnion<readonly [z.ZodObject<{
184
- schemaVersion: z.ZodLiteral<1>;
185
- id: z.ZodString;
186
- conversationId: z.ZodString;
187
- runId: z.ZodString;
188
- status: z.ZodLiteral<"pending">;
189
- createdAt: z.ZodISODateTime;
190
- updatedAt: z.ZodISODateTime;
191
- }, z.core.$strip>, z.ZodObject<{
192
- schemaVersion: z.ZodLiteral<1>;
193
- id: z.ZodString;
194
- conversationId: z.ZodString;
195
- runId: z.ZodOptional<z.ZodString>;
196
- role: z.ZodEnum<{
197
- assistant: "assistant";
198
- summary: "summary";
199
- system: "system";
200
- user: "user";
201
- }>;
202
- status: z.ZodEnum<{
203
- committed: "committed";
204
- completed: "completed";
205
- failed: "failed";
206
- interrupted: "interrupted";
207
- streaming: "streaming";
208
- superseded: "superseded";
209
- }>;
210
- parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
211
- type: z.ZodLiteral<"text">;
212
- text: z.ZodString;
213
- }, z.core.$strip>, z.ZodObject<{
214
- type: z.ZodLiteral<"reasoning">;
215
- text: z.ZodString;
216
- provider: z.ZodOptional<z.ZodObject<{
217
- schemaVersion: z.ZodInt;
218
- provider: z.ZodString;
219
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
220
- }, z.core.$strip>>;
221
- }, z.core.$strip>, z.ZodObject<{
222
- type: z.ZodLiteral<"file">;
223
- mediaType: z.ZodString;
224
- reference: z.ZodString;
225
- filename: z.ZodOptional<z.ZodString>;
226
- }, z.core.$strip>, z.ZodObject<{
227
- type: z.ZodLiteral<"source">;
228
- sourceId: z.ZodString;
229
- url: z.ZodOptional<z.ZodURL>;
230
- title: z.ZodOptional<z.ZodString>;
231
- }, z.core.$strip>, z.ZodObject<{
232
- type: z.ZodLiteral<"tool-call">;
233
- callId: z.ZodString;
234
- toolName: z.ZodString;
235
- input: z.ZodJSONSchema;
236
- provider: z.ZodOptional<z.ZodObject<{
237
- schemaVersion: z.ZodInt;
238
- provider: z.ZodString;
239
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
240
- }, z.core.$strip>>;
241
- }, z.core.$strip>, z.ZodObject<{
242
- type: z.ZodLiteral<"tool-result">;
243
- callId: z.ZodString;
244
- toolName: z.ZodString;
245
- outcome: z.ZodEnum<{
246
- error: "error";
247
- interrupted: "interrupted";
248
- success: "success";
249
- }>;
250
- output: z.ZodOptional<z.ZodJSONSchema>;
251
- }, z.core.$strip>, z.ZodObject<{
252
- type: z.ZodLiteral<"provider">;
253
- envelope: z.ZodObject<{
254
- schemaVersion: z.ZodInt;
255
- provider: z.ZodString;
256
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
257
- }, z.core.$strip>;
258
- }, z.core.$strip>, z.ZodObject<{
259
- type: z.ZodLiteral<"control">;
260
- reason: z.ZodEnum<{
261
- "run-interrupted": "run-interrupted";
262
- "stale-run": "stale-run";
263
- }>;
264
- }, z.core.$strip>], "type">>;
265
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
266
- createdAt: z.ZodISODateTime;
267
- updatedAt: z.ZodISODateTime;
268
- }, z.core.$strip>]>;
269
- emittedAt: z.ZodISODateTime;
270
- }, z.core.$strip>;
271
- /**
272
- * `runtimeEpoch` is one identity generated per `createAgentRuntime()`. It is the
273
- * same value the store holds as `AgentRun.ownerId`; each name states the role it
274
- * plays where it appears. A changed epoch on the same conversation means the
275
- * runtime restarted, which is how a consumer detects a gap in a transient
276
- * stream that durable checkpoints would not show.
277
- */
278
- export declare const AgentTransientDeltaEventSchema: z.ZodObject<{
279
- conversationId: z.ZodString;
280
- runId: z.ZodString;
281
- emittedAt: z.ZodISODateTime;
282
- type: z.ZodLiteral<"assistant-delta">;
283
- runtimeEpoch: z.ZodString;
284
- sequence: z.ZodInt;
285
- textDelta: z.ZodString;
286
- }, z.core.$strip>;
287
- export declare const AgentReasoningStartEventSchema: z.ZodObject<{
288
- conversationId: z.ZodString;
289
- runId: z.ZodString;
290
- emittedAt: z.ZodISODateTime;
291
- runtimeEpoch: z.ZodString;
292
- sequence: z.ZodInt;
293
- provider: z.ZodOptional<z.ZodObject<{
294
- schemaVersion: z.ZodInt;
295
- provider: z.ZodString;
296
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
297
- }, z.core.$strip>>;
298
- type: z.ZodLiteral<"reasoning-start">;
299
- }, z.core.$strip>;
300
- export declare const AgentReasoningDeltaEventSchema: z.ZodObject<{
301
- conversationId: z.ZodString;
302
- runId: z.ZodString;
303
- emittedAt: z.ZodISODateTime;
304
- runtimeEpoch: z.ZodString;
305
- sequence: z.ZodInt;
306
- provider: z.ZodOptional<z.ZodObject<{
307
- schemaVersion: z.ZodInt;
308
- provider: z.ZodString;
309
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
310
- }, z.core.$strip>>;
311
- type: z.ZodLiteral<"reasoning-delta">;
312
- textDelta: z.ZodString;
313
- }, z.core.$strip>;
314
- export declare const AgentReasoningEndEventSchema: z.ZodObject<{
315
- conversationId: z.ZodString;
316
- runId: z.ZodString;
317
- emittedAt: z.ZodISODateTime;
318
- runtimeEpoch: z.ZodString;
319
- sequence: z.ZodInt;
320
- provider: z.ZodOptional<z.ZodObject<{
321
- schemaVersion: z.ZodInt;
322
- provider: z.ZodString;
323
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
324
- }, z.core.$strip>>;
325
- type: z.ZodLiteral<"reasoning-end">;
326
- }, z.core.$strip>;
327
- export declare const AgentCheckpointEventSchema: z.ZodObject<{
328
- conversationId: z.ZodString;
329
- runId: z.ZodString;
330
- emittedAt: z.ZodISODateTime;
331
- type: z.ZodLiteral<"assistant-checkpoint">;
332
- eventId: z.ZodString;
333
- snapshotVersion: z.ZodInt;
334
- message: z.ZodObject<{
335
- schemaVersion: z.ZodLiteral<1>;
336
- id: z.ZodString;
337
- conversationId: z.ZodString;
338
- runId: z.ZodOptional<z.ZodString>;
339
- role: z.ZodEnum<{
340
- assistant: "assistant";
341
- summary: "summary";
342
- system: "system";
343
- user: "user";
344
- }>;
345
- status: z.ZodEnum<{
346
- committed: "committed";
347
- completed: "completed";
348
- failed: "failed";
349
- interrupted: "interrupted";
350
- streaming: "streaming";
351
- superseded: "superseded";
352
- }>;
353
- parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
354
- type: z.ZodLiteral<"text">;
355
- text: z.ZodString;
356
- }, z.core.$strip>, z.ZodObject<{
357
- type: z.ZodLiteral<"reasoning">;
358
- text: z.ZodString;
359
- provider: z.ZodOptional<z.ZodObject<{
360
- schemaVersion: z.ZodInt;
361
- provider: z.ZodString;
362
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
363
- }, z.core.$strip>>;
364
- }, z.core.$strip>, z.ZodObject<{
365
- type: z.ZodLiteral<"file">;
366
- mediaType: z.ZodString;
367
- reference: z.ZodString;
368
- filename: z.ZodOptional<z.ZodString>;
369
- }, z.core.$strip>, z.ZodObject<{
370
- type: z.ZodLiteral<"source">;
371
- sourceId: z.ZodString;
372
- url: z.ZodOptional<z.ZodURL>;
373
- title: z.ZodOptional<z.ZodString>;
374
- }, z.core.$strip>, z.ZodObject<{
375
- type: z.ZodLiteral<"tool-call">;
376
- callId: z.ZodString;
377
- toolName: z.ZodString;
378
- input: z.ZodJSONSchema;
379
- provider: z.ZodOptional<z.ZodObject<{
380
- schemaVersion: z.ZodInt;
381
- provider: z.ZodString;
382
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
383
- }, z.core.$strip>>;
384
- }, z.core.$strip>, z.ZodObject<{
385
- type: z.ZodLiteral<"tool-result">;
386
- callId: z.ZodString;
387
- toolName: z.ZodString;
388
- outcome: z.ZodEnum<{
389
- error: "error";
390
- interrupted: "interrupted";
391
- success: "success";
392
- }>;
393
- output: z.ZodOptional<z.ZodJSONSchema>;
394
- }, z.core.$strip>, z.ZodObject<{
395
- type: z.ZodLiteral<"provider">;
396
- envelope: z.ZodObject<{
397
- schemaVersion: z.ZodInt;
398
- provider: z.ZodString;
399
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
400
- }, z.core.$strip>;
401
- }, z.core.$strip>, z.ZodObject<{
402
- type: z.ZodLiteral<"control">;
403
- reason: z.ZodEnum<{
404
- "run-interrupted": "run-interrupted";
405
- "stale-run": "stale-run";
406
- }>;
407
- }, z.core.$strip>], "type">>;
408
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
409
- createdAt: z.ZodISODateTime;
410
- updatedAt: z.ZodISODateTime;
411
- }, z.core.$strip>;
412
- metrics: z.ZodOptional<z.ZodObject<{
413
- partial: z.ZodBoolean;
414
- usage: z.ZodObject<{
415
- inputTokens: z.ZodObject<{
416
- value: z.ZodOptional<z.ZodInt>;
417
- provenance: z.ZodEnum<{
418
- computed: "computed";
419
- estimated: "estimated";
420
- "provider-reported": "provider-reported";
421
- unavailable: "unavailable";
422
- }>;
423
- }, z.core.$strip>;
424
- outputTokens: z.ZodObject<{
425
- value: z.ZodOptional<z.ZodInt>;
426
- provenance: z.ZodEnum<{
427
- computed: "computed";
428
- estimated: "estimated";
429
- "provider-reported": "provider-reported";
430
- unavailable: "unavailable";
431
- }>;
432
- }, z.core.$strip>;
433
- reasoningTokens: z.ZodOptional<z.ZodObject<{
434
- value: z.ZodOptional<z.ZodInt>;
435
- provenance: z.ZodEnum<{
436
- computed: "computed";
437
- estimated: "estimated";
438
- "provider-reported": "provider-reported";
439
- unavailable: "unavailable";
440
- }>;
441
- }, z.core.$strip>>;
442
- cacheReadTokens: z.ZodOptional<z.ZodObject<{
443
- value: z.ZodOptional<z.ZodInt>;
444
- provenance: z.ZodEnum<{
445
- computed: "computed";
446
- estimated: "estimated";
447
- "provider-reported": "provider-reported";
448
- unavailable: "unavailable";
449
- }>;
450
- }, z.core.$strip>>;
451
- cacheWriteTokens: z.ZodOptional<z.ZodObject<{
452
- value: z.ZodOptional<z.ZodInt>;
453
- provenance: z.ZodEnum<{
454
- computed: "computed";
455
- estimated: "estimated";
456
- "provider-reported": "provider-reported";
457
- unavailable: "unavailable";
458
- }>;
459
- }, z.core.$strip>>;
460
- cost: z.ZodOptional<z.ZodObject<{
461
- value: z.ZodOptional<z.ZodNumber>;
462
- currency: z.ZodOptional<z.ZodString>;
463
- provenance: z.ZodEnum<{
464
- computed: "computed";
465
- estimated: "estimated";
466
- "provider-reported": "provider-reported";
467
- unavailable: "unavailable";
468
- }>;
469
- }, z.core.$strip>>;
470
- }, z.core.$strip>;
471
- durationMs: z.ZodOptional<z.ZodNumber>;
472
- ttftMs: z.ZodOptional<z.ZodNumber>;
473
- }, z.core.$strip>>;
474
- }, z.core.$strip>;
475
- export declare const AgentRunStateEventSchema: z.ZodObject<{
476
- conversationId: z.ZodString;
477
- runId: z.ZodString;
478
- emittedAt: z.ZodISODateTime;
479
- type: z.ZodLiteral<"run-state">;
480
- eventId: z.ZodString;
481
- snapshotVersion: z.ZodInt;
482
- state: z.ZodEnum<{
483
- abandoned: "abandoned";
484
- cancelled: "cancelled";
485
- completed: "completed";
486
- failed: "failed";
487
- interrupt_requested: "interrupt_requested";
488
- interrupted: "interrupted";
489
- queued: "queued";
490
- running: "running";
491
- superseded: "superseded";
492
- }>;
493
- }, z.core.$strip>;
494
- export declare const AgentToolStatusEventSchema: z.ZodObject<{
495
- conversationId: z.ZodString;
496
- runId: z.ZodString;
497
- emittedAt: z.ZodISODateTime;
498
- type: z.ZodLiteral<"tool-status">;
499
- runtimeEpoch: z.ZodString;
500
- sequence: z.ZodInt;
501
- callId: z.ZodString;
502
- toolName: z.ZodString;
503
- status: z.ZodEnum<{
504
- completed: "completed";
505
- failed: "failed";
506
- interrupted: "interrupted";
507
- started: "started";
508
- }>;
509
- input: z.ZodOptional<z.ZodJSONSchema>;
510
- output: z.ZodOptional<z.ZodJSONSchema>;
511
- }, z.core.$strip>;
512
- export declare const AgentTerminalEventSchema: z.ZodObject<{
513
- conversationId: z.ZodString;
514
- runId: z.ZodString;
515
- emittedAt: z.ZodISODateTime;
516
- type: z.ZodLiteral<"terminal">;
517
- eventId: z.ZodString;
518
- snapshotVersion: z.ZodInt;
519
- reason: z.ZodEnum<{
520
- abandoned: "abandoned";
521
- absorbed: "absorbed";
522
- cancelled: "cancelled";
523
- context_overflow: "context_overflow";
524
- interrupted: "interrupted";
525
- policy_stop: "policy_stop";
526
- provider_failure: "provider_failure";
527
- provider_stop: "provider_stop";
528
- shutdown: "shutdown";
529
- success: "success";
530
- superseded: "superseded";
531
- timeout: "timeout";
532
- }>;
533
- policyName: z.ZodOptional<z.ZodString>;
534
- message: z.ZodObject<{
535
- schemaVersion: z.ZodLiteral<1>;
536
- id: z.ZodString;
537
- conversationId: z.ZodString;
538
- runId: z.ZodOptional<z.ZodString>;
539
- role: z.ZodEnum<{
540
- assistant: "assistant";
541
- summary: "summary";
542
- system: "system";
543
- user: "user";
544
- }>;
545
- status: z.ZodEnum<{
546
- committed: "committed";
547
- completed: "completed";
548
- failed: "failed";
549
- interrupted: "interrupted";
550
- streaming: "streaming";
551
- superseded: "superseded";
552
- }>;
553
- parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
554
- type: z.ZodLiteral<"text">;
555
- text: z.ZodString;
556
- }, z.core.$strip>, z.ZodObject<{
557
- type: z.ZodLiteral<"reasoning">;
558
- text: z.ZodString;
559
- provider: z.ZodOptional<z.ZodObject<{
560
- schemaVersion: z.ZodInt;
561
- provider: z.ZodString;
562
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
563
- }, z.core.$strip>>;
564
- }, z.core.$strip>, z.ZodObject<{
565
- type: z.ZodLiteral<"file">;
566
- mediaType: z.ZodString;
567
- reference: z.ZodString;
568
- filename: z.ZodOptional<z.ZodString>;
569
- }, z.core.$strip>, z.ZodObject<{
570
- type: z.ZodLiteral<"source">;
571
- sourceId: z.ZodString;
572
- url: z.ZodOptional<z.ZodURL>;
573
- title: z.ZodOptional<z.ZodString>;
574
- }, z.core.$strip>, z.ZodObject<{
575
- type: z.ZodLiteral<"tool-call">;
576
- callId: z.ZodString;
577
- toolName: z.ZodString;
578
- input: z.ZodJSONSchema;
579
- provider: z.ZodOptional<z.ZodObject<{
580
- schemaVersion: z.ZodInt;
581
- provider: z.ZodString;
582
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
583
- }, z.core.$strip>>;
584
- }, z.core.$strip>, z.ZodObject<{
585
- type: z.ZodLiteral<"tool-result">;
586
- callId: z.ZodString;
587
- toolName: z.ZodString;
588
- outcome: z.ZodEnum<{
589
- error: "error";
590
- interrupted: "interrupted";
591
- success: "success";
592
- }>;
593
- output: z.ZodOptional<z.ZodJSONSchema>;
594
- }, z.core.$strip>, z.ZodObject<{
595
- type: z.ZodLiteral<"provider">;
596
- envelope: z.ZodObject<{
597
- schemaVersion: z.ZodInt;
598
- provider: z.ZodString;
599
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
600
- }, z.core.$strip>;
601
- }, z.core.$strip>, z.ZodObject<{
602
- type: z.ZodLiteral<"control">;
603
- reason: z.ZodEnum<{
604
- "run-interrupted": "run-interrupted";
605
- "stale-run": "stale-run";
606
- }>;
607
- }, z.core.$strip>], "type">>;
608
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
609
- createdAt: z.ZodISODateTime;
610
- updatedAt: z.ZodISODateTime;
611
- }, z.core.$strip>;
612
- metrics: z.ZodOptional<z.ZodObject<{
613
- partial: z.ZodBoolean;
614
- usage: z.ZodObject<{
615
- inputTokens: z.ZodObject<{
616
- value: z.ZodOptional<z.ZodInt>;
617
- provenance: z.ZodEnum<{
618
- computed: "computed";
619
- estimated: "estimated";
620
- "provider-reported": "provider-reported";
621
- unavailable: "unavailable";
622
- }>;
623
- }, z.core.$strip>;
624
- outputTokens: z.ZodObject<{
625
- value: z.ZodOptional<z.ZodInt>;
626
- provenance: z.ZodEnum<{
627
- computed: "computed";
628
- estimated: "estimated";
629
- "provider-reported": "provider-reported";
630
- unavailable: "unavailable";
631
- }>;
632
- }, z.core.$strip>;
633
- reasoningTokens: z.ZodOptional<z.ZodObject<{
634
- value: z.ZodOptional<z.ZodInt>;
635
- provenance: z.ZodEnum<{
636
- computed: "computed";
637
- estimated: "estimated";
638
- "provider-reported": "provider-reported";
639
- unavailable: "unavailable";
640
- }>;
641
- }, z.core.$strip>>;
642
- cacheReadTokens: z.ZodOptional<z.ZodObject<{
643
- value: z.ZodOptional<z.ZodInt>;
644
- provenance: z.ZodEnum<{
645
- computed: "computed";
646
- estimated: "estimated";
647
- "provider-reported": "provider-reported";
648
- unavailable: "unavailable";
649
- }>;
650
- }, z.core.$strip>>;
651
- cacheWriteTokens: z.ZodOptional<z.ZodObject<{
652
- value: z.ZodOptional<z.ZodInt>;
653
- provenance: z.ZodEnum<{
654
- computed: "computed";
655
- estimated: "estimated";
656
- "provider-reported": "provider-reported";
657
- unavailable: "unavailable";
658
- }>;
659
- }, z.core.$strip>>;
660
- cost: z.ZodOptional<z.ZodObject<{
661
- value: z.ZodOptional<z.ZodNumber>;
662
- currency: z.ZodOptional<z.ZodString>;
663
- provenance: z.ZodEnum<{
664
- computed: "computed";
665
- estimated: "estimated";
666
- "provider-reported": "provider-reported";
667
- unavailable: "unavailable";
668
- }>;
669
- }, z.core.$strip>>;
670
- }, z.core.$strip>;
671
- durationMs: z.ZodOptional<z.ZodNumber>;
672
- ttftMs: z.ZodOptional<z.ZodNumber>;
673
- }, z.core.$strip>>;
674
- }, z.core.$strip>;
675
- export declare const AgentRuntimeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
676
- type: z.ZodLiteral<"admission">;
677
- eventId: z.ZodString;
678
- conversationId: z.ZodString;
679
- runId: z.ZodString;
680
- snapshotVersion: z.ZodInt;
681
- input: z.ZodObject<{
682
- schemaVersion: z.ZodLiteral<1>;
683
- id: z.ZodString;
684
- conversationId: z.ZodString;
685
- runId: z.ZodOptional<z.ZodString>;
686
- role: z.ZodEnum<{
687
- assistant: "assistant";
688
- summary: "summary";
689
- system: "system";
690
- user: "user";
691
- }>;
692
- status: z.ZodEnum<{
693
- committed: "committed";
694
- completed: "completed";
695
- failed: "failed";
696
- interrupted: "interrupted";
697
- streaming: "streaming";
698
- superseded: "superseded";
699
- }>;
700
- parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
701
- type: z.ZodLiteral<"text">;
702
- text: z.ZodString;
703
- }, z.core.$strip>, z.ZodObject<{
704
- type: z.ZodLiteral<"reasoning">;
705
- text: z.ZodString;
706
- provider: z.ZodOptional<z.ZodObject<{
707
- schemaVersion: z.ZodInt;
708
- provider: z.ZodString;
709
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
710
- }, z.core.$strip>>;
711
- }, z.core.$strip>, z.ZodObject<{
712
- type: z.ZodLiteral<"file">;
713
- mediaType: z.ZodString;
714
- reference: z.ZodString;
715
- filename: z.ZodOptional<z.ZodString>;
716
- }, z.core.$strip>, z.ZodObject<{
717
- type: z.ZodLiteral<"source">;
718
- sourceId: z.ZodString;
719
- url: z.ZodOptional<z.ZodURL>;
720
- title: z.ZodOptional<z.ZodString>;
721
- }, z.core.$strip>, z.ZodObject<{
722
- type: z.ZodLiteral<"tool-call">;
723
- callId: z.ZodString;
724
- toolName: z.ZodString;
725
- input: z.ZodJSONSchema;
726
- provider: z.ZodOptional<z.ZodObject<{
727
- schemaVersion: z.ZodInt;
728
- provider: z.ZodString;
729
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
730
- }, z.core.$strip>>;
731
- }, z.core.$strip>, z.ZodObject<{
732
- type: z.ZodLiteral<"tool-result">;
733
- callId: z.ZodString;
734
- toolName: z.ZodString;
735
- outcome: z.ZodEnum<{
736
- error: "error";
737
- interrupted: "interrupted";
738
- success: "success";
739
- }>;
740
- output: z.ZodOptional<z.ZodJSONSchema>;
741
- }, z.core.$strip>, z.ZodObject<{
742
- type: z.ZodLiteral<"provider">;
743
- envelope: z.ZodObject<{
744
- schemaVersion: z.ZodInt;
745
- provider: z.ZodString;
746
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
747
- }, z.core.$strip>;
748
- }, z.core.$strip>, z.ZodObject<{
749
- type: z.ZodLiteral<"control">;
750
- reason: z.ZodEnum<{
751
- "run-interrupted": "run-interrupted";
752
- "stale-run": "stale-run";
753
- }>;
754
- }, z.core.$strip>], "type">>;
755
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
756
- createdAt: z.ZodISODateTime;
757
- updatedAt: z.ZodISODateTime;
758
- }, z.core.$strip>;
759
- run: z.ZodObject<{
760
- schemaVersion: z.ZodLiteral<1>;
761
- id: z.ZodString;
762
- conversationId: z.ZodString;
763
- inputMessageIds: z.ZodArray<z.ZodString>;
764
- assistantMessageId: z.ZodString;
765
- state: z.ZodEnum<{
766
- abandoned: "abandoned";
767
- cancelled: "cancelled";
768
- completed: "completed";
769
- failed: "failed";
770
- interrupt_requested: "interrupt_requested";
771
- interrupted: "interrupted";
772
- queued: "queued";
773
- running: "running";
774
- superseded: "superseded";
775
- }>;
776
- revision: z.ZodInt;
777
- ownerId: z.ZodOptional<z.ZodString>;
778
- fencingToken: z.ZodOptional<z.ZodInt>;
779
- terminalReason: z.ZodOptional<z.ZodEnum<{
780
- abandoned: "abandoned";
781
- absorbed: "absorbed";
782
- cancelled: "cancelled";
783
- context_overflow: "context_overflow";
784
- interrupted: "interrupted";
785
- policy_stop: "policy_stop";
786
- provider_failure: "provider_failure";
787
- provider_stop: "provider_stop";
788
- shutdown: "shutdown";
789
- success: "success";
790
- superseded: "superseded";
791
- timeout: "timeout";
792
- }>>;
793
- terminalPolicyName: z.ZodOptional<z.ZodString>;
794
- absorbedIntoRunId: z.ZodOptional<z.ZodString>;
795
- usage: z.ZodOptional<z.ZodObject<{
796
- inputTokens: z.ZodObject<{
797
- value: z.ZodOptional<z.ZodInt>;
798
- provenance: z.ZodEnum<{
799
- computed: "computed";
800
- estimated: "estimated";
801
- "provider-reported": "provider-reported";
802
- unavailable: "unavailable";
803
- }>;
804
- }, z.core.$strip>;
805
- outputTokens: z.ZodObject<{
806
- value: z.ZodOptional<z.ZodInt>;
807
- provenance: z.ZodEnum<{
808
- computed: "computed";
809
- estimated: "estimated";
810
- "provider-reported": "provider-reported";
811
- unavailable: "unavailable";
812
- }>;
813
- }, z.core.$strip>;
814
- reasoningTokens: z.ZodOptional<z.ZodObject<{
815
- value: z.ZodOptional<z.ZodInt>;
816
- provenance: z.ZodEnum<{
817
- computed: "computed";
818
- estimated: "estimated";
819
- "provider-reported": "provider-reported";
820
- unavailable: "unavailable";
821
- }>;
822
- }, z.core.$strip>>;
823
- cacheReadTokens: z.ZodOptional<z.ZodObject<{
824
- value: z.ZodOptional<z.ZodInt>;
825
- provenance: z.ZodEnum<{
826
- computed: "computed";
827
- estimated: "estimated";
828
- "provider-reported": "provider-reported";
829
- unavailable: "unavailable";
830
- }>;
831
- }, z.core.$strip>>;
832
- cacheWriteTokens: z.ZodOptional<z.ZodObject<{
833
- value: z.ZodOptional<z.ZodInt>;
834
- provenance: z.ZodEnum<{
835
- computed: "computed";
836
- estimated: "estimated";
837
- "provider-reported": "provider-reported";
838
- unavailable: "unavailable";
839
- }>;
840
- }, z.core.$strip>>;
841
- cost: z.ZodOptional<z.ZodObject<{
842
- value: z.ZodOptional<z.ZodNumber>;
843
- currency: z.ZodOptional<z.ZodString>;
844
- provenance: z.ZodEnum<{
845
- computed: "computed";
846
- estimated: "estimated";
847
- "provider-reported": "provider-reported";
848
- unavailable: "unavailable";
849
- }>;
850
- }, z.core.$strip>>;
851
- }, z.core.$strip>>;
852
- createdAt: z.ZodISODateTime;
853
- updatedAt: z.ZodISODateTime;
854
- }, z.core.$strip>;
855
- assistant: z.ZodUnion<readonly [z.ZodObject<{
856
- schemaVersion: z.ZodLiteral<1>;
857
- id: z.ZodString;
858
- conversationId: z.ZodString;
859
- runId: z.ZodString;
860
- status: z.ZodLiteral<"pending">;
861
- createdAt: z.ZodISODateTime;
862
- updatedAt: z.ZodISODateTime;
863
- }, z.core.$strip>, z.ZodObject<{
864
- schemaVersion: z.ZodLiteral<1>;
865
- id: z.ZodString;
866
- conversationId: z.ZodString;
867
- runId: z.ZodOptional<z.ZodString>;
868
- role: z.ZodEnum<{
869
- assistant: "assistant";
870
- summary: "summary";
871
- system: "system";
872
- user: "user";
873
- }>;
874
- status: z.ZodEnum<{
875
- committed: "committed";
876
- completed: "completed";
877
- failed: "failed";
878
- interrupted: "interrupted";
879
- streaming: "streaming";
880
- superseded: "superseded";
881
- }>;
882
- parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
883
- type: z.ZodLiteral<"text">;
884
- text: z.ZodString;
885
- }, z.core.$strip>, z.ZodObject<{
886
- type: z.ZodLiteral<"reasoning">;
887
- text: z.ZodString;
888
- provider: z.ZodOptional<z.ZodObject<{
889
- schemaVersion: z.ZodInt;
890
- provider: z.ZodString;
891
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
892
- }, z.core.$strip>>;
893
- }, z.core.$strip>, z.ZodObject<{
894
- type: z.ZodLiteral<"file">;
895
- mediaType: z.ZodString;
896
- reference: z.ZodString;
897
- filename: z.ZodOptional<z.ZodString>;
898
- }, z.core.$strip>, z.ZodObject<{
899
- type: z.ZodLiteral<"source">;
900
- sourceId: z.ZodString;
901
- url: z.ZodOptional<z.ZodURL>;
902
- title: z.ZodOptional<z.ZodString>;
903
- }, z.core.$strip>, z.ZodObject<{
904
- type: z.ZodLiteral<"tool-call">;
905
- callId: z.ZodString;
906
- toolName: z.ZodString;
907
- input: z.ZodJSONSchema;
908
- provider: z.ZodOptional<z.ZodObject<{
909
- schemaVersion: z.ZodInt;
910
- provider: z.ZodString;
911
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
912
- }, z.core.$strip>>;
913
- }, z.core.$strip>, z.ZodObject<{
914
- type: z.ZodLiteral<"tool-result">;
915
- callId: z.ZodString;
916
- toolName: z.ZodString;
917
- outcome: z.ZodEnum<{
918
- error: "error";
919
- interrupted: "interrupted";
920
- success: "success";
921
- }>;
922
- output: z.ZodOptional<z.ZodJSONSchema>;
923
- }, z.core.$strip>, z.ZodObject<{
924
- type: z.ZodLiteral<"provider">;
925
- envelope: z.ZodObject<{
926
- schemaVersion: z.ZodInt;
927
- provider: z.ZodString;
928
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
929
- }, z.core.$strip>;
930
- }, z.core.$strip>, z.ZodObject<{
931
- type: z.ZodLiteral<"control">;
932
- reason: z.ZodEnum<{
933
- "run-interrupted": "run-interrupted";
934
- "stale-run": "stale-run";
935
- }>;
936
- }, z.core.$strip>], "type">>;
937
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
938
- createdAt: z.ZodISODateTime;
939
- updatedAt: z.ZodISODateTime;
940
- }, z.core.$strip>]>;
941
- emittedAt: z.ZodISODateTime;
942
- }, z.core.$strip>, z.ZodObject<{
943
- conversationId: z.ZodString;
944
- runId: z.ZodString;
945
- emittedAt: z.ZodISODateTime;
946
- type: z.ZodLiteral<"assistant-delta">;
947
- runtimeEpoch: z.ZodString;
948
- sequence: z.ZodInt;
949
- textDelta: z.ZodString;
950
- }, z.core.$strip>, z.ZodObject<{
951
- conversationId: z.ZodString;
952
- runId: z.ZodString;
953
- emittedAt: z.ZodISODateTime;
954
- runtimeEpoch: z.ZodString;
955
- sequence: z.ZodInt;
956
- provider: z.ZodOptional<z.ZodObject<{
957
- schemaVersion: z.ZodInt;
958
- provider: z.ZodString;
959
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
960
- }, z.core.$strip>>;
961
- type: z.ZodLiteral<"reasoning-start">;
962
- }, z.core.$strip>, z.ZodObject<{
963
- conversationId: z.ZodString;
964
- runId: z.ZodString;
965
- emittedAt: z.ZodISODateTime;
966
- runtimeEpoch: z.ZodString;
967
- sequence: z.ZodInt;
968
- provider: z.ZodOptional<z.ZodObject<{
969
- schemaVersion: z.ZodInt;
970
- provider: z.ZodString;
971
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
972
- }, z.core.$strip>>;
973
- type: z.ZodLiteral<"reasoning-delta">;
974
- textDelta: z.ZodString;
975
- }, z.core.$strip>, z.ZodObject<{
976
- conversationId: z.ZodString;
977
- runId: z.ZodString;
978
- emittedAt: z.ZodISODateTime;
979
- runtimeEpoch: z.ZodString;
980
- sequence: z.ZodInt;
981
- provider: z.ZodOptional<z.ZodObject<{
982
- schemaVersion: z.ZodInt;
983
- provider: z.ZodString;
984
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
985
- }, z.core.$strip>>;
986
- type: z.ZodLiteral<"reasoning-end">;
987
- }, z.core.$strip>, z.ZodObject<{
988
- conversationId: z.ZodString;
989
- runId: z.ZodString;
990
- emittedAt: z.ZodISODateTime;
991
- type: z.ZodLiteral<"assistant-checkpoint">;
992
- eventId: z.ZodString;
993
- snapshotVersion: z.ZodInt;
994
- message: z.ZodObject<{
995
- schemaVersion: z.ZodLiteral<1>;
996
- id: z.ZodString;
997
- conversationId: z.ZodString;
998
- runId: z.ZodOptional<z.ZodString>;
999
- role: z.ZodEnum<{
1000
- assistant: "assistant";
1001
- summary: "summary";
1002
- system: "system";
1003
- user: "user";
1004
- }>;
1005
- status: z.ZodEnum<{
1006
- committed: "committed";
1007
- completed: "completed";
1008
- failed: "failed";
1009
- interrupted: "interrupted";
1010
- streaming: "streaming";
1011
- superseded: "superseded";
1012
- }>;
1013
- parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1014
- type: z.ZodLiteral<"text">;
1015
- text: z.ZodString;
1016
- }, z.core.$strip>, z.ZodObject<{
1017
- type: z.ZodLiteral<"reasoning">;
1018
- text: z.ZodString;
1019
- provider: z.ZodOptional<z.ZodObject<{
1020
- schemaVersion: z.ZodInt;
1021
- provider: z.ZodString;
1022
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1023
- }, z.core.$strip>>;
1024
- }, z.core.$strip>, z.ZodObject<{
1025
- type: z.ZodLiteral<"file">;
1026
- mediaType: z.ZodString;
1027
- reference: z.ZodString;
1028
- filename: z.ZodOptional<z.ZodString>;
1029
- }, z.core.$strip>, z.ZodObject<{
1030
- type: z.ZodLiteral<"source">;
1031
- sourceId: z.ZodString;
1032
- url: z.ZodOptional<z.ZodURL>;
1033
- title: z.ZodOptional<z.ZodString>;
1034
- }, z.core.$strip>, z.ZodObject<{
1035
- type: z.ZodLiteral<"tool-call">;
1036
- callId: z.ZodString;
1037
- toolName: z.ZodString;
1038
- input: z.ZodJSONSchema;
1039
- provider: z.ZodOptional<z.ZodObject<{
1040
- schemaVersion: z.ZodInt;
1041
- provider: z.ZodString;
1042
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1043
- }, z.core.$strip>>;
1044
- }, z.core.$strip>, z.ZodObject<{
1045
- type: z.ZodLiteral<"tool-result">;
1046
- callId: z.ZodString;
1047
- toolName: z.ZodString;
1048
- outcome: z.ZodEnum<{
1049
- error: "error";
1050
- interrupted: "interrupted";
1051
- success: "success";
1052
- }>;
1053
- output: z.ZodOptional<z.ZodJSONSchema>;
1054
- }, z.core.$strip>, z.ZodObject<{
1055
- type: z.ZodLiteral<"provider">;
1056
- envelope: z.ZodObject<{
1057
- schemaVersion: z.ZodInt;
1058
- provider: z.ZodString;
1059
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1060
- }, z.core.$strip>;
1061
- }, z.core.$strip>, z.ZodObject<{
1062
- type: z.ZodLiteral<"control">;
1063
- reason: z.ZodEnum<{
1064
- "run-interrupted": "run-interrupted";
1065
- "stale-run": "stale-run";
1066
- }>;
1067
- }, z.core.$strip>], "type">>;
1068
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
1069
- createdAt: z.ZodISODateTime;
1070
- updatedAt: z.ZodISODateTime;
1071
- }, z.core.$strip>;
1072
- metrics: z.ZodOptional<z.ZodObject<{
1073
- partial: z.ZodBoolean;
1074
- usage: z.ZodObject<{
1075
- inputTokens: z.ZodObject<{
1076
- value: z.ZodOptional<z.ZodInt>;
1077
- provenance: z.ZodEnum<{
1078
- computed: "computed";
1079
- estimated: "estimated";
1080
- "provider-reported": "provider-reported";
1081
- unavailable: "unavailable";
1082
- }>;
1083
- }, z.core.$strip>;
1084
- outputTokens: z.ZodObject<{
1085
- value: z.ZodOptional<z.ZodInt>;
1086
- provenance: z.ZodEnum<{
1087
- computed: "computed";
1088
- estimated: "estimated";
1089
- "provider-reported": "provider-reported";
1090
- unavailable: "unavailable";
1091
- }>;
1092
- }, z.core.$strip>;
1093
- reasoningTokens: z.ZodOptional<z.ZodObject<{
1094
- value: z.ZodOptional<z.ZodInt>;
1095
- provenance: z.ZodEnum<{
1096
- computed: "computed";
1097
- estimated: "estimated";
1098
- "provider-reported": "provider-reported";
1099
- unavailable: "unavailable";
1100
- }>;
1101
- }, z.core.$strip>>;
1102
- cacheReadTokens: z.ZodOptional<z.ZodObject<{
1103
- value: z.ZodOptional<z.ZodInt>;
1104
- provenance: z.ZodEnum<{
1105
- computed: "computed";
1106
- estimated: "estimated";
1107
- "provider-reported": "provider-reported";
1108
- unavailable: "unavailable";
1109
- }>;
1110
- }, z.core.$strip>>;
1111
- cacheWriteTokens: z.ZodOptional<z.ZodObject<{
1112
- value: z.ZodOptional<z.ZodInt>;
1113
- provenance: z.ZodEnum<{
1114
- computed: "computed";
1115
- estimated: "estimated";
1116
- "provider-reported": "provider-reported";
1117
- unavailable: "unavailable";
1118
- }>;
1119
- }, z.core.$strip>>;
1120
- cost: z.ZodOptional<z.ZodObject<{
1121
- value: z.ZodOptional<z.ZodNumber>;
1122
- currency: z.ZodOptional<z.ZodString>;
1123
- provenance: z.ZodEnum<{
1124
- computed: "computed";
1125
- estimated: "estimated";
1126
- "provider-reported": "provider-reported";
1127
- unavailable: "unavailable";
1128
- }>;
1129
- }, z.core.$strip>>;
1130
- }, z.core.$strip>;
1131
- durationMs: z.ZodOptional<z.ZodNumber>;
1132
- ttftMs: z.ZodOptional<z.ZodNumber>;
1133
- }, z.core.$strip>>;
1134
- }, z.core.$strip>, z.ZodObject<{
1135
- conversationId: z.ZodString;
1136
- runId: z.ZodString;
1137
- emittedAt: z.ZodISODateTime;
1138
- type: z.ZodLiteral<"run-state">;
1139
- eventId: z.ZodString;
1140
- snapshotVersion: z.ZodInt;
1141
- state: z.ZodEnum<{
1142
- abandoned: "abandoned";
1143
- cancelled: "cancelled";
1144
- completed: "completed";
1145
- failed: "failed";
1146
- interrupt_requested: "interrupt_requested";
1147
- interrupted: "interrupted";
1148
- queued: "queued";
1149
- running: "running";
1150
- superseded: "superseded";
1151
- }>;
1152
- }, z.core.$strip>, z.ZodObject<{
1153
- conversationId: z.ZodString;
1154
- runId: z.ZodString;
1155
- emittedAt: z.ZodISODateTime;
1156
- type: z.ZodLiteral<"tool-status">;
1157
- runtimeEpoch: z.ZodString;
1158
- sequence: z.ZodInt;
1159
- callId: z.ZodString;
1160
- toolName: z.ZodString;
1161
- status: z.ZodEnum<{
1162
- completed: "completed";
1163
- failed: "failed";
1164
- interrupted: "interrupted";
1165
- started: "started";
1166
- }>;
1167
- input: z.ZodOptional<z.ZodJSONSchema>;
1168
- output: z.ZodOptional<z.ZodJSONSchema>;
1169
- }, z.core.$strip>, z.ZodObject<{
1170
- conversationId: z.ZodString;
1171
- runId: z.ZodString;
1172
- emittedAt: z.ZodISODateTime;
1173
- type: z.ZodLiteral<"terminal">;
1174
- eventId: z.ZodString;
1175
- snapshotVersion: z.ZodInt;
1176
- reason: z.ZodEnum<{
1177
- abandoned: "abandoned";
1178
- absorbed: "absorbed";
1179
- cancelled: "cancelled";
1180
- context_overflow: "context_overflow";
1181
- interrupted: "interrupted";
1182
- policy_stop: "policy_stop";
1183
- provider_failure: "provider_failure";
1184
- provider_stop: "provider_stop";
1185
- shutdown: "shutdown";
1186
- success: "success";
1187
- superseded: "superseded";
1188
- timeout: "timeout";
1189
- }>;
1190
- policyName: z.ZodOptional<z.ZodString>;
1191
- message: z.ZodObject<{
1192
- schemaVersion: z.ZodLiteral<1>;
1193
- id: z.ZodString;
1194
- conversationId: z.ZodString;
1195
- runId: z.ZodOptional<z.ZodString>;
1196
- role: z.ZodEnum<{
1197
- assistant: "assistant";
1198
- summary: "summary";
1199
- system: "system";
1200
- user: "user";
1201
- }>;
1202
- status: z.ZodEnum<{
1203
- committed: "committed";
1204
- completed: "completed";
1205
- failed: "failed";
1206
- interrupted: "interrupted";
1207
- streaming: "streaming";
1208
- superseded: "superseded";
1209
- }>;
1210
- parts: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1211
- type: z.ZodLiteral<"text">;
1212
- text: z.ZodString;
1213
- }, z.core.$strip>, z.ZodObject<{
1214
- type: z.ZodLiteral<"reasoning">;
1215
- text: z.ZodString;
1216
- provider: z.ZodOptional<z.ZodObject<{
1217
- schemaVersion: z.ZodInt;
1218
- provider: z.ZodString;
1219
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1220
- }, z.core.$strip>>;
1221
- }, z.core.$strip>, z.ZodObject<{
1222
- type: z.ZodLiteral<"file">;
1223
- mediaType: z.ZodString;
1224
- reference: z.ZodString;
1225
- filename: z.ZodOptional<z.ZodString>;
1226
- }, z.core.$strip>, z.ZodObject<{
1227
- type: z.ZodLiteral<"source">;
1228
- sourceId: z.ZodString;
1229
- url: z.ZodOptional<z.ZodURL>;
1230
- title: z.ZodOptional<z.ZodString>;
1231
- }, z.core.$strip>, z.ZodObject<{
1232
- type: z.ZodLiteral<"tool-call">;
1233
- callId: z.ZodString;
1234
- toolName: z.ZodString;
1235
- input: z.ZodJSONSchema;
1236
- provider: z.ZodOptional<z.ZodObject<{
1237
- schemaVersion: z.ZodInt;
1238
- provider: z.ZodString;
1239
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1240
- }, z.core.$strip>>;
1241
- }, z.core.$strip>, z.ZodObject<{
1242
- type: z.ZodLiteral<"tool-result">;
1243
- callId: z.ZodString;
1244
- toolName: z.ZodString;
1245
- outcome: z.ZodEnum<{
1246
- error: "error";
1247
- interrupted: "interrupted";
1248
- success: "success";
1249
- }>;
1250
- output: z.ZodOptional<z.ZodJSONSchema>;
1251
- }, z.core.$strip>, z.ZodObject<{
1252
- type: z.ZodLiteral<"provider">;
1253
- envelope: z.ZodObject<{
1254
- schemaVersion: z.ZodInt;
1255
- provider: z.ZodString;
1256
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1257
- }, z.core.$strip>;
1258
- }, z.core.$strip>, z.ZodObject<{
1259
- type: z.ZodLiteral<"control">;
1260
- reason: z.ZodEnum<{
1261
- "run-interrupted": "run-interrupted";
1262
- "stale-run": "stale-run";
1263
- }>;
1264
- }, z.core.$strip>], "type">>;
1265
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
1266
- createdAt: z.ZodISODateTime;
1267
- updatedAt: z.ZodISODateTime;
1268
- }, z.core.$strip>;
1269
- metrics: z.ZodOptional<z.ZodObject<{
1270
- partial: z.ZodBoolean;
1271
- usage: z.ZodObject<{
1272
- inputTokens: z.ZodObject<{
1273
- value: z.ZodOptional<z.ZodInt>;
1274
- provenance: z.ZodEnum<{
1275
- computed: "computed";
1276
- estimated: "estimated";
1277
- "provider-reported": "provider-reported";
1278
- unavailable: "unavailable";
1279
- }>;
1280
- }, z.core.$strip>;
1281
- outputTokens: z.ZodObject<{
1282
- value: z.ZodOptional<z.ZodInt>;
1283
- provenance: z.ZodEnum<{
1284
- computed: "computed";
1285
- estimated: "estimated";
1286
- "provider-reported": "provider-reported";
1287
- unavailable: "unavailable";
1288
- }>;
1289
- }, z.core.$strip>;
1290
- reasoningTokens: z.ZodOptional<z.ZodObject<{
1291
- value: z.ZodOptional<z.ZodInt>;
1292
- provenance: z.ZodEnum<{
1293
- computed: "computed";
1294
- estimated: "estimated";
1295
- "provider-reported": "provider-reported";
1296
- unavailable: "unavailable";
1297
- }>;
1298
- }, z.core.$strip>>;
1299
- cacheReadTokens: z.ZodOptional<z.ZodObject<{
1300
- value: z.ZodOptional<z.ZodInt>;
1301
- provenance: z.ZodEnum<{
1302
- computed: "computed";
1303
- estimated: "estimated";
1304
- "provider-reported": "provider-reported";
1305
- unavailable: "unavailable";
1306
- }>;
1307
- }, z.core.$strip>>;
1308
- cacheWriteTokens: z.ZodOptional<z.ZodObject<{
1309
- value: z.ZodOptional<z.ZodInt>;
1310
- provenance: z.ZodEnum<{
1311
- computed: "computed";
1312
- estimated: "estimated";
1313
- "provider-reported": "provider-reported";
1314
- unavailable: "unavailable";
1315
- }>;
1316
- }, z.core.$strip>>;
1317
- cost: z.ZodOptional<z.ZodObject<{
1318
- value: z.ZodOptional<z.ZodNumber>;
1319
- currency: z.ZodOptional<z.ZodString>;
1320
- provenance: z.ZodEnum<{
1321
- computed: "computed";
1322
- estimated: "estimated";
1323
- "provider-reported": "provider-reported";
1324
- unavailable: "unavailable";
1325
- }>;
1326
- }, z.core.$strip>>;
1327
- }, z.core.$strip>;
1328
- durationMs: z.ZodOptional<z.ZodNumber>;
1329
- ttftMs: z.ZodOptional<z.ZodNumber>;
1330
- }, z.core.$strip>>;
1331
- }, z.core.$strip>], "type">;
1332
- export type AgentRuntimeEvent = z.infer<typeof AgentRuntimeEventSchema>;
1333
- export type AgentRuntimePublisher = (event: AgentRuntimeEvent) => void | Promise<void>;
1334
- export declare const AgentRuntimeEventCursorSchema: z.ZodObject<{
1335
- snapshotVersion: z.ZodOptional<z.ZodInt>;
1336
- durableEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1337
- runtimeEpoch: z.ZodOptional<z.ZodString>;
1338
- sequence: z.ZodOptional<z.ZodInt>;
1339
- }, z.core.$strip>;
1340
- export type AgentRuntimeEventCursor = z.infer<typeof AgentRuntimeEventCursorSchema>;
1341
- export interface AgentRuntimeCursorAdvance {
1342
- status: 'accepted' | 'duplicate' | 'gap';
1343
- cursor: AgentRuntimeEventCursor;
1344
- }
1345
- /** Detect duplicate or missing delivery so reconnect can reload the durable snapshot. */
1346
- export declare function advanceAgentRuntimeEventCursor(rawCursor: AgentRuntimeEventCursor, event: AgentRuntimeEvent): AgentRuntimeCursorAdvance;
2
+ import { type AgentRuntimeEvent, type AgentRuntimePublisher } from './event-schema.js';
3
+ export * from './event-schema.js';
1347
4
  export interface AgentRuntimeEventSinkConfig {
1348
5
  write(event: AgentRuntimeEvent): void | Promise<void>;
1349
6
  project?(event: AgentRuntimeEvent): AgentRuntimeEvent | undefined;
@@ -1366,6 +23,4 @@ export interface AgentRuntimeEventSink {
1366
23
  }
1367
24
  /** Bounded, failure-isolated transport-neutral delivery lifecycle. */
1368
25
  export declare function createAgentRuntimeEventSink(config: AgentRuntimeEventSinkConfig): AgentRuntimeEventSink;
1369
- /** Stable identity for a post-CAS event; safe for outbox/dedup keys. */
1370
- export declare function agentDurableEventId(type: 'admission' | 'assistant-checkpoint' | 'run-state' | 'terminal', runId: string, snapshotVersion: number): string;
1371
26
  //# sourceMappingURL=events.d.ts.map