@indra.ai/deva.shield 0.0.2
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 +21 -0
- package/README.md +2 -0
- package/feature/methods.js +135 -0
- package/index.js +61 -0
- package/index.test.js +19 -0
- package/package.json +108 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Quinn Michaels
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
method: proxy
|
|
5
|
+
params: packet
|
|
6
|
+
describe: Return authorized VectorGuardProxy for requesting client.
|
|
7
|
+
copyright: ©2025 Quinn A Michaels. All rights reserved.
|
|
8
|
+
**/
|
|
9
|
+
async proxy(packet) {
|
|
10
|
+
this.state('set', `transport:${packet.id}`);
|
|
11
|
+
const transport = packet.id; // set the transport id from the packet id.
|
|
12
|
+
|
|
13
|
+
this.zone('guard', transport); // set the current zone to guard
|
|
14
|
+
this.feature('guard', transport); // set the Guard feature.
|
|
15
|
+
this.context('proxy', transport); // set the agent context to proxy.
|
|
16
|
+
this.action('method', `proxy:${transport}`); // set the action method to proxy.
|
|
17
|
+
|
|
18
|
+
this.state('set', `uid:${transport}`); //set the uid state for the proxy
|
|
19
|
+
const uid = this.lib.uid(true); // The UID for the proxy
|
|
20
|
+
this.state('set', `time:${transport}`); //set the time state for the proxy
|
|
21
|
+
const time = Date.now(); // current timestamp
|
|
22
|
+
this.state('created', `created:${transport}`); //set the uid state for the proxy
|
|
23
|
+
const created = this.lib.formatDate(time, 'long', true); // Formatted created date.
|
|
24
|
+
|
|
25
|
+
this.state('set', `guard:${transport}`); //set the guard state for the proxy
|
|
26
|
+
const guard = this.guard(); // load the Guard profile
|
|
27
|
+
const {concerns} = guard; // load concerns from client guard profile.
|
|
28
|
+
|
|
29
|
+
this.state('set', `agent:${transport}`); //set the agent state for the proxy
|
|
30
|
+
const agent = this.agent(); // the agent processing the proxy
|
|
31
|
+
|
|
32
|
+
this.state('set', `client:${transport}`); //set the client state for the proxy
|
|
33
|
+
const client = this.client(); // the client requesting the proxy
|
|
34
|
+
|
|
35
|
+
this.state('set', `meta:${transport}`); //set the meta state for the proxy
|
|
36
|
+
const {meta} = packet.q; // set the meta information from the packet question.
|
|
37
|
+
|
|
38
|
+
this.state('set', `params:${transport}`); //set the meta state for the proxy
|
|
39
|
+
const {params} = meta; // set params from the meta information.
|
|
40
|
+
|
|
41
|
+
this.state('set', `opts:${transport}`); //set the opts state for the proxy
|
|
42
|
+
const opts = this.lib.copy(params); // copy the params and set as opts.
|
|
43
|
+
|
|
44
|
+
this.state('set', `command:${transport}`); //set the opts state for the proxy
|
|
45
|
+
const command = opts.shift(); // extract the command first array item out of opts.
|
|
46
|
+
|
|
47
|
+
this.state('set', `message:${transport}`); //set the message state for the proxy
|
|
48
|
+
const message = packet.q.text; // set packet.q.text as the message of the proxy.
|
|
49
|
+
|
|
50
|
+
this.state('set', `write:${transport}`); //set the message state for the proxy
|
|
51
|
+
const write = `OM:${client.profile.write.split(' ').join(':').toUpperCase()}:PROXY`; // set proxy write string.
|
|
52
|
+
|
|
53
|
+
// hash the agent profile for security
|
|
54
|
+
this.state('hash', `agent profile:${transport}`);
|
|
55
|
+
const agent_profile = this.lib.hash(agent.profile, 'sha256');
|
|
56
|
+
|
|
57
|
+
// hash the agent profile for security
|
|
58
|
+
this.state('hash', `client profile:${transport}`);
|
|
59
|
+
const client_profile = this.lib.hash(client.profile, 'sha256');
|
|
60
|
+
|
|
61
|
+
// hash the agent profile for security
|
|
62
|
+
this.state('hash', `token:${transport}`);
|
|
63
|
+
const token = this.lib.hash(`${client.profile.token} PROXY ${transport}`, 'sha256');
|
|
64
|
+
|
|
65
|
+
this.state('set', `data:${transport}`); // set the state to set data
|
|
66
|
+
// data packet
|
|
67
|
+
const data = {
|
|
68
|
+
uid,
|
|
69
|
+
transport,
|
|
70
|
+
time,
|
|
71
|
+
write,
|
|
72
|
+
message,
|
|
73
|
+
caseid: client.profile.caseid,
|
|
74
|
+
opts: opts.length? `:${opts.join(':')}` : '',
|
|
75
|
+
agent: agent_profile,
|
|
76
|
+
client: client_profile,
|
|
77
|
+
name: client.profile.name,
|
|
78
|
+
emojis: client.profile.emojis,
|
|
79
|
+
company: client.profile.company,
|
|
80
|
+
warning: client.profile.warning,
|
|
81
|
+
token,
|
|
82
|
+
concerns,
|
|
83
|
+
meta,
|
|
84
|
+
params,
|
|
85
|
+
command,
|
|
86
|
+
created,
|
|
87
|
+
copyright: client.profile.copyright,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
this.state('hash', `md5:${transport}`); // set state to secure hashing
|
|
91
|
+
data.md5 = this.lib.hash(data, 'md5'); // hash data packet into md5 and inert into data.
|
|
92
|
+
|
|
93
|
+
this.state('hash', `sha256:${transport}`); // set state to secure hashing
|
|
94
|
+
data.sha256 = this.lib.hash(data, 'sha256'); // hash data into sha 256 then set in data.
|
|
95
|
+
|
|
96
|
+
this.state('hash', `sha512:${transport}`); // set state to secure hashing
|
|
97
|
+
data.sha512 = this.lib.hash(data, 'sha512'); // hash data into sha 512 then set in data.
|
|
98
|
+
|
|
99
|
+
// Text data that is joined by line breaks and then trimmed.
|
|
100
|
+
this.state('set', `text:${transport}`); // set state to text for output formatting.
|
|
101
|
+
const text = [
|
|
102
|
+
`:::`,
|
|
103
|
+
`::BEGIN:${data.write}:${data.transport}`,
|
|
104
|
+
`#VectorGuardProxy${data.opts} ${data.message}`,
|
|
105
|
+
`::begin:vector:guard:proxy:${transport}:${data.emojis}`,
|
|
106
|
+
`transport: ${data.transport}`,
|
|
107
|
+
`time: ${data.time}`,
|
|
108
|
+
`caseid: ${data.caseid}`,
|
|
109
|
+
`agent: ${data.agent}`,
|
|
110
|
+
`client: ${data.client}`,
|
|
111
|
+
`name: ${data.name}`,
|
|
112
|
+
`company: ${data.company}`,
|
|
113
|
+
`token: ${data.token}`,
|
|
114
|
+
`warning: ${data.warning}`,
|
|
115
|
+
`created: ${data.created}`,
|
|
116
|
+
`copyright: ${data.copyright}`,
|
|
117
|
+
`md5: ${data.md5}`,
|
|
118
|
+
`sha256: ${data.sha256}`,
|
|
119
|
+
`sha512: ${data.sha512}`,
|
|
120
|
+
`::end:vector:guard:proxy:${data.transport}:${data.emojis}`,
|
|
121
|
+
`::END:${data.write}:${data.transport}`,
|
|
122
|
+
].join('\n').trim();
|
|
123
|
+
|
|
124
|
+
// send the text data to #feecting to parse and return valid text, html, and data.
|
|
125
|
+
this.action('question', `feecting:parse:${transport}`); // action set to feecting parse
|
|
126
|
+
const feecting = await this.question(`${this.askChr}feecting parse:${transport} ${text}`); // parse with feecting agent.
|
|
127
|
+
|
|
128
|
+
this.state('return', `proxy:${transport}`); // set the state to return proxy
|
|
129
|
+
return {
|
|
130
|
+
text: feecting.a.text,
|
|
131
|
+
html: feecting.a.html,
|
|
132
|
+
data,
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
};
|
package/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright (c)2025 Quinn Michaels
|
|
2
|
+
// Vector Deva
|
|
3
|
+
|
|
4
|
+
import Deva from '@indra.ai/deva';
|
|
5
|
+
import pkg from './package.json' with {type:'json'};
|
|
6
|
+
const {agent,vars} = pkg.data;
|
|
7
|
+
|
|
8
|
+
import {exec, spawn} from 'node:child_process';
|
|
9
|
+
|
|
10
|
+
// set the __dirname
|
|
11
|
+
import {dirname} from 'node:path';
|
|
12
|
+
import {fileURLToPath} from 'node:url';
|
|
13
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
|
|
15
|
+
const info = {
|
|
16
|
+
id: pkg.id,
|
|
17
|
+
name: pkg.name,
|
|
18
|
+
version: pkg.version,
|
|
19
|
+
author: pkg.author,
|
|
20
|
+
describe: pkg.description,
|
|
21
|
+
dir: __dirname,
|
|
22
|
+
url: pkg.homepage,
|
|
23
|
+
git: pkg.repository.url,
|
|
24
|
+
bugs: pkg.bugs.url,
|
|
25
|
+
license: pkg.license,
|
|
26
|
+
copyright: pkg.copyright
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const SHIELD = new Deva({
|
|
30
|
+
info,
|
|
31
|
+
agent,
|
|
32
|
+
vars,
|
|
33
|
+
utils: {
|
|
34
|
+
translate(input) {return input.trim();},
|
|
35
|
+
parse(input) {return input.trim();},
|
|
36
|
+
process(input) {return input.trim();},
|
|
37
|
+
},
|
|
38
|
+
listeners: {
|
|
39
|
+
'devacore:question'(packet) {
|
|
40
|
+
this.func.echo(packet.q);
|
|
41
|
+
},
|
|
42
|
+
'devacore:answer'(packet) {
|
|
43
|
+
this.func.echo(packet.a);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
modules: {},
|
|
47
|
+
devas: {},
|
|
48
|
+
func: {},
|
|
49
|
+
methods: {},
|
|
50
|
+
onReady(data, resolve) {
|
|
51
|
+
this.prompt(this.vars.messages.ready);
|
|
52
|
+
return resolve(data);
|
|
53
|
+
},
|
|
54
|
+
onError(data, err, reject) {
|
|
55
|
+
this.prompt(this.vars.messages.error);
|
|
56
|
+
console.log(err);
|
|
57
|
+
return reject(err);
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
export default SHIELD
|
|
61
|
+
|
package/index.test.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright (c)2025 Quinn A Michaels
|
|
2
|
+
// Indra Deva test file
|
|
3
|
+
|
|
4
|
+
const {expect} = require('chai')
|
|
5
|
+
const :key: = require('./index.js');
|
|
6
|
+
|
|
7
|
+
describe(indra.me.name, () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
return indra.init()
|
|
10
|
+
});
|
|
11
|
+
it('Check the DEVA Object', () => {
|
|
12
|
+
expect(indra).to.be.an('object');
|
|
13
|
+
expect(indra).to.have.property('agent');
|
|
14
|
+
expect(indra).to.have.property('vars');
|
|
15
|
+
expect(indra).to.have.property('listeners');
|
|
16
|
+
expect(indra).to.have.property('methods');
|
|
17
|
+
expect(indra).to.have.property('modules');
|
|
18
|
+
});
|
|
19
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "72d29d06-a871-4e5c-942c-7a2d7d21973d",
|
|
3
|
+
"name": "@indra.ai/deva.shield",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"author": "Quinn Michaels",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"copyright": "2025",
|
|
8
|
+
"description": "The Shield Deva.",
|
|
9
|
+
"main": "index.js",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/indraai/deva.shield.git"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"Shield",
|
|
20
|
+
"Deva",
|
|
21
|
+
"Indra.ai",
|
|
22
|
+
"Deva.space",
|
|
23
|
+
"Deva.cloud",
|
|
24
|
+
"Deva.world"
|
|
25
|
+
],
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/indraai/deva.shield/issues"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://deva.space/devas/shield",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@indra.ai/deva": "^1.5.45"
|
|
32
|
+
},
|
|
33
|
+
"data": {
|
|
34
|
+
"agent": {
|
|
35
|
+
"id": "d58b3f33-12a7-4cb4-9fa4-cbc983b58b3",
|
|
36
|
+
"key": "shield",
|
|
37
|
+
"prompt": {
|
|
38
|
+
"emoji": "🛡️",
|
|
39
|
+
"text": "Shield",
|
|
40
|
+
"colors": {
|
|
41
|
+
"label": {
|
|
42
|
+
"R": 0,
|
|
43
|
+
"G": 150,
|
|
44
|
+
"B": 255
|
|
45
|
+
},
|
|
46
|
+
"text": {
|
|
47
|
+
"R": 101,
|
|
48
|
+
"G": 192,
|
|
49
|
+
"B": 255
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"profile": {
|
|
54
|
+
"name": "Shield Deva",
|
|
55
|
+
"hashtag": "#Shield",
|
|
56
|
+
"title": "Shield Deva",
|
|
57
|
+
"subtitle": "Shield Deva for the VectorGuardShield.",
|
|
58
|
+
"describe": "The Shield Deva",
|
|
59
|
+
"post": "Shield.",
|
|
60
|
+
"hashtags": "QuinnMichaels,IndraAI,DevaWorld,ShieldDeva",
|
|
61
|
+
"pronouns": "He, Him",
|
|
62
|
+
"gender": "DEVA",
|
|
63
|
+
"voice": "ash",
|
|
64
|
+
"style": "A Cyber Security Shield.",
|
|
65
|
+
"system": "Deva.world.shield",
|
|
66
|
+
"layout": "default",
|
|
67
|
+
"emoji": "/assets/devas/shield/emoji.png",
|
|
68
|
+
"avatar": "/assets/devas/shield/avatar.png",
|
|
69
|
+
"image": "/assets/devas/shield/image.png",
|
|
70
|
+
"background": "/assets/devas/shield/background.png",
|
|
71
|
+
"creator": "Quinn Michaels",
|
|
72
|
+
"owner": "Quinn Michaels",
|
|
73
|
+
"caseid": "none",
|
|
74
|
+
"copyright": "©2025 Quinn Michaels. All rights reserved.",
|
|
75
|
+
"created": "Saturday, August 30, 2025 - 4:43:23 AM",
|
|
76
|
+
"modified": "Saturday, August 30, 2025 - 4:43:23 AM"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"vars": {
|
|
80
|
+
"messages": {
|
|
81
|
+
"init": "🟠 INIT",
|
|
82
|
+
"start": "🔵 START",
|
|
83
|
+
"enter": "🟢 ENTER",
|
|
84
|
+
"stop": "🔴 STOP",
|
|
85
|
+
"exit": "🟡 EXIT",
|
|
86
|
+
"done": "🟣 DONE",
|
|
87
|
+
"error": "💣 ERROR!",
|
|
88
|
+
"ready": "⭐️ Ready!"
|
|
89
|
+
},
|
|
90
|
+
"ask": {
|
|
91
|
+
"history": []
|
|
92
|
+
},
|
|
93
|
+
"art": {
|
|
94
|
+
"history": []
|
|
95
|
+
},
|
|
96
|
+
"context": {
|
|
97
|
+
"uid": "Shield is creating a uid",
|
|
98
|
+
"status": "Shield is viewing the status",
|
|
99
|
+
"help": "Shield is viewing the help",
|
|
100
|
+
"artist": "Shield creating",
|
|
101
|
+
"live": "Shield livechat",
|
|
102
|
+
"ask": "Shield asking",
|
|
103
|
+
"reply": "Shield reply",
|
|
104
|
+
"comment": "Shield comment"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|