#!/bin/bash
exec > /tmp/amdwork/02_probe2.out 2>&1
echo "=== Xvfb ==="
pgrep -af Xvfb || echo "no Xvfb"
echo "=== existing chrome DISPLAY env (proc 1064 area) ==="
# find the main browser process (has --remote-debugging-port=9222 but not --type=)
for pid in $(pgrep -f 'remote-debugging-port=9222'); do
  t=$(tr '\0' ' ' < /proc/$pid/cmdline 2>/dev/null)
  case "$t" in
    *--type=*) ;;
    *) echo "MAIN pid=$pid"; echo "DISPLAY=$(tr '\0' '\n' < /proc/$pid/environ 2>/dev/null | grep ^DISPLAY=)";;
  esac
done
echo "=== home config dirs ==="
ls -la /home/claude/ | grep -E 'chrome|config' || true
echo "=== existing agent profile? ==="
ls -la /home/claude/chrome-profile-agent 2>/dev/null || echo "no agent profile yet"
echo "=== DONE ==="
