()
| 186 | } |
| 187 | |
| 188 | const fetchAttachments = async () => { |
| 189 | let attachments: AgentMailAttachment[] = [] |
| 190 | if (inboxTask.hasAttachments && ws.inboxProviderId && inboxTask.agentmailMessageId) { |
| 191 | try { |
| 192 | const fullMessage = await agentmail.getMessage( |
| 193 | ws.inboxProviderId, |
| 194 | inboxTask.agentmailMessageId |
| 195 | ) |
| 196 | attachments = fullMessage.attachments || [] |
| 197 | } catch (attachErr) { |
| 198 | logger.warn('Failed to fetch attachment metadata', { taskId, attachErr }) |
| 199 | } |
| 200 | } |
| 201 | const downloaded = await downloadAttachmentContents( |
| 202 | attachments, |
| 203 | ws.inboxProviderId, |
| 204 | inboxTask.agentmailMessageId, |
| 205 | taskId, |
| 206 | userId |
| 207 | ) |
| 208 | return { attachments, ...downloaded } |
| 209 | } |
| 210 | |
| 211 | const [attachmentResult, workspaceContext, integrationTools, userSkillTool, userPermission] = |
| 212 | await Promise.all([ |
no test coverage detected