* Check if a file path is an agent output file and extract the task ID. * Agent output files follow the pattern: {projectTempDir}/tasks/{taskId}.output
(filePath: string)
| 16 | * Agent output files follow the pattern: {projectTempDir}/tasks/{taskId}.output |
| 17 | */ |
| 18 | function getAgentOutputTaskId(filePath: string): string | null { |
| 19 | const prefix = `${getTaskOutputDir()}/`; |
| 20 | const suffix = '.output'; |
| 21 | if (filePath.startsWith(prefix) && filePath.endsWith(suffix)) { |
| 22 | const taskId = filePath.slice(prefix.length, -suffix.length); |
| 23 | // Validate it looks like a task ID (alphanumeric, reasonable length) |
| 24 | if (taskId.length > 0 && taskId.length <= 20 && /^[a-zA-Z0-9_-]+$/.test(taskId)) { |
| 25 | return taskId; |
| 26 | } |
| 27 | } |
| 28 | return null; |
| 29 | } |
| 30 | export function renderToolUseMessage({ |
| 31 | file_path, |
| 32 | offset, |
no test coverage detected