anomalyco / anomalyco/opencode
Native tool content results are downgraded to JSON
@rekram1-node is already working on this.
Since Sep 2, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
LLMNative.request can receive a tool result whose output has type: "content". In packages/opencode/src/session/llm/native-request.ts, that result is currently downgraded to json. AI SDK media items inside the content also use { type: "media", mediaType, data }, while the native runtime expects file content with { type: "file", uri, mime }.
As a result, native tool calls that return text/media content lose the content result type and can produce a payload the native runtime cannot consume.
Steps to reproduce
- Pass a tool result with
output.type === "content"containing a media item through the native request path. - Inspect the tool result sent to the native runtime.
- The result is represented as JSON instead of content and the media item is not canonicalized to native file content.
Expected behavior
Preserve resultType: "content" and convert media items to native file content, using a data URI for inline media data.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.