#!/usr/bin/env bash
set -euo pipefail
# The dev client is paired with the isolated environment and Long history is open.
session="$1"
side="$2"
out="$3"
agent-device screenshot "$out/$side-initial.png" --session "$session"
agent-device record start "$out/$side.mp4" --fps 10 --hide-touches --session "$session"
if [ "$side" = after ]; then
  agent-device press 'label="Keep the full history"' --settle --session "$session"
fi
agent-device fill 'role=text-view' 'Continue with the full history.' --settle --session "$session"
agent-device press 'label="Send"' --settle --session "$session"
# Inspect the completed interaction before stopping; the base shows Compacting and 1 queued.
agent-device screenshot "$out/$side-sent.png" --session "$session"
agent-device record stop --session "$session"
