@indra.ai/deva 1.8.1 → 1.8.3

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.
@@ -71,6 +71,7 @@
71
71
  "parse": "🐩 Parse",
72
72
  "resolve": "🤝 Resolve",
73
73
  "reject": "🧱 Reject",
74
+ "invoke": "🤙 Invoke",
74
75
  "sign": "🖊️️ Sign",
75
76
  "emergency": "🛟 Emergency",
76
77
  "honest": "😇 Honest",
package/config/index.js CHANGED
@@ -41,52 +41,88 @@ export default {
41
41
  ],
42
42
  invoke: {
43
43
  start: {
44
- key: 'start',
45
44
  prev_key: 'init',
46
45
  next_key: 'enter',
47
46
  onfunc: 'onStart',
47
+ clear: false,
48
48
  },
49
49
  enter: {
50
- key: 'enter',
51
50
  prev_key: 'start',
52
51
  next_key: 'done',
53
52
  onfunc: 'onEnter',
53
+ clear: false,
54
54
  },
55
55
  done: {
56
- key: 'done',
57
56
  prev_key: 'enter',
58
57
  next_key: 'ready',
59
58
  onfunc: 'onDone',
59
+ clear: false,
60
60
  },
61
61
  ready: {
62
- key: 'ready',
63
62
  prev_key: 'done',
64
63
  next_key: false,
65
64
  onfunc: 'onReady',
65
+ clear: false,
66
66
  },
67
67
  finish: {
68
- key: 'finish',
69
68
  prev_key: 'answer',
70
69
  next_key: 'complete',
71
70
  onfunc: 'onFinish',
71
+ clear: false,
72
72
  },
73
73
  complete: {
74
- key: 'complete',
75
74
  prev_key: 'finish',
76
75
  next_key: false,
77
76
  onfunc: 'onComplete',
77
+ clear: false,
78
78
  },
79
79
  stop: {
80
- key: 'stop',
81
80
  prev_key: false,
82
- next_key: 'exit',
81
+ next_key: 'close',
83
82
  onfunc: 'onStop',
83
+ clear: false,
84
+ },
85
+ close: {
86
+ prev_key: 'stop',
87
+ next_key: 'leave',
88
+ onfunc: 'onClose',
89
+ clear: false,
90
+ },
91
+ leave: {
92
+ prev_key: 'close',
93
+ next_key: 'exit',
94
+ onfunc: 'onClose',
95
+ clear: false,
84
96
  },
85
97
  exit: {
86
- key: 'exit',
87
98
  prev_key: 'stop',
88
99
  next_key: false,
89
100
  onfunc: 'onExit',
101
+ clear: [
102
+ '_active',
103
+ '_indra',
104
+ '_veda',
105
+ '_license',
106
+ '_data',
107
+ '_error',
108
+ '_log',
109
+ '_report',
110
+ '_vector',
111
+ '_king',
112
+ '_treasury',
113
+ '_security',
114
+ '_guard',
115
+ '_defense',
116
+ '_wall',
117
+ '_proxy',
118
+ '_legal',
119
+ '_authority',
120
+ '_justice',
121
+ '_support',
122
+ '_services',
123
+ '_systems',
124
+ '_networks',
125
+ ]
90
126
  }
91
127
  },
92
128
  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
@@ -291,6 +291,74 @@ class Deva {
291
291
  return this.err(e);
292
292
  }
293
293
  }
