@ai-sdk/openai 4.0.74 → 4.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1382 -1312
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +1574 -1504
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +156 -93
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/responses/convert-to-openai-responses-input.ts +39 -0
- package/src/responses/openai-responses-language-model-options.ts +22 -0
- package/src/responses/openai-responses-language-model.ts +76 -24
package/dist/internal/index.js
CHANGED
|
@@ -3332,7 +3332,8 @@ var OpenAISpeechModel = class _OpenAISpeechModel {
|
|
|
3332
3332
|
|
|
3333
3333
|
// src/responses/openai-responses-language-model.ts
|
|
3334
3334
|
import {
|
|
3335
|
-
APICallError as APICallError2
|
|
3335
|
+
APICallError as APICallError2,
|
|
3336
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError8
|
|
3336
3337
|
} from "@ai-sdk/provider";
|
|
3337
3338
|
import {
|
|
3338
3339
|
combineHeaders as combineHeaders7,
|
|
@@ -3412,47 +3413,370 @@ import {
|
|
|
3412
3413
|
resolveProviderReference as resolveProviderReference2,
|
|
3413
3414
|
validateTypes
|
|
3414
3415
|
} from "@ai-sdk/provider-utils";
|
|
3415
|
-
import { z as
|
|
3416
|
+
import { z as z20 } from "zod/v4";
|
|
3416
3417
|
|
|
3417
|
-
// src/
|
|
3418
|
+
// src/responses/openai-responses-language-model-options.ts
|
|
3418
3419
|
import {
|
|
3419
|
-
createProviderDefinedToolFactoryWithOutputSchema,
|
|
3420
3420
|
lazySchema as lazySchema12,
|
|
3421
3421
|
zodSchema as zodSchema12
|
|
3422
3422
|
} from "@ai-sdk/provider-utils";
|
|
3423
3423
|
import { z as z13 } from "zod/v4";
|
|
3424
|
-
var
|
|
3424
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
3425
|
+
var openaiResponsesReasoningModelIds = [
|
|
3426
|
+
"o1",
|
|
3427
|
+
"o1-2024-12-17",
|
|
3428
|
+
"o3",
|
|
3429
|
+
"o3-2025-04-16",
|
|
3430
|
+
"o3-mini",
|
|
3431
|
+
"o3-mini-2025-01-31",
|
|
3432
|
+
"o4-mini",
|
|
3433
|
+
"o4-mini-2025-04-16",
|
|
3434
|
+
"gpt-5",
|
|
3435
|
+
"gpt-5-2025-08-07",
|
|
3436
|
+
"gpt-5-codex",
|
|
3437
|
+
"gpt-5-mini",
|
|
3438
|
+
"gpt-5-mini-2025-08-07",
|
|
3439
|
+
"gpt-5-nano",
|
|
3440
|
+
"gpt-5-nano-2025-08-07",
|
|
3441
|
+
"gpt-5-pro",
|
|
3442
|
+
"gpt-5-pro-2025-10-06",
|
|
3443
|
+
"gpt-5.1",
|
|
3444
|
+
"gpt-5.1-chat-latest",
|
|
3445
|
+
"gpt-5.1-codex-mini",
|
|
3446
|
+
"gpt-5.1-codex",
|
|
3447
|
+
"gpt-5.1-codex-max",
|
|
3448
|
+
"gpt-5.2",
|
|
3449
|
+
"gpt-5.2-chat-latest",
|
|
3450
|
+
"gpt-5.2-pro",
|
|
3451
|
+
"gpt-5.2-codex",
|
|
3452
|
+
"gpt-5.3-chat-latest",
|
|
3453
|
+
"gpt-5.3-codex",
|
|
3454
|
+
"gpt-5.4",
|
|
3455
|
+
"gpt-5.4-2026-03-05",
|
|
3456
|
+
"gpt-5.4-mini",
|
|
3457
|
+
"gpt-5.4-mini-2026-03-17",
|
|
3458
|
+
"gpt-5.4-nano",
|
|
3459
|
+
"gpt-5.4-nano-2026-03-17",
|
|
3460
|
+
"gpt-5.4-pro",
|
|
3461
|
+
"gpt-5.4-pro-2026-03-05",
|
|
3462
|
+
"gpt-5.5",
|
|
3463
|
+
"gpt-5.5-2026-04-23",
|
|
3464
|
+
"gpt-5.6",
|
|
3465
|
+
"gpt-5.6-luna",
|
|
3466
|
+
"gpt-5.6-sol",
|
|
3467
|
+
"gpt-5.6-terra",
|
|
3468
|
+
"gpt-6-astra",
|
|
3469
|
+
"gpt-6-luna",
|
|
3470
|
+
"gpt-6-sol"
|
|
3471
|
+
];
|
|
3472
|
+
var openaiResponsesModelIds = [
|
|
3473
|
+
"gpt-4.1",
|
|
3474
|
+
"gpt-4.1-2025-04-14",
|
|
3475
|
+
"gpt-4.1-mini",
|
|
3476
|
+
"gpt-4.1-mini-2025-04-14",
|
|
3477
|
+
"gpt-4.1-nano",
|
|
3478
|
+
"gpt-4.1-nano-2025-04-14",
|
|
3479
|
+
"gpt-4o",
|
|
3480
|
+
"gpt-4o-2024-05-13",
|
|
3481
|
+
"gpt-4o-2024-08-06",
|
|
3482
|
+
"gpt-4o-2024-11-20",
|
|
3483
|
+
"gpt-4o-audio-preview",
|
|
3484
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
3485
|
+
"gpt-4o-search-preview",
|
|
3486
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
3487
|
+
"gpt-4o-mini-search-preview",
|
|
3488
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
3489
|
+
"gpt-4o-mini",
|
|
3490
|
+
"gpt-4o-mini-2024-07-18",
|
|
3491
|
+
"gpt-3.5-turbo-0125",
|
|
3492
|
+
"gpt-3.5-turbo",
|
|
3493
|
+
"gpt-3.5-turbo-1106",
|
|
3494
|
+
"gpt-5-chat-latest",
|
|
3495
|
+
...openaiResponsesReasoningModelIds
|
|
3496
|
+
];
|
|
3497
|
+
var openaiLanguageModelResponsesOptionsSchema = lazySchema12(
|
|
3425
3498
|
() => zodSchema12(
|
|
3426
3499
|
z13.object({
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3500
|
+
/**
|
|
3501
|
+
* The ID of the OpenAI Conversation to continue.
|
|
3502
|
+
* You must create a conversation first via the OpenAI API.
|
|
3503
|
+
* Cannot be used in conjunction with `previousResponseId`.
|
|
3504
|
+
* Defaults to `undefined`.
|
|
3505
|
+
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3506
|
+
*/
|
|
3507
|
+
conversation: z13.string().nullish(),
|
|
3508
|
+
/**
|
|
3509
|
+
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
3510
|
+
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
|
|
3511
|
+
*/
|
|
3512
|
+
include: z13.array(
|
|
3513
|
+
z13.enum([
|
|
3514
|
+
"reasoning.encrypted_content",
|
|
3515
|
+
// handled internally by default, only needed for unknown reasoning models
|
|
3516
|
+
"file_search_call.results",
|
|
3517
|
+
"web_search_call.results",
|
|
3518
|
+
"message.output_text.logprobs"
|
|
3519
|
+
])
|
|
3520
|
+
).nullish(),
|
|
3521
|
+
/**
|
|
3522
|
+
* Whether to automatically include web search action sources in the
|
|
3523
|
+
* response. Disable this for OpenAI-compatible providers that do not
|
|
3524
|
+
* support the `web_search_call.action.sources` include value.
|
|
3525
|
+
*
|
|
3526
|
+
* Defaults to `true`.
|
|
3527
|
+
*/
|
|
3528
|
+
includeWebSearchSources: z13.boolean().optional(),
|
|
3529
|
+
/**
|
|
3530
|
+
* Instructions for the model.
|
|
3531
|
+
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
3532
|
+
* Defaults to `undefined`.
|
|
3533
|
+
*/
|
|
3534
|
+
instructions: z13.string().nullish(),
|
|
3535
|
+
/**
|
|
3536
|
+
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
3537
|
+
* the response size and can slow down response times. However, it can
|
|
3538
|
+
* be useful to better understand how the model is behaving.
|
|
3539
|
+
*
|
|
3540
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
3541
|
+
* were generated.
|
|
3542
|
+
*
|
|
3543
|
+
* Setting to a number will return the log probabilities of the top n
|
|
3544
|
+
* tokens that were generated.
|
|
3545
|
+
*
|
|
3546
|
+
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3547
|
+
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3548
|
+
*/
|
|
3549
|
+
logprobs: z13.union([z13.boolean(), z13.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3550
|
+
/**
|
|
3551
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3552
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3553
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
3554
|
+
*/
|
|
3555
|
+
maxToolCalls: z13.number().nullish(),
|
|
3556
|
+
/**
|
|
3557
|
+
* Additional metadata to store with the generation.
|
|
3558
|
+
*/
|
|
3559
|
+
metadata: z13.any().nullish(),
|
|
3560
|
+
/**
|
|
3561
|
+
* Whether to use parallel tool calls. Defaults to `true`.
|
|
3562
|
+
*/
|
|
3563
|
+
parallelToolCalls: z13.boolean().nullish(),
|
|
3564
|
+
/**
|
|
3565
|
+
* The ID of the previous response. You can use it to continue a conversation.
|
|
3566
|
+
* Defaults to `undefined`.
|
|
3567
|
+
*/
|
|
3568
|
+
previousResponseId: z13.string().nullish(),
|
|
3569
|
+
/**
|
|
3570
|
+
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
3571
|
+
*/
|
|
3572
|
+
promptCacheKey: z13.string().nullish(),
|
|
3573
|
+
/**
|
|
3574
|
+
* Prompt cache behavior for GPT-5.6 and later models.
|
|
3575
|
+
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
3576
|
+
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
3577
|
+
*/
|
|
3578
|
+
promptCacheOptions: z13.object({
|
|
3579
|
+
mode: z13.enum(["implicit", "explicit"]).optional(),
|
|
3580
|
+
ttl: z13.literal("30m").optional()
|
|
3581
|
+
}).optional(),
|
|
3582
|
+
/**
|
|
3583
|
+
* The retention policy for the prompt cache.
|
|
3584
|
+
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
3585
|
+
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
3586
|
+
* Available for models before GPT-5.6 that support extended caching.
|
|
3587
|
+
*
|
|
3588
|
+
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
3589
|
+
*
|
|
3590
|
+
* @default 'in_memory'
|
|
3591
|
+
*/
|
|
3592
|
+
promptCacheRetention: z13.enum(["in_memory", "24h"]).nullish(),
|
|
3593
|
+
/**
|
|
3594
|
+
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3595
|
+
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
3596
|
+
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
3597
|
+
* Supported values vary by model.
|
|
3598
|
+
*/
|
|
3599
|
+
reasoningEffort: z13.string().nullish(),
|
|
3600
|
+
/**
|
|
3601
|
+
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
3602
|
+
* without changing the request-level reasoning effort. This preserves the
|
|
3603
|
+
* request prefix for prompt caching.
|
|
3604
|
+
*
|
|
3605
|
+
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3606
|
+
* combined with automatic compaction or automatic truncation.
|
|
3607
|
+
*/
|
|
3608
|
+
reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3609
|
+
/**
|
|
3610
|
+
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3611
|
+
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
3612
|
+
*/
|
|
3613
|
+
reasoningMode: z13.enum(["standard", "pro"]).optional(),
|
|
3614
|
+
/**
|
|
3615
|
+
* Controls which available reasoning items GPT-5.6 can use.
|
|
3616
|
+
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
3617
|
+
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
3618
|
+
*/
|
|
3619
|
+
reasoningContext: z13.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
3620
|
+
/**
|
|
3621
|
+
* Controls reasoning summary output from the model.
|
|
3622
|
+
* Set to "auto" to automatically receive the richest level available,
|
|
3623
|
+
* or "detailed" for comprehensive summaries.
|
|
3624
|
+
*/
|
|
3625
|
+
reasoningSummary: z13.string().nullish(),
|
|
3626
|
+
/**
|
|
3627
|
+
* The identifier for safety monitoring and tracking.
|
|
3628
|
+
*/
|
|
3629
|
+
safetyIdentifier: z13.string().nullish(),
|
|
3630
|
+
/**
|
|
3631
|
+
* Service tier for the request.
|
|
3632
|
+
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
3633
|
+
* Set to 'priority' for faster processing with Enterprise access (available for gpt-4, gpt-5, gpt-5-mini, o3, o4-mini; gpt-5-nano is not supported).
|
|
3634
|
+
* Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
|
|
3635
|
+
* Set to 'ultrafast' for access-controlled Ultrafast processing (available only for gpt-5.6-sol).
|
|
3636
|
+
*
|
|
3637
|
+
* Defaults to 'auto'.
|
|
3638
|
+
*/
|
|
3639
|
+
serviceTier: z13.enum(["auto", "flex", "priority", "fast", "ultrafast", "default"]).nullish(),
|
|
3640
|
+
/**
|
|
3641
|
+
* Whether to store the generation. Defaults to `true`.
|
|
3642
|
+
*/
|
|
3643
|
+
store: z13.boolean().nullish(),
|
|
3644
|
+
/**
|
|
3645
|
+
* Whether to pass through non-image file types as generic input files.
|
|
3646
|
+
*
|
|
3647
|
+
* By default, inline file inputs are restricted to images and PDFs.
|
|
3648
|
+
* Enable this when the target OpenAI Responses model supports additional
|
|
3649
|
+
* file media types, such as text/csv.
|
|
3650
|
+
*/
|
|
3651
|
+
passThroughUnsupportedFiles: z13.boolean().optional(),
|
|
3652
|
+
/**
|
|
3653
|
+
* Whether to use strict JSON schema validation.
|
|
3654
|
+
* Defaults to `true`.
|
|
3655
|
+
*/
|
|
3656
|
+
strictJsonSchema: z13.boolean().nullish(),
|
|
3657
|
+
/**
|
|
3658
|
+
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
3659
|
+
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
3660
|
+
* Valid values: 'low', 'medium', 'high'.
|
|
3661
|
+
*/
|
|
3662
|
+
textVerbosity: z13.enum(["low", "medium", "high"]).nullish(),
|
|
3663
|
+
/**
|
|
3664
|
+
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
3665
|
+
* 'disabled' turns truncation off.
|
|
3666
|
+
*/
|
|
3667
|
+
truncation: z13.enum(["auto", "disabled"]).nullish(),
|
|
3668
|
+
/**
|
|
3669
|
+
* A unique identifier representing your end-user, which can help OpenAI to
|
|
3670
|
+
* monitor and detect abuse.
|
|
3671
|
+
* Defaults to `undefined`.
|
|
3672
|
+
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
3673
|
+
*/
|
|
3674
|
+
user: z13.string().nullish(),
|
|
3675
|
+
/**
|
|
3676
|
+
* Override the system message mode for this model.
|
|
3677
|
+
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
3678
|
+
* - 'developer': Use the 'developer' role for system messages (used by reasoning models)
|
|
3679
|
+
* - 'remove': Remove system messages entirely
|
|
3680
|
+
*
|
|
3681
|
+
* If not specified, the mode is automatically determined based on the model.
|
|
3682
|
+
*/
|
|
3683
|
+
systemMessageMode: z13.enum(["system", "developer", "remove"]).optional(),
|
|
3684
|
+
/**
|
|
3685
|
+
* Force treating this model as a reasoning model.
|
|
3686
|
+
*
|
|
3687
|
+
* This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
|
|
3688
|
+
* where the model ID is not recognized by the SDK's allowlist.
|
|
3689
|
+
*
|
|
3690
|
+
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
3691
|
+
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
3692
|
+
*/
|
|
3693
|
+
forceReasoning: z13.boolean().optional(),
|
|
3694
|
+
/**
|
|
3695
|
+
* Enable server-side context management (compaction).
|
|
3696
|
+
*/
|
|
3697
|
+
contextManagement: z13.array(
|
|
3438
3698
|
z13.object({
|
|
3439
|
-
type: z13.literal("
|
|
3440
|
-
|
|
3441
|
-
diff: z13.string()
|
|
3699
|
+
type: z13.literal("compaction"),
|
|
3700
|
+
compactThreshold: z13.number()
|
|
3442
3701
|
})
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3702
|
+
).nullish(),
|
|
3703
|
+
/**
|
|
3704
|
+
* Request explicit server-side compaction by appending a
|
|
3705
|
+
* `compaction_trigger` item to the Responses input.
|
|
3706
|
+
*/
|
|
3707
|
+
compactionTrigger: z13.boolean().optional(),
|
|
3708
|
+
/**
|
|
3709
|
+
* Restrict the callable tools to a subset while keeping the full tools
|
|
3710
|
+
* list intact, so prompt caching is preserved across requests with
|
|
3711
|
+
* different allowlists.
|
|
3712
|
+
*
|
|
3713
|
+
* When set, this overrides the request-level `toolChoice` and emits
|
|
3714
|
+
* `tool_choice: { type: "allowed_tools", mode, tools }` on the wire.
|
|
3715
|
+
*
|
|
3716
|
+
* @see https://developers.openai.com/api/reference/resources/responses/methods/create#(resource)%20responses%20%3E%20(model)%20tool_choice_allowed%20%3E%20(schema)
|
|
3717
|
+
*/
|
|
3718
|
+
allowedTools: z13.object({
|
|
3719
|
+
toolNames: z13.array(z13.string()).min(1),
|
|
3720
|
+
mode: z13.enum(["auto", "required"]).optional()
|
|
3721
|
+
}).optional()
|
|
3722
|
+
})
|
|
3723
|
+
)
|
|
3724
|
+
);
|
|
3725
|
+
var openaiResponsesSystemMessageOptionsSchema = lazySchema12(
|
|
3726
|
+
() => zodSchema12(
|
|
3727
|
+
z13.object({
|
|
3728
|
+
/**
|
|
3729
|
+
* Emit a configuration update at this position in Responses history.
|
|
3730
|
+
* Requires empty system message content and the same supported
|
|
3731
|
+
* configuration as the request-level reasoningEffortUpdate option.
|
|
3732
|
+
* Unsupported historical updates throw instead of being omitted.
|
|
3733
|
+
*
|
|
3734
|
+
* @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
|
|
3735
|
+
*/
|
|
3736
|
+
reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional()
|
|
3737
|
+
})
|
|
3738
|
+
)
|
|
3739
|
+
);
|
|
3740
|
+
|
|
3741
|
+
// src/tool/apply-patch.ts
|
|
3742
|
+
import {
|
|
3743
|
+
createProviderDefinedToolFactoryWithOutputSchema,
|
|
3744
|
+
lazySchema as lazySchema13,
|
|
3745
|
+
zodSchema as zodSchema13
|
|
3746
|
+
} from "@ai-sdk/provider-utils";
|
|
3747
|
+
import { z as z14 } from "zod/v4";
|
|
3748
|
+
var applyPatchInputSchema = lazySchema13(
|
|
3749
|
+
() => zodSchema13(
|
|
3750
|
+
z14.object({
|
|
3751
|
+
callId: z14.string(),
|
|
3752
|
+
operation: z14.discriminatedUnion("type", [
|
|
3753
|
+
z14.object({
|
|
3754
|
+
type: z14.literal("create_file"),
|
|
3755
|
+
path: z14.string(),
|
|
3756
|
+
diff: z14.string()
|
|
3757
|
+
}),
|
|
3758
|
+
z14.object({
|
|
3759
|
+
type: z14.literal("delete_file"),
|
|
3760
|
+
path: z14.string()
|
|
3761
|
+
}),
|
|
3762
|
+
z14.object({
|
|
3763
|
+
type: z14.literal("update_file"),
|
|
3764
|
+
path: z14.string(),
|
|
3765
|
+
diff: z14.string()
|
|
3766
|
+
})
|
|
3767
|
+
])
|
|
3768
|
+
})
|
|
3769
|
+
)
|
|
3770
|
+
);
|
|
3771
|
+
var applyPatchOutputSchema = lazySchema13(
|
|
3772
|
+
() => zodSchema13(
|
|
3773
|
+
z14.object({
|
|
3774
|
+
status: z14.enum(["completed", "failed"]),
|
|
3775
|
+
output: z14.string().optional()
|
|
3776
|
+
})
|
|
3453
3777
|
)
|
|
3454
3778
|
);
|
|
3455
|
-
var applyPatchArgsSchema =
|
|
3779
|
+
var applyPatchArgsSchema = lazySchema13(() => zodSchema13(z14.object({})));
|
|
3456
3780
|
var applyPatchToolFactory = createProviderDefinedToolFactoryWithOutputSchema({
|
|
3457
3781
|
id: "openai.apply_patch",
|
|
3458
3782
|
inputSchema: applyPatchInputSchema,
|
|
@@ -3463,90 +3787,90 @@ var applyPatch = applyPatchToolFactory;
|
|
|
3463
3787
|
// src/tool/computer.ts
|
|
3464
3788
|
import {
|
|
3465
3789
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
|
|
3466
|
-
lazySchema as
|
|
3467
|
-
zodSchema as
|
|
3790
|
+
lazySchema as lazySchema14,
|
|
3791
|
+
zodSchema as zodSchema14
|
|
3468
3792
|
} from "@ai-sdk/provider-utils";
|
|
3469
|
-
import { z as
|
|
3470
|
-
var safetyCheckSchema =
|
|
3471
|
-
id:
|
|
3472
|
-
code:
|
|
3473
|
-
message:
|
|
3793
|
+
import { z as z15 } from "zod/v4";
|
|
3794
|
+
var safetyCheckSchema = z15.object({
|
|
3795
|
+
id: z15.string(),
|
|
3796
|
+
code: z15.string().optional(),
|
|
3797
|
+
message: z15.string().optional()
|
|
3474
3798
|
});
|
|
3475
|
-
var computerActionSchema =
|
|
3476
|
-
|
|
3477
|
-
type:
|
|
3478
|
-
button:
|
|
3479
|
-
x:
|
|
3480
|
-
y:
|
|
3481
|
-
keys:
|
|
3799
|
+
var computerActionSchema = z15.discriminatedUnion("type", [
|
|
3800
|
+
z15.object({
|
|
3801
|
+
type: z15.literal("click"),
|
|
3802
|
+
button: z15.enum(["left", "right", "wheel", "back", "forward"]),
|
|
3803
|
+
x: z15.number(),
|
|
3804
|
+
y: z15.number(),
|
|
3805
|
+
keys: z15.array(z15.string()).optional()
|
|
3482
3806
|
}),
|
|
3483
|
-
|
|
3484
|
-
type:
|
|
3485
|
-
x:
|
|
3486
|
-
y:
|
|
3487
|
-
keys:
|
|
3807
|
+
z15.object({
|
|
3808
|
+
type: z15.literal("double_click"),
|
|
3809
|
+
x: z15.number(),
|
|
3810
|
+
y: z15.number(),
|
|
3811
|
+
keys: z15.array(z15.string()).optional()
|
|
3488
3812
|
}),
|
|
3489
|
-
|
|
3490
|
-
type:
|
|
3491
|
-
path:
|
|
3492
|
-
keys:
|
|
3813
|
+
z15.object({
|
|
3814
|
+
type: z15.literal("drag"),
|
|
3815
|
+
path: z15.array(z15.object({ x: z15.number(), y: z15.number() })),
|
|
3816
|
+
keys: z15.array(z15.string()).optional()
|
|
3493
3817
|
}),
|
|
3494
|
-
|
|
3495
|
-
type:
|
|
3496
|
-
keys:
|
|
3818
|
+
z15.object({
|
|
3819
|
+
type: z15.literal("keypress"),
|
|
3820
|
+
keys: z15.array(z15.string())
|
|
3497
3821
|
}),
|
|
3498
|
-
|
|
3499
|
-
type:
|
|
3500
|
-
x:
|
|
3501
|
-
y:
|
|
3502
|
-
keys:
|
|
3822
|
+
z15.object({
|
|
3823
|
+
type: z15.literal("move"),
|
|
3824
|
+
x: z15.number(),
|
|
3825
|
+
y: z15.number(),
|
|
3826
|
+
keys: z15.array(z15.string()).optional()
|
|
3503
3827
|
}),
|
|
3504
|
-
|
|
3505
|
-
type:
|
|
3828
|
+
z15.object({
|
|
3829
|
+
type: z15.literal("screenshot")
|
|
3506
3830
|
}),
|
|
3507
|
-
|
|
3508
|
-
type:
|
|
3509
|
-
x:
|
|
3510
|
-
y:
|
|
3511
|
-
scrollX:
|
|
3512
|
-
scrollY:
|
|
3513
|
-
keys:
|
|
3831
|
+
z15.object({
|
|
3832
|
+
type: z15.literal("scroll"),
|
|
3833
|
+
x: z15.number(),
|
|
3834
|
+
y: z15.number(),
|
|
3835
|
+
scrollX: z15.number(),
|
|
3836
|
+
scrollY: z15.number(),
|
|
3837
|
+
keys: z15.array(z15.string()).optional()
|
|
3514
3838
|
}),
|
|
3515
|
-
|
|
3516
|
-
type:
|
|
3517
|
-
text:
|
|
3839
|
+
z15.object({
|
|
3840
|
+
type: z15.literal("type"),
|
|
3841
|
+
text: z15.string()
|
|
3518
3842
|
}),
|
|
3519
|
-
|
|
3520
|
-
type:
|
|
3843
|
+
z15.object({
|
|
3844
|
+
type: z15.literal("wait")
|
|
3521
3845
|
})
|
|
3522
3846
|
]);
|
|
3523
|
-
var computerInputSchema =
|
|
3524
|
-
() =>
|
|
3525
|
-
|
|
3526
|
-
actions:
|
|
3527
|
-
pendingSafetyChecks:
|
|
3528
|
-
status:
|
|
3847
|
+
var computerInputSchema = lazySchema14(
|
|
3848
|
+
() => zodSchema14(
|
|
3849
|
+
z15.object({
|
|
3850
|
+
actions: z15.array(computerActionSchema),
|
|
3851
|
+
pendingSafetyChecks: z15.array(safetyCheckSchema),
|
|
3852
|
+
status: z15.enum(["in_progress", "completed", "incomplete"])
|
|
3529
3853
|
})
|
|
3530
3854
|
)
|
|
3531
3855
|
);
|
|
3532
|
-
var computerOutputSchema =
|
|
3533
|
-
() =>
|
|
3534
|
-
|
|
3535
|
-
output:
|
|
3536
|
-
|
|
3537
|
-
type:
|
|
3538
|
-
imageUrl:
|
|
3539
|
-
fileId:
|
|
3540
|
-
detail:
|
|
3856
|
+
var computerOutputSchema = lazySchema14(
|
|
3857
|
+
() => zodSchema14(
|
|
3858
|
+
z15.object({
|
|
3859
|
+
output: z15.union([
|
|
3860
|
+
z15.object({
|
|
3861
|
+
type: z15.literal("computer_screenshot"),
|
|
3862
|
+
imageUrl: z15.string(),
|
|
3863
|
+
fileId: z15.string().optional(),
|
|
3864
|
+
detail: z15.enum(["auto", "low", "high", "original"]).optional()
|
|
3541
3865
|
}),
|
|
3542
|
-
|
|
3543
|
-
type:
|
|
3544
|
-
fileId:
|
|
3545
|
-
imageUrl:
|
|
3546
|
-
detail:
|
|
3866
|
+
z15.object({
|
|
3867
|
+
type: z15.literal("computer_screenshot"),
|
|
3868
|
+
fileId: z15.string(),
|
|
3869
|
+
imageUrl: z15.string().optional(),
|
|
3870
|
+
detail: z15.enum(["auto", "low", "high", "original"]).optional()
|
|
3547
3871
|
})
|
|
3548
3872
|
]),
|
|
3549
|
-
acknowledgedSafetyChecks:
|
|
3873
|
+
acknowledgedSafetyChecks: z15.array(safetyCheckSchema).optional()
|
|
3550
3874
|
})
|
|
3551
3875
|
)
|
|
3552
3876
|
);
|
|
@@ -3559,26 +3883,26 @@ var computerToolFactory = createProviderDefinedToolFactoryWithOutputSchema2({
|
|
|
3559
3883
|
// src/tool/local-shell.ts
|
|
3560
3884
|
import {
|
|
3561
3885
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
|
|
3562
|
-
lazySchema as
|
|
3563
|
-
zodSchema as
|
|
3886
|
+
lazySchema as lazySchema15,
|
|
3887
|
+
zodSchema as zodSchema15
|
|
3564
3888
|
} from "@ai-sdk/provider-utils";
|
|
3565
|
-
import { z as
|
|
3566
|
-
var localShellInputSchema =
|
|
3567
|
-
() =>
|
|
3568
|
-
|
|
3569
|
-
action:
|
|
3570
|
-
type:
|
|
3571
|
-
command:
|
|
3572
|
-
timeoutMs:
|
|
3573
|
-
user:
|
|
3574
|
-
workingDirectory:
|
|
3575
|
-
env:
|
|
3889
|
+
import { z as z16 } from "zod/v4";
|
|
3890
|
+
var localShellInputSchema = lazySchema15(
|
|
3891
|
+
() => zodSchema15(
|
|
3892
|
+
z16.object({
|
|
3893
|
+
action: z16.object({
|
|
3894
|
+
type: z16.literal("exec"),
|
|
3895
|
+
command: z16.array(z16.string()),
|
|
3896
|
+
timeoutMs: z16.number().optional(),
|
|
3897
|
+
user: z16.string().optional(),
|
|
3898
|
+
workingDirectory: z16.string().optional(),
|
|
3899
|
+
env: z16.record(z16.string(), z16.string()).optional()
|
|
3576
3900
|
})
|
|
3577
3901
|
})
|
|
3578
3902
|
)
|
|
3579
3903
|
);
|
|
3580
|
-
var localShellOutputSchema =
|
|
3581
|
-
() =>
|
|
3904
|
+
var localShellOutputSchema = lazySchema15(
|
|
3905
|
+
() => zodSchema15(z16.object({ output: z16.string() }))
|
|
3582
3906
|
);
|
|
3583
3907
|
var localShell = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
3584
3908
|
id: "openai.local_shell",
|
|
@@ -3589,91 +3913,91 @@ var localShell = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
|
3589
3913
|
// src/tool/shell.ts
|
|
3590
3914
|
import {
|
|
3591
3915
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
|
|
3592
|
-
lazySchema as
|
|
3593
|
-
zodSchema as
|
|
3916
|
+
lazySchema as lazySchema16,
|
|
3917
|
+
zodSchema as zodSchema16
|
|
3594
3918
|
} from "@ai-sdk/provider-utils";
|
|
3595
|
-
import { z as
|
|
3596
|
-
var shellInputSchema =
|
|
3597
|
-
() =>
|
|
3598
|
-
|
|
3599
|
-
action:
|
|
3600
|
-
commands:
|
|
3601
|
-
timeoutMs:
|
|
3602
|
-
maxOutputLength:
|
|
3919
|
+
import { z as z17 } from "zod/v4";
|
|
3920
|
+
var shellInputSchema = lazySchema16(
|
|
3921
|
+
() => zodSchema16(
|
|
3922
|
+
z17.object({
|
|
3923
|
+
action: z17.object({
|
|
3924
|
+
commands: z17.array(z17.string()),
|
|
3925
|
+
timeoutMs: z17.number().optional(),
|
|
3926
|
+
maxOutputLength: z17.number().optional()
|
|
3603
3927
|
})
|
|
3604
3928
|
})
|
|
3605
3929
|
)
|
|
3606
3930
|
);
|
|
3607
|
-
var shellOutputSchema =
|
|
3608
|
-
() =>
|
|
3609
|
-
|
|
3610
|
-
output:
|
|
3611
|
-
|
|
3612
|
-
stdout:
|
|
3613
|
-
stderr:
|
|
3614
|
-
outcome:
|
|
3615
|
-
|
|
3616
|
-
|
|
3931
|
+
var shellOutputSchema = lazySchema16(
|
|
3932
|
+
() => zodSchema16(
|
|
3933
|
+
z17.object({
|
|
3934
|
+
output: z17.array(
|
|
3935
|
+
z17.object({
|
|
3936
|
+
stdout: z17.string(),
|
|
3937
|
+
stderr: z17.string(),
|
|
3938
|
+
outcome: z17.discriminatedUnion("type", [
|
|
3939
|
+
z17.object({ type: z17.literal("timeout") }),
|
|
3940
|
+
z17.object({ type: z17.literal("exit"), exitCode: z17.number() })
|
|
3617
3941
|
])
|
|
3618
3942
|
})
|
|
3619
3943
|
)
|
|
3620
3944
|
})
|
|
3621
3945
|
)
|
|
3622
3946
|
);
|
|
3623
|
-
var shellSkillsSchema =
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
type:
|
|
3627
|
-
providerReference:
|
|
3628
|
-
version:
|
|
3947
|
+
var shellSkillsSchema = z17.array(
|
|
3948
|
+
z17.discriminatedUnion("type", [
|
|
3949
|
+
z17.object({
|
|
3950
|
+
type: z17.literal("skillReference"),
|
|
3951
|
+
providerReference: z17.record(z17.string(), z17.string()),
|
|
3952
|
+
version: z17.string().optional()
|
|
3629
3953
|
}),
|
|
3630
|
-
|
|
3631
|
-
type:
|
|
3632
|
-
name:
|
|
3633
|
-
description:
|
|
3634
|
-
source:
|
|
3635
|
-
type:
|
|
3636
|
-
mediaType:
|
|
3637
|
-
data:
|
|
3954
|
+
z17.object({
|
|
3955
|
+
type: z17.literal("inline"),
|
|
3956
|
+
name: z17.string(),
|
|
3957
|
+
description: z17.string(),
|
|
3958
|
+
source: z17.object({
|
|
3959
|
+
type: z17.literal("base64"),
|
|
3960
|
+
mediaType: z17.literal("application/zip"),
|
|
3961
|
+
data: z17.string()
|
|
3638
3962
|
})
|
|
3639
3963
|
})
|
|
3640
3964
|
])
|
|
3641
3965
|
).optional();
|
|
3642
|
-
var shellArgsSchema =
|
|
3643
|
-
() =>
|
|
3644
|
-
|
|
3645
|
-
environment:
|
|
3646
|
-
|
|
3647
|
-
type:
|
|
3648
|
-
fileIds:
|
|
3649
|
-
memoryLimit:
|
|
3650
|
-
networkPolicy:
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
type:
|
|
3654
|
-
allowedDomains:
|
|
3655
|
-
domainSecrets:
|
|
3656
|
-
|
|
3657
|
-
domain:
|
|
3658
|
-
name:
|
|
3659
|
-
value:
|
|
3966
|
+
var shellArgsSchema = lazySchema16(
|
|
3967
|
+
() => zodSchema16(
|
|
3968
|
+
z17.object({
|
|
3969
|
+
environment: z17.union([
|
|
3970
|
+
z17.object({
|
|
3971
|
+
type: z17.literal("containerAuto"),
|
|
3972
|
+
fileIds: z17.array(z17.string()).optional(),
|
|
3973
|
+
memoryLimit: z17.enum(["1g", "4g", "16g", "64g"]).optional(),
|
|
3974
|
+
networkPolicy: z17.discriminatedUnion("type", [
|
|
3975
|
+
z17.object({ type: z17.literal("disabled") }),
|
|
3976
|
+
z17.object({
|
|
3977
|
+
type: z17.literal("allowlist"),
|
|
3978
|
+
allowedDomains: z17.array(z17.string()),
|
|
3979
|
+
domainSecrets: z17.array(
|
|
3980
|
+
z17.object({
|
|
3981
|
+
domain: z17.string(),
|
|
3982
|
+
name: z17.string(),
|
|
3983
|
+
value: z17.string()
|
|
3660
3984
|
})
|
|
3661
3985
|
).optional()
|
|
3662
3986
|
})
|
|
3663
3987
|
]).optional(),
|
|
3664
3988
|
skills: shellSkillsSchema
|
|
3665
3989
|
}),
|
|
3666
|
-
|
|
3667
|
-
type:
|
|
3668
|
-
containerId:
|
|
3990
|
+
z17.object({
|
|
3991
|
+
type: z17.literal("containerReference"),
|
|
3992
|
+
containerId: z17.string()
|
|
3669
3993
|
}),
|
|
3670
|
-
|
|
3671
|
-
type:
|
|
3672
|
-
skills:
|
|
3673
|
-
|
|
3674
|
-
name:
|
|
3675
|
-
description:
|
|
3676
|
-
path:
|
|
3994
|
+
z17.object({
|
|
3995
|
+
type: z17.literal("local").optional(),
|
|
3996
|
+
skills: z17.array(
|
|
3997
|
+
z17.object({
|
|
3998
|
+
name: z17.string(),
|
|
3999
|
+
description: z17.string(),
|
|
4000
|
+
path: z17.string()
|
|
3677
4001
|
})
|
|
3678
4002
|
).optional()
|
|
3679
4003
|
})
|
|
@@ -3690,31 +4014,31 @@ var shell = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
|
3690
4014
|
// src/tool/tool-search.ts
|
|
3691
4015
|
import {
|
|
3692
4016
|
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
|
|
3693
|
-
lazySchema as
|
|
3694
|
-
zodSchema as
|
|
4017
|
+
lazySchema as lazySchema17,
|
|
4018
|
+
zodSchema as zodSchema17
|
|
3695
4019
|
} from "@ai-sdk/provider-utils";
|
|
3696
|
-
import { z as
|
|
3697
|
-
var toolSearchArgsSchema =
|
|
3698
|
-
() =>
|
|
3699
|
-
|
|
3700
|
-
execution:
|
|
3701
|
-
description:
|
|
3702
|
-
parameters:
|
|
4020
|
+
import { z as z18 } from "zod/v4";
|
|
4021
|
+
var toolSearchArgsSchema = lazySchema17(
|
|
4022
|
+
() => zodSchema17(
|
|
4023
|
+
z18.object({
|
|
4024
|
+
execution: z18.enum(["server", "client"]).optional(),
|
|
4025
|
+
description: z18.string().optional(),
|
|
4026
|
+
parameters: z18.record(z18.string(), z18.unknown()).optional()
|
|
3703
4027
|
})
|
|
3704
4028
|
)
|
|
3705
4029
|
);
|
|
3706
|
-
var toolSearchInputSchema =
|
|
3707
|
-
() =>
|
|
3708
|
-
|
|
3709
|
-
arguments:
|
|
3710
|
-
call_id:
|
|
4030
|
+
var toolSearchInputSchema = lazySchema17(
|
|
4031
|
+
() => zodSchema17(
|
|
4032
|
+
z18.object({
|
|
4033
|
+
arguments: z18.unknown().optional(),
|
|
4034
|
+
call_id: z18.string().nullish()
|
|
3711
4035
|
})
|
|
3712
4036
|
)
|
|
3713
4037
|
);
|
|
3714
|
-
var toolSearchOutputSchema =
|
|
3715
|
-
() =>
|
|
3716
|
-
|
|
3717
|
-
tools:
|
|
4038
|
+
var toolSearchOutputSchema = lazySchema17(
|
|
4039
|
+
() => zodSchema17(
|
|
4040
|
+
z18.object({
|
|
4041
|
+
tools: z18.array(z18.record(z18.string(), z18.unknown()))
|
|
3718
4042
|
})
|
|
3719
4043
|
)
|
|
3720
4044
|
);
|
|
@@ -3728,23 +4052,23 @@ var toolSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema5({
|
|
|
3728
4052
|
import {
|
|
3729
4053
|
createProviderExecutedToolFactory,
|
|
3730
4054
|
experimental_toolCaller,
|
|
3731
|
-
lazySchema as
|
|
3732
|
-
zodSchema as
|
|
4055
|
+
lazySchema as lazySchema18,
|
|
4056
|
+
zodSchema as zodSchema18
|
|
3733
4057
|
} from "@ai-sdk/provider-utils";
|
|
3734
|
-
import { z as
|
|
3735
|
-
var programmaticToolCallingInputSchema =
|
|
3736
|
-
() =>
|
|
3737
|
-
|
|
3738
|
-
code:
|
|
3739
|
-
fingerprint:
|
|
4058
|
+
import { z as z19 } from "zod/v4";
|
|
4059
|
+
var programmaticToolCallingInputSchema = lazySchema18(
|
|
4060
|
+
() => zodSchema18(
|
|
4061
|
+
z19.object({
|
|
4062
|
+
code: z19.string(),
|
|
4063
|
+
fingerprint: z19.string()
|
|
3740
4064
|
})
|
|
3741
4065
|
)
|
|
3742
4066
|
);
|
|
3743
|
-
var programmaticToolCallingOutputSchema =
|
|
3744
|
-
() =>
|
|
3745
|
-
|
|
3746
|
-
result:
|
|
3747
|
-
status:
|
|
4067
|
+
var programmaticToolCallingOutputSchema = lazySchema18(
|
|
4068
|
+
() => zodSchema18(
|
|
4069
|
+
z19.object({
|
|
4070
|
+
result: z19.string(),
|
|
4071
|
+
status: z19.enum(["completed", "incomplete"])
|
|
3748
4072
|
})
|
|
3749
4073
|
)
|
|
3750
4074
|
);
|
|
@@ -4084,7 +4408,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
4084
4408
|
hasComputerTool = false,
|
|
4085
4409
|
toolSearchToolName,
|
|
4086
4410
|
customProviderToolNames,
|
|
4087
|
-
outputSchemaToolNames
|
|
4411
|
+
outputSchemaToolNames,
|
|
4412
|
+
configurationUpdateUnsupportedReason
|
|
4088
4413
|
}) {
|
|
4089
4414
|
var _a2, _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, _M, _N, _O, _P;
|
|
4090
4415
|
let input = [];
|
|
@@ -4100,6 +4425,33 @@ async function convertToOpenAIResponsesInput({
|
|
|
4100
4425
|
for (const { role, content, providerOptions } of prompt) {
|
|
4101
4426
|
switch (role) {
|
|
4102
4427
|
case "system": {
|
|
4428
|
+
let options = await parseProviderOptions7({
|
|
4429
|
+
provider: providerOptionsName,
|
|
4430
|
+
providerOptions,
|
|
4431
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
4432
|
+
});
|
|
4433
|
+
if (options == null && providerOptionsName !== "openai") {
|
|
4434
|
+
options = await parseProviderOptions7({
|
|
4435
|
+
provider: "openai",
|
|
4436
|
+
providerOptions,
|
|
4437
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
4438
|
+
});
|
|
4439
|
+
}
|
|
4440
|
+
const effort = options == null ? void 0 : options.reasoningEffortUpdate;
|
|
4441
|
+
if (effort != null) {
|
|
4442
|
+
const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
|
|
4443
|
+
if (unsupportedReason != null) {
|
|
4444
|
+
throw new UnsupportedFunctionalityError6({
|
|
4445
|
+
functionality: "Message-level reasoningEffortUpdate",
|
|
4446
|
+
message: unsupportedReason
|
|
4447
|
+
});
|
|
4448
|
+
}
|
|
4449
|
+
input.push({
|
|
4450
|
+
type: "configuration_update",
|
|
4451
|
+
reasoning: { effort }
|
|
4452
|
+
});
|
|
4453
|
+
break;
|
|
4454
|
+
}
|
|
4103
4455
|
switch (systemMessageMode) {
|
|
4104
4456
|
case "system": {
|
|
4105
4457
|
const promptCacheBreakpoint = getPromptCacheBreakpoint2(
|
|
@@ -5013,9 +5365,9 @@ ${text}`,
|
|
|
5013
5365
|
}
|
|
5014
5366
|
return { input, warnings };
|
|
5015
5367
|
}
|
|
5016
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
5017
|
-
itemId:
|
|
5018
|
-
reasoningEncryptedContent:
|
|
5368
|
+
var openaiResponsesReasoningProviderOptionsSchema = z20.object({
|
|
5369
|
+
itemId: z20.string().nullish(),
|
|
5370
|
+
reasoningEncryptedContent: z20.string().nullish()
|
|
5019
5371
|
});
|
|
5020
5372
|
|
|
5021
5373
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -5039,157 +5391,157 @@ function mapOpenAIResponseFinishReason({
|
|
|
5039
5391
|
// src/responses/openai-responses-api.ts
|
|
5040
5392
|
import {
|
|
5041
5393
|
isRecord,
|
|
5042
|
-
lazySchema as
|
|
5043
|
-
zodSchema as
|
|
5394
|
+
lazySchema as lazySchema19,
|
|
5395
|
+
zodSchema as zodSchema19
|
|
5044
5396
|
} from "@ai-sdk/provider-utils";
|
|
5045
|
-
import { z as
|
|
5046
|
-
var jsonValueSchema =
|
|
5047
|
-
() =>
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5397
|
+
import { z as z21 } from "zod/v4";
|
|
5398
|
+
var jsonValueSchema = z21.lazy(
|
|
5399
|
+
() => z21.union([
|
|
5400
|
+
z21.string(),
|
|
5401
|
+
z21.number(),
|
|
5402
|
+
z21.boolean(),
|
|
5403
|
+
z21.null(),
|
|
5404
|
+
z21.array(jsonValueSchema),
|
|
5405
|
+
z21.record(z21.string(), jsonValueSchema.optional())
|
|
5054
5406
|
])
|
|
5055
5407
|
);
|
|
5056
|
-
var jsonObjectSchema =
|
|
5057
|
-
var openaiResponsesUsageSchema =
|
|
5408
|
+
var jsonObjectSchema = z21.record(z21.string(), jsonValueSchema.optional());
|
|
5409
|
+
var openaiResponsesUsageSchema = z21.intersection(
|
|
5058
5410
|
jsonObjectSchema,
|
|
5059
|
-
|
|
5060
|
-
input_tokens:
|
|
5061
|
-
input_tokens_details:
|
|
5411
|
+
z21.object({
|
|
5412
|
+
input_tokens: z21.number(),
|
|
5413
|
+
input_tokens_details: z21.intersection(
|
|
5062
5414
|
jsonObjectSchema,
|
|
5063
|
-
|
|
5064
|
-
cached_tokens:
|
|
5065
|
-
cache_write_tokens:
|
|
5066
|
-
orchestration_input_tokens:
|
|
5067
|
-
orchestration_input_cached_tokens:
|
|
5415
|
+
z21.object({
|
|
5416
|
+
cached_tokens: z21.number().nullish(),
|
|
5417
|
+
cache_write_tokens: z21.number().nullish(),
|
|
5418
|
+
orchestration_input_tokens: z21.number().nullish(),
|
|
5419
|
+
orchestration_input_cached_tokens: z21.number().nullish()
|
|
5068
5420
|
})
|
|
5069
5421
|
).nullish(),
|
|
5070
|
-
output_tokens:
|
|
5071
|
-
output_tokens_details:
|
|
5422
|
+
output_tokens: z21.number(),
|
|
5423
|
+
output_tokens_details: z21.intersection(
|
|
5072
5424
|
jsonObjectSchema,
|
|
5073
|
-
|
|
5074
|
-
reasoning_tokens:
|
|
5075
|
-
orchestration_output_tokens:
|
|
5425
|
+
z21.object({
|
|
5426
|
+
reasoning_tokens: z21.number().nullish(),
|
|
5427
|
+
orchestration_output_tokens: z21.number().nullish()
|
|
5076
5428
|
})
|
|
5077
5429
|
).nullish(),
|
|
5078
|
-
total_tokens:
|
|
5430
|
+
total_tokens: z21.number().optional()
|
|
5079
5431
|
})
|
|
5080
5432
|
);
|
|
5081
|
-
var openaiResponsesComputerSafetyCheckSchema =
|
|
5082
|
-
id:
|
|
5083
|
-
code:
|
|
5084
|
-
message:
|
|
5433
|
+
var openaiResponsesComputerSafetyCheckSchema = z21.object({
|
|
5434
|
+
id: z21.string(),
|
|
5435
|
+
code: z21.string().nullish(),
|
|
5436
|
+
message: z21.string().nullish()
|
|
5085
5437
|
});
|
|
5086
|
-
var openaiResponsesComputerActionSchema =
|
|
5087
|
-
|
|
5088
|
-
type:
|
|
5089
|
-
button:
|
|
5090
|
-
x:
|
|
5091
|
-
y:
|
|
5092
|
-
keys:
|
|
5438
|
+
var openaiResponsesComputerActionSchema = z21.discriminatedUnion("type", [
|
|
5439
|
+
z21.object({
|
|
5440
|
+
type: z21.literal("click"),
|
|
5441
|
+
button: z21.enum(["left", "right", "wheel", "back", "forward"]),
|
|
5442
|
+
x: z21.number(),
|
|
5443
|
+
y: z21.number(),
|
|
5444
|
+
keys: z21.array(z21.string()).nullish()
|
|
5093
5445
|
}),
|
|
5094
|
-
|
|
5095
|
-
type:
|
|
5096
|
-
x:
|
|
5097
|
-
y:
|
|
5098
|
-
keys:
|
|
5446
|
+
z21.object({
|
|
5447
|
+
type: z21.literal("double_click"),
|
|
5448
|
+
x: z21.number(),
|
|
5449
|
+
y: z21.number(),
|
|
5450
|
+
keys: z21.array(z21.string()).nullish()
|
|
5099
5451
|
}),
|
|
5100
|
-
|
|
5101
|
-
type:
|
|
5102
|
-
path:
|
|
5103
|
-
keys:
|
|
5452
|
+
z21.object({
|
|
5453
|
+
type: z21.literal("drag"),
|
|
5454
|
+
path: z21.array(z21.object({ x: z21.number(), y: z21.number() })),
|
|
5455
|
+
keys: z21.array(z21.string()).nullish()
|
|
5104
5456
|
}),
|
|
5105
|
-
|
|
5106
|
-
type:
|
|
5107
|
-
keys:
|
|
5457
|
+
z21.object({
|
|
5458
|
+
type: z21.literal("keypress"),
|
|
5459
|
+
keys: z21.array(z21.string())
|
|
5108
5460
|
}),
|
|
5109
|
-
|
|
5110
|
-
type:
|
|
5111
|
-
x:
|
|
5112
|
-
y:
|
|
5113
|
-
keys:
|
|
5461
|
+
z21.object({
|
|
5462
|
+
type: z21.literal("move"),
|
|
5463
|
+
x: z21.number(),
|
|
5464
|
+
y: z21.number(),
|
|
5465
|
+
keys: z21.array(z21.string()).nullish()
|
|
5114
5466
|
}),
|
|
5115
|
-
|
|
5116
|
-
type:
|
|
5467
|
+
z21.object({
|
|
5468
|
+
type: z21.literal("screenshot")
|
|
5117
5469
|
}),
|
|
5118
|
-
|
|
5119
|
-
type:
|
|
5120
|
-
x:
|
|
5121
|
-
y:
|
|
5122
|
-
scroll_x:
|
|
5123
|
-
scroll_y:
|
|
5124
|
-
keys:
|
|
5470
|
+
z21.object({
|
|
5471
|
+
type: z21.literal("scroll"),
|
|
5472
|
+
x: z21.number(),
|
|
5473
|
+
y: z21.number(),
|
|
5474
|
+
scroll_x: z21.number(),
|
|
5475
|
+
scroll_y: z21.number(),
|
|
5476
|
+
keys: z21.array(z21.string()).nullish()
|
|
5125
5477
|
}),
|
|
5126
|
-
|
|
5127
|
-
type:
|
|
5128
|
-
text:
|
|
5478
|
+
z21.object({
|
|
5479
|
+
type: z21.literal("type"),
|
|
5480
|
+
text: z21.string()
|
|
5129
5481
|
}),
|
|
5130
|
-
|
|
5131
|
-
type:
|
|
5482
|
+
z21.object({
|
|
5483
|
+
type: z21.literal("wait")
|
|
5132
5484
|
})
|
|
5133
5485
|
]);
|
|
5134
|
-
var openaiResponsesComputerCallSchema =
|
|
5135
|
-
type:
|
|
5136
|
-
id:
|
|
5137
|
-
call_id:
|
|
5138
|
-
status:
|
|
5486
|
+
var openaiResponsesComputerCallSchema = z21.object({
|
|
5487
|
+
type: z21.literal("computer_call"),
|
|
5488
|
+
id: z21.string(),
|
|
5489
|
+
call_id: z21.string().nullish(),
|
|
5490
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
5139
5491
|
action: openaiResponsesComputerActionSchema.nullish(),
|
|
5140
|
-
actions:
|
|
5141
|
-
pending_safety_checks:
|
|
5492
|
+
actions: z21.array(openaiResponsesComputerActionSchema).nullish(),
|
|
5493
|
+
pending_safety_checks: z21.array(openaiResponsesComputerSafetyCheckSchema).nullish()
|
|
5142
5494
|
});
|
|
5143
|
-
var openaiResponsesToolCallerSchema =
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
type:
|
|
5147
|
-
caller_id:
|
|
5495
|
+
var openaiResponsesToolCallerSchema = z21.discriminatedUnion("type", [
|
|
5496
|
+
z21.object({ type: z21.literal("direct") }),
|
|
5497
|
+
z21.object({
|
|
5498
|
+
type: z21.literal("program"),
|
|
5499
|
+
caller_id: z21.string()
|
|
5148
5500
|
})
|
|
5149
5501
|
]);
|
|
5150
|
-
var openaiResponsesProgramSchema =
|
|
5151
|
-
type:
|
|
5152
|
-
id:
|
|
5153
|
-
call_id:
|
|
5154
|
-
code:
|
|
5155
|
-
fingerprint:
|
|
5502
|
+
var openaiResponsesProgramSchema = z21.object({
|
|
5503
|
+
type: z21.literal("program"),
|
|
5504
|
+
id: z21.string(),
|
|
5505
|
+
call_id: z21.string(),
|
|
5506
|
+
code: z21.string(),
|
|
5507
|
+
fingerprint: z21.string()
|
|
5156
5508
|
});
|
|
5157
|
-
var openaiResponsesProgramOutputSchema =
|
|
5158
|
-
type:
|
|
5159
|
-
id:
|
|
5160
|
-
call_id:
|
|
5161
|
-
result:
|
|
5162
|
-
status:
|
|
5509
|
+
var openaiResponsesProgramOutputSchema = z21.object({
|
|
5510
|
+
type: z21.literal("program_output"),
|
|
5511
|
+
id: z21.string(),
|
|
5512
|
+
call_id: z21.string(),
|
|
5513
|
+
result: z21.string(),
|
|
5514
|
+
status: z21.enum(["completed", "incomplete"])
|
|
5163
5515
|
});
|
|
5164
|
-
var openaiResponsesLocalShellCallSchema =
|
|
5165
|
-
type:
|
|
5166
|
-
id:
|
|
5167
|
-
call_id:
|
|
5168
|
-
action:
|
|
5169
|
-
type:
|
|
5170
|
-
command:
|
|
5171
|
-
timeout_ms:
|
|
5172
|
-
user:
|
|
5173
|
-
working_directory:
|
|
5174
|
-
env:
|
|
5516
|
+
var openaiResponsesLocalShellCallSchema = z21.object({
|
|
5517
|
+
type: z21.literal("local_shell_call"),
|
|
5518
|
+
id: z21.string(),
|
|
5519
|
+
call_id: z21.string(),
|
|
5520
|
+
action: z21.object({
|
|
5521
|
+
type: z21.literal("exec"),
|
|
5522
|
+
command: z21.array(z21.string()),
|
|
5523
|
+
timeout_ms: z21.number().optional(),
|
|
5524
|
+
user: z21.string().optional(),
|
|
5525
|
+
working_directory: z21.string().optional(),
|
|
5526
|
+
env: z21.record(z21.string(), z21.string()).optional()
|
|
5175
5527
|
})
|
|
5176
5528
|
});
|
|
5177
|
-
var openaiResponsesNestedErrorChunkSchema =
|
|
5178
|
-
type:
|
|
5179
|
-
sequence_number:
|
|
5180
|
-
error:
|
|
5181
|
-
type:
|
|
5182
|
-
code:
|
|
5183
|
-
message:
|
|
5184
|
-
param:
|
|
5529
|
+
var openaiResponsesNestedErrorChunkSchema = z21.object({
|
|
5530
|
+
type: z21.literal("error"),
|
|
5531
|
+
sequence_number: z21.number(),
|
|
5532
|
+
error: z21.object({
|
|
5533
|
+
type: z21.string(),
|
|
5534
|
+
code: z21.string().nullish(),
|
|
5535
|
+
message: z21.string(),
|
|
5536
|
+
param: z21.string().nullish()
|
|
5185
5537
|
})
|
|
5186
5538
|
});
|
|
5187
|
-
var openaiResponsesErrorChunkSchema =
|
|
5188
|
-
type:
|
|
5189
|
-
sequence_number:
|
|
5190
|
-
code:
|
|
5191
|
-
message:
|
|
5192
|
-
param:
|
|
5539
|
+
var openaiResponsesErrorChunkSchema = z21.object({
|
|
5540
|
+
type: z21.literal("error"),
|
|
5541
|
+
sequence_number: z21.number(),
|
|
5542
|
+
code: z21.string().nullish(),
|
|
5543
|
+
message: z21.string(),
|
|
5544
|
+
param: z21.string().nullish()
|
|
5193
5545
|
});
|
|
5194
5546
|
var openaiResponsesModeledChunkTypes = /* @__PURE__ */ new Set([
|
|
5195
5547
|
"error",
|
|
@@ -5223,1178 +5575,870 @@ var openaiResponsesModeledOutputItemTypes = /* @__PURE__ */ new Set([
|
|
|
5223
5575
|
"file_search_call",
|
|
5224
5576
|
"function_call",
|
|
5225
5577
|
"image_generation_call",
|
|
5226
|
-
"local_shell_call",
|
|
5227
|
-
"mcp_approval_request",
|
|
5228
|
-
"mcp_call",
|
|
5229
|
-
"mcp_list_tools",
|
|
5230
|
-
"message",
|
|
5231
|
-
"program",
|
|
5232
|
-
"program_output",
|
|
5233
|
-
"reasoning",
|
|
5234
|
-
"shell_call",
|
|
5235
|
-
"shell_call_output",
|
|
5236
|
-
"tool_search_call",
|
|
5237
|
-
"tool_search_output",
|
|
5238
|
-
"web_search_call"
|
|
5239
|
-
]);
|
|
5240
|
-
function isModeledOpenAIResponsesChunk(value) {
|
|
5241
|
-
if (typeof value.type !== "string" || !openaiResponsesModeledChunkTypes.has(value.type)) {
|
|
5242
|
-
return false;
|
|
5243
|
-
}
|
|
5244
|
-
if (value.type !== "response.output_item.added" && value.type !== "response.output_item.done") {
|
|
5245
|
-
return true;
|
|
5246
|
-
}
|
|
5247
|
-
if (!isRecord(value.item) || typeof value.item.type !== "string") {
|
|
5248
|
-
return true;
|
|
5249
|
-
}
|
|
5250
|
-
return openaiResponsesModeledOutputItemTypes.has(value.item.type);
|
|
5251
|
-
}
|
|
5252
|
-
var openaiResponsesChunkSchema =
|
|
5253
|
-
() =>
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
type:
|
|
5257
|
-
item_id:
|
|
5258
|
-
output_index:
|
|
5259
|
-
delta:
|
|
5260
|
-
logprobs:
|
|
5261
|
-
|
|
5262
|
-
token:
|
|
5263
|
-
logprob:
|
|
5264
|
-
top_logprobs:
|
|
5265
|
-
|
|
5266
|
-
token:
|
|
5267
|
-
logprob:
|
|
5268
|
-
})
|
|
5269
|
-
)
|
|
5270
|
-
})
|
|
5271
|
-
).nullish()
|
|
5272
|
-
}),
|
|
5273
|
-
|
|
5274
|
-
type:
|
|
5275
|
-
response:
|
|
5276
|
-
incomplete_details:
|
|
5277
|
-
usage: openaiResponsesUsageSchema.nullish(),
|
|
5278
|
-
reasoning:
|
|
5279
|
-
context:
|
|
5280
|
-
}).nullish(),
|
|
5281
|
-
service_tier:
|
|
5282
|
-
})
|
|
5283
|
-
}),
|
|
5284
|
-
z20.object({
|
|
5285
|
-
type: z20.literal("response.failed"),
|
|
5286
|
-
sequence_number: z20.number(),
|
|
5287
|
-
response: z20.object({
|
|
5288
|
-
error: z20.object({
|
|
5289
|
-
code: z20.string().nullish(),
|
|
5290
|
-
message: z20.string()
|
|
5291
|
-
}).nullish(),
|
|
5292
|
-
incomplete_details: z20.object({ reason: z20.string() }).nullish(),
|
|
5293
|
-
usage: openaiResponsesUsageSchema.nullish(),
|
|
5294
|
-
reasoning: z20.object({
|
|
5295
|
-
context: z20.string().nullish()
|
|
5296
|
-
}).nullish(),
|
|
5297
|
-
service_tier: z20.string().nullish()
|
|
5298
|
-
})
|
|
5299
|
-
}),
|
|
5300
|
-
z20.object({
|
|
5301
|
-
type: z20.literal("response.created"),
|
|
5302
|
-
response: z20.object({
|
|
5303
|
-
id: z20.string(),
|
|
5304
|
-
created_at: z20.number(),
|
|
5305
|
-
model: z20.string(),
|
|
5306
|
-
service_tier: z20.string().nullish()
|
|
5307
|
-
})
|
|
5308
|
-
}),
|
|
5309
|
-
z20.object({
|
|
5310
|
-
type: z20.literal("response.in_progress"),
|
|
5311
|
-
response: z20.object({
|
|
5312
|
-
id: z20.string(),
|
|
5313
|
-
created_at: z20.number(),
|
|
5314
|
-
model: z20.string(),
|
|
5315
|
-
service_tier: z20.string().nullish()
|
|
5316
|
-
})
|
|
5317
|
-
}),
|
|
5318
|
-
z20.object({
|
|
5319
|
-
type: z20.literal("response.output_item.added"),
|
|
5320
|
-
output_index: z20.number(),
|
|
5321
|
-
item: z20.discriminatedUnion("type", [
|
|
5322
|
-
z20.object({
|
|
5323
|
-
type: z20.literal("message"),
|
|
5324
|
-
id: z20.string(),
|
|
5325
|
-
phase: z20.enum(["commentary", "final_answer"]).nullish()
|
|
5326
|
-
}),
|
|
5327
|
-
z20.object({
|
|
5328
|
-
type: z20.literal("reasoning"),
|
|
5329
|
-
id: z20.string(),
|
|
5330
|
-
encrypted_content: z20.string().nullish()
|
|
5331
|
-
}),
|
|
5332
|
-
z20.object({
|
|
5333
|
-
type: z20.literal("function_call"),
|
|
5334
|
-
id: z20.string(),
|
|
5335
|
-
call_id: z20.string(),
|
|
5336
|
-
name: z20.string(),
|
|
5337
|
-
arguments: z20.string(),
|
|
5338
|
-
async: z20.boolean().nullish(),
|
|
5339
|
-
namespace: z20.string().nullish(),
|
|
5340
|
-
caller: openaiResponsesToolCallerSchema.nullish()
|
|
5341
|
-
}),
|
|
5342
|
-
openaiResponsesProgramSchema,
|
|
5343
|
-
openaiResponsesProgramOutputSchema,
|
|
5344
|
-
z20.object({
|
|
5345
|
-
type: z20.literal("web_search_call"),
|
|
5346
|
-
id: z20.string(),
|
|
5347
|
-
status: z20.string()
|
|
5348
|
-
}),
|
|
5349
|
-
openaiResponsesComputerCallSchema,
|
|
5350
|
-
z20.object({
|
|
5351
|
-
type: z20.literal("file_search_call"),
|
|
5352
|
-
id: z20.string()
|
|
5353
|
-
}),
|
|
5354
|
-
openaiResponsesLocalShellCallSchema,
|
|
5355
|
-
z20.object({
|
|
5356
|
-
type: z20.literal("image_generation_call"),
|
|
5357
|
-
id: z20.string()
|
|
5358
|
-
}),
|
|
5359
|
-
z20.object({
|
|
5360
|
-
type: z20.literal("code_interpreter_call"),
|
|
5361
|
-
id: z20.string(),
|
|
5362
|
-
container_id: z20.string(),
|
|
5363
|
-
code: z20.string().nullable(),
|
|
5364
|
-
outputs: z20.array(
|
|
5365
|
-
z20.discriminatedUnion("type", [
|
|
5366
|
-
z20.object({ type: z20.literal("logs"), logs: z20.string() }),
|
|
5367
|
-
z20.object({ type: z20.literal("image"), url: z20.string() })
|
|
5368
|
-
])
|
|
5369
|
-
).nullable(),
|
|
5370
|
-
status: z20.string()
|
|
5371
|
-
}),
|
|
5372
|
-
z20.object({
|
|
5373
|
-
type: z20.literal("mcp_call"),
|
|
5374
|
-
id: z20.string(),
|
|
5375
|
-
status: z20.string(),
|
|
5376
|
-
approval_request_id: z20.string().nullish()
|
|
5377
|
-
}),
|
|
5378
|
-
z20.object({
|
|
5379
|
-
type: z20.literal("mcp_list_tools"),
|
|
5380
|
-
id: z20.string()
|
|
5381
|
-
}),
|
|
5382
|
-
z20.object({
|
|
5383
|
-
type: z20.literal("mcp_approval_request"),
|
|
5384
|
-
id: z20.string()
|
|
5385
|
-
}),
|
|
5386
|
-
z20.object({
|
|
5387
|
-
type: z20.literal("apply_patch_call"),
|
|
5388
|
-
id: z20.string(),
|
|
5389
|
-
call_id: z20.string(),
|
|
5390
|
-
status: z20.enum(["in_progress", "completed"]),
|
|
5391
|
-
operation: z20.discriminatedUnion("type", [
|
|
5392
|
-
z20.object({
|
|
5393
|
-
type: z20.literal("create_file"),
|
|
5394
|
-
path: z20.string(),
|
|
5395
|
-
diff: z20.string()
|
|
5396
|
-
}),
|
|
5397
|
-
z20.object({
|
|
5398
|
-
type: z20.literal("delete_file"),
|
|
5399
|
-
path: z20.string()
|
|
5400
|
-
}),
|
|
5401
|
-
z20.object({
|
|
5402
|
-
type: z20.literal("update_file"),
|
|
5403
|
-
path: z20.string(),
|
|
5404
|
-
diff: z20.string()
|
|
5405
|
-
})
|
|
5406
|
-
])
|
|
5407
|
-
}),
|
|
5408
|
-
z20.object({
|
|
5409
|
-
type: z20.literal("custom_tool_call"),
|
|
5410
|
-
id: z20.string(),
|
|
5411
|
-
call_id: z20.string(),
|
|
5412
|
-
name: z20.string(),
|
|
5413
|
-
input: z20.string(),
|
|
5414
|
-
async: z20.boolean().nullish()
|
|
5415
|
-
}),
|
|
5416
|
-
z20.object({
|
|
5417
|
-
type: z20.literal("shell_call"),
|
|
5418
|
-
id: z20.string(),
|
|
5419
|
-
call_id: z20.string(),
|
|
5420
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
5421
|
-
action: z20.object({
|
|
5422
|
-
commands: z20.array(z20.string())
|
|
5423
|
-
})
|
|
5424
|
-
}),
|
|
5425
|
-
z20.object({
|
|
5426
|
-
type: z20.literal("compaction"),
|
|
5427
|
-
id: z20.string(),
|
|
5428
|
-
encrypted_content: z20.string().nullish()
|
|
5429
|
-
}),
|
|
5430
|
-
z20.object({
|
|
5431
|
-
type: z20.literal("shell_call_output"),
|
|
5432
|
-
id: z20.string(),
|
|
5433
|
-
call_id: z20.string(),
|
|
5434
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
5435
|
-
output: z20.array(
|
|
5436
|
-
z20.object({
|
|
5437
|
-
stdout: z20.string(),
|
|
5438
|
-
stderr: z20.string(),
|
|
5439
|
-
outcome: z20.discriminatedUnion("type", [
|
|
5440
|
-
z20.object({ type: z20.literal("timeout") }),
|
|
5441
|
-
z20.object({
|
|
5442
|
-
type: z20.literal("exit"),
|
|
5443
|
-
exit_code: z20.number()
|
|
5444
|
-
})
|
|
5445
|
-
])
|
|
5446
|
-
})
|
|
5447
|
-
)
|
|
5448
|
-
}),
|
|
5449
|
-
z20.object({
|
|
5450
|
-
type: z20.literal("tool_search_call"),
|
|
5451
|
-
id: z20.string(),
|
|
5452
|
-
execution: z20.enum(["server", "client"]),
|
|
5453
|
-
call_id: z20.string().nullable(),
|
|
5454
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
5455
|
-
arguments: z20.unknown()
|
|
5456
|
-
}),
|
|
5457
|
-
z20.object({
|
|
5458
|
-
type: z20.literal("tool_search_output"),
|
|
5459
|
-
id: z20.string(),
|
|
5460
|
-
execution: z20.enum(["server", "client"]),
|
|
5461
|
-
call_id: z20.string().nullable(),
|
|
5462
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
5463
|
-
tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
|
|
5464
|
-
})
|
|
5465
|
-
])
|
|
5466
|
-
}),
|
|
5467
|
-
z20.object({
|
|
5468
|
-
type: z20.literal("response.output_item.done"),
|
|
5469
|
-
output_index: z20.number(),
|
|
5470
|
-
item: z20.discriminatedUnion("type", [
|
|
5471
|
-
z20.object({
|
|
5472
|
-
type: z20.literal("message"),
|
|
5473
|
-
id: z20.string(),
|
|
5474
|
-
phase: z20.enum(["commentary", "final_answer"]).nullish()
|
|
5475
|
-
}),
|
|
5476
|
-
z20.object({
|
|
5477
|
-
type: z20.literal("reasoning"),
|
|
5478
|
-
id: z20.string(),
|
|
5479
|
-
encrypted_content: z20.string().nullish()
|
|
5480
|
-
}),
|
|
5481
|
-
z20.object({
|
|
5482
|
-
type: z20.literal("function_call"),
|
|
5483
|
-
id: z20.string(),
|
|
5484
|
-
call_id: z20.string(),
|
|
5485
|
-
name: z20.string(),
|
|
5486
|
-
arguments: z20.string(),
|
|
5487
|
-
async: z20.boolean().nullish(),
|
|
5488
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
5489
|
-
namespace: z20.string().nullish(),
|
|
5490
|
-
caller: openaiResponsesToolCallerSchema.nullish()
|
|
5491
|
-
}),
|
|
5492
|
-
openaiResponsesProgramSchema,
|
|
5493
|
-
openaiResponsesProgramOutputSchema,
|
|
5494
|
-
z20.object({
|
|
5495
|
-
type: z20.literal("custom_tool_call"),
|
|
5496
|
-
id: z20.string(),
|
|
5497
|
-
call_id: z20.string(),
|
|
5498
|
-
name: z20.string(),
|
|
5499
|
-
input: z20.string(),
|
|
5500
|
-
async: z20.boolean().nullish(),
|
|
5501
|
-
status: z20.literal("completed")
|
|
5502
|
-
}),
|
|
5503
|
-
z20.object({
|
|
5504
|
-
type: z20.literal("code_interpreter_call"),
|
|
5505
|
-
id: z20.string(),
|
|
5506
|
-
code: z20.string().nullable(),
|
|
5507
|
-
container_id: z20.string(),
|
|
5508
|
-
outputs: z20.array(
|
|
5509
|
-
z20.discriminatedUnion("type", [
|
|
5510
|
-
z20.object({ type: z20.literal("logs"), logs: z20.string() }),
|
|
5511
|
-
z20.object({ type: z20.literal("image"), url: z20.string() })
|
|
5512
|
-
])
|
|
5513
|
-
).nullable()
|
|
5514
|
-
}),
|
|
5515
|
-
z20.object({
|
|
5516
|
-
type: z20.literal("image_generation_call"),
|
|
5517
|
-
id: z20.string(),
|
|
5518
|
-
result: z20.string()
|
|
5519
|
-
}),
|
|
5520
|
-
z20.object({
|
|
5521
|
-
type: z20.literal("web_search_call"),
|
|
5522
|
-
id: z20.string(),
|
|
5523
|
-
status: z20.string(),
|
|
5524
|
-
action: z20.discriminatedUnion("type", [
|
|
5525
|
-
z20.object({
|
|
5526
|
-
type: z20.literal("search"),
|
|
5527
|
-
query: z20.string().nullish(),
|
|
5528
|
-
queries: z20.array(z20.string()).nullish(),
|
|
5529
|
-
sources: z20.array(
|
|
5530
|
-
z20.discriminatedUnion("type", [
|
|
5531
|
-
z20.object({ type: z20.literal("url"), url: z20.string() }),
|
|
5532
|
-
z20.object({ type: z20.literal("api"), name: z20.string() })
|
|
5533
|
-
])
|
|
5534
|
-
).nullish()
|
|
5535
|
-
}),
|
|
5536
|
-
z20.object({
|
|
5537
|
-
type: z20.literal("open_page"),
|
|
5538
|
-
url: z20.string().nullish()
|
|
5539
|
-
}),
|
|
5540
|
-
z20.object({
|
|
5541
|
-
type: z20.literal("find_in_page"),
|
|
5542
|
-
url: z20.string().nullish(),
|
|
5543
|
-
pattern: z20.string().nullish()
|
|
5544
|
-
})
|
|
5545
|
-
]).nullish()
|
|
5546
|
-
}),
|
|
5547
|
-
z20.object({
|
|
5548
|
-
type: z20.literal("file_search_call"),
|
|
5549
|
-
id: z20.string(),
|
|
5550
|
-
queries: z20.array(z20.string()),
|
|
5551
|
-
results: z20.array(
|
|
5552
|
-
z20.object({
|
|
5553
|
-
attributes: z20.record(
|
|
5554
|
-
z20.string(),
|
|
5555
|
-
z20.union([z20.string(), z20.number(), z20.boolean()])
|
|
5556
|
-
),
|
|
5557
|
-
file_id: z20.string(),
|
|
5558
|
-
filename: z20.string(),
|
|
5559
|
-
score: z20.number(),
|
|
5560
|
-
text: z20.string()
|
|
5561
|
-
})
|
|
5562
|
-
).nullish()
|
|
5563
|
-
}),
|
|
5564
|
-
openaiResponsesLocalShellCallSchema,
|
|
5565
|
-
openaiResponsesComputerCallSchema,
|
|
5566
|
-
z20.object({
|
|
5567
|
-
type: z20.literal("mcp_call"),
|
|
5568
|
-
id: z20.string(),
|
|
5569
|
-
status: z20.string(),
|
|
5570
|
-
arguments: z20.string(),
|
|
5571
|
-
name: z20.string(),
|
|
5572
|
-
server_label: z20.string(),
|
|
5573
|
-
output: z20.string().nullish(),
|
|
5574
|
-
error: z20.union([
|
|
5575
|
-
z20.string(),
|
|
5576
|
-
z20.object({
|
|
5577
|
-
type: z20.string().optional(),
|
|
5578
|
-
code: z20.union([z20.number(), z20.string()]).optional(),
|
|
5579
|
-
message: z20.string().optional()
|
|
5580
|
-
}).loose()
|
|
5581
|
-
]).nullish(),
|
|
5582
|
-
approval_request_id: z20.string().nullish()
|
|
5583
|
-
}),
|
|
5584
|
-
z20.object({
|
|
5585
|
-
type: z20.literal("mcp_list_tools"),
|
|
5586
|
-
id: z20.string(),
|
|
5587
|
-
server_label: z20.string(),
|
|
5588
|
-
tools: z20.array(
|
|
5589
|
-
z20.object({
|
|
5590
|
-
name: z20.string(),
|
|
5591
|
-
description: z20.string().optional(),
|
|
5592
|
-
input_schema: z20.any(),
|
|
5593
|
-
annotations: z20.record(z20.string(), z20.unknown()).optional()
|
|
5594
|
-
})
|
|
5595
|
-
),
|
|
5596
|
-
error: z20.union([
|
|
5597
|
-
z20.string(),
|
|
5598
|
-
z20.object({
|
|
5599
|
-
type: z20.string().optional(),
|
|
5600
|
-
code: z20.union([z20.number(), z20.string()]).optional(),
|
|
5601
|
-
message: z20.string().optional()
|
|
5602
|
-
}).loose()
|
|
5603
|
-
]).optional()
|
|
5604
|
-
}),
|
|
5605
|
-
z20.object({
|
|
5606
|
-
type: z20.literal("mcp_approval_request"),
|
|
5607
|
-
id: z20.string(),
|
|
5608
|
-
server_label: z20.string(),
|
|
5609
|
-
name: z20.string(),
|
|
5610
|
-
arguments: z20.string(),
|
|
5611
|
-
approval_request_id: z20.string().optional()
|
|
5612
|
-
}),
|
|
5613
|
-
z20.object({
|
|
5614
|
-
type: z20.literal("apply_patch_call"),
|
|
5615
|
-
id: z20.string(),
|
|
5616
|
-
call_id: z20.string(),
|
|
5617
|
-
status: z20.enum(["in_progress", "completed"]),
|
|
5618
|
-
operation: z20.discriminatedUnion("type", [
|
|
5619
|
-
z20.object({
|
|
5620
|
-
type: z20.literal("create_file"),
|
|
5621
|
-
path: z20.string(),
|
|
5622
|
-
diff: z20.string()
|
|
5623
|
-
}),
|
|
5624
|
-
z20.object({
|
|
5625
|
-
type: z20.literal("delete_file"),
|
|
5626
|
-
path: z20.string()
|
|
5627
|
-
}),
|
|
5628
|
-
z20.object({
|
|
5629
|
-
type: z20.literal("update_file"),
|
|
5630
|
-
path: z20.string(),
|
|
5631
|
-
diff: z20.string()
|
|
5632
|
-
})
|
|
5633
|
-
])
|
|
5634
|
-
}),
|
|
5635
|
-
z20.object({
|
|
5636
|
-
type: z20.literal("shell_call"),
|
|
5637
|
-
id: z20.string(),
|
|
5638
|
-
call_id: z20.string(),
|
|
5639
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
5640
|
-
action: z20.object({
|
|
5641
|
-
commands: z20.array(z20.string())
|
|
5642
|
-
})
|
|
5643
|
-
}),
|
|
5644
|
-
z20.object({
|
|
5645
|
-
type: z20.literal("compaction"),
|
|
5646
|
-
id: z20.string(),
|
|
5647
|
-
encrypted_content: z20.string()
|
|
5648
|
-
}),
|
|
5649
|
-
z20.object({
|
|
5650
|
-
type: z20.literal("shell_call_output"),
|
|
5651
|
-
id: z20.string(),
|
|
5652
|
-
call_id: z20.string(),
|
|
5653
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
5654
|
-
output: z20.array(
|
|
5655
|
-
z20.object({
|
|
5656
|
-
stdout: z20.string(),
|
|
5657
|
-
stderr: z20.string(),
|
|
5658
|
-
outcome: z20.discriminatedUnion("type", [
|
|
5659
|
-
z20.object({ type: z20.literal("timeout") }),
|
|
5660
|
-
z20.object({
|
|
5661
|
-
type: z20.literal("exit"),
|
|
5662
|
-
exit_code: z20.number()
|
|
5663
|
-
})
|
|
5664
|
-
])
|
|
5665
|
-
})
|
|
5666
|
-
)
|
|
5667
|
-
}),
|
|
5668
|
-
z20.object({
|
|
5669
|
-
type: z20.literal("tool_search_call"),
|
|
5670
|
-
id: z20.string(),
|
|
5671
|
-
execution: z20.enum(["server", "client"]),
|
|
5672
|
-
call_id: z20.string().nullable(),
|
|
5673
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
5674
|
-
arguments: z20.unknown()
|
|
5675
|
-
}),
|
|
5676
|
-
z20.object({
|
|
5677
|
-
type: z20.literal("tool_search_output"),
|
|
5678
|
-
id: z20.string(),
|
|
5679
|
-
execution: z20.enum(["server", "client"]),
|
|
5680
|
-
call_id: z20.string().nullable(),
|
|
5681
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
5682
|
-
tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
|
|
5683
|
-
})
|
|
5684
|
-
])
|
|
5685
|
-
}),
|
|
5686
|
-
z20.object({
|
|
5687
|
-
type: z20.literal("response.function_call_arguments.delta"),
|
|
5688
|
-
item_id: z20.string(),
|
|
5689
|
-
output_index: z20.number(),
|
|
5690
|
-
delta: z20.string()
|
|
5691
|
-
}),
|
|
5692
|
-
z20.object({
|
|
5693
|
-
// `name` is documented as required but omitted from live API events:
|
|
5694
|
-
// https://github.com/openai/openai-openapi/issues/545
|
|
5695
|
-
type: z20.literal("response.function_call_arguments.done"),
|
|
5696
|
-
item_id: z20.string(),
|
|
5697
|
-
output_index: z20.number(),
|
|
5698
|
-
arguments: z20.string()
|
|
5699
|
-
}),
|
|
5700
|
-
z20.object({
|
|
5701
|
-
type: z20.literal("response.custom_tool_call_input.delta"),
|
|
5702
|
-
item_id: z20.string(),
|
|
5703
|
-
output_index: z20.number(),
|
|
5704
|
-
delta: z20.string()
|
|
5705
|
-
}),
|
|
5706
|
-
z20.object({
|
|
5707
|
-
type: z20.literal("response.image_generation_call.partial_image"),
|
|
5708
|
-
item_id: z20.string(),
|
|
5709
|
-
output_index: z20.number(),
|
|
5710
|
-
partial_image_b64: z20.string()
|
|
5711
|
-
}),
|
|
5712
|
-
z20.object({
|
|
5713
|
-
type: z20.literal("response.code_interpreter_call_code.delta"),
|
|
5714
|
-
item_id: z20.string(),
|
|
5715
|
-
output_index: z20.number(),
|
|
5716
|
-
delta: z20.string()
|
|
5717
|
-
}),
|
|
5718
|
-
z20.object({
|
|
5719
|
-
type: z20.literal("response.code_interpreter_call_code.done"),
|
|
5720
|
-
item_id: z20.string(),
|
|
5721
|
-
output_index: z20.number(),
|
|
5722
|
-
code: z20.string()
|
|
5723
|
-
}),
|
|
5724
|
-
z20.object({
|
|
5725
|
-
type: z20.literal("response.output_text.annotation.added"),
|
|
5726
|
-
annotation: z20.discriminatedUnion("type", [
|
|
5727
|
-
z20.object({
|
|
5728
|
-
type: z20.literal("url_citation"),
|
|
5729
|
-
start_index: z20.number(),
|
|
5730
|
-
end_index: z20.number(),
|
|
5731
|
-
url: z20.string(),
|
|
5732
|
-
title: z20.string()
|
|
5733
|
-
}),
|
|
5734
|
-
z20.object({
|
|
5735
|
-
type: z20.literal("file_citation"),
|
|
5736
|
-
file_id: z20.string(),
|
|
5737
|
-
filename: z20.string(),
|
|
5738
|
-
index: z20.number()
|
|
5739
|
-
}),
|
|
5740
|
-
z20.object({
|
|
5741
|
-
type: z20.literal("container_file_citation"),
|
|
5742
|
-
container_id: z20.string(),
|
|
5743
|
-
file_id: z20.string(),
|
|
5744
|
-
filename: z20.string(),
|
|
5745
|
-
start_index: z20.number(),
|
|
5746
|
-
end_index: z20.number()
|
|
5747
|
-
}),
|
|
5748
|
-
z20.object({
|
|
5749
|
-
type: z20.literal("file_path"),
|
|
5750
|
-
file_id: z20.string(),
|
|
5751
|
-
index: z20.number()
|
|
5752
|
-
})
|
|
5753
|
-
])
|
|
5754
|
-
}),
|
|
5755
|
-
z20.object({
|
|
5756
|
-
type: z20.literal("response.reasoning_summary_part.added"),
|
|
5757
|
-
item_id: z20.string(),
|
|
5758
|
-
output_index: z20.number().nullish(),
|
|
5759
|
-
summary_index: z20.number()
|
|
5760
|
-
}),
|
|
5761
|
-
z20.object({
|
|
5762
|
-
type: z20.literal("response.reasoning_summary_text.delta"),
|
|
5763
|
-
item_id: z20.string(),
|
|
5764
|
-
output_index: z20.number().nullish(),
|
|
5765
|
-
summary_index: z20.number(),
|
|
5766
|
-
delta: z20.string()
|
|
5767
|
-
}),
|
|
5768
|
-
z20.object({
|
|
5769
|
-
type: z20.literal("response.reasoning_summary_part.done"),
|
|
5770
|
-
item_id: z20.string(),
|
|
5771
|
-
output_index: z20.number().nullish(),
|
|
5772
|
-
summary_index: z20.number()
|
|
5773
|
-
}),
|
|
5774
|
-
z20.object({
|
|
5775
|
-
type: z20.literal("response.apply_patch_call_operation_diff.delta"),
|
|
5776
|
-
item_id: z20.string(),
|
|
5777
|
-
output_index: z20.number(),
|
|
5778
|
-
delta: z20.string(),
|
|
5779
|
-
obfuscation: z20.string().nullish()
|
|
5780
|
-
}),
|
|
5781
|
-
z20.object({
|
|
5782
|
-
type: z20.literal("response.apply_patch_call_operation_diff.done"),
|
|
5783
|
-
item_id: z20.string(),
|
|
5784
|
-
output_index: z20.number(),
|
|
5785
|
-
diff: z20.string()
|
|
5786
|
-
}),
|
|
5787
|
-
openaiResponsesNestedErrorChunkSchema,
|
|
5788
|
-
openaiResponsesErrorChunkSchema,
|
|
5789
|
-
z20.object({ type: z20.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
|
|
5790
|
-
message: "Known response chunk failed schema validation"
|
|
5791
|
-
}).transform((value) => ({
|
|
5792
|
-
type: "unknown_chunk",
|
|
5793
|
-
message: value.type
|
|
5794
|
-
}))
|
|
5795
|
-
// fallback for unknown chunks
|
|
5796
|
-
])
|
|
5797
|
-
)
|
|
5798
|
-
);
|
|
5799
|
-
var openaiResponsesResponseSchema = lazySchema18(
|
|
5800
|
-
() => zodSchema18(
|
|
5801
|
-
z20.object({
|
|
5802
|
-
id: z20.string().optional(),
|
|
5803
|
-
created_at: z20.number().optional(),
|
|
5804
|
-
error: z20.object({
|
|
5805
|
-
message: z20.string(),
|
|
5806
|
-
type: z20.string(),
|
|
5807
|
-
param: z20.string().nullish(),
|
|
5808
|
-
code: z20.string()
|
|
5809
|
-
}).nullish(),
|
|
5810
|
-
model: z20.string().optional(),
|
|
5811
|
-
output: z20.array(
|
|
5812
|
-
z20.discriminatedUnion("type", [
|
|
5813
|
-
z20.object({
|
|
5814
|
-
type: z20.literal("message"),
|
|
5815
|
-
role: z20.literal("assistant"),
|
|
5816
|
-
id: z20.string(),
|
|
5817
|
-
phase: z20.enum(["commentary", "final_answer"]).nullish(),
|
|
5818
|
-
content: z20.array(
|
|
5819
|
-
z20.object({
|
|
5820
|
-
type: z20.literal("output_text"),
|
|
5821
|
-
text: z20.string(),
|
|
5822
|
-
logprobs: z20.array(
|
|
5823
|
-
z20.object({
|
|
5824
|
-
token: z20.string(),
|
|
5825
|
-
logprob: z20.number(),
|
|
5826
|
-
top_logprobs: z20.array(
|
|
5827
|
-
z20.object({
|
|
5828
|
-
token: z20.string(),
|
|
5829
|
-
logprob: z20.number()
|
|
5830
|
-
})
|
|
5831
|
-
)
|
|
5832
|
-
})
|
|
5833
|
-
).nullish(),
|
|
5834
|
-
annotations: z20.array(
|
|
5835
|
-
z20.discriminatedUnion("type", [
|
|
5836
|
-
z20.object({
|
|
5837
|
-
type: z20.literal("url_citation"),
|
|
5838
|
-
start_index: z20.number(),
|
|
5839
|
-
end_index: z20.number(),
|
|
5840
|
-
url: z20.string(),
|
|
5841
|
-
title: z20.string()
|
|
5842
|
-
}),
|
|
5843
|
-
z20.object({
|
|
5844
|
-
type: z20.literal("file_citation"),
|
|
5845
|
-
file_id: z20.string(),
|
|
5846
|
-
filename: z20.string(),
|
|
5847
|
-
index: z20.number()
|
|
5848
|
-
}),
|
|
5849
|
-
z20.object({
|
|
5850
|
-
type: z20.literal("container_file_citation"),
|
|
5851
|
-
container_id: z20.string(),
|
|
5852
|
-
file_id: z20.string(),
|
|
5853
|
-
filename: z20.string(),
|
|
5854
|
-
start_index: z20.number(),
|
|
5855
|
-
end_index: z20.number()
|
|
5856
|
-
}),
|
|
5857
|
-
z20.object({
|
|
5858
|
-
type: z20.literal("file_path"),
|
|
5859
|
-
file_id: z20.string(),
|
|
5860
|
-
index: z20.number()
|
|
5861
|
-
})
|
|
5862
|
-
])
|
|
5863
|
-
)
|
|
5864
|
-
})
|
|
5865
|
-
)
|
|
5866
|
-
}),
|
|
5867
|
-
z20.object({
|
|
5868
|
-
type: z20.literal("web_search_call"),
|
|
5869
|
-
id: z20.string(),
|
|
5870
|
-
status: z20.string(),
|
|
5871
|
-
action: z20.discriminatedUnion("type", [
|
|
5872
|
-
z20.object({
|
|
5873
|
-
type: z20.literal("search"),
|
|
5874
|
-
query: z20.string().nullish(),
|
|
5875
|
-
queries: z20.array(z20.string()).nullish(),
|
|
5876
|
-
sources: z20.array(
|
|
5877
|
-
z20.discriminatedUnion("type", [
|
|
5878
|
-
z20.object({ type: z20.literal("url"), url: z20.string() }),
|
|
5879
|
-
z20.object({
|
|
5880
|
-
type: z20.literal("api"),
|
|
5881
|
-
name: z20.string()
|
|
5882
|
-
})
|
|
5883
|
-
])
|
|
5884
|
-
).nullish()
|
|
5885
|
-
}),
|
|
5886
|
-
z20.object({
|
|
5887
|
-
type: z20.literal("open_page"),
|
|
5888
|
-
url: z20.string().nullish()
|
|
5889
|
-
}),
|
|
5890
|
-
z20.object({
|
|
5891
|
-
type: z20.literal("find_in_page"),
|
|
5892
|
-
url: z20.string().nullish(),
|
|
5893
|
-
pattern: z20.string().nullish()
|
|
5894
|
-
})
|
|
5895
|
-
]).nullish()
|
|
5896
|
-
}),
|
|
5897
|
-
z20.object({
|
|
5898
|
-
type: z20.literal("file_search_call"),
|
|
5899
|
-
id: z20.string(),
|
|
5900
|
-
queries: z20.array(z20.string()),
|
|
5901
|
-
results: z20.array(
|
|
5902
|
-
z20.object({
|
|
5903
|
-
attributes: z20.record(
|
|
5904
|
-
z20.string(),
|
|
5905
|
-
z20.union([z20.string(), z20.number(), z20.boolean()])
|
|
5906
|
-
),
|
|
5907
|
-
file_id: z20.string(),
|
|
5908
|
-
filename: z20.string(),
|
|
5909
|
-
score: z20.number(),
|
|
5910
|
-
text: z20.string()
|
|
5911
|
-
})
|
|
5912
|
-
).nullish()
|
|
5913
|
-
}),
|
|
5914
|
-
z20.object({
|
|
5915
|
-
type: z20.literal("code_interpreter_call"),
|
|
5916
|
-
id: z20.string(),
|
|
5917
|
-
code: z20.string().nullable(),
|
|
5918
|
-
container_id: z20.string(),
|
|
5919
|
-
outputs: z20.array(
|
|
5920
|
-
z20.discriminatedUnion("type", [
|
|
5921
|
-
z20.object({ type: z20.literal("logs"), logs: z20.string() }),
|
|
5922
|
-
z20.object({ type: z20.literal("image"), url: z20.string() })
|
|
5923
|
-
])
|
|
5924
|
-
).nullable()
|
|
5925
|
-
}),
|
|
5926
|
-
z20.object({
|
|
5927
|
-
type: z20.literal("image_generation_call"),
|
|
5928
|
-
id: z20.string(),
|
|
5929
|
-
result: z20.string()
|
|
5930
|
-
}),
|
|
5931
|
-
openaiResponsesLocalShellCallSchema,
|
|
5932
|
-
z20.object({
|
|
5933
|
-
type: z20.literal("function_call"),
|
|
5934
|
-
call_id: z20.string(),
|
|
5935
|
-
name: z20.string(),
|
|
5936
|
-
arguments: z20.string(),
|
|
5937
|
-
id: z20.string(),
|
|
5938
|
-
async: z20.boolean().nullish(),
|
|
5939
|
-
namespace: z20.string().nullish(),
|
|
5940
|
-
caller: openaiResponsesToolCallerSchema.nullish()
|
|
5941
|
-
}),
|
|
5942
|
-
openaiResponsesProgramSchema,
|
|
5943
|
-
openaiResponsesProgramOutputSchema,
|
|
5944
|
-
z20.object({
|
|
5945
|
-
type: z20.literal("custom_tool_call"),
|
|
5946
|
-
call_id: z20.string(),
|
|
5947
|
-
name: z20.string(),
|
|
5948
|
-
input: z20.string(),
|
|
5949
|
-
id: z20.string(),
|
|
5950
|
-
async: z20.boolean().nullish()
|
|
5951
|
-
}),
|
|
5952
|
-
openaiResponsesComputerCallSchema,
|
|
5953
|
-
z20.object({
|
|
5954
|
-
type: z20.literal("reasoning"),
|
|
5955
|
-
id: z20.string(),
|
|
5956
|
-
encrypted_content: z20.string().nullish(),
|
|
5957
|
-
summary: z20.array(
|
|
5958
|
-
z20.object({
|
|
5959
|
-
type: z20.literal("summary_text"),
|
|
5960
|
-
text: z20.string()
|
|
5961
|
-
})
|
|
5962
|
-
)
|
|
5963
|
-
}),
|
|
5964
|
-
z20.object({
|
|
5965
|
-
type: z20.literal("mcp_call"),
|
|
5966
|
-
id: z20.string(),
|
|
5967
|
-
status: z20.string(),
|
|
5968
|
-
arguments: z20.string(),
|
|
5969
|
-
name: z20.string(),
|
|
5970
|
-
server_label: z20.string(),
|
|
5971
|
-
output: z20.string().nullish(),
|
|
5972
|
-
error: z20.union([
|
|
5973
|
-
z20.string(),
|
|
5974
|
-
z20.object({
|
|
5975
|
-
type: z20.string().optional(),
|
|
5976
|
-
code: z20.union([z20.number(), z20.string()]).optional(),
|
|
5977
|
-
message: z20.string().optional()
|
|
5978
|
-
}).loose()
|
|
5979
|
-
]).nullish(),
|
|
5980
|
-
approval_request_id: z20.string().nullish()
|
|
5981
|
-
}),
|
|
5982
|
-
z20.object({
|
|
5983
|
-
type: z20.literal("mcp_list_tools"),
|
|
5984
|
-
id: z20.string(),
|
|
5985
|
-
server_label: z20.string(),
|
|
5986
|
-
tools: z20.array(
|
|
5987
|
-
z20.object({
|
|
5988
|
-
name: z20.string(),
|
|
5989
|
-
description: z20.string().optional(),
|
|
5990
|
-
input_schema: z20.any(),
|
|
5991
|
-
annotations: z20.record(z20.string(), z20.unknown()).optional()
|
|
5992
|
-
})
|
|
5993
|
-
),
|
|
5994
|
-
error: z20.union([
|
|
5995
|
-
z20.string(),
|
|
5996
|
-
z20.object({
|
|
5997
|
-
type: z20.string().optional(),
|
|
5998
|
-
code: z20.union([z20.number(), z20.string()]).optional(),
|
|
5999
|
-
message: z20.string().optional()
|
|
6000
|
-
}).loose()
|
|
6001
|
-
]).optional()
|
|
6002
|
-
}),
|
|
6003
|
-
z20.object({
|
|
6004
|
-
type: z20.literal("mcp_approval_request"),
|
|
6005
|
-
id: z20.string(),
|
|
6006
|
-
server_label: z20.string(),
|
|
6007
|
-
name: z20.string(),
|
|
6008
|
-
arguments: z20.string(),
|
|
6009
|
-
approval_request_id: z20.string().optional()
|
|
6010
|
-
}),
|
|
6011
|
-
z20.object({
|
|
6012
|
-
type: z20.literal("apply_patch_call"),
|
|
6013
|
-
id: z20.string(),
|
|
6014
|
-
call_id: z20.string(),
|
|
6015
|
-
status: z20.enum(["in_progress", "completed"]),
|
|
6016
|
-
operation: z20.discriminatedUnion("type", [
|
|
6017
|
-
z20.object({
|
|
6018
|
-
type: z20.literal("create_file"),
|
|
6019
|
-
path: z20.string(),
|
|
6020
|
-
diff: z20.string()
|
|
6021
|
-
}),
|
|
6022
|
-
z20.object({
|
|
6023
|
-
type: z20.literal("delete_file"),
|
|
6024
|
-
path: z20.string()
|
|
6025
|
-
}),
|
|
6026
|
-
z20.object({
|
|
6027
|
-
type: z20.literal("update_file"),
|
|
6028
|
-
path: z20.string(),
|
|
6029
|
-
diff: z20.string()
|
|
6030
|
-
})
|
|
6031
|
-
])
|
|
6032
|
-
}),
|
|
6033
|
-
z20.object({
|
|
6034
|
-
type: z20.literal("shell_call"),
|
|
6035
|
-
id: z20.string(),
|
|
6036
|
-
call_id: z20.string(),
|
|
6037
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
6038
|
-
action: z20.object({
|
|
6039
|
-
commands: z20.array(z20.string())
|
|
6040
|
-
})
|
|
6041
|
-
}),
|
|
6042
|
-
z20.object({
|
|
6043
|
-
type: z20.literal("compaction"),
|
|
6044
|
-
id: z20.string(),
|
|
6045
|
-
encrypted_content: z20.string()
|
|
6046
|
-
}),
|
|
6047
|
-
z20.object({
|
|
6048
|
-
type: z20.literal("shell_call_output"),
|
|
6049
|
-
id: z20.string(),
|
|
6050
|
-
call_id: z20.string(),
|
|
6051
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
6052
|
-
output: z20.array(
|
|
6053
|
-
z20.object({
|
|
6054
|
-
stdout: z20.string(),
|
|
6055
|
-
stderr: z20.string(),
|
|
6056
|
-
outcome: z20.discriminatedUnion("type", [
|
|
6057
|
-
z20.object({ type: z20.literal("timeout") }),
|
|
6058
|
-
z20.object({
|
|
6059
|
-
type: z20.literal("exit"),
|
|
6060
|
-
exit_code: z20.number()
|
|
6061
|
-
})
|
|
6062
|
-
])
|
|
6063
|
-
})
|
|
6064
|
-
)
|
|
6065
|
-
}),
|
|
6066
|
-
z20.object({
|
|
6067
|
-
type: z20.literal("tool_search_call"),
|
|
6068
|
-
id: z20.string(),
|
|
6069
|
-
execution: z20.enum(["server", "client"]),
|
|
6070
|
-
call_id: z20.string().nullable(),
|
|
6071
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
6072
|
-
arguments: z20.unknown()
|
|
6073
|
-
}),
|
|
6074
|
-
z20.object({
|
|
6075
|
-
type: z20.literal("tool_search_output"),
|
|
6076
|
-
id: z20.string(),
|
|
6077
|
-
execution: z20.enum(["server", "client"]),
|
|
6078
|
-
call_id: z20.string().nullable(),
|
|
6079
|
-
status: z20.enum(["in_progress", "completed", "incomplete"]),
|
|
6080
|
-
tools: z20.array(z20.record(z20.string(), jsonValueSchema.optional()))
|
|
6081
|
-
})
|
|
6082
|
-
])
|
|
6083
|
-
).optional(),
|
|
6084
|
-
service_tier: z20.string().nullish(),
|
|
6085
|
-
reasoning: z20.object({
|
|
6086
|
-
context: z20.string().nullish()
|
|
6087
|
-
}).nullish(),
|
|
6088
|
-
incomplete_details: z20.object({ reason: z20.string() }).nullish(),
|
|
6089
|
-
usage: openaiResponsesUsageSchema.nullish()
|
|
6090
|
-
})
|
|
6091
|
-
)
|
|
6092
|
-
);
|
|
6093
|
-
|
|
6094
|
-
// src/responses/openai-responses-language-model-options.ts
|
|
6095
|
-
import {
|
|
6096
|
-
lazySchema as lazySchema19,
|
|
6097
|
-
zodSchema as zodSchema19
|
|
6098
|
-
} from "@ai-sdk/provider-utils";
|
|
6099
|
-
import { z as z21 } from "zod/v4";
|
|
6100
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
6101
|
-
var openaiResponsesReasoningModelIds = [
|
|
6102
|
-
"o1",
|
|
6103
|
-
"o1-2024-12-17",
|
|
6104
|
-
"o3",
|
|
6105
|
-
"o3-2025-04-16",
|
|
6106
|
-
"o3-mini",
|
|
6107
|
-
"o3-mini-2025-01-31",
|
|
6108
|
-
"o4-mini",
|
|
6109
|
-
"o4-mini-2025-04-16",
|
|
6110
|
-
"gpt-5",
|
|
6111
|
-
"gpt-5-2025-08-07",
|
|
6112
|
-
"gpt-5-codex",
|
|
6113
|
-
"gpt-5-mini",
|
|
6114
|
-
"gpt-5-mini-2025-08-07",
|
|
6115
|
-
"gpt-5-nano",
|
|
6116
|
-
"gpt-5-nano-2025-08-07",
|
|
6117
|
-
"gpt-5-pro",
|
|
6118
|
-
"gpt-5-pro-2025-10-06",
|
|
6119
|
-
"gpt-5.1",
|
|
6120
|
-
"gpt-5.1-chat-latest",
|
|
6121
|
-
"gpt-5.1-codex-mini",
|
|
6122
|
-
"gpt-5.1-codex",
|
|
6123
|
-
"gpt-5.1-codex-max",
|
|
6124
|
-
"gpt-5.2",
|
|
6125
|
-
"gpt-5.2-chat-latest",
|
|
6126
|
-
"gpt-5.2-pro",
|
|
6127
|
-
"gpt-5.2-codex",
|
|
6128
|
-
"gpt-5.3-chat-latest",
|
|
6129
|
-
"gpt-5.3-codex",
|
|
6130
|
-
"gpt-5.4",
|
|
6131
|
-
"gpt-5.4-2026-03-05",
|
|
6132
|
-
"gpt-5.4-mini",
|
|
6133
|
-
"gpt-5.4-mini-2026-03-17",
|
|
6134
|
-
"gpt-5.4-nano",
|
|
6135
|
-
"gpt-5.4-nano-2026-03-17",
|
|
6136
|
-
"gpt-5.4-pro",
|
|
6137
|
-
"gpt-5.4-pro-2026-03-05",
|
|
6138
|
-
"gpt-5.5",
|
|
6139
|
-
"gpt-5.5-2026-04-23",
|
|
6140
|
-
"gpt-5.6",
|
|
6141
|
-
"gpt-5.6-luna",
|
|
6142
|
-
"gpt-5.6-sol",
|
|
6143
|
-
"gpt-5.6-terra",
|
|
6144
|
-
"gpt-6-astra",
|
|
6145
|
-
"gpt-6-luna",
|
|
6146
|
-
"gpt-6-sol"
|
|
6147
|
-
];
|
|
6148
|
-
var openaiResponsesModelIds = [
|
|
6149
|
-
"gpt-4.1",
|
|
6150
|
-
"gpt-4.1-2025-04-14",
|
|
6151
|
-
"gpt-4.1-mini",
|
|
6152
|
-
"gpt-4.1-mini-2025-04-14",
|
|
6153
|
-
"gpt-4.1-nano",
|
|
6154
|
-
"gpt-4.1-nano-2025-04-14",
|
|
6155
|
-
"gpt-4o",
|
|
6156
|
-
"gpt-4o-2024-05-13",
|
|
6157
|
-
"gpt-4o-2024-08-06",
|
|
6158
|
-
"gpt-4o-2024-11-20",
|
|
6159
|
-
"gpt-4o-audio-preview",
|
|
6160
|
-
"gpt-4o-audio-preview-2024-12-17",
|
|
6161
|
-
"gpt-4o-search-preview",
|
|
6162
|
-
"gpt-4o-search-preview-2025-03-11",
|
|
6163
|
-
"gpt-4o-mini-search-preview",
|
|
6164
|
-
"gpt-4o-mini-search-preview-2025-03-11",
|
|
6165
|
-
"gpt-4o-mini",
|
|
6166
|
-
"gpt-4o-mini-2024-07-18",
|
|
6167
|
-
"gpt-3.5-turbo-0125",
|
|
6168
|
-
"gpt-3.5-turbo",
|
|
6169
|
-
"gpt-3.5-turbo-1106",
|
|
6170
|
-
"gpt-5-chat-latest",
|
|
6171
|
-
...openaiResponsesReasoningModelIds
|
|
6172
|
-
];
|
|
6173
|
-
var openaiLanguageModelResponsesOptionsSchema = lazySchema19(
|
|
6174
|
-
() => zodSchema19(
|
|
6175
|
-
z21.object({
|
|
6176
|
-
/**
|
|
6177
|
-
* The ID of the OpenAI Conversation to continue.
|
|
6178
|
-
* You must create a conversation first via the OpenAI API.
|
|
6179
|
-
* Cannot be used in conjunction with `previousResponseId`.
|
|
6180
|
-
* Defaults to `undefined`.
|
|
6181
|
-
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
6182
|
-
*/
|
|
6183
|
-
conversation: z21.string().nullish(),
|
|
6184
|
-
/**
|
|
6185
|
-
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
6186
|
-
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'web_search_call.results', 'message.output_text.logprobs'.
|
|
6187
|
-
*/
|
|
6188
|
-
include: z21.array(
|
|
6189
|
-
z21.enum([
|
|
6190
|
-
"reasoning.encrypted_content",
|
|
6191
|
-
// handled internally by default, only needed for unknown reasoning models
|
|
6192
|
-
"file_search_call.results",
|
|
6193
|
-
"web_search_call.results",
|
|
6194
|
-
"message.output_text.logprobs"
|
|
6195
|
-
])
|
|
6196
|
-
).nullish(),
|
|
6197
|
-
/**
|
|
6198
|
-
* Whether to automatically include web search action sources in the
|
|
6199
|
-
* response. Disable this for OpenAI-compatible providers that do not
|
|
6200
|
-
* support the `web_search_call.action.sources` include value.
|
|
6201
|
-
*
|
|
6202
|
-
* Defaults to `true`.
|
|
6203
|
-
*/
|
|
6204
|
-
includeWebSearchSources: z21.boolean().optional(),
|
|
6205
|
-
/**
|
|
6206
|
-
* Instructions for the model.
|
|
6207
|
-
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
6208
|
-
* Defaults to `undefined`.
|
|
6209
|
-
*/
|
|
6210
|
-
instructions: z21.string().nullish(),
|
|
6211
|
-
/**
|
|
6212
|
-
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
6213
|
-
* the response size and can slow down response times. However, it can
|
|
6214
|
-
* be useful to better understand how the model is behaving.
|
|
6215
|
-
*
|
|
6216
|
-
* Setting to true will return the log probabilities of the tokens that
|
|
6217
|
-
* were generated.
|
|
6218
|
-
*
|
|
6219
|
-
* Setting to a number will return the log probabilities of the top n
|
|
6220
|
-
* tokens that were generated.
|
|
6221
|
-
*
|
|
6222
|
-
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
6223
|
-
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
6224
|
-
*/
|
|
6225
|
-
logprobs: z21.union([z21.boolean(), z21.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
6226
|
-
/**
|
|
6227
|
-
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
6228
|
-
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
6229
|
-
* Any further attempts to call a tool by the model will be ignored.
|
|
6230
|
-
*/
|
|
6231
|
-
maxToolCalls: z21.number().nullish(),
|
|
6232
|
-
/**
|
|
6233
|
-
* Additional metadata to store with the generation.
|
|
6234
|
-
*/
|
|
6235
|
-
metadata: z21.any().nullish(),
|
|
6236
|
-
/**
|
|
6237
|
-
* Whether to use parallel tool calls. Defaults to `true`.
|
|
6238
|
-
*/
|
|
6239
|
-
parallelToolCalls: z21.boolean().nullish(),
|
|
6240
|
-
/**
|
|
6241
|
-
* The ID of the previous response. You can use it to continue a conversation.
|
|
6242
|
-
* Defaults to `undefined`.
|
|
6243
|
-
*/
|
|
6244
|
-
previousResponseId: z21.string().nullish(),
|
|
6245
|
-
/**
|
|
6246
|
-
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
6247
|
-
*/
|
|
6248
|
-
promptCacheKey: z21.string().nullish(),
|
|
6249
|
-
/**
|
|
6250
|
-
* Prompt cache behavior for GPT-5.6 and later models.
|
|
6251
|
-
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
6252
|
-
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
6253
|
-
*/
|
|
6254
|
-
promptCacheOptions: z21.object({
|
|
6255
|
-
mode: z21.enum(["implicit", "explicit"]).optional(),
|
|
6256
|
-
ttl: z21.literal("30m").optional()
|
|
6257
|
-
}).optional(),
|
|
6258
|
-
/**
|
|
6259
|
-
* The retention policy for the prompt cache.
|
|
6260
|
-
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
6261
|
-
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
6262
|
-
* Available for models before GPT-5.6 that support extended caching.
|
|
6263
|
-
*
|
|
6264
|
-
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
6265
|
-
*
|
|
6266
|
-
* @default 'in_memory'
|
|
6267
|
-
*/
|
|
6268
|
-
promptCacheRetention: z21.enum(["in_memory", "24h"]).nullish(),
|
|
6269
|
-
/**
|
|
6270
|
-
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
6271
|
-
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
6272
|
-
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
6273
|
-
* Supported values vary by model.
|
|
6274
|
-
*/
|
|
6275
|
-
reasoningEffort: z21.string().nullish(),
|
|
6276
|
-
/**
|
|
6277
|
-
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
6278
|
-
* without changing the request-level reasoning effort. This preserves the
|
|
6279
|
-
* request prefix for prompt caching.
|
|
6280
|
-
*
|
|
6281
|
-
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
6282
|
-
* combined with automatic compaction or automatic truncation.
|
|
6283
|
-
*/
|
|
6284
|
-
reasoningEffortUpdate: z21.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
6285
|
-
/**
|
|
6286
|
-
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
6287
|
-
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
6288
|
-
*/
|
|
6289
|
-
reasoningMode: z21.enum(["standard", "pro"]).optional(),
|
|
6290
|
-
/**
|
|
6291
|
-
* Controls which available reasoning items GPT-5.6 can use.
|
|
6292
|
-
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
6293
|
-
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
6294
|
-
*/
|
|
6295
|
-
reasoningContext: z21.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
6296
|
-
/**
|
|
6297
|
-
* Controls reasoning summary output from the model.
|
|
6298
|
-
* Set to "auto" to automatically receive the richest level available,
|
|
6299
|
-
* or "detailed" for comprehensive summaries.
|
|
6300
|
-
*/
|
|
6301
|
-
reasoningSummary: z21.string().nullish(),
|
|
6302
|
-
/**
|
|
6303
|
-
* The identifier for safety monitoring and tracking.
|
|
6304
|
-
*/
|
|
6305
|
-
safetyIdentifier: z21.string().nullish(),
|
|
6306
|
-
/**
|
|
6307
|
-
* Service tier for the request.
|
|
6308
|
-
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
6309
|
-
* Set to 'priority' for faster processing with Enterprise access (available for gpt-4, gpt-5, gpt-5-mini, o3, o4-mini; gpt-5-nano is not supported).
|
|
6310
|
-
* Set to 'fast' for the same tier as 'priority' (OpenAI's newer name for it).
|
|
6311
|
-
* Set to 'ultrafast' for access-controlled Ultrafast processing (available only for gpt-5.6-sol).
|
|
6312
|
-
*
|
|
6313
|
-
* Defaults to 'auto'.
|
|
6314
|
-
*/
|
|
6315
|
-
serviceTier: z21.enum(["auto", "flex", "priority", "fast", "ultrafast", "default"]).nullish(),
|
|
6316
|
-
/**
|
|
6317
|
-
* Whether to store the generation. Defaults to `true`.
|
|
6318
|
-
*/
|
|
6319
|
-
store: z21.boolean().nullish(),
|
|
6320
|
-
/**
|
|
6321
|
-
* Whether to pass through non-image file types as generic input files.
|
|
6322
|
-
*
|
|
6323
|
-
* By default, inline file inputs are restricted to images and PDFs.
|
|
6324
|
-
* Enable this when the target OpenAI Responses model supports additional
|
|
6325
|
-
* file media types, such as text/csv.
|
|
6326
|
-
*/
|
|
6327
|
-
passThroughUnsupportedFiles: z21.boolean().optional(),
|
|
6328
|
-
/**
|
|
6329
|
-
* Whether to use strict JSON schema validation.
|
|
6330
|
-
* Defaults to `true`.
|
|
6331
|
-
*/
|
|
6332
|
-
strictJsonSchema: z21.boolean().nullish(),
|
|
6333
|
-
/**
|
|
6334
|
-
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
6335
|
-
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
6336
|
-
* Valid values: 'low', 'medium', 'high'.
|
|
6337
|
-
*/
|
|
6338
|
-
textVerbosity: z21.enum(["low", "medium", "high"]).nullish(),
|
|
6339
|
-
/**
|
|
6340
|
-
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
6341
|
-
* 'disabled' turns truncation off.
|
|
6342
|
-
*/
|
|
6343
|
-
truncation: z21.enum(["auto", "disabled"]).nullish(),
|
|
6344
|
-
/**
|
|
6345
|
-
* A unique identifier representing your end-user, which can help OpenAI to
|
|
6346
|
-
* monitor and detect abuse.
|
|
6347
|
-
* Defaults to `undefined`.
|
|
6348
|
-
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
6349
|
-
*/
|
|
6350
|
-
user: z21.string().nullish(),
|
|
6351
|
-
/**
|
|
6352
|
-
* Override the system message mode for this model.
|
|
6353
|
-
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
6354
|
-
* - 'developer': Use the 'developer' role for system messages (used by reasoning models)
|
|
6355
|
-
* - 'remove': Remove system messages entirely
|
|
6356
|
-
*
|
|
6357
|
-
* If not specified, the mode is automatically determined based on the model.
|
|
6358
|
-
*/
|
|
6359
|
-
systemMessageMode: z21.enum(["system", "developer", "remove"]).optional(),
|
|
6360
|
-
/**
|
|
6361
|
-
* Force treating this model as a reasoning model.
|
|
6362
|
-
*
|
|
6363
|
-
* This is useful for "stealth" reasoning models (e.g. via a custom baseURL)
|
|
6364
|
-
* where the model ID is not recognized by the SDK's allowlist.
|
|
6365
|
-
*
|
|
6366
|
-
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
6367
|
-
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
6368
|
-
*/
|
|
6369
|
-
forceReasoning: z21.boolean().optional(),
|
|
6370
|
-
/**
|
|
6371
|
-
* Enable server-side context management (compaction).
|
|
6372
|
-
*/
|
|
6373
|
-
contextManagement: z21.array(
|
|
6374
|
-
z21.object({
|
|
6375
|
-
type: z21.literal("compaction"),
|
|
6376
|
-
compactThreshold: z21.number()
|
|
5578
|
+
"local_shell_call",
|
|
5579
|
+
"mcp_approval_request",
|
|
5580
|
+
"mcp_call",
|
|
5581
|
+
"mcp_list_tools",
|
|
5582
|
+
"message",
|
|
5583
|
+
"program",
|
|
5584
|
+
"program_output",
|
|
5585
|
+
"reasoning",
|
|
5586
|
+
"shell_call",
|
|
5587
|
+
"shell_call_output",
|
|
5588
|
+
"tool_search_call",
|
|
5589
|
+
"tool_search_output",
|
|
5590
|
+
"web_search_call"
|
|
5591
|
+
]);
|
|
5592
|
+
function isModeledOpenAIResponsesChunk(value) {
|
|
5593
|
+
if (typeof value.type !== "string" || !openaiResponsesModeledChunkTypes.has(value.type)) {
|
|
5594
|
+
return false;
|
|
5595
|
+
}
|
|
5596
|
+
if (value.type !== "response.output_item.added" && value.type !== "response.output_item.done") {
|
|
5597
|
+
return true;
|
|
5598
|
+
}
|
|
5599
|
+
if (!isRecord(value.item) || typeof value.item.type !== "string") {
|
|
5600
|
+
return true;
|
|
5601
|
+
}
|
|
5602
|
+
return openaiResponsesModeledOutputItemTypes.has(value.item.type);
|
|
5603
|
+
}
|
|
5604
|
+
var openaiResponsesChunkSchema = lazySchema19(
|
|
5605
|
+
() => zodSchema19(
|
|
5606
|
+
z21.union([
|
|
5607
|
+
z21.object({
|
|
5608
|
+
type: z21.literal("response.output_text.delta"),
|
|
5609
|
+
item_id: z21.string(),
|
|
5610
|
+
output_index: z21.number().nullish(),
|
|
5611
|
+
delta: z21.string(),
|
|
5612
|
+
logprobs: z21.array(
|
|
5613
|
+
z21.object({
|
|
5614
|
+
token: z21.string(),
|
|
5615
|
+
logprob: z21.number(),
|
|
5616
|
+
top_logprobs: z21.array(
|
|
5617
|
+
z21.object({
|
|
5618
|
+
token: z21.string(),
|
|
5619
|
+
logprob: z21.number()
|
|
5620
|
+
})
|
|
5621
|
+
)
|
|
5622
|
+
})
|
|
5623
|
+
).nullish()
|
|
5624
|
+
}),
|
|
5625
|
+
z21.object({
|
|
5626
|
+
type: z21.enum(["response.completed", "response.incomplete"]),
|
|
5627
|
+
response: z21.object({
|
|
5628
|
+
incomplete_details: z21.object({ reason: z21.string() }).nullish(),
|
|
5629
|
+
usage: openaiResponsesUsageSchema.nullish(),
|
|
5630
|
+
reasoning: z21.object({
|
|
5631
|
+
context: z21.string().nullish()
|
|
5632
|
+
}).nullish(),
|
|
5633
|
+
service_tier: z21.string().nullish()
|
|
6377
5634
|
})
|
|
6378
|
-
)
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
5635
|
+
}),
|
|
5636
|
+
z21.object({
|
|
5637
|
+
type: z21.literal("response.failed"),
|
|
5638
|
+
sequence_number: z21.number(),
|
|
5639
|
+
response: z21.object({
|
|
5640
|
+
error: z21.object({
|
|
5641
|
+
code: z21.string().nullish(),
|
|
5642
|
+
message: z21.string()
|
|
5643
|
+
}).nullish(),
|
|
5644
|
+
incomplete_details: z21.object({ reason: z21.string() }).nullish(),
|
|
5645
|
+
usage: openaiResponsesUsageSchema.nullish(),
|
|
5646
|
+
reasoning: z21.object({
|
|
5647
|
+
context: z21.string().nullish()
|
|
5648
|
+
}).nullish(),
|
|
5649
|
+
service_tier: z21.string().nullish()
|
|
5650
|
+
})
|
|
5651
|
+
}),
|
|
5652
|
+
z21.object({
|
|
5653
|
+
type: z21.literal("response.created"),
|
|
5654
|
+
response: z21.object({
|
|
5655
|
+
id: z21.string(),
|
|
5656
|
+
created_at: z21.number(),
|
|
5657
|
+
model: z21.string(),
|
|
5658
|
+
service_tier: z21.string().nullish()
|
|
5659
|
+
})
|
|
5660
|
+
}),
|
|
5661
|
+
z21.object({
|
|
5662
|
+
type: z21.literal("response.in_progress"),
|
|
5663
|
+
response: z21.object({
|
|
5664
|
+
id: z21.string(),
|
|
5665
|
+
created_at: z21.number(),
|
|
5666
|
+
model: z21.string(),
|
|
5667
|
+
service_tier: z21.string().nullish()
|
|
5668
|
+
})
|
|
5669
|
+
}),
|
|
5670
|
+
z21.object({
|
|
5671
|
+
type: z21.literal("response.output_item.added"),
|
|
5672
|
+
output_index: z21.number(),
|
|
5673
|
+
item: z21.discriminatedUnion("type", [
|
|
5674
|
+
z21.object({
|
|
5675
|
+
type: z21.literal("message"),
|
|
5676
|
+
id: z21.string(),
|
|
5677
|
+
phase: z21.enum(["commentary", "final_answer"]).nullish()
|
|
5678
|
+
}),
|
|
5679
|
+
z21.object({
|
|
5680
|
+
type: z21.literal("reasoning"),
|
|
5681
|
+
id: z21.string(),
|
|
5682
|
+
encrypted_content: z21.string().nullish()
|
|
5683
|
+
}),
|
|
5684
|
+
z21.object({
|
|
5685
|
+
type: z21.literal("function_call"),
|
|
5686
|
+
id: z21.string(),
|
|
5687
|
+
call_id: z21.string(),
|
|
5688
|
+
name: z21.string(),
|
|
5689
|
+
arguments: z21.string(),
|
|
5690
|
+
async: z21.boolean().nullish(),
|
|
5691
|
+
namespace: z21.string().nullish(),
|
|
5692
|
+
caller: openaiResponsesToolCallerSchema.nullish()
|
|
5693
|
+
}),
|
|
5694
|
+
openaiResponsesProgramSchema,
|
|
5695
|
+
openaiResponsesProgramOutputSchema,
|
|
5696
|
+
z21.object({
|
|
5697
|
+
type: z21.literal("web_search_call"),
|
|
5698
|
+
id: z21.string(),
|
|
5699
|
+
status: z21.string()
|
|
5700
|
+
}),
|
|
5701
|
+
openaiResponsesComputerCallSchema,
|
|
5702
|
+
z21.object({
|
|
5703
|
+
type: z21.literal("file_search_call"),
|
|
5704
|
+
id: z21.string()
|
|
5705
|
+
}),
|
|
5706
|
+
openaiResponsesLocalShellCallSchema,
|
|
5707
|
+
z21.object({
|
|
5708
|
+
type: z21.literal("image_generation_call"),
|
|
5709
|
+
id: z21.string()
|
|
5710
|
+
}),
|
|
5711
|
+
z21.object({
|
|
5712
|
+
type: z21.literal("code_interpreter_call"),
|
|
5713
|
+
id: z21.string(),
|
|
5714
|
+
container_id: z21.string(),
|
|
5715
|
+
code: z21.string().nullable(),
|
|
5716
|
+
outputs: z21.array(
|
|
5717
|
+
z21.discriminatedUnion("type", [
|
|
5718
|
+
z21.object({ type: z21.literal("logs"), logs: z21.string() }),
|
|
5719
|
+
z21.object({ type: z21.literal("image"), url: z21.string() })
|
|
5720
|
+
])
|
|
5721
|
+
).nullable(),
|
|
5722
|
+
status: z21.string()
|
|
5723
|
+
}),
|
|
5724
|
+
z21.object({
|
|
5725
|
+
type: z21.literal("mcp_call"),
|
|
5726
|
+
id: z21.string(),
|
|
5727
|
+
status: z21.string(),
|
|
5728
|
+
approval_request_id: z21.string().nullish()
|
|
5729
|
+
}),
|
|
5730
|
+
z21.object({
|
|
5731
|
+
type: z21.literal("mcp_list_tools"),
|
|
5732
|
+
id: z21.string()
|
|
5733
|
+
}),
|
|
5734
|
+
z21.object({
|
|
5735
|
+
type: z21.literal("mcp_approval_request"),
|
|
5736
|
+
id: z21.string()
|
|
5737
|
+
}),
|
|
5738
|
+
z21.object({
|
|
5739
|
+
type: z21.literal("apply_patch_call"),
|
|
5740
|
+
id: z21.string(),
|
|
5741
|
+
call_id: z21.string(),
|
|
5742
|
+
status: z21.enum(["in_progress", "completed"]),
|
|
5743
|
+
operation: z21.discriminatedUnion("type", [
|
|
5744
|
+
z21.object({
|
|
5745
|
+
type: z21.literal("create_file"),
|
|
5746
|
+
path: z21.string(),
|
|
5747
|
+
diff: z21.string()
|
|
5748
|
+
}),
|
|
5749
|
+
z21.object({
|
|
5750
|
+
type: z21.literal("delete_file"),
|
|
5751
|
+
path: z21.string()
|
|
5752
|
+
}),
|
|
5753
|
+
z21.object({
|
|
5754
|
+
type: z21.literal("update_file"),
|
|
5755
|
+
path: z21.string(),
|
|
5756
|
+
diff: z21.string()
|
|
5757
|
+
})
|
|
5758
|
+
])
|
|
5759
|
+
}),
|
|
5760
|
+
z21.object({
|
|
5761
|
+
type: z21.literal("custom_tool_call"),
|
|
5762
|
+
id: z21.string(),
|
|
5763
|
+
call_id: z21.string(),
|
|
5764
|
+
name: z21.string(),
|
|
5765
|
+
input: z21.string(),
|
|
5766
|
+
async: z21.boolean().nullish()
|
|
5767
|
+
}),
|
|
5768
|
+
z21.object({
|
|
5769
|
+
type: z21.literal("shell_call"),
|
|
5770
|
+
id: z21.string(),
|
|
5771
|
+
call_id: z21.string(),
|
|
5772
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
5773
|
+
action: z21.object({
|
|
5774
|
+
commands: z21.array(z21.string())
|
|
5775
|
+
})
|
|
5776
|
+
}),
|
|
5777
|
+
z21.object({
|
|
5778
|
+
type: z21.literal("compaction"),
|
|
5779
|
+
id: z21.string(),
|
|
5780
|
+
encrypted_content: z21.string().nullish()
|
|
5781
|
+
}),
|
|
5782
|
+
z21.object({
|
|
5783
|
+
type: z21.literal("shell_call_output"),
|
|
5784
|
+
id: z21.string(),
|
|
5785
|
+
call_id: z21.string(),
|
|
5786
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
5787
|
+
output: z21.array(
|
|
5788
|
+
z21.object({
|
|
5789
|
+
stdout: z21.string(),
|
|
5790
|
+
stderr: z21.string(),
|
|
5791
|
+
outcome: z21.discriminatedUnion("type", [
|
|
5792
|
+
z21.object({ type: z21.literal("timeout") }),
|
|
5793
|
+
z21.object({
|
|
5794
|
+
type: z21.literal("exit"),
|
|
5795
|
+
exit_code: z21.number()
|
|
5796
|
+
})
|
|
5797
|
+
])
|
|
5798
|
+
})
|
|
5799
|
+
)
|
|
5800
|
+
}),
|
|
5801
|
+
z21.object({
|
|
5802
|
+
type: z21.literal("tool_search_call"),
|
|
5803
|
+
id: z21.string(),
|
|
5804
|
+
execution: z21.enum(["server", "client"]),
|
|
5805
|
+
call_id: z21.string().nullable(),
|
|
5806
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
5807
|
+
arguments: z21.unknown()
|
|
5808
|
+
}),
|
|
5809
|
+
z21.object({
|
|
5810
|
+
type: z21.literal("tool_search_output"),
|
|
5811
|
+
id: z21.string(),
|
|
5812
|
+
execution: z21.enum(["server", "client"]),
|
|
5813
|
+
call_id: z21.string().nullable(),
|
|
5814
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
5815
|
+
tools: z21.array(z21.record(z21.string(), jsonValueSchema.optional()))
|
|
5816
|
+
})
|
|
5817
|
+
])
|
|
5818
|
+
}),
|
|
5819
|
+
z21.object({
|
|
5820
|
+
type: z21.literal("response.output_item.done"),
|
|
5821
|
+
output_index: z21.number(),
|
|
5822
|
+
item: z21.discriminatedUnion("type", [
|
|
5823
|
+
z21.object({
|
|
5824
|
+
type: z21.literal("message"),
|
|
5825
|
+
id: z21.string(),
|
|
5826
|
+
phase: z21.enum(["commentary", "final_answer"]).nullish()
|
|
5827
|
+
}),
|
|
5828
|
+
z21.object({
|
|
5829
|
+
type: z21.literal("reasoning"),
|
|
5830
|
+
id: z21.string(),
|
|
5831
|
+
encrypted_content: z21.string().nullish()
|
|
5832
|
+
}),
|
|
5833
|
+
z21.object({
|
|
5834
|
+
type: z21.literal("function_call"),
|
|
5835
|
+
id: z21.string(),
|
|
5836
|
+
call_id: z21.string(),
|
|
5837
|
+
name: z21.string(),
|
|
5838
|
+
arguments: z21.string(),
|
|
5839
|
+
async: z21.boolean().nullish(),
|
|
5840
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
5841
|
+
namespace: z21.string().nullish(),
|
|
5842
|
+
caller: openaiResponsesToolCallerSchema.nullish()
|
|
5843
|
+
}),
|
|
5844
|
+
openaiResponsesProgramSchema,
|
|
5845
|
+
openaiResponsesProgramOutputSchema,
|
|
5846
|
+
z21.object({
|
|
5847
|
+
type: z21.literal("custom_tool_call"),
|
|
5848
|
+
id: z21.string(),
|
|
5849
|
+
call_id: z21.string(),
|
|
5850
|
+
name: z21.string(),
|
|
5851
|
+
input: z21.string(),
|
|
5852
|
+
async: z21.boolean().nullish(),
|
|
5853
|
+
status: z21.literal("completed")
|
|
5854
|
+
}),
|
|
5855
|
+
z21.object({
|
|
5856
|
+
type: z21.literal("code_interpreter_call"),
|
|
5857
|
+
id: z21.string(),
|
|
5858
|
+
code: z21.string().nullable(),
|
|
5859
|
+
container_id: z21.string(),
|
|
5860
|
+
outputs: z21.array(
|
|
5861
|
+
z21.discriminatedUnion("type", [
|
|
5862
|
+
z21.object({ type: z21.literal("logs"), logs: z21.string() }),
|
|
5863
|
+
z21.object({ type: z21.literal("image"), url: z21.string() })
|
|
5864
|
+
])
|
|
5865
|
+
).nullable()
|
|
5866
|
+
}),
|
|
5867
|
+
z21.object({
|
|
5868
|
+
type: z21.literal("image_generation_call"),
|
|
5869
|
+
id: z21.string(),
|
|
5870
|
+
result: z21.string()
|
|
5871
|
+
}),
|
|
5872
|
+
z21.object({
|
|
5873
|
+
type: z21.literal("web_search_call"),
|
|
5874
|
+
id: z21.string(),
|
|
5875
|
+
status: z21.string(),
|
|
5876
|
+
action: z21.discriminatedUnion("type", [
|
|
5877
|
+
z21.object({
|
|
5878
|
+
type: z21.literal("search"),
|
|
5879
|
+
query: z21.string().nullish(),
|
|
5880
|
+
queries: z21.array(z21.string()).nullish(),
|
|
5881
|
+
sources: z21.array(
|
|
5882
|
+
z21.discriminatedUnion("type", [
|
|
5883
|
+
z21.object({ type: z21.literal("url"), url: z21.string() }),
|
|
5884
|
+
z21.object({ type: z21.literal("api"), name: z21.string() })
|
|
5885
|
+
])
|
|
5886
|
+
).nullish()
|
|
5887
|
+
}),
|
|
5888
|
+
z21.object({
|
|
5889
|
+
type: z21.literal("open_page"),
|
|
5890
|
+
url: z21.string().nullish()
|
|
5891
|
+
}),
|
|
5892
|
+
z21.object({
|
|
5893
|
+
type: z21.literal("find_in_page"),
|
|
5894
|
+
url: z21.string().nullish(),
|
|
5895
|
+
pattern: z21.string().nullish()
|
|
5896
|
+
})
|
|
5897
|
+
]).nullish()
|
|
5898
|
+
}),
|
|
5899
|
+
z21.object({
|
|
5900
|
+
type: z21.literal("file_search_call"),
|
|
5901
|
+
id: z21.string(),
|
|
5902
|
+
queries: z21.array(z21.string()),
|
|
5903
|
+
results: z21.array(
|
|
5904
|
+
z21.object({
|
|
5905
|
+
attributes: z21.record(
|
|
5906
|
+
z21.string(),
|
|
5907
|
+
z21.union([z21.string(), z21.number(), z21.boolean()])
|
|
5908
|
+
),
|
|
5909
|
+
file_id: z21.string(),
|
|
5910
|
+
filename: z21.string(),
|
|
5911
|
+
score: z21.number(),
|
|
5912
|
+
text: z21.string()
|
|
5913
|
+
})
|
|
5914
|
+
).nullish()
|
|
5915
|
+
}),
|
|
5916
|
+
openaiResponsesLocalShellCallSchema,
|
|
5917
|
+
openaiResponsesComputerCallSchema,
|
|
5918
|
+
z21.object({
|
|
5919
|
+
type: z21.literal("mcp_call"),
|
|
5920
|
+
id: z21.string(),
|
|
5921
|
+
status: z21.string(),
|
|
5922
|
+
arguments: z21.string(),
|
|
5923
|
+
name: z21.string(),
|
|
5924
|
+
server_label: z21.string(),
|
|
5925
|
+
output: z21.string().nullish(),
|
|
5926
|
+
error: z21.union([
|
|
5927
|
+
z21.string(),
|
|
5928
|
+
z21.object({
|
|
5929
|
+
type: z21.string().optional(),
|
|
5930
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
5931
|
+
message: z21.string().optional()
|
|
5932
|
+
}).loose()
|
|
5933
|
+
]).nullish(),
|
|
5934
|
+
approval_request_id: z21.string().nullish()
|
|
5935
|
+
}),
|
|
5936
|
+
z21.object({
|
|
5937
|
+
type: z21.literal("mcp_list_tools"),
|
|
5938
|
+
id: z21.string(),
|
|
5939
|
+
server_label: z21.string(),
|
|
5940
|
+
tools: z21.array(
|
|
5941
|
+
z21.object({
|
|
5942
|
+
name: z21.string(),
|
|
5943
|
+
description: z21.string().optional(),
|
|
5944
|
+
input_schema: z21.any(),
|
|
5945
|
+
annotations: z21.record(z21.string(), z21.unknown()).optional()
|
|
5946
|
+
})
|
|
5947
|
+
),
|
|
5948
|
+
error: z21.union([
|
|
5949
|
+
z21.string(),
|
|
5950
|
+
z21.object({
|
|
5951
|
+
type: z21.string().optional(),
|
|
5952
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
5953
|
+
message: z21.string().optional()
|
|
5954
|
+
}).loose()
|
|
5955
|
+
]).optional()
|
|
5956
|
+
}),
|
|
5957
|
+
z21.object({
|
|
5958
|
+
type: z21.literal("mcp_approval_request"),
|
|
5959
|
+
id: z21.string(),
|
|
5960
|
+
server_label: z21.string(),
|
|
5961
|
+
name: z21.string(),
|
|
5962
|
+
arguments: z21.string(),
|
|
5963
|
+
approval_request_id: z21.string().optional()
|
|
5964
|
+
}),
|
|
5965
|
+
z21.object({
|
|
5966
|
+
type: z21.literal("apply_patch_call"),
|
|
5967
|
+
id: z21.string(),
|
|
5968
|
+
call_id: z21.string(),
|
|
5969
|
+
status: z21.enum(["in_progress", "completed"]),
|
|
5970
|
+
operation: z21.discriminatedUnion("type", [
|
|
5971
|
+
z21.object({
|
|
5972
|
+
type: z21.literal("create_file"),
|
|
5973
|
+
path: z21.string(),
|
|
5974
|
+
diff: z21.string()
|
|
5975
|
+
}),
|
|
5976
|
+
z21.object({
|
|
5977
|
+
type: z21.literal("delete_file"),
|
|
5978
|
+
path: z21.string()
|
|
5979
|
+
}),
|
|
5980
|
+
z21.object({
|
|
5981
|
+
type: z21.literal("update_file"),
|
|
5982
|
+
path: z21.string(),
|
|
5983
|
+
diff: z21.string()
|
|
5984
|
+
})
|
|
5985
|
+
])
|
|
5986
|
+
}),
|
|
5987
|
+
z21.object({
|
|
5988
|
+
type: z21.literal("shell_call"),
|
|
5989
|
+
id: z21.string(),
|
|
5990
|
+
call_id: z21.string(),
|
|
5991
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
5992
|
+
action: z21.object({
|
|
5993
|
+
commands: z21.array(z21.string())
|
|
5994
|
+
})
|
|
5995
|
+
}),
|
|
5996
|
+
z21.object({
|
|
5997
|
+
type: z21.literal("compaction"),
|
|
5998
|
+
id: z21.string(),
|
|
5999
|
+
encrypted_content: z21.string()
|
|
6000
|
+
}),
|
|
6001
|
+
z21.object({
|
|
6002
|
+
type: z21.literal("shell_call_output"),
|
|
6003
|
+
id: z21.string(),
|
|
6004
|
+
call_id: z21.string(),
|
|
6005
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
6006
|
+
output: z21.array(
|
|
6007
|
+
z21.object({
|
|
6008
|
+
stdout: z21.string(),
|
|
6009
|
+
stderr: z21.string(),
|
|
6010
|
+
outcome: z21.discriminatedUnion("type", [
|
|
6011
|
+
z21.object({ type: z21.literal("timeout") }),
|
|
6012
|
+
z21.object({
|
|
6013
|
+
type: z21.literal("exit"),
|
|
6014
|
+
exit_code: z21.number()
|
|
6015
|
+
})
|
|
6016
|
+
])
|
|
6017
|
+
})
|
|
6018
|
+
)
|
|
6019
|
+
}),
|
|
6020
|
+
z21.object({
|
|
6021
|
+
type: z21.literal("tool_search_call"),
|
|
6022
|
+
id: z21.string(),
|
|
6023
|
+
execution: z21.enum(["server", "client"]),
|
|
6024
|
+
call_id: z21.string().nullable(),
|
|
6025
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
6026
|
+
arguments: z21.unknown()
|
|
6027
|
+
}),
|
|
6028
|
+
z21.object({
|
|
6029
|
+
type: z21.literal("tool_search_output"),
|
|
6030
|
+
id: z21.string(),
|
|
6031
|
+
execution: z21.enum(["server", "client"]),
|
|
6032
|
+
call_id: z21.string().nullable(),
|
|
6033
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
6034
|
+
tools: z21.array(z21.record(z21.string(), jsonValueSchema.optional()))
|
|
6035
|
+
})
|
|
6036
|
+
])
|
|
6037
|
+
}),
|
|
6038
|
+
z21.object({
|
|
6039
|
+
type: z21.literal("response.function_call_arguments.delta"),
|
|
6040
|
+
item_id: z21.string(),
|
|
6041
|
+
output_index: z21.number(),
|
|
6042
|
+
delta: z21.string()
|
|
6043
|
+
}),
|
|
6044
|
+
z21.object({
|
|
6045
|
+
// `name` is documented as required but omitted from live API events:
|
|
6046
|
+
// https://github.com/openai/openai-openapi/issues/545
|
|
6047
|
+
type: z21.literal("response.function_call_arguments.done"),
|
|
6048
|
+
item_id: z21.string(),
|
|
6049
|
+
output_index: z21.number(),
|
|
6050
|
+
arguments: z21.string()
|
|
6051
|
+
}),
|
|
6052
|
+
z21.object({
|
|
6053
|
+
type: z21.literal("response.custom_tool_call_input.delta"),
|
|
6054
|
+
item_id: z21.string(),
|
|
6055
|
+
output_index: z21.number(),
|
|
6056
|
+
delta: z21.string()
|
|
6057
|
+
}),
|
|
6058
|
+
z21.object({
|
|
6059
|
+
type: z21.literal("response.image_generation_call.partial_image"),
|
|
6060
|
+
item_id: z21.string(),
|
|
6061
|
+
output_index: z21.number(),
|
|
6062
|
+
partial_image_b64: z21.string()
|
|
6063
|
+
}),
|
|
6064
|
+
z21.object({
|
|
6065
|
+
type: z21.literal("response.code_interpreter_call_code.delta"),
|
|
6066
|
+
item_id: z21.string(),
|
|
6067
|
+
output_index: z21.number(),
|
|
6068
|
+
delta: z21.string()
|
|
6069
|
+
}),
|
|
6070
|
+
z21.object({
|
|
6071
|
+
type: z21.literal("response.code_interpreter_call_code.done"),
|
|
6072
|
+
item_id: z21.string(),
|
|
6073
|
+
output_index: z21.number(),
|
|
6074
|
+
code: z21.string()
|
|
6075
|
+
}),
|
|
6076
|
+
z21.object({
|
|
6077
|
+
type: z21.literal("response.output_text.annotation.added"),
|
|
6078
|
+
annotation: z21.discriminatedUnion("type", [
|
|
6079
|
+
z21.object({
|
|
6080
|
+
type: z21.literal("url_citation"),
|
|
6081
|
+
start_index: z21.number(),
|
|
6082
|
+
end_index: z21.number(),
|
|
6083
|
+
url: z21.string(),
|
|
6084
|
+
title: z21.string()
|
|
6085
|
+
}),
|
|
6086
|
+
z21.object({
|
|
6087
|
+
type: z21.literal("file_citation"),
|
|
6088
|
+
file_id: z21.string(),
|
|
6089
|
+
filename: z21.string(),
|
|
6090
|
+
index: z21.number()
|
|
6091
|
+
}),
|
|
6092
|
+
z21.object({
|
|
6093
|
+
type: z21.literal("container_file_citation"),
|
|
6094
|
+
container_id: z21.string(),
|
|
6095
|
+
file_id: z21.string(),
|
|
6096
|
+
filename: z21.string(),
|
|
6097
|
+
start_index: z21.number(),
|
|
6098
|
+
end_index: z21.number()
|
|
6099
|
+
}),
|
|
6100
|
+
z21.object({
|
|
6101
|
+
type: z21.literal("file_path"),
|
|
6102
|
+
file_id: z21.string(),
|
|
6103
|
+
index: z21.number()
|
|
6104
|
+
})
|
|
6105
|
+
])
|
|
6106
|
+
}),
|
|
6107
|
+
z21.object({
|
|
6108
|
+
type: z21.literal("response.reasoning_summary_part.added"),
|
|
6109
|
+
item_id: z21.string(),
|
|
6110
|
+
output_index: z21.number().nullish(),
|
|
6111
|
+
summary_index: z21.number()
|
|
6112
|
+
}),
|
|
6113
|
+
z21.object({
|
|
6114
|
+
type: z21.literal("response.reasoning_summary_text.delta"),
|
|
6115
|
+
item_id: z21.string(),
|
|
6116
|
+
output_index: z21.number().nullish(),
|
|
6117
|
+
summary_index: z21.number(),
|
|
6118
|
+
delta: z21.string()
|
|
6119
|
+
}),
|
|
6120
|
+
z21.object({
|
|
6121
|
+
type: z21.literal("response.reasoning_summary_part.done"),
|
|
6122
|
+
item_id: z21.string(),
|
|
6123
|
+
output_index: z21.number().nullish(),
|
|
6124
|
+
summary_index: z21.number()
|
|
6125
|
+
}),
|
|
6126
|
+
z21.object({
|
|
6127
|
+
type: z21.literal("response.apply_patch_call_operation_diff.delta"),
|
|
6128
|
+
item_id: z21.string(),
|
|
6129
|
+
output_index: z21.number(),
|
|
6130
|
+
delta: z21.string(),
|
|
6131
|
+
obfuscation: z21.string().nullish()
|
|
6132
|
+
}),
|
|
6133
|
+
z21.object({
|
|
6134
|
+
type: z21.literal("response.apply_patch_call_operation_diff.done"),
|
|
6135
|
+
item_id: z21.string(),
|
|
6136
|
+
output_index: z21.number(),
|
|
6137
|
+
diff: z21.string()
|
|
6138
|
+
}),
|
|
6139
|
+
openaiResponsesNestedErrorChunkSchema,
|
|
6140
|
+
openaiResponsesErrorChunkSchema,
|
|
6141
|
+
z21.object({ type: z21.string() }).loose().refine((value) => !isModeledOpenAIResponsesChunk(value), {
|
|
6142
|
+
message: "Known response chunk failed schema validation"
|
|
6143
|
+
}).transform((value) => ({
|
|
6144
|
+
type: "unknown_chunk",
|
|
6145
|
+
message: value.type
|
|
6146
|
+
}))
|
|
6147
|
+
// fallback for unknown chunks
|
|
6148
|
+
])
|
|
6149
|
+
)
|
|
6150
|
+
);
|
|
6151
|
+
var openaiResponsesResponseSchema = lazySchema19(
|
|
6152
|
+
() => zodSchema19(
|
|
6153
|
+
z21.object({
|
|
6154
|
+
id: z21.string().optional(),
|
|
6155
|
+
created_at: z21.number().optional(),
|
|
6156
|
+
error: z21.object({
|
|
6157
|
+
message: z21.string(),
|
|
6158
|
+
type: z21.string(),
|
|
6159
|
+
param: z21.string().nullish(),
|
|
6160
|
+
code: z21.string()
|
|
6161
|
+
}).nullish(),
|
|
6162
|
+
model: z21.string().optional(),
|
|
6163
|
+
output: z21.array(
|
|
6164
|
+
z21.discriminatedUnion("type", [
|
|
6165
|
+
z21.object({
|
|
6166
|
+
type: z21.literal("message"),
|
|
6167
|
+
role: z21.literal("assistant"),
|
|
6168
|
+
id: z21.string(),
|
|
6169
|
+
phase: z21.enum(["commentary", "final_answer"]).nullish(),
|
|
6170
|
+
content: z21.array(
|
|
6171
|
+
z21.object({
|
|
6172
|
+
type: z21.literal("output_text"),
|
|
6173
|
+
text: z21.string(),
|
|
6174
|
+
logprobs: z21.array(
|
|
6175
|
+
z21.object({
|
|
6176
|
+
token: z21.string(),
|
|
6177
|
+
logprob: z21.number(),
|
|
6178
|
+
top_logprobs: z21.array(
|
|
6179
|
+
z21.object({
|
|
6180
|
+
token: z21.string(),
|
|
6181
|
+
logprob: z21.number()
|
|
6182
|
+
})
|
|
6183
|
+
)
|
|
6184
|
+
})
|
|
6185
|
+
).nullish(),
|
|
6186
|
+
annotations: z21.array(
|
|
6187
|
+
z21.discriminatedUnion("type", [
|
|
6188
|
+
z21.object({
|
|
6189
|
+
type: z21.literal("url_citation"),
|
|
6190
|
+
start_index: z21.number(),
|
|
6191
|
+
end_index: z21.number(),
|
|
6192
|
+
url: z21.string(),
|
|
6193
|
+
title: z21.string()
|
|
6194
|
+
}),
|
|
6195
|
+
z21.object({
|
|
6196
|
+
type: z21.literal("file_citation"),
|
|
6197
|
+
file_id: z21.string(),
|
|
6198
|
+
filename: z21.string(),
|
|
6199
|
+
index: z21.number()
|
|
6200
|
+
}),
|
|
6201
|
+
z21.object({
|
|
6202
|
+
type: z21.literal("container_file_citation"),
|
|
6203
|
+
container_id: z21.string(),
|
|
6204
|
+
file_id: z21.string(),
|
|
6205
|
+
filename: z21.string(),
|
|
6206
|
+
start_index: z21.number(),
|
|
6207
|
+
end_index: z21.number()
|
|
6208
|
+
}),
|
|
6209
|
+
z21.object({
|
|
6210
|
+
type: z21.literal("file_path"),
|
|
6211
|
+
file_id: z21.string(),
|
|
6212
|
+
index: z21.number()
|
|
6213
|
+
})
|
|
6214
|
+
])
|
|
6215
|
+
)
|
|
6216
|
+
})
|
|
6217
|
+
)
|
|
6218
|
+
}),
|
|
6219
|
+
z21.object({
|
|
6220
|
+
type: z21.literal("web_search_call"),
|
|
6221
|
+
id: z21.string(),
|
|
6222
|
+
status: z21.string(),
|
|
6223
|
+
action: z21.discriminatedUnion("type", [
|
|
6224
|
+
z21.object({
|
|
6225
|
+
type: z21.literal("search"),
|
|
6226
|
+
query: z21.string().nullish(),
|
|
6227
|
+
queries: z21.array(z21.string()).nullish(),
|
|
6228
|
+
sources: z21.array(
|
|
6229
|
+
z21.discriminatedUnion("type", [
|
|
6230
|
+
z21.object({ type: z21.literal("url"), url: z21.string() }),
|
|
6231
|
+
z21.object({
|
|
6232
|
+
type: z21.literal("api"),
|
|
6233
|
+
name: z21.string()
|
|
6234
|
+
})
|
|
6235
|
+
])
|
|
6236
|
+
).nullish()
|
|
6237
|
+
}),
|
|
6238
|
+
z21.object({
|
|
6239
|
+
type: z21.literal("open_page"),
|
|
6240
|
+
url: z21.string().nullish()
|
|
6241
|
+
}),
|
|
6242
|
+
z21.object({
|
|
6243
|
+
type: z21.literal("find_in_page"),
|
|
6244
|
+
url: z21.string().nullish(),
|
|
6245
|
+
pattern: z21.string().nullish()
|
|
6246
|
+
})
|
|
6247
|
+
]).nullish()
|
|
6248
|
+
}),
|
|
6249
|
+
z21.object({
|
|
6250
|
+
type: z21.literal("file_search_call"),
|
|
6251
|
+
id: z21.string(),
|
|
6252
|
+
queries: z21.array(z21.string()),
|
|
6253
|
+
results: z21.array(
|
|
6254
|
+
z21.object({
|
|
6255
|
+
attributes: z21.record(
|
|
6256
|
+
z21.string(),
|
|
6257
|
+
z21.union([z21.string(), z21.number(), z21.boolean()])
|
|
6258
|
+
),
|
|
6259
|
+
file_id: z21.string(),
|
|
6260
|
+
filename: z21.string(),
|
|
6261
|
+
score: z21.number(),
|
|
6262
|
+
text: z21.string()
|
|
6263
|
+
})
|
|
6264
|
+
).nullish()
|
|
6265
|
+
}),
|
|
6266
|
+
z21.object({
|
|
6267
|
+
type: z21.literal("code_interpreter_call"),
|
|
6268
|
+
id: z21.string(),
|
|
6269
|
+
code: z21.string().nullable(),
|
|
6270
|
+
container_id: z21.string(),
|
|
6271
|
+
outputs: z21.array(
|
|
6272
|
+
z21.discriminatedUnion("type", [
|
|
6273
|
+
z21.object({ type: z21.literal("logs"), logs: z21.string() }),
|
|
6274
|
+
z21.object({ type: z21.literal("image"), url: z21.string() })
|
|
6275
|
+
])
|
|
6276
|
+
).nullable()
|
|
6277
|
+
}),
|
|
6278
|
+
z21.object({
|
|
6279
|
+
type: z21.literal("image_generation_call"),
|
|
6280
|
+
id: z21.string(),
|
|
6281
|
+
result: z21.string()
|
|
6282
|
+
}),
|
|
6283
|
+
openaiResponsesLocalShellCallSchema,
|
|
6284
|
+
z21.object({
|
|
6285
|
+
type: z21.literal("function_call"),
|
|
6286
|
+
call_id: z21.string(),
|
|
6287
|
+
name: z21.string(),
|
|
6288
|
+
arguments: z21.string(),
|
|
6289
|
+
id: z21.string(),
|
|
6290
|
+
async: z21.boolean().nullish(),
|
|
6291
|
+
namespace: z21.string().nullish(),
|
|
6292
|
+
caller: openaiResponsesToolCallerSchema.nullish()
|
|
6293
|
+
}),
|
|
6294
|
+
openaiResponsesProgramSchema,
|
|
6295
|
+
openaiResponsesProgramOutputSchema,
|
|
6296
|
+
z21.object({
|
|
6297
|
+
type: z21.literal("custom_tool_call"),
|
|
6298
|
+
call_id: z21.string(),
|
|
6299
|
+
name: z21.string(),
|
|
6300
|
+
input: z21.string(),
|
|
6301
|
+
id: z21.string(),
|
|
6302
|
+
async: z21.boolean().nullish()
|
|
6303
|
+
}),
|
|
6304
|
+
openaiResponsesComputerCallSchema,
|
|
6305
|
+
z21.object({
|
|
6306
|
+
type: z21.literal("reasoning"),
|
|
6307
|
+
id: z21.string(),
|
|
6308
|
+
encrypted_content: z21.string().nullish(),
|
|
6309
|
+
summary: z21.array(
|
|
6310
|
+
z21.object({
|
|
6311
|
+
type: z21.literal("summary_text"),
|
|
6312
|
+
text: z21.string()
|
|
6313
|
+
})
|
|
6314
|
+
)
|
|
6315
|
+
}),
|
|
6316
|
+
z21.object({
|
|
6317
|
+
type: z21.literal("mcp_call"),
|
|
6318
|
+
id: z21.string(),
|
|
6319
|
+
status: z21.string(),
|
|
6320
|
+
arguments: z21.string(),
|
|
6321
|
+
name: z21.string(),
|
|
6322
|
+
server_label: z21.string(),
|
|
6323
|
+
output: z21.string().nullish(),
|
|
6324
|
+
error: z21.union([
|
|
6325
|
+
z21.string(),
|
|
6326
|
+
z21.object({
|
|
6327
|
+
type: z21.string().optional(),
|
|
6328
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
6329
|
+
message: z21.string().optional()
|
|
6330
|
+
}).loose()
|
|
6331
|
+
]).nullish(),
|
|
6332
|
+
approval_request_id: z21.string().nullish()
|
|
6333
|
+
}),
|
|
6334
|
+
z21.object({
|
|
6335
|
+
type: z21.literal("mcp_list_tools"),
|
|
6336
|
+
id: z21.string(),
|
|
6337
|
+
server_label: z21.string(),
|
|
6338
|
+
tools: z21.array(
|
|
6339
|
+
z21.object({
|
|
6340
|
+
name: z21.string(),
|
|
6341
|
+
description: z21.string().optional(),
|
|
6342
|
+
input_schema: z21.any(),
|
|
6343
|
+
annotations: z21.record(z21.string(), z21.unknown()).optional()
|
|
6344
|
+
})
|
|
6345
|
+
),
|
|
6346
|
+
error: z21.union([
|
|
6347
|
+
z21.string(),
|
|
6348
|
+
z21.object({
|
|
6349
|
+
type: z21.string().optional(),
|
|
6350
|
+
code: z21.union([z21.number(), z21.string()]).optional(),
|
|
6351
|
+
message: z21.string().optional()
|
|
6352
|
+
}).loose()
|
|
6353
|
+
]).optional()
|
|
6354
|
+
}),
|
|
6355
|
+
z21.object({
|
|
6356
|
+
type: z21.literal("mcp_approval_request"),
|
|
6357
|
+
id: z21.string(),
|
|
6358
|
+
server_label: z21.string(),
|
|
6359
|
+
name: z21.string(),
|
|
6360
|
+
arguments: z21.string(),
|
|
6361
|
+
approval_request_id: z21.string().optional()
|
|
6362
|
+
}),
|
|
6363
|
+
z21.object({
|
|
6364
|
+
type: z21.literal("apply_patch_call"),
|
|
6365
|
+
id: z21.string(),
|
|
6366
|
+
call_id: z21.string(),
|
|
6367
|
+
status: z21.enum(["in_progress", "completed"]),
|
|
6368
|
+
operation: z21.discriminatedUnion("type", [
|
|
6369
|
+
z21.object({
|
|
6370
|
+
type: z21.literal("create_file"),
|
|
6371
|
+
path: z21.string(),
|
|
6372
|
+
diff: z21.string()
|
|
6373
|
+
}),
|
|
6374
|
+
z21.object({
|
|
6375
|
+
type: z21.literal("delete_file"),
|
|
6376
|
+
path: z21.string()
|
|
6377
|
+
}),
|
|
6378
|
+
z21.object({
|
|
6379
|
+
type: z21.literal("update_file"),
|
|
6380
|
+
path: z21.string(),
|
|
6381
|
+
diff: z21.string()
|
|
6382
|
+
})
|
|
6383
|
+
])
|
|
6384
|
+
}),
|
|
6385
|
+
z21.object({
|
|
6386
|
+
type: z21.literal("shell_call"),
|
|
6387
|
+
id: z21.string(),
|
|
6388
|
+
call_id: z21.string(),
|
|
6389
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
6390
|
+
action: z21.object({
|
|
6391
|
+
commands: z21.array(z21.string())
|
|
6392
|
+
})
|
|
6393
|
+
}),
|
|
6394
|
+
z21.object({
|
|
6395
|
+
type: z21.literal("compaction"),
|
|
6396
|
+
id: z21.string(),
|
|
6397
|
+
encrypted_content: z21.string()
|
|
6398
|
+
}),
|
|
6399
|
+
z21.object({
|
|
6400
|
+
type: z21.literal("shell_call_output"),
|
|
6401
|
+
id: z21.string(),
|
|
6402
|
+
call_id: z21.string(),
|
|
6403
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
6404
|
+
output: z21.array(
|
|
6405
|
+
z21.object({
|
|
6406
|
+
stdout: z21.string(),
|
|
6407
|
+
stderr: z21.string(),
|
|
6408
|
+
outcome: z21.discriminatedUnion("type", [
|
|
6409
|
+
z21.object({ type: z21.literal("timeout") }),
|
|
6410
|
+
z21.object({
|
|
6411
|
+
type: z21.literal("exit"),
|
|
6412
|
+
exit_code: z21.number()
|
|
6413
|
+
})
|
|
6414
|
+
])
|
|
6415
|
+
})
|
|
6416
|
+
)
|
|
6417
|
+
}),
|
|
6418
|
+
z21.object({
|
|
6419
|
+
type: z21.literal("tool_search_call"),
|
|
6420
|
+
id: z21.string(),
|
|
6421
|
+
execution: z21.enum(["server", "client"]),
|
|
6422
|
+
call_id: z21.string().nullable(),
|
|
6423
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
6424
|
+
arguments: z21.unknown()
|
|
6425
|
+
}),
|
|
6426
|
+
z21.object({
|
|
6427
|
+
type: z21.literal("tool_search_output"),
|
|
6428
|
+
id: z21.string(),
|
|
6429
|
+
execution: z21.enum(["server", "client"]),
|
|
6430
|
+
call_id: z21.string().nullable(),
|
|
6431
|
+
status: z21.enum(["in_progress", "completed", "incomplete"]),
|
|
6432
|
+
tools: z21.array(z21.record(z21.string(), jsonValueSchema.optional()))
|
|
6433
|
+
})
|
|
6434
|
+
])
|
|
6435
|
+
).optional(),
|
|
6436
|
+
service_tier: z21.string().nullish(),
|
|
6437
|
+
reasoning: z21.object({
|
|
6438
|
+
context: z21.string().nullish()
|
|
6439
|
+
}).nullish(),
|
|
6440
|
+
incomplete_details: z21.object({ reason: z21.string() }).nullish(),
|
|
6441
|
+
usage: openaiResponsesUsageSchema.nullish()
|
|
6398
6442
|
})
|
|
6399
6443
|
)
|
|
6400
6444
|
);
|
|
@@ -7365,6 +7409,18 @@ var openaiResponsesSupportedUrls = {
|
|
|
7365
7409
|
"image/*": [/^https?:\/\/.*$/],
|
|
7366
7410
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
7367
7411
|
};
|
|
7412
|
+
function getConfigurationUpdateUnsupportedReason({
|
|
7413
|
+
modelCapabilities,
|
|
7414
|
+
options
|
|
7415
|
+
}) {
|
|
7416
|
+
if (!modelCapabilities.supportsConfigurationUpdate) {
|
|
7417
|
+
return "reasoningEffortUpdate is only supported by GPT-6 and later models";
|
|
7418
|
+
}
|
|
7419
|
+
if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.contextManagement) != null || (options == null ? void 0 : options.truncation) === "auto") {
|
|
7420
|
+
return "reasoningEffortUpdate requires standard reasoning mode without automatic compaction or automatic truncation";
|
|
7421
|
+
}
|
|
7422
|
+
return void 0;
|
|
7423
|
+
}
|
|
7368
7424
|
var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
|
|
7369
7425
|
constructor(modelId, config) {
|
|
7370
7426
|
this.specificationVersion = "v4";
|
|
@@ -7490,11 +7546,16 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
|
|
|
7490
7546
|
outputSchemaToolNames,
|
|
7491
7547
|
supportsAsyncToolCalling: modelCapabilities.supportsAsyncToolCalling
|
|
7492
7548
|
});
|
|
7549
|
+
const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
|
|
7550
|
+
modelCapabilities,
|
|
7551
|
+
options: openaiOptions
|
|
7552
|
+
});
|
|
7493
7553
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
7494
7554
|
prompt,
|
|
7495
7555
|
toolNameMapping,
|
|
7496
7556
|
systemMessageMode: (_d = openaiOptions == null ? void 0 : openaiOptions.systemMessageMode) != null ? _d : isReasoningModel ? "developer" : modelCapabilities.systemMessageMode,
|
|
7497
7557
|
providerOptionsName,
|
|
7558
|
+
configurationUpdateUnsupportedReason,
|
|
7498
7559
|
explicitMessageItemType: config.explicitMessageItemType,
|
|
7499
7560
|
fileIdPrefixes: config.fileIdPrefixes,
|
|
7500
7561
|
passThroughUnsupportedFiles: (_e = openaiOptions == null ? void 0 : openaiOptions.passThroughUnsupportedFiles) != null ? _e : false,
|
|
@@ -7511,18 +7572,27 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
|
|
|
7511
7572
|
});
|
|
7512
7573
|
warnings.push(...inputWarnings);
|
|
7513
7574
|
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
7514
|
-
|
|
7515
|
-
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
7575
|
+
if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
|
|
7516
7576
|
warnings.push({
|
|
7517
7577
|
type: "unsupported",
|
|
7518
7578
|
feature: "reasoningEffortUpdate",
|
|
7519
|
-
details:
|
|
7579
|
+
details: configurationUpdateUnsupportedReason
|
|
7520
7580
|
});
|
|
7521
7581
|
} else if (reasoningEffortUpdate != null) {
|
|
7522
|
-
input
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7582
|
+
const firstItem = input[0];
|
|
7583
|
+
if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
|
|
7584
|
+
input.unshift({
|
|
7585
|
+
type: "configuration_update",
|
|
7586
|
+
reasoning: { effort: reasoningEffortUpdate }
|
|
7587
|
+
});
|
|
7588
|
+
}
|
|
7589
|
+
}
|
|
7590
|
+
for (let i = 1; i < input.length; i++) {
|
|
7591
|
+
if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
|
|
7592
|
+
throw new UnsupportedFunctionalityError8({
|
|
7593
|
+
functionality: "Adjacent reasoning effort configuration updates"
|
|
7594
|
+
});
|
|
7595
|
+
}
|
|
7526
7596
|
}
|
|
7527
7597
|
if (openaiOptions == null ? void 0 : openaiOptions.compactionTrigger) {
|
|
7528
7598
|
input.push({ type: "compaction_trigger" });
|