Commit Graph

120 Commits

Author SHA1 Message Date
shawn pana 7e92031593 Merge branch 'main' into install-lite 2026-03-26 09:43:49 -07:00
ShawnPana e3a994a39d fix: non-fatal validate + curl check before use 2026-03-26 09:40:35 -07:00
ShawnPana 2f41a42eab extract CLI deps to requirements-cli.txt + add CI test 2026-03-26 09:27:18 -07:00
ShawnPana 822a4d948b add aiohttp to lite install deps (needed by LocalBrowserWatchdog._wait_for_cdp_url) 2026-03-26 09:15:29 -07:00
ShawnPana a2cbe678b7 add lightweight CLI install script 2026-03-26 09:15:29 -07:00
Laith Weinberger 9b401cf04c fix tunnel process kill and daemon spawn on windows 2026-03-25 19:28:47 -04:00
Laith Weinberger a31809b83d preserve error exit code 2026-03-25 17:15:34 -04:00
Laith Weinberger c9ea2fb1cf fix daemon orphaning when external browser dies on --connect/--cdp-url 2026-03-25 17:07:03 -04:00
laithrw b6e17ceb05 Merge branch 'main' into fix/install-shell-detection 2026-03-25 16:13:42 -04:00
Laith Weinberger e44ce7ce73 fix linux profile detection for chromium users 2026-03-24 18:14:22 -04:00
Ishan Shah bb40ff255b fix: mark install.sh as executable in git 2026-03-22 19:52:30 -07:00
Ishan Shah fddc133aa9 fix: detect uv installed via curl script 2026-03-22 19:39:49 -07:00
Hirokazu Tanaka 65a57742f5 fix: align print_next_steps shell detection with configure_path
Ensure print_next_steps() falls back to .profile for non-bash/zsh
shells, matching the behavior of configure_path().
2026-03-22 14:41:36 +09:00
Hirokazu Tanaka ba8bdb56ba fix: use login shell instead of running shell for PATH configuration
When the install script is executed via `curl ... | bash`, it always
runs in a bash process, so $BASH_VERSION is always set regardless of
the user's actual shell. This causes PATH to be written to ~/.bashrc
even for zsh users, making the `browser-use` command unavailable.

