@indra.ai/deva 1.1.70 → 1.1.72

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.
Files changed (3) hide show
  1. package/config.json +232 -0
  2. package/index.js +200 -359
  3. package/package.json +1 -1
package/config.json ADDED
@@ -0,0 +1,232 @@
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
+ "messages": {
128
+ "states": {
129
+ "offline": "🛌 ::agent.name:: offline state",
130
+ "online": "🌞 ::agent.name:: online state",
131
+ "ask": "😎 ::agent.name:: ask state",
132
+ "question": "🎙️ ::agent.name:: question state",
133
+ "answer": "🎟️ ::agent.name:: answer state",
134
+ "init": "🚀 ::agent.name:: init state",
135
+ "start": "🚙 ::agent.name:: start state",
136
+ "enter": "🪐 ::agent.name:: enter state",
137
+ "stop": "✋ ::agent.name:: stop state",
138
+ "exit": "🚪 ::agent.name:: exit state",
139
+ "load": "📫 ::agent.name:: load state",
140
+ "unload": "📭 ::agent.name:: is this._states.unload",
141
+ "invalid": "⚠️ ::agent.name:: invalid state",
142
+ "done": "✅ ::agent.name:: done state",
143
+ "error": "❌ ::agent.name:: error state"
144
+ },
145
+ "zones": {
146
+ "deva": "🎉 ::agent.name:: deva zone",
147
+ "config": "🦾 ::agent.name:: config zone",
148
+ "features": "🍿 ::agent.name:: features zone",
149
+ "idle": "😜 ::agent.name:: idle zone",
150
+ "training": "🥋 ::agent.name:: train zone",
151
+ "school": "👨‍🏫 ::agent.name:: work zone",
152
+ "work": "‍🗂️ ::agent.name:: work zone",
153
+ "invalid": "⚠️ ::agent.name:: invalid zone",
154
+ "done": "✅ ::agent.name:: done zone",
155
+ "error": "❌ ::agent.name:: erro zone"
156
+ },
157
+ "actions": {
158
+ "wait": "😵‍💫 ::agent.name:: wait action",
159
+ "question": "👀 ::agent.name:: question action",
160
+ "question_ask": "👥 ::agent.name:: question_ask action",
161
+ "question_ask_answer": "📣 ::agent.name:: question_ask_answer action",
162
+ "question_cmd": "🎮 ::agent.name:: question_cmd action",
163
+ "question_method": "🏄‍♂️ ::agent.name:: question_method action",
164
+ "question_talk": "📢 ::agent.name:: question_talk action",
165
+ "question_answer": "🎙️ ::agent.name:: question_answer action",
166
+ "question_done": "👍 ::agent.name:: question_done action",
167
+ "answer": "🎟️ ::agent.name:: answer action",
168
+ "answer_talk": "🎟️ ::agent.name:: answer_talk action",
169
+ "ask": "👥 ::agent.name:: answer.ask action",
170
+ "ask_answer": "🎟️ ::agent.name:: ask_answer action",
171
+
172
+ "security": "👮‍♀️ security actio",
173
+ "Security": "👮‍♂️ Security read",
174
+ "support": "👩‍⚕️ support actio",
175
+ "Support": "👨‍⚕️ Support read",
176
+ "services": "👩‍🔧 services actio",
177
+ "Services": "👨‍🔧 Services read",
178
+ "solutions": "👩‍🚀 solutions actio",
179
+ "Solutions": "👨‍🚀 Solutions read",
180
+ "systems": "👷‍♀️ systems actio",
181
+ "Systems": "👷‍♂️ Systems read",
182
+ "research": "👩‍🔬 research actio",
183
+ "Research": "👨‍🔬 Research read",
184
+ "development": "👩‍💻 development actio",
185
+ "Development": "👨‍💻 Development read",
186
+ "business": "👩‍💼 business actio",
187
+ "Business": "👨‍💼 Business read",
188
+ "legal": "👩‍⚖️ legal actio",
189
+ "Legal": "👩‍⚖️ Legal read",
190
+ "assistant": "👩 assistant actio",
191
+ "Assistant": "👨 Assistant read",
192
+ "story": "👩‍🏫 story actio",
193
+ "Story": "👨‍🏫 Story read",
194
+ "mind": "🧘‍♀️ mind actio",
195
+ "Mind": "🧘‍♂️ Mind read",
196
+ "client_data": "📂 ::agent.name:: configure",
197
+ "invalid": "⚠️ invalid",
198
+ "done": "✅ done",
199
+ "error": "❌ this._action.erro"
200
+ },
201
+ "features": {
202
+ "security": "🔐 security feature",
203
+ "Security": "🔐 Security configure",
204
+ "support": "💼 support feature",
205
+ "Support": "💼 Support configure",
206
+ "services": "🛠️ services feature",
207
+ "Services": "🛠️ Services configure",
208
+ "solutions": "💡 solutions feature",
209
+ "Solutions": "💡 Solutions configure",
210
+ "systems": "🖥️ systems feature",
211
+ "Systems": "🖥️ Systems configure",
212
+ "research": "🔬 research feature",
213
+ "Research": "🔬 Research configure",
214
+ "development": "🔧 development feature",
215
+ "Development": "🔧 Development configure",
216
+ "business": "📊 business feature",
217
+ "Business": "📊 Business configure",
218
+ "legal": "⚖️ legal feature",
219
+ "Legal": "⚖️ Legal configure",
220
+ "assistant": "👤 assistant feature",
221
+ "Assistant": "👤 Assistant configure",
222
+ "story": "📚 story feature",
223
+ "Story": "📚 Story configure",
224
+ "mind": "🧠 story feature",
225
+ "Mind": "🧠 Mind configure",
226
+ "invalid": "⚠️ feature invalid",
227
+ "done": "✅ feature done",
228
+ "error": "❌ feature error"
229
+ }
230
+ }
231
+ }
232
+ }
package/index.js CHANGED
@@ -3,7 +3,7 @@
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 || {};
@@ -18,9 +18,10 @@ class Deva {
18
18
  this._support = false; // inherited Support features.
19
19
  this._services = false; // inherited Service features.
20
20
  this._business = false; // inherited Business features.
21
- this._development = false; // inherited Business features.
21
+ this._development = false; // inherited Development features.
22
+ this._research = false; // inherited Research features.
22
23
  this._legal = false; // inherited Legal features.
23
- this._story = false; // inherited Assistant features.
24
+ this._story = false; // inherited Story features.
24
25
  this.events = opts.events || new EventEmitter({}); // Event Bus
25
26
  this.lib = opts.lib || {}; // used for loading library functions
26
27
  this.devas = opts.devas || {}; // Devas which are loaded
@@ -36,244 +37,32 @@ class Deva {
36
37
  if (!this[opt] || !this[`_${opt}`]) this[opt] = opts[opt];
37
38
  }
38
39
 
39
- this.cmdChr = '/'; // the trigger for local commands
40
- this.askChr = '#'; // the trigger for ask other DEva features
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
- }
40
+ this.cmdChr = config.cmdChr; // the trigger for local commands
41
+ this.askChr = config.askChr; // the trigger for ask other DEva features
136
42
 
