@opencode-ai/ai 0.0.0-dev-18227 → 0.0.0-dev-18231
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/protocols/open-responses.d.ts +232 -24
- package/dist/protocols/open-responses.js +57 -34
- package/dist/protocols/openai-compatible-responses.d.ts +37 -3
- package/dist/protocols/openai-responses.d.ts +403 -50
- package/dist/protocols/openai-responses.js +33 -7
- package/dist/protocols/xai-responses.d.ts +52 -3
- package/dist/protocols/xai-responses.js +31 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +65 -3
- package/dist/providers/azure.d.ts +65 -3
- package/dist/providers/google-vertex-responses.d.ts +37 -3
- package/dist/providers/openai-compatible-responses.d.ts +37 -3
- package/dist/providers/openai.d.ts +65 -3
- package/package.json +3 -3
|
@@ -7,38 +7,7 @@ export declare const DEFAULT_BASE_URL = "https://api.openai.com/v1";
|
|
|
7
7
|
export declare const PATH = "/responses";
|
|
8
8
|
declare const OpenAIResponsesBody: Schema.Struct<{
|
|
9
9
|
readonly stream: Schema.Literal<true>;
|
|
10
|
-
readonly
|
|
11
|
-
readonly type: Schema.tag<"function">;
|
|
12
|
-
readonly name: Schema.String;
|
|
13
|
-
readonly description: Schema.String;
|
|
14
|
-
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
15
|
-
readonly strict: Schema.optional<Schema.Boolean>;
|
|
16
|
-
}>, Schema.Struct<{
|
|
17
|
-
readonly type: Schema.tag<"image_generation">;
|
|
18
|
-
readonly action: Schema.optional<Schema.Literals<readonly ["auto", "generate", "edit"]>>;
|
|
19
|
-
readonly background: Schema.optional<Schema.Literals<readonly ["auto", "opaque", "transparent"]>>;
|
|
20
|
-
readonly input_fidelity: Schema.optional<Schema.Literals<readonly ["low", "high"]>>;
|
|
21
|
-
readonly output_compression: Schema.optional<Schema.Int>;
|
|
22
|
-
readonly output_format: Schema.optional<Schema.Literals<readonly ["png", "jpeg", "webp"]>>;
|
|
23
|
-
readonly partial_images: Schema.optional<Schema.Int>;
|
|
24
|
-
readonly quality: Schema.optional<Schema.Literals<readonly ["auto", "low", "medium", "high"]>>;
|
|
25
|
-
readonly size: Schema.optional<Schema.String>;
|
|
26
|
-
}>]>>>;
|
|
27
|
-
readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
|
|
28
|
-
readonly type: Schema.tag<"function">;
|
|
29
|
-
readonly name: Schema.String;
|
|
30
|
-
}>, Schema.Struct<{
|
|
31
|
-
readonly type: Schema.tag<"allowed_tools">;
|
|
32
|
-
readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>;
|
|
33
|
-
readonly tools: Schema.$Array<Schema.Struct<{
|
|
34
|
-
readonly type: Schema.tag<"function">;
|
|
35
|
-
readonly name: Schema.String;
|
|
36
|
-
}>>;
|
|
37
|
-
}>]>, Schema.Struct<{
|
|
38
|
-
readonly type: Schema.tag<"image_generation">;
|
|
39
|
-
}>]>>;
|
|
40
|
-
readonly model: Schema.String;
|
|
41
|
-
readonly input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
10
|
+
readonly input: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
42
11
|
readonly role: Schema.tag<"system">;
|
|
43
12
|
readonly content: Schema.String;
|
|
44
13
|
}>, Schema.Struct<{
|
|
@@ -75,9 +44,6 @@ declare const OpenAIResponsesBody: Schema.Struct<{
|
|
|
75
44
|
readonly text: Schema.String;
|
|
76
45
|
}>>;
|
|
77
46
|
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
78
|
-
}>, Schema.Struct<{
|
|
79
|
-
readonly type: Schema.tag<"item_reference">;
|
|
80
|
-
readonly id: Schema.String;
|
|
81
47
|
}>, Schema.Struct<{
|
|
82
48
|
readonly type: Schema.tag<"function_call">;
|
|
83
49
|
readonly id: Schema.optionalKey<Schema.String>;
|
|
@@ -102,7 +68,84 @@ declare const OpenAIResponsesBody: Schema.Struct<{
|
|
|
102
68
|
readonly type: Schema.tag<"input_video">;
|
|
103
69
|
readonly video_url: Schema.String;
|
|
104
70
|
}>]>>]>;
|
|
71
|
+
}>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
72
|
+
readonly type: Schema.tag<"web_search_call">;
|
|
73
|
+
readonly id: Schema.String;
|
|
74
|
+
readonly status: Schema.optional<Schema.String>;
|
|
75
|
+
readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
76
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
77
|
+
readonly type: Schema.tag<"file_search_call">;
|
|
78
|
+
readonly id: Schema.String;
|
|
79
|
+
readonly status: Schema.optional<Schema.String>;
|
|
80
|
+
readonly queries: Schema.optional<Schema.$Array<Schema.String>>;
|
|
81
|
+
readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
82
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
83
|
+
readonly type: Schema.tag<"code_interpreter_call">;
|
|
84
|
+
readonly id: Schema.String;
|
|
85
|
+
readonly status: Schema.optional<Schema.String>;
|
|
86
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
87
|
+
readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
88
|
+
readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
89
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
90
|
+
readonly type: Schema.tag<"mcp_call">;
|
|
91
|
+
readonly id: Schema.String;
|
|
92
|
+
readonly status: Schema.optional<Schema.String>;
|
|
93
|
+
readonly server_label: Schema.optional<Schema.String>;
|
|
94
|
+
readonly name: Schema.optional<Schema.String>;
|
|
95
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
96
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
97
|
+
readonly error: Schema.optional<Schema.Unknown>;
|
|
98
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
99
|
+
readonly type: Schema.tag<"computer_call">;
|
|
100
|
+
readonly id: Schema.String;
|
|
101
|
+
readonly status: Schema.optional<Schema.String>;
|
|
102
|
+
readonly call_id: Schema.optional<Schema.String>;
|
|
103
|
+
readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
104
|
+
readonly pending_safety_checks: Schema.optional<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
105
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
106
|
+
readonly type: Schema.tag<"web_search_preview_call">;
|
|
107
|
+
readonly id: Schema.String;
|
|
108
|
+
readonly status: Schema.optional<Schema.String>;
|
|
109
|
+
readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
110
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
111
|
+
readonly type: Schema.tag<"image_generation_call">;
|
|
112
|
+
readonly id: Schema.String;
|
|
113
|
+
readonly status: Schema.optional<Schema.String>;
|
|
114
|
+
readonly result: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
115
|
+
readonly output_format: Schema.optional<Schema.Literals<readonly ["png", "jpeg", "webp"]>>;
|
|
116
|
+
readonly revised_prompt: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
117
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>;
|
|
118
|
+
readonly tools: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
119
|
+
readonly type: Schema.tag<"function">;
|
|
120
|
+
readonly name: Schema.String;
|
|
121
|
+
readonly description: Schema.String;
|
|
122
|
+
readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
123
|
+
readonly strict: Schema.optional<Schema.Boolean>;
|
|
124
|
+
}>, Schema.Struct<{
|
|
125
|
+
readonly type: Schema.tag<"image_generation">;
|
|
126
|
+
readonly action: Schema.optional<Schema.Literals<readonly ["auto", "generate", "edit"]>>;
|
|
127
|
+
readonly background: Schema.optional<Schema.Literals<readonly ["auto", "opaque", "transparent"]>>;
|
|
128
|
+
readonly input_fidelity: Schema.optional<Schema.Literals<readonly ["low", "high"]>>;
|
|
129
|
+
readonly output_compression: Schema.optional<Schema.Int>;
|
|
130
|
+
readonly output_format: Schema.optional<Schema.Literals<readonly ["png", "jpeg", "webp"]>>;
|
|
131
|
+
readonly partial_images: Schema.optional<Schema.Int>;
|
|
132
|
+
readonly quality: Schema.optional<Schema.Literals<readonly ["auto", "low", "medium", "high"]>>;
|
|
133
|
+
readonly size: Schema.optional<Schema.String>;
|
|
134
|
+
}>]>>>;
|
|
135
|
+
readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "required"]>, Schema.Struct<{
|
|
136
|
+
readonly type: Schema.tag<"function">;
|
|
137
|
+
readonly name: Schema.String;
|
|
138
|
+
}>, Schema.Struct<{
|
|
139
|
+
readonly type: Schema.tag<"allowed_tools">;
|
|
140
|
+
readonly mode: Schema.Literals<readonly ["auto", "none", "required"]>;
|
|
141
|
+
readonly tools: Schema.$Array<Schema.Struct<{
|
|
142
|
+
readonly type: Schema.tag<"function">;
|
|
143
|
+
readonly name: Schema.String;
|
|
144
|
+
}>>;
|
|
145
|
+
}>]>, Schema.Struct<{
|
|
146
|
+
readonly type: Schema.tag<"image_generation">;
|
|
105
147
|
}>]>>;
|
|
148
|
+
readonly model: Schema.String;
|
|
106
149
|
readonly instructions: Schema.optional<Schema.String>;
|
|
107
150
|
readonly store: Schema.optional<Schema.Boolean>;
|
|
108
151
|
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
@@ -133,6 +176,43 @@ declare const OpenAIResponsesBody: Schema.Struct<{
|
|
|
133
176
|
export type OpenAIResponsesBody = Schema.Schema.Type<typeof OpenAIResponsesBody>;
|
|
134
177
|
export declare const protocol: Protocol<{
|
|
135
178
|
readonly input: readonly ({
|
|
179
|
+
readonly [x: string]: unknown;
|
|
180
|
+
readonly id: string;
|
|
181
|
+
readonly type: "web_search_call";
|
|
182
|
+
readonly status?: string | undefined;
|
|
183
|
+
readonly action?: {
|
|
184
|
+
readonly [x: string]: unknown;
|
|
185
|
+
} | null | undefined;
|
|
186
|
+
} | {
|
|
187
|
+
readonly [x: string]: unknown;
|
|
188
|
+
readonly id: string;
|
|
189
|
+
readonly type: "file_search_call";
|
|
190
|
+
readonly status?: string | undefined;
|
|
191
|
+
readonly queries?: readonly string[] | undefined;
|
|
192
|
+
readonly results?: readonly {
|
|
193
|
+
readonly [x: string]: unknown;
|
|
194
|
+
}[] | null | undefined;
|
|
195
|
+
} | {
|
|
196
|
+
readonly [x: string]: unknown;
|
|
197
|
+
readonly id: string;
|
|
198
|
+
readonly type: "code_interpreter_call";
|
|
199
|
+
readonly status?: string | undefined;
|
|
200
|
+
readonly code?: string | null | undefined;
|
|
201
|
+
readonly container_id?: string | null | undefined;
|
|
202
|
+
readonly outputs?: readonly {
|
|
203
|
+
readonly [x: string]: unknown;
|
|
204
|
+
}[] | null | undefined;
|
|
205
|
+
} | {
|
|
206
|
+
readonly [x: string]: unknown;
|
|
207
|
+
readonly id: string;
|
|
208
|
+
readonly type: "mcp_call";
|
|
209
|
+
readonly status?: string | undefined;
|
|
210
|
+
readonly name?: string | undefined;
|
|
211
|
+
readonly output?: string | null | undefined;
|
|
212
|
+
readonly error?: unknown;
|
|
213
|
+
readonly arguments?: string | undefined;
|
|
214
|
+
readonly server_label?: string | undefined;
|
|
215
|
+
} | {
|
|
136
216
|
readonly type: "reasoning";
|
|
137
217
|
readonly summary: readonly {
|
|
138
218
|
readonly type: "summary_text";
|
|
@@ -140,9 +220,6 @@ export declare const protocol: Protocol<{
|
|
|
140
220
|
}[];
|
|
141
221
|
readonly id?: string | undefined;
|
|
142
222
|
readonly encrypted_content?: string | null | undefined;
|
|
143
|
-
} | {
|
|
144
|
-
readonly type: "item_reference";
|
|
145
|
-
readonly id: string;
|
|
146
223
|
} | {
|
|
147
224
|
readonly role: "system";
|
|
148
225
|
readonly content: string;
|
|
@@ -196,6 +273,34 @@ export declare const protocol: Protocol<{
|
|
|
196
273
|
readonly type: "input_video";
|
|
197
274
|
readonly video_url: string;
|
|
198
275
|
})[];
|
|
276
|
+
} | {
|
|
277
|
+
readonly [x: string]: unknown;
|
|
278
|
+
readonly id: string;
|
|
279
|
+
readonly type: "computer_call";
|
|
280
|
+
readonly status?: string | undefined;
|
|
281
|
+
readonly action?: {
|
|
282
|
+
readonly [x: string]: unknown;
|
|
283
|
+
} | null | undefined;
|
|
284
|
+
readonly call_id?: string | undefined;
|
|
285
|
+
readonly pending_safety_checks?: readonly {
|
|
286
|
+
readonly [x: string]: unknown;
|
|
287
|
+
}[] | undefined;
|
|
288
|
+
} | {
|
|
289
|
+
readonly [x: string]: unknown;
|
|
290
|
+
readonly id: string;
|
|
291
|
+
readonly type: "web_search_preview_call";
|
|
292
|
+
readonly status?: string | undefined;
|
|
293
|
+
readonly action?: {
|
|
294
|
+
readonly [x: string]: unknown;
|
|
295
|
+
} | null | undefined;
|
|
296
|
+
} | {
|
|
297
|
+
readonly [x: string]: unknown;
|
|
298
|
+
readonly id: string;
|
|
299
|
+
readonly type: "image_generation_call";
|
|
300
|
+
readonly status?: string | undefined;
|
|
301
|
+
readonly result?: string | null | undefined;
|
|
302
|
+
readonly revised_prompt?: string | null | undefined;
|
|
303
|
+
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
199
304
|
})[];
|
|
200
305
|
readonly model: string;
|
|
201
306
|
readonly stream: true;
|
|
@@ -327,6 +432,43 @@ export declare const protocol: Protocol<{
|
|
|
327
432
|
}, OpenResponses.ParserState>;
|
|
328
433
|
export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
329
434
|
readonly input: readonly ({
|
|
435
|
+
readonly [x: string]: unknown;
|
|
436
|
+
readonly id: string;
|
|
437
|
+
readonly type: "web_search_call";
|
|
438
|
+
readonly status?: string | undefined;
|
|
439
|
+
readonly action?: {
|
|
440
|
+
readonly [x: string]: unknown;
|
|
441
|
+
} | null | undefined;
|
|
442
|
+
} | {
|
|
443
|
+
readonly [x: string]: unknown;
|
|
444
|
+
readonly id: string;
|
|
445
|
+
readonly type: "file_search_call";
|
|
446
|
+
readonly status?: string | undefined;
|
|
447
|
+
readonly queries?: readonly string[] | undefined;
|
|
448
|
+
readonly results?: readonly {
|
|
449
|
+
readonly [x: string]: unknown;
|
|
450
|
+
}[] | null | undefined;
|
|
451
|
+
} | {
|
|
452
|
+
readonly [x: string]: unknown;
|
|
453
|
+
readonly id: string;
|
|
454
|
+
readonly type: "code_interpreter_call";
|
|
455
|
+
readonly status?: string | undefined;
|
|
456
|
+
readonly code?: string | null | undefined;
|
|
457
|
+
readonly container_id?: string | null | undefined;
|
|
458
|
+
readonly outputs?: readonly {
|
|
459
|
+
readonly [x: string]: unknown;
|
|
460
|
+
}[] | null | undefined;
|
|
461
|
+
} | {
|
|
462
|
+
readonly [x: string]: unknown;
|
|
463
|
+
readonly id: string;
|
|
464
|
+
readonly type: "mcp_call";
|
|
465
|
+
readonly status?: string | undefined;
|
|
466
|
+
readonly name?: string | undefined;
|
|
467
|
+
readonly output?: string | null | undefined;
|
|
468
|
+
readonly error?: unknown;
|
|
469
|
+
readonly arguments?: string | undefined;
|
|
470
|
+
readonly server_label?: string | undefined;
|
|
471
|
+
} | {
|
|
330
472
|
readonly type: "reasoning";
|
|
331
473
|
readonly summary: readonly {
|
|
332
474
|
readonly type: "summary_text";
|
|
@@ -334,9 +476,6 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
334
476
|
}[];
|
|
335
477
|
readonly id?: string | undefined;
|
|
336
478
|
readonly encrypted_content?: string | null | undefined;
|
|
337
|
-
} | {
|
|
338
|
-
readonly type: "item_reference";
|
|
339
|
-
readonly id: string;
|
|
340
479
|
} | {
|
|
341
480
|
readonly role: "system";
|
|
342
481
|
readonly content: string;
|
|
@@ -390,6 +529,34 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
390
529
|
readonly type: "input_video";
|
|
391
530
|
readonly video_url: string;
|
|
392
531
|
})[];
|
|
532
|
+
} | {
|
|
533
|
+
readonly [x: string]: unknown;
|
|
534
|
+
readonly id: string;
|
|
535
|
+
readonly type: "computer_call";
|
|
536
|
+
readonly status?: string | undefined;
|
|
537
|
+
readonly action?: {
|
|
538
|
+
readonly [x: string]: unknown;
|
|
539
|
+
} | null | undefined;
|
|
540
|
+
readonly call_id?: string | undefined;
|
|
541
|
+
readonly pending_safety_checks?: readonly {
|
|
542
|
+
readonly [x: string]: unknown;
|
|
543
|
+
}[] | undefined;
|
|
544
|
+
} | {
|
|
545
|
+
readonly [x: string]: unknown;
|
|
546
|
+
readonly id: string;
|
|
547
|
+
readonly type: "web_search_preview_call";
|
|
548
|
+
readonly status?: string | undefined;
|
|
549
|
+
readonly action?: {
|
|
550
|
+
readonly [x: string]: unknown;
|
|
551
|
+
} | null | undefined;
|
|
552
|
+
} | {
|
|
553
|
+
readonly [x: string]: unknown;
|
|
554
|
+
readonly id: string;
|
|
555
|
+
readonly type: "image_generation_call";
|
|
556
|
+
readonly status?: string | undefined;
|
|
557
|
+
readonly result?: string | null | undefined;
|
|
558
|
+
readonly revised_prompt?: string | null | undefined;
|
|
559
|
+
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
393
560
|
})[];
|
|
394
561
|
readonly model: string;
|
|
395
562
|
readonly stream: true;
|
|
@@ -456,6 +623,43 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
456
623
|
}, string>;
|
|
457
624
|
export declare const channelTransport: (options: import("./open-responses-channel.js").Options) => import("../route/transport/index.js").Transport<{
|
|
458
625
|
readonly input: readonly ({
|
|
626
|
+
readonly [x: string]: unknown;
|
|
627
|
+
readonly id: string;
|
|
628
|
+
readonly type: "web_search_call";
|
|
629
|
+
readonly status?: string | undefined;
|
|
630
|
+
readonly action?: {
|
|
631
|
+
readonly [x: string]: unknown;
|
|
632
|
+
} | null | undefined;
|
|
633
|
+
} | {
|
|
634
|
+
readonly [x: string]: unknown;
|
|
635
|
+
readonly id: string;
|
|
636
|
+
readonly type: "file_search_call";
|
|
637
|
+
readonly status?: string | undefined;
|
|
638
|
+
readonly queries?: readonly string[] | undefined;
|
|
639
|
+
readonly results?: readonly {
|
|
640
|
+
readonly [x: string]: unknown;
|
|
641
|
+
}[] | null | undefined;
|
|
642
|
+
} | {
|
|
643
|
+
readonly [x: string]: unknown;
|
|
644
|
+
readonly id: string;
|
|
645
|
+
readonly type: "code_interpreter_call";
|
|
646
|
+
readonly status?: string | undefined;
|
|
647
|
+
readonly code?: string | null | undefined;
|
|
648
|
+
readonly container_id?: string | null | undefined;
|
|
649
|
+
readonly outputs?: readonly {
|
|
650
|
+
readonly [x: string]: unknown;
|
|
651
|
+
}[] | null | undefined;
|
|
652
|
+
} | {
|
|
653
|
+
readonly [x: string]: unknown;
|
|
654
|
+
readonly id: string;
|
|
655
|
+
readonly type: "mcp_call";
|
|
656
|
+
readonly status?: string | undefined;
|
|
657
|
+
readonly name?: string | undefined;
|
|
658
|
+
readonly output?: string | null | undefined;
|
|
659
|
+
readonly error?: unknown;
|
|
660
|
+
readonly arguments?: string | undefined;
|
|
661
|
+
readonly server_label?: string | undefined;
|
|
662
|
+
} | {
|
|
459
663
|
readonly type: "reasoning";
|
|
460
664
|
readonly summary: readonly {
|
|
461
665
|
readonly type: "summary_text";
|
|
@@ -463,9 +667,6 @@ export declare const channelTransport: (options: import("./open-responses-channe
|
|
|
463
667
|
}[];
|
|
464
668
|
readonly id?: string | undefined;
|
|
465
669
|
readonly encrypted_content?: string | null | undefined;
|
|
466
|
-
} | {
|
|
467
|
-
readonly type: "item_reference";
|
|
468
|
-
readonly id: string;
|
|
469
670
|
} | {
|
|
470
671
|
readonly role: "system";
|
|
471
672
|
readonly content: string;
|
|
@@ -519,6 +720,34 @@ export declare const channelTransport: (options: import("./open-responses-channe
|
|
|
519
720
|
readonly type: "input_video";
|
|
520
721
|
readonly video_url: string;
|
|
521
722
|
})[];
|
|
723
|
+
} | {
|
|
724
|
+
readonly [x: string]: unknown;
|
|
725
|
+
readonly id: string;
|
|
726
|
+
readonly type: "computer_call";
|
|
727
|
+
readonly status?: string | undefined;
|
|
728
|
+
readonly action?: {
|
|
729
|
+
readonly [x: string]: unknown;
|
|
730
|
+
} | null | undefined;
|
|
731
|
+
readonly call_id?: string | undefined;
|
|
732
|
+
readonly pending_safety_checks?: readonly {
|
|
733
|
+
readonly [x: string]: unknown;
|
|
734
|
+
}[] | undefined;
|
|
735
|
+
} | {
|
|
736
|
+
readonly [x: string]: unknown;
|
|
737
|
+
readonly id: string;
|
|
738
|
+
readonly type: "web_search_preview_call";
|
|
739
|
+
readonly status?: string | undefined;
|
|
740
|
+
readonly action?: {
|
|
741
|
+
readonly [x: string]: unknown;
|
|
742
|
+
} | null | undefined;
|
|
743
|
+
} | {
|
|
744
|
+
readonly [x: string]: unknown;
|
|
745
|
+
readonly id: string;
|
|
746
|
+
readonly type: "image_generation_call";
|
|
747
|
+
readonly status?: string | undefined;
|
|
748
|
+
readonly result?: string | null | undefined;
|
|
749
|
+
readonly revised_prompt?: string | null | undefined;
|
|
750
|
+
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
522
751
|
})[];
|
|
523
752
|
readonly model: string;
|
|
524
753
|
readonly stream: true;
|
|
@@ -585,6 +814,43 @@ export declare const channelTransport: (options: import("./open-responses-channe
|
|
|
585
814
|
}, import("./open-responses-channel.js").Prepared, string>;
|
|
586
815
|
export declare const transport: import("../route/transport/index.js").Transport<{
|
|
587
816
|
readonly input: readonly ({
|
|
817
|
+
readonly [x: string]: unknown;
|
|
818
|
+
readonly id: string;
|
|
819
|
+
readonly type: "web_search_call";
|
|
820
|
+
readonly status?: string | undefined;
|
|
821
|
+
readonly action?: {
|
|
822
|
+
readonly [x: string]: unknown;
|
|
823
|
+
} | null | undefined;
|
|
824
|
+
} | {
|
|
825
|
+
readonly [x: string]: unknown;
|
|
826
|
+
readonly id: string;
|
|
827
|
+
readonly type: "file_search_call";
|
|
828
|
+
readonly status?: string | undefined;
|
|
829
|
+
readonly queries?: readonly string[] | undefined;
|
|
830
|
+
readonly results?: readonly {
|
|
831
|
+
readonly [x: string]: unknown;
|
|
832
|
+
}[] | null | undefined;
|
|
833
|
+
} | {
|
|
834
|
+
readonly [x: string]: unknown;
|
|
835
|
+
readonly id: string;
|
|
836
|
+
readonly type: "code_interpreter_call";
|
|
837
|
+
readonly status?: string | undefined;
|
|
838
|
+
readonly code?: string | null | undefined;
|
|
839
|
+
readonly container_id?: string | null | undefined;
|
|
840
|
+
readonly outputs?: readonly {
|
|
841
|
+
readonly [x: string]: unknown;
|
|
842
|
+
}[] | null | undefined;
|
|
843
|
+
} | {
|
|
844
|
+
readonly [x: string]: unknown;
|
|
845
|
+
readonly id: string;
|
|
846
|
+
readonly type: "mcp_call";
|
|
847
|
+
readonly status?: string | undefined;
|
|
848
|
+
readonly name?: string | undefined;
|
|
849
|
+
readonly output?: string | null | undefined;
|
|
850
|
+
readonly error?: unknown;
|
|
851
|
+
readonly arguments?: string | undefined;
|
|
852
|
+
readonly server_label?: string | undefined;
|
|
853
|
+
} | {
|
|
588
854
|
readonly type: "reasoning";
|
|
589
855
|
readonly summary: readonly {
|
|
590
856
|
readonly type: "summary_text";
|
|
@@ -592,9 +858,6 @@ export declare const transport: import("../route/transport/index.js").Transport<
|
|
|
592
858
|
}[];
|
|
593
859
|
readonly id?: string | undefined;
|
|
594
860
|
readonly encrypted_content?: string | null | undefined;
|
|
595
|
-
} | {
|
|
596
|
-
readonly type: "item_reference";
|
|
597
|
-
readonly id: string;
|
|
598
861
|
} | {
|
|
599
862
|
readonly role: "system";
|
|
600
863
|
readonly content: string;
|
|
@@ -648,6 +911,34 @@ export declare const transport: import("../route/transport/index.js").Transport<
|
|
|
648
911
|
readonly type: "input_video";
|
|
649
912
|
readonly video_url: string;
|
|
650
913
|
})[];
|
|
914
|
+
} | {
|
|
915
|
+
readonly [x: string]: unknown;
|
|
916
|
+
readonly id: string;
|
|
917
|
+
readonly type: "computer_call";
|
|
918
|
+
readonly status?: string | undefined;
|
|
919
|
+
readonly action?: {
|
|
920
|
+
readonly [x: string]: unknown;
|
|
921
|
+
} | null | undefined;
|
|
922
|
+
readonly call_id?: string | undefined;
|
|
923
|
+
readonly pending_safety_checks?: readonly {
|
|
924
|
+
readonly [x: string]: unknown;
|
|
925
|
+
}[] | undefined;
|
|
926
|
+
} | {
|
|
927
|
+
readonly [x: string]: unknown;
|
|
928
|
+
readonly id: string;
|
|
929
|
+
readonly type: "web_search_preview_call";
|
|
930
|
+
readonly status?: string | undefined;
|
|
931
|
+
readonly action?: {
|
|
932
|
+
readonly [x: string]: unknown;
|
|
933
|
+
} | null | undefined;
|
|
934
|
+
} | {
|
|
935
|
+
readonly [x: string]: unknown;
|
|
936
|
+
readonly id: string;
|
|
937
|
+
readonly type: "image_generation_call";
|
|
938
|
+
readonly status?: string | undefined;
|
|
939
|
+
readonly result?: string | null | undefined;
|
|
940
|
+
readonly revised_prompt?: string | null | undefined;
|
|
941
|
+
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
651
942
|
})[];
|
|
652
943
|
readonly model: string;
|
|
653
944
|
readonly stream: true;
|
|
@@ -714,6 +1005,43 @@ export declare const transport: import("../route/transport/index.js").Transport<
|
|
|
714
1005
|
}, import("./open-responses-channel.js").Prepared, string>;
|
|
715
1006
|
export declare const route: Route<{
|
|
716
1007
|
readonly input: readonly ({
|
|
1008
|
+
readonly [x: string]: unknown;
|
|
1009
|
+
readonly id: string;
|
|
1010
|
+
readonly type: "web_search_call";
|
|
1011
|
+
readonly status?: string | undefined;
|
|
1012
|
+
readonly action?: {
|
|
1013
|
+
readonly [x: string]: unknown;
|
|
1014
|
+
} | null | undefined;
|
|
1015
|
+
} | {
|
|
1016
|
+
readonly [x: string]: unknown;
|
|
1017
|
+
readonly id: string;
|
|
1018
|
+
readonly type: "file_search_call";
|
|
1019
|
+
readonly status?: string | undefined;
|
|
1020
|
+
readonly queries?: readonly string[] | undefined;
|
|
1021
|
+
readonly results?: readonly {
|
|
1022
|
+
readonly [x: string]: unknown;
|
|
1023
|
+
}[] | null | undefined;
|
|
1024
|
+
} | {
|
|
1025
|
+
readonly [x: string]: unknown;
|
|
1026
|
+
readonly id: string;
|
|
1027
|
+
readonly type: "code_interpreter_call";
|
|
1028
|
+
readonly status?: string | undefined;
|
|
1029
|
+
readonly code?: string | null | undefined;
|
|
1030
|
+
readonly container_id?: string | null | undefined;
|
|
1031
|
+
readonly outputs?: readonly {
|
|
1032
|
+
readonly [x: string]: unknown;
|
|
1033
|
+
}[] | null | undefined;
|
|
1034
|
+
} | {
|
|
1035
|
+
readonly [x: string]: unknown;
|
|
1036
|
+
readonly id: string;
|
|
1037
|
+
readonly type: "mcp_call";
|
|
1038
|
+
readonly status?: string | undefined;
|
|
1039
|
+
readonly name?: string | undefined;
|
|
1040
|
+
readonly output?: string | null | undefined;
|
|
1041
|
+
readonly error?: unknown;
|
|
1042
|
+
readonly arguments?: string | undefined;
|
|
1043
|
+
readonly server_label?: string | undefined;
|
|
1044
|
+
} | {
|
|
717
1045
|
readonly type: "reasoning";
|
|
718
1046
|
readonly summary: readonly {
|
|
719
1047
|
readonly type: "summary_text";
|
|
@@ -721,9 +1049,6 @@ export declare const route: Route<{
|
|
|
721
1049
|
}[];
|
|
722
1050
|
readonly id?: string | undefined;
|
|
723
1051
|
readonly encrypted_content?: string | null | undefined;
|
|
724
|
-
} | {
|
|
725
|
-
readonly type: "item_reference";
|
|
726
|
-
readonly id: string;
|
|
727
1052
|
} | {
|
|
728
1053
|
readonly role: "system";
|
|
729
1054
|
readonly content: string;
|
|
@@ -777,6 +1102,34 @@ export declare const route: Route<{
|
|
|
777
1102
|
readonly type: "input_video";
|
|
778
1103
|
readonly video_url: string;
|
|
779
1104
|
})[];
|
|
1105
|
+
} | {
|
|
1106
|
+
readonly [x: string]: unknown;
|
|
1107
|
+
readonly id: string;
|
|
1108
|
+
readonly type: "computer_call";
|
|
1109
|
+
readonly status?: string | undefined;
|
|
1110
|
+
readonly action?: {
|
|
1111
|
+
readonly [x: string]: unknown;
|
|
1112
|
+
} | null | undefined;
|
|
1113
|
+
readonly call_id?: string | undefined;
|
|
1114
|
+
readonly pending_safety_checks?: readonly {
|
|
1115
|
+
readonly [x: string]: unknown;
|
|
1116
|
+
}[] | undefined;
|
|
1117
|
+
} | {
|
|
1118
|
+
readonly [x: string]: unknown;
|
|
1119
|
+
readonly id: string;
|
|
1120
|
+
readonly type: "web_search_preview_call";
|
|
1121
|
+
readonly status?: string | undefined;
|
|
1122
|
+
readonly action?: {
|
|
1123
|
+
readonly [x: string]: unknown;
|
|
1124
|
+
} | null | undefined;
|
|
1125
|
+
} | {
|
|
1126
|
+
readonly [x: string]: unknown;
|
|
1127
|
+
readonly id: string;
|
|
1128
|
+
readonly type: "image_generation_call";
|
|
1129
|
+
readonly status?: string | undefined;
|
|
1130
|
+
readonly result?: string | null | undefined;
|
|
1131
|
+
readonly revised_prompt?: string | null | undefined;
|
|
1132
|
+
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
780
1133
|
})[];
|
|
781
1134
|
readonly model: string;
|
|
782
1135
|
readonly stream: true;
|
|
@@ -7,7 +7,7 @@ import { Protocol } from "../route/protocol.js";
|
|
|
7
7
|
import { HttpTransport } from "../route/transport/index.js";
|
|
8
8
|
import { LLMRequest } from "../schema/index.js";
|
|
9
9
|
import { OpenResponses } from "./open-responses.js";
|
|
10
|
-
import { optionalArray, ProviderShared } from "./shared.js";
|
|
10
|
+
import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js";
|
|
11
11
|
import { OpenAIImage } from "./utils/openai-image.js";
|
|
12
12
|
import { ResponsesHostedTools } from "./utils/responses-hosted-tools.js";
|
|
13
13
|
import { ToolSchemaProjection } from "./utils/tool-schema.js";
|
|
@@ -29,6 +29,30 @@ const OpenAIResponsesImageGenerationTool = Schema.Struct({
|
|
|
29
29
|
quality: Schema.optional(Schema.Literals(["auto", "low", "medium", "high"])),
|
|
30
30
|
size: Schema.optional(OpenAIImage.Size),
|
|
31
31
|
});
|
|
32
|
+
const OpenAIResponsesHostedToolItem = Schema.Union([
|
|
33
|
+
Schema.StructWithRest(Schema.Struct({
|
|
34
|
+
type: Schema.tag("computer_call"),
|
|
35
|
+
id: Schema.String,
|
|
36
|
+
status: Schema.optional(Schema.String),
|
|
37
|
+
call_id: Schema.optional(Schema.String),
|
|
38
|
+
action: optionalNull(JsonObject),
|
|
39
|
+
pending_safety_checks: Schema.optional(Schema.Array(JsonObject)),
|
|
40
|
+
}), [JsonObject]),
|
|
41
|
+
Schema.StructWithRest(Schema.Struct({
|
|
42
|
+
type: Schema.tag("web_search_preview_call"),
|
|
43
|
+
id: Schema.String,
|
|
44
|
+
status: Schema.optional(Schema.String),
|
|
45
|
+
action: optionalNull(JsonObject),
|
|
46
|
+
}), [JsonObject]),
|
|
47
|
+
Schema.StructWithRest(Schema.Struct({
|
|
48
|
+
type: Schema.tag("image_generation_call"),
|
|
49
|
+
id: Schema.String,
|
|
50
|
+
status: Schema.optional(Schema.String),
|
|
51
|
+
result: optionalNull(Schema.String),
|
|
52
|
+
output_format: Schema.optional(Schema.Literals(["png", "jpeg", "webp"])),
|
|
53
|
+
revised_prompt: optionalNull(Schema.String),
|
|
54
|
+
}), [JsonObject]),
|
|
55
|
+
]);
|
|
32
56
|
const OpenAIResponsesTools = Schema.Union([OpenResponses.Tool, OpenAIResponsesImageGenerationTool]);
|
|
33
57
|
const OpenAIResponsesToolChoice = Schema.Union([
|
|
34
58
|
OpenResponses.ToolChoice,
|
|
@@ -36,6 +60,7 @@ const OpenAIResponsesToolChoice = Schema.Union([
|
|
|
36
60
|
]);
|
|
37
61
|
const OpenAIResponsesCoreFields = {
|
|
38
62
|
...OpenResponses.coreFields,
|
|
63
|
+
input: Schema.Array(Schema.Union([OpenResponses.InputItem, OpenAIResponsesHostedToolItem])),
|
|
39
64
|
tools: optionalArray(OpenAIResponsesTools),
|
|
40
65
|
tool_choice: Schema.optional(OpenAIResponsesToolChoice),
|
|
41
66
|
};
|
|
@@ -46,20 +71,20 @@ const OpenAIResponsesBody = Schema.Struct({
|
|
|
46
71
|
// Replayed items are paired with stored server state by id, so a foreign or
|
|
47
72
|
// synthetic token can fail request validation even when `call_id` pairing is
|
|
48
73
|
// intact. Only resend ids in each item kind's own grammar; hosted tool
|
|
49
|
-
//
|
|
74
|
+
// items keep generic validation because every hosted tool mints its own
|
|
50
75
|
// prefix. The same allowlist approach codex uses before resending history
|
|
51
76
|
// (codex-rs core/src/client.rs, `prepare_response_items_for_request`).
|
|
52
77
|
const ITEM_ID_PREFIXES = {
|
|
53
78
|
message: ["msg_"],
|
|
54
79
|
reasoning: ["rs_"],
|
|
55
80
|
"function-call": ["fc_"],
|
|
56
|
-
// Every hosted tool mints its own id prefix, so
|
|
57
|
-
|
|
58
|
-
reference: [],
|
|
81
|
+
// Every hosted tool mints its own id prefix, so items keep generic validation.
|
|
82
|
+
"hosted-tool": [],
|
|
59
83
|
};
|
|
60
84
|
const extension = {
|
|
61
85
|
id: ADAPTER,
|
|
62
86
|
name: NAME,
|
|
87
|
+
lowerHostedToolItem: (item) => (Schema.is(OpenAIResponsesHostedToolItem)(item) ? item : undefined),
|
|
63
88
|
acceptsItemID: (kind, id) => {
|
|
64
89
|
const prefixes = ITEM_ID_PREFIXES[kind];
|
|
65
90
|
return prefixes.length === 0 || prefixes.some((prefix) => id.startsWith(prefix));
|
|
@@ -90,18 +115,19 @@ const lowerToolChoice = (toolChoice, tools) => ProviderShared.matchToolChoice(NA
|
|
|
90
115
|
? { type: "image_generation" }
|
|
91
116
|
: { type: "function", name },
|
|
92
117
|
});
|
|
118
|
+
const decodeBody = ProviderShared.validateWith(Schema.decodeUnknownEffect(OpenAIResponsesBody));
|
|
93
119
|
const fromRequest = Effect.fn("OpenAIResponses.fromRequest")(function* (request) {
|
|
94
120
|
const body = yield* OpenResponses.fromRequestWithExtension(LLMRequest.update(request, { tools: [], toolChoice: undefined }), extension);
|
|
95
121
|
const toolSchemaCompatibility = request.model.compatibility?.toolSchema;
|
|
96
122
|
const parallelToolCalls = OpenResponses.resolveParallelToolCalls(request);
|
|
97
|
-
return {
|
|
123
|
+
return yield* decodeBody({
|
|
98
124
|
...body,
|
|
99
125
|
...(parallelToolCalls === undefined ? {} : { parallel_tool_calls: parallelToolCalls }),
|
|
100
126
|
tools: request.tools.length === 0
|
|
101
127
|
? undefined
|
|
102
128
|
: yield* Effect.forEach(request.tools, (tool) => lowerTool(tool, ToolSchemaProjection.modelCompatibility(tool.inputSchema, toolSchemaCompatibility))),
|
|
103
129
|
tool_choice: body.tool_choice ?? (request.toolChoice ? yield* lowerToolChoice(request.toolChoice, request.tools) : undefined),
|
|
104
|
-
};
|
|
130
|
+
});
|
|
105
131
|
});
|
|
106
132
|
const hostedToolResult = Effect.fn("OpenAIResponses.hostedToolResult")(function* (item) {
|
|
107
133
|
const isError = item.error !== undefined && item.error !== null;
|