Skip to content

Preview sandbox files in the chat - #926

Merged
sajal-truefoundry merged 6 commits into
mainfrom
preview-window
Oct 1, 2026
Merged

sajal-truefoundry merged 6 commits into
mainfrom
preview-window

Conversation

@innoavator

@innoavator innoavator commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Preview generated sandbox files in the thread: HTML, images, and PDFs show as thumbnail cards, and other files open from their chips.
  • A resizable side pane sits beside the chat. Full page fills the chat area, keeps the app sidebar, and collapses the chat history drawer.
  • HTML renders in a sandboxed frame so scripts can paint the page without reading the chat. Download stays available.

Screenshots

Markdown rendered in the side pane:

Markdown preview beside the chat

Full page HTML preview. The app sidebar stays, and chat history is collapsed:

Full page HTML preview

Test plan

  • Generate an HTML file and confirm a thumbnail appears in the message
  • Enlarge it into the side pane and drag the resize grip
  • Open full page and confirm the icon rail stays, chat history collapses, and exit restores the history list
  • Preview a Markdown or source file from its chip and confirm download still works
  • Check a narrow viewport, where the preview covers the thread instead of sitting beside it

Note

Medium Risk
Untrusted assistant-generated HTML runs in sandboxed iframes with scripts enabled; mis-sandboxing could widen exposure, though popups and same-origin are omitted by design.

Overview
Assistant-generated sandbox artifacts can now be previewed in the thread instead of download-only. HTML, images, and PDFs show as inline thumbnail cards with enlarge/download; other files stay in the artifact chips but gain a Preview action that opens the same viewer.

Preview state is wired through new file preview context (turn-scoped sandbox loads, closes on thread/new-chat changes) with FilePreviewHost beside the chat in a resizable side pane, overlay on mobile/compact layouts, or full page within the chat column. Full-page mode hides the recent-chats drawer in SidebarLayout while keeping the app rail. Content is classified by path/extension with size and binary guards; HTML uses sandboxed iframes (scripts/forms allowed, not same-origin/popups). Download is unchanged and can reuse bytes already fetched for preview.

Reviewed by Cursor Bugbot for commit 4241f45. Bugbot is set up for automated code reviews on this repo. Configure here.

Show generated HTML, images, and PDFs in the thread, in a resizable side pane, and across the chat area without covering the app sidebar.

Co-authored-by: Cursor <[email protected]>
@changeset-bot

changeset-bot Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4241f45

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@truefoundry/trueforge-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

innoavator and others added 2 commits September 30, 2026 15:28
Save the sandbox path's filename, drop the pane when the local chat changes, and stop thumbnails from opening popups or submitting forms.

Co-authored-by: Cursor <[email protected]>
The images stay on the pull request via the earlier commit. They do not belong in the tree.

Co-authored-by: Cursor <[email protected]>
@sajal-truefoundry
sajal-truefoundry enabled auto-merge (squash) October 1, 2026 05:28

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 75d65a0. Configure here.

The preview host stays mounted, so the previous file was still painted and downloadable under the next title until the new load finished.

Co-authored-by: Cursor <[email protected]>
@sajal-truefoundry
sajal-truefoundry merged commit c88d850 into main Oct 1, 2026
14 checks passed
@sajal-truefoundry
sajal-truefoundry deleted the preview-window branch October 1, 2026 05:54
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