@@ -1680,6 +1680,25 @@ describe("ProviderTransform.message - anthropic empty content filtering", () =>
16801680 ] )
16811681 } )
16821682
1683+ test ( "leaves signed anthropic reasoning after tool calls unchanged" , ( ) => {
1684+ const msgs = [
1685+ {
1686+ role : "assistant" ,
1687+ content : [
1688+ { type : "reasoning" , text : "First thought" , providerOptions : { anthropic : { signature : "sig-1" } } } ,
1689+ { type : "tool-call" , toolCallId : "toolu_1" , toolName : "read" , input : { filePath : "/root" } } ,
1690+ { type : "reasoning" , text : "Second thought" , providerOptions : { anthropic : { signature : "sig-2" } } } ,
1691+ { type : "tool-call" , toolCallId : "toolu_2" , toolName : "glob" , input : { pattern : "**/*.pdf" } } ,
1692+ ] ,
1693+ } ,
1694+ ] as any [ ]
1695+
1696+ const result = ProviderTransform . message ( msgs , anthropicModel , { } ) as any [ ]
1697+
1698+ expect ( result ) . toHaveLength ( 1 )
1699+ expect ( result [ 0 ] . content ) . toMatchObject ( msgs [ 0 ] . content )
1700+ } )
1701+
16831702 test ( "splits vertex anthropic assistant messages when text trails tool calls" , ( ) => {
16841703 const model = {
16851704 ...anthropicModel ,
@@ -1717,6 +1736,34 @@ describe("ProviderTransform.message - anthropic empty content filtering", () =>
17171736 ] ,
17181737 } )
17191738 } )
1739+
1740+ test ( "leaves redacted vertex anthropic reasoning after tool calls unchanged" , ( ) => {
1741+ const model = {
1742+ ...anthropicModel ,
1743+ providerID : "google-vertex-anthropic" ,
1744+ api : {
1745+ id : "claude-sonnet-4@20250514" ,
1746+ url : "https://us-central1-aiplatform.googleapis.com" ,
1747+ npm : "@ai-sdk/google-vertex/anthropic" ,
1748+ } ,
1749+ }
1750+
1751+ const msgs = [
1752+ {
1753+ role : "assistant" ,
1754+ content : [
1755+ { type : "tool-call" , toolCallId : "toolu_1" , toolName : "read" , input : { filePath : "/root" } } ,
1756+ { type : "reasoning" , text : "" , providerOptions : { anthropic : { redactedData : "redacted-1" } } } ,
1757+ { type : "tool-call" , toolCallId : "toolu_2" , toolName : "glob" , input : { pattern : "**/*.pdf" } } ,
1758+ ] ,
1759+ } ,
1760+ ] as any [ ]
1761+
1762+ const result = ProviderTransform . message ( msgs , model , { } ) as any [ ]
1763+
1764+ expect ( result ) . toHaveLength ( 1 )
1765+ expect ( result [ 0 ] . content ) . toMatchObject ( msgs [ 0 ] . content )
1766+ } )
17201767} )
17211768
17221769describe ( "ProviderTransform.message - strip openai metadata when store=false" , ( ) => {
0 commit comments