@indra.ai/deva 1.1.106 → 1.1.108
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 +25 -41
- package/index.js +31 -99
- package/package.json +1 -1
package/config.json
CHANGED
|
@@ -40,9 +40,8 @@
|
|
|
40
40
|
"exit": "exiting deva.world",
|
|
41
41
|
"load": "loading",
|
|
42
42
|
"unload": "unloading",
|
|
43
|
-
"invalid": "invalid state",
|
|
44
43
|
"done": "done state",
|
|
45
|
-
"
|
|
44
|
+
"invalid": "invalid state",
|
|
46
45
|
"error": "error state",
|
|
47
46
|
"help": "help state"
|
|
48
47
|
},
|
|
@@ -95,68 +94,53 @@
|
|
|
95
94
|
"trimmer": "::agent.name:: is trimming a word count",
|
|
96
95
|
"dupes": "::agent.name:: is removing duplicates",
|
|
97
96
|
"security": "SECURITY",
|
|
98
|
-
"Security": "Security Feature",
|
|
99
97
|
"support": "SUPPORT",
|
|
100
|
-
"Support": "Support Feature",
|
|
101
98
|
"systems": "SYSTMS",
|
|
102
|
-
"Systems": "Systems Feature",
|
|
103
99
|
"services": "SERVICES",
|
|
104
|
-
"Services": "Services Feature",
|
|
105
100
|
"solutions": "SOLUTIONS",
|
|
106
|
-
"Solutions": "Solutions Feature",
|
|
107
101
|
"research": "RESEARCH",
|
|
108
|
-
"Research": "Research Feature",
|
|
109
102
|
"development": "DEVELOPMENT",
|
|
110
|
-
"Development": "Development Feature",
|
|
111
103
|
"business": "BUSINESS",
|
|
112
|
-
"Business": "Business Feature",
|
|
113
104
|
"legal": "LEGAL",
|
|
114
|
-
"Legal": "Legal Feature",
|
|
115
105
|
"assistant": "ASSISTANT",
|
|
116
|
-
"
|
|
117
|
-
"story": "STORY",
|
|
118
|
-
"Story": "Story Feature",
|
|
106
|
+
"artist": "ARTIST",
|
|
119
107
|
"mind": "MIND",
|
|
120
|
-
"
|
|
121
|
-
"
|
|
108
|
+
"Client": "::agent.name:: configure #client",
|
|
109
|
+
"Security": "::agent.name:: configure #security",
|
|
110
|
+
"Support": "::agent.name:: configure #support",
|
|
111
|
+
"Systems": "::agent.name:: configure #systems",
|
|
112
|
+
"Services": "::agent.name:: ocnfigure #services",
|
|
113
|
+
"Solutions": "::agent.name:: configure #solutions",
|
|
114
|
+
"Research": "::agent.name:: configure #research",
|
|
115
|
+
"Development": "::agent.name:: configure #development",
|
|
116
|
+
"Legal": "::agent.name:: configure #legal",
|
|
117
|
+
"Business": "::agent.name:: configure #business",
|
|
118
|
+
"Assistant": "::agent.name:: configure #assistant",
|
|
119
|
+
"Artist": "::agent.name:: configure #artist",
|
|
120
|
+
"Mind": "::agent.name:: configure #mind",
|
|
121
|
+
"Done": "::agent.name:: configure #done",
|
|
122
122
|
"invalid": "::agent.name:: invalid",
|
|
123
|
-
"finish": "::agent.name:: finished",
|
|
124
|
-
"error": "::agent.name:: error",
|
|
125
|
-
"done": "::agent.name:: eone",
|
|
126
123
|
"states": "::agent.name:: getting states",
|
|
127
124
|
"actions": "::agent.name:: getting actions",
|
|
128
125
|
"zones": "::agent.name:: getting zones",
|
|
129
126
|
"features": "::agent.name:: Getting features",
|
|
130
|
-
"contexs": "::agent.name:: Getting contexts"
|
|
127
|
+
"contexs": "::agent.name:: Getting contexts",
|
|
128
|
+
"finish": "::agent.name:: finished"
|
|
131
129
|
},
|
|
132
130
|
"feature": false,
|
|
133
131
|
"features": {
|
|
134
132
|
"security": "Security",
|
|
135
|
-
"Security": "SECURITY Feature",
|
|
136
133
|
"support": "Support",
|
|
137
|
-
"Support": "SUPPORT Feature",
|
|
138
134
|
"services": "Services",
|
|
139
|
-
"Services": "SERVICES",
|
|
140
135
|
"solutions": "Solutions",
|
|
141
|
-
"Solutions": "SOLUTIONS Feature",
|
|
142
136
|
"systems": "Systems",
|
|
143
|
-
"Systems": "SYSTEMS Feature",
|
|
144
137
|
"research": "Research",
|
|
145
|
-
"Research": "RESEARCH Feature",
|
|
146
138
|
"development": "Development",
|
|
147
|
-
"Development": "DEVELOPMENT Feature",
|
|
148
139
|
"business": "Business",
|
|
149
|
-
"Business": "BUSINESS Feature",
|
|
150
140
|
"legal": "Legal",
|
|
151
|
-
"Legal": "LEGAL Feature",
|
|
152
141
|
"assistant": "Assistant",
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"Story": "STORY Feature",
|
|
156
|
-
"mind": "Story",
|
|
157
|
-
"Mind": "MIND Feature",
|
|
158
|
-
"error": "Feature Error",
|
|
159
|
-
"done": "Features Done"
|
|
142
|
+
"artist": "Artist",
|
|
143
|
+
"mind": "Mind"
|
|
160
144
|
},
|
|
161
145
|
"message": "offline",
|
|
162
146
|
"messages": {
|
|
@@ -234,8 +218,8 @@
|
|
|
234
218
|
"Legal": "::agent.name:: is loading the Legal Feature",
|
|
235
219
|
"assistant": "::agent.name:: is accessing the #assistant feature",
|
|
236
220
|
"Assistant": "::agent.name:: is loading the Assistant Feature",
|
|
237
|
-
"
|
|
238
|
-
"
|
|
221
|
+
"artist": "::agent.name:: is accessing the #artist feature",
|
|
222
|
+
"Artist": "::agent.name:: is loading the Artist Feature",
|
|
239
223
|
"mind": "::agent.name:: is accessing the #mind feature",
|
|
240
224
|
"Mind": "::agent.name:: is loading the Mind Feature",
|
|
241
225
|
"client_data": "::agent.name:: configure",
|
|
@@ -271,9 +255,9 @@
|
|
|
271
255
|
"Legal": "Legal configure",
|
|
272
256
|
"assistant": "assistant feature",
|
|
273
257
|
"Assistant": "Assistant configure",
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
"mind": "
|
|
258
|
+
"artist": "artist feature",
|
|
259
|
+
"Artist": "Artist configure",
|
|
260
|
+
"mind": "mind feature",
|
|
277
261
|
"Mind": "Mind configure",
|
|
278
262
|
"invalid": "feature invalid",
|
|
279
263
|
"done": "feature done",
|
package/index.js
CHANGED
|
@@ -26,7 +26,7 @@ class Deva {
|
|
|
26
26
|
this._business = false; // inherited Business features.
|
|
27
27
|
this._legal = false; // inherited Legal features.
|
|
28
28
|
this._assistant = false; // inherited Assistant features.
|
|
29
|
-
this.
|
|
29
|
+
this._artist = false; // inherited artist features.
|
|
30
30
|
this.events = opts.events || new EventEmitter({}); // Event Bus
|
|
31
31
|
this.lib = opts.lib || {}; // used for loading library functions
|
|
32
32
|
this.devas = opts.devas || {}; // Devas which are loaded
|
|
@@ -189,6 +189,7 @@ class Deva {
|
|
|
189
189
|
This will return a not found text string preventing any furhter processing.
|
|
190
190
|
***************/
|
|
191
191
|
_methodNotFound(packet) {
|
|
192
|
+
this.action('invalid');
|
|
192
193
|
packet.a = {
|
|
193
194
|
id: this.uid(),
|
|
194
195
|
agent: this.agent() || false,
|
|
@@ -200,7 +201,6 @@ class Deva {
|
|
|
200
201
|
},
|
|
201
202
|
created: Date.now(),
|
|
202
203
|
};
|
|
203
|
-
this.state('method_not_found');
|
|
204
204
|
return packet;
|
|
205
205
|
}
|
|
206
206
|
|
|
@@ -215,7 +215,7 @@ class Deva {
|
|
|
215
215
|
this.Client = {data}
|
|
216
216
|
***************/
|
|
217
217
|
Client(client) {
|
|
218
|
-
this.action('
|
|
218
|
+
this.action('Client');
|
|
219
219
|
const _client = this.copy(client); // copy the client parameter
|
|
220
220
|
this._client = _client; // set local _client to this scope
|
|
221
221
|
return Promise.resolve();
|
|
@@ -229,7 +229,6 @@ class Deva {
|
|
|
229
229
|
client presented data.
|
|
230
230
|
***************/
|
|
231
231
|
Security() {
|
|
232
|
-
this.feature('Security'); // set feature to Security
|
|
233
232
|
const _cl = this.client(); // set local copy of client data
|
|
234
233
|
try {
|
|
235
234
|
if (!_cl.features.security) return this.Support(); // if no security feature goto Support
|
|
@@ -251,8 +250,6 @@ class Deva {
|
|
|
251
250
|
return this.Support(); // goto Support when done with Security
|
|
252
251
|
}
|
|
253
252
|
} catch (e) {
|
|
254
|
-
this.action('error'); // set the action to error
|
|
255
|
-
this.feature('error'); // set the feature to error
|
|
256
253
|
return this.error(e); // run error handling if an error is caught
|
|
257
254
|
}
|
|
258
255
|
}
|
|
@@ -265,7 +262,6 @@ class Deva {
|
|
|
265
262
|
client presented data.
|
|
266
263
|
***************/
|
|
267
264
|
Support() {
|
|
268
|
-
this.feature('Support'); // set state to support setting
|
|
269
265
|
const _cl = this.client(); // set the local client variable
|
|
270
266
|
try {
|
|
271
267
|
if (!_cl.features.support) return this.Services() // move to Services if no support feature
|
|
@@ -285,8 +281,6 @@ class Deva {
|
|
|
285
281
|
return this.Services(); // when done move to Services
|
|
286
282
|
}
|
|
287
283
|
} catch (e) {
|
|
288
|
-
this.action('error'); // set the action to error
|
|
289
|
-
this.feature('error'); // set the feature to error
|
|
290
284
|
return this.error(e); // run error handling if an error is caught
|
|
291
285
|
}
|
|
292
286
|
}
|
|
@@ -299,7 +293,6 @@ class Deva {
|
|
|
299
293
|
client presented data.
|
|
300
294
|
***************/
|
|
301
295
|
Services() {
|
|
302
|
-
this.feature('Services'); // set state to security setting
|
|
303
296
|
const _cl = this.client(); // set local client
|
|
304
297
|
try {
|
|
305
298
|
if (!_cl.features.services) return this.Systems(); // move to Systems if no Services feature
|
|
@@ -319,8 +312,6 @@ class Deva {
|
|
|
319
312
|
return this.Systems() // go to Systems when done
|
|
320
313
|
}
|
|
321
314
|
} catch (e) {
|
|
322
|
-
this.action('error'); // set the action to error
|
|
323
|
-
this.feature('error'); // set the feature to error
|
|
324
315
|
return this.error(e); // run error handling if an error is caught
|
|
325
316
|
}
|
|
326
317
|
}
|
|
@@ -333,7 +324,6 @@ class Deva {
|
|
|
333
324
|
client presented data.
|
|
334
325
|
***************/
|
|
335
326
|
Systems() {
|
|
336
|
-
this.feature('Systems'); // set state to systems setting
|
|
337
327
|
const _cl = this.client();
|
|
338
328
|
try {
|
|
339
329
|
if (!_cl.features.systems) return this.Solutions(); // move to Solutions if no systems feature
|
|
@@ -353,8 +343,6 @@ class Deva {
|
|
|
353
343
|
return this.Solutions()
|
|
354
344
|
}
|
|
355
345
|
} catch (e) {
|
|
356
|
-
this.action('error'); // set the action to error
|
|
357
|
-
this.feature('error'); // set the feature to error
|
|
358
346
|
return this.error(e); // run error handling if an error is caught
|
|
359
347
|
}
|
|
360
348
|
}
|
|
@@ -367,7 +355,6 @@ class Deva {
|
|
|
367
355
|
client presented data.
|
|
368
356
|
***************/
|
|
369
357
|
Solutions() {
|
|
370
|
-
this.feature('Solutions'); // set state to solutions setting
|
|
371
358
|
const _cl = this.client();
|
|
372
359
|
try {
|
|
373
360
|
if (!_cl.features.solutions) return this.Research(); // moe to research if no solutions
|
|
@@ -387,8 +374,6 @@ class Deva {
|
|
|
387
374
|
return this.Research()
|
|
388
375
|
}
|
|
389
376
|
} catch (e) {
|
|
390
|
-
this.action('error'); // set the action to error
|
|
391
|
-
this.feature('error'); // set the feature to error
|
|
392
377
|
return this.error(e); // run error handling if an error is caught
|
|
393
378
|
}
|
|
394
379
|
}
|
|
@@ -401,7 +386,6 @@ class Deva {
|
|
|
401
386
|
client presented data.
|
|
402
387
|
***************/
|
|
403
388
|
Research() {
|
|
404
|
-
this.feature('Research'); // set state to development setting
|
|
405
389
|
const _cl = this.client(); // set local client variable
|
|
406
390
|
try {
|
|
407
391
|
if (!_cl.features.research) return this.Development(); // if no research goto Business
|
|
@@ -421,8 +405,6 @@ class Deva {
|
|
|
421
405
|
return this.Development(); // goto Development.
|
|
422
406
|
}
|
|
423
407
|
} catch (e) {
|
|
424
|
-
this.action('error'); // set the action to error
|
|
425
|
-
this.feature('error'); // set the feature to error
|
|
426
408
|
return this.error(e); // run error handling if an error is caught
|
|
427
409
|
}
|
|
428
410
|
}
|
|
@@ -435,7 +417,6 @@ class Deva {
|
|
|
435
417
|
client presented data.
|
|
436
418
|
***************/
|
|
437
419
|
Development() {
|
|
438
|
-
this.feature('Development'); // set state to development setting
|
|
439
420
|
const _cl = this.client(); // get hte client data to local variable
|
|
440
421
|
try {
|
|
441
422
|
if (!_cl.features.development) return this.Business(); // if no development goto Business
|
|
@@ -455,8 +436,6 @@ class Deva {
|
|
|
455
436
|
return this.Business(); // goto business when development is done
|
|
456
437
|
}
|
|
457
438
|
} catch (e) {
|
|
458
|
-
this.action('error'); // set the action to error
|
|
459
|
-
this.feature('error'); // set the feature to error
|
|
460
439
|
return this.error(e); // run error handling if an error is caught
|
|
461
440
|
}
|
|
462
441
|
}
|
|
@@ -469,7 +448,6 @@ class Deva {
|
|
|
469
448
|
client presented data.
|
|
470
449
|
***************/
|
|
471
450
|
Business() {
|
|
472
|
-
this.feature('Business'); // set state to business setting
|
|
473
451
|
const _cl = this.client(); // set client into local variable.
|
|
474
452
|
try {
|
|
475
453
|
if (!_cl.features.business) return this.Legal(); // if no business hten goto legal
|
|
@@ -489,8 +467,6 @@ class Deva {
|
|
|
489
467
|
return this.Legal(); // go to Legal when Business is done.
|
|
490
468
|
}
|
|
491
469
|
} catch (e) {
|
|
492
|
-
this.action('error'); // set the action to error
|
|
493
|
-
this.feature('error'); // set the feature to error
|
|
494
470
|
return this.error(e); // run error handling if an error is caught
|
|
495
471
|
}
|
|
496
472
|
}
|
|
@@ -503,7 +479,6 @@ class Deva {
|
|
|
503
479
|
client presented data.
|
|
504
480
|
***************/
|
|
505
481
|
Legal() {
|
|
506
|
-
this.feature('Legal'); // set state to legal setting
|
|
507
482
|
const _cl = this.client(); // set hte local client variable
|
|
508
483
|
try {
|
|
509
484
|
if (!_cl.features.legal) this.Assistant(); // if no legal feature then move to assistant
|
|
@@ -523,8 +498,6 @@ class Deva {
|
|
|
523
498
|
return this.Assistant(); // when done goto Assis
|
|
524
499
|
}
|
|
525
500
|
} catch (e) {
|
|
526
|
-
this.action('error'); // set the action to error
|
|
527
|
-
this.feature('error'); // set the feature to error
|
|
528
501
|
return this.error(e); // run error handling if an error is caught
|
|
529
502
|
}
|
|
530
503
|
}
|
|
@@ -537,10 +510,9 @@ class Deva {
|
|
|
537
510
|
client presented data.
|
|
538
511
|
***************/
|
|
539
512
|
Assistant() {
|
|
540
|
-
this.feature('Assistant'); // set state to assistant setting
|
|
541
513
|
const _cl = this.client(); // set the client into a local variable
|
|
542
514
|
try {
|
|
543
|
-
if (!_cl.features.assistant) return this.
|
|
515
|
+
if (!_cl.features.assistant) return this.Artis(); // if no Assistant then goto Done
|
|
544
516
|
else {
|
|
545
517
|
this.action('Assistant'); // set action to Assistant
|
|
546
518
|
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
@@ -554,45 +526,40 @@ class Deva {
|
|
|
554
526
|
personal: assistant.devas[this._agent.key] // Client personal features and rules.
|
|
555
527
|
};
|
|
556
528
|
delete this._client.features.assistant; // delete the assistant key from client features
|
|
557
|
-
return this.
|
|
529
|
+
return this.Artist(); // when assistant is done goto Artist.
|
|
558
530
|
}
|
|
559
531
|
} catch (e) {
|
|
560
|
-
this.action('error'); // set the action to error
|
|
561
|
-
this.feature('error'); // set the feature to error
|
|
562
532
|
return this.error(e); // run error handling if an error is caught
|
|
563
533
|
}
|
|
564
534
|
}
|
|
565
535
|
|
|
566
536
|
/**************
|
|
567
|
-
func:
|
|
537
|
+
func: Artist
|
|
568
538
|
params: client: false
|
|
569
539
|
describe:
|
|
570
|
-
The
|
|
540
|
+
The Artist feature sets the correct variables and necessary rules for the
|
|
571
541
|
client presented data.
|
|
572
542
|
***************/
|
|
573
|
-
|
|
574
|
-
this.feature('Story'); // set feature to Story
|
|
543
|
+
Artist() {
|
|
575
544
|
const _cl = this.client(); // set local client variable
|
|
576
545
|
try {
|
|
577
|
-
if (!this._client.features.
|
|
546
|
+
if (!this._client.features.artist) return this.Mind(); // if no artist goto Mind
|
|
578
547
|
else {
|
|
579
|
-
this.action('
|
|
548
|
+
this.action('Artist'); // set action to Artist
|
|
580
549
|
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
581
|
-
const {
|
|
582
|
-
this.
|
|
583
|
-
id: this.uid(true), // uuid of the
|
|
550
|
+
const {artist} = features; // set artist from features const
|
|
551
|
+
this._artist = { // set this_artist with data
|
|
552
|
+
id: this.uid(true), // uuid of the artist feature
|
|
584
553
|
client_id: id, // client id for reference
|
|
585
554
|
client_name: profile.name, // client name for personalization
|
|
586
|
-
concerns:
|
|
587
|
-
global:
|
|
588
|
-
personal:
|
|
555
|
+
concerns: artist.concerns, // any concerns for client
|
|
556
|
+
global: artist.global, // the global policies for client
|
|
557
|
+
personal: artist.devas[this._agent.key], // Client personal features and rules.
|
|
589
558
|
};
|
|
590
|
-
delete this._client.features.
|
|
591
|
-
return this.Mind(); // when done with
|
|
559
|
+
delete this._client.features.artist; // delete artist object from client
|
|
560
|
+
return this.Mind(); // when done with artist goto Mind
|
|
592
561
|
}
|
|
593
562
|
} catch (e) {
|
|
594
|
-
this.action('error'); // set the action to error
|
|
595
|
-
this.feature('error'); // set the feature to error
|
|
596
563
|
return this.error(e); // run error handling if an error is caught
|
|
597
564
|
}
|
|
598
565
|
}
|
|
@@ -605,7 +572,6 @@ class Deva {
|
|
|
605
572
|
client presented data.
|
|
606
573
|
***************/
|
|
607
574
|
Mind() {
|
|
608
|
-
this.feature('Mind'); // set state to story setting
|
|
609
575
|
const _cl = this.client();
|
|
610
576
|
try {
|
|
611
577
|
if (!_cl.features.mind) return this.Done();
|
|
@@ -625,8 +591,6 @@ class Deva {
|
|
|
625
591
|
return this.Done(); // when complete then move to the done feature.
|
|
626
592
|
}
|
|
627
593
|
} catch (e) {
|
|
628
|
-
this.action('error'); // set the action to error
|
|
629
|
-
this.feature('error'); // set the feature to error
|
|
630
594
|
return this.error(e); // run error handling if an error is caught
|
|
631
595
|
}
|
|
632
596
|
}
|
|
@@ -640,11 +604,9 @@ class Deva {
|
|
|
640
604
|
return new Promise((resolve, reject) => {
|
|
641
605
|
try {
|
|
642
606
|
delete this._client.features; // delete the features key when done.
|
|
643
|
-
this.action('
|
|
644
|
-
this.feature('done'); // set state to assistant setting
|
|
607
|
+
this.action('Done'); // set state to assistant setting
|
|
645
608
|
return resolve(); // resolve an empty pr
|
|
646
609
|
} catch (e) {
|
|
647
|
-
this.feature('error')
|
|
648
610
|
return this.error(e, false, reject);
|
|
649
611
|
}
|
|
650
612
|
});
|
|
@@ -714,10 +676,9 @@ class Deva {
|
|
|
714
676
|
question(TEXT=false, DATA=false) {
|
|
715
677
|
// check the active status
|
|
716
678
|
if (!this._active) return Promise.resolve(this._messages.states.offline);
|
|
679
|
+
this.state('question');
|
|
717
680
|
const id = this.uid(); // generate a unique id for transport.
|
|
718
681
|
const t_split = TEXT.split(' '); // split the text on spaces to get words.
|
|
719
|
-
this.state('question');
|
|
720
|
-
this.action('question', id);
|
|
721
682
|
|
|
722
683
|
// check to see if the string is an #ask string to talk to the other Deva.
|
|
723
684
|
const isAsk = t_split[0].startsWith(this.askChr);
|
|
@@ -744,7 +705,7 @@ class Deva {
|
|
|
744
705
|
if (!TEXT) return this.finish(this._messages.notext, resolve);
|
|
745
706
|
// reject question if Deva offline
|
|
746
707
|
if (!this._active) return this.finish(this._messages.states.offline, resolve);
|
|
747
|
-
let _action = '
|
|
708
|
+
let _action = 'question'
|
|
748
709
|
try { // try to answer the question
|
|
749
710
|
if (isAsk) { // determine if hte question isAsk
|
|
750
711
|
_action = 'question_ask';
|
|
@@ -796,7 +757,6 @@ class Deva {
|
|
|
796
757
|
}
|
|
797
758
|
}
|
|
798
759
|
catch(e) { // try block error trap
|
|
799
|
-
this.action('error');
|
|
800
760
|
return this.error(e); // if a overall error happens this witll call this.error
|
|
801
761
|
}
|
|
802
762
|
});
|
|
@@ -814,13 +774,11 @@ class Deva {
|
|
|
814
774
|
***************/
|
|
815
775
|
answer(packet, resolve, reject) {
|
|
816
776
|
if (!this._active) return Promise.resolve(this._messages.states.offline);
|
|
817
|
-
|
|
818
777
|
this.state('answer');
|
|
819
778
|
// check if method exists and is of type function
|
|
820
779
|
const {method,params} = packet.q.meta;
|
|
821
780
|
const isMethod = this.methods[method] && typeof this.methods[method] == 'function';
|
|
822
781
|
if (!isMethod) {
|
|
823
|
-
this.action('invalid')
|
|
824
782
|
return resolve(this._methodNotFound(packet)); // resolve method not found if check if check fails
|
|
825
783
|
}
|
|
826
784
|
// Call the local method to process the question based the extracted parameters
|
|
@@ -862,7 +820,6 @@ class Deva {
|
|
|
862
820
|
|
|
863
821
|
return this.finish(packet, resolve) // resolve the packet to the caller.
|
|
864
822
|
}).catch(err => { // catch any errors in the method
|
|
865
|
-
this.action('error');
|
|
866
823
|
return this.error(err, packet, reject); // return this.error with err, packet, reject
|
|
867
824
|
});
|
|
868
825
|
}
|
|
@@ -927,13 +884,11 @@ class Deva {
|
|
|
927
884
|
this.action('ask_answer');
|
|
928
885
|
this.talk(`${agent.key}:ask:${packet.id}`, packet);
|
|
929
886
|
}).catch(err => {
|
|
930
|
-
this.action('error');
|
|
931
887
|
this.talk(`${agent.key}:ask:${packet.id}`, {error:err});
|
|
932
888
|
return this.error(err, packet);
|
|
933
889
|
})
|
|
934
890
|
}
|
|
935
891
|
catch (e) {
|
|
936
|
-
this.action('error');
|
|
937
892
|
this.talk(`${agent.key}:ask:${packet.id}`, {error:e});
|
|
938
893
|
return this.error(e, packet)
|
|
939
894
|
}
|
|
@@ -1058,7 +1013,7 @@ class Deva {
|
|
|
1058
1013
|
data.hash = this.hash(data);
|
|
1059
1014
|
this.action(data.value)
|
|
1060
1015
|
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
1061
|
-
return hasOnDone ? this.onDone(data) :
|
|
1016
|
+
return hasOnDone ? this.onDone(data) : Promise.resolve(data);
|
|
1062
1017
|
}
|
|
1063
1018
|
|
|
1064
1019
|
/**************
|
|
@@ -1074,7 +1029,6 @@ class Deva {
|
|
|
1074
1029
|
***************/
|
|
1075
1030
|
finish(packet, resolve) {
|
|
1076
1031
|
if (!this._active) return Promise.resolve(this._messages.states.offline);
|
|
1077
|
-
this.state('finish');
|
|
1078
1032
|
this.action('finish');
|
|
1079
1033
|
const hasOnFinish = this.onFinish && typeof this.onFinish === 'function' ? true : false;
|
|
1080
1034
|
if (hasOnFinish) return this.onFinish(packet, resolve);
|
|
@@ -1147,7 +1101,7 @@ class Deva {
|
|
|
1147
1101
|
this._business = false;
|
|
1148
1102
|
this._development = false;
|
|
1149
1103
|
this._legal = false;
|
|
1150
|
-
this.
|
|
1104
|
+
this._artist = false;
|
|
1151
1105
|
|
|
1152
1106
|
this.action(data.value);
|
|
1153
1107
|
const hasOnExit = this.onExit && typeof this.onExit === 'function';
|
|
@@ -1399,8 +1353,6 @@ class Deva {
|
|
|
1399
1353
|
this.action('security'); // set the security state
|
|
1400
1354
|
return this.copy(this._security); // return the security feature
|
|
1401
1355
|
} catch (e) {
|
|
1402
|
-
this.action('error'); // set the security state
|
|
1403
|
-
this.feature('error');
|
|
1404
1356
|
return this.error(e);
|
|
1405
1357
|
}
|
|
1406
1358
|
}
|
|
@@ -1418,8 +1370,6 @@ class Deva {
|
|
|
1418
1370
|
this.action('support');
|
|
1419
1371
|
return this.copy(this._support); // return the support feature
|
|
1420
1372
|
} catch (e) {
|
|
1421
|
-
this.action('error'); // set the services state
|
|
1422
|
-
this.feature('error');
|
|
1423
1373
|
return this.error(e);
|
|
1424
1374
|
}
|
|
1425
1375
|
}
|
|
@@ -1437,8 +1387,6 @@ class Deva {
|
|
|
1437
1387
|
this.action('services'); // set the services state
|
|
1438
1388
|
return this.copy(this._services); // return the services feature
|
|
1439
1389
|
} catch (e) {
|
|
1440
|
-
this.action('error'); // set the services state
|
|
1441
|
-
this.feature('error');
|
|
1442
1390
|
return this.error(e);
|
|
1443
1391
|
}
|
|
1444
1392
|
}
|
|
@@ -1456,8 +1404,6 @@ class Deva {
|
|
|
1456
1404
|
this.action('systems'); // set the systems state
|
|
1457
1405
|
return this.copy(this._systems); // return the systems feature
|
|
1458
1406
|
} catch (e) {
|
|
1459
|
-
this.action('error'); // set the systems state
|
|
1460
|
-
this.feature('error');
|
|
1461
1407
|
return this.error(e)
|
|
1462
1408
|
}
|
|
1463
1409
|
}
|
|
@@ -1475,8 +1421,6 @@ class Deva {
|
|
|
1475
1421
|
this.action('solutions'); // set the solutions state
|
|
1476
1422
|
return this.copy(this._solutions); // return the solutions feature
|
|
1477
1423
|
} catch (e) {
|
|
1478
|
-
this.action('error'); // set the systems state
|
|
1479
|
-
this.feature('error');
|
|
1480
1424
|
return this.error(e);
|
|
1481
1425
|
}
|
|
1482
1426
|
}
|
|
@@ -1493,8 +1437,6 @@ class Deva {
|
|
|
1493
1437
|
this.action('research'); // set the research state
|
|
1494
1438
|
return this.copy(this._research); // return research feature
|
|
1495
1439
|
} catch (e) {
|
|
1496
|
-
this.action('error');
|
|
1497
|
-
this.feature('error');
|
|
1498
1440
|
return this.error(e);
|
|
1499
1441
|
}
|
|
1500
1442
|
}
|
|
@@ -1511,8 +1453,6 @@ class Deva {
|
|
|
1511
1453
|
this.action('development'); // set the development state
|
|
1512
1454
|
return this.copy(this._development); // return development feature
|
|
1513
1455
|
} catch (e) {
|
|
1514
|
-
this.action('error');
|
|
1515
|
-
this.feature('error');
|
|
1516
1456
|
return this.error(e);
|
|
1517
1457
|
}
|
|
1518
1458
|
}
|
|
@@ -1529,8 +1469,6 @@ class Deva {
|
|
|
1529
1469
|
this.action('assistant'); // set the assistant state
|
|
1530
1470
|
return this.copy(this._assistant); // return assistant feature
|
|
1531
1471
|
} catch (e) {
|
|
1532
|
-
this.action('error');
|
|
1533
|
-
this.feature('error');
|
|
1534
1472
|
return this.error(e);
|
|
1535
1473
|
}
|
|
1536
1474
|
}
|
|
@@ -1547,8 +1485,6 @@ class Deva {
|
|
|
1547
1485
|
this.action('business');
|
|
1548
1486
|
return this.copy(this._business); // return business feature
|
|
1549
1487
|
} catch (e) {
|
|
1550
|
-
this.action('error');
|
|
1551
|
-
this.feature('error');
|
|
1552
1488
|
return this.error('error');
|
|
1553
1489
|
}
|
|
1554
1490
|
}
|
|
@@ -1565,26 +1501,22 @@ class Deva {
|
|
|
1565
1501
|
this.action('legal');
|
|
1566
1502
|
return this.copy(this._legal); // return legal feature
|
|
1567
1503
|
} catch (e) {
|
|
1568
|
-
this.action('error');
|
|
1569
|
-
this.feature('error');
|
|
1570
1504
|
return this.error(e);
|
|
1571
1505
|
}
|
|
1572
1506
|
}
|
|
1573
1507
|
|
|
1574
1508
|
/**************
|
|
1575
|
-
func:
|
|
1509
|
+
func: artist
|
|
1576
1510
|
params: opts
|
|
1577
|
-
describe: basic
|
|
1511
|
+
describe: basic artist features available in a Deva.
|
|
1578
1512
|
***************/
|
|
1579
|
-
|
|
1513
|
+
artist(opts) {
|
|
1580
1514
|
if (!this._active) return this._messages.states.offline; // chek the active status
|
|
1581
|
-
this.feature('
|
|
1515
|
+
this.feature('artist'); // set the artist state
|
|
1582
1516
|
try {
|
|
1583
|
-
this.action('
|
|
1584
|
-
return this.
|
|
1517
|
+
this.action('artist');
|
|
1518
|
+
return this.artist(this._artist); // return artist feature
|
|
1585
1519
|
} catch (e) {
|
|
1586
|
-
this.action('error');
|
|
1587
|
-
this.feature('error');
|
|
1588
1520
|
return this.error(e);
|
|
1589
1521
|
}
|
|
1590
1522
|
}
|
|
@@ -1615,7 +1547,7 @@ class Deva {
|
|
|
1615
1547
|
delete this.devas[key];
|
|
1616
1548
|
this.talk(config.events.unload, key);
|
|
1617
1549
|
});
|
|
1618
|
-
return
|
|
1550
|
+
return resolve(this._messages.states.unload);
|
|
1619
1551
|
} catch (e) {
|
|
1620
1552
|
return this.error(e, this.devas[key], reject)
|
|
1621
1553
|
}
|
|
@@ -1929,7 +1861,7 @@ class Deva {
|
|
|
1929
1861
|
if (params[1]) helpFile = `${params[0]}_${params[1]}`;
|
|
1930
1862
|
helpFile = path.join(help_dir, 'help', `${helpFile}.feecting`);
|
|
1931
1863
|
try {
|
|
1932
|
-
return
|
|
1864
|
+
return resolve(fs.readFileSync(helpFile, 'utf8'));
|
|
1933
1865
|
} catch (e) {
|
|
1934
1866
|
this.action('help');
|
|
1935
1867
|
this.zone('help');
|