@indra.ai/deva 1.5.2 → 1.5.4

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 +9 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1191,8 +1191,10 @@ class Deva {
1191
1191
  describe
1192
1192
  ***************/
1193
1193
  context(value=false, extra=false) {
1194
+ this.state('try', `context:${value}`);
1194
1195
  try {
1195
1196
  if (!value) return;
1197
+ this.state('set', `context:${value}`);
1196
1198
  this._context = value;
1197
1199
  const lookup = this.vars.context[value] || value;
1198
1200
  const text = extra ? `${lookup} ${extra}` : lookup;
@@ -1208,9 +1210,11 @@ class Deva {
1208
1210
  };
1209
1211
  data.hash = this.lib.hash(data);
1210
1212
  this.talk(config.events.context, data);
1213
+ this.state('return', `context:${value}:${data.id}`);
1211
1214
  return data;
1212
1215
  } catch (e) {
1213
- return this.error(e);
1216
+ this.state('catch', `context:${value}`);
1217
+ return this.error(e, value);
1214
1218
  }
1215
1219
  }
1216
1220
 
@@ -1392,7 +1396,6 @@ class Deva {
1392
1396
  });
1393
1397
  }
1394
1398
 
1395
-
1396
1399
  /**************
1397
1400
  func: prompt
1398
1401
  params:
@@ -1419,11 +1422,6 @@ class Deva {
1419
1422
  return this.talk(config.events.prompt, _data);
1420
1423
  }
1421
1424
 
1422
-
1423
-
1424
-
1425
-
1426
-
1427
1425
  /**************
1428
1426
  func: core
1429
1427
  params: none
@@ -1486,9 +1484,9 @@ class Deva {
1486
1484
  help(msg, help_dir) {
1487
1485
  return new Promise((resolve, reject) => {
1488
1486
  if (!this._active) return resolve(this._messages.offline);
1489
- const params = msg.split(' ');
1490
- let helpFile = 'main';
1491
- if (params[0]) helpFile = params[0];
1487
+ const params = msg.split(' '); // split the msg into an array by spaces.
1488
+ let helpFile = 'main'; // set default help file
1489
+ if (params[0]) helpFile = params[0]; // check the msg for a help file
1492
1490
  if (params[1]) helpFile = `${params[0]}_${params[1]}`;
1493
1491
 
1494
1492
  this.context('help', helpFile);
@@ -1500,7 +1498,7 @@ class Deva {
1500
1498
  const helpPath = this.lib.path.join(help_dir, 'help', `${helpFile}.feecting`);
1501
1499
  this.state('try', `help:${helpFile}`);
1502
1500
  try {
1503
- const helpExists = this.lib.fs.existsSync(helpPath);
1501
+ const helpExists = this.lib.fs.existsSync(helpPath); // check if help file exists
1504
1502
  if (!helpExists) return this.finish(this._messages.help_not_found, resolve);
1505
1503
  const helpDoc = this.lib.fs.readFileSync(helpPath, 'utf8');
1506
1504
  this.state('finish', `help:${helpFile}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "copyright": "(c)2025 Quinn Michaels; All rights reserved.",