( agentName: string, teamName?: string, )
| 347 | * @param teamName - Optional team name |
| 348 | */ |
| 349 | export async function clearMailbox( |
| 350 | agentName: string, |
| 351 | teamName?: string, |
| 352 | ): Promise<void> { |
| 353 | const inboxPath = getInboxPath(agentName, teamName) |
| 354 | |
| 355 | try { |
| 356 | // flag 'r+' throws ENOENT if the file doesn't exist, so we don't |
| 357 | // accidentally create an inbox file that wasn't there. |
| 358 | await writeFile(inboxPath, '[]', { encoding: 'utf-8', flag: 'r+' }) |
| 359 | logForDebugging(`[TeammateMailbox] Cleared inbox for ${agentName}`) |
| 360 | } catch (error) { |
| 361 | const code = getErrnoCode(error) |
| 362 | if (code === 'ENOENT') { |
| 363 | return |
| 364 | } |
| 365 | logForDebugging(`Failed to clear inbox for ${agentName}: ${error}`) |
| 366 | logError(error) |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * Format teammate messages as XML for attachment display |
nothing calls this directly
no test coverage detected