zot/internal
patriceckhart ef7327ca7d anthropic: downscale oversized images on outbound requests
Anthropic returns 'At least one of the image dimensions exceed max
allowed size for many-image requests' when a request contains more
than one image and any of them is larger than 2000 px on the
longest side. Single-image requests get a more lenient 8000 px
cap. OpenAI has no such limit, so a session that worked fine on
gpt-* breaks the moment /model swaps to a Claude family while the
transcript still holds high-res screenshots.

Add anthShrinkImageBytesIfTooBig that decodes any outbound image
exceeding 2000 px on the longest side, resamples it with Catmull-
Rom from golang.org/x/image/draw, and re-encodes in the same
format. JPEG stays JPEG, PNG stays PNG, GIF gets re-encoded as
PNG (we'd otherwise need to compose a single-frame gif by hand).
Decode/encode failures fall back to the original bytes so the
caller's flow is untouched and Anthropic's own error message
surfaces if the image is genuinely unusable.

Both Anthropic encode sites \u2014 the top-level message converter
and the tool-result inner converter \u2014 run every image through
the helper, so screenshots from earlier turns also get resized
on subsequent requests instead of failing forever once the
transcript captured them at full size.

Adds golang.org/x/image v0.18.0 (compatible with go 1.22).
2026-04-28 12:48:13 +02:00
..
agent interactive: trim trailing blanks after the last conversation row 2026-04-28 09:18:05 +02:00
assets assets: refresh zot logo to cleaner pixel-art Z 2026-04-20 12:01:43 +02:00
auth feat(auth): headless OAuth with paste-code input 2026-04-22 17:49:11 +02:00
core session: persist each turn as it happens, flush on SIGTERM/SIGHUP 2026-04-28 08:01:12 +02:00
extproto feat(ext): interactive extension panels + persistence 2026-04-22 08:53:21 +02:00
provider anthropic: downscale oversized images on outbound requests 2026-04-28 12:48:13 +02:00
skills perf(prompt): cut system prompt to the bone (410 -> 54 tokens) 2026-04-19 17:39:38 +02:00
tui tui: render inline images inside tool boxes 2026-04-28 08:11:58 +02:00