vektor-slipstream 1.4.4 → 1.4.5

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 (55) hide show
  1. package/package.json +2 -2
  2. package/CHANGELOG.md +0 -139
  3. package/LICENSE +0 -33
  4. package/TENETS.md +0 -189
  5. package/audn-log.js +0 -143
  6. package/axon.js +0 -389
  7. package/boot-patch.js +0 -33
  8. package/boot-screen.html +0 -210
  9. package/briefing.js +0 -150
  10. package/cerebellum.js +0 -439
  11. package/cloak-behaviour.js +0 -596
  12. package/cloak-captcha.js +0 -541
  13. package/cloak-core.js +0 -499
  14. package/cloak-identity.js +0 -484
  15. package/cloak-index.js +0 -261
  16. package/cloak-llms.js +0 -163
  17. package/cloak-pattern-store.js +0 -471
  18. package/cloak-recorder-auto.js +0 -297
  19. package/cloak-recorder-snippet.js +0 -119
  20. package/cloak-turbo-quant.js +0 -357
  21. package/cloak-warmup.js +0 -240
  22. package/cortex.js +0 -221
  23. package/detect-hardware.js +0 -181
  24. package/entity-resolver.js +0 -298
  25. package/errors.js +0 -66
  26. package/examples/example-claude-mcp.js +0 -220
  27. package/examples/example-langchain-researcher.js +0 -82
  28. package/examples/example-openai-assistant.js +0 -84
  29. package/examples/examples-README.md +0 -161
  30. package/export-import.js +0 -221
  31. package/forget.js +0 -148
  32. package/inspect.js +0 -199
  33. package/mistral/README-mistral.md +0 -123
  34. package/mistral/mistral-bridge.js +0 -218
  35. package/mistral/mistral-setup.js +0 -220
  36. package/mistral/vektor-tool-manifest.json +0 -41
  37. package/models/model_quantized.onnx +0 -0
  38. package/models/vocab.json +0 -1
  39. package/namespace.js +0 -186
  40. package/pin.js +0 -91
  41. package/slipstream-core-extended.js +0 -134
  42. package/slipstream-core.js +0 -1
  43. package/slipstream-db.js +0 -140
  44. package/slipstream-embedder.js +0 -338
  45. package/sovereign.js +0 -142
  46. package/token.js +0 -322
  47. package/types/index.d.ts +0 -269
  48. package/vektor-banner-loader.js +0 -109
  49. package/vektor-cli.js +0 -259
  50. package/vektor-licence-prompt.js +0 -128
  51. package/vektor-licence.js +0 -192
  52. package/vektor-setup.js +0 -270
  53. package/vektor-slipstream.dxt +0 -0
  54. package/vektor-tui.js +0 -373
  55. package/visualize.js +0 -235
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vektor-slipstream",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "Hardware-accelerated persistent memory for AI agents. Local-first, zero cloud dependency, $0 embedding cost.",
5
5
  "main": "slipstream-core-extended.js",
6
6
  "types": "./types/index.d.ts",
@@ -72,7 +72,7 @@
72
72
  "dependencies": {
73
73
  "better-sqlite3": "^12.8.0",
74
74
  "onnxruntime-node": "^1.17.3",
75
- "vektor-slipstream": "^1.4.4"
75
+ "vektor-slipstream": "^1.4.5"
76
76
  },
