@indra.ai/deva 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/config.json CHANGED
@@ -45,8 +45,9 @@
45
45
  "support": "💼 Support",
46
46
  "services": "🛠️ Services",
47
47
  "systems": "📡 Systems",
48
- "legal": "👨‍⚖️️ Legal",
48
+ "legal": "🏛️ Legal",
49
49
  "authority": "👮‍♂️ Authority",
50
+ "justice": "⚖️ Justice",
50
51
  "help": "💚 Help",
51
52
  "error": "❌ Error!"
52
53
  },
@@ -86,7 +87,7 @@
86
87
  "unload": "🛻 unload",
87
88
  "resolve": "🔬 resolve",
88
89
  "reject": "🧱 reject",
89
- "done": " done",
90
+ "done": "👍 done",
90
91
  "data": "📡 data",
91
92
  "finish": "🏁 finish",
92
93
  "complete": "⌛️ complete",
@@ -133,10 +134,10 @@
133
134
  "stop": "🛑 stop",
134
135
  "load": "📦 load",
135
136
  "unload": "🥡 unload",
136
- "done": "📝 done",
137
137
  "finish": "🏁 finish",
138
- "complete": "👍 complete",
139
- "ready": "✅ ready",
138
+ "complete": " complete",
139
+ "done": "☑️ done",
140
+ "ready": "🟢 ready",
140
141
  "question": "🙋 question",
141
142
  "talk": "📢 talk",
142
143
  "context": "📇 context",
@@ -171,17 +172,14 @@
171
172
  "answer": "💡 Answer",
172
173
  "ask": "📣 Ask",
173
174
 
174
- "security": "🚨 Security",
175
- "support": "❤️ Support",
176
- "services": "🛠️ Services",
177
- "systems": "💻️ Systems",
178
-
179
- "Client": " Client",
180
- "Security": "🚓 Security",
181
- "Support": "🚑 Support",
182
- "Services": "🚚 Services",
183
- "Systems": "🚛 Systems",
184
- "Done": "☑️ Done",
175
+ "client": "👨 Client",
176
+ "security": "🚓 Security",
177
+ "support": "🚑 Support",
178
+ "services": "🚚 Services",
179
+ "systems": "🚛 Systems",
180
+ "legal": "🗃️ Legal",
181
+ "justice": "🗄️ Justice",
182
+ "authority": "🚔 Authority",
185
183
 
186
184
  "invalid": "❌ Invalid",
187
185
  "states": "🛻 States",
