Add scope attribute to classes promise. RM #1941

By setting scope => namespace, it's possible to define a global class
from an agent bundle, and a local class in a common bundle.

Includes testcases for new scope attribute.