chore: save current work
This commit is contained in:
+9
-7
@@ -25,9 +25,8 @@ app = FastAPI(title="CDSL CAD Agent API", version="0.1.0")
|
||||
|
||||
@app.on_event("startup")
|
||||
async def resume_autonomous_generation() -> None:
|
||||
"""Restore durable autonomous agent tasks after a backend process restart."""
|
||||
if settings.resume_running_tasks_on_startup:
|
||||
await agent.resume_running_tasks()
|
||||
"""Prewarm model protocols without delaying API readiness."""
|
||||
asyncio.create_task(agent.resume_running_tasks(), name="cad-model-protocol-prewarm")
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
@@ -152,13 +151,16 @@ async def read_task(task_id: str) -> JSONResponse:
|
||||
raise HTTPException(status_code=404, detail="Task not found")
|
||||
task["preview_revision"] = str(task.get("active_revision") or task.get("current_revision") or "")
|
||||
state = agent.v3.repository.get_state(safe_id)
|
||||
draft = agent.v3.artifacts.read_requirements_draft(safe_id, state.requirements_draft_path) if state is not None else None
|
||||
task["requirements_draft"] = draft
|
||||
task["requirements_review"] = agent.v3.artifacts.read_requirements_review(safe_id, state.requirements_review_path) if state is not None else None
|
||||
task["requirements_spec"] = agent.v3.artifacts.read_requirements_spec(safe_id, state.requirements_spec_path) if state is not None else None
|
||||
task["requirements_contract"] = agent.v3.artifacts.read_requirements_contract(safe_id, state.requirements_contract_path) if state is not None else None
|
||||
task["claim_summary"] = _claim_summary(task["requirements_contract"], task.get("action_ledger_summary"))
|
||||
task["requirements_markdown"] = (agent.v3.artifacts.task_dir(safe_id) / "requirements.md").read_text(encoding="utf-8") if (agent.v3.artifacts.task_dir(safe_id) / "requirements.md").is_file() else None
|
||||
task["completion_markdown"] = (agent.v3.artifacts.task_dir(safe_id) / "completion.md").read_text(encoding="utf-8") if (agent.v3.artifacts.task_dir(safe_id) / "completion.md").is_file() else None
|
||||
target_path = agent.v3.artifacts.task_dir(safe_id) / "completion-target.md"
|
||||
result_path = agent.v3.artifacts.task_dir(safe_id) / "completion-result.md"
|
||||
task["completion_target_markdown"] = target_path.read_text(encoding="utf-8") if target_path.is_file() else None
|
||||
task["completion_target_path"] = "completion-target.md" if target_path.is_file() else ""
|
||||
task["completion_result_markdown"] = result_path.read_text(encoding="utf-8") if result_path.is_file() else None
|
||||
task["completion_result_path"] = "completion-result.md" if result_path.is_file() else ""
|
||||
task["usage"] = agent.v3.repository.usage_summary(safe_id)
|
||||
return JSONResponse(task)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user