Add UI and scripting support to embedded queries

Maybe could be merged with: Explicit `sort` parameter in query syntax - #2