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.
- package/README.md +67 -306
- package/package.json +14 -146
- package/CHANGELOG.md +0 -139
- package/LICENSE +0 -33
- package/TENETS.md +0 -189
- package/audn-log.js +0 -143
- package/axon.js +0 -389
- package/boot-patch.js +0 -33
- package/boot-screen.html +0 -210
- package/briefing.js +0 -150
- package/cerebellum.js +0 -439
- package/cloak-behaviour.js +0 -596
- package/cloak-captcha.js +0 -541
- package/cloak-core.js +0 -499
- package/cloak-identity.js +0 -484
- package/cloak-index.js +0 -261
- package/cloak-llms.js +0 -163
- package/cloak-pattern-store.js +0 -471
- package/cloak-recorder-auto.js +0 -297
- package/cloak-recorder-snippet.js +0 -119
- package/cloak-turbo-quant.js +0 -357
- package/cloak-warmup.js +0 -240
- package/cortex.js +0 -221
- package/detect-hardware.js +0 -181
- package/entity-resolver.js +0 -298
- package/errors.js +0 -66
- package/examples/example-claude-mcp.js +0 -220
- package/examples/example-langchain-researcher.js +0 -82
- package/examples/example-openai-assistant.js +0 -84
- package/examples/examples-README.md +0 -161
- package/export-import.js +0 -221
- package/forget.js +0 -148
- package/inspect.js +0 -199
- package/mistral/README-mistral.md +0 -123
- package/mistral/mistral-bridge.js +0 -218
- package/mistral/mistral-setup.js +0 -220
- package/mistral/vektor-tool-manifest.json +0 -41
- package/models/model_quantized.onnx +0 -0
- package/models/vocab.json +0 -1
- package/namespace.js +0 -186
- package/pin.js +0 -91
- package/slipstream-core-extended.js +0 -134
- package/slipstream-core.js +0 -1
- package/slipstream-db.js +0 -140
- package/slipstream-embedder.js +0 -338
- package/sovereign.js +0 -142
- package/token.js +0 -322
- package/types/index.d.ts +0 -269
- package/vektor-banner-loader.js +0 -109
- package/vektor-cli.js +0 -259
- package/vektor-licence-prompt.js +0 -128
- package/vektor-licence.js +0 -192
- package/vektor-setup.js +0 -270
- package/vektor-slipstream.dxt +0 -0
- package/vektor-tui.js +0 -373
- package/visualize.js +0 -235
package/visualize.js
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
/**
|
|
3
|
-
* visualize.js — memory.visualize()
|
|
4
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
-
* Opens a local HTTP server serving a D3 force graph of the agent's memory.
|
|
6
|
-
* Launched by memory.visualize() — opens browser automatically.
|
|
7
|
-
* Runs until the user closes the browser tab or calls server.close().
|
|
8
|
-
*
|
|
9
|
-
* No external dependencies beyond what's already in the SDK.
|
|
10
|
-
* Pure Node.js http + inline HTML/CSS/JS with D3 from CDN.
|
|
11
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const http = require('http');
|
|
15
|
-
const os = require('os');
|
|
16
|
-
|
|
17
|
-
// ── D3 Graph HTML ─────────────────────────────────────────────────────────────
|
|
18
|
-
|
|
19
|
-
function buildHTML(agentId) {
|
|
20
|
-
return `<!DOCTYPE html>
|
|
21
|
-
<html lang="en">
|
|
22
|
-
<head>
|
|
23
|
-
<meta charset="UTF-8">
|
|
24
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
25
|
-
<title>Vektor Memory Graph — ${agentId}</title>
|
|
26
|
-
<style>
|
|
27
|
-
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
28
|
-
body { background: #0c0d0e; color: #e2e8f0; font-family: 'IBM Plex Mono', monospace; overflow: hidden; }
|
|
29
|
-
#header { position: absolute; top: 0; left: 0; right: 0; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; background: rgba(12,13,14,0.9); border-bottom: 1px solid rgba(255,255,255,0.08); z-index: 10; }
|
|
30
|
-
#header h1 { font-size: 13px; font-weight: 500; letter-spacing: 0.06em; color: rgba(242,242,242,0.7); }
|
|
31
|
-
#stats { font-size: 11px; color: rgba(242,242,242,0.38); letter-spacing: 0.04em; }
|
|
32
|
-
#graph { width: 100vw; height: 100vh; }
|
|
33
|
-
.node circle { stroke-width: 1.5; cursor: pointer; }
|
|
34
|
-
.node text { font-size: 10px; fill: rgba(242,242,242,0.6); pointer-events: none; }
|
|
35
|
-
.link { stroke: rgba(255,255,255,0.12); stroke-width: 1; }
|
|
36
|
-
.link.semantic { stroke: rgba(99,153,34,0.4); }
|
|
37
|
-
.link.causal { stroke: rgba(255,107,0,0.4); }
|
|
38
|
-
.link.temporal { stroke: rgba(59,139,212,0.4); }
|
|
39
|
-
.link.entity { stroke: rgba(127,119,221,0.4); }
|
|
40
|
-
#tooltip { position: absolute; background: rgba(12,13,14,0.95); border: 1px solid rgba(255,255,255,0.12); border-radius: 6px; padding: 10px 14px; font-size: 11px; max-width: 300px; line-height: 1.6; pointer-events: none; display: none; z-index: 20; }
|
|
41
|
-
#tooltip .t-content { color: rgba(242,242,242,0.8); margin-bottom: 4px; }
|
|
42
|
-
#tooltip .t-meta { color: rgba(242,242,242,0.38); font-size: 10px; }
|
|
43
|
-
#legend { position: absolute; bottom: 16px; left: 20px; font-size: 10px; color: rgba(242,242,242,0.38); line-height: 2; }
|
|
44
|
-
.leg { display: flex; align-items: center; gap: 6px; }
|
|
45
|
-
.leg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
|
|
46
|
-
#controls { position: absolute; bottom: 16px; right: 20px; display: flex; gap: 8px; }
|
|
47
|
-
#controls button { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: rgba(242,242,242,0.6); font-size: 11px; font-family: inherit; padding: 4px 12px; border-radius: 4px; cursor: pointer; }
|
|
48
|
-
#controls button:hover { background: rgba(255,255,255,0.1); }
|
|
49
|
-
</style>
|
|
50
|
-
</head>
|
|
51
|
-
<body>
|
|
52
|
-
<div id="header">
|
|
53
|
-
<h1>VEKTOR MEMORY GRAPH — ${agentId}</h1>
|
|
54
|
-
<span id="stats">loading...</span>
|
|
55
|
-
</div>
|
|
56
|
-
<svg id="graph"></svg>
|
|
57
|
-
<div id="tooltip"><div class="t-content" id="tt-content"></div><div class="t-meta" id="tt-meta"></div></div>
|
|
58
|
-
<div id="legend">
|
|
59
|
-
<div class="leg"><div class="leg-dot" style="background:#639922"></div> semantic</div>
|
|
60
|
-
<div class="leg"><div class="leg-dot" style="background:#ff6b00"></div> causal</div>
|
|
61
|
-
<div class="leg"><div class="leg-dot" style="background:#378add"></div> temporal</div>
|
|
62
|
-
<div class="leg"><div class="leg-dot" style="background:#7f77dd"></div> entity</div>
|
|
63
|
-
</div>
|
|
64
|
-
<div id="controls">
|
|
65
|
-
<button onclick="restart()">Reset</button>
|
|
66
|
-
<button onclick="window.location.reload()">Refresh</button>
|
|
67
|
-
</div>
|
|
68
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.8.5/d3.min.js"></script>
|
|
69
|
-
<script>
|
|
70
|
-
const W = window.innerWidth, H = window.innerHeight;
|
|
71
|
-
const svg = d3.select('#graph').attr('width', W).attr('height', H);
|
|
72
|
-
const g = svg.append('g');
|
|
73
|
-
const tooltip = document.getElementById('tooltip');
|
|
74
|
-
|
|
75
|
-
svg.call(d3.zoom().scaleExtent([0.1, 4]).on('zoom', e => g.attr('transform', e.transform)));
|
|
76
|
-
|
|
77
|
-
const COLOR = { semantic: '#639922', causal: '#ff6b00', temporal: '#378add', entity: '#7f77dd', default: '#888780' };
|
|
78
|
-
|
|
79
|
-
async function load() {
|
|
80
|
-
const data = await fetch('/data').then(r => r.json());
|
|
81
|
-
const nodes = data.nodes;
|
|
82
|
-
const links = data.edges.map(e => ({ ...e, source: e.source_id, target: e.target_id }));
|
|
83
|
-
|
|
84
|
-
document.getElementById('stats').textContent =
|
|
85
|
-
nodes.length + ' nodes · ' + links.length + ' edges · agent: ${agentId}';
|
|
86
|
-
|
|
87
|
-
g.selectAll('*').remove();
|
|
88
|
-
|
|
89
|
-
const sim = d3.forceSimulation(nodes)
|
|
90
|
-
.force('link', d3.forceLink(links).id(d => d.id).distance(80))
|
|
91
|
-
.force('charge', d3.forceManyBody().strength(-120))
|
|
92
|
-
.force('center', d3.forceCenter(W / 2, H / 2))
|
|
93
|
-
.force('collision', d3.forceCollide(20));
|
|
94
|
-
|
|
95
|
-
const link = g.append('g').selectAll('line')
|
|
96
|
-
.data(links).join('line')
|
|
97
|
-
.attr('class', d => 'link ' + (d.edge_type || 'semantic'));
|
|
98
|
-
|
|
99
|
-
const node = g.append('g').selectAll('g')
|
|
100
|
-
.data(nodes).join('g').attr('class', 'node')
|
|
101
|
-
.call(d3.drag()
|
|
102
|
-
.on('start', (e, d) => { if (!e.active) sim.alphaTarget(0.3).restart(); d.fx = d.x; d.fy = d.y; })
|
|
103
|
-
.on('drag', (e, d) => { d.fx = e.x; d.fy = e.y; })
|
|
104
|
-
.on('end', (e, d) => { if (!e.active) sim.alphaTarget(0); d.fx = null; d.fy = null; }));
|
|
105
|
-
|
|
106
|
-
node.append('circle')
|
|
107
|
-
.attr('r', d => 4 + Math.min((d.importance || 1) * 2, 10))
|
|
108
|
-
.attr('fill', d => COLOR[d.edge_type] || COLOR.default)
|
|
109
|
-
.attr('fill-opacity', 0.8)
|
|
110
|
-
.attr('stroke', d => COLOR[d.edge_type] || COLOR.default)
|
|
111
|
-
.on('mouseover', (e, d) => {
|
|
112
|
-
document.getElementById('tt-content').textContent = d.content ? d.content.slice(0, 200) : d.id;
|
|
113
|
-
document.getElementById('tt-meta').textContent =
|
|
114
|
-
'importance: ' + (d.importance || 1) + ' · type: ' + (d.edge_type || 'semantic') + ' · id: ' + d.id;
|
|
115
|
-
tooltip.style.display = 'block';
|
|
116
|
-
tooltip.style.left = (e.pageX + 12) + 'px';
|
|
117
|
-
tooltip.style.top = (e.pageY + 12) + 'px';
|
|
118
|
-
})
|
|
119
|
-
.on('mousemove', e => {
|
|
120
|
-
tooltip.style.left = (e.pageX + 12) + 'px';
|
|
121
|
-
tooltip.style.top = (e.pageY + 12) + 'px';
|
|
122
|
-
})
|
|
123
|
-
.on('mouseout', () => tooltip.style.display = 'none');
|
|
124
|
-
|
|
125
|
-
node.append('text')
|
|
126
|
-
.attr('dx', 10).attr('dy', 4)
|
|
127
|
-
.text(d => d.content ? d.content.slice(0, 30) + (d.content.length > 30 ? '…' : '') : '');
|
|
128
|
-
|
|
129
|
-
sim.on('tick', () => {
|
|
130
|
-
link.attr('x1', d => d.source.x).attr('y1', d => d.source.y)
|
|
131
|
-
.attr('x2', d => d.target.x).attr('y2', d => d.target.y);
|
|
132
|
-
node.attr('transform', d => 'translate(' + d.x + ',' + d.y + ')');
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
window._sim = sim;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function restart() { if (window._sim) { window._sim.alpha(1).restart(); } }
|
|
139
|
-
|
|
140
|
-
load().catch(e => {
|
|
141
|
-
document.getElementById('stats').textContent = 'Error loading graph: ' + e.message;
|
|
142
|
-
});
|
|
143
|
-
</script>
|
|
144
|
-
</body>
|
|
145
|
-
</html>`;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// ── HTTP Server ───────────────────────────────────────────────────────────────
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* startVisualizer(memory, opts)
|
|
152
|
-
*
|
|
153
|
-
* Starts a local HTTP server serving a D3 memory graph.
|
|
154
|
-
* Opens the browser automatically.
|
|
155
|
-
*
|
|
156
|
-
* @param {SlipstreamMemory} memory — the memory instance to visualize
|
|
157
|
-
* @param {object} opts
|
|
158
|
-
* @param {number} opts.port — port (default: random available)
|
|
159
|
-
* @param {boolean} opts.open — auto-open browser (default: true)
|
|
160
|
-
* @returns {Promise<http.Server>}
|
|
161
|
-
*/
|
|
162
|
-
async function startVisualizer(memory, opts = {}) {
|
|
163
|
-
const { open = true } = opts;
|
|
164
|
-
const agentId = memory.agentId || 'agent';
|
|
165
|
-
|
|
166
|
-
const server = http.createServer(async (req, res) => {
|
|
167
|
-
const cors = { 'Access-Control-Allow-Origin': '*' };
|
|
168
|
-
|
|
169
|
-
if (req.url === '/') {
|
|
170
|
-
res.writeHead(200, { 'Content-Type': 'text/html', ...cors });
|
|
171
|
-
res.end(buildHTML(agentId));
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (req.url === '/data') {
|
|
176
|
-
try {
|
|
177
|
-
// Pull all memories as nodes
|
|
178
|
-
const nodes = memory.db.prepare(
|
|
179
|
-
'SELECT id, content, edge_type, importance FROM memories WHERE agent_id = ? ORDER BY importance DESC LIMIT 500'
|
|
180
|
-
).all(agentId);
|
|
181
|
-
|
|
182
|
-
// Pull edges
|
|
183
|
-
const edges = memory.db.prepare(
|
|
184
|
-
'SELECT source_id, target_id, edge_type, weight FROM memory_edges WHERE agent_id = ? LIMIT 2000'
|
|
185
|
-
).all(agentId);
|
|
186
|
-
|
|
187
|
-
res.writeHead(200, { 'Content-Type': 'application/json', ...cors });
|
|
188
|
-
res.end(JSON.stringify({ nodes, edges }));
|
|
189
|
-
} catch(e) {
|
|
190
|
-
res.writeHead(500, { 'Content-Type': 'application/json', ...cors });
|
|
191
|
-
res.end(JSON.stringify({ error: e.message }));
|
|
192
|
-
}
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
res.writeHead(404); res.end();
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
// Find an available port
|
|
200
|
-
await new Promise((resolve, reject) => {
|
|
201
|
-
const port = opts.port || 0; // 0 = OS picks available port
|
|
202
|
-
server.listen(port, '127.0.0.1', () => resolve());
|
|
203
|
-
server.on('error', reject);
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
const { port } = server.address();
|
|
207
|
-
const url = `http://localhost:${port}`;
|
|
208
|
-
|
|
209
|
-
console.log('');
|
|
210
|
-
console.log(' ╔══════════════════════════════════════════════════════╗');
|
|
211
|
-
console.log(' ║ VEKTOR MEMORY GRAPH — VISUALIZER ║');
|
|
212
|
-
console.log(' ╚══════════════════════════════════════════════════════╝');
|
|
213
|
-
console.log('');
|
|
214
|
-
console.log(` Agent: ${agentId}`);
|
|
215
|
-
console.log(` URL: ${url}`);
|
|
216
|
-
console.log('');
|
|
217
|
-
console.log(' Close this process (Ctrl+C) to stop the visualizer.');
|
|
218
|
-
console.log('');
|
|
219
|
-
|
|
220
|
-
// Auto-open browser
|
|
221
|
-
if (open) {
|
|
222
|
-
const platform = os.platform();
|
|
223
|
-
const { exec } = require('child_process');
|
|
224
|
-
const cmd = platform === 'win32' ? `start ${url}`
|
|
225
|
-
: platform === 'darwin' ? `open ${url}`
|
|
226
|
-
: `xdg-open ${url}`;
|
|
227
|
-
exec(cmd, err => {
|
|
228
|
-
if (err) console.log(` Open manually: ${url}`);
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return server;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
module.exports = { startVisualizer };
|