@indra.ai/deva 1.5.52 โ 1.5.54
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 +72 -15
- package/lib/index.js +12 -10
- package/package.json +48 -27
- package/tests/agent.json +14 -3
- package/tests/client.json +10 -0
- package/tests/index.js +55 -18
package/index.js
CHANGED
|
@@ -18,6 +18,8 @@ class Deva {
|
|
|
18
18
|
this._client = {}; // this will be set on init.
|
|
19
19
|
this._active = false; // the active/birth date.
|
|
20
20
|
this._vector = false; // inherited Vector features.
|
|
21
|
+
this._veda = false; // inherited Veda features.
|
|
22
|
+
this._king = false; // inherited King features.
|
|
21
23
|
this._treasury = false; // inherited Vector features.
|
|
22
24
|
this._security = false; // inherited Security features.
|
|
23
25
|
this._guard = false; // inherited Guard features.
|
|
@@ -297,7 +299,7 @@ class Deva {
|
|
|
297
299
|
|
|
298
300
|
/**************
|
|
299
301
|
func: Vector
|
|
300
|
-
params:
|
|
302
|
+
params: resolve, reject
|
|
301
303
|
describe:
|
|
302
304
|
The Vector feature sets the correct variables and necessary rules for the
|
|
303
305
|
client presented data.
|
|
@@ -306,9 +308,31 @@ class Deva {
|
|
|
306
308
|
return this.Feature('vector', resolve, reject);
|
|
307
309
|
}
|
|
308
310
|
|
|
311
|
+
/**************
|
|
312
|
+
func: Veda
|
|
313
|
+
params: resolve, reject
|
|
314
|
+
describe:
|
|
315
|
+
The Veda feature sets the correct variables and necessary rules for the
|
|
316
|
+
client presented data.
|
|
317
|
+
***************/
|
|
318
|
+
Veda(resolve, reject) {
|
|
319
|
+
return this.Feature('veda', resolve, reject);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**************
|
|
323
|
+
func: King
|
|
324
|
+
params: resolve, reject
|
|
325
|
+
describe:
|
|
326
|
+
The King feature sets the correct variables and necessary rules for the
|
|
327
|
+
client presented data.
|
|
328
|
+
***************/
|
|
329
|
+
King(resolve, reject) {
|
|
330
|
+
return this.Feature('king', resolve, reject);
|
|
331
|
+
}
|
|
332
|
+
|
|
309
333
|
/**************
|
|
310
334
|
func: Treasury
|
|
311
|
-
params:
|
|
335
|
+
params: resolve, reject
|
|
312
336
|
describe:
|
|
313
337
|
The Treasury feature sets the correct variables and necessary rules for the
|
|
314
338
|
client presented data.
|
|
@@ -319,7 +343,7 @@ class Deva {
|
|
|
319
343
|
|
|
320
344
|
/**************
|
|
321
345
|
func: Security
|
|
322
|
-
params:
|
|
346
|
+
params: resolve, reject
|
|
323
347
|
describe:
|
|
324
348
|
The Security feature sets the correct variables and necessary rules for the
|
|
325
349
|
client presented data.
|
|
@@ -330,7 +354,7 @@ class Deva {
|
|
|
330
354
|
|
|
331
355
|
/**************
|
|
332
356
|
func: Guard
|
|
333
|
-
params:
|
|
357
|
+
params: resolve, reject
|
|
334
358
|
describe:
|
|
335
359
|
The Guard feature sets the correct variables and necessary rules for the
|
|
336
360
|
client presented data.
|
|
@@ -341,7 +365,7 @@ class Deva {
|
|
|
341
365
|
|
|
342
366
|
/**************
|
|
343
367
|
func: Defense
|
|
344
|
-
params:
|
|
368
|
+
params: resolve, reject
|
|
345
369
|
describe:
|
|
346
370
|
The Defense feature sets the correct variables and necessary rules for the
|
|
347
371
|
client presented data.
|
|
@@ -352,7 +376,7 @@ class Deva {
|
|
|
352
376
|
|
|
353
377
|
/**************
|
|
354
378
|
func: Wall
|
|
355
|
-
params:
|
|
379
|
+
params: resolve, reject
|
|
356
380
|
describe:
|
|
357
381
|
The Defense feature sets the correct variables and necessary rules for the
|
|
358
382
|
client presented data.
|
|
@@ -363,7 +387,7 @@ class Deva {
|
|
|
363
387
|
|
|
364
388
|
/**************
|
|
365
389
|
func: Shield
|
|
366
|
-
params:
|
|
390
|
+
params: resolve, reject
|
|
367
391
|
describe:
|
|
368
392
|
The Shield feature sets the correct variables and necessary rules for the
|
|
369
393
|
client presented data.
|
|
@@ -374,7 +398,7 @@ class Deva {
|
|
|
374
398
|
|
|
375
399
|
/**************
|
|
376
400
|
func: Proxy
|
|
377
|
-
params:
|
|
401
|
+
params: resolve, reject
|
|
378
402
|
describe:
|
|
379
403
|
The Defense feature sets the correct variables and necessary rules for the
|
|
380
404
|
client presented data.
|
|
@@ -385,7 +409,7 @@ class Deva {
|
|
|
385
409
|
|
|
386
410
|
/**************
|
|
387
411
|
func: Legal
|
|
388
|
-
params:
|
|
412
|
+
params: resolve, reject
|
|
389
413
|
describe:
|
|
390
414
|
The Legal feature sets the correct variables and necessary rules for the
|
|
391
415
|
client presented data.
|
|
@@ -396,7 +420,7 @@ class Deva {
|
|
|
396
420
|
|
|
397
421
|
/**************
|
|
398
422
|
func: Justice
|
|
399
|
-
params:
|
|
423
|
+
params: resolve, reject
|
|
400
424
|
describe:
|
|
401
425
|
The Justice feature sets the correct variables and necessary rules for the
|
|
402
426
|
client presented data.
|
|
@@ -407,7 +431,7 @@ class Deva {
|
|
|
407
431
|
|
|
408
432
|
/**************
|
|
409
433
|
func: Authority
|
|
410
|
-
params:
|
|
434
|
+
params: resolve, reject
|
|
411
435
|
describe:
|
|
412
436
|
The Authority feature sets the correct variables and necessary rules for the
|
|
413
437
|
client presented data.
|
|
@@ -418,7 +442,7 @@ class Deva {
|
|
|
418
442
|
|
|
419
443
|
/**************
|
|
420
444
|
func: Support
|
|
421
|
-
params:
|
|
445
|
+
params: resolve, reject
|
|
422
446
|
describe:
|
|
423
447
|
The Support feature sets the correct variables and necessary rules for the
|
|
424
448
|
client presented data.
|
|
@@ -429,7 +453,7 @@ class Deva {
|
|
|
429
453
|
|
|
430
454
|
/**************
|
|
431
455
|
func: Services
|
|
432
|
-
params:
|
|
456
|
+
params: resolve, reject
|
|
433
457
|
describe:
|
|
434
458
|
The Services feature sets the correct variables and necessary rules for the
|
|
435
459
|
client presented data.
|
|
@@ -826,6 +850,10 @@ class Deva {
|
|
|
826
850
|
return this.Client(client, resolve, reject);
|
|
827
851
|
}).then(() => {
|
|
828
852
|
return this.Vector(resolve, reject);
|
|
853
|
+
}).then(() => {
|
|
854
|
+
return this.Veda(resolve, reject);
|
|
855
|
+
}).then(() => {
|
|
856
|
+
return this.King(resolve, reject);
|
|
829
857
|
}).then(() => {
|
|
830
858
|
return this.Treasury(resolve, reject);
|
|
831
859
|
}).then(() => {
|
|
@@ -897,15 +925,16 @@ class Deva {
|
|
|
897
925
|
const hasOnStart = this.onStart && typeof this.onStart === 'function' ? true : false;
|
|
898
926
|
|
|
899
927
|
this.state('start', data.id);
|
|
928
|
+
this.talk(config.events.start, data);
|
|
900
929
|
return hasOnStart ? this.onStart(data, resolve) : this.enter(data, resolve)
|
|
901
930
|
}
|
|
902
931
|
|
|
903
932
|
/**************
|
|
904
933
|
func: enter
|
|
905
934
|
params:
|
|
906
|
-
- msg:
|
|
935
|
+
- msg: the message from the caller incase need to use in calls
|
|
907
936
|
describe:
|
|
908
|
-
The
|
|
937
|
+
The enter function will check the active status of the Deva and set it to
|
|
909
938
|
offline or enter.
|
|
910
939
|
|
|
911
940
|
If the Deva is offline it will return the offline message.
|
|
@@ -929,6 +958,7 @@ class Deva {
|
|
|
929
958
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
930
959
|
|
|
931
960
|
this.state('enter', data.id);
|
|
961
|
+
this.talk(config.events.enter, data);
|
|
932
962
|
return hasOnEnter ? this.onEnter(data, resolve) : this.done(data, resolve)
|
|
933
963
|
}
|
|
934
964
|
|
|
@@ -961,6 +991,7 @@ class Deva {
|
|
|
961
991
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
962
992
|
|
|
963
993
|
this.state('done', data.id);
|
|
994
|
+
this.talk(config.events.done, data);
|
|
964
995
|
return hasOnDone ? this.onDone(data, resolve) : this.ready(data, resolve);
|
|
965
996
|
}
|
|
966
997
|
|
|
@@ -990,6 +1021,7 @@ class Deva {
|
|
|
990
1021
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
991
1022
|
|
|
992
1023
|
this.state('ready', data.id);
|
|
1024
|
+
this.talk(config.events.ready, data);
|
|
993
1025
|
return hasOnReady ? this.onReady(data, resolve) : resolve(data);
|
|
994
1026
|
}
|
|
995
1027
|
|
|
@@ -1021,6 +1053,7 @@ class Deva {
|
|
|
1021
1053
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1022
1054
|
|
|
1023
1055
|
this.state('finish', data.id); // set finish state
|
|
1056
|
+
this.talk(config.events.finish, data);
|
|
1024
1057
|
return hasOnFinish ? this.onFinish(data, resolve) : this.complete(data, resolve);
|
|
1025
1058
|
}
|
|
1026
1059
|
|
|
@@ -1050,6 +1083,7 @@ class Deva {
|
|
|
1050
1083
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1051
1084
|
|
|
1052
1085
|
this.state('complete', data.id);
|
|
1086
|
+
this.talk(config.events.complete, data);
|
|
1053
1087
|
return hasOnComplete ? this.onComplete(data, resolve) : resolve(data);
|
|
1054
1088
|
}
|
|
1055
1089
|
|
|
@@ -1090,6 +1124,7 @@ class Deva {
|
|
|
1090
1124
|
// has stop function then set hasOnStop variable
|
|
1091
1125
|
// if: has on stop then run on stop function or return exit function.
|
|
1092
1126
|
this.state('stop', id); // set the state to stop
|
|
1127
|
+
this.talk(config.events.stop, data);
|
|
1093
1128
|
return hasOnStop ? this.onStop(data) : this.exit()
|
|
1094
1129
|
}
|
|
1095
1130
|
|
|
@@ -1125,6 +1160,8 @@ class Deva {
|
|
|
1125
1160
|
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1126
1161
|
|
|
1127
1162
|
this.state('exit', id); // set the state to stop
|
|
1163
|
+
this.talk(config.events.exit, data);
|
|
1164
|
+
|
|
1128
1165
|
// clear memory
|
|
1129
1166
|
this._active = false;
|
|
1130
1167
|
this._client = false;
|
|
@@ -1492,6 +1529,26 @@ class Deva {
|
|
|
1492
1529
|
}
|
|
1493
1530
|
|
|
1494
1531
|
// FEATURE FUNCTIONS
|
|
1532
|
+
/**************
|
|
1533
|
+
func: veda
|
|
1534
|
+
params: none
|
|
1535
|
+
describe: basic veda features available in a Deva.
|
|
1536
|
+
usage: this.veda()
|
|
1537
|
+
***************/
|
|
1538
|
+
veda() {
|
|
1539
|
+
return this._getFeature('veda', this._vector);
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
/**************
|
|
1543
|
+
func: king
|
|
1544
|
+
params: none
|
|
1545
|
+
describe: basic king features available in a Deva.
|
|
1546
|
+
usage: this.king()
|
|
1547
|
+
***************/
|
|
1548
|
+
king() {
|
|
1549
|
+
return this._getFeature('king', this._vector);
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1495
1552
|
/**************
|
|
1496
1553
|
func: vector
|
|
1497
1554
|
params: none
|
package/lib/index.js
CHANGED
|
@@ -49,21 +49,23 @@ class LIB {
|
|
|
49
49
|
The uid function can create two types of id for you.
|
|
50
50
|
1. random GUID - this is good for when you need a uinique record id returned
|
|
51
51
|
2. transport id - The transport id is a number generated to provide a
|
|
52
|
-
numerical number used for transporting records
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
secure numerical number used for transporting records
|
|
53
|
+
across networks without collision or needing to store system uuid.
|
|
54
|
+
copyright: 2025 Quinn A Michaels. All rights reserved.
|
|
55
55
|
***************/
|
|
56
|
-
uid(guid=false) {
|
|
57
|
-
|
|
56
|
+
uid(guid=false) {
|
|
57
|
+
const time = Date.now();
|
|
58
58
|
if (guid) {
|
|
59
|
-
|
|
59
|
+
const guid = randomUUID(); // set guid into local variable for testing.
|
|
60
|
+
return guid; // return the guid.
|
|
60
61
|
}
|
|
61
62
|
else {
|
|
62
|
-
const min =
|
|
63
|
-
const max =
|
|
64
|
-
|
|
63
|
+
const min = Math.floor(time - (time / Math.PI)); // generate min time from Math.PI divisor.
|
|
64
|
+
const max = Math.ceil(time + (time * Math.PI)); // generate max time form Math.PI multiplier.
|
|
65
|
+
const begin_random = Math.floor(Math.random() * (max - min) + min); // generate random number between min and max.
|
|
66
|
+
const end_random = Math.ceil(Math.random() * (99999 - 10000) + 10000); // generate the 5 digit end salt on the number for added randomness.
|
|
67
|
+
return `${begin_random}${end_random}`; // return the complete random uid.
|
|
65
68
|
}
|
|
66
|
-
return id;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
/**************
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"id": "9f0bc743-d720-4320-832e-cf5edc3b7cf",
|
|
2
3
|
"name": "@indra.ai/deva",
|
|
3
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.54",
|
|
4
5
|
"description": "The Deva Core",
|
|
5
6
|
"main": "index.js",
|
|
6
7
|
"copyright": "(c)2025 Quinn Michaels; All rights reserved.",
|
|
@@ -23,8 +24,8 @@
|
|
|
23
24
|
"license": "Unlicense",
|
|
24
25
|
"author": {
|
|
25
26
|
"name": "Quinn Michaels",
|
|
26
|
-
"email": "quinn@
|
|
27
|
-
"url": "https://
|
|
27
|
+
"email": "quinn@indra.ai",
|
|
28
|
+
"url": "https://indra.ai/"
|
|
28
29
|
},
|
|
29
30
|
"funding": [
|
|
30
31
|
{
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
"bugs": {
|
|
40
41
|
"url": "https://github.com/indraai/deva/issues"
|
|
41
42
|
},
|
|
42
|
-
"homepage": "https://
|
|
43
|
+
"homepage": "https://indra.ai",
|
|
43
44
|
"eslintConfig": {
|
|
44
45
|
"parserOptions": {
|
|
45
46
|
"ecmaVersion": 6
|
|
@@ -67,6 +68,14 @@
|
|
|
67
68
|
"events": {
|
|
68
69
|
"prompt": "devacore:prompt",
|
|
69
70
|
"error": "devacore:error",
|
|
71
|
+
"start": "devacore:start",
|
|
72
|
+
"enter": "devacore:enter",
|
|
73
|
+
"done": "devacore:done",
|
|
74
|
+
"ready": "devacore:ready",
|
|
75
|
+
"finish": "devacore:finish",
|
|
76
|
+
"complete": "devacore:complete",
|
|
77
|
+
"stop": "devacore:stop",
|
|
78
|
+
"exit": "devacore:exit",
|
|
70
79
|
"question": "devacore:question",
|
|
71
80
|
"answer": "devacore:answer",
|
|
72
81
|
"ask": "devacore:ask",
|
|
@@ -89,7 +98,7 @@
|
|
|
89
98
|
"init": "๐ Init",
|
|
90
99
|
"start": "๐ข Start",
|
|
91
100
|
"enter": "๐ช Enter",
|
|
92
|
-
"done": "
|
|
101
|
+
"done": "โ๏ธ Done",
|
|
93
102
|
"ready": "โญ๏ธ Ready",
|
|
94
103
|
"finish": "๐ Finish",
|
|
95
104
|
"complete": "โ
Complete",
|
|
@@ -99,19 +108,22 @@
|
|
|
99
108
|
"agent": "๐ค Agent",
|
|
100
109
|
"client": "๐จ Client",
|
|
101
110
|
"vector": "๐ค๏ธ Vector",
|
|
111
|
+
"veda": "๐๏ธ Veda",
|
|
112
|
+
"king": "๐๏ธ King",
|
|
102
113
|
"treasury": "๐ฆ๏ธ Treasury",
|
|
103
|
-
"security": "
|
|
114
|
+
"security": "๐จ Security",
|
|
104
115
|
"guard": "๐ Guard",
|
|
105
116
|
"wall": "๐งฑ Wall",
|
|
117
|
+
"shield": "๐ก๏ธ Shield",
|
|
106
118
|
"defense": "๐ช Defense",
|
|
107
|
-
"proxy": "
|
|
119
|
+
"proxy": "๐พ๏ธ Proxy",
|
|
108
120
|
"legal": "๐๏ธ Legal",
|
|
109
121
|
"authority": "๐ Authority",
|
|
110
122
|
"justice": "โ๏ธ Justice",
|
|
111
|
-
"support": "
|
|
112
|
-
"services": "
|
|
113
|
-
"systems": "
|
|
114
|
-
"networks": "
|
|
123
|
+
"support": "๐ผ Support",
|
|
124
|
+
"services": "๐ ๏ธ Services",
|
|
125
|
+
"systems": "๐ฅ๏ธ๏ธ Systems",
|
|
126
|
+
"networks": "๐ก Networks",
|
|
115
127
|
"help": "๐ Help",
|
|
116
128
|
"error": "โ Error!"
|
|
117
129
|
},
|
|
@@ -138,7 +150,7 @@
|
|
|
138
150
|
"init": "๐ Init",
|
|
139
151
|
"start": "๐ข Start",
|
|
140
152
|
"enter": "๐ช Enter",
|
|
141
|
-
"done": "
|
|
153
|
+
"done": "โ๏ธ Done",
|
|
142
154
|
"ready": "โญ๏ธ Ready",
|
|
143
155
|
"finish": "๐ Finish",
|
|
144
156
|
"complete": "โ
Complete",
|
|
@@ -172,7 +184,7 @@
|
|
|
172
184
|
"help": "๐ Help",
|
|
173
185
|
"authorized": "๐ Authorized",
|
|
174
186
|
"unauthorized": "๐ดโโ ๏ธ Unauthorized",
|
|
175
|
-
"Done": "โ๏ธ
|
|
187
|
+
"Done": "โ๏ธ Done",
|
|
176
188
|
"glitch": "๐ก Glitch",
|
|
177
189
|
"intruder": "๐ฆนโโ๏ธ Intruder",
|
|
178
190
|
"snooper": "๐ Snooper",
|
|
@@ -197,16 +209,23 @@
|
|
|
197
209
|
"actions": {
|
|
198
210
|
"client": "๐จ Client",
|
|
199
211
|
"agent": "๐ต๏ธโโ๏ธ Agent",
|
|
200
|
-
"
|
|
212
|
+
"vector": "๐ฝ Vector",
|
|
213
|
+
"veda": "๐๏ธ Veda",
|
|
214
|
+
"king": "๐๏ธ King",
|
|
215
|
+
"security": "๐จ Security",
|
|
201
216
|
"guard": "๐ Guard",
|
|
217
|
+
"shield": "๐ก๏ธ Shield",
|
|
218
|
+
"wall": "๐งฑ Wall",
|
|
219
|
+
"proxy": "๐พ๏ธ Proxy",
|
|
202
220
|
"defense": "๐ช Defense",
|
|
203
|
-
"support": "
|
|
221
|
+
"support": "๐ผ Support",
|
|
204
222
|
"services": "๐ ๏ธ Services",
|
|
205
223
|
"systems": "๐ฅ๏ธ Systems",
|
|
206
224
|
"networks": "๐ก Networks",
|
|
207
|
-
"legal": "
|
|
208
|
-
"justice": "
|
|
209
|
-
"authority": "
|
|
225
|
+
"legal": "๐๏ธ Legal",
|
|
226
|
+
"justice": "โ๏ธ Justice",
|
|
227
|
+
"authority": "๐ Authority",
|
|
228
|
+
"treasury": "๐ฆ Treasury",
|
|
210
229
|
"talk": "๐ข Talk",
|
|
211
230
|
"listen": "๐ Listen",
|
|
212
231
|
"once": "๐ Once",
|
|
@@ -234,7 +253,7 @@
|
|
|
234
253
|
"status": "๐ฅ Status",
|
|
235
254
|
"error": "๐ฃ Error",
|
|
236
255
|
"help": "๐ Help",
|
|
237
|
-
"done": "
|
|
256
|
+
"done": "โ๏ธ Done",
|
|
238
257
|
"ready": "โญ๏ธ Ready",
|
|
239
258
|
"complete": "โ
Complete"
|
|
240
259
|
},
|
|
@@ -244,27 +263,29 @@
|
|
|
244
263
|
"agent": "๐ฆพ Agent",
|
|
245
264
|
"client": "๐ช Client",
|
|
246
265
|
"vector": "๐ค๏ธ Vector",
|
|
247
|
-
"
|
|
248
|
-
"
|
|
266
|
+
"veda": "๐๏ธ Veda",
|
|
267
|
+
"king": "๐๏ธ King",
|
|
268
|
+
"treasury": "๐ฆ Treasury",
|
|
269
|
+
"security": "๐จ Security",
|
|
249
270
|
"guard": "๐ Guard",
|
|
250
271
|
"defense": "๐ช๏ธ๏ธ Defense",
|
|
251
272
|
"wall": "๐งฑ Wall",
|
|
252
273
|
"shield": "๐ก๏ธ Shield",
|
|
253
|
-
"proxy": "
|
|
254
|
-
"legal": "
|
|
255
|
-
"authority": "
|
|
256
|
-
"justice": "
|
|
274
|
+
"proxy": "๐พ๏ธ Proxy",
|
|
275
|
+
"legal": "๐๏ธ Legal",
|
|
276
|
+
"authority": "๐ Authority",
|
|
277
|
+
"justice": "โ๏ธ Justice",
|
|
257
278
|
"support": "๐ผ Support",
|
|
258
279
|
"services": "๐ ๏ธ Services",
|
|
259
280
|
"systems": "๐ฅ๏ธ๏ธ Systems",
|
|
260
|
-
"networks": "
|
|
281
|
+
"networks": "๐ก Networks"
|
|
261
282
|
},
|
|
262
283
|
"message": "offline",
|
|
263
284
|
"messages": {
|
|
264
285
|
"init": "๐ INIT",
|
|
265
286
|
"start": "๐ข START",
|
|
266
287
|
"enter": "๐ต ENTER",
|
|
267
|
-
"done": "
|
|
288
|
+
"done": "โ๏ธ DONE",
|
|
268
289
|
"ready": "โญ๏ธ READY",
|
|
269
290
|
"stop": "๐ด STOP",
|
|
270
291
|
"exit": "๐ช EXIT",
|
package/tests/agent.json
CHANGED
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
"gender": "M"
|
|
31
31
|
},
|
|
32
32
|
"features": {
|
|
33
|
+
"vector": {
|
|
34
|
+
"label": "๐ค๏ธVECTOR",
|
|
35
|
+
"name": "@VECTOR",
|
|
36
|
+
"tag": "#VECTOR",
|
|
37
|
+
"loc": "$VECTOR"
|
|
38
|
+
},
|
|
33
39
|
"security": {
|
|
34
40
|
"label": "๐จSECURITY",
|
|
35
41
|
"name": "@SECURITY",
|
|
@@ -88,11 +94,16 @@
|
|
|
88
94
|
"vars": {
|
|
89
95
|
"hello": "Hellow World",
|
|
90
96
|
"context": {
|
|
91
|
-
"
|
|
97
|
+
"start": "๐๏ธ Start",
|
|
98
|
+
"enter": "๐ช๏ธ Enter",
|
|
99
|
+
"done": "โ
Done",
|
|
100
|
+
"ready": "๐ Ready",
|
|
101
|
+
"finish": "๐ Finish",
|
|
102
|
+
"complete": "๐ค Complete",
|
|
92
103
|
"test": "๐ฟ Test Data",
|
|
93
104
|
"prompt": "๐ป Prompt",
|
|
94
|
-
"feature": "๐ฟ
|
|
95
|
-
"zone": "๐ป
|
|
105
|
+
"feature": "๐ฟ Feature",
|
|
106
|
+
"zone": "๐ป Zone"
|
|
96
107
|
}
|
|
97
108
|
}
|
|
98
109
|
}
|
package/tests/client.json
CHANGED
package/tests/index.js
CHANGED
|
@@ -8,23 +8,25 @@ import Agent from './agent.json' with {type:'json'};
|
|
|
8
8
|
const agent = Agent.DATA;
|
|
9
9
|
|
|
10
10
|
import Deva from '../index.js';
|
|
11
|
+
import pkg from '../package.json' with {type:'json'};
|
|
11
12
|
|
|
12
13
|
import {dirname} from 'node:path';
|
|
13
14
|
import {fileURLToPath} from 'node:url';
|
|
14
15
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
16
|
|
|
16
17
|
const info = {
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
describe:
|
|
20
|
-
version:
|
|
18
|
+
id: pkg.id,
|
|
19
|
+
name: pkg.name,
|
|
20
|
+
describe: pkg.description,
|
|
21
|
+
version: pkg.version,
|
|
22
|
+
author: pkg.author.name,
|
|
23
|
+
email: pkg.author.email,
|
|
24
|
+
url: pkg.authorurl,
|
|
25
|
+
copyright: pkg.copyright,
|
|
21
26
|
dir: __dirname,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
bugs: 'git+https://github.com/indraai/deva.git#bugs',
|
|
25
|
-
author: 'Quinn Michaels',
|
|
27
|
+
git: pkg.repository.url,
|
|
28
|
+
bugs: pkg.bugs.url,
|
|
26
29
|
license: 'TESTING ONLY',
|
|
27
|
-
copyright: 2025,
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
const DevaTest = new Deva({
|
|
@@ -55,6 +57,24 @@ const DevaTest = new Deva({
|
|
|
55
57
|
'devacore:question'(packet) {
|
|
56
58
|
console.log(`๐โโ๏ธ๏ธ question: ${packet.text}`);
|
|
57
59
|
},
|
|
60
|
+
'devacore:start'(packet) {
|
|
61
|
+
console.log(`๐ข start: ${packet.text}`);
|
|
62
|
+
},
|
|
63
|
+
'devacore:enter'(packet) {
|
|
64
|
+
console.log(`๐ช enter: ${packet.text}`);
|
|
65
|
+
},
|
|
66
|
+
'devacore:done'(packet) {
|
|
67
|
+
console.log(`โ๏ธ done: ${packet.text}`);
|
|
68
|
+
},
|
|
69
|
+
'devacore:ready'(packet) {
|
|
70
|
+
console.log(`โญ๏ธ ready: ${packet.text}`);
|
|
71
|
+
},
|
|
72
|
+
'devacore:finish'(packet) {
|
|
73
|
+
console.log(`๐ finish: ${packet.text}`);
|
|
74
|
+
},
|
|
75
|
+
'devacore:complete'(packet) {
|
|
76
|
+
console.log(`โ
complete: ${packet.text}`);
|
|
77
|
+
},
|
|
58
78
|
'devacore:answer'(packet) {
|
|
59
79
|
console.log(`๐จโ๐ฌ answer: ${packet.text}`);
|
|
60
80
|
},
|
|
@@ -71,12 +91,11 @@ const DevaTest = new Deva({
|
|
|
71
91
|
console.log(`๐ฅ action: ${packet.text}`);
|
|
72
92
|
},
|
|
73
93
|
'devacore:feature'(packet) {
|
|
74
|
-
console.log(`---`);
|
|
75
94
|
this.context('feature');
|
|
76
95
|
console.log(`๐ฟ feature: ${packet.text}`);
|
|
77
96
|
},
|
|
78
97
|
'devacore:context'(packet) {
|
|
79
|
-
console.log(
|
|
98
|
+
console.log(`\n๐น context: ${packet.text}`);
|
|
80
99
|
},
|
|
81
100
|
'devacore:error'(packet) {
|
|
82
101
|
console.log(`โ error: ${packet.text}`);
|
|
@@ -87,13 +106,8 @@ const DevaTest = new Deva({
|
|
|
87
106
|
func: {
|
|
88
107
|
test(packet) {
|
|
89
108
|
const text = this._state
|
|
90
|
-
const id = this.lib.uid();
|
|
91
|
-
const uid = this.lib.uid(true);
|
|
92
109
|
const core = this.core();
|
|
93
110
|
const info = this.info();
|
|
94
|
-
const date = Date.now();
|
|
95
|
-
const hashstr = `${id}${uid}${date}`;
|
|
96
|
-
const proxy = this.proxy(hashstr);
|
|
97
111
|
const data = [
|
|
98
112
|
'๐งช TEST RESULTS',
|
|
99
113
|
`::BEGIN:CORE:${core.id}`,
|
|
@@ -115,9 +129,32 @@ const DevaTest = new Deva({
|
|
|
115
129
|
return this.func.test(packet);
|
|
116
130
|
}
|
|
117
131
|
},
|
|
132
|
+
onStart(data, resolve) {
|
|
133
|
+
this.context('start', data.id);
|
|
134
|
+
return this.enter(data, resolve);
|
|
135
|
+
},
|
|
136
|
+
onEnter(data, resolve) {
|
|
137
|
+
this.context('enter', data.id);
|
|
138
|
+
return this.done(data, resolve);
|
|
139
|
+
},
|
|
140
|
+
onDone(data, resolve) {
|
|
141
|
+
this.context('done', data.id);
|
|
142
|
+
return this.ready(data, resolve);
|
|
143
|
+
},
|
|
118
144
|
onReady(data, resolve) {
|
|
119
|
-
this.context('ready');
|
|
120
|
-
this.
|
|
145
|
+
this.context('ready', data.id);
|
|
146
|
+
const test = this.methods.test(data);
|
|
147
|
+
this.prompt(test.text);
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
return resolve(data);
|
|
150
|
+
}, 10000);
|
|
151
|
+
},
|
|
152
|
+
onFinish(data, resolve) {
|
|
153
|
+
this.context('finish', data.id);
|
|
154
|
+
return this.complete(data, resolve);
|
|
155
|
+
},
|
|
156
|
+
onComplete(data, resolve) {
|
|
157
|
+
this.context('complete', data.id);
|
|
121
158
|
return resolve(data);
|
|
122
159
|
},
|
|
123
160
|
onError(e) {
|