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