Okay help? Me, my gf, her ex/my best friend?

So I have a very weird group of friends, to set the scene this focuses on me (to understand easier) person A, and person B. Basically I was the mutual friend of both of these people and I introduced them to each other about 2 years ago. Time goes on and I fall for person A, but when person A came over to hangout with me one day they told me they liked person B. I was heart broken but brushed it off and they ended up dating. Time goes on they breakup ya da ya, so me(still liking person A) ended up dating them. Problem is person B is in our very small friend group, adding on to that person B is my best friend. But my s/o(person A) has recently been cuddling up next to person B more and told me very recently(about a week after our 5 month anniversary) that if they were still dating person B it would be a whole year, and basically said they had been thinking about it a lot. And now I’m really scared for me and person A’s relationship. I really really care and love them and I don’t want to lose them but I don’t know what to do. (It’s been about a week since they talked about the year anniversary thing)