@indra.ai/deva 1.1.66 → 1.1.68
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 +12 -11
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -952,12 +952,12 @@ class Deva {
|
|
|
952
952
|
packet.q.meta.hash = this.hash(packet.q, 'sha256');
|
|
953
953
|
|
|
954
954
|
this.action(_action);
|
|
955
|
-
this.talk('devacore:question',
|
|
955
|
+
this.talk('devacore:question', packet); // global question event make sure to copy data.
|
|
956
956
|
|
|
957
957
|
if (isAsk) { // isAsk check if the question isAsk and talk
|
|
958
958
|
this.state('ask');
|
|
959
959
|
// if: isAsk wait for the once event which is key'd to the packet ID for specified responses
|
|
960
|
-
this.talk(`${key}:ask`,
|
|
960
|
+
this.talk(`${key}:ask`, packet);
|
|
961
961
|
this.once(`${key}:ask:${packet.id}`, answer => {
|
|
962
962
|
this.action('question_ask_answer');
|
|
963
963
|
return resolve(answer); // if:isAsk resolve the answer from the call
|
|
@@ -1031,7 +1031,7 @@ class Deva {
|
|
|
1031
1031
|
|
|
1032
1032
|
|
|
1033
1033
|
this.action('answer_talk');
|
|
1034
|
-
this.talk('devacore:answer',
|
|
1034
|
+
this.talk('devacore:answer', packet); // talk the answer with a copy of the data
|
|
1035
1035
|
|
|
1036
1036
|
return resolve(packet); // resolve the packet to the caller.
|
|
1037
1037
|
}).catch(err => { // catch any errors in the method
|
|
@@ -1082,7 +1082,7 @@ class Deva {
|
|
|
1082
1082
|
return setImmediate(() => {
|
|
1083
1083
|
this.action('invalid')
|
|
1084
1084
|
packet.a.text = `INVALID METHOD (${packet.q.meta.method})`;
|
|
1085
|
-
this.talk(`${this._agent.key}:ask:${packet.id}`,
|
|
1085
|
+
this.talk(`${this._agent.key}:ask:${packet.id}`, packet);
|
|
1086
1086
|
});
|
|
1087
1087
|
}
|
|
1088
1088
|
|
|
@@ -1098,7 +1098,7 @@ class Deva {
|
|
|
1098
1098
|
packet.a.text = result;
|
|
1099
1099
|
}
|
|
1100
1100
|
this.action('ask_answer');
|
|
1101
|
-
this.talk(`${this._agent.key}:ask:${packet.id}`,
|
|
1101
|
+
this.talk(`${this._agent.key}:ask:${packet.id}`, packet);
|
|
1102
1102
|
}).catch(err => {
|
|
1103
1103
|
this.action('error');
|
|
1104
1104
|
this.talk(`${this._agent.key}:ask:${packet.id}`, {error:err});
|
|
@@ -1345,7 +1345,7 @@ class Deva {
|
|
|
1345
1345
|
created: Date.now(),
|
|
1346
1346
|
};
|
|
1347
1347
|
_data.hash = this.hash(_data, 'sha256');
|
|
1348
|
-
this.talk('devacore:state',
|
|
1348
|
+
this.talk('devacore:state', _data);
|
|
1349
1349
|
} catch (e) {
|
|
1350
1350
|
return this.error(e);
|
|
1351
1351
|
}
|
|
@@ -1372,7 +1372,7 @@ class Deva {
|
|
|
1372
1372
|
created: Date.now(),
|
|
1373
1373
|
};
|
|
1374
1374
|
_data.hash = this.hash(_data, 'sha256');
|
|
1375
|
-
this.talk('devacore:zone',
|
|
1375
|
+
this.talk('devacore:zone', _data);
|
|
1376
1376
|
} catch (e) {
|
|
1377
1377
|
return this.error(e);
|
|
1378
1378
|
}
|
|
@@ -1399,7 +1399,7 @@ class Deva {
|
|
|
1399
1399
|
created: Date.now(),
|
|
1400
1400
|
};
|
|
1401
1401
|
_data.hash = this.hash(_data, 'sha256');
|
|
1402
|
-
this.talk('devacore:action',
|
|
1402
|
+
this.talk('devacore:action', _data);
|
|
1403
1403
|
} catch (e) {
|
|
1404
1404
|
return this.error(e)
|
|
1405
1405
|
}
|
|
@@ -1426,7 +1426,8 @@ class Deva {
|
|
|
1426
1426
|
created: Date.now(),
|
|
1427
1427
|
};
|
|
1428
1428
|
_data.hash = this.hash(_data, 'sha256');
|
|
1429
|
-
|
|
1429
|
+
console.log('fature --------');
|
|
1430
|
+
this.talk('devacore:feature', _data);
|
|
1430
1431
|
} catch (e) {
|
|
1431
1432
|
return this.error(e);
|
|
1432
1433
|
}
|
|
@@ -1829,7 +1830,7 @@ class Deva {
|
|
|
1829
1830
|
text,
|
|
1830
1831
|
created: Date.now(),
|
|
1831
1832
|
}
|
|
1832
|
-
return this.talk('devacore:prompt',
|
|
1833
|
+
return this.talk('devacore:prompt', _data);
|
|
1833
1834
|
}
|
|
1834
1835
|
|
|
1835
1836
|
|
|
@@ -1967,7 +1968,7 @@ class Deva {
|
|
|
1967
1968
|
data,
|
|
1968
1969
|
created: Date.now(),
|
|
1969
1970
|
}
|
|
1970
|
-
this.talk('devacore:error',
|
|
1971
|
+
this.talk('devacore:error', _data);
|
|
1971
1972
|
|
|
1972
1973
|
const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
|
|
1973
1974
|
if (hasOnError) return this.onError(err, data, reject);
|