The sensor, believed to be first of its kind, could vastly improve treatment and drug safety for millions of patients who take lithium for bipolar disorder.