"""Run once per checkout against its fresh, running T3 dev server.
Usage: python3 reproduce.py CHECKOUT MCP_SCRIPT PROJECT_DIR
Start each checkout with T3CODE_DEV_SEED=0 and the same settings below before
using this driver. The MCP program is imgmcp.py, supplied alongside this file.
Settings providerInstances.codexSamples: driver codex, enabled true, config:
  binaryPath: codex
  launchArgs: shlex.join(["-c", 'mcp_servers.imgmcp.command="python3"',
                         "-c", 'mcp_servers.imgmcp.args='+json.dumps([MCP_SCRIPT])])
Web: open returned top-level thread, hide sidebar, expand Worked for,
Used imgmcp integration, Snap empty string, Snap whitespace text, Snap null,
and Unknown audio. Empty content correctly has no expansion control.
Capture at 1440x1600 with light theme after two identical frames >=500ms apart.
iOS: open this same thread and expand the same rows using the native client.
The unknown_audio sample returns the envelope as structured data, since Codex
replaces native audio content blocks with an omission string before T3 sees them.
"""
import subprocess,sys
checkout,mcp,project=sys.argv[1:]
def cli(*args):
 return subprocess.run(["node","apps/server/src/bin.ts",*args,"--base-dir",".t3"],cwd=checkout,check=True)
cli("project","add",project,"--title","Tool result samples")
cli("thread","start",project,"Call imgmcp tools exactly once each, sequentially in this order: snap_empty_string, snap_whitespace_text, snap_null, empty_content, unknown_audio. Do not delegate. Do not call any other tools. Finish with exactly: Tool samples complete.","--title","Empty tool results","--provider","codexSamples","--model","gpt-6.1-sol","--wait","--json")

# Additional native capture used a single-call thread to keep the entire result
# visible outside mobile's 256px multi-tool group scroll area, on both commits:
# cli("thread","start",project,"Call only imgmcp.snap_empty_string exactly once. Do not delegate or call other tools. Finish with exactly: Tool sample complete.","--title","Image result","--provider","codexSamples","--model","gpt-6.1-sol","--wait","--json")
