ai-protocol-adapters 1.0.0-alpha.8 → 1.0.0-alpha.9

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.
package/dist/index.d.mts CHANGED
@@ -1,180 +1,5 @@
1
1
  import { z } from 'zod';
2
2
 
3
- /**
4
- * 流式协议适配器 - OpenAI到Anthropic的SSE转换
5
- * 基于编译后的JavaScript文件重新生成的TypeScript源码
6
- */
7
- interface StreamingProtocolAdapterOptions {
8
- debugMode?: boolean;
9
- validateInput?: boolean;
10
- validateOutput?: boolean;
11
- autoHeal?: boolean;
12
- timeout?: number;
13
- retries?: number;
14
- bufferSize?: number;
15
- logger?: any;
16
- }
17
- interface ConversionState {
18
- processedLines: number;
19
- textContent: string;
20
- reasoningContent: string;
21
- toolCallsMap: Map<string, any>;
22
- completedToolCalls: any[];
23
- allSSELines: string[];
24
- errors: any[];
25
- usage: {
26
- input_tokens: number;
27
- output_tokens: number;
28
- };
29
- thinkingBlockStarted: boolean;
30
- contentBlockStarted: boolean;
31
- }
32
- interface ConversionResult$2 {
33
- success: boolean;
34
- error?: string;
35
- anthropicSSE: string;
36
- anthropicStandardResponse: any;
37
- }
38
- declare class StreamingProtocolAdapter {
39
- private config;
40
- constructor(options?: StreamingProtocolAdapterOptions);
41
- private logDebug;
42
- /**
43
- * 转换Anthropic请求为OpenAI格式
44
- */
45
- convertAnthropicToOpenAI(anthropicRequest: any): {
46
- openaiRequest: any;
47
- metadata: {
48
- hasImages: boolean;
49
- requiresVisionHeaders: boolean;
50
- };
51
- };
52
- /**
53
- * 转换OpenAI流式响应为Anthropic SSE格式
54
- */
55
- convertOpenAIStreamToAnthropic(openaiStream: string, originalRequest: any): ConversionResult$2;
56
- /**
57
- * 将OpenAI流转换为Anthropic SSE格式
58
- */
59
- private convertToAnthropicSSE;
60
- /**
61
- * 处理单个流式数据块 - 支持thinking和content双模式
62
- */
63
- private processStreamChunk;
64
- /**
65
- * 处理工具调用 - 支持OpenAI流式分块累积
66
- * OpenAI流式API会将tool_calls分多个chunk发送:
67
- * - Chunk 1: {index:0, id:"call_xxx", type:"function", function:{name:"web_search"}}
68
- * - Chunk 2: {index:0, function:{arguments:"{\"query\":\"xxx\"}"}}
69
- * - Chunk N: 继续累积arguments
70
- */
71
- private processToolCalls;
72
- /**
73
- * 在流结束时关闭所有未关闭的工具调用块
74
- */
75
- private closeAllToolCallBlocks;
76
- /**
77
- * 添加最终事件 - 支持thinking+content双模式
78
- */
79
- private addFinalEvents;
80
- /**
81
- * 构建标准响应格式
82
- */
83
- private buildStandardResponse;
84
- /**
85
- * 创建转换状态对象
86
- */
87
- private createConversionState;
88
- /**
89
- * 转换消息格式
90
- */
91
- private convertMessages;
92
- /**
93
- * 映射Anthropic模型到OpenAI模型
94
- */
95
- private mapAnthropicModelToOpenAI;
96
- /**
97
- * 检查请求是否包含图片内容
98
- */
99
- private hasImageContent;
100
- /**
101
- * 转义JSON字符串
102
- */
103
- private escapeJsonString;
104
- /**
105
- * 获取初始SSE事件(message_start + ping)
106
- */
107
- getInitialSSEEvents(modelName?: string, messageId?: string): string[];
108
- /**
109
- * 增量转换单个OpenAI数据块为Anthropic SSE事件
110
- * 用于逐个处理流式数据片段
111
- */
112
- convertIncrementalChunk(openaiDataLine: string, state: ConversionState): string[];
113
- }
114
-
115
- /**
116
- * O2A SSE适配器相关类型定义
117
- */
118
- interface CaptureSession {
119
- [key: string]: any;
120
- }
121
- /**
122
- * 工具调用信息接口
123
- */
124
- interface ToolCallInfo {
125
- index: number;
126
- name: string;
127
- hasArgs: boolean;
128
- }
129
- /**
130
- * 流式转换状态接口
131
- */
132
- interface StreamingConversionState {
133
- hasContent: boolean;
134
- hasThinking: boolean;
135
- contentBlockIndex: number;
136
- thinkingBlockIndex: number;
137
- toolCallsMap: Map<string, ToolCallInfo>;
138
- completedToolCalls: Set<string>;
139
- accumulatedUsage: {
140
- input_tokens: number;
141
- output_tokens: number;
142
- cache_creation_input_tokens?: number;
143
- cache_read_input_tokens?: number;
144
- };
145
- processedLines: number;
146
- errors: string[];
147
- allSSELines: string[];
148
- }
149
- /**
150
- * 增量转换状态接口(扩展基础状态)
151
- */
152
- interface IncrementalConversionState extends StreamingConversionState {
153
- captureSession?: CaptureSession;
154
- }
155
- /**
156
- * Claude标准响应格式
157
- */
158
- interface ClaudeStandardResponse {
159
- id: string;
160
- model: string;
161
- role: 'assistant';
162
- content: ContentBlock[];
163
- type: 'message';
164
- stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | null;
165
- stop_sequence: string | null;
166
- usage: Usage;
167
- }
168
- interface ContentBlock {
169
- type: 'text' | 'tool_use' | 'tool_result' | 'image';
170
- }
171
- interface Usage {
172
- input_tokens: number;
173
- output_tokens: number;
174
- cache_creation_input_tokens?: number;
175
- cache_read_input_tokens?: number;
176
- }
177
-
178
3
  /**
179
4
  * OpenAI API 协议 zod schemas
180
5
  * 提供完整的类型校验和自动推导
@@ -341,15 +166,15 @@ declare const OpenAIMessageContentSchema: z.ZodUnion<[z.ZodString, z.ZodArray<z.
341
166
  detail?: "low" | "high" | "auto";
342
167
  }>>;
343
168
  }, "strip", z.ZodTypeAny, {
344
- text?: string;
345
169
  type?: "text" | "image_url";
170
+ text?: string;
346
171
  image_url?: {
347
172
  url?: string;
348
173
  detail?: "low" | "high" | "auto";
349
174
  };
350
175
  }, {
351
- text?: string;
352
176
  type?: "text" | "image_url";
177
+ text?: string;
353
178
  image_url?: {
354
179
  url?: string;
355
180
  detail?: "low" | "high" | "auto";
@@ -371,15 +196,15 @@ declare const OpenAIMessageSchema: z.ZodObject<{
371
196
  detail?: "low" | "high" | "auto";
372
197
  }>>;
373
198
  }, "strip", z.ZodTypeAny, {
374
- text?: string;
375
199
  type?: "text" | "image_url";
200
+ text?: string;
376
201
  image_url?: {
377
202
  url?: string;
378
203
  detail?: "low" | "high" | "auto";
379
204
  };
380
205
  }, {
381
- text?: string;
382
206
  type?: "text" | "image_url";
207
+ text?: string;
383
208
  image_url?: {
384
209
  url?: string;
385
210
  detail?: "low" | "high" | "auto";
@@ -416,16 +241,16 @@ declare const OpenAIMessageSchema: z.ZodObject<{
416
241
  }>, "many">>;
417
242
  tool_call_id: z.ZodOptional<z.ZodString>;
418
243
  }, "strip", z.ZodTypeAny, {
419
- role?: "assistant" | "system" | "user" | "tool";
244
+ name?: string;
245
+ role?: "system" | "user" | "assistant" | "tool";
420
246
  content?: string | {
421
- text?: string;
422
247
  type?: "text" | "image_url";
248
+ text?: string;
423
249
  image_url?: {
424
250
  url?: string;
425
251
  detail?: "low" | "high" | "auto";
426
252
  };
427
253
  }[];
428
- name?: string;
429
254
  tool_calls?: {
430
255
  function?: {
431
256
  name?: string;
@@ -436,16 +261,16 @@ declare const OpenAIMessageSchema: z.ZodObject<{
436
261
  }[];
437
262
  tool_call_id?: string;
438
263
  }, {
439
- role?: "assistant" | "system" | "user" | "tool";
264
+ name?: string;
265
+ role?: "system" | "user" | "assistant" | "tool";
440
266
  content?: string | {
441
- text?: string;
442
267
  type?: "text" | "image_url";
268
+ text?: string;
443
269
  image_url?: {
444
270
  url?: string;
445
271
  detail?: "low" | "high" | "auto";
446
272
  };
447
273
  }[];
448
- name?: string;
449
274
  tool_calls?: {
450
275
  function?: {
451
276
  name?: string;
@@ -474,15 +299,15 @@ declare const OpenAIRequestSchema: z.ZodObject<{
474
299
  detail?: "low" | "high" | "auto";
475
300
  }>>;
476
301
  }, "strip", z.ZodTypeAny, {
477
- text?: string;
478
302
  type?: "text" | "image_url";
303
+ text?: string;
479
304
  image_url?: {
480
305
  url?: string;
481
306
  detail?: "low" | "high" | "auto";
482
307
  };
483
308
  }, {
484
- text?: string;
485
309
  type?: "text" | "image_url";
310
+ text?: string;
486
311
  image_url?: {
487
312
  url?: string;
488
313
  detail?: "low" | "high" | "auto";
@@ -519,16 +344,16 @@ declare const OpenAIRequestSchema: z.ZodObject<{
519
344
  }>, "many">>;
520
345
  tool_call_id: z.ZodOptional<z.ZodString>;
521
346
  }, "strip", z.ZodTypeAny, {
522
- role?: "assistant" | "system" | "user" | "tool";
347
+ name?: string;
348
+ role?: "system" | "user" | "assistant" | "tool";
523
349
  content?: string | {
524
- text?: string;
525
350
  type?: "text" | "image_url";
351
+ text?: string;
526
352
  image_url?: {
527
353
  url?: string;
528
354
  detail?: "low" | "high" | "auto";
529
355
  };
530
356
  }[];
531
- name?: string;
532
357
  tool_calls?: {
533
358
  function?: {
534
359
  name?: string;
@@ -539,16 +364,16 @@ declare const OpenAIRequestSchema: z.ZodObject<{
539
364
  }[];
540
365
  tool_call_id?: string;
541
366
  }, {
542
- role?: "assistant" | "system" | "user" | "tool";
367
+ name?: string;
368
+ role?: "system" | "user" | "assistant" | "tool";
543
369
  content?: string | {
544
- text?: string;
545
370
  type?: "text" | "image_url";
371
+ text?: string;
546
372
  image_url?: {
547
373
  url?: string;
548
374
  detail?: "low" | "high" | "auto";
549
375
  };
550
376
  }[];
551
- name?: string;
552
377
  tool_calls?: {
553
378
  function?: {
554
379
  name?: string;
@@ -668,16 +493,16 @@ declare const OpenAIRequestSchema: z.ZodObject<{
668
493
  user?: string;
669
494
  model?: string;
670
495
  messages?: {
671
- role?: "assistant" | "system" | "user" | "tool";
496
+ name?: string;
497
+ role?: "system" | "user" | "assistant" | "tool";
672
498
  content?: string | {
673
- text?: string;
674
499
  type?: "text" | "image_url";
500
+ text?: string;
675
501
  image_url?: {
676
502
  url?: string;
677
503
  detail?: "low" | "high" | "auto";
678
504
  };
679
505
  }[];
680
- name?: string;
681
506
  tool_calls?: {
682
507
  function?: {
683
508
  name?: string;
@@ -726,16 +551,16 @@ declare const OpenAIRequestSchema: z.ZodObject<{
726
551
  user?: string;
727
552
  model?: string;
728
553
  messages?: {
729
- role?: "assistant" | "system" | "user" | "tool";
554
+ name?: string;
555
+ role?: "system" | "user" | "assistant" | "tool";
730
556
  content?: string | {
731
- text?: string;
732
557
  type?: "text" | "image_url";
558
+ text?: string;
733
559
  image_url?: {
734
560
  url?: string;
735
561
  detail?: "low" | "high" | "auto";
736
562
  };
737
563
  }[];
738
- name?: string;
739
564
  tool_calls?: {
740
565
  function?: {
741
566
  name?: string;
@@ -838,15 +663,15 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
838
663
  detail?: "low" | "high" | "auto";
839
664
  }>>;
840
665
  }, "strip", z.ZodTypeAny, {
841
- text?: string;
842
666
  type?: "text" | "image_url";
667
+ text?: string;
843
668
  image_url?: {
844
669
  url?: string;
845
670
  detail?: "low" | "high" | "auto";
846
671
  };
847
672
  }, {
848
- text?: string;
849
673
  type?: "text" | "image_url";
674
+ text?: string;
850
675
  image_url?: {
851
676
  url?: string;
852
677
  detail?: "low" | "high" | "auto";
@@ -883,16 +708,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
883
708
  }>, "many">>;
884
709
  tool_call_id: z.ZodOptional<z.ZodString>;
885
710
  }, "strip", z.ZodTypeAny, {
886
- role?: "assistant" | "system" | "user" | "tool";
711
+ name?: string;
712
+ role?: "system" | "user" | "assistant" | "tool";
887
713
  content?: string | {
888
- text?: string;
889
714
  type?: "text" | "image_url";
715
+ text?: string;
890
716
  image_url?: {
891
717
  url?: string;
892
718
  detail?: "low" | "high" | "auto";
893
719
  };
894
720
  }[];
895
- name?: string;
896
721
  tool_calls?: {
897
722
  function?: {
898
723
  name?: string;
@@ -903,16 +728,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
903
728
  }[];
904
729
  tool_call_id?: string;
905
730
  }, {
906
- role?: "assistant" | "system" | "user" | "tool";
731
+ name?: string;
732
+ role?: "system" | "user" | "assistant" | "tool";
907
733
  content?: string | {
908
- text?: string;
909
734
  type?: "text" | "image_url";
735
+ text?: string;
910
736
  image_url?: {
911
737
  url?: string;
912
738
  detail?: "low" | "high" | "auto";
913
739
  };
914
740
  }[];
915
- name?: string;
916
741
  tool_calls?: {
917
742
  function?: {
918
743
  name?: string;
@@ -939,15 +764,15 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
939
764
  detail?: "low" | "high" | "auto";
940
765
  }>>;
941
766
  }, "strip", z.ZodTypeAny, {
942
- text?: string;
943
767
  type?: "text" | "image_url";
768
+ text?: string;
944
769
  image_url?: {
945
770
  url?: string;
946
771
  detail?: "low" | "high" | "auto";
947
772
  };
948
773
  }, {
949
- text?: string;
950
774
  type?: "text" | "image_url";
775
+ text?: string;
951
776
  image_url?: {
952
777
  url?: string;
953
778
  detail?: "low" | "high" | "auto";
@@ -984,16 +809,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
984
809
  }>, "many">>;
985
810
  tool_call_id: z.ZodOptional<z.ZodString>;
986
811
  }, "strip", z.ZodTypeAny, {
987
- role?: "assistant" | "system" | "user" | "tool";
812
+ name?: string;
813
+ role?: "system" | "user" | "assistant" | "tool";
988
814
  content?: string | {
989
- text?: string;
990
815
  type?: "text" | "image_url";
816
+ text?: string;
991
817
  image_url?: {
992
818
  url?: string;
993
819
  detail?: "low" | "high" | "auto";
994
820
  };
995
821
  }[];
996
- name?: string;
997
822
  tool_calls?: {
998
823
  function?: {
999
824
  name?: string;
@@ -1004,16 +829,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
1004
829
  }[];
1005
830
  tool_call_id?: string;
1006
831
  }, {
1007
- role?: "assistant" | "system" | "user" | "tool";
832
+ name?: string;
833
+ role?: "system" | "user" | "assistant" | "tool";
1008
834
  content?: string | {
1009
- text?: string;
1010
835
  type?: "text" | "image_url";
836
+ text?: string;
1011
837
  image_url?: {
1012
838
  url?: string;
1013
839
  detail?: "low" | "high" | "auto";
1014
840
  };
1015
841
  }[];
1016
- name?: string;
1017
842
  tool_calls?: {
1018
843
  function?: {
1019
844
  name?: string;
@@ -1087,16 +912,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
1087
912
  finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "function_call"]>>;
1088
913
  }, "strip", z.ZodTypeAny, {
1089
914
  message?: {
1090
- role?: "assistant" | "system" | "user" | "tool";
915
+ name?: string;
916
+ role?: "system" | "user" | "assistant" | "tool";
1091
917
  content?: string | {
1092
- text?: string;
1093
918
  type?: "text" | "image_url";
919
+ text?: string;
1094
920
  image_url?: {
1095
921
  url?: string;
1096
922
  detail?: "low" | "high" | "auto";
1097
923
  };
1098
924
  }[];
1099
- name?: string;
1100
925
  tool_calls?: {
1101
926
  function?: {
1102
927
  name?: string;
@@ -1121,16 +946,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
1121
946
  };
1122
947
  index?: number;
1123
948
  delta?: {
1124
- role?: "assistant" | "system" | "user" | "tool";
949
+ name?: string;
950
+ role?: "system" | "user" | "assistant" | "tool";
1125
951
  content?: string | {
1126
- text?: string;
1127
952
  type?: "text" | "image_url";
953
+ text?: string;
1128
954
  image_url?: {
1129
955
  url?: string;
1130
956
  detail?: "low" | "high" | "auto";
1131
957
  };
1132
958
  }[];
1133
- name?: string;
1134
959
  tool_calls?: {
1135
960
  function?: {
1136
961
  name?: string;
@@ -1144,16 +969,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
1144
969
  finish_reason?: "length" | "tool_calls" | "stop" | "content_filter" | "function_call";
1145
970
  }, {
1146
971
  message?: {
1147
- role?: "assistant" | "system" | "user" | "tool";
972
+ name?: string;
973
+ role?: "system" | "user" | "assistant" | "tool";
1148
974
  content?: string | {
1149
- text?: string;
1150
975
  type?: "text" | "image_url";
976
+ text?: string;
1151
977
  image_url?: {
1152
978
  url?: string;
1153
979
  detail?: "low" | "high" | "auto";
1154
980
  };
1155
981
  }[];
1156
- name?: string;
1157
982
  tool_calls?: {
1158
983
  function?: {
1159
984
  name?: string;
@@ -1178,16 +1003,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
1178
1003
  };
1179
1004
  index?: number;
1180
1005
  delta?: {
1181
- role?: "assistant" | "system" | "user" | "tool";
1006
+ name?: string;
1007
+ role?: "system" | "user" | "assistant" | "tool";
1182
1008
  content?: string | {
1183
- text?: string;
1184
1009
  type?: "text" | "image_url";
1010
+ text?: string;
1185
1011
  image_url?: {
1186
1012
  url?: string;
1187
1013
  detail?: "low" | "high" | "auto";
1188
1014
  };
1189
1015
  }[];
1190
- name?: string;
1191
1016
  tool_calls?: {
1192
1017
  function?: {
1193
1018
  name?: string;
@@ -1223,15 +1048,15 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1223
1048
  detail?: "low" | "high" | "auto";
1224
1049
  }>>;
1225
1050
  }, "strip", z.ZodTypeAny, {
1226
- text?: string;
1227
1051
  type?: "text" | "image_url";
1052
+ text?: string;
1228
1053
  image_url?: {
1229
1054
  url?: string;
1230
1055
  detail?: "low" | "high" | "auto";
1231
1056
  };
1232
1057
  }, {
1233
- text?: string;
1234
1058
  type?: "text" | "image_url";
1059
+ text?: string;
1235
1060
  image_url?: {
1236
1061
  url?: string;
1237
1062
  detail?: "low" | "high" | "auto";
@@ -1268,16 +1093,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1268
1093
  }>, "many">>;
1269
1094
  tool_call_id: z.ZodOptional<z.ZodString>;
1270
1095
  }, "strip", z.ZodTypeAny, {
1271
- role?: "assistant" | "system" | "user" | "tool";
1096
+ name?: string;
1097
+ role?: "system" | "user" | "assistant" | "tool";
1272
1098
  content?: string | {
1273
- text?: string;
1274
1099
  type?: "text" | "image_url";
1100
+ text?: string;
1275
1101
  image_url?: {
1276
1102
  url?: string;
1277
1103
  detail?: "low" | "high" | "auto";
1278
1104
  };
1279
1105
  }[];
1280
- name?: string;
1281
1106
  tool_calls?: {
1282
1107
  function?: {
1283
1108
  name?: string;
@@ -1288,16 +1113,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1288
1113
  }[];
1289
1114
  tool_call_id?: string;
1290
1115
  }, {
1291
- role?: "assistant" | "system" | "user" | "tool";
1116
+ name?: string;
1117
+ role?: "system" | "user" | "assistant" | "tool";
1292
1118
  content?: string | {
1293
- text?: string;
1294
1119
  type?: "text" | "image_url";
1120
+ text?: string;
1295
1121
  image_url?: {
1296
1122
  url?: string;
1297
1123
  detail?: "low" | "high" | "auto";
1298
1124
  };
1299
1125
  }[];
1300
- name?: string;
1301
1126
  tool_calls?: {
1302
1127
  function?: {
1303
1128
  name?: string;
@@ -1324,15 +1149,15 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1324
1149
  detail?: "low" | "high" | "auto";
1325
1150
  }>>;
1326
1151
  }, "strip", z.ZodTypeAny, {
1327
- text?: string;
1328
1152
  type?: "text" | "image_url";
1153
+ text?: string;
1329
1154
  image_url?: {
1330
1155
  url?: string;
1331
1156
  detail?: "low" | "high" | "auto";
1332
1157
  };
1333
1158
  }, {
1334
- text?: string;
1335
1159
  type?: "text" | "image_url";
1160
+ text?: string;
1336
1161
  image_url?: {
1337
1162
  url?: string;
1338
1163
  detail?: "low" | "high" | "auto";
@@ -1369,16 +1194,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1369
1194
  }>, "many">>;
1370
1195
  tool_call_id: z.ZodOptional<z.ZodString>;
1371
1196
  }, "strip", z.ZodTypeAny, {
1372
- role?: "assistant" | "system" | "user" | "tool";
1197
+ name?: string;
1198
+ role?: "system" | "user" | "assistant" | "tool";
1373
1199
  content?: string | {
1374
- text?: string;
1375
1200
  type?: "text" | "image_url";
1201
+ text?: string;
1376
1202
  image_url?: {
1377
1203
  url?: string;
1378
1204
  detail?: "low" | "high" | "auto";
1379
1205
  };
1380
1206
  }[];
1381
- name?: string;
1382
1207
  tool_calls?: {
1383
1208
  function?: {
1384
1209
  name?: string;
@@ -1389,16 +1214,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1389
1214
  }[];
1390
1215
  tool_call_id?: string;
1391
1216
  }, {
1392
- role?: "assistant" | "system" | "user" | "tool";
1217
+ name?: string;
1218
+ role?: "system" | "user" | "assistant" | "tool";
1393
1219
  content?: string | {
1394
- text?: string;
1395
1220
  type?: "text" | "image_url";
1221
+ text?: string;
1396
1222
  image_url?: {
1397
1223
  url?: string;
1398
1224
  detail?: "low" | "high" | "auto";
1399
1225
  };
1400
1226
  }[];
1401
- name?: string;
1402
1227
  tool_calls?: {
1403
1228
  function?: {
1404
1229
  name?: string;
@@ -1472,16 +1297,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1472
1297
  finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "function_call"]>>;
1473
1298
  }, "strip", z.ZodTypeAny, {
1474
1299
  message?: {
1475
- role?: "assistant" | "system" | "user" | "tool";
1300
+ name?: string;
1301
+ role?: "system" | "user" | "assistant" | "tool";
1476
1302
  content?: string | {
1477
- text?: string;
1478
1303
  type?: "text" | "image_url";
1304
+ text?: string;
1479
1305
  image_url?: {
1480
1306
  url?: string;
1481
1307
  detail?: "low" | "high" | "auto";
1482
1308
  };
1483
1309
  }[];
1484
- name?: string;
1485
1310
  tool_calls?: {
1486
1311
  function?: {
1487
1312
  name?: string;
@@ -1506,16 +1331,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1506
1331
  };
1507
1332
  index?: number;
1508
1333
  delta?: {
1509
- role?: "assistant" | "system" | "user" | "tool";
1334
+ name?: string;
1335
+ role?: "system" | "user" | "assistant" | "tool";
1510
1336
  content?: string | {
1511
- text?: string;
1512
1337
  type?: "text" | "image_url";
1338
+ text?: string;
1513
1339
  image_url?: {
1514
1340
  url?: string;
1515
1341
  detail?: "low" | "high" | "auto";
1516
1342
  };
1517
1343
  }[];
1518
- name?: string;
1519
1344
  tool_calls?: {
1520
1345
  function?: {
1521
1346
  name?: string;
@@ -1529,16 +1354,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1529
1354
  finish_reason?: "length" | "tool_calls" | "stop" | "content_filter" | "function_call";
1530
1355
  }, {
1531
1356
  message?: {
1532
- role?: "assistant" | "system" | "user" | "tool";
1357
+ name?: string;
1358
+ role?: "system" | "user" | "assistant" | "tool";
1533
1359
  content?: string | {
1534
- text?: string;
1535
1360
  type?: "text" | "image_url";
1361
+ text?: string;
1536
1362
  image_url?: {
1537
1363
  url?: string;
1538
1364
  detail?: "low" | "high" | "auto";
1539
1365
  };
1540
1366
  }[];
1541
- name?: string;
1542
1367
  tool_calls?: {
1543
1368
  function?: {
1544
1369
  name?: string;
@@ -1563,16 +1388,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1563
1388
  };
1564
1389
  index?: number;
1565
1390
  delta?: {
1566
- role?: "assistant" | "system" | "user" | "tool";
1391
+ name?: string;
1392
+ role?: "system" | "user" | "assistant" | "tool";
1567
1393
  content?: string | {
1568
- text?: string;
1569
1394
  type?: "text" | "image_url";
1395
+ text?: string;
1570
1396
  image_url?: {
1571
1397
  url?: string;
1572
1398
  detail?: "low" | "high" | "auto";
1573
1399
  };
1574
1400
  }[];
1575
- name?: string;
1576
1401
  tool_calls?: {
1577
1402
  function?: {
1578
1403
  name?: string;
@@ -1632,16 +1457,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1632
1457
  created?: number;
1633
1458
  choices?: {
1634
1459
  message?: {
1635
- role?: "assistant" | "system" | "user" | "tool";
1460
+ name?: string;
1461
+ role?: "system" | "user" | "assistant" | "tool";
1636
1462
  content?: string | {
1637
- text?: string;
1638
1463
  type?: "text" | "image_url";
1464
+ text?: string;
1639
1465
  image_url?: {
1640
1466
  url?: string;
1641
1467
  detail?: "low" | "high" | "auto";
1642
1468
  };
1643
1469
  }[];
1644
- name?: string;
1645
1470
  tool_calls?: {
1646
1471
  function?: {
1647
1472
  name?: string;
@@ -1666,16 +1491,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1666
1491
  };
1667
1492
  index?: number;
1668
1493
  delta?: {
1669
- role?: "assistant" | "system" | "user" | "tool";
1494
+ name?: string;
1495
+ role?: "system" | "user" | "assistant" | "tool";
1670
1496
  content?: string | {
1671
- text?: string;
1672
1497
  type?: "text" | "image_url";
1498
+ text?: string;
1673
1499
  image_url?: {
1674
1500
  url?: string;
1675
1501
  detail?: "low" | "high" | "auto";
1676
1502
  };
1677
1503
  }[];
1678
- name?: string;
1679
1504
  tool_calls?: {
1680
1505
  function?: {
1681
1506
  name?: string;
@@ -1707,16 +1532,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1707
1532
  created?: number;
1708
1533
  choices?: {
1709
1534
  message?: {
1710
- role?: "assistant" | "system" | "user" | "tool";
1535
+ name?: string;
1536
+ role?: "system" | "user" | "assistant" | "tool";
1711
1537
  content?: string | {
1712
- text?: string;
1713
1538
  type?: "text" | "image_url";
1539
+ text?: string;
1714
1540
  image_url?: {
1715
1541
  url?: string;
1716
1542
  detail?: "low" | "high" | "auto";
1717
1543
  };
1718
1544
  }[];
1719
- name?: string;
1720
1545
  tool_calls?: {
1721
1546
  function?: {
1722
1547
  name?: string;
@@ -1741,16 +1566,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
1741
1566
  };
1742
1567
  index?: number;
1743
1568
  delta?: {
1744
- role?: "assistant" | "system" | "user" | "tool";
1569
+ name?: string;
1570
+ role?: "system" | "user" | "assistant" | "tool";
1745
1571
  content?: string | {
1746
- text?: string;
1747
1572
  type?: "text" | "image_url";
1573
+ text?: string;
1748
1574
  image_url?: {
1749
1575
  url?: string;
1750
1576
  detail?: "low" | "high" | "auto";
1751
1577
  };
1752
1578
  }[];
1753
- name?: string;
1754
1579
  tool_calls?: {
1755
1580
  function?: {
1756
1581
  name?: string;
@@ -1799,15 +1624,15 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
1799
1624
  detail?: "low" | "high" | "auto";
1800
1625
  }>>;
1801
1626
  }, "strip", z.ZodTypeAny, {
1802
- text?: string;
1803
1627
  type?: "text" | "image_url";
1628
+ text?: string;
1804
1629
  image_url?: {
1805
1630
  url?: string;
1806
1631
  detail?: "low" | "high" | "auto";
1807
1632
  };
1808
1633
  }, {
1809
- text?: string;
1810
1634
  type?: "text" | "image_url";
1635
+ text?: string;
1811
1636
  image_url?: {
1812
1637
  url?: string;
1813
1638
  detail?: "low" | "high" | "auto";
@@ -1844,16 +1669,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
1844
1669
  }>, "many">>;
1845
1670
  tool_call_id: z.ZodOptional<z.ZodString>;
1846
1671
  }, "strip", z.ZodTypeAny, {
1847
- role?: "assistant" | "system" | "user" | "tool";
1672
+ name?: string;
1673
+ role?: "system" | "user" | "assistant" | "tool";
1848
1674
  content?: string | {
1849
- text?: string;
1850
1675
  type?: "text" | "image_url";
1676
+ text?: string;
1851
1677
  image_url?: {
1852
1678
  url?: string;
1853
1679
  detail?: "low" | "high" | "auto";
1854
1680
  };
1855
1681
  }[];
1856
- name?: string;
1857
1682
  tool_calls?: {
1858
1683
  function?: {
1859
1684
  name?: string;
@@ -1864,16 +1689,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
1864
1689
  }[];
1865
1690
  tool_call_id?: string;
1866
1691
  }, {
1867
- role?: "assistant" | "system" | "user" | "tool";
1692
+ name?: string;
1693
+ role?: "system" | "user" | "assistant" | "tool";
1868
1694
  content?: string | {
1869
- text?: string;
1870
1695
  type?: "text" | "image_url";
1696
+ text?: string;
1871
1697
  image_url?: {
1872
1698
  url?: string;
1873
1699
  detail?: "low" | "high" | "auto";
1874
1700
  };
1875
1701
  }[];
1876
- name?: string;
1877
1702
  tool_calls?: {
1878
1703
  function?: {
1879
1704
  name?: string;
@@ -1900,15 +1725,15 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
1900
1725
  detail?: "low" | "high" | "auto";
1901
1726
  }>>;
1902
1727
  }, "strip", z.ZodTypeAny, {
1903
- text?: string;
1904
1728
  type?: "text" | "image_url";
1729
+ text?: string;
1905
1730
  image_url?: {
1906
1731
  url?: string;
1907
1732
  detail?: "low" | "high" | "auto";
1908
1733
  };
1909
1734
  }, {
1910
- text?: string;
1911
1735
  type?: "text" | "image_url";
1736
+ text?: string;
1912
1737
  image_url?: {
1913
1738
  url?: string;
1914
1739
  detail?: "low" | "high" | "auto";
@@ -1945,16 +1770,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
1945
1770
  }>, "many">>;
1946
1771
  tool_call_id: z.ZodOptional<z.ZodString>;
1947
1772
  }, "strip", z.ZodTypeAny, {
1948
- role?: "assistant" | "system" | "user" | "tool";
1773
+ name?: string;
1774
+ role?: "system" | "user" | "assistant" | "tool";
1949
1775
  content?: string | {
1950
- text?: string;
1951
1776
  type?: "text" | "image_url";
1777
+ text?: string;
1952
1778
  image_url?: {
1953
1779
  url?: string;
1954
1780
  detail?: "low" | "high" | "auto";
1955
1781
  };
1956
1782
  }[];
1957
- name?: string;
1958
1783
  tool_calls?: {
1959
1784
  function?: {
1960
1785
  name?: string;
@@ -1965,16 +1790,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
1965
1790
  }[];
1966
1791
  tool_call_id?: string;
1967
1792
  }, {
1968
- role?: "assistant" | "system" | "user" | "tool";
1793
+ name?: string;
1794
+ role?: "system" | "user" | "assistant" | "tool";
1969
1795
  content?: string | {
1970
- text?: string;
1971
1796
  type?: "text" | "image_url";
1797
+ text?: string;
1972
1798
  image_url?: {
1973
1799
  url?: string;
1974
1800
  detail?: "low" | "high" | "auto";
1975
1801
  };
1976
1802
  }[];
1977
- name?: string;
1978
1803
  tool_calls?: {
1979
1804
  function?: {
1980
1805
  name?: string;
@@ -2048,16 +1873,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
2048
1873
  finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "function_call"]>>;
2049
1874
  }, "strip", z.ZodTypeAny, {
2050
1875
  message?: {
2051
- role?: "assistant" | "system" | "user" | "tool";
1876
+ name?: string;
1877
+ role?: "system" | "user" | "assistant" | "tool";
2052
1878
  content?: string | {
2053
- text?: string;
2054
1879
  type?: "text" | "image_url";
1880
+ text?: string;
2055
1881
  image_url?: {
2056
1882
  url?: string;
2057
1883
  detail?: "low" | "high" | "auto";
2058
1884
  };
2059
1885
  }[];
2060
- name?: string;
2061
1886
  tool_calls?: {
2062
1887
  function?: {
2063
1888
  name?: string;
@@ -2082,16 +1907,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
2082
1907
  };
2083
1908
  index?: number;
2084
1909
  delta?: {
2085
- role?: "assistant" | "system" | "user" | "tool";
1910
+ name?: string;
1911
+ role?: "system" | "user" | "assistant" | "tool";
2086
1912
  content?: string | {
2087
- text?: string;
2088
1913
  type?: "text" | "image_url";
1914
+ text?: string;
2089
1915
  image_url?: {
2090
1916
  url?: string;
2091
1917
  detail?: "low" | "high" | "auto";
2092
1918
  };
2093
1919
  }[];
2094
- name?: string;
2095
1920
  tool_calls?: {
2096
1921
  function?: {
2097
1922
  name?: string;
@@ -2105,16 +1930,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
2105
1930
  finish_reason?: "length" | "tool_calls" | "stop" | "content_filter" | "function_call";
2106
1931
  }, {
2107
1932
  message?: {
2108
- role?: "assistant" | "system" | "user" | "tool";
1933
+ name?: string;
1934
+ role?: "system" | "user" | "assistant" | "tool";
2109
1935
  content?: string | {
2110
- text?: string;
2111
1936
  type?: "text" | "image_url";
1937
+ text?: string;
2112
1938
  image_url?: {
2113
1939
  url?: string;
2114
1940
  detail?: "low" | "high" | "auto";
2115
1941
  };
2116
1942
  }[];
2117
- name?: string;
2118
1943
  tool_calls?: {
2119
1944
  function?: {
2120
1945
  name?: string;
@@ -2139,16 +1964,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
2139
1964
  };
2140
1965
  index?: number;
2141
1966
  delta?: {
2142
- role?: "assistant" | "system" | "user" | "tool";
1967
+ name?: string;
1968
+ role?: "system" | "user" | "assistant" | "tool";
2143
1969
  content?: string | {
2144
- text?: string;
2145
1970
  type?: "text" | "image_url";
1971
+ text?: string;
2146
1972
  image_url?: {
2147
1973
  url?: string;
2148
1974
  detail?: "low" | "high" | "auto";
2149
1975
  };
2150
1976
  }[];
2151
- name?: string;
2152
1977
  tool_calls?: {
2153
1978
  function?: {
2154
1979
  name?: string;
@@ -2208,16 +2033,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
2208
2033
  created?: number;
2209
2034
  choices?: {
2210
2035
  message?: {
2211
- role?: "assistant" | "system" | "user" | "tool";
2036
+ name?: string;
2037
+ role?: "system" | "user" | "assistant" | "tool";
2212
2038
  content?: string | {
2213
- text?: string;
2214
2039
  type?: "text" | "image_url";
2040
+ text?: string;
2215
2041
  image_url?: {
2216
2042
  url?: string;
2217
2043
  detail?: "low" | "high" | "auto";
2218
2044
  };
2219
2045
  }[];
2220
- name?: string;
2221
2046
  tool_calls?: {
2222
2047
  function?: {
2223
2048
  name?: string;
@@ -2242,16 +2067,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
2242
2067
  };
2243
2068
  index?: number;
2244
2069
  delta?: {
2245
- role?: "assistant" | "system" | "user" | "tool";
2070
+ name?: string;
2071
+ role?: "system" | "user" | "assistant" | "tool";
2246
2072
  content?: string | {
2247
- text?: string;
2248
2073
  type?: "text" | "image_url";
2074
+ text?: string;
2249
2075
  image_url?: {
2250
2076
  url?: string;
2251
2077
  detail?: "low" | "high" | "auto";
2252
2078
  };
2253
2079
  }[];
2254
- name?: string;
2255
2080
  tool_calls?: {
2256
2081
  function?: {
2257
2082
  name?: string;
@@ -2283,16 +2108,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
2283
2108
  created?: number;
2284
2109
  choices?: {
2285
2110
  message?: {
2286
- role?: "assistant" | "system" | "user" | "tool";
2111
+ name?: string;
2112
+ role?: "system" | "user" | "assistant" | "tool";
2287
2113
  content?: string | {
2288
- text?: string;
2289
2114
  type?: "text" | "image_url";
2115
+ text?: string;
2290
2116
  image_url?: {
2291
2117
  url?: string;
2292
2118
  detail?: "low" | "high" | "auto";
2293
2119
  };
2294
2120
  }[];
2295
- name?: string;
2296
2121
  tool_calls?: {
2297
2122
  function?: {
2298
2123
  name?: string;
@@ -2317,16 +2142,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
2317
2142
  };
2318
2143
  index?: number;
2319
2144
  delta?: {
2320
- role?: "assistant" | "system" | "user" | "tool";
2145
+ name?: string;
2146
+ role?: "system" | "user" | "assistant" | "tool";
2321
2147
  content?: string | {
2322
- text?: string;
2323
2148
  type?: "text" | "image_url";
2149
+ text?: string;
2324
2150
  image_url?: {
2325
2151
  url?: string;
2326
2152
  detail?: "low" | "high" | "auto";
2327
2153
  };
2328
2154
  }[];
2329
- name?: string;
2330
2155
  tool_calls?: {
2331
2156
  function?: {
2332
2157
  name?: string;
@@ -2364,16 +2189,16 @@ declare const validateOpenAIRequest: (data: unknown) => {
2364
2189
  user?: string;
2365
2190
  model?: string;
2366
2191
  messages?: {
2367
- role?: "assistant" | "system" | "user" | "tool";
2192
+ name?: string;
2193
+ role?: "system" | "user" | "assistant" | "tool";
2368
2194
  content?: string | {
2369
- text?: string;
2370
2195
  type?: "text" | "image_url";
2196
+ text?: string;
2371
2197
  image_url?: {
2372
2198
  url?: string;
2373
2199
  detail?: "low" | "high" | "auto";
2374
2200
  };
2375
2201
  }[];
2376
- name?: string;
2377
2202
  tool_calls?: {
2378
2203
  function?: {
2379
2204
  name?: string;
@@ -2426,16 +2251,16 @@ declare const validateOpenAIResponse: (data: unknown) => {
2426
2251
  created?: number;
2427
2252
  choices?: {
2428
2253
  message?: {
2429
- role?: "assistant" | "system" | "user" | "tool";
2254
+ name?: string;
2255
+ role?: "system" | "user" | "assistant" | "tool";
2430
2256
  content?: string | {
2431
- text?: string;
2432
2257
  type?: "text" | "image_url";
2258
+ text?: string;
2433
2259
  image_url?: {
2434
2260
  url?: string;
2435
2261
  detail?: "low" | "high" | "auto";
2436
2262
  };
2437
2263
  }[];
2438
- name?: string;
2439
2264
  tool_calls?: {
2440
2265
  function?: {
2441
2266
  name?: string;
@@ -2460,16 +2285,16 @@ declare const validateOpenAIResponse: (data: unknown) => {
2460
2285
  };
2461
2286
  index?: number;
2462
2287
  delta?: {
2463
- role?: "assistant" | "system" | "user" | "tool";
2288
+ name?: string;
2289
+ role?: "system" | "user" | "assistant" | "tool";
2464
2290
  content?: string | {
2465
- text?: string;
2466
2291
  type?: "text" | "image_url";
2292
+ text?: string;
2467
2293
  image_url?: {
2468
2294
  url?: string;
2469
2295
  detail?: "low" | "high" | "auto";
2470
2296
  };
2471
2297
  }[];
2472
- name?: string;
2473
2298
  tool_calls?: {
2474
2299
  function?: {
2475
2300
  name?: string;
@@ -2502,16 +2327,16 @@ declare const validateOpenAIStreamChunk: (data: unknown) => {
2502
2327
  created?: number;
2503
2328
  choices?: {
2504
2329
  message?: {
2505
- role?: "assistant" | "system" | "user" | "tool";
2330
+ name?: string;
2331
+ role?: "system" | "user" | "assistant" | "tool";
2506
2332
  content?: string | {
2507
- text?: string;
2508
2333
  type?: "text" | "image_url";
2334
+ text?: string;
2509
2335
  image_url?: {
2510
2336
  url?: string;
2511
2337
  detail?: "low" | "high" | "auto";
2512
2338
  };
2513
2339
  }[];
2514
- name?: string;
2515
2340
  tool_calls?: {
2516
2341
  function?: {
2517
2342
  name?: string;
@@ -2536,16 +2361,16 @@ declare const validateOpenAIStreamChunk: (data: unknown) => {
2536
2361
  };
2537
2362
  index?: number;
2538
2363
  delta?: {
2539
- role?: "assistant" | "system" | "user" | "tool";
2364
+ name?: string;
2365
+ role?: "system" | "user" | "assistant" | "tool";
2540
2366
  content?: string | {
2541
- text?: string;
2542
2367
  type?: "text" | "image_url";
2368
+ text?: string;
2543
2369
  image_url?: {
2544
2370
  url?: string;
2545
2371
  detail?: "low" | "high" | "auto";
2546
2372
  };
2547
2373
  }[];
2548
- name?: string;
2549
2374
  tool_calls?: {
2550
2375
  function?: {
2551
2376
  name?: string;
@@ -2655,19 +2480,19 @@ declare const AnthropicImageSourceSchema: z.ZodObject<{
2655
2480
  declare const AnthropicContentBlockBaseSchema: z.ZodObject<{
2656
2481
  type: z.ZodEnum<["text", "image", "tool_use", "tool_result"]>;
2657
2482
  }, "strip", z.ZodTypeAny, {
2658
- type?: "text" | "tool_use" | "image" | "tool_result";
2483
+ type?: "text" | "image" | "tool_use" | "tool_result";
2659
2484
  }, {
2660
- type?: "text" | "tool_use" | "image" | "tool_result";
2485
+ type?: "text" | "image" | "tool_use" | "tool_result";
2661
2486
  }>;
2662
2487
  declare const AnthropicTextContentBlockSchema: z.ZodObject<{} & {
2663
2488
  type: z.ZodLiteral<"text">;
2664
2489
  text: z.ZodString;
2665
2490
  }, "strip", z.ZodTypeAny, {
2666
- text?: string;
2667
2491
  type?: "text";
2668
- }, {
2669
2492
  text?: string;
2493
+ }, {
2670
2494
  type?: "text";
2495
+ text?: string;
2671
2496
  }>;
2672
2497
  declare const AnthropicImageContentBlockSchema: z.ZodObject<{} & {
2673
2498
  type: z.ZodLiteral<"image">;
@@ -2722,11 +2547,11 @@ declare const AnthropicToolResultContentBlockSchema: z.ZodObject<{} & {
2722
2547
  type: z.ZodLiteral<"text">;
2723
2548
  text: z.ZodString;
2724
2549
  }, "strip", z.ZodTypeAny, {
2725
- text?: string;
2726
2550
  type?: "text";
2727
- }, {
2728
2551
  text?: string;
2552
+ }, {
2729
2553
  type?: "text";
2554
+ text?: string;
2730
2555
  }>, z.ZodObject<{} & {
2731
2556
  type: z.ZodLiteral<"image">;
2732
2557
  source: z.ZodObject<{
@@ -2759,9 +2584,10 @@ declare const AnthropicToolResultContentBlockSchema: z.ZodObject<{} & {
2759
2584
  }>]>, "many">]>>;
2760
2585
  is_error: z.ZodOptional<z.ZodBoolean>;
2761
2586
  }, "strip", z.ZodTypeAny, {
2587
+ type?: "tool_result";
2762
2588
  content?: string | ({
2763
- text?: string;
2764
2589
  type?: "text";
2590
+ text?: string;
2765
2591
  } | {
2766
2592
  type?: "image";
2767
2593
  source?: {
@@ -2770,13 +2596,13 @@ declare const AnthropicToolResultContentBlockSchema: z.ZodObject<{} & {
2770
2596
  data?: string;
2771
2597
  };
2772
2598
  })[];
2773
- type?: "tool_result";
2774
2599
  tool_use_id?: string;
2775
2600
  is_error?: boolean;
2776
2601
  }, {
2602
+ type?: "tool_result";
2777
2603
  content?: string | ({
2778
- text?: string;
2779
2604
  type?: "text";
2605
+ text?: string;
2780
2606
  } | {
2781
2607
  type?: "image";
2782
2608
  source?: {
@@ -2785,7 +2611,6 @@ declare const AnthropicToolResultContentBlockSchema: z.ZodObject<{} & {
2785
2611
  data?: string;
2786
2612
  };
2787
2613
  })[];
2788
- type?: "tool_result";
2789
2614
  tool_use_id?: string;
2790
2615
  is_error?: boolean;
2791
2616
  }>;
@@ -2793,11 +2618,11 @@ declare const AnthropicContentBlockSchema: z.ZodUnion<[z.ZodObject<{} & {
2793
2618
  type: z.ZodLiteral<"text">;
2794
2619
  text: z.ZodString;
2795
2620
  }, "strip", z.ZodTypeAny, {
2796
- text?: string;
2797
2621
  type?: "text";
2798
- }, {
2799
2622
  text?: string;
2623
+ }, {
2800
2624
  type?: "text";
2625
+ text?: string;
2801
2626
  }>, z.ZodObject<{} & {
2802
2627
  type: z.ZodLiteral<"image">;
2803
2628
  source: z.ZodObject<{
@@ -2849,11 +2674,11 @@ declare const AnthropicContentBlockSchema: z.ZodUnion<[z.ZodObject<{} & {
2849
2674
  type: z.ZodLiteral<"text">;
2850
2675
  text: z.ZodString;
2851
2676
  }, "strip", z.ZodTypeAny, {
2852
- text?: string;
2853
2677
  type?: "text";
2854
- }, {
2855
2678
  text?: string;
2679
+ }, {
2856
2680
  type?: "text";
2681
+ text?: string;
2857
2682
  }>, z.ZodObject<{} & {
2858
2683
  type: z.ZodLiteral<"image">;
2859
2684
  source: z.ZodObject<{
@@ -2886,9 +2711,10 @@ declare const AnthropicContentBlockSchema: z.ZodUnion<[z.ZodObject<{} & {
2886
2711
  }>]>, "many">]>>;
2887
2712
  is_error: z.ZodOptional<z.ZodBoolean>;
2888
2713
  }, "strip", z.ZodTypeAny, {
2714
+ type?: "tool_result";
2889
2715
  content?: string | ({
2890
- text?: string;
2891
2716
  type?: "text";
2717
+ text?: string;
2892
2718
  } | {
2893
2719
  type?: "image";
2894
2720
  source?: {
@@ -2897,13 +2723,13 @@ declare const AnthropicContentBlockSchema: z.ZodUnion<[z.ZodObject<{} & {
2897
2723
  data?: string;
2898
2724
  };
2899
2725
  })[];
2900
- type?: "tool_result";
2901
2726
  tool_use_id?: string;
2902
2727
  is_error?: boolean;
2903
2728
  }, {
2729
+ type?: "tool_result";
2904
2730
  content?: string | ({
2905
- text?: string;
2906
2731
  type?: "text";
2732
+ text?: string;
2907
2733
  } | {
2908
2734
  type?: "image";
2909
2735
  source?: {
@@ -2912,7 +2738,6 @@ declare const AnthropicContentBlockSchema: z.ZodUnion<[z.ZodObject<{} & {
2912
2738
  data?: string;
2913
2739
  };
2914
2740
  })[];
2915
- type?: "tool_result";
2916
2741
  tool_use_id?: string;
2917
2742
  is_error?: boolean;
2918
2743
  }>]>;
@@ -2922,11 +2747,11 @@ declare const AnthropicMessageSchema: z.ZodObject<{
2922
2747
  type: z.ZodLiteral<"text">;
2923
2748
  text: z.ZodString;
2924
2749
  }, "strip", z.ZodTypeAny, {
2925
- text?: string;
2926
2750
  type?: "text";
2927
- }, {
2928
2751
  text?: string;
2752
+ }, {
2929
2753
  type?: "text";
2754
+ text?: string;
2930
2755
  }>, z.ZodObject<{} & {
2931
2756
  type: z.ZodLiteral<"image">;
2932
2757
  source: z.ZodObject<{
@@ -2978,11 +2803,11 @@ declare const AnthropicMessageSchema: z.ZodObject<{
2978
2803
  type: z.ZodLiteral<"text">;
2979
2804
  text: z.ZodString;
2980
2805
  }, "strip", z.ZodTypeAny, {
2981
- text?: string;
2982
2806
  type?: "text";
2983
- }, {
2984
2807
  text?: string;
2808
+ }, {
2985
2809
  type?: "text";
2810
+ text?: string;
2986
2811
  }>, z.ZodObject<{} & {
2987
2812
  type: z.ZodLiteral<"image">;
2988
2813
  source: z.ZodObject<{
@@ -3015,9 +2840,10 @@ declare const AnthropicMessageSchema: z.ZodObject<{
3015
2840
  }>]>, "many">]>>;
3016
2841
  is_error: z.ZodOptional<z.ZodBoolean>;
3017
2842
  }, "strip", z.ZodTypeAny, {
2843
+ type?: "tool_result";
3018
2844
  content?: string | ({
3019
- text?: string;
3020
2845
  type?: "text";
2846
+ text?: string;
3021
2847
  } | {
3022
2848
  type?: "image";
3023
2849
  source?: {
@@ -3026,13 +2852,13 @@ declare const AnthropicMessageSchema: z.ZodObject<{
3026
2852
  data?: string;
3027
2853
  };
3028
2854
  })[];
3029
- type?: "tool_result";
3030
2855
  tool_use_id?: string;
3031
2856
  is_error?: boolean;
3032
2857
  }, {
2858
+ type?: "tool_result";
3033
2859
  content?: string | ({
3034
- text?: string;
3035
2860
  type?: "text";
2861
+ text?: string;
3036
2862
  } | {
3037
2863
  type?: "image";
3038
2864
  source?: {
@@ -3041,15 +2867,14 @@ declare const AnthropicMessageSchema: z.ZodObject<{
3041
2867
  data?: string;
3042
2868
  };
3043
2869
  })[];
3044
- type?: "tool_result";
3045
2870
  tool_use_id?: string;
3046
2871
  is_error?: boolean;
3047
2872
  }>]>, "many">]>;
3048
2873
  }, "strip", z.ZodTypeAny, {
3049
- role?: "assistant" | "system" | "user";
2874
+ role?: "system" | "user" | "assistant";
3050
2875
  content?: string | ({
3051
- text?: string;
3052
2876
  type?: "text";
2877
+ text?: string;
3053
2878
  } | {
3054
2879
  type?: "image";
3055
2880
  source?: {
@@ -3063,9 +2888,10 @@ declare const AnthropicMessageSchema: z.ZodObject<{
3063
2888
  id?: string;
3064
2889
  input?: Record<string, unknown>;
3065
2890
  } | {
2891
+ type?: "tool_result";
3066
2892
  content?: string | ({
3067
- text?: string;
3068
2893
  type?: "text";
2894
+ text?: string;
3069
2895
  } | {
3070
2896
  type?: "image";
3071
2897
  source?: {
@@ -3074,15 +2900,14 @@ declare const AnthropicMessageSchema: z.ZodObject<{
3074
2900
  data?: string;
3075
2901
  };
3076
2902
  })[];
3077
- type?: "tool_result";
3078
2903
  tool_use_id?: string;
3079
2904
  is_error?: boolean;
3080
2905
  })[];
3081
2906
  }, {
3082
- role?: "assistant" | "system" | "user";
2907
+ role?: "system" | "user" | "assistant";
3083
2908
  content?: string | ({
3084
- text?: string;
3085
2909
  type?: "text";
2910
+ text?: string;
3086
2911
  } | {
3087
2912
  type?: "image";
3088
2913
  source?: {
@@ -3096,9 +2921,10 @@ declare const AnthropicMessageSchema: z.ZodObject<{
3096
2921
  id?: string;
3097
2922
  input?: Record<string, unknown>;
3098
2923
  } | {
2924
+ type?: "tool_result";
3099
2925
  content?: string | ({
3100
- text?: string;
3101
2926
  type?: "text";
2927
+ text?: string;
3102
2928
  } | {
3103
2929
  type?: "image";
3104
2930
  source?: {
@@ -3107,7 +2933,6 @@ declare const AnthropicMessageSchema: z.ZodObject<{
3107
2933
  data?: string;
3108
2934
  };
3109
2935
  })[];
3110
- type?: "tool_result";
3111
2936
  tool_use_id?: string;
3112
2937
  is_error?: boolean;
3113
2938
  })[];
@@ -3123,14 +2948,14 @@ declare const AnthropicSystemMessageSchema: z.ZodUnion<[z.ZodString, z.ZodArray<
3123
2948
  type?: "ephemeral";
3124
2949
  }>>;
3125
2950
  }, "strip", z.ZodTypeAny, {
3126
- text?: string;
3127
2951
  type?: "text";
2952
+ text?: string;
3128
2953
  cache_control?: {
3129
2954
  type?: "ephemeral";
3130
2955
  };
3131
2956
  }, {
3132
- text?: string;
3133
2957
  type?: "text";
2958
+ text?: string;
3134
2959
  cache_control?: {
3135
2960
  type?: "ephemeral";
3136
2961
  };
@@ -3151,11 +2976,11 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3151
2976
  type: z.ZodLiteral<"text">;
3152
2977
  text: z.ZodString;
3153
2978
  }, "strip", z.ZodTypeAny, {
3154
- text?: string;
3155
2979
  type?: "text";
3156
- }, {
3157
2980
  text?: string;
2981
+ }, {
3158
2982
  type?: "text";
2983
+ text?: string;
3159
2984
  }>, z.ZodObject<{} & {
3160
2985
  type: z.ZodLiteral<"image">;
3161
2986
  source: z.ZodObject<{
@@ -3207,11 +3032,11 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3207
3032
  type: z.ZodLiteral<"text">;
3208
3033
  text: z.ZodString;
3209
3034
  }, "strip", z.ZodTypeAny, {
3210
- text?: string;
3211
3035
  type?: "text";
3212
- }, {
3213
3036
  text?: string;
3037
+ }, {
3214
3038
  type?: "text";
3039
+ text?: string;
3215
3040
  }>, z.ZodObject<{} & {
3216
3041
  type: z.ZodLiteral<"image">;
3217
3042
  source: z.ZodObject<{
@@ -3244,9 +3069,10 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3244
3069
  }>]>, "many">]>>;
3245
3070
  is_error: z.ZodOptional<z.ZodBoolean>;
3246
3071
  }, "strip", z.ZodTypeAny, {
3072
+ type?: "tool_result";
3247
3073
  content?: string | ({
3248
- text?: string;
3249
3074
  type?: "text";
3075
+ text?: string;
3250
3076
  } | {
3251
3077
  type?: "image";
3252
3078
  source?: {
@@ -3255,13 +3081,13 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3255
3081
  data?: string;
3256
3082
  };
3257
3083
  })[];
3258
- type?: "tool_result";
3259
3084
  tool_use_id?: string;
3260
3085
  is_error?: boolean;
3261
3086
  }, {
3087
+ type?: "tool_result";
3262
3088
  content?: string | ({
3263
- text?: string;
3264
3089
  type?: "text";
3090
+ text?: string;
3265
3091
  } | {
3266
3092
  type?: "image";
3267
3093
  source?: {
@@ -3270,15 +3096,14 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3270
3096
  data?: string;
3271
3097
  };
3272
3098
  })[];
3273
- type?: "tool_result";
3274
3099
  tool_use_id?: string;
3275
3100
  is_error?: boolean;
3276
3101
  }>]>, "many">]>;
3277
3102
  }, "strip", z.ZodTypeAny, {
3278
- role?: "assistant" | "system" | "user";
3103
+ role?: "system" | "user" | "assistant";
3279
3104
  content?: string | ({
3280
- text?: string;
3281
3105
  type?: "text";
3106
+ text?: string;
3282
3107
  } | {
3283
3108
  type?: "image";
3284
3109
  source?: {
@@ -3292,9 +3117,10 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3292
3117
  id?: string;
3293
3118
  input?: Record<string, unknown>;
3294
3119
  } | {
3120
+ type?: "tool_result";
3295
3121
  content?: string | ({
3296
- text?: string;
3297
3122
  type?: "text";
3123
+ text?: string;
3298
3124
  } | {
3299
3125
  type?: "image";
3300
3126
  source?: {
@@ -3303,15 +3129,14 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3303
3129
  data?: string;
3304
3130
  };
3305
3131
  })[];
3306
- type?: "tool_result";
3307
3132
  tool_use_id?: string;
3308
3133
  is_error?: boolean;
3309
3134
  })[];
3310
3135
  }, {
3311
- role?: "assistant" | "system" | "user";
3136
+ role?: "system" | "user" | "assistant";
3312
3137
  content?: string | ({
3313
- text?: string;
3314
3138
  type?: "text";
3139
+ text?: string;
3315
3140
  } | {
3316
3141
  type?: "image";
3317
3142
  source?: {
@@ -3325,9 +3150,10 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3325
3150
  id?: string;
3326
3151
  input?: Record<string, unknown>;
3327
3152
  } | {
3153
+ type?: "tool_result";
3328
3154
  content?: string | ({
3329
- text?: string;
3330
3155
  type?: "text";
3156
+ text?: string;
3331
3157
  } | {
3332
3158
  type?: "image";
3333
3159
  source?: {
@@ -3336,7 +3162,6 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3336
3162
  data?: string;
3337
3163
  };
3338
3164
  })[];
3339
- type?: "tool_result";
3340
3165
  tool_use_id?: string;
3341
3166
  is_error?: boolean;
3342
3167
  })[];
@@ -3352,14 +3177,14 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3352
3177
  type?: "ephemeral";
3353
3178
  }>>;
3354
3179
  }, "strip", z.ZodTypeAny, {
3355
- text?: string;
3356
3180
  type?: "text";
3181
+ text?: string;
3357
3182
  cache_control?: {
3358
3183
  type?: "ephemeral";
3359
3184
  };
3360
3185
  }, {
3361
- text?: string;
3362
3186
  type?: "text";
3187
+ text?: string;
3363
3188
  cache_control?: {
3364
3189
  type?: "ephemeral";
3365
3190
  };
@@ -3443,18 +3268,18 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3443
3268
  }>]>>;
3444
3269
  }, "strip", z.ZodTypeAny, {
3445
3270
  system?: string | {
3446
- text?: string;
3447
3271
  type?: "text";
3272
+ text?: string;
3448
3273
  cache_control?: {
3449
3274
  type?: "ephemeral";
3450
3275
  };
3451
3276
  }[];
3452
3277
  model?: string;
3453
3278
  messages?: {
3454
- role?: "assistant" | "system" | "user";
3279
+ role?: "system" | "user" | "assistant";
3455
3280
  content?: string | ({
3456
- text?: string;
3457
3281
  type?: "text";
3282
+ text?: string;
3458
3283
  } | {
3459
3284
  type?: "image";
3460
3285
  source?: {
@@ -3468,9 +3293,10 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3468
3293
  id?: string;
3469
3294
  input?: Record<string, unknown>;
3470
3295
  } | {
3296
+ type?: "tool_result";
3471
3297
  content?: string | ({
3472
- text?: string;
3473
3298
  type?: "text";
3299
+ text?: string;
3474
3300
  } | {
3475
3301
  type?: "image";
3476
3302
  source?: {
@@ -3479,7 +3305,6 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3479
3305
  data?: string;
3480
3306
  };
3481
3307
  })[];
3482
- type?: "tool_result";
3483
3308
  tool_use_id?: string;
3484
3309
  is_error?: boolean;
3485
3310
  })[];
@@ -3514,18 +3339,18 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3514
3339
  top_k?: number;
3515
3340
  }, {
3516
3341
  system?: string | {
3517
- text?: string;
3518
3342
  type?: "text";
3343
+ text?: string;
3519
3344
  cache_control?: {
3520
3345
  type?: "ephemeral";
3521
3346
  };
3522
3347
  }[];
3523
3348
  model?: string;
3524
3349
  messages?: {
3525
- role?: "assistant" | "system" | "user";
3350
+ role?: "system" | "user" | "assistant";
3526
3351
  content?: string | ({
3527
- text?: string;
3528
3352
  type?: "text";
3353
+ text?: string;
3529
3354
  } | {
3530
3355
  type?: "image";
3531
3356
  source?: {
@@ -3539,9 +3364,10 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3539
3364
  id?: string;
3540
3365
  input?: Record<string, unknown>;
3541
3366
  } | {
3367
+ type?: "tool_result";
3542
3368
  content?: string | ({
3543
- text?: string;
3544
3369
  type?: "text";
3370
+ text?: string;
3545
3371
  } | {
3546
3372
  type?: "image";
3547
3373
  source?: {
@@ -3550,7 +3376,6 @@ declare const AnthropicRequestSchema: z.ZodObject<{
3550
3376
  data?: string;
3551
3377
  };
3552
3378
  })[];
3553
- type?: "tool_result";
3554
3379
  tool_use_id?: string;
3555
3380
  is_error?: boolean;
3556
3381
  })[];
@@ -3609,11 +3434,11 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3609
3434
  type: z.ZodLiteral<"text">;
3610
3435
  text: z.ZodString;
3611
3436
  }, "strip", z.ZodTypeAny, {
3612
- text?: string;
3613
3437
  type?: "text";
3614
- }, {
3615
3438
  text?: string;
3439
+ }, {
3616
3440
  type?: "text";
3441
+ text?: string;
3617
3442
  }>, z.ZodObject<{} & {
3618
3443
  type: z.ZodLiteral<"image">;
3619
3444
  source: z.ZodObject<{
@@ -3665,11 +3490,11 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3665
3490
  type: z.ZodLiteral<"text">;
3666
3491
  text: z.ZodString;
3667
3492
  }, "strip", z.ZodTypeAny, {
3668
- text?: string;
3669
3493
  type?: "text";
3670
- }, {
3671
3494
  text?: string;
3495
+ }, {
3672
3496
  type?: "text";
3497
+ text?: string;
3673
3498
  }>, z.ZodObject<{} & {
3674
3499
  type: z.ZodLiteral<"image">;
3675
3500
  source: z.ZodObject<{
@@ -3702,9 +3527,10 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3702
3527
  }>]>, "many">]>>;
3703
3528
  is_error: z.ZodOptional<z.ZodBoolean>;
3704
3529
  }, "strip", z.ZodTypeAny, {
3530
+ type?: "tool_result";
3705
3531
  content?: string | ({
3706
- text?: string;
3707
3532
  type?: "text";
3533
+ text?: string;
3708
3534
  } | {
3709
3535
  type?: "image";
3710
3536
  source?: {
@@ -3713,13 +3539,13 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3713
3539
  data?: string;
3714
3540
  };
3715
3541
  })[];
3716
- type?: "tool_result";
3717
3542
  tool_use_id?: string;
3718
3543
  is_error?: boolean;
3719
3544
  }, {
3545
+ type?: "tool_result";
3720
3546
  content?: string | ({
3721
- text?: string;
3722
3547
  type?: "text";
3548
+ text?: string;
3723
3549
  } | {
3724
3550
  type?: "image";
3725
3551
  source?: {
@@ -3728,7 +3554,6 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3728
3554
  data?: string;
3729
3555
  };
3730
3556
  })[];
3731
- type?: "tool_result";
3732
3557
  tool_use_id?: string;
3733
3558
  is_error?: boolean;
3734
3559
  }>]>, "many">;
@@ -3751,10 +3576,12 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3751
3576
  cache_read_input_tokens?: number;
3752
3577
  }>;
3753
3578
  }, "strip", z.ZodTypeAny, {
3579
+ type?: "message";
3580
+ id?: string;
3754
3581
  role?: "assistant";
3755
3582
  content?: ({
3756
- text?: string;
3757
3583
  type?: "text";
3584
+ text?: string;
3758
3585
  } | {
3759
3586
  type?: "image";
3760
3587
  source?: {
@@ -3768,9 +3595,10 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3768
3595
  id?: string;
3769
3596
  input?: Record<string, unknown>;
3770
3597
  } | {
3598
+ type?: "tool_result";
3771
3599
  content?: string | ({
3772
- text?: string;
3773
3600
  type?: "text";
3601
+ text?: string;
3774
3602
  } | {
3775
3603
  type?: "image";
3776
3604
  source?: {
@@ -3779,12 +3607,9 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3779
3607
  data?: string;
3780
3608
  };
3781
3609
  })[];
3782
- type?: "tool_result";
3783
3610
  tool_use_id?: string;
3784
3611
  is_error?: boolean;
3785
3612
  })[];
3786
- type?: "message";
3787
- id?: string;
3788
3613
  model?: string;
3789
3614
  usage?: {
3790
3615
  input_tokens?: number;
@@ -3793,12 +3618,14 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3793
3618
  cache_read_input_tokens?: number;
3794
3619
  };
3795
3620
  stop_sequence?: string;
3796
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
3621
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
3797
3622
  }, {
3623
+ type?: "message";
3624
+ id?: string;
3798
3625
  role?: "assistant";
3799
3626
  content?: ({
3800
- text?: string;
3801
3627
  type?: "text";
3628
+ text?: string;
3802
3629
  } | {
3803
3630
  type?: "image";
3804
3631
  source?: {
@@ -3812,9 +3639,10 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3812
3639
  id?: string;
3813
3640
  input?: Record<string, unknown>;
3814
3641
  } | {
3642
+ type?: "tool_result";
3815
3643
  content?: string | ({
3816
- text?: string;
3817
3644
  type?: "text";
3645
+ text?: string;
3818
3646
  } | {
3819
3647
  type?: "image";
3820
3648
  source?: {
@@ -3823,12 +3651,9 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3823
3651
  data?: string;
3824
3652
  };
3825
3653
  })[];
3826
- type?: "tool_result";
3827
3654
  tool_use_id?: string;
3828
3655
  is_error?: boolean;
3829
3656
  })[];
3830
- type?: "message";
3831
- id?: string;
3832
3657
  model?: string;
3833
3658
  usage?: {
3834
3659
  input_tokens?: number;
@@ -3837,7 +3662,7 @@ declare const AnthropicResponseSchema: z.ZodObject<{
3837
3662
  cache_read_input_tokens?: number;
3838
3663
  };
3839
3664
  stop_sequence?: string;
3840
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
3665
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
3841
3666
  }>;
3842
3667
  declare const AnthropicStreamEventBaseSchema: z.ZodObject<{
3843
3668
  type: z.ZodString;
@@ -3857,11 +3682,11 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
3857
3682
  type: z.ZodLiteral<"text">;
3858
3683
  text: z.ZodString;
3859
3684
  }, "strip", z.ZodTypeAny, {
3860
- text?: string;
3861
3685
  type?: "text";
3862
- }, {
3863
3686
  text?: string;
3687
+ }, {
3864
3688
  type?: "text";
3689
+ text?: string;
3865
3690
  }>, z.ZodObject<{} & {
3866
3691
  type: z.ZodLiteral<"image">;
3867
3692
  source: z.ZodObject<{
@@ -3913,11 +3738,11 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
3913
3738
  type: z.ZodLiteral<"text">;
3914
3739
  text: z.ZodString;
3915
3740
  }, "strip", z.ZodTypeAny, {
3916
- text?: string;
3917
3741
  type?: "text";
3918
- }, {
3919
3742
  text?: string;
3743
+ }, {
3920
3744
  type?: "text";
3745
+ text?: string;
3921
3746
  }>, z.ZodObject<{} & {
3922
3747
  type: z.ZodLiteral<"image">;
3923
3748
  source: z.ZodObject<{
@@ -3950,9 +3775,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
3950
3775
  }>]>, "many">]>>;
3951
3776
  is_error: z.ZodOptional<z.ZodBoolean>;
3952
3777
  }, "strip", z.ZodTypeAny, {
3778
+ type?: "tool_result";
3953
3779
  content?: string | ({
3954
- text?: string;
3955
3780
  type?: "text";
3781
+ text?: string;
3956
3782
  } | {
3957
3783
  type?: "image";
3958
3784
  source?: {
@@ -3961,13 +3787,13 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
3961
3787
  data?: string;
3962
3788
  };
3963
3789
  })[];
3964
- type?: "tool_result";
3965
3790
  tool_use_id?: string;
3966
3791
  is_error?: boolean;
3967
3792
  }, {
3793
+ type?: "tool_result";
3968
3794
  content?: string | ({
3969
- text?: string;
3970
3795
  type?: "text";
3796
+ text?: string;
3971
3797
  } | {
3972
3798
  type?: "image";
3973
3799
  source?: {
@@ -3976,7 +3802,6 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
3976
3802
  data?: string;
3977
3803
  };
3978
3804
  })[];
3979
- type?: "tool_result";
3980
3805
  tool_use_id?: string;
3981
3806
  is_error?: boolean;
3982
3807
  }>]>, "many">;
@@ -4003,11 +3828,11 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4003
3828
  type: z.ZodLiteral<"text">;
4004
3829
  text: z.ZodString;
4005
3830
  }, "strip", z.ZodTypeAny, {
4006
- text?: string;
4007
3831
  type?: "text";
4008
- }, {
4009
3832
  text?: string;
3833
+ }, {
4010
3834
  type?: "text";
3835
+ text?: string;
4011
3836
  }>, z.ZodObject<{} & {
4012
3837
  type: z.ZodLiteral<"image">;
4013
3838
  source: z.ZodObject<{
@@ -4059,11 +3884,11 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4059
3884
  type: z.ZodLiteral<"text">;
4060
3885
  text: z.ZodString;
4061
3886
  }, "strip", z.ZodTypeAny, {
4062
- text?: string;
4063
3887
  type?: "text";
4064
- }, {
4065
3888
  text?: string;
3889
+ }, {
4066
3890
  type?: "text";
3891
+ text?: string;
4067
3892
  }>, z.ZodObject<{} & {
4068
3893
  type: z.ZodLiteral<"image">;
4069
3894
  source: z.ZodObject<{
@@ -4096,9 +3921,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4096
3921
  }>]>, "many">]>>;
4097
3922
  is_error: z.ZodOptional<z.ZodBoolean>;
4098
3923
  }, "strip", z.ZodTypeAny, {
3924
+ type?: "tool_result";
4099
3925
  content?: string | ({
4100
- text?: string;
4101
3926
  type?: "text";
3927
+ text?: string;
4102
3928
  } | {
4103
3929
  type?: "image";
4104
3930
  source?: {
@@ -4107,13 +3933,13 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4107
3933
  data?: string;
4108
3934
  };
4109
3935
  })[];
4110
- type?: "tool_result";
4111
3936
  tool_use_id?: string;
4112
3937
  is_error?: boolean;
4113
3938
  }, {
3939
+ type?: "tool_result";
4114
3940
  content?: string | ({
4115
- text?: string;
4116
3941
  type?: "text";
3942
+ text?: string;
4117
3943
  } | {
4118
3944
  type?: "image";
4119
3945
  source?: {
@@ -4122,15 +3948,16 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4122
3948
  data?: string;
4123
3949
  };
4124
3950
  })[];
4125
- type?: "tool_result";
4126
3951
  tool_use_id?: string;
4127
3952
  is_error?: boolean;
4128
3953
  }>]>, "many">>;
4129
3954
  }, "strip", z.ZodTypeAny, {
3955
+ type?: "message";
3956
+ id?: string;
4130
3957
  role?: "assistant";
4131
3958
  content?: ({
4132
- text?: string;
4133
3959
  type?: "text";
3960
+ text?: string;
4134
3961
  } | {
4135
3962
  type?: "image";
4136
3963
  source?: {
@@ -4144,9 +3971,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4144
3971
  id?: string;
4145
3972
  input?: Record<string, unknown>;
4146
3973
  } | {
3974
+ type?: "tool_result";
4147
3975
  content?: string | ({
4148
- text?: string;
4149
3976
  type?: "text";
3977
+ text?: string;
4150
3978
  } | {
4151
3979
  type?: "image";
4152
3980
  source?: {
@@ -4155,12 +3983,9 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4155
3983
  data?: string;
4156
3984
  };
4157
3985
  })[];
4158
- type?: "tool_result";
4159
3986
  tool_use_id?: string;
4160
3987
  is_error?: boolean;
4161
3988
  })[];
4162
- type?: "message";
4163
- id?: string;
4164
3989
  model?: string;
4165
3990
  usage?: {
4166
3991
  input_tokens?: number;
@@ -4169,12 +3994,14 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4169
3994
  cache_read_input_tokens?: number;
4170
3995
  };
4171
3996
  stop_sequence?: string;
4172
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
3997
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
4173
3998
  }, {
3999
+ type?: "message";
4000
+ id?: string;
4174
4001
  role?: "assistant";
4175
4002
  content?: ({
4176
- text?: string;
4177
4003
  type?: "text";
4004
+ text?: string;
4178
4005
  } | {
4179
4006
  type?: "image";
4180
4007
  source?: {
@@ -4188,9 +4015,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4188
4015
  id?: string;
4189
4016
  input?: Record<string, unknown>;
4190
4017
  } | {
4018
+ type?: "tool_result";
4191
4019
  content?: string | ({
4192
- text?: string;
4193
4020
  type?: "text";
4021
+ text?: string;
4194
4022
  } | {
4195
4023
  type?: "image";
4196
4024
  source?: {
@@ -4199,12 +4027,9 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4199
4027
  data?: string;
4200
4028
  };
4201
4029
  })[];
4202
- type?: "tool_result";
4203
4030
  tool_use_id?: string;
4204
4031
  is_error?: boolean;
4205
4032
  })[];
4206
- type?: "message";
4207
- id?: string;
4208
4033
  model?: string;
4209
4034
  usage?: {
4210
4035
  input_tokens?: number;
@@ -4213,14 +4038,17 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4213
4038
  cache_read_input_tokens?: number;
4214
4039
  };
4215
4040
  stop_sequence?: string;
4216
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4041
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
4217
4042
  }>;
4218
4043
  }, "strip", z.ZodTypeAny, {
4044
+ type?: "message_start";
4219
4045
  message?: {
4046
+ type?: "message";
4047
+ id?: string;
4220
4048
  role?: "assistant";
4221
4049
  content?: ({
4222
- text?: string;
4223
4050
  type?: "text";
4051
+ text?: string;
4224
4052
  } | {
4225
4053
  type?: "image";
4226
4054
  source?: {
@@ -4234,9 +4062,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4234
4062
  id?: string;
4235
4063
  input?: Record<string, unknown>;
4236
4064
  } | {
4065
+ type?: "tool_result";
4237
4066
  content?: string | ({
4238
- text?: string;
4239
4067
  type?: "text";
4068
+ text?: string;
4240
4069
  } | {
4241
4070
  type?: "image";
4242
4071
  source?: {
@@ -4245,12 +4074,9 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4245
4074
  data?: string;
4246
4075
  };
4247
4076
  })[];
4248
- type?: "tool_result";
4249
4077
  tool_use_id?: string;
4250
4078
  is_error?: boolean;
4251
4079
  })[];
4252
- type?: "message";
4253
- id?: string;
4254
4080
  model?: string;
4255
4081
  usage?: {
4256
4082
  input_tokens?: number;
@@ -4259,15 +4085,17 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4259
4085
  cache_read_input_tokens?: number;
4260
4086
  };
4261
4087
  stop_sequence?: string;
4262
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4088
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
4263
4089
  };
4264
- type?: "message_start";
4265
4090
  }, {
4091
+ type?: "message_start";
4266
4092
  message?: {
4093
+ type?: "message";
4094
+ id?: string;
4267
4095
  role?: "assistant";
4268
4096
  content?: ({
4269
- text?: string;
4270
4097
  type?: "text";
4098
+ text?: string;
4271
4099
  } | {
4272
4100
  type?: "image";
4273
4101
  source?: {
@@ -4281,9 +4109,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4281
4109
  id?: string;
4282
4110
  input?: Record<string, unknown>;
4283
4111
  } | {
4112
+ type?: "tool_result";
4284
4113
  content?: string | ({
4285
- text?: string;
4286
4114
  type?: "text";
4115
+ text?: string;
4287
4116
  } | {
4288
4117
  type?: "image";
4289
4118
  source?: {
@@ -4292,12 +4121,9 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4292
4121
  data?: string;
4293
4122
  };
4294
4123
  })[];
4295
- type?: "tool_result";
4296
4124
  tool_use_id?: string;
4297
4125
  is_error?: boolean;
4298
4126
  })[];
4299
- type?: "message";
4300
- id?: string;
4301
4127
  model?: string;
4302
4128
  usage?: {
4303
4129
  input_tokens?: number;
@@ -4306,9 +4132,8 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
4306
4132
  cache_read_input_tokens?: number;
4307
4133
  };
4308
4134
  stop_sequence?: string;
4309
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4135
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
4310
4136
  };
4311
- type?: "message_start";
4312
4137
  }>;
4313
4138
  declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4314
4139
  type: z.ZodLiteral<"content_block_start">;
@@ -4317,11 +4142,11 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4317
4142
  type: z.ZodLiteral<"text">;
4318
4143
  text: z.ZodString;
4319
4144
  }, "strip", z.ZodTypeAny, {
4320
- text?: string;
4321
4145
  type?: "text";
4322
- }, {
4323
4146
  text?: string;
4147
+ }, {
4324
4148
  type?: "text";
4149
+ text?: string;
4325
4150
  }>, z.ZodObject<{} & {
4326
4151
  type: z.ZodLiteral<"image">;
4327
4152
  source: z.ZodObject<{
@@ -4373,11 +4198,11 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4373
4198
  type: z.ZodLiteral<"text">;
4374
4199
  text: z.ZodString;
4375
4200
  }, "strip", z.ZodTypeAny, {
4376
- text?: string;
4377
4201
  type?: "text";
4378
- }, {
4379
4202
  text?: string;
4203
+ }, {
4380
4204
  type?: "text";
4205
+ text?: string;
4381
4206
  }>, z.ZodObject<{} & {
4382
4207
  type: z.ZodLiteral<"image">;
4383
4208
  source: z.ZodObject<{
@@ -4410,9 +4235,10 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4410
4235
  }>]>, "many">]>>;
4411
4236
  is_error: z.ZodOptional<z.ZodBoolean>;
4412
4237
  }, "strip", z.ZodTypeAny, {
4238
+ type?: "tool_result";
4413
4239
  content?: string | ({
4414
- text?: string;
4415
4240
  type?: "text";
4241
+ text?: string;
4416
4242
  } | {
4417
4243
  type?: "image";
4418
4244
  source?: {
@@ -4421,13 +4247,13 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4421
4247
  data?: string;
4422
4248
  };
4423
4249
  })[];
4424
- type?: "tool_result";
4425
4250
  tool_use_id?: string;
4426
4251
  is_error?: boolean;
4427
4252
  }, {
4253
+ type?: "tool_result";
4428
4254
  content?: string | ({
4429
- text?: string;
4430
4255
  type?: "text";
4256
+ text?: string;
4431
4257
  } | {
4432
4258
  type?: "image";
4433
4259
  source?: {
@@ -4436,7 +4262,6 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4436
4262
  data?: string;
4437
4263
  };
4438
4264
  })[];
4439
- type?: "tool_result";
4440
4265
  tool_use_id?: string;
4441
4266
  is_error?: boolean;
4442
4267
  }>]>;
@@ -4444,8 +4269,8 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4444
4269
  type?: "content_block_start";
4445
4270
  index?: number;
4446
4271
  content_block?: {
4447
- text?: string;
4448
4272
  type?: "text";
4273
+ text?: string;
4449
4274
  } | {
4450
4275
  type?: "image";
4451
4276
  source?: {
@@ -4459,9 +4284,10 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4459
4284
  id?: string;
4460
4285
  input?: Record<string, unknown>;
4461
4286
  } | {
4287
+ type?: "tool_result";
4462
4288
  content?: string | ({
4463
- text?: string;
4464
4289
  type?: "text";
4290
+ text?: string;
4465
4291
  } | {
4466
4292
  type?: "image";
4467
4293
  source?: {
@@ -4470,7 +4296,6 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4470
4296
  data?: string;
4471
4297
  };
4472
4298
  })[];
4473
- type?: "tool_result";
4474
4299
  tool_use_id?: string;
4475
4300
  is_error?: boolean;
4476
4301
  };
@@ -4478,8 +4303,8 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4478
4303
  type?: "content_block_start";
4479
4304
  index?: number;
4480
4305
  content_block?: {
4481
- text?: string;
4482
4306
  type?: "text";
4307
+ text?: string;
4483
4308
  } | {
4484
4309
  type?: "image";
4485
4310
  source?: {
@@ -4493,9 +4318,10 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4493
4318
  id?: string;
4494
4319
  input?: Record<string, unknown>;
4495
4320
  } | {
4321
+ type?: "tool_result";
4496
4322
  content?: string | ({
4497
- text?: string;
4498
4323
  type?: "text";
4324
+ text?: string;
4499
4325
  } | {
4500
4326
  type?: "image";
4501
4327
  source?: {
@@ -4504,7 +4330,6 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
4504
4330
  data?: string;
4505
4331
  };
4506
4332
  })[];
4507
- type?: "tool_result";
4508
4333
  tool_use_id?: string;
4509
4334
  is_error?: boolean;
4510
4335
  };
@@ -4516,11 +4341,11 @@ declare const AnthropicContentBlockDeltaEventSchema: z.ZodObject<{} & {
4516
4341
  type: z.ZodLiteral<"text_delta">;
4517
4342
  text: z.ZodString;
4518
4343
  }, "strip", z.ZodTypeAny, {
4519
- text?: string;
4520
4344
  type?: "text_delta";
4521
- }, {
4522
4345
  text?: string;
4346
+ }, {
4523
4347
  type?: "text_delta";
4348
+ text?: string;
4524
4349
  }>, z.ZodObject<{
4525
4350
  type: z.ZodLiteral<"input_json_delta">;
4526
4351
  partial_json: z.ZodString;
@@ -4535,8 +4360,8 @@ declare const AnthropicContentBlockDeltaEventSchema: z.ZodObject<{} & {
4535
4360
  type?: "content_block_delta";
4536
4361
  index?: number;
4537
4362
  delta?: {
4538
- text?: string;
4539
4363
  type?: "text_delta";
4364
+ text?: string;
4540
4365
  } | {
4541
4366
  type?: "input_json_delta";
4542
4367
  partial_json?: string;
@@ -4545,8 +4370,8 @@ declare const AnthropicContentBlockDeltaEventSchema: z.ZodObject<{} & {
4545
4370
  type?: "content_block_delta";
4546
4371
  index?: number;
4547
4372
  delta?: {
4548
- text?: string;
4549
4373
  type?: "text_delta";
4374
+ text?: string;
4550
4375
  } | {
4551
4376
  type?: "input_json_delta";
4552
4377
  partial_json?: string;
@@ -4569,10 +4394,10 @@ declare const AnthropicMessageDeltaEventSchema: z.ZodObject<{} & {
4569
4394
  stop_sequence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4570
4395
  }, "strip", z.ZodTypeAny, {
4571
4396
  stop_sequence?: string;
4572
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4397
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
4573
4398
  }, {
4574
4399
  stop_sequence?: string;
4575
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4400
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
4576
4401
  }>;
4577
4402
  usage: z.ZodObject<{
4578
4403
  input_tokens: z.ZodOptional<z.ZodNumber>;
@@ -4594,7 +4419,7 @@ declare const AnthropicMessageDeltaEventSchema: z.ZodObject<{} & {
4594
4419
  type?: "message_delta";
4595
4420
  delta?: {
4596
4421
  stop_sequence?: string;
4597
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4422
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
4598
4423
  };
4599
4424
  usage?: {
4600
4425
  input_tokens?: number;
@@ -4606,7 +4431,7 @@ declare const AnthropicMessageDeltaEventSchema: z.ZodObject<{} & {
4606
4431
  type?: "message_delta";
4607
4432
  delta?: {
4608
4433
  stop_sequence?: string;
4609
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4434
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
4610
4435
  };
4611
4436
  usage?: {
4612
4437
  input_tokens?: number;
@@ -4635,23 +4460,23 @@ declare const AnthropicErrorEventSchema: z.ZodObject<{} & {
4635
4460
  type: z.ZodString;
4636
4461
  message: z.ZodString;
4637
4462
  }, "strip", z.ZodTypeAny, {
4638
- message?: string;
4639
4463
  type?: string;
4640
- }, {
4641
4464
  message?: string;
4465
+ }, {
4642
4466
  type?: string;
4467
+ message?: string;
4643
4468
  }>;
4644
4469
  }, "strip", z.ZodTypeAny, {
4645
4470
  type?: "error";
4646
4471
  error?: {
4647
- message?: string;
4648
4472
  type?: string;
4473
+ message?: string;
4649
4474
  };
4650
4475
  }, {
4651
4476
  type?: "error";
4652
4477
  error?: {
4653
- message?: string;
4654
4478
  type?: string;
4479
+ message?: string;
4655
4480
  };
4656
4481
  }>;
4657
4482
  declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
@@ -4665,11 +4490,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4665
4490
  type: z.ZodLiteral<"text">;
4666
4491
  text: z.ZodString;
4667
4492
  }, "strip", z.ZodTypeAny, {
4668
- text?: string;
4669
4493
  type?: "text";
4670
- }, {
4671
4494
  text?: string;
4495
+ }, {
4672
4496
  type?: "text";
4497
+ text?: string;
4673
4498
  }>, z.ZodObject<{} & {
4674
4499
  type: z.ZodLiteral<"image">;
4675
4500
  source: z.ZodObject<{
@@ -4721,11 +4546,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4721
4546
  type: z.ZodLiteral<"text">;
4722
4547
  text: z.ZodString;
4723
4548
  }, "strip", z.ZodTypeAny, {
4724
- text?: string;
4725
4549
  type?: "text";
4726
- }, {
4727
4550
  text?: string;
4551
+ }, {
4728
4552
  type?: "text";
4553
+ text?: string;
4729
4554
  }>, z.ZodObject<{} & {
4730
4555
  type: z.ZodLiteral<"image">;
4731
4556
  source: z.ZodObject<{
@@ -4758,9 +4583,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4758
4583
  }>]>, "many">]>>;
4759
4584
  is_error: z.ZodOptional<z.ZodBoolean>;
4760
4585
  }, "strip", z.ZodTypeAny, {
4586
+ type?: "tool_result";
4761
4587
  content?: string | ({
4762
- text?: string;
4763
4588
  type?: "text";
4589
+ text?: string;
4764
4590
  } | {
4765
4591
  type?: "image";
4766
4592
  source?: {
@@ -4769,13 +4595,13 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4769
4595
  data?: string;
4770
4596
  };
4771
4597
  })[];
4772
- type?: "tool_result";
4773
4598
  tool_use_id?: string;
4774
4599
  is_error?: boolean;
4775
4600
  }, {
4601
+ type?: "tool_result";
4776
4602
  content?: string | ({
4777
- text?: string;
4778
4603
  type?: "text";
4604
+ text?: string;
4779
4605
  } | {
4780
4606
  type?: "image";
4781
4607
  source?: {
@@ -4784,7 +4610,6 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4784
4610
  data?: string;
4785
4611
  };
4786
4612
  })[];
4787
- type?: "tool_result";
4788
4613
  tool_use_id?: string;
4789
4614
  is_error?: boolean;
4790
4615
  }>]>, "many">;
@@ -4811,11 +4636,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4811
4636
  type: z.ZodLiteral<"text">;
4812
4637
  text: z.ZodString;
4813
4638
  }, "strip", z.ZodTypeAny, {
4814
- text?: string;
4815
4639
  type?: "text";
4816
- }, {
4817
4640
  text?: string;
4641
+ }, {
4818
4642
  type?: "text";
4643
+ text?: string;
4819
4644
  }>, z.ZodObject<{} & {
4820
4645
  type: z.ZodLiteral<"image">;
4821
4646
  source: z.ZodObject<{
@@ -4867,11 +4692,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4867
4692
  type: z.ZodLiteral<"text">;
4868
4693
  text: z.ZodString;
4869
4694
  }, "strip", z.ZodTypeAny, {
4870
- text?: string;
4871
4695
  type?: "text";
4872
- }, {
4873
4696
  text?: string;
4697
+ }, {
4874
4698
  type?: "text";
4699
+ text?: string;
4875
4700
  }>, z.ZodObject<{} & {
4876
4701
  type: z.ZodLiteral<"image">;
4877
4702
  source: z.ZodObject<{
@@ -4904,9 +4729,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4904
4729
  }>]>, "many">]>>;
4905
4730
  is_error: z.ZodOptional<z.ZodBoolean>;
4906
4731
  }, "strip", z.ZodTypeAny, {
4732
+ type?: "tool_result";
4907
4733
  content?: string | ({
4908
- text?: string;
4909
4734
  type?: "text";
4735
+ text?: string;
4910
4736
  } | {
4911
4737
  type?: "image";
4912
4738
  source?: {
@@ -4915,13 +4741,13 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4915
4741
  data?: string;
4916
4742
  };
4917
4743
  })[];
4918
- type?: "tool_result";
4919
4744
  tool_use_id?: string;
4920
4745
  is_error?: boolean;
4921
4746
  }, {
4747
+ type?: "tool_result";
4922
4748
  content?: string | ({
4923
- text?: string;
4924
4749
  type?: "text";
4750
+ text?: string;
4925
4751
  } | {
4926
4752
  type?: "image";
4927
4753
  source?: {
@@ -4930,15 +4756,16 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4930
4756
  data?: string;
4931
4757
  };
4932
4758
  })[];
4933
- type?: "tool_result";
4934
4759
  tool_use_id?: string;
4935
4760
  is_error?: boolean;
4936
4761
  }>]>, "many">>;
4937
4762
  }, "strip", z.ZodTypeAny, {
4763
+ type?: "message";
4764
+ id?: string;
4938
4765
  role?: "assistant";
4939
4766
  content?: ({
4940
- text?: string;
4941
4767
  type?: "text";
4768
+ text?: string;
4942
4769
  } | {
4943
4770
  type?: "image";
4944
4771
  source?: {
@@ -4952,9 +4779,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4952
4779
  id?: string;
4953
4780
  input?: Record<string, unknown>;
4954
4781
  } | {
4782
+ type?: "tool_result";
4955
4783
  content?: string | ({
4956
- text?: string;
4957
4784
  type?: "text";
4785
+ text?: string;
4958
4786
  } | {
4959
4787
  type?: "image";
4960
4788
  source?: {
@@ -4963,12 +4791,9 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4963
4791
  data?: string;
4964
4792
  };
4965
4793
  })[];
4966
- type?: "tool_result";
4967
4794
  tool_use_id?: string;
4968
4795
  is_error?: boolean;
4969
4796
  })[];
4970
- type?: "message";
4971
- id?: string;
4972
4797
  model?: string;
4973
4798
  usage?: {
4974
4799
  input_tokens?: number;
@@ -4977,12 +4802,14 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4977
4802
  cache_read_input_tokens?: number;
4978
4803
  };
4979
4804
  stop_sequence?: string;
4980
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4805
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
4981
4806
  }, {
4807
+ type?: "message";
4808
+ id?: string;
4982
4809
  role?: "assistant";
4983
4810
  content?: ({
4984
- text?: string;
4985
4811
  type?: "text";
4812
+ text?: string;
4986
4813
  } | {
4987
4814
  type?: "image";
4988
4815
  source?: {
@@ -4996,9 +4823,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
4996
4823
  id?: string;
4997
4824
  input?: Record<string, unknown>;
4998
4825
  } | {
4826
+ type?: "tool_result";
4999
4827
  content?: string | ({
5000
- text?: string;
5001
4828
  type?: "text";
4829
+ text?: string;
5002
4830
  } | {
5003
4831
  type?: "image";
5004
4832
  source?: {
@@ -5007,12 +4835,9 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5007
4835
  data?: string;
5008
4836
  };
5009
4837
  })[];
5010
- type?: "tool_result";
5011
4838
  tool_use_id?: string;
5012
4839
  is_error?: boolean;
5013
4840
  })[];
5014
- type?: "message";
5015
- id?: string;
5016
4841
  model?: string;
5017
4842
  usage?: {
5018
4843
  input_tokens?: number;
@@ -5021,14 +4846,17 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5021
4846
  cache_read_input_tokens?: number;
5022
4847
  };
5023
4848
  stop_sequence?: string;
5024
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4849
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
5025
4850
  }>;
5026
4851
  }, "strip", z.ZodTypeAny, {
4852
+ type?: "message_start";
5027
4853
  message?: {
4854
+ type?: "message";
4855
+ id?: string;
5028
4856
  role?: "assistant";
5029
4857
  content?: ({
5030
- text?: string;
5031
4858
  type?: "text";
4859
+ text?: string;
5032
4860
  } | {
5033
4861
  type?: "image";
5034
4862
  source?: {
@@ -5042,9 +4870,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5042
4870
  id?: string;
5043
4871
  input?: Record<string, unknown>;
5044
4872
  } | {
4873
+ type?: "tool_result";
5045
4874
  content?: string | ({
5046
- text?: string;
5047
4875
  type?: "text";
4876
+ text?: string;
5048
4877
  } | {
5049
4878
  type?: "image";
5050
4879
  source?: {
@@ -5053,12 +4882,9 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5053
4882
  data?: string;
5054
4883
  };
5055
4884
  })[];
5056
- type?: "tool_result";
5057
4885
  tool_use_id?: string;
5058
4886
  is_error?: boolean;
5059
4887
  })[];
5060
- type?: "message";
5061
- id?: string;
5062
4888
  model?: string;
5063
4889
  usage?: {
5064
4890
  input_tokens?: number;
@@ -5067,15 +4893,17 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5067
4893
  cache_read_input_tokens?: number;
5068
4894
  };
5069
4895
  stop_sequence?: string;
5070
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4896
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
5071
4897
  };
5072
- type?: "message_start";
5073
4898
  }, {
4899
+ type?: "message_start";
5074
4900
  message?: {
4901
+ type?: "message";
4902
+ id?: string;
5075
4903
  role?: "assistant";
5076
4904
  content?: ({
5077
- text?: string;
5078
4905
  type?: "text";
4906
+ text?: string;
5079
4907
  } | {
5080
4908
  type?: "image";
5081
4909
  source?: {
@@ -5089,9 +4917,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5089
4917
  id?: string;
5090
4918
  input?: Record<string, unknown>;
5091
4919
  } | {
4920
+ type?: "tool_result";
5092
4921
  content?: string | ({
5093
- text?: string;
5094
4922
  type?: "text";
4923
+ text?: string;
5095
4924
  } | {
5096
4925
  type?: "image";
5097
4926
  source?: {
@@ -5100,12 +4929,9 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5100
4929
  data?: string;
5101
4930
  };
5102
4931
  })[];
5103
- type?: "tool_result";
5104
4932
  tool_use_id?: string;
5105
4933
  is_error?: boolean;
5106
4934
  })[];
5107
- type?: "message";
5108
- id?: string;
5109
4935
  model?: string;
5110
4936
  usage?: {
5111
4937
  input_tokens?: number;
@@ -5114,9 +4940,8 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5114
4940
  cache_read_input_tokens?: number;
5115
4941
  };
5116
4942
  stop_sequence?: string;
5117
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
4943
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
5118
4944
  };
5119
- type?: "message_start";
5120
4945
  }>, z.ZodObject<{} & {
5121
4946
  type: z.ZodLiteral<"content_block_start">;
5122
4947
  index: z.ZodNumber;
@@ -5124,11 +4949,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5124
4949
  type: z.ZodLiteral<"text">;
5125
4950
  text: z.ZodString;
5126
4951
  }, "strip", z.ZodTypeAny, {
5127
- text?: string;
5128
4952
  type?: "text";
5129
- }, {
5130
4953
  text?: string;
4954
+ }, {
5131
4955
  type?: "text";
4956
+ text?: string;
5132
4957
  }>, z.ZodObject<{} & {
5133
4958
  type: z.ZodLiteral<"image">;
5134
4959
  source: z.ZodObject<{
@@ -5180,11 +5005,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5180
5005
  type: z.ZodLiteral<"text">;
5181
5006
  text: z.ZodString;
5182
5007
  }, "strip", z.ZodTypeAny, {
5183
- text?: string;
5184
5008
  type?: "text";
5185
- }, {
5186
5009
  text?: string;
5010
+ }, {
5187
5011
  type?: "text";
5012
+ text?: string;
5188
5013
  }>, z.ZodObject<{} & {
5189
5014
  type: z.ZodLiteral<"image">;
5190
5015
  source: z.ZodObject<{
@@ -5217,9 +5042,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5217
5042
  }>]>, "many">]>>;
5218
5043
  is_error: z.ZodOptional<z.ZodBoolean>;
5219
5044
  }, "strip", z.ZodTypeAny, {
5045
+ type?: "tool_result";
5220
5046
  content?: string | ({
5221
- text?: string;
5222
5047
  type?: "text";
5048
+ text?: string;
5223
5049
  } | {
5224
5050
  type?: "image";
5225
5051
  source?: {
@@ -5228,13 +5054,13 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5228
5054
  data?: string;
5229
5055
  };
5230
5056
  })[];
5231
- type?: "tool_result";
5232
5057
  tool_use_id?: string;
5233
5058
  is_error?: boolean;
5234
5059
  }, {
5060
+ type?: "tool_result";
5235
5061
  content?: string | ({
5236
- text?: string;
5237
5062
  type?: "text";
5063
+ text?: string;
5238
5064
  } | {
5239
5065
  type?: "image";
5240
5066
  source?: {
@@ -5243,7 +5069,6 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5243
5069
  data?: string;
5244
5070
  };
5245
5071
  })[];
5246
- type?: "tool_result";
5247
5072
  tool_use_id?: string;
5248
5073
  is_error?: boolean;
5249
5074
  }>]>;
@@ -5251,8 +5076,8 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5251
5076
  type?: "content_block_start";
5252
5077
  index?: number;
5253
5078
  content_block?: {
5254
- text?: string;
5255
5079
  type?: "text";
5080
+ text?: string;
5256
5081
  } | {
5257
5082
  type?: "image";
5258
5083
  source?: {
@@ -5266,9 +5091,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5266
5091
  id?: string;
5267
5092
  input?: Record<string, unknown>;
5268
5093
  } | {
5094
+ type?: "tool_result";
5269
5095
  content?: string | ({
5270
- text?: string;
5271
5096
  type?: "text";
5097
+ text?: string;
5272
5098
  } | {
5273
5099
  type?: "image";
5274
5100
  source?: {
@@ -5277,7 +5103,6 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5277
5103
  data?: string;
5278
5104
  };
5279
5105
  })[];
5280
- type?: "tool_result";
5281
5106
  tool_use_id?: string;
5282
5107
  is_error?: boolean;
5283
5108
  };
@@ -5285,8 +5110,8 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5285
5110
  type?: "content_block_start";
5286
5111
  index?: number;
5287
5112
  content_block?: {
5288
- text?: string;
5289
5113
  type?: "text";
5114
+ text?: string;
5290
5115
  } | {
5291
5116
  type?: "image";
5292
5117
  source?: {
@@ -5300,9 +5125,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5300
5125
  id?: string;
5301
5126
  input?: Record<string, unknown>;
5302
5127
  } | {
5128
+ type?: "tool_result";
5303
5129
  content?: string | ({
5304
- text?: string;
5305
5130
  type?: "text";
5131
+ text?: string;
5306
5132
  } | {
5307
5133
  type?: "image";
5308
5134
  source?: {
@@ -5311,7 +5137,6 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5311
5137
  data?: string;
5312
5138
  };
5313
5139
  })[];
5314
- type?: "tool_result";
5315
5140
  tool_use_id?: string;
5316
5141
  is_error?: boolean;
5317
5142
  };
@@ -5322,11 +5147,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5322
5147
  type: z.ZodLiteral<"text_delta">;
5323
5148
  text: z.ZodString;
5324
5149
  }, "strip", z.ZodTypeAny, {
5325
- text?: string;
5326
5150
  type?: "text_delta";
5327
- }, {
5328
5151
  text?: string;
5152
+ }, {
5329
5153
  type?: "text_delta";
5154
+ text?: string;
5330
5155
  }>, z.ZodObject<{
5331
5156
  type: z.ZodLiteral<"input_json_delta">;
5332
5157
  partial_json: z.ZodString;
@@ -5341,8 +5166,8 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5341
5166
  type?: "content_block_delta";
5342
5167
  index?: number;
5343
5168
  delta?: {
5344
- text?: string;
5345
5169
  type?: "text_delta";
5170
+ text?: string;
5346
5171
  } | {
5347
5172
  type?: "input_json_delta";
5348
5173
  partial_json?: string;
@@ -5351,8 +5176,8 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5351
5176
  type?: "content_block_delta";
5352
5177
  index?: number;
5353
5178
  delta?: {
5354
- text?: string;
5355
5179
  type?: "text_delta";
5180
+ text?: string;
5356
5181
  } | {
5357
5182
  type?: "input_json_delta";
5358
5183
  partial_json?: string;
@@ -5373,10 +5198,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5373
5198
  stop_sequence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5374
5199
  }, "strip", z.ZodTypeAny, {
5375
5200
  stop_sequence?: string;
5376
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
5201
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
5377
5202
  }, {
5378
5203
  stop_sequence?: string;
5379
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
5204
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
5380
5205
  }>;
5381
5206
  usage: z.ZodObject<{
5382
5207
  input_tokens: z.ZodOptional<z.ZodNumber>;
@@ -5398,7 +5223,7 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5398
5223
  type?: "message_delta";
5399
5224
  delta?: {
5400
5225
  stop_sequence?: string;
5401
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
5226
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
5402
5227
  };
5403
5228
  usage?: {
5404
5229
  input_tokens?: number;
@@ -5410,7 +5235,7 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5410
5235
  type?: "message_delta";
5411
5236
  delta?: {
5412
5237
  stop_sequence?: string;
5413
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
5238
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
5414
5239
  };
5415
5240
  usage?: {
5416
5241
  input_tokens?: number;
@@ -5436,23 +5261,23 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
5436
5261
  type: z.ZodString;
5437
5262
  message: z.ZodString;
5438
5263
  }, "strip", z.ZodTypeAny, {
5439
- message?: string;
5440
5264
  type?: string;
5441
- }, {
5442
5265
  message?: string;
5266
+ }, {
5443
5267
  type?: string;
5268
+ message?: string;
5444
5269
  }>;
5445
5270
  }, "strip", z.ZodTypeAny, {
5446
5271
  type?: "error";
5447
5272
  error?: {
5448
- message?: string;
5449
5273
  type?: string;
5274
+ message?: string;
5450
5275
  };
5451
5276
  }, {
5452
5277
  type?: "error";
5453
5278
  error?: {
5454
- message?: string;
5455
5279
  type?: string;
5280
+ message?: string;
5456
5281
  };
5457
5282
  }>]>;
5458
5283
  type AnthropicRequest = z.infer<typeof AnthropicRequestSchema>;
@@ -5468,18 +5293,18 @@ type AnthropicToolUseContentBlock = z.infer<typeof AnthropicToolUseContentBlockS
5468
5293
  type AnthropicToolResultContentBlock = z.infer<typeof AnthropicToolResultContentBlockSchema>;
5469
5294
  declare const validateAnthropicRequest: (data: unknown) => {
5470
5295
  system?: string | {
5471
- text?: string;
5472
5296
  type?: "text";
5297
+ text?: string;
5473
5298
  cache_control?: {
5474
5299
  type?: "ephemeral";
5475
5300
  };
5476
5301
  }[];
5477
5302
  model?: string;
5478
5303
  messages?: {
5479
- role?: "assistant" | "system" | "user";
5304
+ role?: "system" | "user" | "assistant";
5480
5305
  content?: string | ({
5481
- text?: string;
5482
5306
  type?: "text";
5307
+ text?: string;
5483
5308
  } | {
5484
5309
  type?: "image";
5485
5310
  source?: {
@@ -5493,9 +5318,10 @@ declare const validateAnthropicRequest: (data: unknown) => {
5493
5318
  id?: string;
5494
5319
  input?: Record<string, unknown>;
5495
5320
  } | {
5321
+ type?: "tool_result";
5496
5322
  content?: string | ({
5497
- text?: string;
5498
5323
  type?: "text";
5324
+ text?: string;
5499
5325
  } | {
5500
5326
  type?: "image";
5501
5327
  source?: {
@@ -5504,7 +5330,6 @@ declare const validateAnthropicRequest: (data: unknown) => {
5504
5330
  data?: string;
5505
5331
  };
5506
5332
  })[];
5507
- type?: "tool_result";
5508
5333
  tool_use_id?: string;
5509
5334
  is_error?: boolean;
5510
5335
  })[];
@@ -5539,10 +5364,12 @@ declare const validateAnthropicRequest: (data: unknown) => {
5539
5364
  top_k?: number;
5540
5365
  };
5541
5366
  declare const validateAnthropicResponse: (data: unknown) => {
5367
+ type?: "message";
5368
+ id?: string;
5542
5369
  role?: "assistant";
5543
5370
  content?: ({
5544
- text?: string;
5545
5371
  type?: "text";
5372
+ text?: string;
5546
5373
  } | {
5547
5374
  type?: "image";
5548
5375
  source?: {
@@ -5556,9 +5383,10 @@ declare const validateAnthropicResponse: (data: unknown) => {
5556
5383
  id?: string;
5557
5384
  input?: Record<string, unknown>;
5558
5385
  } | {
5386
+ type?: "tool_result";
5559
5387
  content?: string | ({
5560
- text?: string;
5561
5388
  type?: "text";
5389
+ text?: string;
5562
5390
  } | {
5563
5391
  type?: "image";
5564
5392
  source?: {
@@ -5567,12 +5395,9 @@ declare const validateAnthropicResponse: (data: unknown) => {
5567
5395
  data?: string;
5568
5396
  };
5569
5397
  })[];
5570
- type?: "tool_result";
5571
5398
  tool_use_id?: string;
5572
5399
  is_error?: boolean;
5573
5400
  })[];
5574
- type?: "message";
5575
- id?: string;
5576
5401
  model?: string;
5577
5402
  usage?: {
5578
5403
  input_tokens?: number;
@@ -5581,14 +5406,17 @@ declare const validateAnthropicResponse: (data: unknown) => {
5581
5406
  cache_read_input_tokens?: number;
5582
5407
  };
5583
5408
  stop_sequence?: string;
5584
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
5409
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
5585
5410
  };
5586
5411
  declare const validateAnthropicStreamEvent: (data: unknown) => {
5412
+ type?: "message_start";
5587
5413
  message?: {
5414
+ type?: "message";
5415
+ id?: string;
5588
5416
  role?: "assistant";
5589
5417
  content?: ({
5590
- text?: string;
5591
5418
  type?: "text";
5419
+ text?: string;
5592
5420
  } | {
5593
5421
  type?: "image";
5594
5422
  source?: {
@@ -5602,9 +5430,10 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
5602
5430
  id?: string;
5603
5431
  input?: Record<string, unknown>;
5604
5432
  } | {
5433
+ type?: "tool_result";
5605
5434
  content?: string | ({
5606
- text?: string;
5607
5435
  type?: "text";
5436
+ text?: string;
5608
5437
  } | {
5609
5438
  type?: "image";
5610
5439
  source?: {
@@ -5613,12 +5442,9 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
5613
5442
  data?: string;
5614
5443
  };
5615
5444
  })[];
5616
- type?: "tool_result";
5617
5445
  tool_use_id?: string;
5618
5446
  is_error?: boolean;
5619
5447
  })[];
5620
- type?: "message";
5621
- id?: string;
5622
5448
  model?: string;
5623
5449
  usage?: {
5624
5450
  input_tokens?: number;
@@ -5627,15 +5453,14 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
5627
5453
  cache_read_input_tokens?: number;
5628
5454
  };
5629
5455
  stop_sequence?: string;
5630
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
5456
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
5631
5457
  };
5632
- type?: "message_start";
5633
5458
  } | {
5634
5459
  type?: "content_block_start";
5635
5460
  index?: number;
5636
5461
  content_block?: {
5637
- text?: string;
5638
5462
  type?: "text";
5463
+ text?: string;
5639
5464
  } | {
5640
5465
  type?: "image";
5641
5466
  source?: {
@@ -5649,9 +5474,10 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
5649
5474
  id?: string;
5650
5475
  input?: Record<string, unknown>;
5651
5476
  } | {
5477
+ type?: "tool_result";
5652
5478
  content?: string | ({
5653
- text?: string;
5654
5479
  type?: "text";
5480
+ text?: string;
5655
5481
  } | {
5656
5482
  type?: "image";
5657
5483
  source?: {
@@ -5660,7 +5486,6 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
5660
5486
  data?: string;
5661
5487
  };
5662
5488
  })[];
5663
- type?: "tool_result";
5664
5489
  tool_use_id?: string;
5665
5490
  is_error?: boolean;
5666
5491
  };
@@ -5668,8 +5493,8 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
5668
5493
  type?: "content_block_delta";
5669
5494
  index?: number;
5670
5495
  delta?: {
5671
- text?: string;
5672
5496
  type?: "text_delta";
5497
+ text?: string;
5673
5498
  } | {
5674
5499
  type?: "input_json_delta";
5675
5500
  partial_json?: string;
@@ -5681,7 +5506,7 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
5681
5506
  type?: "message_delta";
5682
5507
  delta?: {
5683
5508
  stop_sequence?: string;
5684
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
5509
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
5685
5510
  };
5686
5511
  usage?: {
5687
5512
  input_tokens?: number;
@@ -5696,8 +5521,8 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
5696
5521
  } | {
5697
5522
  type?: "error";
5698
5523
  error?: {
5699
- message?: string;
5700
5524
  type?: string;
5525
+ message?: string;
5701
5526
  };
5702
5527
  };
5703
5528
 
@@ -5723,7 +5548,7 @@ interface OpenAIResponse extends OpenAIResponse$1 {
5723
5548
  /**
5724
5549
  * 转换结果接口 - 增强版
5725
5550
  */
