This is done in large part via the stuff in /opt/cln/galileo and the clloader program. Apparently clloader acts like an AVR boot loader (more or less) and listens on the USB port, downloading "sketches" in response to the arduino GUI. Something like that.
Tom's Computer Info / tom@mmto.org