@ai-sdk/openai 3.0.0-beta.73 → 3.0.0-beta.74
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 +55 -1
- package/dist/index.d.ts +55 -1
- package/dist/index.js +960 -766
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +926 -728
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +128 -1
- package/dist/internal/index.d.ts +128 -1
- package/dist/internal/index.js +903 -707
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +883 -688
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.js
CHANGED
|
@@ -27,6 +27,11 @@ __export(internal_exports, {
|
|
|
27
27
|
OpenAIResponsesLanguageModel: () => OpenAIResponsesLanguageModel,
|
|
28
28
|
OpenAISpeechModel: () => OpenAISpeechModel,
|
|
29
29
|
OpenAITranscriptionModel: () => OpenAITranscriptionModel,
|
|
30
|
+
applyPatch: () => applyPatch,
|
|
31
|
+
applyPatchArgsSchema: () => applyPatchArgsSchema,
|
|
32
|
+
applyPatchInputSchema: () => applyPatchInputSchema,
|
|
33
|
+
applyPatchOutputSchema: () => applyPatchOutputSchema,
|
|
34
|
+
applyPatchToolFactory: () => applyPatchToolFactory,
|
|
30
35
|
codeInterpreter: () => codeInterpreter,
|
|
31
36
|
codeInterpreterArgsSchema: () => codeInterpreterArgsSchema,
|
|
32
37
|
codeInterpreterInputSchema: () => codeInterpreterInputSchema,
|
|
@@ -2129,34 +2134,76 @@ var OpenAISpeechModel = class {
|
|
|
2129
2134
|
|
|
2130
2135
|
// src/responses/openai-responses-language-model.ts
|
|
2131
2136
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2132
|
-
var
|
|
2137
|
+
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
2133
2138
|
|
|
2134
2139
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2135
2140
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2136
|
-
var
|
|
2137
|
-
var
|
|
2141
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2142
|
+
var import_v414 = require("zod/v4");
|
|
2138
2143
|
|
|
2139
|
-
// src/tool/
|
|
2144
|
+
// src/tool/apply-patch.ts
|
|
2140
2145
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
2141
2146
|
var import_v412 = require("zod/v4");
|
|
2142
|
-
var
|
|
2147
|
+
var applyPatchInputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2148
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
2149
|
+
import_v412.z.object({
|
|
2150
|
+
callId: import_v412.z.string(),
|
|
2151
|
+
operation: import_v412.z.discriminatedUnion("type", [
|
|
2152
|
+
import_v412.z.object({
|
|
2153
|
+
type: import_v412.z.literal("create_file"),
|
|
2154
|
+
path: import_v412.z.string(),
|
|
2155
|
+
diff: import_v412.z.string()
|
|
2156
|
+
}),
|
|
2157
|
+
import_v412.z.object({
|
|
2158
|
+
type: import_v412.z.literal("delete_file"),
|
|
2159
|
+
path: import_v412.z.string()
|
|
2160
|
+
}),
|
|
2161
|
+
import_v412.z.object({
|
|
2162
|
+
type: import_v412.z.literal("update_file"),
|
|
2163
|
+
path: import_v412.z.string(),
|
|
2164
|
+
diff: import_v412.z.string()
|
|
2165
|
+
})
|
|
2166
|
+
])
|
|
2167
|
+
})
|
|
2168
|
+
)
|
|
2169
|
+
);
|
|
2170
|
+
var applyPatchOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2143
2171
|
() => (0, import_provider_utils19.zodSchema)(
|
|
2144
2172
|
import_v412.z.object({
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2173
|
+
status: import_v412.z.enum(["completed", "failed"]),
|
|
2174
|
+
output: import_v412.z.string().optional()
|
|
2175
|
+
})
|
|
2176
|
+
)
|
|
2177
|
+
);
|
|
2178
|
+
var applyPatchArgsSchema = (0, import_provider_utils19.lazySchema)(() => (0, import_provider_utils19.zodSchema)(import_v412.z.object({})));
|
|
2179
|
+
var applyPatchToolFactory = (0, import_provider_utils19.createProviderToolFactoryWithOutputSchema)({
|
|
2180
|
+
id: "openai.apply_patch",
|
|
2181
|
+
inputSchema: applyPatchInputSchema,
|
|
2182
|
+
outputSchema: applyPatchOutputSchema
|
|
2183
|
+
});
|
|
2184
|
+
var applyPatch = () => applyPatchToolFactory({});
|
|
2185
|
+
|
|
2186
|
+
// src/tool/local-shell.ts
|
|
2187
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2188
|
+
var import_v413 = require("zod/v4");
|
|
2189
|
+
var localShellInputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2190
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2191
|
+
import_v413.z.object({
|
|
2192
|
+
action: import_v413.z.object({
|
|
2193
|
+
type: import_v413.z.literal("exec"),
|
|
2194
|
+
command: import_v413.z.array(import_v413.z.string()),
|
|
2195
|
+
timeoutMs: import_v413.z.number().optional(),
|
|
2196
|
+
user: import_v413.z.string().optional(),
|
|
2197
|
+
workingDirectory: import_v413.z.string().optional(),
|
|
2198
|
+
env: import_v413.z.record(import_v413.z.string(), import_v413.z.string()).optional()
|
|
2152
2199
|
})
|
|
2153
2200
|
})
|
|
2154
2201
|
)
|
|
2155
2202
|
);
|
|
2156
|
-
var localShellOutputSchema = (0,
|
|
2157
|
-
() => (0,
|
|
2203
|
+
var localShellOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
2204
|
+
() => (0, import_provider_utils20.zodSchema)(import_v413.z.object({ output: import_v413.z.string() }))
|
|
2158
2205
|
);
|
|
2159
|
-
var localShell = (0,
|
|
2206
|
+
var localShell = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
|
|
2160
2207
|
id: "openai.local_shell",
|
|
2161
2208
|
inputSchema: localShellInputSchema,
|
|
2162
2209
|
outputSchema: localShellOutputSchema
|
|
@@ -2173,7 +2220,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2173
2220
|
systemMessageMode,
|
|
2174
2221
|
fileIdPrefixes,
|
|
2175
2222
|
store,
|
|
2176
|
-
hasLocalShellTool = false
|
|
2223
|
+
hasLocalShellTool = false,
|
|
2224
|
+
hasApplyPatchTool = false
|
|
2177
2225
|
}) {
|
|
2178
2226
|
var _a, _b, _c, _d, _e;
|
|
2179
2227
|
const input = [];
|
|
@@ -2221,7 +2269,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2221
2269
|
return {
|
|
2222
2270
|
type: "input_image",
|
|
2223
2271
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2224
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2272
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
|
|
2225
2273
|
},
|
|
2226
2274
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
|
|
2227
2275
|
};
|
|
@@ -2236,7 +2284,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2236
2284
|
type: "input_file",
|
|
2237
2285
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2238
2286
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2239
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2287
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
|
|
2240
2288
|
}
|
|
2241
2289
|
};
|
|
2242
2290
|
} else {
|
|
@@ -2280,7 +2328,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2280
2328
|
part.toolName
|
|
2281
2329
|
);
|
|
2282
2330
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2283
|
-
const parsedInput = await (0,
|
|
2331
|
+
const parsedInput = await (0, import_provider_utils21.validateTypes)({
|
|
2284
2332
|
value: part.input,
|
|
2285
2333
|
schema: localShellInputSchema
|
|
2286
2334
|
});
|
|
@@ -2321,7 +2369,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2321
2369
|
break;
|
|
2322
2370
|
}
|
|
2323
2371
|
case "reasoning": {
|
|
2324
|
-
const providerOptions = await (0,
|
|
2372
|
+
const providerOptions = await (0, import_provider_utils21.parseProviderOptions)({
|
|
2325
2373
|
provider: "openai",
|
|
2326
2374
|
providerOptions: part.providerOptions,
|
|
2327
2375
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2385,7 +2433,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2385
2433
|
part.toolName
|
|
2386
2434
|
);
|
|
2387
2435
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2388
|
-
const parsedOutput = await (0,
|
|
2436
|
+
const parsedOutput = await (0, import_provider_utils21.validateTypes)({
|
|
2389
2437
|
value: output.value,
|
|
2390
2438
|
schema: localShellOutputSchema
|
|
2391
2439
|
});
|
|
@@ -2396,6 +2444,19 @@ async function convertToOpenAIResponsesInput({
|
|
|
2396
2444
|
});
|
|
2397
2445
|
break;
|
|
2398
2446
|
}
|
|
2447
|
+
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
2448
|
+
const parsedOutput = await (0, import_provider_utils21.validateTypes)({
|
|
2449
|
+
value: output.value,
|
|
2450
|
+
schema: applyPatchOutputSchema
|
|
2451
|
+
});
|
|
2452
|
+
input.push({
|
|
2453
|
+
type: "apply_patch_call_output",
|
|
2454
|
+
call_id: part.toolCallId,
|
|
2455
|
+
status: parsedOutput.status,
|
|
2456
|
+
output: parsedOutput.output
|
|
2457
|
+
});
|
|
2458
|
+
break;
|
|
2459
|
+
}
|
|
2399
2460
|
let contentValue;
|
|
2400
2461
|
switch (output.type) {
|
|
2401
2462
|
case "text":
|
|
@@ -2437,7 +2498,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2437
2498
|
return void 0;
|
|
2438
2499
|
}
|
|
2439
2500
|
}
|
|
2440
|
-
}).filter(
|
|
2501
|
+
}).filter(import_provider_utils21.isNonNullable);
|
|
2441
2502
|
break;
|
|
2442
2503
|
}
|
|
2443
2504
|
input.push({
|
|
@@ -2456,9 +2517,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2456
2517
|
}
|
|
2457
2518
|
return { input, warnings };
|
|
2458
2519
|
}
|
|
2459
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2460
|
-
itemId:
|
|
2461
|
-
reasoningEncryptedContent:
|
|
2520
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v414.z.object({
|
|
2521
|
+
itemId: import_v414.z.string().nullish(),
|
|
2522
|
+
reasoningEncryptedContent: import_v414.z.string().nullish()
|
|
2462
2523
|
});
|
|
2463
2524
|
|
|
2464
2525
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2480,349 +2541,393 @@ function mapOpenAIResponseFinishReason({
|
|
|
2480
2541
|
}
|
|
2481
2542
|
|
|
2482
2543
|
// src/responses/openai-responses-api.ts
|
|
2483
|
-
var
|
|
2484
|
-
var
|
|
2485
|
-
var openaiResponsesChunkSchema = (0,
|
|
2486
|
-
() => (0,
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
type:
|
|
2490
|
-
item_id:
|
|
2491
|
-
delta:
|
|
2492
|
-
logprobs:
|
|
2493
|
-
|
|
2494
|
-
token:
|
|
2495
|
-
logprob:
|
|
2496
|
-
top_logprobs:
|
|
2497
|
-
|
|
2498
|
-
token:
|
|
2499
|
-
logprob:
|
|
2544
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2545
|
+
var import_v415 = require("zod/v4");
|
|
2546
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
|
|
2547
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2548
|
+
import_v415.z.union([
|
|
2549
|
+
import_v415.z.object({
|
|
2550
|
+
type: import_v415.z.literal("response.output_text.delta"),
|
|
2551
|
+
item_id: import_v415.z.string(),
|
|
2552
|
+
delta: import_v415.z.string(),
|
|
2553
|
+
logprobs: import_v415.z.array(
|
|
2554
|
+
import_v415.z.object({
|
|
2555
|
+
token: import_v415.z.string(),
|
|
2556
|
+
logprob: import_v415.z.number(),
|
|
2557
|
+
top_logprobs: import_v415.z.array(
|
|
2558
|
+
import_v415.z.object({
|
|
2559
|
+
token: import_v415.z.string(),
|
|
2560
|
+
logprob: import_v415.z.number()
|
|
2500
2561
|
})
|
|
2501
2562
|
)
|
|
2502
2563
|
})
|
|
2503
2564
|
).nullish()
|
|
2504
2565
|
}),
|
|
2505
|
-
|
|
2506
|
-
type:
|
|
2507
|
-
response:
|
|
2508
|
-
incomplete_details:
|
|
2509
|
-
usage:
|
|
2510
|
-
input_tokens:
|
|
2511
|
-
input_tokens_details:
|
|
2512
|
-
output_tokens:
|
|
2513
|
-
output_tokens_details:
|
|
2566
|
+
import_v415.z.object({
|
|
2567
|
+
type: import_v415.z.enum(["response.completed", "response.incomplete"]),
|
|
2568
|
+
response: import_v415.z.object({
|
|
2569
|
+
incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
|
|
2570
|
+
usage: import_v415.z.object({
|
|
2571
|
+
input_tokens: import_v415.z.number(),
|
|
2572
|
+
input_tokens_details: import_v415.z.object({ cached_tokens: import_v415.z.number().nullish() }).nullish(),
|
|
2573
|
+
output_tokens: import_v415.z.number(),
|
|
2574
|
+
output_tokens_details: import_v415.z.object({ reasoning_tokens: import_v415.z.number().nullish() }).nullish()
|
|
2514
2575
|
}),
|
|
2515
|
-
service_tier:
|
|
2576
|
+
service_tier: import_v415.z.string().nullish()
|
|
2516
2577
|
})
|
|
2517
2578
|
}),
|
|
2518
|
-
|
|
2519
|
-
type:
|
|
2520
|
-
response:
|
|
2521
|
-
id:
|
|
2522
|
-
created_at:
|
|
2523
|
-
model:
|
|
2524
|
-
service_tier:
|
|
2579
|
+
import_v415.z.object({
|
|
2580
|
+
type: import_v415.z.literal("response.created"),
|
|
2581
|
+
response: import_v415.z.object({
|
|
2582
|
+
id: import_v415.z.string(),
|
|
2583
|
+
created_at: import_v415.z.number(),
|
|
2584
|
+
model: import_v415.z.string(),
|
|
2585
|
+
service_tier: import_v415.z.string().nullish()
|
|
2525
2586
|
})
|
|
2526
2587
|
}),
|
|
2527
|
-
|
|
2528
|
-
type:
|
|
2529
|
-
output_index:
|
|
2530
|
-
item:
|
|
2531
|
-
|
|
2532
|
-
type:
|
|
2533
|
-
id:
|
|
2588
|
+
import_v415.z.object({
|
|
2589
|
+
type: import_v415.z.literal("response.output_item.added"),
|
|
2590
|
+
output_index: import_v415.z.number(),
|
|
2591
|
+
item: import_v415.z.discriminatedUnion("type", [
|
|
2592
|
+
import_v415.z.object({
|
|
2593
|
+
type: import_v415.z.literal("message"),
|
|
2594
|
+
id: import_v415.z.string()
|
|
2534
2595
|
}),
|
|
2535
|
-
|
|
2536
|
-
type:
|
|
2537
|
-
id:
|
|
2538
|
-
encrypted_content:
|
|
2596
|
+
import_v415.z.object({
|
|
2597
|
+
type: import_v415.z.literal("reasoning"),
|
|
2598
|
+
id: import_v415.z.string(),
|
|
2599
|
+
encrypted_content: import_v415.z.string().nullish()
|
|
2539
2600
|
}),
|
|
2540
|
-
|
|
2541
|
-
type:
|
|
2542
|
-
id:
|
|
2543
|
-
call_id:
|
|
2544
|
-
name:
|
|
2545
|
-
arguments:
|
|
2601
|
+
import_v415.z.object({
|
|
2602
|
+
type: import_v415.z.literal("function_call"),
|
|
2603
|
+
id: import_v415.z.string(),
|
|
2604
|
+
call_id: import_v415.z.string(),
|
|
2605
|
+
name: import_v415.z.string(),
|
|
2606
|
+
arguments: import_v415.z.string()
|
|
2546
2607
|
}),
|
|
2547
|
-
|
|
2548
|
-
type:
|
|
2549
|
-
id:
|
|
2550
|
-
status:
|
|
2608
|
+
import_v415.z.object({
|
|
2609
|
+
type: import_v415.z.literal("web_search_call"),
|
|
2610
|
+
id: import_v415.z.string(),
|
|
2611
|
+
status: import_v415.z.string()
|
|
2551
2612
|
}),
|
|
2552
|
-
|
|
2553
|
-
type:
|
|
2554
|
-
id:
|
|
2555
|
-
status:
|
|
2613
|
+
import_v415.z.object({
|
|
2614
|
+
type: import_v415.z.literal("computer_call"),
|
|
2615
|
+
id: import_v415.z.string(),
|
|
2616
|
+
status: import_v415.z.string()
|
|
2556
2617
|
}),
|
|
2557
|
-
|
|
2558
|
-
type:
|
|
2559
|
-
id:
|
|
2618
|
+
import_v415.z.object({
|
|
2619
|
+
type: import_v415.z.literal("file_search_call"),
|
|
2620
|
+
id: import_v415.z.string()
|
|
2560
2621
|
}),
|
|
2561
|
-
|
|
2562
|
-
type:
|
|
2563
|
-
id:
|
|
2622
|
+
import_v415.z.object({
|
|
2623
|
+
type: import_v415.z.literal("image_generation_call"),
|
|
2624
|
+
id: import_v415.z.string()
|
|
2564
2625
|
}),
|
|
2565
|
-
|
|
2566
|
-
type:
|
|
2567
|
-
id:
|
|
2568
|
-
container_id:
|
|
2569
|
-
code:
|
|
2570
|
-
outputs:
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2626
|
+
import_v415.z.object({
|
|
2627
|
+
type: import_v415.z.literal("code_interpreter_call"),
|
|
2628
|
+
id: import_v415.z.string(),
|
|
2629
|
+
container_id: import_v415.z.string(),
|
|
2630
|
+
code: import_v415.z.string().nullable(),
|
|
2631
|
+
outputs: import_v415.z.array(
|
|
2632
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2633
|
+
import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
|
|
2634
|
+
import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
|
|
2574
2635
|
])
|
|
2575
2636
|
).nullable(),
|
|
2576
|
-
status:
|
|
2637
|
+
status: import_v415.z.string()
|
|
2577
2638
|
}),
|
|
2578
|
-
|
|
2579
|
-
type:
|
|
2580
|
-
id:
|
|
2581
|
-
status:
|
|
2639
|
+
import_v415.z.object({
|
|
2640
|
+
type: import_v415.z.literal("mcp_call"),
|
|
2641
|
+
id: import_v415.z.string(),
|
|
2642
|
+
status: import_v415.z.string()
|
|
2582
2643
|
}),
|
|
2583
|
-
|
|
2584
|
-
type:
|
|
2585
|
-
id:
|
|
2644
|
+
import_v415.z.object({
|
|
2645
|
+
type: import_v415.z.literal("mcp_list_tools"),
|
|
2646
|
+
id: import_v415.z.string()
|
|
2586
2647
|
}),
|
|
2587
|
-
|
|
2588
|
-
type:
|
|
2589
|
-
id:
|
|
2648
|
+
import_v415.z.object({
|
|
2649
|
+
type: import_v415.z.literal("mcp_approval_request"),
|
|
2650
|
+
id: import_v415.z.string()
|
|
2651
|
+
}),
|
|
2652
|
+
import_v415.z.object({
|
|
2653
|
+
type: import_v415.z.literal("apply_patch_call"),
|
|
2654
|
+
id: import_v415.z.string(),
|
|
2655
|
+
call_id: import_v415.z.string(),
|
|
2656
|
+
status: import_v415.z.enum(["in_progress", "completed"]),
|
|
2657
|
+
operation: import_v415.z.discriminatedUnion("type", [
|
|
2658
|
+
import_v415.z.object({
|
|
2659
|
+
type: import_v415.z.literal("create_file"),
|
|
2660
|
+
path: import_v415.z.string(),
|
|
2661
|
+
diff: import_v415.z.string()
|
|
2662
|
+
}),
|
|
2663
|
+
import_v415.z.object({
|
|
2664
|
+
type: import_v415.z.literal("delete_file"),
|
|
2665
|
+
path: import_v415.z.string()
|
|
2666
|
+
}),
|
|
2667
|
+
import_v415.z.object({
|
|
2668
|
+
type: import_v415.z.literal("update_file"),
|
|
2669
|
+
path: import_v415.z.string(),
|
|
2670
|
+
diff: import_v415.z.string()
|
|
2671
|
+
})
|
|
2672
|
+
])
|
|
2590
2673
|
})
|
|
2591
2674
|
])
|
|
2592
2675
|
}),
|
|
2593
|
-
|
|
2594
|
-
type:
|
|
2595
|
-
output_index:
|
|
2596
|
-
item:
|
|
2597
|
-
|
|
2598
|
-
type:
|
|
2599
|
-
id:
|
|
2676
|
+
import_v415.z.object({
|
|
2677
|
+
type: import_v415.z.literal("response.output_item.done"),
|
|
2678
|
+
output_index: import_v415.z.number(),
|
|
2679
|
+
item: import_v415.z.discriminatedUnion("type", [
|
|
2680
|
+
import_v415.z.object({
|
|
2681
|
+
type: import_v415.z.literal("message"),
|
|
2682
|
+
id: import_v415.z.string()
|
|
2600
2683
|
}),
|
|
2601
|
-
|
|
2602
|
-
type:
|
|
2603
|
-
id:
|
|
2604
|
-
encrypted_content:
|
|
2684
|
+
import_v415.z.object({
|
|
2685
|
+
type: import_v415.z.literal("reasoning"),
|
|
2686
|
+
id: import_v415.z.string(),
|
|
2687
|
+
encrypted_content: import_v415.z.string().nullish()
|
|
2605
2688
|
}),
|
|
2606
|
-
|
|
2607
|
-
type:
|
|
2608
|
-
id:
|
|
2609
|
-
call_id:
|
|
2610
|
-
name:
|
|
2611
|
-
arguments:
|
|
2612
|
-
status:
|
|
2689
|
+
import_v415.z.object({
|
|
2690
|
+
type: import_v415.z.literal("function_call"),
|
|
2691
|
+
id: import_v415.z.string(),
|
|
2692
|
+
call_id: import_v415.z.string(),
|
|
2693
|
+
name: import_v415.z.string(),
|
|
2694
|
+
arguments: import_v415.z.string(),
|
|
2695
|
+
status: import_v415.z.literal("completed")
|
|
2613
2696
|
}),
|
|
2614
|
-
|
|
2615
|
-
type:
|
|
2616
|
-
id:
|
|
2617
|
-
code:
|
|
2618
|
-
container_id:
|
|
2619
|
-
outputs:
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2697
|
+
import_v415.z.object({
|
|
2698
|
+
type: import_v415.z.literal("code_interpreter_call"),
|
|
2699
|
+
id: import_v415.z.string(),
|
|
2700
|
+
code: import_v415.z.string().nullable(),
|
|
2701
|
+
container_id: import_v415.z.string(),
|
|
2702
|
+
outputs: import_v415.z.array(
|
|
2703
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2704
|
+
import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
|
|
2705
|
+
import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
|
|
2623
2706
|
])
|
|
2624
2707
|
).nullable()
|
|
2625
2708
|
}),
|
|
2626
|
-
|
|
2627
|
-
type:
|
|
2628
|
-
id:
|
|
2629
|
-
result:
|
|
2709
|
+
import_v415.z.object({
|
|
2710
|
+
type: import_v415.z.literal("image_generation_call"),
|
|
2711
|
+
id: import_v415.z.string(),
|
|
2712
|
+
result: import_v415.z.string()
|
|
2630
2713
|
}),
|
|
2631
|
-
|
|
2632
|
-
type:
|
|
2633
|
-
id:
|
|
2634
|
-
status:
|
|
2635
|
-
action:
|
|
2636
|
-
|
|
2637
|
-
type:
|
|
2638
|
-
query:
|
|
2639
|
-
sources:
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2714
|
+
import_v415.z.object({
|
|
2715
|
+
type: import_v415.z.literal("web_search_call"),
|
|
2716
|
+
id: import_v415.z.string(),
|
|
2717
|
+
status: import_v415.z.string(),
|
|
2718
|
+
action: import_v415.z.discriminatedUnion("type", [
|
|
2719
|
+
import_v415.z.object({
|
|
2720
|
+
type: import_v415.z.literal("search"),
|
|
2721
|
+
query: import_v415.z.string().nullish(),
|
|
2722
|
+
sources: import_v415.z.array(
|
|
2723
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2724
|
+
import_v415.z.object({ type: import_v415.z.literal("url"), url: import_v415.z.string() }),
|
|
2725
|
+
import_v415.z.object({ type: import_v415.z.literal("api"), name: import_v415.z.string() })
|
|
2643
2726
|
])
|
|
2644
2727
|
).nullish()
|
|
2645
2728
|
}),
|
|
2646
|
-
|
|
2647
|
-
type:
|
|
2648
|
-
url:
|
|
2729
|
+
import_v415.z.object({
|
|
2730
|
+
type: import_v415.z.literal("open_page"),
|
|
2731
|
+
url: import_v415.z.string()
|
|
2649
2732
|
}),
|
|
2650
|
-
|
|
2651
|
-
type:
|
|
2652
|
-
url:
|
|
2653
|
-
pattern:
|
|
2733
|
+
import_v415.z.object({
|
|
2734
|
+
type: import_v415.z.literal("find"),
|
|
2735
|
+
url: import_v415.z.string(),
|
|
2736
|
+
pattern: import_v415.z.string()
|
|
2654
2737
|
})
|
|
2655
2738
|
])
|
|
2656
2739
|
}),
|
|
2657
|
-
|
|
2658
|
-
type:
|
|
2659
|
-
id:
|
|
2660
|
-
queries:
|
|
2661
|
-
results:
|
|
2662
|
-
|
|
2663
|
-
attributes:
|
|
2664
|
-
|
|
2665
|
-
|
|
2740
|
+
import_v415.z.object({
|
|
2741
|
+
type: import_v415.z.literal("file_search_call"),
|
|
2742
|
+
id: import_v415.z.string(),
|
|
2743
|
+
queries: import_v415.z.array(import_v415.z.string()),
|
|
2744
|
+
results: import_v415.z.array(
|
|
2745
|
+
import_v415.z.object({
|
|
2746
|
+
attributes: import_v415.z.record(
|
|
2747
|
+
import_v415.z.string(),
|
|
2748
|
+
import_v415.z.union([import_v415.z.string(), import_v415.z.number(), import_v415.z.boolean()])
|
|
2666
2749
|
),
|
|
2667
|
-
file_id:
|
|
2668
|
-
filename:
|
|
2669
|
-
score:
|
|
2670
|
-
text:
|
|
2750
|
+
file_id: import_v415.z.string(),
|
|
2751
|
+
filename: import_v415.z.string(),
|
|
2752
|
+
score: import_v415.z.number(),
|
|
2753
|
+
text: import_v415.z.string()
|
|
2671
2754
|
})
|
|
2672
2755
|
).nullish()
|
|
2673
2756
|
}),
|
|
2674
|
-
|
|
2675
|
-
type:
|
|
2676
|
-
id:
|
|
2677
|
-
call_id:
|
|
2678
|
-
action:
|
|
2679
|
-
type:
|
|
2680
|
-
command:
|
|
2681
|
-
timeout_ms:
|
|
2682
|
-
user:
|
|
2683
|
-
working_directory:
|
|
2684
|
-
env:
|
|
2757
|
+
import_v415.z.object({
|
|
2758
|
+
type: import_v415.z.literal("local_shell_call"),
|
|
2759
|
+
id: import_v415.z.string(),
|
|
2760
|
+
call_id: import_v415.z.string(),
|
|
2761
|
+
action: import_v415.z.object({
|
|
2762
|
+
type: import_v415.z.literal("exec"),
|
|
2763
|
+
command: import_v415.z.array(import_v415.z.string()),
|
|
2764
|
+
timeout_ms: import_v415.z.number().optional(),
|
|
2765
|
+
user: import_v415.z.string().optional(),
|
|
2766
|
+
working_directory: import_v415.z.string().optional(),
|
|
2767
|
+
env: import_v415.z.record(import_v415.z.string(), import_v415.z.string()).optional()
|
|
2685
2768
|
})
|
|
2686
2769
|
}),
|
|
2687
|
-
|
|
2688
|
-
type:
|
|
2689
|
-
id:
|
|
2690
|
-
status:
|
|
2770
|
+
import_v415.z.object({
|
|
2771
|
+
type: import_v415.z.literal("computer_call"),
|
|
2772
|
+
id: import_v415.z.string(),
|
|
2773
|
+
status: import_v415.z.literal("completed")
|
|
2691
2774
|
}),
|
|
2692
|
-
|
|
2693
|
-
type:
|
|
2694
|
-
id:
|
|
2695
|
-
status:
|
|
2696
|
-
arguments:
|
|
2697
|
-
name:
|
|
2698
|
-
server_label:
|
|
2699
|
-
output:
|
|
2700
|
-
error:
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
type:
|
|
2704
|
-
code:
|
|
2705
|
-
message:
|
|
2775
|
+
import_v415.z.object({
|
|
2776
|
+
type: import_v415.z.literal("mcp_call"),
|
|
2777
|
+
id: import_v415.z.string(),
|
|
2778
|
+
status: import_v415.z.string(),
|
|
2779
|
+
arguments: import_v415.z.string(),
|
|
2780
|
+
name: import_v415.z.string(),
|
|
2781
|
+
server_label: import_v415.z.string(),
|
|
2782
|
+
output: import_v415.z.string().nullish(),
|
|
2783
|
+
error: import_v415.z.union([
|
|
2784
|
+
import_v415.z.string(),
|
|
2785
|
+
import_v415.z.object({
|
|
2786
|
+
type: import_v415.z.string().optional(),
|
|
2787
|
+
code: import_v415.z.union([import_v415.z.number(), import_v415.z.string()]).optional(),
|
|
2788
|
+
message: import_v415.z.string().optional()
|
|
2706
2789
|
}).loose()
|
|
2707
2790
|
]).nullish()
|
|
2708
2791
|
}),
|
|
2709
|
-
|
|
2710
|
-
type:
|
|
2711
|
-
id:
|
|
2712
|
-
server_label:
|
|
2713
|
-
tools:
|
|
2714
|
-
|
|
2715
|
-
name:
|
|
2716
|
-
description:
|
|
2717
|
-
input_schema:
|
|
2718
|
-
annotations:
|
|
2792
|
+
import_v415.z.object({
|
|
2793
|
+
type: import_v415.z.literal("mcp_list_tools"),
|
|
2794
|
+
id: import_v415.z.string(),
|
|
2795
|
+
server_label: import_v415.z.string(),
|
|
2796
|
+
tools: import_v415.z.array(
|
|
2797
|
+
import_v415.z.object({
|
|
2798
|
+
name: import_v415.z.string(),
|
|
2799
|
+
description: import_v415.z.string().optional(),
|
|
2800
|
+
input_schema: import_v415.z.any(),
|
|
2801
|
+
annotations: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()).optional()
|
|
2719
2802
|
})
|
|
2720
2803
|
),
|
|
2721
|
-
error:
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
type:
|
|
2725
|
-
code:
|
|
2726
|
-
message:
|
|
2804
|
+
error: import_v415.z.union([
|
|
2805
|
+
import_v415.z.string(),
|
|
2806
|
+
import_v415.z.object({
|
|
2807
|
+
type: import_v415.z.string().optional(),
|
|
2808
|
+
code: import_v415.z.union([import_v415.z.number(), import_v415.z.string()]).optional(),
|
|
2809
|
+
message: import_v415.z.string().optional()
|
|
2727
2810
|
}).loose()
|
|
2728
2811
|
]).optional()
|
|
2729
2812
|
}),
|
|
2730
|
-
|
|
2731
|
-
type:
|
|
2732
|
-
id:
|
|
2733
|
-
server_label:
|
|
2734
|
-
name:
|
|
2735
|
-
arguments:
|
|
2736
|
-
approval_request_id:
|
|
2813
|
+
import_v415.z.object({
|
|
2814
|
+
type: import_v415.z.literal("mcp_approval_request"),
|
|
2815
|
+
id: import_v415.z.string(),
|
|
2816
|
+
server_label: import_v415.z.string(),
|
|
2817
|
+
name: import_v415.z.string(),
|
|
2818
|
+
arguments: import_v415.z.string(),
|
|
2819
|
+
approval_request_id: import_v415.z.string()
|
|
2820
|
+
}),
|
|
2821
|
+
import_v415.z.object({
|
|
2822
|
+
type: import_v415.z.literal("apply_patch_call"),
|
|
2823
|
+
id: import_v415.z.string(),
|
|
2824
|
+
call_id: import_v415.z.string(),
|
|
2825
|
+
status: import_v415.z.enum(["in_progress", "completed"]),
|
|
2826
|
+
operation: import_v415.z.discriminatedUnion("type", [
|
|
2827
|
+
import_v415.z.object({
|
|
2828
|
+
type: import_v415.z.literal("create_file"),
|
|
2829
|
+
path: import_v415.z.string(),
|
|
2830
|
+
diff: import_v415.z.string()
|
|
2831
|
+
}),
|
|
2832
|
+
import_v415.z.object({
|
|
2833
|
+
type: import_v415.z.literal("delete_file"),
|
|
2834
|
+
path: import_v415.z.string()
|
|
2835
|
+
}),
|
|
2836
|
+
import_v415.z.object({
|
|
2837
|
+
type: import_v415.z.literal("update_file"),
|
|
2838
|
+
path: import_v415.z.string(),
|
|
2839
|
+
diff: import_v415.z.string()
|
|
2840
|
+
})
|
|
2841
|
+
])
|
|
2737
2842
|
})
|
|
2738
2843
|
])
|
|
2739
2844
|
}),
|
|
2740
|
-
|
|
2741
|
-
type:
|
|
2742
|
-
item_id:
|
|
2743
|
-
output_index:
|
|
2744
|
-
delta:
|
|
2845
|
+
import_v415.z.object({
|
|
2846
|
+
type: import_v415.z.literal("response.function_call_arguments.delta"),
|
|
2847
|
+
item_id: import_v415.z.string(),
|
|
2848
|
+
output_index: import_v415.z.number(),
|
|
2849
|
+
delta: import_v415.z.string()
|
|
2745
2850
|
}),
|
|
2746
|
-
|
|
2747
|
-
type:
|
|
2748
|
-
item_id:
|
|
2749
|
-
output_index:
|
|
2750
|
-
partial_image_b64:
|
|
2851
|
+
import_v415.z.object({
|
|
2852
|
+
type: import_v415.z.literal("response.image_generation_call.partial_image"),
|
|
2853
|
+
item_id: import_v415.z.string(),
|
|
2854
|
+
output_index: import_v415.z.number(),
|
|
2855
|
+
partial_image_b64: import_v415.z.string()
|
|
2751
2856
|
}),
|
|
2752
|
-
|
|
2753
|
-
type:
|
|
2754
|
-
item_id:
|
|
2755
|
-
output_index:
|
|
2756
|
-
delta:
|
|
2857
|
+
import_v415.z.object({
|
|
2858
|
+
type: import_v415.z.literal("response.code_interpreter_call_code.delta"),
|
|
2859
|
+
item_id: import_v415.z.string(),
|
|
2860
|
+
output_index: import_v415.z.number(),
|
|
2861
|
+
delta: import_v415.z.string()
|
|
2757
2862
|
}),
|
|
2758
|
-
|
|
2759
|
-
type:
|
|
2760
|
-
item_id:
|
|
2761
|
-
output_index:
|
|
2762
|
-
code:
|
|
2863
|
+
import_v415.z.object({
|
|
2864
|
+
type: import_v415.z.literal("response.code_interpreter_call_code.done"),
|
|
2865
|
+
item_id: import_v415.z.string(),
|
|
2866
|
+
output_index: import_v415.z.number(),
|
|
2867
|
+
code: import_v415.z.string()
|
|
2763
2868
|
}),
|
|
2764
|
-
|
|
2765
|
-
type:
|
|
2766
|
-
annotation:
|
|
2767
|
-
|
|
2768
|
-
type:
|
|
2769
|
-
start_index:
|
|
2770
|
-
end_index:
|
|
2771
|
-
url:
|
|
2772
|
-
title:
|
|
2869
|
+
import_v415.z.object({
|
|
2870
|
+
type: import_v415.z.literal("response.output_text.annotation.added"),
|
|
2871
|
+
annotation: import_v415.z.discriminatedUnion("type", [
|
|
2872
|
+
import_v415.z.object({
|
|
2873
|
+
type: import_v415.z.literal("url_citation"),
|
|
2874
|
+
start_index: import_v415.z.number(),
|
|
2875
|
+
end_index: import_v415.z.number(),
|
|
2876
|
+
url: import_v415.z.string(),
|
|
2877
|
+
title: import_v415.z.string()
|
|
2773
2878
|
}),
|
|
2774
|
-
|
|
2775
|
-
type:
|
|
2776
|
-
file_id:
|
|
2777
|
-
filename:
|
|
2778
|
-
index:
|
|
2779
|
-
start_index:
|
|
2780
|
-
end_index:
|
|
2781
|
-
quote:
|
|
2879
|
+
import_v415.z.object({
|
|
2880
|
+
type: import_v415.z.literal("file_citation"),
|
|
2881
|
+
file_id: import_v415.z.string(),
|
|
2882
|
+
filename: import_v415.z.string().nullish(),
|
|
2883
|
+
index: import_v415.z.number().nullish(),
|
|
2884
|
+
start_index: import_v415.z.number().nullish(),
|
|
2885
|
+
end_index: import_v415.z.number().nullish(),
|
|
2886
|
+
quote: import_v415.z.string().nullish()
|
|
2782
2887
|
}),
|
|
2783
|
-
|
|
2784
|
-
type:
|
|
2785
|
-
container_id:
|
|
2786
|
-
file_id:
|
|
2787
|
-
filename:
|
|
2788
|
-
start_index:
|
|
2789
|
-
end_index:
|
|
2790
|
-
index:
|
|
2888
|
+
import_v415.z.object({
|
|
2889
|
+
type: import_v415.z.literal("container_file_citation"),
|
|
2890
|
+
container_id: import_v415.z.string(),
|
|
2891
|
+
file_id: import_v415.z.string(),
|
|
2892
|
+
filename: import_v415.z.string().nullish(),
|
|
2893
|
+
start_index: import_v415.z.number().nullish(),
|
|
2894
|
+
end_index: import_v415.z.number().nullish(),
|
|
2895
|
+
index: import_v415.z.number().nullish()
|
|
2791
2896
|
}),
|
|
2792
|
-
|
|
2793
|
-
type:
|
|
2794
|
-
file_id:
|
|
2795
|
-
index:
|
|
2897
|
+
import_v415.z.object({
|
|
2898
|
+
type: import_v415.z.literal("file_path"),
|
|
2899
|
+
file_id: import_v415.z.string(),
|
|
2900
|
+
index: import_v415.z.number().nullish()
|
|
2796
2901
|
})
|
|
2797
2902
|
])
|
|
2798
2903
|
}),
|
|
2799
|
-
|
|
2800
|
-
type:
|
|
2801
|
-
item_id:
|
|
2802
|
-
summary_index:
|
|
2904
|
+
import_v415.z.object({
|
|
2905
|
+
type: import_v415.z.literal("response.reasoning_summary_part.added"),
|
|
2906
|
+
item_id: import_v415.z.string(),
|
|
2907
|
+
summary_index: import_v415.z.number()
|
|
2803
2908
|
}),
|
|
2804
|
-
|
|
2805
|
-
type:
|
|
2806
|
-
item_id:
|
|
2807
|
-
summary_index:
|
|
2808
|
-
delta:
|
|
2909
|
+
import_v415.z.object({
|
|
2910
|
+
type: import_v415.z.literal("response.reasoning_summary_text.delta"),
|
|
2911
|
+
item_id: import_v415.z.string(),
|
|
2912
|
+
summary_index: import_v415.z.number(),
|
|
2913
|
+
delta: import_v415.z.string()
|
|
2809
2914
|
}),
|
|
2810
|
-
|
|
2811
|
-
type:
|
|
2812
|
-
item_id:
|
|
2813
|
-
summary_index:
|
|
2915
|
+
import_v415.z.object({
|
|
2916
|
+
type: import_v415.z.literal("response.reasoning_summary_part.done"),
|
|
2917
|
+
item_id: import_v415.z.string(),
|
|
2918
|
+
summary_index: import_v415.z.number()
|
|
2814
2919
|
}),
|
|
2815
|
-
|
|
2816
|
-
type:
|
|
2817
|
-
sequence_number:
|
|
2818
|
-
error:
|
|
2819
|
-
type:
|
|
2820
|
-
code:
|
|
2821
|
-
message:
|
|
2822
|
-
param:
|
|
2920
|
+
import_v415.z.object({
|
|
2921
|
+
type: import_v415.z.literal("error"),
|
|
2922
|
+
sequence_number: import_v415.z.number(),
|
|
2923
|
+
error: import_v415.z.object({
|
|
2924
|
+
type: import_v415.z.string(),
|
|
2925
|
+
code: import_v415.z.string(),
|
|
2926
|
+
message: import_v415.z.string(),
|
|
2927
|
+
param: import_v415.z.string().nullish()
|
|
2823
2928
|
})
|
|
2824
2929
|
}),
|
|
2825
|
-
|
|
2930
|
+
import_v415.z.object({ type: import_v415.z.string() }).loose().transform((value) => ({
|
|
2826
2931
|
type: "unknown_chunk",
|
|
2827
2932
|
message: value.type
|
|
2828
2933
|
}))
|
|
@@ -2830,236 +2935,258 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
2830
2935
|
])
|
|
2831
2936
|
)
|
|
2832
2937
|
);
|
|
2833
|
-
var openaiResponsesResponseSchema = (0,
|
|
2834
|
-
() => (0,
|
|
2835
|
-
|
|
2836
|
-
id:
|
|
2837
|
-
created_at:
|
|
2838
|
-
error:
|
|
2839
|
-
message:
|
|
2840
|
-
type:
|
|
2841
|
-
param:
|
|
2842
|
-
code:
|
|
2938
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils22.lazySchema)(
|
|
2939
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
2940
|
+
import_v415.z.object({
|
|
2941
|
+
id: import_v415.z.string().optional(),
|
|
2942
|
+
created_at: import_v415.z.number().optional(),
|
|
2943
|
+
error: import_v415.z.object({
|
|
2944
|
+
message: import_v415.z.string(),
|
|
2945
|
+
type: import_v415.z.string(),
|
|
2946
|
+
param: import_v415.z.string().nullish(),
|
|
2947
|
+
code: import_v415.z.string()
|
|
2843
2948
|
}).nullish(),
|
|
2844
|
-
model:
|
|
2845
|
-
output:
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
type:
|
|
2849
|
-
role:
|
|
2850
|
-
id:
|
|
2851
|
-
content:
|
|
2852
|
-
|
|
2853
|
-
type:
|
|
2854
|
-
text:
|
|
2855
|
-
logprobs:
|
|
2856
|
-
|
|
2857
|
-
token:
|
|
2858
|
-
logprob:
|
|
2859
|
-
top_logprobs:
|
|
2860
|
-
|
|
2861
|
-
token:
|
|
2862
|
-
logprob:
|
|
2949
|
+
model: import_v415.z.string().optional(),
|
|
2950
|
+
output: import_v415.z.array(
|
|
2951
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2952
|
+
import_v415.z.object({
|
|
2953
|
+
type: import_v415.z.literal("message"),
|
|
2954
|
+
role: import_v415.z.literal("assistant"),
|
|
2955
|
+
id: import_v415.z.string(),
|
|
2956
|
+
content: import_v415.z.array(
|
|
2957
|
+
import_v415.z.object({
|
|
2958
|
+
type: import_v415.z.literal("output_text"),
|
|
2959
|
+
text: import_v415.z.string(),
|
|
2960
|
+
logprobs: import_v415.z.array(
|
|
2961
|
+
import_v415.z.object({
|
|
2962
|
+
token: import_v415.z.string(),
|
|
2963
|
+
logprob: import_v415.z.number(),
|
|
2964
|
+
top_logprobs: import_v415.z.array(
|
|
2965
|
+
import_v415.z.object({
|
|
2966
|
+
token: import_v415.z.string(),
|
|
2967
|
+
logprob: import_v415.z.number()
|
|
2863
2968
|
})
|
|
2864
2969
|
)
|
|
2865
2970
|
})
|
|
2866
2971
|
).nullish(),
|
|
2867
|
-
annotations:
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
type:
|
|
2871
|
-
start_index:
|
|
2872
|
-
end_index:
|
|
2873
|
-
url:
|
|
2874
|
-
title:
|
|
2972
|
+
annotations: import_v415.z.array(
|
|
2973
|
+
import_v415.z.discriminatedUnion("type", [
|
|
2974
|
+
import_v415.z.object({
|
|
2975
|
+
type: import_v415.z.literal("url_citation"),
|
|
2976
|
+
start_index: import_v415.z.number(),
|
|
2977
|
+
end_index: import_v415.z.number(),
|
|
2978
|
+
url: import_v415.z.string(),
|
|
2979
|
+
title: import_v415.z.string()
|
|
2875
2980
|
}),
|
|
2876
|
-
|
|
2877
|
-
type:
|
|
2878
|
-
file_id:
|
|
2879
|
-
filename:
|
|
2880
|
-
index:
|
|
2881
|
-
start_index:
|
|
2882
|
-
end_index:
|
|
2883
|
-
quote:
|
|
2981
|
+
import_v415.z.object({
|
|
2982
|
+
type: import_v415.z.literal("file_citation"),
|
|
2983
|
+
file_id: import_v415.z.string(),
|
|
2984
|
+
filename: import_v415.z.string().nullish(),
|
|
2985
|
+
index: import_v415.z.number().nullish(),
|
|
2986
|
+
start_index: import_v415.z.number().nullish(),
|
|
2987
|
+
end_index: import_v415.z.number().nullish(),
|
|
2988
|
+
quote: import_v415.z.string().nullish()
|
|
2884
2989
|
}),
|
|
2885
|
-
|
|
2886
|
-
type:
|
|
2887
|
-
container_id:
|
|
2888
|
-
file_id:
|
|
2889
|
-
filename:
|
|
2890
|
-
start_index:
|
|
2891
|
-
end_index:
|
|
2892
|
-
index:
|
|
2990
|
+
import_v415.z.object({
|
|
2991
|
+
type: import_v415.z.literal("container_file_citation"),
|
|
2992
|
+
container_id: import_v415.z.string(),
|
|
2993
|
+
file_id: import_v415.z.string(),
|
|
2994
|
+
filename: import_v415.z.string().nullish(),
|
|
2995
|
+
start_index: import_v415.z.number().nullish(),
|
|
2996
|
+
end_index: import_v415.z.number().nullish(),
|
|
2997
|
+
index: import_v415.z.number().nullish()
|
|
2893
2998
|
}),
|
|
2894
|
-
|
|
2895
|
-
type:
|
|
2896
|
-
file_id:
|
|
2897
|
-
index:
|
|
2999
|
+
import_v415.z.object({
|
|
3000
|
+
type: import_v415.z.literal("file_path"),
|
|
3001
|
+
file_id: import_v415.z.string(),
|
|
3002
|
+
index: import_v415.z.number().nullish()
|
|
2898
3003
|
})
|
|
2899
3004
|
])
|
|
2900
3005
|
)
|
|
2901
3006
|
})
|
|
2902
3007
|
)
|
|
2903
3008
|
}),
|
|
2904
|
-
|
|
2905
|
-
type:
|
|
2906
|
-
id:
|
|
2907
|
-
status:
|
|
2908
|
-
action:
|
|
2909
|
-
|
|
2910
|
-
type:
|
|
2911
|
-
query:
|
|
2912
|
-
sources:
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
3009
|
+
import_v415.z.object({
|
|
3010
|
+
type: import_v415.z.literal("web_search_call"),
|
|
3011
|
+
id: import_v415.z.string(),
|
|
3012
|
+
status: import_v415.z.string(),
|
|
3013
|
+
action: import_v415.z.discriminatedUnion("type", [
|
|
3014
|
+
import_v415.z.object({
|
|
3015
|
+
type: import_v415.z.literal("search"),
|
|
3016
|
+
query: import_v415.z.string().nullish(),
|
|
3017
|
+
sources: import_v415.z.array(
|
|
3018
|
+
import_v415.z.discriminatedUnion("type", [
|
|
3019
|
+
import_v415.z.object({ type: import_v415.z.literal("url"), url: import_v415.z.string() }),
|
|
3020
|
+
import_v415.z.object({ type: import_v415.z.literal("api"), name: import_v415.z.string() })
|
|
2916
3021
|
])
|
|
2917
3022
|
).nullish()
|
|
2918
3023
|
}),
|
|
2919
|
-
|
|
2920
|
-
type:
|
|
2921
|
-
url:
|
|
3024
|
+
import_v415.z.object({
|
|
3025
|
+
type: import_v415.z.literal("open_page"),
|
|
3026
|
+
url: import_v415.z.string()
|
|
2922
3027
|
}),
|
|
2923
|
-
|
|
2924
|
-
type:
|
|
2925
|
-
url:
|
|
2926
|
-
pattern:
|
|
3028
|
+
import_v415.z.object({
|
|
3029
|
+
type: import_v415.z.literal("find"),
|
|
3030
|
+
url: import_v415.z.string(),
|
|
3031
|
+
pattern: import_v415.z.string()
|
|
2927
3032
|
})
|
|
2928
3033
|
])
|
|
2929
3034
|
}),
|
|
2930
|
-
|
|
2931
|
-
type:
|
|
2932
|
-
id:
|
|
2933
|
-
queries:
|
|
2934
|
-
results:
|
|
2935
|
-
|
|
2936
|
-
attributes:
|
|
2937
|
-
|
|
2938
|
-
|
|
3035
|
+
import_v415.z.object({
|
|
3036
|
+
type: import_v415.z.literal("file_search_call"),
|
|
3037
|
+
id: import_v415.z.string(),
|
|
3038
|
+
queries: import_v415.z.array(import_v415.z.string()),
|
|
3039
|
+
results: import_v415.z.array(
|
|
3040
|
+
import_v415.z.object({
|
|
3041
|
+
attributes: import_v415.z.record(
|
|
3042
|
+
import_v415.z.string(),
|
|
3043
|
+
import_v415.z.union([import_v415.z.string(), import_v415.z.number(), import_v415.z.boolean()])
|
|
2939
3044
|
),
|
|
2940
|
-
file_id:
|
|
2941
|
-
filename:
|
|
2942
|
-
score:
|
|
2943
|
-
text:
|
|
3045
|
+
file_id: import_v415.z.string(),
|
|
3046
|
+
filename: import_v415.z.string(),
|
|
3047
|
+
score: import_v415.z.number(),
|
|
3048
|
+
text: import_v415.z.string()
|
|
2944
3049
|
})
|
|
2945
3050
|
).nullish()
|
|
2946
3051
|
}),
|
|
2947
|
-
|
|
2948
|
-
type:
|
|
2949
|
-
id:
|
|
2950
|
-
code:
|
|
2951
|
-
container_id:
|
|
2952
|
-
outputs:
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
3052
|
+
import_v415.z.object({
|
|
3053
|
+
type: import_v415.z.literal("code_interpreter_call"),
|
|
3054
|
+
id: import_v415.z.string(),
|
|
3055
|
+
code: import_v415.z.string().nullable(),
|
|
3056
|
+
container_id: import_v415.z.string(),
|
|
3057
|
+
outputs: import_v415.z.array(
|
|
3058
|
+
import_v415.z.discriminatedUnion("type", [
|
|
3059
|
+
import_v415.z.object({ type: import_v415.z.literal("logs"), logs: import_v415.z.string() }),
|
|
3060
|
+
import_v415.z.object({ type: import_v415.z.literal("image"), url: import_v415.z.string() })
|
|
2956
3061
|
])
|
|
2957
3062
|
).nullable()
|
|
2958
3063
|
}),
|
|
2959
|
-
|
|
2960
|
-
type:
|
|
2961
|
-
id:
|
|
2962
|
-
result:
|
|
3064
|
+
import_v415.z.object({
|
|
3065
|
+
type: import_v415.z.literal("image_generation_call"),
|
|
3066
|
+
id: import_v415.z.string(),
|
|
3067
|
+
result: import_v415.z.string()
|
|
2963
3068
|
}),
|
|
2964
|
-
|
|
2965
|
-
type:
|
|
2966
|
-
id:
|
|
2967
|
-
call_id:
|
|
2968
|
-
action:
|
|
2969
|
-
type:
|
|
2970
|
-
command:
|
|
2971
|
-
timeout_ms:
|
|
2972
|
-
user:
|
|
2973
|
-
working_directory:
|
|
2974
|
-
env:
|
|
3069
|
+
import_v415.z.object({
|
|
3070
|
+
type: import_v415.z.literal("local_shell_call"),
|
|
3071
|
+
id: import_v415.z.string(),
|
|
3072
|
+
call_id: import_v415.z.string(),
|
|
3073
|
+
action: import_v415.z.object({
|
|
3074
|
+
type: import_v415.z.literal("exec"),
|
|
3075
|
+
command: import_v415.z.array(import_v415.z.string()),
|
|
3076
|
+
timeout_ms: import_v415.z.number().optional(),
|
|
3077
|
+
user: import_v415.z.string().optional(),
|
|
3078
|
+
working_directory: import_v415.z.string().optional(),
|
|
3079
|
+
env: import_v415.z.record(import_v415.z.string(), import_v415.z.string()).optional()
|
|
2975
3080
|
})
|
|
2976
3081
|
}),
|
|
2977
|
-
|
|
2978
|
-
type:
|
|
2979
|
-
call_id:
|
|
2980
|
-
name:
|
|
2981
|
-
arguments:
|
|
2982
|
-
id:
|
|
3082
|
+
import_v415.z.object({
|
|
3083
|
+
type: import_v415.z.literal("function_call"),
|
|
3084
|
+
call_id: import_v415.z.string(),
|
|
3085
|
+
name: import_v415.z.string(),
|
|
3086
|
+
arguments: import_v415.z.string(),
|
|
3087
|
+
id: import_v415.z.string()
|
|
2983
3088
|
}),
|
|
2984
|
-
|
|
2985
|
-
type:
|
|
2986
|
-
id:
|
|
2987
|
-
status:
|
|
3089
|
+
import_v415.z.object({
|
|
3090
|
+
type: import_v415.z.literal("computer_call"),
|
|
3091
|
+
id: import_v415.z.string(),
|
|
3092
|
+
status: import_v415.z.string().optional()
|
|
2988
3093
|
}),
|
|
2989
|
-
|
|
2990
|
-
type:
|
|
2991
|
-
id:
|
|
2992
|
-
encrypted_content:
|
|
2993
|
-
summary:
|
|
2994
|
-
|
|
2995
|
-
type:
|
|
2996
|
-
text:
|
|
3094
|
+
import_v415.z.object({
|
|
3095
|
+
type: import_v415.z.literal("reasoning"),
|
|
3096
|
+
id: import_v415.z.string(),
|
|
3097
|
+
encrypted_content: import_v415.z.string().nullish(),
|
|
3098
|
+
summary: import_v415.z.array(
|
|
3099
|
+
import_v415.z.object({
|
|
3100
|
+
type: import_v415.z.literal("summary_text"),
|
|
3101
|
+
text: import_v415.z.string()
|
|
2997
3102
|
})
|
|
2998
3103
|
)
|
|
2999
3104
|
}),
|
|
3000
|
-
|
|
3001
|
-
type:
|
|
3002
|
-
id:
|
|
3003
|
-
status:
|
|
3004
|
-
arguments:
|
|
3005
|
-
name:
|
|
3006
|
-
server_label:
|
|
3007
|
-
output:
|
|
3008
|
-
error:
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
type:
|
|
3012
|
-
code:
|
|
3013
|
-
message:
|
|
3105
|
+
import_v415.z.object({
|
|
3106
|
+
type: import_v415.z.literal("mcp_call"),
|
|
3107
|
+
id: import_v415.z.string(),
|
|
3108
|
+
status: import_v415.z.string(),
|
|
3109
|
+
arguments: import_v415.z.string(),
|
|
3110
|
+
name: import_v415.z.string(),
|
|
3111
|
+
server_label: import_v415.z.string(),
|
|
3112
|
+
output: import_v415.z.string().nullish(),
|
|
3113
|
+
error: import_v415.z.union([
|
|
3114
|
+
import_v415.z.string(),
|
|
3115
|
+
import_v415.z.object({
|
|
3116
|
+
type: import_v415.z.string().optional(),
|
|
3117
|
+
code: import_v415.z.union([import_v415.z.number(), import_v415.z.string()]).optional(),
|
|
3118
|
+
message: import_v415.z.string().optional()
|
|
3014
3119
|
}).loose()
|
|
3015
3120
|
]).nullish()
|
|
3016
3121
|
}),
|
|
3017
|
-
|
|
3018
|
-
type:
|
|
3019
|
-
id:
|
|
3020
|
-
server_label:
|
|
3021
|
-
tools:
|
|
3022
|
-
|
|
3023
|
-
name:
|
|
3024
|
-
description:
|
|
3025
|
-
input_schema:
|
|
3026
|
-
annotations:
|
|
3122
|
+
import_v415.z.object({
|
|
3123
|
+
type: import_v415.z.literal("mcp_list_tools"),
|
|
3124
|
+
id: import_v415.z.string(),
|
|
3125
|
+
server_label: import_v415.z.string(),
|
|
3126
|
+
tools: import_v415.z.array(
|
|
3127
|
+
import_v415.z.object({
|
|
3128
|
+
name: import_v415.z.string(),
|
|
3129
|
+
description: import_v415.z.string().optional(),
|
|
3130
|
+
input_schema: import_v415.z.any(),
|
|
3131
|
+
annotations: import_v415.z.record(import_v415.z.string(), import_v415.z.unknown()).optional()
|
|
3027
3132
|
})
|
|
3028
3133
|
),
|
|
3029
|
-
error:
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
type:
|
|
3033
|
-
code:
|
|
3034
|
-
message:
|
|
3134
|
+
error: import_v415.z.union([
|
|
3135
|
+
import_v415.z.string(),
|
|
3136
|
+
import_v415.z.object({
|
|
3137
|
+
type: import_v415.z.string().optional(),
|
|
3138
|
+
code: import_v415.z.union([import_v415.z.number(), import_v415.z.string()]).optional(),
|
|
3139
|
+
message: import_v415.z.string().optional()
|
|
3035
3140
|
}).loose()
|
|
3036
3141
|
]).optional()
|
|
3037
3142
|
}),
|
|
3038
|
-
|
|
3039
|
-
type:
|
|
3040
|
-
id:
|
|
3041
|
-
server_label:
|
|
3042
|
-
name:
|
|
3043
|
-
arguments:
|
|
3044
|
-
approval_request_id:
|
|
3143
|
+
import_v415.z.object({
|
|
3144
|
+
type: import_v415.z.literal("mcp_approval_request"),
|
|
3145
|
+
id: import_v415.z.string(),
|
|
3146
|
+
server_label: import_v415.z.string(),
|
|
3147
|
+
name: import_v415.z.string(),
|
|
3148
|
+
arguments: import_v415.z.string(),
|
|
3149
|
+
approval_request_id: import_v415.z.string()
|
|
3150
|
+
}),
|
|
3151
|
+
import_v415.z.object({
|
|
3152
|
+
type: import_v415.z.literal("apply_patch_call"),
|
|
3153
|
+
id: import_v415.z.string(),
|
|
3154
|
+
call_id: import_v415.z.string(),
|
|
3155
|
+
status: import_v415.z.enum(["in_progress", "completed"]),
|
|
3156
|
+
operation: import_v415.z.discriminatedUnion("type", [
|
|
3157
|
+
import_v415.z.object({
|
|
3158
|
+
type: import_v415.z.literal("create_file"),
|
|
3159
|
+
path: import_v415.z.string(),
|
|
3160
|
+
diff: import_v415.z.string()
|
|
3161
|
+
}),
|
|
3162
|
+
import_v415.z.object({
|
|
3163
|
+
type: import_v415.z.literal("delete_file"),
|
|
3164
|
+
path: import_v415.z.string()
|
|
3165
|
+
}),
|
|
3166
|
+
import_v415.z.object({
|
|
3167
|
+
type: import_v415.z.literal("update_file"),
|
|
3168
|
+
path: import_v415.z.string(),
|
|
3169
|
+
diff: import_v415.z.string()
|
|
3170
|
+
})
|
|
3171
|
+
])
|
|
3045
3172
|
})
|
|
3046
3173
|
])
|
|
3047
3174
|
).optional(),
|
|
3048
|
-
service_tier:
|
|
3049
|
-
incomplete_details:
|
|
3050
|
-
usage:
|
|
3051
|
-
input_tokens:
|
|
3052
|
-
input_tokens_details:
|
|
3053
|
-
output_tokens:
|
|
3054
|
-
output_tokens_details:
|
|
3175
|
+
service_tier: import_v415.z.string().nullish(),
|
|
3176
|
+
incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
|
|
3177
|
+
usage: import_v415.z.object({
|
|
3178
|
+
input_tokens: import_v415.z.number(),
|
|
3179
|
+
input_tokens_details: import_v415.z.object({ cached_tokens: import_v415.z.number().nullish() }).nullish(),
|
|
3180
|
+
output_tokens: import_v415.z.number(),
|
|
3181
|
+
output_tokens_details: import_v415.z.object({ reasoning_tokens: import_v415.z.number().nullish() }).nullish()
|
|
3055
3182
|
}).optional()
|
|
3056
3183
|
})
|
|
3057
3184
|
)
|
|
3058
3185
|
);
|
|
3059
3186
|
|
|
3060
3187
|
// src/responses/openai-responses-options.ts
|
|
3061
|
-
var
|
|
3062
|
-
var
|
|
3188
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
3189
|
+
var import_v416 = require("zod/v4");
|
|
3063
3190
|
var TOP_LOGPROBS_MAX = 20;
|
|
3064
3191
|
var openaiResponsesReasoningModelIds = [
|
|
3065
3192
|
"o1",
|
|
@@ -3126,19 +3253,19 @@ var openaiResponsesModelIds = [
|
|
|
3126
3253
|
"gpt-5-chat-latest",
|
|
3127
3254
|
...openaiResponsesReasoningModelIds
|
|
3128
3255
|
];
|
|
3129
|
-
var openaiResponsesProviderOptionsSchema = (0,
|
|
3130
|
-
() => (0,
|
|
3131
|
-
|
|
3132
|
-
conversation:
|
|
3133
|
-
include:
|
|
3134
|
-
|
|
3256
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazySchema)(
|
|
3257
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
3258
|
+
import_v416.z.object({
|
|
3259
|
+
conversation: import_v416.z.string().nullish(),
|
|
3260
|
+
include: import_v416.z.array(
|
|
3261
|
+
import_v416.z.enum([
|
|
3135
3262
|
"reasoning.encrypted_content",
|
|
3136
3263
|
// handled internally by default, only needed for unknown reasoning models
|
|
3137
3264
|
"file_search_call.results",
|
|
3138
3265
|
"message.output_text.logprobs"
|
|
3139
3266
|
])
|
|
3140
3267
|
).nullish(),
|
|
3141
|
-
instructions:
|
|
3268
|
+
instructions: import_v416.z.string().nullish(),
|
|
3142
3269
|
/**
|
|
3143
3270
|
* Return the log probabilities of the tokens.
|
|
3144
3271
|
*
|
|
@@ -3151,17 +3278,17 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazySchem
|
|
|
3151
3278
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3152
3279
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3153
3280
|
*/
|
|
3154
|
-
logprobs:
|
|
3281
|
+
logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3155
3282
|
/**
|
|
3156
3283
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3157
3284
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3158
3285
|
* Any further attempts to call a tool by the model will be ignored.
|
|
3159
3286
|
*/
|
|
3160
|
-
maxToolCalls:
|
|
3161
|
-
metadata:
|
|
3162
|
-
parallelToolCalls:
|
|
3163
|
-
previousResponseId:
|
|
3164
|
-
promptCacheKey:
|
|
3287
|
+
maxToolCalls: import_v416.z.number().nullish(),
|
|
3288
|
+
metadata: import_v416.z.any().nullish(),
|
|
3289
|
+
parallelToolCalls: import_v416.z.boolean().nullish(),
|
|
3290
|
+
previousResponseId: import_v416.z.string().nullish(),
|
|
3291
|
+
promptCacheKey: import_v416.z.string().nullish(),
|
|
3165
3292
|
/**
|
|
3166
3293
|
* The retention policy for the prompt cache.
|
|
3167
3294
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -3170,60 +3297,60 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazySchem
|
|
|
3170
3297
|
*
|
|
3171
3298
|
* @default 'in_memory'
|
|
3172
3299
|
*/
|
|
3173
|
-
promptCacheRetention:
|
|
3174
|
-
reasoningEffort:
|
|
3175
|
-
reasoningSummary:
|
|
3176
|
-
safetyIdentifier:
|
|
3177
|
-
serviceTier:
|
|
3178
|
-
store:
|
|
3179
|
-
strictJsonSchema:
|
|
3180
|
-
textVerbosity:
|
|
3181
|
-
truncation:
|
|
3182
|
-
user:
|
|
3300
|
+
promptCacheRetention: import_v416.z.enum(["in_memory", "24h"]).nullish(),
|
|
3301
|
+
reasoningEffort: import_v416.z.string().nullish(),
|
|
3302
|
+
reasoningSummary: import_v416.z.string().nullish(),
|
|
3303
|
+
safetyIdentifier: import_v416.z.string().nullish(),
|
|
3304
|
+
serviceTier: import_v416.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3305
|
+
store: import_v416.z.boolean().nullish(),
|
|
3306
|
+
strictJsonSchema: import_v416.z.boolean().nullish(),
|
|
3307
|
+
textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
|
|
3308
|
+
truncation: import_v416.z.enum(["auto", "disabled"]).nullish(),
|
|
3309
|
+
user: import_v416.z.string().nullish()
|
|
3183
3310
|
})
|
|
3184
3311
|
)
|
|
3185
3312
|
);
|
|
3186
3313
|
|
|
3187
3314
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3188
3315
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3189
|
-
var
|
|
3316
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
3190
3317
|
|
|
3191
3318
|
// src/tool/code-interpreter.ts
|
|
3192
|
-
var
|
|
3193
|
-
var
|
|
3194
|
-
var codeInterpreterInputSchema = (0,
|
|
3195
|
-
() => (0,
|
|
3196
|
-
|
|
3197
|
-
code:
|
|
3198
|
-
containerId:
|
|
3319
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
3320
|
+
var import_v417 = require("zod/v4");
|
|
3321
|
+
var codeInterpreterInputSchema = (0, import_provider_utils24.lazySchema)(
|
|
3322
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3323
|
+
import_v417.z.object({
|
|
3324
|
+
code: import_v417.z.string().nullish(),
|
|
3325
|
+
containerId: import_v417.z.string()
|
|
3199
3326
|
})
|
|
3200
3327
|
)
|
|
3201
3328
|
);
|
|
3202
|
-
var codeInterpreterOutputSchema = (0,
|
|
3203
|
-
() => (0,
|
|
3204
|
-
|
|
3205
|
-
outputs:
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3329
|
+
var codeInterpreterOutputSchema = (0, import_provider_utils24.lazySchema)(
|
|
3330
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3331
|
+
import_v417.z.object({
|
|
3332
|
+
outputs: import_v417.z.array(
|
|
3333
|
+
import_v417.z.discriminatedUnion("type", [
|
|
3334
|
+
import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
|
|
3335
|
+
import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
|
|
3209
3336
|
])
|
|
3210
3337
|
).nullish()
|
|
3211
3338
|
})
|
|
3212
3339
|
)
|
|
3213
3340
|
);
|
|
3214
|
-
var codeInterpreterArgsSchema = (0,
|
|
3215
|
-
() => (0,
|
|
3216
|
-
|
|
3217
|
-
container:
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
fileIds:
|
|
3341
|
+
var codeInterpreterArgsSchema = (0, import_provider_utils24.lazySchema)(
|
|
3342
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
3343
|
+
import_v417.z.object({
|
|
3344
|
+
container: import_v417.z.union([
|
|
3345
|
+
import_v417.z.string(),
|
|
3346
|
+
import_v417.z.object({
|
|
3347
|
+
fileIds: import_v417.z.array(import_v417.z.string()).optional()
|
|
3221
3348
|
})
|
|
3222
3349
|
]).optional()
|
|
3223
3350
|
})
|
|
3224
3351
|
)
|
|
3225
3352
|
);
|
|
3226
|
-
var codeInterpreterToolFactory = (0,
|
|
3353
|
+
var codeInterpreterToolFactory = (0, import_provider_utils24.createProviderToolFactoryWithOutputSchema)({
|
|
3227
3354
|
id: "openai.code_interpreter",
|
|
3228
3355
|
inputSchema: codeInterpreterInputSchema,
|
|
3229
3356
|
outputSchema: codeInterpreterOutputSchema
|
|
@@ -3233,81 +3360,81 @@ var codeInterpreter = (args = {}) => {
|
|
|
3233
3360
|
};
|
|
3234
3361
|
|
|
3235
3362
|
// src/tool/file-search.ts
|
|
3236
|
-
var
|
|
3237
|
-
var
|
|
3238
|
-
var comparisonFilterSchema =
|
|
3239
|
-
key:
|
|
3240
|
-
type:
|
|
3241
|
-
value:
|
|
3363
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
3364
|
+
var import_v418 = require("zod/v4");
|
|
3365
|
+
var comparisonFilterSchema = import_v418.z.object({
|
|
3366
|
+
key: import_v418.z.string(),
|
|
3367
|
+
type: import_v418.z.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
3368
|
+
value: import_v418.z.union([import_v418.z.string(), import_v418.z.number(), import_v418.z.boolean()])
|
|
3242
3369
|
});
|
|
3243
|
-
var compoundFilterSchema =
|
|
3244
|
-
type:
|
|
3245
|
-
filters:
|
|
3246
|
-
|
|
3370
|
+
var compoundFilterSchema = import_v418.z.object({
|
|
3371
|
+
type: import_v418.z.enum(["and", "or"]),
|
|
3372
|
+
filters: import_v418.z.array(
|
|
3373
|
+
import_v418.z.union([comparisonFilterSchema, import_v418.z.lazy(() => compoundFilterSchema)])
|
|
3247
3374
|
)
|
|
3248
3375
|
});
|
|
3249
|
-
var fileSearchArgsSchema = (0,
|
|
3250
|
-
() => (0,
|
|
3251
|
-
|
|
3252
|
-
vectorStoreIds:
|
|
3253
|
-
maxNumResults:
|
|
3254
|
-
ranking:
|
|
3255
|
-
ranker:
|
|
3256
|
-
scoreThreshold:
|
|
3376
|
+
var fileSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
3377
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
3378
|
+
import_v418.z.object({
|
|
3379
|
+
vectorStoreIds: import_v418.z.array(import_v418.z.string()),
|
|
3380
|
+
maxNumResults: import_v418.z.number().optional(),
|
|
3381
|
+
ranking: import_v418.z.object({
|
|
3382
|
+
ranker: import_v418.z.string().optional(),
|
|
3383
|
+
scoreThreshold: import_v418.z.number().optional()
|
|
3257
3384
|
}).optional(),
|
|
3258
|
-
filters:
|
|
3385
|
+
filters: import_v418.z.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
3259
3386
|
})
|
|
3260
3387
|
)
|
|
3261
3388
|
);
|
|
3262
|
-
var fileSearchOutputSchema = (0,
|
|
3263
|
-
() => (0,
|
|
3264
|
-
|
|
3265
|
-
queries:
|
|
3266
|
-
results:
|
|
3267
|
-
|
|
3268
|
-
attributes:
|
|
3269
|
-
fileId:
|
|
3270
|
-
filename:
|
|
3271
|
-
score:
|
|
3272
|
-
text:
|
|
3389
|
+
var fileSearchOutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3390
|
+
() => (0, import_provider_utils25.zodSchema)(
|
|
3391
|
+
import_v418.z.object({
|
|
3392
|
+
queries: import_v418.z.array(import_v418.z.string()),
|
|
3393
|
+
results: import_v418.z.array(
|
|
3394
|
+
import_v418.z.object({
|
|
3395
|
+
attributes: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()),
|
|
3396
|
+
fileId: import_v418.z.string(),
|
|
3397
|
+
filename: import_v418.z.string(),
|
|
3398
|
+
score: import_v418.z.number(),
|
|
3399
|
+
text: import_v418.z.string()
|
|
3273
3400
|
})
|
|
3274
3401
|
).nullable()
|
|
3275
3402
|
})
|
|
3276
3403
|
)
|
|
3277
3404
|
);
|
|
3278
|
-
var fileSearch = (0,
|
|
3405
|
+
var fileSearch = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
|
|
3279
3406
|
id: "openai.file_search",
|
|
3280
|
-
inputSchema:
|
|
3407
|
+
inputSchema: import_v418.z.object({}),
|
|
3281
3408
|
outputSchema: fileSearchOutputSchema
|
|
3282
3409
|
});
|
|
3283
3410
|
|
|
3284
3411
|
// src/tool/image-generation.ts
|
|
3285
|
-
var
|
|
3286
|
-
var
|
|
3287
|
-
var imageGenerationArgsSchema = (0,
|
|
3288
|
-
() => (0,
|
|
3289
|
-
|
|
3290
|
-
background:
|
|
3291
|
-
inputFidelity:
|
|
3292
|
-
inputImageMask:
|
|
3293
|
-
fileId:
|
|
3294
|
-
imageUrl:
|
|
3412
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
3413
|
+
var import_v419 = require("zod/v4");
|
|
3414
|
+
var imageGenerationArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
3415
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
3416
|
+
import_v419.z.object({
|
|
3417
|
+
background: import_v419.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
3418
|
+
inputFidelity: import_v419.z.enum(["low", "high"]).optional(),
|
|
3419
|
+
inputImageMask: import_v419.z.object({
|
|
3420
|
+
fileId: import_v419.z.string().optional(),
|
|
3421
|
+
imageUrl: import_v419.z.string().optional()
|
|
3295
3422
|
}).optional(),
|
|
3296
|
-
model:
|
|
3297
|
-
moderation:
|
|
3298
|
-
outputCompression:
|
|
3299
|
-
outputFormat:
|
|
3300
|
-
partialImages:
|
|
3301
|
-
quality:
|
|
3302
|
-
size:
|
|
3423
|
+
model: import_v419.z.string().optional(),
|
|
3424
|
+
moderation: import_v419.z.enum(["auto"]).optional(),
|
|
3425
|
+
outputCompression: import_v419.z.number().int().min(0).max(100).optional(),
|
|
3426
|
+
outputFormat: import_v419.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
3427
|
+
partialImages: import_v419.z.number().int().min(0).max(3).optional(),
|
|
3428
|
+
quality: import_v419.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
3429
|
+
size: import_v419.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
3303
3430
|
}).strict()
|
|
3304
3431
|
)
|
|
3305
3432
|
);
|
|
3306
|
-
var imageGenerationInputSchema = (0,
|
|
3307
|
-
var imageGenerationOutputSchema = (0,
|
|
3308
|
-
() => (0,
|
|
3433
|
+
var imageGenerationInputSchema = (0, import_provider_utils26.lazySchema)(() => (0, import_provider_utils26.zodSchema)(import_v419.z.object({})));
|
|
3434
|
+
var imageGenerationOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3435
|
+
() => (0, import_provider_utils26.zodSchema)(import_v419.z.object({ result: import_v419.z.string() }))
|
|
3309
3436
|
);
|
|
3310
|
-
var imageGenerationToolFactory = (0,
|
|
3437
|
+
var imageGenerationToolFactory = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
|
|
3311
3438
|
id: "openai.image_generation",
|
|
3312
3439
|
inputSchema: imageGenerationInputSchema,
|
|
3313
3440
|
outputSchema: imageGenerationOutputSchema
|
|
@@ -3317,32 +3444,32 @@ var imageGeneration = (args = {}) => {
|
|
|
3317
3444
|
};
|
|
3318
3445
|
|
|
3319
3446
|
// src/tool/mcp.ts
|
|
3320
|
-
var
|
|
3321
|
-
var
|
|
3322
|
-
var jsonValueSchema =
|
|
3323
|
-
() =>
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3447
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
3448
|
+
var import_v420 = require("zod/v4");
|
|
3449
|
+
var jsonValueSchema = import_v420.z.lazy(
|
|
3450
|
+
() => import_v420.z.union([
|
|
3451
|
+
import_v420.z.string(),
|
|
3452
|
+
import_v420.z.number(),
|
|
3453
|
+
import_v420.z.boolean(),
|
|
3454
|
+
import_v420.z.null(),
|
|
3455
|
+
import_v420.z.array(jsonValueSchema),
|
|
3456
|
+
import_v420.z.record(import_v420.z.string(), jsonValueSchema)
|
|
3330
3457
|
])
|
|
3331
3458
|
);
|
|
3332
|
-
var mcpArgsSchema = (0,
|
|
3333
|
-
() => (0,
|
|
3334
|
-
|
|
3335
|
-
serverLabel:
|
|
3336
|
-
allowedTools:
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
readOnly:
|
|
3340
|
-
toolNames:
|
|
3459
|
+
var mcpArgsSchema = (0, import_provider_utils27.lazySchema)(
|
|
3460
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
3461
|
+
import_v420.z.object({
|
|
3462
|
+
serverLabel: import_v420.z.string(),
|
|
3463
|
+
allowedTools: import_v420.z.union([
|
|
3464
|
+
import_v420.z.array(import_v420.z.string()),
|
|
3465
|
+
import_v420.z.object({
|
|
3466
|
+
readOnly: import_v420.z.boolean().optional(),
|
|
3467
|
+
toolNames: import_v420.z.array(import_v420.z.string()).optional()
|
|
3341
3468
|
})
|
|
3342
3469
|
]).optional(),
|
|
3343
|
-
authorization:
|
|
3344
|
-
connectorId:
|
|
3345
|
-
headers:
|
|
3470
|
+
authorization: import_v420.z.string().optional(),
|
|
3471
|
+
connectorId: import_v420.z.string().optional(),
|
|
3472
|
+
headers: import_v420.z.record(import_v420.z.string(), import_v420.z.string()).optional(),
|
|
3346
3473
|
// TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
|
|
3347
3474
|
// requireApproval: z
|
|
3348
3475
|
// .union([
|
|
@@ -3353,114 +3480,63 @@ var mcpArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
|
3353
3480
|
// }),
|
|
3354
3481
|
// ])
|
|
3355
3482
|
// .optional(),
|
|
3356
|
-
serverDescription:
|
|
3357
|
-
serverUrl:
|
|
3483
|
+
serverDescription: import_v420.z.string().optional(),
|
|
3484
|
+
serverUrl: import_v420.z.string().optional()
|
|
3358
3485
|
}).refine(
|
|
3359
3486
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
3360
3487
|
"One of serverUrl or connectorId must be provided."
|
|
3361
3488
|
)
|
|
3362
3489
|
)
|
|
3363
3490
|
);
|
|
3364
|
-
var mcpInputSchema = (0,
|
|
3365
|
-
var mcpOutputSchema = (0,
|
|
3366
|
-
() => (0,
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
type:
|
|
3370
|
-
serverLabel:
|
|
3371
|
-
name:
|
|
3372
|
-
arguments:
|
|
3373
|
-
output:
|
|
3374
|
-
error:
|
|
3491
|
+
var mcpInputSchema = (0, import_provider_utils27.lazySchema)(() => (0, import_provider_utils27.zodSchema)(import_v420.z.object({})));
|
|
3492
|
+
var mcpOutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
3493
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
3494
|
+
import_v420.z.discriminatedUnion("type", [
|
|
3495
|
+
import_v420.z.object({
|
|
3496
|
+
type: import_v420.z.literal("call"),
|
|
3497
|
+
serverLabel: import_v420.z.string(),
|
|
3498
|
+
name: import_v420.z.string(),
|
|
3499
|
+
arguments: import_v420.z.string(),
|
|
3500
|
+
output: import_v420.z.string().nullable().optional(),
|
|
3501
|
+
error: import_v420.z.union([import_v420.z.string(), jsonValueSchema]).optional()
|
|
3375
3502
|
}),
|
|
3376
|
-
|
|
3377
|
-
type:
|
|
3378
|
-
serverLabel:
|
|
3379
|
-
tools:
|
|
3380
|
-
|
|
3381
|
-
name:
|
|
3382
|
-
description:
|
|
3503
|
+
import_v420.z.object({
|
|
3504
|
+
type: import_v420.z.literal("listTools"),
|
|
3505
|
+
serverLabel: import_v420.z.string(),
|
|
3506
|
+
tools: import_v420.z.array(
|
|
3507
|
+
import_v420.z.object({
|
|
3508
|
+
name: import_v420.z.string(),
|
|
3509
|
+
description: import_v420.z.string().optional(),
|
|
3383
3510
|
inputSchema: jsonValueSchema,
|
|
3384
|
-
annotations:
|
|
3511
|
+
annotations: import_v420.z.record(import_v420.z.string(), jsonValueSchema).optional()
|
|
3385
3512
|
})
|
|
3386
3513
|
),
|
|
3387
|
-
error:
|
|
3514
|
+
error: import_v420.z.union([import_v420.z.string(), jsonValueSchema]).optional()
|
|
3388
3515
|
}),
|
|
3389
|
-
|
|
3390
|
-
type:
|
|
3391
|
-
serverLabel:
|
|
3392
|
-
name:
|
|
3393
|
-
arguments:
|
|
3394
|
-
approvalRequestId:
|
|
3516
|
+
import_v420.z.object({
|
|
3517
|
+
type: import_v420.z.literal("approvalRequest"),
|
|
3518
|
+
serverLabel: import_v420.z.string(),
|
|
3519
|
+
name: import_v420.z.string(),
|
|
3520
|
+
arguments: import_v420.z.string(),
|
|
3521
|
+
approvalRequestId: import_v420.z.string()
|
|
3395
3522
|
})
|
|
3396
3523
|
])
|
|
3397
3524
|
)
|
|
3398
3525
|
);
|
|
3399
|
-
var mcpToolFactory = (0,
|
|
3526
|
+
var mcpToolFactory = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
3400
3527
|
id: "openai.mcp",
|
|
3401
3528
|
inputSchema: mcpInputSchema,
|
|
3402
3529
|
outputSchema: mcpOutputSchema
|
|
3403
3530
|
});
|
|
3404
3531
|
|
|
3405
3532
|
// src/tool/web-search.ts
|
|
3406
|
-
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
3407
|
-
var import_v420 = require("zod/v4");
|
|
3408
|
-
var webSearchArgsSchema = (0, import_provider_utils27.lazySchema)(
|
|
3409
|
-
() => (0, import_provider_utils27.zodSchema)(
|
|
3410
|
-
import_v420.z.object({
|
|
3411
|
-
externalWebAccess: import_v420.z.boolean().optional(),
|
|
3412
|
-
filters: import_v420.z.object({ allowedDomains: import_v420.z.array(import_v420.z.string()).optional() }).optional(),
|
|
3413
|
-
searchContextSize: import_v420.z.enum(["low", "medium", "high"]).optional(),
|
|
3414
|
-
userLocation: import_v420.z.object({
|
|
3415
|
-
type: import_v420.z.literal("approximate"),
|
|
3416
|
-
country: import_v420.z.string().optional(),
|
|
3417
|
-
city: import_v420.z.string().optional(),
|
|
3418
|
-
region: import_v420.z.string().optional(),
|
|
3419
|
-
timezone: import_v420.z.string().optional()
|
|
3420
|
-
}).optional()
|
|
3421
|
-
})
|
|
3422
|
-
)
|
|
3423
|
-
);
|
|
3424
|
-
var webSearchInputSchema = (0, import_provider_utils27.lazySchema)(() => (0, import_provider_utils27.zodSchema)(import_v420.z.object({})));
|
|
3425
|
-
var webSearchOutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
3426
|
-
() => (0, import_provider_utils27.zodSchema)(
|
|
3427
|
-
import_v420.z.object({
|
|
3428
|
-
action: import_v420.z.discriminatedUnion("type", [
|
|
3429
|
-
import_v420.z.object({
|
|
3430
|
-
type: import_v420.z.literal("search"),
|
|
3431
|
-
query: import_v420.z.string().optional()
|
|
3432
|
-
}),
|
|
3433
|
-
import_v420.z.object({
|
|
3434
|
-
type: import_v420.z.literal("openPage"),
|
|
3435
|
-
url: import_v420.z.string()
|
|
3436
|
-
}),
|
|
3437
|
-
import_v420.z.object({
|
|
3438
|
-
type: import_v420.z.literal("find"),
|
|
3439
|
-
url: import_v420.z.string(),
|
|
3440
|
-
pattern: import_v420.z.string()
|
|
3441
|
-
})
|
|
3442
|
-
]),
|
|
3443
|
-
sources: import_v420.z.array(
|
|
3444
|
-
import_v420.z.discriminatedUnion("type", [
|
|
3445
|
-
import_v420.z.object({ type: import_v420.z.literal("url"), url: import_v420.z.string() }),
|
|
3446
|
-
import_v420.z.object({ type: import_v420.z.literal("api"), name: import_v420.z.string() })
|
|
3447
|
-
])
|
|
3448
|
-
).optional()
|
|
3449
|
-
})
|
|
3450
|
-
)
|
|
3451
|
-
);
|
|
3452
|
-
var webSearchToolFactory = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
3453
|
-
id: "openai.web_search",
|
|
3454
|
-
inputSchema: webSearchInputSchema,
|
|
3455
|
-
outputSchema: webSearchOutputSchema
|
|
3456
|
-
});
|
|
3457
|
-
|
|
3458
|
-
// src/tool/web-search-preview.ts
|
|
3459
3533
|
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
3460
3534
|
var import_v421 = require("zod/v4");
|
|
3461
|
-
var
|
|
3535
|
+
var webSearchArgsSchema = (0, import_provider_utils28.lazySchema)(
|
|
3462
3536
|
() => (0, import_provider_utils28.zodSchema)(
|
|
3463
3537
|
import_v421.z.object({
|
|
3538
|
+
externalWebAccess: import_v421.z.boolean().optional(),
|
|
3539
|
+
filters: import_v421.z.object({ allowedDomains: import_v421.z.array(import_v421.z.string()).optional() }).optional(),
|
|
3464
3540
|
searchContextSize: import_v421.z.enum(["low", "medium", "high"]).optional(),
|
|
3465
3541
|
userLocation: import_v421.z.object({
|
|
3466
3542
|
type: import_v421.z.literal("approximate"),
|
|
@@ -3472,10 +3548,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils28.lazySchema)(
|
|
|
3472
3548
|
})
|
|
3473
3549
|
)
|
|
3474
3550
|
);
|
|
3475
|
-
var
|
|
3476
|
-
|
|
3477
|
-
);
|
|
3478
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils28.lazySchema)(
|
|
3551
|
+
var webSearchInputSchema = (0, import_provider_utils28.lazySchema)(() => (0, import_provider_utils28.zodSchema)(import_v421.z.object({})));
|
|
3552
|
+
var webSearchOutputSchema = (0, import_provider_utils28.lazySchema)(
|
|
3479
3553
|
() => (0, import_provider_utils28.zodSchema)(
|
|
3480
3554
|
import_v421.z.object({
|
|
3481
3555
|
action: import_v421.z.discriminatedUnion("type", [
|
|
@@ -3492,11 +3566,64 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils28.lazySchema)(
|
|
|
3492
3566
|
url: import_v421.z.string(),
|
|
3493
3567
|
pattern: import_v421.z.string()
|
|
3494
3568
|
})
|
|
3569
|
+
]),
|
|
3570
|
+
sources: import_v421.z.array(
|
|
3571
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3572
|
+
import_v421.z.object({ type: import_v421.z.literal("url"), url: import_v421.z.string() }),
|
|
3573
|
+
import_v421.z.object({ type: import_v421.z.literal("api"), name: import_v421.z.string() })
|
|
3574
|
+
])
|
|
3575
|
+
).optional()
|
|
3576
|
+
})
|
|
3577
|
+
)
|
|
3578
|
+
);
|
|
3579
|
+
var webSearchToolFactory = (0, import_provider_utils28.createProviderToolFactoryWithOutputSchema)({
|
|
3580
|
+
id: "openai.web_search",
|
|
3581
|
+
inputSchema: webSearchInputSchema,
|
|
3582
|
+
outputSchema: webSearchOutputSchema
|
|
3583
|
+
});
|
|
3584
|
+
|
|
3585
|
+
// src/tool/web-search-preview.ts
|
|
3586
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
3587
|
+
var import_v422 = require("zod/v4");
|
|
3588
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils29.lazySchema)(
|
|
3589
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
3590
|
+
import_v422.z.object({
|
|
3591
|
+
searchContextSize: import_v422.z.enum(["low", "medium", "high"]).optional(),
|
|
3592
|
+
userLocation: import_v422.z.object({
|
|
3593
|
+
type: import_v422.z.literal("approximate"),
|
|
3594
|
+
country: import_v422.z.string().optional(),
|
|
3595
|
+
city: import_v422.z.string().optional(),
|
|
3596
|
+
region: import_v422.z.string().optional(),
|
|
3597
|
+
timezone: import_v422.z.string().optional()
|
|
3598
|
+
}).optional()
|
|
3599
|
+
})
|
|
3600
|
+
)
|
|
3601
|
+
);
|
|
3602
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils29.lazySchema)(
|
|
3603
|
+
() => (0, import_provider_utils29.zodSchema)(import_v422.z.object({}))
|
|
3604
|
+
);
|
|
3605
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils29.lazySchema)(
|
|
3606
|
+
() => (0, import_provider_utils29.zodSchema)(
|
|
3607
|
+
import_v422.z.object({
|
|
3608
|
+
action: import_v422.z.discriminatedUnion("type", [
|
|
3609
|
+
import_v422.z.object({
|
|
3610
|
+
type: import_v422.z.literal("search"),
|
|
3611
|
+
query: import_v422.z.string().optional()
|
|
3612
|
+
}),
|
|
3613
|
+
import_v422.z.object({
|
|
3614
|
+
type: import_v422.z.literal("openPage"),
|
|
3615
|
+
url: import_v422.z.string()
|
|
3616
|
+
}),
|
|
3617
|
+
import_v422.z.object({
|
|
3618
|
+
type: import_v422.z.literal("find"),
|
|
3619
|
+
url: import_v422.z.string(),
|
|
3620
|
+
pattern: import_v422.z.string()
|
|
3621
|
+
})
|
|
3495
3622
|
])
|
|
3496
3623
|
})
|
|
3497
3624
|
)
|
|
3498
3625
|
);
|
|
3499
|
-
var webSearchPreview = (0,
|
|
3626
|
+
var webSearchPreview = (0, import_provider_utils29.createProviderToolFactoryWithOutputSchema)({
|
|
3500
3627
|
id: "openai.web_search_preview",
|
|
3501
3628
|
inputSchema: webSearchPreviewInputSchema,
|
|
3502
3629
|
outputSchema: webSearchPreviewOutputSchema
|
|
@@ -3528,7 +3655,7 @@ async function prepareResponsesTools({
|
|
|
3528
3655
|
case "provider": {
|
|
3529
3656
|
switch (tool.id) {
|
|
3530
3657
|
case "openai.file_search": {
|
|
3531
|
-
const args = await (0,
|
|
3658
|
+
const args = await (0, import_provider_utils30.validateTypes)({
|
|
3532
3659
|
value: tool.args,
|
|
3533
3660
|
schema: fileSearchArgsSchema
|
|
3534
3661
|
});
|
|
@@ -3550,8 +3677,14 @@ async function prepareResponsesTools({
|
|
|
3550
3677
|
});
|
|
3551
3678
|
break;
|
|
3552
3679
|
}
|
|
3680
|
+
case "openai.apply_patch": {
|
|
3681
|
+
openaiTools.push({
|
|
3682
|
+
type: "apply_patch"
|
|
3683
|
+
});
|
|
3684
|
+
break;
|
|
3685
|
+
}
|
|
3553
3686
|
case "openai.web_search_preview": {
|
|
3554
|
-
const args = await (0,
|
|
3687
|
+
const args = await (0, import_provider_utils30.validateTypes)({
|
|
3555
3688
|
value: tool.args,
|
|
3556
3689
|
schema: webSearchPreviewArgsSchema
|
|
3557
3690
|
});
|
|
@@ -3563,7 +3696,7 @@ async function prepareResponsesTools({
|
|
|
3563
3696
|
break;
|
|
3564
3697
|
}
|
|
3565
3698
|
case "openai.web_search": {
|
|
3566
|
-
const args = await (0,
|
|
3699
|
+
const args = await (0, import_provider_utils30.validateTypes)({
|
|
3567
3700
|
value: tool.args,
|
|
3568
3701
|
schema: webSearchArgsSchema
|
|
3569
3702
|
});
|
|
@@ -3577,7 +3710,7 @@ async function prepareResponsesTools({
|
|
|
3577
3710
|
break;
|
|
3578
3711
|
}
|
|
3579
3712
|
case "openai.code_interpreter": {
|
|
3580
|
-
const args = await (0,
|
|
3713
|
+
const args = await (0, import_provider_utils30.validateTypes)({
|
|
3581
3714
|
value: tool.args,
|
|
3582
3715
|
schema: codeInterpreterArgsSchema
|
|
3583
3716
|
});
|
|
@@ -3588,7 +3721,7 @@ async function prepareResponsesTools({
|
|
|
3588
3721
|
break;
|
|
3589
3722
|
}
|
|
3590
3723
|
case "openai.image_generation": {
|
|
3591
|
-
const args = await (0,
|
|
3724
|
+
const args = await (0, import_provider_utils30.validateTypes)({
|
|
3592
3725
|
value: tool.args,
|
|
3593
3726
|
schema: imageGenerationArgsSchema
|
|
3594
3727
|
});
|
|
@@ -3611,7 +3744,7 @@ async function prepareResponsesTools({
|
|
|
3611
3744
|
break;
|
|
3612
3745
|
}
|
|
3613
3746
|
case "openai.mcp": {
|
|
3614
|
-
const args = await (0,
|
|
3747
|
+
const args = await (0, import_provider_utils30.validateTypes)({
|
|
3615
3748
|
value: tool.args,
|
|
3616
3749
|
schema: mcpArgsSchema
|
|
3617
3750
|
});
|
|
@@ -3654,7 +3787,7 @@ async function prepareResponsesTools({
|
|
|
3654
3787
|
case "tool":
|
|
3655
3788
|
return {
|
|
3656
3789
|
tools: openaiTools,
|
|
3657
|
-
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
3790
|
+
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" || toolChoice.toolName === "apply_patch" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
3658
3791
|
toolWarnings
|
|
3659
3792
|
};
|
|
3660
3793
|
default: {
|
|
@@ -3713,7 +3846,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3713
3846
|
if (stopSequences != null) {
|
|
3714
3847
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
3715
3848
|
}
|
|
3716
|
-
const openaiOptions = await (0,
|
|
3849
|
+
const openaiOptions = await (0, import_provider_utils31.parseProviderOptions)({
|
|
3717
3850
|
provider: "openai",
|
|
3718
3851
|
providerOptions,
|
|
3719
3852
|
schema: openaiResponsesProviderOptionsSchema
|
|
@@ -3725,7 +3858,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3725
3858
|
details: "conversation and previousResponseId cannot be used together"
|
|
3726
3859
|
});
|
|
3727
3860
|
}
|
|
3728
|
-
const toolNameMapping = (0,
|
|
3861
|
+
const toolNameMapping = (0, import_provider_utils31.createToolNameMapping)({
|
|
3729
3862
|
tools,
|
|
3730
3863
|
providerToolNames: {
|
|
3731
3864
|
"openai.code_interpreter": "code_interpreter",
|
|
@@ -3734,7 +3867,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3734
3867
|
"openai.local_shell": "local_shell",
|
|
3735
3868
|
"openai.web_search": "web_search",
|
|
3736
3869
|
"openai.web_search_preview": "web_search_preview",
|
|
3737
|
-
"openai.mcp": "mcp"
|
|
3870
|
+
"openai.mcp": "mcp",
|
|
3871
|
+
"openai.apply_patch": "apply_patch"
|
|
3738
3872
|
}
|
|
3739
3873
|
});
|
|
3740
3874
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
@@ -3743,7 +3877,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3743
3877
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
3744
3878
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
3745
3879
|
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
3746
|
-
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
3880
|
+
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
3881
|
+
hasApplyPatchTool: hasOpenAITool("openai.apply_patch")
|
|
3747
3882
|
});
|
|
3748
3883
|
warnings.push(...inputWarnings);
|
|
3749
3884
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
@@ -3912,12 +4047,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3912
4047
|
responseHeaders,
|
|
3913
4048
|
value: response,
|
|
3914
4049
|
rawValue: rawResponse
|
|
3915
|
-
} = await (0,
|
|
4050
|
+
} = await (0, import_provider_utils31.postJsonToApi)({
|
|
3916
4051
|
url,
|
|
3917
|
-
headers: (0,
|
|
4052
|
+
headers: (0, import_provider_utils31.combineHeaders)(this.config.headers(), options.headers),
|
|
3918
4053
|
body,
|
|
3919
4054
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
3920
|
-
successfulResponseHandler: (0,
|
|
4055
|
+
successfulResponseHandler: (0, import_provider_utils31.createJsonResponseHandler)(
|
|
3921
4056
|
openaiResponsesResponseSchema
|
|
3922
4057
|
),
|
|
3923
4058
|
abortSignal: options.abortSignal,
|
|
@@ -4014,7 +4149,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4014
4149
|
content.push({
|
|
4015
4150
|
type: "source",
|
|
4016
4151
|
sourceType: "url",
|
|
4017
|
-
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0,
|
|
4152
|
+
id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils31.generateId)(),
|
|
4018
4153
|
url: annotation.url,
|
|
4019
4154
|
title: annotation.title
|
|
4020
4155
|
});
|
|
@@ -4022,7 +4157,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4022
4157
|
content.push({
|
|
4023
4158
|
type: "source",
|
|
4024
4159
|
sourceType: "document",
|
|
4025
|
-
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0,
|
|
4160
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils31.generateId)(),
|
|
4026
4161
|
mediaType: "text/plain",
|
|
4027
4162
|
title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
|
|
4028
4163
|
filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
|
|
@@ -4038,7 +4173,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4038
4173
|
content.push({
|
|
4039
4174
|
type: "source",
|
|
4040
4175
|
sourceType: "document",
|
|
4041
|
-
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0,
|
|
4176
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils31.generateId)(),
|
|
4042
4177
|
mediaType: "text/plain",
|
|
4043
4178
|
title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
|
|
4044
4179
|
filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
|
|
@@ -4054,7 +4189,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4054
4189
|
content.push({
|
|
4055
4190
|
type: "source",
|
|
4056
4191
|
sourceType: "document",
|
|
4057
|
-
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0,
|
|
4192
|
+
id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils31.generateId)(),
|
|
4058
4193
|
mediaType: "application/octet-stream",
|
|
4059
4194
|
title: annotation.file_id,
|
|
4060
4195
|
filename: annotation.file_id,
|
|
@@ -4244,6 +4379,23 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4244
4379
|
});
|
|
4245
4380
|
break;
|
|
4246
4381
|
}
|
|
4382
|
+
case "apply_patch_call": {
|
|
4383
|
+
content.push({
|
|
4384
|
+
type: "tool-call",
|
|
4385
|
+
toolCallId: part.call_id,
|
|
4386
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4387
|
+
input: JSON.stringify({
|
|
4388
|
+
callId: part.call_id,
|
|
4389
|
+
operation: part.operation
|
|
4390
|
+
}),
|
|
4391
|
+
providerMetadata: {
|
|
4392
|
+
[providerKey]: {
|
|
4393
|
+
itemId: part.id
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
});
|
|
4397
|
+
break;
|
|
4398
|
+
}
|
|
4247
4399
|
}
|
|
4248
4400
|
}
|
|
4249
4401
|
const providerMetadata = {
|
|
@@ -4289,18 +4441,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4289
4441
|
toolNameMapping,
|
|
4290
4442
|
store
|
|
4291
4443
|
} = await this.getArgs(options);
|
|
4292
|
-
const { responseHeaders, value: response } = await (0,
|
|
4444
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils31.postJsonToApi)({
|
|
4293
4445
|
url: this.config.url({
|
|
4294
4446
|
path: "/responses",
|
|
4295
4447
|
modelId: this.modelId
|
|
4296
4448
|
}),
|
|
4297
|
-
headers: (0,
|
|
4449
|
+
headers: (0, import_provider_utils31.combineHeaders)(this.config.headers(), options.headers),
|
|
4298
4450
|
body: {
|
|
4299
4451
|
...body,
|
|
4300
4452
|
stream: true
|
|
4301
4453
|
},
|
|
4302
4454
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4303
|
-
successfulResponseHandler: (0,
|
|
4455
|
+
successfulResponseHandler: (0, import_provider_utils31.createEventSourceResponseHandler)(
|
|
4304
4456
|
openaiResponsesChunkSchema
|
|
4305
4457
|
),
|
|
4306
4458
|
abortSignal: options.abortSignal,
|
|
@@ -4431,6 +4583,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4431
4583
|
input: "{}",
|
|
4432
4584
|
providerExecuted: true
|
|
4433
4585
|
});
|
|
4586
|
+
} else if (value.item.type === "apply_patch_call") {
|
|
4587
|
+
ongoingToolCalls[value.output_index] = {
|
|
4588
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4589
|
+
toolCallId: value.item.call_id
|
|
4590
|
+
};
|
|
4591
|
+
if (value.item.status === "completed") {
|
|
4592
|
+
controller.enqueue({
|
|
4593
|
+
type: "tool-call",
|
|
4594
|
+
toolCallId: value.item.call_id,
|
|
4595
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4596
|
+
input: JSON.stringify({
|
|
4597
|
+
callId: value.item.call_id,
|
|
4598
|
+
operation: value.item.operation
|
|
4599
|
+
}),
|
|
4600
|
+
providerMetadata: {
|
|
4601
|
+
[providerKey]: {
|
|
4602
|
+
itemId: value.item.id
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
});
|
|
4606
|
+
}
|
|
4434
4607
|
} else if (value.item.type === "message") {
|
|
4435
4608
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
4436
4609
|
controller.enqueue({
|
|
@@ -4594,6 +4767,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4594
4767
|
...value.item.error != null ? { error: value.item.error } : {}
|
|
4595
4768
|
}
|
|
4596
4769
|
});
|
|
4770
|
+
} else if (value.item.type === "apply_patch_call") {
|
|
4771
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
4772
|
+
if (value.item.status === "completed") {
|
|
4773
|
+
controller.enqueue({
|
|
4774
|
+
type: "tool-call",
|
|
4775
|
+
toolCallId: value.item.call_id,
|
|
4776
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4777
|
+
input: JSON.stringify({
|
|
4778
|
+
callId: value.item.call_id,
|
|
4779
|
+
operation: value.item.operation
|
|
4780
|
+
}),
|
|
4781
|
+
providerMetadata: {
|
|
4782
|
+
[providerKey]: {
|
|
4783
|
+
itemId: value.item.id
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4786
|
+
});
|
|
4787
|
+
}
|
|
4597
4788
|
} else if (value.item.type === "mcp_approval_request") {
|
|
4598
4789
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4599
4790
|
controller.enqueue({
|
|
@@ -4791,7 +4982,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4791
4982
|
controller.enqueue({
|
|
4792
4983
|
type: "source",
|
|
4793
4984
|
sourceType: "url",
|
|
4794
|
-
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0,
|
|
4985
|
+
id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0, import_provider_utils31.generateId)(),
|
|
4795
4986
|
url: value.annotation.url,
|
|
4796
4987
|
title: value.annotation.title
|
|
4797
4988
|
});
|
|
@@ -4799,7 +4990,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4799
4990
|
controller.enqueue({
|
|
4800
4991
|
type: "source",
|
|
4801
4992
|
sourceType: "document",
|
|
4802
|
-
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0,
|
|
4993
|
+
id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils31.generateId)(),
|
|
4803
4994
|
mediaType: "text/plain",
|
|
4804
4995
|
title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
|
|
4805
4996
|
filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
|
|
@@ -4815,7 +5006,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4815
5006
|
controller.enqueue({
|
|
4816
5007
|
type: "source",
|
|
4817
5008
|
sourceType: "document",
|
|
4818
|
-
id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0,
|
|
5009
|
+
id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0, import_provider_utils31.generateId)(),
|
|
4819
5010
|
mediaType: "text/plain",
|
|
4820
5011
|
title: (_A = (_z = value.annotation.filename) != null ? _z : value.annotation.file_id) != null ? _A : "Document",
|
|
4821
5012
|
filename: (_B = value.annotation.filename) != null ? _B : value.annotation.file_id,
|
|
@@ -4831,7 +5022,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4831
5022
|
controller.enqueue({
|
|
4832
5023
|
type: "source",
|
|
4833
5024
|
sourceType: "document",
|
|
4834
|
-
id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0,
|
|
5025
|
+
id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0, import_provider_utils31.generateId)(),
|
|
4835
5026
|
mediaType: "application/octet-stream",
|
|
4836
5027
|
title: value.annotation.file_id,
|
|
4837
5028
|
filename: value.annotation.file_id,
|
|
@@ -4944,6 +5135,11 @@ function mapWebSearchOutput(action) {
|
|
|
4944
5135
|
OpenAIResponsesLanguageModel,
|
|
4945
5136
|
OpenAISpeechModel,
|
|
4946
5137
|
OpenAITranscriptionModel,
|
|
5138
|
+
applyPatch,
|
|
5139
|
+
applyPatchArgsSchema,
|
|
5140
|
+
applyPatchInputSchema,
|
|
5141
|
+
applyPatchOutputSchema,
|
|
5142
|
+
applyPatchToolFactory,
|
|
4947
5143
|
codeInterpreter,
|
|
4948
5144
|
codeInterpreterArgsSchema,
|
|
4949
5145
|
codeInterpreterInputSchema,
|