feat(extension): introduce BrowserModel with explicit handshake#40411
feat(extension): introduce BrowserModel with explicit handshake#40411yury-s merged 1 commit intomicrosoft:mainfrom
Conversation
- Replace the blocking `extension.selectTab` command with an `extension.initialized` event pushed by the extension after reporting initial tabs via `chrome.tabs.onCreated`. - Add `BrowserModel` abstraction that owns the tab map and translates between chrome.* dialect and CDP dialect on the relay side. - Gate Playwright CDP traffic on `handler.ready()`: `establishExtensionConnection` awaits the handshake before `connectOverCDP` is called, so `Target.setAutoAttach` is answered from a populated model. - Thread `chrome.tabs.Tab` objects end-to-end from the connect page through to `ConnectedTabGroup.attachTab`, eliminating `TabInfo` and `chrome.tabs.get` round-trips. - Handlers now get a `sendToCDPClient` sink via `connectOverCDP` only after ready, and `onExtensionDisconnect` aborts a pending `ready()` when the user rejects or closes the connect tab.
Test results for "MCP"8 failed 6669 passed, 928 skipped Merge workflow run. |
Summary
browserModel.ts) owns the tab map and translates betweenchrome.*and CDP dialects.ExtensionProtocolV2becomes a thin demuxer.Target.setAutoAttachno longer blocks on the user's tab pick. Instead the extension pusheschrome.tabs.onCreatedfor the selected tab (or none) followed byextension.initialized;establishExtensionConnectionwaits for this before returning, so CDP traffic always meets a populated model.sendToCDPClientviaconnectOverCDP()only afterready()resolves; before that they're silent by construction.chrome.tabs.Tabend-to-end from the connect page toConnectedTabGroup.attachTab; dropTabInfoand thechrome.tabs.getround-trip.