665 Commits

Author SHA1 Message Date
Saurav Panda 95215d6211 Add save_as_pdf agent action for CDP-based page-to-PDF export 2026-02-24 18:35:34 -08:00
Saurav Panda de8039288d Merge branch 'main' into browser-use-radio-button-interaction-issue 2026-02-23 16:55:36 -08:00
Saurav Panda 84babc6b75 fix radio button click occlusion when label overlaps input 2026-02-23 16:19:05 -08:00
Saurav Panda e50588f3c7 fixed styling issues 2026-02-23 15:24:40 -08:00
Saurav Panda 6713afc636 updated _navigate_and_wait 2026-02-21 19:45:54 -08:00
Saurav Panda 69d96c1f45 Merge branch 'main' into cli-add-cordinate-clicking 2026-02-19 18:45:52 -08:00
Saurav Panda 552b2f3b60 fixed ruff format 2026-02-19 18:38:23 -08:00
Saurav Panda 41edfca525 fixed code style issues 2026-02-19 18:17:24 -08:00
Saurav Panda 86b12491dc fixed remote urls in tests 2026-02-19 16:04:06 -08:00
Saurav Panda a3eee8edfe fixed mcp issue 2026-02-19 15:55:22 -08:00
Saurav Panda 33b3af15e6 fixed lint issues 2026-02-19 12:53:46 -08:00
Saurav Panda c18ee5412f add file atttachments to structured output. 2026-02-19 12:43:05 -08:00
Saurav Panda 3f63677756 new direct cli mode 2026-02-19 10:18:12 -08:00
Saurav Panda 7833fcd137 added cookie overlay fix 2026-02-17 11:47:23 -08:00
ShawnPana bff682fee6 fix: address CI lint failures
- Remove unused `import os` from test_doctor_command.py
- Add assert for proc.stdout in test_server_locking.py to satisfy pyright

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 10:36:27 -08:00
ShawnPana 99b0fab320 test(doctor): remove mocking, use real objects per test policy
- Removed all unittest.mock.patch usage
- Tests now use real functions and verify structure/behavior
- Use monkeypatch for env vars (acceptable for test isolation)
- Tests adapt to system state (cloudflared may or may not exist)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 10:30:12 -08:00
ShawnPana c8242e7edd fix(cli): prevent orphaned server processes with flock-based locking
The session server had a race condition where concurrent CLI calls could
spawn multiple server processes. The old server would be orphaned when
the new one overwrote the PID file and deleted its socket.

Changes:
- Add flock-based locking using portalocker (already a dependency)
- Server acquires exclusive lock before writing PID file
- CLI checks both is_server_running() AND is_session_locked()
- Add kill_orphaned_server() to clean up servers with PID but no lock
- Increase socket timeout from 0.1s to 0.5s for reliability
- cleanup_session_files() now removes .lock and .meta files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 10:10:05 -08:00
ShawnPana 4d8c4e5e48 refactor(cli): consolidate tunnel code into single tunnel.py
- Rename tunnel_manager.py to tunnel.py
- Remove dead code: commands/tunnel.py (session-scoped implementation never reached)
- Remove TunnelInfo dataclass and tunnels field from sessions.py
- Remove tunnel routing from server.py (unreachable code path)
- Update imports in main.py, doctor.py, setup.py, and tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 02:09:55 -08:00
ShawnPana e34ee5898e fix(tests): remove unused imports and fix formatting
Pre-commit hooks auto-fixed:
- test_doctor_command.py: Remove unused browser_use import
- test_install_config.py: Remove unused tempfile import, fix formatting
- test_session_browser_mode.py: Remove unused imports (patch, pytest), fix formatting
- test_setup_command.py: Remove unused pytest import

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 15:48:26 -08:00
ShawnPana 35271ed802 fix: address cubic-dev-ai code review concerns from PR #4078
- agent.py: Move API key check inside remote mode block only, allowing
  local mode to work with OPENAI/ANTHROPIC keys without BROWSER_USE_API_KEY
- tunnel_manager.py: Close log file handle on success path to prevent
  file descriptor leak
- profile.py: Use stderr for progress messages when --json flag is set;
  add cleanup_cloud_profile() to delete orphaned cloud profiles on sync failure
