@indra.ai/deva 1.1.12 → 1.1.13

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.
Files changed (2) hide show
  1. package/index.js +4 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -28,6 +28,7 @@ class Deva {
28
28
  wait: '😵‍💫 WAITING',
29
29
  data: '📀 DATA',
30
30
  ask: '🙋‍♀️ ASK',
31
+ cmd: '📟 COMMAND',
31
32
  question: '🙋‍♂️ QUESTION',
32
33
  answer: '🔮 ANSWER',
33
34
  talk: '🎙️ TALK',
@@ -336,8 +337,6 @@ class Deva {
336
337
  ask(packet) {
337
338
  if (!this._active) return Promise.resolve(this.messages.offline);
338
339
 
339
- this.state('ask');
340
-
341
340
  packet.a = {
342
341
  agent: this.agent || false,
343
342
  client: this.client || false,
@@ -435,12 +434,14 @@ class Deva {
435
434
  // !method param:list:parse for the local agent
436
435
  // if is an ask then we format one way
437
436
  if (isAsk) {
437
+ this.state('ask');
438
438
  params = t_split[1] ? t_split[1].split(':') : false;
439
439
  method = params[0];
440
440
  text = t_split.slice(2).join(' ').trim();
441
441
  key = isAsk;
442
442
  }
443
443
  else if (isCmd) {
444
+ this.state('cmd');
444
445
  params = t_split[1] ? t_split[1].split(':') : false;
445
446
  method = isCmd;
446
447
  text = t_split.slice(1).join(' ').trim()
@@ -472,11 +473,9 @@ class Deva {
472
473
  }
473
474
  // if the user sends a local command '$' then it will ask of the self.
474
475
  else {
476
+ this.state('answer');
475
477
  if (typeof this.methods[method] !== 'function') return resolve(this._methodNotFound(packet));
476
478
  this.methods[method](packet).then(result => {
477
-
478
- this.state('answer');
479
-
480
479
  const text = typeof result === 'object' ? result.text : result;
481
480
  const html = typeof result === 'object' ? result.html : result;
482
481
  const data = typeof result === 'object' ? result.data : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {