Skip to content

Add a semantic page map and a what-changed check - #262

Open
tedjames wants to merge 2 commits into
mainfrom
cursor/semantic-page-map-3af9
Open

tedjames wants to merge 2 commits into
mainfrom
cursor/semantic-page-map-3af9

Conversation

@tedjames

Copy link
Copy Markdown
Member

Summary

Adds a semantic page map for a tab from listTabs, and a way to act on a ref from that map, without attaching the debugger and without changing which tab is active.

  • snapshotTab walks the page in a content script and returns role, accessible name, text, state, visibility, and a stable ref (e1, e2, …). The same element keeps its ref until the document is replaced. Asleep tabs are reported and not reloaded. The map is capped at 80 elements. Private details are stripped in the page before the result leaves.
  • actOnRef clicks or types that ref using the existing soft click and type gates (worked or needs a real gesture). After the action it returns a short delta: whether the URL changed, console errors that appeared, and network requests that failed.
  • Neither tool calls chrome.debugger, activates a tab, or focuses a window. actOnRef is gated like other input (popup switch, --allow-input / CLI --allow-actions, and the same origin rules). snapshotTab follows the readTab gate.

AGE-824

Test plan

  • Unit tests for the page map (stable refs, visibility, accessible name, scrubbing) and the what-changed delta
  • Unit tests that the extension path does not attach the debugger or change focus, and rejects a ref that did not come from the map
  • Integration tests for the MCP tool, the input gate, and a refused focus change
  • End-to-end: snapshot a background tab, act on the ref, see the URL change plus a new console error and a failed request, with the focused tab left alone and the debugger not attached
  • CI green, then mark this draft ready for review. Do not merge.
Open in Web Open in Cursor 

cursoragent and others added 2 commits October 28, 2026 18:56
snapshotTab reads a tab through chrome.scripting, without the debugger
and without changing focus. Each entry has a role, accessible name, text,
state, visibility, and a stable ref. actOnRef clicks or types that ref
with the existing soft click and type gates, then reports URL changes,
new console errors, and new failed network requests.

Co-authored-by: werbel.ted <werbel.ted@gmail.com>
A taken port left the previous listening callback attached. On the macOS
Node 22 runner that stack sat until two integration tests hit the 30s
timeout. The retry now closes the failed server first, and a listen or
extension socket that never settles gives up instead of waiting forever.

Co-authored-by: werbel.ted <werbel.ted@gmail.com>
@cursor
cursor Bot marked this pull request as ready for review October 28, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants