From 014de0ec21936a7a2fd64db9d151e73c79bb44ad Mon Sep 17 00:00:00 2001 From: Patrick Barattin Date: Sun, 11 Oct 2026 20:25:38 +0200 Subject: refactor: remove duplicate browser prompt instructions (#35) Remove browser instruction text repeated across tool descriptions, parameter schemas, tool guidelines and the global browser prompt. Tool names, schemas, handlers and concurrency are unchanged; shared recovery and ownership guidance is now available before and after the browser connects, and the prompt names which tools are serialized versus observations. Co-Authored-By: Claude Fable 5.1 --- src/domains/js.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/domains/js.ts') diff --git a/src/domains/js.ts b/src/domains/js.ts index 19c8913..9d7cbd1 100644 --- a/src/domains/js.ts +++ b/src/domains/js.ts @@ -36,8 +36,6 @@ export const executeJsTool = defineBrowserTool({ "DEFAULT for extracting a specific value: `document.querySelector('.price').innerText`, `input.value`, `el.getAttribute('aria-label')`, etc.", "For click coordinates not already in browser_snapshot: `JSON.stringify(document.querySelector('SELECTOR').getBoundingClientRect())` — beats a screenshot every time.", "For 'is this element visible / enabled / checked / focused', a one-liner here beats a screenshot every time.", - "DO NOT call browser_screenshot to read a value or check element state. Use this tool.", - "`return foo` is auto-wrapped in an IIFE — both `foo` and `(() => foo)()` work.", "For iframes, first run `Object.values(document.querySelectorAll('iframe'))` to find the iframe, then pass its targetId.", "Result must be JSON-serializable (Runtime.evaluate returnByValue=true).", ], @@ -138,9 +136,7 @@ export const runScriptTool = defineBrowserTool({ "Execute a temporary JavaScript script with full Node.js + browser-daemon access. Path must be inside tmpdir, cwd, or BH_SCRIPT_DIR. Mandatory timeout. The script is full RCE on the harness's process — only invoke scripts you wrote and reviewed.", promptSnippet: "Run a temporary script with daemon + Node access (security-bounded)", promptGuidelines: [ - "Write the script with the write tool first; pass its absolute path.", - "Path must be inside tmpdir, cwd, or BH_SCRIPT_DIR — otherwise rejected.", - "Default timeout is 60s; pass timeoutMs to extend (max 600s).", + "Write the script with the write tool first; pass its absolute path. Use the OS temp directory rather than hardcoding /tmp.", "Script bindings: params, daemon, require, signal, onUpdate, ctx, console, fetch, JSON, Buffer, setTimeout, clearTimeout.", "Script MUST return { content: [{ type: 'text', text: '...' }], details?: {...} }. Throw on errors.", ], -- cgit v1.2.3