feat: add turn_canceled event for proper interruption handling

Adds a new turn_canceled event type to distinguish intentional turn
interruption from errors. Fixes race conditions in Claude agent where
concurrent stream() calls could cause garbled output by serializing
turn handoff with turn IDs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mohamed Boudra
2025-12-28 16:29:01 +00:00
co-authored by Claude Opus 4.5
parent 076080db48
commit 69b6f755fa
7 changed files with 123 additions and 7 deletions
+1
View File
@@ -819,6 +819,7 @@ export function reduceStreamUpdate(
case "turn_started":
case "turn_completed":
case "turn_failed":
case "turn_canceled":
case "permission_requested":
case "permission_resolved":
case "attention_required":