@indra.ai/deva 1.7.2 β†’ 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(() => {
@@ -1164,7 +1166,6 @@ class Deva {
1164
1166
  return this.Done(resolve, reject);
1165
1167
  }).then(() => {
1166
1168
  const hasOnInit = this.onInit && typeof this.onInit === 'function';
1167
- this.belief('vedic', `init:${data.id.uid}`);
1168
1169
  if (hasOnInit) {
1169
1170
  this.action('onfunc', `hasOnInit:${data.id.uid}`); // state set to watch onInit
1170
1171
  this.state('onfunc', `hasOnInit:${data.id.uid}`); // state set to watch onInit
@@ -1172,12 +1173,13 @@ class Deva {
1172
1173
  this.action('return', `onInit:${data.id.uid}`);
1173
1174
  return this.onInit(data, resolve);
1174
1175
  }
1175
- this.intent('good', `init:${data.id.uid}`); // state set to watch onInit
1176
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
1177
1179
  return this.start(data, resolve);
1178
1180
  }).catch(err => {
1179
- this.intent('bad', `init:${data.id.uid}`); // state set to watch onInit
1180
1181
  this.state('catch', `init:${data.id.uid}`);
1182
+ this.intent('bad', `init:${data.id.uid}`); // state set to watch onInit
1181
1183
  return this.err(err, client, reject);
1182
1184
  });
1183
1185
  });
@@ -1195,44 +1197,19 @@ class Deva {
1195
1197
  ***************/
1196
1198
  start(data, resolve) {
1197
1199
  if (!this._active) return resolve(this._messages.offline);
1198
- this.context('start', data.id.uid);
1199
- this.zone('start', data.id.uid);
1200
- this.action('start', data.id.uid);
1201
- this.state('start', data.id.uid);
1202
-
1203
- this.action('delete', `init:md5:${data.id.uid}`);
1204
- delete data.md5;
1205
- this.action('delete', `init:sha256:${data.id.uid}`);
1206
- delete data.sha256;
1207
- this.action('delete', `init:sha512:${data.id.uid}`);
1208
- delete data.sha512;
1209
-
1210
- this.state('set', `data:value:start:${data.id.uid}`); // state set to watch OnFinish
1211
- data.value = 'start';
1212
-
1213
- this.action('hash', `start:md5:${data.id.uid}`);
1214
- data.md5 = this.hash(data, 'md5');
1215
- this.action('hash', `start:sha256:${data.id.uid}`)
1216
- data.sha256 = this.hash(data, 'sha256');
1217
- this.action('hash', `start:sha512:${data.id.uid}`)
1218
- data.sha512 = this.hash(data, 'sha512');
1219
-
1220
- // setup the finish talk event
1221
- this.action('talk', `${this._events.start}:${data.id.uid}`);
1222
- this.talk(this._events.start, data);
1223
-
1224
- const hasOnStart = this.onStart && typeof this.onStart === 'function' ? true : false;
1225
- if (hasOnStart) {
1226
- this.action('onfunc', `hasOnStart:${data.id.uid}`); // set action to onfunc
1227
- this.state('onfunc', `hasOnStart:${data.id.uid}`); // set state to onfunc
1228
- this.intent('good', `onStart:${data.id.uid}`); // set the good intent
1229
- this.action('return', `onStart:${data.id.uid}`); // return action finish
1230
- return this.onStart(data, resolve)
1231
- }
1232
-
1233
- this.intent('good', `start:${data.id.uid}`); // set the good intent
1234
- this.action('return', `start:${data.id.uid}`); // return action finish
1235
- 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
+ });
1236
1213
  }
1237
1214
 
1238
1215
  /**************
@@ -1248,43 +1225,19 @@ class Deva {
1248
1225
  ***************/