137
- this._feature = false;
138
- this._features = {
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
- };
43
+ this.inherit = config.inherit; // set inherit from config
44
+ this.bind = config.bind; // set the bind from the config
166
45
 
167
- this._messages = {
168
- states: {
169
- offline: `🛌 ${this._agent.profile.name} ${this._states.offline}`,
170
- online: `🌞 ${this._agent.profile.name} ${this._states.online}`,
171
- ask: `😎 ${this._agent.profile.name} ${this._states.ask}`,
172
- question: `🎙️ ${this._agent.profile.name} ${this._states.question}`,
173
- answer: `🎟️ ${this._agent.profile.name} ${this._states.answer}`,
174
- init: `🚀 ${this._agent.profile.name} ${this._states.init}`,
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
46
+ this._state = config.state; // set the current state from config
47
+ this._states = config.states; // set the states from config
48
+
49
+ this._zone = config.zone; // set the current zone from config
50
+ this._zones = config.zones; // set the zones from config
51
+
52
+ this._action = config.action; // set the action from config
53
+ this._actions = config.actions; // set the actions from config
54
+
55
+ this._feature = config.feature; // set the feature from config
56
+ this._features = config.features; // set the features from config
57
+
58
+ this._messages = {}; // set the messages from config
59
+ // then here we are going to loop the messages config to make sure custom values are set
60
+ for (let x in config.messages) {
61
+ this._messages[x] = {};
62
+ for (let y in config.messages[x]) {
63
+ this._messages[x][y] = config.messages[x][y].replace('::agent.name::', opts.agent.profile.name);
64
+ }
65
+ }
277
66
  }
278
67
 
279
68
 
@@ -444,7 +233,7 @@ class Deva {
444
233
  this.feature('Solutions'); // set state to solutions setting
445
234
  const _cl = this.client();
446
235
  try {
447
- if (!_cl.features.solutions) return this.Development();
236
+ if (!_cl.features.solutions) return this.Research();
448
237
  else {
449
238
  this.action('Solutions');
450
239
  const {id, features, profile} = _cl; // set the local consts from client copy
@@ -458,7 +247,7 @@ class Deva {
458
247
  personal: solutions.devas[this._agent.key] // Client personal features and rules.
459
248
  };
460
249
  delete this._client.features.solutions
461
- return this.Development()
250
+ return this.Research()
462
251
  }
463
252
  } catch (e) {
464
253
  this.action('error');
@@ -467,6 +256,40 @@ class Deva {
467
256
  }
468
257
  }
469
258
 
259
+ /**************
260
+ func: Research
261
+ params: client: false
262
+ describe:
263
+ The Research feature sets the correct variables and necessary rules for the
264
+ client presented data.
265
+ ***************/
266
+ Research() {
267
+ this.feature('Research'); // set state to development setting
268
+ const _cl = this.client();
269
+ try {
270
+ if (!_cl.features.research) return this.Development(); // if no research goto Business
271
+ else {
272
+ this.action('Research'); // set the action to Research
273
+ const {id, features, profile} = _cl; // set the local consts from client copy
274
+ const {research} = features; // set research from features const
275
+ this._research = { // set this_research with data
276
+ id: this.uid(true), // uuid of the research feature
277
+ client_id: id, // client id for reference
278
+ client_name: profile.name, // client name for personalization
279
+ concerns: research.concerns, // any concerns for client
280
+ global: research.global, // the global policies for client
281
+ personal: research.devas[this._agent.key] // Client personal features and rules.
282
+ };
283
+ delete this._client.features.research // delete the research key from client features
284
+ return this.Development(); // goto Development.
285
+ }
286
+ } catch (e) {
287
+ this.action('error'); // set the action to error
288
+ this.feature('error'); // set the feature to error
289
+ return this.error(e); // run error handling if an error is caught
290
+ }
291
+ }
292
+
470
293
  /**************
471
294
  func: Development
472
295
  params: client: false
@@ -475,29 +298,29 @@ class Deva {
475
298
  client presented data.
476
299
  ***************/
477
300
  Development() {
478
- this.feature('Development'); // set state to development setting
479
- const _cl = this.client();
301
+ this.feature('Development'); // set state to development setting
302
+ const _cl = this.client(); // get hte client data to local variable
480
303
  try {
481
- if (!_cl.features.development) return this.Business();
304
+ if (!_cl.features.development) return this.Business(); // if no development goto Business
482
305
  else {
483
- this.action('Development');
484
- const {id, features, profile} = _cl; // set the local consts from client copy
485
- const {development} = features; // set development from features const
486
- this._development = { // set this_development with data
487
- id: this.uid(true), // uuid of the development feature
488
- client_id: id, // client id for reference
489
- client_name: profile.name, // client name for personalization
490
- concerns: development.concerns, // any concerns for client
491
- global: development.global, // the global policies for client
492
- personal: development.devas[this._agent.key] // Client personal features and rules.
306
+ this.action('Development'); // set the action to Development
307
+ const {id, features, profile} = _cl; // set the local consts from client copy
308
+ const {development} = features; // set development from features const
309
+ this._development = { // set this_development with data
310
+ id: this.uid(true), // uuid of the development feature
311
+ client_id: id, // client id for reference
312
+ client_name: profile.name, // client name for personalization
313
+ concerns: development.concerns, // any concerns for client
314
+ global: development.global, // the global policies for client
315
+ personal: development.devas[this._agent.key], // Client personal features and rules.
493
316
  };
494
- delete this._client.features.development
495
- return this.Business()
317
+ delete this._client.features.development; // delete the development key from client features.
318
+ return this.Business(); // goto business when development is done
496
319
  }
497
320
  } catch (e) {
498
- this.action('error');
499
- this.feature('error');
500
- return this.error(e) // run error handling if an error is caught
321
+ this.action('error'); // set the action to error
322
+ this.feature('error'); // set the feature to error
323
+ return this.error(e); // run error handling if an error is caught
501
324
  }
502
325
  }
503
326
 
@@ -508,30 +331,30 @@ class Deva {
508
331
  The Business feature sets the correct variables and necessary rules for the
509
332
  client presented data.
510
333
  ***************/
511
- Business(client=false) {
512
- this.feature('Business'); // set state to business setting
513
- const _cl = this.client();
334
+ Business() {
335
+ this.feature('Business'); // set state to business setting
336
+ const _cl = this.client(); // set client into local variable.
514
337
  try {
515
- if (!_cl.features.business) return this.Legal();
338
+ if (!_cl.features.business) return this.Legal(); // if no business hten goto legal
516
339
  else {
517
- this.action('Business');
518
- const {id, features, profile} = _cl; // set the local consts from client copy
519
- const {business} = features; // set business from features const
520
- this._business = { // set this_business with data
521
- id: this.uid(true), // uuid of the business feature
522
- client_id: id, // client id for reference
523
- client_name: profile.name, // client name for personalization
524
- concerns: business.concerns, // any concerns for client
525
- global: business.global, // the global policies for client
526
- personal: business.devas[this._agent.key] // Client personal features and rules.
340
+ this.action('Business'); // set action to Business
341
+ const {id, features, profile} = _cl; // set the local consts from client copy
342
+ const {business} = features; // set business from features const
343
+ this._business = { // set this_business with data
344
+ id: this.uid(true), // uuid of the business feature
345
+ client_id: id, // client id for reference
346
+ client_name: profile.name, // client name for personalization
347
+ concerns: business.concerns, // any concerns for client
348
+ global: business.global, // the global policies for client
349
+ personal: business.devas[this._agent.key] // Client personal features and rules.
527
350
  };
528
- delete this._client.features.business
529
- return this.Legal();
351
+ delete this._client.features.business; // delete the business key from the client features
352
+ return this.Legal(); // go to Legal when Business is done.
530
353
  }
531
354
  } catch (e) {
532
- this.action('error');
533
- this.feature('error');
534
- return this.error(e) // run error handling if an error is caught
355
+ this.action('error'); // set the action to error
356
+ this.feature('error'); // set the feature to error
357
+ return this.error(e); // run error handling if an error is caught
535
358
  }
536
359
  }
537
360
 
@@ -550,22 +373,22 @@ class Deva {
550
373
  else {
551
374
  this.action('Legal');
552
375
  const {id, features, profile} = _cl; // set the local consts from client copy
553
- const {legal} = features; // set legal from features const
554
- this._legal = { // set this_legal with data
555
- id: this.uid(true), // uuid of the legal feature
556
- client_id: id, // client id for reference
557
- client_name: profile.name, // client name for personalization
558
- concerns: legal.concerns, // any concerns for client
559
- global: legal.global, // the global policies for client
560
- personal: legal.devas[this._agent.key] // Client personal features and rules.
376
+ const {legal} = features; // set legal from features const
377
+ this._legal = { // set this_legal with data
378
+ id: this.uid(true), // uuid of the legal feature
379
+ client_id: id, // client id for reference
380
+ client_name: profile.name, // client name for personalization
381
+ concerns: legal.concerns, // any concerns for client
382
+ global: legal.global, // the global policies for client
383
+ personal: legal.devas[this._agent.key], // Client personal features and rules.
561
384
  };
562
385
  delete this._client.features.legal;
563
386
  return this.Assistant();
564
387
  }
565
388
  } catch (e) {
566
- this.action('error');
567
- this.feature('error');
568
- return this.error(e) // run error handling if an error is caught
389
+ this.action('error'); // set the action to error
390
+ this.feature('error'); // set the feature to error
391
+ return this.error(e); // run error handling if an error is caught
569
392
  }
570
393
  }
571
394
 
@@ -576,30 +399,30 @@ class Deva {
576
399
  The Assistant feature sets the correct variables and necessary rules for the
577
400
  client presented data.
578
401
  ***************/
579
- Assistant(client=false) {
580
- this.feature('Assistant'); // set state to assistant setting
581
- const _cl = this.client();
402
+ Assistant() {
403
+ this.feature('Assistant'); // set state to assistant setting
404
+ const _cl = this.client(); // set the client into a local variable
582
405
  try {
583
- if (!_cl.features.assistant) return this.Done();
406
+ if (!_cl.features.assistant) return this.Story(); // if no Assistant then goto Done
584
407
  else {
585
- this.action('Assistant');
586
- const {id, features, profile} = _cl; // set the local consts from client copy
587
- const {assistant} = features; // set assistant from features const
588
- this._assistant = { // set this_assistant with data
589
- id: this.uid(true), // uuid of the assistant feature
590
- client_id: id, // client id for reference
591
- client_name: profile.name, // client name for personalization
592
- concerns: assistant.concerns, // any concerns for client
593
- global: assistant.global, // the global policies for client
594
- personal: assistant.devas[this._agent.key] // Client personal features and rules.
408
+ this.action('Assistant'); // set action to Assistant
409
+ const {id, features, profile} = _cl; // set the local consts from client copy
410
+ const {assistant} = features; // set assistant from features const
411
+ this._assistant = { // set this_assistant with data
412
+ id: this.uid(true), // uuid of the assistant feature
413
+ client_id: id, // client id for reference
414
+ client_name: profile.name, // client name for personalization
415
+ concerns: assistant.concerns, // any concerns for client
416
+ global: assistant.global, // the global policies for client
417
+ personal: assistant.devas[this._agent.key] // Client personal features and rules.
595
418
  };
596
- delete this._client.features.assistant;
597
- return this.Story();
419
+ delete this._client.features.assistant; // delete the assistant key from client features
420
+ return this.Story(); // when assistant is done goto Story.
598
421
  }
599
422
  } catch (e) {
600
- this.action('error');
601
- this.feature('error');
602
- return this.error(e) // run error handling if an error is caught
423
+ this.action('error'); // set the action to error
424
+ this.feature('error'); // set the feature to error
425
+ return this.error(e); // run error handling if an error is caught
603
426
  }
604
427
  }
605
428
 
@@ -610,7 +433,7 @@ class Deva {
610
433
  The Story feature sets the correct variables and necessary rules for the
611
434
  client presented data.
612
435
  ***************/
613
- Story(client=false) {
436
+ Story() {
614
437
  this.feature('Story'); // set state to story setting
615
438
  const _cl = this.client();
616
439
  try {
@@ -631,9 +454,9 @@ class Deva {
631
454
  return this.Mind();
632
455
  }
633
456
  } catch (e) {
634
- this.action('error');
635
- this.feature('error');
636
- return this.error(e) // run error handling if an error is caught
457
+ this.action('error'); // set the action to error
458
+ this.feature('error'); // set the feature to error
459
+ return this.error(e); // run error handling if an error is caught
637
460
  }
638
461
  }
639
462
 
@@ -644,7 +467,7 @@ class Deva {
644
467
  The Mind feature sets the correct variables and necessary rules for the
645
468
  client presented data.
646
469
  ***************/
647
- Mind(client=false) {
470
+ Mind() {
648
471
  this.feature('Mind'); // set state to story setting
649
472
  const _cl = this.client();
650
473
  try {
@@ -665,9 +488,9 @@ class Deva {
665
488
  return this.Done();
666
489
  }
667
490
  } catch (e) {
668
- this.action('error');
669
- this.feature('error');
670
- return this.error(e) // run error handling if an error is caught
491
+ this.action('error'); // set the action to error
492
+ this.feature('error'); // set the feature to error
493
+ return this.error(e); // run error handling if an error is caught
671
494
  }
672
495
  }
673
496
 
@@ -676,13 +499,13 @@ class Deva {
676
499
  params: none
677
500
  describe: The end of the workflow Client Feature Workflow
678
501
  ***************/
679
- Done() {
502
+ Done(client) {
680
503
  return new Promise((resolve, reject) => {
681
504
  try {
682
- delete this._client.features; // delete the features key when done.
683
- this.action('done'); // set state to assistant setting
684
- this.feature('done'); // set state to assistant setting
685
- return resolve();
505
+ delete this._client.features; // delete the features key when done.
506
+ this.action('done'); // set state to assistant setting
507
+ this.feature('done'); // set state to assistant setting
508
+ return resolve(); // resolve an empty pr
686
509
  } catch (e) {
687
510
  this.feature('error')
688
511
  return this.error(e, false, reject);
@@ -699,10 +522,10 @@ class Deva {
699
522
  _assignBind() {
700
523
  return new Promise((resolve, reject) => {
701
524
  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);
525
+ this.bind.forEach(bind => { // loop over the bind items func, method, listener...
526
+ if (this[bind]) for (let x in this[bind]) { // if the root has a bind func, method, listener
527
+ if (typeof this[bind][x] === 'function') { // check to make sure object is a fucntion
528
+ this[bind][x] = this[bind][x].bind(this); // bind the item from the bind object
706
529
  }
707
530
  }
708
531
  });
@@ -714,10 +537,10 @@ class Deva {
714
537
  if (parse) this._agent.parse = this._agent.parse.bind(this);
715
538
  }
716
539
  catch (e) {
717
- return this.error(e, false, reject);
540
+ return this.error(e, false, reject); // trigger the this.error for errors
718
541
  }
719
542
  finally {
720
- return resolve();
543
+ return resolve(); // when the configuration is complete then return an empty resolve.
721
544
  }
722
545
  });
723
546
  }
@@ -811,15 +634,6 @@ class Deva {
811
634
  return packet;
812
635
  }
813
636
 
814
- /**************
815
- func: states
816
- params: none
817
- describe: returns the avaiable staets values.
818
- ***************/
819
- states() {
820
- return this._states;
821
- }
822
-
823
637
  /**************
824
638
  func: talk
825
639
  params:
@@ -949,7 +763,7 @@ class Deva {
949
763
  }
950
764
 
951
765
  // hash the question
952
- packet.q.meta.hash = this.hash(packet.q, 'sha256');
766
+ packet.q.meta.hash = this.hash(packet.q);
953
767
 
954
768
  this.action(_action);
955
769
  this.talk('devacore:question', this.copy(packet)); // global question event make sure to copy data.
@@ -1024,10 +838,10 @@ class Deva {
1024
838
  };
1025
839
 
1026
840
  // create a hash for the answer and insert into answer meta.
1027
- packet_answer.meta.hash = this.hash(packet_answer, 'sha256');
841
+ packet_answer.meta.hash = this.hash(packet_answer);
1028
842
 
1029
843
  packet.a = packet_answer;
1030
- packet.hash = this.hash(packet, 'sha256'); // hash the entire packet.
844
+ packet.hash = this.hash(packet); // hash the entire packet.
1031
845
 
1032
846
 
1033
847
  this.action('answer_talk');
@@ -1139,7 +953,7 @@ class Deva {
1139
953
  text: this._messages.states.start,
1140
954
  created: Date.now(),
1141
955
  }
1142
- _data.hash = this.hash(_data, 'sha256');
956
+ _data.hash = this.hash(_data);
1143
957
 
1144
958
  // set client
1145
959
  this._active = Date.now();
@@ -1178,7 +992,7 @@ class Deva {
1178
992
  for (let x in this._info) {
1179
993
  _info.push(`- ${x}: ${this._info[x]}`);
1180
994
  }
1181
- _info.push(`::end:info:${this.hash(this._info, 'sha256')}`);
995
+ _info.push(`::end:info:${this.hash(this._info)}`);
1182
996
  return _info.join('\n');
1183
997
  }
1184
998
  else {
@@ -1201,7 +1015,7 @@ class Deva {
1201
1015
  if (!this._active) return Promise.resolve(this._messages.states.offline);
1202
1016
  data.value = 'start';
1203
1017
  delete data.hash;
1204
- data.hash = this.hash(data, 'sha256');
1018
+ data.hash = this.hash(data);
1205
1019
 
1206
1020
  if (this.info) {
1207
1021
  const _info = this.info(data.id);
@@ -1228,7 +1042,7 @@ class Deva {
1228
1042
  if (!this._active) return Promise.resolve(this._messages.states.offline);
1229
1043
  data.value = 'enter';
1230
1044
  delete data.hash;
1231
- data.hash = this.hash(data, 'sha256');
1045
+ data.hash = this.hash(data);
1232
1046
  const hasOnEnter = this.onEnter && typeof this.onEnter === 'function' ? true : false;
1233
1047
  return hasOnEnter ? this.onEnter(_data) : this.done(data)
1234
1048
  }
@@ -1249,7 +1063,7 @@ class Deva {
1249
1063
  if (!this._active) return Promise.resolve(this._messages.states.offline);
1250
1064
  data.value = 'done';
1251
1065
  delete data.hash;
1252
- data.hash = this.hash(data, 'sha256');
1066
+ data.hash = this.hash(data);
1253
1067
  const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
1254
1068
  return hasOnDone ? this.onDone(data) : Promise.resolve(data);
1255
1069
  }
@@ -1279,7 +1093,7 @@ class Deva {
1279
1093
  text: this._messages.states.stop,
1280
1094
  created: Date.now(),
1281
1095
  }
1282
- _data.hash = this.hash(_data, 'sha256');
1096
+ _data.hash = this.hash(_data);
1283
1097
  const hasOnStop = this.onStop && typeof this.onStop === 'function';
1284
1098
  return hasOnStop ? this.onStop(_data) : this.exit(_data)
1285
1099
  }
@@ -1304,7 +1118,7 @@ class Deva {
1304
1118
  this._active = false;
1305
1119
  data.value = 'exit';
1306
1120
  delete data.hash;
1307
- data.hash = this.hash(data, 'sha256');
1121
+ data.hash = this.hash(data);
1308
1122
 
1309
1123
  // clear memory
1310
1124
  this._active = false;
@@ -1344,13 +1158,22 @@ class Deva {
1344
1158
  text,
1345
1159
  created: Date.now(),
1346
1160
  };
1347
- _data.hash = this.hash(_data, 'sha256');
1161
+ _data.hash = this.hash(_data);
1348
1162
  this.talk('devacore:state', _data);
1349
1163
  } catch (e) {
1350
1164
  return this.error(e);
1351
1165
  }
1352
1166
  }
1353
1167
 
1168
+ /**************
1169
+ func: states
1170
+ params: none
1171
+ describe: returns the avaiable staets values.
1172
+ ***************/
1173
+ states() {
1174
+ return this._states;
1175
+ }
1176
+
1354
1177
  /**************
1355
1178
  func: zone
1356
1179
  params:
@@ -1371,7 +1194,7 @@ class Deva {
1371
1194
  data,
1372
1195
  created: Date.now(),
1373
1196
  };
1374
- _data.hash = this.hash(_data, 'sha256');
1197
+ _data.hash = this.hash(_data);
1375
1198
  this.talk('devacore:zone', _data);
1376
1199
  } catch (e) {
1377
1200
  return this.error(e);
@@ -1398,7 +1221,7 @@ class Deva {
1398
1221
  text,
1399
1222
  created: Date.now(),
1400
1223
  };
1401
- _data.hash = this.hash(_data, 'sha256');
1224
+ _data.hash = this.hash(_data);
1402
1225
  this.talk('devacore:action', _data);
1403
1226
  } catch (e) {
1404
1227
  return this.error(e)
@@ -1425,7 +1248,7 @@ class Deva {
1425
1248
  data,
1426
1249
  created: Date.now(),
1427
1250
  };
1428
- _data.hash = this.hash(_data, 'sha256');
1251
+ _data.hash = this.hash(_data);
1429
1252
  this.talk('devacore:feature', _data);
1430
1253
  } catch (e) {
1431
1254
  return this.error(e);
@@ -1519,7 +1342,7 @@ class Deva {
1519
1342
  try {
1520
1343
  if (!this._active) return this._messages.states.offline; // check the active status
1521
1344
  this.action('services'); // set the services state
1522
- return this._services; // return the services feature
1345
+ return this.copy(this._services); // return the services feature
1523
1346
  } catch (e) {
1524
1347
  this.action('error'); // set the services state
1525
1348
  this.feature('error');
@@ -1538,7 +1361,7 @@ class Deva {
1538
1361
  try {
1539
1362
  if (!this._active) return this._messages.states.offline; // check the active status
1540
1363
  this.action('systems'); // set the systems state
1541
- return this._systems; // return the systems feature
1364
+ return this.copy(this._systems); // return the systems feature
1542
1365
  } catch (e) {
1543
1366
  this.action('error'); // set the systems state
1544
1367
  this.feature('error');
@@ -1557,7 +1380,7 @@ class Deva {
1557
1380
  try {
1558
1381
  if (!this._active) return this._messages.states.offline; // check the active status
1559
1382
  this.action('solutions'); // set the solutions state
1560
- return this._solutions; // return the solutions feature
1383
+ return this.copy(this._solutions); // return the solutions feature
1561
1384
  } catch (e) {
1562
1385
  this.action('error'); // set the systems state
1563
1386
  this.feature('error');
@@ -1565,6 +1388,24 @@ class Deva {
1565
1388
  }
1566
1389
  }
1567
1390
 
1391
+ /**************
1392
+ func: research
1393
+ params: opts
1394
+ describe: basic research features available in a Deva.
1395
+ ***************/
1396
+ research(opts) {
1397
+ this.feature('research'); // set the research state
1398
+ try {
1399
+ if (!this._active) return this._messages.states.offline; // chek the active status
1400
+ this.action('research'); // set the research state
1401
+ return this.copy(this._research); // return research feature
1402
+ } catch (e) {
1403
+ this.action('error');
1404
+ this.feature('error');
1405
+ return this.error(e);
1406
+ }
1407
+ }
1408
+
1568
1409
  /**************
1569
1410
  func: development
1570
1411
  params: opts
@@ -1575,7 +1416,7 @@ class Deva {
1575
1416
  try {
1576
1417
  if (!this._active) return this._messages.states.offline; // chek the active status
1577
1418
  this.action('development'); // set the development state
1578
- return this._development; // return development feature
1419
+ return this.copy(this._development); // return development feature
1579
1420
  } catch (e) {
1580
1421
  this.action('error');
1581
1422
  this.feature('error');
@@ -1593,7 +1434,7 @@ class Deva {
1593
1434
  try {
1594
1435
  if (!this._active) return this._messages.states.offline; // chek the active status
1595
1436
  this.action('assistant'); // set the assistant state
1596
- return this._assistant; // return assistant feature
1437
+ return this.copy(this._assistant); // return assistant feature
1597
1438
  } catch (e) {
1598
1439
  this.action('error');
1599
1440
  this.feature('error');
@@ -1611,7 +1452,7 @@ class Deva {
1611
1452
  try {
1612
1453
  if (!this._active) return this._messages.states.offline; // chek the active status
1613
1454
  this.action('business');
1614
- return this._business; // return business feature
1455
+ return this.copy(this._business); // return business feature
1615
1456
  } catch (e) {
1616
1457
  this.action('error');
1617
1458
  this.feature('error');
@@ -1629,7 +1470,7 @@ class Deva {
1629
1470
  try {
1630
1471
  if (!this._active) return this._messages.states.offline; // chek the active status
1631
1472
  this.action('legal');
1632
- return this._legal; // return legal feature
1473
+ return this.copy(this._legal); // return legal feature
1633
1474
  } catch (e) {
1634
1475
  this.action('error');
1635
1476
  this.feature('error');
@@ -1647,7 +1488,7 @@ class Deva {
1647
1488
  try {
1648
1489
  if (!this._active) return this._messages.states.offline; // chek the active status
1649
1490
  this.action('story');
1650
- return this._story; // return story feature
1491
+ return this.story(this._story); // return story feature
1651
1492
  } catch (e) {
1652
1493
  this.action('error');
1653
1494
  this.feature('error');
@@ -1664,7 +1505,7 @@ class Deva {
1664
1505
  ***************/
1665
1506
  load(key, client) {
1666
1507
  return new Promise((resolve, reject) => {
1667
- this.state('load', key);
1508
+ this.state('load');
1668
1509
  this.devas[key].init(client).then(loaded => {
1669
1510
  this.talk(`devacore:load`, {
1670
1511
  id:this.uid(true),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.1.70",
3
+ "version": "1.1.72",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {