feat(browser): auto-install the Browser Use CLI instead of silently downgrading
The Browser Use CLI became the default browser backend, but nothing provisioned it: users without uv/uvx (field report from DongyangHe on macOS) silently fell back to the built-in browser tools with no notice. - install_cli() in tools/browser_use_cli.py: uv tool install browser-use via the managed uv (bootstrapped on demand), linked into $HERMES_HOME/bin (UV_TOOL_BIN_DIR) - _find_cli() now also probes $HERMES_HOME/bin for browser-use/uvx — Hermes' managed uv is not on the user's PATH - hermes tools post_setup actually installs (Camofox standard) instead of printing instructions - install.sh / install.ps1 provision the CLI at install time (best-effort, non-fatal, honors --skip-browser) - CLI startup shows a one-line notice (24h rate-limited) when the default backend downgraded to the built-in tools
This commit is contained in:
committed by
Brooklyn Nicholson
parent
ed5e17f4b8
commit
baa6b2e34d
@@ -3156,6 +3156,50 @@ function Install-NodeDeps {
|
||||
$tuiLog = "$env:TEMP\hermes-npm-tui-$(Get-Random).log"
|
||||
[void](_Run-NpmInstall "TUI" $tuiDir $tuiLog $npmExe)
|
||||
}
|
||||
|
||||
Install-BrowserUseCli
|
||||
}
|
||||
|
||||
# The Browser Use CLI is the default browser backend when it is runnable
|
||||
# (tools/browser_use_cli.py). Provision it at install time so fresh installs
|
||||
# don't silently fall back to the built-in browser tools. Best-effort: any
|
||||
# failure is non-fatal (browser_exec can still run via uvx, and `hermes tools`
|
||||
# can install it later).
|
||||
function Install-BrowserUseCli {
|
||||
if (-not $script:UvCmd) { Resolve-UvCmd }
|
||||
if (-not $script:UvCmd) {
|
||||
Write-Info "Skipping Browser Use CLI install (uv unavailable)"
|
||||
return
|
||||
}
|
||||
$managedBin = Join-Path $HermesHome "bin"
|
||||
$managedBu = Join-Path $managedBin "browser-use.exe"
|
||||
if ((Get-Command browser-use -ErrorAction SilentlyContinue) -or (Test-Path $managedBu)) {
|
||||
Write-Success "Browser Use CLI already installed"
|
||||
return
|
||||
}
|
||||
|
||||
Write-Info "Installing Browser Use CLI (default browser backend)..."
|
||||
$prevEAP = $ErrorActionPreference
|
||||
$ErrorActionPreference = "Continue"
|
||||
try {
|
||||
# UV_TOOL_BIN_DIR keeps the binary inside Hermes' managed bin dir,
|
||||
# where the browser tool resolves it — no reliance on the user PATH.
|
||||
$env:UV_TOOL_BIN_DIR = $managedBin
|
||||
$env:UV_NO_CONFIG = "1"
|
||||
& $script:UvCmd tool install browser-use 2>&1 | Out-Null
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Success "Browser Use CLI installed"
|
||||
} else {
|
||||
Write-Warn "Browser Use CLI install failed (exit $LASTEXITCODE) -- browser automation falls back to built-in tools."
|
||||
Write-Info "Install later with: uv tool install browser-use (or via 'hermes tools')"
|
||||
}
|
||||
} catch {
|
||||
Write-Warn "Browser Use CLI install failed: $_"
|
||||
} finally {
|
||||
$ErrorActionPreference = $prevEAP
|
||||
Remove-Item Env:\UV_TOOL_BIN_DIR -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\UV_NO_CONFIG -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
# Clear the cached Electron download + any half-written unpacked output so the
|
||||
|
||||
@@ -2400,6 +2400,40 @@ install_node_deps() {
|
||||
restore_dirty_lockfiles "$INSTALL_DIR"
|
||||
}
|
||||
|
||||
install_browser_use_cli() {
|
||||
# The Browser Use CLI is the default browser backend when it is runnable
|
||||
# (tools/browser_use_cli.py). Provision it here so fresh installs don't
|
||||
# silently fall back to the built-in browser tools. Best-effort: any
|
||||
# failure is non-fatal because browser_exec can still run via uvx and
|
||||
# `hermes tools` can install it later.
|
||||
if [ "$SKIP_BROWSER" = true ]; then
|
||||
log_info "Skipping Browser Use CLI install (--skip-browser)"
|
||||
return 0
|
||||
fi
|
||||
if [ "$DISTRO" = "termux" ]; then
|
||||
return 0
|
||||
fi
|
||||
if [ -z "$UV_CMD" ]; then
|
||||
log_info "Skipping Browser Use CLI install (uv unavailable)"
|
||||
return 0
|
||||
fi
|
||||
if command -v browser-use >/dev/null 2>&1 || [ -x "$HERMES_HOME/bin/browser-use" ]; then
|
||||
log_success "Browser Use CLI already installed"
|
||||
return 0
|
||||
fi
|
||||
|
||||
log_info "Installing Browser Use CLI (default browser backend)..."
|
||||
# UV_TOOL_BIN_DIR keeps the binary inside Hermes' managed bin dir, where
|
||||
# the browser tool resolves it — no reliance on the user's PATH.
|
||||
if run_with_timeout 600 env UV_NO_CONFIG=1 UV_TOOL_BIN_DIR="$HERMES_HOME/bin" \
|
||||
"$UV_CMD" tool install browser-use >/dev/null 2>&1; then
|
||||
log_success "Browser Use CLI installed"
|
||||
else
|
||||
log_warn "Browser Use CLI install failed — browser automation falls back to built-in tools."
|
||||
log_info "Install later with: $UV_CMD tool install browser-use (or via 'hermes tools')"
|
||||
fi
|
||||
}
|
||||
|
||||
run_setup_wizard() {
|
||||
if [ "$RUN_SETUP" = false ]; then
|
||||
log_info "Skipping setup wizard (--skip-setup)"
|
||||
@@ -3222,6 +3256,8 @@ run_stage_body() {
|
||||
require_install_dir
|
||||
check_node
|
||||
install_node_deps
|
||||
install_uv
|
||||
install_browser_use_cli
|
||||
;;
|
||||
path)
|
||||
detect_os
|
||||
@@ -3337,6 +3373,7 @@ main() {
|
||||
setup_venv
|
||||
install_deps
|
||||
install_node_deps
|
||||
install_browser_use_cli
|
||||
setup_path
|
||||
copy_config_templates
|
||||
run_setup_wizard
|
||||
|
||||
Reference in New Issue
Block a user