browser: Add console log capture tools
This was entirely Sketch-coded.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: sc6bbdde6b1a71d8fk
diff --git a/loop/testdata/agent_loop.httprr b/loop/testdata/agent_loop.httprr
index 3d1ad5b..c0bf004 100644
--- a/loop/testdata/agent_loop.httprr
+++ b/loop/testdata/agent_loop.httprr
@@ -1,9 +1,9 @@
httprr trace v1
-16446 2070
+16930 2597
POST https://api.anthropic.com/v1/messages HTTP/1.1
Host: api.anthropic.com
User-Agent: Go-http-client/1.1
-Content-Length: 16248
+Content-Length: 16732
Anthropic-Version: 2023-06-01
Content-Type: application/json
@@ -419,6 +419,27 @@
}
},
{
+ "name": "browser_recent_console_logs",
+ "description": "Get recent browser console logs",
+ "input_schema": {
+ "type": "object",
+ "properties": {
+ "limit": {
+ "type": "integer",
+ "description": "Maximum number of log entries to return (default: 100)"
+ }
+ }
+ }
+ },
+ {
+ "name": "browser_clear_console_logs",
+ "description": "Clear all captured browser console logs",
+ "input_schema": {
+ "type": "object",
+ "properties": {}
+ }
+ },
+ {
"name": "browser_take_screenshot",
"description": "Take a screenshot of the page or a specific element",
"input_schema": {
@@ -525,24 +546,24 @@
Anthropic-Organization-Id: 3c473a21-7208-450a-a9f8-80aebda45c1b
Anthropic-Ratelimit-Input-Tokens-Limit: 200000
Anthropic-Ratelimit-Input-Tokens-Remaining: 199000
-Anthropic-Ratelimit-Input-Tokens-Reset: 2025-05-13T02:19:49Z
+Anthropic-Ratelimit-Input-Tokens-Reset: 2025-05-13T23:34:09Z
Anthropic-Ratelimit-Output-Tokens-Limit: 80000
Anthropic-Ratelimit-Output-Tokens-Remaining: 80000
-Anthropic-Ratelimit-Output-Tokens-Reset: 2025-05-13T02:19:53Z
+Anthropic-Ratelimit-Output-Tokens-Reset: 2025-05-13T23:34:14Z
Anthropic-Ratelimit-Requests-Limit: 4000
Anthropic-Ratelimit-Requests-Remaining: 3999
-Anthropic-Ratelimit-Requests-Reset: 2025-05-13T02:19:48Z
+Anthropic-Ratelimit-Requests-Reset: 2025-05-13T23:34:07Z
Anthropic-Ratelimit-Tokens-Limit: 280000
Anthropic-Ratelimit-Tokens-Remaining: 279000
-Anthropic-Ratelimit-Tokens-Reset: 2025-05-13T02:19:49Z
+Anthropic-Ratelimit-Tokens-Reset: 2025-05-13T23:34:09Z
Cf-Cache-Status: DYNAMIC
-Cf-Ray: 93eeac4d2e40250d-SJC
+Cf-Ray: 93f5f6fa7ab517d2-SJC
Content-Type: application/json
-Date: Tue, 13 May 2025 02:19:53 GMT
-Request-Id: req_011CP4jFATfD5sh1tYAhwA8n
+Date: Tue, 13 May 2025 23:34:14 GMT
+Request-Id: req_011CP6QRHtUEsXiGbCcrW7o4
Server: cloudflare
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Via: 1.1 google
X-Robots-Tag: none
-{"id":"msg_017ZjPLV2KNbvMP9GbZxxEB4","type":"message","role":"assistant","model":"claude-3-7-sonnet-20250219","content":[{"type":"text","text":"I have access to the following tools:\n\n1. bash - Executes shell commands\n2. keyword_search - Locates files with search terms\n3. think - For reasoning and note-taking (no external effects)\n4. title - Sets conversation title\n5. precommit - Creates git branches for tracking work\n6. done - Used when the user's goal is achieved\n7. codereview - Runs automated code review\n8. multiplechoice - Presents quick answer options to the user\n9. browser_* tools (navigate, click, type, wait_for, get_text, eval, scroll_into_view, resize, take_screenshot, read_image) - For browser automation\n10. patch - For precise text edits in files\n\nThese tools allow me to help with various coding tasks, file exploration, text editing, git operations, browser automation, and more."}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":3776,"cache_read_input_tokens":0,"output_tokens":196}}
\ No newline at end of file
+{"id":"msg_012bL4iRbhpsvzdekbT6Jheq","type":"message","role":"assistant","model":"claude-3-7-sonnet-20250219","content":[{"type":"text","text":"I'll list the tools available to me briefly:\n\n1. bash - Execute shell commands\n2. keyword_search - Search for files with keywords\n3. think - Take notes, form plans (no external effects)\n4. title - Set conversation title\n5. precommit - Create a git branch for tracking work\n6. done - Complete a task with checklist verification\n7. codereview - Run automated code review\n8. multiplechoice - Present the user with multiple choice options\n9. browser_navigate - Navigate to a URL\n10. browser_click - Click an element on a webpage\n11. browser_type - Type text into a web form element\n12. browser_wait_for - Wait for an element to appear\n13. browser_get_text - Get text from a webpage element\n14. browser_eval - Run JavaScript in browser context\n15. browser_scroll_into_view - Scroll to make an element visible\n16. browser_resize - Resize browser window\n17. browser_recent_console_logs - Get browser console logs\n18. browser_clear_console_logs - Clear browser console logs\n19. browser_take_screenshot - Take screenshot of webpage\n20. browser_read_image - Read an image file\n21. patch - Make precise text edits to files\n\nThese tools allow me to perform a wide range of actions from running commands, searching code, browsing the web, manipulating files, and managing git workflows."}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":3888,"cache_read_input_tokens":0,"output_tokens":318}}
\ No newline at end of file