Skip to content

fix(dsh-plugin): PiP window close button & observation thumbnail media type detection - #172

Merged
iuyo5678 merged 2 commits into
mainfrom
fix/pip-close-and-obs-mediatype
Sep 2, 2026
Merged

fix(dsh-plugin): PiP window close button & observation thumbnail media type detection#172
iuyo5678 merged 2 commits into
mainfrom
fix/pip-close-and-obs-mediatype

Conversation

@iuyo5678

@iuyo5678 iuyo5678 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

Two remaining issues from #153:

  1. PiP window has no close entry — after popping out the observation overlay into a Document PiP window, onPopOut / onCollapse are both undefined inside 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.

  2. Observation thumbnail hardcodes image/pngpublishFrame() unconditionally sets mediaType: "image/png" for the HTTP thumbnail endpoint, regardless of the actual capture bytes. On Chromium builds that return JPEG from captureVisibleTab, the served Content-Type mismatches the payload.

(Bug 1 from #153 — screenshot attachment store corruption — was already fixed in #135.)

Fix

  1. Add onClosePip prop to OverlayBody; 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 existing pagehide listener.

  2. Export sniffImageMediaType from image.ts and call it in publishFrame() — the same byte-sniffing logic already used by trySaveScreenshot. Falls back to "image/png" for unrecognized bytes.

Testing

  • pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin typecheck — clean
  • pnpm --filter @wxg-prc-cpg/browser-skill-dsh-plugin test — 181 passed (2 new)
  • Manually verified on local DSH: PiP close button works; screenshot flow completes without session corruption

Closes #153

Made with Cursor

TencentXiaowei and others added 2 commits September 2, 2026 16:14
… 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>
@iuyo5678
iuyo5678 merged commit 66ae555 into main Sep 2, 2026
4 checks passed
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.

[dsh-plugin] browser_screenshot 附件格式硬编码为 image/png 导致模型请求必败;PiP 观察窗口无关闭入口

2 participants