For the moment, the only way I found is to separate lights in render layers and make the “blocker” with the compositor, but it is slower and very limited by the number of Blender’s layers.
Is there a light node setup or something else that could be used for that?
Create a mesh (as the area you don’t want the light to escape) and then give it a material of holdout, then disable visibility for camera and shadow (shadow is very important if you have non-ambient lighting outside the mesh).
Basically, the light blocker is the holdout material. simple as that.
Not sure what you mean. This should block lights from outside coming in, and lights from inside going out. At least it worked that way with me. can you give a screenshot?
Create your blockers using the lightpath trick, then have the lights divided among multiple layers, then combine the lighting information in the compositor.
To do what you want without doing this would require that someone develops a light group system for Cycles (in which the rays would then be flagged according to their source light and accessible with the nodes).