import sys, subprocess, pathlib, time, json
out=pathlib.Path(sys.argv[1]);out.mkdir(parents=True,exist_ok=True)
def run(*args):subprocess.run(['agent-device',*args,'--session','issue35402-proof'],check=True)
def press(label):run('press','label='+json.dumps(label),'--settle')
run('record','start',str(out/'play-preview.mp4'),'--hide-touches')
for label in ['Open files','notes','notes/clip#1.wav','Play','Navigate up','Open files','docs','docs/draft#1.md','File actions','Preview']:press(label)
for attempt in range(8):
 a=out/'render-a.png';b=out/'rendered.png'
 run('screenshot',str(a));time.sleep(.5);run('screenshot',str(b))
 if a.read_bytes()==b.read_bytes():break
else:raise RuntimeError('rendered capture did not stabilize')
run('record','stop')
