@ai-sdk/anthropic 3.0.0-beta.65 → 3.0.0-beta.67

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.
@@ -42,7 +42,7 @@ declare const anthropicTools: {
42
42
  *
43
43
  * Tool name must be `bash`.
44
44
  */
45
- bash_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
45
+ bash_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
46
46
  command: string;
47
47
  restart?: boolean;
48
48
  }, {}>;
@@ -54,7 +54,7 @@ declare const anthropicTools: {
54
54
  *
55
55
  * Tool name must be `bash`.
56
56
  */
57
- bash_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
57
+ bash_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
58
58
  command: string;
59
59
  restart?: boolean;
60
60
  }, {}>;
@@ -68,7 +68,7 @@ declare const anthropicTools: {
68
68
  *
69
69
  * Tool name must be `code_execution`.
70
70
  */
71
- codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
71
+ codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
72
72
  code: string;
73
73
  }, {
74
74
  type: "code_execution_result";
@@ -95,7 +95,7 @@ declare const anthropicTools: {
95
95
  *
96
96
  * Tool name must be `code_execution`.
97
97
  */
98
- codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
98
+ codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
99
99
  type: "bash_code_execution";
100
100
  command: string;
101
101
  } | {
@@ -208,7 +208,7 @@ declare const anthropicTools: {
208
208
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
209
209
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
210
210
  */
211
- computer_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
211
+ computer_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
212
212
  action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
213
213
  coordinate?: number[];
214
214
  text?: string;
@@ -229,7 +229,7 @@ declare const anthropicTools: {
229
229
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
230
230
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
231
231
  */
232
- computer_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
232
+ computer_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
233
233
  action: "key" | "hold_key" | "type" | "cursor_position" | "mouse_move" | "left_mouse_down" | "left_mouse_up" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "triple_click" | "scroll" | "wait" | "screenshot";
234
234
  coordinate?: [number, number];
235
235
  duration?: number;
@@ -252,7 +252,7 @@ declare const anthropicTools: {
252
252
  *
253
253
  * Tool name must be `memory`.
254
254
  */
255
- memory_20250818: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
255
+ memory_20250818: _ai_sdk_provider_utils.ProviderToolFactory<{
256
256
  command: "view";
257
257
  path: string;
258
258
  view_range?: [number, number];
@@ -287,7 +287,7 @@ declare const anthropicTools: {
287
287
  *
288
288
  * Tool name must be `str_replace_editor`.
289
289
  */
290
- textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
290
+ textEditor_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
291
291
  command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
292
292
  path: string;
293
293
  file_text?: string;
@@ -305,7 +305,7 @@ declare const anthropicTools: {
305
305
  *
306
306
  * Tool name must be `str_replace_editor`.
307
307
  */
308
- textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
308
+ textEditor_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
309
309
  command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
310
310
  path: string;
311
311
  file_text?: string;
@@ -325,7 +325,7 @@ declare const anthropicTools: {
325
325
  *
326
326
  * @deprecated Use textEditor_20250728 instead
327
327
  */
328
- textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
328
+ textEditor_20250429: _ai_sdk_provider_utils.ProviderToolFactory<{
329
329
  command: "view" | "create" | "str_replace" | "insert";
330
330
  path: string;
331
331
  file_text?: string;
@@ -347,7 +347,7 @@ declare const anthropicTools: {
347
347
  *
348
348
  * @param maxCharacters - Optional maximum number of characters to view in the file
349
349
  */
350
- textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactory<{
350
+ textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactory<{
351
351
  command: "view" | "create" | "str_replace" | "insert";
352
352
  path: string;
353
353
  file_text?: string;
@@ -377,7 +377,7 @@ declare const anthropicTools: {
377
377
  * @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
378
378
  * @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
379
379
  */
380
- webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
380
+ webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
381
381
  url: string;
382
382
  }, {
383
383
  type: "web_fetch_result";
@@ -440,7 +440,7 @@ declare const anthropicTools: {
440
440
  * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
441
441
  * @param userLocation - Optional user location information to provide geographically relevant search results.
442
442
  */
443
- webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
443
+ webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
444
444
  query: string;
445
445
  }, {
446
446
  type: "web_search_result";
@@ -42,7 +42,7 @@ declare const anthropicTools: {
42
42
  *
43
43
  * Tool name must be `bash`.
44
44
  */
45
- bash_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
45
+ bash_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
46
46
  command: string;
47
47
  restart?: boolean;
48
48
  }, {}>;
@@ -54,7 +54,7 @@ declare const anthropicTools: {
54
54
  *
55
55
  * Tool name must be `bash`.
56
56
  */
57
- bash_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
57
+ bash_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
58
58
  command: string;
59
59
  restart?: boolean;
60
60
  }, {}>;
@@ -68,7 +68,7 @@ declare const anthropicTools: {
68
68
  *
69
69
  * Tool name must be `code_execution`.
70
70
  */
71
- codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
71
+ codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
72
72
  code: string;
73
73
  }, {
74
74
  type: "code_execution_result";
@@ -95,7 +95,7 @@ declare const anthropicTools: {
95
95
  *
96
96
  * Tool name must be `code_execution`.
97
97
  */
98
- codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
98
+ codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
99
99
  type: "bash_code_execution";
100
100
  command: string;
101
101
  } | {
@@ -208,7 +208,7 @@ declare const anthropicTools: {
208
208
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
209
209
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
210
210
  */
211
- computer_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
211
+ computer_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
212
212
  action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
213
213
  coordinate?: number[];
214
214
  text?: string;
@@ -229,7 +229,7 @@ declare const anthropicTools: {
229
229
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
230
230
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
231
231
  */
232
- computer_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
232
+ computer_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
233
233
  action: "key" | "hold_key" | "type" | "cursor_position" | "mouse_move" | "left_mouse_down" | "left_mouse_up" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "triple_click" | "scroll" | "wait" | "screenshot";
234
234
  coordinate?: [number, number];
235
235
  duration?: number;
@@ -252,7 +252,7 @@ declare const anthropicTools: {
252
252
  *
253
253
  * Tool name must be `memory`.
254
254
  */
255
- memory_20250818: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
255
+ memory_20250818: _ai_sdk_provider_utils.ProviderToolFactory<{
256
256
  command: "view";
257
257
  path: string;
258
258
  view_range?: [number, number];
@@ -287,7 +287,7 @@ declare const anthropicTools: {
287
287
  *
288
288
  * Tool name must be `str_replace_editor`.
289
289
  */
290
- textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
290
+ textEditor_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
291
291
  command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
292
292
  path: string;
293
293
  file_text?: string;
@@ -305,7 +305,7 @@ declare const anthropicTools: {
305
305
  *
306
306
  * Tool name must be `str_replace_editor`.
307
307
  */
308
- textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
308
+ textEditor_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
309
309
  command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
310
310
  path: string;
311
311
  file_text?: string;
@@ -325,7 +325,7 @@ declare const anthropicTools: {
325
325
  *
326
326
  * @deprecated Use textEditor_20250728 instead
327
327
  */
328
- textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
328
+ textEditor_20250429: _ai_sdk_provider_utils.ProviderToolFactory<{
329
329
  command: "view" | "create" | "str_replace" | "insert";
330
330
  path: string;
331
331
  file_text?: string;
@@ -347,7 +347,7 @@ declare const anthropicTools: {
347
347
  *
348
348
  * @param maxCharacters - Optional maximum number of characters to view in the file
349
349
  */
350
- textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactory<{
350
+ textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactory<{
351
351
  command: "view" | "create" | "str_replace" | "insert";
352
352
  path: string;
353
353
  file_text?: string;
@@ -377,7 +377,7 @@ declare const anthropicTools: {
377
377
  * @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
378
378
  * @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
379
379
  */
380
- webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
380
+ webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
381
381
  url: string;
382
382
  }, {
383
383
  type: "web_fetch_result";
@@ -440,7 +440,7 @@ declare const anthropicTools: {
440
440
  * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
441
441
  * @param userLocation - Optional user location information to provide geographically relevant search results.
442
442
  */
443
- webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
443
+ webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
444
444
  query: string;
445
445
  }, {
446
446
  type: "web_search_result";
@@ -731,7 +731,7 @@ var textEditor_20250728InputSchema = (0, import_provider_utils4.lazySchema)(
731
731
  })
732
732
  )
733
733
  );
734
- var factory = (0, import_provider_utils3.createProviderDefinedToolFactory)({
734
+ var factory = (0, import_provider_utils3.createProviderToolFactory)({
735
735
  id: "anthropic.text_editor_20250728",
736
736
  inputSchema: textEditor_20250728InputSchema
737
737
  });
@@ -778,7 +778,7 @@ var webSearch_20250305InputSchema = (0, import_provider_utils5.lazySchema)(
778
778
  })
779
779
  )
780
780
  );
781
- var factory2 = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
781
+ var factory2 = (0, import_provider_utils5.createProviderToolFactoryWithOutputSchema)({
782
782
  id: "anthropic.web_search_20250305",
783
783
  inputSchema: webSearch_20250305InputSchema,
784
784
  outputSchema: webSearch_20250305OutputSchema
@@ -834,7 +834,7 @@ var webFetch_20250910InputSchema = (0, import_provider_utils6.lazySchema)(
834
834
  })
835
835
  )
836
836
  );
837
- var factory3 = (0, import_provider_utils6.createProviderDefinedToolFactoryWithOutputSchema)({
837
+ var factory3 = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
838
838
  id: "anthropic.web_fetch_20250910",
839
839
  inputSchema: webFetch_20250910InputSchema,
840
840
  outputSchema: webFetch_20250910OutputSchema
@@ -874,7 +874,7 @@ async function prepareTools({
874
874
  });
875
875
  break;
876
876
  }
877
- case "provider-defined": {
877
+ case "provider": {
878
878
  switch (tool.id) {
879
879
  case "anthropic.code_execution_20250522": {
880
880
  betas.add("code-execution-2025-05-22");
@@ -1112,7 +1112,7 @@ var codeExecution_20250522InputSchema = (0, import_provider_utils8.lazySchema)(
1112
1112
  })
1113
1113
  )
1114
1114
  );
1115
- var factory4 = (0, import_provider_utils8.createProviderDefinedToolFactoryWithOutputSchema)({
1115
+ var factory4 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
1116
1116
  id: "anthropic.code_execution_20250522",
1117
1117
  inputSchema: codeExecution_20250522InputSchema,
1118
1118
  outputSchema: codeExecution_20250522OutputSchema
@@ -1200,7 +1200,7 @@ var codeExecution_20250825InputSchema = (0, import_provider_utils9.lazySchema)(
1200
1200
  ])
1201
1201
  )
1202
1202
  );
1203
- var factory5 = (0, import_provider_utils9.createProviderDefinedToolFactoryWithOutputSchema)({
1203
+ var factory5 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
1204
1204
  id: "anthropic.code_execution_20250825",
1205
1205
  inputSchema: codeExecution_20250825InputSchema,
1206
1206
  outputSchema: codeExecution_20250825OutputSchema
@@ -2077,7 +2077,7 @@ var AnthropicMessagesLanguageModel = class {
2077
2077
  betas.add("skills-2025-10-02");
2078
2078
  betas.add("files-api-2025-04-14");
2079
2079
  if (!(tools == null ? void 0 : tools.some(
2080
- (tool) => tool.type === "provider-defined" && tool.id === "anthropic.code_execution_20250825"
2080
+ (tool) => tool.type === "provider" && tool.id === "anthropic.code_execution_20250825"
2081
2081
  ))) {
2082
2082
  warnings.push({
2083
2083
  type: "other",
@@ -3016,22 +3016,20 @@ var AnthropicMessagesLanguageModel = class {
3016
3016
  );
3017
3017
  const [streamForFirstChunk, streamForConsumer] = transformedStream.tee();
3018
3018
  stream = streamForConsumer;
3019
- const reader = streamForFirstChunk.getReader();
3020
- (async () => {
3019
+ const firstChunkReader = streamForFirstChunk.getReader();
3020
+ try {
3021
+ const { done } = await firstChunkReader.read();
3022
+ if (!done) {
3023
+ firstChunkReader.cancel();
3024
+ }
3025
+ } catch (error) {
3021
3026
  try {
3022
- const { done } = await reader.read();
3023
- if (!done) {
3024
- await reader.cancel();
3025
- }
3026
- } catch (error) {
3027
- try {
3028
- await reader.cancel();
3029
- } catch (e) {
3030
- }
3031
- } finally {
3032
- reader.releaseLock();
3027
+ firstChunkReader.cancel();
3028
+ } catch (e) {
3033
3029
  }
3034
- })();
3030
+ } finally {
3031
+ firstChunkReader.releaseLock();
3032
+ }
3035
3033
  return returnPromise.promise;
3036
3034
  }
3037
3035
  };
@@ -3092,7 +3090,7 @@ var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
3092
3090
  })
3093
3091
  )
3094
3092
  );
3095
- var bash_20241022 = (0, import_provider_utils12.createProviderDefinedToolFactory)({
3093
+ var bash_20241022 = (0, import_provider_utils12.createProviderToolFactory)({
3096
3094
  id: "anthropic.bash_20241022",
3097
3095
  inputSchema: bash_20241022InputSchema
3098
3096
  });
@@ -3108,7 +3106,7 @@ var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
3108
3106
  })
3109
3107
  )
3110
3108
  );
3111
- var bash_20250124 = (0, import_provider_utils13.createProviderDefinedToolFactory)({
3109
+ var bash_20250124 = (0, import_provider_utils13.createProviderToolFactory)({
3112
3110
  id: "anthropic.bash_20250124",
3113
3111
  inputSchema: bash_20250124InputSchema
3114
3112
  });
@@ -3136,7 +3134,7 @@ var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
3136
3134
  })
3137
3135
  )
3138
3136
  );
3139
- var computer_20241022 = (0, import_provider_utils14.createProviderDefinedToolFactory)({
3137
+ var computer_20241022 = (0, import_provider_utils14.createProviderToolFactory)({
3140
3138
  id: "anthropic.computer_20241022",
3141
3139
  inputSchema: computer_20241022InputSchema
3142
3140
  });
@@ -3174,7 +3172,7 @@ var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
3174
3172
  })
3175
3173
  )
3176
3174
  );
3177
- var computer_20250124 = (0, import_provider_utils15.createProviderDefinedToolFactory)({
3175
+ var computer_20250124 = (0, import_provider_utils15.createProviderToolFactory)({
3178
3176
  id: "anthropic.computer_20250124",
3179
3177
  inputSchema: computer_20250124InputSchema
3180
3178
  });
@@ -3219,7 +3217,7 @@ var memory_20250818InputSchema = (0, import_provider_utils16.lazySchema)(
3219
3217
  ])
3220
3218
  )
3221
3219
  );
3222
- var memory_20250818 = (0, import_provider_utils16.createProviderDefinedToolFactory)({
3220
+ var memory_20250818 = (0, import_provider_utils16.createProviderToolFactory)({
3223
3221
  id: "anthropic.memory_20250818",
3224
3222
  inputSchema: memory_20250818InputSchema
3225
3223
  });
@@ -3240,7 +3238,7 @@ var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
3240
3238
  })
3241
3239
  )
3242
3240
  );
3243
- var textEditor_20241022 = (0, import_provider_utils17.createProviderDefinedToolFactory)({
3241
+ var textEditor_20241022 = (0, import_provider_utils17.createProviderToolFactory)({
3244
3242
  id: "anthropic.text_editor_20241022",
3245
3243
  inputSchema: textEditor_20241022InputSchema
3246
3244
  });
@@ -3261,7 +3259,7 @@ var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
3261
3259
  })
3262
3260
  )
3263
3261
  );
3264
- var textEditor_20250124 = (0, import_provider_utils18.createProviderDefinedToolFactory)({
3262
+ var textEditor_20250124 = (0, import_provider_utils18.createProviderToolFactory)({
3265
3263
  id: "anthropic.text_editor_20250124",
3266
3264
  inputSchema: textEditor_20250124InputSchema
3267
3265
  });
@@ -3282,7 +3280,7 @@ var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
3282
3280
  })
3283
3281
  )
3284
3282
  );
3285
- var textEditor_20250429 = (0, import_provider_utils19.createProviderDefinedToolFactory)({
3283
+ var textEditor_20250429 = (0, import_provider_utils19.createProviderToolFactory)({
3286
3284
  id: "anthropic.text_editor_20250429",
3287
3285
  inputSchema: textEditor_20250429InputSchema
3288
3286
  });