Four. (20 points)
Given a fixed point $M(-1,2)$, line $l_{1}: y=a(x+1)$, and curve $c: y=\sqrt{x^{2}+1}$. $l_{1}$ intersects $c$ at points $A$ and $B$. $N$ is the midpoint of segment $AB$. Line $\ell_{2}$ passes through points $M$ and $N$, and has an $x$-intercept of $m$. Express $m$ as a function of $a$, $m=f(a)$. Let $g(m)=-\frac{2}{m+1}$. Find the range of $g(f(a))$.
Given $c: y^{2}-x^{2}=1(y \geqslant 1)$, from $y=a(x+1), a \neq 0$ we get $x=\frac{y}{a}-1$. Substituting into $c$ yields $\left(1-a^{2}\right) y^{2}-2 a y+2 a^{2}=0$.
This equation has two distinct positive roots, which must be $\geqslant 1$, because $y^{2}-\left(\frac{y}{a}-1\right)^{2}=1$. Therefore, we have
$$
\left\{\begin{array}{l}
\Delta=4 a^{2}-8 a^{2}\left(1-a^{2}\right)>0 \\
\frac{2 a}{1-a^{2}}>0 \\
1-a^{2}>0
\end{array}\right.
$$

Solving this, we get $\frac{\sqrt{2}}{2}<a<1$.
Let $A\left(x_{1}, y_{1}\right), B\left(x_{2}, y_{2}\right), N\left(x_{0}, y_{0}\right)$, then $y_{0}=\frac{y_{1}+y_{2}}{2}=\frac{a}{1-a^{2}}$
$$
x_{0}=\frac{y_{0}}{a}-1=\frac{a^{2}}{1-a^{2}}
$$

The slope of line $l_{2}$ is $k=2 a^{2}+a-2$, so the equation of $l_{2}$ is $y-2=\left(2 a^{2}+a-2\right)(x+1)$
Setting $y=0$ gives $m=\frac{-2}{2 a^{2}+a-2}-1 . \quad\left(a \neq-\frac{1 \pm \sqrt{17}}{4}\right)$
Thus, $g(m)=-\frac{2}{m+1}=2 a^{2}+a-2, a \in\left(\frac{\sqrt{2}}{2}, \frac{\sqrt{17}-1}{4}\right) \cup$ $\left(\frac{\sqrt{17}-1}{4}, 1\right)$, and its range is $\left(\frac{\sqrt{2}}{2}-1,0\right) \cup(0,1)$.