@ai-sdk/anthropic 4.0.0-beta.16 → 4.0.0-beta.18
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 +18 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1162 -1060
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1162 -1050
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +20 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +22 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/anthropic-files.ts +106 -0
- package/src/anthropic-messages-api.ts +4 -0
- package/src/anthropic-provider.ts +13 -1
- package/src/convert-to-anthropic-messages-prompt.ts +23 -1
package/dist/index.js
CHANGED
|
@@ -29,14 +29,11 @@ module.exports = __toCommonJS(index_exports);
|
|
|
29
29
|
|
|
30
30
|
// src/anthropic-provider.ts
|
|
31
31
|
var import_provider4 = require("@ai-sdk/provider");
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
// src/version.ts
|
|
35
|
-
var VERSION = true ? "4.0.0-beta.16" : "0.0.0-test";
|
|
32
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
36
33
|
|
|
37
|
-
// src/anthropic-
|
|
38
|
-
var
|
|
39
|
-
var
|
|
34
|
+
// src/anthropic-files.ts
|
|
35
|
+
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
36
|
+
var import_v42 = require("zod/v4");
|
|
40
37
|
|
|
41
38
|
// src/anthropic-error.ts
|
|
42
39
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -57,319 +54,396 @@ var anthropicFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
|
|
|
57
54
|
errorToMessage: (data) => data.error.message
|
|
58
55
|
});
|
|
59
56
|
|
|
60
|
-
// src/anthropic-
|
|
61
|
-
var
|
|
62
|
-
var
|
|
63
|
-
var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
57
|
+
// src/anthropic-files.ts
|
|
58
|
+
var anthropicUploadFileProviderOptions = import_v42.z.object({});
|
|
59
|
+
var anthropicUploadFileResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
64
60
|
() => (0, import_provider_utils2.zodSchema)(
|
|
65
61
|
import_v42.z.object({
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
62
|
+
id: import_v42.z.string(),
|
|
63
|
+
type: import_v42.z.literal("file"),
|
|
64
|
+
filename: import_v42.z.string(),
|
|
65
|
+
mime_type: import_v42.z.string(),
|
|
66
|
+
size_bytes: import_v42.z.number(),
|
|
67
|
+
created_at: import_v42.z.string(),
|
|
68
|
+
downloadable: import_v42.z.boolean().nullish()
|
|
69
|
+
})
|
|
70
|
+
)
|
|
71
|
+
);
|
|
72
|
+
var AnthropicFiles = class {
|
|
73
|
+
constructor(config) {
|
|
74
|
+
this.config = config;
|
|
75
|
+
this.specificationVersion = "v4";
|
|
76
|
+
}
|
|
77
|
+
get provider() {
|
|
78
|
+
return this.config.provider;
|
|
79
|
+
}
|
|
80
|
+
async uploadFile({
|
|
81
|
+
data,
|
|
82
|
+
mediaType,
|
|
83
|
+
filename,
|
|
84
|
+
providerOptions
|
|
85
|
+
}) {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
const anthropicOptions = await (0, import_provider_utils2.parseProviderOptions)({
|
|
88
|
+
provider: "anthropic",
|
|
89
|
+
providerOptions,
|
|
90
|
+
schema: (0, import_provider_utils2.zodSchema)(anthropicUploadFileProviderOptions)
|
|
91
|
+
});
|
|
92
|
+
const fileBytes = data instanceof Uint8Array ? data : (0, import_provider_utils2.convertBase64ToUint8Array)(data);
|
|
93
|
+
const blob = new Blob([fileBytes], { type: mediaType });
|
|
94
|
+
const formData = new FormData();
|
|
95
|
+
if (filename != null) {
|
|
96
|
+
formData.append("file", blob, filename);
|
|
97
|
+
} else {
|
|
98
|
+
formData.append("file", blob);
|
|
99
|
+
}
|
|
100
|
+
const { value: response } = await (0, import_provider_utils2.postFormDataToApi)({
|
|
101
|
+
url: `${this.config.baseURL}/files`,
|
|
102
|
+
headers: (0, import_provider_utils2.combineHeaders)(this.config.headers(), {
|
|
103
|
+
"anthropic-beta": "files-api-2025-04-14"
|
|
104
|
+
}),
|
|
105
|
+
formData,
|
|
106
|
+
failedResponseHandler: anthropicFailedResponseHandler,
|
|
107
|
+
successfulResponseHandler: (0, import_provider_utils2.createJsonResponseHandler)(
|
|
108
|
+
anthropicUploadFileResponseSchema
|
|
109
|
+
),
|
|
110
|
+
fetch: this.config.fetch
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
warnings: [],
|
|
114
|
+
providerReference: { anthropic: response.id },
|
|
115
|
+
mediaType: (_a = response.mime_type) != null ? _a : mediaType,
|
|
116
|
+
filename: (_b = response.filename) != null ? _b : filename,
|
|
117
|
+
providerMetadata: {
|
|
118
|
+
anthropic: {
|
|
119
|
+
filename: response.filename,
|
|
120
|
+
mimeType: response.mime_type,
|
|
121
|
+
sizeBytes: response.size_bytes,
|
|
122
|
+
createdAt: response.created_at,
|
|
123
|
+
...response.downloadable != null ? { downloadable: response.downloadable } : {}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// src/anthropic-messages-language-model.ts
|
|
131
|
+
var import_provider3 = require("@ai-sdk/provider");
|
|
132
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
133
|
+
|
|
134
|
+
// src/anthropic-messages-api.ts
|
|
135
|
+
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
136
|
+
var import_v43 = require("zod/v4");
|
|
137
|
+
var anthropicMessagesResponseSchema = (0, import_provider_utils3.lazySchema)(
|
|
138
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
139
|
+
import_v43.z.object({
|
|
140
|
+
type: import_v43.z.literal("message"),
|
|
141
|
+
id: import_v43.z.string().nullish(),
|
|
142
|
+
model: import_v43.z.string().nullish(),
|
|
143
|
+
content: import_v43.z.array(
|
|
144
|
+
import_v43.z.discriminatedUnion("type", [
|
|
145
|
+
import_v43.z.object({
|
|
146
|
+
type: import_v43.z.literal("text"),
|
|
147
|
+
text: import_v43.z.string(),
|
|
148
|
+
citations: import_v43.z.array(
|
|
149
|
+
import_v43.z.discriminatedUnion("type", [
|
|
150
|
+
import_v43.z.object({
|
|
151
|
+
type: import_v43.z.literal("web_search_result_location"),
|
|
152
|
+
cited_text: import_v43.z.string(),
|
|
153
|
+
url: import_v43.z.string(),
|
|
154
|
+
title: import_v43.z.string(),
|
|
155
|
+
encrypted_index: import_v43.z.string()
|
|
82
156
|
}),
|
|
83
|
-
|
|
84
|
-
type:
|
|
85
|
-
cited_text:
|
|
86
|
-
document_index:
|
|
87
|
-
document_title:
|
|
88
|
-
start_page_number:
|
|
89
|
-
end_page_number:
|
|
157
|
+
import_v43.z.object({
|
|
158
|
+
type: import_v43.z.literal("page_location"),
|
|
159
|
+
cited_text: import_v43.z.string(),
|
|
160
|
+
document_index: import_v43.z.number(),
|
|
161
|
+
document_title: import_v43.z.string().nullable(),
|
|
162
|
+
start_page_number: import_v43.z.number(),
|
|
163
|
+
end_page_number: import_v43.z.number()
|
|
90
164
|
}),
|
|
91
|
-
|
|
92
|
-
type:
|
|
93
|
-
cited_text:
|
|
94
|
-
document_index:
|
|
95
|
-
document_title:
|
|
96
|
-
start_char_index:
|
|
97
|
-
end_char_index:
|
|
165
|
+
import_v43.z.object({
|
|
166
|
+
type: import_v43.z.literal("char_location"),
|
|
167
|
+
cited_text: import_v43.z.string(),
|
|
168
|
+
document_index: import_v43.z.number(),
|
|
169
|
+
document_title: import_v43.z.string().nullable(),
|
|
170
|
+
start_char_index: import_v43.z.number(),
|
|
171
|
+
end_char_index: import_v43.z.number()
|
|
98
172
|
})
|
|
99
173
|
])
|
|
100
174
|
).optional()
|
|
101
175
|
}),
|
|
102
|
-
|
|
103
|
-
type:
|
|
104
|
-
thinking:
|
|
105
|
-
signature:
|
|
176
|
+
import_v43.z.object({
|
|
177
|
+
type: import_v43.z.literal("thinking"),
|
|
178
|
+
thinking: import_v43.z.string(),
|
|
179
|
+
signature: import_v43.z.string()
|
|
106
180
|
}),
|
|
107
|
-
|
|
108
|
-
type:
|
|
109
|
-
data:
|
|
181
|
+
import_v43.z.object({
|
|
182
|
+
type: import_v43.z.literal("redacted_thinking"),
|
|
183
|
+
data: import_v43.z.string()
|
|
110
184
|
}),
|
|
111
|
-
|
|
112
|
-
type:
|
|
113
|
-
content:
|
|
185
|
+
import_v43.z.object({
|
|
186
|
+
type: import_v43.z.literal("compaction"),
|
|
187
|
+
content: import_v43.z.string()
|
|
114
188
|
}),
|
|
115
|
-
|
|
116
|
-
type:
|
|
117
|
-
id:
|
|
118
|
-
name:
|
|
119
|
-
input:
|
|
189
|
+
import_v43.z.object({
|
|
190
|
+
type: import_v43.z.literal("tool_use"),
|
|
191
|
+
id: import_v43.z.string(),
|
|
192
|
+
name: import_v43.z.string(),
|
|
193
|
+
input: import_v43.z.unknown(),
|
|
120
194
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
121
|
-
caller:
|
|
122
|
-
|
|
123
|
-
type:
|
|
124
|
-
tool_id:
|
|
195
|
+
caller: import_v43.z.union([
|
|
196
|
+
import_v43.z.object({
|
|
197
|
+
type: import_v43.z.literal("code_execution_20250825"),
|
|
198
|
+
tool_id: import_v43.z.string()
|
|
125
199
|
}),
|
|
126
|
-
|
|
127
|
-
type:
|
|
128
|
-
tool_id:
|
|
200
|
+
import_v43.z.object({
|
|
201
|
+
type: import_v43.z.literal("code_execution_20260120"),
|
|
202
|
+
tool_id: import_v43.z.string()
|
|
129
203
|
}),
|
|
130
|
-
|
|
131
|
-
type:
|
|
204
|
+
import_v43.z.object({
|
|
205
|
+
type: import_v43.z.literal("direct")
|
|
132
206
|
})
|
|
133
207
|
]).optional()
|
|
134
208
|
}),
|
|
135
|
-
|
|
136
|
-
type:
|
|
137
|
-
id:
|
|
138
|
-
name:
|
|
139
|
-
input:
|
|
140
|
-
caller:
|
|
141
|
-
|
|
142
|
-
type:
|
|
143
|
-
tool_id:
|
|
209
|
+
import_v43.z.object({
|
|
210
|
+
type: import_v43.z.literal("server_tool_use"),
|
|
211
|
+
id: import_v43.z.string(),
|
|
212
|
+
name: import_v43.z.string(),
|
|
213
|
+
input: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish(),
|
|
214
|
+
caller: import_v43.z.union([
|
|
215
|
+
import_v43.z.object({
|
|
216
|
+
type: import_v43.z.literal("code_execution_20260120"),
|
|
217
|
+
tool_id: import_v43.z.string()
|
|
144
218
|
}),
|
|
145
|
-
|
|
146
|
-
type:
|
|
219
|
+
import_v43.z.object({
|
|
220
|
+
type: import_v43.z.literal("direct")
|
|
147
221
|
})
|
|
148
222
|
]).optional()
|
|
149
223
|
}),
|
|
150
|
-
|
|
151
|
-
type:
|
|
152
|
-
id:
|
|
153
|
-
name:
|
|
154
|
-
input:
|
|
155
|
-
server_name:
|
|
224
|
+
import_v43.z.object({
|
|
225
|
+
type: import_v43.z.literal("mcp_tool_use"),
|
|
226
|
+
id: import_v43.z.string(),
|
|
227
|
+
name: import_v43.z.string(),
|
|
228
|
+
input: import_v43.z.unknown(),
|
|
229
|
+
server_name: import_v43.z.string()
|
|
156
230
|
}),
|
|
157
|
-
|
|
158
|
-
type:
|
|
159
|
-
tool_use_id:
|
|
160
|
-
is_error:
|
|
161
|
-
content:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
231
|
+
import_v43.z.object({
|
|
232
|
+
type: import_v43.z.literal("mcp_tool_result"),
|
|
233
|
+
tool_use_id: import_v43.z.string(),
|
|
234
|
+
is_error: import_v43.z.boolean(),
|
|
235
|
+
content: import_v43.z.array(
|
|
236
|
+
import_v43.z.union([
|
|
237
|
+
import_v43.z.string(),
|
|
238
|
+
import_v43.z.object({ type: import_v43.z.literal("text"), text: import_v43.z.string() })
|
|
165
239
|
])
|
|
166
240
|
)
|
|
167
241
|
}),
|
|
168
|
-
|
|
169
|
-
type:
|
|
170
|
-
tool_use_id:
|
|
171
|
-
content:
|
|
172
|
-
|
|
173
|
-
type:
|
|
174
|
-
url:
|
|
175
|
-
retrieved_at:
|
|
176
|
-
content:
|
|
177
|
-
type:
|
|
178
|
-
title:
|
|
179
|
-
citations:
|
|
180
|
-
source:
|
|
181
|
-
|
|
182
|
-
type:
|
|
183
|
-
media_type:
|
|
184
|
-
data:
|
|
242
|
+
import_v43.z.object({
|
|
243
|
+
type: import_v43.z.literal("web_fetch_tool_result"),
|
|
244
|
+
tool_use_id: import_v43.z.string(),
|
|
245
|
+
content: import_v43.z.union([
|
|
246
|
+
import_v43.z.object({
|
|
247
|
+
type: import_v43.z.literal("web_fetch_result"),
|
|
248
|
+
url: import_v43.z.string(),
|
|
249
|
+
retrieved_at: import_v43.z.string(),
|
|
250
|
+
content: import_v43.z.object({
|
|
251
|
+
type: import_v43.z.literal("document"),
|
|
252
|
+
title: import_v43.z.string().nullable(),
|
|
253
|
+
citations: import_v43.z.object({ enabled: import_v43.z.boolean() }).optional(),
|
|
254
|
+
source: import_v43.z.union([
|
|
255
|
+
import_v43.z.object({
|
|
256
|
+
type: import_v43.z.literal("base64"),
|
|
257
|
+
media_type: import_v43.z.literal("application/pdf"),
|
|
258
|
+
data: import_v43.z.string()
|
|
185
259
|
}),
|
|
186
|
-
|
|
187
|
-
type:
|
|
188
|
-
media_type:
|
|
189
|
-
data:
|
|
260
|
+
import_v43.z.object({
|
|
261
|
+
type: import_v43.z.literal("text"),
|
|
262
|
+
media_type: import_v43.z.literal("text/plain"),
|
|
263
|
+
data: import_v43.z.string()
|
|
190
264
|
})
|
|
191
265
|
])
|
|
192
266
|
})
|
|
193
267
|
}),
|
|
194
|
-
|
|
195
|
-
type:
|
|
196
|
-
error_code:
|
|
268
|
+
import_v43.z.object({
|
|
269
|
+
type: import_v43.z.literal("web_fetch_tool_result_error"),
|
|
270
|
+
error_code: import_v43.z.string()
|
|
197
271
|
})
|
|
198
272
|
])
|
|
199
273
|
}),
|
|
200
|
-
|
|
201
|
-
type:
|
|
202
|
-
tool_use_id:
|
|
203
|
-
content:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
type:
|
|
207
|
-
url:
|
|
208
|
-
title:
|
|
209
|
-
encrypted_content:
|
|
210
|
-
page_age:
|
|
274
|
+
import_v43.z.object({
|
|
275
|
+
type: import_v43.z.literal("web_search_tool_result"),
|
|
276
|
+
tool_use_id: import_v43.z.string(),
|
|
277
|
+
content: import_v43.z.union([
|
|
278
|
+
import_v43.z.array(
|
|
279
|
+
import_v43.z.object({
|
|
280
|
+
type: import_v43.z.literal("web_search_result"),
|
|
281
|
+
url: import_v43.z.string(),
|
|
282
|
+
title: import_v43.z.string(),
|
|
283
|
+
encrypted_content: import_v43.z.string(),
|
|
284
|
+
page_age: import_v43.z.string().nullish()
|
|
211
285
|
})
|
|
212
286
|
),
|
|
213
|
-
|
|
214
|
-
type:
|
|
215
|
-
error_code:
|
|
287
|
+
import_v43.z.object({
|
|
288
|
+
type: import_v43.z.literal("web_search_tool_result_error"),
|
|
289
|
+
error_code: import_v43.z.string()
|
|
216
290
|
})
|
|
217
291
|
])
|
|
218
292
|
}),
|
|
219
293
|
// code execution results for code_execution_20250522 tool:
|
|
220
|
-
|
|
221
|
-
type:
|
|
222
|
-
tool_use_id:
|
|
223
|
-
content:
|
|
224
|
-
|
|
225
|
-
type:
|
|
226
|
-
stdout:
|
|
227
|
-
stderr:
|
|
228
|
-
return_code:
|
|
229
|
-
content:
|
|
230
|
-
|
|
231
|
-
type:
|
|
232
|
-
file_id:
|
|
294
|
+
import_v43.z.object({
|
|
295
|
+
type: import_v43.z.literal("code_execution_tool_result"),
|
|
296
|
+
tool_use_id: import_v43.z.string(),
|
|
297
|
+
content: import_v43.z.union([
|
|
298
|
+
import_v43.z.object({
|
|
299
|
+
type: import_v43.z.literal("code_execution_result"),
|
|
300
|
+
stdout: import_v43.z.string(),
|
|
301
|
+
stderr: import_v43.z.string(),
|
|
302
|
+
return_code: import_v43.z.number(),
|
|
303
|
+
content: import_v43.z.array(
|
|
304
|
+
import_v43.z.object({
|
|
305
|
+
type: import_v43.z.literal("code_execution_output"),
|
|
306
|
+
file_id: import_v43.z.string()
|
|
233
307
|
})
|
|
234
308
|
).optional().default([])
|
|
235
309
|
}),
|
|
236
|
-
|
|
237
|
-
type:
|
|
238
|
-
encrypted_stdout:
|
|
239
|
-
stderr:
|
|
240
|
-
return_code:
|
|
241
|
-
content:
|
|
242
|
-
|
|
243
|
-
type:
|
|
244
|
-
file_id:
|
|
310
|
+
import_v43.z.object({
|
|
311
|
+
type: import_v43.z.literal("encrypted_code_execution_result"),
|
|
312
|
+
encrypted_stdout: import_v43.z.string(),
|
|
313
|
+
stderr: import_v43.z.string(),
|
|
314
|
+
return_code: import_v43.z.number(),
|
|
315
|
+
content: import_v43.z.array(
|
|
316
|
+
import_v43.z.object({
|
|
317
|
+
type: import_v43.z.literal("code_execution_output"),
|
|
318
|
+
file_id: import_v43.z.string()
|
|
245
319
|
})
|
|
246
320
|
).optional().default([])
|
|
247
321
|
}),
|
|
248
|
-
|
|
249
|
-
type:
|
|
250
|
-
error_code:
|
|
322
|
+
import_v43.z.object({
|
|
323
|
+
type: import_v43.z.literal("code_execution_tool_result_error"),
|
|
324
|
+
error_code: import_v43.z.string()
|
|
251
325
|
})
|
|
252
326
|
])
|
|
253
327
|
}),
|
|
254
328
|
// bash code execution results for code_execution_20250825 tool:
|
|
255
|
-
|
|
256
|
-
type:
|
|
257
|
-
tool_use_id:
|
|
258
|
-
content:
|
|
259
|
-
|
|
260
|
-
type:
|
|
261
|
-
content:
|
|
262
|
-
|
|
263
|
-
type:
|
|
264
|
-
file_id:
|
|
329
|
+
import_v43.z.object({
|
|
330
|
+
type: import_v43.z.literal("bash_code_execution_tool_result"),
|
|
331
|
+
tool_use_id: import_v43.z.string(),
|
|
332
|
+
content: import_v43.z.discriminatedUnion("type", [
|
|
333
|
+
import_v43.z.object({
|
|
334
|
+
type: import_v43.z.literal("bash_code_execution_result"),
|
|
335
|
+
content: import_v43.z.array(
|
|
336
|
+
import_v43.z.object({
|
|
337
|
+
type: import_v43.z.literal("bash_code_execution_output"),
|
|
338
|
+
file_id: import_v43.z.string()
|
|
265
339
|
})
|
|
266
340
|
),
|
|
267
|
-
stdout:
|
|
268
|
-
stderr:
|
|
269
|
-
return_code:
|
|
341
|
+
stdout: import_v43.z.string(),
|
|
342
|
+
stderr: import_v43.z.string(),
|
|
343
|
+
return_code: import_v43.z.number()
|
|
270
344
|
}),
|
|
271
|
-
|
|
272
|
-
type:
|
|
273
|
-
error_code:
|
|
345
|
+
import_v43.z.object({
|
|
346
|
+
type: import_v43.z.literal("bash_code_execution_tool_result_error"),
|
|
347
|
+
error_code: import_v43.z.string()
|
|
274
348
|
})
|
|
275
349
|
])
|
|
276
350
|
}),
|
|
277
351
|
// text editor code execution results for code_execution_20250825 tool:
|
|
278
|
-
|
|
279
|
-
type:
|
|
280
|
-
tool_use_id:
|
|
281
|
-
content:
|
|
282
|
-
|
|
283
|
-
type:
|
|
284
|
-
error_code:
|
|
352
|
+
import_v43.z.object({
|
|
353
|
+
type: import_v43.z.literal("text_editor_code_execution_tool_result"),
|
|
354
|
+
tool_use_id: import_v43.z.string(),
|
|
355
|
+
content: import_v43.z.discriminatedUnion("type", [
|
|
356
|
+
import_v43.z.object({
|
|
357
|
+
type: import_v43.z.literal("text_editor_code_execution_tool_result_error"),
|
|
358
|
+
error_code: import_v43.z.string()
|
|
285
359
|
}),
|
|
286
|
-
|
|
287
|
-
type:
|
|
288
|
-
content:
|
|
289
|
-
file_type:
|
|
290
|
-
num_lines:
|
|
291
|
-
start_line:
|
|
292
|
-
total_lines:
|
|
360
|
+
import_v43.z.object({
|
|
361
|
+
type: import_v43.z.literal("text_editor_code_execution_view_result"),
|
|
362
|
+
content: import_v43.z.string(),
|
|
363
|
+
file_type: import_v43.z.string(),
|
|
364
|
+
num_lines: import_v43.z.number().nullable(),
|
|
365
|
+
start_line: import_v43.z.number().nullable(),
|
|
366
|
+
total_lines: import_v43.z.number().nullable()
|
|
293
367
|
}),
|
|
294
|
-
|
|
295
|
-
type:
|
|
296
|
-
is_file_update:
|
|
368
|
+
import_v43.z.object({
|
|
369
|
+
type: import_v43.z.literal("text_editor_code_execution_create_result"),
|
|
370
|
+
is_file_update: import_v43.z.boolean()
|
|
297
371
|
}),
|
|
298
|
-
|
|
299
|
-
type:
|
|
372
|
+
import_v43.z.object({
|
|
373
|
+
type: import_v43.z.literal(
|
|
300
374
|
"text_editor_code_execution_str_replace_result"
|
|
301
375
|
),
|
|
302
|
-
lines:
|
|
303
|
-
new_lines:
|
|
304
|
-
new_start:
|
|
305
|
-
old_lines:
|
|
306
|
-
old_start:
|
|
376
|
+
lines: import_v43.z.array(import_v43.z.string()).nullable(),
|
|
377
|
+
new_lines: import_v43.z.number().nullable(),
|
|
378
|
+
new_start: import_v43.z.number().nullable(),
|
|
379
|
+
old_lines: import_v43.z.number().nullable(),
|
|
380
|
+
old_start: import_v43.z.number().nullable()
|
|
307
381
|
})
|
|
308
382
|
])
|
|
309
383
|
}),
|
|
310
384
|
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
311
|
-
|
|
312
|
-
type:
|
|
313
|
-
tool_use_id:
|
|
314
|
-
content:
|
|
315
|
-
|
|
316
|
-
type:
|
|
317
|
-
tool_references:
|
|
318
|
-
|
|
319
|
-
type:
|
|
320
|
-
tool_name:
|
|
385
|
+
import_v43.z.object({
|
|
386
|
+
type: import_v43.z.literal("tool_search_tool_result"),
|
|
387
|
+
tool_use_id: import_v43.z.string(),
|
|
388
|
+
content: import_v43.z.union([
|
|
389
|
+
import_v43.z.object({
|
|
390
|
+
type: import_v43.z.literal("tool_search_tool_search_result"),
|
|
391
|
+
tool_references: import_v43.z.array(
|
|
392
|
+
import_v43.z.object({
|
|
393
|
+
type: import_v43.z.literal("tool_reference"),
|
|
394
|
+
tool_name: import_v43.z.string()
|
|
321
395
|
})
|
|
322
396
|
)
|
|
323
397
|
}),
|
|
324
|
-
|
|
325
|
-
type:
|
|
326
|
-
error_code:
|
|
398
|
+
import_v43.z.object({
|
|
399
|
+
type: import_v43.z.literal("tool_search_tool_result_error"),
|
|
400
|
+
error_code: import_v43.z.string()
|
|
327
401
|
})
|
|
328
402
|
])
|
|
329
403
|
})
|
|
330
404
|
])
|
|
331
405
|
),
|
|
332
|
-
stop_reason:
|
|
333
|
-
stop_sequence:
|
|
334
|
-
usage:
|
|
335
|
-
input_tokens:
|
|
336
|
-
output_tokens:
|
|
337
|
-
cache_creation_input_tokens:
|
|
338
|
-
cache_read_input_tokens:
|
|
339
|
-
iterations:
|
|
340
|
-
|
|
341
|
-
type:
|
|
342
|
-
input_tokens:
|
|
343
|
-
output_tokens:
|
|
406
|
+
stop_reason: import_v43.z.string().nullish(),
|
|
407
|
+
stop_sequence: import_v43.z.string().nullish(),
|
|
408
|
+
usage: import_v43.z.looseObject({
|
|
409
|
+
input_tokens: import_v43.z.number(),
|
|
410
|
+
output_tokens: import_v43.z.number(),
|
|
411
|
+
cache_creation_input_tokens: import_v43.z.number().nullish(),
|
|
412
|
+
cache_read_input_tokens: import_v43.z.number().nullish(),
|
|
413
|
+
iterations: import_v43.z.array(
|
|
414
|
+
import_v43.z.object({
|
|
415
|
+
type: import_v43.z.union([import_v43.z.literal("compaction"), import_v43.z.literal("message")]),
|
|
416
|
+
input_tokens: import_v43.z.number(),
|
|
417
|
+
output_tokens: import_v43.z.number()
|
|
344
418
|
})
|
|
345
419
|
).nullish()
|
|
346
420
|
}),
|
|
347
|
-
container:
|
|
348
|
-
expires_at:
|
|
349
|
-
id:
|
|
350
|
-
skills:
|
|
351
|
-
|
|
352
|
-
type:
|
|
353
|
-
skill_id:
|
|
354
|
-
version:
|
|
421
|
+
container: import_v43.z.object({
|
|
422
|
+
expires_at: import_v43.z.string(),
|
|
423
|
+
id: import_v43.z.string(),
|
|
424
|
+
skills: import_v43.z.array(
|
|
425
|
+
import_v43.z.object({
|
|
426
|
+
type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
|
|
427
|
+
skill_id: import_v43.z.string(),
|
|
428
|
+
version: import_v43.z.string()
|
|
355
429
|
})
|
|
356
430
|
).nullish()
|
|
357
431
|
}).nullish(),
|
|
358
|
-
context_management:
|
|
359
|
-
applied_edits:
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
type:
|
|
363
|
-
cleared_tool_uses:
|
|
364
|
-
cleared_input_tokens:
|
|
432
|
+
context_management: import_v43.z.object({
|
|
433
|
+
applied_edits: import_v43.z.array(
|
|
434
|
+
import_v43.z.union([
|
|
435
|
+
import_v43.z.object({
|
|
436
|
+
type: import_v43.z.literal("clear_tool_uses_20250919"),
|
|
437
|
+
cleared_tool_uses: import_v43.z.number(),
|
|
438
|
+
cleared_input_tokens: import_v43.z.number()
|
|
365
439
|
}),
|
|
366
|
-
|
|
367
|
-
type:
|
|
368
|
-
cleared_thinking_turns:
|
|
369
|
-
cleared_input_tokens:
|
|
440
|
+
import_v43.z.object({
|
|
441
|
+
type: import_v43.z.literal("clear_thinking_20251015"),
|
|
442
|
+
cleared_thinking_turns: import_v43.z.number(),
|
|
443
|
+
cleared_input_tokens: import_v43.z.number()
|
|
370
444
|
}),
|
|
371
|
-
|
|
372
|
-
type:
|
|
445
|
+
import_v43.z.object({
|
|
446
|
+
type: import_v43.z.literal("compact_20260112")
|
|
373
447
|
})
|
|
374
448
|
])
|
|
375
449
|
)
|
|
@@ -377,457 +451,457 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
377
451
|
})
|
|
378
452
|
)
|
|
379
453
|
);
|
|
380
|
-
var anthropicMessagesChunkSchema = (0,
|
|
381
|
-
() => (0,
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
type:
|
|
385
|
-
message:
|
|
386
|
-
id:
|
|
387
|
-
model:
|
|
388
|
-
role:
|
|
389
|
-
usage:
|
|
390
|
-
input_tokens:
|
|
391
|
-
cache_creation_input_tokens:
|
|
392
|
-
cache_read_input_tokens:
|
|
454
|
+
var anthropicMessagesChunkSchema = (0, import_provider_utils3.lazySchema)(
|
|
455
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
456
|
+
import_v43.z.discriminatedUnion("type", [
|
|
457
|
+
import_v43.z.object({
|
|
458
|
+
type: import_v43.z.literal("message_start"),
|
|
459
|
+
message: import_v43.z.object({
|
|
460
|
+
id: import_v43.z.string().nullish(),
|
|
461
|
+
model: import_v43.z.string().nullish(),
|
|
462
|
+
role: import_v43.z.string().nullish(),
|
|
463
|
+
usage: import_v43.z.looseObject({
|
|
464
|
+
input_tokens: import_v43.z.number(),
|
|
465
|
+
cache_creation_input_tokens: import_v43.z.number().nullish(),
|
|
466
|
+
cache_read_input_tokens: import_v43.z.number().nullish()
|
|
393
467
|
}),
|
|
394
468
|
// Programmatic tool calling: content may be pre-populated for deferred tool calls
|
|
395
|
-
content:
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
type:
|
|
399
|
-
id:
|
|
400
|
-
name:
|
|
401
|
-
input:
|
|
402
|
-
caller:
|
|
403
|
-
|
|
404
|
-
type:
|
|
405
|
-
tool_id:
|
|
469
|
+
content: import_v43.z.array(
|
|
470
|
+
import_v43.z.discriminatedUnion("type", [
|
|
471
|
+
import_v43.z.object({
|
|
472
|
+
type: import_v43.z.literal("tool_use"),
|
|
473
|
+
id: import_v43.z.string(),
|
|
474
|
+
name: import_v43.z.string(),
|
|
475
|
+
input: import_v43.z.unknown(),
|
|
476
|
+
caller: import_v43.z.union([
|
|
477
|
+
import_v43.z.object({
|
|
478
|
+
type: import_v43.z.literal("code_execution_20250825"),
|
|
479
|
+
tool_id: import_v43.z.string()
|
|
406
480
|
}),
|
|
407
|
-
|
|
408
|
-
type:
|
|
409
|
-
tool_id:
|
|
481
|
+
import_v43.z.object({
|
|
482
|
+
type: import_v43.z.literal("code_execution_20260120"),
|
|
483
|
+
tool_id: import_v43.z.string()
|
|
410
484
|
}),
|
|
411
|
-
|
|
412
|
-
type:
|
|
485
|
+
import_v43.z.object({
|
|
486
|
+
type: import_v43.z.literal("direct")
|
|
413
487
|
})
|
|
414
488
|
]).optional()
|
|
415
489
|
})
|
|
416
490
|
])
|
|
417
491
|
).nullish(),
|
|
418
|
-
stop_reason:
|
|
419
|
-
container:
|
|
420
|
-
expires_at:
|
|
421
|
-
id:
|
|
492
|
+
stop_reason: import_v43.z.string().nullish(),
|
|
493
|
+
container: import_v43.z.object({
|
|
494
|
+
expires_at: import_v43.z.string(),
|
|
495
|
+
id: import_v43.z.string()
|
|
422
496
|
}).nullish()
|
|
423
497
|
})
|
|
424
498
|
}),
|
|
425
|
-
|
|
426
|
-
type:
|
|
427
|
-
index:
|
|
428
|
-
content_block:
|
|
429
|
-
|
|
430
|
-
type:
|
|
431
|
-
text:
|
|
499
|
+
import_v43.z.object({
|
|
500
|
+
type: import_v43.z.literal("content_block_start"),
|
|
501
|
+
index: import_v43.z.number(),
|
|
502
|
+
content_block: import_v43.z.discriminatedUnion("type", [
|
|
503
|
+
import_v43.z.object({
|
|
504
|
+
type: import_v43.z.literal("text"),
|
|
505
|
+
text: import_v43.z.string()
|
|
432
506
|
}),
|
|
433
|
-
|
|
434
|
-
type:
|
|
435
|
-
thinking:
|
|
507
|
+
import_v43.z.object({
|
|
508
|
+
type: import_v43.z.literal("thinking"),
|
|
509
|
+
thinking: import_v43.z.string()
|
|
436
510
|
}),
|
|
437
|
-
|
|
438
|
-
type:
|
|
439
|
-
id:
|
|
440
|
-
name:
|
|
511
|
+
import_v43.z.object({
|
|
512
|
+
type: import_v43.z.literal("tool_use"),
|
|
513
|
+
id: import_v43.z.string(),
|
|
514
|
+
name: import_v43.z.string(),
|
|
441
515
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
442
|
-
input:
|
|
516
|
+
input: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).optional(),
|
|
443
517
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
444
|
-
caller:
|
|
445
|
-
|
|
446
|
-
type:
|
|
447
|
-
tool_id:
|
|
518
|
+
caller: import_v43.z.union([
|
|
519
|
+
import_v43.z.object({
|
|
520
|
+
type: import_v43.z.literal("code_execution_20250825"),
|
|
521
|
+
tool_id: import_v43.z.string()
|
|
448
522
|
}),
|
|
449
|
-
|
|
450
|
-
type:
|
|
451
|
-
tool_id:
|
|
523
|
+
import_v43.z.object({
|
|
524
|
+
type: import_v43.z.literal("code_execution_20260120"),
|
|
525
|
+
tool_id: import_v43.z.string()
|
|
452
526
|
}),
|
|
453
|
-
|
|
454
|
-
type:
|
|
527
|
+
import_v43.z.object({
|
|
528
|
+
type: import_v43.z.literal("direct")
|
|
455
529
|
})
|
|
456
530
|
]).optional()
|
|
457
531
|
}),
|
|
458
|
-
|
|
459
|
-
type:
|
|
460
|
-
data:
|
|
532
|
+
import_v43.z.object({
|
|
533
|
+
type: import_v43.z.literal("redacted_thinking"),
|
|
534
|
+
data: import_v43.z.string()
|
|
461
535
|
}),
|
|
462
|
-
|
|
463
|
-
type:
|
|
464
|
-
content:
|
|
536
|
+
import_v43.z.object({
|
|
537
|
+
type: import_v43.z.literal("compaction"),
|
|
538
|
+
content: import_v43.z.string().nullish()
|
|
465
539
|
}),
|
|
466
|
-
|
|
467
|
-
type:
|
|
468
|
-
id:
|
|
469
|
-
name:
|
|
470
|
-
input:
|
|
471
|
-
caller:
|
|
472
|
-
|
|
473
|
-
type:
|
|
474
|
-
tool_id:
|
|
540
|
+
import_v43.z.object({
|
|
541
|
+
type: import_v43.z.literal("server_tool_use"),
|
|
542
|
+
id: import_v43.z.string(),
|
|
543
|
+
name: import_v43.z.string(),
|
|
544
|
+
input: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish(),
|
|
545
|
+
caller: import_v43.z.union([
|
|
546
|
+
import_v43.z.object({
|
|
547
|
+
type: import_v43.z.literal("code_execution_20260120"),
|
|
548
|
+
tool_id: import_v43.z.string()
|
|
475
549
|
}),
|
|
476
|
-
|
|
477
|
-
type:
|
|
550
|
+
import_v43.z.object({
|
|
551
|
+
type: import_v43.z.literal("direct")
|
|
478
552
|
})
|
|
479
553
|
]).optional()
|
|
480
554
|
}),
|
|
481
|
-
|
|
482
|
-
type:
|
|
483
|
-
id:
|
|
484
|
-
name:
|
|
485
|
-
input:
|
|
486
|
-
server_name:
|
|
555
|
+
import_v43.z.object({
|
|
556
|
+
type: import_v43.z.literal("mcp_tool_use"),
|
|
557
|
+
id: import_v43.z.string(),
|
|
558
|
+
name: import_v43.z.string(),
|
|
559
|
+
input: import_v43.z.unknown(),
|
|
560
|
+
server_name: import_v43.z.string()
|
|
487
561
|
}),
|
|
488
|
-
|
|
489
|
-
type:
|
|
490
|
-
tool_use_id:
|
|
491
|
-
is_error:
|
|
492
|
-
content:
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
562
|
+
import_v43.z.object({
|
|
563
|
+
type: import_v43.z.literal("mcp_tool_result"),
|
|
564
|
+
tool_use_id: import_v43.z.string(),
|
|
565
|
+
is_error: import_v43.z.boolean(),
|
|
566
|
+
content: import_v43.z.array(
|
|
567
|
+
import_v43.z.union([
|
|
568
|
+
import_v43.z.string(),
|
|
569
|
+
import_v43.z.object({ type: import_v43.z.literal("text"), text: import_v43.z.string() })
|
|
496
570
|
])
|
|
497
571
|
)
|
|
498
572
|
}),
|
|
499
|
-
|
|
500
|
-
type:
|
|
501
|
-
tool_use_id:
|
|
502
|
-
content:
|
|
503
|
-
|
|
504
|
-
type:
|
|
505
|
-
url:
|
|
506
|
-
retrieved_at:
|
|
507
|
-
content:
|
|
508
|
-
type:
|
|
509
|
-
title:
|
|
510
|
-
citations:
|
|
511
|
-
source:
|
|
512
|
-
|
|
513
|
-
type:
|
|
514
|
-
media_type:
|
|
515
|
-
data:
|
|
573
|
+
import_v43.z.object({
|
|
574
|
+
type: import_v43.z.literal("web_fetch_tool_result"),
|
|
575
|
+
tool_use_id: import_v43.z.string(),
|
|
576
|
+
content: import_v43.z.union([
|
|
577
|
+
import_v43.z.object({
|
|
578
|
+
type: import_v43.z.literal("web_fetch_result"),
|
|
579
|
+
url: import_v43.z.string(),
|
|
580
|
+
retrieved_at: import_v43.z.string(),
|
|
581
|
+
content: import_v43.z.object({
|
|
582
|
+
type: import_v43.z.literal("document"),
|
|
583
|
+
title: import_v43.z.string().nullable(),
|
|
584
|
+
citations: import_v43.z.object({ enabled: import_v43.z.boolean() }).optional(),
|
|
585
|
+
source: import_v43.z.union([
|
|
586
|
+
import_v43.z.object({
|
|
587
|
+
type: import_v43.z.literal("base64"),
|
|
588
|
+
media_type: import_v43.z.literal("application/pdf"),
|
|
589
|
+
data: import_v43.z.string()
|
|
516
590
|
}),
|
|
517
|
-
|
|
518
|
-
type:
|
|
519
|
-
media_type:
|
|
520
|
-
data:
|
|
591
|
+
import_v43.z.object({
|
|
592
|
+
type: import_v43.z.literal("text"),
|
|
593
|
+
media_type: import_v43.z.literal("text/plain"),
|
|
594
|
+
data: import_v43.z.string()
|
|
521
595
|
})
|
|
522
596
|
])
|
|
523
597
|
})
|
|
524
598
|
}),
|
|
525
|
-
|
|
526
|
-
type:
|
|
527
|
-
error_code:
|
|
599
|
+
import_v43.z.object({
|
|
600
|
+
type: import_v43.z.literal("web_fetch_tool_result_error"),
|
|
601
|
+
error_code: import_v43.z.string()
|
|
528
602
|
})
|
|
529
603
|
])
|
|
530
604
|
}),
|
|
531
|
-
|
|
532
|
-
type:
|
|
533
|
-
tool_use_id:
|
|
534
|
-
content:
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
type:
|
|
538
|
-
url:
|
|
539
|
-
title:
|
|
540
|
-
encrypted_content:
|
|
541
|
-
page_age:
|
|
605
|
+
import_v43.z.object({
|
|
606
|
+
type: import_v43.z.literal("web_search_tool_result"),
|
|
607
|
+
tool_use_id: import_v43.z.string(),
|
|
608
|
+
content: import_v43.z.union([
|
|
609
|
+
import_v43.z.array(
|
|
610
|
+
import_v43.z.object({
|
|
611
|
+
type: import_v43.z.literal("web_search_result"),
|
|
612
|
+
url: import_v43.z.string(),
|
|
613
|
+
title: import_v43.z.string(),
|
|
614
|
+
encrypted_content: import_v43.z.string(),
|
|
615
|
+
page_age: import_v43.z.string().nullish()
|
|
542
616
|
})
|
|
543
617
|
),
|
|
544
|
-
|
|
545
|
-
type:
|
|
546
|
-
error_code:
|
|
618
|
+
import_v43.z.object({
|
|
619
|
+
type: import_v43.z.literal("web_search_tool_result_error"),
|
|
620
|
+
error_code: import_v43.z.string()
|
|
547
621
|
})
|
|
548
622
|
])
|
|
549
623
|
}),
|
|
550
624
|
// code execution results for code_execution_20250522 tool:
|
|
551
|
-
|
|
552
|
-
type:
|
|
553
|
-
tool_use_id:
|
|
554
|
-
content:
|
|
555
|
-
|
|
556
|
-
type:
|
|
557
|
-
stdout:
|
|
558
|
-
stderr:
|
|
559
|
-
return_code:
|
|
560
|
-
content:
|
|
561
|
-
|
|
562
|
-
type:
|
|
563
|
-
file_id:
|
|
625
|
+
import_v43.z.object({
|
|
626
|
+
type: import_v43.z.literal("code_execution_tool_result"),
|
|
627
|
+
tool_use_id: import_v43.z.string(),
|
|
628
|
+
content: import_v43.z.union([
|
|
629
|
+
import_v43.z.object({
|
|
630
|
+
type: import_v43.z.literal("code_execution_result"),
|
|
631
|
+
stdout: import_v43.z.string(),
|
|
632
|
+
stderr: import_v43.z.string(),
|
|
633
|
+
return_code: import_v43.z.number(),
|
|
634
|
+
content: import_v43.z.array(
|
|
635
|
+
import_v43.z.object({
|
|
636
|
+
type: import_v43.z.literal("code_execution_output"),
|
|
637
|
+
file_id: import_v43.z.string()
|
|
564
638
|
})
|
|
565
639
|
).optional().default([])
|
|
566
640
|
}),
|
|
567
|
-
|
|
568
|
-
type:
|
|
569
|
-
encrypted_stdout:
|
|
570
|
-
stderr:
|
|
571
|
-
return_code:
|
|
572
|
-
content:
|
|
573
|
-
|
|
574
|
-
type:
|
|
575
|
-
file_id:
|
|
641
|
+
import_v43.z.object({
|
|
642
|
+
type: import_v43.z.literal("encrypted_code_execution_result"),
|
|
643
|
+
encrypted_stdout: import_v43.z.string(),
|
|
644
|
+
stderr: import_v43.z.string(),
|
|
645
|
+
return_code: import_v43.z.number(),
|
|
646
|
+
content: import_v43.z.array(
|
|
647
|
+
import_v43.z.object({
|
|
648
|
+
type: import_v43.z.literal("code_execution_output"),
|
|
649
|
+
file_id: import_v43.z.string()
|
|
576
650
|
})
|
|
577
651
|
).optional().default([])
|
|
578
652
|
}),
|
|
579
|
-
|
|
580
|
-
type:
|
|
581
|
-
error_code:
|
|
653
|
+
import_v43.z.object({
|
|
654
|
+
type: import_v43.z.literal("code_execution_tool_result_error"),
|
|
655
|
+
error_code: import_v43.z.string()
|
|
582
656
|
})
|
|
583
657
|
])
|
|
584
658
|
}),
|
|
585
659
|
// bash code execution results for code_execution_20250825 tool:
|
|
586
|
-
|
|
587
|
-
type:
|
|
588
|
-
tool_use_id:
|
|
589
|
-
content:
|
|
590
|
-
|
|
591
|
-
type:
|
|
592
|
-
content:
|
|
593
|
-
|
|
594
|
-
type:
|
|
595
|
-
file_id:
|
|
660
|
+
import_v43.z.object({
|
|
661
|
+
type: import_v43.z.literal("bash_code_execution_tool_result"),
|
|
662
|
+
tool_use_id: import_v43.z.string(),
|
|
663
|
+
content: import_v43.z.discriminatedUnion("type", [
|
|
664
|
+
import_v43.z.object({
|
|
665
|
+
type: import_v43.z.literal("bash_code_execution_result"),
|
|
666
|
+
content: import_v43.z.array(
|
|
667
|
+
import_v43.z.object({
|
|
668
|
+
type: import_v43.z.literal("bash_code_execution_output"),
|
|
669
|
+
file_id: import_v43.z.string()
|
|
596
670
|
})
|
|
597
671
|
),
|
|
598
|
-
stdout:
|
|
599
|
-
stderr:
|
|
600
|
-
return_code:
|
|
672
|
+
stdout: import_v43.z.string(),
|
|
673
|
+
stderr: import_v43.z.string(),
|
|
674
|
+
return_code: import_v43.z.number()
|
|
601
675
|
}),
|
|
602
|
-
|
|
603
|
-
type:
|
|
604
|
-
error_code:
|
|
676
|
+
import_v43.z.object({
|
|
677
|
+
type: import_v43.z.literal("bash_code_execution_tool_result_error"),
|
|
678
|
+
error_code: import_v43.z.string()
|
|
605
679
|
})
|
|
606
680
|
])
|
|
607
681
|
}),
|
|
608
682
|
// text editor code execution results for code_execution_20250825 tool:
|
|
609
|
-
|
|
610
|
-
type:
|
|
611
|
-
tool_use_id:
|
|
612
|
-
content:
|
|
613
|
-
|
|
614
|
-
type:
|
|
615
|
-
error_code:
|
|
683
|
+
import_v43.z.object({
|
|
684
|
+
type: import_v43.z.literal("text_editor_code_execution_tool_result"),
|
|
685
|
+
tool_use_id: import_v43.z.string(),
|
|
686
|
+
content: import_v43.z.discriminatedUnion("type", [
|
|
687
|
+
import_v43.z.object({
|
|
688
|
+
type: import_v43.z.literal("text_editor_code_execution_tool_result_error"),
|
|
689
|
+
error_code: import_v43.z.string()
|
|
616
690
|
}),
|
|
617
|
-
|
|
618
|
-
type:
|
|
619
|
-
content:
|
|
620
|
-
file_type:
|
|
621
|
-
num_lines:
|
|
622
|
-
start_line:
|
|
623
|
-
total_lines:
|
|
691
|
+
import_v43.z.object({
|
|
692
|
+
type: import_v43.z.literal("text_editor_code_execution_view_result"),
|
|
693
|
+
content: import_v43.z.string(),
|
|
694
|
+
file_type: import_v43.z.string(),
|
|
695
|
+
num_lines: import_v43.z.number().nullable(),
|
|
696
|
+
start_line: import_v43.z.number().nullable(),
|
|
697
|
+
total_lines: import_v43.z.number().nullable()
|
|
624
698
|
}),
|
|
625
|
-
|
|
626
|
-
type:
|
|
627
|
-
is_file_update:
|
|
699
|
+
import_v43.z.object({
|
|
700
|
+
type: import_v43.z.literal("text_editor_code_execution_create_result"),
|
|
701
|
+
is_file_update: import_v43.z.boolean()
|
|
628
702
|
}),
|
|
629
|
-
|
|
630
|
-
type:
|
|
703
|
+
import_v43.z.object({
|
|
704
|
+
type: import_v43.z.literal(
|
|
631
705
|
"text_editor_code_execution_str_replace_result"
|
|
632
706
|
),
|
|
633
|
-
lines:
|
|
634
|
-
new_lines:
|
|
635
|
-
new_start:
|
|
636
|
-
old_lines:
|
|
637
|
-
old_start:
|
|
707
|
+
lines: import_v43.z.array(import_v43.z.string()).nullable(),
|
|
708
|
+
new_lines: import_v43.z.number().nullable(),
|
|
709
|
+
new_start: import_v43.z.number().nullable(),
|
|
710
|
+
old_lines: import_v43.z.number().nullable(),
|
|
711
|
+
old_start: import_v43.z.number().nullable()
|
|
638
712
|
})
|
|
639
713
|
])
|
|
640
714
|
}),
|
|
641
715
|
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
642
|
-
|
|
643
|
-
type:
|
|
644
|
-
tool_use_id:
|
|
645
|
-
content:
|
|
646
|
-
|
|
647
|
-
type:
|
|
648
|
-
tool_references:
|
|
649
|
-
|
|
650
|
-
type:
|
|
651
|
-
tool_name:
|
|
716
|
+
import_v43.z.object({
|
|
717
|
+
type: import_v43.z.literal("tool_search_tool_result"),
|
|
718
|
+
tool_use_id: import_v43.z.string(),
|
|
719
|
+
content: import_v43.z.union([
|
|
720
|
+
import_v43.z.object({
|
|
721
|
+
type: import_v43.z.literal("tool_search_tool_search_result"),
|
|
722
|
+
tool_references: import_v43.z.array(
|
|
723
|
+
import_v43.z.object({
|
|
724
|
+
type: import_v43.z.literal("tool_reference"),
|
|
725
|
+
tool_name: import_v43.z.string()
|
|
652
726
|
})
|
|
653
727
|
)
|
|
654
728
|
}),
|
|
655
|
-
|
|
656
|
-
type:
|
|
657
|
-
error_code:
|
|
729
|
+
import_v43.z.object({
|
|
730
|
+
type: import_v43.z.literal("tool_search_tool_result_error"),
|
|
731
|
+
error_code: import_v43.z.string()
|
|
658
732
|
})
|
|
659
733
|
])
|
|
660
734
|
})
|
|
661
735
|
])
|
|
662
736
|
}),
|
|
663
|
-
|
|
664
|
-
type:
|
|
665
|
-
index:
|
|
666
|
-
delta:
|
|
667
|
-
|
|
668
|
-
type:
|
|
669
|
-
partial_json:
|
|
737
|
+
import_v43.z.object({
|
|
738
|
+
type: import_v43.z.literal("content_block_delta"),
|
|
739
|
+
index: import_v43.z.number(),
|
|
740
|
+
delta: import_v43.z.discriminatedUnion("type", [
|
|
741
|
+
import_v43.z.object({
|
|
742
|
+
type: import_v43.z.literal("input_json_delta"),
|
|
743
|
+
partial_json: import_v43.z.string()
|
|
670
744
|
}),
|
|
671
|
-
|
|
672
|
-
type:
|
|
673
|
-
text:
|
|
745
|
+
import_v43.z.object({
|
|
746
|
+
type: import_v43.z.literal("text_delta"),
|
|
747
|
+
text: import_v43.z.string()
|
|
674
748
|
}),
|
|
675
|
-
|
|
676
|
-
type:
|
|
677
|
-
thinking:
|
|
749
|
+
import_v43.z.object({
|
|
750
|
+
type: import_v43.z.literal("thinking_delta"),
|
|
751
|
+
thinking: import_v43.z.string()
|
|
678
752
|
}),
|
|
679
|
-
|
|
680
|
-
type:
|
|
681
|
-
signature:
|
|
753
|
+
import_v43.z.object({
|
|
754
|
+
type: import_v43.z.literal("signature_delta"),
|
|
755
|
+
signature: import_v43.z.string()
|
|
682
756
|
}),
|
|
683
|
-
|
|
684
|
-
type:
|
|
685
|
-
content:
|
|
757
|
+
import_v43.z.object({
|
|
758
|
+
type: import_v43.z.literal("compaction_delta"),
|
|
759
|
+
content: import_v43.z.string().nullish()
|
|
686
760
|
}),
|
|
687
|
-
|
|
688
|
-
type:
|
|
689
|
-
citation:
|
|
690
|
-
|
|
691
|
-
type:
|
|
692
|
-
cited_text:
|
|
693
|
-
url:
|
|
694
|
-
title:
|
|
695
|
-
encrypted_index:
|
|
761
|
+
import_v43.z.object({
|
|
762
|
+
type: import_v43.z.literal("citations_delta"),
|
|
763
|
+
citation: import_v43.z.discriminatedUnion("type", [
|
|
764
|
+
import_v43.z.object({
|
|
765
|
+
type: import_v43.z.literal("web_search_result_location"),
|
|
766
|
+
cited_text: import_v43.z.string(),
|
|
767
|
+
url: import_v43.z.string(),
|
|
768
|
+
title: import_v43.z.string(),
|
|
769
|
+
encrypted_index: import_v43.z.string()
|
|
696
770
|
}),
|
|
697
|
-
|
|
698
|
-
type:
|
|
699
|
-
cited_text:
|
|
700
|
-
document_index:
|
|
701
|
-
document_title:
|
|
702
|
-
start_page_number:
|
|
703
|
-
end_page_number:
|
|
771
|
+
import_v43.z.object({
|
|
772
|
+
type: import_v43.z.literal("page_location"),
|
|
773
|
+
cited_text: import_v43.z.string(),
|
|
774
|
+
document_index: import_v43.z.number(),
|
|
775
|
+
document_title: import_v43.z.string().nullable(),
|
|
776
|
+
start_page_number: import_v43.z.number(),
|
|
777
|
+
end_page_number: import_v43.z.number()
|
|
704
778
|
}),
|
|
705
|
-
|
|
706
|
-
type:
|
|
707
|
-
cited_text:
|
|
708
|
-
document_index:
|
|
709
|
-
document_title:
|
|
710
|
-
start_char_index:
|
|
711
|
-
end_char_index:
|
|
779
|
+
import_v43.z.object({
|
|
780
|
+
type: import_v43.z.literal("char_location"),
|
|
781
|
+
cited_text: import_v43.z.string(),
|
|
782
|
+
document_index: import_v43.z.number(),
|
|
783
|
+
document_title: import_v43.z.string().nullable(),
|
|
784
|
+
start_char_index: import_v43.z.number(),
|
|
785
|
+
end_char_index: import_v43.z.number()
|
|
712
786
|
})
|
|
713
787
|
])
|
|
714
788
|
})
|
|
715
789
|
])
|
|
716
790
|
}),
|
|
717
|
-
|
|
718
|
-
type:
|
|
719
|
-
index:
|
|
791
|
+
import_v43.z.object({
|
|
792
|
+
type: import_v43.z.literal("content_block_stop"),
|
|
793
|
+
index: import_v43.z.number()
|
|
720
794
|
}),
|
|
721
|
-
|
|
722
|
-
type:
|
|
723
|
-
error:
|
|
724
|
-
type:
|
|
725
|
-
message:
|
|
795
|
+
import_v43.z.object({
|
|
796
|
+
type: import_v43.z.literal("error"),
|
|
797
|
+
error: import_v43.z.object({
|
|
798
|
+
type: import_v43.z.string(),
|
|
799
|
+
message: import_v43.z.string()
|
|
726
800
|
})
|
|
727
801
|
}),
|
|
728
|
-
|
|
729
|
-
type:
|
|
730
|
-
delta:
|
|
731
|
-
stop_reason:
|
|
732
|
-
stop_sequence:
|
|
733
|
-
container:
|
|
734
|
-
expires_at:
|
|
735
|
-
id:
|
|
736
|
-
skills:
|
|
737
|
-
|
|
738
|
-
type:
|
|
739
|
-
|
|
740
|
-
|
|
802
|
+
import_v43.z.object({
|
|
803
|
+
type: import_v43.z.literal("message_delta"),
|
|
804
|
+
delta: import_v43.z.object({
|
|
805
|
+
stop_reason: import_v43.z.string().nullish(),
|
|
806
|
+
stop_sequence: import_v43.z.string().nullish(),
|
|
807
|
+
container: import_v43.z.object({
|
|
808
|
+
expires_at: import_v43.z.string(),
|
|
809
|
+
id: import_v43.z.string(),
|
|
810
|
+
skills: import_v43.z.array(
|
|
811
|
+
import_v43.z.object({
|
|
812
|
+
type: import_v43.z.union([
|
|
813
|
+
import_v43.z.literal("anthropic"),
|
|
814
|
+
import_v43.z.literal("custom")
|
|
741
815
|
]),
|
|
742
|
-
skill_id:
|
|
743
|
-
version:
|
|
816
|
+
skill_id: import_v43.z.string(),
|
|
817
|
+
version: import_v43.z.string()
|
|
744
818
|
})
|
|
745
819
|
).nullish()
|
|
746
820
|
}).nullish()
|
|
747
821
|
}),
|
|
748
|
-
usage:
|
|
749
|
-
input_tokens:
|
|
750
|
-
output_tokens:
|
|
751
|
-
cache_creation_input_tokens:
|
|
752
|
-
cache_read_input_tokens:
|
|
753
|
-
iterations:
|
|
754
|
-
|
|
755
|
-
type:
|
|
756
|
-
input_tokens:
|
|
757
|
-
output_tokens:
|
|
822
|
+
usage: import_v43.z.looseObject({
|
|
823
|
+
input_tokens: import_v43.z.number().nullish(),
|
|
824
|
+
output_tokens: import_v43.z.number(),
|
|
825
|
+
cache_creation_input_tokens: import_v43.z.number().nullish(),
|
|
826
|
+
cache_read_input_tokens: import_v43.z.number().nullish(),
|
|
827
|
+
iterations: import_v43.z.array(
|
|
828
|
+
import_v43.z.object({
|
|
829
|
+
type: import_v43.z.union([import_v43.z.literal("compaction"), import_v43.z.literal("message")]),
|
|
830
|
+
input_tokens: import_v43.z.number(),
|
|
831
|
+
output_tokens: import_v43.z.number()
|
|
758
832
|
})
|
|
759
833
|
).nullish()
|
|
760
834
|
}),
|
|
761
|
-
context_management:
|
|
762
|
-
applied_edits:
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
type:
|
|
766
|
-
cleared_tool_uses:
|
|
767
|
-
cleared_input_tokens:
|
|
835
|
+
context_management: import_v43.z.object({
|
|
836
|
+
applied_edits: import_v43.z.array(
|
|
837
|
+
import_v43.z.union([
|
|
838
|
+
import_v43.z.object({
|
|
839
|
+
type: import_v43.z.literal("clear_tool_uses_20250919"),
|
|
840
|
+
cleared_tool_uses: import_v43.z.number(),
|
|
841
|
+
cleared_input_tokens: import_v43.z.number()
|
|
768
842
|
}),
|
|
769
|
-
|
|
770
|
-
type:
|
|
771
|
-
cleared_thinking_turns:
|
|
772
|
-
cleared_input_tokens:
|
|
843
|
+
import_v43.z.object({
|
|
844
|
+
type: import_v43.z.literal("clear_thinking_20251015"),
|
|
845
|
+
cleared_thinking_turns: import_v43.z.number(),
|
|
846
|
+
cleared_input_tokens: import_v43.z.number()
|
|
773
847
|
}),
|
|
774
|
-
|
|
775
|
-
type:
|
|
848
|
+
import_v43.z.object({
|
|
849
|
+
type: import_v43.z.literal("compact_20260112")
|
|
776
850
|
})
|
|
777
851
|
])
|
|
778
852
|
)
|
|
779
853
|
}).nullish()
|
|
780
854
|
}),
|
|
781
|
-
|
|
782
|
-
type:
|
|
855
|
+
import_v43.z.object({
|
|
856
|
+
type: import_v43.z.literal("message_stop")
|
|
783
857
|
}),
|
|
784
|
-
|
|
785
|
-
type:
|
|
858
|
+
import_v43.z.object({
|
|
859
|
+
type: import_v43.z.literal("ping")
|
|
786
860
|
})
|
|
787
861
|
])
|
|
788
862
|
)
|
|
789
863
|
);
|
|
790
|
-
var anthropicReasoningMetadataSchema = (0,
|
|
791
|
-
() => (0,
|
|
792
|
-
|
|
793
|
-
signature:
|
|
794
|
-
redactedData:
|
|
864
|
+
var anthropicReasoningMetadataSchema = (0, import_provider_utils3.lazySchema)(
|
|
865
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
866
|
+
import_v43.z.object({
|
|
867
|
+
signature: import_v43.z.string().optional(),
|
|
868
|
+
redactedData: import_v43.z.string().optional()
|
|
795
869
|
})
|
|
796
870
|
)
|
|
797
871
|
);
|
|
798
872
|
|
|
799
873
|
// src/anthropic-messages-options.ts
|
|
800
|
-
var
|
|
801
|
-
var anthropicFilePartProviderOptions =
|
|
874
|
+
var import_v44 = require("zod/v4");
|
|
875
|
+
var anthropicFilePartProviderOptions = import_v44.z.object({
|
|
802
876
|
/**
|
|
803
877
|
* Citation configuration for this document.
|
|
804
878
|
* When enabled, this document will generate citations in the response.
|
|
805
879
|
*/
|
|
806
|
-
citations:
|
|
880
|
+
citations: import_v44.z.object({
|
|
807
881
|
/**
|
|
808
882
|
* Enable citations for this document
|
|
809
883
|
*/
|
|
810
|
-
enabled:
|
|
884
|
+
enabled: import_v44.z.boolean()
|
|
811
885
|
}).optional(),
|
|
812
886
|
/**
|
|
813
887
|
* Custom title for the document.
|
|
814
888
|
* If not provided, the filename will be used.
|
|
815
889
|
*/
|
|
816
|
-
title:
|
|
890
|
+
title: import_v44.z.string().optional(),
|
|
817
891
|
/**
|
|
818
892
|
* Context about the document that will be passed to the model
|
|
819
893
|
* but not used towards cited content.
|
|
820
894
|
* Useful for storing document metadata as text or stringified JSON.
|
|
821
895
|
*/
|
|
822
|
-
context:
|
|
896
|
+
context: import_v44.z.string().optional()
|
|
823
897
|
});
|
|
824
|
-
var anthropicLanguageModelOptions =
|
|
898
|
+
var anthropicLanguageModelOptions = import_v44.z.object({
|
|
825
899
|
/**
|
|
826
900
|
* Whether to send reasoning to the model.
|
|
827
901
|
*
|
|
828
902
|
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
829
903
|
*/
|
|
830
|
-
sendReasoning:
|
|
904
|
+
sendReasoning: import_v44.z.boolean().optional(),
|
|
831
905
|
/**
|
|
832
906
|
* Determines how structured outputs are generated.
|
|
833
907
|
*
|
|
@@ -835,66 +909,66 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
835
909
|
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
836
910
|
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
837
911
|
*/
|
|
838
|
-
structuredOutputMode:
|
|
912
|
+
structuredOutputMode: import_v44.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
839
913
|
/**
|
|
840
914
|
* Configuration for enabling Claude's extended thinking.
|
|
841
915
|
*
|
|
842
916
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
843
917
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
844
918
|
*/
|
|
845
|
-
thinking:
|
|
846
|
-
|
|
919
|
+
thinking: import_v44.z.discriminatedUnion("type", [
|
|
920
|
+
import_v44.z.object({
|
|
847
921
|
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
848
|
-
type:
|
|
922
|
+
type: import_v44.z.literal("adaptive")
|
|
849
923
|
}),
|
|
850
|
-
|
|
924
|
+
import_v44.z.object({
|
|
851
925
|
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
852
|
-
type:
|
|
853
|
-
budgetTokens:
|
|
926
|
+
type: import_v44.z.literal("enabled"),
|
|
927
|
+
budgetTokens: import_v44.z.number().optional()
|
|
854
928
|
}),
|
|
855
|
-
|
|
856
|
-
type:
|
|
929
|
+
import_v44.z.object({
|
|
930
|
+
type: import_v44.z.literal("disabled")
|
|
857
931
|
})
|
|
858
932
|
]).optional(),
|
|
859
933
|
/**
|
|
860
934
|
* Whether to disable parallel function calling during tool use. Default is false.
|
|
861
935
|
* When set to true, Claude will use at most one tool per response.
|
|
862
936
|
*/
|
|
863
|
-
disableParallelToolUse:
|
|
937
|
+
disableParallelToolUse: import_v44.z.boolean().optional(),
|
|
864
938
|
/**
|
|
865
939
|
* Cache control settings for this message.
|
|
866
940
|
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
867
941
|
*/
|
|
868
|
-
cacheControl:
|
|
869
|
-
type:
|
|
870
|
-
ttl:
|
|
942
|
+
cacheControl: import_v44.z.object({
|
|
943
|
+
type: import_v44.z.literal("ephemeral"),
|
|
944
|
+
ttl: import_v44.z.union([import_v44.z.literal("5m"), import_v44.z.literal("1h")]).optional()
|
|
871
945
|
}).optional(),
|
|
872
946
|
/**
|
|
873
947
|
* Metadata to include with the request.
|
|
874
948
|
*
|
|
875
949
|
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
876
950
|
*/
|
|
877
|
-
metadata:
|
|
951
|
+
metadata: import_v44.z.object({
|
|
878
952
|
/**
|
|
879
953
|
* An external identifier for the user associated with the request.
|
|
880
954
|
*
|
|
881
955
|
* Should be a UUID, hash value, or other opaque identifier.
|
|
882
956
|
* Must not contain PII (name, email, phone number, etc.).
|
|
883
957
|
*/
|
|
884
|
-
userId:
|
|
958
|
+
userId: import_v44.z.string().optional()
|
|
885
959
|
}).optional(),
|
|
886
960
|
/**
|
|
887
961
|
* MCP servers to be utilized in this request.
|
|
888
962
|
*/
|
|
889
|
-
mcpServers:
|
|
890
|
-
|
|
891
|
-
type:
|
|
892
|
-
name:
|
|
893
|
-
url:
|
|
894
|
-
authorizationToken:
|
|
895
|
-
toolConfiguration:
|
|
896
|
-
enabled:
|
|
897
|
-
allowedTools:
|
|
963
|
+
mcpServers: import_v44.z.array(
|
|
964
|
+
import_v44.z.object({
|
|
965
|
+
type: import_v44.z.literal("url"),
|
|
966
|
+
name: import_v44.z.string(),
|
|
967
|
+
url: import_v44.z.string(),
|
|
968
|
+
authorizationToken: import_v44.z.string().nullish(),
|
|
969
|
+
toolConfiguration: import_v44.z.object({
|
|
970
|
+
enabled: import_v44.z.boolean().nullish(),
|
|
971
|
+
allowedTools: import_v44.z.array(import_v44.z.string()).nullish()
|
|
898
972
|
}).nullish()
|
|
899
973
|
})
|
|
900
974
|
).optional(),
|
|
@@ -903,13 +977,13 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
903
977
|
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
904
978
|
* Requires code execution tool to be enabled.
|
|
905
979
|
*/
|
|
906
|
-
container:
|
|
907
|
-
id:
|
|
908
|
-
skills:
|
|
909
|
-
|
|
910
|
-
type:
|
|
911
|
-
skillId:
|
|
912
|
-
version:
|
|
980
|
+
container: import_v44.z.object({
|
|
981
|
+
id: import_v44.z.string().optional(),
|
|
982
|
+
skills: import_v44.z.array(
|
|
983
|
+
import_v44.z.object({
|
|
984
|
+
type: import_v44.z.union([import_v44.z.literal("anthropic"), import_v44.z.literal("custom")]),
|
|
985
|
+
skillId: import_v44.z.string(),
|
|
986
|
+
version: import_v44.z.string().optional()
|
|
913
987
|
})
|
|
914
988
|
).optional()
|
|
915
989
|
}).optional(),
|
|
@@ -921,65 +995,65 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
921
995
|
*
|
|
922
996
|
* @default true
|
|
923
997
|
*/
|
|
924
|
-
toolStreaming:
|
|
998
|
+
toolStreaming: import_v44.z.boolean().optional(),
|
|
925
999
|
/**
|
|
926
1000
|
* @default 'high'
|
|
927
1001
|
*/
|
|
928
|
-
effort:
|
|
1002
|
+
effort: import_v44.z.enum(["low", "medium", "high", "max"]).optional(),
|
|
929
1003
|
/**
|
|
930
1004
|
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
931
1005
|
* Only supported with claude-opus-4-6.
|
|
932
1006
|
*/
|
|
933
|
-
speed:
|
|
1007
|
+
speed: import_v44.z.enum(["fast", "standard"]).optional(),
|
|
934
1008
|
/**
|
|
935
1009
|
* A set of beta features to enable.
|
|
936
1010
|
* Allow a provider to receive the full `betas` set if it needs it.
|
|
937
1011
|
*/
|
|
938
|
-
anthropicBeta:
|
|
939
|
-
contextManagement:
|
|
940
|
-
edits:
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
type:
|
|
944
|
-
trigger:
|
|
945
|
-
|
|
946
|
-
type:
|
|
947
|
-
value:
|
|
1012
|
+
anthropicBeta: import_v44.z.array(import_v44.z.string()).optional(),
|
|
1013
|
+
contextManagement: import_v44.z.object({
|
|
1014
|
+
edits: import_v44.z.array(
|
|
1015
|
+
import_v44.z.discriminatedUnion("type", [
|
|
1016
|
+
import_v44.z.object({
|
|
1017
|
+
type: import_v44.z.literal("clear_tool_uses_20250919"),
|
|
1018
|
+
trigger: import_v44.z.discriminatedUnion("type", [
|
|
1019
|
+
import_v44.z.object({
|
|
1020
|
+
type: import_v44.z.literal("input_tokens"),
|
|
1021
|
+
value: import_v44.z.number()
|
|
948
1022
|
}),
|
|
949
|
-
|
|
950
|
-
type:
|
|
951
|
-
value:
|
|
1023
|
+
import_v44.z.object({
|
|
1024
|
+
type: import_v44.z.literal("tool_uses"),
|
|
1025
|
+
value: import_v44.z.number()
|
|
952
1026
|
})
|
|
953
1027
|
]).optional(),
|
|
954
|
-
keep:
|
|
955
|
-
type:
|
|
956
|
-
value:
|
|
1028
|
+
keep: import_v44.z.object({
|
|
1029
|
+
type: import_v44.z.literal("tool_uses"),
|
|
1030
|
+
value: import_v44.z.number()
|
|
957
1031
|
}).optional(),
|
|
958
|
-
clearAtLeast:
|
|
959
|
-
type:
|
|
960
|
-
value:
|
|
1032
|
+
clearAtLeast: import_v44.z.object({
|
|
1033
|
+
type: import_v44.z.literal("input_tokens"),
|
|
1034
|
+
value: import_v44.z.number()
|
|
961
1035
|
}).optional(),
|
|
962
|
-
clearToolInputs:
|
|
963
|
-
excludeTools:
|
|
1036
|
+
clearToolInputs: import_v44.z.boolean().optional(),
|
|
1037
|
+
excludeTools: import_v44.z.array(import_v44.z.string()).optional()
|
|
964
1038
|
}),
|
|
965
|
-
|
|
966
|
-
type:
|
|
967
|
-
keep:
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
type:
|
|
971
|
-
value:
|
|
1039
|
+
import_v44.z.object({
|
|
1040
|
+
type: import_v44.z.literal("clear_thinking_20251015"),
|
|
1041
|
+
keep: import_v44.z.union([
|
|
1042
|
+
import_v44.z.literal("all"),
|
|
1043
|
+
import_v44.z.object({
|
|
1044
|
+
type: import_v44.z.literal("thinking_turns"),
|
|
1045
|
+
value: import_v44.z.number()
|
|
972
1046
|
})
|
|
973
1047
|
]).optional()
|
|
974
1048
|
}),
|
|
975
|
-
|
|
976
|
-
type:
|
|
977
|
-
trigger:
|
|
978
|
-
type:
|
|
979
|
-
value:
|
|
1049
|
+
import_v44.z.object({
|
|
1050
|
+
type: import_v44.z.literal("compact_20260112"),
|
|
1051
|
+
trigger: import_v44.z.object({
|
|
1052
|
+
type: import_v44.z.literal("input_tokens"),
|
|
1053
|
+
value: import_v44.z.number()
|
|
980
1054
|
}).optional(),
|
|
981
|
-
pauseAfterCompaction:
|
|
982
|
-
instructions:
|
|
1055
|
+
pauseAfterCompaction: import_v44.z.boolean().optional(),
|
|
1056
|
+
instructions: import_v44.z.string().optional()
|
|
983
1057
|
})
|
|
984
1058
|
])
|
|
985
1059
|
)
|
|
@@ -1032,91 +1106,42 @@ var CacheControlValidator = class {
|
|
|
1032
1106
|
};
|
|
1033
1107
|
|
|
1034
1108
|
// src/tool/text-editor_20250728.ts
|
|
1035
|
-
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
1036
|
-
var import_v44 = require("zod/v4");
|
|
1037
1109
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1038
|
-
var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
1039
|
-
() => (0, import_provider_utils4.zodSchema)(
|
|
1040
|
-
import_v44.z.object({
|
|
1041
|
-
maxCharacters: import_v44.z.number().optional()
|
|
1042
|
-
})
|
|
1043
|
-
)
|
|
1044
|
-
);
|
|
1045
|
-
var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1046
|
-
() => (0, import_provider_utils4.zodSchema)(
|
|
1047
|
-
import_v44.z.object({
|
|
1048
|
-
command: import_v44.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1049
|
-
path: import_v44.z.string(),
|
|
1050
|
-
file_text: import_v44.z.string().optional(),
|
|
1051
|
-
insert_line: import_v44.z.number().int().optional(),
|
|
1052
|
-
new_str: import_v44.z.string().optional(),
|
|
1053
|
-
insert_text: import_v44.z.string().optional(),
|
|
1054
|
-
old_str: import_v44.z.string().optional(),
|
|
1055
|
-
view_range: import_v44.z.array(import_v44.z.number().int()).optional()
|
|
1056
|
-
})
|
|
1057
|
-
)
|
|
1058
|
-
);
|
|
1059
|
-
var factory = (0, import_provider_utils3.createProviderToolFactory)({
|
|
1060
|
-
id: "anthropic.text_editor_20250728",
|
|
1061
|
-
inputSchema: textEditor_20250728InputSchema
|
|
1062
|
-
});
|
|
1063
|
-
var textEditor_20250728 = (args = {}) => {
|
|
1064
|
-
return factory(args);
|
|
1065
|
-
};
|
|
1066
|
-
|
|
1067
|
-
// src/tool/web-search_20260209.ts
|
|
1068
|
-
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1069
1110
|
var import_v45 = require("zod/v4");
|
|
1070
|
-
var
|
|
1111
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1112
|
+
var textEditor_20250728ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1071
1113
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1072
1114
|
import_v45.z.object({
|
|
1073
|
-
|
|
1074
|
-
allowedDomains: import_v45.z.array(import_v45.z.string()).optional(),
|
|
1075
|
-
blockedDomains: import_v45.z.array(import_v45.z.string()).optional(),
|
|
1076
|
-
userLocation: import_v45.z.object({
|
|
1077
|
-
type: import_v45.z.literal("approximate"),
|
|
1078
|
-
city: import_v45.z.string().optional(),
|
|
1079
|
-
region: import_v45.z.string().optional(),
|
|
1080
|
-
country: import_v45.z.string().optional(),
|
|
1081
|
-
timezone: import_v45.z.string().optional()
|
|
1082
|
-
}).optional()
|
|
1115
|
+
maxCharacters: import_v45.z.number().optional()
|
|
1083
1116
|
})
|
|
1084
1117
|
)
|
|
1085
1118
|
);
|
|
1086
|
-
var
|
|
1087
|
-
() => (0, import_provider_utils5.zodSchema)(
|
|
1088
|
-
import_v45.z.array(
|
|
1089
|
-
import_v45.z.object({
|
|
1090
|
-
url: import_v45.z.string(),
|
|
1091
|
-
title: import_v45.z.string().nullable(),
|
|
1092
|
-
pageAge: import_v45.z.string().nullable(),
|
|
1093
|
-
encryptedContent: import_v45.z.string(),
|
|
1094
|
-
type: import_v45.z.literal("web_search_result")
|
|
1095
|
-
})
|
|
1096
|
-
)
|
|
1097
|
-
)
|
|
1098
|
-
);
|
|
1099
|
-
var webSearch_20260209InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1119
|
+
var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1100
1120
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1101
1121
|
import_v45.z.object({
|
|
1102
|
-
|
|
1122
|
+
command: import_v45.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1123
|
+
path: import_v45.z.string(),
|
|
1124
|
+
file_text: import_v45.z.string().optional(),
|
|
1125
|
+
insert_line: import_v45.z.number().int().optional(),
|
|
1126
|
+
new_str: import_v45.z.string().optional(),
|
|
1127
|
+
insert_text: import_v45.z.string().optional(),
|
|
1128
|
+
old_str: import_v45.z.string().optional(),
|
|
1129
|
+
view_range: import_v45.z.array(import_v45.z.number().int()).optional()
|
|
1103
1130
|
})
|
|
1104
1131
|
)
|
|
1105
1132
|
);
|
|
1106
|
-
var
|
|
1107
|
-
id: "anthropic.
|
|
1108
|
-
inputSchema:
|
|
1109
|
-
outputSchema: webSearch_20260209OutputSchema,
|
|
1110
|
-
supportsDeferredResults: true
|
|
1133
|
+
var factory = (0, import_provider_utils4.createProviderToolFactory)({
|
|
1134
|
+
id: "anthropic.text_editor_20250728",
|
|
1135
|
+
inputSchema: textEditor_20250728InputSchema
|
|
1111
1136
|
});
|
|
1112
|
-
var
|
|
1113
|
-
return
|
|
1137
|
+
var textEditor_20250728 = (args = {}) => {
|
|
1138
|
+
return factory(args);
|
|
1114
1139
|
};
|
|
1115
1140
|
|
|
1116
|
-
// src/tool/web-
|
|
1141
|
+
// src/tool/web-search_20260209.ts
|
|
1117
1142
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1118
1143
|
var import_v46 = require("zod/v4");
|
|
1119
|
-
var
|
|
1144
|
+
var webSearch_20260209ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1120
1145
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1121
1146
|
import_v46.z.object({
|
|
1122
1147
|
maxUses: import_v46.z.number().optional(),
|
|
@@ -1132,7 +1157,7 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1132
1157
|
})
|
|
1133
1158
|
)
|
|
1134
1159
|
);
|
|
1135
|
-
var
|
|
1160
|
+
var webSearch_20260209OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1136
1161
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1137
1162
|
import_v46.z.array(
|
|
1138
1163
|
import_v46.z.object({
|
|
@@ -1145,84 +1170,76 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1145
1170
|
)
|
|
1146
1171
|
)
|
|
1147
1172
|
);
|
|
1148
|
-
var
|
|
1173
|
+
var webSearch_20260209InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1149
1174
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1150
1175
|
import_v46.z.object({
|
|
1151
1176
|
query: import_v46.z.string()
|
|
1152
1177
|
})
|
|
1153
1178
|
)
|
|
1154
1179
|
);
|
|
1155
|
-
var
|
|
1156
|
-
id: "anthropic.
|
|
1157
|
-
inputSchema:
|
|
1158
|
-
outputSchema:
|
|
1180
|
+
var factory2 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
|
|
1181
|
+
id: "anthropic.web_search_20260209",
|
|
1182
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1183
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1159
1184
|
supportsDeferredResults: true
|
|
1160
1185
|
});
|
|
1161
|
-
var
|
|
1162
|
-
return
|
|
1186
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1187
|
+
return factory2(args);
|
|
1163
1188
|
};
|
|
1164
1189
|
|
|
1165
|
-
// src/tool/web-
|
|
1190
|
+
// src/tool/web-search_20250305.ts
|
|
1166
1191
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1167
1192
|
var import_v47 = require("zod/v4");
|
|
1168
|
-
var
|
|
1193
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1169
1194
|
() => (0, import_provider_utils7.zodSchema)(
|
|
1170
1195
|
import_v47.z.object({
|
|
1171
1196
|
maxUses: import_v47.z.number().optional(),
|
|
1172
1197
|
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1173
1198
|
blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1174
|
-
|
|
1175
|
-
|
|
1199
|
+
userLocation: import_v47.z.object({
|
|
1200
|
+
type: import_v47.z.literal("approximate"),
|
|
1201
|
+
city: import_v47.z.string().optional(),
|
|
1202
|
+
region: import_v47.z.string().optional(),
|
|
1203
|
+
country: import_v47.z.string().optional(),
|
|
1204
|
+
timezone: import_v47.z.string().optional()
|
|
1205
|
+
}).optional()
|
|
1176
1206
|
})
|
|
1177
1207
|
)
|
|
1178
1208
|
);
|
|
1179
|
-
var
|
|
1209
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1180
1210
|
() => (0, import_provider_utils7.zodSchema)(
|
|
1181
|
-
import_v47.z.
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
content: import_v47.z.object({
|
|
1185
|
-
type: import_v47.z.literal("document"),
|
|
1211
|
+
import_v47.z.array(
|
|
1212
|
+
import_v47.z.object({
|
|
1213
|
+
url: import_v47.z.string(),
|
|
1186
1214
|
title: import_v47.z.string().nullable(),
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
data: import_v47.z.string()
|
|
1193
|
-
}),
|
|
1194
|
-
import_v47.z.object({
|
|
1195
|
-
type: import_v47.z.literal("text"),
|
|
1196
|
-
mediaType: import_v47.z.literal("text/plain"),
|
|
1197
|
-
data: import_v47.z.string()
|
|
1198
|
-
})
|
|
1199
|
-
])
|
|
1200
|
-
}),
|
|
1201
|
-
retrievedAt: import_v47.z.string().nullable()
|
|
1202
|
-
})
|
|
1215
|
+
pageAge: import_v47.z.string().nullable(),
|
|
1216
|
+
encryptedContent: import_v47.z.string(),
|
|
1217
|
+
type: import_v47.z.literal("web_search_result")
|
|
1218
|
+
})
|
|
1219
|
+
)
|
|
1203
1220
|
)
|
|
1204
1221
|
);
|
|
1205
|
-
var
|
|
1222
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1206
1223
|
() => (0, import_provider_utils7.zodSchema)(
|
|
1207
1224
|
import_v47.z.object({
|
|
1208
|
-
|
|
1225
|
+
query: import_v47.z.string()
|
|
1209
1226
|
})
|
|
1210
1227
|
)
|
|
1211
1228
|
);
|
|
1212
|
-
var
|
|
1213
|
-
id: "anthropic.
|
|
1214
|
-
inputSchema:
|
|
1215
|
-
outputSchema:
|
|
1229
|
+
var factory3 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1230
|
+
id: "anthropic.web_search_20250305",
|
|
1231
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1232
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1216
1233
|
supportsDeferredResults: true
|
|
1217
1234
|
});
|
|
1218
|
-
var
|
|
1219
|
-
return
|
|
1235
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1236
|
+
return factory3(args);
|
|
1220
1237
|
};
|
|
1221
1238
|
|
|
1222
|
-
// src/tool/web-fetch-
|
|
1239
|
+
// src/tool/web-fetch-20260209.ts
|
|
1223
1240
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1224
1241
|
var import_v48 = require("zod/v4");
|
|
1225
|
-
var
|
|
1242
|
+
var webFetch_20260209ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
1226
1243
|
() => (0, import_provider_utils8.zodSchema)(
|
|
1227
1244
|
import_v48.z.object({
|
|
1228
1245
|
maxUses: import_v48.z.number().optional(),
|
|
@@ -1233,7 +1250,7 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1233
1250
|
})
|
|
1234
1251
|
)
|
|
1235
1252
|
);
|
|
1236
|
-
var
|
|
1253
|
+
var webFetch_20260209OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1237
1254
|
() => (0, import_provider_utils8.zodSchema)(
|
|
1238
1255
|
import_v48.z.object({
|
|
1239
1256
|
type: import_v48.z.literal("web_fetch_result"),
|
|
@@ -1259,14 +1276,71 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1259
1276
|
})
|
|
1260
1277
|
)
|
|
1261
1278
|
);
|
|
1262
|
-
var
|
|
1279
|
+
var webFetch_20260209InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1263
1280
|
() => (0, import_provider_utils8.zodSchema)(
|
|
1264
1281
|
import_v48.z.object({
|
|
1265
1282
|
url: import_v48.z.string()
|
|
1266
1283
|
})
|
|
1267
1284
|
)
|
|
1268
1285
|
);
|
|
1269
|
-
var
|
|
1286
|
+
var factory4 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1287
|
+
id: "anthropic.web_fetch_20260209",
|
|
1288
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1289
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1290
|
+
supportsDeferredResults: true
|
|
1291
|
+
});
|
|
1292
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1293
|
+
return factory4(args);
|
|
1294
|
+
};
|
|
1295
|
+
|
|
1296
|
+
// src/tool/web-fetch-20250910.ts
|
|
1297
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1298
|
+
var import_v49 = require("zod/v4");
|
|
1299
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
1300
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1301
|
+
import_v49.z.object({
|
|
1302
|
+
maxUses: import_v49.z.number().optional(),
|
|
1303
|
+
allowedDomains: import_v49.z.array(import_v49.z.string()).optional(),
|
|
1304
|
+
blockedDomains: import_v49.z.array(import_v49.z.string()).optional(),
|
|
1305
|
+
citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
|
|
1306
|
+
maxContentTokens: import_v49.z.number().optional()
|
|
1307
|
+
})
|
|
1308
|
+
)
|
|
1309
|
+
);
|
|
1310
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1311
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1312
|
+
import_v49.z.object({
|
|
1313
|
+
type: import_v49.z.literal("web_fetch_result"),
|
|
1314
|
+
url: import_v49.z.string(),
|
|
1315
|
+
content: import_v49.z.object({
|
|
1316
|
+
type: import_v49.z.literal("document"),
|
|
1317
|
+
title: import_v49.z.string().nullable(),
|
|
1318
|
+
citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
|
|
1319
|
+
source: import_v49.z.union([
|
|
1320
|
+
import_v49.z.object({
|
|
1321
|
+
type: import_v49.z.literal("base64"),
|
|
1322
|
+
mediaType: import_v49.z.literal("application/pdf"),
|
|
1323
|
+
data: import_v49.z.string()
|
|
1324
|
+
}),
|
|
1325
|
+
import_v49.z.object({
|
|
1326
|
+
type: import_v49.z.literal("text"),
|
|
1327
|
+
mediaType: import_v49.z.literal("text/plain"),
|
|
1328
|
+
data: import_v49.z.string()
|
|
1329
|
+
})
|
|
1330
|
+
])
|
|
1331
|
+
}),
|
|
1332
|
+
retrievedAt: import_v49.z.string().nullable()
|
|
1333
|
+
})
|
|
1334
|
+
)
|
|
1335
|
+
);
|
|
1336
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1337
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1338
|
+
import_v49.z.object({
|
|
1339
|
+
url: import_v49.z.string()
|
|
1340
|
+
})
|
|
1341
|
+
)
|
|
1342
|
+
);
|
|
1343
|
+
var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
|
|
1270
1344
|
id: "anthropic.web_fetch_20250910",
|
|
1271
1345
|
inputSchema: webFetch_20250910InputSchema,
|
|
1272
1346
|
outputSchema: webFetch_20250910OutputSchema,
|
|
@@ -1277,7 +1351,7 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1277
1351
|
};
|
|
1278
1352
|
|
|
1279
1353
|
// src/anthropic-prepare-tools.ts
|
|
1280
|
-
var
|
|
1354
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1281
1355
|
async function prepareTools({
|
|
1282
1356
|
tools,
|
|
1283
1357
|
toolChoice,
|
|
@@ -1427,7 +1501,7 @@ async function prepareTools({
|
|
|
1427
1501
|
break;
|
|
1428
1502
|
}
|
|
1429
1503
|
case "anthropic.text_editor_20250728": {
|
|
1430
|
-
const args = await (0,
|
|
1504
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1431
1505
|
value: tool.args,
|
|
1432
1506
|
schema: textEditor_20250728ArgsSchema
|
|
1433
1507
|
});
|
|
@@ -1467,7 +1541,7 @@ async function prepareTools({
|
|
|
1467
1541
|
}
|
|
1468
1542
|
case "anthropic.web_fetch_20250910": {
|
|
1469
1543
|
betas.add("web-fetch-2025-09-10");
|
|
1470
|
-
const args = await (0,
|
|
1544
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1471
1545
|
value: tool.args,
|
|
1472
1546
|
schema: webFetch_20250910ArgsSchema
|
|
1473
1547
|
});
|
|
@@ -1485,7 +1559,7 @@ async function prepareTools({
|
|
|
1485
1559
|
}
|
|
1486
1560
|
case "anthropic.web_fetch_20260209": {
|
|
1487
1561
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1488
|
-
const args = await (0,
|
|
1562
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1489
1563
|
value: tool.args,
|
|
1490
1564
|
schema: webFetch_20260209ArgsSchema
|
|
1491
1565
|
});
|
|
@@ -1502,7 +1576,7 @@ async function prepareTools({
|
|
|
1502
1576
|
break;
|
|
1503
1577
|
}
|
|
1504
1578
|
case "anthropic.web_search_20250305": {
|
|
1505
|
-
const args = await (0,
|
|
1579
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1506
1580
|
value: tool.args,
|
|
1507
1581
|
schema: webSearch_20250305ArgsSchema
|
|
1508
1582
|
});
|
|
@@ -1519,7 +1593,7 @@ async function prepareTools({
|
|
|
1519
1593
|
}
|
|
1520
1594
|
case "anthropic.web_search_20260209": {
|
|
1521
1595
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1522
|
-
const args = await (0,
|
|
1596
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1523
1597
|
value: tool.args,
|
|
1524
1598
|
schema: webSearch_20260209ArgsSchema
|
|
1525
1599
|
});
|
|
@@ -1661,35 +1735,35 @@ function convertAnthropicMessagesUsage({
|
|
|
1661
1735
|
|
|
1662
1736
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1663
1737
|
var import_provider2 = require("@ai-sdk/provider");
|
|
1664
|
-
var
|
|
1738
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
1665
1739
|
|
|
1666
1740
|
// src/tool/code-execution_20250522.ts
|
|
1667
|
-
var
|
|
1668
|
-
var
|
|
1669
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
1670
|
-
() => (0,
|
|
1671
|
-
|
|
1672
|
-
type:
|
|
1673
|
-
stdout:
|
|
1674
|
-
stderr:
|
|
1675
|
-
return_code:
|
|
1676
|
-
content:
|
|
1677
|
-
|
|
1678
|
-
type:
|
|
1679
|
-
file_id:
|
|
1741
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1742
|
+
var import_v410 = require("zod/v4");
|
|
1743
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1744
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
1745
|
+
import_v410.z.object({
|
|
1746
|
+
type: import_v410.z.literal("code_execution_result"),
|
|
1747
|
+
stdout: import_v410.z.string(),
|
|
1748
|
+
stderr: import_v410.z.string(),
|
|
1749
|
+
return_code: import_v410.z.number(),
|
|
1750
|
+
content: import_v410.z.array(
|
|
1751
|
+
import_v410.z.object({
|
|
1752
|
+
type: import_v410.z.literal("code_execution_output"),
|
|
1753
|
+
file_id: import_v410.z.string()
|
|
1680
1754
|
})
|
|
1681
1755
|
).optional().default([])
|
|
1682
1756
|
})
|
|
1683
1757
|
)
|
|
1684
1758
|
);
|
|
1685
|
-
var codeExecution_20250522InputSchema = (0,
|
|
1686
|
-
() => (0,
|
|
1687
|
-
|
|
1688
|
-
code:
|
|
1759
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1760
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
1761
|
+
import_v410.z.object({
|
|
1762
|
+
code: import_v410.z.string()
|
|
1689
1763
|
})
|
|
1690
1764
|
)
|
|
1691
1765
|
);
|
|
1692
|
-
var factory6 = (0,
|
|
1766
|
+
var factory6 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
|
|
1693
1767
|
id: "anthropic.code_execution_20250522",
|
|
1694
1768
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1695
1769
|
outputSchema: codeExecution_20250522OutputSchema
|
|
@@ -1699,118 +1773,9 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1699
1773
|
};
|
|
1700
1774
|
|
|
1701
1775
|
// src/tool/code-execution_20250825.ts
|
|
1702
|
-
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1703
|
-
var import_v410 = require("zod/v4");
|
|
1704
|
-
var codeExecution_20250825OutputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1705
|
-
() => (0, import_provider_utils11.zodSchema)(
|
|
1706
|
-
import_v410.z.discriminatedUnion("type", [
|
|
1707
|
-
import_v410.z.object({
|
|
1708
|
-
type: import_v410.z.literal("code_execution_result"),
|
|
1709
|
-
stdout: import_v410.z.string(),
|
|
1710
|
-
stderr: import_v410.z.string(),
|
|
1711
|
-
return_code: import_v410.z.number(),
|
|
1712
|
-
content: import_v410.z.array(
|
|
1713
|
-
import_v410.z.object({
|
|
1714
|
-
type: import_v410.z.literal("code_execution_output"),
|
|
1715
|
-
file_id: import_v410.z.string()
|
|
1716
|
-
})
|
|
1717
|
-
).optional().default([])
|
|
1718
|
-
}),
|
|
1719
|
-
import_v410.z.object({
|
|
1720
|
-
type: import_v410.z.literal("bash_code_execution_result"),
|
|
1721
|
-
content: import_v410.z.array(
|
|
1722
|
-
import_v410.z.object({
|
|
1723
|
-
type: import_v410.z.literal("bash_code_execution_output"),
|
|
1724
|
-
file_id: import_v410.z.string()
|
|
1725
|
-
})
|
|
1726
|
-
),
|
|
1727
|
-
stdout: import_v410.z.string(),
|
|
1728
|
-
stderr: import_v410.z.string(),
|
|
1729
|
-
return_code: import_v410.z.number()
|
|
1730
|
-
}),
|
|
1731
|
-
import_v410.z.object({
|
|
1732
|
-
type: import_v410.z.literal("bash_code_execution_tool_result_error"),
|
|
1733
|
-
error_code: import_v410.z.string()
|
|
1734
|
-
}),
|
|
1735
|
-
import_v410.z.object({
|
|
1736
|
-
type: import_v410.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1737
|
-
error_code: import_v410.z.string()
|
|
1738
|
-
}),
|
|
1739
|
-
import_v410.z.object({
|
|
1740
|
-
type: import_v410.z.literal("text_editor_code_execution_view_result"),
|
|
1741
|
-
content: import_v410.z.string(),
|
|
1742
|
-
file_type: import_v410.z.string(),
|
|
1743
|
-
num_lines: import_v410.z.number().nullable(),
|
|
1744
|
-
start_line: import_v410.z.number().nullable(),
|
|
1745
|
-
total_lines: import_v410.z.number().nullable()
|
|
1746
|
-
}),
|
|
1747
|
-
import_v410.z.object({
|
|
1748
|
-
type: import_v410.z.literal("text_editor_code_execution_create_result"),
|
|
1749
|
-
is_file_update: import_v410.z.boolean()
|
|
1750
|
-
}),
|
|
1751
|
-
import_v410.z.object({
|
|
1752
|
-
type: import_v410.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1753
|
-
lines: import_v410.z.array(import_v410.z.string()).nullable(),
|
|
1754
|
-
new_lines: import_v410.z.number().nullable(),
|
|
1755
|
-
new_start: import_v410.z.number().nullable(),
|
|
1756
|
-
old_lines: import_v410.z.number().nullable(),
|
|
1757
|
-
old_start: import_v410.z.number().nullable()
|
|
1758
|
-
})
|
|
1759
|
-
])
|
|
1760
|
-
)
|
|
1761
|
-
);
|
|
1762
|
-
var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1763
|
-
() => (0, import_provider_utils11.zodSchema)(
|
|
1764
|
-
import_v410.z.discriminatedUnion("type", [
|
|
1765
|
-
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1766
|
-
import_v410.z.object({
|
|
1767
|
-
type: import_v410.z.literal("programmatic-tool-call"),
|
|
1768
|
-
code: import_v410.z.string()
|
|
1769
|
-
}),
|
|
1770
|
-
import_v410.z.object({
|
|
1771
|
-
type: import_v410.z.literal("bash_code_execution"),
|
|
1772
|
-
command: import_v410.z.string()
|
|
1773
|
-
}),
|
|
1774
|
-
import_v410.z.discriminatedUnion("command", [
|
|
1775
|
-
import_v410.z.object({
|
|
1776
|
-
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1777
|
-
command: import_v410.z.literal("view"),
|
|
1778
|
-
path: import_v410.z.string()
|
|
1779
|
-
}),
|
|
1780
|
-
import_v410.z.object({
|
|
1781
|
-
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1782
|
-
command: import_v410.z.literal("create"),
|
|
1783
|
-
path: import_v410.z.string(),
|
|
1784
|
-
file_text: import_v410.z.string().nullish()
|
|
1785
|
-
}),
|
|
1786
|
-
import_v410.z.object({
|
|
1787
|
-
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1788
|
-
command: import_v410.z.literal("str_replace"),
|
|
1789
|
-
path: import_v410.z.string(),
|
|
1790
|
-
old_str: import_v410.z.string(),
|
|
1791
|
-
new_str: import_v410.z.string()
|
|
1792
|
-
})
|
|
1793
|
-
])
|
|
1794
|
-
])
|
|
1795
|
-
)
|
|
1796
|
-
);
|
|
1797
|
-
var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
|
|
1798
|
-
id: "anthropic.code_execution_20250825",
|
|
1799
|
-
inputSchema: codeExecution_20250825InputSchema,
|
|
1800
|
-
outputSchema: codeExecution_20250825OutputSchema,
|
|
1801
|
-
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
1802
|
-
// when code execution triggers a client-executed tool that needs to be
|
|
1803
|
-
// resolved before the code execution result can be returned.
|
|
1804
|
-
supportsDeferredResults: true
|
|
1805
|
-
});
|
|
1806
|
-
var codeExecution_20250825 = (args = {}) => {
|
|
1807
|
-
return factory7(args);
|
|
1808
|
-
};
|
|
1809
|
-
|
|
1810
|
-
// src/tool/code-execution_20260120.ts
|
|
1811
1776
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
1812
1777
|
var import_v411 = require("zod/v4");
|
|
1813
|
-
var
|
|
1778
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils12.lazySchema)(
|
|
1814
1779
|
() => (0, import_provider_utils12.zodSchema)(
|
|
1815
1780
|
import_v411.z.discriminatedUnion("type", [
|
|
1816
1781
|
import_v411.z.object({
|
|
@@ -1825,18 +1790,6 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)
|
|
|
1825
1790
|
})
|
|
1826
1791
|
).optional().default([])
|
|
1827
1792
|
}),
|
|
1828
|
-
import_v411.z.object({
|
|
1829
|
-
type: import_v411.z.literal("encrypted_code_execution_result"),
|
|
1830
|
-
encrypted_stdout: import_v411.z.string(),
|
|
1831
|
-
stderr: import_v411.z.string(),
|
|
1832
|
-
return_code: import_v411.z.number(),
|
|
1833
|
-
content: import_v411.z.array(
|
|
1834
|
-
import_v411.z.object({
|
|
1835
|
-
type: import_v411.z.literal("code_execution_output"),
|
|
1836
|
-
file_id: import_v411.z.string()
|
|
1837
|
-
})
|
|
1838
|
-
).optional().default([])
|
|
1839
|
-
}),
|
|
1840
1793
|
import_v411.z.object({
|
|
1841
1794
|
type: import_v411.z.literal("bash_code_execution_result"),
|
|
1842
1795
|
content: import_v411.z.array(
|
|
@@ -1880,9 +1833,10 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)
|
|
|
1880
1833
|
])
|
|
1881
1834
|
)
|
|
1882
1835
|
);
|
|
1883
|
-
var
|
|
1836
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
1884
1837
|
() => (0, import_provider_utils12.zodSchema)(
|
|
1885
1838
|
import_v411.z.discriminatedUnion("type", [
|
|
1839
|
+
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1886
1840
|
import_v411.z.object({
|
|
1887
1841
|
type: import_v411.z.literal("programmatic-tool-call"),
|
|
1888
1842
|
code: import_v411.z.string()
|
|
@@ -1914,7 +1868,127 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
|
1914
1868
|
])
|
|
1915
1869
|
)
|
|
1916
1870
|
);
|
|
1917
|
-
var
|
|
1871
|
+
var factory7 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
1872
|
+
id: "anthropic.code_execution_20250825",
|
|
1873
|
+
inputSchema: codeExecution_20250825InputSchema,
|
|
1874
|
+
outputSchema: codeExecution_20250825OutputSchema,
|
|
1875
|
+
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
1876
|
+
// when code execution triggers a client-executed tool that needs to be
|
|
1877
|
+
// resolved before the code execution result can be returned.
|
|
1878
|
+
supportsDeferredResults: true
|
|
1879
|
+
});
|
|
1880
|
+
var codeExecution_20250825 = (args = {}) => {
|
|
1881
|
+
return factory7(args);
|
|
1882
|
+
};
|
|
1883
|
+
|
|
1884
|
+
// src/tool/code-execution_20260120.ts
|
|
1885
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
1886
|
+
var import_v412 = require("zod/v4");
|
|
1887
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)(
|
|
1888
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1889
|
+
import_v412.z.discriminatedUnion("type", [
|
|
1890
|
+
import_v412.z.object({
|
|
1891
|
+
type: import_v412.z.literal("code_execution_result"),
|
|
1892
|
+
stdout: import_v412.z.string(),
|
|
1893
|
+
stderr: import_v412.z.string(),
|
|
1894
|
+
return_code: import_v412.z.number(),
|
|
1895
|
+
content: import_v412.z.array(
|
|
1896
|
+
import_v412.z.object({
|
|
1897
|
+
type: import_v412.z.literal("code_execution_output"),
|
|
1898
|
+
file_id: import_v412.z.string()
|
|
1899
|
+
})
|
|
1900
|
+
).optional().default([])
|
|
1901
|
+
}),
|
|
1902
|
+
import_v412.z.object({
|
|
1903
|
+
type: import_v412.z.literal("encrypted_code_execution_result"),
|
|
1904
|
+
encrypted_stdout: import_v412.z.string(),
|
|
1905
|
+
stderr: import_v412.z.string(),
|
|
1906
|
+
return_code: import_v412.z.number(),
|
|
1907
|
+
content: import_v412.z.array(
|
|
1908
|
+
import_v412.z.object({
|
|
1909
|
+
type: import_v412.z.literal("code_execution_output"),
|
|
1910
|
+
file_id: import_v412.z.string()
|
|
1911
|
+
})
|
|
1912
|
+
).optional().default([])
|
|
1913
|
+
}),
|
|
1914
|
+
import_v412.z.object({
|
|
1915
|
+
type: import_v412.z.literal("bash_code_execution_result"),
|
|
1916
|
+
content: import_v412.z.array(
|
|
1917
|
+
import_v412.z.object({
|
|
1918
|
+
type: import_v412.z.literal("bash_code_execution_output"),
|
|
1919
|
+
file_id: import_v412.z.string()
|
|
1920
|
+
})
|
|
1921
|
+
),
|
|
1922
|
+
stdout: import_v412.z.string(),
|
|
1923
|
+
stderr: import_v412.z.string(),
|
|
1924
|
+
return_code: import_v412.z.number()
|
|
1925
|
+
}),
|
|
1926
|
+
import_v412.z.object({
|
|
1927
|
+
type: import_v412.z.literal("bash_code_execution_tool_result_error"),
|
|
1928
|
+
error_code: import_v412.z.string()
|
|
1929
|
+
}),
|
|
1930
|
+
import_v412.z.object({
|
|
1931
|
+
type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1932
|
+
error_code: import_v412.z.string()
|
|
1933
|
+
}),
|
|
1934
|
+
import_v412.z.object({
|
|
1935
|
+
type: import_v412.z.literal("text_editor_code_execution_view_result"),
|
|
1936
|
+
content: import_v412.z.string(),
|
|
1937
|
+
file_type: import_v412.z.string(),
|
|
1938
|
+
num_lines: import_v412.z.number().nullable(),
|
|
1939
|
+
start_line: import_v412.z.number().nullable(),
|
|
1940
|
+
total_lines: import_v412.z.number().nullable()
|
|
1941
|
+
}),
|
|
1942
|
+
import_v412.z.object({
|
|
1943
|
+
type: import_v412.z.literal("text_editor_code_execution_create_result"),
|
|
1944
|
+
is_file_update: import_v412.z.boolean()
|
|
1945
|
+
}),
|
|
1946
|
+
import_v412.z.object({
|
|
1947
|
+
type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1948
|
+
lines: import_v412.z.array(import_v412.z.string()).nullable(),
|
|
1949
|
+
new_lines: import_v412.z.number().nullable(),
|
|
1950
|
+
new_start: import_v412.z.number().nullable(),
|
|
1951
|
+
old_lines: import_v412.z.number().nullable(),
|
|
1952
|
+
old_start: import_v412.z.number().nullable()
|
|
1953
|
+
})
|
|
1954
|
+
])
|
|
1955
|
+
)
|
|
1956
|
+
);
|
|
1957
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
1958
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1959
|
+
import_v412.z.discriminatedUnion("type", [
|
|
1960
|
+
import_v412.z.object({
|
|
1961
|
+
type: import_v412.z.literal("programmatic-tool-call"),
|
|
1962
|
+
code: import_v412.z.string()
|
|
1963
|
+
}),
|
|
1964
|
+
import_v412.z.object({
|
|
1965
|
+
type: import_v412.z.literal("bash_code_execution"),
|
|
1966
|
+
command: import_v412.z.string()
|
|
1967
|
+
}),
|
|
1968
|
+
import_v412.z.discriminatedUnion("command", [
|
|
1969
|
+
import_v412.z.object({
|
|
1970
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
1971
|
+
command: import_v412.z.literal("view"),
|
|
1972
|
+
path: import_v412.z.string()
|
|
1973
|
+
}),
|
|
1974
|
+
import_v412.z.object({
|
|
1975
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
1976
|
+
command: import_v412.z.literal("create"),
|
|
1977
|
+
path: import_v412.z.string(),
|
|
1978
|
+
file_text: import_v412.z.string().nullish()
|
|
1979
|
+
}),
|
|
1980
|
+
import_v412.z.object({
|
|
1981
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
1982
|
+
command: import_v412.z.literal("str_replace"),
|
|
1983
|
+
path: import_v412.z.string(),
|
|
1984
|
+
old_str: import_v412.z.string(),
|
|
1985
|
+
new_str: import_v412.z.string()
|
|
1986
|
+
})
|
|
1987
|
+
])
|
|
1988
|
+
])
|
|
1989
|
+
)
|
|
1990
|
+
);
|
|
1991
|
+
var factory8 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
|
|
1918
1992
|
id: "anthropic.code_execution_20260120",
|
|
1919
1993
|
inputSchema: codeExecution_20260120InputSchema,
|
|
1920
1994
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
@@ -1925,21 +1999,21 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
1925
1999
|
};
|
|
1926
2000
|
|
|
1927
2001
|
// src/tool/tool-search-regex_20251119.ts
|
|
1928
|
-
var
|
|
1929
|
-
var
|
|
1930
|
-
var toolSearchRegex_20251119OutputSchema = (0,
|
|
1931
|
-
() => (0,
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
type:
|
|
1935
|
-
toolName:
|
|
2002
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2003
|
+
var import_v413 = require("zod/v4");
|
|
2004
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2005
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2006
|
+
import_v413.z.array(
|
|
2007
|
+
import_v413.z.object({
|
|
2008
|
+
type: import_v413.z.literal("tool_reference"),
|
|
2009
|
+
toolName: import_v413.z.string()
|
|
1936
2010
|
})
|
|
1937
2011
|
)
|
|
1938
2012
|
)
|
|
1939
2013
|
);
|
|
1940
|
-
var toolSearchRegex_20251119InputSchema = (0,
|
|
1941
|
-
() => (0,
|
|
1942
|
-
|
|
2014
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2015
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2016
|
+
import_v413.z.object({
|
|
1943
2017
|
/**
|
|
1944
2018
|
* A regex pattern to search for tools.
|
|
1945
2019
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -1950,15 +2024,15 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema
|
|
|
1950
2024
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1951
2025
|
* - "(?i)slack" - case-insensitive search
|
|
1952
2026
|
*/
|
|
1953
|
-
pattern:
|
|
2027
|
+
pattern: import_v413.z.string(),
|
|
1954
2028
|
/**
|
|
1955
2029
|
* Maximum number of tools to return. Optional.
|
|
1956
2030
|
*/
|
|
1957
|
-
limit:
|
|
2031
|
+
limit: import_v413.z.number().optional()
|
|
1958
2032
|
})
|
|
1959
2033
|
)
|
|
1960
2034
|
);
|
|
1961
|
-
var factory9 = (0,
|
|
2035
|
+
var factory9 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
1962
2036
|
id: "anthropic.tool_search_regex_20251119",
|
|
1963
2037
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
1964
2038
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
@@ -1971,7 +2045,7 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
1971
2045
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1972
2046
|
function convertToString(data) {
|
|
1973
2047
|
if (typeof data === "string") {
|
|
1974
|
-
return new TextDecoder().decode((0,
|
|
2048
|
+
return new TextDecoder().decode((0, import_provider_utils15.convertBase64ToUint8Array)(data));
|
|
1975
2049
|
}
|
|
1976
2050
|
if (data instanceof Uint8Array) {
|
|
1977
2051
|
return new TextDecoder().decode(data);
|
|
@@ -2009,7 +2083,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2009
2083
|
const messages = [];
|
|
2010
2084
|
async function shouldEnableCitations(providerMetadata) {
|
|
2011
2085
|
var _a2, _b2;
|
|
2012
|
-
const anthropicOptions = await (0,
|
|
2086
|
+
const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2013
2087
|
provider: "anthropic",
|
|
2014
2088
|
providerOptions: providerMetadata,
|
|
2015
2089
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2017,7 +2091,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2017
2091
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
2018
2092
|
}
|
|
2019
2093
|
async function getDocumentMetadata(providerMetadata) {
|
|
2020
|
-
const anthropicOptions = await (0,
|
|
2094
|
+
const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2021
2095
|
provider: "anthropic",
|
|
2022
2096
|
providerOptions: providerMetadata,
|
|
2023
2097
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2074,7 +2148,26 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2074
2148
|
break;
|
|
2075
2149
|
}
|
|
2076
2150
|
case "file": {
|
|
2077
|
-
if (part.
|
|
2151
|
+
if ((0, import_provider_utils15.isProviderReference)(part.data)) {
|
|
2152
|
+
const fileId = (0, import_provider_utils15.resolveProviderReference)({
|
|
2153
|
+
reference: part.data,
|
|
2154
|
+
provider: "anthropic"
|
|
2155
|
+
});
|
|
2156
|
+
betas.add("files-api-2025-04-14");
|
|
2157
|
+
if (part.mediaType.startsWith("image/")) {
|
|
2158
|
+
anthropicContent.push({
|
|
2159
|
+
type: "image",
|
|
2160
|
+
source: { type: "file", file_id: fileId },
|
|
2161
|
+
cache_control: cacheControl
|
|
2162
|
+
});
|
|
2163
|
+
} else {
|
|
2164
|
+
anthropicContent.push({
|
|
2165
|
+
type: "document",
|
|
2166
|
+
source: { type: "file", file_id: fileId },
|
|
2167
|
+
cache_control: cacheControl
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
} else if (part.mediaType.startsWith("image/")) {
|
|
2078
2171
|
anthropicContent.push({
|
|
2079
2172
|
type: "image",
|
|
2080
2173
|
source: isUrlData(part.data) ? {
|
|
@@ -2083,7 +2176,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2083
2176
|
} : {
|
|
2084
2177
|
type: "base64",
|
|
2085
2178
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
2086
|
-
data: (0,
|
|
2179
|
+
data: (0, import_provider_utils15.convertToBase64)(part.data)
|
|
2087
2180
|
},
|
|
2088
2181
|
cache_control: cacheControl
|
|
2089
2182
|
});
|
|
@@ -2103,7 +2196,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2103
2196
|
} : {
|
|
2104
2197
|
type: "base64",
|
|
2105
2198
|
media_type: "application/pdf",
|
|
2106
|
-
data: (0,
|
|
2199
|
+
data: (0, import_provider_utils15.convertToBase64)(part.data)
|
|
2107
2200
|
},
|
|
2108
2201
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
2109
2202
|
...metadata.context && { context: metadata.context },
|
|
@@ -2241,7 +2334,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2241
2334
|
return void 0;
|
|
2242
2335
|
}
|
|
2243
2336
|
}
|
|
2244
|
-
}).filter(
|
|
2337
|
+
}).filter(import_provider_utils15.isNonNullable);
|
|
2245
2338
|
break;
|
|
2246
2339
|
case "text":
|
|
2247
2340
|
case "error-text":
|
|
@@ -2317,7 +2410,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2317
2410
|
}
|
|
2318
2411
|
case "reasoning": {
|
|
2319
2412
|
if (sendReasoning) {
|
|
2320
|
-
const reasoningMetadata = await (0,
|
|
2413
|
+
const reasoningMetadata = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2321
2414
|
provider: "anthropic",
|
|
2322
2415
|
providerOptions: part.providerOptions,
|
|
2323
2416
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -2523,7 +2616,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2523
2616
|
break;
|
|
2524
2617
|
}
|
|
2525
2618
|
if (output.value.type === "code_execution_result") {
|
|
2526
|
-
const codeExecutionOutput = await (0,
|
|
2619
|
+
const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2527
2620
|
value: output.value,
|
|
2528
2621
|
schema: codeExecution_20250522OutputSchema
|
|
2529
2622
|
});
|
|
@@ -2540,7 +2633,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2540
2633
|
cache_control: cacheControl
|
|
2541
2634
|
});
|
|
2542
2635
|
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
2543
|
-
const codeExecutionOutput = await (0,
|
|
2636
|
+
const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2544
2637
|
value: output.value,
|
|
2545
2638
|
schema: codeExecution_20260120OutputSchema
|
|
2546
2639
|
});
|
|
@@ -2559,7 +2652,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2559
2652
|
});
|
|
2560
2653
|
}
|
|
2561
2654
|
} else {
|
|
2562
|
-
const codeExecutionOutput = await (0,
|
|
2655
|
+
const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2563
2656
|
value: output.value,
|
|
2564
2657
|
schema: codeExecution_20250825OutputSchema
|
|
2565
2658
|
});
|
|
@@ -2628,7 +2721,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2628
2721
|
});
|
|
2629
2722
|
break;
|
|
2630
2723
|
}
|
|
2631
|
-
const webFetchOutput = await (0,
|
|
2724
|
+
const webFetchOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2632
2725
|
value: output.value,
|
|
2633
2726
|
schema: webFetch_20250910OutputSchema
|
|
2634
2727
|
});
|
|
@@ -2663,7 +2756,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2663
2756
|
});
|
|
2664
2757
|
break;
|
|
2665
2758
|
}
|
|
2666
|
-
const webSearchOutput = await (0,
|
|
2759
|
+
const webSearchOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2667
2760
|
value: output.value,
|
|
2668
2761
|
schema: webSearch_20250305OutputSchema
|
|
2669
2762
|
});
|
|
@@ -2690,7 +2783,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2690
2783
|
});
|
|
2691
2784
|
break;
|
|
2692
2785
|
}
|
|
2693
|
-
const toolSearchOutput = await (0,
|
|
2786
|
+
const toolSearchOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2694
2787
|
value: output.value,
|
|
2695
2788
|
schema: toolSearchRegex_20251119OutputSchema
|
|
2696
2789
|
});
|
|
@@ -2854,7 +2947,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2854
2947
|
var _a;
|
|
2855
2948
|
this.modelId = modelId;
|
|
2856
2949
|
this.config = config;
|
|
2857
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
2950
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils16.generateId;
|
|
2858
2951
|
}
|
|
2859
2952
|
supportsUrl(url) {
|
|
2860
2953
|
return url.protocol === "https:";
|
|
@@ -2929,12 +3022,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2929
3022
|
}
|
|
2930
3023
|
}
|
|
2931
3024
|
const providerOptionsName = this.providerOptionsName;
|
|
2932
|
-
const canonicalOptions = await (0,
|
|
3025
|
+
const canonicalOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2933
3026
|
provider: "anthropic",
|
|
2934
3027
|
providerOptions,
|
|
2935
3028
|
schema: anthropicLanguageModelOptions
|
|
2936
3029
|
});
|
|
2937
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0,
|
|
3030
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils16.parseProviderOptions)({
|
|
2938
3031
|
provider: providerOptionsName,
|
|
2939
3032
|
providerOptions,
|
|
2940
3033
|
schema: anthropicLanguageModelOptions
|
|
@@ -2964,7 +3057,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2964
3057
|
} : void 0;
|
|
2965
3058
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
2966
3059
|
const cacheControlValidator = new CacheControlValidator();
|
|
2967
|
-
const toolNameMapping = (0,
|
|
3060
|
+
const toolNameMapping = (0, import_provider_utils16.createToolNameMapping)({
|
|
2968
3061
|
tools,
|
|
2969
3062
|
providerToolNames: {
|
|
2970
3063
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -2994,7 +3087,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2994
3087
|
cacheControlValidator,
|
|
2995
3088
|
toolNameMapping
|
|
2996
3089
|
});
|
|
2997
|
-
if ((0,
|
|
3090
|
+
if ((0, import_provider_utils16.isCustomReasoning)(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
|
|
2998
3091
|
const reasoningConfig = resolveAnthropicReasoningConfig({
|
|
2999
3092
|
reasoning,
|
|
3000
3093
|
supportsAdaptiveThinking,
|
|
@@ -3271,15 +3364,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3271
3364
|
betas,
|
|
3272
3365
|
headers
|
|
3273
3366
|
}) {
|
|
3274
|
-
return (0,
|
|
3275
|
-
await (0,
|
|
3367
|
+
return (0, import_provider_utils16.combineHeaders)(
|
|
3368
|
+
await (0, import_provider_utils16.resolve)(this.config.headers),
|
|
3276
3369
|
headers,
|
|
3277
3370
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
3278
3371
|
);
|
|
3279
3372
|
}
|
|
3280
3373
|
async getBetasFromHeaders(requestHeaders) {
|
|
3281
3374
|
var _a, _b;
|
|
3282
|
-
const configHeaders = await (0,
|
|
3375
|
+
const configHeaders = await (0, import_provider_utils16.resolve)(this.config.headers);
|
|
3283
3376
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
3284
3377
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
3285
3378
|
return new Set(
|
|
@@ -3345,12 +3438,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3345
3438
|
responseHeaders,
|
|
3346
3439
|
value: response,
|
|
3347
3440
|
rawValue: rawResponse
|
|
3348
|
-
} = await (0,
|
|
3441
|
+
} = await (0, import_provider_utils16.postJsonToApi)({
|
|
3349
3442
|
url: this.buildRequestUrl(false),
|
|
3350
3443
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3351
3444
|
body: this.transformRequestBody(args, betas),
|
|
3352
3445
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3353
|
-
successfulResponseHandler: (0,
|
|
3446
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
3354
3447
|
anthropicMessagesResponseSchema
|
|
3355
3448
|
),
|
|
3356
3449
|
abortSignal: options.abortSignal,
|
|
@@ -3765,12 +3858,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3765
3858
|
body.tools
|
|
3766
3859
|
);
|
|
3767
3860
|
const url = this.buildRequestUrl(true);
|
|
3768
|
-
const { responseHeaders, value: response } = await (0,
|
|
3861
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
|
|
3769
3862
|
url,
|
|
3770
3863
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3771
3864
|
body: this.transformRequestBody(body, betas),
|
|
3772
3865
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3773
|
-
successfulResponseHandler: (0,
|
|
3866
|
+
successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
|
|
3774
3867
|
anthropicMessagesChunkSchema
|
|
3775
3868
|
),
|
|
3776
3869
|
abortSignal: options.abortSignal,
|
|
@@ -4593,14 +4686,14 @@ function resolveAnthropicReasoningConfig({
|
|
|
4593
4686
|
maxOutputTokensForModel,
|
|
4594
4687
|
warnings
|
|
4595
4688
|
}) {
|
|
4596
|
-
if (!(0,
|
|
4689
|
+
if (!(0, import_provider_utils16.isCustomReasoning)(reasoning)) {
|
|
4597
4690
|
return void 0;
|
|
4598
4691
|
}
|
|
4599
4692
|
if (reasoning === "none") {
|
|
4600
4693
|
return { thinking: { type: "disabled" } };
|
|
4601
4694
|
}
|
|
4602
4695
|
if (supportsAdaptiveThinking) {
|
|
4603
|
-
const effort = (0,
|
|
4696
|
+
const effort = (0, import_provider_utils16.mapReasoningToProviderEffort)({
|
|
4604
4697
|
reasoning,
|
|
4605
4698
|
effortMap: {
|
|
4606
4699
|
minimal: "low",
|
|
@@ -4613,7 +4706,7 @@ function resolveAnthropicReasoningConfig({
|
|
|
4613
4706
|
});
|
|
4614
4707
|
return { thinking: { type: "adaptive" }, effort };
|
|
4615
4708
|
}
|
|
4616
|
-
const budgetTokens = (0,
|
|
4709
|
+
const budgetTokens = (0, import_provider_utils16.mapReasoningToProviderBudget)({
|
|
4617
4710
|
reasoning,
|
|
4618
4711
|
maxOutputTokens: maxOutputTokensForModel,
|
|
4619
4712
|
maxReasoningBudget: maxOutputTokensForModel,
|
|
@@ -4651,44 +4744,44 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4651
4744
|
}
|
|
4652
4745
|
|
|
4653
4746
|
// src/tool/bash_20241022.ts
|
|
4654
|
-
var
|
|
4655
|
-
var
|
|
4656
|
-
var bash_20241022InputSchema = (0,
|
|
4657
|
-
() => (0,
|
|
4658
|
-
|
|
4659
|
-
command:
|
|
4660
|
-
restart:
|
|
4747
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4748
|
+
var import_v414 = require("zod/v4");
|
|
4749
|
+
var bash_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4750
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
4751
|
+
import_v414.z.object({
|
|
4752
|
+
command: import_v414.z.string(),
|
|
4753
|
+
restart: import_v414.z.boolean().optional()
|
|
4661
4754
|
})
|
|
4662
4755
|
)
|
|
4663
4756
|
);
|
|
4664
|
-
var bash_20241022 = (0,
|
|
4757
|
+
var bash_20241022 = (0, import_provider_utils17.createProviderToolFactory)({
|
|
4665
4758
|
id: "anthropic.bash_20241022",
|
|
4666
4759
|
inputSchema: bash_20241022InputSchema
|
|
4667
4760
|
});
|
|
4668
4761
|
|
|
4669
4762
|
// src/tool/bash_20250124.ts
|
|
4670
|
-
var
|
|
4671
|
-
var
|
|
4672
|
-
var bash_20250124InputSchema = (0,
|
|
4673
|
-
() => (0,
|
|
4674
|
-
|
|
4675
|
-
command:
|
|
4676
|
-
restart:
|
|
4763
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
4764
|
+
var import_v415 = require("zod/v4");
|
|
4765
|
+
var bash_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
4766
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
4767
|
+
import_v415.z.object({
|
|
4768
|
+
command: import_v415.z.string(),
|
|
4769
|
+
restart: import_v415.z.boolean().optional()
|
|
4677
4770
|
})
|
|
4678
4771
|
)
|
|
4679
4772
|
);
|
|
4680
|
-
var bash_20250124 = (0,
|
|
4773
|
+
var bash_20250124 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
4681
4774
|
id: "anthropic.bash_20250124",
|
|
4682
4775
|
inputSchema: bash_20250124InputSchema
|
|
4683
4776
|
});
|
|
4684
4777
|
|
|
4685
4778
|
// src/tool/computer_20241022.ts
|
|
4686
|
-
var
|
|
4687
|
-
var
|
|
4688
|
-
var computer_20241022InputSchema = (0,
|
|
4689
|
-
() => (0,
|
|
4690
|
-
|
|
4691
|
-
action:
|
|
4779
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4780
|
+
var import_v416 = require("zod/v4");
|
|
4781
|
+
var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4782
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
4783
|
+
import_v416.z.object({
|
|
4784
|
+
action: import_v416.z.enum([
|
|
4692
4785
|
"key",
|
|
4693
4786
|
"type",
|
|
4694
4787
|
"mouse_move",
|
|
@@ -4700,23 +4793,23 @@ var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
4700
4793
|
"screenshot",
|
|
4701
4794
|
"cursor_position"
|
|
4702
4795
|
]),
|
|
4703
|
-
coordinate:
|
|
4704
|
-
text:
|
|
4796
|
+
coordinate: import_v416.z.array(import_v416.z.number().int()).optional(),
|
|
4797
|
+
text: import_v416.z.string().optional()
|
|
4705
4798
|
})
|
|
4706
4799
|
)
|
|
4707
4800
|
);
|
|
4708
|
-
var computer_20241022 = (0,
|
|
4801
|
+
var computer_20241022 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
4709
4802
|
id: "anthropic.computer_20241022",
|
|
4710
4803
|
inputSchema: computer_20241022InputSchema
|
|
4711
4804
|
});
|
|
4712
4805
|
|
|
4713
4806
|
// src/tool/computer_20250124.ts
|
|
4714
|
-
var
|
|
4715
|
-
var
|
|
4716
|
-
var computer_20250124InputSchema = (0,
|
|
4717
|
-
() => (0,
|
|
4718
|
-
|
|
4719
|
-
action:
|
|
4807
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
4808
|
+
var import_v417 = require("zod/v4");
|
|
4809
|
+
var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
4810
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
4811
|
+
import_v417.z.object({
|
|
4812
|
+
action: import_v417.z.enum([
|
|
4720
4813
|
"key",
|
|
4721
4814
|
"hold_key",
|
|
4722
4815
|
"type",
|
|
@@ -4734,27 +4827,27 @@ var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
4734
4827
|
"wait",
|
|
4735
4828
|
"screenshot"
|
|
4736
4829
|
]),
|
|
4737
|
-
coordinate:
|
|
4738
|
-
duration:
|
|
4739
|
-
scroll_amount:
|
|
4740
|
-
scroll_direction:
|
|
4741
|
-
start_coordinate:
|
|
4742
|
-
text:
|
|
4830
|
+
coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
|
|
4831
|
+
duration: import_v417.z.number().optional(),
|
|
4832
|
+
scroll_amount: import_v417.z.number().optional(),
|
|
4833
|
+
scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4834
|
+
start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
|
|
4835
|
+
text: import_v417.z.string().optional()
|
|
4743
4836
|
})
|
|
4744
4837
|
)
|
|
4745
4838
|
);
|
|
4746
|
-
var computer_20250124 = (0,
|
|
4839
|
+
var computer_20250124 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
4747
4840
|
id: "anthropic.computer_20250124",
|
|
4748
4841
|
inputSchema: computer_20250124InputSchema
|
|
4749
4842
|
});
|
|
4750
4843
|
|
|
4751
4844
|
// src/tool/computer_20251124.ts
|
|
4752
|
-
var
|
|
4753
|
-
var
|
|
4754
|
-
var computer_20251124InputSchema = (0,
|
|
4755
|
-
() => (0,
|
|
4756
|
-
|
|
4757
|
-
action:
|
|
4845
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
4846
|
+
var import_v418 = require("zod/v4");
|
|
4847
|
+
var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
4848
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
4849
|
+
import_v418.z.object({
|
|
4850
|
+
action: import_v418.z.enum([
|
|
4758
4851
|
"key",
|
|
4759
4852
|
"hold_key",
|
|
4760
4853
|
"type",
|
|
@@ -4773,97 +4866,75 @@ var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
4773
4866
|
"screenshot",
|
|
4774
4867
|
"zoom"
|
|
4775
4868
|
]),
|
|
4776
|
-
coordinate:
|
|
4777
|
-
duration:
|
|
4778
|
-
region:
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4869
|
+
coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
|
|
4870
|
+
duration: import_v418.z.number().optional(),
|
|
4871
|
+
region: import_v418.z.tuple([
|
|
4872
|
+
import_v418.z.number().int(),
|
|
4873
|
+
import_v418.z.number().int(),
|
|
4874
|
+
import_v418.z.number().int(),
|
|
4875
|
+
import_v418.z.number().int()
|
|
4783
4876
|
]).optional(),
|
|
4784
|
-
scroll_amount:
|
|
4785
|
-
scroll_direction:
|
|
4786
|
-
start_coordinate:
|
|
4787
|
-
text:
|
|
4877
|
+
scroll_amount: import_v418.z.number().optional(),
|
|
4878
|
+
scroll_direction: import_v418.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4879
|
+
start_coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
|
|
4880
|
+
text: import_v418.z.string().optional()
|
|
4788
4881
|
})
|
|
4789
4882
|
)
|
|
4790
4883
|
);
|
|
4791
|
-
var computer_20251124 = (0,
|
|
4884
|
+
var computer_20251124 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
4792
4885
|
id: "anthropic.computer_20251124",
|
|
4793
4886
|
inputSchema: computer_20251124InputSchema
|
|
4794
4887
|
});
|
|
4795
4888
|
|
|
4796
4889
|
// src/tool/memory_20250818.ts
|
|
4797
|
-
var
|
|
4798
|
-
var
|
|
4799
|
-
var memory_20250818InputSchema = (0,
|
|
4800
|
-
() => (0,
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
command:
|
|
4804
|
-
path:
|
|
4805
|
-
view_range:
|
|
4890
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
4891
|
+
var import_v419 = require("zod/v4");
|
|
4892
|
+
var memory_20250818InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
4893
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
4894
|
+
import_v419.z.discriminatedUnion("command", [
|
|
4895
|
+
import_v419.z.object({
|
|
4896
|
+
command: import_v419.z.literal("view"),
|
|
4897
|
+
path: import_v419.z.string(),
|
|
4898
|
+
view_range: import_v419.z.tuple([import_v419.z.number(), import_v419.z.number()]).optional()
|
|
4806
4899
|
}),
|
|
4807
|
-
|
|
4808
|
-
command:
|
|
4809
|
-
path:
|
|
4810
|
-
file_text:
|
|
4900
|
+
import_v419.z.object({
|
|
4901
|
+
command: import_v419.z.literal("create"),
|
|
4902
|
+
path: import_v419.z.string(),
|
|
4903
|
+
file_text: import_v419.z.string()
|
|
4811
4904
|
}),
|
|
4812
|
-
|
|
4813
|
-
command:
|
|
4814
|
-
path:
|
|
4815
|
-
old_str:
|
|
4816
|
-
new_str:
|
|
4905
|
+
import_v419.z.object({
|
|
4906
|
+
command: import_v419.z.literal("str_replace"),
|
|
4907
|
+
path: import_v419.z.string(),
|
|
4908
|
+
old_str: import_v419.z.string(),
|
|
4909
|
+
new_str: import_v419.z.string()
|
|
4817
4910
|
}),
|
|
4818
|
-
|
|
4819
|
-
command:
|
|
4820
|
-
path:
|
|
4821
|
-
insert_line:
|
|
4822
|
-
insert_text:
|
|
4911
|
+
import_v419.z.object({
|
|
4912
|
+
command: import_v419.z.literal("insert"),
|
|
4913
|
+
path: import_v419.z.string(),
|
|
4914
|
+
insert_line: import_v419.z.number(),
|
|
4915
|
+
insert_text: import_v419.z.string()
|
|
4823
4916
|
}),
|
|
4824
|
-
|
|
4825
|
-
command:
|
|
4826
|
-
path:
|
|
4917
|
+
import_v419.z.object({
|
|
4918
|
+
command: import_v419.z.literal("delete"),
|
|
4919
|
+
path: import_v419.z.string()
|
|
4827
4920
|
}),
|
|
4828
|
-
|
|
4829
|
-
command:
|
|
4830
|
-
old_path:
|
|
4831
|
-
new_path:
|
|
4921
|
+
import_v419.z.object({
|
|
4922
|
+
command: import_v419.z.literal("rename"),
|
|
4923
|
+
old_path: import_v419.z.string(),
|
|
4924
|
+
new_path: import_v419.z.string()
|
|
4832
4925
|
})
|
|
4833
4926
|
])
|
|
4834
4927
|
)
|
|
4835
4928
|
);
|
|
4836
|
-
var memory_20250818 = (0,
|
|
4929
|
+
var memory_20250818 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
4837
4930
|
id: "anthropic.memory_20250818",
|
|
4838
4931
|
inputSchema: memory_20250818InputSchema
|
|
4839
4932
|
});
|
|
4840
4933
|
|
|
4841
4934
|
// src/tool/text-editor_20241022.ts
|
|
4842
|
-
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
4843
|
-
var import_v419 = require("zod/v4");
|
|
4844
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
4845
|
-
() => (0, import_provider_utils22.zodSchema)(
|
|
4846
|
-
import_v419.z.object({
|
|
4847
|
-
command: import_v419.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4848
|
-
path: import_v419.z.string(),
|
|
4849
|
-
file_text: import_v419.z.string().optional(),
|
|
4850
|
-
insert_line: import_v419.z.number().int().optional(),
|
|
4851
|
-
new_str: import_v419.z.string().optional(),
|
|
4852
|
-
insert_text: import_v419.z.string().optional(),
|
|
4853
|
-
old_str: import_v419.z.string().optional(),
|
|
4854
|
-
view_range: import_v419.z.array(import_v419.z.number().int()).optional()
|
|
4855
|
-
})
|
|
4856
|
-
)
|
|
4857
|
-
);
|
|
4858
|
-
var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
4859
|
-
id: "anthropic.text_editor_20241022",
|
|
4860
|
-
inputSchema: textEditor_20241022InputSchema
|
|
4861
|
-
});
|
|
4862
|
-
|
|
4863
|
-
// src/tool/text-editor_20250124.ts
|
|
4864
4935
|
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
4865
4936
|
var import_v420 = require("zod/v4");
|
|
4866
|
-
var
|
|
4937
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
4867
4938
|
() => (0, import_provider_utils23.zodSchema)(
|
|
4868
4939
|
import_v420.z.object({
|
|
4869
4940
|
command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4877,18 +4948,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
4877
4948
|
})
|
|
4878
4949
|
)
|
|
4879
4950
|
);
|
|
4880
|
-
var
|
|
4881
|
-
id: "anthropic.
|
|
4882
|
-
inputSchema:
|
|
4951
|
+
var textEditor_20241022 = (0, import_provider_utils23.createProviderToolFactory)({
|
|
4952
|
+
id: "anthropic.text_editor_20241022",
|
|
4953
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4883
4954
|
});
|
|
4884
4955
|
|
|
4885
|
-
// src/tool/text-
|
|
4956
|
+
// src/tool/text-editor_20250124.ts
|
|
4886
4957
|
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
4887
4958
|
var import_v421 = require("zod/v4");
|
|
4888
|
-
var
|
|
4959
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
4889
4960
|
() => (0, import_provider_utils24.zodSchema)(
|
|
4890
4961
|
import_v421.z.object({
|
|
4891
|
-
command: import_v421.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4962
|
+
command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4892
4963
|
path: import_v421.z.string(),
|
|
4893
4964
|
file_text: import_v421.z.string().optional(),
|
|
4894
4965
|
insert_line: import_v421.z.number().int().optional(),
|
|
@@ -4899,40 +4970,62 @@ var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
4899
4970
|
})
|
|
4900
4971
|
)
|
|
4901
4972
|
);
|
|
4902
|
-
var
|
|
4903
|
-
id: "anthropic.
|
|
4904
|
-
inputSchema:
|
|
4973
|
+
var textEditor_20250124 = (0, import_provider_utils24.createProviderToolFactory)({
|
|
4974
|
+
id: "anthropic.text_editor_20250124",
|
|
4975
|
+
inputSchema: textEditor_20250124InputSchema
|
|
4905
4976
|
});
|
|
4906
4977
|
|
|
4907
|
-
// src/tool/
|
|
4978
|
+
// src/tool/text-editor_20250429.ts
|
|
4908
4979
|
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
4909
4980
|
var import_v422 = require("zod/v4");
|
|
4910
|
-
var
|
|
4981
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
4911
4982
|
() => (0, import_provider_utils25.zodSchema)(
|
|
4912
|
-
import_v422.z.
|
|
4913
|
-
import_v422.z.
|
|
4914
|
-
|
|
4915
|
-
|
|
4983
|
+
import_v422.z.object({
|
|
4984
|
+
command: import_v422.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4985
|
+
path: import_v422.z.string(),
|
|
4986
|
+
file_text: import_v422.z.string().optional(),
|
|
4987
|
+
insert_line: import_v422.z.number().int().optional(),
|
|
4988
|
+
new_str: import_v422.z.string().optional(),
|
|
4989
|
+
insert_text: import_v422.z.string().optional(),
|
|
4990
|
+
old_str: import_v422.z.string().optional(),
|
|
4991
|
+
view_range: import_v422.z.array(import_v422.z.number().int()).optional()
|
|
4992
|
+
})
|
|
4993
|
+
)
|
|
4994
|
+
);
|
|
4995
|
+
var textEditor_20250429 = (0, import_provider_utils25.createProviderToolFactory)({
|
|
4996
|
+
id: "anthropic.text_editor_20250429",
|
|
4997
|
+
inputSchema: textEditor_20250429InputSchema
|
|
4998
|
+
});
|
|
4999
|
+
|
|
5000
|
+
// src/tool/tool-search-bm25_20251119.ts
|
|
5001
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
5002
|
+
var import_v423 = require("zod/v4");
|
|
5003
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
5004
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
5005
|
+
import_v423.z.array(
|
|
5006
|
+
import_v423.z.object({
|
|
5007
|
+
type: import_v423.z.literal("tool_reference"),
|
|
5008
|
+
toolName: import_v423.z.string()
|
|
4916
5009
|
})
|
|
4917
5010
|
)
|
|
4918
5011
|
)
|
|
4919
5012
|
);
|
|
4920
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
4921
|
-
() => (0,
|
|
4922
|
-
|
|
5013
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils26.lazySchema)(
|
|
5014
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
5015
|
+
import_v423.z.object({
|
|
4923
5016
|
/**
|
|
4924
5017
|
* A natural language query to search for tools.
|
|
4925
5018
|
* Claude will use BM25 text search to find relevant tools.
|
|
4926
5019
|
*/
|
|
4927
|
-
query:
|
|
5020
|
+
query: import_v423.z.string(),
|
|
4928
5021
|
/**
|
|
4929
5022
|
* Maximum number of tools to return. Optional.
|
|
4930
5023
|
*/
|
|
4931
|
-
limit:
|
|
5024
|
+
limit: import_v423.z.number().optional()
|
|
4932
5025
|
})
|
|
4933
5026
|
)
|
|
4934
5027
|
);
|
|
4935
|
-
var factory10 = (0,
|
|
5028
|
+
var factory10 = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
|
|
4936
5029
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4937
5030
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4938
5031
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
@@ -5144,11 +5237,14 @@ var anthropicTools = {
|
|
|
5144
5237
|
toolSearchBm25_20251119
|
|
5145
5238
|
};
|
|
5146
5239
|
|
|
5240
|
+
// src/version.ts
|
|
5241
|
+
var VERSION = true ? "4.0.0-beta.18" : "0.0.0-test";
|
|
5242
|
+
|
|
5147
5243
|
// src/anthropic-provider.ts
|
|
5148
5244
|
function createAnthropic(options = {}) {
|
|
5149
5245
|
var _a, _b;
|
|
5150
|
-
const baseURL = (_a = (0,
|
|
5151
|
-
(0,
|
|
5246
|
+
const baseURL = (_a = (0, import_provider_utils27.withoutTrailingSlash)(
|
|
5247
|
+
(0, import_provider_utils27.loadOptionalSetting)({
|
|
5152
5248
|
settingValue: options.baseURL,
|
|
5153
5249
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
5154
5250
|
})
|
|
@@ -5162,13 +5258,13 @@ function createAnthropic(options = {}) {
|
|
|
5162
5258
|
}
|
|
5163
5259
|
const getHeaders = () => {
|
|
5164
5260
|
const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
|
|
5165
|
-
"x-api-key": (0,
|
|
5261
|
+
"x-api-key": (0, import_provider_utils27.loadApiKey)({
|
|
5166
5262
|
apiKey: options.apiKey,
|
|
5167
5263
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
5168
5264
|
description: "Anthropic"
|
|
5169
5265
|
})
|
|
5170
5266
|
};
|
|
5171
|
-
return (0,
|
|
5267
|
+
return (0, import_provider_utils27.withUserAgentSuffix)(
|
|
5172
5268
|
{
|
|
5173
5269
|
"anthropic-version": "2023-06-01",
|
|
5174
5270
|
...authHeaders,
|
|
@@ -5184,7 +5280,7 @@ function createAnthropic(options = {}) {
|
|
|
5184
5280
|
baseURL,
|
|
5185
5281
|
headers: getHeaders,
|
|
5186
5282
|
fetch: options.fetch,
|
|
5187
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
5283
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils27.generateId,
|
|
5188
5284
|
supportedUrls: () => ({
|
|
5189
5285
|
"image/*": [/^https?:\/\/.*$/],
|
|
5190
5286
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -5210,6 +5306,12 @@ function createAnthropic(options = {}) {
|
|
|
5210
5306
|
provider.imageModel = (modelId) => {
|
|
5211
5307
|
throw new import_provider4.NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
5212
5308
|
};
|
|
5309
|
+
provider.files = () => new AnthropicFiles({
|
|
5310
|
+
provider: providerName,
|
|
5311
|
+
baseURL,
|
|
5312
|
+
headers: getHeaders,
|
|
5313
|
+
fetch: options.fetch
|
|
5314
|
+
});
|
|
5213
5315
|
provider.tools = anthropicTools;
|
|
5214
5316
|
return provider;
|
|
5215
5317
|
}
|