It is good to hear from you, and I hope you managed to get an appointment with your doctor. It is vital that you do not neglect your health, for you, and for your kids.
It would be a good idea to draft a list of what you need, so that even if you are letting your wife lead the way and watching what she does (a perfectly reasonable way to go if you are wanting her to prove her commitment to you and the kids), you establish the key targets that she has to hit if you are going to remain in the marriage.
If she goes off the rails at all we will be done.
Have you defined what 'off the rails' means, or is it a case where if she does x, the boundaries will be moved, so that they are y. And if she does y, 'off the rails' will be z?
I apologize if this seems like I am attacking you. I am not. I am trying to make you aware that having flexible, moveable boundaries because you do not want to break up the marriage can backfire, by giving your wife too much latitude in the driving seat.
What has happened is not insurmountable. It is not good, it is certainly grounds for divorce if you take a black-and-white approach to fidelity, but if you want to try to roll with it, and see if things can be saved, it will be up to your wife to fully explain why she did what she did, and why she thinks you should continue to be married to her.
What happened is a product of your wife's thought processes and attitude to herself, as well as to you and the kids. She must get to the bottom of this in IC and explain why she thought getting involved with her AP was better than coming to you and expressing her anxieties about the relationship.
You have already done this, but it is important to emphasize that your wife can leave any time she wants, to make her address where she wants to be, and why she wants to be there. Let her know that if she cannot commit 100%, she can go her way, and you will go yours.
It seems fairly clear that her affair was not intended to be an exit affair. She was cake-eating behind a wall of lies and deception to pretend that all was well while she chased her affair partner.
By busting the affair, you have called her bluff, and despite what she said about being unhappy, she wants to stay exactly where she was. Which should tell you everything you need to know about how 'bad' the marriage really was.
An alternative scenario is that she got targeted by an opportunist, and she thought it would be fun to run with it, while lying and maintaining the marriage. So she needs to explain to you why she will not do the same thing six months down the line, or whenever some passing chancer pays her a few compliments.