I'm not sure how useful this is going to be, but I wanted to mention it: there is a VisibilityConstraint in the moveit_msgs
package. From the msg documentation:
The constraint is useful to maintain visibility to a disc (the target) in a particular frame.
This disc forms the base of a visibiliy cone whose tip is at the origin of the sensor.
Maintaining visibility is done by ensuring the robot does not obstruct the visibility cone.
Note:
This constraint does NOT enforce minimum or maximum distances between the sensor
and the target, nor does it enforce the target to be in the field of view of
the sensor. A PositionConstraint can (and probably should) be used for such purposes.
I haven't used this myself, but I have the impression this would come closest to what you describe in your OP.
The reason I started my answer with "I'm not sure how useful this is going to be" is that constraints are non-trivial to get working correctly with MoveIt plan requests, so starting with this might lead you down a path where you have to spend quite some effort to get it to do what you want.
It could also "just work".
I'm not entirely sure whether it will help, but you could also take a look at the bio_ik package created by the TAMS group at Hamburg University. It also supports a nr of constraints that could potentially do what you are after.