@indra.ai/deva 1.1.30 → 1.1.31

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