@indra.ai/deva 1.8.1 → 1.8.2

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/config/index.js CHANGED
@@ -87,6 +87,31 @@ export default {
87
87
  prev_key: 'stop',
88
88
  next_key: false,
89
89
  onfunc: 'onExit',
90
+ clear: [
91
+ '_active',
92
+ '_indra',
93
+ '_veda',
94
+ '_license',
95
+ '_data',
96
+ '_error',
97
+ '_log',
98
+ '_report',
99
+ '_vector',
100
+ '_king',
101
+ '_treasury',
102
+ '_security',
103
+ '_guard',
104
+ '_defense',
105
+ '_wall',
106
+ '_proxy',
107
+ '_legal',
108
+ '_authority',
109
+ '_justice',
110
+ '_support',
111
+ '_services',
112
+ '_systems',
113
+ '_networks',
114
+ ]
90
115
  }
91
116
  },
92
117
  context: false,
@@ -43,6 +43,8 @@
43
43
  "put": "🤝 Put",
44
44
  "push": "🫸 Push",
45
45
  "pull": "👉 Pull",
46
+ "while": "🔁 While",
47
+ "loop": "🔃 Loop",
46
48
  "search": "🔎 Search",
47
49
  "memory": "💭 Memory",
48
50
  "signature": "✍️️ Signature",
package/index.js CHANGED
@@ -1489,66 +1489,55 @@ class Deva {
1489
1489
  ***************/
1490
1490
  exit(data) {
1491
1491
  if (!this._active) return this._messages.offline;
1492
- data.key_prev = data.key;
1493
- data.key = 'exit';
1494
- this.context(data.key, data.id.uid);
1495
- this.zone(data.key, data.id.uid);
1496
- this.action(data.key, data.id.uid);
1497
- this.state(data.key, data.id.uid); // set the state to stop
1498
-
1499
- this.action('delete', `${data.key_prev}:md5:${data.id.uid}`);
1492
+ const {key, prev_key, next_key, onfunc} = config.invoke.exit;
1493
+ data.key = key;
1494
+
1495
+ this.context(key, data.id.uid);
1496
+ this.zone(key, data.id.uid);
1497
+ this.action(key, data.id.uid);
1498
+ this.state(key, data.id.uid); // set the state to stop
1499
+
1500
+ this.action('delete', `${prev_key}:md5:${data.id.uid}`);
1500
1501
  delete data.md5;
1501
- this.action('delete', `${data.key_prev}:sha256:${data.id.uid}`);
1502
+ this.action('delete', `${prev_key}:sha256:${data.id.uid}`);
1502
1503
  delete data.sha256;
1503
- this.action('delete', `${data.key_prev}:sha512:${data.id.uid}`);
1504
+ this.action('delete', `${prev_key}:sha512:${data.id.uid}`);
1504
1505
  delete data.sha512;
1505
1506
 
1506
- this.state('set', `${data.key}:time:${data.id.uid}`); // state stop agent
1507
+ this.state('data', `${key}:time:${data.id.uid}`); // state stop agent
1507
1508
  data.exit = Date.now();
1508
1509
 
1509
- this.action('hash', `${data.key}:md5:${data.id.uid}`);
1510
+ this.action('hash', `${key}:md5:${data.id.uid}`);
1510
1511
  data.md5 = this.hash(data, 'md5');
1511
- this.action('hash', `${data.key}:sha256:${data.id.uid}`)
1512
+ this.action('hash', `${key}:sha256:${data.id.uid}`)
1512
1513
  data.sha256 = this.hash(data, 'sha256');
1513
- this.action('hash', `${data.key}:sha512:${data.id.uid}`)
1514
+ this.action('hash', `${key}:sha512:${data.id.uid}`)
1514
1515
  data.sha512 = this.hash(data, 'sha512');
1515
1516
 
1516
- // clear memory
1517
- this._active = false; // the active/birth date.
1518
- this._indra = false; // inherited Indra features.
1519
- this._veda = false; // inherited Veda features.
1520
- this._license = false; // inherited License features.
1521
- this._data = false; // inherited Data features.
1522
- this._error = false; // inherited Error features.
1523
- this._log = false; // inherited Log features.
1524
- this._report = false; // inherited Report features.
1525
- this._vector = false; // inherited Vector features.
1526
- this._king = false; // inherited King features.
1527
- this._treasury = false; // inherited Vector features.
1528
- this._security = false; // inherited Security features.
1529
- this._guard = false; // inherited Guard features.
1530
- this._defense = false; // inherited Security features.
1531
- this._wall = false; // inherited Wall features.
1532
- this._proxy = false; // inherited Proxy features.
1533
- this._legal = false; // inherited Legal features.
1534
- this._authority = false; // inherited Justice features.
1535
- this._justice = false; // inherited Justice features.
1536
- this._support = false; // inherited Support features.
1537
- this._services = false; // inherited Service features.
1538
- this._systems = false; // inherited Systems features.
1539
- this._networks = false; // inherited Systems features.
1517
+ // clear memory from config.invoke.exit.clear
1518
+
1519
+ this.state('loop', `${key}:clear:${data.id.uid}`);
1520
+ for (let item of config.invoke.exit.clear) {
1521
+ this[item] = false;
1522
+ }
1540
1523
 
1541
1524
  this.action('talk', `${this._events.stop}:${data.id.uid}`); // action talk for the event.
1542
1525
  this.talk(this._events.exit, data);
1543
1526
 
1544
1527
  const hasOnExit = this.onExit && typeof this.onExit === 'function';
1545
1528
  if (hasOnExit) {
1546
- this.action('onfunc', `hasOnExit:${data.id.uid}`); // action onfunc
1547
- this.state('onfunc', `hasOnExit:${data.id.uid}`); // state onfunc
1529
+ this.action('onfunc', `${onfunc}:${data.id.uid}`); // action onfunc
1530
+ this.state('onfunc', `${onfunc}:${data.id.uid}`); // state onfunc
1531
+ this.action('return', `${onfunc}:${data.id.uid}`); // state onfunc
1532
+ this.state('valid', `${onfunc}:${data.id.uid}`); // state onfunc
1533
+ this.intent('good', `${onfunc}:${data.id.uid}`); // state onfunc
1534
+ return this[onfunc](data);
1548
1535
  }
1549
1536
 
1550
- this.action('resolve', `exit:${data.uid}`);
1551
- return hasOnExit ? this.onExit(data) : Promise.resolve(data)
1537
+ this.action('resolve', `${key}:${data.uid}`);
1538
+ this.state('valid', `${key}:${data.uid}`);
1539
+ this.intent('good', `${key}:${data.uid}`);
1540
+ return Promise.resolve(data)
1552
1541
  }
1553
1542
 
1554
1543
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "44091450722329207445",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.8.1",
4
+ "version": "1.8.2",
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:44091450722329207445 LICENSE.md",