Lib (react_ui/src/lib/)
Non-React utility modules — native bridge, AI integration, theme system, and shared helpers.
Structure
Modules
native/ — Native Bridge Bootstrap
Bootstraps the window.__SONGBIRD__ global that the sync engine’s transports depend on.
Note:
native.js and native.d.ts have been deleted. All command dispatch now goes through send() from @/sync/api or invoke() from @/sync/transports/promiseHandler.
ai/ — AI Copilot (Multi-Provider)
Modular AI copilot with intent-driven speed optimization and multi-provider abstraction.
Architecture
Request Pipeline
Speed Optimizations
Provider Interface
Specialized Agents
The AI copilot uses a multi-agent architecture where different agents handle different types of requests:
Inline generation (Option+click-drag on a track lane) routes by track type: audio →
ml.generate_lyria3 sync command (Lyria 3 Pro in Rust), MIDI → clip.create_midi_clip + ml.chat with intentOverride: bird_edit so the composer role fills the empty clip.
theme/ — Theme System
Conventions
isPlugin— Boolean flag (truewhen running inside the native WebView,falsein browser dev mode). Guards all native function calls.cn()— Class name merging utility (wrapsclsx+tailwind-merge). Use this instead of raw template literals for conditional Tailwind classes.- No React in
lib/— This layer should remain framework-agnostic. No hooks, no JSX. Components that need these utilities import from@/lib.