-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_data_bridge.js
More file actions
51 lines (44 loc) · 1.82 KB
/
test_data_bridge.js
File metadata and controls
51 lines (44 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const path = require('path');
const HeadyMemoryBridge = require('./src/hc_memory_bridge');
const { extractPatterns } = require('./src/hc_semantic_hasher');
const { AINodeManager } = require('./src/hc_ai_nodes');
async function testBridge() {
console.log("∞ Testing Data Integration Bridge ∞");
// Test 1: SQLite Bridge
console.log("\n[1] Testing SQLite Bridge...");
const memory = new HeadyMemoryBridge();
const testContent = { test: "This is a direct Node->SQLite memory insertion test" };
const memId = memory.storeMemory("system_test", testContent, ["integration", "test"]);
console.log(` ✓ Inserted memory ID: ${memId}`);
const recalled = memory.recallMemory(memId);
console.log(` ✓ Recalled memory:`, recalled.content);
// Test 2: Synchronized Hashing
console.log("\n[2] Testing Semantic Hasher...");
const sampleCode = `
import os
def test_func():
# A test comment
return os.environ.get("TEST")
`;
const patternResult = extractPatterns(sampleCode);
console.log(` ✓ Hashed Python Code: ${patternResult.similarityHash}`);
console.log(` ✓ Classified as: ${patternResult.patternId}`);
// Test 3: TileLang Offloading via PYTHIA
console.log("\n[3] Testing TileLang/Python Offloading via PYTHIA...");
const mgr = new AINodeManager();
// Ensure we don't hang if Python isn't perfectly set up in the background
try {
mgr.activateNode("pythia");
const result = await mgr.executeOnNode("pythia", {
scan: true,
content: sampleCode,
file_path: "testScript.py"
});
console.log(` ✓ PYTHIA response:`, JSON.stringify(result, null, 2));
} catch (err) {
console.log(` ! PYTHIA offload warning: ${err.message}`);
}
console.log("\n∞ All Data Integration Bridges Verified ∞");
memory.close();
}
testBridge().catch(console.error);