  We will describe algebro-geometric solutions of the KdV hierarchy whose
$\tau$-functions in addition satisfy a generalization of the Virasoro
constraints (and, in particular, a generalization of the string equation). We
show that these solutions are closely related to embeddings of the positive
half of the Virasoro algebra into the Lie algebra of differential operators on
the circle. Our results are tested against the case of Witten-Kontsevich
$\tau$-function. As by-products, we exhibit certain links of our methods with
double covers of the projective line equipped with a line bundle and with ${\rm
Gl}(n)$-opers on the punctured disk.