- install.sh: Add guard for --api-key requiring a value; warn on unknown
  arguments instead of silently ignoring; fix read -p with < /dev/tty
  for piped install (curl | bash)
- test_setup_command.py: Remove all unittest.mock usage per repo guidelines,
  replace with real function calls that verify structure and logic

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 15:38:01 -08:00
ShawnPana c0dd7875b8 feat(install): mode-based installation with interactive TUI
Add installation mode selection that determines which browser modes are
available at runtime. This enables lightweight remote-only installs for
sandboxed agents (skipping ~300MB Chromium download).

## Install Modes

- `--remote-only`: Only remote mode, installs cloudflared, skips Chromium
- `--local-only`: Only local modes (chromium/real), skips cloudflared
- `--full`: All modes available (default interactive selection)

## Runtime Behavior

- Single installed mode becomes the default (no --browser flag needed)
- Requesting unavailable mode shows clear error with reinstall instructions
- No config file = all modes available (backward compat for pip users)

## Changes

**New: browser_use/skill_cli/install_config.py**
- Manages ~/.browser-use/install-config.json
- get_config(), save_config(), is_mode_available(), get_default_mode()
- get_mode_unavailable_error() for helpful reinstall guidance

**Modified: browser_use/skill_cli/main.py**
- build_parser() uses config for --browser choices and default
- Validates mode availability before starting session server

**Modified: browser_use/skill_cli/sessions.py**
- create_browser_session() validates mode before creation

**Modified: install.sh**
- Command-line flags: --full, --remote-only, --local-only, --api-key
- Interactive TUI with fallback: gum → whiptail → pure bash menu
- Conditional dependency installation based on selected modes
- Writes install-config.json with installed modes

**Updated: skills/remote-browser/SKILL.md**
- Simplified examples (no --browser remote needed with --remote-only)
- Updated setup instructions for mode-based installation

**New: tests/ci/test_install_config.py**
- 13 tests covering config module
2026-02-09 20:36:08 -08:00
ShawnPana 9f51461bbd fix(cli): error when requesting remote browser on local session + improve docs
When a session is started without --browser remote and a subsequent command
uses --browser remote, the CLI now errors with guidance instead of silently
using the local browser (which loses cloud features like live_url).

Code changes:
- Add session metadata file to track browser_mode per session
- Error only when remote requested but session is local
- Allow local-on-remote (user gets more features than requested)
- Clean up metadata on session close

SKILL.md improvements:
- Clarify that --browser remote only needed on FIRST command
- Add table showing session modes
- Add "What happens if you forget" section with error example
- Add troubleshooting entry for mode mismatch error

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 18:20:06 -08:00
ShawnPana 3c9b2501ac fix(cli): detect browser mode mismatch between existing session and requested mode
When a session is started with --browser chromium and a subsequent command
uses --browser remote (or vice versa), the CLI now detects the mismatch and
provides actionable error guidance instead of silently using the wrong mode.

Changes:
- Add get_session_metadata_path() to track session config in temp files
- Write browser_mode, headed, profile to metadata on server start
- Check metadata in ensure_server() and error if modes don't match
- Clean up metadata file on session close

Example error:
  Error: Session 'default' is running with --browser chromium,
  but --browser remote was requested.

  Options:
    1. Use existing browser: browser-use --browser chromium <command>
    2. Use different session: browser-use --browser remote --session other <command>
    3. Close existing session: browser-use close

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 18:10:46 -08:00
ShawnPana f40235242a refactor: remove pycloudflared, install cloudflared directly in install.sh
- Remove pycloudflared dependency from pyproject.toml
- Simplify tunnel_manager.py to just use shutil.which('cloudflared')
- Add install_cloudflared() to install.sh that downloads binary from
  official Cloudflare GitHub releases based on platform/arch
- Update SKILL.md with manual cloudflared install instructions
- Update setup.py messages for missing cloudflared

