Glad you found this place, though sorry you need to be here.
Have you received counseling for your loss? Help working through that aspect of your life can also be helpful in your current issue. Not a guarantee, but helps you become more centered and solid...which your 2 kids will need if things don't work out.
FYI...I dealt with some parallel circumstances that you have described: events of the past influencing my mental health, "checking out of life" , husband beginning affair, saying it's over, yet continuing on, etc.
My best advice: get counseling, get meds if you need it, come here often, read, make yourself the best you that you can be. My dealing with my past really helped a lot. I worked through that and found that many other things fell into place.