@indra.ai/deva 1.7.1 β†’ 1.8.1

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.
@@ -39,6 +39,7 @@
39
39
  "answer": "πŸ’‘ Answer",
40
40
  "ask": "πŸ“£ Ask",
41
41
  "call": "πŸ“ž Call",
42
+ "wait": "βŒ›οΈ Wait",
42
43
  "init": "🟠 Init",
43
44
  "start": "🟒 Start",
44
45
  "enter": "πŸšͺ Enter",
@@ -102,6 +103,7 @@
102
103
  "target": "🎯 Target",
103
104
  "mature": "πŸ§“ Mature",
104
105
  "immature": "πŸ§’ Immature",
105
- "hash": "#️⃣ Hash"
106
+ "hash": "#️⃣ Hash",
107
+ "romance": "🌹 Romance"
106
108
  }
107
109
  }
@@ -28,10 +28,12 @@
28
28
  "skoptsy": "☦️ Skoptsy",
29
29
  "lds": "πŸ› LDS Church",
30
30
  "pagan": "πŸ§™οΈοΈ Pagan",
31
+ "american": "πŸ‡ΊπŸ‡Έ American",
31
32
  "communists": "πŸ‡·πŸ‡Ί Communist",
32
33
  "nazi": "πŸ’© Nazi",
33
34
  "delusional": "πŸͺ© Delusional",
34
35
  "pervert": "πŸ’‹ Pervert",
36
+ "romance": "🌹 Romance",
35
37
  "other": "πŸ€” Other"
36
38
  }
37
39
  }
package/config/index.js CHANGED
@@ -39,6 +39,56 @@ export default {
39
39
  "func",
40
40
  "methods"
41
41
  ],
42
+ invoke: {
43
+ start: {
44
+ key: 'start',
45
+ prev_key: 'init',
46
+ next_key: 'enter',
47
+ onfunc: 'onStart',
48
+ },
49
+ enter: {
50
+ key: 'enter',
51
+ prev_key: 'start',
52
+ next_key: 'done',
53
+ onfunc: 'onEnter',
54
+ },
55
+ done: {
56
+ key: 'done',
57
+ prev_key: 'enter',
58
+ next_key: 'ready',
59
+ onfunc: 'onDone',
60
+ },
61
+ ready: {
62
+ key: 'ready',
63
+ prev_key: 'done',
64
+ next_key: false,
65
+ onfunc: 'onReady',
66
+ },
67
+ finish: {
68
+ key: 'finish',
69
+ prev_key: 'answer',
70
+ next_key: 'complete',
71
+ onfunc: 'onFinish',
72
+ },
73
+ complete: {
74
+ key: 'complete',
75
+ prev_key: 'finish',
76
+ next_key: false,
77
+ onfunc: 'onComplete',
78
+ },
79
+ stop: {
80
+ key: 'stop',
81
+ prev_key: false,
82
+ next_key: 'exit',
83
+ onfunc: 'onStop',
84
+ },
85
+ exit: {
86
+ key: 'exit',
87
+ prev_key: 'stop',
88
+ next_key: false,
89
+ onfunc: 'onExit',
90
+ }
91
+ },
42
92
  context: false,
43
93
  events: events.DATA,
44
94
  feature: false,
@@ -47,11 +97,11 @@ export default {
47
97
  zones: zones.DATA,
48
98
  action: false,
49
99
  actions: actions.DATA,
50
- state: false,
100
+ state: 'offline',
51
101
  states: states.DATA,
52
- intent: false,
102
+ intent: 'neutral',
53
103
  intents: intents.DATA,
54
- belief: false,
104
+ belief: 'vedic',
55
105
  beliefs: beliefs.DATA,
56
106
  messages: msgs.DATA,
57
107
  }
@@ -34,7 +34,17 @@
34
34
  "pervert": "πŸ’‹ Pervert",
35
35
  "pleasure": "πŸ’… Pleasure",
36
36
  "desire": "😘 Desire",
37
+ "romance": "🌹 Romance",
37
38
  "cannibal": "πŸ₯© Cannibal",