install.sh supported platforms:
- Linux (x86_64, arm64) - full support, downloads binary to ~/.local/bin
- macOS (Intel, Apple Silicon) - full support, uses brew or direct download
- Windows WSL - works (treated as Linux)
- Native Windows - not supported (bash script), use manual install
2026-02-09 17:03:56 -08:00
ShawnPana 9520a0b04e feat: frictionless installation system with setup/doctor commands
- Add TunnelManager for auto-install cloudflared via pycloudflared
- Add 'browser-use setup' command with profile-based configuration
- Add 'browser-use doctor' command for health checks
- Add install.sh bootstrap script (dev testing version)
- Add pycloudflared dependency
- Add comprehensive tests for new functionality
2026-02-09 16:09:38 -08:00
Saurav Panda bb5914f251 added milder nudge for action loop 2026-02-05 11:17:20 -08:00
Saurav Panda cec4aea3bc increased threshold for loop detection 2026-02-04 16:34:42 -08:00
Saurav Panda d24dea0aa4 Merge branch 'main' into improve-input-field-handling 2026-02-03 18:22:19 -08:00
Saurav Panda 5d7ff041d3 improved concatenation heuristic 2026-02-03 18:02:58 -08:00
Saurav Panda b96b9436fc fixed agent loop detection 2026-02-03 16:00:08 -08:00
Saurav Panda bd4ead5d2e Action Loop detection 2026-02-03 15:19:59 -08:00
Saurav Panda 749fa56d1a improve text field handling 2026-02-03 12:52:56 -08:00
Saurav Panda 4d5976c427 Merge branch 'main' into improve-agent-planning 2026-02-02 21:45:06 -08:00
Saurav Panda 023367052c in flash mode disable planning 2026-02-02 18:28:28 -08:00
Saurav Panda 4a522a6f1c dynamic planing exploration 2026-02-02 16:26:50 -08:00
Saurav Panda b88e440b75 Merge branch 'main' into markdown-chunking-for-extraction 2026-02-02 16:10:00 -08:00
Saurav Panda 48206d62ad fixed code style issues 2026-02-02 16:08:29 -08:00
Saurav Panda f88d79a3c3 fixed test for chunking 2026-02-02 15:44:05 -08:00
Saurav Panda defe37dd28 Improve multiact for agent 2026-02-02 12:50:03 -08:00
Saurav Panda 7c05e73bbf improve markdown splitting based on header 2026-02-02 12:37:28 -08:00
Saurav Panda 5ad365e31b added basic planing to agents 2026-02-02 12:28:29 -08:00
Saurav Panda 0b0adfb36c fixed parsing issue with non table data 2026-02-02 10:52:44 -08:00
Saurav Panda e66eac8a37 Improve Markdown Chunker 2026-02-02 00:05:09 -08:00
Saurav Panda beefe832af Merge branch 'main' into schema-enforced-extraction-v2 2026-02-01 20:33:32 -08:00
Saurav Panda db832bcb83 added extraction schema 2026-02-01 20:26:50 -08:00
Saurav Panda ba68695d65 Merge branch 'main' into schema-enforced-extraction 2026-01-31 22:47:48 -08:00
Saurav Panda a27cc17f35 fix: optional enum fields default to None instead of empty string
Empty string is outside most enum value sets, so model_dump would
serialize an out-of-set value violating the schema. Use None with
a type union (same treatment as nested objects) since no in-set
default can be safely chosen.
2026-01-31 22:33:59 -08:00
Gregor Žunič 0cb96ea5d0 fix: restore install, init, --mcp commands in skill_cli
PR #3911 changed the browser-use entry point to skill_cli/main.py but
didn't port the early command interception for install, init, --template,
and --mcp. This broke:

- `browser-use install` (installs Chromium via playwright)
- `browser-use init` (generates template files)
- `browser-use --template` (direct template generation)
- `browser-use --mcp` (MCP server mode)

This fix adds early command interception to skill_cli/main.py, matching
the behavior from browser_use/cli.py. Commands are handled before argparse
to avoid loading heavy dependencies for simple setup tasks.

Also adds tests to prevent regression.
2026-01-31 21:44:19 -08:00
Saurav Panda 357af489d4 Merge branch 'main' into fix-file-sanitization-issue 2026-01-31 21:27:43 -08:00
Saurav Panda d5f38a5eeb add grep tool to agent 2026-01-31 19:48:22 -08:00