@indra.ai/deva 1.8.5 β 1.8.6
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/actions.json +3 -0
- package/config/intents.json +4 -1
- package/config/states.json +3 -1
- package/config/zones.json +4 -1
- package/index.js +43 -32
- package/package.json +1 -1
package/config/actions.json
CHANGED
|
@@ -45,7 +45,10 @@
|
|
|
45
45
|
"enter": "πͺ Enter",
|
|
46
46
|
"finish": "π Finish",
|
|
47
47
|
"stop": "π΄ Stop",
|
|
48
|
+
"close": "π¦ Close",
|
|
49
|
+
"leave": "π«£ Leave",
|
|
48
50
|
"exit": "πͺ Exit",
|
|
51
|
+
"shutdown": "π Shutdown",
|
|
49
52
|
"method": "β€οΈβπ₯ Method",
|
|
50
53
|
"func": "π¦ Func",
|
|
51
54
|
"onfunc": "ποΈ onFunction",
|
package/config/intents.json
CHANGED
package/config/states.json
CHANGED
|
@@ -31,9 +31,11 @@
|
|
|
31
31
|
"finish": "π Finish",
|
|
32
32
|
"complete": "β
Complete",
|
|
33
33
|
"stop": "π΄ Stop",
|
|
34
|
+
"close": "π¦ Close",
|
|
35
|
+
"leave": "π«£ Leave",
|
|
34
36
|
"exit": "πͺ Exit",
|
|
37
|
+
"shutdown": "π Shutdown",
|
|
35
38
|
"open": "π₯« Open",
|
|
36
|
-
"close": "π¦ Close",
|
|
37
39
|
"begin": "πΊοΈ Begin",
|
|
38
40
|
"end": "π¬ End",
|
|
39
41
|
"load": "π¦ Load",
|
package/config/zones.json
CHANGED
|
@@ -22,8 +22,11 @@
|
|
|
22
22
|
"init": "π Init",
|
|
23
23
|
"start": "π’ Start",
|
|
24
24
|
"stop": "π΄ Stop",
|
|
25
|
-
"
|
|
25
|
+
"close": "π¦ Close",
|
|
26
|
+
"leave": "π«£ Leave",
|
|
26
27
|
"exit": "πͺ Exit",
|
|
28
|
+
"shutdown": "π Shutdown",
|
|
29
|
+
"enter": "β Enter",
|
|
27
30
|
"finish": "π Finish",
|
|
28
31
|
"complete": "β
Complete",
|
|
29
32
|
"done": "βοΈ Done",
|
package/index.js
CHANGED
|
@@ -1375,32 +1375,39 @@ class Deva {
|
|
|
1375
1375
|
if (!this._active) return this._messages.offline; // check for active status
|
|
1376
1376
|
const key = 'stop'; // set the stop key
|
|
1377
1377
|
const id = this.uid(); // generate the stop uid
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1378
|
+
let data;
|
|
1379
|
+
return new Promise((resolve, reject) => {
|
|
1380
|
+
try {
|
|
1381
|
+
this.state('set', `${key}:agent:${id.uid}`); // state stop agent
|
|
1382
|
+
const agent = this.agent().sha256; // get the current agent
|
|
1383
|
+
const value = agent.key;
|
|
1384
|
+
|
|
1385
|
+
this.state('set', `${key}:client:${id.uid}`); // state stop agent
|
|
1386
|
+
const client = this.client().sha256; // set the current client
|
|
1387
|
+
|
|
1388
|
+
this.state('data', `${key}:${id.uid}`);
|
|
1389
|
+
data = { // build the stop data
|
|
1390
|
+
id, // set the id
|
|
1391
|
+
key, // set the key
|
|
1392
|
+
value, // set the value
|
|
1393
|
+
agent, // set the agent
|
|
1394
|
+
client, // set the client
|
|
1395
|
+
stop: Date.now(), // set the created date
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
this.action('return', `${key}:invoke:${data.id.uid}`);
|
|
1399
|
+
this.state('valid', `${key}:invoke:${data.id.uid}`);
|
|
1400
|
+
this.intent('good', `${key}:invoke:${data.id.uid}`);
|
|
1401
|
+
return this._invoke({
|
|
1402
|
+
key,
|
|
1403
|
+
data,
|
|
1404
|
+
resolve,
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
catch (err) {
|
|
1408
|
+
return this.err(err, data, reject);
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1404
1411
|
}
|
|
1405
1412
|
|
|
1406
1413
|
/**************
|
|
@@ -1414,7 +1421,9 @@ class Deva {
|
|
|
1414
1421
|
***************/
|
|
1415
1422
|
close(data, resolve) {
|
|
1416
1423
|
if (!this._active) return resolve(this._messages.offline);
|
|
1417
|
-
|
|
1424
|
+
const key = 'close';
|
|
1425
|
+
data.key = key;
|
|
1426
|
+
return this._invoke({key,data,resolve});
|
|
1418
1427
|
}
|
|
1419
1428
|
|
|
1420
1429
|
/**************
|
|
@@ -1429,7 +1438,9 @@ class Deva {
|
|
|
1429
1438
|
***************/
|
|
1430
1439
|
leave(data, resolve) {
|
|
1431
1440
|
if (!this._active) return resolve(this._messages.offline);
|
|
1432
|
-
|
|
1441
|
+
const key = 'leave';
|
|
1442
|
+
data.key = key;
|
|
1443
|
+
return this._invoke({key,data,resolve});
|
|
1433
1444
|
}
|
|
1434
1445
|
|
|
1435
1446
|
/**************
|
|
@@ -1443,10 +1454,10 @@ class Deva {
|
|
|
1443
1454
|
Framework.
|
|
1444
1455
|
***************/
|
|
1445
1456
|
exit(data, resolve) {
|
|
1446
|
-
if (!this._active) return this._messages.offline;
|
|
1457
|
+
if (!this._active) return resolve(this._messages.offline);
|
|
1447
1458
|
const key = 'exit';
|
|
1448
1459
|
data.key = key;
|
|
1449
|
-
return this._invoke({key,
|
|
1460
|
+
return this._invoke({key,data,resolve});
|
|
1450
1461
|
}
|
|
1451
1462
|
|
|
1452
1463
|
/**************
|
|
@@ -1460,7 +1471,7 @@ class Deva {
|
|
|
1460
1471
|
function.
|
|
1461
1472
|
***************/
|
|
1462
1473
|
shutdown(data, resolve) {
|
|
1463
|
-
if (!this._active) return this._messages.offline;
|
|
1474
|
+
if (!this._active) return resolve(this._messages.offline);
|
|
1464
1475
|
const key = 'shutdown';
|
|
1465
1476
|
data.key = key;
|
|
1466
1477
|
return this._invoke({key, data, resolve})
|
|
@@ -2035,7 +2046,7 @@ class Deva {
|
|
|
2035
2046
|
} catch (e) {
|
|
2036
2047
|
this.state('catch', `unload:${key}`);
|
|
2037
2048
|
this.intent('bad', `unload:${key}`);
|
|
2038
|
-
return this.err(e,
|
|
2049
|
+
return this.err(e, key, reject)
|
|
2039
2050
|
}
|
|
2040
2051
|
});
|
|
2041
2052
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "44091450722329207445",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.6",
|
|
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",
|