#!/usr/bin/env bash
set -euo pipefail
# Start a clean checkout with: T3CODE_DEV_SEED=0 vp run dev
# Install agent-browser 0.43.0 and Chromium; set AGENT_BROWSER_BIN if needed.
# Arguments: worktree origin pairing-url browser-session output-directory
worktree=$1
origin=$2
pairing=$3
session=$4
output=$5
script_dir=$(cd -- "$(dirname -- "$0")" && pwd)
python3 "$script_dir/capture.py" "$worktree" "$origin" "$pairing" "$session" "$output" setup
export REGEN_ONLY=1
for variant in expanded literal exact boundary over-limit; do
  count=5
  if [[ "$variant" == boundary || "$variant" == over-limit ]]; then count=2; fi
  for ((trial=1;trial<=count;trial++)); do
    python3 "$script_dir/capture.py" "$worktree" "$origin" - "$session" "$output" case "$variant" "$trial" 1
  done
done
# One additional exact-title repeat with the same settled-state recording flow.
python3 "$script_dir/capture.py" "$worktree" "$origin" - "$session" "$output" case exact 6 1
