ruvnet-kb-first 6.5.0 → 6.5.2

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.
@@ -4,14 +4,14 @@
4
4
  * Loads the embedded knowledge base into RvLite WASM.
5
5
  * Provides semantic search with ~5ms latency.
6
6
  *
7
- * Content Hash: 67818fd61d6327c3
8
- * Generated: 2026-01-02T18:29:18.233Z
9
- * Entries: 16,575
7
+ * Content Hash: 004c720e1d38de27
8
+ * Generated: 2026-01-02T18:55:18.300Z
9
+ * Entries: 17,524
10
10
  */
11
11
 
12
12
  import fs from 'fs';
13
13
  import path from 'path';
14
- import { fileURLToPath, pathToFileURL } from 'url';
14
+ import { fileURLToPath } from 'url';
15
15
 
16
16
  // Initialize WASM on first import
17
17
  let wasmInitialized = false;
@@ -22,9 +22,24 @@ async function ensureWasmInit() {
22
22
  // Dynamic import to get the init function
23
23
  const rvliteModule = await import('@ruvector/edge-full/rvlite');
24
24
 
25
- // Get the wasm file path
26
- const rvlitePath = path.dirname(fileURLToPath(import.meta.resolve('@ruvector/edge-full/rvlite')));
27
- const wasmPath = path.join(rvlitePath, 'rvlite_bg.wasm');
25
+ // Find the WASM file by walking up from this file to find node_modules
26
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
27
+ let searchDir = __dirname;
28
+ let wasmPath = null;
29
+
30
+ // Search for node_modules in parent directories
31
+ while (searchDir !== path.dirname(searchDir)) {
32
+ const candidatePath = path.join(searchDir, 'node_modules', '@ruvector', 'edge-full', 'rvlite', 'rvlite_bg.wasm');
33
+ if (fs.existsSync(candidatePath)) {
34
+ wasmPath = candidatePath;
35
+ break;
36
+ }
37
+ searchDir = path.dirname(searchDir);
38
+ }
39
+
40
+ if (!wasmPath) {
41
+ throw new Error('Could not find rvlite_bg.wasm in node_modules');
42
+ }
28
43
 
29
44
  // Read the wasm file and pass as buffer (Node.js compatible)
30
45
  const wasmBuffer = fs.readFileSync(wasmPath);
@@ -44,9 +59,9 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
44
59
 
45
60
  // KB Version Info
46
61
  export const KB_VERSION = {
47
- hash: '67818fd61d6327c3',
48
- exportedAt: '2026-01-02T18:29:18.233Z',
49
- totalEntries: 16575,
62
+ hash: '004c720e1d38de27',
63
+ exportedAt: '2026-01-02T18:55:18.300Z',
64
+ totalEntries: 17524,
50
65
  embeddingDim: 384,
51
66
  quantization: 'binary',
52
67
  };
@@ -1,58 +1,58 @@
1
1
  {
2
2
  "version": "1.0.0",
3
3
  "schema": "ask_ruvnet",
4
- "exportedAt": "2026-01-02T18:29:18.233Z",
5
- "totalEntries": 16575,
4
+ "exportedAt": "2026-01-02T18:55:18.300Z",
5
+ "totalEntries": 17524,
6
6
  "embeddingDim": 384,
7
7
  "quantization": "binary",
8
8
  "categories": [
9
9
  {
10
10
  "name": "general",
11
- "count": 8502
11
+ "count": 9042
12
12
  },
13
13
  {
14
14
  "name": "agents",
15
- "count": 4443
15
+ "count": 4628
16
16
  },
17
17
  {
18
18
  "name": "vector-db",
19
- "count": 882
19
+ "count": 885
20
20
  },
21
21
  {
22
22
  "name": "swarms",
23
- "count": 735
23
+ "count": 762
24
24
  },
25
25
  {
26
26
  "name": "neural",
27
- "count": 414
27
+ "count": 416
28
28
  },
29
29
  {
30
30
  "name": "mcp",
31
- "count": 259
31
+ "count": 296
32
32
  },
33
33
  {
34
- "name": "deployment",
35
- "count": 257
34
+ "name": "memory",
35
+ "count": 273
36
36
  },
37
37
  {
38
- "name": "sparc",
39
- "count": 236
38
+ "name": "deployment",
39
+ "count": 270
40
40
  },
41
41
  {
42
42
  "name": "github",
43
- "count": 214
43
+ "count": 256
44
44
  },
45
45
  {
46
- "name": "memory",
47
- "count": 206
46
+ "name": "sparc",
47
+ "count": 237
48
48
  },
49
49
  {
50
50
  "name": "performance",
51
- "count": 184
51
+ "count": 201
52
52
  },
53
53
  {
54
54
  "name": "security",
55
- "count": 127
55
+ "count": 139
56
56
  },
57
57
  {
58
58
  "name": "reinforcement-learning",
@@ -60,12 +60,12 @@
60
60
  },
61
61
  {
62
62
  "name": "llm",
63
- "count": 22
63
+ "count": 24
64
64
  },
65
65
  {
66
66
  "name": "consensus",
67
- "count": 13
67
+ "count": 14
68
68
  }
69
69
  ],
70
- "contentHash": "67818fd61d6327c3"
70
+ "contentHash": "004c720e1d38de27"
71
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ruvnet-kb-first",
3
- "version": "6.5.0",
3
+ "version": "6.5.2",
4
4
  "description": "RuvNet KB-First Application Builder - Build intelligent applications on expert knowledge",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -13,12 +13,14 @@
13
13
  "dev": "tsc --watch",
14
14
  "start": "node bin/kb-first.js",
15
15
  "mcp": "node src/mcp-server.js",
16
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
16
+ "test": "node tests/run-wasm-tests.js",
17
+ "test:wasm": "node tests/run-wasm-tests.js",
17
18
  "lint": "eslint src/ templates/",
18
19
  "kb:init": "node bin/kb-first.js init",
19
20
  "kb:score": "node bin/kb-first.js score",
20
21
  "kb:verify": "node bin/kb-first.js verify",
21
22
  "kb:status": "node bin/kb-first.js status",
23
+ "kb:export": "node scripts/kb-export-wasm.js --schema ask_ruvnet --output kb-data/",
22
24
  "prepublishOnly": "echo 'Publishing ruvnet-kb-first...'"
23
25
  },
24
26
  "keywords": [
@@ -49,7 +51,7 @@
49
51
  },
50
52
  "dependencies": {
51
53
  "@ruvector/edge-full": "^0.1.0",
52
- "agentic-flow": "^2.0.1-alpha.43",
54
+ "agentic-flow": "^2.0.1-alpha.50",
53
55
  "chalk": "^5.3.0",
54
56
  "claude-flow": "^2.7.47",
55
57
  "commander": "^12.0.0",
@@ -59,7 +61,7 @@
59
61
  "ora": "^8.0.0",
60
62
  "pg": "^8.16.3",
61
63
  "ruv-swarm": "^1.0.20",
62
- "ruvector": "^0.1.82"
64
+ "ruvector": "^0.1.94"
63
65
  },
64
66
  "devDependencies": {
65
67
  "@types/jest": "^29.5.11",
@@ -122,7 +122,6 @@ async function exportKB(schema, outputDir) {
122
122
  const entries = [];
123
123
  const embeddings = [];
124
124
  let offset = 0;
125
- let hashInput = '';
126
125
 
127
126
  console.log(`\n Exporting chunks...`);
128
127
 
@@ -155,9 +154,6 @@ async function exportKB(schema, outputDir) {
155
154
  } else {
156
155
  embeddings.push(new Float32Array(embeddingArray));
157
156
  }
158
-
159
- // Add to hash input
160
- hashInput += `${row.id}:${row.title}:${row.category}|`;
161
157
  }
162
158
 
163
159
  offset += CONFIG.export.chunkSize;
@@ -167,8 +163,13 @@ async function exportKB(schema, outputDir) {
167
163
 
168
164
  console.log('\n');
169
165
 
170
- // Compute content hash
171
- metadata.contentHash = crypto.createHash('sha256').update(hashInput).digest('hex').substring(0, 16);
166
+ // Compute content hash using MD5 (matches PostgreSQL checkForUpdates query)
167
+ const hashResult = await client.query(`
168
+ SELECT MD5(STRING_AGG(id::text || ':' || title || ':' || category, '|' ORDER BY id))::text as hash
169
+ FROM ${schema}.architecture_docs
170
+ WHERE embedding IS NOT NULL AND is_duplicate = false
171
+ `);
172
+ metadata.contentHash = hashResult.rows[0]?.hash?.substring(0, 16) || 'unknown';
172
173
  console.log(` Content Hash: ${metadata.contentHash}`);
173
174
 
174
175
  // Write metadata