@indra.ai/deva.psychology 0.0.3 → 0.1.1
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/index.js +32 -7
- package/index.test.js +9 -9
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Legal Signature Required For Lawful Use.
|
|
4
4
|
// Distributed under VLA:65628177162971409215 LICENSE.md
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// Psychology Deva
|
|
7
7
|
import Deva from '@indra.ai/deva';
|
|
8
8
|
|
|
9
9
|
import pkg from './package.json' with {type:'json'};
|
|
@@ -41,12 +41,37 @@ const PSYCHOLOGY = new Deva({
|
|
|
41
41
|
listeners: {},
|
|
42
42
|
modules: {},
|
|
43
43
|
func: {
|
|
44
|
-
async
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
44
|
+
async aspect(opts) {
|
|
45
|
+
const estr = `aspect:${opts.type}:${opts.key}:${opts.packet.id.uid}`;
|
|
46
|
+
this.context(opts.key, opts.packet.id.uid);
|
|
47
|
+
this.action('func', estr);
|
|
48
|
+
|
|
49
|
+
const {key, name, warning} = this.vars[opts.type][opts.key];
|
|
50
|
+
|
|
51
|
+
this.vars.status = key;
|
|
52
|
+
this.vars.warning = warning;
|
|
53
|
+
this.state('await', estr);
|
|
54
|
+
const uid = await this.methods.uid(opts.packet);
|
|
55
|
+
|
|
56
|
+
this.vars.status = false;
|
|
57
|
+
this.vars.warning = false;
|
|
58
|
+
|
|
59
|
+
this.action('return', estr); // set action return
|
|
60
|
+
this.state('valid', estr);
|
|
61
|
+
this.intent('good', estr);
|
|
62
|
+
return uid;
|
|
63
|
+
},
|
|
64
|
+
async router(type, packet) {
|
|
65
|
+
const key = packet.q.meta.params.pop();
|
|
66
|
+
const estr = `router:${type}:${key}:${packet.id.uid}`;
|
|
67
|
+
this.context(type, packet.id.uid);
|
|
68
|
+
this.action('func', estr);
|
|
69
|
+
|
|
70
|
+
const opts = {key, type, packet};
|
|
71
|
+
this.action('return', estr); // set action return
|
|
72
|
+
this.state('await', `${key}:router:${packet.id.uid}`); // set action return
|
|
73
|
+
return await this.func.aspect(opts);
|
|
74
|
+
}
|
|
50
75
|
},
|
|
51
76
|
methods: {
|
|
52
77
|
async sound(packet) {
|
package/index.test.js
CHANGED
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
// Distributed under VLA:65628177162971409215 LICENSE.md
|
|
5
5
|
|
|
6
6
|
const {expect} = require('chai')
|
|
7
|
-
const
|
|
7
|
+
const PsychologyDeva = require('./index.js');
|
|
8
8
|
|
|
9
|
-
describe(
|
|
9
|
+
describe(PsychologyDeva.me.name, () => {
|
|
10
10
|
beforeEach(() => {
|
|
11
|
-
return
|
|
11
|
+
return PsychologyDeva.init()
|
|
12
12
|
});
|
|
13
13
|
it('Check the DEVA Object', () => {
|
|
14
|
-
expect(
|
|
15
|
-
expect(
|
|
16
|
-
expect(
|
|
17
|
-
expect(
|
|
18
|
-
expect(
|
|
19
|
-
expect(
|
|
14
|
+
expect(PsychologyDeva).to.be.an('object');
|
|
15
|
+
expect(PsychologyDeva).to.have.property('agent');
|
|
16
|
+
expect(PsychologyDeva).to.have.property('vars');
|
|
17
|
+
expect(PsychologyDeva).to.have.property('listeners');
|
|
18
|
+
expect(PsychologyDeva).to.have.property('methods');
|
|
19
|
+
expect(PsychologyDeva).to.have.property('modules');
|
|
20
20
|
});
|
|
21
21
|
})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "61310845502578190771",
|
|
3
3
|
"name": "@indra.ai/deva.psychology",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"license": "VLA:61310845502578190771 LICENSE.md",
|
|
6
6
|
"VLA": {
|
|
7
7
|
"uid": "61310845502578190771",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"homepage": "https://indra.ai",
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@indra.ai/deva": "^1.
|
|
62
|
+
"@indra.ai/deva": "^1.21.1"
|
|
63
63
|
},
|
|
64
64
|
"data": {
|
|
65
65
|
"agent": {
|