MCPcopy Index your code
hub / github.com/codeaashu/claude-code / clearMailbox

Function clearMailbox

src/utils/teammateMailbox.ts:349–368  ·  view source on GitHub ↗
(
  agentName: string,
  teamName?: string,
)

Source from the content-addressed store, hash-verified

347 * @param teamName - Optional team name
348 */
349export 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

Callers

nothing calls this directly

Calls 4

getInboxPathFunction · 0.85
logForDebuggingFunction · 0.85
getErrnoCodeFunction · 0.85
logErrorFunction · 0.70

Tested by

no test coverage detected