feat: vendor Curry, preloaded and callable across the one universal wheel

Vendors curry_core.py from Athena-Pro/Curry (with the str.format()/format_map()
sandbox-escape fix from https://github.com/Athena-Pro/Curry/pull/4 already
applied) into synapse/, since Curry itself isn't a pip-installable package -
it's meant to be pointed at via a config path, which only works from a source
checkout. Vendoring a single self-contained, stdlib-only file ships it inside
NexusOS's own wheel with no extra dependency to reconcile.

synapse/curry_store.py opens it into a module-level singleton (curry_db) at
import time, the same pattern as memory.store.store and
playbooks.store.playbook_store, and main.py imports it so it's genuinely
initialized at process startup - preloaded, not lazy-on-first-use. Backed by
its own CURRY_DB file (nexus_config.py), separate from memory.db.

NexusOS builds exactly one wheel (py3-none-any, no compiled extensions) -
there is no separate Windows/macOS/Linux artifact; platform differences are
handled by requirement overlays at install time, not by building different
wheels. Verified the same wheel actually carries this correctly: built it,
confirmed twine check passes, confirmed synapse/curry_core.py and
curry_store.py are present in the archive (bin/check.sh's packaging gate now
asserts this too), then installed that exact wheel into a throwaway venv and
round-tripped a declare_constant/get_constant_latest call against it with no
source checkout present - proving "preloaded and ready to be called" holds
from the shipped artifact, not just editable-install execution.

Android/Termux is unaffected by this change in either direction: it already
has a separate, documented, pre-existing blocker in docs/TERMUX.md (no
published Android pydantic-core wheel) that has nothing to do with Curry,
which is pure stdlib and adds no new native/binary dependency.

Scope: preload only, nothing wired into a chat-facing tool yet - no model or
user-authored content reaches declare_function/call_function today.

Verified: 216 backend tests pass (4 new in test_curry_store.py, including a
regression test proving the vendored sandbox fix survived the copy); the 12
pre-existing C/C++/Rust toolchain failures are unrelated and unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-25 21:40:41 -05:00
co-authored by Claude Sonnet 5
parent 0bbe5e200e
commit cb3d3f0a1f
7 changed files with 1792 additions and 1 deletions
File diff suppressed because it is too large Load Diff
+22
View File
@@ -0,0 +1,22 @@
"""NexusOS's own Curry instance: preloaded at import time, ready to be called.
Curry (curry_core.py, vendored alongside this file) is an immutable, versioned
fact store - constants, functions, model registrations, and inference
provenance, backed by SQLite. Nothing in NexusOS wires chat/model-authored
content into it yet; this module only makes it available - `from
synapse.curry_store import curry_db` and call `declare_constant`,
`get_constant_latest`, `declare_function`, `call_function`, etc. directly, the
same way `synapse.memory.store.store` and `synapse.playbooks.store.playbook_store`
are used elsewhere in this codebase.
Kept as a separate database file (CURRY_DB) from the memory/conversation store
on purpose: Curry's schema and lifecycle are independent of the memory store's.
"""
from __future__ import annotations
from .curry_core import Curry
from .nexus_config import CURRY_DB
curry_db = Curry(str(CURRY_DB))
__all__ = ["curry_db"]
+1
View File
@@ -207,6 +207,7 @@ async def _generate_conversation_title(first_message: str, model: str) -> Option
from .memory.store import store, MemoryItem
from .playbooks.store import playbook_store
from .curry_store import curry_db # noqa: F401 - import triggers Curry's own preload at startup
from .search import needs_web_search, web_search
MEMORY_SERVICE = settings.memory_url
+7 -1
View File
@@ -155,6 +155,11 @@ SEED_PLAYBOOK_DIR = (
# --- DATABASE / STORAGE FILES (match your repo) ---
MEMORY_DB = _configured_path("memory_db", "NEXUS_MEMORY_DB", MEMORY_DIR / "memory.db")
# Vendored Curry (synapse/curry_core.py) database: immutable versioned
# constants/functions/models + inference provenance. Separate file from
# MEMORY_DB on purpose - Curry's schema and lifecycle are independent of the
# memory/conversation store.
CURRY_DB = _configured_path("curry_db", "NEXUS_CURRY_DB", DATA_DIR / "curry.db")
# --- LOG FILES ---
BACKEND_LOG = RUNTIME_DIR / "backend.log"
@@ -175,6 +180,7 @@ _REQUIRED_DIRS = (
UPLOADS_DIR,
EXPORTS_DIR,
MEMORY_DB.parent,
CURRY_DB.parent,
)
@@ -419,7 +425,7 @@ __all__ = ["Settings", "settings", "path", "VERSION",
"read_user_config", "write_user_config", "init_state", "INITIALIZED_FILES",
"DATA_DIR", "MODELS_DIR", "RUNTIME_DIR",
"MEMORY_DIR", "LOGS_DIR", "PLAYBOOK_DIR", "UPLOADS_DIR",
"EXPORTS_DIR", "MEMORY_DB", "WEB_DIST_DIR", "FRONTEND_SOURCE_DIR",
"EXPORTS_DIR", "MEMORY_DB", "CURRY_DB", "WEB_DIST_DIR", "FRONTEND_SOURCE_DIR",
"ASSETS_DIR", "SEED_PLAYBOOK_DIR",
"BACKEND_LOG", "OLLAMA_LOG", "CHAT_LOG",
"ALLOWED_HOSTS", "ALLOWED_ORIGINS",