package/index.js CHANGED
@@ -20,7 +20,9 @@ class Deva {
20
20
  this._security = false; // inherited Security features.
21
21
  this._support = false; // inherited Support features.
22
22
  this._services = false; // inherited Service features.
23
- this._systems = false; // inherited Service features.
23
+ this._systems = false; // inherited Systems features.
24
+ this._legal = false; // inherited Legal features.
25
+ this._justice = false; // inherited Justice features.
24
26
  this.events = opts.events || new EventEmitter({}); // Event Bus
25
27
  this.lib = new lib({}); // used for loading library functions
26
28
  this.utils = opts.utils || {}; // parse function
@@ -188,21 +190,25 @@ class Deva {
188
190
  usage:
189
191
  this.Client = {data}
190
192
  ***************/
191
- Client(client) {
192
- this.action('Client');
193
+ Client(client, resolve, reject) {
194
+ this.action('client');
193
195
  // setup any custom methods for the features
194
- for (const x in client.features) {
195
- const methods = client.features[x].methods || false;
196
- if (methods) for (const y in methods) {
197
- const isFunc = typeof methods[y] === 'function';
198
- if (isFunc) {
199
- this.methods[y] = methods[y].bind(this);
196
+ try {
197
+ for (const x in client.features) {
198
+ const methods = client.features[x].methods || false;
199
+ if (methods) for (const y in methods) {
200
+ const isFunc = typeof methods[y] === 'function';
201
+ if (isFunc) {
202
+ this.methods[y] = methods[y].bind(this);
203
+ }
200
204
  }
201
205
  }
206
+ const _client = this.lib.copy(client); // copy the client parameter
207
+ this._client = _client; // set local _client to this scope
208
+ return resolve();
209
+ } catch (e) {
210
+ return this.error(e, false, reject);
202
211
  }
203
- const _client = this.lib.copy(client); // copy the client parameter
204
- this._client = _client; // set local _client to this scope
205
- return Promise.resolve();
206
212
  }
207
213
 
208
214
  /**************
@@ -212,12 +218,12 @@ class Deva {
212
218
  The Security feature sets the correct variables and necessary rules for the
213
219
  client presented data.
214
220
  ***************/
215
- Security() {
221
+ Security(resolve, reject) {
216
222
  this.zone('security');
217
- this.action('Security'); // set action to Security
223
+ this.action('security'); // set action to Security
218
224
  const _cl = this.client(); // set local copy of client data
219
225
  try {
220
- if (!_cl.features.security) return this.Support(); // if no security feature goto Support
226
+ if (!_cl.features.security) return resolve(); // if no security feature goto Support
221
227
  else {
222
228
  this.state('set', 'Security');
223
229
  const {id, profile, features} = _cl; // make a copy the clinet data.
@@ -233,7 +239,7 @@ class Deva {
233
239
  personal: security.devas[this._agent.key], // Client personal features and rules.
234
240
  };
235
241
  delete this._client.features.security; // make a copy the clinet data.
236
- return Promise.resolve(); // goto Support when done with Security
242
+ return resolve(); // goto Support when done with Security
237
243
  }
238
244
  } catch (e) {
239
245
  this.state('reject', 'Security');
@@ -248,12 +254,12 @@ class Deva {
248
254
  The Support feature sets the correct variables and necessary rules for the
249
255
  client presented data.
250
256
  ***************/
251
- Support() {
257
+ Support(resolve, reject) {
252
258
  this.zone('support');
253
- this.action('Support');
259
+ this.action('support');
254
260
  const _cl = this.client(); // set the local client variable
255
261
  try {
256
- if (!_cl.features.support) return Promise.resolve() // move to Services if no support feature
262
+ if (!_cl.features.support) return resolve() // move to Services if no support feature
257
263
  else {
258
264
  this.state('set', 'Support');
259
265
  const {id, features, profile} = _cl; // set the local consts from client copy
@@ -267,11 +273,11 @@ class Deva {
267
273
  personal: support.devas[this._agent.key], // Client personalSecurity features and rules.
268
274
  };
269
275
  delete this._client.features.support; // delete the support key from the client
270
- return Promise.resolve(); // when done move to Services
276
+ return resolve(); // when done move to Services
271
277
  }
272
278
  } catch (e) {
273
279
  this.state('reject', 'Services');
274
- return this.error(e); // run error handling if an error is caught
280
+ return this.error(e, false, reject); // run error handling if an error is caught
275
281
  }
276
282
  }
277
283
 
@@ -282,12 +288,12 @@ class Deva {
282
288
  The Services feature sets the correct variables and necessary rules for the
283
289
  client presented data.
284
290
  ***************/
285
- Services() {
291
+ Services(resolve, reject) {
286
292
  this.zone('services')
287
- this.action('Services');
293
+ this.action('services');
288
294
  const _cl = this.client(); // set local client
289
295
  try {
290
- if (!_cl.features.services) return Promise.resolve(); // move to Done if no Services feature
296
+ if (!_cl.features.services) return resolve(); // move to Done if no Services feature
291
297
  else {
292
298
  this.state('set', 'Services');
293
299
  const {id, features, profile} = _cl; // set the local consts from client copy
@@ -301,11 +307,11 @@ class Deva {
301
307
  personal: services.devas[this._agent.key], // Client personal features and rules.
302
308
  };
303
309
  delete this._client.features.services; // delete the services key for isolation
304
- return Promise.resolve(); // go to Done
310
+ return resolve(); // go to Done
305
311
  }
306
312
  } catch (e) {
307
313
  this.state('reject', 'Services');
308
- return this.error(e); // run error handling if an error is caught
314
+ return this.error(e, false, reject); // run error handling if an error is caught
309
315
  }
310
316
  }
311
317
 
@@ -316,30 +322,98 @@ class Deva {
316
322
  The Systems feature sets the correct variables and necessary rules for the
317
323
  client presented data.
318
324
  ***************/
319
- Systems() {
325
+ Systems(resolve, reject) {
320
326
  this.zone('systems')
321
- this.action('Systems');
327
+ this.action('systems');
322
328
  const _cl = this.client(); // set local client
323
329
  try {
324
- if (!_cl.features.services) return Promise.resolve(); // move to Done if no Systems feature
330
+ if (!_cl.features.systems) return resolve(); // move to Done if no Systems feature
325
331
  else {
326
332
  this.state('set', 'Systems');
327
333
  const {id, features, profile} = _cl; // set the local consts from client copy
328
- const {services} = features; // set services from features const
329
- this._services = { // set this_services with data
330
- id: this.lib.uid(true), // uuid of the services feature
334
+ const {systems} = features; // set systems from features const
335
+ this._systems = { // set this_systems with data
336
+ id: this.lib.uid(true), // uuid of the systems feature
331
337
  client_id: id, // client id for reference
332
338
  client_name: profile.name, // client name for personalization
333
- concerns: services.concerns, // any concerns for client
334
- global: services.global, // the global policies for client
335
- personal: services.devas[this._agent.key], // Client personal features and rules.
339
+ concerns: systems.concerns, // any concerns for client
340
+ global: systems.global, // the global policies for client
341
+ personal: systems.devas[this._agent.key], // Client personal features and rules.
336
342
  };
337
- delete this._client.features.services; // delete the services key for isolation
338
- return Promise.resolve(); // go to Done
343
+ delete this._client.features.systems; // delete the services key for isolation
344
+ return resolve(); // go to Done
339
345
  }
340
346
  } catch (e) {
341
347
  this.state('reject', 'Systems');
342
- return this.error(e); // run error handling if an error is caught
348
+ return this.error(e, false, reject); // run error handling if an error is caught
349
+ }
350
+ }
351
+
352
+ /**************
353
+ func: Legal
354
+ params: client: false
355
+ describe:
356
+ The Legal feature sets the correct variables and necessary rules for the
357
+ client presented data.
358
+ ***************/
359
+ Legal(resolve, reject) {
360
+ this.zone('legal')
361
+ this.action('legal');
362
+ const _cl = this.client(); // set local client
363
+ try {
364
+ if (!_cl.features.legal) return resolve(); // move to Done if no Systems feature
365
+ else {
366
+ this.state('set', 'Legal');
367
+ const {id, features, profile} = _cl; // set the local consts from client copy
368
+ const {legal} = features; // set services from features const
369
+ this._legal = { // set this_services with data
370
+ id: this.lib.uid(true), // uuid of the services feature
371
+ client_id: id, // client id for reference
372
+ client_name: profile.name, // client name for personalization
373
+ concerns: legal.concerns, // any concerns for client
374
+ global: legal.global, // the global policies for client
375
+ personal: legal.devas[this._agent.key], // Client personal features and rules.
376
+ };
377
+ delete this._client.features.legal; // delete the services key for isolation
378
+ return resolve(); // go to Done
379
+ }
380
+ } catch (e) {
381
+ this.state('reject', 'Legal');
382
+ return this.error(e, false, reject); // run error handling if an error is caught
383
+ }
384
+ }
385
+
386
+ /**************
387
+ func: Justice
388
+ params: client: false
389
+ describe:
390
+ The Justice feature sets the correct variables and necessary rules for the
391
+ client presented data.
392
+ ***************/
393
+ Justice(resolve, reject) {
394
+ this.zone('justice')
395
+ this.action('justice');
396
+ const _cl = this.client(); // set local client
397
+ try {
398
+ if (!_cl.features.justice) return resolve(); // move to Done if no Systems feature
399
+ else {
400
+ this.state('set', 'Justice');
401
+ const {id, features, profile} = _cl; // set the local consts from client copy
402
+ const {justice} = features; // set services from features const
403
+ this._justice = { // set this_services with data
404
+ id: this.lib.uid(true), // uuid of the services feature
405
+ client_id: id, // client id for reference
406
+ client_name: profile.name, // client name for personalization
407
+ concerns: justice.concerns, // any concerns for client
408
+ global: justice.global, // the global policies for client
409
+ personal: justice.devas[this._agent.key], // Client personal features and rules.
410
+ };
411
+ delete this._client.features.justice; // delete the services key for isolation
412
+ return resolve(); // go to Done
413
+ }
414
+ } catch (e) {
415
+ this.state('reject', 'Justice');
416
+ return this.error(e, false, reject); // run error handling if an error is caught
343
417
  }
344
418
  }
345
419
 
@@ -348,18 +422,16 @@ class Deva {
348
422
  params: none
349
423
  describe: The end of the workflow Client Feature Workflow
350
424
  ***************/
351
- Done() {
352
- this.action('Done');
353
- return new Promise((resolve, reject) => {
354
- try {
355
- this.state('Done');
356
- delete this._client.features; // delete the features key when done.
357
- return resolve(this.client()); // resolve an empty pr
358
- } catch (e) {
359
- this.state('reject', 'Done');
360
- return this.error(e, false, reject);
361
- }
362
- });
425
+ Done(resolve, reject) {
426
+ this.action('done');
427
+ try {
428
+ this.state('Done');
429
+ delete this._client.features; // delete the features key when done.
430
+ return resolve(this.client()); // resolve an empty pr
431
+ } catch (e) {
432
+ this.state('reject', 'Done');
433
+ return this.error(e, false, reject);
434
+ }
363
435
  }
364
436
 
365
437
  /**************
@@ -684,17 +756,21 @@ class Deva {
684
756
  }).then(() => {
685
757
  return this._assignListeners();
686
758
  }).then(() => {
687
- return this.Client(client);
759
+ return this.Client(client, resolve, reject);
760
+ }).then(() => {
761
+ return this.Security(resolve, reject);
762
+ }).then(() => {
763
+ return this.Services(resolve, reject);
688
764
  }).then(() => {
689
- return this.Security();
765
+ return this.Support(resolve, reject);
690
766
  }).then(() => {
691
- return this.Services();
767
+ return this.Systems(resolve, reject);
692
768
  }).then(() => {
693
- return this.Support();
769
+ return this.Legal(resolve, reject);
694
770
  }).then(() => {
695
- return this.Systems();
771
+ return this.Justice(resolve, reject);
696
772
  }).then(() => {
697
- return this.Done();
773
+ return this.Done(resolve, reject);
698
774
  }).then(() => {
699
775
  this.zone('init');
700
776
  const hasOnInit = this.onInit && typeof this.onInit === 'function';
@@ -1256,6 +1332,42 @@ class Deva {
1256
1332
  }
1257
1333
  }
1258
1334
 
1335
+ /**************
1336
+ func: legal
1337
+ params: none
1338
+ describe: basic legal features available in a Deva.
1339
+ usage: this.systems()
1340
+ ***************/
1341
+ legal() {
1342
+ if (!this._active) return this._messages.offline; // check the active status
1343
+ this.zone('legal');
1344
+ this.feature('legal'); // set the support state
1345
+ try {
1346
+ this.state('return', 'legal'); // set the systems state
1347
+ return this.lib.copy(this._legal); // return the systems feature
1348
+ } catch (e) {
1349
+ return this.error(e); // return this.error when error catch
1350
+ }
1351
+ }
1352
+
1353
+ /**************
1354
+ func: justice
1355
+ params: none
1356
+ describe: basic justice features available in a Deva.
1357
+ usage: this.systems()
1358
+ ***************/
1359
+ justice() {
1360
+ if (!this._active) return this._messages.offline; // check the active status
1361
+ this.zone('justice');
1362
+ this.feature('justice'); // set the support state
1363
+ try {
1364
+ this.state('return', 'justice'); // set the systems state
1365
+ return this.lib.copy(this._justice); // return the systems feature
1366
+ } catch (e) {
1367
+ return this.error(e); // return this.error when error catch
1368
+ }
1369
+ }
1370
+
1259
1371
  /**************
1260
1372
  func: load
1261
1373
  params:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/tests/agent.json CHANGED
@@ -34,30 +34,6 @@
34
34
  "gender": "M"
35
35
  },
36
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
37
  "security": {
62
38
  "label": "🚨SECURITY",
63
39
  "name": "@SECURITY",
@@ -76,17 +52,23 @@
76
52
  "tag": "#SERVICES",
77
53
  "loc": "$SERVICES"
78
54
  },
79
- "solutions": {
80
- "label": "💡SOLUTIONS",
81
- "name": "@SOLUTIONS",
82
- "tag": "#SOLUTIONS",
83
- "loc": "$SOLUTIONS"
84
- },
85
55
  "systems": {
86
56
  "label": "🔧SYSTEMS",
87
- "name": "@SOLUTIONS",
88
- "tag": "#SOLUTIONS",
89
- "loc": "$SOLUTIONS"
57
+ "name": "@SYSTEMS",
58
+ "tag": "#SYSTEMS",
59
+ "loc": "$SYSTEMS"
60
+ },
61
+ "legal": {
62
+ "label": "🏛️LEGAL",
63
+ "name": "@LEGAL",
64
+ "tag": "#LEGAL",
65
+ "loc": "$LEGAL"
66
+ },
67
+ "justice": {
68
+ "label": "⚖️JUSTICE",
69
+ "name": "@JUSTICE",
70
+ "tag": "#JUSTICE",
71
+ "loc": "$JUSTICE"
90
72
  }
91
73
  },
92
74
  "vars": {
package/tests/client.json CHANGED
@@ -43,16 +43,12 @@
43
43
  },
44
44
  "concerns": [],
45
45
  "global": {},
46
- "devas": {
47
- "hello": {}
48
- }
46
+ "devas": {}
49
47
  },
50
48
  "support": {
51
49
  "concerns": [],
52
50
  "global": {},
53
- "devas": {
54
- "hello": {}
55
- }
51
+ "devas": {}
56
52
  },
57
53
  "services": {
58
54
  "concerns": [],
@@ -69,58 +65,22 @@
69
65
  "systems": {
70
66
  "concerns": [],
71
67
  "global": {},
72
- "devas": {
73
- "hello": {}
74
- }
75
- },
76
- "solutions": {
77
- "concerns": [],
78
- "global": {},
79
- "devas": {
80
- "hello": {}
81
- }
82
- },
83
- "development": {
84
- "concerns": [],
85
- "global": {},
86
- "devas": {
87
- "hello": {}
88
- }
89
- },
90
- "assistant": {
91
- "concerns": [],
92
- "global": {},
93
- "devas": {
94
- "hello": {}
95
- }
96
- },
97
- "business": {
98
- "concerns": [],
99
- "global": {},
100
- "devas": {
101
- "hello": {}
102
- }
68
+ "devas": {}
103
69
  },
104
70
  "legal": {
105
71
  "concerns": [],
106
72
  "global": {},
107
- "devas": {
108
- "hello": {}
109
- }
73
+ "devas": {}
110
74
  },
111
- "story": {
75
+ "justice": {
112
76
  "concerns": [],
113
77
  "global": {},
114
- "devas": {
115
- "hello": {}
116
- }
78
+ "devas": {}
117
79
  },
118
- "mind": {
80
+ "authority": {
119
81
  "concerns": [],
120
82
  "global": {},
121
- "devas": {
122
- "hello": {}
123
- }
83
+ "devas": {}
124
84
  }
125
85
  }
126
86
  }