@ai-sdk/anthropic 4.0.0-beta.3 → 4.0.0-beta.31
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 +230 -4
- package/README.md +2 -0
- package/dist/index.d.ts +60 -34
- package/dist/index.js +1747 -1218
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +67 -36
- package/dist/internal/index.js +1506 -1203
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +105 -4
- package/package.json +9 -12
- package/src/anthropic-files.ts +96 -0
- package/src/anthropic-messages-api.ts +4 -0
- package/src/anthropic-messages-language-model.ts +219 -9
- package/src/anthropic-messages-options.ts +62 -6
- package/src/anthropic-prepare-tools.ts +16 -4
- package/src/anthropic-provider.ts +30 -1
- package/src/convert-to-anthropic-messages-prompt.ts +42 -20
- package/src/internal/index.ts +4 -1
- package/src/skills/anthropic-skills-api.ts +44 -0
- package/src/skills/anthropic-skills.ts +136 -0
- package/dist/index.d.mts +0 -1090
- package/dist/index.mjs +0 -5233
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -960
- package/dist/internal/index.mjs +0 -5125
- package/dist/internal/index.mjs.map +0 -1
package/dist/internal/index.js
CHANGED
|
@@ -1,367 +1,361 @@
|
|
|
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/internal/index.ts
|
|
21
|
-
var internal_exports = {};
|
|
22
|
-
__export(internal_exports, {
|
|
23
|
-
AnthropicMessagesLanguageModel: () => AnthropicMessagesLanguageModel,
|
|
24
|
-
anthropicTools: () => anthropicTools,
|
|
25
|
-
prepareTools: () => prepareTools
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(internal_exports);
|
|
28
|
-
|
|
29
1
|
// src/anthropic-messages-language-model.ts
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
import {
|
|
3
|
+
APICallError
|
|
4
|
+
} from "@ai-sdk/provider";
|
|
5
|
+
import {
|
|
6
|
+
combineHeaders,
|
|
7
|
+
createEventSourceResponseHandler,
|
|
8
|
+
createJsonResponseHandler,
|
|
9
|
+
createToolNameMapping,
|
|
10
|
+
generateId,
|
|
11
|
+
isCustomReasoning,
|
|
12
|
+
mapReasoningToProviderBudget,
|
|
13
|
+
mapReasoningToProviderEffort,
|
|
14
|
+
parseProviderOptions as parseProviderOptions2,
|
|
15
|
+
postJsonToApi,
|
|
16
|
+
resolve,
|
|
17
|
+
resolveProviderReference as resolveProviderReference2,
|
|
18
|
+
serializeModelOptions,
|
|
19
|
+
WORKFLOW_SERIALIZE,
|
|
20
|
+
WORKFLOW_DESERIALIZE
|
|
21
|
+
} from "@ai-sdk/provider-utils";
|
|
32
22
|
|
|
33
23
|
// src/anthropic-error.ts
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
import {
|
|
25
|
+
createJsonErrorResponseHandler,
|
|
26
|
+
lazySchema,
|
|
27
|
+
zodSchema
|
|
28
|
+
} from "@ai-sdk/provider-utils";
|
|
29
|
+
import { z } from "zod/v4";
|
|
30
|
+
var anthropicErrorDataSchema = lazySchema(
|
|
31
|
+
() => zodSchema(
|
|
32
|
+
z.object({
|
|
33
|
+
type: z.literal("error"),
|
|
34
|
+
error: z.object({
|
|
35
|
+
type: z.string(),
|
|
36
|
+
message: z.string()
|
|
43
37
|
})
|
|
44
38
|
})
|
|
45
39
|
)
|
|
46
40
|
);
|
|
47
|
-
var anthropicFailedResponseHandler =
|
|
41
|
+
var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
|
|
48
42
|
errorSchema: anthropicErrorDataSchema,
|
|
49
43
|
errorToMessage: (data) => data.error.message
|
|
50
44
|
});
|
|
51
45
|
|
|
52
46
|
// src/anthropic-messages-api.ts
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var anthropicMessagesResponseSchema = (
|
|
56
|
-
() => (
|
|
57
|
-
|
|
58
|
-
type:
|
|
59
|
-
id:
|
|
60
|
-
model:
|
|
61
|
-
content:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
type:
|
|
65
|
-
text:
|
|
66
|
-
citations:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
type:
|
|
70
|
-
cited_text:
|
|
71
|
-
url:
|
|
72
|
-
title:
|
|
73
|
-
encrypted_index:
|
|
47
|
+
import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
|
|
48
|
+
import { z as z2 } from "zod/v4";
|
|
49
|
+
var anthropicMessagesResponseSchema = lazySchema2(
|
|
50
|
+
() => zodSchema2(
|
|
51
|
+
z2.object({
|
|
52
|
+
type: z2.literal("message"),
|
|
53
|
+
id: z2.string().nullish(),
|
|
54
|
+
model: z2.string().nullish(),
|
|
55
|
+
content: z2.array(
|
|
56
|
+
z2.discriminatedUnion("type", [
|
|
57
|
+
z2.object({
|
|
58
|
+
type: z2.literal("text"),
|
|
59
|
+
text: z2.string(),
|
|
60
|
+
citations: z2.array(
|
|
61
|
+
z2.discriminatedUnion("type", [
|
|
62
|
+
z2.object({
|
|
63
|
+
type: z2.literal("web_search_result_location"),
|
|
64
|
+
cited_text: z2.string(),
|
|
65
|
+
url: z2.string(),
|
|
66
|
+
title: z2.string(),
|
|
67
|
+
encrypted_index: z2.string()
|
|
74
68
|
}),
|
|
75
|
-
|
|
76
|
-
type:
|
|
77
|
-
cited_text:
|
|
78
|
-
document_index:
|
|
79
|
-
document_title:
|
|
80
|
-
start_page_number:
|
|
81
|
-
end_page_number:
|
|
69
|
+
z2.object({
|
|
70
|
+
type: z2.literal("page_location"),
|
|
71
|
+
cited_text: z2.string(),
|
|
72
|
+
document_index: z2.number(),
|
|
73
|
+
document_title: z2.string().nullable(),
|
|
74
|
+
start_page_number: z2.number(),
|
|
75
|
+
end_page_number: z2.number()
|
|
82
76
|
}),
|
|
83
|
-
|
|
84
|
-
type:
|
|
85
|
-
cited_text:
|
|
86
|
-
document_index:
|
|
87
|
-
document_title:
|
|
88
|
-
start_char_index:
|
|
89
|
-
end_char_index:
|
|
77
|
+
z2.object({
|
|
78
|
+
type: z2.literal("char_location"),
|
|
79
|
+
cited_text: z2.string(),
|
|
80
|
+
document_index: z2.number(),
|
|
81
|
+
document_title: z2.string().nullable(),
|
|
82
|
+
start_char_index: z2.number(),
|
|
83
|
+
end_char_index: z2.number()
|
|
90
84
|
})
|
|
91
85
|
])
|
|
92
86
|
).optional()
|
|
93
87
|
}),
|
|
94
|
-
|
|
95
|
-
type:
|
|
96
|
-
thinking:
|
|
97
|
-
signature:
|
|
88
|
+
z2.object({
|
|
89
|
+
type: z2.literal("thinking"),
|
|
90
|
+
thinking: z2.string(),
|
|
91
|
+
signature: z2.string()
|
|
98
92
|
}),
|
|
99
|
-
|
|
100
|
-
type:
|
|
101
|
-
data:
|
|
93
|
+
z2.object({
|
|
94
|
+
type: z2.literal("redacted_thinking"),
|
|
95
|
+
data: z2.string()
|
|
102
96
|
}),
|
|
103
|
-
|
|
104
|
-
type:
|
|
105
|
-
content:
|
|
97
|
+
z2.object({
|
|
98
|
+
type: z2.literal("compaction"),
|
|
99
|
+
content: z2.string()
|
|
106
100
|
}),
|
|
107
|
-
|
|
108
|
-
type:
|
|
109
|
-
id:
|
|
110
|
-
name:
|
|
111
|
-
input:
|
|
101
|
+
z2.object({
|
|
102
|
+
type: z2.literal("tool_use"),
|
|
103
|
+
id: z2.string(),
|
|
104
|
+
name: z2.string(),
|
|
105
|
+
input: z2.unknown(),
|
|
112
106
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
113
|
-
caller:
|
|
114
|
-
|
|
115
|
-
type:
|
|
116
|
-
tool_id:
|
|
107
|
+
caller: z2.union([
|
|
108
|
+
z2.object({
|
|
109
|
+
type: z2.literal("code_execution_20250825"),
|
|
110
|
+
tool_id: z2.string()
|
|
117
111
|
}),
|
|
118
|
-
|
|
119
|
-
type:
|
|
120
|
-
tool_id:
|
|
112
|
+
z2.object({
|
|
113
|
+
type: z2.literal("code_execution_20260120"),
|
|
114
|
+
tool_id: z2.string()
|
|
121
115
|
}),
|
|
122
|
-
|
|
123
|
-
type:
|
|
116
|
+
z2.object({
|
|
117
|
+
type: z2.literal("direct")
|
|
124
118
|
})
|
|
125
119
|
]).optional()
|
|
126
120
|
}),
|
|
127
|
-
|
|
128
|
-
type:
|
|
129
|
-
id:
|
|
130
|
-
name:
|
|
131
|
-
input:
|
|
132
|
-
caller:
|
|
133
|
-
|
|
134
|
-
type:
|
|
135
|
-
tool_id:
|
|
121
|
+
z2.object({
|
|
122
|
+
type: z2.literal("server_tool_use"),
|
|
123
|
+
id: z2.string(),
|
|
124
|
+
name: z2.string(),
|
|
125
|
+
input: z2.record(z2.string(), z2.unknown()).nullish(),
|
|
126
|
+
caller: z2.union([
|
|
127
|
+
z2.object({
|
|
128
|
+
type: z2.literal("code_execution_20260120"),
|
|
129
|
+
tool_id: z2.string()
|
|
136
130
|
}),
|
|
137
|
-
|
|
138
|
-
type:
|
|
131
|
+
z2.object({
|
|
132
|
+
type: z2.literal("direct")
|
|
139
133
|
})
|
|
140
134
|
]).optional()
|
|
141
135
|
}),
|
|
142
|
-
|
|
143
|
-
type:
|
|
144
|
-
id:
|
|
145
|
-
name:
|
|
146
|
-
input:
|
|
147
|
-
server_name:
|
|
136
|
+
z2.object({
|
|
137
|
+
type: z2.literal("mcp_tool_use"),
|
|
138
|
+
id: z2.string(),
|
|
139
|
+
name: z2.string(),
|
|
140
|
+
input: z2.unknown(),
|
|
141
|
+
server_name: z2.string()
|
|
148
142
|
}),
|
|
149
|
-
|
|
150
|
-
type:
|
|
151
|
-
tool_use_id:
|
|
152
|
-
is_error:
|
|
153
|
-
content:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
143
|
+
z2.object({
|
|
144
|
+
type: z2.literal("mcp_tool_result"),
|
|
145
|
+
tool_use_id: z2.string(),
|
|
146
|
+
is_error: z2.boolean(),
|
|
147
|
+
content: z2.array(
|
|
148
|
+
z2.union([
|
|
149
|
+
z2.string(),
|
|
150
|
+
z2.object({ type: z2.literal("text"), text: z2.string() })
|
|
157
151
|
])
|
|
158
152
|
)
|
|
159
153
|
}),
|
|
160
|
-
|
|
161
|
-
type:
|
|
162
|
-
tool_use_id:
|
|
163
|
-
content:
|
|
164
|
-
|
|
165
|
-
type:
|
|
166
|
-
url:
|
|
167
|
-
retrieved_at:
|
|
168
|
-
content:
|
|
169
|
-
type:
|
|
170
|
-
title:
|
|
171
|
-
citations:
|
|
172
|
-
source:
|
|
173
|
-
|
|
174
|
-
type:
|
|
175
|
-
media_type:
|
|
176
|
-
data:
|
|
154
|
+
z2.object({
|
|
155
|
+
type: z2.literal("web_fetch_tool_result"),
|
|
156
|
+
tool_use_id: z2.string(),
|
|
157
|
+
content: z2.union([
|
|
158
|
+
z2.object({
|
|
159
|
+
type: z2.literal("web_fetch_result"),
|
|
160
|
+
url: z2.string(),
|
|
161
|
+
retrieved_at: z2.string(),
|
|
162
|
+
content: z2.object({
|
|
163
|
+
type: z2.literal("document"),
|
|
164
|
+
title: z2.string().nullable(),
|
|
165
|
+
citations: z2.object({ enabled: z2.boolean() }).optional(),
|
|
166
|
+
source: z2.union([
|
|
167
|
+
z2.object({
|
|
168
|
+
type: z2.literal("base64"),
|
|
169
|
+
media_type: z2.literal("application/pdf"),
|
|
170
|
+
data: z2.string()
|
|
177
171
|
}),
|
|
178
|
-
|
|
179
|
-
type:
|
|
180
|
-
media_type:
|
|
181
|
-
data:
|
|
172
|
+
z2.object({
|
|
173
|
+
type: z2.literal("text"),
|
|
174
|
+
media_type: z2.literal("text/plain"),
|
|
175
|
+
data: z2.string()
|
|
182
176
|
})
|
|
183
177
|
])
|
|
184
178
|
})
|
|
185
179
|
}),
|
|
186
|
-
|
|
187
|
-
type:
|
|
188
|
-
error_code:
|
|
180
|
+
z2.object({
|
|
181
|
+
type: z2.literal("web_fetch_tool_result_error"),
|
|
182
|
+
error_code: z2.string()
|
|
189
183
|
})
|
|
190
184
|
])
|
|
191
185
|
}),
|
|
192
|
-
|
|
193
|
-
type:
|
|
194
|
-
tool_use_id:
|
|
195
|
-
content:
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
type:
|
|
199
|
-
url:
|
|
200
|
-
title:
|
|
201
|
-
encrypted_content:
|
|
202
|
-
page_age:
|
|
186
|
+
z2.object({
|
|
187
|
+
type: z2.literal("web_search_tool_result"),
|
|
188
|
+
tool_use_id: z2.string(),
|
|
189
|
+
content: z2.union([
|
|
190
|
+
z2.array(
|
|
191
|
+
z2.object({
|
|
192
|
+
type: z2.literal("web_search_result"),
|
|
193
|
+
url: z2.string(),
|
|
194
|
+
title: z2.string(),
|
|
195
|
+
encrypted_content: z2.string(),
|
|
196
|
+
page_age: z2.string().nullish()
|
|
203
197
|
})
|
|
204
198
|
),
|
|
205
|
-
|
|
206
|
-
type:
|
|
207
|
-
error_code:
|
|
199
|
+
z2.object({
|
|
200
|
+
type: z2.literal("web_search_tool_result_error"),
|
|
201
|
+
error_code: z2.string()
|
|
208
202
|
})
|
|
209
203
|
])
|
|
210
204
|
}),
|
|
211
205
|
// code execution results for code_execution_20250522 tool:
|
|
212
|
-
|
|
213
|
-
type:
|
|
214
|
-
tool_use_id:
|
|
215
|
-
content:
|
|
216
|
-
|
|
217
|
-
type:
|
|
218
|
-
stdout:
|
|
219
|
-
stderr:
|
|
220
|
-
return_code:
|
|
221
|
-
content:
|
|
222
|
-
|
|
223
|
-
type:
|
|
224
|
-
file_id:
|
|
206
|
+
z2.object({
|
|
207
|
+
type: z2.literal("code_execution_tool_result"),
|
|
208
|
+
tool_use_id: z2.string(),
|
|
209
|
+
content: z2.union([
|
|
210
|
+
z2.object({
|
|
211
|
+
type: z2.literal("code_execution_result"),
|
|
212
|
+
stdout: z2.string(),
|
|
213
|
+
stderr: z2.string(),
|
|
214
|
+
return_code: z2.number(),
|
|
215
|
+
content: z2.array(
|
|
216
|
+
z2.object({
|
|
217
|
+
type: z2.literal("code_execution_output"),
|
|
218
|
+
file_id: z2.string()
|
|
225
219
|
})
|
|
226
220
|
).optional().default([])
|
|
227
221
|
}),
|
|
228
|
-
|
|
229
|
-
type:
|
|
230
|
-
encrypted_stdout:
|
|
231
|
-
stderr:
|
|
232
|
-
return_code:
|
|
233
|
-
content:
|
|
234
|
-
|
|
235
|
-
type:
|
|
236
|
-
file_id:
|
|
222
|
+
z2.object({
|
|
223
|
+
type: z2.literal("encrypted_code_execution_result"),
|
|
224
|
+
encrypted_stdout: z2.string(),
|
|
225
|
+
stderr: z2.string(),
|
|
226
|
+
return_code: z2.number(),
|
|
227
|
+
content: z2.array(
|
|
228
|
+
z2.object({
|
|
229
|
+
type: z2.literal("code_execution_output"),
|
|
230
|
+
file_id: z2.string()
|
|
237
231
|
})
|
|
238
232
|
).optional().default([])
|
|
239
233
|
}),
|
|
240
|
-
|
|
241
|
-
type:
|
|
242
|
-
error_code:
|
|
234
|
+
z2.object({
|
|
235
|
+
type: z2.literal("code_execution_tool_result_error"),
|
|
236
|
+
error_code: z2.string()
|
|
243
237
|
})
|
|
244
238
|
])
|
|
245
239
|
}),
|
|
246
240
|
// bash code execution results for code_execution_20250825 tool:
|
|
247
|
-
|
|
248
|
-
type:
|
|
249
|
-
tool_use_id:
|
|
250
|
-
content:
|
|
251
|
-
|
|
252
|
-
type:
|
|
253
|
-
content:
|
|
254
|
-
|
|
255
|
-
type:
|
|
256
|
-
file_id:
|
|
241
|
+
z2.object({
|
|
242
|
+
type: z2.literal("bash_code_execution_tool_result"),
|
|
243
|
+
tool_use_id: z2.string(),
|
|
244
|
+
content: z2.discriminatedUnion("type", [
|
|
245
|
+
z2.object({
|
|
246
|
+
type: z2.literal("bash_code_execution_result"),
|
|
247
|
+
content: z2.array(
|
|
248
|
+
z2.object({
|
|
249
|
+
type: z2.literal("bash_code_execution_output"),
|
|
250
|
+
file_id: z2.string()
|
|
257
251
|
})
|
|
258
252
|
),
|
|
259
|
-
stdout:
|
|
260
|
-
stderr:
|
|
261
|
-
return_code:
|
|
253
|
+
stdout: z2.string(),
|
|
254
|
+
stderr: z2.string(),
|
|
255
|
+
return_code: z2.number()
|
|
262
256
|
}),
|
|
263
|
-
|
|
264
|
-
type:
|
|
265
|
-
error_code:
|
|
257
|
+
z2.object({
|
|
258
|
+
type: z2.literal("bash_code_execution_tool_result_error"),
|
|
259
|
+
error_code: z2.string()
|
|
266
260
|
})
|
|
267
261
|
])
|
|
268
262
|
}),
|
|
269
263
|
// text editor code execution results for code_execution_20250825 tool:
|
|
270
|
-
|
|
271
|
-
type:
|
|
272
|
-
tool_use_id:
|
|
273
|
-
content:
|
|
274
|
-
|
|
275
|
-
type:
|
|
276
|
-
error_code:
|
|
264
|
+
z2.object({
|
|
265
|
+
type: z2.literal("text_editor_code_execution_tool_result"),
|
|
266
|
+
tool_use_id: z2.string(),
|
|
267
|
+
content: z2.discriminatedUnion("type", [
|
|
268
|
+
z2.object({
|
|
269
|
+
type: z2.literal("text_editor_code_execution_tool_result_error"),
|
|
270
|
+
error_code: z2.string()
|
|
277
271
|
}),
|
|
278
|
-
|
|
279
|
-
type:
|
|
280
|
-
content:
|
|
281
|
-
file_type:
|
|
282
|
-
num_lines:
|
|
283
|
-
start_line:
|
|
284
|
-
total_lines:
|
|
272
|
+
z2.object({
|
|
273
|
+
type: z2.literal("text_editor_code_execution_view_result"),
|
|
274
|
+
content: z2.string(),
|
|
275
|
+
file_type: z2.string(),
|
|
276
|
+
num_lines: z2.number().nullable(),
|
|
277
|
+
start_line: z2.number().nullable(),
|
|
278
|
+
total_lines: z2.number().nullable()
|
|
285
279
|
}),
|
|
286
|
-
|
|
287
|
-
type:
|
|
288
|
-
is_file_update:
|
|
280
|
+
z2.object({
|
|
281
|
+
type: z2.literal("text_editor_code_execution_create_result"),
|
|
282
|
+
is_file_update: z2.boolean()
|
|
289
283
|
}),
|
|
290
|
-
|
|
291
|
-
type:
|
|
284
|
+
z2.object({
|
|
285
|
+
type: z2.literal(
|
|
292
286
|
"text_editor_code_execution_str_replace_result"
|
|
293
287
|
),
|
|
294
|
-
lines:
|
|
295
|
-
new_lines:
|
|
296
|
-
new_start:
|
|
297
|
-
old_lines:
|
|
298
|
-
old_start:
|
|
288
|
+
lines: z2.array(z2.string()).nullable(),
|
|
289
|
+
new_lines: z2.number().nullable(),
|
|
290
|
+
new_start: z2.number().nullable(),
|
|
291
|
+
old_lines: z2.number().nullable(),
|
|
292
|
+
old_start: z2.number().nullable()
|
|
299
293
|
})
|
|
300
294
|
])
|
|
301
295
|
}),
|
|
302
296
|
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
303
|
-
|
|
304
|
-
type:
|
|
305
|
-
tool_use_id:
|
|
306
|
-
content:
|
|
307
|
-
|
|
308
|
-
type:
|
|
309
|
-
tool_references:
|
|
310
|
-
|
|
311
|
-
type:
|
|
312
|
-
tool_name:
|
|
297
|
+
z2.object({
|
|
298
|
+
type: z2.literal("tool_search_tool_result"),
|
|
299
|
+
tool_use_id: z2.string(),
|
|
300
|
+
content: z2.union([
|
|
301
|
+
z2.object({
|
|
302
|
+
type: z2.literal("tool_search_tool_search_result"),
|
|
303
|
+
tool_references: z2.array(
|
|
304
|
+
z2.object({
|
|
305
|
+
type: z2.literal("tool_reference"),
|
|
306
|
+
tool_name: z2.string()
|
|
313
307
|
})
|
|
314
308
|
)
|
|
315
309
|
}),
|
|
316
|
-
|
|
317
|
-
type:
|
|
318
|
-
error_code:
|
|
310
|
+
z2.object({
|
|
311
|
+
type: z2.literal("tool_search_tool_result_error"),
|
|
312
|
+
error_code: z2.string()
|
|
319
313
|
})
|
|
320
314
|
])
|
|
321
315
|
})
|
|
322
316
|
])
|
|
323
317
|
),
|
|
324
|
-
stop_reason:
|
|
325
|
-
stop_sequence:
|
|
326
|
-
usage:
|
|
327
|
-
input_tokens:
|
|
328
|
-
output_tokens:
|
|
329
|
-
cache_creation_input_tokens:
|
|
330
|
-
cache_read_input_tokens:
|
|
331
|
-
iterations:
|
|
332
|
-
|
|
333
|
-
type:
|
|
334
|
-
input_tokens:
|
|
335
|
-
output_tokens:
|
|
318
|
+
stop_reason: z2.string().nullish(),
|
|
319
|
+
stop_sequence: z2.string().nullish(),
|
|
320
|
+
usage: z2.looseObject({
|
|
321
|
+
input_tokens: z2.number(),
|
|
322
|
+
output_tokens: z2.number(),
|
|
323
|
+
cache_creation_input_tokens: z2.number().nullish(),
|
|
324
|
+
cache_read_input_tokens: z2.number().nullish(),
|
|
325
|
+
iterations: z2.array(
|
|
326
|
+
z2.object({
|
|
327
|
+
type: z2.union([z2.literal("compaction"), z2.literal("message")]),
|
|
328
|
+
input_tokens: z2.number(),
|
|
329
|
+
output_tokens: z2.number()
|
|
336
330
|
})
|
|
337
331
|
).nullish()
|
|
338
332
|
}),
|
|
339
|
-
container:
|
|
340
|
-
expires_at:
|
|
341
|
-
id:
|
|
342
|
-
skills:
|
|
343
|
-
|
|
344
|
-
type:
|
|
345
|
-
skill_id:
|
|
346
|
-
version:
|
|
333
|
+
container: z2.object({
|
|
334
|
+
expires_at: z2.string(),
|
|
335
|
+
id: z2.string(),
|
|
336
|
+
skills: z2.array(
|
|
337
|
+
z2.object({
|
|
338
|
+
type: z2.union([z2.literal("anthropic"), z2.literal("custom")]),
|
|
339
|
+
skill_id: z2.string(),
|
|
340
|
+
version: z2.string()
|
|
347
341
|
})
|
|
348
342
|
).nullish()
|
|
349
343
|
}).nullish(),
|
|
350
|
-
context_management:
|
|
351
|
-
applied_edits:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
type:
|
|
355
|
-
cleared_tool_uses:
|
|
356
|
-
cleared_input_tokens:
|
|
344
|
+
context_management: z2.object({
|
|
345
|
+
applied_edits: z2.array(
|
|
346
|
+
z2.union([
|
|
347
|
+
z2.object({
|
|
348
|
+
type: z2.literal("clear_tool_uses_20250919"),
|
|
349
|
+
cleared_tool_uses: z2.number(),
|
|
350
|
+
cleared_input_tokens: z2.number()
|
|
357
351
|
}),
|
|
358
|
-
|
|
359
|
-
type:
|
|
360
|
-
cleared_thinking_turns:
|
|
361
|
-
cleared_input_tokens:
|
|
352
|
+
z2.object({
|
|
353
|
+
type: z2.literal("clear_thinking_20251015"),
|
|
354
|
+
cleared_thinking_turns: z2.number(),
|
|
355
|
+
cleared_input_tokens: z2.number()
|
|
362
356
|
}),
|
|
363
|
-
|
|
364
|
-
type:
|
|
357
|
+
z2.object({
|
|
358
|
+
type: z2.literal("compact_20260112")
|
|
365
359
|
})
|
|
366
360
|
])
|
|
367
361
|
)
|
|
@@ -369,457 +363,457 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
369
363
|
})
|
|
370
364
|
)
|
|
371
365
|
);
|
|
372
|
-
var anthropicMessagesChunkSchema = (
|
|
373
|
-
() => (
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
type:
|
|
377
|
-
message:
|
|
378
|
-
id:
|
|
379
|
-
model:
|
|
380
|
-
role:
|
|
381
|
-
usage:
|
|
382
|
-
input_tokens:
|
|
383
|
-
cache_creation_input_tokens:
|
|
384
|
-
cache_read_input_tokens:
|
|
366
|
+
var anthropicMessagesChunkSchema = lazySchema2(
|
|
367
|
+
() => zodSchema2(
|
|
368
|
+
z2.discriminatedUnion("type", [
|
|
369
|
+
z2.object({
|
|
370
|
+
type: z2.literal("message_start"),
|
|
371
|
+
message: z2.object({
|
|
372
|
+
id: z2.string().nullish(),
|
|
373
|
+
model: z2.string().nullish(),
|
|
374
|
+
role: z2.string().nullish(),
|
|
375
|
+
usage: z2.looseObject({
|
|
376
|
+
input_tokens: z2.number(),
|
|
377
|
+
cache_creation_input_tokens: z2.number().nullish(),
|
|
378
|
+
cache_read_input_tokens: z2.number().nullish()
|
|
385
379
|
}),
|
|
386
380
|
// Programmatic tool calling: content may be pre-populated for deferred tool calls
|
|
387
|
-
content:
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
type:
|
|
391
|
-
id:
|
|
392
|
-
name:
|
|
393
|
-
input:
|
|
394
|
-
caller:
|
|
395
|
-
|
|
396
|
-
type:
|
|
397
|
-
tool_id:
|
|
381
|
+
content: z2.array(
|
|
382
|
+
z2.discriminatedUnion("type", [
|
|
383
|
+
z2.object({
|
|
384
|
+
type: z2.literal("tool_use"),
|
|
385
|
+
id: z2.string(),
|
|
386
|
+
name: z2.string(),
|
|
387
|
+
input: z2.unknown(),
|
|
388
|
+
caller: z2.union([
|
|
389
|
+
z2.object({
|
|
390
|
+
type: z2.literal("code_execution_20250825"),
|
|
391
|
+
tool_id: z2.string()
|
|
398
392
|
}),
|
|
399
|
-
|
|
400
|
-
type:
|
|
401
|
-
tool_id:
|
|
393
|
+
z2.object({
|
|
394
|
+
type: z2.literal("code_execution_20260120"),
|
|
395
|
+
tool_id: z2.string()
|
|
402
396
|
}),
|
|
403
|
-
|
|
404
|
-
type:
|
|
397
|
+
z2.object({
|
|
398
|
+
type: z2.literal("direct")
|
|
405
399
|
})
|
|
406
400
|
]).optional()
|
|
407
401
|
})
|
|
408
402
|
])
|
|
409
403
|
).nullish(),
|
|
410
|
-
stop_reason:
|
|
411
|
-
container:
|
|
412
|
-
expires_at:
|
|
413
|
-
id:
|
|
404
|
+
stop_reason: z2.string().nullish(),
|
|
405
|
+
container: z2.object({
|
|
406
|
+
expires_at: z2.string(),
|
|
407
|
+
id: z2.string()
|
|
414
408
|
}).nullish()
|
|
415
409
|
})
|
|
416
410
|
}),
|
|
417
|
-
|
|
418
|
-
type:
|
|
419
|
-
index:
|
|
420
|
-
content_block:
|
|
421
|
-
|
|
422
|
-
type:
|
|
423
|
-
text:
|
|
411
|
+
z2.object({
|
|
412
|
+
type: z2.literal("content_block_start"),
|
|
413
|
+
index: z2.number(),
|
|
414
|
+
content_block: z2.discriminatedUnion("type", [
|
|
415
|
+
z2.object({
|
|
416
|
+
type: z2.literal("text"),
|
|
417
|
+
text: z2.string()
|
|
424
418
|
}),
|
|
425
|
-
|
|
426
|
-
type:
|
|
427
|
-
thinking:
|
|
419
|
+
z2.object({
|
|
420
|
+
type: z2.literal("thinking"),
|
|
421
|
+
thinking: z2.string()
|
|
428
422
|
}),
|
|
429
|
-
|
|
430
|
-
type:
|
|
431
|
-
id:
|
|
432
|
-
name:
|
|
423
|
+
z2.object({
|
|
424
|
+
type: z2.literal("tool_use"),
|
|
425
|
+
id: z2.string(),
|
|
426
|
+
name: z2.string(),
|
|
433
427
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
434
|
-
input:
|
|
428
|
+
input: z2.record(z2.string(), z2.unknown()).optional(),
|
|
435
429
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
436
|
-
caller:
|
|
437
|
-
|
|
438
|
-
type:
|
|
439
|
-
tool_id:
|
|
430
|
+
caller: z2.union([
|
|
431
|
+
z2.object({
|
|
432
|
+
type: z2.literal("code_execution_20250825"),
|
|
433
|
+
tool_id: z2.string()
|
|
440
434
|
}),
|
|
441
|
-
|
|
442
|
-
type:
|
|
443
|
-
tool_id:
|
|
435
|
+
z2.object({
|
|
436
|
+
type: z2.literal("code_execution_20260120"),
|
|
437
|
+
tool_id: z2.string()
|
|
444
438
|
}),
|
|
445
|
-
|
|
446
|
-
type:
|
|
439
|
+
z2.object({
|
|
440
|
+
type: z2.literal("direct")
|
|
447
441
|
})
|
|
448
442
|
]).optional()
|
|
449
443
|
}),
|
|
450
|
-
|
|
451
|
-
type:
|
|
452
|
-
data:
|
|
444
|
+
z2.object({
|
|
445
|
+
type: z2.literal("redacted_thinking"),
|
|
446
|
+
data: z2.string()
|
|
453
447
|
}),
|
|
454
|
-
|
|
455
|
-
type:
|
|
456
|
-
content:
|
|
448
|
+
z2.object({
|
|
449
|
+
type: z2.literal("compaction"),
|
|
450
|
+
content: z2.string().nullish()
|
|
457
451
|
}),
|
|
458
|
-
|
|
459
|
-
type:
|
|
460
|
-
id:
|
|
461
|
-
name:
|
|
462
|
-
input:
|
|
463
|
-
caller:
|
|
464
|
-
|
|
465
|
-
type:
|
|
466
|
-
tool_id:
|
|
452
|
+
z2.object({
|
|
453
|
+
type: z2.literal("server_tool_use"),
|
|
454
|
+
id: z2.string(),
|
|
455
|
+
name: z2.string(),
|
|
456
|
+
input: z2.record(z2.string(), z2.unknown()).nullish(),
|
|
457
|
+
caller: z2.union([
|
|
458
|
+
z2.object({
|
|
459
|
+
type: z2.literal("code_execution_20260120"),
|
|
460
|
+
tool_id: z2.string()
|
|
467
461
|
}),
|
|
468
|
-
|
|
469
|
-
type:
|
|
462
|
+
z2.object({
|
|
463
|
+
type: z2.literal("direct")
|
|
470
464
|
})
|
|
471
465
|
]).optional()
|
|
472
466
|
}),
|
|
473
|
-
|
|
474
|
-
type:
|
|
475
|
-
id:
|
|
476
|
-
name:
|
|
477
|
-
input:
|
|
478
|
-
server_name:
|
|
467
|
+
z2.object({
|
|
468
|
+
type: z2.literal("mcp_tool_use"),
|
|
469
|
+
id: z2.string(),
|
|
470
|
+
name: z2.string(),
|
|
471
|
+
input: z2.unknown(),
|
|
472
|
+
server_name: z2.string()
|
|
479
473
|
}),
|
|
480
|
-
|
|
481
|
-
type:
|
|
482
|
-
tool_use_id:
|
|
483
|
-
is_error:
|
|
484
|
-
content:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
474
|
+
z2.object({
|
|
475
|
+
type: z2.literal("mcp_tool_result"),
|
|
476
|
+
tool_use_id: z2.string(),
|
|
477
|
+
is_error: z2.boolean(),
|
|
478
|
+
content: z2.array(
|
|
479
|
+
z2.union([
|
|
480
|
+
z2.string(),
|
|
481
|
+
z2.object({ type: z2.literal("text"), text: z2.string() })
|
|
488
482
|
])
|
|
489
483
|
)
|
|
490
484
|
}),
|
|
491
|
-
|
|
492
|
-
type:
|
|
493
|
-
tool_use_id:
|
|
494
|
-
content:
|
|
495
|
-
|
|
496
|
-
type:
|
|
497
|
-
url:
|
|
498
|
-
retrieved_at:
|
|
499
|
-
content:
|
|
500
|
-
type:
|
|
501
|
-
title:
|
|
502
|
-
citations:
|
|
503
|
-
source:
|
|
504
|
-
|
|
505
|
-
type:
|
|
506
|
-
media_type:
|
|
507
|
-
data:
|
|
485
|
+
z2.object({
|
|
486
|
+
type: z2.literal("web_fetch_tool_result"),
|
|
487
|
+
tool_use_id: z2.string(),
|
|
488
|
+
content: z2.union([
|
|
489
|
+
z2.object({
|
|
490
|
+
type: z2.literal("web_fetch_result"),
|
|
491
|
+
url: z2.string(),
|
|
492
|
+
retrieved_at: z2.string(),
|
|
493
|
+
content: z2.object({
|
|
494
|
+
type: z2.literal("document"),
|
|
495
|
+
title: z2.string().nullable(),
|
|
496
|
+
citations: z2.object({ enabled: z2.boolean() }).optional(),
|
|
497
|
+
source: z2.union([
|
|
498
|
+
z2.object({
|
|
499
|
+
type: z2.literal("base64"),
|
|
500
|
+
media_type: z2.literal("application/pdf"),
|
|
501
|
+
data: z2.string()
|
|
508
502
|
}),
|
|
509
|
-
|
|
510
|
-
type:
|
|
511
|
-
media_type:
|
|
512
|
-
data:
|
|
503
|
+
z2.object({
|
|
504
|
+
type: z2.literal("text"),
|
|
505
|
+
media_type: z2.literal("text/plain"),
|
|
506
|
+
data: z2.string()
|
|
513
507
|
})
|
|
514
508
|
])
|
|
515
509
|
})
|
|
516
510
|
}),
|
|
517
|
-
|
|
518
|
-
type:
|
|
519
|
-
error_code:
|
|
511
|
+
z2.object({
|
|
512
|
+
type: z2.literal("web_fetch_tool_result_error"),
|
|
513
|
+
error_code: z2.string()
|
|
520
514
|
})
|
|
521
515
|
])
|
|
522
516
|
}),
|
|
523
|
-
|
|
524
|
-
type:
|
|
525
|
-
tool_use_id:
|
|
526
|
-
content:
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
type:
|
|
530
|
-
url:
|
|
531
|
-
title:
|
|
532
|
-
encrypted_content:
|
|
533
|
-
page_age:
|
|
517
|
+
z2.object({
|
|
518
|
+
type: z2.literal("web_search_tool_result"),
|
|
519
|
+
tool_use_id: z2.string(),
|
|
520
|
+
content: z2.union([
|
|
521
|
+
z2.array(
|
|
522
|
+
z2.object({
|
|
523
|
+
type: z2.literal("web_search_result"),
|
|
524
|
+
url: z2.string(),
|
|
525
|
+
title: z2.string(),
|
|
526
|
+
encrypted_content: z2.string(),
|
|
527
|
+
page_age: z2.string().nullish()
|
|
534
528
|
})
|
|
535
529
|
),
|
|
536
|
-
|
|
537
|
-
type:
|
|
538
|
-
error_code:
|
|
530
|
+
z2.object({
|
|
531
|
+
type: z2.literal("web_search_tool_result_error"),
|
|
532
|
+
error_code: z2.string()
|
|
539
533
|
})
|
|
540
534
|
])
|
|
541
535
|
}),
|
|
542
536
|
// code execution results for code_execution_20250522 tool:
|
|
543
|
-
|
|
544
|
-
type:
|
|
545
|
-
tool_use_id:
|
|
546
|
-
content:
|
|
547
|
-
|
|
548
|
-
type:
|
|
549
|
-
stdout:
|
|
550
|
-
stderr:
|
|
551
|
-
return_code:
|
|
552
|
-
content:
|
|
553
|
-
|
|
554
|
-
type:
|
|
555
|
-
file_id:
|
|
537
|
+
z2.object({
|
|
538
|
+
type: z2.literal("code_execution_tool_result"),
|
|
539
|
+
tool_use_id: z2.string(),
|
|
540
|
+
content: z2.union([
|
|
541
|
+
z2.object({
|
|
542
|
+
type: z2.literal("code_execution_result"),
|
|
543
|
+
stdout: z2.string(),
|
|
544
|
+
stderr: z2.string(),
|
|
545
|
+
return_code: z2.number(),
|
|
546
|
+
content: z2.array(
|
|
547
|
+
z2.object({
|
|
548
|
+
type: z2.literal("code_execution_output"),
|
|
549
|
+
file_id: z2.string()
|
|
556
550
|
})
|
|
557
551
|
).optional().default([])
|
|
558
552
|
}),
|
|
559
|
-
|
|
560
|
-
type:
|
|
561
|
-
encrypted_stdout:
|
|
562
|
-
stderr:
|
|
563
|
-
return_code:
|
|
564
|
-
content:
|
|
565
|
-
|
|
566
|
-
type:
|
|
567
|
-
file_id:
|
|
553
|
+
z2.object({
|
|
554
|
+
type: z2.literal("encrypted_code_execution_result"),
|
|
555
|
+
encrypted_stdout: z2.string(),
|
|
556
|
+
stderr: z2.string(),
|
|
557
|
+
return_code: z2.number(),
|
|
558
|
+
content: z2.array(
|
|
559
|
+
z2.object({
|
|
560
|
+
type: z2.literal("code_execution_output"),
|
|
561
|
+
file_id: z2.string()
|
|
568
562
|
})
|
|
569
563
|
).optional().default([])
|
|
570
564
|
}),
|
|
571
|
-
|
|
572
|
-
type:
|
|
573
|
-
error_code:
|
|
565
|
+
z2.object({
|
|
566
|
+
type: z2.literal("code_execution_tool_result_error"),
|
|
567
|
+
error_code: z2.string()
|
|
574
568
|
})
|
|
575
569
|
])
|
|
576
570
|
}),
|
|
577
571
|
// bash code execution results for code_execution_20250825 tool:
|
|
578
|
-
|
|
579
|
-
type:
|
|
580
|
-
tool_use_id:
|
|
581
|
-
content:
|
|
582
|
-
|
|
583
|
-
type:
|
|
584
|
-
content:
|
|
585
|
-
|
|
586
|
-
type:
|
|
587
|
-
file_id:
|
|
572
|
+
z2.object({
|
|
573
|
+
type: z2.literal("bash_code_execution_tool_result"),
|
|
574
|
+
tool_use_id: z2.string(),
|
|
575
|
+
content: z2.discriminatedUnion("type", [
|
|
576
|
+
z2.object({
|
|
577
|
+
type: z2.literal("bash_code_execution_result"),
|
|
578
|
+
content: z2.array(
|
|
579
|
+
z2.object({
|
|
580
|
+
type: z2.literal("bash_code_execution_output"),
|
|
581
|
+
file_id: z2.string()
|
|
588
582
|
})
|
|
589
583
|
),
|
|
590
|
-
stdout:
|
|
591
|
-
stderr:
|
|
592
|
-
return_code:
|
|
584
|
+
stdout: z2.string(),
|
|
585
|
+
stderr: z2.string(),
|
|
586
|
+
return_code: z2.number()
|
|
593
587
|
}),
|
|
594
|
-
|
|
595
|
-
type:
|
|
596
|
-
error_code:
|
|
588
|
+
z2.object({
|
|
589
|
+
type: z2.literal("bash_code_execution_tool_result_error"),
|
|
590
|
+
error_code: z2.string()
|
|
597
591
|
})
|
|
598
592
|
])
|
|
599
593
|
}),
|
|
600
594
|
// text editor code execution results for code_execution_20250825 tool:
|
|
601
|
-
|
|
602
|
-
type:
|
|
603
|
-
tool_use_id:
|
|
604
|
-
content:
|
|
605
|
-
|
|
606
|
-
type:
|
|
607
|
-
error_code:
|
|
595
|
+
z2.object({
|
|
596
|
+
type: z2.literal("text_editor_code_execution_tool_result"),
|
|
597
|
+
tool_use_id: z2.string(),
|
|
598
|
+
content: z2.discriminatedUnion("type", [
|
|
599
|
+
z2.object({
|
|
600
|
+
type: z2.literal("text_editor_code_execution_tool_result_error"),
|
|
601
|
+
error_code: z2.string()
|
|
608
602
|
}),
|
|
609
|
-
|
|
610
|
-
type:
|
|
611
|
-
content:
|
|
612
|
-
file_type:
|
|
613
|
-
num_lines:
|
|
614
|
-
start_line:
|
|
615
|
-
total_lines:
|
|
603
|
+
z2.object({
|
|
604
|
+
type: z2.literal("text_editor_code_execution_view_result"),
|
|
605
|
+
content: z2.string(),
|
|
606
|
+
file_type: z2.string(),
|
|
607
|
+
num_lines: z2.number().nullable(),
|
|
608
|
+
start_line: z2.number().nullable(),
|
|
609
|
+
total_lines: z2.number().nullable()
|
|
616
610
|
}),
|
|
617
|
-
|
|
618
|
-
type:
|
|
619
|
-
is_file_update:
|
|
611
|
+
z2.object({
|
|
612
|
+
type: z2.literal("text_editor_code_execution_create_result"),
|
|
613
|
+
is_file_update: z2.boolean()
|
|
620
614
|
}),
|
|
621
|
-
|
|
622
|
-
type:
|
|
615
|
+
z2.object({
|
|
616
|
+
type: z2.literal(
|
|
623
617
|
"text_editor_code_execution_str_replace_result"
|
|
624
618
|
),
|
|
625
|
-
lines:
|
|
626
|
-
new_lines:
|
|
627
|
-
new_start:
|
|
628
|
-
old_lines:
|
|
629
|
-
old_start:
|
|
619
|
+
lines: z2.array(z2.string()).nullable(),
|
|
620
|
+
new_lines: z2.number().nullable(),
|
|
621
|
+
new_start: z2.number().nullable(),
|
|
622
|
+
old_lines: z2.number().nullable(),
|
|
623
|
+
old_start: z2.number().nullable()
|
|
630
624
|
})
|
|
631
625
|
])
|
|
632
626
|
}),
|
|
633
627
|
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
634
|
-
|
|
635
|
-
type:
|
|
636
|
-
tool_use_id:
|
|
637
|
-
content:
|
|
638
|
-
|
|
639
|
-
type:
|
|
640
|
-
tool_references:
|
|
641
|
-
|
|
642
|
-
type:
|
|
643
|
-
tool_name:
|
|
628
|
+
z2.object({
|
|
629
|
+
type: z2.literal("tool_search_tool_result"),
|
|
630
|
+
tool_use_id: z2.string(),
|
|
631
|
+
content: z2.union([
|
|
632
|
+
z2.object({
|
|
633
|
+
type: z2.literal("tool_search_tool_search_result"),
|
|
634
|
+
tool_references: z2.array(
|
|
635
|
+
z2.object({
|
|
636
|
+
type: z2.literal("tool_reference"),
|
|
637
|
+
tool_name: z2.string()
|
|
644
638
|
})
|
|
645
639
|
)
|
|
646
640
|
}),
|
|
647
|
-
|
|
648
|
-
type:
|
|
649
|
-
error_code:
|
|
641
|
+
z2.object({
|
|
642
|
+
type: z2.literal("tool_search_tool_result_error"),
|
|
643
|
+
error_code: z2.string()
|
|
650
644
|
})
|
|
651
645
|
])
|
|
652
646
|
})
|
|
653
647
|
])
|
|
654
648
|
}),
|
|
655
|
-
|
|
656
|
-
type:
|
|
657
|
-
index:
|
|
658
|
-
delta:
|
|
659
|
-
|
|
660
|
-
type:
|
|
661
|
-
partial_json:
|
|
649
|
+
z2.object({
|
|
650
|
+
type: z2.literal("content_block_delta"),
|
|
651
|
+
index: z2.number(),
|
|
652
|
+
delta: z2.discriminatedUnion("type", [
|
|
653
|
+
z2.object({
|
|
654
|
+
type: z2.literal("input_json_delta"),
|
|
655
|
+
partial_json: z2.string()
|
|
662
656
|
}),
|
|
663
|
-
|
|
664
|
-
type:
|
|
665
|
-
text:
|
|
657
|
+
z2.object({
|
|
658
|
+
type: z2.literal("text_delta"),
|
|
659
|
+
text: z2.string()
|
|
666
660
|
}),
|
|
667
|
-
|
|
668
|
-
type:
|
|
669
|
-
thinking:
|
|
661
|
+
z2.object({
|
|
662
|
+
type: z2.literal("thinking_delta"),
|
|
663
|
+
thinking: z2.string()
|
|
670
664
|
}),
|
|
671
|
-
|
|
672
|
-
type:
|
|
673
|
-
signature:
|
|
665
|
+
z2.object({
|
|
666
|
+
type: z2.literal("signature_delta"),
|
|
667
|
+
signature: z2.string()
|
|
674
668
|
}),
|
|
675
|
-
|
|
676
|
-
type:
|
|
677
|
-
content:
|
|
669
|
+
z2.object({
|
|
670
|
+
type: z2.literal("compaction_delta"),
|
|
671
|
+
content: z2.string().nullish()
|
|
678
672
|
}),
|
|
679
|
-
|
|
680
|
-
type:
|
|
681
|
-
citation:
|
|
682
|
-
|
|
683
|
-
type:
|
|
684
|
-
cited_text:
|
|
685
|
-
url:
|
|
686
|
-
title:
|
|
687
|
-
encrypted_index:
|
|
673
|
+
z2.object({
|
|
674
|
+
type: z2.literal("citations_delta"),
|
|
675
|
+
citation: z2.discriminatedUnion("type", [
|
|
676
|
+
z2.object({
|
|
677
|
+
type: z2.literal("web_search_result_location"),
|
|
678
|
+
cited_text: z2.string(),
|
|
679
|
+
url: z2.string(),
|
|
680
|
+
title: z2.string(),
|
|
681
|
+
encrypted_index: z2.string()
|
|
688
682
|
}),
|
|
689
|
-
|
|
690
|
-
type:
|
|
691
|
-
cited_text:
|
|
692
|
-
document_index:
|
|
693
|
-
document_title:
|
|
694
|
-
start_page_number:
|
|
695
|
-
end_page_number:
|
|
683
|
+
z2.object({
|
|
684
|
+
type: z2.literal("page_location"),
|
|
685
|
+
cited_text: z2.string(),
|
|
686
|
+
document_index: z2.number(),
|
|
687
|
+
document_title: z2.string().nullable(),
|
|
688
|
+
start_page_number: z2.number(),
|
|
689
|
+
end_page_number: z2.number()
|
|
696
690
|
}),
|
|
697
|
-
|
|
698
|
-
type:
|
|
699
|
-
cited_text:
|
|
700
|
-
document_index:
|
|
701
|
-
document_title:
|
|
702
|
-
start_char_index:
|
|
703
|
-
end_char_index:
|
|
691
|
+
z2.object({
|
|
692
|
+
type: z2.literal("char_location"),
|
|
693
|
+
cited_text: z2.string(),
|
|
694
|
+
document_index: z2.number(),
|
|
695
|
+
document_title: z2.string().nullable(),
|
|
696
|
+
start_char_index: z2.number(),
|
|
697
|
+
end_char_index: z2.number()
|
|
704
698
|
})
|
|
705
699
|
])
|
|
706
700
|
})
|
|
707
701
|
])
|
|
708
702
|
}),
|
|
709
|
-
|
|
710
|
-
type:
|
|
711
|
-
index:
|
|
703
|
+
z2.object({
|
|
704
|
+
type: z2.literal("content_block_stop"),
|
|
705
|
+
index: z2.number()
|
|
712
706
|
}),
|
|
713
|
-
|
|
714
|
-
type:
|
|
715
|
-
error:
|
|
716
|
-
type:
|
|
717
|
-
message:
|
|
707
|
+
z2.object({
|
|
708
|
+
type: z2.literal("error"),
|
|
709
|
+
error: z2.object({
|
|
710
|
+
type: z2.string(),
|
|
711
|
+
message: z2.string()
|
|
718
712
|
})
|
|
719
713
|
}),
|
|
720
|
-
|
|
721
|
-
type:
|
|
722
|
-
delta:
|
|
723
|
-
stop_reason:
|
|
724
|
-
stop_sequence:
|
|
725
|
-
container:
|
|
726
|
-
expires_at:
|
|
727
|
-
id:
|
|
728
|
-
skills:
|
|
729
|
-
|
|
730
|
-
type:
|
|
731
|
-
|
|
732
|
-
|
|
714
|
+
z2.object({
|
|
715
|
+
type: z2.literal("message_delta"),
|
|
716
|
+
delta: z2.object({
|
|
717
|
+
stop_reason: z2.string().nullish(),
|
|
718
|
+
stop_sequence: z2.string().nullish(),
|
|
719
|
+
container: z2.object({
|
|
720
|
+
expires_at: z2.string(),
|
|
721
|
+
id: z2.string(),
|
|
722
|
+
skills: z2.array(
|
|
723
|
+
z2.object({
|
|
724
|
+
type: z2.union([
|
|
725
|
+
z2.literal("anthropic"),
|
|
726
|
+
z2.literal("custom")
|
|
733
727
|
]),
|
|
734
|
-
skill_id:
|
|
735
|
-
version:
|
|
728
|
+
skill_id: z2.string(),
|
|
729
|
+
version: z2.string()
|
|
736
730
|
})
|
|
737
731
|
).nullish()
|
|
738
732
|
}).nullish()
|
|
739
733
|
}),
|
|
740
|
-
usage:
|
|
741
|
-
input_tokens:
|
|
742
|
-
output_tokens:
|
|
743
|
-
cache_creation_input_tokens:
|
|
744
|
-
cache_read_input_tokens:
|
|
745
|
-
iterations:
|
|
746
|
-
|
|
747
|
-
type:
|
|
748
|
-
input_tokens:
|
|
749
|
-
output_tokens:
|
|
734
|
+
usage: z2.looseObject({
|
|
735
|
+
input_tokens: z2.number().nullish(),
|
|
736
|
+
output_tokens: z2.number(),
|
|
737
|
+
cache_creation_input_tokens: z2.number().nullish(),
|
|
738
|
+
cache_read_input_tokens: z2.number().nullish(),
|
|
739
|
+
iterations: z2.array(
|
|
740
|
+
z2.object({
|
|
741
|
+
type: z2.union([z2.literal("compaction"), z2.literal("message")]),
|
|
742
|
+
input_tokens: z2.number(),
|
|
743
|
+
output_tokens: z2.number()
|
|
750
744
|
})
|
|
751
745
|
).nullish()
|
|
752
746
|
}),
|
|
753
|
-
context_management:
|
|
754
|
-
applied_edits:
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
type:
|
|
758
|
-
cleared_tool_uses:
|
|
759
|
-
cleared_input_tokens:
|
|
747
|
+
context_management: z2.object({
|
|
748
|
+
applied_edits: z2.array(
|
|
749
|
+
z2.union([
|
|
750
|
+
z2.object({
|
|
751
|
+
type: z2.literal("clear_tool_uses_20250919"),
|
|
752
|
+
cleared_tool_uses: z2.number(),
|
|
753
|
+
cleared_input_tokens: z2.number()
|
|
760
754
|
}),
|
|
761
|
-
|
|
762
|
-
type:
|
|
763
|
-
cleared_thinking_turns:
|
|
764
|
-
cleared_input_tokens:
|
|
755
|
+
z2.object({
|
|
756
|
+
type: z2.literal("clear_thinking_20251015"),
|
|
757
|
+
cleared_thinking_turns: z2.number(),
|
|
758
|
+
cleared_input_tokens: z2.number()
|
|
765
759
|
}),
|
|
766
|
-
|
|
767
|
-
type:
|
|
760
|
+
z2.object({
|
|
761
|
+
type: z2.literal("compact_20260112")
|
|
768
762
|
})
|
|
769
763
|
])
|
|
770
764
|
)
|
|
771
765
|
}).nullish()
|
|
772
766
|
}),
|
|
773
|
-
|
|
774
|
-
type:
|
|
767
|
+
z2.object({
|
|
768
|
+
type: z2.literal("message_stop")
|
|
775
769
|
}),
|
|
776
|
-
|
|
777
|
-
type:
|
|
770
|
+
z2.object({
|
|
771
|
+
type: z2.literal("ping")
|
|
778
772
|
})
|
|
779
773
|
])
|
|
780
774
|
)
|
|
781
775
|
);
|
|
782
|
-
var anthropicReasoningMetadataSchema = (
|
|
783
|
-
() => (
|
|
784
|
-
|
|
785
|
-
signature:
|
|
786
|
-
redactedData:
|
|
776
|
+
var anthropicReasoningMetadataSchema = lazySchema2(
|
|
777
|
+
() => zodSchema2(
|
|
778
|
+
z2.object({
|
|
779
|
+
signature: z2.string().optional(),
|
|
780
|
+
redactedData: z2.string().optional()
|
|
787
781
|
})
|
|
788
782
|
)
|
|
789
783
|
);
|
|
790
784
|
|
|
791
785
|
// src/anthropic-messages-options.ts
|
|
792
|
-
|
|
793
|
-
var anthropicFilePartProviderOptions =
|
|
786
|
+
import { z as z3 } from "zod/v4";
|
|
787
|
+
var anthropicFilePartProviderOptions = z3.object({
|
|
794
788
|
/**
|
|
795
789
|
* Citation configuration for this document.
|
|
796
790
|
* When enabled, this document will generate citations in the response.
|
|
797
791
|
*/
|
|
798
|
-
citations:
|
|
792
|
+
citations: z3.object({
|
|
799
793
|
/**
|
|
800
794
|
* Enable citations for this document
|
|
801
795
|
*/
|
|
802
|
-
enabled:
|
|
796
|
+
enabled: z3.boolean()
|
|
803
797
|
}).optional(),
|
|
804
798
|
/**
|
|
805
799
|
* Custom title for the document.
|
|
806
800
|
* If not provided, the filename will be used.
|
|
807
801
|
*/
|
|
808
|
-
title:
|
|
802
|
+
title: z3.string().optional(),
|
|
809
803
|
/**
|
|
810
804
|
* Context about the document that will be passed to the model
|
|
811
805
|
* but not used towards cited content.
|
|
812
806
|
* Useful for storing document metadata as text or stringified JSON.
|
|
813
807
|
*/
|
|
814
|
-
context:
|
|
808
|
+
context: z3.string().optional()
|
|
815
809
|
});
|
|
816
|
-
var anthropicLanguageModelOptions =
|
|
810
|
+
var anthropicLanguageModelOptions = z3.object({
|
|
817
811
|
/**
|
|
818
812
|
* Whether to send reasoning to the model.
|
|
819
813
|
*
|
|
820
814
|
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
821
815
|
*/
|
|
822
|
-
sendReasoning:
|
|
816
|
+
sendReasoning: z3.boolean().optional(),
|
|
823
817
|
/**
|
|
824
818
|
* Determines how structured outputs are generated.
|
|
825
819
|
*
|
|
@@ -827,52 +821,72 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
827
821
|
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
828
822
|
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
829
823
|
*/
|
|
830
|
-
structuredOutputMode:
|
|
824
|
+
structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
831
825
|
/**
|
|
832
826
|
* Configuration for enabling Claude's extended thinking.
|
|
833
827
|
*
|
|
834
828
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
835
829
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
836
830
|
*/
|
|
837
|
-
thinking:
|
|
838
|
-
|
|
831
|
+
thinking: z3.discriminatedUnion("type", [
|
|
832
|
+
z3.object({
|
|
839
833
|
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
840
|
-
type:
|
|
834
|
+
type: z3.literal("adaptive"),
|
|
835
|
+
/**
|
|
836
|
+
* Controls whether thinking content is included in the response.
|
|
837
|
+
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
838
|
+
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
839
|
+
*/
|
|
840
|
+
display: z3.enum(["omitted", "summarized"]).optional()
|
|
841
841
|
}),
|
|
842
|
-
|
|
842
|
+
z3.object({
|
|
843
843
|
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
844
|
-
type:
|
|
845
|
-
budgetTokens:
|
|
844
|
+
type: z3.literal("enabled"),
|
|
845
|
+
budgetTokens: z3.number().optional()
|
|
846
846
|
}),
|
|
847
|
-
|
|
848
|
-
type:
|
|
847
|
+
z3.object({
|
|
848
|
+
type: z3.literal("disabled")
|
|
849
849
|
})
|
|
850
850
|
]).optional(),
|
|
851
851
|
/**
|
|
852
852
|
* Whether to disable parallel function calling during tool use. Default is false.
|
|
853
853
|
* When set to true, Claude will use at most one tool per response.
|
|
854
854
|
*/
|
|
855
|
-
disableParallelToolUse:
|
|
855
|
+
disableParallelToolUse: z3.boolean().optional(),
|
|
856
856
|
/**
|
|
857
857
|
* Cache control settings for this message.
|
|
858
858
|
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
859
859
|
*/
|
|
860
|
-
cacheControl:
|
|
861
|
-
type:
|
|
862
|
-
ttl:
|
|
860
|
+
cacheControl: z3.object({
|
|
861
|
+
type: z3.literal("ephemeral"),
|
|
862
|
+
ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
|
|
863
|
+
}).optional(),
|
|
864
|
+
/**
|
|
865
|
+
* Metadata to include with the request.
|
|
866
|
+
*
|
|
867
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
868
|
+
*/
|
|
869
|
+
metadata: z3.object({
|
|
870
|
+
/**
|
|
871
|
+
* An external identifier for the user associated with the request.
|
|
872
|
+
*
|
|
873
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
874
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
875
|
+
*/
|
|
876
|
+
userId: z3.string().optional()
|
|
863
877
|
}).optional(),
|
|
864
878
|
/**
|
|
865
879
|
* MCP servers to be utilized in this request.
|
|
866
880
|
*/
|
|
867
|
-
mcpServers:
|
|
868
|
-
|
|
869
|
-
type:
|
|
870
|
-
name:
|
|
871
|
-
url:
|
|
872
|
-
authorizationToken:
|
|
873
|
-
toolConfiguration:
|
|
874
|
-
enabled:
|
|
875
|
-
allowedTools:
|
|
881
|
+
mcpServers: z3.array(
|
|
882
|
+
z3.object({
|
|
883
|
+
type: z3.literal("url"),
|
|
884
|
+
name: z3.string(),
|
|
885
|
+
url: z3.string(),
|
|
886
|
+
authorizationToken: z3.string().nullish(),
|
|
887
|
+
toolConfiguration: z3.object({
|
|
888
|
+
enabled: z3.boolean().nullish(),
|
|
889
|
+
allowedTools: z3.array(z3.string()).nullish()
|
|
876
890
|
}).nullish()
|
|
877
891
|
})
|
|
878
892
|
).optional(),
|
|
@@ -881,14 +895,21 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
881
895
|
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
882
896
|
* Requires code execution tool to be enabled.
|
|
883
897
|
*/
|
|
884
|
-
container:
|
|
885
|
-
id:
|
|
886
|
-
skills:
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
898
|
+
container: z3.object({
|
|
899
|
+
id: z3.string().optional(),
|
|
900
|
+
skills: z3.array(
|
|
901
|
+
z3.discriminatedUnion("type", [
|
|
902
|
+
z3.object({
|
|
903
|
+
type: z3.literal("anthropic"),
|
|
904
|
+
skillId: z3.string(),
|
|
905
|
+
version: z3.string().optional()
|
|
906
|
+
}),
|
|
907
|
+
z3.object({
|
|
908
|
+
type: z3.literal("custom"),
|
|
909
|
+
providerReference: z3.record(z3.string(), z3.string()),
|
|
910
|
+
version: z3.string().optional()
|
|
911
|
+
})
|
|
912
|
+
])
|
|
892
913
|
).optional()
|
|
893
914
|
}).optional(),
|
|
894
915
|
/**
|
|
@@ -899,65 +920,86 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
899
920
|
*
|
|
900
921
|
* @default true
|
|
901
922
|
*/
|
|
902
|
-
toolStreaming:
|
|
923
|
+
toolStreaming: z3.boolean().optional(),
|
|
903
924
|
/**
|
|
904
925
|
* @default 'high'
|
|
905
926
|
*/
|
|
906
|
-
effort:
|
|
927
|
+
effort: z3.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
928
|
+
/**
|
|
929
|
+
* Task budget for agentic turns. Informs the model of the total token budget
|
|
930
|
+
* available for the current task, allowing it to prioritize work and wind down
|
|
931
|
+
* gracefully as the budget is consumed.
|
|
932
|
+
*
|
|
933
|
+
* Advisory only — does not enforce a hard token limit.
|
|
934
|
+
*/
|
|
935
|
+
taskBudget: z3.object({
|
|
936
|
+
type: z3.literal("tokens"),
|
|
937
|
+
total: z3.number().int().min(2e4),
|
|
938
|
+
remaining: z3.number().int().min(0).optional()
|
|
939
|
+
}).optional(),
|
|
907
940
|
/**
|
|
908
941
|
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
909
942
|
* Only supported with claude-opus-4-6.
|
|
910
943
|
*/
|
|
911
|
-
speed:
|
|
944
|
+
speed: z3.enum(["fast", "standard"]).optional(),
|
|
945
|
+
/**
|
|
946
|
+
* Controls where model inference runs for this request.
|
|
947
|
+
*
|
|
948
|
+
* - `"global"`: Inference may run in any available geography (default).
|
|
949
|
+
* - `"us"`: Inference runs only in US-based infrastructure.
|
|
950
|
+
*
|
|
951
|
+
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
952
|
+
*/
|
|
953
|
+
inferenceGeo: z3.enum(["us", "global"]).optional(),
|
|
912
954
|
/**
|
|
913
955
|
* A set of beta features to enable.
|
|
914
956
|
* Allow a provider to receive the full `betas` set if it needs it.
|
|
915
957
|
*/
|
|
916
|
-
anthropicBeta:
|
|
917
|
-
contextManagement:
|
|
918
|
-
edits:
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
type:
|
|
922
|
-
trigger:
|
|
923
|
-
|
|
924
|
-
type:
|
|
925
|
-
value:
|
|
958
|
+
anthropicBeta: z3.array(z3.string()).optional(),
|
|
959
|
+
contextManagement: z3.object({
|
|
960
|
+
edits: z3.array(
|
|
961
|
+
z3.discriminatedUnion("type", [
|
|
962
|
+
z3.object({
|
|
963
|
+
type: z3.literal("clear_tool_uses_20250919"),
|
|
964
|
+
trigger: z3.discriminatedUnion("type", [
|
|
965
|
+
z3.object({
|
|
966
|
+
type: z3.literal("input_tokens"),
|
|
967
|
+
value: z3.number()
|
|
926
968
|
}),
|
|
927
|
-
|
|
928
|
-
type:
|
|
929
|
-
value:
|
|
969
|
+
z3.object({
|
|
970
|
+
type: z3.literal("tool_uses"),
|
|
971
|
+
value: z3.number()
|
|
930
972
|
})
|
|
931
973
|
]).optional(),
|
|
932
|
-
keep:
|
|
933
|
-
type:
|
|
934
|
-
value:
|
|
974
|
+
keep: z3.object({
|
|
975
|
+
type: z3.literal("tool_uses"),
|
|
976
|
+
value: z3.number()
|
|
935
977
|
}).optional(),
|
|
936
|
-
clearAtLeast:
|
|
937
|
-
type:
|
|
938
|
-
value:
|
|
978
|
+
clearAtLeast: z3.object({
|
|
979
|
+
type: z3.literal("input_tokens"),
|
|
980
|
+
value: z3.number()
|
|
939
981
|
}).optional(),
|
|
940
|
-
clearToolInputs:
|
|
941
|
-
excludeTools:
|
|
982
|
+
clearToolInputs: z3.boolean().optional(),
|
|
983
|
+
excludeTools: z3.array(z3.string()).optional()
|
|
942
984
|
}),
|
|
943
|
-
|
|
944
|
-
type:
|
|
945
|
-
keep:
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
type:
|
|
949
|
-
value:
|
|
985
|
+
z3.object({
|
|
986
|
+
type: z3.literal("clear_thinking_20251015"),
|
|
987
|
+
keep: z3.union([
|
|
988
|
+
z3.literal("all"),
|
|
989
|
+
z3.object({
|
|
990
|
+
type: z3.literal("thinking_turns"),
|
|
991
|
+
value: z3.number()
|
|
950
992
|
})
|
|
951
993
|
]).optional()
|
|
952
994
|
}),
|
|
953
|
-
|
|
954
|
-
type:
|
|
955
|
-
trigger:
|
|
956
|
-
type:
|
|
957
|
-
value:
|
|
995
|
+
z3.object({
|
|
996
|
+
type: z3.literal("compact_20260112"),
|
|
997
|
+
trigger: z3.object({
|
|
998
|
+
type: z3.literal("input_tokens"),
|
|
999
|
+
value: z3.number()
|
|
958
1000
|
}).optional(),
|
|
959
|
-
pauseAfterCompaction:
|
|
960
|
-
instructions:
|
|
1001
|
+
pauseAfterCompaction: z3.boolean().optional(),
|
|
1002
|
+
instructions: z3.string().optional()
|
|
961
1003
|
})
|
|
962
1004
|
])
|
|
963
1005
|
)
|
|
@@ -965,7 +1007,9 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
965
1007
|
});
|
|
966
1008
|
|
|
967
1009
|
// src/anthropic-prepare-tools.ts
|
|
968
|
-
|
|
1010
|
+
import {
|
|
1011
|
+
UnsupportedFunctionalityError
|
|
1012
|
+
} from "@ai-sdk/provider";
|
|
969
1013
|
|
|
970
1014
|
// src/get-cache-control.ts
|
|
971
1015
|
var MAX_CACHE_BREAKPOINTS = 4;
|
|
@@ -1010,31 +1054,31 @@ var CacheControlValidator = class {
|
|
|
1010
1054
|
};
|
|
1011
1055
|
|
|
1012
1056
|
// src/tool/text-editor_20250728.ts
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
var textEditor_20250728ArgsSchema = (
|
|
1017
|
-
() => (
|
|
1018
|
-
|
|
1019
|
-
maxCharacters:
|
|
1057
|
+
import { createProviderToolFactory } from "@ai-sdk/provider-utils";
|
|
1058
|
+
import { z as z4 } from "zod/v4";
|
|
1059
|
+
import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
|
|
1060
|
+
var textEditor_20250728ArgsSchema = lazySchema3(
|
|
1061
|
+
() => zodSchema3(
|
|
1062
|
+
z4.object({
|
|
1063
|
+
maxCharacters: z4.number().optional()
|
|
1020
1064
|
})
|
|
1021
1065
|
)
|
|
1022
1066
|
);
|
|
1023
|
-
var textEditor_20250728InputSchema = (
|
|
1024
|
-
() => (
|
|
1025
|
-
|
|
1026
|
-
command:
|
|
1027
|
-
path:
|
|
1028
|
-
file_text:
|
|
1029
|
-
insert_line:
|
|
1030
|
-
new_str:
|
|
1031
|
-
insert_text:
|
|
1032
|
-
old_str:
|
|
1033
|
-
view_range:
|
|
1067
|
+
var textEditor_20250728InputSchema = lazySchema3(
|
|
1068
|
+
() => zodSchema3(
|
|
1069
|
+
z4.object({
|
|
1070
|
+
command: z4.enum(["view", "create", "str_replace", "insert"]),
|
|
1071
|
+
path: z4.string(),
|
|
1072
|
+
file_text: z4.string().optional(),
|
|
1073
|
+
insert_line: z4.number().int().optional(),
|
|
1074
|
+
new_str: z4.string().optional(),
|
|
1075
|
+
insert_text: z4.string().optional(),
|
|
1076
|
+
old_str: z4.string().optional(),
|
|
1077
|
+
view_range: z4.array(z4.number().int()).optional()
|
|
1034
1078
|
})
|
|
1035
1079
|
)
|
|
1036
1080
|
);
|
|
1037
|
-
var factory =
|
|
1081
|
+
var factory = createProviderToolFactory({
|
|
1038
1082
|
id: "anthropic.text_editor_20250728",
|
|
1039
1083
|
inputSchema: textEditor_20250728InputSchema
|
|
1040
1084
|
});
|
|
@@ -1043,45 +1087,49 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1043
1087
|
};
|
|
1044
1088
|
|
|
1045
1089
|
// src/tool/web-search_20260209.ts
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1090
|
+
import {
|
|
1091
|
+
createProviderToolFactoryWithOutputSchema,
|
|
1092
|
+
lazySchema as lazySchema4,
|
|
1093
|
+
zodSchema as zodSchema4
|
|
1094
|
+
} from "@ai-sdk/provider-utils";
|
|
1095
|
+
import { z as z5 } from "zod/v4";
|
|
1096
|
+
var webSearch_20260209ArgsSchema = lazySchema4(
|
|
1097
|
+
() => zodSchema4(
|
|
1098
|
+
z5.object({
|
|
1099
|
+
maxUses: z5.number().optional(),
|
|
1100
|
+
allowedDomains: z5.array(z5.string()).optional(),
|
|
1101
|
+
blockedDomains: z5.array(z5.string()).optional(),
|
|
1102
|
+
userLocation: z5.object({
|
|
1103
|
+
type: z5.literal("approximate"),
|
|
1104
|
+
city: z5.string().optional(),
|
|
1105
|
+
region: z5.string().optional(),
|
|
1106
|
+
country: z5.string().optional(),
|
|
1107
|
+
timezone: z5.string().optional()
|
|
1060
1108
|
}).optional()
|
|
1061
1109
|
})
|
|
1062
1110
|
)
|
|
1063
1111
|
);
|
|
1064
|
-
var webSearch_20260209OutputSchema = (
|
|
1065
|
-
() => (
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
url:
|
|
1069
|
-
title:
|
|
1070
|
-
pageAge:
|
|
1071
|
-
encryptedContent:
|
|
1072
|
-
type:
|
|
1112
|
+
var webSearch_20260209OutputSchema = lazySchema4(
|
|
1113
|
+
() => zodSchema4(
|
|
1114
|
+
z5.array(
|
|
1115
|
+
z5.object({
|
|
1116
|
+
url: z5.string(),
|
|
1117
|
+
title: z5.string().nullable(),
|
|
1118
|
+
pageAge: z5.string().nullable(),
|
|
1119
|
+
encryptedContent: z5.string(),
|
|
1120
|
+
type: z5.literal("web_search_result")
|
|
1073
1121
|
})
|
|
1074
1122
|
)
|
|
1075
1123
|
)
|
|
1076
1124
|
);
|
|
1077
|
-
var webSearch_20260209InputSchema = (
|
|
1078
|
-
() => (
|
|
1079
|
-
|
|
1080
|
-
query:
|
|
1125
|
+
var webSearch_20260209InputSchema = lazySchema4(
|
|
1126
|
+
() => zodSchema4(
|
|
1127
|
+
z5.object({
|
|
1128
|
+
query: z5.string()
|
|
1081
1129
|
})
|
|
1082
1130
|
)
|
|
1083
1131
|
);
|
|
1084
|
-
var factory2 =
|
|
1132
|
+
var factory2 = createProviderToolFactoryWithOutputSchema({
|
|
1085
1133
|
id: "anthropic.web_search_20260209",
|
|
1086
1134
|
inputSchema: webSearch_20260209InputSchema,
|
|
1087
1135
|
outputSchema: webSearch_20260209OutputSchema,
|
|
@@ -1092,45 +1140,49 @@ var webSearch_20260209 = (args = {}) => {
|
|
|
1092
1140
|
};
|
|
1093
1141
|
|
|
1094
1142
|
// src/tool/web-search_20250305.ts
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1143
|
+
import {
|
|
1144
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1145
|
+
lazySchema as lazySchema5,
|
|
1146
|
+
zodSchema as zodSchema5
|
|
1147
|
+
} from "@ai-sdk/provider-utils";
|
|
1148
|
+
import { z as z6 } from "zod/v4";
|
|
1149
|
+
var webSearch_20250305ArgsSchema = lazySchema5(
|
|
1150
|
+
() => zodSchema5(
|
|
1151
|
+
z6.object({
|
|
1152
|
+
maxUses: z6.number().optional(),
|
|
1153
|
+
allowedDomains: z6.array(z6.string()).optional(),
|
|
1154
|
+
blockedDomains: z6.array(z6.string()).optional(),
|
|
1155
|
+
userLocation: z6.object({
|
|
1156
|
+
type: z6.literal("approximate"),
|
|
1157
|
+
city: z6.string().optional(),
|
|
1158
|
+
region: z6.string().optional(),
|
|
1159
|
+
country: z6.string().optional(),
|
|
1160
|
+
timezone: z6.string().optional()
|
|
1109
1161
|
}).optional()
|
|
1110
1162
|
})
|
|
1111
1163
|
)
|
|
1112
1164
|
);
|
|
1113
|
-
var webSearch_20250305OutputSchema = (
|
|
1114
|
-
() => (
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
url:
|
|
1118
|
-
title:
|
|
1119
|
-
pageAge:
|
|
1120
|
-
encryptedContent:
|
|
1121
|
-
type:
|
|
1165
|
+
var webSearch_20250305OutputSchema = lazySchema5(
|
|
1166
|
+
() => zodSchema5(
|
|
1167
|
+
z6.array(
|
|
1168
|
+
z6.object({
|
|
1169
|
+
url: z6.string(),
|
|
1170
|
+
title: z6.string().nullable(),
|
|
1171
|
+
pageAge: z6.string().nullable(),
|
|
1172
|
+
encryptedContent: z6.string(),
|
|
1173
|
+
type: z6.literal("web_search_result")
|
|
1122
1174
|
})
|
|
1123
1175
|
)
|
|
1124
1176
|
)
|
|
1125
1177
|
);
|
|
1126
|
-
var webSearch_20250305InputSchema = (
|
|
1127
|
-
() => (
|
|
1128
|
-
|
|
1129
|
-
query:
|
|
1178
|
+
var webSearch_20250305InputSchema = lazySchema5(
|
|
1179
|
+
() => zodSchema5(
|
|
1180
|
+
z6.object({
|
|
1181
|
+
query: z6.string()
|
|
1130
1182
|
})
|
|
1131
1183
|
)
|
|
1132
1184
|
);
|
|
1133
|
-
var factory3 = (
|
|
1185
|
+
var factory3 = createProviderToolFactoryWithOutputSchema2({
|
|
1134
1186
|
id: "anthropic.web_search_20250305",
|
|
1135
1187
|
inputSchema: webSearch_20250305InputSchema,
|
|
1136
1188
|
outputSchema: webSearch_20250305OutputSchema,
|
|
@@ -1141,53 +1193,57 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1141
1193
|
};
|
|
1142
1194
|
|
|
1143
1195
|
// src/tool/web-fetch-20260209.ts
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1196
|
+
import {
|
|
1197
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1198
|
+
lazySchema as lazySchema6,
|
|
1199
|
+
zodSchema as zodSchema6
|
|
1200
|
+
} from "@ai-sdk/provider-utils";
|
|
1201
|
+
import { z as z7 } from "zod/v4";
|
|
1202
|
+
var webFetch_20260209ArgsSchema = lazySchema6(
|
|
1203
|
+
() => zodSchema6(
|
|
1204
|
+
z7.object({
|
|
1205
|
+
maxUses: z7.number().optional(),
|
|
1206
|
+
allowedDomains: z7.array(z7.string()).optional(),
|
|
1207
|
+
blockedDomains: z7.array(z7.string()).optional(),
|
|
1208
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1209
|
+
maxContentTokens: z7.number().optional()
|
|
1154
1210
|
})
|
|
1155
1211
|
)
|
|
1156
1212
|
);
|
|
1157
|
-
var webFetch_20260209OutputSchema = (
|
|
1158
|
-
() => (
|
|
1159
|
-
|
|
1160
|
-
type:
|
|
1161
|
-
url:
|
|
1162
|
-
content:
|
|
1163
|
-
type:
|
|
1164
|
-
title:
|
|
1165
|
-
citations:
|
|
1166
|
-
source:
|
|
1167
|
-
|
|
1168
|
-
type:
|
|
1169
|
-
mediaType:
|
|
1170
|
-
data:
|
|
1213
|
+
var webFetch_20260209OutputSchema = lazySchema6(
|
|
1214
|
+
() => zodSchema6(
|
|
1215
|
+
z7.object({
|
|
1216
|
+
type: z7.literal("web_fetch_result"),
|
|
1217
|
+
url: z7.string(),
|
|
1218
|
+
content: z7.object({
|
|
1219
|
+
type: z7.literal("document"),
|
|
1220
|
+
title: z7.string().nullable(),
|
|
1221
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1222
|
+
source: z7.union([
|
|
1223
|
+
z7.object({
|
|
1224
|
+
type: z7.literal("base64"),
|
|
1225
|
+
mediaType: z7.literal("application/pdf"),
|
|
1226
|
+
data: z7.string()
|
|
1171
1227
|
}),
|
|
1172
|
-
|
|
1173
|
-
type:
|
|
1174
|
-
mediaType:
|
|
1175
|
-
data:
|
|
1228
|
+
z7.object({
|
|
1229
|
+
type: z7.literal("text"),
|
|
1230
|
+
mediaType: z7.literal("text/plain"),
|
|
1231
|
+
data: z7.string()
|
|
1176
1232
|
})
|
|
1177
1233
|
])
|
|
1178
1234
|
}),
|
|
1179
|
-
retrievedAt:
|
|
1235
|
+
retrievedAt: z7.string().nullable()
|
|
1180
1236
|
})
|
|
1181
1237
|
)
|
|
1182
1238
|
);
|
|
1183
|
-
var webFetch_20260209InputSchema = (
|
|
1184
|
-
() => (
|
|
1185
|
-
|
|
1186
|
-
url:
|
|
1239
|
+
var webFetch_20260209InputSchema = lazySchema6(
|
|
1240
|
+
() => zodSchema6(
|
|
1241
|
+
z7.object({
|
|
1242
|
+
url: z7.string()
|
|
1187
1243
|
})
|
|
1188
1244
|
)
|
|
1189
1245
|
);
|
|
1190
|
-
var factory4 = (
|
|
1246
|
+
var factory4 = createProviderToolFactoryWithOutputSchema3({
|
|
1191
1247
|
id: "anthropic.web_fetch_20260209",
|
|
1192
1248
|
inputSchema: webFetch_20260209InputSchema,
|
|
1193
1249
|
outputSchema: webFetch_20260209OutputSchema,
|
|
@@ -1198,53 +1254,57 @@ var webFetch_20260209 = (args = {}) => {
|
|
|
1198
1254
|
};
|
|
1199
1255
|
|
|
1200
1256
|
// src/tool/web-fetch-20250910.ts
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1257
|
+
import {
|
|
1258
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1259
|
+
lazySchema as lazySchema7,
|
|
1260
|
+
zodSchema as zodSchema7
|
|
1261
|
+
} from "@ai-sdk/provider-utils";
|
|
1262
|
+
import { z as z8 } from "zod/v4";
|
|
1263
|
+
var webFetch_20250910ArgsSchema = lazySchema7(
|
|
1264
|
+
() => zodSchema7(
|
|
1265
|
+
z8.object({
|
|
1266
|
+
maxUses: z8.number().optional(),
|
|
1267
|
+
allowedDomains: z8.array(z8.string()).optional(),
|
|
1268
|
+
blockedDomains: z8.array(z8.string()).optional(),
|
|
1269
|
+
citations: z8.object({ enabled: z8.boolean() }).optional(),
|
|
1270
|
+
maxContentTokens: z8.number().optional()
|
|
1211
1271
|
})
|
|
1212
1272
|
)
|
|
1213
1273
|
);
|
|
1214
|
-
var webFetch_20250910OutputSchema = (
|
|
1215
|
-
() => (
|
|
1216
|
-
|
|
1217
|
-
type:
|
|
1218
|
-
url:
|
|
1219
|
-
content:
|
|
1220
|
-
type:
|
|
1221
|
-
title:
|
|
1222
|
-
citations:
|
|
1223
|
-
source:
|
|
1224
|
-
|
|
1225
|
-
type:
|
|
1226
|
-
mediaType:
|
|
1227
|
-
data:
|
|
1274
|
+
var webFetch_20250910OutputSchema = lazySchema7(
|
|
1275
|
+
() => zodSchema7(
|
|
1276
|
+
z8.object({
|
|
1277
|
+
type: z8.literal("web_fetch_result"),
|
|
1278
|
+
url: z8.string(),
|
|
1279
|
+
content: z8.object({
|
|
1280
|
+
type: z8.literal("document"),
|
|
1281
|
+
title: z8.string().nullable(),
|
|
1282
|
+
citations: z8.object({ enabled: z8.boolean() }).optional(),
|
|
1283
|
+
source: z8.union([
|
|
1284
|
+
z8.object({
|
|
1285
|
+
type: z8.literal("base64"),
|
|
1286
|
+
mediaType: z8.literal("application/pdf"),
|
|
1287
|
+
data: z8.string()
|
|
1228
1288
|
}),
|
|
1229
|
-
|
|
1230
|
-
type:
|
|
1231
|
-
mediaType:
|
|
1232
|
-
data:
|
|
1289
|
+
z8.object({
|
|
1290
|
+
type: z8.literal("text"),
|
|
1291
|
+
mediaType: z8.literal("text/plain"),
|
|
1292
|
+
data: z8.string()
|
|
1233
1293
|
})
|
|
1234
1294
|
])
|
|
1235
1295
|
}),
|
|
1236
|
-
retrievedAt:
|
|
1296
|
+
retrievedAt: z8.string().nullable()
|
|
1237
1297
|
})
|
|
1238
1298
|
)
|
|
1239
1299
|
);
|
|
1240
|
-
var webFetch_20250910InputSchema = (
|
|
1241
|
-
() => (
|
|
1242
|
-
|
|
1243
|
-
url:
|
|
1300
|
+
var webFetch_20250910InputSchema = lazySchema7(
|
|
1301
|
+
() => zodSchema7(
|
|
1302
|
+
z8.object({
|
|
1303
|
+
url: z8.string()
|
|
1244
1304
|
})
|
|
1245
1305
|
)
|
|
1246
1306
|
);
|
|
1247
|
-
var factory5 = (
|
|
1307
|
+
var factory5 = createProviderToolFactoryWithOutputSchema4({
|
|
1248
1308
|
id: "anthropic.web_fetch_20250910",
|
|
1249
1309
|
inputSchema: webFetch_20250910InputSchema,
|
|
1250
1310
|
outputSchema: webFetch_20250910OutputSchema,
|
|
@@ -1255,13 +1315,14 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1255
1315
|
};
|
|
1256
1316
|
|
|
1257
1317
|
// src/anthropic-prepare-tools.ts
|
|
1258
|
-
|
|
1318
|
+
import { validateTypes } from "@ai-sdk/provider-utils";
|
|
1259
1319
|
async function prepareTools({
|
|
1260
1320
|
tools,
|
|
1261
1321
|
toolChoice,
|
|
1262
1322
|
disableParallelToolUse,
|
|
1263
1323
|
cacheControlValidator,
|
|
1264
|
-
supportsStructuredOutput
|
|
1324
|
+
supportsStructuredOutput,
|
|
1325
|
+
supportsStrictTools
|
|
1265
1326
|
}) {
|
|
1266
1327
|
var _a;
|
|
1267
1328
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -1283,13 +1344,20 @@ async function prepareTools({
|
|
|
1283
1344
|
const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
|
|
1284
1345
|
const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
|
|
1285
1346
|
const allowedCallers = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers;
|
|
1347
|
+
if (!supportsStrictTools && tool.strict != null) {
|
|
1348
|
+
toolWarnings.push({
|
|
1349
|
+
type: "unsupported",
|
|
1350
|
+
feature: "strict",
|
|
1351
|
+
details: `Tool '${tool.name}' has strict: ${tool.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1286
1354
|
anthropicTools2.push({
|
|
1287
1355
|
name: tool.name,
|
|
1288
1356
|
description: tool.description,
|
|
1289
1357
|
input_schema: tool.inputSchema,
|
|
1290
1358
|
cache_control: cacheControl,
|
|
1291
1359
|
...eagerInputStreaming ? { eager_input_streaming: true } : {},
|
|
1292
|
-
...
|
|
1360
|
+
...supportsStrictTools === true && tool.strict != null ? { strict: tool.strict } : {},
|
|
1293
1361
|
...deferLoading != null ? { defer_loading: deferLoading } : {},
|
|
1294
1362
|
...allowedCallers != null ? { allowed_callers: allowedCallers } : {},
|
|
1295
1363
|
...tool.inputExamples != null ? {
|
|
@@ -1397,7 +1465,7 @@ async function prepareTools({
|
|
|
1397
1465
|
break;
|
|
1398
1466
|
}
|
|
1399
1467
|
case "anthropic.text_editor_20250728": {
|
|
1400
|
-
const args = await
|
|
1468
|
+
const args = await validateTypes({
|
|
1401
1469
|
value: tool.args,
|
|
1402
1470
|
schema: textEditor_20250728ArgsSchema
|
|
1403
1471
|
});
|
|
@@ -1437,7 +1505,7 @@ async function prepareTools({
|
|
|
1437
1505
|
}
|
|
1438
1506
|
case "anthropic.web_fetch_20250910": {
|
|
1439
1507
|
betas.add("web-fetch-2025-09-10");
|
|
1440
|
-
const args = await
|
|
1508
|
+
const args = await validateTypes({
|
|
1441
1509
|
value: tool.args,
|
|
1442
1510
|
schema: webFetch_20250910ArgsSchema
|
|
1443
1511
|
});
|
|
@@ -1455,7 +1523,7 @@ async function prepareTools({
|
|
|
1455
1523
|
}
|
|
1456
1524
|
case "anthropic.web_fetch_20260209": {
|
|
1457
1525
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1458
|
-
const args = await
|
|
1526
|
+
const args = await validateTypes({
|
|
1459
1527
|
value: tool.args,
|
|
1460
1528
|
schema: webFetch_20260209ArgsSchema
|
|
1461
1529
|
});
|
|
@@ -1472,7 +1540,7 @@ async function prepareTools({
|
|
|
1472
1540
|
break;
|
|
1473
1541
|
}
|
|
1474
1542
|
case "anthropic.web_search_20250305": {
|
|
1475
|
-
const args = await
|
|
1543
|
+
const args = await validateTypes({
|
|
1476
1544
|
value: tool.args,
|
|
1477
1545
|
schema: webSearch_20250305ArgsSchema
|
|
1478
1546
|
});
|
|
@@ -1489,7 +1557,7 @@ async function prepareTools({
|
|
|
1489
1557
|
}
|
|
1490
1558
|
case "anthropic.web_search_20260209": {
|
|
1491
1559
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1492
|
-
const args = await
|
|
1560
|
+
const args = await validateTypes({
|
|
1493
1561
|
value: tool.args,
|
|
1494
1562
|
schema: webSearch_20260209ArgsSchema
|
|
1495
1563
|
});
|
|
@@ -1505,7 +1573,6 @@ async function prepareTools({
|
|
|
1505
1573
|
break;
|
|
1506
1574
|
}
|
|
1507
1575
|
case "anthropic.tool_search_regex_20251119": {
|
|
1508
|
-
betas.add("advanced-tool-use-2025-11-20");
|
|
1509
1576
|
anthropicTools2.push({
|
|
1510
1577
|
type: "tool_search_tool_regex_20251119",
|
|
1511
1578
|
name: "tool_search_tool_regex"
|
|
@@ -1513,7 +1580,6 @@ async function prepareTools({
|
|
|
1513
1580
|
break;
|
|
1514
1581
|
}
|
|
1515
1582
|
case "anthropic.tool_search_bm25_20251119": {
|
|
1516
|
-
betas.add("advanced-tool-use-2025-11-20");
|
|
1517
1583
|
anthropicTools2.push({
|
|
1518
1584
|
type: "tool_search_tool_bm25_20251119",
|
|
1519
1585
|
name: "tool_search_tool_bm25"
|
|
@@ -1584,7 +1650,7 @@ async function prepareTools({
|
|
|
1584
1650
|
};
|
|
1585
1651
|
default: {
|
|
1586
1652
|
const _exhaustiveCheck = type;
|
|
1587
|
-
throw new
|
|
1653
|
+
throw new UnsupportedFunctionalityError({
|
|
1588
1654
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
1589
1655
|
});
|
|
1590
1656
|
}
|
|
@@ -1632,36 +1698,50 @@ function convertAnthropicMessagesUsage({
|
|
|
1632
1698
|
}
|
|
1633
1699
|
|
|
1634
1700
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1635
|
-
|
|
1636
|
-
|
|
1701
|
+
import {
|
|
1702
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
1703
|
+
} from "@ai-sdk/provider";
|
|
1704
|
+
import {
|
|
1705
|
+
convertBase64ToUint8Array,
|
|
1706
|
+
convertToBase64,
|
|
1707
|
+
isProviderReference,
|
|
1708
|
+
parseProviderOptions,
|
|
1709
|
+
resolveProviderReference,
|
|
1710
|
+
validateTypes as validateTypes2,
|
|
1711
|
+
isNonNullable
|
|
1712
|
+
} from "@ai-sdk/provider-utils";
|
|
1637
1713
|
|
|
1638
1714
|
// src/tool/code-execution_20250522.ts
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1715
|
+
import {
|
|
1716
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1717
|
+
lazySchema as lazySchema8,
|
|
1718
|
+
zodSchema as zodSchema8
|
|
1719
|
+
} from "@ai-sdk/provider-utils";
|
|
1720
|
+
import { z as z9 } from "zod/v4";
|
|
1721
|
+
var codeExecution_20250522OutputSchema = lazySchema8(
|
|
1722
|
+
() => zodSchema8(
|
|
1723
|
+
z9.object({
|
|
1724
|
+
type: z9.literal("code_execution_result"),
|
|
1725
|
+
stdout: z9.string(),
|
|
1726
|
+
stderr: z9.string(),
|
|
1727
|
+
return_code: z9.number(),
|
|
1728
|
+
content: z9.array(
|
|
1729
|
+
z9.object({
|
|
1730
|
+
type: z9.literal("code_execution_output"),
|
|
1731
|
+
file_id: z9.string()
|
|
1652
1732
|
})
|
|
1653
1733
|
).optional().default([])
|
|
1654
1734
|
})
|
|
1655
1735
|
)
|
|
1656
1736
|
);
|
|
1657
|
-
var codeExecution_20250522InputSchema = (
|
|
1658
|
-
() => (
|
|
1659
|
-
|
|
1660
|
-
code:
|
|
1737
|
+
var codeExecution_20250522InputSchema = lazySchema8(
|
|
1738
|
+
() => zodSchema8(
|
|
1739
|
+
z9.object({
|
|
1740
|
+
code: z9.string()
|
|
1661
1741
|
})
|
|
1662
1742
|
)
|
|
1663
1743
|
);
|
|
1664
|
-
var factory6 = (
|
|
1744
|
+
var factory6 = createProviderToolFactoryWithOutputSchema5({
|
|
1665
1745
|
id: "anthropic.code_execution_20250522",
|
|
1666
1746
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1667
1747
|
outputSchema: codeExecution_20250522OutputSchema
|
|
@@ -1671,102 +1751,106 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1671
1751
|
};
|
|
1672
1752
|
|
|
1673
1753
|
// src/tool/code-execution_20250825.ts
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1754
|
+
import {
|
|
1755
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
1756
|
+
lazySchema as lazySchema9,
|
|
1757
|
+
zodSchema as zodSchema9
|
|
1758
|
+
} from "@ai-sdk/provider-utils";
|
|
1759
|
+
import { z as z10 } from "zod/v4";
|
|
1760
|
+
var codeExecution_20250825OutputSchema = lazySchema9(
|
|
1761
|
+
() => zodSchema9(
|
|
1762
|
+
z10.discriminatedUnion("type", [
|
|
1763
|
+
z10.object({
|
|
1764
|
+
type: z10.literal("code_execution_result"),
|
|
1765
|
+
stdout: z10.string(),
|
|
1766
|
+
stderr: z10.string(),
|
|
1767
|
+
return_code: z10.number(),
|
|
1768
|
+
content: z10.array(
|
|
1769
|
+
z10.object({
|
|
1770
|
+
type: z10.literal("code_execution_output"),
|
|
1771
|
+
file_id: z10.string()
|
|
1688
1772
|
})
|
|
1689
1773
|
).optional().default([])
|
|
1690
1774
|
}),
|
|
1691
|
-
|
|
1692
|
-
type:
|
|
1693
|
-
content:
|
|
1694
|
-
|
|
1695
|
-
type:
|
|
1696
|
-
file_id:
|
|
1775
|
+
z10.object({
|
|
1776
|
+
type: z10.literal("bash_code_execution_result"),
|
|
1777
|
+
content: z10.array(
|
|
1778
|
+
z10.object({
|
|
1779
|
+
type: z10.literal("bash_code_execution_output"),
|
|
1780
|
+
file_id: z10.string()
|
|
1697
1781
|
})
|
|
1698
1782
|
),
|
|
1699
|
-
stdout:
|
|
1700
|
-
stderr:
|
|
1701
|
-
return_code:
|
|
1783
|
+
stdout: z10.string(),
|
|
1784
|
+
stderr: z10.string(),
|
|
1785
|
+
return_code: z10.number()
|
|
1702
1786
|
}),
|
|
1703
|
-
|
|
1704
|
-
type:
|
|
1705
|
-
error_code:
|
|
1787
|
+
z10.object({
|
|
1788
|
+
type: z10.literal("bash_code_execution_tool_result_error"),
|
|
1789
|
+
error_code: z10.string()
|
|
1706
1790
|
}),
|
|
1707
|
-
|
|
1708
|
-
type:
|
|
1709
|
-
error_code:
|
|
1791
|
+
z10.object({
|
|
1792
|
+
type: z10.literal("text_editor_code_execution_tool_result_error"),
|
|
1793
|
+
error_code: z10.string()
|
|
1710
1794
|
}),
|
|
1711
|
-
|
|
1712
|
-
type:
|
|
1713
|
-
content:
|
|
1714
|
-
file_type:
|
|
1715
|
-
num_lines:
|
|
1716
|
-
start_line:
|
|
1717
|
-
total_lines:
|
|
1795
|
+
z10.object({
|
|
1796
|
+
type: z10.literal("text_editor_code_execution_view_result"),
|
|
1797
|
+
content: z10.string(),
|
|
1798
|
+
file_type: z10.string(),
|
|
1799
|
+
num_lines: z10.number().nullable(),
|
|
1800
|
+
start_line: z10.number().nullable(),
|
|
1801
|
+
total_lines: z10.number().nullable()
|
|
1718
1802
|
}),
|
|
1719
|
-
|
|
1720
|
-
type:
|
|
1721
|
-
is_file_update:
|
|
1803
|
+
z10.object({
|
|
1804
|
+
type: z10.literal("text_editor_code_execution_create_result"),
|
|
1805
|
+
is_file_update: z10.boolean()
|
|
1722
1806
|
}),
|
|
1723
|
-
|
|
1724
|
-
type:
|
|
1725
|
-
lines:
|
|
1726
|
-
new_lines:
|
|
1727
|
-
new_start:
|
|
1728
|
-
old_lines:
|
|
1729
|
-
old_start:
|
|
1807
|
+
z10.object({
|
|
1808
|
+
type: z10.literal("text_editor_code_execution_str_replace_result"),
|
|
1809
|
+
lines: z10.array(z10.string()).nullable(),
|
|
1810
|
+
new_lines: z10.number().nullable(),
|
|
1811
|
+
new_start: z10.number().nullable(),
|
|
1812
|
+
old_lines: z10.number().nullable(),
|
|
1813
|
+
old_start: z10.number().nullable()
|
|
1730
1814
|
})
|
|
1731
1815
|
])
|
|
1732
1816
|
)
|
|
1733
1817
|
);
|
|
1734
|
-
var codeExecution_20250825InputSchema = (
|
|
1735
|
-
() => (
|
|
1736
|
-
|
|
1818
|
+
var codeExecution_20250825InputSchema = lazySchema9(
|
|
1819
|
+
() => zodSchema9(
|
|
1820
|
+
z10.discriminatedUnion("type", [
|
|
1737
1821
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1738
|
-
|
|
1739
|
-
type:
|
|
1740
|
-
code:
|
|
1822
|
+
z10.object({
|
|
1823
|
+
type: z10.literal("programmatic-tool-call"),
|
|
1824
|
+
code: z10.string()
|
|
1741
1825
|
}),
|
|
1742
|
-
|
|
1743
|
-
type:
|
|
1744
|
-
command:
|
|
1826
|
+
z10.object({
|
|
1827
|
+
type: z10.literal("bash_code_execution"),
|
|
1828
|
+
command: z10.string()
|
|
1745
1829
|
}),
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
type:
|
|
1749
|
-
command:
|
|
1750
|
-
path:
|
|
1830
|
+
z10.discriminatedUnion("command", [
|
|
1831
|
+
z10.object({
|
|
1832
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1833
|
+
command: z10.literal("view"),
|
|
1834
|
+
path: z10.string()
|
|
1751
1835
|
}),
|
|
1752
|
-
|
|
1753
|
-
type:
|
|
1754
|
-
command:
|
|
1755
|
-
path:
|
|
1756
|
-
file_text:
|
|
1836
|
+
z10.object({
|
|
1837
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1838
|
+
command: z10.literal("create"),
|
|
1839
|
+
path: z10.string(),
|
|
1840
|
+
file_text: z10.string().nullish()
|
|
1757
1841
|
}),
|
|
1758
|
-
|
|
1759
|
-
type:
|
|
1760
|
-
command:
|
|
1761
|
-
path:
|
|
1762
|
-
old_str:
|
|
1763
|
-
new_str:
|
|
1842
|
+
z10.object({
|
|
1843
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1844
|
+
command: z10.literal("str_replace"),
|
|
1845
|
+
path: z10.string(),
|
|
1846
|
+
old_str: z10.string(),
|
|
1847
|
+
new_str: z10.string()
|
|
1764
1848
|
})
|
|
1765
1849
|
])
|
|
1766
1850
|
])
|
|
1767
1851
|
)
|
|
1768
1852
|
);
|
|
1769
|
-
var factory7 = (
|
|
1853
|
+
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
1770
1854
|
id: "anthropic.code_execution_20250825",
|
|
1771
1855
|
inputSchema: codeExecution_20250825InputSchema,
|
|
1772
1856
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -1780,113 +1864,117 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
1780
1864
|
};
|
|
1781
1865
|
|
|
1782
1866
|
// src/tool/code-execution_20260120.ts
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1867
|
+
import {
|
|
1868
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
1869
|
+
lazySchema as lazySchema10,
|
|
1870
|
+
zodSchema as zodSchema10
|
|
1871
|
+
} from "@ai-sdk/provider-utils";
|
|
1872
|
+
import { z as z11 } from "zod/v4";
|
|
1873
|
+
var codeExecution_20260120OutputSchema = lazySchema10(
|
|
1874
|
+
() => zodSchema10(
|
|
1875
|
+
z11.discriminatedUnion("type", [
|
|
1876
|
+
z11.object({
|
|
1877
|
+
type: z11.literal("code_execution_result"),
|
|
1878
|
+
stdout: z11.string(),
|
|
1879
|
+
stderr: z11.string(),
|
|
1880
|
+
return_code: z11.number(),
|
|
1881
|
+
content: z11.array(
|
|
1882
|
+
z11.object({
|
|
1883
|
+
type: z11.literal("code_execution_output"),
|
|
1884
|
+
file_id: z11.string()
|
|
1797
1885
|
})
|
|
1798
1886
|
).optional().default([])
|
|
1799
1887
|
}),
|
|
1800
|
-
|
|
1801
|
-
type:
|
|
1802
|
-
encrypted_stdout:
|
|
1803
|
-
stderr:
|
|
1804
|
-
return_code:
|
|
1805
|
-
content:
|
|
1806
|
-
|
|
1807
|
-
type:
|
|
1808
|
-
file_id:
|
|
1888
|
+
z11.object({
|
|
1889
|
+
type: z11.literal("encrypted_code_execution_result"),
|
|
1890
|
+
encrypted_stdout: z11.string(),
|
|
1891
|
+
stderr: z11.string(),
|
|
1892
|
+
return_code: z11.number(),
|
|
1893
|
+
content: z11.array(
|
|
1894
|
+
z11.object({
|
|
1895
|
+
type: z11.literal("code_execution_output"),
|
|
1896
|
+
file_id: z11.string()
|
|
1809
1897
|
})
|
|
1810
1898
|
).optional().default([])
|
|
1811
1899
|
}),
|
|
1812
|
-
|
|
1813
|
-
type:
|
|
1814
|
-
content:
|
|
1815
|
-
|
|
1816
|
-
type:
|
|
1817
|
-
file_id:
|
|
1900
|
+
z11.object({
|
|
1901
|
+
type: z11.literal("bash_code_execution_result"),
|
|
1902
|
+
content: z11.array(
|
|
1903
|
+
z11.object({
|
|
1904
|
+
type: z11.literal("bash_code_execution_output"),
|
|
1905
|
+
file_id: z11.string()
|
|
1818
1906
|
})
|
|
1819
1907
|
),
|
|
1820
|
-
stdout:
|
|
1821
|
-
stderr:
|
|
1822
|
-
return_code:
|
|
1908
|
+
stdout: z11.string(),
|
|
1909
|
+
stderr: z11.string(),
|
|
1910
|
+
return_code: z11.number()
|
|
1823
1911
|
}),
|
|
1824
|
-
|
|
1825
|
-
type:
|
|
1826
|
-
error_code:
|
|
1912
|
+
z11.object({
|
|
1913
|
+
type: z11.literal("bash_code_execution_tool_result_error"),
|
|
1914
|
+
error_code: z11.string()
|
|
1827
1915
|
}),
|
|
1828
|
-
|
|
1829
|
-
type:
|
|
1830
|
-
error_code:
|
|
1916
|
+
z11.object({
|
|
1917
|
+
type: z11.literal("text_editor_code_execution_tool_result_error"),
|
|
1918
|
+
error_code: z11.string()
|
|
1831
1919
|
}),
|
|
1832
|
-
|
|
1833
|
-
type:
|
|
1834
|
-
content:
|
|
1835
|
-
file_type:
|
|
1836
|
-
num_lines:
|
|
1837
|
-
start_line:
|
|
1838
|
-
total_lines:
|
|
1920
|
+
z11.object({
|
|
1921
|
+
type: z11.literal("text_editor_code_execution_view_result"),
|
|
1922
|
+
content: z11.string(),
|
|
1923
|
+
file_type: z11.string(),
|
|
1924
|
+
num_lines: z11.number().nullable(),
|
|
1925
|
+
start_line: z11.number().nullable(),
|
|
1926
|
+
total_lines: z11.number().nullable()
|
|
1839
1927
|
}),
|
|
1840
|
-
|
|
1841
|
-
type:
|
|
1842
|
-
is_file_update:
|
|
1928
|
+
z11.object({
|
|
1929
|
+
type: z11.literal("text_editor_code_execution_create_result"),
|
|
1930
|
+
is_file_update: z11.boolean()
|
|
1843
1931
|
}),
|
|
1844
|
-
|
|
1845
|
-
type:
|
|
1846
|
-
lines:
|
|
1847
|
-
new_lines:
|
|
1848
|
-
new_start:
|
|
1849
|
-
old_lines:
|
|
1850
|
-
old_start:
|
|
1932
|
+
z11.object({
|
|
1933
|
+
type: z11.literal("text_editor_code_execution_str_replace_result"),
|
|
1934
|
+
lines: z11.array(z11.string()).nullable(),
|
|
1935
|
+
new_lines: z11.number().nullable(),
|
|
1936
|
+
new_start: z11.number().nullable(),
|
|
1937
|
+
old_lines: z11.number().nullable(),
|
|
1938
|
+
old_start: z11.number().nullable()
|
|
1851
1939
|
})
|
|
1852
1940
|
])
|
|
1853
1941
|
)
|
|
1854
1942
|
);
|
|
1855
|
-
var codeExecution_20260120InputSchema = (
|
|
1856
|
-
() => (
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
type:
|
|
1860
|
-
code:
|
|
1943
|
+
var codeExecution_20260120InputSchema = lazySchema10(
|
|
1944
|
+
() => zodSchema10(
|
|
1945
|
+
z11.discriminatedUnion("type", [
|
|
1946
|
+
z11.object({
|
|
1947
|
+
type: z11.literal("programmatic-tool-call"),
|
|
1948
|
+
code: z11.string()
|
|
1861
1949
|
}),
|
|
1862
|
-
|
|
1863
|
-
type:
|
|
1864
|
-
command:
|
|
1950
|
+
z11.object({
|
|
1951
|
+
type: z11.literal("bash_code_execution"),
|
|
1952
|
+
command: z11.string()
|
|
1865
1953
|
}),
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
type:
|
|
1869
|
-
command:
|
|
1870
|
-
path:
|
|
1954
|
+
z11.discriminatedUnion("command", [
|
|
1955
|
+
z11.object({
|
|
1956
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1957
|
+
command: z11.literal("view"),
|
|
1958
|
+
path: z11.string()
|
|
1871
1959
|
}),
|
|
1872
|
-
|
|
1873
|
-
type:
|
|
1874
|
-
command:
|
|
1875
|
-
path:
|
|
1876
|
-
file_text:
|
|
1960
|
+
z11.object({
|
|
1961
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1962
|
+
command: z11.literal("create"),
|
|
1963
|
+
path: z11.string(),
|
|
1964
|
+
file_text: z11.string().nullish()
|
|
1877
1965
|
}),
|
|
1878
|
-
|
|
1879
|
-
type:
|
|
1880
|
-
command:
|
|
1881
|
-
path:
|
|
1882
|
-
old_str:
|
|
1883
|
-
new_str:
|
|
1966
|
+
z11.object({
|
|
1967
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1968
|
+
command: z11.literal("str_replace"),
|
|
1969
|
+
path: z11.string(),
|
|
1970
|
+
old_str: z11.string(),
|
|
1971
|
+
new_str: z11.string()
|
|
1884
1972
|
})
|
|
1885
1973
|
])
|
|
1886
1974
|
])
|
|
1887
1975
|
)
|
|
1888
1976
|
);
|
|
1889
|
-
var factory8 = (
|
|
1977
|
+
var factory8 = createProviderToolFactoryWithOutputSchema7({
|
|
1890
1978
|
id: "anthropic.code_execution_20260120",
|
|
1891
1979
|
inputSchema: codeExecution_20260120InputSchema,
|
|
1892
1980
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
@@ -1897,21 +1985,25 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
1897
1985
|
};
|
|
1898
1986
|
|
|
1899
1987
|
// src/tool/tool-search-regex_20251119.ts
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1988
|
+
import {
|
|
1989
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
1990
|
+
lazySchema as lazySchema11,
|
|
1991
|
+
zodSchema as zodSchema11
|
|
1992
|
+
} from "@ai-sdk/provider-utils";
|
|
1993
|
+
import { z as z12 } from "zod/v4";
|
|
1994
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema11(
|
|
1995
|
+
() => zodSchema11(
|
|
1996
|
+
z12.array(
|
|
1997
|
+
z12.object({
|
|
1998
|
+
type: z12.literal("tool_reference"),
|
|
1999
|
+
toolName: z12.string()
|
|
1908
2000
|
})
|
|
1909
2001
|
)
|
|
1910
2002
|
)
|
|
1911
2003
|
);
|
|
1912
|
-
var toolSearchRegex_20251119InputSchema = (
|
|
1913
|
-
() => (
|
|
1914
|
-
|
|
2004
|
+
var toolSearchRegex_20251119InputSchema = lazySchema11(
|
|
2005
|
+
() => zodSchema11(
|
|
2006
|
+
z12.object({
|
|
1915
2007
|
/**
|
|
1916
2008
|
* A regex pattern to search for tools.
|
|
1917
2009
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -1922,15 +2014,15 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema
|
|
|
1922
2014
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1923
2015
|
* - "(?i)slack" - case-insensitive search
|
|
1924
2016
|
*/
|
|
1925
|
-
pattern:
|
|
2017
|
+
pattern: z12.string(),
|
|
1926
2018
|
/**
|
|
1927
2019
|
* Maximum number of tools to return. Optional.
|
|
1928
2020
|
*/
|
|
1929
|
-
limit:
|
|
2021
|
+
limit: z12.number().optional()
|
|
1930
2022
|
})
|
|
1931
2023
|
)
|
|
1932
2024
|
);
|
|
1933
|
-
var factory9 = (
|
|
2025
|
+
var factory9 = createProviderToolFactoryWithOutputSchema8({
|
|
1934
2026
|
id: "anthropic.tool_search_regex_20251119",
|
|
1935
2027
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
1936
2028
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
@@ -1943,17 +2035,17 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
1943
2035
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1944
2036
|
function convertToString(data) {
|
|
1945
2037
|
if (typeof data === "string") {
|
|
1946
|
-
return new TextDecoder().decode(
|
|
2038
|
+
return new TextDecoder().decode(convertBase64ToUint8Array(data));
|
|
1947
2039
|
}
|
|
1948
2040
|
if (data instanceof Uint8Array) {
|
|
1949
2041
|
return new TextDecoder().decode(data);
|
|
1950
2042
|
}
|
|
1951
2043
|
if (data instanceof URL) {
|
|
1952
|
-
throw new
|
|
2044
|
+
throw new UnsupportedFunctionalityError2({
|
|
1953
2045
|
functionality: "URL-based text documents are not supported for citations"
|
|
1954
2046
|
});
|
|
1955
2047
|
}
|
|
1956
|
-
throw new
|
|
2048
|
+
throw new UnsupportedFunctionalityError2({
|
|
1957
2049
|
functionality: `unsupported data type for text documents: ${typeof data}`
|
|
1958
2050
|
});
|
|
1959
2051
|
}
|
|
@@ -1981,7 +2073,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1981
2073
|
const messages = [];
|
|
1982
2074
|
async function shouldEnableCitations(providerMetadata) {
|
|
1983
2075
|
var _a2, _b2;
|
|
1984
|
-
const anthropicOptions = await
|
|
2076
|
+
const anthropicOptions = await parseProviderOptions({
|
|
1985
2077
|
provider: "anthropic",
|
|
1986
2078
|
providerOptions: providerMetadata,
|
|
1987
2079
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1989,7 +2081,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1989
2081
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
1990
2082
|
}
|
|
1991
2083
|
async function getDocumentMetadata(providerMetadata) {
|
|
1992
|
-
const anthropicOptions = await
|
|
2084
|
+
const anthropicOptions = await parseProviderOptions({
|
|
1993
2085
|
provider: "anthropic",
|
|
1994
2086
|
providerOptions: providerMetadata,
|
|
1995
2087
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2006,7 +2098,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2006
2098
|
switch (type) {
|
|
2007
2099
|
case "system": {
|
|
2008
2100
|
if (system != null) {
|
|
2009
|
-
throw new
|
|
2101
|
+
throw new UnsupportedFunctionalityError2({
|
|
2010
2102
|
functionality: "Multiple system messages that are separated by user/assistant messages"
|
|
2011
2103
|
});
|
|
2012
2104
|
}
|
|
@@ -2046,7 +2138,26 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2046
2138
|
break;
|
|
2047
2139
|
}
|
|
2048
2140
|
case "file": {
|
|
2049
|
-
if (part.
|
|
2141
|
+
if (isProviderReference(part.data)) {
|
|
2142
|
+
const fileId = resolveProviderReference({
|
|
2143
|
+
reference: part.data,
|
|
2144
|
+
provider: "anthropic"
|
|
2145
|
+
});
|
|
2146
|
+
betas.add("files-api-2025-04-14");
|
|
2147
|
+
if (part.mediaType.startsWith("image/")) {
|
|
2148
|
+
anthropicContent.push({
|
|
2149
|
+
type: "image",
|
|
2150
|
+
source: { type: "file", file_id: fileId },
|
|
2151
|
+
cache_control: cacheControl
|
|
2152
|
+
});
|
|
2153
|
+
} else {
|
|
2154
|
+
anthropicContent.push({
|
|
2155
|
+
type: "document",
|
|
2156
|
+
source: { type: "file", file_id: fileId },
|
|
2157
|
+
cache_control: cacheControl
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
} else if (part.mediaType.startsWith("image/")) {
|
|
2050
2161
|
anthropicContent.push({
|
|
2051
2162
|
type: "image",
|
|
2052
2163
|
source: isUrlData(part.data) ? {
|
|
@@ -2055,7 +2166,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2055
2166
|
} : {
|
|
2056
2167
|
type: "base64",
|
|
2057
2168
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
2058
|
-
data:
|
|
2169
|
+
data: convertToBase64(part.data)
|
|
2059
2170
|
},
|
|
2060
2171
|
cache_control: cacheControl
|
|
2061
2172
|
});
|
|
@@ -2075,7 +2186,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2075
2186
|
} : {
|
|
2076
2187
|
type: "base64",
|
|
2077
2188
|
media_type: "application/pdf",
|
|
2078
|
-
data:
|
|
2189
|
+
data: convertToBase64(part.data)
|
|
2079
2190
|
},
|
|
2080
2191
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
2081
2192
|
...metadata.context && { context: metadata.context },
|
|
@@ -2109,7 +2220,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2109
2220
|
cache_control: cacheControl
|
|
2110
2221
|
});
|
|
2111
2222
|
} else {
|
|
2112
|
-
throw new
|
|
2223
|
+
throw new UnsupportedFunctionalityError2({
|
|
2113
2224
|
functionality: `media type: ${part.mediaType}`
|
|
2114
2225
|
});
|
|
2115
2226
|
}
|
|
@@ -2145,26 +2256,16 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2145
2256
|
type: "text",
|
|
2146
2257
|
text: contentPart.text
|
|
2147
2258
|
};
|
|
2148
|
-
case "image-data": {
|
|
2149
|
-
return {
|
|
2150
|
-
type: "image",
|
|
2151
|
-
source: {
|
|
2152
|
-
type: "base64",
|
|
2153
|
-
media_type: contentPart.mediaType,
|
|
2154
|
-
data: contentPart.data
|
|
2155
|
-
}
|
|
2156
|
-
};
|
|
2157
|
-
}
|
|
2158
|
-
case "image-url": {
|
|
2159
|
-
return {
|
|
2160
|
-
type: "image",
|
|
2161
|
-
source: {
|
|
2162
|
-
type: "url",
|
|
2163
|
-
url: contentPart.url
|
|
2164
|
-
}
|
|
2165
|
-
};
|
|
2166
|
-
}
|
|
2167
2259
|
case "file-url": {
|
|
2260
|
+
if (contentPart.mediaType.startsWith("image/")) {
|
|
2261
|
+
return {
|
|
2262
|
+
type: "image",
|
|
2263
|
+
source: {
|
|
2264
|
+
type: "url",
|
|
2265
|
+
url: contentPart.url
|
|
2266
|
+
}
|
|
2267
|
+
};
|
|
2268
|
+
}
|
|
2168
2269
|
return {
|
|
2169
2270
|
type: "document",
|
|
2170
2271
|
source: {
|
|
@@ -2174,6 +2275,16 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2174
2275
|
};
|
|
2175
2276
|
}
|
|
2176
2277
|
case "file-data": {
|
|
2278
|
+
if (contentPart.mediaType.startsWith("image/")) {
|
|
2279
|
+
return {
|
|
2280
|
+
type: "image",
|
|
2281
|
+
source: {
|
|
2282
|
+
type: "base64",
|
|
2283
|
+
media_type: contentPart.mediaType,
|
|
2284
|
+
data: contentPart.data
|
|
2285
|
+
}
|
|
2286
|
+
};
|
|
2287
|
+
}
|
|
2177
2288
|
if (contentPart.mediaType === "application/pdf") {
|
|
2178
2289
|
betas.add("pdfs-2024-09-25");
|
|
2179
2290
|
return {
|
|
@@ -2213,7 +2324,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2213
2324
|
return void 0;
|
|
2214
2325
|
}
|
|
2215
2326
|
}
|
|
2216
|
-
}).filter(
|
|
2327
|
+
}).filter(isNonNullable);
|
|
2217
2328
|
break;
|
|
2218
2329
|
case "text":
|
|
2219
2330
|
case "error-text":
|
|
@@ -2289,7 +2400,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2289
2400
|
}
|
|
2290
2401
|
case "reasoning": {
|
|
2291
2402
|
if (sendReasoning) {
|
|
2292
|
-
const reasoningMetadata = await
|
|
2403
|
+
const reasoningMetadata = await parseProviderOptions({
|
|
2293
2404
|
provider: "anthropic",
|
|
2294
2405
|
providerOptions: part.providerOptions,
|
|
2295
2406
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -2495,7 +2606,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2495
2606
|
break;
|
|
2496
2607
|
}
|
|
2497
2608
|
if (output.value.type === "code_execution_result") {
|
|
2498
|
-
const codeExecutionOutput = await (
|
|
2609
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2499
2610
|
value: output.value,
|
|
2500
2611
|
schema: codeExecution_20250522OutputSchema
|
|
2501
2612
|
});
|
|
@@ -2512,7 +2623,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2512
2623
|
cache_control: cacheControl
|
|
2513
2624
|
});
|
|
2514
2625
|
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
2515
|
-
const codeExecutionOutput = await (
|
|
2626
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2516
2627
|
value: output.value,
|
|
2517
2628
|
schema: codeExecution_20260120OutputSchema
|
|
2518
2629
|
});
|
|
@@ -2531,7 +2642,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2531
2642
|
});
|
|
2532
2643
|
}
|
|
2533
2644
|
} else {
|
|
2534
|
-
const codeExecutionOutput = await (
|
|
2645
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2535
2646
|
value: output.value,
|
|
2536
2647
|
schema: codeExecution_20250825OutputSchema
|
|
2537
2648
|
});
|
|
@@ -2600,7 +2711,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2600
2711
|
});
|
|
2601
2712
|
break;
|
|
2602
2713
|
}
|
|
2603
|
-
const webFetchOutput = await (
|
|
2714
|
+
const webFetchOutput = await validateTypes2({
|
|
2604
2715
|
value: output.value,
|
|
2605
2716
|
schema: webFetch_20250910OutputSchema
|
|
2606
2717
|
});
|
|
@@ -2635,7 +2746,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2635
2746
|
});
|
|
2636
2747
|
break;
|
|
2637
2748
|
}
|
|
2638
|
-
const webSearchOutput = await (
|
|
2749
|
+
const webSearchOutput = await validateTypes2({
|
|
2639
2750
|
value: output.value,
|
|
2640
2751
|
schema: webSearch_20250305OutputSchema
|
|
2641
2752
|
});
|
|
@@ -2662,7 +2773,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2662
2773
|
});
|
|
2663
2774
|
break;
|
|
2664
2775
|
}
|
|
2665
|
-
const toolSearchOutput = await (
|
|
2776
|
+
const toolSearchOutput = await validateTypes2({
|
|
2666
2777
|
value: output.value,
|
|
2667
2778
|
schema: toolSearchRegex_20251119OutputSchema
|
|
2668
2779
|
});
|
|
@@ -2820,13 +2931,22 @@ function createCitationSource(citation, citationDocuments, generateId2) {
|
|
|
2820
2931
|
}
|
|
2821
2932
|
};
|
|
2822
2933
|
}
|
|
2823
|
-
var AnthropicMessagesLanguageModel = class {
|
|
2934
|
+
var AnthropicMessagesLanguageModel = class _AnthropicMessagesLanguageModel {
|
|
2824
2935
|
constructor(modelId, config) {
|
|
2825
2936
|
this.specificationVersion = "v4";
|
|
2826
2937
|
var _a;
|
|
2827
2938
|
this.modelId = modelId;
|
|
2828
2939
|
this.config = config;
|
|
2829
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
2940
|
+
this.generateId = (_a = config.generateId) != null ? _a : generateId;
|
|
2941
|
+
}
|
|
2942
|
+
static [WORKFLOW_SERIALIZE](model) {
|
|
2943
|
+
return serializeModelOptions({
|
|
2944
|
+
modelId: model.modelId,
|
|
2945
|
+
config: model.config
|
|
2946
|
+
});
|
|
2947
|
+
}
|
|
2948
|
+
static [WORKFLOW_DESERIALIZE](options) {
|
|
2949
|
+
return new _AnthropicMessagesLanguageModel(options.modelId, options.config);
|
|
2830
2950
|
}
|
|
2831
2951
|
supportsUrl(url) {
|
|
2832
2952
|
return url.protocol === "https:";
|
|
@@ -2861,10 +2981,11 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2861
2981
|
seed,
|
|
2862
2982
|
tools,
|
|
2863
2983
|
toolChoice,
|
|
2984
|
+
reasoning,
|
|
2864
2985
|
providerOptions,
|
|
2865
2986
|
stream
|
|
2866
2987
|
}) {
|
|
2867
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
2988
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2868
2989
|
const warnings = [];
|
|
2869
2990
|
if (frequencyPenalty != null) {
|
|
2870
2991
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -2900,12 +3021,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2900
3021
|
}
|
|
2901
3022
|
}
|
|
2902
3023
|
const providerOptionsName = this.providerOptionsName;
|
|
2903
|
-
const canonicalOptions = await (
|
|
3024
|
+
const canonicalOptions = await parseProviderOptions2({
|
|
2904
3025
|
provider: "anthropic",
|
|
2905
3026
|
providerOptions,
|
|
2906
3027
|
schema: anthropicLanguageModelOptions
|
|
2907
3028
|
});
|
|
2908
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (
|
|
3029
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await parseProviderOptions2({
|
|
2909
3030
|
provider: providerOptionsName,
|
|
2910
3031
|
providerOptions,
|
|
2911
3032
|
schema: anthropicLanguageModelOptions
|
|
@@ -2919,10 +3040,41 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2919
3040
|
const {
|
|
2920
3041
|
maxOutputTokens: maxOutputTokensForModel,
|
|
2921
3042
|
supportsStructuredOutput: modelSupportsStructuredOutput,
|
|
3043
|
+
supportsAdaptiveThinking,
|
|
3044
|
+
rejectsSamplingParameters,
|
|
3045
|
+
supportsXhighEffort,
|
|
2922
3046
|
isKnownModel
|
|
2923
3047
|
} = getModelCapabilities(this.modelId);
|
|
3048
|
+
if (rejectsSamplingParameters) {
|
|
3049
|
+
if (temperature != null) {
|
|
3050
|
+
warnings.push({
|
|
3051
|
+
type: "unsupported",
|
|
3052
|
+
feature: "temperature",
|
|
3053
|
+
details: `temperature is not supported by ${this.modelId} and will be ignored`
|
|
3054
|
+
});
|
|
3055
|
+
temperature = void 0;
|
|
3056
|
+
}
|
|
3057
|
+
if (topK != null) {
|
|
3058
|
+
warnings.push({
|
|
3059
|
+
type: "unsupported",
|
|
3060
|
+
feature: "topK",
|
|
3061
|
+
details: `topK is not supported by ${this.modelId} and will be ignored`
|
|
3062
|
+
});
|
|
3063
|
+
topK = void 0;
|
|
3064
|
+
}
|
|
3065
|
+
if (topP != null) {
|
|
3066
|
+
warnings.push({
|
|
3067
|
+
type: "unsupported",
|
|
3068
|
+
feature: "topP",
|
|
3069
|
+
details: `topP is not supported by ${this.modelId} and will be ignored`
|
|
3070
|
+
});
|
|
3071
|
+
topP = void 0;
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
const isAnthropicModel = isKnownModel || this.modelId.startsWith("claude-");
|
|
2924
3075
|
const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
|
|
2925
|
-
const
|
|
3076
|
+
const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
|
|
3077
|
+
const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
|
|
2926
3078
|
const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
2927
3079
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
2928
3080
|
type: "function",
|
|
@@ -2932,7 +3084,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2932
3084
|
} : void 0;
|
|
2933
3085
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
2934
3086
|
const cacheControlValidator = new CacheControlValidator();
|
|
2935
|
-
const toolNameMapping =
|
|
3087
|
+
const toolNameMapping = createToolNameMapping({
|
|
2936
3088
|
tools,
|
|
2937
3089
|
providerToolNames: {
|
|
2938
3090
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -2957,14 +3109,32 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2957
3109
|
});
|
|
2958
3110
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
2959
3111
|
prompt,
|
|
2960
|
-
sendReasoning: (
|
|
3112
|
+
sendReasoning: (_d = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _d : true,
|
|
2961
3113
|
warnings,
|
|
2962
3114
|
cacheControlValidator,
|
|
2963
3115
|
toolNameMapping
|
|
2964
3116
|
});
|
|
2965
|
-
|
|
3117
|
+
if (isCustomReasoning(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
|
|
3118
|
+
const reasoningConfig = resolveAnthropicReasoningConfig({
|
|
3119
|
+
reasoning,
|
|
3120
|
+
supportsAdaptiveThinking,
|
|
3121
|
+
supportsXhighEffort,
|
|
3122
|
+
maxOutputTokensForModel,
|
|
3123
|
+
warnings
|
|
3124
|
+
});
|
|
3125
|
+
if (reasoningConfig != null) {
|
|
3126
|
+
if (anthropicOptions.thinking == null) {
|
|
3127
|
+
anthropicOptions.thinking = reasoningConfig.thinking;
|
|
3128
|
+
}
|
|
3129
|
+
if (reasoningConfig.effort != null && ((_e = anthropicOptions.thinking) == null ? void 0 : _e.type) !== "disabled") {
|
|
3130
|
+
anthropicOptions.effort = reasoningConfig.effort;
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
const thinkingType = (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.type;
|
|
2966
3135
|
const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
|
|
2967
|
-
let thinkingBudget = thinkingType === "enabled" ? (
|
|
3136
|
+
let thinkingBudget = thinkingType === "enabled" ? (_g = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _g.budgetTokens : void 0;
|
|
3137
|
+
const thinkingDisplay = thinkingType === "adaptive" ? (_h = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _h.display : void 0;
|
|
2968
3138
|
const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
|
|
2969
3139
|
const baseArgs = {
|
|
2970
3140
|
// model id:
|
|
@@ -2979,14 +3149,24 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2979
3149
|
...isThinking && {
|
|
2980
3150
|
thinking: {
|
|
2981
3151
|
type: thinkingType,
|
|
2982
|
-
...thinkingBudget != null && { budget_tokens: thinkingBudget }
|
|
3152
|
+
...thinkingBudget != null && { budget_tokens: thinkingBudget },
|
|
3153
|
+
...thinkingDisplay != null && { display: thinkingDisplay }
|
|
2983
3154
|
}
|
|
2984
3155
|
},
|
|
2985
|
-
...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && {
|
|
3156
|
+
...((anthropicOptions == null ? void 0 : anthropicOptions.effort) || (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) || useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) && {
|
|
2986
3157
|
output_config: {
|
|
2987
3158
|
...(anthropicOptions == null ? void 0 : anthropicOptions.effort) && {
|
|
2988
3159
|
effort: anthropicOptions.effort
|
|
2989
3160
|
},
|
|
3161
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) && {
|
|
3162
|
+
task_budget: {
|
|
3163
|
+
type: anthropicOptions.taskBudget.type,
|
|
3164
|
+
total: anthropicOptions.taskBudget.total,
|
|
3165
|
+
...anthropicOptions.taskBudget.remaining != null && {
|
|
3166
|
+
remaining: anthropicOptions.taskBudget.remaining
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
},
|
|
2990
3170
|
...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
|
|
2991
3171
|
format: {
|
|
2992
3172
|
type: "json_schema",
|
|
@@ -2998,9 +3178,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2998
3178
|
...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
|
|
2999
3179
|
speed: anthropicOptions.speed
|
|
3000
3180
|
},
|
|
3181
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.inferenceGeo) && {
|
|
3182
|
+
inference_geo: anthropicOptions.inferenceGeo
|
|
3183
|
+
},
|
|
3001
3184
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
3002
3185
|
cache_control: anthropicOptions.cacheControl
|
|
3003
3186
|
},
|
|
3187
|
+
...((_i = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _i.userId) != null && {
|
|
3188
|
+
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
3189
|
+
},
|
|
3004
3190
|
// mcp servers:
|
|
3005
3191
|
...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
|
|
3006
3192
|
mcp_servers: anthropicOptions.mcpServers.map((server) => ({
|
|
@@ -3022,7 +3208,10 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3022
3208
|
id: anthropicOptions.container.id,
|
|
3023
3209
|
skills: anthropicOptions.container.skills.map((skill) => ({
|
|
3024
3210
|
type: skill.type,
|
|
3025
|
-
skill_id: skill.
|
|
3211
|
+
skill_id: skill.type === "custom" ? resolveProviderReference2({
|
|
3212
|
+
reference: skill.providerReference,
|
|
3213
|
+
provider: "anthropic"
|
|
3214
|
+
}) : skill.skillId,
|
|
3026
3215
|
version: skill.version
|
|
3027
3216
|
}))
|
|
3028
3217
|
}
|
|
@@ -3124,7 +3313,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3124
3313
|
}
|
|
3125
3314
|
baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
|
|
3126
3315
|
} else {
|
|
3127
|
-
if (topP != null && temperature != null) {
|
|
3316
|
+
if (isAnthropicModel && topP != null && temperature != null) {
|
|
3128
3317
|
warnings.push({
|
|
3129
3318
|
type: "unsupported",
|
|
3130
3319
|
feature: "topP",
|
|
@@ -3168,10 +3357,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3168
3357
|
if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
|
|
3169
3358
|
betas.add("effort-2025-11-24");
|
|
3170
3359
|
}
|
|
3360
|
+
if (anthropicOptions == null ? void 0 : anthropicOptions.taskBudget) {
|
|
3361
|
+
betas.add("task-budgets-2026-03-13");
|
|
3362
|
+
}
|
|
3171
3363
|
if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
|
|
3172
3364
|
betas.add("fast-mode-2026-02-01");
|
|
3173
3365
|
}
|
|
3174
|
-
if (stream && ((
|
|
3366
|
+
if (stream && ((_j = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _j : true)) {
|
|
3175
3367
|
betas.add("fine-grained-tool-streaming-2025-05-14");
|
|
3176
3368
|
}
|
|
3177
3369
|
const {
|
|
@@ -3185,13 +3377,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3185
3377
|
toolChoice: { type: "required" },
|
|
3186
3378
|
disableParallelToolUse: true,
|
|
3187
3379
|
cacheControlValidator,
|
|
3188
|
-
supportsStructuredOutput: false
|
|
3380
|
+
supportsStructuredOutput: false,
|
|
3381
|
+
supportsStrictTools
|
|
3189
3382
|
} : {
|
|
3190
3383
|
tools: tools != null ? tools : [],
|
|
3191
3384
|
toolChoice,
|
|
3192
3385
|
disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
|
|
3193
3386
|
cacheControlValidator,
|
|
3194
|
-
supportsStructuredOutput
|
|
3387
|
+
supportsStructuredOutput,
|
|
3388
|
+
supportsStrictTools
|
|
3195
3389
|
}
|
|
3196
3390
|
);
|
|
3197
3391
|
const cacheWarnings = cacheControlValidator.getWarnings();
|
|
@@ -3208,7 +3402,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3208
3402
|
...betas,
|
|
3209
3403
|
...toolsBetas,
|
|
3210
3404
|
...userSuppliedBetas,
|
|
3211
|
-
...(
|
|
3405
|
+
...(_k = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _k : []
|
|
3212
3406
|
]),
|
|
3213
3407
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
3214
3408
|
toolNameMapping,
|
|
@@ -3220,16 +3414,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3220
3414
|
betas,
|
|
3221
3415
|
headers
|
|
3222
3416
|
}) {
|
|
3223
|
-
return
|
|
3224
|
-
await
|
|
3417
|
+
return combineHeaders(
|
|
3418
|
+
this.config.headers ? await resolve(this.config.headers) : void 0,
|
|
3225
3419
|
headers,
|
|
3226
3420
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
3227
3421
|
);
|
|
3228
3422
|
}
|
|
3229
3423
|
async getBetasFromHeaders(requestHeaders) {
|
|
3230
3424
|
var _a, _b;
|
|
3231
|
-
const configHeaders = await
|
|
3232
|
-
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
3425
|
+
const configHeaders = this.config.headers ? await resolve(this.config.headers) : void 0;
|
|
3426
|
+
const configBetaHeader = (_a = configHeaders == null ? void 0 : configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
3233
3427
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
3234
3428
|
return new Set(
|
|
3235
3429
|
[
|
|
@@ -3294,12 +3488,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3294
3488
|
responseHeaders,
|
|
3295
3489
|
value: response,
|
|
3296
3490
|
rawValue: rawResponse
|
|
3297
|
-
} = await
|
|
3491
|
+
} = await postJsonToApi({
|
|
3298
3492
|
url: this.buildRequestUrl(false),
|
|
3299
3493
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3300
3494
|
body: this.transformRequestBody(args, betas),
|
|
3301
3495
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3302
|
-
successfulResponseHandler:
|
|
3496
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
3303
3497
|
anthropicMessagesResponseSchema
|
|
3304
3498
|
),
|
|
3305
3499
|
abortSignal: options.abortSignal,
|
|
@@ -3693,6 +3887,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3693
3887
|
};
|
|
3694
3888
|
}
|
|
3695
3889
|
async doStream(options) {
|
|
3890
|
+
"use step";
|
|
3696
3891
|
var _a, _b;
|
|
3697
3892
|
const {
|
|
3698
3893
|
args: body,
|
|
@@ -3714,12 +3909,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3714
3909
|
body.tools
|
|
3715
3910
|
);
|
|
3716
3911
|
const url = this.buildRequestUrl(true);
|
|
3717
|
-
const { responseHeaders, value: response } = await
|
|
3912
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
3718
3913
|
url,
|
|
3719
3914
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3720
3915
|
body: this.transformRequestBody(body, betas),
|
|
3721
3916
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3722
|
-
successfulResponseHandler:
|
|
3917
|
+
successfulResponseHandler: createEventSourceResponseHandler(
|
|
3723
3918
|
anthropicMessagesChunkSchema
|
|
3724
3919
|
),
|
|
3725
3920
|
abortSignal: options.abortSignal,
|
|
@@ -4444,7 +4639,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4444
4639
|
}
|
|
4445
4640
|
if (((_b = result.value) == null ? void 0 : _b.type) === "error") {
|
|
4446
4641
|
const error = result.value.error;
|
|
4447
|
-
throw new
|
|
4642
|
+
throw new APICallError({
|
|
4448
4643
|
message: error.message,
|
|
4449
4644
|
url,
|
|
4450
4645
|
requestBodyValues: body,
|
|
@@ -4467,46 +4662,76 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4467
4662
|
}
|
|
4468
4663
|
};
|
|
4469
4664
|
function getModelCapabilities(modelId) {
|
|
4470
|
-
if (modelId.includes("claude-
|
|
4665
|
+
if (modelId.includes("claude-opus-4-7")) {
|
|
4666
|
+
return {
|
|
4667
|
+
maxOutputTokens: 128e3,
|
|
4668
|
+
supportsStructuredOutput: true,
|
|
4669
|
+
supportsAdaptiveThinking: true,
|
|
4670
|
+
rejectsSamplingParameters: true,
|
|
4671
|
+
supportsXhighEffort: true,
|
|
4672
|
+
isKnownModel: true
|
|
4673
|
+
};
|
|
4674
|
+
} else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
|
|
4471
4675
|
return {
|
|
4472
4676
|
maxOutputTokens: 128e3,
|
|
4473
4677
|
supportsStructuredOutput: true,
|
|
4678
|
+
supportsAdaptiveThinking: true,
|
|
4679
|
+
rejectsSamplingParameters: false,
|
|
4680
|
+
supportsXhighEffort: false,
|
|
4474
4681
|
isKnownModel: true
|
|
4475
4682
|
};
|
|
4476
4683
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
4477
4684
|
return {
|
|
4478
4685
|
maxOutputTokens: 64e3,
|
|
4479
4686
|
supportsStructuredOutput: true,
|
|
4687
|
+
supportsAdaptiveThinking: false,
|
|
4688
|
+
rejectsSamplingParameters: false,
|
|
4689
|
+
supportsXhighEffort: false,
|
|
4480
4690
|
isKnownModel: true
|
|
4481
4691
|
};
|
|
4482
4692
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
4483
4693
|
return {
|
|
4484
4694
|
maxOutputTokens: 32e3,
|
|
4485
4695
|
supportsStructuredOutput: true,
|
|
4696
|
+
supportsAdaptiveThinking: false,
|
|
4697
|
+
rejectsSamplingParameters: false,
|
|
4698
|
+
supportsXhighEffort: false,
|
|
4486
4699
|
isKnownModel: true
|
|
4487
4700
|
};
|
|
4488
4701
|
} else if (modelId.includes("claude-sonnet-4-")) {
|
|
4489
4702
|
return {
|
|
4490
4703
|
maxOutputTokens: 64e3,
|
|
4491
4704
|
supportsStructuredOutput: false,
|
|
4705
|
+
supportsAdaptiveThinking: false,
|
|
4706
|
+
rejectsSamplingParameters: false,
|
|
4707
|
+
supportsXhighEffort: false,
|
|
4492
4708
|
isKnownModel: true
|
|
4493
4709
|
};
|
|
4494
4710
|
} else if (modelId.includes("claude-opus-4-")) {
|
|
4495
4711
|
return {
|
|
4496
4712
|
maxOutputTokens: 32e3,
|
|
4497
4713
|
supportsStructuredOutput: false,
|
|
4714
|
+
supportsAdaptiveThinking: false,
|
|
4715
|
+
rejectsSamplingParameters: false,
|
|
4716
|
+
supportsXhighEffort: false,
|
|
4498
4717
|
isKnownModel: true
|
|
4499
4718
|
};
|
|
4500
4719
|
} else if (modelId.includes("claude-3-haiku")) {
|
|
4501
4720
|
return {
|
|
4502
4721
|
maxOutputTokens: 4096,
|
|
4503
4722
|
supportsStructuredOutput: false,
|
|
4723
|
+
supportsAdaptiveThinking: false,
|
|
4724
|
+
rejectsSamplingParameters: false,
|
|
4725
|
+
supportsXhighEffort: false,
|
|
4504
4726
|
isKnownModel: true
|
|
4505
4727
|
};
|
|
4506
4728
|
} else {
|
|
4507
4729
|
return {
|
|
4508
4730
|
maxOutputTokens: 4096,
|
|
4509
4731
|
supportsStructuredOutput: false,
|
|
4732
|
+
supportsAdaptiveThinking: false,
|
|
4733
|
+
rejectsSamplingParameters: false,
|
|
4734
|
+
supportsXhighEffort: false,
|
|
4510
4735
|
isKnownModel: false
|
|
4511
4736
|
};
|
|
4512
4737
|
}
|
|
@@ -4529,6 +4754,44 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
|
4529
4754
|
}
|
|
4530
4755
|
return hasWebTool20260209 && !hasCodeExecutionTool;
|
|
4531
4756
|
}
|
|
4757
|
+
function resolveAnthropicReasoningConfig({
|
|
4758
|
+
reasoning,
|
|
4759
|
+
supportsAdaptiveThinking,
|
|
4760
|
+
supportsXhighEffort,
|
|
4761
|
+
maxOutputTokensForModel,
|
|
4762
|
+
warnings
|
|
4763
|
+
}) {
|
|
4764
|
+
if (!isCustomReasoning(reasoning)) {
|
|
4765
|
+
return void 0;
|
|
4766
|
+
}
|
|
4767
|
+
if (reasoning === "none") {
|
|
4768
|
+
return { thinking: { type: "disabled" } };
|
|
4769
|
+
}
|
|
4770
|
+
if (supportsAdaptiveThinking) {
|
|
4771
|
+
const effort = mapReasoningToProviderEffort({
|
|
4772
|
+
reasoning,
|
|
4773
|
+
effortMap: {
|
|
4774
|
+
minimal: "low",
|
|
4775
|
+
low: "low",
|
|
4776
|
+
medium: "medium",
|
|
4777
|
+
high: "high",
|
|
4778
|
+
xhigh: supportsXhighEffort ? "xhigh" : "max"
|
|
4779
|
+
},
|
|
4780
|
+
warnings
|
|
4781
|
+
});
|
|
4782
|
+
return { thinking: { type: "adaptive" }, effort };
|
|
4783
|
+
}
|
|
4784
|
+
const budgetTokens = mapReasoningToProviderBudget({
|
|
4785
|
+
reasoning,
|
|
4786
|
+
maxOutputTokens: maxOutputTokensForModel,
|
|
4787
|
+
maxReasoningBudget: maxOutputTokensForModel,
|
|
4788
|
+
warnings
|
|
4789
|
+
});
|
|
4790
|
+
if (budgetTokens == null) {
|
|
4791
|
+
return void 0;
|
|
4792
|
+
}
|
|
4793
|
+
return { thinking: { type: "enabled", budgetTokens } };
|
|
4794
|
+
}
|
|
4532
4795
|
function mapAnthropicResponseContextManagement(contextManagement) {
|
|
4533
4796
|
return contextManagement ? {
|
|
4534
4797
|
appliedEdits: contextManagement.applied_edits.map((edit) => {
|
|
@@ -4556,44 +4819,56 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4556
4819
|
}
|
|
4557
4820
|
|
|
4558
4821
|
// src/tool/bash_20241022.ts
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4822
|
+
import {
|
|
4823
|
+
createProviderToolFactory as createProviderToolFactory2,
|
|
4824
|
+
lazySchema as lazySchema12,
|
|
4825
|
+
zodSchema as zodSchema12
|
|
4826
|
+
} from "@ai-sdk/provider-utils";
|
|
4827
|
+
import { z as z13 } from "zod/v4";
|
|
4828
|
+
var bash_20241022InputSchema = lazySchema12(
|
|
4829
|
+
() => zodSchema12(
|
|
4830
|
+
z13.object({
|
|
4831
|
+
command: z13.string(),
|
|
4832
|
+
restart: z13.boolean().optional()
|
|
4566
4833
|
})
|
|
4567
4834
|
)
|
|
4568
4835
|
);
|
|
4569
|
-
var bash_20241022 = (
|
|
4836
|
+
var bash_20241022 = createProviderToolFactory2({
|
|
4570
4837
|
id: "anthropic.bash_20241022",
|
|
4571
4838
|
inputSchema: bash_20241022InputSchema
|
|
4572
4839
|
});
|
|
4573
4840
|
|
|
4574
4841
|
// src/tool/bash_20250124.ts
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4842
|
+
import {
|
|
4843
|
+
createProviderToolFactory as createProviderToolFactory3,
|
|
4844
|
+
lazySchema as lazySchema13,
|
|
4845
|
+
zodSchema as zodSchema13
|
|
4846
|
+
} from "@ai-sdk/provider-utils";
|
|
4847
|
+
import { z as z14 } from "zod/v4";
|
|
4848
|
+
var bash_20250124InputSchema = lazySchema13(
|
|
4849
|
+
() => zodSchema13(
|
|
4850
|
+
z14.object({
|
|
4851
|
+
command: z14.string(),
|
|
4852
|
+
restart: z14.boolean().optional()
|
|
4582
4853
|
})
|
|
4583
4854
|
)
|
|
4584
4855
|
);
|
|
4585
|
-
var bash_20250124 = (
|
|
4856
|
+
var bash_20250124 = createProviderToolFactory3({
|
|
4586
4857
|
id: "anthropic.bash_20250124",
|
|
4587
4858
|
inputSchema: bash_20250124InputSchema
|
|
4588
4859
|
});
|
|
4589
4860
|
|
|
4590
4861
|
// src/tool/computer_20241022.ts
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4862
|
+
import {
|
|
4863
|
+
createProviderToolFactory as createProviderToolFactory4,
|
|
4864
|
+
lazySchema as lazySchema14,
|
|
4865
|
+
zodSchema as zodSchema14
|
|
4866
|
+
} from "@ai-sdk/provider-utils";
|
|
4867
|
+
import { z as z15 } from "zod/v4";
|
|
4868
|
+
var computer_20241022InputSchema = lazySchema14(
|
|
4869
|
+
() => zodSchema14(
|
|
4870
|
+
z15.object({
|
|
4871
|
+
action: z15.enum([
|
|
4597
4872
|
"key",
|
|
4598
4873
|
"type",
|
|
4599
4874
|
"mouse_move",
|
|
@@ -4605,23 +4880,27 @@ var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
4605
4880
|
"screenshot",
|
|
4606
4881
|
"cursor_position"
|
|
4607
4882
|
]),
|
|
4608
|
-
coordinate:
|
|
4609
|
-
text:
|
|
4883
|
+
coordinate: z15.array(z15.number().int()).optional(),
|
|
4884
|
+
text: z15.string().optional()
|
|
4610
4885
|
})
|
|
4611
4886
|
)
|
|
4612
4887
|
);
|
|
4613
|
-
var computer_20241022 = (
|
|
4888
|
+
var computer_20241022 = createProviderToolFactory4({
|
|
4614
4889
|
id: "anthropic.computer_20241022",
|
|
4615
4890
|
inputSchema: computer_20241022InputSchema
|
|
4616
4891
|
});
|
|
4617
4892
|
|
|
4618
4893
|
// src/tool/computer_20250124.ts
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4894
|
+
import {
|
|
4895
|
+
createProviderToolFactory as createProviderToolFactory5,
|
|
4896
|
+
lazySchema as lazySchema15,
|
|
4897
|
+
zodSchema as zodSchema15
|
|
4898
|
+
} from "@ai-sdk/provider-utils";
|
|
4899
|
+
import { z as z16 } from "zod/v4";
|
|
4900
|
+
var computer_20250124InputSchema = lazySchema15(
|
|
4901
|
+
() => zodSchema15(
|
|
4902
|
+
z16.object({
|
|
4903
|
+
action: z16.enum([
|
|
4625
4904
|
"key",
|
|
4626
4905
|
"hold_key",
|
|
4627
4906
|
"type",
|
|
@@ -4639,27 +4918,31 @@ var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
4639
4918
|
"wait",
|
|
4640
4919
|
"screenshot"
|
|
4641
4920
|
]),
|
|
4642
|
-
coordinate:
|
|
4643
|
-
duration:
|
|
4644
|
-
scroll_amount:
|
|
4645
|
-
scroll_direction:
|
|
4646
|
-
start_coordinate:
|
|
4647
|
-
text:
|
|
4921
|
+
coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
|
|
4922
|
+
duration: z16.number().optional(),
|
|
4923
|
+
scroll_amount: z16.number().optional(),
|
|
4924
|
+
scroll_direction: z16.enum(["up", "down", "left", "right"]).optional(),
|
|
4925
|
+
start_coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
|
|
4926
|
+
text: z16.string().optional()
|
|
4648
4927
|
})
|
|
4649
4928
|
)
|
|
4650
4929
|
);
|
|
4651
|
-
var computer_20250124 = (
|
|
4930
|
+
var computer_20250124 = createProviderToolFactory5({
|
|
4652
4931
|
id: "anthropic.computer_20250124",
|
|
4653
4932
|
inputSchema: computer_20250124InputSchema
|
|
4654
4933
|
});
|
|
4655
4934
|
|
|
4656
4935
|
// src/tool/computer_20251124.ts
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4936
|
+
import {
|
|
4937
|
+
createProviderToolFactory as createProviderToolFactory6,
|
|
4938
|
+
lazySchema as lazySchema16,
|
|
4939
|
+
zodSchema as zodSchema16
|
|
4940
|
+
} from "@ai-sdk/provider-utils";
|
|
4941
|
+
import { z as z17 } from "zod/v4";
|
|
4942
|
+
var computer_20251124InputSchema = lazySchema16(
|
|
4943
|
+
() => zodSchema16(
|
|
4944
|
+
z17.object({
|
|
4945
|
+
action: z17.enum([
|
|
4663
4946
|
"key",
|
|
4664
4947
|
"hold_key",
|
|
4665
4948
|
"type",
|
|
@@ -4678,166 +4961,186 @@ var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
4678
4961
|
"screenshot",
|
|
4679
4962
|
"zoom"
|
|
4680
4963
|
]),
|
|
4681
|
-
coordinate:
|
|
4682
|
-
duration:
|
|
4683
|
-
region:
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4964
|
+
coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4965
|
+
duration: z17.number().optional(),
|
|
4966
|
+
region: z17.tuple([
|
|
4967
|
+
z17.number().int(),
|
|
4968
|
+
z17.number().int(),
|
|
4969
|
+
z17.number().int(),
|
|
4970
|
+
z17.number().int()
|
|
4688
4971
|
]).optional(),
|
|
4689
|
-
scroll_amount:
|
|
4690
|
-
scroll_direction:
|
|
4691
|
-
start_coordinate:
|
|
4692
|
-
text:
|
|
4972
|
+
scroll_amount: z17.number().optional(),
|
|
4973
|
+
scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
|
|
4974
|
+
start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4975
|
+
text: z17.string().optional()
|
|
4693
4976
|
})
|
|
4694
4977
|
)
|
|
4695
4978
|
);
|
|
4696
|
-
var computer_20251124 = (
|
|
4979
|
+
var computer_20251124 = createProviderToolFactory6({
|
|
4697
4980
|
id: "anthropic.computer_20251124",
|
|
4698
4981
|
inputSchema: computer_20251124InputSchema
|
|
4699
4982
|
});
|
|
4700
4983
|
|
|
4701
4984
|
// src/tool/memory_20250818.ts
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4985
|
+
import {
|
|
4986
|
+
createProviderToolFactory as createProviderToolFactory7,
|
|
4987
|
+
lazySchema as lazySchema17,
|
|
4988
|
+
zodSchema as zodSchema17
|
|
4989
|
+
} from "@ai-sdk/provider-utils";
|
|
4990
|
+
import { z as z18 } from "zod/v4";
|
|
4991
|
+
var memory_20250818InputSchema = lazySchema17(
|
|
4992
|
+
() => zodSchema17(
|
|
4993
|
+
z18.discriminatedUnion("command", [
|
|
4994
|
+
z18.object({
|
|
4995
|
+
command: z18.literal("view"),
|
|
4996
|
+
path: z18.string(),
|
|
4997
|
+
view_range: z18.tuple([z18.number(), z18.number()]).optional()
|
|
4711
4998
|
}),
|
|
4712
|
-
|
|
4713
|
-
command:
|
|
4714
|
-
path:
|
|
4715
|
-
file_text:
|
|
4999
|
+
z18.object({
|
|
5000
|
+
command: z18.literal("create"),
|
|
5001
|
+
path: z18.string(),
|
|
5002
|
+
file_text: z18.string()
|
|
4716
5003
|
}),
|
|
4717
|
-
|
|
4718
|
-
command:
|
|
4719
|
-
path:
|
|
4720
|
-
old_str:
|
|
4721
|
-
new_str:
|
|
5004
|
+
z18.object({
|
|
5005
|
+
command: z18.literal("str_replace"),
|
|
5006
|
+
path: z18.string(),
|
|
5007
|
+
old_str: z18.string(),
|
|
5008
|
+
new_str: z18.string()
|
|
4722
5009
|
}),
|
|
4723
|
-
|
|
4724
|
-
command:
|
|
4725
|
-
path:
|
|
4726
|
-
insert_line:
|
|
4727
|
-
insert_text:
|
|
5010
|
+
z18.object({
|
|
5011
|
+
command: z18.literal("insert"),
|
|
5012
|
+
path: z18.string(),
|
|
5013
|
+
insert_line: z18.number(),
|
|
5014
|
+
insert_text: z18.string()
|
|
4728
5015
|
}),
|
|
4729
|
-
|
|
4730
|
-
command:
|
|
4731
|
-
path:
|
|
5016
|
+
z18.object({
|
|
5017
|
+
command: z18.literal("delete"),
|
|
5018
|
+
path: z18.string()
|
|
4732
5019
|
}),
|
|
4733
|
-
|
|
4734
|
-
command:
|
|
4735
|
-
old_path:
|
|
4736
|
-
new_path:
|
|
5020
|
+
z18.object({
|
|
5021
|
+
command: z18.literal("rename"),
|
|
5022
|
+
old_path: z18.string(),
|
|
5023
|
+
new_path: z18.string()
|
|
4737
5024
|
})
|
|
4738
5025
|
])
|
|
4739
5026
|
)
|
|
4740
5027
|
);
|
|
4741
|
-
var memory_20250818 = (
|
|
5028
|
+
var memory_20250818 = createProviderToolFactory7({
|
|
4742
5029
|
id: "anthropic.memory_20250818",
|
|
4743
5030
|
inputSchema: memory_20250818InputSchema
|
|
4744
5031
|
});
|
|
4745
5032
|
|
|
4746
5033
|
// src/tool/text-editor_20241022.ts
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
5034
|
+
import {
|
|
5035
|
+
createProviderToolFactory as createProviderToolFactory8,
|
|
5036
|
+
lazySchema as lazySchema18,
|
|
5037
|
+
zodSchema as zodSchema18
|
|
5038
|
+
} from "@ai-sdk/provider-utils";
|
|
5039
|
+
import { z as z19 } from "zod/v4";
|
|
5040
|
+
var textEditor_20241022InputSchema = lazySchema18(
|
|
5041
|
+
() => zodSchema18(
|
|
5042
|
+
z19.object({
|
|
5043
|
+
command: z19.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
5044
|
+
path: z19.string(),
|
|
5045
|
+
file_text: z19.string().optional(),
|
|
5046
|
+
insert_line: z19.number().int().optional(),
|
|
5047
|
+
new_str: z19.string().optional(),
|
|
5048
|
+
insert_text: z19.string().optional(),
|
|
5049
|
+
old_str: z19.string().optional(),
|
|
5050
|
+
view_range: z19.array(z19.number().int()).optional()
|
|
4760
5051
|
})
|
|
4761
5052
|
)
|
|
4762
5053
|
);
|
|
4763
|
-
var textEditor_20241022 = (
|
|
5054
|
+
var textEditor_20241022 = createProviderToolFactory8({
|
|
4764
5055
|
id: "anthropic.text_editor_20241022",
|
|
4765
5056
|
inputSchema: textEditor_20241022InputSchema
|
|
4766
5057
|
});
|
|
4767
5058
|
|
|
4768
5059
|
// src/tool/text-editor_20250124.ts
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
5060
|
+
import {
|
|
5061
|
+
createProviderToolFactory as createProviderToolFactory9,
|
|
5062
|
+
lazySchema as lazySchema19,
|
|
5063
|
+
zodSchema as zodSchema19
|
|
5064
|
+
} from "@ai-sdk/provider-utils";
|
|
5065
|
+
import { z as z20 } from "zod/v4";
|
|
5066
|
+
var textEditor_20250124InputSchema = lazySchema19(
|
|
5067
|
+
() => zodSchema19(
|
|
5068
|
+
z20.object({
|
|
5069
|
+
command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
5070
|
+
path: z20.string(),
|
|
5071
|
+
file_text: z20.string().optional(),
|
|
5072
|
+
insert_line: z20.number().int().optional(),
|
|
5073
|
+
new_str: z20.string().optional(),
|
|
5074
|
+
insert_text: z20.string().optional(),
|
|
5075
|
+
old_str: z20.string().optional(),
|
|
5076
|
+
view_range: z20.array(z20.number().int()).optional()
|
|
4782
5077
|
})
|
|
4783
5078
|
)
|
|
4784
5079
|
);
|
|
4785
|
-
var textEditor_20250124 = (
|
|
5080
|
+
var textEditor_20250124 = createProviderToolFactory9({
|
|
4786
5081
|
id: "anthropic.text_editor_20250124",
|
|
4787
5082
|
inputSchema: textEditor_20250124InputSchema
|
|
4788
5083
|
});
|
|
4789
5084
|
|
|
4790
5085
|
// src/tool/text-editor_20250429.ts
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
5086
|
+
import {
|
|
5087
|
+
createProviderToolFactory as createProviderToolFactory10,
|
|
5088
|
+
lazySchema as lazySchema20,
|
|
5089
|
+
zodSchema as zodSchema20
|
|
5090
|
+
} from "@ai-sdk/provider-utils";
|
|
5091
|
+
import { z as z21 } from "zod/v4";
|
|
5092
|
+
var textEditor_20250429InputSchema = lazySchema20(
|
|
5093
|
+
() => zodSchema20(
|
|
5094
|
+
z21.object({
|
|
5095
|
+
command: z21.enum(["view", "create", "str_replace", "insert"]),
|
|
5096
|
+
path: z21.string(),
|
|
5097
|
+
file_text: z21.string().optional(),
|
|
5098
|
+
insert_line: z21.number().int().optional(),
|
|
5099
|
+
new_str: z21.string().optional(),
|
|
5100
|
+
insert_text: z21.string().optional(),
|
|
5101
|
+
old_str: z21.string().optional(),
|
|
5102
|
+
view_range: z21.array(z21.number().int()).optional()
|
|
4804
5103
|
})
|
|
4805
5104
|
)
|
|
4806
5105
|
);
|
|
4807
|
-
var textEditor_20250429 = (
|
|
5106
|
+
var textEditor_20250429 = createProviderToolFactory10({
|
|
4808
5107
|
id: "anthropic.text_editor_20250429",
|
|
4809
5108
|
inputSchema: textEditor_20250429InputSchema
|
|
4810
5109
|
});
|
|
4811
5110
|
|
|
4812
5111
|
// src/tool/tool-search-bm25_20251119.ts
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
5112
|
+
import {
|
|
5113
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
5114
|
+
lazySchema as lazySchema21,
|
|
5115
|
+
zodSchema as zodSchema21
|
|
5116
|
+
} from "@ai-sdk/provider-utils";
|
|
5117
|
+
import { z as z22 } from "zod/v4";
|
|
5118
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema21(
|
|
5119
|
+
() => zodSchema21(
|
|
5120
|
+
z22.array(
|
|
5121
|
+
z22.object({
|
|
5122
|
+
type: z22.literal("tool_reference"),
|
|
5123
|
+
toolName: z22.string()
|
|
4821
5124
|
})
|
|
4822
5125
|
)
|
|
4823
5126
|
)
|
|
4824
5127
|
);
|
|
4825
|
-
var toolSearchBm25_20251119InputSchema = (
|
|
4826
|
-
() => (
|
|
4827
|
-
|
|
5128
|
+
var toolSearchBm25_20251119InputSchema = lazySchema21(
|
|
5129
|
+
() => zodSchema21(
|
|
5130
|
+
z22.object({
|
|
4828
5131
|
/**
|
|
4829
5132
|
* A natural language query to search for tools.
|
|
4830
5133
|
* Claude will use BM25 text search to find relevant tools.
|
|
4831
5134
|
*/
|
|
4832
|
-
query:
|
|
5135
|
+
query: z22.string(),
|
|
4833
5136
|
/**
|
|
4834
5137
|
* Maximum number of tools to return. Optional.
|
|
4835
5138
|
*/
|
|
4836
|
-
limit:
|
|
5139
|
+
limit: z22.number().optional()
|
|
4837
5140
|
})
|
|
4838
5141
|
)
|
|
4839
5142
|
);
|
|
4840
|
-
var factory10 = (
|
|
5143
|
+
var factory10 = createProviderToolFactoryWithOutputSchema9({
|
|
4841
5144
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4842
5145
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4843
5146
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
@@ -5048,10 +5351,10 @@ var anthropicTools = {
|
|
|
5048
5351
|
*/
|
|
5049
5352
|
toolSearchBm25_20251119
|
|
5050
5353
|
};
|
|
5051
|
-
|
|
5052
|
-
0 && (module.exports = {
|
|
5354
|
+
export {
|
|
5053
5355
|
AnthropicMessagesLanguageModel,
|
|
5054
5356
|
anthropicTools,
|
|
5357
|
+
getModelCapabilities,
|
|
5055
5358
|
prepareTools
|
|
5056
|
-
}
|
|
5359
|
+
};
|
|
5057
5360
|
//# sourceMappingURL=index.js.map
|