#!/usr/bin/env python3 """Sync only the server-verified shared cognition artifact from JD to JZAO.""" import argparse,hashlib,json,os,pathlib,subprocess,tempfile ROOT=pathlib.Path('/Volumes/JZAO/HoloLake/persona-runtime') ACCESS=ROOT/'shared/registries/local-server-access-map.json' OUTPUT=ROOT/'shared/tcs-shared-cognition/CURRENT.json' def stable_hash(text):return hashlib.sha256(text.encode()).hexdigest() def route(): data=json.loads(ACCESS.read_text());items=[x for x in data['routes'] if x['target_id']=='JD-FD-PRIMARY'] if len(items)!=1:raise RuntimeError('JD_ROUTE_NOT_UNIQUE') return items[0] def fetch(): r=route();cmd=['ssh','-i',r['identity_file'],'-p',str(r.get('port',22)),'-o','BatchMode=yes','-o','StrictHostKeyChecking=yes','-o',f'UserKnownHostsFile={pathlib.Path.home()}/.ssh/known_hosts',f"{r['user']}@{r['host']}",f"test \"$(tr A-Z a-z