@ai-sdk/anthropic 4.0.0-beta.26 → 4.0.0-beta.28
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 +30 -0
- package/dist/index.js +1368 -1259
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +11 -3
- package/dist/internal/index.js +1285 -1199
- package/dist/internal/index.js.map +1 -1
- package/package.json +9 -10
- package/src/anthropic-messages-language-model.ts +25 -4
- package/src/convert-to-anthropic-messages-prompt.ts +19 -19
- package/dist/index.d.mts +0 -1106
- package/dist/index.mjs +0 -5586
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -981
- package/dist/internal/index.mjs +0 -5260
- package/dist/internal/index.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,70 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
VERSION: () => VERSION,
|
|
24
|
-
anthropic: () => anthropic,
|
|
25
|
-
createAnthropic: () => createAnthropic,
|
|
26
|
-
forwardAnthropicContainerIdFromLastStep: () => forwardAnthropicContainerIdFromLastStep
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
|
|
30
1
|
// src/anthropic-provider.ts
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
import {
|
|
3
|
+
InvalidArgumentError,
|
|
4
|
+
NoSuchModelError
|
|
5
|
+
} from "@ai-sdk/provider";
|
|
6
|
+
import {
|
|
7
|
+
generateId as generateId2,
|
|
8
|
+
loadApiKey,
|
|
9
|
+
loadOptionalSetting,
|
|
10
|
+
withoutTrailingSlash,
|
|
11
|
+
withUserAgentSuffix
|
|
12
|
+
} from "@ai-sdk/provider-utils";
|
|
33
13
|
|
|
34
14
|
// src/anthropic-files.ts
|
|
35
|
-
|
|
36
|
-
|
|
15
|
+
import {
|
|
16
|
+
combineHeaders,
|
|
17
|
+
convertBase64ToUint8Array,
|
|
18
|
+
createJsonResponseHandler,
|
|
19
|
+
lazySchema as lazySchema2,
|
|
20
|
+
postFormDataToApi,
|
|
21
|
+
zodSchema as zodSchema2
|
|
22
|
+
} from "@ai-sdk/provider-utils";
|
|
23
|
+
import { z as z2 } from "zod/v4";
|
|
37
24
|
|
|
38
25
|
// src/anthropic-error.ts
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
26
|
+
import {
|
|
27
|
+
createJsonErrorResponseHandler,
|
|
28
|
+
lazySchema,
|
|
29
|
+
zodSchema
|
|
30
|
+
} from "@ai-sdk/provider-utils";
|
|
31
|
+
import { z } from "zod/v4";
|
|
32
|
+
var anthropicErrorDataSchema = lazySchema(
|
|
33
|
+
() => zodSchema(
|
|
34
|
+
z.object({
|
|
35
|
+
type: z.literal("error"),
|
|
36
|
+
error: z.object({
|
|
37
|
+
type: z.string(),
|
|
38
|
+
message: z.string()
|
|
48
39
|
})
|
|
49
40
|
})
|
|
50
41
|
)
|
|
51
42
|
);
|
|
52
|
-
var anthropicFailedResponseHandler =
|
|
43
|
+
var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
|
|
53
44
|
errorSchema: anthropicErrorDataSchema,
|
|
54
45
|
errorToMessage: (data) => data.error.message
|
|
55
46
|
});
|
|
56
47
|
|
|
57
48
|
// src/anthropic-files.ts
|
|
58
|
-
var anthropicUploadFileResponseSchema = (
|
|
59
|
-
() => (
|
|
60
|
-
|
|
61
|
-
id:
|
|
62
|
-
type:
|
|
63
|
-
filename:
|
|
64
|
-
mime_type:
|
|
65
|
-
size_bytes:
|
|
66
|
-
created_at:
|
|
67
|
-
downloadable:
|
|
49
|
+
var anthropicUploadFileResponseSchema = lazySchema2(
|
|
50
|
+
() => zodSchema2(
|
|
51
|
+
z2.object({
|
|
52
|
+
id: z2.string(),
|
|
53
|
+
type: z2.literal("file"),
|
|
54
|
+
filename: z2.string(),
|
|
55
|
+
mime_type: z2.string(),
|
|
56
|
+
size_bytes: z2.number(),
|
|
57
|
+
created_at: z2.string(),
|
|
58
|
+
downloadable: z2.boolean().nullish()
|
|
68
59
|
})
|
|
69
60
|
)
|
|
70
61
|
);
|
|
@@ -82,7 +73,7 @@ var AnthropicFiles = class {
|
|
|
82
73
|
filename
|
|
83
74
|
}) {
|
|
84
75
|
var _a, _b;
|
|
85
|
-
const fileBytes = data instanceof Uint8Array ? data :
|
|
76
|
+
const fileBytes = data instanceof Uint8Array ? data : convertBase64ToUint8Array(data);
|
|
86
77
|
const blob = new Blob([fileBytes], { type: mediaType });
|
|
87
78
|
const formData = new FormData();
|
|
88
79
|
if (filename != null) {
|
|
@@ -90,14 +81,14 @@ var AnthropicFiles = class {
|
|
|
90
81
|
} else {
|
|
91
82
|
formData.append("file", blob);
|
|
92
83
|
}
|
|
93
|
-
const { value: response } = await
|
|
84
|
+
const { value: response } = await postFormDataToApi({
|
|
94
85
|
url: `${this.config.baseURL}/files`,
|
|
95
|
-
headers:
|
|
86
|
+
headers: combineHeaders(this.config.headers(), {
|
|
96
87
|
"anthropic-beta": "files-api-2025-04-14"
|
|
97
88
|
}),
|
|
98
89
|
formData,
|
|
99
90
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
100
|
-
successfulResponseHandler:
|
|
91
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
101
92
|
anthropicUploadFileResponseSchema
|
|
102
93
|
),
|
|
103
94
|
fetch: this.config.fetch
|
|
@@ -121,322 +112,340 @@ var AnthropicFiles = class {
|
|
|
121
112
|
};
|
|
122
113
|
|
|
123
114
|
// src/anthropic-messages-language-model.ts
|
|
124
|
-
|
|
125
|
-
|
|
115
|
+
import {
|
|
116
|
+
APICallError
|
|
117
|
+
} from "@ai-sdk/provider";
|
|
118
|
+
import {
|
|
119
|
+
combineHeaders as combineHeaders2,
|
|
120
|
+
createEventSourceResponseHandler,
|
|
121
|
+
createJsonResponseHandler as createJsonResponseHandler2,
|
|
122
|
+
createToolNameMapping,
|
|
123
|
+
generateId,
|
|
124
|
+
isCustomReasoning,
|
|
125
|
+
mapReasoningToProviderBudget,
|
|
126
|
+
mapReasoningToProviderEffort,
|
|
127
|
+
parseProviderOptions as parseProviderOptions2,
|
|
128
|
+
postJsonToApi,
|
|
129
|
+
resolve,
|
|
130
|
+
resolveProviderReference as resolveProviderReference2,
|
|
131
|
+
serializeModelOptions,
|
|
132
|
+
WORKFLOW_SERIALIZE,
|
|
133
|
+
WORKFLOW_DESERIALIZE
|
|
134
|
+
} from "@ai-sdk/provider-utils";
|
|
126
135
|
|
|
127
136
|
// src/anthropic-messages-api.ts
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
var anthropicMessagesResponseSchema = (
|
|
131
|
-
() => (
|
|
132
|
-
|
|
133
|
-
type:
|
|
134
|
-
id:
|
|
135
|
-
model:
|
|
136
|
-
content:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
type:
|
|
140
|
-
text:
|
|
141
|
-
citations:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
type:
|
|
145
|
-
cited_text:
|
|
146
|
-
url:
|
|
147
|
-
title:
|
|
148
|
-
encrypted_index:
|
|
137
|
+
import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
|
|
138
|
+
import { z as z3 } from "zod/v4";
|
|
139
|
+
var anthropicMessagesResponseSchema = lazySchema3(
|
|
140
|
+
() => zodSchema3(
|
|
141
|
+
z3.object({
|
|
142
|
+
type: z3.literal("message"),
|
|
143
|
+
id: z3.string().nullish(),
|
|
144
|
+
model: z3.string().nullish(),
|
|
145
|
+
content: z3.array(
|
|
146
|
+
z3.discriminatedUnion("type", [
|
|
147
|
+
z3.object({
|
|
148
|
+
type: z3.literal("text"),
|
|
149
|
+
text: z3.string(),
|
|
150
|
+
citations: z3.array(
|
|
151
|
+
z3.discriminatedUnion("type", [
|
|
152
|
+
z3.object({
|
|
153
|
+
type: z3.literal("web_search_result_location"),
|
|
154
|
+
cited_text: z3.string(),
|
|
155
|
+
url: z3.string(),
|
|
156
|
+
title: z3.string(),
|
|
157
|
+
encrypted_index: z3.string()
|
|
149
158
|
}),
|
|
150
|
-
|
|
151
|
-
type:
|
|
152
|
-
cited_text:
|
|
153
|
-
document_index:
|
|
154
|
-
document_title:
|
|
155
|
-
start_page_number:
|
|
156
|
-
end_page_number:
|
|
159
|
+
z3.object({
|
|
160
|
+
type: z3.literal("page_location"),
|
|
161
|
+
cited_text: z3.string(),
|
|
162
|
+
document_index: z3.number(),
|
|
163
|
+
document_title: z3.string().nullable(),
|
|
164
|
+
start_page_number: z3.number(),
|
|
165
|
+
end_page_number: z3.number()
|
|
157
166
|
}),
|
|
158
|
-
|
|
159
|
-
type:
|
|
160
|
-
cited_text:
|
|
161
|
-
document_index:
|
|
162
|
-
document_title:
|
|
163
|
-
start_char_index:
|
|
164
|
-
end_char_index:
|
|
167
|
+
z3.object({
|
|
168
|
+
type: z3.literal("char_location"),
|
|
169
|
+
cited_text: z3.string(),
|
|
170
|
+
document_index: z3.number(),
|
|
171
|
+
document_title: z3.string().nullable(),
|
|
172
|
+
start_char_index: z3.number(),
|
|
173
|
+
end_char_index: z3.number()
|
|
165
174
|
})
|
|
166
175
|
])
|
|
167
176
|
).optional()
|
|
168
177
|
}),
|
|
169
|
-
|
|
170
|
-
type:
|
|
171
|
-
thinking:
|
|
172
|
-
signature:
|
|
178
|
+
z3.object({
|
|
179
|
+
type: z3.literal("thinking"),
|
|
180
|
+
thinking: z3.string(),
|
|
181
|
+
signature: z3.string()
|
|
173
182
|
}),
|
|
174
|
-
|
|
175
|
-
type:
|
|
176
|
-
data:
|
|
183
|
+
z3.object({
|
|
184
|
+
type: z3.literal("redacted_thinking"),
|
|
185
|
+
data: z3.string()
|
|
177
186
|
}),
|
|
178
|
-
|
|
179
|
-
type:
|
|
180
|
-
content:
|
|
187
|
+
z3.object({
|
|
188
|
+
type: z3.literal("compaction"),
|
|
189
|
+
content: z3.string()
|
|
181
190
|
}),
|
|
182
|
-
|
|
183
|
-
type:
|
|
184
|
-
id:
|
|
185
|
-
name:
|
|
186
|
-
input:
|
|
191
|
+
z3.object({
|
|
192
|
+
type: z3.literal("tool_use"),
|
|
193
|
+
id: z3.string(),
|
|
194
|
+
name: z3.string(),
|
|
195
|
+
input: z3.unknown(),
|
|
187
196
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
188
|
-
caller:
|
|
189
|
-
|
|
190
|
-
type:
|
|
191
|
-
tool_id:
|
|
197
|
+
caller: z3.union([
|
|
198
|
+
z3.object({
|
|
199
|
+
type: z3.literal("code_execution_20250825"),
|
|
200
|
+
tool_id: z3.string()
|
|
192
201
|
}),
|
|
193
|
-
|
|
194
|
-
type:
|
|
195
|
-
tool_id:
|
|
202
|
+
z3.object({
|
|
203
|
+
type: z3.literal("code_execution_20260120"),
|
|
204
|
+
tool_id: z3.string()
|
|
196
205
|
}),
|
|
197
|
-
|
|
198
|
-
type:
|
|
206
|
+
z3.object({
|
|
207
|
+
type: z3.literal("direct")
|
|
199
208
|
})
|
|
200
209
|
]).optional()
|
|
201
210
|
}),
|
|
202
|
-
|
|
203
|
-
type:
|
|
204
|
-
id:
|
|
205
|
-
name:
|
|
206
|
-
input:
|
|
207
|
-
caller:
|
|
208
|
-
|
|
209
|
-
type:
|
|
210
|
-
tool_id:
|
|
211
|
+
z3.object({
|
|
212
|
+
type: z3.literal("server_tool_use"),
|
|
213
|
+
id: z3.string(),
|
|
214
|
+
name: z3.string(),
|
|
215
|
+
input: z3.record(z3.string(), z3.unknown()).nullish(),
|
|
216
|
+
caller: z3.union([
|
|
217
|
+
z3.object({
|
|
218
|
+
type: z3.literal("code_execution_20260120"),
|
|
219
|
+
tool_id: z3.string()
|
|
211
220
|
}),
|
|
212
|
-
|
|
213
|
-
type:
|
|
221
|
+
z3.object({
|
|
222
|
+
type: z3.literal("direct")
|
|
214
223
|
})
|
|
215
224
|
]).optional()
|
|
216
225
|
}),
|
|
217
|
-
|
|
218
|
-
type:
|
|
219
|
-
id:
|
|
220
|
-
name:
|
|
221
|
-
input:
|
|
222
|
-
server_name:
|
|
226
|
+
z3.object({
|
|
227
|
+
type: z3.literal("mcp_tool_use"),
|
|
228
|
+
id: z3.string(),
|
|
229
|
+
name: z3.string(),
|
|
230
|
+
input: z3.unknown(),
|
|
231
|
+
server_name: z3.string()
|
|
223
232
|
}),
|
|
224
|
-
|
|
225
|
-
type:
|
|
226
|
-
tool_use_id:
|
|
227
|
-
is_error:
|
|
228
|
-
content:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
233
|
+
z3.object({
|
|
234
|
+
type: z3.literal("mcp_tool_result"),
|
|
235
|
+
tool_use_id: z3.string(),
|
|
236
|
+
is_error: z3.boolean(),
|
|
237
|
+
content: z3.array(
|
|
238
|
+
z3.union([
|
|
239
|
+
z3.string(),
|
|
240
|
+
z3.object({ type: z3.literal("text"), text: z3.string() })
|
|
232
241
|
])
|
|
233
242
|
)
|
|
234
243
|
}),
|
|
235
|
-
|
|
236
|
-
type:
|
|
237
|
-
tool_use_id:
|
|
238
|
-
content:
|
|
239
|
-
|
|
240
|
-
type:
|
|
241
|
-
url:
|
|
242
|
-
retrieved_at:
|
|
243
|
-
content:
|
|
244
|
-
type:
|
|
245
|
-
title:
|
|
246
|
-
citations:
|
|
247
|
-
source:
|
|
248
|
-
|
|
249
|
-
type:
|
|
250
|
-
media_type:
|
|
251
|
-
data:
|
|
244
|
+
z3.object({
|
|
245
|
+
type: z3.literal("web_fetch_tool_result"),
|
|
246
|
+
tool_use_id: z3.string(),
|
|
247
|
+
content: z3.union([
|
|
248
|
+
z3.object({
|
|
249
|
+
type: z3.literal("web_fetch_result"),
|
|
250
|
+
url: z3.string(),
|
|
251
|
+
retrieved_at: z3.string(),
|
|
252
|
+
content: z3.object({
|
|
253
|
+
type: z3.literal("document"),
|
|
254
|
+
title: z3.string().nullable(),
|
|
255
|
+
citations: z3.object({ enabled: z3.boolean() }).optional(),
|
|
256
|
+
source: z3.union([
|
|
257
|
+
z3.object({
|
|
258
|
+
type: z3.literal("base64"),
|
|
259
|
+
media_type: z3.literal("application/pdf"),
|
|
260
|
+
data: z3.string()
|
|
252
261
|
}),
|
|
253
|
-
|
|
254
|
-
type:
|
|
255
|
-
media_type:
|
|
256
|
-
data:
|
|
262
|
+
z3.object({
|
|
263
|
+
type: z3.literal("text"),
|
|
264
|
+
media_type: z3.literal("text/plain"),
|
|
265
|
+
data: z3.string()
|
|
257
266
|
})
|
|
258
267
|
])
|
|
259
268
|
})
|
|
260
269
|
}),
|
|
261
|
-
|
|
262
|
-
type:
|
|
263
|
-
error_code:
|
|
270
|
+
z3.object({
|
|
271
|
+
type: z3.literal("web_fetch_tool_result_error"),
|
|
272
|
+
error_code: z3.string()
|
|
264
273
|
})
|
|
265
274
|
])
|
|
266
275
|
}),
|
|
267
|
-
|
|
268
|
-
type:
|
|
269
|
-
tool_use_id:
|
|
270
|
-
content:
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
type:
|
|
274
|
-
url:
|
|
275
|
-
title:
|
|
276
|
-
encrypted_content:
|
|
277
|
-
page_age:
|
|
276
|
+
z3.object({
|
|
277
|
+
type: z3.literal("web_search_tool_result"),
|
|
278
|
+
tool_use_id: z3.string(),
|
|
279
|
+
content: z3.union([
|
|
280
|
+
z3.array(
|
|
281
|
+
z3.object({
|
|
282
|
+
type: z3.literal("web_search_result"),
|
|
283
|
+
url: z3.string(),
|
|
284
|
+
title: z3.string(),
|
|
285
|
+
encrypted_content: z3.string(),
|
|
286
|
+
page_age: z3.string().nullish()
|
|
278
287
|
})
|
|
279
288
|
),
|
|
280
|
-
|
|
281
|
-
type:
|
|
282
|
-
error_code:
|
|
289
|
+
z3.object({
|
|
290
|
+
type: z3.literal("web_search_tool_result_error"),
|
|
291
|
+
error_code: z3.string()
|
|
283
292
|
})
|
|
284
293
|
])
|
|
285
294
|
}),
|
|
286
295
|
// code execution results for code_execution_20250522 tool:
|
|
287
|
-
|
|
288
|
-
type:
|
|
289
|
-
tool_use_id:
|
|
290
|
-
content:
|
|
291
|
-
|
|
292
|
-
type:
|
|
293
|
-
stdout:
|
|
294
|
-
stderr:
|
|
295
|
-
return_code:
|
|
296
|
-
content:
|
|
297
|
-
|
|
298
|
-
type:
|
|
299
|
-
file_id:
|
|
296
|
+
z3.object({
|
|
297
|
+
type: z3.literal("code_execution_tool_result"),
|
|
298
|
+
tool_use_id: z3.string(),
|
|
299
|
+
content: z3.union([
|
|
300
|
+
z3.object({
|
|
301
|
+
type: z3.literal("code_execution_result"),
|
|
302
|
+
stdout: z3.string(),
|
|
303
|
+
stderr: z3.string(),
|
|
304
|
+
return_code: z3.number(),
|
|
305
|
+
content: z3.array(
|
|
306
|
+
z3.object({
|
|
307
|
+
type: z3.literal("code_execution_output"),
|
|
308
|
+
file_id: z3.string()
|
|
300
309
|
})
|
|
301
310
|
).optional().default([])
|
|
302
311
|
}),
|
|
303
|
-
|
|
304
|
-
type:
|
|
305
|
-
encrypted_stdout:
|
|
306
|
-
stderr:
|
|
307
|
-
return_code:
|
|
308
|
-
content:
|
|
309
|
-
|
|
310
|
-
type:
|
|
311
|
-
file_id:
|
|
312
|
+
z3.object({
|
|
313
|
+
type: z3.literal("encrypted_code_execution_result"),
|
|
314
|
+
encrypted_stdout: z3.string(),
|
|
315
|
+
stderr: z3.string(),
|
|
316
|
+
return_code: z3.number(),
|
|
317
|
+
content: z3.array(
|
|
318
|
+
z3.object({
|
|
319
|
+
type: z3.literal("code_execution_output"),
|
|
320
|
+
file_id: z3.string()
|
|
312
321
|
})
|
|
313
322
|
).optional().default([])
|
|
314
323
|
}),
|
|
315
|
-
|
|
316
|
-
type:
|
|
317
|
-
error_code:
|
|
324
|
+
z3.object({
|
|
325
|
+
type: z3.literal("code_execution_tool_result_error"),
|
|
326
|
+
error_code: z3.string()
|
|
318
327
|
})
|
|
319
328
|
])
|
|
320
329
|
}),
|
|
321
330
|
// bash code execution results for code_execution_20250825 tool:
|
|
322
|
-
|
|
323
|
-
type:
|
|
324
|
-
tool_use_id:
|
|
325
|
-
content:
|
|
326
|
-
|
|
327
|
-
type:
|
|
328
|
-
content:
|
|
329
|
-
|
|
330
|
-
type:
|
|
331
|
-
file_id:
|
|
331
|
+
z3.object({
|
|
332
|
+
type: z3.literal("bash_code_execution_tool_result"),
|
|
333
|
+
tool_use_id: z3.string(),
|
|
334
|
+
content: z3.discriminatedUnion("type", [
|
|
335
|
+
z3.object({
|
|
336
|
+
type: z3.literal("bash_code_execution_result"),
|
|
337
|
+
content: z3.array(
|
|
338
|
+
z3.object({
|
|
339
|
+
type: z3.literal("bash_code_execution_output"),
|
|
340
|
+
file_id: z3.string()
|
|
332
341
|
})
|
|
333
342
|
),
|
|
334
|
-
stdout:
|
|
335
|
-
stderr:
|
|
336
|
-
return_code:
|
|
343
|
+
stdout: z3.string(),
|
|
344
|
+
stderr: z3.string(),
|
|
345
|
+
return_code: z3.number()
|
|
337
346
|
}),
|
|
338
|
-
|
|
339
|
-
type:
|
|
340
|
-
error_code:
|
|
347
|
+
z3.object({
|
|
348
|
+
type: z3.literal("bash_code_execution_tool_result_error"),
|
|
349
|
+
error_code: z3.string()
|
|
341
350
|
})
|
|
342
351
|
])
|
|
343
352
|
}),
|
|
344
353
|
// text editor code execution results for code_execution_20250825 tool:
|
|
345
|
-
|
|
346
|
-
type:
|
|
347
|
-
tool_use_id:
|
|
348
|
-
content:
|
|
349
|
-
|
|
350
|
-
type:
|
|
351
|
-
error_code:
|
|
354
|
+
z3.object({
|
|
355
|
+
type: z3.literal("text_editor_code_execution_tool_result"),
|
|
356
|
+
tool_use_id: z3.string(),
|
|
357
|
+
content: z3.discriminatedUnion("type", [
|
|
358
|
+
z3.object({
|
|
359
|
+
type: z3.literal("text_editor_code_execution_tool_result_error"),
|
|
360
|
+
error_code: z3.string()
|
|
352
361
|
}),
|
|
353
|
-
|
|
354
|
-
type:
|
|
355
|
-
content:
|
|
356
|
-
file_type:
|
|
357
|
-
num_lines:
|
|
358
|
-
start_line:
|
|
359
|
-
total_lines:
|
|
362
|
+
z3.object({
|
|
363
|
+
type: z3.literal("text_editor_code_execution_view_result"),
|
|
364
|
+
content: z3.string(),
|
|
365
|
+
file_type: z3.string(),
|
|
366
|
+
num_lines: z3.number().nullable(),
|
|
367
|
+
start_line: z3.number().nullable(),
|
|
368
|
+
total_lines: z3.number().nullable()
|
|
360
369
|
}),
|
|
361
|
-
|
|
362
|
-
type:
|
|
363
|
-
is_file_update:
|
|
370
|
+
z3.object({
|
|
371
|
+
type: z3.literal("text_editor_code_execution_create_result"),
|
|
372
|
+
is_file_update: z3.boolean()
|
|
364
373
|
}),
|
|
365
|
-
|
|
366
|
-
type:
|
|
374
|
+
z3.object({
|
|
375
|
+
type: z3.literal(
|
|
367
376
|
"text_editor_code_execution_str_replace_result"
|
|
368
377
|
),
|
|
369
|
-
lines:
|
|
370
|
-
new_lines:
|
|
371
|
-
new_start:
|
|
372
|
-
old_lines:
|
|
373
|
-
old_start:
|
|
378
|
+
lines: z3.array(z3.string()).nullable(),
|
|
379
|
+
new_lines: z3.number().nullable(),
|
|
380
|
+
new_start: z3.number().nullable(),
|
|
381
|
+
old_lines: z3.number().nullable(),
|
|
382
|
+
old_start: z3.number().nullable()
|
|
374
383
|
})
|
|
375
384
|
])
|
|
376
385
|
}),
|
|
377
386
|
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
378
|
-
|
|
379
|
-
type:
|
|
380
|
-
tool_use_id:
|
|
381
|
-
content:
|
|
382
|
-
|
|
383
|
-
type:
|
|
384
|
-
tool_references:
|
|
385
|
-
|
|
386
|
-
type:
|
|
387
|
-
tool_name:
|
|
387
|
+
z3.object({
|
|
388
|
+
type: z3.literal("tool_search_tool_result"),
|
|
389
|
+
tool_use_id: z3.string(),
|
|
390
|
+
content: z3.union([
|
|
391
|
+
z3.object({
|
|
392
|
+
type: z3.literal("tool_search_tool_search_result"),
|
|
393
|
+
tool_references: z3.array(
|
|
394
|
+
z3.object({
|
|
395
|
+
type: z3.literal("tool_reference"),
|
|
396
|
+
tool_name: z3.string()
|
|
388
397
|
})
|
|
389
398
|
)
|
|
390
399
|
}),
|
|
391
|
-
|
|
392
|
-
type:
|
|
393
|
-
error_code:
|
|
400
|
+
z3.object({
|
|
401
|
+
type: z3.literal("tool_search_tool_result_error"),
|
|
402
|
+
error_code: z3.string()
|
|
394
403
|
})
|
|
395
404
|
])
|
|
396
405
|
})
|
|
397
406
|
])
|
|
398
407
|
),
|
|
399
|
-
stop_reason:
|
|
400
|
-
stop_sequence:
|
|
401
|
-
usage:
|
|
402
|
-
input_tokens:
|
|
403
|
-
output_tokens:
|
|
404
|
-
cache_creation_input_tokens:
|
|
405
|
-
cache_read_input_tokens:
|
|
406
|
-
iterations:
|
|
407
|
-
|
|
408
|
-
type:
|
|
409
|
-
input_tokens:
|
|
410
|
-
output_tokens:
|
|
408
|
+
stop_reason: z3.string().nullish(),
|
|
409
|
+
stop_sequence: z3.string().nullish(),
|
|
410
|
+
usage: z3.looseObject({
|
|
411
|
+
input_tokens: z3.number(),
|
|
412
|
+
output_tokens: z3.number(),
|
|
413
|
+
cache_creation_input_tokens: z3.number().nullish(),
|
|
414
|
+
cache_read_input_tokens: z3.number().nullish(),
|
|
415
|
+
iterations: z3.array(
|
|
416
|
+
z3.object({
|
|
417
|
+
type: z3.union([z3.literal("compaction"), z3.literal("message")]),
|
|
418
|
+
input_tokens: z3.number(),
|
|
419
|
+
output_tokens: z3.number()
|
|
411
420
|
})
|
|
412
421
|
).nullish()
|
|
413
422
|
}),
|
|
414
|
-
container:
|
|
415
|
-
expires_at:
|
|
416
|
-
id:
|
|
417
|
-
skills:
|
|
418
|
-
|
|
419
|
-
type:
|
|
420
|
-
skill_id:
|
|
421
|
-
version:
|
|
423
|
+
container: z3.object({
|
|
424
|
+
expires_at: z3.string(),
|
|
425
|
+
id: z3.string(),
|
|
426
|
+
skills: z3.array(
|
|
427
|
+
z3.object({
|
|
428
|
+
type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
|
|
429
|
+
skill_id: z3.string(),
|
|
430
|
+
version: z3.string()
|
|
422
431
|
})
|
|
423
432
|
).nullish()
|
|
424
433
|
}).nullish(),
|
|
425
|
-
context_management:
|
|
426
|
-
applied_edits:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
type:
|
|
430
|
-
cleared_tool_uses:
|
|
431
|
-
cleared_input_tokens:
|
|
434
|
+
context_management: z3.object({
|
|
435
|
+
applied_edits: z3.array(
|
|
436
|
+
z3.union([
|
|
437
|
+
z3.object({
|
|
438
|
+
type: z3.literal("clear_tool_uses_20250919"),
|
|
439
|
+
cleared_tool_uses: z3.number(),
|
|
440
|
+
cleared_input_tokens: z3.number()
|
|
432
441
|
}),
|
|
433
|
-
|
|
434
|
-
type:
|
|
435
|
-
cleared_thinking_turns:
|
|
436
|
-
cleared_input_tokens:
|
|
442
|
+
z3.object({
|
|
443
|
+
type: z3.literal("clear_thinking_20251015"),
|
|
444
|
+
cleared_thinking_turns: z3.number(),
|
|
445
|
+
cleared_input_tokens: z3.number()
|
|
437
446
|
}),
|
|
438
|
-
|
|
439
|
-
type:
|
|
447
|
+
z3.object({
|
|
448
|
+
type: z3.literal("compact_20260112")
|
|
440
449
|
})
|
|
441
450
|
])
|
|
442
451
|
)
|
|
@@ -444,457 +453,457 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils3.lazySchema)(
|
|
|
444
453
|
})
|
|
445
454
|
)
|
|
446
455
|
);
|
|
447
|
-
var anthropicMessagesChunkSchema = (
|
|
448
|
-
() => (
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
type:
|
|
452
|
-
message:
|
|
453
|
-
id:
|
|
454
|
-
model:
|
|
455
|
-
role:
|
|
456
|
-
usage:
|
|
457
|
-
input_tokens:
|
|
458
|
-
cache_creation_input_tokens:
|
|
459
|
-
cache_read_input_tokens:
|
|
456
|
+
var anthropicMessagesChunkSchema = lazySchema3(
|
|
457
|
+
() => zodSchema3(
|
|
458
|
+
z3.discriminatedUnion("type", [
|
|
459
|
+
z3.object({
|
|
460
|
+
type: z3.literal("message_start"),
|
|
461
|
+
message: z3.object({
|
|
462
|
+
id: z3.string().nullish(),
|
|
463
|
+
model: z3.string().nullish(),
|
|
464
|
+
role: z3.string().nullish(),
|
|
465
|
+
usage: z3.looseObject({
|
|
466
|
+
input_tokens: z3.number(),
|
|
467
|
+
cache_creation_input_tokens: z3.number().nullish(),
|
|
468
|
+
cache_read_input_tokens: z3.number().nullish()
|
|
460
469
|
}),
|
|
461
470
|
// Programmatic tool calling: content may be pre-populated for deferred tool calls
|
|
462
|
-
content:
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
type:
|
|
466
|
-
id:
|
|
467
|
-
name:
|
|
468
|
-
input:
|
|
469
|
-
caller:
|
|
470
|
-
|
|
471
|
-
type:
|
|
472
|
-
tool_id:
|
|
471
|
+
content: z3.array(
|
|
472
|
+
z3.discriminatedUnion("type", [
|
|
473
|
+
z3.object({
|
|
474
|
+
type: z3.literal("tool_use"),
|
|
475
|
+
id: z3.string(),
|
|
476
|
+
name: z3.string(),
|
|
477
|
+
input: z3.unknown(),
|
|
478
|
+
caller: z3.union([
|
|
479
|
+
z3.object({
|
|
480
|
+
type: z3.literal("code_execution_20250825"),
|
|
481
|
+
tool_id: z3.string()
|
|
473
482
|
}),
|
|
474
|
-
|
|
475
|
-
type:
|
|
476
|
-
tool_id:
|
|
483
|
+
z3.object({
|
|
484
|
+
type: z3.literal("code_execution_20260120"),
|
|
485
|
+
tool_id: z3.string()
|
|
477
486
|
}),
|
|
478
|
-
|
|
479
|
-
type:
|
|
487
|
+
z3.object({
|
|
488
|
+
type: z3.literal("direct")
|
|
480
489
|
})
|
|
481
490
|
]).optional()
|
|
482
491
|
})
|
|
483
492
|
])
|
|
484
493
|
).nullish(),
|
|
485
|
-
stop_reason:
|
|
486
|
-
container:
|
|
487
|
-
expires_at:
|
|
488
|
-
id:
|
|
494
|
+
stop_reason: z3.string().nullish(),
|
|
495
|
+
container: z3.object({
|
|
496
|
+
expires_at: z3.string(),
|
|
497
|
+
id: z3.string()
|
|
489
498
|
}).nullish()
|
|
490
499
|
})
|
|
491
500
|
}),
|
|
492
|
-
|
|
493
|
-
type:
|
|
494
|
-
index:
|
|
495
|
-
content_block:
|
|
496
|
-
|
|
497
|
-
type:
|
|
498
|
-
text:
|
|
501
|
+
z3.object({
|
|
502
|
+
type: z3.literal("content_block_start"),
|
|
503
|
+
index: z3.number(),
|
|
504
|
+
content_block: z3.discriminatedUnion("type", [
|
|
505
|
+
z3.object({
|
|
506
|
+
type: z3.literal("text"),
|
|
507
|
+
text: z3.string()
|
|
499
508
|
}),
|
|
500
|
-
|
|
501
|
-
type:
|
|
502
|
-
thinking:
|
|
509
|
+
z3.object({
|
|
510
|
+
type: z3.literal("thinking"),
|
|
511
|
+
thinking: z3.string()
|
|
503
512
|
}),
|
|
504
|
-
|
|
505
|
-
type:
|
|
506
|
-
id:
|
|
507
|
-
name:
|
|
513
|
+
z3.object({
|
|
514
|
+
type: z3.literal("tool_use"),
|
|
515
|
+
id: z3.string(),
|
|
516
|
+
name: z3.string(),
|
|
508
517
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
509
|
-
input:
|
|
518
|
+
input: z3.record(z3.string(), z3.unknown()).optional(),
|
|
510
519
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
511
|
-
caller:
|
|
512
|
-
|
|
513
|
-
type:
|
|
514
|
-
tool_id:
|
|
520
|
+
caller: z3.union([
|
|
521
|
+
z3.object({
|
|
522
|
+
type: z3.literal("code_execution_20250825"),
|
|
523
|
+
tool_id: z3.string()
|
|
515
524
|
}),
|
|
516
|
-
|
|
517
|
-
type:
|
|
518
|
-
tool_id:
|
|
525
|
+
z3.object({
|
|
526
|
+
type: z3.literal("code_execution_20260120"),
|
|
527
|
+
tool_id: z3.string()
|
|
519
528
|
}),
|
|
520
|
-
|
|
521
|
-
type:
|
|
529
|
+
z3.object({
|
|
530
|
+
type: z3.literal("direct")
|
|
522
531
|
})
|
|
523
532
|
]).optional()
|
|
524
533
|
}),
|
|
525
|
-
|
|
526
|
-
type:
|
|
527
|
-
data:
|
|
534
|
+
z3.object({
|
|
535
|
+
type: z3.literal("redacted_thinking"),
|
|
536
|
+
data: z3.string()
|
|
528
537
|
}),
|
|
529
|
-
|
|
530
|
-
type:
|
|
531
|
-
content:
|
|
538
|
+
z3.object({
|
|
539
|
+
type: z3.literal("compaction"),
|
|
540
|
+
content: z3.string().nullish()
|
|
532
541
|
}),
|
|
533
|
-
|
|
534
|
-
type:
|
|
535
|
-
id:
|
|
536
|
-
name:
|
|
537
|
-
input:
|
|
538
|
-
caller:
|
|
539
|
-
|
|
540
|
-
type:
|
|
541
|
-
tool_id:
|
|
542
|
+
z3.object({
|
|
543
|
+
type: z3.literal("server_tool_use"),
|
|
544
|
+
id: z3.string(),
|
|
545
|
+
name: z3.string(),
|
|
546
|
+
input: z3.record(z3.string(), z3.unknown()).nullish(),
|
|
547
|
+
caller: z3.union([
|
|
548
|
+
z3.object({
|
|
549
|
+
type: z3.literal("code_execution_20260120"),
|
|
550
|
+
tool_id: z3.string()
|
|
542
551
|
}),
|
|
543
|
-
|
|
544
|
-
type:
|
|
552
|
+
z3.object({
|
|
553
|
+
type: z3.literal("direct")
|
|
545
554
|
})
|
|
546
555
|
]).optional()
|
|
547
556
|
}),
|
|
548
|
-
|
|
549
|
-
type:
|
|
550
|
-
id:
|
|
551
|
-
name:
|
|
552
|
-
input:
|
|
553
|
-
server_name:
|
|
557
|
+
z3.object({
|
|
558
|
+
type: z3.literal("mcp_tool_use"),
|
|
559
|
+
id: z3.string(),
|
|
560
|
+
name: z3.string(),
|
|
561
|
+
input: z3.unknown(),
|
|
562
|
+
server_name: z3.string()
|
|
554
563
|
}),
|
|
555
|
-
|
|
556
|
-
type:
|
|
557
|
-
tool_use_id:
|
|
558
|
-
is_error:
|
|
559
|
-
content:
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
564
|
+
z3.object({
|
|
565
|
+
type: z3.literal("mcp_tool_result"),
|
|
566
|
+
tool_use_id: z3.string(),
|
|
567
|
+
is_error: z3.boolean(),
|
|
568
|
+
content: z3.array(
|
|
569
|
+
z3.union([
|
|
570
|
+
z3.string(),
|
|
571
|
+
z3.object({ type: z3.literal("text"), text: z3.string() })
|
|
563
572
|
])
|
|
564
573
|
)
|
|
565
574
|
}),
|
|
566
|
-
|
|
567
|
-
type:
|
|
568
|
-
tool_use_id:
|
|
569
|
-
content:
|
|
570
|
-
|
|
571
|
-
type:
|
|
572
|
-
url:
|
|
573
|
-
retrieved_at:
|
|
574
|
-
content:
|
|
575
|
-
type:
|
|
576
|
-
title:
|
|
577
|
-
citations:
|
|
578
|
-
source:
|
|
579
|
-
|
|
580
|
-
type:
|
|
581
|
-
media_type:
|
|
582
|
-
data:
|
|
575
|
+
z3.object({
|
|
576
|
+
type: z3.literal("web_fetch_tool_result"),
|
|
577
|
+
tool_use_id: z3.string(),
|
|
578
|
+
content: z3.union([
|
|
579
|
+
z3.object({
|
|
580
|
+
type: z3.literal("web_fetch_result"),
|
|
581
|
+
url: z3.string(),
|
|
582
|
+
retrieved_at: z3.string(),
|
|
583
|
+
content: z3.object({
|
|
584
|
+
type: z3.literal("document"),
|
|
585
|
+
title: z3.string().nullable(),
|
|
586
|
+
citations: z3.object({ enabled: z3.boolean() }).optional(),
|
|
587
|
+
source: z3.union([
|
|
588
|
+
z3.object({
|
|
589
|
+
type: z3.literal("base64"),
|
|
590
|
+
media_type: z3.literal("application/pdf"),
|
|
591
|
+
data: z3.string()
|
|
583
592
|
}),
|
|
584
|
-
|
|
585
|
-
type:
|
|
586
|
-
media_type:
|
|
587
|
-
data:
|
|
593
|
+
z3.object({
|
|
594
|
+
type: z3.literal("text"),
|
|
595
|
+
media_type: z3.literal("text/plain"),
|
|
596
|
+
data: z3.string()
|
|
588
597
|
})
|
|
589
598
|
])
|
|
590
599
|
})
|
|
591
600
|
}),
|
|
592
|
-
|
|
593
|
-
type:
|
|
594
|
-
error_code:
|
|
601
|
+
z3.object({
|
|
602
|
+
type: z3.literal("web_fetch_tool_result_error"),
|
|
603
|
+
error_code: z3.string()
|
|
595
604
|
})
|
|
596
605
|
])
|
|
597
606
|
}),
|
|
598
|
-
|
|
599
|
-
type:
|
|
600
|
-
tool_use_id:
|
|
601
|
-
content:
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
type:
|
|
605
|
-
url:
|
|
606
|
-
title:
|
|
607
|
-
encrypted_content:
|
|
608
|
-
page_age:
|
|
607
|
+
z3.object({
|
|
608
|
+
type: z3.literal("web_search_tool_result"),
|
|
609
|
+
tool_use_id: z3.string(),
|
|
610
|
+
content: z3.union([
|
|
611
|
+
z3.array(
|
|
612
|
+
z3.object({
|
|
613
|
+
type: z3.literal("web_search_result"),
|
|
614
|
+
url: z3.string(),
|
|
615
|
+
title: z3.string(),
|
|
616
|
+
encrypted_content: z3.string(),
|
|
617
|
+
page_age: z3.string().nullish()
|
|
609
618
|
})
|
|
610
619
|
),
|
|
611
|
-
|
|
612
|
-
type:
|
|
613
|
-
error_code:
|
|
620
|
+
z3.object({
|
|
621
|
+
type: z3.literal("web_search_tool_result_error"),
|
|
622
|
+
error_code: z3.string()
|
|
614
623
|
})
|
|
615
624
|
])
|
|
616
625
|
}),
|
|
617
626
|
// code execution results for code_execution_20250522 tool:
|
|
618
|
-
|
|
619
|
-
type:
|
|
620
|
-
tool_use_id:
|
|
621
|
-
content:
|
|
622
|
-
|
|
623
|
-
type:
|
|
624
|
-
stdout:
|
|
625
|
-
stderr:
|
|
626
|
-
return_code:
|
|
627
|
-
content:
|
|
628
|
-
|
|
629
|
-
type:
|
|
630
|
-
file_id:
|
|
627
|
+
z3.object({
|
|
628
|
+
type: z3.literal("code_execution_tool_result"),
|
|
629
|
+
tool_use_id: z3.string(),
|
|
630
|
+
content: z3.union([
|
|
631
|
+
z3.object({
|
|
632
|
+
type: z3.literal("code_execution_result"),
|
|
633
|
+
stdout: z3.string(),
|
|
634
|
+
stderr: z3.string(),
|
|
635
|
+
return_code: z3.number(),
|
|
636
|
+
content: z3.array(
|
|
637
|
+
z3.object({
|
|
638
|
+
type: z3.literal("code_execution_output"),
|
|
639
|
+
file_id: z3.string()
|
|
631
640
|
})
|
|
632
641
|
).optional().default([])
|
|
633
642
|
}),
|
|
634
|
-
|
|
635
|
-
type:
|
|
636
|
-
encrypted_stdout:
|
|
637
|
-
stderr:
|
|
638
|
-
return_code:
|
|
639
|
-
content:
|
|
640
|
-
|
|
641
|
-
type:
|
|
642
|
-
file_id:
|
|
643
|
+
z3.object({
|
|
644
|
+
type: z3.literal("encrypted_code_execution_result"),
|
|
645
|
+
encrypted_stdout: z3.string(),
|
|
646
|
+
stderr: z3.string(),
|
|
647
|
+
return_code: z3.number(),
|
|
648
|
+
content: z3.array(
|
|
649
|
+
z3.object({
|
|
650
|
+
type: z3.literal("code_execution_output"),
|
|
651
|
+
file_id: z3.string()
|
|
643
652
|
})
|
|
644
653
|
).optional().default([])
|
|
645
654
|
}),
|
|
646
|
-
|
|
647
|
-
type:
|
|
648
|
-
error_code:
|
|
655
|
+
z3.object({
|
|
656
|
+
type: z3.literal("code_execution_tool_result_error"),
|
|
657
|
+
error_code: z3.string()
|
|
649
658
|
})
|
|
650
659
|
])
|
|
651
660
|
}),
|
|
652
661
|
// bash code execution results for code_execution_20250825 tool:
|
|
653
|
-
|
|
654
|
-
type:
|
|
655
|
-
tool_use_id:
|
|
656
|
-
content:
|
|
657
|
-
|
|
658
|
-
type:
|
|
659
|
-
content:
|
|
660
|
-
|
|
661
|
-
type:
|
|
662
|
-
file_id:
|
|
662
|
+
z3.object({
|
|
663
|
+
type: z3.literal("bash_code_execution_tool_result"),
|
|
664
|
+
tool_use_id: z3.string(),
|
|
665
|
+
content: z3.discriminatedUnion("type", [
|
|
666
|
+
z3.object({
|
|
667
|
+
type: z3.literal("bash_code_execution_result"),
|
|
668
|
+
content: z3.array(
|
|
669
|
+
z3.object({
|
|
670
|
+
type: z3.literal("bash_code_execution_output"),
|
|
671
|
+
file_id: z3.string()
|
|
663
672
|
})
|
|
664
673
|
),
|
|
665
|
-
stdout:
|
|
666
|
-
stderr:
|
|
667
|
-
return_code:
|
|
674
|
+
stdout: z3.string(),
|
|
675
|
+
stderr: z3.string(),
|
|
676
|
+
return_code: z3.number()
|
|
668
677
|
}),
|
|
669
|
-
|
|
670
|
-
type:
|
|
671
|
-
error_code:
|
|
678
|
+
z3.object({
|
|
679
|
+
type: z3.literal("bash_code_execution_tool_result_error"),
|
|
680
|
+
error_code: z3.string()
|
|
672
681
|
})
|
|
673
682
|
])
|
|
674
683
|
}),
|
|
675
684
|
// text editor code execution results for code_execution_20250825 tool:
|
|
676
|
-
|
|
677
|
-
type:
|
|
678
|
-
tool_use_id:
|
|
679
|
-
content:
|
|
680
|
-
|
|
681
|
-
type:
|
|
682
|
-
error_code:
|
|
685
|
+
z3.object({
|
|
686
|
+
type: z3.literal("text_editor_code_execution_tool_result"),
|
|
687
|
+
tool_use_id: z3.string(),
|
|
688
|
+
content: z3.discriminatedUnion("type", [
|
|
689
|
+
z3.object({
|
|
690
|
+
type: z3.literal("text_editor_code_execution_tool_result_error"),
|
|
691
|
+
error_code: z3.string()
|
|
683
692
|
}),
|
|
684
|
-
|
|
685
|
-
type:
|
|
686
|
-
content:
|
|
687
|
-
file_type:
|
|
688
|
-
num_lines:
|
|
689
|
-
start_line:
|
|
690
|
-
total_lines:
|
|
693
|
+
z3.object({
|
|
694
|
+
type: z3.literal("text_editor_code_execution_view_result"),
|
|
695
|
+
content: z3.string(),
|
|
696
|
+
file_type: z3.string(),
|
|
697
|
+
num_lines: z3.number().nullable(),
|
|
698
|
+
start_line: z3.number().nullable(),
|
|
699
|
+
total_lines: z3.number().nullable()
|
|
691
700
|
}),
|
|
692
|
-
|
|
693
|
-
type:
|
|
694
|
-
is_file_update:
|
|
701
|
+
z3.object({
|
|
702
|
+
type: z3.literal("text_editor_code_execution_create_result"),
|
|
703
|
+
is_file_update: z3.boolean()
|
|
695
704
|
}),
|
|
696
|
-
|
|
697
|
-
type:
|
|
705
|
+
z3.object({
|
|
706
|
+
type: z3.literal(
|
|
698
707
|
"text_editor_code_execution_str_replace_result"
|
|
699
708
|
),
|
|
700
|
-
lines:
|
|
701
|
-
new_lines:
|
|
702
|
-
new_start:
|
|
703
|
-
old_lines:
|
|
704
|
-
old_start:
|
|
709
|
+
lines: z3.array(z3.string()).nullable(),
|
|
710
|
+
new_lines: z3.number().nullable(),
|
|
711
|
+
new_start: z3.number().nullable(),
|
|
712
|
+
old_lines: z3.number().nullable(),
|
|
713
|
+
old_start: z3.number().nullable()
|
|
705
714
|
})
|
|
706
715
|
])
|
|
707
716
|
}),
|
|
708
717
|
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
709
|
-
|
|
710
|
-
type:
|
|
711
|
-
tool_use_id:
|
|
712
|
-
content:
|
|
713
|
-
|
|
714
|
-
type:
|
|
715
|
-
tool_references:
|
|
716
|
-
|
|
717
|
-
type:
|
|
718
|
-
tool_name:
|
|
718
|
+
z3.object({
|
|
719
|
+
type: z3.literal("tool_search_tool_result"),
|
|
720
|
+
tool_use_id: z3.string(),
|
|
721
|
+
content: z3.union([
|
|
722
|
+
z3.object({
|
|
723
|
+
type: z3.literal("tool_search_tool_search_result"),
|
|
724
|
+
tool_references: z3.array(
|
|
725
|
+
z3.object({
|
|
726
|
+
type: z3.literal("tool_reference"),
|
|
727
|
+
tool_name: z3.string()
|
|
719
728
|
})
|
|
720
729
|
)
|
|
721
730
|
}),
|
|
722
|
-
|
|
723
|
-
type:
|
|
724
|
-
error_code:
|
|
731
|
+
z3.object({
|
|
732
|
+
type: z3.literal("tool_search_tool_result_error"),
|
|
733
|
+
error_code: z3.string()
|
|
725
734
|
})
|
|
726
735
|
])
|
|
727
736
|
})
|
|
728
737
|
])
|
|
729
738
|
}),
|
|
730
|
-
|
|
731
|
-
type:
|
|
732
|
-
index:
|
|
733
|
-
delta:
|
|
734
|
-
|
|
735
|
-
type:
|
|
736
|
-
partial_json:
|
|
739
|
+
z3.object({
|
|
740
|
+
type: z3.literal("content_block_delta"),
|
|
741
|
+
index: z3.number(),
|
|
742
|
+
delta: z3.discriminatedUnion("type", [
|
|
743
|
+
z3.object({
|
|
744
|
+
type: z3.literal("input_json_delta"),
|
|
745
|
+
partial_json: z3.string()
|
|
737
746
|
}),
|
|
738
|
-
|
|
739
|
-
type:
|
|
740
|
-
text:
|
|
747
|
+
z3.object({
|
|
748
|
+
type: z3.literal("text_delta"),
|
|
749
|
+
text: z3.string()
|
|
741
750
|
}),
|
|
742
|
-
|
|
743
|
-
type:
|
|
744
|
-
thinking:
|
|
751
|
+
z3.object({
|
|
752
|
+
type: z3.literal("thinking_delta"),
|
|
753
|
+
thinking: z3.string()
|
|
745
754
|
}),
|
|
746
|
-
|
|
747
|
-
type:
|
|
748
|
-
signature:
|
|
755
|
+
z3.object({
|
|
756
|
+
type: z3.literal("signature_delta"),
|
|
757
|
+
signature: z3.string()
|
|
749
758
|
}),
|
|
750
|
-
|
|
751
|
-
type:
|
|
752
|
-
content:
|
|
759
|
+
z3.object({
|
|
760
|
+
type: z3.literal("compaction_delta"),
|
|
761
|
+
content: z3.string().nullish()
|
|
753
762
|
}),
|
|
754
|
-
|
|
755
|
-
type:
|
|
756
|
-
citation:
|
|
757
|
-
|
|
758
|
-
type:
|
|
759
|
-
cited_text:
|
|
760
|
-
url:
|
|
761
|
-
title:
|
|
762
|
-
encrypted_index:
|
|
763
|
+
z3.object({
|
|
764
|
+
type: z3.literal("citations_delta"),
|
|
765
|
+
citation: z3.discriminatedUnion("type", [
|
|
766
|
+
z3.object({
|
|
767
|
+
type: z3.literal("web_search_result_location"),
|
|
768
|
+
cited_text: z3.string(),
|
|
769
|
+
url: z3.string(),
|
|
770
|
+
title: z3.string(),
|
|
771
|
+
encrypted_index: z3.string()
|
|
763
772
|
}),
|
|
764
|
-
|
|
765
|
-
type:
|
|
766
|
-
cited_text:
|
|
767
|
-
document_index:
|
|
768
|
-
document_title:
|
|
769
|
-
start_page_number:
|
|
770
|
-
end_page_number:
|
|
773
|
+
z3.object({
|
|
774
|
+
type: z3.literal("page_location"),
|
|
775
|
+
cited_text: z3.string(),
|
|
776
|
+
document_index: z3.number(),
|
|
777
|
+
document_title: z3.string().nullable(),
|
|
778
|
+
start_page_number: z3.number(),
|
|
779
|
+
end_page_number: z3.number()
|
|
771
780
|
}),
|
|
772
|
-
|
|
773
|
-
type:
|
|
774
|
-
cited_text:
|
|
775
|
-
document_index:
|
|
776
|
-
document_title:
|
|
777
|
-
start_char_index:
|
|
778
|
-
end_char_index:
|
|
781
|
+
z3.object({
|
|
782
|
+
type: z3.literal("char_location"),
|
|
783
|
+
cited_text: z3.string(),
|
|
784
|
+
document_index: z3.number(),
|
|
785
|
+
document_title: z3.string().nullable(),
|
|
786
|
+
start_char_index: z3.number(),
|
|
787
|
+
end_char_index: z3.number()
|
|
779
788
|
})
|
|
780
789
|
])
|
|
781
790
|
})
|
|
782
791
|
])
|
|
783
792
|
}),
|
|
784
|
-
|
|
785
|
-
type:
|
|
786
|
-
index:
|
|
793
|
+
z3.object({
|
|
794
|
+
type: z3.literal("content_block_stop"),
|
|
795
|
+
index: z3.number()
|
|
787
796
|
}),
|
|
788
|
-
|
|
789
|
-
type:
|
|
790
|
-
error:
|
|
791
|
-
type:
|
|
792
|
-
message:
|
|
797
|
+
z3.object({
|
|
798
|
+
type: z3.literal("error"),
|
|
799
|
+
error: z3.object({
|
|
800
|
+
type: z3.string(),
|
|
801
|
+
message: z3.string()
|
|
793
802
|
})
|
|
794
803
|
}),
|
|
795
|
-
|
|
796
|
-
type:
|
|
797
|
-
delta:
|
|
798
|
-
stop_reason:
|
|
799
|
-
stop_sequence:
|
|
800
|
-
container:
|
|
801
|
-
expires_at:
|
|
802
|
-
id:
|
|
803
|
-
skills:
|
|
804
|
-
|
|
805
|
-
type:
|
|
806
|
-
|
|
807
|
-
|
|
804
|
+
z3.object({
|
|
805
|
+
type: z3.literal("message_delta"),
|
|
806
|
+
delta: z3.object({
|
|
807
|
+
stop_reason: z3.string().nullish(),
|
|
808
|
+
stop_sequence: z3.string().nullish(),
|
|
809
|
+
container: z3.object({
|
|
810
|
+
expires_at: z3.string(),
|
|
811
|
+
id: z3.string(),
|
|
812
|
+
skills: z3.array(
|
|
813
|
+
z3.object({
|
|
814
|
+
type: z3.union([
|
|
815
|
+
z3.literal("anthropic"),
|
|
816
|
+
z3.literal("custom")
|
|
808
817
|
]),
|
|
809
|
-
skill_id:
|
|
810
|
-
version:
|
|
818
|
+
skill_id: z3.string(),
|
|
819
|
+
version: z3.string()
|
|
811
820
|
})
|
|
812
821
|
).nullish()
|
|
813
822
|
}).nullish()
|
|
814
823
|
}),
|
|
815
|
-
usage:
|
|
816
|
-
input_tokens:
|
|
817
|
-
output_tokens:
|
|
818
|
-
cache_creation_input_tokens:
|
|
819
|
-
cache_read_input_tokens:
|
|
820
|
-
iterations:
|
|
821
|
-
|
|
822
|
-
type:
|
|
823
|
-
input_tokens:
|
|
824
|
-
output_tokens:
|
|
824
|
+
usage: z3.looseObject({
|
|
825
|
+
input_tokens: z3.number().nullish(),
|
|
826
|
+
output_tokens: z3.number(),
|
|
827
|
+
cache_creation_input_tokens: z3.number().nullish(),
|
|
828
|
+
cache_read_input_tokens: z3.number().nullish(),
|
|
829
|
+
iterations: z3.array(
|
|
830
|
+
z3.object({
|
|
831
|
+
type: z3.union([z3.literal("compaction"), z3.literal("message")]),
|
|
832
|
+
input_tokens: z3.number(),
|
|
833
|
+
output_tokens: z3.number()
|
|
825
834
|
})
|
|
826
835
|
).nullish()
|
|
827
836
|
}),
|
|
828
|
-
context_management:
|
|
829
|
-
applied_edits:
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
type:
|
|
833
|
-
cleared_tool_uses:
|
|
834
|
-
cleared_input_tokens:
|
|
837
|
+
context_management: z3.object({
|
|
838
|
+
applied_edits: z3.array(
|
|
839
|
+
z3.union([
|
|
840
|
+
z3.object({
|
|
841
|
+
type: z3.literal("clear_tool_uses_20250919"),
|
|
842
|
+
cleared_tool_uses: z3.number(),
|
|
843
|
+
cleared_input_tokens: z3.number()
|
|
835
844
|
}),
|
|
836
|
-
|
|
837
|
-
type:
|
|
838
|
-
cleared_thinking_turns:
|
|
839
|
-
cleared_input_tokens:
|
|
845
|
+
z3.object({
|
|
846
|
+
type: z3.literal("clear_thinking_20251015"),
|
|
847
|
+
cleared_thinking_turns: z3.number(),
|
|
848
|
+
cleared_input_tokens: z3.number()
|
|
840
849
|
}),
|
|
841
|
-
|
|
842
|
-
type:
|
|
850
|
+
z3.object({
|
|
851
|
+
type: z3.literal("compact_20260112")
|
|
843
852
|
})
|
|
844
853
|
])
|
|
845
854
|
)
|
|
846
855
|
}).nullish()
|
|
847
856
|
}),
|
|
848
|
-
|
|
849
|
-
type:
|
|
857
|
+
z3.object({
|
|
858
|
+
type: z3.literal("message_stop")
|
|
850
859
|
}),
|
|
851
|
-
|
|
852
|
-
type:
|
|
860
|
+
z3.object({
|
|
861
|
+
type: z3.literal("ping")
|
|
853
862
|
})
|
|
854
863
|
])
|
|
855
864
|
)
|
|
856
865
|
);
|
|
857
|
-
var anthropicReasoningMetadataSchema = (
|
|
858
|
-
() => (
|
|
859
|
-
|
|
860
|
-
signature:
|
|
861
|
-
redactedData:
|
|
866
|
+
var anthropicReasoningMetadataSchema = lazySchema3(
|
|
867
|
+
() => zodSchema3(
|
|
868
|
+
z3.object({
|
|
869
|
+
signature: z3.string().optional(),
|
|
870
|
+
redactedData: z3.string().optional()
|
|
862
871
|
})
|
|
863
872
|
)
|
|
864
873
|
);
|
|
865
874
|
|
|
866
875
|
// src/anthropic-messages-options.ts
|
|
867
|
-
|
|
868
|
-
var anthropicFilePartProviderOptions =
|
|
876
|
+
import { z as z4 } from "zod/v4";
|
|
877
|
+
var anthropicFilePartProviderOptions = z4.object({
|
|
869
878
|
/**
|
|
870
879
|
* Citation configuration for this document.
|
|
871
880
|
* When enabled, this document will generate citations in the response.
|
|
872
881
|
*/
|
|
873
|
-
citations:
|
|
882
|
+
citations: z4.object({
|
|
874
883
|
/**
|
|
875
884
|
* Enable citations for this document
|
|
876
885
|
*/
|
|
877
|
-
enabled:
|
|
886
|
+
enabled: z4.boolean()
|
|
878
887
|
}).optional(),
|
|
879
888
|
/**
|
|
880
889
|
* Custom title for the document.
|
|
881
890
|
* If not provided, the filename will be used.
|
|
882
891
|
*/
|
|
883
|
-
title:
|
|
892
|
+
title: z4.string().optional(),
|
|
884
893
|
/**
|
|
885
894
|
* Context about the document that will be passed to the model
|
|
886
895
|
* but not used towards cited content.
|
|
887
896
|
* Useful for storing document metadata as text or stringified JSON.
|
|
888
897
|
*/
|
|
889
|
-
context:
|
|
898
|
+
context: z4.string().optional()
|
|
890
899
|
});
|
|
891
|
-
var anthropicLanguageModelOptions =
|
|
900
|
+
var anthropicLanguageModelOptions = z4.object({
|
|
892
901
|
/**
|
|
893
902
|
* Whether to send reasoning to the model.
|
|
894
903
|
*
|
|
895
904
|
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
896
905
|
*/
|
|
897
|
-
sendReasoning:
|
|
906
|
+
sendReasoning: z4.boolean().optional(),
|
|
898
907
|
/**
|
|
899
908
|
* Determines how structured outputs are generated.
|
|
900
909
|
*
|
|
@@ -902,66 +911,66 @@ var anthropicLanguageModelOptions = import_v44.z.object({
|
|
|
902
911
|
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
903
912
|
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
904
913
|
*/
|
|
905
|
-
structuredOutputMode:
|
|
914
|
+
structuredOutputMode: z4.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
906
915
|
/**
|
|
907
916
|
* Configuration for enabling Claude's extended thinking.
|
|
908
917
|
*
|
|
909
918
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
910
919
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
911
920
|
*/
|
|
912
|
-
thinking:
|
|
913
|
-
|
|
921
|
+
thinking: z4.discriminatedUnion("type", [
|
|
922
|
+
z4.object({
|
|
914
923
|
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
915
|
-
type:
|
|
924
|
+
type: z4.literal("adaptive")
|
|
916
925
|
}),
|
|
917
|
-
|
|
926
|
+
z4.object({
|
|
918
927
|
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
919
|
-
type:
|
|
920
|
-
budgetTokens:
|
|
928
|
+
type: z4.literal("enabled"),
|
|
929
|
+
budgetTokens: z4.number().optional()
|
|
921
930
|
}),
|
|
922
|
-
|
|
923
|
-
type:
|
|
931
|
+
z4.object({
|
|
932
|
+
type: z4.literal("disabled")
|
|
924
933
|
})
|
|
925
934
|
]).optional(),
|
|
926
935
|
/**
|
|
927
936
|
* Whether to disable parallel function calling during tool use. Default is false.
|
|
928
937
|
* When set to true, Claude will use at most one tool per response.
|
|
929
938
|
*/
|
|
930
|
-
disableParallelToolUse:
|
|
939
|
+
disableParallelToolUse: z4.boolean().optional(),
|
|
931
940
|
/**
|
|
932
941
|
* Cache control settings for this message.
|
|
933
942
|
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
934
943
|
*/
|
|
935
|
-
cacheControl:
|
|
936
|
-
type:
|
|
937
|
-
ttl:
|
|
944
|
+
cacheControl: z4.object({
|
|
945
|
+
type: z4.literal("ephemeral"),
|
|
946
|
+
ttl: z4.union([z4.literal("5m"), z4.literal("1h")]).optional()
|
|
938
947
|
}).optional(),
|
|
939
948
|
/**
|
|
940
949
|
* Metadata to include with the request.
|
|
941
950
|
*
|
|
942
951
|
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
943
952
|
*/
|
|
944
|
-
metadata:
|
|
953
|
+
metadata: z4.object({
|
|
945
954
|
/**
|
|
946
955
|
* An external identifier for the user associated with the request.
|
|
947
956
|
*
|
|
948
957
|
* Should be a UUID, hash value, or other opaque identifier.
|
|
949
958
|
* Must not contain PII (name, email, phone number, etc.).
|
|
950
959
|
*/
|
|
951
|
-
userId:
|
|
960
|
+
userId: z4.string().optional()
|
|
952
961
|
}).optional(),
|
|
953
962
|
/**
|
|
954
963
|
* MCP servers to be utilized in this request.
|
|
955
964
|
*/
|
|
956
|
-
mcpServers:
|
|
957
|
-
|
|
958
|
-
type:
|
|
959
|
-
name:
|
|
960
|
-
url:
|
|
961
|
-
authorizationToken:
|
|
962
|
-
toolConfiguration:
|
|
963
|
-
enabled:
|
|
964
|
-
allowedTools:
|
|
965
|
+
mcpServers: z4.array(
|
|
966
|
+
z4.object({
|
|
967
|
+
type: z4.literal("url"),
|
|
968
|
+
name: z4.string(),
|
|
969
|
+
url: z4.string(),
|
|
970
|
+
authorizationToken: z4.string().nullish(),
|
|
971
|
+
toolConfiguration: z4.object({
|
|
972
|
+
enabled: z4.boolean().nullish(),
|
|
973
|
+
allowedTools: z4.array(z4.string()).nullish()
|
|
965
974
|
}).nullish()
|
|
966
975
|
})
|
|
967
976
|
).optional(),
|
|
@@ -970,19 +979,19 @@ var anthropicLanguageModelOptions = import_v44.z.object({
|
|
|
970
979
|
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
971
980
|
* Requires code execution tool to be enabled.
|
|
972
981
|
*/
|
|
973
|
-
container:
|
|
974
|
-
id:
|
|
975
|
-
skills:
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
type:
|
|
979
|
-
skillId:
|
|
980
|
-
version:
|
|
982
|
+
container: z4.object({
|
|
983
|
+
id: z4.string().optional(),
|
|
984
|
+
skills: z4.array(
|
|
985
|
+
z4.discriminatedUnion("type", [
|
|
986
|
+
z4.object({
|
|
987
|
+
type: z4.literal("anthropic"),
|
|
988
|
+
skillId: z4.string(),
|
|
989
|
+
version: z4.string().optional()
|
|
981
990
|
}),
|
|
982
|
-
|
|
983
|
-
type:
|
|
984
|
-
providerReference:
|
|
985
|
-
version:
|
|
991
|
+
z4.object({
|
|
992
|
+
type: z4.literal("custom"),
|
|
993
|
+
providerReference: z4.record(z4.string(), z4.string()),
|
|
994
|
+
version: z4.string().optional()
|
|
986
995
|
})
|
|
987
996
|
])
|
|
988
997
|
).optional()
|
|
@@ -995,16 +1004,16 @@ var anthropicLanguageModelOptions = import_v44.z.object({
|
|
|
995
1004
|
*
|
|
996
1005
|
* @default true
|
|
997
1006
|
*/
|
|
998
|
-
toolStreaming:
|
|
1007
|
+
toolStreaming: z4.boolean().optional(),
|
|
999
1008
|
/**
|
|
1000
1009
|
* @default 'high'
|
|
1001
1010
|
*/
|
|
1002
|
-
effort:
|
|
1011
|
+
effort: z4.enum(["low", "medium", "high", "max"]).optional(),
|
|
1003
1012
|
/**
|
|
1004
1013
|
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
1005
1014
|
* Only supported with claude-opus-4-6.
|
|
1006
1015
|
*/
|
|
1007
|
-
speed:
|
|
1016
|
+
speed: z4.enum(["fast", "standard"]).optional(),
|
|
1008
1017
|
/**
|
|
1009
1018
|
* Controls where model inference runs for this request.
|
|
1010
1019
|
*
|
|
@@ -1013,56 +1022,56 @@ var anthropicLanguageModelOptions = import_v44.z.object({
|
|
|
1013
1022
|
*
|
|
1014
1023
|
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
1015
1024
|
*/
|
|
1016
|
-
inferenceGeo:
|
|
1025
|
+
inferenceGeo: z4.enum(["us", "global"]).optional(),
|
|
1017
1026
|
/**
|
|
1018
1027
|
* A set of beta features to enable.
|
|
1019
1028
|
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1020
1029
|
*/
|
|
1021
|
-
anthropicBeta:
|
|
1022
|
-
contextManagement:
|
|
1023
|
-
edits:
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
type:
|
|
1027
|
-
trigger:
|
|
1028
|
-
|
|
1029
|
-
type:
|
|
1030
|
-
value:
|
|
1030
|
+
anthropicBeta: z4.array(z4.string()).optional(),
|
|
1031
|
+
contextManagement: z4.object({
|
|
1032
|
+
edits: z4.array(
|
|
1033
|
+
z4.discriminatedUnion("type", [
|
|
1034
|
+
z4.object({
|
|
1035
|
+
type: z4.literal("clear_tool_uses_20250919"),
|
|
1036
|
+
trigger: z4.discriminatedUnion("type", [
|
|
1037
|
+
z4.object({
|
|
1038
|
+
type: z4.literal("input_tokens"),
|
|
1039
|
+
value: z4.number()
|
|
1031
1040
|
}),
|
|
1032
|
-
|
|
1033
|
-
type:
|
|
1034
|
-
value:
|
|
1041
|
+
z4.object({
|
|
1042
|
+
type: z4.literal("tool_uses"),
|
|
1043
|
+
value: z4.number()
|
|
1035
1044
|
})
|
|
1036
1045
|
]).optional(),
|
|
1037
|
-
keep:
|
|
1038
|
-
type:
|
|
1039
|
-
value:
|
|
1046
|
+
keep: z4.object({
|
|
1047
|
+
type: z4.literal("tool_uses"),
|
|
1048
|
+
value: z4.number()
|
|
1040
1049
|
}).optional(),
|
|
1041
|
-
clearAtLeast:
|
|
1042
|
-
type:
|
|
1043
|
-
value:
|
|
1050
|
+
clearAtLeast: z4.object({
|
|
1051
|
+
type: z4.literal("input_tokens"),
|
|
1052
|
+
value: z4.number()
|
|
1044
1053
|
}).optional(),
|
|
1045
|
-
clearToolInputs:
|
|
1046
|
-
excludeTools:
|
|
1054
|
+
clearToolInputs: z4.boolean().optional(),
|
|
1055
|
+
excludeTools: z4.array(z4.string()).optional()
|
|
1047
1056
|
}),
|
|
1048
|
-
|
|
1049
|
-
type:
|
|
1050
|
-
keep:
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
type:
|
|
1054
|
-
value:
|
|
1057
|
+
z4.object({
|
|
1058
|
+
type: z4.literal("clear_thinking_20251015"),
|
|
1059
|
+
keep: z4.union([
|
|
1060
|
+
z4.literal("all"),
|
|
1061
|
+
z4.object({
|
|
1062
|
+
type: z4.literal("thinking_turns"),
|
|
1063
|
+
value: z4.number()
|
|
1055
1064
|
})
|
|
1056
1065
|
]).optional()
|
|
1057
1066
|
}),
|
|
1058
|
-
|
|
1059
|
-
type:
|
|
1060
|
-
trigger:
|
|
1061
|
-
type:
|
|
1062
|
-
value:
|
|
1067
|
+
z4.object({
|
|
1068
|
+
type: z4.literal("compact_20260112"),
|
|
1069
|
+
trigger: z4.object({
|
|
1070
|
+
type: z4.literal("input_tokens"),
|
|
1071
|
+
value: z4.number()
|
|
1063
1072
|
}).optional(),
|
|
1064
|
-
pauseAfterCompaction:
|
|
1065
|
-
instructions:
|
|
1073
|
+
pauseAfterCompaction: z4.boolean().optional(),
|
|
1074
|
+
instructions: z4.string().optional()
|
|
1066
1075
|
})
|
|
1067
1076
|
])
|
|
1068
1077
|
)
|
|
@@ -1070,7 +1079,9 @@ var anthropicLanguageModelOptions = import_v44.z.object({
|
|
|
1070
1079
|
});
|
|
1071
1080
|
|
|
1072
1081
|
// src/anthropic-prepare-tools.ts
|
|
1073
|
-
|
|
1082
|
+
import {
|
|
1083
|
+
UnsupportedFunctionalityError
|
|
1084
|
+
} from "@ai-sdk/provider";
|
|
1074
1085
|
|
|
1075
1086
|
// src/get-cache-control.ts
|
|
1076
1087
|
var MAX_CACHE_BREAKPOINTS = 4;
|
|
@@ -1115,31 +1126,31 @@ var CacheControlValidator = class {
|
|
|
1115
1126
|
};
|
|
1116
1127
|
|
|
1117
1128
|
// src/tool/text-editor_20250728.ts
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
var textEditor_20250728ArgsSchema = (
|
|
1122
|
-
() => (
|
|
1123
|
-
|
|
1124
|
-
maxCharacters:
|
|
1129
|
+
import { createProviderToolFactory } from "@ai-sdk/provider-utils";
|
|
1130
|
+
import { z as z5 } from "zod/v4";
|
|
1131
|
+
import { lazySchema as lazySchema4, zodSchema as zodSchema4 } from "@ai-sdk/provider-utils";
|
|
1132
|
+
var textEditor_20250728ArgsSchema = lazySchema4(
|
|
1133
|
+
() => zodSchema4(
|
|
1134
|
+
z5.object({
|
|
1135
|
+
maxCharacters: z5.number().optional()
|
|
1125
1136
|
})
|
|
1126
1137
|
)
|
|
1127
1138
|
);
|
|
1128
|
-
var textEditor_20250728InputSchema = (
|
|
1129
|
-
() => (
|
|
1130
|
-
|
|
1131
|
-
command:
|
|
1132
|
-
path:
|
|
1133
|
-
file_text:
|
|
1134
|
-
insert_line:
|
|
1135
|
-
new_str:
|
|
1136
|
-
insert_text:
|
|
1137
|
-
old_str:
|
|
1138
|
-
view_range:
|
|
1139
|
+
var textEditor_20250728InputSchema = lazySchema4(
|
|
1140
|
+
() => zodSchema4(
|
|
1141
|
+
z5.object({
|
|
1142
|
+
command: z5.enum(["view", "create", "str_replace", "insert"]),
|
|
1143
|
+
path: z5.string(),
|
|
1144
|
+
file_text: z5.string().optional(),
|
|
1145
|
+
insert_line: z5.number().int().optional(),
|
|
1146
|
+
new_str: z5.string().optional(),
|
|
1147
|
+
insert_text: z5.string().optional(),
|
|
1148
|
+
old_str: z5.string().optional(),
|
|
1149
|
+
view_range: z5.array(z5.number().int()).optional()
|
|
1139
1150
|
})
|
|
1140
1151
|
)
|
|
1141
1152
|
);
|
|
1142
|
-
var factory =
|
|
1153
|
+
var factory = createProviderToolFactory({
|
|
1143
1154
|
id: "anthropic.text_editor_20250728",
|
|
1144
1155
|
inputSchema: textEditor_20250728InputSchema
|
|
1145
1156
|
});
|
|
@@ -1148,45 +1159,49 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1148
1159
|
};
|
|
1149
1160
|
|
|
1150
1161
|
// src/tool/web-search_20260209.ts
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1162
|
+
import {
|
|
1163
|
+
createProviderToolFactoryWithOutputSchema,
|
|
1164
|
+
lazySchema as lazySchema5,
|
|
1165
|
+
zodSchema as zodSchema5
|
|
1166
|
+
} from "@ai-sdk/provider-utils";
|
|
1167
|
+
import { z as z6 } from "zod/v4";
|
|
1168
|
+
var webSearch_20260209ArgsSchema = lazySchema5(
|
|
1169
|
+
() => zodSchema5(
|
|
1170
|
+
z6.object({
|
|
1171
|
+
maxUses: z6.number().optional(),
|
|
1172
|
+
allowedDomains: z6.array(z6.string()).optional(),
|
|
1173
|
+
blockedDomains: z6.array(z6.string()).optional(),
|
|
1174
|
+
userLocation: z6.object({
|
|
1175
|
+
type: z6.literal("approximate"),
|
|
1176
|
+
city: z6.string().optional(),
|
|
1177
|
+
region: z6.string().optional(),
|
|
1178
|
+
country: z6.string().optional(),
|
|
1179
|
+
timezone: z6.string().optional()
|
|
1165
1180
|
}).optional()
|
|
1166
1181
|
})
|
|
1167
1182
|
)
|
|
1168
1183
|
);
|
|
1169
|
-
var webSearch_20260209OutputSchema = (
|
|
1170
|
-
() => (
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
url:
|
|
1174
|
-
title:
|
|
1175
|
-
pageAge:
|
|
1176
|
-
encryptedContent:
|
|
1177
|
-
type:
|
|
1184
|
+
var webSearch_20260209OutputSchema = lazySchema5(
|
|
1185
|
+
() => zodSchema5(
|
|
1186
|
+
z6.array(
|
|
1187
|
+
z6.object({
|
|
1188
|
+
url: z6.string(),
|
|
1189
|
+
title: z6.string().nullable(),
|
|
1190
|
+
pageAge: z6.string().nullable(),
|
|
1191
|
+
encryptedContent: z6.string(),
|
|
1192
|
+
type: z6.literal("web_search_result")
|
|
1178
1193
|
})
|
|
1179
1194
|
)
|
|
1180
1195
|
)
|
|
1181
1196
|
);
|
|
1182
|
-
var webSearch_20260209InputSchema = (
|
|
1183
|
-
() => (
|
|
1184
|
-
|
|
1185
|
-
query:
|
|
1197
|
+
var webSearch_20260209InputSchema = lazySchema5(
|
|
1198
|
+
() => zodSchema5(
|
|
1199
|
+
z6.object({
|
|
1200
|
+
query: z6.string()
|
|
1186
1201
|
})
|
|
1187
1202
|
)
|
|
1188
1203
|
);
|
|
1189
|
-
var factory2 =
|
|
1204
|
+
var factory2 = createProviderToolFactoryWithOutputSchema({
|
|
1190
1205
|
id: "anthropic.web_search_20260209",
|
|
1191
1206
|
inputSchema: webSearch_20260209InputSchema,
|
|
1192
1207
|
outputSchema: webSearch_20260209OutputSchema,
|
|
@@ -1197,45 +1212,49 @@ var webSearch_20260209 = (args = {}) => {
|
|
|
1197
1212
|
};
|
|
1198
1213
|
|
|
1199
1214
|
// src/tool/web-search_20250305.ts
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1215
|
+
import {
|
|
1216
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1217
|
+
lazySchema as lazySchema6,
|
|
1218
|
+
zodSchema as zodSchema6
|
|
1219
|
+
} from "@ai-sdk/provider-utils";
|
|
1220
|
+
import { z as z7 } from "zod/v4";
|
|
1221
|
+
var webSearch_20250305ArgsSchema = lazySchema6(
|
|
1222
|
+
() => zodSchema6(
|
|
1223
|
+
z7.object({
|
|
1224
|
+
maxUses: z7.number().optional(),
|
|
1225
|
+
allowedDomains: z7.array(z7.string()).optional(),
|
|
1226
|
+
blockedDomains: z7.array(z7.string()).optional(),
|
|
1227
|
+
userLocation: z7.object({
|
|
1228
|
+
type: z7.literal("approximate"),
|
|
1229
|
+
city: z7.string().optional(),
|
|
1230
|
+
region: z7.string().optional(),
|
|
1231
|
+
country: z7.string().optional(),
|
|
1232
|
+
timezone: z7.string().optional()
|
|
1214
1233
|
}).optional()
|
|
1215
1234
|
})
|
|
1216
1235
|
)
|
|
1217
1236
|
);
|
|
1218
|
-
var webSearch_20250305OutputSchema = (
|
|
1219
|
-
() => (
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
url:
|
|
1223
|
-
title:
|
|
1224
|
-
pageAge:
|
|
1225
|
-
encryptedContent:
|
|
1226
|
-
type:
|
|
1237
|
+
var webSearch_20250305OutputSchema = lazySchema6(
|
|
1238
|
+
() => zodSchema6(
|
|
1239
|
+
z7.array(
|
|
1240
|
+
z7.object({
|
|
1241
|
+
url: z7.string(),
|
|
1242
|
+
title: z7.string().nullable(),
|
|
1243
|
+
pageAge: z7.string().nullable(),
|
|
1244
|
+
encryptedContent: z7.string(),
|
|
1245
|
+
type: z7.literal("web_search_result")
|
|
1227
1246
|
})
|
|
1228
1247
|
)
|
|
1229
1248
|
)
|
|
1230
1249
|
);
|
|
1231
|
-
var webSearch_20250305InputSchema = (
|
|
1232
|
-
() => (
|
|
1233
|
-
|
|
1234
|
-
query:
|
|
1250
|
+
var webSearch_20250305InputSchema = lazySchema6(
|
|
1251
|
+
() => zodSchema6(
|
|
1252
|
+
z7.object({
|
|
1253
|
+
query: z7.string()
|
|
1235
1254
|
})
|
|
1236
1255
|
)
|
|
1237
1256
|
);
|
|
1238
|
-
var factory3 = (
|
|
1257
|
+
var factory3 = createProviderToolFactoryWithOutputSchema2({
|
|
1239
1258
|
id: "anthropic.web_search_20250305",
|
|
1240
1259
|
inputSchema: webSearch_20250305InputSchema,
|
|
1241
1260
|
outputSchema: webSearch_20250305OutputSchema,
|
|
@@ -1246,53 +1265,57 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1246
1265
|
};
|
|
1247
1266
|
|
|
1248
1267
|
// src/tool/web-fetch-20260209.ts
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1268
|
+
import {
|
|
1269
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1270
|
+
lazySchema as lazySchema7,
|
|
1271
|
+
zodSchema as zodSchema7
|
|
1272
|
+
} from "@ai-sdk/provider-utils";
|
|
1273
|
+
import { z as z8 } from "zod/v4";
|
|
1274
|
+
var webFetch_20260209ArgsSchema = lazySchema7(
|
|
1275
|
+
() => zodSchema7(
|
|
1276
|
+
z8.object({
|
|
1277
|
+
maxUses: z8.number().optional(),
|
|
1278
|
+
allowedDomains: z8.array(z8.string()).optional(),
|
|
1279
|
+
blockedDomains: z8.array(z8.string()).optional(),
|
|
1280
|
+
citations: z8.object({ enabled: z8.boolean() }).optional(),
|
|
1281
|
+
maxContentTokens: z8.number().optional()
|
|
1259
1282
|
})
|
|
1260
1283
|
)
|
|
1261
1284
|
);
|
|
1262
|
-
var webFetch_20260209OutputSchema = (
|
|
1263
|
-
() => (
|
|
1264
|
-
|
|
1265
|
-
type:
|
|
1266
|
-
url:
|
|
1267
|
-
content:
|
|
1268
|
-
type:
|
|
1269
|
-
title:
|
|
1270
|
-
citations:
|
|
1271
|
-
source:
|
|
1272
|
-
|
|
1273
|
-
type:
|
|
1274
|
-
mediaType:
|
|
1275
|
-
data:
|
|
1285
|
+
var webFetch_20260209OutputSchema = lazySchema7(
|
|
1286
|
+
() => zodSchema7(
|
|
1287
|
+
z8.object({
|
|
1288
|
+
type: z8.literal("web_fetch_result"),
|
|
1289
|
+
url: z8.string(),
|
|
1290
|
+
content: z8.object({
|
|
1291
|
+
type: z8.literal("document"),
|
|
1292
|
+
title: z8.string().nullable(),
|
|
1293
|
+
citations: z8.object({ enabled: z8.boolean() }).optional(),
|
|
1294
|
+
source: z8.union([
|
|
1295
|
+
z8.object({
|
|
1296
|
+
type: z8.literal("base64"),
|
|
1297
|
+
mediaType: z8.literal("application/pdf"),
|
|
1298
|
+
data: z8.string()
|
|
1276
1299
|
}),
|
|
1277
|
-
|
|
1278
|
-
type:
|
|
1279
|
-
mediaType:
|
|
1280
|
-
data:
|
|
1300
|
+
z8.object({
|
|
1301
|
+
type: z8.literal("text"),
|
|
1302
|
+
mediaType: z8.literal("text/plain"),
|
|
1303
|
+
data: z8.string()
|
|
1281
1304
|
})
|
|
1282
1305
|
])
|
|
1283
1306
|
}),
|
|
1284
|
-
retrievedAt:
|
|
1307
|
+
retrievedAt: z8.string().nullable()
|
|
1285
1308
|
})
|
|
1286
1309
|
)
|
|
1287
1310
|
);
|
|
1288
|
-
var webFetch_20260209InputSchema = (
|
|
1289
|
-
() => (
|
|
1290
|
-
|
|
1291
|
-
url:
|
|
1311
|
+
var webFetch_20260209InputSchema = lazySchema7(
|
|
1312
|
+
() => zodSchema7(
|
|
1313
|
+
z8.object({
|
|
1314
|
+
url: z8.string()
|
|
1292
1315
|
})
|
|
1293
1316
|
)
|
|
1294
1317
|
);
|
|
1295
|
-
var factory4 = (
|
|
1318
|
+
var factory4 = createProviderToolFactoryWithOutputSchema3({
|
|
1296
1319
|
id: "anthropic.web_fetch_20260209",
|
|
1297
1320
|
inputSchema: webFetch_20260209InputSchema,
|
|
1298
1321
|
outputSchema: webFetch_20260209OutputSchema,
|
|
@@ -1303,53 +1326,57 @@ var webFetch_20260209 = (args = {}) => {
|
|
|
1303
1326
|
};
|
|
1304
1327
|
|
|
1305
1328
|
// src/tool/web-fetch-20250910.ts
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1329
|
+
import {
|
|
1330
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1331
|
+
lazySchema as lazySchema8,
|
|
1332
|
+
zodSchema as zodSchema8
|
|
1333
|
+
} from "@ai-sdk/provider-utils";
|
|
1334
|
+
import { z as z9 } from "zod/v4";
|
|
1335
|
+
var webFetch_20250910ArgsSchema = lazySchema8(
|
|
1336
|
+
() => zodSchema8(
|
|
1337
|
+
z9.object({
|
|
1338
|
+
maxUses: z9.number().optional(),
|
|
1339
|
+
allowedDomains: z9.array(z9.string()).optional(),
|
|
1340
|
+
blockedDomains: z9.array(z9.string()).optional(),
|
|
1341
|
+
citations: z9.object({ enabled: z9.boolean() }).optional(),
|
|
1342
|
+
maxContentTokens: z9.number().optional()
|
|
1316
1343
|
})
|
|
1317
1344
|
)
|
|
1318
1345
|
);
|
|
1319
|
-
var webFetch_20250910OutputSchema = (
|
|
1320
|
-
() => (
|
|
1321
|
-
|
|
1322
|
-
type:
|
|
1323
|
-
url:
|
|
1324
|
-
content:
|
|
1325
|
-
type:
|
|
1326
|
-
title:
|
|
1327
|
-
citations:
|
|
1328
|
-
source:
|
|
1329
|
-
|
|
1330
|
-
type:
|
|
1331
|
-
mediaType:
|
|
1332
|
-
data:
|
|
1346
|
+
var webFetch_20250910OutputSchema = lazySchema8(
|
|
1347
|
+
() => zodSchema8(
|
|
1348
|
+
z9.object({
|
|
1349
|
+
type: z9.literal("web_fetch_result"),
|
|
1350
|
+
url: z9.string(),
|
|
1351
|
+
content: z9.object({
|
|
1352
|
+
type: z9.literal("document"),
|
|
1353
|
+
title: z9.string().nullable(),
|
|
1354
|
+
citations: z9.object({ enabled: z9.boolean() }).optional(),
|
|
1355
|
+
source: z9.union([
|
|
1356
|
+
z9.object({
|
|
1357
|
+
type: z9.literal("base64"),
|
|
1358
|
+
mediaType: z9.literal("application/pdf"),
|
|
1359
|
+
data: z9.string()
|
|
1333
1360
|
}),
|
|
1334
|
-
|
|
1335
|
-
type:
|
|
1336
|
-
mediaType:
|
|
1337
|
-
data:
|
|
1361
|
+
z9.object({
|
|
1362
|
+
type: z9.literal("text"),
|
|
1363
|
+
mediaType: z9.literal("text/plain"),
|
|
1364
|
+
data: z9.string()
|
|
1338
1365
|
})
|
|
1339
1366
|
])
|
|
1340
1367
|
}),
|
|
1341
|
-
retrievedAt:
|
|
1368
|
+
retrievedAt: z9.string().nullable()
|
|
1342
1369
|
})
|
|
1343
1370
|
)
|
|
1344
1371
|
);
|
|
1345
|
-
var webFetch_20250910InputSchema = (
|
|
1346
|
-
() => (
|
|
1347
|
-
|
|
1348
|
-
url:
|
|
1372
|
+
var webFetch_20250910InputSchema = lazySchema8(
|
|
1373
|
+
() => zodSchema8(
|
|
1374
|
+
z9.object({
|
|
1375
|
+
url: z9.string()
|
|
1349
1376
|
})
|
|
1350
1377
|
)
|
|
1351
1378
|
);
|
|
1352
|
-
var factory5 = (
|
|
1379
|
+
var factory5 = createProviderToolFactoryWithOutputSchema4({
|
|
1353
1380
|
id: "anthropic.web_fetch_20250910",
|
|
1354
1381
|
inputSchema: webFetch_20250910InputSchema,
|
|
1355
1382
|
outputSchema: webFetch_20250910OutputSchema,
|
|
@@ -1360,7 +1387,7 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1360
1387
|
};
|
|
1361
1388
|
|
|
1362
1389
|
// src/anthropic-prepare-tools.ts
|
|
1363
|
-
|
|
1390
|
+
import { validateTypes } from "@ai-sdk/provider-utils";
|
|
1364
1391
|
async function prepareTools({
|
|
1365
1392
|
tools,
|
|
1366
1393
|
toolChoice,
|
|
@@ -1510,7 +1537,7 @@ async function prepareTools({
|
|
|
1510
1537
|
break;
|
|
1511
1538
|
}
|
|
1512
1539
|
case "anthropic.text_editor_20250728": {
|
|
1513
|
-
const args = await
|
|
1540
|
+
const args = await validateTypes({
|
|
1514
1541
|
value: tool.args,
|
|
1515
1542
|
schema: textEditor_20250728ArgsSchema
|
|
1516
1543
|
});
|
|
@@ -1550,7 +1577,7 @@ async function prepareTools({
|
|
|
1550
1577
|
}
|
|
1551
1578
|
case "anthropic.web_fetch_20250910": {
|
|
1552
1579
|
betas.add("web-fetch-2025-09-10");
|
|
1553
|
-
const args = await
|
|
1580
|
+
const args = await validateTypes({
|
|
1554
1581
|
value: tool.args,
|
|
1555
1582
|
schema: webFetch_20250910ArgsSchema
|
|
1556
1583
|
});
|
|
@@ -1568,7 +1595,7 @@ async function prepareTools({
|
|
|
1568
1595
|
}
|
|
1569
1596
|
case "anthropic.web_fetch_20260209": {
|
|
1570
1597
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1571
|
-
const args = await
|
|
1598
|
+
const args = await validateTypes({
|
|
1572
1599
|
value: tool.args,
|
|
1573
1600
|
schema: webFetch_20260209ArgsSchema
|
|
1574
1601
|
});
|
|
@@ -1585,7 +1612,7 @@ async function prepareTools({
|
|
|
1585
1612
|
break;
|
|
1586
1613
|
}
|
|
1587
1614
|
case "anthropic.web_search_20250305": {
|
|
1588
|
-
const args = await
|
|
1615
|
+
const args = await validateTypes({
|
|
1589
1616
|
value: tool.args,
|
|
1590
1617
|
schema: webSearch_20250305ArgsSchema
|
|
1591
1618
|
});
|
|
@@ -1602,7 +1629,7 @@ async function prepareTools({
|
|
|
1602
1629
|
}
|
|
1603
1630
|
case "anthropic.web_search_20260209": {
|
|
1604
1631
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1605
|
-
const args = await
|
|
1632
|
+
const args = await validateTypes({
|
|
1606
1633
|
value: tool.args,
|
|
1607
1634
|
schema: webSearch_20260209ArgsSchema
|
|
1608
1635
|
});
|
|
@@ -1695,7 +1722,7 @@ async function prepareTools({
|
|
|
1695
1722
|
};
|
|
1696
1723
|
default: {
|
|
1697
1724
|
const _exhaustiveCheck = type;
|
|
1698
|
-
throw new
|
|
1725
|
+
throw new UnsupportedFunctionalityError({
|
|
1699
1726
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
1700
1727
|
});
|
|
1701
1728
|
}
|
|
@@ -1743,36 +1770,50 @@ function convertAnthropicMessagesUsage({
|
|
|
1743
1770
|
}
|
|
1744
1771
|
|
|
1745
1772
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1746
|
-
|
|
1747
|
-
|
|
1773
|
+
import {
|
|
1774
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
1775
|
+
} from "@ai-sdk/provider";
|
|
1776
|
+
import {
|
|
1777
|
+
convertBase64ToUint8Array as convertBase64ToUint8Array2,
|
|
1778
|
+
convertToBase64,
|
|
1779
|
+
isProviderReference,
|
|
1780
|
+
parseProviderOptions,
|
|
1781
|
+
resolveProviderReference,
|
|
1782
|
+
validateTypes as validateTypes2,
|
|
1783
|
+
isNonNullable
|
|
1784
|
+
} from "@ai-sdk/provider-utils";
|
|
1748
1785
|
|
|
1749
1786
|
// src/tool/code-execution_20250522.ts
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1787
|
+
import {
|
|
1788
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1789
|
+
lazySchema as lazySchema9,
|
|
1790
|
+
zodSchema as zodSchema9
|
|
1791
|
+
} from "@ai-sdk/provider-utils";
|
|
1792
|
+
import { z as z10 } from "zod/v4";
|
|
1793
|
+
var codeExecution_20250522OutputSchema = lazySchema9(
|
|
1794
|
+
() => zodSchema9(
|
|
1795
|
+
z10.object({
|
|
1796
|
+
type: z10.literal("code_execution_result"),
|
|
1797
|
+
stdout: z10.string(),
|
|
1798
|
+
stderr: z10.string(),
|
|
1799
|
+
return_code: z10.number(),
|
|
1800
|
+
content: z10.array(
|
|
1801
|
+
z10.object({
|
|
1802
|
+
type: z10.literal("code_execution_output"),
|
|
1803
|
+
file_id: z10.string()
|
|
1763
1804
|
})
|
|
1764
1805
|
).optional().default([])
|
|
1765
1806
|
})
|
|
1766
1807
|
)
|
|
1767
1808
|
);
|
|
1768
|
-
var codeExecution_20250522InputSchema = (
|
|
1769
|
-
() => (
|
|
1770
|
-
|
|
1771
|
-
code:
|
|
1809
|
+
var codeExecution_20250522InputSchema = lazySchema9(
|
|
1810
|
+
() => zodSchema9(
|
|
1811
|
+
z10.object({
|
|
1812
|
+
code: z10.string()
|
|
1772
1813
|
})
|
|
1773
1814
|
)
|
|
1774
1815
|
);
|
|
1775
|
-
var factory6 = (
|
|
1816
|
+
var factory6 = createProviderToolFactoryWithOutputSchema5({
|
|
1776
1817
|
id: "anthropic.code_execution_20250522",
|
|
1777
1818
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1778
1819
|
outputSchema: codeExecution_20250522OutputSchema
|
|
@@ -1782,102 +1823,106 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1782
1823
|
};
|
|
1783
1824
|
|
|
1784
1825
|
// src/tool/code-execution_20250825.ts
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1826
|
+
import {
|
|
1827
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
1828
|
+
lazySchema as lazySchema10,
|
|
1829
|
+
zodSchema as zodSchema10
|
|
1830
|
+
} from "@ai-sdk/provider-utils";
|
|
1831
|
+
import { z as z11 } from "zod/v4";
|
|
1832
|
+
var codeExecution_20250825OutputSchema = lazySchema10(
|
|
1833
|
+
() => zodSchema10(
|
|
1834
|
+
z11.discriminatedUnion("type", [
|
|
1835
|
+
z11.object({
|
|
1836
|
+
type: z11.literal("code_execution_result"),
|
|
1837
|
+
stdout: z11.string(),
|
|
1838
|
+
stderr: z11.string(),
|
|
1839
|
+
return_code: z11.number(),
|
|
1840
|
+
content: z11.array(
|
|
1841
|
+
z11.object({
|
|
1842
|
+
type: z11.literal("code_execution_output"),
|
|
1843
|
+
file_id: z11.string()
|
|
1799
1844
|
})
|
|
1800
1845
|
).optional().default([])
|
|
1801
1846
|
}),
|
|
1802
|
-
|
|
1803
|
-
type:
|
|
1804
|
-
content:
|
|
1805
|
-
|
|
1806
|
-
type:
|
|
1807
|
-
file_id:
|
|
1847
|
+
z11.object({
|
|
1848
|
+
type: z11.literal("bash_code_execution_result"),
|
|
1849
|
+
content: z11.array(
|
|
1850
|
+
z11.object({
|
|
1851
|
+
type: z11.literal("bash_code_execution_output"),
|
|
1852
|
+
file_id: z11.string()
|
|
1808
1853
|
})
|
|
1809
1854
|
),
|
|
1810
|
-
stdout:
|
|
1811
|
-
stderr:
|
|
1812
|
-
return_code:
|
|
1855
|
+
stdout: z11.string(),
|
|
1856
|
+
stderr: z11.string(),
|
|
1857
|
+
return_code: z11.number()
|
|
1813
1858
|
}),
|
|
1814
|
-
|
|
1815
|
-
type:
|
|
1816
|
-
error_code:
|
|
1859
|
+
z11.object({
|
|
1860
|
+
type: z11.literal("bash_code_execution_tool_result_error"),
|
|
1861
|
+
error_code: z11.string()
|
|
1817
1862
|
}),
|
|
1818
|
-
|
|
1819
|
-
type:
|
|
1820
|
-
error_code:
|
|
1863
|
+
z11.object({
|
|
1864
|
+
type: z11.literal("text_editor_code_execution_tool_result_error"),
|
|
1865
|
+
error_code: z11.string()
|
|
1821
1866
|
}),
|
|
1822
|
-
|
|
1823
|
-
type:
|
|
1824
|
-
content:
|
|
1825
|
-
file_type:
|
|
1826
|
-
num_lines:
|
|
1827
|
-
start_line:
|
|
1828
|
-
total_lines:
|
|
1867
|
+
z11.object({
|
|
1868
|
+
type: z11.literal("text_editor_code_execution_view_result"),
|
|
1869
|
+
content: z11.string(),
|
|
1870
|
+
file_type: z11.string(),
|
|
1871
|
+
num_lines: z11.number().nullable(),
|
|
1872
|
+
start_line: z11.number().nullable(),
|
|
1873
|
+
total_lines: z11.number().nullable()
|
|
1829
1874
|
}),
|
|
1830
|
-
|
|
1831
|
-
type:
|
|
1832
|
-
is_file_update:
|
|
1875
|
+
z11.object({
|
|
1876
|
+
type: z11.literal("text_editor_code_execution_create_result"),
|
|
1877
|
+
is_file_update: z11.boolean()
|
|
1833
1878
|
}),
|
|
1834
|
-
|
|
1835
|
-
type:
|
|
1836
|
-
lines:
|
|
1837
|
-
new_lines:
|
|
1838
|
-
new_start:
|
|
1839
|
-
old_lines:
|
|
1840
|
-
old_start:
|
|
1879
|
+
z11.object({
|
|
1880
|
+
type: z11.literal("text_editor_code_execution_str_replace_result"),
|
|
1881
|
+
lines: z11.array(z11.string()).nullable(),
|
|
1882
|
+
new_lines: z11.number().nullable(),
|
|
1883
|
+
new_start: z11.number().nullable(),
|
|
1884
|
+
old_lines: z11.number().nullable(),
|
|
1885
|
+
old_start: z11.number().nullable()
|
|
1841
1886
|
})
|
|
1842
1887
|
])
|
|
1843
1888
|
)
|
|
1844
1889
|
);
|
|
1845
|
-
var codeExecution_20250825InputSchema = (
|
|
1846
|
-
() => (
|
|
1847
|
-
|
|
1890
|
+
var codeExecution_20250825InputSchema = lazySchema10(
|
|
1891
|
+
() => zodSchema10(
|
|
1892
|
+
z11.discriminatedUnion("type", [
|
|
1848
1893
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1849
|
-
|
|
1850
|
-
type:
|
|
1851
|
-
code:
|
|
1894
|
+
z11.object({
|
|
1895
|
+
type: z11.literal("programmatic-tool-call"),
|
|
1896
|
+
code: z11.string()
|
|
1852
1897
|
}),
|
|
1853
|
-
|
|
1854
|
-
type:
|
|
1855
|
-
command:
|
|
1898
|
+
z11.object({
|
|
1899
|
+
type: z11.literal("bash_code_execution"),
|
|
1900
|
+
command: z11.string()
|
|
1856
1901
|
}),
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
type:
|
|
1860
|
-
command:
|
|
1861
|
-
path:
|
|
1902
|
+
z11.discriminatedUnion("command", [
|
|
1903
|
+
z11.object({
|
|
1904
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1905
|
+
command: z11.literal("view"),
|
|
1906
|
+
path: z11.string()
|
|
1862
1907
|
}),
|
|
1863
|
-
|
|
1864
|
-
type:
|
|
1865
|
-
command:
|
|
1866
|
-
path:
|
|
1867
|
-
file_text:
|
|
1908
|
+
z11.object({
|
|
1909
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1910
|
+
command: z11.literal("create"),
|
|
1911
|
+
path: z11.string(),
|
|
1912
|
+
file_text: z11.string().nullish()
|
|
1868
1913
|
}),
|
|
1869
|
-
|
|
1870
|
-
type:
|
|
1871
|
-
command:
|
|
1872
|
-
path:
|
|
1873
|
-
old_str:
|
|
1874
|
-
new_str:
|
|
1914
|
+
z11.object({
|
|
1915
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1916
|
+
command: z11.literal("str_replace"),
|
|
1917
|
+
path: z11.string(),
|
|
1918
|
+
old_str: z11.string(),
|
|
1919
|
+
new_str: z11.string()
|
|
1875
1920
|
})
|
|
1876
1921
|
])
|
|
1877
1922
|
])
|
|
1878
1923
|
)
|
|
1879
1924
|
);
|
|
1880
|
-
var factory7 = (
|
|
1925
|
+
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
1881
1926
|
id: "anthropic.code_execution_20250825",
|
|
1882
1927
|
inputSchema: codeExecution_20250825InputSchema,
|
|
1883
1928
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -1891,113 +1936,117 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
1891
1936
|
};
|
|
1892
1937
|
|
|
1893
1938
|
// src/tool/code-execution_20260120.ts
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1939
|
+
import {
|
|
1940
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
1941
|
+
lazySchema as lazySchema11,
|
|
1942
|
+
zodSchema as zodSchema11
|
|
1943
|
+
} from "@ai-sdk/provider-utils";
|
|
1944
|
+
import { z as z12 } from "zod/v4";
|
|
1945
|
+
var codeExecution_20260120OutputSchema = lazySchema11(
|
|
1946
|
+
() => zodSchema11(
|
|
1947
|
+
z12.discriminatedUnion("type", [
|
|
1948
|
+
z12.object({
|
|
1949
|
+
type: z12.literal("code_execution_result"),
|
|
1950
|
+
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()
|
|
1908
1957
|
})
|
|
1909
1958
|
).optional().default([])
|
|
1910
1959
|
}),
|
|
1911
|
-
|
|
1912
|
-
type:
|
|
1913
|
-
encrypted_stdout:
|
|
1914
|
-
stderr:
|
|
1915
|
-
return_code:
|
|
1916
|
-
content:
|
|
1917
|
-
|
|
1918
|
-
type:
|
|
1919
|
-
file_id:
|
|
1960
|
+
z12.object({
|
|
1961
|
+
type: z12.literal("encrypted_code_execution_result"),
|
|
1962
|
+
encrypted_stdout: z12.string(),
|
|
1963
|
+
stderr: z12.string(),
|
|
1964
|
+
return_code: z12.number(),
|
|
1965
|
+
content: z12.array(
|
|
1966
|
+
z12.object({
|
|
1967
|
+
type: z12.literal("code_execution_output"),
|
|
1968
|
+
file_id: z12.string()
|
|
1920
1969
|
})
|
|
1921
1970
|
).optional().default([])
|
|
1922
1971
|
}),
|
|
1923
|
-
|
|
1924
|
-
type:
|
|
1925
|
-
content:
|
|
1926
|
-
|
|
1927
|
-
type:
|
|
1928
|
-
file_id:
|
|
1972
|
+
z12.object({
|
|
1973
|
+
type: z12.literal("bash_code_execution_result"),
|
|
1974
|
+
content: z12.array(
|
|
1975
|
+
z12.object({
|
|
1976
|
+
type: z12.literal("bash_code_execution_output"),
|
|
1977
|
+
file_id: z12.string()
|
|
1929
1978
|
})
|
|
1930
1979
|
),
|
|
1931
|
-
stdout:
|
|
1932
|
-
stderr:
|
|
1933
|
-
return_code:
|
|
1980
|
+
stdout: z12.string(),
|
|
1981
|
+
stderr: z12.string(),
|
|
1982
|
+
return_code: z12.number()
|
|
1934
1983
|
}),
|
|
1935
|
-
|
|
1936
|
-
type:
|
|
1937
|
-
error_code:
|
|
1984
|
+
z12.object({
|
|
1985
|
+
type: z12.literal("bash_code_execution_tool_result_error"),
|
|
1986
|
+
error_code: z12.string()
|
|
1938
1987
|
}),
|
|
1939
|
-
|
|
1940
|
-
type:
|
|
1941
|
-
error_code:
|
|
1988
|
+
z12.object({
|
|
1989
|
+
type: z12.literal("text_editor_code_execution_tool_result_error"),
|
|
1990
|
+
error_code: z12.string()
|
|
1942
1991
|
}),
|
|
1943
|
-
|
|
1944
|
-
type:
|
|
1945
|
-
content:
|
|
1946
|
-
file_type:
|
|
1947
|
-
num_lines:
|
|
1948
|
-
start_line:
|
|
1949
|
-
total_lines:
|
|
1992
|
+
z12.object({
|
|
1993
|
+
type: z12.literal("text_editor_code_execution_view_result"),
|
|
1994
|
+
content: z12.string(),
|
|
1995
|
+
file_type: z12.string(),
|
|
1996
|
+
num_lines: z12.number().nullable(),
|
|
1997
|
+
start_line: z12.number().nullable(),
|
|
1998
|
+
total_lines: z12.number().nullable()
|
|
1950
1999
|
}),
|
|
1951
|
-
|
|
1952
|
-
type:
|
|
1953
|
-
is_file_update:
|
|
2000
|
+
z12.object({
|
|
2001
|
+
type: z12.literal("text_editor_code_execution_create_result"),
|
|
2002
|
+
is_file_update: z12.boolean()
|
|
1954
2003
|
}),
|
|
1955
|
-
|
|
1956
|
-
type:
|
|
1957
|
-
lines:
|
|
1958
|
-
new_lines:
|
|
1959
|
-
new_start:
|
|
1960
|
-
old_lines:
|
|
1961
|
-
old_start:
|
|
2004
|
+
z12.object({
|
|
2005
|
+
type: z12.literal("text_editor_code_execution_str_replace_result"),
|
|
2006
|
+
lines: z12.array(z12.string()).nullable(),
|
|
2007
|
+
new_lines: z12.number().nullable(),
|
|
2008
|
+
new_start: z12.number().nullable(),
|
|
2009
|
+
old_lines: z12.number().nullable(),
|
|
2010
|
+
old_start: z12.number().nullable()
|
|
1962
2011
|
})
|
|
1963
2012
|
])
|
|
1964
2013
|
)
|
|
1965
2014
|
);
|
|
1966
|
-
var codeExecution_20260120InputSchema = (
|
|
1967
|
-
() => (
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
type:
|
|
1971
|
-
code:
|
|
2015
|
+
var codeExecution_20260120InputSchema = lazySchema11(
|
|
2016
|
+
() => zodSchema11(
|
|
2017
|
+
z12.discriminatedUnion("type", [
|
|
2018
|
+
z12.object({
|
|
2019
|
+
type: z12.literal("programmatic-tool-call"),
|
|
2020
|
+
code: z12.string()
|
|
1972
2021
|
}),
|
|
1973
|
-
|
|
1974
|
-
type:
|
|
1975
|
-
command:
|
|
2022
|
+
z12.object({
|
|
2023
|
+
type: z12.literal("bash_code_execution"),
|
|
2024
|
+
command: z12.string()
|
|
1976
2025
|
}),
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
type:
|
|
1980
|
-
command:
|
|
1981
|
-
path:
|
|
2026
|
+
z12.discriminatedUnion("command", [
|
|
2027
|
+
z12.object({
|
|
2028
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2029
|
+
command: z12.literal("view"),
|
|
2030
|
+
path: z12.string()
|
|
1982
2031
|
}),
|
|
1983
|
-
|
|
1984
|
-
type:
|
|
1985
|
-
command:
|
|
1986
|
-
path:
|
|
1987
|
-
file_text:
|
|
2032
|
+
z12.object({
|
|
2033
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2034
|
+
command: z12.literal("create"),
|
|
2035
|
+
path: z12.string(),
|
|
2036
|
+
file_text: z12.string().nullish()
|
|
1988
2037
|
}),
|
|
1989
|
-
|
|
1990
|
-
type:
|
|
1991
|
-
command:
|
|
1992
|
-
path:
|
|
1993
|
-
old_str:
|
|
1994
|
-
new_str:
|
|
2038
|
+
z12.object({
|
|
2039
|
+
type: z12.literal("text_editor_code_execution"),
|
|
2040
|
+
command: z12.literal("str_replace"),
|
|
2041
|
+
path: z12.string(),
|
|
2042
|
+
old_str: z12.string(),
|
|
2043
|
+
new_str: z12.string()
|
|
1995
2044
|
})
|
|
1996
2045
|
])
|
|
1997
2046
|
])
|
|
1998
2047
|
)
|
|
1999
2048
|
);
|
|
2000
|
-
var factory8 = (
|
|
2049
|
+
var factory8 = createProviderToolFactoryWithOutputSchema7({
|
|
2001
2050
|
id: "anthropic.code_execution_20260120",
|
|
2002
2051
|
inputSchema: codeExecution_20260120InputSchema,
|
|
2003
2052
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
@@ -2008,21 +2057,25 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
2008
2057
|
};
|
|
2009
2058
|
|
|
2010
2059
|
// src/tool/tool-search-regex_20251119.ts
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2060
|
+
import {
|
|
2061
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
2062
|
+
lazySchema as lazySchema12,
|
|
2063
|
+
zodSchema as zodSchema12
|
|
2064
|
+
} from "@ai-sdk/provider-utils";
|
|
2065
|
+
import { z as z13 } from "zod/v4";
|
|
2066
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema12(
|
|
2067
|
+
() => zodSchema12(
|
|
2068
|
+
z13.array(
|
|
2069
|
+
z13.object({
|
|
2070
|
+
type: z13.literal("tool_reference"),
|
|
2071
|
+
toolName: z13.string()
|
|
2019
2072
|
})
|
|
2020
2073
|
)
|
|
2021
2074
|
)
|
|
2022
2075
|
);
|
|
2023
|
-
var toolSearchRegex_20251119InputSchema = (
|
|
2024
|
-
() => (
|
|
2025
|
-
|
|
2076
|
+
var toolSearchRegex_20251119InputSchema = lazySchema12(
|
|
2077
|
+
() => zodSchema12(
|
|
2078
|
+
z13.object({
|
|
2026
2079
|
/**
|
|
2027
2080
|
* A regex pattern to search for tools.
|
|
2028
2081
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -2033,15 +2086,15 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils14.lazySchema
|
|
|
2033
2086
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
2034
2087
|
* - "(?i)slack" - case-insensitive search
|
|
2035
2088
|
*/
|
|
2036
|
-
pattern:
|
|
2089
|
+
pattern: z13.string(),
|
|
2037
2090
|
/**
|
|
2038
2091
|
* Maximum number of tools to return. Optional.
|
|
2039
2092
|
*/
|
|
2040
|
-
limit:
|
|
2093
|
+
limit: z13.number().optional()
|
|
2041
2094
|
})
|
|
2042
2095
|
)
|
|
2043
2096
|
);
|
|
2044
|
-
var factory9 = (
|
|
2097
|
+
var factory9 = createProviderToolFactoryWithOutputSchema8({
|
|
2045
2098
|
id: "anthropic.tool_search_regex_20251119",
|
|
2046
2099
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
2047
2100
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
@@ -2054,17 +2107,17 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
2054
2107
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
2055
2108
|
function convertToString(data) {
|
|
2056
2109
|
if (typeof data === "string") {
|
|
2057
|
-
return new TextDecoder().decode((
|
|
2110
|
+
return new TextDecoder().decode(convertBase64ToUint8Array2(data));
|
|
2058
2111
|
}
|
|
2059
2112
|
if (data instanceof Uint8Array) {
|
|
2060
2113
|
return new TextDecoder().decode(data);
|
|
2061
2114
|
}
|
|
2062
2115
|
if (data instanceof URL) {
|
|
2063
|
-
throw new
|
|
2116
|
+
throw new UnsupportedFunctionalityError2({
|
|
2064
2117
|
functionality: "URL-based text documents are not supported for citations"
|
|
2065
2118
|
});
|
|
2066
2119
|
}
|
|
2067
|
-
throw new
|
|
2120
|
+
throw new UnsupportedFunctionalityError2({
|
|
2068
2121
|
functionality: `unsupported data type for text documents: ${typeof data}`
|
|
2069
2122
|
});
|
|
2070
2123
|
}
|
|
@@ -2092,7 +2145,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2092
2145
|
const messages = [];
|
|
2093
2146
|
async function shouldEnableCitations(providerMetadata) {
|
|
2094
2147
|
var _a2, _b2;
|
|
2095
|
-
const anthropicOptions = await
|
|
2148
|
+
const anthropicOptions = await parseProviderOptions({
|
|
2096
2149
|
provider: "anthropic",
|
|
2097
2150
|
providerOptions: providerMetadata,
|
|
2098
2151
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2100,7 +2153,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2100
2153
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
2101
2154
|
}
|
|
2102
2155
|
async function getDocumentMetadata(providerMetadata) {
|
|
2103
|
-
const anthropicOptions = await
|
|
2156
|
+
const anthropicOptions = await parseProviderOptions({
|
|
2104
2157
|
provider: "anthropic",
|
|
2105
2158
|
providerOptions: providerMetadata,
|
|
2106
2159
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2117,7 +2170,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2117
2170
|
switch (type) {
|
|
2118
2171
|
case "system": {
|
|
2119
2172
|
if (system != null) {
|
|
2120
|
-
throw new
|
|
2173
|
+
throw new UnsupportedFunctionalityError2({
|
|
2121
2174
|
functionality: "Multiple system messages that are separated by user/assistant messages"
|
|
2122
2175
|
});
|
|
2123
2176
|
}
|
|
@@ -2157,8 +2210,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2157
2210
|
break;
|
|
2158
2211
|
}
|
|
2159
2212
|
case "file": {
|
|
2160
|
-
if (
|
|
2161
|
-
const fileId =
|
|
2213
|
+
if (isProviderReference(part.data)) {
|
|
2214
|
+
const fileId = resolveProviderReference({
|
|
2162
2215
|
reference: part.data,
|
|
2163
2216
|
provider: "anthropic"
|
|
2164
2217
|
});
|
|
@@ -2185,7 +2238,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2185
2238
|
} : {
|
|
2186
2239
|
type: "base64",
|
|
2187
2240
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
2188
|
-
data:
|
|
2241
|
+
data: convertToBase64(part.data)
|
|
2189
2242
|
},
|
|
2190
2243
|
cache_control: cacheControl
|
|
2191
2244
|
});
|
|
@@ -2205,7 +2258,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2205
2258
|
} : {
|
|
2206
2259
|
type: "base64",
|
|
2207
2260
|
media_type: "application/pdf",
|
|
2208
|
-
data:
|
|
2261
|
+
data: convertToBase64(part.data)
|
|
2209
2262
|
},
|
|
2210
2263
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
2211
2264
|
...metadata.context && { context: metadata.context },
|
|
@@ -2239,7 +2292,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2239
2292
|
cache_control: cacheControl
|
|
2240
2293
|
});
|
|
2241
2294
|
} else {
|
|
2242
|
-
throw new
|
|
2295
|
+
throw new UnsupportedFunctionalityError2({
|
|
2243
2296
|
functionality: `media type: ${part.mediaType}`
|
|
2244
2297
|
});
|
|
2245
2298
|
}
|
|
@@ -2275,26 +2328,16 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2275
2328
|
type: "text",
|
|
2276
2329
|
text: contentPart.text
|
|
2277
2330
|
};
|
|
2278
|
-
case "image-data": {
|
|
2279
|
-
return {
|
|
2280
|
-
type: "image",
|
|
2281
|
-
source: {
|
|
2282
|
-
type: "base64",
|
|
2283
|
-
media_type: contentPart.mediaType,
|
|
2284
|
-
data: contentPart.data
|
|
2285
|
-
}
|
|
2286
|
-
};
|
|
2287
|
-
}
|
|
2288
|
-
case "image-url": {
|
|
2289
|
-
return {
|
|
2290
|
-
type: "image",
|
|
2291
|
-
source: {
|
|
2292
|
-
type: "url",
|
|
2293
|
-
url: contentPart.url
|
|
2294
|
-
}
|
|
2295
|
-
};
|
|
2296
|
-
}
|
|
2297
2331
|
case "file-url": {
|
|
2332
|
+
if (contentPart.mediaType.startsWith("image/")) {
|
|
2333
|
+
return {
|
|
2334
|
+
type: "image",
|
|
2335
|
+
source: {
|
|
2336
|
+
type: "url",
|
|
2337
|
+
url: contentPart.url
|
|
2338
|
+
}
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2298
2341
|
return {
|
|
2299
2342
|
type: "document",
|
|
2300
2343
|
source: {
|
|
@@ -2304,6 +2347,16 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2304
2347
|
};
|
|
2305
2348
|
}
|
|
2306
2349
|
case "file-data": {
|
|
2350
|
+
if (contentPart.mediaType.startsWith("image/")) {
|
|
2351
|
+
return {
|
|
2352
|
+
type: "image",
|
|
2353
|
+
source: {
|
|
2354
|
+
type: "base64",
|
|
2355
|
+
media_type: contentPart.mediaType,
|
|
2356
|
+
data: contentPart.data
|
|
2357
|
+
}
|
|
2358
|
+
};
|
|
2359
|
+
}
|
|
2307
2360
|
if (contentPart.mediaType === "application/pdf") {
|
|
2308
2361
|
betas.add("pdfs-2024-09-25");
|
|
2309
2362
|
return {
|
|
@@ -2343,7 +2396,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2343
2396
|
return void 0;
|
|
2344
2397
|
}
|
|
2345
2398
|
}
|
|
2346
|
-
}).filter(
|
|
2399
|
+
}).filter(isNonNullable);
|
|
2347
2400
|
break;
|
|
2348
2401
|
case "text":
|
|
2349
2402
|
case "error-text":
|
|
@@ -2419,7 +2472,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2419
2472
|
}
|
|
2420
2473
|
case "reasoning": {
|
|
2421
2474
|
if (sendReasoning) {
|
|
2422
|
-
const reasoningMetadata = await
|
|
2475
|
+
const reasoningMetadata = await parseProviderOptions({
|
|
2423
2476
|
provider: "anthropic",
|
|
2424
2477
|
providerOptions: part.providerOptions,
|
|
2425
2478
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -2625,7 +2678,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2625
2678
|
break;
|
|
2626
2679
|
}
|
|
2627
2680
|
if (output.value.type === "code_execution_result") {
|
|
2628
|
-
const codeExecutionOutput = await (
|
|
2681
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2629
2682
|
value: output.value,
|
|
2630
2683
|
schema: codeExecution_20250522OutputSchema
|
|
2631
2684
|
});
|
|
@@ -2642,7 +2695,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2642
2695
|
cache_control: cacheControl
|
|
2643
2696
|
});
|
|
2644
2697
|
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
2645
|
-
const codeExecutionOutput = await (
|
|
2698
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2646
2699
|
value: output.value,
|
|
2647
2700
|
schema: codeExecution_20260120OutputSchema
|
|
2648
2701
|
});
|
|
@@ -2661,7 +2714,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2661
2714
|
});
|
|
2662
2715
|
}
|
|
2663
2716
|
} else {
|
|
2664
|
-
const codeExecutionOutput = await (
|
|
2717
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2665
2718
|
value: output.value,
|
|
2666
2719
|
schema: codeExecution_20250825OutputSchema
|
|
2667
2720
|
});
|
|
@@ -2730,7 +2783,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2730
2783
|
});
|
|
2731
2784
|
break;
|
|
2732
2785
|
}
|
|
2733
|
-
const webFetchOutput = await (
|
|
2786
|
+
const webFetchOutput = await validateTypes2({
|
|
2734
2787
|
value: output.value,
|
|
2735
2788
|
schema: webFetch_20250910OutputSchema
|
|
2736
2789
|
});
|
|
@@ -2765,7 +2818,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2765
2818
|
});
|
|
2766
2819
|
break;
|
|
2767
2820
|
}
|
|
2768
|
-
const webSearchOutput = await (
|
|
2821
|
+
const webSearchOutput = await validateTypes2({
|
|
2769
2822
|
value: output.value,
|
|
2770
2823
|
schema: webSearch_20250305OutputSchema
|
|
2771
2824
|
});
|
|
@@ -2792,7 +2845,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2792
2845
|
});
|
|
2793
2846
|
break;
|
|
2794
2847
|
}
|
|
2795
|
-
const toolSearchOutput = await (
|
|
2848
|
+
const toolSearchOutput = await validateTypes2({
|
|
2796
2849
|
value: output.value,
|
|
2797
2850
|
schema: toolSearchRegex_20251119OutputSchema
|
|
2798
2851
|
});
|
|
@@ -2950,13 +3003,22 @@ function createCitationSource(citation, citationDocuments, generateId3) {
|
|
|
2950
3003
|
}
|
|
2951
3004
|
};
|
|
2952
3005
|
}
|
|
2953
|
-
var AnthropicMessagesLanguageModel = class {
|
|
3006
|
+
var AnthropicMessagesLanguageModel = class _AnthropicMessagesLanguageModel {
|
|
2954
3007
|
constructor(modelId, config) {
|
|
2955
3008
|
this.specificationVersion = "v4";
|
|
2956
3009
|
var _a;
|
|
2957
3010
|
this.modelId = modelId;
|
|
2958
3011
|
this.config = config;
|
|
2959
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
3012
|
+
this.generateId = (_a = config.generateId) != null ? _a : generateId;
|
|
3013
|
+
}
|
|
3014
|
+
static [WORKFLOW_SERIALIZE](model) {
|
|
3015
|
+
return serializeModelOptions({
|
|
3016
|
+
modelId: model.modelId,
|
|
3017
|
+
config: model.config
|
|
3018
|
+
});
|
|
3019
|
+
}
|
|
3020
|
+
static [WORKFLOW_DESERIALIZE](options) {
|
|
3021
|
+
return new _AnthropicMessagesLanguageModel(options.modelId, options.config);
|
|
2960
3022
|
}
|
|
2961
3023
|
supportsUrl(url) {
|
|
2962
3024
|
return url.protocol === "https:";
|
|
@@ -3031,12 +3093,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3031
3093
|
}
|
|
3032
3094
|
}
|
|
3033
3095
|
const providerOptionsName = this.providerOptionsName;
|
|
3034
|
-
const canonicalOptions = await (
|
|
3096
|
+
const canonicalOptions = await parseProviderOptions2({
|
|
3035
3097
|
provider: "anthropic",
|
|
3036
3098
|
providerOptions,
|
|
3037
3099
|
schema: anthropicLanguageModelOptions
|
|
3038
3100
|
});
|
|
3039
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (
|
|
3101
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await parseProviderOptions2({
|
|
3040
3102
|
provider: providerOptionsName,
|
|
3041
3103
|
providerOptions,
|
|
3042
3104
|
schema: anthropicLanguageModelOptions
|
|
@@ -3066,7 +3128,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3066
3128
|
} : void 0;
|
|
3067
3129
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
3068
3130
|
const cacheControlValidator = new CacheControlValidator();
|
|
3069
|
-
const toolNameMapping =
|
|
3131
|
+
const toolNameMapping = createToolNameMapping({
|
|
3070
3132
|
tools,
|
|
3071
3133
|
providerToolNames: {
|
|
3072
3134
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -3096,7 +3158,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3096
3158
|
cacheControlValidator,
|
|
3097
3159
|
toolNameMapping
|
|
3098
3160
|
});
|
|
3099
|
-
if (
|
|
3161
|
+
if (isCustomReasoning(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
|
|
3100
3162
|
const reasoningConfig = resolveAnthropicReasoningConfig({
|
|
3101
3163
|
reasoning,
|
|
3102
3164
|
supportsAdaptiveThinking,
|
|
@@ -3176,7 +3238,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3176
3238
|
id: anthropicOptions.container.id,
|
|
3177
3239
|
skills: anthropicOptions.container.skills.map((skill) => ({
|
|
3178
3240
|
type: skill.type,
|
|
3179
|
-
skill_id: skill.type === "custom" ? (
|
|
3241
|
+
skill_id: skill.type === "custom" ? resolveProviderReference2({
|
|
3180
3242
|
reference: skill.providerReference,
|
|
3181
3243
|
provider: "anthropic"
|
|
3182
3244
|
}) : skill.skillId,
|
|
@@ -3379,16 +3441,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3379
3441
|
betas,
|
|
3380
3442
|
headers
|
|
3381
3443
|
}) {
|
|
3382
|
-
return (
|
|
3383
|
-
await
|
|
3444
|
+
return combineHeaders2(
|
|
3445
|
+
this.config.headers ? await resolve(this.config.headers) : void 0,
|
|
3384
3446
|
headers,
|
|
3385
3447
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
3386
3448
|
);
|
|
3387
3449
|
}
|
|
3388
3450
|
async getBetasFromHeaders(requestHeaders) {
|
|
3389
3451
|
var _a, _b;
|
|
3390
|
-
const configHeaders = await
|
|
3391
|
-
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
3452
|
+
const configHeaders = this.config.headers ? await resolve(this.config.headers) : void 0;
|
|
3453
|
+
const configBetaHeader = (_a = configHeaders == null ? void 0 : configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
3392
3454
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
3393
3455
|
return new Set(
|
|
3394
3456
|
[
|
|
@@ -3453,12 +3515,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3453
3515
|
responseHeaders,
|
|
3454
3516
|
value: response,
|
|
3455
3517
|
rawValue: rawResponse
|
|
3456
|
-
} = await
|
|
3518
|
+
} = await postJsonToApi({
|
|
3457
3519
|
url: this.buildRequestUrl(false),
|
|
3458
3520
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3459
3521
|
body: this.transformRequestBody(args, betas),
|
|
3460
3522
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3461
|
-
successfulResponseHandler: (
|
|
3523
|
+
successfulResponseHandler: createJsonResponseHandler2(
|
|
3462
3524
|
anthropicMessagesResponseSchema
|
|
3463
3525
|
),
|
|
3464
3526
|
abortSignal: options.abortSignal,
|
|
@@ -3852,6 +3914,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3852
3914
|
};
|
|
3853
3915
|
}
|
|
3854
3916
|
async doStream(options) {
|
|
3917
|
+
"use step";
|
|
3855
3918
|
var _a, _b;
|
|
3856
3919
|
const {
|
|
3857
3920
|
args: body,
|
|
@@ -3873,12 +3936,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3873
3936
|
body.tools
|
|
3874
3937
|
);
|
|
3875
3938
|
const url = this.buildRequestUrl(true);
|
|
3876
|
-
const { responseHeaders, value: response } = await
|
|
3939
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
3877
3940
|
url,
|
|
3878
3941
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3879
3942
|
body: this.transformRequestBody(body, betas),
|
|
3880
3943
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3881
|
-
successfulResponseHandler:
|
|
3944
|
+
successfulResponseHandler: createEventSourceResponseHandler(
|
|
3882
3945
|
anthropicMessagesChunkSchema
|
|
3883
3946
|
),
|
|
3884
3947
|
abortSignal: options.abortSignal,
|
|
@@ -4603,7 +4666,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4603
4666
|
}
|
|
4604
4667
|
if (((_b = result.value) == null ? void 0 : _b.type) === "error") {
|
|
4605
4668
|
const error = result.value.error;
|
|
4606
|
-
throw new
|
|
4669
|
+
throw new APICallError({
|
|
4607
4670
|
message: error.message,
|
|
4608
4671
|
url,
|
|
4609
4672
|
requestBodyValues: body,
|
|
@@ -4701,14 +4764,14 @@ function resolveAnthropicReasoningConfig({
|
|
|
4701
4764
|
maxOutputTokensForModel,
|
|
4702
4765
|
warnings
|
|
4703
4766
|
}) {
|
|
4704
|
-
if (!
|
|
4767
|
+
if (!isCustomReasoning(reasoning)) {
|
|
4705
4768
|
return void 0;
|
|
4706
4769
|
}
|
|
4707
4770
|
if (reasoning === "none") {
|
|
4708
4771
|
return { thinking: { type: "disabled" } };
|
|
4709
4772
|
}
|
|
4710
4773
|
if (supportsAdaptiveThinking) {
|
|
4711
|
-
const effort =
|
|
4774
|
+
const effort = mapReasoningToProviderEffort({
|
|
4712
4775
|
reasoning,
|
|
4713
4776
|
effortMap: {
|
|
4714
4777
|
minimal: "low",
|
|
@@ -4721,7 +4784,7 @@ function resolveAnthropicReasoningConfig({
|
|
|
4721
4784
|
});
|
|
4722
4785
|
return { thinking: { type: "adaptive" }, effort };
|
|
4723
4786
|
}
|
|
4724
|
-
const budgetTokens =
|
|
4787
|
+
const budgetTokens = mapReasoningToProviderBudget({
|
|
4725
4788
|
reasoning,
|
|
4726
4789
|
maxOutputTokens: maxOutputTokensForModel,
|
|
4727
4790
|
maxReasoningBudget: maxOutputTokensForModel,
|
|
@@ -4759,44 +4822,56 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4759
4822
|
}
|
|
4760
4823
|
|
|
4761
4824
|
// src/tool/bash_20241022.ts
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4825
|
+
import {
|
|
4826
|
+
createProviderToolFactory as createProviderToolFactory2,
|
|
4827
|
+
lazySchema as lazySchema13,
|
|
4828
|
+
zodSchema as zodSchema13
|
|
4829
|
+
} from "@ai-sdk/provider-utils";
|
|
4830
|
+
import { z as z14 } from "zod/v4";
|
|
4831
|
+
var bash_20241022InputSchema = lazySchema13(
|
|
4832
|
+
() => zodSchema13(
|
|
4833
|
+
z14.object({
|
|
4834
|
+
command: z14.string(),
|
|
4835
|
+
restart: z14.boolean().optional()
|
|
4769
4836
|
})
|
|
4770
4837
|
)
|
|
4771
4838
|
);
|
|
4772
|
-
var bash_20241022 = (
|
|
4839
|
+
var bash_20241022 = createProviderToolFactory2({
|
|
4773
4840
|
id: "anthropic.bash_20241022",
|
|
4774
4841
|
inputSchema: bash_20241022InputSchema
|
|
4775
4842
|
});
|
|
4776
4843
|
|
|
4777
4844
|
// src/tool/bash_20250124.ts
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4845
|
+
import {
|
|
4846
|
+
createProviderToolFactory as createProviderToolFactory3,
|
|
4847
|
+
lazySchema as lazySchema14,
|
|
4848
|
+
zodSchema as zodSchema14
|
|
4849
|
+
} from "@ai-sdk/provider-utils";
|
|
4850
|
+
import { z as z15 } from "zod/v4";
|
|
4851
|
+
var bash_20250124InputSchema = lazySchema14(
|
|
4852
|
+
() => zodSchema14(
|
|
4853
|
+
z15.object({
|
|
4854
|
+
command: z15.string(),
|
|
4855
|
+
restart: z15.boolean().optional()
|
|
4785
4856
|
})
|
|
4786
4857
|
)
|
|
4787
4858
|
);
|
|
4788
|
-
var bash_20250124 = (
|
|
4859
|
+
var bash_20250124 = createProviderToolFactory3({
|
|
4789
4860
|
id: "anthropic.bash_20250124",
|
|
4790
4861
|
inputSchema: bash_20250124InputSchema
|
|
4791
4862
|
});
|
|
4792
4863
|
|
|
4793
4864
|
// src/tool/computer_20241022.ts
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4865
|
+
import {
|
|
4866
|
+
createProviderToolFactory as createProviderToolFactory4,
|
|
4867
|
+
lazySchema as lazySchema15,
|
|
4868
|
+
zodSchema as zodSchema15
|
|
4869
|
+
} from "@ai-sdk/provider-utils";
|
|
4870
|
+
import { z as z16 } from "zod/v4";
|
|
4871
|
+
var computer_20241022InputSchema = lazySchema15(
|
|
4872
|
+
() => zodSchema15(
|
|
4873
|
+
z16.object({
|
|
4874
|
+
action: z16.enum([
|
|
4800
4875
|
"key",
|
|
4801
4876
|
"type",
|
|
4802
4877
|
"mouse_move",
|
|
@@ -4808,23 +4883,27 @@ var computer_20241022InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
4808
4883
|
"screenshot",
|
|
4809
4884
|
"cursor_position"
|
|
4810
4885
|
]),
|
|
4811
|
-
coordinate:
|
|
4812
|
-
text:
|
|
4886
|
+
coordinate: z16.array(z16.number().int()).optional(),
|
|
4887
|
+
text: z16.string().optional()
|
|
4813
4888
|
})
|
|
4814
4889
|
)
|
|
4815
4890
|
);
|
|
4816
|
-
var computer_20241022 = (
|
|
4891
|
+
var computer_20241022 = createProviderToolFactory4({
|
|
4817
4892
|
id: "anthropic.computer_20241022",
|
|
4818
4893
|
inputSchema: computer_20241022InputSchema
|
|
4819
4894
|
});
|
|
4820
4895
|
|
|
4821
4896
|
// src/tool/computer_20250124.ts
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4897
|
+
import {
|
|
4898
|
+
createProviderToolFactory as createProviderToolFactory5,
|
|
4899
|
+
lazySchema as lazySchema16,
|
|
4900
|
+
zodSchema as zodSchema16
|
|
4901
|
+
} from "@ai-sdk/provider-utils";
|
|
4902
|
+
import { z as z17 } from "zod/v4";
|
|
4903
|
+
var computer_20250124InputSchema = lazySchema16(
|
|
4904
|
+
() => zodSchema16(
|
|
4905
|
+
z17.object({
|
|
4906
|
+
action: z17.enum([
|
|
4828
4907
|
"key",
|
|
4829
4908
|
"hold_key",
|
|
4830
4909
|
"type",
|
|
@@ -4842,27 +4921,31 @@ var computer_20250124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
4842
4921
|
"wait",
|
|
4843
4922
|
"screenshot"
|
|
4844
4923
|
]),
|
|
4845
|
-
coordinate:
|
|
4846
|
-
duration:
|
|
4847
|
-
scroll_amount:
|
|
4848
|
-
scroll_direction:
|
|
4849
|
-
start_coordinate:
|
|
4850
|
-
text:
|
|
4924
|
+
coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4925
|
+
duration: z17.number().optional(),
|
|
4926
|
+
scroll_amount: z17.number().optional(),
|
|
4927
|
+
scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
|
|
4928
|
+
start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4929
|
+
text: z17.string().optional()
|
|
4851
4930
|
})
|
|
4852
4931
|
)
|
|
4853
4932
|
);
|
|
4854
|
-
var computer_20250124 = (
|
|
4933
|
+
var computer_20250124 = createProviderToolFactory5({
|
|
4855
4934
|
id: "anthropic.computer_20250124",
|
|
4856
4935
|
inputSchema: computer_20250124InputSchema
|
|
4857
4936
|
});
|
|
4858
4937
|
|
|
4859
4938
|
// src/tool/computer_20251124.ts
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4939
|
+
import {
|
|
4940
|
+
createProviderToolFactory as createProviderToolFactory6,
|
|
4941
|
+
lazySchema as lazySchema17,
|
|
4942
|
+
zodSchema as zodSchema17
|
|
4943
|
+
} from "@ai-sdk/provider-utils";
|
|
4944
|
+
import { z as z18 } from "zod/v4";
|
|
4945
|
+
var computer_20251124InputSchema = lazySchema17(
|
|
4946
|
+
() => zodSchema17(
|
|
4947
|
+
z18.object({
|
|
4948
|
+
action: z18.enum([
|
|
4866
4949
|
"key",
|
|
4867
4950
|
"hold_key",
|
|
4868
4951
|
"type",
|
|
@@ -4881,166 +4964,186 @@ var computer_20251124InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
|
4881
4964
|
"screenshot",
|
|
4882
4965
|
"zoom"
|
|
4883
4966
|
]),
|
|
4884
|
-
coordinate:
|
|
4885
|
-
duration:
|
|
4886
|
-
region:
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4967
|
+
coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
|
|
4968
|
+
duration: z18.number().optional(),
|
|
4969
|
+
region: z18.tuple([
|
|
4970
|
+
z18.number().int(),
|
|
4971
|
+
z18.number().int(),
|
|
4972
|
+
z18.number().int(),
|
|
4973
|
+
z18.number().int()
|
|
4891
4974
|
]).optional(),
|
|
4892
|
-
scroll_amount:
|
|
4893
|
-
scroll_direction:
|
|
4894
|
-
start_coordinate:
|
|
4895
|
-
text:
|
|
4975
|
+
scroll_amount: z18.number().optional(),
|
|
4976
|
+
scroll_direction: z18.enum(["up", "down", "left", "right"]).optional(),
|
|
4977
|
+
start_coordinate: z18.tuple([z18.number().int(), z18.number().int()]).optional(),
|
|
4978
|
+
text: z18.string().optional()
|
|
4896
4979
|
})
|
|
4897
4980
|
)
|
|
4898
4981
|
);
|
|
4899
|
-
var computer_20251124 = (
|
|
4982
|
+
var computer_20251124 = createProviderToolFactory6({
|
|
4900
4983
|
id: "anthropic.computer_20251124",
|
|
4901
4984
|
inputSchema: computer_20251124InputSchema
|
|
4902
4985
|
});
|
|
4903
4986
|
|
|
4904
4987
|
// src/tool/memory_20250818.ts
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4988
|
+
import {
|
|
4989
|
+
createProviderToolFactory as createProviderToolFactory7,
|
|
4990
|
+
lazySchema as lazySchema18,
|
|
4991
|
+
zodSchema as zodSchema18
|
|
4992
|
+
} from "@ai-sdk/provider-utils";
|
|
4993
|
+
import { z as z19 } from "zod/v4";
|
|
4994
|
+
var memory_20250818InputSchema = lazySchema18(
|
|
4995
|
+
() => zodSchema18(
|
|
4996
|
+
z19.discriminatedUnion("command", [
|
|
4997
|
+
z19.object({
|
|
4998
|
+
command: z19.literal("view"),
|
|
4999
|
+
path: z19.string(),
|
|
5000
|
+
view_range: z19.tuple([z19.number(), z19.number()]).optional()
|
|
4914
5001
|
}),
|
|
4915
|
-
|
|
4916
|
-
command:
|
|
4917
|
-
path:
|
|
4918
|
-
file_text:
|
|
5002
|
+
z19.object({
|
|
5003
|
+
command: z19.literal("create"),
|
|
5004
|
+
path: z19.string(),
|
|
5005
|
+
file_text: z19.string()
|
|
4919
5006
|
}),
|
|
4920
|
-
|
|
4921
|
-
command:
|
|
4922
|
-
path:
|
|
4923
|
-
old_str:
|
|
4924
|
-
new_str:
|
|
5007
|
+
z19.object({
|
|
5008
|
+
command: z19.literal("str_replace"),
|
|
5009
|
+
path: z19.string(),
|
|
5010
|
+
old_str: z19.string(),
|
|
5011
|
+
new_str: z19.string()
|
|
4925
5012
|
}),
|
|
4926
|
-
|
|
4927
|
-
command:
|
|
4928
|
-
path:
|
|
4929
|
-
insert_line:
|
|
4930
|
-
insert_text:
|
|
5013
|
+
z19.object({
|
|
5014
|
+
command: z19.literal("insert"),
|
|
5015
|
+
path: z19.string(),
|
|
5016
|
+
insert_line: z19.number(),
|
|
5017
|
+
insert_text: z19.string()
|
|
4931
5018
|
}),
|
|
4932
|
-
|
|
4933
|
-
command:
|
|
4934
|
-
path:
|
|
5019
|
+
z19.object({
|
|
5020
|
+
command: z19.literal("delete"),
|
|
5021
|
+
path: z19.string()
|
|
4935
5022
|
}),
|
|
4936
|
-
|
|
4937
|
-
command:
|
|
4938
|
-
old_path:
|
|
4939
|
-
new_path:
|
|
5023
|
+
z19.object({
|
|
5024
|
+
command: z19.literal("rename"),
|
|
5025
|
+
old_path: z19.string(),
|
|
5026
|
+
new_path: z19.string()
|
|
4940
5027
|
})
|
|
4941
5028
|
])
|
|
4942
5029
|
)
|
|
4943
5030
|
);
|
|
4944
|
-
var memory_20250818 = (
|
|
5031
|
+
var memory_20250818 = createProviderToolFactory7({
|
|
4945
5032
|
id: "anthropic.memory_20250818",
|
|
4946
5033
|
inputSchema: memory_20250818InputSchema
|
|
4947
5034
|
});
|
|
4948
5035
|
|
|
4949
5036
|
// src/tool/text-editor_20241022.ts
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
5037
|
+
import {
|
|
5038
|
+
createProviderToolFactory as createProviderToolFactory8,
|
|
5039
|
+
lazySchema as lazySchema19,
|
|
5040
|
+
zodSchema as zodSchema19
|
|
5041
|
+
} from "@ai-sdk/provider-utils";
|
|
5042
|
+
import { z as z20 } from "zod/v4";
|
|
5043
|
+
var textEditor_20241022InputSchema = lazySchema19(
|
|
5044
|
+
() => zodSchema19(
|
|
5045
|
+
z20.object({
|
|
5046
|
+
command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
5047
|
+
path: z20.string(),
|
|
5048
|
+
file_text: z20.string().optional(),
|
|
5049
|
+
insert_line: z20.number().int().optional(),
|
|
5050
|
+
new_str: z20.string().optional(),
|
|
5051
|
+
insert_text: z20.string().optional(),
|
|
5052
|
+
old_str: z20.string().optional(),
|
|
5053
|
+
view_range: z20.array(z20.number().int()).optional()
|
|
4963
5054
|
})
|
|
4964
5055
|
)
|
|
4965
5056
|
);
|
|
4966
|
-
var textEditor_20241022 = (
|
|
5057
|
+
var textEditor_20241022 = createProviderToolFactory8({
|
|
4967
5058
|
id: "anthropic.text_editor_20241022",
|
|
4968
5059
|
inputSchema: textEditor_20241022InputSchema
|
|
4969
5060
|
});
|
|
4970
5061
|
|
|
4971
5062
|
// src/tool/text-editor_20250124.ts
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
5063
|
+
import {
|
|
5064
|
+
createProviderToolFactory as createProviderToolFactory9,
|
|
5065
|
+
lazySchema as lazySchema20,
|
|
5066
|
+
zodSchema as zodSchema20
|
|
5067
|
+
} from "@ai-sdk/provider-utils";
|
|
5068
|
+
import { z as z21 } from "zod/v4";
|
|
5069
|
+
var textEditor_20250124InputSchema = lazySchema20(
|
|
5070
|
+
() => zodSchema20(
|
|
5071
|
+
z21.object({
|
|
5072
|
+
command: z21.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
5073
|
+
path: z21.string(),
|
|
5074
|
+
file_text: z21.string().optional(),
|
|
5075
|
+
insert_line: z21.number().int().optional(),
|
|
5076
|
+
new_str: z21.string().optional(),
|
|
5077
|
+
insert_text: z21.string().optional(),
|
|
5078
|
+
old_str: z21.string().optional(),
|
|
5079
|
+
view_range: z21.array(z21.number().int()).optional()
|
|
4985
5080
|
})
|
|
4986
5081
|
)
|
|
4987
5082
|
);
|
|
4988
|
-
var textEditor_20250124 = (
|
|
5083
|
+
var textEditor_20250124 = createProviderToolFactory9({
|
|
4989
5084
|
id: "anthropic.text_editor_20250124",
|
|
4990
5085
|
inputSchema: textEditor_20250124InputSchema
|
|
4991
5086
|
});
|
|
4992
5087
|
|
|
4993
5088
|
// src/tool/text-editor_20250429.ts
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5089
|
+
import {
|
|
5090
|
+
createProviderToolFactory as createProviderToolFactory10,
|
|
5091
|
+
lazySchema as lazySchema21,
|
|
5092
|
+
zodSchema as zodSchema21
|
|
5093
|
+
} from "@ai-sdk/provider-utils";
|
|
5094
|
+
import { z as z22 } from "zod/v4";
|
|
5095
|
+
var textEditor_20250429InputSchema = lazySchema21(
|
|
5096
|
+
() => zodSchema21(
|
|
5097
|
+
z22.object({
|
|
5098
|
+
command: z22.enum(["view", "create", "str_replace", "insert"]),
|
|
5099
|
+
path: z22.string(),
|
|
5100
|
+
file_text: z22.string().optional(),
|
|
5101
|
+
insert_line: z22.number().int().optional(),
|
|
5102
|
+
new_str: z22.string().optional(),
|
|
5103
|
+
insert_text: z22.string().optional(),
|
|
5104
|
+
old_str: z22.string().optional(),
|
|
5105
|
+
view_range: z22.array(z22.number().int()).optional()
|
|
5007
5106
|
})
|
|
5008
5107
|
)
|
|
5009
5108
|
);
|
|
5010
|
-
var textEditor_20250429 = (
|
|
5109
|
+
var textEditor_20250429 = createProviderToolFactory10({
|
|
5011
5110
|
id: "anthropic.text_editor_20250429",
|
|
5012
5111
|
inputSchema: textEditor_20250429InputSchema
|
|
5013
5112
|
});
|
|
5014
5113
|
|
|
5015
5114
|
// src/tool/tool-search-bm25_20251119.ts
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5115
|
+
import {
|
|
5116
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
5117
|
+
lazySchema as lazySchema22,
|
|
5118
|
+
zodSchema as zodSchema22
|
|
5119
|
+
} from "@ai-sdk/provider-utils";
|
|
5120
|
+
import { z as z23 } from "zod/v4";
|
|
5121
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema22(
|
|
5122
|
+
() => zodSchema22(
|
|
5123
|
+
z23.array(
|
|
5124
|
+
z23.object({
|
|
5125
|
+
type: z23.literal("tool_reference"),
|
|
5126
|
+
toolName: z23.string()
|
|
5024
5127
|
})
|
|
5025
5128
|
)
|
|
5026
5129
|
)
|
|
5027
5130
|
);
|
|
5028
|
-
var toolSearchBm25_20251119InputSchema = (
|
|
5029
|
-
() => (
|
|
5030
|
-
|
|
5131
|
+
var toolSearchBm25_20251119InputSchema = lazySchema22(
|
|
5132
|
+
() => zodSchema22(
|
|
5133
|
+
z23.object({
|
|
5031
5134
|
/**
|
|
5032
5135
|
* A natural language query to search for tools.
|
|
5033
5136
|
* Claude will use BM25 text search to find relevant tools.
|
|
5034
5137
|
*/
|
|
5035
|
-
query:
|
|
5138
|
+
query: z23.string(),
|
|
5036
5139
|
/**
|
|
5037
5140
|
* Maximum number of tools to return. Optional.
|
|
5038
5141
|
*/
|
|
5039
|
-
limit:
|
|
5142
|
+
limit: z23.number().optional()
|
|
5040
5143
|
})
|
|
5041
5144
|
)
|
|
5042
5145
|
);
|
|
5043
|
-
var factory10 = (
|
|
5146
|
+
var factory10 = createProviderToolFactoryWithOutputSchema9({
|
|
5044
5147
|
id: "anthropic.tool_search_bm25_20251119",
|
|
5045
5148
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
5046
5149
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
@@ -5253,43 +5356,50 @@ var anthropicTools = {
|
|
|
5253
5356
|
};
|
|
5254
5357
|
|
|
5255
5358
|
// src/skills/anthropic-skills.ts
|
|
5256
|
-
|
|
5359
|
+
import {
|
|
5360
|
+
combineHeaders as combineHeaders3,
|
|
5361
|
+
convertBase64ToUint8Array as convertBase64ToUint8Array3,
|
|
5362
|
+
createJsonResponseHandler as createJsonResponseHandler3,
|
|
5363
|
+
getFromApi,
|
|
5364
|
+
postFormDataToApi as postFormDataToApi2,
|
|
5365
|
+
resolve as resolve2
|
|
5366
|
+
} from "@ai-sdk/provider-utils";
|
|
5257
5367
|
|
|
5258
5368
|
// src/skills/anthropic-skills-api.ts
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
var anthropicSkillResponseSchema = (
|
|
5262
|
-
() => (
|
|
5263
|
-
|
|
5264
|
-
id:
|
|
5265
|
-
display_title:
|
|
5266
|
-
name:
|
|
5267
|
-
description:
|
|
5268
|
-
latest_version:
|
|
5269
|
-
source:
|
|
5270
|
-
created_at:
|
|
5271
|
-
updated_at:
|
|
5369
|
+
import { lazySchema as lazySchema23, zodSchema as zodSchema23 } from "@ai-sdk/provider-utils";
|
|
5370
|
+
import { z as z24 } from "zod/v4";
|
|
5371
|
+
var anthropicSkillResponseSchema = lazySchema23(
|
|
5372
|
+
() => zodSchema23(
|
|
5373
|
+
z24.object({
|
|
5374
|
+
id: z24.string(),
|
|
5375
|
+
display_title: z24.string().nullish(),
|
|
5376
|
+
name: z24.string().nullish(),
|
|
5377
|
+
description: z24.string().nullish(),
|
|
5378
|
+
latest_version: z24.string().nullish(),
|
|
5379
|
+
source: z24.string(),
|
|
5380
|
+
created_at: z24.string(),
|
|
5381
|
+
updated_at: z24.string()
|
|
5272
5382
|
})
|
|
5273
5383
|
)
|
|
5274
5384
|
);
|
|
5275
|
-
var anthropicSkillVersionListResponseSchema = (
|
|
5276
|
-
() => (
|
|
5277
|
-
|
|
5278
|
-
data:
|
|
5279
|
-
|
|
5280
|
-
version:
|
|
5385
|
+
var anthropicSkillVersionListResponseSchema = lazySchema23(
|
|
5386
|
+
() => zodSchema23(
|
|
5387
|
+
z24.object({
|
|
5388
|
+
data: z24.array(
|
|
5389
|
+
z24.object({
|
|
5390
|
+
version: z24.string()
|
|
5281
5391
|
})
|
|
5282
5392
|
)
|
|
5283
5393
|
})
|
|
5284
5394
|
)
|
|
5285
5395
|
);
|
|
5286
|
-
var anthropicSkillVersionResponseSchema = (
|
|
5287
|
-
() => (
|
|
5288
|
-
|
|
5289
|
-
type:
|
|
5290
|
-
skill_id:
|
|
5291
|
-
name:
|
|
5292
|
-
description:
|
|
5396
|
+
var anthropicSkillVersionResponseSchema = lazySchema23(
|
|
5397
|
+
() => zodSchema23(
|
|
5398
|
+
z24.object({
|
|
5399
|
+
type: z24.string(),
|
|
5400
|
+
skill_id: z24.string(),
|
|
5401
|
+
name: z24.string().nullish(),
|
|
5402
|
+
description: z24.string().nullish()
|
|
5293
5403
|
})
|
|
5294
5404
|
)
|
|
5295
5405
|
);
|
|
@@ -5304,7 +5414,7 @@ var AnthropicSkills = class {
|
|
|
5304
5414
|
return this.config.provider;
|
|
5305
5415
|
}
|
|
5306
5416
|
async getHeaders() {
|
|
5307
|
-
return (
|
|
5417
|
+
return combineHeaders3(await resolve2(this.config.headers), {
|
|
5308
5418
|
"anthropic-beta": "skills-2025-10-02"
|
|
5309
5419
|
});
|
|
5310
5420
|
}
|
|
@@ -5313,11 +5423,11 @@ var AnthropicSkills = class {
|
|
|
5313
5423
|
version,
|
|
5314
5424
|
headers
|
|
5315
5425
|
}) {
|
|
5316
|
-
const { value: versionResponse } = await
|
|
5426
|
+
const { value: versionResponse } = await getFromApi({
|
|
5317
5427
|
url: `${this.config.baseURL}/skills/${skillId}/versions/${version}`,
|
|
5318
5428
|
headers,
|
|
5319
5429
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
5320
|
-
successfulResponseHandler: (
|
|
5430
|
+
successfulResponseHandler: createJsonResponseHandler3(
|
|
5321
5431
|
anthropicSkillVersionResponseSchema
|
|
5322
5432
|
),
|
|
5323
5433
|
fetch: this.config.fetch
|
|
@@ -5335,16 +5445,16 @@ var AnthropicSkills = class {
|
|
|
5335
5445
|
formData.append("display_title", params.displayTitle);
|
|
5336
5446
|
}
|
|
5337
5447
|
for (const file of params.files) {
|
|
5338
|
-
const content = typeof file.content === "string" ? (
|
|
5448
|
+
const content = typeof file.content === "string" ? convertBase64ToUint8Array3(file.content) : file.content;
|
|
5339
5449
|
formData.append("files[]", new Blob([content]), file.path);
|
|
5340
5450
|
}
|
|
5341
5451
|
const headers = await this.getHeaders();
|
|
5342
|
-
const { value: response } = await (
|
|
5452
|
+
const { value: response } = await postFormDataToApi2({
|
|
5343
5453
|
url: `${this.config.baseURL}/skills`,
|
|
5344
5454
|
headers,
|
|
5345
5455
|
formData,
|
|
5346
5456
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
5347
|
-
successfulResponseHandler: (
|
|
5457
|
+
successfulResponseHandler: createJsonResponseHandler3(
|
|
5348
5458
|
anthropicSkillResponseSchema
|
|
5349
5459
|
),
|
|
5350
5460
|
fetch: this.config.fetch
|
|
@@ -5375,33 +5485,33 @@ var AnthropicSkills = class {
|
|
|
5375
5485
|
};
|
|
5376
5486
|
|
|
5377
5487
|
// src/version.ts
|
|
5378
|
-
var VERSION = true ? "4.0.0-beta.
|
|
5488
|
+
var VERSION = true ? "4.0.0-beta.28" : "0.0.0-test";
|
|
5379
5489
|
|
|
5380
5490
|
// src/anthropic-provider.ts
|
|
5381
5491
|
function createAnthropic(options = {}) {
|
|
5382
5492
|
var _a, _b;
|
|
5383
|
-
const baseURL = (_a =
|
|
5384
|
-
|
|
5493
|
+
const baseURL = (_a = withoutTrailingSlash(
|
|
5494
|
+
loadOptionalSetting({
|
|
5385
5495
|
settingValue: options.baseURL,
|
|
5386
5496
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
5387
5497
|
})
|
|
5388
5498
|
)) != null ? _a : "https://api.anthropic.com/v1";
|
|
5389
5499
|
const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
|
|
5390
5500
|
if (options.apiKey && options.authToken) {
|
|
5391
|
-
throw new
|
|
5501
|
+
throw new InvalidArgumentError({
|
|
5392
5502
|
argument: "apiKey/authToken",
|
|
5393
5503
|
message: "Both apiKey and authToken were provided. Please use only one authentication method."
|
|
5394
5504
|
});
|
|
5395
5505
|
}
|
|
5396
5506
|
const getHeaders = () => {
|
|
5397
5507
|
const authHeaders = options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {
|
|
5398
|
-
"x-api-key":
|
|
5508
|
+
"x-api-key": loadApiKey({
|
|
5399
5509
|
apiKey: options.apiKey,
|
|
5400
5510
|
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
5401
5511
|
description: "Anthropic"
|
|
5402
5512
|
})
|
|
5403
5513
|
};
|
|
5404
|
-
return
|
|
5514
|
+
return withUserAgentSuffix(
|
|
5405
5515
|
{
|
|
5406
5516
|
"anthropic-version": "2023-06-01",
|
|
5407
5517
|
...authHeaders,
|
|
@@ -5417,7 +5527,7 @@ function createAnthropic(options = {}) {
|
|
|
5417
5527
|
baseURL,
|
|
5418
5528
|
headers: getHeaders,
|
|
5419
5529
|
fetch: options.fetch,
|
|
5420
|
-
generateId: (_a2 = options.generateId) != null ? _a2 :
|
|
5530
|
+
generateId: (_a2 = options.generateId) != null ? _a2 : generateId2,
|
|
5421
5531
|
supportedUrls: () => ({
|
|
5422
5532
|
"image/*": [/^https?:\/\/.*$/],
|
|
5423
5533
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
@@ -5443,11 +5553,11 @@ function createAnthropic(options = {}) {
|
|
|
5443
5553
|
provider.chat = createChatModel;
|
|
5444
5554
|
provider.messages = createChatModel;
|
|
5445
5555
|
provider.embeddingModel = (modelId) => {
|
|
5446
|
-
throw new
|
|
5556
|
+
throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
|
|
5447
5557
|
};
|
|
5448
5558
|
provider.textEmbeddingModel = provider.embeddingModel;
|
|
5449
5559
|
provider.imageModel = (modelId) => {
|
|
5450
|
-
throw new
|
|
5560
|
+
throw new NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
5451
5561
|
};
|
|
5452
5562
|
provider.files = () => new AnthropicFiles({
|
|
5453
5563
|
provider: providerName,
|
|
@@ -5480,11 +5590,10 @@ function forwardAnthropicContainerIdFromLastStep({
|
|
|
5480
5590
|
}
|
|
5481
5591
|
return void 0;
|
|
5482
5592
|
}
|
|
5483
|
-
|
|
5484
|
-
0 && (module.exports = {
|
|
5593
|
+
export {
|
|
5485
5594
|
VERSION,
|
|
5486
5595
|
anthropic,
|
|
5487
5596
|
createAnthropic,
|
|
5488
5597
|
forwardAnthropicContainerIdFromLastStep
|
|
5489
|
-
}
|
|
5598
|
+
};
|
|
5490
5599
|
//# sourceMappingURL=index.js.map
|