superlocalmemory 3.2.0 → 3.2.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/CHANGELOG.md CHANGED
@@ -16,6 +16,18 @@ SuperLocalMemory V3 - Intelligent local memory system for AI coding assistants.
16
16
 
17
17
  ---
18
18
 
19
+ ## [3.2.1] - 2026-03-26
20
+
21
+ ### Fixed
22
+ - **Windows `slm --version` / `slm -v`** — `.bat` and `.cmd` wrappers now intercept `--version`/`-v` directly (fast path, no Python needed) and set `PYTHONPATH` to the npm package's `src/` directory before launching Python. Previously, Windows users hitting `slm.bat` instead of the Node.js wrapper got `unrecognized arguments: --version` because Python resolved an older pip-installed version without the flag.
23
+ - **Unix bash wrapper** (`bin/slm`) — now sets `PYTHONPATH` and intercepts `--version`/`-v`, matching the Node.js wrapper's behavior. Previously relied on npm's shim always routing to `slm-npm`.
24
+ - **`postinstall.js`** — now runs `pip install .` to install the `superlocalmemory` Python package itself (not just dependencies). Prevents stale pip-installed versions from shadowing the npm-distributed source. Falls back to `--user` for PEP 668 environments.
25
+ - **`preuninstall.js`** — corrected version string from "V2" to "V3".
26
+ - **Windows Python detection** — added `py -3` (Python Launcher for Windows) as a fallback candidate in `slm.bat`.
27
+ - **Environment parity** — all three entry points (`slm-npm`, `slm`, `slm.bat`) now set identical PyTorch memory-prevention env vars (`PYTORCH_MPS_HIGH_WATERMARK_RATIO`, `TORCH_DEVICE`, etc.).
28
+
29
+ ---
30
+
19
31
  ## [3.2.0] - 2026-03-26
20
32
 
21
33
  ### Added
package/bin/slm CHANGED
@@ -2,6 +2,19 @@
2
2
  # SuperLocalMemory V3 CLI
3
3
  # Part of Qualixar | https://superlocalmemory.com
4
4
 
5
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6
+ PKG_ROOT="$(dirname "$SCRIPT_DIR")"
7
+ SRC_DIR="$PKG_ROOT/src"
8
+
9
+ # Handle --version / -v directly (fast path)
10
+ for arg in "$@"; do
11
+ if [ "$arg" = "--version" ] || [ "$arg" = "-v" ]; then
12
+ VER=$(grep '"version"' "$PKG_ROOT/package.json" 2>/dev/null | head -1 | sed 's/.*"\([0-9][0-9.]*\)".*/\1/')
13
+ echo "superlocalmemory ${VER:-unknown}"
14
+ exit 0
15
+ fi
16
+ done
17
+
5
18
  # Find Python
6
19
  PYTHON=""
7
20
  for cmd in python3 python; do
@@ -12,9 +25,24 @@ for cmd in python3 python; do
12
25
  done
13
26
 
14
27
  if [ -z "$PYTHON" ]; then
15
- echo "Error: Python 3 not found. Install Python 3.10+ from python.org"
28
+ echo "Error: Python 3 not found. Install Python 3.11+ from python.org"
16
29
  exit 1
17
30
  fi
18
31
 
32
+ # Set PYTHONPATH so Python finds the npm package's src/ directory
33
+ if [ -n "$PYTHONPATH" ]; then
34
+ export PYTHONPATH="$SRC_DIR:$PYTHONPATH"
35
+ else
36
+ export PYTHONPATH="$SRC_DIR"
37
+ fi
38
+
39
+ # Prevent PyTorch Metal/MPS GPU memory reservation
40
+ export PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0
41
+ export PYTORCH_MPS_MEM_LIMIT=0
42
+ export PYTORCH_ENABLE_MPS_FALLBACK=1
43
+ export TOKENIZERS_PARALLELISM=false
44
+ export TORCH_DEVICE=cpu
45
+ export CUDA_VISIBLE_DEVICES=""
46
+
19
47
  # Run V3 CLI
20
48
  exec "$PYTHON" -m superlocalmemory.cli.main "$@"
package/bin/slm.bat CHANGED
@@ -6,22 +6,60 @@ REM Repository: https://github.com/qualixar/superlocalmemory
6
6
 
7
7
  setlocal enabledelayedexpansion
8
8
 
9
+ REM Resolve the package src/ directory for PYTHONPATH
10
+ set "SLM_PKG_DIR=%~dp0..\src"
11
+
12
+ REM Handle --version / -v directly (fast path, no Python needed)
13
+ if "%~1"=="--version" goto :show_version
14
+ if "%~1"=="-v" goto :show_version
15
+
9
16
  REM Find Python 3
10
- where python3 >/dev/null 2>&1
17
+ where python3 >nul 2>&1
11
18
  if %ERRORLEVEL% EQU 0 (
12
19
  set PYTHON_CMD=python3
13
20
  goto :run
14
21
  )
15
- where python >/dev/null 2>&1
22
+ where python >nul 2>&1
16
23
  if %ERRORLEVEL% EQU 0 (
17
24
  set PYTHON_CMD=python
18
25
  goto :run
19
26
  )
27
+ where py >nul 2>&1
28
+ if %ERRORLEVEL% EQU 0 (
29
+ set PYTHON_CMD=py -3
30
+ goto :run
31
+ )
20
32
 
21
33
  echo Error: Python 3.11+ not found.
22
34
  echo Install from: https://python.org/downloads/
23
35
  exit /b 1
24
36
 
