superlocalmemory 3.0.0 → 3.0.1
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/bin/slm-npm +62 -48
- package/package.json +1 -1
package/bin/slm-npm
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* SuperLocalMemory
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2026 Varun Pratap Bhardwaj
|
|
6
|
-
* Solution Architect & Original Creator
|
|
3
|
+
* SuperLocalMemory V3 - NPM Global CLI Wrapper
|
|
7
4
|
*
|
|
5
|
+
* Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
|
|
8
6
|
* Licensed under MIT License (see LICENSE file)
|
|
9
|
-
* Repository: https://github.com/
|
|
10
|
-
*
|
|
11
|
-
* ATTRIBUTION REQUIRED: This notice must be preserved in all copies.
|
|
7
|
+
* Repository: https://github.com/qualixar/superlocalmemory
|
|
12
8
|
*/
|
|
13
9
|
|
|
14
10
|
const { spawnSync } = require('child_process');
|
|
@@ -16,58 +12,76 @@ const path = require('path');
|
|
|
16
12
|
const os = require('os');
|
|
17
13
|
const fs = require('fs');
|
|
18
14
|
|
|
19
|
-
//
|
|
20
|
-
const
|
|
15
|
+
// V3 package root (where src/superlocalmemory/ lives)
|
|
16
|
+
const PKG_ROOT = path.join(__dirname, '..');
|
|
17
|
+
const SRC_DIR = path.join(PKG_ROOT, 'src');
|
|
18
|
+
const CLI_MODULE = 'superlocalmemory.cli.main';
|
|
21
19
|
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
// Find Python 3 binary (robust multi-fallback detection)
|
|
21
|
+
function findPython() {
|
|
22
|
+
const candidates = [
|
|
23
|
+
'python3',
|
|
24
|
+
'python',
|
|
25
|
+
'/opt/homebrew/bin/python3',
|
|
26
|
+
'/usr/local/bin/python3',
|
|
27
|
+
'/usr/bin/python3',
|
|
28
|
+
];
|
|
27
29
|
|
|
30
|
+
// On Windows, also check common locations
|
|
28
31
|
if (os.platform() === 'win32') {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
candidates.push(
|
|
33
|
+
'py -3',
|
|
34
|
+
path.join(process.env.LOCALAPPDATA || '', 'Programs', 'Python', 'Python312', 'python.exe'),
|
|
35
|
+
path.join(process.env.LOCALAPPDATA || '', 'Programs', 'Python', 'Python311', 'python.exe'),
|
|
36
|
+
);
|
|
32
37
|
}
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
for (const candidate of candidates) {
|
|
40
|
+
try {
|
|
41
|
+
const parts = candidate.split(' ');
|
|
42
|
+
const result = spawnSync(parts[0], [...parts.slice(1), '--version'], {
|
|
43
|
+
stdio: 'pipe',
|
|
44
|
+
timeout: 5000,
|
|
45
|
+
});
|
|
46
|
+
if (result.status === 0) {
|
|
47
|
+
const version = (result.stdout || '').toString().trim();
|
|
48
|
+
if (version.includes('3.')) {
|
|
49
|
+
return candidate;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} catch (e) {
|
|
53
|
+
// Try next candidate
|
|
54
|
+
}
|
|
42
55
|
}
|
|
43
|
-
|
|
44
|
-
slmScript = path.join(SLM_DIR, 'bin', 'slm');
|
|
56
|
+
return null;
|
|
45
57
|
}
|
|
46
58
|
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
// Ensure ~/.superlocalmemory/ exists
|
|
60
|
+
const SLM_HOME = process.env.SL_MEMORY_PATH || path.join(os.homedir(), '.superlocalmemory');
|
|
61
|
+
if (!fs.existsSync(SLM_HOME)) {
|
|
62
|
+
fs.mkdirSync(SLM_HOME, { recursive: true });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Find Python
|
|
66
|
+
const python = findPython();
|
|
67
|
+
if (!python) {
|
|
68
|
+
console.error('Error: Python 3.11+ not found.');
|
|
69
|
+
console.error('Install Python from https://python.org/downloads/');
|
|
51
70
|
process.exit(1);
|
|
52
71
|
}
|
|
53
72
|
|
|
54
|
-
//
|
|
73
|
+
// Launch V3 CLI via Python module
|
|
55
74
|
const args = process.argv.slice(2);
|
|
75
|
+
const pythonParts = python.split(' ');
|
|
76
|
+
const result = spawnSync(pythonParts[0], [
|
|
77
|
+
...pythonParts.slice(1),
|
|
78
|
+
'-m', CLI_MODULE, ...args
|
|
79
|
+
], {
|
|
80
|
+
stdio: 'inherit',
|
|
81
|
+
env: {
|
|
82
|
+
...process.env,
|
|
83
|
+
PYTHONPATH: SRC_DIR + (process.env.PYTHONPATH ? path.delimiter + process.env.PYTHONPATH : ''),
|
|
84
|
+
},
|
|
85
|
+
});
|
|
56
86
|
|
|
57
|
-
// Use spawnSync for secure execution (no shell injection risk)
|
|
58
|
-
let result;
|
|
59
|
-
if (os.platform() === 'win32') {
|
|
60
|
-
// Windows: Use cmd or PowerShell
|
|
61
|
-
result = spawnSync(slmScript, args, {
|
|
62
|
-
stdio: 'inherit',
|
|
63
|
-
shell: true
|
|
64
|
-
});
|
|
65
|
-
} else {
|
|
66
|
-
// Mac/Linux: Direct bash execution
|
|
67
|
-
result = spawnSync('bash', [slmScript, ...args], {
|
|
68
|
-
stdio: 'inherit'
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Exit with the same code as the child process
|
|
73
87
|
process.exit(result.status || 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superlocalmemory",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Information-geometric agent memory with mathematical guarantees. 4-channel retrieval, Fisher-Rao similarity, zero-LLM mode, EU AI Act compliant. Works with Claude, Cursor, Windsurf, and 17+ AI tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-memory",
|