This commit is contained in:
team3
2026-07-08 18:55:36 +02:00
parent 224ba1ed4f
commit 9a6ab0937b
15 changed files with 172 additions and 55 deletions

View File

@@ -46,6 +46,16 @@ def active_agents(scope_prefix: str | None = None) -> list[dict]:
and (not scope_prefix or k.startswith(scope_prefix))]
return sorted(out, key=lambda a: -a["runtime"])
# Board-2-Calls tragen diese Marker im agent_key; alles andere unter blocks-{topic}- ist Board 1.
_ARTEFAKT_MARKER = ("-art-gen", "-art-check", "-sb-enrich", "-sb-verify", "-sb-fix",
"-sub-crossblock", "-outline")
def agent_ebene(key: str) -> str:
"""Generierungs-Ebene eines Blocks-Agenten (für Board-Anzeige/Accounting): inventory|artefacts."""
return "artefacts" if any(m in key for m in _ARTEFAKT_MARKER) else "inventory"
# Cancelled scopes (key prefixes, symmetric to kill_process). An agent whose
# key starts with one of these prefixes aborts BEFORE the spawn — so agents WAITING
# in the semaphore queue are also stopped immediately on abort instead of still starting.
@@ -366,6 +376,8 @@ async def run_agent(
if on_event is not None and scope is not None: # batch pipeline only, never fatal
try:
meta = {"provider": provider, "model": model, "role": role, "rc": rc}
if agent_key.startswith("blocks-"): # Ebene fürs Per-Board-Accounting
meta["board"] = agent_ebene(agent_key)
if err_tail:
meta["stderr"] = err_tail
if api_tokens: # direct-API path: usage from the response, even on rc!=0