node-red-contrib-vectorprime 0.1.8 → 0.1.10

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/package.json +1 -1
  2. package/vectorprime.html +161 -52
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-vectorprime",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "VectorPrime Decision Kernel node for Node-RED",
5
5
  "main": "vectorprime.js",
6
6
  "license": "MIT",
package/vectorprime.html CHANGED
@@ -1,7 +1,3 @@
1
- <!-- ========================= -->
2
- <!-- VectorPrime Config Node UI -->
3
- <!-- ========================= -->
4
-
5
1
  <script type="text/html" data-template-name="vectorprime-config">
6
2
  <div class="form-row">
7
3
  <label for="node-config-input-baseUrl">
@@ -26,27 +22,11 @@
26
22
 
27
23
  <div class="form-row">
28
24
  <div style="font-size:12px; color:#666;">
29
- API key is stored securely in Node-RED credentials (not exported with flows).
25
+ Key is stored securely in Node-RED credentials (not exported with flows).
30
26
  </div>
31
27
  </div>
32
28
  </script>
33
29
 
34
- <script type="text/html" data-help-name="vectorprime-config">
35
- <p>
36
- Stores your VectorPrime connection details securely.
37
- Use this once, then reuse it across multiple VectorPrime nodes.
38
- </p>
39
-
40
- <h3>Setup</h3>
41
- <ol>
42
- <li>Leave Base URL default (recommended)</li>
43
- <li>Click <b>Get Free Key</b> to generate a starter key</li>
44
- <li>Select this config in your VectorPrime nodes</li>
45
- </ol>
46
-
47
- <p><b>Default Base URL:</b> <code>https://vectorprime-kernel-backend.onrender.com</code></p>
48
- </script>
49
-
50
30
  <script type="text/javascript">
