Update JS stdout/stderr.write methods for new protocol