Skip to content

chore: simplify snapshotForAI to return string with mode option#39755

Merged
pavelfeldman merged 1 commit intomicrosoft:mainfrom
pavelfeldman:simplify-snapshot-for-ai
Mar 18, 2026
Merged

chore: simplify snapshotForAI to return string with mode option#39755
pavelfeldman merged 1 commit intomicrosoft:mainfrom
pavelfeldman:simplify-snapshot-for-ai

Conversation

@pavelfeldman
Copy link
Member

Summary

  • snapshotForAI() now returns string instead of { full, incremental? } tuple
  • Added mode: 'full' | 'incremental' parameter to control which snapshot is returned
  • Removed ariaSnapshotDiff from TabSnapshot — the caller passes the desired mode and gets back the right snapshot directly
  • The track parameter still maintains incremental state; mode controls what's returned

Push the full/incremental decision into snapshotForAI so callers
get a single string back instead of a {full, incremental?} tuple.
Add mode: 'full' | 'incremental' parameter to control which
snapshot is returned while preserving tracking state.

### option: Page.snapshotForAI.mode
* since: v1.59
- `mode` <[string]>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it an enum please!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You' make it enum as you add the literal :)

@github-actions
Copy link
Contributor

Test results for "MCP"

5507 passed, 343 skipped


Merge workflow run.

@github-actions
Copy link
Contributor

Test results for "tests 1"

6 flaky ⚠️ [chromium-library] › library/video.spec.ts:358 › screencast › should capture navigation `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/trace-viewer.spec.ts:1223 › should display language-specific locators `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/popup.spec.ts:261 › should not throw when click closes popup `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1080 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node20`
⚠️ [webkit-library] › library/browsercontext-add-cookies.spec.ts:426 › should allow unnamed cookies `@webkit-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-test-output.spec.ts:118 › should collapse repeated console messages for test `@windows-latest-node20`

38822 passed, 845 skipped


Merge workflow run.

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