@indra.ai/deva 1.62.2 → 1.62.3

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 +9 -13
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1026,18 +1026,20 @@ class Deva {
1026
1026
  init(client) {
1027
1027
  // set client
1028
1028
  return new Promise((resolve, reject) => {
1029
- // set the core hashes
1029
+ // manually set the core hashes to avoid stack overflow from calls
1030
+ // this is for the early core hashing needed for uid generation.
1030
1031
  this._core.md5 = this.hash(this._core, 'md5'); // md5 the core and created.
1031
1032
  this._core.sha256 = this.hash(this._core, 'sha256'); // sha256 the core, created, md5
1032
1033
  this._core.sha512 = this.hash(this._core, 'sha512'); // sha512 the core, created, md5, sha256.
1033
1034
 
1035
+ // do the core license check on init.
1034
1036
  const license_check = this.license_check(client.VLA, this._core.VLA);
1035
1037
  if (!license_check) {
1036
- this.prompt(this._messages.client_license_invalid);
1038
+ this.prompt(this._messages.client_license_invalid); // set license invalid prompt
1037
1039
  return resolve(this._messages.client_license_invalid); // return if} license check fails
1038
1040
  }
1039
1041
 
1040
- this._active = Date.now();
1042
+ this._active = Date.now(); // after passes license check set _active date.
1041
1043
  const id = this.uid();
1042
1044
  const agent = this.agent();
1043
1045
 
@@ -1052,15 +1054,8 @@ class Deva {
1052
1054
  created: Date.now(),
1053
1055
  }
1054
1056
 
1055
-
1056
- this.action('hash', `start:md5:${data.id.uid}`);
1057
- data.md5 = this.hash(data, 'md5');
1058
-
1059
- this.action('hash', `start:sha256:${data.id.uid}`)
1060
- data.sha256 = this.hash(data, 'sha256');
1061
-
1062
- this.action('hash', `start:sha512:${data.id.uid}`)
1063
- data.sha512 = this.hash(data, 'sha512');
1057
+ // stamp the init data
1058
+ const data_stamped = this._stamp(data, 'init', data.id.uid);
1064
1059
 
1065
1060
  this.events.setMaxListeners(this.maxListeners);
1066
1061
  this._assignInherit().then(() => {
@@ -1110,7 +1105,7 @@ class Deva {
1110
1105
  this.action('return', `init:${data.id.uid}`); // action set to return
1111
1106
  this.state('valid', `init:${data.id.uid}`); // state set to valid
1112
1107
  this.intent('good', `init:${data.id.uid}`); // intent set to good
1113
- return this.start(data, resolve);
1108
+ return this.start(data_stamped, resolve);
1114
1109
  }).catch(err => {
1115
1110
  this.state('catch', `init:${data.id.uid}`); // state set to catch
1116
1111
  this.intent('bad', `init:${data.id.uid}`); // intent set to bad
@@ -1195,6 +1190,7 @@ class Deva {
1195
1190
  if (this[item]) {
1196
1191
  const this_item = this[item];
1197
1192
  this.action('hash', `${agent.key}:config:${item}:${data.id.uid}`);
1193
+ // manually build hash for the config hash object for each agent key.
1198
1194
  this.config.hash[agent.key][item] = this.hash(this_item, 'sha256');
1199
1195
  }
1200
1196
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "23221940810208468106",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.62.2",
4
+ "version": "1.62.3",
5
5
  "description": "Deva Core a Vedic-inspired Event Based Context Aware Feature, Zone, Action, and State Machine integrated Artificial Intelligence Framework",
6
6
  "main": "index.js",
7
7
  "license": "VLA:23221940810208468106 LICENSE.md",