@indra.ai/deva 1.1.42 → 1.1.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +7 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -997,7 +997,7 @@ class Deva {
997
997
 
998
998
  const agent = this.agent() || false;
999
999
  const client = this.client() || false;
1000
- packet.a = { // setup the packet.a container
1000
+ const packet_answer = { // setup the packet.a container
1001
1001
  id: this.uid(),
1002
1002
  agent, // set the agent who answered the question
1003
1003
  client, // set the client asking the question
@@ -1014,14 +1014,15 @@ class Deva {
1014
1014
 
1015
1015
  // create a hash for the answer and insert into answer meta.
1016
1016
  this.action('answer_hash');
1017
- packet.a.meta.hash = this.hash(JSON.stringify(packet.a));
1017
+ packet_answer.meta.hash = this.hash(JSON.stringify(packet_answer));
1018
1018
 
1019
+ packet.a = this.copy(packet_answer);
1019
1020
  this.action('packet_hash');
1020
1021
  packet.hash = this.hash(JSON.stringify(packet)); // hash the entire packet.
1021
1022
 
1022
1023
 
1023
1024
  this.action('answer_talk');
1024
- this.talk('devacore:answer', this.copy(packet)); // talk the answer with a copy of the data
1025
+ this.talk('devacore:answer', packet); // talk the answer with a copy of the data
1025
1026
 
1026
1027
  return resolve(packet); // resolve the packet to the caller.
1027
1028
  }).catch(err => { // catch any errors in the method
@@ -1416,7 +1417,7 @@ class Deva {
1416
1417
  created: Date.now(),
1417
1418
  };
1418
1419
  _data.hash = this.hash(JSON.stringify(_data));
1419
- this.talk('feature', _data);
1420
+ this.talk('devacore:feature', _data);
1420
1421
  } catch (e) {
1421
1422
  return this.error(e);
1422
1423
  }
@@ -1641,7 +1642,7 @@ class Deva {
1641
1642
  return new Promise((resolve, reject) => {
1642
1643
  this.state('load');
1643
1644
  this.devas[key].init(client).then(loaded => {
1644
- this.talk(`deva:load`, {
1645
+ this.talk(`devacore:load`, {
1645
1646
  key,
1646
1647
  created: Date.now(),
1647
1648
  });
@@ -1663,7 +1664,7 @@ class Deva {
1663
1664
  try {
1664
1665
  this.state('uload');
1665
1666
  delete this.devas[key];
1666
- this.talk(`unload`, {
1667
+ this.talk(`devacore:unload`, {
1667
1668
  key,
1668
1669
  created: Date.now(),
1669
1670
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.1.42",
3
+ "version": "1.1.43",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {