(toolBlock: ToolContentBlock)
| 217 | * Extract file path from tool block. |
| 218 | */ |
| 219 | export function extractFilePath(toolBlock: ToolContentBlock): string | null { |
| 220 | const outputStr = typeof toolBlock.output === 'string' ? toolBlock.output : '' |
| 221 | const input = toolBlock.input as Record<string, unknown> |
| 222 | |
| 223 | return ( |
| 224 | extractValueForKey(outputStr, 'file') || |
| 225 | (typeof input?.path === 'string' ? input.path : null) || |
| 226 | (typeof input?.file_path === 'string' ? input.file_path : null) |
| 227 | ) |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * Extract unified diff from tool output, or construct from input. |
no test coverage detected