\(\left(\frac{1}{x+1}-\frac{3}{x^3+1}+\frac{3}{x^2-x+1}\right)\times\frac{3x^2-3x+3}{\left(x+1\right)\left(x+2\right)}-\frac{2x-2}{x^2+2x}\)
\(=\left[\frac{x^2-x+1}{\left(x+1\right)\left(x^2-x+1\right)}-\frac{3}{\left(x+1\right)\left(x^2-x+1\right)}+\frac{3\left(x+1\right)}{\left(x+1\right)\left(x^2-x+1\right)}\right]\times\frac{3\left(x^2-x+1\right)}{\left(x+1\right)\left(x+2\right)}-\frac{2\left(x-1\right)}{x\left(x+2\right)}\)
\(=\frac{\left(x^2-x+1\right)-3+3\left(x+1\right)}{\left(x+1\right)\left(x^2-x+1\right)}\times\frac{3\left(x^2-x+1\right)}{\left(x+1\right)\left(x+2\right)}-\frac{2\left(x-1\right)}{x\left(x+2\right)}\)
\(=\frac{x^2-x+1-3+3x+3}{x+1}\times\frac{3}{\left(x+1\right)\left(x+2\right)}-\frac{2\left(x-1\right)}{x\left(x+2\right)}\)
\(=\frac{x^2+2x+1}{x+1}\times\frac{3}{\left(x+1\right)\left(x+2\right)}-\frac{2\left(x-1\right)}{x\left(x+2\right)}\)
\(=\frac{3\left(x+1\right)^2}{\left(x+1\right)\left(x+1\right)\left(x+2\right)}-\frac{2\left(x-1\right)}{x\left(x+2\right)}\)
\(=\frac{3x}{x\left(x+2\right)}-\frac{2x-2}{x\left(x+2\right)}\)
\(=\frac{3x-2x+2}{x\left(x+2\right)}\)
\(=\frac{x+2}{x\left(x+2\right)}\)
\(=\frac{1}{x}\)