Safe and Adaptive 3-D Locomotion via Constrained Task-Space Imitation Learning