Add quiet loop verification endpoint

This commit is contained in:
2026-05-12 08:15:46 -05:00
parent 7286a241e4
commit 26db60f310
2 changed files with 79 additions and 0 deletions

View File

@@ -153,6 +153,29 @@ async def test_agent_response(
}
@app.post("/admin/test-loop-inactivity")
async def test_loop_inactivity(
session_id: str = Form(...),
inactive_minutes: int = Form(16),
) -> dict:
"""Verify the quiet-chat loop records exactly one Hearthkeeper prompt."""
if not orchestrator:
raise HTTPException(status_code=503, detail="Orchestrator not initialized")
result = await orchestrator.run_hearthkeeper_loop_test(
session_id=session_id,
inactive_minutes=inactive_minutes,
)
if result.get("reason") == "session_not_found":
raise HTTPException(status_code=404, detail="Active session not found")
return {
"status": "passed" if result["passed"] else "failed",
"result": result,
"timestamp": datetime.utcnow().isoformat(),
}
@app.get("/admin/ledger")
async def get_ledger(session_id: str) -> dict:
"""Get the markdown ledger for a session."""