@indra.ai/deva 1.3.4 → 1.3.6

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
@@ -42,11 +42,12 @@
42
42
  "client": "👨‍💼 Client",
43
43
  "agent": "🤖 Agent",
44
44
  "security": "🔐 Security",
45
- "support": "💼 Support",
46
- "services": "🛠️ Services",
47
- "systems": "📡 Systems",
45
+ "support": "🚑 Support",
46
+ "services": "🚚 Services",
47
+ "systems": "🚛 Systems",
48
48
  "legal": "🏛️ Legal",
49
- "authority": "👮‍♂️ Authority",
49
+ "authority": "🚔 Authority",
50
+ "justice": "⚖️ Justice",
50
51
  "help": "💚 Help",
51
52
  "error": "❌ Error!"
52
53
  },
@@ -108,7 +109,7 @@
108
109
  "abort": "💔 ABORT!",
109
110
  "error": "❌ ERROR!",
110
111
  "help": "💙 Help",
111
- "authorized": "🔐 authorized",
112
+ "authorized": "🔑 authorized",
112
113
  "unauthorized": "🏴‍☠️ unauthorized",
113
114
  "Done": "☑️ Done",
114
115
  "glitch": "😡 Glitch",
@@ -172,11 +173,13 @@
172
173
  "ask": "📣 Ask",
173
174
 
174
175
  "client": "👨 Client",
175
- "security": "🚓 Security",
176
- "support": "🚑 Support",
177
- "services": "🚚 Services",
178
- "systems": "🚛 Systems",
179
- "legal": "⚖️ Legal",
176
+ "security": "🔐 Security",
177
+ "support": "🩹 Support",
178
+ "services": "🛠️ Services",
179
+ "systems": "📡 Systems",
180
+ "legal": "🗃️ Legal",
181
+ "justice": "🗄️ Justice",
182
+ "authority": "👮 Authority",
180
183
 
181
184
  "invalid": "❌ Invalid",
182
185
  "states": "🛻 States",
package/index.js CHANGED
@@ -20,8 +20,10 @@ 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.
24
- this._legal = 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.
26
+ this._authority = false; // inherited Justice features.
25
27
  this.events = opts.events || new EventEmitter({}); // Event Bus
26
28
  this.lib = new lib({}); // used for loading library functions
27
29
  this.utils = opts.utils || {}; // parse function
