Replace `active/closingStdin/isTaskProcess` booleans with a single `runPhase` enum (idle | running_messages | running_task | closing_messages). Add `resetRunState()` to eliminate 7-field reset duplication, and `assertRunPhaseInvariants()` for runtime validation of field consistency after every phase transition. Add 3 transition tests covering the full lifecycle, closeStdin during tasks, and sendMessage phase gating. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21 KiB
21 KiB