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

Function sendShutdownRequestToMailbox

src/utils/teammateMailbox.ts:831–863  ·  view source on GitHub ↗
(
  targetName: string,
  teamName?: string,
  reason?: string,
)

Source from the content-addressed store, hash-verified

829 * @returns The request ID and target name
830 */
831export async function sendShutdownRequestToMailbox(
832 targetName: string,
833 teamName?: string,
834 reason?: string,
835): Promise<{ requestId: string; target: string }> {
836 const resolvedTeamName = teamName || getTeamName()
837
838 // Get sender name (supports in-process teammates via AsyncLocalStorage)
839 const senderName = getAgentName() || TEAM_LEAD_NAME
840
841 // Generate a deterministic request ID for this shutdown request
842 const requestId = generateRequestId('shutdown', targetName)
843
844 // Create and send the shutdown request message
845 const shutdownMessage = createShutdownRequestMessage({
846 requestId,
847 from: senderName,
848 reason,
849 })
850
851 await writeToMailbox(
852 targetName,
853 {
854 from: senderName,
855 text: jsonStringify(shutdownMessage),
856 timestamp: new Date().toISOString(),
857 color: getTeammateColor(),
858 },
859 resolvedTeamName,
860 )
861
862 return { requestId, target: targetName }
863}
864
865/**
866 * Checks if a message text contains a shutdown request

Callers 1

TeamsDialogFunction · 0.85

Calls 7

getTeamNameFunction · 0.85
getAgentNameFunction · 0.85
writeToMailboxFunction · 0.85
jsonStringifyFunction · 0.85
generateRequestIdFunction · 0.70
getTeammateColorFunction · 0.70

Tested by

no test coverage detected