Here's all the options I know of.
1. You recruit Shadowheart on the beach (when she's unconscious after saving her from the pod, or at the door to Withers' tomb).
2. You recruit Shadowheart at the grove if you left her on the beach.
3. You recruit Shadowheart at the goblin camp.
4. You never recruit Shadowheart.
5. You kill Shadowheart at any of the above areas and loot her.
6. You kill Shadowheart at any of the above areas and leave her.
During options 1 to 3, you'll get the artifact, still in Shadowheart's possession. You can eventually manually swap it to your inventory - but once it's there you can never get rid of it again. It will also go to your inventory if you send her to camp. And go to your inventory after you've entered the artifact and spoken to the Emperor at the githyanki Creche. Shadowheart does keep it entering the Shadow-Cursed Lands if you skip the Creche, and I don't know if the game will force it on you another time, though I'd guess the forced long rest where you enter the artifact again and the Emperor is revealed between act 2 and act 3 will hand it over to you at the end of it.
Option 4 leads to you getting the artifact when you go to the Mountain Pass or Shadow-Cursed Lands (not sure which). It used to cause a crazed Shadowheart (caused by the Emperor because he wanted her to go to you, presumably) to show up at your camp where you have to fight or recruit her but that seems to be cut.
Option 5 leads to you getting it, simple as.
Option 6 leads to the artifact magically showing up in your inventory during a long rest cutscene.
On a sidenote, 'good' Shadowheart and 'good' Dark Urge are a great match. Both amnesiacs seeking answers from the past and becoming better people, even if one was actually a good person in the past and the other was.. not so much. Still, worth recruiting!