( recipientName: string, content: string, summary: string | undefined, context: ToolUseContext, )
| 193 | } |
| 194 | |
| 195 | async function handleMessage( |
| 196 | recipientName: string, |
| 197 | content: string, |
| 198 | summary: string | undefined, |
| 199 | context: ToolUseContext, |
| 200 | ): Promise<{ data: MessageOutput }> { |
| 201 | const appState = context.getAppState() |
| 202 | const teamName = getTeamName(appState.teamContext) |
| 203 | const senderName = |
| 204 | getAgentName() || (isTeammate() ? 'teammate' : TEAM_LEAD_NAME) |
| 205 | const senderColor = getTeammateColor() |
| 206 | |
| 207 | await writeToMailbox( |
| 208 | recipientName, |
| 209 | { |
| 210 | from: senderName, |
| 211 | text: content, |
| 212 | summary, |
| 213 | timestamp: new Date().toISOString(), |
| 214 | color: senderColor, |
| 215 | }, |
| 216 | teamName, |
| 217 | ) |
| 218 | |
| 219 | const recipientColor = findTeammateColor(appState, recipientName) |
| 220 | |
| 221 | return { |
| 222 | data: { |
| 223 | success: true, |
| 224 | message: `Message sent to ${recipientName}'s inbox`, |
| 225 | routing: { |
| 226 | sender: senderName, |
| 227 | senderColor, |
| 228 | target: `@${recipientName}`, |
| 229 | targetColor: recipientColor, |
| 230 | summary, |
| 231 | content, |
| 232 | }, |
| 233 | }, |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | async function handleBroadcast( |
| 238 | content: string, |
no test coverage detected