This commit is contained in:
team3
2026-07-01 22:01:32 +02:00
parent fa718b7d6c
commit b5398f73d2
17 changed files with 1580 additions and 522 deletions

View File

@@ -164,7 +164,7 @@ async def create_blocks(req: BlocksCreateRequest):
raise HTTPException(400, "Link must start with http:// or https://.")
qp.parent.mkdir(parents=True, exist_ok=True)
atomic_write_json(qp, {"type": type, "location": location, "spec": req.instructions.strip()})
asyncio.create_task(generate_blocks(topic, req.instructions.strip(), req.provider, ab_phase=req.ab_phase, ab_step=req.ab_step, to_step=req.to_step))
asyncio.create_task(generate_blocks(topic, req.instructions.strip(), req.provider, ab_phase=req.ab_phase, ab_step=req.ab_step, to_step=req.to_step, research=req.research))
return {"ok": True}
@@ -231,6 +231,28 @@ async def get_blocks_uebersicht(topic: str):
return await load_overview(topic)
@router.get("/blocks/kanban")
async def get_kanban_board(topic: str):
"""Live card counts per kanban column (empty dict when the streaming inventory is not in use)."""
import database as db
return await db.kanban_stage_counts(topic)
@router.get("/blocks/agents")
async def get_active_agents(topic: str):
"""Currently running agents for this topic + their runtime (seconds). Label = key minus prefix."""
from agents import active_agents
prefix = f"blocks-{topic}-"
return [{"label": a["key"][len(prefix):], "runtime": a["runtime"]} for a in active_agents(prefix)]
@router.post("/blocks/research")
async def add_research(topic: str):
"""Attach one more research agent to the running kanban flow (live breadth boost)."""
from kanban import add_research_agent
return {"started": add_research_agent(topic)}
@router.get("/blocks/question-pattern")
async def get_question_pattern(topic: str, block: str):
"""Unlocked question patterns of a block (up to the current level; empty = live)."""