5726
- interface ConversionResult$1<T> {
5551
+ interface ConversionResult$2<T> {
5727
5552
  success: boolean;
5728
5553
  data?: T;
5729
5554
  originalData?: unknown;
@@ -5738,71 +5563,6 @@ interface ConversionResult$1<T> {
5738
5563
  };
5739
5564
  }
5740
5565
 
5741
- /**
5742
- * 标准协议适配器 - 纯协议转换器
5743
- * 只负责Anthropic和OpenAI格式之间的转换,不包含HTTP请求逻辑
5744
- */
5745
-
5746
- interface StandardProtocolAdapterOptions {
5747
- debugMode?: boolean;
5748
- }
5749
- interface ConvertedRequest {
5750
- openaiRequest: OpenAIRequest;
5751
- metadata: {
5752
- hasImages: boolean;
5753
- requiresVisionHeaders: boolean;
5754
- };
5755
- }
5756
- interface ConvertedResponse {
5757
- anthropicStandardResponse: any;
5758
- success: boolean;
5759
- error?: string;
5760
- }
5761
- /**
5762
- * 标准协议适配器类 - 纯协议转换器
5763
- * 只处理格式转换,不处理HTTP请求
5764
- */
5765
- declare class StandardProtocolAdapter {
5766
- private debugMode;
5767
- private sseAdapter;
5768
- constructor(options?: StandardProtocolAdapterOptions);
5769
- private logDebug;
5770
- /**
5771
- * 转换Anthropic请求为OpenAI请求格式
5772
- * @param anthropicRequest - Anthropic格式的请求
5773
- * @returns 转换后的OpenAI请求和元数据
5774
- */
5775
- convertRequest(anthropicRequest: any): ConvertedRequest;
5776
- /**
5777
- * 从OpenAI流式数据转换为Anthropic标准格式
5778
- * 本质上是流式处理的"await"版本 - 等待整个流处理完成后提取最终结果
5779
- */
5780
- convertFromStreamToStandard(openaiRawStream: string, modelName: string, messageId?: string): ClaudeStandardResponse;
5781
- /**
5782
- * 从SSE流式结果中提取标准格式响应
5783
- */
5784
- private extractStandardResponseFromSSE;
5785
- /**
5786
- * 转换OpenAI响应为Anthropic标准格式
5787
- */
5788
- convertResponse(openaiResponse: any, originalRequest: any): ConvertedResponse;
5789
- /**
5790
- * 映射OpenAI的finish_reason到Anthropic的stop_reason
5791
- */
5792
- private mapFinishReasonToStopReason;
5793
- /**
5794
- * 检测Anthropic请求是否包含图片内容
5795
- */
5796
- private hasImageContent;
5797
- /**
5798
- * 获取调试信息
5799
- */
5800
- getDebugInfo(): {
5801
- adapterType: string;
5802
- supportedTools: string[];
5803
- };
5804
- }
5805
-
5806
5566
  /**
5807
5567
  * A2O请求适配器配置 - 增强版
5808
5568
  */
@@ -5864,7 +5624,7 @@ declare class A2ORequestAdapter {
5864
5624
  * 转换Anthropic请求格式为OpenAI兼容格式 - 增强版
5865
5625
  * 集成校验、修复和错误恢复功能
5866
5626
  */
5867
- convertAnthropicRequestToOpenAIEnhanced(anthropicRequest: unknown): Promise<ConversionResult$1<OpenAIRequest>>;
5627
+ convertAnthropicRequestToOpenAIEnhanced(anthropicRequest: unknown): Promise<ConversionResult$2<OpenAIRequest>>;
5868
5628
  /**
5869
5629
  * 执行核心转换逻辑(原有逻辑保持不变)
5870
5630
  */
@@ -6039,6 +5799,288 @@ declare class FormatValidator {
6039
5799
  };
6040
5800
  }
6041
5801
 
5802
+ /**
5803
+ * 流式协议适配器 - OpenAI到Anthropic的SSE转换
5804
+ * 基于编译后的JavaScript文件重新生成的TypeScript源码
5805
+ */
5806
+ interface ToolCallState {
5807
+ id: string;
5808
+ name: string;
5809
+ input: string;
5810
+ blockStartSent: boolean;
5811
+ blockStopSent: boolean;
5812
+ blockIndex?: number;
5813
+ pendingChunks: string[];
5814
+ }
5815
+ interface StreamingProtocolAdapterOptions {
5816
+ debugMode?: boolean;
5817
+ validateInput?: boolean;
5818
+ validateOutput?: boolean;
5819
+ autoHeal?: boolean;
5820
+ timeout?: number;
5821
+ retries?: number;
5822
+ bufferSize?: number;
5823
+ logger?: any;
5824
+ }
5825
+ interface ConversionState {
5826
+ processedLines: number;
5827
+ textContent: string;
5828
+ reasoningContent: string;
5829
+ toolCallsMap: Map<string, ToolCallState>;
5830
+ completedToolCalls: string[];
5831
+ allSSELines: string[];
5832
+ errors: any[];
5833
+ usage: {
5834
+ input_tokens: number;
5835
+ output_tokens: number;
5836
+ };
5837
+ thinkingBlockStarted: boolean;
5838
+ contentBlockStarted: boolean;
5839
+ toolCallCounter: number;
5840
+ nextToolBlockIndex: number;
5841
+ }
5842
+ interface ConversionResult$1 {
5843
+ success: boolean;
5844
+ error?: string;
5845
+ anthropicSSE: string;
5846
+ anthropicStandardResponse: any;
5847
+ }
5848
+ declare class StreamingProtocolAdapter {
5849
+ private config;
5850
+ constructor(options?: StreamingProtocolAdapterOptions);
5851
+ private logDebug;
5852
+ /**
5853
+ * 转换Anthropic请求为OpenAI格式
5854
+ */
5855
+ convertAnthropicToOpenAI(anthropicRequest: any): {
5856
+ openaiRequest: OpenAIRequest;
5857
+ metadata: {
5858
+ hasImages: boolean;
5859
+ requiresVisionHeaders: boolean;
5860
+ };
5861
+ };
5862
+ /**
5863
+ * 与StandardProtocolAdapter保持一致的API,用于集成测试和向后兼容。
5864
+ */
5865
+ convertRequest(anthropicRequest: any): {
5866
+ openaiRequest: OpenAIRequest;
5867
+ metadata: {
5868
+ hasImages: boolean;
5869
+ requiresVisionHeaders: boolean;
5870
+ };
5871
+ };
5872
+ /**
5873
+ * 转换OpenAI流式响应为Anthropic SSE格式
5874
+ */
5875
+ convertOpenAIStreamToAnthropic(openaiStream: string, originalRequest: any): ConversionResult$1;
5876
+ /**
5877
+ * 将OpenAI流转换为Anthropic SSE格式
5878
+ */
5879
+ private convertToAnthropicSSE;
5880
+ /**
5881
+ * 处理单个流式数据块 - 支持thinking和content双模式
5882
+ */
5883
+ private processStreamChunk;
5884
+ /**
5885
+ * 处理工具调用 - 支持OpenAI流式分块累积
5886
+ * OpenAI流式API会将tool_calls分多个chunk发送:
5887
+ * - Chunk 1: {index:0, id:"call_xxx", type:"function", function:{name:"web_search"}}
5888
+ * - Chunk 2: {index:0, function:{arguments:"{\"query\":\"xxx\"}"}}
5889
+ * - Chunk N: 继续累积arguments
5890
+ */
5891
+ private processToolCalls;
5892
+ private getOrCreateToolCallState;
5893
+ private registerToolCallAlias;
5894
+ private maybeStartToolBlock;
5895
+ private flushPendingToolChunks;
5896
+ private coalesceContent;
5897
+ private appendThinkingContent;
5898
+ private appendTextContent;
5899
+ private updateUsageFromChunk;
5900
+ private isResponsesEvent;
5901
+ private processResponsesEvent;
5902
+ private resolveResponsesToolData;
5903
+ private handleResponsesOutputItemAdded;
5904
+ private handleResponsesFunctionArgumentsDelta;
5905
+ private handleResponsesFunctionArgumentsDone;
5906
+ private extractResponsesTextDelta;
5907
+ private extractResponsesThinkingDelta;
5908
+ private extractArgumentsDelta;
5909
+ /**
5910
+ * 在流结束时关闭所有未关闭的工具调用块
5911
+ */
5912
+ private closeAllToolCallBlocks;
5913
+ /**
5914
+ * 添加最终事件 - 支持thinking+content双模式
5915
+ */
5916
+ private addFinalEvents;
5917
+ /**
5918
+ * 构建标准响应格式
5919
+ */
5920
+ private buildStandardResponse;
5921
+ /**
5922
+ * 创建转换状态对象
5923
+ */
5924
+ private createConversionState;
5925
+ /**
5926
+ * 转换消息格式
5927
+ */
5928
+ private convertMessages;
5929
+ /**
5930
+ * 映射Anthropic模型到OpenAI模型
5931
+ */
5932
+ private mapAnthropicModelToOpenAI;
5933
+ /**
5934
+ * 检查请求是否包含图片内容
5935
+ */
5936
+ private hasImageContent;
5937
+ /**
5938
+ * 转义JSON字符串
5939
+ */
5940
+ private escapeJsonString;
5941
+ /**
5942
+ * 获取初始SSE事件(message_start + ping)
5943
+ */
5944
+ getInitialSSEEvents(modelName?: string, messageId?: string): string[];
5945
+ /**
5946
+ * 增量转换单个OpenAI数据块为Anthropic SSE事件
5947
+ * 用于逐个处理流式数据片段
5948
+ */
5949
+ convertIncrementalChunk(openaiDataLine: string, state: ConversionState): string[];
5950
+ /**
5951
+ * 暴露内部状态创建方法,供外部增量处理流程使用。
5952
+ */
5953
+ createIncrementalState(): ConversionState;
5954
+ }
5955
+
5956
+ /**
5957
+ * O2A SSE适配器相关类型定义
5958
+ */
5959
+ interface CaptureSession {
5960
+ [key: string]: any;
5961
+ }
5962
+ /**
5963
+ * 工具调用信息接口
5964
+ */
5965
+ interface ToolCallInfo {
5966
+ index: number;
5967
+ name: string;
5968
+ hasArgs: boolean;
5969
+ }
5970
+ /**
5971
+ * 流式转换状态接口
5972
+ */
5973
+ interface StreamingConversionState {
5974
+ hasContent: boolean;
5975
+ hasThinking: boolean;
5976
+ contentBlockIndex: number;
5977
+ thinkingBlockIndex: number;
5978
+ toolCallsMap: Map<string, ToolCallInfo>;
5979
+ completedToolCalls: Set<string>;
5980
+ accumulatedUsage: {
5981
+ input_tokens: number;
5982
+ output_tokens: number;
5983
+ cache_creation_input_tokens?: number;
5984
+ cache_read_input_tokens?: number;
5985
+ };
5986
+ processedLines: number;
5987
+ errors: string[];
5988
+ allSSELines: string[];
5989
+ }
5990
+ /**
5991
+ * 增量转换状态接口(扩展基础状态)
5992
+ */
5993
+ interface IncrementalConversionState extends StreamingConversionState {
5994
+ captureSession?: CaptureSession;
5995
+ }
5996
+ /**
5997
+ * Claude标准响应格式
5998
+ */
5999
+ interface ClaudeStandardResponse {
6000
+ id: string;
6001
+ model: string;
6002
+ role: 'assistant';
6003
+ content: ContentBlock[];
6004
+ type: 'message';
6005
+ stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | null;
6006
+ stop_sequence: string | null;
6007
+ usage: Usage;
6008
+ }
6009
+ interface ContentBlock {
6010
+ type: 'text' | 'tool_use' | 'tool_result' | 'image';
6011
+ }
6012
+ interface Usage {
6013
+ input_tokens: number;
6014
+ output_tokens: number;
6015
+ cache_creation_input_tokens?: number;
6016
+ cache_read_input_tokens?: number;
6017
+ }
6018
+
6019
+ /**
6020
+ * 标准协议适配器 - 纯协议转换器
6021
+ * 只负责Anthropic和OpenAI格式之间的转换,不包含HTTP请求逻辑
6022
+ */
6023
+
6024
+ interface StandardProtocolAdapterOptions {
6025
+ debugMode?: boolean;
6026
+ }
6027
+ interface ConvertedRequest {
6028
+ openaiRequest: OpenAIRequest;
6029
+ metadata: {
6030
+ hasImages: boolean;
6031
+ requiresVisionHeaders: boolean;
6032
+ };
6033
+ }
6034
+ interface ConvertedResponse {
6035
+ anthropicStandardResponse: any;
6036
+ success: boolean;
6037
+ error?: string;
6038
+ }
6039
+ /**
6040
+ * 标准协议适配器类 - 纯协议转换器
6041
+ * 只处理格式转换,不处理HTTP请求
6042
+ */
6043
+ declare class StandardProtocolAdapter {
6044
+ private debugMode;
6045
+ private sseAdapter;
6046
+ constructor(options?: StandardProtocolAdapterOptions);
6047
+ private logDebug;
6048
+ /**
6049
+ * 转换Anthropic请求为OpenAI请求格式
6050
+ * @param anthropicRequest - Anthropic格式的请求
6051
+ * @returns 转换后的OpenAI请求和元数据
6052
+ */
6053
+ convertRequest(anthropicRequest: any): ConvertedRequest;
6054
+ /**
6055
+ * 从OpenAI流式数据转换为Anthropic标准格式
6056
+ * 本质上是流式处理的"await"版本 - 等待整个流处理完成后提取最终结果
6057
+ */
6058
+ convertFromStreamToStandard(openaiRawStream: string, modelName: string, messageId?: string): ClaudeStandardResponse;
6059
+ /**
6060
+ * 从SSE流式结果中提取标准格式响应
6061
+ */
6062
+ private extractStandardResponseFromSSE;
6063
+ /**
6064
+ * 转换OpenAI响应为Anthropic标准格式
6065
+ */
6066
+ convertResponse(openaiResponse: any, originalRequest: any): ConvertedResponse;
6067
+ /**
6068
+ * 映射OpenAI的finish_reason到Anthropic的stop_reason
6069
+ */
6070
+ private mapFinishReasonToStopReason;
6071
+ /**
6072
+ * 检测Anthropic请求是否包含图片内容
6073
+ */
6074
+ private hasImageContent;
6075
+ /**
6076
+ * 获取调试信息
6077
+ */
6078
+ getDebugInfo(): {
6079
+ adapterType: string;
6080
+ supportedTools: string[];
6081
+ };
6082
+ }
6083
+
6042
6084
  /**
6043
6085
  * 流式处理相关类型定义
6044
6086
  */
@@ -6387,16 +6429,16 @@ declare const validateA2OConversion: (anthropicData: unknown, convertedData: unk
6387
6429
  user?: string;
6388
6430
  model?: string;
6389
6431
  messages?: {
6390
- role?: "assistant" | "system" | "user" | "tool";
6432
+ name?: string;
6433
+ role?: "system" | "user" | "assistant" | "tool";
6391
6434
  content?: string | {
6392
- text?: string;
6393
6435
  type?: "text" | "image_url";
6436
+ text?: string;
6394
6437
  image_url?: {
6395
6438
  url?: string;
6396
6439
  detail?: "low" | "high" | "auto";
6397
6440
  };
6398
6441
  }[];
6399
- name?: string;
6400
6442
  tool_calls?: {
6401
6443
  function?: {
6402
6444
  name?: string;
@@ -6443,10 +6485,12 @@ declare const validateA2OConversion: (anthropicData: unknown, convertedData: unk
6443
6485
  top_logprobs?: number;
6444
6486
  }>;
6445
6487
  declare const validateO2AConversion: (openaiData: unknown, convertedData: unknown, useHealing?: boolean) => ConversionResult<{
6488
+ type?: "message";
6489
+ id?: string;
6446
6490
  role?: "assistant";
6447
6491
  content?: ({
6448
- text?: string;
6449
6492
  type?: "text";
6493
+ text?: string;
6450
6494
  } | {
6451
6495
  type?: "image";
6452
6496
  source?: {
@@ -6460,9 +6504,10 @@ declare const validateO2AConversion: (openaiData: unknown, convertedData: unknow
6460
6504
  id?: string;
6461
6505
  input?: Record<string, unknown>;
6462
6506
  } | {
6507
+ type?: "tool_result";
6463
6508
  content?: string | ({
6464
- text?: string;
6465
6509
  type?: "text";
6510
+ text?: string;
6466
6511
  } | {
6467
6512
  type?: "image";
6468
6513
  source?: {
@@ -6471,12 +6516,9 @@ declare const validateO2AConversion: (openaiData: unknown, convertedData: unknow
6471
6516
  data?: string;
6472
6517
  };
6473
6518
  })[];
6474
- type?: "tool_result";
6475
6519
  tool_use_id?: string;
6476
6520
  is_error?: boolean;
6477
6521
  })[];
6478
- type?: "message";
6479
- id?: string;
6480
6522
  model?: string;
6481
6523
  usage?: {
6482
6524
  input_tokens?: number;
@@ -6485,7 +6527,7 @@ declare const validateO2AConversion: (openaiData: unknown, convertedData: unknow
6485
6527
  cache_read_input_tokens?: number;
6486
6528
  };
6487
6529
  stop_sequence?: string;
6488
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
6530
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
6489
6531
  }>;
6490
6532
  declare const validateStreamConversion: (inputChunks: unknown[], outputEvents: unknown[], direction: "openai-to-anthropic" | "anthropic-to-openai", useHealing?: boolean) => ConversionResult<unknown[]>;
6491
6533
 
@@ -6576,16 +6618,16 @@ declare const healA2ORequest: (data: unknown, maxAttempts?: number) => Promise<H
6576
6618
  user?: string;
6577
6619
  model?: string;
6578
6620
  messages?: {
6579
- role?: "assistant" | "system" | "user" | "tool";
6621
+ name?: string;
6622
+ role?: "system" | "user" | "assistant" | "tool";
6580
6623
  content?: string | {
6581
- text?: string;
6582
6624
  type?: "text" | "image_url";
6625
+ text?: string;
6583
6626
  image_url?: {
6584
6627
  url?: string;
6585
6628
  detail?: "low" | "high" | "auto";
6586
6629
  };
6587
6630
  }[];
6588
- name?: string;
6589
6631
  tool_calls?: {
6590
6632
  function?: {
6591
6633
  name?: string;
@@ -6633,18 +6675,18 @@ declare const healA2ORequest: (data: unknown, maxAttempts?: number) => Promise<H
6633
6675
  }>>;
6634
6676
  declare const healO2ARequest: (data: unknown, maxAttempts?: number) => Promise<HealingResult<{
6635
6677
  system?: string | {
6636
- text?: string;
6637
6678
  type?: "text";
6679
+ text?: string;
6638
6680
  cache_control?: {
6639
6681
  type?: "ephemeral";
6640
6682
  };
6641
6683
  }[];
6642
6684
  model?: string;
6643
6685
  messages?: {
6644
- role?: "assistant" | "system" | "user";
6686
+ role?: "system" | "user" | "assistant";
6645
6687
  content?: string | ({
6646
- text?: string;
6647
6688
  type?: "text";
6689
+ text?: string;
6648
6690
  } | {
6649
6691
  type?: "image";
6650
6692
  source?: {
@@ -6658,9 +6700,10 @@ declare const healO2ARequest: (data: unknown, maxAttempts?: number) => Promise<H
6658
6700
  id?: string;
6659
6701
  input?: Record<string, unknown>;
6660
6702
  } | {
6703
+ type?: "tool_result";
6661
6704
  content?: string | ({
6662
- text?: string;
6663
6705
  type?: "text";
6706
+ text?: string;
6664
6707
  } | {
6665
6708
  type?: "image";
6666
6709
  source?: {
@@ -6669,7 +6712,6 @@ declare const healO2ARequest: (data: unknown, maxAttempts?: number) => Promise<H
6669
6712
  data?: string;
6670
6713
  };
6671
6714
  })[];
6672
- type?: "tool_result";
6673
6715
  tool_use_id?: string;
6674
6716
  is_error?: boolean;
6675
6717
  })[];
@@ -6704,10 +6746,12 @@ declare const healO2ARequest: (data: unknown, maxAttempts?: number) => Promise<H
6704
6746
  top_k?: number;
6705
6747
  }>>;
6706
6748
  declare const healO2AResponse: (data: unknown, maxAttempts?: number) => Promise<HealingResult<{
6749
+ type?: "message";
6750
+ id?: string;
6707
6751
  role?: "assistant";
6708
6752
  content?: ({
6709
- text?: string;
6710
6753
  type?: "text";
6754
+ text?: string;
6711
6755
  } | {
6712
6756
  type?: "image";
6713
6757
  source?: {
@@ -6721,9 +6765,10 @@ declare const healO2AResponse: (data: unknown, maxAttempts?: number) => Promise<
6721
6765
  id?: string;
6722
6766
  input?: Record<string, unknown>;
6723
6767
  } | {
6768
+ type?: "tool_result";
6724
6769
  content?: string | ({
6725
- text?: string;
6726
6770
  type?: "text";
6771
+ text?: string;
6727
6772
  } | {
6728
6773
  type?: "image";
6729
6774
  source?: {
@@ -6732,12 +6777,9 @@ declare const healO2AResponse: (data: unknown, maxAttempts?: number) => Promise<
6732
6777
  data?: string;
6733
6778
  };
6734
6779
  })[];
6735
- type?: "tool_result";
6736
6780
  tool_use_id?: string;
6737
6781
  is_error?: boolean;
6738
6782
  })[];
6739
- type?: "message";
6740
- id?: string;
6741
6783
  model?: string;
6742
6784
  usage?: {
6743
6785
  input_tokens?: number;
@@ -6746,7 +6788,7 @@ declare const healO2AResponse: (data: unknown, maxAttempts?: number) => Promise<
6746
6788
  cache_read_input_tokens?: number;
6747
6789
  };
6748
6790
  stop_sequence?: string;
6749
- stop_reason?: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
6791
+ stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
6750
6792
  }>>;
6751
6793
 
6752
6794
  /**
@@ -7291,4 +7333,4 @@ declare const FEATURES: {
7291
7333
  readonly externalPackageVerified: true;
7292
7334
  };
7293
7335
 
7294
- export { A2ORequestAdapter, A2ORequestAdapterStatic, ADAPTERS_VERSION, type AnthropicContentBlock, AnthropicContentBlockBaseSchema, AnthropicContentBlockDeltaEventSchema, AnthropicContentBlockSchema, AnthropicContentBlockStartEventSchema, AnthropicContentBlockStopEventSchema, AnthropicErrorEventSchema, type AnthropicImageContentBlock, AnthropicImageContentBlockSchema, AnthropicImageSourceSchema, type AnthropicMessage, AnthropicMessageDeltaEventSchema, AnthropicMessageSchema, AnthropicMessageStartEventSchema, AnthropicMessageStopEventSchema, AnthropicMetadataSchema, AnthropicPingEventSchema, type AnthropicRequest, AnthropicRequestSchema, type AnthropicResponse, AnthropicResponseSchema, type AnthropicSDKConfig, AnthropicSDKWrapper, type AnthropicStreamEvent, AnthropicStreamEventBaseSchema, AnthropicStreamEventSchema, AnthropicSystemMessageSchema, type AnthropicTextContentBlock, AnthropicTextContentBlockSchema, type AnthropicTool, AnthropicToolInputSchemaSchema, type AnthropicToolResultContentBlock, AnthropicToolResultContentBlockSchema, AnthropicToolSchema, type AnthropicToolUseContentBlock, AnthropicToolUseContentBlockSchema, type AnthropicUsage, AnthropicUsageSchema, type BaseSDKClient, A2ORequestAdapter as ClaudeToOpenAIConverter, type ConversionFixResult, ConversionFixer, type ConversionResult$2 as ConversionResult, type ConversionState, ConversionValidator, type ConvertedRequest, type ConvertedResponse, EMERGENCY_HEALING_STRATEGIES, type EnhancedAdapterOptions, type EnhancedConversionResult, ErrorDetector, type ErrorInfo, ErrorRecovery, type ErrorSeverity, type ErrorType, FEATURES, FormatValidator, type HealingContext, type HealingResult, type HealingRule, StandardProtocolAdapter as NonStreamingIOConverter, O2ASSEAdapter, O2ASSEAdapterStatic, type OpenAIChoice, OpenAIChoiceSchema, OpenAIFunctionParametersSchema, OpenAIFunctionSchema, type OpenAIMessage, OpenAIMessageContentSchema, OpenAIMessageSchema, type OpenAIRequest$1 as OpenAIRequest, OpenAIRequestSchema, type OpenAIResponse$1 as OpenAIResponse, OpenAIResponseSchema, type OpenAISDKConfig, OpenAISDKWrapper, type OpenAIStreamChunk, OpenAIStreamChunkSchema, O2ASSEAdapter as OpenAIToClaudeSSEConverter, type OpenAITool, type OpenAIToolCall, OpenAIToolCallSchema, OpenAIToolSchema, type OpenAIUsage, OpenAIUsageSchema, ProtocolHealer, RECOVERY_STRATEGIES, REQUEST_HEALING_STRATEGIES, RESPONSE_HEALING_STRATEGIES, type RecoveryResult, type RecoveryStrategy, type RequestOptions, type SDKConfig, SDKFactory, type SDKProvider, type SDKResponse, type SDKStreamEvent, SSEEventGenerator, STREAM_HEALING_STRATEGIES, type ConversionResult as SchemaConversionResult, StandardProtocolAdapter as StandardGateway, StandardProtocolAdapter, type StandardProtocolAdapterOptions, StreamingProtocolAdapter as StreamingGateway, StreamingProtocolAdapter as StreamingIOConverter, StreamingProtocolAdapter, type StreamingProtocolAdapterOptions, type UnifiedSDKConfig, type ValidationResult, attemptRecovery, conversionValidator, createAnthropicSDK, createOpenAISDK, createValidator, errorRecovery, getAllHealingStrategies, getGlobalLogger, getRecoveryRecommendations, getStrategiesForContext, healA2ORequest, healO2ARequest, healO2AResponse, healingValidate, isRecoverable, protocolHealer, safeValidate, sdkFactory, selectSDKByModel, strictValidate, validateA2OConversion, validateAnthropicRequest, validateAnthropicResponse, validateAnthropicStreamEvent, validateBatch, validateO2AConversion, validateOpenAIRequest, validateOpenAIResponse, validateOpenAIStreamChunk, validateSDKConfig, validateStreamConversion };
7336
+ export { A2ORequestAdapter, A2ORequestAdapterStatic, ADAPTERS_VERSION, type AnthropicContentBlock, AnthropicContentBlockBaseSchema, AnthropicContentBlockDeltaEventSchema, AnthropicContentBlockSchema, AnthropicContentBlockStartEventSchema, AnthropicContentBlockStopEventSchema, AnthropicErrorEventSchema, type AnthropicImageContentBlock, AnthropicImageContentBlockSchema, AnthropicImageSourceSchema, type AnthropicMessage, AnthropicMessageDeltaEventSchema, AnthropicMessageSchema, AnthropicMessageStartEventSchema, AnthropicMessageStopEventSchema, AnthropicMetadataSchema, AnthropicPingEventSchema, type AnthropicRequest, AnthropicRequestSchema, type AnthropicResponse, AnthropicResponseSchema, type AnthropicSDKConfig, AnthropicSDKWrapper, type AnthropicStreamEvent, AnthropicStreamEventBaseSchema, AnthropicStreamEventSchema, AnthropicSystemMessageSchema, type AnthropicTextContentBlock, AnthropicTextContentBlockSchema, type AnthropicTool, AnthropicToolInputSchemaSchema, type AnthropicToolResultContentBlock, AnthropicToolResultContentBlockSchema, AnthropicToolSchema, type AnthropicToolUseContentBlock, AnthropicToolUseContentBlockSchema, type AnthropicUsage, AnthropicUsageSchema, type BaseSDKClient, A2ORequestAdapter as ClaudeToOpenAIConverter, type ConversionFixResult, ConversionFixer, type ConversionResult$1 as ConversionResult, type ConversionState, ConversionValidator, type ConvertedRequest, type ConvertedResponse, EMERGENCY_HEALING_STRATEGIES, type EnhancedAdapterOptions, type EnhancedConversionResult, ErrorDetector, type ErrorInfo, ErrorRecovery, type ErrorSeverity, type ErrorType, FEATURES, FormatValidator, type HealingContext, type HealingResult, type HealingRule, StandardProtocolAdapter as NonStreamingIOConverter, O2ASSEAdapter, O2ASSEAdapterStatic, type OpenAIChoice, OpenAIChoiceSchema, OpenAIFunctionParametersSchema, OpenAIFunctionSchema, type OpenAIMessage, OpenAIMessageContentSchema, OpenAIMessageSchema, type OpenAIRequest$1 as OpenAIRequest, OpenAIRequestSchema, type OpenAIResponse$1 as OpenAIResponse, OpenAIResponseSchema, type OpenAISDKConfig, OpenAISDKWrapper, type OpenAIStreamChunk, OpenAIStreamChunkSchema, O2ASSEAdapter as OpenAIToClaudeSSEConverter, type OpenAITool, type OpenAIToolCall, OpenAIToolCallSchema, OpenAIToolSchema, type OpenAIUsage, OpenAIUsageSchema, ProtocolHealer, RECOVERY_STRATEGIES, REQUEST_HEALING_STRATEGIES, RESPONSE_HEALING_STRATEGIES, type RecoveryResult, type RecoveryStrategy, type RequestOptions, type SDKConfig, SDKFactory, type SDKProvider, type SDKResponse, type SDKStreamEvent, SSEEventGenerator, STREAM_HEALING_STRATEGIES, type ConversionResult as SchemaConversionResult, StandardProtocolAdapter as StandardGateway, StandardProtocolAdapter, type StandardProtocolAdapterOptions, StreamingProtocolAdapter as StreamingGateway, StreamingProtocolAdapter as StreamingIOConverter, StreamingProtocolAdapter, type StreamingProtocolAdapterOptions, type UnifiedSDKConfig, type ValidationResult, attemptRecovery, conversionValidator, createAnthropicSDK, createOpenAISDK, createValidator, errorRecovery, getAllHealingStrategies, getGlobalLogger, getRecoveryRecommendations, getStrategiesForContext, healA2ORequest, healO2ARequest, healO2AResponse, healingValidate, isRecoverable, protocolHealer, safeValidate, sdkFactory, selectSDKByModel, strictValidate, validateA2OConversion, validateAnthropicRequest, validateAnthropicResponse, validateAnthropicStreamEvent, validateBatch, validateO2AConversion, validateOpenAIRequest, validateOpenAIResponse, validateOpenAIStreamChunk, validateSDKConfig, validateStreamConversion };