"""One functional benefic/malefic snapshot for the engine, API, and MCP. This module is not ``functional_benefics.py``. Every product surface, rectification scoring included (BUG-1759, product 2026-11-08), takes the default ``pvr_table30_v1`` (alias ``pvr_table_30``); ``bphs_exception_profile`` is a comparison only. """ from __future__ import annotations from typing import Any def functional_layer_for_ascendant( ascendant: Any, planets: Any = None, *, functional_profile: str | None = None, ) -> dict[str, Any]: """Return the functional layer for an ascendant payload. A dict uses its ``sign``. Anything else is a missing sign and follows the normal ``derive_functional_benefic_malefic`` blocked result. Import or calculation failures return the engine's blocked shape. The exception text stays inside ``effect_on_confidence`` because that field already did; callers must not write this dict to a log. 占星师 2026-11-08 第五轮裁定 3: the default profile is PVR Table 30 (``functional_benefics.DEFAULT_FUNCTIONAL_PROFILE``). ``planets`` (Sun and Moon longitudes) gives the Moon's paksha, which Table 30's note needs for Aries / Libra / Capricorn lagnas. """ try: try: import functional_benefics as fb except ModuleNotFoundError: from scripts import functional_benefics as fb sign = ascendant.get("sign") if isinstance(ascendant, dict) else None return fb.derive_functional_benefic_malefic( sign, functional_profile=functional_profile or fb.DEFAULT_FUNCTIONAL_PROFILE, moon_paksha=fb.moon_paksha_from_planets(planets), ) except Exception as exc: sign = ascendant.get("sign") if isinstance(ascendant, dict) else None return { "status": "blocked", "ascendant": sign, "functional_benefics": [], "functional_malefics": [], "functional_neutrals": [], "yogakarakas": [], "owned_houses": {}, "effect_on_confidence": f"未完成功能性吉凶星判定,需降低高严谨结论置信度: {exc}", "source": "strict_functional_benefic_malefic_v2", }