Use a ref to track current stream text so agent:end can commit the
final message without calling setMessages inside a setCurrentStreamText
updater function, which violates React's rule that state updaters must
be pure.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>