@ai-sdk/anthropic 4.0.0-beta.16 → 4.0.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1162 -1060
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1162 -1050
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +20 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +22 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/anthropic-files.ts +106 -0
- package/src/anthropic-messages-api.ts +4 -0
- package/src/anthropic-provider.ts +13 -1
- package/src/convert-to-anthropic-messages-prompt.ts +23 -1
package/dist/index.mjs
CHANGED
|
@@ -11,26 +11,17 @@ import {
|
|
|
11
11
|
withUserAgentSuffix
|
|
12
12
|
} from "@ai-sdk/provider-utils";
|
|
13
13
|
|
|
14
|
-
// src/
|
|
15
|
-
var VERSION = true ? "4.0.0-beta.16" : "0.0.0-test";
|
|
16
|
-
|
|
17
|
-
// src/anthropic-messages-language-model.ts
|
|
18
|
-
import {
|
|
19
|
-
APICallError
|
|
20
|
-
} from "@ai-sdk/provider";
|
|
14
|
+
// src/anthropic-files.ts
|
|
21
15
|
import {
|
|
22
16
|
combineHeaders,
|
|
23
|
-
|
|
17
|
+
convertBase64ToUint8Array,
|
|
24
18
|
createJsonResponseHandler,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
mapReasoningToProviderEffort,
|
|
30
|
-
parseProviderOptions as parseProviderOptions2,
|
|
31
|
-
postJsonToApi,
|
|
32
|
-
resolve
|
|
19
|
+
lazySchema as lazySchema2,
|
|
20
|
+
parseProviderOptions,
|
|
21
|
+
postFormDataToApi,
|
|
22
|
+
zodSchema as zodSchema2
|
|
33
23
|
} from "@ai-sdk/provider-utils";
|
|
24
|
+
import { z as z2 } from "zod/v4";
|
|
34
25
|
|
|
35
26
|
// src/anthropic-error.ts
|
|
36
27
|
import {
|
|
@@ -55,319 +46,410 @@ var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
55
46
|
errorToMessage: (data) => data.error.message
|
|
56
47
|
});
|
|
57
48
|
|
|
58
|
-
// src/anthropic-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var anthropicMessagesResponseSchema = lazySchema2(
|
|
49
|
+
// src/anthropic-files.ts
|
|
50
|
+
var anthropicUploadFileProviderOptions = z2.object({});
|
|
51
|
+
var anthropicUploadFileResponseSchema = lazySchema2(
|
|
62
52
|
() => zodSchema2(
|
|
63
53
|
z2.object({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
54
|
+
id: z2.string(),
|
|
55
|
+
type: z2.literal("file"),
|
|
56
|
+
filename: z2.string(),
|
|
57
|
+
mime_type: z2.string(),
|
|
58
|
+
size_bytes: z2.number(),
|
|
59
|
+
created_at: z2.string(),
|
|
60
|
+
downloadable: z2.boolean().nullish()
|
|
61
|
+
})
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
var AnthropicFiles = class {
|
|
65
|
+
constructor(config) {
|
|
66
|
+
this.config = config;
|
|
67
|
+
this.specificationVersion = "v4";
|
|
68
|
+
}
|
|
69
|
+
get provider() {
|
|
70
|
+
return this.config.provider;
|
|
71
|
+
}
|
|
72
|
+
async uploadFile({
|
|
73
|
+
data,
|
|
74
|
+
mediaType,
|
|
75
|
+
filename,
|
|
76
|
+
providerOptions
|
|
77
|
+
}) {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
const anthropicOptions = await parseProviderOptions({
|
|
80
|
+
provider: "anthropic",
|
|
81
|
+
providerOptions,
|
|
82
|
+
schema: zodSchema2(anthropicUploadFileProviderOptions)
|
|
83
|
+
});
|
|
84
|
+
const fileBytes = data instanceof Uint8Array ? data : convertBase64ToUint8Array(data);
|
|
85
|
+
const blob = new Blob([fileBytes], { type: mediaType });
|
|
86
|
+
const formData = new FormData();
|
|
87
|
+
if (filename != null) {
|
|
88
|
+
formData.append("file", blob, filename);
|
|
89
|
+
} else {
|
|
90
|
+
formData.append("file", blob);
|
|
91
|
+
}
|
|
92
|
+
const { value: response } = await postFormDataToApi({
|
|
93
|
+
url: `${this.config.baseURL}/files`,
|
|
94
|
+
headers: combineHeaders(this.config.headers(), {
|
|
95
|
+
"anthropic-beta": "files-api-2025-04-14"
|
|
96
|
+
}),
|
|
97
|
+
formData,
|
|
98
|
+
failedResponseHandler: anthropicFailedResponseHandler,
|
|
99
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
100
|
+
anthropicUploadFileResponseSchema
|
|
101
|
+
),
|
|
102
|
+
fetch: this.config.fetch
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
warnings: [],
|
|
106
|
+
providerReference: { anthropic: response.id },
|
|
107
|
+
mediaType: (_a = response.mime_type) != null ? _a : mediaType,
|
|
108
|
+
filename: (_b = response.filename) != null ? _b : filename,
|
|
109
|
+
providerMetadata: {
|
|
110
|
+
anthropic: {
|
|
111
|
+
filename: response.filename,
|
|
112
|
+
mimeType: response.mime_type,
|
|
113
|
+
sizeBytes: response.size_bytes,
|
|
114
|
+
createdAt: response.created_at,
|
|
115
|
+
...response.downloadable != null ? { downloadable: response.downloadable } : {}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// src/anthropic-messages-language-model.ts
|
|
123
|
+
import {
|
|
124
|
+
APICallError
|
|
125
|
+
} from "@ai-sdk/provider";
|
|
126
|
+
import {
|
|
127
|
+
combineHeaders as combineHeaders2,
|
|
128
|
+
createEventSourceResponseHandler,
|
|
129
|
+
createJsonResponseHandler as createJsonResponseHandler2,
|
|
130
|
+
createToolNameMapping,
|
|
131
|
+
generateId,
|
|
132
|
+
isCustomReasoning,
|
|
133
|
+
mapReasoningToProviderBudget,
|
|
134
|
+
mapReasoningToProviderEffort,
|
|
135
|
+
parseProviderOptions as parseProviderOptions3,
|
|
136
|
+
postJsonToApi,
|
|
137
|
+
resolve
|
|
138
|
+
} from "@ai-sdk/provider-utils";
|
|
139
|
+
|
|
140
|
+
// src/anthropic-messages-api.ts
|
|
141
|
+
import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
|
|
142
|
+
import { z as z3 } from "zod/v4";
|
|
143
|
+
var anthropicMessagesResponseSchema = lazySchema3(
|
|
144
|
+
() => zodSchema3(
|
|
145
|
+
z3.object({
|
|
146
|
+
type: z3.literal("message"),
|
|
147
|
+
id: z3.string().nullish(),
|
|
148
|
+
model: z3.string().nullish(),
|
|
149
|
+
content: z3.array(
|
|
150
|
+
z3.discriminatedUnion("type", [
|
|
151
|
+
z3.object({
|
|
152
|
+
type: z3.literal("text"),
|
|
153
|
+
text: z3.string(),
|
|
154
|
+
citations: z3.array(
|
|
155
|
+
z3.discriminatedUnion("type", [
|
|
156
|
+
z3.object({
|
|
157
|
+
type: z3.literal("web_search_result_location"),
|
|
158
|
+
cited_text: z3.string(),
|
|
159
|
+
url: z3.string(),
|
|
160
|
+
title: z3.string(),
|
|
161
|
+
encrypted_index: z3.string()
|
|
80
162
|
}),
|
|
81
|
-
|
|
82
|
-
type:
|
|
83
|
-
cited_text:
|
|
84
|
-
document_index:
|
|
85
|
-
document_title:
|
|
86
|
-
start_page_number:
|
|
87
|
-
end_page_number:
|
|
163
|
+
z3.object({
|
|
164
|
+
type: z3.literal("page_location"),
|
|
165
|
+
cited_text: z3.string(),
|
|
166
|
+
document_index: z3.number(),
|
|
167
|
+
document_title: z3.string().nullable(),
|
|
168
|
+
start_page_number: z3.number(),
|
|
169
|
+
end_page_number: z3.number()
|
|
88
170
|
}),
|
|
89
|
-
|
|
90
|
-
type:
|
|
91
|
-
cited_text:
|
|
92
|
-
document_index:
|
|
93
|
-
document_title:
|
|
94
|
-
start_char_index:
|
|
95
|
-
end_char_index:
|
|
171
|
+
z3.object({
|
|
172
|
+
type: z3.literal("char_location"),
|
|
173
|
+
cited_text: z3.string(),
|
|
174
|
+
document_index: z3.number(),
|
|
175
|
+
document_title: z3.string().nullable(),
|
|
176
|
+
start_char_index: z3.number(),
|
|
177
|
+
end_char_index: z3.number()
|
|
96
178
|
})
|
|
97
179
|
])
|
|
98
180
|
).optional()
|
|
99
181
|
}),
|
|
100
|
-
|
|
101
|
-
type:
|
|
102
|
-
thinking:
|
|
103
|
-
signature:
|
|
182
|
+
z3.object({
|
|
183
|
+
type: z3.literal("thinking"),
|
|
184
|
+
thinking: z3.string(),
|
|
185
|
+
signature: z3.string()
|
|
104
186
|
}),
|
|
105
|
-
|
|
106
|
-
type:
|
|
107
|
-
data:
|
|
187
|
+
z3.object({
|
|
188
|
+
type: z3.literal("redacted_thinking"),
|
|
189
|
+
data: z3.string()
|
|
108
190
|
}),
|
|
109
|
-
|
|
110
|
-
type:
|
|
111
|
-
content:
|
|
191
|
+
z3.object({
|
|
192
|
+
type: z3.literal("compaction"),
|
|
193
|
+
content: z3.string()
|
|
112
194
|
}),
|
|
113
|
-
|
|
114
|
-
type:
|
|
115
|
-
id:
|
|
116
|
-
name:
|
|
117
|
-
input:
|
|
195
|
+
z3.object({
|
|
196
|
+
type: z3.literal("tool_use"),
|
|
197
|
+
id: z3.string(),
|
|
198
|
+
name: z3.string(),
|
|
199
|
+
input: z3.unknown(),
|
|
118
200
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
119
|
-
caller:
|
|
120
|
-
|
|
121
|
-
type:
|
|
122
|
-
tool_id:
|
|
201
|
+
caller: z3.union([
|
|
202
|
+
z3.object({
|
|
203
|
+
type: z3.literal("code_execution_20250825"),
|
|
204
|
+
tool_id: z3.string()
|
|
123
205
|
}),
|
|
124
|
-
|
|
125
|
-
type:
|
|
126
|
-
tool_id:
|
|
206
|
+
z3.object({
|
|
207
|
+
type: z3.literal("code_execution_20260120"),
|
|
208
|
+
tool_id: z3.string()
|
|
127
209
|
}),
|
|
128
|
-
|
|
129
|
-
type:
|
|
210
|
+
z3.object({
|
|
211
|
+
type: z3.literal("direct")
|
|
130
212
|
})
|
|
131
213
|
]).optional()
|
|
132
214
|
}),
|
|
133
|
-
|
|
134
|
-
type:
|
|
135
|
-
id:
|
|
136
|
-
name:
|
|
137
|
-
input:
|
|
138
|
-
caller:
|
|
139
|
-
|
|
140
|
-
type:
|
|
141
|
-
tool_id:
|
|
215
|
+
z3.object({
|
|
216
|
+
type: z3.literal("server_tool_use"),
|
|
217
|
+
id: z3.string(),
|
|
218
|
+
name: z3.string(),
|
|
219
|
+
input: z3.record(z3.string(), z3.unknown()).nullish(),
|
|
220
|
+
caller: z3.union([
|
|
221
|
+
z3.object({
|
|
222
|
+
type: z3.literal("code_execution_20260120"),
|
|
223
|
+
tool_id: z3.string()
|
|
142
224
|
}),
|
|
143
|
-
|
|
144
|
-
type:
|
|
225
|
+
z3.object({
|
|
226
|
+
type: z3.literal("direct")
|
|
145
227
|
})
|
|
146
228
|
]).optional()
|
|
147
229
|
}),
|
|
148
|
-
|
|
149
|
-
type:
|
|
150
|
-
id:
|
|
151
|
-
name:
|
|
152
|
-
input:
|
|
153
|
-
server_name:
|
|
230
|
+
z3.object({
|
|
231
|
+
type: z3.literal("mcp_tool_use"),
|
|
232
|
+
id: z3.string(),
|
|
233
|
+
name: z3.string(),
|
|
234
|
+
input: z3.unknown(),
|
|
235
|
+
server_name: z3.string()
|
|
154
236
|
}),
|
|
155
|
-
|
|
156
|
-
type:
|
|
157
|
-
tool_use_id:
|
|
158
|
-
is_error:
|
|
159
|
-
content:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
237
|
+
z3.object({
|
|
238
|
+
type: z3.literal("mcp_tool_result"),
|
|
239
|
+
tool_use_id: z3.string(),
|
|
240
|
+
is_error: z3.boolean(),
|
|
241
|
+
content: z3.array(
|
|
242
|
+
z3.union([
|
|
243
|
+
z3.string(),
|
|
244
|
+
z3.object({ type: z3.literal("text"), text: z3.string() })
|
|
163
245
|
])
|
|
164
246
|
)
|
|
165
247
|
}),
|
|
166
|
-
|
|
167
|
-
type:
|
|
168
|
-
tool_use_id:
|
|
169
|
-
content:
|
|
170
|
-
|
|
171
|
-
type:
|
|
172
|
-
url:
|
|
173
|
-
retrieved_at:
|
|
174
|
-
content:
|
|
175
|
-
type:
|
|
176
|
-
title:
|
|
177
|
-
citations:
|
|
178
|
-
source:
|
|
179
|
-
|
|
180
|
-
type:
|
|
181
|
-
media_type:
|
|
182
|
-
data:
|
|
248
|
+
z3.object({
|
|
249
|
+
type: z3.literal("web_fetch_tool_result"),
|
|
250
|
+
tool_use_id: z3.string(),
|
|
251
|
+
content: z3.union([
|
|
252
|
+
z3.object({
|
|
253
|
+
type: z3.literal("web_fetch_result"),
|
|
254
|
+
url: z3.string(),
|
|
255
|
+
retrieved_at: z3.string(),
|
|
256
|
+
content: z3.object({
|
|
257
|
+
type: z3.literal("document"),
|
|
258
|
+
title: z3.string().nullable(),
|
|
259
|
+
citations: z3.object({ enabled: z3.boolean() }).optional(),
|
|
260
|
+
source: z3.union([
|
|
261
|
+
z3.object({
|
|
262
|
+
type: z3.literal("base64"),
|
|
263
|
+
media_type: z3.literal("application/pdf"),
|
|
264
|
+
data: z3.string()
|
|
183
265
|
}),
|
|
184
|
-
|
|
185
|
-
type:
|
|
186
|
-
media_type:
|
|
187
|
-
data:
|
|
266
|
+
z3.object({
|
|
267
|
+
type: z3.literal("text"),
|
|
268
|
+
media_type: z3.literal("text/plain"),
|
|
269
|
+
data: z3.string()
|
|
188
270
|
})
|
|
189
271
|
])
|
|
190
272
|
})
|
|
191
273
|
}),
|
|
192
|
-
|
|
193
|
-
type:
|
|
194
|
-
error_code:
|
|
274
|
+
z3.object({
|
|
275
|
+
type: z3.literal("web_fetch_tool_result_error"),
|
|
276
|
+
error_code: z3.string()
|
|
195
277
|
})
|
|
196
278
|
])
|
|
197
279
|
}),
|
|
198
|
-
|
|
199
|
-
type:
|
|
200
|
-
tool_use_id:
|
|
201
|
-
content:
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
type:
|
|
205
|
-
url:
|
|
206
|
-
title:
|
|
207
|
-
encrypted_content:
|
|
208
|
-
page_age:
|
|
280
|
+
z3.object({
|
|
281
|
+
type: z3.literal("web_search_tool_result"),
|
|
282
|
+
tool_use_id: z3.string(),
|
|
283
|
+
content: z3.union([
|
|
284
|
+
z3.array(
|
|
285
|
+
z3.object({
|
|
286
|
+
type: z3.literal("web_search_result"),
|
|
287
|
+
url: z3.string(),
|
|
288
|
+
title: z3.string(),
|
|
289
|
+
encrypted_content: z3.string(),
|
|
290
|
+
page_age: z3.string().nullish()
|
|
209
291
|
})
|
|
210
292
|
),
|
|
211
|
-
|
|
212
|
-
type:
|
|
213
|
-
error_code:
|
|
293
|
+
z3.object({
|
|
294
|
+
type: z3.literal("web_search_tool_result_error"),
|
|
295
|
+
error_code: z3.string()
|
|
214
296
|
})
|
|
215
297
|
])
|
|
216
298
|
}),
|
|
217
299
|
// code execution results for code_execution_20250522 tool:
|
|
218
|
-
|
|
219
|
-
type:
|
|
220
|
-
tool_use_id:
|
|
221
|
-
content:
|
|
222
|
-
|
|
223
|
-
type:
|
|
224
|
-
stdout:
|
|
225
|
-
stderr:
|
|
226
|
-
return_code:
|
|
227
|
-
content:
|
|
228
|
-
|
|
229
|
-
type:
|
|
230
|
-
file_id:
|
|
300
|
+
z3.object({
|
|
301
|
+
type: z3.literal("code_execution_tool_result"),
|
|
302
|
+
tool_use_id: z3.string(),
|
|
303
|
+
content: z3.union([
|
|
304
|
+
z3.object({
|
|
305
|
+
type: z3.literal("code_execution_result"),
|
|
306
|
+
stdout: z3.string(),
|
|
307
|
+
stderr: z3.string(),
|
|
308
|
+
return_code: z3.number(),
|
|
309
|
+
content: z3.array(
|
|
310
|
+
z3.object({
|
|
311
|
+
type: z3.literal("code_execution_output"),
|
|
312
|
+
file_id: z3.string()
|
|
231
313
|
})
|
|
232
314
|
).optional().default([])
|
|
233
315
|
}),
|
|
234
|
-
|
|
235
|
-
type:
|
|
236
|
-
encrypted_stdout:
|
|
237
|
-
stderr:
|
|
238
|
-
return_code:
|
|
239
|
-
content:
|
|
240
|
-
|
|
241
|
-
type:
|
|
242
|
-
file_id:
|
|
316
|
+
z3.object({
|
|
317
|
+
type: z3.literal("encrypted_code_execution_result"),
|
|
318
|
+
encrypted_stdout: z3.string(),
|
|
319
|
+
stderr: z3.string(),
|
|
320
|
+
return_code: z3.number(),
|
|
321
|
+
content: z3.array(
|
|
322
|
+
z3.object({
|
|
323
|
+
type: z3.literal("code_execution_output"),
|
|
324
|
+
file_id: z3.string()
|
|
243
325
|
})
|
|
244
326
|
).optional().default([])
|
|
245
327
|
}),
|
|
246
|
-
|
|
247
|
-
type:
|
|
248
|
-
error_code:
|
|
328
|
+
z3.object({
|
|
329
|
+
type: z3.literal("code_execution_tool_result_error"),
|
|
330
|
+
error_code: z3.string()
|
|
249
331
|
})
|
|
250
332
|
])
|
|
251
333
|
}),
|
|
252
334
|
// bash code execution results for code_execution_20250825 tool:
|
|
253
|
-
|
|
254
|
-
type:
|
|
255
|
-
tool_use_id:
|
|
256
|
-
content:
|
|
257
|
-
|
|
258
|
-
type:
|
|
259
|
-
content:
|
|
260
|
-
|
|
261
|
-
type:
|
|
262
|
-
file_id:
|
|
335
|
+
z3.object({
|
|
336
|
+
type: z3.literal("bash_code_execution_tool_result"),
|
|
337
|
+
tool_use_id: z3.string(),
|
|
338
|
+
content: z3.discriminatedUnion("type", [
|
|
339
|
+
z3.object({
|
|
340
|
+
type: z3.literal("bash_code_execution_result"),
|
|
341
|
+
content: z3.array(
|
|
342
|
+
z3.object({
|
|
343
|
+
type: z3.literal("bash_code_execution_output"),
|
|
344
|
+
file_id: z3.string()
|
|
263
345
|
})
|
|
264
346
|
),
|
|
265
|
-
stdout:
|
|
266
|
-
stderr:
|
|
267
|
-
return_code:
|
|
347
|
+
stdout: z3.string(),
|
|
348
|
+
stderr: z3.string(),
|
|
349
|
+
return_code: z3.number()
|
|
268
350
|
}),
|
|
269
|
-
|
|
270
|
-
type:
|
|
271
|
-
error_code:
|
|
351
|
+
z3.object({
|
|
352
|
+
type: z3.literal("bash_code_execution_tool_result_error"),
|
|
353
|
+
error_code: z3.string()
|
|
272
354
|
})
|
|
273
355
|
])
|
|
274
356
|
}),
|
|
275
357
|
// text editor code execution results for code_execution_20250825 tool:
|
|
276
|
-
|
|
277
|
-
type:
|
|
278
|
-
tool_use_id:
|
|
279
|
-
content:
|
|
280
|
-
|
|
281
|
-
type:
|
|
282
|
-
error_code:
|
|
358
|
+
z3.object({
|
|
359
|
+
type: z3.literal("text_editor_code_execution_tool_result"),
|
|
360
|
+
tool_use_id: z3.string(),
|
|
361
|
+
content: z3.discriminatedUnion("type", [
|
|
362
|
+
z3.object({
|
|
363
|
+
type: z3.literal("text_editor_code_execution_tool_result_error"),
|
|
364
|
+
error_code: z3.string()
|
|
283
365
|
}),
|
|
284
|
-
|
|
285
|
-
type:
|
|
286
|
-
content:
|
|
287
|
-
file_type:
|
|
288
|
-
num_lines:
|
|
289
|
-
start_line:
|
|
290
|
-
total_lines:
|
|
366
|
+
z3.object({
|
|
367
|
+
type: z3.literal("text_editor_code_execution_view_result"),
|
|
368
|
+
content: z3.string(),
|
|
369
|
+
file_type: z3.string(),
|
|
370
|
+
num_lines: z3.number().nullable(),
|
|
371
|
+
start_line: z3.number().nullable(),
|
|
372
|
+
total_lines: z3.number().nullable()
|
|
291
373
|
}),
|
|
292
|
-
|
|
293
|
-
type:
|
|
294
|
-
is_file_update:
|
|
374
|
+
z3.object({
|
|
375
|
+
type: z3.literal("text_editor_code_execution_create_result"),
|
|
376
|
+
is_file_update: z3.boolean()
|
|
295
377
|
}),
|
|
296
|
-
|
|
297
|
-
type:
|
|
378
|
+
z3.object({
|
|
379
|
+
type: z3.literal(
|
|
298
380
|
"text_editor_code_execution_str_replace_result"
|
|
299
381
|
),
|
|
300
|
-
lines:
|
|
301
|
-
new_lines:
|
|
302
|
-
new_start:
|
|
303
|
-
old_lines:
|
|
304
|
-
old_start:
|
|
382
|
+
lines: z3.array(z3.string()).nullable(),
|
|
383
|
+
new_lines: z3.number().nullable(),
|
|
384
|
+
new_start: z3.number().nullable(),
|
|
385
|
+
old_lines: z3.number().nullable(),
|
|
386
|
+
old_start: z3.number().nullable()
|
|
305
387
|
})
|
|
306
388
|
])
|
|
307
389
|
}),
|
|
308
390
|
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
309
|
-
|
|
310
|
-
type:
|
|
311
|
-
tool_use_id:
|
|
312
|
-
content:
|
|
313
|
-
|
|
314
|
-
type:
|
|
315
|
-
tool_references:
|
|
316
|
-
|
|
317
|
-
type:
|
|
318
|
-
tool_name:
|
|
391
|
+
z3.object({
|
|
392
|
+
type: z3.literal("tool_search_tool_result"),
|
|
393
|
+
tool_use_id: z3.string(),
|
|
394
|
+
content: z3.union([
|
|
395
|
+
z3.object({
|
|
396
|
+
type: z3.literal("tool_search_tool_search_result"),
|
|
397
|
+
tool_references: z3.array(
|
|
398
|
+
z3.object({
|
|
399
|
+
type: z3.literal("tool_reference"),
|
|
400
|
+
tool_name: z3.string()
|
|
319
401
|
})
|
|
320
402
|
)
|
|
321
403
|
}),
|
|
322
|
-
|
|
323
|
-
type:
|
|
324
|
-
error_code:
|
|
404
|
+
z3.object({
|
|
405
|
+
type: z3.literal("tool_search_tool_result_error"),
|
|
406
|
+
error_code: z3.string()
|
|
325
407
|
})
|
|
326
408
|
])
|
|
327
409
|
})
|
|
328
410
|
])
|
|
329
411
|
),
|
|
330
|
-
stop_reason:
|
|
331
|
-
stop_sequence:
|
|
332
|
-
usage:
|
|
333
|
-
input_tokens:
|
|
334
|
-
output_tokens:
|
|
335
|
-
cache_creation_input_tokens:
|
|
336
|
-
cache_read_input_tokens:
|
|
337
|
-
iterations:
|
|
338
|
-
|
|
339
|
-
type:
|
|
340
|
-
input_tokens:
|
|
341
|
-
output_tokens:
|
|
412
|
+
stop_reason: z3.string().nullish(),
|
|
413
|
+
stop_sequence: z3.string().nullish(),
|
|
414
|
+
usage: z3.looseObject({
|
|
415
|
+
input_tokens: z3.number(),
|
|
416
|
+
output_tokens: z3.number(),
|
|
417
|
+
cache_creation_input_tokens: z3.number().nullish(),
|
|
418
|
+
cache_read_input_tokens: z3.number().nullish(),
|
|
419
|
+
iterations: z3.array(
|
|
420
|
+
z3.object({
|
|
421
|
+
type: z3.union([z3.literal("compaction"), z3.literal("message")]),
|
|
422
|
+
input_tokens: z3.number(),
|
|
423
|
+
output_tokens: z3.number()
|
|
342
424
|
})
|
|
343
425
|
).nullish()
|
|
344
426
|
}),
|
|
345
|
-
container:
|
|
346
|
-
expires_at:
|
|
347
|
-
id:
|
|
348
|
-
skills:
|
|
349
|
-
|
|
350
|
-
type:
|
|
351
|
-
skill_id:
|
|
352
|
-
version:
|
|
427
|
+
container: z3.object({
|
|
428
|
+
expires_at: z3.string(),
|
|
429
|
+
id: z3.string(),
|
|
430
|
+
skills: z3.array(
|
|
431
|
+
z3.object({
|
|
432
|
+
type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
|
|
433
|
+
skill_id: z3.string(),
|
|
434
|
+
version: z3.string()
|
|
353
435
|
})
|
|
354
436
|
).nullish()
|
|
355
437
|
}).nullish(),
|
|
356
|
-
context_management:
|
|
357
|
-
applied_edits:
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
type:
|
|
361
|
-
cleared_tool_uses:
|
|
362
|
-
cleared_input_tokens:
|
|
438
|
+
context_management: z3.object({
|
|
439
|
+
applied_edits: z3.array(
|
|
440
|
+
z3.union([
|
|
441
|
+
z3.object({
|
|
442
|
+
type: z3.literal("clear_tool_uses_20250919"),
|
|
443
|
+
cleared_tool_uses: z3.number(),
|
|
444
|
+
cleared_input_tokens: z3.number()
|
|
363
445
|
}),
|
|
364
|
-
|
|
365
|
-
type:
|
|
366
|
-
cleared_thinking_turns:
|
|
367
|
-
cleared_input_tokens:
|
|
446
|
+
z3.object({
|
|
447
|
+
type: z3.literal("clear_thinking_20251015"),
|
|
448
|
+
cleared_thinking_turns: z3.number(),
|
|
449
|
+
cleared_input_tokens: z3.number()
|
|
368
450
|
}),
|
|
369
|
-
|
|
370
|
-
type:
|
|
451
|
+
z3.object({
|
|
452
|
+
type: z3.literal("compact_20260112")
|
|
371
453
|
})
|
|
372
454
|
])
|
|
373
455
|
)
|
|
@@ -375,457 +457,457 @@ var anthropicMessagesResponseSchema = lazySchema2(
|
|
|
375
457
|
})
|
|
376
458
|
)
|
|
377
459
|
);
|
|
378
|
-
var anthropicMessagesChunkSchema =
|
|
379
|
-
() =>
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
type:
|
|
383
|
-
message:
|
|
384
|
-
id:
|
|
385
|
-
model:
|
|
386
|
-
role:
|
|
387
|
-
usage:
|
|
388
|
-
input_tokens:
|
|
389
|
-
cache_creation_input_tokens:
|
|
390
|
-
cache_read_input_tokens:
|
|
460
|
+
var anthropicMessagesChunkSchema = lazySchema3(
|
|
461
|
+
() => zodSchema3(
|
|
462
|
+
z3.discriminatedUnion("type", [
|
|
463
|
+
z3.object({
|
|
464
|
+
type: z3.literal("message_start"),
|
|
465
|
+
message: z3.object({
|
|
466
|
+
id: z3.string().nullish(),
|
|
467
|
+
model: z3.string().nullish(),
|
|
468
|
+
role: z3.string().nullish(),
|
|
469
|
+
usage: z3.looseObject({
|
|
470
|
+
input_tokens: z3.number(),
|
|
471
|
+
cache_creation_input_tokens: z3.number().nullish(),
|
|
472
|
+
cache_read_input_tokens: z3.number().nullish()
|
|
391
473
|
}),
|
|
392
474
|
// Programmatic tool calling: content may be pre-populated for deferred tool calls
|
|
393
|
-
content:
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
type:
|
|
397
|
-
id:
|
|
398
|
-
name:
|
|
399
|
-
input:
|
|
400
|
-
caller:
|
|
401
|
-
|
|
402
|
-
type:
|
|
403
|
-
tool_id:
|
|
475
|
+
content: z3.array(
|
|
476
|
+
z3.discriminatedUnion("type", [
|
|
477
|
+
z3.object({
|
|
478
|
+
type: z3.literal("tool_use"),
|
|
479
|
+
id: z3.string(),
|
|
480
|
+
name: z3.string(),
|
|
481
|
+
input: z3.unknown(),
|
|
482
|
+
caller: z3.union([
|
|
483
|
+
z3.object({
|
|
484
|
+
type: z3.literal("code_execution_20250825"),
|
|
485
|
+
tool_id: z3.string()
|
|
404
486
|
}),
|
|
405
|
-
|
|
406
|
-
type:
|
|
407
|
-
tool_id:
|
|
487
|
+
z3.object({
|
|
488
|
+
type: z3.literal("code_execution_20260120"),
|
|
489
|
+
tool_id: z3.string()
|
|
408
490
|
}),
|
|
409
|
-
|
|
410
|
-
type:
|
|
491
|
+
z3.object({
|
|
492
|
+
type: z3.literal("direct")
|
|
411
493
|
})
|
|
412
494
|
]).optional()
|
|
413
495
|
})
|
|
414
496
|
])
|
|
415
497
|
).nullish(),
|
|
416
|
-
stop_reason:
|
|
417
|
-
container:
|
|
418
|
-
expires_at:
|
|
419
|
-
id:
|
|
498
|
+
stop_reason: z3.string().nullish(),
|
|
499
|
+
container: z3.object({
|
|
500
|
+
expires_at: z3.string(),
|
|
501
|
+
id: z3.string()
|
|
420
502
|
}).nullish()
|
|
421
503
|
})
|
|
422
504
|
}),
|
|
423
|
-
|
|
424
|
-
type:
|
|
425
|
-
index:
|
|
426
|
-
content_block:
|
|
427
|
-
|
|
428
|
-
type:
|
|
429
|
-
text:
|
|
505
|
+
z3.object({
|
|
506
|
+
type: z3.literal("content_block_start"),
|
|
507
|
+
index: z3.number(),
|
|
508
|
+
content_block: z3.discriminatedUnion("type", [
|
|
509
|
+
z3.object({
|
|
510
|
+
type: z3.literal("text"),
|
|
511
|
+
text: z3.string()
|
|
430
512
|
}),
|
|
431
|
-
|
|
432
|
-
type:
|
|
433
|
-
thinking:
|
|
513
|
+
z3.object({
|
|
514
|
+
type: z3.literal("thinking"),
|
|
515
|
+
thinking: z3.string()
|
|
434
516
|
}),
|
|
435
|
-
|
|
436
|
-
type:
|
|
437
|
-
id:
|
|
438
|
-
name:
|
|
517
|
+
z3.object({
|
|
518
|
+
type: z3.literal("tool_use"),
|
|
519
|
+
id: z3.string(),
|
|
520
|
+
name: z3.string(),
|
|
439
521
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
440
|
-
input:
|
|
522
|
+
input: z3.record(z3.string(), z3.unknown()).optional(),
|
|
441
523
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
442
|
-
caller:
|
|
443
|
-
|
|
444
|
-
type:
|
|
445
|
-
tool_id:
|
|
524
|
+
caller: z3.union([
|
|
525
|
+
z3.object({
|
|
526
|
+
type: z3.literal("code_execution_20250825"),
|
|
527
|
+
tool_id: z3.string()
|
|
446
528
|
}),
|
|
447
|
-
|
|
448
|
-
type:
|
|
449
|
-
tool_id:
|
|
529
|
+
z3.object({
|
|
530
|
+
type: z3.literal("code_execution_20260120"),
|
|
531
|
+
tool_id: z3.string()
|
|
450
532
|
}),
|
|
451
|
-
|
|
452
|
-
type:
|
|
533
|
+
z3.object({
|
|
534
|
+
type: z3.literal("direct")
|
|
453
535
|
})
|
|
454
536
|
]).optional()
|
|
455
537
|
}),
|
|
456
|
-
|
|
457
|
-
type:
|
|
458
|
-
data:
|
|
538
|
+
z3.object({
|
|
539
|
+
type: z3.literal("redacted_thinking"),
|
|
540
|
+
data: z3.string()
|
|
459
541
|
}),
|
|
460
|
-
|
|
461
|
-
type:
|
|
462
|
-
content:
|
|
542
|
+
z3.object({
|
|
543
|
+
type: z3.literal("compaction"),
|
|
544
|
+
content: z3.string().nullish()
|
|
463
545
|
}),
|
|
464
|
-
|
|
465
|
-
type:
|
|
466
|
-
id:
|
|
467
|
-
name:
|
|
468
|
-
input:
|
|
469
|
-
caller:
|
|
470
|
-
|
|
471
|
-
type:
|
|
472
|
-
tool_id:
|
|
546
|
+
z3.object({
|
|
547
|
+
type: z3.literal("server_tool_use"),
|
|
548
|
+
id: z3.string(),
|
|
549
|
+
name: z3.string(),
|
|
550
|
+
input: z3.record(z3.string(), z3.unknown()).nullish(),
|
|
551
|
+
caller: z3.union([
|
|
552
|
+
z3.object({
|
|
553
|
+
type: z3.literal("code_execution_20260120"),
|
|
554
|
+
tool_id: z3.string()
|
|
473
555
|
}),
|
|
474
|
-
|
|
475
|
-
type:
|
|
556
|
+
z3.object({
|
|
557
|
+
type: z3.literal("direct")
|
|
476
558
|
})
|
|
477
559
|
]).optional()
|
|
478
560
|
}),
|
|
479
|
-
|
|
480
|
-
type:
|
|
481
|
-
id:
|
|
482
|
-
name:
|
|
483
|
-
input:
|
|
484
|
-
server_name:
|
|
561
|
+
z3.object({
|
|
562
|
+
type: z3.literal("mcp_tool_use"),
|
|
563
|
+
id: z3.string(),
|
|
564
|
+
name: z3.string(),
|
|
565
|
+
input: z3.unknown(),
|
|
566
|
+
server_name: z3.string()
|
|
485
567
|
}),
|
|
486
|
-
|
|
487
|
-
type:
|
|
488
|
-
tool_use_id:
|
|
489
|
-
is_error:
|
|
490
|
-
content:
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
568
|
+
z3.object({
|
|
569
|
+
type: z3.literal("mcp_tool_result"),
|
|
570
|
+
tool_use_id: z3.string(),
|
|
571
|
+
is_error: z3.boolean(),
|
|
572
|
+
content: z3.array(
|
|
573
|
+
z3.union([
|
|
574
|
+
z3.string(),
|
|
575
|
+
z3.object({ type: z3.literal("text"), text: z3.string() })
|
|
494
576
|
])
|
|
495
577
|
)
|
|
496
578
|
}),
|
|
497
|
-
|
|
498
|
-
type:
|
|
499
|
-
tool_use_id:
|
|
500
|
-
content:
|
|
501
|
-
|
|
502
|
-
type:
|
|
503
|
-
url:
|
|
504
|
-
retrieved_at:
|
|
505
|
-
content:
|
|
506
|
-
type:
|
|
507
|
-
title:
|
|
508
|
-
citations:
|
|
509
|
-
source:
|
|
510
|
-
|
|
511
|
-
type:
|
|
512
|
-
media_type:
|
|
513
|
-
data:
|
|
579
|
+
z3.object({
|
|
580
|
+
type: z3.literal("web_fetch_tool_result"),
|
|
581
|
+
tool_use_id: z3.string(),
|
|
582
|
+
content: z3.union([
|
|
583
|
+
z3.object({
|
|
584
|
+
type: z3.literal("web_fetch_result"),
|
|
585
|
+
url: z3.string(),
|
|
586
|
+
retrieved_at: z3.string(),
|
|
587
|
+
content: z3.object({
|
|
588
|
+
type: z3.literal("document"),
|
|
589
|
+
title: z3.string().nullable(),
|
|
590
|
+
citations: z3.object({ enabled: z3.boolean() }).optional(),
|
|
591
|
+
source: z3.union([
|
|
592
|
+
z3.object({
|
|
593
|
+
type: z3.literal("base64"),
|
|
594
|
+
media_type: z3.literal("application/pdf"),
|
|
595
|
+
data: z3.string()
|
|
514
596
|
}),
|
|
515
|
-
|
|
516
|
-
type:
|
|
517
|
-
media_type:
|
|
518
|
-
data:
|
|
597
|
+
z3.object({
|
|
598
|
+
type: z3.literal("text"),
|
|
599
|
+
media_type: z3.literal("text/plain"),
|
|
600
|
+
data: z3.string()
|
|
519
601
|
})
|
|
520
602
|
])
|
|
521
603
|
})
|
|
522
604
|
}),
|
|
523
|
-
|
|
524
|
-
type:
|
|
525
|
-
error_code:
|
|
605
|
+
z3.object({
|
|
606
|
+
type: z3.literal("web_fetch_tool_result_error"),
|
|
607
|
+
error_code: z3.string()
|
|
526
608
|
})
|
|
527
609
|
])
|
|
528
610
|
}),
|
|
529
|
-
|
|
530
|
-
type:
|
|
531
|
-
tool_use_id:
|
|
532
|
-
content:
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
type:
|
|
536
|
-
url:
|
|
537
|
-
title:
|
|
538
|
-
encrypted_content:
|
|
539
|
-
page_age:
|
|
611
|
+
z3.object({
|
|
612
|
+
type: z3.literal("web_search_tool_result"),
|
|
613
|
+
tool_use_id: z3.string(),
|
|
614
|
+
content: z3.union([
|
|
615
|
+
z3.array(
|
|
616
|
+
z3.object({
|
|
617
|
+
type: z3.literal("web_search_result"),
|
|
618
|
+
url: z3.string(),
|
|
619
|
+
title: z3.string(),
|
|
620
|
+
encrypted_content: z3.string(),
|
|
621
|
+
page_age: z3.string().nullish()
|
|
540
622
|
})
|
|
541
623
|
),
|
|
542
|
-
|
|
543
|
-
type:
|
|
544
|
-
error_code:
|
|
624
|
+
z3.object({
|
|
625
|
+
type: z3.literal("web_search_tool_result_error"),
|
|
626
|
+
error_code: z3.string()
|
|
545
627
|
})
|
|
546
628
|
])
|
|
547
629
|
}),
|
|
548
630
|
// code execution results for code_execution_20250522 tool:
|
|
549
|
-
|
|
550
|
-
type:
|
|
551
|
-
tool_use_id:
|
|
552
|
-
content:
|
|
553
|
-
|
|
554
|
-
type:
|
|
555
|
-
stdout:
|
|
556
|
-
stderr:
|
|
557
|
-
return_code:
|
|
558
|
-
content:
|
|
559
|
-
|
|
560
|
-
type:
|
|
561
|
-
file_id:
|
|
631
|
+
z3.object({
|
|
632
|
+
type: z3.literal("code_execution_tool_result"),
|
|
633
|
+
tool_use_id: z3.string(),
|
|
634
|
+
content: z3.union([
|
|
635
|
+
z3.object({
|
|
636
|
+
type: z3.literal("code_execution_result"),
|
|
637
|
+
stdout: z3.string(),
|
|
638
|
+
stderr: z3.string(),
|
|
639
|
+
return_code: z3.number(),
|
|
640
|
+
content: z3.array(
|
|
641
|
+
z3.object({
|
|
642
|
+
type: z3.literal("code_execution_output"),
|
|
643
|
+
file_id: z3.string()
|
|
562
644
|
})
|
|
563
645
|
).optional().default([])
|
|
564
646
|
}),
|
|
565
|
-
|
|
566
|
-
type:
|
|
567
|
-
encrypted_stdout:
|
|
568
|
-
stderr:
|
|
569
|
-
return_code:
|
|
570
|
-
content:
|
|
571
|
-
|
|
572
|
-
type:
|
|
573
|
-
file_id:
|
|
647
|
+
z3.object({
|
|
648
|
+
type: z3.literal("encrypted_code_execution_result"),
|
|
649
|
+
encrypted_stdout: z3.string(),
|
|
650
|
+
stderr: z3.string(),
|
|
651
|
+
return_code: z3.number(),
|
|
652
|
+
content: z3.array(
|
|
653
|
+
z3.object({
|
|
654
|
+
type: z3.literal("code_execution_output"),
|
|
655
|
+
file_id: z3.string()
|
|
574
656
|
})
|
|
575
657
|
).optional().default([])
|
|
576
658
|
}),
|
|
577
|
-
|
|
578
|
-
type:
|
|
579
|
-
error_code:
|
|
659
|
+
z3.object({
|
|
660
|
+
type: z3.literal("code_execution_tool_result_error"),
|
|
661
|
+
error_code: z3.string()
|
|
580
662
|
})
|
|
581
663
|
])
|
|
582
664
|
}),
|
|
583
665
|
// bash code execution results for code_execution_20250825 tool:
|
|
584
|
-
|
|
585
|
-
type:
|
|
586
|
-
tool_use_id:
|
|
587
|
-
content:
|
|
588
|
-
|
|
589
|
-
type:
|
|
590
|
-
content:
|
|
591
|
-
|
|
592
|
-
type:
|
|
593
|
-
file_id:
|
|
666
|
+
z3.object({
|
|
667
|
+
type: z3.literal("bash_code_execution_tool_result"),
|
|
668
|
+
tool_use_id: z3.string(),
|
|
669
|
+
content: z3.discriminatedUnion("type", [
|
|
670
|
+
z3.object({
|
|
671
|
+
type: z3.literal("bash_code_execution_result"),
|
|
672
|
+
content: z3.array(
|
|
673
|
+
z3.object({
|
|
674
|
+
type: z3.literal("bash_code_execution_output"),
|
|
675
|
+
file_id: z3.string()
|
|
594
676
|
})
|
|
595
677
|
),
|
|
596
|
-
stdout:
|
|
597
|
-
stderr:
|
|
598
|
-
return_code:
|
|
678
|
+
stdout: z3.string(),
|
|
679
|
+
stderr: z3.string(),
|
|
680
|
+
return_code: z3.number()
|
|
599
681
|
}),
|
|
600
|
-
|
|
601
|
-
type:
|
|
602
|
-
error_code:
|
|
682
|
+
z3.object({
|
|
683
|
+
type: z3.literal("bash_code_execution_tool_result_error"),
|
|
684
|
+
error_code: z3.string()
|
|
603
685
|
})
|
|
604
686
|
])
|
|
605
687
|
}),
|
|
606
688
|
// text editor code execution results for code_execution_20250825 tool:
|
|
607
|
-
|
|
608
|
-
type:
|
|
609
|
-
tool_use_id:
|
|
610
|
-
content:
|
|
611
|
-
|
|
612
|
-
type:
|
|
613
|
-
error_code:
|
|
689
|
+
z3.object({
|
|
690
|
+
type: z3.literal("text_editor_code_execution_tool_result"),
|
|
691
|
+
tool_use_id: z3.string(),
|
|
692
|
+
content: z3.discriminatedUnion("type", [
|
|
693
|
+
z3.object({
|
|
694
|
+
type: z3.literal("text_editor_code_execution_tool_result_error"),
|
|
695
|
+
error_code: z3.string()
|
|
614
696
|
}),
|
|
615
|
-
|
|
616
|
-
type:
|
|
617
|
-
content:
|
|
618
|
-
file_type:
|
|
619
|
-
num_lines:
|
|
620
|
-
start_line:
|
|
621
|
-
total_lines:
|
|
697
|
+
z3.object({
|
|
698
|
+
type: z3.literal("text_editor_code_execution_view_result"),
|
|
699
|
+
content: z3.string(),
|
|
700
|
+
file_type: z3.string(),
|
|
701
|
+
num_lines: z3.number().nullable(),
|
|
702
|
+
start_line: z3.number().nullable(),
|
|
703
|
+
total_lines: z3.number().nullable()
|
|
622
704
|
}),
|
|
623
|
-
|
|
624
|
-
type:
|
|
625
|
-
is_file_update:
|
|
705
|
+
z3.object({
|
|
706
|
+
type: z3.literal("text_editor_code_execution_create_result"),
|
|
707
|
+
is_file_update: z3.boolean()
|
|
626
708
|
}),
|
|
627
|
-
|
|
628
|
-
type:
|
|
709
|
+
z3.object({
|
|
710
|
+
type: z3.literal(
|
|
629
711
|
"text_editor_code_execution_str_replace_result"
|
|
630
712
|
),
|
|
631
|
-
lines:
|
|
632
|
-
new_lines:
|
|
633
|
-
new_start:
|
|
634
|
-
old_lines:
|
|
635
|
-
old_start:
|
|
713
|
+
lines: z3.array(z3.string()).nullable(),
|
|
714
|
+
new_lines: z3.number().nullable(),
|
|
715
|
+
new_start: z3.number().nullable(),
|
|
716
|
+
old_lines: z3.number().nullable(),
|
|
717
|
+
old_start: z3.number().nullable()
|
|
636
718
|
})
|
|
637
719
|
])
|
|
638
720
|
}),
|
|
639
721
|
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
640
|
-
|
|
641
|
-
type:
|
|
642
|
-
tool_use_id:
|
|
643
|
-
content:
|
|
644
|
-
|
|
645
|
-
type:
|
|
646
|
-
tool_references:
|
|
647
|
-
|
|
648
|
-
type:
|
|
649
|
-
tool_name:
|
|
722
|
+
z3.object({
|
|
723
|
+
type: z3.literal("tool_search_tool_result"),
|
|
724
|
+
tool_use_id: z3.string(),
|
|
725
|
+
content: z3.union([
|
|
726
|
+
z3.object({
|
|
727
|
+
type: z3.literal("tool_search_tool_search_result"),
|
|
728
|
+
tool_references: z3.array(
|
|
729
|
+
z3.object({
|
|
730
|
+
type: z3.literal("tool_reference"),
|
|
731
|
+
tool_name: z3.string()
|
|
650
732
|
})
|
|
651
733
|
)
|
|
652
734
|
}),
|
|
653
|
-
|
|
654
|
-
type:
|
|
655
|
-
error_code:
|
|
735
|
+
z3.object({
|
|
736
|
+
type: z3.literal("tool_search_tool_result_error"),
|
|
737
|
+
error_code: z3.string()
|
|
656
738
|
})
|
|
657
739
|
])
|
|
658
740
|
})
|
|
659
741
|
])
|
|
660
742
|
}),
|
|
661
|
-
|
|
662
|
-
type:
|
|
663
|
-
index:
|
|
664
|
-
delta:
|
|
665
|
-
|
|
666
|
-
type:
|
|
667
|
-
partial_json:
|
|
743
|
+
z3.object({
|
|
744
|
+
type: z3.literal("content_block_delta"),
|
|
745
|
+
index: z3.number(),
|
|
746
|
+
delta: z3.discriminatedUnion("type", [
|
|
747
|
+
z3.object({
|
|
748
|
+
type: z3.literal("input_json_delta"),
|
|
749
|
+
partial_json: z3.string()
|
|
668
750
|
}),
|
|
669
|
-
|
|
670
|
-
type:
|
|
671
|
-
text:
|
|
751
|
+
z3.object({
|
|
752
|
+
type: z3.literal("text_delta"),
|
|
753
|
+
text: z3.string()
|
|
672
754
|
}),
|
|
673
|
-
|
|
674
|
-
type:
|
|
675
|
-
thinking:
|
|
755
|
+
z3.object({
|
|
756
|
+
type: z3.literal("thinking_delta"),
|
|
757
|
+
thinking: z3.string()
|
|
676
758
|
}),
|
|
677
|
-
|
|
678
|
-
type:
|
|
679
|
-
signature:
|
|
759
|
+
z3.object({
|
|
760
|
+
type: z3.literal("signature_delta"),
|
|
761
|
+
signature: z3.string()
|
|
680
762
|
}),
|
|
681
|
-
|
|
682
|
-
type:
|
|
683
|
-
content:
|
|
763
|
+
z3.object({
|
|
764
|
+
type: z3.literal("compaction_delta"),
|
|
765
|
+
content: z3.string().nullish()
|
|
684
766
|
}),
|
|
685
|
-
|
|
686
|
-
type:
|
|
687
|
-
citation:
|
|
688
|
-
|
|
689
|
-
type:
|
|
690
|
-
cited_text:
|
|
691
|
-
url:
|
|
692
|
-
title:
|
|
693
|
-
encrypted_index:
|
|
767
|
+
z3.object({
|
|
768
|
+
type: z3.literal("citations_delta"),
|
|
769
|
+
citation: z3.discriminatedUnion("type", [
|
|
770
|
+
z3.object({
|
|
771
|
+
type: z3.literal("web_search_result_location"),
|
|
772
|
+
cited_text: z3.string(),
|
|
773
|
+
url: z3.string(),
|
|
774
|
+
title: z3.string(),
|
|
775
|
+
encrypted_index: z3.string()
|
|
694
776
|
}),
|
|
695
|
-
|
|
696
|
-
type:
|
|
697
|
-
cited_text:
|
|
698
|
-
document_index:
|
|
699
|
-
document_title:
|
|
700
|
-
start_page_number:
|
|
701
|
-
end_page_number:
|
|
777
|
+
z3.object({
|
|
778
|
+
type: z3.literal("page_location"),
|
|
779
|
+
cited_text: z3.string(),
|
|
780
|
+
document_index: z3.number(),
|
|
781
|
+
document_title: z3.string().nullable(),
|
|
782
|
+
start_page_number: z3.number(),
|
|
783
|
+
end_page_number: z3.number()
|
|
702
784
|
}),
|
|
703
|
-
|
|
704
|
-
type:
|
|
705
|
-
cited_text:
|
|
706
|
-
document_index:
|
|
707
|
-
document_title:
|
|
708
|
-
start_char_index:
|
|
709
|
-
end_char_index:
|
|
785
|
+
z3.object({
|
|
786
|
+
type: z3.literal("char_location"),
|
|
787
|
+
cited_text: z3.string(),
|
|
788
|
+
document_index: z3.number(),
|
|
789
|
+
document_title: z3.string().nullable(),
|
|
790
|
+
start_char_index: z3.number(),
|
|
791
|
+
end_char_index: z3.number()
|
|
710
792
|
})
|
|
711
793
|
])
|
|
712
794
|
})
|
|
713
795
|
])
|
|
714
796
|
}),
|
|
715
|
-
|
|
716
|
-
type:
|
|
717
|
-
index:
|
|
797
|
+
z3.object({
|
|
798
|
+
type: z3.literal("content_block_stop"),
|
|
799
|
+
index: z3.number()
|
|
718
800
|
}),
|
|
719
|
-
|
|
720
|
-
type:
|
|
721
|
-
error:
|
|
722
|
-
type:
|
|
723
|
-
message:
|
|
801
|
+
z3.object({
|
|
802
|
+
type: z3.literal("error"),
|
|
803
|
+
error: z3.object({
|
|
804
|
+
type: z3.string(),
|
|
805
|
+
message: z3.string()
|
|
724
806
|
})
|
|
725
807
|
}),
|
|
726
|
-
|
|
727
|
-
type:
|
|
728
|
-
delta:
|
|
729
|
-
stop_reason:
|
|
730
|
-
stop_sequence:
|
|
731
|
-
container:
|
|
732
|
-
expires_at:
|
|
733
|
-
id:
|
|
734
|
-
skills:
|
|
735
|
-
|
|
736
|
-
type:
|
|
737
|
-
|
|
738
|
-
|
|
808
|
+
z3.object({
|
|
809
|
+
type: z3.literal("message_delta"),
|
|
810
|
+
delta: z3.object({
|
|
811
|
+
stop_reason: z3.string().nullish(),
|
|
812
|
+
stop_sequence: z3.string().nullish(),
|
|
813
|
+
container: z3.object({
|
|
814
|
+
expires_at: z3.string(),
|
|
815
|
+
id: z3.string(),
|
|
816
|
+
skills: z3.array(
|
|
817
|
+
z3.object({
|
|
818
|
+
type: z3.union([
|
|
819
|
+
z3.literal("anthropic"),
|
|
820
|
+
z3.literal("custom")
|
|
739
821
|
]),
|
|
740
|
-
skill_id:
|
|
741
|
-
version:
|
|
822
|
+
skill_id: z3.string(),
|
|
823
|
+
version: z3.string()
|
|
742
824
|
})
|
|
743
825
|
).nullish()
|
|
744
826
|
}).nullish()
|
|
745
827
|
}),
|
|
746
|
-
usage:
|
|
747
|
-
input_tokens:
|
|
748
|
-
output_tokens:
|
|
749
|
-
cache_creation_input_tokens:
|
|
750
|
-
cache_read_input_tokens:
|
|
751
|
-
iterations:
|
|
752
|
-
|
|
753
|
-
type:
|
|
754
|
-
input_tokens:
|
|
755
|
-
output_tokens:
|
|
828
|
+
usage: z3.looseObject({
|
|
829
|
+
input_tokens: z3.number().nullish(),
|
|
830
|
+
output_tokens: z3.number(),
|
|
831
|
+
cache_creation_input_tokens: z3.number().nullish(),
|
|
832
|
+
cache_read_input_tokens: z3.number().nullish(),
|
|
833
|
+
iterations: z3.array(
|
|
834
|
+
z3.object({
|
|
835
|
+
type: z3.union([z3.literal("compaction"), z3.literal("message")]),
|
|
836
|
+
input_tokens: z3.number(),
|
|
837
|
+
output_tokens: z3.number()
|
|
756
838
|
})
|
|
757
839
|
).nullish()
|
|
758
840
|
}),
|
|
759
|
-
context_management:
|
|
760
|
-
applied_edits:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
type:
|
|
764
|
-
cleared_tool_uses:
|
|
765
|
-
cleared_input_tokens:
|
|
841
|
+
context_management: z3.object({
|
|
842
|
+
applied_edits: z3.array(
|
|
843
|
+
z3.union([
|
|
844
|
+
z3.object({
|
|
845
|
+
type: z3.literal("clear_tool_uses_20250919"),
|
|
846
|
+
cleared_tool_uses: z3.number(),
|
|
847
|
+
cleared_input_tokens: z3.number()
|
|
766
848
|
}),
|
|
767
|
-
|
|
768
|
-
type:
|
|
769
|
-
cleared_thinking_turns:
|
|
770
|
-
cleared_input_tokens:
|
|
849
|
+
z3.object({
|
|
850
|
+
type: z3.literal("clear_thinking_20251015"),
|
|
851
|
+
cleared_thinking_turns: z3.number(),
|
|
852
|
+
cleared_input_tokens: z3.number()
|
|
771
853
|
}),
|
|
772
|
-
|
|
773
|
-
type:
|
|
854
|
+
z3.object({
|
|
855
|
+
type: z3.literal("compact_20260112")
|
|
774
856
|
})
|
|
775
857
|
])
|
|
776
858
|
)
|
|
777
859
|
}).nullish()
|
|
778
860
|
}),
|
|
779
|
-
|
|
780
|
-
type:
|
|
861
|
+
z3.object({
|
|
862
|
+
type: z3.literal("message_stop")
|
|
781
863
|
}),
|
|
782
|
-
|
|
783
|
-
type:
|
|
864
|
+
z3.object({
|
|
865
|
+
type: z3.literal("ping")
|
|
784
866
|
})
|
|
785
867
|
])
|
|
786
868
|
)
|
|
787
869
|
);
|
|
788
|
-
var anthropicReasoningMetadataSchema =
|
|
789
|
-
() =>
|
|
790
|
-
|
|
791
|
-
signature:
|
|
792
|
-
redactedData:
|
|
870
|
+
var anthropicReasoningMetadataSchema = lazySchema3(
|
|
871
|
+
() => zodSchema3(
|
|
872
|
+
z3.object({
|
|
873
|
+
signature: z3.string().optional(),
|
|
874
|
+
redactedData: z3.string().optional()
|
|
793
875
|
})
|
|
794
876
|
)
|
|
795
877
|
);
|
|
796
878
|
|
|
797
879
|
// src/anthropic-messages-options.ts
|
|
798
|
-
import { z as
|
|
799
|
-
var anthropicFilePartProviderOptions =
|
|
880
|
+
import { z as z4 } from "zod/v4";
|
|
881
|
+
var anthropicFilePartProviderOptions = z4.object({
|
|
800
882
|
/**
|
|
801
883
|
* Citation configuration for this document.
|
|
802
884
|
* When enabled, this document will generate citations in the response.
|
|
803
885
|
*/
|
|
804
|
-
citations:
|
|
886
|
+
citations: z4.object({
|
|
805
887
|
/**
|
|
806
888
|
* Enable citations for this document
|
|
807
889
|
*/
|
|
808
|
-
enabled:
|
|
890
|
+
enabled: z4.boolean()
|
|
809
891
|
}).optional(),
|
|
810
892
|
/**
|
|
811
893
|
* Custom title for the document.
|
|
812
894
|
* If not provided, the filename will be used.
|
|
813
895
|
*/
|
|
814
|
-
title:
|
|
896
|
+
title: z4.string().optional(),
|
|
815
897
|
/**
|
|
816
898
|
* Context about the document that will be passed to the model
|
|
817
899
|
* but not used towards cited content.
|
|
818
900
|
* Useful for storing document metadata as text or stringified JSON.
|
|
819
901
|
*/
|
|
820
|
-
context:
|
|
902
|
+
context: z4.string().optional()
|
|
821
903
|
});
|
|
822
|
-
var anthropicLanguageModelOptions =
|
|
904
|
+
var anthropicLanguageModelOptions = z4.object({
|
|
823
905
|
/**
|
|
824
906
|
* Whether to send reasoning to the model.
|
|
825
907
|
*
|
|
826
908
|
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
827
909
|
*/
|
|
828
|
-
sendReasoning:
|
|
910
|
+
sendReasoning: z4.boolean().optional(),
|
|
829
911
|
/**
|
|
830
912
|
* Determines how structured outputs are generated.
|
|
831
913
|
*
|
|
@@ -833,66 +915,66 @@ var anthropicLanguageModelOptions = z3.object({
|
|
|
833
915
|
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
834
916
|
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
835
917
|
*/
|
|
836
|
-
structuredOutputMode:
|
|
918
|
+
structuredOutputMode: z4.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
837
919
|
/**
|
|
838
920
|
* Configuration for enabling Claude's extended thinking.
|
|
839
921
|
*
|
|
840
922
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
841
923
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
842
924
|
*/
|
|
843
|
-
thinking:
|
|
844
|
-
|
|
925
|
+
thinking: z4.discriminatedUnion("type", [
|
|
926
|
+
z4.object({
|
|
845
927
|
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
846
|
-
type:
|
|
928
|
+
type: z4.literal("adaptive")
|
|
847
929
|
}),
|
|
848
|
-
|
|
930
|
+
z4.object({
|
|
849
931
|
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
850
|
-
type:
|
|
851
|
-
budgetTokens:
|
|
932
|
+
type: z4.literal("enabled"),
|
|
933
|
+
budgetTokens: z4.number().optional()
|
|
852
934
|
}),
|
|
853
|
-
|
|
854
|
-
type:
|
|
935
|
+
z4.object({
|
|
936
|
+
type: z4.literal("disabled")
|
|
855
937
|
})
|
|
856
938
|
]).optional(),
|
|
857
939
|
/**
|
|
858
940
|
* Whether to disable parallel function calling during tool use. Default is false.
|
|
859
941
|
* When set to true, Claude will use at most one tool per response.
|
|
860
942
|
*/
|
|
861
|
-
disableParallelToolUse:
|
|
943
|
+
disableParallelToolUse: z4.boolean().optional(),
|
|
862
944
|
/**
|
|
863
945
|
* Cache control settings for this message.
|
|
864
946
|
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
865
947
|
*/
|
|
866
|
-
cacheControl:
|
|
867
|
-
type:
|
|
868
|
-
ttl:
|
|
948
|
+
cacheControl: z4.object({
|
|
949
|
+
type: z4.literal("ephemeral"),
|
|
950
|
+
ttl: z4.union([z4.literal("5m"), z4.literal("1h")]).optional()
|
|
869
951
|
}).optional(),
|
|
870
952
|
/**
|
|
871
953
|
* Metadata to include with the request.
|
|
872
954
|
*
|
|
873
955
|
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
874
956
|
*/
|
|
875
|
-
metadata:
|
|
957
|
+
metadata: z4.object({
|
|
876
958
|
/**
|
|
877
959
|
* An external identifier for the user associated with the request.
|
|
878
960
|
*
|
|
879
961
|
* Should be a UUID, hash value, or other opaque identifier.
|
|
880
962
|
* Must not contain PII (name, email, phone number, etc.).
|
|
881
963
|
*/
|
|
882
|
-
userId:
|
|
964
|
+
userId: z4.string().optional()
|
|
883
965
|
}).optional(),
|
|
884
966
|
/**
|
|
885
967
|
* MCP servers to be utilized in this request.
|
|
886
968
|
*/
|
|
887
|
-
mcpServers:
|
|
888
|
-
|
|
889
|
-
type:
|
|
890
|
-
name:
|
|
891
|
-
url:
|
|
892
|
-
authorizationToken:
|
|
893
|
-
toolConfiguration:
|
|
894
|
-
enabled:
|
|
895
|
-
allowedTools:
|
|
969
|
+
mcpServers: z4.array(
|
|
970
|
+
z4.object({
|
|
971
|
+
type: z4.literal("url"),
|
|
972
|
+
name: z4.string(),
|
|
973
|
+
url: z4.string(),
|
|
974
|
+
authorizationToken: z4.string().nullish(),
|
|
975
|
+
toolConfiguration: z4.object({
|
|
976
|
+
enabled: z4.boolean().nullish(),
|
|
977
|
+
allowedTools: z4.array(z4.string()).nullish()
|
|
896
978
|
}).nullish()
|
|
897
979
|
})
|
|
898
980
|
).optional(),
|
|
@@ -901,13 +983,13 @@ var anthropicLanguageModelOptions = z3.object({
|
|
|
901
983
|
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
902
984
|
* Requires code execution tool to be enabled.
|
|
903
985
|
*/
|
|
904
|
-
container:
|
|
905
|
-
id:
|
|
906
|
-
skills:
|
|
907
|
-
|
|
908
|
-
type:
|
|
909
|
-
skillId:
|
|
910
|
-
version:
|
|
986
|
+
container: z4.object({
|
|
987
|
+
id: z4.string().optional(),
|
|
988
|
+
skills: z4.array(
|
|
989
|
+
z4.object({
|
|
990
|
+
type: z4.union([z4.literal("anthropic"), z4.literal("custom")]),
|
|
991
|
+
skillId: z4.string(),
|
|
992
|
+
version: z4.string().optional()
|
|
911
993
|
})
|
|
912
994
|
).optional()
|
|
913
995
|
}).optional(),
|
|
@@ -919,65 +1001,65 @@ var anthropicLanguageModelOptions = z3.object({
|
|
|
919
1001
|
*
|
|
920
1002
|
* @default true
|
|
921
1003
|
*/
|
|
922
|
-
toolStreaming:
|
|
1004
|
+
toolStreaming: z4.boolean().optional(),
|
|
923
1005
|
/**
|
|
924
1006
|
* @default 'high'
|
|
925
1007
|
*/
|
|
926
|
-
effort:
|
|
1008
|
+
effort: z4.enum(["low", "medium", "high", "max"]).optional(),
|
|
927
1009
|
/**
|
|
928
1010
|
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
929
1011
|
* Only supported with claude-opus-4-6.
|
|
930
1012
|
*/
|
|
931
|
-
speed:
|
|
1013
|
+
speed: z4.enum(["fast", "standard"]).optional(),
|
|
932
1014
|
/**
|
|
933
1015
|
* A set of beta features to enable.
|
|
934
1016
|
* Allow a provider to receive the full `betas` set if it needs it.
|
|
935
1017
|
*/
|
|
936
|
-
anthropicBeta:
|
|
937
|
-
contextManagement:
|
|
938
|
-
edits:
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
type:
|
|
942
|
-
trigger:
|
|
943
|
-
|
|
944
|
-
type:
|
|
945
|
-
value:
|
|
1018
|
+
anthropicBeta: z4.array(z4.string()).optional(),
|
|
1019
|
+
contextManagement: z4.object({
|
|
1020
|
+
edits: z4.array(
|
|
1021
|
+
z4.discriminatedUnion("type", [
|
|
1022
|
+
z4.object({
|
|
1023
|
+
type: z4.literal("clear_tool_uses_20250919"),
|
|
1024
|
+
trigger: z4.discriminatedUnion("type", [
|
|
1025
|
+
z4.object({
|
|
1026
|
+
type: z4.literal("input_tokens"),
|
|
1027
|
+
value: z4.number()
|
|
946
1028
|
}),
|
|
947
|
-
|
|
948
|
-
type:
|
|
949
|
-
value:
|
|
1029
|
+
z4.object({
|
|
1030
|
+
type: z4.literal("tool_uses"),
|
|
1031
|
+
value: z4.number()
|
|
950
1032
|
})
|
|
951
1033
|
]).optional(),
|
|
952
|
-
keep:
|
|
953
|
-
type:
|
|
954
|
-
value:
|
|
1034
|
+
keep: z4.object({
|
|
1035
|
+
type: z4.literal("tool_uses"),
|
|
1036
|
+
value: z4.number()
|
|
955
1037
|
}).optional(),
|
|
956
|
-
clearAtLeast:
|
|
957
|
-
type:
|
|
958
|
-
value:
|
|
1038
|
+
clearAtLeast: z4.object({
|
|
1039
|
+
type: z4.literal("input_tokens"),
|
|
1040
|
+
value: z4.number()
|
|
959
1041
|
}).optional(),
|
|
960
|
-
clearToolInputs:
|
|
961
|
-
excludeTools:
|
|
1042
|
+
clearToolInputs: z4.boolean().optional(),
|
|
1043
|
+
excludeTools: z4.array(z4.string()).optional()
|
|
962
1044
|
}),
|
|
963
|
-
|
|
964
|
-
type:
|
|
965
|
-
keep:
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
type:
|
|
969
|
-
value:
|
|
1045
|
+
z4.object({
|
|
1046
|
+
type: z4.literal("clear_thinking_20251015"),
|
|
1047
|
+
keep: z4.union([
|
|
1048
|
+
z4.literal("all"),
|
|
1049
|
+
z4.object({
|
|
1050
|
+
type: z4.literal("thinking_turns"),
|
|
1051
|
+
value: z4.number()
|
|
970
1052
|
})
|
|
971
1053
|
]).optional()
|
|
972
1054
|
}),
|
|
973
|
-
|
|
974
|
-
type:
|
|
975
|
-
trigger:
|
|
976
|
-
type:
|
|
977
|
-
value:
|
|
1055
|
+
z4.object({
|
|
1056
|
+
type: z4.literal("compact_20260112"),
|
|
1057
|
+
trigger: z4.object({
|
|
1058
|
+
type: z4.literal("input_tokens"),
|
|
1059
|
+
value: z4.number()
|
|
978
1060
|
}).optional(),
|
|
979
|
-
pauseAfterCompaction:
|
|
980
|
-
instructions:
|
|
1061
|
+
pauseAfterCompaction: z4.boolean().optional(),
|
|
1062
|
+
instructions: z4.string().optional()
|
|
981
1063
|
})
|
|
982
1064
|
])
|
|
983
1065
|
)
|
|
@@ -1033,26 +1115,26 @@ var CacheControlValidator = class {
|
|
|
1033
1115
|
|
|
1034
1116
|
// src/tool/text-editor_20250728.ts
|
|
1035
1117
|
import { createProviderToolFactory } from "@ai-sdk/provider-utils";
|
|
1036
|
-
import { z as
|
|
1037
|
-
import { lazySchema as
|
|
1038
|
-
var textEditor_20250728ArgsSchema =
|
|
1039
|
-
() =>
|
|
1040
|
-
|
|
1041
|
-
maxCharacters:
|
|
1118
|
+
import { z as z5 } from "zod/v4";
|
|
1119
|
+
import { lazySchema as lazySchema4, zodSchema as zodSchema4 } from "@ai-sdk/provider-utils";
|
|
1120
|
+
var textEditor_20250728ArgsSchema = lazySchema4(
|
|
1121
|
+
() => zodSchema4(
|
|
1122
|
+
z5.object({
|
|
1123
|
+
maxCharacters: z5.number().optional()
|
|
1042
1124
|
})
|
|
1043
1125
|
)
|
|
1044
1126
|
);
|
|
1045
|
-
var textEditor_20250728InputSchema =
|
|
1046
|
-
() =>
|
|
1047
|
-
|
|
1048
|
-
command:
|
|
1049
|
-
path:
|
|
1050
|
-
file_text:
|
|
1051
|
-
insert_line:
|
|
1052
|
-
new_str:
|
|
1053
|
-
insert_text:
|
|
1054
|
-
old_str:
|
|
1055
|
-
view_range:
|
|
1127
|
+
var textEditor_20250728InputSchema = lazySchema4(
|
|
1128
|
+
() => zodSchema4(
|
|
1129
|
+
z5.object({
|
|
1130
|
+
command: z5.enum(["view", "create", "str_replace", "insert"]),
|
|
1131
|
+
path: z5.string(),
|
|
1132
|
+
file_text: z5.string().optional(),
|
|
1133
|
+
insert_line: z5.number().int().optional(),
|
|
1134
|
+
new_str: z5.string().optional(),
|
|
1135
|
+
insert_text: z5.string().optional(),
|
|
1136
|
+
old_str: z5.string().optional(),
|
|
1137
|
+
view_range: z5.array(z5.number().int()).optional()
|
|
1056
1138
|
})
|
|
1057
1139
|
)
|
|
1058
1140
|
);
|
|
@@ -1067,64 +1149,11 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1067
1149
|
// src/tool/web-search_20260209.ts
|
|
1068
1150
|
import {
|
|
1069
1151
|
createProviderToolFactoryWithOutputSchema,
|
|
1070
|
-
lazySchema as lazySchema4,
|
|
1071
|
-
zodSchema as zodSchema4
|
|
1072
|
-
} from "@ai-sdk/provider-utils";
|
|
1073
|
-
import { z as z5 } from "zod/v4";
|
|
1074
|
-
var webSearch_20260209ArgsSchema = lazySchema4(
|
|
1075
|
-
() => zodSchema4(
|
|
1076
|
-
z5.object({
|
|
1077
|
-
maxUses: z5.number().optional(),
|
|
1078
|
-
allowedDomains: z5.array(z5.string()).optional(),
|
|
1079
|
-
blockedDomains: z5.array(z5.string()).optional(),
|
|
1080
|
-
userLocation: z5.object({
|
|
1081
|
-
type: z5.literal("approximate"),
|
|
1082
|
-
city: z5.string().optional(),
|
|
1083
|
-
region: z5.string().optional(),
|
|
1084
|
-
country: z5.string().optional(),
|
|
1085
|
-
timezone: z5.string().optional()
|
|
1086
|
-
}).optional()
|
|
1087
|
-
})
|
|
1088
|
-
)
|
|
1089
|
-
);
|
|
1090
|
-
var webSearch_20260209OutputSchema = lazySchema4(
|
|
1091
|
-
() => zodSchema4(
|
|
1092
|
-
z5.array(
|
|
1093
|
-
z5.object({
|
|
1094
|
-
url: z5.string(),
|
|
1095
|
-
title: z5.string().nullable(),
|
|
1096
|
-
pageAge: z5.string().nullable(),
|
|
1097
|
-
encryptedContent: z5.string(),
|
|
1098
|
-
type: z5.literal("web_search_result")
|
|
1099
|
-
})
|
|
1100
|
-
)
|
|
1101
|
-
)
|
|
1102
|
-
);
|
|
1103
|
-
var webSearch_20260209InputSchema = lazySchema4(
|
|
1104
|
-
() => zodSchema4(
|
|
1105
|
-
z5.object({
|
|
1106
|
-
query: z5.string()
|
|
1107
|
-
})
|
|
1108
|
-
)
|
|
1109
|
-
);
|
|
1110
|
-
var factory2 = createProviderToolFactoryWithOutputSchema({
|
|
1111
|
-
id: "anthropic.web_search_20260209",
|
|
1112
|
-
inputSchema: webSearch_20260209InputSchema,
|
|
1113
|
-
outputSchema: webSearch_20260209OutputSchema,
|
|
1114
|
-
supportsDeferredResults: true
|
|
1115
|
-
});
|
|
1116
|
-
var webSearch_20260209 = (args = {}) => {
|
|
1117
|
-
return factory2(args);
|
|
1118
|
-
};
|
|
1119
|
-
|
|
1120
|
-
// src/tool/web-search_20250305.ts
|
|
1121
|
-
import {
|
|
1122
|
-
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1123
1152
|
lazySchema as lazySchema5,
|
|
1124
1153
|
zodSchema as zodSchema5
|
|
1125
1154
|
} from "@ai-sdk/provider-utils";
|
|
1126
1155
|
import { z as z6 } from "zod/v4";
|
|
1127
|
-
var
|
|
1156
|
+
var webSearch_20260209ArgsSchema = lazySchema5(
|
|
1128
1157
|
() => zodSchema5(
|
|
1129
1158
|
z6.object({
|
|
1130
1159
|
maxUses: z6.number().optional(),
|
|
@@ -1140,7 +1169,7 @@ var webSearch_20250305ArgsSchema = lazySchema5(
|
|
|
1140
1169
|
})
|
|
1141
1170
|
)
|
|
1142
1171
|
);
|
|
1143
|
-
var
|
|
1172
|
+
var webSearch_20260209OutputSchema = lazySchema5(
|
|
1144
1173
|
() => zodSchema5(
|
|
1145
1174
|
z6.array(
|
|
1146
1175
|
z6.object({
|
|
@@ -1153,92 +1182,84 @@ var webSearch_20250305OutputSchema = lazySchema5(
|
|
|
1153
1182
|
)
|
|
1154
1183
|
)
|
|
1155
1184
|
);
|
|
1156
|
-
var
|
|
1185
|
+
var webSearch_20260209InputSchema = lazySchema5(
|
|
1157
1186
|
() => zodSchema5(
|
|
1158
1187
|
z6.object({
|
|
1159
1188
|
query: z6.string()
|
|
1160
1189
|
})
|
|
1161
1190
|
)
|
|
1162
1191
|
);
|
|
1163
|
-
var
|
|
1164
|
-
id: "anthropic.
|
|
1165
|
-
inputSchema:
|
|
1166
|
-
outputSchema:
|
|
1192
|
+
var factory2 = createProviderToolFactoryWithOutputSchema({
|
|
1193
|
+
id: "anthropic.web_search_20260209",
|
|
1194
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1195
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1167
1196
|
supportsDeferredResults: true
|
|
1168
1197
|
});
|
|
1169
|
-
var
|
|
1170
|
-
return
|
|
1198
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1199
|
+
return factory2(args);
|
|
1171
1200
|
};
|
|
1172
1201
|
|
|
1173
|
-
// src/tool/web-
|
|
1202
|
+
// src/tool/web-search_20250305.ts
|
|
1174
1203
|
import {
|
|
1175
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1204
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1176
1205
|
lazySchema as lazySchema6,
|
|
1177
1206
|
zodSchema as zodSchema6
|
|
1178
1207
|
} from "@ai-sdk/provider-utils";
|
|
1179
1208
|
import { z as z7 } from "zod/v4";
|
|
1180
|
-
var
|
|
1209
|
+
var webSearch_20250305ArgsSchema = lazySchema6(
|
|
1181
1210
|
() => zodSchema6(
|
|
1182
1211
|
z7.object({
|
|
1183
1212
|
maxUses: z7.number().optional(),
|
|
1184
1213
|
allowedDomains: z7.array(z7.string()).optional(),
|
|
1185
1214
|
blockedDomains: z7.array(z7.string()).optional(),
|
|
1186
|
-
|
|
1187
|
-
|
|
1215
|
+
userLocation: z7.object({
|
|
1216
|
+
type: z7.literal("approximate"),
|
|
1217
|
+
city: z7.string().optional(),
|
|
1218
|
+
region: z7.string().optional(),
|
|
1219
|
+
country: z7.string().optional(),
|
|
1220
|
+
timezone: z7.string().optional()
|
|
1221
|
+
}).optional()
|
|
1188
1222
|
})
|
|
1189
1223
|
)
|
|
1190
1224
|
);
|
|
1191
|
-
var
|
|
1225
|
+
var webSearch_20250305OutputSchema = lazySchema6(
|
|
1192
1226
|
() => zodSchema6(
|
|
1193
|
-
z7.
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
content: z7.object({
|
|
1197
|
-
type: z7.literal("document"),
|
|
1227
|
+
z7.array(
|
|
1228
|
+
z7.object({
|
|
1229
|
+
url: z7.string(),
|
|
1198
1230
|
title: z7.string().nullable(),
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
data: z7.string()
|
|
1205
|
-
}),
|
|
1206
|
-
z7.object({
|
|
1207
|
-
type: z7.literal("text"),
|
|
1208
|
-
mediaType: z7.literal("text/plain"),
|
|
1209
|
-
data: z7.string()
|
|
1210
|
-
})
|
|
1211
|
-
])
|
|
1212
|
-
}),
|
|
1213
|
-
retrievedAt: z7.string().nullable()
|
|
1214
|
-
})
|
|
1231
|
+
pageAge: z7.string().nullable(),
|
|
1232
|
+
encryptedContent: z7.string(),
|
|
1233
|
+
type: z7.literal("web_search_result")
|
|
1234
|
+
})
|
|
1235
|
+
)
|
|
1215
1236
|
)
|
|
1216
1237
|
);
|
|
1217
|
-
var
|
|
1238
|
+
var webSearch_20250305InputSchema = lazySchema6(
|
|
1218
1239
|
() => zodSchema6(
|
|
1219
1240
|
z7.object({
|
|
1220
|
-
|
|
1241
|
+
query: z7.string()
|
|
1221
1242
|
})
|
|
1222
1243
|
)
|
|
1223
1244
|
);
|
|
1224
|
-
var
|
|
1225
|
-
id: "anthropic.
|
|
1226
|
-
inputSchema:
|
|
1227
|
-
outputSchema:
|
|
1245
|
+
var factory3 = createProviderToolFactoryWithOutputSchema2({
|
|
1246
|
+
id: "anthropic.web_search_20250305",
|
|
1247
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1248
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1228
1249
|
supportsDeferredResults: true
|
|
1229
1250
|
});
|
|
1230
|
-
var
|
|
1231
|
-
return
|
|
1251
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1252
|
+
return factory3(args);
|
|
1232
1253
|
};
|
|
1233
1254
|
|
|
1234
|
-
// src/tool/web-fetch-
|
|
1255
|
+
// src/tool/web-fetch-20260209.ts
|
|
1235
1256
|
import {
|
|
1236
|
-
createProviderToolFactoryWithOutputSchema as
|
|
1257
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1237
1258
|
lazySchema as lazySchema7,
|
|
1238
1259
|
zodSchema as zodSchema7
|
|
1239
1260
|
} from "@ai-sdk/provider-utils";
|
|
1240
1261
|
import { z as z8 } from "zod/v4";
|
|
1241
|
-
var
|
|
1262
|
+
var webFetch_20260209ArgsSchema = lazySchema7(
|
|
1242
1263
|
() => zodSchema7(
|
|
1243
1264
|
z8.object({
|
|
1244
1265
|
maxUses: z8.number().optional(),
|
|
@@ -1249,7 +1270,7 @@ var webFetch_20250910ArgsSchema = lazySchema7(
|
|
|
1249
1270
|
})
|
|
1250
1271
|
)
|
|
1251
1272
|
);
|
|
1252
|
-
var
|
|
1273
|
+
var webFetch_20260209OutputSchema = lazySchema7(
|
|
1253
1274
|
() => zodSchema7(
|
|
1254
1275
|
z8.object({
|
|
1255
1276
|
type: z8.literal("web_fetch_result"),
|
|
@@ -1275,13 +1296,74 @@ var webFetch_20250910OutputSchema = lazySchema7(
|
|
|
1275
1296
|
})
|
|
1276
1297
|
)
|
|
1277
1298
|
);
|
|
1278
|
-
var
|
|
1299
|
+
var webFetch_20260209InputSchema = lazySchema7(
|
|
1279
1300
|
() => zodSchema7(
|
|
1280
1301
|
z8.object({
|
|
1281
1302
|
url: z8.string()
|
|
1282
1303
|
})
|
|
1283
1304
|
)
|
|
1284
1305
|
);
|
|
1306
|
+
var factory4 = createProviderToolFactoryWithOutputSchema3({
|
|
1307
|
+
id: "anthropic.web_fetch_20260209",
|
|
1308
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1309
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1310
|
+
supportsDeferredResults: true
|
|
1311
|
+
});
|
|
1312
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1313
|
+
return factory4(args);
|
|
1314
|
+
};
|
|
1315
|
+
|
|
1316
|
+
// src/tool/web-fetch-20250910.ts
|
|
1317
|
+
import {
|
|
1318
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1319
|
+
lazySchema as lazySchema8,
|
|
1320
|
+
zodSchema as zodSchema8
|
|
1321
|
+
} from "@ai-sdk/provider-utils";
|
|
1322
|
+
import { z as z9 } from "zod/v4";
|
|
1323
|
+
var webFetch_20250910ArgsSchema = lazySchema8(
|
|
1324
|
+
() => zodSchema8(
|
|
1325
|
+
z9.object({
|
|
1326
|
+
maxUses: z9.number().optional(),
|
|
1327
|
+
allowedDomains: z9.array(z9.string()).optional(),
|
|
1328
|
+
blockedDomains: z9.array(z9.string()).optional(),
|
|
1329
|
+
citations: z9.object({ enabled: z9.boolean() }).optional(),
|
|
1330
|
+
maxContentTokens: z9.number().optional()
|
|
1331
|
+
})
|
|
1332
|
+
)
|
|
1333
|
+
);
|
|
1334
|
+
var webFetch_20250910OutputSchema = lazySchema8(
|
|
1335
|
+
() => zodSchema8(
|
|
1336
|
+
z9.object({
|
|
1337
|
+
type: z9.literal("web_fetch_result"),
|
|
1338
|
+
url: z9.string(),
|
|
1339
|
+
content: z9.object({
|
|
1340
|
+
type: z9.literal("document"),
|
|
1341
|
+
title: z9.string().nullable(),
|
|
1342
|
+
citations: z9.object({ enabled: z9.boolean() }).optional(),
|
|
1343
|
+
source: z9.union([
|
|
1344
|
+
z9.object({
|
|
1345
|
+
type: z9.literal("base64"),
|
|
1346
|
+
mediaType: z9.literal("application/pdf"),
|
|
1347
|
+
data: z9.string()
|
|
1348
|
+
}),
|
|
1349
|
+
z9.object({
|
|
1350
|
+
type: z9.literal("text"),
|
|
1351
|
+
mediaType: z9.literal("text/plain"),
|
|
1352
|
+
data: z9.string()
|
|
1353
|
+
})
|
|
1354
|
+
])
|
|
1355
|
+
}),
|
|
1356
|
+
retrievedAt: z9.string().nullable()
|
|
1357
|
+
})
|
|
1358
|
+
)
|
|
1359
|
+
);
|
|
1360
|
+
var webFetch_20250910InputSchema = lazySchema8(
|
|
1361
|
+
() => zodSchema8(
|
|
1362
|
+
z9.object({
|
|
1363
|
+
url: z9.string()
|
|
1364
|
+
})
|
|
1365
|
+
)
|
|
1366
|
+
);
|
|
1285
1367
|
var factory5 = createProviderToolFactoryWithOutputSchema4({
|
|
1286
1368
|
id: "anthropic.web_fetch_20250910",
|
|
1287
1369
|
inputSchema: webFetch_20250910InputSchema,
|
|
@@ -1680,9 +1762,11 @@ import {
|
|
|
1680
1762
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
1681
1763
|
} from "@ai-sdk/provider";
|
|
1682
1764
|
import {
|
|
1683
|
-
convertBase64ToUint8Array,
|
|
1765
|
+
convertBase64ToUint8Array as convertBase64ToUint8Array2,
|
|
1684
1766
|
convertToBase64,
|
|
1685
|
-
|
|
1767
|
+
isProviderReference,
|
|
1768
|
+
parseProviderOptions as parseProviderOptions2,
|
|
1769
|
+
resolveProviderReference,
|
|
1686
1770
|
validateTypes as validateTypes2,
|
|
1687
1771
|
isNonNullable
|
|
1688
1772
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1690,30 +1774,30 @@ import {
|
|
|
1690
1774
|
// src/tool/code-execution_20250522.ts
|
|
1691
1775
|
import {
|
|
1692
1776
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1693
|
-
lazySchema as
|
|
1694
|
-
zodSchema as
|
|
1777
|
+
lazySchema as lazySchema9,
|
|
1778
|
+
zodSchema as zodSchema9
|
|
1695
1779
|
} from "@ai-sdk/provider-utils";
|
|
1696
|
-
import { z as
|
|
1697
|
-
var codeExecution_20250522OutputSchema =
|
|
1698
|
-
() =>
|
|
1699
|
-
|
|
1700
|
-
type:
|
|
1701
|
-
stdout:
|
|
1702
|
-
stderr:
|
|
1703
|
-
return_code:
|
|
1704
|
-
content:
|
|
1705
|
-
|
|
1706
|
-
type:
|
|
1707
|
-
file_id:
|
|
1780
|
+
import { z as z10 } from "zod/v4";
|
|
1781
|
+
var codeExecution_20250522OutputSchema = lazySchema9(
|
|
1782
|
+
() => zodSchema9(
|
|
1783
|
+
z10.object({
|
|
1784
|
+
type: z10.literal("code_execution_result"),
|
|
1785
|
+
stdout: z10.string(),
|
|
1786
|
+
stderr: z10.string(),
|
|
1787
|
+
return_code: z10.number(),
|
|
1788
|
+
content: z10.array(
|
|
1789
|
+
z10.object({
|
|
1790
|
+
type: z10.literal("code_execution_output"),
|
|
1791
|
+
file_id: z10.string()
|
|
1708
1792
|
})
|
|
1709
1793
|
).optional().default([])
|
|
1710
1794
|
})
|
|
1711
1795
|
)
|
|
1712
1796
|
);
|
|
1713
|
-
var codeExecution_20250522InputSchema =
|
|
1714
|
-
() =>
|
|
1715
|
-
|
|
1716
|
-
code:
|
|
1797
|
+
var codeExecution_20250522InputSchema = lazySchema9(
|
|
1798
|
+
() => zodSchema9(
|
|
1799
|
+
z10.object({
|
|
1800
|
+
code: z10.string()
|
|
1717
1801
|
})
|
|
1718
1802
|
)
|
|
1719
1803
|
);
|
|
@@ -1729,124 +1813,11 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1729
1813
|
// src/tool/code-execution_20250825.ts
|
|
1730
1814
|
import {
|
|
1731
1815
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
1732
|
-
lazySchema as lazySchema9,
|
|
1733
|
-
zodSchema as zodSchema9
|
|
1734
|
-
} from "@ai-sdk/provider-utils";
|
|
1735
|
-
import { z as z10 } from "zod/v4";
|
|
1736
|
-
var codeExecution_20250825OutputSchema = lazySchema9(
|
|
1737
|
-
() => zodSchema9(
|
|
1738
|
-
z10.discriminatedUnion("type", [
|
|
1739
|
-
z10.object({
|
|
1740
|
-
type: z10.literal("code_execution_result"),
|
|
1741
|
-
stdout: z10.string(),
|
|
1742
|
-
stderr: z10.string(),
|
|
1743
|
-
return_code: z10.number(),
|
|
1744
|
-
content: z10.array(
|
|
1745
|
-
z10.object({
|
|
1746
|
-
type: z10.literal("code_execution_output"),
|
|
1747
|
-
file_id: z10.string()
|
|
1748
|
-
})
|
|
1749
|
-
).optional().default([])
|
|
1750
|
-
}),
|
|
1751
|
-
z10.object({
|
|
1752
|
-
type: z10.literal("bash_code_execution_result"),
|
|
1753
|
-
content: z10.array(
|
|
1754
|
-
z10.object({
|
|
1755
|
-
type: z10.literal("bash_code_execution_output"),
|
|
1756
|
-
file_id: z10.string()
|
|
1757
|
-
})
|
|
1758
|
-
),
|
|
1759
|
-
stdout: z10.string(),
|
|
1760
|
-
stderr: z10.string(),
|
|
1761
|
-
return_code: z10.number()
|
|
1762
|
-
}),
|
|
1763
|
-
z10.object({
|
|
1764
|
-
type: z10.literal("bash_code_execution_tool_result_error"),
|
|
1765
|
-
error_code: z10.string()
|
|
1766
|
-
}),
|
|
1767
|
-
z10.object({
|
|
1768
|
-
type: z10.literal("text_editor_code_execution_tool_result_error"),
|
|
1769
|
-
error_code: z10.string()
|
|
1770
|
-
}),
|
|
1771
|
-
z10.object({
|
|
1772
|
-
type: z10.literal("text_editor_code_execution_view_result"),
|
|
1773
|
-
content: z10.string(),
|
|
1774
|
-
file_type: z10.string(),
|
|
1775
|
-
num_lines: z10.number().nullable(),
|
|
1776
|
-
start_line: z10.number().nullable(),
|
|
1777
|
-
total_lines: z10.number().nullable()
|
|
1778
|
-
}),
|
|
1779
|
-
z10.object({
|
|
1780
|
-
type: z10.literal("text_editor_code_execution_create_result"),
|
|
1781
|
-
is_file_update: z10.boolean()
|
|
1782
|
-
}),
|
|
1783
|
-
z10.object({
|
|
1784
|
-
type: z10.literal("text_editor_code_execution_str_replace_result"),
|
|
1785
|
-
lines: z10.array(z10.string()).nullable(),
|
|
1786
|
-
new_lines: z10.number().nullable(),
|
|
1787
|
-
new_start: z10.number().nullable(),
|
|
1788
|
-
old_lines: z10.number().nullable(),
|
|
1789
|
-
old_start: z10.number().nullable()
|
|
1790
|
-
})
|
|
1791
|
-
])
|
|
1792
|
-
)
|
|
1793
|
-
);
|
|
1794
|
-
var codeExecution_20250825InputSchema = lazySchema9(
|
|
1795
|
-
() => zodSchema9(
|
|
1796
|
-
z10.discriminatedUnion("type", [
|
|
1797
|
-
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1798
|
-
z10.object({
|
|
1799
|
-
type: z10.literal("programmatic-tool-call"),
|
|
1800
|
-
code: z10.string()
|
|
1801
|
-
}),
|
|
1802
|
-
z10.object({
|
|
1803
|
-
type: z10.literal("bash_code_execution"),
|
|
1804
|
-
command: z10.string()
|
|
1805
|
-
}),
|
|
1806
|
-
z10.discriminatedUnion("command", [
|
|
1807
|
-
z10.object({
|
|
1808
|
-
type: z10.literal("text_editor_code_execution"),
|
|
1809
|
-
command: z10.literal("view"),
|
|
1810
|
-
path: z10.string()
|
|
1811
|
-
}),
|
|
1812
|
-
z10.object({
|
|
1813
|
-
type: z10.literal("text_editor_code_execution"),
|
|
1814
|
-
command: z10.literal("create"),
|
|
1815
|
-
path: z10.string(),
|
|
1816
|
-
file_text: z10.string().nullish()
|
|
1817
|
-
}),
|
|
1818
|
-
z10.object({
|
|
1819
|
-
type: z10.literal("text_editor_code_execution"),
|
|
1820
|
-
command: z10.literal("str_replace"),
|
|
1821
|
-
path: z10.string(),
|
|
1822
|
-
old_str: z10.string(),
|
|
1823
|
-
new_str: z10.string()
|
|
1824
|
-
})
|
|
1825
|
-
])
|
|
1826
|
-
])
|
|
1827
|
-
)
|
|
1828
|
-
);
|
|
1829
|
-
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
1830
|
-
id: "anthropic.code_execution_20250825",
|
|
1831
|
-
inputSchema: codeExecution_20250825InputSchema,
|
|
1832
|
-
outputSchema: codeExecution_20250825OutputSchema,
|
|
1833
|
-
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
1834
|
-
// when code execution triggers a client-executed tool that needs to be
|
|
1835
|
-
// resolved before the code execution result can be returned.
|
|
1836
|
-
supportsDeferredResults: true
|
|
1837
|
-
});
|
|
1838
|
-
var codeExecution_20250825 = (args = {}) => {
|
|
1839
|
-
return factory7(args);
|
|
1840
|
-
};
|
|
1841
|
-
|
|
1842
|
-
// src/tool/code-execution_20260120.ts
|
|
1843
|
-
import {
|
|
1844
|
-
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
1845
1816
|
lazySchema as lazySchema10,
|
|
1846
1817
|
zodSchema as zodSchema10
|
|
1847
1818
|
} from "@ai-sdk/provider-utils";
|
|
1848
1819
|
import { z as z11 } from "zod/v4";
|
|
1849
|
-
var
|
|
1820
|
+
var codeExecution_20250825OutputSchema = lazySchema10(
|
|
1850
1821
|
() => zodSchema10(
|
|
1851
1822
|
z11.discriminatedUnion("type", [
|
|
1852
1823
|
z11.object({
|
|
@@ -1861,18 +1832,6 @@ var codeExecution_20260120OutputSchema = lazySchema10(
|
|
|
1861
1832
|
})
|
|
1862
1833
|
).optional().default([])
|
|
1863
1834
|
}),
|
|
1864
|
-
z11.object({
|
|
1865
|
-
type: z11.literal("encrypted_code_execution_result"),
|
|
1866
|
-
encrypted_stdout: z11.string(),
|
|
1867
|
-
stderr: z11.string(),
|
|
1868
|
-
return_code: z11.number(),
|
|
1869
|
-
content: z11.array(
|
|
1870
|
-
z11.object({
|
|
1871
|
-
type: z11.literal("code_execution_output"),
|
|
1872
|
-
file_id: z11.string()
|
|
1873
|
-
})
|
|
1874
|
-
).optional().default([])
|
|
1875
|
-
}),
|
|
1876
1835
|
z11.object({
|
|
1877
1836
|
type: z11.literal("bash_code_execution_result"),
|
|
1878
1837
|
content: z11.array(
|
|
@@ -1916,9 +1875,10 @@ var codeExecution_20260120OutputSchema = lazySchema10(
|
|
|
1916
1875
|
])
|
|
1917
1876
|
)
|
|
1918
1877
|
);
|
|
1919
|
-
var
|
|
1878
|
+
var codeExecution_20250825InputSchema = lazySchema10(
|
|
1920
1879
|
() => zodSchema10(
|
|
1921
1880
|
z11.discriminatedUnion("type", [
|
|
1881
|
+
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1922
1882
|
z11.object({
|
|
1923
1883
|
type: z11.literal("programmatic-tool-call"),
|
|
1924
1884
|
code: z11.string()
|
|
@@ -1950,6 +1910,130 @@ var codeExecution_20260120InputSchema = lazySchema10(
|
|
|
1950
1910
|
])
|
|
1951
1911
|
)
|
|
1952
1912
|
);
|
|
1913
|
+
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
1914
|
+
id: "anthropic.code_execution_20250825",
|
|
1915
|
+
inputSchema: codeExecution_20250825InputSchema,
|
|
1916
|
+
outputSchema: codeExecution_20250825OutputSchema,
|
|
1917
|
+
// Programmatic tool calling: tool results may be deferred to a later turn
|
|
1918
|
+
// when code execution triggers a client-executed tool that needs to be
|
|
1919
|
+
// resolved before the code execution result can be returned.
|
|
1920
|
+
supportsDeferredResults: true
|
|
1921
|
+
});
|
|
1922
|
+
var codeExecution_20250825 = (args = {}) => {
|
|
1923
|
+
return factory7(args);
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1926
|
+
// src/tool/code-execution_20260120.ts
|
|
1927
|
+
import {
|
|
1928
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
1929
|
+
lazySchema as lazySchema11,
|
|
1930
|
+
zodSchema as zodSchema11
|
|
1931
|
+
} from "@ai-sdk/provider-utils";
|
|
1932
|
+
import { z as z12 } from "zod/v4";
|
|
1933
|
+
var codeExecution_20260120OutputSchema = lazySchema11(
|
|
1934
|
+
() => zodSchema11(
|
|
1935
|
+
z12.discriminatedUnion("type", [
|
|
1936
|
+
z12.object({
|
|
1937
|
+
type: z12.literal("code_execution_result"),
|
|
1938
|
+
stdout: z12.string(),
|
|
1939
|
+
stderr: z12.string(),
|
|
1940
|
+
return_code: z12.number(),
|
|
1941
|
+
content: z12.array(
|
|
1942
|
+
z12.object({
|
|
1943
|
+
type: z12.literal("code_execution_output"),
|
|
1944
|
+
file_id: z12.string()
|
|
1945
|
+
})
|
|
1946
|
+
).optional().default([])
|
|
1947
|
+
}),
|
|
1948
|
+
z12.object({
|
|
1949
|
+
type: z12.literal("encrypted_code_execution_result"),
|
|
1950
|
+
encrypted_stdout: z12.string(),
|
|
1951
|
+
stderr: z12.string(),
|
|
1952
|
+
return_code: z12.number(),
|
|
1953
|
+
content: z12.array(
|
|
1954
|
+
z12.object({
|
|
1955
|
+
type: z12.literal("code_execution_output"),
|
|
1956
|
+
file_id: z12.string()
|
|
1957
|
+
})
|
|
1958
|
+
).optional().default([])
|
|
1959
|
+
}),
|
|
1960
|
+
z12.object({
|
|
1961
|
+
type: z12.literal("bash_code_execution_result"),
|
|
1962
|
+
content: z12.array(
|
|
1963
|
+
z12.object({
|
|
1964
|
+
type: z12.literal("bash_code_execution_output"),
|
|
1965
|
+
file_id: z12.string()
|
|
1966
|
+
})
|
|
1967
|
+
),
|
|
1968
|
+
stdout: z12.string(),
|
|
1969
|
+
stderr: z12.string(),
|
|
1970
|
+
return_code: z12.number()
|
|
1971
|
+
}),
|
|
1972
|
+
z12.object({
|
|
1973
|
+
type: z12.literal("bash_code_execution_tool_result_error"),
|
|
1974
|
+
error_code: z12.string()
|
|
1975
|
+
}),
|
|
1976
|
+
z12.object({
|
|
1977
|
+
type: z12.literal("text_editor_code_execution_tool_result_error"),
|
|
1978
|
+
error_code: z12.string()
|
|
1979
|
+
}),
|
|
1980
|
+
z12.object({
|
|
1981
|
+
type: z12.literal("text_editor_code_execution_view_result"),
|
|
1982
|
+
content: z12.string(),
|
|
1983
|
+
file_type: z12.string(),
|
|
1984
|
+
num_lines: z12.number().nullable(),
|
|
1985
|
+
start_line: z12.number().nullable(),
|
|
1986
|
+
total_lines: z12.number().nullable()
|
|
1987
|
+
}),
|
|
1988
|
+
z12.object({
|
|
1989
|
+
type: z12.literal("text_editor_code_execution_create_result"),
|
|
1990
|
+
is_file_update: z12.boolean()
|
|
1991
|
+
}),
|
|
1992
|
+
z12.object({
|
|
1993
|
+
type: z12.literal("text_editor_code_execution_str_replace_result"),
|
|
1994
|
+
lines: z12.array(z12.string()).nullable(),
|
|
1995
|
+
new_lines: z12.number().nullable(),
|
|
1996
|
+
new_start: z12.number().nullable(),
|
|
1997
|
+
old_lines: z12.number().nullable(),
|
|
1998
|
+
old_start: z12.number().nullable()
|
|
1999
|
+
})
|
|
2000
|
+
])
|
|
2001
|
+
)
|
|
2002
|
+
);
|
|
2003
|
+
var codeExecution_20260120InputSchema = lazySchema11(
|
|
2004
|
+
() => zodSchema11(
|
|
2005
|
+
z12.discriminatedUnion("type", [
|
|
2006
|
+
z12.object({
|
|
2007
|
+
type: z12.literal("programmatic-tool-call"),
|
|
2008
|
+
code: z12.string()
|
|
2009
|
+
}),
|
|
2010
|
+
z12.object({
|
|
2011
|
+
type: z12.literal("bash_code_execution"),
|
|
2012
|
+
command: z12.string()
|
|
2013
|
+
}),
|
|
2014
|
+
z12.discriminatedUnion("command", [
|
|
2015
|
+
z12.object({
|
|
2016
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2017
|
+
command: z12.literal("view"),
|
|
2018
|
+
path: z12.string()
|
|
2019
|
+
}),
|
|
2020
|
+
z12.object({
|
|
2021
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2022
|
+
command: z12.literal("create"),
|
|
2023
|
+
path: z12.string(),
|
|
2024
|
+
file_text: z12.string().nullish()
|
|
2025
|
+
}),
|
|
2026
|
+
z12.object({
|
|
2027
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2028
|
+
command: z12.literal("str_replace"),
|
|
2029
|
+
path: z12.string(),
|
|
2030
|
+
old_str: z12.string(),
|
|
2031
|
+
new_str: z12.string()
|
|
2032
|
+
})
|
|
2033
|
+
])
|
|
2034
|
+
])
|
|
2035
|
+
)
|
|
2036
|
+
);
|
|
1953
2037
|
var factory8 = createProviderToolFactoryWithOutputSchema7({
|
|
1954
2038
|
id: "anthropic.code_execution_20260120",
|
|
1955
2039
|
inputSchema: codeExecution_20260120InputSchema,
|
|
@@ -1963,23 +2047,23 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
1963
2047
|
// src/tool/tool-search-regex_20251119.ts
|
|
1964
2048
|
import {
|
|
1965
2049
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
1966
|
-
lazySchema as
|
|
1967
|
-
zodSchema as
|
|
2050
|
+
lazySchema as lazySchema12,
|
|
2051
|
+
zodSchema as zodSchema12
|
|
1968
2052
|
} from "@ai-sdk/provider-utils";
|
|
1969
|
-
import { z as
|
|
1970
|
-
var toolSearchRegex_20251119OutputSchema =
|
|
1971
|
-
() =>
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
type:
|
|
1975
|
-
toolName:
|
|
2053
|
+
import { z as z13 } from "zod/v4";
|
|
2054
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema12(
|
|
2055
|
+
() => zodSchema12(
|
|
2056
|
+
z13.array(
|
|
2057
|
+
z13.object({
|
|
2058
|
+
type: z13.literal("tool_reference"),
|
|
2059
|
+
toolName: z13.string()
|
|
1976
2060
|
})
|
|
1977
2061
|
)
|
|
1978
2062
|
)
|
|
1979
2063
|
);
|
|
1980
|
-
var toolSearchRegex_20251119InputSchema =
|
|
1981
|
-
() =>
|
|
1982
|
-
|
|
2064
|
+
var toolSearchRegex_20251119InputSchema = lazySchema12(
|
|
2065
|
+
() => zodSchema12(
|
|
2066
|
+
z13.object({
|
|
1983
2067
|
/**
|
|
1984
2068
|
* A regex pattern to search for tools.
|
|
1985
2069
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -1990,11 +2074,11 @@ var toolSearchRegex_20251119InputSchema = lazySchema11(
|
|
|
1990
2074
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1991
2075
|
* - "(?i)slack" - case-insensitive search
|
|
1992
2076
|
*/
|
|
1993
|
-
pattern:
|
|
2077
|
+
pattern: z13.string(),
|
|
1994
2078
|
/**
|
|
1995
2079
|
* Maximum number of tools to return. Optional.
|
|
1996
2080
|
*/
|
|
1997
|
-
limit:
|
|
2081
|
+
limit: z13.number().optional()
|
|
1998
2082
|
})
|
|
1999
2083
|
)
|
|
2000
2084
|
);
|
|
@@ -2011,7 +2095,7 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
2011
2095
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2012
2096
|
function convertToString(data) {
|
|
2013
2097
|
if (typeof data === "string") {
|
|
2014
|
-
return new TextDecoder().decode(
|
|
2098
|
+
return new TextDecoder().decode(convertBase64ToUint8Array2(data));
|
|
2015
2099
|
}
|
|
2016
2100
|
if (data instanceof Uint8Array) {
|
|
2017
2101
|
return new TextDecoder().decode(data);
|
|
@@ -2049,7 +2133,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2049
2133
|
const messages = [];
|
|
2050
2134
|
async function shouldEnableCitations(providerMetadata) {
|
|
2051
2135
|
var _a2, _b2;
|
|
2052
|
-
const anthropicOptions = await
|
|
2136
|
+
const anthropicOptions = await parseProviderOptions2({
|
|
2053
2137
|
provider: "anthropic",
|
|
2054
2138
|
providerOptions: providerMetadata,
|
|
2055
2139
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2057,7 +2141,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2057
2141
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
2058
2142
|
}
|
|
2059
2143
|
async function getDocumentMetadata(providerMetadata) {
|
|
2060
|
-
const anthropicOptions = await
|
|
2144
|
+
const anthropicOptions = await parseProviderOptions2({
|
|
2061
2145
|
provider: "anthropic",
|
|
2062
2146
|
providerOptions: providerMetadata,
|
|
2063
2147
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2114,7 +2198,26 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2114
2198
|
break;
|
|
2115
2199
|
}
|
|
2116
2200
|
case "file": {
|
|
2117
|
-
if (part.
|
|
2201
|
+
if (isProviderReference(part.data)) {
|
|
2202
|
+
const fileId = resolveProviderReference({
|
|
2203
|
+
reference: part.data,
|
|
2204
|
+
provider: "anthropic"
|
|
2205
|
+
});
|
|
2206
|
+
betas.add("files-api-2025-04-14");
|
|
2207
|
+
if (part.mediaType.startsWith("image/")) {
|
|
2208
|
+
anthropicContent.push({
|
|
2209
|
+
type: "image",
|
|
2210
|
+
source: { type: "file", file_id: fileId },
|
|
2211
|
+
cache_control: cacheControl
|
|
2212
|
+
});
|
|
2213
|
+
} else {
|
|
2214
|
+
anthropicContent.push({
|
|
2215
|
+
type: "document",
|
|
2216
|
+
source: { type: "file", file_id: fileId },
|
|
2217
|
+
cache_control: cacheControl
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
} else if (part.mediaType.startsWith("image/")) {
|
|
2118
2221
|
anthropicContent.push({
|
|
2119
2222
|
type: "image",
|
|
2120
2223
|
source: isUrlData(part.data) ? {
|
|
@@ -2357,7 +2460,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2357
2460
|
}
|
|
2358
2461
|
case "reasoning": {
|
|
2359
2462
|
if (sendReasoning) {
|
|
2360
|
-
const reasoningMetadata = await
|
|
2463
|
+
const reasoningMetadata = await parseProviderOptions2({
|
|
2361
2464
|
provider: "anthropic",
|
|
2362
2465
|
providerOptions: part.providerOptions,
|
|
2363
2466
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -2969,12 +3072,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2969
3072
|
}
|
|
2970
3073
|
}
|
|
2971
3074
|
const providerOptionsName = this.providerOptionsName;
|
|
2972
|
-
const canonicalOptions = await
|
|
3075
|
+
const canonicalOptions = await parseProviderOptions3({
|
|
2973
3076
|
provider: "anthropic",
|
|
2974
3077
|
providerOptions,
|
|
2975
3078
|
schema: anthropicLanguageModelOptions
|
|
2976
3079
|
});
|
|
2977
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await
|
|
3080
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await parseProviderOptions3({
|
|
2978
3081
|
provider: providerOptionsName,
|
|
2979
3082
|
providerOptions,
|
|
2980
3083
|
schema: anthropicLanguageModelOptions
|
|
@@ -3311,7 +3414,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3311
3414
|
betas,
|
|
3312
3415
|
headers
|
|
3313
3416
|
}) {
|
|
3314
|
-
return
|
|
3417
|
+
return combineHeaders2(
|
|
3315
3418
|
await resolve(this.config.headers),
|
|
3316
3419
|
headers,
|
|
3317
3420
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
@@ -3390,7 +3493,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3390
3493
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3391
3494
|
body: this.transformRequestBody(args, betas),
|
|
3392
3495
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3393
|
-
successfulResponseHandler:
|
|
3496
|
+
successfulResponseHandler: createJsonResponseHandler2(
|
|
3394
3497
|
anthropicMessagesResponseSchema
|
|
3395
3498
|
),
|
|
3396
3499
|
abortSignal: options.abortSignal,
|
|
@@ -4693,15 +4796,15 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4693
4796
|
// src/tool/bash_20241022.ts
|
|
4694
4797
|
import {
|
|
4695
4798
|
createProviderToolFactory as createProviderToolFactory2,
|
|
4696
|
-
lazySchema as
|
|
4697
|
-
zodSchema as
|
|
4799
|
+
lazySchema as lazySchema13,
|
|
4800
|
+
zodSchema as zodSchema13
|
|
4698
4801
|
} from "@ai-sdk/provider-utils";
|
|
4699
|
-
import { z as
|
|
4700
|
-
var bash_20241022InputSchema =
|
|
4701
|
-
() =>
|
|
4702
|
-
|
|
4703
|
-
command:
|
|
4704
|
-
restart:
|
|
4802
|
+
import { z as z14 } from "zod/v4";
|
|
4803
|
+
var bash_20241022InputSchema = lazySchema13(
|
|
4804
|
+
() => zodSchema13(
|
|
4805
|
+
z14.object({
|
|
4806
|
+
command: z14.string(),
|
|
4807
|
+
restart: z14.boolean().optional()
|
|
4705
4808
|
})
|
|
4706
4809
|
)
|
|
4707
4810
|
);
|
|
@@ -4713,15 +4816,15 @@ var bash_20241022 = createProviderToolFactory2({
|
|
|
4713
4816
|
// src/tool/bash_20250124.ts
|
|
4714
4817
|
import {
|
|
4715
4818
|
createProviderToolFactory as createProviderToolFactory3,
|
|
4716
|
-
lazySchema as
|
|
4717
|
-
zodSchema as
|
|
4819
|
+
lazySchema as lazySchema14,
|
|
4820
|
+
zodSchema as zodSchema14
|
|
4718
4821
|
} from "@ai-sdk/provider-utils";
|
|
4719
|
-
import { z as
|
|
4720
|
-
var bash_20250124InputSchema =
|
|
4721
|
-
() =>
|
|
4722
|
-
|
|
4723
|
-
command:
|
|
4724
|
-
restart:
|
|
4822
|
+
import { z as z15 } from "zod/v4";
|
|
4823
|
+
var bash_20250124InputSchema = lazySchema14(
|
|
4824
|
+
() => zodSchema14(
|
|
4825
|
+
z15.object({
|
|
4826
|
+
command: z15.string(),
|
|
4827
|
+
restart: z15.boolean().optional()
|
|
4725
4828
|
})
|
|
4726
4829
|
)
|
|
4727
4830
|
);
|
|
@@ -4733,14 +4836,14 @@ var bash_20250124 = createProviderToolFactory3({
|
|
|
4733
4836
|
// src/tool/computer_20241022.ts
|
|
4734
4837
|
import {
|
|
4735
4838
|
createProviderToolFactory as createProviderToolFactory4,
|
|
4736
|
-
lazySchema as
|
|
4737
|
-
zodSchema as
|
|
4839
|
+
lazySchema as lazySchema15,
|
|
4840
|
+
zodSchema as zodSchema15
|
|
4738
4841
|
} from "@ai-sdk/provider-utils";
|
|
4739
|
-
import { z as
|
|
4740
|
-
var computer_20241022InputSchema =
|
|
4741
|
-
() =>
|
|
4742
|
-
|
|
4743
|
-
action:
|
|
4842
|
+
import { z as z16 } from "zod/v4";
|
|
4843
|
+
var computer_20241022InputSchema = lazySchema15(
|
|
4844
|
+
() => zodSchema15(
|
|
4845
|
+
z16.object({
|
|
4846
|
+
action: z16.enum([
|
|
4744
4847
|
"key",
|
|
4745
4848
|
"type",
|
|
4746
4849
|
"mouse_move",
|
|
@@ -4752,8 +4855,8 @@ var computer_20241022InputSchema = lazySchema14(
|
|
|
4752
4855
|
"screenshot",
|
|
4753
4856
|
"cursor_position"
|
|
4754
4857
|
]),
|
|
4755
|
-
coordinate:
|
|
4756
|
-
text:
|
|
4858
|
+
coordinate: z16.array(z16.number().int()).optional(),
|
|
4859
|
+
text: z16.string().optional()
|
|
4757
4860
|
})
|
|
4758
4861
|
)
|
|
4759
4862
|
);
|
|
@@ -4765,14 +4868,14 @@ var computer_20241022 = createProviderToolFactory4({
|
|
|
4765
4868
|
// src/tool/computer_20250124.ts
|
|
4766
4869
|
import {
|
|
4767
4870
|
createProviderToolFactory as createProviderToolFactory5,
|
|
4768
|
-
lazySchema as
|
|
4769
|
-
zodSchema as
|
|
4871
|
+
lazySchema as lazySchema16,
|
|
4872
|
+
zodSchema as zodSchema16
|
|
4770
4873
|
} from "@ai-sdk/provider-utils";
|
|
4771
|
-
import { z as
|
|
4772
|
-
var computer_20250124InputSchema =
|
|
4773
|
-
() =>
|
|
4774
|
-
|
|
4775
|
-
action:
|
|
4874
|
+
import { z as z17 } from "zod/v4";
|
|
4875
|
+
var computer_20250124InputSchema = lazySchema16(
|
|
4876
|
+
() => zodSchema16(
|
|
4877
|
+
z17.object({
|
|
4878
|
+
action: z17.enum([
|
|
4776
4879
|
"key",
|
|
4777
4880
|
"hold_key",
|
|
4778
4881
|
"type",
|
|
@@ -4790,12 +4893,12 @@ var computer_20250124InputSchema = lazySchema15(
|
|
|
4790
4893
|
"wait",
|
|
4791
4894
|
"screenshot"
|
|
4792
4895
|
]),
|
|
4793
|
-
coordinate:
|
|
4794
|
-
duration:
|
|
4795
|
-
scroll_amount:
|
|
4796
|
-
scroll_direction:
|
|
4797
|
-
start_coordinate:
|
|
4798
|
-
text:
|
|
4896
|
+
coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4897
|
+
duration: z17.number().optional(),
|
|
4898
|
+
scroll_amount: z17.number().optional(),
|
|
4899
|
+
scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
|
|
4900
|
+
start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4901
|
+
text: z17.string().optional()
|
|
4799
4902
|
})
|
|
4800
4903
|
)
|
|
4801
4904
|
);
|
|
@@ -4807,14 +4910,14 @@ var computer_20250124 = createProviderToolFactory5({
|
|
|
4807
4910
|
// src/tool/computer_20251124.ts
|
|
4808
4911
|
import {
|
|
4809
4912
|
createProviderToolFactory as createProviderToolFactory6,
|
|
4810
|
-
lazySchema as
|
|
4811
|
-
zodSchema as
|
|
4913
|
+
lazySchema as lazySchema17,
|
|
4914
|
+
zodSchema as zodSchema17
|
|
4812
4915
|
} from "@ai-sdk/provider-utils";
|
|
4813
|
-
import { z as
|
|
4814
|
-
var computer_20251124InputSchema =
|
|
4815
|
-
() =>
|
|
4816
|
-
|
|
4817
|
-
action:
|
|
4916
|
+
import { z as z18 } from "zod/v4";
|
|
4917
|
+
var computer_20251124InputSchema = lazySchema17(
|
|
4918
|
+
() => zodSchema17(
|
|
4919
|
+
z18.object({
|
|
4920
|
+
action: z18.enum([
|
|
4818
4921
|
"key",
|
|
4819
4922
|
"hold_key",
|
|
4820
4923
|
"type",
|
|
@@ -4833,18 +4936,18 @@ var computer_20251124InputSchema = lazySchema16(
|
|
|
4833
4936
|
"screenshot",
|
|
4834
4937
|
"zoom"
|
|
4835
4938
|
]),
|
|
4836
|
-
coordinate:
|
|
4837
|
-
duration:
|
|
4838
|
-
region:
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4939
|
+
coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
|
|
4940
|
+
duration: z18.number().optional(),
|
|
4941
|
+
region: z18.tuple([
|
|
4942
|
+
z18.number().int(),
|
|
4943
|
+
z18.number().int(),
|
|
4944
|
+
z18.number().int(),
|
|
4945
|
+
z18.number().int()
|
|
4843
4946
|
]).optional(),
|
|
4844
|
-
scroll_amount:
|
|
4845
|
-
scroll_direction:
|
|
4846
|
-
start_coordinate:
|
|
4847
|
-
text:
|
|
4947
|
+
scroll_amount: z18.number().optional(),
|
|
4948
|
+
scroll_direction: z18.enum(["up", "down", "left", "right"]).optional(),
|
|
4949
|
+
start_coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
|
|
4950
|
+
text: z18.string().optional()
|
|
4848
4951
|
})
|
|
4849
4952
|
)
|
|
4850
4953
|
);
|
|
@@ -4856,43 +4959,43 @@ var computer_20251124 = createProviderToolFactory6({
|
|
|
4856
4959
|
// src/tool/memory_20250818.ts
|
|
4857
4960
|
import {
|
|
4858
4961
|
createProviderToolFactory as createProviderToolFactory7,
|
|
4859
|
-
lazySchema as
|
|
4860
|
-
zodSchema as
|
|
4962
|
+
lazySchema as lazySchema18,
|
|
4963
|
+
zodSchema as zodSchema18
|
|
4861
4964
|
} from "@ai-sdk/provider-utils";
|
|
4862
|
-
import { z as
|
|
4863
|
-
var memory_20250818InputSchema =
|
|
4864
|
-
() =>
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
command:
|
|
4868
|
-
path:
|
|
4869
|
-
view_range:
|
|
4965
|
+
import { z as z19 } from "zod/v4";
|
|
4966
|
+
var memory_20250818InputSchema = lazySchema18(
|
|
4967
|
+
() => zodSchema18(
|
|
4968
|
+
z19.discriminatedUnion("command", [
|
|
4969
|
+
z19.object({
|
|
4970
|
+
command: z19.literal("view"),
|
|
4971
|
+
path: z19.string(),
|
|
4972
|
+
view_range: z19.tuple([z19.number(), z19.number()]).optional()
|
|
4870
4973
|
}),
|
|
4871
|
-
|
|
4872
|
-
command:
|
|
4873
|
-
path:
|
|
4874
|
-
file_text:
|
|
4974
|
+
z19.object({
|
|
4975
|
+
command: z19.literal("create"),
|
|
4976
|
+
path: z19.string(),
|
|
4977
|
+
file_text: z19.string()
|
|
4875
4978
|
}),
|
|
4876
|
-
|
|
4877
|
-
command:
|
|
4878
|
-
path:
|
|
4879
|
-
old_str:
|
|
4880
|
-
new_str:
|
|
4979
|
+
z19.object({
|
|
4980
|
+
command: z19.literal("str_replace"),
|
|
4981
|
+
path: z19.string(),
|
|
4982
|
+
old_str: z19.string(),
|
|
4983
|
+
new_str: z19.string()
|
|
4881
4984
|
}),
|
|
4882
|
-
|
|
4883
|
-
command:
|
|
4884
|
-
path:
|
|
4885
|
-
insert_line:
|
|
4886
|
-
insert_text:
|
|
4985
|
+
z19.object({
|
|
4986
|
+
command: z19.literal("insert"),
|
|
4987
|
+
path: z19.string(),
|
|
4988
|
+
insert_line: z19.number(),
|
|
4989
|
+
insert_text: z19.string()
|
|
4887
4990
|
}),
|
|
4888
|
-
|
|
4889
|
-
command:
|
|
4890
|
-
path:
|
|
4991
|
+
z19.object({
|
|
4992
|
+
command: z19.literal("delete"),
|
|
4993
|
+
path: z19.string()
|
|
4891
4994
|
}),
|
|
4892
|
-
|
|
4893
|
-
command:
|
|
4894
|
-
old_path:
|
|
4895
|
-
new_path:
|
|
4995
|
+
z19.object({
|
|
4996
|
+
command: z19.literal("rename"),
|
|
4997
|
+
old_path: z19.string(),
|
|
4998
|
+
new_path: z19.string()
|
|
4896
4999
|
})
|
|
4897
5000
|
])
|
|
4898
5001
|
)
|
|
@@ -4905,37 +5008,11 @@ var memory_20250818 = createProviderToolFactory7({
|
|
|
4905
5008
|
// src/tool/text-editor_20241022.ts
|
|
4906
5009
|
import {
|
|
4907
5010
|
createProviderToolFactory as createProviderToolFactory8,
|
|
4908
|
-
lazySchema as lazySchema18,
|
|
4909
|
-
zodSchema as zodSchema18
|
|
4910
|
-
} from "@ai-sdk/provider-utils";
|
|
4911
|
-
import { z as z19 } from "zod/v4";
|
|
4912
|
-
var textEditor_20241022InputSchema = lazySchema18(
|
|
4913
|
-
() => zodSchema18(
|
|
4914
|
-
z19.object({
|
|
4915
|
-
command: z19.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4916
|
-
path: z19.string(),
|
|
4917
|
-
file_text: z19.string().optional(),
|
|
4918
|
-
insert_line: z19.number().int().optional(),
|
|
4919
|
-
new_str: z19.string().optional(),
|
|
4920
|
-
insert_text: z19.string().optional(),
|
|
4921
|
-
old_str: z19.string().optional(),
|
|
4922
|
-
view_range: z19.array(z19.number().int()).optional()
|
|
4923
|
-
})
|
|
4924
|
-
)
|
|
4925
|
-
);
|
|
4926
|
-
var textEditor_20241022 = createProviderToolFactory8({
|
|
4927
|
-
id: "anthropic.text_editor_20241022",
|
|
4928
|
-
inputSchema: textEditor_20241022InputSchema
|
|
4929
|
-
});
|
|
4930
|
-
|
|
4931
|
-
// src/tool/text-editor_20250124.ts
|
|
4932
|
-
import {
|
|
4933
|
-
createProviderToolFactory as createProviderToolFactory9,
|
|
4934
5011
|
lazySchema as lazySchema19,
|
|
4935
5012
|
zodSchema as zodSchema19
|
|
4936
5013
|
} from "@ai-sdk/provider-utils";
|
|
4937
5014
|
import { z as z20 } from "zod/v4";
|
|
4938
|
-
var
|
|
5015
|
+
var textEditor_20241022InputSchema = lazySchema19(
|
|
4939
5016
|
() => zodSchema19(
|
|
4940
5017
|
z20.object({
|
|
4941
5018
|
command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -4949,22 +5026,22 @@ var textEditor_20250124InputSchema = lazySchema19(
|
|
|
4949
5026
|
})
|
|
4950
5027
|
)
|
|
4951
5028
|
);
|
|
4952
|
-
var
|
|
4953
|
-
id: "anthropic.
|
|
4954
|
-
inputSchema:
|
|
5029
|
+
var textEditor_20241022 = createProviderToolFactory8({
|
|
5030
|
+
id: "anthropic.text_editor_20241022",
|
|
5031
|
+
inputSchema: textEditor_20241022InputSchema
|
|
4955
5032
|
});
|
|
4956
5033
|
|
|
4957
|
-
// src/tool/text-
|
|
5034
|
+
// src/tool/text-editor_20250124.ts
|
|
4958
5035
|
import {
|
|
4959
|
-
createProviderToolFactory as
|
|
5036
|
+
createProviderToolFactory as createProviderToolFactory9,
|
|
4960
5037
|
lazySchema as lazySchema20,
|
|
4961
5038
|
zodSchema as zodSchema20
|
|
4962
5039
|
} from "@ai-sdk/provider-utils";
|
|
4963
5040
|
import { z as z21 } from "zod/v4";
|
|
4964
|
-
var
|
|
5041
|
+
var textEditor_20250124InputSchema = lazySchema20(
|
|
4965
5042
|
() => zodSchema20(
|
|
4966
5043
|
z21.object({
|
|
4967
|
-
command: z21.enum(["view", "create", "str_replace", "insert"]),
|
|
5044
|
+
command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4968
5045
|
path: z21.string(),
|
|
4969
5046
|
file_text: z21.string().optional(),
|
|
4970
5047
|
insert_line: z21.number().int().optional(),
|
|
@@ -4975,6 +5052,32 @@ var textEditor_20250429InputSchema = lazySchema20(
|
|
|
4975
5052
|
})
|
|
4976
5053
|
)
|
|
4977
5054
|
);
|
|
5055
|
+
var textEditor_20250124 = createProviderToolFactory9({
|
|
5056
|
+
id: "anthropic.text_editor_20250124",
|
|
5057
|
+
inputSchema: textEditor_20250124InputSchema
|
|
5058
|
+
});
|
|
5059
|
+
|
|
5060
|
+
// src/tool/text-editor_20250429.ts
|
|
5061
|
+
import {
|
|
5062
|
+
createProviderToolFactory as createProviderToolFactory10,
|
|
5063
|
+
lazySchema as lazySchema21,
|
|
5064
|
+
zodSchema as zodSchema21
|
|
5065
|
+
} from "@ai-sdk/provider-utils";
|
|
5066
|
+
import { z as z22 } from "zod/v4";
|
|
5067
|
+
var textEditor_20250429InputSchema = lazySchema21(
|
|
5068
|
+
() => zodSchema21(
|
|
5069
|
+
z22.object({
|
|
5070
|
+
command: z22.enum(["view", "create", "str_replace", "insert"]),
|
|
5071
|
+
path: z22.string(),
|
|
5072
|
+
file_text: z22.string().optional(),
|
|
5073
|
+
insert_line: z22.number().int().optional(),
|
|
5074
|
+
new_str: z22.string().optional(),
|
|
5075
|
+
insert_text: z22.string().optional(),
|
|
5076
|
+
old_str: z22.string().optional(),
|
|
5077
|
+
view_range: z22.array(z22.number().int()).optional()
|
|
5078
|
+
})
|
|
5079
|
+
)
|
|
5080
|
+
);
|
|
4978
5081
|
var textEditor_20250429 = createProviderToolFactory10({
|
|
4979
5082
|
id: "anthropic.text_editor_20250429",
|
|
4980
5083
|
inputSchema: textEditor_20250429InputSchema
|
|
@@ -4983,32 +5086,32 @@ var textEditor_20250429 = createProviderToolFactory10({
|
|
|
4983
5086
|
// src/tool/tool-search-bm25_20251119.ts
|
|
4984
5087
|
import {
|
|
4985
5088
|
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
4986
|
-
lazySchema as
|
|
4987
|
-
zodSchema as
|
|
5089
|
+
lazySchema as lazySchema22,
|
|
5090
|
+
zodSchema as zodSchema22
|
|
4988
5091
|
} from "@ai-sdk/provider-utils";
|
|
4989
|
-
import { z as
|
|
4990
|
-
var toolSearchBm25_20251119OutputSchema =
|
|
4991
|
-
() =>
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
type:
|
|
4995
|
-
toolName:
|
|
5092
|
+
import { z as z23 } from "zod/v4";
|
|
5093
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema22(
|
|
5094
|
+
() => zodSchema22(
|
|
5095
|
+
z23.array(
|
|
5096
|
+
z23.object({
|
|
5097
|
+
type: z23.literal("tool_reference"),
|
|
5098
|
+
toolName: z23.string()
|
|
4996
5099
|
})
|
|
4997
5100
|
)
|
|
4998
5101
|
)
|
|
4999
5102
|
);
|
|
5000
|
-
var toolSearchBm25_20251119InputSchema =
|
|
5001
|
-
() =>
|
|
5002
|
-
|
|
5103
|
+
var toolSearchBm25_20251119InputSchema = lazySchema22(
|
|
5104
|
+
() => zodSchema22(
|
|
5105
|
+
z23.object({
|
|
5003
5106
|
/**
|
|
5004
5107
|
* A natural language query to search for tools.
|
|
5005
5108
|
* Claude will use BM25 text search to find relevant tools.
|
|
5006
5109
|
*/
|
|
5007
|
-
query:
|
|
5110
|
+
query: z23.string(),
|
|
5008
5111
|
/**
|
|
5009
5112
|
* Maximum number of tools to return. Optional.
|
|
5010
5113
|
*/
|
|
5011
|
-
limit:
|
|
5114
|
+
limit: z23.number().optional()
|
|
5012
5115
|
})
|
|
5013
5116
|
)
|
|
5014
5117
|
);
|
|
@@ -5224,6 +5327,9 @@ var anthropicTools = {
|
|
|
5224
5327
|
toolSearchBm25_20251119
|
|
5225
5328
|
};
|
|
5226
5329
|
|
|
5330
|
+
// src/version.ts
|
|
5331
|
+
var VERSION = true ? "4.0.0-beta.17" : "0.0.0-test";
|
|
5332
|
+
|
|
5227
5333
|
// src/anthropic-provider.ts
|
|
5228
5334
|
function createAnthropic(options = {}) {
|
|
5229
5335
|
var _a, _b;
|
|
@@ -5290,6 +5396,12 @@ function createAnthropic(options = {}) {
|
|
|
5290
5396
|
provider.imageModel = (modelId) => {
|
|
5291
5397
|
throw new NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
5292
5398
|
};
|
|
5399
|
+
provider.files = () => new AnthropicFiles({
|
|
5400
|
+
provider: providerName,
|
|
5401
|
+
baseURL,
|
|
5402
|
+
headers: getHeaders,
|
|
5403
|
+
fetch: options.fetch
|
|
5404
|
+
});
|
|
5293
5405
|
provider.tools = anthropicTools;
|
|
5294
5406
|
return provider;
|
|
5295
5407
|
}
|