This is an extension to #186.
It would be nice to support user-defined (i.e. JS) aggregate functions, in addition to scalar functions. From #216 we have most of the internal plumbing to make this work; the main open question is what API we want to expose to our users.