refactor(synapse): backend updates, add icons module, relocate playbooks to data/playbooks

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jon
2026-07-11 07:25:08 -05:00
parent 3ec57f9140
commit f4f77c5196
24 changed files with 1820 additions and 288 deletions
Regular → Executable
+12 -8
View File
@@ -15,6 +15,12 @@ except Exception:
# --- PROJECT ROOT ---
PROJECT_ROOT = Path(__file__).resolve().parent.parent
# --- VERSION (single source of truth: the VERSION file at the repo root) ---
try:
VERSION = (PROJECT_ROOT / "VERSION").read_text(encoding="utf-8").strip() or "0.0.0"
except Exception:
VERSION = "0.0.0"
# --- CORE DIRECTORIES ---
DATA_DIR = PROJECT_ROOT / "data"
MODELS_DIR = PROJECT_ROOT / "models"
@@ -27,16 +33,15 @@ CACHE_DIR = RUNTIME_DIR / "cache"
TEMP_DIR = RUNTIME_DIR / "tmp"
# --- APPLICATION SUBSYSTEM DIRECTORIES ---
PLAYBOOK_DIR = PROJECT_ROOT / "synapse" / "playbooks"
PLAYBOOK_DIR = DATA_DIR / "playbooks" # YAML playbook files (PlaybookFileStore)
UPLOADS_DIR = DATA_DIR / "uploads"
EXPORTS_DIR = DATA_DIR / "exports"
# --- DATABASE / STORAGE FILES (match your repo) ---
MEMORY_DB = MEMORY_DIR / "memory.db"
PLAYBOOK_DB = MEMORY_DB # same file in your setup
# --- LOG FILES ---
BACKEND_LOG = LOGS_DIR / "backend.log"
BACKEND_LOG = RUNTIME_DIR / "backend.log"
OLLAMA_LOG = LOGS_DIR / "ollama.log"
CHAT_LOG = LOGS_DIR / "chat.log"
@@ -73,7 +78,6 @@ def path(name: str) -> Path:
"uploads": UPLOADS_DIR,
"exports": EXPORTS_DIR,
"memory_db": MEMORY_DB,
"playbook_db": PLAYBOOK_DB,
"backend_log": BACKEND_LOG,
"ollama_log": OLLAMA_LOG,
"chat_log": CHAT_LOG,
@@ -90,6 +94,7 @@ class Settings:
or `Settings` class for typing/tests.
"""
def __init__(self) -> None:
self.version: str = VERSION
self.project_root: Path = PROJECT_ROOT
self.data_dir: Path = DATA_DIR
self.models_dir: Path = MODELS_DIR
@@ -99,7 +104,6 @@ class Settings:
# DB files
self.memory_db: Path = MEMORY_DB
self.playbook_db: Path = PLAYBOOK_DB
# Logs
self.backend_log: Path = BACKEND_LOG
@@ -112,13 +116,13 @@ class Settings:
def as_dict(self) -> Dict[str, Any]:
return {
"version": self.version,
"project_root": str(self.project_root),
"data_dir": str(self.data_dir),
"models_dir": str(self.models_dir),
"runtime_dir": str(self.runtime_dir),
"memory_dir": str(self.memory_dir),
"memory_db": str(self.memory_db),
"playbook_db": str(self.playbook_db),
"ollama_host": self.ollama_host,
"ollama_timeout": self.ollama_timeout,
}
@@ -127,10 +131,10 @@ class Settings:
settings = Settings()
# explicit exports for static checkers and IDEs
__all__ = ["Settings", "settings", "path",
__all__ = ["Settings", "settings", "path", "VERSION",
"PROJECT_ROOT", "DATA_DIR", "MODELS_DIR", "RUNTIME_DIR",
"MEMORY_DIR", "LOGS_DIR", "PLAYBOOK_DIR", "UPLOADS_DIR",
"EXPORTS_DIR", "MEMORY_DB", "PLAYBOOK_DB",
"EXPORTS_DIR", "MEMORY_DB",
"BACKEND_LOG", "OLLAMA_LOG", "CHAT_LOG"]
# --- quick runtime sanity check when run directly (no side effects on import) ---