@indra.ai/deva 1.1.30 → 1.1.32

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,91 @@ 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;
128
+ console.log('AP NAME', ap);
121
129
  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}`,
130
+ uid: `${security.label}:UID ${cp.name} made a #uid with ${ap.name}`,
131
+ hash: `${security.label}:HASH ${cp.name} made a #hash with ${ap.name}`,
132
+ cipher: `${security.label}:CIPHER ${cp.name} locked a #cipher with ${ap.name}`,
133
+ decipher: `${security.label}:DECIPHER ${cp.name} unlocked a #cipher with ${ap.name}`,
134
+ offline: `👻 ${ap.name} is offline`,
135
+ online: `📡 ${ap.name} is online`,
136
+ config: `‍📀 ${ap.name} is checking the config`,
137
+ client: `👨‍💻 ${ap.name} opened the ${ckey} profile`,
138
+ agent: `👨‍💻 ${ap.name} is looking at ${akey} profile`,
139
+ init: `🚀 ${ap.name} is initializing for ${cp.name}`,
140
+ start: `🎬 ${ap.name} has started the process for ${cp.name}`,
141
+ enter: `🎪 ${ap.name} is entering the deva.world with ${cp.name}`,
142
+ stop: `🛑 ${ap.name} has stopped for ${cp.name}`,
143
+ exit: `🚪 ${ap.name} found the exit with ${cp.name}`,
144
+ done: `🤝 ${ap.name} is all done time for #offerings 🍫🍌`,
145
+ wait: `😵‍💫 ${ap.name} waiting for #stuff from ${cp.name}`,
146
+ data: `📀 ${ap.name} is receiving #data for ${cp.name}`,
147
+ ask: `🙋‍♀️ ${ap.name} is asking a #question from ${cp.name}`,
148
+ cmd: `📟 ${ap.name} entered a #command from ${cp.name}`,
149
+ question: `🐵 ${ap.name} is in #question mode ${cp.name}`,
150
+ ask: `🐵 ${ap.name} is in #ask mode ${cp.name}`,
151
+ talk: `🎙️ ${ap.name} is in #talk mode with ${cp.name}`,
152
+ listen: `🎧 ${ap.name} is in #listening mode with ${cp.name}`,
153
+ error: `❌ ${ap.name} had an error. Let's have @Systems look into that.`,
154
+ story: `📓STORY: ${cp.name} is creating an amazing #story ${cp.name}`,
155
+ development: `${development.label}: ${cp.name} and ${ap.name} need ${development.name} assistance`,
156
+ security: `${security.label}: ${cp.name} and ${ap.name} need ${security.name} assistance`,
157
+ support: `${support.label}: ${cp.name} and ${ap.name} need ${support.name} assistance`,
158
+ services: `${services.label}: ${cp.name} and ${ap.name} need ${services.name} assistance`,
159
+ systems: `${systems.label}: ${cp.name} and ${ap.name} need ${systems.name} assistance`,
160
+ solutions: `${development.label}: ${cp.name} and ${ap.name} need ${development.name} assistance`,
161
+ legal: `${legal.label}: ${cp.name} and ${ap.name} need ${legal.name} assistance`,
162
+ business: `${business.label}: ${cp.name} and ${ap.name} need ${business.name} assistance`,
163
+ devas_start: `🧞‍♂️DEVAS: Starting all the #Devas with ${cp.name}`,
164
+ devas_ready: `🧞‍♂️DEVA:READY The #Devas are #ready and #waiitng for ${cp.name} using @${ckey} #${ckey} $${ckey}`,
165
+ devas_stop: `🧞‍♂️DEVA:STOPPING The #Devas are #stopping with ${cp.name}`,
166
+ devas_stopped: `🧞‍♂️DEVA:🛑STOP #Devas and ${cp.name} have #stopped, and that means time for #offerings 🍎🍑🍍🧋`,
167
+ deva_load: `🧞‍♂️DEVA:LOADING ${ap.name} loading for ${cp.name}`,
168
+ deva_loaded: `🧞‍♂️DEVA:LOADED ${ap.name} loaded for ${cp.name}`,
169
+ deva_unloaded: `🧞‍♂️DEVAS:UNLOADED ${ap.name} unloaded for ${cp.name}`,
170
+ question_me: `❓QUESTION:START ${cp.name} started with a great #question to ${ap.name}`,
171
+ question_default: `🧞‍♂️QUESTION:ME ${cp.name} asked a great #question to ${ap.name}`,
172
+ question_ask: `🧞QUESTION:ASK ${ap.name} is pondering what ${cp.name} asked`,
173
+ question_asking: `🧞QUESTION:ASK:ANSWER ${ap.name} is asking another #Deva for ${cp.name}`,
174
+ question_aswering: `🧞QUESTION:ASK:ANSWERING ${ap.name} is answering the #question ${cp.name} asked`,
175
+ question_answer: `🔮QUESTION:ANSWER ${cp.name} received an #ansewr from ${ap.name}`,
176
+ question_command: `🧞‍♀️QUESTION:CMD ${cp.name} issued a #command to ${ap.name}`,
177
+ hash_question: `${security.label}:HASH:QUESTION ${ap.name} created the #question #hash for ${cp.name}`,
178
+ hash_ask: `${security.label}:HASH:ASK ${ap.name} created the #ask #hash for ${cp.name}`,
179
+ hash_answer: `${security.label}:HASH:ANSWER ${cp.name} #answer #hash with ${ap.name}`,
180
+ hash_command: `${security.label}:HASH:COMMAND ${cp.name} used a #command with ${ap.name}`,
181
+ hash_packet: `${security.label}:HASH:PACKET ${ap.name} created the #packet #hash for ${cp.name}`,
182
+ ask_question: `❓QUESTION: ${cp.name} asked ${ap.name} a great #question`,
183
+ ask_answer: `💡ANSWER: ${cp.name} received a great #answer from ${ap.name}`,
184
+ method_not_found: `${security.label}:ERROR:COMMAND ${cp.name} used a #command while working with ${ap.name}, and may need from ${security.name}`,
177
185
 
