#!/usr/bin/env bash
set -euo pipefail
# Run from each checkout after starting it with T3CODE_DEV_SEED=0 vp run dev.
# Argument: an empty synthetic workspace, shared between the two runs.
workspace="${1:?Pass a synthetic workspace directory}"
node apps/server/src/bin.ts project add "$workspace" --title 'Background work demo' --base-dir "$PWD/.t3"
node apps/server/src/bin.ts thread start "$workspace" 'Launch exactly one general-purpose subagent with run_in_background=true and end your turn immediately. Its task: run sleep 20 in the foreground, then call Bash once with run_in_background=true, no description, command sleep 180 && cd /tmp && ls -la | tail -n 5, then wait for it. Do not run the shell yourself.' --provider claudeAgent --model claude-haiku-5-5 --title 'Background shell command' --base-dir "$PWD/.t3" --json
# Pair the browser, open the returned thread by /<environment-id>/<encoded-thread-id>.
# Wait for the parent to finish and the delayed background shell to start.
# Record and activate the Details button, then capture the Background work dialog.
# Both runs: Chromium, 1280x800 CSS pixels, DPR 2, light theme.
# Published stills crop to the dialog; videos crop off the environment label.
