diff options
| author | Patrick Barattin <p.barattin@gmail.com> | 2026-10-11 20:25:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-11 23:55:38 +0530 |
| commit | 014de0ec21936a7a2fd64db9d151e73c79bb44ad (patch) | |
| tree | 654a0a50eb2a88a14f55458e75dfb55e1c5779f5 /src/domains/keyboard.ts | |
| parent | 79526b01f4d3cf16c3cfb46313cf1179f0db40ac (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/keyboard.ts')
| -rw-r--r-- | src/domains/keyboard.ts | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/domains/keyboard.ts b/src/domains/keyboard.ts index 17b56e7..10b1b5c 100644 --- a/src/domains/keyboard.ts +++ b/src/domains/keyboard.ts @@ -31,7 +31,6 @@ export const typeTool = defineBrowserTool({ description: "Type text into the currently focused element. Use browser_click first to focus an input field.", promptSnippet: "Type text into the focused element", promptGuidelines: [ - "Use browser_type to enter text. Click on an input field with browser_click first to focus it.", "For special keys (Enter, Tab, Escape, arrows), use browser_press_key instead.", ], parameters: TypeArgs, @@ -84,9 +83,7 @@ export const pressKeyTool = defineBrowserTool({ promptSnippet: "Press a key (Enter, Tab, Escape, arrows, or any character)", promptGuidelines: [ "Use browser_press_key for keyboard shortcuts and navigation keys.", - "Special key names: Enter, Tab, Backspace, Escape, Delete, ArrowLeft, ArrowUp, ArrowRight, ArrowDown, Home, End, PageUp, PageDown.", - "Use Space as ' ' (a single space character).", - "Modifiers: 1=Alt, 2=Ctrl, 4=Meta(Cmd), 8=Shift. Combine with bitwise OR: Ctrl+Shift = 2|8 = 10.", + "browser_press_key modifiers combine with bitwise OR: Ctrl+Shift = 2|8 = 10.", ], parameters: PressKeyArgs, concurrency: "serialized", @@ -138,11 +135,9 @@ export const dispatchKeyTool = defineBrowserTool({ "Dispatch a DOM KeyboardEvent on a specific element via JS injection. PREFERRED: pass `ref` from browser_snapshot; fallback: a CSS `selector`. Use for React/Vue components that listen to synthetic events more reliably than CDP input.", promptSnippet: "Dispatch a DOM KeyboardEvent on an element by ref (preferred) or selector", promptGuidelines: [ - "PREFER `ref` from browser_snapshot over a CSS selector — survives re-renders.", - "Dispatches a synthetic DOM KeyboardEvent — for React/Vue synthetic event listeners. Does NOT insert text (use browser_type or browser_press_key for actual typing).", + "Does NOT insert text (use browser_type or browser_press_key for actual typing).", "Try browser_press_key first; only use browser_dispatch_key when the page ignores raw CDP key events.", "The event carries keyCode/which (e.g. 13 for Enter) for legacy handlers, but is untrusted (isTrusted === false) — a few libraries may still ignore it.", - "eventType defaults to 'keydown'.", ], parameters: DispatchKeyArgs, concurrency: "serialized", |
