@indra.ai/deva 1.60.5 โ†’ 1.60.7

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Deva Core
2
2
 
3
- **`@indra.ai/deva` ยท v1.60.2**
3
+ **`@indra.ai/deva`**
4
4
 
5
5
  Deva Core is a Vedic-inspired, event-based, context-aware Feature, Zone, Action and State machine framework for building integrated artificial intelligence agents ("Devas") in Node.js. Every Deva is one `Deva` class instance on a shared event bus. As it works, it moves through named features, zones, actions, states, intents, beliefs and contexts, and it broadcasts each step as an event. Every packet it builds is stamped with cumulative md5, sha256 and sha512 hashes.
6
6
 
@@ -77,7 +77,7 @@ const hello = new Deva({
77
77
  hello.init(client);
78
78
  ```
79
79
 
80
- Run it with `node hello.mjs` and it prints `hello world`. This sample was run against v1.60.2.
80
+ Run it with `node examples/hello-world.js` and it prints `hello world`.
81
81
 
82
82
  Three things to know from this example:
83
83
 
package/index.js CHANGED
@@ -1223,20 +1223,19 @@ class Deva {
1223
1223
  }).then(() => {
1224
1224
  const hasOnInit = this.onInit && typeof this.onInit === 'function';
1225
1225
  if (hasOnInit) {
1226
- this.action('onfunc', `hasOnInit:${data.id.uid}`); // state set to watch onInit
1227
- this.state('onfunc', `hasOnInit:${data.id.uid}`); // state set to watch onInit
1228
- this.intent('good', `onInit:${data.id.uid}`); // state set to watch onInit
1229
- this.action('return', `onInit:${data.id.uid}`);
1226
+ this.action('onfunc', `onInit:${data.id.uid}`); // action set to onfunc
1227
+ this.state('onfunc', `onInit:${data.id.uid}`); // state set to onfunc
1228
+ this.intent('good', `onInit:${data.id.uid}`); // intent set to good
1229
+ this.action('return', `onInit:${data.id.uid}`); // action set to return
1230
1230
  return this.onInit(data, resolve);
1231
1231
  }
1232
- this.action('return', `init:${data.id.uid}`);
1233
- this.state('valid', `init:${data.id.uid}`); // state set to watch onInit
1234
- this.intent('good', `init:${data.id.uid}`); // state set to watch onInit
1235
-
1232
+ this.action('return', `init:${data.id.uid}`); // action set to return
1233
+ this.state('valid', `init:${data.id.uid}`); // state set to valid
1234
+ this.intent('good', `init:${data.id.uid}`); // intent set to good
1236
1235
  return this.start(data, resolve);
1237
1236
  }).catch(err => {
1238
- this.state('catch', `init:${data.id.uid}`);
1239
- this.intent('bad', `init:${data.id.uid}`); // state set to watch onInit
1237
+ this.state('catch', `init:${data.id.uid}`); // state set to catch
1238
+ this.intent('bad', `init:${data.id.uid}`); // intent set to bad
1240
1239
  return this.err(err, client, reject);
1241
1240
  });
1242
1241
  });
@@ -1281,10 +1280,10 @@ class Deva {
1281
1280
  /**************
1282
1281
  func: done
1283
1282
  params:
1284
- - data: hte message from the caller incase need to use in calls
1283
+ - data: the message from the caller incase need to use in calls
1285
1284
  describe:
1286
1285
  When the done function is triggered the system will also set the state
1287
- of hte Deva to done.
1286
+ of the Deva to done.
1288
1287
 
1289
1288
  If the deva is offline it will return the offline message.
1290
1289
  usage: this.done('msg')
@@ -1322,26 +1321,27 @@ class Deva {
1322
1321
  }
1323
1322
  }
1324
1323
 
1325
- const key_len = Object.keys(this.devas).length
1326
- let x = 1;
1324
+ const key_len = Object.keys(this.devas).length // check the key length for looping
1325
+ let x = 1; // let x equal one for iteration.
1327
1326
  if (this.devas && key_len) {
1328
- this.state('loop', `${key}:devas:${data.id.uid}`);
1327
+ this.state('loop', `${key}:devas:${data.id.uid}`); // set the state to loop
1329
1328
  for (let deva in this.devas) {
1329
+ // load the deva with client data
1330
1330
  await this.load(deva, data.client).then(async entity => {
1331
- const id = this.uid();
1332
- const {dir} = this.devas[deva].info();
1333
- const deva_agent = this.devas[deva].agent();
1334
- this.talk(`deva:dir`, {id, key:deva_agent.key, dir});
1331
+ const id = this.uid(); // generate a new uid
1332
+ const {dir} = this.devas[deva].info(); // get the base directory for the Deva from the info()
1333
+ const deva_agent = this.devas[deva].agent(); // get the agent data from the deva.
1334
+ this.talk(`deva:dir`, {id, key:deva_agent.key, dir}); // talk the deva dir event to setup tracking the Deva directories
1335
1335
  if (x === key_len) {
1336
1336
  setImmediate(() => {
1337
- return this._invoke({key,data,resolve});
1337
+ return this._invoke({key,data,resolve}); // invoke the deva with the proper key, data, and resolve.
1338
1338
  });
1339
1339
  }
1340
- x = x + 1;
1340
+ x = x + 1; // increment the iterator for key_len matching
1341
1341
  });
1342
1342
  }
1343
1343
  }
1344
- else return this._invoke({key,data,resolve});
1344
+ else return this._invoke({key,data,resolve}); // else run the key invoke.
1345
1345
  }
1346
1346
 
1347
1347
  /**************
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "23221940810208468106",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.60.5",
4
+ "version": "1.60.7",
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",
package/tests/agent.json CHANGED
@@ -67,7 +67,8 @@
67
67
  "test": "๐Ÿ’ฟ Test Data",
68
68
  "prompt": "๐Ÿ’ป Prompt",
69
69
  "feature": "๐Ÿฟ Feature",
70
- "zone": "๐Ÿ—ป Zone"
70
+ "zone": "๐Ÿ—ป Zone",
71
+ "hello": "๐ŸŒŽ Hello World"
71
72
  }
72
73
  }
73
74
  }