Very fun indeed and easier than a sockets-based impl that covers all versions. I'm only doing v3 so far and it's a long haul!
Congrats on this!
I try to keep the code as generic as possible but nearly every game I try has had a surprise for me. I really don't want to have tons of special cases in the code but I think some might be unavoidable.
If you're writing your own Z-machine, then you can write it in a way that plans for such integration and that would make a direct-linked approach much easier.
My 'ssh toy' has proven quite popular so far and I hope it has introduced IF to some new people.
Thanks and best of luck with your Z-Machine. Hacks and Glory await!