Switch OpenAI-compatible streaming from chat.completions.stream()
to chat.completions.create({ stream: true }) and track finish_reason
from streamed chunks directly.
This avoids the SDK's final chat-completion reconstruction path,
which could throw in preview builds while processing agent streams.
Also keep function/class names and sourcemaps in production builds
to make preview stack traces easier to read.
This issue can randomly happen when using `google/gemma-4-31b-it` model via OpenRouter.
Original error stacktrace:
```
index-Bh7OJFcp.js:807 Error processing stream: kn: Cannot read properties of undefined (reading 'type')
at Bb.qJ (index-Bh7OJFcp.js:780:4436)Caused by: TypeError: Cannot read properties of undefined (reading 'type')
at _J (index-Bh7OJFcp.js:780:1713)
at index-Bh7OJFcp.js:780:416
at Array.map (<anonymous>)
at R6e (index-Bh7OJFcp.js:780:408)
at z6e (index-Bh7OJFcp.js:785:258)
at Bb.By (index-Bh7OJFcp.js:781:4928)
at Bb._createChatCompletion (index-Bh7OJFcp.js:781:1059)
at async Bb._runChatCompletion (index-Bh7OJFcp.js:780:6759)
```