294
+
295
+ /**************
296
+ func: _invoke
297
+ params:
298
+ - data: the data to pass to the resolve
299
+ - resolve: the complete resolve to pass back
300
+ describe: The _invoke function is used for the recursion over
301
+ init, start, enter, done ready, finish, complete
302
+ usage: this.complete(data, resolve)
303
+ ***************/
304
+ _invoke(opts) {
305
+ if (!this._active) return resolve(this._messages.offline);
306
+ const {key, data, resolve} = opts;
307
+ const {prev_key, next_key, onfunc, clear} = config.invoke[key];
308
+ this.action('invoke', `${key}:${data.id.uid}`);
309
+ this.context(key, data.id.uid);
310
+ this.zone(key, data.id.uid);
311
+ this.action(key, data.id.uid);
312
+ this.state(key, data.id.uid);
313
+
314
+ this.action('delete', `${key}:md5:${data.id.uid}`);
315
+ delete data.md5;
316
+
317
+ this.action('delete', `${key}:sha256:${data.id.uid}`);
318
+ delete data.sha256;
319
+
320
+ this.action('delete', `${key}:sha512:${data.id.uid}`);
321
+ delete data.sha512;
322
+
323
+ this.state('data', `${key}:date:${data.id.uid}`);
324
+ data[key] = Date.now();// set the complete date on the whole data.
325
+
326
+ this.action('hash', `${key}:md5:${data.id.uid}`);
327
+ data.md5 = this.hash(data, 'md5');
328
+
329
+ this.action('hash', `${key}:sha256:${data.id.uid}`)
330
+ data.sha256 = this.hash(data, 'sha256');
331
+
332
+ this.action('hash', `${key}:sha512:${data.id.uid}`)
333
+ data.sha512 = this.hash(data, 'sha512');
334
+
335
+ // setup the complete talk event
336
+ this.action('talk', `${this._events[key]}:${data.id.uid}`); // action talk for the event.
337
+ this.talk(this._events[key], data); // talk the complete event
338
+
339
+ if (clear) {
340
+ this.state('loop', `${key}:clear:${data.id.uid}`);
341
+ for (let item of config.invoke.exit.clear) {
342
+ this[item] = false;
343
+ }
344
+ }
345
+
346
+ // determine if there is an onComplete function for the entity.
347
+ const hasOnFunc = this[onfunc] && typeof this[onfunc] === 'function';
348
+ if (hasOnFunc) {
349
+ this.action('onfunc', `${key}:has:${onfunc}:${data.id.uid}`); // action onfunc
350
+ this.state('onfunc', `${key}:has:${onfunc}:${data.id.uid}`); // state onfunc
351
+ this.action('return', `${onfunc}:${data.id.uid}`); // action return
352
+ this.state('valid', `${onfunc}:${data.id.uid}`); // state valid
353
+ this.intent('good', `${onfunc}:${data.id.uid}`); // intent good
354
+ return this[onfunc](data, resolve);
355
+ }
356
+
357
+ this.action('return', `${key}:${data.id.uid}`); // return action complete
358
+ this.state('valid', `${key}:${data.id.uid}`); // return state valid
359
+ this.intent('good', `${key}:${data.id.uid}`); // return intent good
360
+ return next_key ? this[next_key](data, resolve) : resolve(data);
361
+ }
294
362
 
