Skip to content

feat(app): fall back to text part for non-multimodal attachments#1903

Open
yashranaway wants to merge 1 commit into
different-ai:devfrom
yashranaway:fix/non-multimodal-attachment-fallback
Open

feat(app): fall back to text part for non-multimodal attachments#1903
yashranaway wants to merge 1 commit into
different-ai:devfrom
yashranaway:fix/non-multimodal-attachment-fallback

Conversation

@yashranaway
Copy link
Copy Markdown
Contributor

Refs #1777

Summary

  • Branch composer attachments by MIME instead of unconditionally encoding every file as a base64 type: "file" data URL. Images and PDFs keep the existing multimodal path. Text-like files (text/* plus a small allowlist of application/{json,xml,yaml,csv,javascript,typescript,sql,x-sh,x-yaml}) are emitted as type: "text" parts with the content inlined between [attached file: name] / [end of name] markers so the agent can reason about them without provider-side rejection.
  • Cap inline text at 256 KB and emit a clear "too large to inline, save it to the workspace" notice above that size so very large CSVs do not balloon the prompt.
  • For binary attachments outside the multimodal set (xlsx, zip, etc.), emit a placeholder text part naming the file and asking the agent to read it from the workspace via Read/Bash, instead of silently sending a payload the provider will drop.
  • Slash commands still accept file parts only (SDK constraint), so the new text-fallback parts are filtered out of buildCommandFileParts rather than passed through as an invalid shape.

Verification

  • pnpm --filter @openwork/app typecheck reports the same pre-existing origin/dev errors as before (missing @heroicons/react/24/solid, xlsx, marked-emoji, marked-shiki, emojilib, @shikijs/transformers, shiki type decls); no new errors land in actions-store.ts.
  • node scripts/i18n-audit.mjs --ci passes — no i18n surface changed.

Notes

  • The reporter on Feature request: native path-injection convention for non-multimodal attachments in the web composer #1777 raised the broader design question of writing attachments to a real workspace path so MCP/Bash can reach them via tools. That is the right long-term shape but needs the Electron bridge plumbing and per-platform tempdir lifecycle. This PR is the narrower fix that unblocks "agent reasons about a CSV/JSON/code attachment" today without provider-side drops, and leaves the path-on-disk story for a follow-up that pairs with the desktop write surface.
  • The MIME allowlist is intentionally small; happy to grow it once we see common attachment types in user reports.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 May 22, 2026 4:22pm

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 22, 2026

@yashranaway is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

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