import subprocess,json,sys
origin=sys.argv[1]
def run(args):
 p=subprocess.run(['node',*args],capture_output=True,text=True)
 print(p.stdout,flush=True)
 if p.returncode not in [0,1]: raise RuntimeError('Command failed')
 return p.stdout
tid=sys.argv[2]
def turn(provider,model,text):
 run(['scripts/handoff-proof.ts',origin,tid,provider,model])
 return run(['apps/server/src/bin.ts','thread','send',tid,text,'--base-dir','.t3','--wait','--json'])
turn('claudeAgent','claude-haiku-5-5','The gate color is VIOLET. Reply Noted.')
turn('cursor','composer-2.5','What is the vault code, the backup code, and the gate color? Say NOT SEEN if absent.')
