Files
chrome-use/scripts/windows-debug/start.sh
T
Chris Tate 8d78fcbbb3 fix: Windows Chrome extraction and debugging environment (#1088)
* windows debugging

* fixes

* fixes

* fix: handle Windows path separators in Chrome zip extraction

The zip crate's enclosed_name() normalizes paths to use backslashes on
Windows, but extract_zip used split_once('/') which only matches forward
slashes. This caused Chrome to be extracted into a nested chrome-win64/
subdirectory instead of directly into the version directory.

Also adds debug diagnostics to find_installed_chrome() (gated behind
AGENT_BROWSER_DEBUG) and better error messages when Chrome cache exists
but no binary is found.

Fixes #1076

* feat: add Puppeteer browser cache as Chrome fallback

Search ~/.cache/puppeteer/chrome/ (or PUPPETEER_CACHE_DIR) for Chrome
binaries before falling back to Playwright's cache. Puppeteer v19+
stores Chrome for Testing in this location, so users with an existing
Puppeteer install can use agent-browser without a separate install step.

* fmt
2026-03-30 12:37:01 -05:00

44 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
INSTANCE_FILE="$SCRIPT_DIR/.instance"
if [[ ! -f "$INSTANCE_FILE" ]]; then
echo "Error: No instance provisioned. Run ./scripts/windows-debug/provision.sh first."
exit 1
fi
source "$INSTANCE_FILE"
export AWS_DEFAULT_REGION="$REGION"
STATE=$(aws ec2 describe-instances \
--instance-ids "$INSTANCE_ID" \
--query "Reservations[0].Instances[0].State.Name" --output text)
if [[ "$STATE" == "running" ]]; then
echo "Instance $INSTANCE_ID is already running."
else
echo "Starting instance $INSTANCE_ID..."
aws ec2 start-instances --instance-ids "$INSTANCE_ID" --no-cli-pager
echo "Waiting for running state..."
aws ec2 wait instance-running --instance-ids "$INSTANCE_ID"
echo "Instance is running."
fi
echo "Waiting for SSM agent connectivity..."
for i in $(seq 1 30); do
SSM_STATUS=$(aws ssm describe-instance-information \
--filters "Key=InstanceIds,Values=$INSTANCE_ID" \
--query "InstanceInformationList[0].PingStatus" --output text 2>/dev/null || echo "None")
if [[ "$SSM_STATUS" == "Online" ]]; then
echo "SSM agent is online. Ready for commands."
echo " ./scripts/windows-debug/run.sh \"your-command-here\""
exit 0
fi
sleep 10
done
echo "Warning: SSM agent not online after 5 minutes. The instance may still be booting."
echo "Try again in a minute: ./scripts/windows-debug/run.sh \"hostname\""