vektor-slipstream 1.4.4 → 2.0.0

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 (56) hide show
  1. package/README.md +67 -306
  2. package/package.json +14 -146
  3. package/CHANGELOG.md +0 -139
  4. package/LICENSE +0 -33
  5. package/TENETS.md +0 -189
  6. package/audn-log.js +0 -143
  7. package/axon.js +0 -389
  8. package/boot-patch.js +0 -33
  9. package/boot-screen.html +0 -210
  10. package/briefing.js +0 -150
  11. package/cerebellum.js +0 -439
  12. package/cloak-behaviour.js +0 -596
  13. package/cloak-captcha.js +0 -541
  14. package/cloak-core.js +0 -499
  15. package/cloak-identity.js +0 -484
  16. package/cloak-index.js +0 -261
  17. package/cloak-llms.js +0 -163
  18. package/cloak-pattern-store.js +0 -471
  19. package/cloak-recorder-auto.js +0 -297
  20. package/cloak-recorder-snippet.js +0 -119
  21. package/cloak-turbo-quant.js +0 -357
  22. package/cloak-warmup.js +0 -240
  23. package/cortex.js +0 -221
  24. package/detect-hardware.js +0 -181
  25. package/entity-resolver.js +0 -298
  26. package/errors.js +0 -66
  27. package/examples/example-claude-mcp.js +0 -220
  28. package/examples/example-langchain-researcher.js +0 -82
  29. package/examples/example-openai-assistant.js +0 -84
  30. package/examples/examples-README.md +0 -161
  31. package/export-import.js +0 -221
  32. package/forget.js +0 -148
  33. package/inspect.js +0 -199
  34. package/mistral/README-mistral.md +0 -123
  35. package/mistral/mistral-bridge.js +0 -218
  36. package/mistral/mistral-setup.js +0 -220
  37. package/mistral/vektor-tool-manifest.json +0 -41
  38. package/models/model_quantized.onnx +0 -0
  39. package/models/vocab.json +0 -1
  40. package/namespace.js +0 -186
  41. package/pin.js +0 -91
  42. package/slipstream-core-extended.js +0 -134
  43. package/slipstream-core.js +0 -1
  44. package/slipstream-db.js +0 -140
  45. package/slipstream-embedder.js +0 -338
  46. package/sovereign.js +0 -142
  47. package/token.js +0 -322
  48. package/types/index.d.ts +0 -269
  49. package/vektor-banner-loader.js +0 -109
  50. package/vektor-cli.js +0 -259
  51. package/vektor-licence-prompt.js +0 -128
  52. package/vektor-licence.js +0 -192
  53. package/vektor-setup.js +0 -270
  54. package/vektor-slipstream.dxt +0 -0
  55. package/vektor-tui.js +0 -373
  56. package/visualize.js +0 -235
