the p9p version of xcpu used to do something similar, but the old svn
repository is gone now so i can't verify. i see an old version of rx.c
in 9grid:/usr/andrey/src/xcpu/rx.c which does something similar to
what you want with threads, channels and procs but doesn't combine the
input.
it doesn't look finished, so it may be useless. it creates a proc for
each remote host :(
it does something like this (from a perfunctory look, it's been a while):
---
# shared between all procs
create input chan
create output chan
for each node create a proc that:
connects to node and set up a session
creates proc for stdout
creates proc for stderr
waits on input chan for commands to send to the node
stdout and stderr procs do:
read from remote host
write to output chan
---
the aggregator part you want can be inserted between read the output
chan and whatever you need to output to, but that logic doesn't exist
in rx.c, i think :)