Right now there's not transport layer at all in stapdyn. Communication is only going stapdyn->module via inferior calls, and script output is writing directly on the target's stdout/err. We really need a means for bidirectional communication, both for control messages and for general script output. For a first draft, I propose listening on a socket in stapdyn, opening that in the target with an inferior call, and then send messages just as we do with staprun and kernel modules.
Commit f1ae3f04 made a related tweak - we're now using duped fds for out/err so that the target's manipulation of stdout and stderr doesn't directly affect us. Another possibility for implementing the transport is using libdyninstAPI_RT's DYNINSTuserMessage for mutatee->mutator communication. For mutator->mutatee, we might just stick with oneTimeCode snippets, which are somewhat slow, but we only need them occasionally.
Transport added in commit 8ca891c.