Skip to content

Commit 9efebbf

Browse files
authored
fix(browser_execute): use real helper names in tool description (#26)
The tool description listed `goto`, `click`, `screenshot` -- none of those exist. The actual helpers (per harness/src/browser_harness/helpers.py) are `goto_url`, `click_at_xy`, `capture_screenshot`. Agents followed the description literally and got NameError on every call. Also nudge agents toward `new_tab(url)` for first navigation per SKILL.md, since bare `goto_url` clobbers the user's active tab. Repro: fresh install, ask any model to "go to wikipedia". Pre-fix: NameError: name 'goto' is not defined. Post-fix: agent uses `new_tab("https://wikipedia.org")` directly.
1 parent 95bb954 commit 9efebbf

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

packages/opencode/src/tool/browser-execute.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ Execute Python code against a connected web browser via the BrowserCode harness.
22

33
This is the single tool for all browser interaction. The agent writes Python that
44
imperatively drives the browser using helpers preloaded into the script's namespace
5-
(`goto`, `click`, `type_text`, `screenshot`, `js`, `cdp`, `new_tab`, `switch_tab`,
6-
`wait_for_load`, `page_info`, `http_get`, etc.).
5+
(`goto_url`, `click_at_xy`, `type_text`, `capture_screenshot`, `js`, `cdp`,
6+
`new_tab`, `switch_tab`, `ensure_real_tab`, `wait_for_load`, `page_info`,
7+
`http_get`, etc.).
78

89
Read `packages/bcode-browser/harness/SKILL.md` for the full helper surface and
910
recommended workflow. Read `packages/bcode-browser/harness/src/browser_harness/helpers.py`
@@ -15,14 +16,17 @@ browser. Add task-specific helpers to
1516
`packages/bcode-browser/harness/agent-workspace/agent_helpers.py` between calls;
1617
they take effect on the very next call.
1718

18-
Coordinate-based interaction is the default — `click(x, y)` rather than selector
19-
indices. `Input.dispatchMouseEvent` passes through iframes, shadow DOM, and
20-
cross-origin at the compositor level.
19+
Coordinate-based interaction is the default — `click_at_xy(x, y)` rather than
20+
selector indices. `Input.dispatchMouseEvent` passes through iframes, shadow DOM,
21+
and cross-origin at the compositor level.
22+
23+
For first navigation use `new_tab(url)` (or `ensure_real_tab(); goto_url(url)`),
24+
not bare `goto_url` — the latter clobbers whatever tab the user is on.
2125

2226
Output is whatever the script writes to stdout/stderr. Wrap multi-step flows in
2327
one call when possible — that's the design.
2428

2529
Example:
26-
goto("https://example.com")
30+
new_tab("https://example.com")
2731
wait_for_load()
2832
print(page_info())

0 commit comments

Comments
 (0)