Add support for image content blocks in agent messages#197
Open
Glavin001 wants to merge 2 commits intorivet-dev:mainfrom
Open
Add support for image content blocks in agent messages#197Glavin001 wants to merge 2 commits intorivet-dev:mainfrom
Glavin001 wants to merge 2 commits intorivet-dev:mainfrom
Conversation
…date The translate_session_update function only handled text content blocks from agent_message_chunk/agent_thought_chunk notifications, silently dropping image content. This adds support for ACP ImageContent blocks (type=image, uri, mimeType) by translating them into OpenCode "file" parts with the correct MIME type and file:// URI, matching the pattern used by the opencode_compat layer. Pending text is finalized before emitting the image part, and both are persisted for session replay. https://claude.ai/code/session_01Exgh67PQ5vVF1MxHDSHm4s
Add image support to the inspector UI so that ACP agent_message_chunk notifications with type=image content blocks are displayed inline. - Add `image` kind and field to TimelineEntry type - Parse image content blocks in the App.tsx event-to-timeline mapper, converting file:// URIs to /v1/fs/file API URLs for browser rendering - Flush accumulated text before emitting an image entry - Render <img> tags in ChatMessages for image timeline entries https://claude.ai/code/session_01Exgh67PQ5vVF1MxHDSHm4s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for handling image content blocks in agent messages, allowing the system to process and display images alongside text in the chat interface.
Key Changes
Backend (opencode-adapter):
translate_session_updateto discriminate content blocks by type (text vs. image)Frontend (inspector):
App.tsxto recognize and handle image content in agent message chunksfile://URIs to/v1/fs/fileAPI endpoints for browser-accessible image fetchingTimelineEntrykind typeChatMessages.tsxto render images with proper styling (max-width, border-radius)Implementation Details
type: "image"in the content discriminatorfile://prefix and passed through the sandbox agent's file serving APIhttps://claude.ai/code/session_01Exgh67PQ5vVF1MxHDSHm4s