@ai-sdk/anthropic 4.0.113 → 4.0.115

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 4.0.115
4
+
5
+ ### Patch Changes
6
+
7
+ - 67f696f: Fix streaming failures when resumed Anthropic responses include server tool results in `message_start` content. Process these results like standalone content blocks, preserving tool results and sources.
8
+
9
+ ## 4.0.114
10
+
11
+ ### Patch Changes
12
+
13
+ - 52a423f: Export provider-specific model capability lookup functions with typed model IDs, endpoint-specific capabilities, and provider option descriptions and support, without API requests or configuration.
14
+ - Updated dependencies [52a423f]
15
+ - @ai-sdk/provider-utils@5.0.88
16
+
3
17
  ## 4.0.113
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Experimental_BatchV4, Experimental_DecisionModelV4, Experimental_ExtractionModelV4, FilesV4, JSONObject, LanguageModelV4, ProviderV4, SkillsV4 } from "@ai-sdk/provider";
1
+ import { Experimental_BatchV4, Experimental_DecisionModelV4, Experimental_ExtractionModelV4, FilesV4, JSONObject, LanguageModelV4, ModelCapability, ProviderOptionDefinition, ProviderV4, SkillsV4 } from "@ai-sdk/provider";
2
2
  import { Experimental_SandboxSession, FetchFunction, InferSchema, ProviderDefinedTool, Resolvable, Tool, ToolExecuteFunction } from "@ai-sdk/provider-utils";
3
3
  import { z } from "zod/v4";
4
4
  //#region src/anthropic-api.d.ts
@@ -571,6 +571,7 @@ type AnthropicTextProviderMetadata = {
571
571
  };
572
572
  //#endregion
573
573
  //#region src/anthropic-model-catalog.d.ts
574
+ type AnthropicLanguageProviderOption = keyof AnthropicLanguageModelOptions;
574
575
  /**
575
576
  * Language model matrix: model IDs by capability. To add a model, add a row and
576
577
  * fill in every column.
@@ -1179,6 +1180,57 @@ declare const languageModelDefinitions: {
1179
1180
  taskBudget: "unknown";
1180
1181
  };
1181
1182
  };
1183
+ /**
1184
+ * Returns Messages API catalog metadata, or `undefined` for unlisted IDs.
1185
+ */
1186
+ export declare function anthropicModelCapabilities(modelId: AnthropicModelIds['language'] | (string & {})): {
1187
+ provider: "anthropic";
1188
+ modelId: "claude-opus-5-5" | "claude-opus-5" | "claude-sonnet-5-5" | "claude-sonnet-5" | "claude-haiku-5-5" | "claude-fable-5-2" | "claude-fable-5-1" | "claude-fable-5" | "claude-opus-4-8" | "claude-opus-4-7" | "claude-opus-4-6" | "claude-sonnet-4-6" | "claude-opus-4-5" | "claude-haiku-4-5" | "claude-sonnet-4-5" | "claude-opus-4-1" | "claude-opus-4-0" | "claude-sonnet-4-0" | "claude-3-haiku-20240307" | "claude-haiku-4-5-20251001" | "claude-opus-4-1-20250805" | "claude-opus-4-20250514" | "claude-opus-4-5-20251101" | "claude-sonnet-4-20250514" | "claude-sonnet-4-5-20250929" | (string & {});
1189
+ endpoints: {
1190
+ messages: {
1191
+ operation: "language";
1192
+ capabilities: {
1193
+ reasoning: {
1194
+ support: ModelCapability;
1195
+ efforts?: readonly string[];
1196
+ adaptive: boolean;
1197
+ budget: boolean;
1198
+ canDisable: boolean;
1199
+ canDisableAboveHighEffort: boolean;
1200
+ betweenTools: boolean;
1201
+ };
1202
+ inputs: {
1203
+ readonly image: ModelCapability;
1204
+ readonly audio: ModelCapability;
1205
+ };
1206
+ objectGeneration: ModelCapability;
1207
+ tools: {
1208
+ readonly usage: ModelCapability;
1209
+ readonly streaming: ModelCapability;
1210
+ } & {
1211
+ forcedChoice: boolean;
1212
+ computerUse: ModelCapability;
1213
+ webSearch: ModelCapability;
1214
+ toolSearch: ModelCapability;
1215
+ };
1216
+ sampling: {
1217
+ readonly temperature: ModelCapability;
1218
+ readonly topP: ModelCapability;
1219
+ readonly logprobs: ModelCapability;
1220
+ } & {
1221
+ topK: ModelCapability;
1222
+ };
1223
+ structuredOutput: {
1224
+ native: boolean;
1225
+ };
1226
+ compaction: ModelCapability;
1227
+ };
1228
+ providerOptions: Record<AnthropicLanguageProviderOption, ProviderOptionDefinition & {
1229
+ support: ModelCapability;
1230
+ }>;
1231
+ };
1232
+ };
1233
+ } | undefined;
1182
1234
  /** Known model IDs, derived from the declarations used to build the catalog. */