38
- "other": "πŸ€” Other"
39
+ "other": "πŸ€” Other",
40
+ "init": "🟠 Init",
41
+ "start": "🟒 Start",
42
+ "enter": "πŸšͺ Enter",
43
+ "done": "β˜‘οΈ Done",
44
+ "ready": "⭐️ Ready",
45
+ "finish": "🏁 Finish",
46
+ "complete": "βœ… Complete",
47
+ "stop": "πŸ”΄ Stop",
48
+ "exit": "πŸšͺ Exit"
39
49
  }
40
50
  }
@@ -15,9 +15,10 @@
15
15
  "question": "πŸ’¬ Question",
16
16
  "cmd": "πŸͺ– Command",
17
17
  "answer": "πŸ’‘ Answer",
18
- "wait": "⏳ Waiting",
18
+ "wait": "⏳ Wait",
19
19
  "pause": "⏸️ Pause",
20
20
  "resume": "πŸš™ Resume",
21
+ "pending": "⏳ Pending",
21
22
  "connect": "πŸ“³ Connect",
22
23
  "disconnect": "πŸ“΄ Disconnect",
23
24
  "send": "πŸ“¬ Send",
@@ -116,6 +117,7 @@
116
117
  "mature": "πŸ§“ Mature",
117
118
  "immature": "πŸ§’ Immature",
118
119
  "consent": "✍️ Consent",
119
- "onfunc": "🎚️ onFunction"
120
+ "onfunc": "🎚️ onFunction",
121
+ "romance": "🌹 Romance"
120
122
  }
121
123
  }
package/config/zones.json CHANGED
@@ -72,6 +72,11 @@
72
72
  "rakshasas": "πŸ₯© Rakshasas",
73
73
  "pisakas": "πŸ₯© Pisakas",
74
74
  "kimidin": "πŸ₯© Kimidin",
75
- "atrin": "πŸ₯© Atrin"
75
+ "atrin": "πŸ₯© Atrin",
76
+ "romance": "🌹 Romance",
77
+ "porn": "πŸ‘™ Pornography",
78
+ "prostitute": "πŸ’ƒ Prostitute",
79
+ "friend": "🀝 Friend",
80
+ "enemy": "🚨 Enemy"
76
81
  }
77
82
  }
package/index.js CHANGED
@@ -1106,10 +1106,12 @@ class Deva {
1106
1106
  }).then(() => {
1107
1107
  return this._assignListeners();
1108
1108
  }).then(() => {
1109
+ this.belief('vedic', `init:${data.id.uid}`);
1109
1110
  this.feature('init', data.id.uid);
1110
1111
  this.zone('init', data.id.uid);
1111
1112
  this.action('init', data.id.uid);
1112
1113
  this.state('init', data.id.uid);
1114
+ this.intent('init', data.id.uid);
1113
1115
  }).then(() => {
1114
1116
  return this.Client(client, resolve, reject);
1115
1117
  }).then(() => {
@@ -1171,12 +1173,13 @@ class Deva {
1171
1173
  this.action('return', `onInit:${data.id.uid}`);
1172
1174
  return this.onInit(data, resolve);
1173
1175
  }
1174
- this.intent('good', `init:${data.id.uid}`); // state set to watch onInit
1175
1176
  this.action('return', `init:${data.id.uid}`);
1177
+ this.state('valid', `init:${data.id.uid}`); // state set to watch onInit
1178
+ this.intent('good', `init:${data.id.uid}`); // state set to watch onInit
1176
1179
  return this.start(data, resolve);
1177
1180
  }).catch(err => {
1178
- this.intent('bad', `init:${data.id.uid}`); // state set to watch onInit
1179
1181
  this.state('catch', `init:${data.id.uid}`);
1182
+ this.intent('bad', `init:${data.id.uid}`); // state set to watch onInit
1180
1183
  return this.err(err, client, reject);
1181
1184
  });
1182
1185
  });
