@indra.ai/deva 1.5.18 β 1.5.19
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 +34 -25
- package/package.json +22 -13
package/index.js
CHANGED
|
@@ -780,8 +780,9 @@ class Deva {
|
|
|
780
780
|
usage: this.start('msg')
|
|
781
781
|
***************/
|
|
782
782
|
start(packet, resolve) {
|
|
783
|
-
this.zone('start');
|
|
784
783
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
784
|
+
const id = this.lib.uid();
|
|
785
|
+
this.zone('start', data.id);
|
|
785
786
|
this.action('start');
|
|
786
787
|
packet.value = 'start';
|
|
787
788
|
delete packet.hash;
|
|
@@ -803,14 +804,14 @@ class Deva {
|
|
|
803
804
|
usage: this.enter('msg')
|
|
804
805
|
***************/
|
|
805
806
|
enter(packet, resolve) {
|
|
806
|
-
this.zone('deva');
|
|
807
807
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
808
|
-
this.
|
|
809
|
-
|
|
808
|
+
const hasOnEnter = this.onEnter && typeof this.onEnter === 'function' ? true : false;
|
|
809
|
+
this.zone('enter', packet.id);
|
|
810
|
+
this.action('enter', packet.id);
|
|
811
|
+
this.state('enter', packet.id);
|
|
810
812
|
delete packet.hash;
|
|
813
|
+
packet.value = 'enter';
|
|
811
814
|
packet.hash = this.lib.hash(packet);
|
|
812
|
-
this.state('enter');
|
|
813
|
-
const hasOnEnter = this.onEnter && typeof this.onEnter === 'function' ? true : false;
|
|
814
815
|
return hasOnEnter ? this.onEnter(packet, resolve) : this.done(packet, resolve)
|
|
815
816
|
}
|
|
816
817
|
|
|
@@ -827,11 +828,13 @@ class Deva {
|
|
|
827
828
|
***************/
|
|
828
829
|
done(packet, resolve) {
|
|
829
830
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
831
|
+
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
832
|
+
this.zone('done', packet.id);
|
|
833
|
+
this.action('done', packet.id);
|
|
834
|
+
this.state('done', packet.id);
|
|
830
835
|
packet.value = 'done';
|
|
831
836
|
delete packet.hash;
|
|
832
837
|
packet.hash = this.lib.hash(packet);
|
|
833
|
-
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
834
|
-
this.state('done', packet.id);
|
|
835
838
|
return hasOnDone ? this.onDone(packet, resolve) : this.ready(packet, resolve);
|
|
836
839
|
}
|
|
837
840
|
|
|
@@ -845,12 +848,13 @@ class Deva {
|
|
|
845
848
|
***************/
|
|
846
849
|
ready(packet, resolve) {
|
|
847
850
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
851
|
+
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
852
|
+
this.zone('ready', packet.id);
|
|
853
|
+
this.action('ready', packet.id);
|
|
854
|
+
this.state('ready', packet.id);
|
|
855
|
+
packet.value = 'ready';
|
|
848
856
|
delete packet.hash;
|
|
849
857
|
packet.hash = this.lib.hash(packet);// hash the entire packet before completeing.
|
|
850
|
-
// check for agent on complete function in agent
|
|
851
|
-
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
852
|
-
// return the provided resolve function or a promise resolve.
|
|
853
|
-
this.state('ready', packet.id); // set the finish state
|
|
854
858
|
return hasOnReady ? this.onReady(packet, resolve) : resolve(packet);
|
|
855
859
|
}
|
|
856
860
|
|
|
@@ -866,10 +870,10 @@ class Deva {
|
|
|
866
870
|
***************/
|
|
867
871
|
finish(packet, resolve) {
|
|
868
872
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
869
|
-
// check for agent on finish function in agent
|
|
870
873
|
const hasOnFinish = this.onFinish && typeof this.onFinish === 'function';
|
|
871
|
-
|
|
872
|
-
this.
|
|
874
|
+
this.zone('finish', packet.id);
|
|
875
|
+
this.action('finish', packet.id);
|
|
876
|
+
this.state('finish', packet.id);
|
|
873
877
|
return hasOnFinish ? this.onFinish(packet, resolve) : this.complete(packet, resolve);
|
|
874
878
|
}
|
|
875
879
|
|
|
@@ -884,14 +888,13 @@ class Deva {
|
|
|
884
888
|
***************/
|
|
885
889
|
complete(packet, resolve) {
|
|
886
890
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
891
|
+
const hasOnComplete = this.onComplete && typeof this.onComplete === 'function';
|
|
892
|
+
this.zone('complete', packet.id);
|
|
893
|
+
this.action('complete', packet.id);
|
|
894
|
+
this.state('complete', packet.id);
|
|
887
895
|
packet.created = Date.now();// set the complete date on the whole packet.
|
|
888
896
|
delete packet.hash;
|
|
889
897
|
packet.hash = this.lib.hash(packet);// hash the entire packet before complete.
|
|
890
|
-
|
|
891
|
-
// check for agent on complete function in agent
|
|
892
|
-
const hasOnComplete = this.onComplete && typeof this.onComplete === 'function';
|
|
893
|
-
// return the provided resolve function or a promise resolve.
|
|
894
|
-
this.state('complete', packet.id); // set the finish state
|
|
895
898
|
return hasOnComplete ? this.onComplete(packet, resolve) : resolve(packet);
|
|
896
899
|
}
|
|
897
900
|
|
|
@@ -909,8 +912,12 @@ class Deva {
|
|
|
909
912
|
this.stop()
|
|
910
913
|
***************/
|
|
911
914
|
stop() {
|
|
912
|
-
const id = this.lib.uid();
|
|
913
915
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
916
|
+
const id = this.lib.uid();
|
|
917
|
+
const hasOnStop = this.onStop && typeof this.onStop === 'function';
|
|
918
|
+
this.zone('stop', id);
|
|
919
|
+
this.action('stop', id);
|
|
920
|
+
this.state('stop', id); // set the state to stop
|
|
914
921
|
|
|
915
922
|
const data = { // build the stop data
|
|
916
923
|
id, // set the id
|
|
@@ -921,9 +928,7 @@ class Deva {
|
|
|
921
928
|
created: Date.now(), // set the created date
|
|
922
929
|
}
|
|
923
930
|
// has stop function then set hasOnStop variable
|
|
924
|
-
const hasOnStop = this.onStop && typeof this.onStop === 'function';
|
|
925
931
|
// if: has on stop then run on stop function or return exit function.
|
|
926
|
-
this.state('stop', id); // set the state to stop
|
|
927
932
|
return hasOnStop ? this.onStop(data) : this.exit()
|
|
928
933
|
}
|
|
929
934
|
|
|
@@ -939,7 +944,13 @@ class Deva {
|
|
|
939
944
|
function.
|
|
940
945
|
***************/
|
|
941
946
|
exit() {
|
|
947
|
+
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
942
948
|
const id = this.lib.uid();
|
|
949
|
+
const hasOnExit = this.onExit && typeof this.onExit === 'function';
|
|
950
|
+
this.zone('exit', id);
|
|
951
|
+
this.action('exit', id);
|
|
952
|
+
this.state('exit', id); // set the state to stop
|
|
953
|
+
|
|
943
954
|
const data = {
|
|
944
955
|
id,
|
|
945
956
|
key: 'exit',
|
|
@@ -962,8 +973,6 @@ class Deva {
|
|
|
962
973
|
this._authority = false;
|
|
963
974
|
this._justice = false;
|
|
964
975
|
|
|
965
|
-
this.state('exit', id);
|
|
966
|
-
const hasOnExit = this.onExit && typeof this.onExit === 'function';
|
|
967
976
|
return hasOnExit ? this.onExit(data) : Promise.resolve(data)
|
|
968
977
|
}
|
|
969
978
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indra.ai/deva",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.19",
|
|
4
4
|
"description": "The Deva Core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"copyright": "(c)2025 Quinn Michaels; All rights reserved.",
|
|
@@ -87,9 +87,14 @@
|
|
|
87
87
|
"load": "π Load",
|
|
88
88
|
"unload": "π» Unload",
|
|
89
89
|
"init": "π Init",
|
|
90
|
-
"start": "
|
|
90
|
+
"start": "π’ Start",
|
|
91
91
|
"enter": "π‘ Enter",
|
|
92
|
+
"done": "β
Done",
|
|
93
|
+
"ready": "π«‘ Ready",
|
|
92
94
|
"finish": "π Finish",
|
|
95
|
+
"complete": "π― Complete",
|
|
96
|
+
"stop": "π΄ Stop",
|
|
97
|
+
"exit": "πͺ Exit",
|
|
93
98
|
"deva": "β‘οΈ Deva",
|
|
94
99
|
"client": "π¨ Client",
|
|
95
100
|
"agent": "π€ Agent",
|
|
@@ -119,7 +124,6 @@
|
|
|
119
124
|
"question": "π¬ Question",
|
|
120
125
|
"cmd": "πͺ Command",
|
|
121
126
|
"answer": "π‘ Answer",
|
|
122
|
-
"ready": "π Ready",
|
|
123
127
|
"wait": "β³ Waiting",
|
|
124
128
|
"pause": "βΈοΈ Pause",
|
|
125
129
|
"resume": "π Resume",
|
|
@@ -128,22 +132,23 @@
|
|
|
128
132
|
"send": "π¬ Send",
|
|
129
133
|
"receive": "πͺ Receive",
|
|
130
134
|
"init": "π Init",
|
|
131
|
-
"start": "
|
|
132
|
-
"stop": "βΉοΈ Stop",
|
|
133
|
-
"open": "π₯« Open",
|
|
134
|
-
"close": "π¦ Close",
|
|
135
|
+
"start": "π’ Start",
|
|
135
136
|
"enter": "π‘ Enter",
|
|
137
|
+
"done": "β
Done",
|
|
138
|
+
"ready": "π«‘ Ready",
|
|
139
|
+
"finish": "π Finish",
|
|
140
|
+
"complete": "π― Complete",
|
|
141
|
+
"stop": "π Stop",
|
|
136
142
|
"exit": "πͺ Exit",
|
|
143
|
+
"open": "π₯« Open",
|
|
144
|
+
"close": "π¦ Close",
|
|
137
145
|
"begin": "πΊοΈ Begin",
|
|
138
146
|
"end": "π¬ End",
|
|
139
147
|
"load": "π Load",
|
|
140
148
|
"unload": "π» Unload",
|
|
141
149
|
"resolve": "π€ Resolve",
|
|
142
150
|
"reject": "π§± Reject",
|
|
143
|
-
"done": "π Done",
|
|
144
151
|
"data": "π‘ Data",
|
|
145
|
-
"finish": "π Finish",
|
|
146
|
-
"complete": "β
Complete",
|
|
147
152
|
"create": "π¨ Create",
|
|
148
153
|
"destroy": "π£ Destroy",
|
|
149
154
|
"write": "π Write",
|
|
@@ -205,10 +210,11 @@
|
|
|
205
210
|
"answer": "π‘ Answer",
|
|
206
211
|
"ask": "π£ Ask",
|
|
207
212
|
"init": "π Init",
|
|
208
|
-
"start": "
|
|
213
|
+
"start": "π’ Start",
|
|
209
214
|
"enter": "π‘ Enter",
|
|
210
215
|
"finish": "π Finish",
|
|
211
|
-
"stop": "
|
|
216
|
+
"stop": "π΄ Stop",
|
|
217
|
+
"exit": "πͺ Exit",
|
|
212
218
|
"method": "β€οΈβπ₯ Method",
|
|
213
219
|
"func": "π¦ Func",
|
|
214
220
|
"actions": "ποΈ Actions",
|
|
@@ -222,7 +228,10 @@
|
|
|
222
228
|
"info": "πββοΈ Info",
|
|
223
229
|
"status": "π₯ Status",
|
|
224
230
|
"error": "π΄ ERROR!",
|
|
225
|
-
"help": "π Help"
|
|
231
|
+
"help": "π Help",
|
|
232
|
+
"done": "β
Done",
|
|
233
|
+
"ready": "π«‘ Ready",
|
|
234
|
+
"complete": "π― Complete"
|
|
226
235
|
},
|
|
227
236
|
"feature": false,
|
|
228
237
|
"features": {
|