#!/usr/bin/env bash
set -euo pipefail
# Run from the checkout under test after vp i.
# Arguments: absolute isolated T3 home, project directory, provider id, model slug.
home_dir=$1
project_dir=$2
provider_id=$3
model_slug=$4
cli=apps/server/src/bin.ts
node "$cli" project add --base-dir "$home_dir" --title 'Printing press' "$project_dir"
thread_id=$(node "$cli" thread start --base-dir "$home_dir" --provider "$provider_id" --model "$model_slug" --title 'Printing press history' "$project_dir" 'Reply Ready only.')
printf 'Open thread %s in the paired web app, wait for Ready, collapse sidebar and thread details.\n' "$thread_id"
printf 'Keep default paragraph streaming, light theme, 1280x800 viewport. Start recording and sampler.js.\n'
read -r -p 'Press Enter when recording is running. '
node "$cli" thread send --base-dir "$home_dir" "$thread_id" 'Write eight long paragraphs about the history of the printing press. Do not use any tools.'
printf 'Record until the reply completes; export window.proofSamples and stop recording.\n'
