* Enqueue a task notification to the message queue.
(attachment: TaskAttachment)
| 272 | * Enqueue a task notification to the message queue. |
| 273 | */ |
| 274 | function enqueueTaskNotification(attachment: TaskAttachment): void { |
| 275 | const statusText = getStatusText(attachment.status) |
| 276 | |
| 277 | const outputPath = getTaskOutputPath(attachment.taskId) |
| 278 | const toolUseIdLine = attachment.toolUseId |
| 279 | ? `\n<${TOOL_USE_ID_TAG}>${attachment.toolUseId}</${TOOL_USE_ID_TAG}>` |
| 280 | : '' |
| 281 | const message = `<${TASK_NOTIFICATION_TAG}> |
| 282 | <${TASK_ID_TAG}>${attachment.taskId}</${TASK_ID_TAG}>${toolUseIdLine} |
| 283 | <${TASK_TYPE_TAG}>${attachment.taskType}</${TASK_TYPE_TAG}> |
| 284 | <${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}> |
| 285 | <${STATUS_TAG}>${attachment.status}</${STATUS_TAG}> |
| 286 | <${SUMMARY_TAG}>Task "${attachment.description}" ${statusText}</${SUMMARY_TAG}> |
| 287 | </${TASK_NOTIFICATION_TAG}>` |
| 288 | |
| 289 | enqueuePendingNotification({ value: message, mode: 'task-notification' }) |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Get human-readable status text. |
no test coverage detected