@indra.ai/deva 1.4.6 → 1.4.8
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 +1 -2
- package/index.js +30 -22
- package/package.json +1 -1
package/config.json
CHANGED
|
@@ -157,7 +157,6 @@
|
|
|
157
157
|
"method": "❤️🔥 Method",
|
|
158
158
|
"list": "📋 List",
|
|
159
159
|
"reply": "📮 Reply",
|
|
160
|
-
"write": "️📝 Write",
|
|
161
160
|
"set": "🍽️ Set",
|
|
162
161
|
"get": "🤔 Get",
|
|
163
162
|
"send": "🚀 Send",
|
|
@@ -200,7 +199,7 @@
|
|
|
200
199
|
"audio": "👂 Audio",
|
|
201
200
|
"text": "📕 Text",
|
|
202
201
|
"image": "🌄 Image",
|
|
203
|
-
"
|
|
202
|
+
"video": "📽️ Video",
|
|
204
203
|
"signature": "✍️ Signature",
|
|
205
204
|
"orders": "🪖 Orders",
|
|
206
205
|
"law": "🔏 Law",
|
package/index.js
CHANGED
|
@@ -238,7 +238,7 @@ class Deva {
|
|
|
238
238
|
const data = features[feature]; // make a copy the clinet data.
|
|
239
239
|
this.state('set', feature);
|
|
240
240
|
this[_fe] = { // set this_security with data
|
|
241
|
-
id: this.lib.uid(
|
|
241
|
+
id: this.lib.uid(), // uuid of the security feature
|
|
242
242
|
client_id: id, // client id for reference
|
|
243
243
|
client_name: profile.name, // client name for personalization
|
|
244
244
|
concerns: data.concerns, // any concerns for client
|
|
@@ -677,7 +677,7 @@ class Deva {
|
|
|
677
677
|
const agent = this.agent();
|
|
678
678
|
|
|
679
679
|
const _data = {
|
|
680
|
-
id: this.lib.uid(
|
|
680
|
+
id: this.lib.uid(),
|
|
681
681
|
key: 'init',
|
|
682
682
|
value: agent.key,
|
|
683
683
|
agent,
|
|
@@ -915,7 +915,7 @@ class Deva {
|
|
|
915
915
|
|
|
916
916
|
this.action('exit');
|
|
917
917
|
const data = {
|
|
918
|
-
id: this.lib.uid(
|
|
918
|
+
id: this.lib.uid(),
|
|
919
919
|
key: 'exit',
|
|
920
920
|
value: this._messages.exit,
|
|
921
921
|
agent,
|
|
@@ -982,7 +982,7 @@ class Deva {
|
|
|
982
982
|
this.action('func', 'states');
|
|
983
983
|
this.state('return', 'states');
|
|
984
984
|
return {
|
|
985
|
-
id: this.lib.uid(
|
|
985
|
+
id: this.lib.uid(),
|
|
986
986
|
key: 'states',
|
|
987
987
|
value: this._states,
|
|
988
988
|
created: Date.now(),
|
|
@@ -1028,7 +1028,7 @@ class Deva {
|
|
|
1028
1028
|
this.action('func', 'zones');
|
|
1029
1029
|
this.state('return', 'zones');
|
|
1030
1030
|
return {
|
|
1031
|
-
id: this.lib.uid(
|
|
1031
|
+
id: this.lib.uid(), // set the uuid of the data
|
|
1032
1032
|
agent: this.agent(), // set the agent value
|
|
1033
1033
|
cleint: this.client(), // set the client value
|
|
1034
1034
|
key: 'zones', // set the key return value
|
|
@@ -1055,7 +1055,7 @@ class Deva {
|
|
|
1055
1055
|
const msg = msg_action || action; // set the correct message
|
|
1056
1056
|
const text = extra ? `${msg} ${extra}` : msg; // set the text of the action
|
|
1057
1057
|
const data = { // build the data object for the action.
|
|
1058
|
-
id: this.lib.uid(
|
|
1058
|
+
id: this.lib.uid(), // generate a guid for the action transmitssion.
|
|
1059
1059
|
agent: this.agent(), // the agent data to send with the action
|
|
1060
1060
|
client: this.client(), // the client data to send with the action
|
|
1061
1061
|
key: 'action', // the key for event to transmit action type
|
|
@@ -1079,14 +1079,16 @@ class Deva {
|
|
|
1079
1079
|
actions() {
|
|
1080
1080
|
this.action('func', 'actions');
|
|
1081
1081
|
this.state('return', 'actions');
|
|
1082
|
-
|
|
1083
|
-
id: this.lib.uid(
|
|
1082
|
+
const data = {
|
|
1083
|
+
id: this.lib.uid(), // set the id with a uuid
|
|
1084
1084
|
agent: this.agent(), // set the agent value
|
|
1085
1085
|
client: this.client(), // set the client value
|
|
1086
1086
|
key: 'actions', // set the data key
|
|
1087
1087
|
value: this._actions, // set the value to the actions list
|
|
1088
|
-
created: Date.now(), // set the data created date
|
|
1089
|
-
}
|
|
1088
|
+
created: Date.now(), // set the data created date
|
|
1089
|
+
};
|
|
1090
|
+
data.hash = this.lib.hash(data)
|
|
1091
|
+
return data;
|
|
1090
1092
|
}
|
|
1091
1093
|
|
|
1092
1094
|
/**************
|
|
@@ -1104,7 +1106,7 @@ class Deva {
|
|
|
1104
1106
|
const text = extra ? `${lookup} ${extra}` : lookup; // set the text value
|
|
1105
1107
|
|
|
1106
1108
|
const data = { // build data object
|
|
1107
|
-
id: this.lib.uid(
|
|
1109
|
+
id: this.lib.uid(), // set the id
|
|
1108
1110
|
agent: this.agent(), // set the agent transporting the packet.
|
|
1109
1111
|
key: 'feature', // set the key for transport
|
|
1110
1112
|
value, // set the value of the key
|
|
@@ -1126,14 +1128,16 @@ class Deva {
|
|
|
1126
1128
|
***************/
|
|
1127
1129
|
features() {
|
|
1128
1130
|
this.state('return', 'features');
|
|
1129
|
-
|
|
1130
|
-
id: this.lib.uid(
|
|
1131
|
+
const data = {
|
|
1132
|
+
id: this.lib.uid(), // set the object id
|
|
1131
1133
|
agent: this.agent(), // set the agent value.
|
|
1132
1134
|
client: this.client(), // set the client value.
|
|
1133
1135
|
key: 'features', // set the key
|
|
1134
1136
|
value: this._features, // set the value to the features list
|
|
1135
1137
|
created: Date.now(), // set the created date.
|
|
1136
|
-
}
|
|
1138
|
+
};
|
|
1139
|
+
data.hash = this.lib.hash(data);
|
|
1140
|
+
return data;
|
|
1137
1141
|
}
|
|
1138
1142
|
|
|
1139
1143
|
/**************
|
|
@@ -1151,7 +1155,7 @@ class Deva {
|
|
|
1151
1155
|
const text = extra ? `${lookup} ${extra}` : lookup;
|
|
1152
1156
|
|
|
1153
1157
|
const data = {
|
|
1154
|
-
id: this.lib.uid(
|
|
1158
|
+
id: this.lib.uid(),
|
|
1155
1159
|
agent: this.agent(),
|
|
1156
1160
|
client: this.client(),
|
|
1157
1161
|
key: 'context',
|
|
@@ -1159,7 +1163,6 @@ class Deva {
|
|
|
1159
1163
|
text,
|
|
1160
1164
|
created: Date.now(),
|
|
1161
1165
|
};
|
|
1162
|
-
|
|
1163
1166
|
data.hash = this.lib.hash(data);
|
|
1164
1167
|
this.talk(config.events.context, data);
|
|
1165
1168
|
return data;
|
|
@@ -1172,7 +1175,7 @@ class Deva {
|
|
|
1172
1175
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1173
1176
|
this.state('return', 'contexts');
|
|
1174
1177
|
return {
|
|
1175
|
-
id: this.lib.uid(
|
|
1178
|
+
id: this.lib.uid(),
|
|
1176
1179
|
agent: this.agent(),
|
|
1177
1180
|
client: this.client(),
|
|
1178
1181
|
key: 'contexts',
|
|
@@ -1419,7 +1422,7 @@ class Deva {
|
|
|
1419
1422
|
const agent = this.agent();
|
|
1420
1423
|
const client = this.client();
|
|
1421
1424
|
const _data = {
|
|
1422
|
-
id: this.lib.uid(
|
|
1425
|
+
id: this.lib.uid(),
|
|
1423
1426
|
key: 'prompt',
|
|
1424
1427
|
value: agent.key,
|
|
1425
1428
|
agent,
|
|
@@ -1427,6 +1430,7 @@ class Deva {
|
|
|
1427
1430
|
text,
|
|
1428
1431
|
created: Date.now(),
|
|
1429
1432
|
}
|
|
1433
|
+
_data.hash = this.lib.hash(_data);
|
|
1430
1434
|
return this.talk(config.events.prompt, _data);
|
|
1431
1435
|
}
|
|
1432
1436
|
|
|
@@ -1505,25 +1509,29 @@ class Deva {
|
|
|
1505
1509
|
- data: Any additional data associated with the error
|
|
1506
1510
|
- reject: An associated promise reject if the caller requires.
|
|
1507
1511
|
describe:
|
|
1508
|
-
The
|
|
1512
|
+
The error function provides the consistent error manage of the system.
|
|
1509
1513
|
usage: this.error(err, data, reject);
|
|
1510
1514
|
***************/
|
|
1511
1515
|
error(err,data=false,reject=false) {
|
|
1512
1516
|
this.zone('error');
|
|
1513
|
-
|
|
1514
1517
|
this.action('error')
|
|
1515
1518
|
const agent = this.agent();
|
|
1516
1519
|
const client = this.client();
|
|
1517
1520
|
const _data = {
|
|
1518
|
-
id: this.lib.uid(
|
|
1521
|
+
id: this.lib.uid(),
|
|
1519
1522
|
key: 'error',
|
|
1520
1523
|
value: agent.key,
|
|
1521
1524
|
agent,
|
|
1522
1525
|
client,
|
|
1523
|
-
error:
|
|
1526
|
+
error: {
|
|
1527
|
+
name: err.name,
|
|
1528
|
+
message: err.message,
|
|
1529
|
+
stack: err.stack,
|
|
1530
|
+
},
|
|
1524
1531
|
data,
|
|
1525
1532
|
created: Date.now(),
|
|
1526
1533
|
}
|
|
1534
|
+
_data.hash = this.lib.hash(_data);
|
|
1527
1535
|
this.talk(config.events.error, this.lib.copy(_data));
|
|
1528
1536
|
const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
|
|
1529
1537
|
|