Deploy a gebo human-agent interface

This document provides step-by-step instructions on how to deploy a gebo human-agent interface (HAI). It is comprehensive so that you may copy, paste, and execute the commands and deploy the configurations provided, from beginning to end.

Set up grunt

Some of these instructions may have already been executed in previous gebo tutorials.

1
2
sudo npm install grunt-cli -g
sudo npm install grunt-init -g

The first command enables you to run the locally installed grunt, automatically. The second allows you to call grunt-init on the gebo-react-hai template.

Get the gebo-react-hai template

This is going in your ~/.grunt-init/ directory:

1
git clone https://github.com/RaphaelDeLaGhetto/grunt-init-gebo-react-hai.git ~/.grunt-init/gebo-react-hai

Create a new project

1
2
3
mkdir myfirsthai
cd myfirsthai
grunt-init gebo-react-hai

Upon execution the gebo-react-hai will prompt you for some input, with some fields prefilled:

1
2
3
4
5
6
7
8
9
10
11
12
13
Please answer the following:
[?] Project name (myfirsthai)
[?] Description (The best project ever.) My first gebo HAI
[?] Version (0.0.0)
[?] Project git repository (none) https://github.com/RaphaelDeLaGhetto/myfirsthai.git
[?] Project homepage (none)
[?] Project issues tracker (none)
[?] Licenses (MIT)
[?] Author name (RaphaelDeLaGhetto)
[?] Author email (daniel@capitolhill.ca)
[?] Author url (none)
[?] Main module/entry point (index.html)
[?] Do you need to make any changes to the above before continuing? (y/N)

Once everything is configured to your liking, execute:

1
sudo npm install

Test

If everything has been initialized correctly, the tests should pass:

1
npm test

Run the development server

1
grunt server

By default, your HAI will be running at http://localhost:9000. There you will see a vanilla gebo HAI interface.

Development

Obviously, a simple Hello, world! HAI isn’t going to suffice. You’re going to want to implement your own functionality…

Project directory

The gebo-react-hai template produces this directory structure:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
.. (up a dir)
/home/daniel/workspace/myfirsthai/
▸ __tests__/
▸ assets/
▸ node_modules/
▾ scripts/
▸ gebo/
config.js
HelloWorld.js
Interface.js
Gruntfile.js
index.html
oauth2callback.html
package.json
README.md
robots.txt

Everything in scripts/gebo directory is critical to interfacing with the gebo-server. Monkey with it at your own risk. I like to place project-specific React components in a scripts/lib directory, which I create myself. Use scripts/HelloWorld.js and scripts/Interface.js as launch points for your own gebo HAI.

Out of the box, the HelloWorld.js interface is intended as a welcome to unauthenticated clients. The functionality defined in Interface.js is only for friendos of the corresponding gebo agent.

Configure

Your HAI needs to know what gebo agent it’s talking to. This is specified in config.js.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// ...
/**
* This HAI's name and client ID
*/
var name = 'myfirsthai';
var clientId = 'myfirsthai@example.com';
/**
* The agent with which this HAI interacts
*/
var gebo = 'https://localhost:3443';
// ...