@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/index.mjs
CHANGED
|
@@ -2321,74 +2321,56 @@ var shell = createProviderToolFactoryWithOutputSchema6({
|
|
|
2321
2321
|
outputSchema: shellOutputSchema
|
|
2322
2322
|
});
|
|
2323
2323
|
|
|
2324
|
-
// src/tool/
|
|
2324
|
+
// src/tool/tool-search.ts
|
|
2325
2325
|
import {
|
|
2326
2326
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
2327
2327
|
lazySchema as lazySchema15,
|
|
2328
2328
|
zodSchema as zodSchema15
|
|
2329
2329
|
} from "@ai-sdk/provider-utils";
|
|
2330
2330
|
import { z as z16 } from "zod/v4";
|
|
2331
|
-
var
|
|
2331
|
+
var toolSearchArgsSchema = lazySchema15(
|
|
2332
2332
|
() => zodSchema15(
|
|
2333
2333
|
z16.object({
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
userLocation: z16.object({
|
|
2338
|
-
type: z16.literal("approximate"),
|
|
2339
|
-
country: z16.string().optional(),
|
|
2340
|
-
city: z16.string().optional(),
|
|
2341
|
-
region: z16.string().optional(),
|
|
2342
|
-
timezone: z16.string().optional()
|
|
2343
|
-
}).optional()
|
|
2334
|
+
execution: z16.enum(["server", "client"]).optional(),
|
|
2335
|
+
description: z16.string().optional(),
|
|
2336
|
+
parameters: z16.record(z16.string(), z16.unknown()).optional()
|
|
2344
2337
|
})
|
|
2345
2338
|
)
|
|
2346
2339
|
);
|
|
2347
|
-
var
|
|
2348
|
-
var webSearchOutputSchema = lazySchema15(
|
|
2340
|
+
var toolSearchInputSchema = lazySchema15(
|
|
2349
2341
|
() => zodSchema15(
|
|
2350
2342
|
z16.object({
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
type: z16.literal("search"),
|
|
2354
|
-
query: z16.string().optional()
|
|
2355
|
-
}),
|
|
2356
|
-
z16.object({
|
|
2357
|
-
type: z16.literal("openPage"),
|
|
2358
|
-
url: z16.string().nullish()
|
|
2359
|
-
}),
|
|
2360
|
-
z16.object({
|
|
2361
|
-
type: z16.literal("findInPage"),
|
|
2362
|
-
url: z16.string().nullish(),
|
|
2363
|
-
pattern: z16.string().nullish()
|
|
2364
|
-
})
|
|
2365
|
-
]).optional(),
|
|
2366
|
-
sources: z16.array(
|
|
2367
|
-
z16.discriminatedUnion("type", [
|
|
2368
|
-
z16.object({ type: z16.literal("url"), url: z16.string() }),
|
|
2369
|
-
z16.object({ type: z16.literal("api"), name: z16.string() })
|
|
2370
|
-
])
|
|
2371
|
-
).optional()
|
|
2343
|
+
arguments: z16.unknown().optional(),
|
|
2344
|
+
call_id: z16.string().nullish()
|
|
2372
2345
|
})
|
|
2373
2346
|
)
|
|
2374
2347
|
);
|
|
2375
|
-
var
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2348
|
+
var toolSearchOutputSchema = lazySchema15(
|
|
2349
|
+
() => zodSchema15(
|
|
2350
|
+
z16.object({
|
|
2351
|
+
tools: z16.array(z16.record(z16.string(), z16.unknown()))
|
|
2352
|
+
})
|
|
2353
|
+
)
|
|
2354
|
+
);
|
|
2355
|
+
var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema7({
|
|
2356
|
+
id: "openai.tool_search",
|
|
2357
|
+
inputSchema: toolSearchInputSchema,
|
|
2358
|
+
outputSchema: toolSearchOutputSchema
|
|
2379
2359
|
});
|
|
2380
|
-
var
|
|
2360
|
+
var toolSearch = (args = {}) => toolSearchToolFactory(args);
|
|
2381
2361
|
|
|
2382
|
-
// src/tool/web-search
|
|
2362
|
+
// src/tool/web-search.ts
|
|
2383
2363
|
import {
|
|
2384
2364
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
2385
2365
|
lazySchema as lazySchema16,
|
|
2386
2366
|
zodSchema as zodSchema16
|
|
2387
2367
|
} from "@ai-sdk/provider-utils";
|
|
2388
2368
|
import { z as z17 } from "zod/v4";
|
|
2389
|
-
var
|
|
2369
|
+
var webSearchArgsSchema = lazySchema16(
|
|
2390
2370
|
() => zodSchema16(
|
|
2391
2371
|
z17.object({
|
|
2372
|
+
externalWebAccess: z17.boolean().optional(),
|
|
2373
|
+
filters: z17.object({ allowedDomains: z17.array(z17.string()).optional() }).optional(),
|
|
2392
2374
|
searchContextSize: z17.enum(["low", "medium", "high"]).optional(),
|
|
2393
2375
|
userLocation: z17.object({
|
|
2394
2376
|
type: z17.literal("approximate"),
|
|
@@ -2400,10 +2382,8 @@ var webSearchPreviewArgsSchema = lazySchema16(
|
|
|
2400
2382
|
})
|
|
2401
2383
|
)
|
|
2402
2384
|
);
|
|
2403
|
-
var
|
|
2404
|
-
|
|
2405
|
-
);
|
|
2406
|
-
var webSearchPreviewOutputSchema = lazySchema16(
|
|
2385
|
+
var webSearchInputSchema = lazySchema16(() => zodSchema16(z17.object({})));
|
|
2386
|
+
var webSearchOutputSchema = lazySchema16(
|
|
2407
2387
|
() => zodSchema16(
|
|
2408
2388
|
z17.object({
|
|
2409
2389
|
action: z17.discriminatedUnion("type", [
|
|
@@ -2420,77 +2400,135 @@ var webSearchPreviewOutputSchema = lazySchema16(
|
|
|
2420
2400
|
url: z17.string().nullish(),
|
|
2421
2401
|
pattern: z17.string().nullish()
|
|
2422
2402
|
})
|
|
2423
|
-
]).optional()
|
|
2403
|
+
]).optional(),
|
|
2404
|
+
sources: z17.array(
|
|
2405
|
+
z17.discriminatedUnion("type", [
|
|
2406
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
2407
|
+
z17.object({ type: z17.literal("api"), name: z17.string() })
|
|
2408
|
+
])
|
|
2409
|
+
).optional()
|
|
2424
2410
|
})
|
|
2425
2411
|
)
|
|
2426
2412
|
);
|
|
2427
|
-
var
|
|
2428
|
-
id: "openai.
|
|
2429
|
-
inputSchema:
|
|
2430
|
-
outputSchema:
|
|
2413
|
+
var webSearchToolFactory = createProviderToolFactoryWithOutputSchema8({
|
|
2414
|
+
id: "openai.web_search",
|
|
2415
|
+
inputSchema: webSearchInputSchema,
|
|
2416
|
+
outputSchema: webSearchOutputSchema
|
|
2431
2417
|
});
|
|
2418
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2432
2419
|
|
|
2433
|
-
// src/tool/
|
|
2420
|
+
// src/tool/web-search-preview.ts
|
|
2434
2421
|
import {
|
|
2435
2422
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
2436
2423
|
lazySchema as lazySchema17,
|
|
2437
2424
|
zodSchema as zodSchema17
|
|
2438
2425
|
} from "@ai-sdk/provider-utils";
|
|
2439
2426
|
import { z as z18 } from "zod/v4";
|
|
2440
|
-
var
|
|
2441
|
-
() =>
|
|
2442
|
-
z18.
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2427
|
+
var webSearchPreviewArgsSchema = lazySchema17(
|
|
2428
|
+
() => zodSchema17(
|
|
2429
|
+
z18.object({
|
|
2430
|
+
searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
|
|
2431
|
+
userLocation: z18.object({
|
|
2432
|
+
type: z18.literal("approximate"),
|
|
2433
|
+
country: z18.string().optional(),
|
|
2434
|
+
city: z18.string().optional(),
|
|
2435
|
+
region: z18.string().optional(),
|
|
2436
|
+
timezone: z18.string().optional()
|
|
2437
|
+
}).optional()
|
|
2438
|
+
})
|
|
2439
|
+
)
|
|
2449
2440
|
);
|
|
2450
|
-
var
|
|
2441
|
+
var webSearchPreviewInputSchema = lazySchema17(
|
|
2442
|
+
() => zodSchema17(z18.object({}))
|
|
2443
|
+
);
|
|
2444
|
+
var webSearchPreviewOutputSchema = lazySchema17(
|
|
2451
2445
|
() => zodSchema17(
|
|
2452
2446
|
z18.object({
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2447
|
+
action: z18.discriminatedUnion("type", [
|
|
2448
|
+
z18.object({
|
|
2449
|
+
type: z18.literal("search"),
|
|
2450
|
+
query: z18.string().optional()
|
|
2451
|
+
}),
|
|
2452
|
+
z18.object({
|
|
2453
|
+
type: z18.literal("openPage"),
|
|
2454
|
+
url: z18.string().nullish()
|
|
2455
|
+
}),
|
|
2456
2456
|
z18.object({
|
|
2457
|
-
|
|
2458
|
-
|
|
2457
|
+
type: z18.literal("findInPage"),
|
|
2458
|
+
url: z18.string().nullish(),
|
|
2459
|
+
pattern: z18.string().nullish()
|
|
2460
|
+
})
|
|
2461
|
+
]).optional()
|
|
2462
|
+
})
|
|
2463
|
+
)
|
|
2464
|
+
);
|
|
2465
|
+
var webSearchPreview = createProviderToolFactoryWithOutputSchema9({
|
|
2466
|
+
id: "openai.web_search_preview",
|
|
2467
|
+
inputSchema: webSearchPreviewInputSchema,
|
|
2468
|
+
outputSchema: webSearchPreviewOutputSchema
|
|
2469
|
+
});
|
|
2470
|
+
|
|
2471
|
+
// src/tool/mcp.ts
|
|
2472
|
+
import {
|
|
2473
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
|
|
2474
|
+
lazySchema as lazySchema18,
|
|
2475
|
+
zodSchema as zodSchema18
|
|
2476
|
+
} from "@ai-sdk/provider-utils";
|
|
2477
|
+
import { z as z19 } from "zod/v4";
|
|
2478
|
+
var jsonValueSchema = z19.lazy(
|
|
2479
|
+
() => z19.union([
|
|
2480
|
+
z19.string(),
|
|
2481
|
+
z19.number(),
|
|
2482
|
+
z19.boolean(),
|
|
2483
|
+
z19.null(),
|
|
2484
|
+
z19.array(jsonValueSchema),
|
|
2485
|
+
z19.record(z19.string(), jsonValueSchema)
|
|
2486
|
+
])
|
|
2487
|
+
);
|
|
2488
|
+
var mcpArgsSchema = lazySchema18(
|
|
2489
|
+
() => zodSchema18(
|
|
2490
|
+
z19.object({
|
|
2491
|
+
serverLabel: z19.string(),
|
|
2492
|
+
allowedTools: z19.union([
|
|
2493
|
+
z19.array(z19.string()),
|
|
2494
|
+
z19.object({
|
|
2495
|
+
readOnly: z19.boolean().optional(),
|
|
2496
|
+
toolNames: z19.array(z19.string()).optional()
|
|
2459
2497
|
})
|
|
2460
2498
|
]).optional(),
|
|
2461
|
-
authorization:
|
|
2462
|
-
connectorId:
|
|
2463
|
-
headers:
|
|
2464
|
-
requireApproval:
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
never:
|
|
2468
|
-
toolNames:
|
|
2499
|
+
authorization: z19.string().optional(),
|
|
2500
|
+
connectorId: z19.string().optional(),
|
|
2501
|
+
headers: z19.record(z19.string(), z19.string()).optional(),
|
|
2502
|
+
requireApproval: z19.union([
|
|
2503
|
+
z19.enum(["always", "never"]),
|
|
2504
|
+
z19.object({
|
|
2505
|
+
never: z19.object({
|
|
2506
|
+
toolNames: z19.array(z19.string()).optional()
|
|
2469
2507
|
}).optional()
|
|
2470
2508
|
})
|
|
2471
2509
|
]).optional(),
|
|
2472
|
-
serverDescription:
|
|
2473
|
-
serverUrl:
|
|
2510
|
+
serverDescription: z19.string().optional(),
|
|
2511
|
+
serverUrl: z19.string().optional()
|
|
2474
2512
|
}).refine(
|
|
2475
2513
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2476
2514
|
"One of serverUrl or connectorId must be provided."
|
|
2477
2515
|
)
|
|
2478
2516
|
)
|
|
2479
2517
|
);
|
|
2480
|
-
var mcpInputSchema =
|
|
2481
|
-
var mcpOutputSchema =
|
|
2482
|
-
() =>
|
|
2483
|
-
|
|
2484
|
-
type:
|
|
2485
|
-
serverLabel:
|
|
2486
|
-
name:
|
|
2487
|
-
arguments:
|
|
2488
|
-
output:
|
|
2489
|
-
error:
|
|
2518
|
+
var mcpInputSchema = lazySchema18(() => zodSchema18(z19.object({})));
|
|
2519
|
+
var mcpOutputSchema = lazySchema18(
|
|
2520
|
+
() => zodSchema18(
|
|
2521
|
+
z19.object({
|
|
2522
|
+
type: z19.literal("call"),
|
|
2523
|
+
serverLabel: z19.string(),
|
|
2524
|
+
name: z19.string(),
|
|
2525
|
+
arguments: z19.string(),
|
|
2526
|
+
output: z19.string().nullish(),
|
|
2527
|
+
error: z19.union([z19.string(), jsonValueSchema]).optional()
|
|
2490
2528
|
})
|
|
2491
2529
|
)
|
|
2492
2530
|
);
|
|
2493
|
-
var mcpToolFactory =
|
|
2531
|
+
var mcpToolFactory = createProviderToolFactoryWithOutputSchema10({
|
|
2494
2532
|
id: "openai.mcp",
|
|
2495
2533
|
inputSchema: mcpInputSchema,
|
|
2496
2534
|
outputSchema: mcpOutputSchema
|
|
@@ -2602,7 +2640,17 @@ var openaiTools = {
|
|
|
2602
2640
|
* @param serverDescription - Optional description of the server.
|
|
2603
2641
|
* @param serverUrl - URL for the MCP server.
|
|
2604
2642
|
*/
|
|
2605
|
-
mcp
|
|
2643
|
+
mcp,
|
|
2644
|
+
/**
|
|
2645
|
+
* Tool search allows the model to dynamically search for and load deferred
|
|
2646
|
+
* tools into the model's context as needed. This helps reduce overall token
|
|
2647
|
+
* usage, cost, and latency by only loading tools when the model needs them.
|
|
2648
|
+
*
|
|
2649
|
+
* To use tool search, mark functions or namespaces with `defer_loading: true`
|
|
2650
|
+
* in the tools array. The model will use tool search to load these tools
|
|
2651
|
+
* when it determines they are needed.
|
|
2652
|
+
*/
|
|
2653
|
+
toolSearch
|
|
2606
2654
|
};
|
|
2607
2655
|
|
|
2608
2656
|
// src/responses/openai-responses-language-model.ts
|
|
@@ -2665,10 +2713,11 @@ import {
|
|
|
2665
2713
|
import {
|
|
2666
2714
|
convertToBase64 as convertToBase642,
|
|
2667
2715
|
isNonNullable,
|
|
2716
|
+
parseJSON,
|
|
2668
2717
|
parseProviderOptions as parseProviderOptions4,
|
|
2669
2718
|
validateTypes
|
|
2670
2719
|
} from "@ai-sdk/provider-utils";
|
|
2671
|
-
import { z as
|
|
2720
|
+
import { z as z20 } from "zod/v4";
|
|
2672
2721
|
function isFileId(data, prefixes) {
|
|
2673
2722
|
if (!prefixes) return false;
|
|
2674
2723
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2686,7 +2735,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2686
2735
|
hasApplyPatchTool = false,
|
|
2687
2736
|
customProviderToolNames
|
|
2688
2737
|
}) {
|
|
2689
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2738
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2690
2739
|
let input = [];
|
|
2691
2740
|
const warnings = [];
|
|
2692
2741
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -2790,6 +2839,32 @@ async function convertToOpenAIResponsesInput({
|
|
|
2790
2839
|
if (hasConversation && id != null) {
|
|
2791
2840
|
break;
|
|
2792
2841
|
}
|
|
2842
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2843
|
+
part.toolName
|
|
2844
|
+
);
|
|
2845
|
+
if (resolvedToolName === "tool_search") {
|
|
2846
|
+
if (store && id != null) {
|
|
2847
|
+
input.push({ type: "item_reference", id });
|
|
2848
|
+
break;
|
|
2849
|
+
}
|
|
2850
|
+
const parsedInput = typeof part.input === "string" ? await parseJSON({
|
|
2851
|
+
text: part.input,
|
|
2852
|
+
schema: toolSearchInputSchema
|
|
2853
|
+
}) : await validateTypes({
|
|
2854
|
+
value: part.input,
|
|
2855
|
+
schema: toolSearchInputSchema
|
|
2856
|
+
});
|
|
2857
|
+
const execution = parsedInput.call_id != null ? "client" : "server";
|
|
2858
|
+
input.push({
|
|
2859
|
+
type: "tool_search_call",
|
|
2860
|
+
id: id != null ? id : part.toolCallId,
|
|
2861
|
+
execution,
|
|
2862
|
+
call_id: (_g = parsedInput.call_id) != null ? _g : null,
|
|
2863
|
+
status: "completed",
|
|
2864
|
+
arguments: parsedInput.arguments
|
|
2865
|
+
});
|
|
2866
|
+
break;
|
|
2867
|
+
}
|
|
2793
2868
|
if (part.providerExecuted) {
|
|
2794
2869
|
if (store && id != null) {
|
|
2795
2870
|
input.push({ type: "item_reference", id });
|
|
@@ -2800,9 +2875,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2800
2875
|
input.push({ type: "item_reference", id });
|
|
2801
2876
|
break;
|
|
2802
2877
|
}
|
|
2803
|
-
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2804
|
-
part.toolName
|
|
2805
|
-
);
|
|
2806
2878
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2807
2879
|
const parsedInput = await validateTypes({
|
|
2808
2880
|
value: part.input,
|
|
@@ -2885,6 +2957,26 @@ async function convertToOpenAIResponsesInput({
|
|
|
2885
2957
|
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
2886
2958
|
part.toolName
|
|
2887
2959
|
);
|
|
2960
|
+
if (resolvedResultToolName === "tool_search") {
|
|
2961
|
+
const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2962
|
+
if (store) {
|
|
2963
|
+
input.push({ type: "item_reference", id: itemId });
|
|
2964
|
+
} else if (part.output.type === "json") {
|
|
2965
|
+
const parsedOutput = await validateTypes({
|
|
2966
|
+
value: part.output.value,
|
|
2967
|
+
schema: toolSearchOutputSchema
|
|
2968
|
+
});
|
|
2969
|
+
input.push({
|
|
2970
|
+
type: "tool_search_output",
|
|
2971
|
+
id: itemId,
|
|
2972
|
+
execution: "server",
|
|
2973
|
+
call_id: null,
|
|
2974
|
+
status: "completed",
|
|
2975
|
+
tools: parsedOutput.tools
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
break;
|
|
2979
|
+
}
|
|
2888
2980
|
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2889
2981
|
if (part.output.type === "json") {
|
|
2890
2982
|
const parsedOutput = await validateTypes({
|
|
@@ -2907,7 +2999,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2907
2999
|
break;
|
|
2908
3000
|
}
|
|
2909
3001
|
if (store) {
|
|
2910
|
-
const itemId = (
|
|
3002
|
+
const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
|
|
2911
3003
|
input.push({ type: "item_reference", id: itemId });
|
|
2912
3004
|
} else {
|
|
2913
3005
|
warnings.push({
|
|
@@ -3017,7 +3109,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3017
3109
|
}
|
|
3018
3110
|
const output = part.output;
|
|
3019
3111
|
if (output.type === "execution-denied") {
|
|
3020
|
-
const approvalId = (
|
|
3112
|
+
const approvalId = (_o = (_n = output.providerOptions) == null ? void 0 : _n.openai) == null ? void 0 : _o.approvalId;
|
|
3021
3113
|
if (approvalId) {
|
|
3022
3114
|
continue;
|
|
3023
3115
|
}
|
|
@@ -3025,6 +3117,20 @@ async function convertToOpenAIResponsesInput({
|
|
|
3025
3117
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
3026
3118
|
part.toolName
|
|
3027
3119
|
);
|
|
3120
|
+
if (resolvedToolName === "tool_search" && output.type === "json") {
|
|
3121
|
+
const parsedOutput = await validateTypes({
|
|
3122
|
+
value: output.value,
|
|
3123
|
+
schema: toolSearchOutputSchema
|
|
3124
|
+
});
|
|
3125
|
+
input.push({
|
|
3126
|
+
type: "tool_search_output",
|
|
3127
|
+
execution: "client",
|
|
3128
|
+
call_id: part.toolCallId,
|
|
3129
|
+
status: "completed",
|
|
3130
|
+
tools: parsedOutput.tools
|
|
3131
|
+
});
|
|
3132
|
+
continue;
|
|
3133
|
+
}
|
|
3028
3134
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
3029
3135
|
const parsedOutput = await validateTypes({
|
|
3030
3136
|
value: output.value,
|
|
@@ -3077,7 +3183,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3077
3183
|
outputValue = output.value;
|
|
3078
3184
|
break;
|
|
3079
3185
|
case "execution-denied":
|
|
3080
|
-
outputValue = (
|
|
3186
|
+
outputValue = (_p = output.reason) != null ? _p : "Tool execution denied.";
|
|
3081
3187
|
break;
|
|
3082
3188
|
case "json":
|
|
3083
3189
|
case "error-json":
|
|
@@ -3131,7 +3237,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3131
3237
|
contentValue = output.value;
|
|
3132
3238
|
break;
|
|
3133
3239
|
case "execution-denied":
|
|
3134
|
-
contentValue = (
|
|
3240
|
+
contentValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
|
|
3135
3241
|
break;
|
|
3136
3242
|
case "json":
|
|
3137
3243
|
case "error-json":
|
|
@@ -3201,9 +3307,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
3201
3307
|
}
|
|
3202
3308
|
return { input, warnings };
|
|
3203
3309
|
}
|
|
3204
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3205
|
-
itemId:
|
|
3206
|
-
reasoningEncryptedContent:
|
|
3310
|
+
var openaiResponsesReasoningProviderOptionsSchema = z20.object({
|
|
3311
|
+
itemId: z20.string().nullish(),
|
|
3312
|
+
reasoningEncryptedContent: z20.string().nullish()
|
|
3207
3313
|
});
|
|
3208
3314
|
|
|
3209
3315
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3225,483 +3331,525 @@ function mapOpenAIResponseFinishReason({
|
|
|
3225
3331
|
}
|
|
3226
3332
|
|
|
3227
3333
|
// src/responses/openai-responses-api.ts
|
|
3228
|
-
import { lazySchema as
|
|
3229
|
-
import { z as
|
|
3230
|
-
var
|
|
3231
|
-
() =>
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3334
|
+
import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
|
|
3335
|
+
import { z as z21 } from "zod/v4";
|
|
3336
|
+
var jsonValueSchema2 = z21.lazy(
|
|
3337
|
+
() => z21.union([
|
|
3338
|
+
z21.string(),
|
|
3339
|
+
z21.number(),
|
|
3340
|
+
z21.boolean(),
|
|
3341
|
+
z21.null(),
|
|
3342
|
+
z21.array(jsonValueSchema2),
|
|
3343
|
+
z21.record(z21.string(), jsonValueSchema2.optional())
|
|
3344
|
+
])
|
|
3345
|
+
);
|
|
3346
|
+
var openaiResponsesChunkSchema = lazySchema19(
|
|
3347
|
+
() => zodSchema19(
|
|
3348
|
+
z21.union([
|
|
3349
|
+
z21.object({
|
|
3350
|
+
type: z21.literal("response.output_text.delta"),
|
|
3351
|
+
item_id: z21.string(),
|
|
3352
|
+
delta: z21.string(),
|
|
3353
|
+
logprobs: z21.array(
|
|
3354
|
+
z21.object({
|
|
3355
|
+
token: z21.string(),
|
|
3356
|
+
logprob: z21.number(),
|
|
3357
|
+
top_logprobs: z21.array(
|
|
3358
|
+
z21.object({
|
|
3359
|
+
token: z21.string(),
|
|
3360
|
+
logprob: z21.number()
|
|
3245
3361
|
})
|
|
3246
3362
|
)
|
|
3247
3363
|
})
|
|
3248
3364
|
).nullish()
|
|
3249
3365
|
}),
|
|
3250
|
-
|
|
3251
|
-
type:
|
|
3252
|
-
response:
|
|
3253
|
-
incomplete_details:
|
|
3254
|
-
usage:
|
|
3255
|
-
input_tokens:
|
|
3256
|
-
input_tokens_details:
|
|
3257
|
-
output_tokens:
|
|
3258
|
-
output_tokens_details:
|
|
3366
|
+
z21.object({
|
|
3367
|
+
type: z21.enum(["response.completed", "response.incomplete"]),
|
|
3368
|
+
response: z21.object({
|
|
3369
|
+
incomplete_details: z21.object({ reason: z21.string() }).nullish(),
|
|
3370
|
+
usage: z21.object({
|
|
3371
|
+
input_tokens: z21.number(),
|
|
3372
|
+
input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
|
|
3373
|
+
output_tokens: z21.number(),
|
|
3374
|
+
output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
|
|
3259
3375
|
}),
|
|
3260
|
-
service_tier:
|
|
3376
|
+
service_tier: z21.string().nullish()
|
|
3261
3377
|
})
|
|
3262
3378
|
}),
|
|
3263
|
-
|
|
3264
|
-
type:
|
|
3265
|
-
response:
|
|
3266
|
-
id:
|
|
3267
|
-
created_at:
|
|
3268
|
-
model:
|
|
3269
|
-
service_tier:
|
|
3379
|
+
z21.object({
|
|
3380
|
+
type: z21.literal("response.created"),
|
|
3381
|
+
response: z21.object({
|
|
3382
|
+
id: z21.string(),
|
|
3383
|
+
created_at: z21.number(),
|
|
3384
|
+
model: z21.string(),
|
|
3385
|
+
service_tier: z21.string().nullish()
|
|
3270
3386
|
})
|
|
3271
3387
|
}),
|
|
3272
|
-
|
|
3273
|
-
type:
|
|
3274
|
-
output_index:
|
|
3275
|
-
item:
|
|
3276
|
-
|
|
3277
|
-
type:
|
|
3278
|
-
id:
|
|
3279
|
-
phase:
|
|
3388
|
+
z21.object({
|
|
3389
|
+
type: z21.literal("response.output_item.added"),
|
|
3390
|
+
output_index: z21.number(),
|
|
3391
|
+
item: z21.discriminatedUnion("type", [
|
|
3392
|
+
z21.object({
|
|
3393
|
+
type: z21.literal("message"),
|
|
3394
|
+
id: z21.string(),
|
|
3395
|
+
phase: z21.enum(["commentary", "final_answer"]).nullish()
|
|
3280
3396
|
}),
|
|
3281
|
-
|
|
3282
|
-
type:
|
|
3283
|
-
id:
|
|
3284
|
-
encrypted_content:
|
|
3397
|
+
z21.object({
|
|
3398
|
+
type: z21.literal("reasoning"),
|
|
3399
|
+
id: z21.string(),
|
|
3400
|
+
encrypted_content: z21.string().nullish()
|
|
3285
3401
|
}),
|
|
3286
|
-
|
|
3287
|
-
type:
|
|
3288
|
-
id:
|
|
3289
|
-
call_id:
|
|
3290
|
-
name:
|
|
3291
|
-
arguments:
|
|
3402
|
+
z21.object({
|
|
3403
|
+
type: z21.literal("function_call"),
|
|
3404
|
+
id: z21.string(),
|
|
3405
|
+
call_id: z21.string(),
|
|
3406
|
+
name: z21.string(),
|
|
3407
|
+
arguments: z21.string()
|
|
3292
3408
|
}),
|
|
3293
|
-
|
|
3294
|
-
type:
|
|
3295
|
-
id:
|
|
3296
|
-
status:
|
|
3409
|
+
z21.object({
|
|
3410
|
+
type: z21.literal("web_search_call"),
|
|
3411
|
+
id: z21.string(),
|
|
3412
|
+
status: z21.string()
|
|
3297
3413
|
}),
|
|
3298
|
-
|
|
3299
|
-
type:
|
|
3300
|
-
id:
|
|
3301
|
-
status:
|
|
3414
|
+
z21.object({
|
|
3415
|
+
type: z21.literal("computer_call"),
|
|
3416
|
+
id: z21.string(),
|
|
3417
|
+
status: z21.string()
|
|
3302
3418
|
}),
|
|
3303
|
-
|
|
3304
|
-
type:
|
|
3305
|
-
id:
|
|
3419
|
+
z21.object({
|
|
3420
|
+
type: z21.literal("file_search_call"),
|
|
3421
|
+
id: z21.string()
|
|
3306
3422
|
}),
|
|
3307
|
-
|
|
3308
|
-
type:
|
|
3309
|
-
id:
|
|
3423
|
+
z21.object({
|
|
3424
|
+
type: z21.literal("image_generation_call"),
|
|
3425
|
+
id: z21.string()
|
|
3310
3426
|
}),
|
|
3311
|
-
|
|
3312
|
-
type:
|
|
3313
|
-
id:
|
|
3314
|
-
container_id:
|
|
3315
|
-
code:
|
|
3316
|
-
outputs:
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3427
|
+
z21.object({
|
|
3428
|
+
type: z21.literal("code_interpreter_call"),
|
|
3429
|
+
id: z21.string(),
|
|
3430
|
+
container_id: z21.string(),
|
|
3431
|
+
code: z21.string().nullable(),
|
|
3432
|
+
outputs: z21.array(
|
|
3433
|
+
z21.discriminatedUnion("type", [
|
|
3434
|
+
z21.object({ type: z21.literal("logs"), logs: z21.string() }),
|
|
3435
|
+
z21.object({ type: z21.literal("image"), url: z21.string() })
|
|
3320
3436
|
])
|
|
3321
3437
|
).nullable(),
|
|
3322
|
-
status:
|
|
3438
|
+
status: z21.string()
|
|
3323
3439
|
}),
|
|
3324
|
-
|
|
3325
|
-
type:
|
|
3326
|
-
id:
|
|
3327
|
-
status:
|
|
3328
|
-
approval_request_id:
|
|
3440
|
+
z21.object({
|
|
3441
|
+
type: z21.literal("mcp_call"),
|
|
3442
|
+
id: z21.string(),
|
|
3443
|
+
status: z21.string(),
|
|
3444
|
+
approval_request_id: z21.string().nullish()
|
|
3329
3445
|
}),
|
|
3330
|
-
|
|
3331
|
-
type:
|
|
3332
|
-
id:
|
|
3446
|
+
z21.object({
|
|
3447
|
+
type: z21.literal("mcp_list_tools"),
|
|
3448
|
+
id: z21.string()
|
|
3333
3449
|
}),
|
|
3334
|
-
|
|
3335
|
-
type:
|
|
3336
|
-
id:
|
|
3450
|
+
z21.object({
|
|
3451
|
+
type: z21.literal("mcp_approval_request"),
|
|
3452
|
+
id: z21.string()
|
|
3337
3453
|
}),
|
|
3338
|
-
|
|
3339
|
-
type:
|
|
3340
|
-
id:
|
|
3341
|
-
call_id:
|
|
3342
|
-
status:
|
|
3343
|
-
operation:
|
|
3344
|
-
|
|
3345
|
-
type:
|
|
3346
|
-
path:
|
|
3347
|
-
diff:
|
|
3454
|
+
z21.object({
|
|
3455
|
+
type: z21.literal("apply_patch_call"),
|
|
3456
|
+
id: z21.string(),
|
|
3457
|
+
call_id: z21.string(),
|
|
3458
|
+
status: z21.enum(["in_progress", "completed"]),
|
|
3459
|
+
operation: z21.discriminatedUnion("type", [
|
|
3460
|
+
z21.object({
|
|
3461
|
+
type: z21.literal("create_file"),
|
|
3462
|
+
path: z21.string(),
|
|
3463
|
+
diff: z21.string()
|
|
3348
3464
|
}),
|
|
3349
|
-
|
|
3350
|
-
type:
|
|
3351
|
-
path:
|
|
3465
|
+
z21.object({
|
|
3466
|
+
type: z21.literal("delete_file"),
|
|
3467
|
+
path: z21.string()
|
|
3352
3468
|
}),
|
|
3353
|
-
|
|
3354
|
-
type:
|
|
3355
|
-
path:
|
|
3356
|
-
diff:
|
|
3469
|
+
z21.object({
|
|
3470
|
+
type: z21.literal("update_file"),
|
|
3471
|
+
path: z21.string(),
|
|
3472
|
+
diff: z21.string()
|
|
3357
3473
|
})
|
|
3358
3474
|
])
|
|
3359
3475
|
}),
|
|
3360
|
-
|
|
3361
|
-
type:
|
|
3362
|
-
id:
|
|
3363
|
-
call_id:
|
|
3364
|
-
name:
|
|
3365
|
-
input:
|
|
3476
|
+
z21.object({
|
|
3477
|
+
type: z21.literal("custom_tool_call"),
|
|
3478
|
+
id: z21.string(),
|
|
3479
|
+
call_id: z21.string(),
|
|
3480
|
+
name: z21.string(),
|
|
3481
|
+
input: z21.string()
|
|
3366
3482
|
}),
|
|
3367
|
-
|
|
3368
|
-
type:
|
|
3369
|
-
id:
|
|
3370
|
-
call_id:
|
|
3371
|
-
status:
|
|
3372
|
-
action:
|
|
3373
|
-
commands:
|
|
3483
|
+
z21.object({
|
|
3484
|
+
type: z21.literal("shell_call"),
|
|
3485
|
+
id: z21.string(),
|
|
3486
|
+
call_id: z21.string(),
|
|
3487
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3488
|
+
action: z21.object({
|
|
3489
|
+
commands: z21.array(z21.string())
|
|
3374
3490
|
})
|
|
3375
3491
|
}),
|
|
3376
|
-
|
|
3377
|
-
type:
|
|
3378
|
-
id:
|
|
3379
|
-
call_id:
|
|
3380
|
-
status:
|
|
3381
|
-
output:
|
|
3382
|
-
|
|
3383
|
-
stdout:
|
|
3384
|
-
stderr:
|
|
3385
|
-
outcome:
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
type:
|
|
3389
|
-
exit_code:
|
|
3492
|
+
z21.object({
|
|
3493
|
+
type: z21.literal("shell_call_output"),
|
|
3494
|
+
id: z21.string(),
|
|
3495
|
+
call_id: z21.string(),
|
|
3496
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3497
|
+
output: z21.array(
|
|
3498
|
+
z21.object({
|
|
3499
|
+
stdout: z21.string(),
|
|
3500
|
+
stderr: z21.string(),
|
|
3501
|
+
outcome: z21.discriminatedUnion("type", [
|
|
3502
|
+
z21.object({ type: z21.literal("timeout") }),
|
|
3503
|
+
z21.object({
|
|
3504
|
+
type: z21.literal("exit"),
|
|
3505
|
+
exit_code: z21.number()
|
|
3390
3506
|
})
|
|
3391
3507
|
])
|
|
3392
3508
|
})
|
|
3393
3509
|
)
|
|
3510
|
+
}),
|
|
3511
|
+
z21.object({
|
|
3512
|
+
type: z21.literal("tool_search_call"),
|
|
3513
|
+
id: z21.string(),
|
|
3514
|
+
execution: z21.enum(["server", "client"]),
|
|
3515
|
+
call_id: z21.string().nullable(),
|
|
3516
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3517
|
+
arguments: z21.unknown()
|
|
3518
|
+
}),
|
|
3519
|
+
z21.object({
|
|
3520
|
+
type: z21.literal("tool_search_output"),
|
|
3521
|
+
id: z21.string(),
|
|
3522
|
+
execution: z21.enum(["server", "client"]),
|
|
3523
|
+
call_id: z21.string().nullable(),
|
|
3524
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3525
|
+
tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
|
|
3394
3526
|
})
|
|
3395
3527
|
])
|
|
3396
3528
|
}),
|
|
3397
|
-
|
|
3398
|
-
type:
|
|
3399
|
-
output_index:
|
|
3400
|
-
item:
|
|
3401
|
-
|
|
3402
|
-
type:
|
|
3403
|
-
id:
|
|
3404
|
-
phase:
|
|
3529
|
+
z21.object({
|
|
3530
|
+
type: z21.literal("response.output_item.done"),
|
|
3531
|
+
output_index: z21.number(),
|
|
3532
|
+
item: z21.discriminatedUnion("type", [
|
|
3533
|
+
z21.object({
|
|
3534
|
+
type: z21.literal("message"),
|
|
3535
|
+
id: z21.string(),
|
|
3536
|
+
phase: z21.enum(["commentary", "final_answer"]).nullish()
|
|
3405
3537
|
}),
|
|
3406
|
-
|
|
3407
|
-
type:
|
|
3408
|
-
id:
|
|
3409
|
-
encrypted_content:
|
|
3538
|
+
z21.object({
|
|
3539
|
+
type: z21.literal("reasoning"),
|
|
3540
|
+
id: z21.string(),
|
|
3541
|
+
encrypted_content: z21.string().nullish()
|
|
3410
3542
|
}),
|
|
3411
|
-
|
|
3412
|
-
type:
|
|
3413
|
-
id:
|
|
3414
|
-
call_id:
|
|
3415
|
-
name:
|
|
3416
|
-
arguments:
|
|
3417
|
-
status:
|
|
3543
|
+
z21.object({
|
|
3544
|
+
type: z21.literal("function_call"),
|
|
3545
|
+
id: z21.string(),
|
|
3546
|
+
call_id: z21.string(),
|
|
3547
|
+
name: z21.string(),
|
|
3548
|
+
arguments: z21.string(),
|
|
3549
|
+
status: z21.literal("completed")
|
|
3418
3550
|
}),
|
|
3419
|
-
|
|
3420
|
-
type:
|
|
3421
|
-
id:
|
|
3422
|
-
call_id:
|
|
3423
|
-
name:
|
|
3424
|
-
input:
|
|
3425
|
-
status:
|
|
3551
|
+
z21.object({
|
|
3552
|
+
type: z21.literal("custom_tool_call"),
|
|
3553
|
+
id: z21.string(),
|
|
3554
|
+
call_id: z21.string(),
|
|
3555
|
+
name: z21.string(),
|
|
3556
|
+
input: z21.string(),
|
|
3557
|
+
status: z21.literal("completed")
|
|
3426
3558
|
}),
|
|
3427
|
-
|
|
3428
|
-
type:
|
|
3429
|
-
id:
|
|
3430
|
-
code:
|
|
3431
|
-
container_id:
|
|
3432
|
-
outputs:
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3559
|
+
z21.object({
|
|
3560
|
+
type: z21.literal("code_interpreter_call"),
|
|
3561
|
+
id: z21.string(),
|
|
3562
|
+
code: z21.string().nullable(),
|
|
3563
|
+
container_id: z21.string(),
|
|
3564
|
+
outputs: z21.array(
|
|
3565
|
+
z21.discriminatedUnion("type", [
|
|
3566
|
+
z21.object({ type: z21.literal("logs"), logs: z21.string() }),
|
|
3567
|
+
z21.object({ type: z21.literal("image"), url: z21.string() })
|
|
3436
3568
|
])
|
|
3437
3569
|
).nullable()
|
|
3438
3570
|
}),
|
|
3439
|
-
|
|
3440
|
-
type:
|
|
3441
|
-
id:
|
|
3442
|
-
result:
|
|
3571
|
+
z21.object({
|
|
3572
|
+
type: z21.literal("image_generation_call"),
|
|
3573
|
+
id: z21.string(),
|
|
3574
|
+
result: z21.string()
|
|
3443
3575
|
}),
|
|
3444
|
-
|
|
3445
|
-
type:
|
|
3446
|
-
id:
|
|
3447
|
-
status:
|
|
3448
|
-
action:
|
|
3449
|
-
|
|
3450
|
-
type:
|
|
3451
|
-
query:
|
|
3452
|
-
sources:
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3576
|
+
z21.object({
|
|
3577
|
+
type: z21.literal("web_search_call"),
|
|
3578
|
+
id: z21.string(),
|
|
3579
|
+
status: z21.string(),
|
|
3580
|
+
action: z21.discriminatedUnion("type", [
|
|
3581
|
+
z21.object({
|
|
3582
|
+
type: z21.literal("search"),
|
|
3583
|
+
query: z21.string().nullish(),
|
|
3584
|
+
sources: z21.array(
|
|
3585
|
+
z21.discriminatedUnion("type", [
|
|
3586
|
+
z21.object({ type: z21.literal("url"), url: z21.string() }),
|
|
3587
|
+
z21.object({ type: z21.literal("api"), name: z21.string() })
|
|
3456
3588
|
])
|
|
3457
3589
|
).nullish()
|
|
3458
3590
|
}),
|
|
3459
|
-
|
|
3460
|
-
type:
|
|
3461
|
-
url:
|
|
3591
|
+
z21.object({
|
|
3592
|
+
type: z21.literal("open_page"),
|
|
3593
|
+
url: z21.string().nullish()
|
|
3462
3594
|
}),
|
|
3463
|
-
|
|
3464
|
-
type:
|
|
3465
|
-
url:
|
|
3466
|
-
pattern:
|
|
3595
|
+
z21.object({
|
|
3596
|
+
type: z21.literal("find_in_page"),
|
|
3597
|
+
url: z21.string().nullish(),
|
|
3598
|
+
pattern: z21.string().nullish()
|
|
3467
3599
|
})
|
|
3468
3600
|
]).nullish()
|
|
3469
3601
|
}),
|
|
3470
|
-
|
|
3471
|
-
type:
|
|
3472
|
-
id:
|
|
3473
|
-
queries:
|
|
3474
|
-
results:
|
|
3475
|
-
|
|
3476
|
-
attributes:
|
|
3477
|
-
|
|
3478
|
-
|
|
3602
|
+
z21.object({
|
|
3603
|
+
type: z21.literal("file_search_call"),
|
|
3604
|
+
id: z21.string(),
|
|
3605
|
+
queries: z21.array(z21.string()),
|
|
3606
|
+
results: z21.array(
|
|
3607
|
+
z21.object({
|
|
3608
|
+
attributes: z21.record(
|
|
3609
|
+
z21.string(),
|
|
3610
|
+
z21.union([z21.string(), z21.number(), z21.boolean()])
|
|
3479
3611
|
),
|
|
3480
|
-
file_id:
|
|
3481
|
-
filename:
|
|
3482
|
-
score:
|
|
3483
|
-
text:
|
|
3612
|
+
file_id: z21.string(),
|
|
3613
|
+
filename: z21.string(),
|
|
3614
|
+
score: z21.number(),
|
|
3615
|
+
text: z21.string()
|
|
3484
3616
|
})
|
|
3485
3617
|
).nullish()
|
|
3486
3618
|
}),
|
|
3487
|
-
|
|
3488
|
-
type:
|
|
3489
|
-
id:
|
|
3490
|
-
call_id:
|
|
3491
|
-
action:
|
|
3492
|
-
type:
|
|
3493
|
-
command:
|
|
3494
|
-
timeout_ms:
|
|
3495
|
-
user:
|
|
3496
|
-
working_directory:
|
|
3497
|
-
env:
|
|
3619
|
+
z21.object({
|
|
3620
|
+
type: z21.literal("local_shell_call"),
|
|
3621
|
+
id: z21.string(),
|
|
3622
|
+
call_id: z21.string(),
|
|
3623
|
+
action: z21.object({
|
|
3624
|
+
type: z21.literal("exec"),
|
|
3625
|
+
command: z21.array(z21.string()),
|
|
3626
|
+
timeout_ms: z21.number().optional(),
|
|
3627
|
+
user: z21.string().optional(),
|
|
3628
|
+
working_directory: z21.string().optional(),
|
|
3629
|
+
env: z21.record(z21.string(), z21.string()).optional()
|
|
3498
3630
|
})
|
|
3499
3631
|
}),
|
|
3500
|
-
|
|
3501
|
-
type:
|
|
3502
|
-
id:
|
|
3503
|
-
status:
|
|
3632
|
+
z21.object({
|
|
3633
|
+
type: z21.literal("computer_call"),
|
|
3634
|
+
id: z21.string(),
|
|
3635
|
+
status: z21.literal("completed")
|
|
3504
3636
|
}),
|
|
3505
|
-
|
|
3506
|
-
type:
|
|
3507
|
-
id:
|
|
3508
|
-
status:
|
|
3509
|
-
arguments:
|
|
3510
|
-
name:
|
|
3511
|
-
server_label:
|
|
3512
|
-
output:
|
|
3513
|
-
error:
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
type:
|
|
3517
|
-
code:
|
|
3518
|
-
message:
|
|
3637
|
+
z21.object({
|
|
3638
|
+
type: z21.literal("mcp_call"),
|
|
3639
|
+
id: z21.string(),
|
|
3640
|
+
status: z21.string(),
|
|
3641
|
+
arguments: z21.string(),
|
|
3642
|
+
name: z21.string(),
|
|
3643
|
+
server_label: z21.string(),
|
|
3644
|
+
output: z21.string().nullish(),
|
|
3645
|
+
error: z21.union([
|
|
3646
|
+
z21.string(),
|
|
3647
|
+
z21.object({
|
|
3648
|
+
type: z21.string().optional(),
|
|
3649
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
3650
|
+
message: z21.string().optional()
|
|
3519
3651
|
}).loose()
|
|
3520
3652
|
]).nullish(),
|
|
3521
|
-
approval_request_id:
|
|
3653
|
+
approval_request_id: z21.string().nullish()
|
|
3522
3654
|
}),
|
|
3523
|
-
|
|
3524
|
-
type:
|
|
3525
|
-
id:
|
|
3526
|
-
server_label:
|
|
3527
|
-
tools:
|
|
3528
|
-
|
|
3529
|
-
name:
|
|
3530
|
-
description:
|
|
3531
|
-
input_schema:
|
|
3532
|
-
annotations:
|
|
3655
|
+
z21.object({
|
|
3656
|
+
type: z21.literal("mcp_list_tools"),
|
|
3657
|
+
id: z21.string(),
|
|
3658
|
+
server_label: z21.string(),
|
|
3659
|
+
tools: z21.array(
|
|
3660
|
+
z21.object({
|
|
3661
|
+
name: z21.string(),
|
|
3662
|
+
description: z21.string().optional(),
|
|
3663
|
+
input_schema: z21.any(),
|
|
3664
|
+
annotations: z21.record(z21.string(), z21.unknown()).optional()
|
|
3533
3665
|
})
|
|
3534
3666
|
),
|
|
3535
|
-
error:
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
type:
|
|
3539
|
-
code:
|
|
3540
|
-
message:
|
|
3667
|
+
error: z21.union([
|
|
3668
|
+
z21.string(),
|
|
3669
|
+
z21.object({
|
|
3670
|
+
type: z21.string().optional(),
|
|
3671
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
3672
|
+
message: z21.string().optional()
|
|
3541
3673
|
}).loose()
|
|
3542
3674
|
]).optional()
|
|
3543
3675
|
}),
|
|
3544
|
-
|
|
3545
|
-
type:
|
|
3546
|
-
id:
|
|
3547
|
-
server_label:
|
|
3548
|
-
name:
|
|
3549
|
-
arguments:
|
|
3550
|
-
approval_request_id:
|
|
3676
|
+
z21.object({
|
|
3677
|
+
type: z21.literal("mcp_approval_request"),
|
|
3678
|
+
id: z21.string(),
|
|
3679
|
+
server_label: z21.string(),
|
|
3680
|
+
name: z21.string(),
|
|
3681
|
+
arguments: z21.string(),
|
|
3682
|
+
approval_request_id: z21.string().optional()
|
|
3551
3683
|
}),
|
|
3552
|
-
|
|
3553
|
-
type:
|
|
3554
|
-
id:
|
|
3555
|
-
call_id:
|
|
3556
|
-
status:
|
|
3557
|
-
operation:
|
|
3558
|
-
|
|
3559
|
-
type:
|
|
3560
|
-
path:
|
|
3561
|
-
diff:
|
|
3684
|
+
z21.object({
|
|
3685
|
+
type: z21.literal("apply_patch_call"),
|
|
3686
|
+
id: z21.string(),
|
|
3687
|
+
call_id: z21.string(),
|
|
3688
|
+
status: z21.enum(["in_progress", "completed"]),
|
|
3689
|
+
operation: z21.discriminatedUnion("type", [
|
|
3690
|
+
z21.object({
|
|
3691
|
+
type: z21.literal("create_file"),
|
|
3692
|
+
path: z21.string(),
|
|
3693
|
+
diff: z21.string()
|
|
3562
3694
|
}),
|
|
3563
|
-
|
|
3564
|
-
type:
|
|
3565
|
-
path:
|
|
3695
|
+
z21.object({
|
|
3696
|
+
type: z21.literal("delete_file"),
|
|
3697
|
+
path: z21.string()
|
|
3566
3698
|
}),
|
|
3567
|
-
|
|
3568
|
-
type:
|
|
3569
|
-
path:
|
|
3570
|
-
diff:
|
|
3699
|
+
z21.object({
|
|
3700
|
+
type: z21.literal("update_file"),
|
|
3701
|
+
path: z21.string(),
|
|
3702
|
+
diff: z21.string()
|
|
3571
3703
|
})
|
|
3572
3704
|
])
|
|
3573
3705
|
}),
|
|
3574
|
-
|
|
3575
|
-
type:
|
|
3576
|
-
id:
|
|
3577
|
-
call_id:
|
|
3578
|
-
status:
|
|
3579
|
-
action:
|
|
3580
|
-
commands:
|
|
3706
|
+
z21.object({
|
|
3707
|
+
type: z21.literal("shell_call"),
|
|
3708
|
+
id: z21.string(),
|
|
3709
|
+
call_id: z21.string(),
|
|
3710
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3711
|
+
action: z21.object({
|
|
3712
|
+
commands: z21.array(z21.string())
|
|
3581
3713
|
})
|
|
3582
3714
|
}),
|
|
3583
|
-
|
|
3584
|
-
type:
|
|
3585
|
-
id:
|
|
3586
|
-
call_id:
|
|
3587
|
-
status:
|
|
3588
|
-
output:
|
|
3589
|
-
|
|
3590
|
-
stdout:
|
|
3591
|
-
stderr:
|
|
3592
|
-
outcome:
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
type:
|
|
3596
|
-
exit_code:
|
|
3715
|
+
z21.object({
|
|
3716
|
+
type: z21.literal("shell_call_output"),
|
|
3717
|
+
id: z21.string(),
|
|
3718
|
+
call_id: z21.string(),
|
|
3719
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3720
|
+
output: z21.array(
|
|
3721
|
+
z21.object({
|
|
3722
|
+
stdout: z21.string(),
|
|
3723
|
+
stderr: z21.string(),
|
|
3724
|
+
outcome: z21.discriminatedUnion("type", [
|
|
3725
|
+
z21.object({ type: z21.literal("timeout") }),
|
|
3726
|
+
z21.object({
|
|
3727
|
+
type: z21.literal("exit"),
|
|
3728
|
+
exit_code: z21.number()
|
|
3597
3729
|
})
|
|
3598
3730
|
])
|
|
3599
3731
|
})
|
|
3600
3732
|
)
|
|
3733
|
+
}),
|
|
3734
|
+
z21.object({
|
|
3735
|
+
type: z21.literal("tool_search_call"),
|
|
3736
|
+
id: z21.string(),
|
|
3737
|
+
execution: z21.enum(["server", "client"]),
|
|
3738
|
+
call_id: z21.string().nullable(),
|
|
3739
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3740
|
+
arguments: z21.unknown()
|
|
3741
|
+
}),
|
|
3742
|
+
z21.object({
|
|
3743
|
+
type: z21.literal("tool_search_output"),
|
|
3744
|
+
id: z21.string(),
|
|
3745
|
+
execution: z21.enum(["server", "client"]),
|
|
3746
|
+
call_id: z21.string().nullable(),
|
|
3747
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3748
|
+
tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
|
|
3601
3749
|
})
|
|
3602
3750
|
])
|
|
3603
3751
|
}),
|
|
3604
|
-
|
|
3605
|
-
type:
|
|
3606
|
-
item_id:
|
|
3607
|
-
output_index:
|
|
3608
|
-
delta:
|
|
3752
|
+
z21.object({
|
|
3753
|
+
type: z21.literal("response.function_call_arguments.delta"),
|
|
3754
|
+
item_id: z21.string(),
|
|
3755
|
+
output_index: z21.number(),
|
|
3756
|
+
delta: z21.string()
|
|
3609
3757
|
}),
|
|
3610
|
-
|
|
3611
|
-
type:
|
|
3612
|
-
item_id:
|
|
3613
|
-
output_index:
|
|
3614
|
-
delta:
|
|
3758
|
+
z21.object({
|
|
3759
|
+
type: z21.literal("response.custom_tool_call_input.delta"),
|
|
3760
|
+
item_id: z21.string(),
|
|
3761
|
+
output_index: z21.number(),
|
|
3762
|
+
delta: z21.string()
|
|
3615
3763
|
}),
|
|
3616
|
-
|
|
3617
|
-
type:
|
|
3618
|
-
item_id:
|
|
3619
|
-
output_index:
|
|
3620
|
-
partial_image_b64:
|
|
3764
|
+
z21.object({
|
|
3765
|
+
type: z21.literal("response.image_generation_call.partial_image"),
|
|
3766
|
+
item_id: z21.string(),
|
|
3767
|
+
output_index: z21.number(),
|
|
3768
|
+
partial_image_b64: z21.string()
|
|
3621
3769
|
}),
|
|
3622
|
-
|
|
3623
|
-
type:
|
|
3624
|
-
item_id:
|
|
3625
|
-
output_index:
|
|
3626
|
-
delta:
|
|
3770
|
+
z21.object({
|
|
3771
|
+
type: z21.literal("response.code_interpreter_call_code.delta"),
|
|
3772
|
+
item_id: z21.string(),
|
|
3773
|
+
output_index: z21.number(),
|
|
3774
|
+
delta: z21.string()
|
|
3627
3775
|
}),
|
|
3628
|
-
|
|
3629
|
-
type:
|
|
3630
|
-
item_id:
|
|
3631
|
-
output_index:
|
|
3632
|
-
code:
|
|
3776
|
+
z21.object({
|
|
3777
|
+
type: z21.literal("response.code_interpreter_call_code.done"),
|
|
3778
|
+
item_id: z21.string(),
|
|
3779
|
+
output_index: z21.number(),
|
|
3780
|
+
code: z21.string()
|
|
3633
3781
|
}),
|
|
3634
|
-
|
|
3635
|
-
type:
|
|
3636
|
-
annotation:
|
|
3637
|
-
|
|
3638
|
-
type:
|
|
3639
|
-
start_index:
|
|
3640
|
-
end_index:
|
|
3641
|
-
url:
|
|
3642
|
-
title:
|
|
3782
|
+
z21.object({
|
|
3783
|
+
type: z21.literal("response.output_text.annotation.added"),
|
|
3784
|
+
annotation: z21.discriminatedUnion("type", [
|
|
3785
|
+
z21.object({
|
|
3786
|
+
type: z21.literal("url_citation"),
|
|
3787
|
+
start_index: z21.number(),
|
|
3788
|
+
end_index: z21.number(),
|
|
3789
|
+
url: z21.string(),
|
|
3790
|
+
title: z21.string()
|
|
3643
3791
|
}),
|
|
3644
|
-
|
|
3645
|
-
type:
|
|
3646
|
-
file_id:
|
|
3647
|
-
filename:
|
|
3648
|
-
index:
|
|
3792
|
+
z21.object({
|
|
3793
|
+
type: z21.literal("file_citation"),
|
|
3794
|
+
file_id: z21.string(),
|
|
3795
|
+
filename: z21.string(),
|
|
3796
|
+
index: z21.number()
|
|
3649
3797
|
}),
|
|
3650
|
-
|
|
3651
|
-
type:
|
|
3652
|
-
container_id:
|
|
3653
|
-
file_id:
|
|
3654
|
-
filename:
|
|
3655
|
-
start_index:
|
|
3656
|
-
end_index:
|
|
3798
|
+
z21.object({
|
|
3799
|
+
type: z21.literal("container_file_citation"),
|
|
3800
|
+
container_id: z21.string(),
|
|
3801
|
+
file_id: z21.string(),
|
|
3802
|
+
filename: z21.string(),
|
|
3803
|
+
start_index: z21.number(),
|
|
3804
|
+
end_index: z21.number()
|
|
3657
3805
|
}),
|
|
3658
|
-
|
|
3659
|
-
type:
|
|
3660
|
-
file_id:
|
|
3661
|
-
index:
|
|
3806
|
+
z21.object({
|
|
3807
|
+
type: z21.literal("file_path"),
|
|
3808
|
+
file_id: z21.string(),
|
|
3809
|
+
index: z21.number()
|
|
3662
3810
|
})
|
|
3663
3811
|
])
|
|
3664
3812
|
}),
|
|
3665
|
-
|
|
3666
|
-
type:
|
|
3667
|
-
item_id:
|
|
3668
|
-
summary_index:
|
|
3813
|
+
z21.object({
|
|
3814
|
+
type: z21.literal("response.reasoning_summary_part.added"),
|
|
3815
|
+
item_id: z21.string(),
|
|
3816
|
+
summary_index: z21.number()
|
|
3669
3817
|
}),
|
|
3670
|
-
|
|
3671
|
-
type:
|
|
3672
|
-
item_id:
|
|
3673
|
-
summary_index:
|
|
3674
|
-
delta:
|
|
3818
|
+
z21.object({
|
|
3819
|
+
type: z21.literal("response.reasoning_summary_text.delta"),
|
|
3820
|
+
item_id: z21.string(),
|
|
3821
|
+
summary_index: z21.number(),
|
|
3822
|
+
delta: z21.string()
|
|
3675
3823
|
}),
|
|
3676
|
-
|
|
3677
|
-
type:
|
|
3678
|
-
item_id:
|
|
3679
|
-
summary_index:
|
|
3824
|
+
z21.object({
|
|
3825
|
+
type: z21.literal("response.reasoning_summary_part.done"),
|
|
3826
|
+
item_id: z21.string(),
|
|
3827
|
+
summary_index: z21.number()
|
|
3680
3828
|
}),
|
|
3681
|
-
|
|
3682
|
-
type:
|
|
3683
|
-
item_id:
|
|
3684
|
-
output_index:
|
|
3685
|
-
delta:
|
|
3686
|
-
obfuscation:
|
|
3829
|
+
z21.object({
|
|
3830
|
+
type: z21.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3831
|
+
item_id: z21.string(),
|
|
3832
|
+
output_index: z21.number(),
|
|
3833
|
+
delta: z21.string(),
|
|
3834
|
+
obfuscation: z21.string().nullish()
|
|
3687
3835
|
}),
|
|
3688
|
-
|
|
3689
|
-
type:
|
|
3690
|
-
item_id:
|
|
3691
|
-
output_index:
|
|
3692
|
-
diff:
|
|
3836
|
+
z21.object({
|
|
3837
|
+
type: z21.literal("response.apply_patch_call_operation_diff.done"),
|
|
3838
|
+
item_id: z21.string(),
|
|
3839
|
+
output_index: z21.number(),
|
|
3840
|
+
diff: z21.string()
|
|
3693
3841
|
}),
|
|
3694
|
-
|
|
3695
|
-
type:
|
|
3696
|
-
sequence_number:
|
|
3697
|
-
error:
|
|
3698
|
-
type:
|
|
3699
|
-
code:
|
|
3700
|
-
message:
|
|
3701
|
-
param:
|
|
3842
|
+
z21.object({
|
|
3843
|
+
type: z21.literal("error"),
|
|
3844
|
+
sequence_number: z21.number(),
|
|
3845
|
+
error: z21.object({
|
|
3846
|
+
type: z21.string(),
|
|
3847
|
+
code: z21.string(),
|
|
3848
|
+
message: z21.string(),
|
|
3849
|
+
param: z21.string().nullish()
|
|
3702
3850
|
})
|
|
3703
3851
|
}),
|
|
3704
|
-
|
|
3852
|
+
z21.object({ type: z21.string() }).loose().transform((value) => ({
|
|
3705
3853
|
type: "unknown_chunk",
|
|
3706
3854
|
message: value.type
|
|
3707
3855
|
}))
|
|
@@ -3709,294 +3857,310 @@ var openaiResponsesChunkSchema = lazySchema18(
|
|
|
3709
3857
|
])
|
|
3710
3858
|
)
|
|
3711
3859
|
);
|
|
3712
|
-
var openaiResponsesResponseSchema =
|
|
3713
|
-
() =>
|
|
3714
|
-
|
|
3715
|
-
id:
|
|
3716
|
-
created_at:
|
|
3717
|
-
error:
|
|
3718
|
-
message:
|
|
3719
|
-
type:
|
|
3720
|
-
param:
|
|
3721
|
-
code:
|
|
3860
|
+
var openaiResponsesResponseSchema = lazySchema19(
|
|
3861
|
+
() => zodSchema19(
|
|
3862
|
+
z21.object({
|
|
3863
|
+
id: z21.string().optional(),
|
|
3864
|
+
created_at: z21.number().optional(),
|
|
3865
|
+
error: z21.object({
|
|
3866
|
+
message: z21.string(),
|
|
3867
|
+
type: z21.string(),
|
|
3868
|
+
param: z21.string().nullish(),
|
|
3869
|
+
code: z21.string()
|
|
3722
3870
|
}).nullish(),
|
|
3723
|
-
model:
|
|
3724
|
-
output:
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
type:
|
|
3728
|
-
role:
|
|
3729
|
-
id:
|
|
3730
|
-
phase:
|
|
3731
|
-
content:
|
|
3732
|
-
|
|
3733
|
-
type:
|
|
3734
|
-
text:
|
|
3735
|
-
logprobs:
|
|
3736
|
-
|
|
3737
|
-
token:
|
|
3738
|
-
logprob:
|
|
3739
|
-
top_logprobs:
|
|
3740
|
-
|
|
3741
|
-
token:
|
|
3742
|
-
logprob:
|
|
3871
|
+
model: z21.string().optional(),
|
|
3872
|
+
output: z21.array(
|
|
3873
|
+
z21.discriminatedUnion("type", [
|
|
3874
|
+
z21.object({
|
|
3875
|
+
type: z21.literal("message"),
|
|
3876
|
+
role: z21.literal("assistant"),
|
|
3877
|
+
id: z21.string(),
|
|
3878
|
+
phase: z21.enum(["commentary", "final_answer"]).nullish(),
|
|
3879
|
+
content: z21.array(
|
|
3880
|
+
z21.object({
|
|
3881
|
+
type: z21.literal("output_text"),
|
|
3882
|
+
text: z21.string(),
|
|
3883
|
+
logprobs: z21.array(
|
|
3884
|
+
z21.object({
|
|
3885
|
+
token: z21.string(),
|
|
3886
|
+
logprob: z21.number(),
|
|
3887
|
+
top_logprobs: z21.array(
|
|
3888
|
+
z21.object({
|
|
3889
|
+
token: z21.string(),
|
|
3890
|
+
logprob: z21.number()
|
|
3743
3891
|
})
|
|
3744
3892
|
)
|
|
3745
3893
|
})
|
|
3746
3894
|
).nullish(),
|
|
3747
|
-
annotations:
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
type:
|
|
3751
|
-
start_index:
|
|
3752
|
-
end_index:
|
|
3753
|
-
url:
|
|
3754
|
-
title:
|
|
3895
|
+
annotations: z21.array(
|
|
3896
|
+
z21.discriminatedUnion("type", [
|
|
3897
|
+
z21.object({
|
|
3898
|
+
type: z21.literal("url_citation"),
|
|
3899
|
+
start_index: z21.number(),
|
|
3900
|
+
end_index: z21.number(),
|
|
3901
|
+
url: z21.string(),
|
|
3902
|
+
title: z21.string()
|
|
3755
3903
|
}),
|
|
3756
|
-
|
|
3757
|
-
type:
|
|
3758
|
-
file_id:
|
|
3759
|
-
filename:
|
|
3760
|
-
index:
|
|
3904
|
+
z21.object({
|
|
3905
|
+
type: z21.literal("file_citation"),
|
|
3906
|
+
file_id: z21.string(),
|
|
3907
|
+
filename: z21.string(),
|
|
3908
|
+
index: z21.number()
|
|
3761
3909
|
}),
|
|
3762
|
-
|
|
3763
|
-
type:
|
|
3764
|
-
container_id:
|
|
3765
|
-
file_id:
|
|
3766
|
-
filename:
|
|
3767
|
-
start_index:
|
|
3768
|
-
end_index:
|
|
3910
|
+
z21.object({
|
|
3911
|
+
type: z21.literal("container_file_citation"),
|
|
3912
|
+
container_id: z21.string(),
|
|
3913
|
+
file_id: z21.string(),
|
|
3914
|
+
filename: z21.string(),
|
|
3915
|
+
start_index: z21.number(),
|
|
3916
|
+
end_index: z21.number()
|
|
3769
3917
|
}),
|
|
3770
|
-
|
|
3771
|
-
type:
|
|
3772
|
-
file_id:
|
|
3773
|
-
index:
|
|
3918
|
+
z21.object({
|
|
3919
|
+
type: z21.literal("file_path"),
|
|
3920
|
+
file_id: z21.string(),
|
|
3921
|
+
index: z21.number()
|
|
3774
3922
|
})
|
|
3775
3923
|
])
|
|
3776
3924
|
)
|
|
3777
3925
|
})
|
|
3778
3926
|
)
|
|
3779
3927
|
}),
|
|
3780
|
-
|
|
3781
|
-
type:
|
|
3782
|
-
id:
|
|
3783
|
-
status:
|
|
3784
|
-
action:
|
|
3785
|
-
|
|
3786
|
-
type:
|
|
3787
|
-
query:
|
|
3788
|
-
sources:
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
type:
|
|
3793
|
-
name:
|
|
3928
|
+
z21.object({
|
|
3929
|
+
type: z21.literal("web_search_call"),
|
|
3930
|
+
id: z21.string(),
|
|
3931
|
+
status: z21.string(),
|
|
3932
|
+
action: z21.discriminatedUnion("type", [
|
|
3933
|
+
z21.object({
|
|
3934
|
+
type: z21.literal("search"),
|
|
3935
|
+
query: z21.string().nullish(),
|
|
3936
|
+
sources: z21.array(
|
|
3937
|
+
z21.discriminatedUnion("type", [
|
|
3938
|
+
z21.object({ type: z21.literal("url"), url: z21.string() }),
|
|
3939
|
+
z21.object({
|
|
3940
|
+
type: z21.literal("api"),
|
|
3941
|
+
name: z21.string()
|
|
3794
3942
|
})
|
|
3795
3943
|
])
|
|
3796
3944
|
).nullish()
|
|
3797
3945
|
}),
|
|
3798
|
-
|
|
3799
|
-
type:
|
|
3800
|
-
url:
|
|
3946
|
+
z21.object({
|
|
3947
|
+
type: z21.literal("open_page"),
|
|
3948
|
+
url: z21.string().nullish()
|
|
3801
3949
|
}),
|
|
3802
|
-
|
|
3803
|
-
type:
|
|
3804
|
-
url:
|
|
3805
|
-
pattern:
|
|
3950
|
+
z21.object({
|
|
3951
|
+
type: z21.literal("find_in_page"),
|
|
3952
|
+
url: z21.string().nullish(),
|
|
3953
|
+
pattern: z21.string().nullish()
|
|
3806
3954
|
})
|
|
3807
3955
|
]).nullish()
|
|
3808
3956
|
}),
|
|
3809
|
-
|
|
3810
|
-
type:
|
|
3811
|
-
id:
|
|
3812
|
-
queries:
|
|
3813
|
-
results:
|
|
3814
|
-
|
|
3815
|
-
attributes:
|
|
3816
|
-
|
|
3817
|
-
|
|
3957
|
+
z21.object({
|
|
3958
|
+
type: z21.literal("file_search_call"),
|
|
3959
|
+
id: z21.string(),
|
|
3960
|
+
queries: z21.array(z21.string()),
|
|
3961
|
+
results: z21.array(
|
|
3962
|
+
z21.object({
|
|
3963
|
+
attributes: z21.record(
|
|
3964
|
+
z21.string(),
|
|
3965
|
+
z21.union([z21.string(), z21.number(), z21.boolean()])
|
|
3818
3966
|
),
|
|
3819
|
-
file_id:
|
|
3820
|
-
filename:
|
|
3821
|
-
score:
|
|
3822
|
-
text:
|
|
3967
|
+
file_id: z21.string(),
|
|
3968
|
+
filename: z21.string(),
|
|
3969
|
+
score: z21.number(),
|
|
3970
|
+
text: z21.string()
|
|
3823
3971
|
})
|
|
3824
3972
|
).nullish()
|
|
3825
3973
|
}),
|
|
3826
|
-
|
|
3827
|
-
type:
|
|
3828
|
-
id:
|
|
3829
|
-
code:
|
|
3830
|
-
container_id:
|
|
3831
|
-
outputs:
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3974
|
+
z21.object({
|
|
3975
|
+
type: z21.literal("code_interpreter_call"),
|
|
3976
|
+
id: z21.string(),
|
|
3977
|
+
code: z21.string().nullable(),
|
|
3978
|
+
container_id: z21.string(),
|
|
3979
|
+
outputs: z21.array(
|
|
3980
|
+
z21.discriminatedUnion("type", [
|
|
3981
|
+
z21.object({ type: z21.literal("logs"), logs: z21.string() }),
|
|
3982
|
+
z21.object({ type: z21.literal("image"), url: z21.string() })
|
|
3835
3983
|
])
|
|
3836
3984
|
).nullable()
|
|
3837
3985
|
}),
|
|
3838
|
-
|
|
3839
|
-
type:
|
|
3840
|
-
id:
|
|
3841
|
-
result:
|
|
3986
|
+
z21.object({
|
|
3987
|
+
type: z21.literal("image_generation_call"),
|
|
3988
|
+
id: z21.string(),
|
|
3989
|
+
result: z21.string()
|
|
3842
3990
|
}),
|
|
3843
|
-
|
|
3844
|
-
type:
|
|
3845
|
-
id:
|
|
3846
|
-
call_id:
|
|
3847
|
-
action:
|
|
3848
|
-
type:
|
|
3849
|
-
command:
|
|
3850
|
-
timeout_ms:
|
|
3851
|
-
user:
|
|
3852
|
-
working_directory:
|
|
3853
|
-
env:
|
|
3991
|
+
z21.object({
|
|
3992
|
+
type: z21.literal("local_shell_call"),
|
|
3993
|
+
id: z21.string(),
|
|
3994
|
+
call_id: z21.string(),
|
|
3995
|
+
action: z21.object({
|
|
3996
|
+
type: z21.literal("exec"),
|
|
3997
|
+
command: z21.array(z21.string()),
|
|
3998
|
+
timeout_ms: z21.number().optional(),
|
|
3999
|
+
user: z21.string().optional(),
|
|
4000
|
+
working_directory: z21.string().optional(),
|
|
4001
|
+
env: z21.record(z21.string(), z21.string()).optional()
|
|
3854
4002
|
})
|
|
3855
4003
|
}),
|
|
3856
|
-
|
|
3857
|
-
type:
|
|
3858
|
-
call_id:
|
|
3859
|
-
name:
|
|
3860
|
-
arguments:
|
|
3861
|
-
id:
|
|
4004
|
+
z21.object({
|
|
4005
|
+
type: z21.literal("function_call"),
|
|
4006
|
+
call_id: z21.string(),
|
|
4007
|
+
name: z21.string(),
|
|
4008
|
+
arguments: z21.string(),
|
|
4009
|
+
id: z21.string()
|
|
3862
4010
|
}),
|
|
3863
|
-
|
|
3864
|
-
type:
|
|
3865
|
-
call_id:
|
|
3866
|
-
name:
|
|
3867
|
-
input:
|
|
3868
|
-
id:
|
|
4011
|
+
z21.object({
|
|
4012
|
+
type: z21.literal("custom_tool_call"),
|
|
4013
|
+
call_id: z21.string(),
|
|
4014
|
+
name: z21.string(),
|
|
4015
|
+
input: z21.string(),
|
|
4016
|
+
id: z21.string()
|
|
3869
4017
|
}),
|
|
3870
|
-
|
|
3871
|
-
type:
|
|
3872
|
-
id:
|
|
3873
|
-
status:
|
|
4018
|
+
z21.object({
|
|
4019
|
+
type: z21.literal("computer_call"),
|
|
4020
|
+
id: z21.string(),
|
|
4021
|
+
status: z21.string().optional()
|
|
3874
4022
|
}),
|
|
3875
|
-
|
|
3876
|
-
type:
|
|
3877
|
-
id:
|
|
3878
|
-
encrypted_content:
|
|
3879
|
-
summary:
|
|
3880
|
-
|
|
3881
|
-
type:
|
|
3882
|
-
text:
|
|
4023
|
+
z21.object({
|
|
4024
|
+
type: z21.literal("reasoning"),
|
|
4025
|
+
id: z21.string(),
|
|
4026
|
+
encrypted_content: z21.string().nullish(),
|
|
4027
|
+
summary: z21.array(
|
|
4028
|
+
z21.object({
|
|
4029
|
+
type: z21.literal("summary_text"),
|
|
4030
|
+
text: z21.string()
|
|
3883
4031
|
})
|
|
3884
4032
|
)
|
|
3885
4033
|
}),
|
|
3886
|
-
|
|
3887
|
-
type:
|
|
3888
|
-
id:
|
|
3889
|
-
status:
|
|
3890
|
-
arguments:
|
|
3891
|
-
name:
|
|
3892
|
-
server_label:
|
|
3893
|
-
output:
|
|
3894
|
-
error:
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
type:
|
|
3898
|
-
code:
|
|
3899
|
-
message:
|
|
4034
|
+
z21.object({
|
|
4035
|
+
type: z21.literal("mcp_call"),
|
|
4036
|
+
id: z21.string(),
|
|
4037
|
+
status: z21.string(),
|
|
4038
|
+
arguments: z21.string(),
|
|
4039
|
+
name: z21.string(),
|
|
4040
|
+
server_label: z21.string(),
|
|
4041
|
+
output: z21.string().nullish(),
|
|
4042
|
+
error: z21.union([
|
|
4043
|
+
z21.string(),
|
|
4044
|
+
z21.object({
|
|
4045
|
+
type: z21.string().optional(),
|
|
4046
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
4047
|
+
message: z21.string().optional()
|
|
3900
4048
|
}).loose()
|
|
3901
4049
|
]).nullish(),
|
|
3902
|
-
approval_request_id:
|
|
4050
|
+
approval_request_id: z21.string().nullish()
|
|
3903
4051
|
}),
|
|
3904
|
-
|
|
3905
|
-
type:
|
|
3906
|
-
id:
|
|
3907
|
-
server_label:
|
|
3908
|
-
tools:
|
|
3909
|
-
|
|
3910
|
-
name:
|
|
3911
|
-
description:
|
|
3912
|
-
input_schema:
|
|
3913
|
-
annotations:
|
|
4052
|
+
z21.object({
|
|
4053
|
+
type: z21.literal("mcp_list_tools"),
|
|
4054
|
+
id: z21.string(),
|
|
4055
|
+
server_label: z21.string(),
|
|
4056
|
+
tools: z21.array(
|
|
4057
|
+
z21.object({
|
|
4058
|
+
name: z21.string(),
|
|
4059
|
+
description: z21.string().optional(),
|
|
4060
|
+
input_schema: z21.any(),
|
|
4061
|
+
annotations: z21.record(z21.string(), z21.unknown()).optional()
|
|
3914
4062
|
})
|
|
3915
4063
|
),
|
|
3916
|
-
error:
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
type:
|
|
3920
|
-
code:
|
|
3921
|
-
message:
|
|
4064
|
+
error: z21.union([
|
|
4065
|
+
z21.string(),
|
|
4066
|
+
z21.object({
|
|
4067
|
+
type: z21.string().optional(),
|
|
4068
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
4069
|
+
message: z21.string().optional()
|
|
3922
4070
|
}).loose()
|
|
3923
4071
|
]).optional()
|
|
3924
4072
|
}),
|
|
3925
|
-
|
|
3926
|
-
type:
|
|
3927
|
-
id:
|
|
3928
|
-
server_label:
|
|
3929
|
-
name:
|
|
3930
|
-
arguments:
|
|
3931
|
-
approval_request_id:
|
|
4073
|
+
z21.object({
|
|
4074
|
+
type: z21.literal("mcp_approval_request"),
|
|
4075
|
+
id: z21.string(),
|
|
4076
|
+
server_label: z21.string(),
|
|
4077
|
+
name: z21.string(),
|
|
4078
|
+
arguments: z21.string(),
|
|
4079
|
+
approval_request_id: z21.string().optional()
|
|
3932
4080
|
}),
|
|
3933
|
-
|
|
3934
|
-
type:
|
|
3935
|
-
id:
|
|
3936
|
-
call_id:
|
|
3937
|
-
status:
|
|
3938
|
-
operation:
|
|
3939
|
-
|
|
3940
|
-
type:
|
|
3941
|
-
path:
|
|
3942
|
-
diff:
|
|
4081
|
+
z21.object({
|
|
4082
|
+
type: z21.literal("apply_patch_call"),
|
|
4083
|
+
id: z21.string(),
|
|
4084
|
+
call_id: z21.string(),
|
|
4085
|
+
status: z21.enum(["in_progress", "completed"]),
|
|
4086
|
+
operation: z21.discriminatedUnion("type", [
|
|
4087
|
+
z21.object({
|
|
4088
|
+
type: z21.literal("create_file"),
|
|
4089
|
+
path: z21.string(),
|
|
4090
|
+
diff: z21.string()
|
|
3943
4091
|
}),
|
|
3944
|
-
|
|
3945
|
-
type:
|
|
3946
|
-
path:
|
|
4092
|
+
z21.object({
|
|
4093
|
+
type: z21.literal("delete_file"),
|
|
4094
|
+
path: z21.string()
|
|
3947
4095
|
}),
|
|
3948
|
-
|
|
3949
|
-
type:
|
|
3950
|
-
path:
|
|
3951
|
-
diff:
|
|
4096
|
+
z21.object({
|
|
4097
|
+
type: z21.literal("update_file"),
|
|
4098
|
+
path: z21.string(),
|
|
4099
|
+
diff: z21.string()
|
|
3952
4100
|
})
|
|
3953
4101
|
])
|
|
3954
4102
|
}),
|
|
3955
|
-
|
|
3956
|
-
type:
|
|
3957
|
-
id:
|
|
3958
|
-
call_id:
|
|
3959
|
-
status:
|
|
3960
|
-
action:
|
|
3961
|
-
commands:
|
|
4103
|
+
z21.object({
|
|
4104
|
+
type: z21.literal("shell_call"),
|
|
4105
|
+
id: z21.string(),
|
|
4106
|
+
call_id: z21.string(),
|
|
4107
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
4108
|
+
action: z21.object({
|
|
4109
|
+
commands: z21.array(z21.string())
|
|
3962
4110
|
})
|
|
3963
4111
|
}),
|
|
3964
|
-
|
|
3965
|
-
type:
|
|
3966
|
-
id:
|
|
3967
|
-
call_id:
|
|
3968
|
-
status:
|
|
3969
|
-
output:
|
|
3970
|
-
|
|
3971
|
-
stdout:
|
|
3972
|
-
stderr:
|
|
3973
|
-
outcome:
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
type:
|
|
3977
|
-
exit_code:
|
|
4112
|
+
z21.object({
|
|
4113
|
+
type: z21.literal("shell_call_output"),
|
|
4114
|
+
id: z21.string(),
|
|
4115
|
+
call_id: z21.string(),
|
|
4116
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
4117
|
+
output: z21.array(
|
|
4118
|
+
z21.object({
|
|
4119
|
+
stdout: z21.string(),
|
|
4120
|
+
stderr: z21.string(),
|
|
4121
|
+
outcome: z21.discriminatedUnion("type", [
|
|
4122
|
+
z21.object({ type: z21.literal("timeout") }),
|
|
4123
|
+
z21.object({
|
|
4124
|
+
type: z21.literal("exit"),
|
|
4125
|
+
exit_code: z21.number()
|
|
3978
4126
|
})
|
|
3979
4127
|
])
|
|
3980
4128
|
})
|
|
3981
4129
|
)
|
|
4130
|
+
}),
|
|
4131
|
+
z21.object({
|
|
4132
|
+
type: z21.literal("tool_search_call"),
|
|
4133
|
+
id: z21.string(),
|
|
4134
|
+
execution: z21.enum(["server", "client"]),
|
|
4135
|
+
call_id: z21.string().nullable(),
|
|
4136
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
4137
|
+
arguments: z21.unknown()
|
|
4138
|
+
}),
|
|
4139
|
+
z21.object({
|
|
4140
|
+
type: z21.literal("tool_search_output"),
|
|
4141
|
+
id: z21.string(),
|
|
4142
|
+
execution: z21.enum(["server", "client"]),
|
|
4143
|
+
call_id: z21.string().nullable(),
|
|
4144
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
4145
|
+
tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
|
|
3982
4146
|
})
|
|
3983
4147
|
])
|
|
3984
4148
|
).optional(),
|
|
3985
|
-
service_tier:
|
|
3986
|
-
incomplete_details:
|
|
3987
|
-
usage:
|
|
3988
|
-
input_tokens:
|
|
3989
|
-
input_tokens_details:
|
|
3990
|
-
output_tokens:
|
|
3991
|
-
output_tokens_details:
|
|
4149
|
+
service_tier: z21.string().nullish(),
|
|
4150
|
+
incomplete_details: z21.object({ reason: z21.string() }).nullish(),
|
|
4151
|
+
usage: z21.object({
|
|
4152
|
+
input_tokens: z21.number(),
|
|
4153
|
+
input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
|
|
4154
|
+
output_tokens: z21.number(),
|
|
4155
|
+
output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
|
|
3992
4156
|
}).optional()
|
|
3993
4157
|
})
|
|
3994
4158
|
)
|
|
3995
4159
|
);
|
|
3996
4160
|
|
|
3997
4161
|
// src/responses/openai-responses-options.ts
|
|
3998
|
-
import { lazySchema as
|
|
3999
|
-
import { z as
|
|
4162
|
+
import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
|
|
4163
|
+
import { z as z22 } from "zod/v4";
|
|
4000
4164
|
var TOP_LOGPROBS_MAX = 20;
|
|
4001
4165
|
var openaiResponsesReasoningModelIds = [
|
|
4002
4166
|
"o1",
|
|
@@ -4057,9 +4221,9 @@ var openaiResponsesModelIds = [
|
|
|
4057
4221
|
"gpt-5-chat-latest",
|
|
4058
4222
|
...openaiResponsesReasoningModelIds
|
|
4059
4223
|
];
|
|
4060
|
-
var openaiLanguageModelResponsesOptionsSchema =
|
|
4061
|
-
() =>
|
|
4062
|
-
|
|
4224
|
+
var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
|
|
4225
|
+
() => zodSchema20(
|
|
4226
|
+
z22.object({
|
|
4063
4227
|
/**
|
|
4064
4228
|
* The ID of the OpenAI Conversation to continue.
|
|
4065
4229
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -4067,13 +4231,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4067
4231
|
* Defaults to `undefined`.
|
|
4068
4232
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
4069
4233
|
*/
|
|
4070
|
-
conversation:
|
|
4234
|
+
conversation: z22.string().nullish(),
|
|
4071
4235
|
/**
|
|
4072
4236
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
4073
4237
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
4074
4238
|
*/
|
|
4075
|
-
include:
|
|
4076
|
-
|
|
4239
|
+
include: z22.array(
|
|
4240
|
+
z22.enum([
|
|
4077
4241
|
"reasoning.encrypted_content",
|
|
4078
4242
|
// handled internally by default, only needed for unknown reasoning models
|
|
4079
4243
|
"file_search_call.results",
|
|
@@ -4085,7 +4249,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4085
4249
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
4086
4250
|
* Defaults to `undefined`.
|
|
4087
4251
|
*/
|
|
4088
|
-
instructions:
|
|
4252
|
+
instructions: z22.string().nullish(),
|
|
4089
4253
|
/**
|
|
4090
4254
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
4091
4255
|
* the response size and can slow down response times. However, it can
|
|
@@ -4100,30 +4264,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4100
4264
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
4101
4265
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
4102
4266
|
*/
|
|
4103
|
-
logprobs:
|
|
4267
|
+
logprobs: z22.union([z22.boolean(), z22.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
4104
4268
|
/**
|
|
4105
4269
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
4106
4270
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
4107
4271
|
* Any further attempts to call a tool by the model will be ignored.
|
|
4108
4272
|
*/
|
|
4109
|
-
maxToolCalls:
|
|
4273
|
+
maxToolCalls: z22.number().nullish(),
|
|
4110
4274
|
/**
|
|
4111
4275
|
* Additional metadata to store with the generation.
|
|
4112
4276
|
*/
|
|
4113
|
-
metadata:
|
|
4277
|
+
metadata: z22.any().nullish(),
|
|
4114
4278
|
/**
|
|
4115
4279
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
4116
4280
|
*/
|
|
4117
|
-
parallelToolCalls:
|
|
4281
|
+
parallelToolCalls: z22.boolean().nullish(),
|
|
4118
4282
|
/**
|
|
4119
4283
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
4120
4284
|
* Defaults to `undefined`.
|
|
4121
4285
|
*/
|
|
4122
|
-
previousResponseId:
|
|
4286
|
+
previousResponseId: z22.string().nullish(),
|
|
4123
4287
|
/**
|
|
4124
4288
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
4125
4289
|
*/
|
|
4126
|
-
promptCacheKey:
|
|
4290
|
+
promptCacheKey: z22.string().nullish(),
|
|
4127
4291
|
/**
|
|
4128
4292
|
* The retention policy for the prompt cache.
|
|
4129
4293
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -4132,7 +4296,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4132
4296
|
*
|
|
4133
4297
|
* @default 'in_memory'
|
|
4134
4298
|
*/
|
|
4135
|
-
promptCacheRetention:
|
|
4299
|
+
promptCacheRetention: z22.enum(["in_memory", "24h"]).nullish(),
|
|
4136
4300
|
/**
|
|
4137
4301
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
4138
4302
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -4143,17 +4307,17 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4143
4307
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
4144
4308
|
* an error.
|
|
4145
4309
|
*/
|
|
4146
|
-
reasoningEffort:
|
|
4310
|
+
reasoningEffort: z22.string().nullish(),
|
|
4147
4311
|
/**
|
|
4148
4312
|
* Controls reasoning summary output from the model.
|
|
4149
4313
|
* Set to "auto" to automatically receive the richest level available,
|
|
4150
4314
|
* or "detailed" for comprehensive summaries.
|
|
4151
4315
|
*/
|
|
4152
|
-
reasoningSummary:
|
|
4316
|
+
reasoningSummary: z22.string().nullish(),
|
|
4153
4317
|
/**
|
|
4154
4318
|
* The identifier for safety monitoring and tracking.
|
|
4155
4319
|
*/
|
|
4156
|
-
safetyIdentifier:
|
|
4320
|
+
safetyIdentifier: z22.string().nullish(),
|
|
4157
4321
|
/**
|
|
4158
4322
|
* Service tier for the request.
|
|
4159
4323
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -4161,34 +4325,34 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4161
4325
|
*
|
|
4162
4326
|
* Defaults to 'auto'.
|
|
4163
4327
|
*/
|
|
4164
|
-
serviceTier:
|
|
4328
|
+
serviceTier: z22.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
4165
4329
|
/**
|
|
4166
4330
|
* Whether to store the generation. Defaults to `true`.
|
|
4167
4331
|
*/
|
|
4168
|
-
store:
|
|
4332
|
+
store: z22.boolean().nullish(),
|
|
4169
4333
|
/**
|
|
4170
4334
|
* Whether to use strict JSON schema validation.
|
|
4171
4335
|
* Defaults to `true`.
|
|
4172
4336
|
*/
|
|
4173
|
-
strictJsonSchema:
|
|
4337
|
+
strictJsonSchema: z22.boolean().nullish(),
|
|
4174
4338
|
/**
|
|
4175
4339
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
4176
4340
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
4177
4341
|
* Valid values: 'low', 'medium', 'high'.
|
|
4178
4342
|
*/
|
|
4179
|
-
textVerbosity:
|
|
4343
|
+
textVerbosity: z22.enum(["low", "medium", "high"]).nullish(),
|
|
4180
4344
|
/**
|
|
4181
4345
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
4182
4346
|
* 'disabled' turns truncation off.
|
|
4183
4347
|
*/
|
|
4184
|
-
truncation:
|
|
4348
|
+
truncation: z22.enum(["auto", "disabled"]).nullish(),
|
|
4185
4349
|
/**
|
|
4186
4350
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
4187
4351
|
* monitor and detect abuse.
|
|
4188
4352
|
* Defaults to `undefined`.
|
|
4189
4353
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
4190
4354
|
*/
|
|
4191
|
-
user:
|
|
4355
|
+
user: z22.string().nullish(),
|
|
4192
4356
|
/**
|
|
4193
4357
|
* Override the system message mode for this model.
|
|
4194
4358
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -4197,7 +4361,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4197
4361
|
*
|
|
4198
4362
|
* If not specified, the mode is automatically determined based on the model.
|
|
4199
4363
|
*/
|
|
4200
|
-
systemMessageMode:
|
|
4364
|
+
systemMessageMode: z22.enum(["system", "developer", "remove"]).optional(),
|
|
4201
4365
|
/**
|
|
4202
4366
|
* Force treating this model as a reasoning model.
|
|
4203
4367
|
*
|
|
@@ -4207,7 +4371,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4207
4371
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4208
4372
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4209
4373
|
*/
|
|
4210
|
-
forceReasoning:
|
|
4374
|
+
forceReasoning: z22.boolean().optional()
|
|
4211
4375
|
})
|
|
4212
4376
|
)
|
|
4213
4377
|
);
|
|
@@ -4223,7 +4387,7 @@ async function prepareResponsesTools({
|
|
|
4223
4387
|
toolNameMapping,
|
|
4224
4388
|
customProviderToolNames
|
|
4225
4389
|
}) {
|
|
4226
|
-
var _a;
|
|
4390
|
+
var _a, _b;
|
|
4227
4391
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
4228
4392
|
const toolWarnings = [];
|
|
4229
4393
|
if (tools == null) {
|
|
@@ -4233,15 +4397,19 @@ async function prepareResponsesTools({
|
|
|
4233
4397
|
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
4234
4398
|
for (const tool of tools) {
|
|
4235
4399
|
switch (tool.type) {
|
|
4236
|
-
case "function":
|
|
4400
|
+
case "function": {
|
|
4401
|
+
const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
|
|
4402
|
+
const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
|
|
4237
4403
|
openaiTools2.push({
|
|
4238
4404
|
type: "function",
|
|
4239
4405
|
name: tool.name,
|
|
4240
4406
|
description: tool.description,
|
|
4241
4407
|
parameters: tool.inputSchema,
|
|
4242
|
-
...tool.strict != null ? { strict: tool.strict } : {}
|
|
4408
|
+
...tool.strict != null ? { strict: tool.strict } : {},
|
|
4409
|
+
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
4243
4410
|
});
|
|
4244
4411
|
break;
|
|
4412
|
+
}
|
|
4245
4413
|
case "provider": {
|
|
4246
4414
|
switch (tool.id) {
|
|
4247
4415
|
case "openai.file_search": {
|
|
@@ -4386,6 +4554,19 @@ async function prepareResponsesTools({
|
|
|
4386
4554
|
resolvedCustomProviderToolNames.add(args.name);
|
|
4387
4555
|
break;
|
|
4388
4556
|
}
|
|
4557
|
+
case "openai.tool_search": {
|
|
4558
|
+
const args = await validateTypes2({
|
|
4559
|
+
value: tool.args,
|
|
4560
|
+
schema: toolSearchArgsSchema
|
|
4561
|
+
});
|
|
4562
|
+
openaiTools2.push({
|
|
4563
|
+
type: "tool_search",
|
|
4564
|
+
...args.execution != null ? { execution: args.execution } : {},
|
|
4565
|
+
...args.description != null ? { description: args.description } : {},
|
|
4566
|
+
...args.parameters != null ? { parameters: args.parameters } : {}
|
|
4567
|
+
});
|
|
4568
|
+
break;
|
|
4569
|
+
}
|
|
4389
4570
|
}
|
|
4390
4571
|
break;
|
|
4391
4572
|
}
|
|
@@ -4407,7 +4588,7 @@ async function prepareResponsesTools({
|
|
|
4407
4588
|
case "required":
|
|
4408
4589
|
return { tools: openaiTools2, toolChoice: type, toolWarnings };
|
|
4409
4590
|
case "tool": {
|
|
4410
|
-
const resolvedToolName = (
|
|
4591
|
+
const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
|
|
4411
4592
|
return {
|
|
4412
4593
|
tools: openaiTools2,
|
|
4413
4594
|
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 },
|
|
@@ -4563,7 +4744,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4563
4744
|
"openai.web_search": "web_search",
|
|
4564
4745
|
"openai.web_search_preview": "web_search_preview",
|
|
4565
4746
|
"openai.mcp": "mcp",
|
|
4566
|
-
"openai.apply_patch": "apply_patch"
|
|
4747
|
+
"openai.apply_patch": "apply_patch",
|
|
4748
|
+
"openai.tool_search": "tool_search"
|
|
4567
4749
|
},
|
|
4568
4750
|
resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
|
|
4569
4751
|
});
|
|
@@ -4741,7 +4923,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4741
4923
|
};
|
|
4742
4924
|
}
|
|
4743
4925
|
async doGenerate(options) {
|
|
4744
|
-
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;
|
|
4926
|
+
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;
|
|
4745
4927
|
const {
|
|
4746
4928
|
args: body,
|
|
4747
4929
|
warnings,
|
|
@@ -4784,6 +4966,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4784
4966
|
const content = [];
|
|
4785
4967
|
const logprobs = [];
|
|
4786
4968
|
let hasFunctionCall = false;
|
|
4969
|
+
const hostedToolSearchCallIds = [];
|
|
4787
4970
|
for (const part of response.output) {
|
|
4788
4971
|
switch (part.type) {
|
|
4789
4972
|
case "reasoning": {
|
|
@@ -4822,6 +5005,46 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4822
5005
|
});
|
|
4823
5006
|
break;
|
|
4824
5007
|
}
|
|
5008
|
+
case "tool_search_call": {
|
|
5009
|
+
const toolCallId = (_b = part.call_id) != null ? _b : part.id;
|
|
5010
|
+
const isHosted = part.execution === "server";
|
|
5011
|
+
if (isHosted) {
|
|
5012
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5013
|
+
}
|
|
5014
|
+
content.push({
|
|
5015
|
+
type: "tool-call",
|
|
5016
|
+
toolCallId,
|
|
5017
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5018
|
+
input: JSON.stringify({
|
|
5019
|
+
arguments: part.arguments,
|
|
5020
|
+
call_id: part.call_id
|
|
5021
|
+
}),
|
|
5022
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5023
|
+
providerMetadata: {
|
|
5024
|
+
[providerOptionsName]: {
|
|
5025
|
+
itemId: part.id
|
|
5026
|
+
}
|
|
5027
|
+
}
|
|
5028
|
+
});
|
|
5029
|
+
break;
|
|
5030
|
+
}
|
|
5031
|
+
case "tool_search_output": {
|
|
5032
|
+
const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
|
|
5033
|
+
content.push({
|
|
5034
|
+
type: "tool-result",
|
|
5035
|
+
toolCallId,
|
|
5036
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5037
|
+
result: {
|
|
5038
|
+
tools: part.tools
|
|
5039
|
+
},
|
|
5040
|
+
providerMetadata: {
|
|
5041
|
+
[providerOptionsName]: {
|
|
5042
|
+
itemId: part.id
|
|
5043
|
+
}
|
|
5044
|
+
}
|
|
5045
|
+
});
|
|
5046
|
+
break;
|
|
5047
|
+
}
|
|
4825
5048
|
case "local_shell_call": {
|
|
4826
5049
|
content.push({
|
|
4827
5050
|
type: "tool-call",
|
|
@@ -4877,7 +5100,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4877
5100
|
}
|
|
4878
5101
|
case "message": {
|
|
4879
5102
|
for (const contentPart of part.content) {
|
|
4880
|
-
if (((
|
|
5103
|
+
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
|
|
4881
5104
|
logprobs.push(contentPart.logprobs);
|
|
4882
5105
|
}
|
|
4883
5106
|
const providerMetadata2 = {
|
|
@@ -4899,7 +5122,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4899
5122
|
content.push({
|
|
4900
5123
|
type: "source",
|
|
4901
5124
|
sourceType: "url",
|
|
4902
|
-
id: (
|
|
5125
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
|
|
4903
5126
|
url: annotation.url,
|
|
4904
5127
|
title: annotation.title
|
|
4905
5128
|
});
|
|
@@ -4907,7 +5130,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4907
5130
|
content.push({
|
|
4908
5131
|
type: "source",
|
|
4909
5132
|
sourceType: "document",
|
|
4910
|
-
id: (
|
|
5133
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
|
|
4911
5134
|
mediaType: "text/plain",
|
|
4912
5135
|
title: annotation.filename,
|
|
4913
5136
|
filename: annotation.filename,
|
|
@@ -4923,7 +5146,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4923
5146
|
content.push({
|
|
4924
5147
|
type: "source",
|
|
4925
5148
|
sourceType: "document",
|
|
4926
|
-
id: (
|
|
5149
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
|
|
4927
5150
|
mediaType: "text/plain",
|
|
4928
5151
|
title: annotation.filename,
|
|
4929
5152
|
filename: annotation.filename,
|
|
@@ -4939,7 +5162,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4939
5162
|
content.push({
|
|
4940
5163
|
type: "source",
|
|
4941
5164
|
sourceType: "document",
|
|
4942
|
-
id: (
|
|
5165
|
+
id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
|
|
4943
5166
|
mediaType: "application/octet-stream",
|
|
4944
5167
|
title: annotation.file_id,
|
|
4945
5168
|
filename: annotation.file_id,
|
|
@@ -5008,7 +5231,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5008
5231
|
break;
|
|
5009
5232
|
}
|
|
5010
5233
|
case "mcp_call": {
|
|
5011
|
-
const toolCallId = part.approval_request_id != null ? (
|
|
5234
|
+
const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
|
|
5012
5235
|
const toolName = `mcp.${part.name}`;
|
|
5013
5236
|
content.push({
|
|
5014
5237
|
type: "tool-call",
|
|
@@ -5042,8 +5265,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5042
5265
|
break;
|
|
5043
5266
|
}
|
|
5044
5267
|
case "mcp_approval_request": {
|
|
5045
|
-
const approvalRequestId = (
|
|
5046
|
-
const dummyToolCallId = (
|
|
5268
|
+
const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
|
|
5269
|
+
const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2();
|
|
5047
5270
|
const toolName = `mcp.${part.name}`;
|
|
5048
5271
|
content.push({
|
|
5049
5272
|
type: "tool-call",
|
|
@@ -5093,13 +5316,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5093
5316
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5094
5317
|
result: {
|
|
5095
5318
|
queries: part.queries,
|
|
5096
|
-
results: (
|
|
5319
|
+
results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
|
|
5097
5320
|
attributes: result.attributes,
|
|
5098
5321
|
fileId: result.file_id,
|
|
5099
5322
|
filename: result.filename,
|
|
5100
5323
|
score: result.score,
|
|
5101
5324
|
text: result.text
|
|
5102
|
-
}))) != null ?
|
|
5325
|
+
}))) != null ? _y : null
|
|
5103
5326
|
}
|
|
5104
5327
|
});
|
|
5105
5328
|
break;
|
|
@@ -5156,10 +5379,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5156
5379
|
content,
|
|
5157
5380
|
finishReason: {
|
|
5158
5381
|
unified: mapOpenAIResponseFinishReason({
|
|
5159
|
-
finishReason: (
|
|
5382
|
+
finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
|
|
5160
5383
|
hasFunctionCall
|
|
5161
5384
|
}),
|
|
5162
|
-
raw: (
|
|
5385
|
+
raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
|
|
5163
5386
|
},
|
|
5164
5387
|
usage: convertOpenAIResponsesUsage(usage),
|
|
5165
5388
|
request: { body },
|
|
@@ -5217,6 +5440,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5217
5440
|
let hasFunctionCall = false;
|
|
5218
5441
|
const activeReasoning = {};
|
|
5219
5442
|
let serviceTier;
|
|
5443
|
+
const hostedToolSearchCallIds = [];
|
|
5220
5444
|
return {
|
|
5221
5445
|
stream: response.pipeThrough(
|
|
5222
5446
|
new TransformStream({
|
|
@@ -5224,7 +5448,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5224
5448
|
controller.enqueue({ type: "stream-start", warnings });
|
|
5225
5449
|
},
|
|
5226
5450
|
transform(chunk, controller) {
|
|
5227
|
-
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;
|
|
5451
|
+
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;
|
|
5228
5452
|
if (options.includeRawChunks) {
|
|
5229
5453
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
5230
5454
|
}
|
|
@@ -5332,6 +5556,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5332
5556
|
input: "{}",
|
|
5333
5557
|
providerExecuted: true
|
|
5334
5558
|
});
|
|
5559
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5560
|
+
const toolCallId = value.item.id;
|
|
5561
|
+
const toolName = toolNameMapping.toCustomToolName("tool_search");
|
|
5562
|
+
const isHosted = value.item.execution === "server";
|
|
5563
|
+
ongoingToolCalls[value.output_index] = {
|
|
5564
|
+
toolName,
|
|
5565
|
+
toolCallId,
|
|
5566
|
+
toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
|
|
5567
|
+
};
|
|
5568
|
+
if (isHosted) {
|
|
5569
|
+
controller.enqueue({
|
|
5570
|
+
type: "tool-input-start",
|
|
5571
|
+
id: toolCallId,
|
|
5572
|
+
toolName,
|
|
5573
|
+
providerExecuted: true
|
|
5574
|
+
});
|
|
5575
|
+
}
|
|
5576
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5335
5577
|
} else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
|
|
5336
5578
|
} else if (value.item.type === "apply_patch_call") {
|
|
5337
5579
|
const { call_id: callId, operation } = value.item;
|
|
@@ -5378,7 +5620,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5378
5620
|
} else if (value.item.type === "shell_call_output") {
|
|
5379
5621
|
} else if (value.item.type === "message") {
|
|
5380
5622
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
5381
|
-
activeMessagePhase = (
|
|
5623
|
+
activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
|
|
5382
5624
|
controller.enqueue({
|
|
5383
5625
|
type: "text-start",
|
|
5384
5626
|
id: value.item.id,
|
|
@@ -5402,14 +5644,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5402
5644
|
providerMetadata: {
|
|
5403
5645
|
[providerOptionsName]: {
|
|
5404
5646
|
itemId: value.item.id,
|
|
5405
|
-
reasoningEncryptedContent: (
|
|
5647
|
+
reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
|
|
5406
5648
|
}
|
|
5407
5649
|
}
|
|
5408
5650
|
});
|
|
5409
5651
|
}
|
|
5410
5652
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
5411
5653
|
if (value.item.type === "message") {
|
|
5412
|
-
const phase = (
|
|
5654
|
+
const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
|
|
5413
5655
|
activeMessagePhase = void 0;
|
|
5414
5656
|
controller.enqueue({
|
|
5415
5657
|
type: "text-end",
|
|
@@ -5503,13 +5745,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5503
5745
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5504
5746
|
result: {
|
|
5505
5747
|
queries: value.item.queries,
|
|
5506
|
-
results: (
|
|
5748
|
+
results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
|
|
5507
5749
|
attributes: result.attributes,
|
|
5508
5750
|
fileId: result.file_id,
|
|
5509
5751
|
filename: result.filename,
|
|
5510
5752
|
score: result.score,
|
|
5511
5753
|
text: result.text
|
|
5512
|
-
}))) != null ?
|
|
5754
|
+
}))) != null ? _f : null
|
|
5513
5755
|
}
|
|
5514
5756
|
});
|
|
5515
5757
|
} else if (value.item.type === "code_interpreter_call") {
|
|
@@ -5531,12 +5773,62 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5531
5773
|
result: value.item.result
|
|
5532
5774
|
}
|
|
5533
5775
|
});
|
|
5776
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5777
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
5778
|
+
const isHosted = value.item.execution === "server";
|
|
5779
|
+
if (toolCall != null) {
|
|
5780
|
+
const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
|
|
5781
|
+
if (isHosted) {
|
|
5782
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5783
|
+
} else {
|
|
5784
|
+
controller.enqueue({
|
|
5785
|
+
type: "tool-input-start",
|
|
5786
|
+
id: toolCallId,
|
|
5787
|
+
toolName: toolCall.toolName
|
|
5788
|
+
});
|
|
5789
|
+
}
|
|
5790
|
+
controller.enqueue({
|
|
5791
|
+
type: "tool-input-end",
|
|
5792
|
+
id: toolCallId
|
|
5793
|
+
});
|
|
5794
|
+
controller.enqueue({
|
|
5795
|
+
type: "tool-call",
|
|
5796
|
+
toolCallId,
|
|
5797
|
+
toolName: toolCall.toolName,
|
|
5798
|
+
input: JSON.stringify({
|
|
5799
|
+
arguments: value.item.arguments,
|
|
5800
|
+
call_id: isHosted ? null : toolCallId
|
|
5801
|
+
}),
|
|
5802
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5803
|
+
providerMetadata: {
|
|
5804
|
+
[providerOptionsName]: {
|
|
5805
|
+
itemId: value.item.id
|
|
5806
|
+
}
|
|
5807
|
+
}
|
|
5808
|
+
});
|
|
5809
|
+
}
|
|
5810
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
5811
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5812
|
+
const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
|
|
5813
|
+
controller.enqueue({
|
|
5814
|
+
type: "tool-result",
|
|
5815
|
+
toolCallId,
|
|
5816
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5817
|
+
result: {
|
|
5818
|
+
tools: value.item.tools
|
|
5819
|
+
},
|
|
5820
|
+
providerMetadata: {
|
|
5821
|
+
[providerOptionsName]: {
|
|
5822
|
+
itemId: value.item.id
|
|
5823
|
+
}
|
|
5824
|
+
}
|
|
5825
|
+
});
|
|
5534
5826
|
} else if (value.item.type === "mcp_call") {
|
|
5535
5827
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5536
|
-
const approvalRequestId = (
|
|
5537
|
-
const aliasedToolCallId = approvalRequestId != null ? (
|
|
5828
|
+
const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
|
|
5829
|
+
const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
5538
5830
|
approvalRequestId
|
|
5539
|
-
)) != null ?
|
|
5831
|
+
)) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
|
|
5540
5832
|
const toolName = `mcp.${value.item.name}`;
|
|
5541
5833
|
controller.enqueue({
|
|
5542
5834
|
type: "tool-call",
|
|
@@ -5606,8 +5898,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5606
5898
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5607
5899
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5608
5900
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5609
|
-
const dummyToolCallId = (
|
|
5610
|
-
const approvalRequestId = (
|
|
5901
|
+
const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2();
|
|
5902
|
+
const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
|
|
5611
5903
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5612
5904
|
approvalRequestId,
|
|
5613
5905
|
dummyToolCallId
|
|
@@ -5696,7 +5988,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5696
5988
|
providerMetadata: {
|
|
5697
5989
|
[providerOptionsName]: {
|
|
5698
5990
|
itemId: value.item.id,
|
|
5699
|
-
reasoningEncryptedContent: (
|
|
5991
|
+
reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
|
|
5700
5992
|
}
|
|
5701
5993
|
}
|
|
5702
5994
|
});
|
|
@@ -5809,7 +6101,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5809
6101
|
id: value.item_id,
|
|
5810
6102
|
delta: value.delta
|
|
5811
6103
|
});
|
|
5812
|
-
if (((
|
|
6104
|
+
if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
|
|
5813
6105
|
logprobs.push(value.logprobs);
|
|
5814
6106
|
}
|
|
5815
6107
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -5838,7 +6130,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5838
6130
|
providerMetadata: {
|
|
5839
6131
|
[providerOptionsName]: {
|
|
5840
6132
|
itemId: value.item_id,
|
|
5841
|
-
reasoningEncryptedContent: (
|
|
6133
|
+
reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
|
|
5842
6134
|
}
|
|
5843
6135
|
}
|
|
5844
6136
|
});
|
|
@@ -5872,10 +6164,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5872
6164
|
} else if (isResponseFinishedChunk(value)) {
|
|
5873
6165
|
finishReason = {
|
|
5874
6166
|
unified: mapOpenAIResponseFinishReason({
|
|
5875
|
-
finishReason: (
|
|
6167
|
+
finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
|
|
5876
6168
|
hasFunctionCall
|
|
5877
6169
|
}),
|
|
5878
|
-
raw: (
|
|
6170
|
+
raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
|
|
5879
6171
|
};
|
|
5880
6172
|
usage = value.response.usage;
|
|
5881
6173
|
if (typeof value.response.service_tier === "string") {
|
|
@@ -5887,7 +6179,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5887
6179
|
controller.enqueue({
|
|
5888
6180
|
type: "source",
|
|
5889
6181
|
sourceType: "url",
|
|
5890
|
-
id: (
|
|
6182
|
+
id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : generateId2(),
|
|
5891
6183
|
url: value.annotation.url,
|
|
5892
6184
|
title: value.annotation.title
|
|
5893
6185
|
});
|
|
@@ -5895,7 +6187,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5895
6187
|
controller.enqueue({
|
|
5896
6188
|
type: "source",
|
|
5897
6189
|
sourceType: "document",
|
|
5898
|
-
id: (
|
|
6190
|
+
id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : generateId2(),
|
|
5899
6191
|
mediaType: "text/plain",
|
|
5900
6192
|
title: value.annotation.filename,
|
|
5901
6193
|
filename: value.annotation.filename,
|
|
@@ -5911,7 +6203,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5911
6203
|
controller.enqueue({
|
|
5912
6204
|
type: "source",
|
|
5913
6205
|
sourceType: "document",
|
|
5914
|
-
id: (
|
|
6206
|
+
id: (_G = (_F = (_E = self.config).generateId) == null ? void 0 : _F.call(_E)) != null ? _G : generateId2(),
|
|
5915
6207
|
mediaType: "text/plain",
|
|
5916
6208
|
title: value.annotation.filename,
|
|
5917
6209
|
filename: value.annotation.filename,
|
|
@@ -5927,7 +6219,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5927
6219
|
controller.enqueue({
|
|
5928
6220
|
type: "source",
|
|
5929
6221
|
sourceType: "document",
|
|
5930
|
-
id: (
|
|
6222
|
+
id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : generateId2(),
|
|
5931
6223
|
mediaType: "application/octet-stream",
|
|
5932
6224
|
title: value.annotation.file_id,
|
|
5933
6225
|
filename: value.annotation.file_id,
|
|
@@ -6045,13 +6337,13 @@ import {
|
|
|
6045
6337
|
} from "@ai-sdk/provider-utils";
|
|
6046
6338
|
|
|
6047
6339
|
// src/speech/openai-speech-options.ts
|
|
6048
|
-
import { lazySchema as
|
|
6049
|
-
import { z as
|
|
6050
|
-
var openaiSpeechModelOptionsSchema =
|
|
6051
|
-
() =>
|
|
6052
|
-
|
|
6053
|
-
instructions:
|
|
6054
|
-
speed:
|
|
6340
|
+
import { lazySchema as lazySchema21, zodSchema as zodSchema21 } from "@ai-sdk/provider-utils";
|
|
6341
|
+
import { z as z23 } from "zod/v4";
|
|
6342
|
+
var openaiSpeechModelOptionsSchema = lazySchema21(
|
|
6343
|
+
() => zodSchema21(
|
|
6344
|
+
z23.object({
|
|
6345
|
+
instructions: z23.string().nullish(),
|
|
6346
|
+
speed: z23.number().min(0.25).max(4).default(1).nullish()
|
|
6055
6347
|
})
|
|
6056
6348
|
)
|
|
6057
6349
|
);
|
|
@@ -6168,33 +6460,33 @@ import {
|
|
|
6168
6460
|
} from "@ai-sdk/provider-utils";
|
|
6169
6461
|
|
|
6170
6462
|
// src/transcription/openai-transcription-api.ts
|
|
6171
|
-
import { lazySchema as
|
|
6172
|
-
import { z as
|
|
6173
|
-
var openaiTranscriptionResponseSchema =
|
|
6174
|
-
() =>
|
|
6175
|
-
|
|
6176
|
-
text:
|
|
6177
|
-
language:
|
|
6178
|
-
duration:
|
|
6179
|
-
words:
|
|
6180
|
-
|
|
6181
|
-
word:
|
|
6182
|
-
start:
|
|
6183
|
-
end:
|
|
6463
|
+
import { lazySchema as lazySchema22, zodSchema as zodSchema22 } from "@ai-sdk/provider-utils";
|
|
6464
|
+
import { z as z24 } from "zod/v4";
|
|
6465
|
+
var openaiTranscriptionResponseSchema = lazySchema22(
|
|
6466
|
+
() => zodSchema22(
|
|
6467
|
+
z24.object({
|
|
6468
|
+
text: z24.string(),
|
|
6469
|
+
language: z24.string().nullish(),
|
|
6470
|
+
duration: z24.number().nullish(),
|
|
6471
|
+
words: z24.array(
|
|
6472
|
+
z24.object({
|
|
6473
|
+
word: z24.string(),
|
|
6474
|
+
start: z24.number(),
|
|
6475
|
+
end: z24.number()
|
|
6184
6476
|
})
|
|
6185
6477
|
).nullish(),
|
|
6186
|
-
segments:
|
|
6187
|
-
|
|
6188
|
-
id:
|
|
6189
|
-
seek:
|
|
6190
|
-
start:
|
|
6191
|
-
end:
|
|
6192
|
-
text:
|
|
6193
|
-
tokens:
|
|
6194
|
-
temperature:
|
|
6195
|
-
avg_logprob:
|
|
6196
|
-
compression_ratio:
|
|
6197
|
-
no_speech_prob:
|
|
6478
|
+
segments: z24.array(
|
|
6479
|
+
z24.object({
|
|
6480
|
+
id: z24.number(),
|
|
6481
|
+
seek: z24.number(),
|
|
6482
|
+
start: z24.number(),
|
|
6483
|
+
end: z24.number(),
|
|
6484
|
+
text: z24.string(),
|
|
6485
|
+
tokens: z24.array(z24.number()),
|
|
6486
|
+
temperature: z24.number(),
|
|
6487
|
+
avg_logprob: z24.number(),
|
|
6488
|
+
compression_ratio: z24.number(),
|
|
6489
|
+
no_speech_prob: z24.number()
|
|
6198
6490
|
})
|
|
6199
6491
|
).nullish()
|
|
6200
6492
|
})
|
|
@@ -6202,33 +6494,33 @@ var openaiTranscriptionResponseSchema = lazySchema21(
|
|
|
6202
6494
|
);
|
|
6203
6495
|
|
|
6204
6496
|
// src/transcription/openai-transcription-options.ts
|
|
6205
|
-
import { lazySchema as
|
|
6206
|
-
import { z as
|
|
6207
|
-
var openAITranscriptionModelOptions =
|
|
6208
|
-
() =>
|
|
6209
|
-
|
|
6497
|
+
import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
|
|
6498
|
+
import { z as z25 } from "zod/v4";
|
|
6499
|
+
var openAITranscriptionModelOptions = lazySchema23(
|
|
6500
|
+
() => zodSchema23(
|
|
6501
|
+
z25.object({
|
|
6210
6502
|
/**
|
|
6211
6503
|
* Additional information to include in the transcription response.
|
|
6212
6504
|
*/
|
|
6213
|
-
include:
|
|
6505
|
+
include: z25.array(z25.string()).optional(),
|
|
6214
6506
|
/**
|
|
6215
6507
|
* The language of the input audio in ISO-639-1 format.
|
|
6216
6508
|
*/
|
|
6217
|
-
language:
|
|
6509
|
+
language: z25.string().optional(),
|
|
6218
6510
|
/**
|
|
6219
6511
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
6220
6512
|
*/
|
|
6221
|
-
prompt:
|
|
6513
|
+
prompt: z25.string().optional(),
|
|
6222
6514
|
/**
|
|
6223
6515
|
* The sampling temperature, between 0 and 1.
|
|
6224
6516
|
* @default 0
|
|
6225
6517
|
*/
|
|
6226
|
-
temperature:
|
|
6518
|
+
temperature: z25.number().min(0).max(1).default(0).optional(),
|
|
6227
6519
|
/**
|
|
6228
6520
|
* The timestamp granularities to populate for this transcription.
|
|
6229
6521
|
* @default ['segment']
|
|
6230
6522
|
*/
|
|
6231
|
-
timestampGranularities:
|
|
6523
|
+
timestampGranularities: z25.array(z25.enum(["word", "segment"])).default(["segment"]).optional()
|
|
6232
6524
|
})
|
|
6233
6525
|
)
|
|
6234
6526
|
);
|
|
@@ -6401,7 +6693,7 @@ var OpenAITranscriptionModel = class {
|
|
|
6401
6693
|
};
|
|
6402
6694
|
|
|
6403
6695
|
// src/version.ts
|
|
6404
|
-
var VERSION = true ? "3.0.
|
|
6696
|
+
var VERSION = true ? "3.0.46" : "0.0.0-test";
|
|
6405
6697
|
|
|
6406
6698
|
// src/openai-provider.ts
|
|
6407
6699
|
function createOpenAI(options = {}) {
|