1183
1235
  type AnthropicModelIds = {
1184
1236
  language: keyof typeof languageModelDefinitions;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["SandboxSession","SandboxSession","_$__tool_computer_toolset_202608010.ComputerToolset_20260801Member","DecisionModelV4","ExtractionModelV4","BatchV4"],"sources":["../src/anthropic-api.ts","../src/anthropic-message-metadata.ts","../src/anthropic-provider-metadata.ts","../src/anthropic-model-catalog.ts","../src/anthropic-language-model-options.ts","../src/anthropic-prepare-tools.ts","../src/tool/computer-toolset_20260801.ts","../src/tool/bash_20241022.ts","../src/tool/bash_20250124.ts","../src/anthropic-tools.ts","../src/anthropic-provider.ts","../src/forward-anthropic-container-id-from-last-step.ts","../src/version.ts"],"mappings":";;;;cAgtBM,sCAA8B,EAAA;;;;;;;;;;GAgBhC,EAAA,KAAA;KAEQ,2BAA2B,EAAE,MACvC,kBAAkB;cA2FP,0DAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqwBxB,WAAW,aACpB,mBAAmB;EAClB;;;;;;;;;;;;;;;;;;;KCnjDQ;EACV;;;;;;EAOA;;;;EAKA;;;;EAKA;;;;EA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;;;;MAHxB;MACA;MAEa;MACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UCAJ,0BAA0B;;;;GAIxC,SAAS,mBAAmB;;;;EAK7B,cAAc,SAAS,mBAAmB;EAE1C,KAAK,SAAS,mBAAmB;EAEjC,SAAS,SAAS,mBAAmB;;EAGrC,cAAc,SAAS,mBAAmBE;;EAE1C,gBAAgB,SAAS,mBAAmBA;IAC1C,YAAYA;;;EAId,gBAAgB,SAAS,mBAAmBC;EAE5C,sBAAsBC;IAAU,MAAM;;;;;EAKtC,mBAAmB;EAEnB,SAAS;;;;EAKT,UAAU;;;;EAKV,cAAc;;UAGC;;EAEf;;IAEE;;;;;;EAOF;;;;;;EAOA;;;;;;;EAQA,YAAY;;;;EAKZ,UAAU;;;;;EAMV,QAAQ;EAER;;;;;EAMA;;;;;wBAMc,gBACd,UAAS,4BACR;;;;qBA6IU,WAAS;;;;;;;;;;wBClRN,0CACd;EAEA,OAAO;IACL,mBAAmB,eAAe;;;EAEpB,kBAAkB,eAAe;;;;qBCdtC"}
