if (cmd === "lyrics_set_auto_sync") { autoSyncOff = !args?.enabled; return Promise.resolve(); } if (cmd === "lyrics_save_lines") { /* the Rust drops the empty lines and sorts by time — a half-tapped set is stored as the lines that HAVE one */ const lines = (args?.lines || []).filter((l) => String(l?.text || "").trim()) .map((l) => ({ time_ms: l.time_ms, text: l.text })).sort((a, b) => a.time_ms - b.time_ms); if (!lines.length) return Promise.reject(new Error("Nothing to save")); /* the Rust's payload_from does NOT carry the entry's auto-sync flag back from a write — false here, faithfully, so the walk notices if the store ever applies a save over the switch */ return Promise.resolve({ status: "synced", source: "user", synced: lines, plain: null, offset_ms: 0, auto_offset_ms: 0, auto_sync_off: false }); } /* the vocal-reduced copy: a render takes a beat, and it is a new file */ if (cmd === "lyrics_prepare_instrumental") return new Promise((r) => setTimeout(() => r({ path: String(args?.path || "") + ".instrumental.wav", cached: false, durationSecs: 214 }), 400));