fix(dsh-plugin): PiP window close button & observation thumbnail media type detection - #172
Merged
Merged
Conversation
… media type The Document PiP window had no close/return entry once popped out — users could not dismiss it from inside the window. Add an onClosePip callback and render a close button in the PiP header; clicking it calls pipWindow.close() and the content returns to its carrier. The observation thumbnail publisher hardcoded mediaType as "image/png" regardless of the actual capture bytes. Reuse the existing sniffImageMediaType helper (exported from image.ts) so the HTTP thumbnail endpoint declares the correct Content-Type when Chromium returns JPEG captures. Closes #153 (Bug 2 fully; Bug 1 was fixed in #135, this covers the remaining observation-thumbnail path). Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two remaining issues from #153:
PiP window has no close entry — after popping out the observation overlay into a Document PiP window,
onPopOut/onCollapseare bothundefinedinside the window. Users have no way to close or dismiss it; if the session fails the window is stuck showing "browser unavailable" with no escape.Observation thumbnail hardcodes
image/png—publishFrame()unconditionally setsmediaType: "image/png"for the HTTP thumbnail endpoint, regardless of the actual capture bytes. On Chromium builds that return JPEG fromcaptureVisibleTab, the servedContent-Typemismatches the payload.(Bug 1 from #153 — screenshot attachment store corruption — was already fixed in #135.)
Fix
Add
onClosePipprop toOverlayBody; both carriers (ObservationOverlay,ObservationSidebarTab) pass() => pipWindow.close()when in PiP mode. A close button (✕) renders in the PiP header; clicking it closes the window and the content returns to its carrier via the existingpagehidelistener.Export
sniffImageMediaTypefromimage.tsand call it inpublishFrame()— the same byte-sniffing logic already used bytrySaveScreenshot. Falls back to"image/png"for unrecognized bytes.Testing
pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin typecheck— cleanpnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin test— 181 passed (2 new)Closes #153
Made with Cursor