feat(upstream): merge a6f47abd engine, MCP, and orchestrator
Independent Staging Quality Gate / validate (push) Has been cancelled
Independent Staging Quality Gate / publish (push) Has been cancelled

Three-way-merge calculation modules and pl9-export into the product fork while keeping commercial API routes, Raman ayanamsa, and the consultation contract as a keypath superset.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-03 20:28:57 +08:00
parent 45d132588f
commit f224146348
30 changed files with 17151 additions and 248 deletions
+52 -2
View File
@@ -34,6 +34,7 @@ VARGA_META = {
81:{'name':'Navamsa-Navamsa','cn':'D9之D9','area':'配偶灵性精微层'},
108:{'name':'Dwadasamsa-Navamsa','cn':'D12之D9','area':'祖先父母精微层'},
144:{'name':'Dwadasamsa-Dwadasamsa','cn':'D12之D12','area':'父母祖先精微层'}}
VEDASTRO_RAW_VERIFIED_DIVISIONS = frozenset({2, 3, 4, 7, 9, 10, 12, 16, 20, 24, 27, 40, 45, 60})
def _si(lon): return int(lon/30)%12
def _sn(i): return SIGNS[i%12]
@@ -182,6 +183,47 @@ def calc_varga(lon, div, mode='classical_local'):
return r
def normalize_varga_ascendant(value):
"""Return the public ascendant object used by all varga charts."""
source_format = None
if isinstance(value, list):
candidates = [
row for row in value
if isinstance(row, dict)
and any(
str(row.get(field, '')).strip().lower() == 'ascendant'
for field in ('name', 'planet', 'key')
)
]
if len(candidates) != 1:
raise ValueError('ambiguous legacy ascendant list')
value = candidates[0]
source_format = 'legacy_list_normalized'
if not isinstance(value, dict):
raise ValueError('ascendant must be a mapping or identified legacy list')
sign = value.get('sign')
if sign not in SIGNS:
raise ValueError('ascendant sign is required')
sign_idx = value.get('sign_idx', SIGNS.index(sign))
if not isinstance(sign_idx, int) or not 0 <= sign_idx < len(SIGNS):
raise ValueError('ascendant sign_idx is invalid')
degree_in_sign = value.get('degree_in_sign')
if not isinstance(degree_in_sign, (int, float)) or not 0 <= degree_in_sign < 30:
raise ValueError('ascendant degree_in_sign is invalid')
normalized = {
'sign': sign,
'sign_idx': sign_idx,
'degree_in_sign': round(float(degree_in_sign), 4),
'longitude': round(float(value.get('longitude', sign_idx * 30 + degree_in_sign)) % 360, 4),
}
if source_format:
normalized['source_format'] = source_format
return normalized
def calc_64th_navamsa(moon_lon: float) -> Dict:
"""Compute the 64th Navamsa from the Moon's Navamsa position.
@@ -272,9 +314,17 @@ def calc_all_vargas(planet_lons, asc_lon, divisions=None, mode='classical_local'
for div in divisions:
m=VARGA_META.get(div,{})
key=f"D{div}_{m.get('name',f'D{div}')}"
mapping_status = (
'official_raw_sign_verified'
if mode == 'vedastro' and div in VEDASTRO_RAW_VERIFIED_DIVISIONS
else 'legacy_candidate_unverified'
if mode == 'vedastro'
else 'classical_local'
)
vd={'_meta':{'div':div,'name':m.get('name',''),'cn':m.get('cn',''),
'area':m.get('area',''),'part_size':30.0/div}}
vd['Ascendant']=calc_varga(asc_lon,div,mode=mode)
'area':m.get('area',''),'part_size':30.0/div,
'mapping_status': mapping_status}}
vd['Ascendant']=normalize_varga_ascendant(calc_varga(asc_lon,div,mode=mode))
for pn,lon in planet_lons.items():
vd[pn]=calc_varga(lon,div,mode=mode)
# 尊贵状态