2. $a \in \mathbf{R}$, the complex number $\omega=1+a \mathrm{i}$, and the complex number $z$ satisfies $\bar{\omega} z-\omega=0$. For what value of $a$ does $|z^{2}-z+2|$ have the minimum value, and find this minimum value.
2. Convert the condition to $z=\frac{1+a \mathrm{i}}{1-a \mathrm{i}}=\frac{1-a^{2}}{1+a^{2}}+\frac{2 a}{1+a^{2}} \mathrm{i}$. Let $a=\tan \frac{\theta}{2}$, then $z=\cos \theta+\mathrm{i} \sin \theta$. Thus,
$$
\begin{aligned}
\left|z^{2}-z+2\right| & =|\cos 2 \theta+\mathrm{i} \sin 2 \theta-\cos \theta-\mathrm{i} \sin \theta+2| \\
& =\sqrt{(\cos 2 \theta-\cos \theta+2)^{2}+(\sin 2 \theta-\sin \theta)^{2}} \\
& =\sqrt{8 \cos ^{2} \theta-6 \cos \theta+2}=\sqrt{8\left(\cos \theta-\frac{3}{8}\right)^{2}+\frac{7}{8}} .
\end{aligned}
$$

When $\cos \theta=\frac{3}{8}$, i.e., $\frac{1-a^{2}}{1+a^{2}}=\frac{3}{8}, a= \pm \frac{\sqrt{55}}{11}$,
$$
\left|z^{2}-z+2\right|_{\text {min }}=\sqrt{\frac{7}{8}}=\frac{\sqrt{14}}{4} \text {. }
$$