Skip to content

feat: treq send — preview images/text in the agent terminal - #233

Open
Ziinc wants to merge 15 commits into
mainfrom
cursor/treq-send-asset-preview-90c3
Open

feat: treq send — preview images/text in the agent terminal#233
Ziinc wants to merge 15 commits into
mainfrom
cursor/treq-send-asset-preview-90c3

Conversation

@Ziinc

@Ziinc Ziinc commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds treq send so agents can push on-disk files (or stdin) into the treq UI for preview. Image and text assets show as dark square thumbnails over the sending terminal; click opens a blur carousel lightbox with copy / reveal / close.

Image zoom

Zoom out / percentage / zoom in (50%–400%, 25% steps) for image assets. Zoom sets explicit width/height (fitted natural size × factor) so layout size actually grows — transform: scale() only repaints larger without changing width. Text previews omit zoom controls.

Test plan

  • Frontend unit tests (incl. zoom width assertions)
  • Screenshot QA: 100% = 256px wide SVG, 200% = 512px
  • Lint / format / typecheck
Open in Web Open in Cursor 

Agents can run `treq send <path>` (or pipe stdin) to stage a path-based
asset and dispatch it to the open Treq window. The sending PTY shows
square thumbnails; click opens an image or read-only text modal.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Also un-nest dismiss control so thumbnails are not nested buttons.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Design notes (why)

  • Path-based IPC, not blobs: mirrors treq agent TCP dispatch. Senders pass a filesystem path; stdin is staged under .treq/send/ so the UI never receives large payloads over the socket.
  • TREQ_PTY_SESSION_ID: set on PTY create so treq send from inside a terminal attaches previews to that pane (not a global modal). Null session falls back to the active terminal.
  • IPC kind discrimination: existing agent JSON stays untagged for back-compat; send requests add "kind":"send" and share the same response shape.
  • UI strip + modal: square chips live in the terminal chrome (outside xterm) so clicks can open Dialog; images use convertFileSrc, text uses read_file for selectable preview.

Cover text + image square thumbnails and both preview modals.
Screenshot harness convertFileSrc now returns file:// so images rasterize.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Float square previews absolutely over the terminal bottom with a
scrim fade, and always show a circular X to dismiss each thumbnail.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Thumbnails extend horizontally from the top-left corner with a
top-down gradient scrim.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Makes the circular close control readable against the dark terminal.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Replace the modal preview with a backdrop-blur carousel of the asset
itself. Terminal chips use shadcn Attachment; lightbox actions close,
copy to clipboard, and reveal in Finder/Explorer/file manager.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Hide the grey dismiss control until the attachment is hovered so the
terminal strip stays quieter at rest.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Add a thumbnail variant that matches the previous treq send overlay:
h-14 w-14 dark tiles, cover images, icon+title for text, and hover
dismiss X at the corner. Skip size/orientation variants so min-w-40
and card padding do not stretch the squares.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Align capture expectations with the restored square thumbnail styling.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Show zoom out, percentage, and zoom in in the treq send toolbar when
viewing an image. Scale the current image with CSS transform and reset
zoom when switching carousel slides. Text previews omit zoom controls.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
transform:scale only repaints larger without changing layout width, so
SVG previews looked unchanged. Use CSS zoom so the img's used size
(and scrollable overflow) actually increases.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
transform:scale and CSS zoom either leave layout width unchanged or
fail to serialize from jsdom into screenshot captures. Size the img
with width/height in px (fitted natural size * zoom, with a 256px
fallback) so SVG and raster previews actually grow.

Co-authored-by: Ziinc <Ziinc@users.noreply.github.com>
@Ziinc
Ziinc marked this pull request as ready for review August 9, 2026 15:09
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