fix(cli): spec-compliant terminal image rendering + Windows clipboard… - #974
fix(cli): spec-compliant terminal image rendering + Windows clipboard…#974smarpitm wants to merge 1 commit into
Conversation
|
Good catches on But Before this can be ported: either convert compressed images to PNG before the kitty path (simplest, since 100 is the only guaranteed-compatible non-raw format), or drop the fabricated format ids and stick to 100/24/32 as the spec actually defines, deriving alpha/no-alpha via raw pixel mode if you want to avoid re-encoding. The terminal-detection additions (WezTerm/Ghostty/Warp/Konsole) and the Windows |
What
Fixes terminal inline image rendering so attached photos display correctly in kitty-capable terminals, and hardens Windows clipboard image paste.
Why
Photos attached via
/imageor Ctrl+V could render "distorted":m=0terminator and every chunk repeateda=T/full control data, so terminals treated each chunk as a new image (fragmented display). The format id was also hardcoded tof=100(PNG) even for the JPEG payloads the compression step produces.sizeparam sent the base64 length instead of the decoded byte length (minus padding).powershell.exe(nopwshfallback).Changes
cli/src/utils/terminal-images.ts— spec-compliant kitty chunking (m=0on the last chunk, control data only on the first), format id derived from the real media type, iTerm2size= decoded bytes, detection for WezTerm/Ghostty/Warp/Konsole (case-insensitive).cli/src/utils/clipboard-image.ts—pwshfallback whenpowershell.exeis missing, normalized string output.cli/src/components/blocks/image-block.tsx,image-card.tsx— passmediaTypeto the renderer.terminal-images.test.ts(sequence conformance against the kitty spec),image-pipeline-integrity.test.ts(verifies image processing never corrupts payloads).test/setup-scm-loader.ts— no-op stub sobun testin theclipackage works in the public mirror (referenced bycli/bunfig.tomlbut missing from the public repo).Validation
bun run typecheck(cli) clean.Note
DeepSeek V4 Flash (the default model) is
multimodal: falseand reads images via the server-side describe pipeline — for best results with photos, use MiniMax M3 / GPT-5.6 Luna / MiMo 2.5.