@ai-sdk/anthropic 4.0.114 → 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,11 @@
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
+
3
9
  ## 4.0.114
4
10
 
5
11
  ### Patch Changes
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAQP;MACF;MACJ;MAEwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAJlB;MACF;MACJ;MAEwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0wBxB,WAAW,aACpB,mBAAmB;EAClB;;;;;;;;;;;;;;;;;;;KCxjDQ;EACV;;;;;;EAOA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;UAGe;EACf,OAAO;EACP;;EAGA;;;;;;;EAQA,uBAAuB;IACrB;IACA;IACA;;;;;;;;;;;;;EAcF,mBAAmB;;;;;;;;;;EAWnB;;;;;IAKE;;;;;IAMA;;;;;IAMA;;;;;;IAOA;;;;;;;;;EAUF,YAAY;;;;;;;EAQZ;;;;IAIE;;;;IAKA;;;;IAKA,QAAQ;;;;MAIN;;;;MAKA;;;;MAKA;;;;;;;;EASJ;;;;;IAKE,cAAc;;;;;;;;;MASR;;;;;MAMA;;;;;MAMA;;;;;;;;;;MAUA;;;;;MAMA;;;;;MAMA;;;;;;;;;;MAUA;;;;;;;;;KC9NE,oBAAo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AAmB;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"}
package/dist/index.js CHANGED
@@ -1475,6 +1475,169 @@ const anthropicResponseSchema = lazySchema(() => zodSchema(z.object({
1475
1475
  z.object({ type: z.literal("compact_20260112") })
1476
1476
  ])) }).nullish()
1477
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
+ }
1478
1641
  const anthropicChunkSchema = lazySchema(() => zodSchema(z.discriminatedUnion("type", [
1479
1642
  z.object({
1480
1643
  type: z.literal("message_start"),
@@ -1496,7 +1659,7 @@ const anthropicChunkSchema = lazySchema(() => zodSchema(z.discriminatedUnion("ty
1496
1659
  input: z.unknown(),
1497
1660
  caller: anthropicToolCallCallerSchema().optional(),
1498
1661
  toolset_name: z.string().nullish()
1499
- })])).nullish(),
1662
+ }), ...anthropicToolResultSchemas()])).nullish(),
1500
1663
  stop_reason: z.string().nullish(),
1501
1664
  input_transformations: z.array(anthropicInputTransformationSchema()).nullish(),
1502
1665
  container: z.object({
@@ -1548,165 +1711,7 @@ const anthropicChunkSchema = lazySchema(() => zodSchema(z.discriminatedUnion("ty
1548
1711
  input: z.unknown(),
1549
1712
  server_name: z.string()
1550
1713
  }),
1551
- z.object({
1552
- type: z.literal("mcp_tool_result"),
1553
- tool_use_id: z.string(),
1554
- is_error: z.boolean(),
1555
- content: anthropicMcpToolResultContentSchema()
1556
- }),
1557
- z.object({
1558
- type: z.literal("web_fetch_tool_result"),
1559
- tool_use_id: z.string(),
1560
- caller: anthropicToolCallCallerSchema().optional(),
1561
- content: z.union([z.object({
1562
- type: z.literal("web_fetch_result"),
1563
- url: z.string(),
1564
- retrieved_at: z.string().nullable(),
1565
- content: z.object({
1566
- type: z.literal("document"),
1567
- title: z.string().nullable(),
1568
- citations: z.object({ enabled: z.boolean() }).optional(),
1569
- source: z.union([z.object({
1570
- type: z.literal("base64"),
1571
- media_type: z.literal("application/pdf"),
1572
- data: z.string()
1573
- }), z.object({
1574
- type: z.literal("text"),
1575
- media_type: z.literal("text/plain"),
1576
- data: z.string()
1577
- })])
1578
- })
1579
- }), z.object({
1580
- type: z.literal("web_fetch_tool_result_error"),
1581
- error_code: z.string()
1582
- })])
1583
- }),
1584
- z.object({
1585
- type: z.literal("web_search_tool_result"),
1586
- tool_use_id: z.string(),
1587
- caller: anthropicToolCallCallerSchema().optional(),
1588
- content: z.union([z.array(z.object({
1589
- type: z.literal("web_search_result"),
1590
- url: z.string(),
1591
- title: z.string().nullable(),
1592
- encrypted_content: z.string(),
1593
- page_age: z.string().nullish()
1594
- })), z.object({
1595
- type: z.literal("web_search_tool_result_error"),
1596
- error_code: z.string()
1597
- })])
1598
- }),
1599
- z.object({
1600
- type: z.literal("code_execution_tool_result"),
1601
- tool_use_id: z.string(),
1602
- content: z.union([
1603
- z.object({
1604
- type: z.literal("code_execution_result"),
1605
- stdout: z.string(),
1606
- stderr: z.string(),
1607
- return_code: z.number(),
1608
- content: z.array(z.object({
1609
- type: z.literal("code_execution_output"),
1610
- file_id: z.string()
1611
- })).optional().default([])
1612
- }),
1613
- z.object({
1614
- type: z.literal("encrypted_code_execution_result"),
1615
- encrypted_stdout: z.string(),
1616
- stderr: z.string(),
1617
- return_code: z.number(),
1618
- content: z.array(z.object({
1619
- type: z.literal("code_execution_output"),
1620
- file_id: z.string()
1621
- })).optional().default([])
1622
- }),
1623
- z.object({
1624
- type: z.literal("code_execution_tool_result_error"),
1625
- error_code: z.string()
1626
- })
1627
- ])
1628
- }),
1629
- z.object({
1630
- type: z.literal("bash_code_execution_tool_result"),
1631
- tool_use_id: z.string(),
1632
- content: z.discriminatedUnion("type", [z.object({
1633
- type: z.literal("bash_code_execution_result"),
1634
- content: z.array(z.object({
1635
- type: z.literal("bash_code_execution_output"),
1636
- file_id: z.string()
1637
- })),
1638
- stdout: z.string(),
1639
- stderr: z.string(),
1640
- return_code: z.number()
1641
- }), z.object({
1642
- type: z.literal("bash_code_execution_tool_result_error"),
1643
- error_code: z.string()
1644
- })])
1645
- }),
1646
- z.object({
1647
- type: z.literal("text_editor_code_execution_tool_result"),
1648
- tool_use_id: z.string(),
1649
- content: z.discriminatedUnion("type", [
1650
- z.object({
1651
- type: z.literal("text_editor_code_execution_tool_result_error"),
1652
- error_code: z.string()
1653
- }),
1654
- z.object({
1655
- type: z.literal("text_editor_code_execution_view_result"),
1656
- content: z.string(),
1657
- file_type: z.string(),
1658
- num_lines: z.number().nullable(),
1659
- start_line: z.number().nullable(),
1660
- total_lines: z.number().nullable()
1661
- }),
1662
- z.object({
1663
- type: z.literal("text_editor_code_execution_create_result"),
1664
- is_file_update: z.boolean()
1665
- }),
1666
- z.object({
1667
- type: z.literal("text_editor_code_execution_str_replace_result"),
1668
- lines: z.array(z.string()).nullable(),
1669
- new_lines: z.number().nullable(),
1670
- new_start: z.number().nullable(),
1671
- old_lines: z.number().nullable(),
1672
- old_start: z.number().nullable()
1673
- })
1674
- ])
1675
- }),
1676
- z.object({
1677
- type: z.literal("tool_search_tool_result"),
1678
- tool_use_id: z.string(),
1679
- content: z.union([z.object({
1680
- type: z.literal("tool_search_tool_search_result"),
1681
- tool_references: z.array(z.object({
1682
- type: z.literal("tool_reference"),
1683
- tool_name: z.string()
1684
- }))
1685
- }), z.object({
1686
- type: z.literal("tool_search_tool_result_error"),
1687
- error_code: z.string()
1688
- })])
1689
- }),
1690
- z.object({
1691
- type: z.literal("advisor_tool_result"),
1692
- tool_use_id: z.string(),
1693
- content: z.discriminatedUnion("type", [
1694
- z.object({
1695
- type: z.literal("advisor_result"),
1696
- text: z.string(),
1697
- stop_reason: z.string().nullish()
1698
- }),
1699
- z.object({
1700
- type: z.literal("advisor_redacted_result"),
1701
- encrypted_content: z.string(),
1702
- stop_reason: z.string().nullish()
1703
- }),
1704
- z.object({
1705
- type: z.literal("advisor_tool_result_error"),
1706
- error_code: z.string()
1707
- })
1708
- ])
1709
- }),
1714
+ ...anthropicToolResultSchemas(),
1710
1715
  anthropicFallbackContentSchema()
1711
1716
  ])
1712
1717
  }),
@@ -5975,9 +5980,9 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
5975
5980
  warnings
5976
5981
  });
5977
5982
  },
5978
- transform(chunk, controller) {
5983
+ transform: function transformChunk(chunk, controller, emitRawChunks = true) {
5979
5984
  if (hasInvalidMessageSequence) return;
5980
- if (options.includeRawChunks) controller.enqueue({
5985
+ if (options.includeRawChunks && emitRawChunks) controller.enqueue({
5981
5986
  type: "raw",
5982
5987
  rawValue: chunk.rawValue
5983
5988
  });
@@ -6625,7 +6630,15 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
6625
6630
  input: inputStr,
6626
6631
  ...callerInfo && { providerMetadata: { anthropic: { caller: callerInfo } } }
6627
6632
  });
6628
- }
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);
6629
6642
  }
6630
6643
  return;
6631
6644
  case "message_delta":
@@ -8312,7 +8325,7 @@ var AnthropicSkills = class {
8312
8325
  };
8313
8326
  //#endregion
8314
8327
  //#region src/version.ts
8315
- const VERSION = "4.0.114";
8328
+ const VERSION = "4.0.115";
8316
8329
  //#endregion
8317
8330
  //#region src/anthropic-provider.ts
8318
8331
  const ANTHROPIC_API_URL = "https://api.anthropic.com";