Files
plugins/packages/kiro/package.json
T
yetone ceda580080 kiro 0.1.18: an image over Kiro's 5 MiB Base64 limit is shrunk on the request, or replaced by a note (#428)
imwaco (#428): in Codex -> magpie -> Kiro, view_image returned a PNG of
4,171,428 bytes, 5,561,904 as Base64, and Kiro answered
  messages.130.content.2.image.source.base64: image exceeds 5 MB maximum:
  5561904 bytes > 5242880 bytes (IMAGE_SIZE_EXCEEDED)
on that turn and on every later one, text-only ones too, as the image
stays in history. The limit is on the Base64 string: 5561904 is that
image's Base64 length, not its file size, so the largest file that fits is
3,932,160 bytes. kiro-cli's own gate is 10 MB of raw file
(MAX_IMAGE_SIZE, aws/amazon-q-developer-cli chat/consts.rs), the gap
kirodotdev/Kiro#11497 describes.

buildKiro's conversation is now built as an object (kiroRequest) and,
after the latest-image selection, kiroBody fits every image left in it,
user images and tool images in history alike, on the plugin's own copy:
- an image at or under 5,242,880 Base64 characters is sent byte for byte;
- one over it is decoded with Bun.Image (Bun 1.4's built-in libspng /
  libjpeg-turbo / libwebp, no new dependency; magpie's host and OpenCode
  2.0.25 both run Bun 1.4.2) and tried, in order: its own kind with the
  long edge at most 2000 px, then WebP (keeps alpha) or JPEG for a JPEG,
  q80, then 0.7x smaller at q75 down to 256 px, until it fits;
- bounds: 50M pixels (a header claiming more is refused before decoding),
  64 MB of Base64 looked at, 30 s per image; one image is worked once per
  sha256 (in-flight shared, 4 kept);
- one that can't be read, has too many pixels, can't be brought under, or
  a host without Bun.Image: the image is left out and a one-line note
  takes its place in that message's text, so the turn still goes.
History, entry count, tool pairing and image order are unchanged.

Run:
- HOME=$(mktemp -d) bun test packages/kiro: 67 pass (image-size.test.mjs
  new, 10 tests); the same under OpenCode 2.0.25's Bun (BUN_BE_BUN=1
  opencode test packages/kiro): 67 pass. bun scripts/check.mjs kiro: ok.
- Fixtures are built in the test: a 1389x1000 noise PNG padded to exactly
  4,171,428 bytes (5,561,904 Base64), PNGs at 3,932,159 / 3,932,160 /
  3,932,161 bytes (Base64 5,242,880 with "=", 5,242,880, 5,242,884), a
  20000x20000 header bomb and 4 MB of junk.
- Full HOME=$(mktemp -d) bun test at 18268848: 2851 pass, 1 fail:
  layerfs "item 3: an import over the file limit" timed out at its 30 s
  bar (46 s) writing 20,001 files at load ~40; it fails alone too at this
  load, and the kiro change doesn't reach layerfs.
Broken by hand: kiroBody without fitImages: 7 of 10 fail; no cache: the
once-per-image test fails; `<` for `<=` at the limit: the boundary test
fails.
Not tried: a real Kiro account (none in a sandbox; no live sign-in read);
an animated GIF over the limit (Bun decodes its first frame only).
2026-10-27 17:27:57 +08:00

13 lines
487 B
JSON

{
"name": "@magpie-community/opencode-kiro-auth",
"version": "0.1.18",
"description": "Kiro subscriptions (Free, Pro, Pro+, Power) in OpenCode and magpie",
"type": "module",
"main": "./index.mjs",
"exports": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "magpie", "kiro"],
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/kiro" }
}