Skip to content

Attach images and folders to chat messages #68

Closed

Description

@currentbits

Goal

Let users attach images and folders to a chat message in the composer, and deliver them to the agent.

Current state

  • Prompt is a plain string at every layer: Composer.onSend -> useCoder.startRun -> runs:start IPC -> runner.startRun -> provider argv/stdin.
  • ChatMessage has only text; no attachment field.
  • No file picker (only project directory pickers), no drag-drop, no paste handling in the composer.
  • @-mentions insert literal @path text; nothing is read or resolved.
  • Inbound image machinery exists (electron/tool-images.js) but only for tool results.

Plan

  1. Data model (src/shared/ipc.ts): add AttachmentInfo { kind: "image"|"folder", path, name }; add optional attachments to ChatMessage and runs.start input.
  2. IPC (electron/preload.js, electron/ipc.js): new channels attachments:pick (native dialog, files+folders), attachments:saveImage (persist pasted/dropped image bytes under userData, returns path), attachments:readImage (data URL for thumbnails). Expose webUtils.getPathForFile via preload for drag-drop paths.
  3. Runner (electron/runner.js): store attachments on the user message; append an attachments section (absolute paths) to the dispatch prompt so every provider (claude stdin NDJSON, codex/grok/kimi/opencode argv) can read them with its normal file tools.
  4. Composer (src/components/Composer.tsx): per-thread attachment state, chips row with image thumbnails and folder names, paperclip button, paste handler, drag-drop; onSend(prompt, attachments); clear on successful send.
  5. Threading (ThreadView.tsx, App.tsx, useCoder.ts): pass attachments through to runs.start.
  6. Transcript (ThreadView.tsx): render attachment chips/thumbnails on user messages.
  7. Stubs: src/devCoder.ts + src/wireClient.ts implementations for the new CoderApi members.
  8. Tests: composer attachment UI, runner dispatch-prompt attachment section, IPC handler coverage.

Out of scope: provider-native image blocks (e.g. claude stream-json content arrays); path references work for all providers since agents run locally.

Activity

  1. added
    plan:doing
    plan:done
    and removed
    plan:doing
    on Aug 15, 2026
  2. currentbits commented on Aug 15, 2026

    @currentbits
    OwnerAuthor

    Implemented in worktree 53c77b8b: AttachmentInfo type + ChatMessage.attachments, attachments:pick/fromPaths/saveImage/readImage IPC channels (electron/attachments.js), runner stores attachments on the user message and appends an absolute-path section to the dispatch prompt for all providers, Composer chips with pick/paste/drag-drop, transcript thumbnails, devCoder/wireClient stubs. Tests: 649/649 renderer, 737/737 electron (incl. 10 new), core and memory-server green. Not committed.

  3. currentbits commented on Aug 18, 2026

    @currentbits
    OwnerAuthor

    Follow-up: drag-and-drop never became the primary path — the picker is still what people use. Filed #469 (window-wide drop, folders via DataTransferItem paths, overlay). Backend from this ticket is fine; the composer-only dataTransfer.files handler is the gap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions