[v0.11.1] Pi Read omits images because Photon WASM is missing from the macOS bundle

Author: okooo5kmCreated Jul 18, 2026Updated Sep 14, 2026

Environment

  • Craft Agents: 0.11.1 (official macOS release)
  • OS: macOS 27.0 (26A5378n), Apple Silicon
  • Connection: custom Pi-compatible (pi_compat) endpoint with supportsImages: 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

  1. Run the unmodified Craft Agents 0.11.1 macOS app.
  2. Open a Pi/pi_compat session whose model supports images.
  3. Use the agent's Read tool on a local 2816×1584 PNG (555,296 bytes).
  4. 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:

javascript
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:

  1. Extract photon_rs_bg.wasm from @silvia-odwyer/[email protected] and place it next to resources/pi-agent-server/index.js.
  2. Point the bundled Photon __dirname to that runtime directory.
  3. Run resizing in-process (resizeImageInProcess) to avoid packaged worker asset-resolution problems.
  4. 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-server and 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 Read tool 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