Commit Graph

4577 Commits

Author SHA1 Message Date
Magnus Müller d4b9e30188 Remove litellm from dependencies (supply chain attack CVE)
litellm versions 1.82.7 and 1.82.8 were backdoored on March 24, 2026
by TeamPCP via a compromised Trivy CI/CD pipeline. browser-use 0.12.3
shipped litellm>=1.82.2 (unpinned) as a core dependency, exposing
~6,900 users to the backdoored versions during the 4-hour window.

This commit:
- Removes litellm entirely from pyproject.toml (core and optional)
- Keeps ChatLiteLLM wrapper intact with a docstring noting
  `pip install litellm` is required separately
- litellm is already lazy-imported inside methods, so users who
  don't use ChatLiteLLM are never affected

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:29:44 -07: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
Laith Weinberger 29da480659 replace MV2 extensions with MV3 + remove chrome flags that block extension loading 2026-03-22 14:17:56 -04:00
Saurav Panda 4a65aea6a9 Merge branch 'main' into auto-switch-new-tab 2026-03-21 17:17:32 -07:00
Saurav Panda 03de83a069 Merge branch 'main' into iframe-click-issue 2026-03-21 15:57:02 -07:00
Saurav Panda 3b8f2457b1 fix: index elements inside cross-origin iframes reliably 2026-03-21 15:54:35 -07:00
Laith Weinberger 43b5e4ce1d rm code agent 2026-03-21 02:05:42 -04:00
Saurav Panda e7a05cbe86 fix: auto-switch to new tabs after click and add checkbox toggle fallback
- AGI-569: after any click that opens a new tab, automatically dispatch
  SwitchTabEvent so the agent lands on the new page immediately instead
  of requiring a manual switch step (~877 occurrences)

- AGI-548: for <input type="checkbox/radio">, capture checked state
  before the CDP mouse click and verify it toggled afterward; if
  unchanged (custom-styled or shadow-DOM-backed inputs), fall back to
  JS element.click() and report the final checked state in metadata
  (~1,241 occurrences)
2026-03-20 12:43:58 -07:00
shawn pana a2c2fa33aa Merge branch 'main' into cli 2026-03-20 09:34:45 -07:00
reformedot 2675c52e65 Enhance User-Agent header handling in BrowserSession
- Updated the BrowserSession class to ensure the User-Agent header is set correctly for both local and remote connections.
- Introduced a utility function to retrieve the browser-use version and incorporated it into the User-Agent string.
- Ensured headers are consistently handled as dictionaries to avoid potential issues with None values.

This change improves the reliability of the CDP client communication by providing a proper User-Agent, which can be crucial for certain web interactions.
2026-03-19 23:33:10 -07: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 91c02012c3 merge origin/main into cli, resolve agent.py delete conflict 2026-03-19 21:06:38 -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
Saurav Panda c53ff656f5 check root before llm_representation fallback 2026-03-19 20:17:46 -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
Saurav Panda 6d86be3a6b fix: detect skeleton screens and retry navigation for blank SPA pages 2026-03-19 18:48:47 -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
Saurav Panda cc1cf2b1c7 Merge branch 'main' into fix-image-url-stripping 2026-03-19 15:34:27 -07:00
Saurav Panda 9445a9ff9e fix image URLs stripped from extracted markdown 2026-03-19 15:29:06 -07:00
Saurav Panda befc7155ad Merge branch 'main' into fix-done-action-hallucination 2026-03-18 18:08:01 -07:00
Saurav Panda cb75bf846a Merge branch 'main' into fix-compaction-hallucination 2026-03-18 17:54:14 -07:00
Saurav Panda 42e9c101fd Update browser_use/agent/system_prompts/system_prompt_flash.md
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-03-18 17:51:54 -07:00
Saurav Panda a31b62ae93 Merge branch 'main' into fix-done-action-hallucination 2026-03-18 17:39:40 -07:00
Saurav Panda 70ced22b7b fixed system prompt for data grounding 2026-03-18 17:39:17 -07:00
Saurav Panda 624c040f6a Merge branch 'main' into fix/sensitive-action-result-redaction 2026-03-18 17:15:38 -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
Saurav Panda cc3cc8fea7 Merge branch 'main' into fix-done-action-hallucination 2026-03-18 16:11:31 -07:00
Saurav Panda 179d526786 added better data grounding in done action 2026-03-18 16:08:00 -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
Saurav Panda 653d795f15 changed default compaction to 25 steps 2026-03-17 17:17:20 -07:00
Saurav Panda 0dea9480ee Merge branch 'main' into fix-compaction-hallucination 2026-03-17 15:43:11 -07:00