@indra.ai/deva.vector 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/LICENSE +1 -1
- package/README.md +2 -4
- package/feature/methods.js +51 -0
- package/index.js +44 -21
- package/package.json +8 -8
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -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
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Copyright (c)2025 Quinn Michaels
|
|
2
|
-
//
|
|
2
|
+
// Vector Deva
|
|
3
3
|
|
|
4
4
|
import Deva from '@indra.ai/deva';
|
|
5
5
|
import pkg from './package.json' with {type:'json'};
|
|
6
6
|
const {agent,vars} = pkg.data;
|
|
7
7
|
|
|
8
8
|
import {exec, spawn} from 'node:child_process';
|
|
9
|
+
|
|
9
10
|
// set the __dirname
|
|
10
11
|
import {dirname} from 'node:path';
|
|
11
12
|
import {fileURLToPath} from 'node:url';
|
|
@@ -25,7 +26,7 @@ const info = {
|
|
|
25
26
|
copyright: pkg.copyright
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
const
|
|
29
|
+
const VECTOR = new Deva({
|
|
29
30
|
info,
|
|
30
31
|
agent,
|
|
31
32
|
vars,
|
|
@@ -36,31 +37,53 @@ const WALL = new Deva({
|
|
|
36
37
|
},
|
|
37
38
|
listeners: {
|
|
38
39
|
'devacore:question'(packet) {
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const result = stdout.split('\n');
|
|
44
|
-
if (error) {
|
|
45
|
-
console.log('error', error);
|
|
46
|
-
}
|
|
47
|
-
else if (stderr) {
|
|
48
|
-
console.log('stderr', stderr);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
40
|
+
this.func.echo(packet.q);
|
|
41
|
+
},
|
|
42
|
+
'devacore:answer'(packet) {
|
|
43
|
+
this.func.echo(packet.a);
|
|
51
44
|
}
|
|
52
45
|
},
|
|
53
46
|
modules: {},
|
|
54
47
|
devas: {},
|
|
55
|
-
func: {
|
|
48
|
+
func: {
|
|
49
|
+
echo(opts) {
|
|
50
|
+
const {id, agent, client, md5, sha256, sha512} = opts;
|
|
51
|
+
const created = Date.now();
|
|
52
|
+
|
|
53
|
+
this.action('func', `echo:${id}`);
|
|
54
|
+
this.state('set', `echo:${id}`);
|
|
55
|
+
const echo_data = [
|
|
56
|
+
`::begin:guard:${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:guard:${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', [echo_data])
|
|
69
|
+
echo.stdout.on('data', data => {
|
|
70
|
+
this.state('data', `echo:stdout:${id}`);
|
|
71
|
+
});
|
|
72
|
+
echo.stderr.on('data', err => {
|
|
73
|
+
this.state('error', `echo:stderr:${id}`);
|
|
74
|
+
this.error(err, opts);
|
|
75
|
+
});
|
|
76
|
+
echo.on('close', data => {
|
|
77
|
+
this.state('close', `echo:${id}`);
|
|
78
|
+
});
|
|
79
|
+
this.state('return', `echo:${id}`);
|
|
80
|
+
return echo_data;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
56
83
|
methods: {},
|
|
57
84
|
onReady(data, resolve) {
|
|
58
85
|
this.prompt(this.vars.messages.ready);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
console.log('userinfo', this.vars.userinfo);
|
|
62
|
-
return resolve(data);
|
|
63
|
-
|
|
86
|
+
return resolve(data);
|
|
64
87
|
},
|
|
65
88
|
onError(data, err, reject) {
|
|
66
89
|
this.prompt(this.vars.messages.error);
|
|
@@ -68,5 +91,5 @@ const WALL = new Deva({
|
|
|
68
91
|
return reject(err);
|
|
69
92
|
},
|
|
70
93
|
});
|
|
71
|
-
export default
|
|
94
|
+
export default VECTOR
|
|
72
95
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
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,13 +26,13 @@
|
|
|
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": {
|
|
35
|
-
"id": "
|
|
35
|
+
"id": "ee657d59-01fb-427f-bc7a-fc96e56d7541",
|
|
36
36
|
"key": "vector",
|
|
37
37
|
"prompt": {
|
|
38
38
|
"emoji": "🛤️",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"hashtag": "#Vector",
|
|
56
56
|
"title": "Vector Deva",
|
|
57
57
|
"subtitle": "Vector Deva for the VectorGuardWall.",
|
|
58
|
-
"describe": "Vector Deva",
|
|
58
|
+
"describe": "The Vector Deva",
|
|
59
59
|
"post": "Vector.",
|
|
60
60
|
"hashtags": "QuinnMichaels,IndraAI,DevaWorld,VectorDeva",
|
|
61
61
|
"pronouns": "He, Him",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"owner": "Quinn Michaels",
|
|
73
73
|
"caseid": "none",
|
|
74
74
|
"copyright": "©2025 Quinn Michaels. All rights reserved.",
|
|
75
|
-
"created": "Friday, August 29, 2025 - 4:
|
|
76
|
-
"modified": "Friday, August 29, 2025 - 4:
|
|
75
|
+
"created": "Friday, August 29, 2025 - 4:47:05 PM",
|
|
76
|
+
"modified": "Friday, August 29, 2025 - 4:47:05 PM"
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"vars": {
|