#!/usr/bin/env bash
# Use the same driver in each installed checkout with its own fresh data home.
# First run setup.py beside this script, then start cut-proxy.py in a terminal.
# Start the checkout: T3CODE_DEV_SEED=0 vp run dev --home-dir "$data_home"
set -euo pipefail
checkout=$1
data_home=$2
project=$3
cd "$checkout"
node apps/server/src/bin.ts project add --base-dir "$data_home" --title 'Connection failure demo' "$project"
node apps/server/src/bin.ts thread start --base-dir "$data_home" --provider codex --model gpt-6-luna --title 'Terminal connection failure' "$project" 'Reply with the single word hello.' --json
# Open the returned thread in the paired web client. Wait for its failed state.
# Hide thread details and dismiss the error banner, then start browser recording.
# Repeat the identical message using:
# node apps/server/src/bin.ts thread send --base-dir "$data_home" "$thread_id" 'Reply with the single word hello.' --json
# Stop recording after the five retries and terminal failure.
# python3 extract-events.py "$data_home" > events.json
