@indra.ai/deva.vector 0.0.7 → 0.0.8

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 +59 -41
  2. package/package.json +1 -1
@@ -1,61 +1,69 @@
1
1
  export default {
2
2
  async vector(packet) {
3
- this.state('set', `vector:transport:${packet.id}`);
3
+ const vector = await this.methods.sign('vector', 'default', packet);
4
+ return vector;
5
+ },
6
+
7
+ async sign(key, type, packet) {
8
+ this.state('set', `${key}:sign:${type}:${packet.id}`);
4
9
  const transport = packet.id; // set the transport id from the packet id.
10
+
11
+ this.prompt(`sign ${key}`);
12
+
13
+ this.zone(key, `${key}:sign:${type}:${transport}`); // set the zone
14
+ this.feature(key, `${key}:sign:${type}:${transport}`); // set the feature
15
+ this.context(key, `${key}:sign:${type}:${transport}`); // set the agent context to proxy.
16
+ this.action('method', `${key}:sign:${type}:${transport}`); // set the action method to proxy.
5
17
 
6
- this.zone('vector', transport); // set the current zone to guard
7
- this.feature('vector', transport); // set the Guard feature.
8
- this.context('vector', transport); // set the agent context to proxy.
9
- this.action('method', `proxy:${transport}`); // set the action method to proxy.
18
+ this.state('set', `${key}:sign:${type}:uid:${transport}`); //set the uid state
19
+ const uid = this.lib.uid(true); // The UID
10
20
 
11
- this.state('set', `uid:${transport}`); //set the uid state for the proxy
12
- const uid = this.lib.uid(true); // The UID for the proxy
13
- this.state('set', `time:${transport}`); //set the time state for the proxy
21
+ this.state('set', `${key}:sign:${type}:time:${transport}`); //set the time state
14
22
  const time = Date.now(); // current timestamp
15
- this.state('created', `created:${transport}`); //set the uid state for the proxy
23
+
24
+ this.state('created', `${key}:sign:${type}:created:${transport}`); //set the created state
16
25
  const created = this.lib.formatDate(time, 'long', true); // Formatted created date.
17
26
 
18
- this.state('set', `vector:${transport}`); //set the guard state for the proxy
19
- const vector = this.guard(); // load the Guard profile
20
- const {concerns} = vector; // load concerns from client guard profile.
27
+ this.state('set', `${key}:sign:${type}:concerns:${transport}`); //set the concerns
28
+ const {concerns} = this[key](); // load the Guard profile
21
29
 
22
- this.state('set', `vector:agent:${transport}`); //set the agent state for the proxy
30
+ this.state('set', `${key}:sign:${type}:agent:${transport}`); //set the agent state
23
31
  const agent = this.agent(); // the agent processing the proxy
24
32
 
25
- this.state('set', `vector:client:${transport}`); //set the client state for the proxy
33
+ this.state('set', `${key}:sign:${type}:client:${transport}`); //set the client state
26
34
  const client = this.client(); // the client requesting the proxy
27
35
 
28
- this.state('set', `vector:meta:${transport}`); //set the meta state for the proxy
36
+ this.state('set', `${key}:sign:${type}:meta:${transport}`); //set the meta state
29
37
  const {meta} = packet.q; // set the meta information from the packet question.
30
38
 
31
- this.state('set', `vector:params:${transport}`); //set the meta state for the proxy
39
+ this.state('set', `${key}:sign:${type}:params:${transport}`); //set the meta state
32
40
  const {params} = meta; // set params from the meta information.
33
41
 
34
- this.state('set', `vector:opts:${transport}`); //set the opts state for the proxy
42
+ this.state('set', `${key}:sign:${type}:opts:${transport}`); //set the opts state
35
43
  const opts = this.lib.copy(params); // copy the params and set as opts.
36
44
 
37
- this.state('set', `vector:command:${transport}`); //set the opts state for the proxy
45
+ this.state('set', `${key}:sign:${type}:command:${transport}`); //set the opts state
38
46
  const command = opts.shift(); // extract the command first array item out of opts.
39
47
 
40
- this.state('set', `vector:message:${transport}`); //set the message state for the proxy
48
+ this.state('set', `${key}:sign:${type}:message:${transport}`); //set the message state
41
49
  const message = packet.q.text; // set packet.q.text as the message of the proxy.
42
50
 
43
- this.state('set', `vector:write:${transport}`); //set the message state for the proxy
44
- const write = `OM:VECTOR:${client.profile.write.split(' ').join(':').toUpperCase()}`; // set proxy write string.
51
+ this.state('set', `${key}:sign:${type}:write:${transport}`); //set the message state
52
+ const write = `OM:${key.toUpperCase()}:${client.profile.write.split(' ').join(':').toUpperCase()}`; // set proxy write string.
45
53
 
46
54
  // hash the agent profile for security
47
- this.state('hash', `vector:agent:hash:${transport}`);
55
+ this.state('hash', `${key}:sign:${type}:write:${transport}`);
48
56
  const agent_hash = this.lib.hash(agent, 'sha256');
49
57
 
50
58
  // hash the agent profile for security
51
- this.state('hash', `vector:client:hash:${transport}`);
59
+ this.state('hash', `${key}:sign:${type}:write:${transport}`);
52
60
  const client_hash = this.lib.hash(client, 'sha256');
53
61
 
54
62
  // hash the agent profile for security
55
- this.state('hash', `vector:token:${transport}`);
56
- const token = this.lib.hash(`VECTOR ${client.profile.token} ${transport}`, 'sha256');
63
+ this.state('hash', `${key}:sign:${type}:write:${transport}`);
64
+ const token = this.lib.hash(`${key} ${client.profile.token} ${transport}`, 'sha256');
57
65
 
58
- this.state('set', `vector:data:${transport}`); // set the state to set data
66
+ this.state('set', `${key}:sign:${type}:write:${transport}`); // set the state to set data
59
67
  // data packet
60
68
  const data = {
61
69
  uid,
@@ -80,22 +88,22 @@ export default {
80
88
  copyright: client.profile.copyright,
81
89
  };
82
90
 
83
- this.state('hash', `vector:md5:${transport}`); // set state to secure hashing
91
+ this.state('hash', `${key}:sign:${type}:md5:${transport}`); // set state to secure hashing
84
92
  data.md5 = this.lib.hash(data, 'md5'); // hash data packet into md5 and inert into data.
85
93
 
86
- this.state('hash', `vector:sha256:${transport}`); // set state to secure hashing
94
+ this.state('hash', `${key}:sign:${type}:sha256:${transport}`); // set state to secure hashing
87
95
  data.sha256 = this.lib.hash(data, 'sha256'); // hash data into sha 256 then set in data.
88
96
 
89
- this.state('hash', `vector:sha512:${transport}`); // set state to secure hashing
97
+ this.state('hash', `${key}:sign:${type}:sha512:${transport}`); // set state to secure hashing
90
98
  data.sha512 = this.lib.hash(data, 'sha512'); // hash data into sha 512 then set in data.
91
99
 
92
100
  // Text data that is joined by line breaks and then trimmed.
93
- this.state('set', `vector:text:${transport}`); // set state to text for output formatting.
101
+ this.state('set', `${key}:sign:${type}:text:${transport}`); // set state to text for output formatting.
94
102
  const text = [
95
103
  `::::`,
96
104
  `::BEGIN:${data.write}:${data.transport}`,
97
- `#Vector${data.opts} ${data.message}`,
98
- `::begin:vector:guard:proxy:${transport}:${data.emojis}`,
105
+ `#${key}:${type}${data.opts} ${data.message}`,
106
+ `::begin:${key}:${transport}:${data.emojis}`,
99
107
  `transport: ${data.transport}`,
100
108
  `time: ${data.time}`,
101
109
  `caseid: ${data.caseid}`,
@@ -110,46 +118,56 @@ export default {
110
118
  `md5: ${data.md5}`,
111
119
  `sha256: ${data.sha256}`,
112
120
  `sha512: ${data.sha512}`,
113
- `::end:vector:guard:proxy:${data.transport}:${data.emojis}`,
121
+ `::end:${key}:${type}${data.transport}:${data.emojis}`,
114
122
  `::END:${data.write}:${data.transport}`,
115
123
  `::::`
116
124
  ].join('\n').trim();
117
125
 
118
126
  // send the text data to #feecting to parse and return valid text, html, and data.
119
- this.action('question', `vector:feecting:parse:${transport}`); // action set to feecting parse
127
+ this.action('question', `${key}:sign:${type}:write:${transport}`); // action set to feecting parse
120
128
  const feecting = await this.question(`${this.askChr}feecting parse:${transport} ${text}`); // parse with feecting agent.
121
129
 
122
- this.state('return', `vector:${transport}`); // set the state to return proxy
130
+ this.state('return', `${key}:sign:${type}:return:${transport}`); // set the state to return proxy
123
131
  return {
124
132
  text: feecting.a.text,
125
133
  html: feecting.a.html,
126
134
  data,
127
135
  }
136
+
128
137
  },
129
- echo(key, type, opts) {
138
+
139
+ async echo(key, type, opts) {
130
140
  const {id, agent, client, text, created, md5, sha256, sha512} = opts;
131
141
 
132
- this.prompt('ECHO ECHO ECHO')
133
142
  this.state('set', `${key}:echo:${type}:time:${id}`);
134
143
  const echo_time = Date.now();
135
144
 
136
145
  this.action('func', `${key}:echo:${type}:${id}`);
137
146
 
147
+ this.state('hash', `${key}:echo:${type}:hash:message:${id}`);
148
+ const message_hash = this.lib.hash(text || 'blank', 'sha256');
149
+
150
+ this.state('hash', `${key}:echo:${type}:hash:agent:${id}`);
151
+ const agent_hash = this.lib.hash(agent, 'sha256');
152
+
153
+ this.state('hash', `${key}:echo:${type}:hash:client:${id}`);
154
+ const client_hash = this.lib.hash(client, 'sha256');
155
+
138
156
  this.state('set', `${key}:echo:${type}:keystr:${id}`);
139
157
  const keystr = `${key.toUpperCase()}:${type.toUpperCase()}:${id}`;
140
158
 
141
159
  this.state('set', `${key}:echo:${type}:data:${id}`);
142
160
  const echo_data = [
143
- `::::`
161
+ `::::`,
144
162
  `::BEGIN:${keystr}`,
145
163
  `key: ${key}`,
146
164
  `type: ${type}`,
147
165
  `transport: ${id}`,
148
166
  `created: ${created}`,
149
167
  `echo: ${echo_time}`,
150
- `message: ${text}`,
151
- `agent: ${this.lib.hash(agent, 'sha256')}`,
152
- `client: ${this.lib.hash(client, 'sha256')}`,
168
+ `message: ${message_hash}`,
169
+ `agent: ${agent_hash}`,
170
+ `client: ${client_hash}`,
153
171
  `md5: ${md5}`,
154
172
  `sha256:${sha256}`,
155
173
  `sha512:${sha512}`,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "33555f8a-707d-4fc9-ae19-ba09036473d4",
3
3
  "name": "@indra.ai/deva.vector",
4
- "version": "0.0.7",
4
+ "version": "0.0.8",
5
5
  "author": "Quinn Michaels",
6
6
  "license": "MIT",
7
7
  "copyright": "2025",