@ai-sdk/openai 4.0.0-beta.1 → 4.0.0-beta.10
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 +137 -0
- package/dist/index.d.mts +69 -22
- package/dist/index.d.ts +69 -22
- package/dist/index.js +1169 -873
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1123 -822
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +56 -28
- package/dist/internal/index.d.ts +56 -28
- package/dist/internal/index.js +1198 -912
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1180 -889
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +142 -3
- package/package.json +3 -3
- package/src/chat/convert-openai-chat-usage.ts +2 -2
- package/src/chat/convert-to-openai-chat-messages.ts +5 -5
- package/src/chat/map-openai-finish-reason.ts +2 -2
- package/src/chat/openai-chat-language-model.ts +22 -22
- package/src/chat/openai-chat-options.ts +1 -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/image/openai-image-model.ts +9 -9
- package/src/openai-language-model-capabilities.ts +1 -0
- package/src/openai-provider.ts +21 -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 +116 -12
- package/src/responses/map-openai-responses-finish-reason.ts +2 -2
- package/src/responses/openai-responses-api.ts +87 -1
- package/src/responses/openai-responses-language-model.ts +168 -33
- package/src/responses/openai-responses-options.ts +4 -2
- package/src/responses/openai-responses-prepare-tools.ts +34 -9
- 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.js
CHANGED
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/internal/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
OpenAIChatLanguageModel: () => OpenAIChatLanguageModel,
|
|
24
24
|
OpenAICompletionLanguageModel: () => OpenAICompletionLanguageModel,
|
|
25
25
|
OpenAIEmbeddingModel: () => OpenAIEmbeddingModel,
|
|
@@ -54,7 +54,7 @@ __export(internal_exports, {
|
|
|
54
54
|
webSearchPreviewArgsSchema: () => webSearchPreviewArgsSchema,
|
|
55
55
|
webSearchPreviewInputSchema: () => webSearchPreviewInputSchema
|
|
56
56
|
});
|
|
57
|
-
module.exports = __toCommonJS(
|
|
57
|
+
module.exports = __toCommonJS(index_exports);
|
|
58
58
|
|
|
59
59
|
// src/chat/openai-chat-language-model.ts
|
|
60
60
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -84,7 +84,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
84
84
|
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
85
85
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
86
86
|
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
87
|
-
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.4");
|
|
87
|
+
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
|
|
88
88
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
89
89
|
return {
|
|
90
90
|
supportsFlexProcessing,
|
|
@@ -675,7 +675,7 @@ function prepareChatTools({
|
|
|
675
675
|
// src/chat/openai-chat-language-model.ts
|
|
676
676
|
var OpenAIChatLanguageModel = class {
|
|
677
677
|
constructor(modelId, config) {
|
|
678
|
-
this.specificationVersion = "
|
|
678
|
+
this.specificationVersion = "v4";
|
|
679
679
|
this.supportedUrls = {
|
|
680
680
|
"image/*": [/^https?:\/\/.*$/]
|
|
681
681
|
};
|
|
@@ -1410,7 +1410,7 @@ var openaiLanguageModelCompletionOptions = (0, import_provider_utils7.lazySchema
|
|
|
1410
1410
|
// src/completion/openai-completion-language-model.ts
|
|
1411
1411
|
var OpenAICompletionLanguageModel = class {
|
|
1412
1412
|
constructor(modelId, config) {
|
|
1413
|
-
this.specificationVersion = "
|
|
1413
|
+
this.specificationVersion = "v4";
|
|
1414
1414
|
this.supportedUrls = {
|
|
1415
1415
|
// No URLs are supported for completion models.
|
|
1416
1416
|
};
|
|
@@ -1675,7 +1675,7 @@ var openaiTextEmbeddingResponseSchema = (0, import_provider_utils10.lazySchema)(
|
|
|
1675
1675
|
// src/embedding/openai-embedding-model.ts
|
|
1676
1676
|
var OpenAIEmbeddingModel = class {
|
|
1677
1677
|
constructor(modelId, config) {
|
|
1678
|
-
this.specificationVersion = "
|
|
1678
|
+
this.specificationVersion = "v4";
|
|
1679
1679
|
this.maxEmbeddingsPerCall = 2048;
|
|
1680
1680
|
this.supportsParallelCalls = true;
|
|
1681
1681
|
this.modelId = modelId;
|
|
@@ -1796,7 +1796,7 @@ var OpenAIImageModel = class {
|
|
|
1796
1796
|
constructor(modelId, config) {
|
|
1797
1797
|
this.modelId = modelId;
|
|
1798
1798
|
this.config = config;
|
|
1799
|
-
this.specificationVersion = "
|
|
1799
|
+
this.specificationVersion = "v4";
|
|
1800
1800
|
}
|
|
1801
1801
|
get maxImagesPerCall() {
|
|
1802
1802
|
var _a;
|
|
@@ -2117,7 +2117,7 @@ var OpenAITranscriptionModel = class {
|
|
|
2117
2117
|
constructor(modelId, config) {
|
|
2118
2118
|
this.modelId = modelId;
|
|
2119
2119
|
this.config = config;
|
|
2120
|
-
this.specificationVersion = "
|
|
2120
|
+
this.specificationVersion = "v4";
|
|
2121
2121
|
}
|
|
2122
2122
|
get provider() {
|
|
2123
2123
|
return this.config.provider;
|
|
@@ -2240,7 +2240,7 @@ var OpenAISpeechModel = class {
|
|
|
2240
2240
|
constructor(modelId, config) {
|
|
2241
2241
|
this.modelId = modelId;
|
|
2242
2242
|
this.config = config;
|
|
2243
|
-
this.specificationVersion = "
|
|
2243
|
+
this.specificationVersion = "v4";
|
|
2244
2244
|
}
|
|
2245
2245
|
get provider() {
|
|
2246
2246
|
return this.config.provider;
|
|
@@ -2338,7 +2338,7 @@ var OpenAISpeechModel = class {
|
|
|
2338
2338
|
|
|
2339
2339
|
// src/responses/openai-responses-language-model.ts
|
|
2340
2340
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2341
|
-
var
|
|
2341
|
+
var import_provider_utils34 = require("@ai-sdk/provider-utils");
|
|
2342
2342
|
|
|
2343
2343
|
// src/responses/convert-openai-responses-usage.ts
|
|
2344
2344
|
function convertOpenAIResponsesUsage(usage) {
|
|
@@ -2381,8 +2381,8 @@ function convertOpenAIResponsesUsage(usage) {
|
|
|
2381
2381
|
|
|
2382
2382
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2383
2383
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2384
|
-
var
|
|
2385
|
-
var
|
|
2384
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2385
|
+
var import_v416 = require("zod/v4");
|
|
2386
2386
|
|
|
2387
2387
|
// src/tool/apply-patch.ts
|
|
2388
2388
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
@@ -2549,6 +2549,39 @@ var shell = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchem
|
|
|
2549
2549
|
outputSchema: shellOutputSchema
|
|
2550
2550
|
});
|
|
2551
2551
|
|
|
2552
|
+
// src/tool/tool-search.ts
|
|
2553
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2554
|
+
var import_v415 = require("zod/v4");
|
|
2555
|
+
var toolSearchArgsSchema = (0, import_provider_utils22.lazySchema)(
|
|
2556
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2557
|
+
import_v415.z.object({
|
|
2558
|
+
execution: import_v415.z.enum(["server", "client"]).optional(),
|
|
2559
|
+
description: import_v415.z.string().optional(),
|
|
2560
|
+
parameters: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()).optional()
|
|
2561
|
+
})
|
|
2562
|
+
)
|
|
2563
|
+
);
|
|
2564
|
+
var toolSearchInputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2565
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2566
|
+
import_v415.z.object({
|
|
2567
|
+
arguments: import_v415.z.unknown().optional(),
|
|
2568
|
+
call_id: import_v415.z.string().nullish()
|
|
2569
|
+
})
|
|
2570
|
+
)
|
|
2571
|
+
);
|
|
2572
|
+
var toolSearchOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2573
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2574
|
+
import_v415.z.object({
|
|
2575
|
+
tools: import_v415.z.array(import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()))
|
|
2576
|
+
})
|
|
2577
|
+
)
|
|
2578
|
+
);
|
|
2579
|
+
var toolSearchToolFactory = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
|
|
2580
|
+
id: "openai.tool_search",
|
|
2581
|
+
inputSchema: toolSearchInputSchema,
|
|
2582
|
+
outputSchema: toolSearchOutputSchema
|
|
2583
|
+
});
|
|
2584
|
+
|
|
2552
2585
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2553
2586
|
function isFileId(data, prefixes) {
|
|
2554
2587
|
if (!prefixes) return false;
|
|
@@ -2567,8 +2600,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2567
2600
|
hasApplyPatchTool = false,
|
|
2568
2601
|
customProviderToolNames
|
|
2569
2602
|
}) {
|
|
2570
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2571
|
-
|
|
2603
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2604
|
+
let input = [];
|
|
2572
2605
|
const warnings = [];
|
|
2573
2606
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2574
2607
|
for (const { role, content } of prompt) {
|
|
@@ -2614,7 +2647,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2614
2647
|
return {
|
|
2615
2648
|
type: "input_image",
|
|
2616
2649
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2617
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2650
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils23.convertToBase64)(part.data)}`
|
|
2618
2651
|
},
|
|
2619
2652
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
|
|
2620
2653
|
};
|
|
@@ -2629,7 +2662,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2629
2662
|
type: "input_file",
|
|
2630
2663
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2631
2664
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2632
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2665
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils23.convertToBase64)(part.data)}`
|
|
2633
2666
|
}
|
|
2634
2667
|
};
|
|
2635
2668
|
} else {
|
|
@@ -2671,6 +2704,32 @@ async function convertToOpenAIResponsesInput({
|
|
|
2671
2704
|
if (hasConversation && id != null) {
|
|
2672
2705
|
break;
|
|
2673
2706
|
}
|
|
2707
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2708
|
+
part.toolName
|
|
2709
|
+
);
|
|
2710
|
+
if (resolvedToolName === "tool_search") {
|
|
2711
|
+
if (store && id != null) {
|
|
2712
|
+
input.push({ type: "item_reference", id });
|
|
2713
|
+
break;
|
|
2714
|
+
}
|
|
2715
|
+
const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils23.parseJSON)({
|
|
2716
|
+
text: part.input,
|
|
2717
|
+
schema: toolSearchInputSchema
|
|
2718
|
+
}) : await (0, import_provider_utils23.validateTypes)({
|
|
2719
|
+
value: part.input,
|
|
2720
|
+
schema: toolSearchInputSchema
|
|
2721
|
+
});
|
|
2722
|
+
const execution = parsedInput.call_id != null ? "client" : "server";
|
|
2723
|
+
input.push({
|
|
2724
|
+
type: "tool_search_call",
|
|
2725
|
+
id: id != null ? id : part.toolCallId,
|
|
2726
|
+
execution,
|
|
2727
|
+
call_id: (_g = parsedInput.call_id) != null ? _g : null,
|
|
2728
|
+
status: "completed",
|
|
2729
|
+
arguments: parsedInput.arguments
|
|
2730
|
+
});
|
|
2731
|
+
break;
|
|
2732
|
+
}
|
|
2674
2733
|
if (part.providerExecuted) {
|
|
2675
2734
|
if (store && id != null) {
|
|
2676
2735
|
input.push({ type: "item_reference", id });
|
|
@@ -2681,11 +2740,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2681
2740
|
input.push({ type: "item_reference", id });
|
|
2682
2741
|
break;
|
|
2683
2742
|
}
|
|
2684
|
-
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2685
|
-
part.toolName
|
|
2686
|
-
);
|
|
2687
2743
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2688
|
-
const parsedInput = await (0,
|
|
2744
|
+
const parsedInput = await (0, import_provider_utils23.validateTypes)({
|
|
2689
2745
|
value: part.input,
|
|
2690
2746
|
schema: localShellInputSchema
|
|
2691
2747
|
});
|
|
@@ -2705,7 +2761,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2705
2761
|
break;
|
|
2706
2762
|
}
|
|
2707
2763
|
if (hasShellTool && resolvedToolName === "shell") {
|
|
2708
|
-
const parsedInput = await (0,
|
|
2764
|
+
const parsedInput = await (0, import_provider_utils23.validateTypes)({
|
|
2709
2765
|
value: part.input,
|
|
2710
2766
|
schema: shellInputSchema
|
|
2711
2767
|
});
|
|
@@ -2723,7 +2779,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2723
2779
|
break;
|
|
2724
2780
|
}
|
|
2725
2781
|
if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
|
|
2726
|
-
const parsedInput = await (0,
|
|
2782
|
+
const parsedInput = await (0, import_provider_utils23.validateTypes)({
|
|
2727
2783
|
value: part.input,
|
|
2728
2784
|
schema: applyPatchInputSchema
|
|
2729
2785
|
});
|
|
@@ -2766,9 +2822,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2766
2822
|
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
2767
2823
|
part.toolName
|
|
2768
2824
|
);
|
|
2825
|
+
if (resolvedResultToolName === "tool_search") {
|
|
2826
|
+
const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2827
|
+
if (store) {
|
|
2828
|
+
input.push({ type: "item_reference", id: itemId });
|
|
2829
|
+
} else if (part.output.type === "json") {
|
|
2830
|
+
const parsedOutput = await (0, import_provider_utils23.validateTypes)({
|
|
2831
|
+
value: part.output.value,
|
|
2832
|
+
schema: toolSearchOutputSchema
|
|
2833
|
+
});
|
|
2834
|
+
input.push({
|
|
2835
|
+
type: "tool_search_output",
|
|
2836
|
+
id: itemId,
|
|
2837
|
+
execution: "server",
|
|
2838
|
+
call_id: null,
|
|
2839
|
+
status: "completed",
|
|
2840
|
+
tools: parsedOutput.tools
|
|
2841
|
+
});
|
|
2842
|
+
}
|
|
2843
|
+
break;
|
|
2844
|
+
}
|
|
2769
2845
|
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2770
2846
|
if (part.output.type === "json") {
|
|
2771
|
-
const parsedOutput = await (0,
|
|
2847
|
+
const parsedOutput = await (0, import_provider_utils23.validateTypes)({
|
|
2772
2848
|
value: part.output.value,
|
|
2773
2849
|
schema: shellOutputSchema
|
|
2774
2850
|
});
|
|
@@ -2788,7 +2864,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2788
2864
|
break;
|
|
2789
2865
|
}
|
|
2790
2866
|
if (store) {
|
|
2791
|
-
const itemId = (
|
|
2867
|
+
const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
|
|
2792
2868
|
input.push({ type: "item_reference", id: itemId });
|
|
2793
2869
|
} else {
|
|
2794
2870
|
warnings.push({
|
|
@@ -2799,7 +2875,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2799
2875
|
break;
|
|
2800
2876
|
}
|
|
2801
2877
|
case "reasoning": {
|
|
2802
|
-
const providerOptions = await (0,
|
|
2878
|
+
const providerOptions = await (0, import_provider_utils23.parseProviderOptions)({
|
|
2803
2879
|
provider: providerOptionsName,
|
|
2804
2880
|
providerOptions: part.providerOptions,
|
|
2805
2881
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2898,7 +2974,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2898
2974
|
}
|
|
2899
2975
|
const output = part.output;
|
|
2900
2976
|
if (output.type === "execution-denied") {
|
|
2901
|
-
const approvalId = (
|
|
2977
|
+
const approvalId = (_o = (_n = output.providerOptions) == null ? void 0 : _n.openai) == null ? void 0 : _o.approvalId;
|
|
2902
2978
|
if (approvalId) {
|
|
2903
2979
|
continue;
|
|
2904
2980
|
}
|
|
@@ -2906,8 +2982,22 @@ async function convertToOpenAIResponsesInput({
|
|
|
2906
2982
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2907
2983
|
part.toolName
|
|
2908
2984
|
);
|
|
2985
|
+
if (resolvedToolName === "tool_search" && output.type === "json") {
|
|
2986
|
+
const parsedOutput = await (0, import_provider_utils23.validateTypes)({
|
|
2987
|
+
value: output.value,
|
|
2988
|
+
schema: toolSearchOutputSchema
|
|
2989
|
+
});
|
|
2990
|
+
input.push({
|
|
2991
|
+
type: "tool_search_output",
|
|
2992
|
+
execution: "client",
|
|
2993
|
+
call_id: part.toolCallId,
|
|
2994
|
+
status: "completed",
|
|
2995
|
+
tools: parsedOutput.tools
|
|
2996
|
+
});
|
|
2997
|
+
continue;
|
|
2998
|
+
}
|
|
2909
2999
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2910
|
-
const parsedOutput = await (0,
|
|
3000
|
+
const parsedOutput = await (0, import_provider_utils23.validateTypes)({
|
|
2911
3001
|
value: output.value,
|
|
2912
3002
|
schema: localShellOutputSchema
|
|
2913
3003
|
});
|
|
@@ -2919,7 +3009,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2919
3009
|
continue;
|
|
2920
3010
|
}
|
|
2921
3011
|
if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
|
|
2922
|
-
const parsedOutput = await (0,
|
|
3012
|
+
const parsedOutput = await (0, import_provider_utils23.validateTypes)({
|
|
2923
3013
|
value: output.value,
|
|
2924
3014
|
schema: shellOutputSchema
|
|
2925
3015
|
});
|
|
@@ -2938,7 +3028,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2938
3028
|
continue;
|
|
2939
3029
|
}
|
|
2940
3030
|
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
2941
|
-
const parsedOutput = await (0,
|
|
3031
|
+
const parsedOutput = await (0, import_provider_utils23.validateTypes)({
|
|
2942
3032
|
value: output.value,
|
|
2943
3033
|
schema: applyPatchOutputSchema
|
|
2944
3034
|
});
|
|
@@ -2958,7 +3048,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2958
3048
|
outputValue = output.value;
|
|
2959
3049
|
break;
|
|
2960
3050
|
case "execution-denied":
|
|
2961
|
-
outputValue = (
|
|
3051
|
+
outputValue = (_p = output.reason) != null ? _p : "Tool execution denied.";
|
|
2962
3052
|
break;
|
|
2963
3053
|
case "json":
|
|
2964
3054
|
case "error-json":
|
|
@@ -2993,7 +3083,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2993
3083
|
});
|
|
2994
3084
|
return void 0;
|
|
2995
3085
|
}
|
|
2996
|
-
}).filter(
|
|
3086
|
+
}).filter(import_provider_utils23.isNonNullable);
|
|
2997
3087
|
break;
|
|
2998
3088
|
default:
|
|
2999
3089
|
outputValue = "";
|
|
@@ -3012,7 +3102,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3012
3102
|
contentValue = output.value;
|
|
3013
3103
|
break;
|
|
3014
3104
|
case "execution-denied":
|
|
3015
|
-
contentValue = (
|
|
3105
|
+
contentValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
|
|
3016
3106
|
break;
|
|
3017
3107
|
case "json":
|
|
3018
3108
|
case "error-json":
|
|
@@ -3052,7 +3142,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3052
3142
|
return void 0;
|
|
3053
3143
|
}
|
|
3054
3144
|
}
|
|
3055
|
-
}).filter(
|
|
3145
|
+
}).filter(import_provider_utils23.isNonNullable);
|
|
3056
3146
|
break;
|
|
3057
3147
|
}
|
|
3058
3148
|
input.push({
|
|
@@ -3069,11 +3159,22 @@ async function convertToOpenAIResponsesInput({
|
|
|
3069
3159
|
}
|
|
3070
3160
|
}
|
|
3071
3161
|
}
|
|
3162
|
+
if (!store && input.some(
|
|
3163
|
+
(item) => "type" in item && item.type === "reasoning" && item.encrypted_content == null
|
|
3164
|
+
)) {
|
|
3165
|
+
warnings.push({
|
|
3166
|
+
type: "other",
|
|
3167
|
+
message: "Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts."
|
|
3168
|
+
});
|
|
3169
|
+
input = input.filter(
|
|
3170
|
+
(item) => !("type" in item) || item.type !== "reasoning" || item.encrypted_content != null
|
|
3171
|
+
);
|
|
3172
|
+
}
|
|
3072
3173
|
return { input, warnings };
|
|
3073
3174
|
}
|
|
3074
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3075
|
-
itemId:
|
|
3076
|
-
reasoningEncryptedContent:
|
|
3175
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v416.z.object({
|
|
3176
|
+
itemId: import_v416.z.string().nullish(),
|
|
3177
|
+
reasoningEncryptedContent: import_v416.z.string().nullish()
|
|
3077
3178
|
});
|
|
3078
3179
|
|
|
3079
3180
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3095,483 +3196,525 @@ function mapOpenAIResponseFinishReason({
|
|
|
3095
3196
|
}
|
|
3096
3197
|
|
|
3097
3198
|
// src/responses/openai-responses-api.ts
|
|
3098
|
-
var
|
|
3099
|
-
var
|
|
3100
|
-
var
|
|
3101
|
-
() =>
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3199
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
3200
|
+
var import_v417 = require("zod/v4");
|
|
3201
|
+
var jsonValueSchema = import_v417.z.lazy(
|
|
3202
|
+
() => import_v417.z.union([
|
|
3203
|
+
import_v417.z.string(),
|
|
3204
|
+
import_v417.z.number(),
|
|
3205
|
+
import_v417.z.boolean(),
|
|
3206
|
+
import_v417.z.null(),
|
|
3207
|
+
import_v417.z.array(jsonValueSchema),
|
|
3208
|
+
import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional())
|
|
3209
|
+
])
|
|
3210
|
+
);
|
|
3211
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
3212
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3213
|
+
import_v417.z.union([
|
|
3214
|
+
import_v417.z.object({
|
|
3215
|
+
type: import_v417.z.literal("response.output_text.delta"),
|
|
3216
|
+
item_id: import_v417.z.string(),
|
|
3217
|
+
delta: import_v417.z.string(),
|
|
3218
|
+
logprobs: import_v417.z.array(
|
|
3219
|
+
import_v417.z.object({
|
|
3220
|
+
token: import_v417.z.string(),
|
|
3221
|
+
logprob: import_v417.z.number(),
|
|
3222
|
+
top_logprobs: import_v417.z.array(
|
|
3223
|
+
import_v417.z.object({
|
|
3224
|
+
token: import_v417.z.string(),
|
|
3225
|
+
logprob: import_v417.z.number()
|
|
3115
3226
|
})
|
|
3116
3227
|
)
|
|
3117
3228
|
})
|
|
3118
3229
|
).nullish()
|
|
3119
3230
|
}),
|
|
3120
|
-
|
|
3121
|
-
type:
|
|
3122
|
-
response:
|
|
3123
|
-
incomplete_details:
|
|
3124
|
-
usage:
|
|
3125
|
-
input_tokens:
|
|
3126
|
-
input_tokens_details:
|
|
3127
|
-
output_tokens:
|
|
3128
|
-
output_tokens_details:
|
|
3231
|
+
import_v417.z.object({
|
|
3232
|
+
type: import_v417.z.enum(["response.completed", "response.incomplete"]),
|
|
3233
|
+
response: import_v417.z.object({
|
|
3234
|
+
incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
|
|
3235
|
+
usage: import_v417.z.object({
|
|
3236
|
+
input_tokens: import_v417.z.number(),
|
|
3237
|
+
input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
|
|
3238
|
+
output_tokens: import_v417.z.number(),
|
|
3239
|
+
output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
|
|
3129
3240
|
}),
|
|
3130
|
-
service_tier:
|
|
3241
|
+
service_tier: import_v417.z.string().nullish()
|
|
3131
3242
|
})
|
|
3132
3243
|
}),
|
|
3133
|
-
|
|
3134
|
-
type:
|
|
3135
|
-
response:
|
|
3136
|
-
id:
|
|
3137
|
-
created_at:
|
|
3138
|
-
model:
|
|
3139
|
-
service_tier:
|
|
3244
|
+
import_v417.z.object({
|
|
3245
|
+
type: import_v417.z.literal("response.created"),
|
|
3246
|
+
response: import_v417.z.object({
|
|
3247
|
+
id: import_v417.z.string(),
|
|
3248
|
+
created_at: import_v417.z.number(),
|
|
3249
|
+
model: import_v417.z.string(),
|
|
3250
|
+
service_tier: import_v417.z.string().nullish()
|
|
3140
3251
|
})
|
|
3141
3252
|
}),
|
|
3142
|
-
|
|
3143
|
-
type:
|
|
3144
|
-
output_index:
|
|
3145
|
-
item:
|
|
3146
|
-
|
|
3147
|
-
type:
|
|
3148
|
-
id:
|
|
3149
|
-
phase:
|
|
3253
|
+
import_v417.z.object({
|
|
3254
|
+
type: import_v417.z.literal("response.output_item.added"),
|
|
3255
|
+
output_index: import_v417.z.number(),
|
|
3256
|
+
item: import_v417.z.discriminatedUnion("type", [
|
|
3257
|
+
import_v417.z.object({
|
|
3258
|
+
type: import_v417.z.literal("message"),
|
|
3259
|
+
id: import_v417.z.string(),
|
|
3260
|
+
phase: import_v417.z.enum(["commentary", "final_answer"]).nullish()
|
|
3150
3261
|
}),
|
|
3151
|
-
|
|
3152
|
-
type:
|
|
3153
|
-
id:
|
|
3154
|
-
encrypted_content:
|
|
3262
|
+
import_v417.z.object({
|
|
3263
|
+
type: import_v417.z.literal("reasoning"),
|
|
3264
|
+
id: import_v417.z.string(),
|
|
3265
|
+
encrypted_content: import_v417.z.string().nullish()
|
|
3155
3266
|
}),
|
|
3156
|
-
|
|
3157
|
-
type:
|
|
3158
|
-
id:
|
|
3159
|
-
call_id:
|
|
3160
|
-
name:
|
|
3161
|
-
arguments:
|
|
3267
|
+
import_v417.z.object({
|
|
3268
|
+
type: import_v417.z.literal("function_call"),
|
|
3269
|
+
id: import_v417.z.string(),
|
|
3270
|
+
call_id: import_v417.z.string(),
|
|
3271
|
+
name: import_v417.z.string(),
|
|
3272
|
+
arguments: import_v417.z.string()
|
|
3162
3273
|
}),
|
|
3163
|
-
|
|
3164
|
-
type:
|
|
3165
|
-
id:
|
|
3166
|
-
status:
|
|
3274
|
+
import_v417.z.object({
|
|
3275
|
+
type: import_v417.z.literal("web_search_call"),
|
|
3276
|
+
id: import_v417.z.string(),
|
|
3277
|
+
status: import_v417.z.string()
|
|
3167
3278
|
}),
|
|
3168
|
-
|
|
3169
|
-
type:
|
|
3170
|
-
id:
|
|
3171
|
-
status:
|
|
3279
|
+
import_v417.z.object({
|
|
3280
|
+
type: import_v417.z.literal("computer_call"),
|
|
3281
|
+
id: import_v417.z.string(),
|
|
3282
|
+
status: import_v417.z.string()
|
|
3172
3283
|
}),
|
|
3173
|
-
|
|
3174
|
-
type:
|
|
3175
|
-
id:
|
|
3284
|
+
import_v417.z.object({
|
|
3285
|
+
type: import_v417.z.literal("file_search_call"),
|
|
3286
|
+
id: import_v417.z.string()
|
|
3176
3287
|
}),
|
|
3177
|
-
|
|
3178
|
-
type:
|
|
3179
|
-
id:
|
|
3288
|
+
import_v417.z.object({
|
|
3289
|
+
type: import_v417.z.literal("image_generation_call"),
|
|
3290
|
+
id: import_v417.z.string()
|
|
3180
3291
|
}),
|
|
3181
|
-
|
|
3182
|
-
type:
|
|
3183
|
-
id:
|
|
3184
|
-
container_id:
|
|
3185
|
-
code:
|
|
3186
|
-
outputs:
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3292
|
+
import_v417.z.object({
|
|
3293
|
+
type: import_v417.z.literal("code_interpreter_call"),
|
|
3294
|
+
id: import_v417.z.string(),
|
|
3295
|
+
container_id: import_v417.z.string(),
|
|
3296
|
+
code: import_v417.z.string().nullable(),
|
|
3297
|
+
outputs: import_v417.z.array(
|
|
3298
|
+
import_v417.z.discriminatedUnion("type", [
|
|
3299
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
3300
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
3190
3301
|
])
|
|
3191
3302
|
).nullable(),
|
|
3192
|
-
status:
|
|
3303
|
+
status: import_v417.z.string()
|
|
3193
3304
|
}),
|
|
3194
|
-
|
|
3195
|
-
type:
|
|
3196
|
-
id:
|
|
3197
|
-
status:
|
|
3198
|
-
approval_request_id:
|
|
3305
|
+
import_v417.z.object({
|
|
3306
|
+
type: import_v417.z.literal("mcp_call"),
|
|
3307
|
+
id: import_v417.z.string(),
|
|
3308
|
+
status: import_v417.z.string(),
|
|
3309
|
+
approval_request_id: import_v417.z.string().nullish()
|
|
3199
3310
|
}),
|
|
3200
|
-
|
|
3201
|
-
type:
|
|
3202
|
-
id:
|
|
3311
|
+
import_v417.z.object({
|
|
3312
|
+
type: import_v417.z.literal("mcp_list_tools"),
|
|
3313
|
+
id: import_v417.z.string()
|
|
3203
3314
|
}),
|
|
3204
|
-
|
|
3205
|
-
type:
|
|
3206
|
-
id:
|
|
3315
|
+
import_v417.z.object({
|
|
3316
|
+
type: import_v417.z.literal("mcp_approval_request"),
|
|
3317
|
+
id: import_v417.z.string()
|
|
3207
3318
|
}),
|
|
3208
|
-
|
|
3209
|
-
type:
|
|
3210
|
-
id:
|
|
3211
|
-
call_id:
|
|
3212
|
-
status:
|
|
3213
|
-
operation:
|
|
3214
|
-
|
|
3215
|
-
type:
|
|
3216
|
-
path:
|
|
3217
|
-
diff:
|
|
3319
|
+
import_v417.z.object({
|
|
3320
|
+
type: import_v417.z.literal("apply_patch_call"),
|
|
3321
|
+
id: import_v417.z.string(),
|
|
3322
|
+
call_id: import_v417.z.string(),
|
|
3323
|
+
status: import_v417.z.enum(["in_progress", "completed"]),
|
|
3324
|
+
operation: import_v417.z.discriminatedUnion("type", [
|
|
3325
|
+
import_v417.z.object({
|
|
3326
|
+
type: import_v417.z.literal("create_file"),
|
|
3327
|
+
path: import_v417.z.string(),
|
|
3328
|
+
diff: import_v417.z.string()
|
|
3218
3329
|
}),
|
|
3219
|
-
|
|
3220
|
-
type:
|
|
3221
|
-
path:
|
|
3330
|
+
import_v417.z.object({
|
|
3331
|
+
type: import_v417.z.literal("delete_file"),
|
|
3332
|
+
path: import_v417.z.string()
|
|
3222
3333
|
}),
|
|
3223
|
-
|
|
3224
|
-
type:
|
|
3225
|
-
path:
|
|
3226
|
-
diff:
|
|
3334
|
+
import_v417.z.object({
|
|
3335
|
+
type: import_v417.z.literal("update_file"),
|
|
3336
|
+
path: import_v417.z.string(),
|
|
3337
|
+
diff: import_v417.z.string()
|
|
3227
3338
|
})
|
|
3228
3339
|
])
|
|
3229
3340
|
}),
|
|
3230
|
-
|
|
3231
|
-
type:
|
|
3232
|
-
id:
|
|
3233
|
-
call_id:
|
|
3234
|
-
name:
|
|
3235
|
-
input:
|
|
3341
|
+
import_v417.z.object({
|
|
3342
|
+
type: import_v417.z.literal("custom_tool_call"),
|
|
3343
|
+
id: import_v417.z.string(),
|
|
3344
|
+
call_id: import_v417.z.string(),
|
|
3345
|
+
name: import_v417.z.string(),
|
|
3346
|
+
input: import_v417.z.string()
|
|
3236
3347
|
}),
|
|
3237
|
-
|
|
3238
|
-
type:
|
|
3239
|
-
id:
|
|
3240
|
-
call_id:
|
|
3241
|
-
status:
|
|
3242
|
-
action:
|
|
3243
|
-
commands:
|
|
3348
|
+
import_v417.z.object({
|
|
3349
|
+
type: import_v417.z.literal("shell_call"),
|
|
3350
|
+
id: import_v417.z.string(),
|
|
3351
|
+
call_id: import_v417.z.string(),
|
|
3352
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3353
|
+
action: import_v417.z.object({
|
|
3354
|
+
commands: import_v417.z.array(import_v417.z.string())
|
|
3244
3355
|
})
|
|
3245
3356
|
}),
|
|
3246
|
-
|
|
3247
|
-
type:
|
|
3248
|
-
id:
|
|
3249
|
-
call_id:
|
|
3250
|
-
status:
|
|
3251
|
-
output:
|
|
3252
|
-
|
|
3253
|
-
stdout:
|
|
3254
|
-
stderr:
|
|
3255
|
-
outcome:
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
type:
|
|
3259
|
-
exit_code:
|
|
3357
|
+
import_v417.z.object({
|
|
3358
|
+
type: import_v417.z.literal("shell_call_output"),
|
|
3359
|
+
id: import_v417.z.string(),
|
|
3360
|
+
call_id: import_v417.z.string(),
|
|
3361
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3362
|
+
output: import_v417.z.array(
|
|
3363
|
+
import_v417.z.object({
|
|
3364
|
+
stdout: import_v417.z.string(),
|
|
3365
|
+
stderr: import_v417.z.string(),
|
|
3366
|
+
outcome: import_v417.z.discriminatedUnion("type", [
|
|
3367
|
+
import_v417.z.object({ type: import_v417.z.literal("timeout") }),
|
|
3368
|
+
import_v417.z.object({
|
|
3369
|
+
type: import_v417.z.literal("exit"),
|
|
3370
|
+
exit_code: import_v417.z.number()
|
|
3260
3371
|
})
|
|
3261
3372
|
])
|
|
3262
3373
|
})
|
|
3263
3374
|
)
|
|
3375
|
+
}),
|
|
3376
|
+
import_v417.z.object({
|
|
3377
|
+
type: import_v417.z.literal("tool_search_call"),
|
|
3378
|
+
id: import_v417.z.string(),
|
|
3379
|
+
execution: import_v417.z.enum(["server", "client"]),
|
|
3380
|
+
call_id: import_v417.z.string().nullable(),
|
|
3381
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3382
|
+
arguments: import_v417.z.unknown()
|
|
3383
|
+
}),
|
|
3384
|
+
import_v417.z.object({
|
|
3385
|
+
type: import_v417.z.literal("tool_search_output"),
|
|
3386
|
+
id: import_v417.z.string(),
|
|
3387
|
+
execution: import_v417.z.enum(["server", "client"]),
|
|
3388
|
+
call_id: import_v417.z.string().nullable(),
|
|
3389
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3390
|
+
tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
|
|
3264
3391
|
})
|
|
3265
3392
|
])
|
|
3266
3393
|
}),
|
|
3267
|
-
|
|
3268
|
-
type:
|
|
3269
|
-
output_index:
|
|
3270
|
-
item:
|
|
3271
|
-
|
|
3272
|
-
type:
|
|
3273
|
-
id:
|
|
3274
|
-
phase:
|
|
3394
|
+
import_v417.z.object({
|
|
3395
|
+
type: import_v417.z.literal("response.output_item.done"),
|
|
3396
|
+
output_index: import_v417.z.number(),
|
|
3397
|
+
item: import_v417.z.discriminatedUnion("type", [
|
|
3398
|
+
import_v417.z.object({
|
|
3399
|
+
type: import_v417.z.literal("message"),
|
|
3400
|
+
id: import_v417.z.string(),
|
|
3401
|
+
phase: import_v417.z.enum(["commentary", "final_answer"]).nullish()
|
|
3275
3402
|
}),
|
|
3276
|
-
|
|
3277
|
-
type:
|
|
3278
|
-
id:
|
|
3279
|
-
encrypted_content:
|
|
3403
|
+
import_v417.z.object({
|
|
3404
|
+
type: import_v417.z.literal("reasoning"),
|
|
3405
|
+
id: import_v417.z.string(),
|
|
3406
|
+
encrypted_content: import_v417.z.string().nullish()
|
|
3280
3407
|
}),
|
|
3281
|
-
|
|
3282
|
-
type:
|
|
3283
|
-
id:
|
|
3284
|
-
call_id:
|
|
3285
|
-
name:
|
|
3286
|
-
arguments:
|
|
3287
|
-
status:
|
|
3408
|
+
import_v417.z.object({
|
|
3409
|
+
type: import_v417.z.literal("function_call"),
|
|
3410
|
+
id: import_v417.z.string(),
|
|
3411
|
+
call_id: import_v417.z.string(),
|
|
3412
|
+
name: import_v417.z.string(),
|
|
3413
|
+
arguments: import_v417.z.string(),
|
|
3414
|
+
status: import_v417.z.literal("completed")
|
|
3288
3415
|
}),
|
|
3289
|
-
|
|
3290
|
-
type:
|
|
3291
|
-
id:
|
|
3292
|
-
call_id:
|
|
3293
|
-
name:
|
|
3294
|
-
input:
|
|
3295
|
-
status:
|
|
3416
|
+
import_v417.z.object({
|
|
3417
|
+
type: import_v417.z.literal("custom_tool_call"),
|
|
3418
|
+
id: import_v417.z.string(),
|
|
3419
|
+
call_id: import_v417.z.string(),
|
|
3420
|
+
name: import_v417.z.string(),
|
|
3421
|
+
input: import_v417.z.string(),
|
|
3422
|
+
status: import_v417.z.literal("completed")
|
|
3296
3423
|
}),
|
|
3297
|
-
|
|
3298
|
-
type:
|
|
3299
|
-
id:
|
|
3300
|
-
code:
|
|
3301
|
-
container_id:
|
|
3302
|
-
outputs:
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3424
|
+
import_v417.z.object({
|
|
3425
|
+
type: import_v417.z.literal("code_interpreter_call"),
|
|
3426
|
+
id: import_v417.z.string(),
|
|
3427
|
+
code: import_v417.z.string().nullable(),
|
|
3428
|
+
container_id: import_v417.z.string(),
|
|
3429
|
+
outputs: import_v417.z.array(
|
|
3430
|
+
import_v417.z.discriminatedUnion("type", [
|
|
3431
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
3432
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
3306
3433
|
])
|
|
3307
3434
|
).nullable()
|
|
3308
3435
|
}),
|
|
3309
|
-
|
|
3310
|
-
type:
|
|
3311
|
-
id:
|
|
3312
|
-
result:
|
|
3436
|
+
import_v417.z.object({
|
|
3437
|
+
type: import_v417.z.literal("image_generation_call"),
|
|
3438
|
+
id: import_v417.z.string(),
|
|
3439
|
+
result: import_v417.z.string()
|
|
3313
3440
|
}),
|
|
3314
|
-
|
|
3315
|
-
type:
|
|
3316
|
-
id:
|
|
3317
|
-
status:
|
|
3318
|
-
action:
|
|
3319
|
-
|
|
3320
|
-
type:
|
|
3321
|
-
query:
|
|
3322
|
-
sources:
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3441
|
+
import_v417.z.object({
|
|
3442
|
+
type: import_v417.z.literal("web_search_call"),
|
|
3443
|
+
id: import_v417.z.string(),
|
|
3444
|
+
status: import_v417.z.string(),
|
|
3445
|
+
action: import_v417.z.discriminatedUnion("type", [
|
|
3446
|
+
import_v417.z.object({
|
|
3447
|
+
type: import_v417.z.literal("search"),
|
|
3448
|
+
query: import_v417.z.string().nullish(),
|
|
3449
|
+
sources: import_v417.z.array(
|
|
3450
|
+
import_v417.z.discriminatedUnion("type", [
|
|
3451
|
+
import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
|
|
3452
|
+
import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
|
|
3326
3453
|
])
|
|
3327
3454
|
).nullish()
|
|
3328
3455
|
}),
|
|
3329
|
-
|
|
3330
|
-
type:
|
|
3331
|
-
url:
|
|
3456
|
+
import_v417.z.object({
|
|
3457
|
+
type: import_v417.z.literal("open_page"),
|
|
3458
|
+
url: import_v417.z.string().nullish()
|
|
3332
3459
|
}),
|
|
3333
|
-
|
|
3334
|
-
type:
|
|
3335
|
-
url:
|
|
3336
|
-
pattern:
|
|
3460
|
+
import_v417.z.object({
|
|
3461
|
+
type: import_v417.z.literal("find_in_page"),
|
|
3462
|
+
url: import_v417.z.string().nullish(),
|
|
3463
|
+
pattern: import_v417.z.string().nullish()
|
|
3337
3464
|
})
|
|
3338
3465
|
]).nullish()
|
|
3339
3466
|
}),
|
|
3340
|
-
|
|
3341
|
-
type:
|
|
3342
|
-
id:
|
|
3343
|
-
queries:
|
|
3344
|
-
results:
|
|
3345
|
-
|
|
3346
|
-
attributes:
|
|
3347
|
-
|
|
3348
|
-
|
|
3467
|
+
import_v417.z.object({
|
|
3468
|
+
type: import_v417.z.literal("file_search_call"),
|
|
3469
|
+
id: import_v417.z.string(),
|
|
3470
|
+
queries: import_v417.z.array(import_v417.z.string()),
|
|
3471
|
+
results: import_v417.z.array(
|
|
3472
|
+
import_v417.z.object({
|
|
3473
|
+
attributes: import_v417.z.record(
|
|
3474
|
+
import_v417.z.string(),
|
|
3475
|
+
import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
|
|
3349
3476
|
),
|
|
3350
|
-
file_id:
|
|
3351
|
-
filename:
|
|
3352
|
-
score:
|
|
3353
|
-
text:
|
|
3477
|
+
file_id: import_v417.z.string(),
|
|
3478
|
+
filename: import_v417.z.string(),
|
|
3479
|
+
score: import_v417.z.number(),
|
|
3480
|
+
text: import_v417.z.string()
|
|
3354
3481
|
})
|
|
3355
3482
|
).nullish()
|
|
3356
3483
|
}),
|
|
3357
|
-
|
|
3358
|
-
type:
|
|
3359
|
-
id:
|
|
3360
|
-
call_id:
|
|
3361
|
-
action:
|
|
3362
|
-
type:
|
|
3363
|
-
command:
|
|
3364
|
-
timeout_ms:
|
|
3365
|
-
user:
|
|
3366
|
-
working_directory:
|
|
3367
|
-
env:
|
|
3484
|
+
import_v417.z.object({
|
|
3485
|
+
type: import_v417.z.literal("local_shell_call"),
|
|
3486
|
+
id: import_v417.z.string(),
|
|
3487
|
+
call_id: import_v417.z.string(),
|
|
3488
|
+
action: import_v417.z.object({
|
|
3489
|
+
type: import_v417.z.literal("exec"),
|
|
3490
|
+
command: import_v417.z.array(import_v417.z.string()),
|
|
3491
|
+
timeout_ms: import_v417.z.number().optional(),
|
|
3492
|
+
user: import_v417.z.string().optional(),
|
|
3493
|
+
working_directory: import_v417.z.string().optional(),
|
|
3494
|
+
env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
|
|
3368
3495
|
})
|
|
3369
3496
|
}),
|
|
3370
|
-
|
|
3371
|
-
type:
|
|
3372
|
-
id:
|
|
3373
|
-
status:
|
|
3497
|
+
import_v417.z.object({
|
|
3498
|
+
type: import_v417.z.literal("computer_call"),
|
|
3499
|
+
id: import_v417.z.string(),
|
|
3500
|
+
status: import_v417.z.literal("completed")
|
|
3374
3501
|
}),
|
|
3375
|
-
|
|
3376
|
-
type:
|
|
3377
|
-
id:
|
|
3378
|
-
status:
|
|
3379
|
-
arguments:
|
|
3380
|
-
name:
|
|
3381
|
-
server_label:
|
|
3382
|
-
output:
|
|
3383
|
-
error:
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
type:
|
|
3387
|
-
code:
|
|
3388
|
-
message:
|
|
3502
|
+
import_v417.z.object({
|
|
3503
|
+
type: import_v417.z.literal("mcp_call"),
|
|
3504
|
+
id: import_v417.z.string(),
|
|
3505
|
+
status: import_v417.z.string(),
|
|
3506
|
+
arguments: import_v417.z.string(),
|
|
3507
|
+
name: import_v417.z.string(),
|
|
3508
|
+
server_label: import_v417.z.string(),
|
|
3509
|
+
output: import_v417.z.string().nullish(),
|
|
3510
|
+
error: import_v417.z.union([
|
|
3511
|
+
import_v417.z.string(),
|
|
3512
|
+
import_v417.z.object({
|
|
3513
|
+
type: import_v417.z.string().optional(),
|
|
3514
|
+
code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
|
|
3515
|
+
message: import_v417.z.string().optional()
|
|
3389
3516
|
}).loose()
|
|
3390
3517
|
]).nullish(),
|
|
3391
|
-
approval_request_id:
|
|
3518
|
+
approval_request_id: import_v417.z.string().nullish()
|
|
3392
3519
|
}),
|
|
3393
|
-
|
|
3394
|
-
type:
|
|
3395
|
-
id:
|
|
3396
|
-
server_label:
|
|
3397
|
-
tools:
|
|
3398
|
-
|
|
3399
|
-
name:
|
|
3400
|
-
description:
|
|
3401
|
-
input_schema:
|
|
3402
|
-
annotations:
|
|
3520
|
+
import_v417.z.object({
|
|
3521
|
+
type: import_v417.z.literal("mcp_list_tools"),
|
|
3522
|
+
id: import_v417.z.string(),
|
|
3523
|
+
server_label: import_v417.z.string(),
|
|
3524
|
+
tools: import_v417.z.array(
|
|
3525
|
+
import_v417.z.object({
|
|
3526
|
+
name: import_v417.z.string(),
|
|
3527
|
+
description: import_v417.z.string().optional(),
|
|
3528
|
+
input_schema: import_v417.z.any(),
|
|
3529
|
+
annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
|
|
3403
3530
|
})
|
|
3404
3531
|
),
|
|
3405
|
-
error:
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
type:
|
|
3409
|
-
code:
|
|
3410
|
-
message:
|
|
3532
|
+
error: import_v417.z.union([
|
|
3533
|
+
import_v417.z.string(),
|
|
3534
|
+
import_v417.z.object({
|
|
3535
|
+
type: import_v417.z.string().optional(),
|
|
3536
|
+
code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
|
|
3537
|
+
message: import_v417.z.string().optional()
|
|
3411
3538
|
}).loose()
|
|
3412
3539
|
]).optional()
|
|
3413
3540
|
}),
|
|
3414
|
-
|
|
3415
|
-
type:
|
|
3416
|
-
id:
|
|
3417
|
-
server_label:
|
|
3418
|
-
name:
|
|
3419
|
-
arguments:
|
|
3420
|
-
approval_request_id:
|
|
3541
|
+
import_v417.z.object({
|
|
3542
|
+
type: import_v417.z.literal("mcp_approval_request"),
|
|
3543
|
+
id: import_v417.z.string(),
|
|
3544
|
+
server_label: import_v417.z.string(),
|
|
3545
|
+
name: import_v417.z.string(),
|
|
3546
|
+
arguments: import_v417.z.string(),
|
|
3547
|
+
approval_request_id: import_v417.z.string().optional()
|
|
3421
3548
|
}),
|
|
3422
|
-
|
|
3423
|
-
type:
|
|
3424
|
-
id:
|
|
3425
|
-
call_id:
|
|
3426
|
-
status:
|
|
3427
|
-
operation:
|
|
3428
|
-
|
|
3429
|
-
type:
|
|
3430
|
-
path:
|
|
3431
|
-
diff:
|
|
3549
|
+
import_v417.z.object({
|
|
3550
|
+
type: import_v417.z.literal("apply_patch_call"),
|
|
3551
|
+
id: import_v417.z.string(),
|
|
3552
|
+
call_id: import_v417.z.string(),
|
|
3553
|
+
status: import_v417.z.enum(["in_progress", "completed"]),
|
|
3554
|
+
operation: import_v417.z.discriminatedUnion("type", [
|
|
3555
|
+
import_v417.z.object({
|
|
3556
|
+
type: import_v417.z.literal("create_file"),
|
|
3557
|
+
path: import_v417.z.string(),
|
|
3558
|
+
diff: import_v417.z.string()
|
|
3432
3559
|
}),
|
|
3433
|
-
|
|
3434
|
-
type:
|
|
3435
|
-
path:
|
|
3560
|
+
import_v417.z.object({
|
|
3561
|
+
type: import_v417.z.literal("delete_file"),
|
|
3562
|
+
path: import_v417.z.string()
|
|
3436
3563
|
}),
|
|
3437
|
-
|
|
3438
|
-
type:
|
|
3439
|
-
path:
|
|
3440
|
-
diff:
|
|
3564
|
+
import_v417.z.object({
|
|
3565
|
+
type: import_v417.z.literal("update_file"),
|
|
3566
|
+
path: import_v417.z.string(),
|
|
3567
|
+
diff: import_v417.z.string()
|
|
3441
3568
|
})
|
|
3442
3569
|
])
|
|
3443
3570
|
}),
|
|
3444
|
-
|
|
3445
|
-
type:
|
|
3446
|
-
id:
|
|
3447
|
-
call_id:
|
|
3448
|
-
status:
|
|
3449
|
-
action:
|
|
3450
|
-
commands:
|
|
3571
|
+
import_v417.z.object({
|
|
3572
|
+
type: import_v417.z.literal("shell_call"),
|
|
3573
|
+
id: import_v417.z.string(),
|
|
3574
|
+
call_id: import_v417.z.string(),
|
|
3575
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3576
|
+
action: import_v417.z.object({
|
|
3577
|
+
commands: import_v417.z.array(import_v417.z.string())
|
|
3451
3578
|
})
|
|
3452
3579
|
}),
|
|
3453
|
-
|
|
3454
|
-
type:
|
|
3455
|
-
id:
|
|
3456
|
-
call_id:
|
|
3457
|
-
status:
|
|
3458
|
-
output:
|
|
3459
|
-
|
|
3460
|
-
stdout:
|
|
3461
|
-
stderr:
|
|
3462
|
-
outcome:
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
type:
|
|
3466
|
-
exit_code:
|
|
3580
|
+
import_v417.z.object({
|
|
3581
|
+
type: import_v417.z.literal("shell_call_output"),
|
|
3582
|
+
id: import_v417.z.string(),
|
|
3583
|
+
call_id: import_v417.z.string(),
|
|
3584
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3585
|
+
output: import_v417.z.array(
|
|
3586
|
+
import_v417.z.object({
|
|
3587
|
+
stdout: import_v417.z.string(),
|
|
3588
|
+
stderr: import_v417.z.string(),
|
|
3589
|
+
outcome: import_v417.z.discriminatedUnion("type", [
|
|
3590
|
+
import_v417.z.object({ type: import_v417.z.literal("timeout") }),
|
|
3591
|
+
import_v417.z.object({
|
|
3592
|
+
type: import_v417.z.literal("exit"),
|
|
3593
|
+
exit_code: import_v417.z.number()
|
|
3467
3594
|
})
|
|
3468
3595
|
])
|
|
3469
3596
|
})
|
|
3470
3597
|
)
|
|
3598
|
+
}),
|
|
3599
|
+
import_v417.z.object({
|
|
3600
|
+
type: import_v417.z.literal("tool_search_call"),
|
|
3601
|
+
id: import_v417.z.string(),
|
|
3602
|
+
execution: import_v417.z.enum(["server", "client"]),
|
|
3603
|
+
call_id: import_v417.z.string().nullable(),
|
|
3604
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3605
|
+
arguments: import_v417.z.unknown()
|
|
3606
|
+
}),
|
|
3607
|
+
import_v417.z.object({
|
|
3608
|
+
type: import_v417.z.literal("tool_search_output"),
|
|
3609
|
+
id: import_v417.z.string(),
|
|
3610
|
+
execution: import_v417.z.enum(["server", "client"]),
|
|
3611
|
+
call_id: import_v417.z.string().nullable(),
|
|
3612
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3613
|
+
tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
|
|
3471
3614
|
})
|
|
3472
3615
|
])
|
|
3473
3616
|
}),
|
|
3474
|
-
|
|
3475
|
-
type:
|
|
3476
|
-
item_id:
|
|
3477
|
-
output_index:
|
|
3478
|
-
delta:
|
|
3617
|
+
import_v417.z.object({
|
|
3618
|
+
type: import_v417.z.literal("response.function_call_arguments.delta"),
|
|
3619
|
+
item_id: import_v417.z.string(),
|
|
3620
|
+
output_index: import_v417.z.number(),
|
|
3621
|
+
delta: import_v417.z.string()
|
|
3479
3622
|
}),
|
|
3480
|
-
|
|
3481
|
-
type:
|
|
3482
|
-
item_id:
|
|
3483
|
-
output_index:
|
|
3484
|
-
delta:
|
|
3623
|
+
import_v417.z.object({
|
|
3624
|
+
type: import_v417.z.literal("response.custom_tool_call_input.delta"),
|
|
3625
|
+
item_id: import_v417.z.string(),
|
|
3626
|
+
output_index: import_v417.z.number(),
|
|
3627
|
+
delta: import_v417.z.string()
|
|
3485
3628
|
}),
|
|
3486
|
-
|
|
3487
|
-
type:
|
|
3488
|
-
item_id:
|
|
3489
|
-
output_index:
|
|
3490
|
-
partial_image_b64:
|
|
3629
|
+
import_v417.z.object({
|
|
3630
|
+
type: import_v417.z.literal("response.image_generation_call.partial_image"),
|
|
3631
|
+
item_id: import_v417.z.string(),
|
|
3632
|
+
output_index: import_v417.z.number(),
|
|
3633
|
+
partial_image_b64: import_v417.z.string()
|
|
3491
3634
|
}),
|
|
3492
|
-
|
|
3493
|
-
type:
|
|
3494
|
-
item_id:
|
|
3495
|
-
output_index:
|
|
3496
|
-
delta:
|
|
3635
|
+
import_v417.z.object({
|
|
3636
|
+
type: import_v417.z.literal("response.code_interpreter_call_code.delta"),
|
|
3637
|
+
item_id: import_v417.z.string(),
|
|
3638
|
+
output_index: import_v417.z.number(),
|
|
3639
|
+
delta: import_v417.z.string()
|
|
3497
3640
|
}),
|
|
3498
|
-
|
|
3499
|
-
type:
|
|
3500
|
-
item_id:
|
|
3501
|
-
output_index:
|
|
3502
|
-
code:
|
|
3641
|
+
import_v417.z.object({
|
|
3642
|
+
type: import_v417.z.literal("response.code_interpreter_call_code.done"),
|
|
3643
|
+
item_id: import_v417.z.string(),
|
|
3644
|
+
output_index: import_v417.z.number(),
|
|
3645
|
+
code: import_v417.z.string()
|
|
3503
3646
|
}),
|
|
3504
|
-
|
|
3505
|
-
type:
|
|
3506
|
-
annotation:
|
|
3507
|
-
|
|
3508
|
-
type:
|
|
3509
|
-
start_index:
|
|
3510
|
-
end_index:
|
|
3511
|
-
url:
|
|
3512
|
-
title:
|
|
3647
|
+
import_v417.z.object({
|
|
3648
|
+
type: import_v417.z.literal("response.output_text.annotation.added"),
|
|
3649
|
+
annotation: import_v417.z.discriminatedUnion("type", [
|
|
3650
|
+
import_v417.z.object({
|
|
3651
|
+
type: import_v417.z.literal("url_citation"),
|
|
3652
|
+
start_index: import_v417.z.number(),
|
|
3653
|
+
end_index: import_v417.z.number(),
|
|
3654
|
+
url: import_v417.z.string(),
|
|
3655
|
+
title: import_v417.z.string()
|
|
3513
3656
|
}),
|
|
3514
|
-
|
|
3515
|
-
type:
|
|
3516
|
-
file_id:
|
|
3517
|
-
filename:
|
|
3518
|
-
index:
|
|
3657
|
+
import_v417.z.object({
|
|
3658
|
+
type: import_v417.z.literal("file_citation"),
|
|
3659
|
+
file_id: import_v417.z.string(),
|
|
3660
|
+
filename: import_v417.z.string(),
|
|
3661
|
+
index: import_v417.z.number()
|
|
3519
3662
|
}),
|
|
3520
|
-
|
|
3521
|
-
type:
|
|
3522
|
-
container_id:
|
|
3523
|
-
file_id:
|
|
3524
|
-
filename:
|
|
3525
|
-
start_index:
|
|
3526
|
-
end_index:
|
|
3663
|
+
import_v417.z.object({
|
|
3664
|
+
type: import_v417.z.literal("container_file_citation"),
|
|
3665
|
+
container_id: import_v417.z.string(),
|
|
3666
|
+
file_id: import_v417.z.string(),
|
|
3667
|
+
filename: import_v417.z.string(),
|
|
3668
|
+
start_index: import_v417.z.number(),
|
|
3669
|
+
end_index: import_v417.z.number()
|
|
3527
3670
|
}),
|
|
3528
|
-
|
|
3529
|
-
type:
|
|
3530
|
-
file_id:
|
|
3531
|
-
index:
|
|
3671
|
+
import_v417.z.object({
|
|
3672
|
+
type: import_v417.z.literal("file_path"),
|
|
3673
|
+
file_id: import_v417.z.string(),
|
|
3674
|
+
index: import_v417.z.number()
|
|
3532
3675
|
})
|
|
3533
3676
|
])
|
|
3534
3677
|
}),
|
|
3535
|
-
|
|
3536
|
-
type:
|
|
3537
|
-
item_id:
|
|
3538
|
-
summary_index:
|
|
3678
|
+
import_v417.z.object({
|
|
3679
|
+
type: import_v417.z.literal("response.reasoning_summary_part.added"),
|
|
3680
|
+
item_id: import_v417.z.string(),
|
|
3681
|
+
summary_index: import_v417.z.number()
|
|
3539
3682
|
}),
|
|
3540
|
-
|
|
3541
|
-
type:
|
|
3542
|
-
item_id:
|
|
3543
|
-
summary_index:
|
|
3544
|
-
delta:
|
|
3683
|
+
import_v417.z.object({
|
|
3684
|
+
type: import_v417.z.literal("response.reasoning_summary_text.delta"),
|
|
3685
|
+
item_id: import_v417.z.string(),
|
|
3686
|
+
summary_index: import_v417.z.number(),
|
|
3687
|
+
delta: import_v417.z.string()
|
|
3545
3688
|
}),
|
|
3546
|
-
|
|
3547
|
-
type:
|
|
3548
|
-
item_id:
|
|
3549
|
-
summary_index:
|
|
3689
|
+
import_v417.z.object({
|
|
3690
|
+
type: import_v417.z.literal("response.reasoning_summary_part.done"),
|
|
3691
|
+
item_id: import_v417.z.string(),
|
|
3692
|
+
summary_index: import_v417.z.number()
|
|
3550
3693
|
}),
|
|
3551
|
-
|
|
3552
|
-
type:
|
|
3553
|
-
item_id:
|
|
3554
|
-
output_index:
|
|
3555
|
-
delta:
|
|
3556
|
-
obfuscation:
|
|
3694
|
+
import_v417.z.object({
|
|
3695
|
+
type: import_v417.z.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3696
|
+
item_id: import_v417.z.string(),
|
|
3697
|
+
output_index: import_v417.z.number(),
|
|
3698
|
+
delta: import_v417.z.string(),
|
|
3699
|
+
obfuscation: import_v417.z.string().nullish()
|
|
3557
3700
|
}),
|
|
3558
|
-
|
|
3559
|
-
type:
|
|
3560
|
-
item_id:
|
|
3561
|
-
output_index:
|
|
3562
|
-
diff:
|
|
3701
|
+
import_v417.z.object({
|
|
3702
|
+
type: import_v417.z.literal("response.apply_patch_call_operation_diff.done"),
|
|
3703
|
+
item_id: import_v417.z.string(),
|
|
3704
|
+
output_index: import_v417.z.number(),
|
|
3705
|
+
diff: import_v417.z.string()
|
|
3563
3706
|
}),
|
|
3564
|
-
|
|
3565
|
-
type:
|
|
3566
|
-
sequence_number:
|
|
3567
|
-
error:
|
|
3568
|
-
type:
|
|
3569
|
-
code:
|
|
3570
|
-
message:
|
|
3571
|
-
param:
|
|
3707
|
+
import_v417.z.object({
|
|
3708
|
+
type: import_v417.z.literal("error"),
|
|
3709
|
+
sequence_number: import_v417.z.number(),
|
|
3710
|
+
error: import_v417.z.object({
|
|
3711
|
+
type: import_v417.z.string(),
|
|
3712
|
+
code: import_v417.z.string(),
|
|
3713
|
+
message: import_v417.z.string(),
|
|
3714
|
+
param: import_v417.z.string().nullish()
|
|
3572
3715
|
})
|
|
3573
3716
|
}),
|
|
3574
|
-
|
|
3717
|
+
import_v417.z.object({ type: import_v417.z.string() }).loose().transform((value) => ({
|
|
3575
3718
|
type: "unknown_chunk",
|
|
3576
3719
|
message: value.type
|
|
3577
3720
|
}))
|
|
@@ -3579,294 +3722,310 @@ var openaiResponsesChunkSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
3579
3722
|
])
|
|
3580
3723
|
)
|
|
3581
3724
|
);
|
|
3582
|
-
var openaiResponsesResponseSchema = (0,
|
|
3583
|
-
() => (0,
|
|
3584
|
-
|
|
3585
|
-
id:
|
|
3586
|
-
created_at:
|
|
3587
|
-
error:
|
|
3588
|
-
message:
|
|
3589
|
-
type:
|
|
3590
|
-
param:
|
|
3591
|
-
code:
|
|
3725
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
|
|
3726
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3727
|
+
import_v417.z.object({
|
|
3728
|
+
id: import_v417.z.string().optional(),
|
|
3729
|
+
created_at: import_v417.z.number().optional(),
|
|
3730
|
+
error: import_v417.z.object({
|
|
3731
|
+
message: import_v417.z.string(),
|
|
3732
|
+
type: import_v417.z.string(),
|
|
3733
|
+
param: import_v417.z.string().nullish(),
|
|
3734
|
+
code: import_v417.z.string()
|
|
3592
3735
|
}).nullish(),
|
|
3593
|
-
model:
|
|
3594
|
-
output:
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
type:
|
|
3598
|
-
role:
|
|
3599
|
-
id:
|
|
3600
|
-
phase:
|
|
3601
|
-
content:
|
|
3602
|
-
|
|
3603
|
-
type:
|
|
3604
|
-
text:
|
|
3605
|
-
logprobs:
|
|
3606
|
-
|
|
3607
|
-
token:
|
|
3608
|
-
logprob:
|
|
3609
|
-
top_logprobs:
|
|
3610
|
-
|
|
3611
|
-
token:
|
|
3612
|
-
logprob:
|
|
3736
|
+
model: import_v417.z.string().optional(),
|
|
3737
|
+
output: import_v417.z.array(
|
|
3738
|
+
import_v417.z.discriminatedUnion("type", [
|
|
3739
|
+
import_v417.z.object({
|
|
3740
|
+
type: import_v417.z.literal("message"),
|
|
3741
|
+
role: import_v417.z.literal("assistant"),
|
|
3742
|
+
id: import_v417.z.string(),
|
|
3743
|
+
phase: import_v417.z.enum(["commentary", "final_answer"]).nullish(),
|
|
3744
|
+
content: import_v417.z.array(
|
|
3745
|
+
import_v417.z.object({
|
|
3746
|
+
type: import_v417.z.literal("output_text"),
|
|
3747
|
+
text: import_v417.z.string(),
|
|
3748
|
+
logprobs: import_v417.z.array(
|
|
3749
|
+
import_v417.z.object({
|
|
3750
|
+
token: import_v417.z.string(),
|
|
3751
|
+
logprob: import_v417.z.number(),
|
|
3752
|
+
top_logprobs: import_v417.z.array(
|
|
3753
|
+
import_v417.z.object({
|
|
3754
|
+
token: import_v417.z.string(),
|
|
3755
|
+
logprob: import_v417.z.number()
|
|
3613
3756
|
})
|
|
3614
3757
|
)
|
|
3615
3758
|
})
|
|
3616
3759
|
).nullish(),
|
|
3617
|
-
annotations:
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
type:
|
|
3621
|
-
start_index:
|
|
3622
|
-
end_index:
|
|
3623
|
-
url:
|
|
3624
|
-
title:
|
|
3760
|
+
annotations: import_v417.z.array(
|
|
3761
|
+
import_v417.z.discriminatedUnion("type", [
|
|
3762
|
+
import_v417.z.object({
|
|
3763
|
+
type: import_v417.z.literal("url_citation"),
|
|
3764
|
+
start_index: import_v417.z.number(),
|
|
3765
|
+
end_index: import_v417.z.number(),
|
|
3766
|
+
url: import_v417.z.string(),
|
|
3767
|
+
title: import_v417.z.string()
|
|
3625
3768
|
}),
|
|
3626
|
-
|
|
3627
|
-
type:
|
|
3628
|
-
file_id:
|
|
3629
|
-
filename:
|
|
3630
|
-
index:
|
|
3769
|
+
import_v417.z.object({
|
|
3770
|
+
type: import_v417.z.literal("file_citation"),
|
|
3771
|
+
file_id: import_v417.z.string(),
|
|
3772
|
+
filename: import_v417.z.string(),
|
|
3773
|
+
index: import_v417.z.number()
|
|
3631
3774
|
}),
|
|
3632
|
-
|
|
3633
|
-
type:
|
|
3634
|
-
container_id:
|
|
3635
|
-
file_id:
|
|
3636
|
-
filename:
|
|
3637
|
-
start_index:
|
|
3638
|
-
end_index:
|
|
3775
|
+
import_v417.z.object({
|
|
3776
|
+
type: import_v417.z.literal("container_file_citation"),
|
|
3777
|
+
container_id: import_v417.z.string(),
|
|
3778
|
+
file_id: import_v417.z.string(),
|
|
3779
|
+
filename: import_v417.z.string(),
|
|
3780
|
+
start_index: import_v417.z.number(),
|
|
3781
|
+
end_index: import_v417.z.number()
|
|
3639
3782
|
}),
|
|
3640
|
-
|
|
3641
|
-
type:
|
|
3642
|
-
file_id:
|
|
3643
|
-
index:
|
|
3783
|
+
import_v417.z.object({
|
|
3784
|
+
type: import_v417.z.literal("file_path"),
|
|
3785
|
+
file_id: import_v417.z.string(),
|
|
3786
|
+
index: import_v417.z.number()
|
|
3644
3787
|
})
|
|
3645
3788
|
])
|
|
3646
3789
|
)
|
|
3647
3790
|
})
|
|
3648
3791
|
)
|
|
3649
3792
|
}),
|
|
3650
|
-
|
|
3651
|
-
type:
|
|
3652
|
-
id:
|
|
3653
|
-
status:
|
|
3654
|
-
action:
|
|
3655
|
-
|
|
3656
|
-
type:
|
|
3657
|
-
query:
|
|
3658
|
-
sources:
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
type:
|
|
3663
|
-
name:
|
|
3793
|
+
import_v417.z.object({
|
|
3794
|
+
type: import_v417.z.literal("web_search_call"),
|
|
3795
|
+
id: import_v417.z.string(),
|
|
3796
|
+
status: import_v417.z.string(),
|
|
3797
|
+
action: import_v417.z.discriminatedUnion("type", [
|
|
3798
|
+
import_v417.z.object({
|
|
3799
|
+
type: import_v417.z.literal("search"),
|
|
3800
|
+
query: import_v417.z.string().nullish(),
|
|
3801
|
+
sources: import_v417.z.array(
|
|
3802
|
+
import_v417.z.discriminatedUnion("type", [
|
|
3803
|
+
import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
|
|
3804
|
+
import_v417.z.object({
|
|
3805
|
+
type: import_v417.z.literal("api"),
|
|
3806
|
+
name: import_v417.z.string()
|
|
3664
3807
|
})
|
|
3665
3808
|
])
|
|
3666
3809
|
).nullish()
|
|
3667
3810
|
}),
|
|
3668
|
-
|
|
3669
|
-
type:
|
|
3670
|
-
url:
|
|
3811
|
+
import_v417.z.object({
|
|
3812
|
+
type: import_v417.z.literal("open_page"),
|
|
3813
|
+
url: import_v417.z.string().nullish()
|
|
3671
3814
|
}),
|
|
3672
|
-
|
|
3673
|
-
type:
|
|
3674
|
-
url:
|
|
3675
|
-
pattern:
|
|
3815
|
+
import_v417.z.object({
|
|
3816
|
+
type: import_v417.z.literal("find_in_page"),
|
|
3817
|
+
url: import_v417.z.string().nullish(),
|
|
3818
|
+
pattern: import_v417.z.string().nullish()
|
|
3676
3819
|
})
|
|
3677
3820
|
]).nullish()
|
|
3678
3821
|
}),
|
|
3679
|
-
|
|
3680
|
-
type:
|
|
3681
|
-
id:
|
|
3682
|
-
queries:
|
|
3683
|
-
results:
|
|
3684
|
-
|
|
3685
|
-
attributes:
|
|
3686
|
-
|
|
3687
|
-
|
|
3822
|
+
import_v417.z.object({
|
|
3823
|
+
type: import_v417.z.literal("file_search_call"),
|
|
3824
|
+
id: import_v417.z.string(),
|
|
3825
|
+
queries: import_v417.z.array(import_v417.z.string()),
|
|
3826
|
+
results: import_v417.z.array(
|
|
3827
|
+
import_v417.z.object({
|
|
3828
|
+
attributes: import_v417.z.record(
|
|
3829
|
+
import_v417.z.string(),
|
|
3830
|
+
import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
|
|
3688
3831
|
),
|
|
3689
|
-
file_id:
|
|
3690
|
-
filename:
|
|
3691
|
-
score:
|
|
3692
|
-
text:
|
|
3832
|
+
file_id: import_v417.z.string(),
|
|
3833
|
+
filename: import_v417.z.string(),
|
|
3834
|
+
score: import_v417.z.number(),
|
|
3835
|
+
text: import_v417.z.string()
|
|
3693
3836
|
})
|
|
3694
3837
|
).nullish()
|
|
3695
3838
|
}),
|
|
3696
|
-
|
|
3697
|
-
type:
|
|
3698
|
-
id:
|
|
3699
|
-
code:
|
|
3700
|
-
container_id:
|
|
3701
|
-
outputs:
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3839
|
+
import_v417.z.object({
|
|
3840
|
+
type: import_v417.z.literal("code_interpreter_call"),
|
|
3841
|
+
id: import_v417.z.string(),
|
|
3842
|
+
code: import_v417.z.string().nullable(),
|
|
3843
|
+
container_id: import_v417.z.string(),
|
|
3844
|
+
outputs: import_v417.z.array(
|
|
3845
|
+
import_v417.z.discriminatedUnion("type", [
|
|
3846
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
3847
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
3705
3848
|
])
|
|
3706
3849
|
).nullable()
|
|
3707
3850
|
}),
|
|
3708
|
-
|
|
3709
|
-
type:
|
|
3710
|
-
id:
|
|
3711
|
-
result:
|
|
3851
|
+
import_v417.z.object({
|
|
3852
|
+
type: import_v417.z.literal("image_generation_call"),
|
|
3853
|
+
id: import_v417.z.string(),
|
|
3854
|
+
result: import_v417.z.string()
|
|
3712
3855
|
}),
|
|
3713
|
-
|
|
3714
|
-
type:
|
|
3715
|
-
id:
|
|
3716
|
-
call_id:
|
|
3717
|
-
action:
|
|
3718
|
-
type:
|
|
3719
|
-
command:
|
|
3720
|
-
timeout_ms:
|
|
3721
|
-
user:
|
|
3722
|
-
working_directory:
|
|
3723
|
-
env:
|
|
3856
|
+
import_v417.z.object({
|
|
3857
|
+
type: import_v417.z.literal("local_shell_call"),
|
|
3858
|
+
id: import_v417.z.string(),
|
|
3859
|
+
call_id: import_v417.z.string(),
|
|
3860
|
+
action: import_v417.z.object({
|
|
3861
|
+
type: import_v417.z.literal("exec"),
|
|
3862
|
+
command: import_v417.z.array(import_v417.z.string()),
|
|
3863
|
+
timeout_ms: import_v417.z.number().optional(),
|
|
3864
|
+
user: import_v417.z.string().optional(),
|
|
3865
|
+
working_directory: import_v417.z.string().optional(),
|
|
3866
|
+
env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
|
|
3724
3867
|
})
|
|
3725
3868
|
}),
|
|
3726
|
-
|
|
3727
|
-
type:
|
|
3728
|
-
call_id:
|
|
3729
|
-
name:
|
|
3730
|
-
arguments:
|
|
3731
|
-
id:
|
|
3869
|
+
import_v417.z.object({
|
|
3870
|
+
type: import_v417.z.literal("function_call"),
|
|
3871
|
+
call_id: import_v417.z.string(),
|
|
3872
|
+
name: import_v417.z.string(),
|
|
3873
|
+
arguments: import_v417.z.string(),
|
|
3874
|
+
id: import_v417.z.string()
|
|
3732
3875
|
}),
|
|
3733
|
-
|
|
3734
|
-
type:
|
|
3735
|
-
call_id:
|
|
3736
|
-
name:
|
|
3737
|
-
input:
|
|
3738
|
-
id:
|
|
3876
|
+
import_v417.z.object({
|
|
3877
|
+
type: import_v417.z.literal("custom_tool_call"),
|
|
3878
|
+
call_id: import_v417.z.string(),
|
|
3879
|
+
name: import_v417.z.string(),
|
|
3880
|
+
input: import_v417.z.string(),
|
|
3881
|
+
id: import_v417.z.string()
|
|
3739
3882
|
}),
|
|
3740
|
-
|
|
3741
|
-
type:
|
|
3742
|
-
id:
|
|
3743
|
-
status:
|
|
3883
|
+
import_v417.z.object({
|
|
3884
|
+
type: import_v417.z.literal("computer_call"),
|
|
3885
|
+
id: import_v417.z.string(),
|
|
3886
|
+
status: import_v417.z.string().optional()
|
|
3744
3887
|
}),
|
|
3745
|
-
|
|
3746
|
-
type:
|
|
3747
|
-
id:
|
|
3748
|
-
encrypted_content:
|
|
3749
|
-
summary:
|
|
3750
|
-
|
|
3751
|
-
type:
|
|
3752
|
-
text:
|
|
3888
|
+
import_v417.z.object({
|
|
3889
|
+
type: import_v417.z.literal("reasoning"),
|
|
3890
|
+
id: import_v417.z.string(),
|
|
3891
|
+
encrypted_content: import_v417.z.string().nullish(),
|
|
3892
|
+
summary: import_v417.z.array(
|
|
3893
|
+
import_v417.z.object({
|
|
3894
|
+
type: import_v417.z.literal("summary_text"),
|
|
3895
|
+
text: import_v417.z.string()
|
|
3753
3896
|
})
|
|
3754
3897
|
)
|
|
3755
3898
|
}),
|
|
3756
|
-
|
|
3757
|
-
type:
|
|
3758
|
-
id:
|
|
3759
|
-
status:
|
|
3760
|
-
arguments:
|
|
3761
|
-
name:
|
|
3762
|
-
server_label:
|
|
3763
|
-
output:
|
|
3764
|
-
error:
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
type:
|
|
3768
|
-
code:
|
|
3769
|
-
message:
|
|
3899
|
+
import_v417.z.object({
|
|
3900
|
+
type: import_v417.z.literal("mcp_call"),
|
|
3901
|
+
id: import_v417.z.string(),
|
|
3902
|
+
status: import_v417.z.string(),
|
|
3903
|
+
arguments: import_v417.z.string(),
|
|
3904
|
+
name: import_v417.z.string(),
|
|
3905
|
+
server_label: import_v417.z.string(),
|
|
3906
|
+
output: import_v417.z.string().nullish(),
|
|
3907
|
+
error: import_v417.z.union([
|
|
3908
|
+
import_v417.z.string(),
|
|
3909
|
+
import_v417.z.object({
|
|
3910
|
+
type: import_v417.z.string().optional(),
|
|
3911
|
+
code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
|
|
3912
|
+
message: import_v417.z.string().optional()
|
|
3770
3913
|
}).loose()
|
|
3771
3914
|
]).nullish(),
|
|
3772
|
-
approval_request_id:
|
|
3915
|
+
approval_request_id: import_v417.z.string().nullish()
|
|
3773
3916
|
}),
|
|
3774
|
-
|
|
3775
|
-
type:
|
|
3776
|
-
id:
|
|
3777
|
-
server_label:
|
|
3778
|
-
tools:
|
|
3779
|
-
|
|
3780
|
-
name:
|
|
3781
|
-
description:
|
|
3782
|
-
input_schema:
|
|
3783
|
-
annotations:
|
|
3917
|
+
import_v417.z.object({
|
|
3918
|
+
type: import_v417.z.literal("mcp_list_tools"),
|
|
3919
|
+
id: import_v417.z.string(),
|
|
3920
|
+
server_label: import_v417.z.string(),
|
|
3921
|
+
tools: import_v417.z.array(
|
|
3922
|
+
import_v417.z.object({
|
|
3923
|
+
name: import_v417.z.string(),
|
|
3924
|
+
description: import_v417.z.string().optional(),
|
|
3925
|
+
input_schema: import_v417.z.any(),
|
|
3926
|
+
annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
|
|
3784
3927
|
})
|
|
3785
3928
|
),
|
|
3786
|
-
error:
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
type:
|
|
3790
|
-
code:
|
|
3791
|
-
message:
|
|
3929
|
+
error: import_v417.z.union([
|
|
3930
|
+
import_v417.z.string(),
|
|
3931
|
+
import_v417.z.object({
|
|
3932
|
+
type: import_v417.z.string().optional(),
|
|
3933
|
+
code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
|
|
3934
|
+
message: import_v417.z.string().optional()
|
|
3792
3935
|
}).loose()
|
|
3793
3936
|
]).optional()
|
|
3794
3937
|
}),
|
|
3795
|
-
|
|
3796
|
-
type:
|
|
3797
|
-
id:
|
|
3798
|
-
server_label:
|
|
3799
|
-
name:
|
|
3800
|
-
arguments:
|
|
3801
|
-
approval_request_id:
|
|
3938
|
+
import_v417.z.object({
|
|
3939
|
+
type: import_v417.z.literal("mcp_approval_request"),
|
|
3940
|
+
id: import_v417.z.string(),
|
|
3941
|
+
server_label: import_v417.z.string(),
|
|
3942
|
+
name: import_v417.z.string(),
|
|
3943
|
+
arguments: import_v417.z.string(),
|
|
3944
|
+
approval_request_id: import_v417.z.string().optional()
|
|
3802
3945
|
}),
|
|
3803
|
-
|
|
3804
|
-
type:
|
|
3805
|
-
id:
|
|
3806
|
-
call_id:
|
|
3807
|
-
status:
|
|
3808
|
-
operation:
|
|
3809
|
-
|
|
3810
|
-
type:
|
|
3811
|
-
path:
|
|
3812
|
-
diff:
|
|
3946
|
+
import_v417.z.object({
|
|
3947
|
+
type: import_v417.z.literal("apply_patch_call"),
|
|
3948
|
+
id: import_v417.z.string(),
|
|
3949
|
+
call_id: import_v417.z.string(),
|
|
3950
|
+
status: import_v417.z.enum(["in_progress", "completed"]),
|
|
3951
|
+
operation: import_v417.z.discriminatedUnion("type", [
|
|
3952
|
+
import_v417.z.object({
|
|
3953
|
+
type: import_v417.z.literal("create_file"),
|
|
3954
|
+
path: import_v417.z.string(),
|
|
3955
|
+
diff: import_v417.z.string()
|
|
3813
3956
|
}),
|
|
3814
|
-
|
|
3815
|
-
type:
|
|
3816
|
-
path:
|
|
3957
|
+
import_v417.z.object({
|
|
3958
|
+
type: import_v417.z.literal("delete_file"),
|
|
3959
|
+
path: import_v417.z.string()
|
|
3817
3960
|
}),
|
|
3818
|
-
|
|
3819
|
-
type:
|
|
3820
|
-
path:
|
|
3821
|
-
diff:
|
|
3961
|
+
import_v417.z.object({
|
|
3962
|
+
type: import_v417.z.literal("update_file"),
|
|
3963
|
+
path: import_v417.z.string(),
|
|
3964
|
+
diff: import_v417.z.string()
|
|
3822
3965
|
})
|
|
3823
3966
|
])
|
|
3824
3967
|
}),
|
|
3825
|
-
|
|
3826
|
-
type:
|
|
3827
|
-
id:
|
|
3828
|
-
call_id:
|
|
3829
|
-
status:
|
|
3830
|
-
action:
|
|
3831
|
-
commands:
|
|
3968
|
+
import_v417.z.object({
|
|
3969
|
+
type: import_v417.z.literal("shell_call"),
|
|
3970
|
+
id: import_v417.z.string(),
|
|
3971
|
+
call_id: import_v417.z.string(),
|
|
3972
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3973
|
+
action: import_v417.z.object({
|
|
3974
|
+
commands: import_v417.z.array(import_v417.z.string())
|
|
3832
3975
|
})
|
|
3833
3976
|
}),
|
|
3834
|
-
|
|
3835
|
-
type:
|
|
3836
|
-
id:
|
|
3837
|
-
call_id:
|
|
3838
|
-
status:
|
|
3839
|
-
output:
|
|
3840
|
-
|
|
3841
|
-
stdout:
|
|
3842
|
-
stderr:
|
|
3843
|
-
outcome:
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
type:
|
|
3847
|
-
exit_code:
|
|
3977
|
+
import_v417.z.object({
|
|
3978
|
+
type: import_v417.z.literal("shell_call_output"),
|
|
3979
|
+
id: import_v417.z.string(),
|
|
3980
|
+
call_id: import_v417.z.string(),
|
|
3981
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3982
|
+
output: import_v417.z.array(
|
|
3983
|
+
import_v417.z.object({
|
|
3984
|
+
stdout: import_v417.z.string(),
|
|
3985
|
+
stderr: import_v417.z.string(),
|
|
3986
|
+
outcome: import_v417.z.discriminatedUnion("type", [
|
|
3987
|
+
import_v417.z.object({ type: import_v417.z.literal("timeout") }),
|
|
3988
|
+
import_v417.z.object({
|
|
3989
|
+
type: import_v417.z.literal("exit"),
|
|
3990
|
+
exit_code: import_v417.z.number()
|
|
3848
3991
|
})
|
|
3849
3992
|
])
|
|
3850
3993
|
})
|
|
3851
3994
|
)
|
|
3995
|
+
}),
|
|
3996
|
+
import_v417.z.object({
|
|
3997
|
+
type: import_v417.z.literal("tool_search_call"),
|
|
3998
|
+
id: import_v417.z.string(),
|
|
3999
|
+
execution: import_v417.z.enum(["server", "client"]),
|
|
4000
|
+
call_id: import_v417.z.string().nullable(),
|
|
4001
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4002
|
+
arguments: import_v417.z.unknown()
|
|
4003
|
+
}),
|
|
4004
|
+
import_v417.z.object({
|
|
4005
|
+
type: import_v417.z.literal("tool_search_output"),
|
|
4006
|
+
id: import_v417.z.string(),
|
|
4007
|
+
execution: import_v417.z.enum(["server", "client"]),
|
|
4008
|
+
call_id: import_v417.z.string().nullable(),
|
|
4009
|
+
status: import_v417.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4010
|
+
tools: import_v417.z.array(import_v417.z.record(import_v417.z.string(), jsonValueSchema.optional()))
|
|
3852
4011
|
})
|
|
3853
4012
|
])
|
|
3854
4013
|
).optional(),
|
|
3855
|
-
service_tier:
|
|
3856
|
-
incomplete_details:
|
|
3857
|
-
usage:
|
|
3858
|
-
input_tokens:
|
|
3859
|
-
input_tokens_details:
|
|
3860
|
-
output_tokens:
|
|
3861
|
-
output_tokens_details:
|
|
4014
|
+
service_tier: import_v417.z.string().nullish(),
|
|
4015
|
+
incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
|
|
4016
|
+
usage: import_v417.z.object({
|
|
4017
|
+
input_tokens: import_v417.z.number(),
|
|
4018
|
+
input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
|
|
4019
|
+
output_tokens: import_v417.z.number(),
|
|
4020
|
+
output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
|
|
3862
4021
|
}).optional()
|
|
3863
4022
|
})
|
|
3864
4023
|
)
|
|
3865
4024
|
);
|
|
3866
4025
|
|
|
3867
4026
|
// src/responses/openai-responses-options.ts
|
|
3868
|
-
var
|
|
3869
|
-
var
|
|
4027
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
4028
|
+
var import_v418 = require("zod/v4");
|
|
3870
4029
|
var TOP_LOGPROBS_MAX = 20;
|
|
3871
4030
|
var openaiResponsesReasoningModelIds = [
|
|
3872
4031
|
"o1",
|
|
@@ -3895,11 +4054,12 @@ var openaiResponsesReasoningModelIds = [
|
|
|
3895
4054
|
"gpt-5.2-chat-latest",
|
|
3896
4055
|
"gpt-5.2-pro",
|
|
3897
4056
|
"gpt-5.2-codex",
|
|
4057
|
+
"gpt-5.3-chat-latest",
|
|
4058
|
+
"gpt-5.3-codex",
|
|
3898
4059
|
"gpt-5.4",
|
|
3899
4060
|
"gpt-5.4-2026-03-05",
|
|
3900
4061
|
"gpt-5.4-pro",
|
|
3901
|
-
"gpt-5.4-pro-2026-03-05"
|
|
3902
|
-
"gpt-5.3-codex"
|
|
4062
|
+
"gpt-5.4-pro-2026-03-05"
|
|
3903
4063
|
];
|
|
3904
4064
|
var openaiResponsesModelIds = [
|
|
3905
4065
|
"gpt-4.1",
|
|
@@ -3926,9 +4086,9 @@ var openaiResponsesModelIds = [
|
|
|
3926
4086
|
"gpt-5-chat-latest",
|
|
3927
4087
|
...openaiResponsesReasoningModelIds
|
|
3928
4088
|
];
|
|
3929
|
-
var openaiLanguageModelResponsesOptionsSchema = (0,
|
|
3930
|
-
() => (0,
|
|
3931
|
-
|
|
4089
|
+
var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils25.lazySchema)(
|
|
4090
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
4091
|
+
import_v418.z.object({
|
|
3932
4092
|
/**
|
|
3933
4093
|
* The ID of the OpenAI Conversation to continue.
|
|
3934
4094
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -3936,13 +4096,13 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
|
|
|
3936
4096
|
* Defaults to `undefined`.
|
|
3937
4097
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3938
4098
|
*/
|
|
3939
|
-
conversation:
|
|
4099
|
+
conversation: import_v418.z.string().nullish(),
|
|
3940
4100
|
/**
|
|
3941
4101
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
3942
4102
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
3943
4103
|
*/
|
|
3944
|
-
include:
|
|
3945
|
-
|
|
4104
|
+
include: import_v418.z.array(
|
|
4105
|
+
import_v418.z.enum([
|
|
3946
4106
|
"reasoning.encrypted_content",
|
|
3947
4107
|
// handled internally by default, only needed for unknown reasoning models
|
|
3948
4108
|
"file_search_call.results",
|
|
@@ -3954,7 +4114,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
|
|
|
3954
4114
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
3955
4115
|
* Defaults to `undefined`.
|
|
3956
4116
|
*/
|
|
3957
|
-
instructions:
|
|
4117
|
+
instructions: import_v418.z.string().nullish(),
|
|
3958
4118
|
/**
|
|
3959
4119
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
3960
4120
|
* the response size and can slow down response times. However, it can
|
|
@@ -3969,30 +4129,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
|
|
|
3969
4129
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3970
4130
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3971
4131
|
*/
|
|
3972
|
-
logprobs:
|
|
4132
|
+
logprobs: import_v418.z.union([import_v418.z.boolean(), import_v418.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3973
4133
|
/**
|
|
3974
4134
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3975
4135
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3976
4136
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3977
4137
|
*/
|
|
3978
|
-
maxToolCalls:
|
|
4138
|
+
maxToolCalls: import_v418.z.number().nullish(),
|
|
3979
4139
|
/**
|
|
3980
4140
|
* Additional metadata to store with the generation.
|
|
3981
4141
|
*/
|
|
3982
|
-
metadata:
|
|
4142
|
+
metadata: import_v418.z.any().nullish(),
|
|
3983
4143
|
/**
|
|
3984
4144
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
3985
4145
|
*/
|
|
3986
|
-
parallelToolCalls:
|
|
4146
|
+
parallelToolCalls: import_v418.z.boolean().nullish(),
|
|
3987
4147
|
/**
|
|
3988
4148
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
3989
4149
|
* Defaults to `undefined`.
|
|
3990
4150
|
*/
|
|
3991
|
-
previousResponseId:
|
|
4151
|
+
previousResponseId: import_v418.z.string().nullish(),
|
|
3992
4152
|
/**
|
|
3993
4153
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
3994
4154
|
*/
|
|
3995
|
-
promptCacheKey:
|
|
4155
|
+
promptCacheKey: import_v418.z.string().nullish(),
|
|
3996
4156
|
/**
|
|
3997
4157
|
* The retention policy for the prompt cache.
|
|
3998
4158
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -4001,7 +4161,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
|
|
|
4001
4161
|
*
|
|
4002
4162
|
* @default 'in_memory'
|
|
4003
4163
|
*/
|
|
4004
|
-
promptCacheRetention:
|
|
4164
|
+
promptCacheRetention: import_v418.z.enum(["in_memory", "24h"]).nullish(),
|
|
4005
4165
|
/**
|
|
4006
4166
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
4007
4167
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -4012,17 +4172,17 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
|
|
|
4012
4172
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
4013
4173
|
* an error.
|
|
4014
4174
|
*/
|
|
4015
|
-
reasoningEffort:
|
|
4175
|
+
reasoningEffort: import_v418.z.string().nullish(),
|
|
4016
4176
|
/**
|
|
4017
4177
|
* Controls reasoning summary output from the model.
|
|
4018
4178
|
* Set to "auto" to automatically receive the richest level available,
|
|
4019
4179
|
* or "detailed" for comprehensive summaries.
|
|
4020
4180
|
*/
|
|
4021
|
-
reasoningSummary:
|
|
4181
|
+
reasoningSummary: import_v418.z.string().nullish(),
|
|
4022
4182
|
/**
|
|
4023
4183
|
* The identifier for safety monitoring and tracking.
|
|
4024
4184
|
*/
|
|
4025
|
-
safetyIdentifier:
|
|
4185
|
+
safetyIdentifier: import_v418.z.string().nullish(),
|
|
4026
4186
|
/**
|
|
4027
4187
|
* Service tier for the request.
|
|
4028
4188
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -4030,34 +4190,34 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
|
|
|
4030
4190
|
*
|
|
4031
4191
|
* Defaults to 'auto'.
|
|
4032
4192
|
*/
|
|
4033
|
-
serviceTier:
|
|
4193
|
+
serviceTier: import_v418.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
4034
4194
|
/**
|
|
4035
4195
|
* Whether to store the generation. Defaults to `true`.
|
|
4036
4196
|
*/
|
|
4037
|
-
store:
|
|
4197
|
+
store: import_v418.z.boolean().nullish(),
|
|
4038
4198
|
/**
|
|
4039
4199
|
* Whether to use strict JSON schema validation.
|
|
4040
4200
|
* Defaults to `true`.
|
|
4041
4201
|
*/
|
|
4042
|
-
strictJsonSchema:
|
|
4202
|
+
strictJsonSchema: import_v418.z.boolean().nullish(),
|
|
4043
4203
|
/**
|
|
4044
4204
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
4045
4205
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
4046
4206
|
* Valid values: 'low', 'medium', 'high'.
|
|
4047
4207
|
*/
|
|
4048
|
-
textVerbosity:
|
|
4208
|
+
textVerbosity: import_v418.z.enum(["low", "medium", "high"]).nullish(),
|
|
4049
4209
|
/**
|
|
4050
4210
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
4051
4211
|
* 'disabled' turns truncation off.
|
|
4052
4212
|
*/
|
|
4053
|
-
truncation:
|
|
4213
|
+
truncation: import_v418.z.enum(["auto", "disabled"]).nullish(),
|
|
4054
4214
|
/**
|
|
4055
4215
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
4056
4216
|
* monitor and detect abuse.
|
|
4057
4217
|
* Defaults to `undefined`.
|
|
4058
4218
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
4059
4219
|
*/
|
|
4060
|
-
user:
|
|
4220
|
+
user: import_v418.z.string().nullish(),
|
|
4061
4221
|
/**
|
|
4062
4222
|
* Override the system message mode for this model.
|
|
4063
4223
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -4066,7 +4226,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
|
|
|
4066
4226
|
*
|
|
4067
4227
|
* If not specified, the mode is automatically determined based on the model.
|
|
4068
4228
|
*/
|
|
4069
|
-
systemMessageMode:
|
|
4229
|
+
systemMessageMode: import_v418.z.enum(["system", "developer", "remove"]).optional(),
|
|
4070
4230
|
/**
|
|
4071
4231
|
* Force treating this model as a reasoning model.
|
|
4072
4232
|
*
|
|
@@ -4076,51 +4236,51 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils24.lazy
|
|
|
4076
4236
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4077
4237
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4078
4238
|
*/
|
|
4079
|
-
forceReasoning:
|
|
4239
|
+
forceReasoning: import_v418.z.boolean().optional()
|
|
4080
4240
|
})
|
|
4081
4241
|
)
|
|
4082
4242
|
);
|
|
4083
4243
|
|
|
4084
4244
|
// src/responses/openai-responses-prepare-tools.ts
|
|
4085
4245
|
var import_provider7 = require("@ai-sdk/provider");
|
|
4086
|
-
var
|
|
4246
|
+
var import_provider_utils33 = require("@ai-sdk/provider-utils");
|
|
4087
4247
|
|
|
4088
4248
|
// src/tool/code-interpreter.ts
|
|
4089
|
-
var
|
|
4090
|
-
var
|
|
4091
|
-
var codeInterpreterInputSchema = (0,
|
|
4092
|
-
() => (0,
|
|
4093
|
-
|
|
4094
|
-
code:
|
|
4095
|
-
containerId:
|
|
4249
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
4250
|
+
var import_v419 = require("zod/v4");
|
|
4251
|
+
var codeInterpreterInputSchema = (0, import_provider_utils26.lazySchema)(
|
|
4252
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
4253
|
+
import_v419.z.object({
|
|
4254
|
+
code: import_v419.z.string().nullish(),
|
|
4255
|
+
containerId: import_v419.z.string()
|
|
4096
4256
|
})
|
|
4097
4257
|
)
|
|
4098
4258
|
);
|
|
4099
|
-
var codeInterpreterOutputSchema = (0,
|
|
4100
|
-
() => (0,
|
|
4101
|
-
|
|
4102
|
-
outputs:
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4259
|
+
var codeInterpreterOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
4260
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
4261
|
+
import_v419.z.object({
|
|
4262
|
+
outputs: import_v419.z.array(
|
|
4263
|
+
import_v419.z.discriminatedUnion("type", [
|
|
4264
|
+
import_v419.z.object({ type: import_v419.z.literal("logs"), logs: import_v419.z.string() }),
|
|
4265
|
+
import_v419.z.object({ type: import_v419.z.literal("image"), url: import_v419.z.string() })
|
|
4106
4266
|
])
|
|
4107
4267
|
).nullish()
|
|
4108
4268
|
})
|
|
4109
4269
|
)
|
|
4110
4270
|
);
|
|
4111
|
-
var codeInterpreterArgsSchema = (0,
|
|
4112
|
-
() => (0,
|
|
4113
|
-
|
|
4114
|
-
container:
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
fileIds:
|
|
4271
|
+
var codeInterpreterArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
4272
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
4273
|
+
import_v419.z.object({
|
|
4274
|
+
container: import_v419.z.union([
|
|
4275
|
+
import_v419.z.string(),
|
|
4276
|
+
import_v419.z.object({
|
|
4277
|
+
fileIds: import_v419.z.array(import_v419.z.string()).optional()
|
|
4118
4278
|
})
|
|
4119
4279
|
]).optional()
|
|
4120
4280
|
})
|
|
4121
4281
|
)
|
|
4122
4282
|
);
|
|
4123
|
-
var codeInterpreterToolFactory = (0,
|
|
4283
|
+
var codeInterpreterToolFactory = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
|
|
4124
4284
|
id: "openai.code_interpreter",
|
|
4125
4285
|
inputSchema: codeInterpreterInputSchema,
|
|
4126
4286
|
outputSchema: codeInterpreterOutputSchema
|
|
@@ -4130,81 +4290,81 @@ var codeInterpreter = (args = {}) => {
|
|
|
4130
4290
|
};
|
|
4131
4291
|
|
|
4132
4292
|
// src/tool/file-search.ts
|
|
4133
|
-
var
|
|
4134
|
-
var
|
|
4135
|
-
var comparisonFilterSchema =
|
|
4136
|
-
key:
|
|
4137
|
-
type:
|
|
4138
|
-
value:
|
|
4293
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
4294
|
+
var import_v420 = require("zod/v4");
|
|
4295
|
+
var comparisonFilterSchema = import_v420.z.object({
|
|
4296
|
+
key: import_v420.z.string(),
|
|
4297
|
+
type: import_v420.z.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
4298
|
+
value: import_v420.z.union([import_v420.z.string(), import_v420.z.number(), import_v420.z.boolean(), import_v420.z.array(import_v420.z.string())])
|
|
4139
4299
|
});
|
|
4140
|
-
var compoundFilterSchema =
|
|
4141
|
-
type:
|
|
4142
|
-
filters:
|
|
4143
|
-
|
|
4300
|
+
var compoundFilterSchema = import_v420.z.object({
|
|
4301
|
+
type: import_v420.z.enum(["and", "or"]),
|
|
4302
|
+
filters: import_v420.z.array(
|
|
4303
|
+
import_v420.z.union([comparisonFilterSchema, import_v420.z.lazy(() => compoundFilterSchema)])
|
|
4144
4304
|
)
|
|
4145
4305
|
});
|
|
4146
|
-
var fileSearchArgsSchema = (0,
|
|
4147
|
-
() => (0,
|
|
4148
|
-
|
|
4149
|
-
vectorStoreIds:
|
|
4150
|
-
maxNumResults:
|
|
4151
|
-
ranking:
|
|
4152
|
-
ranker:
|
|
4153
|
-
scoreThreshold:
|
|
4306
|
+
var fileSearchArgsSchema = (0, import_provider_utils27.lazySchema)(
|
|
4307
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
4308
|
+
import_v420.z.object({
|
|
4309
|
+
vectorStoreIds: import_v420.z.array(import_v420.z.string()),
|
|
4310
|
+
maxNumResults: import_v420.z.number().optional(),
|
|
4311
|
+
ranking: import_v420.z.object({
|
|
4312
|
+
ranker: import_v420.z.string().optional(),
|
|
4313
|
+
scoreThreshold: import_v420.z.number().optional()
|
|
4154
4314
|
}).optional(),
|
|
4155
|
-
filters:
|
|
4315
|
+
filters: import_v420.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
4156
4316
|
})
|
|
4157
4317
|
)
|
|
4158
4318
|
);
|
|
4159
|
-
var fileSearchOutputSchema = (0,
|
|
4160
|
-
() => (0,
|
|
4161
|
-
|
|
4162
|
-
queries:
|
|
4163
|
-
results:
|
|
4164
|
-
|
|
4165
|
-
attributes:
|
|
4166
|
-
fileId:
|
|
4167
|
-
filename:
|
|
4168
|
-
score:
|
|
4169
|
-
text:
|
|
4319
|
+
var fileSearchOutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
4320
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
4321
|
+
import_v420.z.object({
|
|
4322
|
+
queries: import_v420.z.array(import_v420.z.string()),
|
|
4323
|
+
results: import_v420.z.array(
|
|
4324
|
+
import_v420.z.object({
|
|
4325
|
+
attributes: import_v420.z.record(import_v420.z.string(), import_v420.z.unknown()),
|
|
4326
|
+
fileId: import_v420.z.string(),
|
|
4327
|
+
filename: import_v420.z.string(),
|
|
4328
|
+
score: import_v420.z.number(),
|
|
4329
|
+
text: import_v420.z.string()
|
|
4170
4330
|
})
|
|
4171
4331
|
).nullable()
|
|
4172
4332
|
})
|
|
4173
4333
|
)
|
|
4174
4334
|
);
|
|
4175
|
-
var fileSearch = (0,
|
|
4335
|
+
var fileSearch = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
4176
4336
|
id: "openai.file_search",
|
|
4177
|
-
inputSchema:
|
|
4337
|
+
inputSchema: import_v420.z.object({}),
|
|
4178
4338
|
outputSchema: fileSearchOutputSchema
|
|
4179
4339
|
});
|
|
4180
4340
|
|
|
4181
4341
|
// src/tool/image-generation.ts
|
|
4182
|
-
var
|
|
4183
|
-
var
|
|
4184
|
-
var imageGenerationArgsSchema = (0,
|
|
4185
|
-
() => (0,
|
|
4186
|
-
|
|
4187
|
-
background:
|
|
4188
|
-
inputFidelity:
|
|
4189
|
-
inputImageMask:
|
|
4190
|
-
fileId:
|
|
4191
|
-
imageUrl:
|
|
4342
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
4343
|
+
var import_v421 = require("zod/v4");
|
|
4344
|
+
var imageGenerationArgsSchema = (0, import_provider_utils28.lazySchema)(
|
|
4345
|
+
() => (0, import_provider_utils28.zodSchema)(
|
|
4346
|
+
import_v421.z.object({
|
|
4347
|
+
background: import_v421.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
4348
|
+
inputFidelity: import_v421.z.enum(["low", "high"]).optional(),
|
|
4349
|
+
inputImageMask: import_v421.z.object({
|
|
4350
|
+
fileId: import_v421.z.string().optional(),
|
|
4351
|
+
imageUrl: import_v421.z.string().optional()
|
|
4192
4352
|
}).optional(),
|
|
4193
|
-
model:
|
|
4194
|
-
moderation:
|
|
4195
|
-
outputCompression:
|
|
4196
|
-
outputFormat:
|
|
4197
|
-
partialImages:
|
|
4198
|
-
quality:
|
|
4199
|
-
size:
|
|
4353
|
+
model: import_v421.z.string().optional(),
|
|
4354
|
+
moderation: import_v421.z.enum(["auto"]).optional(),
|
|
4355
|
+
outputCompression: import_v421.z.number().int().min(0).max(100).optional(),
|
|
4356
|
+
outputFormat: import_v421.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
4357
|
+
partialImages: import_v421.z.number().int().min(0).max(3).optional(),
|
|
4358
|
+
quality: import_v421.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
4359
|
+
size: import_v421.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
4200
4360
|
}).strict()
|
|
4201
4361
|
)
|
|
4202
4362
|
);
|
|
4203
|
-
var imageGenerationInputSchema = (0,
|
|
4204
|
-
var imageGenerationOutputSchema = (0,
|
|
4205
|
-
() => (0,
|
|
4363
|
+
var imageGenerationInputSchema = (0, import_provider_utils28.lazySchema)(() => (0, import_provider_utils28.zodSchema)(import_v421.z.object({})));
|
|
4364
|
+
var imageGenerationOutputSchema = (0, import_provider_utils28.lazySchema)(
|
|
4365
|
+
() => (0, import_provider_utils28.zodSchema)(import_v421.z.object({ result: import_v421.z.string() }))
|
|
4206
4366
|
);
|
|
4207
|
-
var imageGenerationToolFactory = (0,
|
|
4367
|
+
var imageGenerationToolFactory = (0, import_provider_utils28.createProviderToolFactoryWithOutputSchema)({
|
|
4208
4368
|
id: "openai.image_generation",
|
|
4209
4369
|
inputSchema: imageGenerationInputSchema,
|
|
4210
4370
|
outputSchema: imageGenerationOutputSchema
|
|
@@ -4214,153 +4374,101 @@ var imageGeneration = (args = {}) => {
|
|
|
4214
4374
|
};
|
|
4215
4375
|
|
|
4216
4376
|
// src/tool/custom.ts
|
|
4217
|
-
var
|
|
4218
|
-
var
|
|
4219
|
-
var customArgsSchema = (0,
|
|
4220
|
-
() => (0,
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
definition: import_v421.z.string()
|
|
4377
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
4378
|
+
var import_v422 = require("zod/v4");
|
|
4379
|
+
var customArgsSchema = (0, import_provider_utils29.lazySchema)(
|
|
4380
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
4381
|
+
import_v422.z.object({
|
|
4382
|
+
description: import_v422.z.string().optional(),
|
|
4383
|
+
format: import_v422.z.union([
|
|
4384
|
+
import_v422.z.object({
|
|
4385
|
+
type: import_v422.z.literal("grammar"),
|
|
4386
|
+
syntax: import_v422.z.enum(["regex", "lark"]),
|
|
4387
|
+
definition: import_v422.z.string()
|
|
4229
4388
|
}),
|
|
4230
|
-
|
|
4231
|
-
type:
|
|
4389
|
+
import_v422.z.object({
|
|
4390
|
+
type: import_v422.z.literal("text")
|
|
4232
4391
|
})
|
|
4233
4392
|
]).optional()
|
|
4234
4393
|
})
|
|
4235
4394
|
)
|
|
4236
4395
|
);
|
|
4237
|
-
var customInputSchema = (0,
|
|
4238
|
-
var customToolFactory = (0,
|
|
4396
|
+
var customInputSchema = (0, import_provider_utils29.lazySchema)(() => (0, import_provider_utils29.zodSchema)(import_v422.z.string()));
|
|
4397
|
+
var customToolFactory = (0, import_provider_utils29.createProviderToolFactory)({
|
|
4239
4398
|
id: "openai.custom",
|
|
4240
4399
|
inputSchema: customInputSchema
|
|
4241
4400
|
});
|
|
4242
4401
|
|
|
4243
4402
|
// src/tool/mcp.ts
|
|
4244
|
-
var
|
|
4245
|
-
var
|
|
4246
|
-
var
|
|
4247
|
-
() =>
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4403
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
4404
|
+
var import_v423 = require("zod/v4");
|
|
4405
|
+
var jsonValueSchema2 = import_v423.z.lazy(
|
|
4406
|
+
() => import_v423.z.union([
|
|
4407
|
+
import_v423.z.string(),
|
|
4408
|
+
import_v423.z.number(),
|
|
4409
|
+
import_v423.z.boolean(),
|
|
4410
|
+
import_v423.z.null(),
|
|
4411
|
+
import_v423.z.array(jsonValueSchema2),
|
|
4412
|
+
import_v423.z.record(import_v423.z.string(), jsonValueSchema2)
|
|
4254
4413
|
])
|
|
4255
4414
|
);
|
|
4256
|
-
var mcpArgsSchema = (0,
|
|
4257
|
-
() => (0,
|
|
4258
|
-
|
|
4259
|
-
serverLabel:
|
|
4260
|
-
allowedTools:
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
readOnly:
|
|
4264
|
-
toolNames:
|
|
4415
|
+
var mcpArgsSchema = (0, import_provider_utils30.lazySchema)(
|
|
4416
|
+
() => (0, import_provider_utils30.zodSchema)(
|
|
4417
|
+
import_v423.z.object({
|
|
4418
|
+
serverLabel: import_v423.z.string(),
|
|
4419
|
+
allowedTools: import_v423.z.union([
|
|
4420
|
+
import_v423.z.array(import_v423.z.string()),
|
|
4421
|
+
import_v423.z.object({
|
|
4422
|
+
readOnly: import_v423.z.boolean().optional(),
|
|
4423
|
+
toolNames: import_v423.z.array(import_v423.z.string()).optional()
|
|
4265
4424
|
})
|
|
4266
4425
|
]).optional(),
|
|
4267
|
-
authorization:
|
|
4268
|
-
connectorId:
|
|
4269
|
-
headers:
|
|
4270
|
-
requireApproval:
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
never:
|
|
4274
|
-
toolNames:
|
|
4426
|
+
authorization: import_v423.z.string().optional(),
|
|
4427
|
+
connectorId: import_v423.z.string().optional(),
|
|
4428
|
+
headers: import_v423.z.record(import_v423.z.string(), import_v423.z.string()).optional(),
|
|
4429
|
+
requireApproval: import_v423.z.union([
|
|
4430
|
+
import_v423.z.enum(["always", "never"]),
|
|
4431
|
+
import_v423.z.object({
|
|
4432
|
+
never: import_v423.z.object({
|
|
4433
|
+
toolNames: import_v423.z.array(import_v423.z.string()).optional()
|
|
4275
4434
|
}).optional()
|
|
4276
4435
|
})
|
|
4277
4436
|
]).optional(),
|
|
4278
|
-
serverDescription:
|
|
4279
|
-
serverUrl:
|
|
4437
|
+
serverDescription: import_v423.z.string().optional(),
|
|
4438
|
+
serverUrl: import_v423.z.string().optional()
|
|
4280
4439
|
}).refine(
|
|
4281
4440
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
4282
4441
|
"One of serverUrl or connectorId must be provided."
|
|
4283
4442
|
)
|
|
4284
4443
|
)
|
|
4285
4444
|
);
|
|
4286
|
-
var mcpInputSchema = (0,
|
|
4287
|
-
var mcpOutputSchema = (0,
|
|
4288
|
-
() => (0,
|
|
4289
|
-
|
|
4290
|
-
type:
|
|
4291
|
-
serverLabel:
|
|
4292
|
-
name:
|
|
4293
|
-
arguments:
|
|
4294
|
-
output:
|
|
4295
|
-
error:
|
|
4445
|
+
var mcpInputSchema = (0, import_provider_utils30.lazySchema)(() => (0, import_provider_utils30.zodSchema)(import_v423.z.object({})));
|
|
4446
|
+
var mcpOutputSchema = (0, import_provider_utils30.lazySchema)(
|
|
4447
|
+
() => (0, import_provider_utils30.zodSchema)(
|
|
4448
|
+
import_v423.z.object({
|
|
4449
|
+
type: import_v423.z.literal("call"),
|
|
4450
|
+
serverLabel: import_v423.z.string(),
|
|
4451
|
+
name: import_v423.z.string(),
|
|
4452
|
+
arguments: import_v423.z.string(),
|
|
4453
|
+
output: import_v423.z.string().nullish(),
|
|
4454
|
+
error: import_v423.z.union([import_v423.z.string(), jsonValueSchema2]).optional()
|
|
4296
4455
|
})
|
|
4297
4456
|
)
|
|
4298
4457
|
);
|
|
4299
|
-
var mcpToolFactory = (0,
|
|
4458
|
+
var mcpToolFactory = (0, import_provider_utils30.createProviderToolFactoryWithOutputSchema)({
|
|
4300
4459
|
id: "openai.mcp",
|
|
4301
4460
|
inputSchema: mcpInputSchema,
|
|
4302
4461
|
outputSchema: mcpOutputSchema
|
|
4303
4462
|
});
|
|
4304
4463
|
|
|
4305
4464
|
// src/tool/web-search.ts
|
|
4306
|
-
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
4307
|
-
var import_v423 = require("zod/v4");
|
|
4308
|
-
var webSearchArgsSchema = (0, import_provider_utils30.lazySchema)(
|
|
4309
|
-
() => (0, import_provider_utils30.zodSchema)(
|
|
4310
|
-
import_v423.z.object({
|
|
4311
|
-
externalWebAccess: import_v423.z.boolean().optional(),
|
|
4312
|
-
filters: import_v423.z.object({ allowedDomains: import_v423.z.array(import_v423.z.string()).optional() }).optional(),
|
|
4313
|
-
searchContextSize: import_v423.z.enum(["low", "medium", "high"]).optional(),
|
|
4314
|
-
userLocation: import_v423.z.object({
|
|
4315
|
-
type: import_v423.z.literal("approximate"),
|
|
4316
|
-
country: import_v423.z.string().optional(),
|
|
4317
|
-
city: import_v423.z.string().optional(),
|
|
4318
|
-
region: import_v423.z.string().optional(),
|
|
4319
|
-
timezone: import_v423.z.string().optional()
|
|
4320
|
-
}).optional()
|
|
4321
|
-
})
|
|
4322
|
-
)
|
|
4323
|
-
);
|
|
4324
|
-
var webSearchInputSchema = (0, import_provider_utils30.lazySchema)(() => (0, import_provider_utils30.zodSchema)(import_v423.z.object({})));
|
|
4325
|
-
var webSearchOutputSchema = (0, import_provider_utils30.lazySchema)(
|
|
4326
|
-
() => (0, import_provider_utils30.zodSchema)(
|
|
4327
|
-
import_v423.z.object({
|
|
4328
|
-
action: import_v423.z.discriminatedUnion("type", [
|
|
4329
|
-
import_v423.z.object({
|
|
4330
|
-
type: import_v423.z.literal("search"),
|
|
4331
|
-
query: import_v423.z.string().optional()
|
|
4332
|
-
}),
|
|
4333
|
-
import_v423.z.object({
|
|
4334
|
-
type: import_v423.z.literal("openPage"),
|
|
4335
|
-
url: import_v423.z.string().nullish()
|
|
4336
|
-
}),
|
|
4337
|
-
import_v423.z.object({
|
|
4338
|
-
type: import_v423.z.literal("findInPage"),
|
|
4339
|
-
url: import_v423.z.string().nullish(),
|
|
4340
|
-
pattern: import_v423.z.string().nullish()
|
|
4341
|
-
})
|
|
4342
|
-
]).optional(),
|
|
4343
|
-
sources: import_v423.z.array(
|
|
4344
|
-
import_v423.z.discriminatedUnion("type", [
|
|
4345
|
-
import_v423.z.object({ type: import_v423.z.literal("url"), url: import_v423.z.string() }),
|
|
4346
|
-
import_v423.z.object({ type: import_v423.z.literal("api"), name: import_v423.z.string() })
|
|
4347
|
-
])
|
|
4348
|
-
).optional()
|
|
4349
|
-
})
|
|
4350
|
-
)
|
|
4351
|
-
);
|
|
4352
|
-
var webSearchToolFactory = (0, import_provider_utils30.createProviderToolFactoryWithOutputSchema)({
|
|
4353
|
-
id: "openai.web_search",
|
|
4354
|
-
inputSchema: webSearchInputSchema,
|
|
4355
|
-
outputSchema: webSearchOutputSchema
|
|
4356
|
-
});
|
|
4357
|
-
|
|
4358
|
-
// src/tool/web-search-preview.ts
|
|
4359
4465
|
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
4360
4466
|
var import_v424 = require("zod/v4");
|
|
4361
|
-
var
|
|
4467
|
+
var webSearchArgsSchema = (0, import_provider_utils31.lazySchema)(
|
|
4362
4468
|
() => (0, import_provider_utils31.zodSchema)(
|
|
4363
4469
|
import_v424.z.object({
|
|
4470
|
+
externalWebAccess: import_v424.z.boolean().optional(),
|
|
4471
|
+
filters: import_v424.z.object({ allowedDomains: import_v424.z.array(import_v424.z.string()).optional() }).optional(),
|
|
4364
4472
|
searchContextSize: import_v424.z.enum(["low", "medium", "high"]).optional(),
|
|
4365
4473
|
userLocation: import_v424.z.object({
|
|
4366
4474
|
type: import_v424.z.literal("approximate"),
|
|
@@ -4372,10 +4480,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils31.lazySchema)(
|
|
|
4372
4480
|
})
|
|
4373
4481
|
)
|
|
4374
4482
|
);
|
|
4375
|
-
var
|
|
4376
|
-
|
|
4377
|
-
);
|
|
4378
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils31.lazySchema)(
|
|
4483
|
+
var webSearchInputSchema = (0, import_provider_utils31.lazySchema)(() => (0, import_provider_utils31.zodSchema)(import_v424.z.object({})));
|
|
4484
|
+
var webSearchOutputSchema = (0, import_provider_utils31.lazySchema)(
|
|
4379
4485
|
() => (0, import_provider_utils31.zodSchema)(
|
|
4380
4486
|
import_v424.z.object({
|
|
4381
4487
|
action: import_v424.z.discriminatedUnion("type", [
|
|
@@ -4392,11 +4498,64 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils31.lazySchema)(
|
|
|
4392
4498
|
url: import_v424.z.string().nullish(),
|
|
4393
4499
|
pattern: import_v424.z.string().nullish()
|
|
4394
4500
|
})
|
|
4501
|
+
]).optional(),
|
|
4502
|
+
sources: import_v424.z.array(
|
|
4503
|
+
import_v424.z.discriminatedUnion("type", [
|
|
4504
|
+
import_v424.z.object({ type: import_v424.z.literal("url"), url: import_v424.z.string() }),
|
|
4505
|
+
import_v424.z.object({ type: import_v424.z.literal("api"), name: import_v424.z.string() })
|
|
4506
|
+
])
|
|
4507
|
+
).optional()
|
|
4508
|
+
})
|
|
4509
|
+
)
|
|
4510
|
+
);
|
|
4511
|
+
var webSearchToolFactory = (0, import_provider_utils31.createProviderToolFactoryWithOutputSchema)({
|
|
4512
|
+
id: "openai.web_search",
|
|
4513
|
+
inputSchema: webSearchInputSchema,
|
|
4514
|
+
outputSchema: webSearchOutputSchema
|
|
4515
|
+
});
|
|
4516
|
+
|
|
4517
|
+
// src/tool/web-search-preview.ts
|
|
4518
|
+
var import_provider_utils32 = require("@ai-sdk/provider-utils");
|
|
4519
|
+
var import_v425 = require("zod/v4");
|
|
4520
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils32.lazySchema)(
|
|
4521
|
+
() => (0, import_provider_utils32.zodSchema)(
|
|
4522
|
+
import_v425.z.object({
|
|
4523
|
+
searchContextSize: import_v425.z.enum(["low", "medium", "high"]).optional(),
|
|
4524
|
+
userLocation: import_v425.z.object({
|
|
4525
|
+
type: import_v425.z.literal("approximate"),
|
|
4526
|
+
country: import_v425.z.string().optional(),
|
|
4527
|
+
city: import_v425.z.string().optional(),
|
|
4528
|
+
region: import_v425.z.string().optional(),
|
|
4529
|
+
timezone: import_v425.z.string().optional()
|
|
4530
|
+
}).optional()
|
|
4531
|
+
})
|
|
4532
|
+
)
|
|
4533
|
+
);
|
|
4534
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils32.lazySchema)(
|
|
4535
|
+
() => (0, import_provider_utils32.zodSchema)(import_v425.z.object({}))
|
|
4536
|
+
);
|
|
4537
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils32.lazySchema)(
|
|
4538
|
+
() => (0, import_provider_utils32.zodSchema)(
|
|
4539
|
+
import_v425.z.object({
|
|
4540
|
+
action: import_v425.z.discriminatedUnion("type", [
|
|
4541
|
+
import_v425.z.object({
|
|
4542
|
+
type: import_v425.z.literal("search"),
|
|
4543
|
+
query: import_v425.z.string().optional()
|
|
4544
|
+
}),
|
|
4545
|
+
import_v425.z.object({
|
|
4546
|
+
type: import_v425.z.literal("openPage"),
|
|
4547
|
+
url: import_v425.z.string().nullish()
|
|
4548
|
+
}),
|
|
4549
|
+
import_v425.z.object({
|
|
4550
|
+
type: import_v425.z.literal("findInPage"),
|
|
4551
|
+
url: import_v425.z.string().nullish(),
|
|
4552
|
+
pattern: import_v425.z.string().nullish()
|
|
4553
|
+
})
|
|
4395
4554
|
]).optional()
|
|
4396
4555
|
})
|
|
4397
4556
|
)
|
|
4398
4557
|
);
|
|
4399
|
-
var webSearchPreview = (0,
|
|
4558
|
+
var webSearchPreview = (0, import_provider_utils32.createProviderToolFactoryWithOutputSchema)({
|
|
4400
4559
|
id: "openai.web_search_preview",
|
|
4401
4560
|
inputSchema: webSearchPreviewInputSchema,
|
|
4402
4561
|
outputSchema: webSearchPreviewOutputSchema
|
|
@@ -4409,7 +4568,7 @@ async function prepareResponsesTools({
|
|
|
4409
4568
|
toolNameMapping,
|
|
4410
4569
|
customProviderToolNames
|
|
4411
4570
|
}) {
|
|
4412
|
-
var _a;
|
|
4571
|
+
var _a, _b;
|
|
4413
4572
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
4414
4573
|
const toolWarnings = [];
|
|
4415
4574
|
if (tools == null) {
|
|
@@ -4419,19 +4578,23 @@ async function prepareResponsesTools({
|
|
|
4419
4578
|
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
4420
4579
|
for (const tool of tools) {
|
|
4421
4580
|
switch (tool.type) {
|
|
4422
|
-
case "function":
|
|
4581
|
+
case "function": {
|
|
4582
|
+
const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
|
|
4583
|
+
const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
|
|
4423
4584
|
openaiTools.push({
|
|
4424
4585
|
type: "function",
|
|
4425
4586
|
name: tool.name,
|
|
4426
4587
|
description: tool.description,
|
|
4427
4588
|
parameters: tool.inputSchema,
|
|
4428
|
-
...tool.strict != null ? { strict: tool.strict } : {}
|
|
4589
|
+
...tool.strict != null ? { strict: tool.strict } : {},
|
|
4590
|
+
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
4429
4591
|
});
|
|
4430
4592
|
break;
|
|
4593
|
+
}
|
|
4431
4594
|
case "provider": {
|
|
4432
4595
|
switch (tool.id) {
|
|
4433
4596
|
case "openai.file_search": {
|
|
4434
|
-
const args = await (0,
|
|
4597
|
+
const args = await (0, import_provider_utils33.validateTypes)({
|
|
4435
4598
|
value: tool.args,
|
|
4436
4599
|
schema: fileSearchArgsSchema
|
|
4437
4600
|
});
|
|
@@ -4454,7 +4617,7 @@ async function prepareResponsesTools({
|
|
|
4454
4617
|
break;
|
|
4455
4618
|
}
|
|
4456
4619
|
case "openai.shell": {
|
|
4457
|
-
const args = await (0,
|
|
4620
|
+
const args = await (0, import_provider_utils33.validateTypes)({
|
|
4458
4621
|
value: tool.args,
|
|
4459
4622
|
schema: shellArgsSchema
|
|
4460
4623
|
});
|
|
@@ -4473,7 +4636,7 @@ async function prepareResponsesTools({
|
|
|
4473
4636
|
break;
|
|
4474
4637
|
}
|
|
4475
4638
|
case "openai.web_search_preview": {
|
|
4476
|
-
const args = await (0,
|
|
4639
|
+
const args = await (0, import_provider_utils33.validateTypes)({
|
|
4477
4640
|
value: tool.args,
|
|
4478
4641
|
schema: webSearchPreviewArgsSchema
|
|
4479
4642
|
});
|
|
@@ -4485,7 +4648,7 @@ async function prepareResponsesTools({
|
|
|
4485
4648
|
break;
|
|
4486
4649
|
}
|
|
4487
4650
|
case "openai.web_search": {
|
|
4488
|
-
const args = await (0,
|
|
4651
|
+
const args = await (0, import_provider_utils33.validateTypes)({
|
|
4489
4652
|
value: tool.args,
|
|
4490
4653
|
schema: webSearchArgsSchema
|
|
4491
4654
|
});
|
|
@@ -4499,7 +4662,7 @@ async function prepareResponsesTools({
|
|
|
4499
4662
|
break;
|
|
4500
4663
|
}
|
|
4501
4664
|
case "openai.code_interpreter": {
|
|
4502
|
-
const args = await (0,
|
|
4665
|
+
const args = await (0, import_provider_utils33.validateTypes)({
|
|
4503
4666
|
value: tool.args,
|
|
4504
4667
|
schema: codeInterpreterArgsSchema
|
|
4505
4668
|
});
|
|
@@ -4510,7 +4673,7 @@ async function prepareResponsesTools({
|
|
|
4510
4673
|
break;
|
|
4511
4674
|
}
|
|
4512
4675
|
case "openai.image_generation": {
|
|
4513
|
-
const args = await (0,
|
|
4676
|
+
const args = await (0, import_provider_utils33.validateTypes)({
|
|
4514
4677
|
value: tool.args,
|
|
4515
4678
|
schema: imageGenerationArgsSchema
|
|
4516
4679
|
});
|
|
@@ -4533,7 +4696,7 @@ async function prepareResponsesTools({
|
|
|
4533
4696
|
break;
|
|
4534
4697
|
}
|
|
4535
4698
|
case "openai.mcp": {
|
|
4536
|
-
const args = await (0,
|
|
4699
|
+
const args = await (0, import_provider_utils33.validateTypes)({
|
|
4537
4700
|
value: tool.args,
|
|
4538
4701
|
schema: mcpArgsSchema
|
|
4539
4702
|
});
|
|
@@ -4559,17 +4722,30 @@ async function prepareResponsesTools({
|
|
|
4559
4722
|
break;
|
|
4560
4723
|
}
|
|
4561
4724
|
case "openai.custom": {
|
|
4562
|
-
const args = await (0,
|
|
4725
|
+
const args = await (0, import_provider_utils33.validateTypes)({
|
|
4563
4726
|
value: tool.args,
|
|
4564
4727
|
schema: customArgsSchema
|
|
4565
4728
|
});
|
|
4566
4729
|
openaiTools.push({
|
|
4567
4730
|
type: "custom",
|
|
4568
|
-
name:
|
|
4731
|
+
name: tool.name,
|
|
4569
4732
|
description: args.description,
|
|
4570
4733
|
format: args.format
|
|
4571
4734
|
});
|
|
4572
|
-
resolvedCustomProviderToolNames.add(
|
|
4735
|
+
resolvedCustomProviderToolNames.add(tool.name);
|
|
4736
|
+
break;
|
|
4737
|
+
}
|
|
4738
|
+
case "openai.tool_search": {
|
|
4739
|
+
const args = await (0, import_provider_utils33.validateTypes)({
|
|
4740
|
+
value: tool.args,
|
|
4741
|
+
schema: toolSearchArgsSchema
|
|
4742
|
+
});
|
|
4743
|
+
openaiTools.push({
|
|
4744
|
+
type: "tool_search",
|
|
4745
|
+
...args.execution != null ? { execution: args.execution } : {},
|
|
4746
|
+
...args.description != null ? { description: args.description } : {},
|
|
4747
|
+
...args.parameters != null ? { parameters: args.parameters } : {}
|
|
4748
|
+
});
|
|
4573
4749
|
break;
|
|
4574
4750
|
}
|
|
4575
4751
|
}
|
|
@@ -4593,7 +4769,7 @@ async function prepareResponsesTools({
|
|
|
4593
4769
|
case "required":
|
|
4594
4770
|
return { tools: openaiTools, toolChoice: type, toolWarnings };
|
|
4595
4771
|
case "tool": {
|
|
4596
|
-
const resolvedToolName = (
|
|
4772
|
+
const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
|
|
4597
4773
|
return {
|
|
4598
4774
|
tools: openaiTools,
|
|
4599
4775
|
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 },
|
|
@@ -4673,7 +4849,7 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
|
4673
4849
|
}
|
|
4674
4850
|
var OpenAIResponsesLanguageModel = class {
|
|
4675
4851
|
constructor(modelId, config) {
|
|
4676
|
-
this.specificationVersion = "
|
|
4852
|
+
this.specificationVersion = "v4";
|
|
4677
4853
|
this.supportedUrls = {
|
|
4678
4854
|
"image/*": [/^https?:\/\/.*$/],
|
|
4679
4855
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -4718,13 +4894,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4718
4894
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
4719
4895
|
}
|
|
4720
4896
|
const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
|
|
4721
|
-
let openaiOptions = await (0,
|
|
4897
|
+
let openaiOptions = await (0, import_provider_utils34.parseProviderOptions)({
|
|
4722
4898
|
provider: providerOptionsName,
|
|
4723
4899
|
providerOptions,
|
|
4724
4900
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4725
4901
|
});
|
|
4726
4902
|
if (openaiOptions == null && providerOptionsName !== "openai") {
|
|
4727
|
-
openaiOptions = await (0,
|
|
4903
|
+
openaiOptions = await (0, import_provider_utils34.parseProviderOptions)({
|
|
4728
4904
|
provider: "openai",
|
|
4729
4905
|
providerOptions,
|
|
4730
4906
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
@@ -4738,7 +4914,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4738
4914
|
details: "conversation and previousResponseId cannot be used together"
|
|
4739
4915
|
});
|
|
4740
4916
|
}
|
|
4741
|
-
const toolNameMapping = (0,
|
|
4917
|
+
const toolNameMapping = (0, import_provider_utils34.createToolNameMapping)({
|
|
4742
4918
|
tools,
|
|
4743
4919
|
providerToolNames: {
|
|
4744
4920
|
"openai.code_interpreter": "code_interpreter",
|
|
@@ -4749,9 +4925,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4749
4925
|
"openai.web_search": "web_search",
|
|
4750
4926
|
"openai.web_search_preview": "web_search_preview",
|
|
4751
4927
|
"openai.mcp": "mcp",
|
|
4752
|
-
"openai.apply_patch": "apply_patch"
|
|
4753
|
-
|
|
4754
|
-
|
|
4928
|
+
"openai.apply_patch": "apply_patch",
|
|
4929
|
+
"openai.tool_search": "tool_search"
|
|
4930
|
+
}
|
|
4755
4931
|
});
|
|
4756
4932
|
const customProviderToolNames = /* @__PURE__ */ new Set();
|
|
4757
4933
|
const {
|
|
@@ -4927,7 +5103,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4927
5103
|
};
|
|
4928
5104
|
}
|
|
4929
5105
|
async doGenerate(options) {
|
|
4930
|
-
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;
|
|
5106
|
+
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;
|
|
4931
5107
|
const {
|
|
4932
5108
|
args: body,
|
|
4933
5109
|
warnings,
|
|
@@ -4945,12 +5121,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4945
5121
|
responseHeaders,
|
|
4946
5122
|
value: response,
|
|
4947
5123
|
rawValue: rawResponse
|
|
4948
|
-
} = await (0,
|
|
5124
|
+
} = await (0, import_provider_utils34.postJsonToApi)({
|
|
4949
5125
|
url,
|
|
4950
|
-
headers: (0,
|
|
5126
|
+
headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
|
|
4951
5127
|
body,
|
|
4952
5128
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4953
|
-
successfulResponseHandler: (0,
|
|
5129
|
+
successfulResponseHandler: (0, import_provider_utils34.createJsonResponseHandler)(
|
|
4954
5130
|
openaiResponsesResponseSchema
|
|
4955
5131
|
),
|
|
4956
5132
|
abortSignal: options.abortSignal,
|
|
@@ -4970,6 +5146,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4970
5146
|
const content = [];
|
|
4971
5147
|
const logprobs = [];
|
|
4972
5148
|
let hasFunctionCall = false;
|
|
5149
|
+
const hostedToolSearchCallIds = [];
|
|
4973
5150
|
for (const part of response.output) {
|
|
4974
5151
|
switch (part.type) {
|
|
4975
5152
|
case "reasoning": {
|
|
@@ -5008,6 +5185,46 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5008
5185
|
});
|
|
5009
5186
|
break;
|
|
5010
5187
|
}
|
|
5188
|
+
case "tool_search_call": {
|
|
5189
|
+
const toolCallId = (_b = part.call_id) != null ? _b : part.id;
|
|
5190
|
+
const isHosted = part.execution === "server";
|
|
5191
|
+
if (isHosted) {
|
|
5192
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5193
|
+
}
|
|
5194
|
+
content.push({
|
|
5195
|
+
type: "tool-call",
|
|
5196
|
+
toolCallId,
|
|
5197
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5198
|
+
input: JSON.stringify({
|
|
5199
|
+
arguments: part.arguments,
|
|
5200
|
+
call_id: part.call_id
|
|
5201
|
+
}),
|
|
5202
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5203
|
+
providerMetadata: {
|
|
5204
|
+
[providerOptionsName]: {
|
|
5205
|
+
itemId: part.id
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
5208
|
+
});
|
|
5209
|
+
break;
|
|
5210
|
+
}
|
|
5211
|
+
case "tool_search_output": {
|
|
5212
|
+
const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
|
|
5213
|
+
content.push({
|
|
5214
|
+
type: "tool-result",
|
|
5215
|
+
toolCallId,
|
|
5216
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5217
|
+
result: {
|
|
5218
|
+
tools: part.tools
|
|
5219
|
+
},
|
|
5220
|
+
providerMetadata: {
|
|
5221
|
+
[providerOptionsName]: {
|
|
5222
|
+
itemId: part.id
|
|
5223
|
+
}
|
|
5224
|
+
}
|
|
5225
|
+
});
|
|
5226
|
+
break;
|
|
5227
|
+
}
|
|
5011
5228
|
case "local_shell_call": {
|
|
5012
5229
|
content.push({
|
|
5013
5230
|
type: "tool-call",
|
|
@@ -5063,7 +5280,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5063
5280
|
}
|
|
5064
5281
|
case "message": {
|
|
5065
5282
|
for (const contentPart of part.content) {
|
|
5066
|
-
if (((
|
|
5283
|
+
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
|
|
5067
5284
|
logprobs.push(contentPart.logprobs);
|
|
5068
5285
|
}
|
|
5069
5286
|
const providerMetadata2 = {
|
|
@@ -5085,7 +5302,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5085
5302
|
content.push({
|
|
5086
5303
|
type: "source",
|
|
5087
5304
|
sourceType: "url",
|
|
5088
|
-
id: (
|
|
5305
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils34.generateId)(),
|
|
5089
5306
|
url: annotation.url,
|
|
5090
5307
|
title: annotation.title
|
|
5091
5308
|
});
|
|
@@ -5093,7 +5310,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5093
5310
|
content.push({
|
|
5094
5311
|
type: "source",
|
|
5095
5312
|
sourceType: "document",
|
|
5096
|
-
id: (
|
|
5313
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils34.generateId)(),
|
|
5097
5314
|
mediaType: "text/plain",
|
|
5098
5315
|
title: annotation.filename,
|
|
5099
5316
|
filename: annotation.filename,
|
|
@@ -5109,7 +5326,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5109
5326
|
content.push({
|
|
5110
5327
|
type: "source",
|
|
5111
5328
|
sourceType: "document",
|
|
5112
|
-
id: (
|
|
5329
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils34.generateId)(),
|
|
5113
5330
|
mediaType: "text/plain",
|
|
5114
5331
|
title: annotation.filename,
|
|
5115
5332
|
filename: annotation.filename,
|
|
@@ -5125,7 +5342,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5125
5342
|
content.push({
|
|
5126
5343
|
type: "source",
|
|
5127
5344
|
sourceType: "document",
|
|
5128
|
-
id: (
|
|
5345
|
+
id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils34.generateId)(),
|
|
5129
5346
|
mediaType: "application/octet-stream",
|
|
5130
5347
|
title: annotation.file_id,
|
|
5131
5348
|
filename: annotation.file_id,
|
|
@@ -5194,7 +5411,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5194
5411
|
break;
|
|
5195
5412
|
}
|
|
5196
5413
|
case "mcp_call": {
|
|
5197
|
-
const toolCallId = part.approval_request_id != null ? (
|
|
5414
|
+
const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
|
|
5198
5415
|
const toolName = `mcp.${part.name}`;
|
|
5199
5416
|
content.push({
|
|
5200
5417
|
type: "tool-call",
|
|
@@ -5228,8 +5445,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5228
5445
|
break;
|
|
5229
5446
|
}
|
|
5230
5447
|
case "mcp_approval_request": {
|
|
5231
|
-
const approvalRequestId = (
|
|
5232
|
-
const dummyToolCallId = (
|
|
5448
|
+
const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
|
|
5449
|
+
const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils34.generateId)();
|
|
5233
5450
|
const toolName = `mcp.${part.name}`;
|
|
5234
5451
|
content.push({
|
|
5235
5452
|
type: "tool-call",
|
|
@@ -5279,13 +5496,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5279
5496
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5280
5497
|
result: {
|
|
5281
5498
|
queries: part.queries,
|
|
5282
|
-
results: (
|
|
5499
|
+
results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
|
|
5283
5500
|
attributes: result.attributes,
|
|
5284
5501
|
fileId: result.file_id,
|
|
5285
5502
|
filename: result.filename,
|
|
5286
5503
|
score: result.score,
|
|
5287
5504
|
text: result.text
|
|
5288
|
-
}))) != null ?
|
|
5505
|
+
}))) != null ? _y : null
|
|
5289
5506
|
}
|
|
5290
5507
|
});
|
|
5291
5508
|
break;
|
|
@@ -5342,10 +5559,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5342
5559
|
content,
|
|
5343
5560
|
finishReason: {
|
|
5344
5561
|
unified: mapOpenAIResponseFinishReason({
|
|
5345
|
-
finishReason: (
|
|
5562
|
+
finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
|
|
5346
5563
|
hasFunctionCall
|
|
5347
5564
|
}),
|
|
5348
|
-
raw: (
|
|
5565
|
+
raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
|
|
5349
5566
|
},
|
|
5350
5567
|
usage: convertOpenAIResponsesUsage(usage),
|
|
5351
5568
|
request: { body },
|
|
@@ -5370,18 +5587,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5370
5587
|
providerOptionsName,
|
|
5371
5588
|
isShellProviderExecuted
|
|
5372
5589
|
} = await this.getArgs(options);
|
|
5373
|
-
const { responseHeaders, value: response } = await (0,
|
|
5590
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils34.postJsonToApi)({
|
|
5374
5591
|
url: this.config.url({
|
|
5375
5592
|
path: "/responses",
|
|
5376
5593
|
modelId: this.modelId
|
|
5377
5594
|
}),
|
|
5378
|
-
headers: (0,
|
|
5595
|
+
headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
|
|
5379
5596
|
body: {
|
|
5380
5597
|
...body,
|
|
5381
5598
|
stream: true
|
|
5382
5599
|
},
|
|
5383
5600
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
5384
|
-
successfulResponseHandler: (0,
|
|
5601
|
+
successfulResponseHandler: (0, import_provider_utils34.createEventSourceResponseHandler)(
|
|
5385
5602
|
openaiResponsesChunkSchema
|
|
5386
5603
|
),
|
|
5387
5604
|
abortSignal: options.abortSignal,
|
|
@@ -5403,6 +5620,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5403
5620
|
let hasFunctionCall = false;
|
|
5404
5621
|
const activeReasoning = {};
|
|
5405
5622
|
let serviceTier;
|
|
5623
|
+
const hostedToolSearchCallIds = [];
|
|
5406
5624
|
return {
|
|
5407
5625
|
stream: response.pipeThrough(
|
|
5408
5626
|
new TransformStream({
|
|
@@ -5410,7 +5628,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5410
5628
|
controller.enqueue({ type: "stream-start", warnings });
|
|
5411
5629
|
},
|
|
5412
5630
|
transform(chunk, controller) {
|
|
5413
|
-
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;
|
|
5631
|
+
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;
|
|
5414
5632
|
if (options.includeRawChunks) {
|
|
5415
5633
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
5416
5634
|
}
|
|
@@ -5518,6 +5736,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5518
5736
|
input: "{}",
|
|
5519
5737
|
providerExecuted: true
|
|
5520
5738
|
});
|
|
5739
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5740
|
+
const toolCallId = value.item.id;
|
|
5741
|
+
const toolName = toolNameMapping.toCustomToolName("tool_search");
|
|
5742
|
+
const isHosted = value.item.execution === "server";
|
|
5743
|
+
ongoingToolCalls[value.output_index] = {
|
|
5744
|
+
toolName,
|
|
5745
|
+
toolCallId,
|
|
5746
|
+
toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
|
|
5747
|
+
};
|
|
5748
|
+
if (isHosted) {
|
|
5749
|
+
controller.enqueue({
|
|
5750
|
+
type: "tool-input-start",
|
|
5751
|
+
id: toolCallId,
|
|
5752
|
+
toolName,
|
|
5753
|
+
providerExecuted: true
|
|
5754
|
+
});
|
|
5755
|
+
}
|
|
5756
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5521
5757
|
} else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
|
|
5522
5758
|
} else if (value.item.type === "apply_patch_call") {
|
|
5523
5759
|
const { call_id: callId, operation } = value.item;
|
|
@@ -5564,7 +5800,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5564
5800
|
} else if (value.item.type === "shell_call_output") {
|
|
5565
5801
|
} else if (value.item.type === "message") {
|
|
5566
5802
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
5567
|
-
activeMessagePhase = (
|
|
5803
|
+
activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
|
|
5568
5804
|
controller.enqueue({
|
|
5569
5805
|
type: "text-start",
|
|
5570
5806
|
id: value.item.id,
|
|
@@ -5588,14 +5824,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5588
5824
|
providerMetadata: {
|
|
5589
5825
|
[providerOptionsName]: {
|
|
5590
5826
|
itemId: value.item.id,
|
|
5591
|
-
reasoningEncryptedContent: (
|
|
5827
|
+
reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
|
|
5592
5828
|
}
|
|
5593
5829
|
}
|
|
5594
5830
|
});
|
|
5595
5831
|
}
|
|
5596
5832
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
5597
5833
|
if (value.item.type === "message") {
|
|
5598
|
-
const phase = (
|
|
5834
|
+
const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
|
|
5599
5835
|
activeMessagePhase = void 0;
|
|
5600
5836
|
controller.enqueue({
|
|
5601
5837
|
type: "text-end",
|
|
@@ -5689,13 +5925,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5689
5925
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5690
5926
|
result: {
|
|
5691
5927
|
queries: value.item.queries,
|
|
5692
|
-
results: (
|
|
5928
|
+
results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
|
|
5693
5929
|
attributes: result.attributes,
|
|
5694
5930
|
fileId: result.file_id,
|
|
5695
5931
|
filename: result.filename,
|
|
5696
5932
|
score: result.score,
|
|
5697
5933
|
text: result.text
|
|
5698
|
-
}))) != null ?
|
|
5934
|
+
}))) != null ? _f : null
|
|
5699
5935
|
}
|
|
5700
5936
|
});
|
|
5701
5937
|
} else if (value.item.type === "code_interpreter_call") {
|
|
@@ -5717,12 +5953,62 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5717
5953
|
result: value.item.result
|
|
5718
5954
|
}
|
|
5719
5955
|
});
|
|
5956
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5957
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
5958
|
+
const isHosted = value.item.execution === "server";
|
|
5959
|
+
if (toolCall != null) {
|
|
5960
|
+
const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
|
|
5961
|
+
if (isHosted) {
|
|
5962
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5963
|
+
} else {
|
|
5964
|
+
controller.enqueue({
|
|
5965
|
+
type: "tool-input-start",
|
|
5966
|
+
id: toolCallId,
|
|
5967
|
+
toolName: toolCall.toolName
|
|
5968
|
+
});
|
|
5969
|
+
}
|
|
5970
|
+
controller.enqueue({
|
|
5971
|
+
type: "tool-input-end",
|
|
5972
|
+
id: toolCallId
|
|
5973
|
+
});
|
|
5974
|
+
controller.enqueue({
|
|
5975
|
+
type: "tool-call",
|
|
5976
|
+
toolCallId,
|
|
5977
|
+
toolName: toolCall.toolName,
|
|
5978
|
+
input: JSON.stringify({
|
|
5979
|
+
arguments: value.item.arguments,
|
|
5980
|
+
call_id: isHosted ? null : toolCallId
|
|
5981
|
+
}),
|
|
5982
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5983
|
+
providerMetadata: {
|
|
5984
|
+
[providerOptionsName]: {
|
|
5985
|
+
itemId: value.item.id
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5988
|
+
});
|
|
5989
|
+
}
|
|
5990
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
5991
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5992
|
+
const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
|
|
5993
|
+
controller.enqueue({
|
|
5994
|
+
type: "tool-result",
|
|
5995
|
+
toolCallId,
|
|
5996
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5997
|
+
result: {
|
|
5998
|
+
tools: value.item.tools
|
|
5999
|
+
},
|
|
6000
|
+
providerMetadata: {
|
|
6001
|
+
[providerOptionsName]: {
|
|
6002
|
+
itemId: value.item.id
|
|
6003
|
+
}
|
|
6004
|
+
}
|
|
6005
|
+
});
|
|
5720
6006
|
} else if (value.item.type === "mcp_call") {
|
|
5721
6007
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5722
|
-
const approvalRequestId = (
|
|
5723
|
-
const aliasedToolCallId = approvalRequestId != null ? (
|
|
6008
|
+
const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
|
|
6009
|
+
const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
5724
6010
|
approvalRequestId
|
|
5725
|
-
)) != null ?
|
|
6011
|
+
)) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
|
|
5726
6012
|
const toolName = `mcp.${value.item.name}`;
|
|
5727
6013
|
controller.enqueue({
|
|
5728
6014
|
type: "tool-call",
|
|
@@ -5792,8 +6078,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5792
6078
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5793
6079
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5794
6080
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5795
|
-
const dummyToolCallId = (
|
|
5796
|
-
const approvalRequestId = (
|
|
6081
|
+
const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils34.generateId)();
|
|
6082
|
+
const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
|
|
5797
6083
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5798
6084
|
approvalRequestId,
|
|
5799
6085
|
dummyToolCallId
|
|
@@ -5882,7 +6168,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5882
6168
|
providerMetadata: {
|
|
5883
6169
|
[providerOptionsName]: {
|
|
5884
6170
|
itemId: value.item.id,
|
|
5885
|
-
reasoningEncryptedContent: (
|
|
6171
|
+
reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
|
|
5886
6172
|
}
|
|
5887
6173
|
}
|
|
5888
6174
|
});
|
|
@@ -5995,7 +6281,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5995
6281
|
id: value.item_id,
|
|
5996
6282
|
delta: value.delta
|
|
5997
6283
|
});
|
|
5998
|
-
if (((
|
|
6284
|
+
if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
|
|
5999
6285
|
logprobs.push(value.logprobs);
|
|
6000
6286
|
}
|
|
6001
6287
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -6024,7 +6310,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6024
6310
|
providerMetadata: {
|
|
6025
6311
|
[providerOptionsName]: {
|
|
6026
6312
|
itemId: value.item_id,
|
|
6027
|
-
reasoningEncryptedContent: (
|
|
6313
|
+
reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
|
|
6028
6314
|
}
|
|
6029
6315
|
}
|
|
6030
6316
|
});
|
|
@@ -6058,10 +6344,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6058
6344
|
} else if (isResponseFinishedChunk(value)) {
|
|
6059
6345
|
finishReason = {
|
|
6060
6346
|
unified: mapOpenAIResponseFinishReason({
|
|
6061
|
-
finishReason: (
|
|
6347
|
+
finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
|
|
6062
6348
|
hasFunctionCall
|
|
6063
6349
|
}),
|
|
6064
|
-
raw: (
|
|
6350
|
+
raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
|
|
6065
6351
|
};
|
|
6066
6352
|
usage = value.response.usage;
|
|
6067
6353
|
if (typeof value.response.service_tier === "string") {
|
|
@@ -6073,7 +6359,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6073
6359
|
controller.enqueue({
|
|
6074
6360
|
type: "source",
|
|
6075
6361
|
sourceType: "url",
|
|
6076
|
-
id: (
|
|
6362
|
+
id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : (0, import_provider_utils34.generateId)(),
|
|
6077
6363
|
url: value.annotation.url,
|
|
6078
6364
|
title: value.annotation.title
|
|
6079
6365
|
});
|
|
@@ -6081,7 +6367,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6081
6367
|
controller.enqueue({
|
|
6082
6368
|
type: "source",
|
|
6083
6369
|
sourceType: "document",
|
|
6084
|
-
id: (
|
|
6370
|
+
id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : (0, import_provider_utils34.generateId)(),
|
|
6085
6371
|
mediaType: "text/plain",
|
|
6086
6372
|
title: value.annotation.filename,
|
|
6087
6373
|
filename: value.annotation.filename,
|
|
@@ -6097,7 +6383,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6097
6383
|
controller.enqueue({
|
|
6098
6384
|
type: "source",
|
|
6099
6385
|
sourceType: "document",
|
|
6100
|
-
id: (
|
|
6386
|
+
id: (_G = (_F = (_E = self.config).generateId) == null ? void 0 : _F.call(_E)) != null ? _G : (0, import_provider_utils34.generateId)(),
|
|
6101
6387
|
mediaType: "text/plain",
|
|
6102
6388
|
title: value.annotation.filename,
|
|
6103
6389
|
filename: value.annotation.filename,
|
|
@@ -6113,7 +6399,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6113
6399
|
controller.enqueue({
|
|
6114
6400
|
type: "source",
|
|
6115
6401
|
sourceType: "document",
|
|
6116
|
-
id: (
|
|
6402
|
+
id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : (0, import_provider_utils34.generateId)(),
|
|
6117
6403
|
mediaType: "application/octet-stream",
|
|
6118
6404
|
title: value.annotation.file_id,
|
|
6119
6405
|
filename: value.annotation.file_id,
|