Implements the missing server-side packaging phase that exists in the
legacy system. JamTracks must be packaged/signed on the server before
they can be downloaded.
**Legacy System Flow (8 states):**
1. initial → 2. packaging → 3. downloading → 4. keying → 5. synchronized
**Previous Implementation (6 states - INCORRECT):**
1. idle → 2. checking → 3. downloading (skipped packaging!)
**New Implementation (7 states - CORRECT):**
1. idle → 2. checking → 3. packaging → 4. downloading → 5. keying → 6. synchronized
Changes:
1. REST API (rest.js):
- Added enqueueMixdown(packageId) endpoint
- POST /mixdowns/{packageId}/enqueue
2. Redux State (mediaSlice.js):
- Added 'packaging' state to downloadState
- Added packageId, packaging_steps, current_packaging_step, signing_state fields
- Updated clearDownloadState to reset new fields
3. Download Logic (mediaSlice.js downloadJamTrack thunk):
- Added packaging phase before download
- Calls enqueueMixdown API
- Waits for signing_state === 'SIGNED' (polls Redux state every 500ms)
- 60 second timeout with clear error messages
- Only proceeds to download after package is signed
4. WebSocket Handler (useSessionWebSocket.js):
- Added SUBSCRIBE_NOTIFICATION handler
- Updates packaging progress: signing_state, packaging_steps, current_packaging_step
- Handles packaging errors: ERROR, SIGNING_TIMEOUT, QUEUED_TIMEOUT, QUIET_TIMEOUT
- Logs packaging progress for debugging
5. UI (JKSessionJamTrackPlayer.js):
- Added packaging state display
- Shows "Your JamTrack is currently being created in the JamKazam server"
- Displays signing_state and step progress (X of Y)
- Shows spinner during packaging
- Matches legacy system UX
This fixes the critical issue where JamTracks were attempted to be
downloaded without server-side packaging, which would always fail.
The flow now matches the legacy download_jamtrack.js.coffee behavior
documented in .planning/codebase/JAMTRACK_LEGACY.md lines 57-85.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>