 +      nodetype.setDocument(opts.contentDocument);
 +      cli.setEvalFunction(opts.jsEnvironment.evalFunction);
 +
++      // Create a FocusManager for the various parts to register with
++      if (!opts.focusManager) {
++        opts.debug = true;
++        opts.focusManager = new FocusManager({
++          debug: true,
++          document: opts.chromeDocument
++        });
++      }
++
 +      opts.inputter = new Inputter(opts);
 +      opts.inputter.update();
-+      if (opts.popup) {
-+        opts.inputter.addPopupListener(opts.popup);
++      if (opts.gcliTerm) {
++        opts.focusManager.onFocus.add(opts.gcliTerm.show, opts.gcliTerm);
++        opts.focusManager.onBlur.add(opts.gcliTerm.hide, opts.gcliTerm);
++        opts.focusManager.addMonitoredElement(opts.gcliTerm.hintNode, 'gcliTerm');
 +      }
 +
 +      if (opts.hintElement) {

     console.log("define: " + moduleName + " -> " + payload.toString()
         .slice(0, 40).replace(/\n/, '\\n').replace(/\r/, '\\r') + "...");
   }
@@ -417,151 +494,6564 @@ function define(moduleName, deps, payloa
     console.error(this.depth + " Error: Redefining module: " + moduleName);
   }
   define.modules[moduleName] = payload;

+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+define('gcli/index', ['require', 'exports', 'module' , 'gcli/canon', 'gcli/types/basic', 'gcli/types/javascript', 'gcli/types/node', 'gcli/cli', 'gcli/ui/inputter', 'gcli/ui/arg_fetch', 'gcli/ui/menu', 'gcli/ui/focus'], function(require, exports, module) {
+
+  // The API for use by command authors
+  exports.addCommand = require('gcli/canon').addCommand;
