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)
```
Generated release with automated versioning system.
Release type: minor
Build date: 2026-06-06 00:54:11 UTC
🤖 Generated with automated release workflow
Introduces a shared `toolTargeting.ts` module that resolves the active MIDI
region/track from the user's current selection, enabling tools to operate on
the correct target without requiring explicit track IDs in most cases.
Adds two new read-only tools — `list_all_tracks` and
`get_user_selected_music_range_and_track` — so the agent can inspect
available tracks and the current selection context before acting.
Also refactors `AddNotesTool` to auto-create MIDI regions when no region
exists, refactors `RemoveNotesTool`, `ReadMusicTool`, and
`ReadChordProgressionTool` to use the new targeting helpers, adds a
`buildToolHistoryContent` hook to `BaseTool` for cleaner chat history
display, and updates system prompts and tests throughout.
Generated release with automated versioning system.
Release type: minor
Build date: 2026-05-31 20:17:05 UTC
🤖 Generated with automated release workflow
Generated release with automated versioning system.
Release type: minor
Build date: 2026-05-29 22:03:39 UTC
🤖 Generated with automated release workflow