@indra.ai/deva 1.1.123 → 1.1.125
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 -0
- package/index.js +20 -17
- package/package.json +1 -1
package/config.json
CHANGED
package/index.js
CHANGED
|
@@ -687,8 +687,8 @@ class Deva {
|
|
|
687
687
|
this.talk(`${key}:ask`, packet);
|
|
688
688
|
this.once(`${key}:ask:${packet.id}`, answer => {
|
|
689
689
|
this.action('question_ask_answer');
|
|
690
|
-
|
|
691
|
-
this.talk(config.events.
|
|
690
|
+
|
|
691
|
+
this.talk(config.events.ask, this.copy(answer));
|
|
692
692
|
return this.finish(answer, resolve); // if:isAsk resolve the answer from the call
|
|
693
693
|
});
|
|
694
694
|
}
|
|
@@ -1140,22 +1140,25 @@ class Deva {
|
|
|
1140
1140
|
***************/
|
|
1141
1141
|
action(action) {
|
|
1142
1142
|
try {
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1143
|
+
this._action = action; // set the local action variable
|
|
1144
|
+
// check local vars for custom actions
|
|
1145
|
+
const var_action = this.vars.actions ? this.vars.actions[action] : false;
|
|
1146
|
+
// check system action messages
|
|
1147
|
+
const msg_action = this._messages.actions[action] || var_action;
|
|
1148
|
+
const text = msg_action || action; // set the text of the action
|
|
1149
|
+
const data = { // build the data object for the action.
|
|
1150
|
+
id: this.uid(true), // generate a guid for the action transmitssion.
|
|
1151
|
+
key: 'action', // the key for event to transmit action type
|
|
1152
|
+
value: action, // the value key which is the action passed
|
|
1153
|
+
agent: this.agent(), // the agent data to send with the action
|
|
1154
|
+
client: this.client(), // the client data to send with the action
|
|
1155
|
+
text, // text of the action to send
|
|
1156
|
+
created: Date.now(), // action time stamp
|
|
1154
1157
|
};
|
|
1155
|
-
data.hash = this.hash(data);
|
|
1156
|
-
this.talk(config.events.action, data);
|
|
1157
|
-
} catch (e) {
|
|
1158
|
-
return this.error(e)
|
|
1158
|
+
data.hash = this.hash(data); // generate a hash of the action packet.
|
|
1159
|
+
this.talk(config.events.action, data); // talk the core action event
|
|
1160
|
+
} catch (e) { // catch any errors that occur
|
|
1161
|
+
return this.error(e); // return error on error catch
|
|
1159
1162
|
}
|
|
1160
1163
|
}
|
|
1161
1164
|
|