@indra.ai/deva 1.29.6 → 1.29.8

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 +21 -31
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -360,13 +360,13 @@ class Deva {
360
360
  this.action('return', `${onfunc}:${data.id.uid}`); // action return
361
361
  this.state('valid', `${onfunc}:${data.id.uid}`); // state valid
362
362
  this.intent('good', `${onfunc}:${data.id.uid}`); // intent good
363
- return this[onfunc](data, resolve);
363
+ return this[onfunc](data, resolve);
364
364
  }
365
-
365
+
366
366
  this.action('return', `${key}:${data.id.uid}`); // return action complete
367
367
  this.state('valid', `${key}:${data.id.uid}`); // return state valid
368
368
  this.intent('good', `${key}:${data.id.uid}`); // return intent good
369
- return next_key ? this[next_key](data, resolve) : resolve(data);
369
+ return next_key ? this[next_key](data, resolve) : resolve(data);
370
370
  }
371
371
 
372
372
  /**************
@@ -1346,7 +1346,7 @@ class Deva {
1346
1346
  sequence. This design preserves language-agnostic interoperability and
1347
1347
  deterministic state transitions across Deva systems.
1348
1348
  ***************/
1349
- start(data, resolve) {
1349
+ async start(data, resolve) {
1350
1350
  if (!this._active) return resolve(this._messages.offline);
1351
1351
  return this._invoke({key:'start',data,resolve});
1352
1352
  }
@@ -1362,7 +1362,7 @@ class Deva {
1362
1362
  If the Deva is offline it will return the offline message.
1363
1363
  usage: this.enter('msg')
1364
1364
  ***************/
1365
- enter(data, resolve) {
1365
+ async enter(data, resolve) {
1366
1366
  if (!this._active) return resolve(this._messages.offline);
1367
1367
  return this._invoke({key:'enter',data,resolve});
1368
1368
  }
@@ -1381,6 +1381,7 @@ class Deva {
1381
1381
  done(data, resolve) {
1382
1382
  if (!this._active) return resolve(this._messages.offline);
1383
1383
  return this._invoke({key:'done',data,resolve});
1384
+
1384
1385
  }
1385
1386
 
1386
1387
  /**************
@@ -1391,7 +1392,7 @@ class Deva {
1391
1392
  describe: This function is use to relay the to the ready state.
1392
1393
  usage: this.ready(data, resolve)
1393
1394
  ***************/
1394
- async ready(data, resolve) {
1395
+ ready(data, resolve) {
1395
1396
  if (!this._active) return resolve(this._messages.offline);
1396
1397
  const key = 'ready';
1397
1398
 
@@ -1409,30 +1410,19 @@ class Deva {
1409
1410
  this.config.hash[agent.key][item] = this.hash(this_item, 'sha256');
1410
1411
  }
1411
1412
  }
1412
- // check if the entity has devas to load after everything is ready.
1413
- // load the devas
1414
- let deva;
1415
- try {
1416
- if (this.devas && Object.keys(this.devas).length) {
1417
- for (deva in this.devas) {
1418
- await this.load(deva, data.client);
1419
- // after the deva loads talk the event to set asset directory.
1420
- const id = this.devas[deva].uid();
1421
- const {dir} = this.devas[deva].info();
1422
- const {key} = this.devas[deva].agent();
1423
- this.talk(`deva:dir`, {id, key,dir});
1424
- }
1425
- }
1426
- }
1427
- catch (err) {
1428
- return this.err(err, deva);
1429
- }
1430
- finally {
1431
- // return the invoke in a set immediate so it runs after the loop
1432
- return setImmediate(() => {
1433
- return this._invoke({key,data,resolve});
1434
- });
1413
+
1414
+ if (this.devas && Object.keys(this.devas).length) {
1415
+ for (let deva in this.devas) {
1416
+ this.load(deva, data.client);
1417
+ // after the deva loads talk the event to set asset directory.
1418
+ const id = this.uid();
1419
+ const {dir} = this.devas[deva].info();
1420
+ const {key} = this.devas[deva].agent();
1421
+ this.talk(`deva:dir`, {id, key,dir});
1422
+ }
1435
1423
  }
1424
+
1425
+ return this._invoke({key,data,resolve});
1436
1426
  }
1437
1427
 
1438
1428
  /**************
@@ -2160,12 +2150,12 @@ class Deva {
2160
2150
  -deva: The Deva model to load.
2161
2151
  describe: This function will enable fast loading of Deva into the system.
2162
2152
  ***************/
2163
- async load(key, client) {
2153
+ load(key, client) {
2164
2154
  this.zone('load', key);
2165
2155
  this.action('load', key);
2166
2156
  this.state('load', key);
2167
2157
  this.intent('good', `load:${key}`);
2168
- return await this.devas[key].init(client);
2158
+ return this.devas[key].init(client);
2169
2159
  }
2170
2160
 
2171
2161
  /**************
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "38159520729793885324",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.29.6",
4
+ "version": "1.29.8",
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:38159520729793885324 LICENSE.md",