Render saved screenshots and recordings in chat markdown#4321
Render saved screenshots and recordings in chat markdown#4321juliusmarminge wants to merge 4 commits into
Conversation
- Add secure asset access for workspace media and browser artifacts - Support saving preview screenshots and embedding playable recordings
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Effect service review: one convention issue found regarding error cause preservation. See inline comment.
Posted via Macroscope — Effect Service Conventions
ApprovabilityVerdict: Needs human review New feature introducing browser artifact handling, media rendering in chat, and screenshot-saving capabilities across server and web packages. The scope includes new asset types, new UI components, and security-sensitive path resolution logic that warrants human review. You can customize Macroscope's approvability policy. Learn more. |
- Preserve error causes in screenshot save failures - Reject save+savePath combinations and describe both schema fields - Verify canonical (symlink-resolved) containment before workspace writes - Add collision-resistant suffix to artifact screenshot names - Fix Windows drive paths, protocol-relative URLs, query strings, and extensionless video sources in markdown media resolution - Only treat absolute browser-artifacts paths as server artifacts Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Verify the deepest existing ancestor canonicalizes inside the workspace before mkdir, and reject existing destination symlinks that resolve outside the root. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON, but a cloud agent failed to start.
Reviewed by Cursor Bugbot for commit f38f3a7. Configure here.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Summary
Testing
Note
Medium Risk
New filesystem write paths and asset signing for browser artifacts add security-sensitive surface area, though workspace saves include extensive symlink/traversal guards and tests.
Overview
Agents can persist preview snapshots via
preview_snapshotwithsave(writes tobrowserArtifactsDir) orsavePath(workspace-relative.png), with symlink-safe containment checks on workspace writes; results includesavedScreenshotPathfor embedding in replies.The asset API gains a
browser-artifactresource backed by<stateDir>/browser-artifacts, with issuance limited to media file names (no traversal). Workspace videos (.webm,.mp4, etc.) use exact-file signed URLs like images.Chat markdown renders
img/videothroughMarkdownMedia, resolving workspace paths and absolutebrowser-artifactspaths to signed URLs; sanitization allowsvideotags and preserves Windows drive-lettersrcvalues.Preview tool descriptions document embedding recordings and screenshots in chat.
Reviewed by Cursor Bugbot for commit a035fa0. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Render saved screenshots and recordings in chat markdown
saveandsavePathparameters to thepreview_snapshotMCP tool:savePathwrites a PNG to a workspace-relative path with symlink/traversal protection;save=truewrites to a server-side browser artifacts directory with a timestamp+UUID filename.browser-artifactasset claim type in assets.ts, allowing the server to issue and resolve signed URLs for files inbrowserArtifactsDirby filename only.imgandvideotags in chat markdown from direct URLs, workspace-relative signed URLs, or browser artifact filenames, with loading/error states and image expansion.videotags and adds a rehype plugin to preserve Windows drive-letter paths through sanitization.browser-artifactclaim resolves files by filename from a server directory; invalid or missing filenames return null rather than an error to the client.Macroscope summarized a035fa0.