( recipientName: string, content: string, summary: string | undefined, context: ToolUseContext, )
| 147 | } |
| 148 | |
| 149 | async function handleMessage( |
| 150 | recipientName: string, |
| 151 | content: string, |
| 152 | summary: string | undefined, |
| 153 | context: ToolUseContext, |
| 154 | ): Promise<{ data: MessageOutput }> { |
| 155 | const appState = context.getAppState() |
| 156 | const teamName = getTeamName(appState.teamContext) |
| 157 | const senderName = |
| 158 | getAgentName() || (isTeammate() ? 'teammate' : TEAM_LEAD_NAME) |
| 159 | const senderColor = getTeammateColor() |
| 160 | |
| 161 | await writeToMailbox( |
| 162 | recipientName, |
| 163 | { |
| 164 | from: senderName, |
| 165 | text: content, |
| 166 | summary, |
| 167 | timestamp: new Date().toISOString(), |
| 168 | color: senderColor, |
| 169 | }, |
| 170 | teamName, |
| 171 | ) |
| 172 | |
| 173 | const recipientColor = findTeammateColor(appState, recipientName) |
| 174 | |
| 175 | return { |
| 176 | data: { |
| 177 | success: true, |
| 178 | message: `Message sent to ${recipientName}'s inbox`, |
| 179 | routing: { |
| 180 | sender: senderName, |
| 181 | senderColor, |
| 182 | target: `@${recipientName}`, |
| 183 | targetColor: recipientColor, |
| 184 | summary, |
| 185 | content, |
| 186 | }, |
| 187 | }, |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | async function handleBroadcast( |
| 192 | content: string, |
no test coverage detected