@ai-sdk/openai 3.0.45 → 3.0.46
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 +6 -0
- package/dist/index.d.mts +66 -2
- package/dist/index.d.ts +66 -2
- package/dist/index.js +1142 -855
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1096 -804
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +29 -1
- package/dist/internal/index.d.ts +29 -1
- package/dist/internal/index.js +1173 -897
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1155 -874
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +139 -0
- package/package.json +1 -1
- package/src/openai-tools.ts +12 -0
- package/src/responses/convert-to-openai-responses-input.ts +85 -4
- package/src/responses/openai-responses-api.ts +87 -1
- package/src/responses/openai-responses-language-model.ts +139 -0
- package/src/responses/openai-responses-prepare-tools.ts +26 -1
- package/src/tool/tool-search.ts +98 -0
package/dist/internal/index.mjs
CHANGED
|
@@ -2388,10 +2388,11 @@ import {
|
|
|
2388
2388
|
import {
|
|
2389
2389
|
convertToBase64 as convertToBase642,
|
|
2390
2390
|
isNonNullable,
|
|
2391
|
+
parseJSON,
|
|
2391
2392
|
parseProviderOptions as parseProviderOptions6,
|
|
2392
2393
|
validateTypes
|
|
2393
2394
|
} from "@ai-sdk/provider-utils";
|
|
2394
|
-
import { z as
|
|
2395
|
+
import { z as z16 } from "zod/v4";
|
|
2395
2396
|
|
|
2396
2397
|
// src/tool/apply-patch.ts
|
|
2397
2398
|
import {
|
|
@@ -2570,6 +2571,43 @@ var shell = createProviderToolFactoryWithOutputSchema3({
|
|
|
2570
2571
|
outputSchema: shellOutputSchema
|
|
2571
2572
|
});
|
|
2572
2573
|
|
|
2574
|
+
// src/tool/tool-search.ts
|
|
2575
|
+
import {
|
|
2576
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
2577
|
+
lazySchema as lazySchema14,
|
|
2578
|
+
zodSchema as zodSchema14
|
|
2579
|
+
} from "@ai-sdk/provider-utils";
|
|
2580
|
+
import { z as z15 } from "zod/v4";
|
|
2581
|
+
var toolSearchArgsSchema = lazySchema14(
|
|
2582
|
+
() => zodSchema14(
|
|
2583
|
+
z15.object({
|
|
2584
|
+
execution: z15.enum(["server", "client"]).optional(),
|
|
2585
|
+
description: z15.string().optional(),
|
|
2586
|
+
parameters: z15.record(z15.string(), z15.unknown()).optional()
|
|
2587
|
+
})
|
|
2588
|
+
)
|
|
2589
|
+
);
|
|
2590
|
+
var toolSearchInputSchema = lazySchema14(
|
|
2591
|
+
() => zodSchema14(
|
|
2592
|
+
z15.object({
|
|
2593
|
+
arguments: z15.unknown().optional(),
|
|
2594
|
+
call_id: z15.string().nullish()
|
|
2595
|
+
})
|
|
2596
|
+
)
|
|
2597
|
+
);
|
|
2598
|
+
var toolSearchOutputSchema = lazySchema14(
|
|
2599
|
+
() => zodSchema14(
|
|
2600
|
+
z15.object({
|
|
2601
|
+
tools: z15.array(z15.record(z15.string(), z15.unknown()))
|
|
2602
|
+
})
|
|
2603
|
+
)
|
|
2604
|
+
);
|
|
2605
|
+
var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema4({
|
|
2606
|
+
id: "openai.tool_search",
|
|
2607
|
+
inputSchema: toolSearchInputSchema,
|
|
2608
|
+
outputSchema: toolSearchOutputSchema
|
|
2609
|
+
});
|
|
2610
|
+
|
|
2573
2611
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2574
2612
|
function isFileId(data, prefixes) {
|
|
2575
2613
|
if (!prefixes) return false;
|
|
@@ -2588,7 +2626,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2588
2626
|
hasApplyPatchTool = false,
|
|
2589
2627
|
customProviderToolNames
|
|
2590
2628
|
}) {
|
|
2591
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2629
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2592
2630
|
let input = [];
|
|
2593
2631
|
const warnings = [];
|
|
2594
2632
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -2692,6 +2730,32 @@ async function convertToOpenAIResponsesInput({
|
|
|
2692
2730
|
if (hasConversation && id != null) {
|
|
2693
2731
|
break;
|
|
2694
2732
|
}
|
|
2733
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2734
|
+
part.toolName
|
|
2735
|
+
);
|
|
2736
|
+
if (resolvedToolName === "tool_search") {
|
|
2737
|
+
if (store && id != null) {
|
|
2738
|
+
input.push({ type: "item_reference", id });
|
|
2739
|
+
break;
|
|
2740
|
+
}
|
|
2741
|
+
const parsedInput = typeof part.input === "string" ? await parseJSON({
|
|
2742
|
+
text: part.input,
|
|
2743
|
+
schema: toolSearchInputSchema
|
|
2744
|
+
}) : await validateTypes({
|
|
2745
|
+
value: part.input,
|
|
2746
|
+
schema: toolSearchInputSchema
|
|
2747
|
+
});
|
|
2748
|
+
const execution = parsedInput.call_id != null ? "client" : "server";
|
|
2749
|
+
input.push({
|
|
2750
|
+
type: "tool_search_call",
|
|
2751
|
+
id: id != null ? id : part.toolCallId,
|
|
2752
|
+
execution,
|
|
2753
|
+
call_id: (_g = parsedInput.call_id) != null ? _g : null,
|
|
2754
|
+
status: "completed",
|
|
2755
|
+
arguments: parsedInput.arguments
|
|
2756
|
+
});
|
|
2757
|
+
break;
|
|
2758
|
+
}
|
|
2695
2759
|
if (part.providerExecuted) {
|
|
2696
2760
|
if (store && id != null) {
|
|
2697
2761
|
input.push({ type: "item_reference", id });
|
|
@@ -2702,9 +2766,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2702
2766
|
input.push({ type: "item_reference", id });
|
|
2703
2767
|
break;
|
|
2704
2768
|
}
|
|
2705
|
-
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2706
|
-
part.toolName
|
|
2707
|
-
);
|
|
2708
2769
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2709
2770
|
const parsedInput = await validateTypes({
|
|
2710
2771
|
value: part.input,
|
|
@@ -2787,6 +2848,26 @@ async function convertToOpenAIResponsesInput({
|
|
|
2787
2848
|
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
2788
2849
|
part.toolName
|
|
2789
2850
|
);
|
|
2851
|
+
if (resolvedResultToolName === "tool_search") {
|
|
2852
|
+
const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2853
|
+
if (store) {
|
|
2854
|
+
input.push({ type: "item_reference", id: itemId });
|
|
2855
|
+
} else if (part.output.type === "json") {
|
|
2856
|
+
const parsedOutput = await validateTypes({
|
|
2857
|
+
value: part.output.value,
|
|
2858
|
+
schema: toolSearchOutputSchema
|
|
2859
|
+
});
|
|
2860
|
+
input.push({
|
|
2861
|
+
type: "tool_search_output",
|
|
2862
|
+
id: itemId,
|
|
2863
|
+
execution: "server",
|
|
2864
|
+
call_id: null,
|
|
2865
|
+
status: "completed",
|
|
2866
|
+
tools: parsedOutput.tools
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
break;
|
|
2870
|
+
}
|
|
2790
2871
|
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2791
2872
|
if (part.output.type === "json") {
|
|
2792
2873
|
const parsedOutput = await validateTypes({
|
|
@@ -2809,7 +2890,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2809
2890
|
break;
|
|
2810
2891
|
}
|
|
2811
2892
|
if (store) {
|
|
2812
|
-
const itemId = (
|
|
2893
|
+
const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
|
|
2813
2894
|
input.push({ type: "item_reference", id: itemId });
|
|
2814
2895
|
} else {
|
|
2815
2896
|
warnings.push({
|
|
@@ -2919,7 +3000,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2919
3000
|
}
|
|
2920
3001
|
const output = part.output;
|
|
2921
3002
|
if (output.type === "execution-denied") {
|
|
2922
|
-
const approvalId = (
|
|
3003
|
+
const approvalId = (_o = (_n = output.providerOptions) == null ? void 0 : _n.openai) == null ? void 0 : _o.approvalId;
|
|
2923
3004
|
if (approvalId) {
|
|
2924
3005
|
continue;
|
|
2925
3006
|
}
|
|
@@ -2927,6 +3008,20 @@ async function convertToOpenAIResponsesInput({
|
|
|
2927
3008
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2928
3009
|
part.toolName
|
|
2929
3010
|
);
|
|
3011
|
+
if (resolvedToolName === "tool_search" && output.type === "json") {
|
|
3012
|
+
const parsedOutput = await validateTypes({
|
|
3013
|
+
value: output.value,
|
|
3014
|
+
schema: toolSearchOutputSchema
|
|
3015
|
+
});
|
|
3016
|
+
input.push({
|
|
3017
|
+
type: "tool_search_output",
|
|
3018
|
+
execution: "client",
|
|
3019
|
+
call_id: part.toolCallId,
|
|
3020
|
+
status: "completed",
|
|
3021
|
+
tools: parsedOutput.tools
|
|
3022
|
+
});
|
|
3023
|
+
continue;
|
|
3024
|
+
}
|
|
2930
3025
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2931
3026
|
const parsedOutput = await validateTypes({
|
|
2932
3027
|
value: output.value,
|
|
@@ -2979,7 +3074,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2979
3074
|
outputValue = output.value;
|
|
2980
3075
|
break;
|
|
2981
3076
|
case "execution-denied":
|
|
2982
|
-
outputValue = (
|
|
3077
|
+
outputValue = (_p = output.reason) != null ? _p : "Tool execution denied.";
|
|
2983
3078
|
break;
|
|
2984
3079
|
case "json":
|
|
2985
3080
|
case "error-json":
|
|
@@ -3033,7 +3128,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3033
3128
|
contentValue = output.value;
|
|
3034
3129
|
break;
|
|
3035
3130
|
case "execution-denied":
|
|
3036
|
-
contentValue = (
|
|
3131
|
+
contentValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
|
|
3037
3132
|
break;
|
|
3038
3133
|
case "json":
|
|
3039
3134
|
case "error-json":
|
|
@@ -3103,9 +3198,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
3103
3198
|
}
|
|
3104
3199
|
return { input, warnings };
|
|
3105
3200
|
}
|
|
3106
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3107
|
-
itemId:
|
|
3108
|
-
reasoningEncryptedContent:
|
|
3201
|
+
var openaiResponsesReasoningProviderOptionsSchema = z16.object({
|
|
3202
|
+
itemId: z16.string().nullish(),
|
|
3203
|
+
reasoningEncryptedContent: z16.string().nullish()
|
|
3109
3204
|
});
|
|
3110
3205
|
|
|
3111
3206
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3127,483 +3222,525 @@ function mapOpenAIResponseFinishReason({
|
|
|
3127
3222
|
}
|
|
3128
3223
|
|
|
3129
3224
|
// src/responses/openai-responses-api.ts
|
|
3130
|
-
import { lazySchema as
|
|
3131
|
-
import { z as
|
|
3132
|
-
var
|
|
3133
|
-
() =>
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3225
|
+
import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
|
|
3226
|
+
import { z as z17 } from "zod/v4";
|
|
3227
|
+
var jsonValueSchema = z17.lazy(
|
|
3228
|
+
() => z17.union([
|
|
3229
|
+
z17.string(),
|
|
3230
|
+
z17.number(),
|
|
3231
|
+
z17.boolean(),
|
|
3232
|
+
z17.null(),
|
|
3233
|
+
z17.array(jsonValueSchema),
|
|
3234
|
+
z17.record(z17.string(), jsonValueSchema.optional())
|
|
3235
|
+
])
|
|
3236
|
+
);
|
|
3237
|
+
var openaiResponsesChunkSchema = lazySchema15(
|
|
3238
|
+
() => zodSchema15(
|
|
3239
|
+
z17.union([
|
|
3240
|
+
z17.object({
|
|
3241
|
+
type: z17.literal("response.output_text.delta"),
|
|
3242
|
+
item_id: z17.string(),
|
|
3243
|
+
delta: z17.string(),
|
|
3244
|
+
logprobs: z17.array(
|
|
3245
|
+
z17.object({
|
|
3246
|
+
token: z17.string(),
|
|
3247
|
+
logprob: z17.number(),
|
|
3248
|
+
top_logprobs: z17.array(
|
|
3249
|
+
z17.object({
|
|
3250
|
+
token: z17.string(),
|
|
3251
|
+
logprob: z17.number()
|
|
3147
3252
|
})
|
|
3148
3253
|
)
|
|
3149
3254
|
})
|
|
3150
3255
|
).nullish()
|
|
3151
3256
|
}),
|
|
3152
|
-
|
|
3153
|
-
type:
|
|
3154
|
-
response:
|
|
3155
|
-
incomplete_details:
|
|
3156
|
-
usage:
|
|
3157
|
-
input_tokens:
|
|
3158
|
-
input_tokens_details:
|
|
3159
|
-
output_tokens:
|
|
3160
|
-
output_tokens_details:
|
|
3257
|
+
z17.object({
|
|
3258
|
+
type: z17.enum(["response.completed", "response.incomplete"]),
|
|
3259
|
+
response: z17.object({
|
|
3260
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
3261
|
+
usage: z17.object({
|
|
3262
|
+
input_tokens: z17.number(),
|
|
3263
|
+
input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
|
|
3264
|
+
output_tokens: z17.number(),
|
|
3265
|
+
output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
|
|
3161
3266
|
}),
|
|
3162
|
-
service_tier:
|
|
3267
|
+
service_tier: z17.string().nullish()
|
|
3163
3268
|
})
|
|
3164
3269
|
}),
|
|
3165
|
-
|
|
3166
|
-
type:
|
|
3167
|
-
response:
|
|
3168
|
-
id:
|
|
3169
|
-
created_at:
|
|
3170
|
-
model:
|
|
3171
|
-
service_tier:
|
|
3270
|
+
z17.object({
|
|
3271
|
+
type: z17.literal("response.created"),
|
|
3272
|
+
response: z17.object({
|
|
3273
|
+
id: z17.string(),
|
|
3274
|
+
created_at: z17.number(),
|
|
3275
|
+
model: z17.string(),
|
|
3276
|
+
service_tier: z17.string().nullish()
|
|
3172
3277
|
})
|
|
3173
3278
|
}),
|
|
3174
|
-
|
|
3175
|
-
type:
|
|
3176
|
-
output_index:
|
|
3177
|
-
item:
|
|
3178
|
-
|
|
3179
|
-
type:
|
|
3180
|
-
id:
|
|
3181
|
-
phase:
|
|
3279
|
+
z17.object({
|
|
3280
|
+
type: z17.literal("response.output_item.added"),
|
|
3281
|
+
output_index: z17.number(),
|
|
3282
|
+
item: z17.discriminatedUnion("type", [
|
|
3283
|
+
z17.object({
|
|
3284
|
+
type: z17.literal("message"),
|
|
3285
|
+
id: z17.string(),
|
|
3286
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish()
|
|
3182
3287
|
}),
|
|
3183
|
-
|
|
3184
|
-
type:
|
|
3185
|
-
id:
|
|
3186
|
-
encrypted_content:
|
|
3288
|
+
z17.object({
|
|
3289
|
+
type: z17.literal("reasoning"),
|
|
3290
|
+
id: z17.string(),
|
|
3291
|
+
encrypted_content: z17.string().nullish()
|
|
3187
3292
|
}),
|
|
3188
|
-
|
|
3189
|
-
type:
|
|
3190
|
-
id:
|
|
3191
|
-
call_id:
|
|
3192
|
-
name:
|
|
3193
|
-
arguments:
|
|
3293
|
+
z17.object({
|
|
3294
|
+
type: z17.literal("function_call"),
|
|
3295
|
+
id: z17.string(),
|
|
3296
|
+
call_id: z17.string(),
|
|
3297
|
+
name: z17.string(),
|
|
3298
|
+
arguments: z17.string()
|
|
3194
3299
|
}),
|
|
3195
|
-
|
|
3196
|
-
type:
|
|
3197
|
-
id:
|
|
3198
|
-
status:
|
|
3300
|
+
z17.object({
|
|
3301
|
+
type: z17.literal("web_search_call"),
|
|
3302
|
+
id: z17.string(),
|
|
3303
|
+
status: z17.string()
|
|
3199
3304
|
}),
|
|
3200
|
-
|
|
3201
|
-
type:
|
|
3202
|
-
id:
|
|
3203
|
-
status:
|
|
3305
|
+
z17.object({
|
|
3306
|
+
type: z17.literal("computer_call"),
|
|
3307
|
+
id: z17.string(),
|
|
3308
|
+
status: z17.string()
|
|
3204
3309
|
}),
|
|
3205
|
-
|
|
3206
|
-
type:
|
|
3207
|
-
id:
|
|
3310
|
+
z17.object({
|
|
3311
|
+
type: z17.literal("file_search_call"),
|
|
3312
|
+
id: z17.string()
|
|
3208
3313
|
}),
|
|
3209
|
-
|
|
3210
|
-
type:
|
|
3211
|
-
id:
|
|
3314
|
+
z17.object({
|
|
3315
|
+
type: z17.literal("image_generation_call"),
|
|
3316
|
+
id: z17.string()
|
|
3212
3317
|
}),
|
|
3213
|
-
|
|
3214
|
-
type:
|
|
3215
|
-
id:
|
|
3216
|
-
container_id:
|
|
3217
|
-
code:
|
|
3218
|
-
outputs:
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3318
|
+
z17.object({
|
|
3319
|
+
type: z17.literal("code_interpreter_call"),
|
|
3320
|
+
id: z17.string(),
|
|
3321
|
+
container_id: z17.string(),
|
|
3322
|
+
code: z17.string().nullable(),
|
|
3323
|
+
outputs: z17.array(
|
|
3324
|
+
z17.discriminatedUnion("type", [
|
|
3325
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3326
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3222
3327
|
])
|
|
3223
3328
|
).nullable(),
|
|
3224
|
-
status:
|
|
3329
|
+
status: z17.string()
|
|
3225
3330
|
}),
|
|
3226
|
-
|
|
3227
|
-
type:
|
|
3228
|
-
id:
|
|
3229
|
-
status:
|
|
3230
|
-
approval_request_id:
|
|
3331
|
+
z17.object({
|
|
3332
|
+
type: z17.literal("mcp_call"),
|
|
3333
|
+
id: z17.string(),
|
|
3334
|
+
status: z17.string(),
|
|
3335
|
+
approval_request_id: z17.string().nullish()
|
|
3231
3336
|
}),
|
|
3232
|
-
|
|
3233
|
-
type:
|
|
3234
|
-
id:
|
|
3337
|
+
z17.object({
|
|
3338
|
+
type: z17.literal("mcp_list_tools"),
|
|
3339
|
+
id: z17.string()
|
|
3235
3340
|
}),
|
|
3236
|
-
|
|
3237
|
-
type:
|
|
3238
|
-
id:
|
|
3341
|
+
z17.object({
|
|
3342
|
+
type: z17.literal("mcp_approval_request"),
|
|
3343
|
+
id: z17.string()
|
|
3239
3344
|
}),
|
|
3240
|
-
|
|
3241
|
-
type:
|
|
3242
|
-
id:
|
|
3243
|
-
call_id:
|
|
3244
|
-
status:
|
|
3245
|
-
operation:
|
|
3246
|
-
|
|
3247
|
-
type:
|
|
3248
|
-
path:
|
|
3249
|
-
diff:
|
|
3345
|
+
z17.object({
|
|
3346
|
+
type: z17.literal("apply_patch_call"),
|
|
3347
|
+
id: z17.string(),
|
|
3348
|
+
call_id: z17.string(),
|
|
3349
|
+
status: z17.enum(["in_progress", "completed"]),
|
|
3350
|
+
operation: z17.discriminatedUnion("type", [
|
|
3351
|
+
z17.object({
|
|
3352
|
+
type: z17.literal("create_file"),
|
|
3353
|
+
path: z17.string(),
|
|
3354
|
+
diff: z17.string()
|
|
3250
3355
|
}),
|
|
3251
|
-
|
|
3252
|
-
type:
|
|
3253
|
-
path:
|
|
3356
|
+
z17.object({
|
|
3357
|
+
type: z17.literal("delete_file"),
|
|
3358
|
+
path: z17.string()
|
|
3254
3359
|
}),
|
|
3255
|
-
|
|
3256
|
-
type:
|
|
3257
|
-
path:
|
|
3258
|
-
diff:
|
|
3360
|
+
z17.object({
|
|
3361
|
+
type: z17.literal("update_file"),
|
|
3362
|
+
path: z17.string(),
|
|
3363
|
+
diff: z17.string()
|
|
3259
3364
|
})
|
|
3260
3365
|
])
|
|
3261
3366
|
}),
|
|
3262
|
-
|
|
3263
|
-
type:
|
|
3264
|
-
id:
|
|
3265
|
-
call_id:
|
|
3266
|
-
name:
|
|
3267
|
-
input:
|
|
3367
|
+
z17.object({
|
|
3368
|
+
type: z17.literal("custom_tool_call"),
|
|
3369
|
+
id: z17.string(),
|
|
3370
|
+
call_id: z17.string(),
|
|
3371
|
+
name: z17.string(),
|
|
3372
|
+
input: z17.string()
|
|
3268
3373
|
}),
|
|
3269
|
-
|
|
3270
|
-
type:
|
|
3271
|
-
id:
|
|
3272
|
-
call_id:
|
|
3273
|
-
status:
|
|
3274
|
-
action:
|
|
3275
|
-
commands:
|
|
3374
|
+
z17.object({
|
|
3375
|
+
type: z17.literal("shell_call"),
|
|
3376
|
+
id: z17.string(),
|
|
3377
|
+
call_id: z17.string(),
|
|
3378
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3379
|
+
action: z17.object({
|
|
3380
|
+
commands: z17.array(z17.string())
|
|
3276
3381
|
})
|
|
3277
3382
|
}),
|
|
3278
|
-
|
|
3279
|
-
type:
|
|
3280
|
-
id:
|
|
3281
|
-
call_id:
|
|
3282
|
-
status:
|
|
3283
|
-
output:
|
|
3284
|
-
|
|
3285
|
-
stdout:
|
|
3286
|
-
stderr:
|
|
3287
|
-
outcome:
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
type:
|
|
3291
|
-
exit_code:
|
|
3383
|
+
z17.object({
|
|
3384
|
+
type: z17.literal("shell_call_output"),
|
|
3385
|
+
id: z17.string(),
|
|
3386
|
+
call_id: z17.string(),
|
|
3387
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3388
|
+
output: z17.array(
|
|
3389
|
+
z17.object({
|
|
3390
|
+
stdout: z17.string(),
|
|
3391
|
+
stderr: z17.string(),
|
|
3392
|
+
outcome: z17.discriminatedUnion("type", [
|
|
3393
|
+
z17.object({ type: z17.literal("timeout") }),
|
|
3394
|
+
z17.object({
|
|
3395
|
+
type: z17.literal("exit"),
|
|
3396
|
+
exit_code: z17.number()
|
|
3292
3397
|
})
|
|
3293
3398
|
])
|
|
3294
3399
|
})
|
|
3295
3400
|
)
|
|
3401
|
+
}),
|
|
3402
|
+
z17.object({
|
|
3403
|
+
type: z17.literal("tool_search_call"),
|
|
3404
|
+
id: z17.string(),
|
|
3405
|
+
execution: z17.enum(["server", "client"]),
|
|
3406
|
+
call_id: z17.string().nullable(),
|
|
3407
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3408
|
+
arguments: z17.unknown()
|
|
3409
|
+
}),
|
|
3410
|
+
z17.object({
|
|
3411
|
+
type: z17.literal("tool_search_output"),
|
|
3412
|
+
id: z17.string(),
|
|
3413
|
+
execution: z17.enum(["server", "client"]),
|
|
3414
|
+
call_id: z17.string().nullable(),
|
|
3415
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3416
|
+
tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
|
|
3296
3417
|
})
|
|
3297
3418
|
])
|
|
3298
3419
|
}),
|
|
3299
|
-
|
|
3300
|
-
type:
|
|
3301
|
-
output_index:
|
|
3302
|
-
item:
|
|
3303
|
-
|
|
3304
|
-
type:
|
|
3305
|
-
id:
|
|
3306
|
-
phase:
|
|
3420
|
+
z17.object({
|
|
3421
|
+
type: z17.literal("response.output_item.done"),
|
|
3422
|
+
output_index: z17.number(),
|
|
3423
|
+
item: z17.discriminatedUnion("type", [
|
|
3424
|
+
z17.object({
|
|
3425
|
+
type: z17.literal("message"),
|
|
3426
|
+
id: z17.string(),
|
|
3427
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish()
|
|
3307
3428
|
}),
|
|
3308
|
-
|
|
3309
|
-
type:
|
|
3310
|
-
id:
|
|
3311
|
-
encrypted_content:
|
|
3429
|
+
z17.object({
|
|
3430
|
+
type: z17.literal("reasoning"),
|
|
3431
|
+
id: z17.string(),
|
|
3432
|
+
encrypted_content: z17.string().nullish()
|
|
3312
3433
|
}),
|
|
3313
|
-
|
|
3314
|
-
type:
|
|
3315
|
-
id:
|
|
3316
|
-
call_id:
|
|
3317
|
-
name:
|
|
3318
|
-
arguments:
|
|
3319
|
-
status:
|
|
3434
|
+
z17.object({
|
|
3435
|
+
type: z17.literal("function_call"),
|
|
3436
|
+
id: z17.string(),
|
|
3437
|
+
call_id: z17.string(),
|
|
3438
|
+
name: z17.string(),
|
|
3439
|
+
arguments: z17.string(),
|
|
3440
|
+
status: z17.literal("completed")
|
|
3320
3441
|
}),
|
|
3321
|
-
|
|
3322
|
-
type:
|
|
3323
|
-
id:
|
|
3324
|
-
call_id:
|
|
3325
|
-
name:
|
|
3326
|
-
input:
|
|
3327
|
-
status:
|
|
3442
|
+
z17.object({
|
|
3443
|
+
type: z17.literal("custom_tool_call"),
|
|
3444
|
+
id: z17.string(),
|
|
3445
|
+
call_id: z17.string(),
|
|
3446
|
+
name: z17.string(),
|
|
3447
|
+
input: z17.string(),
|
|
3448
|
+
status: z17.literal("completed")
|
|
3328
3449
|
}),
|
|
3329
|
-
|
|
3330
|
-
type:
|
|
3331
|
-
id:
|
|
3332
|
-
code:
|
|
3333
|
-
container_id:
|
|
3334
|
-
outputs:
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3450
|
+
z17.object({
|
|
3451
|
+
type: z17.literal("code_interpreter_call"),
|
|
3452
|
+
id: z17.string(),
|
|
3453
|
+
code: z17.string().nullable(),
|
|
3454
|
+
container_id: z17.string(),
|
|
3455
|
+
outputs: z17.array(
|
|
3456
|
+
z17.discriminatedUnion("type", [
|
|
3457
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3458
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3338
3459
|
])
|
|
3339
3460
|
).nullable()
|
|
3340
3461
|
}),
|
|
3341
|
-
|
|
3342
|
-
type:
|
|
3343
|
-
id:
|
|
3344
|
-
result:
|
|
3462
|
+
z17.object({
|
|
3463
|
+
type: z17.literal("image_generation_call"),
|
|
3464
|
+
id: z17.string(),
|
|
3465
|
+
result: z17.string()
|
|
3345
3466
|
}),
|
|
3346
|
-
|
|
3347
|
-
type:
|
|
3348
|
-
id:
|
|
3349
|
-
status:
|
|
3350
|
-
action:
|
|
3351
|
-
|
|
3352
|
-
type:
|
|
3353
|
-
query:
|
|
3354
|
-
sources:
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3467
|
+
z17.object({
|
|
3468
|
+
type: z17.literal("web_search_call"),
|
|
3469
|
+
id: z17.string(),
|
|
3470
|
+
status: z17.string(),
|
|
3471
|
+
action: z17.discriminatedUnion("type", [
|
|
3472
|
+
z17.object({
|
|
3473
|
+
type: z17.literal("search"),
|
|
3474
|
+
query: z17.string().nullish(),
|
|
3475
|
+
sources: z17.array(
|
|
3476
|
+
z17.discriminatedUnion("type", [
|
|
3477
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
3478
|
+
z17.object({ type: z17.literal("api"), name: z17.string() })
|
|
3358
3479
|
])
|
|
3359
3480
|
).nullish()
|
|
3360
3481
|
}),
|
|
3361
|
-
|
|
3362
|
-
type:
|
|
3363
|
-
url:
|
|
3482
|
+
z17.object({
|
|
3483
|
+
type: z17.literal("open_page"),
|
|
3484
|
+
url: z17.string().nullish()
|
|
3364
3485
|
}),
|
|
3365
|
-
|
|
3366
|
-
type:
|
|
3367
|
-
url:
|
|
3368
|
-
pattern:
|
|
3486
|
+
z17.object({
|
|
3487
|
+
type: z17.literal("find_in_page"),
|
|
3488
|
+
url: z17.string().nullish(),
|
|
3489
|
+
pattern: z17.string().nullish()
|
|
3369
3490
|
})
|
|
3370
3491
|
]).nullish()
|
|
3371
3492
|
}),
|
|
3372
|
-
|
|
3373
|
-
type:
|
|
3374
|
-
id:
|
|
3375
|
-
queries:
|
|
3376
|
-
results:
|
|
3377
|
-
|
|
3378
|
-
attributes:
|
|
3379
|
-
|
|
3380
|
-
|
|
3493
|
+
z17.object({
|
|
3494
|
+
type: z17.literal("file_search_call"),
|
|
3495
|
+
id: z17.string(),
|
|
3496
|
+
queries: z17.array(z17.string()),
|
|
3497
|
+
results: z17.array(
|
|
3498
|
+
z17.object({
|
|
3499
|
+
attributes: z17.record(
|
|
3500
|
+
z17.string(),
|
|
3501
|
+
z17.union([z17.string(), z17.number(), z17.boolean()])
|
|
3381
3502
|
),
|
|
3382
|
-
file_id:
|
|
3383
|
-
filename:
|
|
3384
|
-
score:
|
|
3385
|
-
text:
|
|
3503
|
+
file_id: z17.string(),
|
|
3504
|
+
filename: z17.string(),
|
|
3505
|
+
score: z17.number(),
|
|
3506
|
+
text: z17.string()
|
|
3386
3507
|
})
|
|
3387
3508
|
).nullish()
|
|
3388
3509
|
}),
|
|
3389
|
-
|
|
3390
|
-
type:
|
|
3391
|
-
id:
|
|
3392
|
-
call_id:
|
|
3393
|
-
action:
|
|
3394
|
-
type:
|
|
3395
|
-
command:
|
|
3396
|
-
timeout_ms:
|
|
3397
|
-
user:
|
|
3398
|
-
working_directory:
|
|
3399
|
-
env:
|
|
3510
|
+
z17.object({
|
|
3511
|
+
type: z17.literal("local_shell_call"),
|
|
3512
|
+
id: z17.string(),
|
|
3513
|
+
call_id: z17.string(),
|
|
3514
|
+
action: z17.object({
|
|
3515
|
+
type: z17.literal("exec"),
|
|
3516
|
+
command: z17.array(z17.string()),
|
|
3517
|
+
timeout_ms: z17.number().optional(),
|
|
3518
|
+
user: z17.string().optional(),
|
|
3519
|
+
working_directory: z17.string().optional(),
|
|
3520
|
+
env: z17.record(z17.string(), z17.string()).optional()
|
|
3400
3521
|
})
|
|
3401
3522
|
}),
|
|
3402
|
-
|
|
3403
|
-
type:
|
|
3404
|
-
id:
|
|
3405
|
-
status:
|
|
3523
|
+
z17.object({
|
|
3524
|
+
type: z17.literal("computer_call"),
|
|
3525
|
+
id: z17.string(),
|
|
3526
|
+
status: z17.literal("completed")
|
|
3406
3527
|
}),
|
|
3407
|
-
|
|
3408
|
-
type:
|
|
3409
|
-
id:
|
|
3410
|
-
status:
|
|
3411
|
-
arguments:
|
|
3412
|
-
name:
|
|
3413
|
-
server_label:
|
|
3414
|
-
output:
|
|
3415
|
-
error:
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
type:
|
|
3419
|
-
code:
|
|
3420
|
-
message:
|
|
3528
|
+
z17.object({
|
|
3529
|
+
type: z17.literal("mcp_call"),
|
|
3530
|
+
id: z17.string(),
|
|
3531
|
+
status: z17.string(),
|
|
3532
|
+
arguments: z17.string(),
|
|
3533
|
+
name: z17.string(),
|
|
3534
|
+
server_label: z17.string(),
|
|
3535
|
+
output: z17.string().nullish(),
|
|
3536
|
+
error: z17.union([
|
|
3537
|
+
z17.string(),
|
|
3538
|
+
z17.object({
|
|
3539
|
+
type: z17.string().optional(),
|
|
3540
|
+
code: z17.union([z17.number(), z17.string()]).optional(),
|
|
3541
|
+
message: z17.string().optional()
|
|
3421
3542
|
}).loose()
|
|
3422
3543
|
]).nullish(),
|
|
3423
|
-
approval_request_id:
|
|
3544
|
+
approval_request_id: z17.string().nullish()
|
|
3424
3545
|
}),
|
|
3425
|
-
|
|
3426
|
-
type:
|
|
3427
|
-
id:
|
|
3428
|
-
server_label:
|
|
3429
|
-
tools:
|
|
3430
|
-
|
|
3431
|
-
name:
|
|
3432
|
-
description:
|
|
3433
|
-
input_schema:
|
|
3434
|
-
annotations:
|
|
3546
|
+
z17.object({
|
|
3547
|
+
type: z17.literal("mcp_list_tools"),
|
|
3548
|
+
id: z17.string(),
|
|
3549
|
+
server_label: z17.string(),
|
|
3550
|
+
tools: z17.array(
|
|
3551
|
+
z17.object({
|
|
3552
|
+
name: z17.string(),
|
|
3553
|
+
description: z17.string().optional(),
|
|
3554
|
+
input_schema: z17.any(),
|
|
3555
|
+
annotations: z17.record(z17.string(), z17.unknown()).optional()
|
|
3435
3556
|
})
|
|
3436
3557
|
),
|
|
3437
|
-
error:
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
type:
|
|
3441
|
-
code:
|
|
3442
|
-
message:
|
|
3558
|
+
error: z17.union([
|
|
3559
|
+
z17.string(),
|
|
3560
|
+
z17.object({
|
|
3561
|
+
type: z17.string().optional(),
|
|
3562
|
+
code: z17.union([z17.number(), z17.string()]).optional(),
|
|
3563
|
+
message: z17.string().optional()
|
|
3443
3564
|
}).loose()
|
|
3444
3565
|
]).optional()
|
|
3445
3566
|
}),
|
|
3446
|
-
|
|
3447
|
-
type:
|
|
3448
|
-
id:
|
|
3449
|
-
server_label:
|
|
3450
|
-
name:
|
|
3451
|
-
arguments:
|
|
3452
|
-
approval_request_id:
|
|
3567
|
+
z17.object({
|
|
3568
|
+
type: z17.literal("mcp_approval_request"),
|
|
3569
|
+
id: z17.string(),
|
|
3570
|
+
server_label: z17.string(),
|
|
3571
|
+
name: z17.string(),
|
|
3572
|
+
arguments: z17.string(),
|
|
3573
|
+
approval_request_id: z17.string().optional()
|
|
3453
3574
|
}),
|
|
3454
|
-
|
|
3455
|
-
type:
|
|
3456
|
-
id:
|
|
3457
|
-
call_id:
|
|
3458
|
-
status:
|
|
3459
|
-
operation:
|
|
3460
|
-
|
|
3461
|
-
type:
|
|
3462
|
-
path:
|
|
3463
|
-
diff:
|
|
3575
|
+
z17.object({
|
|
3576
|
+
type: z17.literal("apply_patch_call"),
|
|
3577
|
+
id: z17.string(),
|
|
3578
|
+
call_id: z17.string(),
|
|
3579
|
+
status: z17.enum(["in_progress", "completed"]),
|
|
3580
|
+
operation: z17.discriminatedUnion("type", [
|
|
3581
|
+
z17.object({
|
|
3582
|
+
type: z17.literal("create_file"),
|
|
3583
|
+
path: z17.string(),
|
|
3584
|
+
diff: z17.string()
|
|
3464
3585
|
}),
|
|
3465
|
-
|
|
3466
|
-
type:
|
|
3467
|
-
path:
|
|
3586
|
+
z17.object({
|
|
3587
|
+
type: z17.literal("delete_file"),
|
|
3588
|
+
path: z17.string()
|
|
3468
3589
|
}),
|
|
3469
|
-
|
|
3470
|
-
type:
|
|
3471
|
-
path:
|
|
3472
|
-
diff:
|
|
3590
|
+
z17.object({
|
|
3591
|
+
type: z17.literal("update_file"),
|
|
3592
|
+
path: z17.string(),
|
|
3593
|
+
diff: z17.string()
|
|
3473
3594
|
})
|
|
3474
3595
|
])
|
|
3475
3596
|
}),
|
|
3476
|
-
|
|
3477
|
-
type:
|
|
3478
|
-
id:
|
|
3479
|
-
call_id:
|
|
3480
|
-
status:
|
|
3481
|
-
action:
|
|
3482
|
-
commands:
|
|
3597
|
+
z17.object({
|
|
3598
|
+
type: z17.literal("shell_call"),
|
|
3599
|
+
id: z17.string(),
|
|
3600
|
+
call_id: z17.string(),
|
|
3601
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3602
|
+
action: z17.object({
|
|
3603
|
+
commands: z17.array(z17.string())
|
|
3483
3604
|
})
|
|
3484
3605
|
}),
|
|
3485
|
-
|
|
3486
|
-
type:
|
|
3487
|
-
id:
|
|
3488
|
-
call_id:
|
|
3489
|
-
status:
|
|
3490
|
-
output:
|
|
3491
|
-
|
|
3492
|
-
stdout:
|
|
3493
|
-
stderr:
|
|
3494
|
-
outcome:
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
type:
|
|
3498
|
-
exit_code:
|
|
3606
|
+
z17.object({
|
|
3607
|
+
type: z17.literal("shell_call_output"),
|
|
3608
|
+
id: z17.string(),
|
|
3609
|
+
call_id: z17.string(),
|
|
3610
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3611
|
+
output: z17.array(
|
|
3612
|
+
z17.object({
|
|
3613
|
+
stdout: z17.string(),
|
|
3614
|
+
stderr: z17.string(),
|
|
3615
|
+
outcome: z17.discriminatedUnion("type", [
|
|
3616
|
+
z17.object({ type: z17.literal("timeout") }),
|
|
3617
|
+
z17.object({
|
|
3618
|
+
type: z17.literal("exit"),
|
|
3619
|
+
exit_code: z17.number()
|
|
3499
3620
|
})
|
|
3500
3621
|
])
|
|
3501
3622
|
})
|
|
3502
3623
|
)
|
|
3624
|
+
}),
|
|
3625
|
+
z17.object({
|
|
3626
|
+
type: z17.literal("tool_search_call"),
|
|
3627
|
+
id: z17.string(),
|
|
3628
|
+
execution: z17.enum(["server", "client"]),
|
|
3629
|
+
call_id: z17.string().nullable(),
|
|
3630
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3631
|
+
arguments: z17.unknown()
|
|
3632
|
+
}),
|
|
3633
|
+
z17.object({
|
|
3634
|
+
type: z17.literal("tool_search_output"),
|
|
3635
|
+
id: z17.string(),
|
|
3636
|
+
execution: z17.enum(["server", "client"]),
|
|
3637
|
+
call_id: z17.string().nullable(),
|
|
3638
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3639
|
+
tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
|
|
3503
3640
|
})
|
|
3504
3641
|
])
|
|
3505
3642
|
}),
|
|
3506
|
-
|
|
3507
|
-
type:
|
|
3508
|
-
item_id:
|
|
3509
|
-
output_index:
|
|
3510
|
-
delta:
|
|
3643
|
+
z17.object({
|
|
3644
|
+
type: z17.literal("response.function_call_arguments.delta"),
|
|
3645
|
+
item_id: z17.string(),
|
|
3646
|
+
output_index: z17.number(),
|
|
3647
|
+
delta: z17.string()
|
|
3511
3648
|
}),
|
|
3512
|
-
|
|
3513
|
-
type:
|
|
3514
|
-
item_id:
|
|
3515
|
-
output_index:
|
|
3516
|
-
delta:
|
|
3649
|
+
z17.object({
|
|
3650
|
+
type: z17.literal("response.custom_tool_call_input.delta"),
|
|
3651
|
+
item_id: z17.string(),
|
|
3652
|
+
output_index: z17.number(),
|
|
3653
|
+
delta: z17.string()
|
|
3517
3654
|
}),
|
|
3518
|
-
|
|
3519
|
-
type:
|
|
3520
|
-
item_id:
|
|
3521
|
-
output_index:
|
|
3522
|
-
partial_image_b64:
|
|
3655
|
+
z17.object({
|
|
3656
|
+
type: z17.literal("response.image_generation_call.partial_image"),
|
|
3657
|
+
item_id: z17.string(),
|
|
3658
|
+
output_index: z17.number(),
|
|
3659
|
+
partial_image_b64: z17.string()
|
|
3523
3660
|
}),
|
|
3524
|
-
|
|
3525
|
-
type:
|
|
3526
|
-
item_id:
|
|
3527
|
-
output_index:
|
|
3528
|
-
delta:
|
|
3661
|
+
z17.object({
|
|
3662
|
+
type: z17.literal("response.code_interpreter_call_code.delta"),
|
|
3663
|
+
item_id: z17.string(),
|
|
3664
|
+
output_index: z17.number(),
|
|
3665
|
+
delta: z17.string()
|
|
3529
3666
|
}),
|
|
3530
|
-
|
|
3531
|
-
type:
|
|
3532
|
-
item_id:
|
|
3533
|
-
output_index:
|
|
3534
|
-
code:
|
|
3667
|
+
z17.object({
|
|
3668
|
+
type: z17.literal("response.code_interpreter_call_code.done"),
|
|
3669
|
+
item_id: z17.string(),
|
|
3670
|
+
output_index: z17.number(),
|
|
3671
|
+
code: z17.string()
|
|
3535
3672
|
}),
|
|
3536
|
-
|
|
3537
|
-
type:
|
|
3538
|
-
annotation:
|
|
3539
|
-
|
|
3540
|
-
type:
|
|
3541
|
-
start_index:
|
|
3542
|
-
end_index:
|
|
3543
|
-
url:
|
|
3544
|
-
title:
|
|
3673
|
+
z17.object({
|
|
3674
|
+
type: z17.literal("response.output_text.annotation.added"),
|
|
3675
|
+
annotation: z17.discriminatedUnion("type", [
|
|
3676
|
+
z17.object({
|
|
3677
|
+
type: z17.literal("url_citation"),
|
|
3678
|
+
start_index: z17.number(),
|
|
3679
|
+
end_index: z17.number(),
|
|
3680
|
+
url: z17.string(),
|
|
3681
|
+
title: z17.string()
|
|
3545
3682
|
}),
|
|
3546
|
-
|
|
3547
|
-
type:
|
|
3548
|
-
file_id:
|
|
3549
|
-
filename:
|
|
3550
|
-
index:
|
|
3683
|
+
z17.object({
|
|
3684
|
+
type: z17.literal("file_citation"),
|
|
3685
|
+
file_id: z17.string(),
|
|
3686
|
+
filename: z17.string(),
|
|
3687
|
+
index: z17.number()
|
|
3551
3688
|
}),
|
|
3552
|
-
|
|
3553
|
-
type:
|
|
3554
|
-
container_id:
|
|
3555
|
-
file_id:
|
|
3556
|
-
filename:
|
|
3557
|
-
start_index:
|
|
3558
|
-
end_index:
|
|
3689
|
+
z17.object({
|
|
3690
|
+
type: z17.literal("container_file_citation"),
|
|
3691
|
+
container_id: z17.string(),
|
|
3692
|
+
file_id: z17.string(),
|
|
3693
|
+
filename: z17.string(),
|
|
3694
|
+
start_index: z17.number(),
|
|
3695
|
+
end_index: z17.number()
|
|
3559
3696
|
}),
|
|
3560
|
-
|
|
3561
|
-
type:
|
|
3562
|
-
file_id:
|
|
3563
|
-
index:
|
|
3697
|
+
z17.object({
|
|
3698
|
+
type: z17.literal("file_path"),
|
|
3699
|
+
file_id: z17.string(),
|
|
3700
|
+
index: z17.number()
|
|
3564
3701
|
})
|
|
3565
3702
|
])
|
|
3566
3703
|
}),
|
|
3567
|
-
|
|
3568
|
-
type:
|
|
3569
|
-
item_id:
|
|
3570
|
-
summary_index:
|
|
3704
|
+
z17.object({
|
|
3705
|
+
type: z17.literal("response.reasoning_summary_part.added"),
|
|
3706
|
+
item_id: z17.string(),
|
|
3707
|
+
summary_index: z17.number()
|
|
3571
3708
|
}),
|
|
3572
|
-
|
|
3573
|
-
type:
|
|
3574
|
-
item_id:
|
|
3575
|
-
summary_index:
|
|
3576
|
-
delta:
|
|
3709
|
+
z17.object({
|
|
3710
|
+
type: z17.literal("response.reasoning_summary_text.delta"),
|
|
3711
|
+
item_id: z17.string(),
|
|
3712
|
+
summary_index: z17.number(),
|
|
3713
|
+
delta: z17.string()
|
|
3577
3714
|
}),
|
|
3578
|
-
|
|
3579
|
-
type:
|
|
3580
|
-
item_id:
|
|
3581
|
-
summary_index:
|
|
3715
|
+
z17.object({
|
|
3716
|
+
type: z17.literal("response.reasoning_summary_part.done"),
|
|
3717
|
+
item_id: z17.string(),
|
|
3718
|
+
summary_index: z17.number()
|
|
3582
3719
|
}),
|
|
3583
|
-
|
|
3584
|
-
type:
|
|
3585
|
-
item_id:
|
|
3586
|
-
output_index:
|
|
3587
|
-
delta:
|
|
3588
|
-
obfuscation:
|
|
3720
|
+
z17.object({
|
|
3721
|
+
type: z17.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3722
|
+
item_id: z17.string(),
|
|
3723
|
+
output_index: z17.number(),
|
|
3724
|
+
delta: z17.string(),
|
|
3725
|
+
obfuscation: z17.string().nullish()
|
|
3589
3726
|
}),
|
|
3590
|
-
|
|
3591
|
-
type:
|
|
3592
|
-
item_id:
|
|
3593
|
-
output_index:
|
|
3594
|
-
diff:
|
|
3727
|
+
z17.object({
|
|
3728
|
+
type: z17.literal("response.apply_patch_call_operation_diff.done"),
|
|
3729
|
+
item_id: z17.string(),
|
|
3730
|
+
output_index: z17.number(),
|
|
3731
|
+
diff: z17.string()
|
|
3595
3732
|
}),
|
|
3596
|
-
|
|
3597
|
-
type:
|
|
3598
|
-
sequence_number:
|
|
3599
|
-
error:
|
|
3600
|
-
type:
|
|
3601
|
-
code:
|
|
3602
|
-
message:
|
|
3603
|
-
param:
|
|
3733
|
+
z17.object({
|
|
3734
|
+
type: z17.literal("error"),
|
|
3735
|
+
sequence_number: z17.number(),
|
|
3736
|
+
error: z17.object({
|
|
3737
|
+
type: z17.string(),
|
|
3738
|
+
code: z17.string(),
|
|
3739
|
+
message: z17.string(),
|
|
3740
|
+
param: z17.string().nullish()
|
|
3604
3741
|
})
|
|
3605
3742
|
}),
|
|
3606
|
-
|
|
3743
|
+
z17.object({ type: z17.string() }).loose().transform((value) => ({
|
|
3607
3744
|
type: "unknown_chunk",
|
|
3608
3745
|
message: value.type
|
|
3609
3746
|
}))
|
|
@@ -3611,294 +3748,310 @@ var openaiResponsesChunkSchema = lazySchema14(
|
|
|
3611
3748
|
])
|
|
3612
3749
|
)
|
|
3613
3750
|
);
|
|
3614
|
-
var openaiResponsesResponseSchema =
|
|
3615
|
-
() =>
|
|
3616
|
-
|
|
3617
|
-
id:
|
|
3618
|
-
created_at:
|
|
3619
|
-
error:
|
|
3620
|
-
message:
|
|
3621
|
-
type:
|
|
3622
|
-
param:
|
|
3623
|
-
code:
|
|
3751
|
+
var openaiResponsesResponseSchema = lazySchema15(
|
|
3752
|
+
() => zodSchema15(
|
|
3753
|
+
z17.object({
|
|
3754
|
+
id: z17.string().optional(),
|
|
3755
|
+
created_at: z17.number().optional(),
|
|
3756
|
+
error: z17.object({
|
|
3757
|
+
message: z17.string(),
|
|
3758
|
+
type: z17.string(),
|
|
3759
|
+
param: z17.string().nullish(),
|
|
3760
|
+
code: z17.string()
|
|
3624
3761
|
}).nullish(),
|
|
3625
|
-
model:
|
|
3626
|
-
output:
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
type:
|
|
3630
|
-
role:
|
|
3631
|
-
id:
|
|
3632
|
-
phase:
|
|
3633
|
-
content:
|
|
3634
|
-
|
|
3635
|
-
type:
|
|
3636
|
-
text:
|
|
3637
|
-
logprobs:
|
|
3638
|
-
|
|
3639
|
-
token:
|
|
3640
|
-
logprob:
|
|
3641
|
-
top_logprobs:
|
|
3642
|
-
|
|
3643
|
-
token:
|
|
3644
|
-
logprob:
|
|
3762
|
+
model: z17.string().optional(),
|
|
3763
|
+
output: z17.array(
|
|
3764
|
+
z17.discriminatedUnion("type", [
|
|
3765
|
+
z17.object({
|
|
3766
|
+
type: z17.literal("message"),
|
|
3767
|
+
role: z17.literal("assistant"),
|
|
3768
|
+
id: z17.string(),
|
|
3769
|
+
phase: z17.enum(["commentary", "final_answer"]).nullish(),
|
|
3770
|
+
content: z17.array(
|
|
3771
|
+
z17.object({
|
|
3772
|
+
type: z17.literal("output_text"),
|
|
3773
|
+
text: z17.string(),
|
|
3774
|
+
logprobs: z17.array(
|
|
3775
|
+
z17.object({
|
|
3776
|
+
token: z17.string(),
|
|
3777
|
+
logprob: z17.number(),
|
|
3778
|
+
top_logprobs: z17.array(
|
|
3779
|
+
z17.object({
|
|
3780
|
+
token: z17.string(),
|
|
3781
|
+
logprob: z17.number()
|
|
3645
3782
|
})
|
|
3646
3783
|
)
|
|
3647
3784
|
})
|
|
3648
3785
|
).nullish(),
|
|
3649
|
-
annotations:
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
type:
|
|
3653
|
-
start_index:
|
|
3654
|
-
end_index:
|
|
3655
|
-
url:
|
|
3656
|
-
title:
|
|
3786
|
+
annotations: z17.array(
|
|
3787
|
+
z17.discriminatedUnion("type", [
|
|
3788
|
+
z17.object({
|
|
3789
|
+
type: z17.literal("url_citation"),
|
|
3790
|
+
start_index: z17.number(),
|
|
3791
|
+
end_index: z17.number(),
|
|
3792
|
+
url: z17.string(),
|
|
3793
|
+
title: z17.string()
|
|
3657
3794
|
}),
|
|
3658
|
-
|
|
3659
|
-
type:
|
|
3660
|
-
file_id:
|
|
3661
|
-
filename:
|
|
3662
|
-
index:
|
|
3795
|
+
z17.object({
|
|
3796
|
+
type: z17.literal("file_citation"),
|
|
3797
|
+
file_id: z17.string(),
|
|
3798
|
+
filename: z17.string(),
|
|
3799
|
+
index: z17.number()
|
|
3663
3800
|
}),
|
|
3664
|
-
|
|
3665
|
-
type:
|
|
3666
|
-
container_id:
|
|
3667
|
-
file_id:
|
|
3668
|
-
filename:
|
|
3669
|
-
start_index:
|
|
3670
|
-
end_index:
|
|
3801
|
+
z17.object({
|
|
3802
|
+
type: z17.literal("container_file_citation"),
|
|
3803
|
+
container_id: z17.string(),
|
|
3804
|
+
file_id: z17.string(),
|
|
3805
|
+
filename: z17.string(),
|
|
3806
|
+
start_index: z17.number(),
|
|
3807
|
+
end_index: z17.number()
|
|
3671
3808
|
}),
|
|
3672
|
-
|
|
3673
|
-
type:
|
|
3674
|
-
file_id:
|
|
3675
|
-
index:
|
|
3809
|
+
z17.object({
|
|
3810
|
+
type: z17.literal("file_path"),
|
|
3811
|
+
file_id: z17.string(),
|
|
3812
|
+
index: z17.number()
|
|
3676
3813
|
})
|
|
3677
3814
|
])
|
|
3678
3815
|
)
|
|
3679
3816
|
})
|
|
3680
3817
|
)
|
|
3681
3818
|
}),
|
|
3682
|
-
|
|
3683
|
-
type:
|
|
3684
|
-
id:
|
|
3685
|
-
status:
|
|
3686
|
-
action:
|
|
3687
|
-
|
|
3688
|
-
type:
|
|
3689
|
-
query:
|
|
3690
|
-
sources:
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
type:
|
|
3695
|
-
name:
|
|
3819
|
+
z17.object({
|
|
3820
|
+
type: z17.literal("web_search_call"),
|
|
3821
|
+
id: z17.string(),
|
|
3822
|
+
status: z17.string(),
|
|
3823
|
+
action: z17.discriminatedUnion("type", [
|
|
3824
|
+
z17.object({
|
|
3825
|
+
type: z17.literal("search"),
|
|
3826
|
+
query: z17.string().nullish(),
|
|
3827
|
+
sources: z17.array(
|
|
3828
|
+
z17.discriminatedUnion("type", [
|
|
3829
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
3830
|
+
z17.object({
|
|
3831
|
+
type: z17.literal("api"),
|
|
3832
|
+
name: z17.string()
|
|
3696
3833
|
})
|
|
3697
3834
|
])
|
|
3698
3835
|
).nullish()
|
|
3699
3836
|
}),
|
|
3700
|
-
|
|
3701
|
-
type:
|
|
3702
|
-
url:
|
|
3837
|
+
z17.object({
|
|
3838
|
+
type: z17.literal("open_page"),
|
|
3839
|
+
url: z17.string().nullish()
|
|
3703
3840
|
}),
|
|
3704
|
-
|
|
3705
|
-
type:
|
|
3706
|
-
url:
|
|
3707
|
-
pattern:
|
|
3841
|
+
z17.object({
|
|
3842
|
+
type: z17.literal("find_in_page"),
|
|
3843
|
+
url: z17.string().nullish(),
|
|
3844
|
+
pattern: z17.string().nullish()
|
|
3708
3845
|
})
|
|
3709
3846
|
]).nullish()
|
|
3710
3847
|
}),
|
|
3711
|
-
|
|
3712
|
-
type:
|
|
3713
|
-
id:
|
|
3714
|
-
queries:
|
|
3715
|
-
results:
|
|
3716
|
-
|
|
3717
|
-
attributes:
|
|
3718
|
-
|
|
3719
|
-
|
|
3848
|
+
z17.object({
|
|
3849
|
+
type: z17.literal("file_search_call"),
|
|
3850
|
+
id: z17.string(),
|
|
3851
|
+
queries: z17.array(z17.string()),
|
|
3852
|
+
results: z17.array(
|
|
3853
|
+
z17.object({
|
|
3854
|
+
attributes: z17.record(
|
|
3855
|
+
z17.string(),
|
|
3856
|
+
z17.union([z17.string(), z17.number(), z17.boolean()])
|
|
3720
3857
|
),
|
|
3721
|
-
file_id:
|
|
3722
|
-
filename:
|
|
3723
|
-
score:
|
|
3724
|
-
text:
|
|
3858
|
+
file_id: z17.string(),
|
|
3859
|
+
filename: z17.string(),
|
|
3860
|
+
score: z17.number(),
|
|
3861
|
+
text: z17.string()
|
|
3725
3862
|
})
|
|
3726
3863
|
).nullish()
|
|
3727
3864
|
}),
|
|
3728
|
-
|
|
3729
|
-
type:
|
|
3730
|
-
id:
|
|
3731
|
-
code:
|
|
3732
|
-
container_id:
|
|
3733
|
-
outputs:
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3865
|
+
z17.object({
|
|
3866
|
+
type: z17.literal("code_interpreter_call"),
|
|
3867
|
+
id: z17.string(),
|
|
3868
|
+
code: z17.string().nullable(),
|
|
3869
|
+
container_id: z17.string(),
|
|
3870
|
+
outputs: z17.array(
|
|
3871
|
+
z17.discriminatedUnion("type", [
|
|
3872
|
+
z17.object({ type: z17.literal("logs"), logs: z17.string() }),
|
|
3873
|
+
z17.object({ type: z17.literal("image"), url: z17.string() })
|
|
3737
3874
|
])
|
|
3738
3875
|
).nullable()
|
|
3739
3876
|
}),
|
|
3740
|
-
|
|
3741
|
-
type:
|
|
3742
|
-
id:
|
|
3743
|
-
result:
|
|
3877
|
+
z17.object({
|
|
3878
|
+
type: z17.literal("image_generation_call"),
|
|
3879
|
+
id: z17.string(),
|
|
3880
|
+
result: z17.string()
|
|
3744
3881
|
}),
|
|
3745
|
-
|
|
3746
|
-
type:
|
|
3747
|
-
id:
|
|
3748
|
-
call_id:
|
|
3749
|
-
action:
|
|
3750
|
-
type:
|
|
3751
|
-
command:
|
|
3752
|
-
timeout_ms:
|
|
3753
|
-
user:
|
|
3754
|
-
working_directory:
|
|
3755
|
-
env:
|
|
3882
|
+
z17.object({
|
|
3883
|
+
type: z17.literal("local_shell_call"),
|
|
3884
|
+
id: z17.string(),
|
|
3885
|
+
call_id: z17.string(),
|
|
3886
|
+
action: z17.object({
|
|
3887
|
+
type: z17.literal("exec"),
|
|
3888
|
+
command: z17.array(z17.string()),
|
|
3889
|
+
timeout_ms: z17.number().optional(),
|
|
3890
|
+
user: z17.string().optional(),
|
|
3891
|
+
working_directory: z17.string().optional(),
|
|
3892
|
+
env: z17.record(z17.string(), z17.string()).optional()
|
|
3756
3893
|
})
|
|
3757
3894
|
}),
|
|
3758
|
-
|
|
3759
|
-
type:
|
|
3760
|
-
call_id:
|
|
3761
|
-
name:
|
|
3762
|
-
arguments:
|
|
3763
|
-
id:
|
|
3895
|
+
z17.object({
|
|
3896
|
+
type: z17.literal("function_call"),
|
|
3897
|
+
call_id: z17.string(),
|
|
3898
|
+
name: z17.string(),
|
|
3899
|
+
arguments: z17.string(),
|
|
3900
|
+
id: z17.string()
|
|
3764
3901
|
}),
|
|
3765
|
-
|
|
3766
|
-
type:
|
|
3767
|
-
call_id:
|
|
3768
|
-
name:
|
|
3769
|
-
input:
|
|
3770
|
-
id:
|
|
3902
|
+
z17.object({
|
|
3903
|
+
type: z17.literal("custom_tool_call"),
|
|
3904
|
+
call_id: z17.string(),
|
|
3905
|
+
name: z17.string(),
|
|
3906
|
+
input: z17.string(),
|
|
3907
|
+
id: z17.string()
|
|
3771
3908
|
}),
|
|
3772
|
-
|
|
3773
|
-
type:
|
|
3774
|
-
id:
|
|
3775
|
-
status:
|
|
3909
|
+
z17.object({
|
|
3910
|
+
type: z17.literal("computer_call"),
|
|
3911
|
+
id: z17.string(),
|
|
3912
|
+
status: z17.string().optional()
|
|
3776
3913
|
}),
|
|
3777
|
-
|
|
3778
|
-
type:
|
|
3779
|
-
id:
|
|
3780
|
-
encrypted_content:
|
|
3781
|
-
summary:
|
|
3782
|
-
|
|
3783
|
-
type:
|
|
3784
|
-
text:
|
|
3914
|
+
z17.object({
|
|
3915
|
+
type: z17.literal("reasoning"),
|
|
3916
|
+
id: z17.string(),
|
|
3917
|
+
encrypted_content: z17.string().nullish(),
|
|
3918
|
+
summary: z17.array(
|
|
3919
|
+
z17.object({
|
|
3920
|
+
type: z17.literal("summary_text"),
|
|
3921
|
+
text: z17.string()
|
|
3785
3922
|
})
|
|
3786
3923
|
)
|
|
3787
3924
|
}),
|
|
3788
|
-
|
|
3789
|
-
type:
|
|
3790
|
-
id:
|
|
3791
|
-
status:
|
|
3792
|
-
arguments:
|
|
3793
|
-
name:
|
|
3794
|
-
server_label:
|
|
3795
|
-
output:
|
|
3796
|
-
error:
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
type:
|
|
3800
|
-
code:
|
|
3801
|
-
message:
|
|
3925
|
+
z17.object({
|
|
3926
|
+
type: z17.literal("mcp_call"),
|
|
3927
|
+
id: z17.string(),
|
|
3928
|
+
status: z17.string(),
|
|
3929
|
+
arguments: z17.string(),
|
|
3930
|
+
name: z17.string(),
|
|
3931
|
+
server_label: z17.string(),
|
|
3932
|
+
output: z17.string().nullish(),
|
|
3933
|
+
error: z17.union([
|
|
3934
|
+
z17.string(),
|
|
3935
|
+
z17.object({
|
|
3936
|
+
type: z17.string().optional(),
|
|
3937
|
+
code: z17.union([z17.number(), z17.string()]).optional(),
|
|
3938
|
+
message: z17.string().optional()
|
|
3802
3939
|
}).loose()
|
|
3803
3940
|
]).nullish(),
|
|
3804
|
-
approval_request_id:
|
|
3941
|
+
approval_request_id: z17.string().nullish()
|
|
3805
3942
|
}),
|
|
3806
|
-
|
|
3807
|
-
type:
|
|
3808
|
-
id:
|
|
3809
|
-
server_label:
|
|
3810
|
-
tools:
|
|
3811
|
-
|
|
3812
|
-
name:
|
|
3813
|
-
description:
|
|
3814
|
-
input_schema:
|
|
3815
|
-
annotations:
|
|
3943
|
+
z17.object({
|
|
3944
|
+
type: z17.literal("mcp_list_tools"),
|
|
3945
|
+
id: z17.string(),
|
|
3946
|
+
server_label: z17.string(),
|
|
3947
|
+
tools: z17.array(
|
|
3948
|
+
z17.object({
|
|
3949
|
+
name: z17.string(),
|
|
3950
|
+
description: z17.string().optional(),
|
|
3951
|
+
input_schema: z17.any(),
|
|
3952
|
+
annotations: z17.record(z17.string(), z17.unknown()).optional()
|
|
3816
3953
|
})
|
|
3817
3954
|
),
|
|
3818
|
-
error:
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
type:
|
|
3822
|
-
code:
|
|
3823
|
-
message:
|
|
3955
|
+
error: z17.union([
|
|
3956
|
+
z17.string(),
|
|
3957
|
+
z17.object({
|
|
3958
|
+
type: z17.string().optional(),
|
|
3959
|
+
code: z17.union([z17.number(), z17.string()]).optional(),
|
|
3960
|
+
message: z17.string().optional()
|
|
3824
3961
|
}).loose()
|
|
3825
3962
|
]).optional()
|
|
3826
3963
|
}),
|
|
3827
|
-
|
|
3828
|
-
type:
|
|
3829
|
-
id:
|
|
3830
|
-
server_label:
|
|
3831
|
-
name:
|
|
3832
|
-
arguments:
|
|
3833
|
-
approval_request_id:
|
|
3964
|
+
z17.object({
|
|
3965
|
+
type: z17.literal("mcp_approval_request"),
|
|
3966
|
+
id: z17.string(),
|
|
3967
|
+
server_label: z17.string(),
|
|
3968
|
+
name: z17.string(),
|
|
3969
|
+
arguments: z17.string(),
|
|
3970
|
+
approval_request_id: z17.string().optional()
|
|
3834
3971
|
}),
|
|
3835
|
-
|
|
3836
|
-
type:
|
|
3837
|
-
id:
|
|
3838
|
-
call_id:
|
|
3839
|
-
status:
|
|
3840
|
-
operation:
|
|
3841
|
-
|
|
3842
|
-
type:
|
|
3843
|
-
path:
|
|
3844
|
-
diff:
|
|
3972
|
+
z17.object({
|
|
3973
|
+
type: z17.literal("apply_patch_call"),
|
|
3974
|
+
id: z17.string(),
|
|
3975
|
+
call_id: z17.string(),
|
|
3976
|
+
status: z17.enum(["in_progress", "completed"]),
|
|
3977
|
+
operation: z17.discriminatedUnion("type", [
|
|
3978
|
+
z17.object({
|
|
3979
|
+
type: z17.literal("create_file"),
|
|
3980
|
+
path: z17.string(),
|
|
3981
|
+
diff: z17.string()
|
|
3845
3982
|
}),
|
|
3846
|
-
|
|
3847
|
-
type:
|
|
3848
|
-
path:
|
|
3983
|
+
z17.object({
|
|
3984
|
+
type: z17.literal("delete_file"),
|
|
3985
|
+
path: z17.string()
|
|
3849
3986
|
}),
|
|
3850
|
-
|
|
3851
|
-
type:
|
|
3852
|
-
path:
|
|
3853
|
-
diff:
|
|
3987
|
+
z17.object({
|
|
3988
|
+
type: z17.literal("update_file"),
|
|
3989
|
+
path: z17.string(),
|
|
3990
|
+
diff: z17.string()
|
|
3854
3991
|
})
|
|
3855
3992
|
])
|
|
3856
3993
|
}),
|
|
3857
|
-
|
|
3858
|
-
type:
|
|
3859
|
-
id:
|
|
3860
|
-
call_id:
|
|
3861
|
-
status:
|
|
3862
|
-
action:
|
|
3863
|
-
commands:
|
|
3994
|
+
z17.object({
|
|
3995
|
+
type: z17.literal("shell_call"),
|
|
3996
|
+
id: z17.string(),
|
|
3997
|
+
call_id: z17.string(),
|
|
3998
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
3999
|
+
action: z17.object({
|
|
4000
|
+
commands: z17.array(z17.string())
|
|
3864
4001
|
})
|
|
3865
4002
|
}),
|
|
3866
|
-
|
|
3867
|
-
type:
|
|
3868
|
-
id:
|
|
3869
|
-
call_id:
|
|
3870
|
-
status:
|
|
3871
|
-
output:
|
|
3872
|
-
|
|
3873
|
-
stdout:
|
|
3874
|
-
stderr:
|
|
3875
|
-
outcome:
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
type:
|
|
3879
|
-
exit_code:
|
|
4003
|
+
z17.object({
|
|
4004
|
+
type: z17.literal("shell_call_output"),
|
|
4005
|
+
id: z17.string(),
|
|
4006
|
+
call_id: z17.string(),
|
|
4007
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
4008
|
+
output: z17.array(
|
|
4009
|
+
z17.object({
|
|
4010
|
+
stdout: z17.string(),
|
|
4011
|
+
stderr: z17.string(),
|
|
4012
|
+
outcome: z17.discriminatedUnion("type", [
|
|
4013
|
+
z17.object({ type: z17.literal("timeout") }),
|
|
4014
|
+
z17.object({
|
|
4015
|
+
type: z17.literal("exit"),
|
|
4016
|
+
exit_code: z17.number()
|
|
3880
4017
|
})
|
|
3881
4018
|
])
|
|
3882
4019
|
})
|
|
3883
4020
|
)
|
|
4021
|
+
}),
|
|
4022
|
+
z17.object({
|
|
4023
|
+
type: z17.literal("tool_search_call"),
|
|
4024
|
+
id: z17.string(),
|
|
4025
|
+
execution: z17.enum(["server", "client"]),
|
|
4026
|
+
call_id: z17.string().nullable(),
|
|
4027
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
4028
|
+
arguments: z17.unknown()
|
|
4029
|
+
}),
|
|
4030
|
+
z17.object({
|
|
4031
|
+
type: z17.literal("tool_search_output"),
|
|
4032
|
+
id: z17.string(),
|
|
4033
|
+
execution: z17.enum(["server", "client"]),
|
|
4034
|
+
call_id: z17.string().nullable(),
|
|
4035
|
+
status: z17.enum(["in_progress", "completed", "incomplete"]),
|
|
4036
|
+
tools: z17.array(z17.record(z17.string(), jsonValueSchema.optional()))
|
|
3884
4037
|
})
|
|
3885
4038
|
])
|
|
3886
4039
|
).optional(),
|
|
3887
|
-
service_tier:
|
|
3888
|
-
incomplete_details:
|
|
3889
|
-
usage:
|
|
3890
|
-
input_tokens:
|
|
3891
|
-
input_tokens_details:
|
|
3892
|
-
output_tokens:
|
|
3893
|
-
output_tokens_details:
|
|
4040
|
+
service_tier: z17.string().nullish(),
|
|
4041
|
+
incomplete_details: z17.object({ reason: z17.string() }).nullish(),
|
|
4042
|
+
usage: z17.object({
|
|
4043
|
+
input_tokens: z17.number(),
|
|
4044
|
+
input_tokens_details: z17.object({ cached_tokens: z17.number().nullish() }).nullish(),
|
|
4045
|
+
output_tokens: z17.number(),
|
|
4046
|
+
output_tokens_details: z17.object({ reasoning_tokens: z17.number().nullish() }).nullish()
|
|
3894
4047
|
}).optional()
|
|
3895
4048
|
})
|
|
3896
4049
|
)
|
|
3897
4050
|
);
|
|
3898
4051
|
|
|
3899
4052
|
// src/responses/openai-responses-options.ts
|
|
3900
|
-
import { lazySchema as
|
|
3901
|
-
import { z as
|
|
4053
|
+
import { lazySchema as lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
|
|
4054
|
+
import { z as z18 } from "zod/v4";
|
|
3902
4055
|
var TOP_LOGPROBS_MAX = 20;
|
|
3903
4056
|
var openaiResponsesReasoningModelIds = [
|
|
3904
4057
|
"o1",
|
|
@@ -3959,9 +4112,9 @@ var openaiResponsesModelIds = [
|
|
|
3959
4112
|
"gpt-5-chat-latest",
|
|
3960
4113
|
...openaiResponsesReasoningModelIds
|
|
3961
4114
|
];
|
|
3962
|
-
var openaiLanguageModelResponsesOptionsSchema =
|
|
3963
|
-
() =>
|
|
3964
|
-
|
|
4115
|
+
var openaiLanguageModelResponsesOptionsSchema = lazySchema16(
|
|
4116
|
+
() => zodSchema16(
|
|
4117
|
+
z18.object({
|
|
3965
4118
|
/**
|
|
3966
4119
|
* The ID of the OpenAI Conversation to continue.
|
|
3967
4120
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -3969,13 +4122,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
3969
4122
|
* Defaults to `undefined`.
|
|
3970
4123
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3971
4124
|
*/
|
|
3972
|
-
conversation:
|
|
4125
|
+
conversation: z18.string().nullish(),
|
|
3973
4126
|
/**
|
|
3974
4127
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
3975
4128
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
3976
4129
|
*/
|
|
3977
|
-
include:
|
|
3978
|
-
|
|
4130
|
+
include: z18.array(
|
|
4131
|
+
z18.enum([
|
|
3979
4132
|
"reasoning.encrypted_content",
|
|
3980
4133
|
// handled internally by default, only needed for unknown reasoning models
|
|
3981
4134
|
"file_search_call.results",
|
|
@@ -3987,7 +4140,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
3987
4140
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
3988
4141
|
* Defaults to `undefined`.
|
|
3989
4142
|
*/
|
|
3990
|
-
instructions:
|
|
4143
|
+
instructions: z18.string().nullish(),
|
|
3991
4144
|
/**
|
|
3992
4145
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
3993
4146
|
* the response size and can slow down response times. However, it can
|
|
@@ -4002,30 +4155,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4002
4155
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
4003
4156
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
4004
4157
|
*/
|
|
4005
|
-
logprobs:
|
|
4158
|
+
logprobs: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
4006
4159
|
/**
|
|
4007
4160
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
4008
4161
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
4009
4162
|
* Any further attempts to call a tool by the model will be ignored.
|
|
4010
4163
|
*/
|
|
4011
|
-
maxToolCalls:
|
|
4164
|
+
maxToolCalls: z18.number().nullish(),
|
|
4012
4165
|
/**
|
|
4013
4166
|
* Additional metadata to store with the generation.
|
|
4014
4167
|
*/
|
|
4015
|
-
metadata:
|
|
4168
|
+
metadata: z18.any().nullish(),
|
|
4016
4169
|
/**
|
|
4017
4170
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
4018
4171
|
*/
|
|
4019
|
-
parallelToolCalls:
|
|
4172
|
+
parallelToolCalls: z18.boolean().nullish(),
|
|
4020
4173
|
/**
|
|
4021
4174
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
4022
4175
|
* Defaults to `undefined`.
|
|
4023
4176
|
*/
|
|
4024
|
-
previousResponseId:
|
|
4177
|
+
previousResponseId: z18.string().nullish(),
|
|
4025
4178
|
/**
|
|
4026
4179
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
4027
4180
|
*/
|
|
4028
|
-
promptCacheKey:
|
|
4181
|
+
promptCacheKey: z18.string().nullish(),
|
|
4029
4182
|
/**
|
|
4030
4183
|
* The retention policy for the prompt cache.
|
|
4031
4184
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -4034,7 +4187,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4034
4187
|
*
|
|
4035
4188
|
* @default 'in_memory'
|
|
4036
4189
|
*/
|
|
4037
|
-
promptCacheRetention:
|
|
4190
|
+
promptCacheRetention: z18.enum(["in_memory", "24h"]).nullish(),
|
|
4038
4191
|
/**
|
|
4039
4192
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
4040
4193
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -4045,17 +4198,17 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4045
4198
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
4046
4199
|
* an error.
|
|
4047
4200
|
*/
|
|
4048
|
-
reasoningEffort:
|
|
4201
|
+
reasoningEffort: z18.string().nullish(),
|
|
4049
4202
|
/**
|
|
4050
4203
|
* Controls reasoning summary output from the model.
|
|
4051
4204
|
* Set to "auto" to automatically receive the richest level available,
|
|
4052
4205
|
* or "detailed" for comprehensive summaries.
|
|
4053
4206
|
*/
|
|
4054
|
-
reasoningSummary:
|
|
4207
|
+
reasoningSummary: z18.string().nullish(),
|
|
4055
4208
|
/**
|
|
4056
4209
|
* The identifier for safety monitoring and tracking.
|
|
4057
4210
|
*/
|
|
4058
|
-
safetyIdentifier:
|
|
4211
|
+
safetyIdentifier: z18.string().nullish(),
|
|
4059
4212
|
/**
|
|
4060
4213
|
* Service tier for the request.
|
|
4061
4214
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -4063,34 +4216,34 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4063
4216
|
*
|
|
4064
4217
|
* Defaults to 'auto'.
|
|
4065
4218
|
*/
|
|
4066
|
-
serviceTier:
|
|
4219
|
+
serviceTier: z18.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
4067
4220
|
/**
|
|
4068
4221
|
* Whether to store the generation. Defaults to `true`.
|
|
4069
4222
|
*/
|
|
4070
|
-
store:
|
|
4223
|
+
store: z18.boolean().nullish(),
|
|
4071
4224
|
/**
|
|
4072
4225
|
* Whether to use strict JSON schema validation.
|
|
4073
4226
|
* Defaults to `true`.
|
|
4074
4227
|
*/
|
|
4075
|
-
strictJsonSchema:
|
|
4228
|
+
strictJsonSchema: z18.boolean().nullish(),
|
|
4076
4229
|
/**
|
|
4077
4230
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
4078
4231
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
4079
4232
|
* Valid values: 'low', 'medium', 'high'.
|
|
4080
4233
|
*/
|
|
4081
|
-
textVerbosity:
|
|
4234
|
+
textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
|
|
4082
4235
|
/**
|
|
4083
4236
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
4084
4237
|
* 'disabled' turns truncation off.
|
|
4085
4238
|
*/
|
|
4086
|
-
truncation:
|
|
4239
|
+
truncation: z18.enum(["auto", "disabled"]).nullish(),
|
|
4087
4240
|
/**
|
|
4088
4241
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
4089
4242
|
* monitor and detect abuse.
|
|
4090
4243
|
* Defaults to `undefined`.
|
|
4091
4244
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
4092
4245
|
*/
|
|
4093
|
-
user:
|
|
4246
|
+
user: z18.string().nullish(),
|
|
4094
4247
|
/**
|
|
4095
4248
|
* Override the system message mode for this model.
|
|
4096
4249
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -4099,7 +4252,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4099
4252
|
*
|
|
4100
4253
|
* If not specified, the mode is automatically determined based on the model.
|
|
4101
4254
|
*/
|
|
4102
|
-
systemMessageMode:
|
|
4255
|
+
systemMessageMode: z18.enum(["system", "developer", "remove"]).optional(),
|
|
4103
4256
|
/**
|
|
4104
4257
|
* Force treating this model as a reasoning model.
|
|
4105
4258
|
*
|
|
@@ -4109,7 +4262,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema15(
|
|
|
4109
4262
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4110
4263
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4111
4264
|
*/
|
|
4112
|
-
forceReasoning:
|
|
4265
|
+
forceReasoning: z18.boolean().optional()
|
|
4113
4266
|
})
|
|
4114
4267
|
)
|
|
4115
4268
|
);
|
|
@@ -4122,44 +4275,44 @@ import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
|
|
|
4122
4275
|
|
|
4123
4276
|
// src/tool/code-interpreter.ts
|
|
4124
4277
|
import {
|
|
4125
|
-
createProviderToolFactoryWithOutputSchema as
|
|
4126
|
-
lazySchema as
|
|
4127
|
-
zodSchema as
|
|
4278
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
4279
|
+
lazySchema as lazySchema17,
|
|
4280
|
+
zodSchema as zodSchema17
|
|
4128
4281
|
} from "@ai-sdk/provider-utils";
|
|
4129
|
-
import { z as
|
|
4130
|
-
var codeInterpreterInputSchema =
|
|
4131
|
-
() =>
|
|
4132
|
-
|
|
4133
|
-
code:
|
|
4134
|
-
containerId:
|
|
4282
|
+
import { z as z19 } from "zod/v4";
|
|
4283
|
+
var codeInterpreterInputSchema = lazySchema17(
|
|
4284
|
+
() => zodSchema17(
|
|
4285
|
+
z19.object({
|
|
4286
|
+
code: z19.string().nullish(),
|
|
4287
|
+
containerId: z19.string()
|
|
4135
4288
|
})
|
|
4136
4289
|
)
|
|
4137
4290
|
);
|
|
4138
|
-
var codeInterpreterOutputSchema =
|
|
4139
|
-
() =>
|
|
4140
|
-
|
|
4141
|
-
outputs:
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4291
|
+
var codeInterpreterOutputSchema = lazySchema17(
|
|
4292
|
+
() => zodSchema17(
|
|
4293
|
+
z19.object({
|
|
4294
|
+
outputs: z19.array(
|
|
4295
|
+
z19.discriminatedUnion("type", [
|
|
4296
|
+
z19.object({ type: z19.literal("logs"), logs: z19.string() }),
|
|
4297
|
+
z19.object({ type: z19.literal("image"), url: z19.string() })
|
|
4145
4298
|
])
|
|
4146
4299
|
).nullish()
|
|
4147
4300
|
})
|
|
4148
4301
|
)
|
|
4149
4302
|
);
|
|
4150
|
-
var codeInterpreterArgsSchema =
|
|
4151
|
-
() =>
|
|
4152
|
-
|
|
4153
|
-
container:
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
fileIds:
|
|
4303
|
+
var codeInterpreterArgsSchema = lazySchema17(
|
|
4304
|
+
() => zodSchema17(
|
|
4305
|
+
z19.object({
|
|
4306
|
+
container: z19.union([
|
|
4307
|
+
z19.string(),
|
|
4308
|
+
z19.object({
|
|
4309
|
+
fileIds: z19.array(z19.string()).optional()
|
|
4157
4310
|
})
|
|
4158
4311
|
]).optional()
|
|
4159
4312
|
})
|
|
4160
4313
|
)
|
|
4161
4314
|
);
|
|
4162
|
-
var codeInterpreterToolFactory =
|
|
4315
|
+
var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema5({
|
|
4163
4316
|
id: "openai.code_interpreter",
|
|
4164
4317
|
inputSchema: codeInterpreterInputSchema,
|
|
4165
4318
|
outputSchema: codeInterpreterOutputSchema
|
|
@@ -4170,88 +4323,88 @@ var codeInterpreter = (args = {}) => {
|
|
|
4170
4323
|
|
|
4171
4324
|
// src/tool/file-search.ts
|
|
4172
4325
|
import {
|
|
4173
|
-
createProviderToolFactoryWithOutputSchema as
|
|
4174
|
-
lazySchema as
|
|
4175
|
-
zodSchema as
|
|
4326
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
4327
|
+
lazySchema as lazySchema18,
|
|
4328
|
+
zodSchema as zodSchema18
|
|
4176
4329
|
} from "@ai-sdk/provider-utils";
|
|
4177
|
-
import { z as
|
|
4178
|
-
var comparisonFilterSchema =
|
|
4179
|
-
key:
|
|
4180
|
-
type:
|
|
4181
|
-
value:
|
|
4330
|
+
import { z as z20 } from "zod/v4";
|
|
4331
|
+
var comparisonFilterSchema = z20.object({
|
|
4332
|
+
key: z20.string(),
|
|
4333
|
+
type: z20.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
4334
|
+
value: z20.union([z20.string(), z20.number(), z20.boolean(), z20.array(z20.string())])
|
|
4182
4335
|
});
|
|
4183
|
-
var compoundFilterSchema =
|
|
4184
|
-
type:
|
|
4185
|
-
filters:
|
|
4186
|
-
|
|
4336
|
+
var compoundFilterSchema = z20.object({
|
|
4337
|
+
type: z20.enum(["and", "or"]),
|
|
4338
|
+
filters: z20.array(
|
|
4339
|
+
z20.union([comparisonFilterSchema, z20.lazy(() => compoundFilterSchema)])
|
|
4187
4340
|
)
|
|
4188
4341
|
});
|
|
4189
|
-
var fileSearchArgsSchema =
|
|
4190
|
-
() =>
|
|
4191
|
-
|
|
4192
|
-
vectorStoreIds:
|
|
4193
|
-
maxNumResults:
|
|
4194
|
-
ranking:
|
|
4195
|
-
ranker:
|
|
4196
|
-
scoreThreshold:
|
|
4342
|
+
var fileSearchArgsSchema = lazySchema18(
|
|
4343
|
+
() => zodSchema18(
|
|
4344
|
+
z20.object({
|
|
4345
|
+
vectorStoreIds: z20.array(z20.string()),
|
|
4346
|
+
maxNumResults: z20.number().optional(),
|
|
4347
|
+
ranking: z20.object({
|
|
4348
|
+
ranker: z20.string().optional(),
|
|
4349
|
+
scoreThreshold: z20.number().optional()
|
|
4197
4350
|
}).optional(),
|
|
4198
|
-
filters:
|
|
4351
|
+
filters: z20.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
4199
4352
|
})
|
|
4200
4353
|
)
|
|
4201
4354
|
);
|
|
4202
|
-
var fileSearchOutputSchema =
|
|
4203
|
-
() =>
|
|
4204
|
-
|
|
4205
|
-
queries:
|
|
4206
|
-
results:
|
|
4207
|
-
|
|
4208
|
-
attributes:
|
|
4209
|
-
fileId:
|
|
4210
|
-
filename:
|
|
4211
|
-
score:
|
|
4212
|
-
text:
|
|
4355
|
+
var fileSearchOutputSchema = lazySchema18(
|
|
4356
|
+
() => zodSchema18(
|
|
4357
|
+
z20.object({
|
|
4358
|
+
queries: z20.array(z20.string()),
|
|
4359
|
+
results: z20.array(
|
|
4360
|
+
z20.object({
|
|
4361
|
+
attributes: z20.record(z20.string(), z20.unknown()),
|
|
4362
|
+
fileId: z20.string(),
|
|
4363
|
+
filename: z20.string(),
|
|
4364
|
+
score: z20.number(),
|
|
4365
|
+
text: z20.string()
|
|
4213
4366
|
})
|
|
4214
4367
|
).nullable()
|
|
4215
4368
|
})
|
|
4216
4369
|
)
|
|
4217
4370
|
);
|
|
4218
|
-
var fileSearch =
|
|
4371
|
+
var fileSearch = createProviderToolFactoryWithOutputSchema6({
|
|
4219
4372
|
id: "openai.file_search",
|
|
4220
|
-
inputSchema:
|
|
4373
|
+
inputSchema: z20.object({}),
|
|
4221
4374
|
outputSchema: fileSearchOutputSchema
|
|
4222
4375
|
});
|
|
4223
4376
|
|
|
4224
4377
|
// src/tool/image-generation.ts
|
|
4225
4378
|
import {
|
|
4226
|
-
createProviderToolFactoryWithOutputSchema as
|
|
4227
|
-
lazySchema as
|
|
4228
|
-
zodSchema as
|
|
4379
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
4380
|
+
lazySchema as lazySchema19,
|
|
4381
|
+
zodSchema as zodSchema19
|
|
4229
4382
|
} from "@ai-sdk/provider-utils";
|
|
4230
|
-
import { z as
|
|
4231
|
-
var imageGenerationArgsSchema =
|
|
4232
|
-
() =>
|
|
4233
|
-
|
|
4234
|
-
background:
|
|
4235
|
-
inputFidelity:
|
|
4236
|
-
inputImageMask:
|
|
4237
|
-
fileId:
|
|
4238
|
-
imageUrl:
|
|
4383
|
+
import { z as z21 } from "zod/v4";
|
|
4384
|
+
var imageGenerationArgsSchema = lazySchema19(
|
|
4385
|
+
() => zodSchema19(
|
|
4386
|
+
z21.object({
|
|
4387
|
+
background: z21.enum(["auto", "opaque", "transparent"]).optional(),
|
|
4388
|
+
inputFidelity: z21.enum(["low", "high"]).optional(),
|
|
4389
|
+
inputImageMask: z21.object({
|
|
4390
|
+
fileId: z21.string().optional(),
|
|
4391
|
+
imageUrl: z21.string().optional()
|
|
4239
4392
|
}).optional(),
|
|
4240
|
-
model:
|
|
4241
|
-
moderation:
|
|
4242
|
-
outputCompression:
|
|
4243
|
-
outputFormat:
|
|
4244
|
-
partialImages:
|
|
4245
|
-
quality:
|
|
4246
|
-
size:
|
|
4393
|
+
model: z21.string().optional(),
|
|
4394
|
+
moderation: z21.enum(["auto"]).optional(),
|
|
4395
|
+
outputCompression: z21.number().int().min(0).max(100).optional(),
|
|
4396
|
+
outputFormat: z21.enum(["png", "jpeg", "webp"]).optional(),
|
|
4397
|
+
partialImages: z21.number().int().min(0).max(3).optional(),
|
|
4398
|
+
quality: z21.enum(["auto", "low", "medium", "high"]).optional(),
|
|
4399
|
+
size: z21.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
4247
4400
|
}).strict()
|
|
4248
4401
|
)
|
|
4249
4402
|
);
|
|
4250
|
-
var imageGenerationInputSchema =
|
|
4251
|
-
var imageGenerationOutputSchema =
|
|
4252
|
-
() =>
|
|
4403
|
+
var imageGenerationInputSchema = lazySchema19(() => zodSchema19(z21.object({})));
|
|
4404
|
+
var imageGenerationOutputSchema = lazySchema19(
|
|
4405
|
+
() => zodSchema19(z21.object({ result: z21.string() }))
|
|
4253
4406
|
);
|
|
4254
|
-
var imageGenerationToolFactory =
|
|
4407
|
+
var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema7({
|
|
4255
4408
|
id: "openai.image_generation",
|
|
4256
4409
|
inputSchema: imageGenerationInputSchema,
|
|
4257
4410
|
outputSchema: imageGenerationOutputSchema
|
|
@@ -4263,29 +4416,29 @@ var imageGeneration = (args = {}) => {
|
|
|
4263
4416
|
// src/tool/custom.ts
|
|
4264
4417
|
import {
|
|
4265
4418
|
createProviderToolFactory,
|
|
4266
|
-
lazySchema as
|
|
4267
|
-
zodSchema as
|
|
4419
|
+
lazySchema as lazySchema20,
|
|
4420
|
+
zodSchema as zodSchema20
|
|
4268
4421
|
} from "@ai-sdk/provider-utils";
|
|
4269
|
-
import { z as
|
|
4270
|
-
var customArgsSchema =
|
|
4271
|
-
() =>
|
|
4272
|
-
|
|
4273
|
-
name:
|
|
4274
|
-
description:
|
|
4275
|
-
format:
|
|
4276
|
-
|
|
4277
|
-
type:
|
|
4278
|
-
syntax:
|
|
4279
|
-
definition:
|
|
4422
|
+
import { z as z22 } from "zod/v4";
|
|
4423
|
+
var customArgsSchema = lazySchema20(
|
|
4424
|
+
() => zodSchema20(
|
|
4425
|
+
z22.object({
|
|
4426
|
+
name: z22.string(),
|
|
4427
|
+
description: z22.string().optional(),
|
|
4428
|
+
format: z22.union([
|
|
4429
|
+
z22.object({
|
|
4430
|
+
type: z22.literal("grammar"),
|
|
4431
|
+
syntax: z22.enum(["regex", "lark"]),
|
|
4432
|
+
definition: z22.string()
|
|
4280
4433
|
}),
|
|
4281
|
-
|
|
4282
|
-
type:
|
|
4434
|
+
z22.object({
|
|
4435
|
+
type: z22.literal("text")
|
|
4283
4436
|
})
|
|
4284
4437
|
]).optional()
|
|
4285
4438
|
})
|
|
4286
4439
|
)
|
|
4287
4440
|
);
|
|
4288
|
-
var customInputSchema =
|
|
4441
|
+
var customInputSchema = lazySchema20(() => zodSchema20(z22.string()));
|
|
4289
4442
|
var customToolFactory = createProviderToolFactory({
|
|
4290
4443
|
id: "openai.custom",
|
|
4291
4444
|
inputSchema: customInputSchema
|
|
@@ -4293,137 +4446,82 @@ var customToolFactory = createProviderToolFactory({
|
|
|
4293
4446
|
|
|
4294
4447
|
// src/tool/mcp.ts
|
|
4295
4448
|
import {
|
|
4296
|
-
createProviderToolFactoryWithOutputSchema as
|
|
4297
|
-
lazySchema as
|
|
4298
|
-
zodSchema as
|
|
4449
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
4450
|
+
lazySchema as lazySchema21,
|
|
4451
|
+
zodSchema as zodSchema21
|
|
4299
4452
|
} from "@ai-sdk/provider-utils";
|
|
4300
|
-
import { z as
|
|
4301
|
-
var
|
|
4302
|
-
() =>
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4453
|
+
import { z as z23 } from "zod/v4";
|
|
4454
|
+
var jsonValueSchema2 = z23.lazy(
|
|
4455
|
+
() => z23.union([
|
|
4456
|
+
z23.string(),
|
|
4457
|
+
z23.number(),
|
|
4458
|
+
z23.boolean(),
|
|
4459
|
+
z23.null(),
|
|
4460
|
+
z23.array(jsonValueSchema2),
|
|
4461
|
+
z23.record(z23.string(), jsonValueSchema2)
|
|
4309
4462
|
])
|
|
4310
4463
|
);
|
|
4311
|
-
var mcpArgsSchema =
|
|
4312
|
-
() =>
|
|
4313
|
-
|
|
4314
|
-
serverLabel:
|
|
4315
|
-
allowedTools:
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
readOnly:
|
|
4319
|
-
toolNames:
|
|
4464
|
+
var mcpArgsSchema = lazySchema21(
|
|
4465
|
+
() => zodSchema21(
|
|
4466
|
+
z23.object({
|
|
4467
|
+
serverLabel: z23.string(),
|
|
4468
|
+
allowedTools: z23.union([
|
|
4469
|
+
z23.array(z23.string()),
|
|
4470
|
+
z23.object({
|
|
4471
|
+
readOnly: z23.boolean().optional(),
|
|
4472
|
+
toolNames: z23.array(z23.string()).optional()
|
|
4320
4473
|
})
|
|
4321
4474
|
]).optional(),
|
|
4322
|
-
authorization:
|
|
4323
|
-
connectorId:
|
|
4324
|
-
headers:
|
|
4325
|
-
requireApproval:
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
never:
|
|
4329
|
-
toolNames:
|
|
4475
|
+
authorization: z23.string().optional(),
|
|
4476
|
+
connectorId: z23.string().optional(),
|
|
4477
|
+
headers: z23.record(z23.string(), z23.string()).optional(),
|
|
4478
|
+
requireApproval: z23.union([
|
|
4479
|
+
z23.enum(["always", "never"]),
|
|
4480
|
+
z23.object({
|
|
4481
|
+
never: z23.object({
|
|
4482
|
+
toolNames: z23.array(z23.string()).optional()
|
|
4330
4483
|
}).optional()
|
|
4331
4484
|
})
|
|
4332
4485
|
]).optional(),
|
|
4333
|
-
serverDescription:
|
|
4334
|
-
serverUrl:
|
|
4486
|
+
serverDescription: z23.string().optional(),
|
|
4487
|
+
serverUrl: z23.string().optional()
|
|
4335
4488
|
}).refine(
|
|
4336
4489
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
4337
4490
|
"One of serverUrl or connectorId must be provided."
|
|
4338
4491
|
)
|
|
4339
4492
|
)
|
|
4340
4493
|
);
|
|
4341
|
-
var mcpInputSchema =
|
|
4342
|
-
var mcpOutputSchema =
|
|
4343
|
-
() =>
|
|
4344
|
-
|
|
4345
|
-
type:
|
|
4346
|
-
serverLabel:
|
|
4347
|
-
name:
|
|
4348
|
-
arguments:
|
|
4349
|
-
output:
|
|
4350
|
-
error:
|
|
4494
|
+
var mcpInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
|
|
4495
|
+
var mcpOutputSchema = lazySchema21(
|
|
4496
|
+
() => zodSchema21(
|
|
4497
|
+
z23.object({
|
|
4498
|
+
type: z23.literal("call"),
|
|
4499
|
+
serverLabel: z23.string(),
|
|
4500
|
+
name: z23.string(),
|
|
4501
|
+
arguments: z23.string(),
|
|
4502
|
+
output: z23.string().nullish(),
|
|
4503
|
+
error: z23.union([z23.string(), jsonValueSchema2]).optional()
|
|
4351
4504
|
})
|
|
4352
4505
|
)
|
|
4353
4506
|
);
|
|
4354
|
-
var mcpToolFactory =
|
|
4507
|
+
var mcpToolFactory = createProviderToolFactoryWithOutputSchema8({
|
|
4355
4508
|
id: "openai.mcp",
|
|
4356
4509
|
inputSchema: mcpInputSchema,
|
|
4357
4510
|
outputSchema: mcpOutputSchema
|
|
4358
4511
|
});
|
|
4359
4512
|
|
|
4360
4513
|
// src/tool/web-search.ts
|
|
4361
|
-
import {
|
|
4362
|
-
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
4363
|
-
lazySchema as lazySchema21,
|
|
4364
|
-
zodSchema as zodSchema21
|
|
4365
|
-
} from "@ai-sdk/provider-utils";
|
|
4366
|
-
import { z as z23 } from "zod/v4";
|
|
4367
|
-
var webSearchArgsSchema = lazySchema21(
|
|
4368
|
-
() => zodSchema21(
|
|
4369
|
-
z23.object({
|
|
4370
|
-
externalWebAccess: z23.boolean().optional(),
|
|
4371
|
-
filters: z23.object({ allowedDomains: z23.array(z23.string()).optional() }).optional(),
|
|
4372
|
-
searchContextSize: z23.enum(["low", "medium", "high"]).optional(),
|
|
4373
|
-
userLocation: z23.object({
|
|
4374
|
-
type: z23.literal("approximate"),
|
|
4375
|
-
country: z23.string().optional(),
|
|
4376
|
-
city: z23.string().optional(),
|
|
4377
|
-
region: z23.string().optional(),
|
|
4378
|
-
timezone: z23.string().optional()
|
|
4379
|
-
}).optional()
|
|
4380
|
-
})
|
|
4381
|
-
)
|
|
4382
|
-
);
|
|
4383
|
-
var webSearchInputSchema = lazySchema21(() => zodSchema21(z23.object({})));
|
|
4384
|
-
var webSearchOutputSchema = lazySchema21(
|
|
4385
|
-
() => zodSchema21(
|
|
4386
|
-
z23.object({
|
|
4387
|
-
action: z23.discriminatedUnion("type", [
|
|
4388
|
-
z23.object({
|
|
4389
|
-
type: z23.literal("search"),
|
|
4390
|
-
query: z23.string().optional()
|
|
4391
|
-
}),
|
|
4392
|
-
z23.object({
|
|
4393
|
-
type: z23.literal("openPage"),
|
|
4394
|
-
url: z23.string().nullish()
|
|
4395
|
-
}),
|
|
4396
|
-
z23.object({
|
|
4397
|
-
type: z23.literal("findInPage"),
|
|
4398
|
-
url: z23.string().nullish(),
|
|
4399
|
-
pattern: z23.string().nullish()
|
|
4400
|
-
})
|
|
4401
|
-
]).optional(),
|
|
4402
|
-
sources: z23.array(
|
|
4403
|
-
z23.discriminatedUnion("type", [
|
|
4404
|
-
z23.object({ type: z23.literal("url"), url: z23.string() }),
|
|
4405
|
-
z23.object({ type: z23.literal("api"), name: z23.string() })
|
|
4406
|
-
])
|
|
4407
|
-
).optional()
|
|
4408
|
-
})
|
|
4409
|
-
)
|
|
4410
|
-
);
|
|
4411
|
-
var webSearchToolFactory = createProviderToolFactoryWithOutputSchema8({
|
|
4412
|
-
id: "openai.web_search",
|
|
4413
|
-
inputSchema: webSearchInputSchema,
|
|
4414
|
-
outputSchema: webSearchOutputSchema
|
|
4415
|
-
});
|
|
4416
|
-
|
|
4417
|
-
// src/tool/web-search-preview.ts
|
|
4418
4514
|
import {
|
|
4419
4515
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
4420
4516
|
lazySchema as lazySchema22,
|
|
4421
4517
|
zodSchema as zodSchema22
|
|
4422
4518
|
} from "@ai-sdk/provider-utils";
|
|
4423
4519
|
import { z as z24 } from "zod/v4";
|
|
4424
|
-
var
|
|
4520
|
+
var webSearchArgsSchema = lazySchema22(
|
|
4425
4521
|
() => zodSchema22(
|
|
4426
4522
|
z24.object({
|
|
4523
|
+
externalWebAccess: z24.boolean().optional(),
|
|
4524
|
+
filters: z24.object({ allowedDomains: z24.array(z24.string()).optional() }).optional(),
|
|
4427
4525
|
searchContextSize: z24.enum(["low", "medium", "high"]).optional(),
|
|
4428
4526
|
userLocation: z24.object({
|
|
4429
4527
|
type: z24.literal("approximate"),
|
|
@@ -4435,10 +4533,8 @@ var webSearchPreviewArgsSchema = lazySchema22(
|
|
|
4435
4533
|
})
|
|
4436
4534
|
)
|
|
4437
4535
|
);
|
|
4438
|
-
var
|
|
4439
|
-
|
|
4440
|
-
);
|
|
4441
|
-
var webSearchPreviewOutputSchema = lazySchema22(
|
|
4536
|
+
var webSearchInputSchema = lazySchema22(() => zodSchema22(z24.object({})));
|
|
4537
|
+
var webSearchOutputSchema = lazySchema22(
|
|
4442
4538
|
() => zodSchema22(
|
|
4443
4539
|
z24.object({
|
|
4444
4540
|
action: z24.discriminatedUnion("type", [
|
|
@@ -4455,11 +4551,68 @@ var webSearchPreviewOutputSchema = lazySchema22(
|
|
|
4455
4551
|
url: z24.string().nullish(),
|
|
4456
4552
|
pattern: z24.string().nullish()
|
|
4457
4553
|
})
|
|
4554
|
+
]).optional(),
|
|
4555
|
+
sources: z24.array(
|
|
4556
|
+
z24.discriminatedUnion("type", [
|
|
4557
|
+
z24.object({ type: z24.literal("url"), url: z24.string() }),
|
|
4558
|
+
z24.object({ type: z24.literal("api"), name: z24.string() })
|
|
4559
|
+
])
|
|
4560
|
+
).optional()
|
|
4561
|
+
})
|
|
4562
|
+
)
|
|
4563
|
+
);
|
|
4564
|
+
var webSearchToolFactory = createProviderToolFactoryWithOutputSchema9({
|
|
4565
|
+
id: "openai.web_search",
|
|
4566
|
+
inputSchema: webSearchInputSchema,
|
|
4567
|
+
outputSchema: webSearchOutputSchema
|
|
4568
|
+
});
|
|
4569
|
+
|
|
4570
|
+
// src/tool/web-search-preview.ts
|
|
4571
|
+
import {
|
|
4572
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
|
|
4573
|
+
lazySchema as lazySchema23,
|
|
4574
|
+
zodSchema as zodSchema23
|
|
4575
|
+
} from "@ai-sdk/provider-utils";
|
|
4576
|
+
import { z as z25 } from "zod/v4";
|
|
4577
|
+
var webSearchPreviewArgsSchema = lazySchema23(
|
|
4578
|
+
() => zodSchema23(
|
|
4579
|
+
z25.object({
|
|
4580
|
+
searchContextSize: z25.enum(["low", "medium", "high"]).optional(),
|
|
4581
|
+
userLocation: z25.object({
|
|
4582
|
+
type: z25.literal("approximate"),
|
|
4583
|
+
country: z25.string().optional(),
|
|
4584
|
+
city: z25.string().optional(),
|
|
4585
|
+
region: z25.string().optional(),
|
|
4586
|
+
timezone: z25.string().optional()
|
|
4587
|
+
}).optional()
|
|
4588
|
+
})
|
|
4589
|
+
)
|
|
4590
|
+
);
|
|
4591
|
+
var webSearchPreviewInputSchema = lazySchema23(
|
|
4592
|
+
() => zodSchema23(z25.object({}))
|
|
4593
|
+
);
|
|
4594
|
+
var webSearchPreviewOutputSchema = lazySchema23(
|
|
4595
|
+
() => zodSchema23(
|
|
4596
|
+
z25.object({
|
|
4597
|
+
action: z25.discriminatedUnion("type", [
|
|
4598
|
+
z25.object({
|
|
4599
|
+
type: z25.literal("search"),
|
|
4600
|
+
query: z25.string().optional()
|
|
4601
|
+
}),
|
|
4602
|
+
z25.object({
|
|
4603
|
+
type: z25.literal("openPage"),
|
|
4604
|
+
url: z25.string().nullish()
|
|
4605
|
+
}),
|
|
4606
|
+
z25.object({
|
|
4607
|
+
type: z25.literal("findInPage"),
|
|
4608
|
+
url: z25.string().nullish(),
|
|
4609
|
+
pattern: z25.string().nullish()
|
|
4610
|
+
})
|
|
4458
4611
|
]).optional()
|
|
4459
4612
|
})
|
|
4460
4613
|
)
|
|
4461
4614
|
);
|
|
4462
|
-
var webSearchPreview =
|
|
4615
|
+
var webSearchPreview = createProviderToolFactoryWithOutputSchema10({
|
|
4463
4616
|
id: "openai.web_search_preview",
|
|
4464
4617
|
inputSchema: webSearchPreviewInputSchema,
|
|
4465
4618
|
outputSchema: webSearchPreviewOutputSchema
|
|
@@ -4472,7 +4625,7 @@ async function prepareResponsesTools({
|
|
|
4472
4625
|
toolNameMapping,
|
|
4473
4626
|
customProviderToolNames
|
|
4474
4627
|
}) {
|
|
4475
|
-
var _a;
|
|
4628
|
+
var _a, _b;
|
|
4476
4629
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
4477
4630
|
const toolWarnings = [];
|
|
4478
4631
|
if (tools == null) {
|
|
@@ -4482,15 +4635,19 @@ async function prepareResponsesTools({
|
|
|
4482
4635
|
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
4483
4636
|
for (const tool of tools) {
|
|
4484
4637
|
switch (tool.type) {
|
|
4485
|
-
case "function":
|
|
4638
|
+
case "function": {
|
|
4639
|
+
const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
|
|
4640
|
+
const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
|
|
4486
4641
|
openaiTools.push({
|
|
4487
4642
|
type: "function",
|
|
4488
4643
|
name: tool.name,
|
|
4489
4644
|
description: tool.description,
|
|
4490
4645
|
parameters: tool.inputSchema,
|
|
4491
|
-
...tool.strict != null ? { strict: tool.strict } : {}
|
|
4646
|
+
...tool.strict != null ? { strict: tool.strict } : {},
|
|
4647
|
+
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
4492
4648
|
});
|
|
4493
4649
|
break;
|
|
4650
|
+
}
|
|
4494
4651
|
case "provider": {
|
|
4495
4652
|
switch (tool.id) {
|
|
4496
4653
|
case "openai.file_search": {
|
|
@@ -4635,6 +4792,19 @@ async function prepareResponsesTools({
|
|
|
4635
4792
|
resolvedCustomProviderToolNames.add(args.name);
|
|
4636
4793
|
break;
|
|
4637
4794
|
}
|
|
4795
|
+
case "openai.tool_search": {
|
|
4796
|
+
const args = await validateTypes2({
|
|
4797
|
+
value: tool.args,
|
|
4798
|
+
schema: toolSearchArgsSchema
|
|
4799
|
+
});
|
|
4800
|
+
openaiTools.push({
|
|
4801
|
+
type: "tool_search",
|
|
4802
|
+
...args.execution != null ? { execution: args.execution } : {},
|
|
4803
|
+
...args.description != null ? { description: args.description } : {},
|
|
4804
|
+
...args.parameters != null ? { parameters: args.parameters } : {}
|
|
4805
|
+
});
|
|
4806
|
+
break;
|
|
4807
|
+
}
|
|
4638
4808
|
}
|
|
4639
4809
|
break;
|
|
4640
4810
|
}
|
|
@@ -4656,7 +4826,7 @@ async function prepareResponsesTools({
|
|
|
4656
4826
|
case "required":
|
|
4657
4827
|
return { tools: openaiTools, toolChoice: type, toolWarnings };
|
|
4658
4828
|
case "tool": {
|
|
4659
|
-
const resolvedToolName = (
|
|
4829
|
+
const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
|
|
4660
4830
|
return {
|
|
4661
4831
|
tools: openaiTools,
|
|
4662
4832
|
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 },
|
|
@@ -4812,7 +4982,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4812
4982
|
"openai.web_search": "web_search",
|
|
4813
4983
|
"openai.web_search_preview": "web_search_preview",
|
|
4814
4984
|
"openai.mcp": "mcp",
|
|
4815
|
-
"openai.apply_patch": "apply_patch"
|
|
4985
|
+
"openai.apply_patch": "apply_patch",
|
|
4986
|
+
"openai.tool_search": "tool_search"
|
|
4816
4987
|
},
|
|
4817
4988
|
resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
|
|
4818
4989
|
});
|
|
@@ -4990,7 +5161,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4990
5161
|
};
|
|
4991
5162
|
}
|
|
4992
5163
|
async doGenerate(options) {
|
|
4993
|
-
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;
|
|
5164
|
+
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;
|
|
4994
5165
|
const {
|
|
4995
5166
|
args: body,
|
|
4996
5167
|
warnings,
|
|
@@ -5033,6 +5204,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5033
5204
|
const content = [];
|
|
5034
5205
|
const logprobs = [];
|
|
5035
5206
|
let hasFunctionCall = false;
|
|
5207
|
+
const hostedToolSearchCallIds = [];
|
|
5036
5208
|
for (const part of response.output) {
|
|
5037
5209
|
switch (part.type) {
|
|
5038
5210
|
case "reasoning": {
|
|
@@ -5071,6 +5243,46 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5071
5243
|
});
|
|
5072
5244
|
break;
|
|
5073
5245
|
}
|
|
5246
|
+
case "tool_search_call": {
|
|
5247
|
+
const toolCallId = (_b = part.call_id) != null ? _b : part.id;
|
|
5248
|
+
const isHosted = part.execution === "server";
|
|
5249
|
+
if (isHosted) {
|
|
5250
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5251
|
+
}
|
|
5252
|
+
content.push({
|
|
5253
|
+
type: "tool-call",
|
|
5254
|
+
toolCallId,
|
|
5255
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5256
|
+
input: JSON.stringify({
|
|
5257
|
+
arguments: part.arguments,
|
|
5258
|
+
call_id: part.call_id
|
|
5259
|
+
}),
|
|
5260
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5261
|
+
providerMetadata: {
|
|
5262
|
+
[providerOptionsName]: {
|
|
5263
|
+
itemId: part.id
|
|
5264
|
+
}
|
|
5265
|
+
}
|
|
5266
|
+
});
|
|
5267
|
+
break;
|
|
5268
|
+
}
|
|
5269
|
+
case "tool_search_output": {
|
|
5270
|
+
const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
|
|
5271
|
+
content.push({
|
|
5272
|
+
type: "tool-result",
|
|
5273
|
+
toolCallId,
|
|
5274
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5275
|
+
result: {
|
|
5276
|
+
tools: part.tools
|
|
5277
|
+
},
|
|
5278
|
+
providerMetadata: {
|
|
5279
|
+
[providerOptionsName]: {
|
|
5280
|
+
itemId: part.id
|
|
5281
|
+
}
|
|
5282
|
+
}
|
|
5283
|
+
});
|
|
5284
|
+
break;
|
|
5285
|
+
}
|
|
5074
5286
|
case "local_shell_call": {
|
|
5075
5287
|
content.push({
|
|
5076
5288
|
type: "tool-call",
|
|
@@ -5126,7 +5338,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5126
5338
|
}
|
|
5127
5339
|
case "message": {
|
|
5128
5340
|
for (const contentPart of part.content) {
|
|
5129
|
-
if (((
|
|
5341
|
+
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
|
|
5130
5342
|
logprobs.push(contentPart.logprobs);
|
|
5131
5343
|
}
|
|
5132
5344
|
const providerMetadata2 = {
|
|
@@ -5148,7 +5360,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5148
5360
|
content.push({
|
|
5149
5361
|
type: "source",
|
|
5150
5362
|
sourceType: "url",
|
|
5151
|
-
id: (
|
|
5363
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
|
|
5152
5364
|
url: annotation.url,
|
|
5153
5365
|
title: annotation.title
|
|
5154
5366
|
});
|
|
@@ -5156,7 +5368,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5156
5368
|
content.push({
|
|
5157
5369
|
type: "source",
|
|
5158
5370
|
sourceType: "document",
|
|
5159
|
-
id: (
|
|
5371
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
|
|
5160
5372
|
mediaType: "text/plain",
|
|
5161
5373
|
title: annotation.filename,
|
|
5162
5374
|
filename: annotation.filename,
|
|
@@ -5172,7 +5384,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5172
5384
|
content.push({
|
|
5173
5385
|
type: "source",
|
|
5174
5386
|
sourceType: "document",
|
|
5175
|
-
id: (
|
|
5387
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
|
|
5176
5388
|
mediaType: "text/plain",
|
|
5177
5389
|
title: annotation.filename,
|
|
5178
5390
|
filename: annotation.filename,
|
|
@@ -5188,7 +5400,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5188
5400
|
content.push({
|
|
5189
5401
|
type: "source",
|
|
5190
5402
|
sourceType: "document",
|
|
5191
|
-
id: (
|
|
5403
|
+
id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
|
|
5192
5404
|
mediaType: "application/octet-stream",
|
|
5193
5405
|
title: annotation.file_id,
|
|
5194
5406
|
filename: annotation.file_id,
|
|
@@ -5257,7 +5469,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5257
5469
|
break;
|
|
5258
5470
|
}
|
|
5259
5471
|
case "mcp_call": {
|
|
5260
|
-
const toolCallId = part.approval_request_id != null ? (
|
|
5472
|
+
const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
|
|
5261
5473
|
const toolName = `mcp.${part.name}`;
|
|
5262
5474
|
content.push({
|
|
5263
5475
|
type: "tool-call",
|
|
@@ -5291,8 +5503,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5291
5503
|
break;
|
|
5292
5504
|
}
|
|
5293
5505
|
case "mcp_approval_request": {
|
|
5294
|
-
const approvalRequestId = (
|
|
5295
|
-
const dummyToolCallId = (
|
|
5506
|
+
const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
|
|
5507
|
+
const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2();
|
|
5296
5508
|
const toolName = `mcp.${part.name}`;
|
|
5297
5509
|
content.push({
|
|
5298
5510
|
type: "tool-call",
|
|
@@ -5342,13 +5554,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5342
5554
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5343
5555
|
result: {
|
|
5344
5556
|
queries: part.queries,
|
|
5345
|
-
results: (
|
|
5557
|
+
results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
|
|
5346
5558
|
attributes: result.attributes,
|
|
5347
5559
|
fileId: result.file_id,
|
|
5348
5560
|
filename: result.filename,
|
|
5349
5561
|
score: result.score,
|
|
5350
5562
|
text: result.text
|
|
5351
|
-
}))) != null ?
|
|
5563
|
+
}))) != null ? _y : null
|
|
5352
5564
|
}
|
|
5353
5565
|
});
|
|
5354
5566
|
break;
|
|
@@ -5405,10 +5617,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5405
5617
|
content,
|
|
5406
5618
|
finishReason: {
|
|
5407
5619
|
unified: mapOpenAIResponseFinishReason({
|
|
5408
|
-
finishReason: (
|
|
5620
|
+
finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
|
|
5409
5621
|
hasFunctionCall
|
|
5410
5622
|
}),
|
|
5411
|
-
raw: (
|
|
5623
|
+
raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
|
|
5412
5624
|
},
|
|
5413
5625
|
usage: convertOpenAIResponsesUsage(usage),
|
|
5414
5626
|
request: { body },
|
|
@@ -5466,6 +5678,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5466
5678
|
let hasFunctionCall = false;
|
|
5467
5679
|
const activeReasoning = {};
|
|
5468
5680
|
let serviceTier;
|
|
5681
|
+
const hostedToolSearchCallIds = [];
|
|
5469
5682
|
return {
|
|
5470
5683
|
stream: response.pipeThrough(
|
|
5471
5684
|
new TransformStream({
|
|
@@ -5473,7 +5686,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5473
5686
|
controller.enqueue({ type: "stream-start", warnings });
|
|
5474
5687
|
},
|
|
5475
5688
|
transform(chunk, controller) {
|
|
5476
|
-
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;
|
|
5689
|
+
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;
|
|
5477
5690
|
if (options.includeRawChunks) {
|
|
5478
5691
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
5479
5692
|
}
|
|
@@ -5581,6 +5794,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5581
5794
|
input: "{}",
|
|
5582
5795
|
providerExecuted: true
|
|
5583
5796
|
});
|
|
5797
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5798
|
+
const toolCallId = value.item.id;
|
|
5799
|
+
const toolName = toolNameMapping.toCustomToolName("tool_search");
|
|
5800
|
+
const isHosted = value.item.execution === "server";
|
|
5801
|
+
ongoingToolCalls[value.output_index] = {
|
|
5802
|
+
toolName,
|
|
5803
|
+
toolCallId,
|
|
5804
|
+
toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
|
|
5805
|
+
};
|
|
5806
|
+
if (isHosted) {
|
|
5807
|
+
controller.enqueue({
|
|
5808
|
+
type: "tool-input-start",
|
|
5809
|
+
id: toolCallId,
|
|
5810
|
+
toolName,
|
|
5811
|
+
providerExecuted: true
|
|
5812
|
+
});
|
|
5813
|
+
}
|
|
5814
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5584
5815
|
} else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
|
|
5585
5816
|
} else if (value.item.type === "apply_patch_call") {
|
|
5586
5817
|
const { call_id: callId, operation } = value.item;
|
|
@@ -5627,7 +5858,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5627
5858
|
} else if (value.item.type === "shell_call_output") {
|
|
5628
5859
|
} else if (value.item.type === "message") {
|
|
5629
5860
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
5630
|
-
activeMessagePhase = (
|
|
5861
|
+
activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
|
|
5631
5862
|
controller.enqueue({
|
|
5632
5863
|
type: "text-start",
|
|
5633
5864
|
id: value.item.id,
|
|
@@ -5651,14 +5882,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5651
5882
|
providerMetadata: {
|
|
5652
5883
|
[providerOptionsName]: {
|
|
5653
5884
|
itemId: value.item.id,
|
|
5654
|
-
reasoningEncryptedContent: (
|
|
5885
|
+
reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
|
|
5655
5886
|
}
|
|
5656
5887
|
}
|
|
5657
5888
|
});
|
|
5658
5889
|
}
|
|
5659
5890
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
5660
5891
|
if (value.item.type === "message") {
|
|
5661
|
-
const phase = (
|
|
5892
|
+
const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
|
|
5662
5893
|
activeMessagePhase = void 0;
|
|
5663
5894
|
controller.enqueue({
|
|
5664
5895
|
type: "text-end",
|
|
@@ -5752,13 +5983,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5752
5983
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5753
5984
|
result: {
|
|
5754
5985
|
queries: value.item.queries,
|
|
5755
|
-
results: (
|
|
5986
|
+
results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
|
|
5756
5987
|
attributes: result.attributes,
|
|
5757
5988
|
fileId: result.file_id,
|
|
5758
5989
|
filename: result.filename,
|
|
5759
5990
|
score: result.score,
|
|
5760
5991
|
text: result.text
|
|
5761
|
-
}))) != null ?
|
|
5992
|
+
}))) != null ? _f : null
|
|
5762
5993
|
}
|
|
5763
5994
|
});
|
|
5764
5995
|
} else if (value.item.type === "code_interpreter_call") {
|
|
@@ -5780,12 +6011,62 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5780
6011
|
result: value.item.result
|
|
5781
6012
|
}
|
|
5782
6013
|
});
|
|
6014
|
+
} else if (value.item.type === "tool_search_call") {
|
|
6015
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
6016
|
+
const isHosted = value.item.execution === "server";
|
|
6017
|
+
if (toolCall != null) {
|
|
6018
|
+
const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
|
|
6019
|
+
if (isHosted) {
|
|
6020
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
6021
|
+
} else {
|
|
6022
|
+
controller.enqueue({
|
|
6023
|
+
type: "tool-input-start",
|
|
6024
|
+
id: toolCallId,
|
|
6025
|
+
toolName: toolCall.toolName
|
|
6026
|
+
});
|
|
6027
|
+
}
|
|
6028
|
+
controller.enqueue({
|
|
6029
|
+
type: "tool-input-end",
|
|
6030
|
+
id: toolCallId
|
|
6031
|
+
});
|
|
6032
|
+
controller.enqueue({
|
|
6033
|
+
type: "tool-call",
|
|
6034
|
+
toolCallId,
|
|
6035
|
+
toolName: toolCall.toolName,
|
|
6036
|
+
input: JSON.stringify({
|
|
6037
|
+
arguments: value.item.arguments,
|
|
6038
|
+
call_id: isHosted ? null : toolCallId
|
|
6039
|
+
}),
|
|
6040
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
6041
|
+
providerMetadata: {
|
|
6042
|
+
[providerOptionsName]: {
|
|
6043
|
+
itemId: value.item.id
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6046
|
+
});
|
|
6047
|
+
}
|
|
6048
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
6049
|
+
} else if (value.item.type === "tool_search_output") {
|
|
6050
|
+
const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
|
|
6051
|
+
controller.enqueue({
|
|
6052
|
+
type: "tool-result",
|
|
6053
|
+
toolCallId,
|
|
6054
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
6055
|
+
result: {
|
|
6056
|
+
tools: value.item.tools
|
|
6057
|
+
},
|
|
6058
|
+
providerMetadata: {
|
|
6059
|
+
[providerOptionsName]: {
|
|
6060
|
+
itemId: value.item.id
|
|
6061
|
+
}
|
|
6062
|
+
}
|
|
6063
|
+
});
|
|
5783
6064
|
} else if (value.item.type === "mcp_call") {
|
|
5784
6065
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5785
|
-
const approvalRequestId = (
|
|
5786
|
-
const aliasedToolCallId = approvalRequestId != null ? (
|
|
6066
|
+
const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
|
|
6067
|
+
const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
5787
6068
|
approvalRequestId
|
|
5788
|
-
)) != null ?
|
|
6069
|
+
)) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
|
|
5789
6070
|
const toolName = `mcp.${value.item.name}`;
|
|
5790
6071
|
controller.enqueue({
|
|
5791
6072
|
type: "tool-call",
|
|
@@ -5855,8 +6136,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5855
6136
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5856
6137
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5857
6138
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5858
|
-
const dummyToolCallId = (
|
|
5859
|
-
const approvalRequestId = (
|
|
6139
|
+
const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2();
|
|
6140
|
+
const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
|
|
5860
6141
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5861
6142
|
approvalRequestId,
|
|
5862
6143
|
dummyToolCallId
|
|
@@ -5945,7 +6226,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5945
6226
|
providerMetadata: {
|
|
5946
6227
|
[providerOptionsName]: {
|
|
5947
6228
|
itemId: value.item.id,
|
|
5948
|
-
reasoningEncryptedContent: (
|
|
6229
|
+
reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
|
|
5949
6230
|
}
|
|
5950
6231
|
}
|
|
5951
6232
|
});
|
|
@@ -6058,7 +6339,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6058
6339
|
id: value.item_id,
|
|
6059
6340
|
delta: value.delta
|
|
6060
6341
|
});
|
|
6061
|
-
if (((
|
|
6342
|
+
if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
|
|
6062
6343
|
logprobs.push(value.logprobs);
|
|
6063
6344
|
}
|
|
6064
6345
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -6087,7 +6368,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6087
6368
|
providerMetadata: {
|
|
6088
6369
|
[providerOptionsName]: {
|
|
6089
6370
|
itemId: value.item_id,
|
|
6090
|
-
reasoningEncryptedContent: (
|
|
6371
|
+
reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
|
|
6091
6372
|
}
|
|
6092
6373
|
}
|
|
6093
6374
|
});
|
|
@@ -6121,10 +6402,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6121
6402
|
} else if (isResponseFinishedChunk(value)) {
|
|
6122
6403
|
finishReason = {
|
|
6123
6404
|
unified: mapOpenAIResponseFinishReason({
|
|
6124
|
-
finishReason: (
|
|
6405
|
+
finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
|
|
6125
6406
|
hasFunctionCall
|
|
6126
6407
|
}),
|
|
6127
|
-
raw: (
|
|
6408
|
+
raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
|
|
6128
6409
|
};
|
|
6129
6410
|
usage = value.response.usage;
|
|
6130
6411
|
if (typeof value.response.service_tier === "string") {
|
|
@@ -6136,7 +6417,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6136
6417
|
controller.enqueue({
|
|
6137
6418
|
type: "source",
|
|
6138
6419
|
sourceType: "url",
|
|
6139
|
-
id: (
|
|
6420
|
+
id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : generateId2(),
|
|
6140
6421
|
url: value.annotation.url,
|
|
6141
6422
|
title: value.annotation.title
|
|
6142
6423
|
});
|
|
@@ -6144,7 +6425,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6144
6425
|
controller.enqueue({
|
|
6145
6426
|
type: "source",
|
|
6146
6427
|
sourceType: "document",
|
|
6147
|
-
id: (
|
|
6428
|
+
id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId2(),
|
|
6148
6429
|
mediaType: "text/plain",
|
|
6149
6430
|
title: value.annotation.filename,
|
|
6150
6431
|
filename: value.annotation.filename,
|
|
@@ -6160,7 +6441,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6160
6441
|
controller.enqueue({
|
|
6161
6442
|
type: "source",
|
|
6162
6443
|
sourceType: "document",
|
|
6163
|
-
id: (
|
|
6444
|
+
id: (_G = (_F = (_E = self.config).generateId) == null ? void 0 : _F.call(_E)) != null ? _G : generateId2(),
|
|
6164
6445
|
mediaType: "text/plain",
|
|
6165
6446
|
title: value.annotation.filename,
|
|
6166
6447
|
filename: value.annotation.filename,
|
|
@@ -6176,7 +6457,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
6176
6457
|
controller.enqueue({
|
|
6177
6458
|
type: "source",
|
|
6178
6459
|
sourceType: "document",
|
|
6179
|
-
id: (
|
|
6460
|
+
id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : generateId2(),
|
|
6180
6461
|
mediaType: "application/octet-stream",
|
|
6181
6462
|
title: value.annotation.file_id,
|
|
6182
6463
|
filename: value.annotation.file_id,
|