Repository navigation
feat(cli): images on any turn and ACP image blocks (#559) - #563
Merged
Merged
Conversation
Chat queues images for any later message with /image, the TUI host keeps a pending-image queue taken by the next turn, and ACP maps image content blocks onto the spill-and-reference path, advertises promptCapabilities.image and runs image-only prompts. An image-only user message sends no empty text part. No model-callable image tool, by decision; threat model and README updated.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Nov 11, 2026
3 tasks
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.
What
Images can now ride on any user message, not only the first one:
tole chathas/image <path|data-url>. It queues an image for the next message./imageon its own lists the queue and/image clearempties it.TuiSession) has a pending-image queue that the nextrun_turntakes. feat(tui): handle terminal paste and attach images (paste, path, optional clipboard) #560 will drive it from tole-tui.tole acpaccepts ACPimagecontent blocks and advertisespromptCapabilities.image. An image-only prompt now runs instead of failing with "missing prompt".Closes #559
Why
The core (
run_turn_with_images) already takes images per turn, so the first-message-only limit was in the hosts. In a long chat or the TUI you could not show the model a screenshot halfway through. ACP dropped image blocks and rejected an image-only prompt, so a pasted image from an editor got nothing.Image-tool decision (owner): no model-callable image tool for now. Images stay user-supplied. Tool results are text in the OpenAI-compatible format, so a tool would need an attributed-message mechanism plus its own threat-model entry. The decision is recorded on #559 and in
docs/threat-model.md. It will be revisited in a follow-up issue if a concrete need comes up.Changes
tole-core/src/openai.rsis that an image-only user message no longer sends an emptytextpart.turn_runner(additive):run_turn_on_with_imagesandrun_turn_with_images. The existingrun_turn_onandrun_turn_withdelegate to them with&[].resolve_image(spec): one spec, same jail, size cap and sniffing as--image.resolve_inline_image(base64): the same spill path as a CLIdata:URL. It refuses an oversize payload before decoding it.inline_images_supported()session_host(additive):run_session_turn_with_images;run_session_turndelegates to it. Memory recall is skipped when the prompt has no text.acp.rs):prompt_content()turnstextblocks into the prompt text andimageblocks into images throughresolve_inline_image.mimeTypeis not trusted: the bytes are sniffed.uriis never read, so no client-named path reaches the filesystem.initializenow advertisespromptCapabilities: {image: <spill dir exists>, audio: false, embeddedContext: false}. Per the ACP spec, image blocks require theimageprompt capability. A code comment quotes the spec, checked 2026-11-11.chat(main.rs):/imageline command.--imagehelp mention/image.tui_host.rs:Inner.pending_images.attach_image(spec) -> Result<ImageRef, String>,attach_image_ref,pending_images,clear_pending_images.run_turntakes the queue. If the message never reached the log (a parked turn that did not settle, or a provider build error), the images go back to the front of the queue.docs/threat-model.md: new "Image input (multimodal input: images in chat (vision parts on the wire) #212, feat(core,cli): images on any turn, ACP image blocks, and a decision on an image-reading tool #559)" section covering the input paths, jail/cap/sniffing, untrusted image content, ACPmimeType/urihandling and the no-tool decision.docs/epics.mdUI-epic line updated.Testing
cargo fmt --all -- --check: clean.cargo clippy --workspace --all-targets -- -D warnings: clean.cargo check -p tole-cli --no-default-featuresandcargo check -p tole-cli --no-default-features --features shell-tools --tests: clean.cargo test --workspace: 1224 passed, 0 failed.cargo test -p tole-cli --no-default-features --test images_any_turn_e2e: passes. The chat test runs in the bare profile; the ACP test needsshell-tools.turn_runner::each_turn_records_its_own_images: the acceptance test. The second turn's message records its own references and the first records none.turn_runner::an_oversize_inline_image_is_refused_before_decodingtui_host::pending_images_ride_on_the_next_message_only: the queue is taken by one message, and a message that was not recorded keeps its images.acp::tests::prompt_content_*(3 tests): text/image mapping, ignored blocks, image-only accepted, empty prompt refused, bad image refused.openai::an_image_only_user_message_sends_no_empty_text_parttests/images_any_turn_e2e.rs, using the real binary and a recording mock provider:/imageon a later message. A path outside the jail is refused, the second message records the image and only that request carries it on the wire.mimeType, theuriis ignored and the file is spilled under$CODECORA_HOME/tole/images. A text+audio prompt runs with the audio ignored. An audio-only prompt and a non-image block are both refused. No base64 blob ends up in the log.turn_runner::run_turn_with_images:each_turn_records_its_own_imagesand the ACP e2e test fail./image: the chat e2e test fails.tui_hosttest fails.prompt_content_accepts_image_only_and_refuses_emptyfail.cora review --stagedwas not run: cora is not installed in this environment. I reviewed the staged diff by hand instead, focusing on the jail and size cap for ACP-supplied images, type sniffing, the clienturinever being read, and the error paths. CI Cora Review is the gate.acp.rs. Not changed here: the spec's baseline says agents MUST supportresource_linkblocks in prompts. tole ignored them before this PR and still does, so a prompt with only aresource_linkis still refused as "missing prompt".