As a semi-aside: Are there headless tools for interacting with Logseq databases, especially queries? This would be super useful for automations.
This is less ideal than a library due to the complexity of running it; setting it up on a server will probably be annoying. But it should give you a lot of the power Logseq has, it apparently being the same API as plugins get to use.