@ai-sdk/openai 4.0.0-beta.2 → 4.0.0-beta.20
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 +225 -22
- package/README.md +2 -0
- package/dist/index.d.mts +124 -35
- package/dist/index.d.ts +124 -35
- package/dist/index.js +1319 -895
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1275 -844
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +102 -36
- package/dist/internal/index.d.ts +102 -36
- package/dist/internal/index.js +1348 -934
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1332 -911
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +274 -9
- package/package.json +3 -5
- package/src/chat/convert-openai-chat-usage.ts +2 -2
- package/src/chat/convert-to-openai-chat-messages.ts +5 -5
- package/src/chat/map-openai-finish-reason.ts +2 -2
- package/src/chat/openai-chat-language-model.ts +32 -24
- package/src/chat/openai-chat-options.ts +5 -0
- package/src/chat/openai-chat-prepare-tools.ts +6 -6
- package/src/completion/convert-openai-completion-usage.ts +2 -2
- package/src/completion/convert-to-openai-completion-prompt.ts +2 -2
- package/src/completion/map-openai-finish-reason.ts +2 -2
- package/src/completion/openai-completion-language-model.ts +20 -20
- package/src/embedding/openai-embedding-model.ts +5 -5
- package/src/image/openai-image-model.ts +9 -9
- package/src/index.ts +1 -0
- package/src/openai-language-model-capabilities.ts +3 -2
- package/src/openai-provider.ts +21 -21
- package/src/openai-tools.ts +12 -1
- package/src/responses/convert-openai-responses-usage.ts +2 -2
- package/src/responses/convert-to-openai-responses-input.ts +159 -12
- package/src/responses/map-openai-responses-finish-reason.ts +2 -2
- package/src/responses/openai-responses-api.ts +136 -2
- package/src/responses/openai-responses-language-model.ts +233 -37
- package/src/responses/openai-responses-options.ts +24 -2
- package/src/responses/openai-responses-prepare-tools.ts +34 -9
- package/src/responses/openai-responses-provider-metadata.ts +10 -0
- package/src/speech/openai-speech-model.ts +7 -7
- package/src/tool/custom.ts +0 -6
- package/src/tool/tool-search.ts +98 -0
- package/src/transcription/openai-transcription-model.ts +8 -8
package/dist/index.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
createEventSourceResponseHandler,
|
|
16
16
|
createJsonResponseHandler,
|
|
17
17
|
generateId,
|
|
18
|
+
isCustomReasoning,
|
|
18
19
|
isParsableJson,
|
|
19
20
|
parseProviderOptions,
|
|
20
21
|
postJsonToApi
|
|
@@ -42,9 +43,9 @@ var openaiFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
42
43
|
// src/openai-language-model-capabilities.ts
|
|
43
44
|
function getOpenAILanguageModelCapabilities(modelId) {
|
|
44
45
|
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
45
|
-
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5
|
|
46
|
+
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") && !modelId.startsWith("gpt-5.4-nano") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
46
47
|
const isReasoningModel = modelId.startsWith("o1") || modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
47
|
-
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.4");
|
|
48
|
+
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1") || modelId.startsWith("gpt-5.2") || modelId.startsWith("gpt-5.3") || modelId.startsWith("gpt-5.4");
|
|
48
49
|
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
49
50
|
return {
|
|
50
51
|
supportsFlexProcessing,
|
|
@@ -639,7 +640,7 @@ function prepareChatTools({
|
|
|
639
640
|
// src/chat/openai-chat-language-model.ts
|
|
640
641
|
var OpenAIChatLanguageModel = class {
|
|
641
642
|
constructor(modelId, config) {
|
|
642
|
-
this.specificationVersion = "
|
|
643
|
+
this.specificationVersion = "v4";
|
|
643
644
|
this.supportedUrls = {
|
|
644
645
|
"image/*": [/^https?:\/\/.*$/]
|
|
645
646
|
};
|
|
@@ -662,9 +663,10 @@ var OpenAIChatLanguageModel = class {
|
|
|
662
663
|
seed,
|
|
663
664
|
tools,
|
|
664
665
|
toolChoice,
|
|
666
|
+
reasoning,
|
|
665
667
|
providerOptions
|
|
666
668
|
}) {
|
|
667
|
-
var _a, _b, _c, _d, _e;
|
|
669
|
+
var _a, _b, _c, _d, _e, _f;
|
|
668
670
|
const warnings = [];
|
|
669
671
|
const openaiOptions = (_a = await parseProviderOptions({
|
|
670
672
|
provider: "openai",
|
|
@@ -672,18 +674,19 @@ var OpenAIChatLanguageModel = class {
|
|
|
672
674
|
schema: openaiLanguageModelChatOptions
|
|
673
675
|
})) != null ? _a : {};
|
|
674
676
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
675
|
-
const
|
|
677
|
+
const resolvedReasoningEffort = (_b = openaiOptions.reasoningEffort) != null ? _b : isCustomReasoning(reasoning) ? reasoning : void 0;
|
|
678
|
+
const isReasoningModel = (_c = openaiOptions.forceReasoning) != null ? _c : modelCapabilities.isReasoningModel;
|
|
676
679
|
if (topK != null) {
|
|
677
680
|
warnings.push({ type: "unsupported", feature: "topK" });
|
|
678
681
|
}
|
|
679
682
|
const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages(
|
|
680
683
|
{
|
|
681
684
|
prompt,
|
|
682
|
-
systemMessageMode: (
|
|
685
|
+
systemMessageMode: (_d = openaiOptions.systemMessageMode) != null ? _d : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode
|
|
683
686
|
}
|
|
684
687
|
);
|
|
685
688
|
warnings.push(...messageWarnings);
|
|
686
|
-
const strictJsonSchema = (
|
|
689
|
+
const strictJsonSchema = (_e = openaiOptions.strictJsonSchema) != null ? _e : true;
|
|
687
690
|
const baseArgs = {
|
|
688
691
|
// model id:
|
|
689
692
|
model: this.modelId,
|
|
@@ -704,7 +707,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
704
707
|
json_schema: {
|
|
705
708
|
schema: responseFormat.schema,
|
|
706
709
|
strict: strictJsonSchema,
|
|
707
|
-
name: (
|
|
710
|
+
name: (_f = responseFormat.name) != null ? _f : "response",
|
|
708
711
|
description: responseFormat.description
|
|
709
712
|
}
|
|
710
713
|
} : { type: "json_object" } : void 0,
|
|
@@ -717,7 +720,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
717
720
|
store: openaiOptions.store,
|
|
718
721
|
metadata: openaiOptions.metadata,
|
|
719
722
|
prediction: openaiOptions.prediction,
|
|
720
|
-
reasoning_effort:
|
|
723
|
+
reasoning_effort: resolvedReasoningEffort,
|
|
721
724
|
service_tier: openaiOptions.serviceTier,
|
|
722
725
|
prompt_cache_key: openaiOptions.promptCacheKey,
|
|
723
726
|
prompt_cache_retention: openaiOptions.promptCacheRetention,
|
|
@@ -726,7 +729,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
726
729
|
messages
|
|
727
730
|
};
|
|
728
731
|
if (isReasoningModel) {
|
|
729
|
-
if (
|
|
732
|
+
if (resolvedReasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
|
|
730
733
|
if (baseArgs.temperature != null) {
|
|
731
734
|
baseArgs.temperature = void 0;
|
|
732
735
|
warnings.push({
|
|
@@ -1383,7 +1386,7 @@ var openaiLanguageModelCompletionOptions = lazySchema4(
|
|
|
1383
1386
|
// src/completion/openai-completion-language-model.ts
|
|
1384
1387
|
var OpenAICompletionLanguageModel = class {
|
|
1385
1388
|
constructor(modelId, config) {
|
|
1386
|
-
this.specificationVersion = "
|
|
1389
|
+
this.specificationVersion = "v4";
|
|
1387
1390
|
this.supportedUrls = {
|
|
1388
1391
|
// No URLs are supported for completion models.
|
|
1389
1392
|
};
|
|
@@ -1655,7 +1658,7 @@ var openaiTextEmbeddingResponseSchema = lazySchema6(
|
|
|
1655
1658
|
// src/embedding/openai-embedding-model.ts
|
|
1656
1659
|
var OpenAIEmbeddingModel = class {
|
|
1657
1660
|
constructor(modelId, config) {
|
|
1658
|
-
this.specificationVersion = "
|
|
1661
|
+
this.specificationVersion = "v4";
|
|
1659
1662
|
this.maxEmbeddingsPerCall = 2048;
|
|
1660
1663
|
this.supportsParallelCalls = true;
|
|
1661
1664
|
this.modelId = modelId;
|
|
@@ -1784,7 +1787,7 @@ var OpenAIImageModel = class {
|
|
|
1784
1787
|
constructor(modelId, config) {
|
|
1785
1788
|
this.modelId = modelId;
|
|
1786
1789
|
this.config = config;
|
|
1787
|
-
this.specificationVersion = "
|
|
1790
|
+
this.specificationVersion = "v4";
|
|
1788
1791
|
}
|
|
1789
1792
|
get maxImagesPerCall() {
|
|
1790
1793
|
var _a;
|
|
@@ -2076,7 +2079,6 @@ import { z as z11 } from "zod/v4";
|
|
|
2076
2079
|
var customArgsSchema = lazySchema10(
|
|
2077
2080
|
() => zodSchema10(
|
|
2078
2081
|
z11.object({
|
|
2079
|
-
name: z11.string(),
|
|
2080
2082
|
description: z11.string().optional(),
|
|
2081
2083
|
format: z11.union([
|
|
2082
2084
|
z11.object({
|
|
@@ -2321,74 +2323,56 @@ var shell = createProviderToolFactoryWithOutputSchema6({
|
|
|
2321
2323
|
outputSchema: shellOutputSchema
|
|
2322
2324
|
});
|
|
2323
2325
|
|
|
2324
|
-
// src/tool/
|
|
2326
|
+
// src/tool/tool-search.ts
|
|
2325
2327
|
import {
|
|
2326
2328
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
2327
2329
|
lazySchema as lazySchema15,
|
|
2328
2330
|
zodSchema as zodSchema15
|
|
2329
2331
|
} from "@ai-sdk/provider-utils";
|
|
2330
2332
|
import { z as z16 } from "zod/v4";
|
|
2331
|
-
var
|
|
2333
|
+
var toolSearchArgsSchema = lazySchema15(
|
|
2332
2334
|
() => zodSchema15(
|
|
2333
2335
|
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()
|
|
2336
|
+
execution: z16.enum(["server", "client"]).optional(),
|
|
2337
|
+
description: z16.string().optional(),
|
|
2338
|
+
parameters: z16.record(z16.string(), z16.unknown()).optional()
|
|
2344
2339
|
})
|
|
2345
2340
|
)
|
|
2346
2341
|
);
|
|
2347
|
-
var
|
|
2348
|
-
var webSearchOutputSchema = lazySchema15(
|
|
2342
|
+
var toolSearchInputSchema = lazySchema15(
|
|
2349
2343
|
() => zodSchema15(
|
|
2350
2344
|
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()
|
|
2345
|
+
arguments: z16.unknown().optional(),
|
|
2346
|
+
call_id: z16.string().nullish()
|
|
2372
2347
|
})
|
|
2373
2348
|
)
|
|
2374
2349
|
);
|
|
2375
|
-
var
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2350
|
+
var toolSearchOutputSchema = lazySchema15(
|
|
2351
|
+
() => zodSchema15(
|
|
2352
|
+
z16.object({
|
|
2353
|
+
tools: z16.array(z16.record(z16.string(), z16.unknown()))
|
|
2354
|
+
})
|
|
2355
|
+
)
|
|
2356
|
+
);
|
|
2357
|
+
var toolSearchToolFactory = createProviderToolFactoryWithOutputSchema7({
|
|
2358
|
+
id: "openai.tool_search",
|
|
2359
|
+
inputSchema: toolSearchInputSchema,
|
|
2360
|
+
outputSchema: toolSearchOutputSchema
|
|
2379
2361
|
});
|
|
2380
|
-
var
|
|
2362
|
+
var toolSearch = (args = {}) => toolSearchToolFactory(args);
|
|
2381
2363
|
|
|
2382
|
-
// src/tool/web-search
|
|
2364
|
+
// src/tool/web-search.ts
|
|
2383
2365
|
import {
|
|
2384
2366
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
2385
2367
|
lazySchema as lazySchema16,
|
|
2386
2368
|
zodSchema as zodSchema16
|
|
2387
2369
|
} from "@ai-sdk/provider-utils";
|
|
2388
2370
|
import { z as z17 } from "zod/v4";
|
|
2389
|
-
var
|
|
2371
|
+
var webSearchArgsSchema = lazySchema16(
|
|
2390
2372
|
() => zodSchema16(
|
|
2391
2373
|
z17.object({
|
|
2374
|
+
externalWebAccess: z17.boolean().optional(),
|
|
2375
|
+
filters: z17.object({ allowedDomains: z17.array(z17.string()).optional() }).optional(),
|
|
2392
2376
|
searchContextSize: z17.enum(["low", "medium", "high"]).optional(),
|
|
2393
2377
|
userLocation: z17.object({
|
|
2394
2378
|
type: z17.literal("approximate"),
|
|
@@ -2400,10 +2384,8 @@ var webSearchPreviewArgsSchema = lazySchema16(
|
|
|
2400
2384
|
})
|
|
2401
2385
|
)
|
|
2402
2386
|
);
|
|
2403
|
-
var
|
|
2404
|
-
|
|
2405
|
-
);
|
|
2406
|
-
var webSearchPreviewOutputSchema = lazySchema16(
|
|
2387
|
+
var webSearchInputSchema = lazySchema16(() => zodSchema16(z17.object({})));
|
|
2388
|
+
var webSearchOutputSchema = lazySchema16(
|
|
2407
2389
|
() => zodSchema16(
|
|
2408
2390
|
z17.object({
|
|
2409
2391
|
action: z17.discriminatedUnion("type", [
|
|
@@ -2420,77 +2402,135 @@ var webSearchPreviewOutputSchema = lazySchema16(
|
|
|
2420
2402
|
url: z17.string().nullish(),
|
|
2421
2403
|
pattern: z17.string().nullish()
|
|
2422
2404
|
})
|
|
2423
|
-
]).optional()
|
|
2405
|
+
]).optional(),
|
|
2406
|
+
sources: z17.array(
|
|
2407
|
+
z17.discriminatedUnion("type", [
|
|
2408
|
+
z17.object({ type: z17.literal("url"), url: z17.string() }),
|
|
2409
|
+
z17.object({ type: z17.literal("api"), name: z17.string() })
|
|
2410
|
+
])
|
|
2411
|
+
).optional()
|
|
2424
2412
|
})
|
|
2425
2413
|
)
|
|
2426
2414
|
);
|
|
2427
|
-
var
|
|
2428
|
-
id: "openai.
|
|
2429
|
-
inputSchema:
|
|
2430
|
-
outputSchema:
|
|
2415
|
+
var webSearchToolFactory = createProviderToolFactoryWithOutputSchema8({
|
|
2416
|
+
id: "openai.web_search",
|
|
2417
|
+
inputSchema: webSearchInputSchema,
|
|
2418
|
+
outputSchema: webSearchOutputSchema
|
|
2431
2419
|
});
|
|
2420
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2432
2421
|
|
|
2433
|
-
// src/tool/
|
|
2422
|
+
// src/tool/web-search-preview.ts
|
|
2434
2423
|
import {
|
|
2435
2424
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
2436
2425
|
lazySchema as lazySchema17,
|
|
2437
2426
|
zodSchema as zodSchema17
|
|
2438
2427
|
} from "@ai-sdk/provider-utils";
|
|
2439
2428
|
import { z as z18 } from "zod/v4";
|
|
2440
|
-
var
|
|
2441
|
-
() =>
|
|
2442
|
-
z18.
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2429
|
+
var webSearchPreviewArgsSchema = lazySchema17(
|
|
2430
|
+
() => zodSchema17(
|
|
2431
|
+
z18.object({
|
|
2432
|
+
searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
|
|
2433
|
+
userLocation: z18.object({
|
|
2434
|
+
type: z18.literal("approximate"),
|
|
2435
|
+
country: z18.string().optional(),
|
|
2436
|
+
city: z18.string().optional(),
|
|
2437
|
+
region: z18.string().optional(),
|
|
2438
|
+
timezone: z18.string().optional()
|
|
2439
|
+
}).optional()
|
|
2440
|
+
})
|
|
2441
|
+
)
|
|
2442
|
+
);
|
|
2443
|
+
var webSearchPreviewInputSchema = lazySchema17(
|
|
2444
|
+
() => zodSchema17(z18.object({}))
|
|
2449
2445
|
);
|
|
2450
|
-
var
|
|
2446
|
+
var webSearchPreviewOutputSchema = lazySchema17(
|
|
2451
2447
|
() => zodSchema17(
|
|
2452
2448
|
z18.object({
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2449
|
+
action: z18.discriminatedUnion("type", [
|
|
2450
|
+
z18.object({
|
|
2451
|
+
type: z18.literal("search"),
|
|
2452
|
+
query: z18.string().optional()
|
|
2453
|
+
}),
|
|
2456
2454
|
z18.object({
|
|
2457
|
-
|
|
2458
|
-
|
|
2455
|
+
type: z18.literal("openPage"),
|
|
2456
|
+
url: z18.string().nullish()
|
|
2457
|
+
}),
|
|
2458
|
+
z18.object({
|
|
2459
|
+
type: z18.literal("findInPage"),
|
|
2460
|
+
url: z18.string().nullish(),
|
|
2461
|
+
pattern: z18.string().nullish()
|
|
2462
|
+
})
|
|
2463
|
+
]).optional()
|
|
2464
|
+
})
|
|
2465
|
+
)
|
|
2466
|
+
);
|
|
2467
|
+
var webSearchPreview = createProviderToolFactoryWithOutputSchema9({
|
|
2468
|
+
id: "openai.web_search_preview",
|
|
2469
|
+
inputSchema: webSearchPreviewInputSchema,
|
|
2470
|
+
outputSchema: webSearchPreviewOutputSchema
|
|
2471
|
+
});
|
|
2472
|
+
|
|
2473
|
+
// src/tool/mcp.ts
|
|
2474
|
+
import {
|
|
2475
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema10,
|
|
2476
|
+
lazySchema as lazySchema18,
|
|
2477
|
+
zodSchema as zodSchema18
|
|
2478
|
+
} from "@ai-sdk/provider-utils";
|
|
2479
|
+
import { z as z19 } from "zod/v4";
|
|
2480
|
+
var jsonValueSchema = z19.lazy(
|
|
2481
|
+
() => z19.union([
|
|
2482
|
+
z19.string(),
|
|
2483
|
+
z19.number(),
|
|
2484
|
+
z19.boolean(),
|
|
2485
|
+
z19.null(),
|
|
2486
|
+
z19.array(jsonValueSchema),
|
|
2487
|
+
z19.record(z19.string(), jsonValueSchema)
|
|
2488
|
+
])
|
|
2489
|
+
);
|
|
2490
|
+
var mcpArgsSchema = lazySchema18(
|
|
2491
|
+
() => zodSchema18(
|
|
2492
|
+
z19.object({
|
|
2493
|
+
serverLabel: z19.string(),
|
|
2494
|
+
allowedTools: z19.union([
|
|
2495
|
+
z19.array(z19.string()),
|
|
2496
|
+
z19.object({
|
|
2497
|
+
readOnly: z19.boolean().optional(),
|
|
2498
|
+
toolNames: z19.array(z19.string()).optional()
|
|
2459
2499
|
})
|
|
2460
2500
|
]).optional(),
|
|
2461
|
-
authorization:
|
|
2462
|
-
connectorId:
|
|
2463
|
-
headers:
|
|
2464
|
-
requireApproval:
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
never:
|
|
2468
|
-
toolNames:
|
|
2501
|
+
authorization: z19.string().optional(),
|
|
2502
|
+
connectorId: z19.string().optional(),
|
|
2503
|
+
headers: z19.record(z19.string(), z19.string()).optional(),
|
|
2504
|
+
requireApproval: z19.union([
|
|
2505
|
+
z19.enum(["always", "never"]),
|
|
2506
|
+
z19.object({
|
|
2507
|
+
never: z19.object({
|
|
2508
|
+
toolNames: z19.array(z19.string()).optional()
|
|
2469
2509
|
}).optional()
|
|
2470
2510
|
})
|
|
2471
2511
|
]).optional(),
|
|
2472
|
-
serverDescription:
|
|
2473
|
-
serverUrl:
|
|
2512
|
+
serverDescription: z19.string().optional(),
|
|
2513
|
+
serverUrl: z19.string().optional()
|
|
2474
2514
|
}).refine(
|
|
2475
2515
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2476
2516
|
"One of serverUrl or connectorId must be provided."
|
|
2477
2517
|
)
|
|
2478
2518
|
)
|
|
2479
2519
|
);
|
|
2480
|
-
var mcpInputSchema =
|
|
2481
|
-
var mcpOutputSchema =
|
|
2482
|
-
() =>
|
|
2483
|
-
|
|
2484
|
-
type:
|
|
2485
|
-
serverLabel:
|
|
2486
|
-
name:
|
|
2487
|
-
arguments:
|
|
2488
|
-
output:
|
|
2489
|
-
error:
|
|
2520
|
+
var mcpInputSchema = lazySchema18(() => zodSchema18(z19.object({})));
|
|
2521
|
+
var mcpOutputSchema = lazySchema18(
|
|
2522
|
+
() => zodSchema18(
|
|
2523
|
+
z19.object({
|
|
2524
|
+
type: z19.literal("call"),
|
|
2525
|
+
serverLabel: z19.string(),
|
|
2526
|
+
name: z19.string(),
|
|
2527
|
+
arguments: z19.string(),
|
|
2528
|
+
output: z19.string().nullish(),
|
|
2529
|
+
error: z19.union([z19.string(), jsonValueSchema]).optional()
|
|
2490
2530
|
})
|
|
2491
2531
|
)
|
|
2492
2532
|
);
|
|
2493
|
-
var mcpToolFactory =
|
|
2533
|
+
var mcpToolFactory = createProviderToolFactoryWithOutputSchema10({
|
|
2494
2534
|
id: "openai.mcp",
|
|
2495
2535
|
inputSchema: mcpInputSchema,
|
|
2496
2536
|
outputSchema: mcpOutputSchema
|
|
@@ -2512,7 +2552,6 @@ var openaiTools = {
|
|
|
2512
2552
|
* Lark syntax). The model returns a `custom_tool_call` output item whose
|
|
2513
2553
|
* `input` field is a string matching the specified grammar.
|
|
2514
2554
|
*
|
|
2515
|
-
* @param name - The name of the custom tool.
|
|
2516
2555
|
* @param description - An optional description of the tool.
|
|
2517
2556
|
* @param format - The output format constraint (grammar type, syntax, and definition).
|
|
2518
2557
|
*/
|
|
@@ -2602,7 +2641,17 @@ var openaiTools = {
|
|
|
2602
2641
|
* @param serverDescription - Optional description of the server.
|
|
2603
2642
|
* @param serverUrl - URL for the MCP server.
|
|
2604
2643
|
*/
|
|
2605
|
-
mcp
|
|
2644
|
+
mcp,
|
|
2645
|
+
/**
|
|
2646
|
+
* Tool search allows the model to dynamically search for and load deferred
|
|
2647
|
+
* tools into the model's context as needed. This helps reduce overall token
|
|
2648
|
+
* usage, cost, and latency by only loading tools when the model needs them.
|
|
2649
|
+
*
|
|
2650
|
+
* To use tool search, mark functions or namespaces with `defer_loading: true`
|
|
2651
|
+
* in the tools array. The model will use tool search to load these tools
|
|
2652
|
+
* when it determines they are needed.
|
|
2653
|
+
*/
|
|
2654
|
+
toolSearch
|
|
2606
2655
|
};
|
|
2607
2656
|
|
|
2608
2657
|
// src/responses/openai-responses-language-model.ts
|
|
@@ -2615,6 +2664,7 @@ import {
|
|
|
2615
2664
|
createJsonResponseHandler as createJsonResponseHandler5,
|
|
2616
2665
|
createToolNameMapping,
|
|
2617
2666
|
generateId as generateId2,
|
|
2667
|
+
isCustomReasoning as isCustomReasoning2,
|
|
2618
2668
|
parseProviderOptions as parseProviderOptions5,
|
|
2619
2669
|
postJsonToApi as postJsonToApi5
|
|
2620
2670
|
} from "@ai-sdk/provider-utils";
|
|
@@ -2665,10 +2715,11 @@ import {
|
|
|
2665
2715
|
import {
|
|
2666
2716
|
convertToBase64 as convertToBase642,
|
|
2667
2717
|
isNonNullable,
|
|
2718
|
+
parseJSON,
|
|
2668
2719
|
parseProviderOptions as parseProviderOptions4,
|
|
2669
2720
|
validateTypes
|
|
2670
2721
|
} from "@ai-sdk/provider-utils";
|
|
2671
|
-
import { z as
|
|
2722
|
+
import { z as z20 } from "zod/v4";
|
|
2672
2723
|
function isFileId(data, prefixes) {
|
|
2673
2724
|
if (!prefixes) return false;
|
|
2674
2725
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2686,8 +2737,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2686
2737
|
hasApplyPatchTool = false,
|
|
2687
2738
|
customProviderToolNames
|
|
2688
2739
|
}) {
|
|
2689
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2690
|
-
|
|
2740
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
2741
|
+
let input = [];
|
|
2691
2742
|
const warnings = [];
|
|
2692
2743
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
2693
2744
|
for (const { role, content } of prompt) {
|
|
@@ -2790,6 +2841,32 @@ async function convertToOpenAIResponsesInput({
|
|
|
2790
2841
|
if (hasConversation && id != null) {
|
|
2791
2842
|
break;
|
|
2792
2843
|
}
|
|
2844
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2845
|
+
part.toolName
|
|
2846
|
+
);
|
|
2847
|
+
if (resolvedToolName === "tool_search") {
|
|
2848
|
+
if (store && id != null) {
|
|
2849
|
+
input.push({ type: "item_reference", id });
|
|
2850
|
+
break;
|
|
2851
|
+
}
|
|
2852
|
+
const parsedInput = typeof part.input === "string" ? await parseJSON({
|
|
2853
|
+
text: part.input,
|
|
2854
|
+
schema: toolSearchInputSchema
|
|
2855
|
+
}) : await validateTypes({
|
|
2856
|
+
value: part.input,
|
|
2857
|
+
schema: toolSearchInputSchema
|
|
2858
|
+
});
|
|
2859
|
+
const execution = parsedInput.call_id != null ? "client" : "server";
|
|
2860
|
+
input.push({
|
|
2861
|
+
type: "tool_search_call",
|
|
2862
|
+
id: id != null ? id : part.toolCallId,
|
|
2863
|
+
execution,
|
|
2864
|
+
call_id: (_g = parsedInput.call_id) != null ? _g : null,
|
|
2865
|
+
status: "completed",
|
|
2866
|
+
arguments: parsedInput.arguments
|
|
2867
|
+
});
|
|
2868
|
+
break;
|
|
2869
|
+
}
|
|
2793
2870
|
if (part.providerExecuted) {
|
|
2794
2871
|
if (store && id != null) {
|
|
2795
2872
|
input.push({ type: "item_reference", id });
|
|
@@ -2800,9 +2877,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2800
2877
|
input.push({ type: "item_reference", id });
|
|
2801
2878
|
break;
|
|
2802
2879
|
}
|
|
2803
|
-
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2804
|
-
part.toolName
|
|
2805
|
-
);
|
|
2806
2880
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2807
2881
|
const parsedInput = await validateTypes({
|
|
2808
2882
|
value: part.input,
|
|
@@ -2885,6 +2959,26 @@ async function convertToOpenAIResponsesInput({
|
|
|
2885
2959
|
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
2886
2960
|
part.toolName
|
|
2887
2961
|
);
|
|
2962
|
+
if (resolvedResultToolName === "tool_search") {
|
|
2963
|
+
const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2964
|
+
if (store) {
|
|
2965
|
+
input.push({ type: "item_reference", id: itemId });
|
|
2966
|
+
} else if (part.output.type === "json") {
|
|
2967
|
+
const parsedOutput = await validateTypes({
|
|
2968
|
+
value: part.output.value,
|
|
2969
|
+
schema: toolSearchOutputSchema
|
|
2970
|
+
});
|
|
2971
|
+
input.push({
|
|
2972
|
+
type: "tool_search_output",
|
|
2973
|
+
id: itemId,
|
|
2974
|
+
execution: "server",
|
|
2975
|
+
call_id: null,
|
|
2976
|
+
status: "completed",
|
|
2977
|
+
tools: parsedOutput.tools
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
2980
|
+
break;
|
|
2981
|
+
}
|
|
2888
2982
|
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2889
2983
|
if (part.output.type === "json") {
|
|
2890
2984
|
const parsedOutput = await validateTypes({
|
|
@@ -2907,7 +3001,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2907
3001
|
break;
|
|
2908
3002
|
}
|
|
2909
3003
|
if (store) {
|
|
2910
|
-
const itemId = (
|
|
3004
|
+
const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
|
|
2911
3005
|
input.push({ type: "item_reference", id: itemId });
|
|
2912
3006
|
} else {
|
|
2913
3007
|
warnings.push({
|
|
@@ -2990,6 +3084,28 @@ async function convertToOpenAIResponsesInput({
|
|
|
2990
3084
|
}
|
|
2991
3085
|
break;
|
|
2992
3086
|
}
|
|
3087
|
+
case "custom": {
|
|
3088
|
+
if (part.kind === "openai.compaction") {
|
|
3089
|
+
const providerOpts = (_n = part.providerOptions) == null ? void 0 : _n[providerOptionsName];
|
|
3090
|
+
const id = providerOpts == null ? void 0 : providerOpts.itemId;
|
|
3091
|
+
if (hasConversation && id != null) {
|
|
3092
|
+
break;
|
|
3093
|
+
}
|
|
3094
|
+
if (store && id != null) {
|
|
3095
|
+
input.push({ type: "item_reference", id });
|
|
3096
|
+
break;
|
|
3097
|
+
}
|
|
3098
|
+
const encryptedContent = providerOpts == null ? void 0 : providerOpts.encryptedContent;
|
|
3099
|
+
if (id != null) {
|
|
3100
|
+
input.push({
|
|
3101
|
+
type: "compaction",
|
|
3102
|
+
id,
|
|
3103
|
+
encrypted_content: encryptedContent
|
|
3104
|
+
});
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
break;
|
|
3108
|
+
}
|
|
2993
3109
|
}
|
|
2994
3110
|
}
|
|
2995
3111
|
break;
|
|
@@ -3017,7 +3133,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3017
3133
|
}
|
|
3018
3134
|
const output = part.output;
|
|
3019
3135
|
if (output.type === "execution-denied") {
|
|
3020
|
-
const approvalId = (
|
|
3136
|
+
const approvalId = (_p = (_o = output.providerOptions) == null ? void 0 : _o.openai) == null ? void 0 : _p.approvalId;
|
|
3021
3137
|
if (approvalId) {
|
|
3022
3138
|
continue;
|
|
3023
3139
|
}
|
|
@@ -3025,6 +3141,20 @@ async function convertToOpenAIResponsesInput({
|
|
|
3025
3141
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
3026
3142
|
part.toolName
|
|
3027
3143
|
);
|
|
3144
|
+
if (resolvedToolName === "tool_search" && output.type === "json") {
|
|
3145
|
+
const parsedOutput = await validateTypes({
|
|
3146
|
+
value: output.value,
|
|
3147
|
+
schema: toolSearchOutputSchema
|
|
3148
|
+
});
|
|
3149
|
+
input.push({
|
|
3150
|
+
type: "tool_search_output",
|
|
3151
|
+
execution: "client",
|
|
3152
|
+
call_id: part.toolCallId,
|
|
3153
|
+
status: "completed",
|
|
3154
|
+
tools: parsedOutput.tools
|
|
3155
|
+
});
|
|
3156
|
+
continue;
|
|
3157
|
+
}
|
|
3028
3158
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
3029
3159
|
const parsedOutput = await validateTypes({
|
|
3030
3160
|
value: output.value,
|
|
@@ -3077,7 +3207,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3077
3207
|
outputValue = output.value;
|
|
3078
3208
|
break;
|
|
3079
3209
|
case "execution-denied":
|
|
3080
|
-
outputValue = (
|
|
3210
|
+
outputValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
|
|
3081
3211
|
break;
|
|
3082
3212
|
case "json":
|
|
3083
3213
|
case "error-json":
|
|
@@ -3105,6 +3235,11 @@ async function convertToOpenAIResponsesInput({
|
|
|
3105
3235
|
filename: (_a2 = item.filename) != null ? _a2 : "data",
|
|
3106
3236
|
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3107
3237
|
};
|
|
3238
|
+
case "file-url":
|
|
3239
|
+
return {
|
|
3240
|
+
type: "input_file",
|
|
3241
|
+
file_url: item.url
|
|
3242
|
+
};
|
|
3108
3243
|
default:
|
|
3109
3244
|
warnings.push({
|
|
3110
3245
|
type: "other",
|
|
@@ -3131,7 +3266,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3131
3266
|
contentValue = output.value;
|
|
3132
3267
|
break;
|
|
3133
3268
|
case "execution-denied":
|
|
3134
|
-
contentValue = (
|
|
3269
|
+
contentValue = (_r = output.reason) != null ? _r : "Tool execution denied.";
|
|
3135
3270
|
break;
|
|
3136
3271
|
case "json":
|
|
3137
3272
|
case "error-json":
|
|
@@ -3163,6 +3298,12 @@ async function convertToOpenAIResponsesInput({
|
|
|
3163
3298
|
file_data: `data:${item.mediaType};base64,${item.data}`
|
|
3164
3299
|
};
|
|
3165
3300
|
}
|
|
3301
|
+
case "file-url": {
|
|
3302
|
+
return {
|
|
3303
|
+
type: "input_file",
|
|
3304
|
+
file_url: item.url
|
|
3305
|
+
};
|
|
3306
|
+
}
|
|
3166
3307
|
default: {
|
|
3167
3308
|
warnings.push({
|
|
3168
3309
|
type: "other",
|
|
@@ -3188,11 +3329,22 @@ async function convertToOpenAIResponsesInput({
|
|
|
3188
3329
|
}
|
|
3189
3330
|
}
|
|
3190
3331
|
}
|
|
3332
|
+
if (!store && input.some(
|
|
3333
|
+
(item) => "type" in item && item.type === "reasoning" && item.encrypted_content == null
|
|
3334
|
+
)) {
|
|
3335
|
+
warnings.push({
|
|
3336
|
+
type: "other",
|
|
3337
|
+
message: "Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts."
|
|
3338
|
+
});
|
|
3339
|
+
input = input.filter(
|
|
3340
|
+
(item) => !("type" in item) || item.type !== "reasoning" || item.encrypted_content != null
|
|
3341
|
+
);
|
|
3342
|
+
}
|
|
3191
3343
|
return { input, warnings };
|
|
3192
3344
|
}
|
|
3193
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3194
|
-
itemId:
|
|
3195
|
-
reasoningEncryptedContent:
|
|
3345
|
+
var openaiResponsesReasoningProviderOptionsSchema = z20.object({
|
|
3346
|
+
itemId: z20.string().nullish(),
|
|
3347
|
+
reasoningEncryptedContent: z20.string().nullish()
|
|
3196
3348
|
});
|
|
3197
3349
|
|
|
3198
3350
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3214,483 +3366,552 @@ function mapOpenAIResponseFinishReason({
|
|
|
3214
3366
|
}
|
|
3215
3367
|
|
|
3216
3368
|
// src/responses/openai-responses-api.ts
|
|
3217
|
-
import { lazySchema as
|
|
3218
|
-
import { z as
|
|
3219
|
-
var
|
|
3220
|
-
() =>
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3369
|
+
import { lazySchema as lazySchema19, zodSchema as zodSchema19 } from "@ai-sdk/provider-utils";
|
|
3370
|
+
import { z as z21 } from "zod/v4";
|
|
3371
|
+
var jsonValueSchema2 = z21.lazy(
|
|
3372
|
+
() => z21.union([
|
|
3373
|
+
z21.string(),
|
|
3374
|
+
z21.number(),
|
|
3375
|
+
z21.boolean(),
|
|
3376
|
+
z21.null(),
|
|
3377
|
+
z21.array(jsonValueSchema2),
|
|
3378
|
+
z21.record(z21.string(), jsonValueSchema2.optional())
|
|
3379
|
+
])
|
|
3380
|
+
);
|
|
3381
|
+
var openaiResponsesChunkSchema = lazySchema19(
|
|
3382
|
+
() => zodSchema19(
|
|
3383
|
+
z21.union([
|
|
3384
|
+
z21.object({
|
|
3385
|
+
type: z21.literal("response.output_text.delta"),
|
|
3386
|
+
item_id: z21.string(),
|
|
3387
|
+
delta: z21.string(),
|
|
3388
|
+
logprobs: z21.array(
|
|
3389
|
+
z21.object({
|
|
3390
|
+
token: z21.string(),
|
|
3391
|
+
logprob: z21.number(),
|
|
3392
|
+
top_logprobs: z21.array(
|
|
3393
|
+
z21.object({
|
|
3394
|
+
token: z21.string(),
|
|
3395
|
+
logprob: z21.number()
|
|
3234
3396
|
})
|
|
3235
3397
|
)
|
|
3236
3398
|
})
|
|
3237
3399
|
).nullish()
|
|
3238
3400
|
}),
|
|
3239
|
-
|
|
3240
|
-
type:
|
|
3241
|
-
response:
|
|
3242
|
-
incomplete_details:
|
|
3243
|
-
usage:
|
|
3244
|
-
input_tokens:
|
|
3245
|
-
input_tokens_details:
|
|
3246
|
-
output_tokens:
|
|
3247
|
-
output_tokens_details:
|
|
3401
|
+
z21.object({
|
|
3402
|
+
type: z21.enum(["response.completed", "response.incomplete"]),
|
|
3403
|
+
response: z21.object({
|
|
3404
|
+
incomplete_details: z21.object({ reason: z21.string() }).nullish(),
|
|
3405
|
+
usage: z21.object({
|
|
3406
|
+
input_tokens: z21.number(),
|
|
3407
|
+
input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
|
|
3408
|
+
output_tokens: z21.number(),
|
|
3409
|
+
output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
|
|
3248
3410
|
}),
|
|
3249
|
-
service_tier:
|
|
3411
|
+
service_tier: z21.string().nullish()
|
|
3250
3412
|
})
|
|
3251
3413
|
}),
|
|
3252
|
-
|
|
3253
|
-
type:
|
|
3254
|
-
response:
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3414
|
+
z21.object({
|
|
3415
|
+
type: z21.literal("response.failed"),
|
|
3416
|
+
response: z21.object({
|
|
3417
|
+
error: z21.object({
|
|
3418
|
+
code: z21.string().nullish(),
|
|
3419
|
+
message: z21.string()
|
|
3420
|
+
}).nullish(),
|
|
3421
|
+
incomplete_details: z21.object({ reason: z21.string() }).nullish(),
|
|
3422
|
+
usage: z21.object({
|
|
3423
|
+
input_tokens: z21.number(),
|
|
3424
|
+
input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
|
|
3425
|
+
output_tokens: z21.number(),
|
|
3426
|
+
output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
|
|
3427
|
+
}).nullish(),
|
|
3428
|
+
service_tier: z21.string().nullish()
|
|
3259
3429
|
})
|
|
3260
3430
|
}),
|
|
3261
|
-
|
|
3262
|
-
type:
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3431
|
+
z21.object({
|
|
3432
|
+
type: z21.literal("response.created"),
|
|
3433
|
+
response: z21.object({
|
|
3434
|
+
id: z21.string(),
|
|
3435
|
+
created_at: z21.number(),
|
|
3436
|
+
model: z21.string(),
|
|
3437
|
+
service_tier: z21.string().nullish()
|
|
3438
|
+
})
|
|
3439
|
+
}),
|
|
3440
|
+
z21.object({
|
|
3441
|
+
type: z21.literal("response.output_item.added"),
|
|
3442
|
+
output_index: z21.number(),
|
|
3443
|
+
item: z21.discriminatedUnion("type", [
|
|
3444
|
+
z21.object({
|
|
3445
|
+
type: z21.literal("message"),
|
|
3446
|
+
id: z21.string(),
|
|
3447
|
+
phase: z21.enum(["commentary", "final_answer"]).nullish()
|
|
3269
3448
|
}),
|
|
3270
|
-
|
|
3271
|
-
type:
|
|
3272
|
-
id:
|
|
3273
|
-
encrypted_content:
|
|
3449
|
+
z21.object({
|
|
3450
|
+
type: z21.literal("reasoning"),
|
|
3451
|
+
id: z21.string(),
|
|
3452
|
+
encrypted_content: z21.string().nullish()
|
|
3274
3453
|
}),
|
|
3275
|
-
|
|
3276
|
-
type:
|
|
3277
|
-
id:
|
|
3278
|
-
call_id:
|
|
3279
|
-
name:
|
|
3280
|
-
arguments:
|
|
3454
|
+
z21.object({
|
|
3455
|
+
type: z21.literal("function_call"),
|
|
3456
|
+
id: z21.string(),
|
|
3457
|
+
call_id: z21.string(),
|
|
3458
|
+
name: z21.string(),
|
|
3459
|
+
arguments: z21.string()
|
|
3281
3460
|
}),
|
|
3282
|
-
|
|
3283
|
-
type:
|
|
3284
|
-
id:
|
|
3285
|
-
status:
|
|
3461
|
+
z21.object({
|
|
3462
|
+
type: z21.literal("web_search_call"),
|
|
3463
|
+
id: z21.string(),
|
|
3464
|
+
status: z21.string()
|
|
3286
3465
|
}),
|
|
3287
|
-
|
|
3288
|
-
type:
|
|
3289
|
-
id:
|
|
3290
|
-
status:
|
|
3466
|
+
z21.object({
|
|
3467
|
+
type: z21.literal("computer_call"),
|
|
3468
|
+
id: z21.string(),
|
|
3469
|
+
status: z21.string()
|
|
3291
3470
|
}),
|
|
3292
|
-
|
|
3293
|
-
type:
|
|
3294
|
-
id:
|
|
3471
|
+
z21.object({
|
|
3472
|
+
type: z21.literal("file_search_call"),
|
|
3473
|
+
id: z21.string()
|
|
3295
3474
|
}),
|
|
3296
|
-
|
|
3297
|
-
type:
|
|
3298
|
-
id:
|
|
3475
|
+
z21.object({
|
|
3476
|
+
type: z21.literal("image_generation_call"),
|
|
3477
|
+
id: z21.string()
|
|
3299
3478
|
}),
|
|
3300
|
-
|
|
3301
|
-
type:
|
|
3302
|
-
id:
|
|
3303
|
-
container_id:
|
|
3304
|
-
code:
|
|
3305
|
-
outputs:
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3479
|
+
z21.object({
|
|
3480
|
+
type: z21.literal("code_interpreter_call"),
|
|
3481
|
+
id: z21.string(),
|
|
3482
|
+
container_id: z21.string(),
|
|
3483
|
+
code: z21.string().nullable(),
|
|
3484
|
+
outputs: z21.array(
|
|
3485
|
+
z21.discriminatedUnion("type", [
|
|
3486
|
+
z21.object({ type: z21.literal("logs"), logs: z21.string() }),
|
|
3487
|
+
z21.object({ type: z21.literal("image"), url: z21.string() })
|
|
3309
3488
|
])
|
|
3310
3489
|
).nullable(),
|
|
3311
|
-
status:
|
|
3490
|
+
status: z21.string()
|
|
3312
3491
|
}),
|
|
3313
|
-
|
|
3314
|
-
type:
|
|
3315
|
-
id:
|
|
3316
|
-
status:
|
|
3317
|
-
approval_request_id:
|
|
3492
|
+
z21.object({
|
|
3493
|
+
type: z21.literal("mcp_call"),
|
|
3494
|
+
id: z21.string(),
|
|
3495
|
+
status: z21.string(),
|
|
3496
|
+
approval_request_id: z21.string().nullish()
|
|
3318
3497
|
}),
|
|
3319
|
-
|
|
3320
|
-
type:
|
|
3321
|
-
id:
|
|
3498
|
+
z21.object({
|
|
3499
|
+
type: z21.literal("mcp_list_tools"),
|
|
3500
|
+
id: z21.string()
|
|
3322
3501
|
}),
|
|
3323
|
-
|
|
3324
|
-
type:
|
|
3325
|
-
id:
|
|
3502
|
+
z21.object({
|
|
3503
|
+
type: z21.literal("mcp_approval_request"),
|
|
3504
|
+
id: z21.string()
|
|
3326
3505
|
}),
|
|
3327
|
-
|
|
3328
|
-
type:
|
|
3329
|
-
id:
|
|
3330
|
-
call_id:
|
|
3331
|
-
status:
|
|
3332
|
-
operation:
|
|
3333
|
-
|
|
3334
|
-
type:
|
|
3335
|
-
path:
|
|
3336
|
-
diff:
|
|
3506
|
+
z21.object({
|
|
3507
|
+
type: z21.literal("apply_patch_call"),
|
|
3508
|
+
id: z21.string(),
|
|
3509
|
+
call_id: z21.string(),
|
|
3510
|
+
status: z21.enum(["in_progress", "completed"]),
|
|
3511
|
+
operation: z21.discriminatedUnion("type", [
|
|
3512
|
+
z21.object({
|
|
3513
|
+
type: z21.literal("create_file"),
|
|
3514
|
+
path: z21.string(),
|
|
3515
|
+
diff: z21.string()
|
|
3337
3516
|
}),
|
|
3338
|
-
|
|
3339
|
-
type:
|
|
3340
|
-
path:
|
|
3517
|
+
z21.object({
|
|
3518
|
+
type: z21.literal("delete_file"),
|
|
3519
|
+
path: z21.string()
|
|
3341
3520
|
}),
|
|
3342
|
-
|
|
3343
|
-
type:
|
|
3344
|
-
path:
|
|
3345
|
-
diff:
|
|
3521
|
+
z21.object({
|
|
3522
|
+
type: z21.literal("update_file"),
|
|
3523
|
+
path: z21.string(),
|
|
3524
|
+
diff: z21.string()
|
|
3346
3525
|
})
|
|
3347
3526
|
])
|
|
3348
3527
|
}),
|
|
3349
|
-
|
|
3350
|
-
type:
|
|
3351
|
-
id:
|
|
3352
|
-
call_id:
|
|
3353
|
-
name:
|
|
3354
|
-
input:
|
|
3528
|
+
z21.object({
|
|
3529
|
+
type: z21.literal("custom_tool_call"),
|
|
3530
|
+
id: z21.string(),
|
|
3531
|
+
call_id: z21.string(),
|
|
3532
|
+
name: z21.string(),
|
|
3533
|
+
input: z21.string()
|
|
3355
3534
|
}),
|
|
3356
|
-
|
|
3357
|
-
type:
|
|
3358
|
-
id:
|
|
3359
|
-
call_id:
|
|
3360
|
-
status:
|
|
3361
|
-
action:
|
|
3362
|
-
commands:
|
|
3535
|
+
z21.object({
|
|
3536
|
+
type: z21.literal("shell_call"),
|
|
3537
|
+
id: z21.string(),
|
|
3538
|
+
call_id: z21.string(),
|
|
3539
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3540
|
+
action: z21.object({
|
|
3541
|
+
commands: z21.array(z21.string())
|
|
3363
3542
|
})
|
|
3364
3543
|
}),
|
|
3365
|
-
|
|
3366
|
-
type:
|
|
3367
|
-
id:
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3544
|
+
z21.object({
|
|
3545
|
+
type: z21.literal("compaction"),
|
|
3546
|
+
id: z21.string(),
|
|
3547
|
+
encrypted_content: z21.string().nullish()
|
|
3548
|
+
}),
|
|
3549
|
+
z21.object({
|
|
3550
|
+
type: z21.literal("shell_call_output"),
|
|
3551
|
+
id: z21.string(),
|
|
3552
|
+
call_id: z21.string(),
|
|
3553
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3554
|
+
output: z21.array(
|
|
3555
|
+
z21.object({
|
|
3556
|
+
stdout: z21.string(),
|
|
3557
|
+
stderr: z21.string(),
|
|
3558
|
+
outcome: z21.discriminatedUnion("type", [
|
|
3559
|
+
z21.object({ type: z21.literal("timeout") }),
|
|
3560
|
+
z21.object({
|
|
3561
|
+
type: z21.literal("exit"),
|
|
3562
|
+
exit_code: z21.number()
|
|
3379
3563
|
})
|
|
3380
3564
|
])
|
|
3381
3565
|
})
|
|
3382
3566
|
)
|
|
3567
|
+
}),
|
|
3568
|
+
z21.object({
|
|
3569
|
+
type: z21.literal("tool_search_call"),
|
|
3570
|
+
id: z21.string(),
|
|
3571
|
+
execution: z21.enum(["server", "client"]),
|
|
3572
|
+
call_id: z21.string().nullable(),
|
|
3573
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3574
|
+
arguments: z21.unknown()
|
|
3575
|
+
}),
|
|
3576
|
+
z21.object({
|
|
3577
|
+
type: z21.literal("tool_search_output"),
|
|
3578
|
+
id: z21.string(),
|
|
3579
|
+
execution: z21.enum(["server", "client"]),
|
|
3580
|
+
call_id: z21.string().nullable(),
|
|
3581
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3582
|
+
tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
|
|
3383
3583
|
})
|
|
3384
3584
|
])
|
|
3385
3585
|
}),
|
|
3386
|
-
|
|
3387
|
-
type:
|
|
3388
|
-
output_index:
|
|
3389
|
-
item:
|
|
3390
|
-
|
|
3391
|
-
type:
|
|
3392
|
-
id:
|
|
3393
|
-
phase:
|
|
3586
|
+
z21.object({
|
|
3587
|
+
type: z21.literal("response.output_item.done"),
|
|
3588
|
+
output_index: z21.number(),
|
|
3589
|
+
item: z21.discriminatedUnion("type", [
|
|
3590
|
+
z21.object({
|
|
3591
|
+
type: z21.literal("message"),
|
|
3592
|
+
id: z21.string(),
|
|
3593
|
+
phase: z21.enum(["commentary", "final_answer"]).nullish()
|
|
3394
3594
|
}),
|
|
3395
|
-
|
|
3396
|
-
type:
|
|
3397
|
-
id:
|
|
3398
|
-
encrypted_content:
|
|
3595
|
+
z21.object({
|
|
3596
|
+
type: z21.literal("reasoning"),
|
|
3597
|
+
id: z21.string(),
|
|
3598
|
+
encrypted_content: z21.string().nullish()
|
|
3399
3599
|
}),
|
|
3400
|
-
|
|
3401
|
-
type:
|
|
3402
|
-
id:
|
|
3403
|
-
call_id:
|
|
3404
|
-
name:
|
|
3405
|
-
arguments:
|
|
3406
|
-
status:
|
|
3600
|
+
z21.object({
|
|
3601
|
+
type: z21.literal("function_call"),
|
|
3602
|
+
id: z21.string(),
|
|
3603
|
+
call_id: z21.string(),
|
|
3604
|
+
name: z21.string(),
|
|
3605
|
+
arguments: z21.string(),
|
|
3606
|
+
status: z21.literal("completed")
|
|
3407
3607
|
}),
|
|
3408
|
-
|
|
3409
|
-
type:
|
|
3410
|
-
id:
|
|
3411
|
-
call_id:
|
|
3412
|
-
name:
|
|
3413
|
-
input:
|
|
3414
|
-
status:
|
|
3608
|
+
z21.object({
|
|
3609
|
+
type: z21.literal("custom_tool_call"),
|
|
3610
|
+
id: z21.string(),
|
|
3611
|
+
call_id: z21.string(),
|
|
3612
|
+
name: z21.string(),
|
|
3613
|
+
input: z21.string(),
|
|
3614
|
+
status: z21.literal("completed")
|
|
3415
3615
|
}),
|
|
3416
|
-
|
|
3417
|
-
type:
|
|
3418
|
-
id:
|
|
3419
|
-
code:
|
|
3420
|
-
container_id:
|
|
3421
|
-
outputs:
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3616
|
+
z21.object({
|
|
3617
|
+
type: z21.literal("code_interpreter_call"),
|
|
3618
|
+
id: z21.string(),
|
|
3619
|
+
code: z21.string().nullable(),
|
|
3620
|
+
container_id: z21.string(),
|
|
3621
|
+
outputs: z21.array(
|
|
3622
|
+
z21.discriminatedUnion("type", [
|
|
3623
|
+
z21.object({ type: z21.literal("logs"), logs: z21.string() }),
|
|
3624
|
+
z21.object({ type: z21.literal("image"), url: z21.string() })
|
|
3425
3625
|
])
|
|
3426
3626
|
).nullable()
|
|
3427
3627
|
}),
|
|
3428
|
-
|
|
3429
|
-
type:
|
|
3430
|
-
id:
|
|
3431
|
-
result:
|
|
3628
|
+
z21.object({
|
|
3629
|
+
type: z21.literal("image_generation_call"),
|
|
3630
|
+
id: z21.string(),
|
|
3631
|
+
result: z21.string()
|
|
3432
3632
|
}),
|
|
3433
|
-
|
|
3434
|
-
type:
|
|
3435
|
-
id:
|
|
3436
|
-
status:
|
|
3437
|
-
action:
|
|
3438
|
-
|
|
3439
|
-
type:
|
|
3440
|
-
query:
|
|
3441
|
-
sources:
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3633
|
+
z21.object({
|
|
3634
|
+
type: z21.literal("web_search_call"),
|
|
3635
|
+
id: z21.string(),
|
|
3636
|
+
status: z21.string(),
|
|
3637
|
+
action: z21.discriminatedUnion("type", [
|
|
3638
|
+
z21.object({
|
|
3639
|
+
type: z21.literal("search"),
|
|
3640
|
+
query: z21.string().nullish(),
|
|
3641
|
+
sources: z21.array(
|
|
3642
|
+
z21.discriminatedUnion("type", [
|
|
3643
|
+
z21.object({ type: z21.literal("url"), url: z21.string() }),
|
|
3644
|
+
z21.object({ type: z21.literal("api"), name: z21.string() })
|
|
3445
3645
|
])
|
|
3446
3646
|
).nullish()
|
|
3447
3647
|
}),
|
|
3448
|
-
|
|
3449
|
-
type:
|
|
3450
|
-
url:
|
|
3648
|
+
z21.object({
|
|
3649
|
+
type: z21.literal("open_page"),
|
|
3650
|
+
url: z21.string().nullish()
|
|
3451
3651
|
}),
|
|
3452
|
-
|
|
3453
|
-
type:
|
|
3454
|
-
url:
|
|
3455
|
-
pattern:
|
|
3652
|
+
z21.object({
|
|
3653
|
+
type: z21.literal("find_in_page"),
|
|
3654
|
+
url: z21.string().nullish(),
|
|
3655
|
+
pattern: z21.string().nullish()
|
|
3456
3656
|
})
|
|
3457
3657
|
]).nullish()
|
|
3458
3658
|
}),
|
|
3459
|
-
|
|
3460
|
-
type:
|
|
3461
|
-
id:
|
|
3462
|
-
queries:
|
|
3463
|
-
results:
|
|
3464
|
-
|
|
3465
|
-
attributes:
|
|
3466
|
-
|
|
3467
|
-
|
|
3659
|
+
z21.object({
|
|
3660
|
+
type: z21.literal("file_search_call"),
|
|
3661
|
+
id: z21.string(),
|
|
3662
|
+
queries: z21.array(z21.string()),
|
|
3663
|
+
results: z21.array(
|
|
3664
|
+
z21.object({
|
|
3665
|
+
attributes: z21.record(
|
|
3666
|
+
z21.string(),
|
|
3667
|
+
z21.union([z21.string(), z21.number(), z21.boolean()])
|
|
3468
3668
|
),
|
|
3469
|
-
file_id:
|
|
3470
|
-
filename:
|
|
3471
|
-
score:
|
|
3472
|
-
text:
|
|
3669
|
+
file_id: z21.string(),
|
|
3670
|
+
filename: z21.string(),
|
|
3671
|
+
score: z21.number(),
|
|
3672
|
+
text: z21.string()
|
|
3473
3673
|
})
|
|
3474
3674
|
).nullish()
|
|
3475
3675
|
}),
|
|
3476
|
-
|
|
3477
|
-
type:
|
|
3478
|
-
id:
|
|
3479
|
-
call_id:
|
|
3480
|
-
action:
|
|
3481
|
-
type:
|
|
3482
|
-
command:
|
|
3483
|
-
timeout_ms:
|
|
3484
|
-
user:
|
|
3485
|
-
working_directory:
|
|
3486
|
-
env:
|
|
3676
|
+
z21.object({
|
|
3677
|
+
type: z21.literal("local_shell_call"),
|
|
3678
|
+
id: z21.string(),
|
|
3679
|
+
call_id: z21.string(),
|
|
3680
|
+
action: z21.object({
|
|
3681
|
+
type: z21.literal("exec"),
|
|
3682
|
+
command: z21.array(z21.string()),
|
|
3683
|
+
timeout_ms: z21.number().optional(),
|
|
3684
|
+
user: z21.string().optional(),
|
|
3685
|
+
working_directory: z21.string().optional(),
|
|
3686
|
+
env: z21.record(z21.string(), z21.string()).optional()
|
|
3487
3687
|
})
|
|
3488
3688
|
}),
|
|
3489
|
-
|
|
3490
|
-
type:
|
|
3491
|
-
id:
|
|
3492
|
-
status:
|
|
3689
|
+
z21.object({
|
|
3690
|
+
type: z21.literal("computer_call"),
|
|
3691
|
+
id: z21.string(),
|
|
3692
|
+
status: z21.literal("completed")
|
|
3493
3693
|
}),
|
|
3494
|
-
|
|
3495
|
-
type:
|
|
3496
|
-
id:
|
|
3497
|
-
status:
|
|
3498
|
-
arguments:
|
|
3499
|
-
name:
|
|
3500
|
-
server_label:
|
|
3501
|
-
output:
|
|
3502
|
-
error:
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
type:
|
|
3506
|
-
code:
|
|
3507
|
-
message:
|
|
3694
|
+
z21.object({
|
|
3695
|
+
type: z21.literal("mcp_call"),
|
|
3696
|
+
id: z21.string(),
|
|
3697
|
+
status: z21.string(),
|
|
3698
|
+
arguments: z21.string(),
|
|
3699
|
+
name: z21.string(),
|
|
3700
|
+
server_label: z21.string(),
|
|
3701
|
+
output: z21.string().nullish(),
|
|
3702
|
+
error: z21.union([
|
|
3703
|
+
z21.string(),
|
|
3704
|
+
z21.object({
|
|
3705
|
+
type: z21.string().optional(),
|
|
3706
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
3707
|
+
message: z21.string().optional()
|
|
3508
3708
|
}).loose()
|
|
3509
3709
|
]).nullish(),
|
|
3510
|
-
approval_request_id:
|
|
3710
|
+
approval_request_id: z21.string().nullish()
|
|
3511
3711
|
}),
|
|
3512
|
-
|
|
3513
|
-
type:
|
|
3514
|
-
id:
|
|
3515
|
-
server_label:
|
|
3516
|
-
tools:
|
|
3517
|
-
|
|
3518
|
-
name:
|
|
3519
|
-
description:
|
|
3520
|
-
input_schema:
|
|
3521
|
-
annotations:
|
|
3712
|
+
z21.object({
|
|
3713
|
+
type: z21.literal("mcp_list_tools"),
|
|
3714
|
+
id: z21.string(),
|
|
3715
|
+
server_label: z21.string(),
|
|
3716
|
+
tools: z21.array(
|
|
3717
|
+
z21.object({
|
|
3718
|
+
name: z21.string(),
|
|
3719
|
+
description: z21.string().optional(),
|
|
3720
|
+
input_schema: z21.any(),
|
|
3721
|
+
annotations: z21.record(z21.string(), z21.unknown()).optional()
|
|
3522
3722
|
})
|
|
3523
3723
|
),
|
|
3524
|
-
error:
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
type:
|
|
3528
|
-
code:
|
|
3529
|
-
message:
|
|
3724
|
+
error: z21.union([
|
|
3725
|
+
z21.string(),
|
|
3726
|
+
z21.object({
|
|
3727
|
+
type: z21.string().optional(),
|
|
3728
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
3729
|
+
message: z21.string().optional()
|
|
3530
3730
|
}).loose()
|
|
3531
3731
|
]).optional()
|
|
3532
3732
|
}),
|
|
3533
|
-
|
|
3534
|
-
type:
|
|
3535
|
-
id:
|
|
3536
|
-
server_label:
|
|
3537
|
-
name:
|
|
3538
|
-
arguments:
|
|
3539
|
-
approval_request_id:
|
|
3733
|
+
z21.object({
|
|
3734
|
+
type: z21.literal("mcp_approval_request"),
|
|
3735
|
+
id: z21.string(),
|
|
3736
|
+
server_label: z21.string(),
|
|
3737
|
+
name: z21.string(),
|
|
3738
|
+
arguments: z21.string(),
|
|
3739
|
+
approval_request_id: z21.string().optional()
|
|
3540
3740
|
}),
|
|
3541
|
-
|
|
3542
|
-
type:
|
|
3543
|
-
id:
|
|
3544
|
-
call_id:
|
|
3545
|
-
status:
|
|
3546
|
-
operation:
|
|
3547
|
-
|
|
3548
|
-
type:
|
|
3549
|
-
path:
|
|
3550
|
-
diff:
|
|
3741
|
+
z21.object({
|
|
3742
|
+
type: z21.literal("apply_patch_call"),
|
|
3743
|
+
id: z21.string(),
|
|
3744
|
+
call_id: z21.string(),
|
|
3745
|
+
status: z21.enum(["in_progress", "completed"]),
|
|
3746
|
+
operation: z21.discriminatedUnion("type", [
|
|
3747
|
+
z21.object({
|
|
3748
|
+
type: z21.literal("create_file"),
|
|
3749
|
+
path: z21.string(),
|
|
3750
|
+
diff: z21.string()
|
|
3551
3751
|
}),
|
|
3552
|
-
|
|
3553
|
-
type:
|
|
3554
|
-
path:
|
|
3752
|
+
z21.object({
|
|
3753
|
+
type: z21.literal("delete_file"),
|
|
3754
|
+
path: z21.string()
|
|
3555
3755
|
}),
|
|
3556
|
-
|
|
3557
|
-
type:
|
|
3558
|
-
path:
|
|
3559
|
-
diff:
|
|
3756
|
+
z21.object({
|
|
3757
|
+
type: z21.literal("update_file"),
|
|
3758
|
+
path: z21.string(),
|
|
3759
|
+
diff: z21.string()
|
|
3560
3760
|
})
|
|
3561
3761
|
])
|
|
3562
3762
|
}),
|
|
3563
|
-
|
|
3564
|
-
type:
|
|
3565
|
-
id:
|
|
3566
|
-
call_id:
|
|
3567
|
-
status:
|
|
3568
|
-
action:
|
|
3569
|
-
commands:
|
|
3763
|
+
z21.object({
|
|
3764
|
+
type: z21.literal("shell_call"),
|
|
3765
|
+
id: z21.string(),
|
|
3766
|
+
call_id: z21.string(),
|
|
3767
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3768
|
+
action: z21.object({
|
|
3769
|
+
commands: z21.array(z21.string())
|
|
3570
3770
|
})
|
|
3571
3771
|
}),
|
|
3572
|
-
|
|
3573
|
-
type:
|
|
3574
|
-
id:
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3772
|
+
z21.object({
|
|
3773
|
+
type: z21.literal("compaction"),
|
|
3774
|
+
id: z21.string(),
|
|
3775
|
+
encrypted_content: z21.string()
|
|
3776
|
+
}),
|
|
3777
|
+
z21.object({
|
|
3778
|
+
type: z21.literal("shell_call_output"),
|
|
3779
|
+
id: z21.string(),
|
|
3780
|
+
call_id: z21.string(),
|
|
3781
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3782
|
+
output: z21.array(
|
|
3783
|
+
z21.object({
|
|
3784
|
+
stdout: z21.string(),
|
|
3785
|
+
stderr: z21.string(),
|
|
3786
|
+
outcome: z21.discriminatedUnion("type", [
|
|
3787
|
+
z21.object({ type: z21.literal("timeout") }),
|
|
3788
|
+
z21.object({
|
|
3789
|
+
type: z21.literal("exit"),
|
|
3790
|
+
exit_code: z21.number()
|
|
3586
3791
|
})
|
|
3587
3792
|
])
|
|
3588
3793
|
})
|
|
3589
3794
|
)
|
|
3795
|
+
}),
|
|
3796
|
+
z21.object({
|
|
3797
|
+
type: z21.literal("tool_search_call"),
|
|
3798
|
+
id: z21.string(),
|
|
3799
|
+
execution: z21.enum(["server", "client"]),
|
|
3800
|
+
call_id: z21.string().nullable(),
|
|
3801
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3802
|
+
arguments: z21.unknown()
|
|
3803
|
+
}),
|
|
3804
|
+
z21.object({
|
|
3805
|
+
type: z21.literal("tool_search_output"),
|
|
3806
|
+
id: z21.string(),
|
|
3807
|
+
execution: z21.enum(["server", "client"]),
|
|
3808
|
+
call_id: z21.string().nullable(),
|
|
3809
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
3810
|
+
tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
|
|
3590
3811
|
})
|
|
3591
3812
|
])
|
|
3592
3813
|
}),
|
|
3593
|
-
|
|
3594
|
-
type:
|
|
3595
|
-
item_id:
|
|
3596
|
-
output_index:
|
|
3597
|
-
delta:
|
|
3814
|
+
z21.object({
|
|
3815
|
+
type: z21.literal("response.function_call_arguments.delta"),
|
|
3816
|
+
item_id: z21.string(),
|
|
3817
|
+
output_index: z21.number(),
|
|
3818
|
+
delta: z21.string()
|
|
3598
3819
|
}),
|
|
3599
|
-
|
|
3600
|
-
type:
|
|
3601
|
-
item_id:
|
|
3602
|
-
output_index:
|
|
3603
|
-
delta:
|
|
3820
|
+
z21.object({
|
|
3821
|
+
type: z21.literal("response.custom_tool_call_input.delta"),
|
|
3822
|
+
item_id: z21.string(),
|
|
3823
|
+
output_index: z21.number(),
|
|
3824
|
+
delta: z21.string()
|
|
3604
3825
|
}),
|
|
3605
|
-
|
|
3606
|
-
type:
|
|
3607
|
-
item_id:
|
|
3608
|
-
output_index:
|
|
3609
|
-
partial_image_b64:
|
|
3826
|
+
z21.object({
|
|
3827
|
+
type: z21.literal("response.image_generation_call.partial_image"),
|
|
3828
|
+
item_id: z21.string(),
|
|
3829
|
+
output_index: z21.number(),
|
|
3830
|
+
partial_image_b64: z21.string()
|
|
3610
3831
|
}),
|
|
3611
|
-
|
|
3612
|
-
type:
|
|
3613
|
-
item_id:
|
|
3614
|
-
output_index:
|
|
3615
|
-
delta:
|
|
3832
|
+
z21.object({
|
|
3833
|
+
type: z21.literal("response.code_interpreter_call_code.delta"),
|
|
3834
|
+
item_id: z21.string(),
|
|
3835
|
+
output_index: z21.number(),
|
|
3836
|
+
delta: z21.string()
|
|
3616
3837
|
}),
|
|
3617
|
-
|
|
3618
|
-
type:
|
|
3619
|
-
item_id:
|
|
3620
|
-
output_index:
|
|
3621
|
-
code:
|
|
3838
|
+
z21.object({
|
|
3839
|
+
type: z21.literal("response.code_interpreter_call_code.done"),
|
|
3840
|
+
item_id: z21.string(),
|
|
3841
|
+
output_index: z21.number(),
|
|
3842
|
+
code: z21.string()
|
|
3622
3843
|
}),
|
|
3623
|
-
|
|
3624
|
-
type:
|
|
3625
|
-
annotation:
|
|
3626
|
-
|
|
3627
|
-
type:
|
|
3628
|
-
start_index:
|
|
3629
|
-
end_index:
|
|
3630
|
-
url:
|
|
3631
|
-
title:
|
|
3844
|
+
z21.object({
|
|
3845
|
+
type: z21.literal("response.output_text.annotation.added"),
|
|
3846
|
+
annotation: z21.discriminatedUnion("type", [
|
|
3847
|
+
z21.object({
|
|
3848
|
+
type: z21.literal("url_citation"),
|
|
3849
|
+
start_index: z21.number(),
|
|
3850
|
+
end_index: z21.number(),
|
|
3851
|
+
url: z21.string(),
|
|
3852
|
+
title: z21.string()
|
|
3632
3853
|
}),
|
|
3633
|
-
|
|
3634
|
-
type:
|
|
3635
|
-
file_id:
|
|
3636
|
-
filename:
|
|
3637
|
-
index:
|
|
3854
|
+
z21.object({
|
|
3855
|
+
type: z21.literal("file_citation"),
|
|
3856
|
+
file_id: z21.string(),
|
|
3857
|
+
filename: z21.string(),
|
|
3858
|
+
index: z21.number()
|
|
3638
3859
|
}),
|
|
3639
|
-
|
|
3640
|
-
type:
|
|
3641
|
-
container_id:
|
|
3642
|
-
file_id:
|
|
3643
|
-
filename:
|
|
3644
|
-
start_index:
|
|
3645
|
-
end_index:
|
|
3860
|
+
z21.object({
|
|
3861
|
+
type: z21.literal("container_file_citation"),
|
|
3862
|
+
container_id: z21.string(),
|
|
3863
|
+
file_id: z21.string(),
|
|
3864
|
+
filename: z21.string(),
|
|
3865
|
+
start_index: z21.number(),
|
|
3866
|
+
end_index: z21.number()
|
|
3646
3867
|
}),
|
|
3647
|
-
|
|
3648
|
-
type:
|
|
3649
|
-
file_id:
|
|
3650
|
-
index:
|
|
3868
|
+
z21.object({
|
|
3869
|
+
type: z21.literal("file_path"),
|
|
3870
|
+
file_id: z21.string(),
|
|
3871
|
+
index: z21.number()
|
|
3651
3872
|
})
|
|
3652
3873
|
])
|
|
3653
3874
|
}),
|
|
3654
|
-
|
|
3655
|
-
type:
|
|
3656
|
-
item_id:
|
|
3657
|
-
summary_index:
|
|
3875
|
+
z21.object({
|
|
3876
|
+
type: z21.literal("response.reasoning_summary_part.added"),
|
|
3877
|
+
item_id: z21.string(),
|
|
3878
|
+
summary_index: z21.number()
|
|
3658
3879
|
}),
|
|
3659
|
-
|
|
3660
|
-
type:
|
|
3661
|
-
item_id:
|
|
3662
|
-
summary_index:
|
|
3663
|
-
delta:
|
|
3880
|
+
z21.object({
|
|
3881
|
+
type: z21.literal("response.reasoning_summary_text.delta"),
|
|
3882
|
+
item_id: z21.string(),
|
|
3883
|
+
summary_index: z21.number(),
|
|
3884
|
+
delta: z21.string()
|
|
3664
3885
|
}),
|
|
3665
|
-
|
|
3666
|
-
type:
|
|
3667
|
-
item_id:
|
|
3668
|
-
summary_index:
|
|
3886
|
+
z21.object({
|
|
3887
|
+
type: z21.literal("response.reasoning_summary_part.done"),
|
|
3888
|
+
item_id: z21.string(),
|
|
3889
|
+
summary_index: z21.number()
|
|
3669
3890
|
}),
|
|
3670
|
-
|
|
3671
|
-
type:
|
|
3672
|
-
item_id:
|
|
3673
|
-
output_index:
|
|
3674
|
-
delta:
|
|
3675
|
-
obfuscation:
|
|
3891
|
+
z21.object({
|
|
3892
|
+
type: z21.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3893
|
+
item_id: z21.string(),
|
|
3894
|
+
output_index: z21.number(),
|
|
3895
|
+
delta: z21.string(),
|
|
3896
|
+
obfuscation: z21.string().nullish()
|
|
3676
3897
|
}),
|
|
3677
|
-
|
|
3678
|
-
type:
|
|
3679
|
-
item_id:
|
|
3680
|
-
output_index:
|
|
3681
|
-
diff:
|
|
3898
|
+
z21.object({
|
|
3899
|
+
type: z21.literal("response.apply_patch_call_operation_diff.done"),
|
|
3900
|
+
item_id: z21.string(),
|
|
3901
|
+
output_index: z21.number(),
|
|
3902
|
+
diff: z21.string()
|
|
3682
3903
|
}),
|
|
3683
|
-
|
|
3684
|
-
type:
|
|
3685
|
-
sequence_number:
|
|
3686
|
-
error:
|
|
3687
|
-
type:
|
|
3688
|
-
code:
|
|
3689
|
-
message:
|
|
3690
|
-
param:
|
|
3904
|
+
z21.object({
|
|
3905
|
+
type: z21.literal("error"),
|
|
3906
|
+
sequence_number: z21.number(),
|
|
3907
|
+
error: z21.object({
|
|
3908
|
+
type: z21.string(),
|
|
3909
|
+
code: z21.string(),
|
|
3910
|
+
message: z21.string(),
|
|
3911
|
+
param: z21.string().nullish()
|
|
3691
3912
|
})
|
|
3692
3913
|
}),
|
|
3693
|
-
|
|
3914
|
+
z21.object({ type: z21.string() }).loose().transform((value) => ({
|
|
3694
3915
|
type: "unknown_chunk",
|
|
3695
3916
|
message: value.type
|
|
3696
3917
|
}))
|
|
@@ -3698,294 +3919,315 @@ var openaiResponsesChunkSchema = lazySchema18(
|
|
|
3698
3919
|
])
|
|
3699
3920
|
)
|
|
3700
3921
|
);
|
|
3701
|
-
var openaiResponsesResponseSchema =
|
|
3702
|
-
() =>
|
|
3703
|
-
|
|
3704
|
-
id:
|
|
3705
|
-
created_at:
|
|
3706
|
-
error:
|
|
3707
|
-
message:
|
|
3708
|
-
type:
|
|
3709
|
-
param:
|
|
3710
|
-
code:
|
|
3922
|
+
var openaiResponsesResponseSchema = lazySchema19(
|
|
3923
|
+
() => zodSchema19(
|
|
3924
|
+
z21.object({
|
|
3925
|
+
id: z21.string().optional(),
|
|
3926
|
+
created_at: z21.number().optional(),
|
|
3927
|
+
error: z21.object({
|
|
3928
|
+
message: z21.string(),
|
|
3929
|
+
type: z21.string(),
|
|
3930
|
+
param: z21.string().nullish(),
|
|
3931
|
+
code: z21.string()
|
|
3711
3932
|
}).nullish(),
|
|
3712
|
-
model:
|
|
3713
|
-
output:
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
type:
|
|
3717
|
-
role:
|
|
3718
|
-
id:
|
|
3719
|
-
phase:
|
|
3720
|
-
content:
|
|
3721
|
-
|
|
3722
|
-
type:
|
|
3723
|
-
text:
|
|
3724
|
-
logprobs:
|
|
3725
|
-
|
|
3726
|
-
token:
|
|
3727
|
-
logprob:
|
|
3728
|
-
top_logprobs:
|
|
3729
|
-
|
|
3730
|
-
token:
|
|
3731
|
-
logprob:
|
|
3933
|
+
model: z21.string().optional(),
|
|
3934
|
+
output: z21.array(
|
|
3935
|
+
z21.discriminatedUnion("type", [
|
|
3936
|
+
z21.object({
|
|
3937
|
+
type: z21.literal("message"),
|
|
3938
|
+
role: z21.literal("assistant"),
|
|
3939
|
+
id: z21.string(),
|
|
3940
|
+
phase: z21.enum(["commentary", "final_answer"]).nullish(),
|
|
3941
|
+
content: z21.array(
|
|
3942
|
+
z21.object({
|
|
3943
|
+
type: z21.literal("output_text"),
|
|
3944
|
+
text: z21.string(),
|
|
3945
|
+
logprobs: z21.array(
|
|
3946
|
+
z21.object({
|
|
3947
|
+
token: z21.string(),
|
|
3948
|
+
logprob: z21.number(),
|
|
3949
|
+
top_logprobs: z21.array(
|
|
3950
|
+
z21.object({
|
|
3951
|
+
token: z21.string(),
|
|
3952
|
+
logprob: z21.number()
|
|
3732
3953
|
})
|
|
3733
3954
|
)
|
|
3734
3955
|
})
|
|
3735
3956
|
).nullish(),
|
|
3736
|
-
annotations:
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
type:
|
|
3740
|
-
start_index:
|
|
3741
|
-
end_index:
|
|
3742
|
-
url:
|
|
3743
|
-
title:
|
|
3957
|
+
annotations: z21.array(
|
|
3958
|
+
z21.discriminatedUnion("type", [
|
|
3959
|
+
z21.object({
|
|
3960
|
+
type: z21.literal("url_citation"),
|
|
3961
|
+
start_index: z21.number(),
|
|
3962
|
+
end_index: z21.number(),
|
|
3963
|
+
url: z21.string(),
|
|
3964
|
+
title: z21.string()
|
|
3744
3965
|
}),
|
|
3745
|
-
|
|
3746
|
-
type:
|
|
3747
|
-
file_id:
|
|
3748
|
-
filename:
|
|
3749
|
-
index:
|
|
3966
|
+
z21.object({
|
|
3967
|
+
type: z21.literal("file_citation"),
|
|
3968
|
+
file_id: z21.string(),
|
|
3969
|
+
filename: z21.string(),
|
|
3970
|
+
index: z21.number()
|
|
3750
3971
|
}),
|
|
3751
|
-
|
|
3752
|
-
type:
|
|
3753
|
-
container_id:
|
|
3754
|
-
file_id:
|
|
3755
|
-
filename:
|
|
3756
|
-
start_index:
|
|
3757
|
-
end_index:
|
|
3972
|
+
z21.object({
|
|
3973
|
+
type: z21.literal("container_file_citation"),
|
|
3974
|
+
container_id: z21.string(),
|
|
3975
|
+
file_id: z21.string(),
|
|
3976
|
+
filename: z21.string(),
|
|
3977
|
+
start_index: z21.number(),
|
|
3978
|
+
end_index: z21.number()
|
|
3758
3979
|
}),
|
|
3759
|
-
|
|
3760
|
-
type:
|
|
3761
|
-
file_id:
|
|
3762
|
-
index:
|
|
3980
|
+
z21.object({
|
|
3981
|
+
type: z21.literal("file_path"),
|
|
3982
|
+
file_id: z21.string(),
|
|
3983
|
+
index: z21.number()
|
|
3763
3984
|
})
|
|
3764
3985
|
])
|
|
3765
3986
|
)
|
|
3766
3987
|
})
|
|
3767
3988
|
)
|
|
3768
3989
|
}),
|
|
3769
|
-
|
|
3770
|
-
type:
|
|
3771
|
-
id:
|
|
3772
|
-
status:
|
|
3773
|
-
action:
|
|
3774
|
-
|
|
3775
|
-
type:
|
|
3776
|
-
query:
|
|
3777
|
-
sources:
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
type:
|
|
3782
|
-
name:
|
|
3990
|
+
z21.object({
|
|
3991
|
+
type: z21.literal("web_search_call"),
|
|
3992
|
+
id: z21.string(),
|
|
3993
|
+
status: z21.string(),
|
|
3994
|
+
action: z21.discriminatedUnion("type", [
|
|
3995
|
+
z21.object({
|
|
3996
|
+
type: z21.literal("search"),
|
|
3997
|
+
query: z21.string().nullish(),
|
|
3998
|
+
sources: z21.array(
|
|
3999
|
+
z21.discriminatedUnion("type", [
|
|
4000
|
+
z21.object({ type: z21.literal("url"), url: z21.string() }),
|
|
4001
|
+
z21.object({
|
|
4002
|
+
type: z21.literal("api"),
|
|
4003
|
+
name: z21.string()
|
|
3783
4004
|
})
|
|
3784
4005
|
])
|
|
3785
4006
|
).nullish()
|
|
3786
4007
|
}),
|
|
3787
|
-
|
|
3788
|
-
type:
|
|
3789
|
-
url:
|
|
4008
|
+
z21.object({
|
|
4009
|
+
type: z21.literal("open_page"),
|
|
4010
|
+
url: z21.string().nullish()
|
|
3790
4011
|
}),
|
|
3791
|
-
|
|
3792
|
-
type:
|
|
3793
|
-
url:
|
|
3794
|
-
pattern:
|
|
4012
|
+
z21.object({
|
|
4013
|
+
type: z21.literal("find_in_page"),
|
|
4014
|
+
url: z21.string().nullish(),
|
|
4015
|
+
pattern: z21.string().nullish()
|
|
3795
4016
|
})
|
|
3796
4017
|
]).nullish()
|
|
3797
4018
|
}),
|
|
3798
|
-
|
|
3799
|
-
type:
|
|
3800
|
-
id:
|
|
3801
|
-
queries:
|
|
3802
|
-
results:
|
|
3803
|
-
|
|
3804
|
-
attributes:
|
|
3805
|
-
|
|
3806
|
-
|
|
4019
|
+
z21.object({
|
|
4020
|
+
type: z21.literal("file_search_call"),
|
|
4021
|
+
id: z21.string(),
|
|
4022
|
+
queries: z21.array(z21.string()),
|
|
4023
|
+
results: z21.array(
|
|
4024
|
+
z21.object({
|
|
4025
|
+
attributes: z21.record(
|
|
4026
|
+
z21.string(),
|
|
4027
|
+
z21.union([z21.string(), z21.number(), z21.boolean()])
|
|
3807
4028
|
),
|
|
3808
|
-
file_id:
|
|
3809
|
-
filename:
|
|
3810
|
-
score:
|
|
3811
|
-
text:
|
|
4029
|
+
file_id: z21.string(),
|
|
4030
|
+
filename: z21.string(),
|
|
4031
|
+
score: z21.number(),
|
|
4032
|
+
text: z21.string()
|
|
3812
4033
|
})
|
|
3813
4034
|
).nullish()
|
|
3814
4035
|
}),
|
|
3815
|
-
|
|
3816
|
-
type:
|
|
3817
|
-
id:
|
|
3818
|
-
code:
|
|
3819
|
-
container_id:
|
|
3820
|
-
outputs:
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
4036
|
+
z21.object({
|
|
4037
|
+
type: z21.literal("code_interpreter_call"),
|
|
4038
|
+
id: z21.string(),
|
|
4039
|
+
code: z21.string().nullable(),
|
|
4040
|
+
container_id: z21.string(),
|
|
4041
|
+
outputs: z21.array(
|
|
4042
|
+
z21.discriminatedUnion("type", [
|
|
4043
|
+
z21.object({ type: z21.literal("logs"), logs: z21.string() }),
|
|
4044
|
+
z21.object({ type: z21.literal("image"), url: z21.string() })
|
|
3824
4045
|
])
|
|
3825
4046
|
).nullable()
|
|
3826
4047
|
}),
|
|
3827
|
-
|
|
3828
|
-
type:
|
|
3829
|
-
id:
|
|
3830
|
-
result:
|
|
4048
|
+
z21.object({
|
|
4049
|
+
type: z21.literal("image_generation_call"),
|
|
4050
|
+
id: z21.string(),
|
|
4051
|
+
result: z21.string()
|
|
3831
4052
|
}),
|
|
3832
|
-
|
|
3833
|
-
type:
|
|
3834
|
-
id:
|
|
3835
|
-
call_id:
|
|
3836
|
-
action:
|
|
3837
|
-
type:
|
|
3838
|
-
command:
|
|
3839
|
-
timeout_ms:
|
|
3840
|
-
user:
|
|
3841
|
-
working_directory:
|
|
3842
|
-
env:
|
|
4053
|
+
z21.object({
|
|
4054
|
+
type: z21.literal("local_shell_call"),
|
|
4055
|
+
id: z21.string(),
|
|
4056
|
+
call_id: z21.string(),
|
|
4057
|
+
action: z21.object({
|
|
4058
|
+
type: z21.literal("exec"),
|
|
4059
|
+
command: z21.array(z21.string()),
|
|
4060
|
+
timeout_ms: z21.number().optional(),
|
|
4061
|
+
user: z21.string().optional(),
|
|
4062
|
+
working_directory: z21.string().optional(),
|
|
4063
|
+
env: z21.record(z21.string(), z21.string()).optional()
|
|
3843
4064
|
})
|
|
3844
4065
|
}),
|
|
3845
|
-
|
|
3846
|
-
type:
|
|
3847
|
-
call_id:
|
|
3848
|
-
name:
|
|
3849
|
-
arguments:
|
|
3850
|
-
id:
|
|
4066
|
+
z21.object({
|
|
4067
|
+
type: z21.literal("function_call"),
|
|
4068
|
+
call_id: z21.string(),
|
|
4069
|
+
name: z21.string(),
|
|
4070
|
+
arguments: z21.string(),
|
|
4071
|
+
id: z21.string()
|
|
3851
4072
|
}),
|
|
3852
|
-
|
|
3853
|
-
type:
|
|
3854
|
-
call_id:
|
|
3855
|
-
name:
|
|
3856
|
-
input:
|
|
3857
|
-
id:
|
|
4073
|
+
z21.object({
|
|
4074
|
+
type: z21.literal("custom_tool_call"),
|
|
4075
|
+
call_id: z21.string(),
|
|
4076
|
+
name: z21.string(),
|
|
4077
|
+
input: z21.string(),
|
|
4078
|
+
id: z21.string()
|
|
3858
4079
|
}),
|
|
3859
|
-
|
|
3860
|
-
type:
|
|
3861
|
-
id:
|
|
3862
|
-
status:
|
|
4080
|
+
z21.object({
|
|
4081
|
+
type: z21.literal("computer_call"),
|
|
4082
|
+
id: z21.string(),
|
|
4083
|
+
status: z21.string().optional()
|
|
3863
4084
|
}),
|
|
3864
|
-
|
|
3865
|
-
type:
|
|
3866
|
-
id:
|
|
3867
|
-
encrypted_content:
|
|
3868
|
-
summary:
|
|
3869
|
-
|
|
3870
|
-
type:
|
|
3871
|
-
text:
|
|
4085
|
+
z21.object({
|
|
4086
|
+
type: z21.literal("reasoning"),
|
|
4087
|
+
id: z21.string(),
|
|
4088
|
+
encrypted_content: z21.string().nullish(),
|
|
4089
|
+
summary: z21.array(
|
|
4090
|
+
z21.object({
|
|
4091
|
+
type: z21.literal("summary_text"),
|
|
4092
|
+
text: z21.string()
|
|
3872
4093
|
})
|
|
3873
4094
|
)
|
|
3874
4095
|
}),
|
|
3875
|
-
|
|
3876
|
-
type:
|
|
3877
|
-
id:
|
|
3878
|
-
status:
|
|
3879
|
-
arguments:
|
|
3880
|
-
name:
|
|
3881
|
-
server_label:
|
|
3882
|
-
output:
|
|
3883
|
-
error:
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
type:
|
|
3887
|
-
code:
|
|
3888
|
-
message:
|
|
4096
|
+
z21.object({
|
|
4097
|
+
type: z21.literal("mcp_call"),
|
|
4098
|
+
id: z21.string(),
|
|
4099
|
+
status: z21.string(),
|
|
4100
|
+
arguments: z21.string(),
|
|
4101
|
+
name: z21.string(),
|
|
4102
|
+
server_label: z21.string(),
|
|
4103
|
+
output: z21.string().nullish(),
|
|
4104
|
+
error: z21.union([
|
|
4105
|
+
z21.string(),
|
|
4106
|
+
z21.object({
|
|
4107
|
+
type: z21.string().optional(),
|
|
4108
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
4109
|
+
message: z21.string().optional()
|
|
3889
4110
|
}).loose()
|
|
3890
4111
|
]).nullish(),
|
|
3891
|
-
approval_request_id:
|
|
4112
|
+
approval_request_id: z21.string().nullish()
|
|
3892
4113
|
}),
|
|
3893
|
-
|
|
3894
|
-
type:
|
|
3895
|
-
id:
|
|
3896
|
-
server_label:
|
|
3897
|
-
tools:
|
|
3898
|
-
|
|
3899
|
-
name:
|
|
3900
|
-
description:
|
|
3901
|
-
input_schema:
|
|
3902
|
-
annotations:
|
|
4114
|
+
z21.object({
|
|
4115
|
+
type: z21.literal("mcp_list_tools"),
|
|
4116
|
+
id: z21.string(),
|
|
4117
|
+
server_label: z21.string(),
|
|
4118
|
+
tools: z21.array(
|
|
4119
|
+
z21.object({
|
|
4120
|
+
name: z21.string(),
|
|
4121
|
+
description: z21.string().optional(),
|
|
4122
|
+
input_schema: z21.any(),
|
|
4123
|
+
annotations: z21.record(z21.string(), z21.unknown()).optional()
|
|
3903
4124
|
})
|
|
3904
4125
|
),
|
|
3905
|
-
error:
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
type:
|
|
3909
|
-
code:
|
|
3910
|
-
message:
|
|
4126
|
+
error: z21.union([
|
|
4127
|
+
z21.string(),
|
|
4128
|
+
z21.object({
|
|
4129
|
+
type: z21.string().optional(),
|
|
4130
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
4131
|
+
message: z21.string().optional()
|
|
3911
4132
|
}).loose()
|
|
3912
4133
|
]).optional()
|
|
3913
4134
|
}),
|
|
3914
|
-
|
|
3915
|
-
type:
|
|
3916
|
-
id:
|
|
3917
|
-
server_label:
|
|
3918
|
-
name:
|
|
3919
|
-
arguments:
|
|
3920
|
-
approval_request_id:
|
|
4135
|
+
z21.object({
|
|
4136
|
+
type: z21.literal("mcp_approval_request"),
|
|
4137
|
+
id: z21.string(),
|
|
4138
|
+
server_label: z21.string(),
|
|
4139
|
+
name: z21.string(),
|
|
4140
|
+
arguments: z21.string(),
|
|
4141
|
+
approval_request_id: z21.string().optional()
|
|
3921
4142
|
}),
|
|
3922
|
-
|
|
3923
|
-
type:
|
|
3924
|
-
id:
|
|
3925
|
-
call_id:
|
|
3926
|
-
status:
|
|
3927
|
-
operation:
|
|
3928
|
-
|
|
3929
|
-
type:
|
|
3930
|
-
path:
|
|
3931
|
-
diff:
|
|
4143
|
+
z21.object({
|
|
4144
|
+
type: z21.literal("apply_patch_call"),
|
|
4145
|
+
id: z21.string(),
|
|
4146
|
+
call_id: z21.string(),
|
|
4147
|
+
status: z21.enum(["in_progress", "completed"]),
|
|
4148
|
+
operation: z21.discriminatedUnion("type", [
|
|
4149
|
+
z21.object({
|
|
4150
|
+
type: z21.literal("create_file"),
|
|
4151
|
+
path: z21.string(),
|
|
4152
|
+
diff: z21.string()
|
|
3932
4153
|
}),
|
|
3933
|
-
|
|
3934
|
-
type:
|
|
3935
|
-
path:
|
|
4154
|
+
z21.object({
|
|
4155
|
+
type: z21.literal("delete_file"),
|
|
4156
|
+
path: z21.string()
|
|
3936
4157
|
}),
|
|
3937
|
-
|
|
3938
|
-
type:
|
|
3939
|
-
path:
|
|
3940
|
-
diff:
|
|
4158
|
+
z21.object({
|
|
4159
|
+
type: z21.literal("update_file"),
|
|
4160
|
+
path: z21.string(),
|
|
4161
|
+
diff: z21.string()
|
|
3941
4162
|
})
|
|
3942
4163
|
])
|
|
3943
4164
|
}),
|
|
3944
|
-
|
|
3945
|
-
type:
|
|
3946
|
-
id:
|
|
3947
|
-
call_id:
|
|
3948
|
-
status:
|
|
3949
|
-
action:
|
|
3950
|
-
commands:
|
|
4165
|
+
z21.object({
|
|
4166
|
+
type: z21.literal("shell_call"),
|
|
4167
|
+
id: z21.string(),
|
|
4168
|
+
call_id: z21.string(),
|
|
4169
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
4170
|
+
action: z21.object({
|
|
4171
|
+
commands: z21.array(z21.string())
|
|
3951
4172
|
})
|
|
3952
4173
|
}),
|
|
3953
|
-
|
|
3954
|
-
type:
|
|
3955
|
-
id:
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
4174
|
+
z21.object({
|
|
4175
|
+
type: z21.literal("compaction"),
|
|
4176
|
+
id: z21.string(),
|
|
4177
|
+
encrypted_content: z21.string()
|
|
4178
|
+
}),
|
|
4179
|
+
z21.object({
|
|
4180
|
+
type: z21.literal("shell_call_output"),
|
|
4181
|
+
id: z21.string(),
|
|
4182
|
+
call_id: z21.string(),
|
|
4183
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
4184
|
+
output: z21.array(
|
|
4185
|
+
z21.object({
|
|
4186
|
+
stdout: z21.string(),
|
|
4187
|
+
stderr: z21.string(),
|
|
4188
|
+
outcome: z21.discriminatedUnion("type", [
|
|
4189
|
+
z21.object({ type: z21.literal("timeout") }),
|
|
4190
|
+
z21.object({
|
|
4191
|
+
type: z21.literal("exit"),
|
|
4192
|
+
exit_code: z21.number()
|
|
3967
4193
|
})
|
|
3968
4194
|
])
|
|
3969
4195
|
})
|
|
3970
4196
|
)
|
|
4197
|
+
}),
|
|
4198
|
+
z21.object({
|
|
4199
|
+
type: z21.literal("tool_search_call"),
|
|
4200
|
+
id: z21.string(),
|
|
4201
|
+
execution: z21.enum(["server", "client"]),
|
|
4202
|
+
call_id: z21.string().nullable(),
|
|
4203
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
4204
|
+
arguments: z21.unknown()
|
|
4205
|
+
}),
|
|
4206
|
+
z21.object({
|
|
4207
|
+
type: z21.literal("tool_search_output"),
|
|
4208
|
+
id: z21.string(),
|
|
4209
|
+
execution: z21.enum(["server", "client"]),
|
|
4210
|
+
call_id: z21.string().nullable(),
|
|
4211
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
4212
|
+
tools: z21.array(z21.record(z21.string(), jsonValueSchema2.optional()))
|
|
3971
4213
|
})
|
|
3972
4214
|
])
|
|
3973
4215
|
).optional(),
|
|
3974
|
-
service_tier:
|
|
3975
|
-
incomplete_details:
|
|
3976
|
-
usage:
|
|
3977
|
-
input_tokens:
|
|
3978
|
-
input_tokens_details:
|
|
3979
|
-
output_tokens:
|
|
3980
|
-
output_tokens_details:
|
|
4216
|
+
service_tier: z21.string().nullish(),
|
|
4217
|
+
incomplete_details: z21.object({ reason: z21.string() }).nullish(),
|
|
4218
|
+
usage: z21.object({
|
|
4219
|
+
input_tokens: z21.number(),
|
|
4220
|
+
input_tokens_details: z21.object({ cached_tokens: z21.number().nullish() }).nullish(),
|
|
4221
|
+
output_tokens: z21.number(),
|
|
4222
|
+
output_tokens_details: z21.object({ reasoning_tokens: z21.number().nullish() }).nullish()
|
|
3981
4223
|
}).optional()
|
|
3982
4224
|
})
|
|
3983
4225
|
)
|
|
3984
4226
|
);
|
|
3985
4227
|
|
|
3986
4228
|
// src/responses/openai-responses-options.ts
|
|
3987
|
-
import { lazySchema as
|
|
3988
|
-
import { z as
|
|
4229
|
+
import { lazySchema as lazySchema20, zodSchema as zodSchema20 } from "@ai-sdk/provider-utils";
|
|
4230
|
+
import { z as z22 } from "zod/v4";
|
|
3989
4231
|
var TOP_LOGPROBS_MAX = 20;
|
|
3990
4232
|
var openaiResponsesReasoningModelIds = [
|
|
3991
4233
|
"o1",
|
|
@@ -4014,11 +4256,16 @@ var openaiResponsesReasoningModelIds = [
|
|
|
4014
4256
|
"gpt-5.2-chat-latest",
|
|
4015
4257
|
"gpt-5.2-pro",
|
|
4016
4258
|
"gpt-5.2-codex",
|
|
4259
|
+
"gpt-5.3-chat-latest",
|
|
4260
|
+
"gpt-5.3-codex",
|
|
4017
4261
|
"gpt-5.4",
|
|
4018
4262
|
"gpt-5.4-2026-03-05",
|
|
4263
|
+
"gpt-5.4-mini",
|
|
4264
|
+
"gpt-5.4-mini-2026-03-17",
|
|
4265
|
+
"gpt-5.4-nano",
|
|
4266
|
+
"gpt-5.4-nano-2026-03-17",
|
|
4019
4267
|
"gpt-5.4-pro",
|
|
4020
|
-
"gpt-5.4-pro-2026-03-05"
|
|
4021
|
-
"gpt-5.3-codex"
|
|
4268
|
+
"gpt-5.4-pro-2026-03-05"
|
|
4022
4269
|
];
|
|
4023
4270
|
var openaiResponsesModelIds = [
|
|
4024
4271
|
"gpt-4.1",
|
|
@@ -4045,9 +4292,9 @@ var openaiResponsesModelIds = [
|
|
|
4045
4292
|
"gpt-5-chat-latest",
|
|
4046
4293
|
...openaiResponsesReasoningModelIds
|
|
4047
4294
|
];
|
|
4048
|
-
var openaiLanguageModelResponsesOptionsSchema =
|
|
4049
|
-
() =>
|
|
4050
|
-
|
|
4295
|
+
var openaiLanguageModelResponsesOptionsSchema = lazySchema20(
|
|
4296
|
+
() => zodSchema20(
|
|
4297
|
+
z22.object({
|
|
4051
4298
|
/**
|
|
4052
4299
|
* The ID of the OpenAI Conversation to continue.
|
|
4053
4300
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -4055,13 +4302,13 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4055
4302
|
* Defaults to `undefined`.
|
|
4056
4303
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
4057
4304
|
*/
|
|
4058
|
-
conversation:
|
|
4305
|
+
conversation: z22.string().nullish(),
|
|
4059
4306
|
/**
|
|
4060
4307
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
4061
4308
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
4062
4309
|
*/
|
|
4063
|
-
include:
|
|
4064
|
-
|
|
4310
|
+
include: z22.array(
|
|
4311
|
+
z22.enum([
|
|
4065
4312
|
"reasoning.encrypted_content",
|
|
4066
4313
|
// handled internally by default, only needed for unknown reasoning models
|
|
4067
4314
|
"file_search_call.results",
|
|
@@ -4073,7 +4320,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4073
4320
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
4074
4321
|
* Defaults to `undefined`.
|
|
4075
4322
|
*/
|
|
4076
|
-
instructions:
|
|
4323
|
+
instructions: z22.string().nullish(),
|
|
4077
4324
|
/**
|
|
4078
4325
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
4079
4326
|
* the response size and can slow down response times. However, it can
|
|
@@ -4088,30 +4335,30 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4088
4335
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
4089
4336
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
4090
4337
|
*/
|
|
4091
|
-
logprobs:
|
|
4338
|
+
logprobs: z22.union([z22.boolean(), z22.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
4092
4339
|
/**
|
|
4093
4340
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
4094
4341
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
4095
4342
|
* Any further attempts to call a tool by the model will be ignored.
|
|
4096
4343
|
*/
|
|
4097
|
-
maxToolCalls:
|
|
4344
|
+
maxToolCalls: z22.number().nullish(),
|
|
4098
4345
|
/**
|
|
4099
4346
|
* Additional metadata to store with the generation.
|
|
4100
4347
|
*/
|
|
4101
|
-
metadata:
|
|
4348
|
+
metadata: z22.any().nullish(),
|
|
4102
4349
|
/**
|
|
4103
4350
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
4104
4351
|
*/
|
|
4105
|
-
parallelToolCalls:
|
|
4352
|
+
parallelToolCalls: z22.boolean().nullish(),
|
|
4106
4353
|
/**
|
|
4107
4354
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
4108
4355
|
* Defaults to `undefined`.
|
|
4109
4356
|
*/
|
|
4110
|
-
previousResponseId:
|
|
4357
|
+
previousResponseId: z22.string().nullish(),
|
|
4111
4358
|
/**
|
|
4112
4359
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
4113
4360
|
*/
|
|
4114
|
-
promptCacheKey:
|
|
4361
|
+
promptCacheKey: z22.string().nullish(),
|
|
4115
4362
|
/**
|
|
4116
4363
|
* The retention policy for the prompt cache.
|
|
4117
4364
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -4120,7 +4367,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4120
4367
|
*
|
|
4121
4368
|
* @default 'in_memory'
|
|
4122
4369
|
*/
|
|
4123
|
-
promptCacheRetention:
|
|
4370
|
+
promptCacheRetention: z22.enum(["in_memory", "24h"]).nullish(),
|
|
4124
4371
|
/**
|
|
4125
4372
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
4126
4373
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -4131,17 +4378,17 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4131
4378
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
4132
4379
|
* an error.
|
|
4133
4380
|
*/
|
|
4134
|
-
reasoningEffort:
|
|
4381
|
+
reasoningEffort: z22.string().nullish(),
|
|
4135
4382
|
/**
|
|
4136
4383
|
* Controls reasoning summary output from the model.
|
|
4137
4384
|
* Set to "auto" to automatically receive the richest level available,
|
|
4138
4385
|
* or "detailed" for comprehensive summaries.
|
|
4139
4386
|
*/
|
|
4140
|
-
reasoningSummary:
|
|
4387
|
+
reasoningSummary: z22.string().nullish(),
|
|
4141
4388
|
/**
|
|
4142
4389
|
* The identifier for safety monitoring and tracking.
|
|
4143
4390
|
*/
|
|
4144
|
-
safetyIdentifier:
|
|
4391
|
+
safetyIdentifier: z22.string().nullish(),
|
|
4145
4392
|
/**
|
|
4146
4393
|
* Service tier for the request.
|
|
4147
4394
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -4149,34 +4396,34 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4149
4396
|
*
|
|
4150
4397
|
* Defaults to 'auto'.
|
|
4151
4398
|
*/
|
|
4152
|
-
serviceTier:
|
|
4399
|
+
serviceTier: z22.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
4153
4400
|
/**
|
|
4154
4401
|
* Whether to store the generation. Defaults to `true`.
|
|
4155
4402
|
*/
|
|
4156
|
-
store:
|
|
4403
|
+
store: z22.boolean().nullish(),
|
|
4157
4404
|
/**
|
|
4158
4405
|
* Whether to use strict JSON schema validation.
|
|
4159
4406
|
* Defaults to `true`.
|
|
4160
4407
|
*/
|
|
4161
|
-
strictJsonSchema:
|
|
4408
|
+
strictJsonSchema: z22.boolean().nullish(),
|
|
4162
4409
|
/**
|
|
4163
4410
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
4164
4411
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
4165
4412
|
* Valid values: 'low', 'medium', 'high'.
|
|
4166
4413
|
*/
|
|
4167
|
-
textVerbosity:
|
|
4414
|
+
textVerbosity: z22.enum(["low", "medium", "high"]).nullish(),
|
|
4168
4415
|
/**
|
|
4169
4416
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
4170
4417
|
* 'disabled' turns truncation off.
|
|
4171
4418
|
*/
|
|
4172
|
-
truncation:
|
|
4419
|
+
truncation: z22.enum(["auto", "disabled"]).nullish(),
|
|
4173
4420
|
/**
|
|
4174
4421
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
4175
4422
|
* monitor and detect abuse.
|
|
4176
4423
|
* Defaults to `undefined`.
|
|
4177
4424
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
4178
4425
|
*/
|
|
4179
|
-
user:
|
|
4426
|
+
user: z22.string().nullish(),
|
|
4180
4427
|
/**
|
|
4181
4428
|
* Override the system message mode for this model.
|
|
4182
4429
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -4185,7 +4432,7 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4185
4432
|
*
|
|
4186
4433
|
* If not specified, the mode is automatically determined based on the model.
|
|
4187
4434
|
*/
|
|
4188
|
-
systemMessageMode:
|
|
4435
|
+
systemMessageMode: z22.enum(["system", "developer", "remove"]).optional(),
|
|
4189
4436
|
/**
|
|
4190
4437
|
* Force treating this model as a reasoning model.
|
|
4191
4438
|
*
|
|
@@ -4195,7 +4442,16 @@ var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
|
4195
4442
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4196
4443
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4197
4444
|
*/
|
|
4198
|
-
forceReasoning:
|
|
4445
|
+
forceReasoning: z22.boolean().optional(),
|
|
4446
|
+
/**
|
|
4447
|
+
* Enable server-side context management (compaction).
|
|
4448
|
+
*/
|
|
4449
|
+
contextManagement: z22.array(
|
|
4450
|
+
z22.object({
|
|
4451
|
+
type: z22.literal("compaction"),
|
|
4452
|
+
compactThreshold: z22.number()
|
|
4453
|
+
})
|
|
4454
|
+
).nullish()
|
|
4199
4455
|
})
|
|
4200
4456
|
)
|
|
4201
4457
|
);
|
|
@@ -4211,7 +4467,7 @@ async function prepareResponsesTools({
|
|
|
4211
4467
|
toolNameMapping,
|
|
4212
4468
|
customProviderToolNames
|
|
4213
4469
|
}) {
|
|
4214
|
-
var _a;
|
|
4470
|
+
var _a, _b;
|
|
4215
4471
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
4216
4472
|
const toolWarnings = [];
|
|
4217
4473
|
if (tools == null) {
|
|
@@ -4221,15 +4477,19 @@ async function prepareResponsesTools({
|
|
|
4221
4477
|
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
4222
4478
|
for (const tool of tools) {
|
|
4223
4479
|
switch (tool.type) {
|
|
4224
|
-
case "function":
|
|
4480
|
+
case "function": {
|
|
4481
|
+
const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
|
|
4482
|
+
const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
|
|
4225
4483
|
openaiTools2.push({
|
|
4226
4484
|
type: "function",
|
|
4227
4485
|
name: tool.name,
|
|
4228
4486
|
description: tool.description,
|
|
4229
4487
|
parameters: tool.inputSchema,
|
|
4230
|
-
...tool.strict != null ? { strict: tool.strict } : {}
|
|
4488
|
+
...tool.strict != null ? { strict: tool.strict } : {},
|
|
4489
|
+
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
4231
4490
|
});
|
|
4232
4491
|
break;
|
|
4492
|
+
}
|
|
4233
4493
|
case "provider": {
|
|
4234
4494
|
switch (tool.id) {
|
|
4235
4495
|
case "openai.file_search": {
|
|
@@ -4367,11 +4627,24 @@ async function prepareResponsesTools({
|
|
|
4367
4627
|
});
|
|
4368
4628
|
openaiTools2.push({
|
|
4369
4629
|
type: "custom",
|
|
4370
|
-
name:
|
|
4630
|
+
name: tool.name,
|
|
4371
4631
|
description: args.description,
|
|
4372
4632
|
format: args.format
|
|
4373
4633
|
});
|
|
4374
|
-
resolvedCustomProviderToolNames.add(
|
|
4634
|
+
resolvedCustomProviderToolNames.add(tool.name);
|
|
4635
|
+
break;
|
|
4636
|
+
}
|
|
4637
|
+
case "openai.tool_search": {
|
|
4638
|
+
const args = await validateTypes2({
|
|
4639
|
+
value: tool.args,
|
|
4640
|
+
schema: toolSearchArgsSchema
|
|
4641
|
+
});
|
|
4642
|
+
openaiTools2.push({
|
|
4643
|
+
type: "tool_search",
|
|
4644
|
+
...args.execution != null ? { execution: args.execution } : {},
|
|
4645
|
+
...args.description != null ? { description: args.description } : {},
|
|
4646
|
+
...args.parameters != null ? { parameters: args.parameters } : {}
|
|
4647
|
+
});
|
|
4375
4648
|
break;
|
|
4376
4649
|
}
|
|
4377
4650
|
}
|
|
@@ -4395,7 +4668,7 @@ async function prepareResponsesTools({
|
|
|
4395
4668
|
case "required":
|
|
4396
4669
|
return { tools: openaiTools2, toolChoice: type, toolWarnings };
|
|
4397
4670
|
case "tool": {
|
|
4398
|
-
const resolvedToolName = (
|
|
4671
|
+
const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
|
|
4399
4672
|
return {
|
|
4400
4673
|
tools: openaiTools2,
|
|
4401
4674
|
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 },
|
|
@@ -4475,7 +4748,7 @@ function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
|
4475
4748
|
}
|
|
4476
4749
|
var OpenAIResponsesLanguageModel = class {
|
|
4477
4750
|
constructor(modelId, config) {
|
|
4478
|
-
this.specificationVersion = "
|
|
4751
|
+
this.specificationVersion = "v4";
|
|
4479
4752
|
this.supportedUrls = {
|
|
4480
4753
|
"image/*": [/^https?:\/\/.*$/],
|
|
4481
4754
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -4496,12 +4769,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4496
4769
|
frequencyPenalty,
|
|
4497
4770
|
seed,
|
|
4498
4771
|
prompt,
|
|
4772
|
+
reasoning,
|
|
4499
4773
|
providerOptions,
|
|
4500
4774
|
tools,
|
|
4501
4775
|
toolChoice,
|
|
4502
4776
|
responseFormat
|
|
4503
4777
|
}) {
|
|
4504
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4778
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4505
4779
|
const warnings = [];
|
|
4506
4780
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
4507
4781
|
if (topK != null) {
|
|
@@ -4532,7 +4806,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4532
4806
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4533
4807
|
});
|
|
4534
4808
|
}
|
|
4535
|
-
const
|
|
4809
|
+
const resolvedReasoningEffort = (_a = openaiOptions == null ? void 0 : openaiOptions.reasoningEffort) != null ? _a : isCustomReasoning2(reasoning) ? reasoning : void 0;
|
|
4810
|
+
const isReasoningModel = (_b = openaiOptions == null ? void 0 : openaiOptions.forceReasoning) != null ? _b : modelCapabilities.isReasoningModel;
|
|
4536
4811
|
if ((openaiOptions == null ? void 0 : openaiOptions.conversation) && (openaiOptions == null ? void 0 : openaiOptions.previousResponseId)) {
|
|
4537
4812
|
warnings.push({
|
|
4538
4813
|
type: "unsupported",
|
|
@@ -4551,9 +4826,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4551
4826
|
"openai.web_search": "web_search",
|
|
4552
4827
|
"openai.web_search_preview": "web_search_preview",
|
|
4553
4828
|
"openai.mcp": "mcp",
|
|
4554
|
-
"openai.apply_patch": "apply_patch"
|
|
4555
|
-
|
|
4556
|
-
|
|
4829
|
+
"openai.apply_patch": "apply_patch",
|
|
4830
|
+
"openai.tool_search": "tool_search"
|
|
4831
|
+
}
|
|
4557
4832
|
});
|
|
4558
4833
|
const customProviderToolNames = /* @__PURE__ */ new Set();
|
|
4559
4834
|
const {
|
|
@@ -4569,10 +4844,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4569
4844
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
4570
4845
|
prompt,
|
|
4571
4846
|
toolNameMapping,
|
|
4572
|
-
systemMessageMode: (
|
|
4847
|
+
systemMessageMode: (_c = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _c : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
|
|
4573
4848
|
providerOptionsName,
|
|
4574
4849
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
4575
|
-
store: (
|
|
4850
|
+
store: (_d = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _d : true,
|
|
4576
4851
|
hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
|
|
4577
4852
|
hasLocalShellTool: hasOpenAITool("openai.local_shell"),
|
|
4578
4853
|
hasShellTool: hasOpenAITool("openai.shell"),
|
|
@@ -4580,7 +4855,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4580
4855
|
customProviderToolNames: customProviderToolNames.size > 0 ? customProviderToolNames : void 0
|
|
4581
4856
|
});
|
|
4582
4857
|
warnings.push(...inputWarnings);
|
|
4583
|
-
const strictJsonSchema = (
|
|
4858
|
+
const strictJsonSchema = (_e = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _e : true;
|
|
4584
4859
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
4585
4860
|
function addInclude(key) {
|
|
4586
4861
|
if (include == null) {
|
|
@@ -4596,9 +4871,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4596
4871
|
if (topLogprobs) {
|
|
4597
4872
|
addInclude("message.output_text.logprobs");
|
|
4598
4873
|
}
|
|
4599
|
-
const webSearchToolName = (
|
|
4874
|
+
const webSearchToolName = (_f = tools == null ? void 0 : tools.find(
|
|
4600
4875
|
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
4601
|
-
)) == null ? void 0 :
|
|
4876
|
+
)) == null ? void 0 : _f.name;
|
|
4602
4877
|
if (webSearchToolName) {
|
|
4603
4878
|
addInclude("web_search_call.action.sources");
|
|
4604
4879
|
}
|
|
@@ -4621,7 +4896,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4621
4896
|
format: responseFormat.schema != null ? {
|
|
4622
4897
|
type: "json_schema",
|
|
4623
4898
|
strict: strictJsonSchema,
|
|
4624
|
-
name: (
|
|
4899
|
+
name: (_g = responseFormat.name) != null ? _g : "response",
|
|
4625
4900
|
description: responseFormat.description,
|
|
4626
4901
|
schema: responseFormat.schema
|
|
4627
4902
|
} : { type: "json_object" }
|
|
@@ -4647,11 +4922,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4647
4922
|
safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
|
|
4648
4923
|
top_logprobs: topLogprobs,
|
|
4649
4924
|
truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
|
|
4925
|
+
// context management (server-side compaction):
|
|
4926
|
+
...(openaiOptions == null ? void 0 : openaiOptions.contextManagement) && {
|
|
4927
|
+
context_management: openaiOptions.contextManagement.map((cm) => ({
|
|
4928
|
+
type: cm.type,
|
|
4929
|
+
compact_threshold: cm.compactThreshold
|
|
4930
|
+
}))
|
|
4931
|
+
},
|
|
4650
4932
|
// model-specific settings:
|
|
4651
|
-
...isReasoningModel && (
|
|
4933
|
+
...isReasoningModel && (resolvedReasoningEffort != null || (openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null) && {
|
|
4652
4934
|
reasoning: {
|
|
4653
|
-
...
|
|
4654
|
-
effort:
|
|
4935
|
+
...resolvedReasoningEffort != null && {
|
|
4936
|
+
effort: resolvedReasoningEffort
|
|
4655
4937
|
},
|
|
4656
4938
|
...(openaiOptions == null ? void 0 : openaiOptions.reasoningSummary) != null && {
|
|
4657
4939
|
summary: openaiOptions.reasoningSummary
|
|
@@ -4660,7 +4942,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4660
4942
|
}
|
|
4661
4943
|
};
|
|
4662
4944
|
if (isReasoningModel) {
|
|
4663
|
-
if (!(
|
|
4945
|
+
if (!(resolvedReasoningEffort === "none" && modelCapabilities.supportsNonReasoningParameters)) {
|
|
4664
4946
|
if (baseArgs.temperature != null) {
|
|
4665
4947
|
baseArgs.temperature = void 0;
|
|
4666
4948
|
warnings.push({
|
|
@@ -4710,9 +4992,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4710
4992
|
});
|
|
4711
4993
|
delete baseArgs.service_tier;
|
|
4712
4994
|
}
|
|
4713
|
-
const shellToolEnvType = (
|
|
4995
|
+
const shellToolEnvType = (_j = (_i = (_h = tools == null ? void 0 : tools.find(
|
|
4714
4996
|
(tool) => tool.type === "provider" && tool.id === "openai.shell"
|
|
4715
|
-
)) == null ? void 0 :
|
|
4997
|
+
)) == null ? void 0 : _h.args) == null ? void 0 : _i.environment) == null ? void 0 : _j.type;
|
|
4716
4998
|
const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
|
|
4717
4999
|
return {
|
|
4718
5000
|
webSearchToolName,
|
|
@@ -4729,7 +5011,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4729
5011
|
};
|
|
4730
5012
|
}
|
|
4731
5013
|
async doGenerate(options) {
|
|
4732
|
-
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;
|
|
5014
|
+
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;
|
|
4733
5015
|
const {
|
|
4734
5016
|
args: body,
|
|
4735
5017
|
warnings,
|
|
@@ -4772,6 +5054,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4772
5054
|
const content = [];
|
|
4773
5055
|
const logprobs = [];
|
|
4774
5056
|
let hasFunctionCall = false;
|
|
5057
|
+
const hostedToolSearchCallIds = [];
|
|
4775
5058
|
for (const part of response.output) {
|
|
4776
5059
|
switch (part.type) {
|
|
4777
5060
|
case "reasoning": {
|
|
@@ -4810,6 +5093,46 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4810
5093
|
});
|
|
4811
5094
|
break;
|
|
4812
5095
|
}
|
|
5096
|
+
case "tool_search_call": {
|
|
5097
|
+
const toolCallId = (_b = part.call_id) != null ? _b : part.id;
|
|
5098
|
+
const isHosted = part.execution === "server";
|
|
5099
|
+
if (isHosted) {
|
|
5100
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5101
|
+
}
|
|
5102
|
+
content.push({
|
|
5103
|
+
type: "tool-call",
|
|
5104
|
+
toolCallId,
|
|
5105
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5106
|
+
input: JSON.stringify({
|
|
5107
|
+
arguments: part.arguments,
|
|
5108
|
+
call_id: part.call_id
|
|
5109
|
+
}),
|
|
5110
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5111
|
+
providerMetadata: {
|
|
5112
|
+
[providerOptionsName]: {
|
|
5113
|
+
itemId: part.id
|
|
5114
|
+
}
|
|
5115
|
+
}
|
|
5116
|
+
});
|
|
5117
|
+
break;
|
|
5118
|
+
}
|
|
5119
|
+
case "tool_search_output": {
|
|
5120
|
+
const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
|
|
5121
|
+
content.push({
|
|
5122
|
+
type: "tool-result",
|
|
5123
|
+
toolCallId,
|
|
5124
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5125
|
+
result: {
|
|
5126
|
+
tools: part.tools
|
|
5127
|
+
},
|
|
5128
|
+
providerMetadata: {
|
|
5129
|
+
[providerOptionsName]: {
|
|
5130
|
+
itemId: part.id
|
|
5131
|
+
}
|
|
5132
|
+
}
|
|
5133
|
+
});
|
|
5134
|
+
break;
|
|
5135
|
+
}
|
|
4813
5136
|
case "local_shell_call": {
|
|
4814
5137
|
content.push({
|
|
4815
5138
|
type: "tool-call",
|
|
@@ -4865,7 +5188,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4865
5188
|
}
|
|
4866
5189
|
case "message": {
|
|
4867
5190
|
for (const contentPart of part.content) {
|
|
4868
|
-
if (((
|
|
5191
|
+
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
|
|
4869
5192
|
logprobs.push(contentPart.logprobs);
|
|
4870
5193
|
}
|
|
4871
5194
|
const providerMetadata2 = {
|
|
@@ -4887,7 +5210,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4887
5210
|
content.push({
|
|
4888
5211
|
type: "source",
|
|
4889
5212
|
sourceType: "url",
|
|
4890
|
-
id: (
|
|
5213
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : generateId2(),
|
|
4891
5214
|
url: annotation.url,
|
|
4892
5215
|
title: annotation.title
|
|
4893
5216
|
});
|
|
@@ -4895,7 +5218,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4895
5218
|
content.push({
|
|
4896
5219
|
type: "source",
|
|
4897
5220
|
sourceType: "document",
|
|
4898
|
-
id: (
|
|
5221
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : generateId2(),
|
|
4899
5222
|
mediaType: "text/plain",
|
|
4900
5223
|
title: annotation.filename,
|
|
4901
5224
|
filename: annotation.filename,
|
|
@@ -4911,7 +5234,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4911
5234
|
content.push({
|
|
4912
5235
|
type: "source",
|
|
4913
5236
|
sourceType: "document",
|
|
4914
|
-
id: (
|
|
5237
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2(),
|
|
4915
5238
|
mediaType: "text/plain",
|
|
4916
5239
|
title: annotation.filename,
|
|
4917
5240
|
filename: annotation.filename,
|
|
@@ -4927,7 +5250,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4927
5250
|
content.push({
|
|
4928
5251
|
type: "source",
|
|
4929
5252
|
sourceType: "document",
|
|
4930
|
-
id: (
|
|
5253
|
+
id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : generateId2(),
|
|
4931
5254
|
mediaType: "application/octet-stream",
|
|
4932
5255
|
title: annotation.file_id,
|
|
4933
5256
|
filename: annotation.file_id,
|
|
@@ -4996,7 +5319,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4996
5319
|
break;
|
|
4997
5320
|
}
|
|
4998
5321
|
case "mcp_call": {
|
|
4999
|
-
const toolCallId = part.approval_request_id != null ? (
|
|
5322
|
+
const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
|
|
5000
5323
|
const toolName = `mcp.${part.name}`;
|
|
5001
5324
|
content.push({
|
|
5002
5325
|
type: "tool-call",
|
|
@@ -5030,8 +5353,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5030
5353
|
break;
|
|
5031
5354
|
}
|
|
5032
5355
|
case "mcp_approval_request": {
|
|
5033
|
-
const approvalRequestId = (
|
|
5034
|
-
const dummyToolCallId = (
|
|
5356
|
+
const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
|
|
5357
|
+
const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId2();
|
|
5035
5358
|
const toolName = `mcp.${part.name}`;
|
|
5036
5359
|
content.push({
|
|
5037
5360
|
type: "tool-call",
|
|
@@ -5081,13 +5404,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5081
5404
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5082
5405
|
result: {
|
|
5083
5406
|
queries: part.queries,
|
|
5084
|
-
results: (
|
|
5407
|
+
results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
|
|
5085
5408
|
attributes: result.attributes,
|
|
5086
5409
|
fileId: result.file_id,
|
|
5087
5410
|
filename: result.filename,
|
|
5088
5411
|
score: result.score,
|
|
5089
5412
|
text: result.text
|
|
5090
|
-
}))) != null ?
|
|
5413
|
+
}))) != null ? _y : null
|
|
5091
5414
|
}
|
|
5092
5415
|
});
|
|
5093
5416
|
break;
|
|
@@ -5130,6 +5453,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5130
5453
|
});
|
|
5131
5454
|
break;
|
|
5132
5455
|
}
|
|
5456
|
+
case "compaction": {
|
|
5457
|
+
content.push({
|
|
5458
|
+
type: "custom",
|
|
5459
|
+
kind: "openai.compaction",
|
|
5460
|
+
providerMetadata: {
|
|
5461
|
+
[providerOptionsName]: {
|
|
5462
|
+
type: "compaction",
|
|
5463
|
+
itemId: part.id,
|
|
5464
|
+
encryptedContent: part.encrypted_content
|
|
5465
|
+
}
|
|
5466
|
+
}
|
|
5467
|
+
});
|
|
5468
|
+
break;
|
|
5469
|
+
}
|
|
5133
5470
|
}
|
|
5134
5471
|
}
|
|
5135
5472
|
const providerMetadata = {
|
|
@@ -5144,10 +5481,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5144
5481
|
content,
|
|
5145
5482
|
finishReason: {
|
|
5146
5483
|
unified: mapOpenAIResponseFinishReason({
|
|
5147
|
-
finishReason: (
|
|
5484
|
+
finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
|
|
5148
5485
|
hasFunctionCall
|
|
5149
5486
|
}),
|
|
5150
|
-
raw: (
|
|
5487
|
+
raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
|
|
5151
5488
|
},
|
|
5152
5489
|
usage: convertOpenAIResponsesUsage(usage),
|
|
5153
5490
|
request: { body },
|
|
@@ -5205,6 +5542,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5205
5542
|
let hasFunctionCall = false;
|
|
5206
5543
|
const activeReasoning = {};
|
|
5207
5544
|
let serviceTier;
|
|
5545
|
+
const hostedToolSearchCallIds = [];
|
|
5208
5546
|
return {
|
|
5209
5547
|
stream: response.pipeThrough(
|
|
5210
5548
|
new TransformStream({
|
|
@@ -5212,7 +5550,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5212
5550
|
controller.enqueue({ type: "stream-start", warnings });
|
|
5213
5551
|
},
|
|
5214
5552
|
transform(chunk, controller) {
|
|
5215
|
-
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;
|
|
5553
|
+
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, _K, _L;
|
|
5216
5554
|
if (options.includeRawChunks) {
|
|
5217
5555
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
5218
5556
|
}
|
|
@@ -5320,6 +5658,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5320
5658
|
input: "{}",
|
|
5321
5659
|
providerExecuted: true
|
|
5322
5660
|
});
|
|
5661
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5662
|
+
const toolCallId = value.item.id;
|
|
5663
|
+
const toolName = toolNameMapping.toCustomToolName("tool_search");
|
|
5664
|
+
const isHosted = value.item.execution === "server";
|
|
5665
|
+
ongoingToolCalls[value.output_index] = {
|
|
5666
|
+
toolName,
|
|
5667
|
+
toolCallId,
|
|
5668
|
+
toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
|
|
5669
|
+
};
|
|
5670
|
+
if (isHosted) {
|
|
5671
|
+
controller.enqueue({
|
|
5672
|
+
type: "tool-input-start",
|
|
5673
|
+
id: toolCallId,
|
|
5674
|
+
toolName,
|
|
5675
|
+
providerExecuted: true
|
|
5676
|
+
});
|
|
5677
|
+
}
|
|
5678
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5323
5679
|
} else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
|
|
5324
5680
|
} else if (value.item.type === "apply_patch_call") {
|
|
5325
5681
|
const { call_id: callId, operation } = value.item;
|
|
@@ -5366,7 +5722,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5366
5722
|
} else if (value.item.type === "shell_call_output") {
|
|
5367
5723
|
} else if (value.item.type === "message") {
|
|
5368
5724
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
5369
|
-
activeMessagePhase = (
|
|
5725
|
+
activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
|
|
5370
5726
|
controller.enqueue({
|
|
5371
5727
|
type: "text-start",
|
|
5372
5728
|
id: value.item.id,
|
|
@@ -5390,14 +5746,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5390
5746
|
providerMetadata: {
|
|
5391
5747
|
[providerOptionsName]: {
|
|
5392
5748
|
itemId: value.item.id,
|
|
5393
|
-
reasoningEncryptedContent: (
|
|
5749
|
+
reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
|
|
5394
5750
|
}
|
|
5395
5751
|
}
|
|
5396
5752
|
});
|
|
5397
5753
|
}
|
|
5398
5754
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
5399
5755
|
if (value.item.type === "message") {
|
|
5400
|
-
const phase = (
|
|
5756
|
+
const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
|
|
5401
5757
|
activeMessagePhase = void 0;
|
|
5402
5758
|
controller.enqueue({
|
|
5403
5759
|
type: "text-end",
|
|
@@ -5491,13 +5847,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5491
5847
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5492
5848
|
result: {
|
|
5493
5849
|
queries: value.item.queries,
|
|
5494
|
-
results: (
|
|
5850
|
+
results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
|
|
5495
5851
|
attributes: result.attributes,
|
|
5496
5852
|
fileId: result.file_id,
|
|
5497
5853
|
filename: result.filename,
|
|
5498
5854
|
score: result.score,
|
|
5499
5855
|
text: result.text
|
|
5500
|
-
}))) != null ?
|
|
5856
|
+
}))) != null ? _f : null
|
|
5501
5857
|
}
|
|
5502
5858
|
});
|
|
5503
5859
|
} else if (value.item.type === "code_interpreter_call") {
|
|
@@ -5519,12 +5875,62 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5519
5875
|
result: value.item.result
|
|
5520
5876
|
}
|
|
5521
5877
|
});
|
|
5878
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5879
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
5880
|
+
const isHosted = value.item.execution === "server";
|
|
5881
|
+
if (toolCall != null) {
|
|
5882
|
+
const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
|
|
5883
|
+
if (isHosted) {
|
|
5884
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5885
|
+
} else {
|
|
5886
|
+
controller.enqueue({
|
|
5887
|
+
type: "tool-input-start",
|
|
5888
|
+
id: toolCallId,
|
|
5889
|
+
toolName: toolCall.toolName
|
|
5890
|
+
});
|
|
5891
|
+
}
|
|
5892
|
+
controller.enqueue({
|
|
5893
|
+
type: "tool-input-end",
|
|
5894
|
+
id: toolCallId
|
|
5895
|
+
});
|
|
5896
|
+
controller.enqueue({
|
|
5897
|
+
type: "tool-call",
|
|
5898
|
+
toolCallId,
|
|
5899
|
+
toolName: toolCall.toolName,
|
|
5900
|
+
input: JSON.stringify({
|
|
5901
|
+
arguments: value.item.arguments,
|
|
5902
|
+
call_id: isHosted ? null : toolCallId
|
|
5903
|
+
}),
|
|
5904
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5905
|
+
providerMetadata: {
|
|
5906
|
+
[providerOptionsName]: {
|
|
5907
|
+
itemId: value.item.id
|
|
5908
|
+
}
|
|
5909
|
+
}
|
|
5910
|
+
});
|
|
5911
|
+
}
|
|
5912
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
5913
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5914
|
+
const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
|
|
5915
|
+
controller.enqueue({
|
|
5916
|
+
type: "tool-result",
|
|
5917
|
+
toolCallId,
|
|
5918
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5919
|
+
result: {
|
|
5920
|
+
tools: value.item.tools
|
|
5921
|
+
},
|
|
5922
|
+
providerMetadata: {
|
|
5923
|
+
[providerOptionsName]: {
|
|
5924
|
+
itemId: value.item.id
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
});
|
|
5522
5928
|
} else if (value.item.type === "mcp_call") {
|
|
5523
5929
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5524
|
-
const approvalRequestId = (
|
|
5525
|
-
const aliasedToolCallId = approvalRequestId != null ? (
|
|
5930
|
+
const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
|
|
5931
|
+
const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
5526
5932
|
approvalRequestId
|
|
5527
|
-
)) != null ?
|
|
5933
|
+
)) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
|
|
5528
5934
|
const toolName = `mcp.${value.item.name}`;
|
|
5529
5935
|
controller.enqueue({
|
|
5530
5936
|
type: "tool-call",
|
|
@@ -5594,8 +6000,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5594
6000
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5595
6001
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5596
6002
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5597
|
-
const dummyToolCallId = (
|
|
5598
|
-
const approvalRequestId = (
|
|
6003
|
+
const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : generateId2();
|
|
6004
|
+
const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
|
|
5599
6005
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5600
6006
|
approvalRequestId,
|
|
5601
6007
|
dummyToolCallId
|
|
@@ -5684,12 +6090,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5684
6090
|
providerMetadata: {
|
|
5685
6091
|
[providerOptionsName]: {
|
|
5686
6092
|
itemId: value.item.id,
|
|
5687
|
-
reasoningEncryptedContent: (
|
|
6093
|
+
reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
|
|
5688
6094
|
}
|
|
5689
6095
|
}
|
|
5690
6096
|
});
|
|
5691
6097
|
}
|
|
5692
6098
|
delete activeReasoning[value.item.id];
|
|
6099
|
+
} else if (value.item.type === "compaction") {
|
|
6100
|
+
controller.enqueue({
|
|
6101
|
+
type: "custom",
|
|
6102
|
+
kind: "openai.compaction",
|
|
6103
|
+
providerMetadata: {
|
|
6104
|
+
[providerOptionsName]: {
|
|
6105
|
+
type: "compaction",
|
|
6106
|
+
itemId: value.item.id,
|
|
6107
|
+
encryptedContent: value.item.encrypted_content
|
|
6108
|
+
}
|
|
6109
|
+
}
|
|
6110
|
+
});
|
|
5693
6111
|
}
|
|
5694
6112
|
} else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
|
|
5695
6113
|
const toolCall = ongoingToolCalls[value.output_index];
|
|
@@ -5797,7 +6215,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5797
6215
|
id: value.item_id,
|
|
5798
6216
|
delta: value.delta
|
|
5799
6217
|
});
|
|
5800
|
-
if (((
|
|
6218
|
+
if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
|
|
5801
6219
|
logprobs.push(value.logprobs);
|
|
5802
6220
|
}
|
|
5803
6221
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -5826,7 +6244,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5826
6244
|
providerMetadata: {
|
|
5827
6245
|
[providerOptionsName]: {
|
|
5828
6246
|
itemId: value.item_id,
|
|
5829
|
-
reasoningEncryptedContent: (
|
|
6247
|
+
reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
|
|
5830
6248
|
}
|
|
5831
6249
|
}
|
|
5832
6250
|
});
|
|
@@ -5860,22 +6278,32 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5860
6278
|
} else if (isResponseFinishedChunk(value)) {
|
|
5861
6279
|
finishReason = {
|
|
5862
6280
|
unified: mapOpenAIResponseFinishReason({
|
|
5863
|
-
finishReason: (
|
|
6281
|
+
finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
|
|
5864
6282
|
hasFunctionCall
|
|
5865
6283
|
}),
|
|
5866
|
-
raw: (
|
|
6284
|
+
raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
|
|
5867
6285
|
};
|
|
5868
6286
|
usage = value.response.usage;
|
|
5869
6287
|
if (typeof value.response.service_tier === "string") {
|
|
5870
6288
|
serviceTier = value.response.service_tier;
|
|
5871
6289
|
}
|
|
6290
|
+
} else if (isResponseFailedChunk(value)) {
|
|
6291
|
+
const incompleteReason = (_y = value.response.incomplete_details) == null ? void 0 : _y.reason;
|
|
6292
|
+
finishReason = {
|
|
6293
|
+
unified: incompleteReason ? mapOpenAIResponseFinishReason({
|
|
6294
|
+
finishReason: incompleteReason,
|
|
6295
|
+
hasFunctionCall
|
|
6296
|
+
}) : "error",
|
|
6297
|
+
raw: incompleteReason != null ? incompleteReason : "error"
|
|
6298
|
+
};
|
|
6299
|
+
usage = (_z = value.response.usage) != null ? _z : void 0;
|
|
5872
6300
|
} else if (isResponseAnnotationAddedChunk(value)) {
|
|
5873
6301
|
ongoingAnnotations.push(value.annotation);
|
|
5874
6302
|
if (value.annotation.type === "url_citation") {
|
|
5875
6303
|
controller.enqueue({
|
|
5876
6304
|
type: "source",
|
|
5877
6305
|
sourceType: "url",
|
|
5878
|
-
id: (
|
|
6306
|
+
id: (_C = (_B = (_A = self.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId2(),
|
|
5879
6307
|
url: value.annotation.url,
|
|
5880
6308
|
title: value.annotation.title
|
|
5881
6309
|
});
|
|
@@ -5883,7 +6311,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5883
6311
|
controller.enqueue({
|
|
5884
6312
|
type: "source",
|
|
5885
6313
|
sourceType: "document",
|
|
5886
|
-
id: (
|
|
6314
|
+
id: (_F = (_E = (_D = self.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : generateId2(),
|
|
5887
6315
|
mediaType: "text/plain",
|
|
5888
6316
|
title: value.annotation.filename,
|
|
5889
6317
|
filename: value.annotation.filename,
|
|
@@ -5899,7 +6327,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5899
6327
|
controller.enqueue({
|
|
5900
6328
|
type: "source",
|
|
5901
6329
|
sourceType: "document",
|
|
5902
|
-
id: (
|
|
6330
|
+
id: (_I = (_H = (_G = self.config).generateId) == null ? void 0 : _H.call(_G)) != null ? _I : generateId2(),
|
|
5903
6331
|
mediaType: "text/plain",
|
|
5904
6332
|
title: value.annotation.filename,
|
|
5905
6333
|
filename: value.annotation.filename,
|
|
@@ -5915,7 +6343,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5915
6343
|
controller.enqueue({
|
|
5916
6344
|
type: "source",
|
|
5917
6345
|
sourceType: "document",
|
|
5918
|
-
id: (
|
|
6346
|
+
id: (_L = (_K = (_J = self.config).generateId) == null ? void 0 : _K.call(_J)) != null ? _L : generateId2(),
|
|
5919
6347
|
mediaType: "application/octet-stream",
|
|
5920
6348
|
title: value.annotation.file_id,
|
|
5921
6349
|
filename: value.annotation.file_id,
|
|
@@ -5963,6 +6391,9 @@ function isResponseOutputItemDoneChunk(chunk) {
|
|
|
5963
6391
|
function isResponseFinishedChunk(chunk) {
|
|
5964
6392
|
return chunk.type === "response.completed" || chunk.type === "response.incomplete";
|
|
5965
6393
|
}
|
|
6394
|
+
function isResponseFailedChunk(chunk) {
|
|
6395
|
+
return chunk.type === "response.failed";
|
|
6396
|
+
}
|
|
5966
6397
|
function isResponseCreatedChunk(chunk) {
|
|
5967
6398
|
return chunk.type === "response.created";
|
|
5968
6399
|
}
|
|
@@ -6033,13 +6464,13 @@ import {
|
|
|
6033
6464
|
} from "@ai-sdk/provider-utils";
|
|
6034
6465
|
|
|
6035
6466
|
// src/speech/openai-speech-options.ts
|
|
6036
|
-
import { lazySchema as
|
|
6037
|
-
import { z as
|
|
6038
|
-
var openaiSpeechModelOptionsSchema =
|
|
6039
|
-
() =>
|
|
6040
|
-
|
|
6041
|
-
instructions:
|
|
6042
|
-
speed:
|
|
6467
|
+
import { lazySchema as lazySchema21, zodSchema as zodSchema21 } from "@ai-sdk/provider-utils";
|
|
6468
|
+
import { z as z23 } from "zod/v4";
|
|
6469
|
+
var openaiSpeechModelOptionsSchema = lazySchema21(
|
|
6470
|
+
() => zodSchema21(
|
|
6471
|
+
z23.object({
|
|
6472
|
+
instructions: z23.string().nullish(),
|
|
6473
|
+
speed: z23.number().min(0.25).max(4).default(1).nullish()
|
|
6043
6474
|
})
|
|
6044
6475
|
)
|
|
6045
6476
|
);
|
|
@@ -6049,7 +6480,7 @@ var OpenAISpeechModel = class {
|
|
|
6049
6480
|
constructor(modelId, config) {
|
|
6050
6481
|
this.modelId = modelId;
|
|
6051
6482
|
this.config = config;
|
|
6052
|
-
this.specificationVersion = "
|
|
6483
|
+
this.specificationVersion = "v4";
|
|
6053
6484
|
}
|
|
6054
6485
|
get provider() {
|
|
6055
6486
|
return this.config.provider;
|
|
@@ -6156,33 +6587,33 @@ import {
|
|
|
6156
6587
|
} from "@ai-sdk/provider-utils";
|
|
6157
6588
|
|
|
6158
6589
|
// src/transcription/openai-transcription-api.ts
|
|
6159
|
-
import { lazySchema as
|
|
6160
|
-
import { z as
|
|
6161
|
-
var openaiTranscriptionResponseSchema =
|
|
6162
|
-
() =>
|
|
6163
|
-
|
|
6164
|
-
text:
|
|
6165
|
-
language:
|
|
6166
|
-
duration:
|
|
6167
|
-
words:
|
|
6168
|
-
|
|
6169
|
-
word:
|
|
6170
|
-
start:
|
|
6171
|
-
end:
|
|
6590
|
+
import { lazySchema as lazySchema22, zodSchema as zodSchema22 } from "@ai-sdk/provider-utils";
|
|
6591
|
+
import { z as z24 } from "zod/v4";
|
|
6592
|
+
var openaiTranscriptionResponseSchema = lazySchema22(
|
|
6593
|
+
() => zodSchema22(
|
|
6594
|
+
z24.object({
|
|
6595
|
+
text: z24.string(),
|
|
6596
|
+
language: z24.string().nullish(),
|
|
6597
|
+
duration: z24.number().nullish(),
|
|
6598
|
+
words: z24.array(
|
|
6599
|
+
z24.object({
|
|
6600
|
+
word: z24.string(),
|
|
6601
|
+
start: z24.number(),
|
|
6602
|
+
end: z24.number()
|
|
6172
6603
|
})
|
|
6173
6604
|
).nullish(),
|
|
6174
|
-
segments:
|
|
6175
|
-
|
|
6176
|
-
id:
|
|
6177
|
-
seek:
|
|
6178
|
-
start:
|
|
6179
|
-
end:
|
|
6180
|
-
text:
|
|
6181
|
-
tokens:
|
|
6182
|
-
temperature:
|
|
6183
|
-
avg_logprob:
|
|
6184
|
-
compression_ratio:
|
|
6185
|
-
no_speech_prob:
|
|
6605
|
+
segments: z24.array(
|
|
6606
|
+
z24.object({
|
|
6607
|
+
id: z24.number(),
|
|
6608
|
+
seek: z24.number(),
|
|
6609
|
+
start: z24.number(),
|
|
6610
|
+
end: z24.number(),
|
|
6611
|
+
text: z24.string(),
|
|
6612
|
+
tokens: z24.array(z24.number()),
|
|
6613
|
+
temperature: z24.number(),
|
|
6614
|
+
avg_logprob: z24.number(),
|
|
6615
|
+
compression_ratio: z24.number(),
|
|
6616
|
+
no_speech_prob: z24.number()
|
|
6186
6617
|
})
|
|
6187
6618
|
).nullish()
|
|
6188
6619
|
})
|
|
@@ -6190,33 +6621,33 @@ var openaiTranscriptionResponseSchema = lazySchema21(
|
|
|
6190
6621
|
);
|
|
6191
6622
|
|
|
6192
6623
|
// src/transcription/openai-transcription-options.ts
|
|
6193
|
-
import { lazySchema as
|
|
6194
|
-
import { z as
|
|
6195
|
-
var openAITranscriptionModelOptions =
|
|
6196
|
-
() =>
|
|
6197
|
-
|
|
6624
|
+
import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
|
|
6625
|
+
import { z as z25 } from "zod/v4";
|
|
6626
|
+
var openAITranscriptionModelOptions = lazySchema23(
|
|
6627
|
+
() => zodSchema23(
|
|
6628
|
+
z25.object({
|
|
6198
6629
|
/**
|
|
6199
6630
|
* Additional information to include in the transcription response.
|
|
6200
6631
|
*/
|
|
6201
|
-
include:
|
|
6632
|
+
include: z25.array(z25.string()).optional(),
|
|
6202
6633
|
/**
|
|
6203
6634
|
* The language of the input audio in ISO-639-1 format.
|
|
6204
6635
|
*/
|
|
6205
|
-
language:
|
|
6636
|
+
language: z25.string().optional(),
|
|
6206
6637
|
/**
|
|
6207
6638
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
6208
6639
|
*/
|
|
6209
|
-
prompt:
|
|
6640
|
+
prompt: z25.string().optional(),
|
|
6210
6641
|
/**
|
|
6211
6642
|
* The sampling temperature, between 0 and 1.
|
|
6212
6643
|
* @default 0
|
|
6213
6644
|
*/
|
|
6214
|
-
temperature:
|
|
6645
|
+
temperature: z25.number().min(0).max(1).default(0).optional(),
|
|
6215
6646
|
/**
|
|
6216
6647
|
* The timestamp granularities to populate for this transcription.
|
|
6217
6648
|
* @default ['segment']
|
|
6218
6649
|
*/
|
|
6219
|
-
timestampGranularities:
|
|
6650
|
+
timestampGranularities: z25.array(z25.enum(["word", "segment"])).default(["segment"]).optional()
|
|
6220
6651
|
})
|
|
6221
6652
|
)
|
|
6222
6653
|
);
|
|
@@ -6285,7 +6716,7 @@ var OpenAITranscriptionModel = class {
|
|
|
6285
6716
|
constructor(modelId, config) {
|
|
6286
6717
|
this.modelId = modelId;
|
|
6287
6718
|
this.config = config;
|
|
6288
|
-
this.specificationVersion = "
|
|
6719
|
+
this.specificationVersion = "v4";
|
|
6289
6720
|
}
|
|
6290
6721
|
get provider() {
|
|
6291
6722
|
return this.config.provider;
|
|
@@ -6389,7 +6820,7 @@ var OpenAITranscriptionModel = class {
|
|
|
6389
6820
|
};
|
|
6390
6821
|
|
|
6391
6822
|
// src/version.ts
|
|
6392
|
-
var VERSION = true ? "4.0.0-beta.
|
|
6823
|
+
var VERSION = true ? "4.0.0-beta.20" : "0.0.0-test";
|
|
6393
6824
|
|
|
6394
6825
|
// src/openai-provider.ts
|
|
6395
6826
|
function createOpenAI(options = {}) {
|
|
@@ -6470,7 +6901,7 @@ function createOpenAI(options = {}) {
|
|
|
6470
6901
|
const provider = function(modelId) {
|
|
6471
6902
|
return createLanguageModel(modelId);
|
|
6472
6903
|
};
|
|
6473
|
-
provider.specificationVersion = "
|
|
6904
|
+
provider.specificationVersion = "v4";
|
|
6474
6905
|
provider.languageModel = createLanguageModel;
|
|
6475
6906
|
provider.chat = createChatModel;
|
|
6476
6907
|
provider.completion = createCompletionModel;
|