Your 'formal' alternative is impossible. If you wish to make the original more formal, simply enclose the direct quotation in quotation marks: What do you mean by "I thought you wouldn’t mind"?
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.