oficina / slides Public

Agents can add pictures through the API closed

On branch feat/agent-images

Agents can now add pictures to a deck: POST /api/v1/decks/{sqid}/assets takes the image bytes with the agent's bearer token, the same access as /ops.

  • PNG, JPEG or WebP, sniffed from the bytes; 20 MiB at most; header-checked and held to a 50-megapixel budget (shared with export as svg.MaxDecodePixels). SVG is refused.
  • Stored content-addressed as the browser path does, with the verification row, then register_asset applied as the agent, so open editors see it. The same bytes twice give the same ref, with no new write.
  • Answers {id, ref, width, height}; props.asset on an image block takes the id.
  • The SVG thumbnail checks the header before decoding a WebP, so a tiny file can't claim a huge picture and make the server allocate ~900 MB.

Reviewed by Astra twice; accepted leftovers: thumbnails of WebPs over 50 MP fall back to a URL (no picture in <img>), and the agent limit is stricter than the browser's. make ci and the gate pass.

Why now: importing Paul's talks into Slides needs pictures, and docs/api.md said "An agent cannot add a picture today."

🤖 Generated with Claude Code

Merged and deployed to edge (picture uploads c2c83d5; scenes and clips d079b1a, migration 0014 applied on start-up, no errors in the logs). Closing.