@indra.ai/deva 1.5.18 β†’ 1.5.20

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.
Files changed (2) hide show
  1. package/index.js +34 -25
  2. 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', packet.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.action('enter');
809
- packet.value = 'enter';
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
- // return the provided resolve function or a promise resolve.
872
- this.state('finish', packet.id); // set the finish state
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.18",
3
+ "version": "1.5.20",
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": "🏎️ 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": "πŸ› 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": "🎬 Start",
213
+ "start": "🟒 Start",
209
214
  "enter": "🏑 Enter",
210
215
  "finish": "🏁 Finish",
211
- "stop": "πŸ›‘ 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": {