@@ -1194,44 +1197,19 @@ class Deva {
1194
1197
  ***************/
1195
1198
  start(data, resolve) {
1196
1199
  if (!this._active) return resolve(this._messages.offline);
1197
- this.context('start', data.id.uid);
1198
- this.zone('start', data.id.uid);
1199
- this.action('start', data.id.uid);
1200
- this.state('start', data.id.uid);
1201
-
1202
- this.action('delete', `init:md5:${data.id.uid}`);
1203
- delete data.md5;
1204
- this.action('delete', `init:sha256:${data.id.uid}`);
1205
- delete data.sha256;
1206
- this.action('delete', `init:sha512:${data.id.uid}`);
1207
- delete data.sha512;
1208
-
1209
- this.state('set', `data:value:start:${data.id.uid}`); // state set to watch OnFinish
1210
- data.value = 'start';
1211
-
1212
- this.action('hash', `start:md5:${data.id.uid}`);
1213
- data.md5 = this.hash(data, 'md5');
1214
- this.action('hash', `start:sha256:${data.id.uid}`)
1215
- data.sha256 = this.hash(data, 'sha256');
1216
- this.action('hash', `start:sha512:${data.id.uid}`)
1217
- data.sha512 = this.hash(data, 'sha512');
1218
-
1219
- // setup the finish talk event
1220
- this.action('talk', `${this._events.start}:${data.id.uid}`);
1221
- this.talk(this._events.start, data);
1222
-
1223
- const hasOnStart = this.onStart && typeof this.onStart === 'function' ? true : false;
1224
- if (hasOnStart) {
1225
- this.action('onfunc', `hasOnStart:${data.id.uid}`); // set action to onfunc
1226
- this.state('onfunc', `hasOnStart:${data.id.uid}`); // set state to onfunc
1227
- this.intent('good', `onStart:${data.id.uid}`); // set the good intent
1228
- this.action('return', `onStart:${data.id.uid}`); // return action finish
1229
- return this.onStart(data, resolve)
1230
- }
1231
-
1232
- this.intent('good', `start:${data.id.uid}`); // set the good intent
1233
- this.action('return', `start:${data.id.uid}`); // return action finish
1234
- return this.enter(data, resolve)
1200
+ const {key, prev_key, next_key, onfunc} = config.invoke.enter;
1201
+ this.context(key, data.id.uid);
1202
+ this.zone(key, data.id.uid);
1203
+ this.action(key, data.id.uid);
1204
+ this.state(key, data.id.uid);
1205
+ this.intent(key, data.id.uid);
1206
+ return this._invoke({
1207
+ key,
1208
+ prev_key,
1209
+ next_key,
1210
+ onfunc,data,
1211
+ resolve
1212
+ });
1235
1213
  }
1236
1214
 
1237
1215
  /**************
@@ -1247,43 +1225,19 @@ class Deva {
1247
1225
  ***************/
1248
1226
  enter(data, resolve) {
1249
1227
  if (!this._active) return resolve(this._messages.offline);
1250
- this.context('enter', data.id.uid);
1251
- this.zone('enter', data.id.uid);
1252
- this.action('enter', data.id.uid);
1253
- this.state('enter', data.id.uid);
1254
-
1255
- this.action('delete', `start:md5:${data.id.uid}`);
1256
- delete data.md5;
1257
- this.action('delete', `start:sha256:${data.id.uid}`);
1258
- delete data.sha256;
1259
- this.action('delete', `start:sha512:${data.id.uid}`);
1260
- delete data.sha512;
1261
-
1262
- this.state('set', `data:value:enter:${data.id.uid}`); // state set to watch OnFinish
1263
- data.value = 'enter';
1264
-
1265
- this.action('hash', `enter:md5:${data.id.uid}`);
1266
- data.md5 = this.hash(data, 'md5');
1267
- this.action('hash', `enter:sha256:${data.id.uid}`)
1268
- data.sha256 = this.hash(data, 'sha256');
1269
- this.action('hash', `enter:sha512:${data.id.uid}`)
1270
- data.sha512 = this.hash(data, 'sha512');
1271
-
1272
- this.action('talk', `${this._events.enter}:${data.id.uid}`);
1273
- this.talk(this._events.enter, data);
1274
-
1275
- const hasOnEnter = this.onEnter && typeof this.onEnter === 'function' ? true : false;
1276
- if (hasOnEnter) {
1277
- this.action('onfunc', `hasOnEnter:${data.id.uid}`); // action onfunc set
1278
- this.state('onfunc', `hasOnEnter:${data.id.uid}`); // state onfunc set
1279
- this.intent('good', `onEnter:${data.id.uid}`); // set good intent on enter
1280
- this.action('return', `onEnter:${data.id.uid}`); // set return actions
1281
- return this.onEnter(data, resolve); // set return on enter.
1282
- }
1283
-
1284
- this.intent('good', `enter:${data.id.uid}`); // set good intent enter
1285
- this.action('return', `enter:${data.id.uid}`); // return action finish
1286
- return this.done(data, resolve)
1228
+ const {key, prev_key, next_key, onfunc} = config.invoke.enter;
1229
+ this.context(key, data.id.uid);
1230
+ this.zone(key, data.id.uid);
1231
+ this.action(key, data.id.uid);
1232
+ this.state(key, data.id.uid);
1233
+ this.intent(key, data.id.uid);
1234
+ return this._invoke({
1235
+ key,
1236
+ prev_key,
1237
+ next_key,
1238
+ onfunc,data,
1239
+ resolve
1240
+ });
1287
1241
  }
1288
1242
 
1289
1243
  /**************
@@ -1299,43 +1253,19 @@ class Deva {
1299
1253
  ***************/
1300
1254
  done(data, resolve) {
1301
1255
  if (!this._active) return resolve(this._messages.offline);
1302
- this.context('done', data.id.uid);
1303
- this.zone('done', data.id.uid);
1304
- this.action('done', data.id.uid);
1305
- this.state('done', data.id.uid);
1306
-
1307
- this.action('delete', `enter:md5:${data.id.uid}`);
1308
- delete data.md5;
1309
- this.action('delete', `enter:sha256:${data.id.uid}`);
1310
- delete data.sha256;
1311
- this.action('delete', `enter:sha512:${data.id.uid}`);
1312
- delete data.sha512;
1313
-
1314
- this.state('set', `data:value:done:${data.id.uid}`); // state set to watch OnFinish
1315
- data.value = 'done';
1316
-
1317
- this.action('hash', `done:md5:${data.id.uid}`);
1318
- data.md5 = this.hash(data, 'md5');
1319
- this.action('hash', `done:sha256:${data.id.uid}`)
1320
- data.sha256 = this.hash(data, 'sha256');
1321
- this.action('hash', `done:sha512:${data.id.uid}`)
1322
- data.sha512 = this.hash(data, 'sha512');
1323
-
1324
- this.action('talk', `${this._events.done}:${data.id.uid}`);
1325
- this.talk(this._events.done, data);
1326
-
1327
- const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
1328
- if (hasOnDone) {
1329
- this.action('onfunc', `hasOnDone:${data.id.uid}`); // state onfunc
1330
- this.state('onfunc', `hasOnDone:${data.id.uid}`); // state onfunc
1331
- this.intent('good', `onDone:${data.id.uid}`); // set the onDone intent
1332
- this.action('return', `onDone:${data.id.uid}`); // set the return action
1333
- return this.onDone(data, resolve);
1334
- }
1335
-
1336
- this.intent('good', `done:${data.id.uid}`); // set done intent
1337
- this.action('return', `done:${data.id.uid}`); // return action finish
1338
- return this.ready(data, resolve);
1256
+ const {key, prev_key, next_key, onfunc} = config.invoke.done;
1257
+ this.context(key, data.id.uid);
1258
+ this.zone(key, data.id.uid);
1259
+ this.action(key, data.id.uid);
1260
+ this.state(key, data.id.uid);
1261
+ this.intent(key, data.id.uid);
1262
+ return this._invoke({
1263
+ key,
1264
+ prev_key,
1265
+ next_key,
1266
+ onfunc,data,
1267
+ resolve
1268
+ });
1339
1269
  }
1340
1270
 
1341
1271
  /**************
@@ -1348,26 +1278,15 @@ class Deva {
1348
1278
  ***************/
1349
1279
  ready(data, resolve) {
1350
1280
  if (!this._active) return resolve(this._messages.offline);
1351
- this.context('ready', data.id.uid);
1352
- this.zone('ready', data.id.uid);
1353
- this.action('ready', data.id.uid);
1354
- this.state('ready', data.id.uid);
1281
+ const {key, prev_key, next_key, onfunc} = config.invoke.ready;
1282
+ this.context(key, data.id.uid);
1283
+ this.zone(key, data.id.uid);
1284
+ this.action(key, data.id.uid);
1285
+ this.state(key, data.id.uid);
1286
+ this.intent(key, data.id.uid);
1355
1287
 
1356
- const agent = this.agent();
1357
- const client = this.client();
1358
-
1359
- // Delete previous data hashes
1360
- this.action('delete', `done:md5:${data.id.uid}`);
1361
- delete data.md5;
1362
- this.action('delete', `done:sha256:${data.id.uid}`);
1363
- delete data.sha256;
1364
- this.action('delete', `done:sha512:${data.id.uid}`);
1365
- delete data.sha512;
1366
-
1367
- this.state('set', `data:value:ready:${data.id.uid}`); // state set to watch OnFinish
1368
- data.value = 'ready';
1369
-
1370
- this.state('set', `config:hash:${data.id.uid}`); // state set to watch OnFinish
1288
+ const agent = this.agent();
1289
+ this.state('set', `${key}:config:hash:${data.id.uid}`); // state set to watch OnFinish
1371
1290
  this.config.hash[agent.key] = {};
1372
1291
  for (let item of this._config.ready_hash) {
1373
1292
  if (this[item]) {
@@ -1376,30 +1295,14 @@ class Deva {
1376
1295
  this.config.hash[agent.key][item] = this.hash(this_item, 'sha256');
1377
1296
  }
1378
1297
  }
1379
-
1380
- this.action('hash', `ready:md5:${data.id.uid}`);
1381
- data.md5 = this.hash(data, 'md5');
1382
- this.action('hash', `ready:sha256:${data.id.uid}`)
1383
- data.sha256 = this.hash(data, 'sha256');
1384
- this.action('hash', `ready:sha512:${data.id.uid}`)
1385
- data.sha512 = this.hash(data, 'sha512');
1386
-
1387
- this.action('talk', `${this._events.ready}:${data.id.uid}`);
1388
- this.talk(this._events.ready, data);
1389
-
1390
-
1391
- const hasOnReady = this.onReady && typeof this.onReady === 'function';
1392
- if (hasOnReady) {
1393
- this.action('onfunc', `hasOnReady:${data.id.uid}`); // action onfunc
1394
- this.state('onfunc', `hasOnReady:${data.id.uid}`); // state onfunc
1395
- this.intent('good', `onReady:${data.id.uis}`); // set ready intent
1396
- this.action('return', `onReady:${data.id.uid}`); // set action onReady return
1397
- return this.onReady(data, resolve);
1398
- }
1399
-
1400
- this.intent('good', `ready:${data.id.uid}`); // set read intent good
1401
- this.action('resolve', `ready:${data.id.uid}`); // return action ready
1402
- return resolve(data);
1298
+ return this._invoke({
1299
+ key,
1300
+ prev_key,
1301
+ next_key,
1302
+ onfunc,
1303
+ data,
1304
+ resolve,
1305
+ });
1403
1306
  }
1404
1307
 
1405
1308
  /**************
@@ -1411,41 +1314,22 @@ class Deva {
1411
1314
  usage: this.finish(data, resolve)
1412
1315
  ***************/
1413
1316
  finish(data, resolve) {
1414
- if (!this._active) return resolve(this._messages.offline); //
1415
- this.context('finish', data.id.uid);
1416
- this.zone('finish', data.id.uid); // enter finish zone
1417
- this.action('finish', data.id.uid); // start finish action
1418
- this.state('finish', data.id.uid); // set finish state
1419
-
1420
- this.action('delete', `answer:md5:${data.id.uid}`);
1421
- delete data.md5;
1422
- this.action('delete', `answer:sha256:${data.id.uid}`);
1423
- delete data.sha256;
1424
- this.action('delete', `answer:sha512:${data.id.uid}`);
1425
- delete data.sha512;
1426
-
1427
- data.finish = Date.now(); // set the finish timestamp
1428
- this.state('set', `data:finish:${data.finish}:${data.id.uid}`)
1429
-
1430
- this.action('hash', `finish:md5:${data.id.uid}`);
1431
- data.md5 = this.hash(data, 'md5');
1432
- this.action('hash', `finish:sha256:${data.id.uid}`)
1433
- data.sha256 = this.hash(data, 'sha256');
1434
- this.action('hash', `finish:sha512:${data.id.uid}`)
1435
- data.sha512 = this.hash(data, 'sha512');
1317
+ if (!this._active) return resolve(this._messages.offline);
1318
+ const {key, prev_key, next_key, onfunc} = config.invoke.finish;
1319
+ this.context(key, data.id.uid);
1320
+ this.zone(key, data.id.uid); // enter finish zone
1321
+ this.action(key, data.id.uid); // start finish action
1322
+ this.state(key, data.id.uid); // set finish state
1323
+ this.intent(key, data.id.uid); // set finish state
1436
1324
 
1437
- // setup the finish talk event
1438
- this.action('talk', `${this._events.finish}:${data.id.uid}`);
1439
- this.talk(this._events.finish, data);
1440
-
1441
- const hasOnFinish = this.onFinish && typeof this.onFinish === 'function';
1442
- if (hasOnFinish) {
1443
- this.action('onfunc', `hasOnFinish:${data.id.uid}`); // action onfunc
1444
- this.state('onfunc', `hasOnFinish:${data.id.uid}`); // state onfunc
1445
- }
1446
-
1447
- this.action('return', `finish:${data.id.uid}`); // return action finish
1448
- return hasOnFinish ? this.onFinish(data, resolve) : this.complete(data, resolve);
1325
+ return this._invoke({
1326
+ key,
1327
+ prev_key,
1328
+ next_key,
1329
+ onfunc,
1330
+ data,
1331
+ resolve,
1332
+ });
1449
1333
  }
1450
1334
 
1451
1335
  /**************
@@ -1459,42 +1343,78 @@ class Deva {
1459
1343
  ***************/
1460
1344
  complete(data, resolve) {
1461
1345
  if (!this._active) return resolve(this._messages.offline);
1462
- this.context('complete', data.id.uid);
1463
- this.zone('complete', data.id.uid);
1464
- this.action('complete', data.id.uid);
1465
- this.state('complete', data.id.uid);
1346
+ const {key, prev_key, next_key, onfunc} = config.invoke.complete;
1347
+ this.context(key, data.id.uid);
1348
+ this.zone(key, data.id.uid);
1349
+ this.action(key, data.id.uid);
1350
+ this.state(key, data.id.uid);
1351
+
1352
+ return this._invoke({
1353
+ key,
1354
+ prev_key,
1355
+ next_key,
1356
+ onfunc,
1357
+ data,
1358
+ resolve,
1359
+ });
1360
+ }
1361
+ /**************
1362
+ func: _invoke
1363
+ params:
1364
+ - data: the data to pass to the resolve
1365
+ - resolve: the complete resolve to pass back
1366
+ describe: The _invoke function is used for the recursion over
1367
+ init, start, enter, done ready, finish, complete
1368
+ usage: this.complete(data, resolve)
1369
+ ***************/
1370
+ _invoke(opts) {
1371
+ if (!this._active) return resolve(this._messages.offline);
1372
+ const {key, prev_key, next_key, onfunc, data, resolve} = opts;
1373
+ this.context(key, data.id.uid);
1374
+ this.zone(key, data.id.uid);
1375
+ this.action(key, data.id.uid);
1376
+ this.state(key, data.id.uid);
1466
1377
 
1467
- this.action('delete', `finish:md5:${data.id.uid}`);
1378
+ this.action('delete', `${key}:md5:${data.id.uid}`);
1468
1379
  delete data.md5;
1469
- this.action('delete', `finish:sha256:${data.id.uid}`);
1380
+
1381
+ this.action('delete', `${key}:sha256:${data.id.uid}`);
1470
1382
  delete data.sha256;
1471
- this.action('delete', `finish:sha512:${data.id.uid}`);
1383
+
1384
+ this.action('delete', `${key}:sha512:${data.id.uid}`);
1472
1385
  delete data.sha512;
1473
1386
 
1474
- data.complete = Date.now();// set the complete date on the whole data.
1475
- this.state('set', `data:complete:${data.complete}:${data.id.uid}`)
1476
-
1477
- this.action('hash', `complete:md5:${data.id.uid}`);
1387
+ this.state('data', `${key}:date:${data.id.uid}`);
1388
+ data[key] = Date.now();// set the complete date on the whole data.
1389
+
1390
+ this.action('hash', `${key}:md5:${data.id.uid}`);
1478
1391
  data.md5 = this.hash(data, 'md5');
1479
- this.action('hash', `complete:sha256:${data.id.uid}`)
1392
+
1393
+ this.action('hash', `${key}:sha256:${data.id.uid}`)
1480
1394
  data.sha256 = this.hash(data, 'sha256');
1481
1395
 
1482
- this.action('hash', `complete:sha512:${data.id.uid}`)
1396
+ this.action('hash', `${key}:sha512:${data.id.uid}`)
1483
1397
  data.sha512 = this.hash(data, 'sha512');
1484
1398
 
1485
1399
  // setup the complete talk event
1486
- this.action('talk', `${this._events.complete}:${data.id.uid}`); // action talk for the event.
1487
- this.talk(this._events.complete, data); // talk the complete event
1400
+ this.action('talk', `${this._events[key]}:${data.id.uid}`); // action talk for the event.
1401
+ this.talk(this._events[key], data); // talk the complete event
1488
1402
 
1489
1403
  // determine if there is an onComplete function for the entity.
1490
- const hasOnComplete = this.onComplete && typeof this.onComplete === 'function';
1491
- if (hasOnComplete) {
1492
- this.action('onfunc', `hasOnComplete:${data.id.uid}`); // action onfunc
1493
- this.state('onfunc', `hasOnComplete:${data.id.uid}`); // state onfunc
1404
+ const hasOnFunc = this[onfunc] && typeof this[onfunc] === 'function';
1405
+ if (hasOnFunc) {
1406
+ this.action('onfunc', `${key}:has:${onfunc}:${data.id.uid}`); // action onfunc
1407
+ this.state('onfunc', `${key}:has:${onfunc}:${data.id.uid}`); // state onfunc
1408
+ this.action('return', `${onfunc}:${data.id.uid}`); // action return
1409
+ this.state('valid', `${onfunc}:${data.id.uid}`); // state valid
1410
+ this.intent('good', `${onfunc}:${data.id.uid}`); // intent good
1411
+ return this[onfunc](data, resolve);
1494
1412
  }
1495
1413
 
1496
- this.action('return', `complete:${data.id.uid}`); // return action complete
1497
- return hasOnComplete ? this.onComplete(data, resolve) : resolve(data);
1414
+ this.action('return', `${key}:${data.id.uid}`); // return action complete
1415
+ this.state('valid', `${key}:${data.id.uid}`); // return state valid
1416
+ this.intent('good', `${key}:${data.id.uid}`); // return intent good
1417
+ return next_key ? this[next_key](data, resolve) : resolve(data);
1498
1418
  }
1499
1419
 
1500
1420
  /**************
@@ -1512,26 +1432,27 @@ class Deva {
1512
1432
  ***************/
1513
1433
  stop() {
1514
1434
  if (!this._active) return this._messages.offline;
1435
+ const {key, prev_key, next_key, onfunc} = config.invoke.stop;
1515
1436
  const id = this.uid();
1516
- const key = 'stop';
1517
1437
  this.context(key, id.uid);
1518
1438
  this.zone(key, id.uid);
1519
1439
  this.action(key, id.uid);
1520
1440
  this.state(key, id.uid); // set the state to stop
1521
1441
 
1522
1442
  this.state('set', `${key}:agent:${id.uid}`); // state stop agent
1523
- const agent = this.agent(); // get the current agent
1524
-
1525
- this.state('set', `stop:client:${id.uid}`); // state stop agent
1526
- const client = this.client(); // set the current client
1443
+ const agent = this.agent().sha256; // get the current agent
1444
+ const value = agent.key;
1445
+
1446
+ this.state('set', `${key}:client:${id.uid}`); // state stop agent
1447
+ const client = this.client().sha256; // set the current client
1527
1448
 
1528
- this.state('data', `stop:${id.uid}`);
1449
+ this.state('data', `${key}:${id.uid}`);
1529
1450
  const data = { // build the stop data
1530
1451
  id, // set the id
1531
1452
  key, // set the key
1532
- value: agent.key, // set the value
1533
- agent: agent.sha256, // set the agent
1534
- client: client.sha256, // set the client
1453
+ value, // set the value
1454
+ agent, // set the agent
1455
+ client, // set the client
1535
1456
  stop: Date.now(), // set the created date
1536
1457
  }
1537
1458
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "44091450722329207445",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.7.1",
4
+ "version": "1.8.1",
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",
package/tests/index.js CHANGED
@@ -178,7 +178,6 @@ const DevaTest = new Deva({
178
178
  },
179
179
  },
180
180
  onInit(data, resolve) {
181
- this.belief('vedic', `${data.id.uid}`);
182
181
  return this.start(data, resolve);
183
182
  },
184
183
  onStart(data, resolve) {