@ai-sdk/anthropic 4.0.59 → 4.0.60

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.
@@ -134,6 +134,11 @@ interface AnthropicToolCallContent {
134
134
  * (e.g., code execution calling a user-defined tool programmatically).
135
135
  */
136
136
  caller?: AnthropicToolCallCaller;
137
+ /**
138
+ * Present when this tool call is a member call of a toolset
139
+ * (e.g. `computer` for the computer toolset). `name` is then the member name.
140
+ */
141
+ toolset_name?: string;
137
142
  cache_control: AnthropicCacheControl | undefined;
138
143
  }
139
144
  interface AnthropicServerToolUseContent {
@@ -160,6 +165,10 @@ interface AnthropicToolReferenceContent {
160
165
  interface AnthropicToolResultContent {
161
166
  type: 'tool_result';
162
167
  tool_use_id: string;
168
+ /**
169
+ * Required for results of toolset member calls (e.g. `computer`).
170
+ */
171
+ toolset_name?: string;
163
172
  content: string | Array<AnthropicNestedTextContent | AnthropicNestedImageContent | AnthropicNestedDocumentContent | AnthropicToolReferenceContent>;
164
173
  is_error: boolean | undefined;
165
174
  cache_control: AnthropicCacheControl | undefined;
@@ -382,6 +391,17 @@ type AnthropicTool = {
382
391
  display_number: number;
383
392
  enable_zoom?: boolean;
384
393
  cache_control: AnthropicCacheControl | undefined;
394
+ } | {
395
+ /**
396
+ * Computer toolset. Declared without a `name`; the API returns member
397
+ * tool calls (e.g. `left_click`) with `toolset_name: 'computer'`.
398
+ */
399
+ type: 'computer_toolset_20260801';
400
+ configs?: Record<string, {
401
+ enabled?: boolean;
402
+ defer_loading?: boolean;
403
+ }>;
404
+ cache_control: AnthropicCacheControl | undefined;
385
405
  } | {
386
406
  name: string;
387
407
  type: 'text_editor_20250124' | 'text_editor_20241022' | 'text_editor_20250429';
@@ -519,6 +539,7 @@ declare const anthropicResponseSchema: _ai_sdk_provider_utils.LazySchema<{
519
539
  } | {
520
540
  type: "direct";
521
541
  } | undefined;
542
+ toolset_name?: string | null | undefined;
522
543
  } | {
523
544
  type: "server_tool_use";
524
545
  id: string;
@@ -776,7 +797,7 @@ type Citation = NonNullable<(InferSchema<typeof anthropicResponseSchema>['conten
776
797
  type: 'text';
777
798
  })['citations']>[number];
778
799
 
779
- type AnthropicModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | (string & {});
800
+ type AnthropicModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | (string & {});
780
801
 
781
802
  type AnthropicLanguageModelConfig = {
782
803
  provider: string;
@@ -952,9 +973,26 @@ declare function getModelCapabilities(modelId: string): {
952
973
  rejectsSamplingParameters: boolean;
953
974
  supportsXhighEffort: boolean;
954
975
  rejectsThinkingDisabledAboveHighEffort: boolean;
976
+ /**
977
+ * Thinking is always adaptive: `thinking.type` `disabled` and `enabled`
978
+ * are rejected with a 400.
979
+ */
980
+ rejectsThinkingDisabled: boolean;
981
+ /**
982
+ * Forced tool use (`tool_choice` `any` or a named tool) is rejected with a 400.
983
+ */
984
+ rejectsForcedToolUse: boolean;
955
985
  isKnownModel: boolean;
956
986
  };
957
987
 
988
+ /**
989
+ * Member tools of the computer toolset. Each member is returned by the API as
990
+ * its own `tool_use` block; the AI SDK exposes it as the `action` of a single
991
+ * computer tool call.
992
+ */
993
+ declare const computerToolset_20260801Members: readonly ["screenshot", "zoom", "left_click", "right_click", "middle_click", "double_click", "triple_click", "left_click_drag", "mouse_move", "left_mouse_down", "left_mouse_up", "cursor_position", "scroll", "type", "key", "hold_key", "wait"];
994
+ type ComputerToolset_20260801Member = (typeof computerToolset_20260801Members)[number];
995
+
958
996
  type Bash20241022Input = {
959
997
  /**
960
998
  * The bash command to run. Required unless the tool is being restarted.
@@ -1482,6 +1520,44 @@ declare const anthropicTools: {
1482
1520
  displayNumber?: number;
1483
1521
  enableZoom?: boolean;
1484
1522
  }, {}>;
1523
+ /**
1524
+ * The computer toolset lets Claude control a computer through screenshots,
1525
+ * mouse, and keyboard. It replaces the versioned computer tools
1526
+ * (`computer_20251124` and earlier) on newer models.
1527
+ *
1528
+ * The API returns each computer action as its own `tool_use` block with
1529
+ * `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
1530
+ * and exposes the member name as `action`, so `execute` receives the same
1531
+ * input shape as the older computer tools. Claude may return several actions
1532
+ * in one turn.
1533
+ *
1534
+ * Coordinates are always in the pixel space of the screenshots you return;
1535
+ * there are no display size parameters. Zoom is enabled by default.
1536
+ *
1537
+ * Does not require a beta header.
1538
+ *
1539
+ * Supported models: Claude Opus 5.5 (required; older computer tool types
1540
+ * are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
1541
+ *
1542
+ * @param configs - Per-member settings keyed by member name, e.g.
1543
+ * `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
1544
+ */
1545
+ computerToolset_20260801: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
1546
+ action: ComputerToolset_20260801Member;
1547
+ coordinate?: [number, number];
1548
+ duration?: number;
1549
+ region?: [number, number, number, number];
1550
+ repeat?: number;
1551
+ scroll_amount?: number;
1552
+ scroll_direction?: "up" | "down" | "left" | "right";
1553
+ start_coordinate?: [number, number];
1554
+ text?: string;
1555
+ }, {
1556
+ configs?: Partial<Record<ComputerToolset_20260801Member, {
1557
+ enabled?: boolean;
1558
+ deferLoading?: boolean;
1559
+ }>>;
1560
+ }, {}>;
1485
1561
  /**
1486
1562
  * The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
1487
1563
  * Claude can create, read, update, and delete files that persist between sessions,
@@ -1965,7 +2041,7 @@ declare class CacheControlValidator {
1965
2041
  getWarnings(): SharedV4Warning[];
1966
2042
  }
1967
2043
 
1968
- declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, supportsStrictTools, defaultEagerInputStreaming, }: {
2044
+ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, supportsStrictTools, defaultEagerInputStreaming, rejectsForcedToolUse, }: {
1969
2045
  tools: LanguageModelV4CallOptions['tools'];
1970
2046
  toolChoice: LanguageModelV4CallOptions['toolChoice'] | undefined;
1971
2047
  disableParallelToolUse?: boolean;
@@ -1983,6 +2059,12 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
1983
2059
  * it explicitly. Driven by the model-level `toolStreaming` option.
1984
2060
  */
1985
2061
  defaultEagerInputStreaming?: boolean;
2062
+ /**
2063
+ * Whether the model rejects forced tool use (`tool_choice` `any` or a
2064
+ * named tool). When true, `required` and `tool` tool choices fall back to
2065
+ * `auto` with a warning.
2066
+ */
2067
+ rejectsForcedToolUse?: boolean;
1986
2068
  }): Promise<{
1987
2069
  tools: Array<AnthropicTool> | undefined;
1988
2070
  toolChoice: AnthropicToolChoice | undefined;