51
31
  (function () {
52
32
  function normalizeBaseUrl(url) {
@@ -88,6 +68,7 @@
88
68
  return;
89
69
  }
90
70
 
71
+ // Call backend directly from the editor
91
72
  const resp = await fetch(`${baseUrl}/v1/keys/free`, {
92
73
  method: "POST",
93
74
  headers: { "Content-Type": "application/json" },
@@ -111,7 +92,7 @@
111
92
  }
112
93
 
113
94
  apiKeyInput.value = data.api_key;
114
- statusEl.textContent = "✅ Free key saved";
95
+ statusEl.textContent = "✅ Free key generated + saved";
115
96
  statusEl.style.color = "green";
116
97
  } catch (err) {
117
98
  statusEl.textContent = `❌ Error: ${err.message}`;
@@ -123,9 +104,31 @@
123
104
  })();
124
105
  </script>
125
106
 
126
- <!-- ========================= -->
127
- <!-- VectorPrime Rank Node UI -->
128
- <!-- ========================= -->
107
+ <!-- HELP TAB: vectorprime-config -->
108
+ <script type="text/html" data-help-name="vectorprime-config">
109
+ <p><b>VectorPrime Config</b> stores your Base URL and API key securely.</p>
110
+
111
+ <h3>Quick Setup</h3>
112
+ <ol>
113
+ <li>Set <b>Base URL</b> (default is already correct)</li>
114
+ <li>Click <b>Get Free Key</b></li>
115
+ <li>Click <b>Done</b></li>
116
+ </ol>
117
+
118
+ <p>
119
+ ✅ Your key is stored in Node-RED <b>credentials</b>, so it is <b>not exported with flows</b>.
120
+ </p>
121
+
122
+ <h3>Recommended Base URL</h3>
123
+ <pre>https://vectorprime-kernel-backend.onrender.com</pre>
124
+
125
+ <h3>Tip</h3>
126
+ <p>
127
+ You can also paste your own paid key here if you want higher limits.
128
+ </p>
129
+ </script>
130
+
131
+ <hr />
129
132
 
130
133
  <script type="text/html" data-template-name="vectorprime-rank">
131
134
  <div class="form-row">
@@ -145,37 +148,11 @@
145
148
 
146
149
  <div class="form-row">
147
150
  <div style="font-size:12px; color:#666;">
148
- ✅ Sends <code>msg.payload</code> to VectorPrime and returns ranked results in <code>msg.payload</code>.
151
+ ✅ Sends <code>msg.payload</code> to VectorPrime and returns the ranked result in <code>msg.payload</code>.
149
152
  </div>
150
153
  </div>
151
154
  </script>
152
155
 
153
- <!-- ✅ THIS is the exact text that should show when you hover in the palette -->
154
- <script type="text/html" data-help-name="vectorprime-rank">
155
- <p>
156
- Automatically ranks tasks, alerts, or choices in <code>msg.payload</code> so your flow can pick the <b>best next action</b>.
157
- </p>
158
-
159
- <h3>Why developers install this</h3>
160
- <ul>
161
- <li><b>Incident response:</b> rank alerts and fix the highest-impact issue first</li>
162
- <li><b>Automation & ops:</b> choose what job runs next when time/resources are limited</li>
163
- <li><b>AI agents:</b> pick the safest + highest-outcome tool/action automatically</li>
164
- <li><b>Queues & tickets:</b> prioritize support tickets, work orders, escalations</li>
165
- <li><b>Workflow routing:</b> route incoming events by urgency + risk</li>
166
- </ul>
167
-
168
- <h3>Input</h3>
169
- <p><code>msg.payload</code> = your decisions/tasks object (JSON)</p>
170
-
171
- <h3>Output</h3>
172
- <p><code>msg.payload</code> = ranked decision result (JSON)</p>
173
-
174
- <p>
175
- If you hit a free-tier limit, the response may include an upgrade URL so the flow can continue.
176
- </p>
177
- </script>
178
-
179
156
  <script type="text/javascript">
180
157
  RED.nodes.registerType("vectorprime-rank", {
181
158
  category: "network",
@@ -188,9 +165,141 @@
188
165
  inputs: 1,
189
166
  outputs: 1,
190
167
  icon: "font-awesome/fa-bolt",
168
+
169
+ // ✅ This is the name users see in the palette
191
170
  paletteLabel: "Rank Decision (VectorPrime)",
171
+
172
+ // ✅ This is the short description used in the tooltip card
173
+ description: "Automatically ranks tasks, alerts, or choices in msg.payload so your flow can pick the best next action.",
174
+
192
175
  label: function () {
193
176
  return this.name || "Rank Decision (VectorPrime)";
194
177
  }
195
178
  });
179
+ </script>
180
+
181
+ <!-- ✅ HELP TAB: vectorprime-rank -->
182
+ <script type="text/html" data-help-name="vectorprime-rank">
183
+ <p>
184
+ <b>Rank Decision (VectorPrime)</b> sorts your options and returns the best next action.
185
+ Use it anywhere you need <b>priority scoring</b> or <b>decision ranking</b> inside a flow.
186
+ </p>
187
+
188
+ <h3>What it does</h3>
189
+ <ul>
190
+ <li>Reads input from <code>msg.payload</code></li>
191
+ <li>Calls VectorPrime Rank API</li>
192
+ <li>Returns the ranked decision in <code>msg.payload</code></li>
193
+ </ul>
194
+
195
+ <h3>Best use cases</h3>
196
+ <ul>
197
+ <li><b>Incident response:</b> rank alerts by urgency</li>
198
+ <li><b>Task automation:</b> choose the best next action automatically</li>
199
+ <li><b>Ops + IoT:</b> prioritize device events and maintenance actions</li>
200
+ <li><b>Workflows:</b> sort leads, tickets, jobs, or notifications</li>
201
+ </ul>
202
+
203
+ <h3>Input format (example)</h3>
204
+ <p>Send a list of options to rank inside <code>msg.payload</code>:</p>
205
+
206
+ <pre><code>{
207
+ "items": [
208
+ { "id": "fix-prod-bug", "label": "Fix production bug", "urgency": 10, "impact": 10 },
209
+ { "id": "ship-feature", "label": "Ship new feature", "urgency": 7, "impact": 8 },
210
+ { "id": "refactor", "label": "Refactor module", "urgency": 3, "impact": 5 }
211
+ ]
212
+ }</code></pre>
213
+
214
+ <h3>Output</h3>
215
+ <p>
216
+ The response is returned in <code>msg.payload</code> (ranked order + decision result).
217
+ If your free tier limit is reached, the node may return an <b>upgrade URL</b>.
218
+ </p>
219
+
220
+ <h3>1-Click Example Flow (Import This)</h3>
221
+ <p>
222
+ Copy the JSON below, then go to:
223
+ <br/>
224
+ <b>Node-RED Menu → Import → Clipboard → Paste → Import</b>
225
+ </p>
226
+
227
+ <pre><code>[
228
+ {
229
+ "id": "a111111111111111",
230
+ "type": "tab",
231
+ "label": "VectorPrime 1-Click Demo",
232
+ "disabled": false,
233
+ "info": ""
234
+ },
235
+ {
236
+ "id": "b111111111111111",
237
+ "type": "inject",
238
+ "z": "a111111111111111",
239
+ "name": "Run VectorPrime Rank (1-click)",
240
+ "props": [
241
+ {
242
+ "p": "payload"
243
+ }
244
+ ],
245
+ "payload": "{\"items\":[{\"id\":\"fix-prod-bug\",\"label\":\"Fix production bug\",\"urgency\":10,\"impact\":10},{\"id\":\"ship-feature\",\"label\":\"Ship new feature\",\"urgency\":7,\"impact\":8},{\"id\":\"refactor\",\"label\":\"Refactor module\",\"urgency\":3,\"impact\":5}]}",
246
+ "payloadType": "json",
247
+ "repeat": "",
248
+ "crontab": "",
249
+ "once": false,
250
+ "onceDelay": 0.1,
251
+ "topic": "",
252
+ "x": 220,
253
+ "y": 160,
254
+ "wires": [
255
+ [
256
+ "c111111111111111"
257
+ ]
258
+ ]
259
+ },
260
+ {
261
+ "id": "c111111111111111",
262
+ "type": "vectorprime-rank",
263
+ "z": "a111111111111111",
264
+ "name": "VectorPrime Rank",
265
+ "config": "d111111111111111",
266
+ "endpoint": "/v1/kernel/rank",
267
+ "x": 460,
268
+ "y": 160,
269
+ "wires": [
270
+ [
271
+ "e111111111111111"
272
+ ]
273
+ ]
274
+ },
275
+ {
276
+ "id": "e111111111111111",
277
+ "type": "debug",
278
+ "z": "a111111111111111",
279
+ "name": "VectorPrime Output",
280
+ "active": true,
281
+ "tosidebar": true,
282
+ "console": false,
283
+ "tostatus": false,
284
+ "complete": "payload",
285
+ "targetType": "msg",
286
+ "statusVal": "",
287
+ "statusType": "auto",
288
+ "x": 700,
289
+ "y": 160,
290
+ "wires": []
291
+ },
292
+ {
293
+ "id": "d111111111111111",
294
+ "type": "vectorprime-config",
295
+ "name": "VectorPrime Config",
296
+ "baseUrl": "https://vectorprime-kernel-backend.onrender.com"
297
+ }
298
+ ]</code></pre>
299
+
300
+ <h3>Advanced tip: override Authorization</h3>
301
+ <p>
302
+ If you set <code>msg.headers.Authorization</code> before this node runs, it will use your header instead
303
+ of the stored key.
304
+ </p>
196
305
  </script>