fix(coding-agent): fix standalone binary WASM loading on Linux, fixes #784

- Import photon-node from ESM entry point (photon_rs_bg.js) instead of CJS
  entry, allowing Bun to embed WASM in compiled binaries
- Add photon.d.ts for TypeScript support of ESM entry
- Add scripts/build-binaries.sh for local binary builds
- Simplify GitHub workflow to use the build script
- Add binaries/ to gitignore
This commit is contained in:
Mario Zechner 2026-01-16 20:56:18 +01:00
parent 0c33e0dee5
commit 5aa0689828
7 changed files with 177 additions and 87 deletions

View file

@ -1,4 +1,6 @@
import photon from "@silvia-odwyer/photon-node";
// Use ESM entry point so Bun can embed the WASM in compiled binaries
// (the CJS entry uses fs.readFileSync which breaks in standalone binaries)
import { PhotonImage } from "@silvia-odwyer/photon-node/photon_rs_bg.js";
/**
* Convert image to PNG format for terminal display.
@ -14,7 +16,7 @@ export async function convertToPng(
}
try {
const image = photon.PhotonImage.new_from_byteslice(new Uint8Array(Buffer.from(base64Data, "base64")));
const image = PhotonImage.new_from_byteslice(new Uint8Array(Buffer.from(base64Data, "base64")));
try {
const pngBuffer = image.get_bytes();
return {