Rival Libyan factions commit to cease-fire, elections