nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Feature] Support pasting images into nanocoder

Open will-lamerton opened this issue 5 months ago • 8 comments

Description

Add support for pasting images directly into nanocoder so that screenshots, diagrams, mockups, and error captures can be attached to a message and sent to the model as visual context. Today the input handles text only; users have no way to share an image with the agent.

Use Case

A large share of real coding work is visual: a screenshot of a broken UI, a stack trace captured as an image, a Figma/mockup of a layout to build, a chart to interpret, or a diagram of an architecture. Right now the only option is to describe these in words, which is slow and lossy.

Most modern providers nanocoder already targets (Anthropic, Google, and many OpenAI-compatible vision models) accept image content, so the capability gap is in nanocoder's input and message pipeline rather than in the models themselves. Letting users paste an image (the way they already do in the Claude/ChatGPT desktop apps) would make nanocoder meaningfully more useful for front-end work, debugging, and design-to-code tasks.

Proposed Solution

  • In the chat input, detect when the clipboard contains image data (paste) and/or accept an image file path / drag-and-drop reference.
  • Show a compact attachment indicator in the input (e.g. [image #1]) rather than dumping binary into the prompt, with a way to remove an attachment before sending.
  • On send, attach the image to the user message as an image content part alongside the text.
  • Convert attached images into AI SDK image parts in the message converter so they flow to the provider as multimodal content.
  • Gracefully degrade: if the active model/provider does not support vision, surface a clear message instead of silently dropping the image.

Alternatives Considered

  • File-path-only attachment (no true paste): user types/passes a path and nanocoder reads it from disk. Lower effort and a reasonable first step, but misses the core "paste a screenshot" ergonomic that the request is about.
  • Describe-in-text only (status quo): no code change, but lossy and defeats the purpose.
  • External tool/MCP to read an image file: works for files already on disk but does not solve clipboard paste and adds friction.

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] This feature aligns with the project's goals (local-first AI assistance)

Implementation Notes (optional)

Relevant areas based on the current codebase:

  • Input layer: source/components/user-input.tsx and source/components/text-input.tsx already have paste detection (highlightPastedText, paste-bypass logic around user-input.tsx:421). This is where clipboard image data would need to be intercepted and stored as a pending attachment instead of being treated as text.
  • Message conversion: source/ai-sdk-client/converters/message-converter.ts currently builds text-only content parts. It would need to emit AI SDK image parts when a message carries attachments. The AI SDK supports image content parts on user messages across the Anthropic / Google / OpenAI-compatible providers in source/ai-sdk-client/providers/.
  • ACP path: source/acp/acp-content.ts:47 already receives image/audio blocks but currently emits [Attached image omitted: nanocoder cannot process image content over ACP yet]. This is the natural place to wire real image handling for the ACP surface, and a good marker that the rest of the pipeline needs to learn about images too.
  • Capability gating: need a way to know whether the selected model supports vision so we can warn (or fall back) when it does not.
  • Terminal constraints: clipboard image access in a TTY is non-trivial. Worth scoping which terminals/paste mechanisms are supported (macOS pbpaste/AppleScript for raw image data, iTerm2/Kitty image protocols, or an explicit file-path fallback) as part of the design.

will-lamerton avatar Jun 07 '26 12:06 will-lamerton

Can we also add the features of user inputing descriptions under a specific photo to enhance understanding of the AI to the photo? This does not appeared in any ai agents I have used before which is quite annoying

jason1015-coder avatar Jun 08 '26 06:06 jason1015-coder

Hi @will-lamerton,

Could you please assign this issue to me? It looks very interesting, and I'd love to work on it and have a PR ready by the weekend.

Thanks!

ragini-pandey avatar Jun 10 '26 14:06 ragini-pandey

Hi @will-lamerton,

Could you please assign this issue to me? It looks very interesting, and I'd love to work on it and have a PR ready by the weekend.

Thanks!

Hey @ragini-pandey - done! Let me know if you need anything :D

will-lamerton avatar Jun 10 '26 14:06 will-lamerton

@will-lamerton if no one is doing this can i go ahead on fixing this issue if u assign this ?

Dhirenderchoudhary avatar Jun 11 '26 14:06 Dhirenderchoudhary

Hey @Dhirenderchoudhary - thanks for the offer but @ragini-pandey is assigned and working on this! Feel free to send her a message and see if she needs any assistance though!

will-lamerton avatar Jun 11 '26 15:06 will-lamerton

@ragini-pandey If you are not working on this let me know i can fix it and push PR

Dhirenderchoudhary avatar Jun 15 '26 05:06 Dhirenderchoudhary

Hey @Dhirenderchoudhary - there is an open PR for this from @ragini-pandey - thanks again for being so up to help!

will-lamerton avatar Jun 16 '26 14:06 will-lamerton

@will-lamerton Okayy no problem If there is any other issue or feature let me know i am completely in to help and fix. RN actively understanding the codebase and checking for if there is a bug or not.

Dhirenderchoudhary avatar Jun 16 '26 15:06 Dhirenderchoudhary