@indra.ai/deva 1.1.117 → 1.1.119

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 (3) hide show
  1. package/config.json +5 -31
  2. package/index.js +13 -62
  3. package/package.json +1 -1
package/config.json CHANGED
@@ -95,7 +95,6 @@
95
95
  "business": "BUSINESS",
96
96
  "legal": "LEGAL",
97
97
  "assistant": "ASSISTANT",
98
- "artist": "ARTIST",
99
98
  "Client": "configure client",
100
99
  "Security": "configure security",
101
100
  "Support": "configure support",
@@ -107,7 +106,6 @@
107
106
  "Legal": "configure legal",
108
107
  "Business": "configure business",
109
108
  "Assistant": "configure assistant",
110
- "Artist": "configure artist",
111
109
  "Done": "configure done",
112
110
  "invalid": "invalid",
113
111
  "states": "getting states",
@@ -128,14 +126,13 @@
128
126
  "development": "Development",
129
127
  "business": "Business",
130
128
  "legal": "Legal",
131
- "assistant": "Assistant",
132
- "artist": "Artist"
129
+ "assistant": "Assistant"
133
130
  },
134
131
  "message": "offline",
135
132
  "messages": {
136
133
  "states": {
134
+ "ready": "ready for task",
137
135
  "offline": "offline",
138
- "online": "online",
139
136
  "ask": "asked a question",
140
137
  "question": "received a question",
141
138
  "answer": "answered the question",
@@ -147,7 +144,6 @@
147
144
  "load": "loading",
148
145
  "unload": "is unloading",
149
146
  "invalid": "seems to be invalid",
150
- "finish": "finish state",
151
147
  "done": "done",
152
148
  "error": "appears to have had an error",
153
149
  "help": "getting help"
@@ -156,14 +152,10 @@
156
152
  "deva": "The Deva Zone",
157
153
  "config": "The Config Zone",
158
154
  "features": "The Features Zone",
159
- "idle": "The Idle Zone",
160
- "training": "The Training Zone",
161
- "school": "The School Zone",
155
+ "learn": "The Learning Zone",
156
+ "personal": "The Personal Zone",
162
157
  "work": "The Work Zone",
163
158
  "danger": "The Danger Zone",
164
- "invalid": "The Invalid Zone",
165
- "done": "The Done Zone",
166
- "error": "The Error Zone",
167
159
  "help": "The Help Zone"
168
160
  },
169
161
  "actions": {
@@ -207,13 +199,10 @@
207
199
  "Legal": "loading the Legal Feature",
208
200
  "assistant": "accessing the #assistant feature",
209
201
  "Assistant": "loading the Assistant Feature",
210
- "artist": "accessing the #artist feature",
211
- "Artist": "loading the Artist Feature",
212
202
  "client_data": "configure client data",
213
203
  "invalid": "invalid action",
214
204
  "finish": "finished",
215
205
  "done": "done",
216
- "error": "error",
217
206
  "help": "providing help",
218
207
  "states": "listing the states",
219
208
  "actions": "listing the actions",
@@ -223,30 +212,15 @@
223
212
  },
224
213
  "features": {
225
214
  "security": "accessing #security feature",
226
- "Security": "Security configure",
227
215
  "support": "accessing #support feature",
228
- "Support": "Support configure",
229
216
  "services": "accessing #services feature",
230
- "Services": "Services configure",
231
217
  "solutions": "solutions feature",
232
- "Solutions": "Solutions configure",
233
218
  "systems": "systems feature",
234
- "Systems": "Systems configure",
235
219
  "research": "research feature",
236
- "Research": "Research configure",
237
220
  "development": "development feature",
238
- "Development": "Development configure",
239
221
  "business": "business feature",
240
- "Business": "Business configure",
241
222
  "legal": "legal feature",
242
- "Legal": "Legal configure",
243
- "assistant": "assistant feature",
244
- "Assistant": "Assistant configure",
245
- "artist": "artist feature",
246
- "Artist": "Artist configure",
247
- "invalid": "feature invalid",
248
- "done": "feature done",
249
- "error": "feature error"
223
+ "assistant": "assistant feature"
250
224
  }
251
225
  }
252
226
  }
