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
+7 -18
View File
@@ -1,11 +1,8 @@
import threading
from typing import List
from .playbooks.store import playbook_store, PlaybookItem
class PlaybookManager:
_lock = threading.Lock()
@classmethod
def _all(cls) -> List[PlaybookItem]:
"""Return all playbooks sorted by order (position 0 is always main)."""
@@ -25,18 +22,10 @@ class PlaybookManager:
@classmethod
def get_system_prompt(cls) -> str:
playbook = cls.get_main_playbook()
return getattr(playbook, "instructions", "") or "" if playbook else ""
@classmethod
def render_prompt(cls, user_message: str, variables: dict | None = None) -> str:
if not variables:
return user_message
result = user_message
for key, value in variables.items():
result = result.replace(f"{{{{{key}}}}}", str(value))
return result
# Keep old name as alias so nothing else breaks
@classmethod
def get_active_playbook(cls) -> PlaybookItem | None:
return cls.get_main_playbook()
if not playbook:
return ""
goal = (getattr(playbook, "goal", "") or "").strip()
instructions = (getattr(playbook, "instructions", "") or "").strip()
if goal and instructions:
return f"{goal}\n\n{instructions}"
return goal or instructions