@indra.ai/deva.shield 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.
Files changed (2) hide show
  1. package/feature/methods.js +8 -131
  2. package/package.json +2 -2
@@ -1,135 +1,12 @@
1
1
  export default {
2
-
3
- /**
4
- method: proxy
2
+ /**************
3
+ method: shield
5
4
  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
- }
5
+ describe: The global shield feature that installs with every agent
6
+ ***************/
7
+ async shield(packet) {
8
+ const shield = await this.methods.sign('shield', 'default', packet);
9
+ return shield;
134
10
  },
11
+
135
12
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "72d29d06-a871-4e5c-942c-7a2d7d21973d",
3
3
  "name": "@indra.ai/deva.shield",
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "author": "Quinn Michaels",
6
6
  "license": "MIT",
7
7
  "copyright": "2025",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://deva.space/devas/shield",
30
30
  "dependencies": {
31
- "@indra.ai/deva": "^1.5.46"
31
+ "@indra.ai/deva": "^1.5.47"
32
32
  },
33
33
  "data": {
34
34
  "agent": {