@ai-sdk/anthropic 2.1.0-beta.3 → 2.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/index.d.mts +105 -3
- package/dist/index.d.ts +105 -3
- package/dist/index.js +651 -377
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +631 -357
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +122 -6
- package/dist/internal/index.d.ts +122 -6
- package/dist/internal/index.js +645 -371
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +630 -356
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -38,8 +38,8 @@ module.exports = __toCommonJS(internal_exports);
|
|
|
38
38
|
|
|
39
39
|
// src/anthropic-messages-language-model.ts
|
|
40
40
|
var import_provider3 = require("@ai-sdk/provider");
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
42
|
+
var import_v47 = require("zod/v4");
|
|
43
43
|
|
|
44
44
|
// src/anthropic-error.ts
|
|
45
45
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -113,58 +113,110 @@ function getCacheControl(providerMetadata) {
|
|
|
113
113
|
return cacheControlValue;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
// src/tool/
|
|
116
|
+
// src/tool/text-editor_20250728.ts
|
|
117
117
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
118
118
|
var import_v43 = require("zod/v4");
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
119
|
+
var textEditor_20250728ArgsSchema = import_v43.z.object({
|
|
120
|
+
maxCharacters: import_v43.z.number().optional()
|
|
121
|
+
});
|
|
122
|
+
var factory = (0, import_provider_utils2.createProviderDefinedToolFactory)({
|
|
123
|
+
id: "anthropic.text_editor_20250728",
|
|
124
|
+
name: "str_replace_based_edit_tool",
|
|
125
|
+
inputSchema: import_v43.z.object({
|
|
126
|
+
command: import_v43.z.enum(["view", "create", "str_replace", "insert"]),
|
|
127
|
+
path: import_v43.z.string(),
|
|
128
|
+
file_text: import_v43.z.string().optional(),
|
|
129
|
+
insert_line: import_v43.z.number().int().optional(),
|
|
130
|
+
new_str: import_v43.z.string().optional(),
|
|
131
|
+
old_str: import_v43.z.string().optional(),
|
|
132
|
+
view_range: import_v43.z.array(import_v43.z.number().int()).optional()
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
var textEditor_20250728 = (args = {}) => {
|
|
136
|
+
return factory(args);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// src/tool/web-search_20250305.ts
|
|
140
|
+
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
141
|
+
var import_v44 = require("zod/v4");
|
|
142
|
+
var webSearch_20250305ArgsSchema = import_v44.z.object({
|
|
143
|
+
maxUses: import_v44.z.number().optional(),
|
|
144
|
+
allowedDomains: import_v44.z.array(import_v44.z.string()).optional(),
|
|
145
|
+
blockedDomains: import_v44.z.array(import_v44.z.string()).optional(),
|
|
146
|
+
userLocation: import_v44.z.object({
|
|
147
|
+
type: import_v44.z.literal("approximate"),
|
|
148
|
+
city: import_v44.z.string().optional(),
|
|
149
|
+
region: import_v44.z.string().optional(),
|
|
150
|
+
country: import_v44.z.string().optional(),
|
|
151
|
+
timezone: import_v44.z.string().optional()
|
|
141
152
|
}).optional()
|
|
142
153
|
});
|
|
143
|
-
var webSearch_20250305OutputSchema =
|
|
144
|
-
|
|
145
|
-
url:
|
|
146
|
-
title:
|
|
147
|
-
pageAge:
|
|
148
|
-
encryptedContent:
|
|
149
|
-
type:
|
|
154
|
+
var webSearch_20250305OutputSchema = import_v44.z.array(
|
|
155
|
+
import_v44.z.object({
|
|
156
|
+
url: import_v44.z.string(),
|
|
157
|
+
title: import_v44.z.string(),
|
|
158
|
+
pageAge: import_v44.z.string().nullable(),
|
|
159
|
+
encryptedContent: import_v44.z.string(),
|
|
160
|
+
type: import_v44.z.literal("web_search_result")
|
|
150
161
|
})
|
|
151
162
|
);
|
|
152
|
-
var
|
|
163
|
+
var factory2 = (0, import_provider_utils3.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
153
164
|
id: "anthropic.web_search_20250305",
|
|
154
165
|
name: "web_search",
|
|
155
|
-
inputSchema:
|
|
156
|
-
query:
|
|
166
|
+
inputSchema: import_v44.z.object({
|
|
167
|
+
query: import_v44.z.string()
|
|
157
168
|
}),
|
|
158
169
|
outputSchema: webSearch_20250305OutputSchema
|
|
159
170
|
});
|
|
160
171
|
var webSearch_20250305 = (args = {}) => {
|
|
161
|
-
return
|
|
172
|
+
return factory2(args);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// src/tool/web-fetch-20250910.ts
|
|
176
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
177
|
+
var import_v45 = require("zod/v4");
|
|
178
|
+
var webFetch_20250910ArgsSchema = import_v45.z.object({
|
|
179
|
+
maxUses: import_v45.z.number().optional(),
|
|
180
|
+
allowedDomains: import_v45.z.array(import_v45.z.string()).optional(),
|
|
181
|
+
blockedDomains: import_v45.z.array(import_v45.z.string()).optional(),
|
|
182
|
+
citations: import_v45.z.object({ enabled: import_v45.z.boolean() }).optional(),
|
|
183
|
+
maxContentTokens: import_v45.z.number().optional()
|
|
184
|
+
});
|
|
185
|
+
var webFetch_20250910OutputSchema = import_v45.z.object({
|
|
186
|
+
type: import_v45.z.literal("web_fetch_result"),
|
|
187
|
+
url: import_v45.z.string(),
|
|
188
|
+
content: import_v45.z.object({
|
|
189
|
+
type: import_v45.z.literal("document"),
|
|
190
|
+
title: import_v45.z.string(),
|
|
191
|
+
citations: import_v45.z.object({ enabled: import_v45.z.boolean() }).optional(),
|
|
192
|
+
source: import_v45.z.union([
|
|
193
|
+
import_v45.z.object({
|
|
194
|
+
type: import_v45.z.literal("base64"),
|
|
195
|
+
mediaType: import_v45.z.literal("application/pdf"),
|
|
196
|
+
data: import_v45.z.string()
|
|
197
|
+
}),
|
|
198
|
+
import_v45.z.object({
|
|
199
|
+
type: import_v45.z.literal("text"),
|
|
200
|
+
mediaType: import_v45.z.literal("text/plain"),
|
|
201
|
+
data: import_v45.z.string()
|
|
202
|
+
})
|
|
203
|
+
])
|
|
204
|
+
}),
|
|
205
|
+
retrievedAt: import_v45.z.string().nullable()
|
|
206
|
+
});
|
|
207
|
+
var factory3 = (0, import_provider_utils4.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
208
|
+
id: "anthropic.web_fetch_20250910",
|
|
209
|
+
name: "web_fetch",
|
|
210
|
+
inputSchema: import_v45.z.object({
|
|
211
|
+
url: import_v45.z.string()
|
|
212
|
+
}),
|
|
213
|
+
outputSchema: webFetch_20250910OutputSchema
|
|
214
|
+
});
|
|
215
|
+
var webFetch_20250910 = (args = {}) => {
|
|
216
|
+
return factory3(args);
|
|
162
217
|
};
|
|
163
218
|
|
|
164
219
|
// src/anthropic-prepare-tools.ts
|
|
165
|
-
function isWebSearchTool(tool) {
|
|
166
|
-
return typeof tool === "object" && tool !== null && "type" in tool && tool.type === "web_search_20250305";
|
|
167
|
-
}
|
|
168
220
|
function prepareTools({
|
|
169
221
|
tools,
|
|
170
222
|
toolChoice,
|
|
@@ -178,12 +230,8 @@ function prepareTools({
|
|
|
178
230
|
}
|
|
179
231
|
const anthropicTools2 = [];
|
|
180
232
|
for (const tool of tools) {
|
|
181
|
-
if (isWebSearchTool(tool)) {
|
|
182
|
-
anthropicTools2.push(tool);
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
233
|
switch (tool.type) {
|
|
186
|
-
case "function":
|
|
234
|
+
case "function": {
|
|
187
235
|
const cacheControl = getCacheControl(tool.providerOptions);
|
|
188
236
|
anthropicTools2.push({
|
|
189
237
|
name: tool.name,
|
|
@@ -192,9 +240,18 @@ function prepareTools({
|
|
|
192
240
|
cache_control: cacheControl
|
|
193
241
|
});
|
|
194
242
|
break;
|
|
195
|
-
|
|
243
|
+
}
|
|
244
|
+
case "provider-defined": {
|
|
196
245
|
switch (tool.id) {
|
|
197
|
-
case "anthropic.
|
|
246
|
+
case "anthropic.code_execution_20250522": {
|
|
247
|
+
betas.add("code-execution-2025-05-22");
|
|
248
|
+
anthropicTools2.push({
|
|
249
|
+
type: "code_execution_20250522",
|
|
250
|
+
name: "code_execution"
|
|
251
|
+
});
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
case "anthropic.computer_20250124": {
|
|
198
255
|
betas.add("computer-use-2025-01-24");
|
|
199
256
|
anthropicTools2.push({
|
|
200
257
|
name: "computer",
|
|
@@ -204,7 +261,8 @@ function prepareTools({
|
|
|
204
261
|
display_number: tool.args.displayNumber
|
|
205
262
|
});
|
|
206
263
|
break;
|
|
207
|
-
|
|
264
|
+
}
|
|
265
|
+
case "anthropic.computer_20241022": {
|
|
208
266
|
betas.add("computer-use-2024-10-22");
|
|
209
267
|
anthropicTools2.push({
|
|
210
268
|
name: "computer",
|
|
@@ -214,41 +272,70 @@ function prepareTools({
|
|
|
214
272
|
display_number: tool.args.displayNumber
|
|
215
273
|
});
|
|
216
274
|
break;
|
|
217
|
-
|
|
275
|
+
}
|
|
276
|
+
case "anthropic.text_editor_20250124": {
|
|
218
277
|
betas.add("computer-use-2025-01-24");
|
|
219
278
|
anthropicTools2.push({
|
|
220
279
|
name: "str_replace_editor",
|
|
221
280
|
type: "text_editor_20250124"
|
|
222
281
|
});
|
|
223
282
|
break;
|
|
224
|
-
|
|
283
|
+
}
|
|
284
|
+
case "anthropic.text_editor_20241022": {
|
|
225
285
|
betas.add("computer-use-2024-10-22");
|
|
226
286
|
anthropicTools2.push({
|
|
227
287
|
name: "str_replace_editor",
|
|
228
288
|
type: "text_editor_20241022"
|
|
229
289
|
});
|
|
230
290
|
break;
|
|
231
|
-
|
|
291
|
+
}
|
|
292
|
+
case "anthropic.text_editor_20250429": {
|
|
232
293
|
betas.add("computer-use-2025-01-24");
|
|
233
294
|
anthropicTools2.push({
|
|
234
295
|
name: "str_replace_based_edit_tool",
|
|
235
296
|
type: "text_editor_20250429"
|
|
236
297
|
});
|
|
237
298
|
break;
|
|
238
|
-
|
|
299
|
+
}
|
|
300
|
+
case "anthropic.text_editor_20250728": {
|
|
301
|
+
const args = textEditor_20250728ArgsSchema.parse(tool.args);
|
|
302
|
+
anthropicTools2.push({
|
|
303
|
+
name: "str_replace_based_edit_tool",
|
|
304
|
+
type: "text_editor_20250728",
|
|
305
|
+
max_characters: args.maxCharacters
|
|
306
|
+
});
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
case "anthropic.bash_20250124": {
|
|
239
310
|
betas.add("computer-use-2025-01-24");
|
|
240
311
|
anthropicTools2.push({
|
|
241
312
|
name: "bash",
|
|
242
313
|
type: "bash_20250124"
|
|
243
314
|
});
|
|
244
315
|
break;
|
|
245
|
-
|
|
316
|
+
}
|
|
317
|
+
case "anthropic.bash_20241022": {
|
|
246
318
|
betas.add("computer-use-2024-10-22");
|
|
247
319
|
anthropicTools2.push({
|
|
248
320
|
name: "bash",
|
|
249
321
|
type: "bash_20241022"
|
|
250
322
|
});
|
|
251
323
|
break;
|
|
324
|
+
}
|
|
325
|
+
case "anthropic.web_fetch_20250910": {
|
|
326
|
+
betas.add("web-fetch-2025-09-10");
|
|
327
|
+
const args = webFetch_20250910ArgsSchema.parse(tool.args);
|
|
328
|
+
anthropicTools2.push({
|
|
329
|
+
type: "web_fetch_20250910",
|
|
330
|
+
name: "web_fetch",
|
|
331
|
+
max_uses: args.maxUses,
|
|
332
|
+
allowed_domains: args.allowedDomains,
|
|
333
|
+
blocked_domains: args.blockedDomains,
|
|
334
|
+
citations: args.citations,
|
|
335
|
+
max_content_tokens: args.maxContentTokens
|
|
336
|
+
});
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
252
339
|
case "anthropic.web_search_20250305": {
|
|
253
340
|
const args = webSearch_20250305ArgsSchema.parse(tool.args);
|
|
254
341
|
anthropicTools2.push({
|
|
@@ -261,22 +348,17 @@ function prepareTools({
|
|
|
261
348
|
});
|
|
262
349
|
break;
|
|
263
350
|
}
|
|
264
|
-
|
|
265
|
-
betas.add("code-execution-2025-05-22");
|
|
266
|
-
anthropicTools2.push({
|
|
267
|
-
type: "code_execution_20250522",
|
|
268
|
-
name: "code_execution"
|
|
269
|
-
});
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
default:
|
|
351
|
+
default: {
|
|
273
352
|
toolWarnings.push({ type: "unsupported-tool", tool });
|
|
274
353
|
break;
|
|
354
|
+
}
|
|
275
355
|
}
|
|
276
356
|
break;
|
|
277
|
-
|
|
357
|
+
}
|
|
358
|
+
default: {
|
|
278
359
|
toolWarnings.push({ type: "unsupported-tool", tool });
|
|
279
360
|
break;
|
|
361
|
+
}
|
|
280
362
|
}
|
|
281
363
|
}
|
|
282
364
|
if (toolChoice == null) {
|
|
@@ -333,27 +415,27 @@ function prepareTools({
|
|
|
333
415
|
|
|
334
416
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
335
417
|
var import_provider2 = require("@ai-sdk/provider");
|
|
336
|
-
var
|
|
418
|
+
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
337
419
|
|
|
338
420
|
// src/tool/code-execution_20250522.ts
|
|
339
|
-
var
|
|
340
|
-
var
|
|
341
|
-
var codeExecution_20250522OutputSchema =
|
|
342
|
-
type:
|
|
343
|
-
stdout:
|
|
344
|
-
stderr:
|
|
345
|
-
return_code:
|
|
421
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
422
|
+
var import_v46 = require("zod/v4");
|
|
423
|
+
var codeExecution_20250522OutputSchema = import_v46.z.object({
|
|
424
|
+
type: import_v46.z.literal("code_execution_result"),
|
|
425
|
+
stdout: import_v46.z.string(),
|
|
426
|
+
stderr: import_v46.z.string(),
|
|
427
|
+
return_code: import_v46.z.number()
|
|
346
428
|
});
|
|
347
|
-
var
|
|
429
|
+
var factory4 = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
348
430
|
id: "anthropic.code_execution_20250522",
|
|
349
431
|
name: "code_execution",
|
|
350
|
-
inputSchema:
|
|
351
|
-
code:
|
|
432
|
+
inputSchema: import_v46.z.object({
|
|
433
|
+
code: import_v46.z.string()
|
|
352
434
|
}),
|
|
353
435
|
outputSchema: codeExecution_20250522OutputSchema
|
|
354
436
|
});
|
|
355
437
|
var codeExecution_20250522 = (args = {}) => {
|
|
356
|
-
return
|
|
438
|
+
return factory4(args);
|
|
357
439
|
};
|
|
358
440
|
|
|
359
441
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
@@ -385,7 +467,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
385
467
|
const messages = [];
|
|
386
468
|
async function shouldEnableCitations(providerMetadata) {
|
|
387
469
|
var _a2, _b2;
|
|
388
|
-
const anthropicOptions = await (0,
|
|
470
|
+
const anthropicOptions = await (0, import_provider_utils6.parseProviderOptions)({
|
|
389
471
|
provider: "anthropic",
|
|
390
472
|
providerOptions: providerMetadata,
|
|
391
473
|
schema: anthropicFilePartProviderOptions
|
|
@@ -393,7 +475,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
393
475
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
394
476
|
}
|
|
395
477
|
async function getDocumentMetadata(providerMetadata) {
|
|
396
|
-
const anthropicOptions = await (0,
|
|
478
|
+
const anthropicOptions = await (0, import_provider_utils6.parseProviderOptions)({
|
|
397
479
|
provider: "anthropic",
|
|
398
480
|
providerOptions: providerMetadata,
|
|
399
481
|
schema: anthropicFilePartProviderOptions
|
|
@@ -450,7 +532,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
450
532
|
} : {
|
|
451
533
|
type: "base64",
|
|
452
534
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
453
|
-
data: (0,
|
|
535
|
+
data: (0, import_provider_utils6.convertToBase64)(part.data)
|
|
454
536
|
},
|
|
455
537
|
cache_control: cacheControl
|
|
456
538
|
});
|
|
@@ -470,7 +552,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
470
552
|
} : {
|
|
471
553
|
type: "base64",
|
|
472
554
|
media_type: "application/pdf",
|
|
473
|
-
data: (0,
|
|
555
|
+
data: (0, import_provider_utils6.convertToBase64)(part.data)
|
|
474
556
|
},
|
|
475
557
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
476
558
|
...metadata.context && { context: metadata.context },
|
|
@@ -605,7 +687,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
605
687
|
}
|
|
606
688
|
case "reasoning": {
|
|
607
689
|
if (sendReasoning) {
|
|
608
|
-
const reasoningMetadata = await (0,
|
|
690
|
+
const reasoningMetadata = await (0, import_provider_utils6.parseProviderOptions)({
|
|
609
691
|
provider: "anthropic",
|
|
610
692
|
providerOptions: part.providerOptions,
|
|
611
693
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -646,30 +728,20 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
646
728
|
}
|
|
647
729
|
case "tool-call": {
|
|
648
730
|
if (part.providerExecuted) {
|
|
649
|
-
if (part.toolName === "web_search") {
|
|
731
|
+
if (part.toolName === "code_execution" || part.toolName === "web_fetch" || part.toolName === "web_search") {
|
|
650
732
|
anthropicContent.push({
|
|
651
733
|
type: "server_tool_use",
|
|
652
734
|
id: part.toolCallId,
|
|
653
|
-
name:
|
|
735
|
+
name: part.toolName,
|
|
654
736
|
input: part.input,
|
|
655
737
|
cache_control: cacheControl
|
|
656
738
|
});
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
type: "server_tool_use",
|
|
662
|
-
id: part.toolCallId,
|
|
663
|
-
name: "code_execution",
|
|
664
|
-
input: part.input,
|
|
665
|
-
cache_control: cacheControl
|
|
739
|
+
} else {
|
|
740
|
+
warnings.push({
|
|
741
|
+
type: "other",
|
|
742
|
+
message: `provider executed tool call for tool ${part.toolName} is not supported`
|
|
666
743
|
});
|
|
667
|
-
break;
|
|
668
744
|
}
|
|
669
|
-
warnings.push({
|
|
670
|
-
type: "other",
|
|
671
|
-
message: `provider executed tool call for tool ${part.toolName} is not supported`
|
|
672
|
-
});
|
|
673
745
|
break;
|
|
674
746
|
}
|
|
675
747
|
anthropicContent.push({
|
|
@@ -682,7 +754,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
682
754
|
break;
|
|
683
755
|
}
|
|
684
756
|
case "tool-result": {
|
|
685
|
-
if (part.toolName === "
|
|
757
|
+
if (part.toolName === "code_execution") {
|
|
686
758
|
const output = part.output;
|
|
687
759
|
if (output.type !== "json") {
|
|
688
760
|
warnings.push({
|
|
@@ -691,24 +763,21 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
691
763
|
});
|
|
692
764
|
break;
|
|
693
765
|
}
|
|
694
|
-
const
|
|
695
|
-
output.value
|
|
696
|
-
);
|
|
766
|
+
const codeExecutionOutput = codeExecution_20250522OutputSchema.parse(output.value);
|
|
697
767
|
anthropicContent.push({
|
|
698
|
-
type: "
|
|
768
|
+
type: "code_execution_tool_result",
|
|
699
769
|
tool_use_id: part.toolCallId,
|
|
700
|
-
content:
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
})),
|
|
770
|
+
content: {
|
|
771
|
+
type: codeExecutionOutput.type,
|
|
772
|
+
stdout: codeExecutionOutput.stdout,
|
|
773
|
+
stderr: codeExecutionOutput.stderr,
|
|
774
|
+
return_code: codeExecutionOutput.return_code
|
|
775
|
+
},
|
|
707
776
|
cache_control: cacheControl
|
|
708
777
|
});
|
|
709
778
|
break;
|
|
710
779
|
}
|
|
711
|
-
if (part.toolName === "
|
|
780
|
+
if (part.toolName === "web_fetch") {
|
|
712
781
|
const output = part.output;
|
|
713
782
|
if (output.type !== "json") {
|
|
714
783
|
warnings.push({
|
|
@@ -717,20 +786,57 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
717
786
|
});
|
|
718
787
|
break;
|
|
719
788
|
}
|
|
720
|
-
const
|
|
789
|
+
const webFetchOutput = webFetch_20250910OutputSchema.parse(
|
|
790
|
+
output.value
|
|
791
|
+
);
|
|
721
792
|
anthropicContent.push({
|
|
722
|
-
type: "
|
|
793
|
+
type: "web_fetch_tool_result",
|
|
723
794
|
tool_use_id: part.toolCallId,
|
|
724
795
|
content: {
|
|
725
|
-
type:
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
796
|
+
type: "web_fetch_result",
|
|
797
|
+
url: webFetchOutput.url,
|
|
798
|
+
retrieved_at: webFetchOutput.retrievedAt,
|
|
799
|
+
content: {
|
|
800
|
+
type: "document",
|
|
801
|
+
title: webFetchOutput.content.title,
|
|
802
|
+
citations: webFetchOutput.content.citations,
|
|
803
|
+
source: {
|
|
804
|
+
type: webFetchOutput.content.source.type,
|
|
805
|
+
media_type: webFetchOutput.content.source.mediaType,
|
|
806
|
+
data: webFetchOutput.content.source.data
|
|
807
|
+
}
|
|
808
|
+
}
|
|
729
809
|
},
|
|
730
810
|
cache_control: cacheControl
|
|
731
811
|
});
|
|
732
812
|
break;
|
|
733
813
|
}
|
|
814
|
+
if (part.toolName === "web_search") {
|
|
815
|
+
const output = part.output;
|
|
816
|
+
if (output.type !== "json") {
|
|
817
|
+
warnings.push({
|
|
818
|
+
type: "other",
|
|
819
|
+
message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
|
|
820
|
+
});
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
const webSearchOutput = webSearch_20250305OutputSchema.parse(
|
|
824
|
+
output.value
|
|
825
|
+
);
|
|
826
|
+
anthropicContent.push({
|
|
827
|
+
type: "web_search_tool_result",
|
|
828
|
+
tool_use_id: part.toolCallId,
|
|
829
|
+
content: webSearchOutput.map((result) => ({
|
|
830
|
+
url: result.url,
|
|
831
|
+
title: result.title,
|
|
832
|
+
page_age: result.pageAge,
|
|
833
|
+
encrypted_content: result.encryptedContent,
|
|
834
|
+
type: result.type
|
|
835
|
+
})),
|
|
836
|
+
cache_control: cacheControl
|
|
837
|
+
});
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
734
840
|
warnings.push({
|
|
735
841
|
type: "other",
|
|
736
842
|
message: `provider executed tool result for tool ${part.toolName} is not supported`
|
|
@@ -824,36 +930,36 @@ function mapAnthropicStopReason({
|
|
|
824
930
|
|
|
825
931
|
// src/anthropic-messages-language-model.ts
|
|
826
932
|
var citationSchemas = {
|
|
827
|
-
webSearchResult:
|
|
828
|
-
type:
|
|
829
|
-
cited_text:
|
|
830
|
-
url:
|
|
831
|
-
title:
|
|
832
|
-
encrypted_index:
|
|
933
|
+
webSearchResult: import_v47.z.object({
|
|
934
|
+
type: import_v47.z.literal("web_search_result_location"),
|
|
935
|
+
cited_text: import_v47.z.string(),
|
|
936
|
+
url: import_v47.z.string(),
|
|
937
|
+
title: import_v47.z.string(),
|
|
938
|
+
encrypted_index: import_v47.z.string()
|
|
833
939
|
}),
|
|
834
|
-
pageLocation:
|
|
835
|
-
type:
|
|
836
|
-
cited_text:
|
|
837
|
-
document_index:
|
|
838
|
-
document_title:
|
|
839
|
-
start_page_number:
|
|
840
|
-
end_page_number:
|
|
940
|
+
pageLocation: import_v47.z.object({
|
|
941
|
+
type: import_v47.z.literal("page_location"),
|
|
942
|
+
cited_text: import_v47.z.string(),
|
|
943
|
+
document_index: import_v47.z.number(),
|
|
944
|
+
document_title: import_v47.z.string().nullable(),
|
|
945
|
+
start_page_number: import_v47.z.number(),
|
|
946
|
+
end_page_number: import_v47.z.number()
|
|
841
947
|
}),
|
|
842
|
-
charLocation:
|
|
843
|
-
type:
|
|
844
|
-
cited_text:
|
|
845
|
-
document_index:
|
|
846
|
-
document_title:
|
|
847
|
-
start_char_index:
|
|
848
|
-
end_char_index:
|
|
948
|
+
charLocation: import_v47.z.object({
|
|
949
|
+
type: import_v47.z.literal("char_location"),
|
|
950
|
+
cited_text: import_v47.z.string(),
|
|
951
|
+
document_index: import_v47.z.number(),
|
|
952
|
+
document_title: import_v47.z.string().nullable(),
|
|
953
|
+
start_char_index: import_v47.z.number(),
|
|
954
|
+
end_char_index: import_v47.z.number()
|
|
849
955
|
})
|
|
850
956
|
};
|
|
851
|
-
var citationSchema =
|
|
957
|
+
var citationSchema = import_v47.z.discriminatedUnion("type", [
|
|
852
958
|
citationSchemas.webSearchResult,
|
|
853
959
|
citationSchemas.pageLocation,
|
|
854
960
|
citationSchemas.charLocation
|
|
855
961
|
]);
|
|
856
|
-
var documentCitationSchema =
|
|
962
|
+
var documentCitationSchema = import_v47.z.discriminatedUnion("type", [
|
|
857
963
|
citationSchemas.pageLocation,
|
|
858
964
|
citationSchemas.charLocation
|
|
859
965
|
]);
|
|
@@ -902,7 +1008,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
902
1008
|
var _a;
|
|
903
1009
|
this.modelId = modelId;
|
|
904
1010
|
this.config = config;
|
|
905
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
1011
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils7.generateId;
|
|
906
1012
|
}
|
|
907
1013
|
supportsUrl(url) {
|
|
908
1014
|
return url.protocol === "https:";
|
|
@@ -971,7 +1077,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
971
1077
|
description: "Respond with a JSON object.",
|
|
972
1078
|
inputSchema: responseFormat.schema
|
|
973
1079
|
} : void 0;
|
|
974
|
-
const anthropicOptions = await (0,
|
|
1080
|
+
const anthropicOptions = await (0, import_provider_utils7.parseProviderOptions)({
|
|
975
1081
|
provider: "anthropic",
|
|
976
1082
|
providerOptions,
|
|
977
1083
|
schema: anthropicProviderOptions
|
|
@@ -1063,8 +1169,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1063
1169
|
betas,
|
|
1064
1170
|
headers
|
|
1065
1171
|
}) {
|
|
1066
|
-
return (0,
|
|
1067
|
-
await (0,
|
|
1172
|
+
return (0, import_provider_utils7.combineHeaders)(
|
|
1173
|
+
await (0, import_provider_utils7.resolve)(this.config.headers),
|
|
1068
1174
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {},
|
|
1069
1175
|
headers
|
|
1070
1176
|
);
|
|
@@ -1108,12 +1214,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1108
1214
|
responseHeaders,
|
|
1109
1215
|
value: response,
|
|
1110
1216
|
rawValue: rawResponse
|
|
1111
|
-
} = await (0,
|
|
1217
|
+
} = await (0, import_provider_utils7.postJsonToApi)({
|
|
1112
1218
|
url: this.buildRequestUrl(false),
|
|
1113
1219
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1114
1220
|
body: this.transformRequestBody(args),
|
|
1115
1221
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1116
|
-
successfulResponseHandler: (0,
|
|
1222
|
+
successfulResponseHandler: (0, import_provider_utils7.createJsonResponseHandler)(
|
|
1117
1223
|
anthropicMessagesResponseSchema
|
|
1118
1224
|
),
|
|
1119
1225
|
abortSignal: options.abortSignal,
|
|
@@ -1178,7 +1284,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1178
1284
|
break;
|
|
1179
1285
|
}
|
|
1180
1286
|
case "server_tool_use": {
|
|
1181
|
-
if (part.name === "web_search" || part.name === "code_execution") {
|
|
1287
|
+
if (part.name === "web_search" || part.name === "code_execution" || part.name === "web_fetch") {
|
|
1182
1288
|
content.push({
|
|
1183
1289
|
type: "tool-call",
|
|
1184
1290
|
toolCallId: part.id,
|
|
@@ -1189,6 +1295,44 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1189
1295
|
}
|
|
1190
1296
|
break;
|
|
1191
1297
|
}
|
|
1298
|
+
case "web_fetch_tool_result": {
|
|
1299
|
+
if (part.content.type === "web_fetch_result") {
|
|
1300
|
+
content.push({
|
|
1301
|
+
type: "tool-result",
|
|
1302
|
+
toolCallId: part.tool_use_id,
|
|
1303
|
+
toolName: "web_fetch",
|
|
1304
|
+
result: {
|
|
1305
|
+
type: "web_fetch_result",
|
|
1306
|
+
url: part.content.url,
|
|
1307
|
+
retrievedAt: part.content.retrieved_at,
|
|
1308
|
+
content: {
|
|
1309
|
+
type: part.content.content.type,
|
|
1310
|
+
title: part.content.content.title,
|
|
1311
|
+
citations: part.content.content.citations,
|
|
1312
|
+
source: {
|
|
1313
|
+
type: part.content.content.source.type,
|
|
1314
|
+
mediaType: part.content.content.source.media_type,
|
|
1315
|
+
data: part.content.content.source.data
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
|
+
providerExecuted: true
|
|
1320
|
+
});
|
|
1321
|
+
} else if (part.content.type === "web_fetch_tool_result_error") {
|
|
1322
|
+
content.push({
|
|
1323
|
+
type: "tool-result",
|
|
1324
|
+
toolCallId: part.tool_use_id,
|
|
1325
|
+
toolName: "web_fetch",
|
|
1326
|
+
isError: true,
|
|
1327
|
+
result: {
|
|
1328
|
+
type: "web_fetch_tool_result_error",
|
|
1329
|
+
errorCode: part.content.error_code
|
|
1330
|
+
},
|
|
1331
|
+
providerExecuted: true
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
break;
|
|
1335
|
+
}
|
|
1192
1336
|
case "web_search_tool_result": {
|
|
1193
1337
|
if (Array.isArray(part.content)) {
|
|
1194
1338
|
content.push({
|
|
@@ -1299,12 +1443,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1299
1443
|
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs(options);
|
|
1300
1444
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
1301
1445
|
const body = { ...args, stream: true };
|
|
1302
|
-
const { responseHeaders, value: response } = await (0,
|
|
1446
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils7.postJsonToApi)({
|
|
1303
1447
|
url: this.buildRequestUrl(true),
|
|
1304
1448
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
1305
1449
|
body: this.transformRequestBody(body),
|
|
1306
1450
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
1307
|
-
successfulResponseHandler: (0,
|
|
1451
|
+
successfulResponseHandler: (0, import_provider_utils7.createEventSourceResponseHandler)(
|
|
1308
1452
|
anthropicMessagesChunkSchema
|
|
1309
1453
|
),
|
|
1310
1454
|
abortSignal: options.abortSignal,
|
|
@@ -1317,7 +1461,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1317
1461
|
totalTokens: void 0
|
|
1318
1462
|
};
|
|
1319
1463
|
const contentBlocks = {};
|
|
1320
|
-
let
|
|
1464
|
+
let rawUsage = void 0;
|
|
1465
|
+
let cacheCreationInputTokens = null;
|
|
1321
1466
|
let blockType = void 0;
|
|
1322
1467
|
const generateId2 = this.generateId;
|
|
1323
1468
|
return {
|
|
@@ -1390,7 +1535,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1390
1535
|
return;
|
|
1391
1536
|
}
|
|
1392
1537
|
case "server_tool_use": {
|
|
1393
|
-
if (value.content_block.name === "web_search" || value.content_block.name === "code_execution") {
|
|
1538
|
+
if (value.content_block.name === "web_fetch" || value.content_block.name === "web_search" || value.content_block.name === "code_execution") {
|
|
1394
1539
|
contentBlocks[value.index] = {
|
|
1395
1540
|
type: "tool-call",
|
|
1396
1541
|
toolCallId: value.content_block.id,
|
|
@@ -1407,6 +1552,44 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1407
1552
|
}
|
|
1408
1553
|
return;
|
|
1409
1554
|
}
|
|
1555
|
+
case "web_fetch_tool_result": {
|
|
1556
|
+
const part = value.content_block;
|
|
1557
|
+
if (part.content.type === "web_fetch_result") {
|
|
1558
|
+
controller.enqueue({
|
|
1559
|
+
type: "tool-result",
|
|
1560
|
+
toolCallId: part.tool_use_id,
|
|
1561
|
+
toolName: "web_fetch",
|
|
1562
|
+
result: {
|
|
1563
|
+
type: "web_fetch_result",
|
|
1564
|
+
url: part.content.url,
|
|
1565
|
+
retrievedAt: part.content.retrieved_at,
|
|
1566
|
+
content: {
|
|
1567
|
+
type: part.content.content.type,
|
|
1568
|
+
title: part.content.content.title,
|
|
1569
|
+
citations: part.content.content.citations,
|
|
1570
|
+
source: {
|
|
1571
|
+
type: part.content.content.source.type,
|
|
1572
|
+
mediaType: part.content.content.source.media_type,
|
|
1573
|
+
data: part.content.content.source.data
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
} else if (part.content.type === "web_fetch_tool_result_error") {
|
|
1579
|
+
controller.enqueue({
|
|
1580
|
+
type: "tool-result",
|
|
1581
|
+
toolCallId: part.tool_use_id,
|
|
1582
|
+
toolName: "web_fetch",
|
|
1583
|
+
isError: true,
|
|
1584
|
+
result: {
|
|
1585
|
+
type: "web_fetch_tool_result_error",
|
|
1586
|
+
errorCode: part.content.error_code
|
|
1587
|
+
},
|
|
1588
|
+
providerExecuted: true
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1410
1593
|
case "web_search_tool_result": {
|
|
1411
1594
|
const part = value.content_block;
|
|
1412
1595
|
if (Array.isArray(part.content)) {
|
|
@@ -1609,12 +1792,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1609
1792
|
case "message_start": {
|
|
1610
1793
|
usage.inputTokens = value.message.usage.input_tokens;
|
|
1611
1794
|
usage.cachedInputTokens = (_b = value.message.usage.cache_read_input_tokens) != null ? _b : void 0;
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
usage: value.message.usage,
|
|
1615
|
-
cacheCreationInputTokens: (_c = value.message.usage.cache_creation_input_tokens) != null ? _c : null
|
|
1616
|
-
}
|
|
1795
|
+
rawUsage = {
|
|
1796
|
+
...value.message.usage
|
|
1617
1797
|
};
|
|
1798
|
+
cacheCreationInputTokens = (_c = value.message.usage.cache_creation_input_tokens) != null ? _c : null;
|
|
1618
1799
|
controller.enqueue({
|
|
1619
1800
|
type: "response-metadata",
|
|
1620
1801
|
id: (_d = value.message.id) != null ? _d : void 0,
|
|
@@ -1629,6 +1810,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1629
1810
|
finishReason: value.delta.stop_reason,
|
|
1630
1811
|
isJsonResponseFromTool: usesJsonResponseTool
|
|
1631
1812
|
});
|
|
1813
|
+
rawUsage = {
|
|
1814
|
+
...rawUsage,
|
|
1815
|
+
...value.usage
|
|
1816
|
+
};
|
|
1632
1817
|
return;
|
|
1633
1818
|
}
|
|
1634
1819
|
case "message_stop": {
|
|
@@ -1636,7 +1821,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1636
1821
|
type: "finish",
|
|
1637
1822
|
finishReason,
|
|
1638
1823
|
usage,
|
|
1639
|
-
providerMetadata
|
|
1824
|
+
providerMetadata: {
|
|
1825
|
+
anthropic: {
|
|
1826
|
+
usage: rawUsage != null ? rawUsage : null,
|
|
1827
|
+
cacheCreationInputTokens
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1640
1830
|
});
|
|
1641
1831
|
return;
|
|
1642
1832
|
}
|
|
@@ -1657,247 +1847,299 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1657
1847
|
};
|
|
1658
1848
|
}
|
|
1659
1849
|
};
|
|
1660
|
-
var anthropicMessagesResponseSchema =
|
|
1661
|
-
type:
|
|
1662
|
-
id:
|
|
1663
|
-
model:
|
|
1664
|
-
content:
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
type:
|
|
1668
|
-
text:
|
|
1669
|
-
citations:
|
|
1850
|
+
var anthropicMessagesResponseSchema = import_v47.z.object({
|
|
1851
|
+
type: import_v47.z.literal("message"),
|
|
1852
|
+
id: import_v47.z.string().nullish(),
|
|
1853
|
+
model: import_v47.z.string().nullish(),
|
|
1854
|
+
content: import_v47.z.array(
|
|
1855
|
+
import_v47.z.discriminatedUnion("type", [
|
|
1856
|
+
import_v47.z.object({
|
|
1857
|
+
type: import_v47.z.literal("text"),
|
|
1858
|
+
text: import_v47.z.string(),
|
|
1859
|
+
citations: import_v47.z.array(citationSchema).optional()
|
|
1670
1860
|
}),
|
|
1671
|
-
|
|
1672
|
-
type:
|
|
1673
|
-
thinking:
|
|
1674
|
-
signature:
|
|
1861
|
+
import_v47.z.object({
|
|
1862
|
+
type: import_v47.z.literal("thinking"),
|
|
1863
|
+
thinking: import_v47.z.string(),
|
|
1864
|
+
signature: import_v47.z.string()
|
|
1675
1865
|
}),
|
|
1676
|
-
|
|
1677
|
-
type:
|
|
1678
|
-
data:
|
|
1866
|
+
import_v47.z.object({
|
|
1867
|
+
type: import_v47.z.literal("redacted_thinking"),
|
|
1868
|
+
data: import_v47.z.string()
|
|
1679
1869
|
}),
|
|
1680
|
-
|
|
1681
|
-
type:
|
|
1682
|
-
id:
|
|
1683
|
-
name:
|
|
1684
|
-
input:
|
|
1870
|
+
import_v47.z.object({
|
|
1871
|
+
type: import_v47.z.literal("tool_use"),
|
|
1872
|
+
id: import_v47.z.string(),
|
|
1873
|
+
name: import_v47.z.string(),
|
|
1874
|
+
input: import_v47.z.unknown()
|
|
1685
1875
|
}),
|
|
1686
|
-
|
|
1687
|
-
type:
|
|
1688
|
-
id:
|
|
1689
|
-
name:
|
|
1690
|
-
input:
|
|
1876
|
+
import_v47.z.object({
|
|
1877
|
+
type: import_v47.z.literal("server_tool_use"),
|
|
1878
|
+
id: import_v47.z.string(),
|
|
1879
|
+
name: import_v47.z.string(),
|
|
1880
|
+
input: import_v47.z.record(import_v47.z.string(), import_v47.z.unknown()).nullish()
|
|
1691
1881
|
}),
|
|
1692
|
-
|
|
1693
|
-
type:
|
|
1694
|
-
tool_use_id:
|
|
1695
|
-
content:
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1882
|
+
import_v47.z.object({
|
|
1883
|
+
type: import_v47.z.literal("web_fetch_tool_result"),
|
|
1884
|
+
tool_use_id: import_v47.z.string(),
|
|
1885
|
+
content: import_v47.z.union([
|
|
1886
|
+
import_v47.z.object({
|
|
1887
|
+
type: import_v47.z.literal("web_fetch_result"),
|
|
1888
|
+
url: import_v47.z.string(),
|
|
1889
|
+
retrieved_at: import_v47.z.string(),
|
|
1890
|
+
content: import_v47.z.object({
|
|
1891
|
+
type: import_v47.z.literal("document"),
|
|
1892
|
+
title: import_v47.z.string(),
|
|
1893
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
1894
|
+
source: import_v47.z.object({
|
|
1895
|
+
type: import_v47.z.literal("text"),
|
|
1896
|
+
media_type: import_v47.z.string(),
|
|
1897
|
+
data: import_v47.z.string()
|
|
1898
|
+
})
|
|
1899
|
+
})
|
|
1900
|
+
}),
|
|
1901
|
+
import_v47.z.object({
|
|
1902
|
+
type: import_v47.z.literal("web_fetch_tool_result_error"),
|
|
1903
|
+
error_code: import_v47.z.string()
|
|
1904
|
+
})
|
|
1905
|
+
])
|
|
1906
|
+
}),
|
|
1907
|
+
import_v47.z.object({
|
|
1908
|
+
type: import_v47.z.literal("web_search_tool_result"),
|
|
1909
|
+
tool_use_id: import_v47.z.string(),
|
|
1910
|
+
content: import_v47.z.union([
|
|
1911
|
+
import_v47.z.array(
|
|
1912
|
+
import_v47.z.object({
|
|
1913
|
+
type: import_v47.z.literal("web_search_result"),
|
|
1914
|
+
url: import_v47.z.string(),
|
|
1915
|
+
title: import_v47.z.string(),
|
|
1916
|
+
encrypted_content: import_v47.z.string(),
|
|
1917
|
+
page_age: import_v47.z.string().nullish()
|
|
1703
1918
|
})
|
|
1704
1919
|
),
|
|
1705
|
-
|
|
1706
|
-
type:
|
|
1707
|
-
error_code:
|
|
1920
|
+
import_v47.z.object({
|
|
1921
|
+
type: import_v47.z.literal("web_search_tool_result_error"),
|
|
1922
|
+
error_code: import_v47.z.string()
|
|
1708
1923
|
})
|
|
1709
1924
|
])
|
|
1710
1925
|
}),
|
|
1711
|
-
|
|
1712
|
-
type:
|
|
1713
|
-
tool_use_id:
|
|
1714
|
-
content:
|
|
1715
|
-
|
|
1716
|
-
type:
|
|
1717
|
-
stdout:
|
|
1718
|
-
stderr:
|
|
1719
|
-
return_code:
|
|
1926
|
+
import_v47.z.object({
|
|
1927
|
+
type: import_v47.z.literal("code_execution_tool_result"),
|
|
1928
|
+
tool_use_id: import_v47.z.string(),
|
|
1929
|
+
content: import_v47.z.union([
|
|
1930
|
+
import_v47.z.object({
|
|
1931
|
+
type: import_v47.z.literal("code_execution_result"),
|
|
1932
|
+
stdout: import_v47.z.string(),
|
|
1933
|
+
stderr: import_v47.z.string(),
|
|
1934
|
+
return_code: import_v47.z.number()
|
|
1720
1935
|
}),
|
|
1721
|
-
|
|
1722
|
-
type:
|
|
1723
|
-
error_code:
|
|
1936
|
+
import_v47.z.object({
|
|
1937
|
+
type: import_v47.z.literal("code_execution_tool_result_error"),
|
|
1938
|
+
error_code: import_v47.z.string()
|
|
1724
1939
|
})
|
|
1725
1940
|
])
|
|
1726
1941
|
})
|
|
1727
1942
|
])
|
|
1728
1943
|
),
|
|
1729
|
-
stop_reason:
|
|
1730
|
-
usage:
|
|
1731
|
-
input_tokens:
|
|
1732
|
-
output_tokens:
|
|
1733
|
-
cache_creation_input_tokens:
|
|
1734
|
-
cache_read_input_tokens:
|
|
1944
|
+
stop_reason: import_v47.z.string().nullish(),
|
|
1945
|
+
usage: import_v47.z.looseObject({
|
|
1946
|
+
input_tokens: import_v47.z.number(),
|
|
1947
|
+
output_tokens: import_v47.z.number(),
|
|
1948
|
+
cache_creation_input_tokens: import_v47.z.number().nullish(),
|
|
1949
|
+
cache_read_input_tokens: import_v47.z.number().nullish()
|
|
1735
1950
|
})
|
|
1736
1951
|
});
|
|
1737
|
-
var anthropicMessagesChunkSchema =
|
|
1738
|
-
|
|
1739
|
-
type:
|
|
1740
|
-
message:
|
|
1741
|
-
id:
|
|
1742
|
-
model:
|
|
1743
|
-
usage:
|
|
1744
|
-
input_tokens:
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
cache_read_input_tokens: import_v45.z.number().nullish()
|
|
1952
|
+
var anthropicMessagesChunkSchema = import_v47.z.discriminatedUnion("type", [
|
|
1953
|
+
import_v47.z.object({
|
|
1954
|
+
type: import_v47.z.literal("message_start"),
|
|
1955
|
+
message: import_v47.z.object({
|
|
1956
|
+
id: import_v47.z.string().nullish(),
|
|
1957
|
+
model: import_v47.z.string().nullish(),
|
|
1958
|
+
usage: import_v47.z.looseObject({
|
|
1959
|
+
input_tokens: import_v47.z.number(),
|
|
1960
|
+
cache_creation_input_tokens: import_v47.z.number().nullish(),
|
|
1961
|
+
cache_read_input_tokens: import_v47.z.number().nullish()
|
|
1748
1962
|
})
|
|
1749
1963
|
})
|
|
1750
1964
|
}),
|
|
1751
|
-
|
|
1752
|
-
type:
|
|
1753
|
-
index:
|
|
1754
|
-
content_block:
|
|
1755
|
-
|
|
1756
|
-
type:
|
|
1757
|
-
text:
|
|
1965
|
+
import_v47.z.object({
|
|
1966
|
+
type: import_v47.z.literal("content_block_start"),
|
|
1967
|
+
index: import_v47.z.number(),
|
|
1968
|
+
content_block: import_v47.z.discriminatedUnion("type", [
|
|
1969
|
+
import_v47.z.object({
|
|
1970
|
+
type: import_v47.z.literal("text"),
|
|
1971
|
+
text: import_v47.z.string()
|
|
1758
1972
|
}),
|
|
1759
|
-
|
|
1760
|
-
type:
|
|
1761
|
-
thinking:
|
|
1973
|
+
import_v47.z.object({
|
|
1974
|
+
type: import_v47.z.literal("thinking"),
|
|
1975
|
+
thinking: import_v47.z.string()
|
|
1762
1976
|
}),
|
|
1763
|
-
|
|
1764
|
-
type:
|
|
1765
|
-
id:
|
|
1766
|
-
name:
|
|
1977
|
+
import_v47.z.object({
|
|
1978
|
+
type: import_v47.z.literal("tool_use"),
|
|
1979
|
+
id: import_v47.z.string(),
|
|
1980
|
+
name: import_v47.z.string()
|
|
1767
1981
|
}),
|
|
1768
|
-
|
|
1769
|
-
type:
|
|
1770
|
-
data:
|
|
1982
|
+
import_v47.z.object({
|
|
1983
|
+
type: import_v47.z.literal("redacted_thinking"),
|
|
1984
|
+
data: import_v47.z.string()
|
|
1771
1985
|
}),
|
|
1772
|
-
|
|
1773
|
-
type:
|
|
1774
|
-
id:
|
|
1775
|
-
name:
|
|
1776
|
-
input:
|
|
1986
|
+
import_v47.z.object({
|
|
1987
|
+
type: import_v47.z.literal("server_tool_use"),
|
|
1988
|
+
id: import_v47.z.string(),
|
|
1989
|
+
name: import_v47.z.string(),
|
|
1990
|
+
input: import_v47.z.record(import_v47.z.string(), import_v47.z.unknown()).nullish()
|
|
1777
1991
|
}),
|
|
1778
|
-
|
|
1779
|
-
type:
|
|
1780
|
-
tool_use_id:
|
|
1781
|
-
content:
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1992
|
+
import_v47.z.object({
|
|
1993
|
+
type: import_v47.z.literal("web_fetch_tool_result"),
|
|
1994
|
+
tool_use_id: import_v47.z.string(),
|
|
1995
|
+
content: import_v47.z.union([
|
|
1996
|
+
import_v47.z.object({
|
|
1997
|
+
type: import_v47.z.literal("web_fetch_result"),
|
|
1998
|
+
url: import_v47.z.string(),
|
|
1999
|
+
retrieved_at: import_v47.z.string(),
|
|
2000
|
+
content: import_v47.z.object({
|
|
2001
|
+
type: import_v47.z.literal("document"),
|
|
2002
|
+
title: import_v47.z.string(),
|
|
2003
|
+
citations: import_v47.z.object({ enabled: import_v47.z.boolean() }).optional(),
|
|
2004
|
+
source: import_v47.z.object({
|
|
2005
|
+
type: import_v47.z.literal("text"),
|
|
2006
|
+
media_type: import_v47.z.string(),
|
|
2007
|
+
data: import_v47.z.string()
|
|
2008
|
+
})
|
|
2009
|
+
})
|
|
2010
|
+
}),
|
|
2011
|
+
import_v47.z.object({
|
|
2012
|
+
type: import_v47.z.literal("web_fetch_tool_result_error"),
|
|
2013
|
+
error_code: import_v47.z.string()
|
|
2014
|
+
})
|
|
2015
|
+
])
|
|
2016
|
+
}),
|
|
2017
|
+
import_v47.z.object({
|
|
2018
|
+
type: import_v47.z.literal("web_search_tool_result"),
|
|
2019
|
+
tool_use_id: import_v47.z.string(),
|
|
2020
|
+
content: import_v47.z.union([
|
|
2021
|
+
import_v47.z.array(
|
|
2022
|
+
import_v47.z.object({
|
|
2023
|
+
type: import_v47.z.literal("web_search_result"),
|
|
2024
|
+
url: import_v47.z.string(),
|
|
2025
|
+
title: import_v47.z.string(),
|
|
2026
|
+
encrypted_content: import_v47.z.string(),
|
|
2027
|
+
page_age: import_v47.z.string().nullish()
|
|
1789
2028
|
})
|
|
1790
2029
|
),
|
|
1791
|
-
|
|
1792
|
-
type:
|
|
1793
|
-
error_code:
|
|
2030
|
+
import_v47.z.object({
|
|
2031
|
+
type: import_v47.z.literal("web_search_tool_result_error"),
|
|
2032
|
+
error_code: import_v47.z.string()
|
|
1794
2033
|
})
|
|
1795
2034
|
])
|
|
1796
2035
|
}),
|
|
1797
|
-
|
|
1798
|
-
type:
|
|
1799
|
-
tool_use_id:
|
|
1800
|
-
content:
|
|
1801
|
-
|
|
1802
|
-
type:
|
|
1803
|
-
stdout:
|
|
1804
|
-
stderr:
|
|
1805
|
-
return_code:
|
|
2036
|
+
import_v47.z.object({
|
|
2037
|
+
type: import_v47.z.literal("code_execution_tool_result"),
|
|
2038
|
+
tool_use_id: import_v47.z.string(),
|
|
2039
|
+
content: import_v47.z.union([
|
|
2040
|
+
import_v47.z.object({
|
|
2041
|
+
type: import_v47.z.literal("code_execution_result"),
|
|
2042
|
+
stdout: import_v47.z.string(),
|
|
2043
|
+
stderr: import_v47.z.string(),
|
|
2044
|
+
return_code: import_v47.z.number()
|
|
1806
2045
|
}),
|
|
1807
|
-
|
|
1808
|
-
type:
|
|
1809
|
-
error_code:
|
|
2046
|
+
import_v47.z.object({
|
|
2047
|
+
type: import_v47.z.literal("code_execution_tool_result_error"),
|
|
2048
|
+
error_code: import_v47.z.string()
|
|
1810
2049
|
})
|
|
1811
2050
|
])
|
|
1812
2051
|
})
|
|
1813
2052
|
])
|
|
1814
2053
|
}),
|
|
1815
|
-
|
|
1816
|
-
type:
|
|
1817
|
-
index:
|
|
1818
|
-
delta:
|
|
1819
|
-
|
|
1820
|
-
type:
|
|
1821
|
-
partial_json:
|
|
2054
|
+
import_v47.z.object({
|
|
2055
|
+
type: import_v47.z.literal("content_block_delta"),
|
|
2056
|
+
index: import_v47.z.number(),
|
|
2057
|
+
delta: import_v47.z.discriminatedUnion("type", [
|
|
2058
|
+
import_v47.z.object({
|
|
2059
|
+
type: import_v47.z.literal("input_json_delta"),
|
|
2060
|
+
partial_json: import_v47.z.string()
|
|
1822
2061
|
}),
|
|
1823
|
-
|
|
1824
|
-
type:
|
|
1825
|
-
text:
|
|
2062
|
+
import_v47.z.object({
|
|
2063
|
+
type: import_v47.z.literal("text_delta"),
|
|
2064
|
+
text: import_v47.z.string()
|
|
1826
2065
|
}),
|
|
1827
|
-
|
|
1828
|
-
type:
|
|
1829
|
-
thinking:
|
|
2066
|
+
import_v47.z.object({
|
|
2067
|
+
type: import_v47.z.literal("thinking_delta"),
|
|
2068
|
+
thinking: import_v47.z.string()
|
|
1830
2069
|
}),
|
|
1831
|
-
|
|
1832
|
-
type:
|
|
1833
|
-
signature:
|
|
2070
|
+
import_v47.z.object({
|
|
2071
|
+
type: import_v47.z.literal("signature_delta"),
|
|
2072
|
+
signature: import_v47.z.string()
|
|
1834
2073
|
}),
|
|
1835
|
-
|
|
1836
|
-
type:
|
|
2074
|
+
import_v47.z.object({
|
|
2075
|
+
type: import_v47.z.literal("citations_delta"),
|
|
1837
2076
|
citation: citationSchema
|
|
1838
2077
|
})
|
|
1839
2078
|
])
|
|
1840
2079
|
}),
|
|
1841
|
-
|
|
1842
|
-
type:
|
|
1843
|
-
index:
|
|
2080
|
+
import_v47.z.object({
|
|
2081
|
+
type: import_v47.z.literal("content_block_stop"),
|
|
2082
|
+
index: import_v47.z.number()
|
|
1844
2083
|
}),
|
|
1845
|
-
|
|
1846
|
-
type:
|
|
1847
|
-
error:
|
|
1848
|
-
type:
|
|
1849
|
-
message:
|
|
2084
|
+
import_v47.z.object({
|
|
2085
|
+
type: import_v47.z.literal("error"),
|
|
2086
|
+
error: import_v47.z.object({
|
|
2087
|
+
type: import_v47.z.string(),
|
|
2088
|
+
message: import_v47.z.string()
|
|
1850
2089
|
})
|
|
1851
2090
|
}),
|
|
1852
|
-
|
|
1853
|
-
type:
|
|
1854
|
-
delta:
|
|
1855
|
-
usage:
|
|
2091
|
+
import_v47.z.object({
|
|
2092
|
+
type: import_v47.z.literal("message_delta"),
|
|
2093
|
+
delta: import_v47.z.object({ stop_reason: import_v47.z.string().nullish() }),
|
|
2094
|
+
usage: import_v47.z.looseObject({
|
|
2095
|
+
output_tokens: import_v47.z.number(),
|
|
2096
|
+
cache_creation_input_tokens: import_v47.z.number().nullish()
|
|
2097
|
+
})
|
|
1856
2098
|
}),
|
|
1857
|
-
|
|
1858
|
-
type:
|
|
2099
|
+
import_v47.z.object({
|
|
2100
|
+
type: import_v47.z.literal("message_stop")
|
|
1859
2101
|
}),
|
|
1860
|
-
|
|
1861
|
-
type:
|
|
2102
|
+
import_v47.z.object({
|
|
2103
|
+
type: import_v47.z.literal("ping")
|
|
1862
2104
|
})
|
|
1863
2105
|
]);
|
|
1864
|
-
var anthropicReasoningMetadataSchema =
|
|
1865
|
-
signature:
|
|
1866
|
-
redactedData:
|
|
2106
|
+
var anthropicReasoningMetadataSchema = import_v47.z.object({
|
|
2107
|
+
signature: import_v47.z.string().optional(),
|
|
2108
|
+
redactedData: import_v47.z.string().optional()
|
|
1867
2109
|
});
|
|
1868
2110
|
|
|
1869
2111
|
// src/tool/bash_20241022.ts
|
|
1870
|
-
var
|
|
1871
|
-
var
|
|
1872
|
-
var bash_20241022 = (0,
|
|
2112
|
+
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
2113
|
+
var import_v48 = __toESM(require("zod/v4"));
|
|
2114
|
+
var bash_20241022 = (0, import_provider_utils8.createProviderDefinedToolFactory)({
|
|
1873
2115
|
id: "anthropic.bash_20241022",
|
|
1874
2116
|
name: "bash",
|
|
1875
|
-
inputSchema:
|
|
1876
|
-
command:
|
|
1877
|
-
restart:
|
|
2117
|
+
inputSchema: import_v48.default.object({
|
|
2118
|
+
command: import_v48.default.string(),
|
|
2119
|
+
restart: import_v48.default.boolean().optional()
|
|
1878
2120
|
})
|
|
1879
2121
|
});
|
|
1880
2122
|
|
|
1881
2123
|
// src/tool/bash_20250124.ts
|
|
1882
|
-
var
|
|
1883
|
-
var
|
|
1884
|
-
var bash_20250124 = (0,
|
|
2124
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
2125
|
+
var import_v49 = __toESM(require("zod/v4"));
|
|
2126
|
+
var bash_20250124 = (0, import_provider_utils9.createProviderDefinedToolFactory)({
|
|
1885
2127
|
id: "anthropic.bash_20250124",
|
|
1886
2128
|
name: "bash",
|
|
1887
|
-
inputSchema:
|
|
1888
|
-
command:
|
|
1889
|
-
restart:
|
|
2129
|
+
inputSchema: import_v49.default.object({
|
|
2130
|
+
command: import_v49.default.string(),
|
|
2131
|
+
restart: import_v49.default.boolean().optional()
|
|
1890
2132
|
})
|
|
1891
2133
|
});
|
|
1892
2134
|
|
|
1893
2135
|
// src/tool/computer_20241022.ts
|
|
1894
|
-
var
|
|
1895
|
-
var
|
|
1896
|
-
var computer_20241022 = (0,
|
|
2136
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
2137
|
+
var import_v410 = require("zod/v4");
|
|
2138
|
+
var computer_20241022 = (0, import_provider_utils10.createProviderDefinedToolFactory)({
|
|
1897
2139
|
id: "anthropic.computer_20241022",
|
|
1898
2140
|
name: "computer",
|
|
1899
|
-
inputSchema:
|
|
1900
|
-
action:
|
|
2141
|
+
inputSchema: import_v410.z.object({
|
|
2142
|
+
action: import_v410.z.enum([
|
|
1901
2143
|
"key",
|
|
1902
2144
|
"type",
|
|
1903
2145
|
"mouse_move",
|
|
@@ -1909,19 +2151,19 @@ var computer_20241022 = (0, import_provider_utils8.createProviderDefinedToolFact
|
|
|
1909
2151
|
"screenshot",
|
|
1910
2152
|
"cursor_position"
|
|
1911
2153
|
]),
|
|
1912
|
-
coordinate:
|
|
1913
|
-
text:
|
|
2154
|
+
coordinate: import_v410.z.array(import_v410.z.number().int()).optional(),
|
|
2155
|
+
text: import_v410.z.string().optional()
|
|
1914
2156
|
})
|
|
1915
2157
|
});
|
|
1916
2158
|
|
|
1917
2159
|
// src/tool/computer_20250124.ts
|
|
1918
|
-
var
|
|
1919
|
-
var
|
|
1920
|
-
var computer_20250124 = (0,
|
|
2160
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
2161
|
+
var import_v411 = require("zod/v4");
|
|
2162
|
+
var computer_20250124 = (0, import_provider_utils11.createProviderDefinedToolFactory)({
|
|
1921
2163
|
id: "anthropic.computer_20250124",
|
|
1922
2164
|
name: "computer",
|
|
1923
|
-
inputSchema:
|
|
1924
|
-
action:
|
|
2165
|
+
inputSchema: import_v411.z.object({
|
|
2166
|
+
action: import_v411.z.enum([
|
|
1925
2167
|
"key",
|
|
1926
2168
|
"hold_key",
|
|
1927
2169
|
"type",
|
|
@@ -1939,63 +2181,63 @@ var computer_20250124 = (0, import_provider_utils9.createProviderDefinedToolFact
|
|
|
1939
2181
|
"wait",
|
|
1940
2182
|
"screenshot"
|
|
1941
2183
|
]),
|
|
1942
|
-
coordinate:
|
|
1943
|
-
duration:
|
|
1944
|
-
scroll_amount:
|
|
1945
|
-
scroll_direction:
|
|
1946
|
-
start_coordinate:
|
|
1947
|
-
text:
|
|
2184
|
+
coordinate: import_v411.z.tuple([import_v411.z.number().int(), import_v411.z.number().int()]).optional(),
|
|
2185
|
+
duration: import_v411.z.number().optional(),
|
|
2186
|
+
scroll_amount: import_v411.z.number().optional(),
|
|
2187
|
+
scroll_direction: import_v411.z.enum(["up", "down", "left", "right"]).optional(),
|
|
2188
|
+
start_coordinate: import_v411.z.tuple([import_v411.z.number().int(), import_v411.z.number().int()]).optional(),
|
|
2189
|
+
text: import_v411.z.string().optional()
|
|
1948
2190
|
})
|
|
1949
2191
|
});
|
|
1950
2192
|
|
|
1951
2193
|
// src/tool/text-editor_20241022.ts
|
|
1952
|
-
var
|
|
1953
|
-
var
|
|
1954
|
-
var textEditor_20241022 = (0,
|
|
2194
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2195
|
+
var import_v412 = require("zod/v4");
|
|
2196
|
+
var textEditor_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
|
|
1955
2197
|
id: "anthropic.text_editor_20241022",
|
|
1956
2198
|
name: "str_replace_editor",
|
|
1957
|
-
inputSchema:
|
|
1958
|
-
command:
|
|
1959
|
-
path:
|
|
1960
|
-
file_text:
|
|
1961
|
-
insert_line:
|
|
1962
|
-
new_str:
|
|
1963
|
-
old_str:
|
|
1964
|
-
view_range:
|
|
2199
|
+
inputSchema: import_v412.z.object({
|
|
2200
|
+
command: import_v412.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2201
|
+
path: import_v412.z.string(),
|
|
2202
|
+
file_text: import_v412.z.string().optional(),
|
|
2203
|
+
insert_line: import_v412.z.number().int().optional(),
|
|
2204
|
+
new_str: import_v412.z.string().optional(),
|
|
2205
|
+
old_str: import_v412.z.string().optional(),
|
|
2206
|
+
view_range: import_v412.z.array(import_v412.z.number().int()).optional()
|
|
1965
2207
|
})
|
|
1966
2208
|
});
|
|
1967
2209
|
|
|
1968
2210
|
// src/tool/text-editor_20250124.ts
|
|
1969
|
-
var
|
|
1970
|
-
var
|
|
1971
|
-
var textEditor_20250124 = (0,
|
|
2211
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2212
|
+
var import_v413 = require("zod/v4");
|
|
2213
|
+
var textEditor_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
1972
2214
|
id: "anthropic.text_editor_20250124",
|
|
1973
2215
|
name: "str_replace_editor",
|
|
1974
|
-
inputSchema:
|
|
1975
|
-
command:
|
|
1976
|
-
path:
|
|
1977
|
-
file_text:
|
|
1978
|
-
insert_line:
|
|
1979
|
-
new_str:
|
|
1980
|
-
old_str:
|
|
1981
|
-
view_range:
|
|
2216
|
+
inputSchema: import_v413.z.object({
|
|
2217
|
+
command: import_v413.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2218
|
+
path: import_v413.z.string(),
|
|
2219
|
+
file_text: import_v413.z.string().optional(),
|
|
2220
|
+
insert_line: import_v413.z.number().int().optional(),
|
|
2221
|
+
new_str: import_v413.z.string().optional(),
|
|
2222
|
+
old_str: import_v413.z.string().optional(),
|
|
2223
|
+
view_range: import_v413.z.array(import_v413.z.number().int()).optional()
|
|
1982
2224
|
})
|
|
1983
2225
|
});
|
|
1984
2226
|
|
|
1985
2227
|
// src/tool/text-editor_20250429.ts
|
|
1986
|
-
var
|
|
1987
|
-
var
|
|
1988
|
-
var textEditor_20250429 = (0,
|
|
2228
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2229
|
+
var import_v414 = require("zod/v4");
|
|
2230
|
+
var textEditor_20250429 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
1989
2231
|
id: "anthropic.text_editor_20250429",
|
|
1990
2232
|
name: "str_replace_based_edit_tool",
|
|
1991
|
-
inputSchema:
|
|
1992
|
-
command:
|
|
1993
|
-
path:
|
|
1994
|
-
file_text:
|
|
1995
|
-
insert_line:
|
|
1996
|
-
new_str:
|
|
1997
|
-
old_str:
|
|
1998
|
-
view_range:
|
|
2233
|
+
inputSchema: import_v414.z.object({
|
|
2234
|
+
command: import_v414.z.enum(["view", "create", "str_replace", "insert"]),
|
|
2235
|
+
path: import_v414.z.string(),
|
|
2236
|
+
file_text: import_v414.z.string().optional(),
|
|
2237
|
+
insert_line: import_v414.z.number().int().optional(),
|
|
2238
|
+
new_str: import_v414.z.string().optional(),
|
|
2239
|
+
old_str: import_v414.z.string().optional(),
|
|
2240
|
+
view_range: import_v414.z.array(import_v414.z.number().int()).optional()
|
|
1999
2241
|
})
|
|
2000
2242
|
});
|
|
2001
2243
|
|
|
@@ -2061,6 +2303,8 @@ var anthropicTools = {
|
|
|
2061
2303
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
2062
2304
|
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
2063
2305
|
*
|
|
2306
|
+
* Supported models: Claude Sonnet 3.5
|
|
2307
|
+
*
|
|
2064
2308
|
* Tool name must be `str_replace_editor`.
|
|
2065
2309
|
*/
|
|
2066
2310
|
textEditor_20241022,
|
|
@@ -2069,6 +2313,8 @@ var anthropicTools = {
|
|
|
2069
2313
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
2070
2314
|
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
2071
2315
|
*
|
|
2316
|
+
* Supported models: Claude Sonnet 3.7
|
|
2317
|
+
*
|
|
2072
2318
|
* Tool name must be `str_replace_editor`.
|
|
2073
2319
|
*/
|
|
2074
2320
|
textEditor_20250124,
|
|
@@ -2080,8 +2326,36 @@ var anthropicTools = {
|
|
|
2080
2326
|
* Note: This version does not support the "undo_edit" command.
|
|
2081
2327
|
*
|
|
2082
2328
|
* Tool name must be `str_replace_based_edit_tool`.
|
|
2329
|
+
*
|
|
2330
|
+
* @deprecated Use textEditor_20250728 instead
|
|
2083
2331
|
*/
|
|
2084
2332
|
textEditor_20250429,
|
|
2333
|
+
/**
|
|
2334
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
2335
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
2336
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
2337
|
+
*
|
|
2338
|
+
* Note: This version does not support the "undo_edit" command and adds optional max_characters parameter.
|
|
2339
|
+
*
|
|
2340
|
+
* Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
|
|
2341
|
+
*
|
|
2342
|
+
* Tool name must be `str_replace_based_edit_tool`.
|
|
2343
|
+
*
|
|
2344
|
+
* @param maxCharacters - Optional maximum number of characters to view in the file
|
|
2345
|
+
*/
|
|
2346
|
+
textEditor_20250728,
|
|
2347
|
+
/**
|
|
2348
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
2349
|
+
*
|
|
2350
|
+
* Tool name must be `web_fetch`.
|
|
2351
|
+
*
|
|
2352
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
2353
|
+
* @param allowedDomains - Only fetch from these domains
|
|
2354
|
+
* @param blockedDomains - Never fetch from these domains
|
|
2355
|
+
* @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
|
|
2356
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
2357
|
+
*/
|
|
2358
|
+
webFetch_20250910,
|
|
2085
2359
|
/**
|
|
2086
2360
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
2087
2361
|
*
|