@ai-sdk/anthropic 2.0.0-beta.2 → 2.0.0-beta.3

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
@@ -42,16 +42,16 @@ var import_provider_utils11 = require("@ai-sdk/provider-utils");
42
42
  // src/anthropic-messages-language-model.ts
43
43
  var import_provider3 = require("@ai-sdk/provider");
44
44
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
45
- var import_zod3 = require("zod");
45
+ var import_v44 = require("zod/v4");
46
46
 
47
47
  // src/anthropic-error.ts
48
48
  var import_provider_utils = require("@ai-sdk/provider-utils");
49
- var import_zod = require("zod");
50
- var anthropicErrorDataSchema = import_zod.z.object({
51
- type: import_zod.z.literal("error"),
52
- error: import_zod.z.object({
53
- type: import_zod.z.string(),
54
- message: import_zod.z.string()
49
+ var import_v4 = require("zod/v4");
50
+ var anthropicErrorDataSchema = import_v4.z.object({
51
+ type: import_v4.z.literal("error"),
52
+ error: import_v4.z.object({
53
+ type: import_v4.z.string(),
54
+ message: import_v4.z.string()
55
55
  })
56
56
  });
57
57
  var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
@@ -60,35 +60,35 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
60
60
  });
61
61
 
62
62
  // src/anthropic-messages-options.ts
63
- var import_zod2 = require("zod");
64
- var anthropicFilePartProviderOptions = import_zod2.z.object({
63
+ var import_v42 = require("zod/v4");
64
+ var anthropicFilePartProviderOptions = import_v42.z.object({
65
65
  /**
66
66
  * Citation configuration for this document.
67
67
  * When enabled, this document will generate citations in the response.
68
68
  */
69
- citations: import_zod2.z.object({
69
+ citations: import_v42.z.object({
70
70
  /**
71
71
  * Enable citations for this document
72
72
  */
73
- enabled: import_zod2.z.boolean()
73
+ enabled: import_v42.z.boolean()
74
74
  }).optional(),
75
75
  /**
76
76
  * Custom title for the document.
77
77
  * If not provided, the filename will be used.
78
78
  */
79
- title: import_zod2.z.string().optional(),
79
+ title: import_v42.z.string().optional(),
80
80
  /**
81
81
  * Context about the document that will be passed to the model
82
82
  * but not used towards cited content.
83
83
  * Useful for storing document metadata as text or stringified JSON.
84
84
  */
85
- context: import_zod2.z.string().optional()
85
+ context: import_v42.z.string().optional()
86
86
  });
87
- var anthropicProviderOptions = import_zod2.z.object({
88
- sendReasoning: import_zod2.z.boolean().optional(),
89
- thinking: import_zod2.z.object({
90
- type: import_zod2.z.union([import_zod2.z.literal("enabled"), import_zod2.z.literal("disabled")]),
91
- budgetTokens: import_zod2.z.number().optional()
87
+ var anthropicProviderOptions = import_v42.z.object({
88
+ sendReasoning: import_v42.z.boolean().optional(),
89
+ thinking: import_v42.z.object({
90
+ type: import_v42.z.union([import_v42.z.literal("enabled"), import_v42.z.literal("disabled")]),
91
+ budgetTokens: import_v42.z.number().optional()
92
92
  }).optional()
93
93
  });
94
94
 
@@ -97,45 +97,45 @@ var import_provider = require("@ai-sdk/provider");
97
97
 
98
98
  // src/tool/web-search_20250305.ts
99
99
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
100
- var import_v4 = require("zod/v4");
101
- var webSearch_20250305ArgsSchema = import_v4.z.object({
100
+ var import_v43 = require("zod/v4");
101
+ var webSearch_20250305ArgsSchema = import_v43.z.object({
102
102
  /**
103
103
  * Maximum number of web searches Claude can perform during the conversation.
104
104
  */
105
- maxUses: import_v4.z.number().optional(),
105
+ maxUses: import_v43.z.number().optional(),
106
106
  /**
107
107
  * Optional list of domains that Claude is allowed to search.
108
108
  */
109
- allowedDomains: import_v4.z.array(import_v4.z.string()).optional(),
109
+ allowedDomains: import_v43.z.array(import_v43.z.string()).optional(),
110
110
  /**
111
111
  * Optional list of domains that Claude should avoid when searching.
112
112
  */
113
- blockedDomains: import_v4.z.array(import_v4.z.string()).optional(),
113
+ blockedDomains: import_v43.z.array(import_v43.z.string()).optional(),
114
114
  /**
115
115
  * Optional user location information to provide geographically relevant search results.
116
116
  */
117
- userLocation: import_v4.z.object({
118
- type: import_v4.z.literal("approximate"),
119
- city: import_v4.z.string().optional(),
120
- region: import_v4.z.string().optional(),
121
- country: import_v4.z.string().optional(),
122
- timezone: import_v4.z.string().optional()
117
+ userLocation: import_v43.z.object({
118
+ type: import_v43.z.literal("approximate"),
119
+ city: import_v43.z.string().optional(),
120
+ region: import_v43.z.string().optional(),
121
+ country: import_v43.z.string().optional(),
122
+ timezone: import_v43.z.string().optional()
123
123
  }).optional()
124
124
  });
125
- var webSearch_20250305OutputSchema = import_v4.z.array(
126
- import_v4.z.object({
127
- url: import_v4.z.string(),
128
- title: import_v4.z.string(),
129
- pageAge: import_v4.z.string().nullable(),
130
- encryptedContent: import_v4.z.string(),
131
- type: import_v4.z.string()
125
+ var webSearch_20250305OutputSchema = import_v43.z.array(
126
+ import_v43.z.object({
127
+ url: import_v43.z.string(),
128
+ title: import_v43.z.string(),
129
+ pageAge: import_v43.z.string().nullable(),
130
+ encryptedContent: import_v43.z.string(),
131
+ type: import_v43.z.string()
132
132
  })
133
133
  );
134
134
  var factory = (0, import_provider_utils2.createProviderDefinedToolFactoryWithOutputSchema)({
135
135
  id: "anthropic.web_search_20250305",
136
136
  name: "web_search",
137
- inputSchema: import_v4.z.object({
138
- query: import_v4.z.string()
137
+ inputSchema: import_v43.z.object({
138
+ query: import_v43.z.string()
139
139
  }),
140
140
  outputSchema: webSearch_20250305OutputSchema
141
141
  });
@@ -725,36 +725,36 @@ function mapAnthropicStopReason({
725
725
 
726
726
  // src/anthropic-messages-language-model.ts
727
727
  var citationSchemas = {
728
- webSearchResult: import_zod3.z.object({
729
- type: import_zod3.z.literal("web_search_result_location"),
730
- cited_text: import_zod3.z.string(),
731
- url: import_zod3.z.string(),
732
- title: import_zod3.z.string(),
733
- encrypted_index: import_zod3.z.string()
728
+ webSearchResult: import_v44.z.object({
729
+ type: import_v44.z.literal("web_search_result_location"),
730
+ cited_text: import_v44.z.string(),
731
+ url: import_v44.z.string(),
732
+ title: import_v44.z.string(),
733
+ encrypted_index: import_v44.z.string()
734
734
  }),
735
- pageLocation: import_zod3.z.object({
736
- type: import_zod3.z.literal("page_location"),
737
- cited_text: import_zod3.z.string(),
738
- document_index: import_zod3.z.number(),
739
- document_title: import_zod3.z.string().nullable(),
740
- start_page_number: import_zod3.z.number(),
741
- end_page_number: import_zod3.z.number()
735
+ pageLocation: import_v44.z.object({
736
+ type: import_v44.z.literal("page_location"),
737
+ cited_text: import_v44.z.string(),
738
+ document_index: import_v44.z.number(),
739
+ document_title: import_v44.z.string().nullable(),
740
+ start_page_number: import_v44.z.number(),
741
+ end_page_number: import_v44.z.number()
742
742
  }),
743
- charLocation: import_zod3.z.object({
744
- type: import_zod3.z.literal("char_location"),
745
- cited_text: import_zod3.z.string(),
746
- document_index: import_zod3.z.number(),
747
- document_title: import_zod3.z.string().nullable(),
748
- start_char_index: import_zod3.z.number(),
749
- end_char_index: import_zod3.z.number()
743
+ charLocation: import_v44.z.object({
744
+ type: import_v44.z.literal("char_location"),
745
+ cited_text: import_v44.z.string(),
746
+ document_index: import_v44.z.number(),
747
+ document_title: import_v44.z.string().nullable(),
748
+ start_char_index: import_v44.z.number(),
749
+ end_char_index: import_v44.z.number()
750
750
  })
751
751
  };
752
- var citationSchema = import_zod3.z.discriminatedUnion("type", [
752
+ var citationSchema = import_v44.z.discriminatedUnion("type", [
753
753
  citationSchemas.webSearchResult,
754
754
  citationSchemas.pageLocation,
755
755
  citationSchemas.charLocation
756
756
  ]);
757
- var documentCitationSchema = import_zod3.z.discriminatedUnion("type", [
757
+ var documentCitationSchema = import_v44.z.discriminatedUnion("type", [
758
758
  citationSchemas.pageLocation,
759
759
  citationSchemas.charLocation
760
760
  ]);
@@ -951,8 +951,12 @@ var AnthropicMessagesLanguageModel = class {
951
951
  tool_choice: anthropicToolChoice
952
952
  },
953
953
  warnings: [...warnings, ...toolWarnings],
954
- betas: /* @__PURE__ */ new Set([...messagesBetas, ...toolsBetas]),
955
- jsonResponseTool
954
+ betas: /* @__PURE__ */ new Set([
955
+ "fine-grained-tool-streaming-2025-05-14",
956
+ ...messagesBetas,
957
+ ...toolsBetas
958
+ ]),
959
+ usesJsonResponseTool: jsonResponseTool != null
956
960
  };
957
961
  }
958
962
  async getHeaders({
@@ -998,7 +1002,7 @@ var AnthropicMessagesLanguageModel = class {
998
1002
  }
999
1003
  async doGenerate(options) {
1000
1004
  var _a, _b, _c, _d, _e;
1001
- const { args, warnings, betas, jsonResponseTool } = await this.getArgs(options);
1005
+ const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
1002
1006
  const citationDocuments = this.extractCitationDocuments(options.prompt);
1003
1007
  const {
1004
1008
  responseHeaders,
@@ -1019,7 +1023,7 @@ var AnthropicMessagesLanguageModel = class {
1019
1023
  for (const part of response.content) {
1020
1024
  switch (part.type) {
1021
1025
  case "text": {
1022
- if (jsonResponseTool == null) {
1026
+ if (!usesJsonResponseTool) {
1023
1027
  content.push({ type: "text", text: part.text });
1024
1028
  if (part.citations) {
1025
1029
  for (const citation of part.citations) {
@@ -1061,7 +1065,7 @@ var AnthropicMessagesLanguageModel = class {
1061
1065
  case "tool_use": {
1062
1066
  content.push(
1063
1067
  // when a json response tool is used, the tool call becomes the text:
1064
- jsonResponseTool != null ? {
1068
+ usesJsonResponseTool ? {
1065
1069
  type: "text",
1066
1070
  text: JSON.stringify(part.input)
1067
1071
  } : {
@@ -1138,7 +1142,7 @@ var AnthropicMessagesLanguageModel = class {
1138
1142
  content,
1139
1143
  finishReason: mapAnthropicStopReason({
1140
1144
  finishReason: response.stop_reason,
1141
- isJsonResponseFromTool: jsonResponseTool != null
1145
+ isJsonResponseFromTool: usesJsonResponseTool
1142
1146
  }),
1143
1147
  usage: {
1144
1148
  inputTokens: response.usage.input_tokens,
@@ -1162,7 +1166,7 @@ var AnthropicMessagesLanguageModel = class {
1162
1166
  };
1163
1167
  }
1164
1168
  async doStream(options) {
1165
- const { args, warnings, betas, jsonResponseTool } = await this.getArgs(options);
1169
+ const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
1166
1170
  const citationDocuments = this.extractCitationDocuments(options.prompt);
1167
1171
  const body = { ...args, stream: true };
1168
1172
  const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({
@@ -1240,14 +1244,14 @@ var AnthropicMessagesLanguageModel = class {
1240
1244
  return;
1241
1245
  }
1242
1246
  case "tool_use": {
1243
- contentBlocks[value.index] = jsonResponseTool != null ? { type: "text" } : {
1247
+ contentBlocks[value.index] = usesJsonResponseTool ? { type: "text" } : {
1244
1248
  type: "tool-call",
1245
1249
  toolCallId: value.content_block.id,
1246
1250
  toolName: value.content_block.name,
1247
1251
  input: ""
1248
1252
  };
1249
1253
  controller.enqueue(
1250
- jsonResponseTool != null ? { type: "text-start", id: String(value.index) } : {
1254
+ usesJsonResponseTool ? { type: "text-start", id: String(value.index) } : {
1251
1255
  type: "tool-input-start",
1252
1256
  id: value.content_block.id,
1253
1257
  toolName: value.content_block.name
@@ -1348,7 +1352,7 @@ var AnthropicMessagesLanguageModel = class {
1348
1352
  break;
1349
1353
  }
1350
1354
  case "tool-call":
1351
- if (jsonResponseTool == null) {
1355
+ if (!usesJsonResponseTool) {
1352
1356
  controller.enqueue({
1353
1357
  type: "tool-input-end",
1354
1358
  id: contentBlock.toolCallId
@@ -1366,7 +1370,7 @@ var AnthropicMessagesLanguageModel = class {
1366
1370
  const deltaType = value.delta.type;
1367
1371
  switch (deltaType) {
1368
1372
  case "text_delta": {
1369
- if (jsonResponseTool != null) {
1373
+ if (usesJsonResponseTool) {
1370
1374
  return;
1371
1375
  }
1372
1376
  controller.enqueue({
@@ -1402,16 +1406,15 @@ var AnthropicMessagesLanguageModel = class {
1402
1406
  case "input_json_delta": {
1403
1407
  const contentBlock = contentBlocks[value.index];
1404
1408
  const delta = value.delta.partial_json;
1405
- if (jsonResponseTool == null) {
1406
- if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
1409
+ if (usesJsonResponseTool) {
1410
+ if ((contentBlock == null ? void 0 : contentBlock.type) !== "text") {
1407
1411
  return;
1408
1412
  }
1409
1413
  controller.enqueue({
1410
- type: "tool-input-delta",
1411
- id: contentBlock.toolCallId,
1414
+ type: "text-delta",
1415
+ id: String(value.index),
1412
1416
  delta
1413
1417
  });
1414
- contentBlock.input += delta;
1415
1418
  } else {
1416
1419
  if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
1417
1420
  return;
@@ -1421,6 +1424,7 @@ var AnthropicMessagesLanguageModel = class {
1421
1424
  id: contentBlock.toolCallId,
1422
1425
  delta
1423
1426
  });
1427
+ contentBlock.input += delta;
1424
1428
  }
1425
1429
  return;
1426
1430
  }
@@ -1462,7 +1466,7 @@ var AnthropicMessagesLanguageModel = class {
1462
1466
  usage.totalTokens = ((_f = usage.inputTokens) != null ? _f : 0) + ((_g = value.usage.output_tokens) != null ? _g : 0);
1463
1467
  finishReason = mapAnthropicStopReason({
1464
1468
  finishReason: value.delta.stop_reason,
1465
- isJsonResponseFromTool: jsonResponseTool != null
1469
+ isJsonResponseFromTool: usesJsonResponseTool
1466
1470
  });
1467
1471
  return;
1468
1472
  }
@@ -1492,218 +1496,218 @@ var AnthropicMessagesLanguageModel = class {
1492
1496
  };
1493
1497
  }
1494
1498
  };
1495
- var anthropicMessagesResponseSchema = import_zod3.z.object({
1496
- type: import_zod3.z.literal("message"),
1497
- id: import_zod3.z.string().nullish(),
1498
- model: import_zod3.z.string().nullish(),
1499
- content: import_zod3.z.array(
1500
- import_zod3.z.discriminatedUnion("type", [
1501
- import_zod3.z.object({
1502
- type: import_zod3.z.literal("text"),
1503
- text: import_zod3.z.string(),
1504
- citations: import_zod3.z.array(citationSchema).optional()
1499
+ var anthropicMessagesResponseSchema = import_v44.z.object({
1500
+ type: import_v44.z.literal("message"),
1501
+ id: import_v44.z.string().nullish(),
1502
+ model: import_v44.z.string().nullish(),
1503
+ content: import_v44.z.array(
1504
+ import_v44.z.discriminatedUnion("type", [
1505
+ import_v44.z.object({
1506
+ type: import_v44.z.literal("text"),
1507
+ text: import_v44.z.string(),
1508
+ citations: import_v44.z.array(citationSchema).optional()
1505
1509
  }),
1506
- import_zod3.z.object({
1507
- type: import_zod3.z.literal("thinking"),
1508
- thinking: import_zod3.z.string(),
1509
- signature: import_zod3.z.string()
1510
+ import_v44.z.object({
1511
+ type: import_v44.z.literal("thinking"),
1512
+ thinking: import_v44.z.string(),
1513
+ signature: import_v44.z.string()
1510
1514
  }),
1511
- import_zod3.z.object({
1512
- type: import_zod3.z.literal("redacted_thinking"),
1513
- data: import_zod3.z.string()
1515
+ import_v44.z.object({
1516
+ type: import_v44.z.literal("redacted_thinking"),
1517
+ data: import_v44.z.string()
1514
1518
  }),
1515
- import_zod3.z.object({
1516
- type: import_zod3.z.literal("tool_use"),
1517
- id: import_zod3.z.string(),
1518
- name: import_zod3.z.string(),
1519
- input: import_zod3.z.unknown()
1519
+ import_v44.z.object({
1520
+ type: import_v44.z.literal("tool_use"),
1521
+ id: import_v44.z.string(),
1522
+ name: import_v44.z.string(),
1523
+ input: import_v44.z.unknown()
1520
1524
  }),
1521
- import_zod3.z.object({
1522
- type: import_zod3.z.literal("server_tool_use"),
1523
- id: import_zod3.z.string(),
1524
- name: import_zod3.z.string(),
1525
- input: import_zod3.z.record(import_zod3.z.unknown()).nullish()
1525
+ import_v44.z.object({
1526
+ type: import_v44.z.literal("server_tool_use"),
1527
+ id: import_v44.z.string(),
1528
+ name: import_v44.z.string(),
1529
+ input: import_v44.z.record(import_v44.z.string(), import_v44.z.unknown()).nullish()
1526
1530
  }),
1527
- import_zod3.z.object({
1528
- type: import_zod3.z.literal("web_search_tool_result"),
1529
- tool_use_id: import_zod3.z.string(),
1530
- content: import_zod3.z.union([
1531
- import_zod3.z.array(
1532
- import_zod3.z.object({
1533
- type: import_zod3.z.literal("web_search_result"),
1534
- url: import_zod3.z.string(),
1535
- title: import_zod3.z.string(),
1536
- encrypted_content: import_zod3.z.string(),
1537
- page_age: import_zod3.z.string().nullish()
1531
+ import_v44.z.object({
1532
+ type: import_v44.z.literal("web_search_tool_result"),
1533
+ tool_use_id: import_v44.z.string(),
1534
+ content: import_v44.z.union([
1535
+ import_v44.z.array(
1536
+ import_v44.z.object({
1537
+ type: import_v44.z.literal("web_search_result"),
1538
+ url: import_v44.z.string(),
1539
+ title: import_v44.z.string(),
1540
+ encrypted_content: import_v44.z.string(),
1541
+ page_age: import_v44.z.string().nullish()
1538
1542
  })
1539
1543
  ),
1540
- import_zod3.z.object({
1541
- type: import_zod3.z.literal("web_search_tool_result_error"),
1542
- error_code: import_zod3.z.string()
1544
+ import_v44.z.object({
1545
+ type: import_v44.z.literal("web_search_tool_result_error"),
1546
+ error_code: import_v44.z.string()
1543
1547
  })
1544
1548
  ])
1545
1549
  })
1546
1550
  ])
1547
1551
  ),
1548
- stop_reason: import_zod3.z.string().nullish(),
1549
- usage: import_zod3.z.object({
1550
- input_tokens: import_zod3.z.number(),
1551
- output_tokens: import_zod3.z.number(),
1552
- cache_creation_input_tokens: import_zod3.z.number().nullish(),
1553
- cache_read_input_tokens: import_zod3.z.number().nullish(),
1554
- server_tool_use: import_zod3.z.object({
1555
- web_search_requests: import_zod3.z.number()
1552
+ stop_reason: import_v44.z.string().nullish(),
1553
+ usage: import_v44.z.object({
1554
+ input_tokens: import_v44.z.number(),
1555
+ output_tokens: import_v44.z.number(),
1556
+ cache_creation_input_tokens: import_v44.z.number().nullish(),
1557
+ cache_read_input_tokens: import_v44.z.number().nullish(),
1558
+ server_tool_use: import_v44.z.object({
1559
+ web_search_requests: import_v44.z.number()
1556
1560
  }).nullish()
1557
1561
  })
1558
1562
  });
1559
- var anthropicMessagesChunkSchema = import_zod3.z.discriminatedUnion("type", [
1560
- import_zod3.z.object({
1561
- type: import_zod3.z.literal("message_start"),
1562
- message: import_zod3.z.object({
1563
- id: import_zod3.z.string().nullish(),
1564
- model: import_zod3.z.string().nullish(),
1565
- usage: import_zod3.z.object({
1566
- input_tokens: import_zod3.z.number(),
1567
- output_tokens: import_zod3.z.number(),
1568
- cache_creation_input_tokens: import_zod3.z.number().nullish(),
1569
- cache_read_input_tokens: import_zod3.z.number().nullish()
1563
+ var anthropicMessagesChunkSchema = import_v44.z.discriminatedUnion("type", [
1564
+ import_v44.z.object({
1565
+ type: import_v44.z.literal("message_start"),
1566
+ message: import_v44.z.object({
1567
+ id: import_v44.z.string().nullish(),
1568
+ model: import_v44.z.string().nullish(),
1569
+ usage: import_v44.z.object({
1570
+ input_tokens: import_v44.z.number(),
1571
+ output_tokens: import_v44.z.number(),
1572
+ cache_creation_input_tokens: import_v44.z.number().nullish(),
1573
+ cache_read_input_tokens: import_v44.z.number().nullish()
1570
1574
  })
1571
1575
  })
1572
1576
  }),
1573
- import_zod3.z.object({
1574
- type: import_zod3.z.literal("content_block_start"),
1575
- index: import_zod3.z.number(),
1576
- content_block: import_zod3.z.discriminatedUnion("type", [
1577
- import_zod3.z.object({
1578
- type: import_zod3.z.literal("text"),
1579
- text: import_zod3.z.string()
1577
+ import_v44.z.object({
1578
+ type: import_v44.z.literal("content_block_start"),
1579
+ index: import_v44.z.number(),
1580
+ content_block: import_v44.z.discriminatedUnion("type", [
1581
+ import_v44.z.object({
1582
+ type: import_v44.z.literal("text"),
1583
+ text: import_v44.z.string()
1580
1584
  }),
1581
- import_zod3.z.object({
1582
- type: import_zod3.z.literal("thinking"),
1583
- thinking: import_zod3.z.string()
1585
+ import_v44.z.object({
1586
+ type: import_v44.z.literal("thinking"),
1587
+ thinking: import_v44.z.string()
1584
1588
  }),
1585
- import_zod3.z.object({
1586
- type: import_zod3.z.literal("tool_use"),
1587
- id: import_zod3.z.string(),
1588
- name: import_zod3.z.string()
1589
+ import_v44.z.object({
1590
+ type: import_v44.z.literal("tool_use"),
1591
+ id: import_v44.z.string(),
1592
+ name: import_v44.z.string()
1589
1593
  }),
1590
- import_zod3.z.object({
1591
- type: import_zod3.z.literal("redacted_thinking"),
1592
- data: import_zod3.z.string()
1594
+ import_v44.z.object({
1595
+ type: import_v44.z.literal("redacted_thinking"),
1596
+ data: import_v44.z.string()
1593
1597
  }),
1594
- import_zod3.z.object({
1595
- type: import_zod3.z.literal("server_tool_use"),
1596
- id: import_zod3.z.string(),
1597
- name: import_zod3.z.string(),
1598
- input: import_zod3.z.record(import_zod3.z.unknown()).nullish()
1598
+ import_v44.z.object({
1599
+ type: import_v44.z.literal("server_tool_use"),
1600
+ id: import_v44.z.string(),
1601
+ name: import_v44.z.string(),
1602
+ input: import_v44.z.record(import_v44.z.string(), import_v44.z.unknown()).nullish()
1599
1603
  }),
1600
- import_zod3.z.object({
1601
- type: import_zod3.z.literal("web_search_tool_result"),
1602
- tool_use_id: import_zod3.z.string(),
1603
- content: import_zod3.z.union([
1604
- import_zod3.z.array(
1605
- import_zod3.z.object({
1606
- type: import_zod3.z.literal("web_search_result"),
1607
- url: import_zod3.z.string(),
1608
- title: import_zod3.z.string(),
1609
- encrypted_content: import_zod3.z.string(),
1610
- page_age: import_zod3.z.string().nullish()
1604
+ import_v44.z.object({
1605
+ type: import_v44.z.literal("web_search_tool_result"),
1606
+ tool_use_id: import_v44.z.string(),
1607
+ content: import_v44.z.union([
1608
+ import_v44.z.array(
1609
+ import_v44.z.object({
1610
+ type: import_v44.z.literal("web_search_result"),
1611
+ url: import_v44.z.string(),
1612
+ title: import_v44.z.string(),
1613
+ encrypted_content: import_v44.z.string(),
1614
+ page_age: import_v44.z.string().nullish()
1611
1615
  })
1612
1616
  ),
1613
- import_zod3.z.object({
1614
- type: import_zod3.z.literal("web_search_tool_result_error"),
1615
- error_code: import_zod3.z.string()
1617
+ import_v44.z.object({
1618
+ type: import_v44.z.literal("web_search_tool_result_error"),
1619
+ error_code: import_v44.z.string()
1616
1620
  })
1617
1621
  ])
1618
1622
  })
1619
1623
  ])
1620
1624
  }),
1621
- import_zod3.z.object({
1622
- type: import_zod3.z.literal("content_block_delta"),
1623
- index: import_zod3.z.number(),
1624
- delta: import_zod3.z.discriminatedUnion("type", [
1625
- import_zod3.z.object({
1626
- type: import_zod3.z.literal("input_json_delta"),
1627
- partial_json: import_zod3.z.string()
1625
+ import_v44.z.object({
1626
+ type: import_v44.z.literal("content_block_delta"),
1627
+ index: import_v44.z.number(),
1628
+ delta: import_v44.z.discriminatedUnion("type", [
1629
+ import_v44.z.object({
1630
+ type: import_v44.z.literal("input_json_delta"),
1631
+ partial_json: import_v44.z.string()
1628
1632
  }),
1629
- import_zod3.z.object({
1630
- type: import_zod3.z.literal("text_delta"),
1631
- text: import_zod3.z.string()
1633
+ import_v44.z.object({
1634
+ type: import_v44.z.literal("text_delta"),
1635
+ text: import_v44.z.string()
1632
1636
  }),
1633
- import_zod3.z.object({
1634
- type: import_zod3.z.literal("thinking_delta"),
1635
- thinking: import_zod3.z.string()
1637
+ import_v44.z.object({
1638
+ type: import_v44.z.literal("thinking_delta"),
1639
+ thinking: import_v44.z.string()
1636
1640
  }),
1637
- import_zod3.z.object({
1638
- type: import_zod3.z.literal("signature_delta"),
1639
- signature: import_zod3.z.string()
1641
+ import_v44.z.object({
1642
+ type: import_v44.z.literal("signature_delta"),
1643
+ signature: import_v44.z.string()
1640
1644
  }),
1641
- import_zod3.z.object({
1642
- type: import_zod3.z.literal("citations_delta"),
1645
+ import_v44.z.object({
1646
+ type: import_v44.z.literal("citations_delta"),
1643
1647
  citation: citationSchema
1644
1648
  })
1645
1649
  ])
1646
1650
  }),
1647
- import_zod3.z.object({
1648
- type: import_zod3.z.literal("content_block_stop"),
1649
- index: import_zod3.z.number()
1651
+ import_v44.z.object({
1652
+ type: import_v44.z.literal("content_block_stop"),
1653
+ index: import_v44.z.number()
1650
1654
  }),
1651
- import_zod3.z.object({
1652
- type: import_zod3.z.literal("error"),
1653
- error: import_zod3.z.object({
1654
- type: import_zod3.z.string(),
1655
- message: import_zod3.z.string()
1655
+ import_v44.z.object({
1656
+ type: import_v44.z.literal("error"),
1657
+ error: import_v44.z.object({
1658
+ type: import_v44.z.string(),
1659
+ message: import_v44.z.string()
1656
1660
  })
1657
1661
  }),
1658
- import_zod3.z.object({
1659
- type: import_zod3.z.literal("message_delta"),
1660
- delta: import_zod3.z.object({ stop_reason: import_zod3.z.string().nullish() }),
1661
- usage: import_zod3.z.object({ output_tokens: import_zod3.z.number() })
1662
+ import_v44.z.object({
1663
+ type: import_v44.z.literal("message_delta"),
1664
+ delta: import_v44.z.object({ stop_reason: import_v44.z.string().nullish() }),
1665
+ usage: import_v44.z.object({ output_tokens: import_v44.z.number() })
1662
1666
  }),
1663
- import_zod3.z.object({
1664
- type: import_zod3.z.literal("message_stop")
1667
+ import_v44.z.object({
1668
+ type: import_v44.z.literal("message_stop")
1665
1669
  }),
1666
- import_zod3.z.object({
1667
- type: import_zod3.z.literal("ping")
1670
+ import_v44.z.object({
1671
+ type: import_v44.z.literal("ping")
1668
1672
  })
1669
1673
  ]);
1670
- var anthropicReasoningMetadataSchema = import_zod3.z.object({
1671
- signature: import_zod3.z.string().optional(),
1672
- redactedData: import_zod3.z.string().optional()
1674
+ var anthropicReasoningMetadataSchema = import_v44.z.object({
1675
+ signature: import_v44.z.string().optional(),
1676
+ redactedData: import_v44.z.string().optional()
1673
1677
  });
1674
1678
 
1675
1679
  // src/tool/bash_20241022.ts
1676
1680
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
1677
- var import_v42 = __toESM(require("zod/v4"));
1681
+ var import_v45 = __toESM(require("zod/v4"));
1678
1682
  var bash_20241022 = (0, import_provider_utils5.createProviderDefinedToolFactory)({
1679
1683
  id: "anthropic.bash_20241022",
1680
1684
  name: "bash",
1681
- inputSchema: import_v42.default.object({
1682
- command: import_v42.default.string(),
1683
- restart: import_v42.default.boolean().optional()
1685
+ inputSchema: import_v45.default.object({
1686
+ command: import_v45.default.string(),
1687
+ restart: import_v45.default.boolean().optional()
1684
1688
  })
1685
1689
  });
1686
1690
 
1687
1691
  // src/tool/bash_20250124.ts
1688
1692
  var import_provider_utils6 = require("@ai-sdk/provider-utils");
1689
- var import_v43 = __toESM(require("zod/v4"));
1693
+ var import_v46 = __toESM(require("zod/v4"));
1690
1694
  var bash_20250124 = (0, import_provider_utils6.createProviderDefinedToolFactory)({
1691
1695
  id: "anthropic.bashTool_20250124",
1692
1696
  name: "bash",
1693
- inputSchema: import_v43.default.object({
1694
- command: import_v43.default.string(),
1695
- restart: import_v43.default.boolean().optional()
1697
+ inputSchema: import_v46.default.object({
1698
+ command: import_v46.default.string(),
1699
+ restart: import_v46.default.boolean().optional()
1696
1700
  })
1697
1701
  });
1698
1702
 
1699
1703
  // src/tool/computer_20241022.ts
1700
1704
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
1701
- var import_v44 = require("zod/v4");
1705
+ var import_v47 = require("zod/v4");
1702
1706
  var computer_20241022 = (0, import_provider_utils7.createProviderDefinedToolFactory)({
1703
1707
  id: "anthropic.computer_20241022",
1704
1708
  name: "computer",
1705
- inputSchema: import_v44.z.object({
1706
- action: import_v44.z.enum([
1709
+ inputSchema: import_v47.z.object({
1710
+ action: import_v47.z.enum([
1707
1711
  "key",
1708
1712
  "type",
1709
1713
  "mouse_move",
@@ -1715,19 +1719,19 @@ var computer_20241022 = (0, import_provider_utils7.createProviderDefinedToolFact
1715
1719
  "screenshot",
1716
1720
  "cursor_position"
1717
1721
  ]),
1718
- coordinate: import_v44.z.array(import_v44.z.number().int()).optional(),
1719
- text: import_v44.z.string().optional()
1722
+ coordinate: import_v47.z.array(import_v47.z.number().int()).optional(),
1723
+ text: import_v47.z.string().optional()
1720
1724
  })
1721
1725
  });
1722
1726
 
1723
1727
  // src/tool/computer_20250124.ts
1724
1728
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
1725
- var import_v45 = require("zod/v4");
1729
+ var import_v48 = require("zod/v4");
1726
1730
  var computer_20250124 = (0, import_provider_utils8.createProviderDefinedToolFactory)({
1727
1731
  id: "anthropic.computer_20250124",
1728
1732
  name: "computer",
1729
- inputSchema: import_v45.z.object({
1730
- action: import_v45.z.enum([
1733
+ inputSchema: import_v48.z.object({
1734
+ action: import_v48.z.enum([
1731
1735
  "key",
1732
1736
  "hold_key",
1733
1737
  "type",
@@ -1745,46 +1749,46 @@ var computer_20250124 = (0, import_provider_utils8.createProviderDefinedToolFact
1745
1749
  "wait",
1746
1750
  "screenshot"
1747
1751
  ]),
1748
- coordinate: import_v45.z.tuple([import_v45.z.number().int(), import_v45.z.number().int()]).optional(),
1749
- duration: import_v45.z.number().optional(),
1750
- scroll_amount: import_v45.z.number().optional(),
1751
- scroll_direction: import_v45.z.enum(["up", "down", "left", "right"]).optional(),
1752
- start_coordinate: import_v45.z.tuple([import_v45.z.number().int(), import_v45.z.number().int()]).optional(),
1753
- text: import_v45.z.string().optional()
1752
+ coordinate: import_v48.z.tuple([import_v48.z.number().int(), import_v48.z.number().int()]).optional(),
1753
+ duration: import_v48.z.number().optional(),
1754
+ scroll_amount: import_v48.z.number().optional(),
1755
+ scroll_direction: import_v48.z.enum(["up", "down", "left", "right"]).optional(),
1756
+ start_coordinate: import_v48.z.tuple([import_v48.z.number().int(), import_v48.z.number().int()]).optional(),
1757
+ text: import_v48.z.string().optional()
1754
1758
  })
1755
1759
  });
1756
1760
 
1757
1761
  // src/tool/text-editor_20241022.ts
1758
1762
  var import_provider_utils9 = require("@ai-sdk/provider-utils");
1759
- var import_v46 = require("zod/v4");
1763
+ var import_v49 = require("zod/v4");
1760
1764
  var textEditor_20241022 = (0, import_provider_utils9.createProviderDefinedToolFactory)({
1761
1765
  id: "anthropic.text_editor_20241022",
1762
1766
  name: "str_replace_editor",
1763
- inputSchema: import_v46.z.object({
1764
- command: import_v46.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
1765
- path: import_v46.z.string(),
1766
- file_text: import_v46.z.string().optional(),
1767
- insert_line: import_v46.z.number().int().optional(),
1768
- new_str: import_v46.z.string().optional(),
1769
- old_str: import_v46.z.string().optional(),
1770
- view_range: import_v46.z.array(import_v46.z.number().int()).optional()
1767
+ inputSchema: import_v49.z.object({
1768
+ command: import_v49.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
1769
+ path: import_v49.z.string(),
1770
+ file_text: import_v49.z.string().optional(),
1771
+ insert_line: import_v49.z.number().int().optional(),
1772
+ new_str: import_v49.z.string().optional(),
1773
+ old_str: import_v49.z.string().optional(),
1774
+ view_range: import_v49.z.array(import_v49.z.number().int()).optional()
1771
1775
  })
1772
1776
  });
1773
1777
 
1774
1778
  // src/tool/text-editor_20250124.ts
1775
1779
  var import_provider_utils10 = require("@ai-sdk/provider-utils");
1776
- var import_v47 = require("zod/v4");
1780
+ var import_v410 = require("zod/v4");
1777
1781
  var textEditor_20250124 = (0, import_provider_utils10.createProviderDefinedToolFactory)({
1778
1782
  id: "anthropic.text_editor_20250124",
1779
1783
  name: "str_replace_editor",
1780
- inputSchema: import_v47.z.object({
1781
- command: import_v47.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
1782
- path: import_v47.z.string(),
1783
- file_text: import_v47.z.string().optional(),
1784
- insert_line: import_v47.z.number().int().optional(),
1785
- new_str: import_v47.z.string().optional(),
1786
- old_str: import_v47.z.string().optional(),
1787
- view_range: import_v47.z.array(import_v47.z.number().int()).optional()
1784
+ inputSchema: import_v410.z.object({
1785
+ command: import_v410.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
1786
+ path: import_v410.z.string(),
1787
+ file_text: import_v410.z.string().optional(),
1788
+ insert_line: import_v410.z.number().int().optional(),
1789
+ new_str: import_v410.z.string().optional(),
1790
+ old_str: import_v410.z.string().optional(),
1791
+ view_range: import_v410.z.array(import_v410.z.number().int()).optional()
1788
1792
  })
1789
1793
  });
1790
1794