1249
1226
  enter(data, resolve) {
1250
1227
  if (!this._active) return resolve(this._messages.offline);
1251
- this.context('enter', data.id.uid);
1252
- this.zone('enter', data.id.uid);
1253
- this.action('enter', data.id.uid);
1254
- this.state('enter', data.id.uid);
1255
-
1256
- this.action('delete', `start:md5:${data.id.uid}`);
1257
- delete data.md5;
1258
- this.action('delete', `start:sha256:${data.id.uid}`);
1259
- delete data.sha256;
1260
- this.action('delete', `start:sha512:${data.id.uid}`);
1261
- delete data.sha512;
1262
-
1263
- this.state('set', `data:value:enter:${data.id.uid}`); // state set to watch OnFinish
1264
- data.value = 'enter';
1265
-
1266
- this.action('hash', `enter:md5:${data.id.uid}`);
1267
- data.md5 = this.hash(data, 'md5');
1268
- this.action('hash', `enter:sha256:${data.id.uid}`)
1269
- data.sha256 = this.hash(data, 'sha256');
1270
- this.action('hash', `enter:sha512:${data.id.uid}`)
1271
- data.sha512 = this.hash(data, 'sha512');
1272
-
1273
- this.action('talk', `${this._events.enter}:${data.id.uid}`);
1274
- this.talk(this._events.enter, data);
1275
-
1276
- const hasOnEnter = this.onEnter && typeof this.onEnter === 'function' ? true : false;
1277
- if (hasOnEnter) {
1278
- this.action('onfunc', `hasOnEnter:${data.id.uid}`); // action onfunc set
1279
- this.state('onfunc', `hasOnEnter:${data.id.uid}`); // state onfunc set
1280
- this.intent('good', `onEnter:${data.id.uid}`); // set good intent on enter
1281
- this.action('return', `onEnter:${data.id.uid}`); // set return actions
1282
- return this.onEnter(data, resolve); // set return on enter.
1283
- }
1284
-
1285
- this.intent('good', `enter:${data.id.uid}`); // set good intent enter
1286
- this.action('return', `enter:${data.id.uid}`); // return action finish
1287
- 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
+ });
1288
1241
  }
1289
1242
 
1290
1243
  /**************
@@ -1300,43 +1253,19 @@ class Deva {
1300
1253
  ***************/
1301
1254
  done(data, resolve) {
1302
1255
  if (!this._active) return resolve(this._messages.offline);
1303
- this.context('done', data.id.uid);
1304
- this.zone('done', data.id.uid);
1305
- this.action('done', data.id.uid);
1306
- this.state('done', data.id.uid);
1307
-
1308
- this.action('delete', `enter:md5:${data.id.uid}`);
1309
- delete data.md5;
1310
- this.action('delete', `enter:sha256:${data.id.uid}`);
1311
- delete data.sha256;
1312
- this.action('delete', `enter:sha512:${data.id.uid}`);
1313
- delete data.sha512;
1314
-
1315
- this.state('set', `data:value:done:${data.id.uid}`); // state set to watch OnFinish
1316
- data.value = 'done';
1317
-
1318
- this.action('hash', `done:md5:${data.id.uid}`);
1319
- data.md5 = this.hash(data, 'md5');
1320
- this.action('hash', `done:sha256:${data.id.uid}`)
1321
- data.sha256 = this.hash(data, 'sha256');
1322
- this.action('hash', `done:sha512:${data.id.uid}`)
1323
- data.sha512 = this.hash(data, 'sha512');
1324
-
1325
- this.action('talk', `${this._events.done}:${data.id.uid}`);
1326
- this.talk(this._events.done, data);
1327
-
1328
- const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
1329
- if (hasOnDone) {
1330
- this.action('onfunc', `hasOnDone:${data.id.uid}`); // state onfunc
1331
- this.state('onfunc', `hasOnDone:${data.id.uid}`); // state onfunc
1332
- this.intent('good', `onDone:${data.id.uid}`); // set the onDone intent
1333
- this.action('return', `onDone:${data.id.uid}`); // set the return action
1334
- return this.onDone(data, resolve);
1335
- }
1336
-
1337
- this.intent('good', `done:${data.id.uid}`); // set done intent
1338
- this.action('return', `done:${data.id.uid}`); // return action finish
1339
- 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
+ });
1340
1269
  }
1341
1270
 
1342
1271
  /**************
@@ -1349,26 +1278,15 @@ class Deva {
1349
1278
  ***************/
1350
1279
  ready(data, resolve) {
1351
1280
  if (!this._active) return resolve(this._messages.offline);
1352
- this.context('ready', data.id.uid);
1353
- this.zone('ready', data.id.uid);
1354
- this.action('ready', data.id.uid);
1355
- this.state('ready', data.id.uid);
1356
-
1357
- const agent = this.agent();
1358
- const client = this.client();
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);
1359
1287
 
