- testcases/*.md: declarative test definitions (send, expect_response, expect_state, expect_actions, action) - runtime_test.py: standalone runner + pytest integration via conftest.py - /tests route: web UI showing last run results from results.json - /api/tests: serves results JSON - Two initial testcases: counter_state (UI actions) and pub_conversation (multi-turn, language switch, tool use, memorizer state) - pub_conversation: 19/20 passed on first run - Fix nm-text vertical overflow in node metrics bar Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
"""Cognitive Agent Runtime — modular package.
|
|
|
|
uvicorn entrypoint: agent:app
|
|
"""
|
|
|
|
import logging
|
|
from pathlib import Path
|
|
|
|
from dotenv import load_dotenv
|
|
load_dotenv(Path(__file__).parent.parent / ".env")
|
|
|
|
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(name)s] %(message)s", datefmt="%H:%M:%S")
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.responses import FileResponse
|
|
from fastapi.staticfiles import StaticFiles
|
|
from starlette.responses import Response
|
|
|
|
from .api import register_routes
|
|
|
|
STATIC_DIR = Path(__file__).parent.parent / "static"
|
|
|
|
app = FastAPI(title="cog")
|
|
|
|
# Register all API + WS routes
|
|
register_routes(app)
|
|
|
|
# Serve index.html explicitly, then static assets
|
|
@app.get("/")
|
|
async def index():
|
|
resp = FileResponse(STATIC_DIR / "index.html")
|
|
resp.headers["Cache-Control"] = "no-cache"
|
|
return resp
|
|
|
|
@app.get("/tests")
|
|
async def tests_page():
|
|
return FileResponse(STATIC_DIR / "tests.html")
|
|
|
|
@app.get("/callback")
|
|
async def callback():
|
|
"""OIDC callback — serves the same SPA, JS handles the code exchange."""
|
|
return FileResponse(STATIC_DIR / "index.html")
|
|
|
|
app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
|