feat: orchestrator MVP — webhooks, agent launcher, QG checks
This commit is contained in:
32
src/main.py
Normal file
32
src/main.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from fastapi import FastAPI
|
||||
from contextlib import asynccontextmanager
|
||||
from .db import init_db
|
||||
from .webhooks.plane import router as plane_router
|
||||
from .webhooks.gitea import router as gitea_router
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
init_db()
|
||||
yield
|
||||
|
||||
|
||||
app = FastAPI(title="Multi-Agent Orchestrator", lifespan=lifespan)
|
||||
app.include_router(plane_router, prefix="/webhook")
|
||||
app.include_router(gitea_router, prefix="/webhook")
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
async def health():
|
||||
return {"status": "ok", "service": "orchestrator"}
|
||||
|
||||
|
||||
@app.get("/status")
|
||||
async def status():
|
||||
from .db import get_db
|
||||
conn = get_db()
|
||||
tasks = conn.execute(
|
||||
"SELECT * FROM tasks WHERE stage != 'done' ORDER BY created_at DESC LIMIT 10"
|
||||
).fetchall()
|
||||
conn.close()
|
||||
return {"active_tasks": [dict(t) for t in tasks]}
|
||||
Reference in New Issue
Block a user