@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/index.mjs
CHANGED
|
@@ -245,6 +245,9 @@ function convertToOpenAIChatMessages({
|
|
|
245
245
|
}
|
|
246
246
|
case "tool": {
|
|
247
247
|
for (const toolResponse of content) {
|
|
248
|
+
if (toolResponse.type === "tool-approval-response") {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
248
251
|
const output = toolResponse.output;
|
|
249
252
|
let contentValue;
|
|
250
253
|
switch (output.type) {
|
|
@@ -2331,16 +2334,14 @@ var mcpArgsSchema = lazySchema16(
|
|
|
2331
2334
|
authorization: z17.string().optional(),
|
|
2332
2335
|
connectorId: z17.string().optional(),
|
|
2333
2336
|
headers: z17.record(z17.string(), z17.string()).optional(),
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
// ])
|
|
2343
|
-
// .optional(),
|
|
2337
|
+
requireApproval: z17.union([
|
|
2338
|
+
z17.enum(["always", "never"]),
|
|
2339
|
+
z17.object({
|
|
2340
|
+
never: z17.object({
|
|
2341
|
+
toolNames: z17.array(z17.string()).optional()
|
|
2342
|
+
}).optional()
|
|
2343
|
+
})
|
|
2344
|
+
]).optional(),
|
|
2344
2345
|
serverDescription: z17.string().optional(),
|
|
2345
2346
|
serverUrl: z17.string().optional()
|
|
2346
2347
|
}).refine(
|
|
@@ -2352,36 +2353,14 @@ var mcpArgsSchema = lazySchema16(
|
|
|
2352
2353
|
var mcpInputSchema = lazySchema16(() => zodSchema16(z17.object({})));
|
|
2353
2354
|
var mcpOutputSchema = lazySchema16(
|
|
2354
2355
|
() => zodSchema16(
|
|
2355
|
-
z17.
|
|
2356
|
-
z17.
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
}),
|
|
2364
|
-
z17.object({
|
|
2365
|
-
type: z17.literal("listTools"),
|
|
2366
|
-
serverLabel: z17.string(),
|
|
2367
|
-
tools: z17.array(
|
|
2368
|
-
z17.object({
|
|
2369
|
-
name: z17.string(),
|
|
2370
|
-
description: z17.string().optional(),
|
|
2371
|
-
inputSchema: jsonValueSchema,
|
|
2372
|
-
annotations: z17.record(z17.string(), jsonValueSchema).optional()
|
|
2373
|
-
})
|
|
2374
|
-
),
|
|
2375
|
-
error: z17.union([z17.string(), jsonValueSchema]).optional()
|
|
2376
|
-
}),
|
|
2377
|
-
z17.object({
|
|
2378
|
-
type: z17.literal("approvalRequest"),
|
|
2379
|
-
serverLabel: z17.string(),
|
|
2380
|
-
name: z17.string(),
|
|
2381
|
-
arguments: z17.string(),
|
|
2382
|
-
approvalRequestId: z17.string()
|
|
2383
|
-
})
|
|
2384
|
-
])
|
|
2356
|
+
z17.object({
|
|
2357
|
+
type: z17.literal("call"),
|
|
2358
|
+
serverLabel: z17.string(),
|
|
2359
|
+
name: z17.string(),
|
|
2360
|
+
arguments: z17.string(),
|
|
2361
|
+
output: z17.string().nullable().optional(),
|
|
2362
|
+
error: z17.union([z17.string(), jsonValueSchema]).optional()
|
|
2363
|
+
})
|
|
2385
2364
|
)
|
|
2386
2365
|
);
|
|
2387
2366
|
var mcpToolFactory = createProviderToolFactoryWithOutputSchema9({
|
|
@@ -2790,6 +2769,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2790
2769
|
}
|
|
2791
2770
|
case "tool": {
|
|
2792
2771
|
for (const part of content) {
|
|
2772
|
+
if (part.type === "tool-approval-response") {
|
|
2773
|
+
continue;
|
|
2774
|
+
}
|
|
2793
2775
|
const output = part.output;
|
|
2794
2776
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2795
2777
|
part.toolName
|
|
@@ -4486,54 +4468,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4486
4468
|
break;
|
|
4487
4469
|
}
|
|
4488
4470
|
case "mcp_list_tools": {
|
|
4489
|
-
content.push({
|
|
4490
|
-
type: "tool-call",
|
|
4491
|
-
toolCallId: part.id,
|
|
4492
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4493
|
-
input: JSON.stringify({}),
|
|
4494
|
-
providerExecuted: true
|
|
4495
|
-
});
|
|
4496
|
-
content.push({
|
|
4497
|
-
type: "tool-result",
|
|
4498
|
-
toolCallId: part.id,
|
|
4499
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4500
|
-
result: {
|
|
4501
|
-
type: "listTools",
|
|
4502
|
-
serverLabel: part.server_label,
|
|
4503
|
-
tools: part.tools.map((t) => {
|
|
4504
|
-
var _a2, _b2;
|
|
4505
|
-
return {
|
|
4506
|
-
name: t.name,
|
|
4507
|
-
description: (_a2 = t.description) != null ? _a2 : void 0,
|
|
4508
|
-
inputSchema: t.input_schema,
|
|
4509
|
-
annotations: (_b2 = t.annotations) != null ? _b2 : void 0
|
|
4510
|
-
};
|
|
4511
|
-
}),
|
|
4512
|
-
...part.error != null ? { error: part.error } : {}
|
|
4513
|
-
}
|
|
4514
|
-
});
|
|
4515
4471
|
break;
|
|
4516
4472
|
}
|
|
4517
4473
|
case "mcp_approval_request": {
|
|
4518
|
-
content.push({
|
|
4519
|
-
type: "tool-call",
|
|
4520
|
-
toolCallId: part.id,
|
|
4521
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4522
|
-
input: JSON.stringify({}),
|
|
4523
|
-
providerExecuted: true
|
|
4524
|
-
});
|
|
4525
|
-
content.push({
|
|
4526
|
-
type: "tool-result",
|
|
4527
|
-
toolCallId: part.id,
|
|
4528
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4529
|
-
result: {
|
|
4530
|
-
type: "approvalRequest",
|
|
4531
|
-
serverLabel: part.server_label,
|
|
4532
|
-
name: part.name,
|
|
4533
|
-
arguments: part.arguments,
|
|
4534
|
-
approvalRequestId: part.approval_request_id
|
|
4535
|
-
}
|
|
4536
|
-
});
|
|
4537
4474
|
break;
|
|
4538
4475
|
}
|
|
4539
4476
|
case "computer_call": {
|
|
@@ -4971,25 +4908,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4971
4908
|
});
|
|
4972
4909
|
} else if (value.item.type === "mcp_list_tools") {
|
|
4973
4910
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4974
|
-
controller.enqueue({
|
|
4975
|
-
type: "tool-result",
|
|
4976
|
-
toolCallId: value.item.id,
|
|
4977
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4978
|
-
result: {
|
|
4979
|
-
type: "listTools",
|
|
4980
|
-
serverLabel: value.item.server_label,
|
|
4981
|
-
tools: value.item.tools.map((t) => {
|
|
4982
|
-
var _a2, _b2;
|
|
4983
|
-
return {
|
|
4984
|
-
name: t.name,
|
|
4985
|
-
description: (_a2 = t.description) != null ? _a2 : void 0,
|
|
4986
|
-
inputSchema: t.input_schema,
|
|
4987
|
-
annotations: (_b2 = t.annotations) != null ? _b2 : void 0
|
|
4988
|
-
};
|
|
4989
|
-
}),
|
|
4990
|
-
...value.item.error != null ? { error: value.item.error } : {}
|
|
4991
|
-
}
|
|
4992
|
-
});
|
|
4993
4911
|
} else if (value.item.type === "apply_patch_call") {
|
|
4994
4912
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4995
4913
|
if (value.item.status === "completed") {
|
|
@@ -5010,18 +4928,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5010
4928
|
}
|
|
5011
4929
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5012
4930
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5013
|
-
controller.enqueue({
|
|
5014
|
-
type: "tool-result",
|
|
5015
|
-
toolCallId: value.item.id,
|
|
5016
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
5017
|
-
result: {
|
|
5018
|
-
type: "approvalRequest",
|
|
5019
|
-
serverLabel: value.item.server_label,
|
|
5020
|
-
name: value.item.name,
|
|
5021
|
-
arguments: value.item.arguments,
|
|
5022
|
-
approvalRequestId: value.item.approval_request_id
|
|
5023
|
-
}
|
|
5024
|
-
});
|
|
5025
4931
|
} else if (value.item.type === "local_shell_call") {
|
|
5026
4932
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5027
4933
|
controller.enqueue({
|
|
@@ -5721,7 +5627,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5721
5627
|
};
|
|
5722
5628
|
|
|
5723
5629
|
// src/version.ts
|
|
5724
|
-
var VERSION = true ? "3.0.0-beta.
|
|
5630
|
+
var VERSION = true ? "3.0.0-beta.110" : "0.0.0-test";
|
|
5725
5631
|
|
|
5726
5632
|
// src/openai-provider.ts
|
|
5727
5633
|
function createOpenAI(options = {}) {
|