@runtypelabs/persona 3.26.0 → 3.27.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.
@@ -0,0 +1,1249 @@
1
+ /* eslint-disable */
2
+ // @generated by packages/widget/scripts/generate-runtype-openapi-types.mjs
3
+ // Source: openapi/runtype-public-openapi.local.json
4
+ //
5
+ // Refresh the source snapshot from the public Runtype OpenAPI endpoint with:
6
+ // pnpm --filter @runtypelabs/persona fetch:runtype-openapi
7
+ // Then regenerate this file with:
8
+ // pnpm --filter @runtypelabs/persona generate:runtype-types
9
+
10
+ export type RuntypeAgentSSEEvent = {
11
+ agentId: string;
12
+ agentName: string;
13
+ config?: {
14
+ enableReflection?: boolean;
15
+ model?: string;
16
+ };
17
+ executionId: string;
18
+ maxTurns: number;
19
+ seq: number;
20
+ startedAt: string;
21
+ type: "agent_start";
22
+ } | {
23
+ executionId: string;
24
+ iteration: number;
25
+ maxTurns: number;
26
+ seq: number;
27
+ startedAt: string;
28
+ totalCost?: number;
29
+ type: "agent_iteration_start";
30
+ } | ({
31
+ executionId: string;
32
+ iteration: number;
33
+ role: "user" | "assistant" | "system";
34
+ seq: number;
35
+ turnId: string;
36
+ turnIndex: number;
37
+ type: "agent_turn_start";
38
+ }) | ({
39
+ contentType: "text" | "thinking" | "tool_input";
40
+ delta: string;
41
+ executionId: string;
42
+ iteration: number;
43
+ seq: number;
44
+ turnId: string;
45
+ type: "agent_turn_delta";
46
+ }) | ({
47
+ completedAt: string;
48
+ content?: string;
49
+ cost?: number;
50
+ estimatedContextBreakdown?: {
51
+ categories: Record<string, {
52
+ chars: number;
53
+ estimatedTokens: number;
54
+ }>;
55
+ contextWindowSize?: number;
56
+ estimatedTotalTokens: number;
57
+ estimatedUtilizationPercent?: number;
58
+ };
59
+ executionId: string;
60
+ iteration: number;
61
+ role: "user" | "assistant" | "system";
62
+ seq: number;
63
+ stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
64
+ tokens?: {
65
+ input: number;
66
+ output: number;
67
+ };
68
+ turnId: string;
69
+ type: "agent_turn_complete";
70
+ }) | ({
71
+ executionId: string;
72
+ iteration: number;
73
+ origin?: "webmcp" | "sdk";
74
+ pageOrigin?: string;
75
+ parameters?: Record<string, unknown>;
76
+ seq: number;
77
+ toolCallId: string;
78
+ toolName: string;
79
+ toolType: "flow" | "mcp" | "builtin" | "custom" | "external" | "advisor" | "subagent" | "local";
80
+ type: "agent_tool_start";
81
+ }) | {
82
+ delta: string;
83
+ executionId: string;
84
+ iteration: number;
85
+ seq: number;
86
+ toolCallId: string;
87
+ type: "agent_tool_delta";
88
+ } | {
89
+ delta: string;
90
+ executionId: string;
91
+ iteration: number;
92
+ seq: number;
93
+ toolCallId: string;
94
+ type: "agent_tool_input_delta";
95
+ } | {
96
+ executionId: string;
97
+ hiddenParameterNames?: Array<string>;
98
+ iteration: number;
99
+ parameters: Record<string, unknown>;
100
+ seq: number;
101
+ toolCallId: string;
102
+ toolName: string;
103
+ type: "agent_tool_input_complete";
104
+ } | {
105
+ executionId: string;
106
+ executionTime?: number;
107
+ iteration: number;
108
+ result?: unknown;
109
+ seq: number;
110
+ success: boolean;
111
+ toolCallId: string;
112
+ toolName: string;
113
+ type: "agent_tool_complete";
114
+ } | ({
115
+ executionId?: string;
116
+ iteration: number;
117
+ media: Array<({
118
+ annotations?: {
119
+ audience?: Array<"user" | "assistant">;
120
+ };
121
+ data: string;
122
+ mediaType: string;
123
+ type: "media";
124
+ }) | ({
125
+ annotations?: {
126
+ audience?: Array<"user" | "assistant">;
127
+ };
128
+ mediaType?: string;
129
+ type: "image-url";
130
+ url: string;
131
+ }) | ({
132
+ annotations?: {
133
+ audience?: Array<"user" | "assistant">;
134
+ };
135
+ mediaType: string;
136
+ type: "file-url";
137
+ url: string;
138
+ })>;
139
+ seq?: number;
140
+ toolCallId: string;
141
+ toolName: string;
142
+ type: "agent_media";
143
+ }) | {
144
+ approvalId: string;
145
+ description: string;
146
+ executionId: string;
147
+ externalAgent?: {
148
+ contextId?: string;
149
+ taskId?: string;
150
+ };
151
+ iteration?: number;
152
+ parameters?: Record<string, unknown>;
153
+ seq: number;
154
+ startedAt: string;
155
+ timeout: number;
156
+ toolCallId: string;
157
+ toolName: string;
158
+ toolType: string;
159
+ type: "agent_approval_start";
160
+ } | ({
161
+ approvalId: string;
162
+ completedAt: string;
163
+ decision: "approved" | "denied" | "timeout";
164
+ executionId: string;
165
+ resolvedBy: "user" | "system";
166
+ seq: number;
167
+ type: "agent_approval_complete";
168
+ }) | ({
169
+ awaitedAt: string;
170
+ executionId: string;
171
+ origin?: "webmcp" | "sdk";
172
+ pageOrigin?: string;
173
+ parameters?: Record<string, unknown>;
174
+ seq: number;
175
+ toolCallId?: string;
176
+ toolId: string;
177
+ toolName: string;
178
+ type: "agent_await";
179
+ }) | {
180
+ completedAt: string;
181
+ cost?: number;
182
+ duration?: number;
183
+ estimatedContextBreakdown?: {
184
+ categories: Record<string, {
185
+ chars: number;
186
+ estimatedTokens: number;
187
+ }>;
188
+ contextWindowSize?: number;
189
+ estimatedTotalTokens: number;
190
+ estimatedUtilizationPercent?: number;
191
+ };
192
+ executionId: string;
193
+ iteration: number;
194
+ output?: string;
195
+ runningTotalCost?: number;
196
+ seq: number;
197
+ stopConditionMet: boolean;
198
+ tokens?: {
199
+ input: number;
200
+ output: number;
201
+ };
202
+ toolCallsMade: number;
203
+ type: "agent_iteration_complete";
204
+ } | {
205
+ executionId: string;
206
+ iteration: number;
207
+ reflection?: string;
208
+ seq: number;
209
+ type: "agent_reflection";
210
+ } | {
211
+ activatedCapabilities: Array<string>;
212
+ executionId: string;
213
+ iteration: number;
214
+ seq: number;
215
+ skill: string;
216
+ toolCallId: string;
217
+ type: "agent_skill_loaded";
218
+ } | ({
219
+ executionId: string;
220
+ iteration: number;
221
+ outcome: "pending_approval" | "auto_published";
222
+ proposalId?: string;
223
+ seq: number;
224
+ skill: string;
225
+ toolCallId: string;
226
+ type: "agent_skill_proposed";
227
+ }) | ({
228
+ agentId: string;
229
+ completedAt: string;
230
+ duration?: number;
231
+ error?: string;
232
+ executionId: string;
233
+ externalAgent?: {
234
+ contextId?: string;
235
+ taskId?: string;
236
+ };
237
+ finalOutput?: string;
238
+ iterations: number;
239
+ seq: number;
240
+ stopReason: "complete" | "end_turn" | "max_turns" | "max_cost" | "timeout" | "error";
241
+ success: boolean;
242
+ totalCost?: number;
243
+ totalTokens?: {
244
+ input: number;
245
+ output: number;
246
+ };
247
+ type: "agent_complete";
248
+ }) | {
249
+ error: {
250
+ code: string;
251
+ details?: Record<string, unknown>;
252
+ message: string;
253
+ };
254
+ executionId: string;
255
+ iteration?: number;
256
+ recoverable: boolean;
257
+ seq: number;
258
+ type: "agent_error";
259
+ } | {
260
+ executionId: string;
261
+ seq: number;
262
+ timestamp: string;
263
+ type: "agent_ping";
264
+ };
265
+
266
+ export type RuntypeFlowSSEEvent = {
267
+ executionContext?: Record<string, unknown>;
268
+ executionId?: string;
269
+ flowId: string;
270
+ flowName?: string;
271
+ input?: unknown;
272
+ seq?: number;
273
+ source?: string;
274
+ startedAt: string;
275
+ toolContext?: {
276
+ executionId: string;
277
+ stepId: string;
278
+ toolId: string;
279
+ };
280
+ totalSteps?: number;
281
+ type: "flow_start";
282
+ } | {
283
+ completedAt?: string;
284
+ completedSteps?: number;
285
+ duration?: number;
286
+ executionContext?: Record<string, unknown>;
287
+ executionId?: string;
288
+ executionTime?: number;
289
+ failedSteps?: number;
290
+ finalOutput?: string;
291
+ flowId?: string;
292
+ output?: unknown;
293
+ seq?: number;
294
+ source?: string;
295
+ success?: boolean;
296
+ successfulSteps?: number;
297
+ toolContext?: {
298
+ executionId: string;
299
+ stepId: string;
300
+ toolId: string;
301
+ };
302
+ totalSteps?: number;
303
+ totalTokensUsed?: number;
304
+ type: "flow_complete";
305
+ } | ({
306
+ code?: string;
307
+ error: string | {
308
+ code: string;
309
+ message: string;
310
+ stepId?: string;
311
+ stepType?: string;
312
+ };
313
+ executionId?: string;
314
+ executionTime?: number;
315
+ flowId?: string;
316
+ seq?: number;
317
+ timestamp?: string;
318
+ toolContext?: {
319
+ executionId: string;
320
+ stepId: string;
321
+ toolId: string;
322
+ };
323
+ type: "flow_error";
324
+ upgradeUrl?: string;
325
+ }) | ({
326
+ awaitedAt: string;
327
+ executionId?: string;
328
+ flowId: string;
329
+ origin?: "webmcp" | "sdk";
330
+ pageOrigin?: string;
331
+ parameters?: Record<string, unknown>;
332
+ seq?: number;
333
+ toolCallId?: string;
334
+ toolId?: string;
335
+ toolName?: string;
336
+ type: "flow_await";
337
+ }) | {
338
+ estimatedTokens?: number;
339
+ executionId?: string;
340
+ id?: string;
341
+ index?: number;
342
+ name?: string;
343
+ seq?: number;
344
+ startedAt: string;
345
+ stepId?: string;
346
+ stepName?: string;
347
+ stepType?: string;
348
+ toolContext?: {
349
+ executionId: string;
350
+ stepId: string;
351
+ toolId: string;
352
+ };
353
+ totalSteps?: number;
354
+ type: "step_start";
355
+ } | {
356
+ delta?: string;
357
+ executionId?: string;
358
+ id?: string;
359
+ messageId?: string;
360
+ partId?: string;
361
+ seq?: number;
362
+ text?: string;
363
+ toolContext?: {
364
+ executionId: string;
365
+ stepId: string;
366
+ toolId: string;
367
+ };
368
+ toolId?: string;
369
+ type: "step_delta";
370
+ } | ({
371
+ completedAt?: string;
372
+ duration?: number;
373
+ durationMs?: number;
374
+ error?: string;
375
+ executionId?: string;
376
+ executionTime?: number;
377
+ id?: string;
378
+ index?: number;
379
+ name?: string;
380
+ output?: unknown;
381
+ result?: unknown;
382
+ seq?: number;
383
+ stepId?: string;
384
+ stepName?: string;
385
+ stepType?: string;
386
+ stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
387
+ success?: boolean;
388
+ tokensUsed?: number;
389
+ toolContext?: {
390
+ executionId: string;
391
+ stepId: string;
392
+ toolId: string;
393
+ };
394
+ type: "step_complete";
395
+ }) | {
396
+ error: string;
397
+ executionId?: string;
398
+ executionTime?: number;
399
+ id?: string;
400
+ index?: number;
401
+ name?: string;
402
+ seq?: number;
403
+ stepType?: string;
404
+ type: "step_error";
405
+ } | {
406
+ error?: string;
407
+ executionId?: string;
408
+ id: string;
409
+ index?: number;
410
+ name?: string;
411
+ seq?: number;
412
+ skippedAt: string;
413
+ stepType: string;
414
+ totalSteps: number;
415
+ type: "step_skip";
416
+ when: string;
417
+ } | {
418
+ executionId?: string;
419
+ seq?: number;
420
+ type: "step_await";
421
+ [key: string]: unknown;
422
+ } | ({
423
+ agentContext?: {
424
+ executionId: string;
425
+ iteration: number;
426
+ seq: number;
427
+ };
428
+ executionId?: string;
429
+ hiddenParameterNames?: Array<string>;
430
+ name?: string;
431
+ parameters?: Record<string, unknown>;
432
+ providerOptions?: Record<string, unknown>;
433
+ seq?: number;
434
+ startedAt?: string;
435
+ stepId?: string;
436
+ toolCallId?: string;
437
+ toolId?: string;
438
+ toolName?: string;
439
+ toolType: "flow" | "mcp" | "builtin" | "custom" | "external" | "advisor" | "subagent" | "local";
440
+ type: "tool_start";
441
+ [key: string]: unknown;
442
+ }) | {
443
+ delta?: string;
444
+ executionId?: string;
445
+ seq?: number;
446
+ toolId?: string;
447
+ type: "tool_delta";
448
+ [key: string]: unknown;
449
+ } | {
450
+ delta: string;
451
+ executionId?: string;
452
+ seq?: number;
453
+ stepId?: string;
454
+ toolCallId?: string;
455
+ toolId?: string;
456
+ type: "tool_input_delta";
457
+ } | {
458
+ executionId?: string;
459
+ hiddenParameterNames?: Array<string>;
460
+ parameters: Record<string, unknown>;
461
+ providerOptions?: Record<string, unknown>;
462
+ seq?: number;
463
+ stepId?: string;
464
+ toolCallId?: string;
465
+ toolId?: string;
466
+ toolName?: string;
467
+ type: "tool_input_complete";
468
+ } | {
469
+ agentContext?: {
470
+ executionId: string;
471
+ iteration: number;
472
+ seq: number;
473
+ };
474
+ completedAt?: string;
475
+ error?: string;
476
+ executionId?: string;
477
+ executionTime?: number;
478
+ name?: string;
479
+ result?: unknown;
480
+ seq?: number;
481
+ stepId?: string;
482
+ success: boolean;
483
+ toolCallId?: string;
484
+ toolCost?: number;
485
+ toolId?: string;
486
+ toolName?: string;
487
+ type: "tool_complete";
488
+ } | {
489
+ agentContext?: {
490
+ executionId: string;
491
+ iteration: number;
492
+ seq: number;
493
+ };
494
+ error: string;
495
+ executionId?: string;
496
+ executionTime?: number;
497
+ failedAt?: string;
498
+ name: string;
499
+ seq?: number;
500
+ toolId: string;
501
+ type: "tool_error";
502
+ } | {
503
+ executionId?: string;
504
+ id: string;
505
+ seq?: number;
506
+ text: string;
507
+ type: "chunk";
508
+ } | {
509
+ executionId?: string;
510
+ seq?: number;
511
+ type: "text_start";
512
+ [key: string]: unknown;
513
+ } | {
514
+ executionId?: string;
515
+ seq?: number;
516
+ type: "text_end";
517
+ [key: string]: unknown;
518
+ } | {
519
+ executionId?: string;
520
+ seq?: number;
521
+ type: "reason_start";
522
+ [key: string]: unknown;
523
+ } | {
524
+ executionId?: string;
525
+ seq?: number;
526
+ type: "reason_delta";
527
+ [key: string]: unknown;
528
+ } | {
529
+ executionId?: string;
530
+ seq?: number;
531
+ type: "reason_complete";
532
+ [key: string]: unknown;
533
+ } | {
534
+ executionId?: string;
535
+ seq?: number;
536
+ type: "source";
537
+ [key: string]: unknown;
538
+ } | {
539
+ executionId?: string;
540
+ seq?: number;
541
+ type: "fallback_start";
542
+ [key: string]: unknown;
543
+ } | {
544
+ executionId?: string;
545
+ seq?: number;
546
+ type: "fallback_complete";
547
+ [key: string]: unknown;
548
+ } | {
549
+ executionId?: string;
550
+ seq?: number;
551
+ type: "fallback_exhausted";
552
+ [key: string]: unknown;
553
+ };
554
+
555
+ export type RuntypeDispatchSSEEvent = {
556
+ agentId: string;
557
+ agentName: string;
558
+ config?: {
559
+ enableReflection?: boolean;
560
+ model?: string;
561
+ };
562
+ executionId: string;
563
+ maxTurns: number;
564
+ seq: number;
565
+ startedAt: string;
566
+ type: "agent_start";
567
+ } | {
568
+ executionId: string;
569
+ iteration: number;
570
+ maxTurns: number;
571
+ seq: number;
572
+ startedAt: string;
573
+ totalCost?: number;
574
+ type: "agent_iteration_start";
575
+ } | ({
576
+ executionId: string;
577
+ iteration: number;
578
+ role: "user" | "assistant" | "system";
579
+ seq: number;
580
+ turnId: string;
581
+ turnIndex: number;
582
+ type: "agent_turn_start";
583
+ }) | ({
584
+ contentType: "text" | "thinking" | "tool_input";
585
+ delta: string;
586
+ executionId: string;
587
+ iteration: number;
588
+ seq: number;
589
+ turnId: string;
590
+ type: "agent_turn_delta";
591
+ }) | ({
592
+ completedAt: string;
593
+ content?: string;
594
+ cost?: number;
595
+ estimatedContextBreakdown?: {
596
+ categories: Record<string, {
597
+ chars: number;
598
+ estimatedTokens: number;
599
+ }>;
600
+ contextWindowSize?: number;
601
+ estimatedTotalTokens: number;
602
+ estimatedUtilizationPercent?: number;
603
+ };
604
+ executionId: string;
605
+ iteration: number;
606
+ role: "user" | "assistant" | "system";
607
+ seq: number;
608
+ stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
609
+ tokens?: {
610
+ input: number;
611
+ output: number;
612
+ };
613
+ turnId: string;
614
+ type: "agent_turn_complete";
615
+ }) | ({
616
+ executionId: string;
617
+ iteration: number;
618
+ origin?: "webmcp" | "sdk";
619
+ pageOrigin?: string;
620
+ parameters?: Record<string, unknown>;
621
+ seq: number;
622
+ toolCallId: string;
623
+ toolName: string;
624
+ toolType: "flow" | "mcp" | "builtin" | "custom" | "external" | "advisor" | "subagent" | "local";
625
+ type: "agent_tool_start";
626
+ }) | {
627
+ delta: string;
628
+ executionId: string;
629
+ iteration: number;
630
+ seq: number;
631
+ toolCallId: string;
632
+ type: "agent_tool_delta";
633
+ } | {
634
+ delta: string;
635
+ executionId: string;
636
+ iteration: number;
637
+ seq: number;
638
+ toolCallId: string;
639
+ type: "agent_tool_input_delta";
640
+ } | {
641
+ executionId: string;
642
+ hiddenParameterNames?: Array<string>;
643
+ iteration: number;
644
+ parameters: Record<string, unknown>;
645
+ seq: number;
646
+ toolCallId: string;
647
+ toolName: string;
648
+ type: "agent_tool_input_complete";
649
+ } | {
650
+ executionId: string;
651
+ executionTime?: number;
652
+ iteration: number;
653
+ result?: unknown;
654
+ seq: number;
655
+ success: boolean;
656
+ toolCallId: string;
657
+ toolName: string;
658
+ type: "agent_tool_complete";
659
+ } | ({
660
+ executionId?: string;
661
+ iteration: number;
662
+ media: Array<({
663
+ annotations?: {
664
+ audience?: Array<"user" | "assistant">;
665
+ };
666
+ data: string;
667
+ mediaType: string;
668
+ type: "media";
669
+ }) | ({
670
+ annotations?: {
671
+ audience?: Array<"user" | "assistant">;
672
+ };
673
+ mediaType?: string;
674
+ type: "image-url";
675
+ url: string;
676
+ }) | ({
677
+ annotations?: {
678
+ audience?: Array<"user" | "assistant">;
679
+ };
680
+ mediaType: string;
681
+ type: "file-url";
682
+ url: string;
683
+ })>;
684
+ seq?: number;
685
+ toolCallId: string;
686
+ toolName: string;
687
+ type: "agent_media";
688
+ }) | {
689
+ approvalId: string;
690
+ description: string;
691
+ executionId: string;
692
+ externalAgent?: {
693
+ contextId?: string;
694
+ taskId?: string;
695
+ };
696
+ iteration?: number;
697
+ parameters?: Record<string, unknown>;
698
+ seq: number;
699
+ startedAt: string;
700
+ timeout: number;
701
+ toolCallId: string;
702
+ toolName: string;
703
+ toolType: string;
704
+ type: "agent_approval_start";
705
+ } | ({
706
+ approvalId: string;
707
+ completedAt: string;
708
+ decision: "approved" | "denied" | "timeout";
709
+ executionId: string;
710
+ resolvedBy: "user" | "system";
711
+ seq: number;
712
+ type: "agent_approval_complete";
713
+ }) | ({
714
+ awaitedAt: string;
715
+ executionId: string;
716
+ origin?: "webmcp" | "sdk";
717
+ pageOrigin?: string;
718
+ parameters?: Record<string, unknown>;
719
+ seq: number;
720
+ toolCallId?: string;
721
+ toolId: string;
722
+ toolName: string;
723
+ type: "agent_await";
724
+ }) | {
725
+ completedAt: string;
726
+ cost?: number;
727
+ duration?: number;
728
+ estimatedContextBreakdown?: {
729
+ categories: Record<string, {
730
+ chars: number;
731
+ estimatedTokens: number;
732
+ }>;
733
+ contextWindowSize?: number;
734
+ estimatedTotalTokens: number;
735
+ estimatedUtilizationPercent?: number;
736
+ };
737
+ executionId: string;
738
+ iteration: number;
739
+ output?: string;
740
+ runningTotalCost?: number;
741
+ seq: number;
742
+ stopConditionMet: boolean;
743
+ tokens?: {
744
+ input: number;
745
+ output: number;
746
+ };
747
+ toolCallsMade: number;
748
+ type: "agent_iteration_complete";
749
+ } | {
750
+ executionId: string;
751
+ iteration: number;
752
+ reflection?: string;
753
+ seq: number;
754
+ type: "agent_reflection";
755
+ } | {
756
+ activatedCapabilities: Array<string>;
757
+ executionId: string;
758
+ iteration: number;
759
+ seq: number;
760
+ skill: string;
761
+ toolCallId: string;
762
+ type: "agent_skill_loaded";
763
+ } | ({
764
+ executionId: string;
765
+ iteration: number;
766
+ outcome: "pending_approval" | "auto_published";
767
+ proposalId?: string;
768
+ seq: number;
769
+ skill: string;
770
+ toolCallId: string;
771
+ type: "agent_skill_proposed";
772
+ }) | ({
773
+ agentId: string;
774
+ completedAt: string;
775
+ duration?: number;
776
+ error?: string;
777
+ executionId: string;
778
+ externalAgent?: {
779
+ contextId?: string;
780
+ taskId?: string;
781
+ };
782
+ finalOutput?: string;
783
+ iterations: number;
784
+ seq: number;
785
+ stopReason: "complete" | "end_turn" | "max_turns" | "max_cost" | "timeout" | "error";
786
+ success: boolean;
787
+ totalCost?: number;
788
+ totalTokens?: {
789
+ input: number;
790
+ output: number;
791
+ };
792
+ type: "agent_complete";
793
+ }) | {
794
+ error: {
795
+ code: string;
796
+ details?: Record<string, unknown>;
797
+ message: string;
798
+ };
799
+ executionId: string;
800
+ iteration?: number;
801
+ recoverable: boolean;
802
+ seq: number;
803
+ type: "agent_error";
804
+ } | {
805
+ executionId: string;
806
+ seq: number;
807
+ timestamp: string;
808
+ type: "agent_ping";
809
+ } | {
810
+ executionContext?: Record<string, unknown>;
811
+ executionId?: string;
812
+ flowId: string;
813
+ flowName?: string;
814
+ input?: unknown;
815
+ seq?: number;
816
+ source?: string;
817
+ startedAt: string;
818
+ toolContext?: {
819
+ executionId: string;
820
+ stepId: string;
821
+ toolId: string;
822
+ };
823
+ totalSteps?: number;
824
+ type: "flow_start";
825
+ } | {
826
+ completedAt?: string;
827
+ completedSteps?: number;
828
+ duration?: number;
829
+ executionContext?: Record<string, unknown>;
830
+ executionId?: string;
831
+ executionTime?: number;
832
+ failedSteps?: number;
833
+ finalOutput?: string;
834
+ flowId?: string;
835
+ output?: unknown;
836
+ seq?: number;
837
+ source?: string;
838
+ success?: boolean;
839
+ successfulSteps?: number;
840
+ toolContext?: {
841
+ executionId: string;
842
+ stepId: string;
843
+ toolId: string;
844
+ };
845
+ totalSteps?: number;
846
+ totalTokensUsed?: number;
847
+ type: "flow_complete";
848
+ } | ({
849
+ code?: string;
850
+ error: string | {
851
+ code: string;
852
+ message: string;
853
+ stepId?: string;
854
+ stepType?: string;
855
+ };
856
+ executionId?: string;
857
+ executionTime?: number;
858
+ flowId?: string;
859
+ seq?: number;
860
+ timestamp?: string;
861
+ toolContext?: {
862
+ executionId: string;
863
+ stepId: string;
864
+ toolId: string;
865
+ };
866
+ type: "flow_error";
867
+ upgradeUrl?: string;
868
+ }) | ({
869
+ awaitedAt: string;
870
+ executionId?: string;
871
+ flowId: string;
872
+ origin?: "webmcp" | "sdk";
873
+ pageOrigin?: string;
874
+ parameters?: Record<string, unknown>;
875
+ seq?: number;
876
+ toolCallId?: string;
877
+ toolId?: string;
878
+ toolName?: string;
879
+ type: "flow_await";
880
+ }) | {
881
+ estimatedTokens?: number;
882
+ executionId?: string;
883
+ id?: string;
884
+ index?: number;
885
+ name?: string;
886
+ seq?: number;
887
+ startedAt: string;
888
+ stepId?: string;
889
+ stepName?: string;
890
+ stepType?: string;
891
+ toolContext?: {
892
+ executionId: string;
893
+ stepId: string;
894
+ toolId: string;
895
+ };
896
+ totalSteps?: number;
897
+ type: "step_start";
898
+ } | {
899
+ delta?: string;
900
+ executionId?: string;
901
+ id?: string;
902
+ messageId?: string;
903
+ partId?: string;
904
+ seq?: number;
905
+ text?: string;
906
+ toolContext?: {
907
+ executionId: string;
908
+ stepId: string;
909
+ toolId: string;
910
+ };
911
+ toolId?: string;
912
+ type: "step_delta";
913
+ } | ({
914
+ completedAt?: string;
915
+ duration?: number;
916
+ durationMs?: number;
917
+ error?: string;
918
+ executionId?: string;
919
+ executionTime?: number;
920
+ id?: string;
921
+ index?: number;
922
+ name?: string;
923
+ output?: unknown;
924
+ result?: unknown;
925
+ seq?: number;
926
+ stepId?: string;
927
+ stepName?: string;
928
+ stepType?: string;
929
+ stopReason?: "end_turn" | "max_tool_calls" | "length" | "content_filter" | "error" | "unknown";
930
+ success?: boolean;
931
+ tokensUsed?: number;
932
+ toolContext?: {
933
+ executionId: string;
934
+ stepId: string;
935
+ toolId: string;
936
+ };
937
+ type: "step_complete";
938
+ }) | {
939
+ error: string;
940
+ executionId?: string;
941
+ executionTime?: number;
942
+ id?: string;
943
+ index?: number;
944
+ name?: string;
945
+ seq?: number;
946
+ stepType?: string;
947
+ type: "step_error";
948
+ } | {
949
+ error?: string;
950
+ executionId?: string;
951
+ id: string;
952
+ index?: number;
953
+ name?: string;
954
+ seq?: number;
955
+ skippedAt: string;
956
+ stepType: string;
957
+ totalSteps: number;
958
+ type: "step_skip";
959
+ when: string;
960
+ } | {
961
+ executionId?: string;
962
+ seq?: number;
963
+ type: "step_await";
964
+ [key: string]: unknown;
965
+ } | ({
966
+ agentContext?: {
967
+ executionId: string;
968
+ iteration: number;
969
+ seq: number;
970
+ };
971
+ executionId?: string;
972
+ hiddenParameterNames?: Array<string>;
973
+ name?: string;
974
+ parameters?: Record<string, unknown>;
975
+ providerOptions?: Record<string, unknown>;
976
+ seq?: number;
977
+ startedAt?: string;
978
+ stepId?: string;
979
+ toolCallId?: string;
980
+ toolId?: string;
981
+ toolName?: string;
982
+ toolType: "flow" | "mcp" | "builtin" | "custom" | "external" | "advisor" | "subagent" | "local";
983
+ type: "tool_start";
984
+ [key: string]: unknown;
985
+ }) | {
986
+ delta?: string;
987
+ executionId?: string;
988
+ seq?: number;
989
+ toolId?: string;
990
+ type: "tool_delta";
991
+ [key: string]: unknown;
992
+ } | {
993
+ delta: string;
994
+ executionId?: string;
995
+ seq?: number;
996
+ stepId?: string;
997
+ toolCallId?: string;
998
+ toolId?: string;
999
+ type: "tool_input_delta";
1000
+ } | {
1001
+ executionId?: string;
1002
+ hiddenParameterNames?: Array<string>;
1003
+ parameters: Record<string, unknown>;
1004
+ providerOptions?: Record<string, unknown>;
1005
+ seq?: number;
1006
+ stepId?: string;
1007
+ toolCallId?: string;
1008
+ toolId?: string;
1009
+ toolName?: string;
1010
+ type: "tool_input_complete";
1011
+ } | {
1012
+ agentContext?: {
1013
+ executionId: string;
1014
+ iteration: number;
1015
+ seq: number;
1016
+ };
1017
+ completedAt?: string;
1018
+ error?: string;
1019
+ executionId?: string;
1020
+ executionTime?: number;
1021
+ name?: string;
1022
+ result?: unknown;
1023
+ seq?: number;
1024
+ stepId?: string;
1025
+ success: boolean;
1026
+ toolCallId?: string;
1027
+ toolCost?: number;
1028
+ toolId?: string;
1029
+ toolName?: string;
1030
+ type: "tool_complete";
1031
+ } | {
1032
+ agentContext?: {
1033
+ executionId: string;
1034
+ iteration: number;
1035
+ seq: number;
1036
+ };
1037
+ error: string;
1038
+ executionId?: string;
1039
+ executionTime?: number;
1040
+ failedAt?: string;
1041
+ name: string;
1042
+ seq?: number;
1043
+ toolId: string;
1044
+ type: "tool_error";
1045
+ } | {
1046
+ executionId?: string;
1047
+ id: string;
1048
+ seq?: number;
1049
+ text: string;
1050
+ type: "chunk";
1051
+ } | {
1052
+ executionId?: string;
1053
+ seq?: number;
1054
+ type: "text_start";
1055
+ [key: string]: unknown;
1056
+ } | {
1057
+ executionId?: string;
1058
+ seq?: number;
1059
+ type: "text_end";
1060
+ [key: string]: unknown;
1061
+ } | {
1062
+ executionId?: string;
1063
+ seq?: number;
1064
+ type: "reason_start";
1065
+ [key: string]: unknown;
1066
+ } | {
1067
+ executionId?: string;
1068
+ seq?: number;
1069
+ type: "reason_delta";
1070
+ [key: string]: unknown;
1071
+ } | {
1072
+ executionId?: string;
1073
+ seq?: number;
1074
+ type: "reason_complete";
1075
+ [key: string]: unknown;
1076
+ } | {
1077
+ executionId?: string;
1078
+ seq?: number;
1079
+ type: "source";
1080
+ [key: string]: unknown;
1081
+ } | {
1082
+ executionId?: string;
1083
+ seq?: number;
1084
+ type: "fallback_start";
1085
+ [key: string]: unknown;
1086
+ } | {
1087
+ executionId?: string;
1088
+ seq?: number;
1089
+ type: "fallback_complete";
1090
+ [key: string]: unknown;
1091
+ } | {
1092
+ executionId?: string;
1093
+ seq?: number;
1094
+ type: "fallback_exhausted";
1095
+ [key: string]: unknown;
1096
+ } | ({
1097
+ artifactType: "markdown" | "component";
1098
+ component?: string;
1099
+ id: string;
1100
+ title?: string;
1101
+ type: "artifact_start";
1102
+ }) | {
1103
+ delta: string;
1104
+ id: string;
1105
+ type: "artifact_delta";
1106
+ } | {
1107
+ component: string;
1108
+ id: string;
1109
+ props: Record<string, unknown>;
1110
+ type: "artifact_update";
1111
+ } | {
1112
+ id: string;
1113
+ type: "artifact_complete";
1114
+ } | ({
1115
+ artifactType?: "markdown" | "component";
1116
+ component?: string;
1117
+ content?: string;
1118
+ id?: string;
1119
+ props?: Record<string, unknown>;
1120
+ title?: string;
1121
+ type: "artifact";
1122
+ [key: string]: unknown;
1123
+ });
1124
+
1125
+ export type RuntypeStreamEventOf<U, T extends string> = Extract<U, { type: T }>;
1126
+
1127
+ export type RuntypeAgentTurnCompleteEvent = RuntypeStreamEventOf<
1128
+ RuntypeAgentSSEEvent,
1129
+ "agent_turn_complete"
1130
+ >;
1131
+
1132
+ export type RuntypeStepCompleteEvent = RuntypeStreamEventOf<
1133
+ RuntypeFlowSSEEvent,
1134
+ "step_complete"
1135
+ >;
1136
+
1137
+ export type RuntypeStopReasonKind = NonNullable<
1138
+ RuntypeAgentTurnCompleteEvent["stopReason"] | RuntypeStepCompleteEvent["stopReason"]
1139
+ >;
1140
+
1141
+ export type RuntypeClientInitRequest = {
1142
+ flowId?: string;
1143
+ sessionId?: string;
1144
+ token: string;
1145
+ };
1146
+
1147
+ export type RuntypeClientInitResponse = {
1148
+ config: {
1149
+ placeholder?: string;
1150
+ theme?: unknown;
1151
+ welcomeMessage?: string | null;
1152
+ };
1153
+ expiresAt: string;
1154
+ flow: {
1155
+ description?: string | null;
1156
+ id: string;
1157
+ name?: string | null;
1158
+ };
1159
+ sessionId: string;
1160
+ };
1161
+
1162
+ export type RuntypeClientChatRequest = {
1163
+ assistantMessageId?: string;
1164
+ clientTools?: Array<{
1165
+ description: string;
1166
+ name: string;
1167
+ origin?: "webmcp" | "sdk";
1168
+ pageOrigin?: string;
1169
+ parametersSchema: {
1170
+ type: "object";
1171
+ [key: string]: unknown;
1172
+ };
1173
+ }>;
1174
+ clientToolsFingerprint?: string;
1175
+ inputs?: Record<string, unknown>;
1176
+ messages: Array<{
1177
+ content: string | (Array<{
1178
+ text: string;
1179
+ type: "text";
1180
+ } | {
1181
+ image: string;
1182
+ mimeType?: string;
1183
+ type: "image";
1184
+ } | {
1185
+ data: string;
1186
+ filename: string;
1187
+ mimeType: string;
1188
+ type: "file";
1189
+ } | {
1190
+ providerOptions?: Record<string, unknown>;
1191
+ text: string;
1192
+ type: "reasoning";
1193
+ }>);
1194
+ id?: string;
1195
+ role: "user" | "assistant" | "system";
1196
+ }>;
1197
+ metadata?: Record<string, unknown>;
1198
+ sessionId: string;
1199
+ submitMode?: "normal" | "interrupt";
1200
+ turnId?: string;
1201
+ };
1202
+
1203
+ export type RuntypeClientChatStreamEvent = RuntypeFlowSSEEvent;
1204
+
1205
+ export type RuntypeClientResumeRequest = {
1206
+ executionId: string;
1207
+ messages?: Array<{
1208
+ content: string | (Array<{
1209
+ text: string;
1210
+ type: "text";
1211
+ } | {
1212
+ image: string;
1213
+ mimeType?: string;
1214
+ type: "image";
1215
+ } | {
1216
+ data: string;
1217
+ filename: string;
1218
+ mimeType: string;
1219
+ type: "file";
1220
+ } | {
1221
+ providerOptions?: Record<string, unknown>;
1222
+ text: string;
1223
+ type: "reasoning";
1224
+ }>);
1225
+ role: "system" | "user" | "assistant";
1226
+ }>;
1227
+ sessionId: string;
1228
+ streamResponse?: boolean;
1229
+ toolOutputs?: Record<string, unknown>;
1230
+ };
1231
+
1232
+ export type RuntypeClientResumeStreamEvent = RuntypeDispatchSSEEvent;
1233
+
1234
+ export type RuntypeClientFeedbackRequest = {
1235
+ comment?: string;
1236
+ messageId?: string;
1237
+ metadata?: Record<string, unknown>;
1238
+ rating?: number;
1239
+ sessionId: string;
1240
+ type: "upvote" | "downvote" | "copy" | "csat" | "nps";
1241
+ };
1242
+
1243
+ export type RuntypeClientFeedbackResponse = {
1244
+ feedbackId: string;
1245
+ message?: string;
1246
+ success: true;
1247
+ };
1248
+
1249
+ export type RuntypeClientFeedbackType = RuntypeClientFeedbackRequest["type"];