feat: deliver editorial images from content callbacks

Merged
SI
1mo ago
+356-35

Completed content runs already produce an editorial image, but the callback schema strips imageUrl and the poster delivers only videos. Retain optional imageUrl and post editorial images before videos, with a URL fallback if download fails or the reported MIME is unsupported. This is a bounded successor to #438.

Use the returned PNG/JPEG/WebP/GIF MIME instead of mislabeling every image PNG. Share the existing download path and retain video Buffer/null behavior; add an image-specific filename fallback. Preserve completed-video selection, auth, thread-state retry skip, captions, video labels and failed-run counts. No image-only job, new generation step, SDK upgrade, billing change or automatic caller. MIME is reported metadata, not byte verification; existing outbound callback trust and buffering limits remain.

The existing Tasks poll mapper also drops the already-produced image. Its source companion is required for the normal pipeline; recommend API receiver first. Tasks main auto-deploys Trigger, so that companion's merge is a worker release boundary. No manual deploy or real worker call is performed here. Docs owns callback contract/publication companion; no active fixture edited.

Validation:

  • Tests written first; API regressions failed 10/passed 75 plus a missing helper suite, then 89 tests/11 files passed.
  • 366 focused tests/50 files and full lint/changed-file formatting pass.
  • Local whole-project TypeScript retains 211 baseline diagnostics byte-identically.
  • Actual schema/handler/poster/downloader code uses fake fetch/thread/auth fixture boundaries. Tests cover MIME, order, optional image alignment, fallback, legacy video-only behavior, denied auth, terminal retry and validation envelopes/CORS.
  • No real provider/customer/Slack/admin/database/key/credit operation or credential inspection. No hosted delivery or exactly-once claim. Independent review, fresh CI and preview tracked before merge handoff; coordinator owns merge.

Head f295413dd6704655c84fd0b153bdadd8f542bbd1, tree 2f6093f6da1b42f42c645e296c24f27a3d0d43b7, base 8ec416923fc8139556bdb5ebd97f2b73d4663f94. Original #438 remains untouched.

API companion: https://github.com/recoupable/tasks/pull/162

Refreshed onto actual API #1096 merge 7bb7677a750ff1554c2bb8396ee80c366454f3c1; new head 63b7d5e10748cdde1eb504da9de3ab3e7c4b7809. Identical feature patch by range-diff. Fresh focused tests: 381 passed across 51 files; lint passed; 211 pre-existing TypeScript diagnostics byte-identical. Fresh exact-head CI and Records acceptance pending; earlier full CI totals describe preceding head.