@indra.ai/deva 1.5.61 → 1.6.1

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/index.js CHANGED
@@ -19,9 +19,12 @@ class Deva {
19
19
  this._agent = opts.agent || false; // Agent profile object
20
20
  this._client = {}; // this will be set on init.
21
21
  this._active = false; // the active/birth date.
22
- this._data = false; // inherited Vector features.
23
- this._vector = false; // inherited Vector features.
24
22
  this._veda = false; // inherited Veda features.
23
+ this._data = false; // inherited Data features.
24
+ this._error = false; // inherited Error features.
25
+ this._log = false; // inherited Log features.
26
+ this._report = false; // inherited Report features.
27
+ this._vector = false; // inherited Vector features.
25
28
  this._god = false; // inherited God features.
26
29
  this._king = false; // inherited King features.
27
30
  this._treasury = false; // inherited Vector features.
@@ -72,7 +75,6 @@ class Deva {
72
75
 
73
76
  this._context = opts.context || false; // set the local context
74
77
 
75
- this._message = config.message; // current message of agent.
76
78
  this._messages = config.messages; // set the messages from config
77
79
  }
78
80
 
@@ -96,7 +98,7 @@ class Deva {
96
98
  });
97
99
  }
98
100
  catch (e) {
99
- return this.error(e, false, reject); // trigger the this.error for errors
101
+ return this.err(e, false, reject); // trigger the this.err for errors
100
102
  }
101
103
  finally {
102
104
  return resolve(); // when the configuration is complete then return an empty resolve.
@@ -131,7 +133,7 @@ class Deva {
131
133
  }
132
134
  }
133
135
  catch (e) {
134
- return this.error(e, false, reject); // pass errors to this.error
136
+ return this.err(e, false, reject); // pass errors to this.err
135
137
  }
136
138
  finally {
137
139
  return resolve(); // resolve the function after everything is done.
@@ -159,7 +161,7 @@ class Deva {
159
161
  return resolve();
160
162
  }
161
163
  catch (e) {
162
- return this.error(e, false, reject);
164
+ return this.err(e, false, reject);
163
165
  }
164
166
  });
165
167
  }
@@ -223,7 +225,7 @@ class Deva {
223
225
  return data; // return the security feature
224
226
  } catch (e) {
225
227
  this.state('catch', key);
226
- return this.error(e);
228
+ return this.err(e);
227
229
  }
228
230
  }
229
231
 
@@ -259,7 +261,7 @@ class Deva {
259
261
  this.state('resolve', 'client');
260
262
  return resolve();
261
263
  } catch (e) {
262
- return this.error(e, false, reject);
264
+ return this.err(e, false, reject);
263
265
  }
264
266
  }
265
267
 
@@ -298,10 +300,21 @@ class Deva {
298
300
  }
299
301
  } catch (e) {
300
302
  this.state('catch', `${feature}:${_id.uid}`);
301
- return this.error(e, feature, reject); // run error handling if an error is caught
303
+ return this.err(e, feature, reject); // run error handling if an error is caught
302
304
  }
303
305
  }
304
306
 
307
+ /**************
308
+ func: Veda
309
+ params: resolve, reject
310
+ describe:
311
+ The Veda feature sets the correct variables and necessary rules for the
312
+ client presented data.
313
+ ***************/
314
+ Veda(resolve, reject) {
315
+ return this.Feature('veda', resolve, reject);
316
+ }
317
+
305
318
  /**************
306
319
  func: Data
307
320
  params: resolve, reject
@@ -314,25 +327,47 @@ class Deva {
314
327
  }
315
328
 
316
329
  /**************
317
- func: Vector
330
+ func: Error
318
331
  params: resolve, reject
319
332
  describe:
320
- The Vector feature sets the correct variables and necessary rules for the
333
+ The Error feature sets the correct variables and necessary rules for the
321
334
  client presented data.
322
335
  ***************/
