@indra.ai/deva.vector 0.0.4 → 0.0.5
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/feature/methods.js +51 -0
- package/index.js +22 -16
- package/package.json +11 -11
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
/**************
|
|
3
|
+
method: Guard
|
|
4
|
+
params: packet
|
|
5
|
+
describe: The global service feature that installs with every agent
|
|
6
|
+
***************/
|
|
7
|
+
vector(packet) {
|
|
8
|
+
this.context('feature');
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const guard = this.guard();
|
|
11
|
+
const agent = this.agent();
|
|
12
|
+
const global = [];
|
|
13
|
+
guard.global.forEach((item,index) => {
|
|
14
|
+
global.push(`::begin:global:${item.key}:${item.id}`);
|
|
15
|
+
for (let x in item) {
|
|
16
|
+
global.push(`${x}: ${item[x]}`);
|
|
17
|
+
}
|
|
18
|
+
global.push(`::end:global:${item.key}:${this.lib.hash(item)}`);
|
|
19
|
+
});
|
|
20
|
+
const concerns = [];
|
|
21
|
+
guard.concerns.forEach((item, index) => {
|
|
22
|
+
concerns.push(`${index + 1}. ${item}`);
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const info = [
|
|
26
|
+
`::BEGIN:VECTOR:${packet.id}`,
|
|
27
|
+
'### Client',
|
|
28
|
+
`::begin:client:${guard.client_id}`,
|
|
29
|
+
`id: ${guard.client_id}`,
|
|
30
|
+
`client: ${guard.client_name}`,
|
|
31
|
+
'**concerns**',
|
|
32
|
+
concerns.join('\n'),
|
|
33
|
+
`::end:client:${this.lib.hash(guard)}`,
|
|
34
|
+
'### Global',
|
|
35
|
+
global.join('\n'),
|
|
36
|
+
`date: ${this.lib.formatDate(Date.now(), 'long', true)}`,
|
|
37
|
+
`::END:VECTOR:${this.lib.hash(packet)}`,
|
|
38
|
+
].join('\n');
|
|
39
|
+
this.question(`${this.askChr}feecting parse ${info}`).then(feecting => {
|
|
40
|
+
return resolve({
|
|
41
|
+
text: feecting.a.text,
|
|
42
|
+
html: feecting.a.html,
|
|
43
|
+
data: guard.concerns,
|
|
44
|
+
});
|
|
45
|
+
}).catch(err => {
|
|
46
|
+
return this.error(err, packet, reject);
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
};
|
package/index.js
CHANGED
|
@@ -37,23 +37,23 @@ const VECTOR = new Deva({
|
|
|
37
37
|
},
|
|
38
38
|
listeners: {
|
|
39
39
|
'devacore:question'(packet) {
|
|
40
|
-
this.func.
|
|
40
|
+
this.func.echo(packet.q);
|
|
41
41
|
},
|
|
42
42
|
'devacore:answer'(packet) {
|
|
43
|
-
this.func.
|
|
43
|
+
this.func.echo(packet.a);
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
modules: {},
|
|
47
47
|
devas: {},
|
|
48
48
|
func: {
|
|
49
|
-
|
|
49
|
+
echo(opts) {
|
|
50
50
|
const {id, agent, client, md5, sha256, sha512} = opts;
|
|
51
51
|
const created = Date.now();
|
|
52
|
-
|
|
53
|
-
this.action('func', `
|
|
54
|
-
this.state('set', `
|
|
55
|
-
const
|
|
56
|
-
`::begin:
|
|
52
|
+
|
|
53
|
+
this.action('func', `echo:${id}`);
|
|
54
|
+
this.state('set', `echo:${id}`);
|
|
55
|
+
const echo_data = [
|
|
56
|
+
`::begin:guard:${id}`,
|
|
57
57
|
`transport: ${id}`,
|
|
58
58
|
`client: ${client.profile.id}`,
|
|
59
59
|
`agent: ${agent.profile.id}`,
|
|
@@ -61,18 +61,24 @@ const VECTOR = new Deva({
|
|
|
61
61
|
`md5: ${md5}`,
|
|
62
62
|
`sha256:${sha256}`,
|
|
63
63
|
`sha512:${sha512}`,
|
|
64
|
-
`::end:
|
|
65
|
-
].join('\
|
|
66
|
-
|
|
64
|
+
`::end:guard:${id}`,
|
|
65
|
+
].join('\n');
|
|
66
|
+
|
|
67
67
|
// stub for later features right now just echo into the system process for SIGINT monitoring.
|
|
68
|
-
const echo = spawn('echo', [
|
|
68
|
+
const echo = spawn('echo', [echo_data])
|
|
69
|
+
echo.stdout.on('data', data => {
|
|
70
|
+
this.state('data', `echo:stdout:${id}`);
|
|
71
|
+
});
|
|
69
72
|
echo.stderr.on('data', err => {
|
|
73
|
+
this.state('error', `echo:stderr:${id}`);
|
|
70
74
|
this.error(err, opts);
|
|
71
75
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
echo.on('close', data => {
|
|
77
|
+
this.state('close', `echo:${id}`);
|
|
78
|
+
});
|
|
79
|
+
this.state('return', `echo:${id}`);
|
|
80
|
+
return echo_data;
|
|
81
|
+
}
|
|
76
82
|
},
|
|
77
83
|
methods: {},
|
|
78
84
|
onReady(data, resolve) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "33555f8a-707d-4fc9-ae19-ba09036473d4",
|
|
3
3
|
"name": "@indra.ai/deva.vector",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"author": "Quinn Michaels",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"copyright": "2025",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"bugs": {
|
|
27
27
|
"url": "https://github.com/indraai/deva.vector/issues"
|
|
28
28
|
},
|
|
29
|
-
"homepage": "https://deva.space/devas/
|
|
29
|
+
"homepage": "https://deva.space/devas/vector",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@indra.ai/deva": "^1.5.
|
|
31
|
+
"@indra.ai/deva": "^1.5.45"
|
|
32
32
|
},
|
|
33
33
|
"data": {
|
|
34
34
|
"agent": {
|
|
@@ -94,14 +94,14 @@
|
|
|
94
94
|
"history": []
|
|
95
95
|
},
|
|
96
96
|
"context": {
|
|
97
|
-
"uid": "
|
|
98
|
-
"status": "
|
|
99
|
-
"help": "
|
|
100
|
-
"artist": "
|
|
101
|
-
"live": "
|
|
102
|
-
"ask": "
|
|
103
|
-
"reply": "
|
|
104
|
-
"comment": "
|
|
97
|
+
"uid": "Vector is creating a uid",
|
|
98
|
+
"status": "Vector is viewing the status",
|
|
99
|
+
"help": "Vector is viewing the help",
|
|
100
|
+
"artist": "Vector creating",
|
|
101
|
+
"live": "Vector livechat",
|
|
102
|
+
"ask": "Vector asking",
|
|
103
|
+
"reply": "Vector reply",
|
|
104
|
+
"comment": "Vector comment"
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|