aboutsummaryrefslogtreecommitdiff
path: root/src/domains/js.ts
diff options
context:
space:
mode:
authorPatrick Barattin <p.barattin@gmail.com>2026-10-11 20:25:38 +0200
committerGitHub <noreply@github.com>2026-10-11 23:55:38 +0530
commit014de0ec21936a7a2fd64db9d151e73c79bb44ad (patch)
tree654a0a50eb2a88a14f55458e75dfb55e1c5779f5 /src/domains/js.ts
parent79526b01f4d3cf16c3cfb46313cf1179f0db40ac (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'src/domains/js.ts')
-rw-r--r--src/domains/js.ts6
1 files changed, 1 insertions, 5 deletions
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.",
],