@indra.ai/deva 1.3.4 → 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
@@ -47,6 +47,7 @@
47
47
  "systems": "📡 Systems",
48
48
  "legal": "🏛️ Legal",
49
49
  "authority": "👮‍♂️ Authority",
50
+ "justice": "⚖️ Justice",
50
51
  "help": "💚 Help",
51
52
  "error": "❌ Error!"
52
53
  },
@@ -176,7 +177,9 @@
176
177
  "support": "🚑 Support",
177
178
  "services": "🚚 Services",
178
179
  "systems": "🚛 Systems",
179
- "legal": "⚖️ Legal",
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,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.
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.
25
26
  this.events = opts.events || new EventEmitter({}); // Event Bus
26
27
  this.lib = new lib({}); // used for loading library functions
27
28
  this.utils = opts.utils || {}; // parse function
@@ -222,7 +223,7 @@ class Deva {
222
223
  this.action('security'); // set action to Security
223
224
  const _cl = this.client(); // set local copy of client data
224
225
  try {
225
- 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
226
227
  else {
227
228
  this.state('set', 'Security');
228
229
  const {id, profile, features} = _cl; // make a copy the clinet data.
@@ -258,7 +259,7 @@ class Deva {
258
259
  this.action('support');
259
260
  const _cl = this.client(); // set the local client variable
260
261
  try {
261
- 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
262
263
  else {
263
264
  this.state('set', 'Support');
264
265
  const {id, features, profile} = _cl; // set the local consts from client copy
@@ -292,7 +293,7 @@ class Deva {
292
293
  this.action('services');
293
294
  const _cl = this.client(); // set local client
294
295
  try {
295
- 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
296
297
  else {
297
298
  this.state('set', 'Services');
298
299
  const {id, features, profile} = _cl; // set the local consts from client copy
@@ -326,20 +327,20 @@ class Deva {
326
327
  this.action('systems');
327
328
  const _cl = this.client(); // set local client
328
329
  try {
329
- 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
330
331
  else {
331
332
  this.state('set', 'Systems');
332
333
  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
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
336
337
  client_id: id, // client id for reference
337
338
  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.
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.
341
342
  };
342
- delete this._client.features.services; // delete the services key for isolation
343
+ delete this._client.features.systems; // delete the services key for isolation
343
344
  return resolve(); // go to Done
344
345
  }
345
346
  } catch (e) {
@@ -360,7 +361,7 @@ class Deva {
360
361
  this.action('legal');
361
362
  const _cl = this.client(); // set local client
362
363
  try {
363
- if (!_cl.features.legal) return Promise.resolve(); // move to Done if no Systems feature
364
+ if (!_cl.features.legal) return resolve(); // move to Done if no Systems feature
364
365
  else {
365
366
  this.state('set', 'Legal');
366
367
  const {id, features, profile} = _cl; // set the local consts from client copy
@@ -382,6 +383,40 @@ class Deva {
382
383
  }
383
384
  }
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
417
+ }
418
+ }
419
+
385
420
  /**************
386
421
  func: Done
387
422
  params: none
@@ -732,6 +767,8 @@ class Deva {
732
767
  return this.Systems(resolve, reject);
733
768
  }).then(() => {
734
769
  return this.Legal(resolve, reject);
770
+ }).then(() => {
771
+ return this.Justice(resolve, reject);
735
772
  }).then(() => {
736
773
  return this.Done(resolve, reject);
737
774
  }).then(() => {
@@ -1301,7 +1338,7 @@ class Deva {
1301
1338
  describe: basic legal features available in a Deva.
1302
1339
  usage: this.systems()
1303
1340
  ***************/
1304
- systems() {
1341
+ legal() {
1305
1342
  if (!this._active) return this._messages.offline; // check the active status
1306
1343
  this.zone('legal');
1307
1344
  this.feature('legal'); // set the support state
@@ -1313,6 +1350,24 @@ class Deva {
1313
1350
  }
1314
1351
  }
1315
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
+
1316
1371
  /**************
1317
1372
  func: load
1318
1373
  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.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
  }