Skip to content

Feat/in session browser view#1750

Open
Douglasymlai wants to merge 3 commits into
mainfrom
feat/in-session-browser-view
Open

Feat/in session browser view#1750
Douglasymlai wants to merge 3 commits into
mainfrom
feat/in-session-browser-view

Conversation

@Douglasymlai

@Douglasymlai Douglasymlai commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Related Issue

Closes #

Description

Introduces a unified Preview Panel on the session page, replacing the previous single-purpose file preview with a tabbed surface that supports browser, file, canvas, terminal, and review content types.

Preview panel & layout

  • Adds PreviewPanel with a scrollable tab strip, chooser flow for new tabs, and per-tab content routing (BrowserTab, FileTab, CanvasTab, TerminalTab, ReviewTab, ChooserTab).
  • Refactors the session layout to a resizable chat/preview split with open/close animation; browser webviews are held until the panel animation settles so pages do not flash over the chat mid-transition.
  • Extends pageTabStore with per-project preview state (sessionPreviewByProject), tab lifecycle helpers, and openBrowserPreview() for opening or reusing browser tabs by URL.

In-session embedded browser (desktop)

  • Adds PreviewBrowserLayer, an always-mounted Electron <webview> layer that positions guests over the active browser tab via previewBrowserViewport, parks them offscreen when hidden, and evicts idle project guests after 10 minutes to reclaim renderer processes.
  • Adds browser chrome (back/forward/refresh, address bar, open in system browser) and a webviewRegistry for navigation control without reparenting guests.
  • Adds browserUrl.ts for URL normalization and canonicalization.

Integration & security

  • Links in chat markdown and user messages open in the session preview browser on desktop instead of leaving the app; web host falls back to window.open.
  • Hardens Electron main-process webview attachment: strips unsafe guest preferences, blocks non-HTTP(S) sources, and routes window.open / target=_blank into the same guest instead of spawning popups.
  • Refactors FilePreview and folder flows to support embedded mode inside preview tabs.

Tests

  • Adds unit coverage for preview panel routing, browser layer viewport/guest behavior, URL helpers, and preview store tab management (30 tests).

Testing Evidence (REQUIRED)

Screenshot 2026-07-12 at 02 52 28

Unit tests (all passing):

✓ test/unit/lib/browserUrl.test.ts (5 tests)
✓ test/unit/store/pageTabStore.preview.test.ts (12 tests)
✓ test/unit/components/Session/PreviewPanel.test.tsx (7 tests)
✓ test/unit/components/Session/PreviewBrowserLayer.test.tsx (6 tests)

Test Files  4 passed (4)
Tests       30 passed (30)

Manual verification (desktop):

  • Open a project session and toggle the preview panel from the header.

  • Add a browser tab from the chooser; navigate via the address bar and back/forward controls.

  • Click an https:// link in a chat message; confirm it opens in the in-session browser.

  • Open a file preview tab; confirm file content renders in the embedded tab shell.

  • Resize the chat/preview split and close/reopen the panel; confirm the browser tab retains its page.

  • Switch between projects; confirm preview state is scoped per project without cross-project flash.

  • I have included human-verified testing evidence in this PR.

  • This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).

  • No frontend/UI changes in this PR.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant