@indra.ai/deva.wall 0.0.3 → 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/index.js +33 -12
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -37,22 +37,43 @@ const WALL = new Deva({
|
|
|
37
37
|
},
|
|
38
38
|
listeners: {
|
|
39
39
|
'devacore:question'(packet) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (error) {
|
|
45
|
-
console.log('error', error);
|
|
46
|
-
}
|
|
47
|
-
else if (stderr) {
|
|
48
|
-
console.log('stderr', stderr);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
40
|
+
this.func.echostr(packet.q);
|
|
41
|
+
},
|
|
42
|
+
'devacore:answer'(packet) {
|
|
43
|
+
this.func.echostr(packet.a);
|
|
51
44
|
}
|
|
52
45
|
},
|
|
53
46
|
modules: {},
|
|
54
47
|
devas: {},
|
|
55
|
-
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
|
+
},
|
|
56
77
|
methods: {},
|
|
57
78
|
onReady(data, resolve) {
|
|
58
79
|
this.prompt(this.vars.messages.ready);
|