Safe Reinforcement Learning on the Constraint Manifold: Theory and Applications