Skip to content

Generalized attachment system: pluggable Sources, per-alias capabilities, end-to-end MIME coverage #2595

@simonferquel-clanker

Description

@simonferquel-clanker

Problem

Today pkg/chat.MessagePartTypeFile{Path,...} hard-codes a local FS path; only images flow end-to-end; PDFs work only via Anthropic's bespoke FileManager; audio/video are silently dropped by every non-Anthropic converter. Embedders (pkg/app, pkg/cli) hand-roll resize+base64+data-URL before the runtime sees anything. No storage abstraction, no per-alias capability matrix, no cleanup wiring.

What we're building

A single chat.Document + pluggable attachment.Sources on LocalRuntime + pure attachment.Decide over per-alias capability tables + per-alias AliasProfile (caps, prefs, uploader, image constraints). Newly enables PDFs across all PDF-capable aliases, audio on Gemini/OpenAI, video on Anthropic/Gemini/Vertex AI, clean text inline with size-aware promotion. Tenant isolation by construction via per-request runtime in serve api.

Detailed design

https://gist.github.com/simonferquel-clanker/4848e15f66cc0c271f8c7ac1847263b3

Delivery plan (5 PRs)

  • 1. pkg/attachment + pkg/chat.Document + mandatory WithAttachmentSourceResolver Opt + tests
  • 2. Anthropic refactor; FileManagermemstore.FileIDStore
  • 3. Gemini, Vertex AI, OpenAI Files-API + capability tables + ImageConstraints
  • 4. Bedrock + oaistream aliases (mistral/xai/ollama/nebius/minimax/github-copilot)
  • 5. LocalRuntime registry + TUI/CLI plumbing + per-request runtime in serve api + deprecate MessagePartTypeFile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions