@indra.ai/deva 1.1.43 → 1.1.45

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 +83 -79
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -62,8 +62,8 @@ class Deva {
62
62
  enter: `enter deva.world`,
63
63
  stop: `stop what you are doing`,
64
64
  exit: 'exit deva.world',
65
- load: 'load Deva',
66
- unload: 'unload Deva',
65
+ load: 'loading',
66
+ unload: 'unloading',
67
67
 
68
68
  invalid: 'State Invalid',
69
69
  done: 'State Done',
@@ -100,27 +100,27 @@ class Deva {
100
100
  answer_talk: 'sharing the answer',
101
101
  ask: 'asking',
102
102
  ask_answer: 'answering',
103
- security: 'security',
103
+ security: 'SECURITY',
104
104
  Security: 'Security Feature',
105
- support: 'support',
105
+ support: 'SUPPORT',
106
106
  Support: 'Support Feature',
107
- systems: 'systems',
107
+ systems: 'SYSTMS',
108
108
  Systems: 'Systems Feature',
109
- services: 'services',
109
+ services: 'SERVICES',
110
110
  Services: 'Services Feature',
111
- solutions: 'solutions',
111
+ solutions: 'SOLUTIONS',
112
112
  Solutions: 'Solutions Feature',
113
- development: 'development',
113
+ development: 'DEVELOPMENT',
114
114
  Development: 'Development Feature',
115
- business: 'business',
115
+ business: 'BUSINESS',
116
116
  Business: 'Business Feature',
117
- legal: 'legal',
117
+ legal: 'LEGAL',
118
118
  Legal: 'Legal Feature',
119
- assistant: 'assistant',
119
+ assistant: 'ASSISTANT',
120
120
  Assistant: 'Assistant Feature',
121
- story: 'story',
121
+ story: 'STORY',
122
122
  Story: 'Story Feature',
123
- mind: 'mind',
123
+ mind: 'MIND',
124
124
  Mind: 'Mind Feature',
125
125
  client_data: 'Client Data',
126
126
  invalid: 'Actin Invalid',
@@ -130,28 +130,28 @@ class Deva {
130
130
 
131
131
  this._feature = false;
132
132
  this._features = {
133
- security: 'security',
134
- Security: 'Security Feature',
135
- support: 'support',
136
- Support: 'Support Feature',
137
- services: 'services',
138
- Services: 'Servicees Feature',
139
- solutions: 'solutions',
140
- Solutions: 'Solutions Feature',
141
- systems: 'systems',
142
- Systems: 'Systems Feature',
143
- development: 'development',
144
- Development: 'Development Feature',
145
- business: 'business',
146
- Business: 'Business Feature',
147
- legal:'legal',
148
- Legal:'Legal Feature',
149
- assistant: 'assistant',
150
- Assistant: 'Assistant Feature',
151
- story: 'story',
152
- Story: 'Story Feature',
153
- mind: 'mind',
154
- Mind: 'Mind Feature',
133
+ security: '🔐 SECURITY',
134
+ Security: '🔐 SECURITY Feature',
135
+ support: '💼 SUPPORT',
136
+ Support: '💼 SUPPORT Feature',
137
+ services: '🛠️ SERVICES',
138
+ Services: '🛠️ SERVICES',
139
+ solutions: '💡 SOLUTIONS',
140
+ Solutions: '💡 SOLUTIONS Feature',
141
+ systems: '🖥️ SYSTEMS',
142
+ Systems: '🖥️ SYSTEMS Feature',
143
+ development: '🔧 DEVELOPMENT',
144
+ Development: '🔧 DEVELOPMENT Feature',
145
+ business: '📊 BUSINESS',
146
+ Business: '📊 BUSINESS Feature',
147
+ legal:'⚖️ LEGAL',
148
+ Legal:'⚖️ LEGAL Feature',
149
+ assistant: '🤝 ASSISTANT',
150
+ Assistant: '🤝 ASSISTANT Feature',
151
+ story: '📚 STORY',
152
+ Story: '📚 STORY Feature',
153
+ mind: '🧠 MIND',
154
+ Mind: '🧠 MIND Feature',
155
155
  error: 'Feature Error',
156
156
  done: 'Feature Done',
157
157
  };
@@ -170,8 +170,8 @@ class Deva {
170
170
  enter: `📲 ${this._agent.profile.name} ${this._states.enter}`,
171
171
  stop: `✋ ${this._agent.profile.name} ${this._states.stop}`,
172
172
  exit: `🚪 ${this._agent.profile.name} ${this._states.exit}`,
173
- load: `📫 ${this._agent.profile.name} ${this._states.load}`,
174
- unload: `📭 ${this._agent.profile.name} ${this._states.unload}`,
173
+ load: `📫 ${this._agent.profile.name} is ${this._states.load}`,
174
+ unload: `📭 ${this._agent.profile.name} is ${this._states.unload}`,
175
175
  uid: `${this._agent.profile.name} ${this._states.uid}`,
176
176
  hash: `${this._agent.profile.name} ${this._states.hash}`,
177
177
  cipher: `${this._agent.profile.name} ${this._states.cipher}`,
@@ -207,28 +207,28 @@ class Deva {
207
207
  ask: `👥 ${this._agent.profile.name} is asking`,
208
208
  ask_answer: `🎟️ ${this._agent.profile.name} is answering the ask`,
209
209
 
210
- security: `${this._actions.security} is responding`,
211
- Security: `${this._actions.Security} is ready`,
212
- support: `${this._actions.support} is responding`,
213
- Support: `${this._actions.Support} is ready`,
214
- services: `${this._actions.Services} is responding`,
215
- Services: `${this._actions.Services} is ready`,
216
- solutions: `${this._actions.solutions} is responding`,
217
- Solutions: `${this._actions.Solutions} is ready`,
218
- solutions: `${this._actions.Systems} is responding`,
219
- Systems: `${this._actions.Systems} is ready`,
220
- development: `${this._actions.Development} is responding`,
221
- Development: `${this._actions.Development} is ready`,
222
- business: `${this._actions.Business} is responding`,
223
- Business: `${this._actions.Business} is ready`,
224
- legal: `${this._actions.Legal} is responding`,
225
- Legal: `${this._actions.Legal} is ready`,
226
- assistant: `${this._actions.Assistant} is responding`,
227
- Assistant: `${this._actions.Assistant} is ready`,
228
- story: `${this._actions.Story} is responding`,
229
- Story: `${this._actions.Story} is ready`,
230
- mind: `${this._actions.Mind} is responding`,
231
- Mind: `${this._actions.Mind} is ready`,
210
+ security: `${this._features.security} is responding`,
211
+ Security: `${this._features.Security} is ready`,
212
+ support: `${this._features.support} is responding`,
213
+ Support: `${this._features.Support} is ready`,
214
+ services: `${this._features.Services} is responding`,
215
+ Services: `${this._features.Services} is ready`,
216
+ solutions: `${this._features.solutions} is responding`,
217
+ Solutions: `${this._features.Solutions} is ready`,
218
+ solutions: `${this._features.Systems} is responding`,
219
+ Systems: `${this._features.Systems} is ready`,
220
+ development: `${this._features.Development} is responding`,
221
+ Development: `${this._features.Development} is ready`,
222
+ business: `${this._features.Business} is responding`,
223
+ Business: `${this._features.Business} is ready`,
224
+ legal: `${this._features.Legal} is responding`,
225
+ Legal: `${this._features.Legal} is ready`,
226
+ assistant: `${this._features.Assistant} is responding`,
227
+ Assistant: `${this._features.Assistant} is ready`,
228
+ story: `${this._features.Story} is responding`,
229
+ Story: `${this._features.Story} is ready`,
230
+ mind: `${this._features.Mind} is responding`,
231
+ Mind: `${this._features.Mind} is ready`,
232
232
  client_data: `📂 ${this._agent.profile.name} setting Client Data`,
233
233
  invalid: `${this._actions.invalid}`,
234
234
  done: `✅ ${this._actions.done}`,
@@ -1022,7 +1022,7 @@ class Deva {
1022
1022
 
1023
1023
 
1024
1024
  this.action('answer_talk');
1025
- this.talk('devacore:answer', packet); // talk the answer with a copy of the data
1025
+ this.talk('devacore:answer', this.copy(packet)); // talk the answer with a copy of the data
1026
1026
 
1027
1027
  return resolve(packet); // resolve the packet to the caller.
1028
1028
  }).catch(err => { // catch any errors in the method
@@ -1073,7 +1073,7 @@ class Deva {
1073
1073
  return setImmediate(() => {
1074
1074
  this.action('invalid')
1075
1075
  packet.a.text = `INVALID METHOD (${packet.q.meta.method})`;
1076
- this.talk(`${this._agent.key}:ask:${packet.id}`, packet);
1076
+ this.talk(`${this._agent.key}:ask:${packet.id}`, this.copy(packet));
1077
1077
  });
1078
1078
  }
1079
1079
 
@@ -1092,13 +1092,13 @@ class Deva {
1092
1092
  this.talk(`${this._agent.key}:ask:${packet.id}`, this.copy(packet));
1093
1093
  }).catch(err => {
1094
1094
  this.action('error');
1095
- this.talk(`${this._agent.key}:ask:${packet.id}`, {error:err.toString()});
1095
+ this.talk(`${this._agent.key}:ask:${packet.id}`, {error:err});
1096
1096
  return this.error(err, packet);
1097
1097
  })
1098
1098
  }
1099
1099
  catch (e) {
1100
1100
  this.action('error');
1101
- this.talk(`${this._agent.key}:ask:${packet.id}`, {error:e.toString()});
1101
+ this.talk(`${this._agent.key}:ask:${packet.id}`, {error:e});
1102
1102
  return this.error(e, packet)
1103
1103
  }
1104
1104
  // now when we ask the meta params[0] should be the method
@@ -1363,7 +1363,7 @@ class Deva {
1363
1363
  created: Date.now(),
1364
1364
  };
1365
1365
  _data.hash = this.hash(JSON.stringify(_data));
1366
- this.talk('zone', _data);
1366
+ this.talk('devacore:zone', this.copy(_data));
1367
1367
  } catch (e) {
1368
1368
  return this.error(e);
1369
1369
  }
@@ -1417,7 +1417,7 @@ class Deva {
1417
1417
  created: Date.now(),
1418
1418
  };
1419
1419
  _data.hash = this.hash(JSON.stringify(_data));
1420
- this.talk('devacore:feature', _data);
1420
+ this.talk('devacore:feature', this.copy(_data));
1421
1421
  } catch (e) {
1422
1422
  return this.error(e);
1423
1423
  }
@@ -1643,6 +1643,7 @@ class Deva {
1643
1643
  this.state('load');
1644
1644
  this.devas[key].init(client).then(loaded => {
1645
1645
  this.talk(`devacore:load`, {
1646
+ id:this.uid(true),
1646
1647
  key,
1647
1648
  created: Date.now(),
1648
1649
  });
@@ -1663,14 +1664,17 @@ class Deva {
1663
1664
  return new Promise((resolve, reject) => {
1664
1665
  try {
1665
1666
  this.state('uload');
1666
- delete this.devas[key];
1667
- this.talk(`devacore:unload`, {
1668
- key,
1669
- created: Date.now(),
1667
+ this.devas[key].stop().then(exit => {
1668
+ delete this.devas[key];
1669
+ this.talk(`devacore:unload`, {
1670
+ id:this.uid(true),
1671
+ key,
1672
+ created: Date.now(),
1673
+ });
1670
1674
  });
1671
1675
  return resolve(this._messages.states.unload);
1672
1676
  } catch (e) {
1673
- return reject(e, this.devas[key], reject)
1677
+ return this.error(e, this.devas[key], reject)
1674
1678
  }
1675
1679
  });
1676
1680
  }
@@ -1798,15 +1802,16 @@ class Deva {
1798
1802
  ***************/
1799
1803
  prompt(text) {
1800
1804
  // Talk a global prompt event for the client
1801
- return this.talk('devacore:prompt', {
1802
- id: this.uid(),
1805
+ const _data = {
1806
+ id: this.uid(true),
1803
1807
  key: 'return',
1804
1808
  value: 'prompt',
1805
1809
  agent: this.agent(),
1806
1810
  client: this.client(),
1807
1811
  text,
1808
1812
  created: Date.now(),
1809
- });
1813
+ }
1814
+ return this.talk('devacore:prompt', this.copy(_data));
1810
1815
  }
1811
1816
 
1812
1817
 
@@ -1940,22 +1945,21 @@ class Deva {
1940
1945
  console.log('\n::END:DATA\n');
1941
1946
  }
1942
1947
 
1943
- this.talk('devacore:error', {
1948
+ const _data = {
1944
1949
  id: this.uid(true),
1945
1950
  key: 'return',
1946
1951
  value: 'error',
1947
1952
  agent: this.agent(),
1948
1953
  client: this.client(),
1949
- text: err.toString(),
1954
+ error: err,
1950
1955
  data,
1951
1956
  created: Date.now(),
1952
- });
1957
+ }
1958
+ this.talk('devacore:error', this.copy(_data));
1953
1959
 
1954
1960
  const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
1955
1961
  if (hasOnError) return this.onError(err, data, reject);
1956
- else {
1957
- return reject ? reject(err) : err;
1958
- }
1962
+ else return reject ? reject(err) : err;
1959
1963
  }
1960
1964
 
1961
1965
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.1.43",
3
+ "version": "1.1.45",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {