Add quiet loop verification endpoint
This commit is contained in:
23
app/main.py
23
app/main.py
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user