Description
When using the --file flag in local mode, all files are hardcoded as text/plain regardless of their actual type. Image files (PNG, JPEG, etc.) are passed to the LLM as garbled UTF-8 text instead of base64-encoded images.
Root cause: run.ts line 385 hardcodes mime to "text/plain" for all non-directory files when not in --attach mode. FSUtil.mimeType is already called on line 380 but the result is discarded. Downstream in session/prompt.ts, part.mime is trusted as-is with no re-detection, so text/plain routes images through the Read-tool text path instead of the base64 data: URL path.
Plugins
None
OpenCode version
dev branch
Steps to reproduce
- Run: opencode -f image.png "describe this image"
- The LLM receives garbled binary text instead of a base64-encoded image
Operating System
All
Terminal
All
Description
When using the --file flag in local mode, all files are hardcoded as text/plain regardless of their actual type. Image files (PNG, JPEG, etc.) are passed to the LLM as garbled UTF-8 text instead of base64-encoded images.
Root cause: run.ts line 385 hardcodes mime to "text/plain" for all non-directory files when not in --attach mode. FSUtil.mimeType is already called on line 380 but the result is discarded. Downstream in session/prompt.ts, part.mime is trusted as-is with no re-detection, so text/plain routes images through the Read-tool text path instead of the base64 data: URL path.
Plugins
None
OpenCode version
dev branch
Steps to reproduce
Operating System
All
Terminal
All