You have happened on a typical example of the existentialist
problem. How do we know that anything is conscious in any defensible
sense of the term? How do we know for example, that the caterpillar is
conscious? All we really can tell is that its nervous system can receive
certain stimuli and control its body in responding to them.
One
practical point of view, and arguably the simplest, is to accept this as
evidence for consciousness.
Now, if we do accept this as our criterion for consciousness, then certain
kinds of pupa (the term "chrysalis" is not much used any more) that
cannot move at all until the adult emerges, might not seem very
conscious for all we can tell, but most kinds of pupa of Lepidopteran
insects (butterflies and other moths) can in fact wriggle if disturbed.
How effective it is as a means of defence, I cannot say; all they can
move is the abdomen, but I suppose if that is all you can do, it sometimes may be better than doing nothing.
What is pretty definite, is that they
are as conscious as anyone could reasonably expect; they do not in
general wriggle when they are not disturbed, and they do wriggle when
they are disturbed. Although close inspection of a moth's pupa shows
that within its outer shell its body is complete, the only part it can
move is its abdomen, and that is the part that it does move. Certain
kinds of pupa that shelter in tunnels or similar structures have spiky
abdomens and about at the time that the moth emerges, they wriggle the
abdomen in such a way as to move forward, ready to emerge.
Taken all together, that sounds about as much like consciousness as anything that it might make sense to demand in the circumstances.