from contextlib import asynccontextmanager from fastapi import FastAPI from api.database import engine from api.routers import decisions, progress, state, tasks, topics, workstreams @asynccontextmanager async def lifespan(app: FastAPI): yield await engine.dispose() app = FastAPI( title="Custodian State Hub", description="Local-first state API for the Custodian agent system.", version="0.1.0", lifespan=lifespan, ) app.include_router(topics.router) app.include_router(workstreams.router) app.include_router(tasks.router) app.include_router(decisions.router) app.include_router(progress.router) app.include_router(state.router) @app.get("/", include_in_schema=False) async def root(): return {"service": "state-hub", "docs": "/docs"}