Update daemon.js

Experimental support for running as an agent instead of a daemon. Added for issue #12.