Just reading this for the first time and thinking off the top of my head...
One way to accomplish this now would be to have an entire TestSuite dedicated as the "Script Repo". Each TestCase would have one Groovy TestStep. You could use TestCase properties as inputs to the "function" and the return value of the Groovy TestStep is the return value of the "function". Of course whenever you want to call your "function", you'd have to always be sure to first set your inputs by using groovy to modify the TestCase "input" properties.
It's not very neat, but I think it could be done.