1
+ {"version":3,"file":"index.d.ts","names":["SandboxSession","SandboxSession","_$__tool_computer_toolset_202608010.ComputerToolset_20260801Member","DecisionModelV4","ExtractionModelV4","BatchV4"],"sources":["../src/anthropic-api.ts","../src/anthropic-message-metadata.ts","../src/anthropic-provider-metadata.ts","../src/anthropic-model-catalog.ts","../src/anthropic-language-model-options.ts","../src/anthropic-prepare-tools.ts","../src/tool/computer-toolset_20260801.ts","../src/tool/bash_20241022.ts","../src/tool/bash_20250124.ts","../src/anthropic-tools.ts","../src/anthropic-provider.ts","../src/forward-anthropic-container-id-from-last-step.ts","../src/version.ts"],"mappings":";;;;cAgtBM,sCAA8B,EAAA;;;;;;;;;;GAgBhC,EAAA,KAAA;KAEQ,2BAA2B,EAAE,MACvC,kBAAkB;cA2FP,0DAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;wBAMc,gBACd,UAAS,4BACR;;;;qBA6IU,WAAS;;;;;;;;;;wBClRN,0CACd;EAEA,OAAO;IACL,mBAAmB,eAAe;;;EAEpB,kBAAkB,eAAe;;;;qBCdtC"}
package/dist/index.js CHANGED
@@ -823,7 +823,30 @@ const languageModelDefinitions = {
823
823
  const languageModelRows = Object.entries(languageModelDefinitions);
824
824
  /** Entries for every listed model ID, documented or not. */
825
825
  const listedLanguageModelEntries = Object.fromEntries(languageModelRows.map(([modelId, row]) => [modelId, createAnthropicLanguageModelEntry(row)]));
826
- Object.fromEntries(languageModelRows.filter(([, row]) => row.documented).map(([modelId]) => [modelId, listedLanguageModelEntries[modelId]]));
826
+ const anthropicModelCatalog = Object.fromEntries(languageModelRows.filter(([, row]) => row.documented).map(([modelId]) => [modelId, listedLanguageModelEntries[modelId]]));
827
+ /**
828
+ * Returns Messages API catalog metadata, or `undefined` for unlisted IDs.
829
+ */
830
+ function anthropicModelCapabilities(modelId) {
831
+ if (!Object.prototype.hasOwnProperty.call(anthropicModelCatalog, modelId)) return;
832
+ const entry = anthropicModelCatalog[modelId];
833
+ const { supportsXhighEffort: _supportsXhighEffort, ...reasoning } = entry.capabilities.language.reasoning;
834
+ return {
835
+ provider: "anthropic",
836
+ modelId,
837
+ endpoints: { messages: {
838
+ operation: "language",
839
+ capabilities: {
840
+ ...entry.capabilities.language,
841
+ reasoning
842
+ },
843
+ providerOptions: Object.fromEntries(Object.entries(anthropicProviderOptions.language).map(([name, definition]) => [name, {
844
+ ...definition,
845
+ support: entry.providerOptions.language[name]
846
+ }]))
847
+ } }
848
+ };
849
+ }
827
850
  function getAnthropicLanguageModelEntry(modelId) {
828
851
  return Object.prototype.hasOwnProperty.call(listedLanguageModelEntries, modelId) ? listedLanguageModelEntries[modelId] : createAnthropicLanguageModelEntry(getUnlistedModelRow(modelId));
829
852
  }
@@ -1452,6 +1475,169 @@ const anthropicResponseSchema = lazySchema(() => zodSchema(z.object({
1452
1475
  z.object({ type: z.literal("compact_20260112") })
1453
1476
  ])) }).nullish()
1454
1477
  })));
