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/form.ts | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
(limited to 'src/domains/form.ts')
diff --git a/src/domains/form.ts b/src/domains/form.ts
index 577eb5d..1673738 100644
--- a/src/domains/form.ts
+++ b/src/domains/form.ts
@@ -27,15 +27,12 @@ export const fillTool = defineBrowserTool({
"Fill a form field (input/textarea/contenteditable), or tick a checkbox/radio by passing 'true'/'false'. PREFERRED: pass `ref` (e.g. 'e7') from browser_snapshot — survives re-renders. Fallback: a CSS `selector`. Writes through the native value setter and fires bubbling 'input'/'change' events, so React/Vue/Angular controlled components and rich-text editors update correctly — unlike browser_type. Refuses a disabled field rather than writing a value the page will ignore. Returns the field's value after writing, plus a compact diff of page changes.",
promptSnippet: "Fill a form field by ref (preferred) or selector (works with React/Vue controlled inputs)",
promptGuidelines: [
- "PREFER `ref` from browser_snapshot (the '[eN]' handle) over a guessed CSS selector — refs survive re-renders and don't require you to invent a selector.",
"Pass the desired value; no browser_click is needed first.",
"For a checkbox or radio pass 'true' or 'false' — it toggles `checked`, not the submit value. browser_set_checked does the same thing with a boolean.",
- "A disabled field is refused: the error says so, rather than reporting a write the page never accepted.",
- "A 'ref is stale' error means the page changed — re-run browser_snapshot to get fresh refs.",
"Use browser_type instead only for keystroke-sensitive widgets (autocomplete, masked/segmented inputs).",
"Fill sets the value but does not focus or submit. To submit a tag/autocomplete input, follow with browser_dispatch_key({ ref, key: 'Enter' }) — not browser_press_key, which targets the focused element and may miss this field.",
"For a custom (div-based) dropdown, browser_fill won't validate against its option list — open it, run browser_snapshot, then browser_click the option's ref.",
- "The result reports the field's value after writing and an appended page-changes diff — confirm both match what you intended before moving on.",
+ "Confirm the field value browser_fill returns matches what you intended.",
],
parameters: FillArgs,
concurrency: "serialized",
@@ -118,8 +115,6 @@ export const focusTool = defineBrowserTool({
"Focus an element via the DOM .focus() method — deterministic, no coordinate accuracy needed. PREFERRED: pass `ref` from browser_snapshot; fallback: a CSS `selector`. Use before browser_type when a click might miss the field.",
promptSnippet: "Focus an element by ref (preferred) or selector",
promptGuidelines: [
- "PREFER `ref` from browser_snapshot over a CSS selector — survives re-renders.",
- "Use before browser_type to guarantee the right field is focused without relying on click coordinates.",
"For simply setting a value, prefer browser_fill (it doesn't need a separate focus step).",
],
parameters: FocusArgs,
@@ -196,10 +191,8 @@ export const selectOptionTool = defineBrowserTool({
"Select an option in a native