videogen/docs/reelforge/P3_P5_IMPLEMENTATION_PLAN.md
caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
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

62 lines
3.4 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.

# P3–P5 — module architecture & implementation plan
> Directive: real working implementations, no stubs/monkey-patches. Each item is
> a concrete module with a clear seam into existing code + tests.
## P3.1 — Compose-stage VFX render (real FFmpeg)
**Module:** `app/services/compose/vfx.py` (pure filtergraph builder).
- `build_vfx_filters(camera_motion, effects, *, intensity, fps, width, height) -> list[str]`
— maps each preset to a **valid FFmpeg filter fragment**. Camera moves use
`zoompan`/`rotate`/`crop`/`setpts`; filter-class VFX use `rgbashift`/`noise`/
`tblend`/`curves`/`vignette`/`gblur`.
- Presets split into **filter-class** (renderable now) and **overlay-class**
(explosion/confetti/rain… need generative overlay assets) — the builder emits
real filters for filter-class and cleanly skips overlay-class (logged), never a
fake filter. Overlay assets are a separate pipeline (P3.2, later).
- `build_vfx_node(..., in_label='comp', out_label='cfx') -> str` → `;[comp]f1,f2[cfx]` or ''.
**Seam:** `compose_avatar_over_screen` gains `camera_motion` + `effects` params;
the VFX node is spliced between `[comp]` and the caption burn (effects render,
captions on top). `_build_final_node(ass_path, in_label='comp')` reads the fx label.
**Wiring:** the compose stage passes `job.params['camera_motion']` + `['effects']`;
reel-create validates presets (`validate_camera_motion` / `validate_effects_stack`)
so an invalid selection is a 422 before render.
## P4 — Provider adapter breadth (real submit/poll)
**Module:** `app/domains/routing/providers/async_media.py` — a config-driven
`AsyncMediaAdapter` (one tested implementation for several async video/music
providers). Config = provider_key, base_url, submit_path, submit_body_fn,
poll_path_fn, state_field, state_map, id_field, output_field, seconds_field,
unit, capability. Real submit (POST) + poll (GET) + usage normalization; the
HTTP transport is the injectable boundary (tests pass a fake transport — that is
the network seam, not a stub of adapter logic).
**Providers:** Runway, Luma, Kling, Veo (video, seconds), Suno (music, seconds)
— each a real config. Registered in `registry.register_available_adapters` +
`build_adapter`; catalog entries already seeded.
## P5 — Commerce polish (real)
- **Tax** — `wallet/policy.build_purchase_quote` computes a configurable tax
(`reelforge_wallet_tax_bps`, default 0) instead of the 0 placeholder; the
checkout total includes it. Real integer math.
- **Invoices** — `domains/wallet/invoices.py` `InvoiceService.list_invoices` /
`get_invoice` from confirmed `payment_intents` (line items: credit, fee, tax,
total); `GET /wallet/invoices`, `GET /wallet/invoices/{id}`. Web view.
- **BYOK key UI** — web `app/settings/keys/page.tsx` over the existing
`POST/GET/DELETE /byok/keys` (secrets write-only).
- **Referral (paygo)** — `domains/wallet/referral.py`: a first-top-up referral
credit grant (append-only wallet ledger `grant` reason `referral`), idempotent
per (referrer, referee).
- **Directory hygiene** — ADR: `app/platform/providers/` as the canonical
outbound-protocol home; re-export from `domains/routing/providers` during
migration (no client import churn).
## Sequencing
P3.1 (VFX render) → P4 (async adapters) → P5 (tax → invoices → BYOK UI →
referral). Each lands with tests; migrations only where new tables are needed
(none for P3.1/P4; none for tax/invoices/referral — they reuse existing tables).