Accessing history stack or sidecar from LUA script

I’d like to add an Export storage for Nind Denoise, starting from this:

So I’m wondering if I can access the history stack of an image, and split the stack in 2 different stages for process the image.

Obviously I could use “external_command” and perform the 2 stages processing via darktable-cli, but I’m wondering if is it possible to do directly in the LUA script through the darktable utils.