#!/usr/bin/env bash
set -euo pipefail
# Run from either installed checkout, with its isolated dev server already running.
# Start unset case: T3CODE_DEV_SEED=0 env -u T3CODE_THREAD_ID vp run dev
# Start inherited case: T3CODE_DEV_SEED=0 T3CODE_THREAD_ID=unrelated-parent-thread vp run dev
# In Settings > Providers add Pi; set launch arguments to --no-approve.
# This keeps project files unloaded and suppresses the private-path trust notice.
mode=${1:?Pass unset or inherited}
node apps/server/src/bin.ts project add --base-dir .t3 --title 'Pi environment proof' .
node apps/server/src/bin.ts thread start --base-dir .t3 --provider pi \
  --model anthropic/claude-haiku-5-5 --title "Pi environment: $mode" \
  --json --wait . 'Reply only: Ready.'
# Open the returned thread in the paired web app (1280x800 CSS px, light theme).
# Close thread details, start browser recording, type and submit exactly:
# Use your bash tool to run exactly: echo "thread=$T3CODE_THREAD_ID" and then reply with only the exact output.
# Wait for completion. Expand Worked for, then the echo tool row. Capture.
# Compare the output with the thread id in the URL.
