Files
foodlinkk-command-center/cockpit/app/services/agent_names.py
T

41 lines
1.1 KiB
Python
Raw Normal View History

"""Normalize legacy agent_name values to agent_souls keys."""
from __future__ import annotations
AGENT_NAME_MAP: dict[str, str] = {
"retail_360": "retail",
"retail_scraper": "retail",
"retail_crm": "retail",
"retail_intel": "retail",
"rss_feeds": "marketing",
"wholesale_scraper": "sourcing",
"halal_registry": "halal",
"halal_engine": "halal",
"halal_reco": "halal",
"branch_scraper": "sourcing",
"hermes": "herman",
"herman_delegate": "herman",
"ops": "sysops",
"sysop": "sysops",
"web_builder": "webbuilder",
"packaging_agent": "packaging",
}
def normalize_agent_key(name: str | None) -> str:
key = (name or "").strip().lower()
if not key:
return ""
return AGENT_NAME_MAP.get(key, key)
def aliases_for_key(canonical: str) -> list[str]:
"""All raw agent_name values that map to this soul key (including the key itself)."""
key = (canonical or "").strip().lower()
if not key:
return []
names = {key}
for raw, canon in AGENT_NAME_MAP.items():
if canon == key:
names.add(raw)
return sorted(names)