@indra.ai/deva 1.1.107 → 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 -156
- package/index.js +28 -62
- 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",
|
|
@@ -41,59 +41,50 @@
|
|
|
41
41
|
"load": "loading",
|
|
42
42
|
"unload": "unloading",
|
|
43
43
|
"done": "done state",
|
|
44
|
-
"finish": "finish state",
|
|
45
44
|
"invalid": "invalid state",
|
|
46
45
|
"error": "error state",
|
|
47
46
|
"help": "help state"
|
|
48
47
|
},
|
|
49
48
|
"zone": false,
|
|
50
49
|
"zones": {
|
|
51
|
-
"deva": "Deva Zone",
|
|
52
|
-
"config": "Configuration Zone",
|
|
53
|
-
"features": "Feature Zone",
|
|
54
|
-
"idle": "Idle Zone",
|
|
55
|
-
"training": "Training Zone",
|
|
56
|
-
"school": "School Zone",
|
|
57
|
-
"work": "Work Zone",
|
|
58
|
-
"fun": "Fun Zone",
|
|
59
|
-
"adventure": "Adventure Zone",
|
|
60
|
-
"party": "Party Zone",
|
|
61
|
-
"invalid": "Invalid
|
|
62
|
-
"done": "Done Zone",
|
|
63
|
-
"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",
|
|
64
62
|
"help": "Help Zone"
|
|
65
63
|
},
|
|
66
64
|
"action": false,
|
|
67
65
|
"actions": {
|
|
68
|
-
"wait": "
|
|
69
|
-
"help": "
|
|
70
|
-
"start": "
|
|
71
|
-
"enter": "
|
|
72
|
-
"exit": "
|
|
73
|
-
"stop": "
|
|
74
|
-
"load": "
|
|
75
|
-
"unload": "
|
|
76
|
-
"question": "
|
|
77
|
-
"context": "
|
|
78
|
-
"question_ask": "
|
|
79
|
-
"question_ask_answer": "
|
|
80
|
-
"question_cmd": "
|
|
81
|
-
"question_method": "
|
|
82
|
-
"question_talk": "
|
|
83
|
-
"question_answer": "
|
|
84
|
-
"question_done": "
|
|
85
|
-
"answer": "
|
|
86
|
-
"answer_talk": "
|
|
87
|
-
"ask": "
|
|
88
|
-
"ask_answer": "
|
|
89
|
-
|
|
90
|
-
"get-today": "::agent.name:: getting the value of today",
|
|
91
|
-
"format-date": "::agent.name:: format date",
|
|
92
|
-
"format-time": "::agent.name:: format time",
|
|
93
|
-
"format-currency": "::agent.name:: format currency",
|
|
94
|
-
"format-percent": "::agent.name:: format percent",
|
|
95
|
-
"trimmer": "::agent.name:: is trimming a word count",
|
|
96
|
-
"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
|
+
|
|
97
88
|
"security": "SECURITY",
|
|
98
89
|
"support": "SUPPORT",
|
|
99
90
|
"systems": "SYSTMS",
|
|
@@ -105,28 +96,26 @@
|
|
|
105
96
|
"legal": "LEGAL",
|
|
106
97
|
"assistant": "ASSISTANT",
|
|
107
98
|
"artist": "ARTIST",
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"contexs": "::agent.name:: Getting contexts",
|
|
129
|
-
"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"
|
|
130
119
|
},
|
|
131
120
|
"feature": false,
|
|
132
121
|
"features": {
|
|
@@ -140,107 +129,104 @@
|
|
|
140
129
|
"business": "Business",
|
|
141
130
|
"legal": "Legal",
|
|
142
131
|
"assistant": "Assistant",
|
|
143
|
-
"artist": "Artist"
|
|
144
|
-
"mind": "Mind"
|
|
132
|
+
"artist": "Artist"
|
|
145
133
|
},
|
|
146
134
|
"message": "offline",
|
|
147
135
|
"messages": {
|
|
148
136
|
"states": {
|
|
149
|
-
"offline": "
|
|
150
|
-
"online": "
|
|
151
|
-
"ask": "
|
|
152
|
-
"question": "
|
|
153
|
-
"answer": "
|
|
154
|
-
"init": "
|
|
155
|
-
"start": "
|
|
156
|
-
"enter": "
|
|
157
|
-
"stop": "
|
|
158
|
-
"exit": "
|
|
159
|
-
"load": "
|
|
160
|
-
"unload": "
|
|
161
|
-
"invalid": "
|
|
162
|
-
"finish": "
|
|
163
|
-
"done": "
|
|
164
|
-
"error": "
|
|
165
|
-
"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"
|
|
166
154
|
},
|
|
167
155
|
"zones": {
|
|
168
|
-
"deva": "
|
|
169
|
-
"config": "
|
|
170
|
-
"features": "
|
|
171
|
-
"idle": "
|
|
172
|
-
"training": "
|
|
173
|
-
"school": "
|
|
174
|
-
"work": "
|
|
175
|
-
"danger": "
|
|
176
|
-
"invalid": "
|
|
177
|
-
"done": "
|
|
178
|
-
"error": "
|
|
179
|
-
"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"
|
|
180
168
|
},
|
|
181
169
|
"actions": {
|
|
182
|
-
"wait": "
|
|
183
|
-
"start": "
|
|
184
|
-
"enter": "
|
|
185
|
-
"exit": "
|
|
186
|
-
"stop": "
|
|
187
|
-
"load": "
|
|
188
|
-
"unload": "
|
|
189
|
-
"question": "
|
|
190
|
-
"question_ask": "
|
|
191
|
-
"question_ask_answer": "
|
|
192
|
-
"question_cmd": "
|
|
193
|
-
"question_method": "
|
|
194
|
-
"question_talk": "
|
|
195
|
-
"question_answer": "
|
|
196
|
-
"question_done": "
|
|
197
|
-
"answer": "
|
|
198
|
-
"answer_talk": "
|
|
199
|
-
"ask": "
|
|
200
|
-
"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",
|
|
201
189
|
|
|
202
|
-
"security": "
|
|
203
|
-
"Security": "
|
|
204
|
-
"support": "
|
|
205
|
-
"Support": "
|
|
206
|
-
"services": "
|
|
207
|
-
"Services": "
|
|
208
|
-
"solutions": "
|
|
209
|
-
"Solutions": "
|
|
210
|
-
"systems": "
|
|
211
|
-
"Systems": "
|
|
212
|
-
"research": "
|
|
213
|
-
"Research": "
|
|
214
|
-
"development": "
|
|
215
|
-
"Development": "
|
|
216
|
-
"business": "
|
|
217
|
-
"Business": "
|
|
218
|
-
"legal": "
|
|
219
|
-
"Legal": "
|
|
220
|
-
"assistant": "
|
|
221
|
-
"Assistant": "
|
|
222
|
-
"artist": "
|
|
223
|
-
"Artist": "
|
|
224
|
-
"
|
|
225
|
-
"
|
|
226
|
-
"
|
|
227
|
-
"
|
|
228
|
-
"
|
|
229
|
-
"
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"
|
|
233
|
-
"
|
|
234
|
-
"
|
|
235
|
-
"features": "::agent.name:: is listing the features",
|
|
236
|
-
"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"
|
|
237
223
|
},
|
|
238
224
|
"features": {
|
|
239
|
-
"security": "
|
|
225
|
+
"security": "accessing #security feature",
|
|
240
226
|
"Security": "Security configure",
|
|
241
|
-
"support": "
|
|
227
|
+
"support": "accessing #support feature",
|
|
242
228
|
"Support": "Support configure",
|
|
243
|
-
"services": "
|
|
229
|
+
"services": "accessing #services feature",
|
|
244
230
|
"Services": "Services configure",
|
|
245
231
|
"solutions": "solutions feature",
|
|
246
232
|
"Solutions": "Solutions configure",
|
|
@@ -258,8 +244,6 @@
|
|
|
258
244
|
"Assistant": "Assistant configure",
|
|
259
245
|
"artist": "artist feature",
|
|
260
246
|
"Artist": "Artist configure",
|
|
261
|
-
"mind": "mind feature",
|
|
262
|
-
"Mind": "Mind configure",
|
|
263
247
|
"invalid": "feature invalid",
|
|
264
248
|
"done": "feature done",
|
|
265
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,7 +980,8 @@ 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;
|
|
1016
|
-
|
|
983
|
+
this.state('online');
|
|
984
|
+
return hasOnDone ? this.onDone(data) : Promise.resolve(data);
|
|
1017
985
|
}
|
|
1018
986
|
|
|
1019
987
|
/**************
|
|
@@ -1029,8 +997,9 @@ class Deva {
|
|
|
1029
997
|
***************/
|
|
1030
998
|
finish(packet, resolve) {
|
|
1031
999
|
if (!this._active) return Promise.resolve(this._messages.states.offline);
|
|
1032
|
-
this.state('finish');
|
|
1033
1000
|
this.action('finish');
|
|
1001
|
+
this.state('online');
|
|
1002
|
+
packet.hash = this.hash(packet);// hash the entire packet before finishing.
|
|
1034
1003
|
const hasOnFinish = this.onFinish && typeof this.onFinish === 'function' ? true : false;
|
|
1035
1004
|
if (hasOnFinish) return this.onFinish(packet, resolve);
|
|
1036
1005
|
else if (resolve) return resolve(packet);
|
|
@@ -1161,21 +1130,21 @@ class Deva {
|
|
|
1161
1130
|
- st: The zone flag to set for the Deva that matches to this._zones
|
|
1162
1131
|
describe
|
|
1163
1132
|
***************/
|
|
1164
|
-
zone(
|
|
1133
|
+
zone(value) {
|
|
1165
1134
|
try {
|
|
1166
|
-
if (!this._zones[
|
|
1167
|
-
this._zone =
|
|
1168
|
-
const text = this._messages.zones[
|
|
1169
|
-
const
|
|
1135
|
+
if (!this._zones[value]) return;
|
|
1136
|
+
this._zone = value;
|
|
1137
|
+
const text = this._messages.zones[value];
|
|
1138
|
+
const data = {
|
|
1170
1139
|
id: this.uid(true),
|
|
1171
1140
|
key: 'zone',
|
|
1172
|
-
value
|
|
1173
|
-
agent: this.
|
|
1141
|
+
value,
|
|
1142
|
+
agent: this.agent(),
|
|
1174
1143
|
text,
|
|
1175
1144
|
created: Date.now(),
|
|
1176
1145
|
};
|
|
1177
|
-
|
|
1178
|
-
this.talk(config.events.zone,
|
|
1146
|
+
data.hash = this.hash(data);
|
|
1147
|
+
this.talk(config.events.zone, data);
|
|
1179
1148
|
} catch (e) {
|
|
1180
1149
|
return this.error(e);
|
|
1181
1150
|
}
|
|
@@ -1548,7 +1517,7 @@ class Deva {
|
|
|
1548
1517
|
delete this.devas[key];
|
|
1549
1518
|
this.talk(config.events.unload, key);
|
|
1550
1519
|
});
|
|
1551
|
-
return
|
|
1520
|
+
return resolve(this._messages.states.unload);
|
|
1552
1521
|
} catch (e) {
|
|
1553
1522
|
return this.error(e, this.devas[key], reject)
|
|
1554
1523
|
}
|
|
@@ -1595,7 +1564,7 @@ class Deva {
|
|
|
1595
1564
|
// this.action('hash');
|
|
1596
1565
|
algo = algo || this._security.hash || 'md5';
|
|
1597
1566
|
const the_hash = createHash(algo);
|
|
1598
|
-
the_hash.update(
|
|
1567
|
+
the_hash.update(JSON.stringify(str));
|
|
1599
1568
|
const _digest = the_hash.digest('base64');
|
|
1600
1569
|
return `${algo}:${_digest}`;
|
|
1601
1570
|
}
|
|
@@ -1760,7 +1729,7 @@ class Deva {
|
|
|
1760
1729
|
- dec: is the number of decimal places to apply to the number.
|
|
1761
1730
|
describe:
|
|
1762
1731
|
***************/
|
|
1763
|
-
|
|
1732
|
+
formatPercent(n, dec=2) {
|
|
1764
1733
|
return parseFloat(n).toFixed(dec) + '%';
|
|
1765
1734
|
}
|
|
1766
1735
|
|
|
@@ -1832,6 +1801,7 @@ class Deva {
|
|
|
1832
1801
|
status(msg=false) {
|
|
1833
1802
|
// check the active status
|
|
1834
1803
|
if (!this._active) return Promise.resolve(this._messages.states.offline);
|
|
1804
|
+
this.action('status');
|
|
1835
1805
|
// format the date since active for output.
|
|
1836
1806
|
const dateFormat = this.formatDate(this._active, 'long', true);
|
|
1837
1807
|
// create the text msg string
|
|
@@ -1853,7 +1823,6 @@ class Deva {
|
|
|
1853
1823
|
help(msg, help_dir) {
|
|
1854
1824
|
return new Promise((resolve, reject) => {
|
|
1855
1825
|
if (!this._active) return resolve(this._messages.states.offline);
|
|
1856
|
-
this.state('help');
|
|
1857
1826
|
this.zone('help');
|
|
1858
1827
|
this.action('help');
|
|
1859
1828
|
const params = msg.split(' ');
|
|
@@ -1862,11 +1831,8 @@ class Deva {
|
|
|
1862
1831
|
if (params[1]) helpFile = `${params[0]}_${params[1]}`;
|
|
1863
1832
|
helpFile = path.join(help_dir, 'help', `${helpFile}.feecting`);
|
|
1864
1833
|
try {
|
|
1865
|
-
return
|
|
1834
|
+
return resolve(fs.readFileSync(helpFile, 'utf8'));
|
|
1866
1835
|
} catch (e) {
|
|
1867
|
-
this.action('help');
|
|
1868
|
-
this.zone('help');
|
|
1869
|
-
this.state('help');
|
|
1870
1836
|
return reject(e)
|
|
1871
1837
|
}
|
|
1872
1838
|
});
|