diff --git a/main.py b/main.py index 9dd9b24..67ded0f 100644 --- a/main.py +++ b/main.py @@ -200,6 +200,39 @@ async def orchestrate_task(task_data: dict, is_auth: bool = Depends(verify_passw async def get_orch_status(is_auth: bool = Depends(verify_password)): return get_orchestrator_status() +# --- SISTEMA CRONOS --- +@app.get("/api/cronos/status") +async def get_cronos_status(is_auth: bool = Depends(verify_password)): + """Retorna o status semanal atual e lista de conhecimentos.""" + memory_root = "/root/Antigravity_Memory" + current_week_path = os.path.join(memory_root, "current_week/status_geral.md") + + status_content = "" + if os.path.exists(current_week_path): + with open(current_week_path, "r") as f: + status_content = f.read() + + # Lista arquivos em knowledge + knowledge_dir = os.path.join(memory_root, "knowledge") + knowledge_files = [] + if os.path.exists(knowledge_dir): + knowledge_files = [f for f in os.listdir(knowledge_dir) if f.endswith(".md")] + + return { + "status": status_content, + "knowledge_topics": knowledge_files, + "last_update": time.strftime("%Y-%m-%d %H:%M:%S") + } + +@app.get("/api/cronos/knowledge/{topic}") +async def get_cronos_knowledge(topic: str, is_auth: bool = Depends(verify_password)): + filepath = os.path.join("/root/Antigravity_Memory/knowledge", topic) + if not os.path.exists(filepath): + raise HTTPException(status_code=404, detail="Tópico não encontrado") + + with open(filepath, "r") as f: + return {"content": f.read()} + # --- SERVER --- if __name__ == "__main__": import uvicorn