Commit Graph

3622 Commits

Author SHA1 Message Date
Magnus Müller
8957f40930 Merge branch 'main' into code-use-to-full-script 2025-10-24 22:45:51 -07:00
Magnus Müller
4c4bc40476 Merge branch 'main' into add-element-lookup-helpers 2025-10-24 22:35:32 -07:00
Magnus Müller
e1e8003c24 Fix: Ensure direct action calls go through act() for consistent error handling
The action_wrapper now delegates to act() instead of calling registry.execute_action() directly.
This ensures:
- Consistent error handling (returns ActionResult with error, not raw exceptions)
- Consistent result normalization (always returns ActionResult)
- Full observability (Laminar spans, logging)
- Proper handling of BrowserError and TimeoutError

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 19:34:18 -07:00
Magnus Müller
cc250ff87e Add element lookup helper methods to BrowserSession
Added two convenience methods for finding element indices:
- get_index_by_id: Find element by its id attribute
- get_index_by_class: Find element by class name

These methods simplify common DOM element lookup patterns when
working with selector maps.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 19:26:55 -07:00
Magnus Müller
56a301ed7d Linter 2025-10-24 19:26:14 -07:00
Magnus Müller
c9137fe029 Add direct action call API to Tools via __getattr__
Enable simpler, more ergonomic action calls in tests and direct usage:
- Old API: tools.act(NavigateActionModel(navigate=GoToUrlAction(...)), browser_session)
- New API: tools.navigate(url=..., browser_session=browser_session)

Implementation:
- Added __getattr__ method to Tools class that dynamically creates action wrappers
- Delegates to existing registry.execute_action() to avoid code duplication
- Works with all Tools subclasses (Tools, CodeAgentTools, custom subclasses)
- Works with custom registered actions
- Maintains full backward compatibility with existing act() API

