make client.js work in advanced mode; add externs; connect to repl based on config