Use $SHELL (the user's login shell) instead of $BASH_VERSION/$ZSH_VERSION
to detect the correct shell RC file.

Fixes #4440
2026-03-22 14:36:36 +09:00
ShawnPana dbb356d2eb fall back to raw profile value when Chrome metadata can't be read
If list_chrome_profiles() returns empty (permissions, corrupt Local State,
first-run Chrome), skip resolution and use the profile value as-is instead
of always raising RuntimeError.
2026-03-19 23:14:31 -07:00
ShawnPana 566bca0a88 handle ping success:false case in ensure_daemon config check
Previous commit fixed the exception path. This fixes the case where
ping returns a response with success:false — same fallthrough bug.
2026-03-19 23:10:22 -07:00
ShawnPana edfd554f0f fix ensure_daemon falling through on ping failure with explicit config
When ping fails but daemon is alive, return instead of trying to spawn
a second daemon. The old daemon holds the socket so the new one can't
bind, causing silent config mismatch.
2026-03-19 23:06:31 -07:00
ShawnPana 1b5edbaac9 fix tunnel example: add cloud connect before opening tunnel URL 2026-03-19 22:58:12 -07:00
ShawnPana 638198687e pin profile-use version in install.sh to avoid GitHub API rate limiting
The profile-use install script fetches the latest version from GitHub API,
which is rate-limited to 60 req/hour for unauthenticated requests. CI
runners share IPs and exhaust this limit. Pin to v1.0.2 to skip the API
call. Users can update later via browser-use profile update.
2026-03-19 22:52:11 -07:00
ShawnPana 4188eeb3ea resolve profile display names and show available profiles on mismatch
--profile now accepts both directory names ("Default", "Profile 1") and
display names ("Person 1", "Work") with case-insensitive matching. On
unknown profile, lists all available profiles with both names.
2026-03-19 22:45:52 -07:00
ShawnPana 5a77129d1b fix docs: use --profile "Default" instead of bare --profile before subcommands
Bare --profile before a subcommand like 'open' causes argparse to consume
the subcommand as the profile value. Always use explicit profile name.
2026-03-19 22:38:37 -07:00
ShawnPana e0027909ec guard s.close() in is_daemon_alive against UnboundLocalError
Initialize s = None before try so finally doesn't crash if
socket.socket() itself fails.
2026-03-19 22:33:55 -07:00
ShawnPana 0509146cf5 move socket creation inside try block in is_daemon_alive
Ensures the function always returns bool, never throws if socket
allocation fails.
2026-03-19 22:22:04 -07:00
ShawnPana f29aa6b5bc fix os.kill(pid, 0) on Windows: use OpenProcess instead of TerminateProcess
On Windows, os.kill(pid, 0) calls TerminateProcess which kills the process
instead of checking liveness. Use ctypes OpenProcess for Windows, keeping
os.kill(pid, 0) for Unix. Affects list_sessions(), tunnel PID checks, and
_handle_sessions().
2026-03-19 22:17:31 -07:00
ShawnPana 77bbfbbb66 fix INSTALL_DIR scoping in install.sh, use cross-platform cloudflared fix in doctor
- Pass INSTALL_DIR to sh instead of curl so profile-use installs to
  the correct location (~/.browser-use/bin/)
- Replace macOS-specific 'brew install cloudflared' with generic link
2026-03-19 22:08:35 -07:00
ShawnPana 54f3febdfa address PR review comments: fix cloud v2 --help, guard double signal, error to stderr, stale port
- Narrow cloud --help intercept to only fire when --help is immediately
  after 'cloud', so 'cloud v2 --help' still shows OpenAPI endpoints
- Guard signal handler against concurrent shutdown tasks on repeated signals
- Route error response bodies to stderr in cloud REST commands
- Replace stale port 49200 in README Windows troubleshooting
2026-03-19 22:04:34 -07:00
ShawnPana c5885e9e06 store shutdown task reference to prevent browser orphaning on signal exit
await the shutdown task in run() so browser cleanup (kill/stop) completes
before the event loop tears down. Previously, asyncio.run() could cancel
the shutdown mid-cleanup, leaving Chrome processes orphaned.
2026-03-19 21:55:14 -07:00
ShawnPana c26f228e5a fix cloud --help to show custom usage, tighten test assertions
- Intercept `cloud --help` early so it routes to _print_cloud_usage()
  instead of argparse's generic stub
- Remove permissive `or 'cloud'` fallback in epilog test assertion
- Delete no-op regex test that didn't verify actual code
- Tighten default socket path assertion to check 'default.sock'
2026-03-19 21:48:28 -07:00
ShawnPana 9980a9ea4f remove redundant string quotes on type annotations in daemon.py 2026-03-19 21:21:18 -07:00
ShawnPana 9f33a88a91 fix formatting: line length in profile_use.py, missing blank line in tunnel.py 2026-03-19 21:17:36 -07:00
ShawnPana 69902b713d fix docs/code discrepancies: add click coordinates, annotate extract, add --session
- Document coordinate clicking (click <x> <y>) in all interaction sections
- Annotate extract command as not yet implemented in README and SKILL.md
- Remove browser.extract() from Python wrapper docs (raises NotImplementedError)
- Add --session flag to global options tables in both SKILL.md files
2026-03-19 20:21:09 -07:00
ShawnPana 55665f70b8 fix socket FD leaks on connect() failure in CLI daemon infrastructure
Wrap socket creation + connect in try/finally across 5 locations to
ensure sockets are closed when connect() raises. Previously, failed
connections leaked file descriptors until GC ran.
2026-03-19 19:58:58 -07:00
ShawnPana 694a111fad add upload command to CLI, extract find_file_input_near_element to BrowserSession
- Add `browser-use upload <index> <path>` command for uploading files to
  file input elements via the CLI
- Extract find_file_input_near_element from nested closures in tools/service.py
  to a reusable method on BrowserSession, deduplicating two copies
- Add BrowserWrapper.upload() for the Python REPL
- Resolve file paths to absolute on the client side before sending to daemon
- Update SKILL.md files and README with upload command docs
2026-03-19 17:02:34 -07:00
ShawnPana 43e007238c update docs for profile-use integration and ~/.browser-use/ directory layout
Document profile subcommand as passthrough to profile-use Go binary,
add file layout section showing ~/.browser-use/ structure, update
authenticated browsing workflow examples for new profile list output.
2026-03-18 16:30:56 -07:00
ShawnPana c70e5029ae fix profile subcommand argparse passthrough
Use nargs=REMAINDER to capture profile-use args, matching the cloud
subcommand pattern. Without this, argparse rejects unknown args like
'browser-use profile update'.
2026-03-18 16:19:41 -07:00
ShawnPana d3e1818496 consolidate CLI files under ~/.browser-use/, add profile-use integration and doctor checks
Unify all CLI-managed files under ~/.browser-use/ (config, sockets, PIDs,
binaries, tunnels) instead of scattering across ~/.config/browser-use/ and
~/.browser-use/run/. Add profile-use Go binary as managed subcommand via
browser-use profile, with auto-download fallback and install.sh integration.
Wire cloudflared and profile-use availability checks into browser-use doctor.
2026-03-18 16:16:28 -07:00
ShawnPana bff2918558 add --connect flag for Chrome auto-discovery and fix daemon shutdown for external browsers
Adds `--connect` to auto-discover running Chrome instances via DevToolsActivePort
files and well-known port probing, eliminating manual CDP URL construction. Fixes
daemon process hanging on `close` when connected to external browsers (--connect,
--cdp-url, cloud) by calling stop() (disconnect) instead of kill() (terminate).
2026-03-18 09:41:58 -07:00
ShawnPana bfa886afea add cloud command and config utilities
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 10:12:49 -07:00
ShawnPana 3318f56318 simplify CLI infrastructure: single-session daemon, remove install modes, streamline setup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 10:12:41 -07:00
ShawnPana c93a867a85 add API key signup URL to cloud command error message
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 16:01:27 -07:00
ShawnPana 0dc2fc5a6f remove run command and agent infrastructure from CLI
The `run` command pulled in heavy SDK dependencies (openai, anthropic,
google), had a bug (await on sync get_llm), and is superseded by
`browser-use cloud` for agent execution. CLI is now purely a browser
automation interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 11:44:13 -07:00
ShawnPana 91e987acdc add browser-use cloud command: generic REST passthrough to Cloud API
Login/logout with API key persistence, versioned REST calls (v2/v3),
task polling, and OpenAPI-driven help. Stdlib only, no daemon needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 11:13:43 -07:00
ShawnPana 4be221386b changes 2026-03-11 12:57:50 -07:00
ShawnPana 859cb97063 simplify daemon architecture: single session, socket-as-liveness, no PID/lock files
Replace the multi-session server (server.py, SessionRegistry, portalocker locking,
PID files, orphan detection) with a minimal daemon (daemon.py) that holds one
BrowserSession in memory. Socket file existence = alive. Auto-exits when browser
dies via CDP watchdog.

-2277 lines, +142 lines across 20 files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 19:05:44 -08:00
ShawnPana 39698e58e4 strip cloud/remote commands from skill_cli
Remove all cloud API paths from the CLI while leaving core library
cloud support (BrowserSession(use_cloud=True), browser/cloud/) untouched.

Deleted: api_key.py, cloud_task.py, cloud_session.py
Removed: --browser remote, cloud-only run flags, task/session subcommands,
cloud profile ops (create/update/delete/sync), remote mode validation
Kept: tunnel (just Cloudflare), all local commands, install_config.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 15:56:31 -08:00
Laith Weinberger 8ebe4385ed fix: preserve non-ASCII chars in all remaining JSON file outputs 2026-03-01 14:19:38 -05:00
laithrw 2249e75fd8 Merge branch 'main' into improving-real-browser 2026-02-20 19:28:06 -05:00
Saurav Panda 552b2f3b60 fixed ruff format 2026-02-19 18:38:23 -08:00
Saurav Panda 3f63677756 new direct cli mode 2026-02-19 10:18:12 -08:00
ShawnPana 8af57fa19a feat(install): always install from GitHub main branch
Changes install.sh to clone from github.com/browser-use/browser-use@main
by default instead of installing from PyPI. Custom branches and repos
can still be specified via BROWSER_USE_BRANCH and BROWSER_USE_REPO
environment variables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 11:37:18 -08:00