@@ -222,7 +224,7 @@ class Deva {
222
224
  this.action('security'); // set action to Security
223
225
  const _cl = this.client(); // set local copy of client data
224
226
  try {
225
- if (!_cl.features.security) return this.Support(); // if no security feature goto Support
227
+ if (!_cl.features.security) return resolve(); // if no security feature goto Support
226
228
  else {
227
229
  this.state('set', 'Security');
228
230
  const {id, profile, features} = _cl; // make a copy the clinet data.
@@ -258,7 +260,7 @@ class Deva {
258
260
  this.action('support');
259
261
  const _cl = this.client(); // set the local client variable
260
262
  try {
261
- if (!_cl.features.support) return Promise.resolve() // move to Services if no support feature
263
+ if (!_cl.features.support) return resolve() // move to Services if no support feature
262
264
  else {
263
265
  this.state('set', 'Support');
264
266
  const {id, features, profile} = _cl; // set the local consts from client copy
@@ -292,7 +294,7 @@ class Deva {
292
294
  this.action('services');
293
295
  const _cl = this.client(); // set local client
294
296
  try {
295
- if (!_cl.features.services) return Promise.resolve(); // move to Done if no Services feature
297
+ if (!_cl.features.services) return resolve(); // move to Done if no Services feature
296
298
  else {
297
299
  this.state('set', 'Services');
298
300
  const {id, features, profile} = _cl; // set the local consts from client copy
@@ -326,20 +328,20 @@ class Deva {
326
328
  this.action('systems');
327
329
  const _cl = this.client(); // set local client
328
330
  try {
329
- if (!_cl.features.services) return Promise.resolve(); // move to Done if no Systems feature
331
+ if (!_cl.features.systems) return resolve(); // move to Done if no Systems feature
330
332
  else {
331
333
  this.state('set', 'Systems');
332
334
  const {id, features, profile} = _cl; // set the local consts from client copy
333
- const {services} = features; // set services from features const
334
- this._services = { // set this_services with data
335
- id: this.lib.uid(true), // uuid of the services feature
335
+ const {systems} = features; // set systems from features const
336
+ this._systems = { // set this_systems with data
337
+ id: this.lib.uid(true), // uuid of the systems feature
336
338
  client_id: id, // client id for reference
337
339
  client_name: profile.name, // client name for personalization
338
- concerns: services.concerns, // any concerns for client
339
- global: services.global, // the global policies for client
340
- personal: services.devas[this._agent.key], // Client personal features and rules.
340
+ concerns: systems.concerns, // any concerns for client
341
+ global: systems.global, // the global policies for client
342
+ personal: systems.devas[this._agent.key], // Client personal features and rules.
341
343
  };
342
- delete this._client.features.services; // delete the services key for isolation
344
+ delete this._client.features.systems; // delete the services key for isolation
343
345
  return resolve(); // go to Done
344
346
  }
345
347
  } catch (e) {
@@ -360,7 +362,7 @@ class Deva {
360
362
  this.action('legal');
361
363
  const _cl = this.client(); // set local client
362
364
  try {
363
- if (!_cl.features.legal) return Promise.resolve(); // move to Done if no Systems feature
365
+ if (!_cl.features.legal) return resolve(); // move to Done if no Systems feature
364
366
  else {
365
367
  this.state('set', 'Legal');
366
368
  const {id, features, profile} = _cl; // set the local consts from client copy
@@ -382,6 +384,74 @@ class Deva {
382
384
  }
383
385
  }
384
386
 
387
+ /**************
388
+ func: Justice
389
+ params: client: false
390
+ describe:
391
+ The Justice feature sets the correct variables and necessary rules for the
392
+ client presented data.
393
+ ***************/
394
+ Justice(resolve, reject) {
395
+ this.zone('justice')
396
+ this.action('justice');
397
+ const _cl = this.client(); // set local client
398
+ try {
399
+ if (!_cl.features.justice) return resolve(); // move to Done if no Systems feature
400
+ else {
401
+ this.state('set', 'Justice');
402
+ const {id, features, profile} = _cl; // set the local consts from client copy
403
+ const {justice} = features; // set services from features const
404
+ this._justice = { // set this_services with data
405
+ id: this.lib.uid(true), // uuid of the services feature
406
+ client_id: id, // client id for reference
407
+ client_name: profile.name, // client name for personalization
408
+ concerns: justice.concerns, // any concerns for client
409
+ global: justice.global, // the global policies for client
410
+ personal: justice.devas[this._agent.key], // Client personal features and rules.
411
+ };
412
+ delete this._client.features.justice; // delete the services key for isolation
413
+ return resolve(); // go to Done
414
+ }
415
+ } catch (e) {
416
+ this.state('reject', 'Justice');
417
+ return this.error(e, false, reject); // run error handling if an error is caught
418
+ }
419
+ }
420
+
421
+ /**************
422
+ func: Authority
423
+ params: client: false
424
+ describe:
425
+ The Authority feature sets the correct variables and necessary rules for the
426
+ client presented data.
427
+ ***************/
428
+ Authority(resolve, reject) {
429
+ this.zone('authority')
430
+ this.action('authority');
431
+ const _cl = this.client(); // set local client
432
+ try {
433
+ if (!_cl.features.authority) return resolve(); // move to Done if no Systems feature
434
+ else {
435
+ this.state('set', 'Authority');
436
+ const {id, features, profile} = _cl; // set the local consts from client copy
437
+ const {authority} = features; // set services from features const
438
+ this._authority = { // set this_services with data
439
+ id: this.lib.uid(true), // uuid of the services feature
440
+ client_id: id, // client id for reference
441
+ client_name: profile.name, // client name for personalization
442
+ concerns: authority.concerns, // any concerns for client
443
+ global: authority.global, // the global policies for client
444
+ personal: authority.devas[this._agent.key], // Client personal features and rules.
445
+ };
446
+ delete this._client.features.authority; // delete the services key for isolation
447
+ return resolve(); // go to Done
448
+ }
449
+ } catch (e) {
450
+ this.state('reject', 'Authority');
451
+ return this.error(e, false, reject); // run error handling if an error is caught
452
+ }
453
+ }
454
+
385
455
  /**************
386
456
  func: Done
387
457
  params: none
@@ -732,6 +802,10 @@ class Deva {
732
802
  return this.Systems(resolve, reject);
733
803
  }).then(() => {
734
804
  return this.Legal(resolve, reject);
805
+ }).then(() => {
806
+ return this.Justice(resolve, reject);
807
+ }).then(() => {
808
+ return this.Authority(resolve, reject);
735
809
  }).then(() => {
736
810
  return this.Done(resolve, reject);
737
811
  }).then(() => {
@@ -1301,7 +1375,7 @@ class Deva {
1301
1375
  describe: basic legal features available in a Deva.
1302
1376
  usage: this.systems()
1303
1377
  ***************/
1304
- systems() {
1378
+ legal() {
1305
1379
  if (!this._active) return this._messages.offline; // check the active status
1306
1380
  this.zone('legal');
1307
1381
  this.feature('legal'); // set the support state
@@ -1313,6 +1387,42 @@ class Deva {
1313
1387
  }
1314
1388
  }
1315
1389
 
1390
+ /**************
1391
+ func: justice
1392
+ params: none
1393
+ describe: basic justice features available in a Deva.
1394
+ usage: this.systems()
1395
+ ***************/
1396
+ justice() {
1397
+ if (!this._active) return this._messages.offline; // check the active status
1398
+ this.zone('justice');
1399
+ this.feature('justice'); // set the support state
1400
+ try {
1401
+ this.state('return', 'justice'); // set the systems state
1402
+ return this.lib.copy(this._justice); // return the systems feature
1403
+ } catch (e) {
1404
+ return this.error(e); // return this.error when error catch
1405
+ }
1406
+ }
1407
+
1408
+ /**************
1409
+ func: authority
1410
+ params: none
1411
+ describe: basic authority features available in a Deva.
1412
+ usage: this.systems()
1413
+ ***************/
1414
+ authority() {
1415
+ if (!this._active) return this._messages.offline; // check the active status
1416
+ this.zone('authority');
1417
+ this.feature('authority'); // set the support state
1418
+ try {
1419
+ this.state('return', 'authority'); // set the systems state
1420
+ return this.lib.copy(this._authority); // return the systems feature
1421
+ } catch (e) {
1422
+ return this.error(e); // return this.error when error catch
1423
+ }
1424
+ }
1425
+
1316
1426
  /**************
1317
1427
  func: load
1318
1428
  params:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
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
  }