77
77
  "optionalDependencies": {
78
78
  "@anthropic-ai/sdk": "^0.82.0",
package/CHANGELOG.md DELETED
@@ -1,139 +0,0 @@
1
- # VEKTOR v1.3.7 — Changelog
2
-
3
- Released: 2026-04-05
4
-
5
- ## New features
6
-
7
- ### memory.forget(id)
8
- Hard-deletes a memory and cascades to all graph edges. Throws if memory is pinned — must unpin first.
9
- ```js
10
- await memory.forget('mem_abc123');
11
- // → { deleted: true, edgesRemoved: 4 }
12
- ```
13
-
14
- ### memory.forgetWhere(query, opts)
15
- Semantic bulk-delete. Preview with `dryRun: true` before committing.
16
- ```js
17
- await memory.forgetWhere('Project Atlas', { dryRun: true });
18
- await memory.forgetWhere('Project Atlas', { minScore: 0.9, limit: 5 });
19
- ```
20
-
21
- ### memory.pin(id) / memory.unpin(id) / memory.listPinned()
22
- Mark memories as permanent — REM cycle will never compress or delete them.
23
- ```js
24
- const { id } = await memory.remember('User is allergic to peanuts');
25
- await memory.pin(id);
26
- await memory.listPinned(); // → all pinned memories
27
- ```
28
-
29
- ### memory.inspect()
30
- Full diagnostic snapshot — no more raw SQLite queries to debug state.
31
- ```js
32
- const state = memory.inspect();
33
- state.counts // → { memories: 247, pinned: 3, edges: 7180 }
34
- state.rem // → { totalDreams: 11, compressionRatio: '0.06' }
35
- state.graph.topNodes // → 5 most-connected memories
36
- ```
37
-
38
- ### memory.auditLog(opts) / memory.auditStats()
39
- Full AUDN decision history. Nothing disappears silently.
40
- ```js
41
- memory.auditLog({ action: 'DELETE', since: '7d' });
42
- // → [{ action, memory_id, content, reason, similarity, ran_at }]
43
- ```
44
-
45
- ### memory.briefing({ since }) — scoped date filtering
46
- ```js
47
- await memory.briefing({ since: '7d' });
48
- await memory.briefing({ since: '12h', minImportance: 0.7 });
49
- await memory.briefing({ since: '2026-01-01', raw: true });
50
- ```
51
-
52
- ### memory.export() / memory.import()
53
- Full graph serialisation with checksum integrity.
54
- ```js
55
- const bundle = memory.export();
56
- fs.writeFileSync('backup.vektor.json', JSON.stringify(bundle));
57
-
58
- memory.import(bundle);
59
- // → { imported: 244, skipped: 3, edgesAdded: 7100 }
60
-
61
- memory.import(bundle, { dryRun: true }); // preview
62
- memory.import(bundle, { mode: 'replace' }); // wipe and restore
63
- ```
64
-
65
- ### Namespace support
66
- Scope all reads/writes to prevent project bleed.
67
- ```js
68
- const memory = await createMemory({ agentId: 'my-agent', namespace: 'project-atlas' });
69
- memory.listNamespaces();
70
- // → [{ namespace: 'project-atlas', memories: 18 }, ...]
71
- ```
72
-
73
- ### TypeScript types
74
- Full `.d.ts` declarations for all public API methods. No more flying blind in your IDE.
75
- Add to `tsconfig.json`: `"types": ["vektor-slipstream"]`
76
-
77
- ### Structured error codes
78
- Replace string catch blocks with reliable `VektorError.code` switching.
79
- ```js
80
- import { VektorError, ERR } from 'vektor-slipstream/errors';
81
-
82
- try {
83
- await memory.remember(...)
84
- } catch (e) {
85
- if (e instanceof VektorError) {
86
- switch (e.code) {
87
- case ERR.LICENCE_INVALID: // handle
88
- case ERR.EMBED_FAILED: // retry
89
- }
90
- }
91
- }
92
- ```
93
-
94
- ## Schema changes
95
- Run `npx vektor migrate` after updating, or migration runs automatically on startup.
96
-
97
- New columns:
98
- - `memories.pinned` INTEGER DEFAULT 0
99
- - `memories.namespace` TEXT DEFAULT 'default'
100
- - `memories.updated_at` INTEGER
101
-
102
- New tables:
103
- - `audn_log` — AUDN decision audit trail
104
- - `rem_log` — REM cycle run history (if not already present)
105
- - `vektor_meta` — schema version tracking
106
-
107
- ## Bug fixes
108
- - REM cycle now skips pinned memories (previously could compress critical facts)
109
- - AUDN deletions now logged before execution (previously silent)
110
- - briefing() no longer returns stale summary when no memories exist in window
111
-
112
- ## Breaking changes
113
- None. All new methods are additive. Existing code works unchanged.
114
- Migration is backward-compatible — new columns have safe defaults.
115
-
116
- ## Gemini security review fixes (round 1 — applied)
117
- - `briefing.js` — pinned memory query now has LIMIT 50 (context bomb prevention)
118
- - `briefing.js` — `parseSince()` guards against `Date.now()` ms being passed as unix seconds
119
- - `forget.js` — `forgetWhere()` selective error catching — infra errors re-thrown, only expected skips swallowed
120
- - `namespace.js` — O(N) JS delete loop replaced with bulk SQL subquery (2 statements vs N*2)
121
- - `inspect.js` — all `SUM()` aggregations wrapped in `IFNULL(..., 0)` — no more `null` in charts
122
- - `migrate-137.js` — `PRAGMA table_info()` replaces brittle error-message string matching
123
-
124
- ## Gemini security review fixes (round 2 — applied)
125
- - `export-import.js` — Fix 1: `IN (...memIds)` placeholders replaced with SQL subqueries — no more 32,766 param limit crash on large exports
126
- - `export-import.js` — Fix 2: O(N) loop in `replace` mode replaced with bulk subquery deletes
127
- - `export-import.js` — Fix 3: checksum now hashes full memories payload — content/importance tampering now detectable
128
- - `export-import.js` — Fix 4: dangling edge guard — edges only inserted if both source and target exist in destination (`WHERE EXISTS`)
129
- - `export-import.js` — `edgesSkipped` added to import return value with console.warn for partial imports
130
-
131
- ## Gemini security review fixes (round 3 — applied)
132
- - `forget.js` — pinned edge orphan guard: blocks deleting a memory that shares
133
- a graph edge with a pinned memory — prevents silent MAGMA traversal corruption
134
- - `namespace.js` — SQLITE_BUSY retry loop: 3 attempts × 100ms using
135
- `Atomics.wait` (correct sync sleep for better-sqlite3) before propagating error
136
- - `export-import.js` — confirmed: empty bundle guard (line 103) already sits
137
- before checksum computation (line 107) — correct order, no change needed
138
-
139
- ## Total fixes across 3 Gemini review rounds: 13
package/LICENSE DELETED
@@ -1,33 +0,0 @@
1
- VEKTOR SLIPSTREAM — COMMERCIAL LICENCE
2
-
3
- Copyright (c) 2026 VEKTOR Memory (vektormemory.com)
4
-
5
- This software is licensed, not sold. Purchase of a Vektor Slipstream licence
6
- grants you a non-exclusive, non-transferable right to use this software in
7
- accordance with the following terms:
8
-
9
- PERMITTED:
10
- - Use in personal, commercial, and client projects
11
- - Embed in products you sell or SaaS platforms
12
- - Deploy on up to 3 machines per licence key
13
- - Modify for your own use (modifications are not redistributable)
14
-
15
- NOT PERMITTED:
16
- - Redistribute, resell, or sublicense this software
17
- - Remove or modify licence enforcement mechanisms
18
- - Share your licence key with others
19
- - Use in projects that compete directly with VEKTOR Memory
20
-
21
- LICENCE ENFORCEMENT:
22
- This software requires a valid licence key from vektormemory.com.
23
- Licence keys are validated via Polar (polar.sh) and cached locally.
24
- Each key activates on up to 3 machines.
25
-
26
- SOVEREIGNTY GUARANTEE:
27
- Core SDK functionality remains a one-time purchase permanently.
28
- No mandatory subscription will ever be required for the memory core,
29
- AUDN loop, REM cycle, or integration adapters included in this package.
30
-
31
- Purchase: https://vektormemory.com/product#pricing
32
- Support: hello@vektormemory.com
33
- Docs: https://vektormemory.com/docs
package/TENETS.md DELETED
@@ -1,189 +0,0 @@
1
- # The 8 Sovereign Laws of Vektor Slipstream
2
-
3
- Vektor Slipstream is built on a two-tier trust framework.
4
-
5
- **Tier 1 — Architectural Laws** are enforced by the code itself.
6
- You can verify every one of them by inspecting the source.
7
-
8
- **Tier 2 — Design Commitments** are the principles that shaped every
9
- engineering decision. They are auditable in how the system behaves,
10
- not enforced at runtime (except Law VIII, which is opt-in).
11
-
12
- ---
13
-
14
- ## Tier 1 — Architectural Laws
15
- *Enforced by the code. Verifiable by inspection.*
16
-
17
- ### Law I — Locality
18
- **Data never leaves your machine.**
19
-
20
- All memory operations read and write to a local SQLite file.
21
- No outbound network calls are made for memory storage, retrieval,
22
- or embedding. LLM inference uses the provider you configure under
23
- your own API key.
24
-
25
- **Verify it:**
26
- ```bash
27
- grep -r "fetch\|axios\|http\|https" src/slipstream-core.js | grep -v "provider"
28
- # Returns nothing — no outbound memory calls exist
29
- ```
30
-
31
- **In the code:** `createMemory({ dbPath })` — the only write path
32
- is the SQLite adapter. There is no cloud sync path in the codebase.
33
-
34
- ---
35
-
36
- ### Law II — Epistemological Hygiene
37
- **Every write passes through AUDN curation. No exceptions.**
38
-
39
- Every call to `memory.remember()` routes through the AUDN loop
40
- before writing. The system decides: ADD new info, UPDATE an existing
41
- node, DELETE a contradiction, or NO_OP if already known.
42
- Duplicates and drift are structurally impossible.
43
-
44
- **Verify it:**
45
- ```bash
46
- grep -n "remember" src/slipstream-core.js
47
- # Every path leads through audn() before any db.run()
48
- ```
49
-
50
- **In the code:** `memory.remember(text)` → `audn(text)` → `ADD | UPDATE | DELETE | NO_OP` → SQLite write
51
-
52
- ---
53
-
54
- ### Law III — Continual Synthesis
55
- **The REM cycle compresses. It never injects.**
56
-
57
- The 7-phase REM cycle only removes or consolidates existing memories.
58
- It never adds new information from external sources. Compression is
59
- one-way: fragments collapse into insights. The graph grows wiser,
60
- not larger.
61
-
62
- **Verify it:**
63
- ```bash
64
- grep -n "INSERT\|remember" src/rem.js
65
- # All INSERTs are rewrites of existing nodes — no external data source
66
- ```
67
-
68
- **In the code:** `memory.dream()` — reads the fragment pool, writes
69
- consolidated insights, tombstones the originals. No external fetch.
70
-
71
- ---
72
-
73
- ### Law IV — Object Permanence
74
- **Memory survives all session resets.**
75
-
76
- The SQLite graph persists across process restarts, provider changes,
77
- and agent redeployments. The `.db` file is the complete state.
78
- Backup is a file copy. Migration is a file move.
79
-
80
- **Verify it:**
81
- ```bash
82
- ls -lh ./your-agent.db
83
- # Kill the process. Restart. Memory is intact.
84
- ```
85
-
86
- **In the code:** `createMemory({ dbPath: './agent.db' })` —
87
- no in-memory-only state path exists. SQLite is the only store.
88
-
89
- ---
90
-
91
- ## Tier 2 — Design Commitments
92
- *Principles that shaped every engineering decision.
93
- Auditable in how the system behaves, not enforced at runtime.*
94
-
95
- ---
96
-
97
- ### Law V — Signal Purity
98
- **Retrieval returns relevance, not recency.**
99
-
100
- Recall is ranked by combined importance score and cosine similarity —
101
- not insertion order or timestamp. A memory from six months ago
102
- surfaces if it is more relevant than one from yesterday.
103
-
104
- **Auditable in:** `memory.recall()` ranking logic —
105
- `ORDER BY (importance_score * cos_similarity) DESC`,
106
- never `ORDER BY created_at DESC`.
107
-
108
- ---
109
-
110
- ### Law VI — Separation of Concerns
111
- **Memory and identity are separate systems.**
112
-
113
- The MAGMA graph holds what the agent knows.
114
- The Cloak vault holds who the agent is.
115
- These are separate storage systems with separate access paths.
116
- Compromising one does not compromise the other.
117
-
118
- **Auditable in:** `slipstream-memory.db` ≠ `vault.enc` —
119
- different files, different encryption keys, different access methods.
120
-
121
- ---
122
-
123
- ### Law VII — Harm Avoidance
124
- **No code path knowingly facilitates harm.**
125
-
126
- No feature in Vektor Slipstream is designed to enable surveillance,
127
- manipulation, or harm. This is a design commitment, not runtime
128
- enforcement. Operators are accountable for what their agents do
129
- with persistent memory.
130
-
131
- **Auditable in:** codebase review — no profiling, tracking, or
132
- behavioural manipulation primitives exist in the SDK.
133
-
134
- ---
135
-
136
- ### Law VIII — Injection Resistance *(opt-in enforcement)*
137
- **Prompt injection surface is minimised by design.
138
- Full enforcement is available on request.**
139
-
140
- AUDN prompt inputs are delimited before LLM evaluation.
141
- Recalled memories are clearly bounded in context to prevent
142
- bleed into system instructions.
143
-
144
- Full injection-shield screening is available as an opt-in flag
145
- for operators who require it. It adds approximately 80ms per write.
146
-
147
- ```js
148
- const memory = await createMemory({
149
- agentId: 'my-agent',
150
- licenceKey: process.env.VEKTOR_KEY,
151
- dbPath: './agent.db',
152
- sovereign: true // enables Law VIII enforcement
153
- });
154
- ```
155
-
156
- **Auditable in:** `sovereign.js` — input screening wrapper,
157
- loaded only when `sovereign: true` is passed to `createMemory()`.
158
-
159
- ---
160
-
161
- ## Boot confirmation
162
-
163
- When Vektor Slipstream initialises, the following is logged to confirm
164
- the laws are active:
165
-
166
- ```
167
- [vektor] Sovereign Agent active
168
- [vektor] Law I ✓ locality — no cloud sync path
169
- [vektor] Law II ✓ hygiene — AUDN on every write
170
- [vektor] Law III ✓ synthesis — REM compress-only
171
- [vektor] Law IV ✓ permanence — SQLite persists
172
- [vektor] Law VIII sovereign: true — injection shield active
173
- ```
174
-
175
- Laws V–VII are design commitments and are not logged at boot.
176
- Law VIII boot line only appears when `sovereign: true` is set.
177
-
178
- ---
179
-
180
- ## The contract
181
-
182
- Tier 1 laws are signed by the architecture.
183
- If any of them are ever violated by a future version of Vektor,
184
- that is a breaking change and will be documented as such in CHANGELOG.md.
185
-
186
- Tier 2 laws are signed by the team.
187
- They are the principles we will not compromise in future development.
188
-
189
- *Version: Slipstream 1.0.2 · Last updated: 2026-04-03*
package/audn-log.js DELETED
@@ -1,143 +0,0 @@
1
- /**
2
- * VEKTOR AUDN audit log — v1.3.7
3
- * Records every ADD/UPDATE/DELETE/NO_OP decision AUDN makes
4
- * before acting on it. Full transparency — nothing disappears silently.
5
- *
6
- * Schema additions required:
7
- * CREATE TABLE IF NOT EXISTS audn_log (
8
- * id INTEGER PRIMARY KEY AUTOINCREMENT,
9
- * agent_id TEXT NOT NULL,
10
- * namespace TEXT NOT NULL,
11
- * action TEXT NOT NULL, -- ADD | UPDATE | DELETE | NO_OP
12
- * memory_id TEXT, -- affected memory id (null for ADD before insert)
13
- * content TEXT, -- snapshot of content at time of action
14
- * reason TEXT, -- why AUDN made this decision
15
- * similarity REAL, -- similarity score that triggered the decision
16
- * ran_at INTEGER DEFAULT (unixepoch())
17
- * );
18
- * CREATE INDEX IF NOT EXISTS idx_audn_log_agent ON audn_log(agent_id, namespace, ran_at);
19
- */
20
-
21
- /**
22
- * logAudn — call this inside AUDN before executing each decision
23
- *
24
- * @param {object} db
25
- * @param {string} agentId
26
- * @param {string} namespace
27
- * @param {object} entry
28
- * @param {string} entry.action - ADD | UPDATE | DELETE | NO_OP
29
- * @param {string} entry.memoryId - memory id (if known)
30
- * @param {string} entry.content - content snapshot
31
- * @param {string} entry.reason - human-readable reason
32
- * @param {number} entry.similarity - cosine score that triggered this
33
- */
34
- export function logAudn(db, agentId, namespace, entry) {
35
- db.prepare(`
36
- INSERT INTO audn_log (agent_id, namespace, action, memory_id, content, reason, similarity)
37
- VALUES (?, ?, ?, ?, ?, ?, ?)
38
- `).run(
39
- agentId,
40
- namespace,
41
- entry.action,
42
- entry.memoryId || null,
43
- entry.content ? entry.content.slice(0, 500) : null,
44
- entry.reason || null,
45
- entry.similarity || null
46
- );
47
- }
48
-
49
- /**
50
- * auditLog(opts) — retrieve AUDN decision history
51
- *
52
- * @param {object} db
53
- * @param {string} agentId
54
- * @param {string} namespace
55
- * @param {object} opts
56
- * @param {number} opts.limit - max rows (default 50)
57
- * @param {string} opts.action - filter to specific action (ADD|UPDATE|DELETE|NO_OP)
58
- * @param {string} opts.since - time filter — '7d', '24h', ISO date
59
- * @returns {object[]}
60
- */
61
- export function auditLog(db, agentId, namespace, opts = {}) {
62
- const { limit = 50, action = null, since = null } = opts;
63
-
64
- let sinceTs = null;
65
- if (since) {
66
- const rel = String(since).match(/^(\d+)(d|h|m)$/);
67
- if (rel) {
68
- const n = parseInt(rel[1]);
69
- const unit = rel[2];
70
- const seconds = unit === 'd' ? n * 86400 : unit === 'h' ? n * 3600 : n * 60;
71
- sinceTs = Math.floor(Date.now() / 1000) - seconds;
72
- } else {
73
- sinceTs = Math.floor(Date.parse(since) / 1000);
74
- }
75
- }
76
-
77
- const actionClause = action ? `AND action = '${action.toUpperCase()}'` : '';
78
- const sinceClause = sinceTs ? `AND ran_at >= ${sinceTs}` : '';
79
-
80
- return db.prepare(`
81
- SELECT id, action, memory_id, content, reason, similarity, ran_at
82
- FROM audn_log
83
- WHERE agent_id = ? AND namespace = ?
84
- ${actionClause}
85
- ${sinceClause}
86
- ORDER BY ran_at DESC
87
- LIMIT ?
88
- `).all(agentId, namespace, limit);
89
- }
90
-
91
- /**
92
- * auditStats() — summary counts by action type
93
- */
94
- export function auditStats(db, agentId, namespace) {
95
- return db.prepare(`
96
- SELECT
97
- action,
98
- COUNT(*) as count,
99
- MAX(ran_at) as last_at
100
- FROM audn_log
101
- WHERE agent_id = ? AND namespace = ?
102
- GROUP BY action
103
- ORDER BY count DESC
104
- `).all(agentId, namespace);
105
- }
106
-
107
- /**
108
- * pruneAuditLog(days) — keep log from growing forever
109
- * Call from REM cycle or a scheduled job
110
- */
111
- export function pruneAuditLog(db, agentId, namespace, keepDays = 30) {
112
- const cutoff = Math.floor(Date.now() / 1000) - keepDays * 86400;
113
- const result = db.prepare(
114
- `DELETE FROM audn_log WHERE agent_id = ? AND namespace = ? AND ran_at < ?`
115
- ).run(agentId, namespace, cutoff);
116
- return { pruned: result.changes };
117
- }
118
-
119
- /**
120
- * Integration into Memory class / AUDN loop:
121
- *
122
- * // Inside AUDN decision logic:
123
- * logAudn(this.db, this.agentId, this.namespace, {
124
- * action: 'DELETE',
125
- * memoryId: existing.id,
126
- * content: existing.content,
127
- * reason: 'Contradicts newer memory with score 0.94',
128
- * similarity: 0.94
129
- * });
130
- * // then execute the delete
131
- *
132
- * // Expose on Memory class:
133
- * auditLog(opts = {}) {
134
- * return auditLog(this.db, this.agentId, this.namespace, opts);
135
- * }
136
- *
137
- * Usage:
138
- * memory.auditLog({ action: 'DELETE', since: '7d' });
139
- * // → [{ id, action:'DELETE', content:'...', reason:'...', ran_at }]
140
- *
141
- * memory.auditLog({ limit: 100 });
142
- * // → last 100 AUDN decisions
143
- */