1478
+ function anthropicToolResultSchemas() {
1479
+ return [
1480
+ z.object({
1481
+ type: z.literal("mcp_tool_result"),
1482
+ tool_use_id: z.string(),
1483
+ is_error: z.boolean(),
1484
+ content: anthropicMcpToolResultContentSchema()
1485
+ }),
1486
+ z.object({
1487
+ type: z.literal("web_fetch_tool_result"),
1488
+ tool_use_id: z.string(),
1489
+ caller: anthropicToolCallCallerSchema().optional(),
1490
+ content: z.union([z.object({
1491
+ type: z.literal("web_fetch_result"),
1492
+ url: z.string(),
1493
+ retrieved_at: z.string().nullable(),
1494
+ content: z.object({
1495
+ type: z.literal("document"),
1496
+ title: z.string().nullable(),
1497
+ citations: z.object({ enabled: z.boolean() }).optional(),
1498
+ source: z.union([z.object({
1499
+ type: z.literal("base64"),
1500
+ media_type: z.literal("application/pdf"),
1501
+ data: z.string()
1502
+ }), z.object({
1503
+ type: z.literal("text"),
1504
+ media_type: z.literal("text/plain"),
1505
+ data: z.string()
1506
+ })])
1507
+ })
1508
+ }), z.object({
1509
+ type: z.literal("web_fetch_tool_result_error"),
1510
+ error_code: z.string()
1511
+ })])
1512
+ }),
1513
+ z.object({
1514
+ type: z.literal("web_search_tool_result"),
1515
+ tool_use_id: z.string(),
1516
+ caller: anthropicToolCallCallerSchema().optional(),
1517
+ content: z.union([z.array(z.object({
1518
+ type: z.literal("web_search_result"),
1519
+ url: z.string(),
1520
+ title: z.string().nullable(),
1521
+ encrypted_content: z.string(),
1522
+ page_age: z.string().nullish()
1523
+ })), z.object({
1524
+ type: z.literal("web_search_tool_result_error"),
1525
+ error_code: z.string()
1526
+ })])
1527
+ }),
1528
+ z.object({
1529
+ type: z.literal("code_execution_tool_result"),
1530
+ tool_use_id: z.string(),
1531
+ content: z.union([
1532
+ z.object({
1533
+ type: z.literal("code_execution_result"),
1534
+ stdout: z.string(),
1535
+ stderr: z.string(),
1536
+ return_code: z.number(),
1537
+ content: z.array(z.object({
1538
+ type: z.literal("code_execution_output"),
1539
+ file_id: z.string()
1540
+ })).optional().default([])
1541
+ }),
1542
+ z.object({
1543
+ type: z.literal("encrypted_code_execution_result"),
1544
+ encrypted_stdout: z.string(),
1545
+ stderr: z.string(),
1546
+ return_code: z.number(),
1547
+ content: z.array(z.object({
1548
+ type: z.literal("code_execution_output"),
1549
+ file_id: z.string()
1550
+ })).optional().default([])
1551
+ }),
1552
+ z.object({
1553
+ type: z.literal("code_execution_tool_result_error"),
1554
+ error_code: z.string()
1555
+ })
1556
+ ])
1557
+ }),
1558
+ z.object({
1559
+ type: z.literal("bash_code_execution_tool_result"),
1560
+ tool_use_id: z.string(),
1561
+ content: z.discriminatedUnion("type", [z.object({
1562
+ type: z.literal("bash_code_execution_result"),
1563
+ content: z.array(z.object({
1564
+ type: z.literal("bash_code_execution_output"),
1565
+ file_id: z.string()
1566
+ })),
1567
+ stdout: z.string(),
1568
+ stderr: z.string(),
1569
+ return_code: z.number()
1570
+ }), z.object({
1571
+ type: z.literal("bash_code_execution_tool_result_error"),
1572
+ error_code: z.string()
1573
+ })])
1574
+ }),
1575
+ z.object({
1576
+ type: z.literal("text_editor_code_execution_tool_result"),
1577
+ tool_use_id: z.string(),
1578
+ content: z.discriminatedUnion("type", [
1579
+ z.object({
1580
+ type: z.literal("text_editor_code_execution_tool_result_error"),
1581
+ error_code: z.string()
1582
+ }),
1583
+ z.object({
1584
+ type: z.literal("text_editor_code_execution_view_result"),
1585
+ content: z.string(),
1586
+ file_type: z.string(),
1587
+ num_lines: z.number().nullable(),
1588
+ start_line: z.number().nullable(),
1589
+ total_lines: z.number().nullable()
1590
+ }),
1591
+ z.object({
1592
+ type: z.literal("text_editor_code_execution_create_result"),
1593
+ is_file_update: z.boolean()
1594
+ }),
1595
+ z.object({
1596
+ type: z.literal("text_editor_code_execution_str_replace_result"),
1597
+ lines: z.array(z.string()).nullable(),
1598
+ new_lines: z.number().nullable(),
1599
+ new_start: z.number().nullable(),
1600
+ old_lines: z.number().nullable(),
1601
+ old_start: z.number().nullable()
1602
+ })
1603
+ ])
1604
+ }),
1605
+ z.object({
1606
+ type: z.literal("tool_search_tool_result"),
1607
+ tool_use_id: z.string(),
1608
+ content: z.union([z.object({
1609
+ type: z.literal("tool_search_tool_search_result"),
1610
+ tool_references: z.array(z.object({
1611
+ type: z.literal("tool_reference"),
1612
+ tool_name: z.string()
1613
+ }))
1614
+ }), z.object({
1615
+ type: z.literal("tool_search_tool_result_error"),
1616
+ error_code: z.string()
1617
+ })])
1618
+ }),
1619
+ z.object({
1620
+ type: z.literal("advisor_tool_result"),
1621
+ tool_use_id: z.string(),
1622
+ content: z.discriminatedUnion("type", [
1623
+ z.object({
1624
+ type: z.literal("advisor_result"),
1625
+ text: z.string(),
1626
+ stop_reason: z.string().nullish()
1627
+ }),
1628
+ z.object({
1629
+ type: z.literal("advisor_redacted_result"),
1630
+ encrypted_content: z.string(),
1631
+ stop_reason: z.string().nullish()
1632
+ }),
1633
+ z.object({
1634
+ type: z.literal("advisor_tool_result_error"),
1635
+ error_code: z.string()
1636
+ })
1637
+ ])
1638
+ })
1639
+ ];
1640
+ }
1455
1641
  const anthropicChunkSchema = lazySchema(() => zodSchema(z.discriminatedUnion("type", [
1456
1642
  z.object({
1457
1643
  type: z.literal("message_start"),
@@ -1473,7 +1659,7 @@ const anthropicChunkSchema = lazySchema(() => zodSchema(z.discriminatedUnion("ty
1473
1659
  input: z.unknown(),
1474
1660
  caller: anthropicToolCallCallerSchema().optional(),
1475
1661
  toolset_name: z.string().nullish()
1476
- })])).nullish(),
1662
+ }), ...anthropicToolResultSchemas()])).nullish(),
1477
1663
  stop_reason: z.string().nullish(),
