@indra.ai/deva 1.54.0 → 1.54.6

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 +24 -10
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -151,13 +151,11 @@ class Deva {
151
151
  }
152
152
  }
153
153
  });
154
+ return resolve(); // when the configuration is complete then return an empty resolve.
154
155
  }
155
156
  catch (e) {
156
157
  return this.err(e, false, reject); // trigger the this.err for errors
157
158
  }
158
- finally {
159
- return resolve(); // when the configuration is complete then return an empty resolve.
160
- }
161
159
  });
162
160
  }
163
161
 
@@ -186,13 +184,11 @@ class Deva {
186
184
  return this.listeners[listener](packet); // return the listener function
187
185
  })
188
186
  }
187
+ return resolve(); // resolve the function after everything is done.
189
188
  }
190
189
  catch (e) {
191
190
  return this.err(e, false, reject); // pass errors to this.err
192
191
  }
193
- finally {
194
- return resolve(); // resolve the function after everything is done.
195
- }
196
192
  });
197
193
  }
198
194
 
@@ -309,7 +305,7 @@ class Deva {
309
305
  if (!config.invoke[key]) return resolve (this._messages.invalidkey);
310
306
  if (!data) return resolve (this._messages.nodata);
311
307
 
312
- const {prev_key, next_key, onfunc, clear, load} = config.invoke[key];
308
+ const {next_key, onfunc, clear} = config.invoke[key];
313
309
  this.action('invoke', `${key}:${data.id.uid}`);
314
310
  this.context(key, data.id.uid);
315
311
  this.zone(key, data.id.uid);
@@ -1089,6 +1085,10 @@ class Deva {
1089
1085
  init(client) {
1090
1086
  // set client
1091
1087
  return new Promise((resolve, reject) => {
1088
+ // set the core hashes
1089
+ this._core.md5 = this.hash(this._core, 'md5'); // md5 the core and created.
1090
+ this._core.sha256 = this.hash(this._core, 'sha256'); // sha256 the core, created, md5
1091
+ this._core.sha512 = this.hash(this._core, 'sha512'); // sha512 the core, created, md5, sha256.
1092
1092
 
1093
1093
  const license_check = this.license_check(client.VLA, this._core.VLA);
1094
1094
  if (!license_check) {
@@ -1110,7 +1110,8 @@ class Deva {
1110
1110
  text: this._messages.init,
1111
1111
  created: Date.now(),
1112
1112
  }
1113
-
1113
+
1114
+
1114
1115
  this.action('hash', `start:md5:${data.id.uid}`);
1115
1116
  data.md5 = this.hash(data, 'md5');
1116
1117
 
@@ -1184,6 +1185,7 @@ class Deva {
1184
1185
  this.action('return', `init:${data.id.uid}`);
1185
1186
  this.state('valid', `init:${data.id.uid}`); // state set to watch onInit
1186
1187
  this.intent('good', `init:${data.id.uid}`); // state set to watch onInit
1188
+
1187
1189
  return this.start(data, resolve);
1188
1190
  }).catch(err => {
1189
1191
  this.state('catch', `init:${data.id.uid}`);
@@ -2013,7 +2015,11 @@ class Deva {
2013
2015
  const data = this.lib.copy(this._core);
2014
2016
  data.id = id;
2015
2017
  data.created = Date.now();
2016
-
2018
+
2019
+ delete data.md5; // delete old md5 hash
2020
+ delete data.sha256; // delete old sha256 hash
2021
+ delete data.sha512; // delete old sha512 hash
2022
+
2017
2023
  data.md5 = this.hash(data, 'md5');
2018
2024
  data.sha256 = this.hash(data, 'sha256');
2019
2025
  data.sha512 = this.hash(data, 'sha512');
@@ -2166,7 +2172,15 @@ class Deva {
2166
2172
  - reject: An associated promise reject if the caller requires.
2167
2173
  describe:
2168
2174
  The err function provides the consistent error manage of the system.
2175
+
2176
+ If the agent defines an onError function, err hands it (err, packet, reject)
2177
+ and returns its result. In that case the agent owns the outcome: onError must
2178
+ call reject to fail the caller's promise, or the promise will stay pending.
2179
+ If there is no onError function, err calls reject(err) itself.
2180
+
2169
2181
  usage: this.err(err, data, reject);
2182
+
2183
+
2170
2184
  ***************/
2171
2185
  err(err,packet,reject=false) {
2172
2186
  const id = this.uid();
@@ -2251,7 +2265,7 @@ class Deva {
2251
2265
  const {profile} = agent;
2252
2266
  const machine = this.machine(); // get the machine hash
2253
2267
 
2254
- const core_hash = this.hash(this._core, 'sha256');
2268
+ const core_hash = this._core.sha256; // get the core sha256 hash
2255
2269
 
2256
2270
  const warning = this._agent.profile.warning || this._messages.warning; // agent or default warning
2257
2271
  const notice = this._agent.profile.notice || this._messages.notice; // agent or default notice
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "23221940810208468106",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.54.0",
4
+ "version": "1.54.6",
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",
@@ -84,6 +84,6 @@
84
84
  },
85
85
  "engines": {
86
86
  "npm": ">=9.5.1",
87
- "node": ">=18.16.0"
87
+ "node": ">=22"
88
88
  }
89
89
  }