@indra.ai/deva 1.6.98 → 1.6.100
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 +8 -0
- package/config/zones.json +2 -1
- package/index.js +39 -23
- package/package.json +1 -1
package/config/index.js
CHANGED
package/config/zones.json
CHANGED
package/index.js
CHANGED
|
@@ -16,6 +16,7 @@ class Deva {
|
|
|
16
16
|
this._id = opts.id || randomUUID(); // the unique id assigned to the agent at load
|
|
17
17
|
this._info = opts.info || false; // the deva information from the package file.
|
|
18
18
|
this._config = opts.config || {}; // local Config Object
|
|
19
|
+
this._config.ready_hash = config.ready_hash; // items to hash at ready
|
|
19
20
|
this._agent = opts.agent || false; // Agent profile object
|
|
20
21
|
this._client = {}; // this will be set on init.
|
|
21
22
|
this._active = false; // the active/birth date.
|
|
@@ -64,7 +65,6 @@ class Deva {
|
|
|
64
65
|
|
|
65
66
|
this._uid = config.uid; // set the uid options
|
|
66
67
|
|
|
67
|
-
|
|
68
68
|
this._events = config.events; // set the core system events
|
|
69
69
|
this._feature = config.feature; // set the feature from config data.
|
|
70
70
|
this._features = config.features; // set the features from config data.
|
|
@@ -1227,6 +1227,9 @@ class Deva {
|
|
|
1227
1227
|
this.action('ready', data.id.uid);
|
|
1228
1228
|
this.state('ready', data.id.uid);
|
|
1229
1229
|
|
|
1230
|
+
const agent = this.agent();
|
|
1231
|
+
const client = this.client();
|
|
1232
|
+
|
|
1230
1233
|
// Delete previous data hashes
|
|
1231
1234
|
this.action('delete', `done:md5:${data.id.uid}`);
|
|
1232
1235
|
delete data.md5;
|
|
@@ -1238,6 +1241,16 @@ class Deva {
|
|
|
1238
1241
|
this.state('set', `data:value:ready:${data.id.uid}`); // state set to watch OnFinish
|
|
1239
1242
|
data.value = 'ready';
|
|
1240
1243
|
|
|
1244
|
+
this.state('set', `config:hash:${data.id.uid}`); // state set to watch OnFinish
|
|
1245
|
+
this.config.hash[agent.key] = {};
|
|
1246
|
+
for (let item of this._config.ready_hash) {
|
|
1247
|
+
if (this[item]) {
|
|
1248
|
+
const this_item = this[item];
|
|
1249
|
+
this.action('hash', `${agent.key}:config:${item}:${data.id.uid}`);
|
|
1250
|
+
this.config.hash[agent.key][item] = this.hash(this_item, 'sha256');
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1241
1254
|
this.action('hash', `ready:md5:${data.id.uid}`);
|
|
1242
1255
|
data.md5 = this.hash(data, 'md5');
|
|
1243
1256
|
this.action('hash', `ready:sha256:${data.id.uid}`)
|
|
@@ -1248,6 +1261,7 @@ class Deva {
|
|
|
1248
1261
|
this.action('talk', `${this._events.ready}:${data.id.uid}`);
|
|
1249
1262
|
this.talk(this._events.ready, data);
|
|
1250
1263
|
|
|
1264
|
+
|
|
1251
1265
|
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
1252
1266
|
if (hasOnReady) {
|
|
1253
1267
|
this.action('onfunc', `hasOnReady:${data.id.uid}`); // action onfunc
|
|
@@ -1369,12 +1383,13 @@ class Deva {
|
|
|
1369
1383
|
stop() {
|
|
1370
1384
|
if (!this._active) return this._messages.offline;
|
|
1371
1385
|
const id = this.uid();
|
|
1372
|
-
|
|
1373
|
-
this.
|
|
1374
|
-
this.
|
|
1375
|
-
this.
|
|
1386
|
+
const key = 'stop';
|
|
1387
|
+
this.context(key, id.uid);
|
|
1388
|
+
this.zone(key, id.uid);
|
|
1389
|
+
this.action(key, id.uid);
|
|
1390
|
+
this.state(key, id.uid); // set the state to stop
|
|
1376
1391
|
|
|
1377
|
-
this.state('set',
|
|
1392
|
+
this.state('set', `${key}:agent:${id.uid}`); // state stop agent
|
|
1378
1393
|
const agent = this.agent(); // get the current agent
|
|
1379
1394
|
|
|
1380
1395
|
this.state('set', `stop:client:${id.uid}`); // state stop agent
|
|
@@ -1383,10 +1398,10 @@ class Deva {
|
|
|
1383
1398
|
this.state('data', `stop:${id.uid}`);
|
|
1384
1399
|
const data = { // build the stop data
|
|
1385
1400
|
id, // set the id
|
|
1386
|
-
key
|
|
1387
|
-
value:
|
|
1388
|
-
agent:
|
|
1389
|
-
client:
|
|
1401
|
+
key, // set the key
|
|
1402
|
+
value: agent.key, // set the value
|
|
1403
|
+
agent: agent.sha256, // set the agent
|
|
1404
|
+
client: client.sha256, // set the client
|
|
1390
1405
|
stop: Date.now(), // set the created date
|
|
1391
1406
|
}
|
|
1392
1407
|
|
|
@@ -1423,27 +1438,28 @@ class Deva {
|
|
|
1423
1438
|
***************/
|
|
1424
1439
|
exit(data) {
|
|
1425
1440
|
if (!this._active) return this._messages.offline;
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
this.
|
|
1429
|
-
this.
|
|
1430
|
-
this.
|
|
1431
|
-
|
|
1432
|
-
|
|
1441
|
+
data.key_prev = data.key;
|
|
1442
|
+
data.key = 'exit';
|
|
1443
|
+
this.context(data.key, data.id.uid);
|
|
1444
|
+
this.zone(data.key, data.id.uid);
|
|
1445
|
+
this.action(data.key, data.id.uid);
|
|
1446
|
+
this.state(data.key, data.id.uid); // set the state to stop
|
|
1447
|
+
|
|
1448
|
+
this.action('delete', `${data.key_prev}:md5:${data.id.uid}`);
|
|
1433
1449
|
delete data.md5;
|
|
1434
|
-
this.action('delete',
|
|
1450
|
+
this.action('delete', `${data.key_prev}:sha256:${data.id.uid}`);
|
|
1435
1451
|
delete data.sha256;
|
|
1436
|
-
this.action('delete',
|
|
1452
|
+
this.action('delete', `${data.key_prev}:sha512:${data.id.uid}`);
|
|
1437
1453
|
delete data.sha512;
|
|
1438
1454
|
|
|
1439
|
-
this.state('set',
|
|
1455
|
+
this.state('set', `${data.key}:time:${data.id.uid}`); // state stop agent
|
|
1440
1456
|
data.exit = Date.now();
|
|
1441
1457
|
|
|
1442
|
-
this.action('hash',
|
|
1458
|
+
this.action('hash', `${data.key}:md5:${data.id.uid}`);
|
|
1443
1459
|
data.md5 = this.hash(data, 'md5');
|
|
1444
|
-
this.action('hash',
|
|
1460
|
+
this.action('hash', `${data.key}:sha256:${data.id.uid}`)
|
|
1445
1461
|
data.sha256 = this.hash(data, 'sha256');
|
|
1446
|
-
this.action('hash',
|
|
1462
|
+
this.action('hash', `${data.key}:sha512:${data.id.uid}`)
|
|
1447
1463
|
data.sha512 = this.hash(data, 'sha512');
|
|
1448
1464
|
|
|
1449
1465
|
// clear memory
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "44091450722329207445",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.100",
|
|
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",
|