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 #!/bin/sh
# agent-browser CLI wrapper # 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:]') OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m) ARCH=$(uname -m)
@@ -9,29 +9,20 @@ case "$OS" in
darwin) OS="darwin" ;; darwin) OS="darwin" ;;
linux) OS="linux" ;; linux) OS="linux" ;;
mingw*|msys*|cygwin*) OS="win32" ;; mingw*|msys*|cygwin*) OS="win32" ;;
*) echo "Unsupported OS: $OS" >&2; exit 1 ;;
esac esac
case "$ARCH" in case "$ARCH" in
x86_64|amd64) ARCH="x64" ;; x86_64|amd64) ARCH="x64" ;;
aarch64|arm64) ARCH="arm64" ;; aarch64|arm64) ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac esac
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BINARY="$SCRIPT_DIR/agent-browser-${OS}-${ARCH}"
if [ "$OS" = "win32" ]; then # Try native binary if it exists
BINARY="agent-browser-${OS}-${ARCH}.exe" if [ -f "$BINARY" ] && [ -x "$BINARY" ]; then
else exec "$BINARY" "$@"
BINARY="agent-browser-${OS}-${ARCH}"
fi fi
BINARY_PATH="$SCRIPT_DIR/$BINARY" # Fall back to Node.js
exec node "$SCRIPT_DIR/../dist/index.js" "$@"
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" "$@"
+5 -12
View File
@@ -1,6 +1,6 @@
@echo off @echo off
:: Cross-platform launcher for agent-browser (Windows) :: agent-browser CLI wrapper for Windows
:: Detects architecture and runs the appropriate native binary :: Tries native binary first, falls back to Node.js
setlocal setlocal
@@ -23,13 +23,6 @@ if exist "%BINARY%" (
exit /b %errorlevel% exit /b %errorlevel%
) )
:: Fallback to Node.js implementation :: Fall back to Node.js
set "NODE_CLI=%SCRIPT_DIR%..\dist\cli-light.js" node "%SCRIPT_DIR%..\dist\index.js" %*
if exist "%NODE_CLI%" ( exit /b %errorlevel%
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
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "agent-browser", "name": "agent-browser",
"version": "0.3.3", "version": "0.3.4",
"description": "Headless browser automation CLI for AI agents", "description": "Headless browser automation CLI for AI agents",
"type": "module", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",