Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bin/agent-browser
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ ARCH=$(uname -m)
case "$OS" in darwin) OS="darwin" ;; linux) OS="linux" ;; mingw*|msys*|cygwin*) OS="win32" ;; esac
case "$ARCH" in x86_64|amd64) ARCH="x64" ;; aarch64|arm64) ARCH="arm64" ;; esac

BINARY="$SCRIPT_DIR/agent-browser-${OS}-${ARCH}"
# Add .exe extension for Windows binaries
EXT=""
case "$OS" in win32) EXT=".exe" ;; esac

BINARY="$SCRIPT_DIR/agent-browser-${OS}-${ARCH}${EXT}"

if [ -f "$BINARY" ] && [ -x "$BINARY" ]; then
exec "$BINARY" "$@"
Expand Down
23 changes: 22 additions & 1 deletion bin/agent-browser.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
@echo off
setlocal

:: Detect architecture
set "ARCH=x64"
if "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "ARCH=arm64"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows ARM64 architecture detection attempts to load non-existent agent-browser-win32-arm64.exe binary, causing npm install to fail on ARM64 Windows machines

Fix on Vercel

if "%PROCESSOR_ARCHITECTURE%"=="x86" (
if not defined PROCESSOR_ARCHITEW6432 set "ARCH=x86"
)
Comment on lines +7 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
if not defined PROCESSOR_ARCHITEW6432 set "ARCH=x86"
)
:: Note: x86 detection (32-bit Windows) is not supported as only x64 binaries are built.
:: On 32-bit systems, x64 emulation will be used (default ARCH=x64 above).

Windows 32-bit detection sets ARCH=x86 but no agent-browser-win32-x86.exe binary is built, causing npm install to fail on 32-bit Windows systems

Fix on Vercel


:: Get script directory
set "SCRIPT_DIR=%~dp0"
node "%SCRIPT_DIR%..\dist\index.js" %*

:: Path to the Windows binary
set "BINARY=%SCRIPT_DIR%agent-browser-win32-%ARCH%.exe"

:: Check if binary exists
if not exist "%BINARY%" (
echo Error: agent-browser binary not found at %BINARY% >&2
echo Run 'npm install' to download the binary, or 'npm run build:native' to build it locally. >&2
Comment on lines +19 to +20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo Error: agent-browser binary not found at %BINARY% >&2
echo Run 'npm install' to download the binary, or 'npm run build:native' to build it locally. >&2
echo Error: agent-browser binary not found at %BINARY%
echo Run 'npm install' to download the binary, or 'npm run build:native' to build it locally.

Invalid stderr redirection syntax >&2 in Windows batch file that doesn't support Unix-style redirection

Fix on Vercel

exit /b 1
)

:: Run the binary with all arguments
"%BINARY%" %*
exit /b %errorlevel%