Internal Emails Show How a Controversial Gun-Detection AI System Found Its Way to NYC