@ai-sdk/openai 3.0.0-beta.54 → 3.0.0-beta.56

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/dist/index.js CHANGED
@@ -27,7 +27,7 @@ __export(src_exports, {
27
27
  module.exports = __toCommonJS(src_exports);
28
28
 
29
29
  // src/openai-provider.ts
30
- var import_provider_utils30 = require("@ai-sdk/provider-utils");
30
+ var import_provider_utils31 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/chat/openai-chat-language-model.ts
33
33
  var import_provider3 = require("@ai-sdk/provider");
@@ -1989,6 +1989,94 @@ var webSearchPreview = (0, import_provider_utils19.createProviderDefinedToolFact
1989
1989
  outputSchema: webSearchPreviewOutputSchema
1990
1990
  });
1991
1991
 
1992
+ // src/tool/mcp.ts
1993
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
1994
+ var import_v415 = require("zod/v4");
1995
+ var jsonValueSchema = import_v415.z.lazy(
1996
+ () => import_v415.z.union([
1997
+ import_v415.z.string(),
1998
+ import_v415.z.number(),
1999
+ import_v415.z.boolean(),
2000
+ import_v415.z.null(),
2001
+ import_v415.z.array(jsonValueSchema),
2002
+ import_v415.z.record(import_v415.z.string(), jsonValueSchema)
2003
+ ])
2004
+ );
2005
+ var mcpArgsSchema = (0, import_provider_utils20.lazySchema)(
2006
+ () => (0, import_provider_utils20.zodSchema)(
2007
+ import_v415.z.object({
2008
+ serverLabel: import_v415.z.string(),
2009
+ allowedTools: import_v415.z.union([
2010
+ import_v415.z.array(import_v415.z.string()),
2011
+ import_v415.z.object({
2012
+ readOnly: import_v415.z.boolean().optional(),
2013
+ toolNames: import_v415.z.array(import_v415.z.string()).optional()
2014
+ })
2015
+ ]).optional(),
2016
+ authorization: import_v415.z.string().optional(),
2017
+ connectorId: import_v415.z.string().optional(),
2018
+ headers: import_v415.z.record(import_v415.z.string(), import_v415.z.string()).optional(),
2019
+ // TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
2020
+ // requireApproval: z
2021
+ // .union([
2022
+ // z.enum(['always', 'never']),
2023
+ // z.object({
2024
+ // readOnly: z.boolean().optional(),
2025
+ // toolNames: z.array(z.string()).optional(),
2026
+ // }),
2027
+ // ])
2028
+ // .optional(),
2029
+ serverDescription: import_v415.z.string().optional(),
2030
+ serverUrl: import_v415.z.string().optional()
2031
+ }).refine(
2032
+ (v) => v.serverUrl != null || v.connectorId != null,
2033
+ "One of serverUrl or connectorId must be provided."
2034
+ )
2035
+ )
2036
+ );
2037
+ var mcpInputSchema = (0, import_provider_utils20.lazySchema)(() => (0, import_provider_utils20.zodSchema)(import_v415.z.object({})));
2038
+ var mcpOutputSchema = (0, import_provider_utils20.lazySchema)(
2039
+ () => (0, import_provider_utils20.zodSchema)(
2040
+ import_v415.z.discriminatedUnion("type", [
2041
+ import_v415.z.object({
2042
+ type: import_v415.z.literal("call"),
2043
+ serverLabel: import_v415.z.string(),
2044
+ name: import_v415.z.string(),
2045
+ arguments: import_v415.z.string(),
2046
+ output: import_v415.z.string().nullable().optional(),
2047
+ error: import_v415.z.union([import_v415.z.string(), jsonValueSchema]).optional()
2048
+ }),
2049
+ import_v415.z.object({
2050
+ type: import_v415.z.literal("listTools"),
2051
+ serverLabel: import_v415.z.string(),
2052
+ tools: import_v415.z.array(
2053
+ import_v415.z.object({
2054
+ name: import_v415.z.string(),
2055
+ description: import_v415.z.string().optional(),
2056
+ inputSchema: jsonValueSchema,
2057
+ annotations: import_v415.z.record(import_v415.z.string(), jsonValueSchema).optional()
2058
+ })
2059
+ ),
2060
+ error: import_v415.z.union([import_v415.z.string(), jsonValueSchema]).optional()
2061
+ }),
2062
+ import_v415.z.object({
2063
+ type: import_v415.z.literal("approvalRequest"),
2064
+ serverLabel: import_v415.z.string(),
2065
+ name: import_v415.z.string(),
2066
+ arguments: import_v415.z.string(),
2067
+ approvalRequestId: import_v415.z.string()
2068
+ })
2069
+ ])
2070
+ )
2071
+ );
2072
+ var mcpToolFactory = (0, import_provider_utils20.createProviderDefinedToolFactoryWithOutputSchema)({
2073
+ id: "openai.mcp",
2074
+ name: "mcp",
2075
+ inputSchema: mcpInputSchema,
2076
+ outputSchema: mcpOutputSchema
2077
+ });
2078
+ var mcp = (args) => mcpToolFactory(args);
2079
+
1992
2080
  // src/openai-tools.ts
1993
2081
  var openaiTools = {
1994
2082
  /**
@@ -2064,17 +2152,33 @@ var openaiTools = {
2064
2152
  * @param searchContextSize - The search context size to use for the web search.
2065
2153
  * @param userLocation - The user location to use for the web search.
2066
2154
  */
2067
- webSearch
2155
+ webSearch,
2156
+ /**
2157
+ * MCP (Model Context Protocol) allows models to call tools exposed by
2158
+ * remote MCP servers or service connectors.
2159
+ *
2160
+ * Must have name `mcp`.
2161
+ *
2162
+ * @param serverLabel - Label to identify the MCP server.
2163
+ * @param allowedTools - Allowed tool names or filter object.
2164
+ * @param authorization - OAuth access token for the MCP server/connector.
2165
+ * @param connectorId - Identifier for a service connector.
2166
+ * @param headers - Optional headers to include in MCP requests.
2167
+ * // param requireApproval - Approval policy ('always'|'never'|filter object). (Removed - always 'never')
2168
+ * @param serverDescription - Optional description of the server.
2169
+ * @param serverUrl - URL for the MCP server.
2170
+ */
2171
+ mcp
2068
2172
  };
2069
2173
 
2070
2174
  // src/responses/openai-responses-language-model.ts
2071
2175
  var import_provider8 = require("@ai-sdk/provider");
2072
- var import_provider_utils24 = require("@ai-sdk/provider-utils");
2176
+ var import_provider_utils25 = require("@ai-sdk/provider-utils");
2073
2177
 
2074
2178
  // src/responses/convert-to-openai-responses-input.ts
2075
2179
  var import_provider6 = require("@ai-sdk/provider");
2076
- var import_provider_utils20 = require("@ai-sdk/provider-utils");
2077
- var import_v415 = require("zod/v4");
2180
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
2181
+ var import_v416 = require("zod/v4");
2078
2182
  function isFileId(data, prefixes) {
2079
2183
  if (!prefixes) return false;
2080
2184
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -2132,7 +2236,7 @@ async function convertToOpenAIResponsesInput({
2132
2236
  return {
2133
2237
  type: "input_image",
2134
2238
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2135
- image_url: `data:${mediaType};base64,${(0, import_provider_utils20.convertToBase64)(part.data)}`
2239
+ image_url: `data:${mediaType};base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
2136
2240
  },
2137
2241
  detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail
2138
2242
  };
@@ -2147,7 +2251,7 @@ async function convertToOpenAIResponsesInput({
2147
2251
  type: "input_file",
2148
2252
  ...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2149
2253
  filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
2150
- file_data: `data:application/pdf;base64,${(0, import_provider_utils20.convertToBase64)(part.data)}`
2254
+ file_data: `data:application/pdf;base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
2151
2255
  }
2152
2256
  };
2153
2257
  } else {
@@ -2190,7 +2294,7 @@ async function convertToOpenAIResponsesInput({
2190
2294
  break;
2191
2295
  }
2192
2296
  if (hasLocalShellTool && part.toolName === "local_shell") {
2193
- const parsedInput = await (0, import_provider_utils20.validateTypes)({
2297
+ const parsedInput = await (0, import_provider_utils21.validateTypes)({
2194
2298
  value: part.input,
2195
2299
  schema: localShellInputSchema
2196
2300
  });
@@ -2231,7 +2335,7 @@ async function convertToOpenAIResponsesInput({
2231
2335
  break;
2232
2336
  }
2233
2337
  case "reasoning": {
2234
- const providerOptions = await (0, import_provider_utils20.parseProviderOptions)({
2338
+ const providerOptions = await (0, import_provider_utils21.parseProviderOptions)({
2235
2339
  provider: "openai",
2236
2340
  providerOptions: part.providerOptions,
2237
2341
  schema: openaiResponsesReasoningProviderOptionsSchema
@@ -2292,7 +2396,7 @@ async function convertToOpenAIResponsesInput({
2292
2396
  for (const part of content) {
2293
2397
  const output = part.output;
2294
2398
  if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
2295
- const parsedOutput = await (0, import_provider_utils20.validateTypes)({
2399
+ const parsedOutput = await (0, import_provider_utils21.validateTypes)({
2296
2400
  value: output.value,
2297
2401
  schema: localShellOutputSchema
2298
2402
  });
@@ -2344,7 +2448,7 @@ async function convertToOpenAIResponsesInput({
2344
2448
  return void 0;
2345
2449
  }
2346
2450
  }
2347
- }).filter(import_provider_utils20.isNonNullable);
2451
+ }).filter(import_provider_utils21.isNonNullable);
2348
2452
  break;
2349
2453
  }
2350
2454
  input.push({
@@ -2363,9 +2467,9 @@ async function convertToOpenAIResponsesInput({
2363
2467
  }
2364
2468
  return { input, warnings };
2365
2469
  }
2366
- var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
2367
- itemId: import_v415.z.string().nullish(),
2368
- reasoningEncryptedContent: import_v415.z.string().nullish()
2470
+ var openaiResponsesReasoningProviderOptionsSchema = import_v416.z.object({
2471
+ itemId: import_v416.z.string().nullish(),
2472
+ reasoningEncryptedContent: import_v416.z.string().nullish()
2369
2473
  });
2370
2474
 
2371
2475
  // src/responses/map-openai-responses-finish-reason.ts
@@ -2387,285 +2491,344 @@ function mapOpenAIResponseFinishReason({
2387
2491
  }
2388
2492
 
2389
2493
  // src/responses/openai-responses-api.ts
2390
- var import_provider_utils21 = require("@ai-sdk/provider-utils");
2391
- var import_v416 = require("zod/v4");
2392
- var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
2393
- () => (0, import_provider_utils21.zodSchema)(
2394
- import_v416.z.union([
2395
- import_v416.z.object({
2396
- type: import_v416.z.literal("response.output_text.delta"),
2397
- item_id: import_v416.z.string(),
2398
- delta: import_v416.z.string(),
2399
- logprobs: import_v416.z.array(
2400
- import_v416.z.object({
2401
- token: import_v416.z.string(),
2402
- logprob: import_v416.z.number(),
2403
- top_logprobs: import_v416.z.array(
2404
- import_v416.z.object({
2405
- token: import_v416.z.string(),
2406
- logprob: import_v416.z.number()
2494
+ var import_provider_utils22 = require("@ai-sdk/provider-utils");
2495
+ var import_v417 = require("zod/v4");
2496
+ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
2497
+ () => (0, import_provider_utils22.zodSchema)(
2498
+ import_v417.z.union([
2499
+ import_v417.z.object({
2500
+ type: import_v417.z.literal("response.output_text.delta"),
2501
+ item_id: import_v417.z.string(),
2502
+ delta: import_v417.z.string(),
2503
+ logprobs: import_v417.z.array(
2504
+ import_v417.z.object({
2505
+ token: import_v417.z.string(),
2506
+ logprob: import_v417.z.number(),
2507
+ top_logprobs: import_v417.z.array(
2508
+ import_v417.z.object({
2509
+ token: import_v417.z.string(),
2510
+ logprob: import_v417.z.number()
2407
2511
  })
2408
2512
  )
2409
2513
  })
2410
2514
  ).nullish()
2411
2515
  }),
2412
- import_v416.z.object({
2413
- type: import_v416.z.enum(["response.completed", "response.incomplete"]),
2414
- response: import_v416.z.object({
2415
- incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
2416
- usage: import_v416.z.object({
2417
- input_tokens: import_v416.z.number(),
2418
- input_tokens_details: import_v416.z.object({ cached_tokens: import_v416.z.number().nullish() }).nullish(),
2419
- output_tokens: import_v416.z.number(),
2420
- output_tokens_details: import_v416.z.object({ reasoning_tokens: import_v416.z.number().nullish() }).nullish()
2516
+ import_v417.z.object({
2517
+ type: import_v417.z.enum(["response.completed", "response.incomplete"]),
2518
+ response: import_v417.z.object({
2519
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
2520
+ usage: import_v417.z.object({
2521
+ input_tokens: import_v417.z.number(),
2522
+ input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
2523
+ output_tokens: import_v417.z.number(),
2524
+ output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
2421
2525
  }),
2422
- service_tier: import_v416.z.string().nullish()
2526
+ service_tier: import_v417.z.string().nullish()
2423
2527
  })
2424
2528
  }),
2425
- import_v416.z.object({
2426
- type: import_v416.z.literal("response.created"),
2427
- response: import_v416.z.object({
2428
- id: import_v416.z.string(),
2429
- created_at: import_v416.z.number(),
2430
- model: import_v416.z.string(),
2431
- service_tier: import_v416.z.string().nullish()
2529
+ import_v417.z.object({
2530
+ type: import_v417.z.literal("response.created"),
2531
+ response: import_v417.z.object({
2532
+ id: import_v417.z.string(),
2533
+ created_at: import_v417.z.number(),
2534
+ model: import_v417.z.string(),
2535
+ service_tier: import_v417.z.string().nullish()
2432
2536
  })
2433
2537
  }),
2434
- import_v416.z.object({
2435
- type: import_v416.z.literal("response.output_item.added"),
2436
- output_index: import_v416.z.number(),
2437
- item: import_v416.z.discriminatedUnion("type", [
2438
- import_v416.z.object({
2439
- type: import_v416.z.literal("message"),
2440
- id: import_v416.z.string()
2538
+ import_v417.z.object({
2539
+ type: import_v417.z.literal("response.output_item.added"),
2540
+ output_index: import_v417.z.number(),
2541
+ item: import_v417.z.discriminatedUnion("type", [
2542
+ import_v417.z.object({
2543
+ type: import_v417.z.literal("message"),
2544
+ id: import_v417.z.string()
2441
2545
  }),
2442
- import_v416.z.object({
2443
- type: import_v416.z.literal("reasoning"),
2444
- id: import_v416.z.string(),
2445
- encrypted_content: import_v416.z.string().nullish()
2546
+ import_v417.z.object({
2547
+ type: import_v417.z.literal("reasoning"),
2548
+ id: import_v417.z.string(),
2549
+ encrypted_content: import_v417.z.string().nullish()
2446
2550
  }),
2447
- import_v416.z.object({
2448
- type: import_v416.z.literal("function_call"),
2449
- id: import_v416.z.string(),
2450
- call_id: import_v416.z.string(),
2451
- name: import_v416.z.string(),
2452
- arguments: import_v416.z.string()
2551
+ import_v417.z.object({
2552
+ type: import_v417.z.literal("function_call"),
2553
+ id: import_v417.z.string(),
2554
+ call_id: import_v417.z.string(),
2555
+ name: import_v417.z.string(),
2556
+ arguments: import_v417.z.string()
2453
2557
  }),
2454
- import_v416.z.object({
2455
- type: import_v416.z.literal("web_search_call"),
2456
- id: import_v416.z.string(),
2457
- status: import_v416.z.string()
2558
+ import_v417.z.object({
2559
+ type: import_v417.z.literal("web_search_call"),
2560
+ id: import_v417.z.string(),
2561
+ status: import_v417.z.string()
2458
2562
  }),
2459
- import_v416.z.object({
2460
- type: import_v416.z.literal("computer_call"),
2461
- id: import_v416.z.string(),
2462
- status: import_v416.z.string()
2563
+ import_v417.z.object({
2564
+ type: import_v417.z.literal("computer_call"),
2565
+ id: import_v417.z.string(),
2566
+ status: import_v417.z.string()
2463
2567
  }),
2464
- import_v416.z.object({
2465
- type: import_v416.z.literal("file_search_call"),
2466
- id: import_v416.z.string()
2568
+ import_v417.z.object({
2569
+ type: import_v417.z.literal("file_search_call"),
2570
+ id: import_v417.z.string()
2467
2571
  }),
2468
- import_v416.z.object({
2469
- type: import_v416.z.literal("image_generation_call"),
2470
- id: import_v416.z.string()
2572
+ import_v417.z.object({
2573
+ type: import_v417.z.literal("image_generation_call"),
2574
+ id: import_v417.z.string()
2471
2575
  }),
2472
- import_v416.z.object({
2473
- type: import_v416.z.literal("code_interpreter_call"),
2474
- id: import_v416.z.string(),
2475
- container_id: import_v416.z.string(),
2476
- code: import_v416.z.string().nullable(),
2477
- outputs: import_v416.z.array(
2478
- import_v416.z.discriminatedUnion("type", [
2479
- import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
2480
- import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
2576
+ import_v417.z.object({
2577
+ type: import_v417.z.literal("code_interpreter_call"),
2578
+ id: import_v417.z.string(),
2579
+ container_id: import_v417.z.string(),
2580
+ code: import_v417.z.string().nullable(),
2581
+ outputs: import_v417.z.array(
2582
+ import_v417.z.discriminatedUnion("type", [
2583
+ import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
2584
+ import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
2481
2585
  ])
2482
2586
  ).nullable(),
2483
- status: import_v416.z.string()
2587
+ status: import_v417.z.string()
2588
+ }),
2589
+ import_v417.z.object({
2590
+ type: import_v417.z.literal("mcp_call"),
2591
+ id: import_v417.z.string(),
2592
+ status: import_v417.z.string()
2593
+ }),
2594
+ import_v417.z.object({
2595
+ type: import_v417.z.literal("mcp_list_tools"),
2596
+ id: import_v417.z.string()
2597
+ }),
2598
+ import_v417.z.object({
2599
+ type: import_v417.z.literal("mcp_approval_request"),
2600
+ id: import_v417.z.string()
2484
2601
  })
2485
2602
  ])
2486
2603
  }),
2487
- import_v416.z.object({
2488
- type: import_v416.z.literal("response.output_item.done"),
2489
- output_index: import_v416.z.number(),
2490
- item: import_v416.z.discriminatedUnion("type", [
2491
- import_v416.z.object({
2492
- type: import_v416.z.literal("message"),
2493
- id: import_v416.z.string()
2604
+ import_v417.z.object({
2605
+ type: import_v417.z.literal("response.output_item.done"),
2606
+ output_index: import_v417.z.number(),
2607
+ item: import_v417.z.discriminatedUnion("type", [
2608
+ import_v417.z.object({
2609
+ type: import_v417.z.literal("message"),
2610
+ id: import_v417.z.string()
2494
2611
  }),
2495
- import_v416.z.object({
2496
- type: import_v416.z.literal("reasoning"),
2497
- id: import_v416.z.string(),
2498
- encrypted_content: import_v416.z.string().nullish()
2612
+ import_v417.z.object({
2613
+ type: import_v417.z.literal("reasoning"),
2614
+ id: import_v417.z.string(),
2615
+ encrypted_content: import_v417.z.string().nullish()
2499
2616
  }),
2500
- import_v416.z.object({
2501
- type: import_v416.z.literal("function_call"),
2502
- id: import_v416.z.string(),
2503
- call_id: import_v416.z.string(),
2504
- name: import_v416.z.string(),
2505
- arguments: import_v416.z.string(),
2506
- status: import_v416.z.literal("completed")
2617
+ import_v417.z.object({
2618
+ type: import_v417.z.literal("function_call"),
2619
+ id: import_v417.z.string(),
2620
+ call_id: import_v417.z.string(),
2621
+ name: import_v417.z.string(),
2622
+ arguments: import_v417.z.string(),
2623
+ status: import_v417.z.literal("completed")
2507
2624
  }),
2508
- import_v416.z.object({
2509
- type: import_v416.z.literal("code_interpreter_call"),
2510
- id: import_v416.z.string(),
2511
- code: import_v416.z.string().nullable(),
2512
- container_id: import_v416.z.string(),
2513
- outputs: import_v416.z.array(
2514
- import_v416.z.discriminatedUnion("type", [
2515
- import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
2516
- import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
2625
+ import_v417.z.object({
2626
+ type: import_v417.z.literal("code_interpreter_call"),
2627
+ id: import_v417.z.string(),
2628
+ code: import_v417.z.string().nullable(),
2629
+ container_id: import_v417.z.string(),
2630
+ outputs: import_v417.z.array(
2631
+ import_v417.z.discriminatedUnion("type", [
2632
+ import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
2633
+ import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
2517
2634
  ])
2518
2635
  ).nullable()
2519
2636
  }),
2520
- import_v416.z.object({
2521
- type: import_v416.z.literal("image_generation_call"),
2522
- id: import_v416.z.string(),
2523
- result: import_v416.z.string()
2637
+ import_v417.z.object({
2638
+ type: import_v417.z.literal("image_generation_call"),
2639
+ id: import_v417.z.string(),
2640
+ result: import_v417.z.string()
2524
2641
  }),
2525
- import_v416.z.object({
2526
- type: import_v416.z.literal("web_search_call"),
2527
- id: import_v416.z.string(),
2528
- status: import_v416.z.string(),
2529
- action: import_v416.z.discriminatedUnion("type", [
2530
- import_v416.z.object({
2531
- type: import_v416.z.literal("search"),
2532
- query: import_v416.z.string().nullish(),
2533
- sources: import_v416.z.array(
2534
- import_v416.z.discriminatedUnion("type", [
2535
- import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
2536
- import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
2642
+ import_v417.z.object({
2643
+ type: import_v417.z.literal("web_search_call"),
2644
+ id: import_v417.z.string(),
2645
+ status: import_v417.z.string(),
2646
+ action: import_v417.z.discriminatedUnion("type", [
2647
+ import_v417.z.object({
2648
+ type: import_v417.z.literal("search"),
2649
+ query: import_v417.z.string().nullish(),
2650
+ sources: import_v417.z.array(
2651
+ import_v417.z.discriminatedUnion("type", [
2652
+ import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
2653
+ import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
2537
2654
  ])
2538
2655
  ).nullish()
2539
2656
  }),
2540
- import_v416.z.object({
2541
- type: import_v416.z.literal("open_page"),
2542
- url: import_v416.z.string()
2657
+ import_v417.z.object({
2658
+ type: import_v417.z.literal("open_page"),
2659
+ url: import_v417.z.string()
2543
2660
  }),
2544
- import_v416.z.object({
2545
- type: import_v416.z.literal("find"),
2546
- url: import_v416.z.string(),
2547
- pattern: import_v416.z.string()
2661
+ import_v417.z.object({
2662
+ type: import_v417.z.literal("find"),
2663
+ url: import_v417.z.string(),
2664
+ pattern: import_v417.z.string()
2548
2665
  })
2549
2666
  ])
2550
2667
  }),
2551
- import_v416.z.object({
2552
- type: import_v416.z.literal("file_search_call"),
2553
- id: import_v416.z.string(),
2554
- queries: import_v416.z.array(import_v416.z.string()),
2555
- results: import_v416.z.array(
2556
- import_v416.z.object({
2557
- attributes: import_v416.z.record(
2558
- import_v416.z.string(),
2559
- import_v416.z.union([import_v416.z.string(), import_v416.z.number(), import_v416.z.boolean()])
2668
+ import_v417.z.object({
2669
+ type: import_v417.z.literal("file_search_call"),
2670
+ id: import_v417.z.string(),
2671
+ queries: import_v417.z.array(import_v417.z.string()),
2672
+ results: import_v417.z.array(
2673
+ import_v417.z.object({
2674
+ attributes: import_v417.z.record(
2675
+ import_v417.z.string(),
2676
+ import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
2560
2677
  ),
2561
- file_id: import_v416.z.string(),
2562
- filename: import_v416.z.string(),
2563
- score: import_v416.z.number(),
2564
- text: import_v416.z.string()
2678
+ file_id: import_v417.z.string(),
2679
+ filename: import_v417.z.string(),
2680
+ score: import_v417.z.number(),
2681
+ text: import_v417.z.string()
2565
2682
  })
2566
2683
  ).nullish()
2567
2684
  }),
2568
- import_v416.z.object({
2569
- type: import_v416.z.literal("local_shell_call"),
2570
- id: import_v416.z.string(),
2571
- call_id: import_v416.z.string(),
2572
- action: import_v416.z.object({
2573
- type: import_v416.z.literal("exec"),
2574
- command: import_v416.z.array(import_v416.z.string()),
2575
- timeout_ms: import_v416.z.number().optional(),
2576
- user: import_v416.z.string().optional(),
2577
- working_directory: import_v416.z.string().optional(),
2578
- env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
2685
+ import_v417.z.object({
2686
+ type: import_v417.z.literal("local_shell_call"),
2687
+ id: import_v417.z.string(),
2688
+ call_id: import_v417.z.string(),
2689
+ action: import_v417.z.object({
2690
+ type: import_v417.z.literal("exec"),
2691
+ command: import_v417.z.array(import_v417.z.string()),
2692
+ timeout_ms: import_v417.z.number().optional(),
2693
+ user: import_v417.z.string().optional(),
2694
+ working_directory: import_v417.z.string().optional(),
2695
+ env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
2579
2696
  })
2580
2697
  }),
2581
- import_v416.z.object({
2582
- type: import_v416.z.literal("computer_call"),
2583
- id: import_v416.z.string(),
2584
- status: import_v416.z.literal("completed")
2698
+ import_v417.z.object({
2699
+ type: import_v417.z.literal("computer_call"),
2700
+ id: import_v417.z.string(),
2701
+ status: import_v417.z.literal("completed")
2702
+ }),
2703
+ import_v417.z.object({
2704
+ type: import_v417.z.literal("mcp_call"),
2705
+ id: import_v417.z.string(),
2706
+ status: import_v417.z.string(),
2707
+ arguments: import_v417.z.string(),
2708
+ name: import_v417.z.string(),
2709
+ server_label: import_v417.z.string(),
2710
+ output: import_v417.z.string().nullish(),
2711
+ error: import_v417.z.union([
2712
+ import_v417.z.string(),
2713
+ import_v417.z.object({
2714
+ type: import_v417.z.string().optional(),
2715
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
2716
+ message: import_v417.z.string().optional()
2717
+ }).loose()
2718
+ ]).nullish()
2719
+ }),
2720
+ import_v417.z.object({
2721
+ type: import_v417.z.literal("mcp_list_tools"),
2722
+ id: import_v417.z.string(),
2723
+ server_label: import_v417.z.string(),
2724
+ tools: import_v417.z.array(
2725
+ import_v417.z.object({
2726
+ name: import_v417.z.string(),
2727
+ description: import_v417.z.string().optional(),
2728
+ input_schema: import_v417.z.any(),
2729
+ annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
2730
+ })
2731
+ ),
2732
+ error: import_v417.z.union([
2733
+ import_v417.z.string(),
2734
+ import_v417.z.object({
2735
+ type: import_v417.z.string().optional(),
2736
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
2737
+ message: import_v417.z.string().optional()
2738
+ }).loose()
2739
+ ]).optional()
2740
+ }),
2741
+ import_v417.z.object({
2742
+ type: import_v417.z.literal("mcp_approval_request"),
2743
+ id: import_v417.z.string(),
2744
+ server_label: import_v417.z.string(),
2745
+ name: import_v417.z.string(),
2746
+ arguments: import_v417.z.string(),
2747
+ approval_request_id: import_v417.z.string()
2585
2748
  })
2586
2749
  ])
2587
2750
  }),
2588
- import_v416.z.object({
2589
- type: import_v416.z.literal("response.function_call_arguments.delta"),
2590
- item_id: import_v416.z.string(),
2591
- output_index: import_v416.z.number(),
2592
- delta: import_v416.z.string()
2751
+ import_v417.z.object({
2752
+ type: import_v417.z.literal("response.function_call_arguments.delta"),
2753
+ item_id: import_v417.z.string(),
2754
+ output_index: import_v417.z.number(),
2755
+ delta: import_v417.z.string()
2593
2756
  }),
2594
- import_v416.z.object({
2595
- type: import_v416.z.literal("response.image_generation_call.partial_image"),
2596
- item_id: import_v416.z.string(),
2597
- output_index: import_v416.z.number(),
2598
- partial_image_b64: import_v416.z.string()
2757
+ import_v417.z.object({
2758
+ type: import_v417.z.literal("response.image_generation_call.partial_image"),
2759
+ item_id: import_v417.z.string(),
2760
+ output_index: import_v417.z.number(),
2761
+ partial_image_b64: import_v417.z.string()
2599
2762
  }),
2600
- import_v416.z.object({
2601
- type: import_v416.z.literal("response.code_interpreter_call_code.delta"),
2602
- item_id: import_v416.z.string(),
2603
- output_index: import_v416.z.number(),
2604
- delta: import_v416.z.string()
2763
+ import_v417.z.object({
2764
+ type: import_v417.z.literal("response.code_interpreter_call_code.delta"),
2765
+ item_id: import_v417.z.string(),
2766
+ output_index: import_v417.z.number(),
2767
+ delta: import_v417.z.string()
2605
2768
  }),
2606
- import_v416.z.object({
2607
- type: import_v416.z.literal("response.code_interpreter_call_code.done"),
2608
- item_id: import_v416.z.string(),
2609
- output_index: import_v416.z.number(),
2610
- code: import_v416.z.string()
2769
+ import_v417.z.object({
2770
+ type: import_v417.z.literal("response.code_interpreter_call_code.done"),
2771
+ item_id: import_v417.z.string(),
2772
+ output_index: import_v417.z.number(),
2773
+ code: import_v417.z.string()
2611
2774
  }),
2612
- import_v416.z.object({
2613
- type: import_v416.z.literal("response.output_text.annotation.added"),
2614
- annotation: import_v416.z.discriminatedUnion("type", [
2615
- import_v416.z.object({
2616
- type: import_v416.z.literal("url_citation"),
2617
- url: import_v416.z.string(),
2618
- title: import_v416.z.string()
2775
+ import_v417.z.object({
2776
+ type: import_v417.z.literal("response.output_text.annotation.added"),
2777
+ annotation: import_v417.z.discriminatedUnion("type", [
2778
+ import_v417.z.object({
2779
+ type: import_v417.z.literal("url_citation"),
2780
+ url: import_v417.z.string(),
2781
+ title: import_v417.z.string()
2619
2782
  }),
2620
- import_v416.z.object({
2621
- type: import_v416.z.literal("file_citation"),
2622
- file_id: import_v416.z.string(),
2623
- filename: import_v416.z.string().nullish(),
2624
- index: import_v416.z.number().nullish(),
2625
- start_index: import_v416.z.number().nullish(),
2626
- end_index: import_v416.z.number().nullish(),
2627
- quote: import_v416.z.string().nullish()
2783
+ import_v417.z.object({
2784
+ type: import_v417.z.literal("file_citation"),
2785
+ file_id: import_v417.z.string(),
2786
+ filename: import_v417.z.string().nullish(),
2787
+ index: import_v417.z.number().nullish(),
2788
+ start_index: import_v417.z.number().nullish(),
2789
+ end_index: import_v417.z.number().nullish(),
2790
+ quote: import_v417.z.string().nullish()
2628
2791
  }),
2629
- import_v416.z.object({
2630
- type: import_v416.z.literal("container_file_citation"),
2631
- container_id: import_v416.z.string(),
2632
- file_id: import_v416.z.string(),
2633
- filename: import_v416.z.string().nullish(),
2634
- start_index: import_v416.z.number().nullish(),
2635
- end_index: import_v416.z.number().nullish(),
2636
- index: import_v416.z.number().nullish()
2792
+ import_v417.z.object({
2793
+ type: import_v417.z.literal("container_file_citation"),
2794
+ container_id: import_v417.z.string(),
2795
+ file_id: import_v417.z.string(),
2796
+ filename: import_v417.z.string().nullish(),
2797
+ start_index: import_v417.z.number().nullish(),
2798
+ end_index: import_v417.z.number().nullish(),
2799
+ index: import_v417.z.number().nullish()
2637
2800
  }),
2638
- import_v416.z.object({
2639
- type: import_v416.z.literal("file_path"),
2640
- file_id: import_v416.z.string(),
2641
- index: import_v416.z.number().nullish()
2801
+ import_v417.z.object({
2802
+ type: import_v417.z.literal("file_path"),
2803
+ file_id: import_v417.z.string(),
2804
+ index: import_v417.z.number().nullish()
2642
2805
  })
2643
2806
  ])
2644
2807
  }),
2645
- import_v416.z.object({
2646
- type: import_v416.z.literal("response.reasoning_summary_part.added"),
2647
- item_id: import_v416.z.string(),
2648
- summary_index: import_v416.z.number()
2808
+ import_v417.z.object({
2809
+ type: import_v417.z.literal("response.reasoning_summary_part.added"),
2810
+ item_id: import_v417.z.string(),
2811
+ summary_index: import_v417.z.number()
2649
2812
  }),
2650
- import_v416.z.object({
2651
- type: import_v416.z.literal("response.reasoning_summary_text.delta"),
2652
- item_id: import_v416.z.string(),
2653
- summary_index: import_v416.z.number(),
2654
- delta: import_v416.z.string()
2813
+ import_v417.z.object({
2814
+ type: import_v417.z.literal("response.reasoning_summary_text.delta"),
2815
+ item_id: import_v417.z.string(),
2816
+ summary_index: import_v417.z.number(),
2817
+ delta: import_v417.z.string()
2655
2818
  }),
2656
- import_v416.z.object({
2657
- type: import_v416.z.literal("response.reasoning_summary_part.done"),
2658
- item_id: import_v416.z.string(),
2659
- summary_index: import_v416.z.number()
2819
+ import_v417.z.object({
2820
+ type: import_v417.z.literal("response.reasoning_summary_part.done"),
2821
+ item_id: import_v417.z.string(),
2822
+ summary_index: import_v417.z.number()
2660
2823
  }),
2661
- import_v416.z.object({
2662
- type: import_v416.z.literal("error"),
2663
- code: import_v416.z.string(),
2664
- message: import_v416.z.string(),
2665
- param: import_v416.z.string().nullish(),
2666
- sequence_number: import_v416.z.number()
2824
+ import_v417.z.object({
2825
+ type: import_v417.z.literal("error"),
2826
+ code: import_v417.z.string(),
2827
+ message: import_v417.z.string(),
2828
+ param: import_v417.z.string().nullish(),
2829
+ sequence_number: import_v417.z.number()
2667
2830
  }),
2668
- import_v416.z.object({ type: import_v416.z.string() }).loose().transform((value) => ({
2831
+ import_v417.z.object({ type: import_v417.z.string() }).loose().transform((value) => ({
2669
2832
  type: "unknown_chunk",
2670
2833
  message: value.type
2671
2834
  }))
@@ -2673,188 +2836,234 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazySchema)(
2673
2836
  ])
2674
2837
  )
2675
2838
  );
2676
- var openaiResponsesResponseSchema = (0, import_provider_utils21.lazySchema)(
2677
- () => (0, import_provider_utils21.zodSchema)(
2678
- import_v416.z.object({
2679
- id: import_v416.z.string(),
2680
- created_at: import_v416.z.number(),
2681
- error: import_v416.z.object({
2682
- code: import_v416.z.string(),
2683
- message: import_v416.z.string()
2839
+ var openaiResponsesResponseSchema = (0, import_provider_utils22.lazySchema)(
2840
+ () => (0, import_provider_utils22.zodSchema)(
2841
+ import_v417.z.object({
2842
+ id: import_v417.z.string(),
2843
+ created_at: import_v417.z.number(),
2844
+ error: import_v417.z.object({
2845
+ code: import_v417.z.string(),
2846
+ message: import_v417.z.string()
2684
2847
  }).nullish(),
2685
- model: import_v416.z.string(),
2686
- output: import_v416.z.array(
2687
- import_v416.z.discriminatedUnion("type", [
2688
- import_v416.z.object({
2689
- type: import_v416.z.literal("message"),
2690
- role: import_v416.z.literal("assistant"),
2691
- id: import_v416.z.string(),
2692
- content: import_v416.z.array(
2693
- import_v416.z.object({
2694
- type: import_v416.z.literal("output_text"),
2695
- text: import_v416.z.string(),
2696
- logprobs: import_v416.z.array(
2697
- import_v416.z.object({
2698
- token: import_v416.z.string(),
2699
- logprob: import_v416.z.number(),
2700
- top_logprobs: import_v416.z.array(
2701
- import_v416.z.object({
2702
- token: import_v416.z.string(),
2703
- logprob: import_v416.z.number()
2848
+ model: import_v417.z.string(),
2849
+ output: import_v417.z.array(
2850
+ import_v417.z.discriminatedUnion("type", [
2851
+ import_v417.z.object({
2852
+ type: import_v417.z.literal("message"),
2853
+ role: import_v417.z.literal("assistant"),
2854
+ id: import_v417.z.string(),
2855
+ content: import_v417.z.array(
2856
+ import_v417.z.object({
2857
+ type: import_v417.z.literal("output_text"),
2858
+ text: import_v417.z.string(),
2859
+ logprobs: import_v417.z.array(
2860
+ import_v417.z.object({
2861
+ token: import_v417.z.string(),
2862
+ logprob: import_v417.z.number(),
2863
+ top_logprobs: import_v417.z.array(
2864
+ import_v417.z.object({
2865
+ token: import_v417.z.string(),
2866
+ logprob: import_v417.z.number()
2704
2867
  })
2705
2868
  )
2706
2869
  })
2707
2870
  ).nullish(),
2708
- annotations: import_v416.z.array(
2709
- import_v416.z.discriminatedUnion("type", [
2710
- import_v416.z.object({
2711
- type: import_v416.z.literal("url_citation"),
2712
- start_index: import_v416.z.number(),
2713
- end_index: import_v416.z.number(),
2714
- url: import_v416.z.string(),
2715
- title: import_v416.z.string()
2871
+ annotations: import_v417.z.array(
2872
+ import_v417.z.discriminatedUnion("type", [
2873
+ import_v417.z.object({
2874
+ type: import_v417.z.literal("url_citation"),
2875
+ start_index: import_v417.z.number(),
2876
+ end_index: import_v417.z.number(),
2877
+ url: import_v417.z.string(),
2878
+ title: import_v417.z.string()
2716
2879
  }),
2717
- import_v416.z.object({
2718
- type: import_v416.z.literal("file_citation"),
2719
- file_id: import_v416.z.string(),
2720
- filename: import_v416.z.string().nullish(),
2721
- index: import_v416.z.number().nullish(),
2722
- start_index: import_v416.z.number().nullish(),
2723
- end_index: import_v416.z.number().nullish(),
2724
- quote: import_v416.z.string().nullish()
2880
+ import_v417.z.object({
2881
+ type: import_v417.z.literal("file_citation"),
2882
+ file_id: import_v417.z.string(),
2883
+ filename: import_v417.z.string().nullish(),
2884
+ index: import_v417.z.number().nullish(),
2885
+ start_index: import_v417.z.number().nullish(),
2886
+ end_index: import_v417.z.number().nullish(),
2887
+ quote: import_v417.z.string().nullish()
2725
2888
  }),
2726
- import_v416.z.object({
2727
- type: import_v416.z.literal("container_file_citation"),
2728
- container_id: import_v416.z.string(),
2729
- file_id: import_v416.z.string(),
2730
- filename: import_v416.z.string().nullish(),
2731
- start_index: import_v416.z.number().nullish(),
2732
- end_index: import_v416.z.number().nullish(),
2733
- index: import_v416.z.number().nullish()
2889
+ import_v417.z.object({
2890
+ type: import_v417.z.literal("container_file_citation"),
2891
+ container_id: import_v417.z.string(),
2892
+ file_id: import_v417.z.string(),
2893
+ filename: import_v417.z.string().nullish(),
2894
+ start_index: import_v417.z.number().nullish(),
2895
+ end_index: import_v417.z.number().nullish(),
2896
+ index: import_v417.z.number().nullish()
2734
2897
  }),
2735
- import_v416.z.object({
2736
- type: import_v416.z.literal("file_path"),
2737
- file_id: import_v416.z.string(),
2738
- index: import_v416.z.number().nullish()
2898
+ import_v417.z.object({
2899
+ type: import_v417.z.literal("file_path"),
2900
+ file_id: import_v417.z.string(),
2901
+ index: import_v417.z.number().nullish()
2739
2902
  })
2740
2903
  ])
2741
2904
  )
2742
2905
  })
2743
2906
  )
2744
2907
  }),
2745
- import_v416.z.object({
2746
- type: import_v416.z.literal("web_search_call"),
2747
- id: import_v416.z.string(),
2748
- status: import_v416.z.string(),
2749
- action: import_v416.z.discriminatedUnion("type", [
2750
- import_v416.z.object({
2751
- type: import_v416.z.literal("search"),
2752
- query: import_v416.z.string().nullish(),
2753
- sources: import_v416.z.array(
2754
- import_v416.z.discriminatedUnion("type", [
2755
- import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
2756
- import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
2908
+ import_v417.z.object({
2909
+ type: import_v417.z.literal("web_search_call"),
2910
+ id: import_v417.z.string(),
2911
+ status: import_v417.z.string(),
2912
+ action: import_v417.z.discriminatedUnion("type", [
2913
+ import_v417.z.object({
2914
+ type: import_v417.z.literal("search"),
2915
+ query: import_v417.z.string().nullish(),
2916
+ sources: import_v417.z.array(
2917
+ import_v417.z.discriminatedUnion("type", [
2918
+ import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
2919
+ import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
2757
2920
  ])
2758
2921
  ).nullish()
2759
2922
  }),
2760
- import_v416.z.object({
2761
- type: import_v416.z.literal("open_page"),
2762
- url: import_v416.z.string()
2923
+ import_v417.z.object({
2924
+ type: import_v417.z.literal("open_page"),
2925
+ url: import_v417.z.string()
2763
2926
  }),
2764
- import_v416.z.object({
2765
- type: import_v416.z.literal("find"),
2766
- url: import_v416.z.string(),
2767
- pattern: import_v416.z.string()
2927
+ import_v417.z.object({
2928
+ type: import_v417.z.literal("find"),
2929
+ url: import_v417.z.string(),
2930
+ pattern: import_v417.z.string()
2768
2931
  })
2769
2932
  ])
2770
2933
  }),
2771
- import_v416.z.object({
2772
- type: import_v416.z.literal("file_search_call"),
2773
- id: import_v416.z.string(),
2774
- queries: import_v416.z.array(import_v416.z.string()),
2775
- results: import_v416.z.array(
2776
- import_v416.z.object({
2777
- attributes: import_v416.z.record(
2778
- import_v416.z.string(),
2779
- import_v416.z.union([import_v416.z.string(), import_v416.z.number(), import_v416.z.boolean()])
2934
+ import_v417.z.object({
2935
+ type: import_v417.z.literal("file_search_call"),
2936
+ id: import_v417.z.string(),
2937
+ queries: import_v417.z.array(import_v417.z.string()),
2938
+ results: import_v417.z.array(
2939
+ import_v417.z.object({
2940
+ attributes: import_v417.z.record(
2941
+ import_v417.z.string(),
2942
+ import_v417.z.union([import_v417.z.string(), import_v417.z.number(), import_v417.z.boolean()])
2780
2943
  ),
2781
- file_id: import_v416.z.string(),
2782
- filename: import_v416.z.string(),
2783
- score: import_v416.z.number(),
2784
- text: import_v416.z.string()
2944
+ file_id: import_v417.z.string(),
2945
+ filename: import_v417.z.string(),
2946
+ score: import_v417.z.number(),
2947
+ text: import_v417.z.string()
2785
2948
  })
2786
2949
  ).nullish()
2787
2950
  }),
2788
- import_v416.z.object({
2789
- type: import_v416.z.literal("code_interpreter_call"),
2790
- id: import_v416.z.string(),
2791
- code: import_v416.z.string().nullable(),
2792
- container_id: import_v416.z.string(),
2793
- outputs: import_v416.z.array(
2794
- import_v416.z.discriminatedUnion("type", [
2795
- import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
2796
- import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
2951
+ import_v417.z.object({
2952
+ type: import_v417.z.literal("code_interpreter_call"),
2953
+ id: import_v417.z.string(),
2954
+ code: import_v417.z.string().nullable(),
2955
+ container_id: import_v417.z.string(),
2956
+ outputs: import_v417.z.array(
2957
+ import_v417.z.discriminatedUnion("type", [
2958
+ import_v417.z.object({ type: import_v417.z.literal("logs"), logs: import_v417.z.string() }),
2959
+ import_v417.z.object({ type: import_v417.z.literal("image"), url: import_v417.z.string() })
2797
2960
  ])
2798
2961
  ).nullable()
2799
2962
  }),
2800
- import_v416.z.object({
2801
- type: import_v416.z.literal("image_generation_call"),
2802
- id: import_v416.z.string(),
2803
- result: import_v416.z.string()
2963
+ import_v417.z.object({
2964
+ type: import_v417.z.literal("image_generation_call"),
2965
+ id: import_v417.z.string(),
2966
+ result: import_v417.z.string()
2804
2967
  }),
2805
- import_v416.z.object({
2806
- type: import_v416.z.literal("local_shell_call"),
2807
- id: import_v416.z.string(),
2808
- call_id: import_v416.z.string(),
2809
- action: import_v416.z.object({
2810
- type: import_v416.z.literal("exec"),
2811
- command: import_v416.z.array(import_v416.z.string()),
2812
- timeout_ms: import_v416.z.number().optional(),
2813
- user: import_v416.z.string().optional(),
2814
- working_directory: import_v416.z.string().optional(),
2815
- env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
2968
+ import_v417.z.object({
2969
+ type: import_v417.z.literal("local_shell_call"),
2970
+ id: import_v417.z.string(),
2971
+ call_id: import_v417.z.string(),
2972
+ action: import_v417.z.object({
2973
+ type: import_v417.z.literal("exec"),
2974
+ command: import_v417.z.array(import_v417.z.string()),
2975
+ timeout_ms: import_v417.z.number().optional(),
2976
+ user: import_v417.z.string().optional(),
2977
+ working_directory: import_v417.z.string().optional(),
2978
+ env: import_v417.z.record(import_v417.z.string(), import_v417.z.string()).optional()
2816
2979
  })
2817
2980
  }),
2818
- import_v416.z.object({
2819
- type: import_v416.z.literal("function_call"),
2820
- call_id: import_v416.z.string(),
2821
- name: import_v416.z.string(),
2822
- arguments: import_v416.z.string(),
2823
- id: import_v416.z.string()
2981
+ import_v417.z.object({
2982
+ type: import_v417.z.literal("function_call"),
2983
+ call_id: import_v417.z.string(),
2984
+ name: import_v417.z.string(),
2985
+ arguments: import_v417.z.string(),
2986
+ id: import_v417.z.string()
2824
2987
  }),
2825
- import_v416.z.object({
2826
- type: import_v416.z.literal("computer_call"),
2827
- id: import_v416.z.string(),
2828
- status: import_v416.z.string().optional()
2988
+ import_v417.z.object({
2989
+ type: import_v417.z.literal("computer_call"),
2990
+ id: import_v417.z.string(),
2991
+ status: import_v417.z.string().optional()
2829
2992
  }),
2830
- import_v416.z.object({
2831
- type: import_v416.z.literal("reasoning"),
2832
- id: import_v416.z.string(),
2833
- encrypted_content: import_v416.z.string().nullish(),
2834
- summary: import_v416.z.array(
2835
- import_v416.z.object({
2836
- type: import_v416.z.literal("summary_text"),
2837
- text: import_v416.z.string()
2993
+ import_v417.z.object({
2994
+ type: import_v417.z.literal("reasoning"),
2995
+ id: import_v417.z.string(),
2996
+ encrypted_content: import_v417.z.string().nullish(),
2997
+ summary: import_v417.z.array(
2998
+ import_v417.z.object({
2999
+ type: import_v417.z.literal("summary_text"),
3000
+ text: import_v417.z.string()
2838
3001
  })
2839
3002
  )
3003
+ }),
3004
+ import_v417.z.object({
3005
+ type: import_v417.z.literal("mcp_call"),
3006
+ id: import_v417.z.string(),
3007
+ status: import_v417.z.string(),
3008
+ arguments: import_v417.z.string(),
3009
+ name: import_v417.z.string(),
3010
+ server_label: import_v417.z.string(),
3011
+ output: import_v417.z.string().nullish(),
3012
+ error: import_v417.z.union([
3013
+ import_v417.z.string(),
3014
+ import_v417.z.object({
3015
+ type: import_v417.z.string().optional(),
3016
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3017
+ message: import_v417.z.string().optional()
3018
+ }).loose()
3019
+ ]).nullish()
3020
+ }),
3021
+ import_v417.z.object({
3022
+ type: import_v417.z.literal("mcp_list_tools"),
3023
+ id: import_v417.z.string(),
3024
+ server_label: import_v417.z.string(),
3025
+ tools: import_v417.z.array(
3026
+ import_v417.z.object({
3027
+ name: import_v417.z.string(),
3028
+ description: import_v417.z.string().optional(),
3029
+ input_schema: import_v417.z.any(),
3030
+ annotations: import_v417.z.record(import_v417.z.string(), import_v417.z.unknown()).optional()
3031
+ })
3032
+ ),
3033
+ error: import_v417.z.union([
3034
+ import_v417.z.string(),
3035
+ import_v417.z.object({
3036
+ type: import_v417.z.string().optional(),
3037
+ code: import_v417.z.union([import_v417.z.number(), import_v417.z.string()]).optional(),
3038
+ message: import_v417.z.string().optional()
3039
+ }).loose()
3040
+ ]).optional()
3041
+ }),
3042
+ import_v417.z.object({
3043
+ type: import_v417.z.literal("mcp_approval_request"),
3044
+ id: import_v417.z.string(),
3045
+ server_label: import_v417.z.string(),
3046
+ name: import_v417.z.string(),
3047
+ arguments: import_v417.z.string(),
3048
+ approval_request_id: import_v417.z.string()
2840
3049
  })
2841
3050
  ])
2842
3051
  ),
2843
- service_tier: import_v416.z.string().nullish(),
2844
- incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
2845
- usage: import_v416.z.object({
2846
- input_tokens: import_v416.z.number(),
2847
- input_tokens_details: import_v416.z.object({ cached_tokens: import_v416.z.number().nullish() }).nullish(),
2848
- output_tokens: import_v416.z.number(),
2849
- output_tokens_details: import_v416.z.object({ reasoning_tokens: import_v416.z.number().nullish() }).nullish()
3052
+ service_tier: import_v417.z.string().nullish(),
3053
+ incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
3054
+ usage: import_v417.z.object({
3055
+ input_tokens: import_v417.z.number(),
3056
+ input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
3057
+ output_tokens: import_v417.z.number(),
3058
+ output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
2850
3059
  })
2851
3060
  })
2852
3061
  )
2853
3062
  );
2854
3063
 
2855
3064
  // src/responses/openai-responses-options.ts
2856
- var import_provider_utils22 = require("@ai-sdk/provider-utils");
2857
- var import_v417 = require("zod/v4");
3065
+ var import_provider_utils23 = require("@ai-sdk/provider-utils");
3066
+ var import_v418 = require("zod/v4");
2858
3067
  var TOP_LOGPROBS_MAX = 20;
2859
3068
  var openaiResponsesReasoningModelIds = [
2860
3069
  "o1",
@@ -2917,18 +3126,18 @@ var openaiResponsesModelIds = [
2917
3126
  "gpt-5-chat-latest",
2918
3127
  ...openaiResponsesReasoningModelIds
2919
3128
  ];
2920
- var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazySchema)(
2921
- () => (0, import_provider_utils22.zodSchema)(
2922
- import_v417.z.object({
2923
- include: import_v417.z.array(
2924
- import_v417.z.enum([
3129
+ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazySchema)(
3130
+ () => (0, import_provider_utils23.zodSchema)(
3131
+ import_v418.z.object({
3132
+ include: import_v418.z.array(
3133
+ import_v418.z.enum([
2925
3134
  "reasoning.encrypted_content",
2926
3135
  // handled internally by default, only needed for unknown reasoning models
2927
3136
  "file_search_call.results",
2928
3137
  "message.output_text.logprobs"
2929
3138
  ])
2930
3139
  ).nullish(),
2931
- instructions: import_v417.z.string().nullish(),
3140
+ instructions: import_v418.z.string().nullish(),
2932
3141
  /**
2933
3142
  * Return the log probabilities of the tokens.
2934
3143
  *
@@ -2941,33 +3150,33 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazySchem
2941
3150
  * @see https://platform.openai.com/docs/api-reference/responses/create
2942
3151
  * @see https://cookbook.openai.com/examples/using_logprobs
2943
3152
  */
2944
- logprobs: import_v417.z.union([import_v417.z.boolean(), import_v417.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
3153
+ logprobs: import_v418.z.union([import_v418.z.boolean(), import_v418.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
2945
3154
  /**
2946
3155
  * The maximum number of total calls to built-in tools that can be processed in a response.
2947
3156
  * This maximum number applies across all built-in tool calls, not per individual tool.
2948
3157
  * Any further attempts to call a tool by the model will be ignored.
2949
3158
  */
2950
- maxToolCalls: import_v417.z.number().nullish(),
2951
- metadata: import_v417.z.any().nullish(),
2952
- parallelToolCalls: import_v417.z.boolean().nullish(),
2953
- previousResponseId: import_v417.z.string().nullish(),
2954
- promptCacheKey: import_v417.z.string().nullish(),
2955
- reasoningEffort: import_v417.z.string().nullish(),
2956
- reasoningSummary: import_v417.z.string().nullish(),
2957
- safetyIdentifier: import_v417.z.string().nullish(),
2958
- serviceTier: import_v417.z.enum(["auto", "flex", "priority", "default"]).nullish(),
2959
- store: import_v417.z.boolean().nullish(),
2960
- strictJsonSchema: import_v417.z.boolean().nullish(),
2961
- textVerbosity: import_v417.z.enum(["low", "medium", "high"]).nullish(),
2962
- truncation: import_v417.z.enum(["auto", "disabled"]).nullish(),
2963
- user: import_v417.z.string().nullish()
3159
+ maxToolCalls: import_v418.z.number().nullish(),
3160
+ metadata: import_v418.z.any().nullish(),
3161
+ parallelToolCalls: import_v418.z.boolean().nullish(),
3162
+ previousResponseId: import_v418.z.string().nullish(),
3163
+ promptCacheKey: import_v418.z.string().nullish(),
3164
+ reasoningEffort: import_v418.z.string().nullish(),
3165
+ reasoningSummary: import_v418.z.string().nullish(),
3166
+ safetyIdentifier: import_v418.z.string().nullish(),
3167
+ serviceTier: import_v418.z.enum(["auto", "flex", "priority", "default"]).nullish(),
3168
+ store: import_v418.z.boolean().nullish(),
3169
+ strictJsonSchema: import_v418.z.boolean().nullish(),
3170
+ textVerbosity: import_v418.z.enum(["low", "medium", "high"]).nullish(),
3171
+ truncation: import_v418.z.enum(["auto", "disabled"]).nullish(),
3172
+ user: import_v418.z.string().nullish()
2964
3173
  })
2965
3174
  )
2966
3175
  );
2967
3176
 
2968
3177
  // src/responses/openai-responses-prepare-tools.ts
2969
3178
  var import_provider7 = require("@ai-sdk/provider");
2970
- var import_provider_utils23 = require("@ai-sdk/provider-utils");
3179
+ var import_provider_utils24 = require("@ai-sdk/provider-utils");
2971
3180
  async function prepareResponsesTools({
2972
3181
  tools,
2973
3182
  toolChoice,
@@ -2993,7 +3202,7 @@ async function prepareResponsesTools({
2993
3202
  case "provider-defined": {
2994
3203
  switch (tool.id) {
2995
3204
  case "openai.file_search": {
2996
- const args = await (0, import_provider_utils23.validateTypes)({
3205
+ const args = await (0, import_provider_utils24.validateTypes)({
2997
3206
  value: tool.args,
2998
3207
  schema: fileSearchArgsSchema
2999
3208
  });
@@ -3016,7 +3225,7 @@ async function prepareResponsesTools({
3016
3225
  break;
3017
3226
  }
3018
3227
  case "openai.web_search_preview": {
3019
- const args = await (0, import_provider_utils23.validateTypes)({
3228
+ const args = await (0, import_provider_utils24.validateTypes)({
3020
3229
  value: tool.args,
3021
3230
  schema: webSearchPreviewArgsSchema
3022
3231
  });
@@ -3028,7 +3237,7 @@ async function prepareResponsesTools({
3028
3237
  break;
3029
3238
  }
3030
3239
  case "openai.web_search": {
3031
- const args = await (0, import_provider_utils23.validateTypes)({
3240
+ const args = await (0, import_provider_utils24.validateTypes)({
3032
3241
  value: tool.args,
3033
3242
  schema: webSearchArgsSchema
3034
3243
  });
@@ -3041,7 +3250,7 @@ async function prepareResponsesTools({
3041
3250
  break;
3042
3251
  }
3043
3252
  case "openai.code_interpreter": {
3044
- const args = await (0, import_provider_utils23.validateTypes)({
3253
+ const args = await (0, import_provider_utils24.validateTypes)({
3045
3254
  value: tool.args,
3046
3255
  schema: codeInterpreterArgsSchema
3047
3256
  });
@@ -3052,7 +3261,7 @@ async function prepareResponsesTools({
3052
3261
  break;
3053
3262
  }
3054
3263
  case "openai.image_generation": {
3055
- const args = await (0, import_provider_utils23.validateTypes)({
3264
+ const args = await (0, import_provider_utils24.validateTypes)({
3056
3265
  value: tool.args,
3057
3266
  schema: imageGenerationArgsSchema
3058
3267
  });
@@ -3074,6 +3283,36 @@ async function prepareResponsesTools({
3074
3283
  });
3075
3284
  break;
3076
3285
  }
3286
+ case "openai.mcp": {
3287
+ const args = await (0, import_provider_utils24.validateTypes)({
3288
+ value: tool.args,
3289
+ schema: mcpArgsSchema
3290
+ });
3291
+ openaiTools2.push({
3292
+ type: "mcp",
3293
+ server_label: args.serverLabel,
3294
+ allowed_tools: Array.isArray(args.allowedTools) ? args.allowedTools : args.allowedTools ? {
3295
+ read_only: args.allowedTools.readOnly,
3296
+ tool_names: args.allowedTools.toolNames
3297
+ } : void 0,
3298
+ authorization: args.authorization,
3299
+ connector_id: args.connectorId,
3300
+ headers: args.headers,
3301
+ // require_approval:
3302
+ // typeof args.requireApproval === 'string'
3303
+ // ? args.requireApproval
3304
+ // : args.requireApproval
3305
+ // ? {
3306
+ // read_only: args.requireApproval.readOnly,
3307
+ // tool_names: args.requireApproval.toolNames,
3308
+ // }
3309
+ // : undefined,
3310
+ require_approval: "never",
3311
+ server_description: args.serverDescription,
3312
+ server_url: args.serverUrl
3313
+ });
3314
+ break;
3315
+ }
3077
3316
  }
3078
3317
  break;
3079
3318
  }
@@ -3094,7 +3333,7 @@ async function prepareResponsesTools({
3094
3333
  case "tool":
3095
3334
  return {
3096
3335
  tools: openaiTools2,
3097
- toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
3336
+ toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" || toolChoice.toolName === "mcp" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
3098
3337
  toolWarnings
3099
3338
  };
3100
3339
  default: {
@@ -3159,7 +3398,7 @@ var OpenAIResponsesLanguageModel = class {
3159
3398
  if (stopSequences != null) {
3160
3399
  warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
3161
3400
  }
3162
- const openaiOptions = await (0, import_provider_utils24.parseProviderOptions)({
3401
+ const openaiOptions = await (0, import_provider_utils25.parseProviderOptions)({
3163
3402
  provider: "openai",
3164
3403
  providerOptions,
3165
3404
  schema: openaiResponsesProviderOptionsSchema
@@ -3335,12 +3574,12 @@ var OpenAIResponsesLanguageModel = class {
3335
3574
  responseHeaders,
3336
3575
  value: response,
3337
3576
  rawValue: rawResponse
3338
- } = await (0, import_provider_utils24.postJsonToApi)({
3577
+ } = await (0, import_provider_utils25.postJsonToApi)({
3339
3578
  url,
3340
- headers: (0, import_provider_utils24.combineHeaders)(this.config.headers(), options.headers),
3579
+ headers: (0, import_provider_utils25.combineHeaders)(this.config.headers(), options.headers),
3341
3580
  body,
3342
3581
  failedResponseHandler: openaiFailedResponseHandler,
3343
- successfulResponseHandler: (0, import_provider_utils24.createJsonResponseHandler)(
3582
+ successfulResponseHandler: (0, import_provider_utils25.createJsonResponseHandler)(
3344
3583
  openaiResponsesResponseSchema
3345
3584
  ),
3346
3585
  abortSignal: options.abortSignal,
@@ -3437,7 +3676,7 @@ var OpenAIResponsesLanguageModel = class {
3437
3676
  content.push({
3438
3677
  type: "source",
3439
3678
  sourceType: "url",
3440
- id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils24.generateId)(),
3679
+ id: (_f = (_e = (_d = this.config).generateId) == null ? void 0 : _e.call(_d)) != null ? _f : (0, import_provider_utils25.generateId)(),
3441
3680
  url: annotation.url,
3442
3681
  title: annotation.title
3443
3682
  });
@@ -3445,7 +3684,7 @@ var OpenAIResponsesLanguageModel = class {
3445
3684
  content.push({
3446
3685
  type: "source",
3447
3686
  sourceType: "document",
3448
- id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils24.generateId)(),
3687
+ id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils25.generateId)(),
3449
3688
  mediaType: "text/plain",
3450
3689
  title: (_k = (_j = annotation.quote) != null ? _j : annotation.filename) != null ? _k : "Document",
3451
3690
  filename: (_l = annotation.filename) != null ? _l : annotation.file_id,
@@ -3461,7 +3700,7 @@ var OpenAIResponsesLanguageModel = class {
3461
3700
  content.push({
3462
3701
  type: "source",
3463
3702
  sourceType: "document",
3464
- id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils24.generateId)(),
3703
+ id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils25.generateId)(),
3465
3704
  mediaType: "text/plain",
3466
3705
  title: (_q = (_p = annotation.filename) != null ? _p : annotation.file_id) != null ? _q : "Document",
3467
3706
  filename: (_r = annotation.filename) != null ? _r : annotation.file_id,
@@ -3477,7 +3716,7 @@ var OpenAIResponsesLanguageModel = class {
3477
3716
  content.push({
3478
3717
  type: "source",
3479
3718
  sourceType: "document",
3480
- id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils24.generateId)(),
3719
+ id: (_u = (_t = (_s = this.config).generateId) == null ? void 0 : _t.call(_s)) != null ? _u : (0, import_provider_utils25.generateId)(),
3481
3720
  mediaType: "application/octet-stream",
3482
3721
  title: annotation.file_id,
3483
3722
  filename: annotation.file_id,
@@ -3524,6 +3763,80 @@ var OpenAIResponsesLanguageModel = class {
3524
3763
  });
3525
3764
  break;
3526
3765
  }
3766
+ case "mcp_call": {
3767
+ content.push({
3768
+ type: "tool-call",
3769
+ toolCallId: part.id,
3770
+ toolName: "mcp",
3771
+ input: JSON.stringify({}),
3772
+ providerExecuted: true
3773
+ });
3774
+ content.push({
3775
+ type: "tool-result",
3776
+ toolCallId: part.id,
3777
+ toolName: "mcp",
3778
+ result: {
3779
+ type: "call",
3780
+ serverLabel: part.server_label,
3781
+ name: part.name,
3782
+ arguments: part.arguments,
3783
+ ...part.output != null ? { output: part.output } : {},
3784
+ ...part.error != null ? { error: part.error } : {}
3785
+ }
3786
+ });
3787
+ break;
3788
+ }
3789
+ case "mcp_list_tools": {
3790
+ content.push({
3791
+ type: "tool-call",
3792
+ toolCallId: part.id,
3793
+ toolName: "mcp",
3794
+ input: JSON.stringify({}),
3795
+ providerExecuted: true
3796
+ });
3797
+ content.push({
3798
+ type: "tool-result",
3799
+ toolCallId: part.id,
3800
+ toolName: "mcp",
3801
+ result: {
3802
+ type: "listTools",
3803
+ serverLabel: part.server_label,
3804
+ tools: part.tools.map((t) => {
3805
+ var _a2, _b2;
3806
+ return {
3807
+ name: t.name,
3808
+ description: (_a2 = t.description) != null ? _a2 : void 0,
3809
+ inputSchema: t.input_schema,
3810
+ annotations: (_b2 = t.annotations) != null ? _b2 : void 0
3811
+ };
3812
+ }),
3813
+ ...part.error != null ? { error: part.error } : {}
3814
+ }
3815
+ });
3816
+ break;
3817
+ }
3818
+ case "mcp_approval_request": {
3819
+ content.push({
3820
+ type: "tool-call",
3821
+ toolCallId: part.id,
3822
+ toolName: "mcp",
3823
+ input: JSON.stringify({}),
3824
+ providerExecuted: true
3825
+ });
3826
+ content.push({
3827
+ type: "tool-result",
3828
+ toolCallId: part.id,
3829
+ toolName: "mcp",
3830
+ result: {
3831
+ type: "approvalRequest",
3832
+ serverLabel: part.server_label,
3833
+ name: part.name,
3834
+ arguments: part.arguments,
3835
+ approvalRequestId: part.approval_request_id
3836
+ }
3837
+ });
3838
+ break;
3839
+ }
3527
3840
  case "computer_call": {
3528
3841
  content.push({
3529
3842
  type: "tool-call",
@@ -3632,18 +3945,18 @@ var OpenAIResponsesLanguageModel = class {
3632
3945
  webSearchToolName,
3633
3946
  store
3634
3947
  } = await this.getArgs(options);
3635
- const { responseHeaders, value: response } = await (0, import_provider_utils24.postJsonToApi)({
3948
+ const { responseHeaders, value: response } = await (0, import_provider_utils25.postJsonToApi)({
3636
3949
  url: this.config.url({
3637
3950
  path: "/responses",
3638
3951
  modelId: this.modelId
3639
3952
  }),
3640
- headers: (0, import_provider_utils24.combineHeaders)(this.config.headers(), options.headers),
3953
+ headers: (0, import_provider_utils25.combineHeaders)(this.config.headers(), options.headers),
3641
3954
  body: {
3642
3955
  ...body,
3643
3956
  stream: true
3644
3957
  },
3645
3958
  failedResponseHandler: openaiFailedResponseHandler,
3646
- successfulResponseHandler: (0, import_provider_utils24.createEventSourceResponseHandler)(
3959
+ successfulResponseHandler: (0, import_provider_utils25.createEventSourceResponseHandler)(
3647
3960
  openaiResponsesChunkSchema
3648
3961
  ),
3649
3962
  abortSignal: options.abortSignal,
@@ -3758,6 +4071,14 @@ var OpenAIResponsesLanguageModel = class {
3758
4071
  input: "{}",
3759
4072
  providerExecuted: true
3760
4073
  });
4074
+ } else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
4075
+ controller.enqueue({
4076
+ type: "tool-call",
4077
+ toolCallId: value.item.id,
4078
+ toolName: "mcp",
4079
+ input: "{}",
4080
+ providerExecuted: true
4081
+ });
3761
4082
  } else if (value.item.type === "message") {
3762
4083
  controller.enqueue({
3763
4084
  type: "text-start",
@@ -3869,6 +4190,56 @@ var OpenAIResponsesLanguageModel = class {
3869
4190
  result: value.item.result
3870
4191
  }
3871
4192
  });
4193
+ } else if (value.item.type === "mcp_call") {
4194
+ ongoingToolCalls[value.output_index] = void 0;
4195
+ controller.enqueue({
4196
+ type: "tool-result",
4197
+ toolCallId: value.item.id,
4198
+ toolName: "mcp",
4199
+ result: {
4200
+ type: "call",
4201
+ serverLabel: value.item.server_label,
4202
+ name: value.item.name,
4203
+ arguments: value.item.arguments,
4204
+ ...value.item.output != null ? { output: value.item.output } : {},
4205
+ ...value.item.error != null ? { error: value.item.error } : {}
4206
+ }
4207
+ });
4208
+ } else if (value.item.type === "mcp_list_tools") {
4209
+ ongoingToolCalls[value.output_index] = void 0;
4210
+ controller.enqueue({
4211
+ type: "tool-result",
4212
+ toolCallId: value.item.id,
4213
+ toolName: "mcp",
4214
+ result: {
4215
+ type: "listTools",
4216
+ serverLabel: value.item.server_label,
4217
+ tools: value.item.tools.map((t) => {
4218
+ var _a2, _b2;
4219
+ return {
4220
+ name: t.name,
4221
+ description: (_a2 = t.description) != null ? _a2 : void 0,
4222
+ inputSchema: t.input_schema,
4223
+ annotations: (_b2 = t.annotations) != null ? _b2 : void 0
4224
+ };
4225
+ }),
4226
+ ...value.item.error != null ? { error: value.item.error } : {}
4227
+ }
4228
+ });
4229
+ } else if (value.item.type === "mcp_approval_request") {
4230
+ ongoingToolCalls[value.output_index] = void 0;
4231
+ controller.enqueue({
4232
+ type: "tool-result",
4233
+ toolCallId: value.item.id,
4234
+ toolName: "mcp",
4235
+ result: {
4236
+ type: "approvalRequest",
4237
+ serverLabel: value.item.server_label,
4238
+ name: value.item.name,
4239
+ arguments: value.item.arguments,
4240
+ approvalRequestId: value.item.approval_request_id
4241
+ }
4242
+ });
3872
4243
  } else if (value.item.type === "local_shell_call") {
3873
4244
  ongoingToolCalls[value.output_index] = void 0;
3874
4245
  controller.enqueue({
@@ -4054,7 +4425,7 @@ var OpenAIResponsesLanguageModel = class {
4054
4425
  controller.enqueue({
4055
4426
  type: "source",
4056
4427
  sourceType: "url",
4057
- id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0, import_provider_utils24.generateId)(),
4428
+ id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0, import_provider_utils25.generateId)(),
4058
4429
  url: value.annotation.url,
4059
4430
  title: value.annotation.title
4060
4431
  });
@@ -4062,7 +4433,7 @@ var OpenAIResponsesLanguageModel = class {
4062
4433
  controller.enqueue({
4063
4434
  type: "source",
4064
4435
  sourceType: "document",
4065
- id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils24.generateId)(),
4436
+ id: (_s = (_r = (_q = self.config).generateId) == null ? void 0 : _r.call(_q)) != null ? _s : (0, import_provider_utils25.generateId)(),
4066
4437
  mediaType: "text/plain",
4067
4438
  title: (_u = (_t = value.annotation.quote) != null ? _t : value.annotation.filename) != null ? _u : "Document",
4068
4439
  filename: (_v = value.annotation.filename) != null ? _v : value.annotation.file_id,
@@ -4078,7 +4449,7 @@ var OpenAIResponsesLanguageModel = class {
4078
4449
  controller.enqueue({
4079
4450
  type: "source",
4080
4451
  sourceType: "document",
4081
- id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0, import_provider_utils24.generateId)(),
4452
+ id: (_y = (_x = (_w = self.config).generateId) == null ? void 0 : _x.call(_w)) != null ? _y : (0, import_provider_utils25.generateId)(),
4082
4453
  mediaType: "text/plain",
4083
4454
  title: (_A = (_z = value.annotation.filename) != null ? _z : value.annotation.file_id) != null ? _A : "Document",
4084
4455
  filename: (_B = value.annotation.filename) != null ? _B : value.annotation.file_id,
@@ -4094,7 +4465,7 @@ var OpenAIResponsesLanguageModel = class {
4094
4465
  controller.enqueue({
4095
4466
  type: "source",
4096
4467
  sourceType: "document",
4097
- id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0, import_provider_utils24.generateId)(),
4468
+ id: (_E = (_D = (_C = self.config).generateId) == null ? void 0 : _D.call(_C)) != null ? _E : (0, import_provider_utils25.generateId)(),
4098
4469
  mediaType: "application/octet-stream",
4099
4470
  title: value.annotation.file_id,
4100
4471
  filename: value.annotation.file_id,
@@ -4200,16 +4571,16 @@ function mapWebSearchOutput(action) {
4200
4571
  }
4201
4572
 
4202
4573
  // src/speech/openai-speech-model.ts
4203
- var import_provider_utils26 = require("@ai-sdk/provider-utils");
4574
+ var import_provider_utils27 = require("@ai-sdk/provider-utils");
4204
4575
 
4205
4576
  // src/speech/openai-speech-options.ts
4206
- var import_provider_utils25 = require("@ai-sdk/provider-utils");
4207
- var import_v418 = require("zod/v4");
4208
- var openaiSpeechProviderOptionsSchema = (0, import_provider_utils25.lazySchema)(
4209
- () => (0, import_provider_utils25.zodSchema)(
4210
- import_v418.z.object({
4211
- instructions: import_v418.z.string().nullish(),
4212
- speed: import_v418.z.number().min(0.25).max(4).default(1).nullish()
4577
+ var import_provider_utils26 = require("@ai-sdk/provider-utils");
4578
+ var import_v419 = require("zod/v4");
4579
+ var openaiSpeechProviderOptionsSchema = (0, import_provider_utils26.lazySchema)(
4580
+ () => (0, import_provider_utils26.zodSchema)(
4581
+ import_v419.z.object({
4582
+ instructions: import_v419.z.string().nullish(),
4583
+ speed: import_v419.z.number().min(0.25).max(4).default(1).nullish()
4213
4584
  })
4214
4585
  )
4215
4586
  );
@@ -4234,7 +4605,7 @@ var OpenAISpeechModel = class {
4234
4605
  providerOptions
4235
4606
  }) {
4236
4607
  const warnings = [];
4237
- const openAIOptions = await (0, import_provider_utils26.parseProviderOptions)({
4608
+ const openAIOptions = await (0, import_provider_utils27.parseProviderOptions)({
4238
4609
  provider: "openai",
4239
4610
  providerOptions,
4240
4611
  schema: openaiSpeechProviderOptionsSchema
@@ -4287,15 +4658,15 @@ var OpenAISpeechModel = class {
4287
4658
  value: audio,
4288
4659
  responseHeaders,
4289
4660
  rawValue: rawResponse
4290
- } = await (0, import_provider_utils26.postJsonToApi)({
4661
+ } = await (0, import_provider_utils27.postJsonToApi)({
4291
4662
  url: this.config.url({
4292
4663
  path: "/audio/speech",
4293
4664
  modelId: this.modelId
4294
4665
  }),
4295
- headers: (0, import_provider_utils26.combineHeaders)(this.config.headers(), options.headers),
4666
+ headers: (0, import_provider_utils27.combineHeaders)(this.config.headers(), options.headers),
4296
4667
  body: requestBody,
4297
4668
  failedResponseHandler: openaiFailedResponseHandler,
4298
- successfulResponseHandler: (0, import_provider_utils26.createBinaryResponseHandler)(),
4669
+ successfulResponseHandler: (0, import_provider_utils27.createBinaryResponseHandler)(),
4299
4670
  abortSignal: options.abortSignal,
4300
4671
  fetch: this.config.fetch
4301
4672
  });
@@ -4316,36 +4687,36 @@ var OpenAISpeechModel = class {
4316
4687
  };
4317
4688
 
4318
4689
  // src/transcription/openai-transcription-model.ts
4319
- var import_provider_utils29 = require("@ai-sdk/provider-utils");
4690
+ var import_provider_utils30 = require("@ai-sdk/provider-utils");
4320
4691
 
4321
4692
  // src/transcription/openai-transcription-api.ts
4322
- var import_provider_utils27 = require("@ai-sdk/provider-utils");
4323
- var import_v419 = require("zod/v4");
4324
- var openaiTranscriptionResponseSchema = (0, import_provider_utils27.lazySchema)(
4325
- () => (0, import_provider_utils27.zodSchema)(
4326
- import_v419.z.object({
4327
- text: import_v419.z.string(),
4328
- language: import_v419.z.string().nullish(),
4329
- duration: import_v419.z.number().nullish(),
4330
- words: import_v419.z.array(
4331
- import_v419.z.object({
4332
- word: import_v419.z.string(),
4333
- start: import_v419.z.number(),
4334
- end: import_v419.z.number()
4693
+ var import_provider_utils28 = require("@ai-sdk/provider-utils");
4694
+ var import_v420 = require("zod/v4");
4695
+ var openaiTranscriptionResponseSchema = (0, import_provider_utils28.lazySchema)(
4696
+ () => (0, import_provider_utils28.zodSchema)(
4697
+ import_v420.z.object({
4698
+ text: import_v420.z.string(),
4699
+ language: import_v420.z.string().nullish(),
4700
+ duration: import_v420.z.number().nullish(),
4701
+ words: import_v420.z.array(
4702
+ import_v420.z.object({
4703
+ word: import_v420.z.string(),
4704
+ start: import_v420.z.number(),
4705
+ end: import_v420.z.number()
4335
4706
  })
4336
4707
  ).nullish(),
4337
- segments: import_v419.z.array(
4338
- import_v419.z.object({
4339
- id: import_v419.z.number(),
4340
- seek: import_v419.z.number(),
4341
- start: import_v419.z.number(),
4342
- end: import_v419.z.number(),
4343
- text: import_v419.z.string(),
4344
- tokens: import_v419.z.array(import_v419.z.number()),
4345
- temperature: import_v419.z.number(),
4346
- avg_logprob: import_v419.z.number(),
4347
- compression_ratio: import_v419.z.number(),
4348
- no_speech_prob: import_v419.z.number()
4708
+ segments: import_v420.z.array(
4709
+ import_v420.z.object({
4710
+ id: import_v420.z.number(),
4711
+ seek: import_v420.z.number(),
4712
+ start: import_v420.z.number(),
4713
+ end: import_v420.z.number(),
4714
+ text: import_v420.z.string(),
4715
+ tokens: import_v420.z.array(import_v420.z.number()),
4716
+ temperature: import_v420.z.number(),
4717
+ avg_logprob: import_v420.z.number(),
4718
+ compression_ratio: import_v420.z.number(),
4719
+ no_speech_prob: import_v420.z.number()
4349
4720
  })
4350
4721
  ).nullish()
4351
4722
  })
@@ -4353,33 +4724,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils27.lazySchema)(
4353
4724
  );
4354
4725
 
4355
4726
  // src/transcription/openai-transcription-options.ts
4356
- var import_provider_utils28 = require("@ai-sdk/provider-utils");
4357
- var import_v420 = require("zod/v4");
4358
- var openAITranscriptionProviderOptions = (0, import_provider_utils28.lazySchema)(
4359
- () => (0, import_provider_utils28.zodSchema)(
4360
- import_v420.z.object({
4727
+ var import_provider_utils29 = require("@ai-sdk/provider-utils");
4728
+ var import_v421 = require("zod/v4");
4729
+ var openAITranscriptionProviderOptions = (0, import_provider_utils29.lazySchema)(
4730
+ () => (0, import_provider_utils29.zodSchema)(
4731
+ import_v421.z.object({
4361
4732
  /**
4362
4733
  * Additional information to include in the transcription response.
4363
4734
  */
4364
- include: import_v420.z.array(import_v420.z.string()).optional(),
4735
+ include: import_v421.z.array(import_v421.z.string()).optional(),
4365
4736
  /**
4366
4737
  * The language of the input audio in ISO-639-1 format.
4367
4738
  */
4368
- language: import_v420.z.string().optional(),
4739
+ language: import_v421.z.string().optional(),
4369
4740
  /**
4370
4741
  * An optional text to guide the model's style or continue a previous audio segment.
4371
4742
  */
4372
- prompt: import_v420.z.string().optional(),
4743
+ prompt: import_v421.z.string().optional(),
4373
4744
  /**
4374
4745
  * The sampling temperature, between 0 and 1.
4375
4746
  * @default 0
4376
4747
  */
4377
- temperature: import_v420.z.number().min(0).max(1).default(0).optional(),
4748
+ temperature: import_v421.z.number().min(0).max(1).default(0).optional(),
4378
4749
  /**
4379
4750
  * The timestamp granularities to populate for this transcription.
4380
4751
  * @default ['segment']
4381
4752
  */
4382
- timestampGranularities: import_v420.z.array(import_v420.z.enum(["word", "segment"])).default(["segment"]).optional()
4753
+ timestampGranularities: import_v421.z.array(import_v421.z.enum(["word", "segment"])).default(["segment"]).optional()
4383
4754
  })
4384
4755
  )
4385
4756
  );
@@ -4459,15 +4830,15 @@ var OpenAITranscriptionModel = class {
4459
4830
  providerOptions
4460
4831
  }) {
4461
4832
  const warnings = [];
4462
- const openAIOptions = await (0, import_provider_utils29.parseProviderOptions)({
4833
+ const openAIOptions = await (0, import_provider_utils30.parseProviderOptions)({
4463
4834
  provider: "openai",
4464
4835
  providerOptions,
4465
4836
  schema: openAITranscriptionProviderOptions
4466
4837
  });
4467
4838
  const formData = new FormData();
4468
- const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils29.convertBase64ToUint8Array)(audio)]);
4839
+ const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils30.convertBase64ToUint8Array)(audio)]);
4469
4840
  formData.append("model", this.modelId);
4470
- const fileExtension = (0, import_provider_utils29.mediaTypeToExtension)(mediaType);
4841
+ const fileExtension = (0, import_provider_utils30.mediaTypeToExtension)(mediaType);
4471
4842
  formData.append(
4472
4843
  "file",
4473
4844
  new File([blob], "audio", { type: mediaType }),
@@ -4512,15 +4883,15 @@ var OpenAITranscriptionModel = class {
4512
4883
  value: response,
4513
4884
  responseHeaders,
4514
4885
  rawValue: rawResponse
4515
- } = await (0, import_provider_utils29.postFormDataToApi)({
4886
+ } = await (0, import_provider_utils30.postFormDataToApi)({
4516
4887
  url: this.config.url({
4517
4888
  path: "/audio/transcriptions",
4518
4889
  modelId: this.modelId
4519
4890
  }),
4520
- headers: (0, import_provider_utils29.combineHeaders)(this.config.headers(), options.headers),
4891
+ headers: (0, import_provider_utils30.combineHeaders)(this.config.headers(), options.headers),
4521
4892
  formData,
4522
4893
  failedResponseHandler: openaiFailedResponseHandler,
4523
- successfulResponseHandler: (0, import_provider_utils29.createJsonResponseHandler)(
4894
+ successfulResponseHandler: (0, import_provider_utils30.createJsonResponseHandler)(
4524
4895
  openaiTranscriptionResponseSchema
4525
4896
  ),
4526
4897
  abortSignal: options.abortSignal,
@@ -4552,21 +4923,21 @@ var OpenAITranscriptionModel = class {
4552
4923
  };
4553
4924
 
4554
4925
  // src/version.ts
4555
- var VERSION = true ? "3.0.0-beta.54" : "0.0.0-test";
4926
+ var VERSION = true ? "3.0.0-beta.56" : "0.0.0-test";
4556
4927
 
4557
4928
  // src/openai-provider.ts
4558
4929
  function createOpenAI(options = {}) {
4559
4930
  var _a, _b;
4560
- const baseURL = (_a = (0, import_provider_utils30.withoutTrailingSlash)(
4561
- (0, import_provider_utils30.loadOptionalSetting)({
4931
+ const baseURL = (_a = (0, import_provider_utils31.withoutTrailingSlash)(
4932
+ (0, import_provider_utils31.loadOptionalSetting)({
4562
4933
  settingValue: options.baseURL,
4563
4934
  environmentVariableName: "OPENAI_BASE_URL"
4564
4935
  })
4565
4936
  )) != null ? _a : "https://api.openai.com/v1";
4566
4937
  const providerName = (_b = options.name) != null ? _b : "openai";
4567
- const getHeaders = () => (0, import_provider_utils30.withUserAgentSuffix)(
4938
+ const getHeaders = () => (0, import_provider_utils31.withUserAgentSuffix)(
4568
4939
  {
4569
- Authorization: `Bearer ${(0, import_provider_utils30.loadApiKey)({
4940
+ Authorization: `Bearer ${(0, import_provider_utils31.loadApiKey)({
4570
4941
  apiKey: options.apiKey,
4571
4942
  environmentVariableName: "OPENAI_API_KEY",
4572
4943
  description: "OpenAI"