Files
NexusOS/synapse/playbook_manager.py
T
janvanwan 42eaed647a feat: sync with upstream — v1.2.0, in-app updates, Projects, modules
Brings the public tree back in line with the development repo after several
weeks of drift caused by a stale publish include list.

New:
- In-app update path: GET /update/check compares the checkout against
  origin/main and POST /update/apply runs `ncp upgrade` detached (pull,
  rebuild, restart). The sidebar shows the version, checks on click, and
  offers an "update available" pill.
- Projects: a project workspace groups chats and RAG documents, with
  per-project instructions and document retrieval scoped to the active
  project. Replaces the standalone Documents page.
- modules/: auto-discovered feature plugins (mail, network) with their
  frontend counterparts and tests.
- Memory curation runs in-process (synapse/memory/curator.py) on the chat
  model when a conversation goes idle. The separate memory service on :8001
  is gone, along with the launcher lines that started it.

Also: the KDE theme, panel and Promethean terminal assets, the full test
suite, and VERSION 1.2.0.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-08-25 09:13:55 -05:00

30 lines
905 B
Python

from typing import List
from .playbooks.store import playbook_store, PlaybookItem
def _all() -> List[PlaybookItem]:
"""Return all playbooks sorted by order (position 0 is always main)."""
return playbook_store.all_playbooks()
def get_main_playbook() -> PlaybookItem | None:
playbooks = _all()
return playbooks[0] if playbooks else None
def get_context_playbooks() -> List[PlaybookItem]:
"""All playbooks after the first — injected as reference context."""
playbooks = _all()
return playbooks[1:] if len(playbooks) > 1 else []
def get_system_prompt() -> str:
playbook = 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