295
363
  /**************
296
364
  func: Client
@@ -878,7 +946,7 @@ class Deva {
878
946
  this.state('set', `${key}:${method}:data:${id.uid}`);
879
947
  const data = typeof result === 'object' ? result.data : false;
880
948
 
881
- this.state('data', `${key}:${method}:${sub_key}:${id.uid}`);
949
+ this.state('data', `${key}:${method}:${subkey}:${id.uid}`);
882
950
  const packet_answer = { // setup the packet.a container
883
951
  id,
884
952
  agent, // set the agent who answered the question
@@ -894,16 +962,16 @@ class Deva {
894
962
  created: Date.now(), // set the created date for the answer
895
963
  };
896
964
  // create a hash for the answer and insert into answer meta.
897
- this.action('hash', `${key}:${method}:${sub_key}:md5:${id.uid}`);
965
+ this.action('hash', `${key}:${method}:${subkey}:md5:${id.uid}`);
898
966
  packet_answer.md5 = this.hash(packet_answer, 'md5');
899
967
 
900
- this.action('hash', `${key}:${method}:${sub_key}:sha256:${id.uid}`);
968
+ this.action('hash', `${key}:${method}:${subkey}:sha256:${id.uid}`);
901
969
  packet_answer.sha256 = this.hash(packet_answer, 'sha256');
902
970
 
903
- this.action('hash', `${key}:${method}:${sub_key}:sha512:${id.uid}`);
971
+ this.action('hash', `${key}:${method}:${subkey}:sha512:${id.uid}`);
904
972
  packet_answer.sha512 = this.hash(packet_answer, 'sha512');
905
973
 
906
- this.state('set', `${key}:${method}:${sub_key}:${id.uid}`);
974
+ this.state('set', `${key}:${method}:${subkey}:${id.uid}`);
907
975
  packet.a = packet_answer; // set the packet.a to the packet_answer
908
976
 
909
977
  this.action('talk', `${this._events.answer}:${id.uid}`);
@@ -1187,29 +1255,22 @@ class Deva {
1187
1255
 
1188
1256
  /**************
1189
1257
  func: start
1190
- params:
1191
- - msg: the message for use when using custome flow logic to pass to onEnter
1192
- describe:
1193
- The start function begins the process by setting the state to start setting
1194
- the active to the current datetime and then checking for a custom onStart
1195
- function or running the enter function.
1196
- usage: this.start('msg')
1258
+ usage: this.start(data, resolve);
1259
+ params: data, resolve
1260
+ - data: The data packet that is passed through the invoke chain.
1261
+ - resolve: The Promise resolver following the data through recursion.
1262
+ describe:
1263
+ The start() function initiates the Invoke Recursion Framework phase for the
1264
+ current Deva context. It first checks for active runtime status, retrieves
1265
+ invocation parameters (key-chain mapping, lifecycle handlers) from
1266
+ config.invoke.start, declares the invoke action, and then delegates control
1267
+ to _invoke(), ensuring consistent recursion through the start-enter-done
1268
+ sequence. This design preserves language-agnostic interoperability and
1269
+ deterministic state transitions across Deva systems.
1197
1270
  ***************/
1198
1271
  start(data, resolve) {
1199
1272
  if (!this._active) return resolve(this._messages.offline);
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
- });
1273
+ return this._invoke({key:'start',data,resolve});
1213
1274
  }
1214
1275
 
1215
1276
  /**************
@@ -1225,19 +1286,7 @@ class Deva {
1225
1286
  ***************/
1226
1287
  enter(data, resolve) {
1227
1288
  if (!this._active) return resolve(this._messages.offline);
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
- });
1289
+ return this._invoke({key:'enter',data,resolve});
1241
1290
  }
1242
1291
 
1243
1292
  /**************
@@ -1253,19 +1302,7 @@ class Deva {
1253
1302
  ***************/
1254
1303
  done(data, resolve) {
1255
1304
  if (!this._active) return resolve(this._messages.offline);
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
- });
1305
+ return this._invoke({key:'done',data,resolve});
1269
1306
  }
1270
1307
 
1271
1308
  /**************
@@ -1278,16 +1315,15 @@ class Deva {
1278
1315
  ***************/
1279
1316
  ready(data, resolve) {
1280
1317
  if (!this._active) return resolve(this._messages.offline);
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);
1318
+ const key = 'ready';
1287
1319
 
1320
+ this.state('set', `${key}:agent:${data.id.uid}`);
1288
1321
  const agent = this.agent();
1322
+
1289
1323
  this.state('set', `${key}:config:hash:${data.id.uid}`); // state set to watch OnFinish
1290
1324
  this.config.hash[agent.key] = {};
1325
+
1326
+ this.state('loop', `${key}:config:ready:hash:${data.id.uid}`);
1291
1327
  for (let item of this._config.ready_hash) {
1292
1328
  if (this[item]) {
1293
1329
  const this_item = this[item];
@@ -1295,14 +1331,7 @@ class Deva {
1295
1331
  this.config.hash[agent.key][item] = this.hash(this_item, 'sha256');
1296
1332
  }
1297
1333
  }
1298
- return this._invoke({
1299
- key,
1300
- prev_key,
1301
- next_key,
1302
- onfunc,
1303
- data,
1304
- resolve,
1305
- });
1334
+ return this._invoke({key,data,resolve});
1306
1335
  }
1307
1336
 
1308
1337
  /**************
@@ -1315,21 +1344,7 @@ class Deva {
1315
1344
  ***************/
