Skip to content

feat(desktop): drop files anywhere in the chat area#36262

Merged
OutThisLife merged 3 commits into
mainfrom
bb/chat-area-file-drop
Jun 1, 2026
Merged

feat(desktop): drop files anywhere in the chat area#36262
OutThisLife merged 3 commits into
mainfrom
bb/chat-area-file-drop

Conversation

@OutThisLife

@OutThisLife OutThisLife commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two desktop chat fixes.

1. Drop files anywhere in the chat area

  • File drag/drop was only wired to the composer input. You can now drop a file anywhere in the conversation area.
  • New useFileDropZone hook: enter/leave depth counter (no flicker over nested children) + a capture-phase onDropCapture reset so the affordance always clears — even when the composer claims a drop and stopPropagations before the bubble-phase onDrop runs.
  • New ChatDropOverlay: full-bleed, pointer-events-none (the drop lands on the real element underneath), styled to mirror the composer surface.
  • Dropped paths render as the same inline @file: ref chips the composer-input drop produces (not attachment cards), via droppedFileInlineRef + the composer insert bus. Composer drops keep their own caret-aware behavior. Disabled while a session is still loading.

2. Don't render bare file paths as tool images (404)

  • vision_analyze (and any tool reporting an image by local path) rendered a broken/404 image: toolImageUrl handed the bare filesystem path straight to <img src>, which resolves against the renderer origin → 404.
  • Restrict inline tool images to fetchable sources (data: URLs + remote http(s)); bare paths fall back to the tool's codicon. Regression tests via buildToolView.

Test plan

  • tsc -b + eslint clean on changed files
  • vitest run tool-fallback-model.test.ts — 3 passed
  • Verified live via npm run dev (HMR)
  • Drag a file from Finder over the message list → overlay → drop → inline chips
  • Drag over composer → inline-ref / caret behavior unchanged
  • vision_analyze on a local image → tool codicon, no broken image

File drops were only wired to the composer input. Add a reusable
useFileDropZone hook (enter/leave depth counting + capture-phase reset so
the affordance clears even when the composer claims the drop) and a
pointer-events-none ChatDropOverlay, wired onto the conversation viewport.
Drops funnel through the existing onAttachDroppedItems; composer drops keep
their own inline-ref behavior.
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: bb/chat-area-file-drop vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9572 on HEAD, 9572 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4961 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

…t cards

Match the composer-input drop behavior — funnel dropped paths through
droppedFileInlineRef + the composer insert bus so they render as inline
ref chips instead of attachment cards.
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Jun 1, 2026
vision_analyze reports its input image as a local filesystem path, which
toolImageUrl handed straight to <img src>. In the renderer that resolves
against the dev-server origin and 404s. Restrict inline tool images to
fetchable sources (data: URLs and remote http(s)); bare paths now fall
back to the tool's codicon.
@OutThisLife OutThisLife merged commit 359f2be into main Jun 1, 2026
17 of 19 checks passed
@OutThisLife OutThisLife deleted the bb/chat-area-file-drop branch June 1, 2026 05:30
JoeKowal pushed a commit to JoeKowal/hermes-agent that referenced this pull request Jun 4, 2026
* feat(desktop): drop files anywhere in the chat area

File drops were only wired to the composer input. Add a reusable
useFileDropZone hook (enter/leave depth counting + capture-phase reset so
the affordance clears even when the composer claims the drop) and a
pointer-events-none ChatDropOverlay, wired onto the conversation viewport.
Drops funnel through the existing onAttachDroppedItems; composer drops keep
their own inline-ref behavior.

* fix(desktop): chat-area drops insert inline @file refs, not attachment cards

Match the composer-input drop behavior — funnel dropped paths through
droppedFileInlineRef + the composer insert bus so they render as inline
ref chips instead of attachment cards.

* fix(desktop): don't render bare file paths as tool images (404)

vision_analyze reports its input image as a local filesystem path, which
toolImageUrl handed straight to <img src>. In the renderer that resolves
against the dev-server origin and 404s. Restrict inline tool images to
fetchable sources (data: URLs and remote http(s)); bare paths now fall
back to the tool's codicon.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants