{"_id":"@blackbelt-technology/pi-image-fit","name":"@blackbelt-technology/pi-image-fit","dist-tags":{"latest":"0.5.4"},"versions":{"0.5.4":{"name":"@blackbelt-technology/pi-image-fit","version":"0.5.4","description":"Pi extension that resizes oversize images at Read-time so they fit model byte and pixel ceilings.","type":"module","repository":{"type":"git","url":"git+https://github.com/BlackBeltTechnology/pi-agent-dashboard.git","directory":"packages/image-fit-extension"},"license":"MIT","publishConfig":{"access":"public"},"keywords":["pi-package","pi-extension","image","resize"],"pi":{"extensions":["src/extension.ts"]},"dependencies":{"jimp":"^1.6.1"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*","@mariozechner/pi-coding-agent":"*"},"peerDependenciesMeta":{"@earendil-works/pi-coding-agent":{"optional":true},"@mariozechner/pi-coding-agent":{"optional":true}},"devDependencies":{"@earendil-works/pi-coding-agent":"*"},"_id":"@blackbelt-technology/pi-image-fit@0.5.4","bugs":{"url":"https://github.com/BlackBeltTechnology/pi-agent-dashboard/issues"},"homepage":"https://github.com/BlackBeltTechnology/pi-agent-dashboard#readme","_nodeVersion":"24.15.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-JS9FedDaAzM5O5UTsBhC+Cot8ymv3A2ehs+yNjzyxTDmJ7gq3/3VC6JaRGSElKPbtcFyJOrZYsLESE9xcfNobA==","shasum":"0fa0817b27c767085fac6d1371c1c6a8c96c6871","tarball":"https://registry.npmjs.org/@blackbelt-technology/pi-image-fit/-/pi-image-fit-0.5.4.tgz","fileCount":6,"unpackedSize":22593,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC+W9lGkdHpiKiQQ8Znl+p9o6NQD3TgBPB8sTo9GiPh0QIgFxUfiw4cmHYfO6J+djyOG18o/6/EC5L7Pp1pCyK4oeY="}]},"_npmUser":{"name":"robertcsakany","email":"robert.csakany@blackbelt.hu"},"directories":{},"maintainers":[{"name":"mbotond","email":"botond.molnar@blackbelt.hu"},{"name":"mrbence","email":"dbence10@gmail.com"},{"name":"robertcsakany","email":"robert.csakany@blackbelt.hu"},{"name":"norbert.herczeg","email":"norbert.herczeg@blackbelt.hu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-image-fit_0.5.4_1781305748493_0.5159601765906745"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-12T23:09:08.359Z","0.5.4":"2026-06-12T23:09:08.685Z","modified":"2026-06-12T23:09:08.916Z"},"maintainers":[{"name":"mbotond","email":"botond.molnar@blackbelt.hu"},{"name":"mrbence","email":"dbence10@gmail.com"},{"name":"robertcsakany","email":"robert.csakany@blackbelt.hu"},{"name":"norbert.herczeg","email":"norbert.herczeg@blackbelt.hu"}],"description":"Pi extension that resizes oversize images at Read-time so they fit model byte and pixel ceilings.","homepage":"https://github.com/BlackBeltTechnology/pi-agent-dashboard#readme","keywords":["pi-package","pi-extension","image","resize"],"repository":{"type":"git","url":"git+https://github.com/BlackBeltTechnology/pi-agent-dashboard.git","directory":"packages/image-fit-extension"},"bugs":{"url":"https://github.com/BlackBeltTechnology/pi-agent-dashboard/issues"},"license":"MIT","readme":"# @blackbelt-technology/pi-image-fit\n\nPi extension that resizes oversize images at Read-time so they fit model\nbyte and pixel ceilings.\n\nThe extension hooks `pi.on(\"tool_call\", ...)`. When the agent runs the\nbuilt-in `read` tool with an image path (`.png`, `.jpg`, `.jpeg`, `.webp`,\n`.gif`), the extension:\n\n1. Stats the file and (lazily) probes dimensions via [jimp](https://github.com/jimp-dev/jimp).\n2. If the image already fits both thresholds, leaves `event.input.path`\n   untouched — built-in Read sees the original bytes, no temp file, no\n   telemetry.\n3. Otherwise, re-encodes the image (long-edge scaled, aspect-ratio\n   preserved) into a session-scoped temp file under\n   `os.tmpdir()/pi-image-fit/<session>/<sha256>.<ext>` and mutates\n   `event.input.path` to point at it. Built-in Read attaches the smaller\n   image to the agent's context window.\n\nNo native binary deps — `jimp` only. No `electron-rebuild` step, no\nplatform-specific prebuilt downloads. Pure JS install on every supported\npi target.\n\n## Install\n\n```bash\npi install @blackbelt-technology/pi-image-fit\n```\n\nThe next pi session loads the extension. No dashboard or other workspace\npackage required.\n\n## Default thresholds\n\n| Setting | Default | Env var |\n| --- | --- | --- |\n| Long-edge pixels | 1568 | `PI_IMAGE_FIT_MAX_EDGE` |\n| Byte size | 4,194,304 (4 MiB) | `PI_IMAGE_FIT_MAX_BYTES` |\n| JPEG quality | 85 | `PI_IMAGE_FIT_QUALITY` |\n| Kill switch | off | `PI_IMAGE_FIT_DISABLE` |\n\nResize triggers when **either** the byte size **or** the long edge\nexceeds its threshold. When both are at or below their thresholds, the\nextension is a no-op.\n\n## Environment variables\n\n- `PI_IMAGE_FIT_DISABLE` — truthy (`1`, `true`, `yes`, case-insensitive)\n  skips the `pi.on(\"tool_call\", ...)` registration entirely; the\n  extension logs a single disabled-message line on load and does nothing\n  else.\n- `PI_IMAGE_FIT_MAX_EDGE=<px>` — positive integer; override the\n  long-edge threshold.\n- `PI_IMAGE_FIT_MAX_BYTES=<bytes>` — positive integer; override the byte\n  threshold.\n- `PI_IMAGE_FIT_QUALITY=<1-100>` — JPEG output quality. Ignored for\n  PNG-in → PNG-out path (always lossless).\n\nInvalid values fall back to the documented default and log a single\nwarning line naming the variable.\n\n## Output format\n\nFormat-adaptive:\n\n- `.png` source → PNG output (lossless re-encode preserves transparency).\n- everything else → JPEG at the configured quality.\n\nCache file extension matches the chosen output format.\n\n## Telemetry\n\nOn a successful resize the extension emits exactly one line:\n\n```\n[pi-image-fit] <path> <srcW>×<srcH> <srcBytes>B → <dstW>×<dstH> <dstBytes>B\n```\n\nNo log on already-small pass-throughs, on non-image reads, or on\nnon-`read` tool calls. Failures log a single `[pi-image-fit] WARN ...`\nline and fall through to the original path (the agent's Read behaves\nexactly as if the extension were not installed).\n\n## Caveat: silent quality loss\n\nA 4K screenshot squashed to 1568 px may lose fine text. The agent has no\nway to tell that resize fired beyond the console log line. If pixel\nperfect Read matters for a workflow, set `PI_IMAGE_FIT_DISABLE=1` in\nthat environment.\n\n## License\n\nMIT. Part of the [pi-agent-dashboard](https://github.com/BlackBeltTechnology/pi-agent-dashboard)\nmonorepo; versions move in lockstep with the rest of the workspace.\n","readmeFilename":"README.md","_rev":"1-a4ce674d4365a5357b80e01c235d3a2c"}