1. Remove duplicate ToolResult definition in heartbeat package - Import tools.ToolResult instead of local definition - Add nil check for handler before execution 2. Fix SpawnTool to return AsyncResult and implement AsyncTool - Add callback field and SetCallback method - Return AsyncResult instead of NewToolResult 3. Add context cancellation support to SubagentManager - Check ctx.Done() before and during task execution - Set task status to "cancelled" on cancellation - Call callback with result on completion 4. Fix data race window in CronTool.addJob - Use Lock instead of RLock for channel/chatID access - Ensure consistent snapshot during job creation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
10 KiB
10 KiB