@indra.ai/deva.vector 0.0.32 → 0.0.34
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 +62 -58
- package/package.json +2 -2
package/feature/methods.js
CHANGED
|
@@ -5,63 +5,67 @@ export default {
|
|
|
5
5
|
},
|
|
6
6
|
|
|
7
7
|
async echo(key, type, packet) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
8
|
+
let echo_data = false;
|
|
9
|
+
try {
|
|
10
|
+
const {id, agent, client, text, created, md5, sha256, sha512} = packet[type];
|
|
11
|
+
|
|
12
|
+
this.state('set', `${key}:echo:${type}:time:${id}`);
|
|
13
|
+
const echo_time = Date.now();
|
|
14
|
+
|
|
15
|
+
this.action('func', `${key}:echo:${type}:${id}`);
|
|
16
|
+
|
|
17
|
+
this.state('hash', `${key}:echo:${type}:hash:message:${id}`);
|
|
18
|
+
const message_hash = this.lib.hash(text || 'blank', 'sha256');
|
|
19
|
+
|
|
20
|
+
// hash the agent profile for security
|
|
21
|
+
this.state('hash', `${key}:echo:${type}:packet:sha256:${id}`);
|
|
22
|
+
const packet_hash = this.lib.hash(packet, 'sha256');
|
|
23
|
+
|
|
24
|
+
this.state('hash', `${key}:echo:${type}:hash:agent:${id}`);
|
|
25
|
+
const agent_hash = this.lib.hash(agent, 'sha256');
|
|
26
|
+
|
|
27
|
+
this.state('hash', `${key}:echo:${type}:hash:client:${id}`);
|
|
28
|
+
const client_hash = this.lib.hash(client, 'sha256');
|
|
29
|
+
|
|
30
|
+
this.state('set', `${key}:echo:${type}:keystr:${id}`);
|
|
31
|
+
const keystr = `${key.toUpperCase()}:${type.toUpperCase()}:${id}`;
|
|
32
|
+
|
|
33
|
+
this.state('set', `${key}:echo:${type}:data:${id}`);
|
|
34
|
+
echo_data = [
|
|
35
|
+
`::::`,
|
|
36
|
+
`::BEGIN:${keystr}`,
|
|
37
|
+
`key: ${key}`,
|
|
38
|
+
`type: ${type}`,
|
|
39
|
+
`transport: ${id}`,
|
|
40
|
+
`created: ${created}`,
|
|
41
|
+
`echo: ${echo_time}`,
|
|
42
|
+
`message: ${message_hash}`,
|
|
43
|
+
`agent: ${agent_hash}`,
|
|
44
|
+
`client: ${client_hash}`,
|
|
45
|
+
`packet: ${packet_hash}`,
|
|
46
|
+
`md5: ${md5}`,
|
|
47
|
+
`sha256:${sha256}`,
|
|
48
|
+
`sha512:${sha512}`,
|
|
49
|
+
`::END:${keystr}`,
|
|
50
|
+
'::::',
|
|
51
|
+
].join('\n');
|
|
52
|
+
|
|
53
|
+
// stub for later features right now just echo into the system process for SIGINT monitoring.
|
|
54
|
+
const echo = this.lib.spawn('echo', [echo_data])
|
|
55
|
+
echo.stdout.on('data', data => {
|
|
56
|
+
this.state('data', `${key}:echo:${type}:stdout:${id}`);
|
|
57
|
+
});
|
|
58
|
+
echo.stderr.on('data', err => {
|
|
59
|
+
this.state('error', `${key}:echo:${type}:stderr:${id}`);
|
|
60
|
+
this.error(err, opts);
|
|
61
|
+
});
|
|
62
|
+
echo.on('close', data => {
|
|
63
|
+
this.state('close', `${key}:echo:${type}:close:${id}`);
|
|
64
|
+
});
|
|
65
|
+
this.state('return', `${key}:echo:${type}:return:${id}`);
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
return echo_data;
|
|
69
|
+
}
|
|
66
70
|
}
|
|
67
71
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "47853658710534513323",
|
|
3
3
|
"name": "@indra.ai/deva.vector",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.34",
|
|
5
5
|
"license": "VLA:55542255017902542863 LICENSE.md",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Quinn A Michaels",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://deva.space/devas/vector",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@indra.ai/deva": "^1.6.
|
|
45
|
+
"@indra.ai/deva": "^1.6.38"
|
|
46
46
|
},
|
|
47
47
|
"data": {
|
|
48
48
|
"agent": {
|