@indra.ai/deva 1.56.4 → 1.57.0
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.
- package/config/index.js +1 -0
- package/index.js +31 -10
- package/package.json +1 -1
package/config/index.js
CHANGED
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ class Deva {
|
|
|
18
18
|
this._id = opts.id || randomUUID(); // the unique id assigned to the agent at load
|
|
19
19
|
this._info = opts.info || false; // the deva information from the package file.
|
|
20
20
|
this._config = opts.config || {}; // local Config Object
|
|
21
|
+
this._config.hashes = config.hashes; // set hashes array from config for stamping.
|
|
21
22
|
this._config.ready_hash = config.ready_hash; // items to hash at ready
|
|
22
23
|
this._config.timeout = {...config.timeout, ...this._config.timeout}; // add timeout values to _config.
|
|
23
24
|
|
|
@@ -405,6 +406,34 @@ class Deva {
|
|
|
405
406
|
return next_key ? this[next_key](data, resolve) : resolve(data);
|
|
406
407
|
}
|
|
407
408
|
|
|
409
|
+
/**************
|
|
410
|
+
func: _stamp
|
|
411
|
+
params:
|
|
412
|
+
- data: the data to stamp
|
|
413
|
+
- label: the label for the hash action.
|
|
414
|
+
describe: the stamp function will take a data object and apply the hashes from the this._config.hashes array.
|
|
415
|
+
usage: this._stamp(data, 'value')
|
|
416
|
+
***************/
|
|
417
|
+
_stamp(data, label='', uid='') {
|
|
418
|
+
for (const algo of this._config.hashes) {
|
|
419
|
+
if (label) this.action('hash', `${label}:${algo}:${uid}`);
|
|
420
|
+
data[algo] = this.hash(data, algo);
|
|
421
|
+
}
|
|
422
|
+
return data;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**************
|
|
426
|
+
func: _unstamp
|
|
427
|
+
params:
|
|
428
|
+
- data: the data to unstamp
|
|
429
|
+
describe: the unstamp function will take a data object and remove the hashes over the this._hashes array.
|
|
430
|
+
usage: this._unstamp(data)
|
|
431
|
+
***************/
|
|
432
|
+
_unstamp(data) {
|
|
433
|
+
for (const algo of this._config.hashes) delete data[algo];
|
|
434
|
+
return data;
|
|
435
|
+
}
|
|
436
|
+
|
|
408
437
|
/**************
|
|
409
438
|
func: Client
|
|
410
439
|
params: client - client provided data.
|
|
@@ -845,16 +874,8 @@ class Deva {
|
|
|
845
874
|
created: Date.now(), // timestamp the question
|
|
846
875
|
}
|
|
847
876
|
|
|
848
|
-
//
|
|
849
|
-
|
|
850
|
-
this.action('hash', `${method}:md5:${id.uid}`);
|
|
851
|
-
packet.q.md5 = this.hash(packet.q, 'md5');
|
|
852
|
-
|
|
853
|
-
this.action('hash', `${method}:sha256:${id.uid}`)
|
|
854
|
-
packet.q.sha256 = this.hash(packet.q, 'sha256');
|
|
855
|
-
|
|
856
|
-
this.action('hash', `${method}:sha512:${id.uid}`)
|
|
857
|
-
packet.q.sha512 = this.hash(packet.q, 'sha512');
|
|
877
|
+
// stamp the question
|
|
878
|
+
packet.q = this._stamp(packet.q, method, id.uid);
|
|
858
879
|
|
|
859
880
|
this.action('talk', `${this._events.question}:${id.uid}`);
|
|
860
881
|
this.intent('good', `${this._events.question}:${id.uid}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "23221940810208468106",
|
|
3
3
|
"name": "@indra.ai/deva",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.57.0",
|
|
5
5
|
"description": "Deva Core a Vedic-inspired Event Based Context Aware Feature, Zone, Action, and State Machine integrated Artificial Intelligence Framework",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "VLA:23221940810208468106 LICENSE.md",
|