@@ -13,6 +13,7 @@ import {
1313 sanitizeToolUseResultPairing ,
1414 sanitizeToolUseResultPairingForModel ,
1515} from "../../session-transcript-repair.js" ;
16+ import { isThinkingLikeBlock } from "../../thinking-block.js" ;
1617import {
1718 extractToolCallsFromAssistant ,
1819 extractToolResultIds ,
@@ -47,14 +48,6 @@ type AnthropicToolResultContentBlock = {
4748 tool_call_id ?: unknown ;
4849} ;
4950
50- function isThinkingLikeReplayBlock ( block : unknown ) : boolean {
51- if ( ! block || typeof block !== "object" ) {
52- return false ;
53- }
54- const type = ( block as { type ?: unknown } ) . type ;
55- return type === "thinking" || type === "redacted_thinking" ;
56- }
57-
5851function isReplaySafeThinkingTurn ( content : unknown [ ] , allowedToolNames ?: Set < string > ) : boolean {
5952 const seenToolCallIds = new Set < string > ( ) ;
6053 for ( const block of content ) {
@@ -164,7 +157,7 @@ function sanitizeReplayToolCallInputs(
164157 }
165158 if (
166159 allowProviderOwnedThinkingReplay &&
167- message . content . some ( ( block ) => isThinkingLikeReplayBlock ( block ) ) &&
160+ message . content . some ( ( block ) => isThinkingLikeBlock ( block ) ) &&
168161 message . content . some ( ( block ) => isReplayToolCallBlock ( block ) )
169162 ) {
170163 const replaySafeToolCalls = extractToolCallsFromAssistant ( message ) ;
@@ -274,7 +267,7 @@ function isSignedThinkingReplayAssistantSpan(message: AgentMessage | undefined):
274267 return false ;
275268 }
276269 return (
277- content . some ( ( block ) => isThinkingLikeReplayBlock ( block ) ) &&
270+ content . some ( ( block ) => isThinkingLikeBlock ( block ) ) &&
278271 content . some ( ( block ) => isReplayToolCallBlock ( block ) )
279272 ) ;
280273}
0 commit comments