- restricted read_long_content file access to only paths in available_file_paths or browser_session.download_files to mitigate injection
- made PDF page selection truncate pages that exceed char budget instead of dropping them entirely
- fixed truncation hint in file_system.py to reference read_long_context instead of search_page
Made read_file smarter for PDFs - instead of just reading the first 20 pgs, it reads up to 60k chars and uses IDF scoring to prioritize pgs w unique content
- Add 0-byte file check in upload_file handler to catch empty files early
with a clear error message instead of silently passing them to websites
- Add 0-byte file check in CDP upload watchdog before setFileInputFiles
to prevent uploading empty files that cause cascading failures
- Replace hardcoded text extension list in read_file_structured() with
dynamic derivation from _file_types, so new text-based file types
are automatically supported for external file reading
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix f-string quote style (double→single) in _build_filename_error_message
- Remove unused XmlFile import from test file
- Add missing blank lines before DEFAULT_FILE_SYSTEM_PATH
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Allow dots, spaces, and parentheses in filenames (e.g. report.v2.md, my file.csv)
- Auto-sanitize invalid filenames instead of rejecting them (spaces→hyphens, strip bad chars)
- Add specific error messages for binary extensions (.png, .jpg, etc.) to stop infinite retry loops
- Add specific error messages for unsupported extensions explaining which ones are valid
- Add .html and .xml as supported file types
- Improve write_file tool description with explicit filename rules and append behavior
- Add HtmlFile and XmlFile classes
- Add comprehensive tests for sanitization, new file types, and error messages
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- agent/views.py: Move RateLimitError import inside format_error() function
to avoid loading openai SDK (~800ms) at module level
- llm/messages.py: Replace openai.BaseModel with pydantic.BaseModel directly
to remove unnecessary openai dependency
- filesystem/file_system.py: Move reportlab imports inside sync_to_disk_sync()
to avoid ~40ms startup cost when PDF generation is not used
- utils.py: Convert OpenAIBadRequestError and GroqBadRequestError to lazy
loaders to avoid loading SDKs at module level
This improves import time for users who don't use OpenAI provider,
especially when using Anthropic, Google, or other providers.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds support for .jsonl file extension in the FileSystem class to enable
code-use mode to work with JSON Lines files (where each line is a valid
JSON object).
Changes:
- Added JsonlFile class implementing BaseFile interface
- Registered 'jsonl' extension in _file_types dictionary
- Updated external file reading to include .jsonl files
- Added state restoration support for JsonlFile
- Added comprehensive test coverage for JSONL file operations
Fixes issue where code agent rejected filenames like 'WebVoyager_data.jsonl'
with error "Invalid filename format. Must be alphanumeric with supported
extension."
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Addressed @pirate's feedback to fix lint errors by running pre-commit.
This reformatted 242 files across the codebase for consistency.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
The markdown-pdf dependency had a transitive dependency on pymupdf (AGPL-3.0),
which conflicts with browser-use's MIT license and could require commercial
users to open-source their entire application.
This change:
- Replaces markdown-pdf==1.5 with reportlab>=4.0.0 (BSD licensed)
- Updates PdfFile.sync_to_disk_sync() to use reportlab for PDF generation
- Maintains the same API surface with no breaking changes
- Supports basic markdown formatting (headers, paragraphs)
- All existing tests continue to pass
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added new file types: JsonFile and CsvFile to the file system.
- Updated read_file method to handle external files with .json and .csv extensions.
- Modified write_file action to allow .json and .csv file extensions in addition to .md and .txt.
- Introduced pypdf dependency for PDF file handling.
This update improves the flexibility of file operations within the application.
- Added functionality to remove existing data directory before creating a new one, ensuring a clean state for operations.
- Introduced `shutil` for directory removal.
- Enhanced logging in the Agent class to inform users about available attachments after task completion.
- Revised system prompt guidelines to clarify the use of text and files_to_display in the done action.