Previously, the Output callback set state to 'thinking' on every tool
event (including streaming chunks), so the state flickered immediately
away from 'calling:'. Now:
- Tool events no longer trigger setState('thinking')
- The loop emits a 'state' event with 'thinking' at the top of each
iteration (before calling the backend), which is the correct time
to transition.
- New 'state' event role in Output callback for explicit state transitions.
This keeps the detach button visible in the GUI during tool execution.