@ai-sdk/anthropic 2.1.0-beta.9 → 3.0.0-beta.15

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
@@ -41,21 +41,21 @@ var import_provider4 = require("@ai-sdk/provider");
41
41
  var import_provider_utils15 = require("@ai-sdk/provider-utils");
42
42
 
43
43
  // src/version.ts
44
- var VERSION = true ? "2.1.0-beta.9" : "0.0.0-test";
44
+ var VERSION = true ? "3.0.0-beta.15" : "0.0.0-test";
45
45
 
46
46
  // src/anthropic-messages-language-model.ts
47
47
  var import_provider3 = require("@ai-sdk/provider");
48
48
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
49
- var import_v47 = require("zod/v4");
49
+ var z7 = __toESM(require("zod/v4"));
50
50
 
51
51
  // src/anthropic-error.ts
52
52
  var import_provider_utils = require("@ai-sdk/provider-utils");
53
- var import_v4 = require("zod/v4");
54
- var anthropicErrorDataSchema = import_v4.z.object({
55
- type: import_v4.z.literal("error"),
56
- error: import_v4.z.object({
57
- type: import_v4.z.string(),
58
- message: import_v4.z.string()
53
+ var z = __toESM(require("zod/v4"));
54
+ var anthropicErrorDataSchema = z.object({
55
+ type: z.literal("error"),
56
+ error: z.object({
57
+ type: z.string(),
58
+ message: z.string()
59
59
  })
60
60
  });
61
61
  var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
@@ -64,48 +64,48 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
64
64
  });
65
65
 
66
66
  // src/anthropic-messages-options.ts
67
- var import_v42 = require("zod/v4");
68
- var anthropicFilePartProviderOptions = import_v42.z.object({
67
+ var z2 = __toESM(require("zod/v4"));
68
+ var anthropicFilePartProviderOptions = z2.object({
69
69
  /**
70
70
  * Citation configuration for this document.
71
71
  * When enabled, this document will generate citations in the response.
72
72
  */
73
- citations: import_v42.z.object({
73
+ citations: z2.object({
74
74
  /**
75
75
  * Enable citations for this document
76
76
  */
77
- enabled: import_v42.z.boolean()
77
+ enabled: z2.boolean()
78
78
  }).optional(),
79
79
  /**
80
80
  * Custom title for the document.
81
81
  * If not provided, the filename will be used.
82
82
  */
83
- title: import_v42.z.string().optional(),
83
+ title: z2.string().optional(),
84
84
  /**
85
85
  * Context about the document that will be passed to the model
86
86
  * but not used towards cited content.
87
87
  * Useful for storing document metadata as text or stringified JSON.
88
88
  */
89
- context: import_v42.z.string().optional()
89
+ context: z2.string().optional()
90
90
  });
91
- var anthropicProviderOptions = import_v42.z.object({
92
- sendReasoning: import_v42.z.boolean().optional(),
93
- thinking: import_v42.z.object({
94
- type: import_v42.z.union([import_v42.z.literal("enabled"), import_v42.z.literal("disabled")]),
95
- budgetTokens: import_v42.z.number().optional()
91
+ var anthropicProviderOptions = z2.object({
92
+ sendReasoning: z2.boolean().optional(),
93
+ thinking: z2.object({
94
+ type: z2.union([z2.literal("enabled"), z2.literal("disabled")]),
95
+ budgetTokens: z2.number().optional()
96
96
  }).optional(),
97
97
  /**
98
98
  * Whether to disable parallel function calling during tool use. Default is false.
99
99
  * When set to true, Claude will use at most one tool per response.
100
100
  */
101
- disableParallelToolUse: import_v42.z.boolean().optional(),
101
+ disableParallelToolUse: z2.boolean().optional(),
102
102
  /**
103
103
  * Cache control settings for this message.
104
104
  * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
105
105
  */
106
- cacheControl: import_v42.z.object({
107
- type: import_v42.z.literal("ephemeral"),
108
- ttl: import_v42.z.union([import_v42.z.literal("5m"), import_v42.z.literal("1h")]).optional()
106
+ cacheControl: z2.object({
107
+ type: z2.literal("ephemeral"),
108
+ ttl: z2.union([z2.literal("5m"), z2.literal("1h")]).optional()
109
109
  }).optional()
110
110
  });
111
111
 
@@ -122,21 +122,21 @@ function getCacheControl(providerMetadata) {
122
122
 
123
123
  // src/tool/text-editor_20250728.ts
124
124
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
125
- var import_v43 = require("zod/v4");
126
- var textEditor_20250728ArgsSchema = import_v43.z.object({
127
- maxCharacters: import_v43.z.number().optional()
125
+ var z3 = __toESM(require("zod/v4"));
126
+ var textEditor_20250728ArgsSchema = z3.object({
127
+ maxCharacters: z3.number().optional()
128
128
  });
129
129
  var factory = (0, import_provider_utils2.createProviderDefinedToolFactory)({
130
130
  id: "anthropic.text_editor_20250728",
131
131
  name: "str_replace_based_edit_tool",
132
- inputSchema: import_v43.z.object({
133
- command: import_v43.z.enum(["view", "create", "str_replace", "insert"]),
134
- path: import_v43.z.string(),
135
- file_text: import_v43.z.string().optional(),
136
- insert_line: import_v43.z.number().int().optional(),
137
- new_str: import_v43.z.string().optional(),
138
- old_str: import_v43.z.string().optional(),
139
- view_range: import_v43.z.array(import_v43.z.number().int()).optional()
132
+ inputSchema: z3.object({
133
+ command: z3.enum(["view", "create", "str_replace", "insert"]),
134
+ path: z3.string(),
135
+ file_text: z3.string().optional(),
136
+ insert_line: z3.number().int().optional(),
137
+ new_str: z3.string().optional(),
138
+ old_str: z3.string().optional(),
139
+ view_range: z3.array(z3.number().int()).optional()
140
140
  })
141
141
  });
142
142
  var textEditor_20250728 = (args = {}) => {
@@ -145,33 +145,33 @@ var textEditor_20250728 = (args = {}) => {
145
145
 
146
146
  // src/tool/web-search_20250305.ts
147
147
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
148
- var import_v44 = require("zod/v4");
149
- var webSearch_20250305ArgsSchema = import_v44.z.object({
150
- maxUses: import_v44.z.number().optional(),
151
- allowedDomains: import_v44.z.array(import_v44.z.string()).optional(),
152
- blockedDomains: import_v44.z.array(import_v44.z.string()).optional(),
153
- userLocation: import_v44.z.object({
154
- type: import_v44.z.literal("approximate"),
155
- city: import_v44.z.string().optional(),
156
- region: import_v44.z.string().optional(),
157
- country: import_v44.z.string().optional(),
158
- timezone: import_v44.z.string().optional()
148
+ var z4 = __toESM(require("zod/v4"));
149
+ var webSearch_20250305ArgsSchema = z4.object({
150
+ maxUses: z4.number().optional(),
151
+ allowedDomains: z4.array(z4.string()).optional(),
152
+ blockedDomains: z4.array(z4.string()).optional(),
153
+ userLocation: z4.object({
154
+ type: z4.literal("approximate"),
155
+ city: z4.string().optional(),
156
+ region: z4.string().optional(),
157
+ country: z4.string().optional(),
158
+ timezone: z4.string().optional()
159
159
  }).optional()
160
160
  });
161
- var webSearch_20250305OutputSchema = import_v44.z.array(
162
- import_v44.z.object({
163
- url: import_v44.z.string(),
164
- title: import_v44.z.string(),
165
- pageAge: import_v44.z.string().nullable(),
166
- encryptedContent: import_v44.z.string(),
167
- type: import_v44.z.literal("web_search_result")
161
+ var webSearch_20250305OutputSchema = z4.array(
162
+ z4.object({
163
+ url: z4.string(),
164
+ title: z4.string(),
165
+ pageAge: z4.string().nullable(),
166
+ encryptedContent: z4.string(),
167
+ type: z4.literal("web_search_result")
168
168
  })
169
169
  );
170
170
  var factory2 = (0, import_provider_utils3.createProviderDefinedToolFactoryWithOutputSchema)({
171
171
  id: "anthropic.web_search_20250305",
172
172
  name: "web_search",
173
- inputSchema: import_v44.z.object({
174
- query: import_v44.z.string()
173
+ inputSchema: z4.object({
174
+ query: z4.string()
175
175
  }),
176
176
  outputSchema: webSearch_20250305OutputSchema
177
177
  });
@@ -181,41 +181,41 @@ var webSearch_20250305 = (args = {}) => {
181
181
 
182
182
  // src/tool/web-fetch-20250910.ts
183
183
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
184
- var import_v45 = require("zod/v4");
185
- var webFetch_20250910ArgsSchema = import_v45.z.object({
186
- maxUses: import_v45.z.number().optional(),
187
- allowedDomains: import_v45.z.array(import_v45.z.string()).optional(),
188
- blockedDomains: import_v45.z.array(import_v45.z.string()).optional(),
189
- citations: import_v45.z.object({ enabled: import_v45.z.boolean() }).optional(),
190
- maxContentTokens: import_v45.z.number().optional()
184
+ var z5 = __toESM(require("zod/v4"));
185
+ var webFetch_20250910ArgsSchema = z5.object({
186
+ maxUses: z5.number().optional(),
187
+ allowedDomains: z5.array(z5.string()).optional(),
188
+ blockedDomains: z5.array(z5.string()).optional(),
189
+ citations: z5.object({ enabled: z5.boolean() }).optional(),
190
+ maxContentTokens: z5.number().optional()
191
191
  });
192
- var webFetch_20250910OutputSchema = import_v45.z.object({
193
- type: import_v45.z.literal("web_fetch_result"),
194
- url: import_v45.z.string(),
195
- content: import_v45.z.object({
196
- type: import_v45.z.literal("document"),
197
- title: import_v45.z.string(),
198
- citations: import_v45.z.object({ enabled: import_v45.z.boolean() }).optional(),
199
- source: import_v45.z.union([
200
- import_v45.z.object({
201
- type: import_v45.z.literal("base64"),
202
- mediaType: import_v45.z.literal("application/pdf"),
203
- data: import_v45.z.string()
192
+ var webFetch_20250910OutputSchema = z5.object({
193
+ type: z5.literal("web_fetch_result"),
194
+ url: z5.string(),
195
+ content: z5.object({
196
+ type: z5.literal("document"),
197
+ title: z5.string(),
198
+ citations: z5.object({ enabled: z5.boolean() }).optional(),
199
+ source: z5.union([
200
+ z5.object({
201
+ type: z5.literal("base64"),
202
+ mediaType: z5.literal("application/pdf"),
203
+ data: z5.string()
204
204
  }),
205
- import_v45.z.object({
206
- type: import_v45.z.literal("text"),
207
- mediaType: import_v45.z.literal("text/plain"),
208
- data: import_v45.z.string()
205
+ z5.object({
206
+ type: z5.literal("text"),
207
+ mediaType: z5.literal("text/plain"),
208
+ data: z5.string()
209
209
  })
210
210
  ])
211
211
  }),
212
- retrievedAt: import_v45.z.string().nullable()
212
+ retrievedAt: z5.string().nullable()
213
213
  });
214
214
  var factory3 = (0, import_provider_utils4.createProviderDefinedToolFactoryWithOutputSchema)({
215
215
  id: "anthropic.web_fetch_20250910",
216
216
  name: "web_fetch",
217
- inputSchema: import_v45.z.object({
218
- url: import_v45.z.string()
217
+ inputSchema: z5.object({
218
+ url: z5.string()
219
219
  }),
220
220
  outputSchema: webFetch_20250910OutputSchema
221
221
  });
@@ -426,18 +426,18 @@ var import_provider_utils6 = require("@ai-sdk/provider-utils");
426
426
 
427
427
  // src/tool/code-execution_20250522.ts
428
428
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
429
- var import_v46 = require("zod/v4");
430
- var codeExecution_20250522OutputSchema = import_v46.z.object({
431
- type: import_v46.z.literal("code_execution_result"),
432
- stdout: import_v46.z.string(),
433
- stderr: import_v46.z.string(),
434
- return_code: import_v46.z.number()
429
+ var z6 = __toESM(require("zod/v4"));
430
+ var codeExecution_20250522OutputSchema = z6.object({
431
+ type: z6.literal("code_execution_result"),
432
+ stdout: z6.string(),
433
+ stderr: z6.string(),
434
+ return_code: z6.number()
435
435
  });
436
436
  var factory4 = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
437
437
  id: "anthropic.code_execution_20250522",
438
438
  name: "code_execution",
439
- inputSchema: import_v46.z.object({
440
- code: import_v46.z.string()
439
+ inputSchema: z6.object({
440
+ code: z6.string()
441
441
  }),
442
442
  outputSchema: codeExecution_20250522OutputSchema
443
443
  });
@@ -467,7 +467,7 @@ async function convertToAnthropicMessagesPrompt({
467
467
  sendReasoning,
468
468
  warnings
469
469
  }) {
470
- var _a, _b, _c, _d, _e;
470
+ var _a, _b, _c, _d, _e, _f;
471
471
  const betas = /* @__PURE__ */ new Set();
472
472
  const blocks = groupIntoBlocks(prompt);
473
473
  let system = void 0;
@@ -643,6 +643,9 @@ async function convertToAnthropicMessagesPrompt({
643
643
  case "error-text":
644
644
  contentValue = output.value;
645
645
  break;
646
+ case "execution-denied":
647
+ contentValue = (_e = output.reason) != null ? _e : "Tool execution denied.";
648
+ break;
646
649
  case "json":
647
650
  case "error-json":
648
651
  default:
@@ -677,7 +680,7 @@ async function convertToAnthropicMessagesPrompt({
677
680
  for (let k = 0; k < content.length; k++) {
678
681
  const part = content[k];
679
682
  const isLastContentPart = k === content.length - 1;
680
- const cacheControl = (_e = getCacheControl(part.providerOptions)) != null ? _e : isLastContentPart ? getCacheControl(message.providerOptions) : void 0;
683
+ const cacheControl = (_f = getCacheControl(part.providerOptions)) != null ? _f : isLastContentPart ? getCacheControl(message.providerOptions) : void 0;
681
684
  switch (part.type) {
682
685
  case "text": {
683
686
  anthropicContent.push({
@@ -937,36 +940,36 @@ function mapAnthropicStopReason({
937
940
 
938
941
  // src/anthropic-messages-language-model.ts
939
942
  var citationSchemas = {
940
- webSearchResult: import_v47.z.object({
941
- type: import_v47.z.literal("web_search_result_location"),
942
- cited_text: import_v47.z.string(),
943
- url: import_v47.z.string(),
944
- title: import_v47.z.string(),
945
- encrypted_index: import_v47.z.string()
943
+ webSearchResult: z7.object({
944
+ type: z7.literal("web_search_result_location"),
945
+ cited_text: z7.string(),
946
+ url: z7.string(),
947
+ title: z7.string(),
948
+ encrypted_index: z7.string()
946
949
  }),
947
- pageLocation: import_v47.z.object({
948
- type: import_v47.z.literal("page_location"),
949
- cited_text: import_v47.z.string(),
950
- document_index: import_v47.z.number(),
951
- document_title: import_v47.z.string().nullable(),
952
- start_page_number: import_v47.z.number(),
953
- end_page_number: import_v47.z.number()
950
+ pageLocation: z7.object({
951
+ type: z7.literal("page_location"),
952
+ cited_text: z7.string(),
953
+ document_index: z7.number(),
954
+ document_title: z7.string().nullable(),
955
+ start_page_number: z7.number(),
956
+ end_page_number: z7.number()
954
957
  }),
955
- charLocation: import_v47.z.object({
956
- type: import_v47.z.literal("char_location"),
957
- cited_text: import_v47.z.string(),
958
- document_index: import_v47.z.number(),
959
- document_title: import_v47.z.string().nullable(),
960
- start_char_index: import_v47.z.number(),
961
- end_char_index: import_v47.z.number()
958
+ charLocation: z7.object({
959
+ type: z7.literal("char_location"),
960
+ cited_text: z7.string(),
961
+ document_index: z7.number(),
962
+ document_title: z7.string().nullable(),
963
+ start_char_index: z7.number(),
964
+ end_char_index: z7.number()
962
965
  })
963
966
  };
964
- var citationSchema = import_v47.z.discriminatedUnion("type", [
967
+ var citationSchema = z7.discriminatedUnion("type", [
965
968
  citationSchemas.webSearchResult,
966
969
  citationSchemas.pageLocation,
967
970
  citationSchemas.charLocation
968
971
  ]);
969
- var documentCitationSchema = import_v47.z.discriminatedUnion("type", [
972
+ var documentCitationSchema = z7.discriminatedUnion("type", [
970
973
  citationSchemas.pageLocation,
971
974
  citationSchemas.charLocation
972
975
  ]);
@@ -1214,7 +1217,7 @@ var AnthropicMessagesLanguageModel = class {
1214
1217
  });
1215
1218
  }
1216
1219
  async doGenerate(options) {
1217
- var _a, _b, _c, _d, _e;
1220
+ var _a, _b, _c, _d, _e, _f;
1218
1221
  const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
1219
1222
  const citationDocuments = this.extractCitationDocuments(options.prompt);
1220
1223
  const {
@@ -1441,7 +1444,8 @@ var AnthropicMessagesLanguageModel = class {
1441
1444
  providerMetadata: {
1442
1445
  anthropic: {
1443
1446
  usage: response.usage,
1444
- cacheCreationInputTokens: (_e = response.usage.cache_creation_input_tokens) != null ? _e : null
1447
+ cacheCreationInputTokens: (_e = response.usage.cache_creation_input_tokens) != null ? _e : null,
1448
+ stopSequence: (_f = response.stop_sequence) != null ? _f : null
1445
1449
  }
1446
1450
  }
1447
1451
  };
@@ -1470,6 +1474,7 @@ var AnthropicMessagesLanguageModel = class {
1470
1474
  const contentBlocks = {};
1471
1475
  let rawUsage = void 0;
1472
1476
  let cacheCreationInputTokens = null;
1477
+ let stopSequence = null;
1473
1478
  let blockType = void 0;
1474
1479
  const generateId3 = this.generateId;
1475
1480
  return {
@@ -1479,7 +1484,7 @@ var AnthropicMessagesLanguageModel = class {
1479
1484
  controller.enqueue({ type: "stream-start", warnings });
1480
1485
  },
1481
1486
  transform(chunk, controller) {
1482
- var _a, _b, _c, _d, _e, _f, _g;
1487
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1483
1488
  if (options.includeRawChunks) {
1484
1489
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1485
1490
  }
@@ -1817,6 +1822,7 @@ var AnthropicMessagesLanguageModel = class {
1817
1822
  finishReason: value.delta.stop_reason,
1818
1823
  isJsonResponseFromTool: usesJsonResponseTool
1819
1824
  });
1825
+ stopSequence = (_h = value.delta.stop_sequence) != null ? _h : null;
1820
1826
  rawUsage = {
1821
1827
  ...rawUsage,
1822
1828
  ...value.usage
@@ -1831,7 +1837,8 @@ var AnthropicMessagesLanguageModel = class {
1831
1837
  providerMetadata: {
1832
1838
  anthropic: {
1833
1839
  usage: rawUsage != null ? rawUsage : null,
1834
- cacheCreationInputTokens
1840
+ cacheCreationInputTokens,
1841
+ stopSequence
1835
1842
  }
1836
1843
  }
1837
1844
  });
@@ -1854,299 +1861,303 @@ var AnthropicMessagesLanguageModel = class {
1854
1861
  };
1855
1862
  }
1856
1863
  };
1857
- var anthropicMessagesResponseSchema = import_v47.z.object({
1858
- type: import_v47.z.literal("message"),
1859
- id: import_v47.z.string().nullish(),
1860
- model: import_v47.z.string().nullish(),
1861
- content: import_v47.z.array(
1862
- import_v47.z.discriminatedUnion("type", [
1863
- import_v47.z.object({
1864
- type: import_v47.z.literal("text"),
1865
- text: import_v47.z.string(),
1866
- citations: import_v47.z.array(citationSchema).optional()
1864
+ var anthropicMessagesResponseSchema = z7.object({
1865
+ type: z7.literal("message"),
1866
+ id: z7.string().nullish(),
1867
+ model: z7.string().nullish(),
1868
+ content: z7.array(
1869
+ z7.discriminatedUnion("type", [
1870
+ z7.object({
1871
+ type: z7.literal("text"),
1872
+ text: z7.string(),
1873
+ citations: z7.array(citationSchema).optional()
1867
1874
  }),
1868
- import_v47.z.object({
1869
- type: import_v47.z.literal("thinking"),
1870
- thinking: import_v47.z.string(),
1871
- signature: import_v47.z.string()
1875
+ z7.object({
1876
+ type: z7.literal("thinking"),
1877
+ thinking: z7.string(),
1878
+ signature: z7.string()
1872
1879
  }),
1873
- import_v47.z.object({
1874
- type: import_v47.z.literal("redacted_thinking"),
1875
- data: import_v47.z.string()
1880
+ z7.object({
1881
+ type: z7.literal("redacted_thinking"),
1882
+ data: z7.string()
1876
1883
  }),
1877
- import_v47.z.object({
1878
- type: import_v47.z.literal("tool_use"),
1879
- id: import_v47.z.string(),
1880
- name: import_v47.z.string(),
1881
- input: import_v47.z.unknown()
1884
+ z7.object({
1885
+ type: z7.literal("tool_use"),
1886
+ id: z7.string(),
1887
+ name: z7.string(),
1888
+ input: z7.unknown()
1882
1889
  }),
1883
- import_v47.z.object({
1884
- type: import_v47.z.literal("server_tool_use"),
1885
- id: import_v47.z.string(),
1886
- name: import_v47.z.string(),
1887
- input: import_v47.z.record(import_v47.z.string(), import_v47.z.unknown()).nullish()
1890
+ z7.object({
1891
+ type: z7.literal("server_tool_use"),
1892
+ id: z7.string(),
1893
+ name: z7.string(),
1894
+ input: z7.record(z7.string(), z7.unknown()).nullish()
1888
1895
  }),
1889
- import_v47.z.object({
1890
- type: import_v47.z.literal("web_fetch_tool_result"),
1891
- tool_use_id: import_v47.z.string(),
1892
- content: import_v47.z.union([
1893
- import_v47.z.object({
1894
- type: import_v47.z.literal("web_fetch_result"),
1895
- url: import_v47.z.string(),
1896
- retrieved_at: import_v47.z.string(),
1897
- content: import_v47.z.object({
1898
- type: import_v47.z.literal("document"),
1899
- title: import_v47.z.string().nullable(),
1900
- citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
1901
- source: import_v47.z.object({
1902
- type: import_v47.z.literal("text"),
1903
- media_type: import_v47.z.string(),
1904
- data: import_v47.z.string()
1896
+ z7.object({
1897
+ type: z7.literal("web_fetch_tool_result"),
1898
+ tool_use_id: z7.string(),
1899
+ content: z7.union([
1900
+ z7.object({
1901
+ type: z7.literal("web_fetch_result"),
1902
+ url: z7.string(),
1903
+ retrieved_at: z7.string(),
1904
+ content: z7.object({
1905
+ type: z7.literal("document"),
1906
+ title: z7.string().nullable(),
1907
+ citations: z7.object({ enabled: z7.boolean() }).optional(),
1908
+ source: z7.object({
1909
+ type: z7.literal("text"),
1910
+ media_type: z7.string(),
1911
+ data: z7.string()
1905
1912
  })
1906
1913
  })
1907
1914
  }),
1908
- import_v47.z.object({
1909
- type: import_v47.z.literal("web_fetch_tool_result_error"),
1910
- error_code: import_v47.z.string()
1915
+ z7.object({
1916
+ type: z7.literal("web_fetch_tool_result_error"),
1917
+ error_code: z7.string()
1911
1918
  })
1912
1919
  ])
1913
1920
  }),
1914
- import_v47.z.object({
1915
- type: import_v47.z.literal("web_search_tool_result"),
1916
- tool_use_id: import_v47.z.string(),
1917
- content: import_v47.z.union([
1918
- import_v47.z.array(
1919
- import_v47.z.object({
1920
- type: import_v47.z.literal("web_search_result"),
1921
- url: import_v47.z.string(),
1922
- title: import_v47.z.string(),
1923
- encrypted_content: import_v47.z.string(),
1924
- page_age: import_v47.z.string().nullish()
1921
+ z7.object({
1922
+ type: z7.literal("web_search_tool_result"),
1923
+ tool_use_id: z7.string(),
1924
+ content: z7.union([
1925
+ z7.array(
1926
+ z7.object({
1927
+ type: z7.literal("web_search_result"),
1928
+ url: z7.string(),
1929
+ title: z7.string(),
1930
+ encrypted_content: z7.string(),
1931
+ page_age: z7.string().nullish()
1925
1932
  })
1926
1933
  ),
1927
- import_v47.z.object({
1928
- type: import_v47.z.literal("web_search_tool_result_error"),
1929
- error_code: import_v47.z.string()
1934
+ z7.object({
1935
+ type: z7.literal("web_search_tool_result_error"),
1936
+ error_code: z7.string()
1930
1937
  })
1931
1938
  ])
1932
1939
  }),
1933
- import_v47.z.object({
1934
- type: import_v47.z.literal("code_execution_tool_result"),
1935
- tool_use_id: import_v47.z.string(),
1936
- content: import_v47.z.union([
1937
- import_v47.z.object({
1938
- type: import_v47.z.literal("code_execution_result"),
1939
- stdout: import_v47.z.string(),
1940
- stderr: import_v47.z.string(),
1941
- return_code: import_v47.z.number()
1940
+ z7.object({
1941
+ type: z7.literal("code_execution_tool_result"),
1942
+ tool_use_id: z7.string(),
1943
+ content: z7.union([
1944
+ z7.object({
1945
+ type: z7.literal("code_execution_result"),
1946
+ stdout: z7.string(),
1947
+ stderr: z7.string(),
1948
+ return_code: z7.number()
1942
1949
  }),
1943
- import_v47.z.object({
1944
- type: import_v47.z.literal("code_execution_tool_result_error"),
1945
- error_code: import_v47.z.string()
1950
+ z7.object({
1951
+ type: z7.literal("code_execution_tool_result_error"),
1952
+ error_code: z7.string()
1946
1953
  })
1947
1954
  ])
1948
1955
  })
1949
1956
  ])
1950
1957
  ),
1951
- stop_reason: import_v47.z.string().nullish(),
1952
- usage: import_v47.z.looseObject({
1953
- input_tokens: import_v47.z.number(),
1954
- output_tokens: import_v47.z.number(),
1955
- cache_creation_input_tokens: import_v47.z.number().nullish(),
1956
- cache_read_input_tokens: import_v47.z.number().nullish()
1958
+ stop_reason: z7.string().nullish(),
1959
+ stop_sequence: z7.string().nullish(),
1960
+ usage: z7.looseObject({
1961
+ input_tokens: z7.number(),
1962
+ output_tokens: z7.number(),
1963
+ cache_creation_input_tokens: z7.number().nullish(),
1964
+ cache_read_input_tokens: z7.number().nullish()
1957
1965
  })
1958
1966
  });
1959
- var anthropicMessagesChunkSchema = import_v47.z.discriminatedUnion("type", [
1960
- import_v47.z.object({
1961
- type: import_v47.z.literal("message_start"),
1962
- message: import_v47.z.object({
1963
- id: import_v47.z.string().nullish(),
1964
- model: import_v47.z.string().nullish(),
1965
- usage: import_v47.z.looseObject({
1966
- input_tokens: import_v47.z.number(),
1967
- cache_creation_input_tokens: import_v47.z.number().nullish(),
1968
- cache_read_input_tokens: import_v47.z.number().nullish()
1967
+ var anthropicMessagesChunkSchema = z7.discriminatedUnion("type", [
1968
+ z7.object({
1969
+ type: z7.literal("message_start"),
1970
+ message: z7.object({
1971
+ id: z7.string().nullish(),
1972
+ model: z7.string().nullish(),
1973
+ usage: z7.looseObject({
1974
+ input_tokens: z7.number(),
1975
+ cache_creation_input_tokens: z7.number().nullish(),
1976
+ cache_read_input_tokens: z7.number().nullish()
1969
1977
  })
1970
1978
  })
1971
1979
  }),
1972
- import_v47.z.object({
1973
- type: import_v47.z.literal("content_block_start"),
1974
- index: import_v47.z.number(),
1975
- content_block: import_v47.z.discriminatedUnion("type", [
1976
- import_v47.z.object({
1977
- type: import_v47.z.literal("text"),
1978
- text: import_v47.z.string()
1980
+ z7.object({
1981
+ type: z7.literal("content_block_start"),
1982
+ index: z7.number(),
1983
+ content_block: z7.discriminatedUnion("type", [
1984
+ z7.object({
1985
+ type: z7.literal("text"),
1986
+ text: z7.string()
1979
1987
  }),
1980
- import_v47.z.object({
1981
- type: import_v47.z.literal("thinking"),
1982
- thinking: import_v47.z.string()
1988
+ z7.object({
1989
+ type: z7.literal("thinking"),
1990
+ thinking: z7.string()
1983
1991
  }),
1984
- import_v47.z.object({
1985
- type: import_v47.z.literal("tool_use"),
1986
- id: import_v47.z.string(),
1987
- name: import_v47.z.string()
1992
+ z7.object({
1993
+ type: z7.literal("tool_use"),
1994
+ id: z7.string(),
1995
+ name: z7.string()
1988
1996
  }),
1989
- import_v47.z.object({
1990
- type: import_v47.z.literal("redacted_thinking"),
1991
- data: import_v47.z.string()
1997
+ z7.object({
1998
+ type: z7.literal("redacted_thinking"),
1999
+ data: z7.string()
1992
2000
  }),
1993
- import_v47.z.object({
1994
- type: import_v47.z.literal("server_tool_use"),
1995
- id: import_v47.z.string(),
1996
- name: import_v47.z.string(),
1997
- input: import_v47.z.record(import_v47.z.string(), import_v47.z.unknown()).nullish()
2001
+ z7.object({
2002
+ type: z7.literal("server_tool_use"),
2003
+ id: z7.string(),
2004
+ name: z7.string(),
2005
+ input: z7.record(z7.string(), z7.unknown()).nullish()
1998
2006
  }),
1999
- import_v47.z.object({
2000
- type: import_v47.z.literal("web_fetch_tool_result"),
2001
- tool_use_id: import_v47.z.string(),
2002
- content: import_v47.z.union([
2003
- import_v47.z.object({
2004
- type: import_v47.z.literal("web_fetch_result"),
2005
- url: import_v47.z.string(),
2006
- retrieved_at: import_v47.z.string(),
2007
- content: import_v47.z.object({
2008
- type: import_v47.z.literal("document"),
2009
- title: import_v47.z.string().nullable(),
2010
- citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
2011
- source: import_v47.z.object({
2012
- type: import_v47.z.literal("text"),
2013
- media_type: import_v47.z.string(),
2014
- data: import_v47.z.string()
2007
+ z7.object({
2008
+ type: z7.literal("web_fetch_tool_result"),
2009
+ tool_use_id: z7.string(),
2010
+ content: z7.union([
2011
+ z7.object({
2012
+ type: z7.literal("web_fetch_result"),
2013
+ url: z7.string(),
2014
+ retrieved_at: z7.string(),
2015
+ content: z7.object({
2016
+ type: z7.literal("document"),
2017
+ title: z7.string().nullable(),
2018
+ citations: z7.object({ enabled: z7.boolean() }).optional(),
2019
+ source: z7.object({
2020
+ type: z7.literal("text"),
2021
+ media_type: z7.string(),
2022
+ data: z7.string()
2015
2023
  })
2016
2024
  })
2017
2025
  }),
2018
- import_v47.z.object({
2019
- type: import_v47.z.literal("web_fetch_tool_result_error"),
2020
- error_code: import_v47.z.string()
2026
+ z7.object({
2027
+ type: z7.literal("web_fetch_tool_result_error"),
2028
+ error_code: z7.string()
2021
2029
  })
2022
2030
  ])
2023
2031
  }),
2024
- import_v47.z.object({
2025
- type: import_v47.z.literal("web_search_tool_result"),
2026
- tool_use_id: import_v47.z.string(),
2027
- content: import_v47.z.union([
2028
- import_v47.z.array(
2029
- import_v47.z.object({
2030
- type: import_v47.z.literal("web_search_result"),
2031
- url: import_v47.z.string(),
2032
- title: import_v47.z.string(),
2033
- encrypted_content: import_v47.z.string(),
2034
- page_age: import_v47.z.string().nullish()
2032
+ z7.object({
2033
+ type: z7.literal("web_search_tool_result"),
2034
+ tool_use_id: z7.string(),
2035
+ content: z7.union([
2036
+ z7.array(
2037
+ z7.object({
2038
+ type: z7.literal("web_search_result"),
2039
+ url: z7.string(),
2040
+ title: z7.string(),
2041
+ encrypted_content: z7.string(),
2042
+ page_age: z7.string().nullish()
2035
2043
  })
2036
2044
  ),
2037
- import_v47.z.object({
2038
- type: import_v47.z.literal("web_search_tool_result_error"),
2039
- error_code: import_v47.z.string()
2045
+ z7.object({
2046
+ type: z7.literal("web_search_tool_result_error"),
2047
+ error_code: z7.string()
2040
2048
  })
2041
2049
  ])
2042
2050
  }),
2043
- import_v47.z.object({
2044
- type: import_v47.z.literal("code_execution_tool_result"),
2045
- tool_use_id: import_v47.z.string(),
2046
- content: import_v47.z.union([
2047
- import_v47.z.object({
2048
- type: import_v47.z.literal("code_execution_result"),
2049
- stdout: import_v47.z.string(),
2050
- stderr: import_v47.z.string(),
2051
- return_code: import_v47.z.number()
2051
+ z7.object({
2052
+ type: z7.literal("code_execution_tool_result"),
2053
+ tool_use_id: z7.string(),
2054
+ content: z7.union([
2055
+ z7.object({
2056
+ type: z7.literal("code_execution_result"),
2057
+ stdout: z7.string(),
2058
+ stderr: z7.string(),
2059
+ return_code: z7.number()
2052
2060
  }),
2053
- import_v47.z.object({
2054
- type: import_v47.z.literal("code_execution_tool_result_error"),
2055
- error_code: import_v47.z.string()
2061
+ z7.object({
2062
+ type: z7.literal("code_execution_tool_result_error"),
2063
+ error_code: z7.string()
2056
2064
  })
2057
2065
  ])
2058
2066
  })
2059
2067
  ])
2060
2068
  }),
2061
- import_v47.z.object({
2062
- type: import_v47.z.literal("content_block_delta"),
2063
- index: import_v47.z.number(),
2064
- delta: import_v47.z.discriminatedUnion("type", [
2065
- import_v47.z.object({
2066
- type: import_v47.z.literal("input_json_delta"),
2067
- partial_json: import_v47.z.string()
2069
+ z7.object({
2070
+ type: z7.literal("content_block_delta"),
2071
+ index: z7.number(),
2072
+ delta: z7.discriminatedUnion("type", [
2073
+ z7.object({
2074
+ type: z7.literal("input_json_delta"),
2075
+ partial_json: z7.string()
2068
2076
  }),
2069
- import_v47.z.object({
2070
- type: import_v47.z.literal("text_delta"),
2071
- text: import_v47.z.string()
2077
+ z7.object({
2078
+ type: z7.literal("text_delta"),
2079
+ text: z7.string()
2072
2080
  }),
2073
- import_v47.z.object({
2074
- type: import_v47.z.literal("thinking_delta"),
2075
- thinking: import_v47.z.string()
2081
+ z7.object({
2082
+ type: z7.literal("thinking_delta"),
2083
+ thinking: z7.string()
2076
2084
  }),
2077
- import_v47.z.object({
2078
- type: import_v47.z.literal("signature_delta"),
2079
- signature: import_v47.z.string()
2085
+ z7.object({
2086
+ type: z7.literal("signature_delta"),
2087
+ signature: z7.string()
2080
2088
  }),
2081
- import_v47.z.object({
2082
- type: import_v47.z.literal("citations_delta"),
2089
+ z7.object({
2090
+ type: z7.literal("citations_delta"),
2083
2091
  citation: citationSchema
2084
2092
  })
2085
2093
  ])
2086
2094
  }),
2087
- import_v47.z.object({
2088
- type: import_v47.z.literal("content_block_stop"),
2089
- index: import_v47.z.number()
2095
+ z7.object({
2096
+ type: z7.literal("content_block_stop"),
2097
+ index: z7.number()
2090
2098
  }),
2091
- import_v47.z.object({
2092
- type: import_v47.z.literal("error"),
2093
- error: import_v47.z.object({
2094
- type: import_v47.z.string(),
2095
- message: import_v47.z.string()
2099
+ z7.object({
2100
+ type: z7.literal("error"),
2101
+ error: z7.object({
2102
+ type: z7.string(),
2103
+ message: z7.string()
2096
2104
  })
2097
2105
  }),
2098
- import_v47.z.object({
2099
- type: import_v47.z.literal("message_delta"),
2100
- delta: import_v47.z.object({ stop_reason: import_v47.z.string().nullish() }),
2101
- usage: import_v47.z.looseObject({
2102
- output_tokens: import_v47.z.number(),
2103
- cache_creation_input_tokens: import_v47.z.number().nullish()
2106
+ z7.object({
2107
+ type: z7.literal("message_delta"),
2108
+ delta: z7.object({
2109
+ stop_reason: z7.string().nullish(),
2110
+ stop_sequence: z7.string().nullish()
2111
+ }),
2112
+ usage: z7.looseObject({
2113
+ output_tokens: z7.number(),
2114
+ cache_creation_input_tokens: z7.number().nullish()
2104
2115
  })
2105
2116
  }),
2106
- import_v47.z.object({
2107
- type: import_v47.z.literal("message_stop")
2117
+ z7.object({
2118
+ type: z7.literal("message_stop")
2108
2119
  }),
2109
- import_v47.z.object({
2110
- type: import_v47.z.literal("ping")
2120
+ z7.object({
2121
+ type: z7.literal("ping")
2111
2122
  })
2112
2123
  ]);
2113
- var anthropicReasoningMetadataSchema = import_v47.z.object({
2114
- signature: import_v47.z.string().optional(),
2115
- redactedData: import_v47.z.string().optional()
2124
+ var anthropicReasoningMetadataSchema = z7.object({
2125
+ signature: z7.string().optional(),
2126
+ redactedData: z7.string().optional()
2116
2127
  });
2117
2128
 
2118
2129
  // src/tool/bash_20241022.ts
2119
2130
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
2120
- var import_v48 = __toESM(require("zod/v4"));
2131
+ var import_v4 = __toESM(require("zod/v4"));
2121
2132
  var bash_20241022 = (0, import_provider_utils8.createProviderDefinedToolFactory)({
2122
2133
  id: "anthropic.bash_20241022",
2123
2134
  name: "bash",
2124
- inputSchema: import_v48.default.object({
2125
- command: import_v48.default.string(),
2126
- restart: import_v48.default.boolean().optional()
2135
+ inputSchema: import_v4.default.object({
2136
+ command: import_v4.default.string(),
2137
+ restart: import_v4.default.boolean().optional()
2127
2138
  })
2128
2139
  });
2129
2140
 
2130
2141
  // src/tool/bash_20250124.ts
2131
2142
  var import_provider_utils9 = require("@ai-sdk/provider-utils");
2132
- var import_v49 = __toESM(require("zod/v4"));
2143
+ var import_v42 = __toESM(require("zod/v4"));
2133
2144
  var bash_20250124 = (0, import_provider_utils9.createProviderDefinedToolFactory)({
2134
2145
  id: "anthropic.bash_20250124",
2135
2146
  name: "bash",
2136
- inputSchema: import_v49.default.object({
2137
- command: import_v49.default.string(),
2138
- restart: import_v49.default.boolean().optional()
2147
+ inputSchema: import_v42.default.object({
2148
+ command: import_v42.default.string(),
2149
+ restart: import_v42.default.boolean().optional()
2139
2150
  })
2140
2151
  });
2141
2152
 
2142
2153
  // src/tool/computer_20241022.ts
2143
2154
  var import_provider_utils10 = require("@ai-sdk/provider-utils");
2144
- var import_v410 = require("zod/v4");
2155
+ var z10 = __toESM(require("zod/v4"));
2145
2156
  var computer_20241022 = (0, import_provider_utils10.createProviderDefinedToolFactory)({
2146
2157
  id: "anthropic.computer_20241022",
2147
2158
  name: "computer",
2148
- inputSchema: import_v410.z.object({
2149
- action: import_v410.z.enum([
2159
+ inputSchema: z10.object({
2160
+ action: z10.enum([
2150
2161
  "key",
2151
2162
  "type",
2152
2163
  "mouse_move",
@@ -2158,19 +2169,19 @@ var computer_20241022 = (0, import_provider_utils10.createProviderDefinedToolFac
2158
2169
  "screenshot",
2159
2170
  "cursor_position"
2160
2171
  ]),
2161
- coordinate: import_v410.z.array(import_v410.z.number().int()).optional(),
2162
- text: import_v410.z.string().optional()
2172
+ coordinate: z10.array(z10.number().int()).optional(),
2173
+ text: z10.string().optional()
2163
2174
  })
2164
2175
  });
2165
2176
 
2166
2177
  // src/tool/computer_20250124.ts
2167
2178
  var import_provider_utils11 = require("@ai-sdk/provider-utils");
2168
- var import_v411 = require("zod/v4");
2179
+ var z11 = __toESM(require("zod/v4"));
2169
2180
  var computer_20250124 = (0, import_provider_utils11.createProviderDefinedToolFactory)({
2170
2181
  id: "anthropic.computer_20250124",
2171
2182
  name: "computer",
2172
- inputSchema: import_v411.z.object({
2173
- action: import_v411.z.enum([
2183
+ inputSchema: z11.object({
2184
+ action: z11.enum([
2174
2185
  "key",
2175
2186
  "hold_key",
2176
2187
  "type",
@@ -2188,63 +2199,63 @@ var computer_20250124 = (0, import_provider_utils11.createProviderDefinedToolFac
2188
2199
  "wait",
2189
2200
  "screenshot"
2190
2201
  ]),
2191
- coordinate: import_v411.z.tuple([import_v411.z.number().int(), import_v411.z.number().int()]).optional(),
2192
- duration: import_v411.z.number().optional(),
2193
- scroll_amount: import_v411.z.number().optional(),
2194
- scroll_direction: import_v411.z.enum(["up", "down", "left", "right"]).optional(),
2195
- start_coordinate: import_v411.z.tuple([import_v411.z.number().int(), import_v411.z.number().int()]).optional(),
2196
- text: import_v411.z.string().optional()
2202
+ coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2203
+ duration: z11.number().optional(),
2204
+ scroll_amount: z11.number().optional(),
2205
+ scroll_direction: z11.enum(["up", "down", "left", "right"]).optional(),
2206
+ start_coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
2207
+ text: z11.string().optional()
2197
2208
  })
2198
2209
  });
2199
2210
 
2200
2211
  // src/tool/text-editor_20241022.ts
2201
2212
  var import_provider_utils12 = require("@ai-sdk/provider-utils");
2202
- var import_v412 = require("zod/v4");
2213
+ var z12 = __toESM(require("zod/v4"));
2203
2214
  var textEditor_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
2204
2215
  id: "anthropic.text_editor_20241022",
2205
2216
  name: "str_replace_editor",
2206
- inputSchema: import_v412.z.object({
2207
- command: import_v412.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2208
- path: import_v412.z.string(),
2209
- file_text: import_v412.z.string().optional(),
2210
- insert_line: import_v412.z.number().int().optional(),
2211
- new_str: import_v412.z.string().optional(),
2212
- old_str: import_v412.z.string().optional(),
2213
- view_range: import_v412.z.array(import_v412.z.number().int()).optional()
2217
+ inputSchema: z12.object({
2218
+ command: z12.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2219
+ path: z12.string(),
2220
+ file_text: z12.string().optional(),
2221
+ insert_line: z12.number().int().optional(),
2222
+ new_str: z12.string().optional(),
2223
+ old_str: z12.string().optional(),
2224
+ view_range: z12.array(z12.number().int()).optional()
2214
2225
  })
2215
2226
  });
2216
2227
 
2217
2228
  // src/tool/text-editor_20250124.ts
2218
2229
  var import_provider_utils13 = require("@ai-sdk/provider-utils");
2219
- var import_v413 = require("zod/v4");
2230
+ var z13 = __toESM(require("zod/v4"));
2220
2231
  var textEditor_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
2221
2232
  id: "anthropic.text_editor_20250124",
2222
2233
  name: "str_replace_editor",
2223
- inputSchema: import_v413.z.object({
2224
- command: import_v413.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2225
- path: import_v413.z.string(),
2226
- file_text: import_v413.z.string().optional(),
2227
- insert_line: import_v413.z.number().int().optional(),
2228
- new_str: import_v413.z.string().optional(),
2229
- old_str: import_v413.z.string().optional(),
2230
- view_range: import_v413.z.array(import_v413.z.number().int()).optional()
2234
+ inputSchema: z13.object({
2235
+ command: z13.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
2236
+ path: z13.string(),
2237
+ file_text: z13.string().optional(),
2238
+ insert_line: z13.number().int().optional(),
2239
+ new_str: z13.string().optional(),
2240
+ old_str: z13.string().optional(),
2241
+ view_range: z13.array(z13.number().int()).optional()
2231
2242
  })
2232
2243
  });
2233
2244
 
2234
2245
  // src/tool/text-editor_20250429.ts
2235
2246
  var import_provider_utils14 = require("@ai-sdk/provider-utils");
2236
- var import_v414 = require("zod/v4");
2247
+ var z14 = __toESM(require("zod/v4"));
2237
2248
  var textEditor_20250429 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
2238
2249
  id: "anthropic.text_editor_20250429",
2239
2250
  name: "str_replace_based_edit_tool",
2240
- inputSchema: import_v414.z.object({
2241
- command: import_v414.z.enum(["view", "create", "str_replace", "insert"]),
2242
- path: import_v414.z.string(),
2243
- file_text: import_v414.z.string().optional(),
2244
- insert_line: import_v414.z.number().int().optional(),
2245
- new_str: import_v414.z.string().optional(),
2246
- old_str: import_v414.z.string().optional(),
2247
- view_range: import_v414.z.array(import_v414.z.number().int()).optional()
2251
+ inputSchema: z14.object({
2252
+ command: z14.enum(["view", "create", "str_replace", "insert"]),
2253
+ path: z14.string(),
2254
+ file_text: z14.string().optional(),
2255
+ insert_line: z14.number().int().optional(),
2256
+ new_str: z14.string().optional(),
2257
+ old_str: z14.string().optional(),
2258
+ view_range: z14.array(z14.number().int()).optional()
2248
2259
  })
2249
2260
  });
2250
2261