@ai-sdk/openai 3.0.0 → 3.0.2
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 +60 -303
- package/dist/index.js +157 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +157 -46
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +156 -45
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +156 -45
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/internal/index.mjs
CHANGED
|
@@ -2490,9 +2490,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2490
2490
|
hasShellTool = false,
|
|
2491
2491
|
hasApplyPatchTool = false
|
|
2492
2492
|
}) {
|
|
2493
|
-
var _a, _b, _c, _d, _e;
|
|
2493
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2494
2494
|
const input = [];
|
|
2495
2495
|
const warnings = [];
|
|
2496
|
+
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2496
2497
|
for (const { role, content } of prompt) {
|
|
2497
2498
|
switch (role) {
|
|
2498
2499
|
case "system": {
|
|
@@ -2583,10 +2584,13 @@ async function convertToOpenAIResponsesInput({
|
|
|
2583
2584
|
break;
|
|
2584
2585
|
}
|
|
2585
2586
|
case "tool-call": {
|
|
2587
|
+
const id = (_g = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.itemId) != null ? _g : (_f = (_e = part.providerMetadata) == null ? void 0 : _e.openai) == null ? void 0 : _f.itemId;
|
|
2586
2588
|
if (part.providerExecuted) {
|
|
2589
|
+
if (store && id != null) {
|
|
2590
|
+
input.push({ type: "item_reference", id });
|
|
2591
|
+
}
|
|
2587
2592
|
break;
|
|
2588
2593
|
}
|
|
2589
|
-
const id = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.itemId;
|
|
2590
2594
|
if (store && id != null) {
|
|
2591
2595
|
input.push({ type: "item_reference", id });
|
|
2592
2596
|
break;
|
|
@@ -2643,8 +2647,12 @@ async function convertToOpenAIResponsesInput({
|
|
|
2643
2647
|
}
|
|
2644
2648
|
// assistant tool result parts are from provider-executed tools:
|
|
2645
2649
|
case "tool-result": {
|
|
2650
|
+
if (part.output.type === "execution-denied" || part.output.type === "json" && typeof part.output.value === "object" && part.output.value != null && "type" in part.output.value && part.output.value.type === "execution-denied") {
|
|
2651
|
+
break;
|
|
2652
|
+
}
|
|
2646
2653
|
if (store) {
|
|
2647
|
-
|
|
2654
|
+
const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h.openai) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2655
|
+
input.push({ type: "item_reference", id: itemId });
|
|
2648
2656
|
} else {
|
|
2649
2657
|
warnings.push({
|
|
2650
2658
|
type: "other",
|
|
@@ -2714,9 +2722,31 @@ async function convertToOpenAIResponsesInput({
|
|
|
2714
2722
|
case "tool": {
|
|
2715
2723
|
for (const part of content) {
|
|
2716
2724
|
if (part.type === "tool-approval-response") {
|
|
2725
|
+
const approvalResponse = part;
|
|
2726
|
+
if (processedApprovalIds.has(approvalResponse.approvalId)) {
|
|
2727
|
+
continue;
|
|
2728
|
+
}
|
|
2729
|
+
processedApprovalIds.add(approvalResponse.approvalId);
|
|
2730
|
+
if (store) {
|
|
2731
|
+
input.push({
|
|
2732
|
+
type: "item_reference",
|
|
2733
|
+
id: approvalResponse.approvalId
|
|
2734
|
+
});
|
|
2735
|
+
}
|
|
2736
|
+
input.push({
|
|
2737
|
+
type: "mcp_approval_response",
|
|
2738
|
+
approval_request_id: approvalResponse.approvalId,
|
|
2739
|
+
approve: approvalResponse.approved
|
|
2740
|
+
});
|
|
2717
2741
|
continue;
|
|
2718
2742
|
}
|
|
2719
2743
|
const output = part.output;
|
|
2744
|
+
if (output.type === "execution-denied") {
|
|
2745
|
+
const approvalId = (_l = (_k = output.providerOptions) == null ? void 0 : _k.openai) == null ? void 0 : _l.approvalId;
|
|
2746
|
+
if (approvalId) {
|
|
2747
|
+
continue;
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2720
2750
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2721
2751
|
part.toolName
|
|
2722
2752
|
);
|
|
@@ -2771,7 +2801,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2771
2801
|
contentValue = output.value;
|
|
2772
2802
|
break;
|
|
2773
2803
|
case "execution-denied":
|
|
2774
|
-
contentValue = (
|
|
2804
|
+
contentValue = (_m = output.reason) != null ? _m : "Tool execution denied.";
|
|
2775
2805
|
break;
|
|
2776
2806
|
case "json":
|
|
2777
2807
|
case "error-json":
|
|
@@ -2946,7 +2976,8 @@ var openaiResponsesChunkSchema = lazySchema14(
|
|
|
2946
2976
|
z16.object({
|
|
2947
2977
|
type: z16.literal("mcp_call"),
|
|
2948
2978
|
id: z16.string(),
|
|
2949
|
-
status: z16.string()
|
|
2979
|
+
status: z16.string(),
|
|
2980
|
+
approval_request_id: z16.string().nullish()
|
|
2950
2981
|
}),
|
|
2951
2982
|
z16.object({
|
|
2952
2983
|
type: z16.literal("mcp_list_tools"),
|
|
@@ -3103,7 +3134,8 @@ var openaiResponsesChunkSchema = lazySchema14(
|
|
|
3103
3134
|
code: z16.union([z16.number(), z16.string()]).optional(),
|
|
3104
3135
|
message: z16.string().optional()
|
|
3105
3136
|
}).loose()
|
|
3106
|
-
]).nullish()
|
|
3137
|
+
]).nullish(),
|
|
3138
|
+
approval_request_id: z16.string().nullish()
|
|
3107
3139
|
}),
|
|
3108
3140
|
z16.object({
|
|
3109
3141
|
type: z16.literal("mcp_list_tools"),
|
|
@@ -3132,7 +3164,7 @@ var openaiResponsesChunkSchema = lazySchema14(
|
|
|
3132
3164
|
server_label: z16.string(),
|
|
3133
3165
|
name: z16.string(),
|
|
3134
3166
|
arguments: z16.string(),
|
|
3135
|
-
approval_request_id: z16.string()
|
|
3167
|
+
approval_request_id: z16.string().optional()
|
|
3136
3168
|
}),
|
|
3137
3169
|
z16.object({
|
|
3138
3170
|
type: z16.literal("apply_patch_call"),
|
|
@@ -3455,7 +3487,8 @@ var openaiResponsesResponseSchema = lazySchema14(
|
|
|
3455
3487
|
code: z16.union([z16.number(), z16.string()]).optional(),
|
|
3456
3488
|
message: z16.string().optional()
|
|
3457
3489
|
}).loose()
|
|
3458
|
-
]).nullish()
|
|
3490
|
+
]).nullish(),
|
|
3491
|
+
approval_request_id: z16.string().nullish()
|
|
3459
3492
|
}),
|
|
3460
3493
|
z16.object({
|
|
3461
3494
|
type: z16.literal("mcp_list_tools"),
|
|
@@ -3484,7 +3517,7 @@ var openaiResponsesResponseSchema = lazySchema14(
|
|
|
3484
3517
|
server_label: z16.string(),
|
|
3485
3518
|
name: z16.string(),
|
|
3486
3519
|
arguments: z16.string(),
|
|
3487
|
-
approval_request_id: z16.string()
|
|
3520
|
+
approval_request_id: z16.string().optional()
|
|
3488
3521
|
}),
|
|
3489
3522
|
z16.object({
|
|
3490
3523
|
type: z16.literal("apply_patch_call"),
|
|
@@ -3960,7 +3993,7 @@ var mcpOutputSchema = lazySchema19(
|
|
|
3960
3993
|
serverLabel: z21.string(),
|
|
3961
3994
|
name: z21.string(),
|
|
3962
3995
|
arguments: z21.string(),
|
|
3963
|
-
output: z21.string().
|
|
3996
|
+
output: z21.string().nullish(),
|
|
3964
3997
|
error: z21.union([z21.string(), jsonValueSchema]).optional()
|
|
3965
3998
|
})
|
|
3966
3999
|
)
|
|
@@ -4203,6 +4236,11 @@ async function prepareResponsesTools({
|
|
|
4203
4236
|
value: tool.args,
|
|
4204
4237
|
schema: mcpArgsSchema
|
|
4205
4238
|
});
|
|
4239
|
+
const mapApprovalFilter = (filter) => ({
|
|
4240
|
+
tool_names: filter.toolNames
|
|
4241
|
+
});
|
|
4242
|
+
const requireApproval = args.requireApproval;
|
|
4243
|
+
const requireApprovalParam = requireApproval == null ? void 0 : typeof requireApproval === "string" ? requireApproval : requireApproval.never != null ? { never: mapApprovalFilter(requireApproval.never) } : void 0;
|
|
4206
4244
|
openaiTools.push({
|
|
4207
4245
|
type: "mcp",
|
|
4208
4246
|
server_label: args.serverLabel,
|
|
@@ -4213,7 +4251,7 @@ async function prepareResponsesTools({
|
|
|
4213
4251
|
authorization: args.authorization,
|
|
4214
4252
|
connector_id: args.connectorId,
|
|
4215
4253
|
headers: args.headers,
|
|
4216
|
-
require_approval: "never",
|
|
4254
|
+
require_approval: requireApprovalParam != null ? requireApprovalParam : "never",
|
|
4217
4255
|
server_description: args.serverDescription,
|
|
4218
4256
|
server_url: args.serverUrl
|
|
4219
4257
|
});
|
|
@@ -4255,6 +4293,21 @@ async function prepareResponsesTools({
|
|
|
4255
4293
|
}
|
|
4256
4294
|
|
|
4257
4295
|
// src/responses/openai-responses-language-model.ts
|
|
4296
|
+
function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
4297
|
+
var _a, _b;
|
|
4298
|
+
const mapping = {};
|
|
4299
|
+
for (const message of prompt) {
|
|
4300
|
+
if (message.role !== "assistant") continue;
|
|
4301
|
+
for (const part of message.content) {
|
|
4302
|
+
if (part.type !== "tool-call") continue;
|
|
4303
|
+
const approvalRequestId = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.approvalRequestId;
|
|
4304
|
+
if (approvalRequestId != null) {
|
|
4305
|
+
mapping[approvalRequestId] = part.toolCallId;
|
|
4306
|
+
}
|
|
4307
|
+
}
|
|
4308
|
+
}
|
|
4309
|
+
return mapping;
|
|
4310
|
+
}
|
|
4258
4311
|
var OpenAIResponsesLanguageModel = class {
|
|
4259
4312
|
constructor(modelId, config) {
|
|
4260
4313
|
this.specificationVersion = "v3";
|
|
@@ -4490,7 +4543,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4490
4543
|
};
|
|
4491
4544
|
}
|
|
4492
4545
|
async doGenerate(options) {
|
|
4493
|
-
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;
|
|
4546
|
+
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;
|
|
4494
4547
|
const {
|
|
4495
4548
|
args: body,
|
|
4496
4549
|
warnings,
|
|
@@ -4502,6 +4555,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4502
4555
|
modelId: this.modelId
|
|
4503
4556
|
});
|
|
4504
4557
|
const providerKey = this.config.provider.replace(".responses", "");
|
|
4558
|
+
const approvalRequestIdToDummyToolCallIdFromPrompt = extractApprovalRequestIdToToolCallIdMapping(options.prompt);
|
|
4505
4559
|
const {
|
|
4506
4560
|
responseHeaders,
|
|
4507
4561
|
value: response,
|
|
@@ -4718,17 +4772,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4718
4772
|
break;
|
|
4719
4773
|
}
|
|
4720
4774
|
case "mcp_call": {
|
|
4775
|
+
const toolCallId = part.approval_request_id != null ? (_v = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _v : part.id : part.id;
|
|
4776
|
+
const toolName = `mcp.${part.name}`;
|
|
4721
4777
|
content.push({
|
|
4722
4778
|
type: "tool-call",
|
|
4723
|
-
toolCallId
|
|
4724
|
-
toolName
|
|
4725
|
-
input:
|
|
4726
|
-
providerExecuted: true
|
|
4779
|
+
toolCallId,
|
|
4780
|
+
toolName,
|
|
4781
|
+
input: part.arguments,
|
|
4782
|
+
providerExecuted: true,
|
|
4783
|
+
dynamic: true
|
|
4727
4784
|
});
|
|
4728
4785
|
content.push({
|
|
4729
4786
|
type: "tool-result",
|
|
4730
|
-
toolCallId
|
|
4731
|
-
toolName
|
|
4787
|
+
toolCallId,
|
|
4788
|
+
toolName,
|
|
4732
4789
|
result: {
|
|
4733
4790
|
type: "call",
|
|
4734
4791
|
serverLabel: part.server_label,
|
|
@@ -4736,6 +4793,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4736
4793
|
arguments: part.arguments,
|
|
4737
4794
|
...part.output != null ? { output: part.output } : {},
|
|
4738
4795
|
...part.error != null ? { error: part.error } : {}
|
|
4796
|
+
},
|
|
4797
|
+
providerMetadata: {
|
|
4798
|
+
[providerKey]: {
|
|
4799
|
+
itemId: part.id
|
|
4800
|
+
}
|
|
4739
4801
|
}
|
|
4740
4802
|
});
|
|
4741
4803
|
break;
|
|
@@ -4744,6 +4806,22 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4744
4806
|
break;
|
|
4745
4807
|
}
|
|
4746
4808
|
case "mcp_approval_request": {
|
|
4809
|
+
const approvalRequestId = (_w = part.approval_request_id) != null ? _w : part.id;
|
|
4810
|
+
const dummyToolCallId = (_z = (_y = (_x = this.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : generateId2();
|
|
4811
|
+
const toolName = `mcp.${part.name}`;
|
|
4812
|
+
content.push({
|
|
4813
|
+
type: "tool-call",
|
|
4814
|
+
toolCallId: dummyToolCallId,
|
|
4815
|
+
toolName,
|
|
4816
|
+
input: part.arguments,
|
|
4817
|
+
providerExecuted: true,
|
|
4818
|
+
dynamic: true
|
|
4819
|
+
});
|
|
4820
|
+
content.push({
|
|
4821
|
+
type: "tool-approval-request",
|
|
4822
|
+
approvalId: approvalRequestId,
|
|
4823
|
+
toolCallId: dummyToolCallId
|
|
4824
|
+
});
|
|
4747
4825
|
break;
|
|
4748
4826
|
}
|
|
4749
4827
|
case "computer_call": {
|
|
@@ -4779,13 +4857,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4779
4857
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4780
4858
|
result: {
|
|
4781
4859
|
queries: part.queries,
|
|
4782
|
-
results: (
|
|
4860
|
+
results: (_B = (_A = part.results) == null ? void 0 : _A.map((result) => ({
|
|
4783
4861
|
attributes: result.attributes,
|
|
4784
4862
|
fileId: result.file_id,
|
|
4785
4863
|
filename: result.filename,
|
|
4786
4864
|
score: result.score,
|
|
4787
4865
|
text: result.text
|
|
4788
|
-
}))) != null ?
|
|
4866
|
+
}))) != null ? _B : null
|
|
4789
4867
|
}
|
|
4790
4868
|
});
|
|
4791
4869
|
break;
|
|
@@ -4844,10 +4922,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4844
4922
|
content,
|
|
4845
4923
|
finishReason: {
|
|
4846
4924
|
unified: mapOpenAIResponseFinishReason({
|
|
4847
|
-
finishReason: (
|
|
4925
|
+
finishReason: (_C = response.incomplete_details) == null ? void 0 : _C.reason,
|
|
4848
4926
|
hasFunctionCall
|
|
4849
4927
|
}),
|
|
4850
|
-
raw: (
|
|
4928
|
+
raw: (_E = (_D = response.incomplete_details) == null ? void 0 : _D.reason) != null ? _E : void 0
|
|
4851
4929
|
},
|
|
4852
4930
|
usage: convertOpenAIResponsesUsage(usage),
|
|
4853
4931
|
request: { body },
|
|
@@ -4889,6 +4967,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4889
4967
|
});
|
|
4890
4968
|
const self = this;
|
|
4891
4969
|
const providerKey = this.config.provider.replace(".responses", "");
|
|
4970
|
+
const approvalRequestIdToDummyToolCallIdFromPrompt = extractApprovalRequestIdToToolCallIdMapping(options.prompt);
|
|
4971
|
+
const approvalRequestIdToDummyToolCallIdFromStream = /* @__PURE__ */ new Map();
|
|
4892
4972
|
let finishReason = {
|
|
4893
4973
|
unified: "other",
|
|
4894
4974
|
raw: void 0
|
|
@@ -4908,7 +4988,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4908
4988
|
controller.enqueue({ type: "stream-start", warnings });
|
|
4909
4989
|
},
|
|
4910
4990
|
transform(chunk, controller) {
|
|
4911
|
-
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;
|
|
4991
|
+
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;
|
|
4912
4992
|
if (options.includeRawChunks) {
|
|
4913
4993
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
4914
4994
|
}
|
|
@@ -5004,13 +5084,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5004
5084
|
providerExecuted: true
|
|
5005
5085
|
});
|
|
5006
5086
|
} else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
|
|
5007
|
-
controller.enqueue({
|
|
5008
|
-
type: "tool-call",
|
|
5009
|
-
toolCallId: value.item.id,
|
|
5010
|
-
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
5011
|
-
input: "{}",
|
|
5012
|
-
providerExecuted: true
|
|
5013
|
-
});
|
|
5014
5087
|
} else if (value.item.type === "apply_patch_call") {
|
|
5015
5088
|
const { call_id: callId, operation } = value.item;
|
|
5016
5089
|
ongoingToolCalls[value.output_index] = {
|
|
@@ -5182,10 +5255,23 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5182
5255
|
});
|
|
5183
5256
|
} else if (value.item.type === "mcp_call") {
|
|
5184
5257
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5258
|
+
const approvalRequestId = (_d = value.item.approval_request_id) != null ? _d : void 0;
|
|
5259
|
+
const aliasedToolCallId = approvalRequestId != null ? (_f = (_e = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
5260
|
+
approvalRequestId
|
|
5261
|
+
)) != null ? _e : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _f : value.item.id : value.item.id;
|
|
5262
|
+
const toolName = `mcp.${value.item.name}`;
|
|
5263
|
+
controller.enqueue({
|
|
5264
|
+
type: "tool-call",
|
|
5265
|
+
toolCallId: aliasedToolCallId,
|
|
5266
|
+
toolName,
|
|
5267
|
+
input: value.item.arguments,
|
|
5268
|
+
providerExecuted: true,
|
|
5269
|
+
dynamic: true
|
|
5270
|
+
});
|
|
5185
5271
|
controller.enqueue({
|
|
5186
5272
|
type: "tool-result",
|
|
5187
|
-
toolCallId:
|
|
5188
|
-
toolName
|
|
5273
|
+
toolCallId: aliasedToolCallId,
|
|
5274
|
+
toolName,
|
|
5189
5275
|
result: {
|
|
5190
5276
|
type: "call",
|
|
5191
5277
|
serverLabel: value.item.server_label,
|
|
@@ -5193,6 +5279,11 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5193
5279
|
arguments: value.item.arguments,
|
|
5194
5280
|
...value.item.output != null ? { output: value.item.output } : {},
|
|
5195
5281
|
...value.item.error != null ? { error: value.item.error } : {}
|
|
5282
|
+
},
|
|
5283
|
+
providerMetadata: {
|
|
5284
|
+
[providerKey]: {
|
|
5285
|
+
itemId: value.item.id
|
|
5286
|
+
}
|
|
5196
5287
|
}
|
|
5197
5288
|
});
|
|
5198
5289
|
} else if (value.item.type === "mcp_list_tools") {
|
|
@@ -5237,6 +5328,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5237
5328
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5238
5329
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5239
5330
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5331
|
+
const dummyToolCallId = (_i = (_h = (_g = self.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2();
|
|
5332
|
+
const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : value.item.id;
|
|
5333
|
+
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5334
|
+
approvalRequestId,
|
|
5335
|
+
dummyToolCallId
|
|
5336
|
+
);
|
|
5337
|
+
const toolName = `mcp.${value.item.name}`;
|
|
5338
|
+
controller.enqueue({
|
|
5339
|
+
type: "tool-call",
|
|
5340
|
+
toolCallId: dummyToolCallId,
|
|
5341
|
+
toolName,
|
|
5342
|
+
input: value.item.arguments,
|
|
5343
|
+
providerExecuted: true,
|
|
5344
|
+
dynamic: true
|
|
5345
|
+
});
|
|
5346
|
+
controller.enqueue({
|
|
5347
|
+
type: "tool-approval-request",
|
|
5348
|
+
approvalId: approvalRequestId,
|
|
5349
|
+
toolCallId: dummyToolCallId
|
|
5350
|
+
});
|
|
5240
5351
|
} else if (value.item.type === "local_shell_call") {
|
|
5241
5352
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5242
5353
|
controller.enqueue({
|
|
@@ -5286,7 +5397,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5286
5397
|
providerMetadata: {
|
|
5287
5398
|
[providerKey]: {
|
|
5288
5399
|
itemId: value.item.id,
|
|
5289
|
-
reasoningEncryptedContent: (
|
|
5400
|
+
reasoningEncryptedContent: (_k = value.item.encrypted_content) != null ? _k : null
|
|
5290
5401
|
}
|
|
5291
5402
|
}
|
|
5292
5403
|
});
|
|
@@ -5390,7 +5501,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5390
5501
|
id: value.item_id,
|
|
5391
5502
|
delta: value.delta
|
|
5392
5503
|
});
|
|
5393
|
-
if (((
|
|
5504
|
+
if (((_m = (_l = options.providerOptions) == null ? void 0 : _l.openai) == null ? void 0 : _m.logprobs) && value.logprobs) {
|
|
5394
5505
|
logprobs.push(value.logprobs);
|
|
5395
5506
|
}
|
|
5396
5507
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -5417,7 +5528,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5417
5528
|
providerMetadata: {
|
|
5418
5529
|
[providerKey]: {
|
|
5419
5530
|
itemId: value.item_id,
|
|
5420
|
-
reasoningEncryptedContent: (
|
|
5531
|
+
reasoningEncryptedContent: (_o = (_n = activeReasoning[value.item_id]) == null ? void 0 : _n.encryptedContent) != null ? _o : null
|
|
5421
5532
|
}
|
|
5422
5533
|
}
|
|
5423
5534
|
});
|
|
@@ -5449,10 +5560,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5449
5560
|
} else if (isResponseFinishedChunk(value)) {
|
|
5450
5561
|
finishReason = {
|
|
5451
5562
|
unified: mapOpenAIResponseFinishReason({
|
|
5452
|
-
finishReason: (
|
|
5563
|
+
finishReason: (_p = value.response.incomplete_details) == null ? void 0 : _p.reason,
|
|
5453
5564
|
hasFunctionCall
|
|
5454
5565
|
}),
|
|
5455
|
-
raw: (
|
|
5566
|
+
raw: (_r = (_q = value.response.incomplete_details) == null ? void 0 : _q.reason) != null ? _r : void 0
|
|
5456
5567
|
};
|
|
5457
5568
|
usage = value.response.usage;
|
|
5458
5569
|
if (typeof value.response.service_tier === "string") {
|
|
@@ -5464,7 +5575,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5464
5575
|
controller.enqueue({
|
|
5465
5576
|
type: "source",
|
|
5466
5577
|
sourceType: "url",
|
|
5467
|
-
id: (
|
|
5578
|
+
id: (_u = (_t = (_s = self.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : generateId2(),
|
|
5468
5579
|
url: value.annotation.url,
|
|
5469
5580
|
title: value.annotation.title
|
|
5470
5581
|
});
|
|
@@ -5472,10 +5583,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5472
5583
|
controller.enqueue({
|
|
5473
5584
|
type: "source",
|
|
5474
5585
|
sourceType: "document",
|
|
5475
|
-
id: (
|
|
5586
|
+
id: (_x = (_w = (_v = self.config).generateId) == null ? void 0 : _w.call(_v)) != null ? _x : generateId2(),
|
|
5476
5587
|
mediaType: "text/plain",
|
|
5477
|
-
title: (
|
|
5478
|
-
filename: (
|
|
5588
|
+
title: (_z = (_y = value.annotation.quote) != null ? _y : value.annotation.filename) != null ? _z : "Document",
|
|
5589
|
+
filename: (_A = value.annotation.filename) != null ? _A : value.annotation.file_id,
|
|
5479
5590
|
...value.annotation.file_id ? {
|
|
5480
5591
|
providerMetadata: {
|
|
5481
5592
|
[providerKey]: {
|
|
@@ -5488,10 +5599,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5488
5599
|
controller.enqueue({
|
|
5489
5600
|
type: "source",
|
|
5490
5601
|
sourceType: "document",
|
|
5491
|
-
id: (
|
|
5602
|
+
id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId2(),
|
|
5492
5603
|
mediaType: "text/plain",
|
|
5493
|
-
title: (
|
|
5494
|
-
filename: (
|
|
5604
|
+
title: (_F = (_E = value.annotation.filename) != null ? _E : value.annotation.file_id) != null ? _F : "Document",
|
|
5605
|
+
filename: (_G = value.annotation.filename) != null ? _G : value.annotation.file_id,
|
|
5495
5606
|
providerMetadata: {
|
|
5496
5607
|
[providerKey]: {
|
|
5497
5608
|
fileId: value.annotation.file_id,
|
|
@@ -5504,7 +5615,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5504
5615
|
controller.enqueue({
|
|
5505
5616
|
type: "source",
|
|
5506
5617
|
sourceType: "document",
|
|
5507
|
-
id: (
|
|
5618
|
+
id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : generateId2(),
|
|
5508
5619
|
mediaType: "application/octet-stream",
|
|
5509
5620
|
title: value.annotation.file_id,
|
|
5510
5621
|
filename: value.annotation.file_id,
|