Skip to content

feat(cdp): signal when the ref list is truncated in look()#18

Open
nipunrajk wants to merge 1 commit into
josharsh:mainfrom
nipunrajk:fix-look-truncation
Open

feat(cdp): signal when the ref list is truncated in look()#18
nipunrajk wants to merge 1 commit into
josharsh:mainfrom
nipunrajk:fix-look-truncation

Conversation

@nipunrajk

@nipunrajk nipunrajk commented Jun 26, 2026

Copy link
Copy Markdown

What

  • Tracks truncatedCount in compactAxTree by continuing the loop to count matching elements after the MAX_REFS limit is reached.
  • Appends a hint to the end of the look() text output when truncated: \n… N more elements below — scroll or filter.
  • Adds assertions to verify truncatedCount in snapshot.test.ts.

Why

Fixes #2. Prevents the LLM agent from assuming it has captured the entire page when the element list is truncated, letting it know it needs to scroll or filter.

Checklist

  • pnpm test and pnpm -r typecheck pass
  • Docs/README updated if behavior changed

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.

look(): signal when the ref list is truncated

1 participant