@indra.ai/deva.wall 0.0.4 → 0.0.6
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 -33
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -37,47 +37,46 @@ const WALL = new Deva({
|
|
|
37
37
|
},
|
|
38
38
|
listeners: {
|
|
39
39
|
'devacore:question'(packet) {
|
|
40
|
-
|
|
41
|
-
const sha256 = this.lib.hash(packet, 'sha256');
|
|
42
|
-
const sha512 = this.lib.hash(packet, 'sha512');
|
|
43
|
-
const echostr = `transport: ${packet.id} md5:${md5} | sha256:${sha256} | sha512:${sha512} | created:${packet.created}`;
|
|
44
|
-
// stub for later features right now just echo into the system process for SIGINT monitoring.
|
|
45
|
-
exec(`echo "${echostr}"`, (error, stdout, stderr) => {
|
|
46
|
-
if (error) {
|
|
47
|
-
console.log('error', error);
|
|
48
|
-
}
|
|
49
|
-
else if (stderr) {
|
|
50
|
-
console.log('stderr', stderr);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
40
|
+
this.func.echostr(packet.q);
|
|
53
41
|
},
|
|
54
42
|
'devacore:answer'(packet) {
|
|
55
|
-
|
|
56
|
-
const sha256 = this.lib.hash(packet, 'sha256');
|
|
57
|
-
const sha512 = this.lib.hash(packet, 'sha512');
|
|
58
|
-
const echostr = `transport: ${packet.id} md5:${md5} | sha256:${sha256} | sha512:${sha512} | created:${packet.created}`;
|
|
59
|
-
// stub for later features right now just echo into the system process for SIGINT monitoring.
|
|
60
|
-
exec(`echo "${echostr}"`, (error, stdout, stderr) => {
|
|
61
|
-
if (error) {
|
|
62
|
-
console.log('error', error);
|
|
63
|
-
}
|
|
64
|
-
else if (stderr) {
|
|
65
|
-
console.log('stderr', stderr);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
43
|
+
this.func.echostr(packet.a);
|
|
68
44
|
}
|
|
69
45
|
},
|
|
70
46
|
modules: {},
|
|
71
47
|
devas: {},
|
|
72
|
-
func: {
|
|
48
|
+
func: {
|
|
49
|
+
echostr(opts) {
|
|
50
|
+
const {id, agent, client, md5, sha256, sha512} = opts;
|
|
51
|
+
const created = Date.now();
|
|
52
|
+
|
|
53
|
+
this.action('func', `echostr:${id}`);
|
|
54
|
+
this.state('set', `echostr:${id}`);
|
|
55
|
+
const echostr = [
|
|
56
|
+
`::begin:wall:${id}`,
|
|
57
|
+
`transport: ${id}`,
|
|
58
|
+
`client: ${client.profile.id}`,
|
|
59
|
+
`agent: ${agent.profile.id}`,
|
|
60
|
+
`created: ${created}`,
|
|
61
|
+
`md5: ${md5}`,
|
|
62
|
+
`sha256:${sha256}`,
|
|
63
|
+
`sha512:${sha512}`,
|
|
64
|
+
`::end:wall:${id}`,
|
|
65
|
+
].join('\n');
|
|
66
|
+
|
|
67
|
+
// stub for later features right now just echo into the system process for SIGINT monitoring.
|
|
68
|
+
const echo = spawn('echo', [echostr])
|
|
69
|
+
echo.stderr.on('data', err => {
|
|
70
|
+
this.error(err, opts);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
this.state('return', `echostr:${id}`);
|
|
74
|
+
return echostr;
|
|
75
|
+
}
|
|
76
|
+
},
|
|
73
77
|
methods: {},
|
|
74
78
|
onReady(data, resolve) {
|
|
75
|
-
this.prompt(this.vars.messages.ready);
|
|
76
|
-
this.vars.userinfo = this.lib.os.userInfo();
|
|
77
|
-
|
|
78
|
-
console.log('userinfo', this.vars.userinfo);
|
|
79
|
-
return resolve(data);
|
|
80
|
-
|
|
79
|
+
this.prompt(this.vars.messages.ready);
|
|
81
80
|
},
|
|
82
81
|
onError(data, err, reject) {
|
|
83
82
|
this.prompt(this.vars.messages.error);
|