Commit Graph

8766 Commits

Author SHA1 Message Date
ShawnPana 2d992c3726 feat(cli): add cloud profile management and cookie sync
- Add cloud profile commands: list, create, get, update, delete
- Add profile sync command to sync local Chrome cookies to cloud
- Add profile cookies command to list cookies by domain
- Add cookies export/import commands for bulk transfer
- Optimize cookie import using Network.setCookies (bulk API)
- Real browser now runs headless by default (use --headed for visible)
- Support --domain flag for syncing specific domain cookies only
- Update SKILL.md with cloud profile workflow documentation
2026-01-31 20:02:50 -08:00
Saurav Panda d5f38a5eeb add grep tool to agent 2026-01-31 19:48:22 -08:00
ShawnPana 2b2dc2b4e5 feat(cli): add profile list-local command and fix real browser profile loading
- Add `profile list-local` command to discover local Chrome profiles
- Fix real browser mode to properly pass `profile_directory` to BrowserSession
- Document profile management workflow in SKILL.md
2026-01-31 18:25:17 -08:00
Saurav Panda 69635e7745 fix: non-required fields no longer unconditionally nullable
Non-required fields were always unioned with None, allowing null values
even when the JSON Schema did not permit them. Now only explicitly
nullable fields accept null. Non-required primitives get type-appropriate
zero defaults (empty string, 0, 0.0, False), arrays get [], and nested
objects fall back to None only where constructing a default is infeasible.
2026-01-31 17:55:51 -08:00
laithrw aa949d072b Merge branch 'main' into feat/smart-pdf-reading 2026-01-31 20:54:22 -05:00
Saurav Panda 7c4220845e fix: hide output_schema from JSON schema to fix Gemini INVALID_ARGUMENT
Gemini rejects OBJECT types with no properties in the response schema.
The output_schema field (dict | None) produced exactly that. Since this
field is only used programmatically, wrap it with SkipJsonSchema to
exclude it from the generated JSON schema while keeping it functional.
2026-01-31 17:45:44 -08:00
Saurav Panda 69004dda09 schema enforcement in extract tool 2026-01-31 17:41:42 -08:00
ShawnPana 9abfc327cc feat(cli): add get command for info retrieval (title, html, text, value, attributes, bbox)
Adds information retrieval commands to the browser-use CLI:
- get title: page title
- get html: full page or element HTML via selector
- get text: text content of element by index
- get value: input/textarea value by index
- get attributes: all attributes of element by index
- get bbox: bounding box (x, y, width, height) of element
2026-01-31 17:34:33 -08:00
ShawnPana 3ca625b75e feat(cli): add hover, dblclick, rightclick interaction commands
Adds mouse interaction commands to the browser-use CLI:
- hover: move mouse over element (triggers CSS :hover effects)
- dblclick: double-click element
- rightclick: right-click element (context menu)
2026-01-31 17:28:20 -08:00
ShawnPana 33e03b7b0f feat(cli): add wait command for selector and text conditions
Adds wait conditions to the browser-use CLI with two subcommands:
- wait selector: wait for CSS selector with state options (visible, hidden, attached, detached)
- wait text: wait for text to appear on the page
Both support custom timeout in milliseconds.
2026-01-31 17:17:35 -08:00
ShawnPana 45d244e01c feat(cli): add cookies command for get/set/clear operations
Adds cookie management to the browser-use CLI with three subcommands:
- cookies get: retrieve all cookies or filter by URL
- cookies set: create cookies with domain, path, secure, httpOnly options
- cookies clear: remove all cookies or filter by URL
2026-01-31 17:09:35 -08:00
Saurav Panda 3f3fb0efcc bumping to 0.11.6 (#3995)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Bump the package version to 0.11.6 to prepare a patch release. This
updates pyproject.toml so we can publish the latest changes.

<sup>Written for commit 6ad36bc3a3.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
0.11.6
2026-01-31 17:07:30 -08:00
Saurav Panda 6ad36bc3a3 bumping to 0.11.6 2026-01-31 17:01:30 -08:00
Saurav Panda 65fb1db7db Merge branch 'main' into fix-file-sanitization-issue 2026-01-31 16:17:47 -08:00
Laith Weinberger bce2951178 fixed bug where small remaining char budgets caused neg slice indices 2026-01-31 19:10:45 -05:00
laithrw 28d813b16f Merge branch 'main' into feat/smart-pdf-reading 2026-01-31 19:06:54 -05:00
Laith Weinberger 7a1b76a5f0 bug fixes + lint 2026-01-31 19:03:23 -05:00
laithrw b98118a27b Feat: wait for file download action (#3984)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Click actions now automatically wait for triggered downloads and return
file info, fixing flows that finished before files were saved. Adds a
helper to detach watchdog event handlers to avoid leaks.

- **New Features**
- ClickElement/ClickCoordinate wait for DownloadStarted and completion
(30s default), returning path, name, size, and type; reports active
progress or timeout status in metadata.
- DownloadsWatchdog provides direct start/progress/complete callbacks
and emits new DownloadStartedEvent and DownloadProgressEvent;
FileDownloadedEvent now includes a guid for correlation.

- **Bug Fixes**
- Removes the race by correlating CDP GUIDs and awaiting download
completion; handles stalls and timeouts gracefully.
- Adds BaseWatchdog.detach_handler_from_session to help prevent
duplicate triggers and memory leaks.

<sup>Written for commit a8ce4a2a43.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-31 18:59:40 -05:00
Laith Weinberger 556ecd93ab search_content and read_long_content actions for long webpages and files
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
2026-01-31 18:50:44 -05:00
laithrw a8ce4a2a43 Merge branch 'main' into wait-file-download 2026-01-31 18:22:30 -05:00
Laith Weinberger bdecd06e3e lint 2026-01-31 18:10:51 -05:00
Laith Weinberger 84b460d6ce replace wait for download action w automatic wait listener 2026-01-31 18:02:29 -05:00
laithrw 2d0501aded generalize leaf start fix (#3963)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Generalized the “leaf-start” typing fix to all contenteditable editors,
preventing the first character from being dropped and improving
reliability across rich text inputs.

- **Bug Fixes**
- Detect contenteditable elements (or role="textbox"
non-input/textarea).
- After typing the first char when clear=True, verify via
activeElement.textContent and retype if missing.
  - Removed Draft.js-only detection and the sacrificial space hack.

<sup>Written for commit 2c8b761d49.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-31 16:41:25 -05:00
laithrw 2c8b761d49 Merge branch 'main' into leafstart-bug 2026-01-31 16:14:28 -05:00
laithrw 57f9534b8f rm special anthropic prompts unless flash (#3991)
only use special anthropic prompt for flash, as thinking & main sys are
now min length for caching

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Use the Anthropic-specific system prompt only for Flash mode. Non-Flash
Anthropic 4.5 models now use the standard prompts, which already meet
the 4096+ token requirement for caching.

- **Refactors**
- Simplified selection: Anthropic 4.5 uses
`system_prompt_anthropic_flash.md` only when `flash_mode` is on;
otherwise it falls back to standard (thinking/no-thinking) prompts.
- Removed unused files: `system_prompt_anthropic.md`,
`system_prompt_anthropic_no_thinking.md`.
  - Reduces prompt duplication while keeping caching behavior intact.

<sup>Written for commit 2c5682618b.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-31 16:06:21 -05:00
Laith Weinberger 2c5682618b only use special anthropic prompt for flash, as thinking & main sys are now min length 2026-01-31 16:03:45 -05:00
laithrw f7257d0943 added optional file_name param to ss action (#3989)
so it can return path if it needs; resolves 833 failures where agents
tried write_file with .png and got rejected

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Added an optional file_name to the screenshot action so you can save a
PNG and get the path back. Keeps the old “include in next observation”
behavior and avoids failures where agents tried write_file with .png.

- **New Features**
- Added ScreenshotAction with file_name; sanitizes name and appends .png
if missing.
- When provided, saves viewport screenshot to the workspace directory
and returns the path in attachments; when omitted, sets
include_screenshot for the next observation.

<sup>Written for commit a81a493794.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-31 15:56:46 -05:00
Laith Weinberger a81a493794 added optional file_name param to ss action
so it can return path if it needs; resolves 833 failures where agents tried write_file with .png and got rejected
2026-01-31 15:52:15 -05:00
Saurav Panda a7c2144cd1 added normalize the filename 2026-01-31 11:50:54 -08:00
Saurav Panda 39291298f8 lint fix 2026-01-31 11:21:17 -08:00
Saurav Panda a4380060b9 improved filename sanitization 2026-01-31 11:14:11 -08:00
Laith Weinberger 3dd56ff85f lint 2026-01-31 10:38:02 -05:00
laithrw 3651795f00 Merge branch 'main' into wait-file-download 2026-01-31 10:33:21 -05:00
Laith Weinberger 4fe27c5cb5 improvements 2026-01-31 10:24:44 -05:00
Saurav Panda 61e5ba3470 Backport prompt improvements from anthropic variants to standard prompts (#3982)
## Summary

- Add `<critical_reminders>` section (12 items) to `system_prompt.md`
and `system_prompt_no_thinking.md` — covers action verification, popup
handling, filter application, loop avoidance, and max_steps behavior
- Add `<error_recovery>` section (8 items) — structured escalation from
screenshot verification through alternative approaches
- Add 3 new `<browser_rules>`: popup/modal handling, 403/bot detection
fallback, and unproductive loop detection
- Add action verification guidance to `<action_rules>` — verify state
between consequential actions
- Add 5 failure-mode memory examples (filter, popup, failed click,
captcha, 403) and 2 next_goal examples (close popup, apply filter)
- Strengthen filter rule from "try to apply filters" to "ALWAYS look for
filter/sort options FIRST"
- Fix captcha rule to include step budget ("3-4 steps") and fix
"trajactory" typo

All changes already existed in the anthropic prompt variants — this PR
brings the standard prompts (used by OpenAI, Gemini, and other
non-Anthropic models) to parity.

## Test plan

- [ ] Run `uv run pytest -vxs tests/ci` to confirm no regressions
- [ ] Verify `system_prompt.md` and `system_prompt_no_thinking.md` now
contain all sections present in their anthropic counterparts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Backported robustness rules from the Anthropic prompt variants to the
standard prompts to improve web navigation reliability and reduce
unproductive loops.

- **New Features**
- Added <critical_reminders> (12 items) and <error_recovery> (8 items)
to both standard prompts.
- Browser rules: popup/modal handling, 403/bot detection fallback, and
loop detection.
- Action rules: verify state between consequential actions before
proceeding.
- Guidance: ALWAYS apply filters first when criteria exist; captcha
effort capped at 3–4 steps; fixed “trajectory” typo.
- Examples: added failure-mode memory entries and next_goal examples
(close popup, apply filter).

<sup>Written for commit 996c2cb38d.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-30 20:58:13 -08:00
Saurav Panda 996c2cb38d Merge branch 'main' into backport-prompt-improvements 2026-01-30 20:55:55 -08:00
Laith Weinberger 40e1a80a98 add tool to wait for file download, fixing issue where it'd call complete before download 2026-01-30 22:51:33 -05:00
laithrw 8a703f7217 fix(filesystem): improve write_file filename handling and error messages (#3975)
## Summary
- **Auto-sanitize filenames** instead of rejecting them — special chars
get stripped. Eliminates 148+ failures from filename format errors where
agents enter 15-30 retry loops.
- **Specific error messages for binary extensions** (.png, .jpg, .mp4,
etc.) telling the agent screenshots are automatic and it should not save
them as files. Stops 833+ infinite retry loops.
- **Allow dots, spaces, and parentheses in filenames** (e.g.
`report.v2.md`, `data (1).csv`, `my file.txt`)
- **Add .html and .xml** as supported file types — agents commonly
generate these
- **Improved tool description** with explicit filename rules, supported
extensions, and clarification that default mode overwrites (use
`append=true` to add content)

## Context
Analysis of judgements over 2 weeks revealed file-related failures as a
major pain point. The `write_file` tool was responsible due to strict
filename validation and failures where agents tried to save screenshots
as .png files. Agents entered severe retry loops (15-30+ identical
failed attempts) because:
1. The error message was generic and didn't explain what was wrong
2. The tool description didn't list filename rules
3. Valid-looking filenames with dots/spaces were rejected
4. Binary file attempts got the same generic error, causing endless
retries

## Test plan
- [x] All 55 existing filesystem tests pass
- [x] New tests for filename sanitization (spaces→hyphens, special char
removal, collapse hyphens, fallback name)
- [x] New tests for binary extension error messages (.png, .jpg)
- [x] New tests for unsupported extension error messages (.css, .doc)
- [x] New tests for HTML file writing
- [x] New tests for dots in filename (report.v2.md,
data.backup.2024.csv)
- [x] Pre-commit linting (ruff format, ruff check, pyright) all pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)




<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Behavior of `write_file`/`append_file`/`replace_file_str` changes by
auto-sanitizing filenames and allowing additional characters/extensions,
which could alter file names created and downstream expectations. Risk
is mitigated by basename-only handling and expanded test coverage, but
this touches a core agent tool path.
> 
> **Overview**
> **Improves file-writing ergonomics and failure recovery for agents.**
Filename validation is relaxed to allow dots/spaces/parentheses (while
still enforcing a supported extension), and invalid names are now
auto-sanitized (e.g., spaces→hyphens, unsupported chars removed) before
failing.
> 
> **Adds clearer feedback and broader text support.**
`write_file`/`append_file`/`replace_file_str` now return specific,
actionable errors for missing/unsupported extensions and explicitly
reject common binary/image formats. The filesystem adds `.html` and
`.xml` file types and updates state restore logic to include them, and
the `write_file` tool description is updated to document overwrite
behavior, filename rules, and supported extensions.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5e25d92bef. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-01-30 22:00:24 -05:00
laithrw 372bf822c2 Merge branch 'main' into fix-write-file-issues 2026-01-30 21:51:27 -05:00
laithrw 445047b832 Update tests/ci/infrastructure/test_filesystem.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-01-30 21:51:17 -05:00
Saurav Panda e25fa9a4d8 Merge branch 'main' into backport-prompt-improvements 2026-01-30 17:25:36 -08:00
Saurav Panda 4b0413ee3e Backport prompt improvements from anthropic variants to standard prompts
Standard system prompts (OpenAI/Gemini/etc) were missing several
robustness improvements that the anthropic variants already had.
2026-01-30 17:21:05 -08:00
Saurav Panda c09d2087bf add step budget awareness to prompt (#3981)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds step budget awareness to the agent so it warns at 75% of the step
limit and encourages saving partial results and calling done early.
Aligns with IMP-7a.

- **New Features**
- Injects a budget warning at >=75% of max steps (except the last step).
Message shows used/total, remaining steps, and clear guidance to save
partial results and call done.
- Hooks the warning into context preparation, so the model sees it
before choosing the next action.
- Updates all system prompts to include 75% budget guidance and
multi-item task heuristics (estimate per-item cost, prioritize, save
incrementally).
- Adds CI tests covering threshold behavior, last-step exclusion, small
budgets, percentage formatting, and actionable guidance.

<sup>Written for commit 48cc78928a.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-30 17:01:38 -08:00
Saurav Panda 48cc78928a Merge branch 'main' into saurav-panda/step-budget-awareness 2026-01-30 16:59:31 -08:00
Saurav Panda 9b0d2f685f fixed prompt voilation of under 10 step instruction 2026-01-30 16:57:00 -08:00
Saurav Panda 70472eddd8 fixed contradictory done condition 2026-01-30 16:40:05 -08:00
Saurav Panda 5ec52b09b1 Increase MAX_MEMORY_LENGTH from 1000 to 10000 chars (#3977)
## Summary
- Increases `MAX_MEMORY_LENGTH` from 1000 to 10000 characters in both
`extract` and `evaluate` actions
- Fixes bug where agent loses access to large JS evaluation results and
hallucinates placeholder text like `JSON_STRING_FROM_STEP_6`
- When results exceed the threshold, `long_term_memory` gets a useless
summary and full data only appears in `<read_state>` for one step —
increasing 10x keeps most results in persistent memory

## Root Cause
In `tools/service.py`, when `evaluate` returns >1000 chars:
1. `long_term_memory` = `"JavaScript executed successfully, result
length: 4387 characters."`
2. Full data → `extracted_content` with
`include_extracted_content_only_once = True`
3. Data shown once in `<read_state>`, then gone from context
4. Agent can't access data in later steps → hallucinates placeholder
variable names

## Test plan
- [ ] Run existing CI tests
- [ ] Test `evaluate` with results between 1000-10000 chars — should now
persist in memory
- [ ] Test `extract` with results between 1000-10000 chars — should now
persist in memory
- [ ] Verify results >10000 chars still use the one-time read_state
pattern

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Medium risk because it changes agent memory persistence behavior (more
content kept in long-term context) and adds stricter file-upload
validation that can introduce new user-visible failures for empty files.
> 
> **Overview**
> Improves agent reliability by keeping more `extract` and `evaluate`
output in long-term memory: increases `MAX_MEMORY_LENGTH` from `1000` to
`10000` before falling back to the one-time `<read_state>`/saved-file
pattern.
> 
> Hardens file handling by rejecting empty (0-byte) uploads in both the
`upload_file` tool (local mode) and the CDP `UploadFileEvent` handler,
and makes external file reading treat any `FileSystem._file_types`
extension as text except `docx`/`pdf`/images.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3ba50e68b0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Increase MAX_MEMORY_LENGTH to 10,000 in extract/evaluate so larger
results persist across steps and reduce placeholder hallucinations. Also
block empty-file uploads and make text file detection dynamic for
structured reads.

- **Bug Fixes**
- Keep evaluate/extract results up to 10k chars in long_term_memory;
>10k still uses one-time read_state.
- Reject 0-byte uploads with clear errors (validated in service and CDP
watchdog).
- Derive text extensions from _file_types in read_file_structured,
removing the hardcoded list.

<sup>Written for commit 5524c986e5.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-30 16:37:55 -08:00
Saurav Panda 5524c986e5 Merge branch 'main' into fix/increase-max-memory-length 2026-01-30 16:35:13 -08:00
Laith Weinberger 7fc281951b use BU model for examples 2026-01-30 19:30:13 -05:00
laithrw 878c735973 Merge branch 'main' into improving-real-browser 2026-01-30 19:27:55 -05:00