@ai-sdk/anthropic 1.2.11 → 2.0.0-alpha.2
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 +187 -22
- package/dist/index.d.mts +12 -30
- package/dist/index.d.ts +12 -30
- package/dist/index.js +345 -313
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +347 -315
- package/dist/index.mjs.map +1 -1
- package/{internal/dist → dist/internal}/index.d.mts +10 -37
- package/{internal/dist → dist/internal}/index.d.ts +10 -37
- package/{internal/dist → dist/internal}/index.js +336 -309
- package/dist/internal/index.js.map +1 -0
- package/{internal/dist → dist/internal}/index.mjs +338 -311
- package/dist/internal/index.mjs.map +1 -0
- package/internal.d.ts +1 -0
- package/package.json +18 -16
- package/internal/dist/index.js.map +0 -1
- package/internal/dist/index.mjs.map +0 -1
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
combineHeaders,
|
|
7
7
|
createEventSourceResponseHandler,
|
|
8
8
|
createJsonResponseHandler,
|
|
9
|
-
parseProviderOptions,
|
|
9
|
+
parseProviderOptions as parseProviderOptions2,
|
|
10
10
|
postJsonToApi,
|
|
11
11
|
resolve
|
|
12
12
|
} from "@ai-sdk/provider-utils";
|
|
13
|
-
import { z as
|
|
13
|
+
import { z as z3 } from "zod";
|
|
14
14
|
|
|
15
15
|
// src/anthropic-error.ts
|
|
16
16
|
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
@@ -27,17 +27,34 @@ var anthropicFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
27
27
|
errorToMessage: (data) => data.error.message
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
+
// src/anthropic-messages-options.ts
|
|
31
|
+
import { z as z2 } from "zod";
|
|
32
|
+
var anthropicProviderOptions = z2.object({
|
|
33
|
+
/**
|
|
34
|
+
Include reasoning content in requests sent to the model. Defaults to `true`.
|
|
35
|
+
|
|
36
|
+
If you are experiencing issues with the model handling requests involving
|
|
37
|
+
*/
|
|
38
|
+
sendReasoning: z2.boolean().optional(),
|
|
39
|
+
thinking: z2.object({
|
|
40
|
+
type: z2.union([z2.literal("enabled"), z2.literal("disabled")]),
|
|
41
|
+
budgetTokens: z2.number().optional()
|
|
42
|
+
}).optional()
|
|
43
|
+
});
|
|
44
|
+
|
|
30
45
|
// src/anthropic-prepare-tools.ts
|
|
31
46
|
import {
|
|
32
47
|
UnsupportedFunctionalityError
|
|
33
48
|
} from "@ai-sdk/provider";
|
|
34
|
-
function prepareTools(
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
function prepareTools({
|
|
50
|
+
tools,
|
|
51
|
+
toolChoice
|
|
52
|
+
}) {
|
|
53
|
+
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
37
54
|
const toolWarnings = [];
|
|
38
55
|
const betas = /* @__PURE__ */ new Set();
|
|
39
56
|
if (tools == null) {
|
|
40
|
-
return { tools: void 0,
|
|
57
|
+
return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
|
|
41
58
|
}
|
|
42
59
|
const anthropicTools2 = [];
|
|
43
60
|
for (const tool of tools) {
|
|
@@ -109,11 +126,10 @@ function prepareTools(mode) {
|
|
|
109
126
|
break;
|
|
110
127
|
}
|
|
111
128
|
}
|
|
112
|
-
const toolChoice = mode.toolChoice;
|
|
113
129
|
if (toolChoice == null) {
|
|
114
130
|
return {
|
|
115
131
|
tools: anthropicTools2,
|
|
116
|
-
|
|
132
|
+
toolChoice: void 0,
|
|
117
133
|
toolWarnings,
|
|
118
134
|
betas
|
|
119
135
|
};
|
|
@@ -123,30 +139,30 @@ function prepareTools(mode) {
|
|
|
123
139
|
case "auto":
|
|
124
140
|
return {
|
|
125
141
|
tools: anthropicTools2,
|
|
126
|
-
|
|
142
|
+
toolChoice: { type: "auto" },
|
|
127
143
|
toolWarnings,
|
|
128
144
|
betas
|
|
129
145
|
};
|
|
130
146
|
case "required":
|
|
131
147
|
return {
|
|
132
148
|
tools: anthropicTools2,
|
|
133
|
-
|
|
149
|
+
toolChoice: { type: "any" },
|
|
134
150
|
toolWarnings,
|
|
135
151
|
betas
|
|
136
152
|
};
|
|
137
153
|
case "none":
|
|
138
|
-
return { tools: void 0,
|
|
154
|
+
return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
|
|
139
155
|
case "tool":
|
|
140
156
|
return {
|
|
141
157
|
tools: anthropicTools2,
|
|
142
|
-
|
|
158
|
+
toolChoice: { type: "tool", name: toolChoice.toolName },
|
|
143
159
|
toolWarnings,
|
|
144
160
|
betas
|
|
145
161
|
};
|
|
146
162
|
default: {
|
|
147
163
|
const _exhaustiveCheck = type;
|
|
148
164
|
throw new UnsupportedFunctionalityError({
|
|
149
|
-
functionality: `
|
|
165
|
+
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
150
166
|
});
|
|
151
167
|
}
|
|
152
168
|
}
|
|
@@ -156,13 +172,13 @@ function prepareTools(mode) {
|
|
|
156
172
|
import {
|
|
157
173
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
158
174
|
} from "@ai-sdk/provider";
|
|
159
|
-
import {
|
|
160
|
-
function convertToAnthropicMessagesPrompt({
|
|
175
|
+
import { convertToBase64, parseProviderOptions } from "@ai-sdk/provider-utils";
|
|
176
|
+
async function convertToAnthropicMessagesPrompt({
|
|
161
177
|
prompt,
|
|
162
178
|
sendReasoning,
|
|
163
179
|
warnings
|
|
164
180
|
}) {
|
|
165
|
-
var _a, _b, _c
|
|
181
|
+
var _a, _b, _c;
|
|
166
182
|
const betas = /* @__PURE__ */ new Set();
|
|
167
183
|
const blocks = groupIntoBlocks(prompt);
|
|
168
184
|
let system = void 0;
|
|
@@ -184,10 +200,10 @@ function convertToAnthropicMessagesPrompt({
|
|
|
184
200
|
functionality: "Multiple system messages that are separated by user/assistant messages"
|
|
185
201
|
});
|
|
186
202
|
}
|
|
187
|
-
system = block.messages.map(({ content,
|
|
203
|
+
system = block.messages.map(({ content, providerOptions }) => ({
|
|
188
204
|
type: "text",
|
|
189
205
|
text: content,
|
|
190
|
-
cache_control: getCacheControl(
|
|
206
|
+
cache_control: getCacheControl(providerOptions)
|
|
191
207
|
}));
|
|
192
208
|
break;
|
|
193
209
|
}
|
|
@@ -200,7 +216,7 @@ function convertToAnthropicMessagesPrompt({
|
|
|
200
216
|
for (let j = 0; j < content.length; j++) {
|
|
201
217
|
const part = content[j];
|
|
202
218
|
const isLastPart = j === content.length - 1;
|
|
203
|
-
const cacheControl = (_a = getCacheControl(part.
|
|
219
|
+
const cacheControl = (_a = getCacheControl(part.providerOptions)) != null ? _a : isLastPart ? getCacheControl(message.providerOptions) : void 0;
|
|
204
220
|
switch (part.type) {
|
|
205
221
|
case "text": {
|
|
206
222
|
anthropicContent.push({
|
|
@@ -210,40 +226,39 @@ function convertToAnthropicMessagesPrompt({
|
|
|
210
226
|
});
|
|
211
227
|
break;
|
|
212
228
|
}
|
|
213
|
-
case "image": {
|
|
214
|
-
anthropicContent.push({
|
|
215
|
-
type: "image",
|
|
216
|
-
source: part.image instanceof URL ? {
|
|
217
|
-
type: "url",
|
|
218
|
-
url: part.image.toString()
|
|
219
|
-
} : {
|
|
220
|
-
type: "base64",
|
|
221
|
-
media_type: (_b = part.mimeType) != null ? _b : "image/jpeg",
|
|
222
|
-
data: convertUint8ArrayToBase64(part.image)
|
|
223
|
-
},
|
|
224
|
-
cache_control: cacheControl
|
|
225
|
-
});
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
229
|
case "file": {
|
|
229
|
-
if (part.
|
|
230
|
+
if (part.mediaType.startsWith("image/")) {
|
|
231
|
+
anthropicContent.push({
|
|
232
|
+
type: "image",
|
|
233
|
+
source: part.data instanceof URL ? {
|
|
234
|
+
type: "url",
|
|
235
|
+
url: part.data.toString()
|
|
236
|
+
} : {
|
|
237
|
+
type: "base64",
|
|
238
|
+
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
239
|
+
data: convertToBase64(part.data)
|
|
240
|
+
},
|
|
241
|
+
cache_control: cacheControl
|
|
242
|
+
});
|
|
243
|
+
} else if (part.mediaType === "application/pdf") {
|
|
244
|
+
betas.add("pdfs-2024-09-25");
|
|
245
|
+
anthropicContent.push({
|
|
246
|
+
type: "document",
|
|
247
|
+
source: part.data instanceof URL ? {
|
|
248
|
+
type: "url",
|
|
249
|
+
url: part.data.toString()
|
|
250
|
+
} : {
|
|
251
|
+
type: "base64",
|
|
252
|
+
media_type: "application/pdf",
|
|
253
|
+
data: convertToBase64(part.data)
|
|
254
|
+
},
|
|
255
|
+
cache_control: cacheControl
|
|
256
|
+
});
|
|
257
|
+
} else {
|
|
230
258
|
throw new UnsupportedFunctionalityError2({
|
|
231
|
-
functionality:
|
|
259
|
+
functionality: `media type: ${part.mediaType}`
|
|
232
260
|
});
|
|
233
261
|
}
|
|
234
|
-
betas.add("pdfs-2024-09-25");
|
|
235
|
-
anthropicContent.push({
|
|
236
|
-
type: "document",
|
|
237
|
-
source: part.data instanceof URL ? {
|
|
238
|
-
type: "url",
|
|
239
|
-
url: part.data.toString()
|
|
240
|
-
} : {
|
|
241
|
-
type: "base64",
|
|
242
|
-
media_type: "application/pdf",
|
|
243
|
-
data: part.data
|
|
244
|
-
},
|
|
245
|
-
cache_control: cacheControl
|
|
246
|
-
});
|
|
247
262
|
break;
|
|
248
263
|
}
|
|
249
264
|
}
|
|
@@ -254,7 +269,7 @@ function convertToAnthropicMessagesPrompt({
|
|
|
254
269
|
for (let i2 = 0; i2 < content.length; i2++) {
|
|
255
270
|
const part = content[i2];
|
|
256
271
|
const isLastPart = i2 === content.length - 1;
|
|
257
|
-
const cacheControl = (
|
|
272
|
+
const cacheControl = (_b = getCacheControl(part.providerOptions)) != null ? _b : isLastPart ? getCacheControl(message.providerOptions) : void 0;
|
|
258
273
|
const toolResultContent = part.content != null ? part.content.map((part2) => {
|
|
259
274
|
var _a2;
|
|
260
275
|
switch (part2.type) {
|
|
@@ -269,7 +284,7 @@ function convertToAnthropicMessagesPrompt({
|
|
|
269
284
|
type: "image",
|
|
270
285
|
source: {
|
|
271
286
|
type: "base64",
|
|
272
|
-
media_type: (_a2 = part2.
|
|
287
|
+
media_type: (_a2 = part2.mediaType) != null ? _a2 : "image/jpeg",
|
|
273
288
|
data: part2.data
|
|
274
289
|
},
|
|
275
290
|
cache_control: void 0
|
|
@@ -304,7 +319,7 @@ function convertToAnthropicMessagesPrompt({
|
|
|
304
319
|
for (let k = 0; k < content.length; k++) {
|
|
305
320
|
const part = content[k];
|
|
306
321
|
const isLastContentPart = k === content.length - 1;
|
|
307
|
-
const cacheControl = (
|
|
322
|
+
const cacheControl = (_c = getCacheControl(part.providerOptions)) != null ? _c : isLastContentPart ? getCacheControl(message.providerOptions) : void 0;
|
|
308
323
|
switch (part.type) {
|
|
309
324
|
case "text": {
|
|
310
325
|
anthropicContent.push({
|
|
@@ -321,12 +336,37 @@ function convertToAnthropicMessagesPrompt({
|
|
|
321
336
|
}
|
|
322
337
|
case "reasoning": {
|
|
323
338
|
if (sendReasoning) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
cache_control: cacheControl
|
|
339
|
+
const reasoningMetadata = await parseProviderOptions({
|
|
340
|
+
provider: "anthropic",
|
|
341
|
+
providerOptions: part.providerOptions,
|
|
342
|
+
schema: anthropicReasoningMetadataSchema
|
|
329
343
|
});
|
|
344
|
+
if (reasoningMetadata != null) {
|
|
345
|
+
if (reasoningMetadata.signature != null) {
|
|
346
|
+
anthropicContent.push({
|
|
347
|
+
type: "thinking",
|
|
348
|
+
thinking: part.text,
|
|
349
|
+
signature: reasoningMetadata.signature,
|
|
350
|
+
cache_control: cacheControl
|
|
351
|
+
});
|
|
352
|
+
} else if (reasoningMetadata.redactedData != null) {
|
|
353
|
+
anthropicContent.push({
|
|
354
|
+
type: "redacted_thinking",
|
|
355
|
+
data: reasoningMetadata.redactedData,
|
|
356
|
+
cache_control: cacheControl
|
|
357
|
+
});
|
|
358
|
+
} else {
|
|
359
|
+
warnings.push({
|
|
360
|
+
type: "other",
|
|
361
|
+
message: "unsupported reasoning metadata"
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
warnings.push({
|
|
366
|
+
type: "other",
|
|
367
|
+
message: "unsupported reasoning metadata"
|
|
368
|
+
});
|
|
369
|
+
}
|
|
330
370
|
} else {
|
|
331
371
|
warnings.push({
|
|
332
372
|
type: "other",
|
|
@@ -335,14 +375,6 @@ function convertToAnthropicMessagesPrompt({
|
|
|
335
375
|
}
|
|
336
376
|
break;
|
|
337
377
|
}
|
|
338
|
-
case "redacted-reasoning": {
|
|
339
|
-
anthropicContent.push({
|
|
340
|
-
type: "redacted_thinking",
|
|
341
|
-
data: part.data,
|
|
342
|
-
cache_control: cacheControl
|
|
343
|
-
});
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
378
|
case "tool-call": {
|
|
347
379
|
anthropicContent.push({
|
|
348
380
|
type: "tool_use",
|
|
@@ -361,7 +393,7 @@ function convertToAnthropicMessagesPrompt({
|
|
|
361
393
|
}
|
|
362
394
|
default: {
|
|
363
395
|
const _exhaustiveCheck = type;
|
|
364
|
-
throw new Error(`
|
|
396
|
+
throw new Error(`content type: ${_exhaustiveCheck}`);
|
|
365
397
|
}
|
|
366
398
|
}
|
|
367
399
|
}
|
|
@@ -434,11 +466,9 @@ function mapAnthropicStopReason(finishReason) {
|
|
|
434
466
|
|
|
435
467
|
// src/anthropic-messages-language-model.ts
|
|
436
468
|
var AnthropicMessagesLanguageModel = class {
|
|
437
|
-
constructor(modelId,
|
|
438
|
-
this.specificationVersion = "
|
|
439
|
-
this.defaultObjectGenerationMode = "tool";
|
|
469
|
+
constructor(modelId, config) {
|
|
470
|
+
this.specificationVersion = "v2";
|
|
440
471
|
this.modelId = modelId;
|
|
441
|
-
this.settings = settings;
|
|
442
472
|
this.config = config;
|
|
443
473
|
}
|
|
444
474
|
supportsUrl(url) {
|
|
@@ -447,13 +477,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
447
477
|
get provider() {
|
|
448
478
|
return this.config.provider;
|
|
449
479
|
}
|
|
450
|
-
get
|
|
451
|
-
|
|
480
|
+
get supportedUrls() {
|
|
481
|
+
var _a, _b, _c;
|
|
482
|
+
return (_c = (_b = (_a = this.config).supportedUrls) == null ? void 0 : _b.call(_a)) != null ? _c : {};
|
|
452
483
|
}
|
|
453
484
|
async getArgs({
|
|
454
|
-
mode,
|
|
455
485
|
prompt,
|
|
456
|
-
|
|
486
|
+
maxOutputTokens = 4096,
|
|
457
487
|
// 4096: max model output tokens TODO update default in v5
|
|
458
488
|
temperature,
|
|
459
489
|
topP,
|
|
@@ -463,10 +493,11 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
463
493
|
stopSequences,
|
|
464
494
|
responseFormat,
|
|
465
495
|
seed,
|
|
466
|
-
|
|
496
|
+
tools,
|
|
497
|
+
toolChoice,
|
|
498
|
+
providerOptions
|
|
467
499
|
}) {
|
|
468
500
|
var _a, _b, _c;
|
|
469
|
-
const type = mode.type;
|
|
470
501
|
const warnings = [];
|
|
471
502
|
if (frequencyPenalty != null) {
|
|
472
503
|
warnings.push({
|
|
@@ -493,15 +524,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
493
524
|
details: "JSON response format is not supported."
|
|
494
525
|
});
|
|
495
526
|
}
|
|
496
|
-
const
|
|
497
|
-
prompt,
|
|
498
|
-
sendReasoning: (_a = this.settings.sendReasoning) != null ? _a : true,
|
|
499
|
-
warnings
|
|
500
|
-
});
|
|
501
|
-
const anthropicOptions = parseProviderOptions({
|
|
527
|
+
const anthropicOptions = await parseProviderOptions2({
|
|
502
528
|
provider: "anthropic",
|
|
503
529
|
providerOptions,
|
|
504
|
-
schema:
|
|
530
|
+
schema: anthropicProviderOptions
|
|
531
|
+
});
|
|
532
|
+
const { prompt: messagesPrompt, betas: messagesBetas } = await convertToAnthropicMessagesPrompt({
|
|
533
|
+
prompt,
|
|
534
|
+
sendReasoning: (_a = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _a : true,
|
|
535
|
+
warnings
|
|
505
536
|
});
|
|
506
537
|
const isThinking = ((_b = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _b.type) === "enabled";
|
|
507
538
|
const thinkingBudget = (_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.budgetTokens;
|
|
@@ -509,7 +540,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
509
540
|
// model id:
|
|
510
541
|
model: this.modelId,
|
|
511
542
|
// standardized settings:
|
|
512
|
-
max_tokens:
|
|
543
|
+
max_tokens: maxOutputTokens,
|
|
513
544
|
temperature,
|
|
514
545
|
top_k: topK,
|
|
515
546
|
top_p: topP,
|
|
@@ -552,44 +583,23 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
552
583
|
details: "topP is not supported when thinking is enabled"
|
|
553
584
|
});
|
|
554
585
|
}
|
|
555
|
-
baseArgs.max_tokens =
|
|
556
|
-
}
|
|
557
|
-
switch (type) {
|
|
558
|
-
case "regular": {
|
|
559
|
-
const {
|
|
560
|
-
tools,
|
|
561
|
-
tool_choice,
|
|
562
|
-
toolWarnings,
|
|
563
|
-
betas: toolsBetas
|
|
564
|
-
} = prepareTools(mode);
|
|
565
|
-
return {
|
|
566
|
-
args: { ...baseArgs, tools, tool_choice },
|
|
567
|
-
warnings: [...warnings, ...toolWarnings],
|
|
568
|
-
betas: /* @__PURE__ */ new Set([...messagesBetas, ...toolsBetas])
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
case "object-json": {
|
|
572
|
-
throw new UnsupportedFunctionalityError3({
|
|
573
|
-
functionality: "json-mode object generation"
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
case "object-tool": {
|
|
577
|
-
const { name, description, parameters } = mode.tool;
|
|
578
|
-
return {
|
|
579
|
-
args: {
|
|
580
|
-
...baseArgs,
|
|
581
|
-
tools: [{ name, description, input_schema: parameters }],
|
|
582
|
-
tool_choice: { type: "tool", name }
|
|
583
|
-
},
|
|
584
|
-
warnings,
|
|
585
|
-
betas: messagesBetas
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
default: {
|
|
589
|
-
const _exhaustiveCheck = type;
|
|
590
|
-
throw new Error(`Unsupported type: ${_exhaustiveCheck}`);
|
|
591
|
-
}
|
|
586
|
+
baseArgs.max_tokens = maxOutputTokens + thinkingBudget;
|
|
592
587
|
}
|
|
588
|
+
const {
|
|
589
|
+
tools: anthropicTools2,
|
|
590
|
+
toolChoice: anthropicToolChoice,
|
|
591
|
+
toolWarnings,
|
|
592
|
+
betas: toolsBetas
|
|
593
|
+
} = prepareTools({ tools, toolChoice });
|
|
594
|
+
return {
|
|
595
|
+
args: {
|
|
596
|
+
...baseArgs,
|
|
597
|
+
tools: anthropicTools2,
|
|
598
|
+
tool_choice: anthropicToolChoice
|
|
599
|
+
},
|
|
600
|
+
warnings: [...warnings, ...toolWarnings],
|
|
601
|
+
betas: /* @__PURE__ */ new Set([...messagesBetas, ...toolsBetas])
|
|
602
|
+
};
|
|
593
603
|
}
|
|
594
604
|
async getHeaders({
|
|
595
605
|
betas,
|
|
@@ -627,65 +637,71 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
627
637
|
abortSignal: options.abortSignal,
|
|
628
638
|
fetch: this.config.fetch
|
|
629
639
|
});
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
640
|
+
const content = [];
|
|
641
|
+
for (const part of response.content) {
|
|
642
|
+
switch (part.type) {
|
|
643
|
+
case "text": {
|
|
644
|
+
content.push({ type: "text", text: part.text });
|
|
645
|
+
break;
|
|
646
|
+
}
|
|
647
|
+
case "thinking": {
|
|
648
|
+
content.push({
|
|
649
|
+
type: "reasoning",
|
|
650
|
+
text: part.thinking,
|
|
651
|
+
providerMetadata: {
|
|
652
|
+
anthropic: {
|
|
653
|
+
signature: part.signature
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
case "redacted_thinking": {
|
|
660
|
+
content.push({
|
|
661
|
+
type: "reasoning",
|
|
662
|
+
text: "",
|
|
663
|
+
providerMetadata: {
|
|
664
|
+
anthropic: {
|
|
665
|
+
redactedData: part.data
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
case "tool_use": {
|
|
672
|
+
content.push({
|
|
673
|
+
type: "tool-call",
|
|
643
674
|
toolCallType: "function",
|
|
644
|
-
toolCallId:
|
|
645
|
-
toolName:
|
|
646
|
-
args: JSON.stringify(
|
|
675
|
+
toolCallId: part.id,
|
|
676
|
+
toolName: part.name,
|
|
677
|
+
args: JSON.stringify(part.input)
|
|
647
678
|
});
|
|
679
|
+
break;
|
|
648
680
|
}
|
|
649
681
|
}
|
|
650
682
|
}
|
|
651
|
-
const reasoning = response.content.filter(
|
|
652
|
-
(content) => content.type === "redacted_thinking" || content.type === "thinking"
|
|
653
|
-
).map(
|
|
654
|
-
(content) => content.type === "thinking" ? {
|
|
655
|
-
type: "text",
|
|
656
|
-
text: content.thinking,
|
|
657
|
-
signature: content.signature
|
|
658
|
-
} : {
|
|
659
|
-
type: "redacted",
|
|
660
|
-
data: content.data
|
|
661
|
-
}
|
|
662
|
-
);
|
|
663
683
|
return {
|
|
664
|
-
|
|
665
|
-
reasoning: reasoning.length > 0 ? reasoning : void 0,
|
|
666
|
-
toolCalls,
|
|
684
|
+
content,
|
|
667
685
|
finishReason: mapAnthropicStopReason(response.stop_reason),
|
|
668
686
|
usage: {
|
|
669
|
-
|
|
670
|
-
|
|
687
|
+
inputTokens: response.usage.input_tokens,
|
|
688
|
+
outputTokens: response.usage.output_tokens,
|
|
689
|
+
totalTokens: response.usage.input_tokens + response.usage.output_tokens,
|
|
690
|
+
cachedInputTokens: (_a = response.usage.cache_read_input_tokens) != null ? _a : void 0
|
|
671
691
|
},
|
|
672
|
-
|
|
673
|
-
|
|
692
|
+
request: { body: args },
|
|
693
|
+
response: {
|
|
694
|
+
id: (_b = response.id) != null ? _b : void 0,
|
|
695
|
+
modelId: (_c = response.model) != null ? _c : void 0,
|
|
674
696
|
headers: responseHeaders,
|
|
675
697
|
body: rawResponse
|
|
676
698
|
},
|
|
677
|
-
response: {
|
|
678
|
-
id: (_a = response.id) != null ? _a : void 0,
|
|
679
|
-
modelId: (_b = response.model) != null ? _b : void 0
|
|
680
|
-
},
|
|
681
699
|
warnings,
|
|
682
700
|
providerMetadata: {
|
|
683
701
|
anthropic: {
|
|
684
|
-
cacheCreationInputTokens: (
|
|
685
|
-
cacheReadInputTokens: (_d = response.usage.cache_read_input_tokens) != null ? _d : null
|
|
702
|
+
cacheCreationInputTokens: (_d = response.usage.cache_creation_input_tokens) != null ? _d : null
|
|
686
703
|
}
|
|
687
|
-
}
|
|
688
|
-
request: { body: JSON.stringify(args) }
|
|
704
|
+
}
|
|
689
705
|
};
|
|
690
706
|
}
|
|
691
707
|
async doStream(options) {
|
|
@@ -702,11 +718,11 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
702
718
|
abortSignal: options.abortSignal,
|
|
703
719
|
fetch: this.config.fetch
|
|
704
720
|
});
|
|
705
|
-
const { messages: rawPrompt, ...rawSettings } = args;
|
|
706
721
|
let finishReason = "unknown";
|
|
707
722
|
const usage = {
|
|
708
|
-
|
|
709
|
-
|
|
723
|
+
inputTokens: void 0,
|
|
724
|
+
outputTokens: void 0,
|
|
725
|
+
totalTokens: void 0
|
|
710
726
|
};
|
|
711
727
|
const toolCallContentBlocks = {};
|
|
712
728
|
let providerMetadata = void 0;
|
|
@@ -714,8 +730,11 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
714
730
|
return {
|
|
715
731
|
stream: response.pipeThrough(
|
|
716
732
|
new TransformStream({
|
|
733
|
+
start(controller) {
|
|
734
|
+
controller.enqueue({ type: "stream-start", warnings });
|
|
735
|
+
},
|
|
717
736
|
transform(chunk, controller) {
|
|
718
|
-
var _a, _b, _c, _d;
|
|
737
|
+
var _a, _b, _c, _d, _e, _f;
|
|
719
738
|
if (!chunk.success) {
|
|
720
739
|
controller.enqueue({ type: "error", error: chunk.error });
|
|
721
740
|
return;
|
|
@@ -735,9 +754,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
735
754
|
}
|
|
736
755
|
case "redacted_thinking": {
|
|
737
756
|
controller.enqueue({
|
|
738
|
-
type: "
|
|
739
|
-
|
|
757
|
+
type: "reasoning",
|
|
758
|
+
text: "",
|
|
759
|
+
providerMetadata: {
|
|
760
|
+
anthropic: {
|
|
761
|
+
redactedData: value.content_block.data
|
|
762
|
+
}
|
|
763
|
+
}
|
|
740
764
|
});
|
|
765
|
+
controller.enqueue({ type: "reasoning-part-finish" });
|
|
741
766
|
return;
|
|
742
767
|
}
|
|
743
768
|
case "tool_use": {
|
|
@@ -776,24 +801,30 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
776
801
|
switch (deltaType) {
|
|
777
802
|
case "text_delta": {
|
|
778
803
|
controller.enqueue({
|
|
779
|
-
type: "text
|
|
780
|
-
|
|
804
|
+
type: "text",
|
|
805
|
+
text: value.delta.text
|
|
781
806
|
});
|
|
782
807
|
return;
|
|
783
808
|
}
|
|
784
809
|
case "thinking_delta": {
|
|
785
810
|
controller.enqueue({
|
|
786
811
|
type: "reasoning",
|
|
787
|
-
|
|
812
|
+
text: value.delta.thinking
|
|
788
813
|
});
|
|
789
814
|
return;
|
|
790
815
|
}
|
|
791
816
|
case "signature_delta": {
|
|
792
817
|
if (blockType === "thinking") {
|
|
793
818
|
controller.enqueue({
|
|
794
|
-
type: "reasoning
|
|
795
|
-
|
|
819
|
+
type: "reasoning",
|
|
820
|
+
text: "",
|
|
821
|
+
providerMetadata: {
|
|
822
|
+
anthropic: {
|
|
823
|
+
signature: value.delta.signature
|
|
824
|
+
}
|
|
825
|
+
}
|
|
796
826
|
});
|
|
827
|
+
controller.enqueue({ type: "reasoning-part-finish" });
|
|
797
828
|
}
|
|
798
829
|
return;
|
|
799
830
|
}
|
|
@@ -818,12 +849,11 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
818
849
|
}
|
|
819
850
|
}
|
|
820
851
|
case "message_start": {
|
|
821
|
-
usage.
|
|
822
|
-
usage.
|
|
852
|
+
usage.inputTokens = value.message.usage.input_tokens;
|
|
853
|
+
usage.cachedInputTokens = (_a = value.message.usage.cache_read_input_tokens) != null ? _a : void 0;
|
|
823
854
|
providerMetadata = {
|
|
824
855
|
anthropic: {
|
|
825
|
-
cacheCreationInputTokens: (
|
|
826
|
-
cacheReadInputTokens: (_b = value.message.usage.cache_read_input_tokens) != null ? _b : null
|
|
856
|
+
cacheCreationInputTokens: (_b = value.message.usage.cache_creation_input_tokens) != null ? _b : null
|
|
827
857
|
}
|
|
828
858
|
};
|
|
829
859
|
controller.enqueue({
|
|
@@ -834,7 +864,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
834
864
|
return;
|
|
835
865
|
}
|
|
836
866
|
case "message_delta": {
|
|
837
|
-
usage.
|
|
867
|
+
usage.outputTokens = value.usage.output_tokens;
|
|
868
|
+
usage.totalTokens = ((_e = usage.inputTokens) != null ? _e : 0) + ((_f = value.usage.output_tokens) != null ? _f : 0);
|
|
838
869
|
finishReason = mapAnthropicStopReason(value.delta.stop_reason);
|
|
839
870
|
return;
|
|
840
871
|
}
|
|
@@ -859,142 +890,138 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
859
890
|
}
|
|
860
891
|
})
|
|
861
892
|
),
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
warnings,
|
|
865
|
-
request: { body: JSON.stringify(body) }
|
|
893
|
+
request: { body },
|
|
894
|
+
response: { headers: responseHeaders }
|
|
866
895
|
};
|
|
867
896
|
}
|
|
868
897
|
};
|
|
869
|
-
var anthropicMessagesResponseSchema =
|
|
870
|
-
type:
|
|
871
|
-
id:
|
|
872
|
-
model:
|
|
873
|
-
content:
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
type:
|
|
877
|
-
text:
|
|
898
|
+
var anthropicMessagesResponseSchema = z3.object({
|
|
899
|
+
type: z3.literal("message"),
|
|
900
|
+
id: z3.string().nullish(),
|
|
901
|
+
model: z3.string().nullish(),
|
|
902
|
+
content: z3.array(
|
|
903
|
+
z3.discriminatedUnion("type", [
|
|
904
|
+
z3.object({
|
|
905
|
+
type: z3.literal("text"),
|
|
906
|
+
text: z3.string()
|
|
878
907
|
}),
|
|
879
|
-
|
|
880
|
-
type:
|
|
881
|
-
thinking:
|
|
882
|
-
signature:
|
|
908
|
+
z3.object({
|
|
909
|
+
type: z3.literal("thinking"),
|
|
910
|
+
thinking: z3.string(),
|
|
911
|
+
signature: z3.string()
|
|
883
912
|
}),
|
|
884
|
-
|
|
885
|
-
type:
|
|
886
|
-
data:
|
|
913
|
+
z3.object({
|
|
914
|
+
type: z3.literal("redacted_thinking"),
|
|
915
|
+
data: z3.string()
|
|
887
916
|
}),
|
|
888
|
-
|
|
889
|
-
type:
|
|
890
|
-
id:
|
|
891
|
-
name:
|
|
892
|
-
input:
|
|
917
|
+
z3.object({
|
|
918
|
+
type: z3.literal("tool_use"),
|
|
919
|
+
id: z3.string(),
|
|
920
|
+
name: z3.string(),
|
|
921
|
+
input: z3.unknown()
|
|
893
922
|
})
|
|
894
923
|
])
|
|
895
924
|
),
|
|
896
|
-
stop_reason:
|
|
897
|
-
usage:
|
|
898
|
-
input_tokens:
|
|
899
|
-
output_tokens:
|
|
900
|
-
cache_creation_input_tokens:
|
|
901
|
-
cache_read_input_tokens:
|
|
925
|
+
stop_reason: z3.string().nullish(),
|
|
926
|
+
usage: z3.object({
|
|
927
|
+
input_tokens: z3.number(),
|
|
928
|
+
output_tokens: z3.number(),
|
|
929
|
+
cache_creation_input_tokens: z3.number().nullish(),
|
|
930
|
+
cache_read_input_tokens: z3.number().nullish()
|
|
902
931
|
})
|
|
903
932
|
});
|
|
904
|
-
var anthropicMessagesChunkSchema =
|
|
905
|
-
|
|
906
|
-
type:
|
|
907
|
-
message:
|
|
908
|
-
id:
|
|
909
|
-
model:
|
|
910
|
-
usage:
|
|
911
|
-
input_tokens:
|
|
912
|
-
output_tokens:
|
|
913
|
-
cache_creation_input_tokens:
|
|
914
|
-
cache_read_input_tokens:
|
|
933
|
+
var anthropicMessagesChunkSchema = z3.discriminatedUnion("type", [
|
|
934
|
+
z3.object({
|
|
935
|
+
type: z3.literal("message_start"),
|
|
936
|
+
message: z3.object({
|
|
937
|
+
id: z3.string().nullish(),
|
|
938
|
+
model: z3.string().nullish(),
|
|
939
|
+
usage: z3.object({
|
|
940
|
+
input_tokens: z3.number(),
|
|
941
|
+
output_tokens: z3.number(),
|
|
942
|
+
cache_creation_input_tokens: z3.number().nullish(),
|
|
943
|
+
cache_read_input_tokens: z3.number().nullish()
|
|
915
944
|
})
|
|
916
945
|
})
|
|
917
946
|
}),
|
|
918
|
-
|
|
919
|
-
type:
|
|
920
|
-
index:
|
|
921
|
-
content_block:
|
|
922
|
-
|
|
923
|
-
type:
|
|
924
|
-
text:
|
|
947
|
+
z3.object({
|
|
948
|
+
type: z3.literal("content_block_start"),
|
|
949
|
+
index: z3.number(),
|
|
950
|
+
content_block: z3.discriminatedUnion("type", [
|
|
951
|
+
z3.object({
|
|
952
|
+
type: z3.literal("text"),
|
|
953
|
+
text: z3.string()
|
|
925
954
|
}),
|
|
926
|
-
|
|
927
|
-
type:
|
|
928
|
-
thinking:
|
|
955
|
+
z3.object({
|
|
956
|
+
type: z3.literal("thinking"),
|
|
957
|
+
thinking: z3.string()
|
|
929
958
|
}),
|
|
930
|
-
|
|
931
|
-
type:
|
|
932
|
-
id:
|
|
933
|
-
name:
|
|
959
|
+
z3.object({
|
|
960
|
+
type: z3.literal("tool_use"),
|
|
961
|
+
id: z3.string(),
|
|
962
|
+
name: z3.string()
|
|
934
963
|
}),
|
|
935
|
-
|
|
936
|
-
type:
|
|
937
|
-
data:
|
|
964
|
+
z3.object({
|
|
965
|
+
type: z3.literal("redacted_thinking"),
|
|
966
|
+
data: z3.string()
|
|
938
967
|
})
|
|
939
968
|
])
|
|
940
969
|
}),
|
|
941
|
-
|
|
942
|
-
type:
|
|
943
|
-
index:
|
|
944
|
-
delta:
|
|
945
|
-
|
|
946
|
-
type:
|
|
947
|
-
partial_json:
|
|
970
|
+
z3.object({
|
|
971
|
+
type: z3.literal("content_block_delta"),
|
|
972
|
+
index: z3.number(),
|
|
973
|
+
delta: z3.discriminatedUnion("type", [
|
|
974
|
+
z3.object({
|
|
975
|
+
type: z3.literal("input_json_delta"),
|
|
976
|
+
partial_json: z3.string()
|
|
948
977
|
}),
|
|
949
|
-
|
|
950
|
-
type:
|
|
951
|
-
text:
|
|
978
|
+
z3.object({
|
|
979
|
+
type: z3.literal("text_delta"),
|
|
980
|
+
text: z3.string()
|
|
952
981
|
}),
|
|
953
|
-
|
|
954
|
-
type:
|
|
955
|
-
thinking:
|
|
982
|
+
z3.object({
|
|
983
|
+
type: z3.literal("thinking_delta"),
|
|
984
|
+
thinking: z3.string()
|
|
956
985
|
}),
|
|
957
|
-
|
|
958
|
-
type:
|
|
959
|
-
signature:
|
|
986
|
+
z3.object({
|
|
987
|
+
type: z3.literal("signature_delta"),
|
|
988
|
+
signature: z3.string()
|
|
960
989
|
})
|
|
961
990
|
])
|
|
962
991
|
}),
|
|
963
|
-
|
|
964
|
-
type:
|
|
965
|
-
index:
|
|
992
|
+
z3.object({
|
|
993
|
+
type: z3.literal("content_block_stop"),
|
|
994
|
+
index: z3.number()
|
|
966
995
|
}),
|
|
967
|
-
|
|
968
|
-
type:
|
|
969
|
-
error:
|
|
970
|
-
type:
|
|
971
|
-
message:
|
|
996
|
+
z3.object({
|
|
997
|
+
type: z3.literal("error"),
|
|
998
|
+
error: z3.object({
|
|
999
|
+
type: z3.string(),
|
|
1000
|
+
message: z3.string()
|
|
972
1001
|
})
|
|
973
1002
|
}),
|
|
974
|
-
|
|
975
|
-
type:
|
|
976
|
-
delta:
|
|
977
|
-
usage:
|
|
1003
|
+
z3.object({
|
|
1004
|
+
type: z3.literal("message_delta"),
|
|
1005
|
+
delta: z3.object({ stop_reason: z3.string().nullish() }),
|
|
1006
|
+
usage: z3.object({ output_tokens: z3.number() })
|
|
978
1007
|
}),
|
|
979
|
-
|
|
980
|
-
type:
|
|
1008
|
+
z3.object({
|
|
1009
|
+
type: z3.literal("message_stop")
|
|
981
1010
|
}),
|
|
982
|
-
|
|
983
|
-
type:
|
|
1011
|
+
z3.object({
|
|
1012
|
+
type: z3.literal("ping")
|
|
984
1013
|
})
|
|
985
1014
|
]);
|
|
986
|
-
var
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
budgetTokens: z2.number().optional()
|
|
990
|
-
}).optional()
|
|
1015
|
+
var anthropicReasoningMetadataSchema = z3.object({
|
|
1016
|
+
signature: z3.string().optional(),
|
|
1017
|
+
redactedData: z3.string().optional()
|
|
991
1018
|
});
|
|
992
1019
|
|
|
993
1020
|
// src/anthropic-tools.ts
|
|
994
|
-
import { z as
|
|
995
|
-
var Bash20241022Parameters =
|
|
996
|
-
command:
|
|
997
|
-
restart:
|
|
1021
|
+
import { z as z4 } from "zod";
|
|
1022
|
+
var Bash20241022Parameters = z4.object({
|
|
1023
|
+
command: z4.string(),
|
|
1024
|
+
restart: z4.boolean().optional()
|
|
998
1025
|
});
|
|
999
1026
|
function bashTool_20241022(options = {}) {
|
|
1000
1027
|
return {
|
|
@@ -1006,9 +1033,9 @@ function bashTool_20241022(options = {}) {
|
|
|
1006
1033
|
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
1007
1034
|
};
|
|
1008
1035
|
}
|
|
1009
|
-
var Bash20250124Parameters =
|
|
1010
|
-
command:
|
|
1011
|
-
restart:
|
|
1036
|
+
var Bash20250124Parameters = z4.object({
|
|
1037
|
+
command: z4.string(),
|
|
1038
|
+
restart: z4.boolean().optional()
|
|
1012
1039
|
});
|
|
1013
1040
|
function bashTool_20250124(options = {}) {
|
|
1014
1041
|
return {
|
|
@@ -1020,14 +1047,14 @@ function bashTool_20250124(options = {}) {
|
|
|
1020
1047
|
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
1021
1048
|
};
|
|
1022
1049
|
}
|
|
1023
|
-
var TextEditor20241022Parameters =
|
|
1024
|
-
command:
|
|
1025
|
-
path:
|
|
1026
|
-
file_text:
|
|
1027
|
-
insert_line:
|
|
1028
|
-
new_str:
|
|
1029
|
-
old_str:
|
|
1030
|
-
view_range:
|
|
1050
|
+
var TextEditor20241022Parameters = z4.object({
|
|
1051
|
+
command: z4.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
1052
|
+
path: z4.string(),
|
|
1053
|
+
file_text: z4.string().optional(),
|
|
1054
|
+
insert_line: z4.number().int().optional(),
|
|
1055
|
+
new_str: z4.string().optional(),
|
|
1056
|
+
old_str: z4.string().optional(),
|
|
1057
|
+
view_range: z4.array(z4.number().int()).optional()
|
|
1031
1058
|
});
|
|
1032
1059
|
function textEditorTool_20241022(options = {}) {
|
|
1033
1060
|
return {
|
|
@@ -1039,14 +1066,14 @@ function textEditorTool_20241022(options = {}) {
|
|
|
1039
1066
|
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
1040
1067
|
};
|
|
1041
1068
|
}
|
|
1042
|
-
var TextEditor20250124Parameters =
|
|
1043
|
-
command:
|
|
1044
|
-
path:
|
|
1045
|
-
file_text:
|
|
1046
|
-
insert_line:
|
|
1047
|
-
new_str:
|
|
1048
|
-
old_str:
|
|
1049
|
-
view_range:
|
|
1069
|
+
var TextEditor20250124Parameters = z4.object({
|
|
1070
|
+
command: z4.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
1071
|
+
path: z4.string(),
|
|
1072
|
+
file_text: z4.string().optional(),
|
|
1073
|
+
insert_line: z4.number().int().optional(),
|
|
1074
|
+
new_str: z4.string().optional(),
|
|
1075
|
+
old_str: z4.string().optional(),
|
|
1076
|
+
view_range: z4.array(z4.number().int()).optional()
|
|
1050
1077
|
});
|
|
1051
1078
|
function textEditorTool_20250124(options = {}) {
|
|
1052
1079
|
return {
|
|
@@ -1058,8 +1085,8 @@ function textEditorTool_20250124(options = {}) {
|
|
|
1058
1085
|
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
1059
1086
|
};
|
|
1060
1087
|
}
|
|
1061
|
-
var Computer20241022Parameters =
|
|
1062
|
-
action:
|
|
1088
|
+
var Computer20241022Parameters = z4.object({
|
|
1089
|
+
action: z4.enum([
|
|
1063
1090
|
"key",
|
|
1064
1091
|
"type",
|
|
1065
1092
|
"mouse_move",
|
|
@@ -1071,8 +1098,8 @@ var Computer20241022Parameters = z3.object({
|
|
|
1071
1098
|
"screenshot",
|
|
1072
1099
|
"cursor_position"
|
|
1073
1100
|
]),
|
|
1074
|
-
coordinate:
|
|
1075
|
-
text:
|
|
1101
|
+
coordinate: z4.array(z4.number().int()).optional(),
|
|
1102
|
+
text: z4.string().optional()
|
|
1076
1103
|
});
|
|
1077
1104
|
function computerTool_20241022(options) {
|
|
1078
1105
|
return {
|
|
@@ -1088,8 +1115,8 @@ function computerTool_20241022(options) {
|
|
|
1088
1115
|
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
1089
1116
|
};
|
|
1090
1117
|
}
|
|
1091
|
-
var Computer20250124Parameters =
|
|
1092
|
-
action:
|
|
1118
|
+
var Computer20250124Parameters = z4.object({
|
|
1119
|
+
action: z4.enum([
|
|
1093
1120
|
"key",
|
|
1094
1121
|
"hold_key",
|
|
1095
1122
|
"type",
|
|
@@ -1107,12 +1134,12 @@ var Computer20250124Parameters = z3.object({
|
|
|
1107
1134
|
"wait",
|
|
1108
1135
|
"screenshot"
|
|
1109
1136
|
]),
|
|
1110
|
-
coordinate:
|
|
1111
|
-
duration:
|
|
1112
|
-
scroll_amount:
|
|
1113
|
-
scroll_direction:
|
|
1114
|
-
start_coordinate:
|
|
1115
|
-
text:
|
|
1137
|
+
coordinate: z4.tuple([z4.number().int(), z4.number().int()]).optional(),
|
|
1138
|
+
duration: z4.number().optional(),
|
|
1139
|
+
scroll_amount: z4.number().optional(),
|
|
1140
|
+
scroll_direction: z4.enum(["up", "down", "left", "right"]).optional(),
|
|
1141
|
+
start_coordinate: z4.tuple([z4.number().int(), z4.number().int()]).optional(),
|
|
1142
|
+
text: z4.string().optional()
|
|
1116
1143
|
});
|
|
1117
1144
|
function computerTool_20250124(options) {
|
|
1118
1145
|
return {
|