Here we have an initial copying error in 𝓟 that scribe 2 soon corrected. He first wrote “the thoughts”, but then virtually immediately he overwrote the e of the with a y (there is no difference in the level of ink flow). Perhaps scribe 2 was expecting something like “all the thoughts of X”. There are a few instances in the manuscripts where thy and the have been mixed up; for examples, see under 2 Nephi 20:30. Also see the discussion under Alma 12:5 below regarding thine in the phrase “thine adversary”.
Summary: Accept in Alma 12:3 the corrected reading in 𝓟: “he knows all thy thoughts”.