@indra.ai/deva 1.2.15 → 1.2.16
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 +32 -28
- package/index.js +26 -19
- package/package.json +1 -1
package/config.json
CHANGED
|
@@ -30,30 +30,30 @@
|
|
|
30
30
|
"context": false,
|
|
31
31
|
"zone": "deva",
|
|
32
32
|
"zones": {
|
|
33
|
-
"deva": "
|
|
34
|
-
"client": "
|
|
35
|
-
"agent": "
|
|
36
|
-
"security": "
|
|
37
|
-
"support": "
|
|
38
|
-
"services": "
|
|
39
|
-
"systems": "
|
|
40
|
-
"legal": "
|
|
41
|
-
"business": "
|
|
42
|
-
"art": "
|
|
43
|
-
"music": "
|
|
44
|
-
"fun": "
|
|
45
|
-
"party": "
|
|
46
|
-
"adventure": "
|
|
47
|
-
"cartoon": "
|
|
48
|
-
"mystery": "
|
|
49
|
-
"fantasy": "
|
|
50
|
-
"romance": "
|
|
51
|
-
"comedy": "
|
|
52
|
-
"drama": "
|
|
53
|
-
"scifi": "
|
|
54
|
-
"finish": "
|
|
55
|
-
"help": "
|
|
56
|
-
"error": "
|
|
33
|
+
"deva": "Deva",
|
|
34
|
+
"client": "Client",
|
|
35
|
+
"agent": "Agent",
|
|
36
|
+
"security": "Security",
|
|
37
|
+
"support": "Support",
|
|
38
|
+
"services": "Services",
|
|
39
|
+
"systems": "Systems",
|
|
40
|
+
"legal": "Legal",
|
|
41
|
+
"business": "Business",
|
|
42
|
+
"art": "Art",
|
|
43
|
+
"music": "Music",
|
|
44
|
+
"fun": "Fun",
|
|
45
|
+
"party": "Party",
|
|
46
|
+
"adventure": "Adventure",
|
|
47
|
+
"cartoon": "Cartoon",
|
|
48
|
+
"mystery": "Mystery",
|
|
49
|
+
"fantasy": "Fantasy",
|
|
50
|
+
"romance": "Romance",
|
|
51
|
+
"comedy": "Comedy",
|
|
52
|
+
"drama": "Drama",
|
|
53
|
+
"scifi": "SciFi",
|
|
54
|
+
"finish": "Finish",
|
|
55
|
+
"help": "Help",
|
|
56
|
+
"error": "Error"
|
|
57
57
|
},
|
|
58
58
|
"state": "offline",
|
|
59
59
|
"states": {
|
|
@@ -75,9 +75,6 @@
|
|
|
75
75
|
"disconnect": "Disconnect",
|
|
76
76
|
"send": "Send",
|
|
77
77
|
"receive": "Receive",
|
|
78
|
-
"return": "Return",
|
|
79
|
-
"resolve": "Resolve",
|
|
80
|
-
"reject": "Reject",
|
|
81
78
|
"init": "Initialize",
|
|
82
79
|
"forward": "Forward",
|
|
83
80
|
"backward": "Backward",
|
|
@@ -91,6 +88,8 @@
|
|
|
91
88
|
"end": "End",
|
|
92
89
|
"load": "Load",
|
|
93
90
|
"unload": "Unload",
|
|
91
|
+
"resolve": "Resolve",
|
|
92
|
+
"reject": "Reject",
|
|
94
93
|
"done": "Done",
|
|
95
94
|
"data": "Data",
|
|
96
95
|
"finish": "Finish",
|
|
@@ -125,6 +124,7 @@
|
|
|
125
124
|
"prompt": "Prompt",
|
|
126
125
|
"issue": "Issue",
|
|
127
126
|
"find": "Find",
|
|
127
|
+
"parse": "Parse",
|
|
128
128
|
"view": "View",
|
|
129
129
|
"insert": "Insert",
|
|
130
130
|
"update": "Update",
|
|
@@ -133,6 +133,9 @@
|
|
|
133
133
|
"status": "Status",
|
|
134
134
|
"func": "Function",
|
|
135
135
|
"list": "List items",
|
|
136
|
+
"reply": "Reply",
|
|
137
|
+
"set": "Set",
|
|
138
|
+
"return": "Return",
|
|
136
139
|
|
|
137
140
|
"question_ask": "Question ask",
|
|
138
141
|
"question_ask_answer": "Question ask answer",
|
|
@@ -183,7 +186,8 @@
|
|
|
183
186
|
"notext": "NO TEXT WAS PROVIDED",
|
|
184
187
|
"nopacket": "NO PACKET WAS PROVIDED",
|
|
185
188
|
"method_not_found": "METHOD NOT FOUND",
|
|
186
|
-
"stop": "Stop Deva."
|
|
189
|
+
"stop": "Stop Deva.",
|
|
190
|
+
"exit": "Exit Deva"
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
193
|
}
|
package/index.js
CHANGED
|
@@ -814,29 +814,27 @@ class Deva {
|
|
|
814
814
|
|
|
815
815
|
If the deva is offline it will return the offline message.
|
|
816
816
|
usage:
|
|
817
|
-
this.stop(
|
|
817
|
+
this.stop()
|
|
818
818
|
***************/
|
|
819
819
|
stop() {
|
|
820
820
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
821
821
|
|
|
822
|
-
this.
|
|
822
|
+
this.action('stop');
|
|
823
823
|
const agent = this.agent();
|
|
824
824
|
const client = this.client();
|
|
825
825
|
|
|
826
826
|
const data = {
|
|
827
827
|
id: this.uid(true),
|
|
828
828
|
key: 'stop',
|
|
829
|
-
value:
|
|
829
|
+
value: this._messages.stop,
|
|
830
830
|
agent,
|
|
831
831
|
client,
|
|
832
|
-
text: this._messages.stop,
|
|
833
832
|
created: Date.now(),
|
|
834
833
|
}
|
|
835
|
-
|
|
836
834
|
data.hash = this.hash(data);
|
|
837
|
-
const hasOnStop = this.onStop && typeof this.onStop === 'function';
|
|
838
835
|
|
|
839
|
-
this.
|
|
836
|
+
this.state('stop');
|
|
837
|
+
const hasOnStop = this.onStop && typeof this.onStop === 'function';
|
|
840
838
|
return hasOnStop ? this.onStop(data) : this.exit(data)
|
|
841
839
|
}
|
|
842
840
|
|
|
@@ -855,25 +853,32 @@ class Deva {
|
|
|
855
853
|
If the deva is offline it will return the offline message.
|
|
856
854
|
usage: this.exit('msg')
|
|
857
855
|
***************/
|
|
858
|
-
exit(
|
|
856
|
+
exit() {
|
|
857
|
+
this.zone('exit');
|
|
859
858
|
this._active = false;
|
|
860
|
-
|
|
861
|
-
|
|
859
|
+
|
|
860
|
+
this.action('exit');
|
|
861
|
+
const agent = this.agent();
|
|
862
|
+
const client = this.client();
|
|
863
|
+
|
|
864
|
+
const data = {
|
|
865
|
+
id: this.uid(true),
|
|
866
|
+
key: 'exit',
|
|
867
|
+
value: this._messages.exit,
|
|
868
|
+
agent,
|
|
869
|
+
client,
|
|
870
|
+
created: Date.now(),
|
|
871
|
+
}
|
|
862
872
|
data.hash = this.hash(data);
|
|
863
873
|
|
|
864
|
-
this.state('exit');
|
|
865
874
|
// clear memory
|
|
866
875
|
this._active = false;
|
|
867
876
|
this._client = false;
|
|
868
877
|
this._security = false;
|
|
869
878
|
this._support = false;
|
|
870
879
|
this._services = false;
|
|
871
|
-
this._business = false;
|
|
872
|
-
this._development = false;
|
|
873
|
-
this._legal = false;
|
|
874
|
-
this._assistant = false;
|
|
875
880
|
|
|
876
|
-
this.
|
|
881
|
+
this.state('exit');
|
|
877
882
|
const hasOnExit = this.onExit && typeof this.onExit === 'function';
|
|
878
883
|
return hasOnExit ? this.onExit(data) : Promise.resolve(data)
|
|
879
884
|
}
|
|
@@ -1005,7 +1010,6 @@ class Deva {
|
|
|
1005
1010
|
describe
|
|
1006
1011
|
***************/
|
|
1007
1012
|
feature(feature) {
|
|
1008
|
-
this.action('feature');
|
|
1009
1013
|
try {
|
|
1010
1014
|
if (!this._features[feature]) return;
|
|
1011
1015
|
this._feature = feature;
|
|
@@ -1041,17 +1045,20 @@ class Deva {
|
|
|
1041
1045
|
- st: The context flag to set for the Deva that matches to this._contexts
|
|
1042
1046
|
describe
|
|
1043
1047
|
***************/
|
|
1044
|
-
context(value=false) {
|
|
1048
|
+
context(value=false, extra=false) {
|
|
1045
1049
|
try {
|
|
1046
1050
|
if (!value) return this._context;
|
|
1047
1051
|
this._context = value;
|
|
1052
|
+
const lookup = this.vars.context[value] || value;
|
|
1053
|
+
const text = extra ? `${lookup} ${extra}` : lookup;
|
|
1054
|
+
|
|
1048
1055
|
const data = {
|
|
1049
1056
|
id: this.uid(true),
|
|
1050
1057
|
key: 'context',
|
|
1051
1058
|
value,
|
|
1052
1059
|
agent: this.agent(),
|
|
1053
1060
|
client: this.client(),
|
|
1054
|
-
text
|
|
1061
|
+
text,
|
|
1055
1062
|
created: Date.now(),
|
|
1056
1063
|
};
|
|
1057
1064
|
data.hash = this.hash(data);
|