Skip to content

feat: multi-format file attachments with @-mentions and preview renderers#12

Merged
OmGuptaIND merged 1 commit intomainfrom
OmGuptaIND/file-upload-scope
Apr 24, 2026
Merged

feat: multi-format file attachments with @-mentions and preview renderers#12
OmGuptaIND merged 1 commit intomainfrom
OmGuptaIND/file-upload-scope

Conversation

@OmGuptaIND
Copy link
Copy Markdown
Contributor

Summary

Extend the composer beyond image-only attachments. Users can now upload documents (pdf, docx, doc, rtf), spreadsheets (xlsx, xls, csv, tsv), and text (md, txt, log, json) directly from the composer or Files view; reference any file or folder in the project via @ with shell-style drill-in; and preview uploads in the artifact panel (docx / xlsx / pdf / image). The harness translates markers to absolute-path <file_ref> / <dir_ref> XML so the agent can read / bash them on demand.

Spec: specs/features/MULTI_FORMAT_ATTACHMENTS.md
Follow-ups: specs/features/MULTI_FORMAT_ATTACHMENTS_FOLLOWUPS.md

UI

  • Composer + splits into Add Images / Add Files
  • DestinationPicker modal with folder tree + inline "New folder" + batch mode + smart mime-family defaults + recent-folder memory
  • @ dropdown with files + folders, Finder-style drill-in (chevron / →), back-navigation row for parent scope, keyboard nav + Backspace to pop a level
  • File / folder pills in composer with icon, hover-reveal remove (×), click to open artifact panel (file) or Files view (dir)
  • All floating UIs portaled to document.body so ancestor transforms don't break fixed positioning
  • Session Files bar splits into Uploads + Artifacts sections
  • Sent messages render [img:id] / [file:path] / [dir:path] markers as clickable chips

Rendering

  • Artifact panel gains DocxRenderer (mammoth), XlsxRenderer (SheetJS — with working "Show all rows"), PdfRenderer (<embed>), ImageRenderer — all lazy-loaded
  • fs_read_bytes primitive for binary fetch, 500MB cap

Harness

  • translateFileDirMarkers expands markers into XML refs with absolute paths and shallow folder listings (≤20 items)
  • workspacePath threaded into buildInterleavedContent at both call sites

Infra

  • cloud-init installs poppler-utils, pandoc, python3-pandas, python3-openpyxl, xlsx2csv so the agent can process uploaded docs via its shell / read tools
  • Mirrored in deploy/Dockerfile

Protocol (additive)

  • fs_list_response echoes requested path so concurrent listeners correlate correctly
  • fs_read_bytes / fs_read_bytes_response for binary artifact previews

Test plan

  • Composer + Add Images → pick PNG → inline chip (regression)
  • Composer + Add Files → pick .md → DestinationPicker opens at notes/ → Save → pill in composer → Files view shows it under notes/
  • Drag .xlsx onto composer → picker defaults to data/ → Save → pill → click pill → artifact panel renders sheet tabs + table
  • Type @sal → dropdown → Enter to select → pill inserted
  • Type @data/ → dropdown scopes into data/ → ← / Backspace returns to root
  • Type @email (folder) → Right arrow or chevron → drills in; Enter selects the folder itself
  • Hover a pill → × appears → click removes pill
  • Send message with pills → harness log shows <file_ref name path /> / <dir_ref>
  • Open artifact → xlsx with >5000 rows → "Show all" reveals remaining rows
  • Drag multiple files → single picker → batch list → Save writes all
  • Smart-default folder doesn't exist → picker shows friendly hint, Save still creates it
  • Navigate away from a draft with pills → remount → pills restored
  • Home (hero) composer → menu / dropdown / modal anchor correctly (transform-ancestor fix)
  • Enter on a dropdown row selects — doesn't also send the half-typed @query

🤖 Generated with Claude Code

…rers

Extend the composer beyond image-only attachments. Users can now upload
documents (pdf, docx, doc, rtf), spreadsheets (xlsx, xls, csv, tsv),
and text (md, txt, log, json) directly from the composer or Files view,
reference any file or folder in the project via `@`, and preview them
inline in the artifact panel. The harness translates markers to
absolute-path XML refs so the agent can read the files on demand via
its existing `read` / `bash` tools.

Why: images were the only first-class attachment. Anyone trying to
"give the agent this PDF" had to upload via the Files view, then type
the path. The new flow makes uploads project-native (any format, any
folder) and references discoverable via `@` with shell-style drill-in.

UI
- Composer `+` menu splits into Add Images / Add Files
- DestinationPicker modal for per-upload folder + rename, with
  macOS-style folder create, batch mode, smart defaults per mime
  family (data → /data, pdf → /references, …), recent-folder memory
- `@` dropdown with files + folders, Finder-style drill-in (click
  chevron or →), back-navigation row for parent scope, keyboard nav
- File / folder pills in composer with inline icon, hover-reveal
  remove (×), click to open artifact panel (file) or Files view (dir)
- All three floating UIs portaled into document.body so transforms
  on composer ancestors don't break fixed positioning
- Session Files bar splits into Uploads + Artifacts sections

Rendering
- Artifact panel gains docx (mammoth), xlsx (SheetJS), pdf (<embed>),
  image (<img>) renderers, all lazy-loaded
- fs_read_bytes IPC primitive for binary-file fetch with 500MB cap
- MessageBubble renders [img:id] / [file:path] / [dir:path] markers
  in sent messages as clickable chips

Harness
- translateFileDirMarkers expands [file:path] / [dir:path] markers
  into <file_ref name path> / <dir_ref> XML with absolute paths and
  optional inline folder listings (≤20 items)
- Workspace path threaded into buildInterleavedContent at both call
  sites (processMessage + steer)

Infra
- cloud-init installs poppler-utils, pandoc, python3-pandas,
  python3-openpyxl, xlsx2csv on the VM so the agent can read docs
  via its existing shell / read tools

Protocol additive
- fs_list_response echoes requested path for listener correlation
- fs_read_bytes / fs_read_bytes_response for binary artifact previews

Specs
- specs/features/MULTI_FORMAT_ATTACHMENTS.md (design doc)
- specs/features/MULTI_FORMAT_ATTACHMENTS_FOLLOWUPS.md (known
  follow-ups: a11y nits, sequential batch decode perf, viewport
  clamping on dropdowns)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@OmGuptaIND OmGuptaIND merged commit 5fadf0d into main Apr 24, 2026
@OmGuptaIND OmGuptaIND deleted the OmGuptaIND/file-upload-scope branch April 24, 2026 12:49
OmGuptaIND added a commit that referenced this pull request Apr 24, 2026
### Features
- multi-format file attachments with @-mentions and preview renderers (#12)

### Fixes
- pnpm lock
- workspace safety net — no more /root EACCES, atomic writes, version handshake (#11)

### Chores
- clean up biome lint + format across repo

### Other
- feat(desktop): remove new-project attachments, add text-file creator in files view (#10)
- feat(desktop): reasoning effort pill + provider modal redesign + onboarding tour (#9)
- fix(desktop): honor real harness readiness in provider UI (#8)
- fix(harness): persist session title to meta.json across reloads (#7)
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.

1 participant