"""Usage proof fixture. Run: python3 setup-usage.py WORKTREE SYNTHETIC_DATA_DIR.
Then in WORKTREE: T3CODE_DEV_SEED=0 vp run dev --home-dir .t3/usage-proof --no-seed.
Pair the browser; finish Welcome with Start; open Usage, choose Cost, and click
acme-coder-1 under Breakdown. Use the same data directory for base and head.
No agent turn is needed: this is the app's real OpenCode history reader.
"""
import json,pathlib,sys,time
checkout=pathlib.Path(sys.argv[1]).resolve()
fixture=pathlib.Path(sys.argv[2]).resolve()
messages=fixture/'opencode/storage/message/session-proof'
messages.mkdir(parents=True,exist_ok=True)
for name,cost,inp,out in [('msg_priced',1,60,40),('msg_unpriced',0,9000,900)]:
 data=dict(id=name,sessionID='session-proof',role='assistant',modelID='acme-coder-1',providerID='synthetic',cost=cost,time={'created':int(time.time()*1000)},tokens={'input':inp,'output':out,'reasoning':0,'cache':{'read':0,'write':0}})
 (messages/(name+'.json')).write_text(json.dumps(data))
providers={}
for driver in ['codex','claudeAgent','opencode','cursor','grok','pi','antigravity','muse']:
 env=[{'name':key,'value':str(fixture/value),'sensitive':False} for key,value in [('OPENCODE_DATA_DIR','opencode'),('CODEX_HOME','empty/codex'),('CLAUDE_CONFIG_DIR','empty/claude'),('PI_CODING_AGENT_DIR','empty/pi'),('GROK_HOME','empty/grok'),('XDG_DATA_HOME','empty/data'),('XDG_CONFIG_HOME','empty/config')]]
 providers[driver]={'driver':driver,'enabled':False,'environment':env}
userdata=checkout/'.t3/usage-proof/userdata'
userdata.mkdir(parents=True,exist_ok=True)
(userdata/'settings.json').write_text(json.dumps({'providerInstances':providers}))