1478
1664
  input_transformations: z.array(anthropicInputTransformationSchema()).nullish(),
1479
1665
  container: z.object({
@@ -1525,165 +1711,7 @@ const anthropicChunkSchema = lazySchema(() => zodSchema(z.discriminatedUnion("ty
1525
1711
  input: z.unknown(),
1526
1712
  server_name: z.string()
1527
1713
  }),
1528
- z.object({
1529
- type: z.literal("mcp_tool_result"),
1530
- tool_use_id: z.string(),
1531
- is_error: z.boolean(),
1532
- content: anthropicMcpToolResultContentSchema()
1533
- }),
1534
- z.object({
1535
- type: z.literal("web_fetch_tool_result"),
1536
- tool_use_id: z.string(),
1537
- caller: anthropicToolCallCallerSchema().optional(),
1538
- content: z.union([z.object({
1539
- type: z.literal("web_fetch_result"),
1540
- url: z.string(),
1541
- retrieved_at: z.string().nullable(),
1542
- content: z.object({
1543
- type: z.literal("document"),
1544
- title: z.string().nullable(),
1545
- citations: z.object({ enabled: z.boolean() }).optional(),
1546
- source: z.union([z.object({
1547
- type: z.literal("base64"),
1548
- media_type: z.literal("application/pdf"),
1549
- data: z.string()
1550
- }), z.object({
1551
- type: z.literal("text"),
1552
- media_type: z.literal("text/plain"),
1553
- data: z.string()
1554
- })])
1555
- })
1556
- }), z.object({
1557
- type: z.literal("web_fetch_tool_result_error"),
1558
- error_code: z.string()
1559
- })])
1560
- }),
1561
- z.object({
1562
- type: z.literal("web_search_tool_result"),
1563
- tool_use_id: z.string(),
1564
- caller: anthropicToolCallCallerSchema().optional(),
1565
- content: z.union([z.array(z.object({
1566
- type: z.literal("web_search_result"),
1567
- url: z.string(),
1568
- title: z.string().nullable(),
1569
- encrypted_content: z.string(),
1570
- page_age: z.string().nullish()
1571
- })), z.object({
1572
- type: z.literal("web_search_tool_result_error"),
1573
- error_code: z.string()
1574
- })])
1575
- }),
1576
- z.object({
1577
- type: z.literal("code_execution_tool_result"),
1578
- tool_use_id: z.string(),
1579
- content: z.union([
1580
- z.object({
1581
- type: z.literal("code_execution_result"),
1582
- stdout: z.string(),
1583
- stderr: z.string(),
1584
- return_code: z.number(),
1585
- content: z.array(z.object({
1586
- type: z.literal("code_execution_output"),
1587
- file_id: z.string()
1588
- })).optional().default([])
1589
- }),
1590
- z.object({
1591
- type: z.literal("encrypted_code_execution_result"),
1592
- encrypted_stdout: z.string(),
1593
- stderr: z.string(),
1594
- return_code: z.number(),
1595
- content: z.array(z.object({
1596
- type: z.literal("code_execution_output"),
1597
- file_id: z.string()
1598
- })).optional().default([])
1599
- }),
1600
- z.object({
1601
- type: z.literal("code_execution_tool_result_error"),
1602
- error_code: z.string()
1603
- })
1604
- ])
1605
- }),
1606
- z.object({
1607
- type: z.literal("bash_code_execution_tool_result"),
1608
- tool_use_id: z.string(),
1609
- content: z.discriminatedUnion("type", [z.object({
1610
- type: z.literal("bash_code_execution_result"),
1611
- content: z.array(z.object({
1612
- type: z.literal("bash_code_execution_output"),
1613
- file_id: z.string()
1614
- })),
1615
- stdout: z.string(),
1616
- stderr: z.string(),
1617
- return_code: z.number()
1618
- }), z.object({
1619
- type: z.literal("bash_code_execution_tool_result_error"),
1620
- error_code: z.string()
1621
- })])
1622
- }),
1623
- z.object({
1624
- type: z.literal("text_editor_code_execution_tool_result"),
1625
- tool_use_id: z.string(),
1626
- content: z.discriminatedUnion("type", [
1627
- z.object({
1628
- type: z.literal("text_editor_code_execution_tool_result_error"),
1629
- error_code: z.string()
1630
- }),
1631
- z.object({
1632
- type: z.literal("text_editor_code_execution_view_result"),
1633
- content: z.string(),
1634
- file_type: z.string(),
1635
- num_lines: z.number().nullable(),
1636
- start_line: z.number().nullable(),
1637
- total_lines: z.number().nullable()
1638
- }),
1639
- z.object({
1640
- type: z.literal("text_editor_code_execution_create_result"),
1641
- is_file_update: z.boolean()
1642
- }),
1643
- z.object({
1644
- type: z.literal("text_editor_code_execution_str_replace_result"),
1645
- lines: z.array(z.string()).nullable(),
1646
- new_lines: z.number().nullable(),
1647
- new_start: z.number().nullable(),
1648
- old_lines: z.number().nullable(),
1649
- old_start: z.number().nullable()
1650
- })
1651
- ])
1652
- }),
1653
- z.object({
1654
- type: z.literal("tool_search_tool_result"),
1655
- tool_use_id: z.string(),
1656
- content: z.union([z.object({
1657
- type: z.literal("tool_search_tool_search_result"),
1658
- tool_references: z.array(z.object({
1659
- type: z.literal("tool_reference"),
1660
- tool_name: z.string()
1661
- }))
1662
- }), z.object({
1663
- type: z.literal("tool_search_tool_result_error"),
1664
- error_code: z.string()
1665
- })])
1666
- }),
1667
- z.object({
1668
- type: z.literal("advisor_tool_result"),
1669
- tool_use_id: z.string(),
1670
- content: z.discriminatedUnion("type", [
1671
- z.object({
1672
- type: z.literal("advisor_result"),
1673
- text: z.string(),
1674
- stop_reason: z.string().nullish()
1675
- }),
1676
- z.object({
1677
- type: z.literal("advisor_redacted_result"),
1678
- encrypted_content: z.string(),
1679
- stop_reason: z.string().nullish()
1680
- }),
1681
- z.object({
1682
- type: z.literal("advisor_tool_result_error"),
1683
- error_code: z.string()
1684
- })
1685
- ])
1686
- }),
1714
+ ...anthropicToolResultSchemas(),
1687
1715
  anthropicFallbackContentSchema()
1688
1716
  ])
1689
1717
  }),