323
- Vector(resolve, reject) {
324
- return this.Feature('vector', resolve, reject);
336
+ Error(resolve, reject) {
337
+ return this.Feature('error', resolve, reject);
325
338
  }
326
339
 
327
340
  /**************
328
- func: Veda
341
+ func: Log
329
342
  params: resolve, reject
330
343
  describe:
331
- The Veda feature sets the correct variables and necessary rules for the
344
+ The Log feature sets the correct variables and necessary rules for the
332
345
  client presented data.
333
346
  ***************/
334
- Veda(resolve, reject) {
335
- return this.Feature('veda', resolve, reject);
347
+ Log(resolve, reject) {
348
+ return this.Feature('log', resolve, reject);
349
+ }
350
+
351
+ /**************
352
+ func: Report
353
+ params: resolve, reject
354
+ describe:
355
+ The Report feature sets the correct variables and necessary rules for the
356
+ client presented data.
357
+ ***************/
358
+ Report(resolve, reject) {
359
+ return this.Feature('report', resolve, reject);
360
+ }
361
+
362
+ /**************
363
+ func: Vector
364
+ params: resolve, reject
365
+ describe:
366
+ The Vector feature sets the correct variables and necessary rules for the
367
+ client presented data.
368
+ ***************/
369
+ Vector(resolve, reject) {
370
+ return this.Feature('vector', resolve, reject);
336
371
  }
337
372
 
338
373
  /**************
@@ -533,7 +568,7 @@ class Deva {
533
568
  return resolve(this.client()); // resolve an empty pr
534
569
  } catch (e) {
535
570
  this.state('catch', 'Done');
536
- return this.error(e, false, reject);
571
+ return this.err(e, false, reject);
537
572
  }
538
573
  }
539
574
 
@@ -688,7 +723,7 @@ class Deva {
688
723
  }
689
724
  catch(e) {
690
725
  this.state('catch', 'question');
691
- return this.error(e); // if a overall error happens this witll call this.error
726
+ return this.err(e); // if a overall error happens this witll call this.err
692
727
  }
693
728
  });
694
729
  }
@@ -753,11 +788,11 @@ class Deva {
753
788
  return this.finish(packet, resolve); // resolve the packet to the caller.
754
789
  }).catch(err => { // catch any errors in the method
755
790
  this.state('catch', `answer:${method}:${id.uid}`); // set the state reject answer
756
- return this.error(err, packet, reject); // return this.error with err, packet, reject
791
+ return this.err(err, packet, reject); // return this.err with err, packet, reject
757
792
  });
758
793
  } catch (e) {
759
794
  this.state('catch', `answer:${method}:${id.uid}`);
760
- return this.error(e, packet, reject);
795
+ return this.err(e, packet, reject);
761
796
  }
762
797
  }
763
798
 
@@ -829,13 +864,13 @@ class Deva {
829
864
  }).catch(err => {
830
865
  this.talk(`${agent.key}:ask:${packet.id.uid}`, {error:err});
831
866
  this.state('catch', `ask:${method}:${packet.id.uid}`);
832
- return this.error(err, packet);
867
+ return this.err(err, packet);
833
868
  })
834
869
  }
835
870
  catch (e) {
836
871
  this.state('catch', `ask:${method}:${packet.id.uid}`);
837
872
  this.talk(`${agent.key}:ask:${packet.id.uid}`, {error:e});
838
- return this.error(e, packet)
873
+ return this.err(e, packet)
839
874
  }
840
875
  // now when we ask the meta params[0] should be the method
841
876
  }
@@ -886,12 +921,18 @@ class Deva {
886
921
  this.action('init');
887
922
  this.state('init');
888
923
  return this.Client(client, resolve, reject);
924
+ }).then(() => {
925
+ return this.Veda(resolve, reject);
889
926
  }).then(() => {
890
927
  return this.Data(resolve, reject);
891
928
  }).then(() => {
892
- return this.Vector(resolve, reject);
929
+ return this.Error(resolve, reject);
893
930
  }).then(() => {
894
- return this.Veda(resolve, reject);
931
+ return this.Log(resolve, reject);
932
+ }).then(() => {
933
+ return this.Report(resolve, reject);
934
+ }).then(() => {
935
+ return this.Vector(resolve, reject);
895
936
  }).then(() => {
896
937
  return this.God(resolve, reject);
897
938
  }).then(() => {
@@ -934,7 +975,7 @@ class Deva {
934
975
  return hasOnInit ? this.onInit(data, resolve) : this.start(data, resolve);
935
976
  }).catch(err => {
936
977
  this.state('catch', `init:${data.id.uid}`);
937
- return this.error(err, client, reject);
978
+ return this.err(err, client, reject);
938
979
  });
939
980
  });
940
981
  }
@@ -1260,7 +1301,7 @@ class Deva {
1260
1301
  this.talk(config.events.state, data); // broadcasat the state event
1261
1302
  return data;
1262
1303
  } catch (e) { // catch any errors
1263
- return this.error(e); // return if an error happens
1304
+ return this.err(e); // return if an error happens
1264
1305
  }
1265
1306
  }
1266
1307
 
@@ -1320,7 +1361,7 @@ class Deva {
1320
1361
  return data;
1321
1362
  } catch (e) {
1322
1363
  this.state('catch', `zone:${value}:${id.uid}`);
1323
- return this.error(e, value);
1364
+ return this.err(e, value);
1324
1365
  }
1325
1366
  }
1326
1367
 
@@ -1387,7 +1428,7 @@ class Deva {
1387
1428
  return data;
1388
1429
  } catch (e) { // catch any errors that occur
1389
1430
  this.state('catch', `action:${value}:${id.uid}`);
1390
- return this.error(e); // return error on error catch
1431
+ return this.err(e); // return error on error catch
1391
1432
  }
1392
1433
  }
1393
1434
 
@@ -1448,7 +1489,7 @@ class Deva {
1448
1489
  return data;
1449
1490
  } catch (e) { // catch any errors
1450
1491
  this.state('catch', `feature:${value}:${id.uid}`);
1451
- return this.error(e); // retun this.error when an error is caught.
1492
+ return this.err(e); // retun this.err when an error is caught.
1452
1493
  }
1453
1494
  }
1454
1495
 
@@ -1512,7 +1553,7 @@ class Deva {
1512
1553
  return data;
1513
1554
  } catch (e) {
1514
1555
  this.state('catch', `context:${value}:${id.uid}`);
1515
- return this.error(e, value);
1556
+ return this.err(e, value);
1516
1557
  }
1517
1558
  }
1518
1559
 
@@ -1574,6 +1615,16 @@ class Deva {
1574
1615
  }
1575
1616
 
1576
1617
  // FEATURE FUNCTIONS
1618
+ /**************
1619
+ func: veda
1620
+ params: none
1621
+ describe: basic veda features available in a Deva.
1622
+ usage: this.veda()
1623
+ ***************/
1624
+ veda() {
1625
+ return this._getFeature('veda', this._veda);
1626
+ }
1627
+
1577
1628
  /**************
1578
1629
  func: data
1579
1630
  params: none
@@ -1584,6 +1635,17 @@ class Deva {
1584
1635
  return this._getFeature('data', this._data);
1585
1636
  }
1586
1637
 
1638
+ /**************
1639
+ func: error
1640
+ params: none
1641
+ describe: basic error features available in a Deva.
1642
+ usage: this.error()
1643
+ ***************/
1644
+ error() {
1645
+ return this._getFeature('error', this._error);
1646
+ }
1647
+
1648
+
1587
1649
  /**************
1588
1650
  func: vector
1589
1651
  params: none
@@ -1594,15 +1656,6 @@ class Deva {
1594
1656
  return this._getFeature('vector', this._vector);
1595
1657
  }
1596
1658
 
1597
- /**************
1598
- func: veda
1599
- params: none
1600
- describe: basic veda features available in a Deva.
1601
- usage: this.veda()
1602
- ***************/
1603
- veda() {
1604
- return this._getFeature('veda', this._veda);
1605
- }
1606
1659
 
1607
1660
  /**************
1608
1661
  func: god
@@ -1805,7 +1858,7 @@ class Deva {
1805
1858
  this.state('unload', key)
1806
1859
  return resolve(`${this._states.unload}:${key}`);
1807
1860
  } catch (e) {
1808
- return this.error(e, this.devas[key], reject)
1861
+ return this.err(e, this.devas[key], reject)
1809
1862
  }
1810
1863
  });
1811
1864
  }
@@ -1964,7 +2017,7 @@ class Deva {
1964
2017
  }
1965
2018
  catch(e) {
1966
2019
  this.state('catch', `help:${id.uid}`);
1967
- return this.error(e, msg, reject);
2020
+ return this.err(e, msg, reject);
1968
2021
  }
1969
2022
  finally {
1970
2023
  this.state('return', `help:${id.uid}`);
@@ -1972,26 +2025,28 @@ class Deva {
1972
2025
  }
1973
2026
  });
1974
2027
  }
1975
-
2028
+
1976
2029
  /**************
1977
- func: error
2030
+ func: err
1978
2031
  params:
1979
2032
  - err: The error to process
1980
2033
  - data: Any additional data associated with the error
1981
2034
  - reject: An associated promise reject if the caller requires.
1982
2035
  describe:
1983
- The error function provides the consistent error manage of the system.
1984
- usage: this.error(err, data, reject);
2036
+ The err function provides the consistent error manage of the system.
2037
+ usage: this.err(err, data, reject);
1985
2038
  ***************/
1986
- error(err,packet,reject=false) {
2039
+ err(err,packet,reject=false) {
1987
2040
  const id = this.lib.uid();
1988
2041
  this.zone('error', id.uid);
2042
+ this.feature('error', id.uid);
2043
+
1989
2044
  const agent = this.agent();
1990
2045
  const client = this.client();
1991
-
2046
+
1992
2047
  this.action('error', id.uid);
1993
2048
  const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
1994
-
2049
+
1995
2050
  const data = {
1996
2051
  id,
1997
2052
  key: 'error',
@@ -2009,15 +2064,14 @@ class Deva {
2009
2064
  data.md5 = this.lib.hash(data);
2010
2065
  data.sha256 = this.lib.hash(data, 'sha256');
2011
2066
  data.sha512 = this.lib.hash(data, 'sha512');
2012
-
2067
+
2013
2068
  this.talk(config.events.error, this.lib.copy(data));
2014
-
2069
+
2015
2070
  this.state('return', `error:${id.uid}`);
2016
2071
  this.state('error', id.uid);
2017
2072
  this.context('error', id.uid);
2018
2073
  if (hasOnError) return this.onError(err, packet, reject);
2019
2074
  else return reject ? reject(err) : Promise.reject(err);
2020
- }
2021
-
2075
+ }
2022
2076
  }
2023
2077
  export default Deva;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "9f0bc743-d720-4320-832e-cf5edc3b7cf",
3
3
  "name": "@indra.ai/deva",
4
- "version": "1.5.61",
4
+ "version": "1.6.1",
5
5
  "description": "The Deva Core",
6
6
  "main": "index.js",
7
7
  "copyright": "(c)2025 Quinn A Michaels; All rights reserved.",
@@ -112,10 +112,13 @@
112
112
  "deva": "⚡️ Deva",
113
113
  "agent": "🤖 Agent",
114
114
  "client": "👨 Client",
115
+ "veda": "🕉️ Veda",
115
116
  "data": "💾️ Data",
117
+ "error": "❌ Error!",
118
+ "log": "🪵 Log",
119
+ "report": "🗂️ Report",
116
120
  "vector": "👽️ Vector",
117
121
  "god": "💫 God",
118
- "veda": "🕉️ Veda",
119
122
  "king": "👑️ King",
120
123
  "owner": "🐲️ Owner",
121
124
  "treasury": "🏦️ Treasury",
@@ -132,8 +135,7 @@
132
135
  "services": "🛠️ Services",
133
136
  "systems": "🖥️️ Systems",
134
137
  "networks": "📡 Networks",
135
- "help": "💚 Help",
136
- "error": "❌ Error!"
138
+ "help": "💚 Help"
137
139
  },
138
140
  "state": "offline",
139
141
  "states": {
@@ -217,10 +219,13 @@
217
219
  "actions": {
218
220
  "client": "👨 Client",
219
221
  "agent": "🕵️‍♂️ Agent",
222
+ "veda": "🕉️ Veda",
220
223
  "data": "💾 Data",
224
+ "error": "❌ Error",
225
+ "log": "🪵 Log",
226
+ "report": "🗂️ Report",
221
227
  "vector": "👽 Vector",
222
228
  "god": "💫 God",
223
- "veda": "🕉️ Veda",
224
229
  "king": "👑️ King",
225
230
  "owner": "🐲️ Owner",
226
231
  "treasury": "🏦 Treasury",
@@ -262,7 +267,6 @@
262
267
  "core": "🍎 Core",
263
268
  "info": "💁‍♂️ Info",
264
269
  "status": "🚥 Status",
265
- "error": "💣 Error",
266
270
  "help": "💜 Help",
267
271
  "done": "☑️ Done",
268
272
  "ready": "⭐️ Ready",
@@ -273,10 +277,13 @@
273
277
  "init": "🟠 Init",
274
278
  "agent": "🦾 Agent",
275
279
  "client": "💪 Client",
280
+ "veda": "🕉️ Veda",
276
281
  "data": "💾️ Data",
282
+ "error": "❌️ Error",
283
+ "log": "🪵️ Log",
284
+ "report": "🗂️ Report",
277
285
  "vector": "👽️ Vector",
278
286
  "god": "💫 God",
279
- "veda": "🕉️ Veda",
280
287
  "king": "👑️ King",
281
288
  "owner": "🐲️ Owner",
282
289
  "treasury": "🏦 Treasury",
@@ -294,7 +301,6 @@
294
301
  "systems": "🖥️️ Systems",
295
302
  "networks": "📡 Networks"
296
303
  },
297
- "message": "offline",
298
304
  "messages": {
299
305
  "init": "🟠 INIT",
300
306
  "start": "🟢 START",
package/tests/client.json CHANGED
@@ -34,17 +34,32 @@
34
34
  "currency": "USD"
35
35
  },
36
36
  "features": {
37
+ "veda": {
38
+ "concerns": [],
39
+ "global": [],
40
+ "devas": {}
41
+ },
37
42
  "data": {
38
43
  "concerns": [],
39
44
  "global": [],
40
45
  "devas": {}
41
46
  },
42
- "vector": {
47
+ "error": {
43
48
  "concerns": [],
44
49
  "global": [],
45
50
  "devas": {}
46
51
  },
47
- "veda": {
52
+ "log": {
53
+ "concerns": [],
54
+ "global": [],
55
+ "devas": {}
56
+ },
57
+ "report": {
58
+ "concerns": [],
59
+ "global": [],
60
+ "devas": {}
61
+ },
62
+ "vector": {
48
63
  "concerns": [],
49
64
  "global": [],
50
65
  "devas": {}
package/tests/index.js CHANGED
@@ -146,9 +146,7 @@ const DevaTest = new Deva({
146
146
  this.context('ready', data.id.uid);
147
147
  const test = this.methods.test(data);
148
148
  this.prompt(test.text);
149
- setTimeout(() => {
150
- return resolve(data);
151
- }, 10000);
149
+ return resolve(data);
152
150
  },
153
151
  onFinish(data, resolve) {
154
152
  this.context('finish', data.id.uid);