caelum0x d56639a594
Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

526 lines
34 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# `external/` — Vendored OSS Integration Architecture (Vision 2026)
> **Scope.** This document is the *additive* build plan for `external/` only: which
> repos to clone/pin from the OSS adoption list, how each is wrapped behind a
> product-owned **provider adapter** (in `apps/api`) or an **isolated worker/service**
> (here in `external/`), the `REGISTRY.md` governance entry per repo, licensing
> classification, and the update/pinning strategy.
>
> **Non-goals.** This does *not* re-specify what already exists (the eight cloned
> repos and their `REGISTRY.md` entries, the `comfyui-deploy` B-roll adapter, the
> LatentSync RunPod avatar provider, the `apps/api/assets/workflows` manifest
> system). Those are assumed and are the *conventions* this plan extends.
---
## 0. Governing principles (inherited, not re-litigated)
These come straight from the existing `external/REGISTRY.md` and are the hard
constraints every new package below obeys:
1. **`external/` is pinned upstream source, never a dependency.** Product code
(`apps/api`) MUST NOT `import external.*`. Every integration is either an
**HTTP adapter** to a separately deployed service, or a **container image built
from pinned source** that speaks the async job envelope.
2. **Adoption state is explicit.** Every repo carries one of the five states
(`reference` / `candidate` / `adapter-active` / `isolated-runtime` /
`rejected-runtime`). Nothing runs in production until it reaches
`adapter-active` or `isolated-runtime` with a dated decision record.
3. **License class gates commercial dispatch.** The license-first router
(catalog) hard-excludes non-commercial/territorial weights for paying users.
`external/` mirrors that classification at the *source* level so a rejected
weight can never be built into a shippable worker image by default.
4. **Workflow graphs & weights are pinned artifacts, not live checkouts.**
ComfyUI graphs become product-owned manifests under
`apps/api/assets/workflows`; the *node commits* and *weight revisions* they
depend on are pinned here in `external/`.
5. **Isolation boundary is a container.** Every GPU capability is a worker image
with its own `requirements.lock`, model manifest, input/output JSON-Schema,
and smoke test. The CPU API image never absorbs a GPU dependency graph.
---
## 1. What exists today (do not rebuild)
| Path | State | Role |
|---|---|---|
| `external/ComfyUI` | `candidate` | Graph execution engine (GPL-3.0, isolated) |
| `external/comfyui-deploy` | `adapter-active` | Versioned workflow control plane (AGPL) — the live B-roll seam |
| `external/Wan2.2` | `candidate` | Primary open T2V/I2V model family |
| `external/Wan2GP`, `external/VideoX-Fun`, `external/ViewComfy` | `reference` | Low-VRAM / training / hosting-UX research |
| `external/VideoTuna`, `external/hyvideo` | `rejected-runtime` | NC / unresolved-provenance research only |
| `external/{OpenCut,Pixelle-Video,SwarmUI,FramePack,LTX-Video,VACE,HunyuanVideo,Open-Sora}` | cloned, **unregistered** | Cloned by `clone_all.sh` but not yet in `REGISTRY.md` — this plan registers them |
| `apps/api/assets/workflows/{manifests,selfhost,runninghub}` | product-owned | Pinned graph manifests + schemas (the artifact target) |
| `apps/api/app/domains/broll/providers/*` | product-owned | `BrollGenProvider` adapter registry |
| `apps/api/app/services/avatar/*` | product-owned | `TalkingHeadProvider` adapter registry (HeyGen, LatentSync-RunPod) |
**Convention seam this plan targets:** every new GPU repo becomes a
`external/workers/<cap>/` package that produces an image a RunPod/K8s endpoint
runs; a matching adapter lands in `apps/api` implementing the existing
`BrollGenProvider` / `TalkingHeadProvider` / (new) `AsyncGpuProvider` protocol;
the graph + weight pins land as an `apps/api/assets/workflows` manifest.
---
## 2. New top-level layout under `external/`
```
external/
├── REGISTRY.md # EXISTS — extend with §2 table + assessments below
├── clone_all.sh # EXISTS — extend / superseded by _meta/scripts/clone_v2.sh
├── clone.log # EXISTS
│
├── _meta/ # NEW — governance, pinning, license & security tooling
│ ├── pins.lock.yaml # canonical {repo → url,commit,tag,tree_sha,cloned_at,state}
│ ├── licenses.yaml # per-repo software license + per-weight license class
│ ├── update-policy.md # pin cadence, security-patch SLA, upgrade runbook
│ ├── adoption-decisions/ # one dated decision record per state transition
│ │ ├── _TEMPLATE.md
│ │ └── 2026-08-… .md
│ ├── scripts/
│ │ ├── clone_v2.sh # supersedes clone_all.sh; drives pins.lock.yaml
│ │ ├── pin.py # resolve HEAD→commit, write pins.lock.yaml
│ │ ├── verify_pins.py # assert working tree == pinned commit (CI gate)
│ │ ├── license_scan.py # scan LICENSE/COPYING, emit licenses.yaml diff
│ │ ├── weights_manifest.py # enumerate model weights + their licenses per repo
│ │ ├── vuln_scan.sh # trivy/grype over built worker images
│ │ ├── upstream_diff.py # report drift vs pinned commit before upgrade
│ │ └── sbom.py # CycloneDX SBOM per worker image
│ └── templates/ # scaffolding copied when adding a new worker
│ ├── worker/ # Dockerfile+handler+schema+smoke skeleton
│ └── service/ # compose+config+contract skeleton
│
├── workers/ # NEW — isolated GPU capability images (built from pinned source)
│ ├── _contract/ # the shared async-GPU job envelope + shim libs
│ ├── comfyui-runtime/ # base ComfyUI serving image + node allowlist
│ ├── comfy-nodes/ # pinned custom-node commits (allowlist)
│ ├── wan22-t2v/ wan22-i2v/ wan22-flf2v/
│ ├── wan-camera/ # kijai WanVideoWrapper camera-control graph
│ ├── ltx-video/ cogvideox/ hunyuanvideo/ framepack/
│ ├── frame-interp/ video-helper/
│ ├── whisperx/ faster-whisper/
│ ├── chatterbox/ kokoro/ coqui-xtts/ f5-tts/
│ ├── musetalk/ latentsync/ sadtalker/ infinitetalk/
│ └── mmaudio/
│
├── render/ # NEW — programmatic render engines (Node, not GPU)
│ ├── revideo/ remotion/ opencut-edl/
│
├── services/ # NEW — self-hosted service adapters (compose + config)
│ ├── postiz/ mixpost/ n8n/ activepieces/
│ ├── lago/ openmeter/
│ └── posthog/ listmonk/ calcom/
│
├── ingest/ # NEW — trend + URL ingestion scrapers
│ ├── tiktok-api/ tiktok-trending-actions/ ogohogo-trending/
│ ├── hashtag-analysis/ yt-dlp/
│
├── film-blueprints/ # NEW — orchestration structure to PORT (not run)
│ ├── vimax/ micro-drama-generator/ open-source-cinema/
│
├── story-bots/ # NEW — Reddit/story pipelines to port (GPL isolated)
│ ├── reddit-video-maker-bot/ fully-automated-reddit/ thread-2-tok/
│ └── ai-youtube-shorts/
│
├── gateway-refs/ # NEW — provisioning-key references (reference-only)
│ ├── openrouter-key-manager/ class-key-provisioner/ go-openrouter/
│
└── timeline/ # NEW — NLE interop
├── opentimelineio/ davinci-resolve-mcp/
```
**Directory-count summary of NEW work:** 12 first-level new dirs (`_meta`,
`workers`, `render`, `services`, `ingest`, `film-blueprints`, `story-bots`,
`gateway-refs`, `timeline`, plus the `workers/_contract`, `workers/comfyui-runtime`,
`workers/comfy-nodes` infra dirs), fanning out to the per-capability subdirs
enumerated below.
---
## 3. The async-GPU job envelope (`external/workers/_contract/`)
This is the single most important seam. It generalizes the `runpod-workers/worker-comfyui`
poll/webhook pattern and the existing `latentsync_runpod.py` flow
(`IN_QUEUE → IN_PROGRESS → COMPLETED/FAILED`) into **one envelope every worker
implements**, so the `apps/api` adapter layer is model-agnostic and the router
can fan a film's shots across heterogeneous backends.
| Path | Responsibility |
|---|---|
| `workers/_contract/README.md` | The envelope spec: states, request/response schema, webhook auth, warm-pool contract |
| `workers/_contract/job_envelope.schema.json` | Canonical request/response JSON-Schema (`status ∈ {IN_QUEUE,IN_PROGRESS,COMPLETED,FAILED,CANCELLED,TIMED_OUT}`) |
| `workers/_contract/handler_base.py` | `BaseHandler`: parse input → validate against schema → stream progress → upload output → emit COMPLETED; never raises past the boundary |
| `workers/_contract/progress.py` | Progress/heartbeat emitter (percent, stage, ETA) for poll + webhook |
| `workers/_contract/output_sink.py` | Output upload contract (presigned R2/S3 PUT); worker never holds product creds long-term |
| `workers/_contract/warmpool.py` | Warm-start model cache contract (network-volume mount, model-in-RAM keepalive) |
| `workers/_contract/idempotency.py` | `client_job_id` dedupe so retried dispatch never double-charges the wallet |
| `workers/_contract/errors.py` | Typed failure taxonomy (`OOM`, `BAD_INPUT`, `MODEL_LOAD`, `TIMEOUT`, `CONTENT_BLOCKED`) mapped to product domain errors |
| `workers/_contract/safety.py` | Pre/post content-safety hook interface (NSFW/likeness gate) |
| `workers/_contract/costmeter.py` | GPU-seconds + output-unit meter emitted on COMPLETED (feeds success-only billing) |
| `workers/_contract/health.py` | `/healthz` + `/readyz` (model-loaded) probe shared by all workers |
| `workers/_contract/smoke_base.py` | Shared smoke-test harness (golden input → schema-valid output assertion) |
**Product-side seam (in `apps/api`, listed for completeness — not built here):**
a new `app/domains/media/async_gpu/base.py::AsyncGpuProvider` protocol that
`BrollGenProvider` and `TalkingHeadProvider` both specialize, plus a
`RunpodEnvelopeClient` that speaks §3 and is reused by every adapter.
---
## 4. Per-capability worker package template
Every `external/workers/<cap>/` package contains the **same file skeleton** (copied
from `_meta/templates/worker/`), so adding a model is mechanical and reviewable:
| File (per worker) | Responsibility |
|---|---|
| `Dockerfile` | Build image from pinned upstream source + `requirements.lock`; CUDA/torch base pinned |
| `handler.py` | Implements `_contract.handler_base.BaseHandler` for this model (load, infer, upload) |
| `requirements.lock` | Fully-pinned Python deps (hash-locked) for reproducible builds |
| `model_manifest.yaml` | Model name/revision/precision, weights license class, VRAM envelope, download source |
| `input_schema.json` | JSON-Schema for this capability's inputs (bounds, enums, safe defaults) |
| `output_schema.json` | JSON-Schema for outputs (container, codec, duration, node map) |
| `endpoint.yaml` | Serverless endpoint config (GPU type, min/max workers, idle timeout, network volume) |
| `smoke_test.py` | Golden-input → assert schema-valid, deterministic-enough output |
| `DECISION.md` | Dated adoption record per `REGISTRY.md §5` (provenance, license, arch, security, ops, quality) |
| `README.md` | What it wraps, upstream commit, adapter it feeds, license gate, on/off flag |
ComfyUI-graph-backed workers additionally carry:
| File | Responsibility |
|---|---|
| `graph/<name>.api.json` | Pinned ComfyUI **API-format** workflow (immutable) |
| `graph/<name>.sha256` | Checksum enforced by `verify_pins.py` and the product manifest |
| `nodes.lock.yaml` | Exact custom-node repo commits this graph requires (subset of `comfy-nodes/allowlist.yaml`) |
The **product-facing manifest** for each graph lives in
`apps/api/assets/workflows/manifests/<id>.yaml` (existing convention), pointing at
the `graph/*.api.json` checksum — keeping graph *pins* in `external/` and graph
*dispatch policy* in product source, exactly as `runninghub-wan22-candidate-v1.yaml`
does today.
---
## 5. Worker packages — the GPU tier (license-first)
Grouped by the router's tier taxonomy. **License class** drives whether the image
is built for paying users by default.
### 5.1 Diffusion video (T2V / I2V / keyframe)
| Package | Upstream (clone list) | License class | Router tier | Wraps behind |
|---|---|---|---|---|
| `workers/wan22-t2v` | `Wan-Video/Wan2.2` (vendored) | Apache-2.0 code / weights reviewed | photorealism/consistency | `BrollGenProvider(mode=t2v)` |
| `workers/wan22-i2v` | `Wan-Video/Wan2.2` | Apache-2.0 | first-frame→motion | `BrollGenProvider(mode=i2v)` / film I2V |
| `workers/wan22-flf2v` | `Wan-Video/Wan2.2` + `kijai/ComfyUI-WanVideoWrapper` + `Fannovel16/ComfyUI-Frame-Interpolation` | Apache-2.0 | start+end keyframe → 81f + RIFE/FILM 2x + upscale | film FLF2V shot renderer |
| `workers/wan-camera` | `kijai/ComfyUI-WanVideoWrapper` | Apache-2.0 (nodes) | native camera-motion control | Higgsfield-class camera presets at generate |
| `workers/ltx-video` | `Lightricks/LTX-Video` | Apache-2.0 | **speed** tier / animatic drafts | `BrollGenProvider(mode=t2v, tier=fast)` |
| `workers/cogvideox` | `THUDM/CogVideoX` | Apache-2.0 | **low-VRAM** tier | modest-hardware fallback |
| `workers/hunyuanvideo` | `Tencent-Hunyuan/HunyuanVideo` (vendored clone) | **Community License — territorial** | cinematic, **gated** | router `license_class=territorial`, off for paying by default |
| `workers/framepack` | `lllyasviel/FramePack` (vendored clone) | Apache-2.0 | long-form / next-frame prediction | long faceless-channel segments |
### 5.2 Frame interpolation & assembly (ComfyUI node images)
| Package | Upstream | License | Responsibility |
|---|---|---|---|
| `workers/frame-interp` | `Fannovel16/ComfyUI-Frame-Interpolation` | RIFE/FILM node licenses tracked per-model | RIFE + Google FILM 2x smoothing after FLF2V |
| `workers/video-helper` | `Kosinkadink/ComfyUI-VideoHelperSuite` | node license | load/combine/encode nodes underpinning graph assembly |
| `workers/comfyui-runtime` | `comfyanonymous/ComfyUI` (vendored) | GPL-3.0 (isolated image) | base serving image; hosts the above graphs; **no client workflow upload** |
### 5.3 Captioning / ASR
| Package | Upstream | License | Responsibility |
|---|---|---|---|
| `workers/whisperx` | `m-bain/whisperX` | BSD-2 (code); weights per-model | Two-stage transcribe→forced-align, word-level ±50ms JSON (decoupled from ASS styling) |
| `workers/faster-whisper` | `SYSTRAN/faster-whisper` | MIT | CTranslate2 batched backend powering WhisperX + the long→clips highlight detector |
WhisperX feeds the existing `app/services/captions/{words,ass_karaoke,presets}.py`
Hormozi pipeline — this worker returns **word JSON only**; ASS styling stays product-side.
### 5.4 TTS (voice)
| Package | Upstream | License class | Router policy |
|---|---|---|---|
| `workers/chatterbox` | `resemble-ai/chatterbox` | **MIT — commercial-safe** | default clone/emotion voice; 5s consent-gated enrollment |
| `workers/kokoro` | `hexgrad/kokoro` | **Apache-2.0 — CPU** | zero-cost **draft-narration** tier; upgrades to Chatterbox/cloud on final render |
| `workers/coqui-xtts` | `idiap/coqui-ai-TTS` | **non-commercial (XTTS-v2)** | `license_class=non_commercial`, excluded for paying users |
| `workers/f5-tts` | `SWivid/F5-TTS` | **CC-BY-NC** | `license_class=non_commercial`, excluded for paying users |
### 5.5 Lipsync / avatars
| Package | Upstream | License class | Router tier |
|---|---|---|---|
| `workers/musetalk` | `TMElyralab/MuseTalk` | MIT | realtime 30fps **safe-default** avatar tier |
| `workers/latentsync` | `bytedance/LatentSync` | Apache-2.0 | **best-fidelity** tier (already has `latentsync_runpod.py` adapter — this pins its worker image) |
| `workers/sadtalker` | `OpenTalker/SadTalker` | Apache-2.0 | low-cost single-image tier (existing stub) |
| `workers/infinitetalk` | `MeiGen-AI/InfiniteTalk` + vendored `Wan2GP` | infinite-length; component licenses tracked | multi-speaker, infinite-length dialogue for long-form faceless channels |
MuseTalk/LatentSync/SadTalker all register into the existing
`TalkingHeadProvider` registry so the router picks realtime-vs-fidelity by cost-cap.
### 5.6 Audio design
| Package | Upstream | License | Responsibility |
|---|---|---|---|
| `workers/mmaudio` | `hkchengrex/MMAudio` | MIT (code); weights tracked | video→Foley/SFX sync per shot, auto-ducked under dialogue in the film pipeline |
**Per-worker file count:** ~10 base files + (ComfyUI graph workers) 3 graph files.
22 worker packages ≈ **~230 files**.
---
## 6. Render engines (`external/render/` — Node, non-GPU)
Programmatic, data-driven template rendering — the layer that turns a
shot-template + captions JSON into a deterministic MP4 without GPU time, with a
live preview before committing generation spend.
| Path | Responsibility |
|---|---|
| `render/revideo/DECISION.md` | Adoption record (self-host, license-friendly) |
| `render/revideo/pin.yaml` | `redotvideo/revideo` pinned commit |
| `render/revideo/service/Dockerfile` | Headless Revideo render service image |
| `render/revideo/service/render_contract.md` | `{scene, props JSON} → mp4` HTTP contract the product template engine calls |
| `render/revideo/scenes/README.md` | Where product template→scene compilers land (product owns scene code) |
| `render/revideo/smoke.mjs` | Golden props → frame-hash assertion |
| `render/remotion/DECISION.md` | Adoption record — **paid commercial license gate** flagged |
| `render/remotion/pin.yaml` | `remotion-dev/remotion` pin |
| `render/remotion/service/Dockerfile` | Remotion Lambda/render worker image |
| `render/remotion/license-gate.md` | Commercial-license requirement + entitlement check before enable |
| `render/opencut-edl/DECISION.md` | OpenCut EDL interop (vendored basis of the editor) — keep our own render path |
| `render/opencut-edl/edl_bridge.md` | Map OpenCut project JSON ↔ product EDL; render stays product-owned |
**Seam:** feeds the `apps/api/reelforge/templates` shot-template engine and the
`Revideo/Remotion data-driven template + React Player preview` backlog item. GPU
generation output (§5) is *composited* by this layer, not the other way round.
---
## 7. Service adapters (`external/services/` — self-hosted, HTTP)
Self-hosted services ReelForge deploys separately and talks to over HTTP. Each
dir is an **operator package** (compose + config template + contract), never
imported.
| Path | Responsibility |
|---|---|
| `services/postiz/DECISION.md` | AGPL scheduler; **study OAuth adapters + queue, never proxy customer keys** |
| `services/postiz/pin.yaml` | `gitroomhq/postiz-app` pin |
| `services/postiz/docker-compose.yml` | Isolated Postiz deployment (Postgres+Redis) |
| `services/postiz/env.template` | Per-platform OAuth app credentials (server-side only) |
| `services/postiz/adapter-contract.md` | Which endpoints the publishing hub calls; MCP-server surface mapping |
| `services/postiz/watermark-note.md` | Publish path must consume watermark-safe masters (§ foreign-watermark penalty) |
| `services/mixpost/DECISION.md` | Laravel self-host scheduler — scheduling UX reference |
| `services/mixpost/{pin.yaml,docker-compose.yml,adapter-contract.md}` | Deploy + container/publish flow reference |
| `services/n8n/DECISION.md` | Workflow automation backbone for scheduled publish + trend cron |
| `services/n8n/{pin.yaml,docker-compose.yml}` | Isolated n8n deployment |
| `services/n8n/flows/` | Exported flow JSON: trend-snapshot cron, publish-fanout, retry-backoff |
| `services/activepieces/{DECISION.md,pin.yaml,docker-compose.yml}` | Alternative automation backbone (social + webhook pieces) |
| `services/lago/DECISION.md` | AGPLv3 metering/invoicing/dunning/tax — pairs with in-house real-time wallet |
| `services/lago/{pin.yaml,docker-compose.yml,env.template}` | Isolated Lago deployment |
| `services/lago/bridge-contract.md` | **Wallet stays authoritative for pre-block gating; Lago does invoices/entitlements/tax only** — event mapping (usage→Lago event), reconciliation, no double-count |
| `services/openmeter/{DECISION.md,pin.yaml,docker-compose.yml}` | High-throughput metering alt/complement to Lago's ingestion layer |
| `services/posthog/{DECISION.md,pin.yaml,docker-compose.yml}` | Instrument the 3–5min activation funnel + onboarding A/B + feature flags |
| `services/listmonk/{DECISION.md,pin.yaml,docker-compose.yml}` | Self-hosted affiliate/referral + creator-growth email broadcasts |
| `services/calcom/{DECISION.md,pin.yaml}` | Reference for OSS reseller/white-label + seat-billing patterns (reference-only) |
**Seams:** Postiz/Mixpost/n8n → `apps/api/reelforge/publishing`; Lago/OpenMeter →
`apps/api/reelforge/gateway` (Lago bridge, success-only billing); PostHog/listmonk/Cal.com
→ growth/marketplace/reseller surfaces.
---
## 8. Trend & URL ingestion (`external/ingest/`)
| Path | Responsibility |
|---|---|
| `ingest/tiktok-api/DECISION.md` | `davidteather/TikTok-Api` — **ToS-risky**, sanctioned Research API preferred; state `reference` |
| `ingest/tiktok-api/{pin.yaml,adapter-contract.md,rate-limits.md}` | Wrapper contract + guardrails feeding the trend DB |
| `ingest/tiktok-trending-actions/DECISION.md` | `antiops/tiktok-trending-data` — 15-min GH-Actions Discovery scraper (cron snapshot pattern) |
| `ingest/tiktok-trending-actions/{pin.yaml,cron-pattern.md}` | Snapshot-into-trend-DB pattern |
| `ingest/ogohogo-trending/{DECISION.md,pin.yaml,adapter-contract.md}` | `ogohogo/tiktok-trending-data-api` — hourly users/hashtags/sounds alt source |
| `ingest/hashtag-analysis/{DECISION.md,pin.yaml,contract.md}` | `bellingcat/tiktok-hashtag-analysis` — co-occurrence for keyword/trend feed |
| `ingest/yt-dlp/DECISION.md` | `yt-dlp/yt-dlp` — URL→reel ingest + repurpose source download |
| `ingest/yt-dlp/{pin.yaml,worker/Dockerfile,worker/handler.py,ssrf-policy.md}` | Isolated download worker; SSRF-safe URL fetch, size/duration caps |
**Seam:** all emit into a normalized trend/snapshot schema consumed by
`apps/api/reelforge/publishing` (trend & sound ingestion, saturation/decay score)
and the `trend-audio-remix` / `url-to-recap-reel` templates. yt-dlp also powers
existing URL→reel ingest and the long→clips repurpose detector.
---
## 9. Film orchestration blueprints (`external/film-blueprints/` — port, don't run)
Structural blueprints to *port* into `apps/api/reelforge/film`, not runtime deps.
| Path | Responsibility |
|---|---|
| `film-blueprints/vimax/DECISION.md` | `HKUDS/ViMax` — Director/Screenwriter/Producer/Editor agent structure + AutoCameo; **primary blueprint** |
| `film-blueprints/vimax/port-map.md` | Which ViMax modules map to which `reelforge/film` files; cross-shot consistency + Narrative Context Protocol lineage |
| `film-blueprints/vimax/pin.yaml` | Pinned commit for reference |
| `film-blueprints/micro-drama-generator/DECISION.md` | `Anil-matcha/Open-AI-Micro-Drama-Generator` — 4-agent screenwriter→storyboard→generate |
| `film-blueprints/micro-drama-generator/port-map.md` | flux-dev + flux-kontext-i2i + kling-i2v + MoviePy → route each stage through ReelForge router + wallet-meter per shot |
| `film-blueprints/micro-drama-generator/pin.yaml` | Pinned commit |
| `film-blueprints/open-source-cinema/DECISION.md` | `ismael-joffroy-chandoutis/open-source-cinema` — curated OSS gen-film catalog; **research map, not a dependency** |
| `film-blueprints/open-source-cinema/mined-catalog.md` | Extracted candidate tools to re-evaluate over time |
---
## 10. Story/Reddit pipelines (`external/story-bots/` — GPL, isolate & port)
| Path | Responsibility |
|---|---|
| `story-bots/reddit-video-maker-bot/DECISION.md` | `reddit-Video-Maker-bot/…` — **GPL-3.0, keep isolated**; port narration + comment-mode logic into `templates` (Minecraft-Split) |
| `story-bots/reddit-video-maker-bot/{pin.yaml,port-map.md,gpl-isolation.md}` | Port map + GPL isolation boundary (no linking into product image) |
| `story-bots/fully-automated-reddit/DECISION.md` | `raga70/FullyAutomatedRedditVideoMakerBot` — auto-uploaders + one-word captions + ElevenLabs key rotator |
| `story-bots/fully-automated-reddit/{pin.yaml,reference-notes.md}` | Publishing-hub + caption-engine reference only |
| `story-bots/thread-2-tok/{DECISION.md,pin.yaml,reference-notes.md}` | `3milyfz/thread-2-tok` — simple PRAW→narrated-Minecraft (Flask+FFmpeg+9:16) reference |
| `story-bots/ai-youtube-shorts/DECISION.md` | `SamurAIGPT/AI-Youtube-Shorts-Generator` — OSS OpusClip alt (LLM highlight + Whisper + vertical crop) |
| `story-bots/ai-youtube-shorts/port-map.md` | Basis for the long→clips highlight detector in `repurpose` |
---
## 11. Gateway/provisioning references (`external/gateway-refs/` — reference-only)
| Path | Responsibility |
|---|---|
| `gateway-refs/openrouter-key-manager/{DECISION.md,pin.yaml,reference-notes.md}` | `humphd/openrouter-key-manager` — bulk spend-capped key creation from CSV; distribution-flow reference |
| `gateway-refs/class-key-provisioner/{DECISION.md,pin.yaml,reference-notes.md}` | `Denubis/openrouter-class-key-provisioner` — batch provisioning + credit limits + audit trail (agency bulk keys) |
| `gateway-refs/go-openrouter/{DECISION.md,pin.yaml,reference-notes.md}` | `reVrost/go-openrouter` — key-management CRUD surface pattern for our management API |
**Seam:** informs `apps/api/reelforge/gateway` provisioning/management keys
(per-customer spend-capped sub-keys, midnight-UTC resets, BYOK-in-limit toggle,
reject-before-provider). Reference-only — no code adoption.
---
## 12. Timeline interop (`external/timeline/`)
| Path | Responsibility |
|---|---|
| `timeline/opentimelineio/DECISION.md` | `AcademySoftwareFoundation/OpenTimelineIO` — Apache-2.0, NLE-agnostic interchange |
| `timeline/opentimelineio/{pin.yaml,worker/Dockerfile,worker/handler.py}` | Isolated OTIO/FCPXML export/convert service |
| `timeline/opentimelineio/adapter-contract.md` | Product EDL → OTIO/FCPXML export contract |
| `timeline/davinci-resolve-mcp/{DECISION.md,pin.yaml,bridge-contract.md}` | `samuelgursky/davinci-resolve-mcp` — MCP bridge for programmatic finishing hand-off (power users) |
---
## 13. `REGISTRY.md` additions (governance)
Extend the existing `§2 Registry` table with one row per repo above, and add a
`§4.x` assessment stub per repo. New rows follow the exact existing columns
(*Project | Upstream | Checked commit | Checked software license | Current state
| ReelForge relevance*). Proposed initial states:
| Project | Upstream | Initial state | License class |
|---|---|---|---|
| LTX-Video | `Lightricks/LTX-Video` | `candidate` | Apache-2.0 commercial-safe |
| CogVideoX | `THUDM/CogVideoX` | `candidate` | Apache-2.0 commercial-safe |
| HunyuanVideo | `Tencent-Hunyuan/HunyuanVideo` | `rejected-runtime` (until territorial review) | Community/territorial |
| FramePack | `lllyasviel/FramePack` | `candidate` | Apache-2.0 |
| WanVideoWrapper | `kijai/ComfyUI-WanVideoWrapper` | `candidate` | Apache-2.0 (node) |
| Frame-Interpolation | `Fannovel16/ComfyUI-Frame-Interpolation` | `candidate` | per-model (RIFE/FILM) |
| VideoHelperSuite | `Kosinkadink/ComfyUI-VideoHelperSuite` | `candidate` | node license |
| whisperX | `m-bain/whisperX` | `candidate` | BSD-2 |
| faster-whisper | `SYSTRAN/faster-whisper` | `candidate` | MIT |
| chatterbox | `resemble-ai/chatterbox` | `candidate` | MIT commercial-safe |
| kokoro | `hexgrad/kokoro` | `candidate` | Apache-2.0 |
| coqui-ai-TTS | `idiap/coqui-ai-TTS` | `rejected-runtime` (paying) | XTTS non-commercial |
| F5-TTS | `SWivid/F5-TTS` | `rejected-runtime` (paying) | CC-BY-NC |
| MuseTalk | `TMElyralab/MuseTalk` | `candidate` | MIT |
| LatentSync | `bytedance/LatentSync` | `adapter-active` | Apache-2.0 |
| SadTalker | `OpenTalker/SadTalker` | `adapter-active` | Apache-2.0 |
| InfiniteTalk | `MeiGen-AI/InfiniteTalk` | `candidate` | component-tracked |
| MMAudio | `hkchengrex/MMAudio` | `candidate` | MIT |
| revideo | `redotvideo/revideo` | `candidate` | license-friendly |
| remotion | `remotion-dev/remotion` | `candidate` (license-gated) | paid commercial |
| OpenCut | `OpenCut-app/OpenCut` | `adapter-active` | MIT (vendored editor) |
| postiz-app | `gitroomhq/postiz-app` | `reference`→`adapter-active` | AGPL (never proxy keys) |
| mixpost | `inovector/mixpost` | `reference` | Laravel |
| n8n | `n8n-io/n8n` | `candidate` | Sustainable-Use |
| activepieces | `activepieces/activepieces` | `candidate` | MIT/community |
| lago | `getlago/lago` | `candidate` | AGPLv3 |
| openmeter | `openmeterio/openmeter` | `reference` | Apache-2.0 |
| posthog | `PostHog/posthog` | `candidate` | MIT/community |
| listmonk | `knadh/listmonk` | `candidate` | AGPLv3 |
| cal.com | `calcom/cal.com` | `reference` | AGPLv3 |
| TikTok-Api | `davidteather/TikTok-Api` | `reference` (ToS-risky) | MIT |
| tiktok-trending-data | `antiops/…` | `reference` | scraper |
| tiktok-trending-data-api | `ogohogo/…` | `reference` | scraper |
| tiktok-hashtag-analysis | `bellingcat/…` | `reference` | GPL |
| yt-dlp | `yt-dlp/yt-dlp` | `candidate` | Unlicense |
| ViMax | `HKUDS/ViMax` | `reference` | blueprint |
| Micro-Drama-Generator | `Anil-matcha/…` | `reference` | blueprint |
| open-source-cinema | `ismael-…/…` | `reference` | research map |
| reddit-video-maker-bot | `…/reddit-video-maker-bot` | `reference` (GPL-isolated) | GPL-3.0 |
| FullyAutomatedReddit… | `raga70/…` | `reference` | reference |
| thread-2-tok | `3milyfz/thread-2-tok` | `reference` | reference |
| AI-Youtube-Shorts | `SamurAIGPT/…` | `reference` | reference |
| openrouter-key-manager | `humphd/…` | `reference` | reference |
| class-key-provisioner | `Denubis/…` | `reference` | reference |
| go-openrouter | `reVrost/…` | `reference` | reference |
| OpenTimelineIO | `AcademySoftwareFoundation/…` | `candidate` | Apache-2.0 |
| davinci-resolve-mcp | `samuelgursky/…` | `reference` | MCP bridge |
| worker-comfyui | `runpod-workers/worker-comfyui` | `reference`→pattern | envelope template |
---
## 14. Pinning & update strategy
| Concern | Rule |
|---|---|
| Pin format | `_meta/pins.lock.yaml` records `{url, commit, tag, tree_sha, cloned_at, state, license_class}` per repo — the single source of truth |
| Clone | `_meta/scripts/clone_v2.sh` reads `pins.lock.yaml` (shallow, `GIT_LFS_SKIP_SMUDGE=1`, disk guard preserved from `clone_all.sh`) |
| Verify | `verify_pins.py` runs in CI: working tree HEAD must equal pinned commit; graph `*.sha256` must match; fails the build on drift |
| License scan | `license_scan.py` + `weights_manifest.py` regenerate `licenses.yaml`; any `non_commercial`/`territorial` weight sets the worker's default-build flag to **off-for-paying** |
| Upgrade | `upstream_diff.py` reports drift; an upgrade requires a new `adoption-decisions/*.md` record + re-run smoke test + re-pin — never a silent `git pull` |
| Security | `vuln_scan.sh` (trivy/grype) + `sbom.py` (CycloneDX) per worker image, gated pre-publish |
| Immutability | No worker image ships from a floating branch; `requirements.lock` + base-image digest + weight revision all pinned |
| Isolation | GPL/AGPL source (ComfyUI, Postiz, Lago, listmonk, cal.com, reddit-bots) runs only as a separate network service or isolated image; never linked into the CPU API image |
---
## 15. Phasing (mirrors the digest build sequence)
| Phase | External packages | Unblocks |
|---|---|---|
| **P1 — Templates + captions (fastest ROI)** | `workers/{whisperx,faster-whisper}`, `render/{revideo,opencut-edl}`, `story-bots/*` (port) | Genre shot-templates + Hormozi captions reuse existing compose |
| **P2 — Complete the loop (the wedge)** | `services/{postiz,n8n,posthog}`, `ingest/*`, `render/remotion` | Publishing hub + scheduler + retention analytics + closed-loop A/B |
| **P3 — Resellable platform** | `services/{lago,openmeter}`, `gateway-refs/*` | Provisioning keys + markup + Lago bridge + reseller |
| **P4 — Deep film moat** | `workers/{wan22-*,wan-camera,ltx-video,cogvideox,framepack,frame-interp,video-helper,mmaudio}`, `workers/{chatterbox,kokoro,musetalk,latentsync,infinitetalk}`, `film-blueprints/*`, `timeline/*` | Screenplay→shot-list→character-lock→I2V→animatic→voice→score film pipeline |
| **P5 — Compounding acquisition** | `services/listmonk`, `gateway-refs/*` (reseller), story micro-tools | Clipping marketplace + affiliate + free micro-tools |
| **Gated / deferred** | `workers/{hunyuanvideo,coqui-xtts,f5-tts}` | Enabled only after territorial/NC review; excluded for paying users by default |
---
## 16. Integration seams (summary)
| `external/` package | Product seam (`apps/api`) | Protocol |
|---|---|---|
| `workers/wan22-*`, `ltx-video`, `cogvideox`, `framepack`, `hunyuanvideo` | `app/domains/broll/providers/*` + new `film` I2V renderer | `BrollGenProvider` / `AsyncGpuProvider` (§3) |
| `workers/{musetalk,latentsync,sadtalker,infinitetalk}` | `app/services/avatar/*` | `TalkingHeadProvider` |
| `workers/whisperx`, `faster-whisper` | `app/services/captions/*`, `repurpose` | word-JSON envelope |
| `workers/{chatterbox,kokoro,coqui-xtts,f5-tts}` | `app/services/tts/*`, `voice.py` | TTS envelope + consent gate |
| `workers/mmaudio` | film score/SFX stage | audio envelope |
| `render/{revideo,remotion,opencut-edl}` | `reelforge/templates`, editor | render contract + React Player preview |
| `services/{postiz,mixpost,n8n,activepieces}` | `reelforge/publishing` | HTTP OAuth adapters + queue |
| `services/{lago,openmeter}` | `reelforge/gateway` | Lago bridge (wallet stays authoritative) |
| `services/{posthog,listmonk,calcom}` | onboarding / marketplace / reseller | analytics + email + seat-billing refs |
| `ingest/*` | `reelforge/publishing` trend service | normalized trend snapshots |
| `film-blueprints/*`, `story-bots/*` | `reelforge/film`, `templates`, `repurpose` | ported structure (not runtime) |
| `gateway-refs/*` | `reelforge/gateway` provisioning keys | reference patterns |
| `timeline/*` | editor export | OTIO/FCPXML + Resolve MCP |
---
**Bottom line:** `external/` becomes three cleanly-separated layers — (1) a
**governance/tooling spine** (`_meta`) that pins, license-classifies, and
security-scans every repo; (2) **isolated GPU worker images** (`workers`) all
speaking one async job envelope so the router treats every model uniformly and
the license class gates commercial dispatch at the source; and (3) **self-hosted
service + reference packages** (`render`, `services`, `ingest`, `film-blueprints`,
`story-bots`, `gateway-refs`, `timeline`) that ReelForge deploys and talks to over
HTTP or ports structurally — never importing, never linking GPL/AGPL into the API
image, and never letting `external/` drift from its pins.