Benefits:
- Significantly reduces boilerplate in tests
- More intuitive and Pythonic API
- All existing code continues to work unchanged
- No code duplication (delegates to registry)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 19:25:00 -07:00
Magnus Müller
f41da2d3b4 Fix dropdown selection for Vue.js and reactive frameworks (#3415)
Fixes dropdown selections not persisting in Vue.js, React, and other
reactive frameworks. The issue was that only 'change' events were
dispatched, but Vue's v-model requires 'input' events to register changes.

**Root Cause:**
Dropdown selection handler only dispatched 'change' events, missing the
'input' event required by reactive frameworks.

**Solution:**
Enhanced event dispatching sequence in default_action_watchdog.py:
1. Focus element first
2. Set value and selected state
3. Dispatch 'input' event (critical for Vue v-model and React)
4. Dispatch 'change' event (standard for select elements)
5. Blur element for validation

**Tests:**
Added comprehensive integration tests in tests/ci/interaction/:
- test_dropdown_vue_submit.py: Vue.js 3 with v-model
- test_dropdown_react_submit.py: React 18 with controlled components

Both tests verify dropdown selections persist through the reactive
framework's state management and form submission works correctly.

Closes #3415

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 18:54:57 -07:00
Magnus Müller
fafc274dde Fix log msg 2025-10-24 14:14:22 -07:00
Magnus Müller
258456736c Error at the end 2025-10-24 13:36:51 -07:00
Magnus Müller
c13075d428 Msg if failed 2025-10-24 13:29:34 -07:00
kalil0321
c75b208944 Merge branch 'main' into code-use-to-full-script 2025-10-24 16:06:43 +02:00
kalil0321
dcb3f8e2c6 Format 2025-10-24 16:03:26 +02:00
kalil0321
b569473631 Code use exports now include JavaScript code blocks 2025-10-24 16:02:33 +02:00
Magnus Müller
c4bee3b347 Revert "error-msg-if-chrome-is-running (#3398)"
This reverts commit 739f8410aa, reversing
changes made to 910d5d6767.
2025-10-24 02:37:15 -07:00
Magnus Müller
f47cb6d511 Fix import 2025-10-24 00:06:41 -07:00
Magnus Müller
24ff856193 linter optimized 2025-10-23 23:29:19 -07:00
Alezander9
112d85c73b address cubic comments of special characters and newlines 2025-10-23 19:20:14 -07:00
Magnus Müller
def2c3e172 Fix 2025-10-23 18:49:08 -07:00
Magnus Müller
6ee07c06ec SVG fix 2025-10-23 18:29:05 -07:00
Magnus Müller
0ff12c78c1 Merge branch 'main' into cursor/clean-url-endings-d286 2025-10-23 18:09:24 -07:00
Magnus Müller
3240b13501 reset state stopped after new task 2025-10-23 16:14:00 -07:00
Magnus Müller
0b98afa137 Merge branch 'main' into error-msg-if-chrome-is-running 2025-10-23 14:25:44 -07:00
Magnus Müller
cb920922ea Implement Chrome instance check in LocalBrowserWatchdog
This update adds functionality to the LocalBrowserWatchdog class to check for running Chrome/Chromium instances before launching a new browser. If any instances are detected, a RuntimeError is raised, providing users with instructions on how to close existing Chrome windows. This ensures exclusive control over Chrome for CDP debugging, preventing potential conflicts during browser automation.
2025-10-23 14:17:49 -07:00
mertunsall
0ac4ebff9c Fix laminar bug 2025-10-23 17:44:45 +02:00
Magnus Müller
4ac49de9cf fix(code-use): prevent done() execution inside conditional blocks
Previously, done() calls inside if/else/elif blocks would only show a warning
but still execute, potentially causing tasks to never complete if the condition
wasn't met. This changes the behavior to raise a RuntimeError, forcing the LLM
to restructure code properly.

The proper pattern is:
```python
# Validate and set result variables
if condition:
    result = "success"
else:
    result = "failure"

# Then call done() unconditionally
await done(result, success=True)
```

Changes:
- Upgraded warning to RuntimeError in namespace.py
- Added comprehensive test suite with 5 test cases
- Tests cover if/else/elif blocks and verify standalone done() still works

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 10:03:10 -07:00
Magnus Müller
035617e228 llm_response 2025-10-21 23:40:51 -07:00
Magnus Müller
1f58f60c2e Fix evaluate 2025-10-21 21:50:41 -07:00
Magnus Müller
4d5261418e 2 upload function 2025-10-21 21:44:27 -07:00
Magnus Müller
aa500c9873 Linter 2025-10-21 21:26:10 -07:00
Magnus Müller
32999fc570 More robust check for is wrapped => 2025-10-21 21:25:51 -07:00
Magnus Müller
699fb347e1 Wait 10s for requests 2025-10-21 21:25:04 -07:00
Magnus Müller
b678f27a3e Migration from highlight index to backendnode id 2025-10-21 21:02:28 -07:00
Magnus Müller
2d3031550e revert serilizer for normal mode 2025-10-21 20:19:24 -07:00
Magnus Müller
c222780712 'source': cell.source.split('\n'), 2025-10-21 20:08:55 -07:00
Magnus Müller
5de8a6e3e1 tag name validation rejects valid custom-element names (e.g. my-button) 2025-10-21 20:08:00 -07:00
Magnus Müller
1535bb1aa5 Typo 2025-10-21 20:05:42 -07:00
Magnus Müller
1f35dc3c84 Linter 2025-10-21 20:03:01 -07:00
Magnus Müller
0fd93c6c97 Linter 2025-10-21 20:02:50 -07:00
Magnus Müller
345aea6d10 Allow other llms 2025-10-21 19:47:16 -07:00
Magnus Müller
c0a11ae41a Increase max_failures parameter from 3 to 8 in CodeAgent to allow for more consecutive errors before termination. 2025-10-21 19:03:40 -07:00
Magnus Müller
9caa248316 Merge code7 branch changes 2025-10-21 18:55:54 -07:00
Reagan Hsu
8e2845a6db add new models 2025-10-19 23:29:20 -07:00
Magnus Müller
c00ad67830 Use lower check 2025-10-19 22:04:32 -07:00
Magnus Müller
f1ccdfbf6d Remove general endings 2025-10-19 22:04:32 -07:00
Magnus Müller
66dad509d4 refactor: Improve URL filtering logic by considering surrounding context
Enhanced the URL detection process by storing the original position of URLs and checking the surrounding context for excluded words before modifying the URL. This change ensures more accurate filtering and prevents navigation to undesired links while maintaining the addition of 'https://' for URLs missing a scheme.
2025-10-19 22:04:32 -07:00
Magnus Müller
e9b4940158 Remove position 2025-10-19 22:04:32 -07:00
Magnus Müller
b7e5c4323f refactor: Rename URL extraction method and enhance filtering
Renamed the method for extracting URLs from tasks to `_extract_start_url` for clarity. Added logic to exclude URLs based on specific words in the surrounding context, improving the accuracy of URL detection and preventing navigation to undesired links.
2025-10-19 22:04:32 -07:00
Magnus Müller
3fd7b1ab47 refactor: Format excluded file extensions for better readability
Updated the excluded_extensions list in the Agent class to improve code readability by formatting each file extension on a new line. This change enhances maintainability without altering functionality.
2025-10-19 22:04:32 -07:00
Cursor Agent
75af987149 feat: Exclude file extensions from URL detection
Co-authored-by: mamagnus00 <mamagnus00@gmail.com>
2025-10-19 22:04:32 -07:00
Saurav Panda
ee355bf43c Merge branch 'main' into focus-causes-llm-to-not-input-text-properly 2025-10-16 16:59:08 -07:00