@indra.ai/deva 1.1.30 → 1.1.31
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/examples/agent.json +61 -3
- package/examples/client.json +0 -2
- package/examples/hello-world.js +16 -40
- package/index.js +285 -276
- package/package.json +2 -2
package/examples/agent.json
CHANGED
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
"DATA": {
|
|
6
6
|
"id": 5380514963421,
|
|
7
7
|
"key": "deva",
|
|
8
|
-
"name": "@Deva",
|
|
9
|
-
"describe": "The Deva interface into deva.world.",
|
|
10
8
|
"prompt": {
|
|
11
9
|
"emoji": "🍏",
|
|
12
10
|
"text": "deva",
|
|
@@ -28,11 +26,71 @@
|
|
|
28
26
|
"speed": 1
|
|
29
27
|
},
|
|
30
28
|
"profile": {
|
|
29
|
+
"name": "Deva",
|
|
30
|
+
"describe": "The Deva interface into deva.world.",
|
|
31
31
|
"emoji": "/public/devas/deva/emoji.png",
|
|
32
32
|
"avatar": "/public/devas/deva/avatar.png",
|
|
33
33
|
"background": "/public/devas/deva/background.png",
|
|
34
|
-
"describe": "The Deva Project",
|
|
35
34
|
"gender": "M"
|
|
35
|
+
},
|
|
36
|
+
"features": {
|
|
37
|
+
"assistant": {
|
|
38
|
+
"label": "🤖ASSISTANT",
|
|
39
|
+
"name": "@ASSISTANT",
|
|
40
|
+
"tag": "#ASSISTANT",
|
|
41
|
+
"loc": "$ASSISTANT"
|
|
42
|
+
},
|
|
43
|
+
"business": {
|
|
44
|
+
"label": "💼BUSINESS",
|
|
45
|
+
"name": "@BUSINESS",
|
|
46
|
+
"tag": "#BUSINESS",
|
|
47
|
+
"loc": "$BUSINESS"
|
|
48
|
+
},
|
|
49
|
+
"legal": {
|
|
50
|
+
"label": "👨⚖️LEGAL",
|
|
51
|
+
"name": "@LEGAL",
|
|
52
|
+
"tag": "#LEGAL",
|
|
53
|
+
"loc": "$LEGAL"
|
|
54
|
+
},
|
|
55
|
+
"development": {
|
|
56
|
+
"label": "👨💻DEVELOPMENT",
|
|
57
|
+
"name": "@DEVELOPMENT",
|
|
58
|
+
"tag": "#DEVELOPMENT",
|
|
59
|
+
"loc": "$DEVELOPMENT"
|
|
60
|
+
},
|
|
61
|
+
"security": {
|
|
62
|
+
"label": "🚨SECURITY",
|
|
63
|
+
"name": "@SECURITY",
|
|
64
|
+
"tag": "#SECURITY",
|
|
65
|
+
"loc": "$SECURITY"
|
|
66
|
+
},
|
|
67
|
+
"support": {
|
|
68
|
+
"label": "🆘SUPPORT",
|
|
69
|
+
"name": "@SUPPORT",
|
|
70
|
+
"tag": "#SUPPORT",
|
|
71
|
+
"loc": "$SUPPORT"
|
|
72
|
+
},
|
|
73
|
+
"services": {
|
|
74
|
+
"label": "📞SERVICES",
|
|
75
|
+
"name": "@SERVICES",
|
|
76
|
+
"tag": "#SERVICES",
|
|
77
|
+
"loc": "$SERVICES"
|
|
78
|
+
},
|
|
79
|
+
"solutions": {
|
|
80
|
+
"label": "💡SOLUTIONS",
|
|
81
|
+
"name": "@SOLUTIONS",
|
|
82
|
+
"tag": "#SOLUTIONS",
|
|
83
|
+
"loc": "$SOLUTIONS"
|
|
84
|
+
},
|
|
85
|
+
"systems": {
|
|
86
|
+
"label": "🔧SYSTEMS",
|
|
87
|
+
"name": "@SOLUTIONS",
|
|
88
|
+
"tag": "#SOLUTIONS",
|
|
89
|
+
"loc": "$SOLUTIONS"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"vars": {
|
|
93
|
+
"hello": "Hellow World"
|
|
36
94
|
}
|
|
37
95
|
}
|
|
38
96
|
}
|
package/examples/client.json
CHANGED
package/examples/hello-world.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Copyright (c)2023 Quinn Michaels
|
|
2
2
|
// Distributed under the MIT software license, see the accompanying
|
|
3
3
|
// file LICENSE.md or http://www.opensource.org/licenses/mit-license.php.
|
|
4
|
-
const client = require('./client.json');
|
|
4
|
+
const client = require('./client.json').DATA;
|
|
5
|
+
const agent = require('./agent.json').DATA;
|
|
5
6
|
|
|
6
7
|
const Deva = require('../index');
|
|
7
8
|
const HelloWorld = new Deva({
|
|
@@ -10,25 +11,12 @@ const HelloWorld = new Deva({
|
|
|
10
11
|
key: 'hello',
|
|
11
12
|
},
|
|
12
13
|
agent: {
|
|
13
|
-
id:
|
|
14
|
-
key:
|
|
15
|
-
prompt:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
voice: {
|
|
21
|
-
speech: 'Alex',
|
|
22
|
-
speed: 1
|
|
23
|
-
},
|
|
24
|
-
profile: {
|
|
25
|
-
name: 'Hello World',
|
|
26
|
-
description: 'The most over complex Hello World in the Universe',
|
|
27
|
-
avatar: '',
|
|
28
|
-
background: '',
|
|
29
|
-
describe: 'Hello World Deva',
|
|
30
|
-
gender: 'N',
|
|
31
|
-
},
|
|
14
|
+
id: agent.id,
|
|
15
|
+
key: agent.key,
|
|
16
|
+
prompt: agent.prompt,
|
|
17
|
+
voice: agent.voice,
|
|
18
|
+
profile: agent.profile,
|
|
19
|
+
features: agent.features,
|
|
32
20
|
translate(input) {
|
|
33
21
|
return input.trim();
|
|
34
22
|
},
|
|
@@ -36,9 +24,7 @@ const HelloWorld = new Deva({
|
|
|
36
24
|
return input.trim();
|
|
37
25
|
}
|
|
38
26
|
},
|
|
39
|
-
vars:
|
|
40
|
-
hello: 'Hello World'
|
|
41
|
-
},
|
|
27
|
+
vars: agent.vars,
|
|
42
28
|
listeners: {
|
|
43
29
|
'hello:state'(packet) {
|
|
44
30
|
// console.log(packet.state);
|
|
@@ -47,13 +33,10 @@ const HelloWorld = new Deva({
|
|
|
47
33
|
console.log(packet.text);
|
|
48
34
|
}
|
|
49
35
|
},
|
|
50
|
-
|
|
36
|
+
devas: {},
|
|
51
37
|
modules: {},
|
|
52
38
|
func: {
|
|
53
|
-
|
|
54
|
-
return Promise.resolve(this._client);
|
|
55
|
-
},
|
|
56
|
-
state(packet) {
|
|
39
|
+
test(packet) {
|
|
57
40
|
const text = this._state
|
|
58
41
|
const id = this.uid();
|
|
59
42
|
const uuid = this.uid(true);
|
|
@@ -75,29 +58,22 @@ const HelloWorld = new Deva({
|
|
|
75
58
|
decipher
|
|
76
59
|
}
|
|
77
60
|
return Promise.resolve({
|
|
78
|
-
text:
|
|
61
|
+
text: packet.a.text,
|
|
79
62
|
data,
|
|
80
63
|
});
|
|
81
64
|
}
|
|
82
65
|
},
|
|
83
66
|
methods: {
|
|
84
|
-
|
|
85
|
-
return this.
|
|
86
|
-
},
|
|
87
|
-
state(packet) {
|
|
88
|
-
return this.func.state(packet);
|
|
67
|
+
test(packet) {
|
|
68
|
+
return this.func.test(packet);
|
|
89
69
|
}
|
|
90
70
|
},
|
|
91
|
-
onError(e, packet) {
|
|
92
|
-
console.log('ERROR\n\n', e);
|
|
93
|
-
}
|
|
94
71
|
});
|
|
95
72
|
|
|
96
|
-
HelloWorld.init(client
|
|
73
|
+
HelloWorld.init(client).then(done => {
|
|
97
74
|
// console.log(done);
|
|
98
|
-
return HelloWorld.question('/
|
|
75
|
+
return HelloWorld.question('/test')
|
|
99
76
|
}).then(answer => {
|
|
100
|
-
console.log(answer.a.text);
|
|
101
77
|
console.log(answer.a.data);
|
|
102
78
|
});
|
|
103
79
|
|
package/index.js
CHANGED
|
@@ -7,7 +7,6 @@ const { createHash, randomUUID, createCipheriv, createDecipheriv, randomBytes }
|
|
|
7
7
|
class Deva {
|
|
8
8
|
constructor(opts) {
|
|
9
9
|
opts = opts || {};
|
|
10
|
-
|
|
11
10
|
this._id = randomUUID(); // the unique id assigned to the agent at load
|
|
12
11
|
this._config = opts.config || {}; // local Config Object
|
|
13
12
|
this._agent = opts.agent || false; // Agent profile object
|
|
@@ -19,6 +18,7 @@ class Deva {
|
|
|
19
18
|
this._services = false; // inherited Service features.
|
|
20
19
|
this._assistant = false; // inherited @Assistant features.
|
|
21
20
|
this._business = false; // inherited @Business features.
|
|
21
|
+
this._development = false; // inherited @Business features.
|
|
22
22
|
this._legal = false; // inherited @Legal features.
|
|
23
23
|
this.events = opts.events || new EventEmitter({}); // Event Bus
|
|
24
24
|
this.lib = opts.lib || {}; // used for loading library functions
|
|
@@ -45,9 +45,10 @@ class Deva {
|
|
|
45
45
|
"lib",
|
|
46
46
|
"_agent"
|
|
47
47
|
];
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
this._features = {
|
|
49
50
|
assistant: {
|
|
50
|
-
label: '
|
|
51
|
+
label: '👤ASSISTANT',
|
|
51
52
|
name: '@ASSISTANT',
|
|
52
53
|
tag: '#ASSISTANT',
|
|
53
54
|
loc: '$ASSISTANT',
|
|
@@ -62,7 +63,7 @@ class Deva {
|
|
|
62
63
|
label: '👨⚖️LEGAL',
|
|
63
64
|
name: '@LEGAL',
|
|
64
65
|
tag: '#LEGAL',
|
|
65
|
-
loc:
|
|
66
|
+
loc:' $LEGAL',
|
|
66
67
|
},
|
|
67
68
|
development: {
|
|
68
69
|
label: '👨💻DEVELOPMENT',
|
|
@@ -96,84 +97,90 @@ class Deva {
|
|
|
96
97
|
},
|
|
97
98
|
systems: {
|
|
98
99
|
label: '🔧SYSTEMS',
|
|
99
|
-
name: '@
|
|
100
|
-
tag: '#
|
|
101
|
-
loc: '$
|
|
102
|
-
}
|
|
103
|
-
}
|
|
100
|
+
name: '@SYSTEMS',
|
|
101
|
+
tag: '#SYSTEMS',
|
|
102
|
+
loc: '$SYSTEMS',
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
this._states = {}; // states object
|
|
106
|
+
this._messages = {}; // messages object
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
/**************
|
|
107
110
|
func: States
|
|
108
|
-
params:
|
|
111
|
+
params: none
|
|
109
112
|
describe:
|
|
110
113
|
The States function builds the list of states with the associated client and
|
|
111
114
|
agent variables in the place holders. This function runs after the Client
|
|
112
115
|
function to ensure that hte messages are personalized to the Client and AGent.
|
|
113
116
|
***************/
|
|
114
|
-
|
|
117
|
+
States() {
|
|
115
118
|
const {
|
|
116
119
|
development, security, services, support,
|
|
117
120
|
systems, solutions, assistant, business, legal
|
|
118
|
-
} = this.
|
|
121
|
+
} = this._features;
|
|
122
|
+
|
|
123
|
+
const cp = this._client.profile;
|
|
124
|
+
const ckey = this._client.key
|
|
125
|
+
const ap = this._agent.profile;
|
|
126
|
+
const akey = this._agent.key;
|
|
119
127
|
|
|
120
|
-
const {_agent, _client} = this;
|
|
121
128
|
const _states = {
|
|
122
|
-
uid: `${security.label}:UID ${
|
|
123
|
-
hash: `${security.label}:HASH ${
|
|
124
|
-
cipher: `${security.label}:CIPHER ${
|
|
125
|
-
decipher: `${security.label}:DECIPHER ${
|
|
126
|
-
offline: `👻 ${
|
|
127
|
-
online: `📡 ${
|
|
128
|
-
config: `📀 ${
|
|
129
|
-
client: `👨💻 ${
|
|
130
|
-
agent: `👨💻 ${
|
|
131
|
-
init: `🚀 ${
|
|
132
|
-
start: `🎬 ${
|
|
133
|
-
enter: `🎪 ${
|
|
134
|
-
stop: `🛑 ${
|
|
135
|
-
exit: `🚪 ${
|
|
136
|
-
done: `🤝 ${
|
|
137
|
-
wait: `😵💫 ${
|
|
138
|
-
data: `📀 ${
|
|
139
|
-
ask: `🙋♀️ ${
|
|
140
|
-
cmd: `📟 ${
|
|
141
|
-
question: `🐵 ${
|
|
142
|
-
ask: `🐵 ${
|
|
143
|
-
talk: `🎙️ ${
|
|
144
|
-
listen: `🎧 ${
|
|
145
|
-
error: `❌ ${
|
|
146
|
-
story: `📓STORY: ${
|
|
147
|
-
development: `${development.label}: ${
|
|
148
|
-
security: `${security.label}: ${
|
|
149
|
-
support: `${support.label}: ${
|
|
150
|
-
services: `${services.label}: ${
|
|
151
|
-
systems: `${systems.label}: ${
|
|
152
|
-
solutions: `${development.label}: ${
|
|
153
|
-
legal: `${legal.label}: ${
|
|
154
|
-
business: `${business.label}: ${
|
|
155
|
-
devas_start: `🧞♂️DEVAS: Starting all the #Devas with ${
|
|
156
|
-
devas_ready: `🧞♂️DEVA:READY The #Devas are #ready and #waiitng for ${
|
|
157
|
-
devas_stop: `🧞♂️DEVA:STOPPING The #Devas are #stopping with ${
|
|
158
|
-
devas_stopped: `🧞♂️DEVA:🛑STOP #Devas and ${
|
|
159
|
-
deva_load: `🧞♂️DEVA:LOADING ${
|
|
160
|
-
deva_loaded: `🧞♂️DEVA:LOADED ${
|
|
161
|
-
deva_unloaded: `🧞♂️DEVAS:UNLOADED ${
|
|
162
|
-
question_me: `❓QUESTION:START ${
|
|
163
|
-
question_default: `🧞♂️QUESTION:ME ${
|
|
164
|
-
question_ask: `🧞QUESTION:ASK ${
|
|
165
|
-
question_asking: `🧞QUESTION:ASK:ANSWER ${
|
|
166
|
-
question_aswering: `🧞QUESTION:ASK:ANSWERING ${
|
|
167
|
-
question_answer: `🔮QUESTION:ANSWER ${
|
|
168
|
-
question_command: `🧞♀️QUESTION:CMD ${
|
|
169
|
-
hash_question: `${security.label}:HASH:QUESTION ${
|
|
170
|
-
hash_ask: `${security.label}:HASH:ASK ${
|
|
171
|
-
hash_answer: `${security.label}:HASH:ANSWER ${
|
|
172
|
-
hash_command: `${security.label}:HASH:COMMAND ${
|
|
173
|
-
hash_packet: `${security.label}:HASH:PACKET ${
|
|
174
|
-
ask_question: `❓QUESTION: ${
|
|
175
|
-
ask_answer: `💡ANSWER: ${
|
|
176
|
-
method_not_found: `${security.label}:ERROR:COMMAND ${
|
|
129
|
+
uid: `${security.label}:UID ${cp.name} made a #uid with ${ap.name}`,
|
|
130
|
+
hash: `${security.label}:HASH ${cp.name} made a #hash with ${ap.name}`,
|
|
131
|
+
cipher: `${security.label}:CIPHER ${cp.name} locked a #cipher with ${ap.name}`,
|
|
132
|
+
decipher: `${security.label}:DECIPHER ${cp.name} unlocked a #cipher with ${ap.name}`,
|
|
133
|
+
offline: `👻 ${ap.name} is offline`,
|
|
134
|
+
online: `📡 ${ap.name} is online`,
|
|
135
|
+
config: `📀 ${ap.name} is checking the config`,
|
|
136
|
+
client: `👨💻 ${ap.name} opened the ${ckey} profile`,
|
|
137
|
+
agent: `👨💻 ${ap.name} is looking at ${akey} profile`,
|
|
138
|
+
init: `🚀 ${ap.name} is initializing for ${cp.name}`,
|
|
139
|
+
start: `🎬 ${ap.name} has started the process for ${cp.name}`,
|
|
140
|
+
enter: `🎪 ${ap.name} is entering the deva.world with ${cp.name}`,
|
|
141
|
+
stop: `🛑 ${ap.name} has stopped for ${cp.name}`,
|
|
142
|
+
exit: `🚪 ${ap.name} found the exit with ${cp.name}`,
|
|
143
|
+
done: `🤝 ${ap.name} is all done time for #offerings 🍫🍌`,
|
|
144
|
+
wait: `😵💫 ${ap.name} waiting for #stuff from ${cp.name}`,
|
|
145
|
+
data: `📀 ${ap.name} is receiving #data for ${cp.name}`,
|
|
146
|
+
ask: `🙋♀️ ${ap.name} is asking a #question from ${cp.name}`,
|
|
147
|
+
cmd: `📟 ${ap.name} entered a #command from ${cp.name}`,
|
|
148
|
+
question: `🐵 ${ap.name} is in #question mode ${cp.name}`,
|
|
149
|
+
ask: `🐵 ${ap.name} is in #ask mode ${cp.name}`,
|
|
150
|
+
talk: `🎙️ ${ap.name} is in #talk mode with ${cp.name}`,
|
|
151
|
+
listen: `🎧 ${ap.name} is in #listening mode with ${cp.name}`,
|
|
152
|
+
error: `❌ ${ap.name} had an error. Let's have @Systems look into that.`,
|
|
153
|
+
story: `📓STORY: ${cp.name} is creating an amazing #story ${cp.name}`,
|
|
154
|
+
development: `${development.label}: ${cp.name} and ${ap.name} need ${development.name} assistance`,
|
|
155
|
+
security: `${security.label}: ${cp.name} and ${ap.name} need ${security.name} assistance`,
|
|
156
|
+
support: `${support.label}: ${cp.name} and ${ap.name} need ${support.name} assistance`,
|
|
157
|
+
services: `${services.label}: ${cp.name} and ${ap.name} need ${services.name} assistance`,
|
|
158
|
+
systems: `${systems.label}: ${cp.name} and ${ap.name} need ${systems.name} assistance`,
|
|
159
|
+
solutions: `${development.label}: ${cp.name} and ${ap.name} need ${development.name} assistance`,
|
|
160
|
+
legal: `${legal.label}: ${cp.name} and ${ap.name} need ${legal.name} assistance`,
|
|
161
|
+
business: `${business.label}: ${cp.name} and ${ap.name} need ${business.name} assistance`,
|
|
162
|
+
devas_start: `🧞♂️DEVAS: Starting all the #Devas with ${cp.name}`,
|
|
163
|
+
devas_ready: `🧞♂️DEVA:READY The #Devas are #ready and #waiitng for ${cp.name} using @${cp.key} #${cp.key} $${cp.key}`,
|
|
164
|
+
devas_stop: `🧞♂️DEVA:STOPPING The #Devas are #stopping with ${cp.name}`,
|
|
165
|
+
devas_stopped: `🧞♂️DEVA:🛑STOP #Devas and ${cp.name} have #stopped, and that means time for #offerings 🍎🍑🍍🧋`,
|
|
166
|
+
deva_load: `🧞♂️DEVA:LOADING ${ap.name} loading for ${cp.name}`,
|
|
167
|
+
deva_loaded: `🧞♂️DEVA:LOADED ${ap.name} loaded for ${cp.name}`,
|
|
168
|
+
deva_unloaded: `🧞♂️DEVAS:UNLOADED ${ap.name} unloaded for ${cp.name}`,
|
|
169
|
+
question_me: `❓QUESTION:START ${cp.name} started with a great #question to ${ap.name}`,
|
|
170
|
+
question_default: `🧞♂️QUESTION:ME ${cp.name} asked a great #question to ${ap.name}`,
|
|
171
|
+
question_ask: `🧞QUESTION:ASK ${ap.name} is pondering what ${cp.name} asked`,
|
|
172
|
+
question_asking: `🧞QUESTION:ASK:ANSWER ${ap.name} is asking another #Deva for ${cp.name}`,
|
|
173
|
+
question_aswering: `🧞QUESTION:ASK:ANSWERING ${ap.name} is answering the #question ${cp.name} asked`,
|
|
174
|
+
question_answer: `🔮QUESTION:ANSWER ${cp.name} received an #ansewr from ${ap.name}`,
|
|
175
|
+
question_command: `🧞♀️QUESTION:CMD ${cp.name} issued a #command to ${ap.name}`,
|
|
176
|
+
hash_question: `${security.label}:HASH:QUESTION ${ap.name} created the #question #hash for ${cp.name}`,
|
|
177
|
+
hash_ask: `${security.label}:HASH:ASK ${ap.name} created the #ask #hash for ${cp.name}`,
|
|
178
|
+
hash_answer: `${security.label}:HASH:ANSWER ${cp.name} #answer #hash with ${ap.name}`,
|
|
179
|
+
hash_command: `${security.label}:HASH:COMMAND ${cp.name} used a #command with ${ap.name}`,
|
|
180
|
+
hash_packet: `${security.label}:HASH:PACKET ${ap.name} created the #packet #hash for ${cp.name}`,
|
|
181
|
+
ask_question: `❓QUESTION: ${cp.name} asked ${ap.name} a great #question`,
|
|
182
|
+
ask_answer: `💡ANSWER: ${cp.name} received a great #answer from ${ap.name}`,
|
|
183
|
+
method_not_found: `${security.label}:ERROR:COMMAND ${cp.name} used a #command while working with ${ap.name}, and may need from ${security.name}`,
|
|
177
184
|
|
|
178
185
|
ready_security: `${security.label}:READY - ${security.name} is ready on ${security.tag} in ${security.loc}`,
|
|
179
186
|
ready_support: `${support.label}:READY - ${support.name} is ready on ${support.tag} in ${support.loc}`,
|
|
@@ -185,44 +192,39 @@ class Deva {
|
|
|
185
192
|
ready_business: `${business.label}:READY - ${business.name} is ready ${business.tag} in ${business.loc}`,
|
|
186
193
|
ready_assistant: `${assistant.label}:READY - ${assistant.name} is ready ${assistant.tag} in ${business.loc}`,
|
|
187
194
|
|
|
188
|
-
alert_security: `${security.label}:ALERT There is an #issue with ${
|
|
189
|
-
alert_support: `${support.label}:ALERT There is an #issue with ${
|
|
190
|
-
alert_services: `${services.label}:ALERT There is an #issue with ${
|
|
191
|
-
alert_solutions: `${solutions.label}:ALERT There is an #issue with ${
|
|
192
|
-
alert_systems: `${systems.label}:ALERT There is an #issue with ${
|
|
193
|
-
alert_development: `${development.label}:ALERT There is an #issue with ${
|
|
194
|
-
alert_assistant: `${assistant.label}:ALERT There is an #issue with ${
|
|
195
|
-
alert_legal: `${legal.label}:ALERT There is an #issue with ${
|
|
196
|
-
alert_business: `${business.label}:ALERT There is an #issue with ${
|
|
197
|
-
|
|
198
|
-
setting_client: `👨CLIENT: ${
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
setting_support: `${
|
|
202
|
-
setting_services: `${services.label}: ${
|
|
203
|
-
setting_systems: `${systems.label}: ${
|
|
204
|
-
setting_solutions: `${solutions.label}: ${
|
|
205
|
-
setting_assistant: `${assistant.label}: ${
|
|
206
|
-
setting_legal: `${legal.label}: ${
|
|
207
|
-
setting_business: `${business.label}: ${
|
|
195
|
+
alert_security: `${security.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
|
|
196
|
+
alert_support: `${support.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
|
|
197
|
+
alert_services: `${services.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
|
|
198
|
+
alert_solutions: `${solutions.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
|
|
199
|
+
alert_systems: `${systems.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
|
|
200
|
+
alert_development: `${development.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
|
|
201
|
+
alert_assistant: `${assistant.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
|
|
202
|
+
alert_legal: `${legal.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
|
|
203
|
+
alert_business: `${business.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
|
|
204
|
+
|
|
205
|
+
setting_client: `👨CLIENT: ${ap.name} is setting #${ckey} for ${cp.name} `,
|
|
206
|
+
setting_security: `${security.label}: ${cp.name} and ${ap.name} are receiving ${security.name} on ${security.tag} in ${security.loc}`,
|
|
207
|
+
setting_development: `${development.label}: ${cp.name} and ${ap.name} are receiving ${development.name} on ${development.tag} in ${development.loc}`,
|
|
208
|
+
setting_support: `${support.label}: ${cp.name} and ${ap.name} are receiving ${support.name} on ${development.tag} in ${development.loc}`,
|
|
209
|
+
setting_services: `${services.label}: ${cp.name} and ${ap.name} are receiving ${services.name} on ${services.tag} in ${services.loc}`,
|
|
210
|
+
setting_systems: `${systems.label}: ${cp.name} and ${ap.name} are receiving ${systems.name} on ${systems.tag} in ${systems.loc}`,
|
|
211
|
+
setting_solutions: `${solutions.label}: ${cp.name} and ${ap.name} are receiving ${solutions.name} on ${solutions.tag} in ${solutions.loc}`,
|
|
212
|
+
setting_assistant: `${assistant.label}: ${cp.name} and ${ap.name} are receiving ${assistant.name} on ${assistant.tag} in ${assistant.loc}`,
|
|
213
|
+
setting_legal: `${legal.label}: ${cp.name} and ${ap.name} are receiving ${legal.name} on ${legal.tag} in ${legal.loc}`,
|
|
214
|
+
setting_business: `${business.label}: ${cp.name} and ${ap.name} are receiving ${business.name} on ${business.tag} in ${business.loc}`,
|
|
215
|
+
setting_done: `✅DONE: FEATURE SETTINGS COMPLETE`,
|
|
208
216
|
}
|
|
209
|
-
|
|
210
|
-
// determine if msgs is an object and then loop the msgs
|
|
211
|
-
if (sts && typeof sts === 'object') for (let x in sts) {
|
|
212
|
-
if (!_states[x]) _states[x] = sts[x]; // new state added if not matching _states
|
|
213
|
-
}
|
|
214
|
-
this._states = _states; // set _states as this._states;
|
|
215
217
|
this._states = _states; // The available states to work with.
|
|
216
218
|
}
|
|
217
219
|
|
|
218
220
|
/**************
|
|
219
221
|
func: Messages
|
|
220
|
-
params:
|
|
222
|
+
params: none
|
|
221
223
|
describe:
|
|
222
224
|
The Messages function builds the system messages, and allows for the
|
|
223
225
|
reloading of system messages when client or agent data changes.
|
|
224
226
|
***************/
|
|
225
|
-
|
|
227
|
+
Messages() {
|
|
226
228
|
// Default system messages
|
|
227
229
|
const _messages = {
|
|
228
230
|
offline: `🙅♂️ ${this._agent.profile.name} offline`,
|
|
@@ -232,16 +234,12 @@ class Deva {
|
|
|
232
234
|
enter: `🖖 ${this._agent.profile.name} enter.`,
|
|
233
235
|
exit: `🚪 ${this._agent.profile.name} exit.`,
|
|
234
236
|
done: `👍 ${this._agent.profile.name} done.`,
|
|
235
|
-
devas_started: '
|
|
236
|
-
devas_stopped: '🛑
|
|
237
|
+
devas_started: '🍪DEVAS: #online and ready for #offerings 🍫🥛🍚🍯🧂',
|
|
238
|
+
devas_stopped: '🛑DEVAS: have stopped',
|
|
237
239
|
notext: `❌ ${this._client.profile.name}, Invalid input.`,
|
|
240
|
+
deval_already_loaded: `That #DEVA is already loaded.`,
|
|
238
241
|
method_not_found: `❌ ${this._client.profile.name} you sure messed that up!`,
|
|
239
242
|
}
|
|
240
|
-
|
|
241
|
-
// determine if msgs is an object and then loop the msgs
|
|
242
|
-
if (msgs && typeof msgs === 'object') for (let x in msgs) {
|
|
243
|
-
if (!_messages[x]) _messages[x] = msgs[x]; // new msg added if not matching _messages
|
|
244
|
-
}
|
|
245
243
|
this._messages = this.copy(_messages); // set a copy of _messages as this._messages;
|
|
246
244
|
}
|
|
247
245
|
|
|
@@ -257,12 +255,19 @@ class Deva {
|
|
|
257
255
|
***************/
|
|
258
256
|
set Client(client) {
|
|
259
257
|
const _client = this.copy(client); // copy the client parameter
|
|
260
|
-
if (_client.states) delete _client.states; // delete states key for client security
|
|
261
|
-
if (_client.messages) delete _client.messages; // delete messages key for client security
|
|
262
|
-
if (_client.featuers) delete _client.features; // delete features key for client security
|
|
263
258
|
this._client = _client; // set local _client to this scope
|
|
264
|
-
|
|
265
|
-
this.
|
|
259
|
+
|
|
260
|
+
this.States() // set the States after the Client
|
|
261
|
+
this.Messages() // set the Messages after the Client
|
|
262
|
+
// this.Support();
|
|
263
|
+
// this.Services();
|
|
264
|
+
// this.Systems();
|
|
265
|
+
// this.Solutions();
|
|
266
|
+
// this.Development();
|
|
267
|
+
// this.Assistant();
|
|
268
|
+
// this.Business();
|
|
269
|
+
// this.Legal();
|
|
270
|
+
// if (_client.featuers) delete _client.features; // delete features key for client security
|
|
266
271
|
}
|
|
267
272
|
|
|
268
273
|
/**************
|
|
@@ -272,14 +277,13 @@ class Deva {
|
|
|
272
277
|
The Security feature sets the correct variables and necessary rules for the
|
|
273
278
|
client presented data.
|
|
274
279
|
***************/
|
|
275
|
-
|
|
280
|
+
Security() {
|
|
276
281
|
try {
|
|
277
|
-
if (!
|
|
282
|
+
if (!this._client.features.security) return this.Support();
|
|
278
283
|
else {
|
|
279
|
-
this.state('setting_security');
|
|
280
|
-
const
|
|
281
|
-
const {
|
|
282
|
-
const {security} = features; // set security from features const
|
|
284
|
+
this.state('setting_security');
|
|
285
|
+
const {id, profile, features} = this._client; // make a copy the clinet data.
|
|
286
|
+
const {security} = features; // make a copy the clinet data.
|
|
283
287
|
this._security = { // set this_security with data
|
|
284
288
|
id: this.uid(true), // uuid of the security feature
|
|
285
289
|
client_id: id, // client id for reference
|
|
@@ -290,9 +294,11 @@ class Deva {
|
|
|
290
294
|
global: security.global, // the global policies for client
|
|
291
295
|
personal: security.devas[this._agent.key] // Client personal features and rules.
|
|
292
296
|
};
|
|
297
|
+
delete this._client.features.security // make a copy the clinet data.
|
|
298
|
+
return this.Support();
|
|
293
299
|
}
|
|
294
300
|
} catch (e) {
|
|
295
|
-
this.error(e
|
|
301
|
+
return this.error(e) // run error handling if an error is caught
|
|
296
302
|
}
|
|
297
303
|
}
|
|
298
304
|
|
|
@@ -303,27 +309,26 @@ class Deva {
|
|
|
303
309
|
The Support feature sets the correct variables and necessary rules for the
|
|
304
310
|
client presented data.
|
|
305
311
|
***************/
|
|
306
|
-
|
|
312
|
+
Support() {
|
|
307
313
|
try {
|
|
308
|
-
if (!
|
|
314
|
+
if (!this._client.features.support) return this.Services()
|
|
309
315
|
else {
|
|
310
316
|
this.state('setting_support'); // set state to support setting
|
|
311
|
-
const
|
|
312
|
-
const {id, features, profile} = _client; // set the local consts from client copy
|
|
317
|
+
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
313
318
|
const {support} = features; // set support from features const
|
|
314
319
|
this._support = { // set this_support with data
|
|
315
320
|
id: this.uid(true), // uuid of the support feature
|
|
316
321
|
client_id: id, // client id for reference
|
|
317
322
|
client_name: profile.name, // client name for personalization
|
|
318
|
-
hash: support.hash, // client preferred hash algorithm
|
|
319
|
-
cipher: support.cipher, // client preferred cipher settings
|
|
320
323
|
concerns: support.concerns, // any concerns for client
|
|
321
324
|
global: support.global, // the global policies for client
|
|
322
325
|
personal: support.devas[this._agent.key] // Client personalSecurity features and rules.
|
|
323
326
|
};
|
|
327
|
+
delete this._client.features.support
|
|
328
|
+
return this.Services();
|
|
324
329
|
}
|
|
325
330
|
} catch (e) {
|
|
326
|
-
this.error(e
|
|
331
|
+
return this.error(e) // run error handling if an error is caught
|
|
327
332
|
}
|
|
328
333
|
}
|
|
329
334
|
|
|
@@ -334,27 +339,26 @@ class Deva {
|
|
|
334
339
|
The Services feature sets the correct variables and necessary rules for the
|
|
335
340
|
client presented data.
|
|
336
341
|
***************/
|
|
337
|
-
|
|
342
|
+
Services() {
|
|
338
343
|
try {
|
|
339
|
-
if (!
|
|
344
|
+
if (!this._client.features.services) return this.Systems();
|
|
340
345
|
else {
|
|
341
|
-
this.state('
|
|
342
|
-
const
|
|
343
|
-
const {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
id: this.uid(true), // uuid of the security feature
|
|
346
|
+
this.state('setting_services'); // set state to security setting
|
|
347
|
+
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
348
|
+
const {services} = features; // set services from features const
|
|
349
|
+
this._services = { // set this_services with data
|
|
350
|
+
id: this.uid(true), // uuid of the services feature
|
|
347
351
|
client_id: id, // client id for reference
|
|
348
352
|
client_name: profile.name, // client name for personalization
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
global: security.global, // the global policies for client
|
|
353
|
-
personal: security.devas[this._agent.key] // Client personal features and rules.
|
|
353
|
+
concerns: services.concerns, // any concerns for client
|
|
354
|
+
global: services.global, // the global policies for client
|
|
355
|
+
personal: services.devas[this._agent.key] // Client personal features and rules.
|
|
354
356
|
};
|
|
357
|
+
delete this._client.features.services
|
|
358
|
+
return this.Systems()
|
|
355
359
|
}
|
|
356
360
|
} catch (e) {
|
|
357
|
-
this.error(e
|
|
361
|
+
return this.error(e) // run error handling if an error is caught
|
|
358
362
|
}
|
|
359
363
|
}
|
|
360
364
|
|
|
@@ -365,27 +369,27 @@ class Deva {
|
|
|
365
369
|
The Systems feature sets the correct variables and necessary rules for the
|
|
366
370
|
client presented data.
|
|
367
371
|
***************/
|
|
368
|
-
|
|
372
|
+
Systems() {
|
|
369
373
|
try {
|
|
370
|
-
if (!
|
|
374
|
+
if (!this._client.features.systems) return this.Solutions();
|
|
371
375
|
else {
|
|
372
|
-
this.state('setting_systems');
|
|
373
|
-
const
|
|
374
|
-
const {
|
|
375
|
-
|
|
376
|
-
this._systems = { // set this_systems with data
|
|
376
|
+
this.state('setting_systems'); // set state to systems setting
|
|
377
|
+
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
378
|
+
const {systems} = features; // set systems from features const
|
|
379
|
+
this._systems = { // set this_systems with data
|
|
377
380
|
id: this.uid(true), // uuid of the systems feature
|
|
378
381
|
client_id: id, // client id for reference
|
|
379
382
|
client_name: profile.name, // client name for personalization
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
global: systems.global, // the global policies for client
|
|
384
|
-
personal: systems.devas[this._agent.key] // Client personal features and rules.
|
|
383
|
+
concerns: systems.concerns, // any concerns for client
|
|
384
|
+
global: systems.global, // the global policies for client
|
|
385
|
+
personal: systems.devas[this._agent.key] // Client personal features and rules.
|
|
385
386
|
};
|
|
387
|
+
delete this._client.features.systems
|
|
388
|
+
return this.Solutions()
|
|
386
389
|
}
|
|
387
390
|
} catch (e) {
|
|
388
|
-
|
|
391
|
+
// run error handling if an error is caught
|
|
392
|
+
return this.error(e)
|
|
389
393
|
}
|
|
390
394
|
}
|
|
391
395
|
|
|
@@ -396,27 +400,26 @@ class Deva {
|
|
|
396
400
|
The Solutions feature sets the correct variables and necessary rules for the
|
|
397
401
|
client presented data.
|
|
398
402
|
***************/
|
|
399
|
-
|
|
403
|
+
Solutions() {
|
|
400
404
|
try {
|
|
401
|
-
if (!
|
|
405
|
+
if (!this._client.features.solutions) return this.Development();
|
|
402
406
|
else {
|
|
403
|
-
this.state('setting_solutions');
|
|
404
|
-
const
|
|
405
|
-
const {
|
|
406
|
-
|
|
407
|
-
this._solutions = { // set this_solutions with data
|
|
407
|
+
this.state('setting_solutions'); // set state to solutions setting
|
|
408
|
+
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
409
|
+
const {solutions} = features; // set solutions from features const
|
|
410
|
+
this._solutions = { // set this_solutions with data
|
|
408
411
|
id: this.uid(true), // uuid of the solutions feature
|
|
409
412
|
client_id: id, // client id for reference
|
|
410
413
|
client_name: profile.name, // client name for personalization
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
global: solutions.global, // the global policies for client
|
|
415
|
-
personal: solutions.devas[this._agent.key] // Client personal features and rules.
|
|
414
|
+
concerns: solutions.concerns, // any concerns for client
|
|
415
|
+
global: solutions.global, // the global policies for client
|
|
416
|
+
personal: solutions.devas[this._agent.key] // Client personal features and rules.
|
|
416
417
|
};
|
|
418
|
+
delete this._client.features.solutions
|
|
419
|
+
return this.Development()
|
|
417
420
|
}
|
|
418
421
|
} catch (e) {
|
|
419
|
-
this.error(e
|
|
422
|
+
return this.error(e) // run error handling if an error is caught
|
|
420
423
|
}
|
|
421
424
|
}
|
|
422
425
|
|
|
@@ -427,123 +430,140 @@ class Deva {
|
|
|
427
430
|
The Development feature sets the correct variables and necessary rules for the
|
|
428
431
|
client presented data.
|
|
429
432
|
***************/
|
|
430
|
-
|
|
433
|
+
Development() {
|
|
431
434
|
try {
|
|
432
|
-
if (!
|
|
435
|
+
if (!this._client.features.development) return this.Business();
|
|
433
436
|
else {
|
|
434
|
-
this.state('setting_development');
|
|
435
|
-
const
|
|
436
|
-
const {
|
|
437
|
-
|
|
438
|
-
this._development = { // set this_development with data
|
|
437
|
+
this.state('setting_development'); // set state to development setting
|
|
438
|
+
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
439
|
+
const {development} = features; // set development from features const
|
|
440
|
+
this._development = { // set this_development with data
|
|
439
441
|
id: this.uid(true), // uuid of the development feature
|
|
440
442
|
client_id: id, // client id for reference
|
|
441
443
|
client_name: profile.name, // client name for personalization
|
|
442
|
-
hash: development.hash,
|
|
443
|
-
cipher: development.cipher,
|
|
444
|
-
concerns: development.concerns,
|
|
445
|
-
global: development.global,
|
|
446
|
-
personal: development.devas[this._agent.key]
|
|
444
|
+
hash: development.hash, // client preferred hash algorithm
|
|
445
|
+
cipher: development.cipher, // client preferred cipher settings
|
|
446
|
+
concerns: development.concerns, // any concerns for client
|
|
447
|
+
global: development.global, // the global policies for client
|
|
448
|
+
personal: development.devas[this._agent.key] // Client personal features and rules.
|
|
447
449
|
};
|
|
450
|
+
delete this._client.features.development
|
|
451
|
+
return this.Business()
|
|
448
452
|
}
|
|
449
453
|
} catch (e) {
|
|
450
|
-
this.error(e
|
|
454
|
+
return this.error(e) // run error handling if an error is caught
|
|
451
455
|
}
|
|
452
456
|
}
|
|
453
457
|
|
|
454
458
|
/**************
|
|
455
|
-
func:
|
|
459
|
+
func: Business
|
|
456
460
|
params: client: false
|
|
457
461
|
describe:
|
|
458
|
-
The
|
|
462
|
+
The Business feature sets the correct variables and necessary rules for the
|
|
459
463
|
client presented data.
|
|
460
464
|
***************/
|
|
461
|
-
|
|
465
|
+
Business(client=false) {
|
|
462
466
|
try {
|
|
463
|
-
if (!
|
|
467
|
+
if (!this._client.features.business) return this.Legal();
|
|
464
468
|
else {
|
|
465
|
-
this.state('
|
|
466
|
-
const
|
|
467
|
-
const {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
id: this.uid(true), // uuid of the assistant feature
|
|
469
|
+
this.state('setting_business'); // set state to business setting
|
|
470
|
+
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
471
|
+
const {business} = features; // set business from features const
|
|
472
|
+
this._business = { // set this_business with data
|
|
473
|
+
id: this.uid(true), // uuid of the business feature
|
|
471
474
|
client_id: id, // client id for reference
|
|
472
475
|
client_name: profile.name, // client name for personalization
|
|
473
|
-
hash:
|
|
474
|
-
cipher:
|
|
475
|
-
concerns:
|
|
476
|
-
global:
|
|
477
|
-
personal:
|
|
476
|
+
hash: business.hash, // client preferred hash algorithm
|
|
477
|
+
cipher: business.cipher, // client preferred cipher settings
|
|
478
|
+
concerns: business.concerns, // any concerns for client
|
|
479
|
+
global: business.global, // the global policies for client
|
|
480
|
+
personal: business.devas[this._agent.key] // Client personal features and rules.
|
|
478
481
|
};
|
|
479
|
-
|
|
482
|
+
delete this._client.features.business
|
|
483
|
+
return this.Legal();
|
|
484
|
+
}
|
|
480
485
|
} catch (e) {
|
|
481
|
-
this.error(e
|
|
486
|
+
return this.error(e) // run error handling if an error is caught
|
|
482
487
|
}
|
|
483
488
|
}
|
|
484
489
|
|
|
485
490
|
/**************
|
|
486
|
-
func:
|
|
491
|
+
func: Legal
|
|
487
492
|
params: client: false
|
|
488
493
|
describe:
|
|
489
|
-
The
|
|
494
|
+
The Legal feature sets the correct variables and necessary rules for the
|
|
490
495
|
client presented data.
|
|
491
496
|
***************/
|
|
492
|
-
|
|
497
|
+
Legal() {
|
|
493
498
|
try {
|
|
494
|
-
if (!
|
|
499
|
+
if (!this._client.features.legal) this.Assistant();
|
|
495
500
|
else {
|
|
496
|
-
this.state('
|
|
497
|
-
const
|
|
498
|
-
const {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
id: this.uid(true), // uuid of the business feature
|
|
501
|
+
this.state('setting_legal'); // set state to legal setting
|
|
502
|
+
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
503
|
+
const {legal} = features; // set legal from features const
|
|
504
|
+
this._legal = { // set this_legal with data
|
|
505
|
+
id: this.uid(true), // uuid of the legal feature
|
|
502
506
|
client_id: id, // client id for reference
|
|
503
507
|
client_name: profile.name, // client name for personalization
|
|
504
|
-
hash:
|
|
505
|
-
cipher:
|
|
506
|
-
concerns:
|
|
507
|
-
global:
|
|
508
|
-
personal:
|
|
508
|
+
hash: legal.hash, // client preferred hash algorithm
|
|
509
|
+
cipher: legal.cipher, // client preferred cipher settings
|
|
510
|
+
concerns: legal.concerns, // any concerns for client
|
|
511
|
+
global: legal.global, // the global policies for client
|
|
512
|
+
personal: legal.devas[this._agent.key] // Client personal features and rules.
|
|
509
513
|
};
|
|
514
|
+
delete this._client.features.legal;
|
|
515
|
+
return this.Assistant();
|
|
510
516
|
}
|
|
511
517
|
} catch (e) {
|
|
512
|
-
this.error(e
|
|
518
|
+
return this.error(e) // run error handling if an error is caught
|
|
513
519
|
}
|
|
514
520
|
}
|
|
515
521
|
|
|
516
522
|
/**************
|
|
517
|
-
func:
|
|
523
|
+
func: Assistant
|
|
518
524
|
params: client: false
|
|
519
525
|
describe:
|
|
520
|
-
The
|
|
526
|
+
The Assistant feature sets the correct variables and necessary rules for the
|
|
521
527
|
client presented data.
|
|
522
528
|
***************/
|
|
523
|
-
|
|
529
|
+
Assistant(client=false) {
|
|
524
530
|
try {
|
|
525
|
-
if (!
|
|
531
|
+
if (!this._client.features.assistant) return this.Done();
|
|
526
532
|
else {
|
|
527
|
-
this.state('
|
|
528
|
-
const
|
|
529
|
-
const {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
id: this.uid(true), // uuid of the legal feature
|
|
533
|
+
this.state('setting_assistant'); // set state to assistant setting
|
|
534
|
+
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
535
|
+
const {assistant} = features; // set assistant from features const
|
|
536
|
+
this._assistant = { // set this_assistant with data
|
|
537
|
+
id: this.uid(true), // uuid of the assistant feature
|
|
533
538
|
client_id: id, // client id for reference
|
|
534
539
|
client_name: profile.name, // client name for personalization
|
|
535
|
-
hash:
|
|
536
|
-
cipher:
|
|
537
|
-
concerns:
|
|
538
|
-
global:
|
|
539
|
-
personal:
|
|
540
|
+
hash: assistant.hash, // client preferred hash algorithm
|
|
541
|
+
cipher: assistant.cipher, // client preferred cipher settings
|
|
542
|
+
concerns: assistant.concerns, // any concerns for client
|
|
543
|
+
global: assistant.global, // the global policies for client
|
|
544
|
+
personal: assistant.devas[this._agent.key] // Client personal features and rules.
|
|
540
545
|
};
|
|
546
|
+
delete this._client.features.legal;
|
|
547
|
+
return this.Done();
|
|
541
548
|
}
|
|
542
549
|
} catch (e) {
|
|
543
|
-
this.error(e
|
|
550
|
+
return this.error(e) // run error handling if an error is caught
|
|
544
551
|
}
|
|
545
552
|
}
|
|
546
553
|
|
|
554
|
+
/**************
|
|
555
|
+
func: Done
|
|
556
|
+
params: none
|
|
557
|
+
describe: The end of the workflow Client Feature Workflow
|
|
558
|
+
***************/
|
|
559
|
+
Done() {
|
|
560
|
+
try {
|
|
561
|
+
this.state('setting_done'); // set state to assistant setting
|
|
562
|
+
return;
|
|
563
|
+
} catch (e) {
|
|
564
|
+
return this.error(e);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
547
567
|
/**************
|
|
548
568
|
func: _assignBind
|
|
549
569
|
params: none
|
|
@@ -870,38 +890,6 @@ class Deva {
|
|
|
870
890
|
return this.events.removeListener(evt, callback);
|
|
871
891
|
}
|
|
872
892
|
|
|
873
|
-
/**************
|
|
874
|
-
func: load
|
|
875
|
-
params:
|
|
876
|
-
-deva: The Deva model to load.
|
|
877
|
-
describe:
|
|
878
|
-
This function will enable fast loading of Deva into a system.
|
|
879
|
-
***************/
|
|
880
|
-
load(deva) {
|
|
881
|
-
this.state('deva_load');
|
|
882
|
-
this.devas[deva.key] = deva;
|
|
883
|
-
// inherit the data to the new deva.
|
|
884
|
-
this.inherit.forEach(inherit => {
|
|
885
|
-
this.devas[deva.key][inherit] = this[inherit];
|
|
886
|
-
});
|
|
887
|
-
this.state('deva_loaded');
|
|
888
|
-
return Promise.resolve();
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
/**************
|
|
893
|
-
func: unload
|
|
894
|
-
params:
|
|
895
|
-
- deva: The deva key to unload
|
|
896
|
-
describe: Unload a currently loaded Deva.
|
|
897
|
-
***************/
|
|
898
|
-
unload(deva) {
|
|
899
|
-
this.state('deva_unload');
|
|
900
|
-
delete this.devas[deva];
|
|
901
|
-
this.state('deva_unloaded');
|
|
902
|
-
return Promise.resolve(`unload:${deva} `);
|
|
903
|
-
}
|
|
904
|
-
|
|
905
893
|
/**************
|
|
906
894
|
func: ask
|
|
907
895
|
params: packet
|
|
@@ -1127,8 +1115,6 @@ class Deva {
|
|
|
1127
1115
|
init(client) {
|
|
1128
1116
|
// set client
|
|
1129
1117
|
this.Client = client;
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
1118
|
this._active = Date.now();
|
|
1133
1119
|
return new Promise((resolve, reject) => {
|
|
1134
1120
|
this.events.setMaxListeners(this.maxListeners);
|
|
@@ -1138,17 +1124,7 @@ class Deva {
|
|
|
1138
1124
|
return this._assignListeners();
|
|
1139
1125
|
}).then(() => {
|
|
1140
1126
|
this.state('init');
|
|
1141
|
-
|
|
1142
|
-
this.Security = client;
|
|
1143
|
-
this.Support = client;
|
|
1144
|
-
this.Services = client;
|
|
1145
|
-
this.Systems = client;
|
|
1146
|
-
this.Solutions = client;
|
|
1147
|
-
this.Development = client;
|
|
1148
|
-
this.Assistant = client;
|
|
1149
|
-
this.Business = client;
|
|
1150
|
-
this.Legal = client;
|
|
1151
|
-
|
|
1127
|
+
this.Security();
|
|
1152
1128
|
return this.onInit && typeof this.onInit === 'function' ? this.onInit() : this.start();
|
|
1153
1129
|
}).then(started => {
|
|
1154
1130
|
return resolve(started)
|
|
@@ -1173,9 +1149,9 @@ class Deva {
|
|
|
1173
1149
|
// check fo rthe custom onError function in the agent.
|
|
1174
1150
|
if (this.onError && typeof this.onError === 'function') return this.onError(err, data, reject);
|
|
1175
1151
|
else {
|
|
1176
|
-
console.log('
|
|
1152
|
+
console.log('\n::BEGIN:ERROR\n');
|
|
1177
1153
|
console.log(err);
|
|
1178
|
-
console.log('\n
|
|
1154
|
+
console.log('\n::END:ERROR\n');
|
|
1179
1155
|
return reject ? reject(err) : err;
|
|
1180
1156
|
}
|
|
1181
1157
|
}
|
|
@@ -1289,7 +1265,7 @@ class Deva {
|
|
|
1289
1265
|
// format the date since active for output.
|
|
1290
1266
|
const dateFormat = this.formatDate(this._active, 'long', true);
|
|
1291
1267
|
// create the text msg string
|
|
1292
|
-
let text = `${this.
|
|
1268
|
+
let text = `${this._features.systems.label}:STATUS ${this._agent.profile.name} active since ${dateFormat}`;
|
|
1293
1269
|
if (msg) text = text + `\n${msg}`; // append the msg string if msg true.
|
|
1294
1270
|
return text; // return final text string
|
|
1295
1271
|
}
|
|
@@ -1440,6 +1416,39 @@ class Deva {
|
|
|
1440
1416
|
return this._legal; // return legal feature
|
|
1441
1417
|
}
|
|
1442
1418
|
|
|
1419
|
+
/**************
|
|
1420
|
+
func: load
|
|
1421
|
+
params:
|
|
1422
|
+
-deva: The Deva model to load.
|
|
1423
|
+
describe:
|
|
1424
|
+
This function will enable fast loading of Deva into a system.
|
|
1425
|
+
***************/
|
|
1426
|
+
load(key, client) {
|
|
1427
|
+
return new Promise((resolve, reject) => {
|
|
1428
|
+
this.state('deva_load');
|
|
1429
|
+
this.devas[key].init(client).then(loaded => {
|
|
1430
|
+
this.state('deva_loaded');
|
|
1431
|
+
return resolve();
|
|
1432
|
+
}).catch(err => {
|
|
1433
|
+
return this.error(err, deva, reject);
|
|
1434
|
+
})
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
/**************
|
|
1440
|
+
func: unload
|
|
1441
|
+
params:
|
|
1442
|
+
- deva: The deva key to unload
|
|
1443
|
+
describe: Unload a currently loaded Deva.
|
|
1444
|
+
***************/
|
|
1445
|
+
unload(deva) {
|
|
1446
|
+
this.state('deva_unload');
|
|
1447
|
+
delete this.devas[deva];
|
|
1448
|
+
this.state('deva_unloaded');
|
|
1449
|
+
return Promise.resolve(`unload:${deva} `);
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1443
1452
|
/**************
|
|
1444
1453
|
func: startDevas
|
|
1445
1454
|
params: none
|
|
@@ -1447,14 +1456,14 @@ class Deva {
|
|
|
1447
1456
|
Start Devas will initialize the Deva agents inside this curent Deva.
|
|
1448
1457
|
***************/
|
|
1449
1458
|
startDevas(client) {
|
|
1450
|
-
const _client = this.copy(client); // copy the client data
|
|
1451
1459
|
this.state('devas_start'); // set the devas start state
|
|
1452
1460
|
return new Promise((resolve, reject) => {
|
|
1453
|
-
const
|
|
1461
|
+
const loading = [];
|
|
1462
|
+
const _client = this.copy(client);
|
|
1454
1463
|
for (let x in this.devas) {
|
|
1455
|
-
|
|
1464
|
+
loading.push(this.load(x, client));
|
|
1456
1465
|
}
|
|
1457
|
-
Promise.all(
|
|
1466
|
+
Promise.all(loading).then(() => {
|
|
1458
1467
|
this.state('devas_ready'); // set to ready state
|
|
1459
1468
|
return resolve({ // return the response
|
|
1460
1469
|
text:this._messages.devas_started, // include started state message
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indra.ai/deva",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.31",
|
|
4
4
|
"description": "The Deva Core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "
|
|
7
|
+
"test": "node examples/hello-world.js"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|