@indra.ai/deva 1.5.42 → 1.5.44
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/index.js +301 -126
- package/package.json +9 -4
package/index.js
CHANGED
|
@@ -17,15 +17,19 @@ class Deva {
|
|
|
17
17
|
this._agent = opts.agent || false; // Agent profile object
|
|
18
18
|
this._client = {}; // this will be set on init.
|
|
19
19
|
this._active = false; // the active/birth date.
|
|
20
|
+
this._vector = false; // inherited Vector features.
|
|
20
21
|
this._security = false; // inherited Security features.
|
|
22
|
+
this._guard = false; // inherited Guard features.
|
|
21
23
|
this._defense = false; // inherited Security features.
|
|
24
|
+
this._wall = false; // inherited Wall features.
|
|
25
|
+
this._proxy = false; // inherited Proxy features.
|
|
26
|
+
this._legal = false; // inherited Legal features.
|
|
27
|
+
this._authority = false; // inherited Justice features.
|
|
28
|
+
this._justice = false; // inherited Justice features.
|
|
22
29
|
this._support = false; // inherited Support features.
|
|
23
30
|
this._services = false; // inherited Service features.
|
|
24
31
|
this._systems = false; // inherited Systems features.
|
|
25
32
|
this._networks = false; // inherited Systems features.
|
|
26
|
-
this._legal = false; // inherited Legal features.
|
|
27
|
-
this._justice = false; // inherited Justice features.
|
|
28
|
-
this._authority = false; // inherited Justice features.
|
|
29
33
|
this.events = opts.events || new EventEmitter({}); // Event Bus
|
|
30
34
|
this.lib = new lib({}); // used for loading library functions
|
|
31
35
|
this.utils = opts.utils || {}; // parse function
|
|
@@ -181,7 +185,7 @@ class Deva {
|
|
|
181
185
|
};
|
|
182
186
|
packet.a.hash = this.lib.hash(packet.a);
|
|
183
187
|
delete packet.hash;
|
|
184
|
-
packet.
|
|
188
|
+
packet.md5 = this.lib.hash(packet);
|
|
185
189
|
packet.sha256 = this.lib.hash(packet, 'sha256');
|
|
186
190
|
packet.sha512 = this.lib.hash(packet, 'sha512');
|
|
187
191
|
|
|
@@ -266,6 +270,7 @@ class Deva {
|
|
|
266
270
|
concerns: data.concerns, // any concerns for client
|
|
267
271
|
global: data.global, // the global policies for client
|
|
268
272
|
personal: data.devas[this._agent.key], // Client personal features and rules.
|
|
273
|
+
created: Date.now(),
|
|
269
274
|
};
|
|
270
275
|
delete this._client.features[feature]; // make a copy the clinet data.
|
|
271
276
|
this.state('resolve', `${feature}:${_id}`);
|
|
@@ -277,6 +282,17 @@ class Deva {
|
|
|
277
282
|
}
|
|
278
283
|
}
|
|
279
284
|
|
|
285
|
+
/**************
|
|
286
|
+
func: Vector
|
|
287
|
+
params: client: false
|
|
288
|
+
describe:
|
|
289
|
+
The Vector feature sets the correct variables and necessary rules for the
|
|
290
|
+
client presented data.
|
|
291
|
+
***************/
|
|
292
|
+
Vector(resolve, reject) {
|
|
293
|
+
return this.Feature('vector', resolve, reject);
|
|
294
|
+
}
|
|
295
|
+
|
|
280
296
|
/**************
|
|
281
297
|
func: Security
|
|
282
298
|
params: client: false
|
|
@@ -311,47 +327,36 @@ class Deva {
|
|
|
311
327
|
}
|
|
312
328
|
|
|
313
329
|
/**************
|
|
314
|
-
func:
|
|
330
|
+
func: Wall
|
|
315
331
|
params: client: false
|
|
316
332
|
describe:
|
|
317
|
-
The
|
|
333
|
+
The Defense feature sets the correct variables and necessary rules for the
|
|
318
334
|
client presented data.
|
|
319
335
|
***************/
|
|
320
|
-
|
|
321
|
-
return this.Feature('
|
|
336
|
+
Wall(resolve, reject) {
|
|
337
|
+
return this.Feature('wall', resolve, reject);
|
|
322
338
|
}
|
|
323
339
|
|
|
324
340
|
/**************
|
|
325
|
-
func:
|
|
341
|
+
func: Shield
|
|
326
342
|
params: client: false
|
|
327
343
|
describe:
|
|
328
|
-
The
|
|
344
|
+
The Shield feature sets the correct variables and necessary rules for the
|
|
329
345
|
client presented data.
|
|
330
346
|
***************/
|
|
331
|
-
|
|
332
|
-
return this.Feature('
|
|
347
|
+
Shield(resolve, reject) {
|
|
348
|
+
return this.Feature('shield', resolve, reject);
|
|
333
349
|
}
|
|
334
350
|
|
|
335
351
|
/**************
|
|
336
|
-
func:
|
|
352
|
+
func: Proxy
|
|
337
353
|
params: client: false
|
|
338
354
|
describe:
|
|
339
|
-
The
|
|
340
|
-
client presented data.
|
|
341
|
-
***************/
|
|
342
|
-
Systems(resolve, reject) {
|
|
343
|
-
return this.Feature('systems', resolve, reject);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/**************
|
|
347
|
-
func: Networks
|
|
348
|
-
params: resolve, reject
|
|
349
|
-
describe:
|
|
350
|
-
The Networks feature sets the correct variables and necessary rules for the
|
|
355
|
+
The Defense feature sets the correct variables and necessary rules for the
|
|
351
356
|
client presented data.
|
|
352
357
|
***************/
|
|
353
|
-
|
|
354
|
-
return this.Feature('
|
|
358
|
+
Proxy(resolve, reject) {
|
|
359
|
+
return this.Feature('proxy', resolve, reject);
|
|
355
360
|
}
|
|
356
361
|
|
|
357
362
|
/**************
|
|
@@ -364,7 +369,7 @@ class Deva {
|
|
|
364
369
|
Legal(resolve, reject) {
|
|
365
370
|
return this.Feature('legal', resolve, reject);
|
|
366
371
|
}
|
|
367
|
-
|
|
372
|
+
|
|
368
373
|
/**************
|
|
369
374
|
func: Justice
|
|
370
375
|
params: client: false
|
|
@@ -375,7 +380,7 @@ class Deva {
|
|
|
375
380
|
Justice(resolve, reject) {
|
|
376
381
|
return this.Feature('justice', resolve, reject);
|
|
377
382
|
}
|
|
378
|
-
|
|
383
|
+
|
|
379
384
|
/**************
|
|
380
385
|
func: Authority
|
|
381
386
|
params: client: false
|
|
@@ -387,6 +392,50 @@ class Deva {
|
|
|
387
392
|
return this.Feature('authority', resolve, reject);
|
|
388
393
|
}
|
|
389
394
|
|
|
395
|
+
/**************
|
|
396
|
+
func: Support
|
|
397
|
+
params: client: false
|
|
398
|
+
describe:
|
|
399
|
+
The Support feature sets the correct variables and necessary rules for the
|
|
400
|
+
client presented data.
|
|
401
|
+
***************/
|
|
402
|
+
Support(resolve, reject) {
|
|
403
|
+
return this.Feature('support', resolve, reject);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**************
|
|
407
|
+
func: Services
|
|
408
|
+
params: client: false
|
|
409
|
+
describe:
|
|
410
|
+
The Services feature sets the correct variables and necessary rules for the
|
|
411
|
+
client presented data.
|
|
412
|
+
***************/
|
|
413
|
+
Services(resolve, reject) {
|
|
414
|
+
return this.Feature('services', resolve, reject);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**************
|
|
418
|
+
func: Systems
|
|
419
|
+
params: client: false
|
|
420
|
+
describe:
|
|
421
|
+
The Systems feature sets the correct variables and necessary rules for the
|
|
422
|
+
client presented data.
|
|
423
|
+
***************/
|
|
424
|
+
Systems(resolve, reject) {
|
|
425
|
+
return this.Feature('systems', resolve, reject);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**************
|
|
429
|
+
func: Networks
|
|
430
|
+
params: resolve, reject
|
|
431
|
+
describe:
|
|
432
|
+
The Networks feature sets the correct variables and necessary rules for the
|
|
433
|
+
client presented data.
|
|
434
|
+
***************/
|
|
435
|
+
Networks(resolve, reject) {
|
|
436
|
+
return this.Feature('networks', resolve, reject);
|
|
437
|
+
}
|
|
438
|
+
|
|
390
439
|
/**************
|
|
391
440
|
func: Done
|
|
392
441
|
params: none
|
|
@@ -531,7 +580,9 @@ class Deva {
|
|
|
531
580
|
}
|
|
532
581
|
|
|
533
582
|
// hash the question
|
|
534
|
-
packet.q.
|
|
583
|
+
packet.q.md5 = this.lib.hash(packet.q);
|
|
584
|
+
packet.q.sha256 = this.lib.hash(packet.q, 'sha256');
|
|
585
|
+
packet.q.sha512 = this.lib.hash(packet.q, 'sha512');
|
|
535
586
|
|
|
536
587
|
this.talk(config.events.question, this.lib.copy(packet)); // global question event make sure to copy data.
|
|
537
588
|
|
|
@@ -605,7 +656,10 @@ class Deva {
|
|
|
605
656
|
created: Date.now(), // set the created date for the answer
|
|
606
657
|
};
|
|
607
658
|
// create a hash for the answer and insert into answer meta.
|
|
608
|
-
packet_answer.
|
|
659
|
+
packet_answer.md5 = this.lib.hash(packet_answer);
|
|
660
|
+
packet_answer.sha256 = this.lib.hash(packet_answer, 'sha256');
|
|
661
|
+
packet_answer.sha512 = this.lib.hash(packet_answer, 'sha512');
|
|
662
|
+
|
|
609
663
|
packet.a = packet_answer; // set the packet.a to the packet_answer
|
|
610
664
|
this.talk(config.events.answer, this.lib.copy(packet)); // global talk event
|
|
611
665
|
|
|
@@ -679,7 +733,10 @@ class Deva {
|
|
|
679
733
|
packet_answer.text = result;
|
|
680
734
|
}
|
|
681
735
|
|
|
682
|
-
packet_answer.
|
|
736
|
+
packet_answer.md5 = this.lib.hash(packet_answer);
|
|
737
|
+
packet_answer.sha256 = this.lib.hash(packet_answer, 'sha256');
|
|
738
|
+
packet_answer.sha512 = this.lib.hash(packet_answer, 'sha512');
|
|
739
|
+
|
|
683
740
|
packet.a = packet_answer;
|
|
684
741
|
this.talk(config.events.answer, this.lib.copy(packet)); // global talk event
|
|
685
742
|
this.talk(`${agent.key}:ask:${packet.id}`, packet);
|
|
@@ -727,7 +784,7 @@ class Deva {
|
|
|
727
784
|
text: this._messages.init,
|
|
728
785
|
created: Date.now(),
|
|
729
786
|
}
|
|
730
|
-
data.
|
|
787
|
+
data.md5 = this.lib.hash(data);
|
|
731
788
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
732
789
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
733
790
|
|
|
@@ -743,12 +800,18 @@ class Deva {
|
|
|
743
800
|
this.action('init');
|
|
744
801
|
this.state('init');
|
|
745
802
|
return this.Client(client, resolve, reject);
|
|
803
|
+
}).then(() => {
|
|
804
|
+
return this.Vector(resolve, reject);
|
|
746
805
|
}).then(() => {
|
|
747
806
|
return this.Security(resolve, reject);
|
|
748
807
|
}).then(() => {
|
|
749
808
|
return this.Guard(resolve, reject);
|
|
750
809
|
}).then(() => {
|
|
751
810
|
return this.Defense(resolve, reject);
|
|
811
|
+
}).then(() => {
|
|
812
|
+
return this.Wall(resolve, reject);
|
|
813
|
+
}).then(() => {
|
|
814
|
+
return this.Proxy(resolve, reject);
|
|
752
815
|
}).then(() => {
|
|
753
816
|
return this.Legal(resolve, reject);
|
|
754
817
|
}).then(() => {
|
|
@@ -792,12 +855,17 @@ class Deva {
|
|
|
792
855
|
|
|
793
856
|
this.action('start', data.id);
|
|
794
857
|
const id = this.lib.uid();
|
|
795
|
-
|
|
858
|
+
|
|
859
|
+
delete data.md5;
|
|
860
|
+
delete data.sha256;
|
|
861
|
+
delete data.sha512;
|
|
862
|
+
|
|
796
863
|
data.value = 'start';
|
|
797
|
-
|
|
864
|
+
|
|
865
|
+
data.md5 = this.lib.hash(data);
|
|
798
866
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
799
867
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
800
|
-
|
|
868
|
+
|
|
801
869
|
const hasOnStart = this.onStart && typeof this.onStart === 'function' ? true : false;
|
|
802
870
|
|
|
803
871
|
this.state('start', data.id);
|
|
@@ -821,12 +889,17 @@ class Deva {
|
|
|
821
889
|
|
|
822
890
|
this.action('enter', data.id);
|
|
823
891
|
const hasOnEnter = this.onEnter && typeof this.onEnter === 'function' ? true : false;
|
|
824
|
-
|
|
892
|
+
|
|
893
|
+
delete data.md5;
|
|
894
|
+
delete data.sha256;
|
|
895
|
+
delete data.sha512;
|
|
896
|
+
|
|
825
897
|
data.value = 'enter';
|
|
826
|
-
|
|
898
|
+
|
|
899
|
+
data.md5 = this.lib.hash(data);
|
|
827
900
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
828
901
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
829
|
-
|
|
902
|
+
|
|
830
903
|
this.state('enter', data.id);
|
|
831
904
|
return hasOnEnter ? this.onEnter(data, resolve) : this.done(data, resolve)
|
|
832
905
|
}
|
|
@@ -848,12 +921,17 @@ class Deva {
|
|
|
848
921
|
|
|
849
922
|
this.action('done', data.id);
|
|
850
923
|
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
851
|
-
|
|
924
|
+
|
|
925
|
+
delete data.md5;
|
|
926
|
+
delete data.sha256;
|
|
927
|
+
delete data.sha512;
|
|
928
|
+
|
|
852
929
|
data.value = 'done';
|
|
853
|
-
|
|
930
|
+
|
|
931
|
+
data.md5 = this.lib.hash(data);
|
|
854
932
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
855
933
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
856
|
-
|
|
934
|
+
|
|
857
935
|
this.state('done', data.id);
|
|
858
936
|
return hasOnDone ? this.onDone(data, resolve) : this.ready(data, resolve);
|
|
859
937
|
}
|
|
@@ -872,12 +950,17 @@ class Deva {
|
|
|
872
950
|
|
|
873
951
|
this.action('ready', data.id);
|
|
874
952
|
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
875
|
-
|
|
953
|
+
|
|
954
|
+
delete data.md5;
|
|
955
|
+
delete data.sha256;
|
|
956
|
+
delete data.sha512;
|
|
957
|
+
|
|
876
958
|
data.value = 'ready';
|
|
877
|
-
|
|
959
|
+
|
|
960
|
+
data.md5 = this.lib.hash(data);
|
|
878
961
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
879
962
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
880
|
-
|
|
963
|
+
|
|
881
964
|
this.state('ready', data.id);
|
|
882
965
|
return hasOnReady ? this.onReady(data, resolve) : resolve(data);
|
|
883
966
|
}
|
|
@@ -892,20 +975,25 @@ class Deva {
|
|
|
892
975
|
describe: This function is used to relay into the finish state when resolving a question or data.
|
|
893
976
|
usage: this.finish(data, resolve)
|
|
894
977
|
***************/
|
|
895
|
-
finish(
|
|
896
|
-
this.zone('finish',
|
|
978
|
+
finish(data, resolve) {
|
|
979
|
+
this.zone('finish', data.id); // enter finish zone
|
|
897
980
|
if (!this._active) return resolve(this._messages.offline); //
|
|
898
981
|
|
|
899
|
-
this.action('finish',
|
|
982
|
+
this.action('finish', data.id); // start finish action
|
|
900
983
|
const hasOnFinish = this.onFinish && typeof this.onFinish === 'function';
|
|
901
|
-
delete packet.hash; // delete packet hash to update for finish time
|
|
902
|
-
packet.finish = Date.now(); // set the finish timestamp
|
|
903
|
-
packet.hash = this.lib.hash(packet); // rehash the packet;
|
|
904
|
-
packet.sha256 = this.lib.hash(packet, 'sha256');
|
|
905
|
-
packet.sha512 = this.lib.hash(packet, 'sha512');
|
|
906
984
|
|
|
907
|
-
|
|
908
|
-
|
|
985
|
+
delete data.md5;
|
|
986
|
+
delete data.sha256;
|
|
987
|
+
delete data.sha512;
|
|
988
|
+
|
|
989
|
+
data.finish = Date.now(); // set the finish timestamp
|
|
990
|
+
|
|
991
|
+
data.md5 = this.lib.hash(data);
|
|
992
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
993
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
994
|
+
|
|
995
|
+
this.state('finish', data.id); // set finish state
|
|
996
|
+
return hasOnFinish ? this.onFinish(data, resolve) : this.complete(data, resolve);
|
|
909
997
|
}
|
|
910
998
|
|
|
911
999
|
/**************
|
|
@@ -917,20 +1005,24 @@ class Deva {
|
|
|
917
1005
|
resolving a question or data.
|
|
918
1006
|
usage: this.complete(data, resolve)
|
|
919
1007
|
***************/
|
|
920
|
-
complete(
|
|
921
|
-
this.zone('complete',
|
|
1008
|
+
complete(data, resolve) {
|
|
1009
|
+
this.zone('complete', data.id);
|
|
922
1010
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
923
1011
|
|
|
924
|
-
this.action('complete',
|
|
1012
|
+
this.action('complete', data.id);
|
|
925
1013
|
const hasOnComplete = this.onComplete && typeof this.onComplete === 'function';
|
|
926
|
-
delete packet.hash;
|
|
927
|
-
packet.complete = Date.now();// set the complete date on the whole packet.
|
|
928
|
-
packet.hash = this.lib.hash(packet);// hash the entire packet before complete.
|
|
929
|
-
packet.sha256 = this.lib.hash(packet, 'sha256');
|
|
930
|
-
packet.sha512 = this.lib.hash(packet, 'sha512');
|
|
931
1014
|
|
|
932
|
-
|
|
933
|
-
|
|
1015
|
+
delete data.md5;
|
|
1016
|
+
delete data.sha256;
|
|
1017
|
+
delete data.sha512;
|
|
1018
|
+
|
|
1019
|
+
data.complete = Date.now();// set the complete date on the whole data.
|
|
1020
|
+
data.md5 = this.lib.hash(data);
|
|
1021
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1022
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1023
|
+
|
|
1024
|
+
this.state('complete', data.id);
|
|
1025
|
+
return hasOnComplete ? this.onComplete(data, resolve) : resolve(data);
|
|
934
1026
|
}
|
|
935
1027
|
|
|
936
1028
|
/**************
|
|
@@ -962,7 +1054,8 @@ class Deva {
|
|
|
962
1054
|
client: this.client(), // set the client
|
|
963
1055
|
created: Date.now(), // set the created date
|
|
964
1056
|
}
|
|
965
|
-
|
|
1057
|
+
|
|
1058
|
+
data.md5 = this.lib.hash(data);
|
|
966
1059
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
967
1060
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
968
1061
|
|
|
@@ -998,20 +1091,29 @@ class Deva {
|
|
|
998
1091
|
client: this.client(),
|
|
999
1092
|
created: Date.now(),
|
|
1000
1093
|
}
|
|
1001
|
-
|
|
1094
|
+
|
|
1095
|
+
data.md5 = this.lib.hash(data);
|
|
1096
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1097
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1002
1098
|
|
|
1003
1099
|
this.state('exit', id); // set the state to stop
|
|
1004
1100
|
// clear memory
|
|
1005
1101
|
this._active = false;
|
|
1006
1102
|
this._client = false;
|
|
1103
|
+
this._vector = false;
|
|
1007
1104
|
this._security = false;
|
|
1105
|
+
this._guard = false;
|
|
1106
|
+
this._defense = false;
|
|
1107
|
+
this._wall = false;
|
|
1108
|
+
this._shield = false;
|
|
1109
|
+
this._proxy = false;
|
|
1110
|
+
this._legal = false;
|
|
1111
|
+
this._authority = false;
|
|
1112
|
+
this._justice = false;
|
|
1008
1113
|
this._support = false;
|
|
1009
1114
|
this._services = false;
|
|
1010
1115
|
this._systems = false;
|
|
1011
1116
|
this._networks = false;
|
|
1012
|
-
this._legal = false;
|
|
1013
|
-
this._authority = false;
|
|
1014
|
-
this._justice = false;
|
|
1015
1117
|
return hasOnExit ? this.onExit(data) : Promise.resolve(data)
|
|
1016
1118
|
}
|
|
1017
1119
|
|
|
@@ -1039,9 +1141,11 @@ class Deva {
|
|
|
1039
1141
|
text, // set the text value of the data
|
|
1040
1142
|
created: Date.now(), // set the data created date.
|
|
1041
1143
|
};
|
|
1042
|
-
|
|
1144
|
+
|
|
1145
|
+
data.md5 = this.lib.hash(data);
|
|
1043
1146
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1044
1147
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1148
|
+
|
|
1045
1149
|
this.talk(config.events.state, data); // broadcasat the state event
|
|
1046
1150
|
return data;
|
|
1047
1151
|
} catch (e) { // catch any errors
|
|
@@ -1063,9 +1167,11 @@ class Deva {
|
|
|
1063
1167
|
value: this._states,
|
|
1064
1168
|
created: Date.now(),
|
|
1065
1169
|
}
|
|
1066
|
-
|
|
1170
|
+
|
|
1171
|
+
data.md5 = this.lib.hash(data);
|
|
1067
1172
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1068
1173
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1174
|
+
|
|
1069
1175
|
this.state('return', `states:${id}`);
|
|
1070
1176
|
return data;
|
|
1071
1177
|
}
|
|
@@ -1094,9 +1200,11 @@ class Deva {
|
|
|
1094
1200
|
text,
|
|
1095
1201
|
created: Date.now(),
|
|
1096
1202
|
};
|
|
1097
|
-
|
|
1203
|
+
|
|
1204
|
+
data.md5 = this.lib.hash(data);
|
|
1098
1205
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1099
1206
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1207
|
+
|
|
1100
1208
|
this.talk(config.events.zone, data);
|
|
1101
1209
|
return data;
|
|
1102
1210
|
} catch (e) {
|
|
@@ -1114,7 +1222,8 @@ class Deva {
|
|
|
1114
1222
|
const id = this.lib.uid();
|
|
1115
1223
|
this.action('zones', id);
|
|
1116
1224
|
this.state('return', `zones:${id}`);
|
|
1117
|
-
|
|
1225
|
+
|
|
1226
|
+
const data = {
|
|
1118
1227
|
id, // set the uuid of the data
|
|
1119
1228
|
agent: this.agent(), // set the agent value
|
|
1120
1229
|
cleint: this.client(), // set the client value
|
|
@@ -1122,6 +1231,12 @@ class Deva {
|
|
|
1122
1231
|
value: this._zones, // set the list of zones
|
|
1123
1232
|
created: Date.now(), // set the created date of the object.
|
|
1124
1233
|
}
|
|
1234
|
+
|
|
1235
|
+
data.md5 = this.lib.hash(data);
|
|
1236
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1237
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1238
|
+
|
|
1239
|
+
return data
|
|
1125
1240
|
}
|
|
1126
1241
|
|
|
1127
1242
|
/**************
|
|
@@ -1142,6 +1257,7 @@ class Deva {
|
|
|
1142
1257
|
const msg_action = var_action || this._actions[value];
|
|
1143
1258
|
const msg = msg_action || action; // set the correct message
|
|
1144
1259
|
const text = extra ? `${msg} ${extra}` : msg; // set the text of the action
|
|
1260
|
+
|
|
1145
1261
|
const data = { // build the data object for the action.
|
|
1146
1262
|
id, // generate a guid for the action transmitssion.
|
|
1147
1263
|
agent: this.agent(), // the agent data to send with the action
|
|
@@ -1151,9 +1267,11 @@ class Deva {
|
|
|
1151
1267
|
text, // text of the action to send
|
|
1152
1268
|
created: Date.now(), // action time stamp
|
|
1153
1269
|
};
|
|
1154
|
-
|
|
1270
|
+
|
|
1271
|
+
data.md5 = this.lib.hash(data);
|
|
1155
1272
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1156
1273
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1274
|
+
|
|
1157
1275
|
this.talk(config.events.action, data); // talk the core action event
|
|
1158
1276
|
return data;
|
|
1159
1277
|
} catch (e) { // catch any errors that occur
|
|
@@ -1178,9 +1296,11 @@ class Deva {
|
|
|
1178
1296
|
value: this._actions, // set the value to the actions list
|
|
1179
1297
|
created: Date.now(), // set the data created date
|
|
1180
1298
|
};
|
|
1181
|
-
|
|
1299
|
+
|
|
1300
|
+
data.md5 = this.lib.hash(data);
|
|
1182
1301
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1183
1302
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1303
|
+
|
|
1184
1304
|
this.state('return', `actions:${id}`);
|
|
1185
1305
|
return data;
|
|
1186
1306
|
}
|
|
@@ -1208,9 +1328,11 @@ class Deva {
|
|
|
1208
1328
|
text, // set the text value
|
|
1209
1329
|
created: Date.now(), // set the creation date
|
|
1210
1330
|
};
|
|
1211
|
-
|
|
1331
|
+
|
|
1332
|
+
data.md5 = this.lib.hash(data);
|
|
1212
1333
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1213
1334
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1335
|
+
|
|
1214
1336
|
this.talk(config.events.feature, data); // talk the feature event with data
|
|
1215
1337
|
return data;
|
|
1216
1338
|
} catch (e) { // catch any errors
|
|
@@ -1236,9 +1358,11 @@ class Deva {
|
|
|
1236
1358
|
value: this._features, // set the value to the features list
|
|
1237
1359
|
created: Date.now(), // set the created date.
|
|
1238
1360
|
};
|
|
1239
|
-
|
|
1361
|
+
|
|
1362
|
+
data.md5 = this.lib.hash(data);
|
|
1240
1363
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1241
1364
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1365
|
+
|
|
1242
1366
|
this.state('return', `features:${id}`);
|
|
1243
1367
|
return data;
|
|
1244
1368
|
}
|
|
@@ -1268,9 +1392,11 @@ class Deva {
|
|
|
1268
1392
|
text,
|
|
1269
1393
|
created: Date.now(),
|
|
1270
1394
|
};
|
|
1271
|
-
|
|
1395
|
+
|
|
1396
|
+
data.md5 = this.lib.hash(data);
|
|
1272
1397
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1273
1398
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1399
|
+
|
|
1274
1400
|
this.talk(config.events.context, data);
|
|
1275
1401
|
return data;
|
|
1276
1402
|
} catch (e) {
|
|
@@ -1292,9 +1418,11 @@ class Deva {
|
|
|
1292
1418
|
value: this.vars.context || false,
|
|
1293
1419
|
created: Date.now(),
|
|
1294
1420
|
};
|
|
1295
|
-
|
|
1421
|
+
|
|
1422
|
+
data.md5 = this.lib.hash(data);
|
|
1296
1423
|
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1297
1424
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1425
|
+
|
|
1298
1426
|
this.state('return', `contexts:${id}`);
|
|
1299
1427
|
return data;
|
|
1300
1428
|
}
|
|
@@ -1307,13 +1435,14 @@ class Deva {
|
|
|
1307
1435
|
***************/
|
|
1308
1436
|
client() {
|
|
1309
1437
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1312
|
-
client_copy.hash = this.lib.hash(client_copy);
|
|
1313
|
-
client_copy.sha256 = this.lib.hash(client_copy, 'sha256');
|
|
1314
|
-
client_copy.sha512 = this.lib.hash(client_copy, 'sha512');
|
|
1438
|
+
const data = this.lib.copy(this._client); // create a copy of the client data
|
|
1439
|
+
data.created = Date.now();
|
|
1315
1440
|
|
|
1316
|
-
|
|
1441
|
+
data.md5 = this.lib.hash(data);
|
|
1442
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1443
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1444
|
+
|
|
1445
|
+
return data; // return the copy of the client data.
|
|
1317
1446
|
}
|
|
1318
1447
|
|
|
1319
1448
|
/**************
|
|
@@ -1324,15 +1453,26 @@ class Deva {
|
|
|
1324
1453
|
***************/
|
|
1325
1454
|
agent() {
|
|
1326
1455
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1327
|
-
const
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1456
|
+
const data = this.lib.copy(this._agent); // create a copy of the agent data.
|
|
1457
|
+
data.created = Date.now();
|
|
1458
|
+
|
|
1459
|
+
data.md5 = this.lib.hash(data);
|
|
1460
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1461
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1462
|
+
return data; // return the copy of the agent data.
|
|
1333
1463
|
}
|
|
1334
1464
|
|
|
1335
1465
|
// FEATURE FUNCTIONS
|
|
1466
|
+
/**************
|
|
1467
|
+
func: vector
|
|
1468
|
+
params: none
|
|
1469
|
+
describe: basic vector features available in a Deva.
|
|
1470
|
+
usage: this.vector()
|
|
1471
|
+
***************/
|
|
1472
|
+
vector() {
|
|
1473
|
+
return this._getFeature('vector', this._vector);
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1336
1476
|
/**************
|
|
1337
1477
|
func: security
|
|
1338
1478
|
params: none
|
|
@@ -1363,6 +1503,56 @@ class Deva {
|
|
|
1363
1503
|
return this._getFeature('defense', this._defense);
|
|
1364
1504
|
}
|
|
1365
1505
|
|
|
1506
|
+
/**************
|
|
1507
|
+
func: wall
|
|
1508
|
+
params: none
|
|
1509
|
+
describe: basic wall features available in a Deva.
|
|
1510
|
+
usage: this.wall()
|
|
1511
|
+
***************/
|
|
1512
|
+
wall() {
|
|
1513
|
+
return this._getFeature('wall', this._wall);
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
/**************
|
|
1517
|
+
func: proxy
|
|
1518
|
+
params: none
|
|
1519
|
+
describe: basic proxy features available in a Deva.
|
|
1520
|
+
usage: this.proxy()
|
|
1521
|
+
***************/
|
|
1522
|
+
proxy() {
|
|
1523
|
+
return this._getFeature('proxy', this._proxy);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/**************
|
|
1527
|
+
func: legal
|
|
1528
|
+
params: none
|
|
1529
|
+
describe: basic legal features available in a Deva.
|
|
1530
|
+
usage: this.systems()
|
|
1531
|
+
***************/
|
|
1532
|
+
legal() {
|
|
1533
|
+
return this._getFeature('legal', this._legal);
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
/**************
|
|
1537
|
+
func: authority
|
|
1538
|
+
params: none
|
|
1539
|
+
describe: basic authority features available in a Deva.
|
|
1540
|
+
usage: this.systems()
|
|
1541
|
+
***************/
|
|
1542
|
+
authority() {
|
|
1543
|
+
return this._getFeature('authority', this._authority);
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
/**************
|
|
1547
|
+
func: justice
|
|
1548
|
+
params: none
|
|
1549
|
+
describe: basic justice features available in a Deva.
|
|
1550
|
+
usage: this.systems()
|
|
1551
|
+
***************/
|
|
1552
|
+
justice() {
|
|
1553
|
+
return this._getFeature('justice', this._justice);
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1366
1556
|
/**************
|
|
1367
1557
|
func: support
|
|
1368
1558
|
params: none
|
|
@@ -1403,36 +1593,6 @@ class Deva {
|
|
|
1403
1593
|
return this._getFeature('networks', this._networks);
|
|
1404
1594
|
}
|
|
1405
1595
|
|
|
1406
|
-
/**************
|
|
1407
|
-
func: legal
|
|
1408
|
-
params: none
|
|
1409
|
-
describe: basic legal features available in a Deva.
|
|
1410
|
-
usage: this.systems()
|
|
1411
|
-
***************/
|
|
1412
|
-
legal() {
|
|
1413
|
-
return this._getFeature('legal', this._legal);
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
/**************
|
|
1417
|
-
func: justice
|
|
1418
|
-
params: none
|
|
1419
|
-
describe: basic justice features available in a Deva.
|
|
1420
|
-
usage: this.systems()
|
|
1421
|
-
***************/
|
|
1422
|
-
justice() {
|
|
1423
|
-
return this._getFeature('justice', this._justice);
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
/**************
|
|
1427
|
-
func: authority
|
|
1428
|
-
params: none
|
|
1429
|
-
describe: basic authority features available in a Deva.
|
|
1430
|
-
usage: this.systems()
|
|
1431
|
-
***************/
|
|
1432
|
-
authority() {
|
|
1433
|
-
return this._getFeature('authority', this._authority);
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
1596
|
/**************
|
|
1437
1597
|
func: load
|
|
1438
1598
|
params:
|
|
@@ -1493,7 +1653,11 @@ class Deva {
|
|
|
1493
1653
|
text,
|
|
1494
1654
|
created: Date.now(),
|
|
1495
1655
|
}
|
|
1496
|
-
|
|
1656
|
+
|
|
1657
|
+
data.md5 = this.lib.hash(data);
|
|
1658
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1659
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1660
|
+
|
|
1497
1661
|
this.talk(config.events.prompt, data);
|
|
1498
1662
|
return data;
|
|
1499
1663
|
}
|
|
@@ -1512,7 +1676,11 @@ class Deva {
|
|
|
1512
1676
|
const data = this.lib.copy(this._core);
|
|
1513
1677
|
data.id = id;
|
|
1514
1678
|
data.created = Date.now();
|
|
1515
|
-
|
|
1679
|
+
|
|
1680
|
+
data.md5 = this.lib.hash(data);
|
|
1681
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1682
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1683
|
+
|
|
1516
1684
|
this.state('return', `core:${id}`);
|
|
1517
1685
|
return data;
|
|
1518
1686
|
}
|
|
@@ -1530,7 +1698,11 @@ class Deva {
|
|
|
1530
1698
|
const data = this.lib.copy(this._info);
|
|
1531
1699
|
data.id = id;
|
|
1532
1700
|
data.created = Date.now();
|
|
1533
|
-
|
|
1701
|
+
|
|
1702
|
+
data.md5 = this.lib.hash(data);
|
|
1703
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1704
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1705
|
+
|
|
1534
1706
|
this.state('return', `info:${id}`);
|
|
1535
1707
|
return data;
|
|
1536
1708
|
}
|
|
@@ -1653,7 +1825,10 @@ class Deva {
|
|
|
1653
1825
|
packet,
|
|
1654
1826
|
created: Date.now(),
|
|
1655
1827
|
}
|
|
1656
|
-
data.
|
|
1828
|
+
data.md5 = this.lib.hash(data);
|
|
1829
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1830
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1831
|
+
|
|
1657
1832
|
this.talk(config.events.error, this.lib.copy(data));
|
|
1658
1833
|
|
|
1659
1834
|
this.state('return', `error:${id}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indra.ai/deva",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.44",
|
|
4
4
|
"description": "The Deva Core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"copyright": "(c)2025 Quinn Michaels; All rights reserved.",
|
|
@@ -236,14 +236,19 @@
|
|
|
236
236
|
},
|
|
237
237
|
"feature": false,
|
|
238
238
|
"features": {
|
|
239
|
-
"
|
|
239
|
+
"agent": "🦾 Agent",
|
|
240
|
+
"client": "💪 Client",
|
|
240
241
|
"init": "🟠 Init",
|
|
242
|
+
"vector": "🛤️ Vector",
|
|
241
243
|
"security": "🔐 Security",
|
|
242
|
-
"defense": "🪖️️ Defense",
|
|
243
244
|
"guard": "💂 Guard",
|
|
245
|
+
"defense": "🪖️️ Defense",
|
|
246
|
+
"wall": "🧱 Wall",
|
|
247
|
+
"shield": "🛡️ Shield",
|
|
248
|
+
"proxy": "🤝 Proxy",
|
|
244
249
|
"legal": "🗂️️️ Legal",
|
|
245
|
-
"justice": "🏛️️ Justice",
|
|
246
250
|
"authority": "🚓️️ Authority",
|
|
251
|
+
"justice": "🏛️️ Justice",
|
|
247
252
|
"support": "💼 Support",
|
|
248
253
|
"services": "🛠️ Services",
|
|
249
254
|
"systems": "🖥️️ Systems",
|