37
+ :show_version
38
+ REM Read version from package.json via findstr
39
+ for /f "tokens=2 delims=:," %%a in ('findstr /C:"\"version\"" "%~dp0..\package.json"') do (
40
+ set "VER=%%~a"
41
+ set "VER=!VER: =!"
42
+ echo superlocalmemory !VER!
43
+ exit /b 0
44
+ )
45
+ echo superlocalmemory unknown
46
+ exit /b 0
47
+
25
48
  :run
49
+ REM Set PYTHONPATH so Python finds the npm package's src/ directory
50
+ if defined PYTHONPATH (
51
+ set "PYTHONPATH=%SLM_PKG_DIR%;%PYTHONPATH%"
52
+ ) else (
53
+ set "PYTHONPATH=%SLM_PKG_DIR%"
54
+ )
55
+
56
+ REM Prevent PyTorch Metal/MPS GPU memory reservation
57
+ set "PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0"
58
+ set "PYTORCH_MPS_MEM_LIMIT=0"
59
+ set "PYTORCH_ENABLE_MPS_FALLBACK=1"
60
+ set "TOKENIZERS_PARALLELISM=false"
61
+ set "TORCH_DEVICE=cpu"
62
+ set "CUDA_VISIBLE_DEVICES="
63
+
26
64
  %PYTHON_CMD% -m superlocalmemory.cli.main %*
27
65
  exit /b %ERRORLEVEL%
package/bin/slm.cmd CHANGED
@@ -1,5 +1,5 @@
1
1
  @echo off
2
2
  REM SuperLocalMemory V3 - Windows CLI (CMD variant)
3
- REM Calls slm.bat for compatibility
3
+ REM Delegates to slm.bat which handles PYTHONPATH and --version
4
4
  call "%~dp0slm.bat" %*
5
5
  exit /b %ERRORLEVEL%
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superlocalmemory",
3
- "version": "3.2.0",
3
+ "version": "3.2.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",
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "superlocalmemory"
3
- version = "3.2.0"
3
+ version = "3.2.1"
4
4
  description = "Information-geometric agent memory with mathematical guarantees"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -157,6 +157,39 @@ if (pipInstall(perfDeps, 'performance')) {
157
157
  console.log('⚠ Performance deps skipped (system works fine without them).');
158
158
  }
159
159
 
160
+ // --- Step 3b: Install the superlocalmemory package itself ---
161
+ // This ensures `python -m superlocalmemory.cli.main` always resolves the
162
+ // correct version, even when invoked outside the Node.js wrapper (e.g.,
163
+ // via slm.bat on Windows or direct Python invocation).
164
+ console.log('\nInstalling superlocalmemory Python package...');
165
+ const pkgRoot = path.join(__dirname, '..');
166
+ const pipInstallPkg = spawnSync(pythonParts[0], [
167
+ ...pythonParts.slice(1), '-m', 'pip', 'install', '--quiet', '--disable-pip-version-check',
168
+ pkgRoot,
169
+ ], { stdio: 'pipe', timeout: 300000, env: { ...process.env, PATH: '/opt/homebrew/bin:/usr/local/bin:/usr/bin:' + (process.env.PATH || '') } });
170
+
171
+ if (pipInstallPkg.status === 0) {
172
+ console.log('✓ SuperLocalMemory Python package installed');
173
+ } else {
174
+ // Try with --user if PEP 668
175
+ const stderr = (pipInstallPkg.stderr || '').toString();
176
+ if (stderr.includes('externally-managed') || stderr.includes('PEP 668')) {
177
+ const retryResult = spawnSync(pythonParts[0], [
178
+ ...pythonParts.slice(1), '-m', 'pip', 'install', '--quiet', '--disable-pip-version-check',
179
+ '--user', pkgRoot,
180
+ ], { stdio: 'pipe', timeout: 300000, env: { ...process.env, PATH: '/opt/homebrew/bin:/usr/local/bin:/usr/bin:' + (process.env.PATH || '') } });
181
+ if (retryResult.status === 0) {
182
+ console.log('✓ SuperLocalMemory Python package installed (--user)');
183
+ } else {
184
+ console.log('⚠ Could not pip install the package. The Node.js wrapper (slm-npm)');
185
+ console.log(' sets PYTHONPATH automatically, so CLI will still work.');
186
+ }
187
+ } else {
188
+ console.log('⚠ Could not pip install the package. The Node.js wrapper (slm-npm)');
189
+ console.log(' sets PYTHONPATH automatically, so CLI will still work.');
190
+ }
191
+ }
192
+
160
193
  // --- Step 4: Detect V2 installation ---
161
194
  const V2_HOME = path.join(os.homedir(), '.claude-memory');
162
195
  if (fs.existsSync(V2_HOME) && fs.existsSync(path.join(V2_HOME, 'memory.db'))) {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * SuperLocalMemory V2 - NPM Preuninstall Script
3
+ * SuperLocalMemory V3 - NPM Preuninstall Script
4
4
  *
5
5
  * Copyright (c) 2026 Varun Pratap Bhardwaj
6
6
  * Solution Architect & Original Creator
@@ -16,7 +16,7 @@ const os = require('os');
16
16
  const fs = require('fs');
17
17
 
18
18
  console.log('\n════════════════════════════════════════════════════════════');
19
- console.log(' SuperLocalMemory V2 - Uninstalling');
19
+ console.log(' SuperLocalMemory V3 - Uninstalling');
20
20
  console.log('════════════════════════════════════════════════════════════\n');
21
21
 
22
22
  const SLM_DIR = path.join(os.homedir(), '.superlocalmemory');