package/index.js CHANGED
@@ -26,7 +26,6 @@ class Deva {
26
26
  this._business = false; // inherited Business features.
27
27
  this._legal = false; // inherited Legal features.
28
28
  this._assistant = false; // inherited Assistant features.
29
- this._artist = false; // inherited artist features.
30
29
  this.events = opts.events || new EventEmitter({}); // Event Bus
31
30
  this.lib = opts.lib || {}; // used for loading library functions
32
31
  this.utils = opts.util || {}; // parse function
@@ -213,8 +212,8 @@ class Deva {
213
212
  for (const x in client.features) {
214
213
  const methods = client.features[x].methods || false;
215
214
  if (methods) for (const y in methods) {
216
- const isMethod = typeof methods[y] === 'function' && !this.methods[y];
217
- if (isMethod) this.methods[y] = methods[y].bind(this);
215
+ const isFunc = typeof methods[y] === 'function';
216
+ if (isFunc) this.methods[y] = methods[y].bind(this);
218
217
  }
219
218
  }
220
219
  // console.log('CLINET BEFORE COPY', client);
@@ -514,7 +513,7 @@ class Deva {
514
513
  Assistant() {
515
514
  const _cl = this.client(); // set the client into a local variable
516
515
  try {
517
- if (!_cl.features.assistant) return this.Artist(); // if no Assistant then goto Done
516
+ if (!_cl.features.assistant) return this.Done(); // if no Assistant then goto Done
518
517
  else {
519
518
  this.action('Assistant'); // set action to Assistant
520
519
  const {id, features, profile} = _cl; // set the local consts from client copy
@@ -528,38 +527,7 @@ class Deva {
528
527
  personal: assistant.devas[this._agent.key] // Client personal features and rules.
529
528
  };
530
529
  delete this._client.features.assistant; // delete the assistant key from client features
531
- return this.Artist(); // when assistant is done goto Artist.
532
- }
533
- } catch (e) {
534
- return this.error(e); // run error handling if an error is caught
535
- }
536
- }
537
-
538
- /**************
539
- func: Artist
540
- params: client: false
541
- describe:
542
- The Artist feature sets the correct variables and necessary rules for the
543
- client presented data.
544
- ***************/
545
- Artist() {
546
- const _cl = this.client(); // set local client variable
547
- try {
548
- if (!this._client.features.artist) return this.Done(); // if no artist goto Done
549
- else {
550
- this.action('Artist'); // set action to Artist
551
- const {id, features, profile} = this._client; // set the local consts from client copy
552
- const {artist} = features; // set artist from features const
553
- this._artist = { // set this_artist with data
554
- id: this.uid(true), // uuid of the artist feature
555
- client_id: id, // client id for reference
556
- client_name: profile.name, // client name for personalization
557
- concerns: artist.concerns, // any concerns for client
558
- global: artist.global, // the global policies for client
559
- personal: artist.devas[this._agent.key], // Client personal features and rules.
560
- };
561
- delete this._client.features.artist; // delete artist object from client
562
- return this.Done(); // when done with artist goto Done
530
+ return this.Done(); // when assistant is done goto Done.
563
531
  }
564
532
  } catch (e) {
565
533
  return this.error(e); // run error handling if an error is caught
@@ -981,7 +949,6 @@ class Deva {
981
949
  data.hash = this.hash(data);
982
950
  this.action(data.value)
983
951
  const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
984
- this.state('online');
985
952
  return hasOnDone ? this.onDone(data) : Promise.resolve(data);
986
953
  }
987
954
 
@@ -999,9 +966,10 @@ class Deva {
999
966
  finish(packet, resolve) {
1000
967
  if (!this._active) return Promise.resolve(this._messages.states.offline);
1001
968
  this.action('finish');
1002
- this.state('online');
1003
969
  packet.hash = this.hash(packet);// hash the entire packet before finishing.
1004
970
  const hasOnFinish = this.onFinish && typeof this.onFinish === 'function' ? true : false;
971
+
972
+ this.state('ready');
1005
973
  if (hasOnFinish) return this.onFinish(packet, resolve);
1006
974
  else if (resolve) return resolve(packet);
1007
975
  else return Promise.resolve(packet)
@@ -1072,7 +1040,7 @@ class Deva {
1072
1040
  this._business = false;
1073
1041
  this._development = false;
1074
1042
  this._legal = false;
1075
- this._artist = false;
1043
+ this._assistant = false;
1076
1044
 
1077
1045
  this.action(data.value);
1078
1046
  const hasOnExit = this.onExit && typeof this.onExit === 'function';
@@ -1428,22 +1396,6 @@ class Deva {
1428
1396
  }
1429
1397
  }
1430
1398
 
1431
- /**************
1432
- func: assistant
1433
- params: opts
1434
- describe: basic assistant features available in a Deva.
1435
- ***************/
1436
- assistant(opts) {
1437
- if (!this._active) return this._messages.states.offline; // chek the active status
1438
- this.feature('assistant'); // set the assistant state
1439
- try {
1440
- this.action('assistant'); // set the assistant state
1441
- return this.copy(this._assistant); // return assistant feature
1442
- } catch (e) {
1443
- return this.error(e);
1444
- }
1445
- }
1446
-
1447
1399
  /**************
1448
1400
  func: business
1449
1401
  params: opts
@@ -1477,16 +1429,16 @@ class Deva {
1477
1429
  }
1478
1430
 
1479
1431
  /**************
1480
- func: artist
1432
+ func: assistant
1481
1433
  params: opts
1482
- describe: basic artist features available in a Deva.
1434
+ describe: basic assistant features available in a Deva.
1483
1435
  ***************/
1484
- artist(opts) {
1436
+ assistant(opts) {
1485
1437
  if (!this._active) return this._messages.states.offline; // chek the active status
1486
- this.feature('artist'); // set the artist state
1438
+ this.feature('assistant'); // set the assistant state
1487
1439
  try {
1488
- this.action('artist');
1489
- return this.artist(this._artist); // return artist feature
1440
+ this.action('assistant'); // set the assistant state
1441
+ return this.copy(this._assistant); // return assistant feature
1490
1442
  } catch (e) {
1491
1443
  return this.error(e);
1492
1444
  }
@@ -1863,7 +1815,6 @@ class Deva {
1863
1815
  created: Date.now(),
1864
1816
  }
1865
1817
  this.talk(config.events.error, this.copy(_data));
1866
-
1867
1818
  const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
1868
1819
  if (hasOnError) return this.onError(err, data, reject);
1869
1820
  else return reject ? reject(err) : err;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.1.117",
3
+ "version": "1.1.119",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "scripts": {