main
John Lauer
Preserve adopted board30 and validated resistor library candidates with native-render dependency
7fa0c9c
"""Gracefully reopen only verified saved task editor; never kill or reset preferences."""
from pathlib import Path
import json,subprocess,base64
O=Path(__file__).resolve().parents[1]/'checkpoints/bourns-land-review-v2';remote='C:/Users/john/adom-projects/adom-custom-electronic-load/review/bourns-land-candidate/bourns-land-candidate.kicad_pcb'
def call(v,a,label):
p=subprocess.run(['adom-bridge','--target','AdomLapper','--ai-thread','adom-custom-load',v,json.dumps(a)],capture_output=True,text=True);j=json.loads(p.stdout);(O/(label+'.json')).write_text(json.dumps(j,indent=2));assert p.returncode==0 and j.get('success',True) and not j.get('error') and j.get('exitCode',0)==0,str(j)[:500];return j
j=call('kicad_routing_state',{'filePath':remote},'recovery-live-state');assert j['revision']=='220ff87203aeecc41b5a40ff9e5b371fc7e7de11853c1205fde01494316c9b7a'
for h in [19543304,1715462]:call('desktop_close_window',{'hwnd':h},f'recovery-close-{h}')
s="$p=Get-Process -Id 58336 -ErrorAction SilentlyContinue; if($p){if(-not $p.WaitForExit(10000)){throw 'Task editor still running; inspect save prompt'}}"
call('run_script',{'interpreter':'powershell','scriptB64':base64.b64encode(s.encode()).decode(),'reason':'Wait for saved task editor exit; preserve all other processes'},'recovery-exit')
j=call('kicad_open_board',{'filePath':remote,'foreground':False},'recovery-open');print({k:v for k,v in j.items() if k in ['hwnd','pid','pcbHwnd','success']},flush=True)