"""협상 agent 카탈로그 변경 알림 (best-effort). 공용 협상카드(card.nego_cards, user_id NULL)는 agent 의 action space(Q-table action 축)를 정의한다. negodata 에서 공용 카드를 추가/삭제/번호변경하면 agent 의 캐시된 엔진을 무효화해 최신 카탈로그로 재조립되게 알린다. 실패해도 카드 작업 자체는 성공으로 둔다 — agent 는 TTL/다음 재조립으로 결국 반영된다. 개인(회사) 카드나 와일드카드는 action space 를 바꾸지 않으므로 알리지 않는다(호출부에서 판정). """ import httpx from common.logger import LOG from config.server_configs import web_server_config async def notify_catalog_changed() -> None: if getattr(web_server_config, "is_test", False): return # 테스트 환경에선 외부 호출 안 함 base = (getattr(web_server_config, "agent_base_url", "") or "").rstrip("/") if not base: return try: async with httpx.AsyncClient(timeout=3.0) as cli: await cli.post(f"{base}/v1/catalog-refresh-all") except Exception as ex: # 알림 실패는 카드 작업을 막지 않는다 LOG.w(f"[agent_notify] 공용 카탈로그 변경 알림 실패(무시): {ex}")