[v0.11.1] Pi Read omits images because Photon WASM is missing from the macOS bundle
Environment
- Craft Agents: 0.11.1 (official macOS release)
- OS: macOS 27.0 (26A5378n), Apple Silicon
- Connection: custom Pi-compatible (
pi_compat) endpoint withsupportsImages: true - Model:
grok-4.5
The failure happens in the Pi Read image-processing path before the image reaches the provider.
Description
In a Pi/pi_compat session, reading a local image that needs resizing always omits the image with a misleading size-limit message. Attaching the same image directly to chat works because that path uses Electron's Sharp-based image handling instead of Pi's Photon path.
Steps to reproduce
- Run the unmodified Craft Agents 0.11.1 macOS app.
- Open a Pi/pi_compat session whose model supports images.
- Use the agent's
Readtool on a local 2816×1584 PNG (555,296 bytes). - Inspect the tool result.
Expected behavior
Read should resize the image and return inline image content to the model.
Actual behavior
Read image file [image/png]
[Image omitted: could not be resized below the inline image size limit.]Root cause found
The v0.11.1 lockfile pulls @earendil-works/[email protected], which depends on @silvia-odwyer/[email protected].
In the packaged resources/pi-agent-server/index.js, Photon contains a build-machine path:
var __dirname = "/Users/runner/work/craft-agents/craft-agents/node_modules/@silvia-odwyer/photon-node";However, photon_rs_bg.wasm is not included in the released app bundle. Photon loading therefore fails; the error is swallowed, resizeImage returns null, and processImage emits the generic size-limit message above.
Local workaround tested
We verified the diagnosis with this local hotfix:
- Extract
photon_rs_bg.wasmfrom@silvia-odwyer/[email protected]and place it next toresources/pi-agent-server/index.js. - Point the bundled Photon
__dirnameto that runtime directory. - Run resizing in-process (
resizeImageInProcess) to avoid packaged worker asset-resolution problems. - Fully restart the Pi worker / app.
After starting a new Pi process, the real Read tool succeeded:
Read image file [image/png]
[Image: original 2816x1584, displayed at 2000x1125. Multiply coordinates by 1.41 to map to original image.]This is only a diagnostic workaround because modifying the app bundle invalidates its original code signature.
Suggested upstream fix
- Include Photon WASM as a release asset for
pi-agent-serverand resolve it from a runtime-relative URL/path rather than a baked CI__dirname. - Ensure both Bun worker and in-process resize paths can resolve the packaged WASM.
- Add a packaged-release smoke test that uses the real
Readtool on an image larger than 2000 px. - Log the underlying Photon load error instead of reporting every loader failure as an inline-size-limit error.
Source: craft-ai-agents/craft-agents-oss