( block: unknown, toolName: string | undefined, toolCallId?: string )
| 58 | } |
| 59 | |
| 60 | function isMatchingPendingRenderOnlyToolBlock( |
| 61 | block: unknown, |
| 62 | toolName: string | undefined, |
| 63 | toolCallId?: string |
| 64 | ): block is RenderOnlyToolPendingBlock { |
| 65 | if (!isRecord(block)) return false |
| 66 | const candidate = block as BlockWithTool |
| 67 | if (candidate.type !== 'tool' || !candidate.tool) return false |
| 68 | if (candidate.tool.transient !== true) return false |
| 69 | if (candidate.tool.name !== toolName) return false |
| 70 | if (toolCallId && candidate.tool.toolCallId !== toolCallId) return false |
| 71 | return isRenderOnlyTool(String(candidate.tool.name)) |
| 72 | } |
| 73 | |
| 74 | export function removeRenderOnlyToolPendingBlock<T>( |
| 75 | blocks: readonly T[], |
no test coverage detected