  We study a family of stochastic control problems arising in typical
applications (such as boundary control and control of delay equations with
delay in the control) with the ultimate aim of finding solutions of the
associated HJB equations, regular enough to find optimal feedback controls.
These problems are difficult to treat since the underlying transition
semigroups do not possess good smoothing properties nor the so-called
"structure condition" which typically allows to apply the backward equations
approach. In the papers [14], [15], and, more recently, [16] we studied such
problems developing new partial smoothing techniques which allowed us to obtain
the required regularity in the case when the cost functional is independent of
the state variable. This is a somehow strong restriction which is not verified
in most applications. In this paper (which can be considered a continuation of
the research of the above papers) we develop a new approach to overcome this
restriction. We extend the partial smoothing result to a wider class of
functions which depend on the whole trajectory of the underlying semigroup and
we use this as a key tool to improve our regularity result for the HJB
equation. The fact that such class depends on trajectories requires a
nontrivial technical work as we have to lift the original transition semigroup
to a space of trajectories, defining a new "high-level" environment where our
problems can be solved.
