@indra.ai/deva 1.1.50 → 1.1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +86 -84
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -76,8 +76,12 @@ class Deva {
76
76
  config: 'Configuration Zone',
77
77
  features: 'Feature Zone',
78
78
  idle: 'Idle Zone',
79
- train: 'Training Zone',
80
- work: 'Working Zone',
79
+ training: 'Training Zone',
80
+ school: 'School Zone',
81
+ work: 'Work Zone',
82
+ fun: 'Fun Zone',
83
+ adventure: 'Adventure Zone',
84
+ party: 'Party Zone',
81
85
  invalid: 'Invalid Invalid',
82
86
  done: 'Done Zone',
83
87
  error: 'Error Zone',
@@ -92,14 +96,16 @@ class Deva {
92
96
  question_cmd: 'question:cmd',
93
97
  question_method: 'question:method',
94
98
  question_talk: 'question:talk',
95
- question_hash: 'question:hash',
96
99
  question_answer: 'question:answer',
97
100
  question_done: 'question:done',
98
101
  answer: 'answer',
99
- answer_hash: 'hashing the answer',
100
102
  answer_talk: 'sharing the answer',
101
103
  ask: 'asking',
102
104
  ask_answer: 'answering',
105
+ uid: 'create unique id',
106
+ hash: 'create hash',
107
+ cipher: 'encrypt data',
108
+ decipher: 'dencrypt data',
103
109
  security: 'SECURITY',
104
110
  Security: 'Security Feature',
105
111
  support: 'SUPPORT',
@@ -130,63 +136,61 @@ class Deva {
130
136
 
131
137
  this._feature = false;
132
138
  this._features = {
133
- security: '🔐 SECURITY',
134
- Security: '🔐 SECURITY Feature',
135
- support: '💼 SUPPORT',
136
- Support: '💼 SUPPORT Feature',
137
- services: '🛠️ SERVICES',
138
- Services: '🛠️ SERVICES',
139
- solutions: '💡 SOLUTIONS',
140
- Solutions: '💡 SOLUTIONS Feature',
141
- systems: '🖥️ SYSTEMS',
142
- Systems: '🖥️ SYSTEMS Feature',
143
- development: '🔧 DEVELOPMENT',
144
- Development: '🔧 DEVELOPMENT Feature',
145
- business: '📊 BUSINESS',
146
- Business: '📊 BUSINESS Feature',
147
- legal:'⚖️ LEGAL',
148
- Legal:'⚖️ LEGAL Feature',
149
- assistant: '🤝 ASSISTANT',
150
- Assistant: '🤝 ASSISTANT Feature',
151
- story: '📚 STORY',
152
- Story: '📚 STORY Feature',
153
- mind: '🧠 MIND',
154
- Mind: '🧠 MIND Feature',
139
+ security: 'Security',
140
+ Security: 'SECURITY Feature',
141
+ support: 'Support',
142
+ Support: 'SUPPORT Feature',
143
+ services: 'Services',
144
+ Services: 'SERVICES',
145
+ solutions: 'Solutions',
146
+ Solutions: 'SOLUTIONS Feature',
147
+ systems: 'Systems',
148
+ Systems: 'SYSTEMS Feature',
149
+ research: 'Research',
150
+ Research: 'RESEARCH Feature',
151
+ development: 'Development',
152
+ Development: 'DEVELOPMENT Feature',
153
+ business: 'Business',
154
+ Business: 'BUSINESS Feature',
155
+ legal:'Legal',
156
+ Legal:'LEGAL Feature',
157
+ assistant: 'Assistant',
158
+ Assistant: 'ASSISTANT Feature',
159
+ story: 'Story',
160
+ Story: 'STORY Feature',
161
+ mind: 'Story',
162
+ Mind: 'MIND Feature',
155
163
  error: 'Feature Error',
156
- done: 'Feature Done',
164
+ done: 'Features Done',
157
165
  };
158
166
 
159
167
  this._messages = {
160
168
  states: {
161
- offline: `${this._agent.profile.name} ${this._states.offline}`,
162
- online: `${this._agent.profile.name} ${this._states.online}`,
169
+ offline: `🛌 ${this._agent.profile.name} ${this._states.offline}`,
170
+ online: `🌞 ${this._agent.profile.name} ${this._states.online}`,
163
171
  ask: `😎 ${this._agent.profile.name} ${this._states.ask}`,
164
172
  question: `🎙️ ${this._agent.profile.name} ${this._states.question}`,
165
173
  answer: `🎟️ ${this._agent.profile.name} ${this._states.answer}`,
166
- offline: `${this._agent.profile.name} ${this._states.offline}`,
167
- online: `${this._agent.profile.name} ${this._states.online}`,
168
174
  init: `🚀 ${this._agent.profile.name} ${this._states.init}`,
169
- start: `🎬 ${this._agent.profile.name} ${this._states.start}`,
170
- enter: `📲 ${this._agent.profile.name} ${this._states.enter}`,
175
+ start: `🚙 ${this._agent.profile.name} ${this._states.start}`,
176
+ enter: `🪐 ${this._agent.profile.name} ${this._states.enter}`,
171
177
  stop: `✋ ${this._agent.profile.name} ${this._states.stop}`,
172
178
  exit: `🚪 ${this._agent.profile.name} ${this._states.exit}`,
173
179
  load: `📫 ${this._agent.profile.name} is ${this._states.load}`,
174
180
  unload: `📭 ${this._agent.profile.name} is ${this._states.unload}`,
175
- uid: `${this._agent.profile.name} ${this._states.uid}`,
176
- hash: `${this._agent.profile.name} ${this._states.hash}`,
177
- cipher: `${this._agent.profile.name} ${this._states.cipher}`,
178
- decipher: `${this._agent.profile.name} ${this._states.decipher}`,
181
+ uid: `🔑 ${this._agent.profile.name} ${this._states.uid}`,
179
182
  invalid: `⚠️ ${this._agent.profile.name} ${this._states.invalid}`,
180
183
  done: `✅ ${this._agent.profile.name} ${this._states.done}`,
181
184
  error: `❌ ${this._states.error}`,
182
185
  },
183
186
  zones: {
184
187
  deva: `🎉 ${this._agent.profile.name} ${this._zones.deva}`,
185
- config: `💪 ${this._agent.profile.name} ${this._zones.config}`,
188
+ config: `🦾 ${this._agent.profile.name} ${this._zones.config}`,
186
189
  features: `🍿 ${this._agent.profile.name} ${this._zones.features}`,
187
- idle: `🥱 ${this._agent.profile.name} ${this._zones.idle}`,
188
- train: `👨‍🎓 ${this._agent.profile.name} ${this._zones.train}`,
189
- work: `😓 ${this._agent.profile.name} ${this._zones.work}`,
190
+ idle: `😜 ${this._agent.profile.name} ${this._zones.idle}`,
191
+ training: `🥋 ${this._agent.profile.name} ${this._zones.train}`,
192
+ school: `👨‍🏫 ${this._agent.profile.name} ${this._zones.work}`,
193
+ work: `‍🗂️ ${this._agent.profile.name} ${this._zones.work}`,
190
194
  invalid: `⚠️ ${this._agent.profile.name} ${this._zones.invalid}`,
191
195
  done: `✅ ${this._agent.profile.name} ${this._zones.done}`,
192
196
  error: `❌ ${this._agent.profile.name} ${this._zones.error}`,
@@ -199,7 +203,6 @@ class Deva {
199
203
  question_cmd: `🎮 ${this._agent.profile.name} issue command`,
200
204
  question_method: `🏄‍♂️ ${this._agent.profile.name} ${this._actions.question_method}`,
201
205
  question_talk: `📢 ${this._agent.profile.name} ${this._actions.question_talk}`,
202
- question_hash: `#️⃣ ${this._agent.profile.name} hash question`,
203
206
  question_answer: `🎙️ ${this._agent.profile.name} ${this._actions.question_answer}`,
204
207
  question_done: `👍 ${this._agent.profile.name} ${this._actions.question_done}`,
205
208
  answer: `🎟️ ${this._agent.profile.name} gave an ${this._actions.answer}`,
@@ -207,28 +210,34 @@ class Deva {
207
210
  ask: `👥 ${this._agent.profile.name} asking`,
208
211
  ask_answer: `🎟️ ${this._agent.profile.name} answering ask`,
209
212
 
213
+ uid: `🆔 ${this._agent.profile.name} ${this._actions.uid}`,
214
+ hash: `🔏 ${this._agent.profile.name} ${this._actions.hash}`,
215
+ cipher: `🔒 ${this._agent.profile.name} ${this._actions.cipher}`,
216
+ decipher: `🔓 ${this._agent.profile.name} ${this._actions.decipher}`,
217
+
210
218
  security: `${this._features.security} action`,
211
219
  Security: `${this._features.Security} ready`,
212
220
  support: `${this._features.support} action`,
213
221
  Support: `${this._features.Support} ready`,
214
- services: `${this._features.Services} action`,
222
+ services: `${this._features.services} action`,
215
223
  Services: `${this._features.Services} ready`,
216
224
  solutions: `${this._features.solutions} action`,
217
225
  Solutions: `${this._features.Solutions} ready`,
218
- solutions: `${this._features.Systems} action`,
219
- systems: `${this._features.Systems} action`,
226
+ systems: `${this._features.systems} action`,
220
227
  Systems: `${this._features.Systems} ready`,
228
+ research: `${this._features.research} action`,
229
+ Research: `${this._features.Research} ready`,
221
230
  development: `${this._features.Development} action`,
222
231
  Development: `${this._features.Development} ready`,
223
- business: `${this._features.Business} action`,
232
+ business: `${this._features.business} action`,
224
233
  Business: `${this._features.Business} ready`,
225
- legal: `${this._features.Legal} action`,
234
+ legal: `${this._features.legal} action`,
226
235
  Legal: `${this._features.Legal} ready`,
227
- assistant: `${this._features.Assistant} action`,
236
+ assistant: `${this._features.assistant} action`,
228
237
  Assistant: `${this._features.Assistant} ready`,
229
- story: `${this._features.Story} action`,
238
+ story: `${this._features.story} action`,
230
239
  Story: `${this._features.Story} ready`,
231
- mind: `${this._features.Mind} action`,
240
+ mind: `${this._features.mind} action`,
232
241
  Mind: `${this._features.Mind} ready`,
233
242
  client_data: `📂 ${this._agent.profile.name} configure`,
234
243
  invalid: `${this._actions.invalid}`,
@@ -236,27 +245,29 @@ class Deva {
236
245
  error: `${this._action.error}`,
237
246
  },
238
247
  features: {
239
- security: `${this._features.security} feature`,
240
- Security: `${this._features.Security} configure`,
241
- support: `${this._features.support} feature`,
242
- Support: `${this._features.Support} configure`,
243
- services: `${this._features.services} feature state`,
244
- Services: `${this._features.Services} configure`,
245
- solutions: `${this._features.solutions} is solving`,
246
- Solutions: `${this._features.Solutions} configure`,
247
- systems: `${this._features.systems} is mantaining`,
248
- Systems: `${this._features.Systems} configure`,
249
- development: `${this._features.development} is developing`,
250
- Development: `${this._features.Development} configure`,
251
- business: `${this._features.business} is successful`,
252
- Business: `${this._features.Business} configure`,
253
- legal: `${this._features.legal} is upholding the law`,
254
- Legal: `${this._features.Legal} configure`,
255
- assistant: `${this._features.assistant} is assisting`,
256
- Assistant: `${this._features.Assistant} configure`,
257
- story: `${this._features.story} is creating`,
258
- Story: `${this._features.Story} configure`,
259
- mind: `${this._features.story} is thinking and pondering`,
248
+ security: `🔐 ${this._features.security} feature`,
249
+ Security: `🔐 ${this._features.Security} configure`,
250
+ support: `💼 ${this._features.support} feature`,
251
+ Support: `💼 ${this._features.Support} configure`,
252
+ services: `🛠️ ${this._features.services} feature`,
253
+ Services: `🛠️ ${this._features.Services} configure`,
254
+ solutions: `💡 ${this._features.solutions} feature`,
255
+ Solutions: `💡 ${this._features.Solutions} configure`,
256
+ systems: `🖥️ ${this._features.systems} feature`,
257
+ Systems: `🖥️ ${this._features.Systems} configure`,
258
+ research: `🔍 ${this._features.research} feature`,
259
+ Research: `🔍 ${this._features.Research} configure`,
260
+ development: `🔧 ${this._features.development} feature`,
261
+ Development: `🔧 ${this._features.Development} configure`,
262
+ business: `📊 ${this._features.business} feature`,
263
+ Business: `📊 ${this._features.Business} configure`,
264
+ legal: `⚖️ ${this._features.legal} feature`,
265
+ Legal: `⚖️ ${this._features.Legal} configure`,
266
+ assistant: `👤 ${this._features.assistant} feature`,
267
+ Assistant: `👤 ${this._features.Assistant} configure`,
268
+ story: `📚 ${this._features.story} feature`,
269
+ Story: `📚 ${this._features.Story} configure`,
270
+ mind: `${this._features.story} feature`,
260
271
  Mind: `${this._features.Mind} configure`,
261
272
  invalid: `⚠️ ${this._features.invalid}`,
262
273
  done: `✅ ${this._features.done}`,
@@ -411,7 +422,6 @@ class Deva {
411
422
  global: systems.global, // the global policies for client
412
423
  personal: systems.devas[this._agent.key] // Client personal features and rules.
413
424
  };
414
- console.log('SYSTEMS FEATURE SETUP', this._systems);
415
425
  delete this._client.features.systems
416
426
  return this.Solutions()
417
427
  }
@@ -939,7 +949,6 @@ class Deva {
939
949
  }
940
950
 
941
951
  // hash the question
942
- this.action('question_hash'); // set the has question state
943
952
  packet.q.meta.hash = this.hash(JSON.stringify(packet.q));
944
953
 
945
954
  this.action(_action);
@@ -1015,11 +1024,9 @@ class Deva {
1015
1024
  };
1016
1025
 
1017
1026
  // create a hash for the answer and insert into answer meta.
1018
- this.action('answer_hash');
1019
1027
  packet_answer.meta.hash = this.hash(JSON.stringify(packet_answer));
1020
1028
 
1021
1029
  packet.a = this.copy(packet_answer);
1022
- this.action('packet_hash');
1023
1030
  packet.hash = this.hash(JSON.stringify(packet)); // hash the entire packet.
1024
1031
 
1025
1032
 
@@ -1696,6 +1703,7 @@ class Deva {
1696
1703
  is shared.
1697
1704
  ***************/
1698
1705
  uid(guid=false) {
1706
+ this.action('uid');
1699
1707
  let id;
1700
1708
  if (guid) {
1701
1709
  id = randomUUID()
@@ -1718,6 +1726,7 @@ class Deva {
1718
1726
  The hash algorithm will take a string of text and produce a hash.
1719
1727
  ***************/
1720
1728
  hash(str, algo=false) {
1729
+ this.action('hash');
1721
1730
  algo = algo || this._security.hash || 'md5';
1722
1731
  const the_hash = createHash(algo);
1723
1732
  the_hash.update(str);
@@ -1733,6 +1742,7 @@ class Deva {
1733
1742
  defined client security settings.
1734
1743
  ***************/
1735
1744
  cipher(str) {
1745
+ this.action('cipher');
1736
1746
  const security = this._security;
1737
1747
  const {password, algorithm} = security.cipher;
1738
1748
  const key = createHash('sha256').update(String(password)).digest('base64');
@@ -1743,14 +1753,6 @@ class Deva {
1743
1753
  const _cipher = createCipheriv(algorithm, key_in_bytes, iv);
1744
1754
  const encrypted = _cipher.update(String(str), 'utf8', 'hex') + _cipher.final('hex');
1745
1755
 
1746
- this.state('cipher', {
1747
- id: this.uid(true),
1748
- iv,
1749
- key,
1750
- agent_id: this._agent.id,
1751
- client_id: this._client.id,
1752
- created: Date.now()
1753
- });
1754
1756
 
1755
1757
  return {
1756
1758
  iv: iv.toString('base64'),
@@ -1759,6 +1761,7 @@ class Deva {
1759
1761
  }
1760
1762
  }
1761
1763
  decipher(opt) {
1764
+ this.action('decipher');
1762
1765
  const iv = Buffer.from(opt.iv, 'base64');
1763
1766
  const encrypted = Buffer.from(opt.encrypted, 'hex');
1764
1767
  const key_in_bytes = Buffer.from(opt.key, 'base64')
@@ -1767,7 +1770,6 @@ class Deva {
1767
1770
  const decipher = createDecipheriv( algorithm, key_in_bytes, iv);
1768
1771
  const decrypted = decipher.update(encrypted);
1769
1772
  const final = Buffer.concat([decrypted, decipher.final()]);
1770
- this.state('decipher');
1771
1773
  return final.toString();
1772
1774
  }
1773
1775
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.1.50",
3
+ "version": "1.1.51",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {