songbird-collab
Real-time collaboration infrastructure for multi-user DAW sessions.What it owns
- Peer management and operation logs.
- WebSocket transport to the Node.js collab server (
server/server.js). - Throttled mixer broadcasting.
- State, session, and transport synchronization across peers.
Public API
Modules:collab— top-level session lifecycle, peer management, room join/leave.collab_transport— WebSocket connection toserver/server.js.collab_mixer_sync— debounced/throttled mixer-parameter broadcast and apply.collab_state_sync— full project state push/pull and merge integration.
How it fits
Sits betweensongbird-state (source of truth being synced) and the network. Consumed by songbird-state, songbird-app, songbird-engine.
collab channel at
rust/crates/data/songbird-sync/src/channels/collab/. There is no direct
Tauri command path for collab; everything is a collab.* command or
collab:* event.
Sync Protocol
Wire messages between the Rust client andserver/server.js:
| Direction | Type | Description |
|---|---|---|
| Client → Server | create | Create room, returns invite code |
| Client → Server | join | Join room with invite code |
| Client → Server | push | Push file changes after a local commit |
| Client → Server | pull | Request current file state |
| Client → Server | presence | Cursor / tool position |
| Server → Client | created | Room created + invite code |
| Server → Client | joined | Joined + files + peer list |
| Server → Client | update | Remote changes (post-merge) |
| Server → Client | pushAck | Push acknowledged |
| Server → Client | presence | Remote cursor update |
| Server → Client | peerJoined | Peer connectivity |
| Server → Client | peerLeft | Peer disconnect |
collab sync-engine channel translates these into typed events
consumed by React (see defs.rs for the full enum).
Merge Strategy
Performed by the Node.js server, not by this crate — but consumers should understand the contract:.birdfiles: parsed into a structured tree (sig → tracks → arr → sections → tracks). Merged at track-per-section granularity. Two users editing different tracks in the same section auto-merge..mixer.json,.plugins.json: recursive deep merge at the per-track-property level. Different controls auto-merge.- Conflicts: last-write-wins (the incoming push takes precedence).
server/merge/{bird-merge.js,json-merge.js}.
Echo Prevention (critical)
When applying remote files, the client must set theundoRedoInProgress
guard so the local commit loop does not echo the changes back to the
server. This reuses the same guard mechanism as undo/redo. Skipping this
causes infinite sync loops between two peers.
Full guard semantics: rust/crates/data/songbird-state/SPEC.md.
Running the collab server locally
Tests
e2e-headless skill — open
two browser sessions and exercise create/join/push/pull through the UI.
See AGENTS.md §6 for the mandatory browser-testing rule that applies here.