aboutsummaryrefslogtreecommitdiff
path: root/src/domains/form.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/domains/form.ts')
-rw-r--r--src/domains/form.ts10
1 files changed, 1 insertions, 9 deletions
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 <select> element by value, visible label, or index. PREFERRED: pass `ref` from browser_snapshot; fallback: a CSS `selector`. Sets the selection and fires bubbling 'input'/'change' events so framework listeners update. On no match, returns the available options.",
promptSnippet: "Select an option in a native <select> by ref (preferred) or selector",
promptGuidelines: [
- "PREFER `ref` from browser_snapshot over a CSS selector — survives re-renders.",
"Provide exactly one of value, label, or index to choose the option.",
"For custom (non-native) dropdowns built from divs, click to open then browser_click the option instead.",
- "If no option matches, the error details list the available options so you can retry.",
],
parameters: SelectOptionArgs,
concurrency: "serialized",
@@ -263,7 +256,6 @@ export const setCheckedTool = defineBrowserTool({
"Set a checkbox or radio to a desired checked state by ref. Only acts if the current state differs, fires change, and reports the final state. Get the ref from browser_snapshot's [eN].",
promptSnippet: "Set a checkbox/radio checked state by ref",
promptGuidelines: [
- "checked:true ticks the box, checked:false unticks it. Idempotent — no-op if already in the desired state.",
"For radios, set checked:true on the option you want; the group deselects the others.",
],
parameters: SetCheckedArgs,