@indra.ai/deva 1.5.55 → 1.5.56

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
@@ -278,7 +278,7 @@ class Deva {
278
278
  const _fe = `_${feature}`;
279
279
  const {id, profile, features} = _cl; // make a copy the clinet data.
280
280
  const data = features[feature]; // make a copy the clinet data.
281
- this.state('set', `feature:${id}`);
281
+ this.state('set', `${feature}:${_id.uid}`);
282
282
  this[_fe] = { // set this feature with data
283
283
  id: _id, // uid of the feature
284
284
  client_id: id, // client id for reference
@@ -342,6 +342,17 @@ class Deva {
342
342
  return this.Feature('king', resolve, reject);
343
343
  }
344
344
 
345
+ /**************
346
+ func: Owner
347
+ params: resolve, reject
348
+ describe:
349
+ The Owner feature sets the correct variables and necessary rules for the
350
+ client presented data.
351
+ ***************/
352
+ Owner(resolve, reject) {
353
+ return this.Feature('owner', resolve, reject);
354
+ }
355
+
345
356
  /**************
346
357
  func: Treasury
347
358
  params: resolve, reject
@@ -685,14 +696,14 @@ class Deva {
685
696
  const client = this.client();
686
697
  // check if method exists and is of type function
687
698
  const {method,params} = packet.q.meta;
688
- this.action('answer', `${method}:${id}`);
699
+ this.action('answer', `${method}:${id.uid}`);
689
700
 
690
- this.state('try', `answer:${method}:${id}`);
701
+ this.state('try', `answer:${method}:${id.uid}`);
691
702
  try {
692
703
  const isMethod = this.methods[method] && typeof this.methods[method] == 'function';
693
704
  if (!isMethod) return resolve(this._methodNotFound(packet)); // resolve method not found if check if check fails
694
705
 
695
- this.action('method', `answer:${method}:${id}`);
706
+ this.action('method', `answer:${method}:${id.uid}`);
696
707
  this.methods[method](packet).then(result => {
697
708
  // check the result for the text, html, and data object. // this is for when answers are returned from nested Devas.
698
709
  const text = typeof result === 'object' ? result.text : result;
@@ -700,7 +711,7 @@ class Deva {
700
711
  // if the data passed is NOT an object it will FALSE
701
712
  const data = typeof result === 'object' ? result.data : false;
702
713
 
703
- this.state('set', `answer:${method}:packet_answer:${id}`);
714
+ this.state('set', `answer:${method}:packet_answer:${id.uid}`);
704
715
  const packet_answer = { // setup the packet.a container
705
716
  id,
706
717
  agent, // set the agent who answered the question
@@ -723,14 +734,14 @@ class Deva {
723
734
  packet.a = packet_answer; // set the packet.a to the packet_answer
724
735
  this.talk(config.events.answer, this.lib.copy(packet)); // global talk event
725
736
 
726
- this.state('return', `answer:${method}:${id}`); // set the state resolve answer
737
+ this.state('return', `answer:${method}:${id.uid}`); // set the state resolve answer
727
738
  return this.finish(packet, resolve); // resolve the packet to the caller.
728
739
  }).catch(err => { // catch any errors in the method
729
- this.state('catch', `answer:${method}:${id}`); // set the state reject answer
740
+ this.state('catch', `answer:${method}:${id.uid}`); // set the state reject answer
730
741
  return this.error(err, packet, reject); // return this.error with err, packet, reject
731
742
  });
732
743
  } catch (e) {
733
- this.state('catch', `answer:${method}:${id}`);
744
+ this.state('catch', `answer:${method}:${id.uid}`);
734
745
  return this.error(e, packet, reject);
735
746
  }
736
747
  }
@@ -868,6 +879,8 @@ class Deva {
868
879
  return this.God(resolve, reject);
869
880
  }).then(() => {
870
881
  return this.King(resolve, reject);
882
+ }).then(() => {
883
+ return this.Owner(resolve, reject);
871
884
  }).then(() => {
872
885
  return this.Treasury(resolve, reject);
873
886
  }).then(() => {
@@ -1252,7 +1265,7 @@ class Deva {
1252
1265
  data.sha256 = this.lib.hash(data, 'sha256');
1253
1266
  data.sha512 = this.lib.hash(data, 'sha512');
1254
1267
 
1255
- this.state('return', `states:${id}`);
1268
+ this.state('return', `states:${id.uid}`);
1256
1269
  return data;
1257
1270
  }
1258
1271
 
@@ -1288,7 +1301,7 @@ class Deva {
1288
1301
  this.talk(config.events.zone, data);
1289
1302
  return data;
1290
1303
  } catch (e) {
1291
- this.state('catch', `zone:${value}:${id}`);
1304
+ this.state('catch', `zone:${value}:${id.uid}`);
1292
1305
  return this.error(e, value);
1293
1306
  }
1294
1307
  }
@@ -1300,8 +1313,8 @@ class Deva {
1300
1313
  ***************/
1301
1314
  zones() {
1302
1315
  const id = this.lib.uid();
1303
- this.action('zones', id);
1304
- this.state('return', `zones:${id}`);
1316
+ this.action('zones', id.uid);
1317
+ this.state('return', `zones:${id.uid}`);
1305
1318
 
1306
1319
  const data = {
1307
1320
  id, // set the uuid of the data
@@ -1355,7 +1368,7 @@ class Deva {
1355
1368
  this.talk(config.events.action, data); // talk the core action event
1356
1369
  return data;
1357
1370
  } catch (e) { // catch any errors that occur
1358
- this.state('catch', `action:${value}:${id}`);
1371
+ this.state('catch', `action:${value}:${id.uid}`);
1359
1372
  return this.error(e); // return error on error catch
1360
1373
  }
1361
1374
  }
@@ -1367,7 +1380,7 @@ class Deva {
1367
1380
  ***************/
1368
1381
  actions() {
1369
1382
  const id = this.lib.uid();
1370
- this.action('actions', id);
1383
+ this.action('actions', id.uid);
1371
1384
  const data = {
1372
1385
  id, // set the id with a uuid
1373
1386
  agent: this.agent(), // set the agent value
@@ -1381,7 +1394,7 @@ class Deva {
1381
1394
  data.sha256 = this.lib.hash(data, 'sha256');
1382
1395
  data.sha512 = this.lib.hash(data, 'sha512');
1383
1396
 
1384
- this.state('return', `actions:${id}`);
1397
+ this.state('return', `actions:${id.uid}`);
1385
1398
  return data;
1386
1399
  }
1387
1400
 
@@ -1416,7 +1429,7 @@ class Deva {
1416
1429
  this.talk(config.events.feature, data); // talk the feature event with data
1417
1430
  return data;
1418
1431
  } catch (e) { // catch any errors
1419
- this.state('catch', `feature:${value}:${id}`);
1432
+ this.state('catch', `feature:${value}:${id.uid}`);
1420
1433
  return this.error(e); // retun this.error when an error is caught.
1421
1434
  }
1422
1435
  }
@@ -1429,7 +1442,7 @@ class Deva {
1429
1442
  features() {
1430
1443
  if (!this._active) return this._messages.offline; // check the active status
1431
1444
  const id = this.lib.uid();
1432
- this.action('features', id);
1445
+ this.action('features', id.uid);
1433
1446
  const data = {
1434
1447
  id, // set the object id
1435
1448
  agent: this.agent(), // set the agent value.
@@ -1443,7 +1456,7 @@ class Deva {
1443
1456
  data.sha256 = this.lib.hash(data, 'sha256');
1444
1457
  data.sha512 = this.lib.hash(data, 'sha512');
1445
1458
 
1446
- this.state('return', `features:${id}`);
1459
+ this.state('return', `features:${id.uid}`);
1447
1460
  return data;
1448
1461
  }
1449
1462
 
@@ -1480,7 +1493,7 @@ class Deva {
1480
1493
  this.talk(config.events.context, data);
1481
1494
  return data;
1482
1495
  } catch (e) {
1483
- this.state('catch', `context:${value}:${id.guid}`);
1496
+ this.state('catch', `context:${value}:${id.uid}`);
1484
1497
  return this.error(e, value);
1485
1498
  }
1486
1499
  }
@@ -1503,7 +1516,7 @@ class Deva {
1503
1516
  data.sha256 = this.lib.hash(data, 'sha256');
1504
1517
  data.sha512 = this.lib.hash(data, 'sha512');
1505
1518
 
1506
- this.state('return', `contexts:${id}`);
1519
+ this.state('return', `contexts:${id.uid}`);
1507
1520
  return data;
1508
1521
  }
1509
1522
 
@@ -1544,15 +1557,25 @@ class Deva {
1544
1557
 
1545
1558
  // FEATURE FUNCTIONS
1546
1559
  /**************
1560
+ func: vector
1561
+ params: none
1562
+ describe: basic vector features available in a Deva.
1563
+ usage: this.vector()
1564
+ ***************/
1565
+ vector() {
1566
+ return this._getFeature('vector', this._vector);
1567
+ }
1568
+
1569
+ /**************
1547
1570
  func: veda
1548
1571
  params: none
1549
1572
  describe: basic veda features available in a Deva.
1550
1573
  usage: this.veda()
1551
1574
  ***************/
1552
1575
  veda() {
1553
- return this._getFeature('veda', this._vector);
1576
+ return this._getFeature('veda', this._veda);
1554
1577
  }
1555
-
1578
+
1556
1579
  /**************
1557
1580
  func: god
1558
1581
  params: none
@@ -1560,9 +1583,9 @@ class Deva {
1560
1583
  usage: this.god()
1561
1584
  ***************/
1562
1585
  god() {
1563
- return this._getFeature('god', this._vector);
1586
+ return this._getFeature('god', this._god);
1564
1587
  }
1565
-
1588
+
1566
1589
  /**************
1567
1590
  func: king
1568
1591
  params: none
@@ -1570,17 +1593,17 @@ class Deva {
1570
1593
  usage: this.king()
1571
1594
  ***************/
1572
1595
  king() {
1573
- return this._getFeature('king', this._vector);
1596
+ return this._getFeature('king', this._king);
1574
1597
  }
1575
1598
 
1576
1599
  /**************
1577
- func: vector
1600
+ func: owner
1578
1601
  params: none
1579
- describe: basic vector features available in a Deva.
1580
- usage: this.vector()
1602
+ describe: basic owner features available in a Deva.
1603
+ usage: this.owner()
1581
1604
  ***************/
1582
- vector() {
1583
- return this._getFeature('vector', this._vector);
1605
+ owner() {
1606
+ return this._getFeature('owner', this._king);
1584
1607
  }
1585
1608
 
1586
1609
  /**************
@@ -1646,7 +1669,7 @@ class Deva {
1646
1669
  /**************
1647
1670
  func: proxy
1648
1671
  params: none
1649
- describe: basic proxy features available in a Deva.
1672
+ describe: basic proxy features availcoable in a Deva.
1650
1673
  usage: this.proxy()
1651
1674
  ***************/
1652
1675
  proxy() {
@@ -1857,7 +1880,7 @@ class Deva {
1857
1880
  // format the date since active for output.
1858
1881
  const dateFormat = this.lib.formatDate(this._active, 'long', true);
1859
1882
  // create the text msg string
1860
- this.state('return', `status:${id}`);
1883
+ this.state('return', `status:${id.uid}`);
1861
1884
  return `${this._agent.profile.name} active since ${dateFormat}`; // return final text string
1862
1885
  }
1863
1886
 
@@ -1878,10 +1901,10 @@ class Deva {
1878
1901
  this.zone('help', id);
1879
1902
  if (!this._active) return resolve(this._messages.offline);
1880
1903
 
1881
- this.feature('help', id);
1882
- this.action('help', id);
1883
- this.state('help', id);
1884
- this.context('help', id);
1904
+ this.feature('help', id.uid);
1905
+ this.action('help', id.uid);
1906
+ this.state('help', id.uid);
1907
+ this.context('help', id.uid);
1885
1908
  const params = msg.split(' '); // split the msg into an array by spaces.
1886
1909
 
1887
1910
  const splitText = params[0].split(':');
@@ -1891,12 +1914,12 @@ class Deva {
1891
1914
  const helpPath = this.lib.path.join(help_dir, 'help', `${helpFile}.feecting`);
1892
1915
 
1893
1916
  try {
1894
- this.state('try', `help:${id}`);
1917
+ this.state('try', `help:${id.uid}`);
1895
1918
 
1896
1919
  // check if help file exists first and resolve if no file
1897
1920
  const helpExists = this.lib.fs.existsSync(helpPath); // check if help file exists
1898
1921
  if (!helpExists) {
1899
- this.state('return', `${this._messages.help_not_found}:${id}`);
1922
+ this.state('return', `${this._messages.help_not_found}:${id.uid}`);
1900
1923
  return resolve(this._messages.help_not_found);
1901
1924
  }
1902
1925
 
@@ -1904,7 +1927,7 @@ class Deva {
1904
1927
  const helpFile = this.lib.fs.readFileSync(helpPath, 'utf8');
1905
1928
  const helpPart = helpFile.split(`::BEGIN:${part}`);
1906
1929
  if (!helpPart[1]) {
1907
- this.state('return', `${this._messages.help_not_found}:${id}`);
1930
+ this.state('return', `${this._messages.help_not_found}:${id.uid}`);
1908
1931
  resolve(this._messages.help_not_found);
1909
1932
  }
1910
1933
 
@@ -1912,11 +1935,11 @@ class Deva {
1912
1935
  helpDoc = helpFile.split(`::BEGIN:${part}`)[1].split(`::END:${part}`)[0];
1913
1936
  }
1914
1937
  catch(e) {
1915
- this.state('catch', `help:${id}`);
1938
+ this.state('catch', `help:${id.uid}`);
1916
1939
  return this.error(e, msg, reject);
1917
1940
  }
1918
1941
  finally {
1919
- this.state('return', `help:${id}`);
1942
+ this.state('return', `help:${id.uid}`);
1920
1943
  return resolve(helpDoc);
1921
1944
  }
1922
1945
  });
@@ -1934,11 +1957,11 @@ class Deva {
1934
1957
  ***************/
1935
1958
  error(err,packet,reject=false) {
1936
1959
  const id = this.lib.uid();
1937
- this.zone('error', id);
1960
+ this.zone('error', id.uid);
1938
1961
  const agent = this.agent();
1939
1962
  const client = this.client();
1940
1963
 
1941
- this.action('error', id);
1964
+ this.action('error', id.uid);
1942
1965
  const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
1943
1966
 
1944
1967
  const data = {
@@ -1961,9 +1984,9 @@ class Deva {
1961
1984
 
1962
1985
  this.talk(config.events.error, this.lib.copy(data));
1963
1986
 
1964
- this.state('return', `error:${id}`);
1965
- this.state('error', id);
1966
- this.context('error', id);
1987
+ this.state('return', `error:${id.uid}`);
1988
+ this.state('error', id.uid);
1989
+ this.context('error', id.uid);
1967
1990
  if (hasOnError) return this.onError(err, packet, reject);
1968
1991
  else return reject ? reject(err) : Promise.reject(err);
1969
1992
  }
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.56",
5
5
  "description": "The Deva Core",
6
6
  "main": "index.js",
7
7
  "copyright": "(c)2025 Quinn Michaels; All rights reserved.",
@@ -115,6 +115,7 @@
115
115
  "god": "💫 God",
116
116
  "veda": "🕉️ Veda",
117
117
  "king": "👑️ King",
118
+ "owner": "🐲️ Owner",
118
119
  "treasury": "🏦️ Treasury",
119
120
  "security": "🚨 Security",
120
121
  "guard": "💂 Guard",
@@ -218,20 +219,21 @@
218
219
  "god": "💫 God",
219
220
  "veda": "🕉️ Veda",
220
221
  "king": "👑️ King",
222
+ "owner": "🐲️ Owner",
223
+ "treasury": "🏦 Treasury",
221
224
  "security": "🚨 Security",
222
225
  "guard": "💂 Guard",
223
- "shield": "🛡️ Shield",
226
+ "defense": "🪖 Defense",
224
227
  "wall": "🧱 Wall",
228
+ "shield": "🛡️ Shield",
225
229
  "proxy": "👾️ Proxy",
226
- "defense": "🪖 Defense",
230
+ "legal": "🏛️ Legal",
231
+ "authority": "🚔 Authority",
232
+ "justice": "⚖️ Justice",
227
233
  "support": "💼 Support",
228
234
  "services": "🛠️ Services",
229
235
  "systems": "🖥️ Systems",
230
236
  "networks": "📡 Networks",
231
- "legal": "🏛️ Legal",
232
- "justice": "⚖️ Justice",
233
- "authority": "🚔 Authority",
234
- "treasury": "🏦 Treasury",
235
237
  "talk": "📢 Talk",
236
238
  "listen": "👂 Listen",
237
239
  "once": "👂 Once",
@@ -272,6 +274,7 @@
272
274
  "god": "💫 God",
273
275
  "veda": "🕉️ Veda",
274
276
  "king": "👑️ King",
277
+ "owner": "🐲️ Owner",
275
278
  "treasury": "🏦 Treasury",
276
279
  "security": "🚨 Security",
277
280
  "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
@@ -54,6 +54,11 @@
54
54
  "global": [],
55
55
  "devas": {}
56
56
  },
57
+ "owner": {
58
+ "concerns": [],
59
+ "global": [],
60
+ "devas": {}
61
+ },
57
62
  "treasury": {
58
63
  "concerns": [],
59
64
  "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) {