@indra.ai/deva 1.3.7 → 1.3.9
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.json +16 -9
- package/index.js +121 -38
- package/package.json +1 -1
- package/tests/agent.json +20 -5
- package/tests/client.json +22 -12
- package/tests/index.js +31 -29
package/config.json
CHANGED
|
@@ -45,9 +45,11 @@
|
|
|
45
45
|
"support": "🚑 Support",
|
|
46
46
|
"services": "🚚 Services",
|
|
47
47
|
"systems": "🚛 Systems",
|
|
48
|
+
"networks": "🛰️ Networks",
|
|
48
49
|
"legal": "🏛️ Legal",
|
|
49
50
|
"authority": "🚔 Authority",
|
|
50
51
|
"justice": "⚖️ Justice",
|
|
52
|
+
"defense": "🪖 Defense",
|
|
51
53
|
"help": "💚 Help",
|
|
52
54
|
"error": "❌ Error!"
|
|
53
55
|
},
|
|
@@ -121,7 +123,8 @@
|
|
|
121
123
|
"official": "🫡 Official",
|
|
122
124
|
"unofficial": "🤥 Unofficial",
|
|
123
125
|
"approved": "🎖️ Approved",
|
|
124
|
-
"denied": "🖕 Denied"
|
|
126
|
+
"denied": "🖕 Denied",
|
|
127
|
+
"secure": "🔏 Secure"
|
|
125
128
|
},
|
|
126
129
|
"action": false,
|
|
127
130
|
"actions": {
|
|
@@ -138,9 +141,9 @@
|
|
|
138
141
|
"done": "☑️ Done",
|
|
139
142
|
"ready": "🟢 Ready",
|
|
140
143
|
"question": "🙋 Question",
|
|
141
|
-
"talk": "📢
|
|
142
|
-
"context": "📇
|
|
143
|
-
"prompt": "🐚
|
|
144
|
+
"talk": "📢 Talk",
|
|
145
|
+
"context": "📇 Context",
|
|
146
|
+
"prompt": "🐚 Prompt",
|
|
144
147
|
"issue": "🎫 Issue",
|
|
145
148
|
"find": "🔎 Find",
|
|
146
149
|
"parse": "🏘️ Parse",
|
|
@@ -152,7 +155,7 @@
|
|
|
152
155
|
"status": "🚥 Status",
|
|
153
156
|
"func": "🔦 Function",
|
|
154
157
|
"method": "❤️🔥 Method",
|
|
155
|
-
"list": "📋 List
|
|
158
|
+
"list": "📋 List",
|
|
156
159
|
"reply": "📮 Reply",
|
|
157
160
|
"write": "️📝 Write",
|
|
158
161
|
"set": "🍽️ Set",
|
|
@@ -174,20 +177,22 @@
|
|
|
174
177
|
"client": "👨 Client",
|
|
175
178
|
"agent": "🕵️♂️ Agent",
|
|
176
179
|
"security": "🔐 Security",
|
|
177
|
-
"support": "🩹
|
|
180
|
+
"support": "🩹 Support",
|
|
178
181
|
"services": "🛠️ Services",
|
|
179
|
-
"systems": "
|
|
182
|
+
"systems": "🖥️ Systems",
|
|
183
|
+
"networks": "📡 Networks",
|
|
180
184
|
"legal": "🗃️ Legal",
|
|
181
185
|
"justice": "🗄️ Justice",
|
|
182
186
|
"authority": "👮 Authority",
|
|
187
|
+
"defense": "🪖 Defense",
|
|
183
188
|
|
|
184
189
|
"invalid": "❌ Invalid",
|
|
185
190
|
"states": "🛻 States",
|
|
186
191
|
"actions": "🏎️ Actions",
|
|
187
192
|
"zones": "Zones",
|
|
188
193
|
"feature": "🎥 Feature",
|
|
189
|
-
"features": "🎥
|
|
190
|
-
"contexts": "🌈
|
|
194
|
+
"features": "🎥 Features",
|
|
195
|
+
"contexts": "🌈 Contexts",
|
|
191
196
|
"help": "💜 Help",
|
|
192
197
|
"error": "🔴 ERROR!",
|
|
193
198
|
"lawful": "🚓 Lawful",
|
|
@@ -209,9 +214,11 @@
|
|
|
209
214
|
"support": "💼 Support",
|
|
210
215
|
"services": "🛠️ Services",
|
|
211
216
|
"systems": "🖥️️ Systems",
|
|
217
|
+
"networks": "🛜️️ Networks",
|
|
212
218
|
"legal": "🗂️️️ Legal",
|
|
213
219
|
"justice": "🏛️️ Justice",
|
|
214
220
|
"authority": "🚓️️ Authority",
|
|
221
|
+
"defense": "🪖️️ Defense",
|
|
215
222
|
"cipher": "🔒 Cipher",
|
|
216
223
|
"decipher": "🔓 Decipher",
|
|
217
224
|
"promp": "🪵 Prompt",
|
package/index.js
CHANGED
|
@@ -21,9 +21,11 @@ class Deva {
|
|
|
21
21
|
this._support = false; // inherited Support features.
|
|
22
22
|
this._services = false; // inherited Service features.
|
|
23
23
|
this._systems = false; // inherited Systems features.
|
|
24
|
+
this._networks = false; // inherited Systems features.
|
|
24
25
|
this._legal = false; // inherited Legal features.
|
|
25
26
|
this._justice = false; // inherited Justice features.
|
|
26
|
-
this._authority = false; // inherited
|
|
27
|
+
this._authority = false; // inherited Authority features.
|
|
28
|
+
this._defense = false; // inherited Defense features.
|
|
27
29
|
this.events = opts.events || new EventEmitter({}); // Event Bus
|
|
28
30
|
this.lib = new lib({}); // used for loading library functions
|
|
29
31
|
this.utils = opts.utils || {}; // parse function
|
|
@@ -297,6 +299,17 @@ class Deva {
|
|
|
297
299
|
return this.Feature('systems', resolve, reject);
|
|
298
300
|
}
|
|
299
301
|
|
|
302
|
+
/**************
|
|
303
|
+
func: Networks
|
|
304
|
+
params: resolve, reject
|
|
305
|
+
describe:
|
|
306
|
+
The Networks feature sets the correct variables and necessary rules for the
|
|
307
|
+
client presented data.
|
|
308
|
+
***************/
|
|
309
|
+
Networks(resolve, reject) {
|
|
310
|
+
return this.Feature('networks', resolve, reject);
|
|
311
|
+
}
|
|
312
|
+
|
|
300
313
|
/**************
|
|
301
314
|
func: Legal
|
|
302
315
|
params: client: false
|
|
@@ -330,16 +343,28 @@ class Deva {
|
|
|
330
343
|
return this.Feature('authority', resolve, reject);
|
|
331
344
|
}
|
|
332
345
|
|
|
346
|
+
/**************
|
|
347
|
+
func: Defense
|
|
348
|
+
params: client: false
|
|
349
|
+
describe:
|
|
350
|
+
The Defense feature sets the correct variables and necessary rules for the
|
|
351
|
+
client presented data.
|
|
352
|
+
***************/
|
|
353
|
+
Defense(resolve, reject) {
|
|
354
|
+
return this.Feature('defense', resolve, reject);
|
|
355
|
+
}
|
|
356
|
+
|
|
333
357
|
/**************
|
|
334
358
|
func: Done
|
|
335
359
|
params: none
|
|
336
360
|
describe: The end of the workflow Client Feature Workflow
|
|
337
361
|
***************/
|
|
338
362
|
Done(resolve, reject) {
|
|
339
|
-
this.action('done');
|
|
363
|
+
this.action('done', 'init');
|
|
340
364
|
try {
|
|
341
|
-
this.state('
|
|
365
|
+
this.state('secure', 'data');
|
|
342
366
|
delete this._client.features; // delete the features key when done.
|
|
367
|
+
this.state('resolve', 'init');
|
|
343
368
|
return resolve(this.client()); // resolve an empty pr
|
|
344
369
|
} catch (e) {
|
|
345
370
|
this.state('reject', 'Done');
|
|
@@ -674,21 +699,45 @@ class Deva {
|
|
|
674
699
|
this.action('init');
|
|
675
700
|
this.state('init');
|
|
676
701
|
return this.Client(client, resolve, reject);
|
|
677
|
-
}).then(
|
|
702
|
+
}).then(part => {
|
|
703
|
+
this.state('done', 'client');
|
|
704
|
+
this.action('done', 'client');
|
|
678
705
|
return this.Security(resolve, reject);
|
|
679
|
-
}).then(
|
|
706
|
+
}).then(part => {
|
|
707
|
+
this.state('done', 'security');
|
|
708
|
+
this.action('done', 'security');
|
|
680
709
|
return this.Support(resolve, reject);
|
|
681
710
|
}).then(() => {
|
|
711
|
+
this.state('done', 'support');
|
|
712
|
+
this.action('done', 'support');
|
|
682
713
|
return this.Services(resolve, reject);
|
|
683
714
|
}).then(() => {
|
|
715
|
+
this.state('done', 'services');
|
|
716
|
+
this.action('done', 'services');
|
|
684
717
|
return this.Systems(resolve, reject);
|
|
685
718
|
}).then(() => {
|
|
719
|
+
this.state('done', 'systems');
|
|
720
|
+
this.action('done', 'systems');
|
|
721
|
+
return this.Networks(resolve, reject);
|
|
722
|
+
}).then(() => {
|
|
723
|
+
this.state('done', 'networks');
|
|
724
|
+
this.action('done', 'networks');
|
|
686
725
|
return this.Legal(resolve, reject);
|
|
687
726
|
}).then(() => {
|
|
727
|
+
this.state('done', 'legal');
|
|
728
|
+
this.action('done', 'legal');
|
|
729
|
+
return this.Authority(resolve, reject);
|
|
730
|
+
}).then(() => {
|
|
731
|
+
this.state('done', 'authority');
|
|
732
|
+
this.action('done', 'authority');
|
|
688
733
|
return this.Justice(resolve, reject);
|
|
689
734
|
}).then(() => {
|
|
690
|
-
|
|
735
|
+
this.state('done', 'justice');
|
|
736
|
+
this.action('done', 'justice');
|
|
737
|
+
return this.Defense(resolve, reject);
|
|
691
738
|
}).then(() => {
|
|
739
|
+
this.state('done', 'defense');
|
|
740
|
+
this.action('done', 'defense');
|
|
692
741
|
return this.Done(resolve, reject);
|
|
693
742
|
}).then(() => {
|
|
694
743
|
const hasOnInit = this.onInit && typeof this.onInit === 'function';
|
|
@@ -733,7 +782,7 @@ class Deva {
|
|
|
733
782
|
usage: this.enter('msg')
|
|
734
783
|
***************/
|
|
735
784
|
enter(data, resolve) {
|
|
736
|
-
this.zone('
|
|
785
|
+
this.zone('enter');
|
|
737
786
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
738
787
|
this.action('enter');
|
|
739
788
|
data.value = 'enter';
|
|
@@ -763,35 +812,9 @@ class Deva {
|
|
|
763
812
|
data.hash = this.lib.hash(data);
|
|
764
813
|
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
765
814
|
this.state('done');
|
|
766
|
-
return hasOnDone ? this.onDone(data, resolve) : this.
|
|
815
|
+
return hasOnDone ? this.onDone(data, resolve) : this.finish(data, resolve);
|
|
767
816
|
}
|
|
768
817
|
|
|
769
|
-
/**************
|
|
770
|
-
func: ready
|
|
771
|
-
params:
|
|
772
|
-
- packet: the data to pass to the resolve
|
|
773
|
-
- resolve: the complete resolve to pass back
|
|
774
|
-
describe: This function is use to relay the Agent ito a complete state when
|
|
775
|
-
resolving a question or data.
|
|
776
|
-
usage: this.complete(data, resolve)
|
|
777
|
-
***************/
|
|
778
|
-
ready(packet, resolve) {
|
|
779
|
-
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
780
|
-
this.action('ready'); // set the complete action
|
|
781
|
-
|
|
782
|
-
packet.hash = this.lib.hash(packet);// hash the entire packet before completeing.
|
|
783
|
-
// check for agent on complete function in agent
|
|
784
|
-
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
785
|
-
|
|
786
|
-
// if: agent has on complete then return on complete
|
|
787
|
-
this.state('ready'); // set the finish state
|
|
788
|
-
|
|
789
|
-
// return the provided resolve function or a promise resolve.
|
|
790
|
-
return hasOnReady ? this.onReady(packet, resolve) : resolve(packet);
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
818
|
/**************
|
|
796
819
|
func: finish
|
|
797
820
|
params:
|
|
@@ -835,9 +858,33 @@ class Deva {
|
|
|
835
858
|
// if: agent has on complete then return on complete
|
|
836
859
|
this.state('complete'); // set the finish state
|
|
837
860
|
// return the provided resolve function or a promise resolve.
|
|
838
|
-
return hasOnComplete ? this.onComplete(packet) :
|
|
861
|
+
return hasOnComplete ? this.onComplete(packet) : this.ready(packet, resolve);
|
|
839
862
|
}
|
|
840
863
|
|
|
864
|
+
/**************
|
|
865
|
+
func: ready
|
|
866
|
+
params:
|
|
867
|
+
- packet: the data to pass to the resolve
|
|
868
|
+
- resolve: the complete resolve to pass back
|
|
869
|
+
describe: This function is use to relay the Agent ito a complete state when
|
|
870
|
+
resolving a question or data.
|
|
871
|
+
usage: this.complete(data, resolve)
|
|
872
|
+
***************/
|
|
873
|
+
ready(packet, resolve) {
|
|
874
|
+
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
875
|
+
this.action('ready'); // set the complete action
|
|
876
|
+
|
|
877
|
+
packet.hash = this.lib.hash(packet);// hash the entire packet before completeing.
|
|
878
|
+
// check for agent on complete function in agent
|
|
879
|
+
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
880
|
+
|
|
881
|
+
// if: agent has on complete then return on complete
|
|
882
|
+
this.state('ready'); // set the finish state
|
|
883
|
+
|
|
884
|
+
// return the provided resolve function or a promise resolve.
|
|
885
|
+
return hasOnReady ? this.onReady(packet, resolve) : resolve(packet);
|
|
886
|
+
}
|
|
887
|
+
|
|
841
888
|
/**************
|
|
842
889
|
func: stop
|
|
843
890
|
params:
|
|
@@ -1251,11 +1298,29 @@ class Deva {
|
|
|
1251
1298
|
}
|
|
1252
1299
|
}
|
|
1253
1300
|
|
|
1301
|
+
/**************
|
|
1302
|
+
func: networks
|
|
1303
|
+
params: none
|
|
1304
|
+
describe: basic networks features available in a Deva.
|
|
1305
|
+
usage: this.networks()
|
|
1306
|
+
***************/
|
|
1307
|
+
networks() {
|
|
1308
|
+
if (!this._active) return this._messages.offline; // check the active status
|
|
1309
|
+
this.zone('networks');
|
|
1310
|
+
this.feature('networks'); // set the support state
|
|
1311
|
+
try {
|
|
1312
|
+
this.state('return', 'networks'); // set the networks state
|
|
1313
|
+
return this.lib.copy(this._networks); // return the systems feature
|
|
1314
|
+
} catch (e) {
|
|
1315
|
+
return this.error(e); // return this.error when error catch
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1254
1319
|
/**************
|
|
1255
1320
|
func: legal
|
|
1256
1321
|
params: none
|
|
1257
1322
|
describe: basic legal features available in a Deva.
|
|
1258
|
-
usage: this.
|
|
1323
|
+
usage: this.legal()
|
|
1259
1324
|
***************/
|
|
1260
1325
|
legal() {
|
|
1261
1326
|
if (!this._active) return this._messages.offline; // check the active status
|
|
@@ -1273,7 +1338,7 @@ class Deva {
|
|
|
1273
1338
|
func: justice
|
|
1274
1339
|
params: none
|
|
1275
1340
|
describe: basic justice features available in a Deva.
|
|
1276
|
-
usage: this.
|
|
1341
|
+
usage: this.justice()
|
|
1277
1342
|
***************/
|
|
1278
1343
|
justice() {
|
|
1279
1344
|
if (!this._active) return this._messages.offline; // check the active status
|
|
@@ -1291,7 +1356,7 @@ class Deva {
|
|
|
1291
1356
|
func: authority
|
|
1292
1357
|
params: none
|
|
1293
1358
|
describe: basic authority features available in a Deva.
|
|
1294
|
-
usage: this.
|
|
1359
|
+
usage: this.authority()
|
|
1295
1360
|
***************/
|
|
1296
1361
|
authority() {
|
|
1297
1362
|
if (!this._active) return this._messages.offline; // check the active status
|
|
@@ -1305,6 +1370,24 @@ class Deva {
|
|
|
1305
1370
|
}
|
|
1306
1371
|
}
|
|
1307
1372
|
|
|
1373
|
+
/**************
|
|
1374
|
+
func: defense
|
|
1375
|
+
params: none
|
|
1376
|
+
describe: basic defense features available in a Deva.
|
|
1377
|
+
usage: this.defense()
|
|
1378
|
+
***************/
|
|
1379
|
+
defense() {
|
|
1380
|
+
if (!this._active) return this._messages.offline; // check the active status
|
|
1381
|
+
this.zone('defense');
|
|
1382
|
+
this.feature('defense'); // set the support state
|
|
1383
|
+
try {
|
|
1384
|
+
this.state('return', 'defense'); // set the systems state
|
|
1385
|
+
return this.lib.copy(this._defense); // return the systems feature
|
|
1386
|
+
} catch (e) {
|
|
1387
|
+
return this.error(e); // return this.error when error catch
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1308
1391
|
/**************
|
|
1309
1392
|
func: load
|
|
1310
1393
|
params:
|
package/package.json
CHANGED
package/tests/agent.json
CHANGED
|
@@ -21,10 +21,6 @@
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"voice": {
|
|
25
|
-
"speech": "Alex",
|
|
26
|
-
"speed": 1
|
|
27
|
-
},
|
|
28
24
|
"profile": {
|
|
29
25
|
"name": "Deva",
|
|
30
26
|
"describe": "The Indra interface into deva.world.",
|
|
@@ -58,6 +54,12 @@
|
|
|
58
54
|
"tag": "#SYSTEMS",
|
|
59
55
|
"loc": "$SYSTEMS"
|
|
60
56
|
},
|
|
57
|
+
"networks": {
|
|
58
|
+
"label": "📡NETWORKS",
|
|
59
|
+
"name": "@NETWORKS",
|
|
60
|
+
"tag": "#NETWORKS",
|
|
61
|
+
"loc": "$NETWORKS"
|
|
62
|
+
},
|
|
61
63
|
"legal": {
|
|
62
64
|
"label": "🏛️LEGAL",
|
|
63
65
|
"name": "@LEGAL",
|
|
@@ -69,10 +71,23 @@
|
|
|
69
71
|
"name": "@JUSTICE",
|
|
70
72
|
"tag": "#JUSTICE",
|
|
71
73
|
"loc": "$JUSTICE"
|
|
74
|
+
},
|
|
75
|
+
"defense": {
|
|
76
|
+
"label": "🪖DEFENSE",
|
|
77
|
+
"name": "@DEFENSE",
|
|
78
|
+
"tag": "#DEFENSE",
|
|
79
|
+
"loc": "$DEFENSE"
|
|
72
80
|
}
|
|
73
81
|
},
|
|
74
82
|
"vars": {
|
|
75
|
-
"hello": "Hellow World"
|
|
83
|
+
"hello": "Hellow World",
|
|
84
|
+
"context": {
|
|
85
|
+
"ready": "🤝 Everything is ready!",
|
|
86
|
+
"test": "💿 Test Data",
|
|
87
|
+
"prompt": "💻 Prompt",
|
|
88
|
+
"feature": "🍿 Accessing Feature",
|
|
89
|
+
"zone": "🗻 Accessing Zone"
|
|
90
|
+
}
|
|
76
91
|
}
|
|
77
92
|
}
|
|
78
93
|
}
|
package/tests/client.json
CHANGED
|
@@ -42,44 +42,54 @@
|
|
|
42
42
|
"password": "generic password for encryption test"
|
|
43
43
|
},
|
|
44
44
|
"concerns": [],
|
|
45
|
-
"global":
|
|
45
|
+
"global": [],
|
|
46
46
|
"devas": {}
|
|
47
47
|
},
|
|
48
48
|
"support": {
|
|
49
49
|
"concerns": [],
|
|
50
|
-
"global":
|
|
50
|
+
"global": [],
|
|
51
51
|
"devas": {}
|
|
52
52
|
},
|
|
53
53
|
"services": {
|
|
54
54
|
"concerns": [],
|
|
55
|
-
"global":
|
|
56
|
-
"indra": "https://indra.ai",
|
|
57
|
-
"world": "https://deva.world",
|
|
58
|
-
"space": "https://deva.space",
|
|
59
|
-
"cloud": "https://deva.cloud"
|
|
60
|
-
|
|
55
|
+
"global": [
|
|
56
|
+
{"indra": "https://indra.ai"},
|
|
57
|
+
{"world": "https://deva.world"},
|
|
58
|
+
{"space": "https://deva.space"},
|
|
59
|
+
{"cloud": "https://deva.cloud"}
|
|
60
|
+
],
|
|
61
61
|
"devas": {
|
|
62
62
|
"hello": {}
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"systems": {
|
|
66
66
|
"concerns": [],
|
|
67
|
-
"global":
|
|
67
|
+
"global": [],
|
|
68
|
+
"devas": {}
|
|
69
|
+
},
|
|
70
|
+
"networks": {
|
|
71
|
+
"concerns": [],
|
|
72
|
+
"global": [],
|
|
68
73
|
"devas": {}
|
|
69
74
|
},
|
|
70
75
|
"legal": {
|
|
71
76
|
"concerns": [],
|
|
72
|
-
"global":
|
|
77
|
+
"global": [],
|
|
73
78
|
"devas": {}
|
|
74
79
|
},
|
|
75
80
|
"justice": {
|
|
76
81
|
"concerns": [],
|
|
77
|
-
"global":
|
|
82
|
+
"global": [],
|
|
78
83
|
"devas": {}
|
|
79
84
|
},
|
|
80
85
|
"authority": {
|
|
81
86
|
"concerns": [],
|
|
82
|
-
"global":
|
|
87
|
+
"global": [],
|
|
88
|
+
"devas": {}
|
|
89
|
+
},
|
|
90
|
+
"defense": {
|
|
91
|
+
"concerns": [],
|
|
92
|
+
"global": [],
|
|
83
93
|
"devas": {}
|
|
84
94
|
}
|
|
85
95
|
}
|
package/tests/index.js
CHANGED
|
@@ -9,11 +9,7 @@ const agent = Agent.DATA;
|
|
|
9
9
|
|
|
10
10
|
import Deva from '../index.js';
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
client: {
|
|
14
|
-
id: 100,
|
|
15
|
-
key: 'hello',
|
|
16
|
-
},
|
|
12
|
+
const DevaTest = new Deva({
|
|
17
13
|
agent: {
|
|
18
14
|
id: agent.id,
|
|
19
15
|
key: agent.key,
|
|
@@ -26,11 +22,15 @@ const HelloWorld = new Deva({
|
|
|
26
22
|
},
|
|
27
23
|
parse(input) {
|
|
28
24
|
return input.trim();
|
|
25
|
+
},
|
|
26
|
+
process(input) {
|
|
27
|
+
return input.trim();
|
|
29
28
|
}
|
|
30
29
|
},
|
|
31
30
|
vars: agent.vars,
|
|
32
31
|
listeners: {
|
|
33
32
|
'devacore:prompt'(packet) {
|
|
33
|
+
this.context('prompt');
|
|
34
34
|
console.log(`👔 prompt: ${packet.text}`);
|
|
35
35
|
},
|
|
36
36
|
'devacore:question'(packet) {
|
|
@@ -53,8 +53,12 @@ const HelloWorld = new Deva({
|
|
|
53
53
|
},
|
|
54
54
|
'devacore:feature'(packet) {
|
|
55
55
|
console.log(`---`);
|
|
56
|
+
this.context('feature');
|
|
56
57
|
console.log(`🍿 feature: ${packet.text}`);
|
|
57
58
|
},
|
|
59
|
+
'devacore:context'(packet) {
|
|
60
|
+
console.log(`🛹 context: ${packet.text}`);
|
|
61
|
+
},
|
|
58
62
|
'devacore:error'(packet) {
|
|
59
63
|
console.log(`❌ error: ${packet.text}`);
|
|
60
64
|
},
|
|
@@ -64,43 +68,41 @@ const HelloWorld = new Deva({
|
|
|
64
68
|
func: {
|
|
65
69
|
test(packet) {
|
|
66
70
|
const text = this._state
|
|
67
|
-
const id = this.uid();
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
created: this.formatDate(Date.now(), 'long'),
|
|
82
|
-
},
|
|
83
|
-
cipher,
|
|
84
|
-
decipher
|
|
85
|
-
}
|
|
86
|
-
console.log(data)
|
|
87
|
-
return Promise.resolve({
|
|
88
|
-
text: packet.a.text,
|
|
71
|
+
const id = this.lib.uid();
|
|
72
|
+
const uid = this.lib.uid(true);
|
|
73
|
+
const data = [
|
|
74
|
+
`::BEGIN:DATA:${id}`,
|
|
75
|
+
`id: ${id}`,
|
|
76
|
+
`uid: ${uid}`,
|
|
77
|
+
`md5: ${this.lib.hash(packet)}`,
|
|
78
|
+
`sha256: ${this.lib.hash(packet, 'sha256')}`,
|
|
79
|
+
`sha512: ${this.lib.hash(packet, 'sha512')}`,
|
|
80
|
+
`date: ${this.lib.formatDate(Date.now(), 'long', true)}`,
|
|
81
|
+
`::END:DATA:${this.lib.hash(packet)}`,
|
|
82
|
+
];
|
|
83
|
+
return {
|
|
84
|
+
text: data.join('\n'),
|
|
89
85
|
data,
|
|
90
|
-
}
|
|
86
|
+
};
|
|
91
87
|
}
|
|
92
88
|
},
|
|
93
89
|
methods: {
|
|
94
90
|
test(packet) {
|
|
91
|
+
this.context('test');
|
|
95
92
|
return this.func.test(packet);
|
|
96
93
|
}
|
|
97
94
|
},
|
|
95
|
+
onReady(data, resolve) {
|
|
96
|
+
this.context('ready');
|
|
97
|
+
this.prompt(this.methods.test(data).text);
|
|
98
|
+
return resolve(data);
|
|
99
|
+
},
|
|
98
100
|
onError(e) {
|
|
99
101
|
console.log(e);
|
|
100
102
|
}
|
|
101
103
|
});
|
|
102
104
|
|
|
103
|
-
|
|
105
|
+
DevaTest.init(client);
|
|
104
106
|
|
|
105
107
|
|
|
106
108
|
// HelloWorld.question('/hello hello there').then(hello => {
|