feat(tui): image rendering — ImageRenderer trait and Kitty backend #55
No reviewers
Labels
No labels
area:agents
area:ai
area:config
area:dashboard
area:design
area:design-review
area:devtools
area:entities
area:gallery
area:generate
area:image
area:infra
area:meta
area:model-browser
area:navigation
area:presets
area:security
area:sessions
area:settings
area:sharing
area:test
area:ux
area:webhook
area:workdir
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/loom!55
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "tui/kitty-12"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Eighth PR in the loom-tui stack. First of four image-rendering backends called for by spec §2.2.
Stacks on #54. Closes charles/loom#12.
What's in
image::ImageRenderertrait (render,delete,protocol_name)image::ImageSource::{Path, Bytes}withcache_key(width, height)hashing path or a bounded byte sampleimage::RenderHandle(u32)opaqueimage::kitty::KittyRenderer:a=Tchunked base64 transmission atCHUNK_SIZE = 4096,f=100(PNG),U=1virtual placement,c/rfor cellsa=pre-placement when the(source, w, h)hash is already in the cachea=d,d=i,i=<id>deleteu32id allocator that wraps at MAX back to 1 soid == 0is never emittedTests (7 new, 51 total)
ImageSource::cache_keyis stable across equal sources and differs on size / byteschunk_payloadsplits exactly atCHUNK_SIZEand aboveu32::MAXNotes
imagecrate lands in #14 alongsideHalfBlockRendererimage::mod.rsis#![allow(dead_code)]at module level because the trait/source surface is consumed by gallery / generate preview in later screen ticketsAdds the first of four image backends called for by spec §2.2: - image::ImageRenderer trait with render/delete/protocol_name - ImageSource (Path or Bytes) with a stable cache_key(width, height) - image::RenderHandle opaque id - image::kitty::KittyRenderer implementing the trait: - Transmits PNG via APC with f=100, chunked base64 (m=1/m=0) - Uses a=T on first transmission and a=p for cache hits - U=1 virtual placement so images ride reflow - Per-session cache keyed by (source, width_cells, height_cells) with incrementing u32 ids wrapping at MAX back to 1 - Emits a=d,d=i on delete to clear a specific id - Chunk splitter helper with tests covering the 4096-byte boundary Tests cover the pure logic (chunk splitter, cache-key stability, id allocator wrap-around). Escape sequences to stdout aren't unit- testable without a fake tty; they're exercised manually. Closes charles/loom#12 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>