1316
1345
  finish(data, resolve) {
1317
1346
  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
1324
-
1325
- return this._invoke({
1326
- key,
1327
- prev_key,
1328
- next_key,
1329
- onfunc,
1330
- data,
1331
- resolve,
1332
- });
1347
+ return this._invoke({key:'finish',data,resolve});
1333
1348
  }
1334
1349
 
1335
1350
  /**************
@@ -1343,101 +1358,23 @@ class Deva {
1343
1358
  ***************/
1344
1359
  complete(data, resolve) {
1345
1360
  if (!this._active) return resolve(this._messages.offline);
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);
1377
-
1378
- this.action('delete', `${key}:md5:${data.id.uid}`);
1379
- delete data.md5;
1380
-
1381
- this.action('delete', `${key}:sha256:${data.id.uid}`);
1382
- delete data.sha256;
1383
-
1384
- this.action('delete', `${key}:sha512:${data.id.uid}`);
1385
- delete data.sha512;
1386
-
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}`);
1391
- data.md5 = this.hash(data, 'md5');
1392
-
1393
- this.action('hash', `${key}:sha256:${data.id.uid}`)
1394
- data.sha256 = this.hash(data, 'sha256');
1395
-
1396
- this.action('hash', `${key}:sha512:${data.id.uid}`)
1397
- data.sha512 = this.hash(data, 'sha512');
1398
-
1399
- // setup the complete talk 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
1402
-
1403
- // determine if there is an onComplete function for the entity.
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);
1412
- }
1413
-
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);
1361
+ return this._invoke({key:'complete',data,resolve});
1418
1362
  }
1419
-
1363
+
1420
1364
  /**************
1421
1365
  func: stop
1422
1366
  params:
1423
1367
  - msg: hte message from the caller incase need to use in calls
1424
1368
  describe:
1425
- The stop function will stop the Deva by setting the active status to false,
1426
- and the state to stop. From here it will check for a custom onStop function
1427
- for anything to run, or run the exit function.
1428
-
1429
- If the deva is offline it will return the offline message.
1369
+ The stop function will stop the Deva by setting necessary context,
1370
+ zone, action, state to stop and creating the stop data packet.
1430
1371
  usage:
1431
1372
  this.stop()
1432
1373
  ***************/
1433
1374
  stop() {
1434
1375
  if (!this._active) return this._messages.offline;
1435
- const {key, prev_key, next_key, onfunc} = config.invoke.stop;
1376
+ const key = 'stop';
1436
1377
  const id = this.uid();
1437
- this.context(key, id.uid);
1438
- this.zone(key, id.uid);
1439
- this.action(key, id.uid);
1440
- this.state(key, id.uid); // set the state to stop
1441
1378
 
1442
1379
  this.state('set', `${key}:agent:${id.uid}`); // state stop agent
1443
1380
  const agent = this.agent().sha256; // get the current agent
@@ -1455,26 +1392,48 @@ class Deva {
1455
1392
  client, // set the client
1456
1393
  stop: Date.now(), // set the created date
1457
1394
  }
1395
+
1396
+ return this._invoke({
1397
+ key,
1398
+ data,
1399
+ resolve: Promise.resolve(),
1400
+ })
1401
+ }
1458
1402
 
1459
- this.action('hash', `stop:md5:${data.id.uid}`);
1460
- data.md5 = this.hash(data, 'md5');
1461
- this.action('hash', `stop:sha256:${data.id.uid}`)
1462
- data.sha256 = this.hash(data, 'sha256');
1463
- this.action('hash', `stop:sha512:${data.id.uid}`)
1464
- data.sha512 = this.hash(data, 'sha512');
1403
+ /**************
1404
+ func: close
1405
+ usage: this.close(data, resolve);
1406
+ params: data, resolve
1407
+ - data: The data packet that is passed through the closing invoke chain.
1408
+ - resolve: The Promise resolver following the data through recursion.
1409
+ describe:
1410
+ The close() function initiates the closing Invoke Recursion Framework.
1411
+ It first checks for active runtime status, retrieves invocation parameters
1412
+ (chain mapping, lifecycle handlers) from config.invoke.close and then
1413
+ delegates control to _invoke(), ensuring consistent recursion through the
1414
+ start-enter-done sequence.
1415
+ ***************/
1416
+ close(data, resolve) {
1417
+ if (!this._active) return resolve(this._messages.offline);
1418
+ return this._invoke({key:'close',data,resolve});
1419
+ }
1465
1420
 
1466
- // has stop function then set hasOnStop variable
1467
- // if: has on stop then run on stop function or return exit function.
1468
- this.action('talk', `${this._events.stop}:${data.id.uid}`); // action talk for the event.
1469
- this.talk(this._events.stop, data);
1470
-
1471
- // determine if there is an onComplete function for the entity.
1472
- const hasOnStop = this.onStop && typeof this.onStop === 'function';
1473
- if (hasOnStop) {
1474
- this.action('onfunc', `hasOnStop:${data.id.uid}`); // action onfunc
1475
- this.state('onfunc', `hasOnStop:${data.id.uid}`); // state onfunc
1476
- }
1477
- return hasOnStop ? this.onStop(data) : this.exit(data)
1421
+ /**************
1422
+ func: leave
1423
+ usage: this.leave(data, resolve);
1424
+ params: data, resolve
1425
+ - data: The data packet that is passed through the closing invoke chain.
1426
+ - resolve: The Promise resolver following the data through recursion.
1427
+ describe:
1428
+ The leave() function initiates the leave aspect of the Invoke Recursion
1429
+ Framework. It first checks for active runtime status, retrieves invocation
1430
+ parameters (chain mapping, lifecycle handlers) from config.invoke.close and
1431
+ then delegates control to _invoke(), ensuring consistent recursion through
1432
+ the start-enter-done sequence.
1433
+ ***************/
1434
+ leave(data, resolve) {
1435
+ if (!this._active) return resolve(this._messages.offline);
1436
+ return this._invoke({key:'leave',data,resolve});
1478
1437
  }
1479
1438
 
1480
1439
  /**************
@@ -1487,68 +1446,11 @@ class Deva {
1487
1446
  The return will check for a custom onExit function or run the done
1488
1447
  function.
1489
1448
  ***************/
1490
- exit(data) {
1449
+ exit(data, resolve) {
1491
1450
  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}`);
