@linnlabs/linnkit 0.8.0

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 (123) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/LICENSE +21 -0
  3. package/README.md +178 -0
  4. package/README.zh-CN.md +182 -0
  5. package/dist/agent-invocation-BHcNfrBV.d.cts +30 -0
  6. package/dist/agent-invocation-BznDaXDs.d.ts +30 -0
  7. package/dist/agentEvents-DEB7Fy_J.d.cts +81 -0
  8. package/dist/agentEvents-DEB7Fy_J.d.ts +81 -0
  9. package/dist/agentSpec-EkmviZjy.d.cts +2621 -0
  10. package/dist/agentSpec-EkmviZjy.d.ts +2621 -0
  11. package/dist/ai-engine.types-BpeU_XQG.d.cts +158 -0
  12. package/dist/ai-engine.types-vZRnQcJa.d.ts +158 -0
  13. package/dist/audit-BaRUGaqv.d.cts +307 -0
  14. package/dist/audit-BaRUGaqv.d.ts +307 -0
  15. package/dist/audit-CtcfART1.d.ts +33 -0
  16. package/dist/audit-LeOrm2hX.d.cts +33 -0
  17. package/dist/checkpointMarker-DAI3wUQu.d.cts +8 -0
  18. package/dist/checkpointMarker-DAI3wUQu.d.ts +8 -0
  19. package/dist/cli.cjs +8028 -0
  20. package/dist/cli.cjs.map +1 -0
  21. package/dist/cli.d.cts +4 -0
  22. package/dist/cli.d.ts +4 -0
  23. package/dist/cli.js +8025 -0
  24. package/dist/cli.js.map +1 -0
  25. package/dist/context-manager.cjs +8704 -0
  26. package/dist/context-manager.cjs.map +1 -0
  27. package/dist/context-manager.d.cts +2190 -0
  28. package/dist/context-manager.d.ts +2190 -0
  29. package/dist/context-manager.js +8650 -0
  30. package/dist/context-manager.js.map +1 -0
  31. package/dist/context-trace-DRi5M4lX.d.ts +239 -0
  32. package/dist/context-trace-HE2qY5Q-.d.cts +239 -0
  33. package/dist/contracts.cjs +1333 -0
  34. package/dist/contracts.cjs.map +1 -0
  35. package/dist/contracts.d.cts +8 -0
  36. package/dist/contracts.d.ts +8 -0
  37. package/dist/contracts.js +1214 -0
  38. package/dist/contracts.js.map +1 -0
  39. package/dist/defaultGraphExecutor-BBswR8wn.d.ts +624 -0
  40. package/dist/defaultGraphExecutor-BIjJj7WF.d.cts +624 -0
  41. package/dist/execution-CAIypb41.d.cts +129 -0
  42. package/dist/execution-CAIypb41.d.ts +129 -0
  43. package/dist/index-CHqwkvGp.d.ts +149 -0
  44. package/dist/index-CJeWHopy.d.ts +584 -0
  45. package/dist/index-Cm-JbzTH.d.cts +1450 -0
  46. package/dist/index-Cvr23YCl.d.cts +23 -0
  47. package/dist/index-DDzuSb0n.d.ts +23 -0
  48. package/dist/index-DO4dQgf2.d.cts +584 -0
  49. package/dist/index-DRBWi1fy.d.ts +1450 -0
  50. package/dist/index-Dl5PLgAv.d.cts +149 -0
  51. package/dist/index.cjs +9577 -0
  52. package/dist/index.cjs.map +1 -0
  53. package/dist/index.d.cts +89 -0
  54. package/dist/index.d.ts +89 -0
  55. package/dist/index.js +9563 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/messages-XthmnHZ3.d.cts +8007 -0
  58. package/dist/messages-XthmnHZ3.d.ts +8007 -0
  59. package/dist/ports-DaatKJXp.d.cts +90 -0
  60. package/dist/ports-DnLuKfpE.d.ts +90 -0
  61. package/dist/ports.cjs +4 -0
  62. package/dist/ports.cjs.map +1 -0
  63. package/dist/ports.d.cts +7 -0
  64. package/dist/ports.d.ts +7 -0
  65. package/dist/ports.js +3 -0
  66. package/dist/ports.js.map +1 -0
  67. package/dist/quickstart.cjs +7697 -0
  68. package/dist/quickstart.cjs.map +1 -0
  69. package/dist/quickstart.d.cts +24 -0
  70. package/dist/quickstart.d.ts +24 -0
  71. package/dist/quickstart.js +7691 -0
  72. package/dist/quickstart.js.map +1 -0
  73. package/dist/runAgent-CPj_9e58.d.ts +88 -0
  74. package/dist/runAgent-HYKlXbVr.d.cts +88 -0
  75. package/dist/runHandle-CyXvzgzk.d.ts +239 -0
  76. package/dist/runHandle-D3gPsD7B.d.cts +239 -0
  77. package/dist/runtime-kernel/events.cjs +1485 -0
  78. package/dist/runtime-kernel/events.cjs.map +1 -0
  79. package/dist/runtime-kernel/events.d.cts +8 -0
  80. package/dist/runtime-kernel/events.d.ts +8 -0
  81. package/dist/runtime-kernel/events.js +1475 -0
  82. package/dist/runtime-kernel/events.js.map +1 -0
  83. package/dist/runtime-kernel.cjs +8656 -0
  84. package/dist/runtime-kernel.cjs.map +1 -0
  85. package/dist/runtime-kernel.d.cts +19 -0
  86. package/dist/runtime-kernel.d.ts +19 -0
  87. package/dist/runtime-kernel.js +8568 -0
  88. package/dist/runtime-kernel.js.map +1 -0
  89. package/dist/sse-vPyrOPa0.d.cts +1687 -0
  90. package/dist/sse-vPyrOPa0.d.ts +1687 -0
  91. package/dist/testkit.cjs +10613 -0
  92. package/dist/testkit.cjs.map +1 -0
  93. package/dist/testkit.d.cts +284 -0
  94. package/dist/testkit.d.ts +284 -0
  95. package/dist/testkit.js +10593 -0
  96. package/dist/testkit.js.map +1 -0
  97. package/dist/todo-B1PmDlp3.d.cts +2253 -0
  98. package/dist/todo-B1PmDlp3.d.ts +2253 -0
  99. package/dist/tokenizer-DFL4I7-I.d.ts +28 -0
  100. package/dist/tokenizer-DH_JXv-H.d.cts +28 -0
  101. package/dist/toolContracts-Blll0241.d.ts +463 -0
  102. package/dist/toolContracts-CLkQmhTG.d.cts +463 -0
  103. package/docs/README.md +76 -0
  104. package/docs/integration/01-installation.md +94 -0
  105. package/docs/integration/02-quickstart.md +104 -0
  106. package/docs/integration/README.md +223 -0
  107. package/docs/integration/agent-registration-guide.md +330 -0
  108. package/docs/integration/audit.md +64 -0
  109. package/docs/integration/child-runs.md +87 -0
  110. package/docs/integration/constraints-and-pitfalls.md +87 -0
  111. package/docs/integration/context-engineering.md +650 -0
  112. package/docs/integration/context-fences.md +289 -0
  113. package/docs/integration/glossary.md +69 -0
  114. package/docs/integration/llm-provider.md +76 -0
  115. package/docs/integration/persistence.md +44 -0
  116. package/docs/integration/realtime.md +76 -0
  117. package/docs/integration/run-supervisor.md +69 -0
  118. package/docs/integration/telemetry.md +48 -0
  119. package/docs/integration/testing.md +95 -0
  120. package/docs/integration/tool-development-guide.md +362 -0
  121. package/docs/integration/tool-history.md +202 -0
  122. package/docs/integration/tools.md +188 -0
  123. package/package.json +115 -0
