Am I a failure for not fixing her or doing better?
Hello and welcome to the family. I'm so sorry that you're going through this and the same thing happened in my marriage. One day, my wife simply said "I'm done" and there was nothing I could do about it. I hate that it's so common in these relationships but there's a lot you can do to prevent that if you do decide to reconcile someday.
First, you're not a failure. You can't fix anyone, much less someone with mental illness, so you have to let these types of thoughts go. It is not your fault.
Second, it's not your fault for not doing better. Were there things you could have done? Sure. But you're human and you messed up at times, just like all of us do. Part of a relationship is forgiveness and meeting someone halfway, which doesn't happen in a lot of BPD relationships. That's not your fault at all.
Third, the next place people usually go with their thoughts is, "Well, I should have known not to bring her into my mids lives." You said something similar, but there's no truth to it. At first, the relationship was wonderful because she loved everything you loved. That was part of the mental illness as well, holding new partners on a pedestal and then being shocked when it turns out they're not perfect. There's no way you could have known and none of this is directly your fault.
What's next? This just happened and after a few days, she might come to her senses. Then you have to have a serious discussion about the future and if it's "worth it." Nobody here can give you that answer and we can't help you decide. Every relationship is unique and even though you and I have so much in common, we can't walk in each other's shoes.
I ultimately divorced because there was a lot more to the story and my wife left me to rush into another relationship. I forgave her and could have reconciled, but she always would have had one foot out the door and that's not fair to anyone. In my case, in those circumstances, it wasn't "worth it". That doesn't mean you have the same story though.
What are you struggling the most with right now? Have you considered counseling to talk some of this out? How old are your kids? Tell us a little more of the story when you can.