@indra.ai/deva 1.1.71 → 1.1.73
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/README.md +33 -3
- package/config.json +233 -0
- package/index.js +276 -433
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,6 +7,35 @@ Deva is a Node.js module designed to simplify the development of multi-agent sys
|
|
|
7
7
|
|
|
8
8
|
The Deva module is a JavaScript library for building multi-agent systems that can communicate with each other and with external services. It provides a unified API for creating agents and defining their behaviors, and includes tools for handling communication between agents and for integrating with third-party APIs. The Deva module is designed to be flexible and customizable, allowing developers to easily create complex systems that can perform a wide range of tasks, from data collection and analysis to chatbot interactions and image generation. The module is written in JavaScript and can be used with Node.js, making it easy to integrate with other JavaScript libraries and tools.
|
|
9
9
|
|
|
10
|
+
## Core Features
|
|
11
|
+
The core features in the @indra.ai deva.core encompass a wide range of functionalities and capabilities. Here's a brief overview of each feature:
|
|
12
|
+
|
|
13
|
+
1. Security Feature: This feature focuses on ensuring the security and privacy of the system, monitoring and responding to security-related issues.
|
|
14
|
+
|
|
15
|
+
2. Support Feature: The support feature is responsible for addressing user queries, providing assistance, and resolving any issues or concerns raised by users.
|
|
16
|
+
|
|
17
|
+
3. Services Feature: This feature pertains to the various services offered by the @indra.ai platform, such as cloud computing, data storage, networking, and more.
|
|
18
|
+
|
|
19
|
+
4. Systems Feature: The systems feature deals with the management and operation of the underlying infrastructure and resources that power the @indra.ai platform.
|
|
20
|
+
|
|
21
|
+
5. Solutions Feature: This feature is geared towards providing solutions to specific problems or challenges faced by users, offering guidance and recommendations.
|
|
22
|
+
|
|
23
|
+
6. Research Feature: The research feature focuses on exploring and advancing cutting-edge technologies, innovations, and methodologies within the domain of AI and related fields.
|
|
24
|
+
|
|
25
|
+
7. Development Feature: The development feature encompasses the creation, improvement, and maintenance of software and applications within the @indra.ai ecosystem.
|
|
26
|
+
|
|
27
|
+
8. Business Feature: This feature caters to the needs and requirements of businesses, offering tools, insights, and strategies to drive growth, efficiency, and success.
|
|
28
|
+
|
|
29
|
+
9. Legal Feature: The legal feature ensures compliance with legal and regulatory frameworks, addressing legal matters and providing guidance on legal aspects related to the @indra.ai platform.
|
|
30
|
+
|
|
31
|
+
10. Assistant Feature: This feature involves an AI-powered assistant that assists users with various tasks, answering questions, providing information, and offering support.
|
|
32
|
+
|
|
33
|
+
11. Story Feature: The story feature enables the generation of engaging and interactive stories, leveraging AI capabilities to create captivating narratives.
|
|
34
|
+
|
|
35
|
+
12. Mind Feature: The mind feature pertains to cognitive abilities and intelligence, encompassing aspects such as learning, reasoning, and decision-making within the @indra.ai platform.
|
|
36
|
+
|
|
37
|
+
These core features work together to provide a comprehensive and robust platform for users, covering essential aspects such as security, support, services, research, development, and more.
|
|
38
|
+
|
|
10
39
|
## Functions
|
|
11
40
|
|
|
12
41
|
Here are some insights about the code you shared:
|
|
@@ -87,11 +116,10 @@ const Deva = require('feecting/deva');
|
|
|
87
116
|
|
|
88
117
|
// setup the Deva object
|
|
89
118
|
const deva = new Deva({
|
|
119
|
+
info: {}
|
|
90
120
|
agent: {
|
|
91
121
|
uid: '*uinique identifier*'
|
|
92
122
|
key: '*DEVA KEY*',
|
|
93
|
-
name: '*DEVA NAME*',
|
|
94
|
-
describe: '*DEVA LONG DESCRIPTION*',
|
|
95
123
|
prompt: {
|
|
96
124
|
emoji: '🐶',
|
|
97
125
|
text: '*DEVA*',
|
|
@@ -102,6 +130,8 @@ const deva = new Deva({
|
|
|
102
130
|
speed: 1
|
|
103
131
|
},
|
|
104
132
|
profile: {
|
|
133
|
+
name: '*DEVA NAME*',
|
|
134
|
+
describe: '*DEVA LONG DESCRIPTION*',
|
|
105
135
|
emoji: 'the graphic emoji the agent travels with. 50px x 50px'
|
|
106
136
|
avatar: 'the graphic avatar the agent travels with 150px x 150px',
|
|
107
137
|
background: 'a background asset for page displays for th eagent',
|
|
@@ -117,10 +147,10 @@ const deva = new Deva({
|
|
|
117
147
|
},
|
|
118
148
|
vars: {},
|
|
119
149
|
listeners: {},
|
|
150
|
+
deva: {},
|
|
120
151
|
modules: {},
|
|
121
152
|
func: {},
|
|
122
153
|
methods: {},
|
|
123
|
-
deva: {},
|
|
124
154
|
onStart() {},
|
|
125
155
|
onStop() {},
|
|
126
156
|
onEnter() {},
|
package/config.json
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Deva Core Configuration",
|
|
3
|
+
"describe": "The Deva Core Configuraitno File contains all the values needed to run deva.world core.",
|
|
4
|
+
"copyright": "Copyright (c) Quinn Michaels. All rights reserved.",
|
|
5
|
+
"DATA": {
|
|
6
|
+
"cmdChr": "/",
|
|
7
|
+
"askChr": "#",
|
|
8
|
+
"inherit": ["events", "lib"],
|
|
9
|
+
"bind": [
|
|
10
|
+
"listeners",
|
|
11
|
+
"methods",
|
|
12
|
+
"func",
|
|
13
|
+
"lib",
|
|
14
|
+
"_agent"
|
|
15
|
+
],
|
|
16
|
+
"state": "offline",
|
|
17
|
+
"states": {
|
|
18
|
+
"ask": "asking another",
|
|
19
|
+
"question": "asked a question",
|
|
20
|
+
"answer": "gave an answer",
|
|
21
|
+
"offline": "offline",
|
|
22
|
+
"online": "online",
|
|
23
|
+
"init": "initializing",
|
|
24
|
+
"start": "starting journey",
|
|
25
|
+
"enter": "entering deva.world",
|
|
26
|
+
"stop": "stopping",
|
|
27
|
+
"exit": "exiting deva.world",
|
|
28
|
+
"load": "loading",
|
|
29
|
+
"unload": "unloading",
|
|
30
|
+
"invalid": "invalid state",
|
|
31
|
+
"done": "done state",
|
|
32
|
+
"error": "error state"
|
|
33
|
+
},
|
|
34
|
+
"zone": false,
|
|
35
|
+
"zones": {
|
|
36
|
+
"deva": "Deva Zone",
|
|
37
|
+
"config": "Configuration Zone",
|
|
38
|
+
"features": "Feature Zone",
|
|
39
|
+
"idle": "Idle Zone",
|
|
40
|
+
"training": "Training Zone",
|
|
41
|
+
"school": "School Zone",
|
|
42
|
+
"work": "Work Zone",
|
|
43
|
+
"fun": "Fun Zone",
|
|
44
|
+
"adventure": "Adventure Zone",
|
|
45
|
+
"party": "Party Zone",
|
|
46
|
+
"invalid": "Invalid Invalid",
|
|
47
|
+
"done": "Done Zone",
|
|
48
|
+
"error": "Error Zone"
|
|
49
|
+
},
|
|
50
|
+
"action": false,
|
|
51
|
+
"actions": {
|
|
52
|
+
"wait": "wait",
|
|
53
|
+
"question": "question",
|
|
54
|
+
"question_ask": "question:ask",
|
|
55
|
+
"question_ask_answer": "returned with an answer",
|
|
56
|
+
"question_cmd": "question:cmd",
|
|
57
|
+
"question_method": "question:method",
|
|
58
|
+
"question_talk": "question:talk",
|
|
59
|
+
"question_answer": "question:answer",
|
|
60
|
+
"question_done": "question:done",
|
|
61
|
+
"answer": "answer",
|
|
62
|
+
"answer_talk": "sharing the answer",
|
|
63
|
+
"ask": "asking",
|
|
64
|
+
"ask_answer": "answering",
|
|
65
|
+
"uid": "create unique id",
|
|
66
|
+
"hash": "create hash",
|
|
67
|
+
"cipher": "encrypt data",
|
|
68
|
+
"decipher": "dencrypt data",
|
|
69
|
+
"security": "SECURITY",
|
|
70
|
+
"Security": "Security Feature",
|
|
71
|
+
"support": "SUPPORT",
|
|
72
|
+
"Support": "Support Feature",
|
|
73
|
+
"systems": "SYSTMS",
|
|
74
|
+
"Systems": "Systems Feature",
|
|
75
|
+
"services": "SERVICES",
|
|
76
|
+
"Services": "Services Feature",
|
|
77
|
+
"solutions": "SOLUTIONS",
|
|
78
|
+
"Solutions": "Solutions Feature",
|
|
79
|
+
"research": "RESEARCH",
|
|
80
|
+
"Research": "Research Feature",
|
|
81
|
+
"development": "DEVELOPMENT",
|
|
82
|
+
"Development": "Development Feature",
|
|
83
|
+
"business": "BUSINESS",
|
|
84
|
+
"Business": "Business Feature",
|
|
85
|
+
"legal": "LEGAL",
|
|
86
|
+
"Legal": "Legal Feature",
|
|
87
|
+
"assistant": "ASSISTANT",
|
|
88
|
+
"Assistant": "Assistant Feature",
|
|
89
|
+
"story": "STORY",
|
|
90
|
+
"Story": "Story Feature",
|
|
91
|
+
"mind": "MIND",
|
|
92
|
+
"Mind": "Mind Feature",
|
|
93
|
+
"client_data": "client configure",
|
|
94
|
+
"invalid": "Actin Invalid",
|
|
95
|
+
"error": "Action Error",
|
|
96
|
+
"done": "Action Done"
|
|
97
|
+
},
|
|
98
|
+
"feature": false,
|
|
99
|
+
"features": {
|
|
100
|
+
"security": "Security",
|
|
101
|
+
"Security": "SECURITY Feature",
|
|
102
|
+
"support": "Support",
|
|
103
|
+
"Support": "SUPPORT Feature",
|
|
104
|
+
"services": "Services",
|
|
105
|
+
"Services": "SERVICES",
|
|
106
|
+
"solutions": "Solutions",
|
|
107
|
+
"Solutions": "SOLUTIONS Feature",
|
|
108
|
+
"systems": "Systems",
|
|
109
|
+
"Systems": "SYSTEMS Feature",
|
|
110
|
+
"research": "Research",
|
|
111
|
+
"Research": "RESEARCH Feature",
|
|
112
|
+
"development": "Development",
|
|
113
|
+
"Development": "DEVELOPMENT Feature",
|
|
114
|
+
"business": "Business",
|
|
115
|
+
"Business": "BUSINESS Feature",
|
|
116
|
+
"legal": "Legal",
|
|
117
|
+
"Legal": "LEGAL Feature",
|
|
118
|
+
"assistant": "Assistant",
|
|
119
|
+
"Assistant": "ASSISTANT Feature",
|
|
120
|
+
"story": "Story",
|
|
121
|
+
"Story": "STORY Feature",
|
|
122
|
+
"mind": "Story",
|
|
123
|
+
"Mind": "MIND Feature",
|
|
124
|
+
"error": "Feature Error",
|
|
125
|
+
"done": "Features Done"
|
|
126
|
+
},
|
|
127
|
+
"message": "offline",
|
|
128
|
+
"messages": {
|
|
129
|
+
"states": {
|
|
130
|
+
"offline": "🛌 ::agent.name:: offline state",
|
|
131
|
+
"online": "🌞 ::agent.name:: online state",
|
|
132
|
+
"ask": "😎 ::agent.name:: ask state",
|
|
133
|
+
"question": "🎙️ ::agent.name:: question state",
|
|
134
|
+
"answer": "🎟️ ::agent.name:: answer state",
|
|
135
|
+
"init": "🚀 ::agent.name:: init state",
|
|
136
|
+
"start": "🚙 ::agent.name:: start state",
|
|
137
|
+
"enter": "🪐 ::agent.name:: enter state",
|
|
138
|
+
"stop": "✋ ::agent.name:: stop state",
|
|
139
|
+
"exit": "🚪 ::agent.name:: exit state",
|
|
140
|
+
"load": "📫 ::agent.name:: load state",
|
|
141
|
+
"unload": "📭 ::agent.name:: is this._states.unload",
|
|
142
|
+
"invalid": "⚠️ ::agent.name:: invalid state",
|
|
143
|
+
"done": "✅ ::agent.name:: done state",
|
|
144
|
+
"error": "❌ ::agent.name:: error state"
|
|
145
|
+
},
|
|
146
|
+
"zones": {
|
|
147
|
+
"deva": "🎉 ::agent.name:: deva zone",
|
|
148
|
+
"config": "🦾 ::agent.name:: config zone",
|
|
149
|
+
"features": "🍿 ::agent.name:: features zone",
|
|
150
|
+
"idle": "😜 ::agent.name:: idle zone",
|
|
151
|
+
"training": "🥋 ::agent.name:: train zone",
|
|
152
|
+
"school": "👨🏫 ::agent.name:: work zone",
|
|
153
|
+
"work": "🗂️ ::agent.name:: work zone",
|
|
154
|
+
"invalid": "⚠️ ::agent.name:: invalid zone",
|
|
155
|
+
"done": "✅ ::agent.name:: done zone",
|
|
156
|
+
"error": "❌ ::agent.name:: erro zone"
|
|
157
|
+
},
|
|
158
|
+
"actions": {
|
|
159
|
+
"wait": "😵💫 ::agent.name:: wait action",
|
|
160
|
+
"question": "👀 ::agent.name:: question action",
|
|
161
|
+
"question_ask": "👥 ::agent.name:: question_ask action",
|
|
162
|
+
"question_ask_answer": "📣 ::agent.name:: question_ask_answer action",
|
|
163
|
+
"question_cmd": "🎮 ::agent.name:: question_cmd action",
|
|
164
|
+
"question_method": "🏄♂️ ::agent.name:: question_method action",
|
|
165
|
+
"question_talk": "📢 ::agent.name:: question_talk action",
|
|
166
|
+
"question_answer": "🎙️ ::agent.name:: question_answer action",
|
|
167
|
+
"question_done": "👍 ::agent.name:: question_done action",
|
|
168
|
+
"answer": "🎟️ ::agent.name:: answer action",
|
|
169
|
+
"answer_talk": "🎟️ ::agent.name:: answer_talk action",
|
|
170
|
+
"ask": "👥 ::agent.name:: answer.ask action",
|
|
171
|
+
"ask_answer": "🎟️ ::agent.name:: ask_answer action",
|
|
172
|
+
|
|
173
|
+
"security": "👮♀️ security actio",
|
|
174
|
+
"Security": "👮♂️ Security read",
|
|
175
|
+
"support": "👩⚕️ support actio",
|
|
176
|
+
"Support": "👨⚕️ Support read",
|
|
177
|
+
"services": "👩🔧 services actio",
|
|
178
|
+
"Services": "👨🔧 Services read",
|
|
179
|
+
"solutions": "👩🚀 solutions actio",
|
|
180
|
+
"Solutions": "👨🚀 Solutions read",
|
|
181
|
+
"systems": "👷♀️ systems actio",
|
|
182
|
+
"Systems": "👷♂️ Systems read",
|
|
183
|
+
"research": "👩🔬 research actio",
|
|
184
|
+
"Research": "👨🔬 Research read",
|
|
185
|
+
"development": "👩💻 development actio",
|
|
186
|
+
"Development": "👨💻 Development read",
|
|
187
|
+
"business": "👩💼 business actio",
|
|
188
|
+
"Business": "👨💼 Business read",
|
|
189
|
+
"legal": "👩⚖️ legal actio",
|
|
190
|
+
"Legal": "👩⚖️ Legal read",
|
|
191
|
+
"assistant": "👩 assistant actio",
|
|
192
|
+
"Assistant": "👨 Assistant read",
|
|
193
|
+
"story": "👩🏫 story actio",
|
|
194
|
+
"Story": "👨🏫 Story read",
|
|
195
|
+
"mind": "🧘♀️ mind actio",
|
|
196
|
+
"Mind": "🧘♂️ Mind read",
|
|
197
|
+
"client_data": "📂 ::agent.name:: configure",
|
|
198
|
+
"invalid": "⚠️ invalid",
|
|
199
|
+
"done": "✅ done",
|
|
200
|
+
"error": "❌ this._action.erro"
|
|
201
|
+
},
|
|
202
|
+
"features": {
|
|
203
|
+
"security": "🔐 security feature",
|
|
204
|
+
"Security": "🔐 Security configure",
|
|
205
|
+
"support": "💼 support feature",
|
|
206
|
+
"Support": "💼 Support configure",
|
|
207
|
+
"services": "🛠️ services feature",
|
|
208
|
+
"Services": "🛠️ Services configure",
|
|
209
|
+
"solutions": "💡 solutions feature",
|
|
210
|
+
"Solutions": "💡 Solutions configure",
|
|
211
|
+
"systems": "🖥️ systems feature",
|
|
212
|
+
"Systems": "🖥️ Systems configure",
|
|
213
|
+
"research": "🔬 research feature",
|
|
214
|
+
"Research": "🔬 Research configure",
|
|
215
|
+
"development": "🔧 development feature",
|
|
216
|
+
"Development": "🔧 Development configure",
|
|
217
|
+
"business": "📊 business feature",
|
|
218
|
+
"Business": "📊 Business configure",
|
|
219
|
+
"legal": "⚖️ legal feature",
|
|
220
|
+
"Legal": "⚖️ Legal configure",
|
|
221
|
+
"assistant": "👤 assistant feature",
|
|
222
|
+
"Assistant": "👤 Assistant configure",
|
|
223
|
+
"story": "📚 story feature",
|
|
224
|
+
"Story": "📚 Story configure",
|
|
225
|
+
"mind": "🧠 story feature",
|
|
226
|
+
"Mind": "🧠 Mind configure",
|
|
227
|
+
"invalid": "⚠️ feature invalid",
|
|
228
|
+
"done": "✅ feature done",
|
|
229
|
+
"error": "❌ feature error"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
package/index.js
CHANGED
|
@@ -3,279 +3,71 @@
|
|
|
3
3
|
// file LICENSE.md or http://www.opensource.org/licenses/mit-license.php.
|
|
4
4
|
const {EventEmitter} = require('events');
|
|
5
5
|
const { createHash, randomUUID, createCipheriv, createDecipheriv, randomBytes } = require('crypto');
|
|
6
|
-
|
|
6
|
+
const config = require('./config.json').DATA // load the deva core configuration data.
|
|
7
7
|
class Deva {
|
|
8
8
|
constructor(opts) {
|
|
9
9
|
opts = opts || {};
|
|
10
|
-
this._id = randomUUID();
|
|
11
|
-
this._info = opts.info || false;
|
|
12
|
-
this._config = opts.config || {};
|
|
13
|
-
this._agent = opts.agent || false;
|
|
14
|
-
this._client = {};
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
10
|
+
this._id = randomUUID(); // the unique id assigned to the agent at load
|
|
11
|
+
this._info = opts.info || false; // the deva information from the package file.
|
|
12
|
+
this._config = opts.config || {}; // local Config Object
|
|
13
|
+
this._agent = opts.agent || false; // Agent profile object
|
|
14
|
+
this._client = {}; // this will be set on init.
|
|
15
|
+
this._active = false; // the active/birth date.
|
|
16
|
+
this._security = false; // inherited Security features.
|
|
17
|
+
this._support = false; // inherited Support features.
|
|
18
|
+
this._services = false; // inherited Service features.
|
|
19
|
+
this._systems = false; // inherited Systems features.
|
|
20
|
+
this._solutions = false; // inherited Solutions features.
|
|
21
|
+
this._research = false; // inherited Research features.
|
|
22
|
+
this._development = false; // inherited Development features.
|
|
23
|
+
this._business = false; // inherited Business features.
|
|
24
|
+
this._legal = false; // inherited Legal features.
|
|
25
|
+
this._assistant = false; // inherited Assistant features.
|
|
26
|
+
this._story = false; // inherited Story features.
|
|
27
|
+
this.events = opts.events || new EventEmitter({}); // Event Bus
|
|
28
|
+
this.lib = opts.lib || {}; // used for loading library functions
|
|
29
|
+
this.devas = opts.devas || {}; // Devas which are loaded
|
|
30
|
+
this.vars = opts.vars || {}; // Variables object
|
|
31
|
+
this.listeners = opts.listeners || {}; // local Listeners
|
|
32
|
+
this.modules = opts.modules || {}; // 3rd Party Modules
|
|
33
|
+
this.func = opts.func || {}; // local Functions
|
|
34
|
+
this.methods = opts.methods || {}; // local Methods
|
|
35
|
+
this.maxListeners = opts.maxListenners || 0; // set the local maxListeners
|
|
33
36
|
|
|
34
37
|
// prevent overwriting existing functions and variables with same name
|
|
35
38
|
for (var opt in opts) {
|
|
36
39
|
if (!this[opt] || !this[`_${opt}`]) this[opt] = opts[opt];
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
this.cmdChr =
|
|
40
|
-
this.askChr =
|
|
41
|
-
// index of the items
|
|
42
|
-
this.inherit = ["events", "lib"];
|
|
43
|
-
this.bind = [
|
|
44
|
-
"listeners",
|
|
45
|
-
"methods",
|
|
46
|
-
"func",
|
|
47
|
-
"lib",
|
|
48
|
-
"_agent"
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
this._state = 'offline'; // current state of agent.
|
|
52
|
-
this._states = {
|
|
53
|
-
ask: `asking another`,
|
|
54
|
-
question: `asked a question`,
|
|
55
|
-
answer: `gave an answer`,
|
|
56
|
-
|
|
57
|
-
offline: `offline`,
|
|
58
|
-
online: `online`,
|
|
59
|
-
|
|
60
|
-
init: `initializing`,
|
|
61
|
-
start: `starting journey`,
|
|
62
|
-
enter: `entering deva.world`,
|
|
63
|
-
stop: `stopping`,
|
|
64
|
-
exit: 'exiting deva.world',
|
|
65
|
-
load: 'loading',
|
|
66
|
-
unload: 'unloading',
|
|
67
|
-
|
|
68
|
-
invalid: 'invalid state',
|
|
69
|
-
done: 'done state',
|
|
70
|
-
error: 'error state',
|
|
71
|
-
}; // states object
|
|
72
|
-
|
|
73
|
-
this._zone = false; // current state of agent.
|
|
74
|
-
this._zones = {
|
|
75
|
-
deva: 'Deva Zone',
|
|
76
|
-
config: 'Configuration Zone',
|
|
77
|
-
features: 'Feature Zone',
|
|
78
|
-
idle: 'Idle Zone',
|
|
79
|
-
training: 'Training Zone',
|
|
80
|
-
school: 'School Zone',
|
|
81
|
-
work: 'Work Zone',
|
|
82
|
-
fun: 'Fun Zone',
|
|
83
|
-
adventure: 'Adventure Zone',
|
|
84
|
-
party: 'Party Zone',
|
|
85
|
-
invalid: 'Invalid Invalid',
|
|
86
|
-
done: 'Done Zone',
|
|
87
|
-
error: 'Error Zone',
|
|
88
|
-
}; // states object
|
|
89
|
-
|
|
90
|
-
this._action = false;
|
|
91
|
-
this._actions = {
|
|
92
|
-
wait: 'wait',
|
|
93
|
-
question: 'question',
|
|
94
|
-
question_ask: 'question:ask',
|
|
95
|
-
question_ask_answer: 'returned with an answer',
|
|
96
|
-
question_cmd: 'question:cmd',
|
|
97
|
-
question_method: 'question:method',
|
|
98
|
-
question_talk: 'question:talk',
|
|
99
|
-
question_answer: 'question:answer',
|
|
100
|
-
question_done: 'question:done',
|
|
101
|
-
answer: 'answer',
|
|
102
|
-
answer_talk: 'sharing the answer',
|
|
103
|
-
ask: 'asking',
|
|
104
|
-
ask_answer: 'answering',
|
|
105
|
-
uid: 'create unique id',
|
|
106
|
-
hash: 'create hash',
|
|
107
|
-
cipher: 'encrypt data',
|
|
108
|
-
decipher: 'dencrypt data',
|
|
109
|
-
security: 'SECURITY',
|
|
110
|
-
Security: 'Security Feature',
|
|
111
|
-
support: 'SUPPORT',
|
|
112
|
-
Support: 'Support Feature',
|
|
113
|
-
systems: 'SYSTMS',
|
|
114
|
-
Systems: 'Systems Feature',
|
|
115
|
-
services: 'SERVICES',
|
|
116
|
-
Services: 'Services Feature',
|
|
117
|
-
solutions: 'SOLUTIONS',
|
|
118
|
-
Solutions: 'Solutions Feature',
|
|
119
|
-
development: 'DEVELOPMENT',
|
|
120
|
-
Development: 'Development Feature',
|
|
121
|
-
business: 'BUSINESS',
|
|
122
|
-
Business: 'Business Feature',
|
|
123
|
-
legal: 'LEGAL',
|
|
124
|
-
Legal: 'Legal Feature',
|
|
125
|
-
assistant: 'ASSISTANT',
|
|
126
|
-
Assistant: 'Assistant Feature',
|
|
127
|
-
story: 'STORY',
|
|
128
|
-
Story: 'Story Feature',
|
|
129
|
-
mind: 'MIND',
|
|
130
|
-
Mind: 'Mind Feature',
|
|
131
|
-
client_data: 'client configure',
|
|
132
|
-
invalid: 'Actin Invalid',
|
|
133
|
-
error: 'Action Error',
|
|
134
|
-
done: 'Action Done',
|
|
135
|
-
}
|
|
42
|
+
this.cmdChr = config.cmdChr; // the trigger for local commands
|
|
43
|
+
this.askChr = config.askChr; // the trigger for ask other DEva features
|
|
136
44
|
|
|
137
|
-
this.
|
|
138
|
-
this.
|
|
139
|
-
security: 'Security',
|
|
140
|
-
Security: 'SECURITY Feature',
|
|
141
|
-
support: 'Support',
|
|
142
|
-
Support: 'SUPPORT Feature',
|
|
143
|
-
services: 'Services',
|
|
144
|
-
Services: 'SERVICES',
|
|
145
|
-
solutions: 'Solutions',
|
|
146
|
-
Solutions: 'SOLUTIONS Feature',
|
|
147
|
-
systems: 'Systems',
|
|
148
|
-
Systems: 'SYSTEMS Feature',
|
|
149
|
-
research: 'Research',
|
|
150
|
-
Research: 'RESEARCH Feature',
|
|
151
|
-
development: 'Development',
|
|
152
|
-
Development: 'DEVELOPMENT Feature',
|
|
153
|
-
business: 'Business',
|
|
154
|
-
Business: 'BUSINESS Feature',
|
|
155
|
-
legal:'Legal',
|
|
156
|
-
Legal:'LEGAL Feature',
|
|
157
|
-
assistant: 'Assistant',
|
|
158
|
-
Assistant: 'ASSISTANT Feature',
|
|
159
|
-
story: 'Story',
|
|
160
|
-
Story: 'STORY Feature',
|
|
161
|
-
mind: 'Story',
|
|
162
|
-
Mind: 'MIND Feature',
|
|
163
|
-
error: 'Feature Error',
|
|
164
|
-
done: 'Features Done',
|
|
165
|
-
};
|
|
45
|
+
this.inherit = config.inherit; // set inherit from config
|
|
46
|
+
this.bind = config.bind; // set the bind from the config
|
|
166
47
|
|
|
167
|
-
this.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
start: `🚙 ${this._agent.profile.name} ${this._states.start}`,
|
|
176
|
-
enter: `🪐 ${this._agent.profile.name} ${this._states.enter}`,
|
|
177
|
-
stop: `✋ ${this._agent.profile.name} ${this._states.stop}`,
|
|
178
|
-
exit: `🚪 ${this._agent.profile.name} ${this._states.exit}`,
|
|
179
|
-
load: `📫 ${this._agent.profile.name} is ${this._states.load}`,
|
|
180
|
-
unload: `📭 ${this._agent.profile.name} is ${this._states.unload}`,
|
|
181
|
-
uid: `🔑 ${this._agent.profile.name} ${this._states.uid}`,
|
|
182
|
-
invalid: `⚠️ ${this._agent.profile.name} ${this._states.invalid}`,
|
|
183
|
-
done: `✅ ${this._agent.profile.name} ${this._states.done}`,
|
|
184
|
-
error: `❌ ${this._states.error}`,
|
|
185
|
-
},
|
|
186
|
-
zones: {
|
|
187
|
-
deva: `🎉 ${this._agent.profile.name} ${this._zones.deva}`,
|
|
188
|
-
config: `🦾 ${this._agent.profile.name} ${this._zones.config}`,
|
|
189
|
-
features: `🍿 ${this._agent.profile.name} ${this._zones.features}`,
|
|
190
|
-
idle: `😜 ${this._agent.profile.name} ${this._zones.idle}`,
|
|
191
|
-
training: `🥋 ${this._agent.profile.name} ${this._zones.train}`,
|
|
192
|
-
school: `👨🏫 ${this._agent.profile.name} ${this._zones.work}`,
|
|
193
|
-
work: `🗂️ ${this._agent.profile.name} ${this._zones.work}`,
|
|
194
|
-
invalid: `⚠️ ${this._agent.profile.name} ${this._zones.invalid}`,
|
|
195
|
-
done: `✅ ${this._agent.profile.name} ${this._zones.done}`,
|
|
196
|
-
error: `❌ ${this._agent.profile.name} ${this._zones.error}`,
|
|
197
|
-
},
|
|
198
|
-
actions: {
|
|
199
|
-
wait: `😵💫 ${this._agent.profile.name} ${this._actions.wait}`,
|
|
200
|
-
question: `👀 ${this._agent.profile.name} ${this._actions.question}`,
|
|
201
|
-
question_ask: `👥 ${this._agent.profile.name} ${this._actions.question_ask}`,
|
|
202
|
-
question_ask_answer: `📣 ${this._agent.profile.name} ${this._actions.question_ask_answer}`,
|
|
203
|
-
question_cmd: `🎮 ${this._agent.profile.name} issue command`,
|
|
204
|
-
question_method: `🏄♂️ ${this._agent.profile.name} ${this._actions.question_method}`,
|
|
205
|
-
question_talk: `📢 ${this._agent.profile.name} ${this._actions.question_talk}`,
|
|
206
|
-
question_answer: `🎙️ ${this._agent.profile.name} ${this._actions.question_answer}`,
|
|
207
|
-
question_done: `👍 ${this._agent.profile.name} ${this._actions.question_done}`,
|
|
208
|
-
answer: `🎟️ ${this._agent.profile.name} gave an ${this._actions.answer}`,
|
|
209
|
-
answer_talk: `🎟️ ${this._agent.profile.name} talk ansnwer to listeners`,
|
|
210
|
-
ask: `👥 ${this._agent.profile.name} asking`,
|
|
211
|
-
ask_answer: `🎟️ ${this._agent.profile.name} answering ask`,
|
|
212
|
-
|
|
213
|
-
uid: `🆔 ${this._agent.profile.name} ${this._actions.uid}`,
|
|
214
|
-
hash: `🔏 ${this._agent.profile.name} ${this._actions.hash}`,
|
|
215
|
-
cipher: `🔒 ${this._agent.profile.name} ${this._actions.cipher}`,
|
|
216
|
-
decipher: `🔓 ${this._agent.profile.name} ${this._actions.decipher}`,
|
|
217
|
-
|
|
218
|
-
security: `👮♀️ ${this._features.security} action`,
|
|
219
|
-
Security: `👮♂️ ${this._features.Security} ready`,
|
|
220
|
-
support: `👩⚕️ ${this._features.support} action`,
|
|
221
|
-
Support: `👨⚕️ ${this._features.Support} ready`,
|
|
222
|
-
services: `👩🔧 ${this._features.services} action`,
|
|
223
|
-
Services: `👨🔧 ${this._features.Services} ready`,
|
|
224
|
-
solutions: `👩🚀 ${this._features.solutions} action`,
|
|
225
|
-
Solutions: `👨🚀 ${this._features.Solutions} ready`,
|
|
226
|
-
systems: `👷♀️ ${this._features.systems} action`,
|
|
227
|
-
Systems: `👷♂️ ${this._features.Systems} ready`,
|
|
228
|
-
research: `👩🔬 ${this._features.research} action`,
|
|
229
|
-
Research: `👨🔬 ${this._features.Research} ready`,
|
|
230
|
-
development: `👩💻 ${this._features.development} action`,
|
|
231
|
-
Development: `👨💻 ${this._features.Development} ready`,
|
|
232
|
-
business: `👩💼 ${this._features.business} action`,
|
|
233
|
-
Business: `👨💼 ${this._features.Business} ready`,
|
|
234
|
-
legal: `👩⚖️ ${this._features.legal} action`,
|
|
235
|
-
Legal: `👩⚖️ ${this._features.Legal} ready`,
|
|
236
|
-
assistant: `👩 ${this._features.assistant} action`,
|
|
237
|
-
Assistant: `👨 ${this._features.Assistant} ready`,
|
|
238
|
-
story: `👩🏫 ${this._features.story} action`,
|
|
239
|
-
Story: `👨🏫 ${this._features.Story} ready`,
|
|
240
|
-
mind: `🧘♀️ ${this._features.mind} action`,
|
|
241
|
-
Mind: `🧘♂️ ${this._features.Mind} ready`,
|
|
242
|
-
client_data: `📂 ${this._agent.profile.name} configure`,
|
|
243
|
-
invalid: `⚠️ ${this._actions.invalid}`,
|
|
244
|
-
done: `✅ ${this._actions.done}`,
|
|
245
|
-
error: `❌ ${this._action.error}`,
|
|
246
|
-
},
|
|
247
|
-
features: {
|
|
248
|
-
security: `🔐 ${this._features.security} feature`,
|
|
249
|
-
Security: `🔐 ${this._features.Security} configure`,
|
|
250
|
-
support: `💼 ${this._features.support} feature`,
|
|
251
|
-
Support: `💼 ${this._features.Support} configure`,
|
|
252
|
-
services: `🛠️ ${this._features.services} feature`,
|
|
253
|
-
Services: `🛠️ ${this._features.Services} configure`,
|
|
254
|
-
solutions: `💡 ${this._features.solutions} feature`,
|
|
255
|
-
Solutions: `💡 ${this._features.Solutions} configure`,
|
|
256
|
-
systems: `🖥️ ${this._features.systems} feature`,
|
|
257
|
-
Systems: `🖥️ ${this._features.Systems} configure`,
|
|
258
|
-
research: `🔍 ${this._features.research} feature`,
|
|
259
|
-
Research: `🔍 ${this._features.Research} configure`,
|
|
260
|
-
development: `🔧 ${this._features.development} feature`,
|
|
261
|
-
Development: `🔧 ${this._features.Development} configure`,
|
|
262
|
-
business: `📊 ${this._features.business} feature`,
|
|
263
|
-
Business: `📊 ${this._features.Business} configure`,
|
|
264
|
-
legal: `⚖️ ${this._features.legal} feature`,
|
|
265
|
-
Legal: `⚖️ ${this._features.Legal} configure`,
|
|
266
|
-
assistant: `👤 ${this._features.assistant} feature`,
|
|
267
|
-
Assistant: `👤 ${this._features.Assistant} configure`,
|
|
268
|
-
story: `📚 ${this._features.story} feature`,
|
|
269
|
-
Story: `📚 ${this._features.Story} configure`,
|
|
270
|
-
mind: `🧠 ${this._features.story} feature`,
|
|
271
|
-
Mind: `🧠 ${this._features.Mind} configure`,
|
|
272
|
-
invalid: `⚠️ ${this._features.invalid}`,
|
|
273
|
-
done: `✅ ${this._features.done}`,
|
|
274
|
-
error: `❌ ${this._features.error}`,
|
|
275
|
-
},
|
|
276
|
-
}; // messages object
|
|
277
|
-
}
|
|
48
|
+
this._state = config.state; // set the current state from config
|
|
49
|
+
this._states = config.states; // set the states from config
|
|
50
|
+
|
|
51
|
+
this._zone = config.zone; // set the current zone from config
|
|
52
|
+
this._zones = config.zones; // set the zones from config
|
|
53
|
+
|
|
54
|
+
this._action = config.action; // set the action from config
|
|
55
|
+
this._actions = config.actions; // set the actions from config
|
|
278
56
|
|
|
57
|
+
this._feature = config.feature; // set the feature from config
|
|
58
|
+
this._features = config.features; // set the features from config
|
|
59
|
+
|
|
60
|
+
this._message = config.message; // current state of agent.
|
|
61
|
+
this._messages = {}; // set the messages from config
|
|
62
|
+
|
|
63
|
+
// then here we are going to loop the messages config to make sure custom values are set
|
|
64
|
+
for (let x in config.messages) {
|
|
65
|
+
this._messages[x] = {};
|
|
66
|
+
for (let y in config.messages[x]) {
|
|
67
|
+
this._messages[x][y] = config.messages[x][y].replace('::agent.name::', opts.agent.profile.name);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
279
71
|
|
|
280
72
|
/**************
|
|
281
73
|
func: Client
|
|
@@ -302,31 +94,31 @@ class Deva {
|
|
|
302
94
|
client presented data.
|
|
303
95
|
***************/
|
|
304
96
|
Security() {
|
|
305
|
-
this.feature('Security');
|
|
306
|
-
const _cl = this.client();
|
|
97
|
+
this.feature('Security'); // set feature to Security
|
|
98
|
+
const _cl = this.client(); // set local copy of client data
|
|
307
99
|
try {
|
|
308
|
-
if (!_cl.features.security) return this.Support();
|
|
100
|
+
if (!_cl.features.security) return this.Support(); // if no security feature goto Support
|
|
309
101
|
else {
|
|
310
|
-
this.action('Security');
|
|
311
|
-
const {id, profile, features} = _cl;
|
|
312
|
-
const {security} = features;
|
|
313
|
-
this._security = {
|
|
314
|
-
id: this.uid(true),
|
|
315
|
-
client_id: id,
|
|
316
|
-
client_name: profile.name,
|
|
317
|
-
hash: security.hash,
|
|
318
|
-
cipher: security.cipher,
|
|
319
|
-
concerns: security.concerns,
|
|
320
|
-
global: security.global,
|
|
321
|
-
personal: security.devas[this._agent.key]
|
|
102
|
+
this.action('Security'); // set action to Security
|
|
103
|
+
const {id, profile, features} = _cl; // make a copy the clinet data.
|
|
104
|
+
const {security} = features; // make a copy the clinet data.
|
|
105
|
+
this._security = { // set this_security with data
|
|
106
|
+
id: this.uid(true), // uuid of the security feature
|
|
107
|
+
client_id: id, // client id for reference
|
|
108
|
+
client_name: profile.name, // client name for personalization
|
|
109
|
+
hash: security.hash, // client preferred hash algorithm
|
|
110
|
+
cipher: security.cipher, // client preferred cipher settings
|
|
111
|
+
concerns: security.concerns, // any concerns for client
|
|
112
|
+
global: security.global, // the global policies for client
|
|
113
|
+
personal: security.devas[this._agent.key], // Client personal features and rules.
|
|
322
114
|
};
|
|
323
|
-
delete this._client.features.security
|
|
324
|
-
return this.Support();
|
|
115
|
+
delete this._client.features.security; // make a copy the clinet data.
|
|
116
|
+
return this.Support(); // goto Support when done with Security
|
|
325
117
|
}
|
|
326
118
|
} catch (e) {
|
|
327
|
-
this.action('error');
|
|
328
|
-
this.feature('error');
|
|
329
|
-
return this.error(e)
|
|
119
|
+
this.action('error'); // set the action to error
|
|
120
|
+
this.feature('error'); // set the feature to error
|
|
121
|
+
return this.error(e); // run error handling if an error is caught
|
|
330
122
|
}
|
|
331
123
|
}
|
|
332
124
|
|
|
@@ -358,9 +150,9 @@ class Deva {
|
|
|
358
150
|
return this.Services();
|
|
359
151
|
}
|
|
360
152
|
} catch (e) {
|
|
361
|
-
this.action('error');
|
|
362
|
-
this.feature('error');
|
|
363
|
-
return this.error(e)
|
|
153
|
+
this.action('error'); // set the action to error
|
|
154
|
+
this.feature('error'); // set the feature to error
|
|
155
|
+
return this.error(e); // run error handling if an error is caught
|
|
364
156
|
}
|
|
365
157
|
}
|
|
366
158
|
|
|
@@ -392,9 +184,9 @@ class Deva {
|
|
|
392
184
|
return this.Systems()
|
|
393
185
|
}
|
|
394
186
|
} catch (e) {
|
|
395
|
-
this.action('error');
|
|
396
|
-
this.feature('error');
|
|
397
|
-
return this.error(e)
|
|
187
|
+
this.action('error'); // set the action to error
|
|
188
|
+
this.feature('error'); // set the feature to error
|
|
189
|
+
return this.error(e); // run error handling if an error is caught
|
|
398
190
|
}
|
|
399
191
|
}
|
|
400
192
|
|
|
@@ -426,10 +218,9 @@ class Deva {
|
|
|
426
218
|
return this.Solutions()
|
|
427
219
|
}
|
|
428
220
|
} catch (e) {
|
|
429
|
-
//
|
|
430
|
-
this.
|
|
431
|
-
this.
|
|
432
|
-
return this.error(e)
|
|
221
|
+
this.action('error'); // set the action to error
|
|
222
|
+
this.feature('error'); // set the feature to error
|
|
223
|
+
return this.error(e); // run error handling if an error is caught
|
|
433
224
|
}
|
|
434
225
|
}
|
|
435
226
|
|
|
@@ -444,26 +235,60 @@ class Deva {
|
|
|
444
235
|
this.feature('Solutions'); // set state to solutions setting
|
|
445
236
|
const _cl = this.client();
|
|
446
237
|
try {
|
|
447
|
-
if (!_cl.features.solutions) return this.
|
|
238
|
+
if (!_cl.features.solutions) return this.Research();
|
|
448
239
|
else {
|
|
449
240
|
this.action('Solutions');
|
|
450
|
-
const {id, features, profile} = _cl;
|
|
451
|
-
const {solutions} = features;
|
|
452
|
-
this._solutions = {
|
|
453
|
-
id: this.uid(true),
|
|
454
|
-
client_id: id,
|
|
455
|
-
client_name: profile.name,
|
|
456
|
-
concerns: solutions.concerns,
|
|
457
|
-
global: solutions.global,
|
|
458
|
-
personal: solutions.devas[this._agent.key]
|
|
241
|
+
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
242
|
+
const {solutions} = features; // set solutions from features const
|
|
243
|
+
this._solutions = { // set this_solutions with data
|
|
244
|
+
id: this.uid(true), // uuid of the solutions feature
|
|
245
|
+
client_id: id, // client id for reference
|
|
246
|
+
client_name: profile.name, // client name for personalization
|
|
247
|
+
concerns: solutions.concerns, // any concerns for client
|
|
248
|
+
global: solutions.global, // the global policies for client
|
|
249
|
+
personal: solutions.devas[this._agent.key], // Client personal features and rules.
|
|
459
250
|
};
|
|
460
251
|
delete this._client.features.solutions
|
|
461
|
-
return this.
|
|
252
|
+
return this.Research()
|
|
462
253
|
}
|
|
463
254
|
} catch (e) {
|
|
464
|
-
this.action('error');
|
|
465
|
-
this.feature('error');
|
|
466
|
-
return this.error(e)
|
|
255
|
+
this.action('error'); // set the action to error
|
|
256
|
+
this.feature('error'); // set the feature to error
|
|
257
|
+
return this.error(e); // run error handling if an error is caught
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**************
|
|
262
|
+
func: Research
|
|
263
|
+
params: client: false
|
|
264
|
+
describe:
|
|
265
|
+
The Research feature sets the correct variables and necessary rules for the
|
|
266
|
+
client presented data.
|
|
267
|
+
***************/
|
|
268
|
+
Research() {
|
|
269
|
+
this.feature('Research'); // set state to development setting
|
|
270
|
+
const _cl = this.client(); // set local client variable
|
|
271
|
+
try {
|
|
272
|
+
if (!_cl.features.research) return this.Development(); // if no research goto Business
|
|
273
|
+
else {
|
|
274
|
+
this.action('Research'); // set the action to Research
|
|
275
|
+
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
276
|
+
const {research} = features; // set research from features const
|
|
277
|
+
this._research = { // set this_research with data
|
|
278
|
+
id: this.uid(true), // uuid of the research feature
|
|
279
|
+
client_id: id, // client id for reference
|
|
280
|
+
client_name: profile.name, // client name for personalization
|
|
281
|
+
concerns: research.concerns, // any concerns for client
|
|
282
|
+
global: research.global, // the global policies for client
|
|
283
|
+
personal: research.devas[this._agent.key] // Client personal features and rules.
|
|
284
|
+
};
|
|
285
|
+
delete this._client.features.research // delete the research key from client features
|
|
286
|
+
return this.Development(); // goto Development.
|
|
287
|
+
}
|
|
288
|
+
} catch (e) {
|
|
289
|
+
this.action('error'); // set the action to error
|
|
290
|
+
this.feature('error'); // set the feature to error
|
|
291
|
+
return this.error(e); // run error handling if an error is caught
|
|
467
292
|
}
|
|
468
293
|
}
|
|
469
294
|
|
|
@@ -475,29 +300,29 @@ class Deva {
|
|
|
475
300
|
client presented data.
|
|
476
301
|
***************/
|
|
477
302
|
Development() {
|
|
478
|
-
this.feature('Development');
|
|
479
|
-
const _cl = this.client();
|
|
303
|
+
this.feature('Development'); // set state to development setting
|
|
304
|
+
const _cl = this.client(); // get hte client data to local variable
|
|
480
305
|
try {
|
|
481
|
-
if (!_cl.features.development) return this.Business();
|
|
306
|
+
if (!_cl.features.development) return this.Business(); // if no development goto Business
|
|
482
307
|
else {
|
|
483
|
-
this.action('Development');
|
|
484
|
-
const {id, features, profile} = _cl;
|
|
485
|
-
const {development} = features;
|
|
486
|
-
this._development = {
|
|
487
|
-
id: this.uid(true),
|
|
488
|
-
client_id: id,
|
|
489
|
-
client_name: profile.name,
|
|
490
|
-
concerns: development.concerns,
|
|
491
|
-
global: development.global,
|
|
492
|
-
personal: development.devas[this._agent.key]
|
|
308
|
+
this.action('Development'); // set the action to Development
|
|
309
|
+
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
310
|
+
const {development} = features; // set development from features const
|
|
311
|
+
this._development = { // set this_development with data
|
|
312
|
+
id: this.uid(true), // uuid of the development feature
|
|
313
|
+
client_id: id, // client id for reference
|
|
314
|
+
client_name: profile.name, // client name for personalization
|
|
315
|
+
concerns: development.concerns, // any concerns for client
|
|
316
|
+
global: development.global, // the global policies for client
|
|
317
|
+
personal: development.devas[this._agent.key], // Client personal features and rules.
|
|
493
318
|
};
|
|
494
|
-
delete this._client.features.development
|
|
495
|
-
return this.Business()
|
|
319
|
+
delete this._client.features.development; // delete the development key from client features.
|
|
320
|
+
return this.Business(); // goto business when development is done
|
|
496
321
|
}
|
|
497
322
|
} catch (e) {
|
|
498
|
-
this.action('error');
|
|
499
|
-
this.feature('error');
|
|
500
|
-
return this.error(e)
|
|
323
|
+
this.action('error'); // set the action to error
|
|
324
|
+
this.feature('error'); // set the feature to error
|
|
325
|
+
return this.error(e); // run error handling if an error is caught
|
|
501
326
|
}
|
|
502
327
|
}
|
|
503
328
|
|
|
@@ -508,30 +333,30 @@ class Deva {
|
|
|
508
333
|
The Business feature sets the correct variables and necessary rules for the
|
|
509
334
|
client presented data.
|
|
510
335
|
***************/
|
|
511
|
-
Business(
|
|
512
|
-
this.feature('Business');
|
|
513
|
-
const _cl = this.client();
|
|
336
|
+
Business() {
|
|
337
|
+
this.feature('Business'); // set state to business setting
|
|
338
|
+
const _cl = this.client(); // set client into local variable.
|
|
514
339
|
try {
|
|
515
|
-
if (!_cl.features.business) return this.Legal();
|
|
340
|
+
if (!_cl.features.business) return this.Legal(); // if no business hten goto legal
|
|
516
341
|
else {
|
|
517
|
-
this.action('Business');
|
|
518
|
-
const {id, features, profile} = _cl;
|
|
519
|
-
const {business} = features;
|
|
520
|
-
this._business = {
|
|
521
|
-
id: this.uid(true),
|
|
522
|
-
client_id: id,
|
|
523
|
-
client_name: profile.name,
|
|
524
|
-
concerns: business.concerns,
|
|
525
|
-
global: business.global,
|
|
526
|
-
personal: business.devas[this._agent.key]
|
|
342
|
+
this.action('Business'); // set action to Business
|
|
343
|
+
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
344
|
+
const {business} = features; // set business from features const
|
|
345
|
+
this._business = { // set this_business with data
|
|
346
|
+
id: this.uid(true), // uuid of the business feature
|
|
347
|
+
client_id: id, // client id for reference
|
|
348
|
+
client_name: profile.name, // client name for personalization
|
|
349
|
+
concerns: business.concerns, // any concerns for client
|
|
350
|
+
global: business.global, // the global policies for client
|
|
351
|
+
personal: business.devas[this._agent.key] // Client personal features and rules.
|
|
527
352
|
};
|
|
528
|
-
delete this._client.features.business
|
|
529
|
-
return this.Legal();
|
|
353
|
+
delete this._client.features.business; // delete the business key from the client features
|
|
354
|
+
return this.Legal(); // go to Legal when Business is done.
|
|
530
355
|
}
|
|
531
356
|
} catch (e) {
|
|
532
|
-
this.action('error');
|
|
533
|
-
this.feature('error');
|
|
534
|
-
return this.error(e)
|
|
357
|
+
this.action('error'); // set the action to error
|
|
358
|
+
this.feature('error'); // set the feature to error
|
|
359
|
+
return this.error(e); // run error handling if an error is caught
|
|
535
360
|
}
|
|
536
361
|
}
|
|
537
362
|
|
|
@@ -550,22 +375,22 @@ class Deva {
|
|
|
550
375
|
else {
|
|
551
376
|
this.action('Legal');
|
|
552
377
|
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
553
|
-
const {legal} = features;
|
|
554
|
-
this._legal = {
|
|
555
|
-
id: this.uid(true),
|
|
556
|
-
client_id: id,
|
|
557
|
-
client_name: profile.name,
|
|
558
|
-
concerns: legal.concerns,
|
|
559
|
-
global: legal.global,
|
|
560
|
-
personal: legal.devas[this._agent.key]
|
|
378
|
+
const {legal} = features; // set legal from features const
|
|
379
|
+
this._legal = { // set this_legal with data
|
|
380
|
+
id: this.uid(true), // uuid of the legal feature
|
|
381
|
+
client_id: id, // client id for reference
|
|
382
|
+
client_name: profile.name, // client name for personalization
|
|
383
|
+
concerns: legal.concerns, // any concerns for client
|
|
384
|
+
global: legal.global, // the global policies for client
|
|
385
|
+
personal: legal.devas[this._agent.key], // Client personal features and rules.
|
|
561
386
|
};
|
|
562
387
|
delete this._client.features.legal;
|
|
563
388
|
return this.Assistant();
|
|
564
389
|
}
|
|
565
390
|
} catch (e) {
|
|
566
|
-
this.action('error');
|
|
567
|
-
this.feature('error');
|
|
568
|
-
return this.error(e)
|
|
391
|
+
this.action('error'); // set the action to error
|
|
392
|
+
this.feature('error'); // set the feature to error
|
|
393
|
+
return this.error(e); // run error handling if an error is caught
|
|
569
394
|
}
|
|
570
395
|
}
|
|
571
396
|
|
|
@@ -576,30 +401,30 @@ class Deva {
|
|
|
576
401
|
The Assistant feature sets the correct variables and necessary rules for the
|
|
577
402
|
client presented data.
|
|
578
403
|
***************/
|
|
579
|
-
Assistant(
|
|
580
|
-
this.feature('Assistant');
|
|
581
|
-
const _cl = this.client();
|
|
404
|
+
Assistant() {
|
|
405
|
+
this.feature('Assistant'); // set state to assistant setting
|
|
406
|
+
const _cl = this.client(); // set the client into a local variable
|
|
582
407
|
try {
|
|
583
|
-
if (!_cl.features.assistant) return this.
|
|
408
|
+
if (!_cl.features.assistant) return this.Story(); // if no Assistant then goto Done
|
|
584
409
|
else {
|
|
585
|
-
this.action('Assistant');
|
|
586
|
-
const {id, features, profile} = _cl;
|
|
587
|
-
const {assistant} = features;
|
|
588
|
-
this._assistant = {
|
|
589
|
-
id: this.uid(true),
|
|
590
|
-
client_id: id,
|
|
591
|
-
client_name: profile.name,
|
|
592
|
-
concerns: assistant.concerns,
|
|
593
|
-
global: assistant.global,
|
|
594
|
-
personal: assistant.devas[this._agent.key]
|
|
410
|
+
this.action('Assistant'); // set action to Assistant
|
|
411
|
+
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
412
|
+
const {assistant} = features; // set assistant from features const
|
|
413
|
+
this._assistant = { // set this_assistant with data
|
|
414
|
+
id: this.uid(true), // uuid of the assistant feature
|
|
415
|
+
client_id: id, // client id for reference
|
|
416
|
+
client_name: profile.name, // client name for personalization
|
|
417
|
+
concerns: assistant.concerns, // any concerns for client
|
|
418
|
+
global: assistant.global, // the global policies for client
|
|
419
|
+
personal: assistant.devas[this._agent.key] // Client personal features and rules.
|
|
595
420
|
};
|
|
596
|
-
delete this._client.features.assistant;
|
|
597
|
-
return this.Story();
|
|
421
|
+
delete this._client.features.assistant; // delete the assistant key from client features
|
|
422
|
+
return this.Story(); // when assistant is done goto Story.
|
|
598
423
|
}
|
|
599
424
|
} catch (e) {
|
|
600
|
-
this.action('error');
|
|
601
|
-
this.feature('error');
|
|
602
|
-
return this.error(e)
|
|
425
|
+
this.action('error'); // set the action to error
|
|
426
|
+
this.feature('error'); // set the feature to error
|
|
427
|
+
return this.error(e); // run error handling if an error is caught
|
|
603
428
|
}
|
|
604
429
|
}
|
|
605
430
|
|
|
@@ -610,30 +435,30 @@ class Deva {
|
|
|
610
435
|
The Story feature sets the correct variables and necessary rules for the
|
|
611
436
|
client presented data.
|
|
612
437
|
***************/
|
|
613
|
-
Story(
|
|
614
|
-
this.feature('Story');
|
|
615
|
-
const _cl = this.client();
|
|
438
|
+
Story() {
|
|
439
|
+
this.feature('Story'); // set feature to Story
|
|
440
|
+
const _cl = this.client(); // set local client variable
|
|
616
441
|
try {
|
|
617
|
-
if (!this._client.features.story) return this.Mind();
|
|
442
|
+
if (!this._client.features.story) return this.Mind(); // if no story goto Mind
|
|
618
443
|
else {
|
|
619
|
-
this.action('Story');
|
|
620
|
-
const {id, features, profile} = this._client;
|
|
621
|
-
const {story} = features;
|
|
622
|
-
this._story = {
|
|
623
|
-
id: this.uid(true),
|
|
624
|
-
client_id: id,
|
|
625
|
-
client_name: profile.name,
|
|
626
|
-
concerns: story.concerns,
|
|
627
|
-
global: story.global,
|
|
628
|
-
personal: story.devas[this._agent.key]
|
|
444
|
+
this.action('Story'); // set action to Story
|
|
445
|
+
const {id, features, profile} = this._client; // set the local consts from client copy
|
|
446
|
+
const {story} = features; // set story from features const
|
|
447
|
+
this._story = { // set this_story with data
|
|
448
|
+
id: this.uid(true), // uuid of the story feature
|
|
449
|
+
client_id: id, // client id for reference
|
|
450
|
+
client_name: profile.name, // client name for personalization
|
|
451
|
+
concerns: story.concerns, // any concerns for client
|
|
452
|
+
global: story.global, // the global policies for client
|
|
453
|
+
personal: story.devas[this._agent.key], // Client personal features and rules.
|
|
629
454
|
};
|
|
630
|
-
delete this._client.features.story;
|
|
631
|
-
return this.Mind();
|
|
455
|
+
delete this._client.features.story; // delete story object from client
|
|
456
|
+
return this.Mind(); // when done with Story goto Mind
|
|
632
457
|
}
|
|
633
458
|
} catch (e) {
|
|
634
|
-
this.action('error');
|
|
635
|
-
this.feature('error');
|
|
636
|
-
return this.error(e)
|
|
459
|
+
this.action('error'); // set the action to error
|
|
460
|
+
this.feature('error'); // set the feature to error
|
|
461
|
+
return this.error(e); // run error handling if an error is caught
|
|
637
462
|
}
|
|
638
463
|
}
|
|
639
464
|
|
|
@@ -644,30 +469,30 @@ class Deva {
|
|
|
644
469
|
The Mind feature sets the correct variables and necessary rules for the
|
|
645
470
|
client presented data.
|
|
646
471
|
***************/
|
|
647
|
-
Mind(
|
|
472
|
+
Mind() {
|
|
648
473
|
this.feature('Mind'); // set state to story setting
|
|
649
474
|
const _cl = this.client();
|
|
650
475
|
try {
|
|
651
476
|
if (!_cl.features.mind) return this.Done();
|
|
652
477
|
else {
|
|
653
478
|
this.action('Mind');
|
|
654
|
-
const {id, features, profile} = _cl;
|
|
655
|
-
const {mind} = features;
|
|
656
|
-
this._mind = {
|
|
657
|
-
id: this.uid(true),
|
|
658
|
-
client_id: id,
|
|
659
|
-
client_name: profile.name,
|
|
660
|
-
concerns: mind.concerns,
|
|
661
|
-
global: mind.global,
|
|
662
|
-
personal: mind.devas[this._agent.key]
|
|
479
|
+
const {id, features, profile} = _cl; // set the local consts from client copy
|
|
480
|
+
const {mind} = features; // set mind from features const
|
|
481
|
+
this._mind = { // set this_mind with data
|
|
482
|
+
id: this.uid(true), // uuid of the mind feature
|
|
483
|
+
client_id: id, // client id for reference
|
|
484
|
+
client_name: profile.name, // client name for personalization
|
|
485
|
+
concerns: mind.concerns, // any concerns for client
|
|
486
|
+
global: mind.global, // the global policies for client
|
|
487
|
+
personal: mind.devas[this._agent.key], // Client personal features and rules.
|
|
663
488
|
};
|
|
664
489
|
delete this._client.features.mind;
|
|
665
490
|
return this.Done();
|
|
666
491
|
}
|
|
667
492
|
} catch (e) {
|
|
668
|
-
this.action('error');
|
|
669
|
-
this.feature('error');
|
|
670
|
-
return this.error(e)
|
|
493
|
+
this.action('error'); // set the action to error
|
|
494
|
+
this.feature('error'); // set the feature to error
|
|
495
|
+
return this.error(e); // run error handling if an error is caught
|
|
671
496
|
}
|
|
672
497
|
}
|
|
673
498
|
|
|
@@ -676,13 +501,13 @@ class Deva {
|
|
|
676
501
|
params: none
|
|
677
502
|
describe: The end of the workflow Client Feature Workflow
|
|
678
503
|
***************/
|
|
679
|
-
Done() {
|
|
504
|
+
Done(client) {
|
|
680
505
|
return new Promise((resolve, reject) => {
|
|
681
506
|
try {
|
|
682
|
-
delete this._client.features;
|
|
683
|
-
this.action('done');
|
|
684
|
-
this.feature('done');
|
|
685
|
-
return resolve();
|
|
507
|
+
delete this._client.features; // delete the features key when done.
|
|
508
|
+
this.action('done'); // set state to assistant setting
|
|
509
|
+
this.feature('done'); // set state to assistant setting
|
|
510
|
+
return resolve(); // resolve an empty pr
|
|
686
511
|
} catch (e) {
|
|
687
512
|
this.feature('error')
|
|
688
513
|
return this.error(e, false, reject);
|
|
@@ -699,10 +524,10 @@ class Deva {
|
|
|
699
524
|
_assignBind() {
|
|
700
525
|
return new Promise((resolve, reject) => {
|
|
701
526
|
try {
|
|
702
|
-
this.bind.forEach(bind => {
|
|
703
|
-
if (this[bind]) for (let x in this[bind]) {
|
|
704
|
-
if (typeof this[bind][x] === 'function') {
|
|
705
|
-
this[bind][x] = this[bind][x].bind(this);
|
|
527
|
+
this.bind.forEach(bind => { // loop over the bind items func, method, listener...
|
|
528
|
+
if (this[bind]) for (let x in this[bind]) { // if the root has a bind func, method, listener
|
|
529
|
+
if (typeof this[bind][x] === 'function') { // check to make sure object is a fucntion
|
|
530
|
+
this[bind][x] = this[bind][x].bind(this); // bind the item from the bind object
|
|
706
531
|
}
|
|
707
532
|
}
|
|
708
533
|
});
|
|
@@ -714,10 +539,10 @@ class Deva {
|
|
|
714
539
|
if (parse) this._agent.parse = this._agent.parse.bind(this);
|
|
715
540
|
}
|
|
716
541
|
catch (e) {
|
|
717
|
-
return this.error(e, false, reject);
|
|
542
|
+
return this.error(e, false, reject); // trigger the this.error for errors
|
|
718
543
|
}
|
|
719
544
|
finally {
|
|
720
|
-
return resolve();
|
|
545
|
+
return resolve(); // when the configuration is complete then return an empty resolve.
|
|
721
546
|
}
|
|
722
547
|
});
|
|
723
548
|
}
|
|
@@ -811,15 +636,6 @@ class Deva {
|
|
|
811
636
|
return packet;
|
|
812
637
|
}
|
|
813
638
|
|
|
814
|
-
/**************
|
|
815
|
-
func: states
|
|
816
|
-
params: none
|
|
817
|
-
describe: returns the avaiable staets values.
|
|
818
|
-
***************/
|
|
819
|
-
states() {
|
|
820
|
-
return this._states;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
639
|
/**************
|
|
824
640
|
func: talk
|
|
825
641
|
params:
|
|
@@ -1351,6 +1167,15 @@ class Deva {
|
|
|
1351
1167
|
}
|
|
1352
1168
|
}
|
|
1353
1169
|
|
|
1170
|
+
/**************
|
|
1171
|
+
func: states
|
|
1172
|
+
params: none
|
|
1173
|
+
describe: returns the avaiable staets values.
|
|
1174
|
+
***************/
|
|
1175
|
+
states() {
|
|
1176
|
+
return this._states;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1354
1179
|
/**************
|
|
1355
1180
|
func: zone
|
|
1356
1181
|
params:
|
|
@@ -1519,7 +1344,7 @@ class Deva {
|
|
|
1519
1344
|
try {
|
|
1520
1345
|
if (!this._active) return this._messages.states.offline; // check the active status
|
|
1521
1346
|
this.action('services'); // set the services state
|
|
1522
|
-
return this._services; // return the services feature
|
|
1347
|
+
return this.copy(this._services); // return the services feature
|
|
1523
1348
|
} catch (e) {
|
|
1524
1349
|
this.action('error'); // set the services state
|
|
1525
1350
|
this.feature('error');
|
|
@@ -1538,7 +1363,7 @@ class Deva {
|
|
|
1538
1363
|
try {
|
|
1539
1364
|
if (!this._active) return this._messages.states.offline; // check the active status
|
|
1540
1365
|
this.action('systems'); // set the systems state
|
|
1541
|
-
return this._systems; // return the systems feature
|
|
1366
|
+
return this.copy(this._systems); // return the systems feature
|
|
1542
1367
|
} catch (e) {
|
|
1543
1368
|
this.action('error'); // set the systems state
|
|
1544
1369
|
this.feature('error');
|
|
@@ -1557,7 +1382,7 @@ class Deva {
|
|
|
1557
1382
|
try {
|
|
1558
1383
|
if (!this._active) return this._messages.states.offline; // check the active status
|
|
1559
1384
|
this.action('solutions'); // set the solutions state
|
|
1560
|
-
return this._solutions; // return the solutions feature
|
|
1385
|
+
return this.copy(this._solutions); // return the solutions feature
|
|
1561
1386
|
} catch (e) {
|
|
1562
1387
|
this.action('error'); // set the systems state
|
|
1563
1388
|
this.feature('error');
|
|
@@ -1565,6 +1390,24 @@ class Deva {
|
|
|
1565
1390
|
}
|
|
1566
1391
|
}
|
|
1567
1392
|
|
|
1393
|
+
/**************
|
|
1394
|
+
func: research
|
|
1395
|
+
params: opts
|
|
1396
|
+
describe: basic research features available in a Deva.
|
|
1397
|
+
***************/
|
|
1398
|
+
research(opts) {
|
|
1399
|
+
this.feature('research'); // set the research state
|
|
1400
|
+
try {
|
|
1401
|
+
if (!this._active) return this._messages.states.offline; // chek the active status
|
|
1402
|
+
this.action('research'); // set the research state
|
|
1403
|
+
return this.copy(this._research); // return research feature
|
|
1404
|
+
} catch (e) {
|
|
1405
|
+
this.action('error');
|
|
1406
|
+
this.feature('error');
|
|
1407
|
+
return this.error(e);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1568
1411
|
/**************
|
|
1569
1412
|
func: development
|
|
1570
1413
|
params: opts
|
|
@@ -1575,7 +1418,7 @@ class Deva {
|
|
|
1575
1418
|
try {
|
|
1576
1419
|
if (!this._active) return this._messages.states.offline; // chek the active status
|
|
1577
1420
|
this.action('development'); // set the development state
|
|
1578
|
-
return this._development; // return development feature
|
|
1421
|
+
return this.copy(this._development); // return development feature
|
|
1579
1422
|
} catch (e) {
|
|
1580
1423
|
this.action('error');
|
|
1581
1424
|
this.feature('error');
|
|
@@ -1593,7 +1436,7 @@ class Deva {
|
|
|
1593
1436
|
try {
|
|
1594
1437
|
if (!this._active) return this._messages.states.offline; // chek the active status
|
|
1595
1438
|
this.action('assistant'); // set the assistant state
|
|
1596
|
-
return this._assistant; // return assistant feature
|
|
1439
|
+
return this.copy(this._assistant); // return assistant feature
|
|
1597
1440
|
} catch (e) {
|
|
1598
1441
|
this.action('error');
|
|
1599
1442
|
this.feature('error');
|
|
@@ -1611,7 +1454,7 @@ class Deva {
|
|
|
1611
1454
|
try {
|
|
1612
1455
|
if (!this._active) return this._messages.states.offline; // chek the active status
|
|
1613
1456
|
this.action('business');
|
|
1614
|
-
return this._business; // return business feature
|
|
1457
|
+
return this.copy(this._business); // return business feature
|
|
1615
1458
|
} catch (e) {
|
|
1616
1459
|
this.action('error');
|
|
1617
1460
|
this.feature('error');
|
|
@@ -1629,7 +1472,7 @@ class Deva {
|
|
|
1629
1472
|
try {
|
|
1630
1473
|
if (!this._active) return this._messages.states.offline; // chek the active status
|
|
1631
1474
|
this.action('legal');
|
|
1632
|
-
return this._legal; // return legal feature
|
|
1475
|
+
return this.copy(this._legal); // return legal feature
|
|
1633
1476
|
} catch (e) {
|
|
1634
1477
|
this.action('error');
|
|
1635
1478
|
this.feature('error');
|
|
@@ -1647,7 +1490,7 @@ class Deva {
|
|
|
1647
1490
|
try {
|
|
1648
1491
|
if (!this._active) return this._messages.states.offline; // chek the active status
|
|
1649
1492
|
this.action('story');
|
|
1650
|
-
return this._story; // return story feature
|
|
1493
|
+
return this.story(this._story); // return story feature
|
|
1651
1494
|
} catch (e) {
|
|
1652
1495
|
this.action('error');
|
|
1653
1496
|
this.feature('error');
|
|
@@ -1664,7 +1507,7 @@ class Deva {
|
|
|
1664
1507
|
***************/
|
|
1665
1508
|
load(key, client) {
|
|
1666
1509
|
return new Promise((resolve, reject) => {
|
|
1667
|
-
this.state('load'
|
|
1510
|
+
this.state('load');
|
|
1668
1511
|
this.devas[key].init(client).then(loaded => {
|
|
1669
1512
|
this.talk(`devacore:load`, {
|
|
1670
1513
|
id:this.uid(true),
|