A power-sharing deal between the opposition coalition and the ruling military council has been agreed in Sudan.