clan: map runtime-guard manager alias so agent_id=clan is recognized
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user