$$
f(x)=4 \sin x \cdot \sin ^{2}\left(\frac{\pi}{4}+\frac{x}{2}\right)+\cos 2 x .
$$
(1) Let the constant $\omega>0$, if $y=f(\omega x)$ is an increasing function in the interval $\left[-\frac{\pi}{2}, \frac{2 \pi}{3}\right]$, find the range of $\omega$;
(2) Let the set $A=\left\{x \left\lvert\, \frac{\pi}{6} \leqslant x \leqslant \frac{2 \pi}{3}\right.\right\}, B=\{x|| f(x)-m \mid<2\}$, if $A \subseteq B$, find the range of the real number $m$.
(1) $f(x)=4 \sin x \cdot \frac{1-\cos \left(\frac{\pi}{2}+x\right)}{2}+\cos 2 x=2 \sin x \cdot(1+\sin x)+$ $1-2 \sin ^{2} x=2 \sin x+1$.
Since $f(\omega x)-2 \sin \omega x+1$ is an increasing function on $\left[-\frac{\pi}{2}, \frac{2 \pi}{3}\right]$, we have
$\left[-\frac{\pi}{2}, \frac{2 \pi}{3}\right] \subseteq\left[\frac{2 k \pi-\frac{\pi}{2}}{\omega}, \frac{2 k \pi+\frac{\pi}{2}}{\omega}\right]$, where $k \in \mathbf{Z}$.

That is, $2 k-\frac{1}{2} \leqslant-\frac{1}{2} \omega, 2 k+\frac{1}{2} \geqslant \frac{2}{3} \omega$, which means $4 k \leqslant 1-\omega-1$, thus, $k=0$. Therefore, $\omega \in\left(0, \frac{3}{4}\right]$.
(2)
$$
\begin{array}{l}
m>\max f(x)-2=f\left(\frac{\pi}{2}\right)-2=3-2=1 \\
m<\min f(x)+2=f\left(\frac{\pi}{6}\right)+2=2+2=4
\end{array}
$$

Hence, $m \in(1,4)$.