#!/usr/bin/env python3
"""Run from a checkout with a running, fresh T3 dev server.
Usage: driver.py PROJECT_DIRECTORY
Set PROOF_MODEL to a supported Codex model in the environment.
The app is driven through its own thread CLI; view the returned thread in the web client.
Record the running row from command one through command done on each commit.
"""
import os, subprocess, sys
prompt = ('Use your built-in spawn_agent tool (not delegate_task) to spawn one subagent. '
          'Tell the subagent to run these shell commands one at a time: ls, then sleep 8 && echo one, '
          'then sleep 8 && echo two, then sleep 8 && echo done. Name its task Run Commands. '
          'Do not do the commands yourself. Wait for the subagent to finish.')
subprocess.run(['node', 'apps/server/src/bin.ts', 'thread', 'start', '--base-dir', '.t3',
                '--title', 'Native subagent progress', '--provider', 'codex',
                '--model', os.environ['PROOF_MODEL'], sys.argv[1], prompt, '--json'], check=True)
