carry attached images through to the model

The composer already uploaded an image, split its data URL and put the bytes on the wire as
`images`. Nothing on the server read them. The `chat` ClientMessage had no such field, and the
prompt reached the sidecar as a bare string, so all the model ever saw was the client-generated
`[Attached image: …]` placeholder — a label describing a picture it was never shown.

The transport was never the obstacle: `query()` consumes an async iterable of user messages whose
`content` is an Anthropic `MessageParam`, and only `pushTurn` hardcoding a string kept it to text.
So `images` is threaded through the four hops that dropped it and turned into native image content
blocks at the end, renaming `mediaType` to the API's `media_type` at that last step.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-07 02:54:39 +00:00
co-authored by Claude Opus 5
parent 5134501a2f
commit 6d0d103c78
5 changed files with 46 additions and 9 deletions
+2 -1
View File
@@ -1,5 +1,5 @@
import { logger } from '@@/api/chat/logger';
import type { MessageCost, TurnMessage } from '@@/api/chat/types';
import type { MessageCost, PromptImage, TurnMessage } from '@@/api/chat/types';
import * as sidecar from '@@/sidecar-registry';
type ClaudeCodeParams = {
@@ -34,6 +34,7 @@ type ClaudeCodeStreamingParams = {
email: string;
username: string;
prompt: string;
images?: PromptImage[];
sessionKey: string;
cwd?: string;
model?: string;