A Self-Regulated Learning Framework using Generative AI and its Application in CS Educational Intervention Design