@ai-sdk/openai 4.0.0-beta.2 → 4.0.0-beta.21
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/CHANGELOG.md +234 -22
- package/README.md +2 -0
- package/dist/index.d.mts +134 -35
- package/dist/index.d.ts +134 -35
- package/dist/index.js +1700 -1139
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1697 -1117
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +107 -41
- package/dist/internal/index.d.ts +107 -41
- package/dist/internal/index.js +1380 -939
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1371 -917
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +274 -9
- package/package.json +3 -5
- package/src/chat/convert-openai-chat-usage.ts +2 -2
- package/src/chat/convert-to-openai-chat-messages.ts +26 -15
- package/src/chat/map-openai-finish-reason.ts +2 -2
- package/src/chat/openai-chat-language-model.ts +32 -24
- package/src/chat/openai-chat-options.ts +5 -0
- package/src/chat/openai-chat-prepare-tools.ts +6 -6
- package/src/completion/convert-openai-completion-usage.ts +2 -2
- package/src/completion/convert-to-openai-completion-prompt.ts +2 -2
- package/src/completion/map-openai-finish-reason.ts +2 -2
- package/src/completion/openai-completion-language-model.ts +20 -20
- package/src/embedding/openai-embedding-model.ts +5 -5
- package/src/files/openai-files-api.ts +17 -0
- package/src/files/openai-files-options.ts +18 -0
- package/src/files/openai-files.ts +102 -0
- package/src/image/openai-image-model.ts +9 -9
- package/src/index.ts +2 -0
- package/src/openai-config.ts +5 -5
- package/src/openai-language-model-capabilities.ts +3 -2
- package/src/openai-provider.ts +39 -21
- package/src/openai-tools.ts +12 -1
- package/src/responses/convert-openai-responses-usage.ts +2 -2
- package/src/responses/convert-to-openai-responses-input.ts +188 -14
- package/src/responses/map-openai-responses-finish-reason.ts +2 -2
- package/src/responses/openai-responses-api.ts +136 -2
- package/src/responses/openai-responses-language-model.ts +233 -37
- package/src/responses/openai-responses-options.ts +24 -2
- package/src/responses/openai-responses-prepare-tools.ts +34 -9
- package/src/responses/openai-responses-provider-metadata.ts +10 -0
- package/src/speech/openai-speech-model.ts +7 -7
- package/src/tool/custom.ts +0 -6
- package/src/tool/tool-search.ts +98 -0
- package/src/transcription/openai-transcription-model.ts +8 -8
package/dist/internal/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
createEventSourceResponseHandler,
|
|
8
8
|
createJsonResponseHandler,
|
|
9
9
|
generateId,
|
|
10
|
+
isCustomReasoning,
|
|
10
11
|
isParsableJson,
|
|
11
12
|
parseProviderOptions,
|
|
12
13
|
postJsonToApi
|
|
@@ -34,9 +35,9 @@ var openaiFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
34
35
|
// src/openai-language-model-capabilities.ts
|
|
35
36
|
function getOpenAILanguageModelCapabilities(modelId) {
|
|
36
37
|
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
37
|
-
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5
|
|
38
|
+
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") && !modelId.startsWith("gpt-5.4-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
38
39
|
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
39
|
-
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.4");
|
|
40
|
+
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
|
|
40
41
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
41
42
|
return {
|
|
42
43
|
supportsFlexProcessing,
|
|
@@ -90,7 +91,11 @@ function convertOpenAIChatUsage(usage) {
|
|
|
90
91
|
import {
|
|
91
92
|
UnsupportedFunctionalityError
|
|
92
93
|
} from "@ai-sdk/provider";
|
|
93
|
-
import {
|
|
94
|
+
import {
|
|
95
|
+
convertToBase64,
|
|
96
|
+
isProviderReference,
|
|
97
|
+
resolveProviderReference
|
|
98
|
+
} from "@ai-sdk/provider-utils";
|
|
94
99
|
function convertToOpenAIChatMessages({
|
|
95
100
|
prompt,
|
|
96
101
|
systemMessageMode = "system"
|
|
@@ -140,13 +145,23 @@ function convertToOpenAIChatMessages({
|
|
|
140
145
|
return { type: "text", text: part.text };
|
|
141
146
|
}
|
|
142
147
|
case "file": {
|
|
148
|
+
if (isProviderReference(part.data)) {
|
|
149
|
+
return {
|
|
150
|
+
type: "file",
|
|
151
|
+
file: {
|
|
152
|
+
file_id: resolveProviderReference({
|
|
153
|
+
reference: part.data,
|
|
154
|
+
provider: "openai"
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
143
159
|
if (part.mediaType.startsWith("image/")) {
|
|
144
160
|
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
145
161
|
return {
|
|
146
162
|
type: "image_url",
|
|
147
163
|
image_url: {
|
|
148
164
|
url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}`,
|
|
149
|
-
// OpenAI specific extension: image detail
|
|
150
165
|
detail: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.imageDetail
|
|
151
166
|
}
|
|
152
167
|
};
|
|
@@ -190,7 +205,7 @@ function convertToOpenAIChatMessages({
|
|
|
190
205
|
}
|
|
191
206
|
return {
|
|
192
207
|
type: "file",
|
|
193
|
-
file:
|
|
208
|
+
file: {
|
|
194
209
|
filename: (_c = part.filename) != null ? _c : `part-${index}.pdf`,
|
|
195
210
|
file_data: `data:application/pdf;base64,${convertToBase64(part.data)}`
|
|
196
211
|
}
|
|
@@ -631,7 +646,7 @@ function prepareChatTools({
|
|
|
631
646
|
// src/chat/openai-chat-language-model.ts
|
|
632
647
|
var OpenAIChatLanguageModel = class {
|
|
633
648
|
constructor(modelId, config) {
|
|
634
|
-
this.specificationVersion = "
|
|
649
|
+
this.specificationVersion = "v4";
|
|
635
650
|
this.supportedUrls = {
|
|
636
651
|
"image/*": [/^https?:\/\/.*$/]
|
|
637
652
|
};
|
|
@@ -654,9 +669,10 @@ var OpenAIChatLanguageModel = class {
|
|
|
654
669
|
seed,
|
|
655
670
|
tools,
|
|
656
671
|
toolChoice,
|
|
672
|
+
reasoning,
|
|
657
673
|
providerOptions
|
|
658
674
|
}) {
|
|
659
|
-
var _a, _b, _c, _d, _e;
|
|
675
|
+
var _a, _b, _c, _d, _e, _f;
|
|
660
676
|
const warnings = [];
|
|
661
677
|
const openaiOptions = (_a = await parseProviderOptions({
|
|
662
678
|
provider: "openai",
|
|
@@ -664,18 +680,19 @@ var OpenAIChatLanguageModel = class {
|
|
|
664
680
|
schema: openaiLanguageModelChatOptions
|
|
665
681
|
})) != null ? _a : {};
|
|
666
682
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
667
|
-
const
|
|
683
|
+
const resolvedReasoningEffort = (_b = openaiOptions.reasoningEffort) != null ? _b : isCustomReasoning(reasoning) ? reasoning : void 0;
|
|
684
|
+
const isReasoningModel = (_c = openaiOptions.forceReasoning) != null ? _c : modelCapabilities.isReasoningModel;
|
|
668
685
|
if (topK != null) {
|
|
669
686
|
warnings.push({ type: "unsupported", feature: "topK" });
|
|
670
687
|
}
|
|
671
688
|
const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages(
|
|
672
689
|
{
|
|
673
690
|
prompt,
|
|
674
|
-
systemMessageMode: (
|
|
691
|
+
systemMessageMode: (_d = openaiOptions.systemMessageMode) != null ? _d : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode
|
|
675
692
|
}
|
|
676
693
|
);
|
|
677
694
|
warnings.push(...messageWarnings);
|
|
678
|
-
const strictJsonSchema = (
|
|
695
|
+
const strictJsonSchema = (_e = openaiOptions.strictJsonSchema) != null ? _e : true;
|
|
679
696
|
const baseArgs = {
|
|
680
697
|
// model id:
|
|
681
698
|
model: this.modelId,
|
|
@@ -696,7 +713,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
696
713
|
json_schema: {
|
|
697
714
|
schema: responseFormat.schema,
|
|
698
715
|
strict: strictJsonSchema,
|
|
699
|
-
name: (
|
|
716
|
+
name: (_f = responseFormat.name) != null ? _f : "response",
|
|
700
717
|
description: responseFormat.description
|
|
701
718
|
}
|
|
702
719
|
} : { type: "json_object" } : void 0,
|
|
@@ -709,7 +726,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
709
726
|
store: openaiOptions.store,
|
|
710
727
|
metadata: openaiOptions.metadata,
|
|
711
728
|
prediction: openaiOptions.prediction,
|
|
712
|
-
reasoning_effort:
|
|
729
|
+
reasoning_effort: resolvedReasoningEffort,
|
|
713
730
|
service_tier: openaiOptions.serviceTier,
|
|
714
731
|
prompt_cache_key: openaiOptions.promptCacheKey,
|
|
715
732
|
prompt_cache_retention: openaiOptions.promptCacheRetention,
|
|
@@ -718,7 +735,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
718
735
|
messages
|
|
719
736
|
};
|
|
720
737
|
if (isReasoningModel) {
|
|
721
|
-
if (
|
|
738
|
+
if (resolvedReasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
|
|
722
739
|
if (baseArgs.temperature != null) {
|
|
723
740
|
baseArgs.temperature = void 0;
|
|
724
741
|
warnings.push({
|
|
@@ -1375,7 +1392,7 @@ var openaiLanguageModelCompletionOptions = lazySchema4(
|
|
|
1375
1392
|
// src/completion/openai-completion-language-model.ts
|
|
1376
1393
|
var OpenAICompletionLanguageModel = class {
|
|
1377
1394
|
constructor(modelId, config) {
|
|
1378
|
-
this.specificationVersion = "
|
|
1395
|
+
this.specificationVersion = "v4";
|
|
1379
1396
|
this.supportedUrls = {
|
|
1380
1397
|
// No URLs are supported for completion models.
|
|
1381
1398
|
};
|
|
@@ -1647,7 +1664,7 @@ var openaiTextEmbeddingResponseSchema = lazySchema6(
|
|
|
1647
1664
|
// src/embedding/openai-embedding-model.ts
|
|
1648
1665
|
var OpenAIEmbeddingModel = class {
|
|
1649
1666
|
constructor(modelId, config) {
|
|
1650
|
-
this.specificationVersion = "
|
|
1667
|
+
this.specificationVersion = "v4";
|
|
1651
1668
|
this.maxEmbeddingsPerCall = 2048;
|
|
1652
1669
|
this.supportsParallelCalls = true;
|
|
1653
1670
|
this.modelId = modelId;
|
|
@@ -1776,7 +1793,7 @@ var OpenAIImageModel = class {
|
|
|
1776
1793
|
constructor(modelId, config) {
|
|
1777
1794
|
this.modelId = modelId;
|
|
1778
1795
|
this.config = config;
|
|
1779
|
-
this.specificationVersion = "
|
|
1796
|
+
this.specificationVersion = "v4";
|
|
1780
1797
|
}
|
|
1781
1798
|
get maxImagesPerCall() {
|
|
1782
1799
|
var _a;
|
|
@@ -2104,7 +2121,7 @@ var OpenAITranscriptionModel = class {
|
|
|
2104
2121
|
constructor(modelId, config) {
|
|
2105
2122
|
this.modelId = modelId;
|
|
2106
2123
|
this.config = config;
|
|
2107
|
-
this.specificationVersion = "
|
|
2124
|
+
this.specificationVersion = "v4";
|
|
2108
2125
|
}
|
|
2109
2126
|
get provider() {
|
|
2110
2127
|
return this.config.provider;
|
|
@@ -2232,7 +2249,7 @@ var OpenAISpeechModel = class {
|
|
|
2232
2249
|
constructor(modelId, config) {
|
|
2233
2250
|
this.modelId = modelId;
|
|
2234
2251
|
this.config = config;
|
|
2235
|
-
this.specificationVersion = "
|
|
2252
|
+
this.specificationVersion = "v4";
|
|
2236
2253
|
}
|
|
2237
2254
|
get provider() {
|
|
2238
2255
|
return this.config.provider;
|
|
@@ -2338,6 +2355,7 @@ import {
|
|
|
2338
2355
|
createJsonResponseHandler as createJsonResponseHandler6,
|
|
2339
2356
|
createToolNameMapping,
|
|
2340
2357
|
generateId as generateId2,
|
|
2358
|
+
isCustomReasoning as isCustomReasoning2,
|
|
2341
2359
|
parseProviderOptions as parseProviderOptions7,
|
|
2342
2360
|
postJsonToApi as postJsonToApi6
|
|
2343
2361
|
} from "@ai-sdk/provider-utils";
|
|
@@ -2388,10 +2406,13 @@ import {
|
|
|
2388
2406
|
import {
|
|
2389
2407
|
convertToBase64 as convertToBase642,
|
|
2390
2408
|
isNonNullable,
|
|
2409
|
+
isProviderReference as isProviderReference2,
|
|
2410
|
+
parseJSON,
|
|
2391
2411
|
parseProviderOptions as parseProviderOptions6,
|
|
2412
|
+
resolveProviderReference as resolveProviderReference2,
|
|
2392
2413
|
validateTypes
|
|
2393
2414
|
} from "@ai-sdk/provider-utils";
|
|
2394
|
-
import { z as
|
|
2415
|
+
import { z as z16 } from "zod/v4";
|
|
2395
2416
|
|
|
2396
2417
|
// src/tool/apply-patch.ts
|
|
2397
2418
|
import {
|
|
@@ -2570,6 +2591,43 @@ var shell = createProviderToolFactoryWithOutputSchema3({
|
|
|
2570
2591
|
outputSchema: shellOutputSchema
|
|
2571
2592
|
});
|
|
2572
2593
|
|
|
2594
|
+
// src/tool/tool-search.ts
|
|
2595
|
+
import {
|
|
2596
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
2597
|
+
lazySchema as lazySchema14,
|
|
2598
|
+
zodSchema as zodSchema14
|
|
2599
|
+
} from "@ai-sdk/provider-utils";
|
|
2600
|
+
import { z as z15 } from "zod/v4";
|
|
2601
|
+
var toolSearchArgsSchema = lazySchema14(
|
|
2602
|
+
() => zodSchema14(
|
|
2603
|
+
z15.object({
|
|
2604
|
+
execution: z15.enum(["server", "client"]).optional(),
|
|
2605
|
+
description: z15.string().optional(),
|
|
2606
|
+
parameters: z15.record(z15.string(), z15.unknown()).optional()
|
|
2607
|
+
})
|
|
2608
|
+
)
|
|
2609
|
+
);
|
|
2610
|
+
var toolSearchInputSchema = lazySchema14(
|
|
2611
|
+
() => zodSchema14(
|
|
2612
|
+
z15.object({
|
|
2613
|
+
arguments: z15.unknown().optional(),
|
|
2614
|
+
call_id: z15.string().nullish()
|
|
2615
|
+
})
|
|
2616
|
+
)
|
|
2617
|
+
);
|
|
2618
|
+
var toolSearchOutputSchema = lazySchema14(
|
|
2619
|
+
() => zodSchema14(
|
|
2620
|
+
z15.object({
|
|
2621
|
+
tools: z15.array(z15.record(z15.string(), z15.unknown()))
|
|
2622
|
+
})
|
|
2623
|
+
)
|
|
2624
|
+
);
|
|
2625
|
+
var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
|
|
2626
|
+
id: "openai.tool_search",
|
|
2627
|
+
inputSchema: toolSearchInputSchema,
|
|
2628
|
+
outputSchema: toolSearchOutputSchema
|
|
2629
|
+
});
|
|
2630
|
+
|
|
2573
2631
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2574
2632
|
function isFileId(data, prefixes) {
|
|
2575
2633
|
if (!prefixes) return false;
|
|
@@ -2588,8 +2646,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2588
2646
|
hasApplyPatchTool = false,
|
|
2589
2647
|
customProviderToolNames
|
|
2590
2648
|
}) {
|
|
2591
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2592
|
-
|
|
2649
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
2650
|
+
let input = [];
|
|
2593
2651
|
const warnings = [];
|
|
2594
2652
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2595
2653
|
for (const { role, content } of prompt) {
|
|
@@ -2624,12 +2682,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2624
2682
|
input.push({
|
|
2625
2683
|
role: "user",
|
|
2626
2684
|
content: content.map((part, index) => {
|
|
2627
|
-
var _a2, _b2, _c2;
|
|
2685
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
2628
2686
|
switch (part.type) {
|
|
2629
2687
|
case "text": {
|
|
2630
2688
|
return { type: "input_text", text: part.text };
|
|
2631
2689
|
}
|
|
2632
2690
|
case "file": {
|
|
2691
|
+
if (isProviderReference2(part.data)) {
|
|
2692
|
+
const fileId = resolveProviderReference2({
|
|
2693
|
+
reference: part.data,
|
|
2694
|
+
provider: providerOptionsName
|
|
2695
|
+
});
|
|
2696
|
+
if (part.mediaType.startsWith("image/")) {
|
|
2697
|
+
return {
|
|
2698
|
+
type: "input_image",
|
|
2699
|
+
file_id: fileId,
|
|
2700
|
+
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
|
|
2701
|
+
};
|
|
2702
|
+
}
|
|
2703
|
+
return {
|
|
2704
|
+
type: "input_file",
|
|
2705
|
+
file_id: fileId
|
|
2706
|
+
};
|
|
2707
|
+
}
|
|
2633
2708
|
if (part.mediaType.startsWith("image/")) {
|
|
2634
2709
|
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
2635
2710
|
return {
|
|
@@ -2637,7 +2712,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2637
2712
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2638
2713
|
image_url: `data:${mediaType};base64,${convertToBase642(part.data)}`
|
|
2639
2714
|
},
|
|
2640
|
-
detail: (
|
|
2715
|
+
detail: (_d2 = (_c2 = part.providerOptions) == null ? void 0 : _c2[providerOptionsName]) == null ? void 0 : _d2.imageDetail
|
|
2641
2716
|
};
|
|
2642
2717
|
} else if (part.mediaType === "application/pdf") {
|
|
2643
2718
|
if (part.data instanceof URL) {
|
|
@@ -2649,7 +2724,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2649
2724
|
return {
|
|
2650
2725
|
type: "input_file",
|
|
2651
2726
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2652
|
-
filename: (
|
|
2727
|
+
filename: (_e2 = part.filename) != null ? _e2 : `part-${index}.pdf`,
|
|
2653
2728
|
file_data: `data:application/pdf;base64,${convertToBase642(part.data)}`
|
|
2654
2729
|
}
|
|
2655
2730
|
};
|
|
@@ -2692,6 +2767,32 @@ async function convertToOpenAIResponsesInput({
|
|
|
2692
2767
|
if (hasConversation && id != null) {
|
|
2693
2768
|
break;
|
|
2694
2769
|
}
|
|
2770
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2771
|
+
part.toolName
|
|
2772
|
+
);
|
|
2773
|
+
if (resolvedToolName === "tool_search") {
|
|
2774
|
+
if (store && id != null) {
|
|
2775
|
+
input.push({ type: "item_reference", id });
|
|
2776
|
+
break;
|
|
2777
|
+
}
|
|
2778
|
+
const parsedInput = typeof part.input === "string" ? await parseJSON({
|
|
2779
|
+
text: part.input,
|
|
2780
|
+
schema: toolSearchInputSchema
|
|
2781
|
+
}) : await validateTypes({
|
|
2782
|
+
value: part.input,
|
|
2783
|
+
schema: toolSearchInputSchema
|
|
2784
|
+
});
|
|
2785
|
+
const execution = parsedInput.call_id != null ? "client" : "server";
|
|
2786
|
+
input.push({
|
|
2787
|
+
type: "tool_search_call",
|
|
2788
|
+
id: id != null ? id : part.toolCallId,
|
|
2789
|
+
execution,
|
|
2790
|
+
call_id: (_g = parsedInput.call_id) != null ? _g : null,
|
|
2791
|
+
status: "completed",
|
|
2792
|
+
arguments: parsedInput.arguments
|
|
2793
|
+
});
|
|
2794
|
+
break;
|
|
2795
|
+
}
|
|
2695
2796
|
if (part.providerExecuted) {
|
|
2696
2797
|
if (store && id != null) {
|
|
2697
2798
|
input.push({ type: "item_reference", id });
|
|
@@ -2702,9 +2803,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2702
2803
|
input.push({ type: "item_reference", id });
|
|
2703
2804
|
break;
|
|
2704
2805
|
}
|
|
2705
|
-
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2706
|
-
part.toolName
|
|
2707
|
-
);
|
|
2708
2806
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2709
2807
|
const parsedInput = await validateTypes({
|
|
2710
2808
|
value: part.input,
|
|
@@ -2787,6 +2885,26 @@ async function convertToOpenAIResponsesInput({
|
|
|
2787
2885
|
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
2788
2886
|
part.toolName
|
|
2789
2887
|
);
|
|
2888
|
+
if (resolvedResultToolName === "tool_search") {
|
|
2889
|
+
const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2890
|
+
if (store) {
|
|
2891
|
+
input.push({ type: "item_reference", id: itemId });
|
|
2892
|
+
} else if (part.output.type === "json") {
|
|
2893
|
+
const parsedOutput = await validateTypes({
|
|
2894
|
+
value: part.output.value,
|
|
2895
|
+
schema: toolSearchOutputSchema
|
|
2896
|
+
});
|
|
2897
|
+
input.push({
|
|
2898
|
+
type: "tool_search_output",
|
|
2899
|
+
id: itemId,
|
|
2900
|
+
execution: "server",
|
|
2901
|
+
call_id: null,
|
|
2902
|
+
status: "completed",
|
|
2903
|
+
tools: parsedOutput.tools
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2906
|
+
break;
|
|
2907
|
+
}
|
|
2790
2908
|
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2791
2909
|
if (part.output.type === "json") {
|
|
2792
2910
|
const parsedOutput = await validateTypes({
|
|
@@ -2809,7 +2927,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2809
2927
|
break;
|
|
2810
2928
|
}
|
|
2811
2929
|
if (store) {
|
|
2812
|
-
const itemId = (
|
|
2930
|
+
const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
|
|
2813
2931
|
input.push({ type: "item_reference", id: itemId });
|
|
2814
2932
|
} else {
|
|
2815
2933
|
warnings.push({
|
|
@@ -2892,6 +3010,28 @@ async function convertToOpenAIResponsesInput({
|
|
|
2892
3010
|
}
|
|
2893
3011
|
break;
|
|
2894
3012
|
}
|
|
3013
|
+
case "custom": {
|
|
3014
|
+
if (part.kind === "openai.compaction") {
|
|
3015
|
+
const providerOpts = (_n = part.providerOptions) == null ? void 0 : _n[providerOptionsName];
|
|
3016
|
+
const id = providerOpts == null ? void 0 : providerOpts.itemId;
|
|
3017
|
+
if (hasConversation && id != null) {
|
|
3018
|
+
break;
|
|
3019
|
+
}
|
|
3020
|
+
if (store && id != null) {
|
|
3021
|
+
input.push({ type: "item_reference", id });
|
|
3022
|
+
break;
|
|
3023
|
+
}
|
|
3024
|
+
const encryptedContent = providerOpts == null ? void 0 : providerOpts.encryptedContent;
|
|
3025
|
+
if (id != null) {
|
|
3026
|
+
input.push({
|
|
3027
|
+
type: "compaction",
|
|
3028
|
+
id,
|
|
3029
|
+
encrypted_content: encryptedContent
|
|
3030
|
+
});
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
break;
|
|
3034
|
+
}
|
|
2895
3035
|
}
|
|
2896
3036
|
}
|
|
2897
3037
|
break;
|
|
@@ -2919,7 +3059,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2919
3059
|
}
|
|
2920
3060
|
const output = part.output;
|
|
2921
3061
|
if (output.type === "execution-denied") {
|
|
2922
|
-
const approvalId = (
|
|
3062
|
+
const approvalId = (_p = (_o = output.providerOptions) == null ? void 0 : _o.openai) == null ? void 0 : _p.approvalId;
|
|
2923
3063
|
if (approvalId) {
|
|
2924
3064
|
continue;
|
|
2925
3065
|
}
|
|
@@ -2927,6 +3067,20 @@ async function convertToOpenAIResponsesInput({
|
|
|
2927
3067
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2928
3068
|
part.toolName
|
|
2929
3069
|
);
|
|
3070
|
+
if (resolvedToolName === "tool_search" && output.type === "json") {
|
|
3071
|
+
const parsedOutput = await validateTypes({
|
|
3072
|
+
value: output.value,
|
|
3073
|
+
schema: toolSearchOutputSchema
|
|
3074
|
+
});
|
|
3075
|
+
input.push({
|
|
3076
|
+
type: "tool_search_output",
|
|
3077
|
+
execution: "client",
|
|
3078
|
+
call_id: part.toolCallId,
|
|
3079
|
+
status: "completed",
|
|
3080
|
+
tools: parsedOutput.tools
|
|
3081
|
+
});
|
|
3082
|
+
continue;
|
|
3083
|
+
}
|
|
2930
3084
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2931
3085
|
const parsedOutput = await validateTypes({
|
|
2932
3086
|
value: output.value,
|
|
@@ -2979,7 +3133,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2979
3133
|
outputValue = output.value;
|
|
2980
3134
|
break;
|
|
2981
3135
|
case "execution-denied":
|
|
2982
|
-
outputValue = (
|
|
3136
|
+
outputValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
|
|
2983
3137
|
break;
|
|
2984
3138
|
case "json":
|
|
2985
3139
|
case "error-json":
|
|
@@ -3007,6 +3161,11 @@ async function convertToOpenAIResponsesInput({
|
|
|
3007
3161
|
filename: (_a2 = item.filename) != null ? _a2 : "data",
|
|
3008
3162
|
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3009
3163
|
};
|
|
3164
|
+
case "file-url":
|
|
3165
|
+
return {
|
|
3166
|
+
type: "input_file",
|
|
3167
|
+
file_url: item.url
|
|
3168
|
+
};
|
|
3010
3169
|
default:
|
|
3011
3170
|
warnings.push({
|
|
3012
3171
|
type: "other",
|
|
@@ -3033,7 +3192,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3033
3192
|
contentValue = output.value;
|
|
3034
3193
|
break;
|
|
3035
3194
|
case "execution-denied":
|
|
3036
|
-
contentValue = (
|
|
3195
|
+
contentValue = (_r = output.reason) != null ? _r : "Tool execution denied.";
|
|
3037
3196
|
break;
|
|
3038
3197
|
case "json":
|
|
3039
3198
|
case "error-json":
|
|
@@ -3065,6 +3224,12 @@ async function convertToOpenAIResponsesInput({
|
|
|
3065
3224
|
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3066
3225
|
};
|
|
3067
3226
|
}
|
|
3227
|
+
case "file-url": {
|
|
3228
|
+
return {
|
|
3229
|
+
type: "input_file",
|
|
3230
|
+
file_url: item.url
|
|
3231
|
+
};
|
|
3232
|
+
}
|
|
3068
3233
|
default: {
|
|
3069
3234
|
warnings.push({
|
|
3070
3235
|
type: "other",
|
|
@@ -3090,11 +3255,22 @@ async function convertToOpenAIResponsesInput({
|
|
|
3090
3255
|
}
|
|
3091
3256
|
}
|
|
3092
3257
|
}
|
|
3258
|
+
if (!store && input.some(
|
|
3259
|
+
(item) => "type" in item && item.type === "reasoning" && item.encrypted_content == null
|
|
3260
|
+
)) {
|
|
3261
|
+
warnings.push({
|
|
3262
|
+
type: "other",
|
|
3263
|
+
message: "Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts."
|
|
3264
|
+
});
|
|
3265
|
+
input = input.filter(
|
|
3266
|
+
(item) => !("type" in item) || item.type !== "reasoning" || item.encrypted_content != null
|
|
3267
|
+
);
|
|
3268
|
+
}
|
|
3093
3269
|
return { input, warnings };
|
|
3094
3270
|
}
|
|
3095
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3096
|
-
itemId:
|
|
3097
|
-
reasoningEncryptedContent:
|
|
3271
|
+
var openaiResponsesReasoningProviderOptionsSchema = z16.object({
|
|
3272
|
+
itemId: z16.string().nullish(),
|
|
3273
|
+
reasoningEncryptedContent: z16.string().nullish()
|
|
3098
3274
|
});
|
|
3099
3275
|
|
|
3100
3276
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3116,483 +3292,552 @@ function mapOpenAIResponseFinishReason({
|
|
|
3116
3292
|
}
|
|
3117
3293
|
|
|
3118
3294
|
// src/responses/openai-responses-api.ts
|
|
3119
|
-
import { lazySchema as
|
|
3120
|
-
import { z as
|
|
3121
|
-
var
|
|
3122
|
-
() =>
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3295
|
+
import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
|
|
3296
|
+
import { z as z17 } from "zod/v4";
|
|
3297
|
+
var jsonValueSchema = z17.lazy(
|
|
3298
|
+
() => z17.union([
|
|
3299
|
+
z17.string(),
|
|
3300
|
+
z17.number(),
|
|
3301
|
+
z17.boolean(),
|
|
3302
|
+
z17.null(),
|
|
3303
|
+
z17.array(jsonValueSchema),
|
|
3304
|
+
z17.record(z17.string(), jsonValueSchema.optional())
|
|
3305
|
+
])
|
|
3306
|
+
);
|
|
3307
|
+
var openaiResponsesChunkSchema = lazySchema15(
|
|
3308
|
+
() => zodSchema15(
|
|
3309
|
+
z17.union([
|
|
3310
|
+
z17.object({
|
|
3311
|
+
type: z17.literal("response.output_text.delta"),
|
|
3312
|
+
item_id: z17.string(),
|
|
3313
|
+
delta: z17.string(),
|
|
3314
|
+
logprobs: z17.array(
|
|
3315
|
+
z17.object({
|
|
3316
|
+
token: z17.string(),
|
|
3317
|
+
logprob: z17.number(),
|
|
3318
|
+
top_logprobs: z17.array(
|
|
3319
|
+
z17.object({
|
|
3320
|
+
token: z17.string(),
|
|
3321
|
+
logprob: z17.number()
|
|
3136
3322
|
})
|
|
3137
3323
|
)
|
|
3138
3324
|
})
|
|
3139
3325
|
).nullish()
|
|
3140
3326
|
}),
|
|
3141
|
-
|
|
3142
|
-
type:
|
|
3143
|
-
response:
|
|
3144
|
-
incomplete_details:
|
|
3145
|
-
usage:
|
|
3146
|
-
input_tokens:
|
|
3147
|
-
input_tokens_details:
|
|
3148
|
-
output_tokens:
|
|
3149
|
-
output_tokens_details:
|
|
3327
|
+
z17.object({
|
|
3328
|
+
type: z17.enum(["response.completed", "response.incomplete"]),
|
|
3329
|
+
response: z17.object({
|
|
3330
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3331
|
+
usage: z17.object({
|
|
3332
|
+
input_tokens: z17.number(),
|
|
3333
|
+
input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
|
|
3334
|
+
output_tokens: z17.number(),
|
|
3335
|
+
output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
|
|
3150
3336
|
}),
|
|
3151
|
-
service_tier:
|
|
3337
|
+
service_tier: z17.string().nullish()
|
|
3338
|
+
})
|
|
3339
|
+
}),
|
|
3340
|
+
z17.object({
|
|
3341
|
+
type: z17.literal("response.failed"),
|
|
3342
|
+
response: z17.object({
|
|
3343
|
+
error: z17.object({
|
|
3344
|
+
code: z17.string().nullish(),
|
|
3345
|
+
message: z17.string()
|
|
3346
|
+
}).nullish(),
|
|
3347
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3348
|
+
usage: z17.object({
|
|
3349
|
+
input_tokens: z17.number(),
|
|
3350
|
+
input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
|
|
3351
|
+
output_tokens: z17.number(),
|
|
3352
|
+
output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
|
|
3353
|
+
}).nullish(),
|
|
3354
|
+
service_tier: z17.string().nullish()
|
|
3152
3355
|
})
|
|
3153
3356
|
}),
|
|
3154
|
-
|
|
3155
|
-
type:
|
|
3156
|
-
response:
|
|
3157
|
-
id:
|
|
3158
|
-
created_at:
|
|
3159
|
-
model:
|
|
3160
|
-
service_tier:
|
|
3357
|
+
z17.object({
|
|
3358
|
+
type: z17.literal("response.created"),
|
|
3359
|
+
response: z17.object({
|
|
3360
|
+
id: z17.string(),
|
|
3361
|
+
created_at: z17.number(),
|
|
3362
|
+
model: z17.string(),
|
|
3363
|
+
service_tier: z17.string().nullish()
|
|
3161
3364
|
})
|
|
3162
3365
|
}),
|
|
3163
|
-
|
|
3164
|
-
type:
|
|
3165
|
-
output_index:
|
|
3166
|
-
item:
|
|
3167
|
-
|
|
3168
|
-
type:
|
|
3169
|
-
id:
|
|
3170
|
-
phase:
|
|
3366
|
+
z17.object({
|
|
3367
|
+
type: z17.literal("response.output_item.added"),
|
|
3368
|
+
output_index: z17.number(),
|
|
3369
|
+
item: z17.discriminatedUnion("type", [
|
|
3370
|
+
z17.object({
|
|
3371
|
+
type: z17.literal("message"),
|
|
3372
|
+
id: z17.string(),
|
|
3373
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish()
|
|
3171
3374
|
}),
|
|
3172
|
-
|
|
3173
|
-
type:
|
|
3174
|
-
id:
|
|
3175
|
-
encrypted_content:
|
|
3375
|
+
z17.object({
|
|
3376
|
+
type: z17.literal("reasoning"),
|
|
3377
|
+
id: z17.string(),
|
|
3378
|
+
encrypted_content: z17.string().nullish()
|
|
3176
3379
|
}),
|
|
3177
|
-
|
|
3178
|
-
type:
|
|
3179
|
-
id:
|
|
3180
|
-
call_id:
|
|
3181
|
-
name:
|
|
3182
|
-
arguments:
|
|
3380
|
+
z17.object({
|
|
3381
|
+
type: z17.literal("function_call"),
|
|
3382
|
+
id: z17.string(),
|
|
3383
|
+
call_id: z17.string(),
|
|
3384
|
+
name: z17.string(),
|
|
3385
|
+
arguments: z17.string()
|
|
3183
3386
|
}),
|
|
3184
|
-
|
|
3185
|
-
type:
|
|
3186
|
-
id:
|
|
3187
|
-
status:
|
|
3387
|
+
z17.object({
|
|
3388
|
+
type: z17.literal("web_search_call"),
|
|
3389
|
+
id: z17.string(),
|
|
3390
|
+
status: z17.string()
|
|
3188
3391
|
}),
|
|
3189
|
-
|
|
3190
|
-
type:
|
|
3191
|
-
id:
|
|
3192
|
-
status:
|
|
3392
|
+
z17.object({
|
|
3393
|
+
type: z17.literal("computer_call"),
|
|
3394
|
+
id: z17.string(),
|
|
3395
|
+
status: z17.string()
|
|
3193
3396
|
}),
|
|
3194
|
-
|
|
3195
|
-
type:
|
|
3196
|
-
id:
|
|
3397
|
+
z17.object({
|
|
3398
|
+
type: z17.literal("file_search_call"),
|
|
3399
|
+
id: z17.string()
|
|
3197
3400
|
}),
|
|
3198
|
-
|
|
3199
|
-
type:
|
|
3200
|
-
id:
|
|
3401
|
+
z17.object({
|
|
3402
|
+
type: z17.literal("image_generation_call"),
|
|
3403
|
+
id: z17.string()
|
|
3201
3404
|
}),
|
|
3202
|
-
|
|
3203
|
-
type:
|
|
3204
|
-
id:
|
|
3205
|
-
container_id:
|
|
3206
|
-
code:
|
|
3207
|
-
outputs:
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3405
|
+
z17.object({
|
|
3406
|
+
type: z17.literal("code_interpreter_call"),
|
|
3407
|
+
id: z17.string(),
|
|
3408
|
+
container_id: z17.string(),
|
|
3409
|
+
code: z17.string().nullable(),
|
|
3410
|
+
outputs: z17.array(
|
|
3411
|
+
z17.discriminatedUnion("type", [
|
|
3412
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3413
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3211
3414
|
])
|
|
3212
3415
|
).nullable(),
|
|
3213
|
-
status:
|
|
3416
|
+
status: z17.string()
|
|
3214
3417
|
}),
|
|
3215
|
-
|
|
3216
|
-
type:
|
|
3217
|
-
id:
|
|
3218
|
-
status:
|
|
3219
|
-
approval_request_id:
|
|
3418
|
+
z17.object({
|
|
3419
|
+
type: z17.literal("mcp_call"),
|
|
3420
|
+
id: z17.string(),
|
|
3421
|
+
status: z17.string(),
|
|
3422
|
+
approval_request_id: z17.string().nullish()
|
|
3220
3423
|
}),
|
|
3221
|
-
|
|
3222
|
-
type:
|
|
3223
|
-
id:
|
|
3424
|
+
z17.object({
|
|
3425
|
+
type: z17.literal("mcp_list_tools"),
|
|
3426
|
+
id: z17.string()
|
|
3224
3427
|
}),
|
|
3225
|
-
|
|
3226
|
-
type:
|
|
3227
|
-
id:
|
|
3428
|
+
z17.object({
|
|
3429
|
+
type: z17.literal("mcp_approval_request"),
|
|
3430
|
+
id: z17.string()
|
|
3228
3431
|
}),
|
|
3229
|
-
|
|
3230
|
-
type:
|
|
3231
|
-
id:
|
|
3232
|
-
call_id:
|
|
3233
|
-
status:
|
|
3234
|
-
operation:
|
|
3235
|
-
|
|
3236
|
-
type:
|
|
3237
|
-
path:
|
|
3238
|
-
diff:
|
|
3432
|
+
z17.object({
|
|
3433
|
+
type: z17.literal("apply_patch_call"),
|
|
3434
|
+
id: z17.string(),
|
|
3435
|
+
call_id: z17.string(),
|
|
3436
|
+
status: z17.enum(["in_progress", "completed"]),
|
|
3437
|
+
operation: z17.discriminatedUnion("type", [
|
|
3438
|
+
z17.object({
|
|
3439
|
+
type: z17.literal("create_file"),
|
|
3440
|
+
path: z17.string(),
|
|
3441
|
+
diff: z17.string()
|
|
3239
3442
|
}),
|
|
3240
|
-
|
|
3241
|
-
type:
|
|
3242
|
-
path:
|
|
3443
|
+
z17.object({
|
|
3444
|
+
type: z17.literal("delete_file"),
|
|
3445
|
+
path: z17.string()
|
|
3243
3446
|
}),
|
|
3244
|
-
|
|
3245
|
-
type:
|
|
3246
|
-
path:
|
|
3247
|
-
diff:
|
|
3447
|
+
z17.object({
|
|
3448
|
+
type: z17.literal("update_file"),
|
|
3449
|
+
path: z17.string(),
|
|
3450
|
+
diff: z17.string()
|
|
3248
3451
|
})
|
|
3249
3452
|
])
|
|
3250
3453
|
}),
|
|
3251
|
-
|
|
3252
|
-
type:
|
|
3253
|
-
id:
|
|
3254
|
-
call_id:
|
|
3255
|
-
name:
|
|
3256
|
-
input:
|
|
3454
|
+
z17.object({
|
|
3455
|
+
type: z17.literal("custom_tool_call"),
|
|
3456
|
+
id: z17.string(),
|
|
3457
|
+
call_id: z17.string(),
|
|
3458
|
+
name: z17.string(),
|
|
3459
|
+
input: z17.string()
|
|
3257
3460
|
}),
|
|
3258
|
-
|
|
3259
|
-
type:
|
|
3260
|
-
id:
|
|
3261
|
-
call_id:
|
|
3262
|
-
status:
|
|
3263
|
-
action:
|
|
3264
|
-
commands:
|
|
3461
|
+
z17.object({
|
|
3462
|
+
type: z17.literal("shell_call"),
|
|
3463
|
+
id: z17.string(),
|
|
3464
|
+
call_id: z17.string(),
|
|
3465
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3466
|
+
action: z17.object({
|
|
3467
|
+
commands: z17.array(z17.string())
|
|
3265
3468
|
})
|
|
3266
3469
|
}),
|
|
3267
|
-
|
|
3268
|
-
type:
|
|
3269
|
-
id:
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3470
|
+
z17.object({
|
|
3471
|
+
type: z17.literal("compaction"),
|
|
3472
|
+
id: z17.string(),
|
|
3473
|
+
encrypted_content: z17.string().nullish()
|
|
3474
|
+
}),
|
|
3475
|
+
z17.object({
|
|
3476
|
+
type: z17.literal("shell_call_output"),
|
|
3477
|
+
id: z17.string(),
|
|
3478
|
+
call_id: z17.string(),
|
|
3479
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3480
|
+
output: z17.array(
|
|
3481
|
+
z17.object({
|
|
3482
|
+
stdout: z17.string(),
|
|
3483
|
+
stderr: z17.string(),
|
|
3484
|
+
outcome: z17.discriminatedUnion("type", [
|
|
3485
|
+
z17.object({ type: z17.literal("timeout") }),
|
|
3486
|
+
z17.object({
|
|
3487
|
+
type: z17.literal("exit"),
|
|
3488
|
+
exit_code: z17.number()
|
|
3281
3489
|
})
|
|
3282
3490
|
])
|
|
3283
3491
|
})
|
|
3284
3492
|
)
|
|
3493
|
+
}),
|
|
3494
|
+
z17.object({
|
|
3495
|
+
type: z17.literal("tool_search_call"),
|
|
3496
|
+
id: z17.string(),
|
|
3497
|
+
execution: z17.enum(["server", "client"]),
|
|
3498
|
+
call_id: z17.string().nullable(),
|
|
3499
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3500
|
+
arguments: z17.unknown()
|
|
3501
|
+
}),
|
|
3502
|
+
z17.object({
|
|
3503
|
+
type: z17.literal("tool_search_output"),
|
|
3504
|
+
id: z17.string(),
|
|
3505
|
+
execution: z17.enum(["server", "client"]),
|
|
3506
|
+
call_id: z17.string().nullable(),
|
|
3507
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3508
|
+
tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
|
|
3285
3509
|
})
|
|
3286
3510
|
])
|
|
3287
3511
|
}),
|
|
3288
|
-
|
|
3289
|
-
type:
|
|
3290
|
-
output_index:
|
|
3291
|
-
item:
|
|
3292
|
-
|
|
3293
|
-
type:
|
|
3294
|
-
id:
|
|
3295
|
-
phase:
|
|
3512
|
+
z17.object({
|
|
3513
|
+
type: z17.literal("response.output_item.done"),
|
|
3514
|
+
output_index: z17.number(),
|
|
3515
|
+
item: z17.discriminatedUnion("type", [
|
|
3516
|
+
z17.object({
|
|
3517
|
+
type: z17.literal("message"),
|
|
3518
|
+
id: z17.string(),
|
|
3519
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish()
|
|
3296
3520
|
}),
|
|
3297
|
-
|
|
3298
|
-
type:
|
|
3299
|
-
id:
|
|
3300
|
-
encrypted_content:
|
|
3521
|
+
z17.object({
|
|
3522
|
+
type: z17.literal("reasoning"),
|
|
3523
|
+
id: z17.string(),
|
|
3524
|
+
encrypted_content: z17.string().nullish()
|
|
3301
3525
|
}),
|
|
3302
|
-
|
|
3303
|
-
type:
|
|
3304
|
-
id:
|
|
3305
|
-
call_id:
|
|
3306
|
-
name:
|
|
3307
|
-
arguments:
|
|
3308
|
-
status:
|
|
3526
|
+
z17.object({
|
|
3527
|
+
type: z17.literal("function_call"),
|
|
3528
|
+
id: z17.string(),
|
|
3529
|
+
call_id: z17.string(),
|
|
3530
|
+
name: z17.string(),
|
|
3531
|
+
arguments: z17.string(),
|
|
3532
|
+
status: z17.literal("completed")
|
|
3309
3533
|
}),
|
|
3310
|
-
|
|
3311
|
-
type:
|
|
3312
|
-
id:
|
|
3313
|
-
call_id:
|
|
3314
|
-
name:
|
|
3315
|
-
input:
|
|
3316
|
-
status:
|
|
3534
|
+
z17.object({
|
|
3535
|
+
type: z17.literal("custom_tool_call"),
|
|
3536
|
+
id: z17.string(),
|
|
3537
|
+
call_id: z17.string(),
|
|
3538
|
+
name: z17.string(),
|
|
3539
|
+
input: z17.string(),
|
|
3540
|
+
status: z17.literal("completed")
|
|
3317
3541
|
}),
|
|
3318
|
-
|
|
3319
|
-
type:
|
|
3320
|
-
id:
|
|
3321
|
-
code:
|
|
3322
|
-
container_id:
|
|
3323
|
-
outputs:
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3542
|
+
z17.object({
|
|
3543
|
+
type: z17.literal("code_interpreter_call"),
|
|
3544
|
+
id: z17.string(),
|
|
3545
|
+
code: z17.string().nullable(),
|
|
3546
|
+
container_id: z17.string(),
|
|
3547
|
+
outputs: z17.array(
|
|
3548
|
+
z17.discriminatedUnion("type", [
|
|
3549
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3550
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3327
3551
|
])
|
|
3328
3552
|
).nullable()
|
|
3329
3553
|
}),
|
|
3330
|
-
|
|
3331
|
-
type:
|
|
3332
|
-
id:
|
|
3333
|
-
result:
|
|
3554
|
+
z17.object({
|
|
3555
|
+
type: z17.literal("image_generation_call"),
|
|
3556
|
+
id: z17.string(),
|
|
3557
|
+
result: z17.string()
|
|
3334
3558
|
}),
|
|
3335
|
-
|
|
3336
|
-
type:
|
|
3337
|
-
id:
|
|
3338
|
-
status:
|
|
3339
|
-
action:
|
|
3340
|
-
|
|
3341
|
-
type:
|
|
3342
|
-
query:
|
|
3343
|
-
sources:
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3559
|
+
z17.object({
|
|
3560
|
+
type: z17.literal("web_search_call"),
|
|
3561
|
+
id: z17.string(),
|
|
3562
|
+
status: z17.string(),
|
|
3563
|
+
action: z17.discriminatedUnion("type", [
|
|
3564
|
+
z17.object({
|
|
3565
|
+
type: z17.literal("search"),
|
|
3566
|
+
query: z17.string().nullish(),
|
|
3567
|
+
sources: z17.array(
|
|
3568
|
+
z17.discriminatedUnion("type", [
|
|
3569
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
3570
|
+
z17.object({ type: z17.literal("api"), name: z17.string() })
|
|
3347
3571
|
])
|
|
3348
3572
|
).nullish()
|
|
3349
3573
|
}),
|
|
3350
|
-
|
|
3351
|
-
type:
|
|
3352
|
-
url:
|
|
3574
|
+
z17.object({
|
|
3575
|
+
type: z17.literal("open_page"),
|
|
3576
|
+
url: z17.string().nullish()
|
|
3353
3577
|
}),
|
|
3354
|
-
|
|
3355
|
-
type:
|
|
3356
|
-
url:
|
|
3357
|
-
pattern:
|
|
3578
|
+
z17.object({
|
|
3579
|
+
type: z17.literal("find_in_page"),
|
|
3580
|
+
url: z17.string().nullish(),
|
|
3581
|
+
pattern: z17.string().nullish()
|
|
3358
3582
|
})
|
|
3359
3583
|
]).nullish()
|
|
3360
3584
|
}),
|
|
3361
|
-
|
|
3362
|
-
type:
|
|
3363
|
-
id:
|
|
3364
|
-
queries:
|
|
3365
|
-
results:
|
|
3366
|
-
|
|
3367
|
-
attributes:
|
|
3368
|
-
|
|
3369
|
-
|
|
3585
|
+
z17.object({
|
|
3586
|
+
type: z17.literal("file_search_call"),
|
|
3587
|
+
id: z17.string(),
|
|
3588
|
+
queries: z17.array(z17.string()),
|
|
3589
|
+
results: z17.array(
|
|
3590
|
+
z17.object({
|
|
3591
|
+
attributes: z17.record(
|
|
3592
|
+
z17.string(),
|
|
3593
|
+
z17.union([z17.string(), z17.number(), z17.boolean()])
|
|
3370
3594
|
),
|
|
3371
|
-
file_id:
|
|
3372
|
-
filename:
|
|
3373
|
-
score:
|
|
3374
|
-
text:
|
|
3595
|
+
file_id: z17.string(),
|
|
3596
|
+
filename: z17.string(),
|
|
3597
|
+
score: z17.number(),
|
|
3598
|
+
text: z17.string()
|
|
3375
3599
|
})
|
|
3376
3600
|
).nullish()
|
|
3377
3601
|
}),
|
|
3378
|
-
|
|
3379
|
-
type:
|
|
3380
|
-
id:
|
|
3381
|
-
call_id:
|
|
3382
|
-
action:
|
|
3383
|
-
type:
|
|
3384
|
-
command:
|
|
3385
|
-
timeout_ms:
|
|
3386
|
-
user:
|
|
3387
|
-
working_directory:
|
|
3388
|
-
env:
|
|
3602
|
+
z17.object({
|
|
3603
|
+
type: z17.literal("local_shell_call"),
|
|
3604
|
+
id: z17.string(),
|
|
3605
|
+
call_id: z17.string(),
|
|
3606
|
+
action: z17.object({
|
|
3607
|
+
type: z17.literal("exec"),
|
|
3608
|
+
command: z17.array(z17.string()),
|
|
3609
|
+
timeout_ms: z17.number().optional(),
|
|
3610
|
+
user: z17.string().optional(),
|
|
3611
|
+
working_directory: z17.string().optional(),
|
|
3612
|
+
env: z17.record(z17.string(), z17.string()).optional()
|
|
3389
3613
|
})
|
|
3390
3614
|
}),
|
|
3391
|
-
|
|
3392
|
-
type:
|
|
3393
|
-
id:
|
|
3394
|
-
status:
|
|
3615
|
+
z17.object({
|
|
3616
|
+
type: z17.literal("computer_call"),
|
|
3617
|
+
id: z17.string(),
|
|
3618
|
+
status: z17.literal("completed")
|
|
3395
3619
|
}),
|
|
3396
|
-
|
|
3397
|
-
type:
|
|
3398
|
-
id:
|
|
3399
|
-
status:
|
|
3400
|
-
arguments:
|
|
3401
|
-
name:
|
|
3402
|
-
server_label:
|
|
3403
|
-
output:
|
|
3404
|
-
error:
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
type:
|
|
3408
|
-
code:
|
|
3409
|
-
message:
|
|
3620
|
+
z17.object({
|
|
3621
|
+
type: z17.literal("mcp_call"),
|
|
3622
|
+
id: z17.string(),
|
|
3623
|
+
status: z17.string(),
|
|
3624
|
+
arguments: z17.string(),
|
|
3625
|
+
name: z17.string(),
|
|
3626
|
+
server_label: z17.string(),
|
|
3627
|
+
output: z17.string().nullish(),
|
|
3628
|
+
error: z17.union([
|
|
3629
|
+
z17.string(),
|
|
3630
|
+
z17.object({
|
|
3631
|
+
type: z17.string().optional(),
|
|
3632
|
+
code: z17.union([z17.number(), z17.string()]).optional(),
|
|
3633
|
+
message: z17.string().optional()
|
|
3410
3634
|
}).loose()
|
|
3411
3635
|
]).nullish(),
|
|
3412
|
-
approval_request_id:
|
|
3636
|
+
approval_request_id: z17.string().nullish()
|
|
3413
3637
|
}),
|
|
3414
|
-
|
|
3415
|
-
type:
|
|
3416
|
-
id:
|
|
3417
|
-
server_label:
|
|
3418
|
-
tools:
|
|
3419
|
-
|
|
3420
|
-
name:
|
|
3421
|
-
description:
|
|
3422
|
-
input_schema:
|
|
3423
|
-
annotations:
|
|
3638
|
+
z17.object({
|
|
3639
|
+
type: z17.literal("mcp_list_tools"),
|
|
3640
|
+
id: z17.string(),
|
|
3641
|
+
server_label: z17.string(),
|
|
3642
|
+
tools: z17.array(
|
|
3643
|
+
z17.object({
|
|
3644
|
+
name: z17.string(),
|
|
3645
|
+
description: z17.string().optional(),
|
|
3646
|
+
input_schema: z17.any(),
|
|
3647
|
+
annotations: z17.record(z17.string(), z17.unknown()).optional()
|
|
3424
3648
|
})
|
|
3425
3649
|
),
|
|
3426
|
-
error:
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
type:
|
|
3430
|
-
code:
|
|
3431
|
-
message:
|
|
3650
|
+
error: z17.union([
|
|
3651
|
+
z17.string(),
|
|
3652
|
+
z17.object({
|
|
3653
|
+
type: z17.string().optional(),
|
|
3654
|
+
code: z17.union([z17.number(), z17.string()]).optional(),
|
|
3655
|
+
message: z17.string().optional()
|
|
3432
3656
|
}).loose()
|
|
3433
3657
|
]).optional()
|
|
3434
3658
|
}),
|
|
3435
|
-
|
|
3436
|
-
type:
|
|
3437
|
-
id:
|
|
3438
|
-
server_label:
|
|
3439
|
-
name:
|
|
3440
|
-
arguments:
|
|
3441
|
-
approval_request_id:
|
|
3659
|
+
z17.object({
|
|
3660
|
+
type: z17.literal("mcp_approval_request"),
|
|
3661
|
+
id: z17.string(),
|
|
3662
|
+
server_label: z17.string(),
|
|
3663
|
+
name: z17.string(),
|
|
3664
|
+
arguments: z17.string(),
|
|
3665
|
+
approval_request_id: z17.string().optional()
|
|
3442
3666
|
}),
|
|
3443
|
-
|
|
3444
|
-
type:
|
|
3445
|
-
id:
|
|
3446
|
-
call_id:
|
|
3447
|
-
status:
|
|
3448
|
-
operation:
|
|
3449
|
-
|
|
3450
|
-
type:
|
|
3451
|
-
path:
|
|
3452
|
-
diff:
|
|
3667
|
+
z17.object({
|
|
3668
|
+
type: z17.literal("apply_patch_call"),
|
|
3669
|
+
id: z17.string(),
|
|
3670
|
+
call_id: z17.string(),
|
|
3671
|
+
status: z17.enum(["in_progress", "completed"]),
|
|
3672
|
+
operation: z17.discriminatedUnion("type", [
|
|
3673
|
+
z17.object({
|
|
3674
|
+
type: z17.literal("create_file"),
|
|
3675
|
+
path: z17.string(),
|
|
3676
|
+
diff: z17.string()
|
|
3453
3677
|
}),
|
|
3454
|
-
|
|
3455
|
-
type:
|
|
3456
|
-
path:
|
|
3678
|
+
z17.object({
|
|
3679
|
+
type: z17.literal("delete_file"),
|
|
3680
|
+
path: z17.string()
|
|
3457
3681
|
}),
|
|
3458
|
-
|
|
3459
|
-
type:
|
|
3460
|
-
path:
|
|
3461
|
-
diff:
|
|
3682
|
+
z17.object({
|
|
3683
|
+
type: z17.literal("update_file"),
|
|
3684
|
+
path: z17.string(),
|
|
3685
|
+
diff: z17.string()
|
|
3462
3686
|
})
|
|
3463
3687
|
])
|
|
3464
3688
|
}),
|
|
3465
|
-
|
|
3466
|
-
type:
|
|
3467
|
-
id:
|
|
3468
|
-
call_id:
|
|
3469
|
-
status:
|
|
3470
|
-
action:
|
|
3471
|
-
commands:
|
|
3689
|
+
z17.object({
|
|
3690
|
+
type: z17.literal("shell_call"),
|
|
3691
|
+
id: z17.string(),
|
|
3692
|
+
call_id: z17.string(),
|
|
3693
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3694
|
+
action: z17.object({
|
|
3695
|
+
commands: z17.array(z17.string())
|
|
3472
3696
|
})
|
|
3473
3697
|
}),
|
|
3474
|
-
|
|
3475
|
-
type:
|
|
3476
|
-
id:
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3698
|
+
z17.object({
|
|
3699
|
+
type: z17.literal("compaction"),
|
|
3700
|
+
id: z17.string(),
|
|
3701
|
+
encrypted_content: z17.string()
|
|
3702
|
+
}),
|
|
3703
|
+
z17.object({
|
|
3704
|
+
type: z17.literal("shell_call_output"),
|
|
3705
|
+
id: z17.string(),
|
|
3706
|
+
call_id: z17.string(),
|
|
3707
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3708
|
+
output: z17.array(
|
|
3709
|
+
z17.object({
|
|
3710
|
+
stdout: z17.string(),
|
|
3711
|
+
stderr: z17.string(),
|
|
3712
|
+
outcome: z17.discriminatedUnion("type", [
|
|
3713
|
+
z17.object({ type: z17.literal("timeout") }),
|
|
3714
|
+
z17.object({
|
|
3715
|
+
type: z17.literal("exit"),
|
|
3716
|
+
exit_code: z17.number()
|
|
3488
3717
|
})
|
|
3489
3718
|
])
|
|
3490
3719
|
})
|
|
3491
3720
|
)
|
|
3721
|
+
}),
|
|
3722
|
+
z17.object({
|
|
3723
|
+
type: z17.literal("tool_search_call"),
|
|
3724
|
+
id: z17.string(),
|
|
3725
|
+
execution: z17.enum(["server", "client"]),
|
|
3726
|
+
call_id: z17.string().nullable(),
|
|
3727
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3728
|
+
arguments: z17.unknown()
|
|
3729
|
+
}),
|
|
3730
|
+
z17.object({
|
|
3731
|
+
type: z17.literal("tool_search_output"),
|
|
3732
|
+
id: z17.string(),
|
|
3733
|
+
execution: z17.enum(["server", "client"]),
|
|
3734
|
+
call_id: z17.string().nullable(),
|
|
3735
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3736
|
+
tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
|
|
3492
3737
|
})
|
|
3493
3738
|
])
|
|
3494
3739
|
}),
|
|
3495
|
-
|
|
3496
|
-
type:
|
|
3497
|
-
item_id:
|
|
3498
|
-
output_index:
|
|
3499
|
-
delta:
|
|
3740
|
+
z17.object({
|
|
3741
|
+
type: z17.literal("response.function_call_arguments.delta"),
|
|
3742
|
+
item_id: z17.string(),
|
|
3743
|
+
output_index: z17.number(),
|
|
3744
|
+
delta: z17.string()
|
|
3500
3745
|
}),
|
|
3501
|
-
|
|
3502
|
-
type:
|
|
3503
|
-
item_id:
|
|
3504
|
-
output_index:
|
|
3505
|
-
delta:
|
|
3746
|
+
z17.object({
|
|
3747
|
+
type: z17.literal("response.custom_tool_call_input.delta"),
|
|
3748
|
+
item_id: z17.string(),
|
|
3749
|
+
output_index: z17.number(),
|
|
3750
|
+
delta: z17.string()
|
|
3506
3751
|
}),
|
|
3507
|
-
|
|
3508
|
-
type:
|
|
3509
|
-
item_id:
|
|
3510
|
-
output_index:
|
|
3511
|
-
partial_image_b64:
|
|
3752
|
+
z17.object({
|
|
3753
|
+
type: z17.literal("response.image_generation_call.partial_image"),
|
|
3754
|
+
item_id: z17.string(),
|
|
3755
|
+
output_index: z17.number(),
|
|
3756
|
+
partial_image_b64: z17.string()
|
|
3512
3757
|
}),
|
|
3513
|
-
|
|
3514
|
-
type:
|
|
3515
|
-
item_id:
|
|
3516
|
-
output_index:
|
|
3517
|
-
delta:
|
|
3758
|
+
z17.object({
|
|
3759
|
+
type: z17.literal("response.code_interpreter_call_code.delta"),
|
|
3760
|
+
item_id: z17.string(),
|
|
3761
|
+
output_index: z17.number(),
|
|
3762
|
+
delta: z17.string()
|
|
3518
3763
|
}),
|
|
3519
|
-
|
|
3520
|
-
type:
|
|
3521
|
-
item_id:
|
|
3522
|
-
output_index:
|
|
3523
|
-
code:
|
|
3764
|
+
z17.object({
|
|
3765
|
+
type: z17.literal("response.code_interpreter_call_code.done"),
|
|
3766
|
+
item_id: z17.string(),
|
|
3767
|
+
output_index: z17.number(),
|
|
3768
|
+
code: z17.string()
|
|
3524
3769
|
}),
|
|
3525
|
-
|
|
3526
|
-
type:
|
|
3527
|
-
annotation:
|
|
3528
|
-
|
|
3529
|
-
type:
|
|
3530
|
-
start_index:
|
|
3531
|
-
end_index:
|
|
3532
|
-
url:
|
|
3533
|
-
title:
|
|
3770
|
+
z17.object({
|
|
3771
|
+
type: z17.literal("response.output_text.annotation.added"),
|
|
3772
|
+
annotation: z17.discriminatedUnion("type", [
|
|
3773
|
+
z17.object({
|
|
3774
|
+
type: z17.literal("url_citation"),
|
|
3775
|
+
start_index: z17.number(),
|
|
3776
|
+
end_index: z17.number(),
|
|
3777
|
+
url: z17.string(),
|
|
3778
|
+
title: z17.string()
|
|
3534
3779
|
}),
|
|
3535
|
-
|
|
3536
|
-
type:
|
|
3537
|
-
file_id:
|
|
3538
|
-
filename:
|
|
3539
|
-
index:
|
|
3780
|
+
z17.object({
|
|
3781
|
+
type: z17.literal("file_citation"),
|
|
3782
|
+
file_id: z17.string(),
|
|
3783
|
+
filename: z17.string(),
|
|
3784
|
+
index: z17.number()
|
|
3540
3785
|
}),
|
|
3541
|
-
|
|
3542
|
-
type:
|
|
3543
|
-
container_id:
|
|
3544
|
-
file_id:
|
|
3545
|
-
filename:
|
|
3546
|
-
start_index:
|
|
3547
|
-
end_index:
|
|
3786
|
+
z17.object({
|
|
3787
|
+
type: z17.literal("container_file_citation"),
|
|
3788
|
+
container_id: z17.string(),
|
|
3789
|
+
file_id: z17.string(),
|
|
3790
|
+
filename: z17.string(),
|
|
3791
|
+
start_index: z17.number(),
|
|
3792
|
+
end_index: z17.number()
|
|
3548
3793
|
}),
|
|
3549
|
-
|
|
3550
|
-
type:
|
|
3551
|
-
file_id:
|
|
3552
|
-
index:
|
|
3794
|
+
z17.object({
|
|
3795
|
+
type: z17.literal("file_path"),
|
|
3796
|
+
file_id: z17.string(),
|
|
3797
|
+
index: z17.number()
|
|
3553
3798
|
})
|
|
3554
3799
|
])
|
|
3555
3800
|
}),
|
|
3556
|
-
|
|
3557
|
-
type:
|
|
3558
|
-
item_id:
|
|
3559
|
-
summary_index:
|
|
3801
|
+
z17.object({
|
|
3802
|
+
type: z17.literal("response.reasoning_summary_part.added"),
|
|
3803
|
+
item_id: z17.string(),
|
|
3804
|
+
summary_index: z17.number()
|
|
3560
3805
|
}),
|
|
3561
|
-
|
|
3562
|
-
type:
|
|
3563
|
-
item_id:
|
|
3564
|
-
summary_index:
|
|
3565
|
-
delta:
|
|
3806
|
+
z17.object({
|
|
3807
|
+
type: z17.literal("response.reasoning_summary_text.delta"),
|
|
3808
|
+
item_id: z17.string(),
|
|
3809
|
+
summary_index: z17.number(),
|
|
3810
|
+
delta: z17.string()
|
|
3566
3811
|
}),
|
|
3567
|
-
|
|
3568
|
-
type:
|
|
3569
|
-
item_id:
|
|
3570
|
-
summary_index:
|
|
3812
|
+
z17.object({
|
|
3813
|
+
type: z17.literal("response.reasoning_summary_part.done"),
|
|
3814
|
+
item_id: z17.string(),
|
|
3815
|
+
summary_index: z17.number()
|
|
3571
3816
|
}),
|
|
3572
|
-
|
|
3573
|
-
type:
|
|
3574
|
-
item_id:
|
|
3575
|
-
output_index:
|
|
3576
|
-
delta:
|
|
3577
|
-
obfuscation:
|
|
3817
|
+
z17.object({
|
|
3818
|
+
type: z17.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3819
|
+
item_id: z17.string(),
|
|
3820
|
+
output_index: z17.number(),
|
|
3821
|
+
delta: z17.string(),
|
|
3822
|
+
obfuscation: z17.string().nullish()
|
|
3578
3823
|
}),
|
|
3579
|
-
|
|
3580
|
-
type:
|
|
3581
|
-
item_id:
|
|
3582
|
-
output_index:
|
|
3583
|
-
diff:
|
|
3824
|
+
z17.object({
|
|
3825
|
+
type: z17.literal("response.apply_patch_call_operation_diff.done"),
|
|
3826
|
+
item_id: z17.string(),
|
|
3827
|
+
output_index: z17.number(),
|
|
3828
|
+
diff: z17.string()
|
|
3584
3829
|
}),
|
|
3585
|
-
|
|
3586
|
-
type:
|
|
3587
|
-
sequence_number:
|
|
3588
|
-
error:
|
|
3589
|
-
type:
|
|
3590
|
-
code:
|
|
3591
|
-
message:
|
|
3592
|
-
param:
|
|
3830
|
+
z17.object({
|
|
3831
|
+
type: z17.literal("error"),
|
|
3832
|
+
sequence_number: z17.number(),
|
|
3833
|
+
error: z17.object({
|
|
3834
|
+
type: z17.string(),
|
|
3835
|
+
code: z17.string(),
|
|
3836
|
+
message: z17.string(),
|
|
3837
|
+
param: z17.string().nullish()
|
|
3593
3838
|
})
|
|
3594
3839
|
}),
|
|
3595
|
-
|
|
3840
|
+
z17.object({ type: z17.string() }).loose().transform((value) => ({
|
|
3596
3841
|
type: "unknown_chunk",
|
|
3597
3842
|
message: value.type
|
|
3598
3843
|
}))
|
|
@@ -3600,294 +3845,315 @@ var openaiResponsesChunkSchema = lazySchema14(
|
|
|
3600
3845
|
])
|
|
3601
3846
|
)
|
|
3602
3847
|
);
|
|
3603
|
-
var openaiResponsesResponseSchema =
|
|
3604
|
-
() =>
|
|
3605
|
-
|
|
3606
|
-
id:
|
|
3607
|
-
created_at:
|
|
3608
|
-
error:
|
|
3609
|
-
message:
|
|
3610
|
-
type:
|
|
3611
|
-
param:
|
|
3612
|
-
code:
|
|
3848
|
+
var openaiResponsesResponseSchema = lazySchema15(
|
|
3849
|
+
() => zodSchema15(
|
|
3850
|
+
z17.object({
|
|
3851
|
+
id: z17.string().optional(),
|
|
3852
|
+
created_at: z17.number().optional(),
|
|
3853
|
+
error: z17.object({
|
|
3854
|
+
message: z17.string(),
|
|
3855
|
+
type: z17.string(),
|
|
3856
|
+
param: z17.string().nullish(),
|
|
3857
|
+
code: z17.string()
|
|
3613
3858
|
}).nullish(),
|
|
3614
|
-
model:
|
|
3615
|
-
output:
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
type:
|
|
3619
|
-
role:
|
|
3620
|
-
id:
|
|
3621
|
-
phase:
|
|
3622
|
-
content:
|
|
3623
|
-
|
|
3624
|
-
type:
|
|
3625
|
-
text:
|
|
3626
|
-
logprobs:
|
|
3627
|
-
|
|
3628
|
-
token:
|
|
3629
|
-
logprob:
|
|
3630
|
-
top_logprobs:
|
|
3631
|
-
|
|
3632
|
-
token:
|
|
3633
|
-
logprob:
|
|
3859
|
+
model: z17.string().optional(),
|
|
3860
|
+
output: z17.array(
|
|
3861
|
+
z17.discriminatedUnion("type", [
|
|
3862
|
+
z17.object({
|
|
3863
|
+
type: z17.literal("message"),
|
|
3864
|
+
role: z17.literal("assistant"),
|
|
3865
|
+
id: z17.string(),
|
|
3866
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish(),
|
|
3867
|
+
content: z17.array(
|
|
3868
|
+
z17.object({
|
|
3869
|
+
type: z17.literal("output_text"),
|
|
3870
|
+
text: z17.string(),
|
|
3871
|
+
logprobs: z17.array(
|
|
3872
|
+
z17.object({
|
|
3873
|
+
token: z17.string(),
|
|
3874
|
+
logprob: z17.number(),
|
|
3875
|
+
top_logprobs: z17.array(
|
|
3876
|
+
z17.object({
|
|
3877
|
+
token: z17.string(),
|
|
3878
|
+
logprob: z17.number()
|
|
3634
3879
|
})
|
|
3635
3880
|
)
|
|
3636
3881
|
})
|
|
3637
3882
|
).nullish(),
|
|
3638
|
-
annotations:
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
type:
|
|
3642
|
-
start_index:
|
|
3643
|
-
end_index:
|
|
3644
|
-
url:
|
|
3645
|
-
title:
|
|
3883
|
+
annotations: z17.array(
|
|
3884
|
+
z17.discriminatedUnion("type", [
|
|
3885
|
+
z17.object({
|
|
3886
|
+
type: z17.literal("url_citation"),
|
|
3887
|
+
start_index: z17.number(),
|
|
3888
|
+
end_index: z17.number(),
|
|
3889
|
+
url: z17.string(),
|
|
3890
|
+
title: z17.string()
|
|
3646
3891
|
}),
|
|
3647
|
-
|
|
3648
|
-
type:
|
|
3649
|
-
file_id:
|
|
3650
|
-
filename:
|
|
3651
|
-
index:
|
|
3892
|
+
z17.object({
|
|
3893
|
+
type: z17.literal("file_citation"),
|
|
3894
|
+
file_id: z17.string(),
|
|
3895
|
+
filename: z17.string(),
|
|
3896
|
+
index: z17.number()
|
|
3652
3897
|
}),
|
|
3653
|
-
|
|
3654
|
-
type:
|
|
3655
|
-
container_id:
|
|
3656
|
-
file_id:
|
|
3657
|
-
filename:
|
|
3658
|
-
start_index:
|
|
3659
|
-
end_index:
|
|
3898
|
+
z17.object({
|
|
3899
|
+
type: z17.literal("container_file_citation"),
|
|
3900
|
+
container_id: z17.string(),
|
|
3901
|
+
file_id: z17.string(),
|
|
3902
|
+
filename: z17.string(),
|
|
3903
|
+
start_index: z17.number(),
|
|
3904
|
+
end_index: z17.number()
|
|
3660
3905
|
}),
|
|
3661
|
-
|
|
3662
|
-
type:
|
|
3663
|
-
file_id:
|
|
3664
|
-
index:
|
|
3906
|
+
z17.object({
|
|
3907
|
+
type: z17.literal("file_path"),
|
|
3908
|
+
file_id: z17.string(),
|
|
3909
|
+
index: z17.number()
|
|
3665
3910
|
})
|
|
3666
3911
|
])
|
|
3667
3912
|
)
|
|
3668
3913
|
})
|
|
3669
3914
|
)
|
|
3670
3915
|
}),
|
|
3671
|
-
|
|
3672
|
-
type:
|
|
3673
|
-
id:
|
|
3674
|
-
status:
|
|
3675
|
-
action:
|
|
3676
|
-
|
|
3677
|
-
type:
|
|
3678
|
-
query:
|
|
3679
|
-
sources:
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
type:
|
|
3684
|
-
name:
|
|
3916
|
+
z17.object({
|
|
3917
|
+
type: z17.literal("web_search_call"),
|
|
3918
|
+
id: z17.string(),
|
|
3919
|
+
status: z17.string(),
|
|
3920
|
+
action: z17.discriminatedUnion("type", [
|
|
3921
|
+
z17.object({
|
|
3922
|
+
type: z17.literal("search"),
|
|
3923
|
+
query: z17.string().nullish(),
|
|
3924
|
+
sources: z17.array(
|
|
3925
|
+
z17.discriminatedUnion("type", [
|
|
3926
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
3927
|
+
z17.object({
|
|
3928
|
+
type: z17.literal("api"),
|
|
3929
|
+
name: z17.string()
|
|
3685
3930
|
})
|
|
3686
3931
|
])
|
|
3687
3932
|
).nullish()
|
|
3688
3933
|
}),
|
|
3689
|
-
|
|
3690
|
-
type:
|
|
3691
|
-
url:
|
|
3934
|
+
z17.object({
|
|
3935
|
+
type: z17.literal("open_page"),
|
|
3936
|
+
url: z17.string().nullish()
|
|
3692
3937
|
}),
|
|
3693
|
-
|
|
3694
|
-
type:
|
|
3695
|
-
url:
|
|
3696
|
-
pattern:
|
|
3938
|
+
z17.object({
|
|
3939
|
+
type: z17.literal("find_in_page"),
|
|
3940
|
+
url: z17.string().nullish(),
|
|
3941
|
+
pattern: z17.string().nullish()
|
|
3697
3942
|
})
|
|
3698
3943
|
]).nullish()
|
|
3699
3944
|
}),
|
|
3700
|
-
|
|
3701
|
-
type:
|
|
3702
|
-
id:
|
|
3703
|
-
queries:
|
|
3704
|
-
results:
|
|
3705
|
-
|
|
3706
|
-
attributes:
|
|
3707
|
-
|
|
3708
|
-
|
|
3945
|
+
z17.object({
|
|
3946
|
+
type: z17.literal("file_search_call"),
|
|
3947
|
+
id: z17.string(),
|
|
3948
|
+
queries: z17.array(z17.string()),
|
|
3949
|
+
results: z17.array(
|
|
3950
|
+
z17.object({
|
|
3951
|
+
attributes: z17.record(
|
|
3952
|
+
z17.string(),
|
|
3953
|
+
z17.union([z17.string(), z17.number(), z17.boolean()])
|
|
3709
3954
|
),
|
|
3710
|
-
file_id:
|
|
3711
|
-
filename:
|
|
3712
|
-
score:
|
|
3713
|
-
text:
|
|
3955
|
+
file_id: z17.string(),
|
|
3956
|
+
filename: z17.string(),
|
|
3957
|
+
score: z17.number(),
|
|
3958
|
+
text: z17.string()
|
|
3714
3959
|
})
|
|
3715
3960
|
).nullish()
|
|
3716
3961
|
}),
|
|
3717
|
-
|
|
3718
|
-
type:
|
|
3719
|
-
id:
|
|
3720
|
-
code:
|
|
3721
|
-
container_id:
|
|
3722
|
-
outputs:
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3962
|
+
z17.object({
|
|
3963
|
+
type: z17.literal("code_interpreter_call"),
|
|
3964
|
+
id: z17.string(),
|
|
3965
|
+
code: z17.string().nullable(),
|
|
3966
|
+
container_id: z17.string(),
|
|
3967
|
+
outputs: z17.array(
|
|
3968
|
+
z17.discriminatedUnion("type", [
|
|
3969
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3970
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3726
3971
|
])
|
|
3727
3972
|
).nullable()
|
|
3728
3973
|
}),
|
|
3729
|
-
|
|
3730
|
-
type:
|
|
3731
|
-
id:
|
|
3732
|
-
result:
|
|
3974
|
+
z17.object({
|
|
3975
|
+
type: z17.literal("image_generation_call"),
|
|
3976
|
+
id: z17.string(),
|
|
3977
|
+
result: z17.string()
|
|
3733
3978
|
}),
|
|
3734
|
-
|
|
3735
|
-
type:
|
|
3736
|
-
id:
|
|
3737
|
-
call_id:
|
|
3738
|
-
action:
|
|
3739
|
-
type:
|
|
3740
|
-
command:
|
|
3741
|
-
timeout_ms:
|
|
3742
|
-
user:
|
|
3743
|
-
working_directory:
|
|
3744
|
-
env:
|
|
3979
|
+
z17.object({
|
|
3980
|
+
type: z17.literal("local_shell_call"),
|
|
3981
|
+
id: z17.string(),
|
|
3982
|
+
call_id: z17.string(),
|
|
3983
|
+
action: z17.object({
|
|
3984
|
+
type: z17.literal("exec"),
|
|
3985
|
+
command: z17.array(z17.string()),
|
|
3986
|
+
timeout_ms: z17.number().optional(),
|
|
3987
|
+
user: z17.string().optional(),
|
|
3988
|
+
working_directory: z17.string().optional(),
|
|
3989
|
+
env: z17.record(z17.string(), z17.string()).optional()
|
|
3745
3990
|
})
|
|
3746
3991
|
}),
|
|
3747
|
-
|
|
3748
|
-
type:
|
|
3749
|
-
call_id:
|
|
3750
|
-
name:
|
|
3751
|
-
arguments:
|
|
3752
|
-
id:
|
|
3992
|
+
z17.object({
|
|
3993
|
+
type: z17.literal("function_call"),
|
|
3994
|
+
call_id: z17.string(),
|
|
3995
|
+
name: z17.string(),
|
|
3996
|
+
arguments: z17.string(),
|
|
3997
|
+
id: z17.string()
|
|
3753
3998
|
}),
|
|
3754
|
-
|
|
3755
|
-
type:
|
|
3756
|
-
call_id:
|
|
3757
|
-
name:
|
|
3758
|
-
input:
|
|
3759
|
-
id:
|
|
3999
|
+
z17.object({
|
|
4000
|
+
type: z17.literal("custom_tool_call"),
|
|
4001
|
+
call_id: z17.string(),
|
|
4002
|
+
name: z17.string(),
|
|
4003
|
+
input: z17.string(),
|
|
4004
|
+
id: z17.string()
|
|
3760
4005
|
}),
|
|
3761
|
-
|
|
3762
|
-
type:
|
|
3763
|
-
id:
|
|
3764
|
-
status:
|
|
4006
|
+
z17.object({
|
|
4007
|
+
type: z17.literal("computer_call"),
|
|
4008
|
+
id: z17.string(),
|
|
4009
|
+
status: z17.string().optional()
|
|
3765
4010
|
}),
|
|
3766
|
-
|
|
3767
|
-
type:
|
|
3768
|
-
id:
|
|
3769
|
-
encrypted_content:
|
|
3770
|
-
summary:
|
|
3771
|
-
|
|
3772
|
-
type:
|
|
3773
|
-
text:
|
|
4011
|
+
z17.object({
|
|
4012
|
+
type: z17.literal("reasoning"),
|
|
4013
|
+
id: z17.string(),
|
|
4014
|
+
encrypted_content: z17.string().nullish(),
|
|
4015
|
+
summary: z17.array(
|
|
4016
|
+
z17.object({
|
|
4017
|
+
type: z17.literal("summary_text"),
|
|
4018
|
+
text: z17.string()
|
|
3774
4019
|
})
|
|
3775
4020
|
)
|
|
3776
4021
|
}),
|
|
3777
|
-
|
|
3778
|
-
type:
|
|
3779
|
-
id:
|
|
3780
|
-
status:
|
|
3781
|
-
arguments:
|
|
3782
|
-
name:
|
|
3783
|
-
server_label:
|
|
3784
|
-
output:
|
|
3785
|
-
error:
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
type:
|
|
3789
|
-
code:
|
|
3790
|
-
message:
|
|
4022
|
+
z17.object({
|
|
4023
|
+
type: z17.literal("mcp_call"),
|
|
4024
|
+
id: z17.string(),
|
|
4025
|
+
status: z17.string(),
|
|
4026
|
+
arguments: z17.string(),
|
|
4027
|
+
name: z17.string(),
|
|
4028
|
+
server_label: z17.string(),
|
|
4029
|
+
output: z17.string().nullish(),
|
|
4030
|
+
error: z17.union([
|
|
4031
|
+
z17.string(),
|
|
4032
|
+
z17.object({
|
|
4033
|
+
type: z17.string().optional(),
|
|
4034
|
+
code: z17.union([z17.number(), z17.string()]).optional(),
|
|
4035
|
+
message: z17.string().optional()
|
|
3791
4036
|
}).loose()
|
|
3792
4037
|
]).nullish(),
|
|
3793
|
-
approval_request_id:
|
|
4038
|
+
approval_request_id: z17.string().nullish()
|
|
3794
4039
|
}),
|
|
3795
|
-
|
|
3796
|
-
type:
|
|
3797
|
-
id:
|
|
3798
|
-
server_label:
|
|
3799
|
-
tools:
|
|
3800
|
-
|
|
3801
|
-
name:
|
|
3802
|
-
description:
|
|
3803
|
-
input_schema:
|
|
3804
|
-
annotations:
|
|
4040
|
+
z17.object({
|
|
4041
|
+
type: z17.literal("mcp_list_tools"),
|
|
4042
|
+
id: z17.string(),
|
|
4043
|
+
server_label: z17.string(),
|
|
4044
|
+
tools: z17.array(
|
|
4045
|
+
z17.object({
|
|
4046
|
+
name: z17.string(),
|
|
4047
|
+
description: z17.string().optional(),
|
|
4048
|
+
input_schema: z17.any(),
|
|
4049
|
+
annotations: z17.record(z17.string(), z17.unknown()).optional()
|
|
3805
4050
|
})
|
|
3806
4051
|
),
|
|
3807
|
-
error:
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
type:
|
|
3811
|
-
code:
|
|
3812
|
-
message:
|
|
4052
|
+
error: z17.union([
|
|
4053
|
+
z17.string(),
|
|
4054
|
+
z17.object({
|
|
4055
|
+
type: z17.string().optional(),
|
|
4056
|
+
code: z17.union([z17.number(), z17.string()]).optional(),
|
|
4057
|
+
message: z17.string().optional()
|
|
3813
4058
|
}).loose()
|
|
3814
4059
|
]).optional()
|
|
3815
4060
|
}),
|
|
3816
|
-
|
|
3817
|
-
type:
|
|
3818
|
-
id:
|
|
3819
|
-
server_label:
|
|
3820
|
-
name:
|
|
3821
|
-
arguments:
|
|
3822
|
-
approval_request_id:
|
|
4061
|
+
z17.object({
|
|
4062
|
+
type: z17.literal("mcp_approval_request"),
|
|
4063
|
+
id: z17.string(),
|
|
4064
|
+
server_label: z17.string(),
|
|
4065
|
+
name: z17.string(),
|
|
4066
|
+
arguments: z17.string(),
|
|
4067
|
+
approval_request_id: z17.string().optional()
|
|
3823
4068
|
}),
|
|
3824
|
-
|
|
3825
|
-
type:
|
|
3826
|
-
id:
|
|
3827
|
-
call_id:
|
|
3828
|
-
status:
|
|
3829
|
-
operation:
|
|
3830
|
-
|
|
3831
|
-
type:
|
|
3832
|
-
path:
|
|
3833
|
-
diff:
|
|
4069
|
+
z17.object({
|
|
4070
|
+
type: z17.literal("apply_patch_call"),
|
|
4071
|
+
id: z17.string(),
|
|
4072
|
+
call_id: z17.string(),
|
|
4073
|
+
status: z17.enum(["in_progress", "completed"]),
|
|
4074
|
+
operation: z17.discriminatedUnion("type", [
|
|
4075
|
+
z17.object({
|
|
4076
|
+
type: z17.literal("create_file"),
|
|
4077
|
+
path: z17.string(),
|
|
4078
|
+
diff: z17.string()
|
|
3834
4079
|
}),
|
|
3835
|
-
|
|
3836
|
-
type:
|
|
3837
|
-
path:
|
|
4080
|
+
z17.object({
|
|
4081
|
+
type: z17.literal("delete_file"),
|
|
4082
|
+
path: z17.string()
|
|
3838
4083
|
}),
|
|
3839
|
-
|
|
3840
|
-
type:
|
|
3841
|
-
path:
|
|
3842
|
-
diff:
|
|
4084
|
+
z17.object({
|
|
4085
|
+
type: z17.literal("update_file"),
|
|
4086
|
+
path: z17.string(),
|
|
4087
|
+
diff: z17.string()
|
|
3843
4088
|
})
|
|
3844
4089
|
])
|
|
3845
4090
|
}),
|
|
3846
|
-
|
|
3847
|
-
type:
|
|
3848
|
-
id:
|
|
3849
|
-
call_id:
|
|
3850
|
-
status:
|
|
3851
|
-
action:
|
|
3852
|
-
commands:
|
|
4091
|
+
z17.object({
|
|
4092
|
+
type: z17.literal("shell_call"),
|
|
4093
|
+
id: z17.string(),
|
|
4094
|
+
call_id: z17.string(),
|
|
4095
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
4096
|
+
action: z17.object({
|
|
4097
|
+
commands: z17.array(z17.string())
|
|
3853
4098
|
})
|
|
3854
4099
|
}),
|
|
3855
|
-
|
|
3856
|
-
type:
|
|
3857
|
-
id:
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
4100
|
+
z17.object({
|
|
4101
|
+
type: z17.literal("compaction"),
|
|
4102
|
+
id: z17.string(),
|
|
4103
|
+
encrypted_content: z17.string()
|
|
4104
|
+
}),
|
|
4105
|
+
z17.object({
|
|
4106
|
+
type: z17.literal("shell_call_output"),
|
|
4107
|
+
id: z17.string(),
|
|
4108
|
+
call_id: z17.string(),
|
|
4109
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
4110
|
+
output: z17.array(
|
|
4111
|
+
z17.object({
|
|
4112
|
+
stdout: z17.string(),
|
|
4113
|
+
stderr: z17.string(),
|
|
4114
|
+
outcome: z17.discriminatedUnion("type", [
|
|
4115
|
+
z17.object({ type: z17.literal("timeout") }),
|
|
4116
|
+
z17.object({
|
|
4117
|
+
type: z17.literal("exit"),
|
|
4118
|
+
exit_code: z17.number()
|
|
3869
4119
|
})
|
|
3870
4120
|
])
|
|
3871
4121
|
})
|
|
3872
4122
|
)
|
|
4123
|
+
}),
|
|
4124
|
+
z17.object({
|
|
4125
|
+
type: z17.literal("tool_search_call"),
|
|
4126
|
+
id: z17.string(),
|
|
4127
|
+
execution: z17.enum(["server", "client"]),
|
|
4128
|
+
call_id: z17.string().nullable(),
|
|
4129
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
4130
|
+
arguments: z17.unknown()
|
|
4131
|
+
}),
|
|
4132
|
+
z17.object({
|
|
4133
|
+
type: z17.literal("tool_search_output"),
|
|
4134
|
+
id: z17.string(),
|
|
4135
|
+
execution: z17.enum(["server", "client"]),
|
|
4136
|
+
call_id: z17.string().nullable(),
|
|
4137
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
4138
|
+
tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
|
|
3873
4139
|
})
|
|
3874
4140
|
])
|
|
3875
4141
|
).optional(),
|
|
3876
|
-
service_tier:
|
|
3877
|
-
incomplete_details:
|
|
3878
|
-
usage:
|
|
3879
|
-
input_tokens:
|
|
3880
|
-
input_tokens_details:
|
|
3881
|
-
output_tokens:
|
|
3882
|
-
output_tokens_details:
|
|
4142
|
+
service_tier: z17.string().nullish(),
|
|
4143
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
4144
|
+
usage: z17.object({
|
|
4145
|
+
input_tokens: z17.number(),
|
|
4146
|
+
input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
|
|
4147
|
+
output_tokens: z17.number(),
|
|
4148
|
+
output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
|
|
3883
4149
|
}).optional()
|
|
3884
4150
|
})
|
|
3885
4151
|
)
|
|
3886
4152
|
);
|
|
3887
4153
|
|
|
3888
4154
|
// src/responses/openai-responses-options.ts
|
|
3889
|
-
import { lazySchema as
|
|
3890
|
-
import { z as
|
|
4155
|
+
import { lazySchema as lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
|
|
4156
|
+
import { z as z18 } from "zod/v4";
|
|
3891
4157
|
var TOP_LOGPROBS_MAX = 20;
|
|
3892
4158
|
var openaiResponsesReasoningModelIds = [
|
|
3893
4159
|
"o1",
|
|
@@ -3916,11 +4182,16 @@ var openaiResponsesReasoningModelIds = [
|
|
|
3916
4182
|
"gpt-5.2-chat-latest",
|
|
3917
4183
|
"gpt-5.2-pro",
|
|
3918
4184
|
"gpt-5.2-codex",
|
|
4185
|
+
"gpt-5.3-chat-latest",
|
|
4186
|
+
"gpt-5.3-codex",
|
|
3919
4187
|
"gpt-5.4",
|
|
3920
4188
|
"gpt-5.4-2026-03-05",
|
|
4189
|
+
"gpt-5.4-mini",
|
|
4190
|
+
"gpt-5.4-mini-2026-03-17",
|
|
4191
|
+
"gpt-5.4-nano",
|
|
4192
|
+
"gpt-5.4-nano-2026-03-17",
|
|
3921
4193
|
"gpt-5.4-pro",
|
|
3922
|
-
"gpt-5.4-pro-2026-03-05"
|
|
3923
|
-
"gpt-5.3-codex"
|
|
4194
|
+
"gpt-5.4-pro-2026-03-05"
|
|
3924
4195
|
];
|
|
3925
4196
|
var openaiResponsesModelIds = [
|
|
3926
4197
|
"gpt-4.1",
|
|
@@ -3947,9 +4218,9 @@ var openaiResponsesModelIds = [
|
|
|
3947
4218
|
"gpt-5-chat-latest",
|
|
3948
4219
|
...openaiResponsesReasoningModelIds
|
|
3949
4220
|
];
|
|
3950
|
-
var openaiLanguageModelResponsesOptionsSchema =
|
|
3951
|
-
() =>
|
|
3952
|
-
|
|
4221
|
+
var openaiLanguageModelResponsesOptionsSchema = lazySchema16(
|
|
4222
|
+
() => zodSchema16(
|
|
4223
|
+
z18.object({
|
|
3953
4224
|
/**
|
|
3954
4225
|
* The ID of the OpenAI Conversation to continue.
|
|
3955
4226
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -3957,13 +4228,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
3957
4228
|
* Defaults to `undefined`.
|
|
3958
4229
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3959
4230
|
*/
|
|
3960
|
-
conversation:
|
|
4231
|
+
conversation: z18.string().nullish(),
|
|
3961
4232
|
/**
|
|
3962
4233
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
3963
4234
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
3964
4235
|
*/
|
|
3965
|
-
include:
|
|
3966
|
-
|
|
4236
|
+
include: z18.array(
|
|
4237
|
+
z18.enum([
|
|
3967
4238
|
"reasoning.encrypted_content",
|
|
3968
4239
|
// handled internally by default, only needed for unknown reasoning models
|
|
3969
4240
|
"file_search_call.results",
|
|
@@ -3975,7 +4246,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
3975
4246
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
3976
4247
|
* Defaults to `undefined`.
|
|
3977
4248
|
*/
|
|
3978
|
-
instructions:
|
|
4249
|
+
instructions: z18.string().nullish(),
|
|
3979
4250
|
/**
|
|
3980
4251
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
3981
4252
|
* the response size and can slow down response times. However, it can
|
|
@@ -3990,30 +4261,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
3990
4261
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3991
4262
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3992
4263
|
*/
|
|
3993
|
-
logprobs:
|
|
4264
|
+
logprobs: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3994
4265
|
/**
|
|
3995
4266
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3996
4267
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3997
4268
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3998
4269
|
*/
|
|
3999
|
-
maxToolCalls:
|
|
4270
|
+
maxToolCalls: z18.number().nullish(),
|
|
4000
4271
|
/**
|
|
4001
4272
|
* Additional metadata to store with the generation.
|
|
4002
4273
|
*/
|
|
4003
|
-
metadata:
|
|
4274
|
+
metadata: z18.any().nullish(),
|
|
4004
4275
|
/**
|
|
4005
4276
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
4006
4277
|
*/
|
|
4007
|
-
parallelToolCalls:
|
|
4278
|
+
parallelToolCalls: z18.boolean().nullish(),
|
|
4008
4279
|
/**
|
|
4009
4280
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
4010
4281
|
* Defaults to `undefined`.
|
|
4011
4282
|
*/
|
|
4012
|
-
previousResponseId:
|
|
4283
|
+
previousResponseId: z18.string().nullish(),
|
|
4013
4284
|
/**
|
|
4014
4285
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
4015
4286
|
*/
|
|
4016
|
-
promptCacheKey:
|
|
4287
|
+
promptCacheKey: z18.string().nullish(),
|
|
4017
4288
|
/**
|
|
4018
4289
|
* The retention policy for the prompt cache.
|
|
4019
4290
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -4022,7 +4293,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4022
4293
|
*
|
|
4023
4294
|
* @default 'in_memory'
|
|
4024
4295
|
*/
|
|
4025
|
-
promptCacheRetention:
|
|
4296
|
+
promptCacheRetention: z18.enum(["in_memory", "24h"]).nullish(),
|
|
4026
4297
|
/**
|
|
4027
4298
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
4028
4299
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -4033,17 +4304,17 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4033
4304
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
4034
4305
|
* an error.
|
|
4035
4306
|
*/
|
|
4036
|
-
reasoningEffort:
|
|
4307
|
+
reasoningEffort: z18.string().nullish(),
|
|
4037
4308
|
/**
|
|
4038
4309
|
* Controls reasoning summary output from the model.
|
|
4039
4310
|
* Set to "auto" to automatically receive the richest level available,
|
|
4040
4311
|
* or "detailed" for comprehensive summaries.
|
|
4041
4312
|
*/
|
|
4042
|
-
reasoningSummary:
|
|
4313
|
+
reasoningSummary: z18.string().nullish(),
|
|
4043
4314
|
/**
|
|
4044
4315
|
* The identifier for safety monitoring and tracking.
|
|
4045
4316
|
*/
|
|
4046
|
-
safetyIdentifier:
|
|
4317
|
+
safetyIdentifier: z18.string().nullish(),
|
|
4047
4318
|
/**
|
|
4048
4319
|
* Service tier for the request.
|
|
4049
4320
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -4051,34 +4322,34 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4051
4322
|
*
|
|
4052
4323
|
* Defaults to 'auto'.
|
|
4053
4324
|
*/
|
|
4054
|
-
serviceTier:
|
|
4325
|
+
serviceTier: z18.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
4055
4326
|
/**
|
|
4056
4327
|
* Whether to store the generation. Defaults to `true`.
|
|
4057
4328
|
*/
|
|
4058
|
-
store:
|
|
4329
|
+
store: z18.boolean().nullish(),
|
|
4059
4330
|
/**
|
|
4060
4331
|
* Whether to use strict JSON schema validation.
|
|
4061
4332
|
* Defaults to `true`.
|
|
4062
4333
|
*/
|
|
4063
|
-
strictJsonSchema:
|
|
4334
|
+
strictJsonSchema: z18.boolean().nullish(),
|
|
4064
4335
|
/**
|
|
4065
4336
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
4066
4337
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
4067
4338
|
* Valid values: 'low', 'medium', 'high'.
|
|
4068
4339
|
*/
|
|
4069
|
-
textVerbosity:
|
|
4340
|
+
textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
|
|
4070
4341
|
/**
|
|
4071
4342
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
4072
4343
|
* 'disabled' turns truncation off.
|
|
4073
4344
|
*/
|
|
4074
|
-
truncation:
|
|
4345
|
+
truncation: z18.enum(["auto", "disabled"]).nullish(),
|
|
4075
4346
|
/**
|
|
4076
4347
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
4077
4348
|
* monitor and detect abuse.
|
|
4078
4349
|
* Defaults to `undefined`.
|
|
4079
4350
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
4080
4351
|
*/
|
|
4081
|
-
user:
|
|
4352
|
+
user: z18.string().nullish(),
|
|
4082
4353
|
/**
|
|
4083
4354
|
* Override the system message mode for this model.
|
|
4084
4355
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -4087,7 +4358,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4087
4358
|
*
|
|
4088
4359
|
* If not specified, the mode is automatically determined based on the model.
|
|
4089
4360
|
*/
|
|
4090
|
-
systemMessageMode:
|
|
4361
|
+
systemMessageMode: z18.enum(["system", "developer", "remove"]).optional(),
|
|
4091
4362
|
/**
|
|
4092
4363
|
* Force treating this model as a reasoning model.
|
|
4093
4364
|
*
|
|
@@ -4097,7 +4368,16 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4097
4368
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4098
4369
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4099
4370
|
*/
|
|
4100
|
-
forceReasoning:
|
|
4371
|
+
forceReasoning: z18.boolean().optional(),
|
|
4372
|
+
/**
|
|
4373
|
+
* Enable server-side context management (compaction).
|
|
4374
|
+
*/
|
|
4375
|
+
contextManagement: z18.array(
|
|
4376
|
+
z18.object({
|
|
4377
|
+
type: z18.literal("compaction"),
|
|
4378
|
+
compactThreshold: z18.number()
|
|
4379
|
+
})
|
|
4380
|
+
).nullish()
|
|
4101
4381
|
})
|
|
4102
4382
|
)
|
|
4103
4383
|
);
|
|
@@ -4110,44 +4390,44 @@ import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
|
|
|
4110
4390
|
|
|
4111
4391
|
// src/tool/code-interpreter.ts
|
|
4112
4392
|
import {
|
|
4113
|
-
createProviderToolFactoryWithOutputSchema as
|
|
4114
|
-
lazySchema as
|
|
4115
|
-
zodSchema as
|
|
4393
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
4394
|
+
lazySchema as lazySchema17,
|
|
4395
|
+
zodSchema as zodSchema17
|
|
4116
4396
|
} from "@ai-sdk/provider-utils";
|
|
4117
|
-
import { z as
|
|
4118
|
-
var codeInterpreterInputSchema =
|
|
4119
|
-
() =>
|
|
4120
|
-
|
|
4121
|
-
code:
|
|
4122
|
-
containerId:
|
|
4397
|
+
import { z as z19 } from "zod/v4";
|
|
4398
|
+
var codeInterpreterInputSchema = lazySchema17(
|
|
4399
|
+
() => zodSchema17(
|
|
4400
|
+
z19.object({
|
|
4401
|
+
code: z19.string().nullish(),
|
|
4402
|
+
containerId: z19.string()
|
|
4123
4403
|
})
|
|
4124
4404
|
)
|
|
4125
4405
|
);
|
|
4126
|
-
var codeInterpreterOutputSchema =
|
|
4127
|
-
() =>
|
|
4128
|
-
|
|
4129
|
-
outputs:
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4406
|
+
var codeInterpreterOutputSchema = lazySchema17(
|
|
4407
|
+
() => zodSchema17(
|
|
4408
|
+
z19.object({
|
|
4409
|
+
outputs: z19.array(
|
|
4410
|
+
z19.discriminatedUnion("type", [
|
|
4411
|
+
z19.object({ type: z19.literal("logs"), logs: z19.string() }),
|
|
4412
|
+
z19.object({ type: z19.literal("image"), url: z19.string() })
|
|
4133
4413
|
])
|
|
4134
4414
|
).nullish()
|
|
4135
4415
|
})
|
|
4136
4416
|
)
|
|
4137
4417
|
);
|
|
4138
|
-
var codeInterpreterArgsSchema =
|
|
4139
|
-
() =>
|
|
4140
|
-
|
|
4141
|
-
container:
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
fileIds:
|
|
4418
|
+
var codeInterpreterArgsSchema = lazySchema17(
|
|
4419
|
+
() => zodSchema17(
|
|
4420
|
+
z19.object({
|
|
4421
|
+
container: z19.union([
|
|
4422
|
+
z19.string(),
|
|
4423
|
+
z19.object({
|
|
4424
|
+
fileIds: z19.array(z19.string()).optional()
|
|
4145
4425
|
})
|
|
4146
4426
|
]).optional()
|
|
4147
4427
|
})
|
|
4148
4428
|
)
|
|
4149
4429
|
);
|
|
4150
|
-
var codeInterpreterToolFactory =
|
|
4430
|
+
var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema5({
|
|
4151
4431
|
id: "openai.code_interpreter",
|
|
4152
4432
|
inputSchema: codeInterpreterInputSchema,
|
|
4153
4433
|
outputSchema: codeInterpreterOutputSchema
|
|
@@ -4158,88 +4438,88 @@ var codeInterpreter = (args = {}) => {
|
|
|
4158
4438
|
|
|
4159
4439
|
// src/tool/file-search.ts
|
|
4160
4440
|
import {
|
|
4161
|
-
createProviderToolFactoryWithOutputSchema as
|
|
4162
|
-
lazySchema as
|
|
4163
|
-
zodSchema as
|
|
4441
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
4442
|
+
lazySchema as lazySchema18,
|
|
4443
|
+
zodSchema as zodSchema18
|
|
4164
4444
|
} from "@ai-sdk/provider-utils";
|
|
4165
|
-
import { z as
|
|
4166
|
-
var comparisonFilterSchema =
|
|
4167
|
-
key:
|
|
4168
|
-
type:
|
|
4169
|
-
value:
|
|
4445
|
+
import { z as z20 } from "zod/v4";
|
|
4446
|
+
var comparisonFilterSchema = z20.object({
|
|
4447
|
+
key: z20.string(),
|
|
4448
|
+
type: z20.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
4449
|
+
value: z20.union([z20.string(), z20.number(), z20.boolean(), z20.array(z20.string())])
|
|
4170
4450
|
});
|
|
4171
|
-
var compoundFilterSchema =
|
|
4172
|
-
type:
|
|
4173
|
-
filters:
|
|
4174
|
-
|
|
4451
|
+
var compoundFilterSchema = z20.object({
|
|
4452
|
+
type: z20.enum(["and", "or"]),
|
|
4453
|
+
filters: z20.array(
|
|
4454
|
+
z20.union([comparisonFilterSchema, z20.lazy(() => compoundFilterSchema)])
|
|
4175
4455
|
)
|
|
4176
4456
|
});
|
|
4177
|
-
var fileSearchArgsSchema =
|
|
4178
|
-
() =>
|
|
4179
|
-
|
|
4180
|
-
vectorStoreIds:
|
|
4181
|
-
maxNumResults:
|
|
4182
|
-
ranking:
|
|
4183
|
-
ranker:
|
|
4184
|
-
scoreThreshold:
|
|
4457
|
+
var fileSearchArgsSchema = lazySchema18(
|
|
4458
|
+
() => zodSchema18(
|
|
4459
|
+
z20.object({
|
|
4460
|
+
vectorStoreIds: z20.array(z20.string()),
|
|
4461
|
+
maxNumResults: z20.number().optional(),
|
|
4462
|
+
ranking: z20.object({
|
|
4463
|
+
ranker: z20.string().optional(),
|
|
4464
|
+
scoreThreshold: z20.number().optional()
|
|
4185
4465
|
}).optional(),
|
|
4186
|
-
filters:
|
|
4466
|
+
filters: z20.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
4187
4467
|
})
|
|
4188
4468
|
)
|
|
4189
4469
|
);
|
|
4190
|
-
var fileSearchOutputSchema =
|
|
4191
|
-
() =>
|
|
4192
|
-
|
|
4193
|
-
queries:
|
|
4194
|
-
results:
|
|
4195
|
-
|
|
4196
|
-
attributes:
|
|
4197
|
-
fileId:
|
|
4198
|
-
filename:
|
|
4199
|
-
score:
|
|
4200
|
-
text:
|
|
4470
|
+
var fileSearchOutputSchema = lazySchema18(
|
|
4471
|
+
() => zodSchema18(
|
|
4472
|
+
z20.object({
|
|
4473
|
+
queries: z20.array(z20.string()),
|
|
4474
|
+
results: z20.array(
|
|
4475
|
+
z20.object({
|
|
4476
|
+
attributes: z20.record(z20.string(), z20.unknown()),
|
|
4477
|
+
fileId: z20.string(),
|
|
4478
|
+
filename: z20.string(),
|
|
4479
|
+
score: z20.number(),
|
|
4480
|
+
text: z20.string()
|
|
4201
4481
|
})
|
|
4202
4482
|
).nullable()
|
|
4203
4483
|
})
|
|
4204
4484
|
)
|
|
4205
4485
|
);
|
|
4206
|
-
var fileSearch =
|
|
4486
|
+
var fileSearch = createProviderToolFactoryWithOutputSchema6({
|
|
4207
4487
|
id: "openai.file_search",
|
|
4208
|
-
inputSchema:
|
|
4488
|
+
inputSchema: z20.object({}),
|
|
4209
4489
|
outputSchema: fileSearchOutputSchema
|
|
4210
4490
|
});
|
|
4211
4491
|
|
|
4212
4492
|
// src/tool/image-generation.ts
|
|
4213
4493
|
import {
|
|
4214
|
-
createProviderToolFactoryWithOutputSchema as
|
|
4215
|
-
lazySchema as
|
|
4216
|
-
zodSchema as
|
|
4494
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
4495
|
+
lazySchema as lazySchema19,
|
|
4496
|
+
zodSchema as zodSchema19
|
|
4217
4497
|
} from "@ai-sdk/provider-utils";
|
|
4218
|
-
import { z as
|
|
4219
|
-
var imageGenerationArgsSchema =
|
|
4220
|
-
() =>
|
|
4221
|
-
|
|
4222
|
-
background:
|
|
4223
|
-
inputFidelity:
|
|
4224
|
-
inputImageMask:
|
|
4225
|
-
fileId:
|
|
4226
|
-
imageUrl:
|
|
4498
|
+
import { z as z21 } from "zod/v4";
|
|
4499
|
+
var imageGenerationArgsSchema = lazySchema19(
|
|
4500
|
+
() => zodSchema19(
|
|
4501
|
+
z21.object({
|
|
4502
|
+
background: z21.enum(["auto", "opaque", "transparent"]).optional(),
|
|
4503
|
+
inputFidelity: z21.enum(["low", "high"]).optional(),
|
|
4504
|
+
inputImageMask: z21.object({
|
|
4505
|
+
fileId: z21.string().optional(),
|
|
4506
|
+
imageUrl: z21.string().optional()
|
|
4227
4507
|
}).optional(),
|
|
4228
|
-
model:
|
|
4229
|
-
moderation:
|
|
4230
|
-
outputCompression:
|
|
4231
|
-
outputFormat:
|
|
4232
|
-
partialImages:
|
|
4233
|
-
quality:
|
|
4234
|
-
size:
|
|
4508
|
+
model: z21.string().optional(),
|
|
4509
|
+
moderation: z21.enum(["auto"]).optional(),
|
|
4510
|
+
outputCompression: z21.number().int().min(0).max(100).optional(),
|
|
4511
|
+
outputFormat: z21.enum(["png", "jpeg", "webp"]).optional(),
|
|
4512
|
+
partialImages: z21.number().int().min(0).max(3).optional(),
|
|
4513
|
+
quality: z21.enum(["auto", "low", "medium", "high"]).optional(),
|
|
4514
|
+
size: z21.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
4235
4515
|
}).strict()
|
|
4236
4516
|
)
|
|
4237
4517
|
);
|
|
4238
|
-
var imageGenerationInputSchema =
|
|
4239
|
-
var imageGenerationOutputSchema =
|
|
4240
|
-
() =>
|
|
4518
|
+
var imageGenerationInputSchema = lazySchema19(() => zodSchema19(z21.object({})));
|
|
4519
|
+
var imageGenerationOutputSchema = lazySchema19(
|
|
4520
|
+
() => zodSchema19(z21.object({ result: z21.string() }))
|
|
4241
4521
|
);
|
|
4242
|
-
var imageGenerationToolFactory =
|
|
4522
|
+
var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema7({
|
|
4243
4523
|
id: "openai.image_generation",
|
|
4244
4524
|
inputSchema: imageGenerationInputSchema,
|
|
4245
4525
|
outputSchema: imageGenerationOutputSchema
|
|
@@ -4251,29 +4531,28 @@ var imageGeneration = (args = {}) => {
|
|
|
4251
4531
|
// src/tool/custom.ts
|
|
4252
4532
|
import {
|
|
4253
4533
|
createProviderToolFactory,
|
|
4254
|
-
lazySchema as
|
|
4255
|
-
zodSchema as
|
|
4534
|
+
lazySchema as lazySchema20,
|
|
4535
|
+
zodSchema as zodSchema20
|
|
4256
4536
|
} from "@ai-sdk/provider-utils";
|
|
4257
|
-
import { z as
|
|
4258
|
-
var customArgsSchema =
|
|
4259
|
-
() =>
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
definition: z21.string()
|
|
4537
|
+
import { z as z22 } from "zod/v4";
|
|
4538
|
+
var customArgsSchema = lazySchema20(
|
|
4539
|
+
() => zodSchema20(
|
|
4540
|
+
z22.object({
|
|
4541
|
+
description: z22.string().optional(),
|
|
4542
|
+
format: z22.union([
|
|
4543
|
+
z22.object({
|
|
4544
|
+
type: z22.literal("grammar"),
|
|
4545
|
+
syntax: z22.enum(["regex", "lark"]),
|
|
4546
|
+
definition: z22.string()
|
|
4268
4547
|
}),
|
|
4269
|
-
|
|
4270
|
-
type:
|
|
4548
|
+
z22.object({
|
|
4549
|
+
type: z22.literal("text")
|
|
4271
4550
|
})
|
|
4272
4551
|
]).optional()
|
|
4273
4552
|
})
|
|
4274
4553
|
)
|
|
4275
4554
|
);
|
|
4276
|
-
var customInputSchema =
|
|
4555
|
+
var customInputSchema = lazySchema20(() => zodSchema20(z22.string()));
|
|
4277
4556
|
var customToolFactory = createProviderToolFactory({
|
|
4278
4557
|
id: "openai.custom",
|
|
4279
4558
|
inputSchema: customInputSchema
|
|
@@ -4281,137 +4560,82 @@ var customToolFactory = createProviderToolFactory({
|
|
|
4281
4560
|
|
|
4282
4561
|
// src/tool/mcp.ts
|
|
4283
4562
|
import {
|
|
4284
|
-
createProviderToolFactoryWithOutputSchema as
|
|
4285
|
-
lazySchema as
|
|
4286
|
-
zodSchema as
|
|
4563
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
4564
|
+
lazySchema as lazySchema21,
|
|
4565
|
+
zodSchema as zodSchema21
|
|
4287
4566
|
} from "@ai-sdk/provider-utils";
|
|
4288
|
-
import { z as
|
|
4289
|
-
var
|
|
4290
|
-
() =>
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4567
|
+
import { z as z23 } from "zod/v4";
|
|
4568
|
+
var jsonValueSchema2 = z23.lazy(
|
|
4569
|
+
() => z23.union([
|
|
4570
|
+
z23.string(),
|
|
4571
|
+
z23.number(),
|
|
4572
|
+
z23.boolean(),
|
|
4573
|
+
z23.null(),
|
|
4574
|
+
z23.array(jsonValueSchema2),
|
|
4575
|
+
z23.record(z23.string(), jsonValueSchema2)
|
|
4297
4576
|
])
|
|
4298
4577
|
);
|
|
4299
|
-
var mcpArgsSchema =
|
|
4300
|
-
() =>
|
|
4301
|
-
|
|
4302
|
-
serverLabel:
|
|
4303
|
-
allowedTools:
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
readOnly:
|
|
4307
|
-
toolNames:
|
|
4578
|
+
var mcpArgsSchema = lazySchema21(
|
|
4579
|
+
() => zodSchema21(
|
|
4580
|
+
z23.object({
|
|
4581
|
+
serverLabel: z23.string(),
|
|
4582
|
+
allowedTools: z23.union([
|
|
4583
|
+
z23.array(z23.string()),
|
|
4584
|
+
z23.object({
|
|
4585
|
+
readOnly: z23.boolean().optional(),
|
|
4586
|
+
toolNames: z23.array(z23.string()).optional()
|
|
4308
4587
|
})
|
|
4309
4588
|
]).optional(),
|
|
4310
|
-
authorization:
|
|
4311
|
-
connectorId:
|
|
4312
|
-
headers:
|
|
4313
|
-
requireApproval:
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
never:
|
|
4317
|
-
toolNames:
|
|
4589
|
+
authorization: z23.string().optional(),
|
|
4590
|
+
connectorId: z23.string().optional(),
|
|
4591
|
+
headers: z23.record(z23.string(), z23.string()).optional(),
|
|
4592
|
+
requireApproval: z23.union([
|
|
4593
|
+
z23.enum(["always", "never"]),
|
|
4594
|
+
z23.object({
|
|
4595
|
+
never: z23.object({
|
|
4596
|
+
toolNames: z23.array(z23.string()).optional()
|
|
4318
4597
|
}).optional()
|
|
4319
4598
|
})
|
|
4320
4599
|
]).optional(),
|
|
4321
|
-
serverDescription:
|
|
4322
|
-
serverUrl:
|
|
4600
|
+
serverDescription: z23.string().optional(),
|
|
4601
|
+
serverUrl: z23.string().optional()
|
|
4323
4602
|
}).refine(
|
|
4324
4603
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
4325
4604
|
"One of serverUrl or connectorId must be provided."
|
|
4326
4605
|
)
|
|
4327
4606
|
)
|
|
4328
4607
|
);
|
|
4329
|
-
var mcpInputSchema =
|
|
4330
|
-
var mcpOutputSchema =
|
|
4331
|
-
() =>
|
|
4332
|
-
|
|
4333
|
-
type:
|
|
4334
|
-
serverLabel:
|
|
4335
|
-
name:
|
|
4336
|
-
arguments:
|
|
4337
|
-
output:
|
|
4338
|
-
error:
|
|
4608
|
+
var mcpInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
|
|
4609
|
+
var mcpOutputSchema = lazySchema21(
|
|
4610
|
+
() => zodSchema21(
|
|
4611
|
+
z23.object({
|
|
4612
|
+
type: z23.literal("call"),
|
|
4613
|
+
serverLabel: z23.string(),
|
|
4614
|
+
name: z23.string(),
|
|
4615
|
+
arguments: z23.string(),
|
|
4616
|
+
output: z23.string().nullish(),
|
|
4617
|
+
error: z23.union([z23.string(), jsonValueSchema2]).optional()
|
|
4339
4618
|
})
|
|
4340
4619
|
)
|
|
4341
4620
|
);
|
|
4342
|
-
var mcpToolFactory =
|
|
4621
|
+
var mcpToolFactory = createProviderToolFactoryWithOutputSchema8({
|
|
4343
4622
|
id: "openai.mcp",
|
|
4344
4623
|
inputSchema: mcpInputSchema,
|
|
4345
4624
|
outputSchema: mcpOutputSchema
|
|
4346
4625
|
});
|
|
4347
4626
|
|
|
4348
4627
|
// src/tool/web-search.ts
|
|
4349
|
-
import {
|
|
4350
|
-
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
4351
|
-
lazySchema as lazySchema21,
|
|
4352
|
-
zodSchema as zodSchema21
|
|
4353
|
-
} from "@ai-sdk/provider-utils";
|
|
4354
|
-
import { z as z23 } from "zod/v4";
|
|
4355
|
-
var webSearchArgsSchema = lazySchema21(
|
|
4356
|
-
() => zodSchema21(
|
|
4357
|
-
z23.object({
|
|
4358
|
-
externalWebAccess: z23.boolean().optional(),
|
|
4359
|
-
filters: z23.object({ allowedDomains: z23.array(z23.string()).optional() }).optional(),
|
|
4360
|
-
searchContextSize: z23.enum(["low", "medium", "high"]).optional(),
|
|
4361
|
-
userLocation: z23.object({
|
|
4362
|
-
type: z23.literal("approximate"),
|
|
4363
|
-
country: z23.string().optional(),
|
|
4364
|
-
city: z23.string().optional(),
|
|
4365
|
-
region: z23.string().optional(),
|
|
4366
|
-
timezone: z23.string().optional()
|
|
4367
|
-
}).optional()
|
|
4368
|
-
})
|
|
4369
|
-
)
|
|
4370
|
-
);
|
|
4371
|
-
var webSearchInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
|
|
4372
|
-
var webSearchOutputSchema = lazySchema21(
|
|
4373
|
-
() => zodSchema21(
|
|
4374
|
-
z23.object({
|
|
4375
|
-
action: z23.discriminatedUnion("type", [
|
|
4376
|
-
z23.object({
|
|
4377
|
-
type: z23.literal("search"),
|
|
4378
|
-
query: z23.string().optional()
|
|
4379
|
-
}),
|
|
4380
|
-
z23.object({
|
|
4381
|
-
type: z23.literal("openPage"),
|
|
4382
|
-
url: z23.string().nullish()
|
|
4383
|
-
}),
|
|
4384
|
-
z23.object({
|
|
4385
|
-
type: z23.literal("findInPage"),
|
|
4386
|
-
url: z23.string().nullish(),
|
|
4387
|
-
pattern: z23.string().nullish()
|
|
4388
|
-
})
|
|
4389
|
-
]).optional(),
|
|
4390
|
-
sources: z23.array(
|
|
4391
|
-
z23.discriminatedUnion("type", [
|
|
4392
|
-
z23.object({ type: z23.literal("url"), url: z23.string() }),
|
|
4393
|
-
z23.object({ type: z23.literal("api"), name: z23.string() })
|
|
4394
|
-
])
|
|
4395
|
-
).optional()
|
|
4396
|
-
})
|
|
4397
|
-
)
|
|
4398
|
-
);
|
|
4399
|
-
var webSearchToolFactory = createProviderToolFactoryWithOutputSchema8({
|
|
4400
|
-
id: "openai.web_search",
|
|
4401
|
-
inputSchema: webSearchInputSchema,
|
|
4402
|
-
outputSchema: webSearchOutputSchema
|
|
4403
|
-
});
|
|
4404
|
-
|
|
4405
|
-
// src/tool/web-search-preview.ts
|
|
4406
4628
|
import {
|
|
4407
4629
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
4408
4630
|
lazySchema as lazySchema22,
|
|
4409
4631
|
zodSchema as zodSchema22
|
|
4410
4632
|
} from "@ai-sdk/provider-utils";
|
|
4411
4633
|
import { z as z24 } from "zod/v4";
|
|
4412
|
-
var
|
|
4634
|
+
var webSearchArgsSchema = lazySchema22(
|
|
4413
4635
|
() => zodSchema22(
|
|
4414
4636
|
z24.object({
|
|
4637
|
+
externalWebAccess: z24.boolean().optional(),
|
|
4638
|
+
filters: z24.object({ allowedDomains: z24.array(z24.string()).optional() }).optional(),
|
|
4415
4639
|
searchContextSize: z24.enum(["low", "medium", "high"]).optional(),
|
|
4416
4640
|
userLocation: z24.object({
|
|
4417
4641
|
type: z24.literal("approximate"),
|
|
@@ -4423,10 +4647,8 @@ var webSearchPreviewArgsSchema = lazySchema22(
|
|
|
4423
4647
|
})
|
|
4424
4648
|
)
|
|
4425
4649
|
);
|
|
4426
|
-
var
|
|
4427
|
-
|
|
4428
|
-
);
|
|
4429
|
-
var webSearchPreviewOutputSchema = lazySchema22(
|
|
4650
|
+
var webSearchInputSchema = lazySchema22(() => zodSchema22(z24.object({})));
|
|
4651
|
+
var webSearchOutputSchema = lazySchema22(
|
|
4430
4652
|
() => zodSchema22(
|
|
4431
4653
|
z24.object({
|
|
4432
4654
|
action: z24.discriminatedUnion("type", [
|
|
@@ -4443,11 +4665,68 @@ var webSearchPreviewOutputSchema = lazySchema22(
|
|
|
4443
4665
|
url: z24.string().nullish(),
|
|
4444
4666
|
pattern: z24.string().nullish()
|
|
4445
4667
|
})
|
|
4668
|
+
]).optional(),
|
|
4669
|
+
sources: z24.array(
|
|
4670
|
+
z24.discriminatedUnion("type", [
|
|
4671
|
+
z24.object({ type: z24.literal("url"), url: z24.string() }),
|
|
4672
|
+
z24.object({ type: z24.literal("api"), name: z24.string() })
|
|
4673
|
+
])
|
|
4674
|
+
).optional()
|
|
4675
|
+
})
|
|
4676
|
+
)
|
|
4677
|
+
);
|
|
4678
|
+
var webSearchToolFactory = createProviderToolFactoryWithOutputSchema9({
|
|
4679
|
+
id: "openai.web_search",
|
|
4680
|
+
inputSchema: webSearchInputSchema,
|
|
4681
|
+
outputSchema: webSearchOutputSchema
|
|
4682
|
+
});
|
|
4683
|
+
|
|
4684
|
+
// src/tool/web-search-preview.ts
|
|
4685
|
+
import {
|
|
4686
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
|
|
4687
|
+
lazySchema as lazySchema23,
|
|
4688
|
+
zodSchema as zodSchema23
|
|
4689
|
+
} from "@ai-sdk/provider-utils";
|
|
4690
|
+
import { z as z25 } from "zod/v4";
|
|
4691
|
+
var webSearchPreviewArgsSchema = lazySchema23(
|
|
4692
|
+
() => zodSchema23(
|
|
4693
|
+
z25.object({
|
|
4694
|
+
searchContextSize: z25.enum(["low", "medium", "high"]).optional(),
|
|
4695
|
+
userLocation: z25.object({
|
|
4696
|
+
type: z25.literal("approximate"),
|
|
4697
|
+
country: z25.string().optional(),
|
|
4698
|
+
city: z25.string().optional(),
|
|
4699
|
+
region: z25.string().optional(),
|
|
4700
|
+
timezone: z25.string().optional()
|
|
4701
|
+
}).optional()
|
|
4702
|
+
})
|
|
4703
|
+
)
|
|
4704
|
+
);
|
|
4705
|
+
var webSearchPreviewInputSchema = lazySchema23(
|
|
4706
|
+
() => zodSchema23(z25.object({}))
|
|
4707
|
+
);
|
|
4708
|
+
var webSearchPreviewOutputSchema = lazySchema23(
|
|
4709
|
+
() => zodSchema23(
|
|
4710
|
+
z25.object({
|
|
4711
|
+
action: z25.discriminatedUnion("type", [
|
|
4712
|
+
z25.object({
|
|
4713
|
+
type: z25.literal("search"),
|
|
4714
|
+
query: z25.string().optional()
|
|
4715
|
+
}),
|
|
4716
|
+
z25.object({
|
|
4717
|
+
type: z25.literal("openPage"),
|
|
4718
|
+
url: z25.string().nullish()
|
|
4719
|
+
}),
|
|
4720
|
+
z25.object({
|
|
4721
|
+
type: z25.literal("findInPage"),
|
|
4722
|
+
url: z25.string().nullish(),
|
|
4723
|
+
pattern: z25.string().nullish()
|
|
4724
|
+
})
|
|
4446
4725
|
]).optional()
|
|
4447
4726
|
})
|
|
4448
4727
|
)
|
|
4449
4728
|
);
|
|
4450
|
-
var webSearchPreview =
|
|
4729
|
+
var webSearchPreview = createProviderToolFactoryWithOutputSchema10({
|
|
4451
4730
|
id: "openai.web_search_preview",
|
|
4452
4731
|
inputSchema: webSearchPreviewInputSchema,
|
|
4453
4732
|
outputSchema: webSearchPreviewOutputSchema
|
|
@@ -4460,7 +4739,7 @@ async function prepareResponsesTools({
|
|
|
4460
4739
|
toolNameMapping,
|
|
4461
4740
|
customProviderToolNames
|
|
4462
4741
|
}) {
|
|
4463
|
-
var _a;
|
|
4742
|
+
var _a, _b;
|
|
4464
4743
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
4465
4744
|
const toolWarnings = [];
|
|
4466
4745
|
if (tools == null) {
|
|
@@ -4470,15 +4749,19 @@ async function prepareResponsesTools({
|
|
|
4470
4749
|
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
4471
4750
|
for (const tool of tools) {
|
|
4472
4751
|
switch (tool.type) {
|
|
4473
|
-
case "function":
|
|
4752
|
+
case "function": {
|
|
4753
|
+
const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
|
|
4754
|
+
const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
|
|
4474
4755
|
openaiTools.push({
|
|
4475
4756
|
type: "function",
|
|
4476
4757
|
name: tool.name,
|
|
4477
4758
|
description: tool.description,
|
|
4478
4759
|
parameters: tool.inputSchema,
|
|
4479
|
-
...tool.strict != null ? { strict: tool.strict } : {}
|
|
4760
|
+
...tool.strict != null ? { strict: tool.strict } : {},
|
|
4761
|
+
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
4480
4762
|
});
|
|
4481
4763
|
break;
|
|
4764
|
+
}
|
|
4482
4765
|
case "provider": {
|
|
4483
4766
|
switch (tool.id) {
|
|
4484
4767
|
case "openai.file_search": {
|
|
@@ -4616,11 +4899,24 @@ async function prepareResponsesTools({
|
|
|
4616
4899
|
});
|
|
4617
4900
|
openaiTools.push({
|
|
4618
4901
|
type: "custom",
|
|
4619
|
-
name:
|
|
4902
|
+
name: tool.name,
|
|
4620
4903
|
description: args.description,
|
|
4621
4904
|
format: args.format
|
|
4622
4905
|
});
|
|
4623
|
-
resolvedCustomProviderToolNames.add(
|
|
4906
|
+
resolvedCustomProviderToolNames.add(tool.name);
|
|
4907
|
+
break;
|
|
4908
|
+
}
|
|
4909
|
+
case "openai.tool_search": {
|
|
4910
|
+
const args = await validateTypes2({
|
|
4911
|
+
value: tool.args,
|
|
4912
|
+
schema: toolSearchArgsSchema
|
|
4913
|
+
});
|
|
4914
|
+
openaiTools.push({
|
|
4915
|
+
type: "tool_search",
|
|
4916
|
+
...args.execution != null ? { execution: args.execution } : {},
|
|
4917
|
+
...args.description != null ? { description: args.description } : {},
|
|
4918
|
+
...args.parameters != null ? { parameters: args.parameters } : {}
|
|
4919
|
+
});
|
|
4624
4920
|
break;
|
|
4625
4921
|
}
|
|
4626
4922
|
}
|
|
@@ -4644,7 +4940,7 @@ async function prepareResponsesTools({
|
|
|
4644
4940
|
case "required":
|
|
4645
4941
|
return { tools: openaiTools, toolChoice: type, toolWarnings };
|
|
4646
4942
|
case "tool": {
|
|
4647
|
-
const resolvedToolName = (
|
|
4943
|
+
const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
|
|
4648
4944
|
return {
|
|
4649
4945
|
tools: openaiTools,
|
|
4650
4946
|
toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
|
|
@@ -4724,7 +5020,7 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
|
4724
5020
|
}
|
|
4725
5021
|
var OpenAIResponsesLanguageModel = class {
|
|
4726
5022
|
constructor(modelId, config) {
|
|
4727
|
-
this.specificationVersion = "
|
|
5023
|
+
this.specificationVersion = "v4";
|
|
4728
5024
|
this.supportedUrls = {
|
|
4729
5025
|
"image/*": [/^https?:\/\/.*$/],
|
|
4730
5026
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -4745,12 +5041,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4745
5041
|
frequencyPenalty,
|
|
4746
5042
|
seed,
|
|
4747
5043
|
prompt,
|
|
5044
|
+
reasoning,
|
|
4748
5045
|
providerOptions,
|
|
4749
5046
|
tools,
|
|
4750
5047
|
toolChoice,
|
|
4751
5048
|
responseFormat
|
|
4752
5049
|
}) {
|
|
4753
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
5050
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4754
5051
|
const warnings = [];
|
|
4755
5052
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
4756
5053
|
if (topK != null) {
|
|
@@ -4781,7 +5078,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4781
5078
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4782
5079
|
});
|
|
4783
5080
|
}
|
|
4784
|
-
const
|
|
5081
|
+
const resolvedReasoningEffort = (_a = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a : isCustomReasoning2(reasoning) ? reasoning : void 0;
|
|
5082
|
+
const isReasoningModel = (_b = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
|
|
4785
5083
|
if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
|
|
4786
5084
|
warnings.push({
|
|
4787
5085
|
type: "unsupported",
|
|
@@ -4800,9 +5098,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4800
5098
|
"openai.web_search": "web_search",
|
|
4801
5099
|
"openai.web_search_preview": "web_search_preview",
|
|
4802
5100
|
"openai.mcp": "mcp",
|
|
4803
|
-
"openai.apply_patch": "apply_patch"
|
|
4804
|
-
|
|
4805
|
-
|
|
5101
|
+
"openai.apply_patch": "apply_patch",
|
|
5102
|
+
"openai.tool_search": "tool_search"
|
|
5103
|
+
}
|
|
4806
5104
|
});
|
|
4807
5105
|
const customProviderToolNames = /* @__PURE__ */ new Set();
|
|
4808
5106
|
const {
|
|
@@ -4818,10 +5116,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4818
5116
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
4819
5117
|
prompt,
|
|
4820
5118
|
toolNameMapping,
|
|
4821
|
-
systemMessageMode: (
|
|
5119
|
+
systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
|
|
4822
5120
|
providerOptionsName,
|
|
4823
5121
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
4824
|
-
store: (
|
|
5122
|
+
store: (_d = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _d : true,
|
|
4825
5123
|
hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
|
|
4826
5124
|
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
4827
5125
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
@@ -4829,7 +5127,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4829
5127
|
customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0
|
|
4830
5128
|
});
|
|
4831
5129
|
warnings.push(...inputWarnings);
|
|
4832
|
-
const strictJsonSchema = (
|
|
5130
|
+
const strictJsonSchema = (_e = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _e : true;
|
|
4833
5131
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4834
5132
|
function addInclude(key) {
|
|
4835
5133
|
if (include == null) {
|
|
@@ -4845,9 +5143,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4845
5143
|
if (topLogprobs) {
|
|
4846
5144
|
addInclude("message.output_text.logprobs");
|
|
4847
5145
|
}
|
|
4848
|
-
const webSearchToolName = (
|
|
5146
|
+
const webSearchToolName = (_f = tools == null ? void 0 : tools.find(
|
|
4849
5147
|
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4850
|
-
)) == null ? void 0 :
|
|
5148
|
+
)) == null ? void 0 : _f.name;
|
|
4851
5149
|
if (webSearchToolName) {
|
|
4852
5150
|
addInclude("web_search_call.action.sources");
|
|
4853
5151
|
}
|
|
@@ -4870,7 +5168,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4870
5168
|
format: responseFormat.schema != null ? {
|
|
4871
5169
|
type: "json_schema",
|
|
4872
5170
|
strict: strictJsonSchema,
|
|
4873
|
-
name: (
|
|
5171
|
+
name: (_g = responseFormat.name) != null ? _g : "response",
|
|
4874
5172
|
description: responseFormat.description,
|
|
4875
5173
|
schema: responseFormat.schema
|
|
4876
5174
|
} : { type: "json_object" }
|
|
@@ -4896,11 +5194,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4896
5194
|
safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
|
|
4897
5195
|
top_logprobs: topLogprobs,
|
|
4898
5196
|
truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
|
|
5197
|
+
// context management (server-side compaction):
|
|
5198
|
+
...(openaiOptions == null ? void 0 : openaiOptions.contextManagement) && {
|
|
5199
|
+
context_management: openaiOptions.contextManagement.map((cm) => ({
|
|
5200
|
+
type: cm.type,
|
|
5201
|
+
compact_threshold: cm.compactThreshold
|
|
5202
|
+
}))
|
|
5203
|
+
},
|
|
4899
5204
|
// model-specific settings:
|
|
4900
|
-
...isReasoningModel && (
|
|
5205
|
+
...isReasoningModel && (resolvedReasoningEffort != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) && {
|
|
4901
5206
|
reasoning: {
|
|
4902
|
-
...
|
|
4903
|
-
effort:
|
|
5207
|
+
...resolvedReasoningEffort != null && {
|
|
5208
|
+
effort: resolvedReasoningEffort
|
|
4904
5209
|
},
|
|
4905
5210
|
...(openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null && {
|
|
4906
5211
|
summary: openaiOptions.reasoningSummary
|
|
@@ -4909,7 +5214,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4909
5214
|
}
|
|
4910
5215
|
};
|
|
4911
5216
|
if (isReasoningModel) {
|
|
4912
|
-
if (!(
|
|
5217
|
+
if (!(resolvedReasoningEffort === "none" && modelCapabilities.supportsNonReasoningParameters)) {
|
|
4913
5218
|
if (baseArgs.temperature != null) {
|
|
4914
5219
|
baseArgs.temperature = void 0;
|
|
4915
5220
|
warnings.push({
|
|
@@ -4959,9 +5264,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4959
5264
|
});
|
|
4960
5265
|
delete baseArgs.service_tier;
|
|
4961
5266
|
}
|
|
4962
|
-
const shellToolEnvType = (
|
|
5267
|
+
const shellToolEnvType = (_j = (_i = (_h = tools == null ? void 0 : tools.find(
|
|
4963
5268
|
(tool) => tool.type === "provider" && tool.id === "openai.shell"
|
|
4964
|
-
)) == null ? void 0 :
|
|
5269
|
+
)) == null ? void 0 : _h.args) == null ? void 0 : _i.environment) == null ? void 0 : _j.type;
|
|
4965
5270
|
const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
|
|
4966
5271
|
return {
|
|
4967
5272
|
webSearchToolName,
|
|
@@ -4978,7 +5283,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4978
5283
|
};
|
|
4979
5284
|
}
|
|
4980
5285
|
async doGenerate(options) {
|
|
4981
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
5286
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
|
|
4982
5287
|
const {
|
|
4983
5288
|
args: body,
|
|
4984
5289
|
warnings,
|
|
@@ -5021,6 +5326,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5021
5326
|
const content = [];
|
|
5022
5327
|
const logprobs = [];
|
|
5023
5328
|
let hasFunctionCall = false;
|
|
5329
|
+
const hostedToolSearchCallIds = [];
|
|
5024
5330
|
for (const part of response.output) {
|
|
5025
5331
|
switch (part.type) {
|
|
5026
5332
|
case "reasoning": {
|
|
@@ -5059,6 +5365,46 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5059
5365
|
});
|
|
5060
5366
|
break;
|
|
5061
5367
|
}
|
|
5368
|
+
case "tool_search_call": {
|
|
5369
|
+
const toolCallId = (_b = part.call_id) != null ? _b : part.id;
|
|
5370
|
+
const isHosted = part.execution === "server";
|
|
5371
|
+
if (isHosted) {
|
|
5372
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5373
|
+
}
|
|
5374
|
+
content.push({
|
|
5375
|
+
type: "tool-call",
|
|
5376
|
+
toolCallId,
|
|
5377
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5378
|
+
input: JSON.stringify({
|
|
5379
|
+
arguments: part.arguments,
|
|
5380
|
+
call_id: part.call_id
|
|
5381
|
+
}),
|
|
5382
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5383
|
+
providerMetadata: {
|
|
5384
|
+
[providerOptionsName]: {
|
|
5385
|
+
itemId: part.id
|
|
5386
|
+
}
|
|
5387
|
+
}
|
|
5388
|
+
});
|
|
5389
|
+
break;
|
|
5390
|
+
}
|
|
5391
|
+
case "tool_search_output": {
|
|
5392
|
+
const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
|
|
5393
|
+
content.push({
|
|
5394
|
+
type: "tool-result",
|
|
5395
|
+
toolCallId,
|
|
5396
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5397
|
+
result: {
|
|
5398
|
+
tools: part.tools
|
|
5399
|
+
},
|
|
5400
|
+
providerMetadata: {
|
|
5401
|
+
[providerOptionsName]: {
|
|
5402
|
+
itemId: part.id
|
|
5403
|
+
}
|
|
5404
|
+
}
|
|
5405
|
+
});
|
|
5406
|
+
break;
|
|
5407
|
+
}
|
|
5062
5408
|
case "local_shell_call": {
|
|
5063
5409
|
content.push({
|
|
5064
5410
|
type: "tool-call",
|
|
@@ -5114,7 +5460,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5114
5460
|
}
|
|
5115
5461
|
case "message": {
|
|
5116
5462
|
for (const contentPart of part.content) {
|
|
5117
|
-
if (((
|
|
5463
|
+
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
|
|
5118
5464
|
logprobs.push(contentPart.logprobs);
|
|
5119
5465
|
}
|
|
5120
5466
|
const providerMetadata2 = {
|
|
@@ -5136,7 +5482,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5136
5482
|
content.push({
|
|
5137
5483
|
type: "source",
|
|
5138
5484
|
sourceType: "url",
|
|
5139
|
-
id: (
|
|
5485
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
|
|
5140
5486
|
url: annotation.url,
|
|
5141
5487
|
title: annotation.title
|
|
5142
5488
|
});
|
|
@@ -5144,7 +5490,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5144
5490
|
content.push({
|
|
5145
5491
|
type: "source",
|
|
5146
5492
|
sourceType: "document",
|
|
5147
|
-
id: (
|
|
5493
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
|
|
5148
5494
|
mediaType: "text/plain",
|
|
5149
5495
|
title: annotation.filename,
|
|
5150
5496
|
filename: annotation.filename,
|
|
@@ -5160,7 +5506,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5160
5506
|
content.push({
|
|
5161
5507
|
type: "source",
|
|
5162
5508
|
sourceType: "document",
|
|
5163
|
-
id: (
|
|
5509
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
|
|
5164
5510
|
mediaType: "text/plain",
|
|
5165
5511
|
title: annotation.filename,
|
|
5166
5512
|
filename: annotation.filename,
|
|
@@ -5176,7 +5522,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5176
5522
|
content.push({
|
|
5177
5523
|
type: "source",
|
|
5178
5524
|
sourceType: "document",
|
|
5179
|
-
id: (
|
|
5525
|
+
id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
|
|
5180
5526
|
mediaType: "application/octet-stream",
|
|
5181
5527
|
title: annotation.file_id,
|
|
5182
5528
|
filename: annotation.file_id,
|
|
@@ -5245,7 +5591,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5245
5591
|
break;
|
|
5246
5592
|
}
|
|
5247
5593
|
case "mcp_call": {
|
|
5248
|
-
const toolCallId = part.approval_request_id != null ? (
|
|
5594
|
+
const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
|
|
5249
5595
|
const toolName = `mcp.${part.name}`;
|
|
5250
5596
|
content.push({
|
|
5251
5597
|
type: "tool-call",
|
|
@@ -5279,8 +5625,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5279
5625
|
break;
|
|
5280
5626
|
}
|
|
5281
5627
|
case "mcp_approval_request": {
|
|
5282
|
-
const approvalRequestId = (
|
|
5283
|
-
const dummyToolCallId = (
|
|
5628
|
+
const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
|
|
5629
|
+
const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2();
|
|
5284
5630
|
const toolName = `mcp.${part.name}`;
|
|
5285
5631
|
content.push({
|
|
5286
5632
|
type: "tool-call",
|
|
@@ -5330,13 +5676,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5330
5676
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5331
5677
|
result: {
|
|
5332
5678
|
queries: part.queries,
|
|
5333
|
-
results: (
|
|
5679
|
+
results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
|
|
5334
5680
|
attributes: result.attributes,
|
|
5335
5681
|
fileId: result.file_id,
|
|
5336
5682
|
filename: result.filename,
|
|
5337
5683
|
score: result.score,
|
|
5338
5684
|
text: result.text
|
|
5339
|
-
}))) != null ?
|
|
5685
|
+
}))) != null ? _y : null
|
|
5340
5686
|
}
|
|
5341
5687
|
});
|
|
5342
5688
|
break;
|
|
@@ -5379,6 +5725,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5379
5725
|
});
|
|
5380
5726
|
break;
|
|
5381
5727
|
}
|
|
5728
|
+
case "compaction": {
|
|
5729
|
+
content.push({
|
|
5730
|
+
type: "custom",
|
|
5731
|
+
kind: "openai.compaction",
|
|
5732
|
+
providerMetadata: {
|
|
5733
|
+
[providerOptionsName]: {
|
|
5734
|
+
type: "compaction",
|
|
5735
|
+
itemId: part.id,
|
|
5736
|
+
encryptedContent: part.encrypted_content
|
|
5737
|
+
}
|
|
5738
|
+
}
|
|
5739
|
+
});
|
|
5740
|
+
break;
|
|
5741
|
+
}
|
|
5382
5742
|
}
|
|
5383
5743
|
}
|
|
5384
5744
|
const providerMetadata = {
|
|
@@ -5393,10 +5753,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5393
5753
|
content,
|
|
5394
5754
|
finishReason: {
|
|
5395
5755
|
unified: mapOpenAIResponseFinishReason({
|
|
5396
|
-
finishReason: (
|
|
5756
|
+
finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
|
|
5397
5757
|
hasFunctionCall
|
|
5398
5758
|
}),
|
|
5399
|
-
raw: (
|
|
5759
|
+
raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
|
|
5400
5760
|
},
|
|
5401
5761
|
usage: convertOpenAIResponsesUsage(usage),
|
|
5402
5762
|
request: { body },
|
|
@@ -5454,6 +5814,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5454
5814
|
let hasFunctionCall = false;
|
|
5455
5815
|
const activeReasoning = {};
|
|
5456
5816
|
let serviceTier;
|
|
5817
|
+
const hostedToolSearchCallIds = [];
|
|
5457
5818
|
return {
|
|
5458
5819
|
stream: response.pipeThrough(
|
|
5459
5820
|
new TransformStream({
|
|
@@ -5461,7 +5822,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5461
5822
|
controller.enqueue({ type: "stream-start", warnings });
|
|
5462
5823
|
},
|
|
5463
5824
|
transform(chunk, controller) {
|
|
5464
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
5825
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
|
|
5465
5826
|
if (options.includeRawChunks) {
|
|
5466
5827
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
5467
5828
|
}
|
|
@@ -5569,6 +5930,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5569
5930
|
input: "{}",
|
|
5570
5931
|
providerExecuted: true
|
|
5571
5932
|
});
|
|
5933
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5934
|
+
const toolCallId = value.item.id;
|
|
5935
|
+
const toolName = toolNameMapping.toCustomToolName("tool_search");
|
|
5936
|
+
const isHosted = value.item.execution === "server";
|
|
5937
|
+
ongoingToolCalls[value.output_index] = {
|
|
5938
|
+
toolName,
|
|
5939
|
+
toolCallId,
|
|
5940
|
+
toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
|
|
5941
|
+
};
|
|
5942
|
+
if (isHosted) {
|
|
5943
|
+
controller.enqueue({
|
|
5944
|
+
type: "tool-input-start",
|
|
5945
|
+
id: toolCallId,
|
|
5946
|
+
toolName,
|
|
5947
|
+
providerExecuted: true
|
|
5948
|
+
});
|
|
5949
|
+
}
|
|
5950
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5572
5951
|
} else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
|
|
5573
5952
|
} else if (value.item.type === "apply_patch_call") {
|
|
5574
5953
|
const { call_id: callId, operation } = value.item;
|
|
@@ -5615,7 +5994,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5615
5994
|
} else if (value.item.type === "shell_call_output") {
|
|
5616
5995
|
} else if (value.item.type === "message") {
|
|
5617
5996
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
5618
|
-
activeMessagePhase = (
|
|
5997
|
+
activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
|
|
5619
5998
|
controller.enqueue({
|
|
5620
5999
|
type: "text-start",
|
|
5621
6000
|
id: value.item.id,
|
|
@@ -5639,14 +6018,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5639
6018
|
providerMetadata: {
|
|
5640
6019
|
[providerOptionsName]: {
|
|
5641
6020
|
itemId: value.item.id,
|
|
5642
|
-
reasoningEncryptedContent: (
|
|
6021
|
+
reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
|
|
5643
6022
|
}
|
|
5644
6023
|
}
|
|
5645
6024
|
});
|
|
5646
6025
|
}
|
|
5647
6026
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
5648
6027
|
if (value.item.type === "message") {
|
|
5649
|
-
const phase = (
|
|
6028
|
+
const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
|
|
5650
6029
|
activeMessagePhase = void 0;
|
|
5651
6030
|
controller.enqueue({
|
|
5652
6031
|
type: "text-end",
|
|
@@ -5740,13 +6119,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5740
6119
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5741
6120
|
result: {
|
|
5742
6121
|
queries: value.item.queries,
|
|
5743
|
-
results: (
|
|
6122
|
+
results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
|
|
5744
6123
|
attributes: result.attributes,
|
|
5745
6124
|
fileId: result.file_id,
|
|
5746
6125
|
filename: result.filename,
|
|
5747
6126
|
score: result.score,
|
|
5748
6127
|
text: result.text
|
|
5749
|
-
}))) != null ?
|
|
6128
|
+
}))) != null ? _f : null
|
|
5750
6129
|
}
|
|
5751
6130
|
});
|
|
5752
6131
|
} else if (value.item.type === "code_interpreter_call") {
|
|
@@ -5768,12 +6147,62 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5768
6147
|
result: value.item.result
|
|
5769
6148
|
}
|
|
5770
6149
|
});
|
|
6150
|
+
} else if (value.item.type === "tool_search_call") {
|
|
6151
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
6152
|
+
const isHosted = value.item.execution === "server";
|
|
6153
|
+
if (toolCall != null) {
|
|
6154
|
+
const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
|
|
6155
|
+
if (isHosted) {
|
|
6156
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
6157
|
+
} else {
|
|
6158
|
+
controller.enqueue({
|
|
6159
|
+
type: "tool-input-start",
|
|
6160
|
+
id: toolCallId,
|
|
6161
|
+
toolName: toolCall.toolName
|
|
6162
|
+
});
|
|
6163
|
+
}
|
|
6164
|
+
controller.enqueue({
|
|
6165
|
+
type: "tool-input-end",
|
|
6166
|
+
id: toolCallId
|
|
6167
|
+
});
|
|
6168
|
+
controller.enqueue({
|
|
6169
|
+
type: "tool-call",
|
|
6170
|
+
toolCallId,
|
|
6171
|
+
toolName: toolCall.toolName,
|
|
6172
|
+
input: JSON.stringify({
|
|
6173
|
+
arguments: value.item.arguments,
|
|
6174
|
+
call_id: isHosted ? null : toolCallId
|
|
6175
|
+
}),
|
|
6176
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
6177
|
+
providerMetadata: {
|
|
6178
|
+
[providerOptionsName]: {
|
|
6179
|
+
itemId: value.item.id
|
|
6180
|
+
}
|
|
6181
|
+
}
|
|
6182
|
+
});
|
|
6183
|
+
}
|
|
6184
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
6185
|
+
} else if (value.item.type === "tool_search_output") {
|
|
6186
|
+
const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
|
|
6187
|
+
controller.enqueue({
|
|
6188
|
+
type: "tool-result",
|
|
6189
|
+
toolCallId,
|
|
6190
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
6191
|
+
result: {
|
|
6192
|
+
tools: value.item.tools
|
|
6193
|
+
},
|
|
6194
|
+
providerMetadata: {
|
|
6195
|
+
[providerOptionsName]: {
|
|
6196
|
+
itemId: value.item.id
|
|
6197
|
+
}
|
|
6198
|
+
}
|
|
6199
|
+
});
|
|
5771
6200
|
} else if (value.item.type === "mcp_call") {
|
|
5772
6201
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5773
|
-
const approvalRequestId = (
|
|
5774
|
-
const aliasedToolCallId = approvalRequestId != null ? (
|
|
6202
|
+
const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
|
|
6203
|
+
const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
5775
6204
|
approvalRequestId
|
|
5776
|
-
)) != null ?
|
|
6205
|
+
)) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
|
|
5777
6206
|
const toolName = `mcp.${value.item.name}`;
|
|
5778
6207
|
controller.enqueue({
|
|
5779
6208
|
type: "tool-call",
|
|
@@ -5843,8 +6272,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5843
6272
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5844
6273
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5845
6274
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5846
|
-
const dummyToolCallId = (
|
|
5847
|
-
const approvalRequestId = (
|
|
6275
|
+
const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2();
|
|
6276
|
+
const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
|
|
5848
6277
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5849
6278
|
approvalRequestId,
|
|
5850
6279
|
dummyToolCallId
|
|
@@ -5933,12 +6362,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5933
6362
|
providerMetadata: {
|
|
5934
6363
|
[providerOptionsName]: {
|
|
5935
6364
|
itemId: value.item.id,
|
|
5936
|
-
reasoningEncryptedContent: (
|
|
6365
|
+
reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
|
|
5937
6366
|
}
|
|
5938
6367
|
}
|
|
5939
6368
|
});
|
|
5940
6369
|
}
|
|
5941
6370
|
delete activeReasoning[value.item.id];
|
|
6371
|
+
} else if (value.item.type === "compaction") {
|
|
6372
|
+
controller.enqueue({
|
|
6373
|
+
type: "custom",
|
|
6374
|
+
kind: "openai.compaction",
|
|
6375
|
+
providerMetadata: {
|
|
6376
|
+
[providerOptionsName]: {
|
|
6377
|
+
type: "compaction",
|
|
6378
|
+
itemId: value.item.id,
|
|
6379
|
+
encryptedContent: value.item.encrypted_content
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
});
|
|
5942
6383
|
}
|
|
5943
6384
|
} else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
|
|
5944
6385
|
const toolCall = ongoingToolCalls[value.output_index];
|
|
@@ -6046,7 +6487,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6046
6487
|
id: value.item_id,
|
|
6047
6488
|
delta: value.delta
|
|
6048
6489
|
});
|
|
6049
|
-
if (((
|
|
6490
|
+
if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
|
|
6050
6491
|
logprobs.push(value.logprobs);
|
|
6051
6492
|
}
|
|
6052
6493
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -6075,7 +6516,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6075
6516
|
providerMetadata: {
|
|
6076
6517
|
[providerOptionsName]: {
|
|
6077
6518
|
itemId: value.item_id,
|
|
6078
|
-
reasoningEncryptedContent: (
|
|
6519
|
+
reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
|
|
6079
6520
|
}
|
|
6080
6521
|
}
|
|
6081
6522
|
});
|
|
@@ -6109,22 +6550,32 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6109
6550
|
} else if (isResponseFinishedChunk(value)) {
|
|
6110
6551
|
finishReason = {
|
|
6111
6552
|
unified: mapOpenAIResponseFinishReason({
|
|
6112
|
-
finishReason: (
|
|
6553
|
+
finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
|
|
6113
6554
|
hasFunctionCall
|
|
6114
6555
|
}),
|
|
6115
|
-
raw: (
|
|
6556
|
+
raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
|
|
6116
6557
|
};
|
|
6117
6558
|
usage = value.response.usage;
|
|
6118
6559
|
if (typeof value.response.service_tier === "string") {
|
|
6119
6560
|
serviceTier = value.response.service_tier;
|
|
6120
6561
|
}
|
|
6562
|
+
} else if (isResponseFailedChunk(value)) {
|
|
6563
|
+
const incompleteReason = (_y = value.response.incomplete_details) == null ? void 0 : _y.reason;
|
|
6564
|
+
finishReason = {
|
|
6565
|
+
unified: incompleteReason ? mapOpenAIResponseFinishReason({
|
|
6566
|
+
finishReason: incompleteReason,
|
|
6567
|
+
hasFunctionCall
|
|
6568
|
+
}) : "error",
|
|
6569
|
+
raw: incompleteReason != null ? incompleteReason : "error"
|
|
6570
|
+
};
|
|
6571
|
+
usage = (_z = value.response.usage) != null ? _z : void 0;
|
|
6121
6572
|
} else if (isResponseAnnotationAddedChunk(value)) {
|
|
6122
6573
|
ongoingAnnotations.push(value.annotation);
|
|
6123
6574
|
if (value.annotation.type === "url_citation") {
|
|
6124
6575
|
controller.enqueue({
|
|
6125
6576
|
type: "source",
|
|
6126
6577
|
sourceType: "url",
|
|
6127
|
-
id: (
|
|
6578
|
+
id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId2(),
|
|
6128
6579
|
url: value.annotation.url,
|
|
6129
6580
|
title: value.annotation.title
|
|
6130
6581
|
});
|
|
@@ -6132,7 +6583,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6132
6583
|
controller.enqueue({
|
|
6133
6584
|
type: "source",
|
|
6134
6585
|
sourceType: "document",
|
|
6135
|
-
id: (
|
|
6586
|
+
id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : generateId2(),
|
|
6136
6587
|
mediaType: "text/plain",
|
|
6137
6588
|
title: value.annotation.filename,
|
|
6138
6589
|
filename: value.annotation.filename,
|
|
@@ -6148,7 +6599,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6148
6599
|
controller.enqueue({
|
|
6149
6600
|
type: "source",
|
|
6150
6601
|
sourceType: "document",
|
|
6151
|
-
id: (
|
|
6602
|
+
id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : generateId2(),
|
|
6152
6603
|
mediaType: "text/plain",
|
|
6153
6604
|
title: value.annotation.filename,
|
|
6154
6605
|
filename: value.annotation.filename,
|
|
@@ -6164,7 +6615,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6164
6615
|
controller.enqueue({
|
|
6165
6616
|
type: "source",
|
|
6166
6617
|
sourceType: "document",
|
|
6167
|
-
id: (
|
|
6618
|
+
id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : generateId2(),
|
|
6168
6619
|
mediaType: "application/octet-stream",
|
|
6169
6620
|
title: value.annotation.file_id,
|
|
6170
6621
|
filename: value.annotation.file_id,
|
|
@@ -6212,6 +6663,9 @@ function isResponseOutputItemDoneChunk(chunk) {
|
|
|
6212
6663
|
function isResponseFinishedChunk(chunk) {
|
|
6213
6664
|
return chunk.type === "response.completed" || chunk.type === "response.incomplete";
|
|
6214
6665
|
}
|
|
6666
|
+
function isResponseFailedChunk(chunk) {
|
|
6667
|
+
return chunk.type === "response.failed";
|
|
6668
|
+
}
|
|
6215
6669
|
function isResponseCreatedChunk(chunk) {
|
|
6216
6670
|
return chunk.type === "response.created";
|
|
6217
6671
|
}
|