( targetName: string, reason: string | undefined, context: ToolUseContext, )
| 266 | } |
| 267 | |
| 268 | async function handleShutdownRequest( |
| 269 | targetName: string, |
| 270 | reason: string | undefined, |
| 271 | context: ToolUseContext, |
| 272 | ): Promise<{ data: RequestOutput }> { |
| 273 | const appState = context.getAppState() |
| 274 | const teamName = getTeamName(appState.teamContext) |
| 275 | const senderName = getAgentName() || TEAM_LEAD_NAME |
| 276 | const requestId = generateRequestId('shutdown', targetName) |
| 277 | |
| 278 | const shutdownMessage = createShutdownRequestMessage({ |
| 279 | requestId, |
| 280 | from: senderName, |
| 281 | reason, |
| 282 | }) |
| 283 | |
| 284 | await writeToMailbox( |
| 285 | targetName, |
| 286 | { |
| 287 | from: senderName, |
| 288 | text: jsonStringify(shutdownMessage), |
| 289 | timestamp: new Date().toISOString(), |
| 290 | color: getTeammateColor(), |
| 291 | }, |
| 292 | teamName, |
| 293 | ) |
| 294 | |
| 295 | return { |
| 296 | data: { |
| 297 | success: true, |
| 298 | message: `Shutdown request sent to ${targetName}. Request ID: ${requestId}`, |
| 299 | request_id: requestId, |
| 300 | target: targetName, |
| 301 | }, |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | async function handleShutdownApproval( |
| 306 | requestId: string, |
no test coverage detected