@@ -1,218 +0,0 @@
1
- 'use strict';
2
- /**
3
- * mistral/mistral-bridge.js
4
- * VEKTOR SLIPSTREAM — Mistral HTTP Bridge
5
- * ─────────────────────────────────────────────────────────────────────────────
6
- * Lightweight HTTP server that exposes Slipstream memory as a tool endpoint
7
- * for Mistral agents (Le Chat, Mistral API, La Plateforme).
8
- *
9
- * Architecture: fully local — Mistral calls localhost:3847
10
- * Your memory never leaves your machine.
11
- *
12
- * Start via: node mistral/mistral-setup.js
13
- * Or directly: node mistral/mistral-bridge.js
14
- *
15
- * Endpoint: POST http://localhost:3847/api/v1/mistral/vektor_memoire
16
- * ─────────────────────────────────────────────────────────────────────────────
17
- */
18
-
19
- const http = require('http');
20
- const path = require('path');
21
- const fs = require('fs');
22
- const os = require('os');
23
-
24
- const PORT = process.env.VEKTOR_MISTRAL_PORT || 3847;
25
- const CONFIG_PATH = path.join(os.homedir(), '.vektor', 'mistral.config.json');
26
-
27
- // ── Load config ───────────────────────────────────────────────────────────────
28
-
29
- function loadConfig() {
30
- try {
31
- if (fs.existsSync(CONFIG_PATH)) {
32
- return JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
33
- }
34
- } catch(_) {}
35
- return null;
36
- }
37
-
38
- // ── Session state — per-key turn isolation ────────────────────────────────────
39
- // Prevents one Mistral session from stomping another.
40
- // TTL: 60s — stale sessions are garbage collected.
41
-
42
- const sessions = new Map();
43
- const SESSION_TTL = 60_000;
44
-
45
- function getSession(key) {
46
- const s = sessions.get(key);
47
- if (s && Date.now() - s.updatedAt > SESSION_TTL) {
48
- sessions.delete(key);
49
- return { lastAction: 'NONE', updatedAt: Date.now() };
50
- }
51
- return s ?? { lastAction: 'NONE', updatedAt: Date.now() };
52
- }
53
-
54
- function setSession(key, action) {
55
- sessions.set(key, { lastAction: action, updatedAt: Date.now() });
56
- }
57
-
58
- // ── Response helpers ──────────────────────────────────────────────────────────
59
-
60
- function json(res, status, body) {
61
- const payload = JSON.stringify(body);
62
- res.writeHead(status, {
63
- 'Content-Type': 'application/json',
64
- 'Content-Length': Buffer.byteLength(payload),
65
- 'Access-Control-Allow-Origin': '*',
66
- });
67
- res.end(payload);
68
- }
69
-
70
- // ── Main handler ──────────────────────────────────────────────────────────────
71
-
72
- async function handler(req, res) {
73
- // CORS preflight
74
- if (req.method === 'OPTIONS') {
75
- res.writeHead(204, { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'POST', 'Access-Control-Allow-Headers': 'Content-Type' });
76
- res.end();
77
- return;
78
- }
79
-
80
- // Health check
81
- if (req.method === 'GET' && req.url === '/health') {
82
- return json(res, 200, { status: 'ok', bridge: 'vektor-mistral', version: '1.0.5' });
83
- }
84
-
85
- if (req.method !== 'POST' || req.url !== '/api/v1/mistral/vektor_memoire') {
86
- return json(res, 404, { error: 'NOT_FOUND' });
87
- }
88
-
89
- // Parse body
90
- let body;
91
- try {
92
- const raw = await new Promise((resolve, reject) => {
93
- let data = '';
94
- req.on('data', chunk => data += chunk);
95
- req.on('end', () => resolve(data));
96
- req.on('error', reject);
97
- });
98
- body = JSON.parse(raw);
99
- } catch(_) {
100
- return json(res, 400, { error: 'INVALID_JSON' });
101
- }
102
-
103
- const { key, action = 'recall', query, content, limit = 5 } = body;
104
-
105
- // Require key
106
- if (!key || key.length < 8) {
107
- return json(res, 400, { error: 'MISSING_KEY', detail: 'Pass your Vektor licence key as the "key" field.' });
108
- }
109
-
110
- // Require query for recall, content for remember
111
- if (action === 'recall' && !query) {
112
- return json(res, 400, { error: 'MISSING_QUERY', detail: 'Pass a "query" string for recall operations.' });
113
- }
114
- if (action === 'remember' && !content) {
115
- return json(res, 400, { error: 'MISSING_CONTENT', detail: 'Pass a "content" string for remember operations.' });
116
- }
117
-
118
- // Validate key against config
119
- const config = loadConfig();
120
- if (!config) {
121
- return json(res, 503, {
122
- error: 'BRIDGE_NOT_CONFIGURED',
123
- detail: 'Run node mistral/mistral-setup.js first to activate the bridge.',
124
- });
125
- }
126
-
127
- if (config.licenceKey !== key) {
128
- return json(res, 401, { error: 'AUTHENTICATION_FAILED', detail: 'Key does not match registered licence.' });
129
- }
130
-
131
- // Load memory lazily — reuses the same db connection across requests
132
- if (!handler._memory) {
133
- try {
134
- const { createMemory } = require('../slipstream-core');
135
- handler._memory = await createMemory({
136
- agentId: config.agentId || 'mistral-agent',
137
- dbPath: config.dbPath || path.join(os.homedir(), '.vektor', 'mistral-memory.db'),
138
- licenceKey: config.licenceKey,
139
- silent: true,
140
- });
141
- console.log('[mistral-bridge] Memory loaded:', config.dbPath || 'default path');
142
- } catch(e) {
143
- return json(res, 500, { error: 'MEMORY_INIT_FAILED', detail: e.message });
144
- }
145
- }
146
-
147
- const memory = handler._memory;
148
- const session = getSession(key);
149
-
150
- try {
151
- if (action === 'recall') {
152
- const results = await memory.recall(query, Math.min(limit, 20));
153
- setSession(key, 'RECALL');
154
- return json(res, 200, {
155
- action: 'recall',
156
- query,
157
- memory_fragments: results.map(r => ({
158
- content: r.content,
159
- relevance: r.score,
160
- importance: r.importance,
161
- id: r.id,
162
- })),
163
- count: results.length,
164
- metadata: { engine: 'VEKTOR_MAGMA_v1.0.5', auth: 'VERIFIED', local: true },
165
- });
166
- }
167
-
168
- if (action === 'remember') {
169
- const result = await memory.remember(content, { importance: body.importance || 2 });
170
- setSession(key, 'REMEMBER');
171
- return json(res, 200, {
172
- action: 'remember',
173
- stored: result.action !== 'NO_OP',
174
- audn: result.action,
175
- id: result.id,
176
- content: content.slice(0, 100),
177
- metadata: { engine: 'VEKTOR_MAGMA_v1.0.5', auth: 'VERIFIED', local: true },
178
- });
179
- }
180
-
181
- return json(res, 400, { error: 'INVALID_ACTION', detail: 'action must be "recall" or "remember"' });
182
-
183
- } catch(e) {
184
- console.error('[mistral-bridge] Error:', e.message);
185
- return json(res, 500, { error: 'MEMORY_ERROR', detail: e.message });
186
- }
187
- }
188
-
189
- // ── Start server ──────────────────────────────────────────────────────────────
190
-
191
- const server = http.createServer(handler);
192
-
193
- server.listen(PORT, '127.0.0.1', () => {
194
- console.log('');
195
- console.log(' ╔══════════════════════════════════════════════════════╗');
196
- console.log(' ║ VEKTOR SLIPSTREAM — MISTRAL BRIDGE ║');
197
- console.log(' ╚══════════════════════════════════════════════════════╝');
198
- console.log('');
199
- console.log(` Listening: http://127.0.0.1:${PORT}`);
200
- console.log(` Endpoint: POST /api/v1/mistral/vektor_memoire`);
201
- console.log(` Health: GET /health`);
202
- console.log('');
203
- console.log(' Your memory never leaves this machine.');
204
- console.log(' Law I — Locality: enforced.');
205
- console.log('');
206
- });
207
-
208
- server.on('error', err => {
209
- if (err.code === 'EADDRINUSE') {
210
- console.error(`[mistral-bridge] Port ${PORT} already in use.`);
211
- console.error('[mistral-bridge] Either the bridge is already running, or change VEKTOR_MISTRAL_PORT.');
212
- } else {
213
- console.error('[mistral-bridge] Server error:', err.message);
214
- }
215
- process.exit(1);
216
- });
217
-
218
- module.exports = { server };
@@ -1,220 +0,0 @@
1
- 'use strict';
2
- /**
3
- * mistral/mistral-setup.js
4
- * VEKTOR SLIPSTREAM — Mistral Bridge Setup
5
- * ─────────────────────────────────────────────────────────────────────────────
6
- * Interactive CLI that:
7
- * 1. Prompts for your Vektor licence key
8
- * 2. Validates it against Polar
9
- * 3. Writes config to ~/.vektor/mistral.config.json
10
- * 4. Starts the local Mistral bridge on port 3847
11
- *
12
- * Run once to activate:
13
- * node mistral/mistral-setup.js
14
- *
15
- * To start the bridge without setup (config already exists):
16
- * node mistral/mistral-setup.js --start
17
- *
18
- * ─────────────────────────────────────────────────────────────────────────────
19
- */
20
-
21
- const readline = require('readline');
22
- const fs = require('fs');
23
- const path = require('path');
24
- const os = require('os');
25
- const { spawn } = require('child_process');
26
-
27
- const CONFIG_DIR = path.join(os.homedir(), '.vektor');
28
- const CONFIG_PATH = path.join(CONFIG_DIR, 'mistral.config.json');
29
- const BRIDGE_PATH = path.join(__dirname, 'mistral-bridge.js');
30
- const MANIFEST_PATH = path.join(__dirname, 'vektor-tool-manifest.json');
31
-
32
- // ── Helpers ───────────────────────────────────────────────────────────────────
33
-
34
- function ask(rl, question) {
35
- return new Promise(resolve => rl.question(question, resolve));
36
- }
37
-
38
- function writeConfig(config) {
39
- if (!fs.existsSync(CONFIG_DIR)) fs.mkdirSync(CONFIG_DIR, { recursive: true });
40
- fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2));
41
- }
42
-
43
- function readConfig() {
44
- try {
45
- if (fs.existsSync(CONFIG_PATH)) return JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
46
- } catch(_) {}
47
- return null;
48
- }
49
-
50
- async function validateKey(licenceKey) {
51
- const POLAR_ORG_ID = 'a922049c-3049-41e8-9b20-b18890576b6f';
52
- const POLAR_API = 'https://api.polar.sh/v1/customer-portal/license-keys/validate';
53
-
54
- process.stdout.write(' Validating licence key...');
55
-
56
- try {
57
- const res = await fetch(POLAR_API, {
58
- method: 'POST',
59
- headers: { 'Content-Type': 'application/json' },
60
- body: JSON.stringify({ key: licenceKey, organization_id: POLAR_ORG_ID }),
61
- signal: AbortSignal.timeout(10000),
62
- });
63
-
64
- if (!res.ok) {
65
- process.stdout.write(' ✗\n');
66
- return { valid: false, reason: `API error ${res.status}` };
67
- }
68
-
69
- const data = await res.json();
70
- if (data.status !== 'granted') {
71
- process.stdout.write(' ✗\n');
72
- return { valid: false, reason: `Licence ${data.status}` };
73
- }
74
-
75
- process.stdout.write(' ✓\n');
76
- return { valid: true, email: data.user?.email || '', tier: data.benefit?.type || 'slipstream' };
77
-
78
- } catch(e) {
79
- process.stdout.write(' ✗\n');
80
- return { valid: false, reason: e.message };
81
- }
82
- }
83
-
84
- function startBridge(background = false) {
85
- if (background) {
86
- // Detached background process — survives the setup script
87
- const child = spawn(process.execPath, [BRIDGE_PATH], {
88
- detached: true,
89
- stdio: 'ignore',
90
- });
91
- child.unref();
92
- console.log(`\n Bridge started in background (PID ${child.pid})`);
93
- console.log(` To stop it: kill ${child.pid}`);
94
- } else {
95
- // Foreground — process stays open, logs to console
96
- require(BRIDGE_PATH);
97
- }
98
- }
99
-
100
- function printManifestInstructions() {
101
- console.log('\n ─────────────────────────────────────────────────────────');
102
- console.log(' NEXT STEP — Add the tool to your Mistral agent');
103
- console.log(' ─────────────────────────────────────────────────────────');
104
- console.log('\n Tool manifest location:');
105
- console.log(` ${MANIFEST_PATH}`);
106
- console.log('\n Add it to your Mistral agent config or La Plateforme project.');
107
- console.log(' The bridge endpoint is: http://localhost:3847/api/v1/mistral/vektor_memoire');
108
- console.log('\n Example tool call from your Mistral agent:');
109
- console.log(' {');
110
- console.log(' "action": "recall",');
111
- console.log(' "query": "user coding preferences",');
112
- console.log(` "key": "YOUR_LICENCE_KEY"`);
113
- console.log(' }');
114
- console.log('\n ─────────────────────────────────────────────────────────\n');
115
- }
116
-
117
- // ── Main ──────────────────────────────────────────────────────────────────────
118
-
119
- async function main() {
120
- console.log('');
121
- console.log(' ╔══════════════════════════════════════════════════════╗');
122
- console.log(' ║ VEKTOR SLIPSTREAM — MISTRAL BRIDGE SETUP ║');
123
- console.log(' ╚══════════════════════════════════════════════════════╝');
124
- console.log('');
125
-
126
- const startOnly = process.argv.includes('--start');
127
-
128
- // If --start flag and config exists, skip setup
129
- if (startOnly) {
130
- const config = readConfig();
131
- if (!config) {
132
- console.error(' No config found. Run without --start to complete setup first.');
133
- process.exit(1);
134
- }
135
- console.log(` Config found. Starting bridge for agent: ${config.agentId}`);
136
- startBridge(false);
137
- return;
138
- }
139
-
140
- // Check for existing config
141
- const existing = readConfig();
142
- if (existing) {
143
- console.log(` Existing config found for licence: ${existing.licenceKey.slice(0, 12)}...`);
144
- console.log(` Agent ID: ${existing.agentId}`);
145
- console.log(` DB path: ${existing.dbPath}`);
146
- console.log('');
147
- }
148
-
149
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
150
-
151
- try {
152
- // Step 1 — Licence key
153
- const defaultKey = existing?.licenceKey || process.env.VEKTOR_LICENCE_KEY || '';
154
- const keyPrompt = defaultKey
155
- ? ` Enter licence key [${defaultKey.slice(0, 12)}...]: `
156
- : ' Enter your Vektor licence key: ';
157
-
158
- const rawKey = (await ask(rl, keyPrompt)).trim();
159
- const licenceKey = rawKey || defaultKey;
160
-
161
- if (!licenceKey || licenceKey.length < 8) {
162
- console.error('\n No licence key provided. Purchase at: https://vektormemory.com');
163
- rl.close();
164
- process.exit(1);
165
- }
166
-
167
- // Step 2 — Validate
168
- const validation = await validateKey(licenceKey);
169
- if (!validation.valid) {
170
- console.error(`\n Licence invalid: ${validation.reason}`);
171
- console.error(' Purchase at: https://vektormemory.com');
172
- rl.close();
173
- process.exit(1);
174
- }
175
-
176
- if (validation.email) console.log(` Licence owner: ${validation.email}`);
177
-
178
- // Step 3 — Agent ID
179
- const defaultAgentId = existing?.agentId || 'mistral-agent';
180
- const agentIdRaw = (await ask(rl, `\n Agent ID [${defaultAgentId}]: `)).trim();
181
- const agentId = agentIdRaw || defaultAgentId;
182
-
183
- // Step 4 — DB path
184
- const defaultDbPath = existing?.dbPath || path.join(CONFIG_DIR, 'mistral-memory.db');
185
- const dbPathRaw = (await ask(rl, ` Memory DB path [${defaultDbPath}]: `)).trim();
186
- const dbPath = dbPathRaw || defaultDbPath;
187
-
188
- // Step 5 — Background or foreground
189
- const bgRaw = (await ask(rl, '\n Run bridge in background? [Y/n]: ')).trim().toLowerCase();
190
- const background = bgRaw !== 'n' && bgRaw !== 'no';
191
-
192
- rl.close();
193
-
194
- // Write config
195
- const config = { licenceKey, agentId, dbPath, version: '1.0.5', createdAt: new Date().toISOString() };
196
- writeConfig(config);
197
-
198
- console.log('\n ─────────────────────────────────────────────────────────');
199
- console.log(' Config saved to: ~/.vektor/mistral.config.json');
200
- console.log(' ─────────────────────────────────────────────────────────');
201
-
202
- printManifestInstructions();
203
-
204
- // Start bridge
205
- startBridge(background);
206
-
207
- if (background) {
208
- console.log('\n Setup complete. Bridge is running.');
209
- console.log(' To restart: node mistral/mistral-setup.js --start\n');
210
- process.exit(0);
211
- }
212
-
213
- } catch(e) {
214
- rl.close();
215
- console.error('\n Setup error:', e.message);
216
- process.exit(1);
217
- }
218
- }
219
-
220
- main();
@@ -1,41 +0,0 @@
1
- {
2
- "function": {
3
- "name": "vektor_memoire",
4
- "description": "Query the VEKTOR Slipstream persistent memory graph for long-term context and recalled associations. Returns ranked memory fragments with importance scores. Requires a valid Vektor licence key. The bridge must be running locally via: node mistral/mistral-setup.js",
5
- "parameters": {
6
- "type": "object",
7
- "properties": {
8
- "query": {
9
- "type": "string",
10
- "description": "The concept, question, or topic to retrieve from memory."
11
- },
12
- "key": {
13
- "type": "string",
14
- "description": "Your Vektor Slipstream licence key (VEKTOR-XXXX-XXXX-XXXX)."
15
- },
16
- "action": {
17
- "type": "string",
18
- "description": "Operation to perform: 'recall' (default) to retrieve memories, 'remember' to store a new memory.",
19
- "enum": ["recall", "remember"],
20
- "default": "recall"
21
- },
22
- "content": {
23
- "type": "string",
24
- "description": "When action is 'remember': the text to store as a memory."
25
- },
26
- "limit": {
27
- "type": "integer",
28
- "description": "Maximum number of memory fragments to return (recall only). Default: 5. Max: 20.",
29
- "default": 5,
30
- "minimum": 1,
31
- "maximum": 20
32
- }
33
- },
34
- "required": ["key", "action"]
35
- }
36
- },
37
- "_bridge": {
38
- "url": "http://localhost:3847/api/v1/mistral/vektor_memoire",
39
- "note": "The bridge runs locally on your machine. Start it with: node mistral/mistral-setup.js"
40
- }
41
- }
Binary file