@indra.ai/deva 1.7.2 β 1.8.2
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 -1
- package/config/beliefs.json +2 -0
- package/config/index.js +78 -3
- package/config/intents.json +11 -1
- package/config/states.json +6 -2
- package/config/zones.json +6 -1
- package/index.js +173 -264
- package/package.json +1 -1
package/config/actions.json
CHANGED
|
@@ -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
|
}
|
package/config/beliefs.json
CHANGED
|
@@ -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,81 @@ 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
|
+
clear: [
|
|
91
|
+
'_active',
|
|
92
|
+
'_indra',
|
|
93
|
+
'_veda',
|
|
94
|
+
'_license',
|
|
95
|
+
'_data',
|
|
96
|
+
'_error',
|
|
97
|
+
'_log',
|
|
98
|
+
'_report',
|
|
99
|
+
'_vector',
|
|
100
|
+
'_king',
|
|
101
|
+
'_treasury',
|
|
102
|
+
'_security',
|
|
103
|
+
'_guard',
|
|
104
|
+
'_defense',
|
|
105
|
+
'_wall',
|
|
106
|
+
'_proxy',
|
|
107
|
+
'_legal',
|
|
108
|
+
'_authority',
|
|
109
|
+
'_justice',
|
|
110
|
+
'_support',
|
|
111
|
+
'_services',
|
|
112
|
+
'_systems',
|
|
113
|
+
'_networks',
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
},
|
|
42
117
|
context: false,
|
|
43
118
|
events: events.DATA,
|
|
44
119
|
feature: false,
|
|
@@ -47,11 +122,11 @@ export default {
|
|
|
47
122
|
zones: zones.DATA,
|
|
48
123
|
action: false,
|
|
49
124
|
actions: actions.DATA,
|
|
50
|
-
state:
|
|
125
|
+
state: 'offline',
|
|
51
126
|
states: states.DATA,
|
|
52
|
-
intent:
|
|
127
|
+
intent: 'neutral',
|
|
53
128
|
intents: intents.DATA,
|
|
54
|
-
belief:
|
|
129
|
+
belief: 'vedic',
|
|
55
130
|
beliefs: beliefs.DATA,
|
|
56
131
|
messages: msgs.DATA,
|
|
57
132
|
}
|
package/config/intents.json
CHANGED
|
@@ -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
|
}
|
package/config/states.json
CHANGED
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
"question": "π¬ Question",
|
|
16
16
|
"cmd": "πͺ Command",
|
|
17
17
|
"answer": "π‘ Answer",
|
|
18
|
-
"wait": "β³
|
|
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",
|
|
@@ -42,6 +43,8 @@
|
|
|
42
43
|
"put": "π€ Put",
|
|
43
44
|
"push": "π«Έ Push",
|
|
44
45
|
"pull": "π Pull",
|
|
46
|
+
"while": "π While",
|
|
47
|
+
"loop": "π Loop",
|
|
45
48
|
"search": "π Search",
|
|
46
49
|
"memory": "π Memory",
|
|
47
50
|
"signature": "βοΈοΈ Signature",
|
|
@@ -116,6 +119,7 @@
|
|
|
116
119
|
"mature": "π§ Mature",
|
|
117
120
|
"immature": "π§ Immature",
|
|
118
121
|
"consent": "βοΈ Consent",
|
|
119
|
-
"onfunc": "ποΈ onFunction"
|
|
122
|
+
"onfunc": "ποΈ onFunction",
|
|
123
|
+
"romance": "πΉ Romance"
|
|
120
124
|
}
|
|
121
125
|
}
|
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
|
-
|
|
1199
|
-
this.
|
|
1200
|
-
this.
|
|
1201
|
-
this.
|
|
1202
|
-
|
|
1203
|
-
this.
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
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
|
-
|
|
1252
|
-
this.
|
|
1253
|
-
this.
|
|
1254
|
-
this.
|
|
1255
|
-
|
|
1256
|
-
this.
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
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
|
-
|
|
1304
|
-
this.
|
|
1305
|
-
this.
|
|
1306
|
-
this.
|
|
1307
|
-
|
|
1308
|
-
this.
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
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
|
-
|
|
1353
|
-
this.
|
|
1354
|
-
this.
|
|
1355
|
-
this.
|
|
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);
|
|
1356
1287
|
|
|
1357
|
-
const agent = this.agent();
|
|
1358
|
-
|
|
1359
|
-
|
|
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
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
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
|
-
|
|
1417
|
-
this.
|
|
1418
|
-
this.
|
|
1419
|
-
this.
|
|
1420
|
-
|
|
1421
|
-
this.
|
|
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
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
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
|
-
|
|
1464
|
-
this.
|
|
1465
|
-
this.
|
|
1466
|
-
this.
|
|
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',
|
|
1378
|
+
this.action('delete', `${key}:md5:${data.id.uid}`);
|
|
1469
1379
|
delete data.md5;
|
|
1470
|
-
|
|
1380
|
+
|
|
1381
|
+
this.action('delete', `${key}:sha256:${data.id.uid}`);
|
|
1471
1382
|
delete data.sha256;
|
|
1472
|
-
|
|
1383
|
+
|
|
1384
|
+
this.action('delete', `${key}:sha512:${data.id.uid}`);
|
|
1473
1385
|
delete data.sha512;
|
|
1474
1386
|
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
this.action('hash',
|
|
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
|
-
|
|
1392
|
+
|
|
1393
|
+
this.action('hash', `${key}:sha256:${data.id.uid}`)
|
|
1481
1394
|
data.sha256 = this.hash(data, 'sha256');
|
|
1482
1395
|
|
|
1483
|
-
this.action('hash',
|
|
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
|
|
1488
|
-
this.talk(this._events
|
|
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
|
|
1492
|
-
if (
|
|
1493
|
-
this.action('onfunc',
|
|
1494
|
-
this.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',
|
|
1498
|
-
|
|
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
|
-
|
|
1527
|
-
|
|
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',
|
|
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
|
|
1534
|
-
agent
|
|
1535
|
-
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
|
|
|
@@ -1569,66 +1489,55 @@ class Deva {
|
|
|
1569
1489
|
***************/
|
|
1570
1490
|
exit(data) {
|
|
1571
1491
|
if (!this._active) return this._messages.offline;
|
|
1572
|
-
|
|
1573
|
-
data.key =
|
|
1574
|
-
|
|
1575
|
-
this.
|
|
1576
|
-
this.
|
|
1577
|
-
this.
|
|
1578
|
-
|
|
1579
|
-
|
|
1492
|
+
const {key, prev_key, next_key, onfunc} = config.invoke.exit;
|
|
1493
|
+
data.key = key;
|
|
1494
|
+
|
|
1495
|
+
this.context(key, data.id.uid);
|
|
1496
|
+
this.zone(key, data.id.uid);
|
|
1497
|
+
this.action(key, data.id.uid);
|
|
1498
|
+
this.state(key, data.id.uid); // set the state to stop
|
|
1499
|
+
|
|
1500
|
+
this.action('delete', `${prev_key}:md5:${data.id.uid}`);
|
|
1580
1501
|
delete data.md5;
|
|
1581
|
-
this.action('delete', `${
|
|
1502
|
+
this.action('delete', `${prev_key}:sha256:${data.id.uid}`);
|
|
1582
1503
|
delete data.sha256;
|
|
1583
|
-
this.action('delete', `${
|
|
1504
|
+
this.action('delete', `${prev_key}:sha512:${data.id.uid}`);
|
|
1584
1505
|
delete data.sha512;
|
|
1585
1506
|
|
|
1586
|
-
this.state('
|
|
1507
|
+
this.state('data', `${key}:time:${data.id.uid}`); // state stop agent
|
|
1587
1508
|
data.exit = Date.now();
|
|
1588
1509
|
|
|
1589
|
-
this.action('hash', `${
|
|
1510
|
+
this.action('hash', `${key}:md5:${data.id.uid}`);
|
|
1590
1511
|
data.md5 = this.hash(data, 'md5');
|
|
1591
|
-
this.action('hash', `${
|
|
1512
|
+
this.action('hash', `${key}:sha256:${data.id.uid}`)
|
|
1592
1513
|
data.sha256 = this.hash(data, 'sha256');
|
|
1593
|
-
this.action('hash', `${
|
|
1514
|
+
this.action('hash', `${key}:sha512:${data.id.uid}`)
|
|
1594
1515
|
data.sha512 = this.hash(data, 'sha512');
|
|
1595
1516
|
|
|
1596
|
-
// clear memory
|
|
1597
|
-
|
|
1598
|
-
this.
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
this._error = false; // inherited Error features.
|
|
1603
|
-
this._log = false; // inherited Log features.
|
|
1604
|
-
this._report = false; // inherited Report features.
|
|
1605
|
-
this._vector = false; // inherited Vector features.
|
|
1606
|
-
this._king = false; // inherited King features.
|
|
1607
|
-
this._treasury = false; // inherited Vector features.
|
|
1608
|
-
this._security = false; // inherited Security features.
|
|
1609
|
-
this._guard = false; // inherited Guard features.
|
|
1610
|
-
this._defense = false; // inherited Security features.
|
|
1611
|
-
this._wall = false; // inherited Wall features.
|
|
1612
|
-
this._proxy = false; // inherited Proxy features.
|
|
1613
|
-
this._legal = false; // inherited Legal features.
|
|
1614
|
-
this._authority = false; // inherited Justice features.
|
|
1615
|
-
this._justice = false; // inherited Justice features.
|
|
1616
|
-
this._support = false; // inherited Support features.
|
|
1617
|
-
this._services = false; // inherited Service features.
|
|
1618
|
-
this._systems = false; // inherited Systems features.
|
|
1619
|
-
this._networks = false; // inherited Systems features.
|
|
1517
|
+
// clear memory from config.invoke.exit.clear
|
|
1518
|
+
|
|
1519
|
+
this.state('loop', `${key}:clear:${data.id.uid}`);
|
|
1520
|
+
for (let item of config.invoke.exit.clear) {
|
|
1521
|
+
this[item] = false;
|
|
1522
|
+
}
|
|
1620
1523
|
|
|
1621
1524
|
this.action('talk', `${this._events.stop}:${data.id.uid}`); // action talk for the event.
|
|
1622
1525
|
this.talk(this._events.exit, data);
|
|
1623
1526
|
|
|
1624
1527
|
const hasOnExit = this.onExit && typeof this.onExit === 'function';
|
|
1625
1528
|
if (hasOnExit) {
|
|
1626
|
-
this.action('onfunc',
|
|
1627
|
-
this.state('onfunc',
|
|
1529
|
+
this.action('onfunc', `${onfunc}:${data.id.uid}`); // action onfunc
|
|
1530
|
+
this.state('onfunc', `${onfunc}:${data.id.uid}`); // state onfunc
|
|
1531
|
+
this.action('return', `${onfunc}:${data.id.uid}`); // state onfunc
|
|
1532
|
+
this.state('valid', `${onfunc}:${data.id.uid}`); // state onfunc
|
|
1533
|
+
this.intent('good', `${onfunc}:${data.id.uid}`); // state onfunc
|
|
1534
|
+
return this[onfunc](data);
|
|
1628
1535
|
}
|
|
1629
1536
|
|
|
1630
|
-
this.action('resolve',
|
|
1631
|
-
|
|
1537
|
+
this.action('resolve', `${key}:${data.uid}`);
|
|
1538
|
+
this.state('valid', `${key}:${data.uid}`);
|
|
1539
|
+
this.intent('good', `${key}:${data.uid}`);
|
|
1540
|
+
return Promise.resolve(data)
|
|
1632
1541
|
}
|
|
1633
1542
|
|
|
1634
1543
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "44091450722329207445",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.2",
|
|
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",
|