Files
oh-my-pi/packages/coding-agent/src/prompts/tools/browser.md
T
can1357 92c79d80c7 feat: introduced OMP Browser Relay extension with CDP RPC execution
- Implement the OMP Browser Relay extension with WebSocket communication and CDP RPC execution.
- Add browser relay server, daemon management, and bridge multiplexing in the coding agent.
- Introduce CLI commands and settings schema options for configuring and installing the relay.
- Add utility functions and test suites supporting environment parsing and relay lifecycle handling.
2026-08-02 05:33:07 +02:00

2.5 KiB

Drives real Chromium tab; full puppeteer access via JS.

- Static content? `read` the URL. Browser only for JS execution, auth, interactive actions. - `open` → `run` — tabs survive calls and subagents, open once reuse. - `run` scope: `page`, `browser`, `tab`, `display`, `assert`, `wait` available. `wait(fn)` polls until truthy — use instead of polling inside `tab.evaluate`.
  • tab helpers (drop to raw puppeteer page for anything uncovered): Element handles: tab.ref("e5") / tab.id(n) return a handle you call methods on directly — (await tab.id(n)).click(). Handles are NOT selectors: tab.click/type/fill/waitFor* take STRING selectors only. Snapshot refs work in any selector slot: tab.click("e5") ≡ tab.click("aria-ref=e5"). Simple: tab.goto, tab.click, tab.type, tab.fill, tab.press, tab.scroll, tab.scrollIntoView, tab.drag, tab.uploadFile, tab.select, tab.screenshot, tab.extract, tab.evaluate. Screenshots: tab.screenshot({ selector?, fullPage?, silent? }) saves to browser.screenshotDir, or OS temp when unset, then returns the path. It NEVER accepts a path. Waits: tab.waitFor, tab.waitForSelector, tab.waitForUrl, tab.waitForResponse, tab.waitForNavigation. Snapshots: tab.observe() → accessibility tree; tab.ariaSnapshot() → ARIA YAML with [ref=eN].

    Gotchas:

    • tab.fill NEVER works for <select> — use tab.select.
    • tab.waitForNavigation must start BEFORE the trigger click.
    • Navigation and re-renders (virtualized lists, SPA updates) invalidate ids/refs — re-observe or re-snapshot, then act in the same cell.
    • Stalled actions fail fast with named error, never whole-cell timeout.
    • Raw request interception is run-scoped: run end removes request handlers, disables interception, releases held requests.
  • app.path → NEVER tamper with a real desktop app (no stealth patches).

  • app.relay: true → drive the user's own Chrome tabs via the omp browser relay (auto-started; needs the OMP Browser Relay extension installed). app.target picks a tab by URL/title substring; without it the visible tab is adopted without stealing focus.

  • Selectors: CSS + puppeteer aria/…, text/…, xpath/…, pierce/…. Playwright-only pseudos (:has-text(), :visible) are REJECTED.

- MUST `open` before `run`. Default to `tab.observe()`; screenshot only for appearance. `code` runs with full Node access — not sandboxed.