@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/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.0.
|
|
44
|
+
var VERSION = true ? "2.0.24" : "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
|
|
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
|
|
54
|
-
var anthropicErrorDataSchema =
|
|
55
|
-
type:
|
|
56
|
-
error:
|
|
57
|
-
type:
|
|
58
|
-
message:
|
|
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
|
|
68
|
-
var anthropicFilePartProviderOptions =
|
|
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:
|
|
73
|
+
citations: z2.object({
|
|
74
74
|
/**
|
|
75
75
|
* Enable citations for this document
|
|
76
76
|
*/
|
|
77
|
-
enabled:
|
|
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:
|
|
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:
|
|
89
|
+
context: z2.string().optional()
|
|
90
90
|
});
|
|
91
|
-
var anthropicProviderOptions =
|
|
92
|
-
sendReasoning:
|
|
93
|
-
thinking:
|
|
94
|
-
type:
|
|
95
|
-
budgetTokens:
|
|
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:
|
|
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:
|
|
107
|
-
type:
|
|
108
|
-
ttl:
|
|
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
|
|
126
|
-
var textEditor_20250728ArgsSchema =
|
|
127
|
-
maxCharacters:
|
|
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:
|
|
133
|
-
command:
|
|
134
|
-
path:
|
|
135
|
-
file_text:
|
|
136
|
-
insert_line:
|
|
137
|
-
new_str:
|
|
138
|
-
old_str:
|
|
139
|
-
view_range:
|
|
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
|
|
149
|
-
var webSearch_20250305ArgsSchema =
|
|
150
|
-
maxUses:
|
|
151
|
-
allowedDomains:
|
|
152
|
-
blockedDomains:
|
|
153
|
-
userLocation:
|
|
154
|
-
type:
|
|
155
|
-
city:
|
|
156
|
-
region:
|
|
157
|
-
country:
|
|
158
|
-
timezone:
|
|
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 =
|
|
162
|
-
|
|
163
|
-
url:
|
|
164
|
-
title:
|
|
165
|
-
pageAge:
|
|
166
|
-
encryptedContent:
|
|
167
|
-
type:
|
|
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:
|
|
174
|
-
query:
|
|
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
|
|
185
|
-
var webFetch_20250910ArgsSchema =
|
|
186
|
-
maxUses:
|
|
187
|
-
allowedDomains:
|
|
188
|
-
blockedDomains:
|
|
189
|
-
citations:
|
|
190
|
-
maxContentTokens:
|
|
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 =
|
|
193
|
-
type:
|
|
194
|
-
url:
|
|
195
|
-
content:
|
|
196
|
-
type:
|
|
197
|
-
title:
|
|
198
|
-
citations:
|
|
199
|
-
source:
|
|
200
|
-
|
|
201
|
-
type:
|
|
202
|
-
mediaType:
|
|
203
|
-
data:
|
|
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
|
-
|
|
206
|
-
type:
|
|
207
|
-
mediaType:
|
|
208
|
-
data:
|
|
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:
|
|
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:
|
|
218
|
-
url:
|
|
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
|
|
430
|
-
var codeExecution_20250522OutputSchema =
|
|
431
|
-
type:
|
|
432
|
-
stdout:
|
|
433
|
-
stderr:
|
|
434
|
-
return_code:
|
|
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:
|
|
440
|
-
code:
|
|
439
|
+
inputSchema: z6.object({
|
|
440
|
+
code: z6.string()
|
|
441
441
|
}),
|
|
442
442
|
outputSchema: codeExecution_20250522OutputSchema
|
|
443
443
|
});
|
|
@@ -937,36 +937,36 @@ function mapAnthropicStopReason({
|
|
|
937
937
|
|
|
938
938
|
// src/anthropic-messages-language-model.ts
|
|
939
939
|
var citationSchemas = {
|
|
940
|
-
webSearchResult:
|
|
941
|
-
type:
|
|
942
|
-
cited_text:
|
|
943
|
-
url:
|
|
944
|
-
title:
|
|
945
|
-
encrypted_index:
|
|
940
|
+
webSearchResult: z7.object({
|
|
941
|
+
type: z7.literal("web_search_result_location"),
|
|
942
|
+
cited_text: z7.string(),
|
|
943
|
+
url: z7.string(),
|
|
944
|
+
title: z7.string(),
|
|
945
|
+
encrypted_index: z7.string()
|
|
946
946
|
}),
|
|
947
|
-
pageLocation:
|
|
948
|
-
type:
|
|
949
|
-
cited_text:
|
|
950
|
-
document_index:
|
|
951
|
-
document_title:
|
|
952
|
-
start_page_number:
|
|
953
|
-
end_page_number:
|
|
947
|
+
pageLocation: z7.object({
|
|
948
|
+
type: z7.literal("page_location"),
|
|
949
|
+
cited_text: z7.string(),
|
|
950
|
+
document_index: z7.number(),
|
|
951
|
+
document_title: z7.string().nullable(),
|
|
952
|
+
start_page_number: z7.number(),
|
|
953
|
+
end_page_number: z7.number()
|
|
954
954
|
}),
|
|
955
|
-
charLocation:
|
|
956
|
-
type:
|
|
957
|
-
cited_text:
|
|
958
|
-
document_index:
|
|
959
|
-
document_title:
|
|
960
|
-
start_char_index:
|
|
961
|
-
end_char_index:
|
|
955
|
+
charLocation: z7.object({
|
|
956
|
+
type: z7.literal("char_location"),
|
|
957
|
+
cited_text: z7.string(),
|
|
958
|
+
document_index: z7.number(),
|
|
959
|
+
document_title: z7.string().nullable(),
|
|
960
|
+
start_char_index: z7.number(),
|
|
961
|
+
end_char_index: z7.number()
|
|
962
962
|
})
|
|
963
963
|
};
|
|
964
|
-
var citationSchema =
|
|
964
|
+
var citationSchema = z7.discriminatedUnion("type", [
|
|
965
965
|
citationSchemas.webSearchResult,
|
|
966
966
|
citationSchemas.pageLocation,
|
|
967
967
|
citationSchemas.charLocation
|
|
968
968
|
]);
|
|
969
|
-
var documentCitationSchema =
|
|
969
|
+
var documentCitationSchema = z7.discriminatedUnion("type", [
|
|
970
970
|
citationSchemas.pageLocation,
|
|
971
971
|
citationSchemas.charLocation
|
|
972
972
|
]);
|
|
@@ -1858,303 +1858,303 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1858
1858
|
};
|
|
1859
1859
|
}
|
|
1860
1860
|
};
|
|
1861
|
-
var anthropicMessagesResponseSchema =
|
|
1862
|
-
type:
|
|
1863
|
-
id:
|
|
1864
|
-
model:
|
|
1865
|
-
content:
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
type:
|
|
1869
|
-
text:
|
|
1870
|
-
citations:
|
|
1861
|
+
var anthropicMessagesResponseSchema = z7.object({
|
|
1862
|
+
type: z7.literal("message"),
|
|
1863
|
+
id: z7.string().nullish(),
|
|
1864
|
+
model: z7.string().nullish(),
|
|
1865
|
+
content: z7.array(
|
|
1866
|
+
z7.discriminatedUnion("type", [
|
|
1867
|
+
z7.object({
|
|
1868
|
+
type: z7.literal("text"),
|
|
1869
|
+
text: z7.string(),
|
|
1870
|
+
citations: z7.array(citationSchema).optional()
|
|
1871
1871
|
}),
|
|
1872
|
-
|
|
1873
|
-
type:
|
|
1874
|
-
thinking:
|
|
1875
|
-
signature:
|
|
1872
|
+
z7.object({
|
|
1873
|
+
type: z7.literal("thinking"),
|
|
1874
|
+
thinking: z7.string(),
|
|
1875
|
+
signature: z7.string()
|
|
1876
1876
|
}),
|
|
1877
|
-
|
|
1878
|
-
type:
|
|
1879
|
-
data:
|
|
1877
|
+
z7.object({
|
|
1878
|
+
type: z7.literal("redacted_thinking"),
|
|
1879
|
+
data: z7.string()
|
|
1880
1880
|
}),
|
|
1881
|
-
|
|
1882
|
-
type:
|
|
1883
|
-
id:
|
|
1884
|
-
name:
|
|
1885
|
-
input:
|
|
1881
|
+
z7.object({
|
|
1882
|
+
type: z7.literal("tool_use"),
|
|
1883
|
+
id: z7.string(),
|
|
1884
|
+
name: z7.string(),
|
|
1885
|
+
input: z7.unknown()
|
|
1886
1886
|
}),
|
|
1887
|
-
|
|
1888
|
-
type:
|
|
1889
|
-
id:
|
|
1890
|
-
name:
|
|
1891
|
-
input:
|
|
1887
|
+
z7.object({
|
|
1888
|
+
type: z7.literal("server_tool_use"),
|
|
1889
|
+
id: z7.string(),
|
|
1890
|
+
name: z7.string(),
|
|
1891
|
+
input: z7.record(z7.string(), z7.unknown()).nullish()
|
|
1892
1892
|
}),
|
|
1893
|
-
|
|
1894
|
-
type:
|
|
1895
|
-
tool_use_id:
|
|
1896
|
-
content:
|
|
1897
|
-
|
|
1898
|
-
type:
|
|
1899
|
-
url:
|
|
1900
|
-
retrieved_at:
|
|
1901
|
-
content:
|
|
1902
|
-
type:
|
|
1903
|
-
title:
|
|
1904
|
-
citations:
|
|
1905
|
-
source:
|
|
1906
|
-
type:
|
|
1907
|
-
media_type:
|
|
1908
|
-
data:
|
|
1893
|
+
z7.object({
|
|
1894
|
+
type: z7.literal("web_fetch_tool_result"),
|
|
1895
|
+
tool_use_id: z7.string(),
|
|
1896
|
+
content: z7.union([
|
|
1897
|
+
z7.object({
|
|
1898
|
+
type: z7.literal("web_fetch_result"),
|
|
1899
|
+
url: z7.string(),
|
|
1900
|
+
retrieved_at: z7.string(),
|
|
1901
|
+
content: z7.object({
|
|
1902
|
+
type: z7.literal("document"),
|
|
1903
|
+
title: z7.string().nullable(),
|
|
1904
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1905
|
+
source: z7.object({
|
|
1906
|
+
type: z7.literal("text"),
|
|
1907
|
+
media_type: z7.string(),
|
|
1908
|
+
data: z7.string()
|
|
1909
1909
|
})
|
|
1910
1910
|
})
|
|
1911
1911
|
}),
|
|
1912
|
-
|
|
1913
|
-
type:
|
|
1914
|
-
error_code:
|
|
1912
|
+
z7.object({
|
|
1913
|
+
type: z7.literal("web_fetch_tool_result_error"),
|
|
1914
|
+
error_code: z7.string()
|
|
1915
1915
|
})
|
|
1916
1916
|
])
|
|
1917
1917
|
}),
|
|
1918
|
-
|
|
1919
|
-
type:
|
|
1920
|
-
tool_use_id:
|
|
1921
|
-
content:
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
type:
|
|
1925
|
-
url:
|
|
1926
|
-
title:
|
|
1927
|
-
encrypted_content:
|
|
1928
|
-
page_age:
|
|
1918
|
+
z7.object({
|
|
1919
|
+
type: z7.literal("web_search_tool_result"),
|
|
1920
|
+
tool_use_id: z7.string(),
|
|
1921
|
+
content: z7.union([
|
|
1922
|
+
z7.array(
|
|
1923
|
+
z7.object({
|
|
1924
|
+
type: z7.literal("web_search_result"),
|
|
1925
|
+
url: z7.string(),
|
|
1926
|
+
title: z7.string(),
|
|
1927
|
+
encrypted_content: z7.string(),
|
|
1928
|
+
page_age: z7.string().nullish()
|
|
1929
1929
|
})
|
|
1930
1930
|
),
|
|
1931
|
-
|
|
1932
|
-
type:
|
|
1933
|
-
error_code:
|
|
1931
|
+
z7.object({
|
|
1932
|
+
type: z7.literal("web_search_tool_result_error"),
|
|
1933
|
+
error_code: z7.string()
|
|
1934
1934
|
})
|
|
1935
1935
|
])
|
|
1936
1936
|
}),
|
|
1937
|
-
|
|
1938
|
-
type:
|
|
1939
|
-
tool_use_id:
|
|
1940
|
-
content:
|
|
1941
|
-
|
|
1942
|
-
type:
|
|
1943
|
-
stdout:
|
|
1944
|
-
stderr:
|
|
1945
|
-
return_code:
|
|
1937
|
+
z7.object({
|
|
1938
|
+
type: z7.literal("code_execution_tool_result"),
|
|
1939
|
+
tool_use_id: z7.string(),
|
|
1940
|
+
content: z7.union([
|
|
1941
|
+
z7.object({
|
|
1942
|
+
type: z7.literal("code_execution_result"),
|
|
1943
|
+
stdout: z7.string(),
|
|
1944
|
+
stderr: z7.string(),
|
|
1945
|
+
return_code: z7.number()
|
|
1946
1946
|
}),
|
|
1947
|
-
|
|
1948
|
-
type:
|
|
1949
|
-
error_code:
|
|
1947
|
+
z7.object({
|
|
1948
|
+
type: z7.literal("code_execution_tool_result_error"),
|
|
1949
|
+
error_code: z7.string()
|
|
1950
1950
|
})
|
|
1951
1951
|
])
|
|
1952
1952
|
})
|
|
1953
1953
|
])
|
|
1954
1954
|
),
|
|
1955
|
-
stop_reason:
|
|
1956
|
-
stop_sequence:
|
|
1957
|
-
usage:
|
|
1958
|
-
input_tokens:
|
|
1959
|
-
output_tokens:
|
|
1960
|
-
cache_creation_input_tokens:
|
|
1961
|
-
cache_read_input_tokens:
|
|
1955
|
+
stop_reason: z7.string().nullish(),
|
|
1956
|
+
stop_sequence: z7.string().nullish(),
|
|
1957
|
+
usage: z7.looseObject({
|
|
1958
|
+
input_tokens: z7.number(),
|
|
1959
|
+
output_tokens: z7.number(),
|
|
1960
|
+
cache_creation_input_tokens: z7.number().nullish(),
|
|
1961
|
+
cache_read_input_tokens: z7.number().nullish()
|
|
1962
1962
|
})
|
|
1963
1963
|
});
|
|
1964
|
-
var anthropicMessagesChunkSchema =
|
|
1965
|
-
|
|
1966
|
-
type:
|
|
1967
|
-
message:
|
|
1968
|
-
id:
|
|
1969
|
-
model:
|
|
1970
|
-
usage:
|
|
1971
|
-
input_tokens:
|
|
1972
|
-
cache_creation_input_tokens:
|
|
1973
|
-
cache_read_input_tokens:
|
|
1964
|
+
var anthropicMessagesChunkSchema = z7.discriminatedUnion("type", [
|
|
1965
|
+
z7.object({
|
|
1966
|
+
type: z7.literal("message_start"),
|
|
1967
|
+
message: z7.object({
|
|
1968
|
+
id: z7.string().nullish(),
|
|
1969
|
+
model: z7.string().nullish(),
|
|
1970
|
+
usage: z7.looseObject({
|
|
1971
|
+
input_tokens: z7.number(),
|
|
1972
|
+
cache_creation_input_tokens: z7.number().nullish(),
|
|
1973
|
+
cache_read_input_tokens: z7.number().nullish()
|
|
1974
1974
|
})
|
|
1975
1975
|
})
|
|
1976
1976
|
}),
|
|
1977
|
-
|
|
1978
|
-
type:
|
|
1979
|
-
index:
|
|
1980
|
-
content_block:
|
|
1981
|
-
|
|
1982
|
-
type:
|
|
1983
|
-
text:
|
|
1977
|
+
z7.object({
|
|
1978
|
+
type: z7.literal("content_block_start"),
|
|
1979
|
+
index: z7.number(),
|
|
1980
|
+
content_block: z7.discriminatedUnion("type", [
|
|
1981
|
+
z7.object({
|
|
1982
|
+
type: z7.literal("text"),
|
|
1983
|
+
text: z7.string()
|
|
1984
1984
|
}),
|
|
1985
|
-
|
|
1986
|
-
type:
|
|
1987
|
-
thinking:
|
|
1985
|
+
z7.object({
|
|
1986
|
+
type: z7.literal("thinking"),
|
|
1987
|
+
thinking: z7.string()
|
|
1988
1988
|
}),
|
|
1989
|
-
|
|
1990
|
-
type:
|
|
1991
|
-
id:
|
|
1992
|
-
name:
|
|
1989
|
+
z7.object({
|
|
1990
|
+
type: z7.literal("tool_use"),
|
|
1991
|
+
id: z7.string(),
|
|
1992
|
+
name: z7.string()
|
|
1993
1993
|
}),
|
|
1994
|
-
|
|
1995
|
-
type:
|
|
1996
|
-
data:
|
|
1994
|
+
z7.object({
|
|
1995
|
+
type: z7.literal("redacted_thinking"),
|
|
1996
|
+
data: z7.string()
|
|
1997
1997
|
}),
|
|
1998
|
-
|
|
1999
|
-
type:
|
|
2000
|
-
id:
|
|
2001
|
-
name:
|
|
2002
|
-
input:
|
|
1998
|
+
z7.object({
|
|
1999
|
+
type: z7.literal("server_tool_use"),
|
|
2000
|
+
id: z7.string(),
|
|
2001
|
+
name: z7.string(),
|
|
2002
|
+
input: z7.record(z7.string(), z7.unknown()).nullish()
|
|
2003
2003
|
}),
|
|
2004
|
-
|
|
2005
|
-
type:
|
|
2006
|
-
tool_use_id:
|
|
2007
|
-
content:
|
|
2008
|
-
|
|
2009
|
-
type:
|
|
2010
|
-
url:
|
|
2011
|
-
retrieved_at:
|
|
2012
|
-
content:
|
|
2013
|
-
type:
|
|
2014
|
-
title:
|
|
2015
|
-
citations:
|
|
2016
|
-
source:
|
|
2017
|
-
type:
|
|
2018
|
-
media_type:
|
|
2019
|
-
data:
|
|
2004
|
+
z7.object({
|
|
2005
|
+
type: z7.literal("web_fetch_tool_result"),
|
|
2006
|
+
tool_use_id: z7.string(),
|
|
2007
|
+
content: z7.union([
|
|
2008
|
+
z7.object({
|
|
2009
|
+
type: z7.literal("web_fetch_result"),
|
|
2010
|
+
url: z7.string(),
|
|
2011
|
+
retrieved_at: z7.string(),
|
|
2012
|
+
content: z7.object({
|
|
2013
|
+
type: z7.literal("document"),
|
|
2014
|
+
title: z7.string().nullable(),
|
|
2015
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
2016
|
+
source: z7.object({
|
|
2017
|
+
type: z7.literal("text"),
|
|
2018
|
+
media_type: z7.string(),
|
|
2019
|
+
data: z7.string()
|
|
2020
2020
|
})
|
|
2021
2021
|
})
|
|
2022
2022
|
}),
|
|
2023
|
-
|
|
2024
|
-
type:
|
|
2025
|
-
error_code:
|
|
2023
|
+
z7.object({
|
|
2024
|
+
type: z7.literal("web_fetch_tool_result_error"),
|
|
2025
|
+
error_code: z7.string()
|
|
2026
2026
|
})
|
|
2027
2027
|
])
|
|
2028
2028
|
}),
|
|
2029
|
-
|
|
2030
|
-
type:
|
|
2031
|
-
tool_use_id:
|
|
2032
|
-
content:
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
type:
|
|
2036
|
-
url:
|
|
2037
|
-
title:
|
|
2038
|
-
encrypted_content:
|
|
2039
|
-
page_age:
|
|
2029
|
+
z7.object({
|
|
2030
|
+
type: z7.literal("web_search_tool_result"),
|
|
2031
|
+
tool_use_id: z7.string(),
|
|
2032
|
+
content: z7.union([
|
|
2033
|
+
z7.array(
|
|
2034
|
+
z7.object({
|
|
2035
|
+
type: z7.literal("web_search_result"),
|
|
2036
|
+
url: z7.string(),
|
|
2037
|
+
title: z7.string(),
|
|
2038
|
+
encrypted_content: z7.string(),
|
|
2039
|
+
page_age: z7.string().nullish()
|
|
2040
2040
|
})
|
|
2041
2041
|
),
|
|
2042
|
-
|
|
2043
|
-
type:
|
|
2044
|
-
error_code:
|
|
2042
|
+
z7.object({
|
|
2043
|
+
type: z7.literal("web_search_tool_result_error"),
|
|
2044
|
+
error_code: z7.string()
|
|
2045
2045
|
})
|
|
2046
2046
|
])
|
|
2047
2047
|
}),
|
|
2048
|
-
|
|
2049
|
-
type:
|
|
2050
|
-
tool_use_id:
|
|
2051
|
-
content:
|
|
2052
|
-
|
|
2053
|
-
type:
|
|
2054
|
-
stdout:
|
|
2055
|
-
stderr:
|
|
2056
|
-
return_code:
|
|
2048
|
+
z7.object({
|
|
2049
|
+
type: z7.literal("code_execution_tool_result"),
|
|
2050
|
+
tool_use_id: z7.string(),
|
|
2051
|
+
content: z7.union([
|
|
2052
|
+
z7.object({
|
|
2053
|
+
type: z7.literal("code_execution_result"),
|
|
2054
|
+
stdout: z7.string(),
|
|
2055
|
+
stderr: z7.string(),
|
|
2056
|
+
return_code: z7.number()
|
|
2057
2057
|
}),
|
|
2058
|
-
|
|
2059
|
-
type:
|
|
2060
|
-
error_code:
|
|
2058
|
+
z7.object({
|
|
2059
|
+
type: z7.literal("code_execution_tool_result_error"),
|
|
2060
|
+
error_code: z7.string()
|
|
2061
2061
|
})
|
|
2062
2062
|
])
|
|
2063
2063
|
})
|
|
2064
2064
|
])
|
|
2065
2065
|
}),
|
|
2066
|
-
|
|
2067
|
-
type:
|
|
2068
|
-
index:
|
|
2069
|
-
delta:
|
|
2070
|
-
|
|
2071
|
-
type:
|
|
2072
|
-
partial_json:
|
|
2066
|
+
z7.object({
|
|
2067
|
+
type: z7.literal("content_block_delta"),
|
|
2068
|
+
index: z7.number(),
|
|
2069
|
+
delta: z7.discriminatedUnion("type", [
|
|
2070
|
+
z7.object({
|
|
2071
|
+
type: z7.literal("input_json_delta"),
|
|
2072
|
+
partial_json: z7.string()
|
|
2073
2073
|
}),
|
|
2074
|
-
|
|
2075
|
-
type:
|
|
2076
|
-
text:
|
|
2074
|
+
z7.object({
|
|
2075
|
+
type: z7.literal("text_delta"),
|
|
2076
|
+
text: z7.string()
|
|
2077
2077
|
}),
|
|
2078
|
-
|
|
2079
|
-
type:
|
|
2080
|
-
thinking:
|
|
2078
|
+
z7.object({
|
|
2079
|
+
type: z7.literal("thinking_delta"),
|
|
2080
|
+
thinking: z7.string()
|
|
2081
2081
|
}),
|
|
2082
|
-
|
|
2083
|
-
type:
|
|
2084
|
-
signature:
|
|
2082
|
+
z7.object({
|
|
2083
|
+
type: z7.literal("signature_delta"),
|
|
2084
|
+
signature: z7.string()
|
|
2085
2085
|
}),
|
|
2086
|
-
|
|
2087
|
-
type:
|
|
2086
|
+
z7.object({
|
|
2087
|
+
type: z7.literal("citations_delta"),
|
|
2088
2088
|
citation: citationSchema
|
|
2089
2089
|
})
|
|
2090
2090
|
])
|
|
2091
2091
|
}),
|
|
2092
|
-
|
|
2093
|
-
type:
|
|
2094
|
-
index:
|
|
2092
|
+
z7.object({
|
|
2093
|
+
type: z7.literal("content_block_stop"),
|
|
2094
|
+
index: z7.number()
|
|
2095
2095
|
}),
|
|
2096
|
-
|
|
2097
|
-
type:
|
|
2098
|
-
error:
|
|
2099
|
-
type:
|
|
2100
|
-
message:
|
|
2096
|
+
z7.object({
|
|
2097
|
+
type: z7.literal("error"),
|
|
2098
|
+
error: z7.object({
|
|
2099
|
+
type: z7.string(),
|
|
2100
|
+
message: z7.string()
|
|
2101
2101
|
})
|
|
2102
2102
|
}),
|
|
2103
|
-
|
|
2104
|
-
type:
|
|
2105
|
-
delta:
|
|
2106
|
-
stop_reason:
|
|
2107
|
-
stop_sequence:
|
|
2103
|
+
z7.object({
|
|
2104
|
+
type: z7.literal("message_delta"),
|
|
2105
|
+
delta: z7.object({
|
|
2106
|
+
stop_reason: z7.string().nullish(),
|
|
2107
|
+
stop_sequence: z7.string().nullish()
|
|
2108
2108
|
}),
|
|
2109
|
-
usage:
|
|
2110
|
-
output_tokens:
|
|
2111
|
-
cache_creation_input_tokens:
|
|
2109
|
+
usage: z7.looseObject({
|
|
2110
|
+
output_tokens: z7.number(),
|
|
2111
|
+
cache_creation_input_tokens: z7.number().nullish()
|
|
2112
2112
|
})
|
|
2113
2113
|
}),
|
|
2114
|
-
|
|
2115
|
-
type:
|
|
2114
|
+
z7.object({
|
|
2115
|
+
type: z7.literal("message_stop")
|
|
2116
2116
|
}),
|
|
2117
|
-
|
|
2118
|
-
type:
|
|
2117
|
+
z7.object({
|
|
2118
|
+
type: z7.literal("ping")
|
|
2119
2119
|
})
|
|
2120
2120
|
]);
|
|
2121
|
-
var anthropicReasoningMetadataSchema =
|
|
2122
|
-
signature:
|
|
2123
|
-
redactedData:
|
|
2121
|
+
var anthropicReasoningMetadataSchema = z7.object({
|
|
2122
|
+
signature: z7.string().optional(),
|
|
2123
|
+
redactedData: z7.string().optional()
|
|
2124
2124
|
});
|
|
2125
2125
|
|
|
2126
2126
|
// src/tool/bash_20241022.ts
|
|
2127
2127
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
2128
|
-
var
|
|
2128
|
+
var import_v4 = __toESM(require("zod/v4"));
|
|
2129
2129
|
var bash_20241022 = (0, import_provider_utils8.createProviderDefinedToolFactory)({
|
|
2130
2130
|
id: "anthropic.bash_20241022",
|
|
2131
2131
|
name: "bash",
|
|
2132
|
-
inputSchema:
|
|
2133
|
-
command:
|
|
2134
|
-
restart:
|
|
2132
|
+
inputSchema: import_v4.default.object({
|
|
2133
|
+
command: import_v4.default.string(),
|
|
2134
|
+
restart: import_v4.default.boolean().optional()
|
|
2135
2135
|
})
|
|
2136
2136
|
});
|
|
2137
2137
|
|
|
2138
2138
|
// src/tool/bash_20250124.ts
|
|
2139
2139
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
2140
|
-
var
|
|
2140
|
+
var import_v42 = __toESM(require("zod/v4"));
|
|
2141
2141
|
var bash_20250124 = (0, import_provider_utils9.createProviderDefinedToolFactory)({
|
|
2142
2142
|
id: "anthropic.bash_20250124",
|
|
2143
2143
|
name: "bash",
|
|
2144
|
-
inputSchema:
|
|
2145
|
-
command:
|
|
2146
|
-
restart:
|
|
2144
|
+
inputSchema: import_v42.default.object({
|
|
2145
|
+
command: import_v42.default.string(),
|
|
2146
|
+
restart: import_v42.default.boolean().optional()
|
|
2147
2147
|
})
|
|
2148
2148
|
});
|
|
2149
2149
|
|
|
2150
2150
|
// src/tool/computer_20241022.ts
|
|
2151
2151
|
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
2152
|
-
var
|
|
2152
|
+
var z10 = __toESM(require("zod/v4"));
|
|
2153
2153
|
var computer_20241022 = (0, import_provider_utils10.createProviderDefinedToolFactory)({
|
|
2154
2154
|
id: "anthropic.computer_20241022",
|
|
2155
2155
|
name: "computer",
|
|
2156
|
-
inputSchema:
|
|
2157
|
-
action:
|
|
2156
|
+
inputSchema: z10.object({
|
|
2157
|
+
action: z10.enum([
|
|
2158
2158
|
"key",
|
|
2159
2159
|
"type",
|
|
2160
2160
|
"mouse_move",
|
|
@@ -2166,19 +2166,19 @@ var computer_20241022 = (0, import_provider_utils10.createProviderDefinedToolFac
|
|
|
2166
2166
|
"screenshot",
|
|
2167
2167
|
"cursor_position"
|
|
2168
2168
|
]),
|
|
2169
|
-
coordinate:
|
|
2170
|
-
text:
|
|
2169
|
+
coordinate: z10.array(z10.number().int()).optional(),
|
|
2170
|
+
text: z10.string().optional()
|
|
2171
2171
|
})
|
|
2172
2172
|
});
|
|
2173
2173
|
|
|
2174
2174
|
// src/tool/computer_20250124.ts
|
|
2175
2175
|
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
2176
|
-
var
|
|
2176
|
+
var z11 = __toESM(require("zod/v4"));
|
|
2177
2177
|
var computer_20250124 = (0, import_provider_utils11.createProviderDefinedToolFactory)({
|
|
2178
2178
|
id: "anthropic.computer_20250124",
|
|
2179
2179
|
name: "computer",
|
|
2180
|
-
inputSchema:
|
|
2181
|
-
action:
|
|
2180
|
+
inputSchema: z11.object({
|
|
2181
|
+
action: z11.enum([
|
|
2182
2182
|
"key",
|
|
2183
2183
|
"hold_key",
|
|
2184
2184
|
"type",
|
|
@@ -2196,63 +2196,63 @@ var computer_20250124 = (0, import_provider_utils11.createProviderDefinedToolFac
|
|
|
2196
2196
|
"wait",
|
|
2197
2197
|
"screenshot"
|
|
2198
2198
|
]),
|
|
2199
|
-
coordinate:
|
|
2200
|
-
duration:
|
|
2201
|
-
scroll_amount:
|
|
2202
|
-
scroll_direction:
|
|
2203
|
-
start_coordinate:
|
|
2204
|
-
text:
|
|
2199
|
+
coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
|
|
2200
|
+
duration: z11.number().optional(),
|
|
2201
|
+
scroll_amount: z11.number().optional(),
|
|
2202
|
+
scroll_direction: z11.enum(["up", "down", "left", "right"]).optional(),
|
|
2203
|
+
start_coordinate: z11.tuple([z11.number().int(), z11.number().int()]).optional(),
|
|
2204
|
+
text: z11.string().optional()
|
|
2205
2205
|
})
|
|
2206
2206
|
});
|
|
2207
2207
|
|
|
2208
2208
|
// src/tool/text-editor_20241022.ts
|
|
2209
2209
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
2210
|
-
var
|
|
2210
|
+
var z12 = __toESM(require("zod/v4"));
|
|
2211
2211
|
var textEditor_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
|
|
2212
2212
|
id: "anthropic.text_editor_20241022",
|
|
2213
2213
|
name: "str_replace_editor",
|
|
2214
|
-
inputSchema:
|
|
2215
|
-
command:
|
|
2216
|
-
path:
|
|
2217
|
-
file_text:
|
|
2218
|
-
insert_line:
|
|
2219
|
-
new_str:
|
|
2220
|
-
old_str:
|
|
2221
|
-
view_range:
|
|
2214
|
+
inputSchema: z12.object({
|
|
2215
|
+
command: z12.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2216
|
+
path: z12.string(),
|
|
2217
|
+
file_text: z12.string().optional(),
|
|
2218
|
+
insert_line: z12.number().int().optional(),
|
|
2219
|
+
new_str: z12.string().optional(),
|
|
2220
|
+
old_str: z12.string().optional(),
|
|
2221
|
+
view_range: z12.array(z12.number().int()).optional()
|
|
2222
2222
|
})
|
|
2223
2223
|
});
|
|
2224
2224
|
|
|
2225
2225
|
// src/tool/text-editor_20250124.ts
|
|
2226
2226
|
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
2227
|
-
var
|
|
2227
|
+
var z13 = __toESM(require("zod/v4"));
|
|
2228
2228
|
var textEditor_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
|
|
2229
2229
|
id: "anthropic.text_editor_20250124",
|
|
2230
2230
|
name: "str_replace_editor",
|
|
2231
|
-
inputSchema:
|
|
2232
|
-
command:
|
|
2233
|
-
path:
|
|
2234
|
-
file_text:
|
|
2235
|
-
insert_line:
|
|
2236
|
-
new_str:
|
|
2237
|
-
old_str:
|
|
2238
|
-
view_range:
|
|
2231
|
+
inputSchema: z13.object({
|
|
2232
|
+
command: z13.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
2233
|
+
path: z13.string(),
|
|
2234
|
+
file_text: z13.string().optional(),
|
|
2235
|
+
insert_line: z13.number().int().optional(),
|
|
2236
|
+
new_str: z13.string().optional(),
|
|
2237
|
+
old_str: z13.string().optional(),
|
|
2238
|
+
view_range: z13.array(z13.number().int()).optional()
|
|
2239
2239
|
})
|
|
2240
2240
|
});
|
|
2241
2241
|
|
|
2242
2242
|
// src/tool/text-editor_20250429.ts
|
|
2243
2243
|
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2244
|
-
var
|
|
2244
|
+
var z14 = __toESM(require("zod/v4"));
|
|
2245
2245
|
var textEditor_20250429 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
|
|
2246
2246
|
id: "anthropic.text_editor_20250429",
|
|
2247
2247
|
name: "str_replace_based_edit_tool",
|
|
2248
|
-
inputSchema:
|
|
2249
|
-
command:
|
|
2250
|
-
path:
|
|
2251
|
-
file_text:
|
|
2252
|
-
insert_line:
|
|
2253
|
-
new_str:
|
|
2254
|
-
old_str:
|
|
2255
|
-
view_range:
|
|
2248
|
+
inputSchema: z14.object({
|
|
2249
|
+
command: z14.enum(["view", "create", "str_replace", "insert"]),
|
|
2250
|
+
path: z14.string(),
|
|
2251
|
+
file_text: z14.string().optional(),
|
|
2252
|
+
insert_line: z14.number().int().optional(),
|
|
2253
|
+
new_str: z14.string().optional(),
|
|
2254
|
+
old_str: z14.string().optional(),
|
|
2255
|
+
view_range: z14.array(z14.number().int()).optional()
|
|
2256
2256
|
})
|
|
2257
2257
|
});
|
|
2258
2258
|
|