# Prepare the isolated state used by prove.py. Never upload the generated auth/config files.
import sys,json,shutil,tomllib
from pathlib import Path
scratch=Path(sys.argv[1]);auth=Path(sys.argv[2]);config=Path(sys.argv[3]);mcp_entry=Path(sys.argv[4])
c=tomllib.loads(config.read_text());project=scratch/'project';project.mkdir(parents=True,exist_ok=True)
(project/'README.md').write_text('Synthetic process cleanup evidence workspace.\n')
for side in ['base','head']:
 h=scratch/side/'proof2/codex';h.mkdir(parents=True,exist_ok=True)
 shutil.copyfile(auth,h/'auth.json')
 text='model = "gpt-6.1-sol"\nopenai_base_url = '+json.dumps(c['openai_base_url'])+'\n\n[mcp_servers.filesystem]\ncommand = "node"\nargs = '+json.dumps([str(mcp_entry),str(project)])+'\n'
 (h/'config.toml').write_text(text)
