Searching available nodes from context

So now I am playing with invoke_search_popup

I have it popping up when I need it to and I see I have to set its props. What I cannot see is if there is a way to populate the enum based on the current node_tree? In Node Wrangler it seems to be done in a very manual way, I would kind of like this to work with any node window (e.g. Sverchock/AN etc.)

You can look at how the node search menu is iterating over node types in the context:
https://developer.blender.org/diffusion/B/browse/master/release/scripts/startup/bl_operators/node.py;118fb9f1f7436e6c8cd3ccae7c6c2c12f0c1b9fc$193

Thanks Brecht I’m slowly figuring it out.