Skip to content

feat: add JavaScript debugging tools to browser automation#25

Merged
cfc4n merged 2 commits intomasterfrom
browser_debugger
Apr 12, 2025
Merged

feat: add JavaScript debugging tools to browser automation#25
cfc4n merged 2 commits intomasterfrom
browser_debugger

Conversation

@cfc4n
Copy link
Copy Markdown
Member

@cfc4n cfc4n commented Apr 12, 2025

This pull request includes significant additions and modifications to the services/browser.go and services/browser_debugger.go files to enhance browser automation and debugging capabilities. The most important changes include adding new tools for JavaScript debugging, modifying the headless mode configuration, updating the prompt for the browser assistant, and implementing the handling of various debugging tasks.

Enhancements to browser automation and debugging:

  • services/browser.go: Modified the Init function to use the Headless configuration from bs.config instead of a hardcoded value.
  • services/browser.go: Added tools for enabling/disabling JavaScript debugging, setting/removing breakpoints, pausing/resuming script execution, and retrieving the current call stack.
  • services/browser.go: Updated the prompt in the handlePrompt function to include detailed descriptions of the browser assistant's capabilities, including new debugging tools.
  • services/browser.go: Enabled the cancellation of the browser context in the Close function to properly stop the browser.

New debugging capabilities:

  • services/browser_debugger.go: Added a new file to handle various debugging tasks such as enabling/disabling debugging, setting/removing breakpoints, pausing/resuming script execution, and retrieving the current call stack.

 * update Browser MCP prompts.

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
@cfc4n cfc4n requested a review from Copilot April 12, 2025 15:39
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 12, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

services/browser_debugger.go:98

  • Consider validating that 'result["breakpointId"]' is a string before performing the type assertion to avoid potential panics if the response structure changes.
breakpointID = result["breakpointId"].(string)

services/browser_config.go:35

  • [nitpick] If the commented-out logger field is no longer needed, consider removing it entirely to keep the configuration file clean.
//logger          *zerolog.Logger

@dosubot dosubot bot added the enhancement New feature or request label Apr 12, 2025
…press cancel error in browser

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
@cfc4n cfc4n requested a review from Copilot April 12, 2025 15:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

services/browser_debugger.go:100

  • [nitpick] Consider providing a more descriptive error message when the breakpoint ID is not retrieved, possibly including details from the debugger's response to facilitate troubleshooting.
breakpointID = ""

@cfc4n cfc4n merged commit 33f6bb0 into master Apr 12, 2025
6 checks passed
@cfc4n cfc4n deleted the browser_debugger branch April 12, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants