@indra.ai/deva 1.5.55 → 1.5.57

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
@@ -17,6 +17,7 @@ class Deva {
17
17
  this._agent = opts.agent || false; // Agent profile object
18
18
  this._client = {}; // this will be set on init.
19
19
  this._active = false; // the active/birth date.
20
+ this._data = false; // inherited Vector features.
20
21
  this._vector = false; // inherited Vector features.
21
22
  this._veda = false; // inherited Veda features.
22
23
  this._god = false; // inherited God features.
@@ -278,7 +279,7 @@ class Deva {
278
279
  const _fe = `_${feature}`;
279
280
  const {id, profile, features} = _cl; // make a copy the clinet data.
280
281
  const data = features[feature]; // make a copy the clinet data.
281
- this.state('set', `feature:${id}`);
282
+ this.state('set', `${feature}:${_id.uid}`);
282
283
  this[_fe] = { // set this feature with data
283
284
  id: _id, // uid of the feature
284
285
  client_id: id, // client id for reference
@@ -298,6 +299,17 @@ class Deva {
298
299
  }
299
300
  }
300
301
 
302
+ /**************
303
+ func: Data
304
+ params: resolve, reject
305
+ describe:
306
+ The Data feature sets the correct variables and necessary rules for the
307
+ client presented data.
308
+ ***************/
309
+ Data(resolve, reject) {
310
+ return this.Feature('data', resolve, reject);
311
+ }
312
+
301
313
  /**************
302
314
  func: Vector
303
315
  params: resolve, reject
@@ -342,6 +354,17 @@ class Deva {
342
354
  return this.Feature('king', resolve, reject);
343
355
  }
344
356
 
357
+ /**************
358
+ func: Owner
359
+ params: resolve, reject
360
+ describe:
361
+ The Owner feature sets the correct variables and necessary rules for the
362
+ client presented data.
363
+ ***************/
364
+ Owner(resolve, reject) {
365
+ return this.Feature('owner', resolve, reject);
366
+ }
367
+
345
368
  /**************
346
369
  func: Treasury
347
370
  params: resolve, reject
@@ -685,14 +708,14 @@ class Deva {
685
708
  const client = this.client();
686
709
  // check if method exists and is of type function
687
710
  const {method,params} = packet.q.meta;
688
- this.action('answer', `${method}:${id}`);
711
+ this.action('answer', `${method}:${id.uid}`);
689
712
 
690
- this.state('try', `answer:${method}:${id}`);
713
+ this.state('try', `answer:${method}:${id.uid}`);
691
714
  try {
692
715
  const isMethod = this.methods[method] && typeof this.methods[method] == 'function';
693
716
  if (!isMethod) return resolve(this._methodNotFound(packet)); // resolve method not found if check if check fails
694
717
 
695
- this.action('method', `answer:${method}:${id}`);
718
+ this.action('method', `answer:${method}:${id.uid}`);
696
719
  this.methods[method](packet).then(result => {
697
720
  // check the result for the text, html, and data object. // this is for when answers are returned from nested Devas.
698
721
  const text = typeof result === 'object' ? result.text : result;
@@ -700,7 +723,7 @@ class Deva {
700
723
  // if the data passed is NOT an object it will FALSE
701
724
  const data = typeof result === 'object' ? result.data : false;
702
725
 
703
- this.state('set', `answer:${method}:packet_answer:${id}`);
726
+ this.state('set', `answer:${method}:packet_answer:${id.uid}`);
704
727
  const packet_answer = { // setup the packet.a container
705
728
  id,
706
729
  agent, // set the agent who answered the question
@@ -723,14 +746,14 @@ class Deva {
723
746
  packet.a = packet_answer; // set the packet.a to the packet_answer
724
747
  this.talk(config.events.answer, this.lib.copy(packet)); // global talk event
725
748
 
726
- this.state('return', `answer:${method}:${id}`); // set the state resolve answer
749
+ this.state('return', `answer:${method}:${id.uid}`); // set the state resolve answer
727
750
  return this.finish(packet, resolve); // resolve the packet to the caller.
728
751
  }).catch(err => { // catch any errors in the method
729
- this.state('catch', `answer:${method}:${id}`); // set the state reject answer
752
+ this.state('catch', `answer:${method}:${id.uid}`); // set the state reject answer
730
753
  return this.error(err, packet, reject); // return this.error with err, packet, reject
731
754
  });
732
755
  } catch (e) {
733
- this.state('catch', `answer:${method}:${id}`);
756
+ this.state('catch', `answer:${method}:${id.uid}`);
734
757
  return this.error(e, packet, reject);
735
758
  }
736
759
  }
@@ -860,6 +883,8 @@ class Deva {
860
883
  this.action('init');
861
884
  this.state('init');
862
885
  return this.Client(client, resolve, reject);
886
+ }).then(() => {
887
+ return this.Data(resolve, reject);
863
888
  }).then(() => {
864
889
  return this.Vector(resolve, reject);
865
890
  }).then(() => {
@@ -868,6 +893,8 @@ class Deva {
868
893
  return this.God(resolve, reject);
869
894
  }).then(() => {
870
895
  return this.King(resolve, reject);
896
+ }).then(() => {
897
+ return this.Owner(resolve, reject);
871
898
  }).then(() => {
872
899
  return this.Treasury(resolve, reject);
873
900
  }).then(() => {
@@ -1180,6 +1207,7 @@ class Deva {
1180
1207
  this._active = false;
1181
1208
  this._client = false;
1182
1209
  this._vector = false;
1210
+ this._data = false;
1183
1211
  this._treasury = false;
1184
1212
  this._security = false;
1185
1213
  this._guard = false;
@@ -1252,7 +1280,7 @@ class Deva {
1252
1280
  data.sha256 = this.lib.hash(data, 'sha256');
1253
1281
  data.sha512 = this.lib.hash(data, 'sha512');
1254
1282
 
1255
- this.state('return', `states:${id}`);
1283
+ this.state('return', `states:${id.uid}`);
1256
1284
  return data;
1257
1285
  }
1258
1286
 
@@ -1288,7 +1316,7 @@ class Deva {
1288
1316
  this.talk(config.events.zone, data);
1289
1317
  return data;
1290
1318
  } catch (e) {
1291
- this.state('catch', `zone:${value}:${id}`);
1319
+ this.state('catch', `zone:${value}:${id.uid}`);
1292
1320
  return this.error(e, value);
1293
1321
  }
1294
1322
  }
@@ -1300,8 +1328,8 @@ class Deva {
1300
1328
  ***************/
1301
1329
  zones() {
1302
1330
  const id = this.lib.uid();
1303
- this.action('zones', id);
1304
- this.state('return', `zones:${id}`);
1331
+ this.action('zones', id.uid);
1332
+ this.state('return', `zones:${id.uid}`);
1305
1333
 
1306
1334
  const data = {
1307
1335
  id, // set the uuid of the data
@@ -1355,7 +1383,7 @@ class Deva {
1355
1383
  this.talk(config.events.action, data); // talk the core action event
1356
1384
  return data;
1357
1385
  } catch (e) { // catch any errors that occur
1358
- this.state('catch', `action:${value}:${id}`);
1386
+ this.state('catch', `action:${value}:${id.uid}`);
1359
1387
  return this.error(e); // return error on error catch
1360
1388
  }
1361
1389
  }
@@ -1367,7 +1395,7 @@ class Deva {
1367
1395
  ***************/
1368
1396
  actions() {
1369
1397
  const id = this.lib.uid();
1370
- this.action('actions', id);
1398
+ this.action('actions', id.uid);
1371
1399
  const data = {
1372
1400
  id, // set the id with a uuid
1373
1401
  agent: this.agent(), // set the agent value
@@ -1381,7 +1409,7 @@ class Deva {
1381
1409
  data.sha256 = this.lib.hash(data, 'sha256');
1382
1410
  data.sha512 = this.lib.hash(data, 'sha512');
1383
1411
 
1384
- this.state('return', `actions:${id}`);
1412
+ this.state('return', `actions:${id.uid}`);
1385
1413
  return data;
1386
1414
  }
1387
1415
 
@@ -1416,7 +1444,7 @@ class Deva {
1416
1444
  this.talk(config.events.feature, data); // talk the feature event with data
1417
1445
  return data;
1418
1446
  } catch (e) { // catch any errors
1419
- this.state('catch', `feature:${value}:${id}`);
1447
+ this.state('catch', `feature:${value}:${id.uid}`);
1420
1448
  return this.error(e); // retun this.error when an error is caught.
1421
1449
  }
1422
1450
  }
@@ -1429,7 +1457,7 @@ class Deva {
1429
1457
  features() {
1430
1458
  if (!this._active) return this._messages.offline; // check the active status
1431
1459
  const id = this.lib.uid();
1432
- this.action('features', id);
1460
+ this.action('features', id.uid);
1433
1461
  const data = {
1434
1462
  id, // set the object id
1435
1463
  agent: this.agent(), // set the agent value.
@@ -1443,7 +1471,7 @@ class Deva {
1443
1471
  data.sha256 = this.lib.hash(data, 'sha256');
1444
1472
  data.sha512 = this.lib.hash(data, 'sha512');
1445
1473
 
1446
- this.state('return', `features:${id}`);
1474
+ this.state('return', `features:${id.uid}`);
1447
1475
  return data;
1448
1476
  }
1449
1477
 
@@ -1480,7 +1508,7 @@ class Deva {
1480
1508
  this.talk(config.events.context, data);
1481
1509
  return data;
1482
1510
  } catch (e) {
1483
- this.state('catch', `context:${value}:${id.guid}`);
1511
+ this.state('catch', `context:${value}:${id.uid}`);
1484
1512
  return this.error(e, value);
1485
1513
  }
1486
1514
  }
@@ -1503,7 +1531,7 @@ class Deva {
1503
1531
  data.sha256 = this.lib.hash(data, 'sha256');
1504
1532
  data.sha512 = this.lib.hash(data, 'sha512');
1505
1533
 
1506
- this.state('return', `contexts:${id}`);
1534
+ this.state('return', `contexts:${id.uid}`);
1507
1535
  return data;
1508
1536
  }
1509
1537
 
@@ -1544,15 +1572,35 @@ class Deva {
1544
1572
 
1545
1573
  // FEATURE FUNCTIONS
1546
1574
  /**************
1575
+ func: data
1576
+ params: none
1577
+ describe: basic data features available in a Deva.
1578
+ usage: this.data()
1579
+ ***************/
1580
+ data() {
1581
+ return this._getFeature('data', this._data);
1582
+ }
1583
+
1584
+ /**************
1585
+ func: vector
1586
+ params: none
1587
+ describe: basic vector features available in a Deva.
1588
+ usage: this.vector()
1589
+ ***************/
1590
+ vector() {
1591
+ return this._getFeature('vector', this._vector);
1592
+ }
1593
+
1594
+ /**************
1547
1595
  func: veda
1548
1596
  params: none
1549
1597
  describe: basic veda features available in a Deva.
1550
1598
  usage: this.veda()
1551
1599
  ***************/
1552
1600
  veda() {
1553
- return this._getFeature('veda', this._vector);
1601
+ return this._getFeature('veda', this._veda);
1554
1602
  }
1555
-
1603
+
1556
1604
  /**************
1557
1605
  func: god
1558
1606
  params: none
@@ -1560,9 +1608,9 @@ class Deva {
1560
1608
  usage: this.god()
1561
1609
  ***************/
1562
1610
  god() {
1563
- return this._getFeature('god', this._vector);
1611
+ return this._getFeature('god', this._god);
1564
1612
  }
1565
-
1613
+
1566
1614
  /**************
1567
1615
  func: king
1568
1616
  params: none
@@ -1570,17 +1618,17 @@ class Deva {
1570
1618
  usage: this.king()
1571
1619
  ***************/
1572
1620
  king() {
1573
- return this._getFeature('king', this._vector);
1621
+ return this._getFeature('king', this._king);
1574
1622
  }
1575
1623
 
1576
1624
  /**************
1577
- func: vector
1625
+ func: owner
1578
1626
  params: none
1579
- describe: basic vector features available in a Deva.
1580
- usage: this.vector()
1627
+ describe: basic owner features available in a Deva.
1628
+ usage: this.owner()
1581
1629
  ***************/
1582
- vector() {
1583
- return this._getFeature('vector', this._vector);
1630
+ owner() {
1631
+ return this._getFeature('owner', this._king);
1584
1632
  }
1585
1633
 
1586
1634
  /**************
@@ -1646,7 +1694,7 @@ class Deva {
1646
1694
  /**************
1647
1695
  func: proxy
1648
1696
  params: none
1649
- describe: basic proxy features available in a Deva.
1697
+ describe: basic proxy features availcoable in a Deva.
1650
1698
  usage: this.proxy()
1651
1699
  ***************/
1652
1700
  proxy() {
@@ -1857,7 +1905,7 @@ class Deva {
1857
1905
  // format the date since active for output.
1858
1906
  const dateFormat = this.lib.formatDate(this._active, 'long', true);
1859
1907
  // create the text msg string
1860
- this.state('return', `status:${id}`);
1908
+ this.state('return', `status:${id.uid}`);
1861
1909
  return `${this._agent.profile.name} active since ${dateFormat}`; // return final text string
1862
1910
  }
1863
1911
 
@@ -1878,10 +1926,10 @@ class Deva {
1878
1926
  this.zone('help', id);
1879
1927
  if (!this._active) return resolve(this._messages.offline);
1880
1928
 
1881
- this.feature('help', id);
1882
- this.action('help', id);
1883
- this.state('help', id);
1884
- this.context('help', id);
1929
+ this.feature('help', id.uid);
1930
+ this.action('help', id.uid);
1931
+ this.state('help', id.uid);
1932
+ this.context('help', id.uid);
1885
1933
  const params = msg.split(' '); // split the msg into an array by spaces.
1886
1934
 
1887
1935
  const splitText = params[0].split(':');
@@ -1891,12 +1939,12 @@ class Deva {
1891
1939
  const helpPath = this.lib.path.join(help_dir, 'help', `${helpFile}.feecting`);
1892
1940
 
1893
1941
  try {
1894
- this.state('try', `help:${id}`);
1942
+ this.state('try', `help:${id.uid}`);
1895
1943
 
1896
1944
  // check if help file exists first and resolve if no file
1897
1945
  const helpExists = this.lib.fs.existsSync(helpPath); // check if help file exists
1898
1946
  if (!helpExists) {
1899
- this.state('return', `${this._messages.help_not_found}:${id}`);
1947
+ this.state('return', `${this._messages.help_not_found}:${id.uid}`);
1900
1948
  return resolve(this._messages.help_not_found);
1901
1949
  }
1902
1950
 
@@ -1904,7 +1952,7 @@ class Deva {
1904
1952
  const helpFile = this.lib.fs.readFileSync(helpPath, 'utf8');
1905
1953
  const helpPart = helpFile.split(`::BEGIN:${part}`);
1906
1954
  if (!helpPart[1]) {
1907
- this.state('return', `${this._messages.help_not_found}:${id}`);
1955
+ this.state('return', `${this._messages.help_not_found}:${id.uid}`);
1908
1956
  resolve(this._messages.help_not_found);
1909
1957
  }
1910
1958
 
@@ -1912,11 +1960,11 @@ class Deva {
1912
1960
  helpDoc = helpFile.split(`::BEGIN:${part}`)[1].split(`::END:${part}`)[0];
1913
1961
  }
1914
1962
  catch(e) {
1915
- this.state('catch', `help:${id}`);
1963
+ this.state('catch', `help:${id.uid}`);
1916
1964
  return this.error(e, msg, reject);
1917
1965
  }
1918
1966
  finally {
1919
- this.state('return', `help:${id}`);
1967
+ this.state('return', `help:${id.uid}`);
1920
1968
  return resolve(helpDoc);
1921
1969
  }
1922
1970
  });
@@ -1934,11 +1982,11 @@ class Deva {
1934
1982
  ***************/
1935
1983
  error(err,packet,reject=false) {
1936
1984
  const id = this.lib.uid();
1937
- this.zone('error', id);
1985
+ this.zone('error', id.uid);
1938
1986
  const agent = this.agent();
1939
1987
  const client = this.client();
1940
1988
 
1941
- this.action('error', id);
1989
+ this.action('error', id.uid);
1942
1990
  const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
1943
1991
 
1944
1992
  const data = {
@@ -1961,9 +2009,9 @@ class Deva {
1961
2009
 
1962
2010
  this.talk(config.events.error, this.lib.copy(data));
1963
2011
 
1964
- this.state('return', `error:${id}`);
1965
- this.state('error', id);
1966
- this.context('error', id);
2012
+ this.state('return', `error:${id.uid}`);
2013
+ this.state('error', id.uid);
2014
+ this.context('error', id.uid);
1967
2015
  if (hasOnError) return this.onError(err, packet, reject);
1968
2016
  else return reject ? reject(err) : Promise.reject(err);
1969
2017
  }
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.55",
4
+ "version": "1.5.57",
5
5
  "description": "The Deva Core",
6
6
  "main": "index.js",
7
7
  "copyright": "(c)2025 Quinn Michaels; All rights reserved.",
@@ -111,10 +111,12 @@
111
111
  "deva": "⚡️ Deva",
112
112
  "agent": "🤖 Agent",
113
113
  "client": "👨 Client",
114
- "vector": "🛤️ Vector",
114
+ "data": "💾️ Data",
115
+ "vector": "👽️ Vector",
115
116
  "god": "💫 God",
116
117
  "veda": "🕉️ Veda",
117
118
  "king": "👑️ King",
119
+ "owner": "🐲️ Owner",
118
120
  "treasury": "🏦️ Treasury",
119
121
  "security": "🚨 Security",
120
122
  "guard": "💂 Guard",
@@ -214,24 +216,26 @@
214
216
  "actions": {
215
217
  "client": "👨 Client",
216
218
  "agent": "🕵️‍♂️ Agent",
219
+ "data": "💾 Data",
217
220
  "vector": "👽 Vector",
218
221
  "god": "💫 God",
219
222
  "veda": "🕉️ Veda",
220
223
  "king": "👑️ King",
224
+ "owner": "🐲️ Owner",
225
+ "treasury": "🏦 Treasury",
221
226
  "security": "🚨 Security",
222
227
  "guard": "💂 Guard",
223
- "shield": "🛡️ Shield",
228
+ "defense": "🪖 Defense",
224
229
  "wall": "🧱 Wall",
230
+ "shield": "🛡️ Shield",
225
231
  "proxy": "👾️ Proxy",
226
- "defense": "🪖 Defense",
232
+ "legal": "🏛️ Legal",
233
+ "authority": "🚔 Authority",
234
+ "justice": "⚖️ Justice",
227
235
  "support": "💼 Support",
228
236
  "services": "🛠️ Services",
229
237
  "systems": "🖥️ Systems",
230
238
  "networks": "📡 Networks",
231
- "legal": "🏛️ Legal",
232
- "justice": "⚖️ Justice",
233
- "authority": "🚔 Authority",
234
- "treasury": "🏦 Treasury",
235
239
  "talk": "📢 Talk",
236
240
  "listen": "👂 Listen",
237
241
  "once": "👂 Once",
@@ -268,10 +272,12 @@
268
272
  "init": "🟠 Init",
269
273
  "agent": "🦾 Agent",
270
274
  "client": "💪 Client",
271
- "vector": "🛤️ Vector",
275
+ "data": "💾️ Data",
276
+ "vector": "👽️ Vector",
272
277
  "god": "💫 God",
273
278
  "veda": "🕉️ Veda",
274
279
  "king": "👑️ King",
280
+ "owner": "🐲️ Owner",
275
281
  "treasury": "🏦 Treasury",
276
282
  "security": "🚨 Security",
277
283
  "guard": "💂 Guard",
package/tests/agent.json CHANGED
@@ -4,10 +4,10 @@
4
4
  "copyright": "Copyright (c)2025 Quinn Michaels. All rights reserved.",
5
5
  "DATA": {
6
6
  "id": 5380514963421,
7
- "key": "deva",
7
+ "key": "test",
8
8
  "prompt": {
9
9
  "emoji": "🍏",
10
- "text": "deva",
10
+ "text": "test",
11
11
  "colors": {
12
12
  "label": {
13
13
  "R": 0,
@@ -22,77 +22,15 @@
22
22
  }
23
23
  },
24
24
  "profile": {
25
- "name": "Deva",
26
- "describe": "The Indra interface into deva.world.",
25
+ "name": "Test Deva",
26
+ "describe": "The Test Deva.",
27
27
  "emoji": "/public/devas/deva/emoji.png",
28
28
  "avatar": "/public/devas/deva/avatar.png",
29
29
  "background": "/public/devas/deva/background.png",
30
30
  "gender": "M"
31
31
  },
32
- "features": {
33
- "vector": {
34
- "label": "🛤️VECTOR",
35
- "name": "@VECTOR",
36
- "tag": "#VECTOR",
37
- "loc": "$VECTOR"
38
- },
39
- "security": {
40
- "label": "🚨SECURITY",
41
- "name": "@SECURITY",
42
- "tag": "#SECURITY",
43
- "loc": "$SECURITY"
44
- },
45
- "support": {
46
- "label": "🆘SUPPORT",
47
- "name": "@SUPPORT",
48
- "tag": "#SUPPORT",
49
- "loc": "$SUPPORT"
50
- },
51
- "services": {
52
- "label": "📞SERVICES",
53
- "name": "@SERVICES",
54
- "tag": "#SERVICES",
55
- "loc": "$SERVICES"
56
- },
57
- "systems": {
58
- "label": "🔧SYSTEMS",
59
- "name": "@SYSTEMS",
60
- "tag": "#SYSTEMS",
61
- "loc": "$SYSTEMS"
62
- },
63
- "networks": {
64
- "label": "📡NETWORKS",
65
- "name": "@NETWORKS",
66
- "tag": "#NETWORKS",
67
- "loc": "$NETWORKS"
68
- },
69
- "legal": {
70
- "label": "🏛️LEGAL",
71
- "name": "@LEGAL",
72
- "tag": "#LEGAL",
73
- "loc": "$LEGAL"
74
- },
75
- "justice": {
76
- "label": "⚖️JUSTICE",
77
- "name": "@JUSTICE",
78
- "tag": "#JUSTICE",
79
- "loc": "$JUSTICE"
80
- },
81
- "defense": {
82
- "label": "🪖DEFENSE",
83
- "name": "@DEFENSE",
84
- "tag": "#DEFENSE",
85
- "loc": "$DEFENSE"
86
- },
87
- "defense": {
88
- "label": "💂GUARD",
89
- "name": "@GUARD",
90
- "tag": "#GUARD",
91
- "loc": "$GUARD"
92
- }
93
- },
94
32
  "vars": {
95
- "hello": "Hellow World",
33
+ "hello": "Hello World",
96
34
  "context": {
97
35
  "start": "🏎️ Start",
98
36
  "enter": "🚪️ Enter",
package/tests/client.json CHANGED
@@ -34,6 +34,11 @@
34
34
  "currency": "USD"
35
35
  },
36
36
  "features": {
37
+ "data": {
38
+ "concerns": [],
39
+ "global": [],
40
+ "devas": {}
41
+ },
37
42
  "vector": {
38
43
  "concerns": [],
39
44
  "global": [],
@@ -54,6 +59,11 @@
54
59
  "global": [],
55
60
  "devas": {}
56
61
  },
62
+ "owner": {
63
+ "concerns": [],
64
+ "global": [],
65
+ "devas": {}
66
+ },
57
67
  "treasury": {
58
68
  "concerns": [],
59
69
  "global": [],
package/tests/index.js CHANGED
@@ -91,7 +91,7 @@ const DevaTest = new Deva({
91
91
  console.log(`💥 action: ${packet.text}`);
92
92
  },
93
93
  'devacore:feature'(packet) {
94
- this.context('feature');
94
+ this.context('feature', `${packet.value}:${packet.id.uid}`);
95
95
  console.log(`🍿 feature: ${packet.text}`);
96
96
  },
97
97
  'devacore:context'(packet) {