# Browser actions and task controls

| Failure | Handling |
| --- | --- |
| Empty tab-header list after snapshot capture | The pinned Playwright response renderer guards against it: detach or close during that asynchronous read must not dereference a missing header |
| Playwright response with no attached page | Only snapshot reads are retried, at most three times; navigation, form input and submission are never replayed. Reconnection to a different URL is not accepted as recovery: the Agent receives an observation-required result and the remaining batch stops |
| Extension action loses its reference | Nothing was dispatched |
| Extension connection closes | The action outcome is unknown and requires inspection |
| Either extension case | A fresh snapshot of the same URL is read before control returns to the Agent. A recovered observation stops the remaining batch; completed steps are retained; no input or submission is replayed. A failed snapshot or a different page remains an error |

Opening a URL in the user's Chrome or Edge creates a normal working tab. Opening a new working tab is the product's policy; the extension connection page itself can also navigate and is not inherently unusable.

| Thing | Rule |
| --- | --- |
| Toolbar | Address, navigation, reload, action markers, operation history, preview. No page pause or resume; those belong to the conversation controls next to the composer. |
| Input | Users and Agents may operate pages, including OpenProgram. Pointer, wheel, keyboard, edit and navigation change no task state and create no write prohibition. Legacy page-input notifications are ignored. |
| Closing a page | Immediate, without waiting for task pause |
| Lost binding | Reacquire the original window and tab. An existing page is observed as it is; only an absent page reopens at its last URL. Returns a fresh observation; never replays a click or submission or picks another page. A lost connection is not proof of closing. |
| Task pause | Stops later generation and tool dispatch. Ownership, access and frame validation still apply. Continuation observes current state with no second page permission. |
| Reporting | History, markers and lifecycle describe activity without controlling it. Lost authentication and unsaved data are reported honestly. |

## Floating preview

| Control | Effect |
| --- | --- |
| Open page | Opens it in a tab |
| Close preview (X) | Hides; page and session resource stay, Resources can reopen |
| More → Automatically show what the Agent is using | Checked follows the Agent's page, unchecked keeps the current one. Not always-on-top; no effect on execution. Native and Web menus agree. |
| Absent | Pin, expand or shrink buttons. Dragging and eight-direction resizing stay; legacy expanded geometry stays compatible. |

## What Resources keeps

| Kind | Rule |
| --- | --- |
| Page the conversation opened | Belongs to that conversation and stays listed until it is closed. |
| Closed page | Leaves the list, and its tab goes with it unless the tab is in the strip or on the canvas. |
| Another application's window | Shared by everyone, so it is listed only while the Agent operates it and released after each call. |

| Layout | Value |
| --- | --- |
| Frame | No outer frame, shadow, or side and bottom padding; page fills below a 30 CSS-pixel header |
| Corners | One card, 10 CSS-pixel corners. Header rounds its top; stage clips fallback, iframe and gesture surfaces at the bottom; gesture image rounds its top too. Stage shares the header background so top cutouts blend. |
| Native radius | `View.setBorderRadius`: round(10 × UI zoom), minimum 1; cached, reset to zero in a normal tab only when needed |
| Resize targets | Eight, transparent, outward; corners 24×24, half outside the page. Native surfaces take page input, so the outer area resizes. |
| Corner hint | Only the hovered corner: 2px stroke, 14×14 box, 12px outer arc, 2px outside the corner |
| Placement | 22 CSS pixels per side: 12 corner handle, 8 sidebar resize rail, 2 separation |

## Preview viewport

| Aspect | Behaviour |
| --- | --- |
| Desktop | Electron [`enableDeviceEmulation`](https://www.electronjs.org/docs/latest/api/web-contents#contentsenabledeviceemulationparameters): 1920 CSS pixels wide, height following the preview's shape (1080 at 16:9), scale = preview width ÷ 1920. Fills the preview edge to edge. Page zoom stays 1. |
| Browser iframe | Fixed 1920 × 1080 with a CSS transform fitted inside the stage; cross-origin limits and separate iframe state unchanged |
| Independent of size | Page identity, width-driven layout, scroll position, Agent CSS coordinates |
| Normal tab | Override off, the user's page zoom restored. Navigation reapplies preview geometry. |
| Excluded | A screenshot-only surface, which loses native interaction; resolution selector; desktop-wide emulation |

**Input and capture mapping**

- Renderer bounds convert to native DIP before scaling. Native input uses Chromium's emulated-view mapping.
- Observations and screenshots stay in CSS coordinates. The exact native Page reports `input_scale` through the owner-checked binding reply; coordinate clicks and pointer moves multiply by it before CDP. Wheel deltas and `window.scrollBy` stay in CSS units.
- MCP reference namespaces stay upstream: scaled reference clicks evaluate the existing click script there; hover uses a temporary exact-element marker, frame-aware Playwright bounds and a native pointer move.
- Action markers share the viewport and scale. Owner checks and deferred transfer restoration stay.
- Agent screenshots use a fixed CSS-resolution CDP capture with temporary device metrics and DPR compensation. Concurrent captures share one result. Cleanup removes the override and restores native geometry, as does final debugger detach. A resize, navigation, ownership change or preview exit invalidates an in-flight result.
- A capture keeps its owned native view and navigation generation. Start or commit in any frame, same-document and same-URL reload included, invalidates pending captures; a failed navigation never restores an earlier generation. Position-only moves keep native captures; dynamic DOM updates do not count as generations.

**Movement cost and gestures**

- Position-only moves update bounds without touching emulation or zoom. Identical geometry issues nothing. Scale changes only with native dimensions; navigation and debugger detach restore emulation. Renderer reports share one rounded geometry, UI zoom included.
- Root scrollbar tracks are hidden by a reversible author-origin stylesheet; wheel, keyboard and nested scrolling work. Leaving preview removes it, including when insertion overlaps navigation or exit.
- While a drag or resize is held, one decoded bitmap moves and scales in the renderer; native bounds and emulation stay fixed, and page animations look frozen. On release the hidden page gets the final bounds once, a capture waits for its painted surface, and live interaction resumes.
- Presentation captures use `capturePage`, never CDP or a loop. An invalidated or timed-out capture cannot hide or restore a replaced preview.

## Exact editable values

How the native `type` action writes text:

| Case | Behaviour |
| --- | --- |
| `input`, `textarea` | Filled normally |
| contenteditable | After the native editable check and clear, replaces the selection with a plain text node and emits `input`, avoiding Chromium paragraph nodes that add a rendered newline for blank lines |
| Read-back | Rendered `innerText` after handlers |
| Editor rewrites text or collapses significant whitespace | Failed action needing a fresh observation, never a replay |
| Evidence of success | A fresh public observation |

## Dispatch cancellation

A browser action checks the task's cancellation while it waits for its tab and while it waits for the page to settle; a list of actions checks again before each one. A cancelled pending action sends nothing. A dispatched action is neither undone nor repeated.

## Acceptance

- Hiding keeps the page; Resources reopens it; the More item sends no execution-control requests.
- `innerWidth` stays 1920 across resizes below and above 480 pixels. Native clicks, Agent clicks, markers, scrolling and fresh screenshots agree at two sizes; UI zoom, navigation, tab restoration and transfer cleanup hold.
- Sixty moves and repeated identical bounds cause zero emulation resets; one reset per changed scale; forced restoration and stylesheet lifecycle hold; dragging and scrolling stay continuous.

## Implementation status

Implemented and reviewed: controls, viewport, gestures, frameless layout, exact values, dispatch cancellation, capture generations. Installed-App acceptance of dispatch cancellation and capture generations is open.
