From 38083736a942918fee26737cf452dbc1775a1eb8 Mon Sep 17 00:00:00 2001 From: SomeRandmGuyy <127457986+SomeRandmGuyy@users.noreply.github.com> Date: Wed, 16 Sep 2026 03:45:53 +0000 Subject: [PATCH 1/7] =?UTF-8?q?docs:=20design=20spec=20for=20clips-to-libr?= =?UTF-8?q?ary=20(Crayo=20export=20=E2=86=92=20Supabase=20Storage=20?= =?UTF-8?q?=E2=86=92=20preview/download)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2026-09-16-clips-to-library-design.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 docs/superpowers/specs/2026-09-16-clips-to-library-design.md diff --git a/docs/superpowers/specs/2026-09-16-clips-to-library-design.md b/docs/superpowers/specs/2026-09-16-clips-to-library-design.md new file mode 100644 index 0000000..02cbbfb --- /dev/null +++ b/docs/superpowers/specs/2026-09-16-clips-to-library-design.md @@ -0,0 +1,115 @@ +# Clips to Library: export, store, preview, download + +**Date:** 2026-09-16 +**Status:** approved in chat (brainstorming), pending written review +**Sub-project:** 1 of 3 in the Crayo pipeline rebuild (2: VPS media worker replacing Daytona fetch; 3: verify remaining Crayo commands) + +## Problem + +`/autoclip` never yields a video. When Crayo finishes an AutoClip, both callers +(`runAutoclip` in `src/lib/server/crayo-tools.server.ts` and the background job's +final phase in `src/lib/server/media-fetch-job.server.ts`) ingest only each clip's +`thumbnail_url`. The clips exist as Crayo `project_id`s that are never exported, so the +Library receives JPGs, not mp4s. There is also no way to download finished media: +`/api/library/file` forces `content-disposition: inline` and only caption sidecars have a +Download button. + +## Decisions already made + +- Heavy fetching (YouTube etc.) will move to an always-on worker on the VPS (sub-project 2). + This sub-project does not touch fetching or Daytona. +- Finished clips are stored in Supabase Storage (bucket `clippy-library`, already the default + backend in `src/lib/server/library-storage.server.ts`), shown in the Library with the existing + player, and downloadable from there. No automatic copy to the operator's computer. + +## Architecture and data flow + +1. AutoClip reports done with N clips, each a Crayo `project_id`. +2. For each clip the app starts a Crayo export (`POST /projects/{id}/export`) and polls + `GET /exports/{id}` in bounded steps until it returns an mp4 URL. +3. The mp4 is streamed from Crayo's CDN into the library bucket through a new streaming write + path, so no clip is buffered in a Vercel function's memory. The Library asset row records the + clip title, duration, source URL, run id, segment index, and Crayo project id. The thumbnail is + attached to the same asset (no separate JPG asset). +4. The run's results list the library asset ids; the Agent results panel and Library cards render + the clip with the existing `