"""Single entry points for orchestration — GSD preferred, LangGraph legacy.""" from __future__ import annotations import logging import warnings from typing import Any logger = logging.getLogger(__name__) # Od 2026-07 nowe przepływy projektowe idą przez GSD; LangGraph /api pozostaje dla kompatybilności. LEGACY_LANGGRAPH_DEPRECATED = True PREFERRED_ORCHESTRATION_PATH = "gsd" def warn_legacy_langgraph_usage(context: str = "") -> None: if not LEGACY_LANGGRAPH_DEPRECATED: return msg = ( "Legacy LangGraph orchestration is deprecated; route new flows through GSD " f"(gsd.integration.start_gsd_for_project). {context}".strip() ) warnings.warn(msg, DeprecationWarning, stacklevel=3) logger.debug("[orchestration] %s", msg) def register_legacy_langgraph_route(route: str = "/api", **tags: Any) -> None: """Rejestracja metryki legacy LangGraph przy starcie serwera.""" from core.orchestration_paths import record_orchestration_path warn_legacy_langgraph_usage(f"route={route}") record_orchestration_path("legacy_langgraph", event="registered", route=route, **tags) def start_project_orchestration( project_id: str, user_id: str, tenant_id: str | None = None, profile: dict | None = None, program_type: str = "", ) -> dict[str, Any]: """Preferowany punkt wejścia orkiestracji dla nowych projektów (GSD).""" from gsd.integration import start_gsd_for_project return start_gsd_for_project( project_id=project_id, user_id=user_id, tenant_id=tenant_id or user_id, profile=profile or {}, program_type=program_type, ) def record_gsd_orchestration(**context: Any) -> None: from core.orchestration_paths import record_orchestration_path record_orchestration_path(PREFERRED_ORCHESTRATION_PATH, **context)