@indra.ai/deva 1.1.108 → 1.1.109
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 +140 -155
- package/index.js +25 -58
- package/package.json +1 -1
package/config.json
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"question": "asked a question",
|
|
33
33
|
"answer": "gave an answer",
|
|
34
34
|
"offline": "offline",
|
|
35
|
-
"
|
|
35
|
+
"ready": "ready for tasking",
|
|
36
36
|
"init": "initializing",
|
|
37
37
|
"start": "starting",
|
|
38
38
|
"enter": "entering deva.world",
|
|
@@ -47,52 +47,44 @@
|
|
|
47
47
|
},
|
|
48
48
|
"zone": false,
|
|
49
49
|
"zones": {
|
|
50
|
-
"deva": "Deva Zone",
|
|
51
|
-
"config": "Configuration Zone",
|
|
52
|
-
"features": "Feature Zone",
|
|
53
|
-
"idle": "Idle Zone",
|
|
54
|
-
"training": "Training Zone",
|
|
55
|
-
"school": "School Zone",
|
|
56
|
-
"work": "Work Zone",
|
|
57
|
-
"fun": "Fun Zone",
|
|
58
|
-
"adventure": "Adventure Zone",
|
|
59
|
-
"party": "Party Zone",
|
|
60
|
-
"invalid": "Invalid
|
|
61
|
-
"done": "Done Zone",
|
|
62
|
-
"error": "Error Zone",
|
|
50
|
+
"deva": "The Deva Zone",
|
|
51
|
+
"config": "The Configuration Zone",
|
|
52
|
+
"features": "The Feature Zone",
|
|
53
|
+
"idle": "The Idle Zone",
|
|
54
|
+
"training": "The Training Zone",
|
|
55
|
+
"school": "The School Zone",
|
|
56
|
+
"work": "The Work Zone",
|
|
57
|
+
"fun": "The Fun Zone",
|
|
58
|
+
"adventure": "The Adventure Zone",
|
|
59
|
+
"party": "The Party Zone",
|
|
60
|
+
"invalid": "The Invalid Zone",
|
|
61
|
+
"done": "The Done Zone",
|
|
63
62
|
"help": "Help Zone"
|
|
64
63
|
},
|
|
65
64
|
"action": false,
|
|
66
65
|
"actions": {
|
|
67
|
-
"wait": "
|
|
68
|
-
"help": "
|
|
69
|
-
"start": "
|
|
70
|
-
"enter": "
|
|
71
|
-
"exit": "
|
|
72
|
-
"stop": "
|
|
73
|
-
"load": "
|
|
74
|
-
"unload": "
|
|
75
|
-
"question": "
|
|
76
|
-
"context": "
|
|
77
|
-
"question_ask": "
|
|
78
|
-
"question_ask_answer": "
|
|
79
|
-
"question_cmd": "
|
|
80
|
-
"question_method": "
|
|
81
|
-
"question_talk": "
|
|
82
|
-
"question_answer": "
|
|
83
|
-
"question_done": "
|
|
84
|
-
"answer": "
|
|
85
|
-
"answer_talk": "
|
|
86
|
-
"ask": "
|
|
87
|
-
"ask_answer": "
|
|
88
|
-
|
|
89
|
-
"get-today": "::agent.name:: getting the value of today",
|
|
90
|
-
"format-date": "::agent.name:: format date",
|
|
91
|
-
"format-time": "::agent.name:: format time",
|
|
92
|
-
"format-currency": "::agent.name:: format currency",
|
|
93
|
-
"format-percent": "::agent.name:: format percent",
|
|
94
|
-
"trimmer": "::agent.name:: is trimming a word count",
|
|
95
|
-
"dupes": "::agent.name:: is removing duplicates",
|
|
66
|
+
"wait": "waiting",
|
|
67
|
+
"help": "giving help",
|
|
68
|
+
"start": "has started",
|
|
69
|
+
"enter": "has entered deva.world",
|
|
70
|
+
"exit": "has exited deva.world",
|
|
71
|
+
"stop": "stopped",
|
|
72
|
+
"load": "loaded",
|
|
73
|
+
"unload": "unloaded",
|
|
74
|
+
"question": "received a question",
|
|
75
|
+
"context": "context change",
|
|
76
|
+
"question_ask": "asked a question",
|
|
77
|
+
"question_ask_answer": "answered the ask",
|
|
78
|
+
"question_cmd": "command",
|
|
79
|
+
"question_method": "method",
|
|
80
|
+
"question_talk": "talk question",
|
|
81
|
+
"question_answer": "answer question",
|
|
82
|
+
"question_done": "question done",
|
|
83
|
+
"answer": "has given an answer",
|
|
84
|
+
"answer_talk": "broadcasted the answer",
|
|
85
|
+
"ask": "is being asked a question",
|
|
86
|
+
"ask_answer": "answer ask",
|
|
87
|
+
|
|
96
88
|
"security": "SECURITY",
|
|
97
89
|
"support": "SUPPORT",
|
|
98
90
|
"systems": "SYSTMS",
|
|
@@ -104,28 +96,26 @@
|
|
|
104
96
|
"legal": "LEGAL",
|
|
105
97
|
"assistant": "ASSISTANT",
|
|
106
98
|
"artist": "ARTIST",
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"contexs": "::agent.name:: Getting contexts",
|
|
128
|
-
"finish": "::agent.name:: finished"
|
|
99
|
+
"Client": "configure client",
|
|
100
|
+
"Security": "configure security",
|
|
101
|
+
"Support": "configure support",
|
|
102
|
+
"Systems": "configure systems",
|
|
103
|
+
"Services": "ocnfigure services",
|
|
104
|
+
"Solutions": "configure solutions",
|
|
105
|
+
"Research": "configure research",
|
|
106
|
+
"Development": "configure development",
|
|
107
|
+
"Legal": "configure legal",
|
|
108
|
+
"Business": "configure business",
|
|
109
|
+
"Assistant": "configure assistant",
|
|
110
|
+
"Artist": "configure artist",
|
|
111
|
+
"Done": "configure done",
|
|
112
|
+
"invalid": "invalid",
|
|
113
|
+
"states": "getting states",
|
|
114
|
+
"actions": "getting actions",
|
|
115
|
+
"zones": "getting zones",
|
|
116
|
+
"features": "Getting features",
|
|
117
|
+
"contexs": "Getting contexts",
|
|
118
|
+
"finish": "finished"
|
|
129
119
|
},
|
|
130
120
|
"feature": false,
|
|
131
121
|
"features": {
|
|
@@ -139,107 +129,104 @@
|
|
|
139
129
|
"business": "Business",
|
|
140
130
|
"legal": "Legal",
|
|
141
131
|
"assistant": "Assistant",
|
|
142
|
-
"artist": "Artist"
|
|
143
|
-
"mind": "Mind"
|
|
132
|
+
"artist": "Artist"
|
|
144
133
|
},
|
|
145
134
|
"message": "offline",
|
|
146
135
|
"messages": {
|
|
147
136
|
"states": {
|
|
148
|
-
"offline": "
|
|
149
|
-
"online": "
|
|
150
|
-
"ask": "
|
|
151
|
-
"question": "
|
|
152
|
-
"answer": "
|
|
153
|
-
"init": "
|
|
154
|
-
"start": "
|
|
155
|
-
"enter": "
|
|
156
|
-
"stop": "
|
|
157
|
-
"exit": "
|
|
158
|
-
"load": "
|
|
159
|
-
"unload": "
|
|
160
|
-
"invalid": "
|
|
161
|
-
"finish": "
|
|
162
|
-
"done": "
|
|
163
|
-
"error": "
|
|
164
|
-
"help": "
|
|
137
|
+
"offline": "offline",
|
|
138
|
+
"online": "online",
|
|
139
|
+
"ask": "asked a question",
|
|
140
|
+
"question": "received a question",
|
|
141
|
+
"answer": "answered the question",
|
|
142
|
+
"init": "initializing",
|
|
143
|
+
"start": "starting",
|
|
144
|
+
"enter": "has entered deva.world",
|
|
145
|
+
"stop": "stopping",
|
|
146
|
+
"exit": "has exited deva.world",
|
|
147
|
+
"load": "loading",
|
|
148
|
+
"unload": "is unloading",
|
|
149
|
+
"invalid": "seems to be invalid",
|
|
150
|
+
"finish": "finish state",
|
|
151
|
+
"done": "done",
|
|
152
|
+
"error": "appears to have had an error",
|
|
153
|
+
"help": "getting help"
|
|
165
154
|
},
|
|
166
155
|
"zones": {
|
|
167
|
-
"deva": "
|
|
168
|
-
"config": "
|
|
169
|
-
"features": "
|
|
170
|
-
"idle": "
|
|
171
|
-
"training": "
|
|
172
|
-
"school": "
|
|
173
|
-
"work": "
|
|
174
|
-
"danger": "
|
|
175
|
-
"invalid": "
|
|
176
|
-
"done": "
|
|
177
|
-
"error": "
|
|
178
|
-
"help": "
|
|
156
|
+
"deva": "The Deva Zone",
|
|
157
|
+
"config": "The Config Zone",
|
|
158
|
+
"features": "The Features Zone",
|
|
159
|
+
"idle": "The Idle Zone",
|
|
160
|
+
"training": "The Training Zone",
|
|
161
|
+
"school": "The School Zone",
|
|
162
|
+
"work": "The Work Zone",
|
|
163
|
+
"danger": "The Danger Zone",
|
|
164
|
+
"invalid": "The Invalid Zone",
|
|
165
|
+
"done": "The Done Zone",
|
|
166
|
+
"error": "The Error Zone",
|
|
167
|
+
"help": "The Help Zone"
|
|
179
168
|
},
|
|
180
169
|
"actions": {
|
|
181
|
-
"wait": "
|
|
182
|
-
"start": "
|
|
183
|
-
"enter": "
|
|
184
|
-
"exit": "
|
|
185
|
-
"stop": "
|
|
186
|
-
"load": "
|
|
187
|
-
"unload": "
|
|
188
|
-
"question": "
|
|
189
|
-
"question_ask": "
|
|
190
|
-
"question_ask_answer": "
|
|
191
|
-
"question_cmd": "
|
|
192
|
-
"question_method": "
|
|
193
|
-
"question_talk": "
|
|
194
|
-
"question_answer": "
|
|
195
|
-
"question_done": "
|
|
196
|
-
"answer": "
|
|
197
|
-
"answer_talk": "
|
|
198
|
-
"ask": "
|
|
199
|
-
"ask_answer": "
|
|
170
|
+
"wait": "waiting",
|
|
171
|
+
"start": "started",
|
|
172
|
+
"enter": "entered deva.world",
|
|
173
|
+
"exit": "exited deva.world",
|
|
174
|
+
"stop": "stopped",
|
|
175
|
+
"load": "loaded",
|
|
176
|
+
"unload": "unloaded",
|
|
177
|
+
"question": "received a question",
|
|
178
|
+
"question_ask": "asking another Deva",
|
|
179
|
+
"question_ask_answer": "answered what they were asked",
|
|
180
|
+
"question_cmd": "running a command",
|
|
181
|
+
"question_method": "running a method",
|
|
182
|
+
"question_talk": "broadcasting the question",
|
|
183
|
+
"question_answer": "answered the question",
|
|
184
|
+
"question_done": "the question is done",
|
|
185
|
+
"answer": "generating an answer",
|
|
186
|
+
"answer_talk": "talking an answer",
|
|
187
|
+
"ask": "asking a question",
|
|
188
|
+
"ask_answer": "answering a question",
|
|
200
189
|
|
|
201
|
-
"security": "
|
|
202
|
-
"Security": "
|
|
203
|
-
"support": "
|
|
204
|
-
"Support": "
|
|
205
|
-
"services": "
|
|
206
|
-
"Services": "
|
|
207
|
-
"solutions": "
|
|
208
|
-
"Solutions": "
|
|
209
|
-
"systems": "
|
|
210
|
-
"Systems": "
|
|
211
|
-
"research": "
|
|
212
|
-
"Research": "
|
|
213
|
-
"development": "
|
|
214
|
-
"Development": "
|
|
215
|
-
"business": "
|
|
216
|
-
"Business": "
|
|
217
|
-
"legal": "
|
|
218
|
-
"Legal": "
|
|
219
|
-
"assistant": "
|
|
220
|
-
"Assistant": "
|
|
221
|
-
"artist": "
|
|
222
|
-
"Artist": "
|
|
223
|
-
"
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"
|
|
227
|
-
"
|
|
228
|
-
"
|
|
229
|
-
"
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"
|
|
233
|
-
"
|
|
234
|
-
"features": "::agent.name:: is listing the features",
|
|
235
|
-
"contexts": "::agent.name:: is listing the contexts"
|
|
190
|
+
"security": "accessing the #security feature",
|
|
191
|
+
"Security": "loading the Security Feature",
|
|
192
|
+
"support": "accessing the #support feature",
|
|
193
|
+
"Support": "loading the Support Feature",
|
|
194
|
+
"services": "accessing the #services feature",
|
|
195
|
+
"Services": "loading the Services Feature",
|
|
196
|
+
"solutions": "accessing the #services feature",
|
|
197
|
+
"Solutions": "loading the Services Feature",
|
|
198
|
+
"systems": "accing #systems",
|
|
199
|
+
"Systems": "loading the Systems Feature",
|
|
200
|
+
"research": "accessing the #research feature",
|
|
201
|
+
"Research": "loading the Research Feature",
|
|
202
|
+
"development": "accessing the #development feature",
|
|
203
|
+
"Development": "loading the Development Feature",
|
|
204
|
+
"business": "accessing the #business feature",
|
|
205
|
+
"Business": "loading the Business Feature",
|
|
206
|
+
"legal": "accessing the #legal feature",
|
|
207
|
+
"Legal": "loading the Legal Feature",
|
|
208
|
+
"assistant": "accessing the #assistant feature",
|
|
209
|
+
"Assistant": "loading the Assistant Feature",
|
|
210
|
+
"artist": "accessing the #artist feature",
|
|
211
|
+
"Artist": "loading the Artist Feature",
|
|
212
|
+
"client_data": "configure client data",
|
|
213
|
+
"invalid": "invalid action",
|
|
214
|
+
"finish": "finished",
|
|
215
|
+
"done": "done",
|
|
216
|
+
"error": "error",
|
|
217
|
+
"help": "providing help",
|
|
218
|
+
"states": "listing the states",
|
|
219
|
+
"actions": "listing the actions",
|
|
220
|
+
"zones": "listing the zones",
|
|
221
|
+
"features": "listing the features",
|
|
222
|
+
"contexts": "listing the contexts"
|
|
236
223
|
},
|
|
237
224
|
"features": {
|
|
238
|
-
"security": "
|
|
225
|
+
"security": "accessing #security feature",
|
|
239
226
|
"Security": "Security configure",
|
|
240
|
-
"support": "
|
|
227
|
+
"support": "accessing #support feature",
|
|
241
228
|
"Support": "Support configure",
|
|
242
|
-
"services": "
|
|
229
|
+
"services": "accessing #services feature",
|
|
243
230
|
"Services": "Services configure",
|
|
244
231
|
"solutions": "solutions feature",
|
|
245
232
|
"Solutions": "Solutions configure",
|
|
@@ -257,8 +244,6 @@
|
|
|
257
244
|
"Assistant": "Assistant configure",
|
|
258
245
|
"artist": "artist feature",
|
|
259
246
|
"Artist": "Artist configure",
|
|
260
|
-
"mind": "mind feature",
|
|
261
|
-
"Mind": "Mind configure",
|
|
262
247
|
"invalid": "feature invalid",
|
|
263
248
|
"done": "feature done",
|
|
264
249
|
"error": "feature error"
|
package/index.js
CHANGED
|
@@ -543,7 +543,7 @@ class Deva {
|
|
|
543
543
|
Artist() {
|
|
544
544
|
const _cl = this.client(); // set local client variable
|
|
545
545
|
try {
|
|
546
|
-
if (!this._client.features.artist) return this.
|
|
546
|
+
if (!this._client.features.artist) return this.Done(); // if no artist goto Done
|
|
547
547
|
else {
|
|
548
548
|
this.action('Artist'); // set action to Artist
|
|
549
549
|
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
@@ -557,38 +557,7 @@ class Deva {
|
|
|
557
557
|
personal: artist.devas[this._agent.key], // Client personal features and rules.
|
|
558
558
|
};
|
|
559
559
|
delete this._client.features.artist; // delete artist object from client
|
|
560
|
-
return this.
|
|
561
|
-
}
|
|
562
|
-
} catch (e) {
|
|
563
|
-
return this.error(e); // run error handling if an error is caught
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
/**************
|
|
568
|
-
func: Mind
|
|
569
|
-
params: client: false
|
|
570
|
-
describe:
|
|
571
|
-
The Mind feature sets the correct variables and necessary rules for the
|
|
572
|
-
client presented data.
|
|
573
|
-
***************/
|
|
574
|
-
Mind() {
|
|
575
|
-
const _cl = this.client();
|
|
576
|
-
try {
|
|
577
|
-
if (!_cl.features.mind) return this.Done();
|
|
578
|
-
else {
|
|
579
|
-
this.action('Mind');
|
|
580
|
-
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
581
|
-
const {mind} = features; // set mind from features const
|
|
582
|
-
this._mind = { // set this_mind with data
|
|
583
|
-
id: this.uid(true), // uuid of the mind feature
|
|
584
|
-
client_id: id, // client id for reference
|
|
585
|
-
client_name: profile.name, // client name for personalization
|
|
586
|
-
concerns: mind.concerns, // any concerns for client
|
|
587
|
-
global: mind.global, // the global policies for client
|
|
588
|
-
personal: mind.devas[this._agent.key], // Client personal features and rules.
|
|
589
|
-
};
|
|
590
|
-
delete this._client.features.mind; // delete the mind feature from client data
|
|
591
|
-
return this.Done(); // when complete then move to the done feature.
|
|
560
|
+
return this.Done(); // when done with artist goto Done
|
|
592
561
|
}
|
|
593
562
|
} catch (e) {
|
|
594
563
|
return this.error(e); // run error handling if an error is caught
|
|
@@ -811,13 +780,9 @@ class Deva {
|
|
|
811
780
|
// create a hash for the answer and insert into answer meta.
|
|
812
781
|
packet_answer.meta.hash = this.hash(packet_answer);
|
|
813
782
|
|
|
814
|
-
packet.a = this.copy(packet_answer);
|
|
815
|
-
packet.hash = this.hash(packet); // hash the entire packet.
|
|
816
|
-
|
|
817
|
-
|
|
818
783
|
this.action('answer_talk');
|
|
784
|
+
packet.a = packet_answer;
|
|
819
785
|
this.talk(config.events.answer, this.copy(packet)); // global talk event
|
|
820
|
-
|
|
821
786
|
return this.finish(packet, resolve) // resolve the packet to the caller.
|
|
822
787
|
}).catch(err => { // catch any errors in the method
|
|
823
788
|
return this.error(err, packet, reject); // return this.error with err, packet, reject
|
|
@@ -847,7 +812,7 @@ class Deva {
|
|
|
847
812
|
const agent = this.agent();
|
|
848
813
|
const client = this.client();
|
|
849
814
|
// build the answer packet from this model
|
|
850
|
-
|
|
815
|
+
const packet_answer = {
|
|
851
816
|
id: this.uid(),
|
|
852
817
|
agent,
|
|
853
818
|
client,
|
|
@@ -874,14 +839,16 @@ class Deva {
|
|
|
874
839
|
// the response based on the passed through packet.
|
|
875
840
|
this.methods[packet.q.meta.method](packet).then(result => {
|
|
876
841
|
if (typeof result === 'object') {
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
842
|
+
packet_answer.text = result.text || false;
|
|
843
|
+
packet_answer.html = result.html || false;
|
|
844
|
+
packet_answer.data = result.data || false;
|
|
880
845
|
}
|
|
881
846
|
else {
|
|
882
|
-
|
|
847
|
+
packet_answer.text = result;
|
|
883
848
|
}
|
|
849
|
+
packet_answer.meta.hash = this.hash(packet_answer);
|
|
884
850
|
this.action('ask_answer');
|
|
851
|
+
packet.a = packet_answer;
|
|
885
852
|
this.talk(`${agent.key}:ask:${packet.id}`, packet);
|
|
886
853
|
}).catch(err => {
|
|
887
854
|
this.talk(`${agent.key}:ask:${packet.id}`, {error:err});
|
|
@@ -1013,6 +980,7 @@ class Deva {
|
|
|
1013
980
|
data.hash = this.hash(data);
|
|
1014
981
|
this.action(data.value)
|
|
1015
982
|
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
983
|
+
this.state('online');
|
|
1016
984
|
return hasOnDone ? this.onDone(data) : Promise.resolve(data);
|
|
1017
985
|
}
|
|
1018
986
|
|
|
@@ -1030,6 +998,8 @@ class Deva {
|
|
|
1030
998
|
finish(packet, resolve) {
|
|
1031
999
|
if (!this._active) return Promise.resolve(this._messages.states.offline);
|
|
1032
1000
|
this.action('finish');
|
|
1001
|
+
this.state('online');
|
|
1002
|
+
packet.hash = this.hash(packet);// hash the entire packet before finishing.
|
|
1033
1003
|
const hasOnFinish = this.onFinish && typeof this.onFinish === 'function' ? true : false;
|
|
1034
1004
|
if (hasOnFinish) return this.onFinish(packet, resolve);
|
|
1035
1005
|
else if (resolve) return resolve(packet);
|
|
@@ -1160,21 +1130,21 @@ class Deva {
|
|
|
1160
1130
|
- st: The zone flag to set for the Deva that matches to this._zones
|
|
1161
1131
|
describe
|
|
1162
1132
|
***************/
|
|
1163
|
-
zone(
|
|
1133
|
+
zone(value) {
|
|
1164
1134
|
try {
|
|
1165
|
-
if (!this._zones[
|
|
1166
|
-
this._zone =
|
|
1167
|
-
const text = this._messages.zones[
|
|
1168
|
-
const
|
|
1135
|
+
if (!this._zones[value]) return;
|
|
1136
|
+
this._zone = value;
|
|
1137
|
+
const text = this._messages.zones[value];
|
|
1138
|
+
const data = {
|
|
1169
1139
|
id: this.uid(true),
|
|
1170
1140
|
key: 'zone',
|
|
1171
|
-
value
|
|
1172
|
-
agent: this.
|
|
1141
|
+
value,
|
|
1142
|
+
agent: this.agent(),
|
|
1173
1143
|
text,
|
|
1174
1144
|
created: Date.now(),
|
|
1175
1145
|
};
|
|
1176
|
-
|
|
1177
|
-
this.talk(config.events.zone,
|
|
1146
|
+
data.hash = this.hash(data);
|
|
1147
|
+
this.talk(config.events.zone, data);
|
|
1178
1148
|
} catch (e) {
|
|
1179
1149
|
return this.error(e);
|
|
1180
1150
|
}
|
|
@@ -1594,7 +1564,7 @@ class Deva {
|
|
|
1594
1564
|
// this.action('hash');
|
|
1595
1565
|
algo = algo || this._security.hash || 'md5';
|
|
1596
1566
|
const the_hash = createHash(algo);
|
|
1597
|
-
the_hash.update(
|
|
1567
|
+
the_hash.update(JSON.stringify(str));
|
|
1598
1568
|
const _digest = the_hash.digest('base64');
|
|
1599
1569
|
return `${algo}:${_digest}`;
|
|
1600
1570
|
}
|
|
@@ -1759,7 +1729,7 @@ class Deva {
|
|
|
1759
1729
|
- dec: is the number of decimal places to apply to the number.
|
|
1760
1730
|
describe:
|
|
1761
1731
|
***************/
|
|
1762
|
-
|
|
1732
|
+
formatPercent(n, dec=2) {
|
|
1763
1733
|
return parseFloat(n).toFixed(dec) + '%';
|
|
1764
1734
|
}
|
|
1765
1735
|
|
|
@@ -1831,6 +1801,7 @@ class Deva {
|
|
|
1831
1801
|
status(msg=false) {
|
|
1832
1802
|
// check the active status
|
|
1833
1803
|
if (!this._active) return Promise.resolve(this._messages.states.offline);
|
|
1804
|
+
this.action('status');
|
|
1834
1805
|
// format the date since active for output.
|
|
1835
1806
|
const dateFormat = this.formatDate(this._active, 'long', true);
|
|
1836
1807
|
// create the text msg string
|
|
@@ -1852,7 +1823,6 @@ class Deva {
|
|
|
1852
1823
|
help(msg, help_dir) {
|
|
1853
1824
|
return new Promise((resolve, reject) => {
|
|
1854
1825
|
if (!this._active) return resolve(this._messages.states.offline);
|
|
1855
|
-
this.state('help');
|
|
1856
1826
|
this.zone('help');
|
|
1857
1827
|
this.action('help');
|
|
1858
1828
|
const params = msg.split(' ');
|
|
@@ -1863,9 +1833,6 @@ class Deva {
|
|
|
1863
1833
|
try {
|
|
1864
1834
|
return resolve(fs.readFileSync(helpFile, 'utf8'));
|
|
1865
1835
|
} catch (e) {
|
|
1866
|
-
this.action('help');
|
|
1867
|
-
this.zone('help');
|
|
1868
|
-
this.state('help');
|
|
1869
1836
|
return reject(e)
|
|
1870
1837
|
}
|
|
1871
1838
|
});
|