Crazy theory time!
The AI (maybe of the creator herself) is hidden within the black blood (Nightblood) of the commanders (past/present/future).
I think; that is how the commanders of the past speak with Lexa in her dreams, and ultimately the spirits of the past commanders are somehow integrated, maybe using nano technology (which is not too far fetched with the leaps and bound we are having in technology right now) and that is how the next commander is chosen.
I feel that the black blood may make Lexa immune to Ali’s effects, or at the very least allow her to enter the city of Light safely, or unaffected by the obvious mind control that’s going on right now in Arcadia, to take Ali down.
Feel free to comment below 😊