{"action":"created","comment":{"url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/comments/78581697","id":78581697,"diff_hunk":"@@ -0,0 +1,92 @@\n+import craftai, { Time } from 'craft-ai';\n+import dotenv from 'dotenv';\n+\n+dotenv.load();\n+\n+const CRAFT_AGENT = 'ROOM_R1';\n+const TIME_QUANTUM = 20 * 60;\n+\n+// 0 - Create the craft client\n+let CRAFT_CLIENT = craftai({\n+  owner: process.env.CRAFT_OWNER,\n+  token: process.env.CRAFT_TOKEN,\n+  operationsChunksSize: 200\n+});\n+\n+const CRAFT_MODEL = {\n+  context: {\n+    movement: {\n+      type: 'enum'\n+    },\n+    light: {\n+      type: 'enum'\n+    },\n+    time: {\n+      type: 'time_of_day'\n+    },\n+    month: {\n+      type: 'continuous'\n+    },\n+    tz: {\n+      type: 'timezone'\n+    }\n+  },\n+  output: ['light'],\n+  time_quantum: TIME_QUANTUM\n+};\n+\n+fetch('http://craft.ai/content/data/twor_ROOM_R1.json')\n+.then((response) => {\n+  return response.json();\n+})\n+.then((context) => {\n+\n+  // 1 - Cleanup the mess (agent's name can't be duplicate)\n+  return CRAFT_CLIENT.destroyAgent(CRAFT_AGENT)\n+  // 2 - Create the agent\n+  .then(() => {\n+    console.log(`Creating agent ${CRAFT_AGENT} from the following model.`, CRAFT_MODEL);\n+    return CRAFT_CLIENT.createAgent(CRAFT_MODEL, CRAFT_AGENT);\n+  })\n+  // 3 - Send the dataset's operations\n+  .then(() => {\n+    console.log(`Adding context operations to agent ${CRAFT_AGENT} from '${CRAFT_AGENT}' from twor.`);\n+    return CRAFT_CLIENT.addAgentContextOperations(CRAFT_AGENT, context);\n+  })\n+  .then(() => {\n+    return CRAFT_CLIENT.getAgent(CRAFT_AGENT)\n+    .then(() => {\n+      console.log(`Operations successfully added to agent ${CRAFT_AGENT}`);\n+    })\n+    .then(() => CRAFT_CLIENT.getAgentInspectorUrl(CRAFT_AGENT, 1272745200));\n+  })\n+  .then(url => console.log(`Agent ${CRAFT_AGENT} inspectable at ${url}`))\n+  // 4 - Get some decisions\n+  .then(() => {\n+    // Download the tree\n+    return CRAFT_CLIENT.getAgentDecisionTree(CRAFT_AGENT, 1272745200);","path":"src/learn.js","position":67,"original_position":67,"commit_id":"4a19378ff8d6546dd4673defe2d0079fe53703c6","original_commit_id":"4a19378ff8d6546dd4673defe2d0079fe53703c6","user":{"login":"cloderic","id":958596,"avatar_url":"https://avatars.githubusercontent.com/u/958596?v=3","gravatar_id":"","url":"https://api.github.com/users/cloderic","html_url":"https://github.com/cloderic","followers_url":"https://api.github.com/users/cloderic/followers","following_url":"https://api.github.com/users/cloderic/following{/other_user}","gists_url":"https://api.github.com/users/cloderic/gists{/gist_id}","starred_url":"https://api.github.com/users/cloderic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloderic/subscriptions","organizations_url":"https://api.github.com/users/cloderic/orgs","repos_url":"https://api.github.com/users/cloderic/repos","events_url":"https://api.github.com/users/cloderic/events{/privacy}","received_events_url":"https://api.github.com/users/cloderic/received_events","type":"User","site_admin":false},"body":"Why this timestamp ?\r\nPerhaps you can extract one from the dowloaded data.","created_at":"2016-09-13T15:19:11Z","updated_at":"2016-09-13T15:19:11Z","html_url":"https://github.com/craft-ai/craft-ai-starterkit-nodejs/pull/4#discussion_r78581697","pull_request_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/comments/78581697"},"html":{"href":"https://github.com/craft-ai/craft-ai-starterkit-nodejs/pull/4#discussion_r78581697"},"pull_request":{"href":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/4","id":85065312,"html_url":"https://github.com/craft-ai/craft-ai-starterkit-nodejs/pull/4","diff_url":"https://github.com/craft-ai/craft-ai-starterkit-nodejs/pull/4.diff","patch_url":"https://github.com/craft-ai/craft-ai-starterkit-nodejs/pull/4.patch","issue_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/issues/4","number":4,"state":"open","locked":false,"title":"Learning","user":{"login":"Giska","id":5380503,"avatar_url":"https://avatars.githubusercontent.com/u/5380503?v=3","gravatar_id":"","url":"https://api.github.com/users/Giska","html_url":"https://github.com/Giska","followers_url":"https://api.github.com/users/Giska/followers","following_url":"https://api.github.com/users/Giska/following{/other_user}","gists_url":"https://api.github.com/users/Giska/gists{/gist_id}","starred_url":"https://api.github.com/users/Giska/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Giska/subscriptions","organizations_url":"https://api.github.com/users/Giska/orgs","repos_url":"https://api.github.com/users/Giska/repos","events_url":"https://api.github.com/users/Giska/events{/privacy}","received_events_url":"https://api.github.com/users/Giska/received_events","type":"User","site_admin":false},"body":"@cloderic could review it please ?","created_at":"2016-09-13T14:59:37Z","updated_at":"2016-09-13T15:19:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8c8ce31e5cbd39f3f74e1f162ad73469c55eba6","assignee":{"login":"cloderic","id":958596,"avatar_url":"https://avatars.githubusercontent.com/u/958596?v=3","gravatar_id":"","url":"https://api.github.com/users/cloderic","html_url":"https://github.com/cloderic","followers_url":"https://api.github.com/users/cloderic/followers","following_url":"https://api.github.com/users/cloderic/following{/other_user}","gists_url":"https://api.github.com/users/cloderic/gists{/gist_id}","starred_url":"https://api.github.com/users/cloderic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloderic/subscriptions","organizations_url":"https://api.github.com/users/cloderic/orgs","repos_url":"https://api.github.com/users/cloderic/repos","events_url":"https://api.github.com/users/cloderic/events{/privacy}","received_events_url":"https://api.github.com/users/cloderic/received_events","type":"User","site_admin":false},"assignees":[{"login":"cloderic","id":958596,"avatar_url":"https://avatars.githubusercontent.com/u/958596?v=3","gravatar_id":"","url":"https://api.github.com/users/cloderic","html_url":"https://github.com/cloderic","followers_url":"https://api.github.com/users/cloderic/followers","following_url":"https://api.github.com/users/cloderic/following{/other_user}","gists_url":"https://api.github.com/users/cloderic/gists{/gist_id}","starred_url":"https://api.github.com/users/cloderic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloderic/subscriptions","organizations_url":"https://api.github.com/users/cloderic/orgs","repos_url":"https://api.github.com/users/cloderic/repos","events_url":"https://api.github.com/users/cloderic/events{/privacy}","received_events_url":"https://api.github.com/users/cloderic/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/4/commits","review_comments_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/4/comments","review_comment_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/issues/4/comments","statuses_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/statuses/4a19378ff8d6546dd4673defe2d0079fe53703c6","head":{"label":"craft-ai:learning","ref":"learning","sha":"4a19378ff8d6546dd4673defe2d0079fe53703c6","user":{"login":"craft-ai","id":12046764,"avatar_url":"https://avatars.githubusercontent.com/u/12046764?v=3","gravatar_id":"","url":"https://api.github.com/users/craft-ai","html_url":"https://github.com/craft-ai","followers_url":"https://api.github.com/users/craft-ai/followers","following_url":"https://api.github.com/users/craft-ai/following{/other_user}","gists_url":"https://api.github.com/users/craft-ai/gists{/gist_id}","starred_url":"https://api.github.com/users/craft-ai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craft-ai/subscriptions","organizations_url":"https://api.github.com/users/craft-ai/orgs","repos_url":"https://api.github.com/users/craft-ai/repos","events_url":"https://api.github.com/users/craft-ai/events{/privacy}","received_events_url":"https://api.github.com/users/craft-ai/received_events","type":"Organization","site_admin":false},"repo":{"id":46927866,"name":"craft-ai-starterkit-nodejs","full_name":"craft-ai/craft-ai-starterkit-nodejs","owner":{"login":"craft-ai","id":12046764,"avatar_url":"https://avatars.githubusercontent.com/u/12046764?v=3","gravatar_id":"","url":"https://api.github.com/users/craft-ai","html_url":"https://github.com/craft-ai","followers_url":"https://api.github.com/users/craft-ai/followers","following_url":"https://api.github.com/users/craft-ai/following{/other_user}","gists_url":"https://api.github.com/users/craft-ai/gists{/gist_id}","starred_url":"https://api.github.com/users/craft-ai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craft-ai/subscriptions","organizations_url":"https://api.github.com/users/craft-ai/orgs","repos_url":"https://api.github.com/users/craft-ai/repos","events_url":"https://api.github.com/users/craft-ai/events{/privacy}","received_events_url":"https://api.github.com/users/craft-ai/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/craft-ai/craft-ai-starterkit-nodejs","description":"Start using craft ai in a node js app using the official client (https://www.npmjs.com/package/craft-ai)","fork":false,"url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs","forks_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/forks","keys_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/teams","hooks_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/hooks","issue_events_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/issues/events{/number}","events_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/events","assignees_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/assignees{/user}","branches_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/branches{/branch}","tags_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/tags","blobs_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/git/refs{/sha}","trees_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/statuses/{sha}","languages_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/languages","stargazers_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/stargazers","contributors_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/contributors","subscribers_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/subscribers","subscription_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/subscription","commits_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/commits{/sha}","git_commits_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/git/commits{/sha}","comments_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/comments{/number}","issue_comment_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/issues/comments{/number}","contents_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/contents/{+path}","compare_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/merges","archive_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/downloads","issues_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/issues{/number}","pulls_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls{/number}","milestones_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/milestones{/number}","notifications_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/labels{/name}","releases_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/releases{/id}","deployments_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/deployments","created_at":"2015-11-26T13:19:57Z","updated_at":"2016-01-28T13:39:48Z","pushed_at":"2016-09-13T14:59:37Z","git_url":"git://github.com/craft-ai/craft-ai-starterkit-nodejs.git","ssh_url":"git@github.com:craft-ai/craft-ai-starterkit-nodejs.git","clone_url":"https://github.com/craft-ai/craft-ai-starterkit-nodejs.git","svn_url":"https://github.com/craft-ai/craft-ai-starterkit-nodejs","homepage":"","size":16,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":1,"forks":35,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"craft-ai:master","ref":"master","sha":"949ba871103879bb523960433477e1a8eedfdb03","user":{"login":"craft-ai","id":12046764,"avatar_url":"https://avatars.githubusercontent.com/u/12046764?v=3","gravatar_id":"","url":"https://api.github.com/users/craft-ai","html_url":"https://github.com/craft-ai","followers_url":"https://api.github.com/users/craft-ai/followers","following_url":"https://api.github.com/users/craft-ai/following{/other_user}","gists_url":"https://api.github.com/users/craft-ai/gists{/gist_id}","starred_url":"https://api.github.com/users/craft-ai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craft-ai/subscriptions","organizations_url":"https://api.github.com/users/craft-ai/orgs","repos_url":"https://api.github.com/users/craft-ai/repos","events_url":"https://api.github.com/users/craft-ai/events{/privacy}","received_events_url":"https://api.github.com/users/craft-ai/received_events","type":"Organization","site_admin":false},"repo":{"id":46927866,"name":"craft-ai-starterkit-nodejs","full_name":"craft-ai/craft-ai-starterkit-nodejs","owner":{"login":"craft-ai","id":12046764,"avatar_url":"https://avatars.githubusercontent.com/u/12046764?v=3","gravatar_id":"","url":"https://api.github.com/users/craft-ai","html_url":"https://github.com/craft-ai","followers_url":"https://api.github.com/users/craft-ai/followers","following_url":"https://api.github.com/users/craft-ai/following{/other_user}","gists_url":"https://api.github.com/users/craft-ai/gists{/gist_id}","starred_url":"https://api.github.com/users/craft-ai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craft-ai/subscriptions","organizations_url":"https://api.github.com/users/craft-ai/orgs","repos_url":"https://api.github.com/users/craft-ai/repos","events_url":"https://api.github.com/users/craft-ai/events{/privacy}","received_events_url":"https://api.github.com/users/craft-ai/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/craft-ai/craft-ai-starterkit-nodejs","description":"Start using craft ai in a node js app using the official client (https://www.npmjs.com/package/craft-ai)","fork":false,"url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs","forks_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/forks","keys_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/teams","hooks_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/hooks","issue_events_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/issues/events{/number}","events_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/events","assignees_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/assignees{/user}","branches_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/branches{/branch}","tags_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/tags","blobs_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/git/refs{/sha}","trees_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/statuses/{sha}","languages_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/languages","stargazers_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/stargazers","contributors_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/contributors","subscribers_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/subscribers","subscription_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/subscription","commits_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/commits{/sha}","git_commits_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/git/commits{/sha}","comments_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/comments{/number}","issue_comment_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/issues/comments{/number}","contents_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/contents/{+path}","compare_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/merges","archive_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/downloads","issues_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/issues{/number}","pulls_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls{/number}","milestones_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/milestones{/number}","notifications_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/labels{/name}","releases_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/releases{/id}","deployments_url":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/deployments","created_at":"2015-11-26T13:19:57Z","updated_at":"2016-01-28T13:39:48Z","pushed_at":"2016-09-13T14:59:37Z","git_url":"git://github.com/craft-ai/craft-ai-starterkit-nodejs.git","ssh_url":"git@github.com:craft-ai/craft-ai-starterkit-nodejs.git","clone_url":"https://github.com/craft-ai/craft-ai-starterkit-nodejs.git","svn_url":"https://github.com/craft-ai/craft-ai-starterkit-nodejs","homepage":"","size":16,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":1,"forks":35,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/4"},"html":{"href":"https://github.com/craft-ai/craft-ai-starterkit-nodejs/pull/4"},"issue":{"href":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/issues/4"},"comments":{"href":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/craft-ai/craft-ai-starterkit-nodejs/statuses/4a19378ff8d6546dd4673defe2d0079fe53703c6"}}}}
{"actor":{"display_login":"cloderic"}}