@oh-my-pi/pi-coding-agent 4.7.0 → 4.8.1
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/CHANGELOG.md +12 -0
- package/package.json +8 -6
- package/src/utils/image-convert.ts +3 -1
- package/src/utils/image-resize.ts +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [4.8.1] - 2026-01-12
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Prevent bun from statically resolving sharp import to fix runtime errors on arm64
|
|
10
|
+
|
|
11
|
+
## [4.8.0] - 2026-01-12
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Move `sharp` to optional dependencies with all platform binaries to fix arm64 runtime errors
|
|
16
|
+
|
|
5
17
|
## [4.7.0] - 2026-01-12
|
|
6
18
|
### Added
|
|
7
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-coding-agent",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.1",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"ompConfig": {
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"prepublishOnly": "bun run generate-template && bun run clean && bun run build"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@oh-my-pi/pi-ai": "4.
|
|
43
|
-
"@oh-my-pi/pi-agent-core": "4.
|
|
44
|
-
"@oh-my-pi/pi-git-tool": "4.
|
|
45
|
-
"@oh-my-pi/pi-tui": "4.
|
|
42
|
+
"@oh-my-pi/pi-ai": "4.8.1",
|
|
43
|
+
"@oh-my-pi/pi-agent-core": "4.8.1",
|
|
44
|
+
"@oh-my-pi/pi-git-tool": "4.8.1",
|
|
45
|
+
"@oh-my-pi/pi-tui": "4.8.1",
|
|
46
46
|
"@openai/agents": "^0.3.7",
|
|
47
47
|
"@sinclair/typebox": "^0.34.46",
|
|
48
48
|
"ajv": "^8.17.1",
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"nanoid": "^5.1.6",
|
|
59
59
|
"ndjson": "^2.0.0",
|
|
60
60
|
"node-html-parser": "^6.1.13",
|
|
61
|
-
"sharp": "^0.34.2",
|
|
62
61
|
"smol-toml": "^1.6.0",
|
|
63
62
|
"strip-ansi": "^7.1.2",
|
|
64
63
|
"winston": "^3.17.0",
|
|
@@ -72,6 +71,9 @@
|
|
|
72
71
|
"@types/node": "^24.3.0",
|
|
73
72
|
"ms": "^2.1.3"
|
|
74
73
|
},
|
|
74
|
+
"optionalDependencies": {
|
|
75
|
+
"sharp": "^0.34.2"
|
|
76
|
+
},
|
|
75
77
|
"keywords": [
|
|
76
78
|
"coding-agent",
|
|
77
79
|
"ai",
|
|
@@ -16,7 +16,9 @@ export async function convertToPng(
|
|
|
16
16
|
|
|
17
17
|
// Try sharp first
|
|
18
18
|
try {
|
|
19
|
-
|
|
19
|
+
// Use variable to prevent bun from statically analyzing the import
|
|
20
|
+
const sharpModule = "sharp";
|
|
21
|
+
const sharp = (await import(/* @vite-ignore */ sharpModule)).default;
|
|
20
22
|
const buffer = Buffer.from(base64Data, "base64");
|
|
21
23
|
const pngBuffer = await sharp(buffer).png().toBuffer();
|
|
22
24
|
return {
|
|
@@ -99,9 +99,12 @@ export async function resizeImage(img: ImageContent, options?: ImageResizeOption
|
|
|
99
99
|
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
100
100
|
const buffer = Buffer.from(img.data, "base64");
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
|
+
let sharp: any;
|
|
103
104
|
try {
|
|
104
|
-
|
|
105
|
+
// Use variable to prevent bun from statically analyzing the import
|
|
106
|
+
const sharpModule = "sharp";
|
|
107
|
+
sharp = (await import(/* @vite-ignore */ sharpModule)).default;
|
|
105
108
|
} catch {
|
|
106
109
|
// Sharp not available - try ImageMagick fallback
|
|
107
110
|
return resizeImageWithImageMagick(img, opts);
|
|
@@ -147,13 +150,11 @@ export async function resizeImage(img: ImageContent, options?: ImageResizeOption
|
|
|
147
150
|
height: number,
|
|
148
151
|
jpegQuality: number,
|
|
149
152
|
): Promise<{ buffer: Buffer; mimeType: string }> {
|
|
150
|
-
const resized = await sharp
|
|
151
|
-
.resize(width, height, { fit: "inside", withoutEnlargement: true })
|
|
152
|
-
.toBuffer();
|
|
153
|
+
const resized = await sharp(buffer).resize(width, height, { fit: "inside", withoutEnlargement: true }).toBuffer();
|
|
153
154
|
|
|
154
155
|
const [pngBuffer, jpegBuffer] = await Promise.all([
|
|
155
|
-
sharp
|
|
156
|
-
sharp
|
|
156
|
+
sharp(resized).png({ compressionLevel: 9 }).toBuffer(),
|
|
157
|
+
sharp(resized).jpeg({ quality: jpegQuality }).toBuffer(),
|
|
157
158
|
]);
|
|
158
159
|
|
|
159
160
|
return pickSmaller({ buffer: pngBuffer, mimeType: "image/png" }, { buffer: jpegBuffer, mimeType: "image/jpeg" });
|