@ai-sdk/openai 3.0.0-beta.109 → 3.0.0-beta.110
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 +9 -0
- package/dist/index.d.mts +5 -16
- package/dist/index.d.ts +5 -16
- package/dist/index.js +23 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -117
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +22 -116
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +22 -116
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -283,6 +283,9 @@ function convertToOpenAIChatMessages({
|
|
|
283
283
|
}
|
|
284
284
|
case "tool": {
|
|
285
285
|
for (const toolResponse of content) {
|
|
286
|
+
if (toolResponse.type === "tool-approval-response") {
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
286
289
|
const output = toolResponse.output;
|
|
287
290
|
let contentValue;
|
|
288
291
|
switch (output.type) {
|
|
@@ -2689,6 +2692,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2689
2692
|
}
|
|
2690
2693
|
case "tool": {
|
|
2691
2694
|
for (const part of content) {
|
|
2695
|
+
if (part.type === "tool-approval-response") {
|
|
2696
|
+
continue;
|
|
2697
|
+
}
|
|
2692
2698
|
const output = part.output;
|
|
2693
2699
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2694
2700
|
part.toolName
|
|
@@ -3878,16 +3884,14 @@ var mcpArgsSchema = (0, import_provider_utils28.lazySchema)(
|
|
|
3878
3884
|
authorization: import_v421.z.string().optional(),
|
|
3879
3885
|
connectorId: import_v421.z.string().optional(),
|
|
3880
3886
|
headers: import_v421.z.record(import_v421.z.string(), import_v421.z.string()).optional(),
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
// ])
|
|
3890
|
-
// .optional(),
|
|
3887
|
+
requireApproval: import_v421.z.union([
|
|
3888
|
+
import_v421.z.enum(["always", "never"]),
|
|
3889
|
+
import_v421.z.object({
|
|
3890
|
+
never: import_v421.z.object({
|
|
3891
|
+
toolNames: import_v421.z.array(import_v421.z.string()).optional()
|
|
3892
|
+
}).optional()
|
|
3893
|
+
})
|
|
3894
|
+
]).optional(),
|
|
3891
3895
|
serverDescription: import_v421.z.string().optional(),
|
|
3892
3896
|
serverUrl: import_v421.z.string().optional()
|
|
3893
3897
|
}).refine(
|
|
@@ -3899,36 +3903,14 @@ var mcpArgsSchema = (0, import_provider_utils28.lazySchema)(
|
|
|
3899
3903
|
var mcpInputSchema = (0, import_provider_utils28.lazySchema)(() => (0, import_provider_utils28.zodSchema)(import_v421.z.object({})));
|
|
3900
3904
|
var mcpOutputSchema = (0, import_provider_utils28.lazySchema)(
|
|
3901
3905
|
() => (0, import_provider_utils28.zodSchema)(
|
|
3902
|
-
import_v421.z.
|
|
3903
|
-
import_v421.z.
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
}),
|
|
3911
|
-
import_v421.z.object({
|
|
3912
|
-
type: import_v421.z.literal("listTools"),
|
|
3913
|
-
serverLabel: import_v421.z.string(),
|
|
3914
|
-
tools: import_v421.z.array(
|
|
3915
|
-
import_v421.z.object({
|
|
3916
|
-
name: import_v421.z.string(),
|
|
3917
|
-
description: import_v421.z.string().optional(),
|
|
3918
|
-
inputSchema: jsonValueSchema,
|
|
3919
|
-
annotations: import_v421.z.record(import_v421.z.string(), jsonValueSchema).optional()
|
|
3920
|
-
})
|
|
3921
|
-
),
|
|
3922
|
-
error: import_v421.z.union([import_v421.z.string(), jsonValueSchema]).optional()
|
|
3923
|
-
}),
|
|
3924
|
-
import_v421.z.object({
|
|
3925
|
-
type: import_v421.z.literal("approvalRequest"),
|
|
3926
|
-
serverLabel: import_v421.z.string(),
|
|
3927
|
-
name: import_v421.z.string(),
|
|
3928
|
-
arguments: import_v421.z.string(),
|
|
3929
|
-
approvalRequestId: import_v421.z.string()
|
|
3930
|
-
})
|
|
3931
|
-
])
|
|
3906
|
+
import_v421.z.object({
|
|
3907
|
+
type: import_v421.z.literal("call"),
|
|
3908
|
+
serverLabel: import_v421.z.string(),
|
|
3909
|
+
name: import_v421.z.string(),
|
|
3910
|
+
arguments: import_v421.z.string(),
|
|
3911
|
+
output: import_v421.z.string().nullable().optional(),
|
|
3912
|
+
error: import_v421.z.union([import_v421.z.string(), jsonValueSchema]).optional()
|
|
3913
|
+
})
|
|
3932
3914
|
)
|
|
3933
3915
|
);
|
|
3934
3916
|
var mcpToolFactory = (0, import_provider_utils28.createProviderToolFactoryWithOutputSchema)({
|
|
@@ -4699,54 +4681,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4699
4681
|
break;
|
|
4700
4682
|
}
|
|
4701
4683
|
case "mcp_list_tools": {
|
|
4702
|
-
content.push({
|
|
4703
|
-
type: "tool-call",
|
|
4704
|
-
toolCallId: part.id,
|
|
4705
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4706
|
-
input: JSON.stringify({}),
|
|
4707
|
-
providerExecuted: true
|
|
4708
|
-
});
|
|
4709
|
-
content.push({
|
|
4710
|
-
type: "tool-result",
|
|
4711
|
-
toolCallId: part.id,
|
|
4712
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4713
|
-
result: {
|
|
4714
|
-
type: "listTools",
|
|
4715
|
-
serverLabel: part.server_label,
|
|
4716
|
-
tools: part.tools.map((t) => {
|
|
4717
|
-
var _a2, _b2;
|
|
4718
|
-
return {
|
|
4719
|
-
name: t.name,
|
|
4720
|
-
description: (_a2 = t.description) != null ? _a2 : void 0,
|
|
4721
|
-
inputSchema: t.input_schema,
|
|
4722
|
-
annotations: (_b2 = t.annotations) != null ? _b2 : void 0
|
|
4723
|
-
};
|
|
4724
|
-
}),
|
|
4725
|
-
...part.error != null ? { error: part.error } : {}
|
|
4726
|
-
}
|
|
4727
|
-
});
|
|
4728
4684
|
break;
|
|
4729
4685
|
}
|
|
4730
4686
|
case "mcp_approval_request": {
|
|
4731
|
-
content.push({
|
|
4732
|
-
type: "tool-call",
|
|
4733
|
-
toolCallId: part.id,
|
|
4734
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4735
|
-
input: JSON.stringify({}),
|
|
4736
|
-
providerExecuted: true
|
|
4737
|
-
});
|
|
4738
|
-
content.push({
|
|
4739
|
-
type: "tool-result",
|
|
4740
|
-
toolCallId: part.id,
|
|
4741
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4742
|
-
result: {
|
|
4743
|
-
type: "approvalRequest",
|
|
4744
|
-
serverLabel: part.server_label,
|
|
4745
|
-
name: part.name,
|
|
4746
|
-
arguments: part.arguments,
|
|
4747
|
-
approvalRequestId: part.approval_request_id
|
|
4748
|
-
}
|
|
4749
|
-
});
|
|
4750
4687
|
break;
|
|
4751
4688
|
}
|
|
4752
4689
|
case "computer_call": {
|
|
@@ -5184,25 +5121,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5184
5121
|
});
|
|
5185
5122
|
} else if (value.item.type === "mcp_list_tools") {
|
|
5186
5123
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5187
|
-
controller.enqueue({
|
|
5188
|
-
type: "tool-result",
|
|
5189
|
-
toolCallId: value.item.id,
|
|
5190
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
5191
|
-
result: {
|
|
5192
|
-
type: "listTools",
|
|
5193
|
-
serverLabel: value.item.server_label,
|
|
5194
|
-
tools: value.item.tools.map((t) => {
|
|
5195
|
-
var _a2, _b2;
|
|
5196
|
-
return {
|
|
5197
|
-
name: t.name,
|
|
5198
|
-
description: (_a2 = t.description) != null ? _a2 : void 0,
|
|
5199
|
-
inputSchema: t.input_schema,
|
|
5200
|
-
annotations: (_b2 = t.annotations) != null ? _b2 : void 0
|
|
5201
|
-
};
|
|
5202
|
-
}),
|
|
5203
|
-
...value.item.error != null ? { error: value.item.error } : {}
|
|
5204
|
-
}
|
|
5205
|
-
});
|
|
5206
5124
|
} else if (value.item.type === "apply_patch_call") {
|
|
5207
5125
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5208
5126
|
if (value.item.status === "completed") {
|
|
@@ -5223,18 +5141,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5223
5141
|
}
|
|
5224
5142
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5225
5143
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5226
|
-
controller.enqueue({
|
|
5227
|
-
type: "tool-result",
|
|
5228
|
-
toolCallId: value.item.id,
|
|
5229
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
5230
|
-
result: {
|
|
5231
|
-
type: "approvalRequest",
|
|
5232
|
-
serverLabel: value.item.server_label,
|
|
5233
|
-
name: value.item.name,
|
|
5234
|
-
arguments: value.item.arguments,
|
|
5235
|
-
approvalRequestId: value.item.approval_request_id
|
|
5236
|
-
}
|
|
5237
|
-
});
|
|
5238
5144
|
} else if (value.item.type === "local_shell_call") {
|
|
5239
5145
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5240
5146
|
controller.enqueue({
|