I'm sure you already know the answer. There is no reasonable explanation for what your wife is doing, and it doesn't matter that she's redirecting the convo back to non-flirting things. If what she's doing is so innocent, you'd know about it. It's even worse that this is a friend of yours. So she's already cheating on you, because the definition of that is anything you wouldn't do in front of your spouse.
You ask what to do about them, but the friend is a no-brainer. He's an ex friend. If you can just ignore him from now on, that will be tough, but it's always the best thing to do. It will drive him nuts and he'll want to explain, but there's nothing to explain. He's trying to steal your wife. Short of murder, there's nothing worse than this.
As for your wife, obviously you need to talk to her and tell her she owes you complete honesty. If she starts to whine about you looking at her texts, do not let her derail the convo that way. Then decide what comes next. If it was me, I'd be demanding couples counseling. This is a sign something is very wrong between the 2 of you, and most couples can't figure this out on their own.
· 2 months ago