Register a new template function from a plug?

Can I call silverbullet.registerFunction from a plug somehow? It looks like it only works from inside a space script block.

I also tried overriding builtinFunctions from builtin_query_functions.ts just to see if I could insert a new function that way but it doesn’t work probably because of the load order.

edit: This sort of works as a workaround if I put this in a spacescript, but I’m wanting to avoid the space script part and provide it from the plug:

silverbullet.registerFunction({name: "queryOpenAI"}, async (systemPrompt, userPrompt) => {
  const pageContent = await syscall("system.invokeFunction", "silverbullet-ai.queryOpenAI", systemPrompt, userPrompt);
  return pageContent;
})