@indra.ai/deva 1.4.7 → 1.4.8

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 +16 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1079,14 +1079,16 @@ class Deva {
1079
1079
  actions() {
1080
1080
  this.action('func', 'actions');
1081
1081
  this.state('return', 'actions');
1082
- return {
1082
+ const data = {
1083
1083
  id: this.lib.uid(), // set the id with a uuid
1084
1084
  agent: this.agent(), // set the agent value
1085
1085
  client: this.client(), // set the client value
1086
1086
  key: 'actions', // set the data key
1087
1087
  value: this._actions, // set the value to the actions list
1088
- created: Date.now(), // set the data created date
1089
- }
1088
+ created: Date.now(), // set the data created date
1089
+ };
1090
+ data.hash = this.lib.hash(data)
1091
+ return data;
1090
1092
  }
1091
1093
 
1092
1094
  /**************
@@ -1126,14 +1128,16 @@ class Deva {
1126
1128
  ***************/
1127
1129
  features() {
1128
1130
  this.state('return', 'features');
1129
- return { // return the data object
1131
+ const data = {
1130
1132
  id: this.lib.uid(), // set the object id
1131
1133
  agent: this.agent(), // set the agent value.
1132
1134
  client: this.client(), // set the client value.
1133
1135
  key: 'features', // set the key
1134
1136
  value: this._features, // set the value to the features list
1135
1137
  created: Date.now(), // set the created date.
1136
- }
1138
+ };
1139
+ data.hash = this.lib.hash(data);
1140
+ return data;
1137
1141
  }
1138
1142
 
1139
1143
  /**************
@@ -1159,7 +1163,6 @@ class Deva {
1159
1163
  text,
1160
1164
  created: Date.now(),
1161
1165
  };
1162
-
1163
1166
  data.hash = this.lib.hash(data);
1164
1167
  this.talk(config.events.context, data);
1165
1168
  return data;
@@ -1427,6 +1430,7 @@ class Deva {
1427
1430
  text,
1428
1431
  created: Date.now(),
1429
1432
  }
1433
+ _data.hash = this.lib.hash(_data);
1430
1434
  return this.talk(config.events.prompt, _data);
1431
1435
  }
1432
1436
 
@@ -1519,10 +1523,15 @@ class Deva {
1519
1523
  value: agent.key,
1520
1524
  agent,
1521
1525
  client,
1522
- error: err,
1526
+ error: {
1527
+ name: err.name,
1528
+ message: err.message,
1529
+ stack: err.stack,
1530
+ },
1523
1531
  data,
1524
1532
  created: Date.now(),
1525
1533
  }
1534
+ _data.hash = this.lib.hash(_data);
1526
1535
  this.talk(config.events.error, this.lib.copy(_data));
1527
1536
  const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
1528
1537
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "type": "module",