This commit is contained in:
Chris Tate
2026-01-11 04:00:44 -06:00
parent 24d32ade9c
commit 58bbd17635
3 changed files with 13 additions and 29 deletions
+7 -16
View File
@@ -1,6 +1,6 @@
#!/bin/sh
# agent-browser CLI wrapper
# Detects platform and runs the appropriate native binary
# Tries native binary first, falls back to Node.js
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
@@ -9,29 +9,20 @@ case "$OS" in
darwin) OS="darwin" ;;
linux) OS="linux" ;;
mingw*|msys*|cygwin*) OS="win32" ;;
*) echo "Unsupported OS: $OS" >&2; exit 1 ;;
esac
case "$ARCH" in
x86_64|amd64) ARCH="x64" ;;
aarch64|arm64) ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BINARY="$SCRIPT_DIR/agent-browser-${OS}-${ARCH}"
if [ "$OS" = "win32" ]; then
BINARY="agent-browser-${OS}-${ARCH}.exe"
else
BINARY="agent-browser-${OS}-${ARCH}"
# Try native binary if it exists
if [ -f "$BINARY" ] && [ -x "$BINARY" ]; then
exec "$BINARY" "$@"
fi
BINARY_PATH="$SCRIPT_DIR/$BINARY"
if [ ! -f "$BINARY_PATH" ]; then
echo "Native binary not found: $BINARY" >&2
echo "Falling back to Node.js..." >&2
exec node "$SCRIPT_DIR/../dist/index.js" "$@"
fi
exec "$BINARY_PATH" "$@"
# Fall back to Node.js
exec node "$SCRIPT_DIR/../dist/index.js" "$@"
+5 -12
View File
@@ -1,6 +1,6 @@
@echo off
:: Cross-platform launcher for agent-browser (Windows)
:: Detects architecture and runs the appropriate native binary
:: agent-browser CLI wrapper for Windows
:: Tries native binary first, falls back to Node.js
setlocal
@@ -23,13 +23,6 @@ if exist "%BINARY%" (
exit /b %errorlevel%
)
:: Fallback to Node.js implementation
set "NODE_CLI=%SCRIPT_DIR%..\dist\cli-light.js"
if exist "%NODE_CLI%" (
node "%NODE_CLI%" %*
exit /b %errorlevel%
)
echo Error: No binary found for win32-%ARCH% >&2
echo Run 'npm run build:native' or 'npm run build:all-platforms' to build >&2
exit /b 1
:: Fall back to Node.js
node "%SCRIPT_DIR%..\dist\index.js" %*
exit /b %errorlevel%