#!/usr/bin/env python3 """Test the session registry end-to-end.""" import sys sys.path.insert(0, "/data/symbiont") from symbiont.sessions import SessionRegistry, sitrep reg = SessionRegistry() # Register this session (the one that built everything) sid = reg.register( "cowork", "Building Symbiont core: router, dispatcher, sessions, Dendrite integration" ) print(f"Registered session: {sid}") # Log some progress reg.log(sid, "Built LLM router with Haiku classifier and model tier dispatch") reg.log(sid, "Added systemd life support (API service + heartbeat timer)") reg.log(sid, "Integrated Dendrite headless browser via web.py") reg.log(sid, "Created session registry for cross-instance awareness") reg.log(sid, "Deployed CLAUDE.md bootstrap for new sessions") # Lock a resource to test that reg.lock_resource(sid, "/data/symbiont/symbiont/router.py", "May refactor to Elixir soon") # Print the sitrep print() print(sitrep()) # Test the API endpoints too import urllib.request, json resp = urllib.request.urlopen("http://localhost:8111/sitrep", timeout=5) api_sitrep = json.loads(resp.read()) print(f"API /sitrep active sessions: {len(api_sitrep['active'])}") # Complete this session reg.complete(sid, "Built Symbiont v0.1: router, dispatcher, ledger, heartbeat, Dendrite, sessions, CLAUDE.md") print(f"\nSession {sid} completed.") # Final sitrep showing it moved to completed print() print(sitrep())