@@ -0,0 +1,1687 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const BaseSSEEvent: z.ZodObject<{
4
+ id: z.ZodString;
5
+ timestamp: z.ZodNumber;
6
+ conversation_id: z.ZodString;
7
+ turn_id: z.ZodString;
8
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ id: string;
11
+ timestamp: number;
12
+ conversation_id: string;
13
+ turn_id: string;
14
+ metadata?: Record<string, unknown> | undefined;
15
+ }, {
16
+ id: string;
17
+ timestamp: number;
18
+ conversation_id: string;
19
+ turn_id: string;
20
+ metadata?: Record<string, unknown> | undefined;
21
+ }>;
22
+ type BaseSSEEvent = z.infer<typeof BaseSSEEvent>;
23
+ declare const SSEThoughtEvent: z.ZodObject<{
24
+ id: z.ZodString;
25
+ timestamp: z.ZodNumber;
26
+ conversation_id: z.ZodString;
27
+ turn_id: z.ZodString;
28
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
29
+ } & {
30
+ type: z.ZodLiteral<"thought">;
31
+ thought_message_id: z.ZodOptional<z.ZodString>;
32
+ delta: z.ZodOptional<z.ZodString>;
33
+ content: z.ZodOptional<z.ZodString>;
34
+ is_complete: z.ZodDefault<z.ZodBoolean>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ type: "thought";
37
+ id: string;
38
+ timestamp: number;
39
+ conversation_id: string;
40
+ turn_id: string;
41
+ is_complete: boolean;
42
+ content?: string | undefined;
43
+ metadata?: Record<string, unknown> | undefined;
44
+ thought_message_id?: string | undefined;
45
+ delta?: string | undefined;
46
+ }, {
47
+ type: "thought";
48
+ id: string;
49
+ timestamp: number;
50
+ conversation_id: string;
51
+ turn_id: string;
52
+ content?: string | undefined;
53
+ metadata?: Record<string, unknown> | undefined;
54
+ thought_message_id?: string | undefined;
55
+ delta?: string | undefined;
56
+ is_complete?: boolean | undefined;
57
+ }>;
58
+ type SSEThoughtEvent = z.infer<typeof SSEThoughtEvent>;
59
+ declare const SSEFinalAnswerChunkEvent: z.ZodObject<{
60
+ id: z.ZodString;
61
+ timestamp: z.ZodNumber;
62
+ conversation_id: z.ZodString;
63
+ turn_id: z.ZodString;
64
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
65
+ } & {
66
+ type: z.ZodLiteral<"final_answer_chunk">;
67
+ answer_id: z.ZodString;
68
+ seq: z.ZodNumber;
69
+ chunk: z.ZodString;
70
+ is_last: z.ZodOptional<z.ZodBoolean>;
71
+ }, "strip", z.ZodTypeAny, {
72
+ type: "final_answer_chunk";
73
+ id: string;
74
+ timestamp: number;
75
+ conversation_id: string;
76
+ turn_id: string;
77
+ answer_id: string;
78
+ seq: number;
79
+ chunk: string;
80
+ metadata?: Record<string, unknown> | undefined;
81
+ is_last?: boolean | undefined;
82
+ }, {
83
+ type: "final_answer_chunk";
84
+ id: string;
85
+ timestamp: number;
86
+ conversation_id: string;
87
+ turn_id: string;
88
+ answer_id: string;
89
+ seq: number;
90
+ chunk: string;
91
+ metadata?: Record<string, unknown> | undefined;
92
+ is_last?: boolean | undefined;
93
+ }>;
94
+ type SSEFinalAnswerChunkEvent = z.infer<typeof SSEFinalAnswerChunkEvent>;
95
+ declare const SSEFinalAnswerEvent: z.ZodObject<{
96
+ id: z.ZodString;
97
+ timestamp: z.ZodNumber;
98
+ conversation_id: z.ZodString;
99
+ turn_id: z.ZodString;
100
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
101
+ } & {
102
+ type: z.ZodLiteral<"final_answer">;
103
+ answer_id: z.ZodString;
104
+ content: z.ZodString;
105
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
106
+ }, "strip", z.ZodTypeAny, {
107
+ type: "final_answer";
108
+ id: string;
109
+ content: string;
110
+ timestamp: number;
111
+ conversation_id: string;
112
+ turn_id: string;
113
+ answer_id: string;
114
+ metadata?: Record<string, unknown> | undefined;
115
+ meta?: Record<string, any> | undefined;
116
+ }, {
117
+ type: "final_answer";
118
+ id: string;
119
+ content: string;
120
+ timestamp: number;
121
+ conversation_id: string;
122
+ turn_id: string;
123
+ answer_id: string;
124
+ metadata?: Record<string, unknown> | undefined;
125
+ meta?: Record<string, any> | undefined;
126
+ }>;
127
+ type SSEFinalAnswerEvent = z.infer<typeof SSEFinalAnswerEvent>;
128
+ declare const SSEMarkdownChunkEvent: z.ZodObject<{
129
+ id: z.ZodString;
130
+ timestamp: z.ZodNumber;
131
+ conversation_id: z.ZodString;
132
+ turn_id: z.ZodString;
133
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
134
+ } & {
135
+ type: z.ZodLiteral<"markdown_chunk">;
136
+ content_type: z.ZodDefault<z.ZodEnum<["text", "code", "table", "image"]>>;
137
+ text: z.ZodString;
138
+ seq: z.ZodOptional<z.ZodNumber>;
139
+ }, "strip", z.ZodTypeAny, {
140
+ type: "markdown_chunk";
141
+ id: string;
142
+ timestamp: number;
143
+ conversation_id: string;
144
+ turn_id: string;
145
+ text: string;
146
+ content_type: "code" | "image" | "text" | "table";
147
+ metadata?: Record<string, unknown> | undefined;
148
+ seq?: number | undefined;
149
+ }, {
150
+ type: "markdown_chunk";
151
+ id: string;
152
+ timestamp: number;
153
+ conversation_id: string;
154
+ turn_id: string;
155
+ text: string;
156
+ metadata?: Record<string, unknown> | undefined;
157
+ seq?: number | undefined;
158
+ content_type?: "code" | "image" | "text" | "table" | undefined;
159
+ }>;
160
+ type SSEMarkdownChunkEvent = z.infer<typeof SSEMarkdownChunkEvent>;
161
+ declare const SSEToolCallDecisionEvent: z.ZodObject<{
162
+ id: z.ZodString;
163
+ timestamp: z.ZodNumber;
164
+ conversation_id: z.ZodString;
165
+ turn_id: z.ZodString;
166
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
167
+ } & {
168
+ tool_name: z.ZodString;
169
+ tool_call_id: z.ZodString;
170
+ phase: z.ZodEnum<["start", "update", "complete", "error"]>;
171
+ status: z.ZodEnum<["loading", "success", "error"]>;
172
+ args: z.ZodOptional<z.ZodAny>;
173
+ payload: z.ZodOptional<z.ZodAny>;
174
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
175
+ } & {
176
+ type: z.ZodLiteral<"tool_call_decision">;
177
+ }, "strip", z.ZodTypeAny, {
178
+ type: "tool_call_decision";
179
+ status: "error" | "loading" | "success";
180
+ id: string;
181
+ tool_name: string;
182
+ tool_call_id: string;
183
+ timestamp: number;
184
+ conversation_id: string;
185
+ turn_id: string;
186
+ phase: "start" | "update" | "complete" | "error";
187
+ args?: any;
188
+ metadata?: Record<string, unknown> | undefined;
189
+ payload?: any;
190
+ meta?: Record<string, any> | undefined;
191
+ }, {
192
+ type: "tool_call_decision";
193
+ status: "error" | "loading" | "success";
194
+ id: string;
195
+ tool_name: string;
196
+ tool_call_id: string;
197
+ timestamp: number;
198
+ conversation_id: string;
199
+ turn_id: string;
200
+ phase: "start" | "update" | "complete" | "error";
201
+ args?: any;
202
+ metadata?: Record<string, unknown> | undefined;
203
+ payload?: any;
204
+ meta?: Record<string, any> | undefined;
205
+ }>;
206
+ type SSEToolCallDecisionEvent = z.infer<typeof SSEToolCallDecisionEvent>;
207
+ declare const SSEToolProcessEvent: z.ZodObject<{
208
+ id: z.ZodString;
209
+ timestamp: z.ZodNumber;
210
+ conversation_id: z.ZodString;
211
+ turn_id: z.ZodString;
212
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
213
+ } & {
214
+ tool_name: z.ZodString;
215
+ tool_call_id: z.ZodString;
216
+ phase: z.ZodEnum<["start", "update", "complete", "error"]>;
217
+ status: z.ZodEnum<["loading", "success", "error"]>;
218
+ args: z.ZodOptional<z.ZodAny>;
219
+ payload: z.ZodOptional<z.ZodAny>;
220
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
221
+ } & {
222
+ type: z.ZodLiteral<"tool_process">;
223
+ }, "strip", z.ZodTypeAny, {
224
+ type: "tool_process";
225
+ status: "error" | "loading" | "success";
226
+ id: string;
227
+ tool_name: string;
228
+ tool_call_id: string;
229
+ timestamp: number;
230
+ conversation_id: string;
231
+ turn_id: string;
232
+ phase: "start" | "update" | "complete" | "error";
233
+ args?: any;
234
+ metadata?: Record<string, unknown> | undefined;
235
+ payload?: any;
236
+ meta?: Record<string, any> | undefined;
237
+ }, {
238
+ type: "tool_process";
239
+ status: "error" | "loading" | "success";
240
+ id: string;
241
+ tool_name: string;
242
+ tool_call_id: string;
243
+ timestamp: number;
244
+ conversation_id: string;
245
+ turn_id: string;
246
+ phase: "start" | "update" | "complete" | "error";
247
+ args?: any;
248
+ metadata?: Record<string, unknown> | undefined;
249
+ payload?: any;
250
+ meta?: Record<string, any> | undefined;
251
+ }>;
252
+ type SSEToolProcessEvent = z.infer<typeof SSEToolProcessEvent>;
253
+ declare const SSEToolOutputEvent: z.ZodObject<{
254
+ id: z.ZodString;
255
+ timestamp: z.ZodNumber;
256
+ conversation_id: z.ZodString;
257
+ turn_id: z.ZodString;
258
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
259
+ } & {
260
+ type: z.ZodLiteral<"tool_output">;
261
+ tool_name: z.ZodString;
262
+ tool_call_id: z.ZodString;
263
+ status: z.ZodEnum<["success", "error"]>;
264
+ output: z.ZodOptional<z.ZodAny>;
265
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
266
+ duration_ms: z.ZodOptional<z.ZodNumber>;
267
+ }, "strip", z.ZodTypeAny, {
268
+ type: "tool_output";
269
+ status: "error" | "success";
270
+ id: string;
271
+ tool_name: string;
272
+ tool_call_id: string;
273
+ timestamp: number;
274
+ conversation_id: string;
275
+ turn_id: string;
276
+ metadata?: Record<string, unknown> | undefined;
277
+ payload?: Record<string, any> | undefined;
278
+ output?: any;
279
+ duration_ms?: number | undefined;
280
+ }, {
281
+ type: "tool_output";
282
+ status: "error" | "success";
283
+ id: string;
284
+ tool_name: string;
285
+ tool_call_id: string;
286
+ timestamp: number;
287
+ conversation_id: string;
288
+ turn_id: string;
289
+ metadata?: Record<string, unknown> | undefined;
290
+ payload?: Record<string, any> | undefined;
291
+ output?: any;
292
+ duration_ms?: number | undefined;
293
+ }>;
294
+ type SSEToolOutputEvent = z.infer<typeof SSEToolOutputEvent>;
295
+ declare const SSETodoUpdatedEvent: z.ZodObject<{
296
+ id: z.ZodString;
297
+ timestamp: z.ZodNumber;
298
+ conversation_id: z.ZodString;
299
+ turn_id: z.ZodString;
300
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
301
+ } & {
302
+ type: z.ZodLiteral<"todo_updated">;
303
+ todo_list_id: z.ZodString;
304
+ todo_list_version: z.ZodNumber;
305
+ items: z.ZodArray<z.ZodObject<{
306
+ id: z.ZodString;
307
+ content: z.ZodString;
308
+ status: z.ZodEnum<["pending", "in_progress", "completed", "cancelled"]>;
309
+ }, "strip", z.ZodTypeAny, {
310
+ status: "in_progress" | "completed" | "cancelled" | "pending";
311
+ id: string;
312
+ content: string;
313
+ }, {
314
+ status: "in_progress" | "completed" | "cancelled" | "pending";
315
+ id: string;
316
+ content: string;
317
+ }>, "many">;
318
+ }, "strip", z.ZodTypeAny, {
319
+ type: "todo_updated";
320
+ id: string;
321
+ timestamp: number;
322
+ conversation_id: string;
323
+ turn_id: string;
324
+ todo_list_id: string;
325
+ todo_list_version: number;
326
+ items: {
327
+ status: "in_progress" | "completed" | "cancelled" | "pending";
328
+ id: string;
329
+ content: string;
330
+ }[];
331
+ metadata?: Record<string, unknown> | undefined;
332
+ }, {
333
+ type: "todo_updated";
334
+ id: string;
335
+ timestamp: number;
336
+ conversation_id: string;
337
+ turn_id: string;
338
+ todo_list_id: string;
339
+ todo_list_version: number;
340
+ items: {
341
+ status: "in_progress" | "completed" | "cancelled" | "pending";
342
+ id: string;
343
+ content: string;
344
+ }[];
345
+ metadata?: Record<string, unknown> | undefined;
346
+ }>;
347
+ type SSETodoUpdatedEvent = z.infer<typeof SSETodoUpdatedEvent>;
348
+ declare const SSESubRunTraceEvent: z.ZodObject<{
349
+ id: z.ZodString;
350
+ timestamp: z.ZodNumber;
351
+ conversation_id: z.ZodString;
352
+ turn_id: z.ZodString;
353
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
354
+ } & {
355
+ type: z.ZodLiteral<"subrun_trace">;
356
+ parent_tool_call_id: z.ZodString;
357
+ subrun_id: z.ZodString;
358
+ subrun_parent_id: z.ZodOptional<z.ZodString>;
359
+ kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer"]>;
360
+ delta: z.ZodOptional<z.ZodString>;
361
+ content: z.ZodOptional<z.ZodString>;
362
+ tool_name: z.ZodOptional<z.ZodString>;
363
+ tool_call_id: z.ZodOptional<z.ZodString>;
364
+ phase: z.ZodOptional<z.ZodEnum<["start", "update", "complete", "error"]>>;
365
+ status: z.ZodOptional<z.ZodEnum<["loading", "success", "error"]>>;
366
+ args: z.ZodOptional<z.ZodUnknown>;
367
+ output: z.ZodOptional<z.ZodUnknown>;
368
+ duration_ms: z.ZodOptional<z.ZodNumber>;
369
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
370
+ }, "strip", z.ZodTypeAny, {
371
+ type: "subrun_trace";
372
+ id: string;
373
+ timestamp: number;
374
+ kind: "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
375
+ conversation_id: string;
376
+ turn_id: string;
377
+ parent_tool_call_id: string;
378
+ subrun_id: string;
379
+ status?: "error" | "loading" | "success" | undefined;
380
+ tool_name?: string | undefined;
381
+ args?: unknown;
382
+ tool_call_id?: string | undefined;
383
+ content?: string | undefined;
384
+ metadata?: Record<string, unknown> | undefined;
385
+ delta?: string | undefined;
386
+ phase?: "start" | "update" | "complete" | "error" | undefined;
387
+ meta?: Record<string, unknown> | undefined;
388
+ output?: unknown;
389
+ duration_ms?: number | undefined;
390
+ subrun_parent_id?: string | undefined;
391
+ }, {
392
+ type: "subrun_trace";
393
+ id: string;
394
+ timestamp: number;
395
+ kind: "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
396
+ conversation_id: string;
397
+ turn_id: string;
398
+ parent_tool_call_id: string;
399
+ subrun_id: string;
400
+ status?: "error" | "loading" | "success" | undefined;
401
+ tool_name?: string | undefined;
402
+ args?: unknown;
403
+ tool_call_id?: string | undefined;
404
+ content?: string | undefined;
405
+ metadata?: Record<string, unknown> | undefined;
406
+ delta?: string | undefined;
407
+ phase?: "start" | "update" | "complete" | "error" | undefined;
408
+ meta?: Record<string, unknown> | undefined;
409
+ output?: unknown;
410
+ duration_ms?: number | undefined;
411
+ subrun_parent_id?: string | undefined;
412
+ }>;
413
+ type SSESubRunTraceEvent = z.infer<typeof SSESubRunTraceEvent>;
414
+ declare const SSERequiresUserInteractionEvent: z.ZodObject<{
415
+ id: z.ZodString;
416
+ timestamp: z.ZodNumber;
417
+ conversation_id: z.ZodString;
418
+ turn_id: z.ZodString;
419
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
420
+ } & {
421
+ type: z.ZodLiteral<"requires_user_interaction">;
422
+ form: z.ZodOptional<z.ZodAny>;
423
+ interaction_type: z.ZodOptional<z.ZodString>;
424
+ prompt: z.ZodOptional<z.ZodString>;
425
+ }, "strip", z.ZodTypeAny, {
426
+ type: "requires_user_interaction";
427
+ id: string;
428
+ timestamp: number;
429
+ conversation_id: string;
430
+ turn_id: string;
431
+ metadata?: Record<string, unknown> | undefined;
432
+ form?: any;
433
+ interaction_type?: string | undefined;
434
+ prompt?: string | undefined;
435
+ }, {
436
+ type: "requires_user_interaction";
437
+ id: string;
438
+ timestamp: number;
439
+ conversation_id: string;
440
+ turn_id: string;
441
+ metadata?: Record<string, unknown> | undefined;
442
+ form?: any;
443
+ interaction_type?: string | undefined;
444
+ prompt?: string | undefined;
445
+ }>;
446
+ type SSERequiresUserInteractionEvent = z.infer<typeof SSERequiresUserInteractionEvent>;
447
+ declare const SSEErrorEvent: z.ZodObject<{
448
+ id: z.ZodString;
449
+ timestamp: z.ZodNumber;
450
+ conversation_id: z.ZodString;
451
+ turn_id: z.ZodString;
452
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
453
+ } & {
454
+ type: z.ZodLiteral<"error">;
455
+ error: z.ZodString;
456
+ details: z.ZodOptional<z.ZodAny>;
457
+ error_code: z.ZodOptional<z.ZodString>;
458
+ retryable: z.ZodOptional<z.ZodBoolean>;
459
+ }, "strip", z.ZodTypeAny, {
460
+ type: "error";
461
+ id: string;
462
+ timestamp: number;
463
+ conversation_id: string;
464
+ turn_id: string;
465
+ error: string;
466
+ metadata?: Record<string, unknown> | undefined;
467
+ details?: any;
468
+ error_code?: string | undefined;
469
+ retryable?: boolean | undefined;
470
+ }, {
471
+ type: "error";
472
+ id: string;
473
+ timestamp: number;
474
+ conversation_id: string;
475
+ turn_id: string;
476
+ error: string;
477
+ metadata?: Record<string, unknown> | undefined;
478
+ details?: any;
479
+ error_code?: string | undefined;
480
+ retryable?: boolean | undefined;
481
+ }>;
482
+ type SSEErrorEvent = z.infer<typeof SSEErrorEvent>;
483
+ declare const SSEStreamEndEvent: z.ZodObject<{
484
+ id: z.ZodString;
485
+ timestamp: z.ZodNumber;
486
+ conversation_id: z.ZodString;
487
+ turn_id: z.ZodString;
488
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
489
+ } & {
490
+ type: z.ZodLiteral<"stream_end">;
491
+ reason: z.ZodOptional<z.ZodEnum<["complete", "error", "interrupted", "timeout"]>>;
492
+ reason_message: z.ZodOptional<z.ZodString>;
493
+ stats: z.ZodOptional<z.ZodObject<{
494
+ total_events: z.ZodOptional<z.ZodNumber>;
495
+ duration_ms: z.ZodOptional<z.ZodNumber>;
496
+ error_count: z.ZodOptional<z.ZodNumber>;
497
+ benchmark: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
498
+ }, "strip", z.ZodTypeAny, {
499
+ duration_ms?: number | undefined;
500
+ total_events?: number | undefined;
501
+ error_count?: number | undefined;
502
+ benchmark?: Record<string, unknown> | undefined;
503
+ }, {
504
+ duration_ms?: number | undefined;
505
+ total_events?: number | undefined;
506
+ error_count?: number | undefined;
507
+ benchmark?: Record<string, unknown> | undefined;
508
+ }>>;
509
+ }, "strip", z.ZodTypeAny, {
510
+ type: "stream_end";
511
+ id: string;
512
+ timestamp: number;
513
+ conversation_id: string;
514
+ turn_id: string;
515
+ metadata?: Record<string, unknown> | undefined;
516
+ reason?: "complete" | "error" | "interrupted" | "timeout" | undefined;
517
+ reason_message?: string | undefined;
518
+ stats?: {
519
+ duration_ms?: number | undefined;
520
+ total_events?: number | undefined;
521
+ error_count?: number | undefined;
522
+ benchmark?: Record<string, unknown> | undefined;
523
+ } | undefined;
524
+ }, {
525
+ type: "stream_end";
526
+ id: string;
527
+ timestamp: number;
528
+ conversation_id: string;
529
+ turn_id: string;
530
+ metadata?: Record<string, unknown> | undefined;
531
+ reason?: "complete" | "error" | "interrupted" | "timeout" | undefined;
532
+ reason_message?: string | undefined;
533
+ stats?: {
534
+ duration_ms?: number | undefined;
535
+ total_events?: number | undefined;
536
+ error_count?: number | undefined;
537
+ benchmark?: Record<string, unknown> | undefined;
538
+ } | undefined;
539
+ }>;
540
+ type SSEStreamEndEvent = z.infer<typeof SSEStreamEndEvent>;
541
+ declare const SSEHistorySummaryEvent: z.ZodObject<{
542
+ id: z.ZodString;
543
+ timestamp: z.ZodNumber;
544
+ conversation_id: z.ZodString;
545
+ turn_id: z.ZodString;
546
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
547
+ } & {
548
+ type: z.ZodLiteral<"history_summary">;
549
+ summary_id: z.ZodString;
550
+ content: z.ZodString;
551
+ original_message_count: z.ZodNumber;
552
+ summary_seq: z.ZodNumber;
553
+ }, "strip", z.ZodTypeAny, {
554
+ type: "history_summary";
555
+ id: string;
556
+ content: string;
557
+ timestamp: number;
558
+ conversation_id: string;
559
+ turn_id: string;
560
+ summary_seq: number;
561
+ original_message_count: number;
562
+ summary_id: string;
563
+ metadata?: Record<string, unknown> | undefined;
564
+ }, {
565
+ type: "history_summary";
566
+ id: string;
567
+ content: string;
568
+ timestamp: number;
569
+ conversation_id: string;
570
+ turn_id: string;
571
+ summary_seq: number;
572
+ original_message_count: number;
573
+ summary_id: string;
574
+ metadata?: Record<string, unknown> | undefined;
575
+ }>;
576
+ type SSEHistorySummaryEvent = z.infer<typeof SSEHistorySummaryEvent>;
577
+ declare const SSESummarizationStartEvent: z.ZodObject<{
578
+ id: z.ZodString;
579
+ timestamp: z.ZodNumber;
580
+ conversation_id: z.ZodString;
581
+ turn_id: z.ZodString;
582
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
583
+ } & {
584
+ type: z.ZodLiteral<"summarization_start">;
585
+ originalMessages: z.ZodOptional<z.ZodNumber>;
586
+ }, "strip", z.ZodTypeAny, {
587
+ type: "summarization_start";
588
+ id: string;
589
+ timestamp: number;
590
+ conversation_id: string;
591
+ turn_id: string;
592
+ metadata?: Record<string, unknown> | undefined;
593
+ originalMessages?: number | undefined;
594
+ }, {
595
+ type: "summarization_start";
596
+ id: string;
597
+ timestamp: number;
598
+ conversation_id: string;
599
+ turn_id: string;
600
+ metadata?: Record<string, unknown> | undefined;
601
+ originalMessages?: number | undefined;
602
+ }>;
603
+ type SSESummarizationStartEvent = z.infer<typeof SSESummarizationStartEvent>;
604
+ declare const SSESummarizationEndEvent: z.ZodObject<{
605
+ id: z.ZodString;
606
+ timestamp: z.ZodNumber;
607
+ conversation_id: z.ZodString;
608
+ turn_id: z.ZodString;
609
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
610
+ } & {
611
+ type: z.ZodLiteral<"summarization_end">;
612
+ originalMessages: z.ZodOptional<z.ZodNumber>;
613
+ compressedMessages: z.ZodOptional<z.ZodNumber>;
614
+ compressionRatio: z.ZodOptional<z.ZodString>;
615
+ timeSaved: z.ZodOptional<z.ZodString>;
616
+ }, "strip", z.ZodTypeAny, {
617
+ type: "summarization_end";
618
+ id: string;
619
+ timestamp: number;
620
+ conversation_id: string;
621
+ turn_id: string;
622
+ compressionRatio?: string | undefined;
623
+ metadata?: Record<string, unknown> | undefined;
624
+ originalMessages?: number | undefined;
625
+ compressedMessages?: number | undefined;
626
+ timeSaved?: string | undefined;
627
+ }, {
628
+ type: "summarization_end";
629
+ id: string;
630
+ timestamp: number;
631
+ conversation_id: string;
632
+ turn_id: string;
633
+ compressionRatio?: string | undefined;
634
+ metadata?: Record<string, unknown> | undefined;
635
+ originalMessages?: number | undefined;
636
+ compressedMessages?: number | undefined;
637
+ timeSaved?: string | undefined;
638
+ }>;
639
+ type SSESummarizationEndEvent = z.infer<typeof SSESummarizationEndEvent>;
640
+ declare const SSESummarizationErrorEvent: z.ZodObject<{
641
+ id: z.ZodString;
642
+ timestamp: z.ZodNumber;
643
+ conversation_id: z.ZodString;
644
+ turn_id: z.ZodString;
645
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
646
+ } & {
647
+ type: z.ZodLiteral<"summarization_error">;
648
+ error: z.ZodString;
649
+ }, "strip", z.ZodTypeAny, {
650
+ type: "summarization_error";
651
+ id: string;
652
+ timestamp: number;
653
+ conversation_id: string;
654
+ turn_id: string;
655
+ error: string;
656
+ metadata?: Record<string, unknown> | undefined;
657
+ }, {
658
+ type: "summarization_error";
659
+ id: string;
660
+ timestamp: number;
661
+ conversation_id: string;
662
+ turn_id: string;
663
+ error: string;
664
+ metadata?: Record<string, unknown> | undefined;
665
+ }>;
666
+ type SSESummarizationErrorEvent = z.infer<typeof SSESummarizationErrorEvent>;
667
+ declare const SSEEvent: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
668
+ id: z.ZodString;
669
+ timestamp: z.ZodNumber;
670
+ conversation_id: z.ZodString;
671
+ turn_id: z.ZodString;
672
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
673
+ } & {
674
+ type: z.ZodLiteral<"thought">;
675
+ thought_message_id: z.ZodOptional<z.ZodString>;
676
+ delta: z.ZodOptional<z.ZodString>;
677
+ content: z.ZodOptional<z.ZodString>;
678
+ is_complete: z.ZodDefault<z.ZodBoolean>;
679
+ }, "strip", z.ZodTypeAny, {
680
+ type: "thought";
681
+ id: string;
682
+ timestamp: number;
683
+ conversation_id: string;
684
+ turn_id: string;
685
+ is_complete: boolean;
686
+ content?: string | undefined;
687
+ metadata?: Record<string, unknown> | undefined;
688
+ thought_message_id?: string | undefined;
689
+ delta?: string | undefined;
690
+ }, {
691
+ type: "thought";
692
+ id: string;
693
+ timestamp: number;
694
+ conversation_id: string;
695
+ turn_id: string;
696
+ content?: string | undefined;
697
+ metadata?: Record<string, unknown> | undefined;
698
+ thought_message_id?: string | undefined;
699
+ delta?: string | undefined;
700
+ is_complete?: boolean | undefined;
701
+ }>, z.ZodObject<{
702
+ id: z.ZodString;
703
+ timestamp: z.ZodNumber;
704
+ conversation_id: z.ZodString;
705
+ turn_id: z.ZodString;
706
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
707
+ } & {
708
+ type: z.ZodLiteral<"final_answer_chunk">;
709
+ answer_id: z.ZodString;
710
+ seq: z.ZodNumber;
711
+ chunk: z.ZodString;
712
+ is_last: z.ZodOptional<z.ZodBoolean>;
713
+ }, "strip", z.ZodTypeAny, {
714
+ type: "final_answer_chunk";
715
+ id: string;
716
+ timestamp: number;
717
+ conversation_id: string;
718
+ turn_id: string;
719
+ answer_id: string;
720
+ seq: number;
721
+ chunk: string;
722
+ metadata?: Record<string, unknown> | undefined;
723
+ is_last?: boolean | undefined;
724
+ }, {
725
+ type: "final_answer_chunk";
726
+ id: string;
727
+ timestamp: number;
728
+ conversation_id: string;
729
+ turn_id: string;
730
+ answer_id: string;
731
+ seq: number;
732
+ chunk: string;
733
+ metadata?: Record<string, unknown> | undefined;
734
+ is_last?: boolean | undefined;
735
+ }>, z.ZodObject<{
736
+ id: z.ZodString;
737
+ timestamp: z.ZodNumber;
738
+ conversation_id: z.ZodString;
739
+ turn_id: z.ZodString;
740
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
741
+ } & {
742
+ type: z.ZodLiteral<"final_answer">;
743
+ answer_id: z.ZodString;
744
+ content: z.ZodString;
745
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
746
+ }, "strip", z.ZodTypeAny, {
747
+ type: "final_answer";
748
+ id: string;
749
+ content: string;
750
+ timestamp: number;
751
+ conversation_id: string;
752
+ turn_id: string;
753
+ answer_id: string;
754
+ metadata?: Record<string, unknown> | undefined;
755
+ meta?: Record<string, any> | undefined;
756
+ }, {
757
+ type: "final_answer";
758
+ id: string;
759
+ content: string;
760
+ timestamp: number;
761
+ conversation_id: string;
762
+ turn_id: string;
763
+ answer_id: string;
764
+ metadata?: Record<string, unknown> | undefined;
765
+ meta?: Record<string, any> | undefined;
766
+ }>, z.ZodObject<{
767
+ id: z.ZodString;
768
+ timestamp: z.ZodNumber;
769
+ conversation_id: z.ZodString;
770
+ turn_id: z.ZodString;
771
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
772
+ } & {
773
+ type: z.ZodLiteral<"markdown_chunk">;
774
+ content_type: z.ZodDefault<z.ZodEnum<["text", "code", "table", "image"]>>;
775
+ text: z.ZodString;
776
+ seq: z.ZodOptional<z.ZodNumber>;
777
+ }, "strip", z.ZodTypeAny, {
778
+ type: "markdown_chunk";
779
+ id: string;
780
+ timestamp: number;
781
+ conversation_id: string;
782
+ turn_id: string;
783
+ text: string;
784
+ content_type: "code" | "image" | "text" | "table";
785
+ metadata?: Record<string, unknown> | undefined;
786
+ seq?: number | undefined;
787
+ }, {
788
+ type: "markdown_chunk";
789
+ id: string;
790
+ timestamp: number;
791
+ conversation_id: string;
792
+ turn_id: string;
793
+ text: string;
794
+ metadata?: Record<string, unknown> | undefined;
795
+ seq?: number | undefined;
796
+ content_type?: "code" | "image" | "text" | "table" | undefined;
797
+ }>, z.ZodObject<{
798
+ id: z.ZodString;
799
+ timestamp: z.ZodNumber;
800
+ conversation_id: z.ZodString;
801
+ turn_id: z.ZodString;
802
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
803
+ } & {
804
+ tool_name: z.ZodString;
805
+ tool_call_id: z.ZodString;
806
+ phase: z.ZodEnum<["start", "update", "complete", "error"]>;
807
+ status: z.ZodEnum<["loading", "success", "error"]>;
808
+ args: z.ZodOptional<z.ZodAny>;
809
+ payload: z.ZodOptional<z.ZodAny>;
810
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
811
+ } & {
812
+ type: z.ZodLiteral<"tool_call_decision">;
813
+ }, "strip", z.ZodTypeAny, {
814
+ type: "tool_call_decision";
815
+ status: "error" | "loading" | "success";
816
+ id: string;
817
+ tool_name: string;
818
+ tool_call_id: string;
819
+ timestamp: number;
820
+ conversation_id: string;
821
+ turn_id: string;
822
+ phase: "start" | "update" | "complete" | "error";
823
+ args?: any;
824
+ metadata?: Record<string, unknown> | undefined;
825
+ payload?: any;
826
+ meta?: Record<string, any> | undefined;
827
+ }, {
828
+ type: "tool_call_decision";
829
+ status: "error" | "loading" | "success";
830
+ id: string;
831
+ tool_name: string;
832
+ tool_call_id: string;
833
+ timestamp: number;
834
+ conversation_id: string;
835
+ turn_id: string;
836
+ phase: "start" | "update" | "complete" | "error";
837
+ args?: any;
838
+ metadata?: Record<string, unknown> | undefined;
839
+ payload?: any;
840
+ meta?: Record<string, any> | undefined;
841
+ }>, z.ZodObject<{
842
+ id: z.ZodString;
843
+ timestamp: z.ZodNumber;
844
+ conversation_id: z.ZodString;
845
+ turn_id: z.ZodString;
846
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
847
+ } & {
848
+ tool_name: z.ZodString;
849
+ tool_call_id: z.ZodString;
850
+ phase: z.ZodEnum<["start", "update", "complete", "error"]>;
851
+ status: z.ZodEnum<["loading", "success", "error"]>;
852
+ args: z.ZodOptional<z.ZodAny>;
853
+ payload: z.ZodOptional<z.ZodAny>;
854
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
855
+ } & {
856
+ type: z.ZodLiteral<"tool_process">;
857
+ }, "strip", z.ZodTypeAny, {
858
+ type: "tool_process";
859
+ status: "error" | "loading" | "success";
860
+ id: string;
861
+ tool_name: string;
862
+ tool_call_id: string;
863
+ timestamp: number;
864
+ conversation_id: string;
865
+ turn_id: string;
866
+ phase: "start" | "update" | "complete" | "error";
867
+ args?: any;
868
+ metadata?: Record<string, unknown> | undefined;
869
+ payload?: any;
870
+ meta?: Record<string, any> | undefined;
871
+ }, {
872
+ type: "tool_process";
873
+ status: "error" | "loading" | "success";
874
+ id: string;
875
+ tool_name: string;
876
+ tool_call_id: string;
877
+ timestamp: number;
878
+ conversation_id: string;
879
+ turn_id: string;
880
+ phase: "start" | "update" | "complete" | "error";
881
+ args?: any;
882
+ metadata?: Record<string, unknown> | undefined;
883
+ payload?: any;
884
+ meta?: Record<string, any> | undefined;
885
+ }>, z.ZodObject<{
886
+ id: z.ZodString;
887
+ timestamp: z.ZodNumber;
888
+ conversation_id: z.ZodString;
889
+ turn_id: z.ZodString;
890
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
891
+ } & {
892
+ type: z.ZodLiteral<"tool_output">;
893
+ tool_name: z.ZodString;
894
+ tool_call_id: z.ZodString;
895
+ status: z.ZodEnum<["success", "error"]>;
896
+ output: z.ZodOptional<z.ZodAny>;
897
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
898
+ duration_ms: z.ZodOptional<z.ZodNumber>;
899
+ }, "strip", z.ZodTypeAny, {
900
+ type: "tool_output";
901
+ status: "error" | "success";
902
+ id: string;
903
+ tool_name: string;
904
+ tool_call_id: string;
905
+ timestamp: number;
906
+ conversation_id: string;
907
+ turn_id: string;
908
+ metadata?: Record<string, unknown> | undefined;
909
+ payload?: Record<string, any> | undefined;
910
+ output?: any;
911
+ duration_ms?: number | undefined;
912
+ }, {
913
+ type: "tool_output";
914
+ status: "error" | "success";
915
+ id: string;
916
+ tool_name: string;
917
+ tool_call_id: string;
918
+ timestamp: number;
919
+ conversation_id: string;
920
+ turn_id: string;
921
+ metadata?: Record<string, unknown> | undefined;
922
+ payload?: Record<string, any> | undefined;
923
+ output?: any;
924
+ duration_ms?: number | undefined;
925
+ }>, z.ZodObject<{
926
+ id: z.ZodString;
927
+ timestamp: z.ZodNumber;
928
+ conversation_id: z.ZodString;
929
+ turn_id: z.ZodString;
930
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
931
+ } & {
932
+ type: z.ZodLiteral<"todo_updated">;
933
+ todo_list_id: z.ZodString;
934
+ todo_list_version: z.ZodNumber;
935
+ items: z.ZodArray<z.ZodObject<{
936
+ id: z.ZodString;
937
+ content: z.ZodString;
938
+ status: z.ZodEnum<["pending", "in_progress", "completed", "cancelled"]>;
939
+ }, "strip", z.ZodTypeAny, {
940
+ status: "in_progress" | "completed" | "cancelled" | "pending";
941
+ id: string;
942
+ content: string;
943
+ }, {
944
+ status: "in_progress" | "completed" | "cancelled" | "pending";
945
+ id: string;
946
+ content: string;
947
+ }>, "many">;
948
+ }, "strip", z.ZodTypeAny, {
949
+ type: "todo_updated";
950
+ id: string;
951
+ timestamp: number;
952
+ conversation_id: string;
953
+ turn_id: string;
954
+ todo_list_id: string;
955
+ todo_list_version: number;
956
+ items: {
957
+ status: "in_progress" | "completed" | "cancelled" | "pending";
958
+ id: string;
959
+ content: string;
960
+ }[];
961
+ metadata?: Record<string, unknown> | undefined;
962
+ }, {
963
+ type: "todo_updated";
964
+ id: string;
965
+ timestamp: number;
966
+ conversation_id: string;
967
+ turn_id: string;
968
+ todo_list_id: string;
969
+ todo_list_version: number;
970
+ items: {
971
+ status: "in_progress" | "completed" | "cancelled" | "pending";
972
+ id: string;
973
+ content: string;
974
+ }[];
975
+ metadata?: Record<string, unknown> | undefined;
976
+ }>, z.ZodObject<{
977
+ id: z.ZodString;
978
+ timestamp: z.ZodNumber;
979
+ conversation_id: z.ZodString;
980
+ turn_id: z.ZodString;
981
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
982
+ } & {
983
+ type: z.ZodLiteral<"subrun_trace">;
984
+ parent_tool_call_id: z.ZodString;
985
+ subrun_id: z.ZodString;
986
+ subrun_parent_id: z.ZodOptional<z.ZodString>;
987
+ kind: z.ZodEnum<["thought_delta", "thought_complete", "tool_call_decision", "tool_process", "tool_output", "final_answer_chunk", "final_answer"]>;
988
+ delta: z.ZodOptional<z.ZodString>;
989
+ content: z.ZodOptional<z.ZodString>;
990
+ tool_name: z.ZodOptional<z.ZodString>;
991
+ tool_call_id: z.ZodOptional<z.ZodString>;
992
+ phase: z.ZodOptional<z.ZodEnum<["start", "update", "complete", "error"]>>;
993
+ status: z.ZodOptional<z.ZodEnum<["loading", "success", "error"]>>;
994
+ args: z.ZodOptional<z.ZodUnknown>;
995
+ output: z.ZodOptional<z.ZodUnknown>;
996
+ duration_ms: z.ZodOptional<z.ZodNumber>;
997
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
998
+ }, "strip", z.ZodTypeAny, {
999
+ type: "subrun_trace";
1000
+ id: string;
1001
+ timestamp: number;
1002
+ kind: "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
1003
+ conversation_id: string;
1004
+ turn_id: string;
1005
+ parent_tool_call_id: string;
1006
+ subrun_id: string;
1007
+ status?: "error" | "loading" | "success" | undefined;
1008
+ tool_name?: string | undefined;
1009
+ args?: unknown;
1010
+ tool_call_id?: string | undefined;
1011
+ content?: string | undefined;
1012
+ metadata?: Record<string, unknown> | undefined;
1013
+ delta?: string | undefined;
1014
+ phase?: "start" | "update" | "complete" | "error" | undefined;
1015
+ meta?: Record<string, unknown> | undefined;
1016
+ output?: unknown;
1017
+ duration_ms?: number | undefined;
1018
+ subrun_parent_id?: string | undefined;
1019
+ }, {
1020
+ type: "subrun_trace";
1021
+ id: string;
1022
+ timestamp: number;
1023
+ kind: "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
1024
+ conversation_id: string;
1025
+ turn_id: string;
1026
+ parent_tool_call_id: string;
1027
+ subrun_id: string;
1028
+ status?: "error" | "loading" | "success" | undefined;
1029
+ tool_name?: string | undefined;
1030
+ args?: unknown;
1031
+ tool_call_id?: string | undefined;
1032
+ content?: string | undefined;
1033
+ metadata?: Record<string, unknown> | undefined;
1034
+ delta?: string | undefined;
1035
+ phase?: "start" | "update" | "complete" | "error" | undefined;
1036
+ meta?: Record<string, unknown> | undefined;
1037
+ output?: unknown;
1038
+ duration_ms?: number | undefined;
1039
+ subrun_parent_id?: string | undefined;
1040
+ }>, z.ZodObject<{
1041
+ id: z.ZodString;
1042
+ timestamp: z.ZodNumber;
1043
+ conversation_id: z.ZodString;
1044
+ turn_id: z.ZodString;
1045
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1046
+ } & {
1047
+ type: z.ZodLiteral<"requires_user_interaction">;
1048
+ form: z.ZodOptional<z.ZodAny>;
1049
+ interaction_type: z.ZodOptional<z.ZodString>;
1050
+ prompt: z.ZodOptional<z.ZodString>;
1051
+ }, "strip", z.ZodTypeAny, {
1052
+ type: "requires_user_interaction";
1053
+ id: string;
1054
+ timestamp: number;
1055
+ conversation_id: string;
1056
+ turn_id: string;
1057
+ metadata?: Record<string, unknown> | undefined;
1058
+ form?: any;
1059
+ interaction_type?: string | undefined;
1060
+ prompt?: string | undefined;
1061
+ }, {
1062
+ type: "requires_user_interaction";
1063
+ id: string;
1064
+ timestamp: number;
1065
+ conversation_id: string;
1066
+ turn_id: string;
1067
+ metadata?: Record<string, unknown> | undefined;
1068
+ form?: any;
1069
+ interaction_type?: string | undefined;
1070
+ prompt?: string | undefined;
1071
+ }>, z.ZodObject<{
1072
+ id: z.ZodString;
1073
+ timestamp: z.ZodNumber;
1074
+ conversation_id: z.ZodString;
1075
+ turn_id: z.ZodString;
1076
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1077
+ } & {
1078
+ type: z.ZodLiteral<"error">;
1079
+ error: z.ZodString;
1080
+ details: z.ZodOptional<z.ZodAny>;
1081
+ error_code: z.ZodOptional<z.ZodString>;
1082
+ retryable: z.ZodOptional<z.ZodBoolean>;
1083
+ }, "strip", z.ZodTypeAny, {
1084
+ type: "error";
1085
+ id: string;
1086
+ timestamp: number;
1087
+ conversation_id: string;
1088
+ turn_id: string;
1089
+ error: string;
1090
+ metadata?: Record<string, unknown> | undefined;
1091
+ details?: any;
1092
+ error_code?: string | undefined;
1093
+ retryable?: boolean | undefined;
1094
+ }, {
1095
+ type: "error";
1096
+ id: string;
1097
+ timestamp: number;
1098
+ conversation_id: string;
1099
+ turn_id: string;
1100
+ error: string;
1101
+ metadata?: Record<string, unknown> | undefined;
1102
+ details?: any;
1103
+ error_code?: string | undefined;
1104
+ retryable?: boolean | undefined;
1105
+ }>, z.ZodObject<{
1106
+ id: z.ZodString;
1107
+ timestamp: z.ZodNumber;
1108
+ conversation_id: z.ZodString;
1109
+ turn_id: z.ZodString;
1110
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1111
+ } & {
1112
+ type: z.ZodLiteral<"stream_end">;
1113
+ reason: z.ZodOptional<z.ZodEnum<["complete", "error", "interrupted", "timeout"]>>;
1114
+ reason_message: z.ZodOptional<z.ZodString>;
1115
+ stats: z.ZodOptional<z.ZodObject<{
1116
+ total_events: z.ZodOptional<z.ZodNumber>;
1117
+ duration_ms: z.ZodOptional<z.ZodNumber>;
1118
+ error_count: z.ZodOptional<z.ZodNumber>;
1119
+ benchmark: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1120
+ }, "strip", z.ZodTypeAny, {
1121
+ duration_ms?: number | undefined;
1122
+ total_events?: number | undefined;
1123
+ error_count?: number | undefined;
1124
+ benchmark?: Record<string, unknown> | undefined;
1125
+ }, {
1126
+ duration_ms?: number | undefined;
1127
+ total_events?: number | undefined;
1128
+ error_count?: number | undefined;
1129
+ benchmark?: Record<string, unknown> | undefined;
1130
+ }>>;
1131
+ }, "strip", z.ZodTypeAny, {
1132
+ type: "stream_end";
1133
+ id: string;
1134
+ timestamp: number;
1135
+ conversation_id: string;
1136
+ turn_id: string;
1137
+ metadata?: Record<string, unknown> | undefined;
1138
+ reason?: "complete" | "error" | "interrupted" | "timeout" | undefined;
1139
+ reason_message?: string | undefined;
1140
+ stats?: {
1141
+ duration_ms?: number | undefined;
1142
+ total_events?: number | undefined;
1143
+ error_count?: number | undefined;
1144
+ benchmark?: Record<string, unknown> | undefined;
1145
+ } | undefined;
1146
+ }, {
1147
+ type: "stream_end";
1148
+ id: string;
1149
+ timestamp: number;
1150
+ conversation_id: string;
1151
+ turn_id: string;
1152
+ metadata?: Record<string, unknown> | undefined;
1153
+ reason?: "complete" | "error" | "interrupted" | "timeout" | undefined;
1154
+ reason_message?: string | undefined;
1155
+ stats?: {
1156
+ duration_ms?: number | undefined;
1157
+ total_events?: number | undefined;
1158
+ error_count?: number | undefined;
1159
+ benchmark?: Record<string, unknown> | undefined;
1160
+ } | undefined;
1161
+ }>, z.ZodObject<{
1162
+ id: z.ZodString;
1163
+ timestamp: z.ZodNumber;
1164
+ conversation_id: z.ZodString;
1165
+ turn_id: z.ZodString;
1166
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1167
+ } & {
1168
+ type: z.ZodLiteral<"history_summary">;
1169
+ summary_id: z.ZodString;
1170
+ content: z.ZodString;
1171
+ original_message_count: z.ZodNumber;
1172
+ summary_seq: z.ZodNumber;
1173
+ }, "strip", z.ZodTypeAny, {
1174
+ type: "history_summary";
1175
+ id: string;
1176
+ content: string;
1177
+ timestamp: number;
1178
+ conversation_id: string;
1179
+ turn_id: string;
1180
+ summary_seq: number;
1181
+ original_message_count: number;
1182
+ summary_id: string;
1183
+ metadata?: Record<string, unknown> | undefined;
1184
+ }, {
1185
+ type: "history_summary";
1186
+ id: string;
1187
+ content: string;
1188
+ timestamp: number;
1189
+ conversation_id: string;
1190
+ turn_id: string;
1191
+ summary_seq: number;
1192
+ original_message_count: number;
1193
+ summary_id: string;
1194
+ metadata?: Record<string, unknown> | undefined;
1195
+ }>, z.ZodObject<{
1196
+ id: z.ZodString;
1197
+ timestamp: z.ZodNumber;
1198
+ conversation_id: z.ZodString;
1199
+ turn_id: z.ZodString;
1200
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1201
+ } & {
1202
+ type: z.ZodLiteral<"summarization_start">;
1203
+ originalMessages: z.ZodOptional<z.ZodNumber>;
1204
+ }, "strip", z.ZodTypeAny, {
1205
+ type: "summarization_start";
1206
+ id: string;
1207
+ timestamp: number;
1208
+ conversation_id: string;
1209
+ turn_id: string;
1210
+ metadata?: Record<string, unknown> | undefined;
1211
+ originalMessages?: number | undefined;
1212
+ }, {
1213
+ type: "summarization_start";
1214
+ id: string;
1215
+ timestamp: number;
1216
+ conversation_id: string;
1217
+ turn_id: string;
1218
+ metadata?: Record<string, unknown> | undefined;
1219
+ originalMessages?: number | undefined;
1220
+ }>, z.ZodObject<{
1221
+ id: z.ZodString;
1222
+ timestamp: z.ZodNumber;
1223
+ conversation_id: z.ZodString;
1224
+ turn_id: z.ZodString;
1225
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1226
+ } & {
1227
+ type: z.ZodLiteral<"summarization_end">;
1228
+ originalMessages: z.ZodOptional<z.ZodNumber>;
1229
+ compressedMessages: z.ZodOptional<z.ZodNumber>;
1230
+ compressionRatio: z.ZodOptional<z.ZodString>;
1231
+ timeSaved: z.ZodOptional<z.ZodString>;
1232
+ }, "strip", z.ZodTypeAny, {
1233
+ type: "summarization_end";
1234
+ id: string;
1235
+ timestamp: number;
1236
+ conversation_id: string;
1237
+ turn_id: string;
1238
+ compressionRatio?: string | undefined;
1239
+ metadata?: Record<string, unknown> | undefined;
1240
+ originalMessages?: number | undefined;
1241
+ compressedMessages?: number | undefined;
1242
+ timeSaved?: string | undefined;
1243
+ }, {
1244
+ type: "summarization_end";
1245
+ id: string;
1246
+ timestamp: number;
1247
+ conversation_id: string;
1248
+ turn_id: string;
1249
+ compressionRatio?: string | undefined;
1250
+ metadata?: Record<string, unknown> | undefined;
1251
+ originalMessages?: number | undefined;
1252
+ compressedMessages?: number | undefined;
1253
+ timeSaved?: string | undefined;
1254
+ }>, z.ZodObject<{
1255
+ id: z.ZodString;
1256
+ timestamp: z.ZodNumber;
1257
+ conversation_id: z.ZodString;
1258
+ turn_id: z.ZodString;
1259
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1260
+ } & {
1261
+ type: z.ZodLiteral<"summarization_error">;
1262
+ error: z.ZodString;
1263
+ }, "strip", z.ZodTypeAny, {
1264
+ type: "summarization_error";
1265
+ id: string;
1266
+ timestamp: number;
1267
+ conversation_id: string;
1268
+ turn_id: string;
1269
+ error: string;
1270
+ metadata?: Record<string, unknown> | undefined;
1271
+ }, {
1272
+ type: "summarization_error";
1273
+ id: string;
1274
+ timestamp: number;
1275
+ conversation_id: string;
1276
+ turn_id: string;
1277
+ error: string;
1278
+ metadata?: Record<string, unknown> | undefined;
1279
+ }>]>;
1280
+ type SSEEvent = z.infer<typeof SSEEvent>;
1281
+ declare const validateSSEEvent: (event: unknown) => z.SafeParseReturnType<{
1282
+ type: "thought";
1283
+ id: string;
1284
+ timestamp: number;
1285
+ conversation_id: string;
1286
+ turn_id: string;
1287
+ content?: string | undefined;
1288
+ metadata?: Record<string, unknown> | undefined;
1289
+ thought_message_id?: string | undefined;
1290
+ delta?: string | undefined;
1291
+ is_complete?: boolean | undefined;
1292
+ } | {
1293
+ type: "final_answer_chunk";
1294
+ id: string;
1295
+ timestamp: number;
1296
+ conversation_id: string;
1297
+ turn_id: string;
1298
+ answer_id: string;
1299
+ seq: number;
1300
+ chunk: string;
1301
+ metadata?: Record<string, unknown> | undefined;
1302
+ is_last?: boolean | undefined;
1303
+ } | {
1304
+ type: "final_answer";
1305
+ id: string;
1306
+ content: string;
1307
+ timestamp: number;
1308
+ conversation_id: string;
1309
+ turn_id: string;
1310
+ answer_id: string;
1311
+ metadata?: Record<string, unknown> | undefined;
1312
+ meta?: Record<string, any> | undefined;
1313
+ } | {
1314
+ type: "markdown_chunk";
1315
+ id: string;
1316
+ timestamp: number;
1317
+ conversation_id: string;
1318
+ turn_id: string;
1319
+ text: string;
1320
+ metadata?: Record<string, unknown> | undefined;
1321
+ seq?: number | undefined;
1322
+ content_type?: "code" | "image" | "text" | "table" | undefined;
1323
+ } | {
1324
+ type: "tool_call_decision";
1325
+ status: "error" | "loading" | "success";
1326
+ id: string;
1327
+ tool_name: string;
1328
+ tool_call_id: string;
1329
+ timestamp: number;
1330
+ conversation_id: string;
1331
+ turn_id: string;
1332
+ phase: "start" | "update" | "complete" | "error";
1333
+ args?: any;
1334
+ metadata?: Record<string, unknown> | undefined;
1335
+ payload?: any;
1336
+ meta?: Record<string, any> | undefined;
1337
+ } | {
1338
+ type: "tool_process";
1339
+ status: "error" | "loading" | "success";
1340
+ id: string;
1341
+ tool_name: string;
1342
+ tool_call_id: string;
1343
+ timestamp: number;
1344
+ conversation_id: string;
1345
+ turn_id: string;
1346
+ phase: "start" | "update" | "complete" | "error";
1347
+ args?: any;
1348
+ metadata?: Record<string, unknown> | undefined;
1349
+ payload?: any;
1350
+ meta?: Record<string, any> | undefined;
1351
+ } | {
1352
+ type: "tool_output";
1353
+ status: "error" | "success";
1354
+ id: string;
1355
+ tool_name: string;
1356
+ tool_call_id: string;
1357
+ timestamp: number;
1358
+ conversation_id: string;
1359
+ turn_id: string;
1360
+ metadata?: Record<string, unknown> | undefined;
1361
+ payload?: Record<string, any> | undefined;
1362
+ output?: any;
1363
+ duration_ms?: number | undefined;
1364
+ } | {
1365
+ type: "todo_updated";
1366
+ id: string;
1367
+ timestamp: number;
1368
+ conversation_id: string;
1369
+ turn_id: string;
1370
+ todo_list_id: string;
1371
+ todo_list_version: number;
1372
+ items: {
1373
+ status: "in_progress" | "completed" | "cancelled" | "pending";
1374
+ id: string;
1375
+ content: string;
1376
+ }[];
1377
+ metadata?: Record<string, unknown> | undefined;
1378
+ } | {
1379
+ type: "subrun_trace";
1380
+ id: string;
1381
+ timestamp: number;
1382
+ kind: "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
1383
+ conversation_id: string;
1384
+ turn_id: string;
1385
+ parent_tool_call_id: string;
1386
+ subrun_id: string;
1387
+ status?: "error" | "loading" | "success" | undefined;
1388
+ tool_name?: string | undefined;
1389
+ args?: unknown;
1390
+ tool_call_id?: string | undefined;
1391
+ content?: string | undefined;
1392
+ metadata?: Record<string, unknown> | undefined;
1393
+ delta?: string | undefined;
1394
+ phase?: "start" | "update" | "complete" | "error" | undefined;
1395
+ meta?: Record<string, unknown> | undefined;
1396
+ output?: unknown;
1397
+ duration_ms?: number | undefined;
1398
+ subrun_parent_id?: string | undefined;
1399
+ } | {
1400
+ type: "requires_user_interaction";
1401
+ id: string;
1402
+ timestamp: number;
1403
+ conversation_id: string;
1404
+ turn_id: string;
1405
+ metadata?: Record<string, unknown> | undefined;
1406
+ form?: any;
1407
+ interaction_type?: string | undefined;
1408
+ prompt?: string | undefined;
1409
+ } | {
1410
+ type: "error";
1411
+ id: string;
1412
+ timestamp: number;
1413
+ conversation_id: string;
1414
+ turn_id: string;
1415
+ error: string;
1416
+ metadata?: Record<string, unknown> | undefined;
1417
+ details?: any;
1418
+ error_code?: string | undefined;
1419
+ retryable?: boolean | undefined;
1420
+ } | {
1421
+ type: "stream_end";
1422
+ id: string;
1423
+ timestamp: number;
1424
+ conversation_id: string;
1425
+ turn_id: string;
1426
+ metadata?: Record<string, unknown> | undefined;
1427
+ reason?: "complete" | "error" | "interrupted" | "timeout" | undefined;
1428
+ reason_message?: string | undefined;
1429
+ stats?: {
1430
+ duration_ms?: number | undefined;
1431
+ total_events?: number | undefined;
1432
+ error_count?: number | undefined;
1433
+ benchmark?: Record<string, unknown> | undefined;
1434
+ } | undefined;
1435
+ } | {
1436
+ type: "history_summary";
1437
+ id: string;
1438
+ content: string;
1439
+ timestamp: number;
1440
+ conversation_id: string;
1441
+ turn_id: string;
1442
+ summary_seq: number;
1443
+ original_message_count: number;
1444
+ summary_id: string;
1445
+ metadata?: Record<string, unknown> | undefined;
1446
+ } | {
1447
+ type: "summarization_start";
1448
+ id: string;
1449
+ timestamp: number;
1450
+ conversation_id: string;
1451
+ turn_id: string;
1452
+ metadata?: Record<string, unknown> | undefined;
1453
+ originalMessages?: number | undefined;
1454
+ } | {
1455
+ type: "summarization_end";
1456
+ id: string;
1457
+ timestamp: number;
1458
+ conversation_id: string;
1459
+ turn_id: string;
1460
+ compressionRatio?: string | undefined;
1461
+ metadata?: Record<string, unknown> | undefined;
1462
+ originalMessages?: number | undefined;
1463
+ compressedMessages?: number | undefined;
1464
+ timeSaved?: string | undefined;
1465
+ } | {
1466
+ type: "summarization_error";
1467
+ id: string;
1468
+ timestamp: number;
1469
+ conversation_id: string;
1470
+ turn_id: string;
1471
+ error: string;
1472
+ metadata?: Record<string, unknown> | undefined;
1473
+ }, {
1474
+ type: "thought";
1475
+ id: string;
1476
+ timestamp: number;
1477
+ conversation_id: string;
1478
+ turn_id: string;
1479
+ is_complete: boolean;
1480
+ content?: string | undefined;
1481
+ metadata?: Record<string, unknown> | undefined;
1482
+ thought_message_id?: string | undefined;
1483
+ delta?: string | undefined;
1484
+ } | {
1485
+ type: "final_answer_chunk";
1486
+ id: string;
1487
+ timestamp: number;
1488
+ conversation_id: string;
1489
+ turn_id: string;
1490
+ answer_id: string;
1491
+ seq: number;
1492
+ chunk: string;
1493
+ metadata?: Record<string, unknown> | undefined;
1494
+ is_last?: boolean | undefined;
1495
+ } | {
1496
+ type: "final_answer";
1497
+ id: string;
1498
+ content: string;
1499
+ timestamp: number;
1500
+ conversation_id: string;
1501
+ turn_id: string;
1502
+ answer_id: string;
1503
+ metadata?: Record<string, unknown> | undefined;
1504
+ meta?: Record<string, any> | undefined;
1505
+ } | {
1506
+ type: "markdown_chunk";
1507
+ id: string;
1508
+ timestamp: number;
1509
+ conversation_id: string;
1510
+ turn_id: string;
1511
+ text: string;
1512
+ content_type: "code" | "image" | "text" | "table";
1513
+ metadata?: Record<string, unknown> | undefined;
1514
+ seq?: number | undefined;
1515
+ } | {
1516
+ type: "tool_call_decision";
1517
+ status: "error" | "loading" | "success";
1518
+ id: string;
1519
+ tool_name: string;
1520
+ tool_call_id: string;
1521
+ timestamp: number;
1522
+ conversation_id: string;
1523
+ turn_id: string;
1524
+ phase: "start" | "update" | "complete" | "error";
1525
+ args?: any;
1526
+ metadata?: Record<string, unknown> | undefined;
1527
+ payload?: any;
1528
+ meta?: Record<string, any> | undefined;
1529
+ } | {
1530
+ type: "tool_process";
1531
+ status: "error" | "loading" | "success";
1532
+ id: string;
1533
+ tool_name: string;
1534
+ tool_call_id: string;
1535
+ timestamp: number;
1536
+ conversation_id: string;
1537
+ turn_id: string;
1538
+ phase: "start" | "update" | "complete" | "error";
1539
+ args?: any;
1540
+ metadata?: Record<string, unknown> | undefined;
1541
+ payload?: any;
1542
+ meta?: Record<string, any> | undefined;
1543
+ } | {
1544
+ type: "tool_output";
1545
+ status: "error" | "success";
1546
+ id: string;
1547
+ tool_name: string;
1548
+ tool_call_id: string;
1549
+ timestamp: number;
1550
+ conversation_id: string;
1551
+ turn_id: string;
1552
+ metadata?: Record<string, unknown> | undefined;
1553
+ payload?: Record<string, any> | undefined;
1554
+ output?: any;
1555
+ duration_ms?: number | undefined;
1556
+ } | {
1557
+ type: "todo_updated";
1558
+ id: string;
1559
+ timestamp: number;
1560
+ conversation_id: string;
1561
+ turn_id: string;
1562
+ todo_list_id: string;
1563
+ todo_list_version: number;
1564
+ items: {
1565
+ status: "in_progress" | "completed" | "cancelled" | "pending";
1566
+ id: string;
1567
+ content: string;
1568
+ }[];
1569
+ metadata?: Record<string, unknown> | undefined;
1570
+ } | {
1571
+ type: "subrun_trace";
1572
+ id: string;
1573
+ timestamp: number;
1574
+ kind: "final_answer" | "tool_output" | "tool_call_decision" | "tool_process" | "thought_delta" | "thought_complete" | "final_answer_chunk";
1575
+ conversation_id: string;
1576
+ turn_id: string;
1577
+ parent_tool_call_id: string;
1578
+ subrun_id: string;
1579
+ status?: "error" | "loading" | "success" | undefined;
1580
+ tool_name?: string | undefined;
1581
+ args?: unknown;
1582
+ tool_call_id?: string | undefined;
1583
+ content?: string | undefined;
1584
+ metadata?: Record<string, unknown> | undefined;
1585
+ delta?: string | undefined;
1586
+ phase?: "start" | "update" | "complete" | "error" | undefined;
1587
+ meta?: Record<string, unknown> | undefined;
1588
+ output?: unknown;
1589
+ duration_ms?: number | undefined;
1590
+ subrun_parent_id?: string | undefined;
1591
+ } | {
1592
+ type: "requires_user_interaction";
1593
+ id: string;
1594
+ timestamp: number;
1595
+ conversation_id: string;
1596
+ turn_id: string;
1597
+ metadata?: Record<string, unknown> | undefined;
1598
+ form?: any;
1599
+ interaction_type?: string | undefined;
1600
+ prompt?: string | undefined;
1601
+ } | {
1602
+ type: "error";
1603
+ id: string;
1604
+ timestamp: number;
1605
+ conversation_id: string;
1606
+ turn_id: string;
1607
+ error: string;
1608
+ metadata?: Record<string, unknown> | undefined;
1609
+ details?: any;
1610
+ error_code?: string | undefined;
1611
+ retryable?: boolean | undefined;
1612
+ } | {
1613
+ type: "stream_end";
1614
+ id: string;
1615
+ timestamp: number;
1616
+ conversation_id: string;
1617
+ turn_id: string;
1618
+ metadata?: Record<string, unknown> | undefined;
1619
+ reason?: "complete" | "error" | "interrupted" | "timeout" | undefined;
1620
+ reason_message?: string | undefined;
1621
+ stats?: {
1622
+ duration_ms?: number | undefined;
1623
+ total_events?: number | undefined;
1624
+ error_count?: number | undefined;
1625
+ benchmark?: Record<string, unknown> | undefined;
1626
+ } | undefined;
1627
+ } | {
1628
+ type: "history_summary";
1629
+ id: string;
1630
+ content: string;
1631
+ timestamp: number;
1632
+ conversation_id: string;
1633
+ turn_id: string;
1634
+ summary_seq: number;
1635
+ original_message_count: number;
1636
+ summary_id: string;
1637
+ metadata?: Record<string, unknown> | undefined;
1638
+ } | {
1639
+ type: "summarization_start";
1640
+ id: string;
1641
+ timestamp: number;
1642
+ conversation_id: string;
1643
+ turn_id: string;
1644
+ metadata?: Record<string, unknown> | undefined;
1645
+ originalMessages?: number | undefined;
1646
+ } | {
1647
+ type: "summarization_end";
1648
+ id: string;
1649
+ timestamp: number;
1650
+ conversation_id: string;
1651
+ turn_id: string;
1652
+ compressionRatio?: string | undefined;
1653
+ metadata?: Record<string, unknown> | undefined;
1654
+ originalMessages?: number | undefined;
1655
+ compressedMessages?: number | undefined;
1656
+ timeSaved?: string | undefined;
1657
+ } | {
1658
+ type: "summarization_error";
1659
+ id: string;
1660
+ timestamp: number;
1661
+ conversation_id: string;
1662
+ turn_id: string;
1663
+ error: string;
1664
+ metadata?: Record<string, unknown> | undefined;
1665
+ }>;
1666
+ declare const createSSEThoughtEvent: (id: string, conversationId: string, turnId: string, options?: {
1667
+ thought_message_id?: string;
1668
+ delta?: string;
1669
+ content?: string;
1670
+ is_complete?: boolean;
1671
+ }) => SSEThoughtEvent;
1672
+ declare const createSSEFinalAnswerChunkEvent: (id: string, conversationId: string, turnId: string, answerId: string, seq: number, chunk: string, options?: {
1673
+ is_last?: boolean;
1674
+ }) => SSEFinalAnswerChunkEvent;
1675
+ declare const createSSEFinalAnswerEvent: (id: string, conversationId: string, turnId: string, answerId: string, content: string, options?: Partial<SSEFinalAnswerEvent>) => SSEFinalAnswerEvent;
1676
+ declare const createSSEMarkdownChunkEvent: (id: string, conversationId: string, turnId: string, text: string, options?: Partial<SSEMarkdownChunkEvent>) => SSEMarkdownChunkEvent;
1677
+ declare const createSSEToolCallDecisionEvent: (id: string, conversationId: string, turnId: string, toolName: string, toolCallId: string, phase: SSEToolCallDecisionEvent["phase"], status: SSEToolCallDecisionEvent["status"], options?: Partial<SSEToolCallDecisionEvent>) => SSEToolCallDecisionEvent;
1678
+ declare const createSSEToolProcessEvent: (id: string, conversationId: string, turnId: string, toolName: string, toolCallId: string, phase: SSEToolProcessEvent["phase"], status: SSEToolProcessEvent["status"], options?: Partial<SSEToolProcessEvent>) => SSEToolProcessEvent;
1679
+ declare const createSSEToolOutputEvent: (id: string, conversationId: string, turnId: string, toolName: string, toolCallId: string, status: SSEToolOutputEvent["status"], output: unknown, options?: Partial<SSEToolOutputEvent>) => SSEToolOutputEvent;
1680
+ declare const createSSETodoUpdatedEvent: (id: string, conversationId: string, turnId: string, todoListId: string, todoListVersion: number, items: SSETodoUpdatedEvent["items"], options?: Partial<SSETodoUpdatedEvent>) => SSETodoUpdatedEvent;
1681
+ declare const createSSESubRunTraceEvent: (id: string, conversationId: string, turnId: string, parentToolCallId: string, subrunId: string, kind: SSESubRunTraceEvent["kind"], options?: Partial<SSESubRunTraceEvent>) => SSESubRunTraceEvent;
1682
+ declare const createSSERequiresUserInteractionEvent: (id: string, conversationId: string, turnId: string, options?: Partial<SSERequiresUserInteractionEvent>) => SSERequiresUserInteractionEvent;
1683
+ declare const createSSEErrorEvent: (id: string, conversationId: string, turnId: string, error: string, options?: Partial<SSEErrorEvent>) => SSEErrorEvent;
1684
+ declare const createSSEStreamEndEvent: (id: string, conversationId: string, turnId: string, options?: Partial<SSEStreamEndEvent>) => SSEStreamEndEvent;
1685
+ declare const createSSEHistorySummaryEvent: (id: string, conversationId: string, turnId: string, summaryId: string, content: string, originalMessageCount: number, summarySeq: number, options?: Partial<SSEHistorySummaryEvent>) => SSEHistorySummaryEvent;
1686
+
1687
+ export { createSSEToolCallDecisionEvent as A, BaseSSEEvent as B, createSSEToolOutputEvent as C, createSSEToolProcessEvent as D, validateSSEEvent as E, SSEErrorEvent as S, SSEEvent as a, SSEFinalAnswerChunkEvent as b, SSEFinalAnswerEvent as c, SSEHistorySummaryEvent as d, SSEMarkdownChunkEvent as e, SSERequiresUserInteractionEvent as f, SSEStreamEndEvent as g, SSESubRunTraceEvent as h, SSESummarizationEndEvent as i, SSESummarizationErrorEvent as j, SSESummarizationStartEvent as k, SSEThoughtEvent as l, SSETodoUpdatedEvent as m, SSEToolCallDecisionEvent as n, SSEToolOutputEvent as o, SSEToolProcessEvent as p, createSSEErrorEvent as q, createSSEFinalAnswerChunkEvent as r, createSSEFinalAnswerEvent as s, createSSEHistorySummaryEvent as t, createSSEMarkdownChunkEvent as u, createSSERequiresUserInteractionEvent as v, createSSEStreamEndEvent as w, createSSESubRunTraceEvent as x, createSSEThoughtEvent as y, createSSETodoUpdatedEvent as z };