@indra.ai/deva 1.28.2 → 1.29.0

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 +18 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1391,7 +1391,7 @@ class Deva {
1391
1391
  describe: This function is use to relay the to the ready state.
1392
1392
  usage: this.ready(data, resolve)
1393
1393
  ***************/
1394
- ready(data, resolve) {
1394
+ async ready(data, resolve) {
1395
1395
  if (!this._active) return resolve(this._messages.offline);
1396
1396
  const key = 'ready';
1397
1397
 
@@ -1409,7 +1409,23 @@ class Deva {
1409
1409
  this.config.hash[agent.key][item] = this.hash(this_item, 'sha256');
1410
1410
  }
1411
1411
  }
1412
- return this._invoke({key,data,resolve});
1412
+ // check if the entity has devas to load after everything is ready.
1413
+ // load the devas
1414
+ if (this.devas && Object.keys(this.devas).length) {
1415
+ for (let deva in this.devas) {
1416
+ await this.load(deva, data.client);
1417
+ // after the deva loads talk the event to set asset directory.
1418
+ const id = this.devas[deva].uid();
1419
+ const {dir} = this.devas[deva].info();
1420
+ const {key} = this.devas[deva].agent();
1421
+ this.talk(`deva:dir`, {id, key,dir});
1422
+ }
1423
+ setImmediate(() => {
1424
+ // return the invoke in a set immediate so it runs after the loop
1425
+ return this._invoke({key,data,resolve});
1426
+ });
1427
+ }
1428
+ return this._invoke({key,data,resolve});
1413
1429
  }
1414
1430
 
1415
1431
  /**************
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "38159520729793885324",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.28.2",
4
+ "version": "1.29.0",
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",