@ai-sdk/anthropic 4.0.0-beta.2 → 4.0.0-beta.21
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 +148 -4
- package/README.md +2 -0
- package/dist/index.d.mts +50 -38
- package/dist/index.d.ts +50 -38
- package/dist/index.js +1403 -1075
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1440 -1091
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +64 -43
- package/dist/internal/index.d.ts +64 -43
- package/dist/internal/index.js +143 -25
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +146 -23
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +53 -6
- package/package.json +3 -5
- package/src/anthropic-files.ts +106 -0
- package/src/anthropic-messages-api.ts +4 -0
- package/src/anthropic-messages-language-model.ts +147 -38
- package/src/anthropic-messages-options.ts +29 -5
- package/src/anthropic-prepare-tools.ts +22 -10
- package/src/anthropic-provider.ts +38 -9
- package/src/convert-anthropic-messages-usage.ts +2 -2
- package/src/convert-to-anthropic-messages-prompt.ts +40 -18
- package/src/get-cache-control.ts +5 -5
- package/src/internal/index.ts +4 -1
- package/src/map-anthropic-stop-reason.ts +2 -2
- package/src/skills/anthropic-skills-api.ts +44 -0
- package/src/skills/anthropic-skills.ts +136 -0
package/dist/index.js
CHANGED
|
@@ -18,25 +18,22 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
VERSION: () => VERSION,
|
|
24
24
|
anthropic: () => anthropic,
|
|
25
25
|
createAnthropic: () => createAnthropic,
|
|
26
26
|
forwardAnthropicContainerIdFromLastStep: () => forwardAnthropicContainerIdFromLastStep
|
|
27
27
|
});
|
|
28
|
-
module.exports = __toCommonJS(
|
|
28
|
+
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.2" : "0.0.0-test";
|
|
32
|
+
var import_provider_utils29 = 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,52 +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()
|
|
945
|
+
}).optional(),
|
|
946
|
+
/**
|
|
947
|
+
* Metadata to include with the request.
|
|
948
|
+
*
|
|
949
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
950
|
+
*/
|
|
951
|
+
metadata: import_v44.z.object({
|
|
952
|
+
/**
|
|
953
|
+
* An external identifier for the user associated with the request.
|
|
954
|
+
*
|
|
955
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
956
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
957
|
+
*/
|
|
958
|
+
userId: import_v44.z.string().optional()
|
|
871
959
|
}).optional(),
|
|
872
960
|
/**
|
|
873
961
|
* MCP servers to be utilized in this request.
|
|
874
962
|
*/
|
|
875
|
-
mcpServers:
|
|
876
|
-
|
|
877
|
-
type:
|
|
878
|
-
name:
|
|
879
|
-
url:
|
|
880
|
-
authorizationToken:
|
|
881
|
-
toolConfiguration:
|
|
882
|
-
enabled:
|
|
883
|
-
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()
|
|
884
972
|
}).nullish()
|
|
885
973
|
})
|
|
886
974
|
).optional(),
|
|
@@ -889,14 +977,21 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
889
977
|
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
890
978
|
* Requires code execution tool to be enabled.
|
|
891
979
|
*/
|
|
892
|
-
container:
|
|
893
|
-
id:
|
|
894
|
-
skills:
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
980
|
+
container: import_v44.z.object({
|
|
981
|
+
id: import_v44.z.string().optional(),
|
|
982
|
+
skills: import_v44.z.array(
|
|
983
|
+
import_v44.z.discriminatedUnion("type", [
|
|
984
|
+
import_v44.z.object({
|
|
985
|
+
type: import_v44.z.literal("anthropic"),
|
|
986
|
+
skillId: import_v44.z.string(),
|
|
987
|
+
version: import_v44.z.string().optional()
|
|
988
|
+
}),
|
|
989
|
+
import_v44.z.object({
|
|
990
|
+
type: import_v44.z.literal("custom"),
|
|
991
|
+
providerReference: import_v44.z.record(import_v44.z.string(), import_v44.z.string()),
|
|
992
|
+
version: import_v44.z.string().optional()
|
|
993
|
+
})
|
|
994
|
+
])
|
|
900
995
|
).optional()
|
|
901
996
|
}).optional(),
|
|
902
997
|
/**
|
|
@@ -907,65 +1002,65 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
907
1002
|
*
|
|
908
1003
|
* @default true
|
|
909
1004
|
*/
|
|
910
|
-
toolStreaming:
|
|
1005
|
+
toolStreaming: import_v44.z.boolean().optional(),
|
|
911
1006
|
/**
|
|
912
1007
|
* @default 'high'
|
|
913
1008
|
*/
|
|
914
|
-
effort:
|
|
1009
|
+
effort: import_v44.z.enum(["low", "medium", "high", "max"]).optional(),
|
|
915
1010
|
/**
|
|
916
1011
|
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
917
1012
|
* Only supported with claude-opus-4-6.
|
|
918
1013
|
*/
|
|
919
|
-
speed:
|
|
1014
|
+
speed: import_v44.z.enum(["fast", "standard"]).optional(),
|
|
920
1015
|
/**
|
|
921
1016
|
* A set of beta features to enable.
|
|
922
1017
|
* Allow a provider to receive the full `betas` set if it needs it.
|
|
923
1018
|
*/
|
|
924
|
-
anthropicBeta:
|
|
925
|
-
contextManagement:
|
|
926
|
-
edits:
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
type:
|
|
930
|
-
trigger:
|
|
931
|
-
|
|
932
|
-
type:
|
|
933
|
-
value:
|
|
1019
|
+
anthropicBeta: import_v44.z.array(import_v44.z.string()).optional(),
|
|
1020
|
+
contextManagement: import_v44.z.object({
|
|
1021
|
+
edits: import_v44.z.array(
|
|
1022
|
+
import_v44.z.discriminatedUnion("type", [
|
|
1023
|
+
import_v44.z.object({
|
|
1024
|
+
type: import_v44.z.literal("clear_tool_uses_20250919"),
|
|
1025
|
+
trigger: import_v44.z.discriminatedUnion("type", [
|
|
1026
|
+
import_v44.z.object({
|
|
1027
|
+
type: import_v44.z.literal("input_tokens"),
|
|
1028
|
+
value: import_v44.z.number()
|
|
934
1029
|
}),
|
|
935
|
-
|
|
936
|
-
type:
|
|
937
|
-
value:
|
|
1030
|
+
import_v44.z.object({
|
|
1031
|
+
type: import_v44.z.literal("tool_uses"),
|
|
1032
|
+
value: import_v44.z.number()
|
|
938
1033
|
})
|
|
939
1034
|
]).optional(),
|
|
940
|
-
keep:
|
|
941
|
-
type:
|
|
942
|
-
value:
|
|
1035
|
+
keep: import_v44.z.object({
|
|
1036
|
+
type: import_v44.z.literal("tool_uses"),
|
|
1037
|
+
value: import_v44.z.number()
|
|
943
1038
|
}).optional(),
|
|
944
|
-
clearAtLeast:
|
|
945
|
-
type:
|
|
946
|
-
value:
|
|
1039
|
+
clearAtLeast: import_v44.z.object({
|
|
1040
|
+
type: import_v44.z.literal("input_tokens"),
|
|
1041
|
+
value: import_v44.z.number()
|
|
947
1042
|
}).optional(),
|
|
948
|
-
clearToolInputs:
|
|
949
|
-
excludeTools:
|
|
1043
|
+
clearToolInputs: import_v44.z.boolean().optional(),
|
|
1044
|
+
excludeTools: import_v44.z.array(import_v44.z.string()).optional()
|
|
950
1045
|
}),
|
|
951
|
-
|
|
952
|
-
type:
|
|
953
|
-
keep:
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
type:
|
|
957
|
-
value:
|
|
1046
|
+
import_v44.z.object({
|
|
1047
|
+
type: import_v44.z.literal("clear_thinking_20251015"),
|
|
1048
|
+
keep: import_v44.z.union([
|
|
1049
|
+
import_v44.z.literal("all"),
|
|
1050
|
+
import_v44.z.object({
|
|
1051
|
+
type: import_v44.z.literal("thinking_turns"),
|
|
1052
|
+
value: import_v44.z.number()
|
|
958
1053
|
})
|
|
959
1054
|
]).optional()
|
|
960
1055
|
}),
|
|
961
|
-
|
|
962
|
-
type:
|
|
963
|
-
trigger:
|
|
964
|
-
type:
|
|
965
|
-
value:
|
|
1056
|
+
import_v44.z.object({
|
|
1057
|
+
type: import_v44.z.literal("compact_20260112"),
|
|
1058
|
+
trigger: import_v44.z.object({
|
|
1059
|
+
type: import_v44.z.literal("input_tokens"),
|
|
1060
|
+
value: import_v44.z.number()
|
|
966
1061
|
}).optional(),
|
|
967
|
-
pauseAfterCompaction:
|
|
968
|
-
instructions:
|
|
1062
|
+
pauseAfterCompaction: import_v44.z.boolean().optional(),
|
|
1063
|
+
instructions: import_v44.z.string().optional()
|
|
969
1064
|
})
|
|
970
1065
|
])
|
|
971
1066
|
)
|
|
@@ -1018,91 +1113,42 @@ var CacheControlValidator = class {
|
|
|
1018
1113
|
};
|
|
1019
1114
|
|
|
1020
1115
|
// src/tool/text-editor_20250728.ts
|
|
1021
|
-
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
1022
|
-
var import_v44 = require("zod/v4");
|
|
1023
1116
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1024
|
-
var textEditor_20250728ArgsSchema = (0, import_provider_utils4.lazySchema)(
|
|
1025
|
-
() => (0, import_provider_utils4.zodSchema)(
|
|
1026
|
-
import_v44.z.object({
|
|
1027
|
-
maxCharacters: import_v44.z.number().optional()
|
|
1028
|
-
})
|
|
1029
|
-
)
|
|
1030
|
-
);
|
|
1031
|
-
var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
|
|
1032
|
-
() => (0, import_provider_utils4.zodSchema)(
|
|
1033
|
-
import_v44.z.object({
|
|
1034
|
-
command: import_v44.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1035
|
-
path: import_v44.z.string(),
|
|
1036
|
-
file_text: import_v44.z.string().optional(),
|
|
1037
|
-
insert_line: import_v44.z.number().int().optional(),
|
|
1038
|
-
new_str: import_v44.z.string().optional(),
|
|
1039
|
-
insert_text: import_v44.z.string().optional(),
|
|
1040
|
-
old_str: import_v44.z.string().optional(),
|
|
1041
|
-
view_range: import_v44.z.array(import_v44.z.number().int()).optional()
|
|
1042
|
-
})
|
|
1043
|
-
)
|
|
1044
|
-
);
|
|
1045
|
-
var factory = (0, import_provider_utils3.createProviderToolFactory)({
|
|
1046
|
-
id: "anthropic.text_editor_20250728",
|
|
1047
|
-
inputSchema: textEditor_20250728InputSchema
|
|
1048
|
-
});
|
|
1049
|
-
var textEditor_20250728 = (args = {}) => {
|
|
1050
|
-
return factory(args);
|
|
1051
|
-
};
|
|
1052
|
-
|
|
1053
|
-
// src/tool/web-search_20260209.ts
|
|
1054
|
-
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1055
1117
|
var import_v45 = require("zod/v4");
|
|
1056
|
-
var
|
|
1118
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
1119
|
+
var textEditor_20250728ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
1057
1120
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1058
1121
|
import_v45.z.object({
|
|
1059
|
-
|
|
1060
|
-
allowedDomains: import_v45.z.array(import_v45.z.string()).optional(),
|
|
1061
|
-
blockedDomains: import_v45.z.array(import_v45.z.string()).optional(),
|
|
1062
|
-
userLocation: import_v45.z.object({
|
|
1063
|
-
type: import_v45.z.literal("approximate"),
|
|
1064
|
-
city: import_v45.z.string().optional(),
|
|
1065
|
-
region: import_v45.z.string().optional(),
|
|
1066
|
-
country: import_v45.z.string().optional(),
|
|
1067
|
-
timezone: import_v45.z.string().optional()
|
|
1068
|
-
}).optional()
|
|
1122
|
+
maxCharacters: import_v45.z.number().optional()
|
|
1069
1123
|
})
|
|
1070
1124
|
)
|
|
1071
1125
|
);
|
|
1072
|
-
var
|
|
1073
|
-
() => (0, import_provider_utils5.zodSchema)(
|
|
1074
|
-
import_v45.z.array(
|
|
1075
|
-
import_v45.z.object({
|
|
1076
|
-
url: import_v45.z.string(),
|
|
1077
|
-
title: import_v45.z.string().nullable(),
|
|
1078
|
-
pageAge: import_v45.z.string().nullable(),
|
|
1079
|
-
encryptedContent: import_v45.z.string(),
|
|
1080
|
-
type: import_v45.z.literal("web_search_result")
|
|
1081
|
-
})
|
|
1082
|
-
)
|
|
1083
|
-
)
|
|
1084
|
-
);
|
|
1085
|
-
var webSearch_20260209InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1126
|
+
var textEditor_20250728InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1086
1127
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1087
1128
|
import_v45.z.object({
|
|
1088
|
-
|
|
1129
|
+
command: import_v45.z.enum(["view", "create", "str_replace", "insert"]),
|
|
1130
|
+
path: import_v45.z.string(),
|
|
1131
|
+
file_text: import_v45.z.string().optional(),
|
|
1132
|
+
insert_line: import_v45.z.number().int().optional(),
|
|
1133
|
+
new_str: import_v45.z.string().optional(),
|
|
1134
|
+
insert_text: import_v45.z.string().optional(),
|
|
1135
|
+
old_str: import_v45.z.string().optional(),
|
|
1136
|
+
view_range: import_v45.z.array(import_v45.z.number().int()).optional()
|
|
1089
1137
|
})
|
|
1090
1138
|
)
|
|
1091
1139
|
);
|
|
1092
|
-
var
|
|
1093
|
-
id: "anthropic.
|
|
1094
|
-
inputSchema:
|
|
1095
|
-
outputSchema: webSearch_20260209OutputSchema,
|
|
1096
|
-
supportsDeferredResults: true
|
|
1140
|
+
var factory = (0, import_provider_utils4.createProviderToolFactory)({
|
|
1141
|
+
id: "anthropic.text_editor_20250728",
|
|
1142
|
+
inputSchema: textEditor_20250728InputSchema
|
|
1097
1143
|
});
|
|
1098
|
-
var
|
|
1099
|
-
return
|
|
1144
|
+
var textEditor_20250728 = (args = {}) => {
|
|
1145
|
+
return factory(args);
|
|
1100
1146
|
};
|
|
1101
1147
|
|
|
1102
|
-
// src/tool/web-
|
|
1148
|
+
// src/tool/web-search_20260209.ts
|
|
1103
1149
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1104
1150
|
var import_v46 = require("zod/v4");
|
|
1105
|
-
var
|
|
1151
|
+
var webSearch_20260209ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
1106
1152
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1107
1153
|
import_v46.z.object({
|
|
1108
1154
|
maxUses: import_v46.z.number().optional(),
|
|
@@ -1118,7 +1164,7 @@ var webSearch_20250305ArgsSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1118
1164
|
})
|
|
1119
1165
|
)
|
|
1120
1166
|
);
|
|
1121
|
-
var
|
|
1167
|
+
var webSearch_20260209OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1122
1168
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1123
1169
|
import_v46.z.array(
|
|
1124
1170
|
import_v46.z.object({
|
|
@@ -1131,84 +1177,76 @@ var webSearch_20250305OutputSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1131
1177
|
)
|
|
1132
1178
|
)
|
|
1133
1179
|
);
|
|
1134
|
-
var
|
|
1180
|
+
var webSearch_20260209InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
1135
1181
|
() => (0, import_provider_utils6.zodSchema)(
|
|
1136
1182
|
import_v46.z.object({
|
|
1137
1183
|
query: import_v46.z.string()
|
|
1138
1184
|
})
|
|
1139
1185
|
)
|
|
1140
1186
|
);
|
|
1141
|
-
var
|
|
1142
|
-
id: "anthropic.
|
|
1143
|
-
inputSchema:
|
|
1144
|
-
outputSchema:
|
|
1187
|
+
var factory2 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
|
|
1188
|
+
id: "anthropic.web_search_20260209",
|
|
1189
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1190
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1145
1191
|
supportsDeferredResults: true
|
|
1146
1192
|
});
|
|
1147
|
-
var
|
|
1148
|
-
return
|
|
1193
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1194
|
+
return factory2(args);
|
|
1149
1195
|
};
|
|
1150
1196
|
|
|
1151
|
-
// src/tool/web-
|
|
1197
|
+
// src/tool/web-search_20250305.ts
|
|
1152
1198
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1153
1199
|
var import_v47 = require("zod/v4");
|
|
1154
|
-
var
|
|
1200
|
+
var webSearch_20250305ArgsSchema = (0, import_provider_utils7.lazySchema)(
|
|
1155
1201
|
() => (0, import_provider_utils7.zodSchema)(
|
|
1156
1202
|
import_v47.z.object({
|
|
1157
1203
|
maxUses: import_v47.z.number().optional(),
|
|
1158
1204
|
allowedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1159
1205
|
blockedDomains: import_v47.z.array(import_v47.z.string()).optional(),
|
|
1160
|
-
|
|
1161
|
-
|
|
1206
|
+
userLocation: import_v47.z.object({
|
|
1207
|
+
type: import_v47.z.literal("approximate"),
|
|
1208
|
+
city: import_v47.z.string().optional(),
|
|
1209
|
+
region: import_v47.z.string().optional(),
|
|
1210
|
+
country: import_v47.z.string().optional(),
|
|
1211
|
+
timezone: import_v47.z.string().optional()
|
|
1212
|
+
}).optional()
|
|
1162
1213
|
})
|
|
1163
1214
|
)
|
|
1164
1215
|
);
|
|
1165
|
-
var
|
|
1216
|
+
var webSearch_20250305OutputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1166
1217
|
() => (0, import_provider_utils7.zodSchema)(
|
|
1167
|
-
import_v47.z.
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
content: import_v47.z.object({
|
|
1171
|
-
type: import_v47.z.literal("document"),
|
|
1218
|
+
import_v47.z.array(
|
|
1219
|
+
import_v47.z.object({
|
|
1220
|
+
url: import_v47.z.string(),
|
|
1172
1221
|
title: import_v47.z.string().nullable(),
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
data: import_v47.z.string()
|
|
1179
|
-
}),
|
|
1180
|
-
import_v47.z.object({
|
|
1181
|
-
type: import_v47.z.literal("text"),
|
|
1182
|
-
mediaType: import_v47.z.literal("text/plain"),
|
|
1183
|
-
data: import_v47.z.string()
|
|
1184
|
-
})
|
|
1185
|
-
])
|
|
1186
|
-
}),
|
|
1187
|
-
retrievedAt: import_v47.z.string().nullable()
|
|
1188
|
-
})
|
|
1222
|
+
pageAge: import_v47.z.string().nullable(),
|
|
1223
|
+
encryptedContent: import_v47.z.string(),
|
|
1224
|
+
type: import_v47.z.literal("web_search_result")
|
|
1225
|
+
})
|
|
1226
|
+
)
|
|
1189
1227
|
)
|
|
1190
1228
|
);
|
|
1191
|
-
var
|
|
1229
|
+
var webSearch_20250305InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
1192
1230
|
() => (0, import_provider_utils7.zodSchema)(
|
|
1193
1231
|
import_v47.z.object({
|
|
1194
|
-
|
|
1232
|
+
query: import_v47.z.string()
|
|
1195
1233
|
})
|
|
1196
1234
|
)
|
|
1197
1235
|
);
|
|
1198
|
-
var
|
|
1199
|
-
id: "anthropic.
|
|
1200
|
-
inputSchema:
|
|
1201
|
-
outputSchema:
|
|
1236
|
+
var factory3 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1237
|
+
id: "anthropic.web_search_20250305",
|
|
1238
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1239
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1202
1240
|
supportsDeferredResults: true
|
|
1203
1241
|
});
|
|
1204
|
-
var
|
|
1205
|
-
return
|
|
1242
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1243
|
+
return factory3(args);
|
|
1206
1244
|
};
|
|
1207
1245
|
|
|
1208
|
-
// src/tool/web-fetch-
|
|
1246
|
+
// src/tool/web-fetch-20260209.ts
|
|
1209
1247
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1210
1248
|
var import_v48 = require("zod/v4");
|
|
1211
|
-
var
|
|
1249
|
+
var webFetch_20260209ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
1212
1250
|
() => (0, import_provider_utils8.zodSchema)(
|
|
1213
1251
|
import_v48.z.object({
|
|
1214
1252
|
maxUses: import_v48.z.number().optional(),
|
|
@@ -1219,7 +1257,7 @@ var webFetch_20250910ArgsSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1219
1257
|
})
|
|
1220
1258
|
)
|
|
1221
1259
|
);
|
|
1222
|
-
var
|
|
1260
|
+
var webFetch_20260209OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1223
1261
|
() => (0, import_provider_utils8.zodSchema)(
|
|
1224
1262
|
import_v48.z.object({
|
|
1225
1263
|
type: import_v48.z.literal("web_fetch_result"),
|
|
@@ -1245,14 +1283,71 @@ var webFetch_20250910OutputSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1245
1283
|
})
|
|
1246
1284
|
)
|
|
1247
1285
|
);
|
|
1248
|
-
var
|
|
1286
|
+
var webFetch_20260209InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
1249
1287
|
() => (0, import_provider_utils8.zodSchema)(
|
|
1250
1288
|
import_v48.z.object({
|
|
1251
1289
|
url: import_v48.z.string()
|
|
1252
1290
|
})
|
|
1253
1291
|
)
|
|
1254
1292
|
);
|
|
1255
|
-
var
|
|
1293
|
+
var factory4 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1294
|
+
id: "anthropic.web_fetch_20260209",
|
|
1295
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1296
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1297
|
+
supportsDeferredResults: true
|
|
1298
|
+
});
|
|
1299
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1300
|
+
return factory4(args);
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
// src/tool/web-fetch-20250910.ts
|
|
1304
|
+
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1305
|
+
var import_v49 = require("zod/v4");
|
|
1306
|
+
var webFetch_20250910ArgsSchema = (0, import_provider_utils9.lazySchema)(
|
|
1307
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1308
|
+
import_v49.z.object({
|
|
1309
|
+
maxUses: import_v49.z.number().optional(),
|
|
1310
|
+
allowedDomains: import_v49.z.array(import_v49.z.string()).optional(),
|
|
1311
|
+
blockedDomains: import_v49.z.array(import_v49.z.string()).optional(),
|
|
1312
|
+
citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
|
|
1313
|
+
maxContentTokens: import_v49.z.number().optional()
|
|
1314
|
+
})
|
|
1315
|
+
)
|
|
1316
|
+
);
|
|
1317
|
+
var webFetch_20250910OutputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1318
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1319
|
+
import_v49.z.object({
|
|
1320
|
+
type: import_v49.z.literal("web_fetch_result"),
|
|
1321
|
+
url: import_v49.z.string(),
|
|
1322
|
+
content: import_v49.z.object({
|
|
1323
|
+
type: import_v49.z.literal("document"),
|
|
1324
|
+
title: import_v49.z.string().nullable(),
|
|
1325
|
+
citations: import_v49.z.object({ enabled: import_v49.z.boolean() }).optional(),
|
|
1326
|
+
source: import_v49.z.union([
|
|
1327
|
+
import_v49.z.object({
|
|
1328
|
+
type: import_v49.z.literal("base64"),
|
|
1329
|
+
mediaType: import_v49.z.literal("application/pdf"),
|
|
1330
|
+
data: import_v49.z.string()
|
|
1331
|
+
}),
|
|
1332
|
+
import_v49.z.object({
|
|
1333
|
+
type: import_v49.z.literal("text"),
|
|
1334
|
+
mediaType: import_v49.z.literal("text/plain"),
|
|
1335
|
+
data: import_v49.z.string()
|
|
1336
|
+
})
|
|
1337
|
+
])
|
|
1338
|
+
}),
|
|
1339
|
+
retrievedAt: import_v49.z.string().nullable()
|
|
1340
|
+
})
|
|
1341
|
+
)
|
|
1342
|
+
);
|
|
1343
|
+
var webFetch_20250910InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
1344
|
+
() => (0, import_provider_utils9.zodSchema)(
|
|
1345
|
+
import_v49.z.object({
|
|
1346
|
+
url: import_v49.z.string()
|
|
1347
|
+
})
|
|
1348
|
+
)
|
|
1349
|
+
);
|
|
1350
|
+
var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
|
|
1256
1351
|
id: "anthropic.web_fetch_20250910",
|
|
1257
1352
|
inputSchema: webFetch_20250910InputSchema,
|
|
1258
1353
|
outputSchema: webFetch_20250910OutputSchema,
|
|
@@ -1263,13 +1358,14 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1263
1358
|
};
|
|
1264
1359
|
|
|
1265
1360
|
// src/anthropic-prepare-tools.ts
|
|
1266
|
-
var
|
|
1361
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1267
1362
|
async function prepareTools({
|
|
1268
1363
|
tools,
|
|
1269
1364
|
toolChoice,
|
|
1270
1365
|
disableParallelToolUse,
|
|
1271
1366
|
cacheControlValidator,
|
|
1272
|
-
supportsStructuredOutput
|
|
1367
|
+
supportsStructuredOutput,
|
|
1368
|
+
supportsStrictTools
|
|
1273
1369
|
}) {
|
|
1274
1370
|
var _a;
|
|
1275
1371
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -1291,13 +1387,20 @@ async function prepareTools({
|
|
|
1291
1387
|
const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
|
|
1292
1388
|
const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
|
|
1293
1389
|
const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
|
|
1390
|
+
if (!supportsStrictTools && tool.strict != null) {
|
|
1391
|
+
toolWarnings.push({
|
|
1392
|
+
type: "unsupported",
|
|
1393
|
+
feature: "strict",
|
|
1394
|
+
details: `Tool '${tool.name}' has strict: ${tool.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1294
1397
|
anthropicTools2.push({
|
|
1295
1398
|
name: tool.name,
|
|
1296
1399
|
description: tool.description,
|
|
1297
1400
|
input_schema: tool.inputSchema,
|
|
1298
1401
|
cache_control: cacheControl,
|
|
1299
1402
|
...eagerInputStreaming ? { eager_input_streaming: true } : {},
|
|
1300
|
-
...
|
|
1403
|
+
...supportsStrictTools === true && tool.strict != null ? { strict: tool.strict } : {},
|
|
1301
1404
|
...deferLoading != null ? { defer_loading: deferLoading } : {},
|
|
1302
1405
|
...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
|
|
1303
1406
|
...tool.inputExamples != null ? {
|
|
@@ -1405,7 +1508,7 @@ async function prepareTools({
|
|
|
1405
1508
|
break;
|
|
1406
1509
|
}
|
|
1407
1510
|
case "anthropic.text_editor_20250728": {
|
|
1408
|
-
const args = await (0,
|
|
1511
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1409
1512
|
value: tool.args,
|
|
1410
1513
|
schema: textEditor_20250728ArgsSchema
|
|
1411
1514
|
});
|
|
@@ -1445,7 +1548,7 @@ async function prepareTools({
|
|
|
1445
1548
|
}
|
|
1446
1549
|
case "anthropic.web_fetch_20250910": {
|
|
1447
1550
|
betas.add("web-fetch-2025-09-10");
|
|
1448
|
-
const args = await (0,
|
|
1551
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1449
1552
|
value: tool.args,
|
|
1450
1553
|
schema: webFetch_20250910ArgsSchema
|
|
1451
1554
|
});
|
|
@@ -1463,7 +1566,7 @@ async function prepareTools({
|
|
|
1463
1566
|
}
|
|
1464
1567
|
case "anthropic.web_fetch_20260209": {
|
|
1465
1568
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1466
|
-
const args = await (0,
|
|
1569
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1467
1570
|
value: tool.args,
|
|
1468
1571
|
schema: webFetch_20260209ArgsSchema
|
|
1469
1572
|
});
|
|
@@ -1480,7 +1583,7 @@ async function prepareTools({
|
|
|
1480
1583
|
break;
|
|
1481
1584
|
}
|
|
1482
1585
|
case "anthropic.web_search_20250305": {
|
|
1483
|
-
const args = await (0,
|
|
1586
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1484
1587
|
value: tool.args,
|
|
1485
1588
|
schema: webSearch_20250305ArgsSchema
|
|
1486
1589
|
});
|
|
@@ -1497,7 +1600,7 @@ async function prepareTools({
|
|
|
1497
1600
|
}
|
|
1498
1601
|
case "anthropic.web_search_20260209": {
|
|
1499
1602
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1500
|
-
const args = await (0,
|
|
1603
|
+
const args = await (0, import_provider_utils10.validateTypes)({
|
|
1501
1604
|
value: tool.args,
|
|
1502
1605
|
schema: webSearch_20260209ArgsSchema
|
|
1503
1606
|
});
|
|
@@ -1513,7 +1616,6 @@ async function prepareTools({
|
|
|
1513
1616
|
break;
|
|
1514
1617
|
}
|
|
1515
1618
|
case "anthropic.tool_search_regex_20251119": {
|
|
1516
|
-
betas.add("advanced-tool-use-2025-11-20");
|
|
1517
1619
|
anthropicTools2.push({
|
|
1518
1620
|
type: "tool_search_tool_regex_20251119",
|
|
1519
1621
|
name: "tool_search_tool_regex"
|
|
@@ -1521,7 +1623,6 @@ async function prepareTools({
|
|
|
1521
1623
|
break;
|
|
1522
1624
|
}
|
|
1523
1625
|
case "anthropic.tool_search_bm25_20251119": {
|
|
1524
|
-
betas.add("advanced-tool-use-2025-11-20");
|
|
1525
1626
|
anthropicTools2.push({
|
|
1526
1627
|
type: "tool_search_tool_bm25_20251119",
|
|
1527
1628
|
name: "tool_search_tool_bm25"
|
|
@@ -1641,35 +1742,35 @@ function convertAnthropicMessagesUsage({
|
|
|
1641
1742
|
|
|
1642
1743
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1643
1744
|
var import_provider2 = require("@ai-sdk/provider");
|
|
1644
|
-
var
|
|
1745
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
1645
1746
|
|
|
1646
1747
|
// src/tool/code-execution_20250522.ts
|
|
1647
|
-
var
|
|
1648
|
-
var
|
|
1649
|
-
var codeExecution_20250522OutputSchema = (0,
|
|
1650
|
-
() => (0,
|
|
1651
|
-
|
|
1652
|
-
type:
|
|
1653
|
-
stdout:
|
|
1654
|
-
stderr:
|
|
1655
|
-
return_code:
|
|
1656
|
-
content:
|
|
1657
|
-
|
|
1658
|
-
type:
|
|
1659
|
-
file_id:
|
|
1748
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1749
|
+
var import_v410 = require("zod/v4");
|
|
1750
|
+
var codeExecution_20250522OutputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1751
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
1752
|
+
import_v410.z.object({
|
|
1753
|
+
type: import_v410.z.literal("code_execution_result"),
|
|
1754
|
+
stdout: import_v410.z.string(),
|
|
1755
|
+
stderr: import_v410.z.string(),
|
|
1756
|
+
return_code: import_v410.z.number(),
|
|
1757
|
+
content: import_v410.z.array(
|
|
1758
|
+
import_v410.z.object({
|
|
1759
|
+
type: import_v410.z.literal("code_execution_output"),
|
|
1760
|
+
file_id: import_v410.z.string()
|
|
1660
1761
|
})
|
|
1661
1762
|
).optional().default([])
|
|
1662
1763
|
})
|
|
1663
1764
|
)
|
|
1664
1765
|
);
|
|
1665
|
-
var codeExecution_20250522InputSchema = (0,
|
|
1666
|
-
() => (0,
|
|
1667
|
-
|
|
1668
|
-
code:
|
|
1766
|
+
var codeExecution_20250522InputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1767
|
+
() => (0, import_provider_utils11.zodSchema)(
|
|
1768
|
+
import_v410.z.object({
|
|
1769
|
+
code: import_v410.z.string()
|
|
1669
1770
|
})
|
|
1670
1771
|
)
|
|
1671
1772
|
);
|
|
1672
|
-
var factory6 = (0,
|
|
1773
|
+
var factory6 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
|
|
1673
1774
|
id: "anthropic.code_execution_20250522",
|
|
1674
1775
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1675
1776
|
outputSchema: codeExecution_20250522OutputSchema
|
|
@@ -1679,118 +1780,9 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1679
1780
|
};
|
|
1680
1781
|
|
|
1681
1782
|
// src/tool/code-execution_20250825.ts
|
|
1682
|
-
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1683
|
-
var import_v410 = require("zod/v4");
|
|
1684
|
-
var codeExecution_20250825OutputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1685
|
-
() => (0, import_provider_utils11.zodSchema)(
|
|
1686
|
-
import_v410.z.discriminatedUnion("type", [
|
|
1687
|
-
import_v410.z.object({
|
|
1688
|
-
type: import_v410.z.literal("code_execution_result"),
|
|
1689
|
-
stdout: import_v410.z.string(),
|
|
1690
|
-
stderr: import_v410.z.string(),
|
|
1691
|
-
return_code: import_v410.z.number(),
|
|
1692
|
-
content: import_v410.z.array(
|
|
1693
|
-
import_v410.z.object({
|
|
1694
|
-
type: import_v410.z.literal("code_execution_output"),
|
|
1695
|
-
file_id: import_v410.z.string()
|
|
1696
|
-
})
|
|
1697
|
-
).optional().default([])
|
|
1698
|
-
}),
|
|
1699
|
-
import_v410.z.object({
|
|
1700
|
-
type: import_v410.z.literal("bash_code_execution_result"),
|
|
1701
|
-
content: import_v410.z.array(
|
|
1702
|
-
import_v410.z.object({
|
|
1703
|
-
type: import_v410.z.literal("bash_code_execution_output"),
|
|
1704
|
-
file_id: import_v410.z.string()
|
|
1705
|
-
})
|
|
1706
|
-
),
|
|
1707
|
-
stdout: import_v410.z.string(),
|
|
1708
|
-
stderr: import_v410.z.string(),
|
|
1709
|
-
return_code: import_v410.z.number()
|
|
1710
|
-
}),
|
|
1711
|
-
import_v410.z.object({
|
|
1712
|
-
type: import_v410.z.literal("bash_code_execution_tool_result_error"),
|
|
1713
|
-
error_code: import_v410.z.string()
|
|
1714
|
-
}),
|
|
1715
|
-
import_v410.z.object({
|
|
1716
|
-
type: import_v410.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1717
|
-
error_code: import_v410.z.string()
|
|
1718
|
-
}),
|
|
1719
|
-
import_v410.z.object({
|
|
1720
|
-
type: import_v410.z.literal("text_editor_code_execution_view_result"),
|
|
1721
|
-
content: import_v410.z.string(),
|
|
1722
|
-
file_type: import_v410.z.string(),
|
|
1723
|
-
num_lines: import_v410.z.number().nullable(),
|
|
1724
|
-
start_line: import_v410.z.number().nullable(),
|
|
1725
|
-
total_lines: import_v410.z.number().nullable()
|
|
1726
|
-
}),
|
|
1727
|
-
import_v410.z.object({
|
|
1728
|
-
type: import_v410.z.literal("text_editor_code_execution_create_result"),
|
|
1729
|
-
is_file_update: import_v410.z.boolean()
|
|
1730
|
-
}),
|
|
1731
|
-
import_v410.z.object({
|
|
1732
|
-
type: import_v410.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1733
|
-
lines: import_v410.z.array(import_v410.z.string()).nullable(),
|
|
1734
|
-
new_lines: import_v410.z.number().nullable(),
|
|
1735
|
-
new_start: import_v410.z.number().nullable(),
|
|
1736
|
-
old_lines: import_v410.z.number().nullable(),
|
|
1737
|
-
old_start: import_v410.z.number().nullable()
|
|
1738
|
-
})
|
|
1739
|
-
])
|
|
1740
|
-
)
|
|
1741
|
-
);
|
|
1742
|
-
var codeExecution_20250825InputSchema = (0, import_provider_utils11.lazySchema)(
|
|
1743
|
-
() => (0, import_provider_utils11.zodSchema)(
|
|
1744
|
-
import_v410.z.discriminatedUnion("type", [
|
|
1745
|
-
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1746
|
-
import_v410.z.object({
|
|
1747
|
-
type: import_v410.z.literal("programmatic-tool-call"),
|
|
1748
|
-
code: import_v410.z.string()
|
|
1749
|
-
}),
|
|
1750
|
-
import_v410.z.object({
|
|
1751
|
-
type: import_v410.z.literal("bash_code_execution"),
|
|
1752
|
-
command: import_v410.z.string()
|
|
1753
|
-
}),
|
|
1754
|
-
import_v410.z.discriminatedUnion("command", [
|
|
1755
|
-
import_v410.z.object({
|
|
1756
|
-
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1757
|
-
command: import_v410.z.literal("view"),
|
|
1758
|
-
path: import_v410.z.string()
|
|
1759
|
-
}),
|
|
1760
|
-
import_v410.z.object({
|
|
1761
|
-
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1762
|
-
command: import_v410.z.literal("create"),
|
|
1763
|
-
path: import_v410.z.string(),
|
|
1764
|
-
file_text: import_v410.z.string().nullish()
|
|
1765
|
-
}),
|
|
1766
|
-
import_v410.z.object({
|
|
1767
|
-
type: import_v410.z.literal("text_editor_code_execution"),
|
|
1768
|
-
command: import_v410.z.literal("str_replace"),
|
|
1769
|
-
path: import_v410.z.string(),
|
|
1770
|
-
old_str: import_v410.z.string(),
|
|
1771
|
-
new_str: import_v410.z.string()
|
|
1772
|
-
})
|
|
1773
|
-
])
|
|
1774
|
-
])
|
|
1775
|
-
)
|
|
1776
|
-
);
|
|
1777
|
-
var factory7 = (0, import_provider_utils11.createProviderToolFactoryWithOutputSchema)({
|
|
1778
|
-
id: "anthropic.code_execution_20250825",
|
|
1779
|
-
inputSchema: codeExecution_20250825InputSchema,
|
|
1780
|
-
outputSchema: codeExecution_20250825OutputSchema,
|
|
1781
|
-
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
1782
|
-
// when code execution triggers a client-executed tool that needs to be
|
|
1783
|
-
// resolved before the code execution result can be returned.
|
|
1784
|
-
supportsDeferredResults: true
|
|
1785
|
-
});
|
|
1786
|
-
var codeExecution_20250825 = (args = {}) => {
|
|
1787
|
-
return factory7(args);
|
|
1788
|
-
};
|
|
1789
|
-
|
|
1790
|
-
// src/tool/code-execution_20260120.ts
|
|
1791
1783
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
1792
1784
|
var import_v411 = require("zod/v4");
|
|
1793
|
-
var
|
|
1785
|
+
var codeExecution_20250825OutputSchema = (0, import_provider_utils12.lazySchema)(
|
|
1794
1786
|
() => (0, import_provider_utils12.zodSchema)(
|
|
1795
1787
|
import_v411.z.discriminatedUnion("type", [
|
|
1796
1788
|
import_v411.z.object({
|
|
@@ -1805,18 +1797,6 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)
|
|
|
1805
1797
|
})
|
|
1806
1798
|
).optional().default([])
|
|
1807
1799
|
}),
|
|
1808
|
-
import_v411.z.object({
|
|
1809
|
-
type: import_v411.z.literal("encrypted_code_execution_result"),
|
|
1810
|
-
encrypted_stdout: import_v411.z.string(),
|
|
1811
|
-
stderr: import_v411.z.string(),
|
|
1812
|
-
return_code: import_v411.z.number(),
|
|
1813
|
-
content: import_v411.z.array(
|
|
1814
|
-
import_v411.z.object({
|
|
1815
|
-
type: import_v411.z.literal("code_execution_output"),
|
|
1816
|
-
file_id: import_v411.z.string()
|
|
1817
|
-
})
|
|
1818
|
-
).optional().default([])
|
|
1819
|
-
}),
|
|
1820
1800
|
import_v411.z.object({
|
|
1821
1801
|
type: import_v411.z.literal("bash_code_execution_result"),
|
|
1822
1802
|
content: import_v411.z.array(
|
|
@@ -1860,9 +1840,10 @@ var codeExecution_20260120OutputSchema = (0, import_provider_utils12.lazySchema)
|
|
|
1860
1840
|
])
|
|
1861
1841
|
)
|
|
1862
1842
|
);
|
|
1863
|
-
var
|
|
1843
|
+
var codeExecution_20250825InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
1864
1844
|
() => (0, import_provider_utils12.zodSchema)(
|
|
1865
1845
|
import_v411.z.discriminatedUnion("type", [
|
|
1846
|
+
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1866
1847
|
import_v411.z.object({
|
|
1867
1848
|
type: import_v411.z.literal("programmatic-tool-call"),
|
|
1868
1849
|
code: import_v411.z.string()
|
|
@@ -1894,7 +1875,127 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
|
1894
1875
|
])
|
|
1895
1876
|
)
|
|
1896
1877
|
);
|
|
1897
|
-
var
|
|
1878
|
+
var factory7 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
1879
|
+
id: "anthropic.code_execution_20250825",
|
|
1880
|
+
inputSchema: codeExecution_20250825InputSchema,
|
|
1881
|
+
outputSchema: codeExecution_20250825OutputSchema,
|
|
1882
|
+
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
1883
|
+
// when code execution triggers a client-executed tool that needs to be
|
|
1884
|
+
// resolved before the code execution result can be returned.
|
|
1885
|
+
supportsDeferredResults: true
|
|
1886
|
+
});
|
|
1887
|
+
var codeExecution_20250825 = (args = {}) => {
|
|
1888
|
+
return factory7(args);
|
|
1889
|
+
};
|
|
1890
|
+
|
|
1891
|
+
// src/tool/code-execution_20260120.ts
|
|
1892
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
1893
|
+
var import_v412 = require("zod/v4");
|
|
1894
|
+
var codeExecution_20260120OutputSchema = (0, import_provider_utils13.lazySchema)(
|
|
1895
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1896
|
+
import_v412.z.discriminatedUnion("type", [
|
|
1897
|
+
import_v412.z.object({
|
|
1898
|
+
type: import_v412.z.literal("code_execution_result"),
|
|
1899
|
+
stdout: import_v412.z.string(),
|
|
1900
|
+
stderr: import_v412.z.string(),
|
|
1901
|
+
return_code: import_v412.z.number(),
|
|
1902
|
+
content: import_v412.z.array(
|
|
1903
|
+
import_v412.z.object({
|
|
1904
|
+
type: import_v412.z.literal("code_execution_output"),
|
|
1905
|
+
file_id: import_v412.z.string()
|
|
1906
|
+
})
|
|
1907
|
+
).optional().default([])
|
|
1908
|
+
}),
|
|
1909
|
+
import_v412.z.object({
|
|
1910
|
+
type: import_v412.z.literal("encrypted_code_execution_result"),
|
|
1911
|
+
encrypted_stdout: import_v412.z.string(),
|
|
1912
|
+
stderr: import_v412.z.string(),
|
|
1913
|
+
return_code: import_v412.z.number(),
|
|
1914
|
+
content: import_v412.z.array(
|
|
1915
|
+
import_v412.z.object({
|
|
1916
|
+
type: import_v412.z.literal("code_execution_output"),
|
|
1917
|
+
file_id: import_v412.z.string()
|
|
1918
|
+
})
|
|
1919
|
+
).optional().default([])
|
|
1920
|
+
}),
|
|
1921
|
+
import_v412.z.object({
|
|
1922
|
+
type: import_v412.z.literal("bash_code_execution_result"),
|
|
1923
|
+
content: import_v412.z.array(
|
|
1924
|
+
import_v412.z.object({
|
|
1925
|
+
type: import_v412.z.literal("bash_code_execution_output"),
|
|
1926
|
+
file_id: import_v412.z.string()
|
|
1927
|
+
})
|
|
1928
|
+
),
|
|
1929
|
+
stdout: import_v412.z.string(),
|
|
1930
|
+
stderr: import_v412.z.string(),
|
|
1931
|
+
return_code: import_v412.z.number()
|
|
1932
|
+
}),
|
|
1933
|
+
import_v412.z.object({
|
|
1934
|
+
type: import_v412.z.literal("bash_code_execution_tool_result_error"),
|
|
1935
|
+
error_code: import_v412.z.string()
|
|
1936
|
+
}),
|
|
1937
|
+
import_v412.z.object({
|
|
1938
|
+
type: import_v412.z.literal("text_editor_code_execution_tool_result_error"),
|
|
1939
|
+
error_code: import_v412.z.string()
|
|
1940
|
+
}),
|
|
1941
|
+
import_v412.z.object({
|
|
1942
|
+
type: import_v412.z.literal("text_editor_code_execution_view_result"),
|
|
1943
|
+
content: import_v412.z.string(),
|
|
1944
|
+
file_type: import_v412.z.string(),
|
|
1945
|
+
num_lines: import_v412.z.number().nullable(),
|
|
1946
|
+
start_line: import_v412.z.number().nullable(),
|
|
1947
|
+
total_lines: import_v412.z.number().nullable()
|
|
1948
|
+
}),
|
|
1949
|
+
import_v412.z.object({
|
|
1950
|
+
type: import_v412.z.literal("text_editor_code_execution_create_result"),
|
|
1951
|
+
is_file_update: import_v412.z.boolean()
|
|
1952
|
+
}),
|
|
1953
|
+
import_v412.z.object({
|
|
1954
|
+
type: import_v412.z.literal("text_editor_code_execution_str_replace_result"),
|
|
1955
|
+
lines: import_v412.z.array(import_v412.z.string()).nullable(),
|
|
1956
|
+
new_lines: import_v412.z.number().nullable(),
|
|
1957
|
+
new_start: import_v412.z.number().nullable(),
|
|
1958
|
+
old_lines: import_v412.z.number().nullable(),
|
|
1959
|
+
old_start: import_v412.z.number().nullable()
|
|
1960
|
+
})
|
|
1961
|
+
])
|
|
1962
|
+
)
|
|
1963
|
+
);
|
|
1964
|
+
var codeExecution_20260120InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
1965
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
1966
|
+
import_v412.z.discriminatedUnion("type", [
|
|
1967
|
+
import_v412.z.object({
|
|
1968
|
+
type: import_v412.z.literal("programmatic-tool-call"),
|
|
1969
|
+
code: import_v412.z.string()
|
|
1970
|
+
}),
|
|
1971
|
+
import_v412.z.object({
|
|
1972
|
+
type: import_v412.z.literal("bash_code_execution"),
|
|
1973
|
+
command: import_v412.z.string()
|
|
1974
|
+
}),
|
|
1975
|
+
import_v412.z.discriminatedUnion("command", [
|
|
1976
|
+
import_v412.z.object({
|
|
1977
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
1978
|
+
command: import_v412.z.literal("view"),
|
|
1979
|
+
path: import_v412.z.string()
|
|
1980
|
+
}),
|
|
1981
|
+
import_v412.z.object({
|
|
1982
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
1983
|
+
command: import_v412.z.literal("create"),
|
|
1984
|
+
path: import_v412.z.string(),
|
|
1985
|
+
file_text: import_v412.z.string().nullish()
|
|
1986
|
+
}),
|
|
1987
|
+
import_v412.z.object({
|
|
1988
|
+
type: import_v412.z.literal("text_editor_code_execution"),
|
|
1989
|
+
command: import_v412.z.literal("str_replace"),
|
|
1990
|
+
path: import_v412.z.string(),
|
|
1991
|
+
old_str: import_v412.z.string(),
|
|
1992
|
+
new_str: import_v412.z.string()
|
|
1993
|
+
})
|
|
1994
|
+
])
|
|
1995
|
+
])
|
|
1996
|
+
)
|
|
1997
|
+
);
|
|
1998
|
+
var factory8 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
|
|
1898
1999
|
id: "anthropic.code_execution_20260120",
|
|
1899
2000
|
inputSchema: codeExecution_20260120InputSchema,
|
|
1900
2001
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
@@ -1905,21 +2006,21 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
1905
2006
|
};
|
|
1906
2007
|
|
|
1907
2008
|
// src/tool/tool-search-regex_20251119.ts
|
|
1908
|
-
var
|
|
1909
|
-
var
|
|
1910
|
-
var toolSearchRegex_20251119OutputSchema = (0,
|
|
1911
|
-
() => (0,
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
type:
|
|
1915
|
-
toolName:
|
|
2009
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
2010
|
+
var import_v413 = require("zod/v4");
|
|
2011
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2012
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2013
|
+
import_v413.z.array(
|
|
2014
|
+
import_v413.z.object({
|
|
2015
|
+
type: import_v413.z.literal("tool_reference"),
|
|
2016
|
+
toolName: import_v413.z.string()
|
|
1916
2017
|
})
|
|
1917
2018
|
)
|
|
1918
2019
|
)
|
|
1919
2020
|
);
|
|
1920
|
-
var toolSearchRegex_20251119InputSchema = (0,
|
|
1921
|
-
() => (0,
|
|
1922
|
-
|
|
2021
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
2022
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
2023
|
+
import_v413.z.object({
|
|
1923
2024
|
/**
|
|
1924
2025
|
* A regex pattern to search for tools.
|
|
1925
2026
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -1930,15 +2031,15 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema
|
|
|
1930
2031
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1931
2032
|
* - "(?i)slack" - case-insensitive search
|
|
1932
2033
|
*/
|
|
1933
|
-
pattern:
|
|
2034
|
+
pattern: import_v413.z.string(),
|
|
1934
2035
|
/**
|
|
1935
2036
|
* Maximum number of tools to return. Optional.
|
|
1936
2037
|
*/
|
|
1937
|
-
limit:
|
|
2038
|
+
limit: import_v413.z.number().optional()
|
|
1938
2039
|
})
|
|
1939
2040
|
)
|
|
1940
2041
|
);
|
|
1941
|
-
var factory9 = (0,
|
|
2042
|
+
var factory9 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
1942
2043
|
id: "anthropic.tool_search_regex_20251119",
|
|
1943
2044
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
1944
2045
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
@@ -1951,7 +2052,7 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
1951
2052
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1952
2053
|
function convertToString(data) {
|
|
1953
2054
|
if (typeof data === "string") {
|
|
1954
|
-
return new TextDecoder().decode((0,
|
|
2055
|
+
return new TextDecoder().decode((0, import_provider_utils15.convertBase64ToUint8Array)(data));
|
|
1955
2056
|
}
|
|
1956
2057
|
if (data instanceof Uint8Array) {
|
|
1957
2058
|
return new TextDecoder().decode(data);
|
|
@@ -1989,7 +2090,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1989
2090
|
const messages = [];
|
|
1990
2091
|
async function shouldEnableCitations(providerMetadata) {
|
|
1991
2092
|
var _a2, _b2;
|
|
1992
|
-
const anthropicOptions = await (0,
|
|
2093
|
+
const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
|
|
1993
2094
|
provider: "anthropic",
|
|
1994
2095
|
providerOptions: providerMetadata,
|
|
1995
2096
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1997,7 +2098,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1997
2098
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
1998
2099
|
}
|
|
1999
2100
|
async function getDocumentMetadata(providerMetadata) {
|
|
2000
|
-
const anthropicOptions = await (0,
|
|
2101
|
+
const anthropicOptions = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2001
2102
|
provider: "anthropic",
|
|
2002
2103
|
providerOptions: providerMetadata,
|
|
2003
2104
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2054,7 +2155,26 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2054
2155
|
break;
|
|
2055
2156
|
}
|
|
2056
2157
|
case "file": {
|
|
2057
|
-
if (part.
|
|
2158
|
+
if ((0, import_provider_utils15.isProviderReference)(part.data)) {
|
|
2159
|
+
const fileId = (0, import_provider_utils15.resolveProviderReference)({
|
|
2160
|
+
reference: part.data,
|
|
2161
|
+
provider: "anthropic"
|
|
2162
|
+
});
|
|
2163
|
+
betas.add("files-api-2025-04-14");
|
|
2164
|
+
if (part.mediaType.startsWith("image/")) {
|
|
2165
|
+
anthropicContent.push({
|
|
2166
|
+
type: "image",
|
|
2167
|
+
source: { type: "file", file_id: fileId },
|
|
2168
|
+
cache_control: cacheControl
|
|
2169
|
+
});
|
|
2170
|
+
} else {
|
|
2171
|
+
anthropicContent.push({
|
|
2172
|
+
type: "document",
|
|
2173
|
+
source: { type: "file", file_id: fileId },
|
|
2174
|
+
cache_control: cacheControl
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
} else if (part.mediaType.startsWith("image/")) {
|
|
2058
2178
|
anthropicContent.push({
|
|
2059
2179
|
type: "image",
|
|
2060
2180
|
source: isUrlData(part.data) ? {
|
|
@@ -2063,7 +2183,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2063
2183
|
} : {
|
|
2064
2184
|
type: "base64",
|
|
2065
2185
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
2066
|
-
data: (0,
|
|
2186
|
+
data: (0, import_provider_utils15.convertToBase64)(part.data)
|
|
2067
2187
|
},
|
|
2068
2188
|
cache_control: cacheControl
|
|
2069
2189
|
});
|
|
@@ -2083,7 +2203,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2083
2203
|
} : {
|
|
2084
2204
|
type: "base64",
|
|
2085
2205
|
media_type: "application/pdf",
|
|
2086
|
-
data: (0,
|
|
2206
|
+
data: (0, import_provider_utils15.convertToBase64)(part.data)
|
|
2087
2207
|
},
|
|
2088
2208
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
2089
2209
|
...metadata.context && { context: metadata.context },
|
|
@@ -2221,7 +2341,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2221
2341
|
return void 0;
|
|
2222
2342
|
}
|
|
2223
2343
|
}
|
|
2224
|
-
}).filter(
|
|
2344
|
+
}).filter(import_provider_utils15.isNonNullable);
|
|
2225
2345
|
break;
|
|
2226
2346
|
case "text":
|
|
2227
2347
|
case "error-text":
|
|
@@ -2297,7 +2417,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2297
2417
|
}
|
|
2298
2418
|
case "reasoning": {
|
|
2299
2419
|
if (sendReasoning) {
|
|
2300
|
-
const reasoningMetadata = await (0,
|
|
2420
|
+
const reasoningMetadata = await (0, import_provider_utils15.parseProviderOptions)({
|
|
2301
2421
|
provider: "anthropic",
|
|
2302
2422
|
providerOptions: part.providerOptions,
|
|
2303
2423
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -2503,7 +2623,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2503
2623
|
break;
|
|
2504
2624
|
}
|
|
2505
2625
|
if (output.value.type === "code_execution_result") {
|
|
2506
|
-
const codeExecutionOutput = await (0,
|
|
2626
|
+
const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2507
2627
|
value: output.value,
|
|
2508
2628
|
schema: codeExecution_20250522OutputSchema
|
|
2509
2629
|
});
|
|
@@ -2520,7 +2640,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2520
2640
|
cache_control: cacheControl
|
|
2521
2641
|
});
|
|
2522
2642
|
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
2523
|
-
const codeExecutionOutput = await (0,
|
|
2643
|
+
const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2524
2644
|
value: output.value,
|
|
2525
2645
|
schema: codeExecution_20260120OutputSchema
|
|
2526
2646
|
});
|
|
@@ -2539,7 +2659,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2539
2659
|
});
|
|
2540
2660
|
}
|
|
2541
2661
|
} else {
|
|
2542
|
-
const codeExecutionOutput = await (0,
|
|
2662
|
+
const codeExecutionOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2543
2663
|
value: output.value,
|
|
2544
2664
|
schema: codeExecution_20250825OutputSchema
|
|
2545
2665
|
});
|
|
@@ -2608,7 +2728,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2608
2728
|
});
|
|
2609
2729
|
break;
|
|
2610
2730
|
}
|
|
2611
|
-
const webFetchOutput = await (0,
|
|
2731
|
+
const webFetchOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2612
2732
|
value: output.value,
|
|
2613
2733
|
schema: webFetch_20250910OutputSchema
|
|
2614
2734
|
});
|
|
@@ -2643,7 +2763,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2643
2763
|
});
|
|
2644
2764
|
break;
|
|
2645
2765
|
}
|
|
2646
|
-
const webSearchOutput = await (0,
|
|
2766
|
+
const webSearchOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2647
2767
|
value: output.value,
|
|
2648
2768
|
schema: webSearch_20250305OutputSchema
|
|
2649
2769
|
});
|
|
@@ -2670,7 +2790,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2670
2790
|
});
|
|
2671
2791
|
break;
|
|
2672
2792
|
}
|
|
2673
|
-
const toolSearchOutput = await (0,
|
|
2793
|
+
const toolSearchOutput = await (0, import_provider_utils15.validateTypes)({
|
|
2674
2794
|
value: output.value,
|
|
2675
2795
|
schema: toolSearchRegex_20251119OutputSchema
|
|
2676
2796
|
});
|
|
@@ -2830,11 +2950,11 @@ function createCitationSource(citation, citationDocuments, generateId3) {
|
|
|
2830
2950
|
}
|
|
2831
2951
|
var AnthropicMessagesLanguageModel = class {
|
|
2832
2952
|
constructor(modelId, config) {
|
|
2833
|
-
this.specificationVersion = "
|
|
2953
|
+
this.specificationVersion = "v4";
|
|
2834
2954
|
var _a;
|
|
2835
2955
|
this.modelId = modelId;
|
|
2836
2956
|
this.config = config;
|
|
2837
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
2957
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils16.generateId;
|
|
2838
2958
|
}
|
|
2839
2959
|
supportsUrl(url) {
|
|
2840
2960
|
return url.protocol === "https:";
|
|
@@ -2869,10 +2989,11 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2869
2989
|
seed,
|
|
2870
2990
|
tools,
|
|
2871
2991
|
toolChoice,
|
|
2992
|
+
reasoning,
|
|
2872
2993
|
providerOptions,
|
|
2873
2994
|
stream
|
|
2874
2995
|
}) {
|
|
2875
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
2996
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2876
2997
|
const warnings = [];
|
|
2877
2998
|
if (frequencyPenalty != null) {
|
|
2878
2999
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -2908,12 +3029,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2908
3029
|
}
|
|
2909
3030
|
}
|
|
2910
3031
|
const providerOptionsName = this.providerOptionsName;
|
|
2911
|
-
const canonicalOptions = await (0,
|
|
3032
|
+
const canonicalOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
2912
3033
|
provider: "anthropic",
|
|
2913
3034
|
providerOptions,
|
|
2914
3035
|
schema: anthropicLanguageModelOptions
|
|
2915
3036
|
});
|
|
2916
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0,
|
|
3037
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await (0, import_provider_utils16.parseProviderOptions)({
|
|
2917
3038
|
provider: providerOptionsName,
|
|
2918
3039
|
providerOptions,
|
|
2919
3040
|
schema: anthropicLanguageModelOptions
|
|
@@ -2927,10 +3048,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2927
3048
|
const {
|
|
2928
3049
|
maxOutputTokens: maxOutputTokensForModel,
|
|
2929
3050
|
supportsStructuredOutput: modelSupportsStructuredOutput,
|
|
3051
|
+
supportsAdaptiveThinking,
|
|
2930
3052
|
isKnownModel
|
|
2931
3053
|
} = getModelCapabilities(this.modelId);
|
|
3054
|
+
const isAnthropicModel = isKnownModel || this.modelId.startsWith("claude-");
|
|
2932
3055
|
const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
|
|
2933
|
-
const
|
|
3056
|
+
const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
|
|
3057
|
+
const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
|
|
2934
3058
|
const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
2935
3059
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
2936
3060
|
type: "function",
|
|
@@ -2940,7 +3064,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2940
3064
|
} : void 0;
|
|
2941
3065
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
2942
3066
|
const cacheControlValidator = new CacheControlValidator();
|
|
2943
|
-
const toolNameMapping = (0,
|
|
3067
|
+
const toolNameMapping = (0, import_provider_utils16.createToolNameMapping)({
|
|
2944
3068
|
tools,
|
|
2945
3069
|
providerToolNames: {
|
|
2946
3070
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -2965,14 +3089,28 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2965
3089
|
});
|
|
2966
3090
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
2967
3091
|
prompt,
|
|
2968
|
-
sendReasoning: (
|
|
3092
|
+
sendReasoning: (_d = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _d : true,
|
|
2969
3093
|
warnings,
|
|
2970
3094
|
cacheControlValidator,
|
|
2971
3095
|
toolNameMapping
|
|
2972
3096
|
});
|
|
2973
|
-
|
|
3097
|
+
if ((0, import_provider_utils16.isCustomReasoning)(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
|
|
3098
|
+
const reasoningConfig = resolveAnthropicReasoningConfig({
|
|
3099
|
+
reasoning,
|
|
3100
|
+
supportsAdaptiveThinking,
|
|
3101
|
+
maxOutputTokensForModel,
|
|
3102
|
+
warnings
|
|
3103
|
+
});
|
|
3104
|
+
if (reasoningConfig != null) {
|
|
3105
|
+
anthropicOptions.thinking = reasoningConfig.thinking;
|
|
3106
|
+
if (reasoningConfig.effort != null) {
|
|
3107
|
+
anthropicOptions.effort = reasoningConfig.effort;
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
const thinkingType = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.type;
|
|
2974
3112
|
const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
|
|
2975
|
-
let thinkingBudget = thinkingType === "enabled" ? (
|
|
3113
|
+
let thinkingBudget = thinkingType === "enabled" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.budgetTokens : void 0;
|
|
2976
3114
|
const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
|
|
2977
3115
|
const baseArgs = {
|
|
2978
3116
|
// model id:
|
|
@@ -3009,6 +3147,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3009
3147
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
3010
3148
|
cache_control: anthropicOptions.cacheControl
|
|
3011
3149
|
},
|
|
3150
|
+
...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
|
|
3151
|
+
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
3152
|
+
},
|
|
3012
3153
|
// mcp servers:
|
|
3013
3154
|
...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
|
|
3014
3155
|
mcp_servers: anthropicOptions.mcpServers.map((server) => ({
|
|
@@ -3030,7 +3171,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3030
3171
|
id: anthropicOptions.container.id,
|
|
3031
3172
|
skills: anthropicOptions.container.skills.map((skill) => ({
|
|
3032
3173
|
type: skill.type,
|
|
3033
|
-
skill_id: skill.
|
|
3174
|
+
skill_id: skill.type === "custom" ? (0, import_provider_utils16.resolveProviderReference)({
|
|
3175
|
+
reference: skill.providerReference,
|
|
3176
|
+
provider: "anthropic"
|
|
3177
|
+
}) : skill.skillId,
|
|
3034
3178
|
version: skill.version
|
|
3035
3179
|
}))
|
|
3036
3180
|
}
|
|
@@ -3132,7 +3276,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3132
3276
|
}
|
|
3133
3277
|
baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
|
|
3134
3278
|
} else {
|
|
3135
|
-
if (topP != null && temperature != null) {
|
|
3279
|
+
if (isAnthropicModel && topP != null && temperature != null) {
|
|
3136
3280
|
warnings.push({
|
|
3137
3281
|
type: "unsupported",
|
|
3138
3282
|
feature: "topP",
|
|
@@ -3179,7 +3323,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3179
3323
|
if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
|
|
3180
3324
|
betas.add("fast-mode-2026-02-01");
|
|
3181
3325
|
}
|
|
3182
|
-
if (stream && ((
|
|
3326
|
+
if (stream && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _h : true)) {
|
|
3183
3327
|
betas.add("fine-grained-tool-streaming-2025-05-14");
|
|
3184
3328
|
}
|
|
3185
3329
|
const {
|
|
@@ -3193,13 +3337,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3193
3337
|
toolChoice: { type: "required" },
|
|
3194
3338
|
disableParallelToolUse: true,
|
|
3195
3339
|
cacheControlValidator,
|
|
3196
|
-
supportsStructuredOutput: false
|
|
3340
|
+
supportsStructuredOutput: false,
|
|
3341
|
+
supportsStrictTools
|
|
3197
3342
|
} : {
|
|
3198
3343
|
tools: tools != null ? tools : [],
|
|
3199
3344
|
toolChoice,
|
|
3200
3345
|
disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
|
|
3201
3346
|
cacheControlValidator,
|
|
3202
|
-
supportsStructuredOutput
|
|
3347
|
+
supportsStructuredOutput,
|
|
3348
|
+
supportsStrictTools
|
|
3203
3349
|
}
|
|
3204
3350
|
);
|
|
3205
3351
|
const cacheWarnings = cacheControlValidator.getWarnings();
|
|
@@ -3216,7 +3362,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3216
3362
|
...betas,
|
|
3217
3363
|
...toolsBetas,
|
|
3218
3364
|
...userSuppliedBetas,
|
|
3219
|
-
...(
|
|
3365
|
+
...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
|
|
3220
3366
|
]),
|
|
3221
3367
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
3222
3368
|
toolNameMapping,
|
|
@@ -3228,15 +3374,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3228
3374
|
betas,
|
|
3229
3375
|
headers
|
|
3230
3376
|
}) {
|
|
3231
|
-
return (0,
|
|
3232
|
-
await (0,
|
|
3377
|
+
return (0, import_provider_utils16.combineHeaders)(
|
|
3378
|
+
await (0, import_provider_utils16.resolve)(this.config.headers),
|
|
3233
3379
|
headers,
|
|
3234
3380
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
3235
3381
|
);
|
|
3236
3382
|
}
|
|
3237
3383
|
async getBetasFromHeaders(requestHeaders) {
|
|
3238
3384
|
var _a, _b;
|
|
3239
|
-
const configHeaders = await (0,
|
|
3385
|
+
const configHeaders = await (0, import_provider_utils16.resolve)(this.config.headers);
|
|
3240
3386
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
3241
3387
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
3242
3388
|
return new Set(
|
|
@@ -3302,12 +3448,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3302
3448
|
responseHeaders,
|
|
3303
3449
|
value: response,
|
|
3304
3450
|
rawValue: rawResponse
|
|
3305
|
-
} = await (0,
|
|
3451
|
+
} = await (0, import_provider_utils16.postJsonToApi)({
|
|
3306
3452
|
url: this.buildRequestUrl(false),
|
|
3307
3453
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3308
3454
|
body: this.transformRequestBody(args, betas),
|
|
3309
3455
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3310
|
-
successfulResponseHandler: (0,
|
|
3456
|
+
successfulResponseHandler: (0, import_provider_utils16.createJsonResponseHandler)(
|
|
3311
3457
|
anthropicMessagesResponseSchema
|
|
3312
3458
|
),
|
|
3313
3459
|
abortSignal: options.abortSignal,
|
|
@@ -3722,12 +3868,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3722
3868
|
body.tools
|
|
3723
3869
|
);
|
|
3724
3870
|
const url = this.buildRequestUrl(true);
|
|
3725
|
-
const { responseHeaders, value: response } = await (0,
|
|
3871
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils16.postJsonToApi)({
|
|
3726
3872
|
url,
|
|
3727
3873
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3728
3874
|
body: this.transformRequestBody(body, betas),
|
|
3729
3875
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3730
|
-
successfulResponseHandler: (0,
|
|
3876
|
+
successfulResponseHandler: (0, import_provider_utils16.createEventSourceResponseHandler)(
|
|
3731
3877
|
anthropicMessagesChunkSchema
|
|
3732
3878
|
),
|
|
3733
3879
|
abortSignal: options.abortSignal,
|
|
@@ -4479,42 +4625,49 @@ function getModelCapabilities(modelId) {
|
|
|
4479
4625
|
return {
|
|
4480
4626
|
maxOutputTokens: 128e3,
|
|
4481
4627
|
supportsStructuredOutput: true,
|
|
4628
|
+
supportsAdaptiveThinking: true,
|
|
4482
4629
|
isKnownModel: true
|
|
4483
4630
|
};
|
|
4484
4631
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
4485
4632
|
return {
|
|
4486
4633
|
maxOutputTokens: 64e3,
|
|
4487
4634
|
supportsStructuredOutput: true,
|
|
4635
|
+
supportsAdaptiveThinking: false,
|
|
4488
4636
|
isKnownModel: true
|
|
4489
4637
|
};
|
|
4490
4638
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
4491
4639
|
return {
|
|
4492
4640
|
maxOutputTokens: 32e3,
|
|
4493
4641
|
supportsStructuredOutput: true,
|
|
4642
|
+
supportsAdaptiveThinking: false,
|
|
4494
4643
|
isKnownModel: true
|
|
4495
4644
|
};
|
|
4496
4645
|
} else if (modelId.includes("claude-sonnet-4-")) {
|
|
4497
4646
|
return {
|
|
4498
4647
|
maxOutputTokens: 64e3,
|
|
4499
4648
|
supportsStructuredOutput: false,
|
|
4649
|
+
supportsAdaptiveThinking: false,
|
|
4500
4650
|
isKnownModel: true
|
|
4501
4651
|
};
|
|
4502
4652
|
} else if (modelId.includes("claude-opus-4-")) {
|
|
4503
4653
|
return {
|
|
4504
4654
|
maxOutputTokens: 32e3,
|
|
4505
4655
|
supportsStructuredOutput: false,
|
|
4656
|
+
supportsAdaptiveThinking: false,
|
|
4506
4657
|
isKnownModel: true
|
|
4507
4658
|
};
|
|
4508
4659
|
} else if (modelId.includes("claude-3-haiku")) {
|
|
4509
4660
|
return {
|
|
4510
4661
|
maxOutputTokens: 4096,
|
|
4511
4662
|
supportsStructuredOutput: false,
|
|
4663
|
+
supportsAdaptiveThinking: false,
|
|
4512
4664
|
isKnownModel: true
|
|
4513
4665
|
};
|
|
4514
4666
|
} else {
|
|
4515
4667
|
return {
|
|
4516
4668
|
maxOutputTokens: 4096,
|
|
4517
4669
|
supportsStructuredOutput: false,
|
|
4670
|
+
supportsAdaptiveThinking: false,
|
|
4518
4671
|
isKnownModel: false
|
|
4519
4672
|
};
|
|
4520
4673
|
}
|
|
@@ -4537,6 +4690,43 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
|
4537
4690
|
}
|
|
4538
4691
|
return hasWebTool20260209 && !hasCodeExecutionTool;
|
|
4539
4692
|
}
|
|
4693
|
+
function resolveAnthropicReasoningConfig({
|
|
4694
|
+
reasoning,
|
|
4695
|
+
supportsAdaptiveThinking,
|
|
4696
|
+
maxOutputTokensForModel,
|
|
4697
|
+
warnings
|
|
4698
|
+
}) {
|
|
4699
|
+
if (!(0, import_provider_utils16.isCustomReasoning)(reasoning)) {
|
|
4700
|
+
return void 0;
|
|
4701
|
+
}
|
|
4702
|
+
if (reasoning === "none") {
|
|
4703
|
+
return { thinking: { type: "disabled" } };
|
|
4704
|
+
}
|
|
4705
|
+
if (supportsAdaptiveThinking) {
|
|
4706
|
+
const effort = (0, import_provider_utils16.mapReasoningToProviderEffort)({
|
|
4707
|
+
reasoning,
|
|
4708
|
+
effortMap: {
|
|
4709
|
+
minimal: "low",
|
|
4710
|
+
low: "low",
|
|
4711
|
+
medium: "medium",
|
|
4712
|
+
high: "high",
|
|
4713
|
+
xhigh: "max"
|
|
4714
|
+
},
|
|
4715
|
+
warnings
|
|
4716
|
+
});
|
|
4717
|
+
return { thinking: { type: "adaptive" }, effort };
|
|
4718
|
+
}
|
|
4719
|
+
const budgetTokens = (0, import_provider_utils16.mapReasoningToProviderBudget)({
|
|
4720
|
+
reasoning,
|
|
4721
|
+
maxOutputTokens: maxOutputTokensForModel,
|
|
4722
|
+
maxReasoningBudget: maxOutputTokensForModel,
|
|
4723
|
+
warnings
|
|
4724
|
+
});
|
|
4725
|
+
if (budgetTokens == null) {
|
|
4726
|
+
return void 0;
|
|
4727
|
+
}
|
|
4728
|
+
return { thinking: { type: "enabled", budgetTokens } };
|
|
4729
|
+
}
|
|
4540
4730
|
function mapAnthropicResponseContextManagement(contextManagement) {
|
|
4541
4731
|
return contextManagement ? {
|
|
4542
4732
|
appliedEdits: contextManagement.applied_edits.map((edit) => {
|
|
@@ -4564,44 +4754,44 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4564
4754
|
}
|
|
4565
4755
|
|
|
4566
4756
|
// src/tool/bash_20241022.ts
|
|
4567
|
-
var
|
|
4568
|
-
var
|
|
4569
|
-
var bash_20241022InputSchema = (0,
|
|
4570
|
-
() => (0,
|
|
4571
|
-
|
|
4572
|
-
command:
|
|
4573
|
-
restart:
|
|
4757
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
4758
|
+
var import_v414 = require("zod/v4");
|
|
4759
|
+
var bash_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
4760
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
4761
|
+
import_v414.z.object({
|
|
4762
|
+
command: import_v414.z.string(),
|
|
4763
|
+
restart: import_v414.z.boolean().optional()
|
|
4574
4764
|
})
|
|
4575
4765
|
)
|
|
4576
4766
|
);
|
|
4577
|
-
var bash_20241022 = (0,
|
|
4767
|
+
var bash_20241022 = (0, import_provider_utils17.createProviderToolFactory)({
|
|
4578
4768
|
id: "anthropic.bash_20241022",
|
|
4579
4769
|
inputSchema: bash_20241022InputSchema
|
|
4580
4770
|
});
|
|
4581
4771
|
|
|
4582
4772
|
// src/tool/bash_20250124.ts
|
|
4583
|
-
var
|
|
4584
|
-
var
|
|
4585
|
-
var bash_20250124InputSchema = (0,
|
|
4586
|
-
() => (0,
|
|
4587
|
-
|
|
4588
|
-
command:
|
|
4589
|
-
restart:
|
|
4773
|
+
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
4774
|
+
var import_v415 = require("zod/v4");
|
|
4775
|
+
var bash_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
4776
|
+
() => (0, import_provider_utils18.zodSchema)(
|
|
4777
|
+
import_v415.z.object({
|
|
4778
|
+
command: import_v415.z.string(),
|
|
4779
|
+
restart: import_v415.z.boolean().optional()
|
|
4590
4780
|
})
|
|
4591
4781
|
)
|
|
4592
4782
|
);
|
|
4593
|
-
var bash_20250124 = (0,
|
|
4783
|
+
var bash_20250124 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
4594
4784
|
id: "anthropic.bash_20250124",
|
|
4595
4785
|
inputSchema: bash_20250124InputSchema
|
|
4596
4786
|
});
|
|
4597
4787
|
|
|
4598
4788
|
// src/tool/computer_20241022.ts
|
|
4599
|
-
var
|
|
4600
|
-
var
|
|
4601
|
-
var computer_20241022InputSchema = (0,
|
|
4602
|
-
() => (0,
|
|
4603
|
-
|
|
4604
|
-
action:
|
|
4789
|
+
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
4790
|
+
var import_v416 = require("zod/v4");
|
|
4791
|
+
var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
4792
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
4793
|
+
import_v416.z.object({
|
|
4794
|
+
action: import_v416.z.enum([
|
|
4605
4795
|
"key",
|
|
4606
4796
|
"type",
|
|
4607
4797
|
"mouse_move",
|
|
@@ -4613,23 +4803,23 @@ var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
4613
4803
|
"screenshot",
|
|
4614
4804
|
"cursor_position"
|
|
4615
4805
|
]),
|
|
4616
|
-
coordinate:
|
|
4617
|
-
text:
|
|
4806
|
+
coordinate: import_v416.z.array(import_v416.z.number().int()).optional(),
|
|
4807
|
+
text: import_v416.z.string().optional()
|
|
4618
4808
|
})
|
|
4619
4809
|
)
|
|
4620
4810
|
);
|
|
4621
|
-
var computer_20241022 = (0,
|
|
4811
|
+
var computer_20241022 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
4622
4812
|
id: "anthropic.computer_20241022",
|
|
4623
4813
|
inputSchema: computer_20241022InputSchema
|
|
4624
4814
|
});
|
|
4625
4815
|
|
|
4626
4816
|
// src/tool/computer_20250124.ts
|
|
4627
|
-
var
|
|
4628
|
-
var
|
|
4629
|
-
var computer_20250124InputSchema = (0,
|
|
4630
|
-
() => (0,
|
|
4631
|
-
|
|
4632
|
-
action:
|
|
4817
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
4818
|
+
var import_v417 = require("zod/v4");
|
|
4819
|
+
var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
4820
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
4821
|
+
import_v417.z.object({
|
|
4822
|
+
action: import_v417.z.enum([
|
|
4633
4823
|
"key",
|
|
4634
4824
|
"hold_key",
|
|
4635
4825
|
"type",
|
|
@@ -4647,27 +4837,27 @@ var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
4647
4837
|
"wait",
|
|
4648
4838
|
"screenshot"
|
|
4649
4839
|
]),
|
|
4650
|
-
coordinate:
|
|
4651
|
-
duration:
|
|
4652
|
-
scroll_amount:
|
|
4653
|
-
scroll_direction:
|
|
4654
|
-
start_coordinate:
|
|
4655
|
-
text:
|
|
4840
|
+
coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
|
|
4841
|
+
duration: import_v417.z.number().optional(),
|
|
4842
|
+
scroll_amount: import_v417.z.number().optional(),
|
|
4843
|
+
scroll_direction: import_v417.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4844
|
+
start_coordinate: import_v417.z.tuple([import_v417.z.number().int(), import_v417.z.number().int()]).optional(),
|
|
4845
|
+
text: import_v417.z.string().optional()
|
|
4656
4846
|
})
|
|
4657
4847
|
)
|
|
4658
4848
|
);
|
|
4659
|
-
var computer_20250124 = (0,
|
|
4849
|
+
var computer_20250124 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
4660
4850
|
id: "anthropic.computer_20250124",
|
|
4661
4851
|
inputSchema: computer_20250124InputSchema
|
|
4662
4852
|
});
|
|
4663
4853
|
|
|
4664
4854
|
// src/tool/computer_20251124.ts
|
|
4665
|
-
var
|
|
4666
|
-
var
|
|
4667
|
-
var computer_20251124InputSchema = (0,
|
|
4668
|
-
() => (0,
|
|
4669
|
-
|
|
4670
|
-
action:
|
|
4855
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
4856
|
+
var import_v418 = require("zod/v4");
|
|
4857
|
+
var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
4858
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
4859
|
+
import_v418.z.object({
|
|
4860
|
+
action: import_v418.z.enum([
|
|
4671
4861
|
"key",
|
|
4672
4862
|
"hold_key",
|
|
4673
4863
|
"type",
|
|
@@ -4686,97 +4876,75 @@ var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
4686
4876
|
"screenshot",
|
|
4687
4877
|
"zoom"
|
|
4688
4878
|
]),
|
|
4689
|
-
coordinate:
|
|
4690
|
-
duration:
|
|
4691
|
-
region:
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4879
|
+
coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
|
|
4880
|
+
duration: import_v418.z.number().optional(),
|
|
4881
|
+
region: import_v418.z.tuple([
|
|
4882
|
+
import_v418.z.number().int(),
|
|
4883
|
+
import_v418.z.number().int(),
|
|
4884
|
+
import_v418.z.number().int(),
|
|
4885
|
+
import_v418.z.number().int()
|
|
4696
4886
|
]).optional(),
|
|
4697
|
-
scroll_amount:
|
|
4698
|
-
scroll_direction:
|
|
4699
|
-
start_coordinate:
|
|
4700
|
-
text:
|
|
4887
|
+
scroll_amount: import_v418.z.number().optional(),
|
|
4888
|
+
scroll_direction: import_v418.z.enum(["up", "down", "left", "right"]).optional(),
|
|
4889
|
+
start_coordinate: import_v418.z.tuple([import_v418.z.number().int(), import_v418.z.number().int()]).optional(),
|
|
4890
|
+
text: import_v418.z.string().optional()
|
|
4701
4891
|
})
|
|
4702
4892
|
)
|
|
4703
4893
|
);
|
|
4704
|
-
var computer_20251124 = (0,
|
|
4894
|
+
var computer_20251124 = (0, import_provider_utils21.createProviderToolFactory)({
|
|
4705
4895
|
id: "anthropic.computer_20251124",
|
|
4706
4896
|
inputSchema: computer_20251124InputSchema
|
|
4707
4897
|
});
|
|
4708
4898
|
|
|
4709
4899
|
// src/tool/memory_20250818.ts
|
|
4710
|
-
var
|
|
4711
|
-
var
|
|
4712
|
-
var memory_20250818InputSchema = (0,
|
|
4713
|
-
() => (0,
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
command:
|
|
4717
|
-
path:
|
|
4718
|
-
view_range:
|
|
4900
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
4901
|
+
var import_v419 = require("zod/v4");
|
|
4902
|
+
var memory_20250818InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
4903
|
+
() => (0, import_provider_utils22.zodSchema)(
|
|
4904
|
+
import_v419.z.discriminatedUnion("command", [
|
|
4905
|
+
import_v419.z.object({
|
|
4906
|
+
command: import_v419.z.literal("view"),
|
|
4907
|
+
path: import_v419.z.string(),
|
|
4908
|
+
view_range: import_v419.z.tuple([import_v419.z.number(), import_v419.z.number()]).optional()
|
|
4719
4909
|
}),
|
|
4720
|
-
|
|
4721
|
-
command:
|
|
4722
|
-
path:
|
|
4723
|
-
file_text:
|
|
4910
|
+
import_v419.z.object({
|
|
4911
|
+
command: import_v419.z.literal("create"),
|
|
4912
|
+
path: import_v419.z.string(),
|
|
4913
|
+
file_text: import_v419.z.string()
|
|
4724
4914
|
}),
|
|
4725
|
-
|
|
4726
|
-
command:
|
|
4727
|
-
path:
|
|
4728
|
-
old_str:
|
|
4729
|
-
new_str:
|
|
4915
|
+
import_v419.z.object({
|
|
4916
|
+
command: import_v419.z.literal("str_replace"),
|
|
4917
|
+
path: import_v419.z.string(),
|
|
4918
|
+
old_str: import_v419.z.string(),
|
|
4919
|
+
new_str: import_v419.z.string()
|
|
4730
4920
|
}),
|
|
4731
|
-
|
|
4732
|
-
command:
|
|
4733
|
-
path:
|
|
4734
|
-
insert_line:
|
|
4735
|
-
insert_text:
|
|
4921
|
+
import_v419.z.object({
|
|
4922
|
+
command: import_v419.z.literal("insert"),
|
|
4923
|
+
path: import_v419.z.string(),
|
|
4924
|
+
insert_line: import_v419.z.number(),
|
|
4925
|
+
insert_text: import_v419.z.string()
|
|
4736
4926
|
}),
|
|
4737
|
-
|
|
4738
|
-
command:
|
|
4739
|
-
path:
|
|
4927
|
+
import_v419.z.object({
|
|
4928
|
+
command: import_v419.z.literal("delete"),
|
|
4929
|
+
path: import_v419.z.string()
|
|
4740
4930
|
}),
|
|
4741
|
-
|
|
4742
|
-
command:
|
|
4743
|
-
old_path:
|
|
4744
|
-
new_path:
|
|
4931
|
+
import_v419.z.object({
|
|
4932
|
+
command: import_v419.z.literal("rename"),
|
|
4933
|
+
old_path: import_v419.z.string(),
|
|
4934
|
+
new_path: import_v419.z.string()
|
|
4745
4935
|
})
|
|
4746
4936
|
])
|
|
4747
4937
|
)
|
|
4748
4938
|
);
|
|
4749
|
-
var memory_20250818 = (0,
|
|
4939
|
+
var memory_20250818 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
4750
4940
|
id: "anthropic.memory_20250818",
|
|
4751
4941
|
inputSchema: memory_20250818InputSchema
|
|
4752
4942
|
});
|
|
4753
4943
|
|
|
4754
4944
|
// src/tool/text-editor_20241022.ts
|
|
4755
|
-
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
4756
|
-
var import_v419 = require("zod/v4");
|
|
4757
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils22.lazySchema)(
|
|
4758
|
-
() => (0, import_provider_utils22.zodSchema)(
|
|
4759
|
-
import_v419.z.object({
|
|
4760
|
-
command: import_v419.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4761
|
-
path: import_v419.z.string(),
|
|
4762
|
-
file_text: import_v419.z.string().optional(),
|
|
4763
|
-
insert_line: import_v419.z.number().int().optional(),
|
|
4764
|
-
new_str: import_v419.z.string().optional(),
|
|
4765
|
-
insert_text: import_v419.z.string().optional(),
|
|
4766
|
-
old_str: import_v419.z.string().optional(),
|
|
4767
|
-
view_range: import_v419.z.array(import_v419.z.number().int()).optional()
|
|
4768
|
-
})
|
|
4769
|
-
)
|
|
4770
|
-
);
|
|
4771
|
-
var textEditor_20241022 = (0, import_provider_utils22.createProviderToolFactory)({
|
|
4772
|
-
id: "anthropic.text_editor_20241022",
|
|
4773
|
-
inputSchema: textEditor_20241022InputSchema
|
|
4774
|
-
});
|
|
4775
|
-
|
|
4776
|
-
// src/tool/text-editor_20250124.ts
|
|
4777
4945
|
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
4778
4946
|
var import_v420 = require("zod/v4");
|
|
4779
|
-
var
|
|
4947
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
4780
4948
|
() => (0, import_provider_utils23.zodSchema)(
|
|
4781
4949
|
import_v420.z.object({
|
|
4782
4950
|
command: import_v420.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4790,18 +4958,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
4790
4958
|
})
|
|
4791
4959
|
)
|
|
4792
4960
|
);
|
|
4793
|
-
var
|
|
4794
|
-
id: "anthropic.
|
|
4795
|
-
inputSchema:
|
|
4961
|
+
var textEditor_20241022 = (0, import_provider_utils23.createProviderToolFactory)({
|
|
4962
|
+
id: "anthropic.text_editor_20241022",
|
|
4963
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4796
4964
|
});
|
|
4797
4965
|
|
|
4798
|
-
// src/tool/text-
|
|
4966
|
+
// src/tool/text-editor_20250124.ts
|
|
4799
4967
|
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
4800
4968
|
var import_v421 = require("zod/v4");
|
|
4801
|
-
var
|
|
4969
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
4802
4970
|
() => (0, import_provider_utils24.zodSchema)(
|
|
4803
4971
|
import_v421.z.object({
|
|
4804
|
-
command: import_v421.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4972
|
+
command: import_v421.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4805
4973
|
path: import_v421.z.string(),
|
|
4806
4974
|
file_text: import_v421.z.string().optional(),
|
|
4807
4975
|
insert_line: import_v421.z.number().int().optional(),
|
|
@@ -4812,40 +4980,62 @@ var textEditor_20250429InputSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
4812
4980
|
})
|
|
4813
4981
|
)
|
|
4814
4982
|
);
|
|
4815
|
-
var
|
|
4816
|
-
id: "anthropic.
|
|
4817
|
-
inputSchema:
|
|
4983
|
+
var textEditor_20250124 = (0, import_provider_utils24.createProviderToolFactory)({
|
|
4984
|
+
id: "anthropic.text_editor_20250124",
|
|
4985
|
+
inputSchema: textEditor_20250124InputSchema
|
|
4818
4986
|
});
|
|
4819
4987
|
|
|
4820
|
-
// src/tool/
|
|
4988
|
+
// src/tool/text-editor_20250429.ts
|
|
4821
4989
|
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
4822
4990
|
var import_v422 = require("zod/v4");
|
|
4823
|
-
var
|
|
4991
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils25.lazySchema)(
|
|
4824
4992
|
() => (0, import_provider_utils25.zodSchema)(
|
|
4825
|
-
import_v422.z.
|
|
4826
|
-
import_v422.z.
|
|
4827
|
-
|
|
4828
|
-
|
|
4993
|
+
import_v422.z.object({
|
|
4994
|
+
command: import_v422.z.enum(["view", "create", "str_replace", "insert"]),
|
|
4995
|
+
path: import_v422.z.string(),
|
|
4996
|
+
file_text: import_v422.z.string().optional(),
|
|
4997
|
+
insert_line: import_v422.z.number().int().optional(),
|
|
4998
|
+
new_str: import_v422.z.string().optional(),
|
|
4999
|
+
insert_text: import_v422.z.string().optional(),
|
|
5000
|
+
old_str: import_v422.z.string().optional(),
|
|
5001
|
+
view_range: import_v422.z.array(import_v422.z.number().int()).optional()
|
|
5002
|
+
})
|
|
5003
|
+
)
|
|
5004
|
+
);
|
|
5005
|
+
var textEditor_20250429 = (0, import_provider_utils25.createProviderToolFactory)({
|
|
5006
|
+
id: "anthropic.text_editor_20250429",
|
|
5007
|
+
inputSchema: textEditor_20250429InputSchema
|
|
5008
|
+
});
|
|
5009
|
+
|
|
5010
|
+
// src/tool/tool-search-bm25_20251119.ts
|
|
5011
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
5012
|
+
var import_v423 = require("zod/v4");
|
|
5013
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
5014
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
5015
|
+
import_v423.z.array(
|
|
5016
|
+
import_v423.z.object({
|
|
5017
|
+
type: import_v423.z.literal("tool_reference"),
|
|
5018
|
+
toolName: import_v423.z.string()
|
|
4829
5019
|
})
|
|
4830
5020
|
)
|
|
4831
5021
|
)
|
|
4832
5022
|
);
|
|
4833
|
-
var toolSearchBm25_20251119InputSchema = (0,
|
|
4834
|
-
() => (0,
|
|
4835
|
-
|
|
5023
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils26.lazySchema)(
|
|
5024
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
5025
|
+
import_v423.z.object({
|
|
4836
5026
|
/**
|
|
4837
5027
|
* A natural language query to search for tools.
|
|
4838
5028
|
* Claude will use BM25 text search to find relevant tools.
|
|
4839
5029
|
*/
|
|
4840
|
-
query:
|
|
5030
|
+
query: import_v423.z.string(),
|
|
4841
5031
|
/**
|
|
4842
5032
|
* Maximum number of tools to return. Optional.
|
|
4843
5033
|
*/
|
|
4844
|
-
limit:
|
|
5034
|
+
limit: import_v423.z.number().optional()
|
|
4845
5035
|
})
|
|
4846
5036
|
)
|
|
4847
5037
|
);
|
|
4848
|
-
var factory10 = (0,
|
|
5038
|
+
var factory10 = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
|
|
4849
5039
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4850
5040
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4851
5041
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
@@ -5057,11 +5247,136 @@ var anthropicTools = {
|
|
|
5057
5247
|
toolSearchBm25_20251119
|
|
5058
5248
|
};
|
|
5059
5249
|
|
|
5250
|
+
// src/skills/anthropic-skills.ts
|
|
5251
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
5252
|
+
|
|
5253
|
+
// src/skills/anthropic-skills-api.ts
|
|
5254
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
5255
|
+
var import_v424 = require("zod/v4");
|
|
5256
|
+
var anthropicSkillResponseSchema = (0, import_provider_utils27.lazySchema)(
|
|
5257
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
5258
|
+
import_v424.z.object({
|
|
5259
|
+
id: import_v424.z.string(),
|
|
5260
|
+
display_title: import_v424.z.string().nullish(),
|
|
5261
|
+
name: import_v424.z.string().nullish(),
|
|
5262
|
+
description: import_v424.z.string().nullish(),
|
|
5263
|
+
latest_version: import_v424.z.string().nullish(),
|
|
5264
|
+
source: import_v424.z.string(),
|
|
5265
|
+
created_at: import_v424.z.string(),
|
|
5266
|
+
updated_at: import_v424.z.string()
|
|
5267
|
+
})
|
|
5268
|
+
)
|
|
5269
|
+
);
|
|
5270
|
+
var anthropicSkillVersionListResponseSchema = (0, import_provider_utils27.lazySchema)(
|
|
5271
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
5272
|
+
import_v424.z.object({
|
|
5273
|
+
data: import_v424.z.array(
|
|
5274
|
+
import_v424.z.object({
|
|
5275
|
+
version: import_v424.z.string()
|
|
5276
|
+
})
|
|
5277
|
+
)
|
|
5278
|
+
})
|
|
5279
|
+
)
|
|
5280
|
+
);
|
|
5281
|
+
var anthropicSkillVersionResponseSchema = (0, import_provider_utils27.lazySchema)(
|
|
5282
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
5283
|
+
import_v424.z.object({
|
|
5284
|
+
type: import_v424.z.string(),
|
|
5285
|
+
skill_id: import_v424.z.string(),
|
|
5286
|
+
name: import_v424.z.string().nullish(),
|
|
5287
|
+
description: import_v424.z.string().nullish()
|
|
5288
|
+
})
|
|
5289
|
+
)
|
|
5290
|
+
);
|
|
5291
|
+
|
|
5292
|
+
// src/skills/anthropic-skills.ts
|
|
5293
|
+
var AnthropicSkills = class {
|
|
5294
|
+
constructor(config) {
|
|
5295
|
+
this.config = config;
|
|
5296
|
+
this.specificationVersion = "v4";
|
|
5297
|
+
}
|
|
5298
|
+
get provider() {
|
|
5299
|
+
return this.config.provider;
|
|
5300
|
+
}
|
|
5301
|
+
async getHeaders() {
|
|
5302
|
+
return (0, import_provider_utils28.combineHeaders)(await (0, import_provider_utils28.resolve)(this.config.headers), {
|
|
5303
|
+
"anthropic-beta": "skills-2025-10-02"
|
|
5304
|
+
});
|
|
5305
|
+
}
|
|
5306
|
+
async fetchVersionMetadata({
|
|
5307
|
+
skillId,
|
|
5308
|
+
version,
|
|
5309
|
+
headers
|
|
5310
|
+
}) {
|
|
5311
|
+
const { value: versionResponse } = await (0, import_provider_utils28.getFromApi)({
|
|
5312
|
+
url: `${this.config.baseURL}/skills/${skillId}/versions/${version}`,
|
|
5313
|
+
headers,
|
|
5314
|
+
failedResponseHandler: anthropicFailedResponseHandler,
|
|
5315
|
+
successfulResponseHandler: (0, import_provider_utils28.createJsonResponseHandler)(
|
|
5316
|
+
anthropicSkillVersionResponseSchema
|
|
5317
|
+
),
|
|
5318
|
+
fetch: this.config.fetch
|
|
5319
|
+
});
|
|
5320
|
+
return {
|
|
5321
|
+
...versionResponse.name != null ? { name: versionResponse.name } : {},
|
|
5322
|
+
...versionResponse.description != null ? { description: versionResponse.description } : {}
|
|
5323
|
+
};
|
|
5324
|
+
}
|
|
5325
|
+
async upload(params) {
|
|
5326
|
+
var _a, _b;
|
|
5327
|
+
const warnings = [];
|
|
5328
|
+
const formData = new FormData();
|
|
5329
|
+
if (params.displayTitle != null) {
|
|
5330
|
+
formData.append("display_title", params.displayTitle);
|
|
5331
|
+
}
|
|
5332
|
+
for (const file of params.files) {
|
|
5333
|
+
const content = typeof file.content === "string" ? (0, import_provider_utils28.convertBase64ToUint8Array)(file.content) : file.content;
|
|
5334
|
+
formData.append("files[]", new Blob([content]), file.path);
|
|
5335
|
+
}
|
|
5336
|
+
const headers = await this.getHeaders();
|
|
5337
|
+
const { value: response } = await (0, import_provider_utils28.postFormDataToApi)({
|
|
5338
|
+
url: `${this.config.baseURL}/skills`,
|
|
5339
|
+
headers,
|
|
5340
|
+
formData,
|
|
5341
|
+
failedResponseHandler: anthropicFailedResponseHandler,
|
|
5342
|
+
successfulResponseHandler: (0, import_provider_utils28.createJsonResponseHandler)(
|
|
5343
|
+
anthropicSkillResponseSchema
|
|
5344
|
+
),
|
|
5345
|
+
fetch: this.config.fetch
|
|
5346
|
+
});
|
|
5347
|
+
const versionMetadata = response.latest_version != null ? await this.fetchVersionMetadata({
|
|
5348
|
+
skillId: response.id,
|
|
5349
|
+
version: response.latest_version,
|
|
5350
|
+
headers
|
|
5351
|
+
}) : {};
|
|
5352
|
+
const name = (_a = versionMetadata.name) != null ? _a : response.name;
|
|
5353
|
+
const description = (_b = versionMetadata.description) != null ? _b : response.description;
|
|
5354
|
+
return {
|
|
5355
|
+
providerReference: { anthropic: response.id },
|
|
5356
|
+
...response.display_title != null ? { displayTitle: response.display_title } : {},
|
|
5357
|
+
...name != null ? { name } : {},
|
|
5358
|
+
...description != null ? { description } : {},
|
|
5359
|
+
...response.latest_version != null ? { latestVersion: response.latest_version } : {},
|
|
5360
|
+
providerMetadata: {
|
|
5361
|
+
anthropic: {
|
|
5362
|
+
...response.source != null ? { source: response.source } : {},
|
|
5363
|
+
...response.created_at != null ? { createdAt: response.created_at } : {},
|
|
5364
|
+
...response.updated_at != null ? { updatedAt: response.updated_at } : {}
|
|
5365
|
+
}
|
|
5366
|
+
},
|
|
5367
|
+
warnings
|
|
5368
|
+
};
|
|
5369
|
+
}
|
|
5370
|
+
};
|
|
5371
|
+
|
|
5372
|
+
// src/version.ts
|
|
5373
|
+
var VERSION = true ? "4.0.0-beta.21" : "0.0.0-test";
|
|
5374
|
+
|
|
5060
5375
|
// src/anthropic-provider.ts
|
|
5061
5376
|
function createAnthropic(options = {}) {
|
|
5062
5377
|
var _a, _b;
|
|
5063
|
-
const baseURL = (_a = (0,
|
|
5064
|
-
(0,
|
|
5378
|
+
const baseURL = (_a = (0, import_provider_utils29.withoutTrailingSlash)(
|
|
5379
|
+
(0, import_provider_utils29.loadOptionalSetting)({
|
|
5065
5380
|
settingValue: options.baseURL,
|
|
5066
5381
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
5067
5382
|
})
|
|
@@ -5075,13 +5390,13 @@ function createAnthropic(options = {}) {
|
|
|
5075
5390
|
}
|
|
5076
5391
|
const getHeaders = () => {
|
|
5077
5392
|
const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
|
|
5078
|
-
"x-api-key": (0,
|
|
5393
|
+
"x-api-key": (0, import_provider_utils29.loadApiKey)({
|
|
5079
5394
|
apiKey: options.apiKey,
|
|
5080
5395
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
5081
5396
|
description: "Anthropic"
|
|
5082
5397
|
})
|
|
5083
5398
|
};
|
|
5084
|
-
return (0,
|
|
5399
|
+
return (0, import_provider_utils29.withUserAgentSuffix)(
|
|
5085
5400
|
{
|
|
5086
5401
|
"anthropic-version": "2023-06-01",
|
|
5087
5402
|
...authHeaders,
|
|
@@ -5097,13 +5412,19 @@ function createAnthropic(options = {}) {
|
|
|
5097
5412
|
baseURL,
|
|
5098
5413
|
headers: getHeaders,
|
|
5099
5414
|
fetch: options.fetch,
|
|
5100
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
5415
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : import_provider_utils29.generateId,
|
|
5101
5416
|
supportedUrls: () => ({
|
|
5102
5417
|
"image/*": [/^https?:\/\/.*$/],
|
|
5103
5418
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
5104
5419
|
})
|
|
5105
5420
|
});
|
|
5106
5421
|
};
|
|
5422
|
+
const createSkills = () => new AnthropicSkills({
|
|
5423
|
+
provider: `${providerName.replace(".messages", "")}.skills`,
|
|
5424
|
+
baseURL,
|
|
5425
|
+
headers: getHeaders,
|
|
5426
|
+
fetch: options.fetch
|
|
5427
|
+
});
|
|
5107
5428
|
const provider = function(modelId) {
|
|
5108
5429
|
if (new.target) {
|
|
5109
5430
|
throw new Error(
|
|
@@ -5112,7 +5433,7 @@ function createAnthropic(options = {}) {
|
|
|
5112
5433
|
}
|
|
5113
5434
|
return createChatModel(modelId);
|
|
5114
5435
|
};
|
|
5115
|
-
provider.specificationVersion = "
|
|
5436
|
+
provider.specificationVersion = "v4";
|
|
5116
5437
|
provider.languageModel = createChatModel;
|
|
5117
5438
|
provider.chat = createChatModel;
|
|
5118
5439
|
provider.messages = createChatModel;
|
|
@@ -5123,6 +5444,13 @@ function createAnthropic(options = {}) {
|
|
|
5123
5444
|
provider.imageModel = (modelId) => {
|
|
5124
5445
|
throw new import_provider4.NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
5125
5446
|
};
|
|
5447
|
+
provider.files = () => new AnthropicFiles({
|
|
5448
|
+
provider: providerName,
|
|
5449
|
+
baseURL,
|
|
5450
|
+
headers: getHeaders,
|
|
5451
|
+
fetch: options.fetch
|
|
5452
|
+
});
|
|
5453
|
+
provider.skills = createSkills;
|
|
5126
5454
|
provider.tools = anthropicTools;
|
|
5127
5455
|
return provider;
|
|
5128
5456
|
}
|