clan: map runtime-guard manager alias so agent_id=clan is recognized

This commit is contained in:
Apple
2026-02-18 09:40:54 -08:00
parent bfd0e05bc9
commit 63fec84734
2 changed files with 119 additions and 2 deletions

View File

@@ -123,14 +123,22 @@ class RuntimeGuard:
)
def get_agent(self, agent_id: str) -> Optional[Dict[str, Any]]:
def _matches(entry: Dict[str, Any], requested_id: str) -> bool:
if entry.get("agent_id") == requested_id:
return True
aliases = entry.get("aliases")
if isinstance(aliases, list):
return requested_id in {str(a) for a in aliases}
return False
workers = self.registry.get("workers", [])
if not isinstance(workers, list):
return None
for w in workers:
if isinstance(w, dict) and w.get("agent_id") == agent_id:
if isinstance(w, dict) and _matches(w, agent_id):
return w
mgr = self.registry.get("manager")
if isinstance(mgr, dict) and mgr.get("agent_id") == agent_id:
if isinstance(mgr, dict) and _matches(mgr, agent_id):
return mgr
return None