1360
- // Delete previous data hashes
1361
- this.action('delete', `done:md5:${data.id.uid}`);
1362
- delete data.md5;
1363
- this.action('delete', `done:sha256:${data.id.uid}`);
1364
- delete data.sha256;
1365
- this.action('delete', `done:sha512:${data.id.uid}`);
1366
- delete data.sha512;
1367
-
1368
- this.state('set', `data:value:ready:${data.id.uid}`); // state set to watch OnFinish
1369
- data.value = 'ready';
1370
-
1371
- 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
1372
1290
  this.config.hash[agent.key] = {};
1373
1291
  for (let item of this._config.ready_hash) {
1374
1292
  if (this[item]) {
@@ -1377,30 +1295,14 @@ class Deva {
1377
1295
  this.config.hash[agent.key][item] = this.hash(this_item, 'sha256');
1378
1296
  }
1379
1297
  }
1380
-
1381
- this.action('hash', `ready:md5:${data.id.uid}`);
1382
- data.md5 = this.hash(data, 'md5');
1383
- this.action('hash', `ready:sha256:${data.id.uid}`)
1384
- data.sha256 = this.hash(data, 'sha256');
1385
- this.action('hash', `ready:sha512:${data.id.uid}`)
1386
- data.sha512 = this.hash(data, 'sha512');
1387
-
1388
- this.action('talk', `${this._events.ready}:${data.id.uid}`);
1389
- this.talk(this._events.ready, data);
1390
-
1391
-
1392
- const hasOnReady = this.onReady && typeof this.onReady === 'function';
1393
- if (hasOnReady) {
1394
- this.action('onfunc', `hasOnReady:${data.id.uid}`); // action onfunc
1395
- this.state('onfunc', `hasOnReady:${data.id.uid}`); // state onfunc
1396
- this.intent('good', `onReady:${data.id.uis}`); // set ready intent
1397
- this.action('return', `onReady:${data.id.uid}`); // set action onReady return
1398
- return this.onReady(data, resolve);
1399
- }
1400
-
1401
- this.intent('good', `ready:${data.id.uid}`); // set read intent good
1402
- this.action('resolve', `ready:${data.id.uid}`); // return action ready
1403
- return resolve(data);
1298
+ return this._invoke({
1299
+ key,
1300
+ prev_key,
1301
+ next_key,
1302
+ onfunc,
1303
+ data,
1304
+ resolve,
1305
+ });
1404
1306
  }
1405
1307
 
1406
1308
  /**************
@@ -1412,41 +1314,22 @@ class Deva {
1412
1314
  usage: this.finish(data, resolve)
1413
1315
  ***************/
1414
1316
  finish(data, resolve) {
1415
- if (!this._active) return resolve(this._messages.offline); //
1416
- this.context('finish', data.id.uid);
1417
- this.zone('finish', data.id.uid); // enter finish zone
1418
- this.action('finish', data.id.uid); // start finish action
1419
- this.state('finish', data.id.uid); // set finish state
1420
-
1421
- this.action('delete', `answer:md5:${data.id.uid}`);
1422
- delete data.md5;
1423
- this.action('delete', `answer:sha256:${data.id.uid}`);
1424
- delete data.sha256;
1425
- this.action('delete', `answer:sha512:${data.id.uid}`);
1426
- delete data.sha512;
1427
-
1428
- data.finish = Date.now(); // set the finish timestamp
1429
- this.state('set', `data:finish:${data.finish}:${data.id.uid}`)
1430
-
1431
- this.action('hash', `finish:md5:${data.id.uid}`);
1432
- data.md5 = this.hash(data, 'md5');
1433
- this.action('hash', `finish:sha256:${data.id.uid}`)
1434
- data.sha256 = this.hash(data, 'sha256');
1435
- this.action('hash', `finish:sha512:${data.id.uid}`)
1436
- 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
1437
1324
 
1438
- // setup the finish talk event
1439
- this.action('talk', `${this._events.finish}:${data.id.uid}`);
1440
- this.talk(this._events.finish, data);
1441
-
1442
- const hasOnFinish = this.onFinish && typeof this.onFinish === 'function';
1443
- if (hasOnFinish) {
1444
- this.action('onfunc', `hasOnFinish:${data.id.uid}`); // action onfunc
1445
- this.state('onfunc', `hasOnFinish:${data.id.uid}`); // state onfunc
1446
- }
1447
-
1448
- this.action('return', `finish:${data.id.uid}`); // return action finish
1449
- 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
+ });
1450
1333
  }
