@blackbelt-technology/pi-image-fit-extension 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -5
- package/src/AGENTS.md +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackbelt-technology/pi-image-fit-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Pi extension that resizes oversize images at Read-time so they fit model byte and pixel ceilings.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -26,14 +26,16 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"src/",
|
|
28
28
|
"!src/__tests__",
|
|
29
|
-
"README.md"
|
|
29
|
+
"README.md",
|
|
30
|
+
"!**/AGENTS.md",
|
|
31
|
+
"!**/*.AGENTS.md"
|
|
30
32
|
],
|
|
31
33
|
"dependencies": {
|
|
32
34
|
"jimp": "^1.6.1"
|
|
33
35
|
},
|
|
34
36
|
"peerDependencies": {
|
|
35
|
-
"@earendil-works/pi-coding-agent": "
|
|
36
|
-
"@mariozechner/pi-coding-agent": "
|
|
37
|
+
"@earendil-works/pi-coding-agent": ">=0.80.10",
|
|
38
|
+
"@mariozechner/pi-coding-agent": ">=0.73.1"
|
|
37
39
|
},
|
|
38
40
|
"peerDependenciesMeta": {
|
|
39
41
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -44,6 +46,6 @@
|
|
|
44
46
|
}
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
|
-
"@earendil-works/pi-coding-agent": "
|
|
49
|
+
"@earendil-works/pi-coding-agent": ">=0.80.10"
|
|
48
50
|
}
|
|
49
51
|
}
|
package/src/AGENTS.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# DOX — packages/image-fit-extension/src
|
|
2
|
-
|
|
3
|
-
Files in this directory. One row per source file.
|
|
4
|
-
|
|
5
|
-
| File | Purpose |
|
|
6
|
-
|------|---------|
|
|
7
|
-
| `cache.ts` | SHA-256 temp-file cache under `os.tmpdir()/pi-image-fit/<session>/`. Exports `ROOT_DIR`, `cacheKey({absPath,mtimeMs,maxEdge,maxBytes,quality})`, `scopeFor(sessionScope)` (sanitizes `[^A-Za-z0-9_-]` → `_`, collapses runs, trims, falls back to `default`), `ensureDir`, `hasCached`, `cleanupSession`, `cleanupOrphans` (24 h sweep, injectable clock). Also exports the context-seam in-memory content cache: `ContentCache` (bounded LRU, `keyFor(base64,mimeType,{maxEdge,maxBytes,quality})` SHA-256, `get`/`set`/`has`, byte-budget eviction, `bytes`/`size` observability) + `DEFAULT_CONTENT_CACHE_BUDGET` (64 MiB); never touches disk. See change: image-fit-tool-result-images. |
|
|
8
|
-
| `extension.ts` | Pi extension entry. Seam 1 `pi.on("tool_call")` gated on `toolName === "read"` + `isImagePath(input.path)`; try/catch fall-through, `session_shutdown` → `cleanupSession`, `cleanupOrphans()` once on load, one telemetry `console.log` per resize. Seam 2 `pi.on("context")` (guarded by `!config.disabled`) → `fitContextMessages(messages, config, ContentCache)` (exported): role-agnostic block walk, `Array.isArray(content)` guard, cheap header-probe gate → hash → cache → `resizeBuffer` on miss, mutates block `data`/`mimeType` in place, returns `{messages}` only on change else `undefined`; per-block try/catch fail-open (one WARN per bad block). `PI_IMAGE_FIT_DISABLE=1` skips BOTH seams. See change: image-fit-tool-result-images. |
|
|
9
|
-
| `policy.ts` | Exports `readConfigFromEnv(): { disabled, maxEdge, maxBytes, quality }`. Env vars `PI_IMAGE_FIT_DISABLE` / `PI_IMAGE_FIT_MAX_EDGE` / `PI_IMAGE_FIT_MAX_BYTES` / `PI_IMAGE_FIT_QUALITY`. Defaults 1568 / 4194304 / 85. Invalid values fall back to default + emit one `[pi-image-fit] WARN ` line naming the variable. See change: pi-image-fit-extension. |
|
|
10
|
-
| `resize.ts` | File-path helpers: `needsResize({bytes,maxBytes,dims,maxEdge})` predicate (long edge OR bytes), `outputFormatFor(srcPath)` (PNG-in → PNG-out, else JPEG), `isImagePath` regex `.png/.jpe?g/.webp/.gif`, `probeDims` (jimp lazy load), `resizeToFile` (long-edge `scaleToFit({w:maxEdge,h:maxEdge})`, `getBuffer(JimpMime.png|jpeg,{quality})`). Buffer helpers (context seam): `estimateBytesFromBase64` (no decode), `probeDimsFromHeader(buf)` (PNG IHDR / JPEG SOF / WEBP VP8X·VP8·VP8L / GIF logical-screen, null on unparseable), `probeDimsFromBuffer(buf)` (jimp fallback), `outputFormatForMime(mime)` (`image/png`→png else jpeg), `resizeBuffer(buf,opts,"png"|"jpeg")` → `{data:Buffer,dims}` (no temp file). jimp only, no native deps. See change: image-fit-tool-result-images. |
|