@ai-sdk/anthropic 2.0.23 → 2.0.24
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 +9 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +356 -356
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +355 -355
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +12 -12
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -39,16 +39,16 @@ module.exports = __toCommonJS(internal_exports);
|
|
|
39
39
|
// src/anthropic-messages-language-model.ts
|
|
40
40
|
var import_provider3 = require("@ai-sdk/provider");
|
|
41
41
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
42
|
-
var
|
|
42
|
+
var z7 = __toESM(require("zod/v4"));
|
|
43
43
|
|
|
44
44
|
// src/anthropic-error.ts
|
|
45
45
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
46
|
-
var
|
|
47
|
-
var anthropicErrorDataSchema =
|
|
48
|
-
type:
|
|
49
|
-
error:
|
|
50
|
-
type:
|
|
51
|
-
message:
|
|
46
|
+
var z = __toESM(require("zod/v4"));
|
|
47
|
+
var anthropicErrorDataSchema = z.object({
|
|
48
|
+
type: z.literal("error"),
|
|
49
|
+
error: z.object({
|
|
50
|
+
type: z.string(),
|
|
51
|
+
message: z.string()
|
|
52
52
|
})
|
|
53
53
|
});
|
|
54
54
|
var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
|
|
@@ -57,48 +57,48 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
// src/anthropic-messages-options.ts
|
|
60
|
-
var
|
|
61
|
-
var anthropicFilePartProviderOptions =
|
|
60
|
+
var z2 = __toESM(require("zod/v4"));
|
|
61
|
+
var anthropicFilePartProviderOptions = z2.object({
|
|
62
62
|
/**
|
|
63
63
|
* Citation configuration for this document.
|
|
64
64
|
* When enabled, this document will generate citations in the response.
|
|
65
65
|
*/
|
|
66
|
-
citations:
|
|
66
|
+
citations: z2.object({
|
|
67
67
|
/**
|
|
68
68
|
* Enable citations for this document
|
|
69
69
|
*/
|
|
70
|
-
enabled:
|
|
70
|
+
enabled: z2.boolean()
|
|
71
71
|
}).optional(),
|
|
72
72
|
/**
|
|
73
73
|
* Custom title for the document.
|
|
74
74
|
* If not provided, the filename will be used.
|
|
75
75
|
*/
|
|
76
|
-
title:
|
|
76
|
+
title: z2.string().optional(),
|
|
77
77
|
/**
|
|
78
78
|
* Context about the document that will be passed to the model
|
|
79
79
|
* but not used towards cited content.
|
|
80
80
|
* Useful for storing document metadata as text or stringified JSON.
|
|
81
81
|
*/
|
|
82
|
-
context:
|
|
82
|
+
context: z2.string().optional()
|
|
83
83
|
});
|
|
84
|
-
var anthropicProviderOptions =
|
|
85
|
-
sendReasoning:
|
|
86
|
-
thinking:
|
|
87
|
-
type:
|
|
88
|
-
budgetTokens:
|
|
84
|
+
var anthropicProviderOptions = z2.object({
|
|
85
|
+
sendReasoning: z2.boolean().optional(),
|
|
86
|
+
thinking: z2.object({
|
|
87
|
+
type: z2.union([z2.literal("enabled"), z2.literal("disabled")]),
|
|
88
|
+
budgetTokens: z2.number().optional()
|
|
89
89
|
}).optional(),
|
|
90
90
|
/**
|
|
91
91
|
* Whether to disable parallel function calling during tool use. Default is false.
|
|
92
92
|
* When set to true, Claude will use at most one tool per response.
|
|
93
93
|
*/
|
|
94
|
-
disableParallelToolUse:
|
|
94
|
+
disableParallelToolUse: z2.boolean().optional(),
|
|
95
95
|
/**
|
|
96
96
|
* Cache control settings for this message.
|
|
97
97
|
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
98
98
|
*/
|
|
99
|
-
cacheControl:
|
|
100
|
-
type:
|
|
101
|
-
ttl:
|
|
99
|
+
cacheControl: z2.object({
|
|
100
|
+
type: z2.literal("ephemeral"),
|
|
101
|
+
ttl: z2.union([z2.literal("5m"), z2.literal("1h")]).optional()
|
|
102
102
|
}).optional()
|
|
103
103
|
});
|
|
104
104
|
|
|
@@ -115,21 +115,21 @@ function getCacheControl(providerMetadata) {
|
|
|
115
115
|
|
|
116
116
|
// src/tool/text-editor_20250728.ts
|
|
117
117
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
118
|
-
var
|
|
119
|
-
var textEditor_20250728ArgsSchema =
|
|
120
|
-
maxCharacters:
|
|
118
|
+
var z3 = __toESM(require("zod/v4"));
|
|
119
|
+
var textEditor_20250728ArgsSchema = z3.object({
|
|
120
|
+
maxCharacters: z3.number().optional()
|
|
121
121
|
});
|
|
122
122
|
var factory = (0, import_provider_utils2.createProviderDefinedToolFactory)({
|
|
123
123
|
id: "anthropic.text_editor_20250728",
|
|
124
124
|
name: "str_replace_based_edit_tool",
|
|
125
|
-
inputSchema:
|
|
126
|
-
command:
|
|
127
|
-
path:
|
|
128
|
-
file_text:
|
|
129
|
-
insert_line:
|
|
130
|
-
new_str:
|
|
131
|
-
old_str:
|
|
132
|
-
view_range:
|
|
125
|
+
inputSchema: z3.object({
|
|
126
|
+
command: z3.enum(["view", "create", "str_replace", "insert"]),
|
|
127
|
+
path: z3.string(),
|
|
128
|
+
file_text: z3.string().optional(),
|
|
129
|
+
insert_line: z3.number().int().optional(),
|
|
130
|
+
new_str: z3.string().optional(),
|
|
131
|
+
old_str: z3.string().optional(),
|
|
132
|
+
view_range: z3.array(z3.number().int()).optional()
|
|
133
133
|
})
|
|
134
134
|
});
|
|
135
135
|
var textEditor_20250728 = (args = {}) => {
|
|
@@ -138,33 +138,33 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
138
138
|
|
|
139
139
|
// src/tool/web-search_20250305.ts
|
|
140
140
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
141
|
-
var
|
|
142
|
-
var webSearch_20250305ArgsSchema =
|
|
143
|
-
maxUses:
|
|
144
|
-
allowedDomains:
|
|
145
|
-
blockedDomains:
|
|
146
|
-
userLocation:
|
|
147
|
-
type:
|
|
148
|
-
city:
|
|
149
|
-
region:
|
|
150
|
-
country:
|
|
151
|
-
timezone:
|
|
141
|
+
var z4 = __toESM(require("zod/v4"));
|
|
142
|
+
var webSearch_20250305ArgsSchema = z4.object({
|
|
143
|
+
maxUses: z4.number().optional(),
|
|
144
|
+
allowedDomains: z4.array(z4.string()).optional(),
|
|
145
|
+
blockedDomains: z4.array(z4.string()).optional(),
|
|
146
|
+
userLocation: z4.object({
|
|
147
|
+
type: z4.literal("approximate"),
|
|
148
|
+
city: z4.string().optional(),
|
|
149
|
+
region: z4.string().optional(),
|
|
150
|
+
country: z4.string().optional(),
|
|
151
|
+
timezone: z4.string().optional()
|
|
152
152
|
}).optional()
|
|
153
153
|
});
|
|
154
|
-
var webSearch_20250305OutputSchema =
|
|
155
|
-
|
|
156
|
-
url:
|
|
157
|
-
title:
|
|
158
|
-
pageAge:
|
|
159
|
-
encryptedContent:
|
|
160
|
-
type:
|
|
154
|
+
var webSearch_20250305OutputSchema = z4.array(
|
|
155
|
+
z4.object({
|
|
156
|
+
url: z4.string(),
|
|
157
|
+
title: z4.string(),
|
|
158
|
+
pageAge: z4.string().nullable(),
|
|
159
|
+
encryptedContent: z4.string(),
|
|
160
|
+
type: z4.literal("web_search_result")
|
|
161
161
|
})
|
|
162
162
|
);
|
|
163
163
|
var factory2 = (0, import_provider_utils3.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
164
164
|
id: "anthropic.web_search_20250305",
|
|
165
165
|
name: "web_search",
|
|
166
|
-
inputSchema:
|
|
167
|
-
query:
|
|
166
|
+
inputSchema: z4.object({
|
|
167
|
+
query: z4.string()
|
|
168
168
|
}),
|
|
169
169
|
outputSchema: webSearch_20250305OutputSchema
|
|
170
170
|
});
|
|
@@ -174,41 +174,41 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
174
174
|
|
|
175
175
|
// src/tool/web-fetch-20250910.ts
|
|
176
176
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
177
|
-
var
|
|
178
|
-
var webFetch_20250910ArgsSchema =
|
|
179
|
-
maxUses:
|
|
180
|
-
allowedDomains:
|
|
181
|
-
blockedDomains:
|
|
182
|
-
citations:
|
|
183
|
-
maxContentTokens:
|
|
177
|
+
var z5 = __toESM(require("zod/v4"));
|
|
178
|
+
var webFetch_20250910ArgsSchema = z5.object({
|
|
179
|
+
maxUses: z5.number().optional(),
|
|
180
|
+
allowedDomains: z5.array(z5.string()).optional(),
|
|
181
|
+
blockedDomains: z5.array(z5.string()).optional(),
|
|
182
|
+
citations: z5.object({ enabled: z5.boolean() }).optional(),
|
|
183
|
+
maxContentTokens: z5.number().optional()
|
|
184
184
|
});
|
|
185
|
-
var webFetch_20250910OutputSchema =
|
|
186
|
-
type:
|
|
187
|
-
url:
|
|
188
|
-
content:
|
|
189
|
-
type:
|
|
190
|
-
title:
|
|
191
|
-
citations:
|
|
192
|
-
source:
|
|
193
|
-
|
|
194
|
-
type:
|
|
195
|
-
mediaType:
|
|
196
|
-
data:
|
|
185
|
+
var webFetch_20250910OutputSchema = z5.object({
|
|
186
|
+
type: z5.literal("web_fetch_result"),
|
|
187
|
+
url: z5.string(),
|
|
188
|
+
content: z5.object({
|
|
189
|
+
type: z5.literal("document"),
|
|
190
|
+
title: z5.string(),
|
|
191
|
+
citations: z5.object({ enabled: z5.boolean() }).optional(),
|
|
192
|
+
source: z5.union([
|
|
193
|
+
z5.object({
|
|
194
|
+
type: z5.literal("base64"),
|
|
195
|
+
mediaType: z5.literal("application/pdf"),
|
|
196
|
+
data: z5.string()
|
|
197
197
|
}),
|
|
198
|
-
|
|
199
|
-
type:
|
|
200
|
-
mediaType:
|
|
201
|
-
data:
|
|
198
|
+
z5.object({
|
|
199
|
+
type: z5.literal("text"),
|
|
200
|
+
mediaType: z5.literal("text/plain"),
|
|
201
|
+
data: z5.string()
|
|
202
202
|
})
|
|
203
203
|
])
|
|
204
204
|
}),
|
|
205
|
-
retrievedAt:
|
|
205
|
+
retrievedAt: z5.string().nullable()
|
|
206
206
|
});
|
|
207
207
|
var factory3 = (0, import_provider_utils4.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
208
208
|
id: "anthropic.web_fetch_20250910",
|
|
209
209
|
name: "web_fetch",
|
|
210
|
-
inputSchema:
|
|
211
|
-
url:
|
|
210
|
+
inputSchema: z5.object({
|
|
211
|
+
url: z5.string()
|
|
212
212
|
}),
|
|
213
213
|
outputSchema: webFetch_20250910OutputSchema
|
|
214
214
|
});
|
|
@@ -419,18 +419,18 @@ var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
|
419
419
|
|
|
420
420
|
// src/tool/code-execution_20250522.ts
|
|
421
421
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
422
|
-
var
|
|
423
|
-
var codeExecution_20250522OutputSchema =
|
|
424
|
-
type:
|
|
425
|
-
stdout:
|
|
426
|
-
stderr:
|
|
427
|
-
return_code:
|
|
422
|
+
var z6 = __toESM(require("zod/v4"));
|
|
423
|
+
var codeExecution_20250522OutputSchema = z6.object({
|
|
424
|
+
type: z6.literal("code_execution_result"),
|
|
425
|
+
stdout: z6.string(),
|
|
426
|
+
stderr: z6.string(),
|
|
427
|
+
return_code: z6.number()
|
|
428
428
|
});
|
|
429
429
|
var factory4 = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
430
430
|
id: "anthropic.code_execution_20250522",
|
|
431
431
|
name: "code_execution",
|
|
432
|
-
inputSchema:
|
|
433
|
-
code:
|
|
432
|
+
inputSchema: z6.object({
|
|
433
|
+
code: z6.string()
|
|
434
434
|
}),
|
|
435
435
|
outputSchema: codeExecution_20250522OutputSchema
|
|
436
436
|
});
|
|
@@ -930,36 +930,36 @@ function mapAnthropicStopReason({
|
|
|
930
930
|
|
|
931
931
|
// src/anthropic-messages-language-model.ts
|
|
932
932
|
var citationSchemas = {
|
|
933
|
-
webSearchResult:
|
|
934
|
-
type:
|
|
935
|
-
cited_text:
|
|
936
|
-
url:
|
|
937
|
-
title:
|
|
938
|
-
encrypted_index:
|
|
933
|
+
webSearchResult: z7.object({
|
|
934
|
+
type: z7.literal("web_search_result_location"),
|
|
935
|
+
cited_text: z7.string(),
|
|
936
|
+
url: z7.string(),
|
|
937
|
+
title: z7.string(),
|
|
938
|
+
encrypted_index: z7.string()
|
|
939
939
|
}),
|
|
940
|
-
pageLocation:
|
|
941
|
-
type:
|
|
942
|
-
cited_text:
|
|
943
|
-
document_index:
|
|
944
|
-
document_title:
|
|
945
|
-
start_page_number:
|
|
946
|
-
end_page_number:
|
|
940
|
+
pageLocation: z7.object({
|
|
941
|
+
type: z7.literal("page_location"),
|
|
942
|
+
cited_text: z7.string(),
|
|
943
|
+
document_index: z7.number(),
|
|
944
|
+
document_title: z7.string().nullable(),
|
|
945
|
+
start_page_number: z7.number(),
|
|
946
|
+
end_page_number: z7.number()
|
|
947
947
|
}),
|
|
948
|
-
charLocation:
|
|
949
|
-
type:
|
|
950
|
-
cited_text:
|
|
951
|
-
document_index:
|
|
952
|
-
document_title:
|
|
953
|
-
start_char_index:
|
|
954
|
-
end_char_index:
|
|
948
|
+
charLocation: z7.object({
|
|
949
|
+
type: z7.literal("char_location"),
|
|
950
|
+
cited_text: z7.string(),
|
|
951
|
+
document_index: z7.number(),
|
|
952
|
+
document_title: z7.string().nullable(),
|
|
953
|
+
start_char_index: z7.number(),
|
|
954
|
+
end_char_index: z7.number()
|
|
955
955
|
})
|
|
956
956
|
};
|
|
957
|
-
var citationSchema =
|
|
957
|
+
var citationSchema = z7.discriminatedUnion("type", [
|
|
958
958
|
citationSchemas.webSearchResult,
|
|
959
959
|
citationSchemas.pageLocation,
|
|
960
960
|
citationSchemas.charLocation
|
|
961
961
|
]);
|
|
962
|
-
var documentCitationSchema =
|
|
962
|
+
var documentCitationSchema = z7.discriminatedUnion("type", [
|
|
963
963
|
citationSchemas.pageLocation,
|
|
964
964
|
citationSchemas.charLocation
|
|
965
965
|
]);
|
|
@@ -1851,303 +1851,303 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1851
1851
|
};
|
|
1852
1852
|
}
|
|
1853
1853
|
};
|
|
1854
|
-
var anthropicMessagesResponseSchema =
|
|
1855
|
-
type:
|
|
1856
|
-
id:
|
|
1857
|
-
model:
|
|
1858
|
-
content:
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
type:
|
|
1862
|
-
text:
|
|
1863
|
-
citations:
|
|
1854
|
+
var anthropicMessagesResponseSchema = z7.object({
|
|
1855
|
+
type: z7.literal("message"),
|
|
1856
|
+
id: z7.string().nullish(),
|
|
1857
|
+
model: z7.string().nullish(),
|
|
1858
|
+
content: z7.array(
|
|
1859
|
+
z7.discriminatedUnion("type", [
|
|
1860
|
+
z7.object({
|
|
1861
|
+
type: z7.literal("text"),
|
|
1862
|
+
text: z7.string(),
|
|
1863
|
+
citations: z7.array(citationSchema).optional()
|
|
1864
1864
|
}),
|
|
1865
|
-
|
|
1866
|
-
type:
|
|
1867
|
-
thinking:
|
|
1868
|
-
signature:
|
|
1865
|
+
z7.object({
|
|
1866
|
+
type: z7.literal("thinking"),
|
|
1867
|
+
thinking: z7.string(),
|
|
1868
|
+
signature: z7.string()
|
|
1869
1869
|
}),
|
|
1870
|
-
|
|
1871
|
-
type:
|
|
1872
|
-
data:
|
|
1870
|
+
z7.object({
|
|
1871
|
+
type: z7.literal("redacted_thinking"),
|
|
1872
|
+
data: z7.string()
|
|
1873
1873
|
}),
|
|
1874
|
-
|
|
1875
|
-
type:
|
|
1876
|
-
id:
|
|
1877
|
-
name:
|
|
1878
|
-
input:
|
|
1874
|
+
z7.object({
|
|
1875
|
+
type: z7.literal("tool_use"),
|
|
1876
|
+
id: z7.string(),
|
|
1877
|
+
name: z7.string(),
|
|
1878
|
+
input: z7.unknown()
|
|
1879
1879
|
}),
|
|
1880
|
-
|
|
1881
|
-
type:
|
|
1882
|
-
id:
|
|
1883
|
-
name:
|
|
1884
|
-
input:
|
|
1880
|
+
z7.object({
|
|
1881
|
+
type: z7.literal("server_tool_use"),
|
|
1882
|
+
id: z7.string(),
|
|
1883
|
+
name: z7.string(),
|
|
1884
|
+
input: z7.record(z7.string(), z7.unknown()).nullish()
|
|
1885
1885
|
}),
|
|
1886
|
-
|
|
1887
|
-
type:
|
|
1888
|
-
tool_use_id:
|
|
1889
|
-
content:
|
|
1890
|
-
|
|
1891
|
-
type:
|
|
1892
|
-
url:
|
|
1893
|
-
retrieved_at:
|
|
1894
|
-
content:
|
|
1895
|
-
type:
|
|
1896
|
-
title:
|
|
1897
|
-
citations:
|
|
1898
|
-
source:
|
|
1899
|
-
type:
|
|
1900
|
-
media_type:
|
|
1901
|
-
data:
|
|
1886
|
+
z7.object({
|
|
1887
|
+
type: z7.literal("web_fetch_tool_result"),
|
|
1888
|
+
tool_use_id: z7.string(),
|
|
1889
|
+
content: z7.union([
|
|
1890
|
+
z7.object({
|
|
1891
|
+
type: z7.literal("web_fetch_result"),
|
|
1892
|
+
url: z7.string(),
|
|
1893
|
+
retrieved_at: z7.string(),
|
|
1894
|
+
content: z7.object({
|
|
1895
|
+
type: z7.literal("document"),
|
|
1896
|
+
title: z7.string().nullable(),
|
|
1897
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1898
|
+
source: z7.object({
|
|
1899
|
+
type: z7.literal("text"),
|
|
1900
|
+
media_type: z7.string(),
|
|
1901
|
+
data: z7.string()
|
|
1902
1902
|
})
|
|
1903
1903
|
})
|
|
1904
1904
|
}),
|
|
1905
|
-
|
|
1906
|
-
type:
|
|
1907
|
-
error_code:
|
|
1905
|
+
z7.object({
|
|
1906
|
+
type: z7.literal("web_fetch_tool_result_error"),
|
|
1907
|
+
error_code: z7.string()
|
|
1908
1908
|
})
|
|
1909
1909
|
])
|
|
1910
1910
|
}),
|
|
1911
|
-
|
|
1912
|
-
type:
|
|
1913
|
-
tool_use_id:
|
|
1914
|
-
content:
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
type:
|
|
1918
|
-
url:
|
|
1919
|
-
title:
|
|
1920
|
-
encrypted_content:
|
|
1921
|
-
page_age:
|
|
1911
|
+
z7.object({
|
|
1912
|
+
type: z7.literal("web_search_tool_result"),
|
|
1913
|
+
tool_use_id: z7.string(),
|
|
1914
|
+
content: z7.union([
|
|
1915
|
+
z7.array(
|
|
1916
|
+
z7.object({
|
|
1917
|
+
type: z7.literal("web_search_result"),
|
|
1918
|
+
url: z7.string(),
|
|
1919
|
+
title: z7.string(),
|
|
1920
|
+
encrypted_content: z7.string(),
|
|
1921
|
+
page_age: z7.string().nullish()
|
|
1922
1922
|
})
|
|
1923
1923
|
),
|
|
1924
|
-
|
|
1925
|
-
type:
|
|
1926
|
-
error_code:
|
|
1924
|
+
z7.object({
|
|
1925
|
+
type: z7.literal("web_search_tool_result_error"),
|
|
1926
|
+
error_code: z7.string()
|
|
1927
1927
|
})
|
|
1928
1928
|
])
|
|
1929
1929
|
}),
|
|
1930
|
-
|
|
1931
|
-
type:
|
|
1932
|
-
tool_use_id:
|
|
1933
|
-
content:
|
|
1934
|
-
|
|
1935
|
-
type:
|
|
1936
|
-
stdout:
|
|
1937
|
-
stderr:
|
|
1938
|
-
return_code:
|
|
1930
|
+
z7.object({
|
|
1931
|
+
type: z7.literal("code_execution_tool_result"),
|
|
1932
|
+
tool_use_id: z7.string(),
|
|
1933
|
+
content: z7.union([
|
|
1934
|
+
z7.object({
|
|
1935
|
+
type: z7.literal("code_execution_result"),
|
|
1936
|
+
stdout: z7.string(),
|
|
1937
|
+
stderr: z7.string(),
|
|
1938
|
+
return_code: z7.number()
|
|
1939
1939
|
}),
|
|
1940
|
-
|
|
1941
|
-
type:
|
|
1942
|
-
error_code:
|
|
1940
|
+
z7.object({
|
|
1941
|
+
type: z7.literal("code_execution_tool_result_error"),
|
|
1942
|
+
error_code: z7.string()
|
|
1943
1943
|
})
|
|
1944
1944
|
])
|
|
1945
1945
|
})
|
|
1946
1946
|
])
|
|
1947
1947
|
),
|
|
1948
|
-
stop_reason:
|
|
1949
|
-
stop_sequence:
|
|
1950
|
-
usage:
|
|
1951
|
-
input_tokens:
|
|
1952
|
-
output_tokens:
|
|
1953
|
-
cache_creation_input_tokens:
|
|
1954
|
-
cache_read_input_tokens:
|
|
1948
|
+
stop_reason: z7.string().nullish(),
|
|
1949
|
+
stop_sequence: z7.string().nullish(),
|
|
1950
|
+
usage: z7.looseObject({
|
|
1951
|
+
input_tokens: z7.number(),
|
|
1952
|
+
output_tokens: z7.number(),
|
|
1953
|
+
cache_creation_input_tokens: z7.number().nullish(),
|
|
1954
|
+
cache_read_input_tokens: z7.number().nullish()
|
|
1955
1955
|
})
|
|
1956
1956
|
});
|
|
1957
|
-
var anthropicMessagesChunkSchema =
|
|
1958
|
-
|
|
1959
|
-
type:
|
|
1960
|
-
message:
|
|
1961
|
-
id:
|
|
1962
|
-
model:
|
|
1963
|
-
usage:
|
|
1964
|
-
input_tokens:
|
|
1965
|
-
cache_creation_input_tokens:
|
|
1966
|
-
cache_read_input_tokens:
|
|
1957
|
+
var anthropicMessagesChunkSchema = z7.discriminatedUnion("type", [
|
|
1958
|
+
z7.object({
|
|
1959
|
+
type: z7.literal("message_start"),
|
|
1960
|
+
message: z7.object({
|
|
1961
|
+
id: z7.string().nullish(),
|
|
1962
|
+
model: z7.string().nullish(),
|
|
1963
|
+
usage: z7.looseObject({
|
|
1964
|
+
input_tokens: z7.number(),
|
|
1965
|
+
cache_creation_input_tokens: z7.number().nullish(),
|
|
1966
|
+
cache_read_input_tokens: z7.number().nullish()
|
|
1967
1967
|
})
|
|
1968
1968
|
})
|
|
1969
1969
|
}),
|
|
1970
|
-
|
|
1971
|
-
type:
|
|
1972
|
-
index:
|
|
1973
|
-
content_block:
|
|
1974
|
-
|
|
1975
|
-
type:
|
|
1976
|
-
text:
|
|
1970
|
+
z7.object({
|
|
1971
|
+
type: z7.literal("content_block_start"),
|
|
1972
|
+
index: z7.number(),
|
|
1973
|
+
content_block: z7.discriminatedUnion("type", [
|
|
1974
|
+
z7.object({
|
|
1975
|
+
type: z7.literal("text"),
|
|
1976
|
+
text: z7.string()
|
|
1977
1977
|
}),
|
|
1978
|
-
|
|
1979
|
-
type:
|
|
1980
|
-
thinking:
|
|
1978
|
+
z7.object({
|
|
1979
|
+
type: z7.literal("thinking"),
|
|
1980
|
+
thinking: z7.string()
|
|
1981
1981
|
}),
|
|
1982
|
-
|
|
1983
|
-
type:
|
|
1984
|
-
id:
|
|
1985
|
-
name:
|
|
1982
|
+
z7.object({
|
|
1983
|
+
type: z7.literal("tool_use"),
|
|
1984
|
+
id: z7.string(),
|
|
1985
|
+
name: z7.string()
|
|
1986
1986
|
}),
|
|
1987
|
-
|
|
1988
|
-
type:
|
|
1989
|
-
data:
|
|
1987
|
+
z7.object({
|
|
1988
|
+
type: z7.literal("redacted_thinking"),
|
|
1989
|
+
data: z7.string()
|
|
1990
1990
|
}),
|
|
1991
|
-
|
|
1992
|
-
type:
|
|
1993
|
-
id:
|
|
1994
|
-
name:
|
|
1995
|
-
input:
|
|
1991
|
+
z7.object({
|
|
1992
|
+
type: z7.literal("server_tool_use"),
|
|
1993
|
+
id: z7.string(),
|
|
1994
|
+
name: z7.string(),
|
|
1995
|
+
input: z7.record(z7.string(), z7.unknown()).nullish()
|
|
1996
1996
|
}),
|
|
1997
|
-
|
|
1998
|
-
type:
|
|
1999
|
-
tool_use_id:
|
|
2000
|
-
content:
|
|
2001
|
-
|
|
2002
|
-
type:
|
|
2003
|
-
url:
|
|
2004
|
-
retrieved_at:
|
|
2005
|
-
content:
|
|
2006
|
-
type:
|
|
2007
|
-
title:
|
|
2008
|
-
citations:
|
|
2009
|
-
source:
|
|
2010
|
-
type:
|
|
2011
|
-
media_type:
|
|
2012
|
-
data:
|
|
1997
|
+
z7.object({
|
|
1998
|
+
type: z7.literal("web_fetch_tool_result"),
|
|
1999
|
+
tool_use_id: z7.string(),
|
|
2000
|
+
content: z7.union([
|
|
2001
|
+
z7.object({
|
|
2002
|
+
type: z7.literal("web_fetch_result"),
|
|
2003
|
+
url: z7.string(),
|
|
2004
|
+
retrieved_at: z7.string(),
|
|
2005
|
+
content: z7.object({
|
|
2006
|
+
type: z7.literal("document"),
|
|
2007
|
+
title: z7.string().nullable(),
|
|
2008
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
2009
|
+
source: z7.object({
|
|
2010
|
+
type: z7.literal("text"),
|
|
2011
|
+
media_type: z7.string(),
|
|
2012
|
+
data: z7.string()
|
|
2013
2013
|
})
|
|
2014
2014
|
})
|
|
2015
2015
|
}),
|
|
2016
|
-
|
|
2017
|
-
type:
|
|
2018
|
-
error_code:
|
|
2016
|
+
z7.object({
|
|
2017
|
+
type: z7.literal("web_fetch_tool_result_error"),
|
|
2018
|
+
error_code: z7.string()
|
|
2019
2019
|
})
|
|
2020
2020
|
])
|
|
2021
2021
|
}),
|
|
2022
|
-
|
|
2023
|
-
type:
|
|
2024
|
-
tool_use_id:
|
|
2025
|
-
content:
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
type:
|
|
2029
|
-
url:
|
|
2030
|
-
title:
|
|
2031
|
-
encrypted_content:
|
|
2032
|
-
page_age:
|
|
2022
|
+
z7.object({
|
|
2023
|
+
type: z7.literal("web_search_tool_result"),
|
|
2024
|
+
tool_use_id: z7.string(),
|
|
2025
|
+
content: z7.union([
|
|
2026
|
+
z7.array(
|
|
2027
|
+
z7.object({
|
|
2028
|
+
type: z7.literal("web_search_result"),
|
|
2029
|
+
url: z7.string(),
|
|
2030
|
+
title: z7.string(),
|
|
2031
|
+
encrypted_content: z7.string(),
|
|
2032
|
+
page_age: z7.string().nullish()
|
|
2033
2033
|
})
|
|
2034
2034
|
),
|
|
2035
|
-
|
|
2036
|
-
type:
|
|
2037
|
-
error_code:
|
|
2035
|
+
z7.object({
|
|
2036
|
+
type: z7.literal("web_search_tool_result_error"),
|
|
2037
|
+
error_code: z7.string()
|
|
2038
2038
|
})
|
|
2039
2039
|
])
|
|
2040
2040
|
}),
|
|
2041
|
-
|
|
2042
|
-
type:
|
|
2043
|
-
tool_use_id:
|
|
2044
|
-
content:
|
|
2045
|
-
|
|
2046
|
-
type:
|
|
2047
|
-
stdout:
|
|
2048
|
-
stderr:
|
|
2049
|
-
return_code:
|
|
2041
|
+
z7.object({
|
|
2042
|
+
type: z7.literal("code_execution_tool_result"),
|
|
2043
|
+
tool_use_id: z7.string(),
|
|
2044
|
+
content: z7.union([
|
|
2045
|
+
z7.object({
|
|
2046
|
+
type: z7.literal("code_execution_result"),
|
|
2047
|
+
stdout: z7.string(),
|
|
2048
|
+
stderr: z7.string(),
|
|
2049
|
+
return_code: z7.number()
|
|
2050
2050
|
}),
|
|
2051
|
-
|
|
2052
|
-
type:
|
|
2053
|
-
error_code:
|
|
2051
|
+
z7.object({
|
|
2052
|
+
type: z7.literal("code_execution_tool_result_error"),
|
|
2053
|
+
error_code: z7.string()
|
|
2054
2054
|
})
|
|
2055
2055
|
])
|
|
2056
2056
|
})
|
|
2057
2057
|
])
|
|
2058
2058
|
}),
|
|
2059
|
-
|
|
2060
|
-
type:
|
|
2061
|
-
index:
|
|
2062
|
-
delta:
|
|
2063
|
-
|
|
2064
|
-
type:
|
|
2065
|
-
partial_json:
|
|
2059
|
+
z7.object({
|
|
2060
|
+
type: z7.literal("content_block_delta"),
|
|
2061
|
+
index: z7.number(),
|
|
2062
|
+
delta: z7.discriminatedUnion("type", [
|
|
2063
|
+
z7.object({
|
|
2064
|
+
type: z7.literal("input_json_delta"),
|
|
2065
|
+
partial_json: z7.string()
|
|
2066
2066
|
}),
|
|
2067
|
-
|
|
2068
|
-
type:
|
|
2069
|
-
text:
|
|
2067
|
+
z7.object({
|
|
2068
|
+
type: z7.literal("text_delta"),
|
|
2069
|
+
text: z7.string()
|
|
2070
2070
|
}),
|
|
2071
|
-
|
|
2072
|
-
type:
|
|
2073
|
-
thinking:
|
|
2071
|
+
z7.object({
|
|
2072
|
+
type: z7.literal("thinking_delta"),
|
|
2073
|
+
thinking: z7.string()
|
|
2074
2074
|
}),
|
|
2075
|
-
|
|
2076
|
-
type:
|
|
2077
|
-
signature:
|
|
2075
|
+
z7.object({
|
|
2076
|
+
type: z7.literal("signature_delta"),
|
|
2077
|
+
signature: z7.string()
|
|
2078
2078
|
}),
|
|
2079
|
-
|
|
2080
|
-
type:
|
|
2079
|
+
z7.object({
|
|
2080
|
+
type: z7.literal("citations_delta"),
|
|
2081
2081
|
citation: citationSchema
|
|
2082
2082
|
})
|
|
2083
2083
|
])
|
|
2084
2084
|
}),
|
|
2085
|
-
|
|
2086
|
-
type:
|
|
2087
|
-
index:
|
|
2085
|
+
z7.object({
|
|
2086
|
+
type: z7.literal("content_block_stop"),
|
|
2087
|
+
index: z7.number()
|
|
2088
2088
|
}),
|
|
2089
|
-
|
|
2090
|
-
type:
|
|
2091
|
-
error:
|
|
2092
|
-
type:
|
|
2093
|
-
message:
|
|
2089
|
+
z7.object({
|
|
2090
|
+
type: z7.literal("error"),
|
|
2091
|
+
error: z7.object({
|
|
2092
|
+
type: z7.string(),
|
|
2093
|
+
message: z7.string()
|
|
2094
2094
|
})
|
|
2095
2095
|
}),
|
|
2096
|
-
|
|
2097
|
-
type:
|
|
2098
|
-
delta:
|
|
2099
|
-
stop_reason:
|
|
2100
|
-
stop_sequence:
|
|
2096
|
+
z7.object({
|
|
2097
|
+
type: z7.literal("message_delta"),
|
|
2098
|
+
delta: z7.object({
|
|
2099
|
+
stop_reason: z7.string().nullish(),
|
|
2100
|
+
stop_sequence: z7.string().nullish()
|
|
2101
2101
|
}),
|
|
2102
|
-
usage:
|
|
2103
|
-
output_tokens:
|
|
2104
|
-
cache_creation_input_tokens:
|
|
2102
|
+
usage: z7.looseObject({
|
|
2103
|
+
output_tokens: z7.number(),
|
|
2104
|
+
cache_creation_input_tokens: z7.number().nullish()
|
|
2105
2105
|
})
|
|
2106
2106
|
}),
|
|
2107
|
-
|
|
2108
|
-
type:
|
|
2107
|
+
z7.object({
|
|
2108
|
+
type: z7.literal("message_stop")
|
|
2109
2109
|
}),
|
|
2110
|
-
|
|
2111
|
-
type:
|
|
2110
|
+
z7.object({
|
|
2111
|
+
type: z7.literal("ping")
|
|
2112
2112
|
})
|
|
2113
2113
|
]);
|
|
2114
|
-
var anthropicReasoningMetadataSchema =
|
|
2115
|
-
signature:
|
|
2116
|
-
redactedData:
|
|
2114
|
+
var anthropicReasoningMetadataSchema = z7.object({
|
|
2115
|
+
signature: z7.string().optional(),
|
|
2116
|
+
redactedData: z7.string().optional()
|
|
2117
2117
|
});
|
|
2118
2118
|
|
|
2119
2119
|
// src/tool/bash_20241022.ts
|
|
2120
2120
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
2121
|
-
var
|
|
2121
|
+
var import_v4 = __toESM(require("zod/v4"));
|
|
2122
2122
|
var bash_20241022 = (0, import_provider_utils8.createProviderDefinedToolFactory)({
|
|
2123
2123
|
id: "anthropic.bash_20241022",
|
|
2124
2124
|
name: "bash",
|
|
2125
|
-
inputSchema:
|
|
2126
|
-
command:
|
|
2127
|
-
restart:
|
|
2125
|
+
inputSchema: import_v4.default.object({
|
|
2126
|
+
command: import_v4.default.string(),
|
|
2127
|
+
restart: import_v4.default.boolean().optional()
|
|
2128
2128
|
})
|
|
2129
2129
|
});
|
|
2130
2130
|
|
|
2131
2131
|
// src/tool/bash_20250124.ts
|
|
2132
2132
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
2133
|
-
var
|
|
2133
|
+
var import_v42 = __toESM(require("zod/v4"));
|
|
2134
2134
|
var bash_20250124 = (0, import_provider_utils9.createProviderDefinedToolFactory)({
|
|
2135
2135
|
id: "anthropic.bash_20250124",
|
|
2136
2136
|
name: "bash",
|
|
2137
|
-
inputSchema:
|
|
2138
|
-
command:
|
|
2139
|
-
restart:
|
|
2137
|
+
inputSchema: import_v42.default.object({
|
|
2138
|
+
command: import_v42.default.string(),
|
|
2139
|
+
restart: import_v42.default.boolean().optional()
|
|
2140
2140
|
})
|
|
2141
2141
|
});
|
|
2142
2142
|
|
|
2143
2143
|
// src/tool/computer_20241022.ts
|
|
2144
2144
|
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
2145
|
-
var
|
|
2145
|
+
var z10 = __toESM(require("zod/v4"));
|
|
2146
2146
|
var computer_20241022 = (0, import_provider_utils10.createProviderDefinedToolFactory)({
|
|
2147
2147
|
id: "anthropic.computer_20241022",
|
|
2148
2148
|
name: "computer",
|
|
2149
|
-
inputSchema:
|
|
2150
|
-
action:
|
|
2149
|
+
inputSchema: z10.object({
|
|
2150
|
+
action: z10.enum([
|
|
2151
2151
|
"key",
|
|
2152
2152
|
"type",
|
|
2153
2153
|
"mouse_move",
|
|
@@ -2159,19 +2159,19 @@ var computer_20241022 = (0, import_provider_utils10.createProviderDefinedToolFac
|
|
|
2159
2159
|
"screenshot",
|
|
2160
2160
|
"cursor_position"
|
|
2161
2161
|
]),
|
|
2162
|
-
coordinate:
|
|
2163
|
-
text:
|
|
2162
|
+
coordinate: z10.array(z10.number().int()).optional(),
|
|
2163
|
+
text: z10.string().optional()
|
|
2164
2164
|
})
|
|
2165
2165
|
});
|
|
2166
2166
|
|
|
2167
2167
|
// src/tool/computer_20250124.ts
|
|
2168
2168
|
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
2169
|
-
var
|
|
2169
|
+
var z11 = __toESM(require("zod/v4"));
|
|
2170
2170
|
var computer_20250124 = (0, import_provider_utils11.createProviderDefinedToolFactory)({
|
|
2171
2171
|
id: "anthropic.computer_20250124",
|
|
2172
2172
|
name: "computer",
|
|
2173
|
-
inputSchema:
|
|
2174
|
-
action:
|
|
2173
|
+
inputSchema: z11.object({
|
|
2174
|
+
action: z11.enum([
|
|
2175
2175
|
"key",
|
|
2176
2176
|
"hold_key",
|
|
2177
2177
|
"type",
|
|
@@ -2189,63 +2189,63 @@ var computer_20250124 = (0, import_provider_utils11.createProviderDefinedToolFac
|
|
|
2189
2189
|
"wait",
|
|
2190
2190
|
"screenshot"
|
|
2191
2191
|
]),
|
|
2192
|
-
coordinate:
|
|
2193
|
-
duration:
|
|
2194
|
-
scroll_amount:
|
|
2195
|
-
scroll_direction:
|
|
2196
|
-
start_coordinate:
|
|
2197
|
-
text:
|
|
2192
|
+
coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
|
|
2193
|
+
duration: z11.number().optional(),
|
|
2194
|
+
scroll_amount: z11.number().optional(),
|
|
2195
|
+
scroll_direction: z11.enum(["up", "down", "left", "right"]).optional(),
|
|
2196
|
+
start_coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
|
|
2197
|
+
text: z11.string().optional()
|
|
2198
2198
|
})
|
|
2199
2199
|
});
|
|
2200
2200
|
|
|
2201
2201
|
// src/tool/text-editor_20241022.ts
|
|
2202
2202
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2203
|
-
var
|
|
2203
|
+
var z12 = __toESM(require("zod/v4"));
|
|
2204
2204
|
var textEditor_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
|
|
2205
2205
|
id: "anthropic.text_editor_20241022",
|
|
2206
2206
|
name: "str_replace_editor",
|
|
2207
|
-
inputSchema:
|
|
2208
|
-
command:
|
|
2209
|
-
path:
|
|
2210
|
-
file_text:
|
|
2211
|
-
insert_line:
|
|
2212
|
-
new_str:
|
|
2213
|
-
old_str:
|
|
2214
|
-
view_range:
|
|
2207
|
+
inputSchema: z12.object({
|
|
2208
|
+
command: z12.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2209
|
+
path: z12.string(),
|
|
2210
|
+
file_text: z12.string().optional(),
|
|
2211
|
+
insert_line: z12.number().int().optional(),
|
|
2212
|
+
new_str: z12.string().optional(),
|
|
2213
|
+
old_str: z12.string().optional(),
|
|
2214
|
+
view_range: z12.array(z12.number().int()).optional()
|
|
2215
2215
|
})
|
|
2216
2216
|
});
|
|
2217
2217
|
|
|
2218
2218
|
// src/tool/text-editor_20250124.ts
|
|
2219
2219
|
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2220
|
-
var
|
|
2220
|
+
var z13 = __toESM(require("zod/v4"));
|
|
2221
2221
|
var textEditor_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2222
2222
|
id: "anthropic.text_editor_20250124",
|
|
2223
2223
|
name: "str_replace_editor",
|
|
2224
|
-
inputSchema:
|
|
2225
|
-
command:
|
|
2226
|
-
path:
|
|
2227
|
-
file_text:
|
|
2228
|
-
insert_line:
|
|
2229
|
-
new_str:
|
|
2230
|
-
old_str:
|
|
2231
|
-
view_range:
|
|
2224
|
+
inputSchema: z13.object({
|
|
2225
|
+
command: z13.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2226
|
+
path: z13.string(),
|
|
2227
|
+
file_text: z13.string().optional(),
|
|
2228
|
+
insert_line: z13.number().int().optional(),
|
|
2229
|
+
new_str: z13.string().optional(),
|
|
2230
|
+
old_str: z13.string().optional(),
|
|
2231
|
+
view_range: z13.array(z13.number().int()).optional()
|
|
2232
2232
|
})
|
|
2233
2233
|
});
|
|
2234
2234
|
|
|
2235
2235
|
// src/tool/text-editor_20250429.ts
|
|
2236
2236
|
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2237
|
-
var
|
|
2237
|
+
var z14 = __toESM(require("zod/v4"));
|
|
2238
2238
|
var textEditor_20250429 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2239
2239
|
id: "anthropic.text_editor_20250429",
|
|
2240
2240
|
name: "str_replace_based_edit_tool",
|
|
2241
|
-
inputSchema:
|
|
2242
|
-
command:
|
|
2243
|
-
path:
|
|
2244
|
-
file_text:
|
|
2245
|
-
insert_line:
|
|
2246
|
-
new_str:
|
|
2247
|
-
old_str:
|
|
2248
|
-
view_range:
|
|
2241
|
+
inputSchema: z14.object({
|
|
2242
|
+
command: z14.enum(["view", "create", "str_replace", "insert"]),
|
|
2243
|
+
path: z14.string(),
|
|
2244
|
+
file_text: z14.string().optional(),
|
|
2245
|
+
insert_line: z14.number().int().optional(),
|
|
2246
|
+
new_str: z14.string().optional(),
|
|
2247
|
+
old_str: z14.string().optional(),
|
|
2248
|
+
view_range: z14.array(z14.number().int()).optional()
|
|
2249
2249
|
})
|
|
2250
2250
|
});
|
|
2251
2251
|
|