1451
1334
 
1452
1335
  /**************
@@ -1460,42 +1343,78 @@ class Deva {
1460
1343
  ***************/
1461
1344
  complete(data, resolve) {
1462
1345
  if (!this._active) return resolve(this._messages.offline);
1463
- this.context('complete', data.id.uid);
1464
- this.zone('complete', data.id.uid);
1465
- this.action('complete', data.id.uid);
1466
- 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);
1467
1377
 
1468
- this.action('delete', `finish:md5:${data.id.uid}`);
1378
+ this.action('delete', `${key}:md5:${data.id.uid}`);
1469
1379
  delete data.md5;
1470
- this.action('delete', `finish:sha256:${data.id.uid}`);
1380
+
1381
+ this.action('delete', `${key}:sha256:${data.id.uid}`);
1471
1382
  delete data.sha256;
1472
- this.action('delete', `finish:sha512:${data.id.uid}`);
1383
+
1384
+ this.action('delete', `${key}:sha512:${data.id.uid}`);
1473
1385
  delete data.sha512;
1474
1386
 
1475
- data.complete = Date.now();// set the complete date on the whole data.
1476
- this.state('set', `data:complete:${data.complete}:${data.id.uid}`)
1477
-
1478
- 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}`);
1479
1391
  data.md5 = this.hash(data, 'md5');
1480
- this.action('hash', `complete:sha256:${data.id.uid}`)
1392
+
1393
+ this.action('hash', `${key}:sha256:${data.id.uid}`)
1481
1394
  data.sha256 = this.hash(data, 'sha256');
1482
1395
 
1483
- this.action('hash', `complete:sha512:${data.id.uid}`)
1396
+ this.action('hash', `${key}:sha512:${data.id.uid}`)
1484
1397
  data.sha512 = this.hash(data, 'sha512');
1485
1398
 
1486
1399
  // setup the complete talk event
1487
- this.action('talk', `${this._events.complete}:${data.id.uid}`); // action talk for the event.
1488
- 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
1489
1402
 
1490
1403
  // determine if there is an onComplete function for the entity.
1491
- const hasOnComplete = this.onComplete && typeof this.onComplete === 'function';
1492
- if (hasOnComplete) {
1493
- this.action('onfunc', `hasOnComplete:${data.id.uid}`); // action onfunc
1494
- 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);
1495
1412
  }
1496
1413
 
1497
- this.action('return', `complete:${data.id.uid}`); // return action complete
1498
- 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);
1499
1418
  }
1500
1419
 
1501
1420
  /**************
@@ -1513,26 +1432,27 @@ class Deva {
1513
1432
  ***************/
1514
1433
  stop() {
1515
1434
  if (!this._active) return this._messages.offline;
1435
+ const {key, prev_key, next_key, onfunc} = config.invoke.stop;
1516
1436
  const id = this.uid();
1517
- const key = 'stop';
1518
1437
  this.context(key, id.uid);
1519
1438
  this.zone(key, id.uid);
1520
1439
  this.action(key, id.uid);
1521
1440
  this.state(key, id.uid); // set the state to stop
1522
1441
 
1523
1442
  this.state('set', `${key}:agent:${id.uid}`); // state stop agent
1524
- const agent = this.agent(); // get the current agent
1525
-
1526
- this.state('set', `stop:client:${id.uid}`); // state stop agent
1527
- 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
1528
1448
 
1529
- this.state('data', `stop:${id.uid}`);
1449
+ this.state('data', `${key}:${id.uid}`);
1530
1450
  const data = { // build the stop data
1531
1451
  id, // set the id
1532
1452
  key, // set the key
1533
- value: agent.key, // set the value
1534
- agent: agent.sha256, // set the agent
1535
- client: client.sha256, // set the client
1453
+ value, // set the value
1454
+ agent, // set the agent
1455
+ client, // set the client
1536
1456
  stop: Date.now(), // set the created date
1537
1457
  }
1538
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.2",
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",