~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
chore: Remove debug scripts that were used for troubleshooting
LearningCircuite526a4f659a9
diff --git a/scripts/audit_sqlcipher_usage.py b/scripts/audit_sqlcipher_usage.pydeleted file mode 100644index b974e7eb04..0000000000--- a/scripts/audit_sqlcipher_usage.py+++ /dev/null@@ -1,141 +0,0 @@-#!/usr/bin/env python3-"""-Audit script to find all SQLCipher database access patterns-and identify which ones need to use centralized utilities.-"""--import re-from pathlib import Path-from typing import List--# Patterns to search for-PATTERNS = {- "pragma_key": [- r"PRAGMA\s+key\s*=",- r"execute.*PRAGMA\s+key",- r"\.execute\(.*key.*=",- ],- "pragma_rekey": [- r"PRAGMA\s+rekey\s*=",- r"execute.*PRAGMA\s+rekey",- ],- "cipher_pragmas": [- r"PRAGMA\s+cipher_page_size",- r"PRAGMA\s+kdf_iter",- r"PRAGMA\s+cipher_memory_security",- r"PRAGMA\s+cipher_hmac_algorithm",- r"PRAGMA\s+cipher_kdf_algorithm",- ],- "sqlcipher_connect": [- r"sqlcipher3\.connect",- r"import\s+sqlcipher3",- ],- "password_handling": [- r"password\.replace\(",- r"password\.encode\(",- r"hex_password",- r"escaped_password",- ],-}---def find_files(root_dir: Path, extensions: List[str]) -> List[Path]:- """Find all Python files in the project."""- files = []- for ext in extensions:- files.extend(root_dir.rglob(f"*{ext}"))- return [- f for f in files if "venv" not in str(f) and "__pycache__" not in str(f)- ]---def search_patterns(file_path: Path, patterns: dict) -> dict:- """Search for patterns in a file."""- try:- with open(file_path, "r", encoding="utf-8") as f:- content = f.read()- lines = content.split("\n")- except Exception as e:- print(f"Error reading {file_path}: {e}")- return {}-- results = {}- for category, pattern_list in patterns.items():- matches = []- for pattern in pattern_list:- for i, line in enumerate(lines, 1):- if re.search(pattern, line, re.IGNORECASE):- matches.append((i, line.strip()))- if matches:- results[category] = matches-- return results---def main():- # Project root- project_root = Path(__file__).parent.parent / "src" / "local_deep_research"-- print("🔍 Auditing SQLCipher usage in Local Deep Research")- print("=" * 70)-- # Find all Python files- files = find_files(project_root, [".py"])- print(f"Found {len(files)} Python files to analyze\n")-- # Files that should be using centralized utilities- files_needing_update = []-- # Analyze each file- for file_path in sorted(files):- results = search_patterns(file_path, PATTERNS)-- if results:- relative_path = file_path.relative_to(project_root)-- # Skip sqlcipher_utils.py itself- if "sqlcipher_utils.py" in str(file_path):- continue-- # Check if this file is already using centralized utils- content = file_path.read_text()- uses_utils = (- "from .sqlcipher_utils import" in content- or "from ..database.sqlcipher_utils import" in content- )-- print(f"\n📄 {relative_path}")- if uses_utils:- print(" ✅ Already imports sqlcipher_utils")- else:- print(" ⚠️ Not using centralized utilities")- files_needing_update.append(relative_path)-- for category, matches in results.items():- print(f"\n {category}:")- for line_num, line in matches[:3]: # Show first 3 matches- print(f" Line {line_num}: {line[:80]}...")- if len(matches) > 3:- print(f" ... and {len(matches) - 3} more matches")-- # Summary- print("\n" + "=" * 70)- print("📊 Summary:")- print(f" Total files analyzed: {len(files)}")- print(f" Files needing update: {len(files_needing_update)}")-- if files_needing_update:- print("\n📝 Files that should use centralized SQLCipher utilities:")- for f in sorted(files_needing_update):- print(f" - {f}")-- # Generate update suggestions- print("\n💡 Suggested updates:")- print(" 1. Import sqlcipher_utils in files that directly use SQLCipher")- print(" 2. Replace direct PRAGMA key calls with set_sqlcipher_key()")- print(" 3. Replace cipher PRAGMA settings with apply_sqlcipher_pragmas()")- print(" 4. Use create_sqlcipher_connection() for new connections")---if __name__ == "__main__":- main()diff --git a/scripts/debug_db_open.py b/scripts/debug_db_open.pydeleted file mode 100644index 01de764376..0000000000--- a/scripts/debug_db_open.py+++ /dev/null@@ -1,103 +0,0 @@-#!/usr/bin/env python3-"""Debug database opening issues."""--import sys-from pathlib import Path-import hashlib--# Add parent directory to path-sys.path.insert(0, str(Path(__file__).parent.parent))--from src.local_deep_research.database.sqlcipher_utils import (- set_sqlcipher_key,- apply_sqlcipher_pragmas,-)---def get_user_hash(username: str) -> str:- """Get the hash for a username."""- return hashlib.sha256(username.encode()).hexdigest()[:16]---def test_open_database(username: str, password: str):- """Test opening a database with different methods."""- print(f"\n🔍 Testing database access for: {username}")- print(" Password: [REDACTED]")-- # Find the database file- user_hash = get_user_hash(username)- db_path = (- Path.home()- / ".local/share/local-deep-research/encrypted_databases"- / f"ldr_user_{user_hash}.db"- )-- print(f"\n1. Looking for database at: {db_path}")- if not db_path.exists():- print(" ❌ Database file not found")- return-- print(f" ✅ Database exists: {db_path.stat().st_size} bytes")-- # Test with raw sqlcipher3- print("\n2. Testing with raw sqlcipher3...")- try:- import sqlcipher3-- # Test 1: With hex encoding- print("\n a) With hex encoding:")- conn = sqlcipher3.connect(str(db_path))- cursor = conn.cursor()-- try:- set_sqlcipher_key(cursor, password)- apply_sqlcipher_pragmas(cursor, creation_mode=False)-- # Test query- cursor.execute(- "SELECT name FROM sqlite_master WHERE type='table' LIMIT 5"- )- tables = cursor.fetchall()- print(f" ✅ Success! Found {len(tables)} tables")- for table in tables[:5]:- print(f" - {table[0]}")- except Exception as e:- print(f" ❌ Failed: {e}")- finally:- conn.close()-- # Test 2: With plain password (old way)- print("\n b) With plain password (old way):")- conn = sqlcipher3.connect(str(db_path))- cursor = conn.cursor()-- try:- cursor.execute(f"PRAGMA key = '{password}'")- cursor.execute(- "SELECT name FROM sqlite_master WHERE type='table' LIMIT 5"- )- tables = cursor.fetchall()- print(f" ✅ Success! Found {len(tables)} tables")- for table in tables[:5]:- print(f" - {table[0]}")- except Exception as e:- print(f" ❌ Failed: {e}")- finally:- conn.close()-- except ImportError:- print(" ❌ sqlcipher3 not available")- except Exception as e:- print(f" ❌ Error: {e}")- import traceback-- traceback.print_exc()---def main():- """Test the latest user."""- test_open_database("simple_1751323627595", "password")---if __name__ == "__main__":- main()