sx-pub Phase 1: DB schema, IPFS wiring, actor + webfinger + collections + status endpoints

Foundation for the sx-pub federated publishing protocol:

- 6 SQLAlchemy models: actor, collections, documents, activities, followers, following
- Conditional DB enablement in sx_docs (DATABASE_URL present → enable DB)
- Python IO helpers: get_or_create_actor (auto-generates RSA keypair),
  list_collections, check_status, seed_default_collections
- 4 defhandler endpoints returning text/sx (no JSON):
  /pub/actor, /pub/webfinger, /pub/collections, /pub/status
- Alembic migration infrastructure for sx service
- Docker compose: DB + pgbouncer + IPFS + env vars

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 01:17:27 +00:00
parent 858275dff9
commit 7b3d763291
8 changed files with 486 additions and 1 deletions

View File

@@ -37,6 +37,10 @@ def _register_sx_helpers() -> None:
"spec-explorer-data": _spec_explorer_data,
"spec-explorer-data-by-slug": _spec_explorer_data_by_slug,
"handler-source": _handler_source,
# sx-pub helpers (only functional when DATABASE_URL is set)
"pub-actor-data": _pub_actor_data,
"pub-collections-data": _pub_collections_data,
"pub-status-data": _pub_status_data,
})
@@ -1717,3 +1721,22 @@ def _page_helpers_demo_data() -> dict:
results["attr-keys"] = list(ATTR_DETAILS.keys())
return results
# ---------------------------------------------------------------------------
# sx-pub helpers — thin wrappers for SX access
# ---------------------------------------------------------------------------
async def _pub_actor_data():
from .pub_helpers import get_or_create_actor
return await get_or_create_actor()
async def _pub_collections_data():
from .pub_helpers import list_collections
return await list_collections()
async def _pub_status_data():
from .pub_helpers import check_status
return await check_status()