@ai-sdk/anthropic 4.0.0-beta.26 → 4.0.0-beta.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/index.js +1368 -1259
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +11 -3
- package/dist/internal/index.js +1285 -1199
- package/dist/internal/index.js.map +1 -1
- package/package.json +9 -10
- package/src/anthropic-messages-language-model.ts +25 -4
- package/src/convert-to-anthropic-messages-prompt.ts +19 -19
- package/dist/index.d.mts +0 -1106
- package/dist/index.mjs +0 -5586
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -981
- package/dist/internal/index.mjs +0 -5260
- package/dist/internal/index.mjs.map +0 -1
package/dist/internal/index.js
CHANGED
|
@@ -1,368 +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 index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
AnthropicMessagesLanguageModel: () => AnthropicMessagesLanguageModel,
|
|
24
|
-
anthropicTools: () => anthropicTools,
|
|
25
|
-
getModelCapabilities: () => getModelCapabilities,
|
|
26
|
-
prepareTools: () => prepareTools
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
|
|
30
1
|
// src/anthropic-messages-language-model.ts
|
|
31
|
-
|
|
32
|
-
|
|
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";
|
|
33
22
|
|
|
34
23
|
// src/anthropic-error.ts
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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()
|
|
44
37
|
})
|
|
45
38
|
})
|
|
46
39
|
)
|
|
47
40
|
);
|
|
48
|
-
var anthropicFailedResponseHandler =
|
|
41
|
+
var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
|
|
49
42
|
errorSchema: anthropicErrorDataSchema,
|
|
50
43
|
errorToMessage: (data) => data.error.message
|
|
51
44
|
});
|
|
52
45
|
|
|
53
46
|
// src/anthropic-messages-api.ts
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var anthropicMessagesResponseSchema = (
|
|
57
|
-
() => (
|
|
58
|
-
|
|
59
|
-
type:
|
|
60
|
-
id:
|
|
61
|
-
model:
|
|
62
|
-
content:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
type:
|
|
66
|
-
text:
|
|
67
|
-
citations:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
type:
|
|
71
|
-
cited_text:
|
|
72
|
-
url:
|
|
73
|
-
title:
|
|
74
|
-
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()
|
|
75
68
|
}),
|
|
76
|
-
|
|
77
|
-
type:
|
|
78
|
-
cited_text:
|
|
79
|
-
document_index:
|
|
80
|
-
document_title:
|
|
81
|
-
start_page_number:
|
|
82
|
-
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()
|
|
83
76
|
}),
|
|
84
|
-
|
|
85
|
-
type:
|
|
86
|
-
cited_text:
|
|
87
|
-
document_index:
|
|
88
|
-
document_title:
|
|
89
|
-
start_char_index:
|
|
90
|
-
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()
|
|
91
84
|
})
|
|
92
85
|
])
|
|
93
86
|
).optional()
|
|
94
87
|
}),
|
|
95
|
-
|
|
96
|
-
type:
|
|
97
|
-
thinking:
|
|
98
|
-
signature:
|
|
88
|
+
z2.object({
|
|
89
|
+
type: z2.literal("thinking"),
|
|
90
|
+
thinking: z2.string(),
|
|
91
|
+
signature: z2.string()
|
|
99
92
|
}),
|
|
100
|
-
|
|
101
|
-
type:
|
|
102
|
-
data:
|
|
93
|
+
z2.object({
|
|
94
|
+
type: z2.literal("redacted_thinking"),
|
|
95
|
+
data: z2.string()
|
|
103
96
|
}),
|
|
104
|
-
|
|
105
|
-
type:
|
|
106
|
-
content:
|
|
97
|
+
z2.object({
|
|
98
|
+
type: z2.literal("compaction"),
|
|
99
|
+
content: z2.string()
|
|
107
100
|
}),
|
|
108
|
-
|
|
109
|
-
type:
|
|
110
|
-
id:
|
|
111
|
-
name:
|
|
112
|
-
input:
|
|
101
|
+
z2.object({
|
|
102
|
+
type: z2.literal("tool_use"),
|
|
103
|
+
id: z2.string(),
|
|
104
|
+
name: z2.string(),
|
|
105
|
+
input: z2.unknown(),
|
|
113
106
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
114
|
-
caller:
|
|
115
|
-
|
|
116
|
-
type:
|
|
117
|
-
tool_id:
|
|
107
|
+
caller: z2.union([
|
|
108
|
+
z2.object({
|
|
109
|
+
type: z2.literal("code_execution_20250825"),
|
|
110
|
+
tool_id: z2.string()
|
|
118
111
|
}),
|
|
119
|
-
|
|
120
|
-
type:
|
|
121
|
-
tool_id:
|
|
112
|
+
z2.object({
|
|
113
|
+
type: z2.literal("code_execution_20260120"),
|
|
114
|
+
tool_id: z2.string()
|
|
122
115
|
}),
|
|
123
|
-
|
|
124
|
-
type:
|
|
116
|
+
z2.object({
|
|
117
|
+
type: z2.literal("direct")
|
|
125
118
|
})
|
|
126
119
|
]).optional()
|
|
127
120
|
}),
|
|
128
|
-
|
|
129
|
-
type:
|
|
130
|
-
id:
|
|
131
|
-
name:
|
|
132
|
-
input:
|
|
133
|
-
caller:
|
|
134
|
-
|
|
135
|
-
type:
|
|
136
|
-
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()
|
|
137
130
|
}),
|
|
138
|
-
|
|
139
|
-
type:
|
|
131
|
+
z2.object({
|
|
132
|
+
type: z2.literal("direct")
|
|
140
133
|
})
|
|
141
134
|
]).optional()
|
|
142
135
|
}),
|
|
143
|
-
|
|
144
|
-
type:
|
|
145
|
-
id:
|
|
146
|
-
name:
|
|
147
|
-
input:
|
|
148
|
-
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()
|
|
149
142
|
}),
|
|
150
|
-
|
|
151
|
-
type:
|
|
152
|
-
tool_use_id:
|
|
153
|
-
is_error:
|
|
154
|
-
content:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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() })
|
|
158
151
|
])
|
|
159
152
|
)
|
|
160
153
|
}),
|
|
161
|
-
|
|
162
|
-
type:
|
|
163
|
-
tool_use_id:
|
|
164
|
-
content:
|
|
165
|
-
|
|
166
|
-
type:
|
|
167
|
-
url:
|
|
168
|
-
retrieved_at:
|
|
169
|
-
content:
|
|
170
|
-
type:
|
|
171
|
-
title:
|
|
172
|
-
citations:
|
|
173
|
-
source:
|
|
174
|
-
|
|
175
|
-
type:
|
|
176
|
-
media_type:
|
|
177
|
-
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()
|
|
178
171
|
}),
|
|
179
|
-
|
|
180
|
-
type:
|
|
181
|
-
media_type:
|
|
182
|
-
data:
|
|
172
|
+
z2.object({
|
|
173
|
+
type: z2.literal("text"),
|
|
174
|
+
media_type: z2.literal("text/plain"),
|
|
175
|
+
data: z2.string()
|
|
183
176
|
})
|
|
184
177
|
])
|
|
185
178
|
})
|
|
186
179
|
}),
|
|
187
|
-
|
|
188
|
-
type:
|
|
189
|
-
error_code:
|
|
180
|
+
z2.object({
|
|
181
|
+
type: z2.literal("web_fetch_tool_result_error"),
|
|
182
|
+
error_code: z2.string()
|
|
190
183
|
})
|
|
191
184
|
])
|
|
192
185
|
}),
|
|
193
|
-
|
|
194
|
-
type:
|
|
195
|
-
tool_use_id:
|
|
196
|
-
content:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
type:
|
|
200
|
-
url:
|
|
201
|
-
title:
|
|
202
|
-
encrypted_content:
|
|
203
|
-
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()
|
|
204
197
|
})
|
|
205
198
|
),
|
|
206
|
-
|
|
207
|
-
type:
|
|
208
|
-
error_code:
|
|
199
|
+
z2.object({
|
|
200
|
+
type: z2.literal("web_search_tool_result_error"),
|
|
201
|
+
error_code: z2.string()
|
|
209
202
|
})
|
|
210
203
|
])
|
|
211
204
|
}),
|
|
212
205
|
// code execution results for code_execution_20250522 tool:
|
|
213
|
-
|
|
214
|
-
type:
|
|
215
|
-
tool_use_id:
|
|
216
|
-
content:
|
|
217
|
-
|
|
218
|
-
type:
|
|
219
|
-
stdout:
|
|
220
|
-
stderr:
|
|
221
|
-
return_code:
|
|
222
|
-
content:
|
|
223
|
-
|
|
224
|
-
type:
|
|
225
|
-
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()
|
|
226
219
|
})
|
|
227
220
|
).optional().default([])
|
|
228
221
|
}),
|
|
229
|
-
|
|
230
|
-
type:
|
|
231
|
-
encrypted_stdout:
|
|
232
|
-
stderr:
|
|
233
|
-
return_code:
|
|
234
|
-
content:
|
|
235
|
-
|
|
236
|
-
type:
|
|
237
|
-
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()
|
|
238
231
|
})
|
|
239
232
|
).optional().default([])
|
|
240
233
|
}),
|
|
241
|
-
|
|
242
|
-
type:
|
|
243
|
-
error_code:
|
|
234
|
+
z2.object({
|
|
235
|
+
type: z2.literal("code_execution_tool_result_error"),
|
|
236
|
+
error_code: z2.string()
|
|
244
237
|
})
|
|
245
238
|
])
|
|
246
239
|
}),
|
|
247
240
|
// bash code execution results for code_execution_20250825 tool:
|
|
248
|
-
|
|
249
|
-
type:
|
|
250
|
-
tool_use_id:
|
|
251
|
-
content:
|
|
252
|
-
|
|
253
|
-
type:
|
|
254
|
-
content:
|
|
255
|
-
|
|
256
|
-
type:
|
|
257
|
-
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()
|
|
258
251
|
})
|
|
259
252
|
),
|
|
260
|
-
stdout:
|
|
261
|
-
stderr:
|
|
262
|
-
return_code:
|
|
253
|
+
stdout: z2.string(),
|
|
254
|
+
stderr: z2.string(),
|
|
255
|
+
return_code: z2.number()
|
|
263
256
|
}),
|
|
264
|
-
|
|
265
|
-
type:
|
|
266
|
-
error_code:
|
|
257
|
+
z2.object({
|
|
258
|
+
type: z2.literal("bash_code_execution_tool_result_error"),
|
|
259
|
+
error_code: z2.string()
|
|
267
260
|
})
|
|
268
261
|
])
|
|
269
262
|
}),
|
|
270
263
|
// text editor code execution results for code_execution_20250825 tool:
|
|
271
|
-
|
|
272
|
-
type:
|
|
273
|
-
tool_use_id:
|
|
274
|
-
content:
|
|
275
|
-
|
|
276
|
-
type:
|
|
277
|
-
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()
|
|
278
271
|
}),
|
|
279
|
-
|
|
280
|
-
type:
|
|
281
|
-
content:
|
|
282
|
-
file_type:
|
|
283
|
-
num_lines:
|
|
284
|
-
start_line:
|
|
285
|
-
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()
|
|
286
279
|
}),
|
|
287
|
-
|
|
288
|
-
type:
|
|
289
|
-
is_file_update:
|
|
280
|
+
z2.object({
|
|
281
|
+
type: z2.literal("text_editor_code_execution_create_result"),
|
|
282
|
+
is_file_update: z2.boolean()
|
|
290
283
|
}),
|
|
291
|
-
|
|
292
|
-
type:
|
|
284
|
+
z2.object({
|
|
285
|
+
type: z2.literal(
|
|
293
286
|
"text_editor_code_execution_str_replace_result"
|
|
294
287
|
),
|
|
295
|
-
lines:
|
|
296
|
-
new_lines:
|
|
297
|
-
new_start:
|
|
298
|
-
old_lines:
|
|
299
|
-
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()
|
|
300
293
|
})
|
|
301
294
|
])
|
|
302
295
|
}),
|
|
303
296
|
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
304
|
-
|
|
305
|
-
type:
|
|
306
|
-
tool_use_id:
|
|
307
|
-
content:
|
|
308
|
-
|
|
309
|
-
type:
|
|
310
|
-
tool_references:
|
|
311
|
-
|
|
312
|
-
type:
|
|
313
|
-
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()
|
|
314
307
|
})
|
|
315
308
|
)
|
|
316
309
|
}),
|
|
317
|
-
|
|
318
|
-
type:
|
|
319
|
-
error_code:
|
|
310
|
+
z2.object({
|
|
311
|
+
type: z2.literal("tool_search_tool_result_error"),
|
|
312
|
+
error_code: z2.string()
|
|
320
313
|
})
|
|
321
314
|
])
|
|
322
315
|
})
|
|
323
316
|
])
|
|
324
317
|
),
|
|
325
|
-
stop_reason:
|
|
326
|
-
stop_sequence:
|
|
327
|
-
usage:
|
|
328
|
-
input_tokens:
|
|
329
|
-
output_tokens:
|
|
330
|
-
cache_creation_input_tokens:
|
|
331
|
-
cache_read_input_tokens:
|
|
332
|
-
iterations:
|
|
333
|
-
|
|
334
|
-
type:
|
|
335
|
-
input_tokens:
|
|
336
|
-
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()
|
|
337
330
|
})
|
|
338
331
|
).nullish()
|
|
339
332
|
}),
|
|
340
|
-
container:
|
|
341
|
-
expires_at:
|
|
342
|
-
id:
|
|
343
|
-
skills:
|
|
344
|
-
|
|
345
|
-
type:
|
|
346
|
-
skill_id:
|
|
347
|
-
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()
|
|
348
341
|
})
|
|
349
342
|
).nullish()
|
|
350
343
|
}).nullish(),
|
|
351
|
-
context_management:
|
|
352
|
-
applied_edits:
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
type:
|
|
356
|
-
cleared_tool_uses:
|
|
357
|
-
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()
|
|
358
351
|
}),
|
|
359
|
-
|
|
360
|
-
type:
|
|
361
|
-
cleared_thinking_turns:
|
|
362
|
-
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()
|
|
363
356
|
}),
|
|
364
|
-
|
|
365
|
-
type:
|
|
357
|
+
z2.object({
|
|
358
|
+
type: z2.literal("compact_20260112")
|
|
366
359
|
})
|
|
367
360
|
])
|
|
368
361
|
)
|
|
@@ -370,457 +363,457 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
370
363
|
})
|
|
371
364
|
)
|
|
372
365
|
);
|
|
373
|
-
var anthropicMessagesChunkSchema = (
|
|
374
|
-
() => (
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
type:
|
|
378
|
-
message:
|
|
379
|
-
id:
|
|
380
|
-
model:
|
|
381
|
-
role:
|
|
382
|
-
usage:
|
|
383
|
-
input_tokens:
|
|
384
|
-
cache_creation_input_tokens:
|
|
385
|
-
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()
|
|
386
379
|
}),
|
|
387
380
|
// Programmatic tool calling: content may be pre-populated for deferred tool calls
|
|
388
|
-
content:
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
type:
|
|
392
|
-
id:
|
|
393
|
-
name:
|
|
394
|
-
input:
|
|
395
|
-
caller:
|
|
396
|
-
|
|
397
|
-
type:
|
|
398
|
-
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()
|
|
399
392
|
}),
|
|
400
|
-
|
|
401
|
-
type:
|
|
402
|
-
tool_id:
|
|
393
|
+
z2.object({
|
|
394
|
+
type: z2.literal("code_execution_20260120"),
|
|
395
|
+
tool_id: z2.string()
|
|
403
396
|
}),
|
|
404
|
-
|
|
405
|
-
type:
|
|
397
|
+
z2.object({
|
|
398
|
+
type: z2.literal("direct")
|
|
406
399
|
})
|
|
407
400
|
]).optional()
|
|
408
401
|
})
|
|
409
402
|
])
|
|
410
403
|
).nullish(),
|
|
411
|
-
stop_reason:
|
|
412
|
-
container:
|
|
413
|
-
expires_at:
|
|
414
|
-
id:
|
|
404
|
+
stop_reason: z2.string().nullish(),
|
|
405
|
+
container: z2.object({
|
|
406
|
+
expires_at: z2.string(),
|
|
407
|
+
id: z2.string()
|
|
415
408
|
}).nullish()
|
|
416
409
|
})
|
|
417
410
|
}),
|
|
418
|
-
|
|
419
|
-
type:
|
|
420
|
-
index:
|
|
421
|
-
content_block:
|
|
422
|
-
|
|
423
|
-
type:
|
|
424
|
-
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()
|
|
425
418
|
}),
|
|
426
|
-
|
|
427
|
-
type:
|
|
428
|
-
thinking:
|
|
419
|
+
z2.object({
|
|
420
|
+
type: z2.literal("thinking"),
|
|
421
|
+
thinking: z2.string()
|
|
429
422
|
}),
|
|
430
|
-
|
|
431
|
-
type:
|
|
432
|
-
id:
|
|
433
|
-
name:
|
|
423
|
+
z2.object({
|
|
424
|
+
type: z2.literal("tool_use"),
|
|
425
|
+
id: z2.string(),
|
|
426
|
+
name: z2.string(),
|
|
434
427
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
435
|
-
input:
|
|
428
|
+
input: z2.record(z2.string(), z2.unknown()).optional(),
|
|
436
429
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
437
|
-
caller:
|
|
438
|
-
|
|
439
|
-
type:
|
|
440
|
-
tool_id:
|
|
430
|
+
caller: z2.union([
|
|
431
|
+
z2.object({
|
|
432
|
+
type: z2.literal("code_execution_20250825"),
|
|
433
|
+
tool_id: z2.string()
|
|
441
434
|
}),
|
|
442
|
-
|
|
443
|
-
type:
|
|
444
|
-
tool_id:
|
|
435
|
+
z2.object({
|
|
436
|
+
type: z2.literal("code_execution_20260120"),
|
|
437
|
+
tool_id: z2.string()
|
|
445
438
|
}),
|
|
446
|
-
|
|
447
|
-
type:
|
|
439
|
+
z2.object({
|
|
440
|
+
type: z2.literal("direct")
|
|
448
441
|
})
|
|
449
442
|
]).optional()
|
|
450
443
|
}),
|
|
451
|
-
|
|
452
|
-
type:
|
|
453
|
-
data:
|
|
444
|
+
z2.object({
|
|
445
|
+
type: z2.literal("redacted_thinking"),
|
|
446
|
+
data: z2.string()
|
|
454
447
|
}),
|
|
455
|
-
|
|
456
|
-
type:
|
|
457
|
-
content:
|
|
448
|
+
z2.object({
|
|
449
|
+
type: z2.literal("compaction"),
|
|
450
|
+
content: z2.string().nullish()
|
|
458
451
|
}),
|
|
459
|
-
|
|
460
|
-
type:
|
|
461
|
-
id:
|
|
462
|
-
name:
|
|
463
|
-
input:
|
|
464
|
-
caller:
|
|
465
|
-
|
|
466
|
-
type:
|
|
467
|
-
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()
|
|
468
461
|
}),
|
|
469
|
-
|
|
470
|
-
type:
|
|
462
|
+
z2.object({
|
|
463
|
+
type: z2.literal("direct")
|
|
471
464
|
})
|
|
472
465
|
]).optional()
|
|
473
466
|
}),
|
|
474
|
-
|
|
475
|
-
type:
|
|
476
|
-
id:
|
|
477
|
-
name:
|
|
478
|
-
input:
|
|
479
|
-
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()
|
|
480
473
|
}),
|
|
481
|
-
|
|
482
|
-
type:
|
|
483
|
-
tool_use_id:
|
|
484
|
-
is_error:
|
|
485
|
-
content:
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
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() })
|
|
489
482
|
])
|
|
490
483
|
)
|
|
491
484
|
}),
|
|
492
|
-
|
|
493
|
-
type:
|
|
494
|
-
tool_use_id:
|
|
495
|
-
content:
|
|
496
|
-
|
|
497
|
-
type:
|
|
498
|
-
url:
|
|
499
|
-
retrieved_at:
|
|
500
|
-
content:
|
|
501
|
-
type:
|
|
502
|
-
title:
|
|
503
|
-
citations:
|
|
504
|
-
source:
|
|
505
|
-
|
|
506
|
-
type:
|
|
507
|
-
media_type:
|
|
508
|
-
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()
|
|
509
502
|
}),
|
|
510
|
-
|
|
511
|
-
type:
|
|
512
|
-
media_type:
|
|
513
|
-
data:
|
|
503
|
+
z2.object({
|
|
504
|
+
type: z2.literal("text"),
|
|
505
|
+
media_type: z2.literal("text/plain"),
|
|
506
|
+
data: z2.string()
|
|
514
507
|
})
|
|
515
508
|
])
|
|
516
509
|
})
|
|
517
510
|
}),
|
|
518
|
-
|
|
519
|
-
type:
|
|
520
|
-
error_code:
|
|
511
|
+
z2.object({
|
|
512
|
+
type: z2.literal("web_fetch_tool_result_error"),
|
|
513
|
+
error_code: z2.string()
|
|
521
514
|
})
|
|
522
515
|
])
|
|
523
516
|
}),
|
|
524
|
-
|
|
525
|
-
type:
|
|
526
|
-
tool_use_id:
|
|
527
|
-
content:
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
type:
|
|
531
|
-
url:
|
|
532
|
-
title:
|
|
533
|
-
encrypted_content:
|
|
534
|
-
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()
|
|
535
528
|
})
|
|
536
529
|
),
|
|
537
|
-
|
|
538
|
-
type:
|
|
539
|
-
error_code:
|
|
530
|
+
z2.object({
|
|
531
|
+
type: z2.literal("web_search_tool_result_error"),
|
|
532
|
+
error_code: z2.string()
|
|
540
533
|
})
|
|
541
534
|
])
|
|
542
535
|
}),
|
|
543
536
|
// code execution results for code_execution_20250522 tool:
|
|
544
|
-
|
|
545
|
-
type:
|
|
546
|
-
tool_use_id:
|
|
547
|
-
content:
|
|
548
|
-
|
|
549
|
-
type:
|
|
550
|
-
stdout:
|
|
551
|
-
stderr:
|
|
552
|
-
return_code:
|
|
553
|
-
content:
|
|
554
|
-
|
|
555
|
-
type:
|
|
556
|
-
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()
|
|
557
550
|
})
|
|
558
551
|
).optional().default([])
|
|
559
552
|
}),
|
|
560
|
-
|
|
561
|
-
type:
|
|
562
|
-
encrypted_stdout:
|
|
563
|
-
stderr:
|
|
564
|
-
return_code:
|
|
565
|
-
content:
|
|
566
|
-
|
|
567
|
-
type:
|
|
568
|
-
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()
|
|
569
562
|
})
|
|
570
563
|
).optional().default([])
|
|
571
564
|
}),
|
|
572
|
-
|
|
573
|
-
type:
|
|
574
|
-
error_code:
|
|
565
|
+
z2.object({
|
|
566
|
+
type: z2.literal("code_execution_tool_result_error"),
|
|
567
|
+
error_code: z2.string()
|
|
575
568
|
})
|
|
576
569
|
])
|
|
577
570
|
}),
|
|
578
571
|
// bash code execution results for code_execution_20250825 tool:
|
|
579
|
-
|
|
580
|
-
type:
|
|
581
|
-
tool_use_id:
|
|
582
|
-
content:
|
|
583
|
-
|
|
584
|
-
type:
|
|
585
|
-
content:
|
|
586
|
-
|
|
587
|
-
type:
|
|
588
|
-
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()
|
|
589
582
|
})
|
|
590
583
|
),
|
|
591
|
-
stdout:
|
|
592
|
-
stderr:
|
|
593
|
-
return_code:
|
|
584
|
+
stdout: z2.string(),
|
|
585
|
+
stderr: z2.string(),
|
|
586
|
+
return_code: z2.number()
|
|
594
587
|
}),
|
|
595
|
-
|
|
596
|
-
type:
|
|
597
|
-
error_code:
|
|
588
|
+
z2.object({
|
|
589
|
+
type: z2.literal("bash_code_execution_tool_result_error"),
|
|
590
|
+
error_code: z2.string()
|
|
598
591
|
})
|
|
599
592
|
])
|
|
600
593
|
}),
|
|
601
594
|
// text editor code execution results for code_execution_20250825 tool:
|
|
602
|
-
|
|
603
|
-
type:
|
|
604
|
-
tool_use_id:
|
|
605
|
-
content:
|
|
606
|
-
|
|
607
|
-
type:
|
|
608
|
-
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()
|
|
609
602
|
}),
|
|
610
|
-
|
|
611
|
-
type:
|
|
612
|
-
content:
|
|
613
|
-
file_type:
|
|
614
|
-
num_lines:
|
|
615
|
-
start_line:
|
|
616
|
-
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()
|
|
617
610
|
}),
|
|
618
|
-
|
|
619
|
-
type:
|
|
620
|
-
is_file_update:
|
|
611
|
+
z2.object({
|
|
612
|
+
type: z2.literal("text_editor_code_execution_create_result"),
|
|
613
|
+
is_file_update: z2.boolean()
|
|
621
614
|
}),
|
|
622
|
-
|
|
623
|
-
type:
|
|
615
|
+
z2.object({
|
|
616
|
+
type: z2.literal(
|
|
624
617
|
"text_editor_code_execution_str_replace_result"
|
|
625
618
|
),
|
|
626
|
-
lines:
|
|
627
|
-
new_lines:
|
|
628
|
-
new_start:
|
|
629
|
-
old_lines:
|
|
630
|
-
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()
|
|
631
624
|
})
|
|
632
625
|
])
|
|
633
626
|
}),
|
|
634
627
|
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
635
|
-
|
|
636
|
-
type:
|
|
637
|
-
tool_use_id:
|
|
638
|
-
content:
|
|
639
|
-
|
|
640
|
-
type:
|
|
641
|
-
tool_references:
|
|
642
|
-
|
|
643
|
-
type:
|
|
644
|
-
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()
|
|
645
638
|
})
|
|
646
639
|
)
|
|
647
640
|
}),
|
|
648
|
-
|
|
649
|
-
type:
|
|
650
|
-
error_code:
|
|
641
|
+
z2.object({
|
|
642
|
+
type: z2.literal("tool_search_tool_result_error"),
|
|
643
|
+
error_code: z2.string()
|
|
651
644
|
})
|
|
652
645
|
])
|
|
653
646
|
})
|
|
654
647
|
])
|
|
655
648
|
}),
|
|
656
|
-
|
|
657
|
-
type:
|
|
658
|
-
index:
|
|
659
|
-
delta:
|
|
660
|
-
|
|
661
|
-
type:
|
|
662
|
-
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()
|
|
663
656
|
}),
|
|
664
|
-
|
|
665
|
-
type:
|
|
666
|
-
text:
|
|
657
|
+
z2.object({
|
|
658
|
+
type: z2.literal("text_delta"),
|
|
659
|
+
text: z2.string()
|
|
667
660
|
}),
|
|
668
|
-
|
|
669
|
-
type:
|
|
670
|
-
thinking:
|
|
661
|
+
z2.object({
|
|
662
|
+
type: z2.literal("thinking_delta"),
|
|
663
|
+
thinking: z2.string()
|
|
671
664
|
}),
|
|
672
|
-
|
|
673
|
-
type:
|
|
674
|
-
signature:
|
|
665
|
+
z2.object({
|
|
666
|
+
type: z2.literal("signature_delta"),
|
|
667
|
+
signature: z2.string()
|
|
675
668
|
}),
|
|
676
|
-
|
|
677
|
-
type:
|
|
678
|
-
content:
|
|
669
|
+
z2.object({
|
|
670
|
+
type: z2.literal("compaction_delta"),
|
|
671
|
+
content: z2.string().nullish()
|
|
679
672
|
}),
|
|
680
|
-
|
|
681
|
-
type:
|
|
682
|
-
citation:
|
|
683
|
-
|
|
684
|
-
type:
|
|
685
|
-
cited_text:
|
|
686
|
-
url:
|
|
687
|
-
title:
|
|
688
|
-
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()
|
|
689
682
|
}),
|
|
690
|
-
|
|
691
|
-
type:
|
|
692
|
-
cited_text:
|
|
693
|
-
document_index:
|
|
694
|
-
document_title:
|
|
695
|
-
start_page_number:
|
|
696
|
-
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()
|
|
697
690
|
}),
|
|
698
|
-
|
|
699
|
-
type:
|
|
700
|
-
cited_text:
|
|
701
|
-
document_index:
|
|
702
|
-
document_title:
|
|
703
|
-
start_char_index:
|
|
704
|
-
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()
|
|
705
698
|
})
|
|
706
699
|
])
|
|
707
700
|
})
|
|
708
701
|
])
|
|
709
702
|
}),
|
|
710
|
-
|
|
711
|
-
type:
|
|
712
|
-
index:
|
|
703
|
+
z2.object({
|
|
704
|
+
type: z2.literal("content_block_stop"),
|
|
705
|
+
index: z2.number()
|
|
713
706
|
}),
|
|
714
|
-
|
|
715
|
-
type:
|
|
716
|
-
error:
|
|
717
|
-
type:
|
|
718
|
-
message:
|
|
707
|
+
z2.object({
|
|
708
|
+
type: z2.literal("error"),
|
|
709
|
+
error: z2.object({
|
|
710
|
+
type: z2.string(),
|
|
711
|
+
message: z2.string()
|
|
719
712
|
})
|
|
720
713
|
}),
|
|
721
|
-
|
|
722
|
-
type:
|
|
723
|
-
delta:
|
|
724
|
-
stop_reason:
|
|
725
|
-
stop_sequence:
|
|
726
|
-
container:
|
|
727
|
-
expires_at:
|
|
728
|
-
id:
|
|
729
|
-
skills:
|
|
730
|
-
|
|
731
|
-
type:
|
|
732
|
-
|
|
733
|
-
|
|
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")
|
|
734
727
|
]),
|
|
735
|
-
skill_id:
|
|
736
|
-
version:
|
|
728
|
+
skill_id: z2.string(),
|
|
729
|
+
version: z2.string()
|
|
737
730
|
})
|
|
738
731
|
).nullish()
|
|
739
732
|
}).nullish()
|
|
740
733
|
}),
|
|
741
|
-
usage:
|
|
742
|
-
input_tokens:
|
|
743
|
-
output_tokens:
|
|
744
|
-
cache_creation_input_tokens:
|
|
745
|
-
cache_read_input_tokens:
|
|
746
|
-
iterations:
|
|
747
|
-
|
|
748
|
-
type:
|
|
749
|
-
input_tokens:
|
|
750
|
-
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()
|
|
751
744
|
})
|
|
752
745
|
).nullish()
|
|
753
746
|
}),
|
|
754
|
-
context_management:
|
|
755
|
-
applied_edits:
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
type:
|
|
759
|
-
cleared_tool_uses:
|
|
760
|
-
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()
|
|
761
754
|
}),
|
|
762
|
-
|
|
763
|
-
type:
|
|
764
|
-
cleared_thinking_turns:
|
|
765
|
-
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()
|
|
766
759
|
}),
|
|
767
|
-
|
|
768
|
-
type:
|
|
760
|
+
z2.object({
|
|
761
|
+
type: z2.literal("compact_20260112")
|
|
769
762
|
})
|
|
770
763
|
])
|
|
771
764
|
)
|
|
772
765
|
}).nullish()
|
|
773
766
|
}),
|
|
774
|
-
|
|
775
|
-
type:
|
|
767
|
+
z2.object({
|
|
768
|
+
type: z2.literal("message_stop")
|
|
776
769
|
}),
|
|
777
|
-
|
|
778
|
-
type:
|
|
770
|
+
z2.object({
|
|
771
|
+
type: z2.literal("ping")
|
|
779
772
|
})
|
|
780
773
|
])
|
|
781
774
|
)
|
|
782
775
|
);
|
|
783
|
-
var anthropicReasoningMetadataSchema = (
|
|
784
|
-
() => (
|
|
785
|
-
|
|
786
|
-
signature:
|
|
787
|
-
redactedData:
|
|
776
|
+
var anthropicReasoningMetadataSchema = lazySchema2(
|
|
777
|
+
() => zodSchema2(
|
|
778
|
+
z2.object({
|
|
779
|
+
signature: z2.string().optional(),
|
|
780
|
+
redactedData: z2.string().optional()
|
|
788
781
|
})
|
|
789
782
|
)
|
|
790
783
|
);
|
|
791
784
|
|
|
792
785
|
// src/anthropic-messages-options.ts
|
|
793
|
-
|
|
794
|
-
var anthropicFilePartProviderOptions =
|
|
786
|
+
import { z as z3 } from "zod/v4";
|
|
787
|
+
var anthropicFilePartProviderOptions = z3.object({
|
|
795
788
|
/**
|
|
796
789
|
* Citation configuration for this document.
|
|
797
790
|
* When enabled, this document will generate citations in the response.
|
|
798
791
|
*/
|
|
799
|
-
citations:
|
|
792
|
+
citations: z3.object({
|
|
800
793
|
/**
|
|
801
794
|
* Enable citations for this document
|
|
802
795
|
*/
|
|
803
|
-
enabled:
|
|
796
|
+
enabled: z3.boolean()
|
|
804
797
|
}).optional(),
|
|
805
798
|
/**
|
|
806
799
|
* Custom title for the document.
|
|
807
800
|
* If not provided, the filename will be used.
|
|
808
801
|
*/
|
|
809
|
-
title:
|
|
802
|
+
title: z3.string().optional(),
|
|
810
803
|
/**
|
|
811
804
|
* Context about the document that will be passed to the model
|
|
812
805
|
* but not used towards cited content.
|
|
813
806
|
* Useful for storing document metadata as text or stringified JSON.
|
|
814
807
|
*/
|
|
815
|
-
context:
|
|
808
|
+
context: z3.string().optional()
|
|
816
809
|
});
|
|
817
|
-
var anthropicLanguageModelOptions =
|
|
810
|
+
var anthropicLanguageModelOptions = z3.object({
|
|
818
811
|
/**
|
|
819
812
|
* Whether to send reasoning to the model.
|
|
820
813
|
*
|
|
821
814
|
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
822
815
|
*/
|
|
823
|
-
sendReasoning:
|
|
816
|
+
sendReasoning: z3.boolean().optional(),
|
|
824
817
|
/**
|
|
825
818
|
* Determines how structured outputs are generated.
|
|
826
819
|
*
|
|
@@ -828,66 +821,66 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
828
821
|
* - `jsonTool`: Use a special 'json' tool to specify the structured output format.
|
|
829
822
|
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default).
|
|
830
823
|
*/
|
|
831
|
-
structuredOutputMode:
|
|
824
|
+
structuredOutputMode: z3.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
832
825
|
/**
|
|
833
826
|
* Configuration for enabling Claude's extended thinking.
|
|
834
827
|
*
|
|
835
828
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
836
829
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
837
830
|
*/
|
|
838
|
-
thinking:
|
|
839
|
-
|
|
831
|
+
thinking: z3.discriminatedUnion("type", [
|
|
832
|
+
z3.object({
|
|
840
833
|
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
841
|
-
type:
|
|
834
|
+
type: z3.literal("adaptive")
|
|
842
835
|
}),
|
|
843
|
-
|
|
836
|
+
z3.object({
|
|
844
837
|
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
845
|
-
type:
|
|
846
|
-
budgetTokens:
|
|
838
|
+
type: z3.literal("enabled"),
|
|
839
|
+
budgetTokens: z3.number().optional()
|
|
847
840
|
}),
|
|
848
|
-
|
|
849
|
-
type:
|
|
841
|
+
z3.object({
|
|
842
|
+
type: z3.literal("disabled")
|
|
850
843
|
})
|
|
851
844
|
]).optional(),
|
|
852
845
|
/**
|
|
853
846
|
* Whether to disable parallel function calling during tool use. Default is false.
|
|
854
847
|
* When set to true, Claude will use at most one tool per response.
|
|
855
848
|
*/
|
|
856
|
-
disableParallelToolUse:
|
|
849
|
+
disableParallelToolUse: z3.boolean().optional(),
|
|
857
850
|
/**
|
|
858
851
|
* Cache control settings for this message.
|
|
859
852
|
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
860
853
|
*/
|
|
861
|
-
cacheControl:
|
|
862
|
-
type:
|
|
863
|
-
ttl:
|
|
854
|
+
cacheControl: z3.object({
|
|
855
|
+
type: z3.literal("ephemeral"),
|
|
856
|
+
ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
|
|
864
857
|
}).optional(),
|
|
865
858
|
/**
|
|
866
859
|
* Metadata to include with the request.
|
|
867
860
|
*
|
|
868
861
|
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
869
862
|
*/
|
|
870
|
-
metadata:
|
|
863
|
+
metadata: z3.object({
|
|
871
864
|
/**
|
|
872
865
|
* An external identifier for the user associated with the request.
|
|
873
866
|
*
|
|
874
867
|
* Should be a UUID, hash value, or other opaque identifier.
|
|
875
868
|
* Must not contain PII (name, email, phone number, etc.).
|
|
876
869
|
*/
|
|
877
|
-
userId:
|
|
870
|
+
userId: z3.string().optional()
|
|
878
871
|
}).optional(),
|
|
879
872
|
/**
|
|
880
873
|
* MCP servers to be utilized in this request.
|
|
881
874
|
*/
|
|
882
|
-
mcpServers:
|
|
883
|
-
|
|
884
|
-
type:
|
|
885
|
-
name:
|
|
886
|
-
url:
|
|
887
|
-
authorizationToken:
|
|
888
|
-
toolConfiguration:
|
|
889
|
-
enabled:
|
|
890
|
-
allowedTools:
|
|
875
|
+
mcpServers: z3.array(
|
|
876
|
+
z3.object({
|
|
877
|
+
type: z3.literal("url"),
|
|
878
|
+
name: z3.string(),
|
|
879
|
+
url: z3.string(),
|
|
880
|
+
authorizationToken: z3.string().nullish(),
|
|
881
|
+
toolConfiguration: z3.object({
|
|
882
|
+
enabled: z3.boolean().nullish(),
|
|
883
|
+
allowedTools: z3.array(z3.string()).nullish()
|
|
891
884
|
}).nullish()
|
|
892
885
|
})
|
|
893
886
|
).optional(),
|
|
@@ -896,19 +889,19 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
896
889
|
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
897
890
|
* Requires code execution tool to be enabled.
|
|
898
891
|
*/
|
|
899
|
-
container:
|
|
900
|
-
id:
|
|
901
|
-
skills:
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
type:
|
|
905
|
-
skillId:
|
|
906
|
-
version:
|
|
892
|
+
container: z3.object({
|
|
893
|
+
id: z3.string().optional(),
|
|
894
|
+
skills: z3.array(
|
|
895
|
+
z3.discriminatedUnion("type", [
|
|
896
|
+
z3.object({
|
|
897
|
+
type: z3.literal("anthropic"),
|
|
898
|
+
skillId: z3.string(),
|
|
899
|
+
version: z3.string().optional()
|
|
907
900
|
}),
|
|
908
|
-
|
|
909
|
-
type:
|
|
910
|
-
providerReference:
|
|
911
|
-
version:
|
|
901
|
+
z3.object({
|
|
902
|
+
type: z3.literal("custom"),
|
|
903
|
+
providerReference: z3.record(z3.string(), z3.string()),
|
|
904
|
+
version: z3.string().optional()
|
|
912
905
|
})
|
|
913
906
|
])
|
|
914
907
|
).optional()
|
|
@@ -921,16 +914,16 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
921
914
|
*
|
|
922
915
|
* @default true
|
|
923
916
|
*/
|
|
924
|
-
toolStreaming:
|
|
917
|
+
toolStreaming: z3.boolean().optional(),
|
|
925
918
|
/**
|
|
926
919
|
* @default 'high'
|
|
927
920
|
*/
|
|
928
|
-
effort:
|
|
921
|
+
effort: z3.enum(["low", "medium", "high", "max"]).optional(),
|
|
929
922
|
/**
|
|
930
923
|
* Enable fast mode for faster inference (2.5x faster output token speeds).
|
|
931
924
|
* Only supported with claude-opus-4-6.
|
|
932
925
|
*/
|
|
933
|
-
speed:
|
|
926
|
+
speed: z3.enum(["fast", "standard"]).optional(),
|
|
934
927
|
/**
|
|
935
928
|
* Controls where model inference runs for this request.
|
|
936
929
|
*
|
|
@@ -939,56 +932,56 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
939
932
|
*
|
|
940
933
|
* See https://platform.claude.com/docs/en/build-with-claude/data-residency
|
|
941
934
|
*/
|
|
942
|
-
inferenceGeo:
|
|
935
|
+
inferenceGeo: z3.enum(["us", "global"]).optional(),
|
|
943
936
|
/**
|
|
944
937
|
* A set of beta features to enable.
|
|
945
938
|
* Allow a provider to receive the full `betas` set if it needs it.
|
|
946
939
|
*/
|
|
947
|
-
anthropicBeta:
|
|
948
|
-
contextManagement:
|
|
949
|
-
edits:
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
type:
|
|
953
|
-
trigger:
|
|
954
|
-
|
|
955
|
-
type:
|
|
956
|
-
value:
|
|
940
|
+
anthropicBeta: z3.array(z3.string()).optional(),
|
|
941
|
+
contextManagement: z3.object({
|
|
942
|
+
edits: z3.array(
|
|
943
|
+
z3.discriminatedUnion("type", [
|
|
944
|
+
z3.object({
|
|
945
|
+
type: z3.literal("clear_tool_uses_20250919"),
|
|
946
|
+
trigger: z3.discriminatedUnion("type", [
|
|
947
|
+
z3.object({
|
|
948
|
+
type: z3.literal("input_tokens"),
|
|
949
|
+
value: z3.number()
|
|
957
950
|
}),
|
|
958
|
-
|
|
959
|
-
type:
|
|
960
|
-
value:
|
|
951
|
+
z3.object({
|
|
952
|
+
type: z3.literal("tool_uses"),
|
|
953
|
+
value: z3.number()
|
|
961
954
|
})
|
|
962
955
|
]).optional(),
|
|
963
|
-
keep:
|
|
964
|
-
type:
|
|
965
|
-
value:
|
|
956
|
+
keep: z3.object({
|
|
957
|
+
type: z3.literal("tool_uses"),
|
|
958
|
+
value: z3.number()
|
|
966
959
|
}).optional(),
|
|
967
|
-
clearAtLeast:
|
|
968
|
-
type:
|
|
969
|
-
value:
|
|
960
|
+
clearAtLeast: z3.object({
|
|
961
|
+
type: z3.literal("input_tokens"),
|
|
962
|
+
value: z3.number()
|
|
970
963
|
}).optional(),
|
|
971
|
-
clearToolInputs:
|
|
972
|
-
excludeTools:
|
|
964
|
+
clearToolInputs: z3.boolean().optional(),
|
|
965
|
+
excludeTools: z3.array(z3.string()).optional()
|
|
973
966
|
}),
|
|
974
|
-
|
|
975
|
-
type:
|
|
976
|
-
keep:
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
type:
|
|
980
|
-
value:
|
|
967
|
+
z3.object({
|
|
968
|
+
type: z3.literal("clear_thinking_20251015"),
|
|
969
|
+
keep: z3.union([
|
|
970
|
+
z3.literal("all"),
|
|
971
|
+
z3.object({
|
|
972
|
+
type: z3.literal("thinking_turns"),
|
|
973
|
+
value: z3.number()
|
|
981
974
|
})
|
|
982
975
|
]).optional()
|
|
983
976
|
}),
|
|
984
|
-
|
|
985
|
-
type:
|
|
986
|
-
trigger:
|
|
987
|
-
type:
|
|
988
|
-
value:
|
|
977
|
+
z3.object({
|
|
978
|
+
type: z3.literal("compact_20260112"),
|
|
979
|
+
trigger: z3.object({
|
|
980
|
+
type: z3.literal("input_tokens"),
|
|
981
|
+
value: z3.number()
|
|
989
982
|
}).optional(),
|
|
990
|
-
pauseAfterCompaction:
|
|
991
|
-
instructions:
|
|
983
|
+
pauseAfterCompaction: z3.boolean().optional(),
|
|
984
|
+
instructions: z3.string().optional()
|
|
992
985
|
})
|
|
993
986
|
])
|
|
994
987
|
)
|
|
@@ -996,7 +989,9 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
996
989
|
});
|
|
997
990
|
|
|
998
991
|
// src/anthropic-prepare-tools.ts
|
|
999
|
-
|
|
992
|
+
import {
|
|
993
|
+
UnsupportedFunctionalityError
|
|
994
|
+
} from "@ai-sdk/provider";
|
|
1000
995
|
|
|
1001
996
|
// src/get-cache-control.ts
|
|
1002
997
|
var MAX_CACHE_BREAKPOINTS = 4;
|
|
@@ -1041,31 +1036,31 @@ var CacheControlValidator = class {
|
|
|
1041
1036
|
};
|
|
1042
1037
|
|
|
1043
1038
|
// src/tool/text-editor_20250728.ts
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
var textEditor_20250728ArgsSchema = (
|
|
1048
|
-
() => (
|
|
1049
|
-
|
|
1050
|
-
maxCharacters:
|
|
1039
|
+
import { createProviderToolFactory } from "@ai-sdk/provider-utils";
|
|
1040
|
+
import { z as z4 } from "zod/v4";
|
|
1041
|
+
import { lazySchema as lazySchema3, zodSchema as zodSchema3 } from "@ai-sdk/provider-utils";
|
|
1042
|
+
var textEditor_20250728ArgsSchema = lazySchema3(
|
|
1043
|
+
() => zodSchema3(
|
|
1044
|
+
z4.object({
|
|
1045
|
+
maxCharacters: z4.number().optional()
|
|
1051
1046
|
})
|
|
1052
1047
|
)
|
|
1053
1048
|
);
|
|
1054
|
-
var textEditor_20250728InputSchema = (
|
|
1055
|
-
() => (
|
|
1056
|
-
|
|
1057
|
-
command:
|
|
1058
|
-
path:
|
|
1059
|
-
file_text:
|
|
1060
|
-
insert_line:
|
|
1061
|
-
new_str:
|
|
1062
|
-
insert_text:
|
|
1063
|
-
old_str:
|
|
1064
|
-
view_range:
|
|
1049
|
+
var textEditor_20250728InputSchema = lazySchema3(
|
|
1050
|
+
() => zodSchema3(
|
|
1051
|
+
z4.object({
|
|
1052
|
+
command: z4.enum(["view", "create", "str_replace", "insert"]),
|
|
1053
|
+
path: z4.string(),
|
|
1054
|
+
file_text: z4.string().optional(),
|
|
1055
|
+
insert_line: z4.number().int().optional(),
|
|
1056
|
+
new_str: z4.string().optional(),
|
|
1057
|
+
insert_text: z4.string().optional(),
|
|
1058
|
+
old_str: z4.string().optional(),
|
|
1059
|
+
view_range: z4.array(z4.number().int()).optional()
|
|
1065
1060
|
})
|
|
1066
1061
|
)
|
|
1067
1062
|
);
|
|
1068
|
-
var factory =
|
|
1063
|
+
var factory = createProviderToolFactory({
|
|
1069
1064
|
id: "anthropic.text_editor_20250728",
|
|
1070
1065
|
inputSchema: textEditor_20250728InputSchema
|
|
1071
1066
|
});
|
|
@@ -1074,45 +1069,49 @@ var textEditor_20250728 = (args = {}) => {
|
|
|
1074
1069
|
};
|
|
1075
1070
|
|
|
1076
1071
|
// src/tool/web-search_20260209.ts
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1072
|
+
import {
|
|
1073
|
+
createProviderToolFactoryWithOutputSchema,
|
|
1074
|
+
lazySchema as lazySchema4,
|
|
1075
|
+
zodSchema as zodSchema4
|
|
1076
|
+
} from "@ai-sdk/provider-utils";
|
|
1077
|
+
import { z as z5 } from "zod/v4";
|
|
1078
|
+
var webSearch_20260209ArgsSchema = lazySchema4(
|
|
1079
|
+
() => zodSchema4(
|
|
1080
|
+
z5.object({
|
|
1081
|
+
maxUses: z5.number().optional(),
|
|
1082
|
+
allowedDomains: z5.array(z5.string()).optional(),
|
|
1083
|
+
blockedDomains: z5.array(z5.string()).optional(),
|
|
1084
|
+
userLocation: z5.object({
|
|
1085
|
+
type: z5.literal("approximate"),
|
|
1086
|
+
city: z5.string().optional(),
|
|
1087
|
+
region: z5.string().optional(),
|
|
1088
|
+
country: z5.string().optional(),
|
|
1089
|
+
timezone: z5.string().optional()
|
|
1091
1090
|
}).optional()
|
|
1092
1091
|
})
|
|
1093
1092
|
)
|
|
1094
1093
|
);
|
|
1095
|
-
var webSearch_20260209OutputSchema = (
|
|
1096
|
-
() => (
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
url:
|
|
1100
|
-
title:
|
|
1101
|
-
pageAge:
|
|
1102
|
-
encryptedContent:
|
|
1103
|
-
type:
|
|
1094
|
+
var webSearch_20260209OutputSchema = lazySchema4(
|
|
1095
|
+
() => zodSchema4(
|
|
1096
|
+
z5.array(
|
|
1097
|
+
z5.object({
|
|
1098
|
+
url: z5.string(),
|
|
1099
|
+
title: z5.string().nullable(),
|
|
1100
|
+
pageAge: z5.string().nullable(),
|
|
1101
|
+
encryptedContent: z5.string(),
|
|
1102
|
+
type: z5.literal("web_search_result")
|
|
1104
1103
|
})
|
|
1105
1104
|
)
|
|
1106
1105
|
)
|
|
1107
1106
|
);
|
|
1108
|
-
var webSearch_20260209InputSchema = (
|
|
1109
|
-
() => (
|
|
1110
|
-
|
|
1111
|
-
query:
|
|
1107
|
+
var webSearch_20260209InputSchema = lazySchema4(
|
|
1108
|
+
() => zodSchema4(
|
|
1109
|
+
z5.object({
|
|
1110
|
+
query: z5.string()
|
|
1112
1111
|
})
|
|
1113
1112
|
)
|
|
1114
1113
|
);
|
|
1115
|
-
var factory2 =
|
|
1114
|
+
var factory2 = createProviderToolFactoryWithOutputSchema({
|
|
1116
1115
|
id: "anthropic.web_search_20260209",
|
|
1117
1116
|
inputSchema: webSearch_20260209InputSchema,
|
|
1118
1117
|
outputSchema: webSearch_20260209OutputSchema,
|
|
@@ -1123,45 +1122,49 @@ var webSearch_20260209 = (args = {}) => {
|
|
|
1123
1122
|
};
|
|
1124
1123
|
|
|
1125
1124
|
// src/tool/web-search_20250305.ts
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1125
|
+
import {
|
|
1126
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
1127
|
+
lazySchema as lazySchema5,
|
|
1128
|
+
zodSchema as zodSchema5
|
|
1129
|
+
} from "@ai-sdk/provider-utils";
|
|
1130
|
+
import { z as z6 } from "zod/v4";
|
|
1131
|
+
var webSearch_20250305ArgsSchema = lazySchema5(
|
|
1132
|
+
() => zodSchema5(
|
|
1133
|
+
z6.object({
|
|
1134
|
+
maxUses: z6.number().optional(),
|
|
1135
|
+
allowedDomains: z6.array(z6.string()).optional(),
|
|
1136
|
+
blockedDomains: z6.array(z6.string()).optional(),
|
|
1137
|
+
userLocation: z6.object({
|
|
1138
|
+
type: z6.literal("approximate"),
|
|
1139
|
+
city: z6.string().optional(),
|
|
1140
|
+
region: z6.string().optional(),
|
|
1141
|
+
country: z6.string().optional(),
|
|
1142
|
+
timezone: z6.string().optional()
|
|
1140
1143
|
}).optional()
|
|
1141
1144
|
})
|
|
1142
1145
|
)
|
|
1143
1146
|
);
|
|
1144
|
-
var webSearch_20250305OutputSchema = (
|
|
1145
|
-
() => (
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
url:
|
|
1149
|
-
title:
|
|
1150
|
-
pageAge:
|
|
1151
|
-
encryptedContent:
|
|
1152
|
-
type:
|
|
1147
|
+
var webSearch_20250305OutputSchema = lazySchema5(
|
|
1148
|
+
() => zodSchema5(
|
|
1149
|
+
z6.array(
|
|
1150
|
+
z6.object({
|
|
1151
|
+
url: z6.string(),
|
|
1152
|
+
title: z6.string().nullable(),
|
|
1153
|
+
pageAge: z6.string().nullable(),
|
|
1154
|
+
encryptedContent: z6.string(),
|
|
1155
|
+
type: z6.literal("web_search_result")
|
|
1153
1156
|
})
|
|
1154
1157
|
)
|
|
1155
1158
|
)
|
|
1156
1159
|
);
|
|
1157
|
-
var webSearch_20250305InputSchema = (
|
|
1158
|
-
() => (
|
|
1159
|
-
|
|
1160
|
-
query:
|
|
1160
|
+
var webSearch_20250305InputSchema = lazySchema5(
|
|
1161
|
+
() => zodSchema5(
|
|
1162
|
+
z6.object({
|
|
1163
|
+
query: z6.string()
|
|
1161
1164
|
})
|
|
1162
1165
|
)
|
|
1163
1166
|
);
|
|
1164
|
-
var factory3 = (
|
|
1167
|
+
var factory3 = createProviderToolFactoryWithOutputSchema2({
|
|
1165
1168
|
id: "anthropic.web_search_20250305",
|
|
1166
1169
|
inputSchema: webSearch_20250305InputSchema,
|
|
1167
1170
|
outputSchema: webSearch_20250305OutputSchema,
|
|
@@ -1172,53 +1175,57 @@ var webSearch_20250305 = (args = {}) => {
|
|
|
1172
1175
|
};
|
|
1173
1176
|
|
|
1174
1177
|
// src/tool/web-fetch-20260209.ts
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1178
|
+
import {
|
|
1179
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
1180
|
+
lazySchema as lazySchema6,
|
|
1181
|
+
zodSchema as zodSchema6
|
|
1182
|
+
} from "@ai-sdk/provider-utils";
|
|
1183
|
+
import { z as z7 } from "zod/v4";
|
|
1184
|
+
var webFetch_20260209ArgsSchema = lazySchema6(
|
|
1185
|
+
() => zodSchema6(
|
|
1186
|
+
z7.object({
|
|
1187
|
+
maxUses: z7.number().optional(),
|
|
1188
|
+
allowedDomains: z7.array(z7.string()).optional(),
|
|
1189
|
+
blockedDomains: z7.array(z7.string()).optional(),
|
|
1190
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1191
|
+
maxContentTokens: z7.number().optional()
|
|
1185
1192
|
})
|
|
1186
1193
|
)
|
|
1187
1194
|
);
|
|
1188
|
-
var webFetch_20260209OutputSchema = (
|
|
1189
|
-
() => (
|
|
1190
|
-
|
|
1191
|
-
type:
|
|
1192
|
-
url:
|
|
1193
|
-
content:
|
|
1194
|
-
type:
|
|
1195
|
-
title:
|
|
1196
|
-
citations:
|
|
1197
|
-
source:
|
|
1198
|
-
|
|
1199
|
-
type:
|
|
1200
|
-
mediaType:
|
|
1201
|
-
data:
|
|
1195
|
+
var webFetch_20260209OutputSchema = lazySchema6(
|
|
1196
|
+
() => zodSchema6(
|
|
1197
|
+
z7.object({
|
|
1198
|
+
type: z7.literal("web_fetch_result"),
|
|
1199
|
+
url: z7.string(),
|
|
1200
|
+
content: z7.object({
|
|
1201
|
+
type: z7.literal("document"),
|
|
1202
|
+
title: z7.string().nullable(),
|
|
1203
|
+
citations: z7.object({ enabled: z7.boolean() }).optional(),
|
|
1204
|
+
source: z7.union([
|
|
1205
|
+
z7.object({
|
|
1206
|
+
type: z7.literal("base64"),
|
|
1207
|
+
mediaType: z7.literal("application/pdf"),
|
|
1208
|
+
data: z7.string()
|
|
1202
1209
|
}),
|
|
1203
|
-
|
|
1204
|
-
type:
|
|
1205
|
-
mediaType:
|
|
1206
|
-
data:
|
|
1210
|
+
z7.object({
|
|
1211
|
+
type: z7.literal("text"),
|
|
1212
|
+
mediaType: z7.literal("text/plain"),
|
|
1213
|
+
data: z7.string()
|
|
1207
1214
|
})
|
|
1208
1215
|
])
|
|
1209
1216
|
}),
|
|
1210
|
-
retrievedAt:
|
|
1217
|
+
retrievedAt: z7.string().nullable()
|
|
1211
1218
|
})
|
|
1212
1219
|
)
|
|
1213
1220
|
);
|
|
1214
|
-
var webFetch_20260209InputSchema = (
|
|
1215
|
-
() => (
|
|
1216
|
-
|
|
1217
|
-
url:
|
|
1221
|
+
var webFetch_20260209InputSchema = lazySchema6(
|
|
1222
|
+
() => zodSchema6(
|
|
1223
|
+
z7.object({
|
|
1224
|
+
url: z7.string()
|
|
1218
1225
|
})
|
|
1219
1226
|
)
|
|
1220
1227
|
);
|
|
1221
|
-
var factory4 = (
|
|
1228
|
+
var factory4 = createProviderToolFactoryWithOutputSchema3({
|
|
1222
1229
|
id: "anthropic.web_fetch_20260209",
|
|
1223
1230
|
inputSchema: webFetch_20260209InputSchema,
|
|
1224
1231
|
outputSchema: webFetch_20260209OutputSchema,
|
|
@@ -1229,53 +1236,57 @@ var webFetch_20260209 = (args = {}) => {
|
|
|
1229
1236
|
};
|
|
1230
1237
|
|
|
1231
1238
|
// src/tool/web-fetch-20250910.ts
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1239
|
+
import {
|
|
1240
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
1241
|
+
lazySchema as lazySchema7,
|
|
1242
|
+
zodSchema as zodSchema7
|
|
1243
|
+
} from "@ai-sdk/provider-utils";
|
|
1244
|
+
import { z as z8 } from "zod/v4";
|
|
1245
|
+
var webFetch_20250910ArgsSchema = lazySchema7(
|
|
1246
|
+
() => zodSchema7(
|
|
1247
|
+
z8.object({
|
|
1248
|
+
maxUses: z8.number().optional(),
|
|
1249
|
+
allowedDomains: z8.array(z8.string()).optional(),
|
|
1250
|
+
blockedDomains: z8.array(z8.string()).optional(),
|
|
1251
|
+
citations: z8.object({ enabled: z8.boolean() }).optional(),
|
|
1252
|
+
maxContentTokens: z8.number().optional()
|
|
1242
1253
|
})
|
|
1243
1254
|
)
|
|
1244
1255
|
);
|
|
1245
|
-
var webFetch_20250910OutputSchema = (
|
|
1246
|
-
() => (
|
|
1247
|
-
|
|
1248
|
-
type:
|
|
1249
|
-
url:
|
|
1250
|
-
content:
|
|
1251
|
-
type:
|
|
1252
|
-
title:
|
|
1253
|
-
citations:
|
|
1254
|
-
source:
|
|
1255
|
-
|
|
1256
|
-
type:
|
|
1257
|
-
mediaType:
|
|
1258
|
-
data:
|
|
1256
|
+
var webFetch_20250910OutputSchema = lazySchema7(
|
|
1257
|
+
() => zodSchema7(
|
|
1258
|
+
z8.object({
|
|
1259
|
+
type: z8.literal("web_fetch_result"),
|
|
1260
|
+
url: z8.string(),
|
|
1261
|
+
content: z8.object({
|
|
1262
|
+
type: z8.literal("document"),
|
|
1263
|
+
title: z8.string().nullable(),
|
|
1264
|
+
citations: z8.object({ enabled: z8.boolean() }).optional(),
|
|
1265
|
+
source: z8.union([
|
|
1266
|
+
z8.object({
|
|
1267
|
+
type: z8.literal("base64"),
|
|
1268
|
+
mediaType: z8.literal("application/pdf"),
|
|
1269
|
+
data: z8.string()
|
|
1259
1270
|
}),
|
|
1260
|
-
|
|
1261
|
-
type:
|
|
1262
|
-
mediaType:
|
|
1263
|
-
data:
|
|
1271
|
+
z8.object({
|
|
1272
|
+
type: z8.literal("text"),
|
|
1273
|
+
mediaType: z8.literal("text/plain"),
|
|
1274
|
+
data: z8.string()
|
|
1264
1275
|
})
|
|
1265
1276
|
])
|
|
1266
1277
|
}),
|
|
1267
|
-
retrievedAt:
|
|
1278
|
+
retrievedAt: z8.string().nullable()
|
|
1268
1279
|
})
|
|
1269
1280
|
)
|
|
1270
1281
|
);
|
|
1271
|
-
var webFetch_20250910InputSchema = (
|
|
1272
|
-
() => (
|
|
1273
|
-
|
|
1274
|
-
url:
|
|
1282
|
+
var webFetch_20250910InputSchema = lazySchema7(
|
|
1283
|
+
() => zodSchema7(
|
|
1284
|
+
z8.object({
|
|
1285
|
+
url: z8.string()
|
|
1275
1286
|
})
|
|
1276
1287
|
)
|
|
1277
1288
|
);
|
|
1278
|
-
var factory5 = (
|
|
1289
|
+
var factory5 = createProviderToolFactoryWithOutputSchema4({
|
|
1279
1290
|
id: "anthropic.web_fetch_20250910",
|
|
1280
1291
|
inputSchema: webFetch_20250910InputSchema,
|
|
1281
1292
|
outputSchema: webFetch_20250910OutputSchema,
|
|
@@ -1286,7 +1297,7 @@ var webFetch_20250910 = (args = {}) => {
|
|
|
1286
1297
|
};
|
|
1287
1298
|
|
|
1288
1299
|
// src/anthropic-prepare-tools.ts
|
|
1289
|
-
|
|
1300
|
+
import { validateTypes } from "@ai-sdk/provider-utils";
|
|
1290
1301
|
async function prepareTools({
|
|
1291
1302
|
tools,
|
|
1292
1303
|
toolChoice,
|
|
@@ -1436,7 +1447,7 @@ async function prepareTools({
|
|
|
1436
1447
|
break;
|
|
1437
1448
|
}
|
|
1438
1449
|
case "anthropic.text_editor_20250728": {
|
|
1439
|
-
const args = await
|
|
1450
|
+
const args = await validateTypes({
|
|
1440
1451
|
value: tool.args,
|
|
1441
1452
|
schema: textEditor_20250728ArgsSchema
|
|
1442
1453
|
});
|
|
@@ -1476,7 +1487,7 @@ async function prepareTools({
|
|
|
1476
1487
|
}
|
|
1477
1488
|
case "anthropic.web_fetch_20250910": {
|
|
1478
1489
|
betas.add("web-fetch-2025-09-10");
|
|
1479
|
-
const args = await
|
|
1490
|
+
const args = await validateTypes({
|
|
1480
1491
|
value: tool.args,
|
|
1481
1492
|
schema: webFetch_20250910ArgsSchema
|
|
1482
1493
|
});
|
|
@@ -1494,7 +1505,7 @@ async function prepareTools({
|
|
|
1494
1505
|
}
|
|
1495
1506
|
case "anthropic.web_fetch_20260209": {
|
|
1496
1507
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1497
|
-
const args = await
|
|
1508
|
+
const args = await validateTypes({
|
|
1498
1509
|
value: tool.args,
|
|
1499
1510
|
schema: webFetch_20260209ArgsSchema
|
|
1500
1511
|
});
|
|
@@ -1511,7 +1522,7 @@ async function prepareTools({
|
|
|
1511
1522
|
break;
|
|
1512
1523
|
}
|
|
1513
1524
|
case "anthropic.web_search_20250305": {
|
|
1514
|
-
const args = await
|
|
1525
|
+
const args = await validateTypes({
|
|
1515
1526
|
value: tool.args,
|
|
1516
1527
|
schema: webSearch_20250305ArgsSchema
|
|
1517
1528
|
});
|
|
@@ -1528,7 +1539,7 @@ async function prepareTools({
|
|
|
1528
1539
|
}
|
|
1529
1540
|
case "anthropic.web_search_20260209": {
|
|
1530
1541
|
betas.add("code-execution-web-tools-2026-02-09");
|
|
1531
|
-
const args = await
|
|
1542
|
+
const args = await validateTypes({
|
|
1532
1543
|
value: tool.args,
|
|
1533
1544
|
schema: webSearch_20260209ArgsSchema
|
|
1534
1545
|
});
|
|
@@ -1621,7 +1632,7 @@ async function prepareTools({
|
|
|
1621
1632
|
};
|
|
1622
1633
|
default: {
|
|
1623
1634
|
const _exhaustiveCheck = type;
|
|
1624
|
-
throw new
|
|
1635
|
+
throw new UnsupportedFunctionalityError({
|
|
1625
1636
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
1626
1637
|
});
|
|
1627
1638
|
}
|
|
@@ -1669,36 +1680,50 @@ function convertAnthropicMessagesUsage({
|
|
|
1669
1680
|
}
|
|
1670
1681
|
|
|
1671
1682
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1672
|
-
|
|
1673
|
-
|
|
1683
|
+
import {
|
|
1684
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
1685
|
+
} from "@ai-sdk/provider";
|
|
1686
|
+
import {
|
|
1687
|
+
convertBase64ToUint8Array,
|
|
1688
|
+
convertToBase64,
|
|
1689
|
+
isProviderReference,
|
|
1690
|
+
parseProviderOptions,
|
|
1691
|
+
resolveProviderReference,
|
|
1692
|
+
validateTypes as validateTypes2,
|
|
1693
|
+
isNonNullable
|
|
1694
|
+
} from "@ai-sdk/provider-utils";
|
|
1674
1695
|
|
|
1675
1696
|
// src/tool/code-execution_20250522.ts
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1697
|
+
import {
|
|
1698
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
1699
|
+
lazySchema as lazySchema8,
|
|
1700
|
+
zodSchema as zodSchema8
|
|
1701
|
+
} from "@ai-sdk/provider-utils";
|
|
1702
|
+
import { z as z9 } from "zod/v4";
|
|
1703
|
+
var codeExecution_20250522OutputSchema = lazySchema8(
|
|
1704
|
+
() => zodSchema8(
|
|
1705
|
+
z9.object({
|
|
1706
|
+
type: z9.literal("code_execution_result"),
|
|
1707
|
+
stdout: z9.string(),
|
|
1708
|
+
stderr: z9.string(),
|
|
1709
|
+
return_code: z9.number(),
|
|
1710
|
+
content: z9.array(
|
|
1711
|
+
z9.object({
|
|
1712
|
+
type: z9.literal("code_execution_output"),
|
|
1713
|
+
file_id: z9.string()
|
|
1689
1714
|
})
|
|
1690
1715
|
).optional().default([])
|
|
1691
1716
|
})
|
|
1692
1717
|
)
|
|
1693
1718
|
);
|
|
1694
|
-
var codeExecution_20250522InputSchema = (
|
|
1695
|
-
() => (
|
|
1696
|
-
|
|
1697
|
-
code:
|
|
1719
|
+
var codeExecution_20250522InputSchema = lazySchema8(
|
|
1720
|
+
() => zodSchema8(
|
|
1721
|
+
z9.object({
|
|
1722
|
+
code: z9.string()
|
|
1698
1723
|
})
|
|
1699
1724
|
)
|
|
1700
1725
|
);
|
|
1701
|
-
var factory6 = (
|
|
1726
|
+
var factory6 = createProviderToolFactoryWithOutputSchema5({
|
|
1702
1727
|
id: "anthropic.code_execution_20250522",
|
|
1703
1728
|
inputSchema: codeExecution_20250522InputSchema,
|
|
1704
1729
|
outputSchema: codeExecution_20250522OutputSchema
|
|
@@ -1708,102 +1733,106 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
1708
1733
|
};
|
|
1709
1734
|
|
|
1710
1735
|
// src/tool/code-execution_20250825.ts
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1736
|
+
import {
|
|
1737
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
1738
|
+
lazySchema as lazySchema9,
|
|
1739
|
+
zodSchema as zodSchema9
|
|
1740
|
+
} from "@ai-sdk/provider-utils";
|
|
1741
|
+
import { z as z10 } from "zod/v4";
|
|
1742
|
+
var codeExecution_20250825OutputSchema = lazySchema9(
|
|
1743
|
+
() => zodSchema9(
|
|
1744
|
+
z10.discriminatedUnion("type", [
|
|
1745
|
+
z10.object({
|
|
1746
|
+
type: z10.literal("code_execution_result"),
|
|
1747
|
+
stdout: z10.string(),
|
|
1748
|
+
stderr: z10.string(),
|
|
1749
|
+
return_code: z10.number(),
|
|
1750
|
+
content: z10.array(
|
|
1751
|
+
z10.object({
|
|
1752
|
+
type: z10.literal("code_execution_output"),
|
|
1753
|
+
file_id: z10.string()
|
|
1725
1754
|
})
|
|
1726
1755
|
).optional().default([])
|
|
1727
1756
|
}),
|
|
1728
|
-
|
|
1729
|
-
type:
|
|
1730
|
-
content:
|
|
1731
|
-
|
|
1732
|
-
type:
|
|
1733
|
-
file_id:
|
|
1757
|
+
z10.object({
|
|
1758
|
+
type: z10.literal("bash_code_execution_result"),
|
|
1759
|
+
content: z10.array(
|
|
1760
|
+
z10.object({
|
|
1761
|
+
type: z10.literal("bash_code_execution_output"),
|
|
1762
|
+
file_id: z10.string()
|
|
1734
1763
|
})
|
|
1735
1764
|
),
|
|
1736
|
-
stdout:
|
|
1737
|
-
stderr:
|
|
1738
|
-
return_code:
|
|
1765
|
+
stdout: z10.string(),
|
|
1766
|
+
stderr: z10.string(),
|
|
1767
|
+
return_code: z10.number()
|
|
1739
1768
|
}),
|
|
1740
|
-
|
|
1741
|
-
type:
|
|
1742
|
-
error_code:
|
|
1769
|
+
z10.object({
|
|
1770
|
+
type: z10.literal("bash_code_execution_tool_result_error"),
|
|
1771
|
+
error_code: z10.string()
|
|
1743
1772
|
}),
|
|
1744
|
-
|
|
1745
|
-
type:
|
|
1746
|
-
error_code:
|
|
1773
|
+
z10.object({
|
|
1774
|
+
type: z10.literal("text_editor_code_execution_tool_result_error"),
|
|
1775
|
+
error_code: z10.string()
|
|
1747
1776
|
}),
|
|
1748
|
-
|
|
1749
|
-
type:
|
|
1750
|
-
content:
|
|
1751
|
-
file_type:
|
|
1752
|
-
num_lines:
|
|
1753
|
-
start_line:
|
|
1754
|
-
total_lines:
|
|
1777
|
+
z10.object({
|
|
1778
|
+
type: z10.literal("text_editor_code_execution_view_result"),
|
|
1779
|
+
content: z10.string(),
|
|
1780
|
+
file_type: z10.string(),
|
|
1781
|
+
num_lines: z10.number().nullable(),
|
|
1782
|
+
start_line: z10.number().nullable(),
|
|
1783
|
+
total_lines: z10.number().nullable()
|
|
1755
1784
|
}),
|
|
1756
|
-
|
|
1757
|
-
type:
|
|
1758
|
-
is_file_update:
|
|
1785
|
+
z10.object({
|
|
1786
|
+
type: z10.literal("text_editor_code_execution_create_result"),
|
|
1787
|
+
is_file_update: z10.boolean()
|
|
1759
1788
|
}),
|
|
1760
|
-
|
|
1761
|
-
type:
|
|
1762
|
-
lines:
|
|
1763
|
-
new_lines:
|
|
1764
|
-
new_start:
|
|
1765
|
-
old_lines:
|
|
1766
|
-
old_start:
|
|
1789
|
+
z10.object({
|
|
1790
|
+
type: z10.literal("text_editor_code_execution_str_replace_result"),
|
|
1791
|
+
lines: z10.array(z10.string()).nullable(),
|
|
1792
|
+
new_lines: z10.number().nullable(),
|
|
1793
|
+
new_start: z10.number().nullable(),
|
|
1794
|
+
old_lines: z10.number().nullable(),
|
|
1795
|
+
old_start: z10.number().nullable()
|
|
1767
1796
|
})
|
|
1768
1797
|
])
|
|
1769
1798
|
)
|
|
1770
1799
|
);
|
|
1771
|
-
var codeExecution_20250825InputSchema = (
|
|
1772
|
-
() => (
|
|
1773
|
-
|
|
1800
|
+
var codeExecution_20250825InputSchema = lazySchema9(
|
|
1801
|
+
() => zodSchema9(
|
|
1802
|
+
z10.discriminatedUnion("type", [
|
|
1774
1803
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
1775
|
-
|
|
1776
|
-
type:
|
|
1777
|
-
code:
|
|
1804
|
+
z10.object({
|
|
1805
|
+
type: z10.literal("programmatic-tool-call"),
|
|
1806
|
+
code: z10.string()
|
|
1778
1807
|
}),
|
|
1779
|
-
|
|
1780
|
-
type:
|
|
1781
|
-
command:
|
|
1808
|
+
z10.object({
|
|
1809
|
+
type: z10.literal("bash_code_execution"),
|
|
1810
|
+
command: z10.string()
|
|
1782
1811
|
}),
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
type:
|
|
1786
|
-
command:
|
|
1787
|
-
path:
|
|
1812
|
+
z10.discriminatedUnion("command", [
|
|
1813
|
+
z10.object({
|
|
1814
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1815
|
+
command: z10.literal("view"),
|
|
1816
|
+
path: z10.string()
|
|
1788
1817
|
}),
|
|
1789
|
-
|
|
1790
|
-
type:
|
|
1791
|
-
command:
|
|
1792
|
-
path:
|
|
1793
|
-
file_text:
|
|
1818
|
+
z10.object({
|
|
1819
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1820
|
+
command: z10.literal("create"),
|
|
1821
|
+
path: z10.string(),
|
|
1822
|
+
file_text: z10.string().nullish()
|
|
1794
1823
|
}),
|
|
1795
|
-
|
|
1796
|
-
type:
|
|
1797
|
-
command:
|
|
1798
|
-
path:
|
|
1799
|
-
old_str:
|
|
1800
|
-
new_str:
|
|
1824
|
+
z10.object({
|
|
1825
|
+
type: z10.literal("text_editor_code_execution"),
|
|
1826
|
+
command: z10.literal("str_replace"),
|
|
1827
|
+
path: z10.string(),
|
|
1828
|
+
old_str: z10.string(),
|
|
1829
|
+
new_str: z10.string()
|
|
1801
1830
|
})
|
|
1802
1831
|
])
|
|
1803
1832
|
])
|
|
1804
1833
|
)
|
|
1805
1834
|
);
|
|
1806
|
-
var factory7 = (
|
|
1835
|
+
var factory7 = createProviderToolFactoryWithOutputSchema6({
|
|
1807
1836
|
id: "anthropic.code_execution_20250825",
|
|
1808
1837
|
inputSchema: codeExecution_20250825InputSchema,
|
|
1809
1838
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -1817,113 +1846,117 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
1817
1846
|
};
|
|
1818
1847
|
|
|
1819
1848
|
// src/tool/code-execution_20260120.ts
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1849
|
+
import {
|
|
1850
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
1851
|
+
lazySchema as lazySchema10,
|
|
1852
|
+
zodSchema as zodSchema10
|
|
1853
|
+
} from "@ai-sdk/provider-utils";
|
|
1854
|
+
import { z as z11 } from "zod/v4";
|
|
1855
|
+
var codeExecution_20260120OutputSchema = lazySchema10(
|
|
1856
|
+
() => zodSchema10(
|
|
1857
|
+
z11.discriminatedUnion("type", [
|
|
1858
|
+
z11.object({
|
|
1859
|
+
type: z11.literal("code_execution_result"),
|
|
1860
|
+
stdout: z11.string(),
|
|
1861
|
+
stderr: z11.string(),
|
|
1862
|
+
return_code: z11.number(),
|
|
1863
|
+
content: z11.array(
|
|
1864
|
+
z11.object({
|
|
1865
|
+
type: z11.literal("code_execution_output"),
|
|
1866
|
+
file_id: z11.string()
|
|
1834
1867
|
})
|
|
1835
1868
|
).optional().default([])
|
|
1836
1869
|
}),
|
|
1837
|
-
|
|
1838
|
-
type:
|
|
1839
|
-
encrypted_stdout:
|
|
1840
|
-
stderr:
|
|
1841
|
-
return_code:
|
|
1842
|
-
content:
|
|
1843
|
-
|
|
1844
|
-
type:
|
|
1845
|
-
file_id:
|
|
1870
|
+
z11.object({
|
|
1871
|
+
type: z11.literal("encrypted_code_execution_result"),
|
|
1872
|
+
encrypted_stdout: z11.string(),
|
|
1873
|
+
stderr: z11.string(),
|
|
1874
|
+
return_code: z11.number(),
|
|
1875
|
+
content: z11.array(
|
|
1876
|
+
z11.object({
|
|
1877
|
+
type: z11.literal("code_execution_output"),
|
|
1878
|
+
file_id: z11.string()
|
|
1846
1879
|
})
|
|
1847
1880
|
).optional().default([])
|
|
1848
1881
|
}),
|
|
1849
|
-
|
|
1850
|
-
type:
|
|
1851
|
-
content:
|
|
1852
|
-
|
|
1853
|
-
type:
|
|
1854
|
-
file_id:
|
|
1882
|
+
z11.object({
|
|
1883
|
+
type: z11.literal("bash_code_execution_result"),
|
|
1884
|
+
content: z11.array(
|
|
1885
|
+
z11.object({
|
|
1886
|
+
type: z11.literal("bash_code_execution_output"),
|
|
1887
|
+
file_id: z11.string()
|
|
1855
1888
|
})
|
|
1856
1889
|
),
|
|
1857
|
-
stdout:
|
|
1858
|
-
stderr:
|
|
1859
|
-
return_code:
|
|
1890
|
+
stdout: z11.string(),
|
|
1891
|
+
stderr: z11.string(),
|
|
1892
|
+
return_code: z11.number()
|
|
1860
1893
|
}),
|
|
1861
|
-
|
|
1862
|
-
type:
|
|
1863
|
-
error_code:
|
|
1894
|
+
z11.object({
|
|
1895
|
+
type: z11.literal("bash_code_execution_tool_result_error"),
|
|
1896
|
+
error_code: z11.string()
|
|
1864
1897
|
}),
|
|
1865
|
-
|
|
1866
|
-
type:
|
|
1867
|
-
error_code:
|
|
1898
|
+
z11.object({
|
|
1899
|
+
type: z11.literal("text_editor_code_execution_tool_result_error"),
|
|
1900
|
+
error_code: z11.string()
|
|
1868
1901
|
}),
|
|
1869
|
-
|
|
1870
|
-
type:
|
|
1871
|
-
content:
|
|
1872
|
-
file_type:
|
|
1873
|
-
num_lines:
|
|
1874
|
-
start_line:
|
|
1875
|
-
total_lines:
|
|
1902
|
+
z11.object({
|
|
1903
|
+
type: z11.literal("text_editor_code_execution_view_result"),
|
|
1904
|
+
content: z11.string(),
|
|
1905
|
+
file_type: z11.string(),
|
|
1906
|
+
num_lines: z11.number().nullable(),
|
|
1907
|
+
start_line: z11.number().nullable(),
|
|
1908
|
+
total_lines: z11.number().nullable()
|
|
1876
1909
|
}),
|
|
1877
|
-
|
|
1878
|
-
type:
|
|
1879
|
-
is_file_update:
|
|
1910
|
+
z11.object({
|
|
1911
|
+
type: z11.literal("text_editor_code_execution_create_result"),
|
|
1912
|
+
is_file_update: z11.boolean()
|
|
1880
1913
|
}),
|
|
1881
|
-
|
|
1882
|
-
type:
|
|
1883
|
-
lines:
|
|
1884
|
-
new_lines:
|
|
1885
|
-
new_start:
|
|
1886
|
-
old_lines:
|
|
1887
|
-
old_start:
|
|
1914
|
+
z11.object({
|
|
1915
|
+
type: z11.literal("text_editor_code_execution_str_replace_result"),
|
|
1916
|
+
lines: z11.array(z11.string()).nullable(),
|
|
1917
|
+
new_lines: z11.number().nullable(),
|
|
1918
|
+
new_start: z11.number().nullable(),
|
|
1919
|
+
old_lines: z11.number().nullable(),
|
|
1920
|
+
old_start: z11.number().nullable()
|
|
1888
1921
|
})
|
|
1889
1922
|
])
|
|
1890
1923
|
)
|
|
1891
1924
|
);
|
|
1892
|
-
var codeExecution_20260120InputSchema = (
|
|
1893
|
-
() => (
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
type:
|
|
1897
|
-
code:
|
|
1925
|
+
var codeExecution_20260120InputSchema = lazySchema10(
|
|
1926
|
+
() => zodSchema10(
|
|
1927
|
+
z11.discriminatedUnion("type", [
|
|
1928
|
+
z11.object({
|
|
1929
|
+
type: z11.literal("programmatic-tool-call"),
|
|
1930
|
+
code: z11.string()
|
|
1898
1931
|
}),
|
|
1899
|
-
|
|
1900
|
-
type:
|
|
1901
|
-
command:
|
|
1932
|
+
z11.object({
|
|
1933
|
+
type: z11.literal("bash_code_execution"),
|
|
1934
|
+
command: z11.string()
|
|
1902
1935
|
}),
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
type:
|
|
1906
|
-
command:
|
|
1907
|
-
path:
|
|
1936
|
+
z11.discriminatedUnion("command", [
|
|
1937
|
+
z11.object({
|
|
1938
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1939
|
+
command: z11.literal("view"),
|
|
1940
|
+
path: z11.string()
|
|
1908
1941
|
}),
|
|
1909
|
-
|
|
1910
|
-
type:
|
|
1911
|
-
command:
|
|
1912
|
-
path:
|
|
1913
|
-
file_text:
|
|
1942
|
+
z11.object({
|
|
1943
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1944
|
+
command: z11.literal("create"),
|
|
1945
|
+
path: z11.string(),
|
|
1946
|
+
file_text: z11.string().nullish()
|
|
1914
1947
|
}),
|
|
1915
|
-
|
|
1916
|
-
type:
|
|
1917
|
-
command:
|
|
1918
|
-
path:
|
|
1919
|
-
old_str:
|
|
1920
|
-
new_str:
|
|
1948
|
+
z11.object({
|
|
1949
|
+
type: z11.literal("text_editor_code_execution"),
|
|
1950
|
+
command: z11.literal("str_replace"),
|
|
1951
|
+
path: z11.string(),
|
|
1952
|
+
old_str: z11.string(),
|
|
1953
|
+
new_str: z11.string()
|
|
1921
1954
|
})
|
|
1922
1955
|
])
|
|
1923
1956
|
])
|
|
1924
1957
|
)
|
|
1925
1958
|
);
|
|
1926
|
-
var factory8 = (
|
|
1959
|
+
var factory8 = createProviderToolFactoryWithOutputSchema7({
|
|
1927
1960
|
id: "anthropic.code_execution_20260120",
|
|
1928
1961
|
inputSchema: codeExecution_20260120InputSchema,
|
|
1929
1962
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
@@ -1934,21 +1967,25 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
1934
1967
|
};
|
|
1935
1968
|
|
|
1936
1969
|
// src/tool/tool-search-regex_20251119.ts
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1970
|
+
import {
|
|
1971
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema8,
|
|
1972
|
+
lazySchema as lazySchema11,
|
|
1973
|
+
zodSchema as zodSchema11
|
|
1974
|
+
} from "@ai-sdk/provider-utils";
|
|
1975
|
+
import { z as z12 } from "zod/v4";
|
|
1976
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema11(
|
|
1977
|
+
() => zodSchema11(
|
|
1978
|
+
z12.array(
|
|
1979
|
+
z12.object({
|
|
1980
|
+
type: z12.literal("tool_reference"),
|
|
1981
|
+
toolName: z12.string()
|
|
1945
1982
|
})
|
|
1946
1983
|
)
|
|
1947
1984
|
)
|
|
1948
1985
|
);
|
|
1949
|
-
var toolSearchRegex_20251119InputSchema = (
|
|
1950
|
-
() => (
|
|
1951
|
-
|
|
1986
|
+
var toolSearchRegex_20251119InputSchema = lazySchema11(
|
|
1987
|
+
() => zodSchema11(
|
|
1988
|
+
z12.object({
|
|
1952
1989
|
/**
|
|
1953
1990
|
* A regex pattern to search for tools.
|
|
1954
1991
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -1959,15 +1996,15 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils13.lazySchema
|
|
|
1959
1996
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1960
1997
|
* - "(?i)slack" - case-insensitive search
|
|
1961
1998
|
*/
|
|
1962
|
-
pattern:
|
|
1999
|
+
pattern: z12.string(),
|
|
1963
2000
|
/**
|
|
1964
2001
|
* Maximum number of tools to return. Optional.
|
|
1965
2002
|
*/
|
|
1966
|
-
limit:
|
|
2003
|
+
limit: z12.number().optional()
|
|
1967
2004
|
})
|
|
1968
2005
|
)
|
|
1969
2006
|
);
|
|
1970
|
-
var factory9 = (
|
|
2007
|
+
var factory9 = createProviderToolFactoryWithOutputSchema8({
|
|
1971
2008
|
id: "anthropic.tool_search_regex_20251119",
|
|
1972
2009
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
1973
2010
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
@@ -1980,17 +2017,17 @@ var toolSearchRegex_20251119 = (args = {}) => {
|
|
|
1980
2017
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1981
2018
|
function convertToString(data) {
|
|
1982
2019
|
if (typeof data === "string") {
|
|
1983
|
-
return new TextDecoder().decode(
|
|
2020
|
+
return new TextDecoder().decode(convertBase64ToUint8Array(data));
|
|
1984
2021
|
}
|
|
1985
2022
|
if (data instanceof Uint8Array) {
|
|
1986
2023
|
return new TextDecoder().decode(data);
|
|
1987
2024
|
}
|
|
1988
2025
|
if (data instanceof URL) {
|
|
1989
|
-
throw new
|
|
2026
|
+
throw new UnsupportedFunctionalityError2({
|
|
1990
2027
|
functionality: "URL-based text documents are not supported for citations"
|
|
1991
2028
|
});
|
|
1992
2029
|
}
|
|
1993
|
-
throw new
|
|
2030
|
+
throw new UnsupportedFunctionalityError2({
|
|
1994
2031
|
functionality: `unsupported data type for text documents: ${typeof data}`
|
|
1995
2032
|
});
|
|
1996
2033
|
}
|
|
@@ -2018,7 +2055,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2018
2055
|
const messages = [];
|
|
2019
2056
|
async function shouldEnableCitations(providerMetadata) {
|
|
2020
2057
|
var _a2, _b2;
|
|
2021
|
-
const anthropicOptions = await
|
|
2058
|
+
const anthropicOptions = await parseProviderOptions({
|
|
2022
2059
|
provider: "anthropic",
|
|
2023
2060
|
providerOptions: providerMetadata,
|
|
2024
2061
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2026,7 +2063,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2026
2063
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
2027
2064
|
}
|
|
2028
2065
|
async function getDocumentMetadata(providerMetadata) {
|
|
2029
|
-
const anthropicOptions = await
|
|
2066
|
+
const anthropicOptions = await parseProviderOptions({
|
|
2030
2067
|
provider: "anthropic",
|
|
2031
2068
|
providerOptions: providerMetadata,
|
|
2032
2069
|
schema: anthropicFilePartProviderOptions
|
|
@@ -2043,7 +2080,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2043
2080
|
switch (type) {
|
|
2044
2081
|
case "system": {
|
|
2045
2082
|
if (system != null) {
|
|
2046
|
-
throw new
|
|
2083
|
+
throw new UnsupportedFunctionalityError2({
|
|
2047
2084
|
functionality: "Multiple system messages that are separated by user/assistant messages"
|
|
2048
2085
|
});
|
|
2049
2086
|
}
|
|
@@ -2083,8 +2120,8 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2083
2120
|
break;
|
|
2084
2121
|
}
|
|
2085
2122
|
case "file": {
|
|
2086
|
-
if (
|
|
2087
|
-
const fileId =
|
|
2123
|
+
if (isProviderReference(part.data)) {
|
|
2124
|
+
const fileId = resolveProviderReference({
|
|
2088
2125
|
reference: part.data,
|
|
2089
2126
|
provider: "anthropic"
|
|
2090
2127
|
});
|
|
@@ -2111,7 +2148,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2111
2148
|
} : {
|
|
2112
2149
|
type: "base64",
|
|
2113
2150
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
2114
|
-
data:
|
|
2151
|
+
data: convertToBase64(part.data)
|
|
2115
2152
|
},
|
|
2116
2153
|
cache_control: cacheControl
|
|
2117
2154
|
});
|
|
@@ -2131,7 +2168,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2131
2168
|
} : {
|
|
2132
2169
|
type: "base64",
|
|
2133
2170
|
media_type: "application/pdf",
|
|
2134
|
-
data:
|
|
2171
|
+
data: convertToBase64(part.data)
|
|
2135
2172
|
},
|
|
2136
2173
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
2137
2174
|
...metadata.context && { context: metadata.context },
|
|
@@ -2165,7 +2202,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2165
2202
|
cache_control: cacheControl
|
|
2166
2203
|
});
|
|
2167
2204
|
} else {
|
|
2168
|
-
throw new
|
|
2205
|
+
throw new UnsupportedFunctionalityError2({
|
|
2169
2206
|
functionality: `media type: ${part.mediaType}`
|
|
2170
2207
|
});
|
|
2171
2208
|
}
|
|
@@ -2201,26 +2238,16 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2201
2238
|
type: "text",
|
|
2202
2239
|
text: contentPart.text
|
|
2203
2240
|
};
|
|
2204
|
-
case "image-data": {
|
|
2205
|
-
return {
|
|
2206
|
-
type: "image",
|
|
2207
|
-
source: {
|
|
2208
|
-
type: "base64",
|
|
2209
|
-
media_type: contentPart.mediaType,
|
|
2210
|
-
data: contentPart.data
|
|
2211
|
-
}
|
|
2212
|
-
};
|
|
2213
|
-
}
|
|
2214
|
-
case "image-url": {
|
|
2215
|
-
return {
|
|
2216
|
-
type: "image",
|
|
2217
|
-
source: {
|
|
2218
|
-
type: "url",
|
|
2219
|
-
url: contentPart.url
|
|
2220
|
-
}
|
|
2221
|
-
};
|
|
2222
|
-
}
|
|
2223
2241
|
case "file-url": {
|
|
2242
|
+
if (contentPart.mediaType.startsWith("image/")) {
|
|
2243
|
+
return {
|
|
2244
|
+
type: "image",
|
|
2245
|
+
source: {
|
|
2246
|
+
type: "url",
|
|
2247
|
+
url: contentPart.url
|
|
2248
|
+
}
|
|
2249
|
+
};
|
|
2250
|
+
}
|
|
2224
2251
|
return {
|
|
2225
2252
|
type: "document",
|
|
2226
2253
|
source: {
|
|
@@ -2230,6 +2257,16 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2230
2257
|
};
|
|
2231
2258
|
}
|
|
2232
2259
|
case "file-data": {
|
|
2260
|
+
if (contentPart.mediaType.startsWith("image/")) {
|
|
2261
|
+
return {
|
|
2262
|
+
type: "image",
|
|
2263
|
+
source: {
|
|
2264
|
+
type: "base64",
|
|
2265
|
+
media_type: contentPart.mediaType,
|
|
2266
|
+
data: contentPart.data
|
|
2267
|
+
}
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2233
2270
|
if (contentPart.mediaType === "application/pdf") {
|
|
2234
2271
|
betas.add("pdfs-2024-09-25");
|
|
2235
2272
|
return {
|
|
@@ -2269,7 +2306,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2269
2306
|
return void 0;
|
|
2270
2307
|
}
|
|
2271
2308
|
}
|
|
2272
|
-
}).filter(
|
|
2309
|
+
}).filter(isNonNullable);
|
|
2273
2310
|
break;
|
|
2274
2311
|
case "text":
|
|
2275
2312
|
case "error-text":
|
|
@@ -2345,7 +2382,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2345
2382
|
}
|
|
2346
2383
|
case "reasoning": {
|
|
2347
2384
|
if (sendReasoning) {
|
|
2348
|
-
const reasoningMetadata = await
|
|
2385
|
+
const reasoningMetadata = await parseProviderOptions({
|
|
2349
2386
|
provider: "anthropic",
|
|
2350
2387
|
providerOptions: part.providerOptions,
|
|
2351
2388
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -2551,7 +2588,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2551
2588
|
break;
|
|
2552
2589
|
}
|
|
2553
2590
|
if (output.value.type === "code_execution_result") {
|
|
2554
|
-
const codeExecutionOutput = await (
|
|
2591
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2555
2592
|
value: output.value,
|
|
2556
2593
|
schema: codeExecution_20250522OutputSchema
|
|
2557
2594
|
});
|
|
@@ -2568,7 +2605,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2568
2605
|
cache_control: cacheControl
|
|
2569
2606
|
});
|
|
2570
2607
|
} else if (output.value.type === "encrypted_code_execution_result") {
|
|
2571
|
-
const codeExecutionOutput = await (
|
|
2608
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2572
2609
|
value: output.value,
|
|
2573
2610
|
schema: codeExecution_20260120OutputSchema
|
|
2574
2611
|
});
|
|
@@ -2587,7 +2624,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2587
2624
|
});
|
|
2588
2625
|
}
|
|
2589
2626
|
} else {
|
|
2590
|
-
const codeExecutionOutput = await (
|
|
2627
|
+
const codeExecutionOutput = await validateTypes2({
|
|
2591
2628
|
value: output.value,
|
|
2592
2629
|
schema: codeExecution_20250825OutputSchema
|
|
2593
2630
|
});
|
|
@@ -2656,7 +2693,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2656
2693
|
});
|
|
2657
2694
|
break;
|
|
2658
2695
|
}
|
|
2659
|
-
const webFetchOutput = await (
|
|
2696
|
+
const webFetchOutput = await validateTypes2({
|
|
2660
2697
|
value: output.value,
|
|
2661
2698
|
schema: webFetch_20250910OutputSchema
|
|
2662
2699
|
});
|
|
@@ -2691,7 +2728,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2691
2728
|
});
|
|
2692
2729
|
break;
|
|
2693
2730
|
}
|
|
2694
|
-
const webSearchOutput = await (
|
|
2731
|
+
const webSearchOutput = await validateTypes2({
|
|
2695
2732
|
value: output.value,
|
|
2696
2733
|
schema: webSearch_20250305OutputSchema
|
|
2697
2734
|
});
|
|
@@ -2718,7 +2755,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2718
2755
|
});
|
|
2719
2756
|
break;
|
|
2720
2757
|
}
|
|
2721
|
-
const toolSearchOutput = await (
|
|
2758
|
+
const toolSearchOutput = await validateTypes2({
|
|
2722
2759
|
value: output.value,
|
|
2723
2760
|
schema: toolSearchRegex_20251119OutputSchema
|
|
2724
2761
|
});
|
|
@@ -2876,13 +2913,22 @@ function createCitationSource(citation, citationDocuments, generateId2) {
|
|
|
2876
2913
|
}
|
|
2877
2914
|
};
|
|
2878
2915
|
}
|
|
2879
|
-
var AnthropicMessagesLanguageModel = class {
|
|
2916
|
+
var AnthropicMessagesLanguageModel = class _AnthropicMessagesLanguageModel {
|
|
2880
2917
|
constructor(modelId, config) {
|
|
2881
2918
|
this.specificationVersion = "v4";
|
|
2882
2919
|
var _a;
|
|
2883
2920
|
this.modelId = modelId;
|
|
2884
2921
|
this.config = config;
|
|
2885
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
2922
|
+
this.generateId = (_a = config.generateId) != null ? _a : generateId;
|
|
2923
|
+
}
|
|
2924
|
+
static [WORKFLOW_SERIALIZE](model) {
|
|
2925
|
+
return serializeModelOptions({
|
|
2926
|
+
modelId: model.modelId,
|
|
2927
|
+
config: model.config
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2930
|
+
static [WORKFLOW_DESERIALIZE](options) {
|
|
2931
|
+
return new _AnthropicMessagesLanguageModel(options.modelId, options.config);
|
|
2886
2932
|
}
|
|
2887
2933
|
supportsUrl(url) {
|
|
2888
2934
|
return url.protocol === "https:";
|
|
@@ -2957,12 +3003,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2957
3003
|
}
|
|
2958
3004
|
}
|
|
2959
3005
|
const providerOptionsName = this.providerOptionsName;
|
|
2960
|
-
const canonicalOptions = await (
|
|
3006
|
+
const canonicalOptions = await parseProviderOptions2({
|
|
2961
3007
|
provider: "anthropic",
|
|
2962
3008
|
providerOptions,
|
|
2963
3009
|
schema: anthropicLanguageModelOptions
|
|
2964
3010
|
});
|
|
2965
|
-
const customProviderOptions = providerOptionsName !== "anthropic" ? await (
|
|
3011
|
+
const customProviderOptions = providerOptionsName !== "anthropic" ? await parseProviderOptions2({
|
|
2966
3012
|
provider: providerOptionsName,
|
|
2967
3013
|
providerOptions,
|
|
2968
3014
|
schema: anthropicLanguageModelOptions
|
|
@@ -2992,7 +3038,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2992
3038
|
} : void 0;
|
|
2993
3039
|
const contextManagement = anthropicOptions == null ? void 0 : anthropicOptions.contextManagement;
|
|
2994
3040
|
const cacheControlValidator = new CacheControlValidator();
|
|
2995
|
-
const toolNameMapping =
|
|
3041
|
+
const toolNameMapping = createToolNameMapping({
|
|
2996
3042
|
tools,
|
|
2997
3043
|
providerToolNames: {
|
|
2998
3044
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -3022,7 +3068,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3022
3068
|
cacheControlValidator,
|
|
3023
3069
|
toolNameMapping
|
|
3024
3070
|
});
|
|
3025
|
-
if (
|
|
3071
|
+
if (isCustomReasoning(reasoning) && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null && (anthropicOptions == null ? void 0 : anthropicOptions.effort) == null) {
|
|
3026
3072
|
const reasoningConfig = resolveAnthropicReasoningConfig({
|
|
3027
3073
|
reasoning,
|
|
3028
3074
|
supportsAdaptiveThinking,
|
|
@@ -3102,7 +3148,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3102
3148
|
id: anthropicOptions.container.id,
|
|
3103
3149
|
skills: anthropicOptions.container.skills.map((skill) => ({
|
|
3104
3150
|
type: skill.type,
|
|
3105
|
-
skill_id: skill.type === "custom" ? (
|
|
3151
|
+
skill_id: skill.type === "custom" ? resolveProviderReference2({
|
|
3106
3152
|
reference: skill.providerReference,
|
|
3107
3153
|
provider: "anthropic"
|
|
3108
3154
|
}) : skill.skillId,
|
|
@@ -3305,16 +3351,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3305
3351
|
betas,
|
|
3306
3352
|
headers
|
|
3307
3353
|
}) {
|
|
3308
|
-
return
|
|
3309
|
-
await
|
|
3354
|
+
return combineHeaders(
|
|
3355
|
+
this.config.headers ? await resolve(this.config.headers) : void 0,
|
|
3310
3356
|
headers,
|
|
3311
3357
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
3312
3358
|
);
|
|
3313
3359
|
}
|
|
3314
3360
|
async getBetasFromHeaders(requestHeaders) {
|
|
3315
3361
|
var _a, _b;
|
|
3316
|
-
const configHeaders = await
|
|
3317
|
-
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
3362
|
+
const configHeaders = this.config.headers ? await resolve(this.config.headers) : void 0;
|
|
3363
|
+
const configBetaHeader = (_a = configHeaders == null ? void 0 : configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
3318
3364
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
3319
3365
|
return new Set(
|
|
3320
3366
|
[
|
|
@@ -3379,12 +3425,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3379
3425
|
responseHeaders,
|
|
3380
3426
|
value: response,
|
|
3381
3427
|
rawValue: rawResponse
|
|
3382
|
-
} = await
|
|
3428
|
+
} = await postJsonToApi({
|
|
3383
3429
|
url: this.buildRequestUrl(false),
|
|
3384
3430
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3385
3431
|
body: this.transformRequestBody(args, betas),
|
|
3386
3432
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3387
|
-
successfulResponseHandler:
|
|
3433
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
3388
3434
|
anthropicMessagesResponseSchema
|
|
3389
3435
|
),
|
|
3390
3436
|
abortSignal: options.abortSignal,
|
|
@@ -3778,6 +3824,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3778
3824
|
};
|
|
3779
3825
|
}
|
|
3780
3826
|
async doStream(options) {
|
|
3827
|
+
"use step";
|
|
3781
3828
|
var _a, _b;
|
|
3782
3829
|
const {
|
|
3783
3830
|
args: body,
|
|
@@ -3799,12 +3846,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3799
3846
|
body.tools
|
|
3800
3847
|
);
|
|
3801
3848
|
const url = this.buildRequestUrl(true);
|
|
3802
|
-
const { responseHeaders, value: response } = await
|
|
3849
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
3803
3850
|
url,
|
|
3804
3851
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3805
3852
|
body: this.transformRequestBody(body, betas),
|
|
3806
3853
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3807
|
-
successfulResponseHandler:
|
|
3854
|
+
successfulResponseHandler: createEventSourceResponseHandler(
|
|
3808
3855
|
anthropicMessagesChunkSchema
|
|
3809
3856
|
),
|
|
3810
3857
|
abortSignal: options.abortSignal,
|
|
@@ -4529,7 +4576,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4529
4576
|
}
|
|
4530
4577
|
if (((_b = result.value) == null ? void 0 : _b.type) === "error") {
|
|
4531
4578
|
const error = result.value.error;
|
|
4532
|
-
throw new
|
|
4579
|
+
throw new APICallError({
|
|
4533
4580
|
message: error.message,
|
|
4534
4581
|
url,
|
|
4535
4582
|
requestBodyValues: body,
|
|
@@ -4627,14 +4674,14 @@ function resolveAnthropicReasoningConfig({
|
|
|
4627
4674
|
maxOutputTokensForModel,
|
|
4628
4675
|
warnings
|
|
4629
4676
|
}) {
|
|
4630
|
-
if (!
|
|
4677
|
+
if (!isCustomReasoning(reasoning)) {
|
|
4631
4678
|
return void 0;
|
|
4632
4679
|
}
|
|
4633
4680
|
if (reasoning === "none") {
|
|
4634
4681
|
return { thinking: { type: "disabled" } };
|
|
4635
4682
|
}
|
|
4636
4683
|
if (supportsAdaptiveThinking) {
|
|
4637
|
-
const effort =
|
|
4684
|
+
const effort = mapReasoningToProviderEffort({
|
|
4638
4685
|
reasoning,
|
|
4639
4686
|
effortMap: {
|
|
4640
4687
|
minimal: "low",
|
|
@@ -4647,7 +4694,7 @@ function resolveAnthropicReasoningConfig({
|
|
|
4647
4694
|
});
|
|
4648
4695
|
return { thinking: { type: "adaptive" }, effort };
|
|
4649
4696
|
}
|
|
4650
|
-
const budgetTokens =
|
|
4697
|
+
const budgetTokens = mapReasoningToProviderBudget({
|
|
4651
4698
|
reasoning,
|
|
4652
4699
|
maxOutputTokens: maxOutputTokensForModel,
|
|
4653
4700
|
maxReasoningBudget: maxOutputTokensForModel,
|
|
@@ -4685,44 +4732,56 @@ function mapAnthropicResponseContextManagement(contextManagement) {
|
|
|
4685
4732
|
}
|
|
4686
4733
|
|
|
4687
4734
|
// src/tool/bash_20241022.ts
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4735
|
+
import {
|
|
4736
|
+
createProviderToolFactory as createProviderToolFactory2,
|
|
4737
|
+
lazySchema as lazySchema12,
|
|
4738
|
+
zodSchema as zodSchema12
|
|
4739
|
+
} from "@ai-sdk/provider-utils";
|
|
4740
|
+
import { z as z13 } from "zod/v4";
|
|
4741
|
+
var bash_20241022InputSchema = lazySchema12(
|
|
4742
|
+
() => zodSchema12(
|
|
4743
|
+
z13.object({
|
|
4744
|
+
command: z13.string(),
|
|
4745
|
+
restart: z13.boolean().optional()
|
|
4695
4746
|
})
|
|
4696
4747
|
)
|
|
4697
4748
|
);
|
|
4698
|
-
var bash_20241022 = (
|
|
4749
|
+
var bash_20241022 = createProviderToolFactory2({
|
|
4699
4750
|
id: "anthropic.bash_20241022",
|
|
4700
4751
|
inputSchema: bash_20241022InputSchema
|
|
4701
4752
|
});
|
|
4702
4753
|
|
|
4703
4754
|
// src/tool/bash_20250124.ts
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4755
|
+
import {
|
|
4756
|
+
createProviderToolFactory as createProviderToolFactory3,
|
|
4757
|
+
lazySchema as lazySchema13,
|
|
4758
|
+
zodSchema as zodSchema13
|
|
4759
|
+
} from "@ai-sdk/provider-utils";
|
|
4760
|
+
import { z as z14 } from "zod/v4";
|
|
4761
|
+
var bash_20250124InputSchema = lazySchema13(
|
|
4762
|
+
() => zodSchema13(
|
|
4763
|
+
z14.object({
|
|
4764
|
+
command: z14.string(),
|
|
4765
|
+
restart: z14.boolean().optional()
|
|
4711
4766
|
})
|
|
4712
4767
|
)
|
|
4713
4768
|
);
|
|
4714
|
-
var bash_20250124 = (
|
|
4769
|
+
var bash_20250124 = createProviderToolFactory3({
|
|
4715
4770
|
id: "anthropic.bash_20250124",
|
|
4716
4771
|
inputSchema: bash_20250124InputSchema
|
|
4717
4772
|
});
|
|
4718
4773
|
|
|
4719
4774
|
// src/tool/computer_20241022.ts
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4775
|
+
import {
|
|
4776
|
+
createProviderToolFactory as createProviderToolFactory4,
|
|
4777
|
+
lazySchema as lazySchema14,
|
|
4778
|
+
zodSchema as zodSchema14
|
|
4779
|
+
} from "@ai-sdk/provider-utils";
|
|
4780
|
+
import { z as z15 } from "zod/v4";
|
|
4781
|
+
var computer_20241022InputSchema = lazySchema14(
|
|
4782
|
+
() => zodSchema14(
|
|
4783
|
+
z15.object({
|
|
4784
|
+
action: z15.enum([
|
|
4726
4785
|
"key",
|
|
4727
4786
|
"type",
|
|
4728
4787
|
"mouse_move",
|
|
@@ -4734,23 +4793,27 @@ var computer_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
4734
4793
|
"screenshot",
|
|
4735
4794
|
"cursor_position"
|
|
4736
4795
|
]),
|
|
4737
|
-
coordinate:
|
|
4738
|
-
text:
|
|
4796
|
+
coordinate: z15.array(z15.number().int()).optional(),
|
|
4797
|
+
text: z15.string().optional()
|
|
4739
4798
|
})
|
|
4740
4799
|
)
|
|
4741
4800
|
);
|
|
4742
|
-
var computer_20241022 = (
|
|
4801
|
+
var computer_20241022 = createProviderToolFactory4({
|
|
4743
4802
|
id: "anthropic.computer_20241022",
|
|
4744
4803
|
inputSchema: computer_20241022InputSchema
|
|
4745
4804
|
});
|
|
4746
4805
|
|
|
4747
4806
|
// src/tool/computer_20250124.ts
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4807
|
+
import {
|
|
4808
|
+
createProviderToolFactory as createProviderToolFactory5,
|
|
4809
|
+
lazySchema as lazySchema15,
|
|
4810
|
+
zodSchema as zodSchema15
|
|
4811
|
+
} from "@ai-sdk/provider-utils";
|
|
4812
|
+
import { z as z16 } from "zod/v4";
|
|
4813
|
+
var computer_20250124InputSchema = lazySchema15(
|
|
4814
|
+
() => zodSchema15(
|
|
4815
|
+
z16.object({
|
|
4816
|
+
action: z16.enum([
|
|
4754
4817
|
"key",
|
|
4755
4818
|
"hold_key",
|
|
4756
4819
|
"type",
|
|
@@ -4768,27 +4831,31 @@ var computer_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
4768
4831
|
"wait",
|
|
4769
4832
|
"screenshot"
|
|
4770
4833
|
]),
|
|
4771
|
-
coordinate:
|
|
4772
|
-
duration:
|
|
4773
|
-
scroll_amount:
|
|
4774
|
-
scroll_direction:
|
|
4775
|
-
start_coordinate:
|
|
4776
|
-
text:
|
|
4834
|
+
coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
|
|
4835
|
+
duration: z16.number().optional(),
|
|
4836
|
+
scroll_amount: z16.number().optional(),
|
|
4837
|
+
scroll_direction: z16.enum(["up", "down", "left", "right"]).optional(),
|
|
4838
|
+
start_coordinate: z16.tuple([z16.number().int(), z16.number().int()]).optional(),
|
|
4839
|
+
text: z16.string().optional()
|
|
4777
4840
|
})
|
|
4778
4841
|
)
|
|
4779
4842
|
);
|
|
4780
|
-
var computer_20250124 = (
|
|
4843
|
+
var computer_20250124 = createProviderToolFactory5({
|
|
4781
4844
|
id: "anthropic.computer_20250124",
|
|
4782
4845
|
inputSchema: computer_20250124InputSchema
|
|
4783
4846
|
});
|
|
4784
4847
|
|
|
4785
4848
|
// src/tool/computer_20251124.ts
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4849
|
+
import {
|
|
4850
|
+
createProviderToolFactory as createProviderToolFactory6,
|
|
4851
|
+
lazySchema as lazySchema16,
|
|
4852
|
+
zodSchema as zodSchema16
|
|
4853
|
+
} from "@ai-sdk/provider-utils";
|
|
4854
|
+
import { z as z17 } from "zod/v4";
|
|
4855
|
+
var computer_20251124InputSchema = lazySchema16(
|
|
4856
|
+
() => zodSchema16(
|
|
4857
|
+
z17.object({
|
|
4858
|
+
action: z17.enum([
|
|
4792
4859
|
"key",
|
|
4793
4860
|
"hold_key",
|
|
4794
4861
|
"type",
|
|
@@ -4807,166 +4874,186 @@ var computer_20251124InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
4807
4874
|
"screenshot",
|
|
4808
4875
|
"zoom"
|
|
4809
4876
|
]),
|
|
4810
|
-
coordinate:
|
|
4811
|
-
duration:
|
|
4812
|
-
region:
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4877
|
+
coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4878
|
+
duration: z17.number().optional(),
|
|
4879
|
+
region: z17.tuple([
|
|
4880
|
+
z17.number().int(),
|
|
4881
|
+
z17.number().int(),
|
|
4882
|
+
z17.number().int(),
|
|
4883
|
+
z17.number().int()
|
|
4817
4884
|
]).optional(),
|
|
4818
|
-
scroll_amount:
|
|
4819
|
-
scroll_direction:
|
|
4820
|
-
start_coordinate:
|
|
4821
|
-
text:
|
|
4885
|
+
scroll_amount: z17.number().optional(),
|
|
4886
|
+
scroll_direction: z17.enum(["up", "down", "left", "right"]).optional(),
|
|
4887
|
+
start_coordinate: z17.tuple([z17.number().int(), z17.number().int()]).optional(),
|
|
4888
|
+
text: z17.string().optional()
|
|
4822
4889
|
})
|
|
4823
4890
|
)
|
|
4824
4891
|
);
|
|
4825
|
-
var computer_20251124 = (
|
|
4892
|
+
var computer_20251124 = createProviderToolFactory6({
|
|
4826
4893
|
id: "anthropic.computer_20251124",
|
|
4827
4894
|
inputSchema: computer_20251124InputSchema
|
|
4828
4895
|
});
|
|
4829
4896
|
|
|
4830
4897
|
// src/tool/memory_20250818.ts
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4898
|
+
import {
|
|
4899
|
+
createProviderToolFactory as createProviderToolFactory7,
|
|
4900
|
+
lazySchema as lazySchema17,
|
|
4901
|
+
zodSchema as zodSchema17
|
|
4902
|
+
} from "@ai-sdk/provider-utils";
|
|
4903
|
+
import { z as z18 } from "zod/v4";
|
|
4904
|
+
var memory_20250818InputSchema = lazySchema17(
|
|
4905
|
+
() => zodSchema17(
|
|
4906
|
+
z18.discriminatedUnion("command", [
|
|
4907
|
+
z18.object({
|
|
4908
|
+
command: z18.literal("view"),
|
|
4909
|
+
path: z18.string(),
|
|
4910
|
+
view_range: z18.tuple([z18.number(), z18.number()]).optional()
|
|
4840
4911
|
}),
|
|
4841
|
-
|
|
4842
|
-
command:
|
|
4843
|
-
path:
|
|
4844
|
-
file_text:
|
|
4912
|
+
z18.object({
|
|
4913
|
+
command: z18.literal("create"),
|
|
4914
|
+
path: z18.string(),
|
|
4915
|
+
file_text: z18.string()
|
|
4845
4916
|
}),
|
|
4846
|
-
|
|
4847
|
-
command:
|
|
4848
|
-
path:
|
|
4849
|
-
old_str:
|
|
4850
|
-
new_str:
|
|
4917
|
+
z18.object({
|
|
4918
|
+
command: z18.literal("str_replace"),
|
|
4919
|
+
path: z18.string(),
|
|
4920
|
+
old_str: z18.string(),
|
|
4921
|
+
new_str: z18.string()
|
|
4851
4922
|
}),
|
|
4852
|
-
|
|
4853
|
-
command:
|
|
4854
|
-
path:
|
|
4855
|
-
insert_line:
|
|
4856
|
-
insert_text:
|
|
4923
|
+
z18.object({
|
|
4924
|
+
command: z18.literal("insert"),
|
|
4925
|
+
path: z18.string(),
|
|
4926
|
+
insert_line: z18.number(),
|
|
4927
|
+
insert_text: z18.string()
|
|
4857
4928
|
}),
|
|
4858
|
-
|
|
4859
|
-
command:
|
|
4860
|
-
path:
|
|
4929
|
+
z18.object({
|
|
4930
|
+
command: z18.literal("delete"),
|
|
4931
|
+
path: z18.string()
|
|
4861
4932
|
}),
|
|
4862
|
-
|
|
4863
|
-
command:
|
|
4864
|
-
old_path:
|
|
4865
|
-
new_path:
|
|
4933
|
+
z18.object({
|
|
4934
|
+
command: z18.literal("rename"),
|
|
4935
|
+
old_path: z18.string(),
|
|
4936
|
+
new_path: z18.string()
|
|
4866
4937
|
})
|
|
4867
4938
|
])
|
|
4868
4939
|
)
|
|
4869
4940
|
);
|
|
4870
|
-
var memory_20250818 = (
|
|
4941
|
+
var memory_20250818 = createProviderToolFactory7({
|
|
4871
4942
|
id: "anthropic.memory_20250818",
|
|
4872
4943
|
inputSchema: memory_20250818InputSchema
|
|
4873
4944
|
});
|
|
4874
4945
|
|
|
4875
4946
|
// src/tool/text-editor_20241022.ts
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4947
|
+
import {
|
|
4948
|
+
createProviderToolFactory as createProviderToolFactory8,
|
|
4949
|
+
lazySchema as lazySchema18,
|
|
4950
|
+
zodSchema as zodSchema18
|
|
4951
|
+
} from "@ai-sdk/provider-utils";
|
|
4952
|
+
import { z as z19 } from "zod/v4";
|
|
4953
|
+
var textEditor_20241022InputSchema = lazySchema18(
|
|
4954
|
+
() => zodSchema18(
|
|
4955
|
+
z19.object({
|
|
4956
|
+
command: z19.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4957
|
+
path: z19.string(),
|
|
4958
|
+
file_text: z19.string().optional(),
|
|
4959
|
+
insert_line: z19.number().int().optional(),
|
|
4960
|
+
new_str: z19.string().optional(),
|
|
4961
|
+
insert_text: z19.string().optional(),
|
|
4962
|
+
old_str: z19.string().optional(),
|
|
4963
|
+
view_range: z19.array(z19.number().int()).optional()
|
|
4889
4964
|
})
|
|
4890
4965
|
)
|
|
4891
4966
|
);
|
|
4892
|
-
var textEditor_20241022 = (
|
|
4967
|
+
var textEditor_20241022 = createProviderToolFactory8({
|
|
4893
4968
|
id: "anthropic.text_editor_20241022",
|
|
4894
4969
|
inputSchema: textEditor_20241022InputSchema
|
|
4895
4970
|
});
|
|
4896
4971
|
|
|
4897
4972
|
// src/tool/text-editor_20250124.ts
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4973
|
+
import {
|
|
4974
|
+
createProviderToolFactory as createProviderToolFactory9,
|
|
4975
|
+
lazySchema as lazySchema19,
|
|
4976
|
+
zodSchema as zodSchema19
|
|
4977
|
+
} from "@ai-sdk/provider-utils";
|
|
4978
|
+
import { z as z20 } from "zod/v4";
|
|
4979
|
+
var textEditor_20250124InputSchema = lazySchema19(
|
|
4980
|
+
() => zodSchema19(
|
|
4981
|
+
z20.object({
|
|
4982
|
+
command: z20.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
4983
|
+
path: z20.string(),
|
|
4984
|
+
file_text: z20.string().optional(),
|
|
4985
|
+
insert_line: z20.number().int().optional(),
|
|
4986
|
+
new_str: z20.string().optional(),
|
|
4987
|
+
insert_text: z20.string().optional(),
|
|
4988
|
+
old_str: z20.string().optional(),
|
|
4989
|
+
view_range: z20.array(z20.number().int()).optional()
|
|
4911
4990
|
})
|
|
4912
4991
|
)
|
|
4913
4992
|
);
|
|
4914
|
-
var textEditor_20250124 = (
|
|
4993
|
+
var textEditor_20250124 = createProviderToolFactory9({
|
|
4915
4994
|
id: "anthropic.text_editor_20250124",
|
|
4916
4995
|
inputSchema: textEditor_20250124InputSchema
|
|
4917
4996
|
});
|
|
4918
4997
|
|
|
4919
4998
|
// src/tool/text-editor_20250429.ts
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4999
|
+
import {
|
|
5000
|
+
createProviderToolFactory as createProviderToolFactory10,
|
|
5001
|
+
lazySchema as lazySchema20,
|
|
5002
|
+
zodSchema as zodSchema20
|
|
5003
|
+
} from "@ai-sdk/provider-utils";
|
|
5004
|
+
import { z as z21 } from "zod/v4";
|
|
5005
|
+
var textEditor_20250429InputSchema = lazySchema20(
|
|
5006
|
+
() => zodSchema20(
|
|
5007
|
+
z21.object({
|
|
5008
|
+
command: z21.enum(["view", "create", "str_replace", "insert"]),
|
|
5009
|
+
path: z21.string(),
|
|
5010
|
+
file_text: z21.string().optional(),
|
|
5011
|
+
insert_line: z21.number().int().optional(),
|
|
5012
|
+
new_str: z21.string().optional(),
|
|
5013
|
+
insert_text: z21.string().optional(),
|
|
5014
|
+
old_str: z21.string().optional(),
|
|
5015
|
+
view_range: z21.array(z21.number().int()).optional()
|
|
4933
5016
|
})
|
|
4934
5017
|
)
|
|
4935
5018
|
);
|
|
4936
|
-
var textEditor_20250429 = (
|
|
5019
|
+
var textEditor_20250429 = createProviderToolFactory10({
|
|
4937
5020
|
id: "anthropic.text_editor_20250429",
|
|
4938
5021
|
inputSchema: textEditor_20250429InputSchema
|
|
4939
5022
|
});
|
|
4940
5023
|
|
|
4941
5024
|
// src/tool/tool-search-bm25_20251119.ts
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
5025
|
+
import {
|
|
5026
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema9,
|
|
5027
|
+
lazySchema as lazySchema21,
|
|
5028
|
+
zodSchema as zodSchema21
|
|
5029
|
+
} from "@ai-sdk/provider-utils";
|
|
5030
|
+
import { z as z22 } from "zod/v4";
|
|
5031
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema21(
|
|
5032
|
+
() => zodSchema21(
|
|
5033
|
+
z22.array(
|
|
5034
|
+
z22.object({
|
|
5035
|
+
type: z22.literal("tool_reference"),
|
|
5036
|
+
toolName: z22.string()
|
|
4950
5037
|
})
|
|
4951
5038
|
)
|
|
4952
5039
|
)
|
|
4953
5040
|
);
|
|
4954
|
-
var toolSearchBm25_20251119InputSchema = (
|
|
4955
|
-
() => (
|
|
4956
|
-
|
|
5041
|
+
var toolSearchBm25_20251119InputSchema = lazySchema21(
|
|
5042
|
+
() => zodSchema21(
|
|
5043
|
+
z22.object({
|
|
4957
5044
|
/**
|
|
4958
5045
|
* A natural language query to search for tools.
|
|
4959
5046
|
* Claude will use BM25 text search to find relevant tools.
|
|
4960
5047
|
*/
|
|
4961
|
-
query:
|
|
5048
|
+
query: z22.string(),
|
|
4962
5049
|
/**
|
|
4963
5050
|
* Maximum number of tools to return. Optional.
|
|
4964
5051
|
*/
|
|
4965
|
-
limit:
|
|
5052
|
+
limit: z22.number().optional()
|
|
4966
5053
|
})
|
|
4967
5054
|
)
|
|
4968
5055
|
);
|
|
4969
|
-
var factory10 = (
|
|
5056
|
+
var factory10 = createProviderToolFactoryWithOutputSchema9({
|
|
4970
5057
|
id: "anthropic.tool_search_bm25_20251119",
|
|
4971
5058
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
4972
5059
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
@@ -5177,11 +5264,10 @@ var anthropicTools = {
|
|
|
5177
5264
|
*/
|
|
5178
5265
|
toolSearchBm25_20251119
|
|
5179
5266
|
};
|
|
5180
|
-
|
|
5181
|
-
0 && (module.exports = {
|
|
5267
|
+
export {
|
|
5182
5268
|
AnthropicMessagesLanguageModel,
|
|
5183
5269
|
anthropicTools,
|
|
5184
5270
|
getModelCapabilities,
|
|
5185
5271
|
prepareTools
|
|
5186
|
-
}
|
|
5272
|
+
};
|
|
5187
5273
|
//# sourceMappingURL=index.js.map
|