178
186
  ready_security: `${security.label}:READY - ${security.name} is ready on ${security.tag} in ${security.loc}`,
179
187
  ready_support: `${support.label}:READY - ${support.name} is ready on ${support.tag} in ${support.loc}`,
@@ -185,44 +193,39 @@ class Deva {
185
193
  ready_business: `${business.label}:READY - ${business.name} is ready ${business.tag} in ${business.loc}`,
186
194
  ready_assistant: `${assistant.label}:READY - ${assistant.name} is ready ${assistant.tag} in ${business.loc}`,
187
195
 
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}`,
196
+ alert_security: `${security.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
197
+ alert_support: `${support.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
198
+ alert_services: `${services.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
199
+ alert_solutions: `${solutions.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
200
+ alert_systems: `${systems.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
201
+ alert_development: `${development.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
202
+ alert_assistant: `${assistant.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
203
+ alert_legal: `${legal.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
204
+ alert_business: `${business.label}:ALERT There is an #issue with ${cp.name} and ${ap.name}.`,
205
+
206
+ setting_client: `👨CLIENT: ${ap.name} is setting #${ckey} for ${cp.name} `,
207
+ setting_security: `${security.label}: ${cp.name} and ${ap.name} are receiving ${security.name} on ${security.tag} in ${security.loc}`,
208
+ setting_development: `${development.label}: ${cp.name} and ${ap.name} are receiving ${development.name} on ${development.tag} in ${development.loc}`,
209
+ setting_support: `${support.label}: ${cp.name} and ${ap.name} are receiving ${support.name} on ${development.tag} in ${development.loc}`,
210
+ setting_services: `${services.label}: ${cp.name} and ${ap.name} are receiving ${services.name} on ${services.tag} in ${services.loc}`,
211
+ setting_systems: `${systems.label}: ${cp.name} and ${ap.name} are receiving ${systems.name} on ${systems.tag} in ${systems.loc}`,
212
+ setting_solutions: `${solutions.label}: ${cp.name} and ${ap.name} are receiving ${solutions.name} on ${solutions.tag} in ${solutions.loc}`,
213
+ setting_assistant: `${assistant.label}: ${cp.name} and ${ap.name} are receiving ${assistant.name} on ${assistant.tag} in ${assistant.loc}`,
214
+ setting_legal: `${legal.label}: ${cp.name} and ${ap.name} are receiving ${legal.name} on ${legal.tag} in ${legal.loc}`,
215
+ setting_business: `${business.label}: ${cp.name} and ${ap.name} are receiving ${business.name} on ${business.tag} in ${business.loc}`,
216
+ setting_done: `✅DONE: FEATURE SETTINGS COMPLETE`,
208
217
  }
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
218
  this._states = _states; // The available states to work with.
216
219
  }
217
220
 
218
221
  /**************
219
222
  func: Messages
220
- params: msgs -additional messages
223
+ params: none
221
224
  describe:
222
225
  The Messages function builds the system messages, and allows for the
223
226
  reloading of system messages when client or agent data changes.
224
227
  ***************/
225
- set Messages(msgs) {
228
+ Messages() {
226
229
  // Default system messages
227
230
  const _messages = {
228
231
  offline: `🙅‍♂️ ${this._agent.profile.name} offline`,
@@ -232,16 +235,12 @@ class Deva {
232
235
  enter: `🖖 ${this._agent.profile.name} enter.`,
233
236
  exit: `🚪 ${this._agent.profile.name} exit.`,
234
237
  done: `👍 ${this._agent.profile.name} done.`,
235
- devas_started: '#Devas are #online and ready for #offerings 🍫🥛🍚🍯🧂',
236
- devas_stopped: '🛑 #Devas have stopped',
238
+ devas_started: '🍪DEVAS: #online and ready for #offerings 🍫🥛🍚🍯🧂',
239
+ devas_stopped: '🛑DEVAS: have stopped',
237
240
  notext: `❌ ${this._client.profile.name}, Invalid input.`,
241
+ deval_already_loaded: `That #DEVA is already loaded.`,
238
242
  method_not_found: `❌ ${this._client.profile.name} you sure messed that up!`,
239
243
  }
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
244
  this._messages = this.copy(_messages); // set a copy of _messages as this._messages;
246
245
  }
247
246
 
@@ -257,12 +256,19 @@ class Deva {
257
256
  ***************/
258
257
  set Client(client) {
259
258
  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
259
  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
260
+
261
+ this.States() // set the States after the Client
262
+ this.Messages() // set the Messages after the Client
263
+ // this.Support();
264
+ // this.Services();
265
+ // this.Systems();
266
+ // this.Solutions();
267
+ // this.Development();
268
+ // this.Assistant();
269
+ // this.Business();
270
+ // this.Legal();
271
+ // if (_client.featuers) delete _client.features; // delete features key for client security
266
272
  }
267
273
 
268
274
  /**************
@@ -272,14 +278,13 @@ class Deva {
272
278
  The Security feature sets the correct variables and necessary rules for the
273
279
  client presented data.
274
280
  ***************/
275
- set Security(client=false) {
281
+ Security() {
276
282
  try {
277
- if (!client) this._security = {}; // if no client then set to empty object
283
+ if (!this._client.features.security) return this.Support();
278
284
  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
285
+ this.state('setting_security');
286
+ const {id, profile, features} = this._client; // make a copy the clinet data.
287
+ const {security} = features; // make a copy the clinet data.
283
288
  this._security = { // set this_security with data
284
289
  id: this.uid(true), // uuid of the security feature
285
290
  client_id: id, // client id for reference
@@ -290,9 +295,11 @@ class Deva {
290
295
  global: security.global, // the global policies for client
291
296
  personal: security.devas[this._agent.key] // Client personal features and rules.
292
297
  };
298
+ delete this._client.features.security // make a copy the clinet data.
299
+ return this.Support();
293
300
  }
294
301
  } catch (e) {
295
- this.error(e, client) // run error handling if an error is caught
302
+ return this.error(e) // run error handling if an error is caught
296
303
  }
297
304
  }
298
305
 
@@ -303,27 +310,26 @@ class Deva {
303
310
  The Support feature sets the correct variables and necessary rules for the
304
311
  client presented data.
305
312
  ***************/
306
- set Support(client=false) {
313
+ Support() {
307
314
  try {
308
- if (!client) this._support = {}; // if no client then set to empty object
315
+ if (!this._client.features.support) return this.Services()
309
316
  else {
310
317
  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
318
+ const {id, features, profile} = this._client; // set the local consts from client copy
313
319
  const {support} = features; // set support from features const
314
320
  this._support = { // set this_support with data
315
321
  id: this.uid(true), // uuid of the support feature
316
322
  client_id: id, // client id for reference
317
323
  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
324
  concerns: support.concerns, // any concerns for client
321
325
  global: support.global, // the global policies for client
322
326
  personal: support.devas[this._agent.key] // Client personalSecurity features and rules.
323
327
  };
328
+ delete this._client.features.support
329
+ return this.Services();
324
330
  }
325
331
  } catch (e) {
326
- this.error(e, client) // run error handling if an error is caught
332
+ return this.error(e) // run error handling if an error is caught
327
333
  }
328
334
  }
329
335
 
@@ -334,27 +340,26 @@ class Deva {
334
340
  The Services feature sets the correct variables and necessary rules for the
335
341
  client presented data.
336
342
  ***************/
337
- set Services(client=false) {
343
+ Services() {
338
344
  try {
339
- if (!client) this._security = {}; // if no client then set to empty object
345
+ if (!this._client.features.services) return this.Systems();
340
346
  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
347
+ this.state('setting_services'); // set state to security setting
348
+ const {id, features, profile} = this._client; // set the local consts from client copy
349
+ const {services} = features; // set services from features const
350
+ this._services = { // set this_services with data
351
+ id: this.uid(true), // uuid of the services feature
347
352
  client_id: id, // client id for reference
348
353
  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.
354
+ concerns: services.concerns, // any concerns for client
355
+ global: services.global, // the global policies for client
356
+ personal: services.devas[this._agent.key] // Client personal features and rules.
354
357
  };
358
+ delete this._client.features.services
359
+ return this.Systems()
355
360
  }
356
361
  } catch (e) {
357
- this.error(e, client) // run error handling if an error is caught
362
+ return this.error(e) // run error handling if an error is caught
358
363
  }
359
364
  }
360
365
 
@@ -365,27 +370,27 @@ class Deva {
365
370
  The Systems feature sets the correct variables and necessary rules for the
366
371
  client presented data.
367
372
  ***************/
368
- set Systems(client=false) {
373
+ Systems() {
369
374
  try {
370
- if (!client) this._systems = {}; // if no client then set to empty object
375
+ if (!this._client.features.systems) return this.Solutions();
371
376
  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
377
+ this.state('setting_systems'); // set state to systems setting
378
+ const {id, features, profile} = this._client; // set the local consts from client copy
379
+ const {systems} = features; // set systems from features const
380
+ this._systems = { // set this_systems with data
377
381
  id: this.uid(true), // uuid of the systems feature
378
382
  client_id: id, // client id for reference
379
383
  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.
384
+ concerns: systems.concerns, // any concerns for client
385
+ global: systems.global, // the global policies for client
386
+ personal: systems.devas[this._agent.key] // Client personal features and rules.
385
387
  };
388
+ delete this._client.features.systems
389
+ return this.Solutions()
386
390
  }
387
391
  } catch (e) {
388
- this.error(e, client) // run error handling if an error is caught
392
+ // run error handling if an error is caught
393
+ return this.error(e)
389
394
  }
390
395
  }
391
396
 
@@ -396,27 +401,26 @@ class Deva {
396
401
  The Solutions feature sets the correct variables and necessary rules for the
397
402
  client presented data.
398
403
  ***************/
399
- set Solutions(client=false) {
404
+ Solutions() {
400
405
  try {
401
- if (!client) this._solutions = {}; // if no client then set to empty object
406
+ if (!this._client.features.solutions) return this.Development();
402
407
  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
408
+ this.state('setting_solutions'); // set state to solutions setting
409
+ const {id, features, profile} = this._client; // set the local consts from client copy
410
+ const {solutions} = features; // set solutions from features const
411
+ this._solutions = { // set this_solutions with data
408
412
  id: this.uid(true), // uuid of the solutions feature
409
413
  client_id: id, // client id for reference
410
414
  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.
415
+ concerns: solutions.concerns, // any concerns for client
416
+ global: solutions.global, // the global policies for client
417
+ personal: solutions.devas[this._agent.key] // Client personal features and rules.
416
418
  };
419
+ delete this._client.features.solutions
420
+ return this.Development()
417
421
  }
418
422
  } catch (e) {
419
- this.error(e, client) // run error handling if an error is caught
423
+ return this.error(e) // run error handling if an error is caught
420
424
  }
421
425
  }
422
426
 
@@ -427,123 +431,140 @@ class Deva {
427
431
  The Development feature sets the correct variables and necessary rules for the
428
432
  client presented data.
429
433
  ***************/
430
- set Development(client=false) {
434
+ Development() {
431
435
  try {
432
- if (!client) this._development = {}; // if no client then set to empty object
436
+ if (!this._client.features.development) return this.Business();
433
437
  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
438
+ this.state('setting_development'); // set state to development setting
439
+ const {id, features, profile} = this._client; // set the local consts from client copy
440
+ const {development} = features; // set development from features const
441
+ this._development = { // set this_development with data
439
442
  id: this.uid(true), // uuid of the development feature
440
443
  client_id: id, // client id for reference
441
444
  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.
445
+ hash: development.hash, // client preferred hash algorithm
446
+ cipher: development.cipher, // client preferred cipher settings
447
+ concerns: development.concerns, // any concerns for client
448
+ global: development.global, // the global policies for client
449
+ personal: development.devas[this._agent.key] // Client personal features and rules.
447
450
  };
451
+ delete this._client.features.development
452
+ return this.Business()
448
453
  }
449
454
  } catch (e) {
450
- this.error(e, client) // run error handling if an error is caught
455
+ return this.error(e) // run error handling if an error is caught
451
456
  }
452
457
  }
453
458
 
454
459
  /**************
455
- func: Assistant
460
+ func: Business
456
461
  params: client: false
457
462
  describe:
458
- The Assistant feature sets the correct variables and necessary rules for the
463
+ The Business feature sets the correct variables and necessary rules for the
459
464
  client presented data.
460
465
  ***************/
461
- set Assistant(client=false) {
466
+ Business(client=false) {
462
467
  try {
463
- if (!client) this._assistant = {}; // if no client then set to empty object
468
+ if (!this._client.features.business) return this.Legal();
464
469
  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
470
+ this.state('setting_business'); // set state to business setting
471
+ const {id, features, profile} = this._client; // set the local consts from client copy
472
+ const {business} = features; // set business from features const
473
+ this._business = { // set this_business with data
474
+ id: this.uid(true), // uuid of the business feature
471
475
  client_id: id, // client id for reference
472
476
  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.
477
+ hash: business.hash, // client preferred hash algorithm
478
+ cipher: business.cipher, // client preferred cipher settings
479
+ concerns: business.concerns, // any concerns for client
480
+ global: business.global, // the global policies for client
481
+ personal: business.devas[this._agent.key] // Client personal features and rules.
478
482
  };
479
- }
483
+ delete this._client.features.business
484
+ return this.Legal();
485
+ }
480
486
  } catch (e) {
481
- this.error(e, client) // run error handling if an error is caught
487
+ return this.error(e) // run error handling if an error is caught
482
488
  }
483
489
  }
484
490
 
485
491
  /**************
486
- func: Business
492
+ func: Legal
487
493
  params: client: false
488
494
  describe:
489
- The Business feature sets the correct variables and necessary rules for the
495
+ The Legal feature sets the correct variables and necessary rules for the
490
496
  client presented data.
491
497
  ***************/
492
- set Business(client=false) {
498
+ Legal() {
493
499
  try {
494
- if (!client) this._business = {}; // if no client then set to empty object
500
+ if (!this._client.features.legal) this.Assistant();
495
501
  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
502
+ this.state('setting_legal'); // set state to legal setting
503
+ const {id, features, profile} = this._client; // set the local consts from client copy
504
+ const {legal} = features; // set legal from features const
505
+ this._legal = { // set this_legal with data
506
+ id: this.uid(true), // uuid of the legal feature
502
507
  client_id: id, // client id for reference
503
508
  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.
509
+ hash: legal.hash, // client preferred hash algorithm
510
+ cipher: legal.cipher, // client preferred cipher settings
511
+ concerns: legal.concerns, // any concerns for client
512
+ global: legal.global, // the global policies for client
513
+ personal: legal.devas[this._agent.key] // Client personal features and rules.
509
514
  };
515
+ delete this._client.features.legal;
516
+ return this.Assistant();
510
517
  }
511
518
  } catch (e) {
512
- this.error(e, client) // run error handling if an error is caught
519
+ return this.error(e) // run error handling if an error is caught
513
520
  }
514
521
  }
515
522
 
516
523
  /**************
517
- func: Legal
524
+ func: Assistant
518
525
  params: client: false
519
526
  describe:
520
- The Legal feature sets the correct variables and necessary rules for the
527
+ The Assistant feature sets the correct variables and necessary rules for the
521
528
  client presented data.
522
529
  ***************/
523
- set Legal(client=false) {
530
+ Assistant(client=false) {
524
531
  try {
525
- if (!client) this._legal = {}; // if no client then set to empty object
532
+ if (!this._client.features.assistant) return this.Done();
526
533
  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
534
+ this.state('setting_assistant'); // set state to assistant setting
535
+ const {id, features, profile} = this._client; // set the local consts from client copy
536
+ const {assistant} = features; // set assistant from features const
537
+ this._assistant = { // set this_assistant with data
538
+ id: this.uid(true), // uuid of the assistant feature
533
539
  client_id: id, // client id for reference
534
540
  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.
541
+ hash: assistant.hash, // client preferred hash algorithm
542
+ cipher: assistant.cipher, // client preferred cipher settings
543
+ concerns: assistant.concerns, // any concerns for client
544
+ global: assistant.global, // the global policies for client
545
+ personal: assistant.devas[this._agent.key] // Client personal features and rules.
540
546
  };
547
+ delete this._client.features.legal;
548
+ return this.Done();
541
549
  }
542
550
  } catch (e) {
543
- this.error(e, client) // run error handling if an error is caught
551
+ return this.error(e) // run error handling if an error is caught
544
552
  }
545
553
  }
546
554
 
555
+ /**************
556
+ func: Done
557
+ params: none
558
+ describe: The end of the workflow Client Feature Workflow
559
+ ***************/
560
+ Done() {
561
+ try {
562
+ this.state('setting_done'); // set state to assistant setting
563
+ return;
564
+ } catch (e) {
565
+ return this.error(e);
566
+ }
567
+ }
547
568
  /**************
548
569
  func: _assignBind
549
570
  params: none
@@ -870,38 +891,6 @@ class Deva {
870
891
  return this.events.removeListener(evt, callback);
871
892
  }
872
893
 
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
894
  /**************
906
895
  func: ask
907
896
  params: packet
@@ -1127,8 +1116,6 @@ class Deva {
1127
1116
  init(client) {
1128
1117
  // set client
1129
1118
  this.Client = client;
1130
-
1131
-
1132
1119
  this._active = Date.now();
1133
1120
  return new Promise((resolve, reject) => {
1134
1121
  this.events.setMaxListeners(this.maxListeners);
@@ -1138,17 +1125,7 @@ class Deva {
1138
1125
  return this._assignListeners();
1139
1126
  }).then(() => {
1140
1127
  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
-
1128
+ this.Security();
1152
1129
  return this.onInit && typeof this.onInit === 'function' ? this.onInit() : this.start();
1153
1130
  }).then(started => {
1154
1131
  return resolve(started)
@@ -1173,9 +1150,9 @@ class Deva {
1173
1150
  // check fo rthe custom onError function in the agent.
1174
1151
  if (this.onError && typeof this.onError === 'function') return this.onError(err, data, reject);
1175
1152
  else {
1176
- console.log(':::::: ERROR :::::::');
1153
+ console.log('\n::BEGIN:ERROR\n');
1177
1154
  console.log(err);
1178
- console.log('\n::::::::::::::::::::\n');
1155
+ console.log('\n::END:ERROR\n');
1179
1156
  return reject ? reject(err) : err;
1180
1157
  }
1181
1158
  }
@@ -1289,7 +1266,7 @@ class Deva {
1289
1266
  // format the date since active for output.
1290
1267
  const dateFormat = this.formatDate(this._active, 'long', true);
1291
1268
  // create the text msg string
1292
- let text = `${this.features.systems.label}:STATUS ${this._agent.profile.name} active since ${dateFormat}`;
1269
+ let text = `${this._features.systems.label}:STATUS ${this._agent.profile.name} active since ${dateFormat}`;
1293
1270
  if (msg) text = text + `\n${msg}`; // append the msg string if msg true.
1294
1271
  return text; // return final text string
1295
1272
  }
@@ -1440,6 +1417,39 @@ class Deva {
1440
1417
  return this._legal; // return legal feature
1441
1418
  }
1442
1419
 
1420
+ /**************
1421
+ func: load
1422
+ params:
1423
+ -deva: The Deva model to load.
1424
+ describe:
1425
+ This function will enable fast loading of Deva into a system.
1426
+ ***************/
1427
+ load(key, client) {
1428
+ return new Promise((resolve, reject) => {
1429
+ this.state('deva_load');
1430
+ this.devas[key].init(client).then(loaded => {
1431
+ this.state('deva_loaded');
1432
+ return resolve();
1433
+ }).catch(err => {
1434
+ return this.error(err, deva, reject);
1435
+ })
1436
+ });
1437
+ }
1438
+
1439
+
1440
+ /**************
1441
+ func: unload
1442
+ params:
1443
+ - deva: The deva key to unload
1444
+ describe: Unload a currently loaded Deva.
1445
+ ***************/
1446
+ unload(deva) {
1447
+ this.state('deva_unload');
1448
+ delete this.devas[deva];
1449
+ this.state('deva_unloaded');
1450
+ return Promise.resolve(`unload:${deva} `);
1451
+ }
1452
+
1443
1453
  /**************
1444
1454
  func: startDevas
1445
1455
  params: none
@@ -1447,14 +1457,14 @@ class Deva {
1447
1457
  Start Devas will initialize the Deva agents inside this curent Deva.
1448
1458
  ***************/
1449
1459
  startDevas(client) {
1450
- const _client = this.copy(client); // copy the client data
1451
1460
  this.state('devas_start'); // set the devas start state
1452
1461
  return new Promise((resolve, reject) => {
1453
- const devas = []; // create devas index
1462
+ const loading = [];
1463
+ const _client = this.copy(client);
1454
1464
  for (let x in this.devas) {
1455
- devas.push(this.devas[x].init(_client)); // push the to devas index
1465
+ loading.push(this.load(x, client));
1456
1466
  }
1457
- Promise.all(devas).then(() => {
1467
+ Promise.all(loading).then(() => {
1458
1468
  this.state('devas_ready'); // set to ready state
1459
1469
  return resolve({ // return the response
1460
1470
  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.32",
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",