1500
- delete data.md5;
1501
- this.action('delete', `${data.key_prev}:sha256:${data.id.uid}`);
1502
- delete data.sha256;
1503
- this.action('delete', `${data.key_prev}:sha512:${data.id.uid}`);
1504
- delete data.sha512;
1505
-
1506
- this.state('set', `${data.key}:time:${data.id.uid}`); // state stop agent
1507
- data.exit = Date.now();
1508
-
1509
- this.action('hash', `${data.key}:md5:${data.id.uid}`);
1510
- data.md5 = this.hash(data, 'md5');
1511
- this.action('hash', `${data.key}:sha256:${data.id.uid}`)
1512
- data.sha256 = this.hash(data, 'sha256');
1513
- this.action('hash', `${data.key}:sha512:${data.id.uid}`)
1514
- data.sha512 = this.hash(data, 'sha512');
1515
-
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.
1540
-
1541
- this.action('talk', `${this._events.stop}:${data.id.uid}`); // action talk for the event.
1542
- this.talk(this._events.exit, data);
1543
-
1544
- const hasOnExit = this.onExit && typeof this.onExit === 'function';
1545
- if (hasOnExit) {
1546
- this.action('onfunc', `hasOnExit:${data.id.uid}`); // action onfunc
1547
- this.state('onfunc', `hasOnExit:${data.id.uid}`); // state onfunc
1548
- }
1549
-
1550
- this.action('resolve', `exit:${data.uid}`);
1551
- return hasOnExit ? this.onExit(data) : Promise.resolve(data)
1451
+ const key = 'exit';
1452
+ data.key = key;
1453
+ return this._invoke({key, data, resolve})
1552
1454
  }
1553
1455
 
1554
1456
 
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.3",
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",