@@ -3763,12 +3791,10 @@ async function convertToAnthropicPrompt({ prompt, sendReasoning, warnings, cache
3763
3791
  });
3764
3792
  return;
3765
3793
  }
3766
- default:
3767
- warnings.push({
3768
- type: "other",
3769
- message: `unsupported tool content part type: ${contentPart.type}`
3770
- });
3771
- return;
3794
+ default: warnings.push({
3795
+ type: "other",
3796
+ message: `unsupported tool content part type: ${contentPart.type}`
3797
+ });
3772
3798
  }
3773
3799
  }).filter(isNonNullable);
3774
3800
  break;
@@ -5266,12 +5292,10 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
5266
5292
  ...edit.pauseAfterCompaction !== void 0 && { pause_after_compaction: edit.pauseAfterCompaction },
5267
5293
  ...edit.instructions !== void 0 && { instructions: edit.instructions }
5268
5294
  };
5269
- default:
5270
- warnings.push({
5271
- type: "other",
5272
- message: `Unknown context management strategy: ${strategy}`
5273
- });
5274
- return;
5295
+ default: warnings.push({
5296
+ type: "other",
5297
+ message: `Unknown context management strategy: ${strategy}`
5298
+ });
5275
5299
  }
5276
5300
  }).filter((edit) => edit !== void 0) } }
