@indra.ai/deva 1.5.60 → 1.5.63
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 +112 -69
- package/package.json +15 -9
- package/tests/client.json +17 -2
- package/tests/index.js +1 -3
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
|
|
|
@@ -302,6 +304,17 @@ class Deva {
|
|
|
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:
|
|
330
|
+
func: Error
|
|
318
331
|
params: resolve, reject
|
|
319
332
|
describe:
|
|
320
|
-
The
|
|
333
|
+
The Error feature sets the correct variables and necessary rules for the
|
|
321
334
|
client presented data.
|
|
322
335
|
***************/
|
|
323
|
-
|
|
324
|
-
return this.Feature('
|
|
336
|
+
Error(resolve, reject) {
|
|
337
|
+
return this.Feature('error', resolve, reject);
|
|
325
338
|
}
|
|
326
339
|
|
|
327
340
|
/**************
|
|
328
|
-
func:
|
|
341
|
+
func: Log
|
|
329
342
|
params: resolve, reject
|
|
330
343
|
describe:
|
|
331
|
-
The
|
|
344
|
+
The Log feature sets the correct variables and necessary rules for the
|
|
332
345
|
client presented data.
|
|
333
346
|
***************/
|
|
334
|
-
|
|
335
|
-
return this.Feature('
|
|
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
|
/**************
|
|
@@ -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.
|
|
929
|
+
return this.Error(resolve, reject);
|
|
893
930
|
}).then(() => {
|
|
894
|
-
return this.
|
|
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(() => {
|
|
@@ -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,54 @@ class Deva {
|
|
|
1584
1635
|
return this._getFeature('data', this._data);
|
|
1585
1636
|
}
|
|
1586
1637
|
|
|
1638
|
+
/**************
|
|
1639
|
+
func: error
|
|
1640
|
+
params:
|
|
1641
|
+
- err: The error to process
|
|
1642
|
+
- data: Any additional data associated with the error
|
|
1643
|
+
- reject: An associated promise reject if the caller requires.
|
|
1644
|
+
describe:
|
|
1645
|
+
The error function provides the consistent error manage of the system.
|
|
1646
|
+
usage: this.error(err, data, reject);
|
|
1647
|
+
***************/
|
|
1648
|
+
error(err,packet,reject=false) {
|
|
1649
|
+
const id = this.lib.uid();
|
|
1650
|
+
this.zone('error', id.uid);
|
|
1651
|
+
this.feature('error', id.uid);
|
|
1652
|
+
|
|
1653
|
+
const agent = this.agent();
|
|
1654
|
+
const client = this.client();
|
|
1655
|
+
|
|
1656
|
+
this.action('error', id.uid);
|
|
1657
|
+
const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
|
|
1658
|
+
|
|
1659
|
+
const data = {
|
|
1660
|
+
id,
|
|
1661
|
+
key: 'error',
|
|
1662
|
+
value: agent.key,
|
|
1663
|
+
agent,
|
|
1664
|
+
client,
|
|
1665
|
+
error: {
|
|
1666
|
+
name: err.name,
|
|
1667
|
+
message: err.message,
|
|
1668
|
+
stack: err.stack,
|
|
1669
|
+
},
|
|
1670
|
+
packet,
|
|
1671
|
+
created: Date.now(),
|
|
1672
|
+
}
|
|
1673
|
+
data.md5 = this.lib.hash(data);
|
|
1674
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1675
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1676
|
+
|
|
1677
|
+
this.talk(config.events.error, this.lib.copy(data));
|
|
1678
|
+
|
|
1679
|
+
this.state('return', `error:${id.uid}`);
|
|
1680
|
+
this.state('error', id.uid);
|
|
1681
|
+
this.context('error', id.uid);
|
|
1682
|
+
if (hasOnError) return this.onError(err, packet, reject);
|
|
1683
|
+
else return reject ? reject(err) : Promise.reject(err);
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1587
1686
|
/**************
|
|
1588
1687
|
func: vector
|
|
1589
1688
|
params: none
|
|
@@ -1594,15 +1693,6 @@ class Deva {
|
|
|
1594
1693
|
return this._getFeature('vector', this._vector);
|
|
1595
1694
|
}
|
|
1596
1695
|
|
|
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
1696
|
|
|
1607
1697
|
/**************
|
|
1608
1698
|
func: god
|
|
@@ -1972,52 +2062,5 @@ class Deva {
|
|
|
1972
2062
|
}
|
|
1973
2063
|
});
|
|
1974
2064
|
}
|
|
1975
|
-
|
|
1976
|
-
/**************
|
|
1977
|
-
func: error
|
|
1978
|
-
params:
|
|
1979
|
-
- err: The error to process
|
|
1980
|
-
- data: Any additional data associated with the error
|
|
1981
|
-
- reject: An associated promise reject if the caller requires.
|
|
1982
|
-
describe:
|
|
1983
|
-
The error function provides the consistent error manage of the system.
|
|
1984
|
-
usage: this.error(err, data, reject);
|
|
1985
|
-
***************/
|
|
1986
|
-
error(err,packet,reject=false) {
|
|
1987
|
-
const id = this.lib.uid();
|
|
1988
|
-
this.zone('error', id.uid);
|
|
1989
|
-
const agent = this.agent();
|
|
1990
|
-
const client = this.client();
|
|
1991
|
-
|
|
1992
|
-
this.action('error', id.uid);
|
|
1993
|
-
const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
|
|
1994
|
-
|
|
1995
|
-
const data = {
|
|
1996
|
-
id,
|
|
1997
|
-
key: 'error',
|
|
1998
|
-
value: agent.key,
|
|
1999
|
-
agent,
|
|
2000
|
-
client,
|
|
2001
|
-
error: {
|
|
2002
|
-
name: err.name,
|
|
2003
|
-
message: err.message,
|
|
2004
|
-
stack: err.stack,
|
|
2005
|
-
},
|
|
2006
|
-
packet,
|
|
2007
|
-
created: Date.now(),
|
|
2008
|
-
}
|
|
2009
|
-
data.md5 = this.lib.hash(data);
|
|
2010
|
-
data.sha256 = this.lib.hash(data, 'sha256');
|
|
2011
|
-
data.sha512 = this.lib.hash(data, 'sha512');
|
|
2012
|
-
|
|
2013
|
-
this.talk(config.events.error, this.lib.copy(data));
|
|
2014
|
-
|
|
2015
|
-
this.state('return', `error:${id.uid}`);
|
|
2016
|
-
this.state('error', id.uid);
|
|
2017
|
-
this.context('error', id.uid);
|
|
2018
|
-
if (hasOnError) return this.onError(err, packet, reject);
|
|
2019
|
-
else return reject ? reject(err) : Promise.reject(err);
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
2065
|
}
|
|
2023
2066
|
export default Deva;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "9f0bc743-d720-4320-832e-cf5edc3b7cf",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.63",
|
|
5
5
|
"description": "The Deva Core",
|
|
6
6
|
"main": "index.js",
|
|
7
|
-
"copyright": "(c)2025 Quinn Michaels; All rights reserved.",
|
|
7
|
+
"copyright": "(c)2025 Quinn A Michaels; All rights reserved.",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "node tests"
|
|
@@ -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
|
-
"
|
|
47
|
+
"error": {
|
|
43
48
|
"concerns": [],
|
|
44
49
|
"global": [],
|
|
45
50
|
"devas": {}
|
|
46
51
|
},
|
|
47
|
-
"
|
|
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
|
-
|
|
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);
|