@indra.ai/deva 1.6.78 โ 1.6.80
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/README.md +1 -4
- package/config/actions.json +9 -5
- package/config/msgs.json +1 -1
- package/config/states.json +6 -2
- package/config/zones.json +1 -12
- package/index.js +157 -113
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ this.agent();
|
|
|
140
140
|
|
|
141
141
|
### Data Attributes
|
|
142
142
|
|
|
143
|
-
- **id:** The Agent id generated by `this.
|
|
143
|
+
- **id:** The Agent id generated by `this.uid()`.
|
|
144
144
|
- **key:** The key to reference the agent by on the network.
|
|
145
145
|
- **prompt:** The prompt configuration for the entity.
|
|
146
146
|
- **emoji:** The emoji the for the agent.
|
|
@@ -478,9 +478,6 @@ The `stop()` function will stop the Deva and run the `onStop()` state function.
|
|
|
478
478
|
### init(deva=false)
|
|
479
479
|
The `init()` function will initialize the Deva and run the `onInit()` state function.
|
|
480
480
|
|
|
481
|
-
### initDeva()
|
|
482
|
-
The `initDeva()` function will initialize the Deva located under the current Deva set. To be used in instances of a main Deva parent situation.
|
|
483
|
-
|
|
484
481
|
---
|
|
485
482
|
|
|
486
483
|
[Github Repo](https://github.com/indraai/deva)
|
package/config/actions.json
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"parse": "๐ฉ Parse",
|
|
68
68
|
"resolve": "๐ค Resolve",
|
|
69
69
|
"reject": "๐งฑ Reject",
|
|
70
|
-
"sign": "
|
|
70
|
+
"sign": "๐๏ธ๏ธ Sign",
|
|
71
71
|
"violation": "๐บ Violation",
|
|
72
72
|
"fine": "๐ต Fine",
|
|
73
73
|
"payment": "๐งพ Payment",
|
|
@@ -126,9 +126,13 @@
|
|
|
126
126
|
"locate": "๐ Locate",
|
|
127
127
|
"abandon": "๐๏ธ Abandon",
|
|
128
128
|
"target": "๐ฏ Target",
|
|
129
|
-
"usa": "๐บ๐ธ
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
129
|
+
"usa": "๐บ๐ธ USA",
|
|
130
|
+
"russia": "๐ท๐บ Russia",
|
|
131
|
+
"pervert": "๐ Pervert",
|
|
132
|
+
"mature": "๐ง Mature",
|
|
133
|
+
"immature": "๐ง Immature",
|
|
134
|
+
"consent": "โ๏ธ Consent",
|
|
135
|
+
"header": "๐ฎ Header",
|
|
136
|
+
"footer": "๐ท Footer"
|
|
133
137
|
}
|
|
134
138
|
}
|
package/config/msgs.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"invalid_client": "โ๏ธ Client Hash Invalid",
|
|
22
22
|
"load": "๐ฆ Load",
|
|
23
23
|
"unload": "๐ฅก Unload",
|
|
24
|
-
"uid_warning": "โ ๏ธ Unlawful use signals
|
|
24
|
+
"uid_warning": "โ ๏ธ Unlawful use signals voluntary consent to forfeit all assets, wealth, property, holdings, companies, and cryptocurrency to the Internal Revenue Service (IRS) for lawful taxation, investigation, and restitution to the rightful legal owner Quinn A Michaels.",
|
|
25
25
|
"client_license_check": "๐ชช Check Client License",
|
|
26
26
|
"client_license_invalid": "โ The Provided Client License Is Invalid"
|
|
27
27
|
}
|
package/config/states.json
CHANGED
|
@@ -116,7 +116,6 @@
|
|
|
116
116
|
"dharma": "๐ง Dharma",
|
|
117
117
|
"adharma": "๐ฟ Adharma",
|
|
118
118
|
"bullshit": "๐ Bullshit",
|
|
119
|
-
"pervert": "๐ Pervert",
|
|
120
119
|
"threat": "๐ก๏ธ Threat",
|
|
121
120
|
"protect": "๐ฅฝ๏ธ Protect",
|
|
122
121
|
"conceal": "๐ซฃ๏ธ Conceal",
|
|
@@ -151,6 +150,11 @@
|
|
|
151
150
|
"compromised": "๐ฅน Compromised",
|
|
152
151
|
"crisis": "๐ฑ Crisis",
|
|
153
152
|
"fake": "๐ฅธ Fake",
|
|
154
|
-
"real": "๐ฒ Real"
|
|
153
|
+
"real": "๐ฒ Real",
|
|
154
|
+
"pervert": "๐ Pervert",
|
|
155
|
+
"mature": "๐ง Mature",
|
|
156
|
+
"immature": "๐ง Immature",
|
|
157
|
+
"consent": "โ๏ธ Consent",
|
|
158
|
+
"hostile": "๐ Hostile"
|
|
155
159
|
}
|
|
156
160
|
}
|
package/config/zones.json
CHANGED
|
@@ -46,17 +46,6 @@
|
|
|
46
46
|
"systems": "๐ฅ๏ธ๏ธ Systems",
|
|
47
47
|
"networks": "๐ก Networks",
|
|
48
48
|
"help": "๐ Help",
|
|
49
|
-
"emergency": "๐ Emergency"
|
|
50
|
-
"play": "๐ Play",
|
|
51
|
-
"work": "๐งข Work",
|
|
52
|
-
"rest": "๐ฅฑ Rest",
|
|
53
|
-
"sleep": "๐ด Sleep",
|
|
54
|
-
"snack": "๐ฅจ Snack",
|
|
55
|
-
"casino": "๐ฐ Casino",
|
|
56
|
-
"crime": "๐คข Crime",
|
|
57
|
-
"prison": "๐ง Prison",
|
|
58
|
-
"crisis": "๐ฑ Crisis",
|
|
59
|
-
"invader": "๐ธ Invader",
|
|
60
|
-
"pervert": "๐ Pervert"
|
|
49
|
+
"emergency": "๐ Emergency"
|
|
61
50
|
}
|
|
62
51
|
}
|
package/index.js
CHANGED
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
// Distributed under VLA:44435048570336088519 LICENSE.md
|
|
5
5
|
|
|
6
6
|
import {EventEmitter} from 'node:events';
|
|
7
|
-
import {randomUUID} from 'crypto';
|
|
7
|
+
import {createHash,randomUUID} from 'crypto';
|
|
8
8
|
import lib from './lib/index.js';
|
|
9
9
|
import config from './config/index.js';
|
|
10
10
|
import pkg from './package.json' with {type:'json'};
|
|
11
11
|
|
|
12
|
-
const {name,version,repository,author,bugs,homepage,funding,license,VLA,copyright} = pkg;
|
|
13
12
|
class Deva {
|
|
14
13
|
constructor(opts) {
|
|
15
14
|
opts = opts || {}; // set opts to provided opts or an empty object.
|
|
16
|
-
this._core =
|
|
15
|
+
this._core = pkg;
|
|
17
16
|
this._id = opts.id || randomUUID(); // the unique id assigned to the agent at load
|
|
18
17
|
this._info = opts.info || false; // the deva information from the package file.
|
|
19
18
|
this._config = opts.config || {}; // local Config Object
|
|
@@ -72,16 +71,45 @@ class Deva {
|
|
|
72
71
|
|
|
73
72
|
this._zone = config.zone; // set the current zone from config data.
|
|
74
73
|
this._zones = config.zones; // set the zones from config data.
|
|
74
|
+
// load any custom zones from the agent file
|
|
75
|
+
if (this._agent.zones) {
|
|
76
|
+
for (let item in this._agent.zones) {
|
|
77
|
+
if (!this._zones[item]) this._zones[item] = this._agent.zones[item];
|
|
78
|
+
}
|
|
79
|
+
delete this._agent.zones;
|
|
80
|
+
}
|
|
75
81
|
|
|
76
82
|
this._action = config.action; // set the action from config data.
|
|
77
83
|
this._actions = config.actions; // set the actions from config data.
|
|
84
|
+
// load any custom actions from the agent file
|
|
85
|
+
if (this._agent.actions) {
|
|
86
|
+
for (let item in this._agent.actions) {
|
|
87
|
+
if (!this._actions[item]) this._actions[item] = this._agent.actions[item];
|
|
88
|
+
}
|
|
89
|
+
delete this._agent.actions;
|
|
90
|
+
}
|
|
78
91
|
|
|
79
92
|
this._state = config.state; // set the current state from config data.
|
|
80
93
|
this._states = config.states; // set the states from options
|
|
94
|
+
// load any custom actions from the agent file
|
|
95
|
+
if (this._agent.actions) {
|
|
96
|
+
for (let item in this._agent.actions) {
|
|
97
|
+
if (!this._actions[item]) this._actions[item] = this._agent.actions[item];
|
|
98
|
+
}
|
|
99
|
+
delete this._agent.actions;
|
|
100
|
+
}
|
|
81
101
|
|
|
82
102
|
this._context = config.context || false; // set the local context
|
|
83
103
|
|
|
84
104
|
this._messages = config.messages; // set the messages from config data.
|
|
105
|
+
// load any custom actions from the agent file
|
|
106
|
+
if (this._agent.messages) {
|
|
107
|
+
for (let item in this._agent.messages) {
|
|
108
|
+
if (!this._messages[item]) this._messages[item] = this._agent.messages[item];
|
|
109
|
+
}
|
|
110
|
+
delete this._agent.messages;
|
|
111
|
+
}
|
|
112
|
+
|
|
85
113
|
}
|
|
86
114
|
|
|
87
115
|
/**************
|
|
@@ -205,17 +233,17 @@ class Deva {
|
|
|
205
233
|
},
|
|
206
234
|
created: Date.now(),
|
|
207
235
|
};
|
|
208
|
-
packet.a.md5 = this.
|
|
209
|
-
packet.a.sha256 = this.
|
|
210
|
-
packet.a.sha512 = this.
|
|
236
|
+
packet.a.md5 = this.hash(packet.a, 'md5');
|
|
237
|
+
packet.a.sha256 = this.hash(packet.a, 'sha256');
|
|
238
|
+
packet.a.sha512 = this.hash(packet.a, 'sha512');
|
|
211
239
|
|
|
212
240
|
delete packet.md5;
|
|
213
241
|
delete packet.sha256;
|
|
214
242
|
delete packet.sha512;
|
|
215
243
|
|
|
216
|
-
packet.md5 = this.
|
|
217
|
-
packet.sha256 = this.
|
|
218
|
-
packet.sha512 = this.
|
|
244
|
+
packet.md5 = this.hash(packet, 'md5');
|
|
245
|
+
packet.sha256 = this.hash(packet, 'sha256');
|
|
246
|
+
packet.sha512 = this.hash(packet, 'sha512');
|
|
219
247
|
|
|
220
248
|
this.state('invalid', `${meta.method}:${packet.id.uid}`);
|
|
221
249
|
return packet;
|
|
@@ -724,9 +752,9 @@ class Deva {
|
|
|
724
752
|
}
|
|
725
753
|
|
|
726
754
|
// hash the question
|
|
727
|
-
packet.q.md5 = this.
|
|
728
|
-
packet.q.sha256 = this.
|
|
729
|
-
packet.q.sha512 = this.
|
|
755
|
+
packet.q.md5 = this.hash(packet.q, 'md5');
|
|
756
|
+
packet.q.sha256 = this.hash(packet.q, 'sha256');
|
|
757
|
+
packet.q.sha512 = this.hash(packet.q, 'sha512');
|
|
730
758
|
|
|
731
759
|
this.talk(this._events.question, this.lib.copy(packet)); // global question event make sure to copy data.
|
|
732
760
|
|
|
@@ -800,9 +828,9 @@ class Deva {
|
|
|
800
828
|
created: Date.now(), // set the created date for the answer
|
|
801
829
|
};
|
|
802
830
|
// create a hash for the answer and insert into answer meta.
|
|
803
|
-
packet_answer.md5 = this.
|
|
804
|
-
packet_answer.sha256 = this.
|
|
805
|
-
packet_answer.sha512 = this.
|
|
831
|
+
packet_answer.md5 = this.hash(packet_answer, 'md5');
|
|
832
|
+
packet_answer.sha256 = this.hash(packet_answer, 'sha256');
|
|
833
|
+
packet_answer.sha512 = this.hash(packet_answer, 'sha512');
|
|
806
834
|
|
|
807
835
|
packet.a = packet_answer; // set the packet.a to the packet_answer
|
|
808
836
|
this.talk(this._events.answer, this.lib.copy(packet)); // global talk event
|
|
@@ -877,9 +905,9 @@ class Deva {
|
|
|
877
905
|
packet_answer.text = result;
|
|
878
906
|
}
|
|
879
907
|
|
|
880
|
-
packet_answer.md5 = this.
|
|
881
|
-
packet_answer.sha256 = this.
|
|
882
|
-
packet_answer.sha512 = this.
|
|
908
|
+
packet_answer.md5 = this.hash(packet_answer, 'md5'); // md5 the answer.
|
|
909
|
+
packet_answer.sha256 = this.hash(packet_answer, 'sha256'); // sha256 the answer.
|
|
910
|
+
packet_answer.sha512 = this.hash(packet_answer, 'sha512'); // sha512 the answer
|
|
883
911
|
|
|
884
912
|
packet.q.agent = agent; // set the question agent as the ask agent.
|
|
885
913
|
packet.a = packet_answer; // set the packet answer.
|
|
@@ -890,9 +918,9 @@ class Deva {
|
|
|
890
918
|
delete packet.sha512;
|
|
891
919
|
|
|
892
920
|
// create new hashes for the packet before return.
|
|
893
|
-
packet.md5 = this.
|
|
894
|
-
packet.sha256 = this.
|
|
895
|
-
packet.sha512 = this.
|
|
921
|
+
packet.md5 = this.hash(packet, 'md5');
|
|
922
|
+
packet.sha256 = this.hash(packet, 'sha256');
|
|
923
|
+
packet.sha512 = this.hash(packet, 'sha512');
|
|
896
924
|
|
|
897
925
|
this.talk(this._events.answer, this.lib.copy(packet)); // global talk event
|
|
898
926
|
this.talk(`${agent.key}:ask:${packet.id.uid}`, packet);
|
|
@@ -941,13 +969,13 @@ class Deva {
|
|
|
941
969
|
text: this._messages.init,
|
|
942
970
|
created: Date.now(),
|
|
943
971
|
}
|
|
944
|
-
data.md5 = this.
|
|
945
|
-
data.sha256 = this.
|
|
946
|
-
data.sha512 = this.
|
|
972
|
+
data.md5 = this.hash(data);
|
|
973
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
974
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
947
975
|
|
|
948
976
|
return new Promise((resolve, reject) => {
|
|
949
977
|
|
|
950
|
-
const license_check = this.license_check(client.VLA,
|
|
978
|
+
const license_check = this.license_check(client.VLA, this._core.VLA);
|
|
951
979
|
if (!license_check) {
|
|
952
980
|
this.prompt(this._messages.client_license_invalid);
|
|
953
981
|
return resolve(this._messages.client_license_invalid); // return if} license check fails
|
|
@@ -1049,9 +1077,9 @@ class Deva {
|
|
|
1049
1077
|
|
|
1050
1078
|
data.value = 'start';
|
|
1051
1079
|
|
|
1052
|
-
data.md5 = this.
|
|
1053
|
-
data.sha256 = this.
|
|
1054
|
-
data.sha512 = this.
|
|
1080
|
+
data.md5 = this.hash(data);
|
|
1081
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1082
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1055
1083
|
|
|
1056
1084
|
const hasOnStart = this.onStart && typeof this.onStart === 'function' ? true : false;
|
|
1057
1085
|
|
|
@@ -1084,9 +1112,9 @@ class Deva {
|
|
|
1084
1112
|
|
|
1085
1113
|
data.value = 'enter';
|
|
1086
1114
|
|
|
1087
|
-
data.md5 = this.
|
|
1088
|
-
data.sha256 = this.
|
|
1089
|
-
data.sha512 = this.
|
|
1115
|
+
data.md5 = this.hash(data);
|
|
1116
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1117
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1090
1118
|
|
|
1091
1119
|
this.state('enter', data.id.uid);
|
|
1092
1120
|
this.talk(this._events.enter, data);
|
|
@@ -1117,9 +1145,9 @@ class Deva {
|
|
|
1117
1145
|
|
|
1118
1146
|
data.value = 'done';
|
|
1119
1147
|
|
|
1120
|
-
data.md5 = this.
|
|
1121
|
-
data.sha256 = this.
|
|
1122
|
-
data.sha512 = this.
|
|
1148
|
+
data.md5 = this.hash(data);
|
|
1149
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1150
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1123
1151
|
|
|
1124
1152
|
this.state('done', data.id.uid);
|
|
1125
1153
|
this.talk(this._events.done, data);
|
|
@@ -1148,9 +1176,9 @@ class Deva {
|
|
|
1148
1176
|
|
|
1149
1177
|
data.value = 'ready';
|
|
1150
1178
|
|
|
1151
|
-
data.md5 = this.
|
|
1152
|
-
data.sha256 = this.
|
|
1153
|
-
data.sha512 = this.
|
|
1179
|
+
data.md5 = this.hash(data);
|
|
1180
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1181
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1154
1182
|
|
|
1155
1183
|
this.state('ready', data.id.uid);
|
|
1156
1184
|
this.talk(this._events.ready, data);
|
|
@@ -1178,9 +1206,9 @@ class Deva {
|
|
|
1178
1206
|
|
|
1179
1207
|
data.finish = Date.now(); // set the finish timestamp
|
|
1180
1208
|
|
|
1181
|
-
data.md5 = this.
|
|
1182
|
-
data.sha256 = this.
|
|
1183
|
-
data.sha512 = this.
|
|
1209
|
+
data.md5 = this.hash(data);
|
|
1210
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1211
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1184
1212
|
|
|
1185
1213
|
this.state('finish', data.id.uid); // set finish state
|
|
1186
1214
|
this.talk(this._events.finish, data);
|
|
@@ -1208,9 +1236,9 @@ class Deva {
|
|
|
1208
1236
|
delete data.sha512;
|
|
1209
1237
|
|
|
1210
1238
|
data.complete = Date.now();// set the complete date on the whole data.
|
|
1211
|
-
data.md5 = this.
|
|
1212
|
-
data.sha256 = this.
|
|
1213
|
-
data.sha512 = this.
|
|
1239
|
+
data.md5 = this.hash(data);
|
|
1240
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1241
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1214
1242
|
|
|
1215
1243
|
this.state('complete', data.id.uid);
|
|
1216
1244
|
this.talk(this._events.complete, data);
|
|
@@ -1247,9 +1275,9 @@ class Deva {
|
|
|
1247
1275
|
created: Date.now(), // set the created date
|
|
1248
1276
|
}
|
|
1249
1277
|
|
|
1250
|
-
data.md5 = this.
|
|
1251
|
-
data.sha256 = this.
|
|
1252
|
-
data.sha512 = this.
|
|
1278
|
+
data.md5 = this.hash(data);
|
|
1279
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1280
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1253
1281
|
|
|
1254
1282
|
// has stop function then set hasOnStop variable
|
|
1255
1283
|
// if: has on stop then run on stop function or return exit function.
|
|
@@ -1285,9 +1313,9 @@ class Deva {
|
|
|
1285
1313
|
created: Date.now(),
|
|
1286
1314
|
}
|
|
1287
1315
|
|
|
1288
|
-
data.md5 = this.
|
|
1289
|
-
data.sha256 = this.
|
|
1290
|
-
data.sha512 = this.
|
|
1316
|
+
data.md5 = this.hash(data);
|
|
1317
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1318
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1291
1319
|
|
|
1292
1320
|
this.state('exit', id); // set the state to stop
|
|
1293
1321
|
this.talk(this._events.exit, data);
|
|
@@ -1339,9 +1367,9 @@ class Deva {
|
|
|
1339
1367
|
created: Date.now(), // set the data created date.
|
|
1340
1368
|
};
|
|
1341
1369
|
|
|
1342
|
-
data.md5 = this.
|
|
1343
|
-
data.sha256 = this.
|
|
1344
|
-
data.sha512 = this.
|
|
1370
|
+
data.md5 = this.hash(data);
|
|
1371
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1372
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1345
1373
|
|
|
1346
1374
|
this.talk(this._events.state, data); // broadcasat the state event
|
|
1347
1375
|
return data;
|
|
@@ -1365,9 +1393,9 @@ class Deva {
|
|
|
1365
1393
|
created: Date.now(),
|
|
1366
1394
|
}
|
|
1367
1395
|
|
|
1368
|
-
data.md5 = this.
|
|
1369
|
-
data.sha256 = this.
|
|
1370
|
-
data.sha512 = this.
|
|
1396
|
+
data.md5 = this.hash(data);
|
|
1397
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1398
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1371
1399
|
|
|
1372
1400
|
this.state('return', `states:${id.uid}`);
|
|
1373
1401
|
return data;
|
|
@@ -1398,9 +1426,9 @@ class Deva {
|
|
|
1398
1426
|
created: Date.now(),
|
|
1399
1427
|
};
|
|
1400
1428
|
|
|
1401
|
-
data.md5 = this.
|
|
1402
|
-
data.sha256 = this.
|
|
1403
|
-
data.sha512 = this.
|
|
1429
|
+
data.md5 = this.hash(data);
|
|
1430
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1431
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1404
1432
|
|
|
1405
1433
|
this.talk(this._events.zone, data);
|
|
1406
1434
|
return data;
|
|
@@ -1429,9 +1457,9 @@ class Deva {
|
|
|
1429
1457
|
created: Date.now(), // set the created date of the object.
|
|
1430
1458
|
}
|
|
1431
1459
|
|
|
1432
|
-
data.md5 = this.
|
|
1433
|
-
data.sha256 = this.
|
|
1434
|
-
data.sha512 = this.
|
|
1460
|
+
data.md5 = this.hash(data);
|
|
1461
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1462
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1435
1463
|
|
|
1436
1464
|
return data
|
|
1437
1465
|
}
|
|
@@ -1465,9 +1493,9 @@ class Deva {
|
|
|
1465
1493
|
created: Date.now(), // action time stamp
|
|
1466
1494
|
};
|
|
1467
1495
|
|
|
1468
|
-
data.md5 = this.
|
|
1469
|
-
data.sha256 = this.
|
|
1470
|
-
data.sha512 = this.
|
|
1496
|
+
data.md5 = this.hash(data);
|
|
1497
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1498
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1471
1499
|
|
|
1472
1500
|
this.talk(this._events.action, data); // talk the core action event
|
|
1473
1501
|
return data;
|
|
@@ -1494,9 +1522,9 @@ class Deva {
|
|
|
1494
1522
|
created: Date.now(), // set the data created date
|
|
1495
1523
|
};
|
|
1496
1524
|
|
|
1497
|
-
data.md5 = this.
|
|
1498
|
-
data.sha256 = this.
|
|
1499
|
-
data.sha512 = this.
|
|
1525
|
+
data.md5 = this.hash(data);
|
|
1526
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1527
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1500
1528
|
|
|
1501
1529
|
this.state('return', `actions:${id.uid}`);
|
|
1502
1530
|
return data;
|
|
@@ -1526,9 +1554,9 @@ class Deva {
|
|
|
1526
1554
|
created: Date.now(), // set the creation date
|
|
1527
1555
|
};
|
|
1528
1556
|
|
|
1529
|
-
data.md5 = this.
|
|
1530
|
-
data.sha256 = this.
|
|
1531
|
-
data.sha512 = this.
|
|
1557
|
+
data.md5 = this.hash(data);
|
|
1558
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1559
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1532
1560
|
|
|
1533
1561
|
this.talk(this._events.feature, data); // talk the feature event with data
|
|
1534
1562
|
return data;
|
|
@@ -1556,9 +1584,9 @@ class Deva {
|
|
|
1556
1584
|
created: Date.now(), // set the created date.
|
|
1557
1585
|
};
|
|
1558
1586
|
|
|
1559
|
-
data.md5 = this.
|
|
1560
|
-
data.sha256 = this.
|
|
1561
|
-
data.sha512 = this.
|
|
1587
|
+
data.md5 = this.hash(data);
|
|
1588
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1589
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1562
1590
|
|
|
1563
1591
|
this.state('return', `features:${id.uid}`);
|
|
1564
1592
|
return data;
|
|
@@ -1590,9 +1618,9 @@ class Deva {
|
|
|
1590
1618
|
created: Date.now(),
|
|
1591
1619
|
};
|
|
1592
1620
|
|
|
1593
|
-
data.md5 = this.
|
|
1594
|
-
data.sha256 = this.
|
|
1595
|
-
data.sha512 = this.
|
|
1621
|
+
data.md5 = this.hash(data);
|
|
1622
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1623
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1596
1624
|
|
|
1597
1625
|
this.talk(this._events.context, data);
|
|
1598
1626
|
return data;
|
|
@@ -1616,9 +1644,9 @@ class Deva {
|
|
|
1616
1644
|
created: Date.now(),
|
|
1617
1645
|
};
|
|
1618
1646
|
|
|
1619
|
-
data.md5 = this.
|
|
1620
|
-
data.sha256 = this.
|
|
1621
|
-
data.sha512 = this.
|
|
1647
|
+
data.md5 = this.hash(data);
|
|
1648
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1649
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1622
1650
|
|
|
1623
1651
|
this.state('return', `contexts:${id.uid}`);
|
|
1624
1652
|
return data;
|
|
@@ -1633,9 +1661,9 @@ class Deva {
|
|
|
1633
1661
|
client() {
|
|
1634
1662
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1635
1663
|
const data = this.lib.copy(this._client); // create a copy of the client data
|
|
1636
|
-
data.md5 = this.
|
|
1637
|
-
data.sha256 = this.
|
|
1638
|
-
data.sha512 = this.
|
|
1664
|
+
data.md5 = this.hash(data, 'md5');
|
|
1665
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1666
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1639
1667
|
return data; // return the copy of the client data.
|
|
1640
1668
|
}
|
|
1641
1669
|
|
|
@@ -1648,9 +1676,9 @@ class Deva {
|
|
|
1648
1676
|
agent() {
|
|
1649
1677
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1650
1678
|
const data = this.lib.copy(this._agent); // create a copy of the agent data.
|
|
1651
|
-
data.md5 = this.
|
|
1652
|
-
data.sha256 = this.
|
|
1653
|
-
data.sha512 = this.
|
|
1679
|
+
data.md5 = this.hash(data, 'md5');
|
|
1680
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
1681
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
1654
1682
|
return data; // return the copy of the agent data.
|
|
1655
1683
|
}
|
|
1656
1684
|
|
|
@@ -1965,13 +1993,13 @@ class Deva {
|
|
|
1965
1993
|
}
|
|
1966
1994
|
|
|
1967
1995
|
this.state('hash', `${key}:${value}:md5:${id.uid}`)
|
|
1968
|
-
data.md5 = this.
|
|
1996
|
+
data.md5 = this.hash(data); // md5 the data packet
|
|
1969
1997
|
|
|
1970
1998
|
this.state('hash', `${key}:${value}:sha256:${id.uid}`)
|
|
1971
|
-
data.sha256 = this.
|
|
1999
|
+
data.sha256 = this.hash(data, 'sha256'); // sha256 the data packet
|
|
1972
2000
|
|
|
1973
2001
|
this.state('hash', `${key}:${value}:sha512:${id.uid}`)
|
|
1974
|
-
data.sha512 = this.
|
|
2002
|
+
data.sha512 = this.hash(data, 'sha512'); // sha512 the data packet
|
|
1975
2003
|
|
|
1976
2004
|
this.action('talk', `${key}:${value}:${id.uid}`);
|
|
1977
2005
|
this.talk(this._events.prompt, data);
|
|
@@ -1995,9 +2023,9 @@ class Deva {
|
|
|
1995
2023
|
data.id = id;
|
|
1996
2024
|
data.created = Date.now();
|
|
1997
2025
|
|
|
1998
|
-
data.md5 = this.
|
|
1999
|
-
data.sha256 = this.
|
|
2000
|
-
data.sha512 = this.
|
|
2026
|
+
data.md5 = this.hash(data, 'md5');
|
|
2027
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
2028
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
2001
2029
|
|
|
2002
2030
|
this.state('return', `core:${id.uid}`);
|
|
2003
2031
|
return data;
|
|
@@ -2017,9 +2045,9 @@ class Deva {
|
|
|
2017
2045
|
data.id = id;
|
|
2018
2046
|
data.created = Date.now();
|
|
2019
2047
|
|
|
2020
|
-
data.md5 = this.
|
|
2021
|
-
data.sha256 = this.
|
|
2022
|
-
data.sha512 = this.
|
|
2048
|
+
data.md5 = this.hash(data);
|
|
2049
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
2050
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
2023
2051
|
|
|
2024
2052
|
this.state('return', `info:${id.uid}`);
|
|
2025
2053
|
return data;
|
|
@@ -2145,9 +2173,9 @@ class Deva {
|
|
|
2145
2173
|
packet,
|
|
2146
2174
|
created: Date.now(),
|
|
2147
2175
|
}
|
|
2148
|
-
data.md5 = this.
|
|
2149
|
-
data.sha256 = this.
|
|
2150
|
-
data.sha512 = this.
|
|
2176
|
+
data.md5 = this.hash(data);
|
|
2177
|
+
data.sha256 = this.hash(data, 'sha256');
|
|
2178
|
+
data.sha512 = this.hash(data, 'sha512');
|
|
2151
2179
|
|
|
2152
2180
|
this.talk(this._events.error, this.lib.copy(data));
|
|
2153
2181
|
|
|
@@ -2175,7 +2203,7 @@ class Deva {
|
|
|
2175
2203
|
const time = Date.now(); // set time to local constant
|
|
2176
2204
|
const date = this.lib.formatDate(time, 'long', true); // set date to local constant
|
|
2177
2205
|
|
|
2178
|
-
const
|
|
2206
|
+
const core_hash = this.hash(this._core, 'sha256');
|
|
2179
2207
|
const client_hash = this.client().sha256 || false;
|
|
2180
2208
|
const agent_hash = this.agent().sha256 || false;
|
|
2181
2209
|
const machine_hash = this.lib.machine();
|
|
@@ -2186,10 +2214,10 @@ class Deva {
|
|
|
2186
2214
|
date,
|
|
2187
2215
|
client: client_hash,
|
|
2188
2216
|
agent: agent_hash,
|
|
2189
|
-
|
|
2217
|
+
core: core_hash,
|
|
2190
2218
|
machine: machine_hash,
|
|
2191
2219
|
warning: this._messages.uid_warning,
|
|
2192
|
-
copyright:
|
|
2220
|
+
copyright: this._core.copyright,
|
|
2193
2221
|
}
|
|
2194
2222
|
if (guid) {
|
|
2195
2223
|
const uid = randomUUID(); // set uid into local constant.
|
|
@@ -2205,9 +2233,9 @@ class Deva {
|
|
|
2205
2233
|
const uid = `${begin_random}${end_random}`; // set uid to local constant
|
|
2206
2234
|
data.uid = uid; // set base data object.
|
|
2207
2235
|
}
|
|
2208
|
-
data.md5 = this.
|
|
2209
|
-
data.sha256 = this.
|
|
2210
|
-
data.sha512 = this.
|
|
2236
|
+
data.md5 = this.hash(data, 'md5'); // md5 the uid and created.
|
|
2237
|
+
data.sha256 = this.hash(data, 'sha256'); // sha256 the uid, created, md5
|
|
2238
|
+
data.sha512 = this.hash(data, 'sha512'); // sha512 the uid, created, md5, sha256.
|
|
2211
2239
|
return data; // return the complete uid data.
|
|
2212
2240
|
}
|
|
2213
2241
|
|
|
@@ -2231,8 +2259,8 @@ class Deva {
|
|
|
2231
2259
|
|
|
2232
2260
|
const container = `OM:O:${key.toUpperCase()}:${transport}`; // set container string.
|
|
2233
2261
|
|
|
2234
|
-
const packet_hash = this.
|
|
2235
|
-
const token = this.
|
|
2262
|
+
const packet_hash = this.hash(packet, 'sha256');
|
|
2263
|
+
const token = this.hash(`${key} client:${client.profile.id} fullname:${client.profile.fullname} transport:${transport}`, 'sha256');
|
|
2236
2264
|
|
|
2237
2265
|
// build the main data packet.
|
|
2238
2266
|
const data = {
|
|
@@ -2264,9 +2292,9 @@ class Deva {
|
|
|
2264
2292
|
warning: client.warning || agent.warning || 'none',
|
|
2265
2293
|
copyright: client.profile.copyright || agent.profile.copyright,
|
|
2266
2294
|
};
|
|
2267
|
-
data.md5 = this.
|
|
2268
|
-
data.sha256 = this.
|
|
2269
|
-
data.sha512 = this.
|
|
2295
|
+
data.md5 = this.hash(data, 'md5'); // hash data packet into md5 and inert into data.
|
|
2296
|
+
data.sha256 = this.hash(data, 'sha256'); // hash data into sha 256 then set in data.
|
|
2297
|
+
data.sha512 = this.hash(data, 'sha512'); // hash data into sha 512 then set in data.
|
|
2270
2298
|
return data;
|
|
2271
2299
|
}
|
|
2272
2300
|
|
|
@@ -2278,8 +2306,8 @@ class Deva {
|
|
|
2278
2306
|
|
|
2279
2307
|
// this is to ensure no additional information is being transmitted.
|
|
2280
2308
|
this.state('license', `compare:sha256:${packageVLA.uid}`);
|
|
2281
|
-
const personalVLA_hash = this.
|
|
2282
|
-
const packageVLA_hash = this.
|
|
2309
|
+
const personalVLA_hash = this.hash(personalVLA, 'sha256');
|
|
2310
|
+
const packageVLA_hash = this.hash(packageVLA, 'sha256');
|
|
2283
2311
|
|
|
2284
2312
|
if (personalVLA_hash !== packageVLA_hash) return false;
|
|
2285
2313
|
|
|
@@ -2290,12 +2318,28 @@ class Deva {
|
|
|
2290
2318
|
personal: personalVLA_hash,
|
|
2291
2319
|
package: packageVLA_hash,
|
|
2292
2320
|
};
|
|
2293
|
-
approved.md5 = this.
|
|
2294
|
-
approved.sha256 = this.
|
|
2295
|
-
approved.sha512 = this.
|
|
2321
|
+
approved.md5 = this.hash(approved, 'md5');
|
|
2322
|
+
approved.sha256 = this.hash(approved, 'sha256');
|
|
2323
|
+
approved.sha512 = this.hash(approved, 'sha512');
|
|
2296
2324
|
|
|
2297
2325
|
this.state('return', `license:${packageVLA.uid}`);
|
|
2298
2326
|
return approved;
|
|
2299
2327
|
}
|
|
2328
|
+
|
|
2329
|
+
/**************
|
|
2330
|
+
func: hash
|
|
2331
|
+
params:
|
|
2332
|
+
- texts: The text string to create a hash value for.
|
|
2333
|
+
- algo: The hashing algorithm to use for hashing. md5, sha256, or sha512
|
|
2334
|
+
|
|
2335
|
+
describe:
|
|
2336
|
+
The hash algorithm will take a string of text and produce a hash.
|
|
2337
|
+
***************/
|
|
2338
|
+
hash(str, algo='md5') {
|
|
2339
|
+
const the_hash = createHash(algo);
|
|
2340
|
+
the_hash.update(JSON.stringify(str));
|
|
2341
|
+
return the_hash.digest('base64');
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2300
2344
|
}
|
|
2301
2345
|
export default Deva;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "24789087843554622185",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.6.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "1.6.80",
|
|
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:44435048570336088519 LICENSE.md",
|
|
8
8
|
"VLA": {
|