@indra.ai/deva 1.5.4 โ 1.5.6
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 +104 -56
- package/package.json +45 -44
package/index.js
CHANGED
|
@@ -409,6 +409,7 @@ class Deva {
|
|
|
409
409
|
to create seamless collaboration between Devas.
|
|
410
410
|
***************/
|
|
411
411
|
talk(evt, resource=false) {
|
|
412
|
+
this.action('talk', evt);
|
|
412
413
|
return this.events.emit(evt, resource);
|
|
413
414
|
}
|
|
414
415
|
|
|
@@ -420,6 +421,7 @@ class Deva {
|
|
|
420
421
|
describe: setup a new event listener in the system.
|
|
421
422
|
***************/
|
|
422
423
|
listen(evt, callback) {
|
|
424
|
+
this.action('listen', evt);
|
|
423
425
|
this.listeners[evt] = callback;
|
|
424
426
|
return this.events.on(evt, packet => {
|
|
425
427
|
return this.listeners[evt](packet);
|
|
@@ -434,6 +436,7 @@ class Deva {
|
|
|
434
436
|
describe:
|
|
435
437
|
***************/
|
|
436
438
|
once(evt, callback) {
|
|
439
|
+
this.action('once', evt)
|
|
437
440
|
return this.events.once(evt, callback);
|
|
438
441
|
}
|
|
439
442
|
|
|
@@ -445,6 +448,7 @@ class Deva {
|
|
|
445
448
|
describe: The ignore function allow the removal of events in the listener group.
|
|
446
449
|
***************/
|
|
447
450
|
ignore(evt, callback) {
|
|
451
|
+
this.action('ignore', evt);
|
|
448
452
|
return this.events.removeListener(evt, callback);
|
|
449
453
|
}
|
|
450
454
|
|
|
@@ -461,7 +465,7 @@ class Deva {
|
|
|
461
465
|
// check the active status
|
|
462
466
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
463
467
|
this.zone('question');
|
|
464
|
-
|
|
468
|
+
this.action('question');
|
|
465
469
|
const id = this.lib.uid(); // generate a unique id for transport.
|
|
466
470
|
const t_split = TEXT.split(' '); // split the text on spaces to get words.
|
|
467
471
|
const data = DATA; // set the DATA to data
|
|
@@ -483,7 +487,7 @@ class Deva {
|
|
|
483
487
|
let text = TEXT, // let TEXT is text for a manipulation variable
|
|
484
488
|
params = false, // params as false to build params string
|
|
485
489
|
method = 'question', // set the default method to question
|
|
486
|
-
key = this.
|
|
490
|
+
key = this.agent().key; // set a temporary key from the agent key.
|
|
487
491
|
|
|
488
492
|
return new Promise((resolve, reject) => {
|
|
489
493
|
// resolve with the no text message if the client says nothing.
|
|
@@ -525,15 +529,12 @@ class Deva {
|
|
|
525
529
|
// hash the question
|
|
526
530
|
packet.q.meta.hash = this.lib.hash(packet.q);
|
|
527
531
|
|
|
528
|
-
this.action('talk', config.events.question);
|
|
529
532
|
this.talk(config.events.question, this.lib.copy(packet)); // global question event make sure to copy data.
|
|
530
533
|
|
|
531
534
|
if (isAsk) { // isAsk check if the question isAsk and talk
|
|
532
535
|
// if: isAsk wait for the once event which is key'd to the packet ID for specified responses
|
|
533
|
-
this.action('talk', `${key}:ask`);
|
|
534
536
|
this.talk(`${key}:ask`, packet);
|
|
535
537
|
this.once(`${key}:ask:${packet.id}`, answer => {
|
|
536
|
-
this.action('talk', config.events.ask);
|
|
537
538
|
this.talk(config.events.ask, this.lib.copy(answer));
|
|
538
539
|
this.state('finish', `${key}:ask`);
|
|
539
540
|
return this.finish(answer, resolve); // if:isAsk resolve the answer from the call
|
|
@@ -564,18 +565,18 @@ class Deva {
|
|
|
564
565
|
answer(packet, resolve, reject) {
|
|
565
566
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
566
567
|
this.zone('answer'); // set zone to answer
|
|
567
|
-
|
|
568
568
|
const agent = this.agent();
|
|
569
569
|
const client = this.client();
|
|
570
570
|
// check if method exists and is of type function
|
|
571
571
|
const {method,params} = packet.q.meta;
|
|
572
|
-
|
|
572
|
+
this.action('answer', method);
|
|
573
|
+
|
|
573
574
|
this.state('try', `answer:${method}`);
|
|
574
575
|
try {
|
|
575
576
|
const isMethod = this.methods[method] && typeof this.methods[method] == 'function';
|
|
576
577
|
if (!isMethod) return resolve(this._methodNotFound(packet)); // resolve method not found if check if check fails
|
|
577
578
|
|
|
578
|
-
this.action('method', method);
|
|
579
|
+
this.action('method', `answer:${method}`);
|
|
579
580
|
this.methods[method](packet).then(result => {
|
|
580
581
|
// check the result for the text, html, and data object. // this is for when answers are returned from nested Devas.
|
|
581
582
|
const text = typeof result === 'object' ? result.text : result;
|
|
@@ -599,7 +600,6 @@ class Deva {
|
|
|
599
600
|
created: Date.now(), // set the created date for the answer
|
|
600
601
|
};
|
|
601
602
|
// create a hash for the answer and insert into answer meta.
|
|
602
|
-
this.action('talk', config.events.answer)
|
|
603
603
|
packet_answer.meta.hash = this.lib.hash(packet_answer);
|
|
604
604
|
packet.a = packet_answer; // set the packet.a to the packet_answer
|
|
605
605
|
this.talk(config.events.answer, this.lib.copy(packet)); // global talk event
|
|
@@ -678,9 +678,7 @@ class Deva {
|
|
|
678
678
|
|
|
679
679
|
packet_answer.meta.hash = this.lib.hash(packet_answer);
|
|
680
680
|
packet.a = packet_answer;
|
|
681
|
-
this.action('talk', config.events.answer);
|
|
682
681
|
this.talk(config.events.answer, this.lib.copy(packet)); // global talk event
|
|
683
|
-
this.action('talk', `ask:${packet.id}`);
|
|
684
682
|
this.talk(`${agent.key}:ask:${packet.id}`, packet);
|
|
685
683
|
}).catch(err => {
|
|
686
684
|
this.talk(`${agent.key}:ask:${packet.id}`, {error:err});
|
|
@@ -1022,14 +1020,17 @@ class Deva {
|
|
|
1022
1020
|
describe: returns the avaiable staets values.
|
|
1023
1021
|
***************/
|
|
1024
1022
|
states() {
|
|
1025
|
-
this.
|
|
1026
|
-
this.
|
|
1027
|
-
|
|
1028
|
-
id
|
|
1023
|
+
const id = this.lib.uid();
|
|
1024
|
+
this.action('states', id);
|
|
1025
|
+
const data = {
|
|
1026
|
+
id,
|
|
1029
1027
|
key: 'states',
|
|
1030
1028
|
value: this._states,
|
|
1031
|
-
created: Date.now(),
|
|
1029
|
+
created: Date.now(),
|
|
1032
1030
|
}
|
|
1031
|
+
data.hash = this.lib.hash(data);
|
|
1032
|
+
this.state('return', `states:${id}`);
|
|
1033
|
+
return data;
|
|
1033
1034
|
}
|
|
1034
1035
|
|
|
1035
1036
|
/**************
|
|
@@ -1039,15 +1040,19 @@ class Deva {
|
|
|
1039
1040
|
describe
|
|
1040
1041
|
***************/
|
|
1041
1042
|
zone(value=false, extra=false) {
|
|
1043
|
+
const id = this.lib.uid();
|
|
1044
|
+
this.action('zone', `zone:${value}:${id}`);
|
|
1045
|
+
|
|
1042
1046
|
if (!value || !this._zones[value] || value === this._zone) return;
|
|
1047
|
+
|
|
1048
|
+
this.state('try', `zone:${value}:${id}`)
|
|
1043
1049
|
try {
|
|
1044
1050
|
this._zone = value;
|
|
1045
|
-
|
|
1046
1051
|
const lookup = this._zones[value]; // set the lookup value
|
|
1047
1052
|
const text = extra ? `${lookup} ${extra}` : lookup; // set the text value
|
|
1048
1053
|
|
|
1049
1054
|
const data = { // build the zone data
|
|
1050
|
-
id
|
|
1055
|
+
id, // set the packetid
|
|
1051
1056
|
agent: this.agent(),
|
|
1052
1057
|
client: this.client(),
|
|
1053
1058
|
key: 'zone',
|
|
@@ -1057,8 +1062,11 @@ class Deva {
|
|
|
1057
1062
|
};
|
|
1058
1063
|
data.hash = this.lib.hash(data);
|
|
1059
1064
|
this.talk(config.events.zone, data);
|
|
1065
|
+
this.state('return', `zone:${value}:${id}`);
|
|
1066
|
+
return data;
|
|
1060
1067
|
} catch (e) {
|
|
1061
|
-
|
|
1068
|
+
this.state('catch', `zone:${value}:${id}`);
|
|
1069
|
+
return this.error(e, value);
|
|
1062
1070
|
}
|
|
1063
1071
|
}
|
|
1064
1072
|
|
|
@@ -1068,10 +1076,11 @@ class Deva {
|
|
|
1068
1076
|
describe: returns a listing of zones currently in the system.
|
|
1069
1077
|
***************/
|
|
1070
1078
|
zones() {
|
|
1071
|
-
this.
|
|
1072
|
-
this.
|
|
1079
|
+
const id = this.lib.uid();
|
|
1080
|
+
this.action('zones', id);
|
|
1081
|
+
this.state('return', `zones:${id}`);
|
|
1073
1082
|
return {
|
|
1074
|
-
id
|
|
1083
|
+
id, // set the uuid of the data
|
|
1075
1084
|
agent: this.agent(), // set the agent value
|
|
1076
1085
|
cleint: this.client(), // set the client value
|
|
1077
1086
|
key: 'zones', // set the key return value
|
|
@@ -1088,6 +1097,8 @@ class Deva {
|
|
|
1088
1097
|
describe
|
|
1089
1098
|
***************/
|
|
1090
1099
|
action(value=false, extra=false) {
|
|
1100
|
+
const id = this.lib.uid();
|
|
1101
|
+
this.state('try', `action:${value}:${id}`);
|
|
1091
1102
|
try {
|
|
1092
1103
|
if (!value || !this._actions[value] || value === this._action) return;
|
|
1093
1104
|
this._action = value; // set the local action variable
|
|
@@ -1098,7 +1109,7 @@ class Deva {
|
|
|
1098
1109
|
const msg = msg_action || action; // set the correct message
|
|
1099
1110
|
const text = extra ? `${msg} ${extra}` : msg; // set the text of the action
|
|
1100
1111
|
const data = { // build the data object for the action.
|
|
1101
|
-
id
|
|
1112
|
+
id, // generate a guid for the action transmitssion.
|
|
1102
1113
|
agent: this.agent(), // the agent data to send with the action
|
|
1103
1114
|
client: this.client(), // the client data to send with the action
|
|
1104
1115
|
key: 'action', // the key for event to transmit action type
|
|
@@ -1108,8 +1119,10 @@ class Deva {
|
|
|
1108
1119
|
};
|
|
1109
1120
|
data.hash = this.lib.hash(data); // generate a hash of the action packet.
|
|
1110
1121
|
this.talk(config.events.action, data); // talk the core action event
|
|
1122
|
+
this.state('return', `action:${value}:${id}`);
|
|
1111
1123
|
return data;
|
|
1112
1124
|
} catch (e) { // catch any errors that occur
|
|
1125
|
+
this.state('catch', `action:${value}:${id}`);
|
|
1113
1126
|
return this.error(e); // return error on error catch
|
|
1114
1127
|
}
|
|
1115
1128
|
}
|
|
@@ -1120,10 +1133,10 @@ class Deva {
|
|
|
1120
1133
|
describe: Returns a list of available actions in the system.
|
|
1121
1134
|
***************/
|
|
1122
1135
|
actions() {
|
|
1123
|
-
this.
|
|
1124
|
-
this.
|
|
1136
|
+
const id = this.lib.uid();
|
|
1137
|
+
this.action('actions', id);
|
|
1125
1138
|
const data = {
|
|
1126
|
-
id
|
|
1139
|
+
id, // set the id with a uuid
|
|
1127
1140
|
agent: this.agent(), // set the agent value
|
|
1128
1141
|
client: this.client(), // set the client value
|
|
1129
1142
|
key: 'actions', // set the data key
|
|
@@ -1131,6 +1144,7 @@ class Deva {
|
|
|
1131
1144
|
created: Date.now(), // set the data created date
|
|
1132
1145
|
};
|
|
1133
1146
|
data.hash = this.lib.hash(data)
|
|
1147
|
+
this.state('return', `actions:${id}`);
|
|
1134
1148
|
return data;
|
|
1135
1149
|
}
|
|
1136
1150
|
|
|
@@ -1142,6 +1156,9 @@ class Deva {
|
|
|
1142
1156
|
describe
|
|
1143
1157
|
***************/
|
|
1144
1158
|
feature(value=false, extra=false) {
|
|
1159
|
+
const id = this.lib.uid();
|
|
1160
|
+
this.action('feature', value);
|
|
1161
|
+
this.state('try', `feature:${value}:${id}`);
|
|
1145
1162
|
try {
|
|
1146
1163
|
if (!value || !this._features[value]) return; // check feature value
|
|
1147
1164
|
|
|
@@ -1149,7 +1166,7 @@ class Deva {
|
|
|
1149
1166
|
const text = extra ? `${lookup} ${extra}` : lookup; // set the text value
|
|
1150
1167
|
|
|
1151
1168
|
const data = { // build data object
|
|
1152
|
-
id
|
|
1169
|
+
id, // set the id
|
|
1153
1170
|
agent: this.agent(), // set the agent transporting the packet.
|
|
1154
1171
|
key: 'feature', // set the key for transport
|
|
1155
1172
|
value, // set the value of the key
|
|
@@ -1158,8 +1175,10 @@ class Deva {
|
|
|
1158
1175
|
};
|
|
1159
1176
|
data.hash = this.lib.hash(data); // generate the hash value of the data packet
|
|
1160
1177
|
this.talk(config.events.feature, data); // talk the feature event with data
|
|
1178
|
+
this.state('return', `feature:${value}:${id}`);
|
|
1161
1179
|
return data;
|
|
1162
1180
|
} catch (e) { // catch any errors
|
|
1181
|
+
this.state('catch', `feature:${value}:${id}`);
|
|
1163
1182
|
return this.error(e); // retun this.error when an error is caught.
|
|
1164
1183
|
}
|
|
1165
1184
|
}
|
|
@@ -1170,9 +1189,10 @@ class Deva {
|
|
|
1170
1189
|
describe: return a list of features that are available to the system.
|
|
1171
1190
|
***************/
|
|
1172
1191
|
features() {
|
|
1173
|
-
this.
|
|
1192
|
+
const id = this.lib.uid();
|
|
1193
|
+
this.action('features', id);
|
|
1174
1194
|
const data = {
|
|
1175
|
-
id
|
|
1195
|
+
id, // set the object id
|
|
1176
1196
|
agent: this.agent(), // set the agent value.
|
|
1177
1197
|
client: this.client(), // set the client value.
|
|
1178
1198
|
key: 'features', // set the key
|
|
@@ -1180,6 +1200,7 @@ class Deva {
|
|
|
1180
1200
|
created: Date.now(), // set the created date.
|
|
1181
1201
|
};
|
|
1182
1202
|
data.hash = this.lib.hash(data);
|
|
1203
|
+
this.state('return', `features:${id}`);
|
|
1183
1204
|
return data;
|
|
1184
1205
|
}
|
|
1185
1206
|
|
|
@@ -1191,16 +1212,18 @@ class Deva {
|
|
|
1191
1212
|
describe
|
|
1192
1213
|
***************/
|
|
1193
1214
|
context(value=false, extra=false) {
|
|
1215
|
+
const id = this.lib.uid();
|
|
1216
|
+
this.action('context', value);
|
|
1194
1217
|
this.state('try', `context:${value}`);
|
|
1195
1218
|
try {
|
|
1196
1219
|
if (!value) return;
|
|
1197
|
-
this.state('set', `context:${value}`);
|
|
1220
|
+
this.state('set', `context:${value}:${id}`);
|
|
1198
1221
|
this._context = value;
|
|
1199
1222
|
const lookup = this.vars.context[value] || value;
|
|
1200
1223
|
const text = extra ? `${lookup} ${extra}` : lookup;
|
|
1201
1224
|
|
|
1202
1225
|
const data = {
|
|
1203
|
-
id
|
|
1226
|
+
id,
|
|
1204
1227
|
agent: this.agent(),
|
|
1205
1228
|
client: this.client(),
|
|
1206
1229
|
key: 'context',
|
|
@@ -1213,7 +1236,7 @@ class Deva {
|
|
|
1213
1236
|
this.state('return', `context:${value}:${data.id}`);
|
|
1214
1237
|
return data;
|
|
1215
1238
|
} catch (e) {
|
|
1216
|
-
this.state('catch', `context:${value}`);
|
|
1239
|
+
this.state('catch', `context:${value}:${id}`);
|
|
1217
1240
|
return this.error(e, value);
|
|
1218
1241
|
}
|
|
1219
1242
|
}
|
|
@@ -1367,7 +1390,7 @@ class Deva {
|
|
|
1367
1390
|
describe: This function will enable fast loading of Deva into the system.
|
|
1368
1391
|
***************/
|
|
1369
1392
|
load(key, client) {
|
|
1370
|
-
this.zone('
|
|
1393
|
+
this.zone('deva', key);
|
|
1371
1394
|
this.action('load', key);
|
|
1372
1395
|
this.state('load', key);
|
|
1373
1396
|
return this.devas[key].init(client);
|
|
@@ -1380,7 +1403,7 @@ class Deva {
|
|
|
1380
1403
|
describe: Unload a currently loaded Deva.
|
|
1381
1404
|
***************/
|
|
1382
1405
|
unload(key) {
|
|
1383
|
-
this.zone('
|
|
1406
|
+
this.zone('deva', key);
|
|
1384
1407
|
return new Promise((resolve, reject) => {
|
|
1385
1408
|
try {
|
|
1386
1409
|
this.action('uload', key);
|
|
@@ -1406,11 +1429,14 @@ class Deva {
|
|
|
1406
1429
|
usage: this.prompt('text')
|
|
1407
1430
|
***************/
|
|
1408
1431
|
prompt(text) {
|
|
1432
|
+
const id = this.lib.uid();
|
|
1433
|
+
this.action('prompt', id);
|
|
1434
|
+
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1409
1435
|
// Talk a global prompt event for the client
|
|
1410
1436
|
const agent = this.agent();
|
|
1411
1437
|
const client = this.client();
|
|
1412
|
-
const
|
|
1413
|
-
id
|
|
1438
|
+
const data = {
|
|
1439
|
+
id,
|
|
1414
1440
|
key: 'prompt',
|
|
1415
1441
|
value: agent.key,
|
|
1416
1442
|
agent,
|
|
@@ -1418,8 +1444,10 @@ class Deva {
|
|
|
1418
1444
|
text,
|
|
1419
1445
|
created: Date.now(),
|
|
1420
1446
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1447
|
+
data.hash = this.lib.hash(data);
|
|
1448
|
+
this.talk(config.events.prompt, data);
|
|
1449
|
+
this.state('return', `prompt:${id}`);
|
|
1450
|
+
return data;
|
|
1423
1451
|
}
|
|
1424
1452
|
|
|
1425
1453
|
/**************
|
|
@@ -1428,11 +1456,16 @@ class Deva {
|
|
|
1428
1456
|
describe: return core data.
|
|
1429
1457
|
***************/
|
|
1430
1458
|
core() {
|
|
1431
|
-
|
|
1459
|
+
const id = this.lib.uid();
|
|
1460
|
+
this.action('core', id);
|
|
1432
1461
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1462
|
+
|
|
1463
|
+
// check the active status
|
|
1433
1464
|
const data = this.lib.copy(this._core);
|
|
1434
|
-
data.id =
|
|
1465
|
+
data.id = id;
|
|
1466
|
+
data.created = Date.now();
|
|
1435
1467
|
data.hash = this.lib.hash(data);
|
|
1468
|
+
this.state('return', `core:${id}`);
|
|
1436
1469
|
return data;
|
|
1437
1470
|
}
|
|
1438
1471
|
|
|
@@ -1442,11 +1475,15 @@ class Deva {
|
|
|
1442
1475
|
describe: return info data.
|
|
1443
1476
|
***************/
|
|
1444
1477
|
info() {
|
|
1445
|
-
|
|
1478
|
+
const id = this.lib.uid();
|
|
1479
|
+
this.action('info', id);
|
|
1446
1480
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1481
|
+
|
|
1447
1482
|
const data = this.lib.copy(this._info);
|
|
1448
|
-
data.id =
|
|
1483
|
+
data.id = id;
|
|
1484
|
+
data.created = Date.now();
|
|
1449
1485
|
data.hash = this.lib.hash(data);
|
|
1486
|
+
this.state('return', `info:${id}`);
|
|
1450
1487
|
return data;
|
|
1451
1488
|
}
|
|
1452
1489
|
|
|
@@ -1462,12 +1499,15 @@ class Deva {
|
|
|
1462
1499
|
usage: this.status('msg')
|
|
1463
1500
|
***************/
|
|
1464
1501
|
status() {
|
|
1502
|
+
const id = this.lib.uid();
|
|
1503
|
+
this.action('status', id);
|
|
1465
1504
|
// check the active status
|
|
1466
1505
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
1467
1506
|
|
|
1468
1507
|
// format the date since active for output.
|
|
1469
1508
|
const dateFormat = this.lib.formatDate(this._active, 'long', true);
|
|
1470
1509
|
// create the text msg string
|
|
1510
|
+
this.state('return', `status:${id}`);
|
|
1471
1511
|
return `${this._agent.profile.name} active since ${dateFormat}`; // return final text string
|
|
1472
1512
|
}
|
|
1473
1513
|
|
|
@@ -1483,28 +1523,32 @@ class Deva {
|
|
|
1483
1523
|
***************/
|
|
1484
1524
|
help(msg, help_dir) {
|
|
1485
1525
|
return new Promise((resolve, reject) => {
|
|
1526
|
+
const id = this.lib.uid();
|
|
1527
|
+
this.context('help', `${msg}:${id}`);
|
|
1528
|
+
this.zone('help', `${msg}:${id}`);
|
|
1529
|
+
this.feature('help', `${msg}:${id}`);
|
|
1530
|
+
this.action('help', `${msg}:${id}`);
|
|
1531
|
+
this.state('help', `${msg}:${id}`);
|
|
1486
1532
|
if (!this._active) return resolve(this._messages.offline);
|
|
1487
1533
|
const params = msg.split(' '); // split the msg into an array by spaces.
|
|
1488
1534
|
let helpFile = 'main'; // set default help file
|
|
1489
1535
|
if (params[0]) helpFile = params[0]; // check the msg for a help file
|
|
1490
1536
|
if (params[1]) helpFile = `${params[0]}_${params[1]}`;
|
|
1491
1537
|
|
|
1492
|
-
this.context('help', helpFile);
|
|
1493
|
-
this.zone('help', helpFile);
|
|
1494
|
-
this.feature('help', helpFile);
|
|
1495
|
-
this.action('help', helpFile);
|
|
1496
|
-
this.state('help', helpFile);
|
|
1497
1538
|
|
|
1498
1539
|
const helpPath = this.lib.path.join(help_dir, 'help', `${helpFile}.feecting`);
|
|
1499
|
-
this.state('try', `help:${
|
|
1540
|
+
this.state('try', `help:${id}`);
|
|
1500
1541
|
try {
|
|
1501
1542
|
const helpExists = this.lib.fs.existsSync(helpPath); // check if help file exists
|
|
1502
|
-
if (!helpExists)
|
|
1543
|
+
if (!helpExists) {
|
|
1544
|
+
this.state('return', `${this._messages.help_not_found}:${id}`);
|
|
1545
|
+
return resolve(this._messages.help_not_found);
|
|
1546
|
+
}
|
|
1503
1547
|
const helpDoc = this.lib.fs.readFileSync(helpPath, 'utf8');
|
|
1504
|
-
this.state('
|
|
1505
|
-
return
|
|
1548
|
+
this.state('return', `help:${id}`);
|
|
1549
|
+
return resolve(helpDoc);
|
|
1506
1550
|
} catch (e) {
|
|
1507
|
-
this.state('catch', `help:${
|
|
1551
|
+
this.state('catch', `help:${id}`);
|
|
1508
1552
|
return this.error(e, msg, reject);
|
|
1509
1553
|
}
|
|
1510
1554
|
});
|
|
@@ -1521,12 +1565,16 @@ class Deva {
|
|
|
1521
1565
|
usage: this.error(err, data, reject);
|
|
1522
1566
|
***************/
|
|
1523
1567
|
error(err,data=false,reject=false) {
|
|
1524
|
-
this.
|
|
1525
|
-
this.
|
|
1568
|
+
const id = this.lib.uid();
|
|
1569
|
+
this.context('error', id);
|
|
1570
|
+
this.zone('error', id);
|
|
1571
|
+
this.action('error', id);
|
|
1572
|
+
this.state('error', id);
|
|
1573
|
+
|
|
1526
1574
|
const agent = this.agent();
|
|
1527
1575
|
const client = this.client();
|
|
1528
1576
|
const _data = {
|
|
1529
|
-
id
|
|
1577
|
+
id,
|
|
1530
1578
|
key: 'error',
|
|
1531
1579
|
value: agent.key,
|
|
1532
1580
|
agent,
|
|
@@ -1543,7 +1591,7 @@ class Deva {
|
|
|
1543
1591
|
this.talk(config.events.error, this.lib.copy(_data));
|
|
1544
1592
|
const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
|
|
1545
1593
|
|
|
1546
|
-
this.state('error
|
|
1594
|
+
this.state('return', `error:${id}`);
|
|
1547
1595
|
if (hasOnError) return this.onError(err, data, reject);
|
|
1548
1596
|
else return reject ? reject(err) : err;
|
|
1549
1597
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indra.ai/deva",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6",
|
|
4
4
|
"description": "The Deva Core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"copyright": "(c)2025 Quinn Michaels; All rights reserved.",
|
|
@@ -150,7 +150,6 @@
|
|
|
150
150
|
"destroy": "๐ฃ Destroy",
|
|
151
151
|
"write": "๐ Write",
|
|
152
152
|
"save": "๐พ Save",
|
|
153
|
-
"delete": "๐งจ Delete",
|
|
154
153
|
"set": "๐ Set",
|
|
155
154
|
"get": "๐ซด Get",
|
|
156
155
|
"put": "๐ค Put",
|
|
@@ -179,37 +178,63 @@
|
|
|
179
178
|
"denied": "๐ Denied",
|
|
180
179
|
"secure": "๐ Secure",
|
|
181
180
|
"try": "๐ธ Try",
|
|
182
|
-
"catch": "โพ๏ธ Catch"
|
|
181
|
+
"catch": "โพ๏ธ Catch",
|
|
182
|
+
"view": "๐ View",
|
|
183
|
+
"insert": "๐ Insert",
|
|
184
|
+
"update": "๐ Update",
|
|
185
|
+
"delete": "๐๏ธ Delete"
|
|
183
186
|
},
|
|
184
187
|
"action": false,
|
|
185
188
|
"actions": {
|
|
189
|
+
"client": "๐จ Client",
|
|
190
|
+
"agent": "๐ต๏ธโโ๏ธ Agent",
|
|
191
|
+
"security": "๐ Security",
|
|
192
|
+
"guard": "๐ Guard",
|
|
193
|
+
"defense": "๐ช Defense",
|
|
194
|
+
"support": "๐ฉน Support",
|
|
195
|
+
"services": "๐ ๏ธ Services",
|
|
196
|
+
"systems": "๐ฅ๏ธ Systems",
|
|
197
|
+
"networks": "๐ก Networks",
|
|
198
|
+
"legal": "๐๏ธ Legal",
|
|
199
|
+
"justice": "๐๏ธ Justice",
|
|
200
|
+
"authority": "๐ฎ Authority",
|
|
201
|
+
"talk": "๐ข Talk",
|
|
202
|
+
"listen": "๐ Listen",
|
|
203
|
+
"once": "๐ Listen Once",
|
|
204
|
+
"ignore": "๐ฆฏ Ignore",
|
|
205
|
+
"question": "๐ Question",
|
|
206
|
+
"answer": "๐ก Answer",
|
|
207
|
+
"ask": "๐ฃ Ask",
|
|
186
208
|
"init": "๐ Init",
|
|
187
|
-
"wait": "โณ Waiting",
|
|
188
209
|
"start": "๐ฌ Start",
|
|
189
210
|
"enter": "๐ก Enter",
|
|
190
|
-
"exit": "๐ช Exit",
|
|
191
|
-
"stop": "๐ Stop",
|
|
192
|
-
"load": "๐ฆ Load",
|
|
193
|
-
"unload": "๐ฅก Unload",
|
|
194
|
-
"finish": "๐ Finish",
|
|
195
|
-
"complete": "โ
Complete",
|
|
196
211
|
"done": "โ๏ธ Done",
|
|
197
212
|
"ready": "๐ข Ready",
|
|
198
|
-
"
|
|
199
|
-
"
|
|
213
|
+
"finish": "๐ Finish",
|
|
214
|
+
"complete": "โ
Complete",
|
|
215
|
+
"stop": "๐ Stop",
|
|
216
|
+
"exit": "๐ช Exit",
|
|
217
|
+
"actions": "๐๏ธ Actions",
|
|
218
|
+
"feature": "๐ฅ Feature",
|
|
219
|
+
"features": "๐ฅ Features",
|
|
200
220
|
"context": "๐ Context",
|
|
221
|
+
"contexts": "๐ Contexts",
|
|
222
|
+
"method": "โค๏ธโ๐ฅ Method",
|
|
223
|
+
"func": "๐ฆ Func",
|
|
224
|
+
"zone": "๐ญ Zone",
|
|
225
|
+
"zones": "๐ช Zones",
|
|
226
|
+
"load": "๐ฆ Load",
|
|
227
|
+
"unload": "๐ฅก Unload",
|
|
201
228
|
"prompt": "๐ Prompt",
|
|
229
|
+
"states": "๐ States",
|
|
230
|
+
"core": "๐ Core",
|
|
231
|
+
"info": "๐โโ๏ธ Info",
|
|
232
|
+
"status": "๐ฅ Status",
|
|
233
|
+
"error": "๐ด ERROR!",
|
|
234
|
+
"wait": "โณ Waiting",
|
|
202
235
|
"issue": "๐ซ Issue",
|
|
203
236
|
"find": "๐ Find",
|
|
204
237
|
"parse": "๐๏ธ Parse",
|
|
205
|
-
"view": "๐ View",
|
|
206
|
-
"insert": "๐ Insert",
|
|
207
|
-
"update": "๐ Update",
|
|
208
|
-
"delete": "๐๏ธ Delete",
|
|
209
|
-
"info": "๐โโ๏ธ Information",
|
|
210
|
-
"status": "๐ฅ Status",
|
|
211
|
-
"func": "๐ฆ Function",
|
|
212
|
-
"method": "โค๏ธโ๐ฅ Method",
|
|
213
238
|
"list": "๐ List",
|
|
214
239
|
"reply": "๐ฎ Reply",
|
|
215
240
|
"set": "๐ฝ๏ธ Set",
|
|
@@ -220,32 +245,8 @@
|
|
|
220
245
|
"resolve": "โต๏ธ Resolve",
|
|
221
246
|
"reject": "โ Reject",
|
|
222
247
|
"write": "๐๏ธ Write",
|
|
223
|
-
"question_ask": "๐ฃ๏ธ Asked",
|
|
224
|
-
"question_ask_answer": "๐๏ธ Answered",
|
|
225
|
-
"question_cmd": "๐ช Command",
|
|
226
|
-
"question_answer": "๐ Answer",
|
|
227
|
-
"answer": "๐ก Answer",
|
|
228
|
-
"ask": "๐ฃ Ask",
|
|
229
|
-
"client": "๐จ Client",
|
|
230
|
-
"agent": "๐ต๏ธโโ๏ธ Agent",
|
|
231
|
-
"security": "๐ Security",
|
|
232
|
-
"support": "๐ฉน Support",
|
|
233
|
-
"services": "๐ ๏ธ Services",
|
|
234
|
-
"systems": "๐ฅ๏ธ Systems",
|
|
235
|
-
"networks": "๐ก Networks",
|
|
236
|
-
"legal": "๐๏ธ Legal",
|
|
237
|
-
"justice": "๐๏ธ Justice",
|
|
238
|
-
"authority": "๐ฎ Authority",
|
|
239
|
-
"defense": "๐ช Defense",
|
|
240
248
|
"invalid": "โ Invalid",
|
|
241
|
-
"states": "๐ป States",
|
|
242
|
-
"actions": "๐๏ธ Actions",
|
|
243
|
-
"zones": "Zones",
|
|
244
|
-
"feature": "๐ฅ Feature",
|
|
245
|
-
"features": "๐ฅ Features",
|
|
246
|
-
"contexts": "๐ Contexts",
|
|
247
249
|
"help": "๐ Help",
|
|
248
|
-
"error": "๐ด ERROR!",
|
|
249
250
|
"lawful": "๐ Lawful",
|
|
250
251
|
"unlawful": "๐ฟ Unlawful",
|
|
251
252
|
"audio": "๐ Audio",
|