5277
5301
  };
@@ -5956,9 +5980,9 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
5956
5980
  warnings
5957
5981
  });
5958
5982
  },
5959
- transform(chunk, controller) {
5983
+ transform: function transformChunk(chunk, controller, emitRawChunks = true) {
5960
5984
  if (hasInvalidMessageSequence) return;
5961
- if (options.includeRawChunks) controller.enqueue({
5985
+ if (options.includeRawChunks && emitRawChunks) controller.enqueue({
5962
5986
  type: "raw",
5963
5987
  rawValue: chunk.rawValue
5964
5988
  });
@@ -6606,7 +6630,15 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
6606
6630
  input: inputStr,
6607
6631
  ...callerInfo && { providerMetadata: { anthropic: { caller: callerInfo } } }
6608
6632
  });
6609
- }
6633
+ } else transformChunk({
6634
+ success: true,
6635
+ value: {
6636
+ type: "content_block_start",
6637
+ index: contentIndex,
6638
+ content_block: part
6639
+ },
6640
+ rawValue: part
6641
+ }, controller, false);
6610
6642
  }
6611
6643
  return;
6612
6644
  case "message_delta":
@@ -8293,7 +8325,7 @@ var AnthropicSkills = class {
8293
8325
  };
8294
8326
  //#endregion
8295
8327
  //#region src/version.ts
8296
- const VERSION = "4.0.113";
8328
+ const VERSION = "4.0.115";
8297
8329
  //#endregion
8298
8330
  //#region src/anthropic-provider.ts
8299
8331
  const ANTHROPIC_API_URL = "https://api.anthropic.com";
@@ -8421,6 +8453,6 @@ function forwardAnthropicContainerIdFromLastStep({ steps }) {
8421
8453
  }
8422
8454
  }
8423
8455
  //#endregion
8424
- export { VERSION, anthropic, createAnthropic, forwardAnthropicContainerIdFromLastStep };
8456
+ export { VERSION, anthropic, anthropicModelCapabilities, createAnthropic, forwardAnthropicContainerIdFromLastStep };
8425
8457
 
8426
8458
  //# sourceMappingURL=index.js.map